I'm trying to do some filtering with FFT. I'm using r2r_1d plan and I have no idea how to do the inverse transform...
void PerformFiltering(double* data, int n)
{
/* FFT */
double* spectrum = new double[n];
fftw_plan plan;
plan = fftw_plan_r2r_1d(n, data, spectrum, FFTW_REDFT00, FFTW_ESTIMATE);
fftw_execute(plan); // signal to spectrum
fftw_destroy_plan(plan);
/* some filtering here */
/* Inverse FFT */
plan = fftw_plan_r2r_1d(n, spectrum, data, FFTW_REDFT00, FFTW_ESTIMATE);
fftw_execute(plan); // spectrum to signal (inverse FFT)
fftw_destroy_plan(plan);
}
Am I doing all the things right? I'm confused because in FFTW complex DFT's you can set a transform direction by flag like this:
p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
or
p = fftw_plan_dft_1d(N, in, out, FFTW_BACKWARD, FFTW_ESTIMATE);