Skip motion search w.r.t. zeromv in first pass

In first pass, when the reference mv is not (0,0),
motion search was performed twice with seed mvs as
(0,0) and ref mv. This patch adds a speed feature
to skip motion search with seed mv as (0,0). The
sf is enabled for speed 6.

cpu-used  Instruction Count     BD-Rate Loss(%)
           Reduction(%)     avg.psnr  ovr.psnr  ssim
   6          0.98          0.0338    0.0048	0.0648

STATS_CHANGED

Change-Id: I086a3251824d35ed9185dee5feb108f40e78c2dd
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 7fc2984..1180942 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -721,15 +721,16 @@
       is_high_bitdepth, bitdepth, bsize, &x->plane[0].src,
       &unscaled_last_source_buf_2d);
   raw_motion_err_list[raw_motion_err_counts] = raw_motion_error;
+  const FIRST_PASS_SPEED_FEATURES *const fp_sf = &cpi->sf.fp_sf;
 
-  if (raw_motion_error > cpi->sf.fp_sf.skip_motion_search_threshold) {
+  if (raw_motion_error > fp_sf->skip_motion_search_threshold) {
     // Test last reference frame using the previous best mv as the
     // starting point (best reference) for the search.
     first_pass_motion_search(cpi, x, &ref_mv, &mv, &motion_error);
 
     // If the current best reference mv is not centered on 0,0 then do a
     // 0,0 based search as well.
-    if (!is_zero_mv(&ref_mv)) {
+    if ((fp_sf->skip_zeromv_motion_search == 0) && !is_zero_mv(&ref_mv)) {
       FULLPEL_MV tmp_mv = kZeroFullMv;
       int tmp_err = INT_MAX;
       first_pass_motion_search(cpi, x, &kZeroMv, &tmp_mv, &tmp_err);
@@ -831,7 +832,7 @@
     xd->mi[0]->ref_frame[0] = LAST_FRAME;
     xd->mi[0]->ref_frame[1] = NONE_FRAME;
 
-    if (cpi->sf.fp_sf.disable_recon == 0) {
+    if (fp_sf->disable_recon == 0) {
       av1_enc_build_inter_predictor(cm, xd, unit_row * unit_scale,
                                     unit_col * unit_scale, NULL, bsize,
                                     AOM_PLANE_Y, AOM_PLANE_Y);
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 5edaf10..4e93698 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1134,6 +1134,8 @@
     sf->winner_mode_sf.multi_winner_mode_type = MULTI_WINNER_MODE_OFF;
 
     sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL4;
+
+    sf->fp_sf.skip_zeromv_motion_search = 1;
   }
 
   // Intra txb hash is currently not compatible with multi-winner mode as the
@@ -1542,6 +1544,7 @@
   fp_sf->reduce_mv_step_param = 3;
   fp_sf->skip_motion_search_threshold = 0;
   fp_sf->disable_recon = 0;
+  fp_sf->skip_zeromv_motion_search = 0;
 }
 
 static AOM_INLINE void init_tpl_sf(TPL_SPEED_FEATURES *tpl_sf) {
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 4b3e542..ef9238b 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -376,6 +376,11 @@
    * \brief Skips reconstruction by using source buffers for prediction
    */
   int disable_recon;
+
+  /*!
+   * \brief Skips the motion search centered on 0,0 mv.
+   */
+  int skip_zeromv_motion_search;
 } FIRST_PASS_SPEED_FEATURES;
 
 /*!\cond */