/* * 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 "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) { 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;ifr; int i,stereo = fr->stereo; static unsigned int balloc[2*SBLIMIT]; static unsigned int scale_index[2][SBLIMIT]; static real fraction[2][SBLIMIT]; int single = fr->single; int num_bytes; 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); num_bytes=0; for (i=0;i= 0) { clip += synth_1to1_mono(mp, (real*)fraction[single],mp->osspace,&num_bytes); } else { int p1 = num_bytes; clip += synth_1to1(mp, (real*)fraction[0],0,mp->osspace,&p1); clip += synth_1to1(mp, (real*)fraction[1],1,mp->osspace,&num_bytes); } } if ((!mp->is_output_initialized) || (mp->sample_rate_device != fr->sample_rate)) { if (mp->is_output_initialized) mp->ao_output->close(mp->ao_output); mp->ao_output->open (mp->ao_output, 16, fr->sample_rate, stereo-1 ? AO_CAP_MODE_STEREO: AO_CAP_MODE_MONO); mp->is_output_initialized = 1; mp->sample_rate_device = fr->sample_rate; printf ("layer1\n"); } mp->ao_output->write (mp->ao_output, (int16_t*)mp->osspace, num_bytes/(stereo-1 ? 4:2), mp->pts); mp->pts = 0; }