Remove experiment speed_refs

Change-Id: Ie4e2f04a6fa27480e500469a0d822e539b7cb066
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 08f4cb6..43d9372 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -2218,11 +2218,6 @@
 
   if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
 
-#if CONFIG_SPEED_REFS
-  // First scanning pass of an SB is dry run only.
-  if (cpi->sb_scanning_pass_idx == 0) assert(dry_run == DRY_RUN_NORMAL);
-#endif  // CONFIG_SPEED_REFS
-
   if (!dry_run && ctx >= 0) td->counts->partition[ctx][partition]++;
 
 #if CONFIG_SUPERTX
@@ -3726,17 +3721,6 @@
   }
 #endif
 
-#if CONFIG_SPEED_REFS
-  if (cpi->sb_scanning_pass_idx == 0) {
-    // NOTE: For the 1st pass of scanning, check all the subblocks of equal size
-    //       only.
-    partition_none_allowed = (bsize == MIN_SPEED_REFS_BLKSIZE);
-    partition_horz_allowed = 0;
-    partition_vert_allowed = 0;
-    do_square_split = (bsize > MIN_SPEED_REFS_BLKSIZE);
-  }
-#endif  // CONFIG_SPEED_REFS
-
   // PARTITION_NONE
   if (partition_none_allowed) {
     rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &this_rdc,
@@ -4573,11 +4557,6 @@
   }
 #endif  // CONFIG_EXT_PARTITION_TYPES
 
-#if CONFIG_SPEED_REFS
-  // First scanning is done.
-  if (cpi->sb_scanning_pass_idx == 0 && bsize == cm->sb_size) return;
-#endif  // CONFIG_SPEED_REFS
-
   // TODO(jbb): This code added so that we avoid static analysis
   // warning related to the fact that best_rd isn't used after this
   // point.  This code should be refactored so that the duplicate
@@ -4630,22 +4609,6 @@
   }
 }
 
-#if CONFIG_SPEED_REFS
-static void restore_mi(const AV1_COMP *const cpi, MACROBLOCK *const x,
-                       int mi_row, int mi_col) {
-  const AV1_COMMON *cm = &cpi->common;
-  MACROBLOCKD *const xd = &x->e_mbd;
-  set_mode_info_offsets(cpi, x, xd, mi_row, mi_col);
-  int x_idx, y;
-  for (y = 0; y < mi_size_high[cm->sb_size]; y++)
-    for (x_idx = 0; x_idx < mi_size_wide[cm->sb_size]; x_idx++)
-      if (mi_col + x_idx < cm->mi_cols && mi_row + y < cm->mi_rows) {
-        memset(xd->mi + y * cm->mi_stride + x_idx, 0, sizeof(*xd->mi));
-        memset(x->mbmi_ext + y * cm->mi_cols + x_idx, 0, sizeof(*x->mbmi_ext));
-      }
-}
-#endif  // CONFIG_SPEED_REFS
-
 static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
                              TileDataEnc *tile_data, int mi_row,
                              TOKENEXTRA **tp) {
@@ -4802,35 +4765,12 @@
         rd_auto_partition_range(cpi, tile_info, xd, mi_row, mi_col,
                                 &x->min_partition_size, &x->max_partition_size);
       }
-#if CONFIG_SPEED_REFS
-      // NOTE: Two scanning passes for the current superblock - the first pass
-      //       is only targeted to collect stats.
-      int m_search_count_backup = *(x->m_search_count_ptr);
-      for (int sb_pass_idx = 0; sb_pass_idx < 2; ++sb_pass_idx) {
-        cpi->sb_scanning_pass_idx = sb_pass_idx;
-        if (frame_is_intra_only(cm) && sb_pass_idx == 0) continue;
-
-        rd_pick_partition(cpi, td, tile_data, tp, mi_row, mi_col, cm->sb_size,
-                          &dummy_rdc,
-#if CONFIG_SUPERTX
-                          &dummy_rate_nocoef,
-#endif  // CONFIG_SUPERTX
-                          INT64_MAX, pc_root);
-        if (sb_pass_idx == 0) {
-          av1_zero(x->pred_mv);
-          pc_root->index = 0;
-          restore_mi(cpi, x, mi_row, mi_col);
-          *(x->m_search_count_ptr) = m_search_count_backup;
-        }
-      }
-#else  // !CONFIG_SPEED_REFS
       rd_pick_partition(cpi, td, tile_data, tp, mi_row, mi_col, cm->sb_size,
                         &dummy_rdc,
 #if CONFIG_SUPERTX
                         &dummy_rate_nocoef,
 #endif  // CONFIG_SUPERTX
                         INT64_MAX, pc_root);
-#endif  // CONFIG_SPEED_REFS
     }
   }
 }
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 8416e25..6eb6d50 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -53,10 +53,6 @@
 extern "C" {
 #endif
 
-#if CONFIG_SPEED_REFS
-#define MIN_SPEED_REFS_BLKSIZE BLOCK_16X16
-#endif  // CONFIG_SPEED_REFS
-
 typedef struct {
   int nmv_vec_cost[NMV_CONTEXTS][MV_JOINTS];
   int nmv_costs[NMV_CONTEXTS][2][MV_VALS];
@@ -629,10 +625,6 @@
   tran_low_t *tcoeff_buf[MAX_MB_PLANE];
 #endif
 
-#if CONFIG_SPEED_REFS
-  int sb_scanning_pass_idx;
-#endif  // CONFIG_SPEED_REFS
-
 #if CONFIG_EXT_REFS
   int extra_arf_allowed;
   int bwd_ref_allowed;
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 5951a19..8f7862a 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -10448,10 +10448,6 @@
   *returnrate_nocoef = INT_MAX;
 #endif  // CONFIG_SUPERTX
 
-#if CONFIG_SPEED_REFS
-  memset(x->mbmi_ext->ref_mvs, 0, sizeof(x->mbmi_ext->ref_mvs));
-#endif  // CONFIG_SPEED_REFS
-
   for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
     x->pred_mv_sad[ref_frame] = INT_MAX;
     x->mbmi_ext->mode_context[ref_frame] = 0;
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 169ed1c..ef837a4 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -196,7 +196,6 @@
 set(CONFIG_SBL_SYMBOL 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_SEGMENT_ZEROMV 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_SMOOTH_HV 1 CACHE NUMBER "AV1 experiment flag.")
-set(CONFIG_SPEED_REFS 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_STRIPED_LOOP_RESTORATION 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_SUPERTX 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_TEMPMV_SIGNALING 1 CACHE NUMBER "AV1 experiment flag.")
diff --git a/configure b/configure
index d427a78..0b7e215 100755
--- a/configure
+++ b/configure
@@ -269,7 +269,6 @@
     wedge
     compound_segment
     ext_refs
-    speed_refs
     gf_groups
     global_motion
     new_quant