Skip to content
Snippets Groups Projects
Commit 8a6ce059 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

More FFT cleanup

parent 4b713036
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
/* 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 */
......@@ -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;
......
......@@ -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 */
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment