Lecture 8B Upsampling Arbitrary Resampling
Total Page:16
File Type:pdf, Size:1020Kb
EE123 Digital Signal Processing Lecture 8B Upsampling Arbitrary Resampling M. Lustig, EECS UC Berkeley Changing Sampling-rate via D.T Processing j! 1 j(w/M 2⇡i/M) X (e )= X e − d M i=0 X ⇣ ⌘ X ⇡ ⇡ − M=2 Xd ... ⇡ ⇡ − Scale by M=2 Shift by (i=1)*2π/(M=2) M. Lustig, EECS UC Berkeley Changing Sampling-rate via D.T Processing j! 1 j(w/M 2⇡i/M) X (e )= X e − d M i=0 X ⇣ ⌘ X ⇡ ⇡ − M=3 Xd ⇡ ⇡ − Scale by M=3 Shift by (i=1)*2π/(M=3) Shift by (i=2)*2π/(M=3) M. Lustig, EECS UC Berkeley Changing Sampling-rate via D.T Processing j! 1 j(w/M 2⇡i/M) X (e )= X e − d M i=0 X ⇣ ⌘ X ⇡ ⇡ − M=3 Xd ... ⇡ ⇡ − M. Lustig, EECS UC Berkeley Anti-Aliasing LPF x[n] ↓M ⇡/M x˜[n] x˜d[n] =˜x[nM] X ⇡ ⇡ − M=3 Xd ⇡ ⇡ − M. Lustig, EECS UC Berkeley UpSampling • Much like D/C converter • Upsample by A LOT ⇒ almost continuous • Intuition: – Recall our D/C model: x[n] ⇒ xs(t)⇒xc(t) – Approximate “xs(t)” by placing zeros between samples – Convolve with a sinc to obtain “xc(t)” M. Lustig, EECS UC Berkeley Up-sampling x[n]=xc(nT ) T xi[n]=xc(nT 0) where T 0 = L integer L Obtain xi[n] from x[n] in two steps: x[n/L] n =0, L, 2L, (1) Generate: x = e 0 otherwise± ± ··· ⇢ x[n] xe[n] M. Lustig, EECS UC Berkeley Up-Sampling (2) Obtain xi[n] from xe[n] by bandlimited interpolation: n xe[0] sinc xe[n] · L ⇣ ⌘ ... ... n n x = x [n] sinc i e ⇤ L ⇣ ⌘ xi[n] ... ... n M. Lustig, EECS UC Berkeley Up-Sampling x [n]=x [n] sinc(n/L) i e ⇤ 1 x [n]= x[k]δ[n kL] e − k= X1 1 n kL x [n]= x[k]sinc( − ) i L k= X1 M. Lustig, EECS UC Berkeley Frequency Domain Interpretation xe[n] LPF x[n] ↑L gain=L xi[n] ⇡/L L ⇒ sinc(n/L) DTFT ⇡ ⇡ −L L M. Lustig, EECS UC Berkeley Frequency Domain Interpretation xe[n] LPF x[n] ↑L gain=L x [n] ⇡/L i j! 1 j!n Xe(e )= xe[n] e− kn= X1 ≠ 0 only for n=mL (integer m) 1 | {z } j!mL = xe[mL] e− = X(ej!L) m= X1 =x[m] Compress DTFT by a factor| {z of L!} M. Lustig, EECS UC Berkeley Example: Xc(j⌦) 1 ⌦N ⌦ sampling T sampling T’=T/L j! j! X(e ) Xi(e ) ⇡ ⇡ ⇡ ⇡ − expanding L − j! Xe(e ) ⇡ ⇡ − M. Lustig, EECS UC Berkeley Example: Xc(j⌦) 1 ⌦N ⌦ sampling T sampling T’=T/L j! j! X(e ) Xi(e ) 1/T ··· ··· ⇡ ⇡ ⇡ ⇡ − expanding L − j! Xe(e ) ⇡ ⇡ − M. Lustig, EECS UC Berkeley Example: Xc(j⌦) 1 ⌦N ⌦ sampling T sampling T’=T/L j! j! X(e ) Xi(e ) L/T 1/T ··· ··· ··· ··· ⇡ ⇡ ⇡ ⇡ ⇡ − expanding L − L j! Xe(e ) ⇡ ⇡ − M. Lustig, EECS UC Berkeley Example: Xc(j⌦) 1 ⌦N ⌦ sampling T sampling T’=T/L j! j! X(e ) Xi(e ) L/T 1/T ··· ··· ··· ··· ⇡ ⇡ ⇡ ⇡ ⇡ − expanding L − L j! Xe(e ) 1/T ··· ··· ⇡ ⇡ ⇡ − L M. Lustig, EECS UC Berkeley Example: Xc(j⌦) 1 ⌦N ⌦ sampling T sampling T’=T/L j! j! X(e ) Xi(e ) L/T 1/T ··· ··· ··· ··· ⇡ ⇡ ⇡ ⇡ ⇡ − expanding L − L j! Xe(e ) L 1/T ⇡ ⇡ ··· ··· −L L ⇡ ⇡ ⇡ − L M. Lustig, EECS UC Berkeley Practical Upsampling • Can interpolate with simple, practical filters. What’s happening? • Example: L=3, linear interpolation - convolve with triangle x[n] ··· periodic n 2 ideal sinc 1/T ··· ··· ⇡ ⇡ ⇡ − M.3 Lustig, EECS UC Berkeley Resampling by non-integer • T’ = TM/L (upsample L, downsample M) LPF LPF x[n] ↑L gain=L ↓M ⇡/L ⇡/M Or, gain L LPF x[n] ↑L ↓M min{ ⇡ /L ,⇡ /M } • What would happen if change order? M. Lustig, EECS UC Berkeley Example: • L = 2, M=3, T’=3/2T (fig 4.30) Xc(j⌦) 1 ⌦N ⌦ sampling T X(ej!) Subsampling M=3 ⇡ ⇡ ⇡ ⇡ − − expanding L=2 LP filtering j! X˜ = H X Xe(e ) i d e ⇡ ⇡ ⇡ ⇡ − − M. Lustig, EECS UC Berkeley Example: • L = 2, M=3, T’=3/2T (fig 4.30) Xc(j⌦) 1 ⌦N ⌦ sampling T j! Subsampling M=3 X(e ) 1/T 2/(3T) ⇡ ⇡ ⇡ ⇡ − − expanding L=2 LP filtering j! 2/T Xe(e ) ˜ 1/T Xi = HdXe ⇡ ⇡ ⇡ ⇡ − − M. Lustig, EECS UC Berkeley Multi-Rate Signal Processing • What if we want to resample by 1.01T? – Expand by L=100 – Filter π/101 ($$$$$) – Downsample by M=101 • Fortunately there are ways around it! – Called multi-rate – Uses compressors, expanders and filtering M. Lustig, EECS UC Berkeley.