diff options
author | Paul Wilkins <paulwilkins@google.com> | 2017-02-09 17:17:55 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-02-09 17:17:55 +0000 |
commit | c3f095c8b3c6eac510e892a7624162da1a655593 (patch) | |
tree | 47fff94edfc582a3e5948ea1d0bf40290d72bcaf /vp9/encoder/vp9_encoder.c | |
parent | 82b88a7fd0803e0b8b98f200324d4899158cf30e (diff) | |
parent | 5f21aba4b011602f87a5a10b619ec52fb8303075 (diff) | |
download | libvpx-c3f095c8b3c6eac510e892a7624162da1a655593.tar libvpx-c3f095c8b3c6eac510e892a7624162da1a655593.tar.gz libvpx-c3f095c8b3c6eac510e892a7624162da1a655593.tar.bz2 libvpx-c3f095c8b3c6eac510e892a7624162da1a655593.zip |
Merge "Fix to avoid abrupt relaxation of max qindex in recode path"
Diffstat (limited to 'vp9/encoder/vp9_encoder.c')
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 323907fc3..50fa8c682 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -3507,8 +3507,14 @@ static void encode_with_recode_loop(VP9_COMP *cpi, size_t *size, // Frame is too large if (rc->projected_frame_size > rc->this_frame_target) { // Special case if the projected size is > the max allowed. - if (rc->projected_frame_size >= rc->max_frame_bandwidth) - q_high = rc->worst_quality; + if (rc->projected_frame_size >= rc->max_frame_bandwidth) { + double q_val_high; + q_val_high = vp9_convert_qindex_to_q(q_high, cm->bit_depth); + q_val_high = q_val_high * ((double)rc->projected_frame_size / + rc->max_frame_bandwidth); + q_high = vp9_convert_q_to_qindex(q_val_high, cm->bit_depth); + q_high = clamp(q_high, rc->best_quality, rc->worst_quality); + } // Raise Qlow as to at least the current value qstep = |