- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I try to implement a DFT of an image (so a 2 dimensional DFT) with split arrays (one array for the real part of a complex number - one array for the complex part). The DFT should be performed not inplace. The array is alligned so that i get the (i,j)th element by array(i*m_Step+j). The arrays are of type float (actually they are allocated with ippimalloc_32f). I use MKL721 (trial version). I searched through the web, the manual and this forum, but somehow I couldnt make my code working:
DFTI_DESCRIPTOR_HANDLE l_Desc=0;
long l_Stride[3];
l_Stride[0] = 0;
l_Stride[1] = m_Step;
l_Stride[2] = 1;
long l_Length[2];
l_Length[0] = m_Height;
l_Length[1] = m_Width;
long l_Status = DftiCreateDescriptor( &l_Desc, DFTI_SINGLE, DFTI_COMPLEX, 2, l_Length );
if(!DftiErrorClass(l_Status, DFTI_NO_ERROR)){
std::cerr << "Error in create descriptor!" << std::endl;
return NULL;
}
DftiSetValue(l_Desc, DFTI_INPUT_STRIDES, l_Stride );
DftiSetValue(l_Desc, DFTI_OUTPUT_STRIDES, l_Stride );
DftiSetValue(l_Desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
DftiSetValue(l_Desc, DFTI_COMPLEX_STORAGE, DFTI_REAL_REAL );
l_Status = DftiCommitDescriptor( l_Desc );
if(!DftiErrorClass(l_Status, DFTI_NO_ERROR)){
std::cerr << "Error in create descriptor!" << std::endl;
return NULL;
}
if( DFTI_NO_ERROR != DftiComputeForward(l_Desc, lp_ImageReal->mp_ImageBuffer, lp_ImageImag->mp_ImageBuffer,
lp_TmpReal->mp_ImageBuffer, lp_TmpImag->mp_ImageBuffer ) ){
std::cerr << "Forward error!" << std::endl;
}
if( DFTI_NO_ERROR != DftiComputeBackward(l_Desc, lp_TmpReal->mp_ImageBuffer, lp_TmpImag->mp_ImageBuffer,
lp_ResultReal->mp_ImageBuffer, lp_ResultImag->mp_ImageBuffer ) ){
std::cerr << "Backward error!" << std::endl;
}
DftiFreeDescriptor(&l_Desc);
what did I do wrong? *Real is always the real part array and *Imag respectivly the imaginary part.
Another question: is dfti of mkl or the dft of IPP faster?
Thanks in advance,
Stefan Hinterstoisser
I try to implement a DFT of an image (so a 2 dimensional DFT) with split arrays (one array for the real part of a complex number - one array for the complex part). The DFT should be performed not inplace. The array is alligned so that i get the (i,j)th element by array(i*m_Step+j). The arrays are of type float (actually they are allocated with ippimalloc_32f). I use MKL721 (trial version). I searched through the web, the manual and this forum, but somehow I couldnt make my code working:
DFTI_DESCRIPTOR_HANDLE l_Desc=0;
long l_Stride[3];
l_Stride[0] = 0;
l_Stride[1] = m_Step;
l_Stride[2] = 1;
long l_Length[2];
l_Length[0] = m_Height;
l_Length[1] = m_Width;
long l_Status = DftiCreateDescriptor( &l_Desc, DFTI_SINGLE, DFTI_COMPLEX, 2, l_Length );
if(!DftiErrorClass(l_Status, DFTI_NO_ERROR)){
std::cerr << "Error in create descriptor!" << std::endl;
return NULL;
}
DftiSetValue(l_Desc, DFTI_INPUT_STRIDES, l_Stride );
DftiSetValue(l_Desc, DFTI_OUTPUT_STRIDES, l_Stride );
DftiSetValue(l_Desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
DftiSetValue(l_Desc, DFTI_COMPLEX_STORAGE, DFTI_REAL_REAL );
l_Status = DftiCommitDescriptor( l_Desc );
if(!DftiErrorClass(l_Status, DFTI_NO_ERROR)){
std::cerr << "Error in create descriptor!" << std::endl;
return NULL;
}
if( DFTI_NO_ERROR != DftiComputeForward(l_Desc, lp_ImageReal->mp_ImageBuffer, lp_ImageImag->mp_ImageBuffer,
lp_TmpReal->mp_ImageBuffer, lp_TmpImag->mp_ImageBuffer ) ){
std::cerr << "Forward error!" << std::endl;
}
if( DFTI_NO_ERROR != DftiComputeBackward(l_Desc, lp_TmpReal->mp_ImageBuffer, lp_TmpImag->mp_ImageBuffer,
lp_ResultReal->mp_ImageBuffer, lp_ResultImag->mp_ImageBuffer ) ){
std::cerr << "Backward error!" << std::endl;
}
DftiFreeDescriptor(&l_Desc);
what did I do wrong? *Real is always the real part array and *Imag respectivly the imaginary part.
Another question: is dfti of mkl or the dft of IPP faster?
Thanks in advance,
Stefan Hinterstoisser
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stefan,
I am going to ask Nadya to respond to the first part of your question. As to the relative speed of MKL vs IPP, except for quite small transforms their speed is essentially the same since they both use IPP kernels.
Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stefan,
DFT interface doesn't support split arrays now. There is this functionality in DFT documentation but one doesn't implemented. You can see about DFT limitations in mklnotes.htm, Known limitations chapter.
Unfortunately we don't plan to add this possibility in the nearest version and we are going to delete it from DFT documentation. We can use FFT MKL interface for split tight arrays with length order of 2.
Any way you canmake requestfor this functionality. It is important for us to know about customer needs.
Thanks,
Nadezhda
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page