Commit ab78067c authored by Thomas Davies's avatar Thomas Davies

EC_MULTISYMBOL: Add block zero (CBP) counts and probs.

Preparation for merging EOB_TOKEN. The block_zero value
corresponds to the first EOB_TOKEN: other EOB_TOKEN values will
be merged with non-zero values.

Change-Id: I94036783ee240fa916a79c544ecd716a9c24fa59
parent 9a9f41f9
...@@ -4477,6 +4477,13 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size, ...@@ -4477,6 +4477,13 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
const unsigned int(*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] = const unsigned int(*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] =
(const unsigned int(*)[REF_TYPES][COEF_BANDS] (const unsigned int(*)[REF_TYPES][COEF_BANDS]
[COEFF_CONTEXTS])cm->counts.eob_branch[tx_size]; [COEFF_CONTEXTS])cm->counts.eob_branch[tx_size];
#if CONFIG_EC_MULTISYMBOL
const av1_blockz_probs_model *const pre_blockz_probs =
pre_fc->blockzero_probs[tx_size];
av1_blockz_probs_model *const blockz_probs = cm->fc->blockzero_probs[tx_size];
const av1_blockz_count_model *const blockz_counts =
(const av1_blockz_count_model *)&cm->counts.blockz_count[tx_size][0];
#endif
int i, j, k, l, m; int i, j, k, l, m;
#if CONFIG_RECT_TX #if CONFIG_RECT_TX
assert(!is_rect_tx(tx_size)); assert(!is_rect_tx(tx_size));
...@@ -4498,6 +4505,20 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size, ...@@ -4498,6 +4505,20 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
av1_merge_probs(pre_probs[i][j][k][l][m], branch_ct[m], av1_merge_probs(pre_probs[i][j][k][l][m], branch_ct[m],
count_sat, update_factor); count_sat, update_factor);
} }
#if CONFIG_EC_MULTISYMBOL
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < BLOCKZ_CONTEXTS; ++k) {
const int n0 = blockz_counts[i][j][k][0];
const int n1 = blockz_counts[i][j][k][1];
const unsigned int branch_ct[2] = { n0, n1 };
blockz_probs[i][j][k] = av1_merge_probs(
pre_blockz_probs[i][j][k], branch_ct, count_sat, update_factor);
}
}
}
#endif
} }
void av1_adapt_coef_probs(AV1_COMMON *cm) { void av1_adapt_coef_probs(AV1_COMMON *cm) {
......
...@@ -202,6 +202,8 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full); ...@@ -202,6 +202,8 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full);
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[ENTROPY_TOKENS]; [ENTROPY_TOKENS];
typedef aom_prob av1_blockz_probs_model[REF_TYPES][BLOCKZ_CONTEXTS];
typedef unsigned int av1_blockz_count_model[REF_TYPES][BLOCKZ_CONTEXTS][2];
extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS] extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
[ENTROPY_TOKENS - 2]; [ENTROPY_TOKENS - 2];
extern const aom_cdf_prob av1_pareto8_tail_cdfs[COEFF_PROB_MODELS] extern const aom_cdf_prob av1_pareto8_tail_cdfs[COEFF_PROB_MODELS]
......
...@@ -283,6 +283,9 @@ typedef struct FRAME_COUNTS { ...@@ -283,6 +283,9 @@ typedef struct FRAME_COUNTS {
unsigned int txb_count[TX_SIZES_ALL][TX_TYPES]; unsigned int txb_count[TX_SIZES_ALL][TX_TYPES];
#endif // CONFIG_ADAPT_SCAN #endif // CONFIG_ADAPT_SCAN
#if CONFIG_EC_MULTISYMBOL
av1_blockz_count_model blockz_count[TX_SIZES][PLANE_TYPES];
#endif
#if CONFIG_REF_MV #if CONFIG_REF_MV
unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2]; unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2];
......
...@@ -4622,6 +4622,10 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) { ...@@ -4622,6 +4622,10 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) {
assert(!memcmp(cm->counts.coef, zero_counts.coef, sizeof(cm->counts.coef))); assert(!memcmp(cm->counts.coef, zero_counts.coef, sizeof(cm->counts.coef)));
assert(!memcmp(cm->counts.eob_branch, zero_counts.eob_branch, assert(!memcmp(cm->counts.eob_branch, zero_counts.eob_branch,
sizeof(cm->counts.eob_branch))); sizeof(cm->counts.eob_branch)));
#if CONFIG_EC_MULTISYMBOL
assert(!memcmp(cm->counts.blockz_count, zero_counts.blockz_count,
sizeof(cm->counts.blockz_count)));
#endif
assert(!memcmp(cm->counts.switchable_interp, zero_counts.switchable_interp, assert(!memcmp(cm->counts.switchable_interp, zero_counts.switchable_interp,
sizeof(cm->counts.switchable_interp))); sizeof(cm->counts.switchable_interp)));
assert(!memcmp(cm->counts.inter_mode, zero_counts.inter_mode, assert(!memcmp(cm->counts.inter_mode, zero_counts.inter_mode,
......
...@@ -468,16 +468,18 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col, ...@@ -468,16 +468,18 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
cpi->common.fc->coef_probs[txsize_sqr_map[tx_size]][type][ref]; cpi->common.fc->coef_probs[txsize_sqr_map[tx_size]][type][ref];
#endif // CONFIG_ENTROPY #endif // CONFIG_ENTROPY
#if CONFIG_EC_ADAPT // use per-tile context #if CONFIG_EC_ADAPT
aom_cdf_prob(*const coef_head_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] = FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
xd->tile_ctx->coef_head_cdfs[tx_size][type][ref];
aom_cdf_prob(*const coef_tail_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
xd->tile_ctx->coef_tail_cdfs[tx_size][type][ref];
#elif CONFIG_EC_MULTISYMBOL #elif CONFIG_EC_MULTISYMBOL
FRAME_CONTEXT *ec_ctx = cpi->common.fc;
#endif
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob(*const coef_head_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] = aom_cdf_prob(*const coef_head_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
cpi->common.fc->coef_head_cdfs[tx_size][type][ref]; ec_ctx->coef_head_cdfs[tx_size][type][ref];
aom_cdf_prob(*const coef_tail_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] = aom_cdf_prob(*const coef_tail_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
cpi->common.fc->coef_tail_cdfs[tx_size][type][ref]; ec_ctx->coef_tail_cdfs[tx_size][type][ref];
unsigned int(*const blockz_count)[2] =
td->counts->blockz_count[txsize_sqr_map[tx_size]][type][ref];
#endif #endif
unsigned int(*const eob_branch)[COEFF_CONTEXTS] = unsigned int(*const eob_branch)[COEFF_CONTEXTS] =
td->counts->eob_branch[txsize_sqr_map[tx_size]][type][ref]; td->counts->eob_branch[txsize_sqr_map[tx_size]][type][ref];
...@@ -494,6 +496,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col, ...@@ -494,6 +496,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
c = 0; c = 0;
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
++blockz_count[pt][eob != 0];
while (c < eob) { while (c < eob) {
const int v = qcoeff[scan[c]]; const int v = qcoeff[scan[c]];
eob_branch[band[c]][pt] += !skip_eob; eob_branch[band[c]][pt] += !skip_eob;
......
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