15 #if defined(FFTW_AVAILABLE) 181 n = number_of_complex_samples * 2;
188 for (i = 0; i < n / 2; i += 2)
196 SWAP (data[j + 1]
,data[i + 1]
);
200 if ((j / 2) < (n / 4))
203 SWAP (data[(n - (i + 2))]
, data[(n - (j + 2))]
);
205 SWAP (data[(n - (i + 2)) + 1]
, data[(n - (j + 2)) + 1]
);
209 while (m >= 2 && j >= m)
223 theta = isign * (2 * (
float)
PIE / mmax);
224 wtemp = sin (0.5f * theta);
225 wpr = -2.0f * wtemp * wtemp;
230 for (m = 1; m < mmax; m += 2)
232 for (i = m; i <= n; i += istep)
235 tempr = wr * data[j - 1] - wi * data[j];
236 tempi = wr * data[j] + wi * data[j - 1];
237 data[j - 1] = data[i - 1] - tempr;
238 data[j] = data[i] - tempi;
239 data[i - 1] += tempr;
242 wr = (wtemp = wr) * wpr - wi * wpi + wr;
243 wi = wi * wpr + wtemp * wpi + wi;
252 return log10 (x) / log10 (2.0f);
261 #if defined(FFTW_AVAILABLE) 262 fftwf_plan KKB::fftwCreateTwoDPlan (kkint32 height,
272 GoalKeeper::Create (
"fftwGoalKeeper", fftwGoalKeeper);
275 fftwGoalKeeper->StartBlock ();
276 fftwf_plan plan = fftwf_plan_dft_2d (height, width, src, dest, sign, flag);
277 fftwGoalKeeper->EndBlock ();
283 void KKB::fftwDestroyPlan (fftwf_plan& plan)
286 GoalKeeper::Create (
"fftwGoalKeeper", fftwGoalKeeper);
288 fftwGoalKeeper->StartBlock ();
289 fftwf_destroy_plan (plan);
291 fftwGoalKeeper->EndBlock ();
296 fftwf_plan KKB::fftwCreateOneDPlan (kkint32 len,
304 GoalKeeper::Create (
"fftwGoalKeeper", fftwGoalKeeper);
306 fftwGoalKeeper->StartBlock ();
307 fftwf_plan plan = fftwf_plan_dft_1d (len, src, dest, sign, flag);
308 fftwGoalKeeper->EndBlock ();
void SWAP(float &a, float &b)
unsigned __int32 kkuint32
volatile KKB::GoalKeeperPtr fftwGoalKeeper
void FFT(float data[], kkuint32 number_of_complex_samples, kkint32 isign)