Report2.doc

advertisement
Filterbank Design and Subband Coding
Shan He, Hongmei Gou
Nov. 5, 2002
Part 1: Filter Design
1 Design a perfect reconstruction QMF bank with the choice of analysis filters
H1 ( z )  H 0 (  z )
Step 1: Design
Due to the constraint of H1 ( z )  H 0 ( z ) , we can represent E (z ) as:
0 
1 1   E0 ( z )
E( z)  

E1 ( z )
1  1  0
In order to make the QMF bank a perfect construction system, we select R( z ) E ( z )  cz  m I . Therefore,
0
 1
 E ( z)
c
R( z )  z m0  0
2
 0


0 
1 1 

1  1  1
E1 ( z ) 
Here, E0 ( z ) and E1 ( z) are type1 polyphase representation of H 0 ( z ) . The QMF bank is determined by H 0 ( z ) only.
H 0 ( z ) = E0 ( z 2 ) + z 1 E1 ( z 2 )
H1 ( z ) = E0 ( z 2 ) - z 1 E1 ( z 2 )
c  m0
1
z 1
)
F0 ( z ) = z (

2
E1 ( z 2 ) E0 ( z 2 )
c  m0
1
z 1

(
)
F1 ( z ) = z
2
E1 ( z 2 ) E0 ( z 2 )
T (z ) = cz  ( 2 m0 1)
We can see that when H1 ( z )  H 0 ( z ) , there must be F0 ( z ) =  F1 ( z) ( - when m0 is even, + when m0 is odd.)
We select H 0 ( z ) , H1 ( z ) as FIR filters. If we also want F0 ( z ) , and F1 ( z ) to be FIR filters, both E0 ( z ) and E1 ( z) must
be a delay, i.e. E0 ( z ) = c0 z  n , E1 ( z) = c1 z  n .
Therefore:
0
1
H 0 ( z ) = c0 z 2 n0 + z 1 c1 z 2 n1 ;
H1 ( z ) = c0 z 2 n0 - z 1 c1 z 2 n1
1
1
c
c
F0 ( z ) = z  m0 z 2 n1 + z  m0 z 1 z 2 n0
2
2
c1
c0
 1 2 n1 c  m0 1 1 2 n0
c
z + z z
z
F1 ( z ) = z  m0
2
2
c1
c0
Step 2: Implementation and Analysis
In the implementation, we select c =1, m0 = 0; c0 =1, n 0 = 0; c1 =1, n1 =0 , so
H 0 ( z ) = 1+ z 1 ;
H1 ( z ) = 1- z 1 ;
F0 ( z ) = (1+ z 1 )/2;
F1 ( z ) = (-1+ z 1 )/2;
T (z ) = 2 z 1
All the filters have linear phase.
In the simulation, we select unit impulse as the input signals, and get a delayed and scaled unit impulse, as shown
in Fig. 1. So it is perfect reconstruction system.
Fig. 1 Input and Output of System1
In the frequency domain, we also calculate the transition function and aliasing terms from our selected filters.
T (z ) = ( H 0 ( z ) F0 ( z ) + H1 ( z ) F1 ( z ) )/2;
A(z ) = ( H 0 ( z ) F0 ( z ) + H1 ( z) F1 ( z ) )/2
Fig. 2: Amplitude and Phase of the Transition Function
Fig. 3: Amplitude and Phase of the Aliasing Term
As shown in Fig. 2 and Fig.3, T (z ) has a constant amplitude and linear phase, while the amplitude of the aliasing
term is very small (about -300 db), so the system is a perfect reconstruction system.
Finally, we check the performance of H 0 ( z ) H1 ( z ) . As shown in Fig. 4 and Fig. 5, H 0 ( z ) and H1 ( z ) do not have
sharp cutoff. This is due to the low order of H 0 ( z ) and H1 ( z ) . This is the disadvantage of the design.
Fig. 4: Amplitude and Phase of H 0 ( z )
Fig. 5: Amplitude and Phase of H1 ( z )
Step 3 Additional Analysis
If F0 ( z ) and F1 ( z ) are not constrained to FIR filters, we can design F0 ( z ) and F1 ( z ) as follows:
c  m0
1
z 1
F0 ( z ) = z (

)
2
E1 ( z 2 ) E0 ( z 2 )
c  m0 E0 ( z 2 )  z 1 E1 ( z 2 )
= z
2
E1 ( z 2 ) E0 ( z 2 )
c
2
= z m
c
1
z 1
)

