Multistage Implementation Problem: There are cases in which the filter requirements call for a digital filter of high complexity, in terms of number of stages. Example: a signal has a bandwidth of 450Hz and it is sampled at 96kHz. We want to resample it at 1kHz: | X (F ) | Fx 96kHz Fy 1 kHz H ( z) 96 x ( n) y ( m) F (kHz) 045 . | H () | 045 . 050 . 0.9 96 96 01 . 96 48 F kHz Solution: for an FIR filter designed by the window method, the order of the filter is determined by the size of the transition region. With a Hamming Window the order is determined by the equation 8 01 . M 96 which yields M 960 8 7,680 Disdvantage: a lot of computations at a high freq. rate 7,680 96,000 0.74 109 multiplies / sec One Stage Implementation: we decimate in one shot. Fx Fy LPF x ( n) Fx D D y ( m) Multistage Implementation: we decimate the signal in several stages. Fy Fx F1 F2 x ( n) H1 D1 FL F3 H2 D2 HL D D1 D2 DL Fx D DL y ( m) See the last stage first: FL x L (n) y ( m) HL DL FL Fx Fy DL D H L ( ) p Fp Passband: 0 Fp DL Fy / 2 F Fy FL F Stopband: Fy / 2 FL / 2 , since D 2 F F 2D 2 L L L This filter clears everything above Fy / 2 . Problem: we can design the low pass filters that the spectrum X ( ) is bandlimited. Hi in a clever way, by taking into consideration xi [n] Fi Hi Di X i ( ) xi 1[m] Fi Fi 1 Di X i 1 () pass stop Fy aliased Fy Fi1 2 2 Di 2 Fi 1 Fy Fi 2 F 2 Fi1 2 F Problem: we can design the low pass filters that the spectrum X ( ) is bandlimited. Hi in a clever way, by taking into consideration xi 1 (m) xi ( n) Fi Hi Specs for • pass: • stop: H i ( ) : Fi Fi 1 Di Di Hi 0 Fp Fi 1 Fy 2 Fi 2 Fp Fi 1 Fy 2 Fi 2 F Example: same problem we saw before: Pass Band Stop Band Sampling Freq. Use Multistage. F1 96kHz F2 12kHz H1 x ( n) 8 [0, 450] Hz > 500 Hz 96 kHz F3 2 kHz H2 6 F4 1kHz H3 2 y ( m) 115 . 045 . 0.9 23 96 96 15 . 045 . 0.9 3 12 12 045 . 050 . 0.9 2 2 22.1 96 2.1 12 0.1 2 35 46 160 3.4 10 6 0.5 106 F kHz rad rad order M 0.3 106 mult./sec Efficient Multirate Implementation Goal: we want to determine an efficient implementation of a multirate system. For example in Decimation and Interpolation: s(n) x(n) H (z ) y (m) D you have to compute every D samples. s(m D) only, ie. one x(n) y (m) H (z ) I s (m) most of the values of s(mD) are zero Noble Identities: x(n) y (m) G( z D ) D x(n) y (m) g D (mD k ) x(k ) k y (m) G (z ) D y(m) g (m ) x(D) 0 if k D y(m) g D (mD D) x(D) g (m) g2 (n) 1 2 G( z ) n g 2 (2m) g (m) 1 G (z ) m For example take an FIR Filter x ( n) h(0) zD h(1) y ( m) D x ( n) y ( m) h(0) D z 1 zD z 1 h(2) since z D D D z 1 h(1) h(2) Similarly: x(n) y (m) G( z M ) M y (m) g M (m kM ) x(k ) k 0 if m M x(n) y (m) G (z ) M g ( k ) x(k ) if m M y(m) k otherwise 0 g M ( k )M x(k ) if m M y(m) otherwise 0 g (m) g2 (n) 1 G( z 2 ) n g 2 (2m) g (m) 1 G (z ) m x ( n) y ( m) h(0) M z M z M h(1) x ( n) h(0) z 1 h(1) z 1 h(2) h(2) since M z M z 1 M y ( m) M Application: POLYPHASE Filters x ( n) y ( m) H ( z) Decimator: take, for example, D=2 2 H ( z) h(n) z n h(2m) z 2 m z 1 h(2m 1) z 2 m n m m H ( z) He ( z 2 ) z 1 Ho ( z 2 ) even odd x ( n) Therefore this system becomes: He ( z 2 ) y ( m) z 1 Ho ( z 2 ) 2 x ( n) He ( z 2 ) 2 Filtering at High Sampling Rate z 1 2 Ho ( z ) 2 y ( m) Filtering at Low Sampling rate x ( n) 2 He ( z) z 1 2 Ho ( z) y ( m) Similarly: x ( n) y ( m) x ( n) 2 H ( z) 2 Ho ( z 2 ) z 1 2 He ( z ) x ( n) Ho ( z) Filtering at High Sampling Rate 2 z 1 He ( z) Filtering at Low Sampling Rate 2 y ( m) y ( m) Example: Consider the Filter/Decimator structure shown below, with s(n) x(n) y (m) H (z ) H ( z ) 1.2 0.6 z 1 1.5 z 2 2.0 z 3 4 z 4 2 2.0 z 5 1.5 z 6 0.6 z 7 1.2 z 8 He ( z2 ) This can be written as H ( z ) 1.2 1.5 z 2 4 z 4 1.5 z 6 1.2 z 8 0.6 2.0 z 2 . 0 z 0 . 6 z z 1 2 4 6 Ho ( z2 ) and implemented in Polyphase form: x ( n) 2 1.2 1.5z 1 4 z 2 1.5z 3 1.2 z 4 z 1 2 1 2 0.6 2.0 z 2 z 0.6 z 3 y ( m) General Polyphase Decomposition Given any integer N: H z h[n]z n n z H ( z) H0 z N 1 Nk z h[kN ]z 0 k N 1 ... z H1 z N H z ( N 1) N H N 1 z N Example: take N=3 H ( z) 2.1 .5z 1 .3z 2 4.2z 3 0.6z 4 1.4z 5 0.2z 6 0.7 z 7 H0 ( z 3 ) 2.1 4.2z 3 0.2z 6 H1 ( z 3 ) .5 0.6z 3 0.7 z 6 H 2 ( z 3 ) .3 1.4 z 3 Apply to Downsampling… H z x[n] y[m] N POLYPHASE H N 1 z N z 1 H2 zN z 1 H1 z N x[n] z 1 H0 zN y[m] N … apply Noble Identity N H N 1 z N H2 z N H1 z z 1 z 1 x[n] z 1 N H0 z y[m] Serial to Parallel (Buffer) N z 1 N x1[m] x[mN 1] N x0 [m] x[mN ] z 1 x[n] xN 1[m] x[(m 1) N 1] Serial to Parallel (Buffer): x[n] 1 2 3 4 5 S/P 6 N n N n0 xN 1[m] 1 3 5 2 4 6 x0[m] m0 Same for Upsampling… N x[n] H z y[m] POLYPHASE x[n] N H0 z N y[m] z 1 H1 z N H N 1 z N z 1 … apply Noble Identity x[n] H z N y[m] NOBLE IDENTITY x[n] H 0 z H1 z z 1 N H N 1 z y[m] N z 1 N Parallel to Serial (Unbuffer or Interlacer) N y0 [ n] N yN 1[n] y[ m ] z 1 This is a Parallel to Serial (an Unbuffer): 1 3 5 2 4 6 y0 [ n ] yN 1[n] n0 n 1 y[ m ] P/S N 1 m0 2 3 mN 4 5 6