ref: 740782f8cd899bb35782a0527c688de8127eee76
parent: d30966609b90feae14baceaf068df2f143fb85c8
author: Marco Paniconi <marpan@google.com>
date: Wed Apr 18 13:15:16 EDT 2018
vp9: Rate control fix for CBR mode. For CBR mode: modify the qp clamping to allow q to respond faster to overshoot. Can reduce some suprious overshoot events observed in screen content coding. Change-Id: I0b3f54b0d1b4086182f834e557a4121950b176d4
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -620,8 +620,14 @@
!(cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame)) &&
(cpi->rc.rc_1_frame * cpi->rc.rc_2_frame == -1) &&
cpi->rc.q_1_frame != cpi->rc.q_2_frame) {
- q = clamp(q, VPXMIN(cpi->rc.q_1_frame, cpi->rc.q_2_frame),
- VPXMAX(cpi->rc.q_1_frame, cpi->rc.q_2_frame));
+ int qclamp = clamp(q, VPXMIN(cpi->rc.q_1_frame, cpi->rc.q_2_frame),
+ VPXMAX(cpi->rc.q_1_frame, cpi->rc.q_2_frame));
+ // If the previous had overshoot and the current q needs to increase above
+ // the clamped value, reduce the clamp for faster reaction to overshoot.
+ if (cpi->rc.rc_1_frame == -1 && q > qclamp)
+ q = (q + qclamp) >> 1;
+ else
+ q = qclamp;
}
return q;
}