Filters: Section 14.3/Pg 428

Total Page:16

File Type:pdf, Size:1020Kb

Filters: Section 14.3/Pg 428

Subband coding

Extension of Nyquist theorem: If a signal is band limited to a frequency range (f1 to f2) and if f1 and f2 satisfy certain criteria then the signal can be recovered from the sampled data provided fs >= 2(f2 – f1) samples/sec. Filters: Section 14.3/Pg 428

Xn Yn

input output

1,0,0,0,…. hn

hn = Impulse Response

N M

Yn = ai Xn-i + biYn-i ………Eq 14.8

i = 0 i = 0

Infinite Impulse Response, IIR filter.

FIR: Finite Impulse Response, FIR filter.

N

Yn = ai Xn-i

i = 0

FIR Filter

Yn = a0Xn + a1Xn-1 + a2Xn-2 + …….. + aNXn-N

Unit impulse 1,0,0,0,0,…….,0

Y0 = a0 , Y1 = a1 , Y2 = a2 ,……….., YN = aN ,

(YN+1 = YN+2 = YN+3 =………= 0) Finite Impulse Response

Xn Yn

Digital filter

M

Yn = hk Xn-k Discrete convolution

k = 0 M is finite – FIR filter M is infinite – IIR filter

Yn = h0Xn + h1Xn-1 + h2Xn-2 +……+ hMXn-M

hi , 0<=i<=M are taps or weights

(h0, h1, h2, …… ,hM)

14.3.1 Some filters used in Subband Coding

QMF – Quadrature Mirror filters

n LPF -> { hn}, HPF -> { (-1) hN-1-n},

Let N = 8, LPF (h0, h1, h2, h3, h4, h5, h6, h7)

HPF (h7, -h6, h5, -h4, h3, -h2, h1,-h0)

Symmetric filters

LPF hN-1-n = hn n = 0,1,…., N -1 2

Let N = 8, LPF symmetric (h0, h1, h2, h3, h4, h5, h6, h7)

(h0, h1, h2, h3, h3, h2, h1, h0)

These are linear phase filters QMF – Quadrature Mirror filters

n For QMF, HPF -> {(-1) hN-1-n} n {(-1) hLP,n}

HPF antisymmetric (h0, -h1, h2, -h3, h3, -h2, h1,-h0)

When LPF is symmetric, HPF is antisymmetric

See Tables 14.1, 14.2 on Pg433 & 14.3 on Pg 434

Johnston LPF, # of taps 8, 16 & 32

From these you can get the taps for HPF.

FIF Filter

xn yn

M yn = hkXn-k

K=0

hk k = 0,1,…,M are filter taps, weights or coefficients

Yn = h0Xn + h1Xn-1 + h2Xn-2 +……+ hMXn-M

Y0 = h0Xn + h1X-1 + h2X-2 +……+ hMX-M

Y1 = h0X1 + h1X0 + h2X-1 +……+ hMX1-M

Original pixels -> X0 X1 X2 X3 X4 X5 X6 ……… XnXn+1

Reflected pixels at the boundary -> X-7 X-6 X-5 X-4 X-3 X-2 X-1

………. X6 X5 X4 X2 X1 X0

7

Johnston LPF (Table 14.1/ Pg 433) yn = hkXn-k

k=0

Y0 = h0X0 + h1X-1 + h2X-2 + h3X-3 + …… + h7X-7

Y1 = h0X1 + h1X0 + h2X-1 + h3X-2 + …… + h7X-6

Y2 = h0X2 + h1X1 + h2X0 + h3X-1 + …… + h7X-5

Let N = 8, LPF symmetric (h0, h1, h2, h3, h4, h5, h6, h7)

(h0, h1, h2, h3, h3, h2, h1, h0)

HPF antisymmetric (h0, -h1, h2, -h3, h3, -h2, h1, -h0)

When LPF is symmetric, HPF is antisymmetric

Symmetric filter = hLP,n hn = hN-1-n LPF n = 0,1,…..,N/2 -1

n HPF Antisymmetric (-1) hN-1-n n hHP,n = (-1) hLP,n

Two channels Filter Banks

LP DECIMATION INTERPOLATION LP

X(n) X(n)

HP HP

Decimation filters h0(n) = hLP(n)

h1(n) = hHP(n)

Interpolation filters g0(n) = gLP(n)

g1(n) = gHP(n)

QMF – Quadrature Mirror filters

H0(w) H1(w)

GAIN LPF HPF QMF

0 90 180 w

H1(w) = H0(w+180) n h1(n) = (-1) h0(n)

X(w) = A + B

= 0.5 [ G0(w)H0(w) + G1(w)H1(w)]X(w) + 0.5 [ G0(w)H0(w+180) + G1(w)H1(w+180)]X(w+180)

For X(w) = X(w) part B of the above equation should be zero.

PR : Perfect Reconstruction Ref 1. B.Porat, “A course in DSP”, Wiley, pages 465 – 469 and 488 – 492, 1997. 2. H.M.Hang and J.W.Woods (Eds), “Handbook of visual Communications” Academic press, Ch.8, 1995.

