changeset 2632:67171616ead6 libavcodec

avoid unneeded clear_blocks()
author michael
date Mon, 25 Apr 2005 00:57:48 +0000
parents c49619ee4c35
children 72e6ffa1f3a5
files h261.c h263.c h263dec.c msmpeg4.c rv10.c wmv2.c
diffstat 6 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/h261.c	Mon Apr 25 00:10:11 2005 +0000
+++ b/h261.c	Mon Apr 25 00:57:48 2005 +0000
@@ -531,7 +531,6 @@
         xy = s->mb_x + s->mb_y * s->mb_stride;
         ff_init_block_index(s);
         ff_update_block_index(s);
-        s->dsp.clear_blocks(s->block[0]);
 
         for(j=0;j<6;j++)
             s->block_last_index[j] = -1;
@@ -606,7 +605,6 @@
     xy = s->mb_x + s->mb_y * s->mb_stride;
     ff_init_block_index(s);
     ff_update_block_index(s);
-    s->dsp.clear_blocks(s->block[0]);
 
     // Read mtype
     h->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2);
@@ -661,12 +659,16 @@
 intra:
     /* decode each block */
     if(s->mb_intra || HAS_CBP(h->mtype)){
+        s->dsp.clear_blocks(s->block[0]);
         for (i = 0; i < 6; i++) {
             if (h261_decode_block(h, s->block[i], i, cbp&32) < 0){
                 return SLICE_ERROR;
             }
             cbp+=cbp;
         }
+    }else{
+        for (i = 0; i < 6; i++)
+            s->block_last_index[i]= -1;
     }
 
     MPV_decode_mb(s, s->block);
--- a/h263.c	Mon Apr 25 00:10:11 2005 +0000
+++ b/h263.c	Mon Apr 25 00:57:48 2005 +0000
@@ -3753,6 +3753,7 @@
 
     if (!IS_SKIP(mb_type)) {
         int i;
+        s->dsp.clear_blocks(s->block[0]);
         /* decode each block */
         for (i = 0; i < 6; i++) {
             if(mpeg4_decode_block(s, block[i], i, cbp&32, s->mb_intra, s->rvlc) < 0){
@@ -3921,6 +3922,8 @@
             }
         }while(cbpc == 20);
         
+        s->dsp.clear_blocks(s->block[0]);
+        
         dquant = cbpc & 8;
         s->mb_intra = ((cbpc & 4) != 0);
         if (s->mb_intra) goto intra;
@@ -4024,6 +4027,7 @@
 
         s->mb_intra = IS_INTRA(mb_type);
         if(HAS_CBP(mb_type)){
+            s->dsp.clear_blocks(s->block[0]);
             cbpc = get_vlc2(&s->gb, cbpc_b_vlc.table, CBPC_B_VLC_BITS, 1);
             if(s->mb_intra){
                 dquant = IS_QUANT(mb_type);
@@ -4102,6 +4106,8 @@
             }
         }while(cbpc == 8);
 
+        s->dsp.clear_blocks(s->block[0]);
+
         dquant = cbpc & 4;
         s->mb_intra = 1;
 intra:
@@ -4193,6 +4199,7 @@
             }
         }while(cbpc == 20);
         
+        s->dsp.clear_blocks(s->block[0]);
         dquant = cbpc & 8;
         s->mb_intra = ((cbpc & 4) != 0);
         if (s->mb_intra) goto intra;
@@ -4324,7 +4331,10 @@
             }
             mb_type= mb_type_b_map[ mb_type ];
             if(modb2) cbp= 0;
-            else      cbp= get_bits(&s->gb, 6);
+            else{
+                s->dsp.clear_blocks(s->block[0]);
+                cbp= get_bits(&s->gb, 6);
+            }
 
             if ((!IS_DIRECT(mb_type)) && cbp) {
                 if(get_bits1(&s->gb)){
@@ -4442,6 +4452,7 @@
         if(!s->progressive_sequence)
             s->interlaced_dct= get_bits1(&s->gb);
 
+        s->dsp.clear_blocks(s->block[0]);
         /* decode each block */
         for (i = 0; i < 6; i++) {
             if (mpeg4_decode_block(s, block[i], i, cbp&32, 1, 0) < 0)
--- a/h263dec.c	Mon Apr 25 00:10:11 2005 +0000
+++ b/h263dec.c	Mon Apr 25 00:57:48 2005 +0000
@@ -195,8 +195,7 @@
             }
 
             /* DCT & quantize */
-	    s->dsp.clear_blocks(s->block[0]);
-            
+           
             s->mv_dir = MV_DIR_FORWARD;
             s->mv_type = MV_TYPE_16X16;
 //            s->mb_skipped = 0;
--- a/msmpeg4.c	Mon Apr 25 00:10:11 2005 +0000
+++ b/msmpeg4.c	Mon Apr 25 00:57:48 2005 +0000
@@ -1552,6 +1552,7 @@
         }
     }
 
+    s->dsp.clear_blocks(s->block[0]);
     for (i = 0; i < 6; i++) {
         if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
 	{
@@ -1644,6 +1645,7 @@
         }
     }
 
+    s->dsp.clear_blocks(s->block[0]);
     for (i = 0; i < 6; i++) {
         if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
 	{
--- a/rv10.c	Mon Apr 25 00:10:11 2005 +0000
+++ b/rv10.c	Mon Apr 25 00:57:48 2005 +0000
@@ -669,7 +669,6 @@
         printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y);
 #endif
 
-	s->dsp.clear_blocks(s->block[0]);
         s->mv_dir = MV_DIR_FORWARD;
         s->mv_type = MV_TYPE_16X16; 
         ret=ff_h263_decode_mb(s, s->block);
--- a/wmv2.c	Mon Apr 25 00:10:11 2005 +0000
+++ b/wmv2.c	Mon Apr 25 00:57:48 2005 +0000
@@ -760,6 +760,7 @@
         wmv2_pred_motion(w, &mx, &my);
         
         if(cbp){
+            s->dsp.clear_blocks(s->block[0]);
             if(s->per_mb_rl_table){
                 s->rl_table_index = decode012(&s->gb);
                 s->rl_chroma_table_index = s->rl_table_index;
@@ -802,6 +803,7 @@
             s->rl_chroma_table_index = s->rl_table_index;
         }
     
+        s->dsp.clear_blocks(s->block[0]);
         for (i = 0; i < 6; i++) {
             if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
 	    {