Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Employee
11 Views

To get IPP documentation example working

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
Highlighted
Employee
11 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__

0 Kudos
Employee
11 Views

Thank you. That's one works correct.
Regards,
Artem
0 Kudos