]> granicus.if.org Git - libvpx/commitdiff
Drop vp9_get_token_extracost
authorAlex Converse <aconverse@google.com>
Fri, 17 Mar 2017 23:24:45 +0000 (16:24 -0700)
committerAlex Converse <aconverse@google.com>
Fri, 17 Mar 2017 23:53:09 +0000 (16:53 -0700)
vp9_get_token_cost does the same thing with one fewer lookup.

Change-Id: Ifc110b12403cb1a04a3f91357ab435c67b4815d6

vp9/encoder/vp9_encodemb.c
vp9/encoder/vp9_tokenize.h

index cf92dbafbd0dce79c6a1173c4ce701cf3254fe4d..576c2861056bf62faf738136e134c6b0eecfd997 100644 (file)
@@ -143,7 +143,7 @@ int vp9_optimize_b(MACROBLOCK *mb, int plane, int block, TX_SIZE tx_size,
       /* Evaluate the first possibility for this state. */
       rate0 = tokens[next][0].rate;
       rate1 = tokens[next][1].rate;
-      vp9_get_token_extracost(cat6_high_cost, x, &t0, &base_bits);
+      base_bits = vp9_get_token_cost(x, &t0, cat6_high_cost);
       /* Consider both possible successor states. */
       if (next < default_eob) {
         band = band_translate[i + 1];
@@ -193,7 +193,7 @@ int vp9_optimize_b(MACROBLOCK *mb, int plane, int block, TX_SIZE tx_size,
         t1 = tokens[next][1].token == EOB_TOKEN ? EOB_TOKEN : ZERO_TOKEN;
         base_bits = 0;
       } else {
-        vp9_get_token_extracost(cat6_high_cost, x, &t0, &base_bits);
+        base_bits = vp9_get_token_cost(x, &t0, cat6_high_cost);
         t1 = t0;
       }
       if (next < default_eob) {
index 4b8d7ad5ce610be99d915ef8e318423a276c2ccf..b2f63ffef5a8909535067f007625f5e31f04964d 100644 (file)
@@ -80,23 +80,6 @@ extern const uint16_t vp9_cat6_high_cost[64];
 extern const uint16_t vp9_cat6_high10_high_cost[256];
 extern const uint16_t vp9_cat6_high12_high_cost[1024];
 
-static INLINE void vp9_get_token_extracost(const uint16_t *cat6_high_table,
-                                           int v, int16_t *token,
-                                           int *extracost) {
-  EXTRABIT extrabits;  // unsigned extrabits
-  v = abs(v);
-  if (v >= CAT6_MIN_VAL) {
-    *token = CATEGORY6_TOKEN;
-    extrabits = v - CAT6_MIN_VAL;
-    *extracost =
-        vp9_cat6_low_cost[extrabits & 0xff] + cat6_high_table[extrabits >> 8];
-  } else {
-    *token = vp9_dct_cat_lt_10_value_tokens[v].token;
-    extrabits = vp9_dct_cat_lt_10_value_tokens[v].extra >> 1;
-    *extracost = vp9_extra_bits[*token].cost[extrabits];
-  }
-}
-
 #if CONFIG_VP9_HIGHBITDEPTH
 static INLINE const uint16_t *vp9_get_high_cost_table(int bit_depth) {
   return bit_depth == 8 ? vp9_cat6_high_cost