Merge branch 'master' of http://www-dev.cockos.com/wdl/WDL into updatewdl
[wdl/wdl-ol.git] / WDL / fft.h
blobf4b2535fbc9b9ea37cc37b64f5df1444f6095d0f
1 /*
2 WDL - fft.h
3 Copyright (C) 2006 and later Cockos Incorporated
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
23 This file defines the interface to the WDL FFT library. These routines are based on the
24 DJBFFT library, which are Copyright 1999 D. J. Bernstein, djb@pobox.com
26 The DJB FFT web page is: http://cr.yp.to/djbfft.html
30 #ifndef _WDL_FFT_H_
31 #define _WDL_FFT_H_
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 #ifndef WDL_FFT_REALSIZE
38 #define WDL_FFT_REALSIZE 4
39 #endif
41 #if WDL_FFT_REALSIZE == 4
42 typedef float WDL_FFT_REAL;
43 #elif WDL_FFT_REALSIZE == 8
44 typedef double WDL_FFT_REAL;
45 #else
46 #error invalid FFT item size
47 #endif
49 typedef struct {
50 WDL_FFT_REAL re;
51 WDL_FFT_REAL im;
52 } WDL_FFT_COMPLEX;
54 extern void WDL_fft_init();
56 extern void WDL_fft_complexmul(WDL_FFT_COMPLEX *dest, WDL_FFT_COMPLEX *src, int len);
57 extern void WDL_fft_complexmul2(WDL_FFT_COMPLEX *dest, WDL_FFT_COMPLEX *src, WDL_FFT_COMPLEX *src2, int len);
58 extern void WDL_fft_complexmul3(WDL_FFT_COMPLEX *destAdd, WDL_FFT_COMPLEX *src, WDL_FFT_COMPLEX *src2, int len);
60 extern void WDL_fft(WDL_FFT_COMPLEX *, int len, int isInverse);
62 #if 0 // these dont work right!
63 extern void WDL_fft_realmul(WDL_FFT_REAL *dest, WDL_FFT_REAL *src, int len);
64 extern void WDL_real_fft(WDL_FFT_REAL *, int len, int isInverse);
65 #endif
67 int WDL_fft_permute(int fftsize, int idx);
68 int *WDL_fft_permute_tab(int fftsize);
70 #ifdef __cplusplus
72 #endif
74 #endif