shithub: libvpx

Download patch

ref: 716db10f0d3c1ded6125229864fe5a78e7d0c203
parent: 03f28c0a12141431de8076970c503ee839d2a268
parent: ae886d6bffb9cd3e889aaaed90644927e3ee34c3
author: John Koleszar <jkoleszar@google.com>
date: Thu Feb 14 13:02:55 EST 2013

Merge "Moved vp9_get_coef_band to header file" into experimental

--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -244,13 +244,6 @@
   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));
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -122,6 +122,12 @@
   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_
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -65,7 +65,7 @@
 
 #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 @@
     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 @@
     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 @@
   }
 
   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) {
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -456,7 +456,7 @@
       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 @@
         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 @@
      *  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 @@
   }
 
   /* 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;
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -489,12 +489,12 @@
     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;
@@ -501,12 +501,12 @@
     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];
   }
 
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -219,7 +219,7 @@
     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 @@
 
   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;
--