]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_cavlc.c
Optimize top non_zero_count_cache init.
[ffmpeg] / libavcodec / h264_cavlc.c
index 8cf188dd0601284364668df7ab0525354d9062c7..86ee926b5c2735c520491098332373ab0c04bf2c 100644 (file)
@@ -25,6 +25,8 @@
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
+#define CABAC 0
+
 #include "internal.h"
 #include "avcodec.h"
 #include "mpegvideo.h"
 //#undef NDEBUG
 #include <assert.h>
 
-static const uint8_t golomb_to_intra4x4_cbp[48]={
- 47, 31, 15,  0, 23, 27, 29, 30,  7, 11, 13, 14, 39, 43, 45, 46,
- 16,  3,  5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44,  1,  2,  4,
-  8, 17, 18, 20, 24,  6,  9, 22, 25, 32, 33, 34, 36, 40, 38, 41
-};
-
-static const uint8_t golomb_to_inter_cbp[48]={
-  0, 16,  1,  2,  4,  8, 32,  3,  5, 10, 12, 15, 47,  7, 11, 13,
- 14,  6,  9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46,
- 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41
-};
-
 static const uint8_t golomb_to_inter_cbp_gray[16]={
  0, 1, 2, 4, 8, 3, 5,10,12,15, 7,11,13,14, 6, 9,
 };
@@ -630,7 +620,7 @@ decode_intra_mb:
         // In deblocking, the quantizer is 0
         s->current_picture.qscale_table[mb_xy]= 0;
         // All coeffs are present
-        memset(h->non_zero_count[mb_xy], 16, 16);
+        memset(h->non_zero_count[mb_xy], 16, 32);
 
         s->current_picture.mb_type[mb_xy]= mb_type;
         return 0;
@@ -641,7 +631,7 @@ decode_intra_mb:
         h->ref_count[1] <<= 1;
     }
 
-    fill_caches(h, mb_type, 0);
+    fill_decode_caches(h, mb_type);
 
     //mb_pred
     if(IS_INTRA(mb_type)){
@@ -921,14 +911,14 @@ decode_intra_mb:
             else                     cbp= golomb_to_inter_cbp_gray[cbp];
         }
     }
-    h->cbp = cbp;
 
     if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){
         if(get_bits1(&s->gb)){
             mb_type |= MB_TYPE_8x8DCT;
-            h->cbp_table[mb_xy]= cbp;
         }
     }
+    h->cbp=
+    h->cbp_table[mb_xy]= cbp;
     s->current_picture.mb_type[mb_xy]= mb_type;
 
     if(cbp || IS_INTRA16x16(mb_type)){