# HG changeset patch # User voroshil # Date 1210506565 0 # Node ID 6f402a181803eeb712b4061ff675eb573340d64e # Parent 4b9f28275b1412d4511de4ae145df0dc931f9143 Implement bidirectional (positive offset - left, negative - right) signed shift for ACELP-based codecs. diff -r 4b9f28275b14 -r 6f402a181803 acelp_math.h --- 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 */