- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
[cpp]
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;
}
[/cpp]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to note that it only seems to crash when the image width > 1024. I can run the code on images which are 8192x1024 etc., but if I try something like 2048x2048 or 1024x8192, it will get an invalid acess error in the inverse function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like the process uses ~70MB of memory when running on a 1024x1024 image, ~130MB when (crashing) to use a 2048x2048 image and ~300MB for a 8196x1024 image which does not crash. I attached the task manager memory details for each scenario. If there is a hidden buffer limit with the inverse WT function, then I may just split my large image into smaller sections for processing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For virtual memory Min and Max, I have Min as 16MB and Max as 6135MB.
I am unsure about the stack reserve/commit, but I am using qMake with QT Creator to do the linking and I believe the default stack size is set with /Zm200.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page