summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_pickmode.c
diff options
context:
space:
mode:
authorMarco <marpan@google.com>2016-08-15 10:22:40 -0700
committerMarco <marpan@google.com>2016-08-17 14:33:44 -0700
commit7eb7d6b22742ed0436f52c7e9dae4ce7d90b0ccd (patch)
tree7416fd16f1e5324be093efdbd79b09c3eb5734a3 /vp9/encoder/vp9_pickmode.c
parentaf3b0de732e2c90dd7216894559f3b1a5b5f21e5 (diff)
downloadlibvpx-7eb7d6b22742ed0436f52c7e9dae4ce7d90b0ccd.tar
libvpx-7eb7d6b22742ed0436f52c7e9dae4ce7d90b0ccd.tar.gz
libvpx-7eb7d6b22742ed0436f52c7e9dae4ce7d90b0ccd.tar.bz2
libvpx-7eb7d6b22742ed0436f52c7e9dae4ce7d90b0ccd.zip
vp9 non-rd pickmode: Add limit on newmv-last and golden bias.
Add option, for newmv-last, to limit the rd-threshold update for early exit, under a source varianace condition. This can improve visual quality in low texture moving areas, like forehead/faces. Also add bias against golden to improve the speed/fps, will little/negligible loss in quality. Only affects CBR mode, non-svc, non-screen-content. Change-Id: I3a5229eee860c71499a6fd464c450b167b07534d
Diffstat (limited to 'vp9/encoder/vp9_pickmode.c')
-rw-r--r--vp9/encoder/vp9_pickmode.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c
index 9186039c1..b95514332 100644
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -978,19 +978,21 @@ static int mode_offset(const PREDICTION_MODE mode) {
}
}
-static INLINE void update_thresh_freq_fact(VP9_COMP *cpi,
- TileDataEnc *tile_data,
- BLOCK_SIZE bsize,
- MV_REFERENCE_FRAME ref_frame,
- THR_MODES best_mode_idx,
- PREDICTION_MODE mode) {
+static INLINE void update_thresh_freq_fact(
+ VP9_COMP *cpi, TileDataEnc *tile_data, int source_variance,
+ BLOCK_SIZE bsize, MV_REFERENCE_FRAME ref_frame, THR_MODES best_mode_idx,
+ PREDICTION_MODE mode) {
THR_MODES thr_mode_idx = mode_idx[ref_frame][mode_offset(mode)];
int *freq_fact = &tile_data->thresh_freq_fact[bsize][thr_mode_idx];
if (thr_mode_idx == best_mode_idx)
*freq_fact -= (*freq_fact >> 4);
- else
+ else if (cpi->sf.limit_newmv_early_exit && mode == NEWMV &&
+ ref_frame == LAST_FRAME && source_variance < 5) {
+ *freq_fact = VPXMIN(*freq_fact + RD_THRESH_INC, 32);
+ } else {
*freq_fact = VPXMIN(*freq_fact + RD_THRESH_INC,
cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT);
+ }
}
void vp9_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost,
@@ -1438,7 +1440,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
mi->tx_size =
VPXMIN(max_txsize_lookup[bsize], tx_mode_to_biggest_tx_size[cm->tx_mode]);
- if (sf->short_circuit_flat_blocks) {
+ if (sf->short_circuit_flat_blocks || sf->limit_newmv_early_exit) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
x->source_variance = vp9_high_get_sby_perpixel_variance(
@@ -1558,6 +1560,13 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
mode_index = mode_idx[ref_frame][INTER_OFFSET(this_mode)];
mode_rd_thresh = best_mode_skip_txfm ? rd_threshes[mode_index] << 1
: rd_threshes[mode_index];
+
+ // Increase mode_rd_thresh value for GOLDEN_FRAME for improved encoding
+ // speed with little/no subjective quality loss.
+ if (cpi->sf.bias_golden && ref_frame == GOLDEN_FRAME &&
+ cpi->rc.frames_since_golden > 4)
+ mode_rd_thresh = mode_rd_thresh << 3;
+
if (rd_less_than_thresh(best_rdc.rdcost, mode_rd_thresh,
rd_thresh_freq_fact[mode_index]))
continue;
@@ -2032,16 +2041,16 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
// TODO(yunqingwang): Check intra mode mask and only update freq_fact
// for those valid modes.
for (i = 0; i < intra_modes; i++) {
- update_thresh_freq_fact(cpi, tile_data, bsize, INTRA_FRAME,
- best_mode_idx, intra_mode_list[i]);
+ update_thresh_freq_fact(cpi, tile_data, x->source_variance, bsize,
+ INTRA_FRAME, best_mode_idx, intra_mode_list[i]);
}
} else {
for (ref_frame = LAST_FRAME; ref_frame <= GOLDEN_FRAME; ++ref_frame) {
PREDICTION_MODE this_mode;
if (best_ref_frame != ref_frame) continue;
for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) {
- update_thresh_freq_fact(cpi, tile_data, bsize, ref_frame,
- best_mode_idx, this_mode);
+ update_thresh_freq_fact(cpi, tile_data, x->source_variance, bsize,
+ ref_frame, best_mode_idx, this_mode);
}
}
}