Commit 985bfc38 authored by Thomas Davies's avatar Thomas Davies

NEW_MULTISYMBOL: adapt transform partition split.

Change-Id: I9c8201c7053dba11e9ac0f02c1bffbb4a322e654
parent 708c1ec5
......@@ -5654,12 +5654,6 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
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 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
#if CONFIG_NEW_MULTISYMBOL
AVERAGE_TILE_CDFS(skip_cdfs)
#if CONFIG_VAR_TX
AVERAGE_TILE_CDFS(txfm_partition_cdf)
#endif
#endif
}
......
......@@ -2130,6 +2130,27 @@ int av1_get_palette_color_index_context(const uint8_t *color_map, int stride,
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 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#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);
......
......@@ -266,7 +266,10 @@ typedef struct frame_contexts {
#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)];
......
......@@ -5044,11 +5044,11 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
#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
......
......@@ -432,6 +432,10 @@ static void read_tx_size_vartx(AV1_COMMON *cm, MACROBLOCKD *xd,
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 @@ static void read_tx_size_vartx(AV1_COMMON *cm, MACROBLOCKD *xd,
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];
......
......@@ -390,10 +390,14 @@ static int prob_diff_update_savings(const aom_tree_index *tree,
#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 @@ static void write_tx_size_vartx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
}
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 @@ static void write_tx_size_vartx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
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 @@ static void write_tx_size_vartx(const AV1_COMMON *cm, const MACROBLOCKD *xd,
}
}
#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 @@ static void update_txfm_partition_probs(AV1_COMMON *cm, aom_writer *w,
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 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
#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
......
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