ref: 45712dc8c8b45c7eee96504fbe23a674f3728241
parent: 51afedbe28e5eca16cbb2ff10c9b71bf04e5ecb4
parent: 9255ad107f2e17685090c15555c0a80b6cd06854
author: Paul Wilkins <paulwilkins@google.com>
date: Wed Feb 13 22:23:31 EST 2013
Merge "Abstract selection of coef band." into experimental
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -41,8 +41,12 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-DECLARE_ALIGNED(16, const int, vp9_coef_bands_4x4[16]) = {
- 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7
+// Unified coefficient band structure used by all block sizes
+DECLARE_ALIGNED(16, const int, vp9_coef_bands[32]) = {
+ 0, 1, 2, 3, 5, 4, 4, 5,
+ 5, 3, 6, 6, 6, 6, 6, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7
};
DECLARE_ALIGNED(16, const uint8_t, vp9_prev_token_class[MAX_ENTROPY_TOKENS]) = {
@@ -70,17 +74,6 @@
12, 13, 14, 15
};
-DECLARE_ALIGNED(64, const int, vp9_coef_bands_8x8[64]) = {
- 0, 1, 2, 3, 5, 4, 4, 5,
- 5, 3, 6, 3, 5, 4, 6, 6,
- 6, 5, 5, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7
-};
-
DECLARE_ALIGNED(64, const int, vp9_default_zig_zag1d_8x8[64]) = {
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
@@ -88,26 +81,6 @@
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63,
};
-// Table can be optimized.
-DECLARE_ALIGNED(16, const int, vp9_coef_bands_16x16[256]) = {
- 0, 1, 2, 3, 5, 4, 4, 5, 5, 3, 6, 3, 5, 4, 6, 6,
- 6, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-};
-
DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_16x16[256]) = {
0, 1, 16, 32, 17, 2, 3, 18,
33, 48, 64, 49, 34, 19, 4, 5,
@@ -143,76 +116,6 @@
237, 252, 253, 238, 223, 239, 254, 255,
};
-DECL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, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-};
-
DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_32x32[1024]) = {
0, 1, 32, 64, 33, 2, 3, 34, 65, 96, 128, 97, 66, 35, 4, 5, 36, 67, 98, 129, 160, 192, 161, 130, 99, 68, 37, 6, 7, 38, 69, 100,
131, 162, 193, 224, 256, 225, 194, 163, 132, 101, 70, 39, 8, 9, 40, 71, 102, 133, 164, 195, 226, 257, 288, 320, 289, 258, 227, 196, 165, 134, 103, 72,
@@ -340,6 +243,13 @@
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,
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -72,10 +72,6 @@
position within the 4x4 DCT. */
#define COEF_BANDS 8
-extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_4x4[16]);
-extern DECLARE_ALIGNED(64, const int, vp9_coef_bands_8x8[64]);
-extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_16x16[256]);
-extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_32x32[1024]);
/* Inside dimension is 3-valued measure of nearby complexity, that is,
the extent to which nearby coefficients are nonzero. For the first
@@ -127,4 +123,5 @@
}
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][coef_bands[c]][pt][token]++; \
+ coef_counts[type][vp9_get_coef_band(c)][pt][token]++; \
pt = vp9_get_coef_context(&recent_energy, token); \
} while (0)
@@ -87,8 +87,7 @@
BOOL_DECODER* const br, int block_idx,
PLANE_TYPE type, TX_TYPE tx_type,
int seg_eob, int16_t *qcoeff_ptr,
- const int *const scan, TX_SIZE txfm_size,
- const int *coef_bands) {
+ const int *const scan, TX_SIZE txfm_size) {
ENTROPY_CONTEXT* const A0 = (ENTROPY_CONTEXT *) xd->above_context;
ENTROPY_CONTEXT* const L0 = (ENTROPY_CONTEXT *) xd->left_context;
const int aidx = vp9_block2above[txfm_size][block_idx];
@@ -180,7 +179,7 @@
int val;
const uint8_t *cat6 = cat6_prob;
if (c >= seg_eob) break;
- prob = coef_probs[type][coef_bands[c]][pt];
+ prob = coef_probs[type][vp9_get_coef_band(c)][pt];
if (!vp9_read(br, prob[EOB_CONTEXT_NODE]))
break;
SKIP_START:
@@ -188,7 +187,7 @@
if (!vp9_read(br, prob[ZERO_CONTEXT_NODE])) {
INCREMENT_COUNT(ZERO_TOKEN);
++c;
- prob = coef_probs[type][coef_bands[c]][pt];
+ prob = coef_probs[type][vp9_get_coef_band(c)][pt];
goto SKIP_START;
}
// ONE_CONTEXT_NODE_0_
@@ -252,7 +251,7 @@
}
if (c < seg_eob)
- coef_counts[type][coef_bands[c]][pt][DCT_EOB_TOKEN]++;
+ coef_counts[type][vp9_get_coef_band(c)][pt][DCT_EOB_TOKEN]++;
A0[aidx] = L0[lidx] = (c > !type);
if (txfm_size >= TX_8X8 && type != PLANE_TYPE_Y2) {
@@ -312,7 +311,7 @@
DCT_DCT, get_eob(xd, segment_id, 1024),
xd->sb_coeff_data.qcoeff,
vp9_default_zig_zag1d_32x32,
- TX_32X32, vp9_coef_bands_32x32);
+ TX_32X32);
eobtotal += c;
// 16x16 chroma blocks
@@ -321,7 +320,7 @@
eobs[i] = c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV, DCT_DCT, seg_eob,
xd->sb_coeff_data.qcoeff + 1024 + (i - 16) * 64,
vp9_default_zig_zag1d_16x16,
- TX_16X16, vp9_coef_bands_16x16);
+ TX_16X16);
eobtotal += c;
}
@@ -345,7 +344,7 @@
get_tx_type(xd, &xd->block[0]),
get_eob(xd, segment_id, 256),
xd->qcoeff, vp9_default_zig_zag1d_16x16,
- TX_16X16, vp9_coef_bands_16x16);
+ TX_16X16);
eobtotal += c;
// 8x8 chroma blocks
@@ -354,7 +353,7 @@
eobs[i] = c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV,
DCT_DCT, seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d_8x8,
- TX_8X8, vp9_coef_bands_8x8);
+ TX_8X8);
eobtotal += c;
}
A[8] = 0;
@@ -376,8 +375,7 @@
eobs[24] = c = decode_coefs(pbi, xd, bc, 24, PLANE_TYPE_Y2,
DCT_DCT, get_eob(xd, segment_id, 4),
xd->block[24].qcoeff,
- vp9_default_zig_zag1d_4x4, TX_8X8,
- vp9_coef_bands_4x4);
+ vp9_default_zig_zag1d_4x4, TX_8X8);
eobtotal += c - 4;
type = PLANE_TYPE_Y_NO_DC;
} else {
@@ -394,8 +392,7 @@
type == PLANE_TYPE_Y_WITH_DC ?
get_tx_type(xd, xd->block + i) : DCT_DCT,
seg_eob, xd->block[i].qcoeff,
- vp9_default_zig_zag1d_8x8,
- TX_8X8, vp9_coef_bands_8x8);
+ vp9_default_zig_zag1d_8x8, TX_8X8);
eobtotal += c;
}
@@ -407,8 +404,7 @@
for (i = 16; i < 24; i++) {
eobs[i] = c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV,
DCT_DCT, seg_eob, xd->block[i].qcoeff,
- vp9_default_zig_zag1d_4x4, TX_4X4,
- vp9_coef_bands_4x4);
+ vp9_default_zig_zag1d_4x4, TX_4X4);
eobtotal += c;
}
} else {
@@ -415,8 +411,7 @@
for (i = 16; i < 24; i += 4) {
eobs[i] = c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV,
DCT_DCT, seg_eob, xd->block[i].qcoeff,
- vp9_default_zig_zag1d_8x8,
- TX_8X8, vp9_coef_bands_8x8);
+ vp9_default_zig_zag1d_8x8, TX_8X8);
eobtotal += c;
}
}
@@ -432,7 +427,7 @@
int c;
c = decode_coefs(dx, xd, bc, i, type, tx_type, seg_eob,
- xd->block[i].qcoeff, scan, TX_4X4, vp9_coef_bands_4x4);
+ xd->block[i].qcoeff, scan, TX_4X4);
eobs[i] = c;
return c;
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -386,13 +386,12 @@
int best, band, pt;
int err_mult = plane_rd_mult[type];
int default_eob;
- int const *scan, *bands;
+ int const *scan;
switch (tx_size) {
default:
case TX_4X4:
scan = vp9_default_zig_zag1d_4x4;
- bands = vp9_coef_bands_4x4;
default_eob = 16;
// TODO: this isn't called (for intra4x4 modes), but will be left in
// since it could be used later
@@ -419,12 +418,10 @@
break;
case TX_8X8:
scan = vp9_default_zig_zag1d_8x8;
- bands = vp9_coef_bands_8x8;
default_eob = 64;
break;
case TX_16X16:
scan = vp9_default_zig_zag1d_16x16;
- bands = vp9_coef_bands_16x16;
default_eob = 256;
break;
}
@@ -459,7 +456,7 @@
t0 = (vp9_dct_value_tokens_ptr + x)->Token;
/* Consider both possible successor states. */
if (next < default_eob) {
- band = bands[i + 1];
+ band = vp9_get_coef_band(i + 1);
pt = trellis_get_coeff_context(t0);
rate0 +=
mb->token_costs[tx_size][type][band][pt][tokens[next][0].token];
@@ -506,7 +503,7 @@
t0 = t1 = (vp9_dct_value_tokens_ptr + x)->Token;
}
if (next < default_eob) {
- band = bands[i + 1];
+ band = vp9_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][
@@ -541,7 +538,7 @@
* add a new trellis node, but we do need to update the costs.
*/
else {
- band = bands[i + 1];
+ band = vp9_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. */
@@ -558,7 +555,7 @@
}
/* Now pick the best path through the whole trellis. */
- band = bands[i + 1];
+ band = vp9_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
@@ -431,7 +431,7 @@
int c = (type == PLANE_TYPE_Y_NO_DC) ? 1 : 0;
int cost = 0, seg_eob;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
- const int *scan, *band;
+ const int *scan;
int16_t *qcoeff_ptr = b->qcoeff;
const TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type(xd, b) : DCT_DCT;
@@ -443,7 +443,6 @@
switch (tx_size) {
case TX_4X4:
scan = vp9_default_zig_zag1d_4x4;
- band = vp9_coef_bands_4x4;
seg_eob = 16;
if (type == PLANE_TYPE_Y_WITH_DC) {
if (tx_type == ADST_DCT) {
@@ -456,17 +455,14 @@
case TX_8X8:
if (type == PLANE_TYPE_Y2) {
scan = vp9_default_zig_zag1d_4x4;
- band = vp9_coef_bands_4x4;
seg_eob = 4;
} else {
scan = vp9_default_zig_zag1d_8x8;
- band = vp9_coef_bands_8x8;
seg_eob = 64;
}
break;
case TX_16X16:
scan = vp9_default_zig_zag1d_16x16;
- band = vp9_coef_bands_16x16;
seg_eob = 256;
if (type == PLANE_TYPE_UV) {
const int uv_idx = ib - 16;
@@ -475,7 +471,6 @@
break;
case TX_32X32:
scan = vp9_default_zig_zag1d_32x32;
- band = vp9_coef_bands_32x32;
seg_eob = 1024;
qcoeff_ptr = xd->sb_coeff_data.qcoeff;
break;
@@ -494,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[band[c]][pt][t];
+ cost += token_costs[vp9_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][band[c]]
+ cost += mb->hybrid_token_costs[tx_size][type][vp9_get_coef_band(c)]
[pt][DCT_EOB_TOKEN];
} else {
int recent_energy = 0;
@@ -506,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[band[c]][pt][t];
+ cost += token_costs[vp9_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][band[c]]
+ cost += mb->token_costs[tx_size][type][vp9_get_coef_band(c)]
[pt][DCT_EOB_TOKEN];
}
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -116,7 +116,7 @@
int16_t *qcoeff_ptr = b->qcoeff;
int seg_eob;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
- const int *bands, *scan;
+ const int *scan;
vp9_coeff_count *counts;
vp9_coeff_probs *probs;
const TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
@@ -138,7 +138,6 @@
default:
case TX_4X4:
seg_eob = 16;
- bands = vp9_coef_bands_4x4;
scan = vp9_default_zig_zag1d_4x4;
if (tx_type != DCT_DCT) {
counts = cpi->hybrid_coef_counts_4x4;
@@ -156,7 +155,6 @@
case TX_8X8:
if (type == PLANE_TYPE_Y2) {
seg_eob = 4;
- bands = vp9_coef_bands_4x4;
scan = vp9_default_zig_zag1d_4x4;
} else {
#if CONFIG_CNVCONTEXT
@@ -164,7 +162,6 @@
l_ec = (l[0] + l[1]) != 0;
#endif
seg_eob = 64;
- bands = vp9_coef_bands_8x8;
scan = vp9_default_zig_zag1d_8x8;
}
if (tx_type != DCT_DCT) {
@@ -186,7 +183,6 @@
}
#endif
seg_eob = 256;
- bands = vp9_coef_bands_16x16;
scan = vp9_default_zig_zag1d_16x16;
if (tx_type != DCT_DCT) {
counts = cpi->hybrid_coef_counts_16x16;
@@ -210,7 +206,6 @@
l_ec = l_ec != 0;
#endif
seg_eob = 1024;
- bands = vp9_coef_bands_32x32;
scan = vp9_default_zig_zag1d_32x32;
counts = cpi->coef_counts_32x32;
probs = cpi->common.fc.coef_probs_32x32;
@@ -224,7 +219,7 @@
seg_eob = 0;
do {
- const int band = bands[c];
+ const int band = vp9_get_coef_band(c);
int token;
if (c < eob) {
@@ -703,7 +698,6 @@
TX_SIZE tx_size,
int dry_run) {
const BLOCKD * const b = xd->block + ib;
- const int *bands;
vp9_coeff_count *counts;
vp9_coeff_probs *probs;
int pt, band;
@@ -723,7 +717,6 @@
switch (tx_size) {
default:
case TX_4X4:
- bands = vp9_coef_bands_4x4;
if (tx_type != DCT_DCT) {
counts = cpi->hybrid_coef_counts_4x4;
probs = cpi->common.fc.hybrid_coef_probs_4x4;
@@ -739,7 +732,6 @@
l_ec = (l[0] + l[1]) != 0;
}
#endif
- bands = vp9_coef_bands_8x8;
if (tx_type != DCT_DCT) {
counts = cpi->hybrid_coef_counts_8x8;
probs = cpi->common.fc.hybrid_coef_probs_8x8;
@@ -758,7 +750,6 @@
l_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0;
}
#endif
- bands = vp9_coef_bands_16x16;
if (tx_type != DCT_DCT) {
counts = cpi->hybrid_coef_counts_16x16;
probs = cpi->common.fc.hybrid_coef_probs_16x16;
@@ -776,7 +767,6 @@
a_ec = a_ec != 0;
l_ec = l_ec != 0;
#endif
- bands = vp9_coef_bands_32x32;
counts = cpi->coef_counts_32x32;
probs = cpi->common.fc.coef_probs_32x32;
break;
@@ -784,7 +774,7 @@
VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec);
- band = bands[(type == PLANE_TYPE_Y_NO_DC) ? 1 : 0];
+ band = vp9_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;
--
⑨