00001 #ifndef KISS_FFT_H
00002 #define KISS_FFT_H
00003
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 #include <math.h>
00007 #include <string.h>
00008 #include <malloc.h>
00009
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifdef USE_SIMD
00028 # include <xmmintrin.h>
00029 # define kiss_fft_scalar __m128
00030 #define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes)
00031 #else
00032 #define KISS_FFT_MALLOC malloc
00033 #endif
00034
00035
00036 #ifdef FIXED_POINT
00037 #include <sys/types.h>
00038 # if (FIXED_POINT == 32)
00039 # define kiss_fft_scalar int32_t
00040 # else
00041 # define kiss_fft_scalar int16_t
00042 # endif
00043 #else
00044 # ifndef kiss_fft_scalar
00045
00046 # define kiss_fft_scalar float
00047 # endif
00048 #endif
00049
00050 typedef struct {
00051 kiss_fft_scalar r;
00052 kiss_fft_scalar i;
00053 }kiss_fft_cpx;
00054
00055
00056
00057
00058 typedef struct _kiss_fft_context
00059 {
00060 kiss_fft_cpx *scratchbuf;
00061 size_t nscratchbuf;
00062 kiss_fft_cpx *tmpbuf;
00063 size_t ntmpbuf;
00064 } kiss_fft_context;
00065
00066 typedef struct kiss_fft_state* kiss_fft_cfg;
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 void kiss_fft(kiss_fft_context *ctx,kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
00105
00106
00107
00108
00109 void kiss_fft_stride(kiss_fft_context *ctx,kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
00110
00111
00112
00113 #define kiss_fft_free free
00114
00115
00116
00117
00118 kiss_fft_context *kiss_fft_init(void);
00119
00120
00121
00122
00123
00124 void kiss_fft_cleanup(kiss_fft_context *);
00125
00126
00127
00128
00129
00130 int kiss_fft_next_fast_size(int n);
00131
00132
00133 #define kiss_fftr_next_fast_size_real(n) \
00134 (kiss_fft_next_fast_size( ((n)+1)>>1)<<1)
00135
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139
00140 #endif