[FFmpeg-cvslog] 8svx: unify mono and stereo code paths.

Nicolas George git at videolan.org
Tue Jul 31 17:35:57 CEST 2012


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Sun Jul 29 12:46:48 2012 +0200| [7a539e67f4fc1cc6fa664e3ddc91aec26be5c61c] | committer: Nicolas George

8svx: unify mono and stereo code paths.

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

 libavcodec/8svx.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
index 967b8c9..e89b252 100644
--- a/libavcodec/8svx.c
+++ b/libavcodec/8svx.c
@@ -121,8 +121,9 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
         /* decompress */
         if (esc->table) {
             const uint8_t *buf = avpkt->data;
+            uint8_t *dst;
             int buf_size = avpkt->size;
-            int n = esc->samples_size;
+            int i, n = esc->samples_size;
 
             if (buf_size < 2) {
                 av_log(avctx, AV_LOG_ERROR, "packet size is too small\n");
@@ -130,15 +131,15 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
             }
             if (!(deinterleaved_samples = av_mallocz(n)))
                 return AVERROR(ENOMEM);
-            p = deinterleaved_samples;
+            dst = p = deinterleaved_samples;
 
             /* the uncompressed starting value is contained in the first byte */
-            if (avctx->channels == 2) {
-                delta_decode(deinterleaved_samples      , buf+1, buf_size/2-1, buf[0], esc->table);
-                buf += buf_size/2;
-                delta_decode(deinterleaved_samples+n/2-1, buf+1, buf_size/2-1, buf[0], esc->table);
-            } else
-                delta_decode(deinterleaved_samples      , buf+1, buf_size-1  , buf[0], esc->table);
+            dst = deinterleaved_samples;
+            for (i = 0; i < avctx->channels; i++) {
+                delta_decode(dst, buf + 1, buf_size / avctx->channels - 1, buf[0], esc->table);
+                buf += buf_size / avctx->channels;
+                dst += n / avctx->channels - 1;
+            }
         } else {
             deinterleaved_samples = avpkt->data;
         }



More information about the ffmpeg-cvslog mailing list