0

Is there anybody who knows how I can replace these APIs from fftw by Kiss-fft APIs?

fftw_plan fftw_plan_dft_r2c_2d(int n0, int n1,double *in, fftw_complex *out,unsigned flags);
fftw_plan fftw_plan_dft_c2r_1d(int n0,fftw_complex *in, double *out,unsigned flags);
Paul R
  • 208,748
  • 37
  • 389
  • 560

1 Answers1

4

For the first case (2D real-to-complex FFT) you need to use the API in tools/kiss_fftndr.h:

kiss_fftndr_cfg  kiss_fftndr_alloc(const int *dims,int ndims,int inverse_fft,void*mem,size_t*lenmem);
void kiss_fftndr(
        kiss_fftndr_cfg cfg,
        const kiss_fft_scalar *timedata,
        kiss_fft_cpx *freqdata);
void kiss_fftndri(
        kiss_fftndr_cfg cfg,
        const kiss_fft_cpx *freqdata,
        kiss_fft_scalar *timedata);

For the second case (1D complex-to-real FFT) you need to use the API in tools/kiss_fftr.h:

kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata);
void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata);
Paul R
  • 208,748
  • 37
  • 389
  • 560
  • "timedata" and "freqdata" are "in" and "out" ? – Mohammadreza Seifikar Jul 30 '13 at 07:26
  • It depends on whether your are doing forward or inverse FFT, but in general anything `const` is input data. – Paul R Jul 30 '13 at 07:37
  • so in the second case I do not need to void kiss_fftr(...); because I'm doing inverse fourier (c2r) , right? – Mohammadreza Seifikar Jul 30 '13 at 08:07
  • one more thing, so you know what is the size of "kiss_fft_cpx" ? – Mohammadreza Seifikar Jul 30 '13 at 08:44
  • Yes, in the second case you probably just want `kiss_fftri` - I put the whole API there for completeness. sizeof(kiss_fft_cpx) is just 2*sizeof(kiss_fft_scalar) (it's a complex number, i.e. real + imaginary). sizeof(kiss_fft_scalar) will depend on how you compile, i.e. whether you use FIXED_POINT or not. It sounds like you really need to read the KissFFT documentation properly before going much further. – Paul R Jul 30 '13 at 09:50
  • @PaulR Long time no see, indeed! Apparently you are the GOTO man for *all-things-FFT* in Stackoverflow. Please let me pick your brain in another problem. I have a different question related to **kissfft**. Do you mind taking a look at it? [Here is the link](https://stackoverflow.com/q/61872422/176769). – karlphillip May 18 '20 at 14:59
  • @karlphillip: sorry, I'm not really an expert on either kissfft or Python - I did spend some time looking at kissfft for a particular task but that was a long time ago (2013 it seems!) so I'm probably out of date now. The good news though is that the author of kissfft hangs out on StackOverflow so you may be able to "ping" him for help: https://stackoverflow.com/users/3343/mark-borgerding – Paul R May 18 '20 at 15:20