shithub: opus

Download patch

ref: 8a6ce059312e1e3163c476b513ebc122831b14a3
parent: 4b71303656e23cd9b9ee8c863d6f21b3a174ea31
author: Jean-Marc Valin <[email protected]>
date: Tue Aug 3 12:49:22 EDT 2010

More FFT cleanup

--- a/libcelt/Makefile.am
+++ b/libcelt/Makefile.am
@@ -23,7 +23,7 @@
 
 noinst_HEADERS = _kiss_fft_guts.h arch.h bands.h fixed_c5x.h fixed_c6x.h \
 	cwrs.h ecintrin.h entcode.h entdec.h entenc.h fixed_generic.h float_cast.h \
-	kfft_double.h kiss_fft.h laplace.h mdct.h mfrngcod.h \
+	kiss_fft.h laplace.h mdct.h mfrngcod.h \
 	mathops.h modes.h os_support.h pitch.h \
 	quant_bands.h rate.h stack_alloc.h vq.h plc.h
 
--- a/libcelt/kfft_double.h
+++ /dev/null
@@ -1,80 +1,0 @@
-/* Copyright (c) 2008 Xiph.Org Foundation, CSIRO
-*/
-/*
-   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 the Xiph.org Foundation 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 FOUNDATION 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.
-*/
-
-#ifndef KFFT_DOUBLE_H
-#define KFFT_DOUBLE_H
-
-#ifdef ENABLE_TI_DSPLIB55
-
-#include "dsplib.h"
-#include "_kiss_fft_guts.h"
-
-#define cpx32_fft_alloc(length) NULL
-#define cpx32_fft_free(state)
-
-#define cpx32_fft(state, X, Y, nx)\
-    (\
-      cfft32_SCALE(X,nx),\
-      cbrev32(X,Y,nx)\
-    )
-
-#define cpx32_ifft(state, X, Y, nx) \
-    (\
-      cifft32_NOSCALE(X,nx),\
-      cbrev32(X,Y,nx)\
-    )
-
-
-#elif defined(ENABLE_TI_DSPLIB64)
-
-#include "kiss_fft.h"
-#include "_kiss_fft_guts.h"
-#include "c64_fft.h"
-
-#define cpx32_fft_alloc(length) 	(kiss_fft_cfg)(c64_fft32_alloc(length, 0, 0))
-#define cpx32_fft_free(state) 		c64_fft32_free((c64_fft_t *)state)
-#define cpx32_fft(state, X, Y, nx) 	c64_fft32 ((c64_fft_t *)state, (const celt_int32 *)(X), (celt_int32 *)(Y))
-#define cpx32_ifft(state, X, Y, nx) 	c64_ifft32((c64_fft_t *)state, (const celt_int32 *)(X), (celt_int32 *)(Y))
-
-#else /* ENABLE_TI_DSPLIB55/64 */
-
-#include "kiss_fft.h"
-#include "_kiss_fft_guts.h"
-
-#define cpx32_fft_alloc_twiddles(length,from) kiss_fft_alloc_twiddles(length, 0, 0, from)
-#define cpx32_fft_alloc(length) kiss_fft_alloc(length, 0, 0)
-#define cpx32_fft_free(state) kiss_fft_free(state)
-#define cpx32_fft(state, X, Y, nx) kiss_fft(state,(const kiss_fft_cpx *)(X), (kiss_fft_cpx *)(Y))
-#define cpx32_ifft(state, X, Y, nx) kiss_ifft(state,(const kiss_fft_cpx *)(X), (kiss_fft_cpx *)(Y))
-
-#endif /* !ENABLE_TI_DSPLIB */
-
-#endif /* KFFT_DOUBLE_H */
--- a/libcelt/kiss_fft.h
+++ b/libcelt/kiss_fft.h
@@ -71,7 +71,7 @@
 # endif
 #endif
 
-
+#if 0
 /* This adds a suffix to all the kiss_fft functions so we
    can easily link with more than one copy of the fft */
 #define CAT_SUFFIX(a,b) a ## b
@@ -85,6 +85,7 @@
 #define kiss_ifft_stride SUF(kiss_ifft_stride,KF_SUFFIX)
 #define kiss_fft_free SUF(kiss_fft_free,KF_SUFFIX)
 
+#endif
 
 typedef struct {
     kiss_fft_scalar r;
--- a/libcelt/mdct.c
+++ b/libcelt/mdct.c
@@ -48,7 +48,8 @@
 #endif
 
 #include "mdct.h"
-#include "kfft_double.h"
+#include "kiss_fft.h"
+#include "_kiss_fft_guts.h"
 #include <math.h>
 #include "os_support.h"
 #include "mathops.h"
@@ -70,9 +71,9 @@
    for (i=0;i<=maxshift;i++)
    {
       if (i==0)
-         l->kfft[i] = cpx32_fft_alloc(N>>2>>i);
+         l->kfft[i] = kiss_fft_alloc(N>>2>>i, 0, 0);
       else
-         l->kfft[i] = cpx32_fft_alloc_twiddles(N>>2>>i, l->kfft[0]);
+         l->kfft[i] = kiss_fft_alloc_twiddles(N>>2>>i, 0, 0, l->kfft[0]);
 #ifndef ENABLE_TI_DSPLIB55
       if (l->kfft[i]==NULL)
          return;
@@ -95,7 +96,7 @@
 {
    int i;
    for (i=0;i<=l->maxshift;i++)
-      cpx32_fft_free(l->kfft[i]);
+      kiss_fft_free(l->kfft[i]);
    celt_free(l->kfft);
    celt_free(l->trig);
 }
@@ -177,7 +178,7 @@
    }
 
    /* N/4 complex FFT, down-scales by 4/N */
-   cpx32_fft(l->kfft[shift], out, f, N4);
+   kiss_fft(l->kfft[shift], (kiss_fft_cpx *)out, (kiss_fft_cpx *)f);
 
    /* Post-rotate */
    {
@@ -246,7 +247,7 @@
    }
 
    /* Inverse N/4 complex FFT. This one should *not* downscale even in fixed-point */
-   cpx32_ifft(l->kfft[shift], f2, f, N4);
+   kiss_ifft(l->kfft[shift], (kiss_fft_cpx *)f2, (kiss_fft_cpx *)f);
    
    /* Post-rotate */
    {