smacker audio: sign-extend the initial 16-bit predicted value
authorFranz Brauße <dev@karlchenofhell.org>
Fri, 30 Mar 2012 18:40:14 +0000 (14:40 -0400)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Sun, 1 Apr 2012 12:00:13 +0000 (14:00 +0200)
Fixes Bug #265

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 12cbbbb4abda2de0ea123282ccf7ebee61517f7d)

libavcodec/smacker.c

index fdc28e1..347e94d 100644 (file)
@@ -659,7 +659,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
     }
     if(bits) { //decode 16-bit data
         for(i = stereo; i >= 0; i--)
-            pred[i] = av_bswap16(get_bits(&gb, 16));
+            pred[i] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16);
         for(i = 0; i <= stereo; i++)
             *samples++ = pred[i];
         for(; i < unp_size / 2; i++) {