problems with ippiFilterGauss_8u_AC4R

problems with ippiFilterGauss_8u_AC4R

Hello.
I have such code:
IppStatus s;
LONG nWidth = 720;
LONG nHeight = 576;
BYTE* pImage = new BYTE[nWidth * nHeight * 4];
memset(pImage, 0, nWidth * nHeight * 4);
//really normal data is copied to pImage by memcpy
//but as example, i think, memset to 0 is OK
//Using Ipp8u & ippiMalloc_8u_AC4() gives the same result.

BYTE* pTemp = new BYTE[nWidth * nHeight * 4];
BYTE* pTemp1 = new BYTE[nWidth * nHeight * 4];
IppiSize roi;
roi.height = nHeight;
roi.width = nWidth;
s = ippiFilterGauss_8u_AC4R(pImage, nWidth * 4, pTemp, nWidth * 4, roi, ippMskSize3x3);
s = ippiFilterGauss_8u_AC4R(pTemp, nWidth * 4, pTemp1, nWidth * 4, roi, ippMskSize3x3);
after first ippiFilterGauss_8u_AC4R operation everything is OK, but on second ippiFilterGauss_8u_AC4R address access violation happens.
If i change nWidth & nHeight to 100 & 100 (value more less then 720) second operation works fine.
What's the problem?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi, below is answer from our expert, I hope it willhelp

ROI can't be equal image size. User has to provide data outside ROI. Correct usage can be seen from the example below:

#include "stdio.h"
#include

int main(void)
{
IppStatus s;
int nWidth = 720;
int nHeight = 576;
IppiSize roi;
Ipp8u *pImage, *pTemp, *pTemp1;

pImage = ippsMalloc_8u((nWidth+2) * (nHeight+2) * 4);
pTemp = ippsMalloc_8u((nWidth+2) * (nHeight+2) * 4);
pTemp1 = ippsMalloc_8u(nWidth * nHeight * 4);

memset(pImage, 0, nWidth * nHeight * 4);
memset(pTemp, 0, nWidth * nHeight * 4);
memset(pTemp1, 0, nWidth * nHeight * 4);

printf("memset - OK
");

//really normal data is copied to pImage by memcpy
//but as example, i think, memset to 0 is OK
//Using Ipp8u & ippiMalloc_8u_AC4()
//gives the same result.

roi.height = nHeight;
roi.width = nWidth;

printf("pImage = %x, size = %x
", (int)pImage, nWidth * nHeight * 4 );
printf("pTemp = %x, size = %x
", (int)pTemp, nWidth * nHeight * 4 );
printf("pTemp1 = %x, size = %x
", (int)pTemp1, nWidth * nHeight * 4 );

s = ippiFilterGauss_8u_AC4R(pImage+nWidth*4+1, nWidth * 4, pTemp, nWidth * 4, roi, ippMskSize3x3);

printf("1-st Gauss - OK
");

s = ippiFilterGauss_8u_AC4R(pTemp+nWidth*4+1, nWidth * 4, pTemp1, nWidth * 4, roi, ippMskSize3x3);

printf("2-nd Gauss - OK
");

ippsFree(pImage);
ippsFree(pTemp);
ippsFree(pTemp1);

return 0;
}

Regards,
Vladimir

Leave a Comment

Please sign in to add a comment. Not a member? Join today