summaryrefslogtreecommitdiff
path: root/vp8/encoder/firstpass.c
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2011-01-10 16:41:53 +0000
committerPaul Wilkins <paulwilkins@google.com>2011-01-10 16:41:53 +0000
commitcf7c4732e5be5c881a49f778ba011ea5d656f66e (patch)
treee6f2bfaf19b45feee4c240cf1ac3d4f99dc7ab90 /vp8/encoder/firstpass.c
parent405499d835a4a01fe09bc5ea01a2e7e77aaef8da (diff)
downloadlibvpx-cf7c4732e5be5c881a49f778ba011ea5d656f66e.tar
libvpx-cf7c4732e5be5c881a49f778ba011ea5d656f66e.tar.gz
libvpx-cf7c4732e5be5c881a49f778ba011ea5d656f66e.tar.bz2
libvpx-cf7c4732e5be5c881a49f778ba011ea5d656f66e.zip
Two Pass VBR change
Further experiment with restriction of the Q range. This uses the average non KF/GF/ARF quantizer, instead of just relying on the initial value. It is not such a strong constraint but there may be a reduced risk of rate misses. Change-Id: I424fe782a37a2f4e18c70805e240db55bfaa25ec
Diffstat (limited to 'vp8/encoder/firstpass.c')
-rw-r--r--vp8/encoder/firstpass.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index 48899162d..4d259c676 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -989,6 +989,19 @@ static int estimate_max_q(VP8_COMP *cpi, double section_err, int section_target_
//Q = cpi->oxcf.cq_target_quality;
}
+ // Adjust maxq_min_limit and maxq_max_limit limits based on
+ // averaga q observed in clip for non kf/gf.arf frames
+ // Give average a chance to settle though.
+ if ( (cpi->ni_frames >
+ ((unsigned int)cpi->total_stats->count >> 8)) &&
+ (cpi->ni_frames > 150) )
+ {
+ cpi->maxq_max_limit = ((cpi->ni_av_qi + 32) < cpi->worst_quality)
+ ? (cpi->ni_av_qi + 32) : cpi->worst_quality;
+ cpi->maxq_min_limit = ((cpi->ni_av_qi - 32) > cpi->best_quality)
+ ? (cpi->ni_av_qi - 32) : cpi->best_quality;
+ }
+
return Q;
}
static int estimate_q(VP8_COMP *cpi, double section_err, int section_target_bandwitdh, int Height, int Width)
@@ -2121,7 +2134,7 @@ void vp8_second_pass(VP8_COMP *cpi)
cpi->common.Width);
// Limit the maxq value returned subsequently.
- // This increases the risk of overspend if the initial
+ // This increases the risk of overspend or underspend if the initial
// estimate for the clip is bad, but helps prevent excessive
// variation in Q, especially near the end of a clip
// where for example a small overspend may cause Q to crash