Merge "Redo banding for all transforms." into experimental
This commit is contained in:
commit
3c77ab4c0f
File diff suppressed because it is too large
Load Diff
@ -42,15 +42,21 @@ DECLARE_ALIGNED(16, const uint8_t, vp9_norm[256]) = {
|
||||
};
|
||||
|
||||
// Unified coefficient band structure used by all block sizes
|
||||
DECLARE_ALIGNED(16, const int, vp9_coef_bands[32]) = {
|
||||
0, 1, 2, 3, 3, 3, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 5,
|
||||
DECLARE_ALIGNED(16, const int, vp9_coef_bands8x8[64]) = {
|
||||
0, 1, 2, 3, 4, 4, 5, 5,
|
||||
1, 2, 3, 4, 4, 5, 5, 5,
|
||||
2, 3, 4, 4, 5, 5, 5, 5,
|
||||
3, 4, 4, 5, 5, 5, 5, 5,
|
||||
4, 4, 5, 5, 5, 5, 5, 5,
|
||||
4, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5
|
||||
};
|
||||
DECLARE_ALIGNED(16, const int, vp9_coef_bands4x4[16]) = {
|
||||
0, 1, 2, 3, 3, 3, 4, 4,
|
||||
4, 4, 5, 5, 5, 5, 5, 5
|
||||
0, 1, 2, 3,
|
||||
1, 2, 3, 4,
|
||||
2, 3, 4, 5,
|
||||
3, 4, 5, 5
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[MAX_ENTROPY_TOKENS]) = {
|
||||
|
@ -126,17 +126,20 @@ static INLINE void vp9_reset_sb64_tokens_context(MACROBLOCKD* const xd) {
|
||||
vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * 4);
|
||||
}
|
||||
|
||||
extern const int vp9_coef_bands[32];
|
||||
extern const int vp9_coef_bands8x8[64];
|
||||
extern const int vp9_coef_bands4x4[16];
|
||||
|
||||
static int get_coef_band(TX_SIZE tx_size, int coef_index) {
|
||||
static int get_coef_band(const int *scan, TX_SIZE tx_size, int coef_index) {
|
||||
if (tx_size == TX_4X4) {
|
||||
return vp9_coef_bands4x4[coef_index];
|
||||
return vp9_coef_bands4x4[scan[coef_index]];
|
||||
} else {
|
||||
if (coef_index < 32)
|
||||
return vp9_coef_bands[coef_index];
|
||||
else
|
||||
const int pos = scan[coef_index];
|
||||
const int sz = 1 << (2 + tx_size);
|
||||
const int x = pos & (sz - 1), y = pos >> (2 + tx_size);
|
||||
if (x >= 8 || y >= 8)
|
||||
return 5;
|
||||
else
|
||||
return vp9_coef_bands8x8[y * 8 + x];
|
||||
}
|
||||
}
|
||||
extern int vp9_get_coef_context(const int *scan, const int *neighbors,
|
||||
|
@ -65,9 +65,11 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) {
|
||||
|
||||
#define INCREMENT_COUNT(token) \
|
||||
do { \
|
||||
coef_counts[type][ref][get_coef_band(txfm_size, c)][pt][token]++; \
|
||||
coef_counts[type][ref][get_coef_band(scan, txfm_size, c)] \
|
||||
[pt][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, default_eob); \
|
||||
} while (0)
|
||||
|
||||
#if CONFIG_CODE_NONZEROCOUNT
|
||||
@ -212,10 +214,10 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
|
||||
if (nzc == nzc_expected)
|
||||
break;
|
||||
#endif
|
||||
prob = coef_probs[type][ref][get_coef_band(txfm_size, c)][pt];
|
||||
prob = coef_probs[type][ref][get_coef_band(scan, txfm_size, c)][pt];
|
||||
#if CONFIG_CODE_NONZEROCOUNT == 0
|
||||
fc->eob_branch_counts[txfm_size][type][ref]
|
||||
[get_coef_band(txfm_size, c)][pt]++;
|
||||
[get_coef_band(scan, txfm_size, c)][pt]++;
|
||||
if (!vp9_read(br, prob[EOB_CONTEXT_NODE]))
|
||||
break;
|
||||
#endif
|
||||
@ -231,7 +233,7 @@ SKIP_START:
|
||||
if (!vp9_read(br, prob[ZERO_CONTEXT_NODE])) {
|
||||
INCREMENT_COUNT(ZERO_TOKEN);
|
||||
++c;
|
||||
prob = coef_probs[type][ref][get_coef_band(txfm_size, c)][pt];
|
||||
prob = coef_probs[type][ref][get_coef_band(scan, txfm_size, c)][pt];
|
||||
goto SKIP_START;
|
||||
}
|
||||
// ONE_CONTEXT_NODE_0_
|
||||
@ -296,7 +298,8 @@ SKIP_START:
|
||||
|
||||
#if CONFIG_CODE_NONZEROCOUNT == 0
|
||||
if (c < seg_eob)
|
||||
coef_counts[type][ref][get_coef_band(txfm_size, c)][pt][DCT_EOB_TOKEN]++;
|
||||
coef_counts[type][ref][get_coef_band(scan, txfm_size, c)]
|
||||
[pt][DCT_EOB_TOKEN]++;
|
||||
#endif
|
||||
|
||||
A0[aidx] = L0[lidx] = c > 0;
|
||||
|
@ -662,7 +662,7 @@ static void optimize_b(VP9_COMMON *const cm,
|
||||
t0 = (vp9_dct_value_tokens_ptr + x)->Token;
|
||||
/* Consider both possible successor states. */
|
||||
if (next < default_eob) {
|
||||
band = get_coef_band(tx_size, i + 1);
|
||||
band = get_coef_band(scan, tx_size, i + 1);
|
||||
pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache,
|
||||
pad, default_eob);
|
||||
rate0 +=
|
||||
@ -721,7 +721,7 @@ static void optimize_b(VP9_COMMON *const cm,
|
||||
t0 = t1 = (vp9_dct_value_tokens_ptr + x)->Token;
|
||||
}
|
||||
if (next < default_eob) {
|
||||
band = get_coef_band(tx_size, i + 1);
|
||||
band = get_coef_band(scan, tx_size, i + 1);
|
||||
if (t0 != DCT_EOB_TOKEN) {
|
||||
pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache,
|
||||
pad, default_eob);
|
||||
@ -763,7 +763,7 @@ static void optimize_b(VP9_COMMON *const cm,
|
||||
* add a new trellis node, but we do need to update the costs.
|
||||
*/
|
||||
else {
|
||||
band = get_coef_band(tx_size, i + 1);
|
||||
band = get_coef_band(scan, tx_size, 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. */
|
||||
@ -782,7 +782,7 @@ static void optimize_b(VP9_COMMON *const cm,
|
||||
}
|
||||
|
||||
/* Now pick the best path through the whole trellis. */
|
||||
band = get_coef_band(tx_size, i + 1);
|
||||
band = get_coef_band(scan, tx_size, i + 1);
|
||||
VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
|
||||
rate0 = tokens[next][0].rate;
|
||||
rate1 = tokens[next][1].rate;
|
||||
|
@ -565,12 +565,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
|
||||
nzc += (v != 0);
|
||||
#endif
|
||||
token_cache[c] = t;
|
||||
cost += token_costs[get_coef_band(tx_size, c)][pt][t];
|
||||
cost += token_costs[get_coef_band(scan, tx_size, c)][pt][t];
|
||||
cost += vp9_dct_value_cost_ptr[v];
|
||||
#if !CONFIG_CODE_NONZEROCOUNT
|
||||
if (!c || token_cache[c - 1])
|
||||
cost += vp9_cost_bit(coef_probs[type][ref]
|
||||
[get_coef_band(tx_size, c)]
|
||||
[get_coef_band(scan, tx_size, c)]
|
||||
[pt][0], 1);
|
||||
#endif
|
||||
pt = vp9_get_coef_context(scan, nb, pad, token_cache, c, default_eob);
|
||||
@ -579,8 +579,9 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
|
||||
cost += nzc_cost[nzc];
|
||||
#else
|
||||
if (c < seg_eob)
|
||||
cost += mb->token_costs[tx_size][type][ref][get_coef_band(tx_size, c)]
|
||||
[pt][DCT_EOB_TOKEN];
|
||||
cost += mb->token_costs[tx_size][type][ref]
|
||||
[get_coef_band(scan, tx_size, c)]
|
||||
[pt][DCT_EOB_TOKEN];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ static void tokenize_b(VP9_COMP *cpi,
|
||||
seg_eob = 0;
|
||||
|
||||
do {
|
||||
const int band = get_coef_band(tx_size, c);
|
||||
const int band = get_coef_band(scan, tx_size, c);
|
||||
int token;
|
||||
int v = 0;
|
||||
#if CONFIG_CODE_NONZEROCOUNT
|
||||
|
Loading…
x
Reference in New Issue
Block a user