diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2009-08-13 18:47:13 +0000 |
---|---|---|
committer | Ramiro Polla <ramiro.polla@gmail.com> | 2009-08-13 18:47:13 +0000 |
commit | f51fb686de61215dfaea5ff7654a12bf528791b7 (patch) | |
tree | fdcdd08aae396c1afb9cbfbb75320f28ca8edbc9 /libavutil/common.h | |
parent | d426ea20c9ac9086a7f2d22e55131b5ea7c5cb37 (diff) | |
download | ffmpeg-f51fb686de61215dfaea5ff7654a12bf528791b7.tar.gz |
Introduce av_clip_uint16().
Originally committed as revision 19636 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/common.h')
-rw-r--r-- | libavutil/common.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h index 47666ab20a..9fac1c0aa4 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -190,6 +190,17 @@ static inline av_const uint8_t av_clip_uint8(int a) } /** + * Clips a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static inline av_const uint16_t av_clip_uint16(int a) +{ + if (a&(~65535)) return (-a)>>31; + else return a; +} + +/** * Clips a signed integer value into the -32768,32767 range. * @param a value to clip * @return clipped value |