/* Notes from RFB: Looks like the user-level routines are: Real FFT void __ogg_fdrffti(int n, double *wsave, int *ifac) void __ogg_fdrfftf(int n,double *r,double *wsave,int *ifac) void __ogg_fdrfftb(int n, double *r, double *wsave, int *ifac) __ogg_fdrffti == initialization __ogg_fdrfftf == forward transform __ogg_fdrfftb == backward transform Parameters are n == length of sequence r == sequence to be transformed (input) == transformed sequence (output) wsave == work array of length 2n (allocated by caller) ifac == work array of length 15 (allocated by caller) Cosine quarter-wave FFT void __ogg_fdcosqi(int n, double *wsave, int *ifac) void __ogg_fdcosqf(int n,double *x,double *wsave,int *ifac) void __ogg_fdcosqb(int n,double *x,double *wsave,int *ifac) */ /******************************************************************** * * * THIS FILE IS PART OF THE OggSQUISH SOFTWARE CODEC SOURCE CODE. * * * ******************************************************************** file: fft.c function: Fast discrete Fourier and cosine transforms and inverses author: Monty modifications by: Monty last modification date: Jul 1 1996 ********************************************************************/ /* These Fourier routines were originally based on the Fourier routines of the same names from the NETLIB bihar and fftpack fortran libraries developed by Paul N. Swarztrauber at the National Center for Atmospheric Research in Boulder, CO USA. They have been reimplemented in C and optimized in a few ways for OggSquish. */ /* As the original fortran libraries are public domain, the C Fourier routines in this file are hereby released to the public domain as well. The C routines here produce output exactly equivalent to the original fortran routines. Of particular interest are the facts that (like the original fortran), these routines can work on arbitrary length vectors that need not be powers of two in length. */ #include #define STIN static static void drfti1(int n, double *wa, int *ifac){ static int ntryh[4] = { 4,2,3,5 }; static double tpi = 6.28318530717958647692528676655900577; double 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; L101: j++; if (j < 4) ntry=ntryh[j]; else ntry+=2; L104: nq=nl/ntry; nr=nl-ntry*nq; if (nr!=0) goto L101; nf++; ifac[nf+1]=ntry; nl=nq; if(ntry!=2)goto L107; if(nf==1)goto L107; for (i=1;i>1; ipp2=ip; idp2=ido; nbd=(ido-1)>>1; t0=l1*ido; t10=ip*ido; if(ido==1)goto L119; for(ik=0;ikl1){ for(j=1;j>1; np2=n; kc=np2; for(k=1;k>1; ipp2=ip; ipph=(ip+1)>>1; if(idol1)goto L139; is= -ido-1; t1=0; for(j=1;j>1; np2=n; for(i=2;i