Commit 251d75f2 authored by Vitor Sessak's avatar Vitor Sessak

Reindent mace.c, its indentation was completly inconsistent with the coding rules.

Originally committed as revision 15204 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b0880d5d
......@@ -241,33 +241,32 @@ typedef struct MACEContext {
} MACEContext;
/* /// "chomp3()" */
static void chomp3(MACEContext *ctx,
uint8_t val,
const uint16_t tab1[],
const uint16_t tab2[][8],
uint32_t numChannels)
static void chomp3(MACEContext *ctx, uint8_t val, const uint16_t tab1[],
const uint16_t tab2[][8], uint32_t numChannels)
{
short current;
current=(short)tab2[(ctx->index & 0x7f0) >> 4][val];
if (current+ctx->lev > 32767) current=32767;
else if (current+ctx->lev < -32768) current=-32767;
else current+=ctx->lev;
ctx->lev=current-(current >> 3);
// *ctx->outPtr++=current >> 8;
*ctx->outPtr=current;
ctx->outPtr+=numChannels;
if ( ( ctx->index += tab1[val]-(ctx->index>>5) ) < 0 ) ctx->index = 0;
current = (short) tab2[(ctx->index & 0x7f0) >> 4][val];
if (current + ctx->lev > 32767)
current = 32767;
else if (current + ctx->lev < -32768)
current = -32767;
else
current += ctx->lev;
ctx->lev = current - (current >> 3);
//*ctx->outPtr++=current >> 8;
*ctx->outPtr = current;
ctx->outPtr += numChannels;
if (( ctx->index += tab1[val]-(ctx->index >> 5) ) < 0)
ctx->index = 0;
}
/* \\\ */
/* /// "Exp1to3()" */
static void Exp1to3(MACEContext *ctx,
const uint8_t *inBuffer,
void *outBuffer,
uint32_t cnt,
uint32_t numChannels,
uint32_t whichChannel)
static void Exp1to3(MACEContext *ctx, const uint8_t *inBuffer, void *outBuffer,
uint32_t cnt, uint32_t numChannels, uint32_t whichChannel)
{
uint8_t pkt;
......@@ -277,13 +276,13 @@ static void Exp1to3(MACEContext *ctx,
ctx->lev=inState[1];
} else
*/
ctx->index=ctx->lev=0;
ctx->index = ctx->lev = 0;
inBuffer+=(whichChannel-1)*2;
inBuffer += (whichChannel - 1)*2;
ctx->outPtr=outBuffer;
ctx->outPtr = outBuffer;
while (cnt>0) {
while (cnt > 0) {
pkt=inBuffer[0];
chomp3(ctx, pkt & 7, MACEtab1, MACEtab2, numChannels);
chomp3(ctx,(pkt >> 3) & 3, MACEtab3, MACEtab4, numChannels);
......@@ -293,7 +292,7 @@ static void Exp1to3(MACEContext *ctx,
chomp3(ctx,(pkt >> 3) & 3, MACEtab3, MACEtab4, numChannels);
chomp3(ctx, pkt >> 5 , MACEtab1, MACEtab2, numChannels);
inBuffer+=numChannels*2;
inBuffer += numChannels*2;
--cnt;
}
......@@ -307,51 +306,52 @@ static void Exp1to3(MACEContext *ctx,
/* \\\ */
/* /// "chomp6()" */
static void chomp6(MACEContext *ctx,
uint8_t val,
const uint16_t tab1[],
const uint16_t tab2[][8],
uint32_t numChannels)
static void chomp6(MACEContext *ctx, uint8_t val, const uint16_t tab1[],
const uint16_t tab2[][8], uint32_t numChannels)
{
short current;
current=(short)tab2[(ctx->index & 0x7f0) >> 4][val];
current = (short)tab2[(ctx->index & 0x7f0) >> 4][val];
if ((ctx->previous^current)>=0) {
if (ctx->factor+506>32767) ctx->factor=32767;
else ctx->factor+=506;
if ((ctx->previous ^ current) >= 0) {
if (ctx->factor + 506 > 32767)
ctx->factor = 32767;
else
ctx->factor += 506;
} else {
if (ctx->factor-314<-32768) ctx->factor=-32767;
else ctx->factor-=314;
if (ctx->factor - 314 < -32768)
ctx->factor = -32767;
else
ctx->factor -= 314;
}
if (current+ctx->level>32767) current=32767;
else if (current+ctx->level<-32768) current=-32767;
else current+=ctx->level;
if (current + ctx->level > 32767)
current = 32767;
else if (current + ctx->level < -32768)
current = -32767;
else
current += ctx->level;
ctx->level=((current*ctx->factor) >> 15);
current>>=1;
ctx->level = ((current*ctx->factor) >> 15);
current >>= 1;
// *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+=numChannels;
*ctx->outPtr=(ctx->previous+current+((ctx->prev2-current) >> 2));
ctx->outPtr+=numChannels;
ctx->prev2=ctx->previous;
ctx->previous=current;
if( ( ctx->index += tab1[val]-(ctx->index>>5) ) < 0 ) ctx->index = 0;
*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;
if ((ctx->index += tab1[val] - (ctx->index >> 5)) < 0)
ctx->index = 0;
}
/* \\\ */
/* /// "Exp1to6()" */
static void Exp1to6(MACEContext *ctx,
const uint8_t *inBuffer,
void *outBuffer,
uint32_t cnt,
uint32_t numChannels,
uint32_t whichChannel)
static void Exp1to6(MACEContext *ctx, const uint8_t *inBuffer, void *outBuffer,
uint32_t cnt, uint32_t numChannels, uint32_t whichChannel)
{
uint8_t pkt;
......@@ -364,19 +364,19 @@ static void Exp1to6(MACEContext *ctx,
ctx->factor=inState[4];
} else
*/
ctx->previous=ctx->prev2=ctx->index=ctx->level=ctx->factor=0;
ctx->previous = ctx->prev2 = ctx->index = ctx->level = ctx->factor = 0;
inBuffer+=(whichChannel-1);
ctx->outPtr=outBuffer;
inBuffer += (whichChannel - 1);
ctx->outPtr = outBuffer;
while (cnt>0) {
pkt=*inBuffer;
pkt = *inBuffer;
chomp6(ctx, pkt >> 5 , MACEtab1, MACEtab2, numChannels);
chomp6(ctx,(pkt >> 3) & 3, MACEtab3, MACEtab4, numChannels);
chomp6(ctx, pkt & 7, MACEtab1, MACEtab2, numChannels);
inBuffer+=numChannels;
inBuffer += numChannels;
--cnt;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment