filter-intra: Support rectangular blocks.

- Use 'tx_size' in function signatures.
- filter_intra_taps_3 and filter_intra_taps_4 updated to support
  TX_SIZES_ALL (thanks to yuec@)

With these changes, filter-intra works correctly with rect-intra-pred.
So, we remove the temporary workaround for this.

Change-Id: Ide0f593419c21a74c08c61859f8dad918ca169fa
diff --git a/av1/common/av1_rtcd_defs.pl b/av1/common/av1_rtcd_defs.pl
index 4020e10..88e9ea4 100755
--- a/av1/common/av1_rtcd_defs.pl
+++ b/av1/common/av1_rtcd_defs.pl
@@ -173,28 +173,28 @@
 
 # FILTER_INTRA predictor functions
 if (aom_config("CONFIG_FILTER_INTRA") eq "yes") {
-  add_proto qw/void av1_dc_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
-  add_proto qw/void av1_v_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
-  add_proto qw/void av1_h_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
-  add_proto qw/void av1_d45_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
-  add_proto qw/void av1_d135_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
-  add_proto qw/void av1_d117_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
-  add_proto qw/void av1_d153_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
-  add_proto qw/void av1_d207_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
-  add_proto qw/void av1_d63_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
-  add_proto qw/void av1_tm_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_dc_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_v_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_h_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_d45_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_d135_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_d117_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_d153_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_d207_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_d63_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
+  add_proto qw/void av1_tm_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left";
   # High bitdepth functions
   if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
-    add_proto qw/void av1_highbd_dc_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
-    add_proto qw/void av1_highbd_v_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
-    add_proto qw/void av1_highbd_h_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
-    add_proto qw/void av1_highbd_d45_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
-    add_proto qw/void av1_highbd_d135_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
-    add_proto qw/void av1_highbd_d117_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
-    add_proto qw/void av1_highbd_d153_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
-    add_proto qw/void av1_highbd_d207_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
-    add_proto qw/void av1_highbd_d63_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
-    add_proto qw/void av1_highbd_tm_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_dc_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_v_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_h_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_d45_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_d135_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_d117_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_d153_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_d207_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_d63_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
+    add_proto qw/void av1_highbd_tm_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint16_t *above, const uint16_t *left, int bd";
   }
 }
 
diff --git a/av1/common/reconintra.c b/av1/common/reconintra.c
index 4d91aed..6f62902 100644
--- a/av1/common/reconintra.c
+++ b/av1/common/reconintra.c
@@ -1377,7 +1377,7 @@
 
 #if CONFIG_FILTER_INTRA
 #if USE_3TAP_INTRA_FILTER
