Reduce sub-pel precision for fast motion search

Reduced sub-pel search precision to 1/4 pel in TPL and simple motion
search to speed up encoder.

Borg test result at speed 5:
       avg_psnr:  ovr_psnr:  ssim:   avg speed change:
hdres:  -0.013    -0.019    -0.094      3.1%
midres: -0.001     0.034     0.019      2.9%
lowres: -0.033    -0.052    -0.180      2.5%
This change gives good speedups without any quality loss, and will be
tested and enabled for low speed settings.

STATS_CHANGED at speed 5

Change-Id: I02bdd3ac49c925b7fe848e4dc829d6e1c2775c2b
diff --git a/av1/encoder/motion_search_facade.c b/av1/encoder/motion_search_facade.c
index f9b0ea4..8db1423 100644
--- a/av1/encoder/motion_search_facade.c
+++ b/av1/encoder/motion_search_facade.c
@@ -810,6 +810,9 @@
     SUBPEL_MOTION_SEARCH_PARAMS ms_params;
     av1_make_default_subpel_ms_params(&ms_params, cpi, x, bsize, &ref_mv,
                                       cost_list);
+    // TODO(yunqing): integrate this into av1_make_default_subpel_ms_params().
+    ms_params.forced_stop = cpi->sf.mv_sf.simple_motion_subpel_force_stop;
+
     MV subpel_start_mv = get_mv_from_fullmv(&best_mv.as_fullmv);
 
     cpi->mv_search_params.find_fractional_mv_step(
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 345cdfc..e03faec 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -591,8 +591,11 @@
     sf->lpf_sf.lpf_pick = LPF_PICK_FROM_FULL_IMAGE_NON_DUAL;
     sf->lpf_sf.disable_lr_filter = 1;
 
+    sf->mv_sf.simple_motion_subpel_force_stop = QUARTER_PEL;
     sf->mv_sf.prune_mesh_search = 1;
     sf->mv_sf.reduce_search_range = 1;
+
+    sf->tpl_sf.subpel_force_stop = QUARTER_PEL;
   }
 
   if (speed >= 6) {
@@ -890,6 +893,7 @@
   tpl_sf->prune_intra_modes = 0;
   tpl_sf->reduce_first_step_size = 0;
   tpl_sf->skip_alike_starting_mv = 0;
+  tpl_sf->subpel_force_stop = EIGHTH_PEL;
 }
 
 static AOM_INLINE void init_gm_sf(GLOBAL_MOTION_SPEED_FEATURES *gm_sf) {
@@ -946,6 +950,7 @@
   mv_sf->prune_mesh_search = 0;
   mv_sf->reduce_search_range = 0;
   mv_sf->search_method = NSTEP;
+  mv_sf->simple_motion_subpel_force_stop = EIGHTH_PEL;
   mv_sf->subpel_force_stop = EIGHTH_PEL;
   mv_sf->subpel_iters_per_step = 2;
   mv_sf->subpel_search_method = SUBPEL_TREE;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 6eb39c2..d12c3c0 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -298,6 +298,9 @@
   // full-pixel center MVs. If set to 2, motion estimation is skipped if the
   // difference between center MVs is less than the threshold.
   int skip_alike_starting_mv;
+
+  // When to stop subpel search.
+  SUBPEL_FORCE_STOP subpel_force_stop;
 } TPL_SPEED_FEATURES;
 
 typedef struct GLOBAL_MOTION_SPEED_FEATURES {
@@ -441,6 +444,9 @@
   // When to stop subpel search.
   SUBPEL_FORCE_STOP subpel_force_stop;
 
+  // When to stop subpel search in simple motion search.
+  SUBPEL_FORCE_STOP simple_motion_subpel_force_stop;
+
   // If true, sub-pixel search uses the exact convolve function used for final
   // encoding and decoding; otherwise, it uses bilinear interpolation.
   SUBPEL_SEARCH_TYPE use_accurate_subpel_search;
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c
index 733cb44..79b94f3 100644
--- a/av1/encoder/tpl_model.c
+++ b/av1/encoder/tpl_model.c
@@ -159,7 +159,7 @@
   SUBPEL_MOTION_SEARCH_PARAMS ms_params;
   av1_make_default_subpel_ms_params(&ms_params, cpi, x, bsize, &center_mv,
                                     cost_list);
-  ms_params.forced_stop = EIGHTH_PEL;
+  ms_params.forced_stop = tpl_sf->subpel_force_stop;
   ms_params.var_params.subpel_search_type = USE_2_TAPS;
   ms_params.mv_cost_params.mv_cost_type = MV_COST_NONE;
   MV subpel_start_mv = get_mv_from_fullmv(&best_mv->as_fullmv);