[FFmpeg-cvslog] adpcm: fix IMA SMJPEG decoding

Paul B Mahol git at videolan.org
Fri Dec 23 03:38:00 CET 2011


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Dec 21 19:27:53 2011 +0000| [01a01bf8bdafab1c81c3039850aba042b247626f] | committer: Janne Grunau

adpcm: fix IMA SMJPEG decoding

Signed-off-by: Janne Grunau <janne-libav at jannau.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=01a01bf8bdafab1c81c3039850aba042b247626f
---

 libavcodec/adpcm.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 48f44fe..2081ef6 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1001,11 +1001,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;



More information about the ffmpeg-cvslog mailing list