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 /libavcodec | |
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
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/adpcm.c | 6 |
1 files changed, 2 insertions, 4 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); |