]> granicus.if.org Git - libvpx/commitdiff
Moved vp9_get_coef_band to header file
authorScott LaVarnway <slavarnway@google.com>
Thu, 14 Feb 2013 20:27:25 +0000 (12:27 -0800)
committerScott LaVarnway <slavarnway@google.com>
Thu, 14 Feb 2013 20:27:25 +0000 (12:27 -0800)
allowing the compiler to inline.

Change-Id: I66e5caf5e7fefa68a223ff0603aa3f9e11e35dbb

vp9/common/vp9_entropy.c
vp9/common/vp9_entropy.h
vp9/decoder/vp9_detokenize.c
vp9/encoder/vp9_encodemb.c
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_tokenize.c

index 119624a3396ed47f56671ddc0b9379808110c543..df0bf0083fb5c0578ddfb11eb2955a2af8b09335 100644 (file)
@@ -244,13 +244,6 @@ int vp9_get_coef_context(int * recent_energy, int token) {
   return vp9_prev_token_class[token];
 };
 
-int vp9_get_coef_band(int coef_index) {
-  if (coef_index < 32)
-    return vp9_coef_bands[coef_index];
-  else
-    return 7;
-}
-
 void vp9_default_coef_probs(VP9_COMMON *pc) {
   vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4,
              sizeof(pc->fc.coef_probs_4x4));
index 4b6902ec555f27ec3686fef767467ee19ba20929..d331bbccb92fa6de03abaa0d75aa75956c04528e 100644 (file)
@@ -122,6 +122,12 @@ static void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) {
   vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
 }
 
+extern const int vp9_coef_bands[32];
+static int get_coef_band(int coef_index) {
+  if (coef_index < 32)
+    return vp9_coef_bands[coef_index];
+  else
+    return 7;
+}
 extern int vp9_get_coef_context(int * recent_energy, int token);
-extern int vp9_get_coef_band(int coef_index);
 #endif  // VP9_COMMON_VP9_ENTROPY_H_
index e0ad1ccfe05f4997a5b7967007acd876079d78a8..b6b6849f9290327b3e4cfa6c8ac01a7ea9376633 100644 (file)
@@ -65,7 +65,7 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) {
 
 #define INCREMENT_COUNT(token)               \
   do {                                       \
-    coef_counts[type][vp9_get_coef_band(c)][pt][token]++;     \
+    coef_counts[type][get_coef_band(c)][pt][token]++;     \
     pt = vp9_get_coef_context(&recent_energy, token);         \
   } while (0)
 
@@ -179,7 +179,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
     int val;
     const uint8_t *cat6 = cat6_prob;
     if (c >= seg_eob) break;
-    prob = coef_probs[type][vp9_get_coef_band(c)][pt];
+    prob = coef_probs[type][get_coef_band(c)][pt];
     if (!vp9_read(br, prob[EOB_CONTEXT_NODE]))
       break;
 SKIP_START:
@@ -187,7 +187,7 @@ SKIP_START:
     if (!vp9_read(br, prob[ZERO_CONTEXT_NODE])) {
       INCREMENT_COUNT(ZERO_TOKEN);
       ++c;
-      prob = coef_probs[type][vp9_get_coef_band(c)][pt];
+      prob = coef_probs[type][get_coef_band(c)][pt];
       goto SKIP_START;
     }
     // ONE_CONTEXT_NODE_0_
@@ -251,7 +251,7 @@ SKIP_START:
   }
 
   if (c < seg_eob)
