New previous coef context experiment
Adds an experiment to derive the previous context of a coefficient not just from the previous coefficient in the scan order but from a combination of several neighboring coefficients previously encountered in scan order. A precomputed table of neighbors for each location for each scan type and block size is used. Currently 5 neighbors are used. Results are about 0.2% positive using a strategy where the max coef magnitude from the 5 neigbors is used to derive the context. Change-Id: Ie708b54d8e1898af742846ce2d1e2b0d89fd4ad5
This commit is contained in:
@@ -63,11 +63,24 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) {
|
||||
return decode_bool(br, 128) ? -value_to_sign : value_to_sign;
|
||||
}
|
||||
|
||||
#define INCREMENT_COUNT(token) \
|
||||
do { \
|
||||
#if CONFIG_NEWCOEFCONTEXT
|
||||
#define PT pn
|
||||
#define INCREMENT_COUNT(token) \
|
||||
do { \
|
||||
coef_counts[type][coef_bands[c]][pn][token]++; \
|
||||
pn = pt = vp9_prev_token_class[token]; \
|
||||
if (c < seg_eob - 1 && NEWCOEFCONTEXT_BAND_COND(coef_bands[c + 1])) \
|
||||
pn = vp9_get_coef_neighbor_context( \
|
||||
qcoeff_ptr, nodc, neighbors, scan[c + 1]); \
|
||||
} while (0)
|
||||
#else
|
||||
#define PT pt
|
||||
#define INCREMENT_COUNT(token) \
|
||||
do { \
|
||||
coef_counts[type][coef_bands[c]][pt][token]++; \
|
||||
pt = vp9_prev_token_class[token]; \
|
||||
} while (0)
|
||||
#endif /* CONFIG_NEWCOEFCONTEXT */
|
||||
|
||||
#define WRITE_COEF_CONTINUE(val, token) \
|
||||
{ \
|
||||
@@ -92,7 +105,12 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
|
||||
const int *const scan, TX_SIZE txfm_size,
|
||||
const int *coef_bands) {
|
||||
FRAME_CONTEXT *const fc = &dx->common.fc;
|
||||
int pt, c = (type == PLANE_TYPE_Y_NO_DC);
|
||||
#if CONFIG_NEWCOEFCONTEXT
|
||||
const int *neighbors;
|
||||
int pn;
|
||||
#endif
|
||||
int nodc = (type == PLANE_TYPE_Y_NO_DC);
|
||||
int pt, c = nodc;
|
||||
vp9_coeff_probs *coef_probs;
|
||||
vp9_prob *prob;
|
||||
vp9_coeff_count *coef_counts;
|
||||
@@ -135,11 +153,15 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
|
||||
}
|
||||
|
||||
VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
|
||||
#if CONFIG_NEWCOEFCONTEXT
|
||||
pn = pt;
|
||||
neighbors = vp9_get_coef_neighbors_handle(scan);
|
||||
#endif
|
||||
while (1) {
|
||||
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][coef_bands[c]][PT];
|
||||
if (!vp9_read(br, prob[EOB_CONTEXT_NODE]))
|
||||
break;
|
||||
SKIP_START:
|
||||
@@ -147,7 +169,7 @@ SKIP_START:
|
||||
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][coef_bands[c]][PT];
|
||||
goto SKIP_START;
|
||||
}
|
||||
// ONE_CONTEXT_NODE_0_
|
||||
@@ -211,7 +233,7 @@ SKIP_START:
|
||||
}
|
||||
|
||||
if (c < seg_eob)
|
||||
coef_counts[type][coef_bands[c]][pt][DCT_EOB_TOKEN]++;
|
||||
coef_counts[type][coef_bands[c]][PT][DCT_EOB_TOKEN]++;
|
||||
|
||||
a[0] = l[0] = (c > !type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user