/* layer1.c: the layer 1 decoder copyright 1995-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.de initially written by Michael Hipp may have a few bugs after last optimization ... */ #include "mpg123.h" 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 == 2) { int i; int jsbound = fr->jsbound; for (i=0;istereo == 2) { int jsbound = fr->jsbound; register real *f0 = fraction[0]; register real *f1 = fraction[1]; ba = balloc; for (sample=smpb,i=0;idown_sample_sblimit;i<32;i++) fraction[0][i] = fraction[1][i] = 0.0; } else { register real *f0 = fraction[0]; ba = balloc; for (sample=smpb,i=0;idown_sample_sblimit;i<32;i++) fraction[0][i] = 0.0; } } int do_layer1(struct frame *fr,byte *pcm_sample, int *pcm_point) { 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; fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32; 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 { int p1=*pcm_point; clip += (fr->synth)( (real *) fraction[0],0,pcm_sample,&p1); clip += (fr->synth)( (real *) fraction[1],1,pcm_sample,pcm_point); } } return clip; }