-    coef_counts[type][vp9_get_coef_band(c)][pt][DCT_EOB_TOKEN]++;
+    coef_counts[type][get_coef_band(c)][pt][DCT_EOB_TOKEN]++;
 
   A0[aidx] = L0[lidx] = (c > !type);
   if (txfm_size >= TX_8X8 && type != PLANE_TYPE_Y2) {
index 459010a404946e36e78f97fee9aed2edb03c118e..c5185dcf68b151d4819408cd536998fee31da43d 100644 (file)
@@ -456,7 +456,7 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
       t0 = (vp9_dct_value_tokens_ptr + x)->Token;
       /* Consider both possible successor states. */
       if (next < default_eob) {
-        band = vp9_get_coef_band(i + 1);
+        band = get_coef_band(i + 1);
         pt = trellis_get_coeff_context(t0);
         rate0 +=
           mb->token_costs[tx_size][type][band][pt][tokens[next][0].token];
@@ -503,7 +503,7 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
         t0 = t1 = (vp9_dct_value_tokens_ptr + x)->Token;
       }
       if (next < default_eob) {
-        band = vp9_get_coef_band(i + 1);
+        band = get_coef_band(i + 1);
         if (t0 != DCT_EOB_TOKEN) {
           pt = trellis_get_coeff_context(t0);
           rate0 += mb->token_costs[tx_size][type][band][pt][
@@ -538,7 +538,7 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
      *  add a new trellis node, but we do need to update the costs.
      */
     else {
-      band = vp9_get_coef_band(i + 1);
+      band = get_coef_band(i + 1);
       t0 = tokens[next][0].token;
       t1 = tokens[next][1].token;
       /* Update the cost of each path if we're past the EOB token. */
@@ -555,7 +555,7 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
   }
 
   /* Now pick the best path through the whole trellis. */
-  band = vp9_get_coef_band(i + 1);
+  band = get_coef_band(i + 1);
   VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
   rate0 = tokens[next][0].rate;
   rate1 = tokens[next][1].rate;
index 3864b891ef0719b26dc2e4ce3e0ecd6bd78a9395..a05b52f36e8081111e79c71f1fa8cb4c1fe90b06 100644 (file)
@@ -489,24 +489,24 @@ static INLINE int cost_coeffs(MACROBLOCK *mb,
     for (; c < eob; c++) {
       int v = qcoeff_ptr[scan[c]];
       int t = vp9_dct_value_tokens_ptr[v].Token;
-      cost += token_costs[vp9_get_coef_band(c)][pt][t];
+      cost += token_costs[get_coef_band(c)][pt][t];
       cost += vp9_dct_value_cost_ptr[v];
       pt = vp9_get_coef_context(&recent_energy, t);
     }
     if (c < seg_eob)
-      cost += mb->hybrid_token_costs[tx_size][type][vp9_get_coef_band(c)]
+      cost += mb->hybrid_token_costs[tx_size][type][get_coef_band(c)]
           [pt][DCT_EOB_TOKEN];
   } else {
     int recent_energy = 0;
     for (; c < eob; c++) {
       int v = qcoeff_ptr[scan[c]];
       int t = vp9_dct_value_tokens_ptr[v].Token;
-      cost += token_costs[vp9_get_coef_band(c)][pt][t];
+      cost += token_costs[get_coef_band(c)][pt][t];
       cost += vp9_dct_value_cost_ptr[v];
       pt = vp9_get_coef_context(&recent_energy, t);
     }
     if (c < seg_eob)
-      cost += mb->token_costs[tx_size][type][vp9_get_coef_band(c)]
+      cost += mb->token_costs[tx_size][type][get_coef_band(c)]
           [pt][DCT_EOB_TOKEN];
   }
 
index d612eb0fc1c4bd5f352d1eea3882601f4527b105..98e04591ba09eec32d6a59e7ce6502352012d91c 100644 (file)
@@ -219,7 +219,7 @@ static void tokenize_b(VP9_COMP *cpi,
     seg_eob = 0;
 
   do {
-    const int band = vp9_get_coef_band(c);
+    const int band = get_coef_band(c);
     int token;
 
     if (c < eob) {
@@ -774,7 +774,7 @@ static INLINE void stuff_b(VP9_COMP *cpi,
 
   VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec);
 
-  band = vp9_get_coef_band((type == PLANE_TYPE_Y_NO_DC) ? 1 : 0);
+  band = get_coef_band((type == PLANE_TYPE_Y_NO_DC) ? 1 : 0);
   t->Token = DCT_EOB_TOKEN;
   t->context_tree = probs[type][band][pt];
   t->skip_eob_node = 0;