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

ippiResizeYUV422_8u_C2R and VirtualAlloc

keerthishankar
Beginner
406 Views
ippiResizeYUV422_8u_C2R crashes when the source image exactly ends on the page boundary. If ippMalloc is used instead of VirtualAlloc, then there is no issue. So, ippiResizeYUV422_8u_C2R requires aligned memory as input?

I am using the x86 version of IPP v7.0.205 on Windows 7. Below is a snippet to reproduce the issue.

const int SRC_WIDTH = 640;
const int SRC_HEIGHT = 360;
const int SRC_STEP = SRC_WIDTH * 2;

SYSTEM_INFO sysInfo;
::GetSystemInfo(&sysInfo);
assert(sysInfo.dwPageSize == 4096);

const int SRC_SIZE = SRC_WIDTH * SRC_HEIGHT * 2;
const int SRC_BUFFERS = 2;

const int DST_WIDTH = 320;
const int DST_HEIGHT = 240;
const int DST_STEP = DST_WIDTH * 2;
const int DST_SIZE = DST_WIDTH * DST_HEIGHT * 2;

const double SRC_AR = (double)SRC_WIDTH / SRC_HEIGHT;
const double DST_AR = (double)DST_WIDTH / DST_HEIGHT;
assert(SRC_AR > DST_AR);

double xFactor = DST_WIDTH / (SRC_WIDTH * (DST_AR / SRC_AR));
double yFactor = (double)DST_HEIGHT / SRC_HEIGHT;

int croppedWidth = ((int)(SRC_WIDTH * (DST_AR / SRC_AR)) + 3) & ~3;
int croppedHeight = SRC_HEIGHT;

Ipp8u* srcImg = (Ipp8u*)::VirtualAlloc(NULL, SRC_SIZE * SRC_BUFFERS, MEM_COMMIT, PAGE_READWRITE);
//Ipp8u* srcImg = (Ipp8u*)ippMalloc(SRC_SIZE * SRC_BUFFERS);
Ipp8u* dstImg = new Ipp8u[DST_SIZE];

IppiSize srcSize = { SRC_WIDTH, SRC_HEIGHT };

IppiRect srcRoi = {
(SRC_WIDTH - croppedWidth) / 2,
(SRC_HEIGHT - croppedHeight) / 2,
croppedWidth,
croppedHeight
};

IppiSize dstSize = { DST_WIDTH, DST_HEIGHT };

for(size_t j = 0; j < SRC_BUFFERS; ++j)
{
Ipp8u* srcBuf = srcImg + (SRC_SIZE * j);
printf("j : %d, srcBuf : %x", j, srcBuf);
IppStatus status;
status = ippiResizeYUV422_8u_C2R(srcBuf, srcSize, SRC_STEP, srcRoi, dstImg, DST_STEP, dstSize, xFactor, yFactor, IPPI_INTER_LINEAR);
printf(" [OK]\\n");
}

::VirtualFree(srcImg, SRC_SIZE * SRC_BUFFERS, MEM_RELEASE);
//ippFree(srcImg);
delete [] dstImg;

0 Kudos
3 Replies
Chao_Y_Intel
Moderator
406 Views
Hello,

Thanks for your report. We are checking this problem now.

Chao
0 Kudos
Chao_Y_Intel
Moderator
406 Views
Hello,

This problem is expected to be fixed in the latest 7.0.6 release. could you please have a check?

Thanks,
Chao
0 Kudos
SergeyKostrov
Valued Contributor II
406 Views
The problemis similar to:

http://software.intel.com/en-us/forums/showthread.php?t=50079&o=a&s=lr

Take a look at apost #7.
0 Kudos
Reply