]> git.sesse.net Git - ffmpeg/commitdiff
add a new av_clip_int16() function to libavutil
authorAurelien Jacobs <aurel@gnuage.org>
Sat, 11 Aug 2007 21:59:01 +0000 (21:59 +0000)
committerAurelien Jacobs <aurel@gnuage.org>
Sat, 11 Aug 2007 21:59:01 +0000 (21:59 +0000)
Originally committed as revision 10076 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavutil/avutil.h
libavutil/common.h

index b491dc9c1468bfb5af9d618807999da24e8cde29..518de4bb18ff462d01c0cd2da2ff24042608fe76 100644 (file)
@@ -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)
index bbade55bfa881c4a16a15936fcd953d095b8f587..955040350345dc5fdedcaae79a429a24aecc5755 100644 (file)
@@ -192,6 +192,17 @@ static inline uint8_t av_clip_uint8(int a)
     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);