-static int filter_intra_taps_3[TX_SIZES][FILTER_INTRA_MODES][3] = {
+static int filter_intra_taps_3[TX_SIZES_ALL][FILTER_INTRA_MODES][3] = {
 #if CONFIG_CHROMA_2X2
   {
       { 697, 836, -509 },
@@ -1454,9 +1454,129 @@
       { 846, 1010, -832 },
   },
 #endif  // CONFIG_TX64X64
+  {
+      { 697, 836, -509 },
+      { 993, 513, -482 },
+      { 381, 984, -341 },
+      { 642, 1169, -787 },
+      { 590, 553, -119 },
+      { 762, 385, -123 },
+      { 358, 687, -21 },
+      { 411, 1083, -470 },
+      { 912, 814, -702 },
+      { 883, 902, -761 },
+  },
+  {
+      { 697, 836, -509 },
+      { 993, 513, -482 },
+      { 381, 984, -341 },
+      { 642, 1169, -787 },
+      { 590, 553, -119 },
+      { 762, 385, -123 },
+      { 358, 687, -21 },
+      { 411, 1083, -470 },
+      { 912, 814, -702 },
+      { 883, 902, -761 },
+  },
+  {
+      { 659, 816, -451 },
+      { 980, 625, -581 },
+      { 558, 962, -496 },
+      { 681, 888, -545 },
+      { 591, 613, 180 },
+      { 778, 399, -153 },
+      { 495, 641, -112 },
+      { 671, 937, -584 },
+      { 745, 940, -661 },
+      { 839, 911, -726 },
+  },
+  {
+      { 659, 816, -451 },
+      { 980, 625, -581 },
+      { 558, 962, -496 },
+      { 681, 888, -545 },
+      { 591, 613, 180 },
+      { 778, 399, -153 },
+      { 495, 641, -112 },
+      { 671, 937, -584 },
+      { 745, 940, -661 },
+      { 839, 911, -726 },
+  },
+  {
+      { 539, 927, -442 },
+      { 1003, 714, -693 },
+      { 349, 1271, -596 },
+      { 820, 764, -560 },
+      { 524, 816, -316 },
+      { 780, 681, -437 },
+      { 586, 795, -357 },
+      { 551, 1135, -663 },
+      { 593, 1061, -630 },
+      { 974, 970, -920 },
+  },
+  {
+      { 539, 927, -442 },
+      { 1003, 714, -693 },
+      { 349, 1271, -596 },
+      { 820, 764, -560 },
+      { 524, 816, -316 },
+      { 780, 681, -437 },
+      { 586, 795, -357 },
+      { 551, 1135, -663 },
+      { 593, 1061, -630 },
+      { 974, 970, -920 },
+  },
+  {
+      { 697, 836, -509 },
+      { 993, 513, -482 },
+      { 381, 984, -341 },
+      { 642, 1169, -787 },
+      { 590, 553, -119 },
+      { 762, 385, -123 },
+      { 358, 687, -21 },
+      { 411, 1083, -470 },
+      { 912, 814, -702 },
+      { 883, 902, -761 },
+  },
+  {
+      { 697, 836, -509 },
+      { 993, 513, -482 },
+      { 381, 984, -341 },
+      { 642, 1169, -787 },
+      { 590, 553, -119 },
+      { 762, 385, -123 },
+      { 358, 687, -21 },
+      { 411, 1083, -470 },
+      { 912, 814, -702 },
+      { 883, 902, -761 },
+  },
+  {
+      { 659, 816, -451 },
+      { 980, 625, -581 },
+      { 558, 962, -496 },
+      { 681, 888, -545 },
+      { 591, 613, 180 },
+      { 778, 399, -153 },
+      { 495, 641, -112 },
+      { 671, 937, -584 },
+      { 745, 940, -661 },
+      { 839, 911, -726 },
+  },
+  {
+      { 659, 816, -451 },
+      { 980, 625, -581 },
+      { 558, 962, -496 },
+      { 681, 888, -545 },
+      { 591, 613, 180 },
+      { 778, 399, -153 },
+      { 495, 641, -112 },
+      { 671, 937, -584 },
+      { 745, 940, -661 },
+      { 839, 911, -726 },
+  }
 };
 #else
-static int filter_intra_taps_4[TX_SIZES][FILTER_INTRA_MODES][4] = {
+static int filter_intra_taps_4[TX_SIZES_ALL][FILTER_INTRA_MODES][4] = {
 #if CONFIG_CHROMA_2X2
   {
       { 735, 881, -537, -54 },
@@ -1533,232 +1653,369 @@
       { 740, 884, -728, 77 },
   },
 #endif  // CONFIG_TX64X64
+  {
+      { 735, 881, -537, -54 },
+      { 1005, 519, -488, -11 },
+      { 383, 990, -343, -6 },
+      { 442, 805, -542, 319 },
+      { 658, 616, -133, -116 },
+      { 875, 442, -141, -151 },
+      { 386, 741, -23, -80 },
+      { 390, 1027, -446, 51 },
+      { 679, 606, -523, 262 },
+      { 903, 922, -778, -23 },
+  },
+  {
+      { 735, 881, -537, -54 },
+      { 1005, 519, -488, -11 },
+      { 383, 990, -343, -6 },
+      { 442, 805, -542, 319 },
+      { 658, 616, -133, -116 },
+      { 875, 442, -141, -151 },
+      { 386, 741, -23, -80 },
+      { 390, 1027, -446, 51 },
+      { 679, 606, -523, 262 },
+      { 903, 922, -778, -23 },
+  },
+  {
+      { 648, 803, -444, 16 },
+      { 972, 620, -576, 7 },
+      { 561, 967, -499, -5 },
+      { 585, 762, -468, 144 },
+      { 596, 619, -182, -9 },
+      { 895, 459, -176, -153 },
+      { 557, 722, -126, -129 },
+      { 601, 839, -523, 105 },
+      { 562, 709, -499, 251 },
+      { 803, 872, -695, 43 },
+  },
+  {
+      { 648, 803, -444, 16 },
+      { 972, 620, -576, 7 },
+      { 561, 967, -499, -5 },
+      { 585, 762, -468, 144 },
+      { 596, 619, -182, -9 },
+      { 895, 459, -176, -153 },
+      { 557, 722, -126, -129 },
+      { 601, 839, -523, 105 },
+      { 562, 709, -499, 251 },
+      { 803, 872, -695, 43 },
+  },
+  {
+      { 423, 728, -347, 111 },
+      { 963, 685, -665, 23 },
+      { 281, 1024, -480, 216 },
+      { 640, 596, -437, 78 },
+      { 429, 669, -259, 99 },
+      { 740, 646, -415, 23 },
+      { 568, 771, -346, 40 },
+      { 404, 833, -486, 209 },
+      { 398, 712, -423, 307 },
+      { 939, 935, -887, 17 },
+  },
+  {
+      { 423, 728, -347, 111 },
+      { 963, 685, -665, 23 },
+      { 281, 1024, -480, 216 },
+      { 640, 596, -437, 78 },
+      { 429, 669, -259, 99 },
+      { 740, 646, -415, 23 },
+      { 568, 771, -346, 40 },
+      { 404, 833, -486, 209 },
+      { 398, 712, -423, 307 },
+      { 939, 935, -887, 17 },
+  },
+  {
+      { 735, 881, -537, -54 },
+      { 1005, 519, -488, -11 },
+      { 383, 990, -343, -6 },
+      { 442, 805, -542, 319 },
+      { 658, 616, -133, -116 },
+      { 875, 442, -141, -151 },
+      { 386, 741, -23, -80 },
+      { 390, 1027, -446, 51 },
+      { 679, 606, -523, 262 },
+      { 903, 922, -778, -23 },
+  },
+  {
+      { 735, 881, -537, -54 },
+      { 1005, 519, -488, -11 },
+      { 383, 990, -343, -6 },
+      { 442, 805, -542, 319 },
+      { 658, 616, -133, -116 },
+      { 875, 442, -141, -151 },
+      { 386, 741, -23, -80 },
+      { 390, 1027, -446, 51 },
+      { 679, 606, -523, 262 },
+      { 903, 922, -778, -23 },
+  },
+  {
+      { 648, 803, -444, 16 },
+      { 972, 620, -576, 7 },
+      { 561, 967, -499, -5 },
+      { 585, 762, -468, 144 },
+      { 596, 619, -182, -9 },
+      { 895, 459, -176, -153 },
+      { 557, 722, -126, -129 },
+      { 601, 839, -523, 105 },
+      { 562, 709, -499, 251 },
+      { 803, 872, -695, 43 },
+  },
+  {
+      { 648, 803, -444, 16 },
+      { 972, 620, -576, 7 },
+      { 561, 967, -499, -5 },
+      { 585, 762, -468, 144 },
+      { 596, 619, -182, -9 },
+      { 895, 459, -176, -153 },
+      { 557, 722, -126, -129 },
+      { 601, 839, -523, 105 },
+      { 562, 709, -499, 251 },
+      { 803, 872, -695, 43 },
+  }
 };
 #endif
 
-static INLINE TX_SIZE get_txsize_from_blocklen(int bs) {
-  switch (bs) {
-    case 4: return TX_4X4;
-    case 8: return TX_8X8;
-    case 16: return TX_16X16;
-    case 32: return TX_32X32;
-#if CONFIG_TX64X64
-    case 64: return TX_64X64;
-#endif  // CONFIG_TX64X64
-    default: assert(0); return TX_INVALID;
-  }
-}
-
 #if USE_3TAP_INTRA_FILTER
-static void filter_intra_predictors_3tap(uint8_t *dst, ptrdiff_t stride, int bs,
-                                         const uint8_t *above,
+static void filter_intra_predictors_3tap(uint8_t *dst, ptrdiff_t stride,
+                                         TX_SIZE tx_size, const uint8_t *above,
                                          const uint8_t *left, int mode) {
-  int k, r, c;
+  int r, c;
   int mean, ipred;
 #if CONFIG_TX64X64
   int buffer[65][65];
 #else
   int buffer[33][33];
 #endif  // CONFIG_TX64X64
-  const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
   const int c0 = filter_intra_taps_3[tx_size][mode][0];
   const int c1 = filter_intra_taps_3[tx_size][mode][1];
   const int c2 = filter_intra_taps_3[tx_size][mode][2];
+  const int bw = tx_size_wide[tx_size];
+  const int bh = tx_size_high[tx_size];
 
-  k = 0;
   mean = 0;
-  while (k < bs) {
-    mean = mean + (int)left[k];
-    mean = mean + (int)above[k];
-    k++;
+  for (r = 0; r < bh; ++r) {
+    mean += (int)left[r];
   }
-  mean = (mean + bs) / (2 * bs);
+  for (c = 0; c < bw; ++c) {
+    mean += (int)above[c];
+  }
+  mean = (mean + ((bw + bh) >> 1)) / (bw + bh);
 
-  for (r = 0; r < bs; ++r) buffer[r + 1][0] = (int)left[r] - mean;
+  for (r = 0; r < bh; ++r) buffer[r + 1][0] = (int)left[r] - mean;
 
-  for (c = 0; c < bs + 1; ++c) buffer[0][c] = (int)above[c - 1] - mean;
+  for (c = 0; c < bw + 1; ++c) buffer[0][c] = (int)above[c - 1] - mean;
 
-  for (r = 1; r < bs + 1; ++r)
-    for (c = 1; c < bs + 1; ++c) {
+  for (r = 1; r < bh + 1; ++r)
+    for (c = 1; c < bw + 1; ++c) {
       ipred = c0 * buffer[r - 1][c] + c1 * buffer[r][c - 1] +
               c2 * buffer[r - 1][c - 1];
       buffer[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
       buffer[r][c] = clip_pixel(buffer[r][c] + mean) - mean;
     }
 
-  for (r = 0; r < bs; ++r) {
-    for (c = 0; c < bs; ++c) dst[c] = clip_pixel(buffer[r + 1][c + 1] + mean);
+  for (r = 0; r < bh; ++r) {
+    for (c = 0; c < bw; ++c) {
+      dst[c] = clip_pixel(buffer[r + 1][c + 1] + mean);
+    }
     dst += stride;
   }
 }
 #else
-static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride, int bs,
-                                         const uint8_t *above,
+static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride,
+                                         TX_SIZE tx_size, const uint8_t *above,
                                          const uint8_t *left, int mode) {
-  int k, r, c;
+  int r, c;
   int mean, ipred;
 #if CONFIG_TX64X64
   int buffer[65][129];
 #else
   int buffer[33][65];
 #endif  // CONFIG_TX64X64
-  const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
   const int c0 = filter_intra_taps_4[tx_size][mode][0];
   const int c1 = filter_intra_taps_4[tx_size][mode][1];
   const int c2 = filter_intra_taps_4[tx_size][mode][2];
   const int c3 = filter_intra_taps_4[tx_size][mode][3];
+  const int bw = tx_size_wide[tx_size];
+  const int bh = tx_size_high[tx_size];
 
-  k = 0;
   mean = 0;
-  while (k < bs) {
-    mean = mean + (int)left[k];
-    mean = mean + (int)above[k];
-    k++;
+  for (r = 0; r < bh; ++r) {
+    mean += (int)left[r];
   }
-  mean = (mean + bs) / (2 * bs);
+  for (c = 0; c < bw; ++c) {
+    mean += (int)above[c];
+  }
+  mean = (mean + ((bw + bh) >> 1)) / (bw + bh);
 
-  for (r = 0; r < bs; ++r) buffer[r + 1][0] = (int)left[r] - mean;
+  for (r = 0; r < bh; ++r) buffer[r + 1][0] = (int)left[r] - mean;
 
-  for (c = 0; c < 2 * bs + 1; ++c) buffer[0][c] = (int)above[c - 1] - mean;
+  for (c = 0; c < 2 * bw + 1; ++c) buffer[0][c] = (int)above[c - 1] - mean;
 
-  for (r = 1; r < bs + 1; ++r)
-    for (c = 1; c < 2 * bs + 1 - r; ++c) {
+  for (r = 1; r < bh + 1; ++r)
+    for (c = 1; c < 2 * bw + 1 - r; ++c) {
       ipred = c0 * buffer[r - 1][c] + c1 * buffer[r][c - 1] +
               c2 * buffer[r - 1][c - 1] + c3 * buffer[r - 1][c + 1];
       buffer[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
       buffer[r][c] = clip_pixel(buffer[r][c] + mean) - mean;
     }
 
-  for (r = 0; r < bs; ++r) {
-    for (c = 0; c < bs; ++c) dst[c] = clip_pixel(buffer[r + 1][c + 1] + mean);
+  for (r = 0; r < bh; ++r) {
+    for (c = 0; c < bw; ++c) {
+      dst[c] = clip_pixel(buffer[r + 1][c + 1] + mean);
+    }
     dst += stride;
   }
 }
 #endif
 
-void av1_dc_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
+void av1_dc_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
                                const uint8_t *above, const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_DC_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_DC_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_DC_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_DC_PRED);
 #endif
 }
 
-void av1_v_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
+void av1_v_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
                               const uint8_t *above, const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_V_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_V_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_V_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_V_PRED);
 #endif
 }
 
-void av1_h_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
+void av1_h_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
                               const uint8_t *above, const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_H_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_H_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_H_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_H_PRED);
 #endif
 }
 
-void av1_d45_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
+void av1_d45_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
                                 const uint8_t *above, const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D45_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_D45_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D45_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_D45_PRED);
 #endif
 }
 
-void av1_d135_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
-                                 const uint8_t *above, const uint8_t *left) {
+void av1_d135_filter_predictor_c(uint8_t *dst, ptrdiff_t stride,
+                                 TX_SIZE tx_size, const uint8_t *above,
+                                 const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D135_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_D135_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D135_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_D135_PRED);
 #endif
 }
 
-void av1_d117_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
-                                 const uint8_t *above, const uint8_t *left) {
+void av1_d117_filter_predictor_c(uint8_t *dst, ptrdiff_t stride,
+                                 TX_SIZE tx_size, const uint8_t *above,
+                                 const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D117_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_D117_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D117_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_D117_PRED);
 #endif
 }
 
