Add ability to have multiple compound modes for interinter
This is currently just a refactor and creates no change in performance.
It allows new compound types to be added easily in the future to
facilitate experiments with segmentation masks.
Change-Id: If48fed216d482454fabb45a304b4220ada0dbdee
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 4c8c2fa..7030210 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -111,6 +111,7 @@
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
static struct av1_token interintra_mode_encodings[INTERINTRA_MODES];
+static struct av1_token compound_type_encodings[COMPOUND_TYPES];
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
static struct av1_token motion_mode_encodings[MOTION_MODES];
@@ -155,6 +156,7 @@
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
av1_tokens_from_tree(interintra_mode_encodings, av1_interintra_mode_tree);
+ av1_tokens_from_tree(compound_type_encodings, av1_compound_type_tree);
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
av1_tokens_from_tree(motion_mode_encodings, av1_motion_mode_tree);
@@ -1602,9 +1604,10 @@
mbmi->motion_mode != SIMPLE_TRANSLATION) &&
#endif // CONFIG_MOTION_VAR
is_interinter_wedge_used(bsize)) {
- aom_write(w, mbmi->use_wedge_interinter,
- cm->fc->wedge_interinter_prob[bsize]);
- if (mbmi->use_wedge_interinter) {
+ av1_write_token(w, av1_compound_type_tree,
+ cm->fc->compound_type_prob[bsize],
+ &compound_type_encodings[mbmi->interinter_compound]);
+ if (mbmi->interinter_compound) {
aom_write_literal(w, mbmi->interinter_wedge_index,
get_wedge_bits_lookup(bsize));
aom_write_bit(w, mbmi->interinter_wedge_sign);
@@ -4133,8 +4136,9 @@
if (cm->reference_mode != SINGLE_REFERENCE) {
for (i = 0; i < BLOCK_SIZES; i++)
if (is_interinter_wedge_used(i))
- av1_cond_prob_diff_update(header_bc, &fc->wedge_interinter_prob[i],
- cm->counts.wedge_interinter[i], probwt);
+ prob_diff_update(av1_compound_type_tree, fc->compound_type_prob[i],
+ cm->counts.compound_interinter[i], COMPOUND_TYPES,
+ probwt, header_bc);
}
#endif // CONFIG_EXT_INTER