changeset 3976:27e90123b346 libavcodec

reverse remainder of the failed attempt to optimize *state=c->mps_state[s]
author michael
date Mon, 09 Oct 2006 21:14:16 +0000
parents 6cc9eb5ee5e3
children ebf01ad52879
files cabac.c cabac.h h264.c
diffstat 3 files changed, 22 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/cabac.c	Mon Oct 09 20:51:33 2006 +0000
+++ b/cabac.c	Mon Oct 09 21:14:16 2006 +0000
@@ -125,26 +125,26 @@
 
     for(i=0; i<state_count; i++){
         for(j=0; j<4; j++){ //FIXME check if this is worth the 1 shift we save
-            c->lps_range[2*i+2][j+4]=
-            c->lps_range[2*i+3][j+4]= lps_range[i][j];
+            c->lps_range[2*i+0][j+4]=
+            c->lps_range[2*i+1][j+4]= lps_range[i][j];
         }
 
-        c->mps_state[2*i+2]= 2*mps_state[i]+2;
-        c->mps_state[2*i+3]= 2*mps_state[i]+3;
+        c->mps_state[2*i+0]= 2*mps_state[i]+0;
+        c->mps_state[2*i+1]= 2*mps_state[i]+1;
 
         if( i ){
 #ifdef BRANCHLESS_CABAD
-            c->mps_state[-2*i-3]= 2*lps_state[i]+2; //FIXME yes this is not valid C but iam lazy, cleanup welcome
-            c->mps_state[-2*i-4]= 2*lps_state[i]+3;
+            c->mps_state[-2*i-1]= 2*lps_state[i]+0; //FIXME yes this is not valid C but iam lazy, cleanup welcome
+            c->mps_state[-2*i-2]= 2*lps_state[i]+1;
         }else{
-            c->mps_state[-2*i-3]= 3;
-            c->mps_state[-2*i-4]= 2;
+            c->mps_state[-2*i-1]= 1;
+            c->mps_state[-2*i-2]= 0;
 #else
-            c->lps_state[2*i+2]= 2*lps_state[i]+2;
-            c->lps_state[2*i+3]= 2*lps_state[i]+3;
+            c->lps_state[2*i+0]= 2*lps_state[i]+0;
+            c->lps_state[2*i+1]= 2*lps_state[i]+1;
         }else{
-            c->lps_state[2*i+2]= 3;
-            c->lps_state[2*i+3]= 2;
+            c->lps_state[2*i+0]= 1;
+            c->lps_state[2*i+1]= 0;
 #endif
         }
     }
--- a/cabac.h	Mon Oct 09 20:51:33 2006 +0000
+++ b/cabac.h	Mon Oct 09 21:14:16 2006 +0000
@@ -40,9 +40,9 @@
 #ifdef STRICT_LIMITS
     int symCount;
 #endif
-    uint8_t lps_range[2*66][4];   ///< rangeTabLPS
-    uint8_t lps_state[2*65];      ///< transIdxLPS
-    uint8_t mps_state[2*65];      ///< transIdxMPS
+    uint8_t lps_range[2*65][4];   ///< rangeTabLPS
+    uint8_t lps_state[2*64];      ///< transIdxLPS
+    uint8_t mps_state[2*64];      ///< transIdxMPS
     const uint8_t *bytestream_start;
     const uint8_t *bytestream;
     const uint8_t *bytestream_end;
@@ -370,11 +370,11 @@
 #define LOW          "0"
 #define RANGE        "4"
 #define LPS_RANGE   "12"
-#define LPS_STATE   "12+2*66*4"
-#define MPS_STATE   "12+2*66*4+2*65"
-#define BYTESTART   "12+2*66*4+4*65"
-#define BYTE        "16+2*66*4+4*65"
-#define BYTEEND     "20+2*66*4+4*65"
+#define LPS_STATE   "12+2*65*4"
+#define MPS_STATE   "12+2*65*4+2*64"
+#define BYTESTART   "12+2*65*4+4*64"
+#define BYTE        "16+2*65*4+4*64"
+#define BYTEEND     "20+2*65*4+4*64"
 #ifndef BRANCHLESS_CABAD
     asm volatile(
         "movzbl (%1), %%eax                     \n\t"
--- a/h264.c	Mon Oct 09 20:51:33 2006 +0000
+++ b/h264.c	Mon Oct 09 21:14:16 2006 +0000
@@ -7401,9 +7401,9 @@
                 pre = clip( ((cabac_context_init_PB[h->cabac_init_idc][i][0] * s->qscale) >>4 ) + cabac_context_init_PB[h->cabac_init_idc][i][1], 1, 126 );
 
             if( pre <= 63 )
-                h->cabac_state[i] = 2 * ( 63 - pre ) + 2;
+                h->cabac_state[i] = 2 * ( 63 - pre ) + 0;
             else
-                h->cabac_state[i] = 2 * ( pre - 64 ) + 3;
+                h->cabac_state[i] = 2 * ( pre - 64 ) + 1;
         }
 
         for(;;){