Commit 9eea9fa2 authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

Fix mix-up in pt token indexing.

This fixes uninitialized reads in the trellis, and probably makes the
trellis do something again.

Change-Id: Ifac8dae9aa77574bde0954a71d4571c5c556df3c
parent 35dc9f55
...@@ -2105,11 +2105,10 @@ int vp9_get_coef_context(const int *scan, const int *neighbors, ...@@ -2105,11 +2105,10 @@ int vp9_get_coef_context(const int *scan, const int *neighbors,
int nb_pad, uint8_t *token_cache, int c, int l) { int nb_pad, uint8_t *token_cache, int c, int l) {
int eob = l; int eob = l;
assert(nb_pad == MAX_NEIGHBORS); assert(nb_pad == MAX_NEIGHBORS);
if (c == eob - 1) { if (c == eob) {
return 0; return 0;
} else { } else {
int ctx; int ctx;
c++;
assert(neighbors[MAX_NEIGHBORS * c + 0] >= 0); assert(neighbors[MAX_NEIGHBORS * c + 0] >= 0);
if (neighbors[MAX_NEIGHBORS * c + 1] >= 0) { if (neighbors[MAX_NEIGHBORS * c + 1] >= 0) {
ctx = (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] + ctx = (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] +
......
...@@ -69,7 +69,7 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) { ...@@ -69,7 +69,7 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) {
[pt][token]++; \ [pt][token]++; \
token_cache[c] = token; \ token_cache[c] = token; \
pt = vp9_get_coef_context(scan, nb, pad, token_cache, \ pt = vp9_get_coef_context(scan, nb, pad, token_cache, \
c, default_eob); \ c + 1, default_eob); \
} while (0) } while (0)
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
......
...@@ -595,7 +595,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb, ...@@ -595,7 +595,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
[get_coef_band(scan, tx_size, c)] [get_coef_band(scan, tx_size, c)]
[pt][0], 1); [pt][0], 1);
#endif #endif
pt = vp9_get_coef_context(scan, nb, pad, token_cache, c, default_eob); pt = vp9_get_coef_context(scan, nb, pad, token_cache, c + 1, default_eob);
} }
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
cost += nzc_cost[nzc]; cost += nzc_cost[nzc];
......
...@@ -291,7 +291,7 @@ static void tokenize_b(VP9_COMP *cpi, ...@@ -291,7 +291,7 @@ static void tokenize_b(VP9_COMP *cpi,
#endif #endif
token_cache[c] = token; token_cache[c] = token;
pt = vp9_get_coef_context(scan, nb, pad, token_cache, c, default_eob); pt = vp9_get_coef_context(scan, nb, pad, token_cache, c + 1, default_eob);
++t; ++t;
} while (c < eob && ++c < seg_eob); } while (c < eob && ++c < seg_eob);
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment