Commit b1bedf5f authored by Thomas Davies's avatar Thomas Davies

Align EXT_TX with EC_MULTISYMBOL and EC_ADAPT.

Do multisymbol coding for transform type.
Load default cdf probabilities directly.
Use CDF frame update mechanism when EC_ADAPT is
enabled.

Change-Id: Id23c927e81587b560e9df8b9bc56c0e2e3bb6f03
parent 7d532719
......@@ -728,6 +728,9 @@ static const int ext_tx_used_intra[EXT_TX_SETS_INTRA][TX_TYPES] = {
{ 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },
};
// Numbers of transform types used in each intra set
static const int ext_tx_cnt_intra[EXT_TX_SETS_INTRA] = { 1, 7, 5 };
// Transform types used in each inter set
static const int ext_tx_used_inter[EXT_TX_SETS_INTER][TX_TYPES] = {
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
......@@ -736,6 +739,9 @@ static const int ext_tx_used_inter[EXT_TX_SETS_INTER][TX_TYPES] = {
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },
};
// Numbers of transform types used in each inter set
static const int ext_tx_cnt_inter[EXT_TX_SETS_INTER] = { 1, 16, 12, 2 };
// 1D Transforms used in inter set, this needs to be changed if
// ext_tx_used_inter is changed
static const int ext_tx_used_inter_1D[EXT_TX_SETS_INTER][TX_TYPES_1D] = {
......
......@@ -5681,16 +5681,12 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
#if CONFIG_VAR_TX
// FIXME: txfm_partition probs
#endif
// FIXME: skip probs
#if CONFIG_EXT_TX
// FIXME: ext_tx CDFs
#else
// FIXME: skip probs
AVERAGE_TILE_CDFS(intra_ext_tx_cdf)
AVERAGE_TILE_CDFS(inter_ext_tx_cdf);
#endif // CONFIG_EXT_TX
AVERAGE_TILE_CDFS(seg.tree_cdf)
AVERAGE_TILE_CDFS(uv_mode_cdf)
......
This diff is collapsed.
......@@ -261,10 +261,15 @@ typedef struct frame_contexts {
#if CONFIG_DELTA_Q
aom_cdf_prob delta_q_cdf[CDF_SIZE(DELTA_Q_PROBS + 1)];
#endif // CONFIG_DELTA_Q
#if !CONFIG_EXT_TX
#if CONFIG_EXT_TX
aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
[CDF_SIZE(TX_TYPES)];
aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SETS_INTER][EXT_TX_SIZES]
[CDF_SIZE(TX_TYPES)];
#else
aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][CDF_SIZE(TX_TYPES)];
aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SIZES][CDF_SIZE(TX_TYPES)];
#endif // !CONFIG_EXT_TX
#endif // CONFIG_EXT_TX
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
aom_cdf_prob intra_filter_cdf[INTRA_FILTERS + 1][CDF_SIZE(INTRA_FILTERS)];
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
......@@ -432,7 +437,14 @@ extern int av1_intra_mode_ind[INTRA_MODES];
extern int av1_intra_mode_inv[INTRA_MODES];
extern int av1_inter_mode_ind[INTER_MODES];
extern int av1_inter_mode_inv[INTER_MODES];
#if CONFIG_EXT_TX
extern int av1_ext_tx_intra_ind[EXT_TX_SETS_INTRA][TX_TYPES];
extern int av1_ext_tx_intra_inv[EXT_TX_SETS_INTRA][TX_TYPES];
extern int av1_ext_tx_inter_ind[EXT_TX_SETS_INTER][TX_TYPES];
extern int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES];
#endif
#endif
#if CONFIG_EXT_INTER
extern const aom_tree_index
av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)];
......
......@@ -787,18 +787,30 @@ static void read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (inter_block) {
if (eset > 0) {
#if CONFIG_EC_MULTISYMBOL
mbmi->tx_type = av1_ext_tx_inter_inv[eset][aom_read_symbol(
r, ec_ctx->inter_ext_tx_cdf[eset][square_tx_size],
ext_tx_cnt_inter[eset], ACCT_STR)];
#else
mbmi->tx_type = aom_read_tree(
r, av1_ext_tx_inter_tree[eset],
ec_ctx->inter_ext_tx_prob[eset][square_tx_size], ACCT_STR);
#endif
if (counts)
++counts->inter_ext_tx[eset][square_tx_size][mbmi->tx_type];
}
} else if (ALLOW_INTRA_EXT_TX) {
if (eset > 0) {
#if CONFIG_EC_MULTISYMBOL
mbmi->tx_type = av1_ext_tx_intra_inv[eset][aom_read_symbol(
r, ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode],
ext_tx_cnt_intra[eset], ACCT_STR)];
#else
mbmi->tx_type = aom_read_tree(
r, av1_ext_tx_intra_tree[eset],
ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode],
ACCT_STR);
#endif
if (counts)
++counts->intra_ext_tx[eset][square_tx_size][mbmi->mode]
[mbmi->tx_type];
......
......@@ -55,7 +55,15 @@ static void initialize_dec(void) {
av1_intra_mode_tree);
av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv,
SWITCHABLE_FILTERS, av1_switchable_interp_tree);
#if !CONFIG_EXT_TX
#if CONFIG_EXT_TX
int s;
for (s = 1; s < EXT_TX_SETS_INTRA; ++s)
av1_indices_from_tree(av1_ext_tx_intra_ind[s], av1_ext_tx_intra_inv[s],
ext_tx_cnt_intra[s], av1_ext_tx_intra_tree[s]);
for (s = 1; s < EXT_TX_SETS_INTER; ++s)
av1_indices_from_tree(av1_ext_tx_inter_ind[s], av1_ext_tx_inter_inv[s],
ext_tx_cnt_inter[s], av1_ext_tx_inter_tree[s]);
#else
av1_indices_from_tree(av1_ext_tx_ind, av1_ext_tx_inv, TX_TYPES,
av1_ext_tx_tree);
#endif
......
......@@ -196,7 +196,14 @@ void av1_encode_token_init(void) {
/* This hack is necessary because the four TX_TYPES are not consecutive,
e.g., 0, 1, 2, 3, when doing an in-order traversal of the av1_ext_tx_tree
structure. */
#if !CONFIG_EXT_TX
#if CONFIG_EXT_TX
for (s = 1; s < EXT_TX_SETS_INTRA; ++s)
av1_indices_from_tree(av1_ext_tx_intra_ind[s], av1_ext_tx_intra_inv[s],
ext_tx_cnt_intra[s], av1_ext_tx_intra_tree[s]);
for (s = 1; s < EXT_TX_SETS_INTER; ++s)
av1_indices_from_tree(av1_ext_tx_inter_ind[s], av1_ext_tx_inter_inv[s],
ext_tx_cnt_inter[s], av1_ext_tx_inter_tree[s]);
#else
av1_indices_from_tree(av1_ext_tx_ind, av1_ext_tx_inv, TX_TYPES,
av1_ext_tx_tree);
#endif
......@@ -1441,17 +1448,30 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
if (is_inter) {
assert(ext_tx_used_inter[eset][mbmi->tx_type]);
if (eset > 0) {
#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_ext_tx_inter_ind[eset][mbmi->tx_type],
ec_ctx->inter_ext_tx_cdf[eset][square_tx_size],
ext_tx_cnt_inter[eset]);
#else
av1_write_token(w, av1_ext_tx_inter_tree[eset],
ec_ctx->inter_ext_tx_prob[eset][square_tx_size],
&ext_tx_inter_encodings[eset][mbmi->tx_type]);
#endif
}
} else if (ALLOW_INTRA_EXT_TX) {
assert(ext_tx_used_intra[eset][mbmi->tx_type]);
if (eset > 0) {
#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(
w, av1_ext_tx_intra_ind[eset][mbmi->tx_type],
ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode],
ext_tx_cnt_intra[eset]);
#else
av1_write_token(
w, av1_ext_tx_intra_tree[eset],
ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode],
&ext_tx_intra_encodings[eset][mbmi->tx_type]);
#endif
}
}
}
......@@ -2684,9 +2704,15 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
const int eset =
get_ext_tx_set(supertx_size, bsize, 1, cm->reduced_tx_set_used);
if (eset > 0) {
#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_ext_tx_inter_ind[eset][mbmi->tx_type],
ec_ctx->inter_ext_tx_cdf[eset][supertx_size],
ext_tx_cnt_inter[eset]);
#else
av1_write_token(w, av1_ext_tx_inter_tree[eset],
cm->fc->inter_ext_tx_prob[eset][supertx_size],
&ext_tx_inter_encodings[eset][mbmi->tx_type]);
#endif
}
}
#else
......
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