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 --- mpeglib/lib/splay/mpeglayer1.cpp | 109 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 mpeglib/lib/splay/mpeglayer1.cpp (limited to 'mpeglib/lib/splay/mpeglayer1.cpp') diff --git a/mpeglib/lib/splay/mpeglayer1.cpp b/mpeglib/lib/splay/mpeglayer1.cpp new file mode 100644 index 00000000..a32951c4 --- /dev/null +++ b/mpeglib/lib/splay/mpeglayer1.cpp @@ -0,0 +1,109 @@ +/* MPEG/WAVE Sound library + + (C) 1997 by Jung woo-jae */ + +// Mpeglayer1.cc +// It's for MPEG Layer 1 + + + +#include "mpegsound.h" +#include "synthesis.h" + +// Tables for layer 1 +static const REAL factortable[15] = +{ + 0.0, + (1.0/2.0) * (4.0/3.0), (1.0/4.0) * (8.0/7.0), + (1.0/8.0) * (16.0/15.0), (1.0/16.0) * (32.0/31.0), + (1.0/32.0) * (64.0/63.0), (1.0/64.0) * (128.0/127.0), + (1.0/128.0) * (256.0/255.0), (1.0/256.0) * (512.0/511.0), + (1.0/512.0) * (1024.0/1023.0), (1.0/1024.0) * (2048.0/2047.0), + (1.0/2048.0) * (4096.0/4095.0), (1.0/4096.0) * (8192.0/8191.0), + (1.0/8192.0) * (16384.0/16383.0), (1.0/16384.0) * (32768.0/32767.0) +}; + +static const REAL offsettable[15] = +{ + 0.0, + ((1.0/2.0)-1.0) * (4.0/3.0), ((1.0/4.0)-1.0) * (8.0/7.0), + ((1.0/8.0)-1.0) * (16.0/15.0), ((1.0/16.0)-1.0) * (32.0/31.0), + ((1.0/32.0)-1.0) * (64.0/63.0), ((1.0/64.0)-1.0) * (128.0/127.0), + ((1.0/128.0)-1.0) * (256.0/255.0), ((1.0/256.0)-1.0) * (512.0/511.0), + ((1.0/512.0)-1.0) * (1024.0/1023.0), ((1.0/1024.0)-1.0) * (2048.0/2047.0), + ((1.0/2048.0)-1.0) * (4096.0/4095.0), ((1.0/4096.0)-1.0) * (8192.0/8191.0), + ((1.0/8192.0)-1.0) * (16384.0/16383.0), ((1.0/16384.0)-1.0) * (32768.0/32767.0) +}; + +// Mpeg layer 1 +void Mpegtoraw::extractlayer1(void) +{ + int inputstereo=mpegAudioHeader->getInputstereo(); + int stereobound=mpegAudioHeader->getStereobound(); + REAL fraction[MAXCHANNEL][MAXSUBBAND]; + REAL scalefactor[MAXCHANNEL][MAXSUBBAND]; + + int bitalloc[MAXCHANNEL][MAXSUBBAND], + sample[MAXCHANNEL][MAXSUBBAND]; + + register int i,j; + int s=stereobound,l; + + +// Bitalloc + for(i=0;idoSynth(lDownSample,lOutputStereo, + fraction[LS],fraction[RS]); + } +} -- cgit v1.2.1