Rework av1_has_right() and av1_has_bottom()

Replace the 4x4 block counting with minimum transform block size
counting. This retains identical coding statistics.

Change-Id: I13ce6b5b62641304b0ff1c6efd34c6a590195792
diff --git a/av1/common/reconintra.c b/av1/common/reconintra.c
index 97ce3b3..ed43909 100644
--- a/av1/common/reconintra.c
+++ b/av1/common/reconintra.c
@@ -237,8 +237,8 @@
                          PARTITION_TYPE partition,
 #endif
                          TX_SIZE txsz, int y, int x, int ss_x) {
-  const int wl = mi_width_log2_lookup[bsize];
-  const int w = AOMMAX(num_4x4_blocks_wide_lookup[bsize] >> ss_x, 1);
+  const int width = block_size_wide[bsize] >> tx_size_wide_log2[0];
+  const int w = AOMMAX(width >> ss_x, 1);
   const int step = tx_size_wide_unit[txsz];
 
   // TODO(bshacklett, huisu): Currently the RD loop traverses 4X8 blocks in
@@ -252,9 +252,10 @@
   if (!right_available) return 0;
 
   // Handle block size 4x8 and 4x4
-  if (ss_x == 0 && num_4x4_blocks_wide_lookup[bsize] < 2 && x == 0) return 1;
+  if (ss_x == 0 && width < 2 && x == 0) return 1;
 
   if (y == 0) {
+    const int wl = mi_width_log2_lookup[bsize];
     const int hl = mi_height_log2_lookup[bsize];
     const uint8_t *order;
     int my_order, tr_order;
@@ -298,13 +299,14 @@
   } else {
     const int wl = mi_width_log2_lookup[bsize];
     const int hl = mi_height_log2_lookup[bsize];
-    const int h = 1 << (hl + 1 - ss_y);
+    const int height = block_size_high[bsize] >> tx_size_high_log2[0];
+    const int h = AOMMAX(height >> ss_y, 1);
     const int step = tx_size_wide_unit[txsz];
     const uint8_t *order = orders[bsize];
     int my_order, bl_order;
 
     // Handle block size 8x4 and 4x4
-    if (ss_y == 0 && num_4x4_blocks_high_lookup[bsize] < 2 && y == 0) return 1;
+    if (ss_y == 0 && height < 2 && y == 0) return 1;
 
     if (y + step < h) return 1;