adpcm: fix IMA SMJPEG decoding

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
(cherry picked from commit 01a01bf8bd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Paul B Mahol 2011-12-21 19:27:53 +00:00 committed by Michael Niedermayer
parent 4f94de84e8
commit 89cf156ace
1 changed files with 9 additions and 5 deletions

View File

@ -1007,11 +1007,15 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
break;
case CODEC_ID_ADPCM_IMA_AMV:
case CODEC_ID_ADPCM_IMA_SMJPEG:
c->status[0].predictor = (int16_t)bytestream_get_le16(&src);
c->status[0].step_index = bytestream_get_le16(&src);
if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
src+=4;
if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) {
c->status[0].predictor = sign_extend(bytestream_get_le16(&src), 16);
c->status[0].step_index = bytestream_get_le16(&src);
src += 4;
} else {
c->status[0].predictor = sign_extend(bytestream_get_be16(&src), 16);
c->status[0].step_index = bytestream_get_byte(&src);
src += 1;
}
for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
char hi, lo;