Skip to Main Content Skip to Search
Accelerating the pace of engineering and science

 

Newsletters - MATLAB News & Notes

Wavelets in Real-Time Applications

The design of multirate DSP systems

by Don Orofino

Modern DSP and communications applications are beginning to employ wavelet techniques in critical algorithms, including data compression, adaptive equalizers, and transmultiplexers 1-4. The applications exploit important characteristics of wavelets, including multiresolution capabilities and perfect reconstruction. This article focuses on the practical aspects of building real-time, wavelet-based, multirate systems. Two methods for implementing multirate systems will be examined and applied to a real-time wavelet application in Simulink.

Wavelet filter banks are fundamentally multirate systems in that they consume and produce data signals with differing sample rates. An analysis filter bank reduces the rate of an input signal and produces multiple output signals with differing rates. A synthesis filter bank increases the rates of multiple input signals while combining them into a single output signal.

Sample-Based Implementation

The first and most familiar technique for implementing multirate DSP systems is to propagate scalar data samples with differing rates within a system model. Figure 1 shows a Simulink model containing analysis and synthesis filter banks implemented using this sample-based technique. The input signal is propagated from the source to the rest of the model one sample at a time. The colors in the model indicate the relative sample rates of the data. Note that many of the intervening blocks process multiple rates simultaneously.

For simulation in a single-rate environment, such as MATLAB, we would have to cope with processing signals of differing lengths due to the changes in sample rates; the data alignment would be carried out using appropriate indexing schemes. In a multirate time-flow environment, such as Simulink, the data is conceptually infinite in length, and the data alignment cannot be performed by indexing. Instead, delay elements are introduced after the analysis filter bank to achieve data alignment. This is accomplished by the "Delay Alignment" subsystem illustrated in Fig. 1. Also, to compare the output signal with the input, additional delays are introduced into the input signal path. Data alignment is a significant aspect of a practical, real-time implementation.

Color Rate Fig. 1: Simulink model for wavelet de-noising, employing multirate analysis and synthesis filter banks.
Red Fs
Green Fs/2
Magenta Fs/3
Cyan Fs/4
Yellow Hybrid

De-Noising Application

An important property of wavelet filter banks is perfect reconstruction. That is, if we connect the output of the analysis filter bank to the input of the synthesis filter bank and use the proper delays for alignment, then the output of the system is identical to the input. If we instead choose to modify the output of the analysis filter bank by applying a nonlinear threshold operation, the system performs "de-noising." The thresholding is carried out in Fig. 1 using a dead-zone transfer function that removes coefficients with values less than a specified level. The model outputs the original signal if the threshold is zero and removes smaller scale features (noise) from the input signal as the threshold is increased. The output may be subtracted from the input to generate a residual signal and is useful for determining the level of de-noising. The input, output, and residual signals produced by the de-noising model are shown in the scope display of Fig. 2.

Fig. 2: Simulation results from the wavelet de-noising model, using a noisy chirp signal as input. With appropriate thresholds selected, signal de-noising occurs.

Frame-Based Implementation

A second technique for implementing a multirate model employs frame-based processing, as shown in Fig. 3. In contrast to the sample-based implementation of Fig. 1, the signals now contain vector-valued data. Each vector represents a set of contiguous samples of the input data, spanning multiple time steps, and is called a data frame, or simply a frame. Frames are represented in the model by thick lines, and the frame sizes (vector lengths) are displayed on each line. The number of samples per frame is specified as a source block parameter; in this model, it is set to 64.


Fig. 3: Frame-based version of the wavelet de-noising model modified for real-time audio. The source produces 64 samples per frame. Note that the frame sizes change across the filter banks by factors of 2.

There are several other changes in Fig. 3 as well. In Fig. 1, all data lines are of equal width (scalars) with differing sample rates (denoted with multiple colors). In Fig. 3, the vector widths change by multiples of two across the filter banks. The reduction in sample rate reveals itself by a reduction in frame size. In addition, the model propagates these data frames at one (constant) rate! The simulation has only one frame rate throughout, yet effectively models a multirate system. As a result of the use of data frames, there is a larger total system delay encountered; the alignment of the input and output data requires additional delay for the frame-based model as compared to the sample-based model.

Thus in Fig. 3 we see the second form of a multirate system. Instead of a change in the rate at which a block consumes or produces data, there is a change in the width of the data frames propagated from block to block. Figs. 1 and 3 are conceptually identical models, processing the same data in the same order and producing the same results. However, the frame-based model propagates the data frames much less frequently than the rate at which the individual samples are propagated and processed in the model of Fig. 1. More data is propagated at each computational step of the frame-based model, and therefore fewer steps are required.

Real Benefits for Real-Time Systems

If we have not reduced the total number of processed samples, why is frame-based processing more efficient? There is a fixed amount of overhead associated with the propagation of data throughout a model, especially for data coming from an external source. The more frequent the need to propagate data, the larger the overhead. Thus, a system implementing frame-based processing can significantly outperform more traditional scalar implementations of the same algorithm.

Simulations also exhibit an efficiency boost for frame-based simulations. For example, the model in Fig. 1 was run in both sample-based and frame-based configurations within Simulink, using 50,000 data samples of data on a 166 MHz Pentium II computer. The frame-based model took 0.7 seconds to complete while the sample-based model took 5.9 seconds. Frame-based processing decreased the simulation time by more than a factor of 8.

Another practical benefit of a frame-based, multirate implementation is achieving required real-time performance. The model shown in Fig. 3 uses real-time audio drivers for Windows 95/98/NT. Running from within the Simulink environment, the frame-based model can achieve a sample rate of 44.1 kHz while the sample-based model could not maintain 8 kHz.

Multirate systems are becoming increasingly attractive for modern implementations of DSP and communications systems. Simulink and the DSP Blockset provide a powerful and easy-to-use environment for the rapid design, prototyping, and deployment of practical, real-time, multirate systems.

To learn more about the products used to design multirate systems, send for your free technical information kit. Simply visit our Web site at www.mathworks.com/products/inforeq.html and request your free data sheets.
Contact sales
Subscribe to newsletters