[FFmpeg-devel] [PATCH] lavu/common: add av_clipl_uint32_c

Lukasz Marek lukasz.m.luki at gmail.com
Thu Nov 21 01:42:38 CET 2013


Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
---
 libavutil/common.h  | 11 +++++++++++
 libavutil/version.h |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavutil/common.h b/libavutil/common.h
index e487218..3b92359 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -173,6 +173,17 @@ static av_always_inline av_const int16_t av_clip_int16_c(int a)
 }
 
 /**
+ * Clip a signed 64-bit integer value into the 0 - 4294967295 range.
+ * @param a value to clip
+ * @return clipped value
+ */
+static av_always_inline av_const uint32_t av_clipl_uint32_c(int64_t a)
+{
+    if (a & INT64_C(~0xFFFFFFFF)) return (uint32_t)((-a)>>63);
+    else                          return (uint32_t)a;
+}
+
+/**
  * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
  * @param a value to clip
  * @return clipped value
diff --git a/libavutil/version.h b/libavutil/version.h
index 3e64a20..c01da93 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -75,7 +75,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  52
-#define LIBAVUTIL_VERSION_MINOR  53
+#define LIBAVUTIL_VERSION_MINOR  54
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
1.8.3.2



More information about the ffmpeg-devel mailing list