/**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor ** the names of its contributors may be used to endorse or promote ** products derived from this software without specific prior written ** permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ /******************************************************************** The routines in this file are from http://www.netlib.org/fftpack/. According to the comments in the original file (which are provided below) and according to the wikipedia article about the FFTPACK[1], they are released as public domain. For information about the author of the original, Fortran routines, and the author of the C translation these routines, see the comments below. [1] http://en.wikipedia.org/wiki/FFTPACK, referenced 2010-12-21. ********************************************************************/ /******************************************************************** 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 __STATIC void drfti1(int n, float *wa, int *ifac){ static int ntryh[4] = { 4,2,3,5 }; static float tpi = 6.28318530717958647692528676655900577; 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; 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