]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Simplify mace_decode_frame()
authorvitor <vitor@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 4 Sep 2008 23:12:20 +0000 (23:12 +0000)
committervitor <vitor@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 4 Sep 2008 23:12:20 +0000 (23:12 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15207 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/mace.c

index 4154cc98edb50bd752115baa9429b3d154527d38..464f30d3dcfcd738157701d8e6d87e0f6913cae6 100644 (file)
@@ -395,23 +395,26 @@ static int mace_decode_frame(AVCodecContext *avctx,
                             void *data, int *data_size,
                             const uint8_t *buf, int buf_size)
 {
-    short *samples;
+    short *samples = data;
     MACEContext *c = avctx->priv_data;
+    int i;
 
-    samples = (short *)data;
     switch (avctx->codec->id) {
     case CODEC_ID_MACE3:
         dprintf(avctx, "mace_decode_frame[3]()");
-        Exp1to3(c, buf, samples, buf_size / 2 / avctx->channels, avctx->channels, 1);
-        if (avctx->channels == 2)
-            Exp1to3(c, buf, samples+1, buf_size / 2 / 2, 2, 2);
+        for(i = 0; i < avctx->channels; i++)
+            Exp1to3(c, buf, samples + i, buf_size / 2 / avctx->channels,
+                    avctx->channels, i + 1);
+
         *data_size = 2 * 3 * buf_size;
         break;
     case CODEC_ID_MACE6:
         dprintf(avctx, "mace_decode_frame[6]()");
-        Exp1to6(c, buf, samples, buf_size / avctx->channels, avctx->channels, 1);
-        if (avctx->channels == 2)
-            Exp1to6(c, buf, samples+1, buf_size / 2, 2, 2);
+
+        for(i = 0; i < avctx->channels; i++)
+            Exp1to6(c, buf, samples + i, buf_size / avctx->channels,
+                    avctx->channels, i + 1);
+
         *data_size = 2 * 6 * buf_size;
         break;
     default: