NEW_MULTISYMBOL: adapt transform partition split. Change-Id: I9c8201c7053dba11e9ac0f02c1bffbb4a322e654
diff --git a/av1/common/entropy.c b/av1/common/entropy.c index 98732a8..69966a7 100644 --- a/av1/common/entropy.c +++ b/av1/common/entropy.c
@@ -5654,12 +5654,6 @@ AVERAGE_TILE_CDFS(tx_size_cdf); -#if CONFIG_VAR_TX -// FIXME: txfm_partition probs -#endif - - // FIXME: skip probs - AVERAGE_TILE_CDFS(intra_ext_tx_cdf) AVERAGE_TILE_CDFS(inter_ext_tx_cdf); @@ -5680,6 +5674,9 @@ #if CONFIG_NEW_MULTISYMBOL AVERAGE_TILE_CDFS(skip_cdfs) +#if CONFIG_VAR_TX + AVERAGE_TILE_CDFS(txfm_partition_cdf) +#endif #endif }
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c index 4169ad4..c16f0e4 100644 --- a/av1/common/entropymode.c +++ b/av1/common/entropymode.c
@@ -2130,6 +2130,27 @@ static const aom_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = { 250, 231, 212, 241, 166, 66, 241, 230, 135, 243, 154, 64, 248, 161, 63, 128, }; +#if CONFIG_NEW_MULTISYMBOL +static const aom_cdf_prob + default_txfm_partition_cdf[TXFM_PARTITION_CONTEXTS][CDF_SIZE(2)] = { + { AOM_ICDF(250 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(231 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(212 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(241 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(166 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(66 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(241 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(230 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(135 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(243 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(154 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(64 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(248 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(161 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(63 * 128), AOM_ICDF(32768), 0 }, + { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 } + }; +#endif // CONFIG_NEW_MULTISYMBOL #endif static const aom_prob default_skip_probs[SKIP_CONTEXTS] = { 192, 128, 64 }; @@ -4880,6 +4901,9 @@ #endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT #if CONFIG_VAR_TX av1_copy(fc->txfm_partition_prob, default_txfm_partition_probs); +#if CONFIG_NEW_MULTISYMBOL + av1_copy(fc->txfm_partition_cdf, default_txfm_partition_cdf); +#endif #endif av1_copy(fc->skip_probs, default_skip_probs); av1_copy(fc->newmv_prob, default_newmv_prob);
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h index 0f3b65a..c8a1a3c 100644 --- a/av1/common/entropymode.h +++ b/av1/common/entropymode.h
@@ -266,7 +266,10 @@ #endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT #if CONFIG_VAR_TX aom_prob txfm_partition_prob[TXFM_PARTITION_CONTEXTS]; +#if CONFIG_NEW_MULTISYMBOL + aom_cdf_prob txfm_partition_cdf[TXFM_PARTITION_CONTEXTS][CDF_SIZE(2)]; #endif +#endif // CONFIG_VAR_TX aom_prob skip_probs[SKIP_CONTEXTS]; #if CONFIG_NEW_MULTISYMBOL aom_cdf_prob skip_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)];
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index f37ccbd..35116bf 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -5044,11 +5044,11 @@ #endif // !CONFIG_PVQ #endif // CONFIG_LV_MAP +#if !CONFIG_NEW_MULTISYMBOL #if CONFIG_VAR_TX for (i = 0; i < TXFM_PARTITION_CONTEXTS; ++i) av1_diff_update_prob(&r, &fc->txfm_partition_prob[i], ACCT_STR); #endif // CONFIG_VAR_TX -#if !CONFIG_NEW_MULTISYMBOL for (i = 0; i < SKIP_CONTEXTS; ++i) av1_diff_update_prob(&r, &fc->skip_probs[i], ACCT_STR); #endif
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index be7a591..5f3e83d 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -432,6 +432,10 @@ MB_MODE_INFO *mbmi, FRAME_COUNTS *counts, TX_SIZE tx_size, int depth, int blk_row, int blk_col, aom_reader *r) { +#if CONFIG_NEW_MULTISYMBOL + FRAME_CONTEXT *ec_ctx = xd->tile_ctx; + (void)cm; +#endif int is_split = 0; const int tx_row = blk_row >> 1; const int tx_col = blk_col >> 1; @@ -459,7 +463,11 @@ return; } +#if CONFIG_NEW_MULTISYMBOL + is_split = aom_read_symbol(r, ec_ctx->txfm_partition_cdf[ctx], 2, ACCT_STR); +#else is_split = aom_read(r, cm->fc->txfm_partition_prob[ctx], ACCT_STR); +#endif if (is_split) { const TX_SIZE sub_txs = sub_tx_size_map[tx_size];
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index c4bd5d2..0fca4ca 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c
@@ -390,10 +390,14 @@ #endif // !CONFIG_EC_ADAPT || CONFIG_COMPOUND_SINGLEREF #if CONFIG_VAR_TX -static void write_tx_size_vartx(const AV1_COMMON *cm, const MACROBLOCKD *xd, +static void write_tx_size_vartx(const AV1_COMMON *cm, MACROBLOCKD *xd, const MB_MODE_INFO *mbmi, TX_SIZE tx_size, int depth, int blk_row, int blk_col, aom_writer *w) { +#if CONFIG_NEW_MULTISYMBOL + FRAME_CONTEXT *ec_ctx = xd->tile_ctx; + (void)cm; +#endif const int tx_row = blk_row >> 1; const int tx_col = blk_col >> 1; const int max_blocks_high = max_block_high(xd, mbmi->sb_type, 0); @@ -412,7 +416,12 @@ } if (tx_size == mbmi->inter_tx_size[tx_row][tx_col]) { +#if CONFIG_NEW_MULTISYMBOL + aom_write_symbol(w, 0, ec_ctx->txfm_partition_cdf[ctx], 2); +#else aom_write(w, 0, cm->fc->txfm_partition_prob[ctx]); +#endif + txfm_partition_update(xd->above_txfm_context + blk_col, xd->left_txfm_context + blk_row, tx_size, tx_size); } else { @@ -420,7 +429,11 @@ const int bsl = tx_size_wide_unit[sub_txs]; int i; +#if CONFIG_NEW_MULTISYMBOL + aom_write_symbol(w, 1, ec_ctx->txfm_partition_cdf[ctx], 2); +#else aom_write(w, 1, cm->fc->txfm_partition_prob[ctx]); +#endif if (tx_size == TX_8X8) { txfm_partition_update(xd->above_txfm_context + blk_col, @@ -438,6 +451,7 @@ } } +#if !CONFIG_NEW_MULTISYMBOL static void update_txfm_partition_probs(AV1_COMMON *cm, aom_writer *w, FRAME_COUNTS *counts, int probwt) { int k; @@ -445,6 +459,7 @@ av1_cond_prob_diff_update(w, &cm->fc->txfm_partition_prob[k], counts->txfm_partition[k], probwt); } +#endif // CONFIG_NEW_MULTISYMBOL #endif static void write_selected_tx_size(const AV1_COMMON *cm, const MACROBLOCKD *xd, @@ -5030,7 +5045,7 @@ #endif // CONFIG_PVQ #endif // CONFIG_LV_MAP -#if CONFIG_VAR_TX +#if CONFIG_VAR_TX && !CONFIG_NEW_MULTISYMBOL update_txfm_partition_probs(cm, header_bc, counts, probwt); #endif