aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2008-07-13 14:08:28 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2008-07-13 14:08:28 +0000
commitae8afab99883f6a98f036364bbaf5b0587257b11 (patch)
treea18512b343c2f36fe523b6fe4d9ea7dda4b309dd /libavcodec/adpcm.c
parente70f1a2067c28474356e1a01f0d6e15d8f147318 (diff)
downloadffmpeg-ae8afab99883f6a98f036364bbaf5b0587257b11.tar.gz
Fix MS ADPCM de- and encoding: first and second sample are swapped.
Noticeable better decoding of e.g. http://samples.mplayerhq.hu/A-codecs/msadpcm-stereo/dance-b5th.asf Originally committed as revision 14201 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index a9a8f74d9b..b4b716f13f 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -604,15 +604,15 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
bytestream_put_le16(&dst, c->status[i].idelta);
}
for(i=0; i<avctx->channels; i++){
+ c->status[i].sample2= *samples++;
+ }
+ for(i=0; i<avctx->channels; i++){
c->status[i].sample1= *samples++;
bytestream_put_le16(&dst, c->status[i].sample1);
}
- for(i=0; i<avctx->channels; i++){
- c->status[i].sample2= *samples++;
-
+ for(i=0; i<avctx->channels; i++)
bytestream_put_le16(&dst, c->status[i].sample2);
- }
if(avctx->trellis > 0) {
int n = avctx->block_align - 7*avctx->channels;
@@ -1050,10 +1050,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
if (st) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
if (st) src+=2;
- *samples++ = c->status[0].sample1;
- if (st) *samples++ = c->status[1].sample1;
*samples++ = c->status[0].sample2;
if (st) *samples++ = c->status[1].sample2;
+ *samples++ = c->status[0].sample1;
+ if (st) *samples++ = c->status[1].sample1;
for(;n>0;n--) {
*samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4 );
*samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F);