summaryrefslogtreecommitdiff
path: root/libavcodec/g723_1.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2012-08-02 07:50:49 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2012-08-03 07:07:07 +0200
commit8ddadea171fa38563cc1ff9a78d4cd07655c0e1b (patch)
treee6dbf192f42964157aec5dc174610a6aa1c38956 /libavcodec/g723_1.c
parent8772d2511a4ac45f275eaef2b4b6b1ef132c993b (diff)
g723_1: make scale_vector() behave like the reference
Diffstat (limited to 'libavcodec/g723_1.c')
-rw-r--r--libavcodec/g723_1.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index 91f1b86170..4ad74f4448 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -282,7 +282,8 @@ static int normalize_bits(int num, int width)
*/
static int scale_vector(int16_t *vector, int length)
{
- int bits, scale, max = 0;
+ int bits, max = 0;
+ int64_t scale;
int i;
@@ -293,7 +294,7 @@ static int scale_vector(int16_t *vector, int length)
scale = (bits == 15) ? 0x7FFF : (1 << bits);
for (i = 0; i < length; i++)
- vector[i] = (vector[i] * scale) >> 4;
+ vector[i] = av_clipl_int32(vector[i] * scale << 1) >> 4;
return bits - 3;
}