diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2010-04-21 17:57:48 +0000 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2010-04-21 17:57:48 +0000 |
commit | b1078e9fe6b5d8f034d15a6ab91430fd41921fe2 (patch) | |
tree | 5d16af4805e9567267f3f3daa96e015523f4216c /libavutil | |
parent | 6858ce2ffc4c57a279b22ab6d8eb56ac3884796e (diff) | |
download | ffmpeg-b1078e9fe6b5d8f034d15a6ab91430fd41921fe2.tar.gz |
Move clipping of audio samples (for those codecs outputting float) from decoder
to the audio conversion routines.
Originally committed as revision 22937 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-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 11ae368826..8d7cc10012 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -145,6 +145,17 @@ static inline av_const int16_t av_clip_int16(int a) } /** + * Clips a signed 64-bit integer value into the -2147483648,2147483647 range. + * @param a value to clip + * @return clipped value + */ +static inline av_const int32_t av_clipl_int32(int64_t a) +{ + if ((a+2147483648) & ~2147483647) return (a>>63) ^ 2147483647; + else return a; +} + +/** * Clips a float value into the amin-amax range. * @param a value to clip * @param amin minimum value of the clip range |