aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mace.c
diff options
context:
space:
mode:
authorFrançois Revol <revol@free.fr>2005-02-01 15:13:27 +0000
committerFrançois Revol <revol@free.fr>2005-02-01 15:13:27 +0000
commit3c8e39f72d64e410a2aa19fd2fb31fd59647cdfa (patch)
tree36dcd10456d6ff9a3c11178babbead38d116506e /libavcodec/mace.c
parent8845e427a7e048fd5c6109af6b7701009667a73e (diff)
downloadffmpeg-3c8e39f72d64e410a2aa19fd2fb31fd59647cdfa.tar.gz
Stereo MACE fix by Burkhard Plaum <plaum AT ipf DOT uni-stuttgart DOT de>
Still doesn't work with our mov demuxer though... Originally committed as revision 3919 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mace.c')
-rw-r--r--libavcodec/mace.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/libavcodec/mace.c b/libavcodec/mace.c
index 8a4a20568c..80cd283932 100644
--- a/libavcodec/mace.c
+++ b/libavcodec/mace.c
@@ -242,7 +242,8 @@ typedef struct MACEContext {
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 @@ static void chomp3(MACEContext *ctx,
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 @@ static void Exp1to3(MACEContext *ctx,
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 Exp1to3(MACEContext *ctx,
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 @@ static void chomp6(MACEContext *ctx,
// *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 @@ static void Exp1to6(MACEContext *ctx,
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;