changeset 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 4b9f28275b14
children 1926f42527c7
files acelp_math.h
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
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 */