Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
6595 Discussions

To get IPP documentation example working

Artem_Y_Intel
Employee
121 Views

Hi, All.

I try to get IPP documentation Wiener filtering example working.

Ipp32f pSrc[256*256];
Ipp32f pDst[256*256];
int srcStep = 256*sizeof(Ipp32f);
int dstStep = 256*sizeof(Ipp32f);
IppiSize roiSize = {256, 256};
IppiSize dstRoiSize = {256, 256};
IppiSize maskSize = {3, 3};
int pBufferSize;
int channels = 1;
unsigned int pSeed = 3;
IppiPoint anchor = {1, 1};
Ipp32f noise[1] = {0.5};
ippiImageJaehne_32f_C1R(pSrc, srcStep, roiSize); // source image
//source image + RandUniform noise
ippiAddRandUniform_Direct_32f_C1IR(pSrc, srcStep, roiSize, 0, 1, &pSeed);
ippiFilterWienerGetBufferSize( dstRoiSize, maskSize, channels, &pBufferSize);
Ipp8u* pBuffer = ippsMalloc_8u(pBufferSize);
ippiFilterWiener_32f_C1R( pSrc, srcStep, pDst, dstStep, dstRoiSize, maskSize, anchor, noise, pBuffer);
ippsFree(pBuffer);

After executing this code under Linux on Intel Xeon CPU L5408 @ 2.13GHz , IPP ver. 6.0.0.045 pDst buffer contains NAN values.
Is there anything I am doing wrong? Any help would be appreciated.



Regards,
Artem
0 Kudos
2 Replies
Ying_S_Intel
Employee
121 Views
Try this one, we will change the example code in manual for next release.
Thanks,
Ying

#include "stdio.h"

#include "ipp.h"

int main()

{

IppStatus stat = ippStsNoErr;

int length = 256*256;

Ipp32f pSrc[256*256];

Ipp32f *pSrcW;

Ipp32f pDst[256*256];

int srcStep = 256*sizeof(Ipp32f);

int dstStep = 256*sizeof(Ipp32f);

IppiSize roiSize = {256, 256};

IppiSize maskSize = {3, 3};

IppiSize dstRoiSize = {256-maskSize.width, 256-maskSize.height};

int pBufferSize;

int channels = 1;

unsigned int pSeed = 3;

IppiPoint anchor = {1, 1};

Ipp32f noise[1] = {0.0};

Ipp8u* pBuffer;

stat = ippiImageJaehne_32f_C1R(pSrc, srcStep, roiSize);

if( stat != ippStsNoErr ){

printf (" ERROR !!! n");

return 1;

}

stat = ippiFilterWienerGetBufferSize( dstRoiSize, maskSize, channels, &pBufferSize);

if( stat != ippStsNoErr ){

printf (" ERROR !!! n");

return 1;

}

stat = ippsSet_32f( 1.0, pDst, length );

pBuffer = ippsMalloc_8u(pBufferSize);

pSrcW = (Ipp32f*)((Ipp8u*)pSrc + (maskSize.height - 1 - anchor.y ) * srcStep + (maskSize.width - 1 - anchor.x ) * sizeof(Ipp32f) );

stat = ippiFilterWiener_32f_C1R( pSrcW, srcStep, pDst, dstStep, dstRoiSize, maskSize, anchor, noise, pBuffer);

if( stat != ippStsNoErr ){

printf (" ERROR !!! n");

return 1;

}

ippsFree(pBuffer);

return 0;

}// __main__

Artem_Y_Intel
Employee
121 Views
Thank you. That's one works correct.
Regards,
Artem
Reply