shithub: libvpx

Download patch

ref: 39d20c6ac36b5406b620db15af7517892e0e885a
parent: a250ebf8b86371e9ffb76ceb4b22fb45d81bf0ac
parent: 42a89eb8cc0e80ff657f30f264e9c27630682094
author: Adrian Grange <[email protected]>
date: Wed Mar 11 12:09:49 EDT 2015

Merge "Clamp rate correction factor after scaling it"

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -377,7 +377,7 @@
       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) {
@@ -385,6 +385,8 @@
 
   // 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;