Reduce number of search steps in simple motion search

Performance:

 SPEED SET | TESTSET | AVG_PSNR | OVR_PSNR |   SSIM  |  SPD
-----------+---------+----------+----------+---------+-------
           |  LOWRES |  +0.024% |  +0.025% | +0.020% | +0.7%
     4     |  MIDRES |  +0.075% |  +0.081% | +0.076% | +0.8%
           |   HDRES |  +0.026% |  +0.022% | +0.004% | +0.7%
-----------+---------+----------+----------+---------+-------
           |  LOWRES |  +0.067% |  +0.071% | +0.032% | +0.8%
     5     |  MIDRES |  +0.020% |  +0.022% | +0.052% | +1.1%
           |   HDRES |  +0.091% |  +0.091% | +0.121% | +1.0%
-----------+---------+----------+----------+---------+-------
           |  LOWRES |  +0.005% |  +0.006% | -0.021% | +1.0%
     6     |  MIDRES |  +0.030% |  +0.031% | +0.010% | +1.1%
           |   HDRES |  +0.052% |  +0.052% | +0.024% | +0.8%

STATS_CHANGED

Change-Id: I0a1f4e8c7a59701a07e7456e17a2663a4cc97c3d
diff --git a/av1/encoder/motion_search_facade.c b/av1/encoder/motion_search_facade.c
index 4f2c2f2..15fecdc 100644
--- a/av1/encoder/motion_search_facade.c
+++ b/av1/encoder/motion_search_facade.c
@@ -739,7 +739,10 @@
   struct buf_2d backup_yv12;
   // ref_mv is used to calculate the cost of the motion vector
   const MV ref_mv = kZeroMv;
-  const int step_param = cpi->mv_search_params.mv_step_param;
+  const int step_param =
+      AOMMIN(cpi->mv_search_params.mv_step_param +
+                 cpi->sf.part_sf.simple_motion_search_reduce_search_steps,
+             MAX_MVSEARCH_STEPS - 2);
   const search_site_config *src_search_sites =
       &cpi->mv_search_params.search_site_cfg[SS_CFG_SRC];
   int cost_list[5];
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 66fb322..c5b7959 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -533,6 +533,7 @@
     sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE;
 
     sf->part_sf.simple_motion_search_prune_agg = 2;
+    sf->part_sf.simple_motion_search_reduce_search_steps = 4;
     sf->part_sf.prune_ab_partition_using_split_info = 1;
 
     sf->inter_sf.alt_ref_search_fp = 1;
@@ -1001,6 +1002,7 @@
   part_sf->simple_motion_search_split = 0;
   part_sf->simple_motion_search_prune_rect = 0;
   part_sf->simple_motion_search_early_term_none = 0;
+  part_sf->simple_motion_search_reduce_search_steps = 0;
   part_sf->intra_cnn_split = 0;
   part_sf->ext_partition_eval_thresh = BLOCK_8X8;
   part_sf->prune_4_partition_using_split_info = 0;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 8049ec0..5bef4f6 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -403,8 +403,8 @@
   BLOCK_SIZE default_min_partition_size;
   BLOCK_SIZE default_max_partition_size;
 
-  // Sets level of adjustmet of variace-based partitioning during
-  // rd_use_partition 0 - no partition adjusment, 1 - try to merge partitions
+  // Sets level of adjustment of variance-based partitioning during
+  // rd_use_partition 0 - no partition adjustment, 1 - try to merge partitions
   // for small blocks and high QP, 2 - always try to merge leaf partitions, 3 -
   // try to merge and split leaf partitions
   int adjust_var_based_rd_partitioning;
@@ -419,7 +419,7 @@
   // Allow skipping partition search for still image frame
   int allow_partition_search_skip;
 
-  // The aggresiveness of pruning with simple_motion_search.
+  // The aggressiveness of pruning with simple_motion_search.
   // Currently 0 is the lowest, and 2 the highest.
   int simple_motion_search_prune_agg;
 
@@ -438,6 +438,12 @@
   // partition after PARTITION_NONE
   int simple_motion_search_early_term_none;
 
+  // Controls whether to reduce the number of motion search steps. If this is 0,
+  // then simple_motion_search has the same number of steps as
+  // single_motion_search (assuming no other speed features). Otherwise, reduce
+  // the number of steps by the value contained in this variable.
+  int simple_motion_search_reduce_search_steps;
+
   // This variable controls the maximum block size where intra blocks can be
   // used in inter frames.
   // TODO(aconverse): Fold this into one of the other many mode skips