Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6628 Discussions

ippiFilterGaussianBorder_8u_C1R - wrong results.

EShamur
Beginner
414 Views

Hi,

I am using IPP2018

I run Gaussian filter (ippiFilterGaussianBorder_8u_C1R)  , kernelSize = 3, sigma = 0.56, on single channel src image.

Src image size is 10x10. The image is flat ie all image data is set to 5.

I expect all dst image data to be 5 as well, However, I got strange result - dst image contains data = 4 and 3. This must be wrong.

Is it rounding issue? How would I work around it? Need your advise.

src
------
5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5

dst
------
4 4 4 4 4 4 4 4 3 3
4 4 4 4 4 4 4 4 3 3
4 4 4 4 4 4 4 4 3 3
4 4 4 4 4 4 4 4 3 3
4 4 4 4 4 4 4 4 3 3
4 4 4 4 4 4 4 4 3 3
4 4 4 4 4 4 4 4 3 3
4 4 4 4 4 4 4 4 3 3
4 4 4 4 4 4 4 4 3 3
4 4 4 4 4 4 4 4 3 3

 

 

Here is my code:

int main(int argc, _TCHAR* argv[])
{
int WIDTH = 10; /* image width */
int HEIGHT = 10; /* image height */
IppStatus status = ippStsNoErr;
Ipp8u* psrc=NULL, *pDst = NULL; /* Pointers to source/destination images */
int srcStep = 0, dstStep = 0; /* Steps, in bytes, through the source/destination images */
IppiSize roiSize = { WIDTH, HEIGHT }; /* Size of source/destination ROI in pixels */
Ipp32u kernelSize = 3;
Ipp32f sigma = 0.56f;
Ipp8u *pBuffer = NULL; /* Pointer to the work buffer */
IppFilterGaussianSpec* pSpec = NULL; /* context structure */
int iTmpBufSize = 0, iSpecSize = 0; /* Common work buffer size */
IppiBorderType borderType = ippBorderRepl;
Ipp8u borderValue = 0;
int numChannels = 1;

psrc=ippiMalloc_8u_C1(roiSize.width, roiSize.height, &srcStep);
pDst = ippiMalloc_8u_C1(roiSize.width, roiSize.height, &dstStep);

/* fill source image with const value = 5*/
for(int i=0;i<HEIGHT; i++)
for(int j=0; j<WIDTH; j++)
*(pSrc + (i * srcStep/sizeof(char)) + j ) = 5;


status = ippiFilterGaussianGetBufferSize(roiSize, kernelSize, ipp8u,
numChannels, &iSpecSize, &iTmpBufSize);
if(status != ippStsNoErr)
return 0;

pSpec = (IppFilterGaussianSpec *)ippsMalloc_8u(iSpecSize);
pBuffer = ippsMalloc_8u(iTmpBufSize);


status = ippiFilterGaussianInit(roiSize, kernelSize, sigma,
borderType, ipp8u, numChannels, pSpec, pBuffer);
if(status != ippStsNoErr)
return 0;

status = ippiFilterGaussianBorder_8u_C1R(pSrc, srcStep, pDst, dstStep,
roiSize, borderValue, pSpec, pBuffer);
if(status != ippStsNoErr)
return 0;

 

// Print output
cout<<"\nsrc"<<endl;
cout<<"------"<<endl;
for(int i=0;i<HEIGHT; i++)
{
for(int j=0; j<WIDTH; j++)
{
cout<<" "<<int(*(pSrc + (i * srcStep/sizeof(char)) + j ));
}
cout<<endl;
}
cout<<"\ndst"<<endl;
cout<<"------"<<endl;
for(int i=0;i<HEIGHT; i++)
{
for(int j=0; j<WIDTH; j++)
{
cout<<" "<<int(*(pDst + (i * srcStep/sizeof(char)) + j ));
}
cout<<endl;
}

ippsFree(pBuffer);
ippsFree(pSpec);
ippiFree(pSrc);
ippiFree(pDst);

return (int)status;
}

 

0 Kudos
2 Replies
VidyalathaB_Intel
Moderator
378 Views

Hi,

Thanks for reaching out to us.

The issue is reproducible from our end.

We are looking into this issue internally. we will get back to you soon.

Regards,

Vidya.


Gennady_F_Intel
Moderator
194 Views

Eyal,

the fix of the problem could be available into the latest version of IPP ( 2021.5).

Here is the output I see while linked your case against this version of IPP:


major = 2021

minor = 5

majorBuild = 0

build = -1274761199

targetCpu = l9  

Name = ippSP AVX2 (l9)

Version = 2021.5 (r0xb404b011)

BuildDate = Nov 18 2021


src

------

 5 5 5 5 5 5 5 5 5 5

 5 5 5 5 5 5 5 5 5 5

 5 5 5 5 5 5 5 5 5 5

 5 5 5 5 5 5 5 5 5 5

 5 5 5 5 5 5 5 5 5 5

 5 5 5 5 5 5 5 5 5 5

 5 5 5 5 5 5 5 5 5 5

 5 5 5 5 5 5 5 5 5 5

 5 5 5 5 5 5 5 5 5 5

 5 5 5 5 5 5 5 5 5 5


dst

------

 5 5 5 5 5 5 5 5 4 4

 5 5 5 5 5 5 5 5 4 4

 5 5 5 5 5 5 5 5 4 4

 5 5 5 5 5 5 5 5 4 4

 5 5 5 5 5 5 5 5 4 4

 5 5 5 5 5 5 5 5 4 4

 5 5 5 5 5 5 5 5 4 4

 5 5 5 5 5 5 5 5 4 4

 5 5 5 5 5 5 5 5 4 4

 5 5 5 5 5 5 5 5 4 4


-Gennady




















Reply