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
diff --git a/av1/common/entropy.c b/av1/common/entropy.c index 3ce205e..38ba284 100644 --- a/av1/common/entropy.c +++ b/av1/common/entropy.c
@@ -5677,6 +5677,10 @@ #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,
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index dfe9719..c5aca1d 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c
@@ -1775,6 +1775,13 @@ #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 @@ 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
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index b329e07..ef5b5d7 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h
@@ -226,6 +226,9 @@ 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;
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 374dd01..b230f84 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -2302,7 +2302,16 @@ 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 @@ #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 @@ #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 @@ #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 @@ 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)
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index a1700ff..a9ac223 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -613,7 +613,12 @@ 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;
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index d53a125..d51e783 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -548,7 +548,13 @@ 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 @@ #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 @@ probwt); } } +#endif #if !CONFIG_EC_ADAPT static void update_switchable_interp_probs(AV1_COMMON *cm, aom_writer *w, @@ -4845,7 +4853,9 @@ 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