/* csvorbis * Copyright (C) 2000 ymnk, JCraft,Inc. * * Written by: 2000 ymnk * Ported to C# from JOrbis by: Mark Crichton * * Thanks go to the JOrbis team, for licencing the code under the * LGPL, making my job a lot easier. * * 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. */ using System; using System.Runtime.CompilerServices; using csogg; namespace csvorbis { class Mdct { //static private float cPI3_8=0.38268343236508977175f; //static private float cPI2_8=0.70710678118654752441f; //static private float cPI1_8=0.92387953251128675613f; int n; int log2n; float[] trig; int[] bitrev; float scale; internal void init(int n) { bitrev=new int[n/4]; trig=new float[n+n/4]; int n2=(int)((uint)n >> 1); log2n=(int)Math.Round(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(((((uint)msb>>j))&i) != 0) acc |= 1 << j; bitrev[i*2]=((~acc)&mask); // bitrev[i*2]=((~acc)&mask)-1; bitrev[i*2+1]=acc; } } scale=4.0f/n; } internal void clear() { } internal void forward(float[] fin, float[] fout) { } float[] _x=new float[1024]; float[] _w=new float[1024]; [MethodImpl(MethodImplOptions.Synchronized)] internal void backward(float[] fin, float[] fout) { if(_x.Length < n/2){_x=new float[n/2];} if(_w.Length < n/2){_w=new float[n/2];} float[] x=_x; float[] w=_w; int n2=(int)((uint)n >> 1); int n4=(int)((uint)n >> 2); int n8=(int)((uint)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<((uint)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<