Quantcast
Channel: Intel® Integrated Performance Primitives
Viewing all articles
Browse latest Browse all 1294

2D Wavelet example test implementation problem

$
0
0

I am having a problem with ref. Below is my implementation. The forward transform works fine, I can see the 4 output images look good. The problem is with the inverse, its output (to be the same image dimensions as the input image, image is square (orgWidth==orgHeight)) has aliasing and it looks like every second row and every second column content is blank. I can't find a way to embed an output image here. Please let me know how I can get that to you in case you want to take a look.

Can you please check and see what the problem may be?

Thank you!!

IppStatus ippStatus = ippStsNoErr;

 IppiWTFwdSpec_32f_C1R* pSpecFwd;
 IppiWTInvSpec_32f_C1R* pSpecInv;
 int specSizeFwd, specSizeInv;
 Ipp32f pTapsLow[3] = { 0.25, 0.5, 0.25 };
 int lenLow = 3;
 int anchorLow = 1;
 Ipp32f pTapsHigh[3] = { 0.75, -0.25, -0.125 };
 int lenHigh = 3;
 int anchorHigh = 1;

 int sourceBWidth = orgWidth + 1;
 int sourceBArraySize = sourceBWidth * sourceBWidth;

 Ipp32f *pSrcB = new Ipp32f[sourceBArraySize];
 int srcStepB = sourceBWidth * sizeof(Ipp32f);
 IppiSize roiSizeB = { sourceBWidth, sourceBWidth };
 int srcStep = orgWidth * sizeof(Ipp32f);
 IppiSize roiSize = { orgWidth, orgWidth };

 int subWidth = orgWidth / 2;

 Ipp32f *pDetailXDst = new Ipp32f[subWidth * subWidth];
 Ipp32f *pDetailYDst = new Ipp32f[subWidth * subWidth];
 Ipp32f *pDetailXYDst = new Ipp32f[subWidth * subWidth];
 Ipp32f *pApproxDst = new Ipp32f[subWidth * subWidth];

 IppiSize dstRoiSize = { subWidth, subWidth };
 int bufSizeFwd, bufSizeInv;
 Ipp8u* pBufferFwd;
 Ipp8u* pBufferInv;
 IppiSize roiInvSize = { subWidth, subWidth };
 int stepDstInv = orgWidth * sizeof(Ipp32f);

 int subWidthPlusOne = subWidth + 1;
 Ipp32f *pAppB = new Ipp32f[subWidthPlusOne * subWidthPlusOne];
 Ipp32f *pXB = new Ipp32f[subWidthPlusOne * subWidthPlusOne];
 Ipp32f *pYB = new Ipp32f[subWidthPlusOne * subWidthPlusOne];
 Ipp32f *pXYB = new Ipp32f[subWidthPlusOne * subWidthPlusOne];
 int StepB = subWidthPlusOne * sizeof(Ipp32f);

 IppiSize roiInvSizeB = { (subWidth + 1), (subWidth + 1) };
 int approxStep, detailXStep, detailYStep, detailXYStep;
 approxStep = detailXStep = detailYStep = detailXYStep = subWidth * sizeof(Ipp32f);
 //adds border to the source image
 ippStatus = ippiCopyWrapBorder_32s_C1R((Ipp32s*)pSrc, srcStep, roiSize, (Ipp32s*)pSrcB, srcStepB, roiSizeB, 1, 1);
 //performs forward  wavelet transform
 ippStatus = ippiWTFwdGetSize_32f(1, lenLow, anchorLow, lenHigh, anchorHigh, &specSizeFwd, &bufSizeFwd);
 pSpecFwd = (IppiWTFwdSpec_32f_C1R*)ippMalloc(specSizeFwd);
 pBufferFwd = (Ipp8u*)ippMalloc(bufSizeFwd);
 ippStatus = ippiWTFwdInit_32f_C1R(pSpecFwd, pTapsLow, lenLow, anchorLow, pTapsHigh, lenHigh, anchorHigh);
 ippStatus = ippiWTFwd_32f_C1R(pSrcB + roiSizeB.width + 1, srcStepB, pApproxDst, approxStep,
  pDetailXDst, detailXStep, pDetailYDst, detailYStep, pDetailXYDst, detailXYStep, dstRoiSize, pSpecFwd, pBufferFwd);



/* ippStatus = ippiCopy_32f_C1R(pApproxDst, approxStep, pDst, srcStep, dstRoiSize);
 ippStatus = ippiCopy_32f_C1R(pDetailXDst, approxStep, pDst + subWidth, srcStep, dstRoiSize);
 ippStatus = ippiCopy_32f_C1R(pDetailYDst, approxStep, pDst + (subWidth * m_nVolLoadedX), srcStep, dstRoiSize);
 ippStatus = ippiCopy_32f_C1R(pDetailXYDst, approxStep, pDst + subWidth + (subWidth * m_nVolLoadedX), srcStep, dstRoiSize);
*/

 ippStatus = ippiWTInvGetSize_32f(1, lenLow, anchorLow, lenHigh, anchorHigh, &specSizeInv, &bufSizeInv);
 pSpecInv = (IppiWTInvSpec_32f_C1R*)ippMalloc(specSizeInv);
 pBufferInv = (Ipp8u*)ippMalloc(bufSizeInv);
 ippStatus = ippiWTInvInit_32f_C1R(pSpecInv, pTapsLow, lenLow, anchorLow, pTapsHigh, lenHigh, anchorHigh);
 //adds border to four images obtained after ippiWTFwd
 ippStatus = ippiCopyWrapBorder_32s_C1R((Ipp32s*)pApproxDst, approxStep, dstRoiSize, (Ipp32s*)pAppB, StepB, roiInvSizeB, 0, 0);
 ippStatus = ippiCopyWrapBorder_32s_C1R((Ipp32s*)pDetailXDst, detailXStep, dstRoiSize, (Ipp32s*)pXB, StepB, roiInvSizeB, 0, 0);
 ippStatus = ippiCopyWrapBorder_32s_C1R((Ipp32s*)pDetailYDst, detailYStep, dstRoiSize, (Ipp32s*)pYB, StepB, roiInvSizeB, 0, 0);
 ippStatus = ippiCopyWrapBorder_32s_C1R((Ipp32s*)pDetailXYDst, detailXYStep, dstRoiSize, (Ipp32s*)pXYB, StepB, roiInvSizeB, 0, 0);
 //performs inverse  wavelet transform  
 ippStatus = ippiWTInv_32f_C1R(pAppB, StepB, pXB, StepB, pYB, StepB, pXYB, StepB, roiInvSize, pDst, stepDstInv, pSpecInv, pBufferInv);

// printf_32f_2D("After WTFinv ->\n pDstInv", pDst, roiSize, stepDstInv, ippStsNoErr);

 ippFree(pSpecFwd);
 ippFree(pSpecInv);
 ippFree(pBufferFwd);
 ippFree(pBufferInv);

 

Zone: 

Thread Topic: 

Question

Viewing all articles
Browse latest Browse all 1294

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>