shithub: libvpx

Download patch

ref: 5bd99f83d9dc1269c4413766d856c41ea25e3931
parent: 31a94868b5ded407a37a99f0b97e905d45d67bee
author: Alex Converse <[email protected]>
date: Wed Jan 20 09:09:45 EST 2016

Remove the vestigal skip_eob feature from tokenization.

Repack TOKENEXTRA fields.

Speed impact within measurment margin of error.

Change-Id: I9a6d1dde1bb4a0766b02d0cb74c871ddde907cde

--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -428,13 +428,11 @@
 }
 
 static INLINE void add_token(TOKENEXTRA **t, const vpx_prob *context_tree,
-                             int32_t extra, uint8_t token,
-                             uint8_t skip_eob_node,
+                             int16_t token, EXTRABIT extra,
                              unsigned int *counts) {
+  (*t)->context_tree = context_tree;
   (*t)->token = token;
   (*t)->extra = extra;
-  (*t)->context_tree = context_tree;
-  (*t)->skip_eob_node = skip_eob_node;
   (*t)++;
   ++counts[token];
 }
@@ -441,12 +439,10 @@
 
 static INLINE void add_token_no_extra(TOKENEXTRA **t,
                                       const vpx_prob *context_tree,
-                                      uint8_t token,
-                                      uint8_t skip_eob_node,
+                                      int16_t token,
                                       unsigned int *counts) {
-  (*t)->token = token;
   (*t)->context_tree = context_tree;
-  (*t)->skip_eob_node = skip_eob_node;
+  (*t)->token = token;
   (*t)++;
   ++counts[token];
 }
@@ -501,15 +497,13 @@
 
   while (c < eob) {
     int v = 0;
-    int skip_eob = 0;
     v = qcoeff[scan[c]];
+    ++eob_branch[band[c]][pt];
 
     while (!v) {
-      add_token_no_extra(&t, coef_probs[band[c]][pt], ZERO_TOKEN, skip_eob,
+      add_token_no_extra(&t, coef_probs[band[c]][pt], ZERO_TOKEN,
                          counts[band[c]][pt]);
-      eob_branch[band[c]][pt] += !skip_eob;
 
-      skip_eob = 1;
       token_cache[scan[c]] = 0;
       ++c;
       pt = get_coef_context(nb, token_cache, c);
@@ -518,9 +512,8 @@
 
     vp9_get_token_extra(v, &token, &extra);
 
-    add_token(&t, coef_probs[band[c]][pt], extra, (uint8_t)token,
-              (uint8_t)skip_eob, counts[band[c]][pt]);
-    eob_branch[band[c]][pt] += !skip_eob;
+    add_token(&t, coef_probs[band[c]][pt], token, extra,
+              counts[band[c]][pt]);
 
     token_cache[scan[c]] = vp9_pt_energy_class[token];
     ++c;
@@ -527,9 +520,9 @@
     pt = get_coef_context(nb, token_cache, c);
   }
   if (c < seg_eob) {
-    add_token_no_extra(&t, coef_probs[band[c]][pt], EOB_TOKEN, 0,
-                       counts[band[c]][pt]);
     ++eob_branch[band[c]][pt];
+    add_token_no_extra(&t, coef_probs[band[c]][pt], EOB_TOKEN,
+                       counts[band[c]][pt]);
   }
 
   *tp = t;
--- a/vp9/encoder/vp9_tokenize.h
+++ b/vp9/encoder/vp9_tokenize.h
@@ -36,9 +36,8 @@
 
 typedef struct {
   const vpx_prob *context_tree;
+  int16_t token;
   EXTRABIT extra;
-  uint8_t token;
-  uint8_t skip_eob_node;
 } TOKENEXTRA;
 
 extern const vpx_tree_index vp9_coef_tree[];