Prevent bitstream from signaling illegal compound types
Currently nothing forbids wedge from being signalled when
the block is > 32X32, even though there is no corresponding wedge
mask for that block size.
BUG=aomedia:640
BUG=aomedia:636
Change-Id: I538be0229a12b5ef01b2e5a950c9f16ef9a5c51e
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 21d3c9b..4773be3 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2110,10 +2110,16 @@
is_any_masked_compound_used(bsize)) {
#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
if (cm->allow_masked_compound) {
- aom_write_symbol(w, mbmi->interinter_compound_type,
- ec_ctx->compound_type_cdf[bsize], COMPOUND_TYPES);
+#if CONFIG_WEDGE && CONFIG_COMPOUND_SEGMENT
+ if (!is_interinter_compound_used(COMPOUND_WEDGE, bsize))
+ aom_write_bit(w, mbmi->interinter_compound_type == COMPOUND_AVERAGE);
+ else
+#endif // CONFIG_WEDGE && CONFIG_COMPOUND_SEGMENT
+ aom_write_symbol(w, mbmi->interinter_compound_type,
+ ec_ctx->compound_type_cdf[bsize], COMPOUND_TYPES);
#if CONFIG_WEDGE
- if (mbmi->interinter_compound_type == COMPOUND_WEDGE) {
+ if (is_interinter_compound_used(COMPOUND_WEDGE, bsize) &&
+ mbmi->interinter_compound_type == COMPOUND_WEDGE) {
aom_write_literal(w, mbmi->wedge_index, get_wedge_bits_lookup(bsize));
aom_write_bit(w, mbmi->wedge_sign);
}