Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Chan__Davy
Beginner
162 Views

Error when using ippiWarpBilinearQuad

Hi,

I am using the function ippiWarpBilinearQuad_32f_C1R to warp a 32f image. Then I encounter the error:

Exception thrown at 0x00000000038746EB (ippiu8-5.2.dll) in IPPTest.exe: 0xC0000005: Access violation reading location 0x00000F9C12FC584C.

Below is my codes.

	IMG_RBUF
		rbBufSrc = { 0 },
		rbBufDst = { 0 };
	IppiSize
		srcSize = { 0 };
	IppiRect
		srcRoi = { 0 },
		dstRoi = { 0 };
	double
		srcQuad[4][2] = {
			{ 221.777777777777, 0.0 },
			{ 332.666666666666, 0.0 },
			{ 332.666666666666, 110.888888888888 },
			{ 221.777777777777, 110.888888888888 } },
		dstQuad[4][2] = {
			{ 222.277404785156, 0.500198245048522 },
			{ 333.166290283203, 0.500114262104034 },
			{ 333.166381835937, 111.388999938964 },
			{ 222.27749633789, 111.389083862304 } },
			coeffs[2][4] = { 0 };
	int
		interpolation = IPPI_INTER_LINEAR;
	IppStatus
		ippSts = ippStsNoErr;
	IMG_COORD
		coZ = { 0 };
	char
		acSrcName[] = "E:\\temp\\Src.r.tif",
		acDstName[] = "E:\\temp\\Dst.r.tif";
	
	// rbBufSrc with size 999x999
	// rbBufDst with size 1000x1000
	if (OK != FILE_ImageSize((IMG_UBYTE*)acSrcName, &rbBufSrc.size) ||
		OK != FILE_ImageSize((IMG_UBYTE*)acDstName, &rbBufDst.size))
		goto EXIT;
	rbBufSrc.linestep = rbBufSrc.size.x;
	rbBufDst.linestep = rbBufDst.size.x;
	if (NULL == (rbBufSrc.ptr = (IMG_REAL*)malloc(sizeof(IMG_REAL)*rbBufSrc.size.x*rbBufSrc.size.y)) ||
		NULL == (rbBufDst.ptr = (IMG_REAL*)malloc(sizeof(IMG_REAL)*rbBufDst.size.x*rbBufDst.size.y)))
		goto EXIT;

	if (OK != FILE_LoadImageTiff_r(
		acSrcName, &coZ, &rbBufSrc.size, &rbBufSrc) ||
		OK != FILE_LoadImageTiff_r(
			acDstName, &coZ, &rbBufDst.size, &rbBufDst))
		goto EXIT;

	srcSize.width = rbBufSrc.size.x;
	srcSize.height = rbBufSrc.size.y;
	srcRoi.x = 221;
	srcRoi.y = 0;
	srcRoi.width = 113;
	srcRoi.height = 112;
	dstRoi.x = dstRoi.y = 0;
	dstRoi.width = dstRoi.height = 1000;

	ippSts = ippiWarpBilinearQuad_32f_C1R(
		rbBufSrc.ptr, srcSize, rbBufSrc.linestep * sizeof(IMG_REAL), srcRoi, srcQuad,
		rbBufDst.ptr, rbBufDst.linestep * sizeof(IMG_REAL), dstRoi, dstQuad,
		interpolation);
	if (ippStsNoErr != ippSts)
		goto EXIT;

The last 32bit of the address being accessed when the error occurs is always a certain offset from the address of the buffer pointer
Address violation at 0x00000F9C12FC584C
rbBufSrc.ptr 0x0000000012fd0070
rbBufDst.ptr 0x00000000133a0070

There is no such error when I change the coordinate of the destination quad from 222.27749633789 to 222.27749633790. It seems strange that such small change will affect the address of the memory being accessed.

The IPP version that I am using is 5.2 but I encounter the same problem when I use IPP 2019.

Thank you.

0 Kudos
5 Replies
Ruqiu_C_Intel
Employee
162 Views

Hi Chan, Davy, 

Thanks for your question. For better investigating the issue, would you mind attach your whole sample code and image files? Then we can reproduce it locally.

Ivan_G_Intel1
Employee
162 Views

Hi, Davy!

Thank you for the reproducer, we will check it on our side and keep this thread updated.

Best regards,
Ivan Galanin.

Chan__Davy
Beginner
162 Views

Hi Ruqiu,

Attached please find the source code and the image files. The function I use to load the images is from a bulky library in my company. You will need to replace with your function.

And I found a related post which seems to be the same problem.
https://software.intel.com/en-us/forums/intel-integrated-performance-primitives/topic/813820#comment...

Best regards,

Davy

Chan__Davy
Beginner
162 Views

Dear Ivan,

I forgot I modified the codes. I revert the change to reproduce the problem. Attached please find the codes. Thanks.

Best regards,

Davy

Gennady_F_Intel
Moderator
162 Views

I still don't see how to build your example as it doesn't contain all needed header files ( e.x - //#include <DSP_GEN.H>, //#include <FILE_MGT.H> ), therefore we may see a lot of underfined errors. 

Reply