[FFmpeg-devel] [PATCH] Add sign_extend() function to mathops.h

Mans Rullgard mans
Mon Mar 2 22:21:44 CET 2009


---
 libavcodec/mathops.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 880e946..b92a6be 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -113,5 +113,12 @@ static inline av_const int mid_pred(int a, int b, int c)
 }
 #endif
 
+#ifndef sign_extend
+static inline av_const int sign_extend(int val, unsigned bits)
+{
+    return (val << (INT_BIT - bits)) >> (INT_BIT - bits);
+}
+#endif
+
 #endif /* AVCODEC_MATHOPS_H */
 
-- 
1.6.1.3





More information about the ffmpeg-devel mailing list