ippiSuperSampling_8u_P3R crashes

ippiSuperSampling_8u_P3R crashes

Resizing of the YV12 (planar) data using ippiSuperSampling_8u_P3R crashes, with invalid access in reading memory location. Below is the code and the details of the buffer and parameters

Input buffer size(pInputImage) is 518400, srcwidth = 720, srcheight = 480, dstwidth = 400, dstheight = 300. It crashes trying to access memory outside the boundary for eg:

address of pI420SrcData[0] = 0x04020000

address of pI420SrcData[1] = 0x04074600

address of pI420SrcData[2] = 0x04089780

It crashes trying to access 0x0409f170 which according to me is exceeds the boundary of V planar buffer. Please let me know what could be wrong here.

I am using Intel IPP v6.1.2.041

Ipp8u* ScalingYUV420Data(Ipp8u* pInputImage,unsigned int srcwidth,unsigned int srcheight,unsigned int dstwidth,unsigned int dstheight)

{

Ipp8u* pI420SrcData[3];

Ipp8u* pI420DestData[3];

IppiRect srcrect;

IppiRect destrect;

IppiSize srcsize;

IppiSize destsize;

pI420SrcData[0] = pInputImage;

pI420SrcData[1] = pI420SrcData[0] + (srcwidth * srcheight);

pI420SrcData[2] = pI420SrcData[1] + (srcwidth * srcheight) / 4 ;

// Calculate the resolution

srcsize.width = srcwidth;

srcsize.height = srcheight;

destsize.width = dstwidth;

destsize.height = dstheight;

int srcstep = srcwidth;

int dststep = dstwidth;

// Calculate the pointers for destination

pI420DestData[0] = m_pScaledDestData;

pI420DestData[1] = pI420DestData[0] + (dstwidth * dstheight);

pI420DestData[2] = pI420DestData[1] + (dstwidth * dstheight) / 4;

int bufsize = 0;

if(ippiSuperSamplingGetBufSize( srcsize, destsize, 3, &bufsize ) != ippStsNoErr)

{

return NULL;

}

 

if(bufsize <= 0)

{

return NULL;

}

Ipp8u* buf = ippsMalloc_8u( bufsize );

ippiSuperSampling_8u_P3R(pI420SrcData, srcstep, srcsize, pI420DestData, dststep, destsize, buf);

if( buf != NULL ) 

ippsFree( buf );

return m_pScaledDestData;

}
1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.