diff options
author | Timofei V. Bondarenko <tim@ipi.ac.ru> | 2007-11-06 13:08:04 +0000 |
---|---|---|
committer | Benoit Fouet <benoit.fouet@free.fr> | 2007-11-06 13:08:04 +0000 |
commit | 62b341525879ff47cd4e0636c096b614348272e2 (patch) | |
tree | 7a55f101b45144d766fb92577a3ae9624e05109f | |
parent | 3837d107b76138680ba450cc1bddc3dc9bd9b00e (diff) | |
download | ffmpeg-62b341525879ff47cd4e0636c096b614348272e2.tar.gz |
fix predictor initialization for adpcm-ima encoder not to lose first sample
in block in adpcm-ima decoder
Patch by Timofei V. Bondarenko: tim £ ipi, ac, ru
Original thread: [FFmpeg-devel] [PATCH] adpcm-ima-wav header and codec
Date: 10/15/2007 05:55 PM
Originally committed as revision 10933 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/adpcm.c | 6 | ||||
-rw-r--r-- | tests/ffmpeg.regression.ref | 6 | ||||
-rw-r--r-- | tests/rotozoom.regression.ref | 6 |
3 files changed, 8 insertions, 10 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 8997780158..b68b064f11 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -451,7 +451,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, *dst++ = 0; /* unknown */ samples++; if (avctx->channels == 2) { - c->status[1].prev_sample = (signed short)samples[1]; + c->status[1].prev_sample = (signed short)samples[0]; /* c->status[1].step_index = 0; */ bytestream_put_le16(&dst, c->status[1].prev_sample); *dst++ = (unsigned char)c->status[1].step_index; @@ -936,11 +936,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx, for(i=0; i<avctx->channels; i++){ cs = &(c->status[i]); - cs->predictor = (int16_t)(src[0] + (src[1]<<8)); + cs->predictor = *samples++ = (int16_t)(src[0] + (src[1]<<8)); src+=2; - // XXX: is this correct ??: *samples++ = cs->predictor; - cs->step_index = *src++; if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index 42c644055b..0d837165ee 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -176,10 +176,10 @@ aefe11ab5067621a1c674859d6413891 *./tests/data/a-ac3.rm 24279 ./tests/data/a-g726.wav 888f2f016e608d044a1bacbca5497ed2 *./tests/data/out.wav stddev:8368.02 PSNR:17.87 bytes:96256 -de3f0e1f50b19bd8572fdd3dee2e72c4 *./tests/data/a-adpcm_ima.wav +3b969c43e45582f713e3c35faee9e0cc *./tests/data/a-adpcm_ima.wav 266300 ./tests/data/a-adpcm_ima.wav -60178d48204f5662d91776e36eddc82e *./tests/data/out.wav -stddev:11441.89 PSNR:15.15 bytes:1054720 +947196b1739a9d6fe0c29424cf61cd8c *./tests/data/out.wav +stddev:904.20 PSNR:37.19 bytes:1056768 628d4789cf9ee16a756ac54b7fd8650d *./tests/data/a-adpcm_ms.wav 267320 ./tests/data/a-adpcm_ms.wav 91a84bb4f319a3a0bf0c0441b3d3a529 *./tests/data/out.wav diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index 9e7851f09b..106c6a0da5 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -176,10 +176,10 @@ aefe11ab5067621a1c674859d6413891 *./tests/data/a-ac3.rm 24279 ./tests/data/a-g726.wav 888f2f016e608d044a1bacbca5497ed2 *./tests/data/out.wav stddev:8368.02 PSNR:17.87 bytes:96256 -de3f0e1f50b19bd8572fdd3dee2e72c4 *./tests/data/a-adpcm_ima.wav +3b969c43e45582f713e3c35faee9e0cc *./tests/data/a-adpcm_ima.wav 266300 ./tests/data/a-adpcm_ima.wav -60178d48204f5662d91776e36eddc82e *./tests/data/out.wav -stddev:11441.89 PSNR:15.15 bytes:1054720 +947196b1739a9d6fe0c29424cf61cd8c *./tests/data/out.wav +stddev:904.20 PSNR:37.19 bytes:1056768 628d4789cf9ee16a756ac54b7fd8650d *./tests/data/a-adpcm_ms.wav 267320 ./tests/data/a-adpcm_ms.wav 91a84bb4f319a3a0bf0c0441b3d3a529 *./tests/data/out.wav |