]> granicus.if.org Git - libvpx/commitdiff
Add enum definition for subpel search precision
authorHui Su <huisu@google.com>
Fri, 7 Dec 2018 00:53:26 +0000 (16:53 -0800)
committerHui Su <huisu@google.com>
Fri, 7 Dec 2018 23:48:11 +0000 (15:48 -0800)
To improve readability.

Change-Id: Idc08b2068c7d8ba9dadc0d559a3b4d61c2a88c94

vp9/encoder/vp9_pickmode.c
vp9/encoder/vp9_speed_features.c
vp9/encoder/vp9_speed_features.h

index fe8f244443227962607eb86d2101a017607b48ca..babfe4a33a14e403868677b367ba67098f5ea264 100644 (file)
@@ -233,10 +233,10 @@ static int combined_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
   }
 
   if (rv && search_subpel) {
-    int subpel_force_stop = cpi->sf.mv.subpel_force_stop;
-    if (use_base_mv && cpi->sf.base_mv_aggressive) subpel_force_stop = 2;
+    SUBPEL_FORCE_STOP subpel_force_stop = cpi->sf.mv.subpel_force_stop;
+    if (use_base_mv && cpi->sf.base_mv_aggressive) subpel_force_stop = HALF_PEL;
     if (cpi->sf.mv.enable_adaptive_subpel_force_stop) {
-      int mv_thresh = cpi->sf.mv.adapt_subpel_force_stop.mv_thresh;
+      const int mv_thresh = cpi->sf.mv.adapt_subpel_force_stop.mv_thresh;
       if (abs(tmp_mv->as_mv.row) >= mv_thresh ||
           abs(tmp_mv->as_mv.col) >= mv_thresh)
         subpel_force_stop = cpi->sf.mv.adapt_subpel_force_stop.force_stop_above;
index 9b6c69a73fdfd954a441a6c827c4fc1d0c49bd1c..e5c2807461875a4ee02e6c1fc384bb402bff9acd 100644 (file)
@@ -533,7 +533,7 @@ static void set_rt_speed_feature_framesize_independent(
     sf->adjust_partitioning_from_last_frame =
         cm->last_frame_type != cm->frame_type ||
         (0 == (frames_since_key + 1) % sf->last_partitioning_redo_frequency);
-    sf->mv.subpel_force_stop = 1;
+    sf->mv.subpel_force_stop = QUARTER_PEL;
     for (i = 0; i < TX_SIZES; i++) {
       sf->intra_y_mode_mask[i] = INTRA_DC_H_V;
       sf->intra_uv_mode_mask[i] = INTRA_DC;
@@ -731,7 +731,7 @@ static void set_rt_speed_feature_framesize_independent(
     if (cpi->row_mt && cpi->oxcf.max_threads > 1)
       sf->adaptive_rd_thresh_row_mt = 1;
 
-    if (content == VP9E_CONTENT_SCREEN) sf->mv.subpel_force_stop = 3;
+    if (content == VP9E_CONTENT_SCREEN) sf->mv.subpel_force_stop = FULL_PEL;
     if (content == VP9E_CONTENT_SCREEN) sf->lpf_pick = LPF_PICK_MINIMAL_LPF;
     // Only keep INTRA_DC mode for speed 8.
     if (!is_keyframe) {
@@ -767,8 +767,8 @@ static void set_rt_speed_feature_framesize_independent(
     sf->mv.adapt_subpel_force_stop.mv_thresh = 2;
     if (cpi->rc.avg_frame_low_motion < 40)
       sf->mv.adapt_subpel_force_stop.mv_thresh = 1;
-    sf->mv.adapt_subpel_force_stop.force_stop_below = 1;
-    sf->mv.adapt_subpel_force_stop.force_stop_above = 2;
+    sf->mv.adapt_subpel_force_stop.force_stop_below = QUARTER_PEL;
+    sf->mv.adapt_subpel_force_stop.force_stop_above = HALF_PEL;
     // Disable partition blocks below 16x16, except for low-resolutions.
     if (cm->frame_type != KEY_FRAME && cm->width >= 320 && cm->height >= 240)
       sf->disable_16x16part_nonkey = 1;
@@ -876,7 +876,7 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) {
   sf->recode_loop = ALLOW_RECODE_FIRST;
   sf->mv.subpel_search_method = SUBPEL_TREE;
   sf->mv.subpel_search_level = 2;
-  sf->mv.subpel_force_stop = 0;
+  sf->mv.subpel_force_stop = EIGHTH_PEL;
   sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf);
   sf->mv.reduce_first_step_size = 0;
   sf->coeff_prob_appx_step = 1;
@@ -993,7 +993,7 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) {
     sf->optimize_coefficients = 0;
   }
 
-  if (sf->mv.subpel_force_stop == 3) {
+  if (sf->mv.subpel_force_stop == FULL_PEL) {
     // Whole pel only
     cpi->find_fractional_mv_step = vp9_skip_sub_pixel_tree;
   } else if (sf->mv.subpel_search_method == SUBPEL_TREE) {
index 02673e602002644cf1622a3ea6e9618330311613..9b09ec4748eeee0d1dcf633269a5eff3b9d55033 100644 (file)
@@ -167,15 +167,17 @@ typedef enum {
   ONE_LOOP_REDUCED = 1
 } FAST_COEFF_UPDATE;
 
+typedef enum { EIGHTH_PEL, QUARTER_PEL, HALF_PEL, FULL_PEL } SUBPEL_FORCE_STOP;
+
 typedef struct ADAPT_SUBPEL_FORCE_STOP {
   // Threshold for full pixel motion vector;
   int mv_thresh;
 
   // subpel_force_stop if full pixel MV is below the threshold.
-  int force_stop_below;
+  SUBPEL_FORCE_STOP force_stop_below;
 
   // subpel_force_stop if full pixel MV is equal to or above the threshold.
-  int force_stop_above;
+  SUBPEL_FORCE_STOP force_stop_above;
 } ADAPT_SUBPEL_FORCE_STOP;
 
 typedef struct MV_SPEED_FEATURES {
@@ -200,12 +202,8 @@ typedef struct MV_SPEED_FEATURES {
   // extensive subpel search.
   int subpel_search_level;
 
-  // Control when to stop subpel search:
-  // 0: Full subpel search.
-  // 1: Stop at quarter pixel.
-  // 2: Stop at half pixel.
-  // 3: Stop at full pixel.
-  int subpel_force_stop;
+  // When to stop subpel motion search.
+  SUBPEL_FORCE_STOP subpel_force_stop;
 
   // If it's enabled, different subpel_force_stop will be used for different MV.
   int enable_adaptive_subpel_force_stop;