From 6bff6cb5a9efe88c2cbe2c5f967560f68ee3ce29 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 12 Apr 2017 17:06:03 -0700 Subject: [PATCH] vp9: 1 pass VBR: Fix to rate control at low min-q. Fix to avoid getting stuck at very low Q even though content is changing, which can happen for --min-q=0. Fix is to more aggressively increase active_worst_quality when detecting significant rate_deviation at very low Q. Change will only affect 1 pass VBR for --min-q < 4, so no change in ytlive metrics for --min-q >= 4. Change-Id: I4dd77dd7c08a30a4390da0ff2c8bda6fccfa76d7 --- vp9/encoder/vp9_ratectrl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index f79b7c6fc..b1866cd8a 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -2172,6 +2172,11 @@ void adjust_gf_boost_lag_one_pass_vbr(VP9_COMP *cpi, uint64_t avg_sad_current) { if (rate_err < 2.0 && !high_content) { rc->fac_active_worst_inter = 120; rc->fac_active_worst_gf = 90; + } else if (rate_err > 8.0 && rc->avg_frame_qindex[INTER_FRAME] < 16) { + // Increase active_worst faster at low Q if rate fluctuation is high. + rc->fac_active_worst_inter = 200; + if (rc->avg_frame_qindex[INTER_FRAME] < 8) + rc->fac_active_worst_inter = 400; } if (low_content && rc->avg_frame_low_motion > 80) { rc->af_ratio_onepass_vbr = 15; -- 2.40.0