Remove unused binary-symbol coding and tree-based coding
Change-Id: I70ebb6ada7ec4a975a8984a2e1ea2fa51664a786
diff --git a/av1/av1.cmake b/av1/av1.cmake
index 2a7a1b9..9b651a3 100644
--- a/av1/av1.cmake
+++ b/av1/av1.cmake
@@ -165,9 +165,7 @@
"${AOM_ROOT}/av1/encoder/temporal_filter.c"
"${AOM_ROOT}/av1/encoder/temporal_filter.h"
"${AOM_ROOT}/av1/encoder/tokenize.c"
- "${AOM_ROOT}/av1/encoder/tokenize.h"
- "${AOM_ROOT}/av1/encoder/treewriter.c"
- "${AOM_ROOT}/av1/encoder/treewriter.h")
+ "${AOM_ROOT}/av1/encoder/tokenize.h")
if (CONFIG_DAALA_TX)
set(AOM_AV1_ENCODER_SOURCES
diff --git a/av1/av1_cx.mk b/av1/av1_cx.mk
index 0bfeea5..57c4576 100644
--- a/av1/av1_cx.mk
+++ b/av1/av1_cx.mk
@@ -77,7 +77,6 @@
AV1_CX_SRCS-yes += encoder/rd.h
AV1_CX_SRCS-yes += encoder/rdopt.h
AV1_CX_SRCS-yes += encoder/tokenize.h
-AV1_CX_SRCS-yes += encoder/treewriter.h
AV1_CX_SRCS-yes += encoder/mcomp.c
AV1_CX_SRCS-yes += encoder/encoder.c
AV1_CX_SRCS-yes += encoder/k_means_template.h
@@ -102,7 +101,6 @@
AV1_CX_SRCS-$(CONFIG_INTERNAL_STATS) += encoder/blockiness.c
AV1_CX_SRCS-yes += encoder/tokenize.c
-AV1_CX_SRCS-yes += encoder/treewriter.c
AV1_CX_SRCS-yes += encoder/aq_variance.c
AV1_CX_SRCS-yes += encoder/aq_variance.h
AV1_CX_SRCS-yes += encoder/aq_cyclicrefresh.c
diff --git a/av1/common/entropy.c b/av1/common/entropy.c
index 962982b..516e756 100644
--- a/av1/common/entropy.c
+++ b/av1/common/entropy.c
@@ -24,20 +24,6 @@
#include "av1/common/txb_common.h"
#endif
-// Unconstrained Node Tree
-/* clang-format off */
-const aom_tree_index av1_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)] = {
- 2, 6, // 0 = LOW_VAL
- -TWO_TOKEN, 4, // 1 = TWO
- -THREE_TOKEN, -FOUR_TOKEN, // 2 = THREE
- 8, 10, // 3 = HIGH_LOW
- -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, // 4 = CAT_ONE
- 12, 14, // 5 = CAT_THREEFOUR
- -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, // 6 = CAT_THREE
- -CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 7 = CAT_FIVE
-};
-/* clang-format on */
-
/* Extra bits coded from LSB to MSB */
const aom_cdf_prob av1_cat1_cdf0[CDF_SIZE(2)] = { AOM_CDF2(20352) };
const aom_cdf_prob *av1_cat1_cdf[] = { av1_cat1_cdf0 };
diff --git a/av1/common/entropy.h b/av1/common/entropy.h
index c6d6482..b0227df 100644
--- a/av1/common/entropy.h
+++ b/av1/common/entropy.h
@@ -242,7 +242,6 @@
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
#define TAIL_NODES (MODEL_NODES + 1)
-extern const aom_tree_index av1_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)];
extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index e3a6226..f197314 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -804,71 +804,6 @@
#endif // CONFIG_EXT_PARTITION
};
-const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
- -SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -WARPED_CAUSAL,
-};
-
-#if !CONFIG_EXT_WARPED_MOTION
-static const aom_prob
- default_motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1] = {
- { 128, 128 }, { 128, 128 }, { 128, 128 }, { 62, 115 }, { 39, 131 },
- { 39, 132 }, { 118, 94 }, { 77, 125 }, { 100, 121 }, { 190, 66 },
- { 207, 102 }, { 197, 100 }, { 239, 76 },
-#if CONFIG_EXT_PARTITION
- { 252, 200 }, { 252, 200 }, { 252, 200 },
-#endif // CONFIG_EXT_PARTITION
- { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 },
- { 208, 200 },
-#if CONFIG_EXT_PARTITION
- { 252, 200 }, { 252, 200 }
-#endif // CONFIG_EXT_PARTITION
- };
-#else
-static const aom_prob
- default_motion_mode_prob[MOTION_MODE_CTX][BLOCK_SIZES_ALL][MOTION_MODES -
- 1] = {
- {
- { 128, 128 }, { 128, 128 }, { 128, 128 }, { 62, 115 }, { 39, 131 },
- { 39, 132 }, { 118, 94 }, { 77, 125 }, { 100, 121 }, { 190, 66 },
- { 207, 102 }, { 197, 100 }, { 239, 76 },
-#if CONFIG_EXT_PARTITION
- { 252, 200 }, { 252, 200 }, { 252, 200 },
-#endif // CONFIG_EXT_PARTITION
- { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 },
- { 208, 200 },
-#if CONFIG_EXT_PARTITION
- { 252, 200 }, { 252, 200 },
-#endif // CONFIG_EXT_PARTITION
- },
- {
- { 128, 128 }, { 128, 128 }, { 128, 128 }, { 62, 115 }, { 39, 131 },
- { 39, 132 }, { 118, 94 }, { 77, 125 }, { 100, 121 }, { 190, 66 },
- { 207, 102 }, { 197, 100 }, { 239, 76 },
-#if CONFIG_EXT_PARTITION
- { 252, 200 }, { 252, 200 }, { 252, 200 },
-#endif // CONFIG_EXT_PARTITION
- { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 },
- { 208, 200 },
-#if CONFIG_EXT_PARTITION
- { 252, 200 }, { 252, 200 },
-#endif // CONFIG_EXT_PARTITION
- },
- {
- { 128, 128 }, { 128, 128 }, { 128, 128 }, { 62, 115 }, { 39, 131 },
- { 39, 132 }, { 118, 94 }, { 77, 125 }, { 100, 121 }, { 190, 66 },
- { 207, 102 }, { 197, 100 }, { 239, 76 },
-#if CONFIG_EXT_PARTITION
- { 252, 200 }, { 252, 200 }, { 252, 200 },
-#endif // CONFIG_EXT_PARTITION
- { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 }, { 208, 200 },
- { 208, 200 },
-#if CONFIG_EXT_PARTITION
- { 252, 200 }, { 252, 200 },
-#endif // CONFIG_EXT_PARTITION
- },
- };
-#endif // CONFIG_EXT_WARPED_MOTION
-
#if !CONFIG_EXT_WARPED_MOTION
static const aom_cdf_prob
default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = {
@@ -986,36 +921,6 @@
};
#endif
-/* clang-format off */
-const aom_tree_index av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)] = {
- -II_DC_PRED, 2, /* 0 = II_DC_NODE */
- -II_SMOOTH_PRED, 4, /* 1 = II_SMOOTH_PRED */
- -II_V_PRED, -II_H_PRED /* 2 = II_V_NODE */
-};
-
-const aom_tree_index av1_inter_compound_mode_tree
- [TREE_SIZE(INTER_COMPOUND_MODES)] = {
- -INTER_COMPOUND_OFFSET(GLOBAL_GLOBALMV), 2,
- -INTER_COMPOUND_OFFSET(NEAREST_NEARESTMV), 4,
- 6, -INTER_COMPOUND_OFFSET(NEW_NEWMV),
- -INTER_COMPOUND_OFFSET(NEAR_NEARMV), 8,
- 10, 12,
- -INTER_COMPOUND_OFFSET(NEAREST_NEWMV), -INTER_COMPOUND_OFFSET(NEW_NEARESTMV),
- -INTER_COMPOUND_OFFSET(NEAR_NEWMV), -INTER_COMPOUND_OFFSET(NEW_NEARMV)
-};
-
-
-#if CONFIG_JNT_COMP
-const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES - 1)] = {
- -COMPOUND_WEDGE, -COMPOUND_SEG
-};
-#else
-const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = {
- -COMPOUND_AVERAGE, 2, -COMPOUND_WEDGE, -COMPOUND_SEG
-};
-#endif // CONFIG_JNT_COMP
-/* clang-format on */
-
static const aom_cdf_prob default_intra_inter_cdf[INTRA_INTER_CONTEXTS]
[CDF_SIZE(2)] = {
{ AOM_CDF2(768) },
@@ -1470,13 +1375,6 @@
{ AOM_ICDF(13107), AOM_ICDF(32768), 0 },
{ AOM_ICDF(13107), AOM_ICDF(32768), 0 },
};
-static const aom_prob default_compound_idx_probs[COMP_INDEX_CONTEXTS] = {
- 192, 128, 64, 192, 128, 64
-};
-
-static const aom_prob default_comp_group_idx_probs[COMP_GROUP_IDX_CONTEXTS] = {
- 192, 128, 64, 192, 128, 64, 128
-};
#endif // CONFIG_JNT_COMP
#if CONFIG_FILTER_INTRA
@@ -2986,14 +2884,11 @@
#if CONFIG_JNT_COMP
av1_copy(fc->compound_index_cdf, default_compound_idx_cdfs);
av1_copy(fc->comp_group_idx_cdf, default_comp_group_idx_cdfs);
- av1_copy(fc->compound_index_probs, default_compound_idx_probs);
- av1_copy(fc->comp_group_idx_probs, default_comp_group_idx_probs);
#endif // CONFIG_JNT_COMP
av1_copy(fc->newmv_cdf, default_newmv_cdf);
av1_copy(fc->zeromv_cdf, default_zeromv_cdf);
av1_copy(fc->refmv_cdf, default_refmv_cdf);
av1_copy(fc->drl_cdf, default_drl_cdf);
- av1_copy(fc->motion_mode_prob, default_motion_mode_prob);
av1_copy(fc->motion_mode_cdf, default_motion_mode_cdf);
av1_copy(fc->obmc_cdf, default_obmc_cdf);
av1_copy(fc->inter_compound_mode_cdf, default_inter_compound_mode_cdf);
@@ -3080,28 +2975,6 @@
for (j = 0; j < (SINGLE_REFS - 1); j++)
fc->single_ref_prob[i][j] = av1_mode_mv_merge_probs(
pre_fc->single_ref_prob[i][j], counts->single_ref[i][j]);
-
-#if !CONFIG_EXT_WARPED_MOTION
- for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; ++i)
- aom_tree_merge_probs(av1_motion_mode_tree, pre_fc->motion_mode_prob[i],
- counts->motion_mode[i], fc->motion_mode_prob[i]);
-#else
- for (i = 0; i < MOTION_MODE_CTX; ++i) {
- for (j = BLOCK_8X8; j < BLOCK_SIZES_ALL; ++j)
- aom_tree_merge_probs(av1_motion_mode_tree, pre_fc->motion_mode_prob[i][j],
- counts->motion_mode[i][j],
- fc->motion_mode_prob[i][j]);
- }
-#endif // CONFIG_EXT_WARPED_MOTION
-
-#if CONFIG_JNT_COMP
- for (i = 0; i < COMP_INDEX_CONTEXTS; ++i)
- fc->compound_index_probs[i] = av1_mode_mv_merge_probs(
- pre_fc->compound_index_probs[i], counts->compound_index[i]);
- for (i = 0; i < COMP_GROUP_IDX_CONTEXTS; ++i)
- fc->comp_group_idx_probs[i] = av1_mode_mv_merge_probs(
- pre_fc->comp_group_idx_probs[i], counts->comp_group_idx[i]);
-#endif // CONFIG_JNT_COMP
}
void av1_adapt_intra_frame_probs(AV1_COMMON *cm) {
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index e9b2cb8..5024034 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -136,10 +136,8 @@
aom_cdf_prob inter_compound_mode_cdf[INTER_MODE_CONTEXTS]
[CDF_SIZE(INTER_COMPOUND_MODES)];
#if CONFIG_JNT_COMP
- aom_prob compound_type_prob[BLOCK_SIZES_ALL][COMPOUND_TYPES - 2];
aom_cdf_prob compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES - 1)];
#else
- aom_prob compound_type_prob[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1];
aom_cdf_prob compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)];
#endif // CONFIG_JNT_COMP
aom_cdf_prob interintra_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(2)];
@@ -147,11 +145,9 @@
aom_cdf_prob interintra_mode_cdf[BLOCK_SIZE_GROUPS]
[CDF_SIZE(INTERINTRA_MODES)];
#if CONFIG_EXT_WARPED_MOTION
- aom_prob motion_mode_prob[MOTION_MODE_CTX][BLOCK_SIZES_ALL][MOTION_MODES - 1];
aom_cdf_prob motion_mode_cdf[MOTION_MODE_CTX][BLOCK_SIZES_ALL]
[CDF_SIZE(MOTION_MODES)];
#else
- aom_prob motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1];
aom_cdf_prob motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)];
#endif // CONFIG_EXT_WARPED_MOTION
aom_cdf_prob obmc_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)];
@@ -185,8 +181,6 @@
#if CONFIG_JNT_COMP
aom_cdf_prob compound_index_cdf[COMP_INDEX_CONTEXTS][CDF_SIZE(2)];
aom_cdf_prob comp_group_idx_cdf[COMP_GROUP_IDX_CONTEXTS][CDF_SIZE(2)];
- aom_prob compound_index_probs[COMP_INDEX_CONTEXTS];
- aom_prob comp_group_idx_probs[COMP_GROUP_IDX_CONTEXTS];
#endif // CONFIG_JNT_COMP
#if CONFIG_EXT_SKIP
aom_cdf_prob skip_mode_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)];
@@ -440,18 +434,6 @@
},
};
-extern const aom_tree_index
- av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)];
-extern const aom_tree_index
- av1_inter_compound_mode_tree[TREE_SIZE(INTER_COMPOUND_MODES)];
-#if CONFIG_JNT_COMP
-extern const aom_tree_index
- av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES - 1)];
-#else
-extern const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)];
-#endif // CONFIG_JNT_COMP
-extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)];
-
void av1_setup_frame_contexts(struct AV1Common *cm);
void av1_setup_past_independence(struct AV1Common *cm);
diff --git a/av1/common/entropymv.c b/av1/common/entropymv.c
index 7630191..18e0d76 100644
--- a/av1/common/entropymv.c
+++ b/av1/common/entropymv.c
@@ -12,32 +12,6 @@
#include "av1/common/onyxc_int.h"
#include "av1/common/entropymv.h"
-const aom_tree_index av1_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = {
- -MV_JOINT_ZERO, 2, -MV_JOINT_HNZVZ, 4, -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
-};
-
-/* clang-format off */
-const aom_tree_index av1_mv_class_tree[TREE_SIZE(MV_CLASSES)] = {
- -MV_CLASS_0, 2,
- -MV_CLASS_1, 4,
- 6, 8,
- -MV_CLASS_2, -MV_CLASS_3,
- 10, 12,
- -MV_CLASS_4, -MV_CLASS_5,
- -MV_CLASS_6, 14,
- 16, 18,
- -MV_CLASS_7, -MV_CLASS_8,
- -MV_CLASS_9, -MV_CLASS_10,
-};
-/* clang-format on */
-
-const aom_tree_index av1_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = {
- -0, -1,
-};
-
-const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1,
- 4, -2, -3 };
-
static const nmv_context default_nmv_context = {
{ AOM_CDF4(4096, 11264, 19328) }, // joints_cdf
{ {
diff --git a/av1/common/entropymv.h b/av1/common/entropymv.h
index 5029d3d..3ff2a5f 100644
--- a/av1/common/entropymv.h
+++ b/av1/common/entropymv.h
@@ -75,11 +75,6 @@
#define MV_UPP ((1 << MV_IN_USE_BITS) - 1)
#define MV_LOW (-(1 << MV_IN_USE_BITS))
-extern const aom_tree_index av1_mv_joint_tree[];
-extern const aom_tree_index av1_mv_class_tree[];
-extern const aom_tree_index av1_mv_class0_tree[];
-extern const aom_tree_index av1_mv_fp_tree[];
-
typedef struct {
aom_cdf_prob classes_cdf[CDF_SIZE(MV_CLASSES)];
aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)];
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 95aaf00..be2e88e 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -67,12 +67,6 @@
}
}
-static struct av1_token interintra_mode_encodings[INTERINTRA_MODES];
-#if CONFIG_JNT_COMP
-static struct av1_token compound_type_encodings[COMPOUND_TYPES - 1];
-#else
-static struct av1_token compound_type_encodings[COMPOUND_TYPES];
-#endif // CONFIG_JNT_COMP
#if CONFIG_LOOP_RESTORATION
static void loop_restoration_write_sb_coeffs(const AV1_COMMON *const cm,
MACROBLOCKD *xd,
@@ -99,10 +93,6 @@
int *const tile_size_bytes,
int *const tile_col_size_bytes);
#endif
-void av1_encode_token_init(void) {
- av1_tokens_from_tree(interintra_mode_encodings, av1_interintra_mode_tree);
- av1_tokens_from_tree(compound_type_encodings, av1_compound_type_tree);
-}
static void write_intra_mode_kf(FRAME_CONTEXT *frame_ctx, const MODE_INFO *mi,
const MODE_INFO *above_mi,
diff --git a/av1/encoder/bitstream.h b/av1/encoder/bitstream.h
index 97cfd14..533c149 100644
--- a/av1/encoder/bitstream.h
+++ b/av1/encoder/bitstream.h
@@ -31,8 +31,6 @@
void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dest, size_t *size);
-void av1_encode_token_init(void);
-
static INLINE int av1_preserve_existing_gf(AV1_COMP *cpi) {
// Do not swap gf and arf indices for internal overlay frames
return !cpi->multi_arf_allowed && cpi->rc.is_src_frame_alt_ref &&
diff --git a/av1/encoder/encodemv.c b/av1/encoder/encodemv.c
index 6699aea..f3f6c71 100644
--- a/av1/encoder/encodemv.c
+++ b/av1/encoder/encodemv.c
@@ -20,16 +20,6 @@
#include "aom_dsp/aom_dsp_common.h"
-static struct av1_token mv_joint_encodings[MV_JOINTS];
-static struct av1_token mv_class_encodings[MV_CLASSES];
-static struct av1_token mv_fp_encodings[MV_FP_SIZE];
-
-void av1_entropy_mv_init(void) {
- av1_tokens_from_tree(mv_joint_encodings, av1_mv_joint_tree);
- av1_tokens_from_tree(mv_class_encodings, av1_mv_class_tree);
- av1_tokens_from_tree(mv_fp_encodings, av1_mv_fp_tree);
-}
-
static void encode_mv_component(aom_writer *w, int comp, nmv_component *mvcomp,
MvSubpelPrecision precision) {
int offset;
diff --git a/av1/encoder/encodemv.h b/av1/encoder/encodemv.h
index 116b291..2fe1ea7 100644
--- a/av1/encoder/encodemv.h
+++ b/av1/encoder/encodemv.h
@@ -18,8 +18,6 @@
extern "C" {
#endif
-void av1_entropy_mv_init(void);
-
void av1_encode_mv(AV1_COMP *cpi, aom_writer *w, const MV *mv, const MV *ref,
nmv_context *mvctx, int usehp);
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 03d3701..d872635 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -451,8 +451,6 @@
#if !CONFIG_XIPHRC
av1_rc_init_minq_luts();
#endif
- av1_entropy_mv_init();
- av1_encode_token_init();
av1_init_wedge_masks();
init_done = 1;
}
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index 3809e58..bf99507 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -76,23 +76,6 @@
dct_cat_lt_10_value_cost +
(sizeof(dct_cat_lt_10_value_cost) / sizeof(*dct_cat_lt_10_value_cost)) / 2;
-// Array indices are identical to previously-existing CONTEXT_NODE indices
-/* clang-format off */
-const aom_tree_index av1_coef_tree[TREE_SIZE(ENTROPY_TOKENS)] = {
- -EOB_TOKEN, 2, // 0 = EOB
- -ZERO_TOKEN, 4, // 1 = ZERO
- -ONE_TOKEN, 6, // 2 = ONE
- 8, 12, // 3 = LOW_VAL
- -TWO_TOKEN, 10, // 4 = TWO
- -THREE_TOKEN, -FOUR_TOKEN, // 5 = THREE
- 14, 16, // 6 = HIGH_LOW
- -CATEGORY1_TOKEN, -CATEGORY2_TOKEN, // 7 = CAT_ONE
- 18, 20, // 8 = CAT_THREEFOUR
- -CATEGORY3_TOKEN, -CATEGORY4_TOKEN, // 9 = CAT_THREE
- -CATEGORY5_TOKEN, -CATEGORY6_TOKEN // 10 = CAT_FIVE
-};
-/* clang-format on */
-
static const int16_t zero_cost[] = { 0 };
static const int16_t sign_cost[1] = { 512 };
static const int16_t cat1_cost[1 << 1] = { 864, 1229 };
diff --git a/av1/encoder/tokenize.h b/av1/encoder/tokenize.h
index 8a5c97c..a3736fc 100644
--- a/av1/encoder/tokenize.h
+++ b/av1/encoder/tokenize.h
@@ -13,9 +13,8 @@
#define AV1_ENCODER_TOKENIZE_H_
#include "av1/common/entropy.h"
-
#include "av1/encoder/block.h"
-#include "av1/encoder/treewriter.h"
+#include "aom_dsp/bitwriter.h"
#ifdef __cplusplus
extern "C" {
@@ -46,9 +45,6 @@
uint8_t token;
} TOKENEXTRA;
-extern const aom_tree_index av1_coef_tree[];
-extern const aom_tree_index av1_coef_con_tree[];
-
int av1_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
struct AV1_COMP;
diff --git a/av1/encoder/treewriter.c b/av1/encoder/treewriter.c
deleted file mode 100644
index 50be724..0000000
--- a/av1/encoder/treewriter.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#include "av1/encoder/treewriter.h"
-
-static void tree2tok(struct av1_token *tokens, const aom_tree_index *tree,
- int i, int v, int l) {
- v += v;
- ++l;
-
- do {
- const aom_tree_index j = tree[i++];
- if (j <= 0) {
- tokens[-j].value = v;
- tokens[-j].len = l;
- } else {
- tree2tok(tokens, tree, j, v, l);
- }
- } while (++v & 1);
-}
-
-void av1_tokens_from_tree(struct av1_token *tokens,
- const aom_tree_index *tree) {
- tree2tok(tokens, tree, 0, 0, 0);
-}
-
-static unsigned int convert_distribution(unsigned int i, aom_tree tree,
- unsigned int branch_ct[][2],
- const unsigned int num_events[]) {
- unsigned int left, right;
-
- if (tree[i] <= 0)
- left = num_events[-tree[i]];
- else
- left = convert_distribution(tree[i], tree, branch_ct, num_events);
-
- if (tree[i + 1] <= 0)
- right = num_events[-tree[i + 1]];
- else
- right = convert_distribution(tree[i + 1], tree, branch_ct, num_events);
-
- branch_ct[i >> 1][0] = left;
- branch_ct[i >> 1][1] = right;
- return left + right;
-}
-
-void av1_tree_probs_from_distribution(aom_tree tree,
- unsigned int branch_ct[/* n-1 */][2],
- const unsigned int num_events[/* n */]) {
- convert_distribution(0, tree, branch_ct, num_events);
-}
diff --git a/av1/encoder/treewriter.h b/av1/encoder/treewriter.h
deleted file mode 100644
index 9a4cb86..0000000
--- a/av1/encoder/treewriter.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AV1_ENCODER_TREEWRITER_H_
-#define AV1_ENCODER_TREEWRITER_H_
-
-#include "aom_dsp/bitwriter.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void av1_tree_probs_from_distribution(aom_tree tree,
- unsigned int branch_ct[/* n - 1 */][2],
- const unsigned int num_events[/* n */]);
-
-struct av1_token {
- int value;
- int len;
-};
-
-void av1_tokens_from_tree(struct av1_token *, const aom_tree_index *);
-
-static INLINE void av1_write_token(aom_writer *w, const aom_tree_index *tree,
- const aom_prob *probs,
- const struct av1_token *token) {
- aom_write_tree(w, tree, probs, token->value, token->len, 0);
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // AV1_ENCODER_TREEWRITER_H_
diff --git a/tools/aom_entropy_optimizer.c b/tools/aom_entropy_optimizer.c
index 73a61ec..a0084fe 100644
--- a/tools/aom_entropy_optimizer.c
+++ b/tools/aom_entropy_optimizer.c
@@ -414,9 +414,6 @@
cts_each_dim[0] = DRL_MODE_CONTEXTS;
cts_each_dim[1] = 2;
- optimize_entropy_table(
- &fc.drl_mode[0][0], probsfile, 2, cts_each_dim, NULL, 1,
- "static const aom_prob default_drl_prob[DRL_MODE_CONTEXTS]");
optimize_cdf_table(&fc.drl_mode[0][0], probsfile, 2, cts_each_dim,
"static const aom_cdf_prob "
"default_drl_cdf[DRL_MODE_CONTEXTS][CDF_SIZE(2)]");
@@ -462,11 +459,6 @@
/* motion_var and warped_motion experiments */
cts_each_dim[0] = BLOCK_SIZES_ALL;
cts_each_dim[1] = MOTION_MODES;
- optimize_entropy_table(
- &fc.motion_mode[0][0], probsfile, 2, cts_each_dim, av1_motion_mode_tree,
- 0,
- "static const aom_prob default_motion_mode_prob[BLOCK_SIZES]"
- "[MOTION_MODES - 1]");
optimize_cdf_table(
&fc.motion_mode[0][0], probsfile, 2, cts_each_dim,
"static const aom_cdf_prob\n"
@@ -480,10 +472,6 @@
/* Intra/inter flag */
cts_each_dim[0] = INTRA_INTER_CONTEXTS;
cts_each_dim[1] = 2;
- optimize_entropy_table(&fc.intra_inter[0][0], probsfile, 2, cts_each_dim,
- NULL, 1,
- "static const aom_prob default_intra_inter_p"
- "[INTRA_INTER_CONTEXTS]");
optimize_cdf_table(
&fc.intra_inter[0][0], probsfile, 2, cts_each_dim,
"static const aom_cdf_prob\n"
@@ -492,10 +480,6 @@
/* Single/comp ref flag */
cts_each_dim[0] = COMP_INTER_CONTEXTS;
cts_each_dim[1] = 2;
- optimize_entropy_table(&fc.comp_inter[0][0], probsfile, 2, cts_each_dim, NULL,
- 1,
- "static const aom_prob default_comp_inter_p"
- "[COMP_INTER_CONTEXTS]");
optimize_cdf_table(
&fc.comp_inter[0][0], probsfile, 2, cts_each_dim,
"static const aom_cdf_prob\n"
@@ -505,9 +489,6 @@
#if CONFIG_EXT_COMP_REFS
cts_each_dim[0] = COMP_REF_TYPE_CONTEXTS;
cts_each_dim[1] = 2;
- optimize_entropy_table(
- &fc.comp_ref_type[0][0], probsfile, 2, cts_each_dim, NULL, 1,
- "static const aom_prob default_comp_ref_type_p[COMP_REF_TYPE_CONTEXTS]");
optimize_cdf_table(
&fc.comp_ref_type[0][0], probsfile, 2, cts_each_dim,
"static const aom_cdf_prob\n"
@@ -516,10 +497,6 @@
cts_each_dim[0] = UNI_COMP_REF_CONTEXTS;
cts_each_dim[1] = UNIDIR_COMP_REFS - 1;
cts_each_dim[2] = 2;
- optimize_entropy_table(
- &fc.uni_comp_ref[0][0][0], probsfile, 3, cts_each_dim, NULL, 1,
- "static const aom_prob\n"
- "default_uni_comp_ref_p[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1]");
optimize_cdf_table(&fc.uni_comp_ref[0][0][0], probsfile, 3, cts_each_dim,
"static const aom_cdf_prob\n"
"default_uni_comp_ref_cdf[UNI_COMP_REF_CONTEXTS][UNIDIR_"
@@ -530,10 +507,6 @@
cts_each_dim[0] = REF_CONTEXTS;
cts_each_dim[1] = SINGLE_REFS - 1;
cts_each_dim[2] = 2;
- optimize_entropy_table(
- &fc.single_ref[0][0][0], probsfile, 3, cts_each_dim, NULL, 1,
- "static const aom_prob default_single_ref_p[REF_CONTEXTS]"
- "[SINGLE_REFS - 1]");
optimize_cdf_table(
&fc.single_ref[0][0][0], probsfile, 3, cts_each_dim,
"static const aom_cdf_prob\n"
@@ -543,9 +516,6 @@
cts_each_dim[0] = REF_CONTEXTS;
cts_each_dim[1] = FWD_REFS - 1;
cts_each_dim[2] = 2;
- optimize_entropy_table(
- &fc.comp_ref[0][0][0], probsfile, 3, cts_each_dim, NULL, 1,
- "static const aom_prob default_comp_ref_p[REF_CONTEXTS][FWD_REFS - 1]");
optimize_cdf_table(
&fc.comp_ref[0][0][0], probsfile, 3, cts_each_dim,
"static const aom_cdf_prob\n"
@@ -554,10 +524,6 @@
cts_each_dim[0] = REF_CONTEXTS;
cts_each_dim[1] = BWD_REFS - 1;
cts_each_dim[2] = 2;
- optimize_entropy_table(&fc.comp_bwdref[0][0][0], probsfile, 3, cts_each_dim,
- NULL, 1,
- "static const aom_prob "
- "default_comp_bwdref_p[REF_CONTEXTS][BWD_REFS - 1]");
optimize_cdf_table(
&fc.comp_bwdref[0][0][0], probsfile, 3, cts_each_dim,
"static const aom_cdf_prob\n"
@@ -574,9 +540,6 @@
/* Skip flag */
cts_each_dim[0] = SKIP_CONTEXTS;
cts_each_dim[1] = 2;
- optimize_entropy_table(
- &fc.skip[0][0], probsfile, 2, cts_each_dim, NULL, 1,
- "static const aom_prob default_skip_probs[SKIP_CONTEXTS]");
optimize_cdf_table(&fc.skip[0][0], probsfile, 2, cts_each_dim,
"static const aom_cdf_prob "
"default_skip_cdfs[SKIP_CONTEXTS][CDF_SIZE(2)]");
@@ -584,8 +547,6 @@
/* intrabc experiment */
#if CONFIG_INTRABC
cts_each_dim[0] = 2;
- optimize_entropy_table(&fc.intrabc[0], probsfile, 1, cts_each_dim, NULL, 1,
- "INTRABC_PROB_DEFAULT");
optimize_cdf_table(
&fc.intrabc[0], probsfile, 1, cts_each_dim,
"static const aom_cdf_prob default_intrabc_cdf[CDF_SIZE(2)]");