Consolidate get_scaled_plane_bsize()

get_scaled_plane_bsize() and get_plane_block_size() are essentially the
same and can thus be merged.

Change-Id: Ia4fb7c87b5df07de9b6b22cd6cc83fbf4967af50
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 2e35c67..9b5bad2 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -805,49 +805,6 @@
   return ss_size_lookup[bsize][subsampling_x][subsampling_y];
 }
 
-// Consider special handling of chroma block size for sub 8X8 partitio blocks.
-static INLINE BLOCK_SIZE get_scaled_plane_bsize(BLOCK_SIZE bsize,
-                                                int subsampling_x,
-                                                int subsampling_y) {
-  assert(subsampling_x >= 0 && subsampling_x < 2);
-  assert(subsampling_y >= 0 && subsampling_y < 2);
-
-  if (!subsampling_x && !subsampling_y) return bsize;
-
-  switch (bsize) {
-    case BLOCK_4X4: return BLOCK_4X4;
-    case BLOCK_4X8:
-      if (subsampling_x == 1 && subsampling_y == 1)
-        return BLOCK_4X4;
-      else if (subsampling_x == 1)
-        return BLOCK_4X8;
-      else
-        return BLOCK_4X4;
-    case BLOCK_8X4:
-      if (subsampling_x == 1 && subsampling_y == 1)
-        return BLOCK_4X4;
-      else if (subsampling_x == 1)
-        return BLOCK_4X4;
-      else
-        return BLOCK_8X4;
-    case BLOCK_4X16:
-      if (subsampling_x == 1 && subsampling_y == 1)
-        return BLOCK_4X8;
-      else if (subsampling_x == 1)
-        return BLOCK_4X16;
-      else
-        return BLOCK_4X8;
-    case BLOCK_16X4:
-      if (subsampling_x == 1 && subsampling_y == 1)
-        return BLOCK_8X4;
-      else if (subsampling_x == 1)
-        return BLOCK_8X4;
-      else
-        return BLOCK_16X4;
-    default: return ss_size_lookup[bsize][subsampling_x][subsampling_y];
-  }
-}
-
 /*
  * Logic to generate the lookup tables:
  *
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 3bd21c7..61d4c13 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -686,7 +686,7 @@
     // block size
     const int b4_w = block_size_wide[bsize] >> ss_x;
     const int b4_h = block_size_high[bsize] >> ss_y;
-    const BLOCK_SIZE plane_bsize = get_scaled_plane_bsize(bsize, ss_x, ss_y);
+    const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, ss_x, ss_y);
     const int b8_w = block_size_wide[plane_bsize];
     const int b8_h = block_size_high[plane_bsize];
     assert(!is_compound);
@@ -1240,7 +1240,7 @@
             if (!is_chroma_reference(mi_row, mi_col, bsize, ss_x, ss_y))
               continue;
             const BLOCK_SIZE plane_bsize =
-                get_scaled_plane_bsize(bsize, ss_x, ss_y);
+                get_plane_block_size(bsize, ss_x, ss_y);
             const TX_SIZE max_tx_size =
                 get_vartx_max_txsize(xd, plane_bsize, plane);
             const int bh_var_tx = tx_size_high_unit[max_tx_size];
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 44b9143..03d492e 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1392,7 +1392,7 @@
   assert(bsize < BLOCK_SIZES_ALL);
   const int ss_x = pd->subsampling_x;
   const int ss_y = pd->subsampling_y;
-  const BLOCK_SIZE plane_bsize = get_scaled_plane_bsize(bsize, ss_x, ss_y);
+  const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, ss_x, ss_y);
   assert(plane_bsize < BLOCK_SIZES_ALL);
   const TX_SIZE max_tx_size = get_vartx_max_txsize(xd, plane_bsize, plane);
   const int step =
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 148906a..f990c80 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -506,7 +506,7 @@
       continue;
 
     const BLOCK_SIZE plane_bsize =
-        get_scaled_plane_bsize(bsize, subsampling_x, subsampling_y);
+        get_plane_block_size(bsize, subsampling_x, subsampling_y);
     assert(plane_bsize < BLOCK_SIZES_ALL);
     const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
     const int mi_height = block_size_high[plane_bsize] >> tx_size_high_log2[0];
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index eb9fae7..e203037 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5652,7 +5652,7 @@
   const int is_inter = is_inter_block(mbmi);
   int64_t this_rd = 0, skip_rd = 0;
   const BLOCK_SIZE plane_bsize =
-      get_scaled_plane_bsize(bsize, pd->subsampling_x, pd->subsampling_y);
+      get_plane_block_size(bsize, pd->subsampling_x, pd->subsampling_y);
 
   if (is_inter && is_cost_valid) {
     for (plane = 1; plane < MAX_MB_PLANE; ++plane)
diff --git a/av1/encoder/reconinter_enc.c b/av1/encoder/reconinter_enc.c
index b2aa880..b1e1645 100644
--- a/av1/encoder/reconinter_enc.c
+++ b/av1/encoder/reconinter_enc.c
@@ -73,7 +73,7 @@
     // block size
     const int b4_w = block_size_wide[bsize] >> ss_x;
     const int b4_h = block_size_high[bsize] >> ss_y;
-    const BLOCK_SIZE plane_bsize = get_scaled_plane_bsize(bsize, ss_x, ss_y);
+    const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, ss_x, ss_y);
     const int b8_w = block_size_wide[plane_bsize];
     const int b8_h = block_size_high[plane_bsize];
     assert(!is_compound);
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index 7389d4d..ade1bc0 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -211,7 +211,7 @@
     if (!is_chroma_reference(mi_row, mi_col, bsize, ss_x, ss_y)) {
       continue;
     }
-    const BLOCK_SIZE plane_bsize = get_scaled_plane_bsize(bsize, ss_x, ss_y);
+    const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, ss_x, ss_y);
     assert(plane_bsize < BLOCK_SIZES_ALL);
     const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
     const int mi_height = block_size_high[plane_bsize] >> tx_size_high_log2[0];