Visible to Intel only — GUID: GUID-1AF5CBDF-2AE8-402A-B46D-185BEE2A5E5B
Visible to Intel only — GUID: GUID-1AF5CBDF-2AE8-402A-B46D-185BEE2A5E5B
WTInv
Performs one-level wavelet reconstruction of an image.
Syntax
IppStatus ippiWTInv_32f_C1R(const Ipp32f* pApproxSrc, int approxStep, const Ipp32f* pDetailXSrc, int detailXStep, const Ipp32f* pDetailYSrc, int detailYStep, const Ipp32f* pDetailXYSrc, int detailXYStep, IppiSize srcRoiSize, Ipp32f* pDst, int dstStep, const IppiWTInvSpec_32f_C1R* pSpec,Ipp8u* pBuffer);
IppStatus ippiWTInv_32f_C3R(const Ipp32f* pApproxSrc, int approxStep, const Ipp32f* pDetailXSrc, int detailXStep, const Ipp32f* pDetailYSrc, int detailYStep, const Ipp32f* pDetailXYSrc, int detailXYStep, IppiSize srcRoiSize, Ipp32f* pDst, int dstStep, const IppiWTInvSpec_32f_C3R* pSpec,Ipp8u* pBuffer);
Include Files
ippi.h
Domain Dependencies
Headers: ippcore.h, ippvm.h, ipps.h
Libraries: ippcore.lib, ippvm.lib, ipps.lib
Parameters
- pApproxSrc
- Pointer to ROI of the source approximation image.
- approxStep
- Distance, in bytes, between the starting points of consecutive lines in the approximation image buffer.
- pDetailXSrc
- Pointer to ROI of the source horizontal detail image.
- detailXStep
- Distance, in bytes, between the starting points of consecutive lines in the horizontal detail image buffer.
- pDetailYSrc
- Pointer to ROI of the source vertical detail image.
- detailYStep
- Distance, in bytes, between the starting points of consecutive lines in the vertical detail image buffer.
- pDetailXYSrc
- Pointer to ROI of the source diagonal detail image.
- detailXYStep
- Distance, in bytes, between the starting points of consecutive lines in the diagonal detail image buffer.
- srcRoiSize
- Size of ROI in pixels for all source images.
- pDst
- Pointer to the destination image ROI.
- dstStep
- Distance, in bytes, between the starting points of consecutive lines in the destination image buffer.
- pSpec
- Pointer to the allocated and initialized inverse DWT specification structure.
- pBuffer
- Pointer to the allocated buffer for intermediate operations.
Description
This function operates with ROI (see Regions of Interest in Intel IPP ). This function performs wavelet reconstruction of the output image pDst from the four component images. See Figure “Image Division into Blocks with Overlapping Borders” for the equivalent algorithm of ippiWTInv function operation. Wavelet parameters are contained in the inverse transform specification structure pSpec. Before using this function, compute the size of the structure and work buffer using the ippiWTInvGetSize function and initialize the structure using ippiWTInvInit.
Product and Performance Information |
---|
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex. Notice revision #20201201 |
The pointers pApproxSrc, pDetailXSrc, pDetailYSrc, and pDetailXYSrc point to ROIs of source images excluding borders. All source ROIs have the same size srcRoiSize, while the destination image size is uniquely determined from the following relations:
dstWidth = 2 * srcRoiSize.width; dstHeight = 2 * srcRoiSize.height;
As source ROIs do not include border pixels required to computations, the application program have to apply a border extension model (symmetrical, wraparound or another) to ROIs of all source images filling the neighboring memory locations. Note the border sizes may be different for different source images. The following C-language expressions can be used to calculate extended image border sizes:
int leftBorderLow = (lenLow - 1 - anchorLow) / 2; int leftBorderHigh = (lenHigh - 1 - anchorHigh) / 2; int rightBorderLow = (anchorLow + 1) / 2; int rightBorderHigh = (anchorHigh + 1) / 2; int apprLeftBorder = leftBorderLow; int apprRightBorder = rightBorderLow; int apprTopBorder = leftBorderLow; int apprBottomBorder = rightBorderLow; int detxLeftBorder = leftBorderLow; int detxRightBorder = rightBorderLow; int detxTopBorder = leftBorderHigh; int detxBottomBorder = rightBorderHigh; int detyLeftBorder = leftBorderHigh; int detyRightBorder = rightBorderHigh; int detyTopBorder = leftBorderLow; int detyBottomBorder = rightBorderLow; int detxyLeftBorder = leftBorderHigh; int detxyRightBorder = rightBorderHigh; int detxyTopBorder = leftBorderHigh; int detxyBottomBorder = rightBorderHigh;
See the description of the function ippiWTInvInit for the explanation of the used parameters.
The above relations show that left and top borders always have equal size only for approximation and diagonal detail images. Right and bottom borders also have equal size only for approximation and diagonal detail images. Thus, the size of memory block allocated for each source image must be extended to accommodate for added border pixels outside ROI.
Figure “Extended Horizontal Detail Source Image for Wavelet Reconstruction” shows ROI and extended image area for the horizontal detail source image.
Sizes of source images extended by border pixels can be calculated as follows:
apprWidthWithBorders = srcWidth + apprLeftBorder + apprRightBorder; apprHeightWithBorders = srcHeight + apprTopBorder + apprBottomBorder; detxWidthWithBorders = srcWidth + detxLeftBorder + detxRightBorder; detxHeightWithBorders = srcHeight + detxTopBorder + detxBottomBorder; detyWidthWithBorders = srcWidth + detyLeftBorder + detyRightBorder; detyHeightWithBorders = srcHeight + detyTopBorder + detyBottomBorder; detxyWidthWithBorders = srcWidth + detxyLeftBorder + detxyRightBorder; detxyHeightWithBorders = srcHeight + detxyTopBorder + detxyBottomBorder;
The ROI concept can be used to reconstruct large images by blocks or ‘tiles'.
To accomplish this, each the source images into blocks with overlapping borders, similar to what is considered in the description of the function ippiWTFwd. Each component must be subdivided into the same pattern of rectangular blocks.
Return Values
ippStsNoErr |
Indicates no error. Any other value indicates an error or a warning. |
ippStsNullPtrErr |
Indicates an error condition if any of the specified pointers is NULL. |
ippStsSizeErr |
Indicates an error condition if srcRoiSize has a field with zero or negative value. |
ippStsStepErr |
Indicates an error condition if step through any buffer is less than or equal to zero. |
ippStsContextMatchErr |
Indicates an error condition if a pointer to an invalid specification structure is passed. |
Example
The example below shows how to use the function ippiWTInv_32f_C1R.
void func_wavelet() { 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; Ipp32f pSrc[8*8] = { 0.0, 0.0, 0.0, 11.1, 11.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 11.1, 11.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 11.1, 11.1, 0.0, 0.0, 0.0, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 11.1, 0.0, 0.0, 0.0, 11.1, 11.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 11.1, 11.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 11.1, 11.1, 0.0, 0.0, 0.0}; Ipp32f pSrcB[9*9]; int srcStepB = 9*sizeof(Ipp32f); IppiSize roiSizeB = {9, 9}; int srcStep = 8*sizeof(Ipp32f); IppiSize roiSize = {8, 8}; Ipp32f pDetailXDst[4*4]; Ipp32f pDetailYDst[4*4]; Ipp32f pDetailXYDst[4*4]; Ipp32f pApproxDst[4*4]; IppiSize dstRoiSize = {4, 4}; int bufSizeFwd, bufSizeInv; Ipp8u* pBufferFwd; Ipp8u* pBufferInv; Ipp32f pDstInv[8*8]; Ipp32f pAppB[5*5]; Ipp32f pXB[5*5]; Ipp32f pYB[5*5]; Ipp32f pXYB[5*5]; int StepB = 5*sizeof(Ipp32f); IppiSize roiInvSize = {4, 4}; IppiSize roiInvSizeB = {5, 5}; int stepDstInv = 8*sizeof(Ipp32f); int approxStep, detailXStep, detailYStep, detailXYStep; approxStep = detailXStep = detailYStep = detailXYStep = 4*sizeof(Ipp32f); //adds border to the source image ippiCopyWrapBorder_32s_C1R((Ipp32s*)pSrc, srcStep, roiSize, (Ipp32s*)pSrcB, srcStepB, roiSizeB, 1, 1); //performs forward wavelet transform ippiWTFwdGetSize_32f(1, lenLow, anchorLow, lenHigh, anchorHigh, &specSizeFwd, &bufSizeFwd); pSpecFwd = (IppiWTFwdSpec_32f_C1R*)ippMalloc(specSizeFwd); pBufferFwd = (Ipp8u*)ippMalloc(bufSizeFwd); ippiWTFwdInit_32f_C1R( pSpecFwd, pTapsLow, lenLow, anchorLow, pTapsHigh, lenHigh, anchorHigh); ippiWTFwd_32f_C1R (pSrcB + roiSizeB.width + 1, srcStepB, pApproxDst, approxStep, pDetailXDst, detailXStep, pDetailYDst, detailYStep, pDetailXYDst, detailXYStep, dstRoiSize, pSpecFwd, pBufferFwd); printf_32f_2D("After WTFwd ->\n pApproxDst", pApproxDst, dstRoiSize, approxStep, ippStsNoErr); printf_32f_2D("pDetailXDst", pDetailXDst, dstRoiSize, detailXStep, ippStsNoErr); printf_32f_2D("pDetailYDst", pDetailYDst, dstRoiSize, detailYStep, ippStsNoErr); printf_32f_2D("pDetailXYDst", pDetailXYDst, dstRoiSize, detailXYStep, ippStsNoErr); //------------------------------------ ippiWTInvGetSize_32f(1, lenLow, anchorLow, lenHigh, anchorHigh, &specSizeInv, &bufSizeInv); pSpecInv = (IppiWTInvSpec_32f_C1R*)ippMalloc(specSizeInv); pBufferInv = (Ipp8u*)ippMalloc(bufSizeInv); ippiWTInvInit_32f_C1R(pSpecInv, pTapsLow, lenLow, anchorLow, pTapsHigh, lenHigh, anchorHigh); //adds border to four images obtained after ippiWTFwd ippiCopyWrapBorder_32s_C1R((Ipp32s*)pApproxDst, approxStep, dstRoiSize, (Ipp32s*)pAppB, StepB, roiInvSizeB, 0, 0); ippiCopyWrapBorder_32s_C1R((Ipp32s*)pDetailXDst, detailXStep, dstRoiSize, (Ipp32s*)pXB, StepB, roiInvSizeB, 0, 0); ippiCopyWrapBorder_32s_C1R((Ipp32s*)pDetailYDst, detailYStep, dstRoiSize, (Ipp32s*)pYB, StepB, roiInvSizeB, 0, 0); ippiCopyWrapBorder_32s_C1R((Ipp32s*)pDetailXYDst, detailXYStep, dstRoiSize, (Ipp32s*)pXYB, StepB, roiInvSizeB, 0, 0); //performs inverse wavelet transform ippiWTInv_32f_C1R( pAppB, StepB, pXB, StepB, pYB, StepB, pXYB, StepB, roiInvSize, pDstInv, stepDstInv, pSpecInv, pBufferInv); printf_32f_2D("After WTFinv ->\n pDstInv", pDstInv, roiSize, stepDstInv, ippStsNoErr); ippFree(pSpecFwd); ippFree(pSpecInv); ippFree(pBufferFwd); ippFree(pBufferInv); }
Result:
After WTFwd -> pApproxDst 0.0 2.8 8.3 0.0 2.8 4.9 9.0 2.8 8.3 9.0 10.4 8.3 0.0 2.8 8.3 0.0 pDetailXDst 0.0 1.0 3.1 0.0 8.3 7.3 5.2 8.3 -4.2 -2.1 2.1 -4.2 0.0 1.0 3.1 0.0 pDetailYDst 0.0 8.3 -4.2 0.0 1.0 7.3 -2.1 1.0 3.1 5.2 2.1 3.1 0.0 8.3 -4.2 0.0 pDetailXYDst 0.0 3.1 -1.6 0.0 3.1 0.0 4.7 3.1 -1.6 4.7 -4.7 -1.6 0.0 3.1 -1.6 0.0 After WTFinv -> pDstInv 0.0 2.8 -0.3 -0.6 2.1 1.1 0.0 0.0 2.8 5.9 2.7 4.9 3.4 5.4 2.8 5.1 -0.3 2.7 -0.6 -1.2 2.2 0.7 -0.3 -0.5 -0.6 4.9 -1.2 -2.2 3.9 1.2 -0.6 -1.0 2.1 3.4 2.2 3.9 1.8 3.7 2.1 3.8 1.1 5.4 0.7 1.2 3.7 3.2 1.1 1.9 0.0 2.8 -0.3 -0.6 2.1 1.1 0.0 0.0 0.0 5.1 -0.5 -1.0 3.8 1.9 0.0 0.0