Align EXT_TX with EC_MULTISYMBOL and EC_ADAPT.

Do multisymbol coding for transform type.
Load default cdf probabilities directly.
Use CDF frame update mechanism when EC_ADAPT is
enabled.

Change-Id: Id23c927e81587b560e9df8b9bc56c0e2e3bb6f03
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index af94487..80cd4a6 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -196,7 +196,14 @@
 /* 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. */
-#if !CONFIG_EXT_TX
+#if CONFIG_EXT_TX
+  for (s = 1; s < EXT_TX_SETS_INTRA; ++s)
+    av1_indices_from_tree(av1_ext_tx_intra_ind[s], av1_ext_tx_intra_inv[s],
+                          ext_tx_cnt_intra[s], av1_ext_tx_intra_tree[s]);
+  for (s = 1; s < EXT_TX_SETS_INTER; ++s)
+    av1_indices_from_tree(av1_ext_tx_inter_ind[s], av1_ext_tx_inter_inv[s],
+                          ext_tx_cnt_inter[s], av1_ext_tx_inter_tree[s]);
+#else
   av1_indices_from_tree(av1_ext_tx_ind, av1_ext_tx_inv, TX_TYPES,
                         av1_ext_tx_tree);
 #endif
@@ -1441,17 +1448,30 @@
       if (is_inter) {
         assert(ext_tx_used_inter[eset][mbmi->tx_type]);
         if (eset > 0) {
+#if CONFIG_EC_MULTISYMBOL
+          aom_write_symbol(w, av1_ext_tx_inter_ind[eset][mbmi->tx_type],
+                           ec_ctx->inter_ext_tx_cdf[eset][square_tx_size],
+                           ext_tx_cnt_inter[eset]);
+#else
           av1_write_token(w, av1_ext_tx_inter_tree[eset],
                           ec_ctx->inter_ext_tx_prob[eset][square_tx_size],
                           &ext_tx_inter_encodings[eset][mbmi->tx_type]);
+#endif
         }
       } else if (ALLOW_INTRA_EXT_TX) {
         assert(ext_tx_used_intra[eset][mbmi->tx_type]);
         if (eset > 0) {
+#if CONFIG_EC_MULTISYMBOL
+          aom_write_symbol(
+              w, av1_ext_tx_intra_ind[eset][mbmi->tx_type],
+              ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode],
+              ext_tx_cnt_intra[eset]);
+#else
           av1_write_token(
               w, av1_ext_tx_intra_tree[eset],
               ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode],
               &ext_tx_intra_encodings[eset][mbmi->tx_type]);
+#endif
         }
       }
     }
@@ -2684,9 +2704,15 @@
       const int eset =
           get_ext_tx_set(supertx_size, bsize, 1, cm->reduced_tx_set_used);
       if (eset > 0) {
+#if CONFIG_EC_MULTISYMBOL
+        aom_write_symbol(w, av1_ext_tx_inter_ind[eset][mbmi->tx_type],
+                         ec_ctx->inter_ext_tx_cdf[eset][supertx_size],
+                         ext_tx_cnt_inter[eset]);
+#else
         av1_write_token(w, av1_ext_tx_inter_tree[eset],
                         cm->fc->inter_ext_tx_prob[eset][supertx_size],
                         &ext_tx_inter_encodings[eset][mbmi->tx_type]);
+#endif
       }
     }
 #else