diff options
author | Vladimir Voroshilov <voroshil@gmail.com> | 2008-05-11 11:49:25 +0000 |
---|---|---|
committer | Vladimir Voroshilov <voroshil@gmail.com> | 2008-05-11 11:49:25 +0000 |
commit | ce9eac7913dea1e6261c2fd99529fbbe32c2a7f0 (patch) | |
tree | 5e9c2383edef5dbf35377937e1bfede68652e7e9 /libavcodec/acelp_math.h | |
parent | 0a1b29dea7d8983532157df3a358e5fc9d319b20 (diff) | |
download | ffmpeg-ce9eac7913dea1e6261c2fd99529fbbe32c2a7f0.tar.gz |
Implement bidirectional (positive offset - left, negative - right)
signed shift for ACELP-based codecs.
Originally committed as revision 13117 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/acelp_math.h')
-rw-r--r-- | libavcodec/acelp_math.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/acelp_math.h b/libavcodec/acelp_math.h index cab957e292..e503df8984 100644 --- a/libavcodec/acelp_math.h +++ b/libavcodec/acelp_math.h @@ -72,4 +72,17 @@ static int sum_of_squares(const int16_t* speech, int length, int offset, int shi 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 */ |