MULTIRATE DIGITAL SIGNAL PROCESSING Signal processing can be enhanced by changing sampling rate: Up-sampling before D/A conversion in order to relax requirements of analog antialiasing filter. Cf. audio CD, where the sampling frequency 44.1 khz is increased fourfold to 176.4 khz. Need to connect systems in digital (audio) signal processing which operate at different sampling rates. Decomposition of a signal into M components corresponding to various frequency bands. If original signal is sampled at the sampling frequency f s (with frequency band of width 45
f s /2), the components then contain a frequency band of width 1 2 f s/m, and can be represented using the sampling rate f s /M. This allows for: - parallel signal processing with processors operating at lower sampling rates. - data compression in subband coding, by representing different frequency band components with different word lengths (e.g., in speech processing). - implementation of high-performance filtering operations with a very narrow transition band. Decomposing the signal into passband, stopband and transition band components, each component can be processed at a lower rate, and the transition band will be less narrow. This results in significant simpler filter complexity. 46
Basic multirate signal processing operations Sampling rate conversion Decimation x(n) M y(m) y(m) = x(mm) (every Mth element of x) Matlab routines: y=downsample(x,m) [ y=decimate(x,m) applies antialiasing lowpass filtering followed by downsampling ] 47
Spectrum of decimated signal: For example, for M = 2, - spectrum of {x(n)} consists of frequencies in [0, π], - spectrum of {y(m)} consists of frequencies in [0, π/2], given by Y (ω) = 1 2 (X(ω/2) + X(π ω/2) ) The second term is due to frequency folding, factor 1/2 is due to sampling rate conversion This implies that if x is bandlimited; X(ω) = 0, π/2 ω π, then Y (ω) = 1 2 X(ω/2) 48
Expansion x(n) L y(m) y(m) = { x(m/l), for m = 0, L, 2L,... 0, otherwise Expansion followed by interpolation is equivalent to sampling rate increase by factor L. Matlab routine: y=upsample(x,l) 49
Spectrum of expanded signal: For example, for M = 2, - spectrum of {x(n)} consists of frequencies in [0, π] - spectrum of {y(m)} consists of frequencies in [0, π], given by Y (ω) = { X(2ω), for 0 ω π/2 X(2(π ω)) [= Y (π ω) ], for π/2 ω π It is seen that Y (ω) is uniquely defined by its value in frequency band [0, π/2] Correct interpolation is achieved by a low-pass filter which eliminates the frequencies in the band π/2 ω π. 50
Sampling rate conversion by non-integer factors Sampling rate conversion with factor F = L/M performed by applying: can be - expansion by factor L - low-pass filtering (corresponding to interpolation) - decimation by factor M Matlab routine: y=resample(x,l,m) 51
Analysis and synthesis filter banks Simple Analysis filter bank: x H 1 (z) 2 x D1 H 2 (z) x D2 2 - H 1 (z): low-pass filter to extract subband [0, π/2] - H 2 (z): high-pass filter to extract subband [π/2, π] - subbands components can be processed using half the sampling rate 52
Analysis filter bank with three subbands: x H 1 (z) 2 x D1 H 2 (z) 2 x D2 H 1 (z) 2 x D21 H 2 (z) 2 x D22 - x D1 : subband component [0, π/2] - x D2 : subband component [π/2, π] - x D21 : subband component [π/2, 3π/4] - x D22 : subband component [3π/4, π] 53
Simple multirate signal processing system Analysis filter bank Synthesis filter bank x H 1 (z) 2 x D1 + 2 G 1(z) x E1 + y H 2 (z) x D2 2 2 G2 (z) x E2 - subband components x D1, x D2 are processed independently at lower sampling frequency - processed components are upsampled to original sampling frequency - synthesis filters G 1 (z), G 2 (z) remove alias components - filtered components are combined back to give the processed signal y 54
Subband decomposition Decomposition into low-frequency component and highfrequency component x H 1 (z) 2 x D1 H 2 (z) x D2 2 - H 1 (z): low-pass filter to extract subband [0, π/2] - H 2 (z): high-pass filter to extract subband [π/2, π] 55
Brickwall filters: - H 1 ideal low-pass filter - H 2 ideal high-pass filter Frequency response H 1 (e jω ) H 2 (e jω ) 0 π/2 π ω 56
Real filters: frequency bands cannot be exactly separated - H 1 real low-pass filter - H 2 real high-pass filter Frequency response H 1 (e jω ) H 2 (e jω ) 0 π/2 π ω 57
Solution: Construct H 1, H 2, G 1, G 2 so that perfect reconstruction is achieved (up to a constant and time delay): y(n) = Kx(n P ) Analysis filter bank Synthesis filter bank x x H 1 (z) 1 x 2 D1 2 H 2 (z) x 2 2 x D2 v 2 2 v 1 G1 (z) x E1+ y + G2 (z) x E2 58
Here: and {x D1 (n)} = {x 1 (0), x 1 (2), x 1 (4),...} {v 1 (n)} = {x D1 (0), 0, x D1 (1), 0, x D1 (2), 0,...} = {x 1 (0), 0, x 1 (2), 0, x 1 (4), 0,...} But as ˆx 1 (±z) = x 1 (0) ± x 1 (1)z 1 + x 1 (2)z 2 ± x 1 (3)z 3 + we have ˆv 1 (z) = v 1 (0) + v 1 (1)z 1 + v 1 (2)z 2 + v 1 (3)z 3 + = x 1 (0) + x 1 (2)z 2 + x 1 (3)z 4 + = 1 2 (ˆx 1(z) + ˆx 1 ( z)) Similarly: ˆv 2 (z) = 1 2 (ˆx 2(z) + ˆx 2 ( z)) 59
We have the relations ˆv 1 (z) = 1 ( ) H 1 (z)ˆx(z) + H 1 ( z)ˆx( z) 2 ˆv 2 (z) = 1 ( ) H 2 (z)ˆx(z) + H 2 ( z)ˆx( z) 2 and ŷ(z) = ˆx E1 (z) + ˆx E2 (z) = G 1 (z)ˆv 1 (z) + G 2 (z)ˆv 2 (z) = ŷ(z) = 1 ( ) G 1 (z)h 1 (z) + G 2 (z)h 2 (z) ˆx(z) 2 + 1 ( ) G 1 (z)h 1 ( z) + G 2 (z)h 2 ( z) ˆx( z) 2 60
Here ˆx( z) is an alias component (Fourier transform= ˆx( e jω ) = ˆx(e j(ω π) )) Alias avoided if: G 1 (z)h 1 ( z) + G 2 (z)h 2 ( z) = 0 = G 1 (z) = 2H 2 ( z) G 2 (z) = 2H 1 ( z) Scaling factor 2 introduced to compensate factor 1/2 in expression for ŷ(z) 61
Typically low- and high-pass filters H 1, H 2 are selected so that = H 2 (z) = H 1 ( z) H 2 (e jω ) = H 1 ( e jω ) = H 1 (e j(π ω) ) = Frequency responses are mirror images about the quadrature frequency π/2 = 2π/4 (quadrature mirror filters) It follows that G 1 (z) = 2H 2 ( z) = 2H 1 (z) G 2 (z) = 2H 1 ( z) = 2H 2 (z) 62
Introducing G 1, G 2 and H 2 (z) = H 1 ( z) into gives ŷ(z) = 1 ( ) G 1 (z)h 1 (z) + G 2 (z)h 2 (z) ˆx(z) 2 + 1 ( ) G 1 (z)h 1 ( z) + G 2 (z)h 2 ( z) ˆx( z) 2 ŷ(z) = ( H 1 (z) 2 H 1 ( z) 2) ˆx(z) = Condition for perfect signal recovery H 1 (z) 2 H 1 ( z) 2 = Kz P 63
Haar filters Only quadrature mirror FIR filters which satisfy perfect signal recovery: H 1 (z) = 1 2 H 2 (z) = 1 2 ( 1 + z 1 ), G 1 (z) = 1 + z 1 ( 1 z 1 ), G 2 (z) = 1 + z 1 giving ŷ(z) = z 1ˆx(z), or y(n) = x(n 1) Alternatively, when noncausal filters can be used, H 1 (z) = 1 2 (z + 1), G 1(z) = 1 + z 1 H 2 (z) = 1 2 (z 1), G 2(z) = 1 + z 1 giving ŷ(z) = ˆx(z), i.e., y(n) = x(n) 64
Subband coding and multiresolution analysis Pyramid algorithm: x x H 1 (z) L x H 1 (z) LL x H 1 (z) LLL 2 2 2 x H 2 (z) H x H 2 (z) LH x H 2 (z) LLH 2 2 2 - x: frequency band 0, π], length N - x H : frequency band [π/2, π], length N/2 - x LH : frequency band [π/4, π/2], length N/4 - x LLH : frequency band [π/8, π/4], length N/8 - x LLL frequency band [0, π/8], length N/8 65
Example (N = 8): Frequency π π/2 π/4 0 0 Time-frequency resolution N x H x LH x LLH x LLL Time Low-frequency components x LLL, x LLH resolution and low time resolution have high frequency High-frequency component x H and high time resolution has low frequency resolution 66
The pyramid algorithm generates a transform of input signal {x(n)} = {x(0), x(1),..., x(n 1)} to the signal transform (when using three stages as above) where x Haar = [x LLL, x LLH, x LH, x H ] x LLL = {x LLL (0),..., x LLL (N/8 1)} x LLH = {x LLH (0),..., x LLL (N/8 1)} x LH = {x LH (0),..., x LH (N/4 1)} x H = {x H (0),..., x H (N/2 1)} 67
Note: sequences x and x Haar have both length N Inverse transform: Use filters G 1, G 2 to reconstruct - x LL from x LLH and x LLL - x L from x LH and x LL - x from x H and x L 68
Signal compression using multiresolution Signal can be compressed by discarding small elements of x Haar : x Haar (m) = { xhaar (m), if x Haar (m) > d 0, if x Haar (m) d where d > 0 is a specified threshold. - Resolution in both time and frequency domain - Fourier transform gives only frequency domain resolution 69
EXAMPLE {x(n)} = {37, 35, 28, 28, 58, 18, 21, 15} {x Haar (m)} = {30, 2, 4, 10, 1, 0, 20, 3} 60 50 40 30 20 1 2 3 4 5 6 7 8 (a) 60 50 40 30 20 1 2 3 4 5 6 7 8 (b) 60 50 40 30 20 1 2 3 4 5 6 7 8 (c) (a): d = 2, (b): d = 3, (c): d = 4 70
Wavelets Haar wavelets Recall that the Fourier transform expresses a signal {x(n)} in terms of frequency components e j2πkn/n. In a similar way, the Haar transform x Haar can be expressed as an expansion of the signal x in terms of a function set. For the cases with three stages (resolution levels), we can show that x(n) = N/2 3 1 m=0 x LLL (m)ϕ H (2 3 n m) N/2 3 1 m=0 x LLH (m)ψ H (2 3 n m) N/2 2 1 m=0 x LH (m)ψ H (2 2 n m) N/2 1 m=0 x H (m)ψ H (2 1 n m) 71
Here: and ψ H (t) = ϕ H (t) = 1, 0 t < 1/2 1, 1/2 t < 1 0, otherwise { 1, 0 t < 1 0, otherwise - ψ H (2 i n) is defined for 0 n < 2 i (dilated, or stretched, version of ψ H (n)) - ψ H (2 i n m) is defined for m2 i n < (m + 1)2 i (dilated and translated version of ψ H (n)) 72
Examples (a): ψ H (t); (b): ψ H (2 2 t); (c): ψ H (2 2 t 1) 1 0 1 2 0 2 4 6 8 10 12 (a) 1 0 1 2 0 2 4 6 8 10 12 (b) 1 0 1 2 0 2 4 6 8 10 12 (c) 73
Expansion of x in terms of ϕ H (2 i n m) and ψ H (2 i n m) is a wavelet expansion. ϕ H (t) and ψ H (t): Haar wavelets 74
Generalization Discrete wavelet expansion of {x(n)} of length N and J resolution levels has the form x(n) = N/2 J 1 m=0 X DW T (0, m)ϕ(2 J n m)+ J i=1 N/2 i 1 m=0 X DW T (i, m)ψ(2 i n m) - ψ(2 i n) is defined for 0 n < 2 i (dilated, or stretched, version of ψ(n)) - ψ(2 i n m) is defined for m2 i n < (m + 1)2 i (dilated and translated version of ψ(n)) ϕ(t): father wavelet ψ(t): mother wavelet ψ(2 i n m): daughter wavelets 75
Daubechies wavelets Main restriction of Haar wavelets: Haar filter does not provide good separation of frequency bands. For more powerful wavelet transforms, we should require that: H 1 (z), H 2 (z) are FIR filters, which give good frequency separation H 1 (z), H 2 (z) give a filter bank which corresponds to a wavelet expansion for some wavelet functions ϕ(t) and ψ(t). filter bank should have the perfect reconstruction property 76
In 1988 Ingrid Daubechies found a class of filters satisfying the conditions: Instead of using quadrature mirror filters, H 1, H 2 should be related according to where M= order of H 1 (z) H 2 (z) = z M H 1 ( z 1 ) Elimination of alias components gives condition for synthesis filters G 1, G 2 : G 1 (z) = z M H 2 ( z) G 2 (z) = z M H 1 ( z) 77
Daubechies filters are defined only for odd values of M. Perfect reconstruction requirement gives condition: 1 ( ) G 1 (z)h 1 (z) + G 2 (z)h 2 (z) 2 = 1 Solution of order M = 2m 1, m = 1, 2,... is given by H 1 (z) = 2 ( ) m 1 + z S(z) 2 where S(z) should satisfy S(e jω ) 2 = m 1 k=0 ( ) m + k 1 k ( sin 2k ω ) 2 78
Case m = 1: Daubechies wavelet is equivalent to the Haar wavelet (scaled by factor 2) Case m = 2: S(z) = 1 3 2 + 3 + 1 z 2 and H 1 (z) = 2 { 1 3 8 + 3 3 8 z + 3 + 3 8 = 0.129409522551 + 0.224143868042z +0.836516303738z 2 + 0.482962913145z 3 z 2 + 1 + } 3 z 3 8 79
Efficient algorithms exist for calculating higher-order Daubechies wavelets, and coefficients have been tabulated. Daubechies wavelets form are an example of orthogonal wavelets, because the associated filters H 1, H 2, G 1, G 2 have a certain orthogonality property. Other orthogonal filter families are the symlets and the Coiflets. Another important type of wavelets are the biorthogonal wavelets, for which the associated filters satisfy a biorthogonality condition. An important family of biorthogonal wavelets are the CDF (Cohen-Daubechies-Feauveau) wavelets, which are used in the JPEG 2000 standard. 80
Wavelet transform of 2-dimensional signal {x(n, m)} - first perform 1-dimensional wavelet transform of each row to give X DWT,row (n, k) (=DWT of nth row of x(n, m)) - then perform 1-dimensional wavelet transform of each column to give the result X DWT (l, k) (=DWT of kth column of X DWT,row (n, k)) Application: image compression and denoising 81
Signal processing with wavelets Time-frequency resolution makes wavelets powerful for data denoising and compression. A standard approach is to use threshold-based methods: Hard thresholds: Given a wavelet transform X DWT (i, m), define: X DWT (i, m) = { XDWT (i, m), if X DWT (i, m) d(i) 0, if X DWT (i, m) < d(i) Threshold d(i) 0 may be different for different resolution levels i. Optimal value of d(i) which depend of signal variance and length have been presented in the literature. 82
Soft thresholds: Given a wavelet transform X DWT (i, m), define: X DWT (i, m) = sgn(x DWT (i, m)) X DWT (i, m) d(i) if X DWT (i, m) d(i), and X DWT (i, m) = 0, if X DWT (i, m) < d(i) Threshold d(i) 0 may be different for different resolution levels i. Optimal value of d(i) which depend of signal variance and length have been presented in the literature. 83
Hard and soft thresholds can be applied to both data compression and denoising. JPEG 2000 image compression standard uses biorthogonal CDF wavelets (cf. above) and quantization of the wavelet components to achieve data compression 84