changeset 2487:b09bc77eb2fb libavcodec

Stereo MACE fix by Burkhard Plaum <plaum AT ipf DOT uni-stuttgart DOT de> Still doesn't work with our mov demuxer though...
author mmu_man
date Tue, 01 Feb 2005 15:13:27 +0000
parents f2a9559db6ac
children 8dd4672b9f74
files mace.c
diffstat 1 files changed, 19 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mace.c	Tue Feb 01 13:03:44 2005 +0000
+++ b/mace.c	Tue Feb 01 15:13:27 2005 +0000
@@ -242,7 +242,8 @@
 static void chomp3(MACEContext *ctx,
             uint8_t val,
             const uint16_t tab1[],
-            const uint16_t tab2[][8])
+            const uint16_t tab2[][8],
+            uint32_t numChannels)
 {
   short current;
 
@@ -252,7 +253,8 @@
   else current+=ctx->lev;
   ctx->lev=current-(current >> 3);
 //  *ctx->outPtr++=current >> 8;
-  *ctx->outPtr++=current;
+  *ctx->outPtr=current;
+  ctx->outPtr+=numChannels;
   if ( ( ctx->index += tab1[val]-(ctx->index>>5) ) < 0 ) ctx->index = 0;
 }
 /* \\\ */
@@ -281,13 +283,13 @@
 
    while (cnt>0) {
      pkt=inBuffer[0];
-     chomp3(ctx, pkt       & 7, MACEtab1, MACEtab2);
-     chomp3(ctx,(pkt >> 3) & 3, MACEtab3, MACEtab4);
-     chomp3(ctx, pkt >> 5     , MACEtab1, MACEtab2);
+     chomp3(ctx, pkt       & 7, MACEtab1, MACEtab2, numChannels);
+     chomp3(ctx,(pkt >> 3) & 3, MACEtab3, MACEtab4, numChannels);
+     chomp3(ctx, pkt >> 5     , MACEtab1, MACEtab2, numChannels);
      pkt=inBuffer[1];
-     chomp3(ctx, pkt       & 7, MACEtab1, MACEtab2);
-     chomp3(ctx,(pkt >> 3) & 3, MACEtab3, MACEtab4);
-     chomp3(ctx, pkt >> 5     , MACEtab1, MACEtab2);
+     chomp3(ctx, pkt       & 7, MACEtab1, MACEtab2, numChannels);
+     chomp3(ctx,(pkt >> 3) & 3, MACEtab3, MACEtab4, numChannels);
+     chomp3(ctx, pkt >> 5     , MACEtab1, MACEtab2, numChannels);
 
      inBuffer+=numChannels*2;
      --cnt;
@@ -306,7 +308,8 @@
 static void chomp6(MACEContext *ctx,
             uint8_t val,
             const uint16_t tab1[],
-            const uint16_t tab2[][8])
+            const uint16_t tab2[][8],
+            uint32_t numChannels)
 {
   short current;
 
@@ -329,9 +332,10 @@
 
 //  *ctx->outPtr++=(ctx->previous+ctx->prev2-((ctx->prev2-current) >> 2)) >> 8;
 //  *ctx->outPtr++=(ctx->previous+current+((ctx->prev2-current) >> 2)) >> 8;
-  *ctx->outPtr++=(ctx->previous+ctx->prev2-((ctx->prev2-current) >> 2));
-  *ctx->outPtr++=(ctx->previous+current+((ctx->prev2-current) >> 2));
-
+  *ctx->outPtr=(ctx->previous+ctx->prev2-((ctx->prev2-current) >> 2));
+  ctx->outPtr+=numChannels;
+  *ctx->outPtr=(ctx->previous+current+((ctx->prev2-current) >> 2));
+  ctx->outPtr+=numChannels;
   ctx->prev2=ctx->previous;
   ctx->previous=current;
 
@@ -366,9 +370,9 @@
    while (cnt>0) {
      pkt=*inBuffer;
 
-     chomp6(ctx, pkt >> 5     , MACEtab1, MACEtab2);
-     chomp6(ctx,(pkt >> 3) & 3, MACEtab3, MACEtab4);
-     chomp6(ctx, pkt       & 7, MACEtab1, MACEtab2);
+     chomp6(ctx, pkt >> 5     , MACEtab1, MACEtab2, numChannels);
+     chomp6(ctx,(pkt >> 3) & 3, MACEtab3, MACEtab4, numChannels);
+     chomp6(ctx, pkt       & 7, MACEtab1, MACEtab2, numChannels);
 
      inBuffer+=numChannels;
      --cnt;