/* 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 Drft{ int n; float[] trigcache; int[] splitcache; void backward(float[] data){ //System.err.println("Drft.backward"); if(n==1)return; drftb1(n,data,trigcache,trigcache,n,splitcache); } void init(int n){ //System.err.println("Drft.init"); this.n=n; trigcache=new float[3*n]; splitcache=new int[32]; fdrffti(n, trigcache, splitcache); } void clear(){ //System.err.println("Drft.clear"); if(trigcache!=null)trigcache=null; if(splitcache!=null)splitcache=null; // memset(l,0,sizeof(drft_lookup)); } static int[] ntryh = { 4,2,3,5 }; static float tpi = 6.28318530717958647692528676655900577f; static float hsqt2 = .70710678118654752440084436210485f; static float taui = .86602540378443864676372317075293618f; static float taur = -.5f; static float sqrt2 = 1.4142135623730950488016887242097f; static void drfti1(int n, float[] wa, int index, int[] ifac){ float arg,argh,argld,fi; int ntry=0,i,j=-1; int k1, l1, l2, ib; int ld, ii, ip, is, nq, nr; int ido, ipm, nfm1; int nl=n; int nf=0; int state=101; loop: while(true){ switch(state){ case 101: j++; if (j < 4) ntry=ntryh[j]; else ntry+=2; case 104: nq=nl/ntry; nr=nl-ntry*nq; if(nr!=0){ state=101; break; } nf++; ifac[nf+1]=ntry; nl=nq; if(ntry!=2){ state=107; break; } if(nf==1){ state=107; break; } for(i=1;i