* @file mace.c
* MACE decoder.
*/
-
+
#include "avcodec.h"
/*
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;
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;
}
/* \\\ */
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;
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;
// *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;
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;
*data_size = 2 * 6 * buf_size;
break;
default:
- *data_size = 0;
return -1;
}
return buf_size;