com.jcraft.jorbis.Mdct Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sound Show documentation
Show all versions of sound Show documentation
Etyl's default sound module
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/* JOrbis
* Copyright (C) 2000 ymnk, JCraft,Inc.
*
* Written by: 2000 ymnk
*
* Many thanks to
* Monty and
* The XIPHOPHORUS Company http://www.xiph.org/ .
* JOrbis has been based on their awesome works, Vorbis codec.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* This program 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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package com.jcraft.jorbis;
class Mdct{
int n;
int log2n;
float[] trig;
int[] bitrev;
float scale;
void init(int n){
bitrev=new int[n/4];
trig=new float[n+n/4];
log2n=(int)Math.rint(Math.log(n)/Math.log(2));
this.n=n;
int AE=0;
int AO=1;
int BE=AE+n/2;
int BO=BE+1;
int CE=BE+n/2;
int CO=CE+1;
// trig lookups...
for(int i=0; i>>j!=0; j++)
if(((msb>>>j)&i)!=0)
acc|=1<>>1;
int n4=n>>>2;
int n8=n>>>3;
// rotate + step 1
{
int inO=1;
int xO=0;
int A=n2;
int i;
for(i=0; i>>(i+2);
int k1=1<<(i+3);
int wbase=n2-2;
A=0;
float[] temp;
for(int r=0; r<(k0>>>2); r++){
int w1=wbase;
w2=w1-(k0>>1);
float AEv=trig[A], wA;
float AOv=trig[A+1], wB;
wbase-=2;
k0++;
for(int s=0; s<(2<