G0(z) = CH0(z), G1(z) =- CH1(z), G0(z) = CH1(-z), G1(z) = -CH1(z) , c = constant

G0(w) = C H1(w+180), G1(w) = -C H0(w+180) implies

g0(n) = n C(-1) h1(n)

g1(n) = n C(-1) h0(n)

h1(n) = (- n 1) h0(n)

OR

g0(n) = Ch0(n) = gLP(n) = ChLP(n)

g1(n) = -Ch1(n) = gHP(n) = -ChHP(n)

Linear phase QMF

hLP(n) = h0(n) = h0(N-1-n), n=0,1,…, N - 1 (symmetric) 2

n 2 2 hHP(n) = h1(n) = (-1) h0(N-1-n), n=0,1,…....,N-1 (antisymmetric) X(z) = C/2 [H0 (z) – H1 (z)]X(z) 2 X(z) = A + B

= C [G0(z) H0(z) + G1(z)H1(z)]X(z) + C [G0(z) H0(-z) + G1(z)H1(-z)]X(-z) 2 2 For PR the part B of the above equation should be zero

1:2 Interpolation

{X0 X1 X2 X3 X4…………} {X0 i0 X1 i1 X2 i2 X3 i3……….}

{X0 0 X1 0 X2 0 X3 0 X4…………}

Note that the original pels (samples) {X0 X1 X2 X3 X4…………} stay the same after interpolation. Interpolated pels are {i0 i1 i2 i3……} inserted between adjacent original pels.

2:1 Decimation

{X0 X2

X4 X6 …………} {X0 X1 X2 X3 X4 X5 …………} {X0 X1 X2 X3 X4 X5 …………}

After applying the filter to the original samples {X0 X1 X2 X3 X4 X5 …………} just delete every other sample to get {X0 X2 X4 X6

…………}

PCM, VQ, DPCM, ADPCM, transform etc. adaptive to the specific subband

Inverse operations based on the encoder

Quantization and Coding bit allocation among the M subbands based on the information content. Follow steps similar to SQ. M 2 2 Rk = R + 0.5 log2(theta0l ) – 0.5 M log2(theta0l )

l=1 M

Where R = (1/M) Rk is the average # of bits/sample

k=1

Rk is # of bits assigned to sample k M:1 decimation or subsampling keep only every Mth sample. Delete the other samples.

1:M Interpolation or unsampling

Interpolate (Fill up) between adjacent two original samples by (M-1) zeros.

Original samples: X0 X1 X2 X3 X4…….

1:2 interpolation: X0 i0 X1 i1 X2 i2 X3 i3 X4………………..

M Band QMF filter bank Apply the above filter at every stage Aliasing between the bands 2 4 A(z) = HL(z) HL(z ) HL(z )

If HL(z) corresponds to 4 – tap filter A(z) corresponds to 3x6x12 = 216 tap filters See discussion on bottom of pg 434.

Application to Speech Coding – G.722 (64, 48, 56 Kbps)

Wideband coding of speech

Audio signal

6 bp sample

(can drop 1 or 2 LSB)

fs = 8KHz

2 bp sample

fs = 8KHz

fs = 16KHz 6 bp sample

Audio Signal out

fs = 16KHz 2 bp sample Quantizer in ADPCM : Variation of Jayant Quantizer

QMF , LPF symmetric hn = hN-1-n , n = 0, 1,2,…..,[(N/2) – 1]

n hHP,n = (-1) hLP,n

HPF is antisymmetric LPF

1] W.C.Chu, “Speech Coding Algorithms”, Hoboken, NJ: Wiley, 2003. 2] R.Goldberg, “A practical handbook of speech coders”, Boca Ratan, FL: CRC Press, 1999.

Application to audio coding (MPEG audio)

MPEG-1 audio Layer 1,2,3 Layer 1,2 bank of 32 filters (32 subbands) Psychoacoustic model assigns # of bits to code each subband (Masking properties of human ear) MP3 is MPEG-1 Layer-3 audio (www.mpeg.org) 3] M.Bosi and R.E.Goldberg, “Introduction to digital audio coding standards”, Norwell, MA, Kluwer, 2002.

Application to image compression

2-D filters implemented by 1-D separable [N x (N/2)] 3 IN 4 All at (N/2 X N/2) resolution

(NXN)

[N x (N/2)] 5

6

Subband Encoder

fy fy

4 6 1 2 3 5

fx fx

R = Rows C = Columns

(NXN/2)

(NXN/2)

(NXN)

All at (N/2 X N/2) resolution

OUT (NXN)

(NXN/2)

(NXN)

(NXN/2)

SUBBAND DECODER

Use reflection at borders

LPF yn = (Xn + Xn-1)/0.5 HPF = (Xn - Xn-1)/0.5

Application to image compression

LPF = {h0 h1 h2 h3 h3 h2 h1 h0}

HPF = {h0 -h1 h2 -h3 h3 -h2 h1 -h0}

N-1 yn = hk Xn-k ; hN-1-n = hn n = 0,1,2….,N -1 Symmetric LPF

K=0 2

N = 8