F1 ( z ) = z  m0 (
2
E1 ( z 2 ) E0 ( z 2 )
0
H 0 ( z)
E1 ( z 2 ) E 0 ( z 2 )
c  m0  E0 ( z 2 )  z 1 E1 ( z 2 )
= z
2
E1 ( z 2 ) E0 ( z 2 )
 H1 ( z)
c
= z  m0
2
E1 ( z 2 ) E 0 ( z 2 )
Since H 0 ( z ) , H1 ( z ) are FIR filters, so are E0 ( z 2 ) and E1 ( z 2 ) . In order to get stable F0 ( z ) and F1 ( z ) , it is required that
zeros of E0 ( z 2 ) and E1 ( z 2 ) must be inside the unit circle. This is severe, so this is not a very practical system.
2 Design a perfect reconstruction QMF bank with the choice of linear-phase FIR
H 0 ( z)
Step 1: Design
Now there is no constraint of H1 ( z )  H 0 ( z ) , we can construct an FIR perfect reconstruction system with power
symmetric filters. But H 0 ( z ) can not have exactly linear phase, unless it has the form of az  K + bz  L . Then it is also
a low order filter and can not have good cutoff.
Then we use the lattice structure for linear FIR perfect-reconstruction QMF banks. This structure yields linearphase analysis and synthesis filters. There is no constraint of H1 ( z )  H 0 ( z ) . It also does not require that H 0 ( z )
and H1 ( z ) have power symmetry.
We select type B pair of the lattice structure. The FIR filters H 0 ( z ) and H1 ( z ) has even orders and symmetric
impulse responses and the determinant of E (z ) is a delay. F0 ( z ) and F1 ( z ) can be calculated as follows:
 F0 ( z ) z 2 r
 F ( z )  b
 0 
 H 1 (  z ) 
 H ( z ) 
 0

Step 2: Implementation and Analysis
We use coefficients of H 0 ( z ) and H1 ( z ) provided by [1]. Their orders are 22 and 24 respectively.
m
0
1
2
3
4
5
6
7
8
9
10
11
12
h0 ,m
h1,m
5.9250950404227e-3
- 1.5683167986894e-2
4.5594028972112e-3
3.6047559927372e-2
- 2.2314449066179e-2
- 4.2444851133377e-2
4.0981175348012e-2
6.3735691673040e-2
- 8.7080719666949e-2
- 6.4640370944037e-1
3.1314592005381e-1
5.6912350680866e-1
1.0446957436687e-6
- 2.7652111453693e-6
8.2562648947712e-6
- 1.3369902864879e-5
- 3.7402147190058e-3
9.9426163128459e-4
5.2822531950793e-4
- 3.1883222956165e-2
- 1.1276359972347e-3
9.5100122977005e-2
-9.5195769252465e-4
-3.1042174432319e-1
5.0039707172893e-1
This table displays only the first half of the coefficients of H 0 ( z ) and H1 ( z ) . We can get the other half since they
are both symmetric. All the filters have linear phase.
As shown in Fig. 6, the output signal is a delayed and scaled version of the input signal. So it is a perfect
reconstruction system.
Fig. 6 Input and Output of System2
Amplitude and phase of the transition function and aliasing terms are shown in Fig.7 and Fig. 8.
Fig. 7: Amplitude and Phase of the Transition Function
Fig. 8: Amplitude and Phase of the Aliasing Term
Due to the roundoff error of the float coefficients of the filters, T (z ) has an approximately constant amplitude. But
the error is tolerable. T (z ) has linear phase. The amplitude of the aliasing term is very small (about -300 db).
Therefore, the system is a perfect reconstruction system.
Finally, we check the performance of H 0 ( z ) and H1 ( z ) . As shown in Fig. 9, 10, H 0 ( z ) and H1 ( z ) have sharp cutoffs .
Fig. 9: Amplitude and Phase of H 0 ( z )
Fig. 10: Amplitude and Phase of H1 ( z )
Compare the two systems we constructed by now. Both of them consist of linear analysis and synthesis filters and
are perfect reconstruction systems. But, system 1 can only has 1-order filters, so the cutoffs of the filters is not
good. System 2 can have high-order filters, so the cutoffs of the filters are very good. However, system 2 has more
delay than system 1.
Step 3 Additional Analysis
We also try to construct an FIR perfect construction QMF bank as follows. First, select linear phase filters H 0 ( z )
and H1 ( z ) and then calculate F0 ( z ) and F1 ( z ) to construct a perfect reconstruction system.
H 0 ( z ) = E00 ( z 2 ) + z 1 E 01 ( z 2 )
H1 ( z ) = E10 ( z 2 ) + z 1 E11 ( z 2 )
In order to construct a perfect reconstruction system, we select R( z ) E ( z )  cz  m I
0
 R00 ( z ) R01 ( z )
 R ( z) R ( z)
11
 10

1
= cz
 m0
= cz  m
0
 E00 ( z ) E01 ( z )
 E ( z) E ( z)
11
 10

 E11 ( z )  E01 ( z )
 E ( z ) E ( z ) 
00
 10

E00 ( z ) E11 ( z )  E10 ( z ) E01 ( z )
F0 ( z ) = z 1 R00 ( z 2 ) + R10 ( z 2 )
= cz  m
0
z 1 E11 ( z 2 )  E10 ( z 2 )
E00 ( z 2 ) E11 ( z 2 )  E10 ( z 2 ) E01 ( z 2 )
F1 ( z ) = z 1 R01 ( z 2 ) + R11 ( z 2 )
= cz  m
0
 z 1 E01 ( z 2 )  E00 ( z )
E00 ( z 2 ) E11 ( z 2 )  E10 ( z 2 ) E01 ( z 2 )
H 0 ( z ) = E00 ( z 2 )  z 1 E 01 ( z 2 ) : equal to B ( z ) of F1 ( z )
H1 ( z ) = E10 ( z 2 )  z 1 E11 ( z 2 ) : equal to  B ( z ) of F0 ( z )
Similar to Step 3 in System 1, it is difficult to guarantee that the poles of F0 ( z ) and F1 ( z ) (roots of
E00 ( z 2 ) E11 ( z 2 )  E10 ( z 2 ) E01 ( z 2 ) ) are inside the unit circle. Thus this is not a practical system either.
3 Design a perfect reconstruction QMF bank with IIR analysis and synthesis filters
Step 1: Design
According to the identified H 0 ( z ) , H1 ( z ) , find F0 ( z ) and F1 ( z ) that can make a perfect reconstruction system. How to
identify the coefficients of F0 ( z ) and F1 ( z ) ?
H 0 ( z ) = E00 ( z 2 ) + z 1 E 01 ( z 2 )
H1 ( z ) = E10 ( z 2 ) + z 1 E11 ( z 2 )
In order to construct a perfect reconstruction system, we select R( z ) E ( z )  cz  m I
0
E01 ( z )
 R00 ( z ) R01 ( z )
 m0  E 00 ( z )
 R ( z ) R ( z )  = cz  E ( z ) E ( z ) 
11
 11

11
 10

F0 ( z ) = z 1 R00 ( z 2 ) + R10 ( z 2 )
F1 ( z ) = z 1 R01 ( z 2 ) + R11 ( z 2 )
1
Step 2: Implementation and Analysis
As shown before, when synthesis filters are IIR filters, it is difficult to guarantee their stability. In the
implementation, we select 1-order IIR analysis filters and carefully choose its coefficients to achieve the stability
of synthesis filters.
0.8  z 1
;
1  0.3 z 1
H 1 ( z ) = H 0 ( z ) ;
H 0 ( z) =
As shown in Fig. 11, the output signal is a delayed and scaled version of the input signal. So it is a perfect
reconstruction system.
Fig. 11 Input and Output of System3
Amplitude and phase of the transition function and aliasing terms are shown in Fig.12 and Fig. 13. The system is a
perfect reconstruction system.
Fig. 12: Amplitude and Phase of the Transition Function
Fig. 13: Amplitude and Phase of the Aliasing Term
Finally, we check the performance of H 0 ( z ) and H1 ( z ) . As shown in Fig. 14, 15, H 0 ( z ) and H1 ( z ) do not have sharp
cutoffs.
Fig. 14: Amplitude and Phase of H 0 ( z )
Fig. 15: Amplitude and Phase of H1 ( z )
Compare the IIR perfect reconstruction QMF bank with the other two systems. It is most difficult to construct a
practical PR QMF bank by IIR filters. In system 3, the IIR filters are non-linear phase filters. However, when IIR
filters have the same order with the FIR filters, IIR filters have better cutoffs, as shown in Fig.14-15, Fig. 4-5
respectively.
Part 2: Subband Image Coding
1
Two-band filterbank for subband coding --- Results and Discussion
We apply three PR QMF filter banks designed in part 1. Different results are achieved and will be analyzed in the
following. Before that, we want to discuss our adopted quantization scheme.
In the transforming sub-band images LL,HL,LH,HH, we need to quantize them into different bit codeword
according to the sub-band image itself, so that the compression can be achieved.
Bit Allocation
From the characteristics of the sub-band image, we can allocate different bits to these images.
 HH—contains many high frequency factors with small amplitude, so we can use fewest bits to code them.
(Actually we often throw them away without infect the reconstructed image greatly. )
 HL,LH – contains relatively high frequency factors whose amplitude are also small. We choose fewer bits to
code them. The number of bits depend on the quality of the filters H0 and H1. With good filters, we just throw
these factors away, the perceptual effect doesn’t change too much. With worse filters, we can allocate 1 to 2
bits to these factors, which will be shown enough in the result.
 LL—contains the DC part of the image, which is the main part. It amplitude is usually large. So we choose to
use more bits to code it. And sometimes it is not necessary to use 8 bits to code it. Without loose the visually
effect, 3-5 bits is enough.
So by the bit allocation scheme described above, we can use number of bits/pixel far less than 8bits/pixel to code
the image and send to the channel.
Now, the problem is how to quantize these sub-band images so as to obtain a minimum distortion.
Quantization Scheme
In the quantization scheme, out goal is to find a quantization of the row (column) vector minimizing the distortion
measurement—mean square error. We use the optimum mean square (Lloyd-Max) quantizer.
This quantizer minimizes the mean square error for a given number of quantization levels. Let u be a real scalar
random variable with a continuous probability density function pu (u ) . It is desired to find the decision levels t k and
reconstruction levels rk for an L-level quantizer such that the mean square error
  E[(u  u * ) 2 ]  
t L 1
t1
(u  u * ) 2 pu (u )du
Using this criterion, we can obtain
tk 
t k 1
rk



tk
upu (u )du
t k 1
tk
(rk  rk 1 )
2
 E[u | u  Tk ]
pu (u )du
In our problems, we put each sub-image into a vector to form the approximation of distribution pu (u ) , then quantize
it optimally to obtain t k s and rk s.
Advantages and disadvantages of Lloyd quantizer
Advantage: It can give the optimal quantization image minimizing the distortion, which is what we want.
Disadvantage: It is optimal, but it is really computation intensively and time-consuming, especially for 2^6 and
higher levels quantization. Fortunately we find that the image DC part need only up to 5 bits to code. So it is
suitable one for our image compression.
There are other quantization methods such as uniform quantizer, which has larger distortion then Lloyd quantizer.
Adding the reason above, we finally make the selection of Lloyd quantizer.
Lenna case:
Then, we apply the three PR QMF banks designed in Part 1 to the lenna image. The output images of the analysis
filters are:
 For FIR1
LL
LH
HL
 For FIR2
HH
LL
LH
HL
HH
 For IIR
LL
LH
HL
HH
From the output images of the three filter banks, we can see that the FIR2 filter produces the most LL-contentrated
output. Using this characterisc we can discard all the other three parts without loss of great distortion. By now, we
can predict FIR2 will performs the best.
When the LL-HH images are obtained, we should quantize and then transmit them.With different bit allocation
scheme as shown in Table 1, we get different reconstructed images with different performance.
LL
LH
HL
HH
5
0
0
0
4
0
0
0
3
0
0
0
Original
FIR2 5 0 0 0
FIR1 5 0 0 0
IIR 5 0 0 0
FIR2 4 0 0 0
FIR1 4 0 0 0
IIR 4 0 0 0
FIR2 3 0 0 0
FIR1 3 0 0 0
IIR 3 0 0 0
Compression Rate (CR) and Distortion are calculated using
CR 
512  512  8
LL
 bit (i)  256  256 
i  HH
512 512
MSE 
where
[ I
i 1 j 1
org
LL
2
bit ( i )
i  HH
(i, j )  I rec (i, j )] 2
512 * 512
8
I org --the original image
I rec --the reconstructed image
PSNR  20 log 10 (
Bit allocation
5000
4000
3000
Filter Type
FIR 2
FIR 1
IIR
FIR 2
FIR 1
IIR
FIR 2
FIR 1
IIR
255
MSE
)
Compression
Rate(bits/pixel)
6.3950
(1.2510)
7.9961
(1.0005)
10.6632
(0.7502)
PSNR
32.0494
29.9906
25.8893
30.9854
29.3802
25.0877
28.4194
12.1485
23.4039
From the reconstructed image we can see that Filter Bank 2 can achieve the best performance. It can give more CR
with smaller distortion.
Filter Bank 2 uses higher order of linear FIR filter, it has sharp cutoff so that the lower frequency part are most
contained in LL part. Then for the HL,LH and HH parts only high frequency parts exist, which is small enough to
discard. This gives the lowest bits/pixel to FB2 at the same distortion. And alternatively, FB2 gives less distortion
at the same bits/pixel.
Baboon case:
Then, we apply the three PR QMF banks designed in Part 1 to the baboon image. The output images of the
analysis filters are:
 For FIR1
LL
LH
HL
HH
LL
LH
 For FIR2
HL
HH
 ForIIR
LL
LH
HL
HH
Because in the ‘lenna’ case we have compared the three kinds of filter banks in detail. Here we only give out the
best performance can be achieved, then show the results of the other two filters at the same compression rate. Of
course, the best performance is again given by FIR2 fitler bank, which is demonstrated by the ‘lenna’ case and also
here in the ‘baboon’ case.
Following is the original image and the reconstructed images by FIR2, FIR1 and IIR filter banks. The best visual
performance (also the PSNR, which is shown next) in the ‘baboon’ case is given by FIR2 filter bank with bit
allocation (LL LH HL HH) = [4 0 2 0], corresponds to 1.5 bits/pixel. Then at the same bits allocation scheme, the
FIR1 and IIR filter banks are applied to the image reconstruction, whose results are shown below also.
Original Image
FIR2 4020
FIR1 4020
IIR 4020
Comparision of PSNR of 3 filters with same bit allocation (LL LH HL HH)[4 0 2 0] RC=5.3312,(1.5006bits/pixel)
FIR2
FIR1
IIR
PSNR
25.7051
24.9260
24.8719
Form the visual perspective, there are difference between the FIR2 result and FIR1 IIR ones, especially when you
look carefully in the high frequency area. From the above table,we can also see that the FIR2 filter still perform
better than the other two.
And compared with ‘lenna.tiff’, its bits/pixel cannot be reduced further. This is because it contains too much high
frequency factors. Then the output of the high pass filter is of large energy. So this high frequency part cannot be
represent by fewer bits or even be thrown away. These bits result that the whole compression ratio can not be as
large as for the ‘lenna‘.
2
4-subband filter bank
Based on the comparison and discussion in Problem 4, we choose FIR filters in FB2 to design our 4-band filter
bank.
The resulting images are shown below. The bit allocation are listed in Table 2.
4-Subband FIR 5220
4- Subband FIR 5000
4-Subband FIR 4000
Table 2. Bit allocation for 4-band filter bank
LLLL
LLLH
LLHL
LLHH-HHHH
5
2
2
0
5
0
0
0
4
0
0
0
RC(bits/pixel)
14.1914
(0.5637)
25.5202
(0.3135)
31.9376
(0.2505)
PSNR
27.6967
26.5851
26.2396
From the resulting images and the RC and PSNR, we can see that the 4-band filter bank gives better performance
than two band coding. Intuitively explanation is that we do more work, get better performance. Actually it is kind
of compressing the LL part of the 2 band, so it will definitely get better performance. But the improvement is
limited.
Baboon case:
We apply FIR2 to baboon image. We select the bit allocation as below with correspoding 1.4391bits/pixel. The
reconstructed image is shown below.
LLLL
4
LLLH
2
LHLL
1
LHLH
2
LLHL
2
LLHH
2
LHHL
1
LHHH
2
HLLL
1
HLLH
2
HHLL
0
HHLH
0
HLHL
2
HLHH
2
HHHL
0
HHHH
0
Original image
Reconstructed image
Bit per pixel: 1.4391
PSNR = 23.6370
This result is not as good as the lenna case. This dues to the high frequency compents in the baboon image.
Although we separate it into LLLL-HHHH sub-band images. Every sub-band image contains information which
we must use certain number of bits to code them instead of discarding as in lenna case.
Reference
1. Truong Q. Nguyen, and P. P. Vaidyanathan, Two channel perfect-reconstruction FIR QMF structures which
yield linear-phase analysis and synthesis filters, IEEE Trans. on Acoustics, speech, and signal processing,
Vol. 37, No. 5, May, 1989.
2. P. P. Vaidyanathan, Chapter 7 , Multirate systems and filter banks.
3. Anil K. Jain, Fundamentals of digital image processing, 1981, Prentice Hall.
Download