Fix bug in cb_pred_filter_search speed feature

Usage of InterpFilter and InterpFilters have been corrected
appropriately.

Change-Id: Id73032ddfa035f8cab35168d4c8ffd4952dad63b
diff --git a/av1/common/filter.h b/av1/common/filter.h
index 184f5b2..fa431fd 100644
--- a/av1/common/filter.h
+++ b/av1/common/filter.h
@@ -35,6 +35,7 @@
   SWITCHABLE_FILTERS = BILINEAR,
   SWITCHABLE = SWITCHABLE_FILTERS + 1, /* the last switchable one */
   EXTRA_FILTERS = INTERP_FILTERS_ALL - SWITCHABLE_FILTERS,
+  INTERP_INVALID = 0xff,
 } InterpFilter;
 
 enum {
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index c1afa8c..6ce45b5 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -8247,8 +8247,8 @@
 
 static INLINE int is_pred_filter_search_allowed(
     const AV1_COMP *const cpi, BLOCK_SIZE bsize, int mi_row, int mi_col,
-    InterpFilters af_horiz, InterpFilters af_vert, InterpFilters lf_horiz,
-    InterpFilters lf_vert) {
+    InterpFilter af_horiz, InterpFilter af_vert, InterpFilter lf_horiz,
+    InterpFilter lf_vert) {
   const AV1_COMMON *cm = &cpi->common;
   const int bsl = mi_size_wide_log2[bsize];
   int pred_filter_search =
@@ -8257,8 +8257,9 @@
              get_chessboard_index(cm->current_frame.frame_number)) &
                 0x1
           : 0;
-  pred_filter_search &= ((af_horiz == lf_horiz) && (af_horiz != SWITCHABLE)) ||
-                        ((af_vert == lf_vert) && (af_vert != SWITCHABLE));
+  pred_filter_search &=
+      ((af_horiz == lf_horiz) && (af_horiz != INTERP_INVALID)) ||
+      ((af_vert == lf_vert) && (af_vert != INTERP_INVALID));
   return pred_filter_search;
 }
 
@@ -8267,12 +8268,12 @@
     const TileDataEnc *tile_data, BLOCK_SIZE bsize, int mi_row, int mi_col,
     const BUFFER_SET *const orig_dst, int64_t *const rd,
     int *const switchable_rate, int *const skip_txfm_sb,
-    int64_t *const skip_sse_sb, const BUFFER_SET *dst_bufs[2],
-    InterpFilters filter_idx, const int switchable_ctx[2], const int skip_pred,
-    int *rate, int64_t *dist, InterpFilters af_horiz, InterpFilters af_vert,
-    InterpFilters lf_horiz, InterpFilters lf_vert) {
-  if ((af_horiz == lf_horiz) && (af_horiz != SWITCHABLE)) {
-    if (((af_vert == lf_vert) && (af_vert != SWITCHABLE))) {
+    int64_t *const skip_sse_sb, const BUFFER_SET *dst_bufs[2], int filter_idx,
+    const int switchable_ctx[2], const int skip_pred, int *rate, int64_t *dist,
+    InterpFilter af_horiz, InterpFilter af_vert, InterpFilter lf_horiz,
+    InterpFilter lf_vert) {
+  if ((af_horiz == lf_horiz) && (af_horiz != INTERP_INVALID)) {
+    if (((af_vert == lf_vert) && (af_vert != INTERP_INVALID))) {
       filter_idx = af_horiz + (af_vert * SWITCHABLE_FILTERS);
       if (filter_idx) {
         interpolation_filter_rd(x, cpi, tile_data, bsize, mi_row, mi_col,
@@ -8291,7 +8292,7 @@
         }
       }
     }
-  } else if ((af_vert == lf_vert) && (af_vert != SWITCHABLE)) {
+  } else if ((af_vert == lf_vert) && (af_vert != INTERP_INVALID)) {
     for (filter_idx = (af_vert * SWITCHABLE_FILTERS);
          filter_idx <= ((af_vert * SWITCHABLE_FILTERS) + 2); filter_idx += 1) {
       if (filter_idx) {
@@ -8323,20 +8324,21 @@
   assert(filter_set_size == DUAL_FILTER_SET_SIZE);
   if ((skip_hor & skip_ver) != cpi->default_interp_skip_flags) {
     int pred_filter_search;
-    InterpFilters af = SWITCHABLE, lf = SWITCHABLE, filter_idx = 0;
+    InterpFilter af_horiz = INTERP_INVALID, lf_horiz = INTERP_INVALID;
+    int filter_idx;
     const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
     const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
     if (above_mbmi && is_inter_block(above_mbmi)) {
-      af = above_mbmi->interp_filters;
+      af_horiz = av1_extract_interp_filter(above_mbmi->interp_filters, 1);
     }
     if (left_mbmi && is_inter_block(left_mbmi)) {
-      lf = left_mbmi->interp_filters;
+      lf_horiz = av1_extract_interp_filter(left_mbmi->interp_filters, 1);
     }
-    pred_filter_search = is_pred_filter_search_allowed(cpi, bsize, mi_row,
-                                                       mi_col, af, af, lf, lf);
+    pred_filter_search = is_pred_filter_search_allowed(
+        cpi, bsize, mi_row, mi_col, af_horiz, af_horiz, lf_horiz, lf_horiz);
     if (pred_filter_search) {
-      assert(af != SWITCHABLE);
-      filter_idx = SWITCHABLE * (af & 0xf);
+      assert(af_horiz != INTERP_INVALID);
+      filter_idx = SWITCHABLE * af_horiz;
       // This assert tells that (filter_x == filter_y) for non-dual filter case
       assert((filter_sets[filter_idx] & 0xffff) ==
              (filter_sets[filter_idx] >> 16));
@@ -8713,8 +8715,9 @@
     const int bh = block_size_high[bsize];
     int skip_pred;
     int pred_filter_search = 0;
-    InterpFilters af_horiz = SWITCHABLE, af_vert = SWITCHABLE,
-                  lf_horiz = SWITCHABLE, lf_vert = SWITCHABLE, filter_idx = 0;
+    InterpFilter af_horiz = INTERP_INVALID, af_vert = INTERP_INVALID,
+                 lf_horiz = INTERP_INVALID, lf_vert = INTERP_INVALID;
+    int filter_idx = 0;
     if (!have_newmv_in_inter_mode(mbmi->mode)) {
       const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
       const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;