diff options
author | Daniel Verkamp <daniel@drv.nu> | 2009-03-21 15:52:14 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2009-03-21 15:52:14 +0000 |
commit | e1dc16ae5673b54a35737bf0fa99a76c2d20e803 (patch) | |
tree | 1cd780c7f0c1cda158d469f62ce2e9a23ed43b29 /libavcodec/smacker.c | |
parent | 2bbd85719c9402199ccbac60b6d6322f813e0885 (diff) | |
download | ffmpeg-e1dc16ae5673b54a35737bf0fa99a76c2d20e803.tar.gz |
Make Smacker audio decoder output audio in original bit depth
Patch by Daniel Verkamp
($firstname) at (three-letter file extension for drivers in Win 3.1) dot (nu)
Thread: [PATCH] Smacker: Output audio in original bit depth
Originally committed as revision 18111 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/smacker.c')
-rw-r--r-- | libavcodec/smacker.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 03241cf921..ad5827ea22 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -558,7 +558,6 @@ static av_cold int decode_end(AVCodecContext *avctx) static av_cold int smka_decode_init(AVCodecContext *avctx) { - avctx->sample_fmt = SAMPLE_FMT_S16; avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; return 0; } @@ -572,6 +571,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, HuffContext h[4]; VLC vlc[4]; int16_t *samples = data; + int8_t *samples8 = data; int val; int i, res; int unp_size; @@ -589,7 +589,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, } stereo = get_bits1(&gb); bits = get_bits1(&gb); - if (unp_size & 0xC0000000 || (unp_size << !bits) > *data_size) { + if (unp_size & 0xC0000000 || unp_size > *data_size) { av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n"); return -1; } @@ -655,7 +655,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, for(i = stereo; i >= 0; i--) pred[i] = get_bits(&gb, 8); for(i = 0; i < stereo; i++) - *samples++ = (pred[i] - 0x80) << 8; + *samples8++ = pred[i]; for(i = 0; i < unp_size; i++) { if(i & stereo){ if(vlc[1].table) @@ -663,17 +663,16 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, else res = 0; pred[1] += (int8_t)h[1].values[res]; - *samples++ = (pred[1] - 0x80) << 8; + *samples8++ = pred[1]; } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; pred[0] += (int8_t)h[0].values[res]; - *samples++ = (pred[0] - 0x80) << 8; + *samples8++ = pred[0]; } } - unp_size *= 2; } for(i = 0; i < 4; i++) { |