Use TX_SIZE consistently instead of int.

Change-Id: If6e84f390c6f92e8e013056c657758ba9e407a71
diff --git a/av1/common/av1_fwd_txfm2d.c b/av1/common/av1_fwd_txfm2d.c
index a46aae3..740c633 100644
--- a/av1/common/av1_fwd_txfm2d.c
+++ b/av1/common/av1_fwd_txfm2d.c
@@ -147,8 +147,8 @@
 #if CONFIG_TXMG
   int32_t txfm_buf[4 * 8];
   int16_t rinput[4 * 8];
-  int tx_size = TX_4X8;
-  int rtx_size = av1_rotate_tx_size(tx_size);
+  TX_SIZE tx_size = TX_4X8;
+  TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
   TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
   int w = tx_size_wide[tx_size];
   int h = tx_size_high[tx_size];
@@ -177,8 +177,8 @@
 #if CONFIG_TXMG
   int32_t txfm_buf[8 * 16];
   int16_t rinput[8 * 16];
-  int tx_size = TX_8X16;
-  int rtx_size = av1_rotate_tx_size(tx_size);
+  TX_SIZE tx_size = TX_8X16;
+  TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
   TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
   int w = tx_size_wide[tx_size];
   int h = tx_size_high[tx_size];
@@ -207,8 +207,8 @@
 #if CONFIG_TXMG
   int32_t txfm_buf[16 * 32];
   int16_t rinput[16 * 32];
-  int tx_size = TX_16X32;
-  int rtx_size = av1_rotate_tx_size(tx_size);
+  TX_SIZE tx_size = TX_16X32;
+  TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
   TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
   int w = tx_size_wide[tx_size];
   int h = tx_size_high[tx_size];
@@ -349,13 +349,13 @@
 #endif  // CONFIG_EXT_TX
 };
 
-TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(TX_TYPE tx_type, int tx_size) {
+TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size) {
   TXFM_2D_FLIP_CFG cfg;
   set_flip_cfg(tx_type, &cfg);
   const TX_TYPE_1D tx_type_col = vtx_tab[tx_type];
   const TX_TYPE_1D tx_type_row = htx_tab[tx_type];
-  const int tx_size_col = txsize_vert_map[tx_size];
-  const int tx_size_row = txsize_horz_map[tx_size];
+  const TX_SIZE tx_size_col = txsize_vert_map[tx_size];
+  const TX_SIZE tx_size_row = txsize_horz_map[tx_size];
   cfg.col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size_col];
   cfg.row_cfg = fwd_txfm_row_cfg_ls[tx_type_row][tx_size_row];
   return cfg;
