Prefer using get_tx_size()

Change-Id: Ifcdd3ce2953c1ecb1d0962da412a4b5ba2cda912
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 7a9f04d..d218eb0 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2219,8 +2219,7 @@
         }
 #endif  // CONFIG_RD_DEBUG
       } else {
-        TX_SIZE tx = plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane])
-                           : m->mbmi.tx_size;
+        TX_SIZE tx = get_tx_size(plane, xd);
         const int bkw = tx_size_wide_unit[tx];
         const int bkh = tx_size_high_unit[tx];
 #if CONFIG_PALETTE && CONFIG_PALETTE_THROUGHPUT
@@ -2252,8 +2251,7 @@
         }
       }
 #else
-      TX_SIZE tx =
-          plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane]) : m->mbmi.tx_size;
+      TX_SIZE tx = get_tx_size(plane, xd);
       TOKEN_STATS token_stats;
 #if CONFIG_PALETTE && CONFIG_PALETTE_THROUGHPUT
       const struct macroblockd_plane *const pd = &xd->plane[plane];
@@ -2319,8 +2317,7 @@
   if (!m->mbmi.skip) {
     for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
       PVQ_INFO *pvq;
-      TX_SIZE tx_size =
-          plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane]) : m->mbmi.tx_size;
+      TX_SIZE tx_size = get_tx_size(plane, xd);
       int idx, idy;
       const struct macroblockd_plane *const pd = &xd->plane[plane];
       int max_blocks_wide;
@@ -2731,8 +2728,7 @@
         const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
 
         int row, col;
-        TX_SIZE tx =
-            plane ? get_uv_tx_size(mbmi, &xd->plane[plane]) : mbmi->tx_size;
+        TX_SIZE tx = get_tx_size(plane, xd);
         BLOCK_SIZE txb_size = txsize_to_bsize[tx];
 
         const int stepr = tx_size_high_unit[txb_size];
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 506411c..d5ddbfa 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -912,7 +912,7 @@
     av1_get_entropy_contexts(bsize, 0, pd, ctx.ta[plane], ctx.tl[plane]);
 #else
     const struct macroblockd_plane *const pd = &xd->plane[plane];
-    const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
+    const TX_SIZE tx_size = get_tx_size(plane, xd);
     av1_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane], ctx.tl[plane]);
 #endif
 
@@ -953,7 +953,7 @@
 #if CONFIG_VAR_TX
     const TX_SIZE tx_size = TX_4X4;
 #else
-    const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
+    const TX_SIZE tx_size = get_tx_size(plane, xd);
 #endif
     av1_subtract_plane(x, bsize, plane);
     av1_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane], ctx.tl[plane]);
@@ -1152,8 +1152,7 @@
 
   if (enable_optimize_b) {
     const struct macroblockd_plane *const pd = &xd->plane[plane];
-    const TX_SIZE tx_size =
-        plane ? get_uv_tx_size(&xd->mi[0]->mbmi, pd) : xd->mi[0]->mbmi.tx_size;
+    const TX_SIZE tx_size = get_tx_size(plane, xd);
     av1_get_entropy_contexts(bsize, tx_size, pd, ta, tl);
   }
   av1_foreach_transformed_block_in_plane(xd, bsize, plane,
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 024d7f8..62db8cb 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -36,7 +36,7 @@
   aom_prob *eob_flag;
   MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
   const PLANE_TYPE plane_type = get_plane_type(plane);
-  const TX_SIZE tx_size = get_tx_size(plane, xd, block);
+  const TX_SIZE tx_size = get_tx_size(plane, xd);
   const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
   const SCAN_ORDER *const scan_order =
       get_scan(cm, tx_size, tx_type, is_inter_block(mbmi));
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 9daa6c9..f721df0 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1126,8 +1126,7 @@
 
 #if !CONFIG_VAR_TX && !CONFIG_SUPERTX
   // Check for consistency of tx_size with mode info
-  assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size
-                              : get_uv_tx_size(mbmi, pd) == tx_size);
+  assert(tx_size == get_tx_size(plane, xd));
 #endif  // !CONFIG_VAR_TX && !CONFIG_SUPERTX
   (void)cm;