1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

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
This commit is contained in:
Reimar Döffinger 2008-07-13 14:08:28 +00:00
parent e70f1a2067
commit ae8afab998
3 changed files with 12 additions and 12 deletions

View File

@ -603,16 +603,16 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
bytestream_put_le16(&dst, c->status[i].idelta); 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++){ for(i=0; i<avctx->channels; i++){
c->status[i].sample1= *samples++; c->status[i].sample1= *samples++;
bytestream_put_le16(&dst, c->status[i].sample1); bytestream_put_le16(&dst, c->status[i].sample1);
} }
for(i=0; i<avctx->channels; i++){ for(i=0; i<avctx->channels; i++)
c->status[i].sample2= *samples++;
bytestream_put_le16(&dst, c->status[i].sample2); bytestream_put_le16(&dst, c->status[i].sample2);
}
if(avctx->trellis > 0) { if(avctx->trellis > 0) {
int n = avctx->block_align - 7*avctx->channels; 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) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
if (st) src+=2; if (st) src+=2;
*samples++ = c->status[0].sample1;
if (st) *samples++ = c->status[1].sample1;
*samples++ = c->status[0].sample2; *samples++ = c->status[0].sample2;
if (st) *samples++ = c->status[1].sample2; if (st) *samples++ = c->status[1].sample2;
*samples++ = c->status[0].sample1;
if (st) *samples++ = c->status[1].sample1;
for(;n>0;n--) { for(;n>0;n--) {
*samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4 ); *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4 );
*samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F); *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F);

View File

@ -181,10 +181,10 @@ efdae2746040dbc27be402b149556f1e *./tests/data/a-adpcm_qt.aiff
281184 ./tests/data/a-adpcm_qt.aiff 281184 ./tests/data/a-adpcm_qt.aiff
5a2084ad27674d5cf3bc2945061e7910 *./tests/data/adpcm_ima_qt.vsynth.out.wav 5a2084ad27674d5cf3bc2945061e7910 *./tests/data/adpcm_ima_qt.vsynth.out.wav
stddev:915.35 PSNR:37.09 bytes:1056768 stddev:915.35 PSNR:37.09 bytes:1056768
628d4789cf9ee16a756ac54b7fd8650d *./tests/data/a-adpcm_ms.wav 88a0c48c9bc6d50a84c408151c6a3d64 *./tests/data/a-adpcm_ms.wav
267320 ./tests/data/a-adpcm_ms.wav 267320 ./tests/data/a-adpcm_ms.wav
91a84bb4f319a3a0bf0c0441b3d3a529 *./tests/data/adpcm_ms.vsynth.out.wav d5f98f5136040be42232a34df92d61f2 *./tests/data/adpcm_ms.vsynth.out.wav
stddev:1050.18 PSNR:35.89 bytes:1054720 stddev:1051.84 PSNR:35.88 bytes:1054720
ab11d9151644cbff27827b7e89f37aa9 *./tests/data/a-adpcm_yam.wav ab11d9151644cbff27827b7e89f37aa9 *./tests/data/a-adpcm_yam.wav
264248 ./tests/data/a-adpcm_yam.wav 264248 ./tests/data/a-adpcm_yam.wav
e92cec8c07913ffb91ad2b11f79cdc00 *./tests/data/adpcm_yam.vsynth.out.wav e92cec8c07913ffb91ad2b11f79cdc00 *./tests/data/adpcm_yam.vsynth.out.wav

View File

@ -181,10 +181,10 @@ efdae2746040dbc27be402b149556f1e *./tests/data/a-adpcm_qt.aiff
281184 ./tests/data/a-adpcm_qt.aiff 281184 ./tests/data/a-adpcm_qt.aiff
5a2084ad27674d5cf3bc2945061e7910 *./tests/data/adpcm_ima_qt.rotozoom.out.wav 5a2084ad27674d5cf3bc2945061e7910 *./tests/data/adpcm_ima_qt.rotozoom.out.wav
stddev:915.35 PSNR:37.09 bytes:1056768 stddev:915.35 PSNR:37.09 bytes:1056768
628d4789cf9ee16a756ac54b7fd8650d *./tests/data/a-adpcm_ms.wav 88a0c48c9bc6d50a84c408151c6a3d64 *./tests/data/a-adpcm_ms.wav
267320 ./tests/data/a-adpcm_ms.wav 267320 ./tests/data/a-adpcm_ms.wav
91a84bb4f319a3a0bf0c0441b3d3a529 *./tests/data/adpcm_ms.rotozoom.out.wav d5f98f5136040be42232a34df92d61f2 *./tests/data/adpcm_ms.rotozoom.out.wav
stddev:1050.18 PSNR:35.89 bytes:1054720 stddev:1051.84 PSNR:35.88 bytes:1054720
ab11d9151644cbff27827b7e89f37aa9 *./tests/data/a-adpcm_yam.wav ab11d9151644cbff27827b7e89f37aa9 *./tests/data/a-adpcm_yam.wav
264248 ./tests/data/a-adpcm_yam.wav 264248 ./tests/data/a-adpcm_yam.wav
e92cec8c07913ffb91ad2b11f79cdc00 *./tests/data/adpcm_yam.rotozoom.out.wav e92cec8c07913ffb91ad2b11f79cdc00 *./tests/data/adpcm_yam.rotozoom.out.wav