/**********************************************************************
This file is part of Crack dot Com's free source code release of
Golgotha.
for
information about compiling & licensing issues visit this URL
If that doesn't help, contact Jonathan Clark at
golgotha_source@usa.net (Subject should have "GOLG" in it)
***********************************************************************/
/*
* Mpeg Layer-1 audio decoder
* --------------------------
* copyright (c) 1995 by Michael Hipp, All rights reserved. See also 'README'
* near unoptimzed ...
*
* may have a few bugs after last optimization ...
*
*/
#include "loaders/mp3/mpg123.hh"
void I_step_one(unsigned int balloc[], unsigned int scale_index[2][SBLIMIT],struct frame *fr)
{
unsigned int *ba=balloc;
unsigned int *sca = (unsigned int *) scale_index;
if(fr->stereo) {
int i;
int jsbound = fr->jsbound;
for (i=0;istereo) {
int jsbound = fr->jsbound;
register real *f0 = fraction[0];
register real *f1 = fraction[1];
ba = balloc;
for (sample=smpb,i=0;i>fr->down_sample;i<32;i++)
fraction[0][i] = fraction[1][i] = 0.0;
}
else {
register real *f0 = fraction[0];
ba = balloc;
for (sample=smpb,i=0;i>fr->down_sample;i<32;i++)
fraction[0][i] = 0.0;
}
}
int do_layer1(struct frame *fr,int outmode,struct audio_info_struct *ai)
{
int clip=0;
int i,stereo = fr->stereo;
unsigned int balloc[2*SBLIMIT];
unsigned int scale_index[2][SBLIMIT];
real fraction[2][SBLIMIT];
int single = fr->single;
if(stereo == 1 || single == 3)
single = 0;
I_step_one(balloc,scale_index,fr);
for (i=0;i= 0)
{
clip += (fr->synth_mono)( (real *) fraction[single],pcm_sample+pcm_point);
}
else {
clip += (fr->synth)( (real *) fraction[0],0,pcm_sample+pcm_point);
clip += (fr->synth)( (real *) fraction[1],1,pcm_sample+pcm_point);
}
pcm_point += fr->block_size;
if(pcm_point == audiobufsize)
audio_flush(outmode,ai);
}
return clip;
}