changeset 10893:2aafcafbe1f0 libavcodec

Replace cabac checks in inline functions from h264.h with constants. No benchmark because its just replacing variables with litteral constants (so no risk for slowdown outside gcc silliness) and i need sleep.
author michael
date Sat, 16 Jan 2010 05:41:33 +0000
parents e80dfe0c441b
children 4b2227257766
files h264.h h264_cabac.c h264_cavlc.c
diffstat 3 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/h264.h	Sat Jan 16 04:49:02 2010 +0000
+++ b/h264.h	Sat Jan 16 05:41:33 2010 +0000
@@ -87,6 +87,10 @@
 #define CHROMA 1
 #endif
 
+#ifndef CABAC
+#define CABAC h->pps.cabac
+#endif
+
 #define EXTENDED_SAR          255
 
 #define MB_TYPE_REF0       MB_TYPE_ACPRED //dirty but it fits in 16 bit
@@ -923,7 +927,7 @@
         h->non_zero_count_cache[2+8*0]=
 
         h->non_zero_count_cache[1+8*3]=
-        h->non_zero_count_cache[2+8*3]= h->pps.cabac && !IS_INTRA(mb_type) ? 0 : 64;
+        h->non_zero_count_cache[2+8*3]= CABAC && !IS_INTRA(mb_type) ? 0 : 64;
 
     }
 
@@ -937,11 +941,11 @@
             h->non_zero_count_cache[3+8*1 + 2*8*i]=
             h->non_zero_count_cache[3+8*2 + 2*8*i]=
             h->non_zero_count_cache[0+8*1 +   8*i]=
-            h->non_zero_count_cache[0+8*4 +   8*i]= h->pps.cabac && !IS_INTRA(mb_type) ? 0 : 64;
+            h->non_zero_count_cache[0+8*4 +   8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64;
         }
     }
 
-    if( h->pps.cabac ) {
+    if( CABAC ) {
         // top_cbp
         if(top_type) {
             h->top_cbp = h->cbp_table[top_xy];
@@ -1053,7 +1057,7 @@
             *(uint32_t*)h->mv_cache [list][scan8[4 ]]=
             *(uint32_t*)h->mv_cache [list][scan8[12]]= 0;
 
-            if( h->pps.cabac ) {
+            if( CABAC ) {
                 /* XXX beurk, Load mvd */
                 if(USES_LIST(top_type, list)){
                     const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
@@ -1210,7 +1214,7 @@
             *(uint64_t*)s->current_picture.motion_val[list][b_xy + 0 + y*h->b_stride]= *(uint64_t*)h->mv_cache[list][scan8[0]+0 + 8*y];
             *(uint64_t*)s->current_picture.motion_val[list][b_xy + 2 + y*h->b_stride]= *(uint64_t*)h->mv_cache[list][scan8[0]+2 + 8*y];
         }
-        if( h->pps.cabac ) {
+        if( CABAC ) {
             if(IS_SKIP(mb_type))
                 fill_rectangle(h->mvd_table[list][b_xy], 4, 4, h->b_stride, 0, 4);
             else
@@ -1229,7 +1233,7 @@
         }
     }
 
-    if(h->slice_type_nos == FF_B_TYPE && h->pps.cabac){
+    if(h->slice_type_nos == FF_B_TYPE && CABAC){
         if(IS_8X8(mb_type)){
             uint8_t *direct_table = &h->direct_table[b8_xy];
             direct_table[1+0*h->b8_stride] = IS_DIRECT(h->sub_mb_type[1]) ? 1 : 0;
--- a/h264_cabac.c	Sat Jan 16 04:49:02 2010 +0000
+++ b/h264_cabac.c	Sat Jan 16 05:41:33 2010 +0000
@@ -25,6 +25,8 @@
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
+#define CABAC 1
+
 #include "internal.h"
 #include "dsputil.h"
 #include "avcodec.h"
--- a/h264_cavlc.c	Sat Jan 16 04:49:02 2010 +0000
+++ b/h264_cavlc.c	Sat Jan 16 05:41:33 2010 +0000
@@ -25,6 +25,8 @@
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
+#define CABAC 0
+
 #include "internal.h"
 #include "avcodec.h"
 #include "mpegvideo.h"