Mercurial > libavcodec.hg
changeset 5877:aea495619138 libavcodec
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
author | benoit |
---|---|
date | Tue, 06 Nov 2007 13:08:04 +0000 |
parents | 731ee5ad6bde |
children | 6c962a4004a1 |
files | adpcm.c |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/adpcm.c Mon Nov 05 18:16:42 2007 +0000 +++ b/adpcm.c Tue Nov 06 13:08:04 2007 +0000 @@ -451,7 +451,7 @@ *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 @@ 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);