Remove ext-tx tree

Hard code av1_ext_tx_ind[] and av1_ext_tx_inv[].

Change-Id: Ife650d41be3f85d048f5585659ad57e03f54b39b
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index 0cdbc13..e337021 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -2653,86 +2653,6 @@
 };
 #endif
 
-#if CONFIG_EXT_TX
-/* clang-format off */
-const aom_tree_index av1_ext_tx_tree[EXT_TX_SET_TYPES][TREE_SIZE(TX_TYPES)] = {
-    // TODO(yaowu@google.com): remove used entry 0.
-    { 0 },
-    { -IDTX, -DCT_DCT, },
-#if CONFIG_MRC_TX
-    { -DCT_DCT, -MRC_DCT, },
-    {   -IDTX, 2,
-        -DCT_DCT, -MRC_DCT, },
-#endif  // CONFIG_MRC_TX
-    {
-        -IDTX, 2,
-        -DCT_DCT, 4,
-        -ADST_ADST, 6,
-        -ADST_DCT, -DCT_ADST,
-    },
-    {
-        -IDTX, 2,
-        -DCT_DCT, 4,
-        6, 8,
-        -V_DCT, -H_DCT,
-        -ADST_ADST, 10,
-        -ADST_DCT, -DCT_ADST,
-    },
-    {
-        -IDTX, 2,
-        4, 6,
-        -V_DCT, -H_DCT,
-        -DCT_DCT, 8,
-        10, 16,
-        12, 14,
-        -ADST_DCT, -DCT_ADST,
-        -FLIPADST_DCT, -DCT_FLIPADST,
-        18, 20,
-        -ADST_ADST, -FLIPADST_FLIPADST,
-        -ADST_FLIPADST, -FLIPADST_ADST,
-    },
-    {
-        -IDTX, 2,
-        4, 14,
-        6, 8,
-        -V_DCT, -H_DCT,
-        10, 12,
-        -V_ADST, -H_ADST,
-        -V_FLIPADST, -H_FLIPADST,
-        -DCT_DCT, 16,
-        18, 24,
-        20, 22,
-        -ADST_DCT, -DCT_ADST,
-        -FLIPADST_DCT, -DCT_FLIPADST,
-        26, 28,
-        -ADST_ADST, -FLIPADST_FLIPADST,
-        -ADST_FLIPADST, -FLIPADST_ADST,
-    },
-};
-/* clang-format on */
-int av1_ext_tx_ind[EXT_TX_SET_TYPES][TX_TYPES];
-int av1_ext_tx_inv[EXT_TX_SET_TYPES][TX_TYPES];
-#else   // !CONFIG_EXT_TX
-/* clang-format off */
-#if CONFIG_MRC_TX
-const aom_tree_index av1_ext_tx_tree[TREE_SIZE(TX_TYPES)] = {
-  -DCT_DCT, 2,
-  -MRC_DCT, 4,
-  -ADST_ADST, 6,
-  -ADST_DCT, -DCT_ADST
-};
-#else
-const aom_tree_index av1_ext_tx_tree[TREE_SIZE(TX_TYPES)] = {
-  -DCT_DCT, 2,
-  -ADST_ADST, 4,
-  -ADST_DCT, -DCT_ADST
-};
-#endif  // CONFIG_MRC_TX
-/* clang-format on */
-int av1_ext_tx_ind[TX_TYPES];
-int av1_ext_tx_inv[TX_TYPES];
-#endif  // CONFIG_EXT_TX
-
 #if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
 static const aom_prob
     default_intra_filter_probs[INTRA_FILTERS + 1][INTRA_FILTERS - 1] = {
diff --git a/av1/common/entropymode.h b/av1/common/entropymode.h
index 8233001..55b67f2 100644
--- a/av1/common/entropymode.h
+++ b/av1/common/entropymode.h
@@ -558,9 +558,80 @@
     av1_default_palette_uv_mode_prob[PALETTE_UV_MODE_CONTEXTS];
 
 #if CONFIG_EXT_TX
-extern int av1_ext_tx_ind[EXT_TX_SET_TYPES][TX_TYPES];
-extern int av1_ext_tx_inv[EXT_TX_SET_TYPES][TX_TYPES];
-#endif
+static const int av1_ext_tx_ind[EXT_TX_SET_TYPES][TX_TYPES] = {
+  {
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  },
+  {
+      1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  },
+#if CONFIG_MRC_TX
+  {
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+  },
+  {
+      1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+  },
+#endif  // CONFIG_MRC_TX
+  {
+      1, 3, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  },
+  {
+      1, 5, 6, 4, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0,
+  },
+  {
+      3, 4, 5, 8, 6, 7, 9, 10, 11, 0, 1, 2, 0, 0, 0, 0,
+  },
+  {
+      7, 8, 9, 12, 10, 11, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6,
+  },
+};
+
+static const int av1_ext_tx_inv[EXT_TX_SET_TYPES][TX_TYPES] = {
+  {
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  },
+  {
+      9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  },
+#if CONFIG_MRC_TX
+  {
+      0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  },
+  {
+      9, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  },
+#endif  // CONFIG_MRC_TX
+  {
+      9, 0, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  },
+  {
+      9, 0, 10, 11, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  },
+  {
+      9, 10, 11, 0, 1, 2, 4, 5, 3, 6, 7, 8, 0, 0, 0, 0,
+  },
+  {
+      9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 4, 5, 3, 6, 7, 8,
+  },
+};
+#else
+#if CONFIG_MRC_TX
+static const int av1_ext_tx_ind[TX_TYPES] = {
+  0, 3, 4, 2, 1,
+};
+static const int av1_ext_tx_inv[TX_TYPES] = {
+  0, 4, 3, 1, 2,
+};
+#else
+static const int av1_ext_tx_ind[TX_TYPES] = {
+  0, 2, 3, 1,
+};
+static const int av1_ext_tx_inv[TX_TYPES] = {
+  0, 3, 1, 2,
+};
+#endif  // CONFIG_MRC_TX
+#endif  // CONFIG_EXT_TX
 
 #if CONFIG_INTERINTRA
 extern const aom_tree_index
@@ -611,10 +682,6 @@
 
 void av1_adapt_intra_frame_probs(struct AV1Common *cm);
 void av1_adapt_inter_frame_probs(struct AV1Common *cm);
-#if !CONFIG_EXT_TX
-extern int av1_ext_tx_ind[TX_TYPES];
-extern int av1_ext_tx_inv[TX_TYPES];
-#endif
 
 static INLINE int av1_ceil_log2(int n) {
   int i = 1, p = 2;
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c
index 30f8a6d..cd82d5b 100644
--- a/av1/decoder/decoder.c
+++ b/av1/decoder/decoder.c
@@ -50,14 +50,6 @@
     av1_init_intra_predictors();
     av1_init_wedge_masks();
     init_done = 1;
-#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],
-                            av1_ext_tx_tree[s]);
-    }
-#else
-    av1_indices_from_tree(av1_ext_tx_ind, av1_ext_tx_inv, av1_ext_tx_tree);
-#endif
   }
 }
 
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 42d92cc..dd0e43b 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -115,18 +115,6 @@
                        int *const tile_col_size_bytes);
 #endif
 void av1_encode_token_init(void) {
-#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],
-                          av1_ext_tx_tree[s]);
-  }
-#else
-  /* 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. */
-  av1_indices_from_tree(av1_ext_tx_ind, av1_ext_tx_inv, av1_ext_tx_tree);
-#endif  // CONFIG_EXT_TX
-
 #if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
   av1_tokens_from_tree(intra_filter_encodings, av1_intra_filter_tree);
 #endif  // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP