1. FFTW正向反向均没有做shift,反向差个系数SIZE*SIZE
2. 注意fftw的几种模式:最好的方式,是save plan,reuse plan.
先用patient模式,找出当前环境下最优的方案,然后save plan,reuse.
临时解决方案,可用estimate模式。
3. FFTW的参考例子比较简洁,如果在不同的平台的上使用,移植还是略微有点麻烦,主要是对应平台的编译。
4. 据某测试数据:
/* use FFTW
method Avg(ms) 10 times
ffwt_plan_dft_2d 58.013794
ffwt_plan_dft_r2c_2d 25.4669923
ffwtf_plan__dft_r2c_2d 19.3967774
**## ffwtf_plan__dft_r2c_2d(neon) 9.5950195 -- best
ffwtf_plan__dft_r2c_2d(threads=4) 30.2916016
ffwtf_plan__dft_r2c_2d(threads=4)(neon) 18.9395753
*/
//------------------------------------
fftwf_plan p1;
int SZ=SIZE;
//for an in-position transform, memory use same space, must be big enough to hold N*(N/2+1)*2
float* rin = (float*)fftwf_malloc(sizeof(float)*SZ*SZ);
fftwf_complex* cout = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * SZ* SL_Floor(SZ/2+1));
p1 = fftwf_plan_dft_r2c_2d(SZ, SZ, rin, cout,FFTW_ESTIMATE);//FFTW_MEASURE);//FFTW_PATIENT);
fftwf_execute(p1);
fftw_destroy_plan(p1);
fftw_free(rin);
fftw_free(cout);