diff options
author | Marco <marpan@google.com> | 2017-05-21 22:15:28 -0700 |
---|---|---|
committer | Marco <marpan@google.com> | 2017-05-21 22:21:44 -0700 |
commit | 2adc0443dd3701d0236a44e9e0670b50c15d30a2 (patch) | |
tree | 42003bb1f929dd16f5d14974c860e34614a0f2fc /vp9/encoder/vp9_aq_cyclicrefresh.c | |
parent | b5055002d7a57ed21badf870f2af384193ac89b6 (diff) | |
download | libvpx-2adc0443dd3701d0236a44e9e0670b50c15d30a2.tar libvpx-2adc0443dd3701d0236a44e9e0670b50c15d30a2.tar.gz libvpx-2adc0443dd3701d0236a44e9e0670b50c15d30a2.tar.bz2 libvpx-2adc0443dd3701d0236a44e9e0670b50c15d30a2.zip |
vp9: Adjustments to cyclic refresh for high motion.
For aq-mode=3: refactor the condition for turning off
the refresh. Add some adjustments for high motion content.
No/little change in RTC metrics, only affects high motion case.
Change-Id: I7da8eabfb0e61db014be4562806f72ee5ef4a43b
Diffstat (limited to 'vp9/encoder/vp9_aq_cyclicrefresh.c')
-rw-r--r-- | vp9/encoder/vp9_aq_cyclicrefresh.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index b4a0bbe58..048ea629f 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -277,8 +277,6 @@ void vp9_cyclic_refresh_postencode(VP9_COMP *const cpi) { !cpi->oxcf.gf_cbr_boost_pct) { // Force this frame as a golden update frame if this frame changes the // resolution (resize_pending != 0). - // TODO(marpan): check on forcing golden update if the background has very - // high motion in current frame. if (cpi->resize_pending != 0) { vp9_cyclic_refresh_set_golden_update(cpi); rc->frames_till_gf_update_due = rc->baseline_gf_interval; @@ -316,6 +314,8 @@ void vp9_cyclic_refresh_set_golden_update(VP9_COMP *const cpi) { else rc->baseline_gf_interval = 40; if (cpi->oxcf.rc_mode == VPX_VBR) rc->baseline_gf_interval = 20; + if (rc->avg_frame_low_motion < 50 && rc->frames_since_key > 40) + rc->baseline_gf_interval = 10; } // Update the segmentation map, and related quantities: cyclic refresh map, @@ -425,6 +425,13 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) { int target_refresh = 0; double weight_segment_target = 0; double weight_segment = 0; + cr->apply_cyclic_refresh = 1; + if (cm->frame_type == KEY_FRAME || cpi->svc.temporal_layer_id > 0 || + (!cpi->use_svc && rc->avg_frame_low_motion < 55 && + rc->frames_since_key > 40)) { + cr->apply_cyclic_refresh = 0; + return; + } cr->percent_refresh = 10; if (cr->reduce_refresh) cr->percent_refresh = 5; cr->max_qdelta_perc = 60; @@ -493,14 +500,8 @@ void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) { const RATE_CONTROL *const rc = &cpi->rc; CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; struct segmentation *const seg = &cm->seg; - // TODO(marpan): Look into whether we should reduce the amount/delta-qp - // instead of completely shutting off at low bitrates. For now keep it on. - // const int apply_cyclic_refresh = apply_cyclic_refresh_bitrate(cm, rc); - const int apply_cyclic_refresh = 1; if (cm->current_video_frame == 0) cr->low_content_avg = 0.0; - // Don't apply refresh on key frame or temporal enhancement layer frames. - if (!apply_cyclic_refresh || (cm->frame_type == KEY_FRAME) || - (cpi->force_update_segmentation) || (cpi->svc.temporal_layer_id > 0)) { + if (!cr->apply_cyclic_refresh || (cpi->force_update_segmentation)) { // Set segmentation map to 0 and disable. unsigned char *const seg_map = cpi->segmentation_map; memset(seg_map, 0, cm->mi_rows * cm->mi_cols); |