Remove the av1_intra_mode_tree const with EC_ADAPT.

When EC_ADAPT is enabled, this adds const av1_intra_mode_ind and
 av1_intra_mode_inv arrays and removes the av1_intra_mode_tree const.
This commit has no effect on metrics.

Change-Id: I1de8f4ea91269adacd7fdadbc8426f641ef866f0
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index 0e0cd4c..92b3631 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -1255,8 +1255,10 @@
 };
 #endif
 #endif
+#if !CONFIG_EC_ADAPT
 int av1_intra_mode_ind[INTRA_MODES];
 int av1_intra_mode_inv[INTRA_MODES];
+#endif
 #if CONFIG_EXT_TX
 int av1_ext_tx_intra_ind[EXT_TX_SETS_INTRA][TX_TYPES];
 int av1_ext_tx_intra_inv[EXT_TX_SETS_INTRA][TX_TYPES];
@@ -1264,6 +1266,26 @@
 int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES];
 #endif
 
+#if CONFIG_EC_ADAPT
+#if CONFIG_ALT_INTRA
+#if CONFIG_SMOOTH_HV
+const int av1_intra_mode_ind[INTRA_MODES] = { 0, 2, 3,  6,  4,  5, 8,
+                                              9, 7, 10, 11, 12, 1 };
+const int av1_intra_mode_inv[INTRA_MODES] = { 0, 12, 1, 2, 4,  5, 3,
+                                              8, 6,  7, 9, 10, 11 };
+#else
+const int av1_intra_mode_ind[INTRA_MODES] = {
+  0, 2, 3, 6, 4, 5, 8, 9, 7, 10, 1
+};
+const int av1_intra_mode_inv[INTRA_MODES] = {
+  0, 10, 1, 2, 4, 5, 3, 8, 6, 7, 9
+};
+#endif  // CONFIG_SMOOTH_HV
+#else
+const int av1_intra_mode_ind[INTRA_MODES] = { 0, 2, 3, 6, 4, 5, 8, 9, 7, 1 };
+const int av1_intra_mode_inv[INTRA_MODES] = { 0, 9, 1, 2, 4, 5, 3, 8, 6, 7 }
+#endif  // CONFIG_ALT_INTRA
+#else
 #if CONFIG_ALT_INTRA
 #if CONFIG_SMOOTH_HV
 const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
@@ -1319,6 +1341,7 @@
   -D153_PRED, -D207_PRED  /* 8 = D153_NODE */
 };
 #endif  // CONFIG_ALT_INTRA
+#endif  // !CONFIG_EC_ADAPT
 
 #if CONFIG_EXT_INTER
 /* clang-format off */
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index 06b70c2..c7f24c1 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -497,9 +497,14 @@
     [PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS][PALETTE_COLORS - 1];
 #endif  // CONFIG_PALETTE
 
+#if !CONFIG_EC_ADAPT
 extern const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
 extern int av1_intra_mode_ind[INTRA_MODES];
 extern int av1_intra_mode_inv[INTRA_MODES];
+#else
+extern const int av1_intra_mode_ind[INTRA_MODES];
+extern const int av1_intra_mode_inv[INTRA_MODES];
+#endif
 #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];
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c
index 408698f..d818c4d 100644
--- a/av1/decoder/decoder.c
+++ b/av1/decoder/decoder.c
@@ -50,8 +50,10 @@
     av1_init_wedge_masks();
 #endif  // CONFIG_EXT_INTER
     init_done = 1;
+#if !CONFIG_EC_ADAPT
     av1_indices_from_tree(av1_intra_mode_ind, av1_intra_mode_inv,
                           av1_intra_mode_tree);
+#endif
     av1_indices_from_tree(av1_switchable_interp_ind, av1_switchable_interp_inv,
                           av1_switchable_interp_tree);
 #if CONFIG_EXT_TX
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 80d8d42..ff3e1ce 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -198,8 +198,10 @@
 #else
   av1_indices_from_tree(av1_ext_tx_ind, av1_ext_tx_inv, av1_ext_tx_tree);
 #endif
+#if !CONFIG_EC_ADAPT
   av1_indices_from_tree(av1_intra_mode_ind, av1_intra_mode_inv,
                         av1_intra_mode_tree);
+#endif
 }
 
 static void write_intra_mode_kf(const AV1_COMMON *cm, FRAME_CONTEXT *frame_ctx,
diff --git a/tools/aom_entropy_optimizer.c b/tools/aom_entropy_optimizer.c
index 63703eb..667a9bf 100644
--- a/tools/aom_entropy_optimizer.c
+++ b/tools/aom_entropy_optimizer.c
@@ -28,6 +28,64 @@
 #include "./aom_config.h"
 #include "av1/common/entropymode.h"
 
+#if CONFIG_EC_ADAPT
+#if CONFIG_ALT_INTRA
+#if CONFIG_SMOOTH_HV
+const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
+  -DC_PRED,
+  2, /* 0 = DC_NODE */
+  -TM_PRED,
+  4, /* 1 = TM_NODE */
+  -V_PRED,
+  6, /* 2 = V_NODE */
+  8,
+  12, /* 3 = COM_NODE */
+  -H_PRED,
+  10, /* 4 = H_NODE */
+  -D135_PRED,
+  -D117_PRED, /* 5 = D135_NODE */
+  -D45_PRED,
+  14, /* 6 = D45_NODE */
+  -D63_PRED,
+  16, /* 7 = D63_NODE */
+  -D153_PRED,
+  18, /* 8 = D153_NODE */
+  -D207_PRED,
+  20, /* 9 = D207_NODE */
+  -SMOOTH_PRED,
+  22, /* 10 = SMOOTH_NODE */
+  -SMOOTH_V_PRED,
+  -SMOOTH_H_PRED /* 11 = SMOOTH_V_NODE */
+};
+#else
+const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
+  -DC_PRED,   2,            /* 0 = DC_NODE */
+  -TM_PRED,   4,            /* 1 = TM_NODE */
+  -V_PRED,    6,            /* 2 = V_NODE */
+  8,          12,           /* 3 = COM_NODE */
+  -H_PRED,    10,           /* 4 = H_NODE */
+  -D135_PRED, -D117_PRED,   /* 5 = D135_NODE */
+  -D45_PRED,  14,           /* 6 = D45_NODE */
+  -D63_PRED,  16,           /* 7 = D63_NODE */
+  -D153_PRED, 18,           /* 8 = D153_NODE */
+  -D207_PRED, -SMOOTH_PRED, /* 9 = D207_NODE */
+};
+#endif  // CONFIG_SMOOTH_HV
+#else
+const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
+  -DC_PRED,   2,          /* 0 = DC_NODE */
+  -TM_PRED,   4,          /* 1 = TM_NODE */
+  -V_PRED,    6,          /* 2 = V_NODE */
+  8,          12,         /* 3 = COM_NODE */
+  -H_PRED,    10,         /* 4 = H_NODE */
+  -D135_PRED, -D117_PRED, /* 5 = D135_NODE */
+  -D45_PRED,  14,         /* 6 = D45_NODE */
+  -D63_PRED,  16,         /* 7 = D63_NODE */
+  -D153_PRED, -D207_PRED  /* 8 = D153_NODE */
+};
+#endif  // CONFIG_ALT_INTRA
+#endif
+
 #define SPACES_PER_TAB 2
 
 typedef unsigned int aom_count_type;