From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- mpg123_artsplugin/mpg123/layer1.c | 157 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 mpg123_artsplugin/mpg123/layer1.c (limited to 'mpg123_artsplugin/mpg123/layer1.c') diff --git a/mpg123_artsplugin/mpg123/layer1.c b/mpg123_artsplugin/mpg123/layer1.c new file mode 100644 index 00000000..a33335ab --- /dev/null +++ b/mpg123_artsplugin/mpg123/layer1.c @@ -0,0 +1,157 @@ +/* + * 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" + +#include "getbits.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;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 mpstr *mp,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; + + 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); + } + + if(pcm_point >= audiobufsize) + audio_flush(outmode,ai); + } + + return clip; +} + + -- cgit v1.2.1