Modularize MV search parameters in AV1_COMP

The motion vector search related parameters in AV1_COMP have been
grouped into a substructure MotionVectorSearchParams.

BUG=aomedia:2610

Change-Id: Iee827deefb79df65c04ac5c9edfc5258fe8f6c41
diff --git a/av1/encoder/encodemv.c b/av1/encoder/encodemv.c
index e66a733..167e9c0 100644
--- a/av1/encoder/encodemv.c
+++ b/av1/encoder/encodemv.c
@@ -193,7 +193,8 @@
   // motion vector component used.
   if (cpi->sf.mv_sf.auto_mv_step_size) {
     int maxv = AOMMAX(abs(mv->row), abs(mv->col)) >> 3;
-    cpi->max_mv_magnitude = AOMMAX(maxv, cpi->max_mv_magnitude);
+    cpi->mv_search_params.max_mv_magnitude =
+        AOMMAX(maxv, cpi->mv_search_params.max_mv_magnitude);
   }
 }
 
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index eeba604..53f376b 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -3952,26 +3952,27 @@
 
 static void set_mv_search_params(AV1_COMP *cpi) {
   const AV1_COMMON *const cm = &cpi->common;
+  MotionVectorSearchParams *const mv_search_params = &cpi->mv_search_params;
   const int max_mv_def = AOMMAX(cm->width, cm->height);
 
   // Default based on max resolution.
-  cpi->mv_step_param = av1_init_search_range(max_mv_def);
+  mv_search_params->mv_step_param = av1_init_search_range(max_mv_def);
 
   if (cpi->sf.mv_sf.auto_mv_step_size) {
     if (frame_is_intra_only(cm)) {
       // Initialize max_mv_magnitude for use in the first INTER frame
       // after a key/intra-only frame.
-      cpi->max_mv_magnitude = max_mv_def;
+      mv_search_params->max_mv_magnitude = max_mv_def;
     } else {
       // Use cpi->max_mv_magnitude == -1 to exclude first pass case.
-      if (cm->show_frame && cpi->max_mv_magnitude != -1) {
+      if (cm->show_frame && mv_search_params->max_mv_magnitude != -1) {
         // Allow mv_steps to correspond to twice the max mv magnitude found
         // in the previous frame, capped by the default max_mv_magnitude based
         // on resolution.
-        cpi->mv_step_param = av1_init_search_range(
-            AOMMIN(max_mv_def, 2 * cpi->max_mv_magnitude));
+        mv_search_params->mv_step_param = av1_init_search_range(
+            AOMMIN(max_mv_def, 2 * mv_search_params->max_mv_magnitude));
       }
-      cpi->max_mv_magnitude = -1;
+      mv_search_params->max_mv_magnitude = -1;
     }
   }
 }
@@ -4225,6 +4226,7 @@
 
 static void init_motion_estimation(AV1_COMP *cpi) {
   AV1_COMMON *const cm = &cpi->common;
+  MotionVectorSearchParams *const mv_search_params = &cpi->mv_search_params;
   const int y_stride = cpi->scaled_source.y_stride;
   const int y_stride_src =
       ((cpi->oxcf.width != cm->width || cpi->oxcf.height != cm->height) ||
@@ -4235,23 +4237,27 @@
                                            : cpi->scaled_source.y_stride;
 
   // Update if ss_cfg is uninitialized or the current frame has a new stride
-  const int should_update = !cpi->ss_cfg[SS_CFG_SRC].stride ||
-                            !cpi->ss_cfg[SS_CFG_LOOKAHEAD].stride ||
-                            (y_stride != cpi->ss_cfg[SS_CFG_SRC].stride);
+  const int should_update =
+      !mv_search_params->ss_cfg[SS_CFG_SRC].stride ||
+      !mv_search_params->ss_cfg[SS_CFG_LOOKAHEAD].stride ||
+      (y_stride != mv_search_params->ss_cfg[SS_CFG_SRC].stride);
 
   if (!should_update) {
     return;
   }
 
   if (cpi->sf.mv_sf.search_method == DIAMOND) {
-    av1_init_dsmotion_compensation(&cpi->ss_cfg[SS_CFG_SRC], y_stride);
-    av1_init_dsmotion_compensation(&cpi->ss_cfg[SS_CFG_LOOKAHEAD],
+    av1_init_dsmotion_compensation(&mv_search_params->ss_cfg[SS_CFG_SRC],
+                                   y_stride);
+    av1_init_dsmotion_compensation(&mv_search_params->ss_cfg[SS_CFG_LOOKAHEAD],
                                    y_stride_src);
   } else {
-    av1_init3smotion_compensation(&cpi->ss_cfg[SS_CFG_SRC], y_stride);
-    av1_init3smotion_compensation(&cpi->ss_cfg[SS_CFG_LOOKAHEAD], y_stride_src);
+    av1_init3smotion_compensation(&mv_search_params->ss_cfg[SS_CFG_SRC],
+                                  y_stride);
+    av1_init3smotion_compensation(&mv_search_params->ss_cfg[SS_CFG_LOOKAHEAD],
+                                  y_stride_src);
   }
-  av1_init_motion_fpf(&cpi->ss_cfg[SS_CFG_FPF], fpf_y_stride);
+  av1_init_motion_fpf(&mv_search_params->ss_cfg[SS_CFG_FPF], fpf_y_stride);
 }
 
 #define COUPLED_CHROMA_FROM_LUMA_RESTORATION 0
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 0a23299..826e9a6 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -834,6 +834,30 @@
 } GlobalMotionInfo;
 
 typedef struct {
+  // Largest MV component used in a frame.
+  // The value from the previous frame is used to set the full pixel search
+  // range for the current frame.
+  int max_mv_magnitude;
+  // Parameter indicating initial search window to be used in full-pixel search.
+  // Range [0, MAX_MVSEARCH_STEPS-2]. Lower value indicates larger window.
+  int mv_step_param;
+  // Pointer to sub-pixel search function.
+  // In encoder: av1_find_best_sub_pixel_tree
+  //             av1_find_best_sub_pixel_tree_pruned
+  //             av1_find_best_sub_pixel_tree_pruned_more
+  //             av1_find_best_sub_pixel_tree_pruned_evenmore
+  // In MV unit test: av1_return_max_sub_pixel_mv
+  //                  av1_return_min_sub_pixel_mv
+  fractional_mv_step_fp *find_fractional_mv_step;
+  // Search site configuration for full-pel MV search.
+  // ss_cfg[SS_CFG_SRC]: Used in tpl, rd/non-rd inter mode loop, simple motion
+  // search.
+  // ss_cfg[SS_CFG_LOOKAHEAD]: Used in intraBC, temporal filter
+  // ss_cfg[SS_CFG_FPF]: Used during first pass and lookahead
+  search_site_config ss_cfg[SS_CFG_TOTAL];
+} MotionVectorSearchParams;
+
+typedef struct {
   int arf_stack[FRAME_BUFFERS];
   int arf_stack_size;
   int lst_stack[FRAME_BUFFERS];
@@ -980,8 +1004,8 @@
   // sf contains fine-grained config set internally based on speed
   SPEED_FEATURES sf;
 
-  int max_mv_magnitude;
-  int mv_step_param;
+  // Parameters for motion vector search process.
+  MotionVectorSearchParams mv_search_params;
 
   int all_one_sided_refs;
 
@@ -990,7 +1014,6 @@
   CYCLIC_REFRESH *cyclic_refresh;
   ActiveMap active_map;
 
-  fractional_mv_step_fp *find_fractional_mv_step;
   aom_variance_fn_ptr_t fn_ptr[BLOCK_SIZES_ALL];
 
 #if CONFIG_INTERNAL_STATS
@@ -1064,12 +1087,6 @@
   int resize_pending_width;
   int resize_pending_height;
 
-  // ss_cfg[SS_CFG_LOOKAHEAD] : used in following cases
-  //                           -> temporal filtering
-  //                           -> intrabc
-  // ss_cfg[SS_CFG_SRC] : used everywhere except above mentioned cases
-  search_site_config ss_cfg[SS_CFG_TOTAL];
-
   TileDataEnc *tile_data;
   int allocated_tiles;  // Keep track of memory allocated for tiles.
 
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index a61f6fd..d0cd939 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -232,7 +232,8 @@
   const int step_param = 3 + sr;
   int cost_list[5];
 
-  const search_site_config *first_pass_search_sites = &cpi->ss_cfg[SS_CFG_FPF];
+  const search_site_config *first_pass_search_sites =
+      &cpi->mv_search_params.ss_cfg[SS_CFG_FPF];
   FULLPEL_MOTION_SEARCH_PARAMS ms_params;
   av1_make_default_fullpel_ms_params(&ms_params, cpi, x, bsize, ref_mv,
                                      first_pass_search_sites);
diff --git a/av1/encoder/motion_search_facade.c b/av1/encoder/motion_search_facade.c
index 0259aa3..e12fc4e 100644
--- a/av1/encoder/motion_search_facade.c
+++ b/av1/encoder/motion_search_facade.c
@@ -25,6 +25,7 @@
                               int search_range, inter_mode_info *mode_info) {
   MACROBLOCKD *xd = &x->e_mbd;
   const AV1_COMMON *cm = &cpi->common;
+  const MotionVectorSearchParams *mv_search_params = &cpi->mv_search_params;
   const int num_planes = av1_num_planes(cm);
   MB_MODE_INFO *mbmi = xd->mi[0];
   struct buf_2d backup_yv12[MAX_MB_PLANE] = { { 0, 0, 0, 0, 0 } };
@@ -54,11 +55,11 @@
     // Take the weighted average of the step_params based on the last frame's
     // max mv magnitude and that based on the best ref mvs of the current
     // block for the given reference.
-    step_param =
-        (av1_init_search_range(x->max_mv_context[ref]) + cpi->mv_step_param) /
-        2;
+    step_param = (av1_init_search_range(x->max_mv_context[ref]) +
+                  mv_search_params->mv_step_param) /
+                 2;
   } else {
-    step_param = cpi->mv_step_param;
+    step_param = mv_search_params->mv_step_param;
   }
 
   if (cpi->sf.mv_sf.adaptive_motion_search && bsize < cm->seq_params.sb_size) {
@@ -102,7 +103,7 @@
 
   // Further reduce the search range.
   if (search_range < INT_MAX) {
-    const search_site_config *ss_cfg = &cpi->ss_cfg[SS_CFG_SRC];
+    const search_site_config *ss_cfg = &mv_search_params->ss_cfg[SS_CFG_SRC];
     // MAx step_param is ss_cfg->ss_count.
     if (search_range < 1) {
       step_param = ss_cfg->ss_count;
@@ -124,7 +125,8 @@
   int_mv second_best_mv;
   x->best_mv.as_int = second_best_mv.as_int = INVALID_MV;
 
-  const search_site_config *src_search_sites = &cpi->ss_cfg[SS_CFG_SRC];
+  const search_site_config *src_search_sites =
+      &mv_search_params->ss_cfg[SS_CFG_SRC];
   FULLPEL_MOTION_SEARCH_PARAMS full_ms_params;
   av1_make_default_fullpel_ms_params(&full_ms_params, cpi, x, bsize, &ref_mv,
                                      src_search_sites);
@@ -215,7 +217,7 @@
         if (cpi->sf.mv_sf.use_accurate_subpel_search) {
           const int try_second = second_best_mv.as_int != INVALID_MV &&
                                  second_best_mv.as_int != x->best_mv.as_int;
-          const int best_mv_var = cpi->find_fractional_mv_step(
+          const int best_mv_var = mv_search_params->find_fractional_mv_step(
               xd, cm, &ms_params, subpel_start_mv, &x->best_mv.as_mv, &dis,
               &x->pred_sse[ref], fractional_ms_list);
 
@@ -224,16 +226,16 @@
             subpel_start_mv = get_mv_from_fullmv(&second_best_mv.as_fullmv);
             if (av1_is_subpelmv_in_range(&ms_params.mv_limits,
                                          subpel_start_mv)) {
-              const int this_var = cpi->find_fractional_mv_step(
+              const int this_var = mv_search_params->find_fractional_mv_step(
                   xd, cm, &ms_params, subpel_start_mv, &this_best_mv, &dis,
                   &x->pred_sse[ref], fractional_ms_list);
               if (this_var < best_mv_var) x->best_mv.as_mv = this_best_mv;
             }
           }
         } else {
-          cpi->find_fractional_mv_step(xd, cm, &ms_params, subpel_start_mv,
-                                       &x->best_mv.as_mv, &dis,
-                                       &x->pred_sse[ref], NULL);
+          mv_search_params->find_fractional_mv_step(
+              xd, cm, &ms_params, subpel_start_mv, &x->best_mv.as_mv, &dis,
+              &x->pred_sse[ref], NULL);
         }
         break;
       case OBMC_CAUSAL:
@@ -411,7 +413,7 @@
                                         mask, mask_stride, id);
       ms_params.forced_stop = EIGHTH_PEL;
       MV start_mv = get_mv_from_fullmv(&x->best_mv.as_fullmv);
-      bestsme = cpi->find_fractional_mv_step(
+      bestsme = cpi->mv_search_params.find_fractional_mv_step(
           xd, cm, &ms_params, start_mv, &x->best_mv.as_mv, &dis, &sse, NULL);
     }
 
@@ -531,7 +533,7 @@
                                       ref_idx);
     ms_params.forced_stop = EIGHTH_PEL;
     MV start_mv = get_mv_from_fullmv(&best_int_mv->as_fullmv);
-    bestsme = cpi->find_fractional_mv_step(
+    bestsme = cpi->mv_search_params.find_fractional_mv_step(
         xd, cm, &ms_params, start_mv, &best_int_mv->as_mv, &dis, &sse, NULL);
   }
 
@@ -688,8 +690,9 @@
   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_step_param;
-  const search_site_config *src_search_sites = &cpi->ss_cfg[SS_CFG_SRC];
+  const int step_param = cpi->mv_search_params.mv_step_param;
+  const search_site_config *src_search_sites =
+      &cpi->mv_search_params.ss_cfg[SS_CFG_SRC];
   int cost_list[5];
   const int ref_idx = 0;
   int var;
@@ -730,9 +733,9 @@
                                       invert_mask);
     MV subpel_start_mv = get_mv_from_fullmv(&x->best_mv.as_fullmv);
 
-    cpi->find_fractional_mv_step(xd, cm, &ms_params, subpel_start_mv,
-                                 &x->best_mv.as_mv, &not_used,
-                                 &x->pred_sse[ref], NULL);
+    cpi->mv_search_params.find_fractional_mv_step(
+        xd, cm, &ms_params, subpel_start_mv, &x->best_mv.as_mv, &not_used,
+        &x->pred_sse[ref], NULL);
   } else {
     // Manually convert from units of pixel to 1/8-pixels if we are not doing
     // subpel search
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index e6aebca..bc8d4e6 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -124,7 +124,7 @@
   const int num_planes = av1_num_planes(cm);
   MB_MODE_INFO *mi = xd->mi[0];
   struct buf_2d backup_yv12[MAX_MB_PLANE] = { { 0, 0, 0, 0, 0 } };
-  int step_param = cpi->mv_step_param;
+  int step_param = cpi->mv_search_params.mv_step_param;
   FULLPEL_MV start_mv;
   const int ref = mi->ref_frame[0];
   const MV ref_mv = av1_get_ref_mv(x, mi->ref_mv_idx).as_mv;
@@ -153,7 +153,8 @@
   else
     center_mv = tmp_mv->as_mv;
 
-  const search_site_config *src_search_sites = &cpi->ss_cfg[SS_CFG_SRC];
+  const search_site_config *src_search_sites =
+      &cpi->mv_search_params.ss_cfg[SS_CFG_SRC];
   FULLPEL_MOTION_SEARCH_PARAMS full_ms_params;
   av1_make_default_fullpel_ms_params(&full_ms_params, cpi, x, bsize, &center_mv,
                                      src_search_sites);
@@ -182,9 +183,9 @@
                                       cost_list, second_pred, mask, mask_stride,
                                       invert_mask);
     MV subpel_start_mv = get_mv_from_fullmv(&x->best_mv.as_fullmv);
-    cpi->find_fractional_mv_step(xd, cm, &ms_params, subpel_start_mv,
-                                 &x->best_mv.as_mv, &dis, &x->pred_sse[ref],
-                                 NULL);
+    cpi->mv_search_params.find_fractional_mv_step(
+        xd, cm, &ms_params, subpel_start_mv, &x->best_mv.as_mv, &dis,
+        &x->pred_sse[ref], NULL);
 
     *tmp_mv = x->best_mv;
     *rate_mv = av1_mv_bit_cost(&tmp_mv->as_mv, &ref_mv, x->nmv_vec_cost,
@@ -244,9 +245,9 @@
                                       cost_list, second_pred, mask, mask_stride,
                                       invert_mask);
     MV start_mv = get_mv_from_fullmv(&x->best_mv.as_fullmv);
-    cpi->find_fractional_mv_step(xd, cm, &ms_params, start_mv,
-                                 &x->best_mv.as_mv, &dis,
-                                 &x->pred_sse[ref_frame], NULL);
+    cpi->mv_search_params.find_fractional_mv_step(
+        xd, cm, &ms_params, start_mv, &x->best_mv.as_mv, &dis,
+        &x->pred_sse[ref_frame], NULL);
     frame_mv[NEWMV][ref_frame].as_int = x->best_mv.as_int;
   } else if (!combined_motion_search(cpi, x, bsize, mi_row, mi_col,
                                      &frame_mv[NEWMV][ref_frame], rate_mv,
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index f911733..31e1897 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -2694,7 +2694,7 @@
 
   FULLPEL_MOTION_SEARCH_PARAMS fullms_params;
   const search_site_config *lookahead_search_sites =
-      &cpi->ss_cfg[SS_CFG_LOOKAHEAD];
+      &cpi->mv_search_params.ss_cfg[SS_CFG_LOOKAHEAD];
   av1_make_default_fullpel_ms_params(&fullms_params, cpi, x, bsize,
                                      &dv_ref.as_mv, lookahead_search_sites);
   fullms_params.is_intra_mode = 1;
@@ -2740,7 +2740,7 @@
       continue;
     }
 
-    const int step_param = cpi->mv_step_param;
+    const int step_param = cpi->mv_search_params.mv_step_param;
     const FULLPEL_MV start_mv = get_fullmv_from_mv(&dv_ref.as_mv);
     int cost_list[5];
 
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 81b3f17..a085e44 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1114,9 +1114,9 @@
 
   // This is only used in motion vector unit test.
   if (cpi->oxcf.motion_vector_unit_test == 1)
-    cpi->find_fractional_mv_step = av1_return_max_sub_pixel_mv;
+    cpi->mv_search_params.find_fractional_mv_step = av1_return_max_sub_pixel_mv;
   else if (cpi->oxcf.motion_vector_unit_test == 2)
-    cpi->find_fractional_mv_step = av1_return_min_sub_pixel_mv;
+    cpi->mv_search_params.find_fractional_mv_step = av1_return_min_sub_pixel_mv;
 
   MACROBLOCK *const x = &cpi->td.mb;
   AV1_COMMON *const cm = &cpi->common;
@@ -1193,14 +1193,18 @@
   // No recode or trellis for 1 pass.
   if (oxcf->pass == 0) sf->hl_sf.recode_loop = DISALLOW_RECODE;
 
+  MotionVectorSearchParams *const mv_search_params = &cpi->mv_search_params;
   if (sf->mv_sf.subpel_search_method == SUBPEL_TREE) {
-    cpi->find_fractional_mv_step = av1_find_best_sub_pixel_tree;
+    mv_search_params->find_fractional_mv_step = av1_find_best_sub_pixel_tree;
   } else if (sf->mv_sf.subpel_search_method == SUBPEL_TREE_PRUNED) {
-    cpi->find_fractional_mv_step = av1_find_best_sub_pixel_tree_pruned;
+    mv_search_params->find_fractional_mv_step =
+        av1_find_best_sub_pixel_tree_pruned;
   } else if (sf->mv_sf.subpel_search_method == SUBPEL_TREE_PRUNED_MORE) {
-    cpi->find_fractional_mv_step = av1_find_best_sub_pixel_tree_pruned_more;
+    mv_search_params->find_fractional_mv_step =
+        av1_find_best_sub_pixel_tree_pruned_more;
   } else if (sf->mv_sf.subpel_search_method == SUBPEL_TREE_PRUNED_EVENMORE) {
-    cpi->find_fractional_mv_step = av1_find_best_sub_pixel_tree_pruned_evenmore;
+    mv_search_params->find_fractional_mv_step =
+        av1_find_best_sub_pixel_tree_pruned_evenmore;
   }
 
   x->min_partition_size = AOMMAX(sf->part_sf.default_min_partition_size,
@@ -1212,9 +1216,9 @@
 
   // This is only used in motion vector unit test.
   if (cpi->oxcf.motion_vector_unit_test == 1)
-    cpi->find_fractional_mv_step = av1_return_max_sub_pixel_mv;
+    mv_search_params->find_fractional_mv_step = av1_return_max_sub_pixel_mv;
   else if (cpi->oxcf.motion_vector_unit_test == 2)
-    cpi->find_fractional_mv_step = av1_return_min_sub_pixel_mv;
+    mv_search_params->find_fractional_mv_step = av1_return_min_sub_pixel_mv;
 
   // assert ensures that tx_domain_dist_level is accessed correctly
   assert(cpi->sf.rd_sf.tx_domain_dist_thres_level >= 0 &&
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index da770a0..8303967 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -89,7 +89,8 @@
   FULLPEL_MOTION_SEARCH_PARAMS full_ms_params;
   SUBPEL_MOTION_SEARCH_PARAMS ms_params;
 
-  const search_site_config ss_cfg = cpi->ss_cfg[SS_CFG_LOOKAHEAD];
+  const search_site_config ss_cfg =
+      cpi->mv_search_params.ss_cfg[SS_CFG_LOOKAHEAD];
   const SEARCH_METHODS full_search_method = NSTEP;
   const int step_param = av1_init_search_range(
       AOMMAX(frame_to_filter->y_crop_width, frame_to_filter->y_crop_height));
@@ -150,9 +151,9 @@
     ms_params.forced_stop = EIGHTH_PEL;
     ms_params.var_params.subpel_search_type = subpel_search_type;
     MV subpel_start_mv = get_mv_from_fullmv(&mb->best_mv.as_fullmv);
-    error = cpi->find_fractional_mv_step(&mb->e_mbd, &cpi->common, &ms_params,
-                                         subpel_start_mv, &mb->best_mv.as_mv,
-                                         &distortion, &sse, NULL);
+    error = cpi->mv_search_params.find_fractional_mv_step(
+        &mb->e_mbd, &cpi->common, &ms_params, subpel_start_mv,
+        &mb->best_mv.as_mv, &distortion, &sse, NULL);
     block_mse = DIVIDE_AND_ROUND(error, mb_pels);
     mb->e_mbd.mi[0]->mv[0] = mb->best_mv;
     *ref_mv = mb->best_mv.as_mv;
@@ -188,7 +189,7 @@
         ms_params.forced_stop = EIGHTH_PEL;
         ms_params.var_params.subpel_search_type = subpel_search_type;
         subpel_start_mv = get_mv_from_fullmv(&mb->best_mv.as_fullmv);
-        error = cpi->find_fractional_mv_step(
+        error = cpi->mv_search_params.find_fractional_mv_step(
             &mb->e_mbd, &cpi->common, &ms_params, subpel_start_mv,
             &mb->best_mv.as_mv, &distortion, &sse, NULL);
         subblock_mses[subblock_idx] = DIVIDE_AND_ROUND(error, subblock_pels);
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c
index f846f88..7973412 100644
--- a/av1/encoder/tpl_model.c
+++ b/av1/encoder/tpl_model.c
@@ -142,8 +142,9 @@
   step_param = tpl_sf->reduce_first_step_size;
   step_param = AOMMIN(step_param, MAX_MVSEARCH_STEPS - 2);
 
-  search_site_config *ss_cfg = &cpi->ss_cfg[SS_CFG_SRC];
-  if (ss_cfg->stride != stride_ref) ss_cfg = &cpi->ss_cfg[SS_CFG_LOOKAHEAD];
+  search_site_config *ss_cfg = &cpi->mv_search_params.ss_cfg[SS_CFG_SRC];
+  if (ss_cfg->stride != stride_ref)
+    ss_cfg = &cpi->mv_search_params.ss_cfg[SS_CFG_LOOKAHEAD];
 
   assert(ss_cfg->stride == stride_ref);
 
@@ -167,9 +168,9 @@
   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(&x->best_mv.as_fullmv);
-  bestsme =
-      cpi->find_fractional_mv_step(xd, cm, &ms_params, subpel_start_mv,
-                                   &x->best_mv.as_mv, &distortion, &sse, NULL);
+  bestsme = cpi->mv_search_params.find_fractional_mv_step(
+      xd, cm, &ms_params, subpel_start_mv, &x->best_mv.as_mv, &distortion, &sse,
+      NULL);
 
   return bestsme;
 }