Skip to content
Rafat Hussain edited this page Jan 30, 2016 · 2 revisions

Wavelet Packet Transform Class ( wpt ) and Functions

wt Initialization

wpt_object wpt_init(wave,N,J);


// wave - Wavelet object created using wave_object
// N - Length of Signal/Time Series
// J - Decomposition Levels

Wavelet Packet Transform Execution

dwpt(wt, inp); // Discrete Wavelet Packet Transform

// obj - wpt object
// inp – Input signal/ Time series of length N


Inverse Wavelet Packet Transform Execution

idwpt(wt, dwtop); // Inverse Discrete Wavelet Packet Transform
// obj - wtree object
// dwtop – DWPT output


wt Object Parameters

wave_object wave; // wavelet object
int siglength;// Length of the original signal.
int outlength;// Length of the output DWT vector
int J; // Number of decomposition Levels
int MaxIter;// Maximum Iterations J <= MaxIter
char ext[10];// Type of Extension used - "per" or "sym". 
char entropy[20];// One of four values “shannon” (default), “threshold”, “norm” and “logenergy”. These values can be set using setDWPTEntropy().
int nodes; // number of nodes retained by the Best Basis Search algorithm
int *nodeindex;// Index of retained nodes. The length of this vector is 2 * wt->nodes. See the example below. wt->nodes = 3 , the nodeindex vector is [2,0,2,1,1,1] where {2,0},{2,1} and {1,1} are the nodes in the pruned tree. 
int *coeflength;// Size J+1 Vector containing lengths of Coefficients at each level. All coefficients at each level have the same length. The first value is the length of the signal (siglength). The last value is the length at the Jth level of decomposition.
double *output; // DWPT Output Vector of size outlength


DWPT Best Basis Search Algorithm

DWPT best basis search algorithm is an entropy based algorithm as described in Ripples in Mathematics: The Discrete Wavelet Transform by Jensen and la Cour-Harbo, Springer Verlag, 2001. The program accepts four entropy options – shannon, threshold, norm and logenergy. These values can be set using setDWPTEntropy function and the default value is “shannon”. This selected entropy is used to calculate the cost function associated with every node and a best basis is selected based on the cost function. Unlike wtree, the wpt object retains only the selected nodes and is a non-redundant transform suitable for compression and denoising applications.

wt Functions

setDWPTExtension(wtree_object wtree, char *extension);// Options "per" and "sym"
int getDWPTNodelength(wtree_object wt, int X);// Returns the length of the coefficients node at the level X of decomposition. 0 < X <= J. All coefficents at each level have the same length. 
void getDWPTCoeffs(wtree_object wt, int X, int Y, double *coeffs, int N);// The function return coefficents coeffs at the node {X,Y} of length N [obtained from getWTREElength(wt,X)] at level X.  0 < X <= J.  0 < Y < 2**J. Also {X,Y} needs to be one of the retained nodes.
void setDWPTEntropy(wpt_object wt, char *entropy, double eparam);//
wpt_summary(wtree_object wt);// Print summary
wpt_free(wtree_object object);// Frees wt object

The coefficient access is exactly the same way as explained in the wtree chapter.