From: Ronald S. Bultje Date: Fri, 28 Jun 2013 17:21:25 +0000 (-0700) Subject: Minor change to prevent one level of dereference in cost_coeffs(). X-Git-Tag: v1.3.0~986^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3ce2b2ab30c5ec7d92e099b507ddc2f2bb0434a;p=platform%2Fupstream%2Flibvpx.git Minor change to prevent one level of dereference in cost_coeffs(). 4x4: 234 -> 236 cycles 8x8: 878 -> 888 cycles 16x16: 3664 -> 3550 cycles 32x32: 18134 -> 17392 cycles Change-Id: I37a51bfbb0060a3a54f09c6045c14a989811ed78 --- diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 46d9bce..eef9349 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -386,27 +386,26 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb, // single eob token cost += token_costs[0][0][pt][DCT_EOB_TOKEN]; } else { - int t, v, prev_rc = 0; + int v, prev_t; // dc token v = qcoeff_ptr[0]; - t = vp9_dct_value_tokens_ptr[v].token; - cost += token_costs[0][0][pt][t] + vp9_dct_value_cost_ptr[v]; - token_cache[0] = vp9_pt_energy_class[t]; + prev_t = vp9_dct_value_tokens_ptr[v].token; + cost += token_costs[0][0][pt][prev_t] + vp9_dct_value_cost_ptr[v]; + token_cache[0] = vp9_pt_energy_class[prev_t]; // ac tokens for (c = 1; c < eob; c++) { const int rc = scan[c]; - int band = get_coef_band(band_translate, c); + const int band = get_coef_band(band_translate, c); + int t; v = qcoeff_ptr[rc]; t = vp9_dct_value_tokens_ptr[v].token; pt = vp9_get_coef_context(scan, nb, pad, token_cache, c, default_eob); - // as an index at some level - cost += token_costs[!token_cache[prev_rc]][band][pt][t] + - vp9_dct_value_cost_ptr[v]; + cost += token_costs[!prev_t][band][pt][t] + vp9_dct_value_cost_ptr[v]; token_cache[rc] = vp9_pt_energy_class[t]; - prev_rc = rc; + prev_t = t; } // eob token