**Name**

**owave1** Computes the orthogonal wavelet transform of an 1D signal

**Command Synopsis**

**owave1** [-r *RecursNum*] [-h *HaarLevel*] [-e *EdgeMode*] [-p *PrecondMode*] [-i] [-n *FilterNorm*] *Signal* *WavTrans* *ImpulseResponse* [*EdgeIR* ]

-rRecursNum: Number of levels (default 1)

-hHaarLevel: Continue decomposition with Haar until HaarLevel

-eEdgeMode: Edge processing mode (0/1/2/3, default 3)

-pPrecondMode: Edge preconditionning mode (0/1/2, default 0)

-i : Invertible transform

-nFilterNorm: Filter taps normalization. 0: no normalization, 1: sum equal to 1.0, 2: squares sum equal to 1.0 (default)

Signal: Input signal

WavTrans: Wavelet transform of Signal

ImpulseResponse: Impulse response of inner filters

EdgeIR: Impulse reponses of edge and preconditionning filters

**Function Summary**

void owave1 (NumRec , Haar , Edge , Precond , Inverse , FilterNorm , Signal , Output , Ri , Edge_Ri )

int *NumRec ;

int *Haar ;

int *Edge ;

int *Precond ;

int *Inverse ;

int *FilterNorm ;

Fsignal Signal ;

Wtrans1d Output ;

Fsignal Ri ;

Fimage Edge_Ri ;

**Description**

*owave1* computes the J level discrete wavelet transform of the univariate digitized signal whose sample values are in the file *Signal*, according to the pyramidal algorithm of S. Mallat [Mal89]. The reader is assumed to be familiar with the wavelet theory (if not, you may read [Mal97]).

Let
{*V*_{j}}_{j Z} be a multiresolution analysis of
*L*^{2}(*I**R*). {*V*_{j}} is a non-increasing sequence of closed subspaces of
*L*^{2}(*I**R*), and there exists a function , called the scaling function, such that
{ = 2^{-j/2}(2^{-j}. - *k*)}_{k Z} is an orthonormal basis of *V*_{j}. If *f* is a continuous-time signal then the orthogonal projection
*P*_{Vj}*f* of *f* on *V*_{j} is an approximation of *f* at the scale 2^{j}. One has

Let *W*_{j} be the orthonormal complement of *V*_{j} in *V*_{j-1}, and the mother wavelet associated to {*V*_{j}}. Then
{ = 2^{-j/2}(2^{-j}. - *k*)}_{k Z} is an orthonormal basis of *W*_{j}. The orthonormal projection
*P*_{Wj}*f* of *f* on *W*_{j} represents the difference of information between scales 2^{j-1} and 2^{j} that is, the detail at the scale 2^{j}. One has

Consider now the function *f* in *V*_{0} defined by

Since
*V*_{0} = *W*_{1} *W*_{2} ^{ ... } *W*_{J} *V*_{J} for any positive integer *J*, one also has

*owave1* performs the wavelet decomposition of *f* up to the level *J*, i.e. computes the coefficients of the detail sub-signals
(*D*_{j}[*k*])_{k Z}, 1 *j* *J* and of the average sub-signal
(*A*_{J}[*k*])_{k Z}. This is done recursively : the sequence *A*_{1}[*k*] and *D*_{1}[*k*] are computed from the sequence *A*_{0}[*k*] , the sequences *A*_{2}[*k*] and *D*_{2}[*k*] are computed from *A*_{1}[*k*] , a.s.o.. The same algorithm is applied at each step. This algorithm is very simple due to the two-scales relationships :

(t) = h_{k}(2t - k) |
|||

(t) = g_{k}(2t - k) |

where

A_{j+1}[n] = h_{k-2n}A_{j}[k] |
|||

D_{j+1}[n] = g_{k-2n}A_{j}[k] |

If the filter (

Notice that the filters that are associated to compactly supported wavelets are of finite length : *h*_{k} = 0, if | *k*| > *K* where *K* is a positive integer.
See [Dau88] for the construction and properties of these filters.

The fact that the discrete signal is of finite size raises some problems near edges, i.e. when computing the first and last coefficients of the average and detail sub-signals. There are several ways of dealing with these problems.

- One can extend the signal with 0-valued samples.
- One can also reflect the signal around each edge.
- One can periodize the signal.
- Finally one can use special filters to compute the coefficients near edges. This corresponds to wavelet basis adapted to the interval which have been constructed by A. Cohen, I. Daubechies, and P. Vial [CDV93].
They have been derived from the orthonormal bases of compactly supported wavelets on
*I**R*constructed by I. Daubechies in [Dau88].

Because of the down-sampling, the size of the average and detail signals is divided by two at each step (omitting edge problems). As a consequence the size of the wavelet decomposition (obtained by adding the sizes of each sub-signal in it) is equal to the size of the original signal, and the scale parameter *J* is upper bounded since obviously one should have
*n* 2^{J} where *n* is the size of the signal. Moreover, when edge processing is performed via periodization or application of special filters, the size of the signal should be a multiple of 2^{J}.

If one chooses the 0-extension or the reflexion for edge processing, and one wants to get the exact reconstruction property, then one has to keep extra coefficients near edges. Thus the size of the wavelet decomposition is in fact slightly larger than the size of the original signal. To overcome this problem one can use one of the two other methods of edge processing.

When the edge processing is done with special filters, then one has the possibility to do a preconditionning of the coefficients near edges before applying the wavelet decomposition. Then one recovers the cancellation property (any polynomial signal of degree less than the cancellation degree of the mother wavelet is decomposed in a zero valued detail sub-signal and a polynomial average sub-signal). This is an inversible linear (but not orthogonal in general) transform.

If the impulse response has size *N* then the complexity of the algorithm is roughly
(2 - 2^{-(J-1)})*nN* multiplications and additions.

The resulting sub-signals
*A*_{1}, *A*_{2},..., *A*_{J} and
*D*_{1}, *D*_{2},..., *D*_{J} are stored in files having all the same prefix *Wavtrans*. The name of the file is *prefix_ j_A.wtrans1d* for

The coefficients *h*_{k} of the filter's impulse response are stored in the file *ImpulseResponse*. The coefficients of the filter's impulse response for computing the edge coefficients are stored in the file *EdgeIR*. Notice that the underlying Daubechies wavelet basis must be the same for edge and inner filter.

- The -r option specifies the number of levels
*J*in the decomposition. - The -e option specifies the edge processing mode.
- 0 : 0 extension.
- 1 : periodization.
- 2 : reflexion.
- 3 : Adapted filtering (default).

- The -p option specifies the preconditionning mode.
- 0 : no preconditionning (default).
- 1 : preconditionning of the signal.
- 2 : preconditionning of the signal and inverse preconditionning of the average at level
*J*.

- The -i option enables to have invertible transform. Since the transform is invertible when EdgeMode is equal to 1 or 3, this only makes sense when EdgeMode is equal to 0 or 2.
- The -n option specifies the normalisation mode of the filter impulse responses' coefficients. If selected the coefficients
*h*_{k}are multiplied by a constant so that their sum is 1.0. If -n is not selected the coefficients are normalized so that the decomposition is orthogonal.

**See Also**

**Version 1.2**

Last Modification date : Thu Jan 31 15:11:32 2002

**Author**

Jean-Pierre D'Ales