Merge "Clamp rate correction factor after scaling it"

This commit is contained in:
Adrian Grange 2015-03-11 16:09:49 -07:00 committed by Gerrit Code Review
commit 39d20c6ac3

View File

@ -377,7 +377,7 @@ static double get_rate_correction_factor(const VP9_COMP *cpi) {
rcf = rc->rate_correction_factors[INTER_NORMAL];
}
rcf *= rcf_mult[rc->frame_size_selector];
return rcf > MAX_BPB_FACTOR ? MAX_BPB_FACTOR : rcf;
return fclamp(rcf, MIN_BPB_FACTOR, MAX_BPB_FACTOR);
}
static void set_rate_correction_factor(VP9_COMP *cpi, double factor) {
@ -386,6 +386,8 @@ static void set_rate_correction_factor(VP9_COMP *cpi, double factor) {
// Normalize RCF to account for the size-dependent scaling factor.
factor /= rcf_mult[cpi->rc.frame_size_selector];
factor = fclamp(factor, MIN_BPB_FACTOR, MAX_BPB_FACTOR);
if (cpi->common.frame_type == KEY_FRAME) {
rc->rate_correction_factors[KF_STD] = factor;
} else if (cpi->oxcf.pass == 2) {