-void av1_d153_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
-                                 const uint8_t *above, const uint8_t *left) {
+void av1_d153_filter_predictor_c(uint8_t *dst, ptrdiff_t stride,
+                                 TX_SIZE tx_size, const uint8_t *above,
+                                 const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D153_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_D153_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D153_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_D153_PRED);
 #endif
 }
 
-void av1_d207_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
-                                 const uint8_t *above, const uint8_t *left) {
+void av1_d207_filter_predictor_c(uint8_t *dst, ptrdiff_t stride,
+                                 TX_SIZE tx_size, const uint8_t *above,
+                                 const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D207_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_D207_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D207_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_D207_PRED);
 #endif
 }
 
-void av1_d63_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
+void av1_d63_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
                                 const uint8_t *above, const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_D63_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_D63_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_D63_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_D63_PRED);
 #endif
 }
 
-void av1_tm_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, int bs,
+void av1_tm_filter_predictor_c(uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size,
                                const uint8_t *above, const uint8_t *left) {
 #if USE_3TAP_INTRA_FILTER
-  filter_intra_predictors_3tap(dst, stride, bs, above, left, FILTER_TM_PRED);
+  filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
+                               FILTER_TM_PRED);
 #else
-  filter_intra_predictors_4tap(dst, stride, bs, above, left, FILTER_TM_PRED);
+  filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
+                               FILTER_TM_PRED);
 #endif
 }
 
 static void filter_intra_predictors(FILTER_INTRA_MODE mode, uint8_t *dst,
-                                    ptrdiff_t stride, int bs,
+                                    ptrdiff_t stride, TX_SIZE tx_size,
                                     const uint8_t *above, const uint8_t *left) {
   switch (mode) {
     case FILTER_DC_PRED:
-      av1_dc_filter_predictor(dst, stride, bs, above, left);
+      av1_dc_filter_predictor(dst, stride, tx_size, above, left);
       break;
     case FILTER_V_PRED:
-      av1_v_filter_predictor(dst, stride, bs, above, left);
+      av1_v_filter_predictor(dst, stride, tx_size, above, left);
       break;
     case FILTER_H_PRED:
-      av1_h_filter_predictor(dst, stride, bs, above, left);
+      av1_h_filter_predictor(dst, stride, tx_size, above, left);
       break;
     case FILTER_D45_PRED:
-      av1_d45_filter_predictor(dst, stride, bs, above, left);
+      av1_d45_filter_predictor(dst, stride, tx_size, above, left);
       break;
     case FILTER_D135_PRED:
-      av1_d135_filter_predictor(dst, stride, bs, above, left);
+      av1_d135_filter_predictor(dst, stride, tx_size, above, left);
       break;
     case FILTER_D117_PRED:
-      av1_d117_filter_predictor(dst, stride, bs, above, left);
+      av1_d117_filter_predictor(dst, stride, tx_size, above, left);
       break;
     case FILTER_D153_PRED:
-      av1_d153_filter_predictor(dst, stride, bs, above, left);
+      av1_d153_filter_predictor(dst, stride, tx_size, above, left);
       break;
     case FILTER_D207_PRED:
-      av1_d207_filter_predictor(dst, stride, bs, above, left);
+      av1_d207_filter_predictor(dst, stride, tx_size, above, left);
       break;
     case FILTER_D63_PRED:
-      av1_d63_filter_predictor(dst, stride, bs, above, left);
+      av1_d63_filter_predictor(dst, stride, tx_size, above, left);
       break;
     case FILTER_TM_PRED:
-      av1_tm_filter_predictor(dst, stride, bs, above, left);
+      av1_tm_filter_predictor(dst, stride, tx_size, above, left);
       break;
     default: assert(0);
   }
@@ -1766,249 +2023,256 @@
 #if CONFIG_HIGHBITDEPTH
 #if USE_3TAP_INTRA_FILTER
 static void highbd_filter_intra_predictors_3tap(uint16_t *dst, ptrdiff_t stride,
-                                                int bs, const uint16_t *above,
+                                                TX_SIZE tx_size,
+                                                const uint16_t *above,
                                                 const uint16_t *left, int mode,
                                                 int bd) {
-  int k, r, c;
+  int r, c;
   int mean, ipred;
 #if CONFIG_TX64X64
   int preds[65][65];
 #else
   int preds[33][33];
 #endif  // CONFIG_TX64X64
-  const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
   const int c0 = filter_intra_taps_3[tx_size][mode][0];
   const int c1 = filter_intra_taps_3[tx_size][mode][1];
   const int c2 = filter_intra_taps_3[tx_size][mode][2];
+  const int bw = tx_size_wide[tx_size];
+  const int bh = tx_size_high[tx_size];
 
-  k = 0;
   mean = 0;
-  while (k < bs) {
-    mean = mean + (int)left[k];
-    mean = mean + (int)above[k];
-    k++;
+  for (r = 0; r < bh; ++r) {
+    mean += (int)left[r];
   }
-  mean = (mean + bs) / (2 * bs);
+  for (c = 0; c < bw; ++c) {
+    mean += (int)above[c];
+  }
+  mean = (mean + ((bw + bh) >> 1)) / (bw + bh);
 
-  for (r = 0; r < bs; ++r) preds[r + 1][0] = (int)left[r] - mean;
+  for (r = 0; r < bh; ++r) preds[r + 1][0] = (int)left[r] - mean;
 
-  for (c = 0; c < bs + 1; ++c) preds[0][c] = (int)above[c - 1] - mean;
+  for (c = 0; c < bw + 1; ++c) preds[0][c] = (int)above[c - 1] - mean;
 
-  for (r = 1; r < bs + 1; ++r)
-    for (c = 1; c < bs + 1; ++c) {
+  for (r = 1; r < bh + 1; ++r)
+    for (c = 1; c < bw + 1; ++c) {
       ipred = c0 * preds[r - 1][c] + c1 * preds[r][c - 1] +
               c2 * preds[r - 1][c - 1];
       preds[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
       preds[r][c] = clip_pixel_highbd(preds[r][c] + mean, bd) - mean;
     }
 
-  for (r = 0; r < bs; ++r) {
-    for (c = 0; c < bs; ++c)
+  for (r = 0; r < bh; ++r) {
+    for (c = 0; c < bw; ++c) {
       dst[c] = clip_pixel_highbd(preds[r + 1][c + 1] + mean, bd);
+    }
     dst += stride;
   }
 }
 #else
 static void highbd_filter_intra_predictors_4tap(uint16_t *dst, ptrdiff_t stride,
-                                                int bs, const uint16_t *above,
+                                                TX_SIZE tx_size,
+                                                const uint16_t *above,
                                                 const uint16_t *left, int mode,
                                                 int bd) {
-  int k, r, c;
+  int r, c;
   int mean, ipred;
 #if CONFIG_TX64X64
   int preds[65][129];
 #else
   int preds[33][65];
 #endif  // CONFIG_TX64X64
-  const TX_SIZE tx_size = get_txsize_from_blocklen(bs);
   const int c0 = filter_intra_taps_4[tx_size][mode][0];
   const int c1 = filter_intra_taps_4[tx_size][mode][1];
   const int c2 = filter_intra_taps_4[tx_size][mode][2];
   const int c3 = filter_intra_taps_4[tx_size][mode][3];
+  const int bw = tx_size_wide[tx_size];
+  const int bh = tx_size_high[tx_size];
 
-  k = 0;
   mean = 0;
-  while (k < bs) {
-    mean = mean + (int)left[k];
-    mean = mean + (int)above[k];
-    k++;
+  for (r = 0; r < bh; ++r) {
+    mean += (int)left[r];
   }
-  mean = (mean + bs) / (2 * bs);
+  for (c = 0; c < bw; ++c) {
+    mean += (int)above[c];
+  }
+  mean = (mean + ((bw + bh) >> 1)) / (bw + bh);
 
-  for (r = 0; r < bs; ++r) preds[r + 1][0] = (int)left[r] - mean;
+  for (r = 0; r < bh; ++r) preds[r + 1][0] = (int)left[r] - mean;
 
-  for (c = 0; c < 2 * bs + 1; ++c) preds[0][c] = (int)above[c - 1] - mean;
+  for (c = 0; c < 2 * bw + 1; ++c) preds[0][c] = (int)above[c - 1] - mean;
 
-  for (r = 1; r < bs + 1; ++r)
-    for (c = 1; c < 2 * bs + 1 - r; ++c) {
+  for (r = 1; r < bh + 1; ++r)
+    for (c = 1; c < 2 * bw + 1 - r; ++c) {
       ipred = c0 * preds[r - 1][c] + c1 * preds[r][c - 1] +
               c2 * preds[r - 1][c - 1] + c3 * preds[r - 1][c + 1];
       preds[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
       preds[r][c] = clip_pixel_highbd(preds[r][c] + mean, bd) - mean;
     }
 
-  for (r = 0; r < bs; ++r) {
-    for (c = 0; c < bs; ++c)
+  for (r = 0; r < bh; ++r) {
+    for (c = 0; c < bw; ++c) {
       dst[c] = clip_pixel_highbd(preds[r + 1][c + 1] + mean, bd);
+    }
     dst += stride;
   }
 }
 #endif
 
-void av1_highbd_dc_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                      const uint16_t *above,
+void av1_highbd_dc_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                      TX_SIZE tx_size, const uint16_t *above,
                                       const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_DC_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_DC_PRED, bd);
 #endif
 }
 
-void av1_highbd_v_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                     const uint16_t *above,
+void av1_highbd_v_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                     TX_SIZE tx_size, const uint16_t *above,
                                      const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_V_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_V_PRED, bd);
 #endif
 }
 
-void av1_highbd_h_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                     const uint16_t *above,
+void av1_highbd_h_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                     TX_SIZE tx_size, const uint16_t *above,
                                      const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_H_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_H_PRED, bd);
 #endif
 }
 
-void av1_highbd_d45_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                       const uint16_t *above,
+void av1_highbd_d45_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                       TX_SIZE tx_size, const uint16_t *above,
                                        const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_D45_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_D45_PRED, bd);
 #endif
 }
 
-void av1_highbd_d135_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                        const uint16_t *above,
+void av1_highbd_d135_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                        TX_SIZE tx_size, const uint16_t *above,
                                         const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_D135_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_D135_PRED, bd);
 #endif
 }
 