y0 = [h0x0+ h1x-1 + h2x-2 + h3x-3 + ….. + h7x-7] y1 = [h0x1+ h1x-0 + h2x-1 + h3x-2 + ….. + h7x-6] y2 = [h0x2+ h1x1 + h2x0 + h3x-1 + ….. + h7x-5]

wx

(0,0) LOW HIGH

LOW LL LH

DPCM DISCARD wy

HL HH

HIGH

SQ DISCARD

8 - Tap Johnson filter (Table 14.1/ p433)

16 - Tap Johnson filter (Table 14.2/ p433) Decomposition of Sinan Image 8 - Tap Smith Barnwell filter (Table 14.4/ p434)

Decomposition of Sinan Image Sinan Image coded at 0.5bpp using 8 tap Johnston filter

DPCM (1bpp)

wx

wy LH LL

Discard HL HH

SQ (1bpp)

Sinan Image coded at 0.5bpp using 8 tap Smith - Barnwell filter 2bpp(DPCM)

wx

wy LL LH

HL HH

Discard Apply VQ to some of the bands.

Bit allocation among subbands: Given M equal bands (M subbands), assume filter outputs are scalar quantized.

M

R = 1 Rk = Avarage # of bits/sample ……………. Eq 13.51

M k=1

(Rk = # of bits/sample at the output of the kth filter)

Reconstruction error variance for kth Quantizer.

2 -2 Rk 2 tau Rk = tau k 2 tau yk ……………. Eq 13.52

Lagrange Variable technique is very powerful. Total error in reconstruction M M 2 2 -2 Rk 2 tau Rk = tau Rk = alpha 2 tau yk ……………. Eq 13.53

k=1 k=1

(Assume alphak = alpha, a constant for all k)

M

Minimize Eq 13.53 subject to ( R – 1 Rk ) = 0

M k=1

Lagrange Variable

Minimize WRT Rk constraint

M -2 Rk 2 J = alpha 2 tau yk - ( R – 1 Rk) ……………. Eq 13.54

k=1 M k=1

Set dJ = 0 to get

dRl

2 -2 Rl alpha dj (tau yl 2 ) + = 0

dRl M

2 2Rl alpha tauyl d (1) + = 0

dRl 2 M

u u d(a ) = a (logea)du

Hence, 2 2Rl alpha tauyl (0.5) [loge0.5] 2 + = 0 M

2 -2Rl (ln 2)* (2 alpha tauyl ) * 2 = …………………Eq 13.58 M

2 log2[(2 * alpha * tauyl ) ln 2 ] – 2Rl = log2 ( ) …………………Eq 12.55 M

M M 2 R = 1 Rk = 1 log2[ 2 alpha tauyk ln2] - 1 log2( ) K=1 M K=1 2M 2 M

M 2 log2 ( ) = 1 log2 [2 * alpha * tauyk ln2]

M M K=1

M 2 1/M -2R = (2 alpha tauyk ln2) 2 …………………Eq 13.56

M K=1

Substitute 11.38 in 11.37

M 2 2 1/M -2R Rk = 1 log2 [2 alpha tauyk ln2] - 1 log2[ (2 alpha tauyl ln2) 2 ] 2 2 l=1

M 2 2 Rk = 0.5 log2[2 alpha tauyk ln2] – 1 log2(2 alpha tauyl ln2) + R 2M l=1

LPF : 8 – tap Johnston LPF

Let N = 8, LPF symmetric (h0, h1, h2, h3, h4, h5, h6, h7)

(h0, h1, h2, h3, h3, h2, h1, h0) 7

-jnw Symmetric filter frequency response is hn e n=0

(h0 = hN-1-n) (Assume T = 1)

HPF = (h0, -h1, h2, -h3, h3, -h2, h1, -h0) jw -j7w -jw -j6w -j2w -j5w -j3w -j4w For Symmetric filter H(e ) is [ h0 + h7e + h1e + h6e + h2e + h5e + h3e + h4e ] j(7/2)w -j(7/2)w j(5/2)w -j(5/2)w j(3/2)w -j(3/2)w -j(1/2)w -j(1/2)w = [ (h0)(e + e ) + (h1)(e + e ) + (h2)(e + e ) + (h3)(e + e )

For symmetric filter h0 = h7, h1 = h6, h2 = h5, h3 = h4

jw -j(7w/2) LPF H(e ) = 2[h0 cos(7w/2) + h1 cos(5w/2) + h2 cos(3w/2) + h3 cos(w/2)]e

Linear Phase Filter: FIR filter

jw -j(7w/2) HPF(antisymmetric): H(e ) = 2[h0sin(7w/2) – h1sin(5w/2) – h2sin(3w/2) – h3sin(w/2) ]je

hn = impulse response

N-1 jwt -jwnT H(e ) = hn e

n= 0 T = Sampling interval, normalize this to one

N = 0 jwT jwnT H(e ) = hn e = H(w)

n= 0

Frequency Response H(ejw) = H(ejw+2 ) , periodic with a period of 2

jw when hn is real, |H(e )| vs w magnitude response is an even function at w=0 and phase response is an odd function at w = 0

Recommended publications