[Ffmpeg-cvslog] r6683 - in trunk/libavcodec: cabac.c cabac.h

michael subversion
Fri Oct 13 16:21:26 CEST 2006


Author: michael
Date: Fri Oct 13 16:21:25 2006
New Revision: 6683

Modified:
   trunk/libavcodec/cabac.c
   trunk/libavcodec/cabac.h

Log:
dehack *ps_state indexing in the branchless decoder


Modified: trunk/libavcodec/cabac.c
==============================================================================
--- trunk/libavcodec/cabac.c	(original)
+++ trunk/libavcodec/cabac.c	Fri Oct 13 16:21:25 2006
@@ -50,6 +50,7 @@
 {  6,  8,  9, 11}, {  6,  7,  9, 10}, {  6,  7,  8,  9}, {  2,  2,  2,  2},
 };
 
+uint8_t ff_h264_mlps_state[4*64];
 uint8_t ff_h264_lps_range[2*65][4];
 uint8_t ff_h264_lps_state[2*64];
 uint8_t ff_h264_mps_state[2*64];
@@ -132,16 +133,18 @@
             ff_h264_lps_range[2*i+1][j+4]= lps_range[i][j];
         }
 
+        ff_h264_mlps_state[128+2*i+0]=
         ff_h264_mps_state[2*i+0]= 2*mps_state[i]+0;
+        ff_h264_mlps_state[128+2*i+1]=
         ff_h264_mps_state[2*i+1]= 2*mps_state[i]+1;
 
         if( i ){
 #ifdef BRANCHLESS_CABAC_DECODER
-            ff_h264_mps_state[-2*i-1]= 2*lps_state[i]+0; //FIXME yes this is not valid C but iam lazy, cleanup welcome
-            ff_h264_mps_state[-2*i-2]= 2*lps_state[i]+1;
+            ff_h264_mlps_state[128-2*i-1]= 2*lps_state[i]+0;
+            ff_h264_mlps_state[128-2*i-2]= 2*lps_state[i]+1;
         }else{
-            ff_h264_mps_state[-2*i-1]= 1;
-            ff_h264_mps_state[-2*i-2]= 0;
+            ff_h264_mlps_state[128-2*i-1]= 1;
+            ff_h264_mlps_state[128-2*i-2]= 0;
 #else
             ff_h264_lps_state[2*i+0]= 2*lps_state[i]+0;
             ff_h264_lps_state[2*i+1]= 2*lps_state[i]+1;

Modified: trunk/libavcodec/cabac.h
==============================================================================
--- trunk/libavcodec/cabac.h	(original)
+++ trunk/libavcodec/cabac.h	Fri Oct 13 16:21:25 2006
@@ -47,6 +47,7 @@
     PutBitContext pb;
 }CABACContext;
 
+extern uint8_t ff_h264_mlps_state[4*64];
 extern uint8_t ff_h264_lps_range[2*65][4];  ///< rangeTabLPS
 extern uint8_t ff_h264_mps_state[2*64];     ///< transIdxMPS
 extern uint8_t ff_h264_lps_state[2*64];     ///< transIdxLPS
@@ -480,7 +481,7 @@
 #endif /* CMOV_IS_FAST */
 
 //eax:state ebx:low edx:mask esi:range
-        "movzbl "MANGLE(ff_h264_mps_state)"(%%eax), %%ecx   \n\t"
+        "movzbl "MANGLE(ff_h264_mlps_state)"+128(%%eax), %%ecx   \n\t"
         "movb %%cl, (%1)                        \n\t"
 
         "movl %%esi, %%edx                      \n\t"
@@ -550,7 +551,7 @@
     c->range += (RangeLPS - c->range) & lps_mask;
 
     s^=lps_mask;
-    *state= ff_h264_mps_state[s];
+    *state= (ff_h264_mlps_state+128)[s];
     bit= s&1;
 
     lps_mask= ff_h264_norm_shift[c->range>>(CABAC_BITS+3)];




More information about the ffmpeg-cvslog mailing list