5#if WDL_FFT_REALSIZE != EEL_F_SIZE
6#error WDL_FFT_REALSIZE -- EEL_F_SIZE size mismatch
9#ifndef EEL_FFT_MINBITLEN
10#define EEL_FFT_MINBITLEN 4
13#ifndef EEL_FFT_MAXBITLEN
14#define EEL_FFT_MAXBITLEN 15
17#ifndef EEL_FFT_MINBITLEN_REORDER
18#define EEL_FFT_MINBITLEN_REORDER (EEL_FFT_MINBITLEN-1)
24#ifdef EEL_SUPER_FAST_FFT_REORDERING
25static int *fft_reorder_table_for_bitsize(
int bitsz)
31static void fft_make_reorder_table(
int bitsz,
int *tab)
33 const int fft_sz=1<<bitsz;
37 memset(
flag,0,fft_sz);
39 for (
x=0;
x<fft_sz;
x++)
62 const int *tab=fft_reorder_table_for_bitsize(bitsz);
67 const int sidx=*tab++;
85 const int sidx=*tab++;
102#ifndef EEL_SLOW_FFT_REORDERING
129 static const int tab4_8_32[]={ 1, 0 };
130 static const int tab16[]={ 1, 3, 0 };
131 static const int tab64[]={ 1, 3, 9, 0 };
132 static const int tab128[]={ 1, 3, 4, 9, 14, 0 };
133 static const int tab256[]={ 1, 3, 6, 12, 13, 14, 19, 0 };
134 static const int tab512[]={ 1, 4, 7, 9, 18, 50, 115, 0 };
135 static const int tab1024[]={ 1, 3, 4, 25, 26, 77, 79, 0 };
136 static const int tab2048[]={ 1, 58, 59, 106, 135, 206, 210, 212, 0 };
137 static const int tab4096[]={ 1, 3, 12, 25, 54, 221, 313, 431, 453, 0 };
138 static const int tab8192[]={ 1, 12, 18, 26, 30, 100, 101, 106, 113, 144, 150, 237, 244, 247, 386, 468, 513, 1210, 4839, 0 };
139 static const int tab16384[]={ 1, 3, 6, 24, 1219, 0 };
140 static const int tab32768[]={ 1, 3, 4, 7, 13, 18, 31, 64, 113, 145, 203, 246, 594, 956, 1871, 2439, 4959, 19175, 0 };
148 case 5: tab = tab4_8_32;
break;
149 case 4: tab=tab16;
break;
150 case 6: tab=tab64;
break;
151 case 7: tab=tab128;
break;
152 case 8: tab=tab256;
break;
153 case 9: tab=tab512;
break;
154 case 10: tab=tab1024;
break;
155 case 11: tab=tab2048;
break;
156 case 12: tab=tab4096;
break;
157 case 13: tab=tab8192;
break;
158 case 14: tab=tab16384;
break;
159 case 15: tab=tab32768;
break;
163 const int fft_sz=1<<bitsz;
171 const int sidx=*tab++;
178 if (idx==sidx)
break;
190 const int sidx=*tab++;
195 const int idx=tb2[lidx];
196 if (idx==sidx)
break;
217static void FFT(
int sizebits, EEL_F *
data,
int dir)
219 if (dir >= 4 && dir < 8)
221 if (dir == 4 || dir == 5)
224#if defined(EEL_SUPER_FAST_FFT_REORDERING) || !defined(EEL_SLOW_FFT_REORDERING)
228 const int flen=1<<sizebits;
230 EEL_F *tmp=(EEL_F*)alloca(
sizeof(EEL_F)*flen*2);
231 const int flen2=flen+flen;
237 for (
x = 0;
x < flen2;
x += 2)
246 for (
x = 0;
x < flen2;
x += 2)
257 else if (dir >= 0 && dir < 2)
261 else if (dir >= 2 && dir < 4)
271 const int offs = (
int)(*
start + 0.0001);
272 const int itemSizeShift=(dir&2)?0:1;
338 const int dest_offs = (
int)(*dest + 0.0001);
339 const int src_offs = (
int)(*src + 0.0001);
340 const int len = ((
int)(*lenptr + 0.0001)) * 2;
341 EEL_F *srcptr,*destptr;
362#if defined(EEL_SUPER_FAST_FFT_REORDERING)
378#ifdef EEL_WANT_DOCUMENTATION
379static const char *eel_fft_function_reference =
380"convolve_c\tdest,src,size\tMultiplies each of size complex pairs in dest by the complex pairs in src. Often used for convolution.\0"
381"fft\tbuffer,size\tPerforms a FFT on the data in the local memory buffer at the offset specified by the first parameter. The size of the FFT is specified "
382 "by the second parameter, which must be 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, or 32768. The outputs are permuted, so if "
383 "you plan to use them in-order, call fft_permute(buffer, size) before and fft_ipermute(buffer,size) after your in-order use. Your inputs or "
384 "outputs will need to be scaled down by 1/size, if used.\n"
385 "Note that fft()/ifft() require real / imaginary input pairs, so a 256 point FFT actually works with 512 items.\n"
386 "Note that fft()/ifft() must NOT cross a 65,536 item boundary, so be sure to specify the offset accordingly.\0"
387"ifft\tbuffer,size\tPerform an inverse FFT. For more information see fft().\0"
388"fft_real\tbuffer,size\tPerforms an FFT, but takes size input samples and produces size/2 complex output pairs. Usually used along with fft_permute(size/2). Inputs/outputs will need to be scaled by 0.5/size.\0"
389"ifft_real\tbuffer,size\tPerforms an inverse FFT, but takes size/2 complex input pairs and produces size real output values. Usually used along with fft_ipermute(size/2).\0"
390"fft_permute\tbuffer,size\tPermute the output of fft() to have bands in-order. See fft() for more information.\0"
391"fft_ipermute\tbuffer,size\tPermute the input for ifft(), taking bands from in-order to the order ifft() requires. See fft() for more information.\0"
float WDL_FFT_REAL
Definition fft.h:42
uint8_t a
Definition Spc_Cpu.h:141
int * l
Definition inflate.c:1579
int y
Definition inflate.c:1588
unsigned x[BMAX+1]
Definition inflate.c:1586
static EEL_F *NSEEL_CGEN_CALL eel_fft(EEL_F **blocks, EEL_F *start, EEL_F *length)
Definition eel_fft.h:306
static EEL_F *NSEEL_CGEN_CALL eel_ifft(EEL_F **blocks, EEL_F *start, EEL_F *length)
Definition eel_fft.h:311
static void FFT(int sizebits, EEL_F *data, int dir)
Definition eel_fft.h:217
void EEL_fft_register()
Definition eel_fft.h:359
#define EEL_FFT_MINBITLEN
Definition eel_fft.h:10
static EEL_F *NSEEL_CGEN_CALL eel_convolve_c(EEL_F **blocks, EEL_F *dest, EEL_F *src, EEL_F *lenptr)
Definition eel_fft.h:336
#define EEL_FFT_MAXBITLEN
Definition eel_fft.h:14
static EEL_F *NSEEL_CGEN_CALL eel_ifft_real(EEL_F **blocks, EEL_F *start, EEL_F *length)
Definition eel_fft.h:321
static EEL_F *NSEEL_CGEN_CALL eel_ifft_permute(EEL_F **blocks, EEL_F *start, EEL_F *length)
Definition eel_fft.h:331
#define EEL_FFT_MINBITLEN_REORDER
Definition eel_fft.h:18
static EEL_F * fft_func(int dir, EEL_F **blocks, EEL_F *start, EEL_F *length)
Definition eel_fft.h:269
static EEL_F *NSEEL_CGEN_CALL eel_fft_permute(EEL_F **blocks, EEL_F *start, EEL_F *length)
Definition eel_fft.h:326
static EEL_F *NSEEL_CGEN_CALL eel_fft_real(EEL_F **blocks, EEL_F *start, EEL_F *length)
Definition eel_fft.h:316
static void fft_reorder_buffer(int bitsz, WDL_FFT_COMPLEX *data, int fwd)
Definition eel_fft.h:105
#define NSEEL_addfunc_retptr(name, np, pproc, fptr)
Definition eel_import.h:55
void *(* NSEEL_PProc_RAM)(void *data, int data_size, struct _compileContext *ctx)
Definition eel_import.h:39
int * WDL_fft_permute_tab(int fftsize)
Definition fft.c:1022
void WDL_fft_complexmul(WDL_FFT_COMPLEX *a, WDL_FFT_COMPLEX *b, int n)
Definition fft.c:580
void WDL_real_fft(WDL_FFT_REAL *buf, int len, int isInverse)
Definition fft.c:1178
void WDL_fft_init()
Definition fft.c:1030
int WDL_fft_permute(int fftsize, int idx)
Definition fft.c:1018
void WDL_fft(WDL_FFT_COMPLEX *buf, int len, int isInverse)
Definition fft.c:1065
virtual ASIOError start()=0
JSAMPIMAGE data
Definition jpeglib.h:945
EEL_F *NSEEL_CGEN_CALL __NSEEL_RAMAlloc(EEL_F **blocks, unsigned int w)
Definition nseel-ram.c:139
EEL_F nseel_ramalloc_onfail
Definition nseel-ram.c:92
#define NSEEL_CGEN_CALL
Definition ns-eel.h:44
#define NSEEL_RAM_ITEMSPERBLOCK
Definition ns-eel.h:235
#define NSEEL_RAM_BLOCKS
Definition ns-eel.h:234
png_uint_32 length
Definition png.c:2247
memcpy(hh, h, RAND_HEAD_LEN)
int flag
Definition unix.c:754
typedef int(UZ_EXP MsgFn)()