Commit f6ad9355 authored by Thomas Davies's avatar Thomas Davies

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
parent 61e3e372
......@@ -5710,6 +5710,9 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
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
......
......@@ -1340,6 +1340,16 @@ static const aom_prob default_intra_inter_p[INTRA_INTER_CONTEXTS] = {
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 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
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);
......
......@@ -228,6 +228,7 @@ typedef struct frame_contexts {
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
......
......@@ -2303,11 +2303,7 @@ static int read_skip(AV1_COMMON *cm, const MACROBLOCKD *xd, int segment_id,
} 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 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#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);
......
......@@ -1876,7 +1876,17 @@ static int read_is_inter_block(AV1_COMMON *const cm, MACROBLOCKD *const xd,
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;
......
......@@ -559,6 +559,19 @@ static int write_skip(const AV1_COMMON *cm, const MACROBLOCKD *xd,
}
}
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 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#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 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
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;
......
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