diff options
author | Paul Wilkins <paulwilkins@google.com> | 2018-09-06 15:56:01 +0100 |
---|---|---|
committer | Jingning Han <jingning@google.com> | 2018-09-08 02:45:08 +0000 |
commit | bb58dfade710c94fc78b50a50f76925863873f38 (patch) | |
tree | 95d4c5f82c6913a6283bac7bc5feaf96bad52e9b | |
parent | 2d65fc2ce68a1d82680bfc4de4148f5684e02109 (diff) | |
download | libvpx-bb58dfade710c94fc78b50a50f76925863873f38.tar libvpx-bb58dfade710c94fc78b50a50f76925863873f38.tar.gz libvpx-bb58dfade710c94fc78b50a50f76925863873f38.tar.bz2 libvpx-bb58dfade710c94fc78b50a50f76925863873f38.zip |
Fix rate control bug with recode all.
This patch fixes a rate control bug that can manifest if the recode
loop is activated for all frame types. Specifically things go wrong when the
recode loop is used on an overlay frame that has a rate target of 0 bits.
The patch prevents adjustment of the active worst quality and repeat recode
loops for overlay frames.
The bug showed up during artificial experiments on re-distribution of bits in
ARF groups but does not activate in any current encode profile, as even best
best quality does not currently allow recodes for all frames.
Change-Id: I80872093d9ebd3350106230c42c3928e56ecb754
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 1fd4a036a..ed8467443 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -4342,8 +4342,9 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size, // Special case if the projected size is > the max allowed. if ((q == q_high) && ((rc->projected_frame_size >= rc->max_frame_bandwidth) || - (rc->projected_frame_size >= - big_rate_miss_high_threshold(cpi)))) { + (!rc->is_src_frame_alt_ref && + (rc->projected_frame_size >= + big_rate_miss_high_threshold(cpi))))) { int max_rate = VPXMAX(1, VPXMIN(rc->max_frame_bandwidth, big_rate_miss_high_threshold(cpi))); double q_val_high; @@ -4448,7 +4449,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size, #endif // Have we been forced to adapt Q outside the expected range by an extreme // rate miss. If so adjust the active maxQ for the subsequent frames. - if (q > cpi->twopass.active_worst_quality) { + if (!rc->is_src_frame_alt_ref && (q > cpi->twopass.active_worst_quality)) { cpi->twopass.active_worst_quality = q; } else if (oxcf->vbr_corpus_complexity && q == q_low && rc->projected_frame_size < rc->this_frame_target) { |