-void av1_highbd_d117_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                        const uint16_t *above,
+void av1_highbd_d117_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                        TX_SIZE tx_size, const uint16_t *above,
                                         const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_D117_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_D117_PRED, bd);
 #endif
 }
 
-void av1_highbd_d153_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                        const uint16_t *above,
+void av1_highbd_d153_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                        TX_SIZE tx_size, const uint16_t *above,
                                         const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_D153_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_D153_PRED, bd);
 #endif
 }
 
-void av1_highbd_d207_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                        const uint16_t *above,
+void av1_highbd_d207_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                        TX_SIZE tx_size, const uint16_t *above,
                                         const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_D207_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_D207_PRED, bd);
 #endif
 }
 
-void av1_highbd_d63_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                       const uint16_t *above,
+void av1_highbd_d63_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                       TX_SIZE tx_size, const uint16_t *above,
                                        const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_D63_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_D63_PRED, bd);
 #endif
 }
 
-void av1_highbd_tm_filter_predictor_c(uint16_t *dst, ptrdiff_t stride, int bs,
-                                      const uint16_t *above,
+void av1_highbd_tm_filter_predictor_c(uint16_t *dst, ptrdiff_t stride,
+                                      TX_SIZE tx_size, const uint16_t *above,
                                       const uint16_t *left, int bd) {
 #if USE_3TAP_INTRA_FILTER
-  highbd_filter_intra_predictors_3tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_3tap(dst, stride, tx_size, above, left,
                                       FILTER_TM_PRED, bd);
 #else
-  highbd_filter_intra_predictors_4tap(dst, stride, bs, above, left,
+  highbd_filter_intra_predictors_4tap(dst, stride, tx_size, above, left,
                                       FILTER_TM_PRED, bd);
 #endif
 }
 
 static void highbd_filter_intra_predictors(FILTER_INTRA_MODE mode,
                                            uint16_t *dst, ptrdiff_t stride,
-                                           int bs, const uint16_t *above,
+                                           TX_SIZE tx_size,
+                                           const uint16_t *above,
                                            const uint16_t *left, int bd) {
   switch (mode) {
     case FILTER_DC_PRED:
-      av1_highbd_dc_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_dc_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     case FILTER_V_PRED:
-      av1_highbd_v_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_v_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     case FILTER_H_PRED:
-      av1_highbd_h_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_h_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     case FILTER_D45_PRED:
-      av1_highbd_d45_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_d45_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     case FILTER_D135_PRED:
-      av1_highbd_d135_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_d135_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     case FILTER_D117_PRED:
-      av1_highbd_d117_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_d117_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     case FILTER_D153_PRED:
-      av1_highbd_d153_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_d153_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     case FILTER_D207_PRED:
-      av1_highbd_d207_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_d207_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     case FILTER_D63_PRED:
-      av1_highbd_d63_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_d63_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     case FILTER_TM_PRED:
-      av1_highbd_tm_filter_predictor(dst, stride, bs, above, left, bd);
+      av1_highbd_tm_filter_predictor(dst, stride, tx_size, above, left, bd);
       break;
     default: assert(0);
   }
@@ -2347,8 +2611,7 @@
 
 #if CONFIG_FILTER_INTRA
   if (filter_intra_mode_info->use_filter_intra_mode[plane != 0]) {
-    // TODO(huisu): Make these work with rectangular blocks.
-    highbd_filter_intra_predictors(filter_intra_mode, dst, dst_stride, txwpx,
+    highbd_filter_intra_predictors(filter_intra_mode, dst, dst_stride, tx_size,
                                    above_row, left_col, xd->bd);
     return;
   }
@@ -2592,8 +2855,7 @@
 
 #if CONFIG_FILTER_INTRA
   if (filter_intra_mode_info->use_filter_intra_mode[plane != 0]) {
-    // TODO(huisu): Make these work with rectangular blocks.
-    filter_intra_predictors(filter_intra_mode, dst, dst_stride, txwpx,
+    filter_intra_predictors(filter_intra_mode, dst, dst_stride, tx_size,
                             above_row, left_col);
     return;
   }
diff --git a/configure b/configure
index 0081a8f..f8191b9 100755
--- a/configure
+++ b/configure
@@ -552,9 +552,6 @@
     enabled ext_comp_refs && enable_feature var_refs
     enabled ext_comp_refs && disable_feature one_sided_compound
     enabled altref2 && enable_feature ext_refs
-    # TODO(urvang): Temporary work-around for nightly tests.
-    # Need to support different width/height in filter-intra functions.
-    enabled filter_intra && disable_feature rect_intra_pred
 
     if ! enabled delta_q && enabled ext_delta_q; then
       log_echo "ext_delta_q requires delta_q, so disabling ext_delta_q"