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
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index aa48187..cfe4c4d 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -2446,37 +2446,6 @@
};
#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 @@
};
#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 @@
};
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 @@
#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 @@
};
#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 @@
}
#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) {
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index 51f6cfd..27ecc2d 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -94,8 +94,6 @@
#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
@@ -567,8 +565,6 @@
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)];
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
@@ -597,8 +593,6 @@
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];
diff --git a/av1/common/filter.h b/av1/common/filter.h
index d791af1..e2b1663 100644
--- a/av1/common/filter.h
+++ b/av1/common/filter.h
@@ -30,10 +30,10 @@
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,
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index e896796..5e07df3 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -1732,9 +1732,8 @@
(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 @@
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
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c
index 6ee00f3..b4a83c9 100644
--- a/av1/decoder/decoder.c
+++ b/av1/decoder/decoder.c
@@ -52,8 +52,6 @@
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],
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 1fe6cbf..a317d2d 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -148,12 +148,6 @@
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 @@
(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 @@
#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];
}
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 5b725a2..9cec775 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -479,8 +479,7 @@
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);
}
}
}
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index edc185d..6489b8f 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -155,8 +155,7 @@
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],
diff --git a/tools/aom_entropy_optimizer.c b/tools/aom_entropy_optimizer.c
index 7684c9b..b02930e 100644
--- a/tools/aom_entropy_optimizer.c
+++ b/tools/aom_entropy_optimizer.c
@@ -395,12 +395,6 @@
/* 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]"