NEW_MULTISYMBOL: Adapt intra_inter binary symbol.
Adapt the intra_inter binary syntax element symbol-by-symbol
and remove updates from the compressed header.
Change-Id: I9abfd91d4521202f27854ce3e01b670ce15846e9
diff --git a/av1/common/entropy.c b/av1/common/entropy.c
index 38ba284..abd5f9b 100644
--- a/av1/common/entropy.c
+++ b/av1/common/entropy.c
@@ -5710,6 +5710,9 @@
if (cm->interp_filter == SWITCHABLE) {
AVERAGE_TILE_CDFS(switchable_interp_cdf)
}
+#if CONFIG_NEW_MULTISYMBOL
+ AVERAGE_TILE_CDFS(intra_inter_cdf)
+#endif
}
#if CONFIG_PVQ
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index c5aca1d..7bebddc 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -1340,6 +1340,16 @@
9, 102, 187, 225
};
+#if CONFIG_NEW_MULTISYMBOL
+static const aom_cdf_prob
+ default_intra_inter_cdf[INTRA_INTER_CONTEXTS][CDF_SIZE(2)] = {
+ { AOM_ICDF(1152), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(13056), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(23936), AOM_ICDF(32768), 0 },
+ { AOM_ICDF(28800), AOM_ICDF(32768), 0 }
+ };
+#endif
+
static const aom_prob default_comp_inter_p[COMP_INTER_CONTEXTS] = {
239, 183, 119, 96, 41
};
@@ -4556,6 +4566,7 @@
av1_copy(fc->inter_ext_tx_cdf, default_inter_ext_tx_cdf);
#if CONFIG_NEW_MULTISYMBOL
av1_copy(fc->skip_cdfs, default_skip_cdfs);
+ av1_copy(fc->intra_inter_cdf, default_intra_inter_cdf);
#endif
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
av1_copy(fc->intra_filter_cdf, default_intra_filter_cdf);
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index ef5b5d7..e547e13 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -228,6 +228,7 @@
aom_prob skip_probs[SKIP_CONTEXTS];
#if CONFIG_NEW_MULTISYMBOL
aom_cdf_prob skip_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)];
+ aom_cdf_prob intra_inter_cdf[INTRA_INTER_CONTEXTS][CDF_SIZE(2)];
#endif
nmv_context nmvc[NMV_CONTEXTS];
#if CONFIG_INTRABC
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index b230f84..052aac7 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -2303,11 +2303,7 @@
} else {
const int ctx = av1_get_skip_context(xd);
#if CONFIG_NEW_MULTISYMBOL
-#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
-#else
- FRAME_CONTEXT *ec_ctx = cm->fc;
-#endif
const int skip = aom_read_symbol(r, ec_ctx->skip_cdfs[ctx], 2, ACCT_STR);
#else
const int skip = aom_read(r, cm->fc->skip_probs[ctx], ACCT_STR);
@@ -5118,9 +5114,10 @@
#if !CONFIG_EC_ADAPT
if (cm->interp_filter == SWITCHABLE) read_switchable_interp_probs(fc, &r);
#endif
-
+#if !CONFIG_NEW_MULTISYMBOL
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
av1_diff_update_prob(&r, &fc->intra_inter_prob[i], ACCT_STR);
+#endif
if (cm->reference_mode != SINGLE_REFERENCE)
setup_compound_reference_mode(cm);
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index a9ac223..273c567 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -1876,7 +1876,17 @@
return get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) != INTRA_FRAME;
} else {
const int ctx = av1_get_intra_inter_context(xd);
+#if CONFIG_NEW_MULTISYMBOL
+#if CONFIG_EC_ADAPT
+ FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
+#else
+ FRAME_CONTEXT *ec_ctx = cm->fc;
+#endif
+ const int is_inter =
+ aom_read_symbol(r, ec_ctx->intra_inter_cdf[ctx], 2, ACCT_STR);
+#else
const int is_inter = aom_read(r, cm->fc->intra_inter_prob[ctx], ACCT_STR);
+#endif
FRAME_COUNTS *counts = xd->counts;
if (counts) ++counts->intra_inter[ctx][is_inter];
return is_inter;
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index d51e783..5bc6be6 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -559,6 +559,19 @@
}
}
+static void write_is_inter(const AV1_COMMON *cm, const MACROBLOCKD *xd,
+ int segment_id, aom_writer *w, const int is_inter) {
+ if (!segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
+#if CONFIG_NEW_MULTISYMBOL
+ FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
+ const int ctx = av1_get_intra_inter_context(xd);
+ aom_write_symbol(w, is_inter, ec_ctx->intra_inter_cdf[ctx], 2);
+#else
+ aom_write(w, is_inter, av1_get_intra_inter_prob(cm, xd));
+#endif
+ }
+}
+
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
static void write_motion_mode(const AV1_COMMON *cm, const MODE_INFO *mi,
aom_writer *w) {
@@ -1862,8 +1875,7 @@
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
- if (!segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
- aom_write(w, is_inter, av1_get_intra_inter_prob(cm, xd));
+ write_is_inter(cm, xd, mbmi->segment_id, w, is_inter);
if (cm->tx_mode == TX_MODE_SELECT &&
#if CONFIG_CB4X4 && (CONFIG_VAR_TX || CONFIG_RECT_TX)
@@ -4984,9 +4996,11 @@
update_switchable_interp_probs(cm, header_bc, counts);
#endif
+#if !CONFIG_NEW_MULTISYMBOL
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
av1_cond_prob_diff_update(header_bc, &fc->intra_inter_prob[i],
counts->intra_inter[i], probwt);
+#endif
if (cpi->allow_comp_inter_inter) {
const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;