Improved token decoder
authorScott LaVarnway <slavarnway@google.com>
Wed, 19 Oct 2011 17:38:35 +0000 (13:38 -0400)
committerScott LaVarnway <slavarnway@google.com>
Wed, 19 Oct 2011 17:38:35 +0000 (13:38 -0400)
Tests showed over 2% improvement on various HD clips.

Change-Id: I94a30d209c92cbd5fef285122f9fc570688635fe

vp8/decoder/detokenize.c

index 1a71948..1d45685 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 
-#include "vp8/common/type_aliases.h"
 #include "vp8/common/blockd.h"
 #include "onyxd_int.h"
 #include "vpx_mem/vpx_mem.h"
@@ -205,33 +204,34 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *x)
     VP8_BD_VALUE value;
     const int *scan;
     register unsigned int shift;
-    UINT32 split;
+    unsigned int split;
     VP8_BD_VALUE bigsplit;
-    INT16 *qcoeff_ptr;
+    short *qcoeff_ptr;
 
     const vp8_prob *coef_probs;
-    int type;
     int stop;
-    INT16 val, bits_count;
-    INT16 c;
-    INT16 v;
+    int val, bits_count;
+    int c;
+    int v;
     const vp8_prob *Prob;
+    int start_coeff;
+
 
-    type = 3;
     i = 0;
     stop = 16;
 
     scan = vp8_default_zig_zag1d;
     qcoeff_ptr = &x->qcoeff[0];
+    coef_probs = fc->coef_probs [3] [ 0 ] [0];
 
     if (x->mode_info_context->mbmi.mode != B_PRED &&
         x->mode_info_context->mbmi.mode != SPLITMV)
     {
         i = 24;
         stop = 24;
-        type = 1;
         qcoeff_ptr += 24*16;
         eobtotal -= 16;
+        coef_probs = fc->coef_probs [1] [ 0 ] [0];
     }
 
     bufend  = bc->user_buffer_end;
@@ -240,23 +240,24 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *x)
     count   = bc->count;
     range   = bc->range;
 
-
-    coef_probs = fc->coef_probs [type] [ 0 ] [0];
+    start_coeff = 0;
 
 BLOCK_LOOP:
     a = A + vp8_block2above[i];
     l = L + vp8_block2left[i];
 
-    c = (INT16)(!type);
+    c = start_coeff;
 
-    /*Dest = ((A)!=0) + ((B)!=0);*/
     VP8_COMBINEENTROPYCONTEXTS(v, *a, *l);
+
     Prob = coef_probs;
     Prob += v * ENTROPY_NODES;
+    *a = *l = 0;
 
 DO_WHILE:
     Prob += coef_bands_x[c];
     DECODE_AND_BRANCH_IF_ZERO(Prob[EOB_CONTEXT_NODE], BLOCK_FINISHED);
+    *a = *l = 1;
 
 CHECK_0_:
     DECODE_AND_LOOP_IF_ZERO(Prob[ZERO_CONTEXT_NODE], CHECK_0_);
@@ -346,7 +347,7 @@ ONE_CONTEXT_NODE_0_:
 
     qcoeff_ptr [ 15 ] = (INT16) v;
 BLOCK_FINISHED:
-    *a = *l = ((eobs[i] = c) != !type);   /* any nonzero data? */
+    eobs[i] = c;
     eobtotal += c;
     qcoeff_ptr += 16;
 
@@ -357,18 +358,18 @@ BLOCK_FINISHED:
 
     if (i == 25)
     {
-        type = 0;
+        start_coeff = 1;
         i = 0;
         stop = 16;
-        coef_probs = fc->coef_probs [type] [ 0 ] [0];
+        coef_probs = fc->coef_probs [0] [ 0 ] [0];
         qcoeff_ptr -= (24*16 + 16);
         goto BLOCK_LOOP;
     }
 
     if (i == 16)
     {
-        type = 2;
-        coef_probs = fc->coef_probs [type] [ 0 ] [0];
+        start_coeff = 0;
+        coef_probs = fc->coef_probs [2] [ 0 ] [0];
         stop = 24;
         goto BLOCK_LOOP;
     }