summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2014-10-28 13:03:06 +0000
committerPaul Wilkins <paulwilkins@google.com>2014-10-28 13:03:06 +0000
commit422d7bc918386b81ce5487c13898b78db241cd06 (patch)
tree13368edbd63f1c6bf8313b7dd629f8dd9aa394ca /vp9
parentd56b3eb0cff6161413df9bf9ab259cf569d5dc3c (diff)
downloadlibvpx-422d7bc918386b81ce5487c13898b78db241cd06.tar
libvpx-422d7bc918386b81ce5487c13898b78db241cd06.tar.gz
libvpx-422d7bc918386b81ce5487c13898b78db241cd06.tar.bz2
libvpx-422d7bc918386b81ce5487c13898b78db241cd06.zip
Relax maximum Q for extreme overshoot.
Added code to relax the active maximum Q in response to extreme local overshoot to reduce bandwidth peaks. The impact is small in metrics terms, but it this helps reduce bandwidth spikes and overall overshoot in a number of clips in our tests sets (especially the YT test set). In particular this should help prevent very big spikes where a clip is mainly easy but has a short hard section. In such a case a choice of maximum Q for the clip as a whole may allow us to hit the overall target rate but give some extreme spikes. The chunked encoding in YT mitigates this problem but it can show up where a longer clip is coded as a single chunk. Change-Id: I213d09950ccb8489d10adf00fda1e53235b39203
Diffstat (limited to 'vp9')
-rw-r--r--vp9/encoder/vp9_firstpass.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 5a67ef414..c8c784b73 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2478,7 +2478,6 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
}
#define MINQ_ADJ_LIMIT 32
-#define Q_LIMIT_STEP 1
void vp9_twopass_postencode_update(VP9_COMP *cpi) {
TWO_PASS *const twopass = &cpi->twopass;
RATE_CONTROL *const rc = &cpi->rc;
@@ -2523,16 +2522,22 @@ void vp9_twopass_postencode_update(VP9_COMP *cpi) {
if (rc->rate_error_estimate > cpi->oxcf.under_shoot_pct) {
--twopass->extend_maxq;
if (rc->rolling_target_bits >= rc->rolling_actual_bits)
- twopass->extend_minq += Q_LIMIT_STEP;
+ ++twopass->extend_minq;
// Overshoot.
} else if (rc->rate_error_estimate < -cpi->oxcf.over_shoot_pct) {
--twopass->extend_minq;
if (rc->rolling_target_bits < rc->rolling_actual_bits)
- twopass->extend_maxq += Q_LIMIT_STEP;
+ ++twopass->extend_maxq;
} else {
+ // Adjustment for extreme local overshoot.
+ if (rc->projected_frame_size > (2 * rc->base_frame_target) &&
+ rc->projected_frame_size > (2 * rc->avg_frame_bandwidth))
+ ++twopass->extend_maxq;
+
+ // Unwind undershoot or overshoot adjustment.
if (rc->rolling_target_bits < rc->rolling_actual_bits)
--twopass->extend_minq;
- if (rc->rolling_target_bits > rc->rolling_actual_bits)
+ else if (rc->rolling_target_bits > rc->rolling_actual_bits)
--twopass->extend_maxq;
}
twopass->extend_minq = clamp(twopass->extend_minq, 0, MINQ_ADJ_LIMIT);