WTHaarFwd, WTHaarInv

Performs forward or inverse single-level discrete wavelet Haar transforms.

Syntax

Case 1: Forward transform

IppStatus ippsWTHaarFwd_8s(const Ipp8s* pSrc, int lenSrc, Ipp8s* pDstLow, Ipp8s* pDstHigh);

IppStatus ippsWTHaarFwd_16s(const Ipp16s* pSrc, int lenSrc, Ipp16s* pDstLow, Ipp16s* pDstHigh);

IppStatus ippsWTHaarFwd_32s(const Ipp32s* pSrc, int lenSrc, Ipp32s* pDstLow, Ipp32s* pDstHigh);

IppStatus ippsWTHaarFwd_64s(const Ipp64s* pSrc, int lenSrc, Ipp64s* pDstLow, Ipp64s* pDstHigh);

IppStatus ippsWTHaarFwd_32f(const Ipp32f* pSrc, int lenSrc, Ipp32f* pDstLow, Ipp32f* pDstHigh);

IppStatus ippsWTHaarFwd_64f(const Ipp64f* pSrc, int lenSrc, Ipp64f* pDstLow, Ipp64f* pDstHigh);

IppStatus ippsWTHaarFwd_8s_Sfs(const Ipp8s* pSrc, int lenSrc, Ipp8s* pDstLow, Ipp8s* pDstHigh, int scaleFactor);

IppStatus ippsWTHaarFwd_16s_Sfs(const Ipp16s* pSrc, int lenSrc, Ipp16s* pDstLow, Ipp16s* pDstHigh, int scaleFactor);

IppStatus ippsWTHaarFwd_32s_Sfs(const Ipp32s* pSrc, int lenSrc, Ipp32s* pDstLow, Ipp32s* pDstHigh, int scaleFactor);

IppStatus ippsWTHaarFwd_64s_Sfs(const Ipp64s* pSrc, int lenSrc, Ipp64s* pDstLow, Ipp64s* pDstHigh, int scaleFactor);

Case 2: Inverse transform

IppStatus ippsWTHaarInv_8s(const Ipp8s* pSrcLow, const Ipp8s* pSrcHigh, Ipp8s* pDst, int lenDst);

IppStatus ippsWTHaarInv_16s(const Ipp16s* pSrcLow, const Ipp16s* pSrcHigh, Ipp16s* pDst, int lenDst);

IppStatus ippsWTHaarInv_32s(const Ipp32s* pSrcLow, const Ipp32s* pSrcHigh, Ipp32s* pDst, int lenDst);

IppStatus ippsWTHaarInv_64s(const Ipp64s* pSrcLow, const Ipp64s* pSrcHigh, Ipp64s* pDst, int lenDst);

IppStatus ippsWTHaarInv_32f(const Ipp32f* pSrcLow, const Ipp32f* pSrcHigh, Ipp32f* pDst, int lenDst);

IppStatus ippsWTHaarInv_64f(const Ipp64f* pSrcLow, const Ipp64f* pSrcHigh, Ipp64f* pDst, int lenDst);

IppStatus ippsWTHaarInv_8s_Sfs(const Ipp8s* pSrcLow, const Ipp8s* pSrcHigh, Ipp8s* pDst, int lenDst, int scaleFactor);

IppStatus ippsWTHaarInv_16s_Sfs(const Ipp16s* pSrcLow, const Ipp16s* pSrcHigh, Ipp16s* pDst, int lenDst, int scaleFactor);

IppStatus ippsWTHaarInv_32s_Sfs(const Ipp32s* pSrcLow, const Ipp32s* pSrcHigh, Ipp32s* pDst, int lenDst, int scaleFactor);

IppStatus ippsWTHaarInv_64s_Sfs(const Ipp64s* pSrcLow, const Ipp64s* pSrcHigh, Ipp64s* pDst, int lenDst, int scaleFactor);

Parameters

pSrc

Pointer to the source vector for forward transform.

lenSrc

Number of elements in the source vector pSrc.

pDstLow

Pointer to the array with the coarse “low frequency” components of the output for forward transform.

pDstHigh

Pointer to the array with the detail “high frequency” components of the output for forward transform.

pSrcLow

Pointer to the array with the coarse “low frequency” components of the input for inverse transform.

pSrcHigh

Pointer to the array with the detail “high frequency” components of the input for inverse transform.

pDst

Pointer to the array with the output signal for inverse transform.

lenDst

Number of elements in the destination vector pDst

scaleFactor

Scale factor, refer to Integer Scaling.

Description

The functions ippsWTHaarFwd and ippsWTHaarInv are declared in the ipps.h file. These functions perform forward and inverse single-level discrete Haar transforms. These transforms are orthogonal and reconstruct the original signal perfectly.

The forward transform can be considered as wavelet signal decomposition with lowpass decimation filter coefficients {1/2, 1/2} and highpass decimation filter coefficients {1/2, -1/2}.