@@ -365,7 +365,7 @@
 TXFM_2D_FLIP_CFG av1_get_fwd_txfm_32x64_cfg(TX_TYPE tx_type) {
   TXFM_2D_FLIP_CFG cfg;
   const TX_TYPE_1D tx_type_row = htx_tab[tx_type];
-  const int tx_size_row = txsize_horz_map[TX_32X64];
+  const TX_SIZE tx_size_row = txsize_horz_map[TX_32X64];
   switch (tx_type) {
     case DCT_DCT:
       cfg.col_cfg = &fwd_txfm_1d_col_cfg_dct_64;
@@ -381,7 +381,7 @@
 TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x32_cfg(TX_TYPE tx_type) {
   TXFM_2D_FLIP_CFG cfg;
   const TX_TYPE_1D tx_type_col = vtx_tab[tx_type];
-  const int tx_size_col = txsize_vert_map[TX_64X32];
+  const TX_SIZE tx_size_col = txsize_vert_map[TX_64X32];
   switch (tx_type) {
     case DCT_DCT:
       cfg.col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size_col];
diff --git a/av1/common/av1_inv_txfm2d.c b/av1/common/av1_inv_txfm2d.c
index e59907c..031d11b 100644
--- a/av1/common/av1_inv_txfm2d.c
+++ b/av1/common/av1_inv_txfm2d.c
@@ -140,13 +140,13 @@
 #endif  // CONFIG_EXT_TX
 };
 
-TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(TX_TYPE tx_type, int tx_size) {
+TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size) {
   TXFM_2D_FLIP_CFG cfg;
   set_flip_cfg(tx_type, &cfg);
   const TX_TYPE_1D tx_type_col = vtx_tab[tx_type];
   const TX_TYPE_1D tx_type_row = htx_tab[tx_type];
-  const int tx_size_col = txsize_vert_map[tx_size];
-  const int tx_size_row = txsize_horz_map[tx_size];
+  const TX_SIZE tx_size_col = txsize_vert_map[tx_size];
+  const TX_SIZE tx_size_row = txsize_horz_map[tx_size];
   cfg.col_cfg = inv_txfm_col_cfg_ls[tx_type_col][tx_size_col];
   cfg.row_cfg = inv_txfm_row_cfg_ls[tx_type_row][tx_size_row];
   return cfg;
@@ -294,9 +294,10 @@
 
 static INLINE void inv_txfm2d_add_facade(const int32_t *input, uint16_t *output,
                                          int stride, int32_t *txfm_buf,
-                                         TX_TYPE tx_type, int tx_size, int bd) {
+                                         TX_TYPE tx_type, TX_SIZE tx_size,
+                                         int bd) {
   TXFM_2D_FLIP_CFG cfg = av1_get_inv_txfm_cfg(tx_type, tx_size);
-  int tx_size_sqr = txsize_sqr_map[tx_size];
+  TX_SIZE tx_size_sqr = txsize_sqr_map[tx_size];
   inv_txfm2d_add_c(input, output, stride, &cfg, txfm_buf,
                    fwd_shift_sum[tx_size_sqr], bd);
 }
@@ -313,8 +314,8 @@
   int txfm_buf[8 * 4 + 8 + 8];
   int32_t rinput[8 * 4];
   uint16_t routput[8 * 4];
-  int tx_size = TX_8X4;
-  int rtx_size = av1_rotate_tx_size(tx_size);
+  TX_SIZE tx_size = TX_8X4;
+  TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
   TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
   int w = tx_size_wide[tx_size];
   int h = tx_size_high[tx_size];
@@ -342,8 +343,8 @@
   int txfm_buf[16 * 8 + 16 + 16];
   int32_t rinput[16 * 8];
   uint16_t routput[16 * 8];
-  int tx_size = TX_16X8;
-  int rtx_size = av1_rotate_tx_size(tx_size);
+  TX_SIZE tx_size = TX_16X8;
+  TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
   TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
   int w = tx_size_wide[tx_size];
   int h = tx_size_high[tx_size];
@@ -371,8 +372,8 @@
   int txfm_buf[32 * 16 + 32 + 32];
   int32_t rinput[32 * 16];
   uint16_t routput[32 * 16];
-  int tx_size = TX_32X16;
-  int rtx_size = av1_rotate_tx_size(tx_size);
+  TX_SIZE tx_size = TX_32X16;
+  TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
   TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
   int w = tx_size_wide[tx_size];
   int h = tx_size_high[tx_size];
@@ -425,8 +426,8 @@
   int txfm_buf[64 * 32 + 64 + 64];
   int32_t rinput[64 * 32];
   uint16_t routput[64 * 32];
-  int tx_size = TX_64X32;
-  int rtx_size = av1_rotate_tx_size(tx_size);
+  TX_SIZE tx_size = TX_64X32;
+  TX_SIZE rtx_size = av1_rotate_tx_size(tx_size);
   TX_TYPE rtx_type = av1_rotate_tx_type(tx_type);
   int w = tx_size_wide[tx_size];
   int h = tx_size_high[tx_size];
diff --git a/av1/common/av1_loopfilter.c b/av1/common/av1_loopfilter.c
index 7eb0f8c..33a6d6a 100644
--- a/av1/common/av1_loopfilter.c
+++ b/av1/common/av1_loopfilter.c
@@ -2217,7 +2217,7 @@
     const int skip_border_4x4_r =
         ss_y && mi_row + idx_r >= cm->mi_rows - mi_size_high[BLOCK_8X8];
 
-    int tx_size_mask = 0;
+    TX_SIZE tx_size_mask = 0;
     const int c_step = (c >> ss_x);
     const int r_step = (r >> ss_y);
     const int col_mask = 1 << c_step;
diff --git a/av1/common/av1_txfm.h b/av1/common/av1_txfm.h
index bcc37d2..bd365de 100644
--- a/av1/common/av1_txfm.h
+++ b/av1/common/av1_txfm.h
@@ -197,7 +197,7 @@
 }
 
 #if CONFIG_TXMG
-static INLINE int av1_rotate_tx_size(int tx_size) {
+static INLINE TX_SIZE av1_rotate_tx_size(TX_SIZE tx_size) {
   switch (tx_size) {
 #if CONFIG_CHROMA_2X2
     case TX_2X2: return TX_2X2;
@@ -354,13 +354,13 @@
                              const TXFM_2D_FLIP_CFG *cfg, int8_t fwd_shift,
                              int bd);
 
-TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(TX_TYPE tx_type, int tx_size);
+TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size);
 #if CONFIG_TX64X64
 TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(TX_TYPE tx_type);
 TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x32_cfg(TX_TYPE tx_type);
 TXFM_2D_FLIP_CFG av1_get_fwd_txfm_32x64_cfg(TX_TYPE tx_type);
 #endif  // CONFIG_TX64X64
-TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(TX_TYPE tx_type, int tx_size);
+TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size);
 #ifdef __cplusplus
 }
 #endif  // __cplusplus
diff --git a/av1/common/scan.c b/av1/common/scan.c
index ca7e63e..2e6c447 100644
--- a/av1/common/scan.c
+++ b/av1/common/scan.c
@@ -8284,7 +8284,7 @@
   ++(*scan_idx);
 }
 
