summaryrefslogtreecommitdiff
path: root/libavcodec/vp3.c
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2009-09-22 15:58:08 +0000
committerMike Melanson <mike@multimedia.cx>2009-09-22 15:58:08 +0000
commit138fe832152d4b30528933ca681b39831dd94569 (patch)
treeb34b3d32f0fed9ff232d0f984e1d3ea5bf99d869 /libavcodec/vp3.c
parent71e4218054c7547f17864a9e6c8ba9306cbdd391 (diff)
Perform the DC prediction reversal immediately after decoding all of
the DC coefficients. This has a greater probability of leveraging the coefficients while they are still cached. When testing with the Big Buck Bunny 1080p video, I consistently saw improvements of 500k-600k dezicycles per run (through reverse_dc_prediction()) thanks to this move. Originally committed as revision 19966 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r--libavcodec/vp3.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 0f4f6dafb3..e2b17062dd 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1099,6 +1099,10 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
return eob_run;
}
+static void reverse_dc_prediction(Vp3DecodeContext *s,
+ int first_fragment,
+ int fragment_width,
+ int fragment_height);
/*
* This function unpacks all of the DCT coefficient data from the
* bitstream.
@@ -1120,10 +1124,22 @@ static int unpack_dct_coeffs(Vp3DecodeContext *s, GetBitContext *gb)
residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_y_table], 0,
s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run);
+ /* reverse prediction of the Y-plane DC coefficients */
+ reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height);
+
/* unpack the C plane DC coefficients */
residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_c_table], 0,
s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run);
+ /* reverse prediction of the C-plane DC coefficients */
+ if (!(s->avctx->flags & CODEC_FLAG_GRAY))
+ {
+ reverse_dc_prediction(s, s->fragment_start[1],
+ s->fragment_width / 2, s->fragment_height / 2);
+ reverse_dc_prediction(s, s->fragment_start[2],
+ s->fragment_width / 2, s->fragment_height / 2);
+ }
+
/* fetch the AC table indexes */
ac_y_table = get_bits(gb, 4);
ac_c_table = get_bits(gb, 4);
@@ -1996,14 +2012,6 @@ static int vp3_decode_frame(AVCodecContext *avctx,
return -1;
}
- reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height);
- if ((avctx->flags & CODEC_FLAG_GRAY) == 0) {
- reverse_dc_prediction(s, s->fragment_start[1],
- s->fragment_width / 2, s->fragment_height / 2);
- reverse_dc_prediction(s, s->fragment_start[2],
- s->fragment_width / 2, s->fragment_height / 2);
- }
-
for (i = 0; i < s->macroblock_height; i++)
render_slice(s, i);