Commit 4a81001b authored by Timothy B. Terriberry's avatar Timothy B. Terriberry Committed by Tim Terriberry

ext_inter: Skip compound type probs. for small block sizes.

When writing the compressed header, prob_diff_update() was called
for compound_type_prob[] for every defined block size, even though
luma never uses block sizes smaller than 4x4.

This fixes is_any_masked_compound_used() and
is_interinter_compound_used() to properly return 0 for chroma-only
block sizes, and then uses these functions to guard the probability
updates in write_compressed_header() and read_compressed_header(),
the same way the actual compound type values are guarded in
read_inter_block_mode_info() and pack_inter_mode_mvs().

Change-Id: Ib521cf53f9ec166ef634609c8b47c5814b6a9ff5
parent 8c469663
......@@ -204,7 +204,11 @@ static INLINE int is_interinter_compound_used(COMPOUND_TYPE type,
BLOCK_SIZE sb_type) {
(void)sb_type;
switch (type) {
#if CONFIG_CB4X4
case COMPOUND_AVERAGE: return sb_type >= BLOCK_4X4;
#else // CONFIG_CB4X4
case COMPOUND_AVERAGE: return 1;
#endif // CONFIG_CB4X4
#if CONFIG_WEDGE
case COMPOUND_WEDGE: return wedge_params_lookup[sb_type].bits > 0;
#endif // CONFIG_WEDGE
......@@ -217,6 +221,9 @@ static INLINE int is_interinter_compound_used(COMPOUND_TYPE type,
static INLINE int is_any_masked_compound_used(BLOCK_SIZE sb_type) {
COMPOUND_TYPE comp_type;
#if CONFIG_CB4X4
if (sb_type < BLOCK_4X4) return 0;
#endif // CONFIG_CB4X4
for (comp_type = 0; comp_type < COMPOUND_TYPES; comp_type++) {
if (is_masked_compound_type(comp_type) &&
is_interinter_compound_used(comp_type, sb_type))
......
......@@ -5106,8 +5106,10 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
if (cm->reference_mode != SINGLE_REFERENCE && cm->allow_masked_compound) {
#endif // CONFIG_COMPOUND_SINGLEREF
for (i = 0; i < BLOCK_SIZES; i++) {
for (j = 0; j < COMPOUND_TYPES - 1; j++) {
av1_diff_update_prob(&r, &fc->compound_type_prob[i][j], ACCT_STR);
if (is_any_masked_compound_used(i)) {
for (j = 0; j < COMPOUND_TYPES - 1; j++) {
av1_diff_update_prob(&r, &fc->compound_type_prob[i][j], ACCT_STR);
}
}
}
}
......
......@@ -5072,10 +5072,13 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
#else // !CONFIG_COMPOUND_SINGLEREF
if (cm->reference_mode != SINGLE_REFERENCE && cm->allow_masked_compound) {
#endif // CONFIG_COMPOUND_SINGLEREF
for (i = 0; i < BLOCK_SIZES; i++)
prob_diff_update(av1_compound_type_tree, fc->compound_type_prob[i],
cm->counts.compound_interinter[i], COMPOUND_TYPES,
probwt, header_bc);
for (i = 0; i < BLOCK_SIZES; i++) {
if (is_any_masked_compound_used(i)) {
prob_diff_update(av1_compound_type_tree, fc->compound_type_prob[i],
cm->counts.compound_interinter[i], COMPOUND_TYPES,
probwt, header_bc);
}
}
}
#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
......
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