Commit 860def60 authored by Thomas Davies's avatar Thomas Davies

NEW_MULTISYMBOL: adapt comp_inter_mode.

Change-Id: I2e783a16418708c6403de3c2e84450dbc83df3b7
parent 149eda56
......@@ -5690,7 +5690,9 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
aom_cdf_prob *fc_cdf_ptr;
// FIXME: comp_inter_cdf not defined
#if CONFIG_NEW_MULTISYMBOL
AVERAGE_TILE_CDFS(comp_inter_cdf)
#endif
// FIXME: comp_ref_cdf and comp_bwd_ref not defined
......
......@@ -1383,6 +1383,14 @@ static const aom_cdf_prob
static const aom_prob default_comp_inter_p[COMP_INTER_CONTEXTS] = {
239, 183, 119, 96, 41
};
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob default_comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(
2)] = { { AOM_ICDF(239 * 128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(183 * 128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(119 * 128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(96 * 128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(41 * 128), AOM_ICDF(32768), 0 } };
#endif
#if CONFIG_EXT_REFS
static const aom_prob default_comp_ref_p[REF_CONTEXTS][FWD_REFS - 1] = {
......@@ -4523,6 +4531,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->partition_prob, default_partition_probs);
av1_copy(fc->intra_inter_prob, default_intra_inter_p);
av1_copy(fc->comp_inter_prob, default_comp_inter_p);
#if CONFIG_NEW_MULTISYMBOL
av1_copy(fc->comp_inter_cdf, default_comp_inter_cdf);
#endif
av1_copy(fc->comp_ref_prob, default_comp_ref_p);
#if CONFIG_LV_MAP
av1_copy(fc->txb_skip, default_txb_skip);
......
......@@ -214,6 +214,9 @@ typedef struct frame_contexts {
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
aom_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
aom_prob comp_inter_prob[COMP_INTER_CONTEXTS];
#if CONFIG_NEW_MULTISYMBOL
aom_cdf_prob comp_inter_cdf[COMP_INTER_CONTEXTS][CDF_SIZE(2)];
#endif
aom_prob single_ref_prob[REF_CONTEXTS][SINGLE_REFS - 1];
#if CONFIG_EXT_REFS
aom_prob comp_ref_prob[REF_CONTEXTS][FWD_REFS - 1];
......
......@@ -101,6 +101,12 @@ static INLINE aom_prob av1_get_reference_mode_prob(const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
return cm->fc->comp_inter_prob[av1_get_reference_mode_context(cm, xd)];
}
#if CONFIG_NEW_MULTISYMBOL
static INLINE aom_cdf_prob *av1_get_reference_mode_cdf(const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
return xd->tile_ctx->comp_inter_cdf[av1_get_reference_mode_context(cm, xd)];
}
#endif
int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
const MACROBLOCKD *xd);
......
......@@ -275,9 +275,11 @@ static void read_frame_reference_mode_probs(AV1_COMMON *cm, aom_reader *r) {
FRAME_CONTEXT *const fc = cm->fc;
int i, j;
#if !CONFIG_NEW_MULTISYMBOL
if (cm->reference_mode == REFERENCE_MODE_SELECT)
for (i = 0; i < COMP_INTER_CONTEXTS; ++i)
av1_diff_update_prob(r, &fc->comp_inter_prob[i], ACCT_STR);
#endif
if (cm->reference_mode != COMPOUND_REFERENCE) {
for (i = 0; i < REF_CONTEXTS; ++i) {
......
......@@ -1238,11 +1238,13 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
// does the feature use compound prediction or not
// (if not specified at the frame/segment level)
if (cm->reference_mode == REFERENCE_MODE_SELECT) {
#if SUB8X8_COMP_REF
aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd));
#else
#if !SUB8X8_COMP_REF
if (mbmi->sb_type != BLOCK_4X4)
aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd));
#endif
#if CONFIG_NEW_MULTISYMBOL
aom_write_symbol(w, is_compound, av1_get_reference_mode_cdf(cm, xd), 2);
#else
aom_write(w, is_compound, av1_get_reference_mode_prob(cm, xd));
#endif
} else {
assert((!is_compound) == (cm->reference_mode == SINGLE_REFERENCE));
......@@ -5019,6 +5021,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
counts->intra_inter[i], probwt);
#endif
#if !CONFIG_NEW_MULTISYMBOL
if (cpi->allow_comp_inter_inter) {
const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
if (use_hybrid_pred)
......@@ -5026,6 +5029,7 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
av1_cond_prob_diff_update(header_bc, &fc->comp_inter_prob[i],
counts->comp_inter[i], probwt);
}
#endif
if (cm->reference_mode != COMPOUND_REFERENCE) {
for (i = 0; i < REF_CONTEXTS; i++) {
......
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