Subband Coding and Wavelets National Chiao Tung Universit Chun-Jen Tsai /4/4
Concept of Subband Coding In transform coding, we use N (or N N) samples as the data transform unit Transform coefficients are de-correlated data each describing different characteristics of the original data Different coefficients can be quantized differentl Unfortunatel, artificial selection of N causes blocking artifacts in the reconstructed image Lapped Orthogonal Transform could reduce such artifacts Ke question: can we design a transform that decomposes data without the artificial block size N? /4
Long-term vs. Short-term Behavior Given a sequence {x n }, it can be decomposed into two tpes of behaviors Long-term trend Short-term, sample-to-sample variation Long-term trend can be extracted b n x + x n n. Sample-to-sample variation can be extracted b z n x x n n xn n. 3/4
Example: Data Decomposition (/5) Let {x n }:, 4,,, 4, 8, 4,,, 8,, {x n x n }:, 4, 4,,, 6, 6,,,,, If we use an m-bit uniform quantizer to code {x n x n }: M m, /M, maximum error / 6/M If we compute n and z n, we have 4/4
Example: Data Decomposition (/5) { n } :,,,, 3,,, 3,,, 9, { n n }:,,,,,,,,,,, If we use an m-bit uniform quantizer to code { n n }: M m, 4/M, maximum error /M 5/4
Example: Data Decomposition (3/5) {z n } :,,,,, 3, 3,,,,, Differential coding of {z n } does not make sense If we use an m-bit uniform quantizer to code {z n }: 6/M, maximum QE 3/M If FLC is used to code the quantizer outputs, the rate of { n } plus {z n } is twice of the rate of {x n } On the other hand, the maximum quantization error is smaller (5/M vs. 6/M) We can reduce the rate b onl sending ever other values of n and z n. 6/4
Example: Data Decomposition (4/5) We can divide { n } into subsequences {, 3, } and {, 4, }; and {z n } into subsequences {z, z 3, } and {z, z 4, }. Note that n xn + xn xn xn, zn The sequence {x n } can be reconstructed b using either the even sequences, { n } and {z n }, or the odd sequences, { n } and {z n } as follows: n + zn xn n n n, z x.. 7/4
Example: Data Decomposition (5/5) B transmitting onl the even or odd sequences of { n } and {z n }, the rate is the same as that of {x n }. But do we still have smaller quantization error? Quantization error is onl affected b the dnamic range of the sequences The dnamic range of a subsequence will be smaller or equal to the original sequence 8/4
Remarks on Data Decomposition Decomposing the {x n } sequence into subsequences ma not result in an increase in rate The two subsequences had distinctl different characteristics, which should be encoded using different techniques If we had not split the {x n } sequence, same approach will be used to compress both subsequences It is possible to further decomposing subsequences into subsequences, and so on Data decomposition is also known as bank-filtering 9/4
Filters Filters are popular tool for data decomposition. A filter isolates certain frequenc components from others. Low-pass filters: Filters that onl let through components below a certain frequenc f. f is called the cut-off frequenc High-pass filters: Filters that block all frequenc components below a certain value f are called high-pass filters Band-pass filters: Filters that let through components that have frequenc content above some frequenc f but below frequenc f /4
Example: Low-Pass Filter A filter is defined b their magnitude transfer function: The ratio of the magnitude of the output and input of the filter as a function of frequenc Ideal low-pass filter Realistic low-pass filter /4
Sampling and Aliasing Nquist theorem for digitization of analog signals: If the highest frequenc component of a continuous-time signal is f, then we need to sample the signal at more than f times per second in order to full reconstruct the original signal from the samples Aliasing effect: if the sampling rate is less than f, frequenc component higher than f will not be distinguishable from low frequenc components: mag. freq. f f /4
Digital Filters Digital filtering involves taking a weighted sum of current and past inputs to the filter and, in some cases, the past outputs of the filter The general form of the input-output relationships of the filter is given b n N M a + ixn i i i b i n i, where the sequence {x n } is the input to the filter, the sequence { n } is the output from the filter, and the values {a i } and {b i } are called the filter coefficients 3/4
Example: Filter for Decomposition In previous example, {x n } is decomposed into { n } and {z n }. It is eas to show that the filter we use for extracting { n } and {z n } out of {x n } are as follows: Filter for { n } Filter for {z n } h n h n.5 n.5 n. otherwise.5 n.5 n. otherwise 4/4
Filter Terminolog If the input sequence is a single followed b all s, the output sequence is called the impulse response of the filter The number N is often called the number of taps in the filter If the b i are all, then the impulse response will die out after N samples. These filters are called finite impulse response (FIR) filters If an of the b i have nonzero values, the impulse response can, in theor, continue forever. Filters with nonzero values for some of the b i are called infinite impulse response (IIR) filters. 5/4
Example: A Simple Two-Tap Filter If a.5, a.5, all other a i and b i are zeros; x n is an impulse function: x n,, then the output n is n, n n ax + ax a x n + a x < or,.5 { n } is the impulse response (often denoted b {h n }).5 n >, 6/4
7/4 Example: An IIR Filter If a, b.9, all other a i and b i are zeros; x n is the impulse function, then the output n is Thus, the impulse response {h n } is. (.9).9.9.9.9.9.9 n n b x a b x a b x a + + + + + + L., (.9), < n n h n n
Convolution Operation If {x n } and { n } are the input and output, respectivel, of a filter with impulse response {h n } n M, then { n } can be obtained b the convolution of {x n } and {h n }: n M k h k x n k, where M is finite for an FIR filter and infinite for an IIR filter. 8/4
Stabilit of a Filter A filter is stable if an bounded inputs will produce bounded outputs Because FIR filters are simpl weighted averages, the are alwas stable For IIR filters, it is possible to have unbounded output even when the input is bounded Although IIR filters can become unstable, the can also provide better performance, in terms of sharper cutoffs and less ripple in the passband and stopband for a fewer number of coefficients 9/4
/4 Example: Unstable IIR Filter Consider a filter with a and b. Suppose the input is a single followed b s, the output is Even though the input contains a single, the output at time n 3 is 3!. n n b x a b x a b x a + + + + + + L
Filter Banks In multimedia compression, we often have to decompose input data into multiple subsequences (i.e. frequenc bands) We need more than two filters to do the JOB An arra of filters is often called a filter bank In practice, we can cascade multiple use of a pair of low-pass and high-pass filters to decompose data into multiple frequenc bands f 3 f f f f f f f 3 freq. /4
Example: An 8-Band Filter Bank s n s n s 3 n s 4 n x n s 5 n s 6 n s 7 n s 8 n /4
Design of a Pair of Low-High Filters For cascading implementation of filter banks, we need a pair of low-pass and high-pass filters The most popular filter pairs are the quadrature mirror filters (QMF), which were first proposed b Crosier, Esteban, and Galand in 976 These filters have the propert that if the impulse response of the low-pass filter is given b {h n }, then the high-pass impulse response is given b {( ) n h N n }, that is, h N n hn N, n,,...,. 3/4
Characteristics of Filters Johnston 8-tap QMF filter Smith-Barnwell 8-tap QMF filter 4/4
Basic Subband Coding Algorithm Block diagram of the subband coding sstem: Quantization is done differentl for each band, this is called the bit allocation problem; similarl, different entrop coding methods can be used for different bands 5/4
Analsis Filters The source output is passed through a bank of filters, called the analsis filter bank. The filters can be nonoverlapping or overlapping. 6/4
Downsampling and Upsampling Since each filter output has smaller bandwidth, we can discard some samples without losing information; this is called down-sampling or decimation For reconstruction, we perform upsampling 7/4
Non-Perfect Reconstruction Although theoreticall there is no data loss for subband decomposition, in realit, this is not trivial ideall + Input source spectrum (freq. domain representation) in realit Output of a two-band filter bank + V (e jω ) Causing alias if we downsample the data in this band b factor! 8/4
Applications of Subband Coding Most audio codecs toda uses subband coding Human ears can be modeled b a filter bank of 5 overlapping bands Some researchers tr to appl subband coding on images and videos, but not ver successful Ke issue: cascaded -D decomposition using separable -D filters is not ver meaningful LL HL LH 9/4 HH
Problems with Time-Freq. Analsis Given a non-stationar signal, it is difficult to tell which frequenc component happened at what time We can use short-term Fourier transform (STFT): * jωt F( ω, τ ) f ( t) g ( t τ ) e dt. Location of the frequenc analsis Window function that selects the signal segment for frequenc analsis while reducing boundar effects t t Ke question: how do we pick the window size of g(t)? 3/4
Concept of Wavelets Once the window function g(t) is fixed, the basis functions, g(t)e jmω t, m,,, of STFT are: A different ideas is to adapt the window size to the basis function such that it contains one ccle onl: Such basis functions are called wavelets 3/4
Wavelet Basis Functions We can start with a single basis function, called mother wavelet, then translate and scale this function to create other basis functions Scaling: f(t/a) is the scaling of f(t) b a constant a Translation: f(t b) is the translation of f(t) b a constant b Note that scaling will change the norm of a function: f t t ( ) f ( ) dt a f ( x) dx a f ( t). a a To have the same norm, we must multipl f(t/a) b a. 3/4
33/4 Example: Scaling Given the function scale it b.5:. ) cos( ) ( otherwise t t t f π. ) cos( ).5 ( otherwise t t t f π
Example: Translation Translate the function f(t/.5) to the right f t ( ).5 cos(π ( t )) 3 t. otherwise 34/4
Basis Function Generation Given a mother wavelet ψ(t), the remaining functions are obtained as ψ a, b ( t) t b ψ. a a Note that the frequenc domain representation of ψ(t) is Ψ a,b (ω) F [ψ a,b (t)], where F [ ] is the Fourier transform. If a and b are continuous, then ψ a,b (t) are the basis functions for continuous wavelet transform (CWT). 35/4
Wavelet Transforms Forward transform: the coefficient w.r.t. each wavelet basis function are: Inverse transform f(t) can be recovered from w a,b b where w, ψ, a b a b a, b ( t), f ( t) ψ ( t) f ( t) dt. dadb f ( t) wa, bψa, b( t), C a C Ψ Ψ ( ) Ψ ω d ω. ω 36/4
Selection of Mother Wavelet Note that C Ψ must be finite for the inverse transform to exist Ψ() The mother wavelet ψ(t) must have zero mean The wavelets bases should have finite energ as well, i.e., ω dω Ψ( ) <. Since Ψ(ω) onl has energ distributed in some frequenc band, it is effectivel a band-pass filter 37/4
Selection of a and b If the scaling and translating parameters a and b are discrete values, the must be set properl so that no input data are missed in the action Small a and large b causes gaps in the analsis process A popular approach is to select a and b according to a a m, b nb a m, where m and n are integers, a, b. That is, Ψ m m / m, n( t) a Ψ( a t nb ), m, n Z. 38/4
Example: Harr Wavelet The Harr wavelet is given b ψ( t) t <. t < B translating and scaling ψ(t), we can snthesize a variet of functions. Harr wavelet is effectivel a simple high-pass filter that analze the signal at various resolutions and locations 39/4
Subband Coding vs. Wavelet Trans. In subband coding, a signal is decomposed into different frequenc subbands for analsis The dimensions of time- and freq.-domain are the same In wavelet analsis, a signal can be decomposed into a (possibl) higher dimensional space for analsis Each subspace can represent different characteristics of the original signals (beond frequenc) 4/4