Lecture 8B Upsampling Arbitrary Resampling

Post on 26-Feb-2023

0 views 0 download

Transcript of Lecture 8B Upsampling Arbitrary Resampling

M. Lustig, EECS UC Berkeley

EE123Digital Signal Processing

Lecture 8BUpsampling

Arbitrary Resampling

Xd(ej!) =

1

M

X

i=0

X⇣ej(w/M�2⇡i/M)

⇡�⇡

Xd

X

M. Lustig, EECS UC Berkeley

Changing Sampling-rate via D.T Processing

⇡�⇡

M=2

Scale by M=2Shift by (i=1)*2π/(M=2)

...

Xd(ej!) =

1

M

X

i=0

X⇣ej(w/M�2⇡i/M)

⇡�⇡

Xd

X

M. Lustig, EECS UC Berkeley

Changing Sampling-rate via D.T Processing

⇡�⇡

M=3

Shift by (i=1)*2π/(M=3)Scale by M=3

Shift by (i=2)*2π/(M=3)

Xd(ej!) =

1

M

X

i=0

X⇣ej(w/M�2⇡i/M)

⇡�⇡

Xd

X

M. Lustig, EECS UC Berkeley

Changing Sampling-rate via D.T Processing

⇡�⇡

M=3

...

⇡/Mx[n]x̃[n] x̃d[n] = x̃[nM ]

M. Lustig, EECS UC Berkeley

Anti-Aliasing

LPF↓M

⇡�⇡

Xd

X

⇡�⇡

M=3

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)”

T 0 =T

LL

xe =

⇢x[n/L] n = 0, ± L, ± 2L, · · ·0 otherwise

M. Lustig, EECS UC Berkeley

Up-sampling

where integer

Obtain xi[n] from x[n] in two steps:

(1) Generate:

x[n] xe[n]

x[n] = xc(nT )

xi[n] = xc(nT0)

xe[0] · sinc⇣n

L

M. Lustig, EECS UC Berkeley

Up-Sampling

(2) Obtain xi[n] from xe[n] by bandlimited interpolation:

nxi = xe[n] ⇤ sinc

⇣n

L

xe[n]

n

xi[n]

...

......

...

xe[n] =1X

k=�1x[k]�[n� kL]

xi[n] =1X

k=�1x[k]sinc(

n� kL

L

)

M. Lustig, EECS UC Berkeley

Up-Sampling

xi[n] = xe[n] ⇤ sinc(n/L)

xe[n]xi[n]

sinc(n/L)⇡

L�⇡

L

L

⇡/L

M. Lustig, EECS UC Berkeley

Frequency Domain Interpretation

x[n]LPF gain=L↑L

DTFT ⇒

= X(ej!L)

M. Lustig, EECS UC Berkeley

Frequency Domain Interpretationxe[n]

xi[n]x[n]LPF gain=L↑L

≠ 0 only for n=mL(integer m)

=1X

m=�1x

e

[mL]| {z }=x[m]

e

�j!mL

Compress DTFT by a factor of L!

Xe(ej!) =

1X

k=�1xe[n]| {z } e

�j!n

n

⇡/L

⌦N ⌦

Xc(j⌦)

X(ej!) Xi(ej!)

M. Lustig, EECS UC Berkeley

Example:

⇡�⇡⇡�⇡

1

sampling T sampling T’=T/L

Xe(ej!)

⇡�⇡

expanding L

⌦N ⌦

Xc(j⌦)

X(ej!) Xi(ej!)

M. Lustig, EECS UC Berkeley

Example:

⇡�⇡

1

sampling T sampling T’=T/L

· · ·· · ·

⇡�⇡

1/T

Xe(ej!)

⇡�⇡

expanding L

⌦N ⌦

Xc(j⌦)

L

· · · · · ·· · ·· · ·

X(ej!) Xi(ej!)

M. Lustig, EECS UC Berkeley

Example:

⇡�⇡⇡�⇡

1

L/T

1/T

sampling T sampling T’=T/L

Xe(ej!)

⇡�⇡

expanding L

⌦N ⌦

Xc(j⌦)

L

· · · · · ·· · ·· · ·

X(ej!) Xi(ej!)

Xe(ej!)

M. Lustig, EECS UC Berkeley

Example:

⇡�⇡⇡�⇡

1

L/T

1/T

sampling T sampling T’=T/L

⇡�⇡ ⇡

L

· · · · · ·1/T

expanding L

⌦N ⌦

Xc(j⌦)

L

· · · · · ·· · ·· · ·

X(ej!) Xi(ej!)

Xe(ej!)

M. Lustig, EECS UC Berkeley

Example:

⇡�⇡⇡�⇡

1

L/T

1/T

sampling T sampling T’=T/L

⇡�⇡ ⇡

L

· · · · · ·1/T

L�⇡

L

L

expanding 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

⇡�⇡

· · · · · ·1/T

3

x[n]

· · ·n

idealperiodicsinc2

M. Lustig, EECS UC Berkeley

Resampling by non-integer

• T’ = TM/L (upsample L, downsample M)

⇡/Lx[n]

LPF gain=L↑L ⇡/M

LPF↓M

⇡/Lx[n] ↑L ⇡/M

LPF↓Mmin{ , }

Or,

• What would happen if change order?

gain L

X̃i = HdXe

M. Lustig, EECS UC Berkeley

Example:

• L = 2, M=3, T’=3/2T (fig 4.30)

⌦N ⌦

Xc(j⌦)

X(ej!)

⇡�⇡

⇡�⇡

1

sampling T Subsampling M=3

Xe(ej!)

⇡�⇡

expanding L=2 LP filtering

⇡�⇡

X̃i = HdXe

M. Lustig, EECS UC Berkeley

Example:

• L = 2, M=3, T’=3/2T (fig 4.30)

⌦N ⌦

Xc(j⌦)

X(ej!)

⇡�⇡

⇡�⇡

1

sampling T Subsampling M=3

Xe(ej!)

⇡�⇡

expanding L=2 LP filtering

⇡�⇡

1/T

1/T

2/T

2/(3T)

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