shithub: libvpx

Download patch

ref: af2a7369537cc842c9d4e484b1cb979db68dfe06
parent: 17a26eb4437d5d02a2e44c271fe6416eb253c98d
parent: 6a464eca0549fb1a539c9f5968d66e66cdf4cce9
author: Jingning Han <[email protected]>
date: Mon Aug 18 13:58:43 EDT 2014

Merge "Speed up mode search depending on relative ref frame position"

--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2632,6 +2632,12 @@
     int64_t total_sse = INT64_MAX;
     int early_term = 0;
 
+    this_mode = vp9_mode_order[mode_index].mode;
+    ref_frame = vp9_mode_order[mode_index].ref_frame[0];
+    if (ref_frame != INTRA_FRAME && !(inter_mode_mask & (1 << this_mode)))
+      continue;
+    second_ref_frame = vp9_mode_order[mode_index].ref_frame[1];
+
     // Look at the reference frame of the best mode so far and set the
     // skip mask to look at a subset of the remaining modes.
     if (mode_index == mode_skip_start && best_mode_index >= 0) {
@@ -2653,6 +2659,13 @@
           break;
       }
     }
+
+    if (cpi->sf.alt_ref_search_fp && cpi->rc.is_src_frame_alt_ref) {
+      mode_skip_mask = 0;
+      if (!(ref_frame == ALTREF_FRAME && second_ref_frame == NONE))
+        continue;
+    }
+
     if (mode_skip_mask & (1 << mode_index))
       continue;
 
@@ -2660,12 +2673,6 @@
     if (rd_less_than_thresh(best_rd, rd_threshes[mode_index],
                             rd_thresh_freq_fact[mode_index]))
       continue;
-
-    this_mode = vp9_mode_order[mode_index].mode;
-    ref_frame = vp9_mode_order[mode_index].ref_frame[0];
-    if (ref_frame != INTRA_FRAME && !(inter_mode_mask & (1 << this_mode)))
-      continue;
-    second_ref_frame = vp9_mode_order[mode_index].ref_frame[1];
 
     if (cpi->sf.motion_field_mode_search) {
       const int mi_width  = MIN(num_8x8_blocks_wide_lookup[bsize],
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -119,6 +119,7 @@
     sf->adaptive_pred_interp_filter = 0;
     sf->cb_partition_search = frame_is_boosted(cpi) ? 0 : 1;
     sf->cb_pred_filter_search = 1;
+    sf->alt_ref_search_fp = 1;
     sf->motion_field_mode_search = frame_is_boosted(cpi) ? 0 : 1;
     sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
     sf->last_partitioning_redo_frequency = 3;
@@ -347,6 +348,7 @@
   sf->cb_pred_filter_search = 0;
   sf->cb_partition_search = 0;
   sf->motion_field_mode_search = 0;
+  sf->alt_ref_search_fp = 0;
   sf->use_quant_fp = 0;
   sf->reference_masking = 0;
   sf->partition_search_type = SEARCH_PARTITION;
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -291,6 +291,8 @@
 
   int motion_field_mode_search;
 
+  int alt_ref_search_fp;
+
   // Fast quantization process path
   int use_quant_fp;