diff common.h @ 519:5cdb952bd09a libavutil

Add av_clipf() function to common.h and use it in ra288.c
author vitor
date Sun, 13 Jul 2008 19:59:44 +0000
parents 80cd26ba5c7c
children bd4052d9050c
line wrap: on
line diff
--- a/common.h	Sun Jul 13 14:56:01 2008 +0000
+++ b/common.h	Sun Jul 13 19:59:44 2008 +0000
@@ -225,6 +225,20 @@
     else                    return a;
 }
 
+/**
+ * clip a float value into the amin-amax range
+ * @param a value to clip
+ * @param amin minimum value of the clip range
+ * @param amax maximum value of the clip range
+ * @return clipped value
+ */
+static inline av_const float av_clipf(float a, float amin, float amax)
+{
+    if      (a < amin) return amin;
+    else if (a > amax) return amax;
+    else               return a;
+}
+
 /* math */
 int64_t av_const ff_gcd(int64_t a, int64_t b);