[FFmpeg-cvslog] adpcm: convert adpcm_xa to bytestream2.

Ronald S. Bultje git at videolan.org
Tue Mar 20 00:16:50 CET 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Sat Mar 17 17:06:14 2012 -0700| [159831cc0987762af51f772d53e28605db45df77] | committer: Ronald S. Bultje

adpcm: convert adpcm_xa to bytestream2.

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

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

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 4faac6f..8c1b59b 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -292,7 +292,7 @@ static int xa_decode(AVCodecContext *avctx,
         for(j=0;j<28;j++) {
             d = in[16+i+j*4];
 
-            t = (signed char)(d<<4)>>4;
+            t = sign_extend(d, 4);
             s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
             s_2 = s_1;
             s_1 = av_clip_int16(s);
@@ -322,7 +322,7 @@ static int xa_decode(AVCodecContext *avctx,
         for(j=0;j<28;j++) {
             d = in[16+i+j*4];
 
-            t = (signed char)d >> 4;
+            t = sign_extend(d >> 4, 4);
             s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
             s_2 = s_1;
             s_1 = av_clip_int16(s);
@@ -834,13 +834,12 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
         bytestream2_seek(&gb, 0, SEEK_END);
         break;
     case CODEC_ID_ADPCM_XA:
-        while (buf_size >= 128) {
-            if ((ret = xa_decode(avctx, samples, src, &c->status[0],
+        while (bytestream2_get_bytes_left(&gb) >= 128) {
+            if ((ret = xa_decode(avctx, samples, buf + bytestream2_tell(&gb), &c->status[0],
                                  &c->status[1], avctx->channels)) < 0)
                 return ret;
-            src += 128;
+            bytestream2_skipu(&gb, 128);
             samples += 28 * 8;
-            buf_size -= 128;
         }
         break;
     case CODEC_ID_ADPCM_IMA_EA_EACS:



More information about the ffmpeg-cvslog mailing list