6 #include <mediastreamer2/dsptools.h>
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 ms_malloc
35 # define kiss_fft_scalar short
37 # ifndef kiss_fft_scalar
38 /* default is float */
39 # define kiss_fft_scalar float
48 typedef struct kiss_fft_state* kiss_fft_cfg;
50 /* add a prefix to these function to avoid collision with the ones defined in speex*/
51 #define kiss_fft_alloc ms_kiss_fft_alloc
52 #define kiss_fft ms_kiss_fft
53 #define kiss_fft_stride ms_kiss_fft_stride
54 #define kiss_fft_cleanup ms_kiss_fft_cleanup
60 * Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
62 * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
64 * The return value from fft_alloc is a cfg buffer used internally
65 * by the fft routine or NULL.
67 * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
68 * The returned value should be free()d when done to avoid memory leaks.
70 * The state can be placed in a user supplied buffer 'mem':
71 * If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
72 * then the function places the cfg in mem and the size used in *lenmem
75 * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
76 * then the function returns NULL and places the minimum cfg
77 * buffer size in *lenmem.
80 kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
83 * kiss_fft(cfg,in_out_buf)
85 * Perform an FFT on a complex input bufferb.
87 * fin should be f[0] , f[1] , ... ,f[nfft-1]
88 * fout will be F[0] , F[1] , ... ,F[nfft-1]
89 * Note that each element is complex and can be accessed like
92 void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
95 A more generic version of the above function. It reads its input from every Nth sample.
97 void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
99 /* If kiss_fft_alloc allocated a buffer, it is one contiguous
100 buffer and can be simply free()d when no longer needed*/
101 #define kiss_fft_free ms_free
104 Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
105 your compiler output to call this before you exit.
107 void kiss_fft_cleanup(void);