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
This commit is contained in:
Paul Wilkins
2011-01-10 16:41:53 +00:00
parent 405499d835
commit cf7c4732e5
2 changed files with 43 additions and 22 deletions

View File

@@ -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