Rate This Document
Findability
Accuracy
Completeness
Readability

WT

Performs forward/inverse wavelet transform initialization, sets and gets the delay lines of the forward/inverse wavelet transform, and performs forward/inverse wavelet transform.

The function calling process is as follows:

  1. Call Init to initialize the wavelet transform state structure.
  2. Call the main function.
  3. Call Release to release the wavelet transform state structure.

The function interface is declared as follows:

  • Initialization:

    HmppResult HMPPS_WTFwdInit_32f(HmppsWTFwdState_32f** state, const float* tapsLow, int32_t lenLow, int32_t offsLow, const float* tapsHigh, int32_t lenHigh, int32_t offsHigh);

    HmppResult HMPPS_WTInvInit_32f (HmppsWTInvState_32f** state, const float* tapsLow, int32_t lenLow, int32_t offsLow, const float* tapsHigh, int32_t lenHigh, int32_t offsHigh);

  • Main function:

    HmppResult HMPPS_WTFwdSetDlyLine_32f(HmppsWTFwdState_32f* state, const float* dlyLow, const float* dlyHigh);

    HmppResult HMPPS_WTInvSetDlyLine_32f(HmppsWTInvState_32f* state, const float* dlyLow, const float* dlyHigh);

    HmppResult HMPPS_WTFwdGetDlyLine_32f (HmppsWTFwdState_32f* state, float* dlyLow, float* dlyHigh);

    HmppResult HMPPS_WTInvGetDlyLine_32f(HmppsWTInvState_32f* state, float* dlyLow, float* dlyHigh);

    HmppResult HMPPS_WTFwd_32f(const float* src, float* dstLow, float* dstHigh, int32_t dstLen, HmppsWTFwdState_32f* state);

    HmppResult HMPPS_WTInv_32f(const float* srcLow, const float* srcHigh, int32_t srcLen, float* dst, HmppsWTInvState_32f* state);

  • Memory release:

    void HMPPS_WTFwdRelease_32f(HmppsWTFwdState_32f *state);

    void HMPPS_WTInvRelease_32f(HmppsWTInvState_32f *state);

Parameters

Parameter

Description

Value Range

Input/Output

state

  • In the Init function: pointer to the pointer to the initialized forward wavelet transform state structure
  • In the main function: pointer to the state structure

Non-null pointer

Input/Output

tapsLow

Pointer to the tap vector of the low-pass filter

Non-null pointer

Input

lenLow

Number of taps in the low-pass filter

Positive integer

Input

offsLow

Input delay (offset) of the low-pass filter

≥ –1

Input

tapsHigh

Pointer to the tap vector of the high-pass filter

Non-null pointer

Input

lenHigh

Number of taps in the high-pass filter

Positive integer

Input

offsHigh

Input delay (offset) of the high-pass filter

≥ –1

Input

dlyLow

Pointer to the vector holding the delay lines for low-frequency components

Non-null pointer

Input

dlyHigh

Pointer to the vector holding the delay lines for high-frequency components

Non-null pointer

Input

src

Pointer to the vector holding the input signal for decomposition

Non-null pointer

Input

dstLow

Pointer to the vector holding output coarse low-frequency components

Non-null pointer

Input/Output

dstHigh

Pointer to the vector holding output detail high-frequency components

Non-null pointer

Input/Output

dstLen

Number of elements in the dstHigh and dstLow vectors

Positive integer

Input

srcLow

Pointer to the vector holding input coarse low-frequency components

Non-null pointer

Input

srcHigh

Pointer to the vector holding detail high-frequency components

Non-null pointer

Input

srcLen

Number of elements in the srcHigh and srcLow vectors

Positive integer

Input

dst

Pointer to the vector holding the output reconstructed signal

Non-null pointer

Input/Output

Return Value

  • Success: HMPP_STS_NO_ERR
  • Failure: An error code is returned.

Error Codes

Error Code

Description

HMPP_STS_SIZE_ERR

lenHigh or lenLow is less than or equal to 0, or dstLen or srcLen is less than or equal to 0.

HMPP_STS_WT_OFFSET_ERR

offsLow or offsHigh is less than –1.

HMPP_STS_NULL_PTR_ERR

Any of the specified pointers is null.

HMPP_STS_CONTEXT_MATCH_ERR

Any of the elements in the state structure is null or out of the value range.

HMPPS_WTFwd_32f Example

#include <stdio.h>
#include <stdint.h>
#include "hmpps.h"

#define LEN 12

int main()
{
    float src[LEN] = {1,2,3,4,5,6,7,8,9,10,11,12};
    float tapsLow[4] = {1,2,3,4};
    float tapsHigh[4] = {1,2,3,4};
    float dstLow[LEN/2];
    float dstHigh[LEN/2];
    int32_t offsetLow = -1;
    int32_t offsetHigh = -1;
    int32_t lenLow = 4;
    int32_t lenHigh = 4;
    HmppsWTFwdState_32f* state;
    HMPPS_WTFwdInit_32f(&state,tapsLow,lenLow,offsetLow,tapsHigh,lenHigh,offsetHigh);
    HMPPS_WTFwdSetDlyLine_32f(state,&src[0],&src[0]);
    HmppResult result = HMPPS_WTFwd_32f(src,dstLow,dstHigh,6,state);
    printf("result = %d\n",result);
    if (result != HMPP_STS_NO_ERR){
       return 0;
    }
    printf("dstLow =");
    for(int i = 0;i<LEN/2;i++){
       printf("%.2f",dstLow[i]);
    }
    printf("\n");
    for(int i = 0;i<LEN/2;i++){
       printf("%.2f",dstHigh[i]);
    }
    printf("\n");
    return 0;
}

Output:

result = 0
dstLow =14.00 20.00 40.00 60.00 80.00 100.00 
dstHigh = 14.00 20.00 40.00 60.00 80.00 100.00

HMPPS_WTInv_32f Example

#include <stdio.h>
#include <stdint.h>
#include "hmpps.h"

#define LEN 12

int main()
{
    float srcLow[LEN/2] = {80,20,40,60,80,100};
    float srcHigh[LEN/2] = {84,20,40,60,80,100};
    float tapsLow[4] = {1,2,3,4};
    float tapsHigh[4] = {1,2,3,4};
    float dst[LEN];
    int32_t offsetLow = 0;
    int32_t offsetHigh = 0;
    int32_t lenLow = 4;
    int32_t lenHigh = 4;
    HmppsWTInvState_32f* state;
    HMPPS_WTInvInit_32f(&state,tapsLow,lenLow,offsetLow,tapsHigh,lenHigh,offsetHigh);
    HMPPS_WTInvSetDlyLine_32f(state,srcLow,srcHigh);
    HmppResult result = HMPPS_WTInv_32f(srcLow,srcHigh,6,dst,state);
    printf("result = %d\n",result);
    if (result != HMPP_STS_NO_ERR){
       return 0;
    }
    printf("dst =");
    for(int i =0;i<LEN;i++){
       printf(" %.2f",dst[i]);
    }
    printf("\n");
}

Output:

result = 0
dst =656.00 984.00 532.00 736.00 200.00 320.00 360.00 560.00 520.00 800.00 680.00 1040.00