summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_pickmode.c
diff options
context:
space:
mode:
authorMarco <marpan@google.com>2017-05-01 10:04:31 -0700
committerMarco <marpan@google.com>2017-05-01 10:36:54 -0700
commitae0215f9450f63453ed05f708ff42f7017b2858f (patch)
tree17a192e70a9fdf42f4e068fbbf3b887f1dff6945 /vp9/encoder/vp9_pickmode.c
parentd51d3934f590573e5be5178b17463d2cbc2ddc37 (diff)
downloadlibvpx-ae0215f9450f63453ed05f708ff42f7017b2858f.tar
libvpx-ae0215f9450f63453ed05f708ff42f7017b2858f.tar.gz
libvpx-ae0215f9450f63453ed05f708ff42f7017b2858f.tar.bz2
libvpx-ae0215f9450f63453ed05f708ff42f7017b2858f.zip
vp9: SVC: Early exit on golden ref in non-rd pickmode.
For SVC 1 pass real-time: add condition to skip the golden (spatial) reference mode in non-rd pickmode. Condition is to skip golden if the sse of zeromv-last mode is below threshold. And change order in ref_mode_set_svc to make sure golden zeromv is tested after last-nearest. Speedup ~3-4% with little/negligible quality loss. Change-Id: I6cbe314a93210454ba2997945f714015f1b2fca3
Diffstat (limited to 'vp9/encoder/vp9_pickmode.c')
-rw-r--r--vp9/encoder/vp9_pickmode.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c
index f8ef450f1..7e9136923 100644
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -1163,8 +1163,8 @@ static const REF_MODE ref_mode_set[RT_INTER_MODES] = {
{ ALTREF_FRAME, NEARMV }, { ALTREF_FRAME, NEWMV }
};
static const REF_MODE ref_mode_set_svc[RT_INTER_MODES] = {
- { LAST_FRAME, ZEROMV }, { GOLDEN_FRAME, ZEROMV },
- { LAST_FRAME, NEARESTMV }, { LAST_FRAME, NEARMV },
+ { LAST_FRAME, ZEROMV }, { LAST_FRAME, NEARESTMV },
+ { LAST_FRAME, NEARMV }, { GOLDEN_FRAME, ZEROMV },
{ GOLDEN_FRAME, NEARESTMV }, { GOLDEN_FRAME, NEARMV },
{ LAST_FRAME, NEWMV }, { GOLDEN_FRAME, NEWMV }
};
@@ -1481,6 +1481,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
int use_golden_nonzeromv = 1;
int force_skip_low_temp_var = 0;
int skip_ref_find_pred[4] = { 0 };
+ unsigned int sse_zeromv_normalized = UINT_MAX;
+ unsigned int thresh_svc_skip_golden = 500;
#if CONFIG_VP9_TEMPORAL_DENOISING
VP9_PICKMODE_CTX_DEN ctx_den;
int64_t zero_last_cost_orig = INT64_MAX;
@@ -1637,6 +1639,12 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
if (ref_frame > usable_ref_frame) continue;
if (skip_ref_find_pred[ref_frame]) continue;
+ // For SVC, skip the golden (spatial) reference search if sse of zeromv_last
+ // is below threshold.
+ if (cpi->use_svc && ref_frame == GOLDEN_FRAME &&
+ sse_zeromv_normalized < thresh_svc_skip_golden)
+ continue;
+
if (sf->short_circuit_flat_blocks && x->source_variance == 0 &&
this_mode != NEARESTMV) {
continue;
@@ -1915,6 +1923,12 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
model_rd_for_sb_y(cpi, bsize, x, xd, &this_rdc.rate, &this_rdc.dist,
&var_y, &sse_y);
}
+ // Save normalized sse (between current and last frame) for (0, 0) motion.
+ if (cpi->use_svc && ref_frame == LAST_FRAME &&
+ frame_mv[this_mode][ref_frame].as_int == 0) {
+ sse_zeromv_normalized =
+ sse_y >> (b_width_log2_lookup[bsize] + b_height_log2_lookup[bsize]);
+ }
}
if (!this_early_term) {