Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
74 Views

Access violation in ippiFilterSeparable

Hi,

I'm getting an access violation in ippiFilterSeparable in the following scenario: imageSize = (5,2), kernelSize = (9,9). Below is the code section :

	IppiSize kernelSize{ 9,9 };
	IppDataType dataType = IppDataType::ipp16s;
	IppDataType kernelDataType = IppDataType::ipp16s;
	IppiSizeL roiSize = {srcSize.width,srcSize.height};

	int srcStep = srcSize.width * sizeof(uint8_t); //  width = 5
	int dstStep = dstSize.width * sizeof(uint8_t); //width=5

	int specSize = 0;
	IppSizeL bufferSize = 0;
	ippiFilterSeparableGetBufferSize_L(roiSize, kernelSize, dataType, kernelDataType, 1 /*channels*/, &bufferSize);
	ippiFilterSeparableGetSpecSize_L(kernelSize, dataType, 1 /*channels*/, &specSize);

   //allocate pBuffer and pSpec buffers using bufferSize and specSize
   //....

    //kernel is a vector with 9 elements
	ippiFilterSeparableInit_16s_L(kernel.data(), kernel.data(), kernelSize, 1, 0, dataType, 1 /*channels*/, pSpec.getBuffer());
	result = ippiFilterSeparable_8u_C1R_L(pSrc, srcStep, pDst, dstStep, roiSize, IppiBorderType::ippBorderRepl, 0, pSpec.getBuffer(), pBuffer.getBuffer());

 

Actually the same thing is hapenning for kernels of size bigger than (3,3). This doesn't happen if the image has size (2,5) (instead of (5,2)).

Also, setting the roiSize in the following way :

IppiSizeL roiSize = { srcSize.width , std::max<int>(srcSize.height, kernel.size()) };

seems to fix the issue. 

Is this the correct way of handling these scenarios ?

Thank you in advance!

Dorian

0 Kudos
1 Reply
Highlighted
Employee
74 Views

Hello, thank you for your issue. Could you please send all code because access violation might happen due to improper buffers allocation

0 Kudos