shithub: libvpx

Download patch

ref: 6432ae4902cf07a9751b02c2bc5ff9e9beca8960
parent: 9d477bd2fa286bc4bd3e532c5b563f53e4035eef
parent: aaa43ed38326f6df346b9156e79a12562cf1ffdd
author: Dmitry Kovalev <[email protected]>
date: Wed Feb 5 10:53:00 EST 2014

Merge "Clamping active_{best, worst}_quality values."

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -555,17 +555,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;