Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6704 Discussions

IPP6.1 "Access violation reading" when using ippiResizeSqrPixel_8u_C3R

vojtecht
Beginner
460 Views
Hi,

When using ippiResizeSqrPixel_8u_C3R I get Access Violation with IPP 6.1 on Core 2 Duo in x64 version of my software. Here's a sample piece of code which doesn't work properly:

// downsizing 24 bit image 768x768 - that means we need 1769472B
void* pv=VirtualAlloc(NULL, 2048*1024, MEM_COMMIT, PAGE_READWRITE); // I will use last 1769472B for the image
void* pv1=VirtualAlloc(NULL, 2048*1024, MEM_RESERVE, PAGE_READWRITE); // reserved memory so we always get AV
ASSERT((BYTE*)pv1==(BYTE*)pv+2048*1024); // block pv1 has to follow pv

IppiSize srcSize={768,768}; // downsizing 768x768 to 192x192
IppiSize dstSize={192,192};
IppiRect srcRect={0,0, srcSize.width,srcSize.height};
IppiRect dstRect={0,0, dstSize.width,dstSize.height};
int interpolation = IPPI_INTER_SUPER;
int scanSrc=4*((srcSize.width*3+3)/4); // aligned to 32 bits
int scanDst=4*((dstSize.width*3+3)/4);
double xFactor=dstSize.width/(double)srcSize.width; // factor 0.25
double yFactor=dstSize.height/(double)srcSize.height;

int BufferSize=0;
IppStatus status=ippiResizeGetBufSize(srcRect, dstRect, 3, interpolation, &BufferSize);
Ipp8u* pBuffer=ippsMalloc_8u(BufferSize);

BYTE *pDst=new BYTE[scanDst*dstSize.height];
BYTE *pSrc=(BYTE*)pv1-scanSrc*srcSize.height;

//ippiResizeSqrPixel will result in access violation reading location pv1
status=ippiResizeSqrPixel_8u_C3R(pSrc, srcSize, scanSrc, srcRect, pDst, scanDst, dstRect, xFactor, yFactor, 0, 0, interpolation, pBuffer);
ippsFree(pBuffer);
...

It happens with ippiu8-6.1.dll and ippim7-6.1.dll, when I erase both of them, it seems to be working. Any help would be appreciated.

Thanks in advance for your answer
Vojtech Tryhuk

PS: Same thing happens when I try to use ippiResize_8u_C3R
PPS: ippiResizeSqrPixel fails when xFactor!=yFactor, am I missing something?
0 Kudos
4 Replies
Ying_H_Intel
Employee
460 Views

Hello Vojtech,

Seeing from your code, everything looks fine. You mentioned ippiResizeSqrPixel failed whenxFactor!=yFactor . What exact value of them?

We have a known issue regarding the function at <http://software.intel.com/en-us/articles/resize-function-ippiresizesqrpixel-crashed-for-small-image/> , but it only occurs when small image.
I try to printthe value pv, pv1, pDst, pSrcand test on "m7", "u7"machinewith IPP 6.1 . But it runs without any problem. Would you please try them and let me know the result at your machine?

The ippiResizeSqr.cpp as attached.

// Print the version of ipp being used
const IppLibraryVersion* lib = ippiGetLibVersion();
printf("%s %s %d.%d.%d.%dn", lib->Name, lib->Version,lib->major, lib->minor, lib->majorBuild, lib->build);

void* pv=VirtualAlloc(NULL, 2048*1024, MEM_COMMIT, PAGE_READWRITE); // I will use last 1769472B for the image
void* pv1=VirtualAlloc(NULL, 2048*1024, MEM_RESERVE, PAGE_READWRITE); // reserved memory so we always get AV
assert((BYTE*)pv1==(BYTE*)pv+2048*1024); // block pv1 has to follow pv

printf("pv address: %x n", pv);
printf("pv1 address: %x n", pv1);


and build it in MSVC 2005 for x64
>C:Program FilesIntelIPP6.1.0.032em64ttoolsenvippenvem64t.bat
>cl ippiResizeSqr.cpp ippiem64t.lib ippsem64t.lib ippcoreem64t.lib

The result is about

ippiu8-6.1.dll 6.1 build 137.15 6.1.137.804
pv address: 3360000
pv1 address: 3560000
pSrc address: 33b0000
pDst address: 32e0ca0

Regards,

Ying

0 Kudos
vojtecht
Beginner
460 Views
>You mentioned ippiResizeSqrPixel failed when xFactor!=yFactor . What exact value of them?
Now I see that it happens only when one of the factors is 1. So an image wasn't downsized in both dimensions - my fault.

>We have a known issue...
I am aware of that.

>Would you please try them and let me know the result at your machine?
Unhandled exception at 0x028949b3 in ippiresizesqr.exe: 0xC0000005: Access violation reading location 0x0000000003530000.

ippiu8-6.1.dll 6.1 build 137.16 6.1.137.805
pv address: 3330000
pv1 address: 3530000
pSrc address: 3380000
pDst address: 1fa0080

Regards
Vojtech

0 Kudos
Ying_H_Intel
Employee
460 Views
Quoting - vojtecht
>You mentioned ippiResizeSqrPixel failed when xFactor!=yFactor . What exact value of them?
Now I see that it happens only when one of the factors is 1. So an image wasn't downsized in both dimensions - my fault.

>We have a known issue...
I am aware of that.

>Would you please try them and let me know the result at your machine?
Unhandled exception at 0x028949b3 in ippiresizesqr.exe: 0xC0000005: Access violation reading location 0x0000000003530000.

ippiu8-6.1.dll 6.1 build 137.16 6.1.137.805
pv address: 3330000
pv1 address: 3530000
pSrc address: 3380000
pDst address: 1fa0080

Regards
Vojtech


Hi Vojtech,

Thanks for the information. I can reproduce the problem now. We will investigate thecause and let you knowifanyresult.

Thanks,
Ying
0 Kudos
Ying_H_Intel
Employee
460 Views
Hi Vojtech,

Sorry for the delay. Just get updates,the bug was corrected in recent IPP version.
To getthe latest IPP install package, pleasefollow the instruction on IPP Downloads, Registration and Licensing.

Regards,
Ying
0 Kudos
Reply