cfft.c

00001 /*
00002 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
00003 ** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
00004 **  
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 ** 
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 ** 
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software 
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 **
00019 ** Any non-GPL usage of this software or parts of this software is strictly
00020 ** forbidden.
00021 **
00022 ** Software using this code must display the following message visibly in the
00023 ** software:
00024 ** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
00025 ** in, for example, the about-box or help/startup screen.
00026 **
00027 ** Commercial non-GPL licensing of this software is possible.
00028 ** For more info contact Ahead Software through [email protected].
00029 **
00030 ** $Id: cfft.c,v 1.2 2005/11/01 21:41:43 gabest Exp $
00031 **/
00032 
00033 /*
00034  * Algorithmically based on Fortran-77 FFTPACK
00035  * by Paul N. Swarztrauber(Version 4, 1985).
00036  *
00037  * Does even sized fft only
00038  */
00039 
00040 /* isign is +1 for backward and -1 for forward transforms */
00041 
00042 #include "common.h"
00043 #include "structs.h"
00044 
00045 #include <stdlib.h>
00046 
00047 #include "cfft.h"
00048 #include "cfft_tab.h"
00049 
00050 
00051 /* static function declarations */
00052 static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
00053                       complex_t *ch, const complex_t *wa);
00054 static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
00055                       complex_t *ch, const complex_t *wa);
00056 static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
00057                    complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign);
00058 static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
00059                       const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
00060 static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
00061                       const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
00062 static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
00063                    const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
00064                    const complex_t *wa4, const int8_t isign);
00065 INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch,
00066                    const uint16_t *ifac, const complex_t *wa, const int8_t isign);
00067 static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac);
00068 
00069 
00070 /*----------------------------------------------------------------------
00071    passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd.
00072   ----------------------------------------------------------------------*/
00073 
00074 static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
00075                       complex_t *ch, const complex_t *wa)
00076 {
00077     uint16_t i, k, ah, ac;
00078 
00079     if (ido == 1)
00080     {
00081         for (k = 0; k < l1; k++)
00082         {
00083             ah = 2*k;
00084             ac = 4*k;
00085 
00086             RE(ch[ah])    = RE(cc[ac]) + RE(cc[ac+1]);
00087             RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
00088             IM(ch[ah])    = IM(cc[ac]) + IM(cc[ac+1]);
00089             IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
00090         }
00091     } else {
00092         for (k = 0; k < l1; k++)
00093         {
00094             ah = k*ido;
00095             ac = 2*k*ido;
00096 
00097             for (i = 0; i < ido; i++)
00098             {
00099                 complex_t t2;
00100 
00101                 RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]);
00102                 RE(t2)       = RE(cc[ac+i]) - RE(cc[ac+i+ido]);
00103 
00104                 IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]);
00105                 IM(t2)       = IM(cc[ac+i]) - IM(cc[ac+i+ido]);
00106 
00107 #if 1
00108                 ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
00109                     IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
00110 #else
00111                 ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
00112                     RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
00113 #endif
00114             }
00115         }
00116     }
00117 }
00118 
00119 static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
00120                       complex_t *ch, const complex_t *wa)
00121 {
00122     uint16_t i, k, ah, ac;
00123 
00124     if (ido == 1)
00125     {
00126         for (k = 0; k < l1; k++)
00127         {
00128             ah = 2*k;
00129             ac = 4*k;
00130 
00131             RE(ch[ah])    = RE(cc[ac]) + RE(cc[ac+1]);
00132             RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
00133             IM(ch[ah])    = IM(cc[ac]) + IM(cc[ac+1]);
00134             IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
00135         }
00136     } else {
00137         for (k = 0; k < l1; k++)
00138         {
00139             ah = k*ido;
00140             ac = 2*k*ido;
00141 
00142             for (i = 0; i < ido; i++)
00143             {
00144                 complex_t t2;
00145 
00146                 RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]);
00147                 RE(t2)       = RE(cc[ac+i]) - RE(cc[ac+i+ido]);
00148 
00149                 IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]);
00150                 IM(t2)       = IM(cc[ac+i]) - IM(cc[ac+i+ido]);
00151 
00152 #if 1
00153                 ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
00154                     RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
00155 #else
00156                 ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
00157                     IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
00158 #endif
00159             }
00160         }
00161     }
00162 }
00163 
00164 
00165 static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
00166                    complex_t *ch, const complex_t *wa1, const complex_t *wa2,
00167                    const int8_t isign)
00168 {
00169     static real_t taur = FRAC_CONST(-0.5);
00170     static real_t taui = FRAC_CONST(0.866025403784439);
00171     uint16_t i, k, ac, ah;
00172     complex_t c2, c3, d2, d3, t2;
00173 
00174     if (ido == 1)
00175     {
00176         if (isign == 1)
00177         {
00178             for (k = 0; k < l1; k++)
00179             {
00180                 ac = 3*k+1;
00181                 ah = k;
00182 
00183                 RE(t2) = RE(cc[ac]) + RE(cc[ac+1]);
00184                 IM(t2) = IM(cc[ac]) + IM(cc[ac+1]);
00185                 RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur);
00186                 IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur);
00187 
00188                 RE(ch[ah]) = RE(cc[ac-1]) + RE(t2);
00189                 IM(ch[ah]) = IM(cc[ac-1]) + IM(t2);
00190 
00191                 RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui);
00192                 IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui);
00193 
00194                 RE(ch[ah+l1]) = RE(c2) - IM(c3);
00195                 IM(ch[ah+l1]) = IM(c2) + RE(c3);
00196                 RE(ch[ah+2*l1]) = RE(c2) + IM(c3);
00197                 IM(ch[ah+2*l1]) = IM(c2) - RE(c3);
00198             }
00199         } else {
00200             for (k = 0; k < l1; k++)
00201             {
00202                 ac = 3*k+1;
00203                 ah = k;
00204 
00205                 RE(t2) = RE(cc[ac]) + RE(cc[ac+1]);
00206                 IM(t2) = IM(cc[ac]) + IM(cc[ac+1]);
00207                 RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur);
00208                 IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur);
00209 
00210                 RE(ch[ah]) = RE(cc[ac-1]) + RE(t2);
00211                 IM(ch[ah]) = IM(cc[ac-1]) + IM(t2);
00212 
00213                 RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui);
00214                 IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui);
00215 
00216                 RE(ch[ah+l1]) = RE(c2) + IM(c3);
00217                 IM(ch[ah+l1]) = IM(c2) - RE(c3);
00218                 RE(ch[ah+2*l1]) = RE(c2) - IM(c3);
00219                 IM(ch[ah+2*l1]) = IM(c2) + RE(c3);
00220             }
00221         }
00222     } else {
00223         if (isign == 1)
00224         {
00225             for (k = 0; k < l1; k++)
00226             {
00227                 for (i = 0; i < ido; i++)
00228                 {
00229                     ac = i + (3*k+1)*ido;
00230                     ah = i + k * ido;
00231 
00232                     RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]);
00233                     RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur);
00234                     IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]);
00235                     IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur);
00236 
00237                     RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2);
00238                     IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2);
00239 
00240                     RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui);
00241                     IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui);
00242 
00243                     RE(d2) = RE(c2) - IM(c3);
00244                     IM(d3) = IM(c2) - RE(c3);
00245                     RE(d3) = RE(c2) + IM(c3);
00246                     IM(d2) = IM(c2) + RE(c3);
00247 
00248 #if 1
00249                     ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
00250                         IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
00251                     ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
00252                         IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
00253 #else
00254                     ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
00255                         RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
00256                     ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
00257                         RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
00258 #endif
00259                 }
00260             }
00261         } else {
00262             for (k = 0; k < l1; k++)
00263             {
00264                 for (i = 0; i < ido; i++)
00265                 {
00266                     ac = i + (3*k+1)*ido;
00267                     ah = i + k * ido;
00268 
00269                     RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]);
00270                     RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur);
00271                     IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]);
00272                     IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur);
00273 
00274                     RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2);
00275                     IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2);
00276 
00277                     RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui);
00278                     IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui);
00279 
00280                     RE(d2) = RE(c2) + IM(c3);
00281                     IM(d3) = IM(c2) + RE(c3);
00282                     RE(d3) = RE(c2) - IM(c3);
00283                     IM(d2) = IM(c2) - RE(c3);
00284 
00285 #if 1
00286                     ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
00287                         RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
00288                     ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
00289                         RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
00290 #else
00291                     ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
00292                         IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
00293                     ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
00294                         IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
00295 #endif
00296                 }
00297             }
00298         }
00299     }
00300 }
00301 
00302 
00303 static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
00304                       complex_t *ch, const complex_t *wa1, const complex_t *wa2,
00305                       const complex_t *wa3)
00306 {
00307     uint16_t i, k, ac, ah;
00308 
00309     if (ido == 1)
00310     {
00311         for (k = 0; k < l1; k++)
00312         {
00313             complex_t t1, t2, t3, t4;
00314 
00315             ac = 4*k;
00316             ah = k;
00317 
00318             RE(t2) = RE(cc[ac])   + RE(cc[ac+2]);
00319             RE(t1) = RE(cc[ac])   - RE(cc[ac+2]);
00320             IM(t2) = IM(cc[ac])   + IM(cc[ac+2]);
00321             IM(t1) = IM(cc[ac])   - IM(cc[ac+2]);
00322             RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]);
00323             IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]);
00324             IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]);
00325             RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]);
00326 
00327             RE(ch[ah])      = RE(t2) + RE(t3);
00328             RE(ch[ah+2*l1]) = RE(t2) - RE(t3);
00329 
00330             IM(ch[ah])      = IM(t2) + IM(t3);
00331             IM(ch[ah+2*l1]) = IM(t2) - IM(t3);
00332 
00333             RE(ch[ah+l1])   = RE(t1) + RE(t4);
00334             RE(ch[ah+3*l1]) = RE(t1) - RE(t4);
00335 
00336             IM(ch[ah+l1])   = IM(t1) + IM(t4);
00337             IM(ch[ah+3*l1]) = IM(t1) - IM(t4);
00338         }
00339     } else {
00340         for (k = 0; k < l1; k++)
00341         {
00342             ac = 4*k*ido;
00343             ah = k*ido;
00344 
00345             for (i = 0; i < ido; i++)
00346             {
00347                 complex_t c2, c3, c4, t1, t2, t3, t4;
00348 
00349                 RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]);
00350                 RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]);
00351                 IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]);
00352                 IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]);
00353                 RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]);
00354                 IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]);
00355                 IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]);
00356                 RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]);
00357 
00358                 RE(c2) = RE(t1) + RE(t4);
00359                 RE(c4) = RE(t1) - RE(t4);
00360 
00361                 IM(c2) = IM(t1) + IM(t4);
00362                 IM(c4) = IM(t1) - IM(t4);
00363 
00364                 RE(ch[ah+i]) = RE(t2) + RE(t3);
00365                 RE(c3)       = RE(t2) - RE(t3);
00366 
00367                 IM(ch[ah+i]) = IM(t2) + IM(t3);
00368                 IM(c3)       = IM(t2) - IM(t3);
00369 
00370 #if 1
00371                 ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
00372                     IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
00373                 ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
00374                     IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
00375                 ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
00376                     IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
00377 #else
00378                 ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
00379                     RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
00380                 ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
00381                     RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
00382                 ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
00383                     RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
00384 #endif
00385             }
00386         }
00387     }
00388 }
00389 
00390 static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
00391                       complex_t *ch, const complex_t *wa1, const complex_t *wa2,
00392                       const complex_t *wa3)
00393 {
00394     uint16_t i, k, ac, ah;
00395 
00396     if (ido == 1)
00397     {
00398         for (k = 0; k < l1; k++)
00399         {
00400             complex_t t1, t2, t3, t4;
00401 
00402             ac = 4*k;
00403             ah = k;
00404 
00405             RE(t2) = RE(cc[ac])   + RE(cc[ac+2]);
00406             RE(t1) = RE(cc[ac])   - RE(cc[ac+2]);
00407             IM(t2) = IM(cc[ac])   + IM(cc[ac+2]);
00408             IM(t1) = IM(cc[ac])   - IM(cc[ac+2]);
00409             RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]);
00410             IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]);
00411             IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]);
00412             RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]);
00413 
00414             RE(ch[ah])      = RE(t2) + RE(t3);
00415             RE(ch[ah+2*l1]) = RE(t2) - RE(t3);
00416 
00417             IM(ch[ah])      = IM(t2) + IM(t3);
00418             IM(ch[ah+2*l1]) = IM(t2) - IM(t3);
00419 
00420             RE(ch[ah+l1])   = RE(t1) - RE(t4);
00421             RE(ch[ah+3*l1]) = RE(t1) + RE(t4);
00422 
00423             IM(ch[ah+l1])   = IM(t1) - IM(t4);
00424             IM(ch[ah+3*l1]) = IM(t1) + IM(t4);
00425         }
00426     } else {
00427         for (k = 0; k < l1; k++)
00428         {
00429             ac = 4*k*ido;
00430             ah = k*ido;
00431 
00432             for (i = 0; i < ido; i++)
00433             {
00434                 complex_t c2, c3, c4, t1, t2, t3, t4;
00435 
00436                 RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]);
00437                 RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]);
00438                 IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]);
00439                 IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]);
00440                 RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]);
00441                 IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]);
00442                 IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]);
00443                 RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]);
00444 
00445                 RE(c2) = RE(t1) - RE(t4);
00446                 RE(c4) = RE(t1) + RE(t4);
00447 
00448                 IM(c2) = IM(t1) - IM(t4);
00449                 IM(c4) = IM(t1) + IM(t4);
00450 
00451                 RE(ch[ah+i]) = RE(t2) + RE(t3);
00452                 RE(c3)       = RE(t2) - RE(t3);
00453 
00454                 IM(ch[ah+i]) = IM(t2) + IM(t3);
00455                 IM(c3)       = IM(t2) - IM(t3);
00456 
00457 #if 1
00458                 ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
00459                     RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
00460                 ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
00461                     RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
00462                 ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
00463                     RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
00464 #else
00465                 ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
00466                     IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
00467                 ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
00468                     IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
00469                 ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
00470                     IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
00471 #endif
00472             }
00473         }
00474     }
00475 }
00476 
00477 static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
00478                    complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
00479                    const complex_t *wa4, const int8_t isign)
00480 {
00481     static real_t tr11 = FRAC_CONST(0.309016994374947);
00482     static real_t ti11 = FRAC_CONST(0.951056516295154);
00483     static real_t tr12 = FRAC_CONST(-0.809016994374947);
00484     static real_t ti12 = FRAC_CONST(0.587785252292473);
00485     uint16_t i, k, ac, ah;
00486     complex_t c2, c3, c4, c5, d3, d4, d5, d2, t2, t3, t4, t5;
00487 
00488     if (ido == 1)
00489     {
00490         if (isign == 1)
00491         {
00492             for (k = 0; k < l1; k++)
00493             {
00494                 ac = 5*k + 1;
00495                 ah = k;
00496 
00497                 RE(t2) = RE(cc[ac]) + RE(cc[ac+3]);
00498                 IM(t2) = IM(cc[ac]) + IM(cc[ac+3]);
00499                 RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]);
00500                 IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]);
00501                 RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]);
00502                 IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]);
00503                 RE(t5) = RE(cc[ac]) - RE(cc[ac+3]);
00504                 IM(t5) = IM(cc[ac]) - IM(cc[ac+3]);
00505 
00506                 RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3);
00507                 IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3);
00508 
00509                 RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
00510                 IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
00511                 RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
00512                 IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
00513 
00514                 ComplexMult(&RE(c5), &RE(c4),
00515                     ti11, ti12, RE(t5), RE(t4));
00516                 ComplexMult(&IM(c5), &IM(c4),
00517                     ti11, ti12, IM(t5), IM(t4));
00518 
00519                 RE(ch[ah+l1]) = RE(c2) - IM(c5);
00520                 IM(ch[ah+l1]) = IM(c2) + RE(c5);
00521                 RE(ch[ah+2*l1]) = RE(c3) - IM(c4);
00522                 IM(ch[ah+2*l1]) = IM(c3) + RE(c4);
00523                 RE(ch[ah+3*l1]) = RE(c3) + IM(c4);
00524                 IM(ch[ah+3*l1]) = IM(c3) - RE(c4);
00525                 RE(ch[ah+4*l1]) = RE(c2) + IM(c5);
00526                 IM(ch[ah+4*l1]) = IM(c2) - RE(c5);
00527             }
00528         } else {
00529             for (k = 0; k < l1; k++)
00530             {
00531                 ac = 5*k + 1;
00532                 ah = k;
00533 
00534                 RE(t2) = RE(cc[ac]) + RE(cc[ac+3]);
00535                 IM(t2) = IM(cc[ac]) + IM(cc[ac+3]);
00536                 RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]);
00537                 IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]);
00538                 RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]);
00539                 IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]);
00540                 RE(t5) = RE(cc[ac]) - RE(cc[ac+3]);
00541                 IM(t5) = IM(cc[ac]) - IM(cc[ac+3]);
00542 
00543                 RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3);
00544                 IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3);
00545 
00546                 RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
00547                 IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
00548                 RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
00549                 IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
00550 
00551                 ComplexMult(&RE(c4), &RE(c5),
00552                     ti12, ti11, RE(t5), RE(t4));
00553                 ComplexMult(&IM(c4), &IM(c5),
00554                     ti12, ti12, IM(t5), IM(t4));
00555 
00556                 RE(ch[ah+l1]) = RE(c2) + IM(c5);
00557                 IM(ch[ah+l1]) = IM(c2) - RE(c5);
00558                 RE(ch[ah+2*l1]) = RE(c3) + IM(c4);
00559                 IM(ch[ah+2*l1]) = IM(c3) - RE(c4);
00560                 RE(ch[ah+3*l1]) = RE(c3) - IM(c4);
00561                 IM(ch[ah+3*l1]) = IM(c3) + RE(c4);
00562                 RE(ch[ah+4*l1]) = RE(c2) - IM(c5);
00563                 IM(ch[ah+4*l1]) = IM(c2) + RE(c5);
00564             }
00565         }
00566     } else {
00567         if (isign == 1)
00568         {
00569             for (k = 0; k < l1; k++)
00570             {
00571                 for (i = 0; i < ido; i++)
00572                 {
00573                     ac = i + (k*5 + 1) * ido;
00574                     ah = i + k * ido;
00575 
00576                     RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]);
00577                     IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]);
00578                     RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]);
00579                     IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]);
00580                     RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]);
00581                     IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]);
00582                     RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]);
00583                     IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]);
00584 
00585                     RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3);
00586                     IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3);
00587 
00588                     RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
00589                     IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
00590                     RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
00591                     IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
00592 
00593                     ComplexMult(&RE(c5), &RE(c4),
00594                         ti11, ti12, RE(t5), RE(t4));
00595                     ComplexMult(&IM(c5), &IM(c4),
00596                         ti11, ti12, IM(t5), IM(t4));
00597 
00598                     IM(d2) = IM(c2) + RE(c5);
00599                     IM(d3) = IM(c3) + RE(c4);
00600                     RE(d4) = RE(c3) + IM(c4);
00601                     RE(d5) = RE(c2) + IM(c5);
00602                     RE(d2) = RE(c2) - IM(c5);
00603                     IM(d5) = IM(c2) - RE(c5);
00604                     RE(d3) = RE(c3) - IM(c4);
00605                     IM(d4) = IM(c3) - RE(c4);
00606 
00607 #if 1
00608                     ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
00609                         IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
00610                     ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
00611                         IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
00612                     ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]),
00613                         IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
00614                     ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
00615                         IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
00616 #else
00617                     ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
00618                         RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
00619                     ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
00620                         RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
00621                     ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]),
00622                         RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
00623                     ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
00624                         RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
00625 #endif
00626                 }
00627             }
00628         } else {
00629             for (k = 0; k < l1; k++)
00630             {
00631                 for (i = 0; i < ido; i++)
00632                 {
00633                     ac = i + (k*5 + 1) * ido;
00634                     ah = i + k * ido;
00635 
00636                     RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]);
00637                     IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]);
00638                     RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]);
00639                     IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]);
00640                     RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]);
00641                     IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]);
00642                     RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]);
00643                     IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]);
00644 
00645                     RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3);
00646                     IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3);
00647 
00648                     RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
00649                     IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
00650                     RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
00651                     IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
00652 
00653                     ComplexMult(&RE(c4), &RE(c5),
00654                         ti12, ti11, RE(t5), RE(t4));
00655                     ComplexMult(&IM(c4), &IM(c5),
00656                         ti12, ti12, IM(t5), IM(t4));
00657 
00658                     IM(d2) = IM(c2) - RE(c5);
00659                     IM(d3) = IM(c3) - RE(c4);
00660                     RE(d4) = RE(c3) - IM(c4);
00661                     RE(d5) = RE(c2) - IM(c5);
00662                     RE(d2) = RE(c2) + IM(c5);
00663                     IM(d5) = IM(c2) + RE(c5);
00664                     RE(d3) = RE(c3) + IM(c4);
00665                     IM(d4) = IM(c3) + RE(c4);
00666 
00667 #if 1
00668                     ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
00669                         RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
00670                     ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
00671                         RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
00672                     ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]),
00673                         RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
00674                     ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
00675                         RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
00676 #else
00677                     ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
00678                         IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
00679                     ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
00680                         IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
00681                     ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]),
00682                         IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
00683                     ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
00684                         IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
00685 #endif
00686                 }
00687             }
00688         }
00689     }
00690 }
00691 
00692 
00693 /*----------------------------------------------------------------------
00694    cfftf1, cfftf, cfftb, cffti1, cffti. Complex FFTs.
00695   ----------------------------------------------------------------------*/
00696 
00697 static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
00698                              const uint16_t *ifac, const complex_t *wa,
00699                              const int8_t isign)
00700 {
00701     uint16_t i;
00702     uint16_t k1, l1, l2;
00703     uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1;
00704 
00705     nf = ifac[1];
00706     na = 0;
00707     l1 = 1;
00708     iw = 0;
00709 
00710     for (k1 = 2; k1 <= nf+1; k1++)
00711     {
00712         ip = ifac[k1];
00713         l2 = ip*l1;
00714         ido = n / l2;
00715         idl1 = ido*l1;
00716 
00717         switch (ip)
00718         {
00719         case 4:
00720             ix2 = iw + ido;
00721             ix3 = ix2 + ido;
00722 
00723             if (na == 0)
00724                 passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
00725             else
00726                 passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
00727 
00728             na = 1 - na;
00729             break;
00730         case 2:
00731             if (na == 0)
00732                 passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
00733             else
00734                 passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
00735 
00736             na = 1 - na;
00737             break;
00738         case 3:
00739             ix2 = iw + ido;
00740 
00741             if (na == 0)
00742                 passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
00743             else
00744                 passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
00745 
00746             na = 1 - na;
00747             break;
00748         case 5:
00749             ix2 = iw + ido;
00750             ix3 = ix2 + ido;
00751             ix4 = ix3 + ido;
00752 
00753             if (na == 0)
00754                 passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
00755             else
00756                 passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
00757 
00758             na = 1 - na;
00759             break;
00760         }
00761 
00762         l1 = l2;
00763         iw += (ip-1) * ido;
00764     }
00765 
00766     if (na == 0)
00767         return;
00768 
00769     for (i = 0; i < n; i++)
00770     {
00771         RE(c[i]) = RE(ch[i]);
00772         IM(c[i]) = IM(ch[i]);
00773     }
00774 }
00775 
00776 static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
00777                              const uint16_t *ifac, const complex_t *wa,
00778                              const int8_t isign)
00779 {
00780     uint16_t i;
00781     uint16_t k1, l1, l2;
00782     uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1;
00783 
00784     nf = ifac[1];
00785     na = 0;
00786     l1 = 1;
00787     iw = 0;
00788 
00789     for (k1 = 2; k1 <= nf+1; k1++)
00790     {
00791         ip = ifac[k1];
00792         l2 = ip*l1;
00793         ido = n / l2;
00794         idl1 = ido*l1;
00795 
00796         switch (ip)
00797         {
00798         case 4:
00799             ix2 = iw + ido;
00800             ix3 = ix2 + ido;
00801 
00802             if (na == 0)
00803                 passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
00804             else
00805                 passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
00806 
00807             na = 1 - na;
00808             break;
00809         case 2:
00810             if (na == 0)
00811                 passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
00812             else
00813                 passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
00814 
00815             na = 1 - na;
00816             break;
00817         case 3:
00818             ix2 = iw + ido;
00819 
00820             if (na == 0)
00821                 passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
00822             else
00823                 passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
00824 
00825             na = 1 - na;
00826             break;
00827         case 5:
00828             ix2 = iw + ido;
00829             ix3 = ix2 + ido;
00830             ix4 = ix3 + ido;
00831 
00832             if (na == 0)
00833                 passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
00834             else
00835                 passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
00836 
00837             na = 1 - na;
00838             break;
00839         }
00840 
00841         l1 = l2;
00842         iw += (ip-1) * ido;
00843     }
00844 
00845     if (na == 0)
00846         return;
00847 
00848     for (i = 0; i < n; i++)
00849     {
00850         RE(c[i]) = RE(ch[i]);
00851         IM(c[i]) = IM(ch[i]);
00852     }
00853 }
00854 
00855 void cfftf(cfft_info *cfft, complex_t *c)
00856 {
00857     cfftf1neg(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, -1);
00858 }
00859 
00860 void cfftb(cfft_info *cfft, complex_t *c)
00861 {
00862     cfftf1pos(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, +1);
00863 }
00864 
00865 static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac)
00866 {
00867     static uint16_t ntryh[4] = {3, 4, 2, 5};
00868 #ifndef FIXED_POINT
00869     real_t arg, argh, argld, fi;
00870     uint16_t ido, ipm;
00871     uint16_t i1, k1, l1, l2;
00872     uint16_t ld, ii, ip;
00873 #endif
00874     uint16_t ntry = 0, i, j;
00875     uint16_t ib;
00876     uint16_t nf, nl, nq, nr;
00877 
00878     nl = n;
00879     nf = 0;
00880     j = 0;
00881 
00882 startloop:
00883     j++;
00884 
00885     if (j <= 4)
00886         ntry = ntryh[j-1];
00887     else
00888         ntry += 2;
00889 
00890     do
00891     {
00892         nq = nl / ntry;
00893         nr = nl - ntry*nq;
00894 
00895         if (nr != 0)
00896             goto startloop;
00897 
00898         nf++;
00899         ifac[nf+1] = ntry;
00900         nl = nq;
00901 
00902         if (ntry == 2 && nf != 1)
00903         {
00904             for (i = 2; i <= nf; i++)
00905             {
00906                 ib = nf - i + 2;
00907                 ifac[ib+1] = ifac[ib];
00908             }
00909             ifac[2] = 2;
00910         }
00911     } while (nl != 1);
00912 
00913     ifac[0] = n;
00914     ifac[1] = nf;
00915 
00916 #ifndef FIXED_POINT
00917     argh = (real_t)2.0*(real_t)M_PI / (real_t)n;
00918     i = 0;
00919     l1 = 1;
00920 
00921     for (k1 = 1; k1 <= nf; k1++)
00922     {
00923         ip = ifac[k1+1];
00924         ld = 0;
00925         l2 = l1*ip;
00926         ido = n / l2;
00927         ipm = ip - 1;
00928 
00929         for (j = 0; j < ipm; j++)
00930         {
00931             i1 = i;
00932             RE(wa[i]) = 1.0;
00933             IM(wa[i]) = 0.0;
00934             ld += l1;
00935             fi = 0;
00936             argld = ld*argh;
00937 
00938             for (ii = 0; ii < ido; ii++)
00939             {
00940                 i++;
00941                 fi++;
00942                 arg = fi * argld;
00943                 RE(wa[i]) = (real_t)cos(arg);
00944 #if 1
00945                 IM(wa[i]) = (real_t)sin(arg);
00946 #else
00947                 IM(wa[i]) = (real_t)-sin(arg);
00948 #endif
00949             }
00950 
00951             if (ip > 5)
00952             {
00953                 RE(wa[i1]) = RE(wa[i]);
00954                 IM(wa[i1]) = IM(wa[i]);
00955             }
00956         }
00957         l1 = l2;
00958     }
00959 #endif
00960 }
00961 
00962 cfft_info *cffti(uint16_t n)
00963 {
00964     cfft_info *cfft = (cfft_info*)faad_malloc(sizeof(cfft_info));
00965 
00966     cfft->n = n;
00967     cfft->work = (complex_t*)faad_malloc(n*sizeof(complex_t));
00968 
00969 #ifndef FIXED_POINT
00970     cfft->tab = (complex_t*)faad_malloc(n*sizeof(complex_t));
00971 
00972     cffti1(n, cfft->tab, cfft->ifac);
00973 #else
00974     cffti1(n, NULL, cfft->ifac);
00975 
00976     switch (n)
00977     {
00978     case 64: cfft->tab = (complex_t*)cfft_tab_64; break;
00979     case 512: cfft->tab = (complex_t*)cfft_tab_512; break;
00980 #ifdef LD_DEC
00981     case 256: cfft->tab = (complex_t*)cfft_tab_256; break;
00982 #endif
00983 
00984 #ifdef ALLOW_SMALL_FRAMELENGTH
00985     case 60: cfft->tab = (complex_t*)cfft_tab_60; break;
00986     case 480: cfft->tab = (complex_t*)cfft_tab_480; break;
00987 #ifdef LD_DEC
00988     case 240: cfft->tab = (complex_t*)cfft_tab_240; break;
00989 #endif
00990 #endif
00991     case 128: cfft->tab = (complex_t*)cfft_tab_128; break;
00992     }
00993 #endif
00994 
00995     return cfft;
00996 }
00997 
00998 void cfftu(cfft_info *cfft)
00999 {
01000     if (cfft->work) faad_free(cfft->work);
01001 #ifndef FIXED_POINT
01002     if (cfft->tab) faad_free(cfft->tab);
01003 #endif
01004 
01005     if (cfft) faad_free(cfft);
01006 }
01007 

Generated on Tue Dec 13 14:47:29 2005 for guliverkli by  doxygen 1.4.5