お試しプログラム
修订版 | 6625bc88014c923c9ced0883a4810c8ddccd7ac3 (tree) |
---|---|
时间 | 2013-04-13 22:28:03 |
作者 | sambuichi <sambuichi@gmai...> |
Commiter | sambuichi |
FFTWのテストコード環境を追加
@@ -1,6 +1,7 @@ | ||
1 | 1 | # my git ignore |
2 | 2 | c/sqlite/test1/*.db |
3 | 3 | *.o |
4 | +*.raw | |
4 | 5 | *.pcm |
5 | 6 | *.wav |
6 | 7 | *.log |
@@ -0,0 +1,53 @@ | ||
1 | +#include "FftContainer.h" | |
2 | + | |
3 | +template <int N> | |
4 | +FftContainer<N>::FftContainer() : | |
5 | + plan_r2c(NULL), | |
6 | + plan_c2r(NULL), | |
7 | + bufferIndex(0), | |
8 | + manipulation(NULL) | |
9 | +{ | |
10 | + plan_r2c = fftw_plan_dft_r2c_1d(N, timeSigBuffer, freqSigBuffer, FFTW_ESTIMATE); | |
11 | + plan_c2r = fftw_plan_dft_c2r_1d(N, freqSigBuffer, timeSigOutBuffer, FFTW_ESTIMATE); | |
12 | + | |
13 | + memset(timeSigBuffer, 0, sizeof(timeSigBuffer)); | |
14 | + memset(freqSigBuffer, 0, sizeof(freqSigBuffer)); | |
15 | + memset(timeSigOutBuffer, 0, sizeof(timeSigOutBuffer)); | |
16 | +} | |
17 | + | |
18 | +template <int N> | |
19 | +FftContainer<N>::~FftContainer() | |
20 | +{ | |
21 | + fftw_destroy_plan(plan_r2c); | |
22 | + fftw_destroy_plan(plan_c2r); | |
23 | +} | |
24 | + | |
25 | +template <int N> | |
26 | +double FftContainer<N>::tick(double inValue) | |
27 | +{ | |
28 | + double outValue = 0; | |
29 | + | |
30 | + // TODO buffering timeSigBuffer <- value | |
31 | + | |
32 | + timeSigBuffer[bufferIndex++] = inValue; | |
33 | + | |
34 | + outValue = freqSigBuffer[bufferIndex++]; | |
35 | + | |
36 | + if(bufferIndex == N) { | |
37 | + bufferIndex = 0; | |
38 | + | |
39 | + fftw_execute(plan_r2c); | |
40 | + | |
41 | + // change complex signal | |
42 | + // TODO manipulate | |
43 | + if(manipulation != NULL) { | |
44 | + manipulation->exec(freqSigBuffer); | |
45 | + } | |
46 | + | |
47 | + fftw_execute(plan_c2r); | |
48 | + | |
49 | + // TODO buffering output time signal buffer | |
50 | + } | |
51 | + | |
52 | + return outValue; | |
53 | +} |
@@ -0,0 +1,37 @@ | ||
1 | +#ifndef __FFTW_CONTAINER__ | |
2 | +#define __FFTW_CONTAINER__ | |
3 | + | |
4 | +#include <fftw3.h> | |
5 | + | |
6 | +// FFT frequency domain singnal manipulation interface | |
7 | +class FftManipulation { | |
8 | +public: | |
9 | + void exec(fftw_complex *sig); | |
10 | +}; | |
11 | + | |
12 | +template <int N> | |
13 | +class FftContainer { | |
14 | +public: | |
15 | + FftContainer(); | |
16 | + ~FftContainer(); | |
17 | + | |
18 | + double tick(double value); | |
19 | + | |
20 | + void setManipulation(FftManipulation *m) { | |
21 | + this->manipulation = m; | |
22 | + } | |
23 | + | |
24 | +private: | |
25 | + double timeSigBuffer[N]; | |
26 | + fftw_complex freqSigBuffer[N]; | |
27 | + double timeSigOutBuffer[N]; | |
28 | + | |
29 | + int bufferIndex; | |
30 | + | |
31 | + fftw_plan plan_r2c; | |
32 | + fftw_plan plan_c2r; | |
33 | + | |
34 | + FftManipulation *manipulation; | |
35 | +}; | |
36 | + | |
37 | +#endif // __FFTW_CONTAINER__ |
@@ -0,0 +1,22 @@ | ||
1 | +CC := g++ -g | |
2 | +#INCLUDE := -I../../../opensource/fftw-3.3.2/api/ | |
3 | +INCLUDE := -I../Include | |
4 | +TARGET := run | |
5 | +DEFS := | |
6 | +OBJS := main.o FftContainer.o | |
7 | + | |
8 | +OBJS := $(patsubst %,obj/%,$(OBJS)) | |
9 | + | |
10 | +obj/%.o: %.cpp | |
11 | + $(CC) $(INCLUDE) $(DEFS) -c $< -o $@ | |
12 | + | |
13 | +# $(TARGET): $(OBJS) | |
14 | +# $(CC) -o $(TARGET) $(OBJS) -L../../../opensource/fftw-3.3.2/ -lfftw3 | |
15 | + | |
16 | +$(TARGET): $(OBJS) | |
17 | + $(CC) -o $(TARGET) $(OBJS) -L../lib/ -lfftw3 | |
18 | + | |
19 | +all: $(TARGET) | |
20 | + | |
21 | +clean: | |
22 | + rm -rf obj/*.o $(TARGET) | |
\ No newline at end of file |
@@ -0,0 +1,2 @@ | ||
1 | +sox -t raw -e signed-integer -r320 -c1 -b16 input.raw -t wav input.wav | |
2 | +sox -t raw -e signed-integer -r320 -c1 -b16 fft.raw -t wav fft.wav |
@@ -0,0 +1,257 @@ | ||
1 | +num sig1 sig2 real imag | |
2 | +0 0.000000 0.000000 0.000000 0.000000 | |
3 | +1 0.269322 0.269322 63.980724 -62.429361 | |
4 | +2 0.465494 0.465494 0.000000 0.000000 | |
5 | +3 0.536180 0.536180 0.000000 0.000000 | |
6 | +4 0.464743 0.464743 0.000000 0.000000 | |
7 | +5 0.274983 0.274983 0.000000 0.000000 | |
8 | +6 0.024357 0.024357 -0.000000 0.000000 | |
9 | +7 -0.212369 -0.212369 -0.000000 0.000000 | |
10 | +8 -0.364395 -0.364395 -0.000000 0.000000 | |
11 | +9 -0.385038 -0.385038 -0.000000 0.000000 | |
12 | +10 -0.265015 -0.265015 -54.894631 96.902576 | |
13 | +11 -0.035089 -0.035089 0.000000 -0.000000 | |
14 | +12 0.242687 0.242687 0.000000 -0.000000 | |
15 | +13 0.492620 0.492620 0.000000 -0.000000 | |
16 | +14 0.646915 0.646915 0.000000 -0.000000 | |
17 | +15 0.664963 0.664963 0.000000 -0.000000 | |
18 | +16 0.544895 0.544895 0.000000 0.000000 | |
19 | +17 0.324111 0.324111 0.000000 0.000000 | |
20 | +18 0.068635 0.068635 0.000000 0.000000 | |
21 | +19 -0.145670 -0.145670 -0.000000 0.000000 | |
22 | +20 -0.254694 -0.254694 -0.000000 0.000000 | |
23 | +21 -0.224323 -0.224323 -0.000000 0.000000 | |
24 | +22 -0.060145 -0.060145 54.894631 -31.097424 | |
25 | +23 0.194134 0.194134 0.000000 -0.000000 | |
26 | +24 0.469127 0.469127 0.000000 -0.000000 | |
27 | +25 0.689508 0.689508 0.000000 0.000000 | |
28 | +26 0.795442 0.795442 0.000000 0.000000 | |
29 | +27 0.759610 0.759610 0.000000 0.000000 | |
30 | +28 0.594982 0.594982 0.000000 0.000000 | |
31 | +29 0.351120 0.351120 0.000000 0.000000 | |
32 | +30 0.100081 0.100081 0.000000 0.000000 | |
33 | +31 -0.084094 -0.084094 -63.980724 65.570639 | |
34 | +32 -0.146447 -0.146447 0.000000 0.000000 | |
35 | +33 -0.066741 -0.066741 66.966920 -59.214777 | |
36 | +34 0.134777 0.134777 0.000000 0.000000 | |
37 | +35 0.403138 0.403138 0.000000 0.000000 | |
38 | +36 0.664290 0.664290 0.000000 0.000000 | |
39 | +37 0.846168 0.846168 0.000000 0.000000 | |
40 | +38 0.899196 0.899196 0.000000 0.000000 | |
41 | +39 0.810396 0.810396 0.000000 0.000000 | |
42 | +40 0.607077 0.607077 0.000000 0.000000 | |
43 | +41 0.349062 0.349062 0.000000 0.000000 | |
44 | +42 0.111668 0.111668 59.583292 94.092300 | |
45 | +43 -0.035729 -0.035729 -0.000000 -0.000000 | |
46 | +44 -0.049432 -0.049432 -0.000000 -0.000000 | |
47 | +45 0.076137 0.076137 -0.000000 -0.000000 | |
48 | +46 0.306852 0.306852 -0.000000 -0.000000 | |
49 | +47 0.578595 0.578595 -0.000000 -0.000000 | |
50 | +48 0.815493 0.815493 -0.000000 -0.000000 | |
51 | +49 0.951512 0.951512 -0.000000 -0.000000 | |
52 | +50 0.949242 0.949242 -0.000000 -0.000000 | |
53 | +51 0.810544 0.810544 -0.000000 -0.000000 | |
54 | +52 0.576015 0.576015 -0.000000 -0.000000 | |
55 | +53 0.313443 0.313443 -0.000000 -0.000000 | |
56 | +54 0.098510 0.098510 53.302630 33.753518 | |
57 | +55 -0.006737 -0.006737 0.000000 0.000000 | |
58 | +56 0.028453 0.028453 0.000000 0.000000 | |
59 | +57 0.194789 0.194789 0.000000 0.000000 | |
60 | +58 0.445580 0.445580 0.000000 0.000000 | |
61 | +59 0.710017 0.710017 0.000000 0.000000 | |
62 | +60 0.913327 0.913327 0.000000 0.000000 | |
63 | +61 0.998043 0.998043 0.000000 0.000000 | |
64 | +62 0.940358 0.940358 0.000000 0.000000 | |
65 | +63 0.756901 0.756901 -60.686258 68.631041 | |
66 | +64 0.500000 0.500000 0.000000 -0.000000 | |
67 | +65 0.242798 0.242798 69.791787 -55.857539 | |
68 | +66 0.058437 0.058437 0.000000 -0.000000 | |
69 | +67 -0.000752 -0.000752 0.000000 -0.000000 | |
70 | +68 0.081858 0.081858 0.000000 -0.000000 | |
71 | +69 0.282462 0.282462 0.000000 -0.000000 | |
72 | +70 0.543597 0.543597 0.000000 -0.000000 | |
73 | +71 0.790488 0.790488 0.000000 -0.000000 | |
74 | +72 0.952332 0.952332 0.000000 -0.000000 | |
75 | +73 0.982439 0.982439 0.000000 -0.000000 | |
76 | +74 0.871521 0.871521 111.069370 -8.192969 | |
77 | +75 0.650333 0.650333 -0.000000 -0.000000 | |
78 | +76 0.380925 0.380925 -0.000000 -0.000000 | |
79 | +77 0.138985 0.138985 -0.000000 -0.000000 | |
80 | +78 -0.007698 -0.007698 -0.000000 -0.000000 | |
81 | +79 -0.018519 -0.018519 -0.000000 -0.000000 | |
82 | +80 0.108386 0.108386 -0.000000 -0.000000 | |
83 | +81 0.335615 0.335615 -0.000000 -0.000000 | |
84 | +82 0.597137 0.597137 -0.000000 -0.000000 | |
85 | +83 0.817088 0.817088 -0.000000 -0.000000 | |
86 | +84 0.931353 0.931353 -0.000000 -0.000000 | |
87 | +85 0.905816 0.905816 -0.000000 -0.000000 | |
88 | +86 0.746061 0.746061 -4.641260 62.920021 | |
89 | +87 0.495792 0.495792 -0.000000 0.000000 | |
90 | +88 0.224393 0.224393 -0.000000 0.000000 | |
91 | +89 0.007189 0.007189 -0.000000 0.000000 | |
92 | +90 -0.095989 -0.095989 -0.000000 0.000000 | |
93 | +91 -0.057821 -0.057821 -0.000000 0.000000 | |
94 | +92 0.108720 0.108720 -0.000000 -0.000000 | |
95 | +93 0.354071 0.354071 -0.000000 -0.000000 | |
96 | +94 0.606174 0.606174 -0.000000 -0.000000 | |
97 | +95 0.790988 0.790988 -57.245593 71.526106 | |
98 | +96 0.853553 0.853553 -0.000000 -0.000000 | |
99 | +97 0.773635 0.773635 72.448519 -52.365736 | |
100 | +98 0.571478 0.571478 -0.000000 -0.000000 | |
101 | +99 0.302053 0.302053 -0.000000 -0.000000 | |
102 | +100 0.039412 0.039412 -0.000000 -0.000000 | |
103 | +101 -0.144379 -0.144379 -0.000000 -0.000000 | |
104 | +102 -0.199743 -0.199743 -0.000000 -0.000000 | |
105 | +103 -0.113700 -0.113700 0.000000 -0.000000 | |
106 | +104 0.086443 0.086443 0.000000 -0.000000 | |
107 | +105 0.340864 0.340864 0.000000 -0.000000 | |
108 | +106 0.574248 0.574248 45.132185 -101.816578 | |
109 | +107 0.717221 0.717221 -0.000000 0.000000 | |
110 | +108 0.726091 0.726091 -0.000000 0.000000 | |
111 | +109 0.595281 0.595281 -0.000000 0.000000 | |
112 | +110 0.358920 0.358920 -0.000000 0.000000 | |
113 | +111 0.081131 0.081131 -0.000000 0.000000 | |
114 | +112 -0.162212 -0.162212 -0.000000 0.000000 | |
115 | +113 -0.305068 -0.305068 -0.000000 -0.000000 | |
116 | +114 -0.310025 -0.310025 -0.000000 -0.000000 | |
117 | +115 -0.178939 -0.178939 0.000000 -0.000000 | |
118 | +116 0.047597 0.047597 0.000000 -0.000000 | |
119 | +117 0.301801 0.301801 0.000000 -0.000000 | |
120 | +118 0.507995 0.507995 -57.678379 25.567067 | |
121 | +119 0.604139 0.604139 -0.000000 0.000000 | |
122 | +120 0.559485 0.559485 -0.000000 0.000000 | |
123 | +121 0.383331 0.383331 -0.000000 -0.000000 | |
124 | +122 0.122374 0.122374 -0.000000 -0.000000 | |
125 | +123 -0.152572 -0.152572 -0.000000 -0.000000 | |
126 | +124 -0.366726 -0.366726 -0.000000 -0.000000 | |
127 | +125 -0.462615 -0.462615 -0.000000 -0.000000 | |
128 | +126 -0.416427 -0.416427 -0.000000 -0.000000 | |
129 | +127 -0.244781 -0.244781 -53.667019 74.248858 | |
130 | +128 -0.000000 -0.000000 0.000000 0.000000 | |
131 | +129 0.244781 0.244781 0.000000 0.000000 | |
132 | +130 0.416427 0.416427 0.000000 0.000000 | |
133 | +131 0.462615 0.462615 0.000000 0.000000 | |
134 | +132 0.366726 0.366726 0.000000 0.000000 | |
135 | +133 0.152572 0.152572 0.000000 0.000000 | |
136 | +134 -0.122374 -0.122374 0.000000 0.000000 | |
137 | +135 -0.383331 -0.383331 0.000000 0.000000 | |
138 | +136 -0.559485 -0.559485 0.000000 0.000000 | |
139 | +137 -0.604139 -0.604139 0.000000 0.000000 | |
140 | +138 -0.507995 -0.507995 0.000000 0.000000 | |
141 | +139 -0.301801 -0.301801 0.000000 0.000000 | |
142 | +140 -0.047597 -0.047597 0.000000 0.000000 | |
143 | +141 0.178939 0.178939 0.000000 0.000000 | |
144 | +142 0.310025 0.310025 0.000000 0.000000 | |
145 | +143 0.305068 0.305068 0.000000 0.000000 | |
146 | +144 0.162212 0.162212 0.000000 0.000000 | |
147 | +145 -0.081131 -0.081131 0.000000 0.000000 | |
148 | +146 -0.358920 -0.358920 0.000000 0.000000 | |
149 | +147 -0.595281 -0.595281 0.000000 0.000000 | |
150 | +148 -0.726091 -0.726091 0.000000 0.000000 | |
151 | +149 -0.717221 -0.717221 0.000000 0.000000 | |
152 | +150 -0.574248 -0.574248 0.000000 0.000000 | |
153 | +151 -0.340864 -0.340864 0.000000 0.000000 | |
154 | +152 -0.086443 -0.086443 0.000000 0.000000 | |
155 | +153 0.113700 0.113700 0.000000 0.000000 | |
156 | +154 0.199743 0.199743 0.000000 0.000000 | |
157 | +155 0.144379 0.144379 0.000000 0.000000 | |
158 | +156 -0.039412 -0.039412 0.000000 0.000000 | |
159 | +157 -0.302053 -0.302053 0.000000 0.000000 | |
160 | +158 -0.571478 -0.571478 0.000000 0.000000 | |
161 | +159 -0.773635 -0.773635 0.000000 0.000000 | |
162 | +160 -0.853553 -0.853553 0.000000 0.000000 | |
163 | +161 -0.790988 -0.790988 0.000000 0.000000 | |
164 | +162 -0.606174 -0.606174 0.000000 0.000000 | |
165 | +163 -0.354071 -0.354071 0.000000 0.000000 | |
166 | +164 -0.108720 -0.108720 0.000000 0.000000 | |
167 | +165 0.057821 0.057821 0.000000 0.000000 | |
168 | +166 0.095989 0.095989 0.000000 0.000000 | |
169 | +167 -0.007189 -0.007189 0.000000 0.000000 | |
170 | +168 -0.224393 -0.224393 0.000000 0.000000 | |
171 | +169 -0.495792 -0.495792 0.000000 0.000000 | |
172 | +170 -0.746061 -0.746061 0.000000 0.000000 | |
173 | +171 -0.905816 -0.905816 0.000000 0.000000 | |
174 | +172 -0.931353 -0.931353 0.000000 0.000000 | |
175 | +173 -0.817088 -0.817088 0.000000 0.000000 | |
176 | +174 -0.597137 -0.597137 0.000000 0.000000 | |
177 | +175 -0.335615 -0.335615 0.000000 0.000000 | |
178 | +176 -0.108386 -0.108386 0.000000 0.000000 | |
179 | +177 0.018519 0.018519 0.000000 0.000000 | |
180 | +178 0.007698 0.007698 0.000000 0.000000 | |
181 | +179 -0.138985 -0.138985 0.000000 0.000000 | |
182 | +180 -0.380925 -0.380925 0.000000 0.000000 | |
183 | +181 -0.650333 -0.650333 0.000000 0.000000 | |
184 | +182 -0.871521 -0.871521 0.000000 0.000000 | |
185 | +183 -0.982439 -0.982439 0.000000 0.000000 | |
186 | +184 -0.952332 -0.952332 0.000000 0.000000 | |
187 | +185 -0.790488 -0.790488 0.000000 0.000000 | |
188 | +186 -0.543597 -0.543597 0.000000 0.000000 | |
189 | +187 -0.282462 -0.282462 0.000000 0.000000 | |
190 | +188 -0.081858 -0.081858 0.000000 0.000000 | |
191 | +189 0.000752 0.000752 0.000000 0.000000 | |
192 | +190 -0.058437 -0.058437 0.000000 0.000000 | |
193 | +191 -0.242798 -0.242798 0.000000 0.000000 | |
194 | +192 -0.500000 -0.500000 0.000000 0.000000 | |
195 | +193 -0.756901 -0.756901 0.000000 0.000000 | |
196 | +194 -0.940358 -0.940358 0.000000 0.000000 | |
197 | +195 -0.998043 -0.998043 0.000000 0.000000 | |
198 | +196 -0.913327 -0.913327 0.000000 0.000000 | |
199 | +197 -0.710017 -0.710017 0.000000 0.000000 | |
200 | +198 -0.445580 -0.445580 0.000000 0.000000 | |
201 | +199 -0.194789 -0.194789 0.000000 0.000000 | |
202 | +200 -0.028453 -0.028453 0.000000 0.000000 | |
203 | +201 0.006737 0.006737 0.000000 0.000000 | |
204 | +202 -0.098510 -0.098510 0.000000 0.000000 | |
205 | +203 -0.313443 -0.313443 0.000000 0.000000 | |
206 | +204 -0.576015 -0.576015 0.000000 0.000000 | |
207 | +205 -0.810544 -0.810544 0.000000 0.000000 | |
208 | +206 -0.949242 -0.949242 0.000000 0.000000 | |
209 | +207 -0.951512 -0.951512 0.000000 0.000000 | |
210 | +208 -0.815493 -0.815493 0.000000 0.000000 | |
211 | +209 -0.578595 -0.578595 0.000000 0.000000 | |
212 | +210 -0.306852 -0.306852 0.000000 0.000000 | |
213 | +211 -0.076137 -0.076137 0.000000 0.000000 | |
214 | +212 0.049432 0.049432 0.000000 0.000000 | |
215 | +213 0.035729 0.035729 0.000000 0.000000 | |
216 | +214 -0.111668 -0.111668 0.000000 0.000000 | |
217 | +215 -0.349062 -0.349062 0.000000 0.000000 | |
218 | +216 -0.607077 -0.607077 0.000000 0.000000 | |
219 | +217 -0.810396 -0.810396 0.000000 0.000000 | |
220 | +218 -0.899196 -0.899196 0.000000 0.000000 | |
221 | +219 -0.846168 -0.846168 0.000000 0.000000 | |
222 | +220 -0.664290 -0.664290 0.000000 0.000000 | |
223 | +221 -0.403138 -0.403138 0.000000 0.000000 | |
224 | +222 -0.134777 -0.134777 0.000000 0.000000 | |
225 | +223 0.066741 0.066741 0.000000 0.000000 | |
226 | +224 0.146447 0.146447 0.000000 0.000000 | |
227 | +225 0.084094 0.084094 0.000000 0.000000 | |
228 | +226 -0.100081 -0.100081 0.000000 0.000000 | |
229 | +227 -0.351120 -0.351120 0.000000 0.000000 | |
230 | +228 -0.594982 -0.594982 0.000000 0.000000 | |
231 | +229 -0.759610 -0.759610 0.000000 0.000000 | |
232 | +230 -0.795442 -0.795442 0.000000 0.000000 | |
233 | +231 -0.689508 -0.689508 0.000000 0.000000 | |
234 | +232 -0.469127 -0.469127 0.000000 0.000000 | |
235 | +233 -0.194134 -0.194134 0.000000 0.000000 | |
236 | +234 0.060145 0.060145 0.000000 0.000000 | |
237 | +235 0.224323 0.224323 0.000000 0.000000 | |
238 | +236 0.254694 0.254694 0.000000 0.000000 | |
239 | +237 0.145670 0.145670 0.000000 0.000000 | |
240 | +238 -0.068635 -0.068635 0.000000 0.000000 | |
241 | +239 -0.324111 -0.324111 0.000000 0.000000 | |
242 | +240 -0.544895 -0.544895 0.000000 0.000000 | |
243 | +241 -0.664963 -0.664963 0.000000 0.000000 | |
244 | +242 -0.646915 -0.646915 0.000000 0.000000 | |
245 | +243 -0.492620 -0.492620 0.000000 0.000000 | |
246 | +244 -0.242687 -0.242687 0.000000 0.000000 | |
247 | +245 0.035089 0.035089 0.000000 0.000000 | |
248 | +246 0.265015 0.265015 0.000000 0.000000 | |
249 | +247 0.385038 0.385038 0.000000 0.000000 | |
250 | +248 0.364395 0.364395 0.000000 0.000000 | |
251 | +249 0.212369 0.212369 0.000000 0.000000 | |
252 | +250 -0.024357 -0.024357 0.000000 0.000000 | |
253 | +251 -0.274983 -0.274983 0.000000 0.000000 | |
254 | +252 -0.464743 -0.464743 0.000000 0.000000 | |
255 | +253 -0.536180 -0.536180 0.000000 0.000000 | |
256 | +254 -0.465494 -0.465494 0.000000 0.000000 | |
257 | +255 -0.269322 -0.269322 0.000000 0.000000 |
@@ -0,0 +1,91 @@ | ||
1 | +#include <fftw3.h> | |
2 | +#include <math.h> | |
3 | +#include <limits.h> | |
4 | + | |
5 | +#define FRAME_LEN 256 | |
6 | +#define OUT_FILE_PCM "input.raw" | |
7 | +#define OUT_FILE_FFT "fft.raw" | |
8 | + | |
9 | +int main(int argc, char *argv[]) | |
10 | +{ | |
11 | + FILE *fhOutPcm = NULL; | |
12 | + FILE *fhOutFft = NULL; | |
13 | + | |
14 | + if((fhOutPcm = fopen(OUT_FILE_PCM, "wb")) == NULL) { | |
15 | + printf("file open error : %s", OUT_FILE_PCM); | |
16 | + return 1; | |
17 | + } | |
18 | + | |
19 | + if((fhOutFft = fopen(OUT_FILE_FFT, "wb")) == NULL) { | |
20 | + printf("file open error : %s", OUT_FILE_FFT); | |
21 | + return 1; | |
22 | + } | |
23 | + | |
24 | + // FFTW time sig -> freq sig -> time sig | |
25 | + double *sig1 = new double[FRAME_LEN]; | |
26 | + double *sig2 = new double[FRAME_LEN]; | |
27 | + | |
28 | + size_t fft_buf_size = sizeof(fftw_complex) * FRAME_LEN; | |
29 | + | |
30 | + fftw_plan plan_r2c = NULL; | |
31 | + fftw_plan plan_c2r = NULL; | |
32 | + | |
33 | + fftw_complex *fft_buf = NULL; | |
34 | + fft_buf = (fftw_complex*) fftw_malloc( fft_buf_size ); | |
35 | + | |
36 | + plan_r2c = fftw_plan_dft_r2c_1d(FRAME_LEN, sig1, fft_buf, FFTW_ESTIMATE); | |
37 | + | |
38 | + // input data sig1 | |
39 | + for(int i = 0; i < FRAME_LEN; i++) { | |
40 | + sig1[i] = sin( 2 * M_PI * i / FRAME_LEN ) * 0.5 + sin( 44 * M_PI * i / FRAME_LEN ) * 0.5; | |
41 | + } | |
42 | + | |
43 | + // fft exec time sig -> freq sig | |
44 | + fftw_execute(plan_r2c); | |
45 | + | |
46 | + // ----- debug out | |
47 | + short *tmps = new short[FRAME_LEN]; | |
48 | + | |
49 | + for(int i = 0; i < FRAME_LEN; i++) { | |
50 | + tmps[i] = (short) (fft_buf[i][0] / FRAME_LEN * SHRT_MAX); | |
51 | + } | |
52 | + fwrite(tmps, sizeof(short), FRAME_LEN, fhOutFft); | |
53 | + fclose(fhOutFft); | |
54 | + // ---------- | |
55 | + for(int i = 0; i < FRAME_LEN; i++) { | |
56 | + tmps[i] = (short) (sig1[i] * SHRT_MAX); | |
57 | + } | |
58 | + fwrite(tmps, sizeof(short), FRAME_LEN, fhOutPcm); | |
59 | + fclose(fhOutPcm); | |
60 | + // ----- debug out [end] | |
61 | + | |
62 | + // -- c2r -- | |
63 | + plan_c2r = fftw_plan_dft_c2r_1d(FRAME_LEN, fft_buf, sig2, FFTW_ESTIMATE); | |
64 | + | |
65 | + fftw_execute(plan_c2r); | |
66 | + | |
67 | + // print signal data | |
68 | + printf("num\tsig1\t\tsig2\t\treal\t\timag\n"); | |
69 | + for(int i = 0; i < FRAME_LEN; i++) { | |
70 | + printf("%d\t%lf\t%lf\t%lf\t%lf\n", i, sig1[i], sig2[i] / FRAME_LEN | |
71 | + , fft_buf[i][0], fft_buf[i][1]); | |
72 | + } | |
73 | + | |
74 | + if(sig1) { | |
75 | + delete[] sig1; | |
76 | + } | |
77 | + | |
78 | + if(sig2) { | |
79 | + delete[] sig2; | |
80 | + } | |
81 | + | |
82 | + if(plan_r2c) { | |
83 | + fftw_destroy_plan(plan_r2c); | |
84 | + } | |
85 | + | |
86 | + if(fft_buf) { | |
87 | + fftw_free(fft_buf); | |
88 | + } | |
89 | + | |
90 | + return 0; | |
91 | +} |
@@ -0,0 +1,410 @@ | ||
1 | +/* | |
2 | + * Copyright (c) 2003, 2007-11 Matteo Frigo | |
3 | + * Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology | |
4 | + * | |
5 | + * The following statement of license applies *only* to this header file, | |
6 | + * and *not* to the other files distributed with FFTW or derived therefrom: | |
7 | + * | |
8 | + * Redistribution and use in source and binary forms, with or without | |
9 | + * modification, are permitted provided that the following conditions | |
10 | + * are met: | |
11 | + * | |
12 | + * 1. Redistributions of source code must retain the above copyright | |
13 | + * notice, this list of conditions and the following disclaimer. | |
14 | + * | |
15 | + * 2. Redistributions in binary form must reproduce the above copyright | |
16 | + * notice, this list of conditions and the following disclaimer in the | |
17 | + * documentation and/or other materials provided with the distribution. | |
18 | + * | |
19 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS | |
20 | + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
21 | + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
22 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
23 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
24 | + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
25 | + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
27 | + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | + */ | |
31 | + | |
32 | +/***************************** NOTE TO USERS ********************************* | |
33 | + * | |
34 | + * THIS IS A HEADER FILE, NOT A MANUAL | |
35 | + * | |
36 | + * If you want to know how to use FFTW, please read the manual, | |
37 | + * online at http://www.fftw.org/doc/ and also included with FFTW. | |
38 | + * For a quick start, see the manual's tutorial section. | |
39 | + * | |
40 | + * (Reading header files to learn how to use a library is a habit | |
41 | + * stemming from code lacking a proper manual. Arguably, it's a | |
42 | + * *bad* habit in most cases, because header files can contain | |
43 | + * interfaces that are not part of the public, stable API.) | |
44 | + * | |
45 | + ****************************************************************************/ | |
46 | + | |
47 | +#ifndef FFTW3_H | |
48 | +#define FFTW3_H | |
49 | + | |
50 | +#include <stdio.h> | |
51 | + | |
52 | +#ifdef __cplusplus | |
53 | +extern "C" | |
54 | +{ | |
55 | +#endif /* __cplusplus */ | |
56 | + | |
57 | +/* If <complex.h> is included, use the C99 complex type. Otherwise | |
58 | + define a type bit-compatible with C99 complex */ | |
59 | +#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I) | |
60 | +# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C | |
61 | +#else | |
62 | +# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2] | |
63 | +#endif | |
64 | + | |
65 | +#define FFTW_CONCAT(prefix, name) prefix ## name | |
66 | +#define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name) | |
67 | +#define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name) | |
68 | +#define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name) | |
69 | +#define FFTW_MANGLE_QUAD(name) FFTW_CONCAT(fftwq_, name) | |
70 | + | |
71 | +/* IMPORTANT: for Windows compilers, you should add a line | |
72 | + #define FFTW_DLL | |
73 | + here and in kernel/ifftw.h if you are compiling/using FFTW as a | |
74 | + DLL, in order to do the proper importing/exporting, or | |
75 | + alternatively compile with -DFFTW_DLL or the equivalent | |
76 | + command-line flag. This is not necessary under MinGW/Cygwin, where | |
77 | + libtool does the imports/exports automatically. */ | |
78 | +#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__)) | |
79 | + /* annoying Windows syntax for shared-library declarations */ | |
80 | +# if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */ | |
81 | +# define FFTW_EXTERN extern __declspec(dllexport) | |
82 | +# else /* user is calling FFTW; import symbol */ | |
83 | +# define FFTW_EXTERN extern __declspec(dllimport) | |
84 | +# endif | |
85 | +#else | |
86 | +# define FFTW_EXTERN extern | |
87 | +#endif | |
88 | + | |
89 | +enum fftw_r2r_kind_do_not_use_me { | |
90 | + FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2, | |
91 | + FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6, | |
92 | + FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10 | |
93 | +}; | |
94 | + | |
95 | +struct fftw_iodim_do_not_use_me { | |
96 | + int n; /* dimension size */ | |
97 | + int is; /* input stride */ | |
98 | + int os; /* output stride */ | |
99 | +}; | |
100 | + | |
101 | +#include <stddef.h> /* for ptrdiff_t */ | |
102 | +struct fftw_iodim64_do_not_use_me { | |
103 | + ptrdiff_t n; /* dimension size */ | |
104 | + ptrdiff_t is; /* input stride */ | |
105 | + ptrdiff_t os; /* output stride */ | |
106 | +}; | |
107 | + | |
108 | +typedef void (*fftw_write_char_func_do_not_use_me)(char c, void *); | |
109 | +typedef int (*fftw_read_char_func_do_not_use_me)(void *); | |
110 | + | |
111 | +/* | |
112 | + huge second-order macro that defines prototypes for all API | |
113 | + functions. We expand this macro for each supported precision | |
114 | + | |
115 | + X: name-mangling macro | |
116 | + R: real data type | |
117 | + C: complex data type | |
118 | +*/ | |
119 | + | |
120 | +#define FFTW_DEFINE_API(X, R, C) \ | |
121 | + \ | |
122 | +FFTW_DEFINE_COMPLEX(R, C); \ | |
123 | + \ | |
124 | +typedef struct X(plan_s) *X(plan); \ | |
125 | + \ | |
126 | +typedef struct fftw_iodim_do_not_use_me X(iodim); \ | |
127 | +typedef struct fftw_iodim64_do_not_use_me X(iodim64); \ | |
128 | + \ | |
129 | +typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \ | |
130 | + \ | |
131 | +typedef fftw_write_char_func_do_not_use_me X(write_char_func); \ | |
132 | +typedef fftw_read_char_func_do_not_use_me X(read_char_func); \ | |
133 | + \ | |
134 | +FFTW_EXTERN void X(execute)(const X(plan) p); \ | |
135 | + \ | |
136 | +FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n, \ | |
137 | + C *in, C *out, int sign, unsigned flags); \ | |
138 | + \ | |
139 | +FFTW_EXTERN X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign, \ | |
140 | + unsigned flags); \ | |
141 | +FFTW_EXTERN X(plan) X(plan_dft_2d)(int n0, int n1, \ | |
142 | + C *in, C *out, int sign, unsigned flags); \ | |
143 | +FFTW_EXTERN X(plan) X(plan_dft_3d)(int n0, int n1, int n2, \ | |
144 | + C *in, C *out, int sign, unsigned flags); \ | |
145 | + \ | |
146 | +FFTW_EXTERN X(plan) X(plan_many_dft)(int rank, const int *n, \ | |
147 | + int howmany, \ | |
148 | + C *in, const int *inembed, \ | |
149 | + int istride, int idist, \ | |
150 | + C *out, const int *onembed, \ | |
151 | + int ostride, int odist, \ | |
152 | + int sign, unsigned flags); \ | |
153 | + \ | |
154 | +FFTW_EXTERN X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims, \ | |
155 | + int howmany_rank, \ | |
156 | + const X(iodim) *howmany_dims, \ | |
157 | + C *in, C *out, \ | |
158 | + int sign, unsigned flags); \ | |
159 | +FFTW_EXTERN X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \ | |
160 | + int howmany_rank, \ | |
161 | + const X(iodim) *howmany_dims, \ | |
162 | + R *ri, R *ii, R *ro, R *io, \ | |
163 | + unsigned flags); \ | |
164 | + \ | |
165 | +FFTW_EXTERN X(plan) X(plan_guru64_dft)(int rank, \ | |
166 | + const X(iodim64) *dims, \ | |
167 | + int howmany_rank, \ | |
168 | + const X(iodim64) *howmany_dims, \ | |
169 | + C *in, C *out, \ | |
170 | + int sign, unsigned flags); \ | |
171 | +FFTW_EXTERN X(plan) X(plan_guru64_split_dft)(int rank, \ | |
172 | + const X(iodim64) *dims, \ | |
173 | + int howmany_rank, \ | |
174 | + const X(iodim64) *howmany_dims, \ | |
175 | + R *ri, R *ii, R *ro, R *io, \ | |
176 | + unsigned flags); \ | |
177 | + \ | |
178 | +FFTW_EXTERN void X(execute_dft)(const X(plan) p, C *in, C *out); \ | |
179 | +FFTW_EXTERN void X(execute_split_dft)(const X(plan) p, R *ri, R *ii, \ | |
180 | + R *ro, R *io); \ | |
181 | + \ | |
182 | +FFTW_EXTERN X(plan) X(plan_many_dft_r2c)(int rank, const int *n, \ | |
183 | + int howmany, \ | |
184 | + R *in, const int *inembed, \ | |
185 | + int istride, int idist, \ | |
186 | + C *out, const int *onembed, \ | |
187 | + int ostride, int odist, \ | |
188 | + unsigned flags); \ | |
189 | + \ | |
190 | +FFTW_EXTERN X(plan) X(plan_dft_r2c)(int rank, const int *n, \ | |
191 | + R *in, C *out, unsigned flags); \ | |
192 | + \ | |
193 | +FFTW_EXTERN X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \ | |
194 | +FFTW_EXTERN X(plan) X(plan_dft_r2c_2d)(int n0, int n1, \ | |
195 | + R *in, C *out, unsigned flags); \ | |
196 | +FFTW_EXTERN X(plan) X(plan_dft_r2c_3d)(int n0, int n1, \ | |
197 | + int n2, \ | |
198 | + R *in, C *out, unsigned flags); \ | |
199 | + \ | |
200 | + \ | |
201 | +FFTW_EXTERN X(plan) X(plan_many_dft_c2r)(int rank, const int *n, \ | |
202 | + int howmany, \ | |
203 | + C *in, const int *inembed, \ | |
204 | + int istride, int idist, \ | |
205 | + R *out, const int *onembed, \ | |
206 | + int ostride, int odist, \ | |
207 | + unsigned flags); \ | |
208 | + \ | |
209 | +FFTW_EXTERN X(plan) X(plan_dft_c2r)(int rank, const int *n, \ | |
210 | + C *in, R *out, unsigned flags); \ | |
211 | + \ | |
212 | +FFTW_EXTERN X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \ | |
213 | +FFTW_EXTERN X(plan) X(plan_dft_c2r_2d)(int n0, int n1, \ | |
214 | + C *in, R *out, unsigned flags); \ | |
215 | +FFTW_EXTERN X(plan) X(plan_dft_c2r_3d)(int n0, int n1, \ | |
216 | + int n2, \ | |
217 | + C *in, R *out, unsigned flags); \ | |
218 | + \ | |
219 | +FFTW_EXTERN X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims, \ | |
220 | + int howmany_rank, \ | |
221 | + const X(iodim) *howmany_dims, \ | |
222 | + R *in, C *out, \ | |
223 | + unsigned flags); \ | |
224 | +FFTW_EXTERN X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims, \ | |
225 | + int howmany_rank, \ | |
226 | + const X(iodim) *howmany_dims, \ | |
227 | + C *in, R *out, \ | |
228 | + unsigned flags); \ | |
229 | + \ | |
230 | +FFTW_EXTERN X(plan) X(plan_guru_split_dft_r2c)( \ | |
231 | + int rank, const X(iodim) *dims, \ | |
232 | + int howmany_rank, \ | |
233 | + const X(iodim) *howmany_dims, \ | |
234 | + R *in, R *ro, R *io, \ | |
235 | + unsigned flags); \ | |
236 | +FFTW_EXTERN X(plan) X(plan_guru_split_dft_c2r)( \ | |
237 | + int rank, const X(iodim) *dims, \ | |
238 | + int howmany_rank, \ | |
239 | + const X(iodim) *howmany_dims, \ | |
240 | + R *ri, R *ii, R *out, \ | |
241 | + unsigned flags); \ | |
242 | + \ | |
243 | +FFTW_EXTERN X(plan) X(plan_guru64_dft_r2c)(int rank, \ | |
244 | + const X(iodim64) *dims, \ | |
245 | + int howmany_rank, \ | |
246 | + const X(iodim64) *howmany_dims, \ | |
247 | + R *in, C *out, \ | |
248 | + unsigned flags); \ | |
249 | +FFTW_EXTERN X(plan) X(plan_guru64_dft_c2r)(int rank, \ | |
250 | + const X(iodim64) *dims, \ | |
251 | + int howmany_rank, \ | |
252 | + const X(iodim64) *howmany_dims, \ | |
253 | + C *in, R *out, \ | |
254 | + unsigned flags); \ | |
255 | + \ | |
256 | +FFTW_EXTERN X(plan) X(plan_guru64_split_dft_r2c)( \ | |
257 | + int rank, const X(iodim64) *dims, \ | |
258 | + int howmany_rank, \ | |
259 | + const X(iodim64) *howmany_dims, \ | |
260 | + R *in, R *ro, R *io, \ | |
261 | + unsigned flags); \ | |
262 | +FFTW_EXTERN X(plan) X(plan_guru64_split_dft_c2r)( \ | |
263 | + int rank, const X(iodim64) *dims, \ | |
264 | + int howmany_rank, \ | |
265 | + const X(iodim64) *howmany_dims, \ | |
266 | + R *ri, R *ii, R *out, \ | |
267 | + unsigned flags); \ | |
268 | + \ | |
269 | +FFTW_EXTERN void X(execute_dft_r2c)(const X(plan) p, R *in, C *out); \ | |
270 | +FFTW_EXTERN void X(execute_dft_c2r)(const X(plan) p, C *in, R *out); \ | |
271 | + \ | |
272 | +FFTW_EXTERN void X(execute_split_dft_r2c)(const X(plan) p, \ | |
273 | + R *in, R *ro, R *io); \ | |
274 | +FFTW_EXTERN void X(execute_split_dft_c2r)(const X(plan) p, \ | |
275 | + R *ri, R *ii, R *out); \ | |
276 | + \ | |
277 | +FFTW_EXTERN X(plan) X(plan_many_r2r)(int rank, const int *n, \ | |
278 | + int howmany, \ | |
279 | + R *in, const int *inembed, \ | |
280 | + int istride, int idist, \ | |
281 | + R *out, const int *onembed, \ | |
282 | + int ostride, int odist, \ | |
283 | + const X(r2r_kind) *kind, unsigned flags); \ | |
284 | + \ | |
285 | +FFTW_EXTERN X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out, \ | |
286 | + const X(r2r_kind) *kind, unsigned flags); \ | |
287 | + \ | |
288 | +FFTW_EXTERN X(plan) X(plan_r2r_1d)(int n, R *in, R *out, \ | |
289 | + X(r2r_kind) kind, unsigned flags); \ | |
290 | +FFTW_EXTERN X(plan) X(plan_r2r_2d)(int n0, int n1, R *in, R *out, \ | |
291 | + X(r2r_kind) kind0, X(r2r_kind) kind1, \ | |
292 | + unsigned flags); \ | |
293 | +FFTW_EXTERN X(plan) X(plan_r2r_3d)(int n0, int n1, int n2, \ | |
294 | + R *in, R *out, X(r2r_kind) kind0, \ | |
295 | + X(r2r_kind) kind1, X(r2r_kind) kind2, \ | |
296 | + unsigned flags); \ | |
297 | + \ | |
298 | +FFTW_EXTERN X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims, \ | |
299 | + int howmany_rank, \ | |
300 | + const X(iodim) *howmany_dims, \ | |
301 | + R *in, R *out, \ | |
302 | + const X(r2r_kind) *kind, unsigned flags); \ | |
303 | + \ | |
304 | +FFTW_EXTERN X(plan) X(plan_guru64_r2r)(int rank, const X(iodim64) *dims, \ | |
305 | + int howmany_rank, \ | |
306 | + const X(iodim64) *howmany_dims, \ | |
307 | + R *in, R *out, \ | |
308 | + const X(r2r_kind) *kind, unsigned flags); \ | |
309 | + \ | |
310 | +FFTW_EXTERN void X(execute_r2r)(const X(plan) p, R *in, R *out); \ | |
311 | + \ | |
312 | +FFTW_EXTERN void X(destroy_plan)(X(plan) p); \ | |
313 | +FFTW_EXTERN void X(forget_wisdom)(void); \ | |
314 | +FFTW_EXTERN void X(cleanup)(void); \ | |
315 | + \ | |
316 | +FFTW_EXTERN void X(set_timelimit)(double t); \ | |
317 | + \ | |
318 | +FFTW_EXTERN void X(plan_with_nthreads)(int nthreads); \ | |
319 | +FFTW_EXTERN int X(init_threads)(void); \ | |
320 | +FFTW_EXTERN void X(cleanup_threads)(void); \ | |
321 | + \ | |
322 | +FFTW_EXTERN int X(export_wisdom_to_filename)(const char *filename); \ | |
323 | +FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file); \ | |
324 | +FFTW_EXTERN char *X(export_wisdom_to_string)(void); \ | |
325 | +FFTW_EXTERN void X(export_wisdom)(X(write_char_func) write_char, \ | |
326 | + void *data); \ | |
327 | +FFTW_EXTERN int X(import_system_wisdom)(void); \ | |
328 | +FFTW_EXTERN int X(import_wisdom_from_filename)(const char *filename); \ | |
329 | +FFTW_EXTERN int X(import_wisdom_from_file)(FILE *input_file); \ | |
330 | +FFTW_EXTERN int X(import_wisdom_from_string)(const char *input_string); \ | |
331 | +FFTW_EXTERN int X(import_wisdom)(X(read_char_func) read_char, void *data); \ | |
332 | + \ | |
333 | +FFTW_EXTERN void X(fprint_plan)(const X(plan) p, FILE *output_file); \ | |
334 | +FFTW_EXTERN void X(print_plan)(const X(plan) p); \ | |
335 | + \ | |
336 | +FFTW_EXTERN void *X(malloc)(size_t n); \ | |
337 | +FFTW_EXTERN R *X(alloc_real)(size_t n); \ | |
338 | +FFTW_EXTERN C *X(alloc_complex)(size_t n); \ | |
339 | +FFTW_EXTERN void X(free)(void *p); \ | |
340 | + \ | |
341 | +FFTW_EXTERN void X(flops)(const X(plan) p, \ | |
342 | + double *add, double *mul, double *fmas); \ | |
343 | +FFTW_EXTERN double X(estimate_cost)(const X(plan) p); \ | |
344 | +FFTW_EXTERN double X(cost)(const X(plan) p); \ | |
345 | + \ | |
346 | +FFTW_EXTERN const char X(version)[]; \ | |
347 | +FFTW_EXTERN const char X(cc)[]; \ | |
348 | +FFTW_EXTERN const char X(codelet_optim)[]; | |
349 | + | |
350 | + | |
351 | +/* end of FFTW_DEFINE_API macro */ | |
352 | + | |
353 | +FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex) | |
354 | +FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex) | |
355 | +FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex) | |
356 | + | |
357 | +/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64 | |
358 | + for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */ | |
359 | +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \ | |
360 | + && !(defined(__ICC) || defined(__INTEL_COMPILER)) \ | |
361 | + && (defined(__i386__) || defined(__x86_64__) || defined(__ia64__)) | |
362 | +# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I) | |
363 | +/* note: __float128 is a typedef, which is not supported with the _Complex | |
364 | + keyword in gcc, so instead we use this ugly __attribute__ version. | |
365 | + However, we can't simply pass the __attribute__ version to | |
366 | + FFTW_DEFINE_API because the __attribute__ confuses gcc in pointer | |
367 | + types. Hence redefining FFTW_DEFINE_COMPLEX. Ugh. */ | |
368 | +# undef FFTW_DEFINE_COMPLEX | |
369 | +# define FFTW_DEFINE_COMPLEX(R, C) typedef _Complex float __attribute__((mode(TC))) C | |
370 | +# endif | |
371 | +FFTW_DEFINE_API(FFTW_MANGLE_QUAD, __float128, fftwq_complex) | |
372 | +#endif | |
373 | + | |
374 | +#define FFTW_FORWARD (-1) | |
375 | +#define FFTW_BACKWARD (+1) | |
376 | + | |
377 | +#define FFTW_NO_TIMELIMIT (-1.0) | |
378 | + | |
379 | +/* documented flags */ | |
380 | +#define FFTW_MEASURE (0U) | |
381 | +#define FFTW_DESTROY_INPUT (1U << 0) | |
382 | +#define FFTW_UNALIGNED (1U << 1) | |
383 | +#define FFTW_CONSERVE_MEMORY (1U << 2) | |
384 | +#define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */ | |
385 | +#define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */ | |
386 | +#define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */ | |
387 | +#define FFTW_ESTIMATE (1U << 6) | |
388 | +#define FFTW_WISDOM_ONLY (1U << 21) | |
389 | + | |
390 | +/* undocumented beyond-guru flags */ | |
391 | +#define FFTW_ESTIMATE_PATIENT (1U << 7) | |
392 | +#define FFTW_BELIEVE_PCOST (1U << 8) | |
393 | +#define FFTW_NO_DFT_R2HC (1U << 9) | |
394 | +#define FFTW_NO_NONTHREADED (1U << 10) | |
395 | +#define FFTW_NO_BUFFERING (1U << 11) | |
396 | +#define FFTW_NO_INDIRECT_OP (1U << 12) | |
397 | +#define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */ | |
398 | +#define FFTW_NO_RANK_SPLITS (1U << 14) | |
399 | +#define FFTW_NO_VRANK_SPLITS (1U << 15) | |
400 | +#define FFTW_NO_VRECURSE (1U << 16) | |
401 | +#define FFTW_NO_SIMD (1U << 17) | |
402 | +#define FFTW_NO_SLOW (1U << 18) | |
403 | +#define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19) | |
404 | +#define FFTW_ALLOW_PRUNING (1U << 20) | |
405 | + | |
406 | +#ifdef __cplusplus | |
407 | +} /* extern "C" */ | |
408 | +#endif /* __cplusplus */ | |
409 | + | |
410 | +#endif /* FFTW3_H */ |
@@ -0,0 +1,41 @@ | ||
1 | +# libfftw3.la - a libtool library file | |
2 | +# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1 | |
3 | +# | |
4 | +# Please DO NOT delete this file! | |
5 | +# It is necessary for linking the library. | |
6 | + | |
7 | +# The name that we can dlopen(3). | |
8 | +dlname='' | |
9 | + | |
10 | +# Names of this library. | |
11 | +library_names='' | |
12 | + | |
13 | +# The name of the static archive. | |
14 | +old_library='libfftw3.a' | |
15 | + | |
16 | +# Linker flags that can not go in dependency_libs. | |
17 | +inherited_linker_flags=' ' | |
18 | + | |
19 | +# Libraries that this one depends upon. | |
20 | +dependency_libs=' -lm' | |
21 | + | |
22 | +# Names of additional weak libraries provided by this library | |
23 | +weak_library_names='' | |
24 | + | |
25 | +# Version information for libfftw3. | |
26 | +current=6 | |
27 | +age=3 | |
28 | +revision=2 | |
29 | + | |
30 | +# Is this an already installed library? | |
31 | +installed=no | |
32 | + | |
33 | +# Should we warn about portability when linking against -modules? | |
34 | +shouldnotlink=no | |
35 | + | |
36 | +# Files to dlopen/dlpreopen | |
37 | +dlopen='' | |
38 | +dlpreopen='' | |
39 | + | |
40 | +# Directory that this library needs to be installed in: | |
41 | +libdir='/usr/local/lib' |
@@ -1,49 +0,0 @@ | ||
1 | - | |
2 | -#main.cpp#,15 | |
3 | -int main(6,46 | |
4 | - | |
5 | -Makefile,184 | |
6 | -CC 1,0 | |
7 | -CPP 2,20 | |
8 | -CFLAGS 3,40 | |
9 | -DEST 4,87 | |
10 | -LDFLAGS 5,118 | |
11 | -LIBS 6,151 | |
12 | -OBJS 7,171 | |
13 | -PROGRAM 8,207 | |
14 | -all:all10,228 | |
15 | -$(PROGRAM)$(PROGRAM12,247 | |
16 | -clean:clean15,321 | |
17 | -install:install17,356 | |
18 | - | |
19 | -Oscillator.cpp,198 | |
20 | -Oscillator::Oscillator(22,536 | |
21 | -float Oscillator::UpdateWithoutInterpolation(39,1005 | |
22 | -float Oscillator::UpdateWithLinearInterpolation(56,1314 | |
23 | -float Oscillator::UpdateWithCubicInterpolation(78,1747 | |
24 | - | |
25 | -Oscillator.h,55 | |
26 | -#define TABLE_SIZE_DEFAULT 2,1 | |
27 | -class Oscillator 4,34 | |
28 | - | |
29 | -main.cpp,15 | |
30 | -int main(6,46 | |
31 | - | |
32 | -readme.txt,246 | |
33 | -References : Ross Bencina,4,63 | |
34 | -References : Ross Bencina, Olli Niemitalo,4,63 | |
35 | -float Oscillator::UpdateWithoutInterpolation(33,742 | |
36 | -float Oscillator::UpdateWithLinearInterpolation(50,1102 | |
37 | -float Oscillator::UpdateWithCubicInterpolation(72,1620 | |
38 | - | |
39 | -run,0 | |
40 | - | |
41 | -main.o,0 | |
42 | - | |
43 | -Oscillator.o,0 | |
44 | - | |
45 | -GTAGS,0 | |
46 | - | |
47 | -GRTAGS,0 | |
48 | - | |
49 | -GPATH,0 |