[FFmpeg-cvslog] r23713 - trunk/libavutil/common.h

rbultje subversion
Tue Jun 22 21:11:33 CEST 2010


Author: rbultje
Date: Tue Jun 22 21:11:33 2010
New Revision: 23713

Log:
Add av_clip_int8(), used in the upcoming VP8 decoder.

Modified:
   trunk/libavutil/common.h

Modified: trunk/libavutil/common.h
==============================================================================
--- trunk/libavutil/common.h	Tue Jun 22 21:06:35 2010	(r23712)
+++ trunk/libavutil/common.h	Tue Jun 22 21:11:33 2010	(r23713)
@@ -123,6 +123,17 @@ static inline av_const uint8_t av_clip_u
 }
 
 /**
+ * Clips a signed integer value into the -128,127 range.
+ * @param a value to clip
+ * @return clipped value
+ */
+static inline av_const int8_t av_clip_int8(int a)
+{
+    if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F;
+    else                  return a;
+}
+
+/**
  * Clips a signed integer value into the 0-65535 range.
  * @param a value to clip
  * @return clipped value



More information about the ffmpeg-cvslog mailing list