diff acelp_math.h @ 6777:6f402a181803 libavcodec

Implement bidirectional (positive offset - left, negative - right) signed shift for ACELP-based codecs.
author voroshil
date Sun, 11 May 2008 11:49:25 +0000
parents 4db65caccc9b
children ff5ef7becd94
line wrap: on
line diff
--- a/acelp_math.h	Sun May 11 11:15:18 2008 +0000
+++ b/acelp_math.h	Sun May 11 11:49:25 2008 +0000
@@ -72,4 +72,17 @@
     return sum;
 }
 
+/**
+ * \brief Shift value left or right depending on sign of offset parameter.
+ * \param value value to shift
+ * \param offset shift offset
+ *
+ * \return value << offset, if offset>=0; value >> -offset - otherwise
+ */
+static inline int bidir_sal(int value, int offset)
+{
+    if(offset < 0) return value >> -offset;
+    else           return value <<  offset;
+}
+
 #endif /* FFMPEG_ACELP_MATH_H */