shithub: libvpx

Download patch

ref: aaa43ed38326f6df346b9156e79a12562cf1ffdd
parent: 1c96e3985e0fab5b288830deb44054bd3e5f0590
author: Dmitry Kovalev <dkovalev@google.com>
date: Fri Jan 24 08:46:56 EST 2014

Clamping active_{best, worst}_quality values.

Change-Id: If370f83080b403e417716d1edad58fdaa2b90170

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -695,17 +695,10 @@
   }
 
   // Clip the active best and worst quality values to limits
-  if (active_worst_quality > rc->worst_quality)
-    active_worst_quality = rc->worst_quality;
-
-  if (active_best_quality < rc->best_quality)
-    active_best_quality = rc->best_quality;
-
-  if (active_best_quality > rc->worst_quality)
-    active_best_quality = rc->worst_quality;
-
-  if (active_worst_quality < active_best_quality)
-    active_worst_quality = active_best_quality;
+  active_best_quality = clamp(active_best_quality,
+                              rc->best_quality, rc->worst_quality);
+  active_worst_quality = clamp(active_worst_quality,
+                               active_best_quality, rc->worst_quality);
 
   *top_index = active_worst_quality;
   *bottom_index = active_best_quality;
--