/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For more information look at the file License.txt in this package. email: hazard_hd@users.sourceforge.net */ /* * 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 ... * */ /* $Id$ */ #ifdef HAVE_CONFIG_H # include #endif #include "HIPDefines.h" #ifdef USE_LAYER_1 #include #include "common.h" #include "decode_i386.h" #ifdef WITH_DMALLOC #include #endif 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; assert ( fr->stereo == 0 || fr->stereo == 1 ); if(fr->stereo) { int i; int jsbound = fr->jsbound; for (i=0;istereo == 0 || fr->stereo == 1 ); if(fr->stereo) { 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,int outmode,struct audio_info_struct *ai) int do_layer1(PMPSTR mp, unsigned char *pcm_sample,int *pcm_point) { int clip=0; unsigned int balloc[2*SBLIMIT]; unsigned int scale_index[2][SBLIMIT]; real fraction[2][SBLIMIT]; struct frame *fr=&(mp->fr); int i,stereo = fr->stereo; 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 += synth_1to1_mono( mp, (real *) fraction[single],pcm_sample,pcm_point); } else { int p1 = *pcm_point; clip += synth_1to1( mp, (real *) fraction[0],0,pcm_sample,&p1); clip += synth_1to1( mp, (real *) fraction[1],1,pcm_sample,pcm_point); } } return clip; } #endif