From 8a6ce059312e1e3163c476b513ebc122831b14a3 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jean-marc.valin@octasic.com> Date: Tue, 3 Aug 2010 16:49:22 -0400 Subject: [PATCH] More FFT cleanup --- libcelt/Makefile.am | 2 +- libcelt/kfft_double.h | 80 ------------------------------------------- libcelt/kiss_fft.h | 3 +- libcelt/mdct.c | 13 +++---- 4 files changed, 10 insertions(+), 88 deletions(-) delete mode 100644 libcelt/kfft_double.h diff --git a/libcelt/Makefile.am b/libcelt/Makefile.am index 8d166cbae..21a4e6c7d 100644 --- a/libcelt/Makefile.am +++ b/libcelt/Makefile.am @@ -23,7 +23,7 @@ libcelt@LIBCELT_SUFFIX@_la_LDFLAGS = -version-info @CELT_LT_CURRENT@:@CELT_LT_RE 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 diff --git a/libcelt/kfft_double.h b/libcelt/kfft_double.h deleted file mode 100644 index 251536b74..000000000 --- a/libcelt/kfft_double.h +++ /dev/null @@ -1,80 +0,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 */ diff --git a/libcelt/kiss_fft.h b/libcelt/kiss_fft.h index 12e6d15d8..3d88c6d99 100644 --- a/libcelt/kiss_fft.h +++ b/libcelt/kiss_fft.h @@ -71,7 +71,7 @@ extern "C" { # 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 @@ extern "C" { #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; diff --git a/libcelt/mdct.c b/libcelt/mdct.c index 0117c40f3..b2b82f898 100644 --- 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 @@ void clt_mdct_init(mdct_lookup *l,int N, int maxshift) 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 @@ void clt_mdct_clear(mdct_lookup *l) { 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 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar } /* 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 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala } /* 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 */ { -- GitLab