From 37293583cd53f2bf8a5ff32018bf6e3f3ff6ad04 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 30 Sep 2015 18:27:49 -0700 Subject: [PATCH] Stabilize the encoder buffer from going too negative. For screen-content mode, with frame dropper off, put a limit on how low encoder buffer can go. Under hard slide changes, the buffer level can go too low and then take long time to come back up (in particular when frame-dropping is not used), which will affect the active_worst and target frame size. Change-Id: Ie9fca097e05cd71141f978ec687f852daf9de332 --- vp9/encoder/vp9_ratectrl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 4fe556111..2146b4fda 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -271,6 +271,13 @@ static void update_buffer_level(VP9_COMP *cpi, int encoded_frame_size) { // Clip the buffer level to the maximum specified buffer size. rc->bits_off_target = VPXMIN(rc->bits_off_target, rc->maximum_buffer_size); + + // For screen-content mode, and if frame-dropper is off, don't let buffer + // level go below threshold, given here as -rc->maximum_ buffer_size. + if (cpi->oxcf.content == VP9E_CONTENT_SCREEN && + cpi->oxcf.drop_frames_water_mark == 0) + rc->bits_off_target = VPXMAX(rc->bits_off_target, -rc->maximum_buffer_size); + rc->buffer_level = rc->bits_off_target; if (is_one_pass_cbr_svc(cpi)) { -- 2.40.0