diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-04-18 13:26:23 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-04-18 14:38:21 +0000 |
commit | 3e9c0217fdd3f7a668c48b89361e0b970c29db56 (patch) | |
tree | ff8b9ddd5cabaf8d6611600c028e6e46a57f2339 /libavutil | |
parent | 5ae484e350e4f1b20b31802dac59ca3519627c0a (diff) | |
download | ffmpeg-3e9c0217fdd3f7a668c48b89361e0b970c29db56.tar.gz |
lavu: add av_clipd_c
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/common.h | 20 | ||||
-rw-r--r-- | libavutil/version.h | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/libavutil/common.h b/libavutil/common.h index beaf9f7635..e303c258e1 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -229,6 +229,23 @@ static av_always_inline av_const float av_clipf_c(float a, float amin, float ama else return a; } +/** + * Clip a double 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 av_always_inline av_const double av_clipd_c(double a, double amin, double amax) +{ +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + /** Compute ceil(log2(x)). * @param x value used to compute ceil(log2(x)) * @return computed ceiling of log2(x) @@ -428,6 +445,9 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) #ifndef av_clipf # define av_clipf av_clipf_c #endif +#ifndef av_clipd +# define av_clipd av_clipd_c +#endif #ifndef av_popcount # define av_popcount av_popcount_c #endif diff --git a/libavutil/version.h b/libavutil/version.h index 6531397a4e..e46e97c4a0 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -75,7 +75,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 52 -#define LIBAVUTIL_VERSION_MINOR 26 +#define LIBAVUTIL_VERSION_MINOR 27 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |