Using local variable for token_cache.
authorDmitry Kovalev <dkovalev@google.com>
Fri, 28 Feb 2014 02:58:32 +0000 (18:58 -0800)
committerDmitry Kovalev <dkovalev@google.com>
Fri, 21 Mar 2014 19:14:05 +0000 (12:14 -0700)
We use local variable for token_cache in the decoder.

Change-Id: I032763fa7894313cffe73e3f14863ae1d0527665

vp9/encoder/vp9_block.h
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_tokenize.c

index 888984c..1d13a08 100644 (file)
@@ -157,7 +157,6 @@ struct macroblock {
 
   // note that token_costs is the cost when eob node is skipped
   vp9_coeff_cost token_costs[TX_SIZES];
-  DECLARE_ALIGNED(16, uint8_t, token_cache[1024]);
 
   int optimize;
 
index 2fd25ef..93f9999 100644 (file)
@@ -566,7 +566,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
   const int16_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
   unsigned int (*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] =
                    x->token_costs[tx_size][type][is_inter_block(mbmi)];
-  uint8_t *p_tok = x->token_cache;
+  uint8_t token_cache[32 * 32];
   int pt = combine_entropy_contexts(*A, *L);
   int c, cost;
   // Check for consistency of tx_size with mode info
@@ -584,7 +584,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
     int v = qcoeff[0];
     int prev_t = vp9_dct_value_tokens_ptr[v].token;
     cost = (*token_costs)[0][pt][prev_t] + vp9_dct_value_cost_ptr[v];
-    p_tok[0] = vp9_pt_energy_class[prev_t];
+    token_cache[0] = vp9_pt_energy_class[prev_t];
     ++token_costs;
 
     // ac tokens
@@ -597,9 +597,9 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
       if (use_fast_coef_costing) {
         cost += (*token_costs)[!prev_t][!prev_t][t] + vp9_dct_value_cost_ptr[v];
       } else {
-        pt = get_coef_context(nb, p_tok, c);
+        pt = get_coef_context(nb, token_cache, c);
         cost += (*token_costs)[!prev_t][pt][t] + vp9_dct_value_cost_ptr[v];
-        p_tok[rc] = vp9_pt_energy_class[t];
+        token_cache[rc] = vp9_pt_energy_class[t];
       }
       prev_t = t;
       if (!--band_left) {
@@ -613,7 +613,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
       if (use_fast_coef_costing) {
         cost += (*token_costs)[0][!prev_t][EOB_TOKEN];
       } else {
-        pt = get_coef_context(nb, p_tok, c);
+        pt = get_coef_context(nb, token_cache, c);
         cost += (*token_costs)[0][pt][EOB_TOKEN];
       }
     }
index bb5f1c2..76d336d 100644 (file)
@@ -162,7 +162,6 @@ struct tokenize_b_args {
   VP9_COMP *cpi;
   MACROBLOCKD *xd;
   TOKENEXTRA **tp;
-  uint8_t *token_cache;
 };
 
 static void set_entropy_context_b(int plane, int block, BLOCK_SIZE plane_bsize,
@@ -213,7 +212,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
   VP9_COMP *cpi = args->cpi;
   MACROBLOCKD *xd = args->xd;
   TOKENEXTRA **tp = args->tp;
-  uint8_t *token_cache = args->token_cache;
+  uint8_t token_cache[32 * 32];
   struct macroblock_plane *p = &cpi->mb.plane[plane];
   struct macroblockd_plane *pd = &xd->plane[plane];
   MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
@@ -315,7 +314,7 @@ void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
   const int ctx = vp9_get_skip_context(xd);
   const int skip_inc = !vp9_segfeature_active(&cm->seg, mbmi->segment_id,
                                               SEG_LVL_SKIP);
-  struct tokenize_b_args arg = {cpi, xd, t, cpi->mb.token_cache};
+  struct tokenize_b_args arg = {cpi, xd, t};
   if (mbmi->skip) {
     if (!dry_run)
       cm->counts.skip[ctx][1] += skip_inc;