]> granicus.if.org Git - libvpx/commitdiff
A small refactor on the rate controller
authorZoe Liu <zoeliu@google.com>
Tue, 19 Jul 2016 20:55:14 +0000 (13:55 -0700)
committerZoe Liu <zoeliu@google.com>
Tue, 19 Jul 2016 20:55:14 +0000 (13:55 -0700)
Change-Id: Ie39e16de2457dd201121c62967e4ddaf5a05c33a

vp10/encoder/ratectrl.c

index 2f2f2b72d6461e11c8f1a7ad9e48cfa45bc77881..6157c9e64cbdf5e305073c9ec3fce32c8e5fa9f0 100644 (file)
@@ -201,8 +201,7 @@ int vp10_rc_clamp_pframe_target_size(const VP10_COMP *const cpi, int target) {
   const VP10EncoderConfig *oxcf = &cpi->oxcf;
   const int min_frame_target = VPXMAX(rc->min_frame_bandwidth,
                                       rc->avg_frame_bandwidth >> 5);
-  if (target < min_frame_target)
-    target = min_frame_target;
+  // Clip the frame target to the minimum setup value.
 #if CONFIG_EXT_REFS
   if (cpi->rc.is_src_frame_alt_ref) {
 #else
@@ -213,7 +212,10 @@ int vp10_rc_clamp_pframe_target_size(const VP10_COMP *const cpi, int target) {
     // The active maximum quantizer insures that an appropriate
     // number of bits will be spent if needed for constructed ARFs.
     target = min_frame_target;
+  } else if (target < min_frame_target) {
+    target = min_frame_target;
   }
+
   // Clip the frame target to the maximum allowed value.
   if (target > rc->max_frame_bandwidth)
     target = rc->max_frame_bandwidth;
@@ -222,6 +224,7 @@ int vp10_rc_clamp_pframe_target_size(const VP10_COMP *const cpi, int target) {
                          oxcf->rc_max_inter_bitrate_pct / 100;
     target = VPXMIN(target, max_rate);
   }
+
   return target;
 }