Mercurial > libavcodec.hg
changeset 7257:9b836800690a libavcodec
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
author | reimar |
---|---|
date | Sun, 13 Jul 2008 14:08:28 +0000 |
parents | 7c13d54f389d |
children | 48c9043b1372 |
files | adpcm.c |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/adpcm.c Sun Jul 13 12:23:02 2008 +0000 +++ b/adpcm.c Sun Jul 13 14:08:28 2008 +0000 @@ -604,15 +604,15 @@ 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 @@ if (st) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st) src+=2; + *samples++ = c->status[0].sample2; + if (st) *samples++ = c->status[1].sample2; *samples++ = c->status[0].sample1; if (st) *samples++ = c->status[1].sample1; - *samples++ = c->status[0].sample2; - if (st) *samples++ = c->status[1].sample2; 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);