changeset 9860:7e82083caab7 libavcodec

VC-1/WMV3 decoding: don't clear blocks unless they're actually used. ~8% faster VC-1 decoding. Possible future optimization: clear blocks after use instead of before, and for DC-only blocks, only clear the DC coefficient.
author darkshikari
date Tue, 16 Jun 2009 09:09:03 +0000
parents 7a116de63777
children 89270a3bc4a0
files vc1dec.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/vc1dec.c	Tue Jun 16 09:00:55 2009 +0000
+++ b/vc1dec.c	Tue Jun 16 09:09:03 2009 +0000
@@ -1800,6 +1800,8 @@
     int scale;
     int q1, q2 = 0;
 
+    s->dsp.clear_block(block);
+
     /* XXX: Guard against dumb values of mquant */
     mquant = (mquant < 1) ? 0 : ( (mquant>31) ? 31 : mquant );
 
@@ -1989,6 +1991,8 @@
     int ttblk = ttmb & 7;
     int pat = 0;
 
+    s->dsp.clear_block(block);
+
     if(ttmb == -1) {
         ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)];
     }
@@ -2166,8 +2170,6 @@
     else
         skipped = v->s.mbskip_table[mb_pos];
 
-    s->dsp.clear_blocks(s->block[0]);
-
     apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY);
     if (!fourmv) /* 1MV mode */
     {
@@ -2459,7 +2461,6 @@
     else
         skipped = v->s.mbskip_table[mb_pos];
 
-    s->dsp.clear_blocks(s->block[0]);
     dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0;
     for(i = 0; i < 6; i++) {
         v->mb_type[0][s->block_index[i]] = 0;
@@ -2851,7 +2852,6 @@
         for(s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
             ff_init_block_index(s);
             ff_update_block_index(s);
-            s->dsp.clear_blocks(s->block[0]);
 
             vc1_decode_p_mb(v);
             if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
@@ -2901,7 +2901,6 @@
         for(s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
             ff_init_block_index(s);
             ff_update_block_index(s);
-            s->dsp.clear_blocks(s->block[0]);
 
             vc1_decode_b_mb(v);
             if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {