# HG changeset patch # User aurel # Date 1186869541 0 # Node ID c3b57cc542e0d2d7d65a91075ff5c664336522a6 # Parent 317edea5d1a859cb1d59ae71afff8a9763aeb024 add a new av_clip_int16() function to libavutil diff -r 317edea5d1a8 -r c3b57cc542e0 avutil.h --- a/avutil.h Sat Aug 11 21:52:40 2007 +0000 +++ b/avutil.h Sat Aug 11 21:59:01 2007 +0000 @@ -30,8 +30,8 @@ #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s -#define LIBAVUTIL_VERSION_INT ((49<<16)+(4<<8)+1) -#define LIBAVUTIL_VERSION 49.4.1 +#define LIBAVUTIL_VERSION_INT ((49<<16)+(5<<8)+0) +#define LIBAVUTIL_VERSION 49.5.0 #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) diff -r 317edea5d1a8 -r c3b57cc542e0 common.h --- a/common.h Sat Aug 11 21:52:40 2007 +0000 +++ b/common.h Sat Aug 11 21:59:01 2007 +0000 @@ -192,6 +192,17 @@ else return a; } +/** + * clip a signed integer value into the -32768,32767 range + * @param a value to clip + * @return clipped value + */ +static inline int16_t av_clip_int16(int a) +{ + if ((a+32768) & ~65535) return (a>>31) ^ 32767; + else return a; +} + /* math */ int64_t ff_gcd(int64_t a, int64_t b);