ref: 6a464eca0549fb1a539c9f5968d66e66cdf4cce9
parent: 43a83a273464d1d264c700d6c147c0889672e097
author: Jingning Han <[email protected]>
date: Mon Aug 18 06:42:23 EDT 2014
Speed up mode search depending on relative ref frame position This commit enables the encoder to record the location of the center frame to generate alter reference frame. It then allows to skip checking prediction modes of other reference frame types when it comes to encode this frame. The speed 3 runtime is reduced for the test sequences: bus at CIF 1000 kbps, 9791 ms -> 9446 ms, i.e., 3.5% speed-up, pedestrian at 1080p 2000 kbps, 184043 ms -> 175730 ms, i.e., 4.5% speed-up. No compression performance change observed. Change-Id: Iacfde3bcc1445964e7a241f239bd6ea11cb94bd1
--- 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;