15 -- a utility that will handle the caching of fft objects
16 -- real-only (no imaginary time component ) FFT
17 -- a multi-dimensional FFT
18 -- a command-line utility to perform ffts
19 -- a command-line utility to perform fast-convolution filtering
21 Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
22 in the tools/ directory.
26 # include <xmmintrin.h>
27 # define kiss_fft_scalar __m128
28 #define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes)
30 #define KISS_FFT_MALLOC celt_alloc
36 #ifdef DOUBLE_PRECISION
37 # define kiss_fft_scalar celt_int32_t
38 # define kiss_twiddle_scalar celt_int32_t
40 # define kiss_fft_scalar celt_int16_t
41 # define kiss_twiddle_scalar celt_int16_t
44 # ifndef kiss_fft_scalar
45 /* default is float */
46 # define kiss_fft_scalar float
47 # define kiss_twiddle_scalar float
57 kiss_twiddle_scalar r;
58 kiss_twiddle_scalar i;
61 typedef struct kiss_fft_state* kiss_fft_cfg;
66 * Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
68 * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
70 * The return value from fft_alloc is a cfg buffer used internally
71 * by the fft routine or NULL.
73 * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
74 * The returned value should be free()d when done to avoid memory leaks.
76 * The state can be placed in a user supplied buffer 'mem':
77 * If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
78 * then the function places the cfg in mem and the size used in *lenmem
81 * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
82 * then the function returns NULL and places the minimum cfg
83 * buffer size in *lenmem.
86 kiss_fft_cfg kiss_fft_alloc(int nfft,void * mem,size_t * lenmem);
89 * kiss_fft(cfg,in_out_buf)
91 * Perform an FFT on a complex input buffer.
93 * fin should be f[0] , f[1] , ... ,f[nfft-1]
94 * fout will be F[0] , F[1] , ... ,F[nfft-1]
95 * Note that each element is complex and can be accessed like
98 void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
99 void kiss_ifft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
102 A more generic version of the above function. It reads its input from every Nth sample.
104 void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
105 void kiss_ifft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
107 /** If kiss_fft_alloc allocated a buffer, it is one contiguous
108 buffer and can be simply free()d when no longer needed*/
109 #define kiss_fft_free celt_free
112 Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
113 your compiler output to call this before you exit.
115 void kiss_fft_cleanup(void);