Merge "Deprecate code_zerogroup experiment." into experimental

This commit is contained in:
John Koleszar
2013-05-07 17:09:38 -07:00
committed by Gerrit Code Review
16 changed files with 5 additions and 1033 deletions

View File

@@ -530,54 +530,6 @@ static void init_frame(VP9D_COMP *pbi) {
xd->mode_info_stride = pc->mode_info_stride;
}
#if CONFIG_CODE_ZEROGROUP
static void read_zpc_probs_common(VP9_COMMON *cm,
vp9_reader* bc,
TX_SIZE tx_size) {
int r, b, p, n;
vp9_zpc_probs *zpc_probs;
vp9_prob upd = ZPC_UPDATE_PROB;
if (!get_zpc_used(tx_size)) return;
if (!vp9_read_bit(bc)) return;
if (tx_size == TX_32X32) {
zpc_probs = &cm->fc.zpc_probs_32x32;
} else if (tx_size == TX_16X16) {
zpc_probs = &cm->fc.zpc_probs_16x16;
} else if (tx_size == TX_8X8) {
zpc_probs = &cm->fc.zpc_probs_8x8;
} else {
zpc_probs = &cm->fc.zpc_probs_4x4;
}
for (r = 0; r < REF_TYPES; ++r) {
for (b = 0; b < ZPC_BANDS; ++b) {
for (p = 0; p < ZPC_PTOKS; ++p) {
for (n = 0; n < ZPC_NODES; ++n) {
vp9_prob *q = &(*zpc_probs)[r][b][p][n];
#if USE_ZPC_EXTRA == 0
if (n == 1) continue;
#endif
if (vp9_read(bc, upd)) {
*q = read_prob_diff_update(bc, *q);
}
}
}
}
}
}
static void read_zpc_probs(VP9_COMMON *cm,
vp9_reader* bc) {
read_zpc_probs_common(cm, bc, TX_4X4);
if (cm->txfm_mode > ONLY_4X4)
read_zpc_probs_common(cm, bc, TX_8X8);
if (cm->txfm_mode > ALLOW_8X8)
read_zpc_probs_common(cm, bc, TX_16X16);
if (cm->txfm_mode > ALLOW_16X16)
read_zpc_probs_common(cm, bc, TX_32X32);
}
#endif // CONFIG_CODE_ZEROGROUP
static void read_coef_probs_common(vp9_coeff_probs *coef_probs,
TX_SIZE tx_size,
vp9_reader *r) {
@@ -855,18 +807,6 @@ static void update_frame_context(FRAME_CONTEXT *fc) {
vp9_zero(fc->NMVcount);
vp9_zero(fc->mv_ref_ct);
vp9_zero(fc->partition_counts);
#if CONFIG_CODE_ZEROGROUP
vp9_copy(fc->pre_zpc_probs_4x4, fc->zpc_probs_4x4);
vp9_copy(fc->pre_zpc_probs_8x8, fc->zpc_probs_8x8);
vp9_copy(fc->pre_zpc_probs_16x16, fc->zpc_probs_16x16);
vp9_copy(fc->pre_zpc_probs_32x32, fc->zpc_probs_32x32);
vp9_zero(fc->zpc_counts_4x4);
vp9_zero(fc->zpc_counts_8x8);
vp9_zero(fc->zpc_counts_16x16);
vp9_zero(fc->zpc_counts_32x32);
#endif
}
static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
@@ -1124,9 +1064,6 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
update_frame_context(&pc->fc);
read_coef_probs(pbi, &header_bc);
#if CONFIG_CODE_ZEROGROUP
read_zpc_probs(pc, &header_bc);
#endif
// Initialize xd pointers. Any reference should do for xd->pre, so use 0.
setup_pre_planes(xd, &pc->yv12_fb[pc->active_ref_idx[0]], NULL,
@@ -1164,9 +1101,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
// Adaptation
if (!pc->error_resilient_mode && !pc->frame_parallel_decoding_mode) {
vp9_adapt_coef_probs(pc);
#if CONFIG_CODE_ZEROGROUP
vp9_adapt_zpc_probs(pc);
#endif
if (pc->frame_type != KEY_FRAME) {
vp9_adapt_mode_probs(pc);
vp9_adapt_nmv_probs(pc, xd->allow_high_precision_mv);

View File

@@ -60,28 +60,12 @@ static const vp9_prob cat6_prob[15] = {
DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]);
#if CONFIG_CODE_ZEROGROUP
#define ZEROGROUP_ADVANCE() \
do { \
token_cache[scan[c]] = ZERO_TOKEN; \
is_last_zero[o] = 1; \
c++; \
} while (0)
#define INCREMENT_COUNT(token) \
do { \
coef_counts[type][ref][get_coef_band(scan, txfm_size, c)] \
[pt][token]++; \
token_cache[scan[c]] = token; \
is_last_zero[o] = (token == ZERO_TOKEN); \
} while (0)
#else
#define INCREMENT_COUNT(token) \
do { \
coef_counts[type][ref][get_coef_band(scan, txfm_size, c)] \
[pt][token]++; \
token_cache[scan[c]] = token; \
} while (0)
#endif
#define WRITE_COEF_CONTINUE(val, token) \
{ \
@@ -117,20 +101,8 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
vp9_coeff_count *coef_counts;
const int ref = xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME;
TX_TYPE tx_type = DCT_DCT;
#if CONFIG_CODE_ZEROGROUP
int is_eoo[3] = {0, 0, 0};
int is_last_zero[3] = {0, 0, 0};
int o, rc;
vp9_zpc_probs *zpc_probs;
vp9_zpc_count *zpc_count;
vp9_prob *zprobs;
int eoo = 0, use_eoo;
#endif
const int *scan, *nb;
uint8_t token_cache[1024];
#if CONFIG_CODE_ZEROGROUP
vpx_memset(token_cache, UNKNOWN_TOKEN, sizeof(token_cache));
#endif
switch (txfm_size) {
default:
@@ -143,10 +115,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
coef_probs = fc->coef_probs_4x4;
coef_counts = fc->coef_counts_4x4;
default_eob = 16;
#if CONFIG_CODE_ZEROGROUP
zpc_probs = &(fc->zpc_probs_4x4);
zpc_count = &(fc->zpc_counts_4x4);
#endif
break;
}
case TX_8X8: {
@@ -162,10 +130,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
above_ec = (A[0] + A[1]) != 0;
left_ec = (L[0] + L[1]) != 0;
default_eob = 64;
#if CONFIG_CODE_ZEROGROUP
zpc_probs = &(fc->zpc_probs_8x8);
zpc_count = &(fc->zpc_counts_8x8);
#endif
break;
}
case TX_16X16: {
@@ -181,10 +145,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
default_eob = 256;
#if CONFIG_CODE_ZEROGROUP
zpc_probs = &(fc->zpc_probs_16x16);
zpc_count = &(fc->zpc_counts_16x16);
#endif
break;
}
case TX_32X32:
@@ -194,10 +154,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
above_ec = (A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0;
default_eob = 1024;
#if CONFIG_CODE_ZEROGROUP
zpc_probs = &fc->zpc_probs_32x32;
zpc_count = &fc->zpc_counts_32x32;
#endif
break;
}
@@ -218,15 +174,6 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
fc->eob_branch_counts[txfm_size][type][ref][band][pt]++;
if (!vp9_read(r, prob[EOB_CONTEXT_NODE]))
break;
#if CONFIG_CODE_ZEROGROUP
rc = scan[c];
o = vp9_get_orientation(rc, txfm_size);
if (token_cache[rc] == ZERO_TOKEN || is_eoo[o]) {
coef_counts[type][ref][band][pt][ZERO_TOKEN]++;
ZEROGROUP_ADVANCE();
goto SKIP_START;
}
#endif
SKIP_START:
if (c >= seg_eob)
@@ -236,35 +183,7 @@ SKIP_START:
c, default_eob);
band = get_coef_band(scan, txfm_size, c);
prob = coef_probs[type][ref][band][pt];
#if CONFIG_CODE_ZEROGROUP
rc = scan[c];
o = vp9_get_orientation(rc, txfm_size);
if (token_cache[rc] == ZERO_TOKEN || is_eoo[o]) {
ZEROGROUP_ADVANCE();
goto SKIP_START;
}
zprobs = (*zpc_probs)[ref]
[coef_to_zpc_band(band)]
[coef_to_zpc_ptok(pt)];
#endif
if (!vp9_read(r, prob[ZERO_CONTEXT_NODE])) {
#if CONFIG_CODE_ZEROGROUP
eoo = 0;
#if USE_ZPC_EOORIENT == 1
use_eoo = vp9_use_eoo(c, seg_eob, scan, txfm_size, is_last_zero, is_eoo);
#else
use_eoo = 0;
#endif
if (use_eoo) {
eoo = !vp9_read(r, zprobs[0]);
++(*zpc_count)[ref]
[coef_to_zpc_band(band)]
[coef_to_zpc_ptok(pt)][0][!eoo];
if (eoo) {
is_eoo[o] = 1;
}
}
#endif
INCREMENT_COUNT(ZERO_TOKEN);
++c;
goto SKIP_START;