Cleanup motion search speed features.
authorAlex Converse <aconverse@google.com>
Tue, 1 Jul 2014 20:02:05 +0000 (13:02 -0700)
committerAlex Converse <aconverse@google.com>
Mon, 7 Jul 2014 17:08:45 +0000 (10:08 -0700)
* Replace max_step_search_steps with constant MAX_MVSEARCH_STEPS
* Fold (reduce_first_step_size + speed > 5) into reduce_first_step_size
  replacing uses of reduce_first_step_size that don't add the speed
  check with zero.

Change-Id: Iae46395dbf3eaca138bf4d18b838a9e364b5a198

vp9/encoder/vp9_mbgraph.c
vp9/encoder/vp9_mcomp.c
vp9/encoder/vp9_speed_features.c
vp9/encoder/vp9_speed_features.h
vp9/encoder/vp9_temporal_filter.c

index abb0d6c..9eb2fbc 100644 (file)
@@ -36,9 +36,8 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
   MV ref_full;
 
   // Further step/diamond searches as necessary
-  int step_param = mv_sf->reduce_first_step_size +
-                       (cpi->oxcf.speed > 5 ? 1 : 0);
-  step_param = MIN(step_param, mv_sf->max_step_search_steps - 2);
+  int step_param = mv_sf->reduce_first_step_size;
+  step_param = MIN(step_param, MAX_MVSEARCH_STEPS - 2);
 
   vp9_set_mv_search_range(x, ref_mv);
 
index cb45dfa..c0edf45 100644 (file)
@@ -60,8 +60,7 @@ int vp9_init_search_range(const SPEED_FEATURES *sf, int size) {
   while ((size << sr) < MAX_FULL_PEL_VAL)
     sr++;
 
-  sr += sf->mv.reduce_first_step_size;
-  sr = MIN(sr, (sf->mv.max_step_search_steps - 2));
+  sr = MIN(sr, MAX_MVSEARCH_STEPS - 2);
   return sr;
 }
 
@@ -1627,8 +1626,7 @@ int vp9_full_pixel_search(VP9_COMP *cpi, MACROBLOCK *x,
       break;
     case NSTEP:
       var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit,
-                                   (sf->mv.max_step_search_steps - 1) -
-                                       step_param,
+                                   MAX_MVSEARCH_STEPS - 1 - step_param,
                                    1, fn_ptr, ref_mv, tmp_mv);
       break;
     default:
index 1eac02f..98d6825 100644 (file)
@@ -149,6 +149,9 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
     }
     cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
   }
+  if (speed >= 6) {
+    sf->mv.reduce_first_step_size = 1;
+  }
 }
 
 static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
@@ -280,6 +283,8 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
 
     // Increase mode checking threshold for NEWMV.
     sf->elevate_newmv_thresh = 2000;
+
+    sf->mv.reduce_first_step_size = 1;
   }
   if (speed >= 7) {
     sf->use_quant_fp = cm->frame_type == KEY_FRAME ? 0 : 1;
@@ -312,7 +317,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
   sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf);
   sf->mv.reduce_first_step_size = 0;
   sf->mv.auto_mv_step_size = 0;
-  sf->mv.max_step_search_steps = MAX_MVSEARCH_STEPS;
   sf->mv.fullpel_search_step_param = 6;
   sf->comp_inter_joint_search_thresh = BLOCK_4X4;
   sf->adaptive_rd_thresh = 0;
index 4ccb77a..e6f4653 100644 (file)
@@ -139,10 +139,6 @@ typedef struct MV_SPEED_FEATURES {
   // Motion search method (Diamond, NSTEP, Hex, Big Diamond, Square, etc).
   SEARCH_METHODS search_method;
 
-  // This parameter controls the number of steps we'll do in a diamond
-  // search.
-  int max_step_search_steps;
-
   // This parameter controls which step in the n-step process we start at.
   // It's changed adaptively based on circumstances.
   int reduce_first_step_size;
index 31f8c32..c090731 100644 (file)
@@ -163,8 +163,8 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
   xd->plane[0].pre[0].buf = frame_ptr_buf;
   xd->plane[0].pre[0].stride = stride;
 
-  step_param = mv_sf->reduce_first_step_size + (cpi->oxcf.speed > 5 ? 1 : 0);
-  step_param = MIN(step_param, mv_sf->max_step_search_steps - 2);
+  step_param = mv_sf->reduce_first_step_size;
+  step_param = MIN(step_param, MAX_MVSEARCH_STEPS - 2);
 
   // Ignore mv costing by sending NULL pointer instead of cost arrays
   vp9_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1,