diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2008-07-13 23:59:44 +0400 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2008-07-13 23:59:44 +0400 |
commit | 4138ad961c4d577d32beb930155558d05bd2cfd3 (patch) | |
tree | 3fb5e811387f72b696a87cd79e4bb9b1cce86f49 /libavutil | |
parent | 8effdce0e70cb130feb5c8f0e89bc01c98d1764c (diff) |
Add av_clipf() function to common.h and use it in ra288.c
Originally committed as revision 14213 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/common.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h index 5a56832eeb..696b03e78b 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -225,6 +225,20 @@ static inline av_const int16_t av_clip_int16(int a) 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); |