I need your help.
I defined array and plan in my main cpp. Then, I put the data in the array and do fftw execute in my sub cpp. sub cpp is in the thread, that is looped.
I defined array size enough because the number of data is dynamic. but fftw is doing fft to whole size of array, so result is not correct in my case. because the number of data is always smaller than array size.
Define array in sub cpp is easy way to solve the problem, but I don't want to define the array in sub cpp because sub cpp is looped.
I want to define array only once and change fft window size independent of array size.
How can I do?
/////// in my main cpp //////
fft_in = (fftw_complex*)fftw_malloc(sizeof(fftw_complex)*nScanSize);
fft_out = (fftw_complex*)fftw_malloc(sizeof(fftw_complex)*nScanSize);
p = fftw_plan_dft_1d(nScanSize, fft_in, fft_out, FFTW_FORWARD, FFTW_ESTIMATE);
/////////////////////////////
/////// in my sub cpp -> looped ///////
for (i = 0; i < nChannelCountAI; i++) {
for (j = nFirstIndex; j < nLastIndex; j++) {
fft_in[j - nFirstIndex][0] = RawData[i][j];
fft_in[j - nFirstIndex][1] = 0;
}
fftw_execute(p);
}
/////////////////////////////