The inverse transform is represented as wavelet signal reconstruction with lowpass interpolation filter coefficients {1, 1} and highpass interpolation filter coefficients {-1, 1}.

The decomposition filter coefficients are frequency response normalized to provide the same value range for both input and output signals. Thus, the amplitude of the low pass filter frequency response is 1 for zero-valued frequency, and the amplitude of the high pass filter frequency response is also 1 for the frequency value near to 0.5.

As the absolute values of the interpolation filter coefficients are equal to 1, the reconstruction of the signal requires few operations. It is well suited for usage in data compression applications. As the decomposition filter coefficients are powers of 2, the integer functions perform lossless decomposition with the scaleFactor value equal to -1. To avoid saturation, use higher-precision data types.

Note that the filter coefficients can be power spectral response normalized, see [Strang96] for more information. Thus, the decomposition filter coefficients are {2-1/2, 2-1/2} and {2-1/2, -2-1/2}; accordingly; the reconstruction filter coefficients are {2-1/2, 2-1/2} and {-2-1/2, 2-1/2}.

In the following definition of the forward single-level discrete Haar transform, N = lenSrc. The coarse “low-frequency” component c(k) is pDstLow[k] and the detail “high-frequency” component d(k) is pDstHigh[k]; also x(2k) and x(2k+1) are even and odd values of the input signal pSrc, respectively.

c(k) = (x (2k) + x(2k+1 ))/2

d(k) = (x(2k+1) - x(2k))/2

In the inverse direction, N= lenDst. The coarse “low-frequency” component c(k) is pSrcLow[k] and the detail “high-frequency” component d(k) is pSrcHigh[k]; also y(2i) and y(2i+1) are even and odd values of the output signal pDst, respectively.

y(2i) = c(i) - d(i)

y(2i+1) = c(i) + d(i)

For even length N, 0 ≤ k < N/2 and 0 ≤ i < N/2. Also, “low-frequency” and “high-frequency” components are of size N/2 for both original and reconstructed signals. The total length of components is equal to the signal length N.

In case of odd length N, the vector is considered as a vector of the extended length N+1 whose two last elements are equal to each other x[N] = x[N - 1]. The last elements of the coarse and detail components of the decomposed signal are defined as follows:

c((N+1 )/2 - 1) = x(N - 1)

d((N + 1)/2 - 1) = 0

Correspondingly, the last element of the reconstructed signal is defined as:

y(N) = y(N - 1) = c((N+ 1)/2 - 1)

For odd length N, 0 ≤ k < N - 1)/2 and 0 ≤ i < N - 1)/2 , assuming that c((N+ 1)/2 - 1) = x(N - 1) and y(N - 1) = c((N + 1)/2 - 1). The “low-frequency” component is of size (N + 1)/2. The “high-frequency” component is of size (N - 1)/2, because the last element d((N + 1)/2 - 1) is always equal to 0. The total length of components is also N.

Such an approach applies continuation of boundaries for filters having the symmetry properties, see [Bris94].

When performing block mode transforms, take into consideration that for decomposition and reconstruction of even-length signals no extrapolations at the boundaries is used. In case of odd-length signals, a symmetric continuation of the signal boundary with the last point replica is applied.

When it is necessary to have a continuous set of output blocks, all the input blocks are to be of even length, besides the last one (which can be either of odd or even length). Thus, if the whole amount of elements is odd, only the last block can be of odd length.

ippsWTHaarFwd. Thise function performs the forward single-level discrete Haar transform of a lenSrc-length signal pSrc and stores the decomposed coarse “low-frequency” components in pDstLow, and the detail “high-frequency” components in pDstHigh.

ippsWTHaarInv. This function performs the inverse single-level discrete Haar transform of the coarse “low-frequency” components pSrcLow and detail “high-frequency” components pSrcHigh, and stores the reconstructed signal in the lenDst-length vector pDst.

For more information on wavelet transforms see [Strang96] and [Bris94].

Example below illustrates the use of the function ippsWTHaarFwd_32f.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when the pDst or pSrc pointer is NULL.

ippStsSizeErr

Indicates an error when len is less than 4 for the function ippsWinBlackmanOpt and less than 3 for all other functions of the family.

Using the ippsWTHaarFwd Function

IppStatus wthaar(void) {
      Ipp32f x[8], lo[4], hi[4];
      IppStatus status;
      ippsSet_32f(7, x, 8);  --x[4];
      status = ippsWTHaarFwd_32f(x, 8, lo, hi);
      printf_32f(“WT Haar low  =”, lo, 4, status);
      printf_32f(“WT Haar high =”, hi, 4, status);
      return status;
}
Output:
    WT Haar low  =  7.000000 7.000000 6.500000 7.000000
    WT Haar high =  0.000000 0.000000 0.500000 0.000000

	

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.