I am trying to use ippiWTFwd and ippiWTInv to compute the haar transform of an image. The image is already in a size that is powers of 2, so I don't have to worry about replication or extending the image border. When I call my function on a 256x256 image up to a 1024x1024 image it doesn't cause a problem. If I try an image that is 2048x2048 or larger, my function will crash in ippiWTInv and return a read access violation at 0x0.
Here is the function I am using, which I pass the image data and the image width/height.
Ipp32f* haarIppi(Ipp32f* inputBuffer, int width, int height)
{
IppiWTFwdSpec_32f_C1R* pSpec;
IppiWTInvSpec_32f_C1R* pSpecInv;
Ipp32f pTapsLow[2] = {0.7071067811865475f,0.7071067811865475f};
Ipp32f pTapsHigh[2] = {0.7071067811865475f,-0.7071067811865475f};
int lenLow = 2;
int anchorLow = 1;
int lenHigh = 2;
int anchorHigh = 1;
int srcStep = width*sizeof(Ipp32f);
Ipp32f* pDetailXDst = new Ipp32f[width*height/4];
Ipp32f* pDetailYDst= new Ipp32f[width*height/4];
Ipp32f* pDetailXYDst = new Ipp32f[width*height/4];
Ipp32f* pApproxDst = new Ipp32f[width*height/4];
IppiSize dstRoiSize = {width/2, height/2};
int bufSize, bufSizeInv;
Ipp8u* pBuffer;
Ipp8u* pBufferInv;
Ipp32f* pDstInv = new Ipp32f[width*height];
IppiSize roiInvSize = {width/2, height/2};
int stepDstInv = width*sizeof(Ipp32f);
int approxStep, detailXStep, detailYStep, detailXYStep;
approxStep = detailXStep = detailYStep = detailXYStep = width/2*sizeof(Ipp32f);
//perform forward wavelet transform
ippiWTFwdInitAlloc_32f_C1R ( &pSpec, pTapsLow, lenLow, anchorLow, pTapsHigh, lenHigh, anchorHigh);
ippiWTFwdGetBufSize_C1R(pSpec, &bufSize);
pBuffer = ippsMalloc_8u(bufSize);
IppStatus forward = ippiWTFwd_32f_C1R (inputBuffer, srcStep, pApproxDst, approxStep, pDetailXDst,
detailXStep, pDetailYDst, detailYStep, pDetailXYDst, detailXYStep,
dstRoiSize, pSpec, pBuffer);
if(forward!=0)
qDebug() << "something failed in forward Xform";
//initialize inverse specs
ippiWTInvInitAlloc_32f_C1R (&pSpecInv, pTapsLow, lenLow, anchorLow, pTapsHigh, lenHigh, anchorHigh);
ippiWTInvGetBufSize_C1R(pSpecInv, &bufSizeInv);
pBufferInv = ippsMalloc_8u(bufSizeInv);
//perform inverse wavelet transform
ippiWTInv_32f_C1R( pApproxDst, approxStep, pDetailXDst, detailXStep, pDetailYDst, detailYStep, pDetailXYDst,
detailXYStep, roiInvSize, pDstInv, stepDstInv, pSpecInv, pBufferInv);
ippiWTInvFree_32f_C1R (pSpecInv);
ippiWTFwdFree_32f_C1R (pSpec);
return pDstInv;
}