-void av1_update_neighbors(int tx_size, const int16_t *scan,
+void av1_update_neighbors(TX_SIZE tx_size, const int16_t *scan,
                           const int16_t *iscan, int16_t *neighbors) {
   const int tx1d_wide = tx_size_wide[tx_size];
   const int tx1d_high = tx_size_high[tx_size];
diff --git a/av1/common/scan.h b/av1/common/scan.h
index 38d8ee8..6f0078f 100644
--- a/av1/common/scan.h
+++ b/av1/common/scan.h
@@ -52,7 +52,7 @@
 
 // For each coeff_idx in scan[], update its above and left neighbors in
 // neighbors[] accordingly.
-void av1_update_neighbors(int tx_size, const int16_t *scan,
+void av1_update_neighbors(TX_SIZE tx_size, const int16_t *scan,
                           const int16_t *iscan, int16_t *neighbors);
 void av1_init_scan_order(AV1_COMMON *cm);
 void av1_adapt_scan_order(AV1_COMMON *cm);
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 5473199..429cce3 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -511,7 +511,7 @@
 #endif
 
 static TX_SIZE read_selected_tx_size(AV1_COMMON *cm, MACROBLOCKD *xd,
-                                     int tx_size_cat, aom_reader *r) {
+                                     TX_SIZE tx_size_cat, aom_reader *r) {
   FRAME_COUNTS *counts = xd->counts;
   const int ctx = get_tx_size_context(xd);
   FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
diff --git a/av1/decoder/detokenize.c b/av1/decoder/detokenize.c
index 1cd54e1..a59a7ba 100644
--- a/av1/decoder/detokenize.c
+++ b/av1/decoder/detokenize.c
@@ -140,7 +140,7 @@
 #endif  // CONFIG_AOM_QM
   (void)tx_type;
   int band, c = 0;
-  const int tx_size_ctx = txsize_sqr_map[tx_size];
+  const TX_SIZE tx_size_ctx = txsize_sqr_map[tx_size];
   aom_cdf_prob(*coef_head_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
       ec_ctx->coef_head_cdfs[tx_size_ctx][type][ref];
   aom_cdf_prob(*coef_tail_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 7cc83b6..eb8f96a 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -368,9 +368,9 @@
 #endif
     const TX_SIZE tx_size = mbmi->tx_size;
     const int is_inter = is_inter_block(mbmi);
-    const int tx_size_ctx = get_tx_size_context(xd);
-    const int tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
-                                     : intra_tx_size_cat_lookup[bsize];
+    const TX_SIZE tx_size_ctx = get_tx_size_context(xd);
+    const TX_SIZE tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
+                                         : intra_tx_size_cat_lookup[bsize];
     const TX_SIZE coded_tx_size = txsize_sqr_up_map[tx_size];
     const int depth = tx_size_to_depth(coded_tx_size);
 #if CONFIG_EXT_TX && CONFIG_RECT_TX
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index ee3f3d9..71d3e33 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -6388,18 +6388,18 @@
       if (is_inter) {
         tx_partition_count_update(cm, x, bsize, mi_row, mi_col, td->counts);
       } else {
-        const int tx_size_ctx = get_tx_size_context(xd);
-        const int tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
-                                         : intra_tx_size_cat_lookup[bsize];
+        const TX_SIZE tx_size_ctx = get_tx_size_context(xd);
+        const TX_SIZE tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
+                                             : intra_tx_size_cat_lookup[bsize];
         const TX_SIZE coded_tx_size = txsize_sqr_up_map[tx_size];
         const int depth = tx_size_to_depth(coded_tx_size);
         ++td->counts->tx_size[tx_size_cat][tx_size_ctx][depth];
         if (tx_size != max_txsize_rect_lookup[bsize]) ++x->txb_split_count;
       }
 #else
-      const int tx_size_ctx = get_tx_size_context(xd);
-      const int tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
-                                       : intra_tx_size_cat_lookup[bsize];
+      const TX_SIZE tx_size_ctx = get_tx_size_context(xd);
+      const TX_SIZE tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
+                                           : intra_tx_size_cat_lookup[bsize];
       const TX_SIZE coded_tx_size = txsize_sqr_up_map[tx_size];
       const int depth = tx_size_to_depth(coded_tx_size);
 
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 5c4d8fc..1e83061 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -1139,7 +1139,7 @@
                                     tran_low_t *ref_coeff,
                                     tran_low_t *const dqcoeff, uint16_t *eob,
                                     const int16_t *quant, int plane,
-                                    int tx_size, TX_TYPE tx_type, int *rate,
+                                    TX_SIZE tx_size, TX_TYPE tx_type, int *rate,
                                     int speed, PVQ_INFO *pvq_info) {
   const int tx_blk_size = tx_size_wide[tx_size];
   daala_enc_ctx *daala_enc = &x->daala_enc;
diff --git a/av1/encoder/encodemb.h b/av1/encoder/encodemb.h
index 742788c..c817a94 100644
--- a/av1/encoder/encodemb.h
+++ b/av1/encoder/encodemb.h
@@ -81,7 +81,7 @@
                                     tran_low_t *ref_coeff,
                                     tran_low_t *const dqcoeff, uint16_t *eob,
                                     const int16_t *quant, int plane,
-                                    int tx_size, TX_TYPE tx_type, int *rate,
+                                    TX_SIZE tx_size, TX_TYPE tx_type, int *rate,
                                     int speed, PVQ_INFO *pvq_info);
 
 void av1_store_pvq_enc_info(PVQ_INFO *pvq_info, int *qg, int *theta, int *k,
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 6115e84..8387b1c 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -511,7 +511,7 @@
 #endif  // !LV_MAP_PROB
 
 void av1_fill_coeff_costs(MACROBLOCK *x, FRAME_CONTEXT *fc) {
-  for (TX_SIZE tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
+  for (int tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
     for (int plane = 0; plane < PLANE_TYPES; ++plane) {
       LV_MAP_COEFF_COST *pcost = &x->coeff_costs[tx_size][plane];
 
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index ef9a033..6d1c69f 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1441,7 +1441,7 @@
   const uint16_t *band_count = &band_count_table[tx_size][1];
   const int eob = p->eobs[block];
   const tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
-  const int tx_size_ctx = txsize_sqr_map[tx_size];
+  const TX_SIZE tx_size_ctx = txsize_sqr_map[tx_size];
   uint8_t token_cache[MAX_TX_SQUARE];
   int pt = combine_entropy_contexts(*a, *l);
   int c, cost;
@@ -2212,8 +2212,9 @@
 }
 #endif  // CONFIG_SUPERTX
 
-static int tx_size_cost(const AV1_COMP *const cpi, const MACROBLOCK *const x,
-                        BLOCK_SIZE bsize, TX_SIZE tx_size) {
+static TX_SIZE tx_size_cost(const AV1_COMP *const cpi,
+                            const MACROBLOCK *const x, BLOCK_SIZE bsize,
+                            TX_SIZE tx_size) {
   const AV1_COMMON *const cm = &cpi->common;
   const MACROBLOCKD *const xd = &x->e_mbd;
   const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
@@ -2229,11 +2230,11 @@
 
   if (tx_select) {
     const int is_inter = is_inter_block(mbmi);
-    const int tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
-                                     : intra_tx_size_cat_lookup[bsize];
+    const TX_SIZE tx_size_cat = is_inter ? inter_tx_size_cat_lookup[bsize]
+                                         : intra_tx_size_cat_lookup[bsize];
     const TX_SIZE coded_tx_size = txsize_sqr_up_map[tx_size];
     const int depth = tx_size_to_depth(coded_tx_size);
-    const int tx_size_ctx = get_tx_size_context(xd);
+    const TX_SIZE tx_size_ctx = get_tx_size_context(xd);
     int r_tx_size = x->tx_size_cost[tx_size_cat][tx_size_ctx][depth];
 #if CONFIG_RECT_TX_EXT && (CONFIG_EXT_TX || CONFIG_VAR_TX)
     if (is_quarter_tx_allowed(xd, mbmi, is_inter) && tx_size != coded_tx_size)
@@ -2291,7 +2292,7 @@
 }
 static int64_t txfm_yrd(const AV1_COMP *const cpi, MACROBLOCK *x,
                         RD_STATS *rd_stats, int64_t ref_best_rd, BLOCK_SIZE bs,
-                        TX_TYPE tx_type, int tx_size) {
+                        TX_TYPE tx_type, TX_SIZE tx_size) {
   const AV1_COMMON *const cm = &cpi->common;
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
@@ -4601,7 +4602,7 @@
       av1_cost_bit(xd->fc->txb_skip[txs_ctx][txb_ctx.txb_skip_ctx], 1);
 #endif  // LV_MAP_PROB
 #else
-  int tx_size_ctx = txsize_sqr_map[tx_size];
+  TX_SIZE tx_size_ctx = txsize_sqr_map[tx_size];
   int coeff_ctx = get_entropy_context(tx_size, pta, ptl);
   zero_blk_rate =
       x->token_head_costs[tx_size_ctx][pd->plane_type][1][0][coeff_ctx][0];
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 5cd373f..6ee82a2 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -454,7 +454,7 @@
 
   // Early termination in transform size search, which only applies while
   // tx_size_search_method is USE_FULL_RD.
-  int tx_size_search_breakout;
+  TX_SIZE tx_size_search_breakout;
 
   // adaptive interp_filter search to allow skip of certain filter types.
   int adaptive_interp_filter_search;