- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear. Intel Members
I gottwo answers from intel engineer about MKL FFT and Inverse FFT
but I got a problem.
from first answer. Ican get a right forward FFT signal about our data. but I can get a inverse data
(Our data consist of 14bit WORD type so I usemy data transfer to float)
from second answer.I canget a correct Inverse data But I can't use FFT Data because some different
things compair malab result.
below is your two answer.
and I attached1 file about your answer result
this issue is very urgent
If you able Please answer ASAP
Thanks~
All the Best
1.
int i,j;
const int ROWS=3072, COLS=2560;
const int ROWSIZE=COLS, COLSIZE=ROWS;
_complex *xx = new _complex[ROWS*COLS];
memset(xx,1,2*sizeof(float)*ROWS*COLS); /* zero fill initialization */
int r,c;
for(r=0;r
{
for (c=0;c
{
xx[*ROWSIZE+(c)].x = (img[*ROWSIZE+(c)]);
xx[*ROWSIZE+(c)].y = (img[*ROWSIZE+(c)]);
}
}
int Height_f = ROWS;
int Widtht_f = COLS;
DFTI_DESCRIPTOR_HANDLE rowfft;
DFTI_DESCRIPTOR_HANDLE colfft;
MKL_LONG status;
MKL_LONG l[2];
float src;
//////////////////////////////////////////////////////////////////////////////////
DftiCreateDescriptor(&rowfft, DFTI_SINGLE, DFTI_COMPLEX, 1, ROWSIZE); /* stride 1 by default */
DftiSetValue(rowfft, DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)ROWS);
DftiSetValue(rowfft, DFTI_INPUT_DISTANCE, (MKL_LONG)ROWSIZE);
DftiSetValue(rowfft, DFTI_OUTPUT_DISTANCE, (MKL_LONG)ROWSIZE);
DftiCreateDescriptor(&colfft, DFTI_SINGLE, DFTI_COMPLEX, 1, COLSIZE); /* will set strides */
MKL_LONG colfft_strides[] = {0, ROWSIZE};
DftiSetValue(colfft, DFTI_INPUT_STRIDES, colfft_strides);
DftiSetValue(colfft, DFTI_OUTPUT_STRIDES, colfft_strides);
DftiSetValue(colfft, DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)COLS);
DftiSetValue(colfft, DFTI_INPUT_DISTANCE, (MKL_LONG)1);
DftiSetValue(colfft, DFTI_OUTPUT_DISTANCE, (MKL_LONG)1);
status = DftiCommitDescriptor( rowfft);
DftiComputeForward(rowfft, xx);
status = DftiCommitDescriptor( colfft);
DftiComputeForward(colfft, xx);
2. Second Answer
#define x(r,c) x[*ROWSIZE+(c)] /* explicit row-major indexing */
typedef struct {float x,y;} singlecomplex;
const int ROWS=3072, COLS=2560;
const int ROWSIZE=COLS, COLSIZE=ROWS;
singlecomplex* xx;
xx = (singlecomplex *)malloc(2*sizeof(float)*ROWS*COLS); /* zero fill initialization -> Ones pading */
memset(xx,0,2*sizeof(float)*ROWS*COLS); /* zero fill initialization */
int r,c;
for(r=0;r
{
for (c=0;c
{
xx[*ROWSIZE+(c)].x = (img[*ROWSIZE+(c)]);
xx[*ROWSIZE+(c)].y = (img[*ROWSIZE+(c)]);
}
}
int Height_f = ROWS;
int Widtht_f = COLS;
DFTI_DESCRIPTOR_HANDLE rowfft;
DFTI_DESCRIPTOR_HANDLE colfft;
MKL_LONG status;
MKL_LONG colfft_strides[] = {0, ROWSIZE};
float src;
status = DftiCreateDescriptor(&rowfft, DFTI_SINGLE, DFTI_COMPLEX, 1, (MKL_LONG)ROWSIZE); /* stride 1 by default */
status = DftiSetValue(rowfft, DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)ROWS);
status = DftiSetValue(rowfft, DFTI_INPUT_DISTANCE, (MKL_LONG)ROWSIZE);
status = DftiSetValue(rowfft, DFTI_BACKWARD_SCALE, 1.0/(ROWS*COLS));
// status = DftiSetValue(rowfft, DFTI_OUTPUT_DISTANCE, (MKL_LONG)ROWSIZE); // not needed for in-place
status = DftiCreateDescriptor(&colfft, DFTI_SINGLE, DFTI_COMPLEX, 1, (MKL_LONG)COLSIZE); /* will set strides */
status = DftiSetValue(colfft, DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)COLS);
status = DftiSetValue(colfft, DFTI_INPUT_DISTANCE, (MKL_LONG)1);
// status = DftiSetValue(colfft, DFTI_OUTPUT_DISTANCE, (MKL_LONG)1); // not needed for in-place
status = DftiSetValue(colfft, DFTI_INPUT_STRIDES, colfft_strides);
// status = DftiSetValue(colfft, DFTI_OUTPUT_STRIDES, colfft_strides); // not needed for in-place
status = DftiCommitDescriptor( rowfft);
status = DftiComputeForward(rowfft, xx);
status = DftiCommitDescriptor( colfft);
status = DftiComputeForward(colfft, xx);
// ///Inverse FFT
status = DftiCommitDescriptor( colfft);
status = DftiComputeBackward(colfft, xx);
status = DftiCommitDescriptor( rowfft);
status = DftiComputeBackward(rowfft, xx);
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The difference between these two variants is in using normalization of trnasforms:
status = DftiSetValue(rowfft, DFTI_BACKWARD_SCALE, 1.0/(ROWS*COLS));
But also please correct your second variant which is not currently correspond to what wassuggested to you.
I means, not needed DftiCommitDescriptor callsafter line // ///Inverse FFT.
Maybe something else was not corrected by you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Thanks to your fast answer
your answer:
I means, not needed DftiCommitDescriptor calls after line // ///Inverse FFT.
-> It is just test code. When I use inverse FFT I don't call DftiCommitDescriptor
Already I attachedmy result file.
I testmy code usingyour code(first code), and your engineer code (2).
Result of FFTusing first code I can see frequency. so I can calculate something.
but I can't get a incerse FFT image.
general, As I know FFT + inverse FFT -> Original image (if I don't treat anything)
by your 1 code I test fft and Inverse fft but I can't get a original image.
When I using code 2
in this case I can get FFT + incerse FFT = original image
but in the FFT image, I can't see the signal. and I cant calculate frequency.
my needs : FFT -> find frequency position information and some calculate and inverse fft
all the best
Dakin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dakin,
Looks like it was you who startedthread about The FFT adjusts only half size...
And that root cause was in interpretation/visualization of data after FFTs. So, please double check your testcase again.
Anyway, it will benice to see your self-contained testcase to reproduce your new problem in order to help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Victor
you are right my issee Start from FFT harf size .
I also test from harfsize test. I also same result only harf size result and can't get inverse FFT image
by sample code in the Intel MKL manual.
fortunately I can get a kind and nice answer from you soI can get a full size FFT result (I can see frequency information) butcan't get a inverse FFT
Another member give a one clue normalization so I can get a FFT and IFFT but I can't get frequency information data
I also check my project and code again and again.
If you have a clue.
Please advice for me.
I'm very thanks to your kindness and help
all the best
Dakin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dakin,
Please add checking of DFTI status after all DFTI calls to be sure that all is OK.
E.g. see MKLROOT/examples/dftc
if (! DftiErrorClass(Status, DFTI_NO_ERROR)) {
printf(" TEST FAILED : after ....)\n");
failure++;
goto FREE_DESCRIPTOR;
}
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page