Commit ec92c113 authored by Thomas Davies's avatar Thomas Davies

Remove unused switchable filter probs and remove remapping.

CDFs are used for coding and costs, so there is no need to
base the CDF on the obsolete tree and remap filter indices.

No change to common test conditions BDR.

Change-Id: I441dd21b127bc07ba33eef8ddcfd147eef21d0d4
parent 4ce85214
......@@ -2446,37 +2446,6 @@ static const aom_cdf_prob default_skip_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)] = {
};
#endif
#if CONFIG_DUAL_FILTER
#if USE_EXTRA_FILTER
static const aom_prob default_switchable_interp_prob
[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = {
{ 235, 192, 128 }, { 36, 243, 48 }, { 34, 16, 128 },
{ 34, 16, 128 }, { 149, 160, 128 }, { 235, 192, 128 },
{ 36, 243, 48 }, { 34, 16, 128 }, { 34, 16, 128 },
{ 149, 160, 128 }, { 235, 192, 128 }, { 36, 243, 48 },
{ 34, 16, 128 }, { 34, 16, 128 }, { 149, 160, 128 },
{ 235, 192, 128 }, { 36, 243, 48 }, { 34, 16, 128 },
{ 34, 16, 128 }, { 149, 160, 128 },
};
#else // USE_EXTRA_FILTER
static const aom_prob default_switchable_interp_prob
[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = {
{ 252, 199 }, { 22, 255 }, { 4, 2 }, { 238, 146 },
{ 253, 66 }, { 24, 255 }, { 2, 1 }, { 198, 41 },
{ 250, 177 }, { 16, 255 }, { 3, 4 }, { 226, 162 },
{ 247, 38 }, { 33, 253 }, { 1, 1 }, { 136, 14 },
};
#endif // USE_EXTRA_FILTER
#else // CONFIG_DUAL_FILTER
static const aom_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1] = {
{ 235, 162 },
{ 36, 255 },
{ 34, 3 },
{ 149, 144 },
};
#endif // CONFIG_DUAL_FILTER
#if CONFIG_EXT_TX
/* clang-format off */
const aom_tree_index av1_ext_tx_tree[EXT_TX_SET_TYPES][TREE_SIZE(TX_TYPES)] = {
......@@ -2611,32 +2580,31 @@ static const aom_cdf_prob
};
#endif
// clang-format on
#if CONFIG_DUAL_FILTER
#if USE_EXTRA_FILTER
static const aom_cdf_prob
default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS][CDF_SIZE(
SWITCHABLE_FILTERS)] = {
{ AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(32096), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(31338), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(32096), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(31338), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(32096), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(31338), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(32096), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(31338), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(6128), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(27632), AOM_ICDF(32768), 0 }
{ AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(31760), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(11050), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(28488), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(31760), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(11050), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(28488), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(31760), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(11050), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(28488), AOM_ICDF(32768), 0 },
{ AOM_ICDF(30080), AOM_ICDF(31088), AOM_ICDF(31760), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4608), AOM_ICDF(9620), AOM_ICDF(11050), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 },
{ AOM_ICDF(4352), AOM_ICDF(5240), AOM_ICDF(31880), AOM_ICDF(32768), 0 },
{ AOM_ICDF(19072), AOM_ICDF(23352), AOM_ICDF(28488), AOM_ICDF(32768), 0 },
};
#else // USE_EXTRA_FILTER
static const aom_cdf_prob
......@@ -4705,7 +4673,6 @@ const aom_cdf_prob
};
static void init_mode_probs(FRAME_CONTEXT *fc) {
av1_copy(fc->switchable_interp_prob, default_switchable_interp_prob);
av1_copy(fc->partition_prob, default_partition_probs);
av1_copy(fc->intra_inter_prob, default_intra_inter_p);
av1_copy(fc->comp_inter_prob, default_comp_inter_p);
......@@ -4877,9 +4844,6 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#endif
}
int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
#if CONFIG_EXT_PARTITION_TYPES
int av1_num_partition_types[PARTITION_BLOCK_SIZES] = {
PARTITION_TYPES, // 8x8: The 4 traditional partitions
......@@ -4892,17 +4856,6 @@ int av1_num_partition_types[PARTITION_BLOCK_SIZES] = {
};
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
{
-EIGHTTAP_REGULAR, 2, 4, -MULTITAP_SHARP, -EIGHTTAP_SMOOTH,
-EIGHTTAP_SMOOTH2,
};
#else
const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] =
{ -EIGHTTAP_REGULAR, 2, -EIGHTTAP_SMOOTH, -MULTITAP_SHARP };
#endif // CONFIG_DUAL_FILTER
void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
int i, j;
FRAME_CONTEXT *fc = cm->fc;
......@@ -5044,13 +4997,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
}
#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
if (cm->interp_filter == SWITCHABLE) {
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
aom_tree_merge_probs(
av1_switchable_interp_tree, pre_fc->switchable_interp_prob[i],
counts->switchable_interp[i], fc->switchable_interp_prob[i]);
}
}
void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
......
......@@ -94,8 +94,6 @@ typedef struct frame_contexts {
#endif
coeff_cdf_model coef_tail_cdfs[TX_SIZES][PLANE_TYPES];
coeff_cdf_model coef_head_cdfs[TX_SIZES][PLANE_TYPES];
aom_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1];
#if CONFIG_ADAPT_SCAN
// TODO(angiebird): try aom_prob
#if CONFIG_CHROMA_2X2
......@@ -566,8 +564,6 @@ extern const aom_tree_index av1_partition_tree[TREE_SIZE(PARTITION_TYPES)];
extern const aom_tree_index
av1_ext_partition_tree[TREE_SIZE(EXT_PARTITION_TYPES)];
#endif
extern const aom_tree_index
av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)];
extern const aom_tree_index
av1_palette_color_index_tree[PALETTE_SIZES][TREE_SIZE(PALETTE_COLORS)];
extern const aom_tree_index av1_tx_size_tree[MAX_TX_DEPTH][TREE_SIZE(TX_SIZES)];
......@@ -597,8 +593,6 @@ extern const aom_tree_index av1_ncobmc_tree[TREE_SIZE(OBMC_FAMILY_MODES)];
extern const aom_tree_index
av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)];
#endif // CONFIG_LOOP_RESTORATION
extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
#if CONFIG_EXT_PARTITION_TYPES
extern int av1_num_partition_types[PARTITION_BLOCK_SIZES];
......
......@@ -30,10 +30,10 @@ extern "C" {
typedef enum {
EIGHTTAP_REGULAR,
EIGHTTAP_SMOOTH,
MULTITAP_SHARP,
#if USE_EXTRA_FILTER
EIGHTTAP_SMOOTH2,
#endif // USE_EXTRA_FILTER
MULTITAP_SHARP,
BILINEAR,
#if USE_EXTRA_FILTER
EIGHTTAP_SHARP,
......
......@@ -1732,9 +1732,8 @@ static INLINE void read_mb_interp_filter(AV1_COMMON *const cm,
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd->mi[0], xd, dir + 2))) {
mbmi->interp_filter[dir] =
(InterpFilter)av1_switchable_interp_inv[aom_read_symbol(
r, ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS,
ACCT_STR)];
(InterpFilter)aom_read_symbol(r, ec_ctx->switchable_interp_cdf[ctx],
SWITCHABLE_FILTERS, ACCT_STR);
if (counts) ++counts->switchable_interp[ctx][mbmi->interp_filter[dir]];
}
}
......@@ -1749,10 +1748,8 @@ static INLINE void read_mb_interp_filter(AV1_COMMON *const cm,
mbmi->interp_filter = cm->interp_filter;
} else {
const int ctx = av1_get_pred_context_switchable_interp(xd);
mbmi->interp_filter =
(InterpFilter)av1_switchable_interp_inv[aom_read_symbol(
r, ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS,
ACCT_STR)];
mbmi->interp_filter = (InterpFilter)aom_read_symbol(
r, ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS, ACCT_STR);
if (counts) ++counts->switchable_interp[ctx][mbmi->interp_filter];
}
#endif // CONFIG_DUAL_FILTER
......
......@@ -52,8 +52,6 @@ static void initialize_dec(void) {
av1_init_wedge_masks();
#endif // CONFIG_EXT_INTER
init_done = 1;
av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv,
av1_switchable_interp_tree);
#if CONFIG_EXT_TX
for (int s = 1; s < EXT_TX_SET_TYPES; ++s) {
av1_indices_from_tree(av1_ext_tx_ind[s], av1_ext_tx_inv[s],
......
......@@ -148,12 +148,6 @@ void av1_encode_token_init(void) {
av1_tokens_from_tree(switchable_restore_encodings,
av1_switchable_restore_tree);
#endif // CONFIG_LOOP_RESTORATION
/* This hack is necessary when CONFIG_DUAL_FILTER is enabled because the five
SWITCHABLE_FILTERS are not consecutive, e.g., 0, 1, 2, 3, 4, when doing
an in-order traversal of the av1_switchable_interp_tree structure. */
av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv,
av1_switchable_interp_tree);
}
static void write_intra_mode_kf(const AV1_COMMON *cm, FRAME_CONTEXT *frame_ctx,
......@@ -1329,7 +1323,7 @@ static void write_mb_interp_filter(AV1_COMP *cpi, const MACROBLOCKD *xd,
(mbmi->ref_frame[1] > INTRA_FRAME &&
has_subpel_mv_component(xd->mi[0], xd, dir + 2))) {
const int ctx = av1_get_pred_context_switchable_interp(xd, dir);
aom_write_symbol(w, av1_switchable_interp_ind[mbmi->interp_filter[dir]],
aom_write_symbol(w, mbmi->interp_filter[dir],
ec_ctx->switchable_interp_cdf[ctx],
SWITCHABLE_FILTERS);
++cpi->interp_filter_selected[0][mbmi->interp_filter[dir]];
......@@ -1340,7 +1334,7 @@ static void write_mb_interp_filter(AV1_COMP *cpi, const MACROBLOCKD *xd,
#else
{
const int ctx = av1_get_pred_context_switchable_interp(xd);
aom_write_symbol(w, av1_switchable_interp_ind[mbmi->interp_filter],
aom_write_symbol(w, mbmi->interp_filter,
ec_ctx->switchable_interp_cdf[ctx], SWITCHABLE_FILTERS);
++cpi->interp_filter_selected[0][mbmi->interp_filter];
}
......
......@@ -479,8 +479,7 @@ static void update_filter_type_count(FRAME_COUNTS *counts,
const int ctx = av1_get_pred_context_switchable_interp(xd, dir);
++counts->switchable_interp[ctx][mbmi->interp_filter[dir]];
update_cdf(xd->tile_ctx->switchable_interp_cdf[ctx],
av1_switchable_interp_ind[mbmi->interp_filter[dir]],
SWITCHABLE_FILTERS);
mbmi->interp_filter[dir], SWITCHABLE_FILTERS);
}
}
}
......
......@@ -155,8 +155,7 @@ void av1_fill_mode_rates(AV1_COMMON *const cm, MACROBLOCK *x,
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; ++i)
av1_cost_tokens_from_cdf(x->switchable_interp_costs[i],
fc->switchable_interp_cdf[i],
av1_switchable_interp_inv);
fc->switchable_interp_cdf[i], NULL);
for (i = 0; i < PALETTE_BLOCK_SIZES; ++i) {
av1_cost_tokens_from_cdf(x->palette_y_size_cost[i],
......
......@@ -395,12 +395,6 @@ int main(int argc, const char **argv) {
/* Interpolation filter */
cts_each_dim[0] = SWITCHABLE_FILTER_CONTEXTS;
cts_each_dim[1] = SWITCHABLE_FILTERS;
optimize_entropy_table(
&fc.switchable_interp[0][0], probsfile, 2, cts_each_dim,
av1_switchable_interp_tree, 0,
"static const aom_prob \n"
"default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]"
"[SWITCHABLE_FILTERS - 1]");
optimize_cdf_table(&fc.switchable_interp[0][0], probsfile, 2, cts_each_dim,
"static const aom_cdf_prob\n"
"default_switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS]"
......
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