Commit 61e3e372 authored by Thomas Davies's avatar Thomas Davies

NEW_MULTISYMBOL: Adapt skip binary symbol.

Perform symbol-by-symbol adaptation for the skip syntax
element and remove updates from the compressed header.

Change-Id: Ic42f60e19c56db52dd51b3784fd305c7e6b595c7
parent 7bfa1432
......@@ -5677,6 +5677,10 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
AVERAGE_TILE_CDFS(intra_filter_cdf)
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
#if CONFIG_NEW_MULTISYMBOL
AVERAGE_TILE_CDFS(skip_cdfs)
#endif
}
void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
......
......@@ -1775,6 +1775,13 @@ static const aom_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = {
#endif
static const aom_prob default_skip_probs[SKIP_CONTEXTS] = { 192, 128, 64 };
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob default_skip_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)] = {
{ AOM_ICDF(24576), AOM_ICDF(32768), 0 },
{ AOM_ICDF(16384), AOM_ICDF(32768), 0 },
{ AOM_ICDF(8192), AOM_ICDF(32768), 0 }
};
#endif
#if CONFIG_DUAL_FILTER
#if USE_EXTRA_FILTER
......@@ -4547,6 +4554,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->partition_cdf, default_partition_cdf);
av1_copy(fc->intra_ext_tx_cdf, default_intra_ext_tx_cdf);
av1_copy(fc->inter_ext_tx_cdf, default_inter_ext_tx_cdf);
#if CONFIG_NEW_MULTISYMBOL
av1_copy(fc->skip_cdfs, default_skip_cdfs);
#endif
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
av1_copy(fc->intra_filter_cdf, default_intra_filter_cdf);
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
......
......@@ -226,6 +226,9 @@ typedef struct frame_contexts {
aom_prob txfm_partition_prob[TXFM_PARTITION_CONTEXTS];
#endif
aom_prob skip_probs[SKIP_CONTEXTS];
#if CONFIG_NEW_MULTISYMBOL
aom_cdf_prob skip_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)];
#endif
nmv_context nmvc[NMV_CONTEXTS];
#if CONFIG_INTRABC
nmv_context ndvc;
......
......@@ -2302,7 +2302,16 @@ static int read_skip(AV1_COMMON *cm, const MACROBLOCKD *xd, int segment_id,
return 1;
} 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);
#endif
FRAME_COUNTS *counts = xd->counts;
if (counts) ++counts->skip[ctx][skip];
return skip;
......@@ -4931,7 +4940,7 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#endif
FRAME_CONTEXT *const fc = cm->fc;
aom_reader r;
int k, i;
int i;
#if !CONFIG_EC_ADAPT || \
(CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION || CONFIG_EXT_INTER)
int j;
......@@ -4973,11 +4982,13 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#endif // CONFIG_LV_MAP
#if CONFIG_VAR_TX
for (k = 0; k < TXFM_PARTITION_CONTEXTS; ++k)
av1_diff_update_prob(&r, &fc->txfm_partition_prob[k], ACCT_STR);
for (i = 0; i < TXFM_PARTITION_CONTEXTS; ++i)
av1_diff_update_prob(&r, &fc->txfm_partition_prob[i], ACCT_STR);
#endif // CONFIG_VAR_TX
for (k = 0; k < SKIP_CONTEXTS; ++k)
av1_diff_update_prob(&r, &fc->skip_probs[k], ACCT_STR);
#if !CONFIG_NEW_MULTISYMBOL
for (i = 0; i < SKIP_CONTEXTS; ++i)
av1_diff_update_prob(&r, &fc->skip_probs[i], ACCT_STR);
#endif
#if CONFIG_DELTA_Q && !CONFIG_EC_ADAPT
#if CONFIG_EXT_DELTA_Q
......@@ -4998,11 +5009,11 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#if !CONFIG_EC_ADAPT
if (cm->seg.enabled && cm->seg.update_map) {
if (cm->seg.temporal_update) {
for (k = 0; k < PREDICTION_PROBS; k++)
av1_diff_update_prob(&r, &cm->fc->seg.pred_probs[k], ACCT_STR);
for (i = 0; i < PREDICTION_PROBS; i++)
av1_diff_update_prob(&r, &cm->fc->seg.pred_probs[i], ACCT_STR);
}
for (k = 0; k < MAX_SEGMENTS - 1; k++)
av1_diff_update_prob(&r, &cm->fc->seg.tree_probs[k], ACCT_STR);
for (i = 0; i < MAX_SEGMENTS - 1; i++)
av1_diff_update_prob(&r, &cm->fc->seg.tree_probs[i], ACCT_STR);
}
for (j = 0; j < INTRA_MODES; j++) {
......@@ -5041,6 +5052,7 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
av1_copy(cm->kf_y_prob, av1_kf_y_mode_prob);
av1_copy(cm->fc->kf_y_cdf, av1_kf_y_mode_cdf);
#if !CONFIG_EC_ADAPT
int k;
for (k = 0; k < INTRA_MODES; k++)
for (j = 0; j < INTRA_MODES; j++)
for (i = 0; i < INTRA_MODES - 1; ++i)
......
......@@ -613,7 +613,12 @@ static int read_skip(AV1_COMMON *cm, const MACROBLOCKD *xd, int segment_id,
return 1;
} else {
const int ctx = av1_get_skip_context(xd);
#if CONFIG_NEW_MULTISYMBOL
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
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);
#endif
FRAME_COUNTS *counts = xd->counts;
if (counts) ++counts->skip[ctx][skip];
return skip;
......
......@@ -548,7 +548,13 @@ static int write_skip(const AV1_COMMON *cm, const MACROBLOCKD *xd,
return 1;
} else {
const int skip = mi->mbmi.skip;
#if CONFIG_NEW_MULTISYMBOL
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
const int ctx = av1_get_skip_context(xd);
aom_write_symbol(w, skip, ec_ctx->skip_cdfs[ctx], 2);
#else
aom_write(w, skip, av1_get_skip_prob(cm, xd));
#endif
return skip;
}
}
......@@ -675,6 +681,7 @@ static void update_delta_lf_probs(AV1_COMMON *cm, aom_writer *w,
#endif // CONFIG_EXT_DELTA_Q
#endif // CONFIG_DELTA_Q
#if !CONFIG_NEW_MULTISYMBOL
static void update_skip_probs(AV1_COMMON *cm, aom_writer *w,
FRAME_COUNTS *counts) {
int k;
......@@ -688,6 +695,7 @@ static void update_skip_probs(AV1_COMMON *cm, aom_writer *w,
probwt);
}
}
#endif
#if !CONFIG_EC_ADAPT
static void update_switchable_interp_probs(AV1_COMMON *cm, aom_writer *w,
......@@ -4845,7 +4853,9 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
update_txfm_partition_probs(cm, header_bc, counts, probwt);
#endif
#if !CONFIG_NEW_MULTISYMBOL
update_skip_probs(cm, header_bc, counts);
#endif
#if !CONFIG_EC_ADAPT && CONFIG_DELTA_Q
update_delta_q_probs(cm, header_bc, counts);
#if CONFIG_EXT_DELTA_Q
......
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