<<

A Comparative Study of DCT, LOT, and DWT-based Image Coders by Warit Wichakool Submitted to the Department of Electrical Engineering and Computer Science in partial fulfillment of the requirements for the degrees of Bachelor of Science in Electircal Engineering and Computer Science and Master of Engineering in Electrical Engineering and Computer Science at the MASSACHUSETTS INSTITUTE OF TECHNOLOGY June 2001 © Warit Wichakool, MMI. All rights reserved. The author hereby grants to MIT permission to reproduce and BARKE distribute publicly paper and electronic copies of this thesis document

in whole or in part. MASSACHUSETTS INSTITUTE OF TECHNOLOGY

JUL 11 2001

Author ...... LIBRARIES Department of Electrical Engineering and Computer Science May 23, 2001 Certified by..... K.S. Thyagarajan Principal Engineer VIA daiesisispupervisf Certified by... David H.itaelin _-Professor of Electrical Engineering WL.T ThesiS~uj rvisor Accepted by...... Arthur C. Smith Chairman, Department Committee on Graduate Students A Comparative Study of DCT, LOT, and DWT-based Image Coders by Warit Wichakool

Submitted to the Department of Electrical Engineering and Computer Science on May 23, 2001, in partial fulfillment of the requirements for the degrees of Bachelor of Science in Electrical Engineering and Computer Science and Master of Engineering in Electrical Engineering and Computer Science

Abstract Ten systems were compared in terms of their system complexity and peak signal-to-noise ratios (PSNR). The results showed that the relationship between PSNR and rate was affected by the combination of the quantizer and the encoder, but was not affected by the type of transform. The performance of the embedded zerotree wavelet (EZW) system was effected by the number of discrete (DWT) levels. In comparison with the 2-level EZW system at a given , the EZW system improved PSNR by up to 4 dB at low bit rates as the number of levels increased from two to three, and gained another 1 dB as the number of levels increased from three to four. Four of the ten systems were studied further: the discrete cosine transform (DCT) baseline JPEG, the lapped orthogonal transform (LOT) version of baseline JPEG, the visual threshold wavelet with the run-length Huffman coder, and the EZW with the adaptive Huffman coder. The PSNR values for the Lena image at 0.5 bit/ for the four systems were 34.56, 34.43, 34.97, and 34.52 dB, respectively. In comparison with the DCT JPEG, the LOT JPEG provided 0.5 dB better PSNR and also reduced the image blockiness, but it introduced small ringing artifacts in areas with sharp edges. The visual threshold wavelet yielded better PSNR than the DCT system at the same bit rate, but the reconstructed image suffered from blurriness. Finally, the EZW system performed comparably to the DCT system. Although the reconstructed image exhibited no blockiness, it clearly lost some details.

VI-A Company Thesis Supervisor: K.S. Thyagarajan Title: Principal Engineer

M.I.T. Thesis Supervisor: David H. Staelin Title: Professor of Electrical Engineering Acknowledgments

I would like to take this opportunity to express my gratitude toward many people on the course of my thesis. First of all, I would like to thank K.S. Thyagarajan for his advice and guidance. I also would like to thank Professor Staelin for his guidance and comments on my thesis, and Henrique Malvar for providing the programs and references of the LOT system for my simulation. I also would like to thank all members of at QUALCOMM INCORPORATED for their supports during my research at the company. In addition, I would like to thank Peter Agboh and Songpon Deechongkit for their comments on my research. In addition, I have to thank Yui (Siraprapha Sanchatjate), my family, and all my friends for all the mental support and encouragement they have been giving me through out the years at MIT. Contents

1 Introduction 12

2 Background 16 2.1 Transform ...... 17 2.1.1 Discrete Cosine Transform ...... 18 2.1.2 Lapped Orthogonal Transform . .... 20 2.1.3 Discrete Wavelet Transform ...... 26 2.2 Quantization ...... 31 2.2.1 Optimal Uniform Quantizer ...... 33 2.2.2 JPEG Uniform Quantizer ...... 34 2.2.3 Visual Threshold Wavelet Quantizer 35 2.2.4 Embedded Zerotree Wavelet Quantizer 37 2.3 Entropy Coding ...... 40 2.3.1 ...... 41 2.3.2 ...... 41 2.3.3 Run-Length Huffman Coding ..... 41

3 Simulation Methods 44 3.1 Part I: System Complexity ...... 46 3.2 Part II: System Performance..... 46 3.2.1 Part II-A: Effect of Number of Levels on DWT Systems . 47 3.2.2 Part II-B: Effect of Transform ...... 47 3.2.3 Part II-C: Effect of Quantizer 48

4 3.2.4 Part II-D: Effect of Entropy Coder ...... 49 3.2.5 Part II-E: Overall System Performance ...... 49 3.3 Part III: Visual Quality ...... 50 3.4 Test Im ages ...... 50

4 Results and Discussions 52 4.1 Part I: System Complexity ...... 52 4.1.1 Transform ...... 52 4.1.2 Quantization ...... 54 4.1.3 Entropy Coding ...... 55 4.2 Part II: System Performance ...... 56 4.2.1 Part II-A: Effect of Number Levels on DWT Systems ..... 56 4.2.2 Part II-B: Effect of Transform ...... 65 4.2.3 Part II-C: Effect of Quantizer ...... 70 4.2.4 Part II-D: Effect of Entropy Coder ...... 71 4.2.5 Part II-E: Overall System Performance ...... 78 4.3 Part III: Visual Quality...... 90

5 Summary 105

A General Thesis Release Letter and Classification Review Letter 107

5 List of Figures

2-1 Basic transform coding system ...... 16 2-2 Block diagram for a separable 2-D transform ...... 18 2-3 Flowgraph conventions ...... 18 2-4 1-D DCT basis functions ...... 19 2-5 Fast DCT for M=8 ...... 2 1 2-6 Fast IDCT for M=8 ...... 22 2-7 General structure of the LOT ...... 23 2-8 LOT basis functions ...... 25 2-9 Type-I, fast LOT for a block size of 16 ...... 26 2-10 Type-I, fast ILOT for a block size of 16 ...... 27 2-11 Type-I, fast LOT for the finite length signal ...... 28 2-12 2-level, 2-band analysis and synthesis for the 1-D DV T ... 30 2-13 Organization of 3-level DWT coefficients ...... 31 2-14 Locations of parent-descendants of the 3-level EZW . .... 39 2-15 Zig-zag scan of the run-length Huffman coder ...... 43 2-16 Flowgraph of the run-length Huffman coder ...... 43

4-1 Effect of number of DWT levels on the PSNR performance of the DWT systems using the EZW quantizer and the adaptive H uffm an coder ...... 64 4-2 Efficiency test for the adaptive Huffman coder ...... 89 4-3 bfragl: original image at 8 bpp ...... 93 4-4 bfrag2: DCT + JPEG + Run-Length Huffman at 0.50 bpp . 94

6 4-5 bfrag3: 3-level DWT + EZW + Adaptive Huffman at 0.50 bpp 95 4-6 bfrag4: 4-level DWT + EZW + Adaptive Huffman at 0.50 bpp 96 4-7 bfrag5: 3-level DWT + Visual Threshold + Run-Length Huff- man at 0.50 bpp ...... 97 4-8 bfrag6: LOT + JPEG + Run-Length Huffman at 0.50 bpp . 98 4-9 lenal: original image at 8 bpp ...... 99 4-10 lena2: DCT + JPEG + Run-Length Huffman at 0.50 bpp . . 100 4-11 lena3: 3-level DWT + EZW + Adaptive Huffman at 0.50 bpp 101 4-12 lena4: 4-level DWT + EZW + Adaptive Huffman at 0.50 bpp 102 4-13 lena5: LOT + JPEG + Run-Length Huffman at 0.50 bpp .. 103 4-14 lena6: 3-level DWT + Visual Threshold + Run-Length Huff- m an at 0.50 bpp ...... 104

7 List of Tables

2.1 Computational costs of the fast DCT ...... 21 2.2 Computational costs of the type-I, fast LOT ...... 29 2.3 Coefficients of 9/7-tap Villasenor biorthogonal filters .. ... 29 2.4 Computational costs of the DWT ...... 32 2.5 Basis function amplitudes for 9/7-tap biorthogonal filters . . 36 2.6 Quantization levels for 9/7-tap biorthogonal filters ...... 37

3.1 List of tested transform coding systems ...... 44 3.2 List of systems for comparing the effect of number of DWT levels on the PSNR performance ...... 47 3.3 List of systems for comparing the effect of transforms on the PSNR performance using the optimal uniform quantizer, the Huffman coder, and the run-length Huffman coder ...... 48 3.4 List of systems for comparing the effect of quantizers on the PSNR performance using the run-length Huffman coder .. . 49 3.5 List of systems for comparing the effect of entropy coders on the PSNR performance using Huffman and run-length Huff- m an coders ...... 49 3.6 List of selected systems for comparing the PSNR performance 50 3.7 List of test im ages ...... 51

4.1 Computational costs of transform algorithms ...... 53 4.2 Normalized costs of transforming a 512x512 image ...... 53

8 4.3 List of systems for comparing the effect of DWT levels on the PSNR performance of the DWT systems ...... 57 4.4 Effect of DWT levels on the PSNR performance of the DWT systems using the optimal uniform quantizer and the run- length Huffman coder ...... 58 4.5 Effect of DWT levels on the PSNR performance of the DWT systems using the optimal uniform quantizer and the run- length Huffman coder (cont.) ...... 59 4.6 Effect of DWT levels on the PSNR performance of the DWT systems using the visual threshold quantizer and the run- length Huffman coder ...... 60 4.7 Effect of DWT levels on the PSNR performance of the DWT systems using the visual threshold quantizer and the run- length Huffman coder (cont.) ...... 61 4.8 Effect of DWT levels on the PSNR performance of the DWT systems using the EZW quantizer and the adaptive Huffman co d er ...... 62 4.9 Effect of DWT levels on the PSNR performance of the DWT systems using the EZW quantizer and the adaptive Huffman coder (cont.) ...... 63 4.10 List of systems for comparing the effect of transforms on the PSNR performance ...... 65 4.11 Effect of transforms on the PSNR performance using the op- timal uniform quantizer and the Huffman coder ...... 66 4.12 Effect of transforms on the PSNR performance using the op- timal uniform quantizer and the Huffman coder (cont.) . .. 67 4.13 Effect of transforms on the PSNR performance using the op- timal uniform quantizer and the run-length Huffman coder . 68

9 4.14 Effect of transforms on the PSNR performance using the op- timal uniform quantizer and the run-length Huffman coder

(con t.) ...... 69 4.15 List of systems for comparing the effect of quantizers on the PSNR performance using the run-length Huffman coder ... 71 4.16 Effect of quantizers on the PSNR performance of the DCT systems using the run-length Huffman coder ...... 72 4.17 Effect of quantizers on the PSNR performance of the DCT systems using the run-length Huffman coder (cont.) ...... 73 4.18 Effect of quantizers on the PSNR performance of the LOT systems using the run-length Huffman coder ...... 74 4.19 Effect of quantizers on the PSNR performance of the LOT systems using the run-length Huffman coder (cont.) ...... 75 4.20 Effect of quantizers on the PSNR performance of the DWT systems using the run-length Huffman coder ...... 76 4.21 Effect of quantizers on the PSNR performance of the DWT systems using the run-length Huffman coder (cont.) ...... 77 4.22 List of systems for comparing the effect of entropy coders on the PSNR performance using the optimal uniform quantizer 78 4.23 Effect of entropy coders on the PSNR performance of the DCT systems using the optimal uniform quantizer ...... 79 4.24 Effect of entropy coders on the PSNR performance of the DCT systems using the optimal uniform quantizer (cont.) . . 80 4.25 Effect of entropy coders on the PSNR performance of the LOT systems using the optimal uniform quantizer ...... 81 4.26 Effect of entropy coders on the PSNR performance of the LOT systems using the optimal uniform quantizer (cont.) . . 82 4.27 Effect of entropy coders on the PSNR performance of the DWT systems using the optimal uniform quantizer ...... 83

10 4.28 Effect of entropy coders on the PSNR performance of the DWT systems using the optimal uniform quantizer (cont.) . 84 4.29 List of selected systems for the comparison in PSNR perfor- m an ce ...... 85 4.30 Comparison of the PSNR performance of DCT, LOT, and DWT systems ...... 86 4.31 Comparison of the PSNR performance of DCT, LOT, and DW T systems (cont.) ...... 87 4.32 Result images and the corresponding PSNRs ...... 91

11 Chapter 1

Introduction

Modern media is overwhelming with graphics such as images and movies. Constraints on and memory space create trade-offs between the size and quality of images. One solution is to compress the image using a transform coding system. The basic transform coding system consists of three blocks: a transform block, a quantization block, and an entropy coding block. At a given bit rate, different systems yield different image quality. In addition, each system varies in terms of the algorithm complexity. Within the system, the complexity and the image quality may be mainly influenced by a single functional block or by a combination of all three blocks. It is hard to determine the best system to use. One of the most popular compression systems uses the discrete cosine transform (DCT) system recommended by Joint Photographic Experts Group (JPEG). The simplest JPEG system is the baseline JPEG. This system combines the DCT with a uniform scalar quantizer and a run-length Huffman coder [1], [9]. The DCT system provides high quality images at reasonable bit rates, but exhibits blockiness at low bit rates. This artifact is caused by independent processes of transformed blocks and the discontinuity of the DCT basis functions [7], [14]. This artifact can be reduced by increasing the bit rate or using more complex systems. However, the gain in quality may not justify additional complexity of the system. Another solution to reduce the blocking effect is to change the transform block to the lapped orthogonal transform (LOT). This transform solves the problem by

12 overlapping and modifying the DCT basis functions to eliminate the independent transformation of image blocks and the discontinuity of the basis functions [7]. The LOT is similar to the DCT because it is a block transform. Furthermore, the LOT uses the DCT bases as its building blocks for new basis functions [7]. However, there is no quantizer and entropy coder for the LOT system. Since the LOT is similar to the DCT, the LOT may benefit from the JPEG-like quantizer and encoder in the same way as the DCT. Therefore, the reduction of the blocking effect can be done by modifying the transform block to the LOT and updating parameters for the quantizer and the encoder accordingly. This solution may be the simplest one to improve the visual quality of the image. Recently, the wavelet-based system has been extensively studied and developed for applications. Many of the candidates for the JPEG-2000 standard are wavelet-based [6]. The discrete wavelet transform (DWT) is one of sub-band coding. One implementation of DWT system employs a filter bank to separate the signal into a number of frequency bands. Each band is then quantized and encoded depending on the systems. These filter banks operate on the whole image instead of a block like the DCT and the LOT. As a result, it should eliminate the image blockiness completely. In addition, the DWT system can gain compression from a special structure called a zerotree. Sample encoders based on this structure are the embedded zerotree wavelet (EZW) and the set partitioning in hierarchical trees (SPIHT). Both encoders use a bit-plane coding scheme and the zerotree structure to compress the information and are claimed to provided higher PSNR than the baseline DCT JPEG at given bit rates [10], [11]. In addition, both the EZW and the SPIHT are embedded systems that can achieve the targeted bit rate exactly. Furthermore, the encoders do not have to send a code table in the encoded file because the decoders will generate the code table during the decoding process [11]. These properties allow both systems to perform progressive coding. Another wavelet system is the visual threshold system. It uses a predefined quantization level for each wavelet band [16]. This quantization scheme is similar to the baseline JPEG. Therefore, this system can be adapted to use the run-length coder of the baseline JPEG system with some

13 modifications. The choices above present alternatives for image compression. All transform cod- ing systems may achieve the same PSNR and bit rate but at different costs. Since the system consists of three functional blocks: the transform, quantizer, and entropy coder, the performance of each system may depend on one particular block or the combination of the blocks. It is useful to compare the PSNR gain for each type of transform, quantizer, and entropy coder independently. The PSNR gain of the transform block can be compared by using the same type of the quantizer and the entropy coder for all transforms. The PSNR gain, as a result, is influenced mainly by the transform block. The comparison of quantizers can be done by restricting the choice of transform and entropy coder to be the same for all compared systems. The comparison of entropy coders can be done in a similar manner. The results of these comparisons should reveal the optimal encoding scheme for each transform. This thesis compared several transform coding systems in terms of their system complexity and peak signal-to-noise ratios (PSNR) at given bit rates. The tested transforms included the discrete cosine transform (DCT), the lapped orthogonal transform (LOT), and the discrete wavelet transform (DWT). The tested quantiz- ers included the optimal uniform quantizer, the JPEG uniform quantizer, the visual threshold quantizer, and the embedded zerotree wavelet (EZW). Finally, the tested entropy coders included the Huffman coder, the adaptive Huffman coder, and the run- length Huffman coder. The system complexity was compared in terms of number of additions and multiplications. This thesis focused primarily on the transform block for the complexity comparison. However, comparisons of quantizers and entropy coders were also included. Selected combinations of these three components were used to study the influence of each component on the PSNR performance. Finally, four systems were studied further to compare overall system performance including the visual quality of reconstructed images. They were the baseline DCT JPEG, the baseline LOT JPEG, the visual threshold wavelet with the run-length Huffman coder, and the EZW with the adaptive Huffman coder. In all comparisons, seven standard test images were used, including Lena and Barbara.

14 This thesis is organized as follows. Chapter 2 presents background and algorithm implementation of the functional blocks used in this thesis. Chapter 3 presents lists of comparison methods and corresponding tested systems. In Chapter 4, the results are presented and discussed, Finally, the thesis is concluded and further studies are proposed in Chapter 5.

15 Chapter 2

Background

This chapter presents brief background and algorithm implementation of all compo- nents of the still image compression used in this thesis. A simple transform coding system consists of three fucntional blocks: transform, quantization, and entropy cod- ing. A block diagram of a simple encoder/decoder system is shown in Figure 2-1 below.

original Entropy compressed S Transform Quantization Cdn mg image Coding image

(a) reconstructed Inversed Entropy compressed image image Transfom Dequantization Decoding

(b)

Figure 2-1: Block diagram of a basic transform coding system for still image copmression (a) The encoding part of the system. (b) The decoding coun- terpart of the system

An original image is passed through the transform block that outputs transform coefficients. The quantizer then reduces the coefficients to fewer numbers or symbols.

16 Finally, the entropy coder translates those numbers or symbols into a stream of binary in order to be stored or transmitted. In this thesis, lists of all components in the simulation are shown as follows.

" Transform:

(a) Discrete Cosine Transform (DCT)

(b) Lapped Orthogonal Transform (LOT)

(c) Discrete Wavelet Transform (DWT)

" Quantization:

(a) Optimal Uniform Quantizer

(b) JPEG Uniform Quantizer

(c) Visual Threshold Wavelet Quantizer

(d) Embedded Zerotree Wavelet Quantizer (EZW)

* Entropy Coding:

(a) Huffman

(b) Adaptive Huffman

(c) Run-Length Huffman

The quantizers and coders listed above may be specifically designed for particular transform coefficients. Some modifications are required in order to use the same quantizer or entropy coder for different transforms. The modifications are described in the background section of that particular algorithm.

2.1 Transform

The transform block is used to remove redundancy of the information of the input signal, an image in this case [1], [4], [8]. The image signal is projected onto a partic- ular set of basis functions. In general, the basis functions are orthonormal in order

17 to minimize the redundancy in the representations. In this thesis, all transforms are either orthogonal or nearly orthogonal because of the advantages of fast algorithms. Furthermore, all transforms are separable, meaning the transform can be performed on each dimension independently. This property reduces the complexity of the im- plementation significantly. The separable 2-D transform can be computed according to the diagram shown in Figure 2-2 below. There are three transforms used in this thesis: the DCT, the LOT, and the DWT. The details of each transform are discussed in the sections below. In addition, there are some conventions of the flowgraphs used in this thesis. All conventions are shown in Figure 2-3 below.

input Row Row 2-D transformed image - Transform Transpose Transform Transpose

(a) reconstructed Inversed Inversed 2-D transformed Row Transpose Row Transpose : a signal Transform Transform image (b)

Figure 2-2: Block diagram for a separable 2-D transform

a a+b a a-b a c c*a

b b

Figure 2-3: Flowgraph conventions

2.1.1 Discrete Cosine Transform

The discrete cosine transform (DCT) is an orthogonal block transform. It projects each block of the input signal onto a set of truncated, sampled cosine waveform. The computation of the DCT coefficients can be done as follows. Let M be the block length, k be the index of the basis function, and n be the sample index, the basis

18 functions of the 1-D DCT are given by

= ] Cos (nk+ ) k ank ; O

r- ; k=O c[k] 2 (2.2) 1 ; otherwise.

First four basis functions of the 1-D DCT are shown in Figure 2-4 below.

(a) (b) 0.5

0 0 T

-0.5 -0.5 p ) 2 4 6 E 0 2 4 6 8

(c) (d) 0.5( 0.5

0 -T- 0 '1111.' -0.5 -0.5 0 2 4 6 8 0 2 4 6 8

Figure 2-4: First four basis functions of the 1-D DCT for M=8

The 2-D DCT is a separable transform. The 2-D transform can be done as previ-

19 ously shown in Figure 2-2 above. In the case of one dimensional transform, the DCT coefficients, X[k], can be calculated as follows. Let x[n] be an input signal indexed by n and M is the DCT block length, X[k] is given by

2 M-1 Ik X[k] = c[k] [n] Cos (n + 2) 0 k< M-1, (2.3) n:=O where

-k0 c[k] =- v' 1 ; otherwise.

The inverse discrete cosine transform (IDCT) is given by

V22 M1 [1k 7r] 0O

2.1.2 Lapped Orthogonal Transform

Although the DCT has been employed extensively in still image compression, the DCT system exhibits blocking artifact at low bit rates. The lapped orthogonal transform (LOT) was developed to minimize this artifact. The causes of the blocking

20 1/(2sqrt(2)) x[O] m[0 n[O] n[0 X[0] 1/(2sqrt(2)) x[1] m[1 n[1] n[1------X[4] x[2] m[2 - -- - n[2] n[2] (C2)/2 X[2] (S2 (S2)/2 x[3] m[13 ------n[3] n[3 --- - X[6] x[4] - - m[4 m[4] n[4] p[4 (Cl)/2 X[1] (S1)/2 (S1)/2 x[5] -- m[5 m[5] n[5] p[5 ----- X[7] 1/sqrt(2) (C 1)/2 x[6] ---- m[6 m[6 n[6]1 n[6 ------p[6 (C5)/2 X[5] 1/sqrt(2) (S5)/2 (S5)/2 x[7]------m[7 m[7 - n[7] n[7 ------p[7 - (C5)/2 X[3]

Figure 2-5: Flowgraph of Fast DCT for M=8 Ci represents cos( ) and

Si represents sin( ).

Table 2.1: Computational costs of the fast DCT, M=8

# Additions # Multiplications

1-D, 8-point DCT 26 16

RxC, 2-D DCT 13RC 4RC 2

effect can be divided into two categories. First, the DCT bases are short, non- overlapped, and discontinuous at the edges. Second, the DCT system transforms each block independently. The LOT eliminates this artifact by forcing the bases to decay to zero at both edges and overlapping with a neighboring transform block [7], [14]. In this thesis, the overlapped part was half of the block length and started at the middle of the preceding block. The general structure of LOT is shown in Figure 2-7. In order to make the LOT an orthogonal transform, all the bases must form an orthonormal set. Furthermore, the overlapped portion must be orthogonal to all bases

21 1/(2sqrt(2)) X[O] n[] n0n[] m[O] m[O] x[0] 1/(2sqrt(2)) X[4] --- - - n[1] n[1] m[1] m[1] x[1] (C2)/2 X[2] n[2 n[2] m[2] m[2] x[2] (S2)>: (/2 X[6] -- - n[3 n[3] ------m[3] m[3] x[3]

X[1] p[4] n[4] (C1)/2 m[4] m[4] - x[4] (S1)/2 (S1)/2 n[5 ------m[5] m[5] -- x[5] X[7] p[5 (C 1)/2 X[3] p[6] 1/sqrt(2) p[6 ------n[6] (C5)/2 m[6] m[6] - - - - x[6] /sqrt(2) 5)/2 - - X[5] -p[7] p[7 ------n[7 -- (C- - m[7] m[7] - - - - x[7]

N'r Figure 2-6: Flowgraph of Fast IDCT for M=8 Ci represents cos( ) and

Si represents sin( ).

of the neighboring block [5]. It is not practical to use the original version of the LOT because there was no fast algorithm available. However, the nearly orthogonal has a fast algorithm. This type of LOT, called the type-I, fast LOT, uses bases of DCT as building blocks for its bases. This algorithm requires few additional computations beyond the existing DCT algorithm [7]. The LOT coefficients can be calculated as follows. Let M be the length of a transform block, V is the overlapped length, where M - 2V. The transform pair is given by

X = PTX (2.5) and

x = PX, (2.6) where P is the basis function matrix whose size is MxV. x is an input vector of

22 -2M+1 -M -M+1 0 1 M M+1 2M I I 2M -2M+1 01 M M+l x[n]

P T Direct LOT p T T P

Inverse LOT P P P

-2M+1 -M -M+1 0 1 M M+1 2M x[n]

Figure 2-7: General structure of the LOT In this structure, the overlapped portion is a half of the block length. PT and P are the transform and the inverse transform operator respectively. length M. The basis function matrix, P, for the fast algorithm is given by

P = P0Z, (2.7) where P is the MxV matrix and Z is the orthogonal matrix of size VxV. The matrix Po is given by

1 De Do De - Do PO= (2.8) J(De - Do) -J(De - Do)

De and Do are the even and odd functions of the DCT bases. J is an anti-identity matrix. Z is approximated in the fast algorithm as

I 0 Z ~ ,7 (2.9) 0 Z

23 where Z is a matrix of size V by v. The matrix Z is defined as

Z TOT 1T2 ... Ty- 2, (2.10) where matrix T is an m by ! matrix. It is defined as

1 0 0

Ti= 0 Y(0j) 0 . (2.11) 0 0 I

Y(Oj) is a rotational matrix in the position (i, i) of the matrix T. Y is a 2x2 matrix and is defined as

Y(00 cos Oi sin Oi (2.12) - sin Oi cos O6 where Oi is a rotation angle. In this thesis, the type-I, fast LOT had the block length, M, of 16 and the over- lapped length, V, of 8 because the 8-point fast DCT can be used as part of LOT algorithms. The matrix Z is equal to TOT 1T2 . The three angles for matrix Y(0j) are [0, 01, 02] = [0.137r, 0.167r, 0.137r] for the optimal coding gain, and [00, 0 1, 02] = [0.1457r, 0.177r, 0.167r] for the QR-based quasi-optimal LOT [5]. This thesis used the angle for the optimal coding gain. The first four basis functions of the type-I, fast LOT for optimal coding gain with the block length of 16 samples and overlapped portion of 8 samples are shown in Figure 2-8 below. The implementations of type-I, fast LOT block transform and inverse transform are shown in Figure 2-9 and 2-10 respectively. The LOT programs can be found in [6]. In addition, all figures of the LOT system were reproduced with the permission of Henrique Malvar. In the case of a finite length signal, the beginning block and the ending block must be modified to support the non-existing overlapping part. It is done by reflecting few samples of the beginning and the ending block outside the signal. Then the reflected parts are treated as part of the signal. In this thesis, only first and last four samples

24 (a) (b) 1 1

0.5 0.5 0(D

0 0

-0.5 -0.5

-1 -1 0 5 10 15 0 5 10 15

(c) (d) 1 1 0.5 -T iI OT T T 0.5 TI 0 0 0 jj jc - -0.5 ii jj -0.5 -1 -1 0 5 10 15 0 5 10 15

Figure 2-8: First four basis functions of the type-I fast LOT, for M = 2V, V = 8 were reflected in order to compute the 8-point DCT of the first and the last block. As a result, only the even DCT coefficients are non-zero and the algorithm uses only the non-zero coefficients to compute the LOT coefficients. The type-I, fast LOT of a finite length signal is shown in Figure 2-11. The computational costs for the type-I, fast LOT are summarized in Table 2.2, where R and C are image dimension. In this thesis, both R and C are assumed to be divisible by 8. The computational costs for the whole image take into account the half length DCT of all edges of the transformed image.

25 br 0 x [0] 0-4 0 0 r b x [1] - 1 2 r b x [2] w--- 2 4 r b x [3] 3 6 Sb DCT x [4] b 4 1 X[0] b x r[5] 5 3 X[2] x [6] b 6 5 X[4] r b x [7] - 7 7 a r b ---- X[6--][1 X [+ 0 0 a 0] 0 X [ 1 xr+1t] * b 1 2 - - -S X[3] x r+12] -b 2 4 - -- -X[5] r+1 3 6 X[7] b DCT Cos xr+ 14] 4 1 b r+151 5 3 "r+11 * b -sinei 6 5 __1. "r+17 7 7 Cos

Figure 2-9: Flowgraph of the type-I fast LOT, for M = 2V, V = 8

2.1.3 Discrete Wavelet Transform

The discrete wavelet transform (DWT) uses the wavelet expansion to represent the signal in different time scales or spatial resolutions. The DWT is a series expansion of a finite length signal. The expansion consists of an approximation and a wavelet or detail. The wavelet expansion can be implemented by a filter bank. The derivation and detailed explanation can be found in [2], [13], and [12]. The filter bank algorithms have been well known for a long time. Therefore, the development cost for the DWT algorithm using the filter bank is practically low. There are two stages for the DWT system. The transform process of the DWT is called an analysis stage. The inverse DWT is called a synthesis stage. The analysis stage separates the input signal into a set of octave-band frequency bands, whereas the synthesis stage reconstructs the signal from DWT coefficients. DWT coefficients

26 b 0 0 x r [0] b 2 1 x [1] b 4 2 Xr[2] b 6 3 - Xr[3] IDCT b X[0] 1 4 x r [4] b X[2] 3 5 xr[5] b X[4] 5 6 x r [6] - - X[6] ------7 7 b x r [7] a - b X[1] - - 0 0 - Xr+i[0] b 2 1 ---4 x [1 - - b r+1 X[5] 4 2 ---4 x [2] b r+1 X[7] ------6 3 -0 x [3] IDCT b r+1 1 4 x [4] -- 4 r+1 3 5 b x [5] 0i~ 0 -4 r+1 -sin 0.- 5 6 x [6] 1 r+1 7 7 x [7] r+1 cos 0

Figure 2-10: Flowgraph of the type-I fast ILOT, for M = 2V, V = 8 can be calculated as follows. The input signal, x[n], is passed through two filters: a low-pass filter and a high-pass filter. Ideally, the cut-off frequency of both filters should be at . Then the output signal of both filters are decimated by a factor of two. To further divide the frequency band, the output of the fist stage can be passed through the same set of filters. However, the distribution of DCT coefficients of a normal image consists of mostly low frequency components. Therefore, only the output of the low-pass filter from the first stage is used as the input to the second stage filter banks. At the second stage, the length of input signal is half of the original length. The process can be repeated many times as long as the length of the input signal is longer than or equal to the length of the longest filter. Furthermore, the computational costs of the DWT increase according to number of levels or stages that the image is passed through. During the synthesis, the synthesis filters undo

27 2 1/2 W He LOT of Block 1 0-E1/2 1E Block 1 DCT 1/2 LOT of B lock 2 ------..... - 1/2 e -E I -e Block 2 D C T :...... 1/J2 ...... 0 -- - LOT of Block 3 1/2 E --- Z Block 3 D C T ...... 0

1/2 fV 0 -E --- Z -- DCT 1/2

Block M\ 2 1/2 LOLOT oof JHe Z Block M

Figure 2-11: Flowgraph of the type-I, fast LOT for a finite length signal The LOT runs from left to right without the factor 2 after He and JHe. The inverse LOT runs from right to left. E is a set of even DCT coefficients and 0 is a set of odd DCT coefficients. the analysis part by combining the highest level first, and then reconstructing the signal in the lower level. The structure of the 2-level analysis and synthesis DWT and the corresponding frequency bands are shown in Figure 2-12 below. In addition, the 2-D DWT is also separable. Therefore, the 2-D DWT can be calculated in each dimension independently, as previously shown in Figure 2-2 above. After the 2-D transformation of the image, the coefficients are organized in a certain way. An example of the organization of the 3-level DWT coefficients is shown in Figure 2-13 below. The DWT coefficients also depend on the type of filter used. There are two kinds of filters: orthogonal and biorthogonal. The orthogonal filters are asymmetric and have

28 Table 2.2: Computational costs of the type-I, fast LOT, M = 2V, V = 8

# Additions # Multiplications single block, 1-D 48 28 type-I, fast LOT, M=16 RxC Image 2-D C) type-I, fast LOT 12RC - 18(R + C) 7RC - 4(R +

non-linear phase in the frequency response. The non-linear phase creates distortion or artifact in the reconstructed image, which is undesirable for image processing. On the other hand, the biorthogonal filters are symmetric and have linear or zero phase in the frequency domain. Therefore, it is desirable to use linear phase FIR filters for image processing. This thesis used 9/7-tap Villasenor biorthogonal filters [15]. The coefficients of both filters for the low-pass version are shown in Table 2.3 below.

Table 2.3: Coefficients of 9/7-tap Villasenor biorthogonal filters

Length Coefficients 0.03828, -0.023849, -0.110624, 0.377402, 0.852699, 9_ 0.377402, -0.110624, -0.023849, 0.03828 -0.064539, -0.040689, 0.418092, 0.788486, 0.418092, -0.040689, -0.064539

The orthogonality in the biorthogonal system is preserved by the relationships between the analysis filters and the synthesis filters. The relationships among these four filters are

ga[n] = (-1)"hs[1 - n] (2.13)

and

g,[n] = (-1)nha[1 - n] (2.14)

29 Input Output a9- 2 Signal Signal

ha 2-- a 2 D2S 2 s - e s

C2: 2 _h

Analysis Synthesis

jH(w)l

C2 D2 DI 1

pi/4 pi/2 pi

Figure 2-12: Structure of 2-level, 2-band analysis and synthesis for the 1-D DWT and the frequency band to which the output of each filter bank corresponds ga is a high-pass analysis filter. ha is a low-pass analysis filter. g8 is a high-pass synthesis filter. h, is a low-pass synthesis filter. where g, is a high-pass analysis filter, ha is a low-pass analysis filter, g, is a high-pass synthesis filter, and h, is a low-pass synthesis filter [2]. In this thesis, the DWT algorithm was derived from the WaveLab802 MATLAB package from Stanford university. The programs can be found in [3]. Parts of the pro- grams were translated into C programs to reduce the simulation time. The MATLAB programs were used for verification purpose. The computational costs for the algorithm are given in two types: the circular convolution algorithm and the minimum limit. The fist one is the circular convolution algorithm, which was used in this thesis. The second one is the minimum limit, which has lower computational costs by exploiting the symmetry of the biorthogonal filters.

30 LL3 HL3 HL2 LH3 HH3 HLI

LH2 HH2

LHl HHi

Figure 2-13: Organization of 3-level DWT coefficients

The computations, especially multiplication, can be reduced significantly by reusing the the previous results. Given the filter length, F, only are distinct values 2 for the odd-length symmetric filters. Let the length of the filters be F and F2, where

F = F + F2, the computational costs for both cases are summarized in Table 2.4 below. These costs were calculated for the odd-length biorthogonal wavelet filters only. However, the cost of the even-length filters should be similar.

2.2 Quantization

The quantization block is used to limit the range of transform coefficients. This block gives the compression gain for the system. However, it introduces loss in the system. There are many quantization schemes used in the lossy image compression. This thesis used four quantizers, listed as follows.

31 Table 2.4: The computational costs of L-level DWT using biorthogonal filters for image size RxC Define variables Ka = RC(F - 2), Kb= RCF, and Ke = RC(F + 2).

Thesis Minimum Level Additions Multiplications Additions Multiplications

1 1 Ka Kb Ka 2 2 Ke 5 5 5 5 2 -Ka -Kb -Ka -Kc 4 4 4 8 21 21 21 21 3 Ka -Kb Ka -K 16 16 16 32 85 85 85 85 4 Ka 64 64 128

L (1 L 4L L 4(1 - (1))L Ka Kb Ka 21 3 K 3 --- 1 3 3 3

(a) Optimal Uniform Quantizer

(b) JPEG Uniform Quantizer

(c) Visual Threshold Uniform Quantizer

(d) Embedded Zerotree Wavelet Quantizer (EZW)

The following sections explain algorithms, advantages, and disadvantages of the above quantizers. It should be noted that certain quantizer, such as the JPEG uniform quan- tizer, is specifically designed for the block-based DCT coefficients. Some modifications were made in order to adapt these quantizers to work with LOT coefficients. The modifications are explained in more detail in the section of that particular quantizer.

32 2.2.1 Optimal Uniform Quantizer

This quantizer is designed for a specific set of transform coefficients in order to minimize the mean square error (MSE). This quantizer is constructed from the statis- tics of the transform coefficients. Theoretically, it should give the smallest MSE which indicates the best performance according to the PSNR value used in this thesis. This quantizer was used in order to provide a fair comparison among all transform coding schemes because it is not optimally designed for any particular transform. In order to apply this quantizer to the coefficients of DCT, LOT, and DWT, there are three factors to be considered. First, how many quantizers are necessary. Second, which quantizer does each coefficient use. Finally, how to distribute the bit resources for each quantizer. To answer these questions, let us look at the derivation and the organization of transform coefficients. The DCT and the LOT are block transforms whereas the DWT is not. The DCT and the LOT coefficients are arranged in a block of size 8 by 8 in this thesis. Each coefficient in this 8x8 block corresponds to different basis functions in the 2-D transform. Furthermore, the coefficients that are located at the same location in the 8x8 block of different blocks correspond to the same basis function. Therefore, it is reasonable to use the same quantizer for each coefficient of the same basis function. As a result, there are 64 different quantizers for DCT and LOT transform coefficients because there are 64 distinct frequencies. In the case of the DWT, the coefficients are organized in the frequency bands. Similarly, wavelet coefficients in different bands use different quantizers. Given L-level DWT, there are 3L + 1 distinct quantizers. The bit distribution problem can be solved by the rate-distortion theory as de- scribed in [1]. Given the average bit rate, B, the bit allocated to the ith quantizer, bi, is

1 o.2 bi= B + 1og 2 N, (2.15)

.k=1 .

33 where ao is the variance of the coefficients in the ith group, and N is the total number of groups, i.e. 64 for the DCT and the LOT. Next, the width of each bin or the quantization level, qi, can be computed by

qi = k max,(IAi (2.16) 2bi where max(IAil) is the maximum magnitude of the ith group, bi is the number of bits allocated for the ith group, and k is the scaling factor, which can be used to change the final bin width and adjust the bit rate. This scaling factor does not effect PSNR but enables the simulation to adjust the bit rate close to the desired value. Finally, the quantized coefficients, j, is calculated by dividing each input coefficient by the corresponding quantization level, i.e.

a = - (2.17) Ci qj

The advantage of using this quantizer is that the quantizer is symmetric around zero, also called flat-zero [1]. This property would benefit the system if the coefficients have zero mean value because the distribution of the coefficients would be symmetrical about zero. There are encoders that can take advantage of this kind of distribution. Details of the coding schemes are presented in the next sections.

2.2.2 JPEG Uniform Quantizer

This quantizer is similar to the optimal uniform quantizer but it is specifically designed for block-based DCT coefficients. The JPEG standard recommends the quantization level for each frequency in the transformed block. These levels are derived from experimental results based on of many images and subjects in order to give the best visual quality for a given bit rate [1], [9]. This thesis used the following

34 quantization table for the black & white image.

16 11 10 16 24 40 51 61 12 12 14 19 26 58 60 55 14 13 16 24 40 57 59 56 14 17 22 29 51 87 80 62 Q = (2.18) 18 22 37 56 68 109 103 77 24 35 55 64 81 104 113 92 49 64 78 87 103 121 120 101 72 92 95 98 112 100 103 99

The top left hand corner corresponds to the quantization level for the DC compo- nent. The bottom right hand corner is the quantization level for the highest frequency component of the transform coefficients in 2-D. This table is the recommended quan- tization levels for the luminescence component according to the JPEG standard [9]. Although this quantizer is specifically designed for the DCT coefficients, the LOT coefficients might be able to use this quantization matrix because the LOT uses the DCT as part of its building block for bases. Therefore, this thesis compared the performance of the DCT system and the LOT system using this quantizer. The quantized coefficient, c3 , is computed by a division operation as in equation (2.17).

2.2.3 Visual Threshold Wavelet Quantizer

This quantizer is intended to preserve the visual quality of the reconstructed image for the DWT coding system. The development of this quantizer was similar to those of the JPEG uniform quantizer. The quantization levels depend on the experimental results of the DWT coefficients. They also depend on the type of wavelet filter and number of levels of the DWT structure. In this thesis, only 9/7-tap biorthogonal filters were used. The DWT coefficients that belong to the same frequency band share the same quantizer. There are three bands at each DWT level with an exception of the coarsest level which has four bands. In other words, given the number of DWT levels,

35 L, there are 3L + 1 different quantizers. The quantization level, QL,O, for each DWT orientation and each DWT level is given as follows. The subscripted '0' refers to the orientation which is the same as frequency band {LL, LH, HL, HH}.

(o 2 QL,O k 2 a1O [log )J (2.19) AL,O where

" AL,O : the basis function amplitude

" a empirical value = 0.495

Sko: empirical value = 0.466

* fo empirical value = 0.401

e go : orientation parameter, JHL = 9LH = 1, 9LL 1.501, and gHH= 0.534

" r output resolution (pixel/degree)

" L: number of DWT levels

* k scaling factor for adjusting quantization levels and bit rate

In the case of the 9/7-tap biorthogonal filters, values of AL,O and QL,O are shown in Table 2.5 and 2.6 respectively.

Table 2.5: The basis function amplitudes, AL,O, for 9/7-tap biorthogonal wavelet filters

Orientation 1 1 2 Level(s) 4 LL 0.62171 0.345374 0.18004 0.0914012 LH 0.672341 0.413174 0.227267 0.117925 HL 0.672341 0.413174 0.227267 0.117925 HH 0.727095 0.494284 0.286881 0.152145

36 Table 2.6: Quantization levels for 9/7-tap biorthogonal filters The output resolution is set at 32 pixel/degree.

Orientation _Level(s) ____a__ 1 2 3 4 LL 14.049 11.106 11.363 14.500 LH 23.028 14.685 12.707 14.156 HL 23.028 14.685 12.707 14.156 HH 58.756 28.408 19.540 17.864

The quantized coefficient is computed by dividing the DWT coefficients with the corresponding quantization level. According to the quantization table given above, the coefficients in the higher frequency band are quantized more heavily than the low frequency coefficients. This property is similar to the quantization for the JPEG system. Models and development processes of this quantizer can be found in [16].

2.2.4 Embedded Zerotree Wavelet Quantizer

The embedded zerotree wavelet (EZW) quantizer combines the bit-plane encoding and the zerotree structure to compress the data. The zerotree structure captures re- lationships among the magnitude of the DWT coefficients across different levels. The bit-plane part extracts each plane of bits, and the encoder searches for zerotree struc- tures and encodes them into symbols. The combination of the EZW and an adaptive arithmetic coder has been claimed to achieve higher compression than the baseline JPEG algorithm [11]. Due to the time constraint and unavailability of the arithmetic coder, the adaptive Huffman coder was used in this thesis. The implementation of the EZW is described below. More details can be founded in [11]. The terms used in the EZW algorithm are given as follows. parents-descendants The relationship of the spatial location between the DWT coefficients of the different level. Given the parent's coordinate (i, j), L-level DWT, and image size of RxC, positions of the descendant are {(4i, 4j), (4i + 1, 4j), (4i, 4j + 1), (4i + 1, 4j + 1)} if (ij) is not in the LL-band, and {(i +

37 R 2 + R + C if (i,j) is in the LL-band, where L is the number of the DWT level. Examples of parent-descendants of 3-level DWT are shown in Figure 2-14. significant: The DWT coefficient X[k] is significant if and only if IX[k] ;> T, where T is the current threshold. insignificant: The DWT coefficient X[k] is insignificant if IX[k]I < T, where T is the current threshold. zerotree root (Z): The DWT coefficient X[k] is a zerotree root if X[k] and all its descendants are insignificant. isolated zero (I): The DWT coefficient X[k] is an isolated zero if X[k] is insignifi- cant and at least one of its descendants is significant. positive (P): The DWT coefficient X[k] is positive if X[k] is significant and positive. negative (N): The DWT coefficient X[k] is negative if X[k] is significant and neg- ative. dominant list: List of DWT coefficient that have not been found significant. subordinate list: List of DWT coefficient that have been found significant.

The process of the EZW can be divided into two steps: the dominant pass and the subordinate pass. The dominant pass compares all coefficients in the dominant list with the current threshold and searches for zerotree structure. On the other hand, the subordinate pass transmits the next bit of the coefficients that have been found significant. The coding begins with the dominant pass by selecting the initial thresh- old, To, such that max(IX[k]I) < 2To. The EZW starts comparing each coefficient from the highest level down to the lowest level. Within the same level, the EZW scans through all frequency bands according to the following order, {LL, HL, LH, HH}. The output symbols are coded as one of the following five symbols, {P, N, I, Z, EOB}. The first four symbols are defined above. The EOB symbol is the end of block

38 ......

...... e f ...... d g h ......

......

...... j ...... m ... q .r ...... P V S

...... y .z ...... u V ...... w x

Figure 2-14: Locations of parent-descendants of the 3-level EZW The parent coefficient a, in the LL-band, has b, c, and d as its descendants. The coefficient b is the parent of e, f, g, and h. All of them reside in the HL-band but in the different level.

39 symbol, which is the same as in the JPEG system. It can be used to indicate the termination of the encoding process. If a coefficient is significant, it is removed from the dominant list and put in the subordinate list. Once all coefficients are compared with the current threshold, the subordinate pass sends the next lower resolution bit of all coefficients in the subordinate list. The output of the subordinate pass is a binary bit, 0 or 1. After the subordinate pass finishes, the current threshold is divided by a factor of two. This threshold is used in the next dominant pass. More details about the EZW can be found in [11]. According to the statistics, if the parent is insignificant, it is likely that all its descendants are also insignificant [11]. At high enough threshold, it is likely to find a lot of zerotree root symbols. As a result, the run-length encoder could take advantage of the long streams of zerotree root symbols. Furthermore, there are only seven symbols in the system, namely {P, N, I, Z, EOB, 0, 1}. The adaptive arithmetic encoder may be more efficient due to the small set of symbols [11]. The EZW may achieve high compression, but the zerotree searching and the re- computation of the code table are the bottle neck of the algorithm used in this thesis. Future works can be done to improve the EZW. Another improved version of the EZW is called the set partitioning in hierarchical trees (SPIHT), which can be found in [10]. Due to the time constraint, the SPIHT was exempted from this thesis.

2.3 Entropy Coding

The entropy coder translates values or symbols into a string of binary bits. Then the output can be stored or transmitted in a digital format. Three encoders used in this thesis are

(a) Huffman

(b) Adaptive Huffman

(c) Run-length Huffman

The following sections describe each encoder briefly.

40 2.3.1 Huffman Coding

The Huffman coding is a variable length coder. It computes the minimum bits to represent each symbol according to its probability. This coding method can give the expected code length close to the entropy of the system [1]. In this thesis, the Huffman coder is used for all transform coefficients. For DCT and LOT, there are two Huffman tables, one for the DC coefficients and the other for the AC coefficients. In the case of DWT, one Huffman table is used for the coefficients in the LL-band, whereas a second table is used for the rest of the coefficients. This Huffman table is computed directly from the statistics of the coefficients. Therefore, it is image specific. This coder was used to compare the effect of the transform and the quantizer because it is the common coder for all transforms.

2.3.2 Adaptive Huffman Coding

The adaptive Huffman coder is an adaptive version of the Huffman coder. The general concepts are the same as the Huffman coding, but the code table is updated as the coding progresses. This algorithm could improve the compression ability of the Huffman coder because the coder has the updated statistics when the symbol is coded. However, the disadvantage of this algorithm is speed. The adaptiveness requires the re-computation of the code words. Therefore, it slows the system down as mentioned in the EZW section.

2.3.3 Run-Length Huffman Coding

The run-length Huffman coder combines the regular Huffman coding with the modifications of the quantized coefficients to achieve higher compression. This coder is the standard coder used in the baseline JPEG. This coder separates the coefficients into two parts: DC and AC. Each type is coded with different methods. The general concepts can be described as follows. The DC coefficients have a very large range. For example, 8-bit data, the 8x8 block DCT can give the DC coefficients in a of [-2047, 2047]. This range requires 12

41 bits to represent. However, the value of DC coefficients of the adjacent blocks are very close to each other because most image are smooth and does not change abruptly. The DC coder part uses the differential pulse code (DPCM) to compute the first difference, and then encodes these differences. The Huffman code word for the DC coefficients can be separated into two parts: the category and the residue. The category determines the range of the magnitude, while the residue determine the sign and the resolutions of the coefficients [1], [9]. The Huffman table for the DC coefficients of the DCT JPEG can be found in [9]. According to the statistics, the quantized AC coefficients of the DCT are likely to be zeroes at high frequencies [1], [9]. The run-length coder counts the maximum number of zeroes before encountering a non-zero coefficient. The scanning method used for the AC coefficients is called zig-zag scan [1], [9]. The zig-zag scan is shown in Figure 2-15 below. The maximum number of zero-run code word is 16. The end-of- block (EOB) is used if the rest of the scanning coefficients are zeroes. The run-length Huffman table for the AC coefficients can be found in [9]. The JPEG run-length Huffman coder is shown in Figure 2-16 below. This coder is designed for the DCT coefficients. However, the LOT coefficients share similar organizations and properties. Therefore, the run-length coder can be adjusted for the LOT system. Few modifications must be made to accommodate the higher range of the LOT coefficients in both DC and AC coefficients. In the case of the DWT system, the coefficients in the LL-band are treated as the DC coefficients, and the other bands are treated as the AC coefficients. This quantizer was used with the optimal uniform quantizer and the visual threshold quantizer for the DWT system. The code table for the DWT system is computed from the statistic of the coefficients of that transformed image. Although it is not a universal encoder, it provides a method to compare the visual threshold system with the current JPEG system.

42 Figure 2-15: Zig-zag scan of the run-length Huffman coder

DC Category - residue DPCM coefficients Huffman Coder Encoded MUX 3 Bit stream AC Zig-zag Run-length coefficients Scan Huffman Coder

Figure 2-16: Flowgraph of the run-length Huffman coder

43 Chapter 3

Simulation Methods

This chapter explains the simulation and comparison processes of all transform coding systems used in this thesis. The simulation imitated all functional blocks in the systems, which consists of the transform, the quantizer, and the entropy coder. A list of systems used in this thesis is shown in Table 3.1 below.

Table 3.1: List of tested transform coding systems

# Transform Quantizer Entropy Coder 1 DCT Optimal Uniform Huffman 2 LOT Optimal Uniform Huffman 3 DWT Optimal Uniform Huffman 4 DCT Optimal Uniform Run-length Huffman 5 LOT Optimal Uniform Run-length Huffman 6 DWT Optimal Uniform Run-length Huffman 7 DCT JPEG Uniform Run-length Huffman 8 LOT JPEG Uniform Run-length Huffman 9 DWT Visual Threshold Run-length Huffman 10 DWT Embedded Zerotree Wavelet Adaptive Huffman

The simulation program can be configured to run all ten systems. Details of each component in the systems can be found in the Chapter 2. However, the modifications were made to make each type of quantizer and entropy coder work with each transform coefficients. Brief descriptions of each system are summarized as follows.

44 (a) The first three systems, (1-3), used the same type of quantizer and the entropy coder. The quantizer and the entropy coder were computed according to the statistics of the coefficients and the quantized coefficients respectively. Although these systems are not practical, they are helpful for investigating the effect of the quantizer and the coder on the PSNR performance. Lists of comparisons are shown in the next sections.

(b) The next three systems, (4-6), differed from the first three systems at the en- coder block. The thesis used this difference to test effects of the coder on the PSNR. In addition, the run-length Huffman coder for the DCT is used in the baseline JPEG standard as described in [9]. In a case of the LOT system, the code table was expanded to accommodate larger range of coefficients. On the other hand, the run-length coder for the DWT system was computed from the statistics of quantized coefficients because there was no standardized run-length coder for the DWT system.

(c) The next three systems, (7-9), used the same type of quantizer and encoder: the universal uniform quantizer and the run-length Huffman coder respectively. Together with the run-length coder, the DCT system imitated the baseline JPEG, while the LOT system attempted to simulate the baseline JPEG-like coder. The DWT system that used the visual threshold quantizer and the run-length coder represented the baseline JPEG-like coder for the wavelet.

(d) Finally, the EZW system uses a different approach to compress an image. One systematic comparison between this system and other systems was to use the PSNR and bit rate. This system was compared against the baseline JPEG-like coder to compare the PSNR performance of the last four systems.

The system evaluations were divided into three parts: the system complexity, the system performance in terms of the PSNR and bit rate, and the visual quality. Each comparison investigated the effects of one or more functional blocks in the system. Details of each comparison are given in the sections below.

45 3.1 Part I: System Complexity

The system complexity is an indicator of the cost of running the system. The system consists of three functional blocks: transform, quantizer, and entropy coder. The complexity of the transform was measured by the number of additions and mul- tiplications. The number of operations include all additions and multiplications for the transform of the whole image because only the DCT and the LOT are block transforms, whereas the DWT is not. The total costs show the amount of process- ing required for each transform. The complexity of quantizers and encoders were measured by the cost of running the algorithms. In this thesis, emphasis was placed on the complexity of the transform block. The quantizer blocked and the entropy encoder are briefly discussed to complete system comparisons.

3.2 Part II: System Performance

This part of the simulation evaluated the performance in terms of bit rate and PSNR. The simulation compared different transform coding systems that differed in the choice of transform, quantizer, and entropy coder. The purpose of this comparison was to evaluate the effect of each component of the system on the PSNR. The PSNR for the 8-bit image is given by

PSNR = 10 log1 0 i=N255'2 (3.1) ZE(X, - j) . i=1. where N are the total number of , xi is the original data, and the 'i is the reconstructed signal. The PSNR is related to the mean square error (MSE). Although the PSNR may not represent the visual quality directly, the PSNR is a systematic way to compare the error of the reconstructed signal and can be computed exactly. The system performance attempted to evaluate

(a) the effect of number of levels on DWT systems,

46 (b) the effect of transform,

(c) the effect of quantizer,

(d) the effect of entropy coder,

(e) and the overall system performance.

In order to evaluate these quantities, the comparisons were divided into multiple sections according to the above list. Details of each set of comparisons are explained below.

3.2.1 Part II-A: Effect of Number of Levels on DWT Systems

This part compared how the number of levels of wavelet expansion affected the system performance. Comparisons were done to determine the trade-offs between the computational costs of the DWT transform and the PSNR gain of the DWT system. A list of systems in this part is shown in Table 3.2 below.

Table 3.2: List of systems for comparing the effect of number of DWT levels on the PSNR performance

Transform Quantizer Entropy Coding 2-level DWT Optimal Uniform Huffman 3-level DWT Optimal Uniform Huffman 4-level DWT Optimal Uniform Huffman 2-level DWT Visual Threshold Run-Length Huffman 3-level DWT Visual Threshold Run-Length Huffman 4-level DWT Visual Threshold Run-Length Huffman 2-level DWT EZW Adaptive Huffman 3-level DWT EZW Adaptive Huffman 4-level DWT EZW Adaptive Huffman

3.2.2 Part II-B: Effect of Transform

This part compared the PSNR performance of different transforms by restricting the choice of quantizer and entropy coder. Because of these constraints, the PSNR

47 performance should reflect the effectiveness of each transform in terms of ability to extract necessary information from the image. In this section, the optimal uniform quantizer was used because it was the only common quantizer among three transforms. In addition, all transforms used either Huffman or the run-length Huffman for the coder. As described in the background section, the optimal uniform quantizer gave the best PSNR performance for a given set of coefficients. A list of systems in this section is shown in Table 3.3 below.

Table 3.3: List of systems for comparing the effect of transforms on the PSNR performance using the optimal uniform quantizer, the Huffman coder, and the run-length Huffman coder

Transform Quantizer Entropy Coder DCT Optimal Uniform Huffman LOT Optimal Uniform Huffman 3-level DWT Optimal Uniform Huffman DCT Optimal Uniform Run-length Huffman LOT Optimal Uniform Run-length Huffman 3-level DWT Optimal Uniform Run-length Huffman

3.2.3 Part II-C: Effect of Quantizer

This part compared the effects on the PSNR performance of each quantizer. Com- parisons were done by changing the quantizer block while keeping the transform and the quantizer the same. This thesis compared the optimal uniform quantizer with the JPEG uniform quantizer for the DCT and the LOT. In the case of the DWT, the thesis compared the optimal uniform quantizer with the visual threshold uniform quantizer. In all cases, the only common encoder that can be used in all system was the run-length Huffman coder. A list of systems compared is shown in Table 3.4 below. In addition, this thesis compared the simulated baseline DCT JPEG with the actual baseline JPEG using XV version 3.10a in the Unix platform to validate the simulated DCT JPEG system.

48 Table 3.4: List of systems for comparing the effect of quantizers on the PSNR performance using the run-length Huffman coder

Transform Quantizer Entropy Coder DCT Optimal Uniform Run-length Huffman DCT JPEG Uniform Run-length Human LOT Optimal Uniform Run-length Huffman LOT JPEG Uniform Run-length Huffman 3-level DWT Optimal Uniform Run-length Huffman 3-level DWT Visual Threshold Run-length Huffman

3.2.4 Part II-D: Effect of Entropy Coder

This part compared the effects on the PSNR of entropy coders. Comparisons were done by restricting the choice of transform and quantizer. Given the same symbols to be coded, the output bit rate should reflect the efficiency of the coder. Only two coders were compared in this thesis. They were the regular Huffman coder, and the run-length Huffman coder. The implementation details are in the background chapter. A list of systems compared is shown in Table 3.5 below.

Table 3.5: List of systems for comparing the effect of entropy coders on the PSNR performance using Huffman and run-length Huffman coders

Transform Quantizer Entropy Coder DCT Optimal Uniform Huffman DCT Optimal Uniform Run-length Huffman LOT Optimal Uniform Huffman LOT Optimal Uniform Run-length Huffman 3-level DWT Optimal Uniform Huffman 3-level DWT Optimal Uniform Run-length Huffman

3.2.5 Part II-E: Overall System Performance

This part compared the current JPEG standard which uses the baseline DCT JPEG with the baseline LOT JPEG system, the visual threshold wavelet system,

49 and the EZW system. The comparisons were targeted to test the DWT with the old JPEG standard and determined the trade-offs among four different systems. Four selected systems are shown in Table 3.6 below.

Table 3.6: List of selected systems for comparing the PSNR performance

Transform Quantizer Entropy Coding DCT JPEG Uniform Run-Length Huffman LOT JPEG Uniform Run-Length Huffman 3-level DWT Visual Threshold Run-Length Huffman 4-level DWT EZW Adaptive Huffman

3.3 Part III: Visual Quality

This comparison discussed the visual artifacts of each system. This thesis was not intended to provide the way to evaluate the visual quality of the reconstructed image. On the other hand, the thesis pointed out the dominant artifacts of each system at low bit rates because at high bit rates, 1 bit/pixel or more, the reconstructed image exhibits no artifact.

3.4 Test Images

Seven images were used in this simulation to reduce the image dependency of the comparisons. These images are black & white and have a resolution of eight bits. A list of images is shown in Table 3.7 below.

50 Table 3.7: List of test images

Dimension Image (pixels x pixels) baboon 512x512 barbara2 720x576 bfrag(barbara) 512x512 boat 256x256 goldhill 720x576 lena 512x512 peppers 512x512

51 Chapter 4

Results and Discussions

This chapter presents the results and discussions of the simulated systems according to the list of system comparisons described in the last chapter.

4.1 Part I: System Complexity

The evaluation of the system complexity was done in terms of computational costs of the algorithms. The evaluation was done for all functional blocks: the transform, the quantizer, and the entropy coder. This thesis focused primarily on the transform block. However, the quantizer and the entropy coder were also evaluated to complete the system.

4.1.1 Transform

The transform complexities were calculated in terms of number of additions and multiplications. The algorithm used for each transform is presented in the Background chapter. Given a RxC image, the computational costs of each transform are shown in

Table 4.1. In the DWT system, F is the sum of the length of both filters, F = F +F 2 . The DWT filters used in this thesis were the 9/7-tap biorthogonal filters. These costs were calculated for the odd-length biorthogonal filters only. However, the costs for the even-length biorthogonal filters should be similar to the odd-length filters.

52 These values in Table 4.1 are the closed form representation of the costs. In order to compare the systems more specifically, the costs of transforming a 512x512 image are summarized in Table 4.2 below. The DCT costs were normalized to 1.00.

Table 4.1: Computational costs of transform algorithms

Transform # Additions # Multiplications

13RC 8x8 DCT 2 4RC 2 Type-I, fast LOT M=16, V=8 12RC - 18(R + C) 7RC - 4(R + C)

L-level Circular 4(1 - (4))L 4(1- RCF Convolution DWT 3 3

Minimum Cost 4(1 - ( ))L 2(1 - (4)L 3 L-level DWT 3 RC(F - 2) RC(F + 2)

Table 4.2: Normalized costs of transforming a 512x512 image

Transform # Additions # Multiplications DCT 1.00 1.00 LOT 1.84 1.74 Circular Convolution, 2-Level DWT 2.69 5.00 Circular Convolution, 3-Level DWT 2.83 5.25 Circular Convolution, 4-Level DWT 2.86 5.31 Minimum cost, 2-Level DWT 2.69 2.82 Minimum cost, 3-Level DWT 2.83 2.95 Minimum cost, 4-Level DWT 2.86 2.98

According to the normalized cost above, the implementation of the DWT in this thesis was the most costly compared to those of the DCT and the LOT. The costs of the DWT were concentrated on the number of multiplications in the circular con- volution process. Compared to the minimum cost DWT, the algorithm used in this thesis can be greatly improved. One solution is to take advantage of the symmetry

53 of the biorthogonal filters. The number of multiplications can be reduced to almost one-half of the original cost by keeping a record of the previous multiplication results. There are also other algorithms that can reduce the computational costs of the DWT coefficients such as the lifting algorithm [2]. On the other hand, the costs of the LOT were only about 75-85% more than those of the DCT system. Another aspect of the algorithm comparisons was the similarity of the algorithm. The LOT algorithm reuses the DCT block transform algorithm. Therefore, the cost of implementing the LOT is left to the butterfly structure for the overlapped parts. On the contrary, the DWT algorithm is completely different from the DCT algorithm. It does not use the block transform. As a result, the cost of changing from the DCT to the DWT is more expensive than the cost of changing from the DCT to the LOT for the transform block. In addition, the entropy coder may need modifications. Effectively, the whole system must be changed. The costs of changing to another system may or may not be desirable for practical applications. The change may be made if the improvement after changing can justify the cost. The effects of the other parts of the system are presented in the following sections.

4.1.2 Quantization

The complexity of the quantizer can be compared in a similar manner as the transform comparison. Evaluations of the quantizers were done in terms of algorithm implementation such as the cost of the algorithm. In this thesis, all quantizers can be classified into three groups as shown below.

(a) Optimal uniform

(b) Universal uniform: JPEG uniform quantizer and visual threshold

(c) Embedded zerotree wavelet

The optimal uniform quantizer was used to compare the system from the theoret- ical perspective only. This quantizer gives a fair comparison of different transforms because it minimizes the signal-to-noise ratio (SNR) of the quantized coefficients of

54 a particular image. It is also useful because only the DCT system has the standard quantizer. To develop the quantizer for the LOT system and the DWT system, fur- ther research must be done separately and may take some period of time. Therefore, this optimal quantizer gives a fast way to compare the system fairly. Furthermore, this quantizer uses a recursive algorithm to compute the quantization levels, which is more computational expensive than other types of quantizers. Therefore, this quan- tizer may not be attractive for practical systems. On the other hand, the universal uniform quantizer uses a predefined set of quan- tization levels for all images. These levels are usually tested and verified to give good visual quality. The advantage of this type of quantizer is that quantizer and the de- quantizer can perform their functions properly regardless of the image as long as they both agree on the quantization levels. The calculation of the quantized coefficient of the uniform quantizer, both the optimal one and the universal one, involves only a division operation, which can be implemented in either hardware or software. Finally, the EZW quantizer combines the bit-plane coding and the zerotree search- ing together in an efficient way. The compression is achieved by coding the tree struc- ture as one symbol instead of coding the elements of the tree individually. Another advantage of the EZW quantizer is that the EZW algorithm can achieve a desired bit rate exactly, which might be useful for certain applications. Despite these advantages, the zerotree search algorithm used in this thesis was repetitive and slow because once the zerotree is found for some threshold, the whole tree was tested against different thresholds until all elements in the tree were found significant or the bit budget was exhausted. Improvements are needed for the version of EZW in this thesis in order to compete with other quantizers and coders. Some algorithms have been experi- mented with to optimize the zerotree searching. For example, the set partitioning in hierarchical trees (SPIHT) might be another alternative to the DWT system [10].

4.1.3 Entropy Coding

The entropy coder allows the computation of the bit rate of each system. This thesis did not emphasize in choosing a particular type of coder. In order to complete

55 the system, the comparisons of different coders used in this thesis is briefly mentioned below. There are three coders used in this thesis: Huffman, adaptive Huffman, and the run-length Huffman. Compared to the Huffman coder, the adaptive Huffman coder is more costly in terms of computation. The adaptive Huffman coder required re- computation of the code words at certain rates. The update of the code table in- creased the overhead of the EZW algorithms used in this thesis. Nevertheless, the adaptiveness of the coder may be locally optimized to code particular regions of the image. On the other hand, the run-length Huffman is easy to implement. This coder changes the definition of the symbols from the single symbol to strings of symbols. This coder is particularly useful for the system with a long string of numbers or characters, i.e. zeros in the case of DCT JPEG, and the LOT JPEG. In the case of the DWT, the size of each band varies according to the DWT level. Therefore, the DWT system may require multiple sets of the Huffman tables in order to efficiently compress the data. Future study may be done to find a universal run-length coder for the visual threshold system and the EZW system.

4.2 Part II: System Performance

The performance comparison of all systems was done in terms of the PSNR and the bit rate. The comparisons were divided into five parts as mentioned in the previous chapter. The results and discussions of those five parts are presented below.

4.2.1 Part II-A: Effect of Number Levels on DWT Systems

As previously described in the background section, the DWT coefficients are ef- fected by the number of DWT level in the system. Specifically, the LL band of the system changes the size and the value according to the number of filter bank stages. These comparisons investigated the effect of the number of level on the PSNR per- formance for different combinations of quantizers and entropy coders. Furthermore,

56 these comparisons were used to find the optimal level for the DWT systems, which were used to compare with the DCT and the LOT systems in the subsequent compar- isons. There were three combinations of the quantizer and the entropy coders used in these comparisons. The systems are listed in Table 4.3 below. The optimal uniform quantizer used the scaling factor of 0.35, and the run-length Huffman coder limited the maximum category size to 11 and the maximum run size to 15. This coder is similar to the baseline JPEG run-length Huffman coder.

Table 4.3: List of systems for comparing the effect of DWT levels on the PSNR performance of the DWT systems

Transform Quantizer Entropy Coder 2-Level DWT Optimal Uniform Run-Length Huffman 3-Level DWT Optimal Uniform Run-Length Huffman 4-Level DWT Optimal Uniform Run-Length Huffman 2-Level DWT Visual Threshold Run-Length Huffman 3-Level DWT Visual Threshold Run-Length Huffman 4-Level DWT Visual Threshold Run-Length Huffman 2-Level DWT EZW Adaptive Huffman 3-Level DWT EZW Adaptive Huffman 4-Level DWT EZW Adaptive Huffman

The results of the simulation on all seven images are summarized in Table 4.4 - 4.9 below. The average bit rate presented in the table were the following set, {0.50, 0.75, 1.00, 1.25, 1.50, 1.75}. The PSNR values and the average bit rates were linearly interpolated to achieve desired value because the system simulation could not fix the exact bit rate with the exception of the EZW system. The graph of the EZW systems for some images are shown in Figure 4-1 below. According to the results, the optimal uniform quantizer and the visual threshold quantizer were unaffected by the number of DWT levels. In fact, as the output resolution of the visual threshold was varied from 32 to 16 or 64 pixels per degree, the PSNR performance remained unaffected. On the other hand, the PSNR performance of the EZW system was significantly improved as the number of levels was changed from two to three. The EZW improved the PSNR about 0.5 to 4 dB as the level was

57 Table 4.4: Effect of DWT levels on the PSNR performance of the DWT systems using the optimal uniform quantizer and the run-length Huffman coder

2 Levels 3 Levels 4 Levels Image Bit Rate PSNR (dB) APSNR (dB) APSNR (dB) 0.50 (23.35) 0.65 0.65 0.75 (25.95) 0.21 0.21 baboon 1.00 (27.21) 0.30 0.26 1.25 (28.86) 0.09 0.10 1.50 (30.11) 0.23 0.22 1.75 (31.63) 0.31 0.22 0.50 (27.82) 1.43 1.56 0.75 (30.85) 0.54 0.63 barbara2 1.00 (32.94) 0.94 1.00 1.25 (34.99) 0.41 0.49 1.50 (36.35) 0.42 0.49 1.75 (37.67) 0.39 0.45 0.50 (28.08) 1.33 1.46 0.75 (32.06) 0.68 0.76 1.00 (33.97) 0.34 0.38 bfrag 1.25 (35.13) 0.99 0.98 1.50 (37.66) 0.42 0.48 1.75 (38.97) 0.68 0.65 0.50 (27.75) 0.97 0.98 0.75 (30.79) 0.72 0.88 1.00 (33.53) 0.66 0.64 btfrag 1.25 (35.46) 0.29 0.23 1.50 (38.51) 0.18 0.17 1.75 (39.94) 0.18 0.08

58 Table 4.5: Effect of DWT levels on the PSNR performance of the DWT systems using the optimal uniform quantizer and the run-length Huffman coder (cont.)

12 Levels 3 Levels 4 Levels Image Bit Rate PSNR (dB) APSNR (dB) APSNR (dB) 0.50 (31.09) 0.72 0.85 0.75 (33.79) 0.46 0.53 1.00 (35.47) 0.49 0.47 goidhill 1.25 (36.93) 0.19 0.27 1.50 (37.76) 0.53 0.53 1.75 (39.23) 0.20 0.10 0.50 (33.36) 1.61 1.67 0.75 (36.27) 0.85 0.90 lena 1.00 (38.19) 0.31 0.33 1.25 (39.38) 0.26 0.20 1.50 (40.65) 0.11 0.16 1.75 (41.66) 0.47 0.58 0.50 (31.94) 1.80 1.91 0.75 35.44 0.35 0.37 1.00 36.59 0.27 0.29 peppers 1.25 (37.76) 0.12 0.14 1.50 (38.76) 0.21 0.24 1.75 (40.04) 0.00 -0.93

59 Table 4.6: Effect of DWT levels on the PSNR performance of the DWT systems using the visual threshold quantizer and the run-length Huffman coder

g B2 Levels 3 Levels 4 Levels Image Bit Rate PSNR (dB) APSNR (dB) APSNR (dB) 0.50 (23.80) 0.20 0.22 0.75 (25.75) 0.18 0.17 baboon 1.00 (27.23) 0.11 0.10 1.25 (28.59) 0.13 0.12 1.50 (29.75) 0.06 0.07 1.75 (30.97) 0.06 0.05 0.50 (29.02) 0.42 0.44 0.75 (31.53) 0.39 0.41 barbara2 1.00 (33.71) 0.25 0.27 1.25 (35.35) 0.27 0.28 1.50 (36.70) 0.11 0.13 1.75 (37.84) 0.28 0.31 0.50 (28.83) 0.59 0.68 0.75 (31.91) 0.50 0.50 1.00 (33.94) 0.33 0.28 bfrag 1.25 (35.78) 0.22 0.18 1.50 (37.27) 0.34 0.37 1.75 (38.92) 0.14 0.09 0.50 (28.22) 0.24 0.20 0.75 (31.60) 0.32 0.28 btfrag 1.00 (34.48) 0.07 0.07 1.25 (36.65) 0.16 0.21 1.50 (38.35) 0.13 -0.04 1.75 (37.75) 0.20 0.13

60 Table 4.7: Effect of DWT levels on the PSNR performance of the DWT systems using the visual threshold quantizer and the run-length Huffman coder (cont.)

12 Levels 3 Levels 4 Levels Image Bit Rate PSNR (dB) APSNR (dB) APSNR (dB) 0.50 (32.30) 0.13 0.13 0.75 (34.26) 0.17 0.14 1.00 (35.73) 0.11 0.14 goidhill 1.25 (37.05) 0.16 0.09 1.50 (38.27) 0.07 -0.06 1.75 (39.22) 0.10 0.08 0.50 (34.64) 0.32 0.32 0.75 (36.86) 0.19 0.22 lena 1.00 (38.26) 0.22 0.19 1.25 (39.37) 0.31 0.28 1.50 (40.64) 0.14 0.09 1.75 (41.77) 0.17 0.11 0.50 (33.97) 0.24 0.19 0.75 (35.63) 0.13 0.05 1.00 (36.82) -0.03 -0.05 peppers 1.25 (37.71) 0.05 0.03 1.50 (38.50) -0.03 -0.05 1.75 (39.34) 0.15 -0.01

61 Table 4.8: Effect of DWT levels on the PSNR performance of the DWT systems using the EZW quantizer and the adaptive Huffman coder

Bit Rate 2 Levels 3 Levels 4 Levels Image PSNR (dB) APSNR (dB) APSNR (dB) 0.50 (22.20) 1.20 1.68 0.75 (23.73) 1.01 1.25 baboon 1.00 (24.81) 2.04 2.19 1.25 (26.99) 0.65 0.77 1.50 (27.70) 0.77 0.99 1.75 (28.55) 1.15 1.56 0.50 (24.57) 3.02 3.94 0.75 (27.05) 3.20 3.84 barbara2 1.00 (28.76) 3.28 4.70 1.25 (30.30) 3.30 3.60 1.50 (32.68) 2.53 3.03 1.75 (34.50) 2.37 2.99 0.50 (23.95) 3.32 4.54 0.75 (26.93) 3.65 4.21 1.00 (28.72) 3.55 4.97 bfrag 1.25 (31.29) 3.59 3.95 1.50 (33.05) 2.93 3.43 1.75 (35.21) 2.53 3.14 0.50 (26.36) 2.69 3.69 0.75 (28.48) 2.99 3.55 1.00 (31.06) 3.52 3.77 btfrag 1.25 (32.72) 2.80 3.14 1.50 (35.09) 2.03 2.73 1.75 (36.09) 3.30 3.46

62 Table 4.9: Effect of DWT levels on the PSNR performance of the DWT systems using the EZW quantizer and the adaptive Huffman coder (cont.)

3 Levels 4 Levels ImageImae BtBit RtePSNRRate 2 Levels (dB) APSNR (dB) ZPSNRA (dB) 0.50 (27.44) 3.60 4.38 0.75 (29.79) 3.18 4.24 1.00 (31.48) 2.98 3.41 goldhill 1.25 (32.95) 2.56 3.01 1.50 (34.55) 2.26 3.08 1.75 (35.50) 2.79 3.01 0.50 (28.50) 4.69 6.02 0.75 (31.67) 4.19 4.72 lena 1.00 (33.92) 3.21 3.93 1.25 (35.91) 2.91 3.29 1.50 (37.01) 2.63 2.89 1.75 (38.59) 1.63 1.92 0.50 (26.40) 3.60 4.40 0.75 (30.02) 3.18 4.24 1.00 (32.60) 2.98 3.41 peppers 1.25 (34.09) 2.56 3.01 1.50 (35.64) 2.26 3.08 1.75 (36.34) 2.79 3.01

63 baboon.raw barbara2.raw

40- 40

30 -30 z z a) I20 n.20

1u 10 0 0.5 1 1.5 2 S 0.5 1 1.5 bfrag. raw goldhill. raw

40 ...... 40 -. .. . .-.. . .-.. . . -. .. . . -.

...... 30 30 -...... z z a) (n 0-20 ...... c20 - ...... -......

10 - 10 0 0.5 1 1.5 2 S 0.5 1 1.5 2 lena.raw peppers.raw

40 40

' 3 0 30 z z ---2-Level a) -- .. -.-..-. 0.20 I. 20 -. 9- 3-Level -.-. 4-Level 10, 10 0 0.5 1 1.5 2 0 0.5 1 1.5 2 Average Bit Rate (bit per pixel) Average Bit Rate (bit per pixel)

Figure 4-1: Effect of number of DWT levels on the PSNR performance of the DWT systems using the EZW quantizer and the adaptive Huffman coder

64 changed from two to three, and gained about 1 dB as the level was changed from three to four. This result clearly indicates that the number of levels affects the PSNR perfor- mance of the EZW system, but does not effect the DWT system with the uniform quantizer. Therefore, the number of DWT levels can be limited to three levels for the systems that use the uniform quantizer such as the optimal uniform quantizer or the visual threshold. The EZW may gain advantage over other systems using four or higher levels wavelet expansions. However, the trade-offs must be considered between the cost to compute the additional DWT level and the gain in the image quality.

4.2.2 Part II-B: Effect of Transform

This section compared the effect of the choice of the transform block on the PSNR performance. Comparisons were done by restricting the choice of quantizer and entropy coder. Because the only difference in the system is the transform block, the differences in the PSNR should be mainly influenced by the transform block. The list of systems tested is shown in Table 4.10.

Table 4.10: List of systems for comparing the effect of transforms on the PSNR performance

Transform Quantizer Entropy Coder DCT Optimal Uniform Huffman LOT Optimal Uniform Huffman 3-Level DWT Optimal Uniform Huffman DCT Optimal Uniform Run-Length Huffman LOT Optimal Uniform Run-Length Huffman 3-Level DWT Optimal Uniform Run-Length Huffman

The DWT system with the optimal uniform quantizer used 3 levels because the results from the previous section showed that there was no significant improvement by increasing the DWT level to four. The optimal uniform used the scaling factor of 0.35 for all transforms. Finally, the run-length Huffman table for the DWT system was generated from the statistics of the quantized coefficients because there is no

65 standard coder for the DWT system. The PSNR performance of all systems listed above are summarized in Table 4.11 - 4.14 below.

Table 4.11: Effect of transforms on the PSNR performance using the op- timal uniform quantizer and the Huffman coder

DCT LOT DWT Image Bit Rate PSNR (dB) APSNR (dB) APSNR (dB) 0.50 (23.66) 0.31 -0.20 0.75 (25.29) 0.32 -0.17 baboon 1.00 (26.82) 0.32 0.14 1.25 (28.20) 0.30 -0.06 1.50 (29.53) 0.25 -0.03 1.75 (30.82) 0.22 -0.12 0.50 (28.05) 0.70 -0.96 0.75 (30.47) 0.47 -0.75 barbara2 1.00 (32.25) 0.59 -0.48 1.25 (33.88) 0.61 -0.80 1.50 (35.48) 0.59 -0.71 1.75 (37.00) 0.49 -1.51 0.50 (27.16) 0.98 -0.11 0.75 (30.00) 1.23 0.28 1.00 (32.70) 1.25 0.55 bfrag 1.25 (35.17) 0.80 -0.55 1.50 (37.02) 0.54 -1.34 1.75 (38.51) 0.38 -1.75 0.50 (28.79) 0.55 0.16 0.75 (31.56) 0.67 -0.67 1.00 (33.92) 0.59 -0.87 btfrag 1.25 (35.82) 0.42 -0.94 1.50 (37.43) 0.47 -1.24 1.75 (38.92) 0.28 -0.94

According to the results in Table 4.11 - 4.14, when the optimal uniform quantizer and the Huffman coder were used, the LOT performed the best of three transforms across all images. The PSNR gain was as high as 1 dB in some cases for the LOT compared to the DCT. On the other hand, the 3-level DWT system had lower PSNR than the other two systems. The PSNR of the DWT systems could decrease down to -1.75 dB compared to the DCT systems in some images.

66 Table 4.12: Effect of transforms on the PSNR performance using the op- timal uniform quantizer and the Huffman coder (cont.)

DCT LOT DWT Image Bit Rate PSNR (dB) APSNR (dB) APSNR (dB) 0.50 (31.48) 0.41 -0.40 0.75 (33.27) 0.37 -1.21 1.00 (34.73) 0.29 -1.69 goidhill 1.25 (36.04) 0.33 -0.93 1.50 (37.28) 0.33 -0.47 1.75 (38.54) 0.20 -1.16 0.50 (32.71) 0.59 0.15 0.75 (35.00) 0.44 -0.54 lena 1.00 (36.61) 0.22 -0.33 1.25 (37.81) 0.31 -0.70 1.50 (39.00) 0.31 -0.47 1.75 (39.99) 0.27 -0.77 0.50 (31.89) 0.41 -0.32 0.75 (33.81) 0.26 -1.07 1.00 (35.05) 0.26 -0.96 peppers 1.25 (36.02) 0.23 -0.21 1.50 (36.91) 0.31 -0.65 1.75 (37.84) 0.27 0.06

67 Table 4.13: Effect of transforms on the PSNR performance using the op- timal uniform quantizer and the run-length Huffman coder

Bit DCT LOT DWT Image Bi Rate PSNR (dB) APSNR (dB) APSNR (dB) 0.50 (23.28) 0.17 0.73 0.75 (25.01) 0.23 1.15 baboon 1.00 (26.69) 0.21 0.81 1.25 (28.16) 0.14 0.80 1.50 (29.50) 0.07 0.83 1.75 (30.80) 0.18 1.14 0.50 (28.72) 0.49 0.52 0.75 (31.29) 0.48 0.10 barbara2 1.00 (33.48) 0.48 0.40 1.25 (35.31) 0.25 0.09 1.50 (36.79) 0.30 -0.02 1.75 (38.07) 0.11 -0.01 0.50 (27.99) 1.17 1.42 0.75 (31.82) 1.00 0.92 1.00 (34.63) 0.65 -0.32 bfrag 1.25 (36.64) 0.59 -0.52 1.50 (38.29) 0.35 -0.21 1.75 (39.60) 0.21 0.05 0.50 (29.16) -1.46 -0.44 0.75 (32.08) -1.06 -0.57 1.00 (34.97) -0.99 -0.78 btfrag 1.25 (36.96) -1.04 -1.21 1.50 (38.72) -0.76 -0.03 1.75 (40.12) -0.55 0.00

68 Table 4.14: Effect of transforms on the PSNR performance using the op- timal uniform quantizer and the run-length Huffman coder (cont.)

DWT Image Bit Rate DCT LOT ImgeBi RtePSNR (dB) APSNR (dB) APSNR (dB) 0.50 (32.06) 0.21 -0.24 0.75 (34.10) 0.22 0.16 1.00 (35.51) 0.21 0.45 goidhill 1.25 (36.77) 0.20 0.35 1.50 (37.91) 0.07 0.39 1.75 (38.80) 0.20 0.63 0.50 (34.26) 0.08 0.72 0.75 (36.55) 0.07 0.56 lena 1.00 (37.97) -0.05 0.53 1.25 (38.88) 0.07 0.76 1.50 (39.76) 0.15 1.00 1.75 (40.68) 0.18 1.45 0.50 (33.54) -0.29 0.19 0.75 (32.30) -0.32 0.49 1.00 (35.71) -0.35 1.15 peppers 1.25 (36.07) -0.12 1.81 1.50 (37.10) -0.18 1.87 1.75 (38.28) 0.00 1.76

69 As the coder was changed to the run-length Huffman coder, the PSNR results of all transforms were comparable. The LOT system gave a slightly higher PSNR, up to 0.5 dB in some cases, than the DCT system. For btfrag image and peppers image, the DCT system performed slightly better in the PSNR than the LOT system, about 1 dB in the case of btfrag image. In the case of the 3-level DWT system, it performed better than the DCT system in all images, except for btfrag image. The performance gain of the DWT system could go as high as 1.80 dB when applied to peppers image. This comparison shows a small positive gain in PSNR of the LOT system with the optimal uniform quantizer in comparison with the DCT system in most cases. On the other hand, the performance of the DWT depends on the type of encoder. The gain in the LOT system is too small to confirm that the gain is obtained from the transform block. In the case of the DWT system, the gain clearly does not depend on the transform block. Two comparison results above suggest that the DWT system can gain the PSNR performance at least from the entropy encoder block. The influence of the quantizer block and the entropy coder block is shown in the next comparisons.

4.2.3 Part II-C: Effect of Quantizer

The following comparisons investigated the effect of the choice of the quantizer on the PSNR performance . Specifically, the comparison focused on the optimal quan- tizer and the universal quantizer because practical systems usually uses the universal quantizer. By constraining the choice of the transform and the entropy coder, the comparison isolated the effect on PSNR due to the quantizer alone. The systems tested are listed in Table 4.15. The comparison results are summarized in Table 4.16 - 4.21 below. The optimal uniform quantizer used the scaling factor of 0.35 for all systems. The visual threshold quantizer used in the DWT system used the output resolution of 32 pixels/degree . The output resolution did not significantly change the PSNR perfor- mance. This thesis had experimented with 16 pixels/degree and 64 pixels/degree and their results were almost the same as the system that used 32 pixels/degree. There- fore, the system with the output resolution of 32 pixels/degree was used to represent

70 Table 4.15: List of systems for comparing the effect of quantizers on the PSNR performance using the run-length Huffman coder

Transform Quantizer Entropy Coder DCT Optimal Uniform Run-Length Huffman DCT JPEG Uniform Run-Length Huffman LOT Optimal Uniform Run-Length Huffman LOT JPEG Uniform Run-Length Huffman 3-Level DWT Optimal Uniform Run-Length Huffman 3-Level DWT Visual Threshold Run-Length Huffman

the visual threshold system in all comparisons. The EZW system were not compared in this section because the encoder used in the EZW system were not the same as the visual threshold system. However, the comparison was made at the system level in the later section. According to the results, the optimal uniform quantizer systems had better PSNR than the universal uniform quantizer across most images as expected. However, the relative performance between two quantizers was not significantly different for all transform, about 0.5 dB. As a result, the universal uniform quantizer can be used in a practical system in place of the optimal uniform quantizer without losing much of the PSNR performance.

4.2.4 Part II-D: Effect of Entropy Coder

The comparisons of the effect of the choice of entropy coder on the PSNR perfor- mance were done by choosing different encoding schemes after the quantizer output. The compared coders used in this thesis were the Huffman coder and the run-length Huffman coder. The complete list of the tested systems is shown in Table 4.22. The results of the compared systems are summarized in Table 4.23 - 4.28. The optimal uniform quantizer in all systems used the scaling factor of 0.35. According to the results, the run-length coder gave slightly better PSNR perfor- mance than the DCT system and the LOT system with the optimal uniform coder. The PSNR gain was about 0.5-1.0 dB. On the other hand, the visual threshold wavelet

71 Table 4.16: Effect of quantizers on the PSNR performance of the DCT systems using the run-length Huffman coder

Optimal Uniform JPEG Uniform Image Bit Rate PSNR (dB) APSNR (dB) 0.50 (23.28) 0.38 0.75 (25.01) 0.17 baboon 1.00 (26.69) -0.29 1.25 (28.16) -0.61 1.50 (29.50) -0.85 1.75 (30.80) -1.02 0.50 (28.72) 0.25 0.75 (31.29) 0.00 barbara2 1.00 (33.48) -0.44 1.25 (35.31) -0.78 1.50 (36.79) -0.91 1.75 (38.07) -0.94 0.50 (27.99) 0.19 0.75 (31.82) -0.54 1.00 (34.63) -0.86 bfrag 1.25 (36.64) -0.90 1.50 (38.29) -0.93 1.75 (39.60) -0.85 0.50 (29.16) 0.36 0.75 (32.08) 0.27 1.00 (34.97) -0.36 btfrag 1.25 (36.96) -0.48 1.50 (38.72) -0.65 1.75 (40.12) -0.66

72 Table 4.17: Effect of quantizers on the PSNR performance of the DCT systems using the run-length Huffman coder (cont.)

Optimal Uniform JPEG Uniform Image Bit Rate PSNR (dB) 7f zPSNR (dB) 0.50 (32.06) 0.29 0.75 (34.10) 0.04 1.00 (35.51) 0.04 goidhill 1.25 (36.77) 0.08 1.50 (37.91) -0.17 1.75 (38.80) -0.17 0.50 (34.26) 0.29 0.75 (36.55) -0.09 1.00 (37.97) -0.20 lena 1.25 (38.88) 0.01 1.50 (39.76) 0.00 1.75 (40.68) -0.05 0.50 (33.54) 0.24 0.75 (35.30) -0.03 1.00 (35.71) 0.57 peppers 1.25 (36.07) 0.98 1.50 (37.10) 0.65 1.75 (38.28) 0.11

73 Table 4.18: Effect of quantizers on the PSNR performance of the LOT systems using the run-length Huffman coder

Optimal Uniform JPEG Uniform Image Bit Rate PSNR (dB) APSNR (dB) 0.50 (23.45) 0.52 0.75 (25.24) 0.24 1.00 (26.90) -0.19 baboon 1.25 (28.30) -0.44 1.50 (29.58) -0.61 1.75 (30.98) -0.94 0.50 (29.21) 0.48 0.75 (31.77) 0.08 barbara2 1.00 (33.96) -0.38 1.25 (35.56) -0.49 1.50 (37.09) -0.70 1.75 (38.18) -0.61 0.50 (29.15) 0.51 0.75 (32.83) -0.22 1.00 (35.28) -0.47 bfrag 1.25 (37.64) -0.62 1.50 (38.64) -0.56 1.75 (39.81) -0.50 0.50 (27.70) 2.17 0.75 (31.02) 1.63 1.00 (33.98) 0.83 btfrag 1.25 (35.92) 0.73 1.50 (37.96) 0.22 1.75 (39.58) -0.05

74 Table 4.19: Effect of quantizers on the PSNR performance of the LOT systems using the run-length Huffman coder (cont.)

Optimal Uniform JPEG Uniform Image Bit Rate PSNR (dB) APSNR (dB) 0.50 (32.26) 0.45 0.75 (34.33) 0.16 1.00 (35.72) 0.10 goidhill 1.25 (36.97) -0.01 1.50 (37.98) -0.03 1.75 (39.00) -0.14 0.50 (34.34) 0.58 0.75 (36.62) 0.07 1.00 (37.92) 0.02 lena 1.25 (38.96) 0.05 1.50 (39.91) 0.02 1.75 (40.86) -0.07 0.50 (33.25) 0.65 0.75 (34.98) 0.33 1.00 (35.36) 0.93 peppers 1.25 (35.95) 1.12 1.50 (36.93) 0.85 1.75 (38.29) 0.17

75 Table 4.20: Effect of quantizers on the PSNR performance of the DWT systems using the run-length Huffman coder

Optimal Uniform Visual Threshold Image Bit Rate PSNR (dB) APSNR (dB) 0.50 (24.00) 0.00 0.75 (26.16) -0.23 baboon 1.00 (27.51) -0.17 1.25 (28.96) -0.24 1.50 (30.34) -0.53 1.75 (31.94) -0.91 0.50 (29.24) 0.21 0.75 (31.39) 0.53 barbara2 1.00 (3388) 0.08 1.25 (35.40) 0.21 1.50 (36.77) 0.04 1.75 (38.06) 0.06 0.50 (29.41) 0.02 0.75 (32.74) -0.33 1.00 (34.31) -0.04 bfrag 1.25 (36.12) -0.12 1.50 (38.08) -0.47 1.75 (39.65) -0.59 0.50 (28.72) -0.26 0.75 (31.51) 0.41 1.00 (34.19) 0.35 btfrag 1.25 (35.75) 1.06 1.50 (38.69) -0.22 1.75 (40.12) -0.18

76 Table 4.21: Effect of quantizers on the PSNR performance of the DWT systems using the run-length Huffman coder (cont.)

Uniform Visual Threshold Image Bit Rate OptimalPSNR (dB) APSNR (dB) 0.50 (31.82) 0.63 0.75 (34.26) 0.17 1.00 (35.96) -0.12 goidhill 1.25 (37.12) 0.09 1.50 (38.30) 0.04 1.75 (39.43) -0.12 0.50 (34.98) -0.02 0.75 (37.12) -0.06 lena 1.00 (38.50) -0.03 1.25 (39.64) 0.04 1.50 (40.75) 0.03 1.75 (42.13) -0.36 0.50 (33.73) 0.48 0.75 (35.79) -0.04 1.00 (36.86) -0.06 peppers 1.25 (37.88) -0.12 1.50 (38.97) -0.50 1.75 (40.05) -0.55

77 Table 4.22: List of systems for comparing the effect of entropy coders on the PSNR performance using the optimal uniform quantizer

Transform Quantizer Entropy Coder DCT Optimal Uniform Huffman DCT Optimal Uniform Run-Length Huffman LOT Optimal Uniform Huffman LOT Optimal Uniform Run-Length Huffman 3-level DWT Optimal Uniform Huffman 3-level DWT Optimal Uniform Run-Length Huffman

system gained about 2-3 dB above the DWT system with the Huffman coder across most images. The comparisons in the previous section showed that the choice of the optimal uniform quantizer and the universal uniform quantizer had very little effect on the PSNR performance. Therefore, these result should remain valid for the systems that use the universal uniform quantizer as well. The results suggests that the DWT system can gain significant increase in PSNR when using the run-length Huffman coder with the universal uniform quantizer. Although this simulation com- puted the run-length Huffman table for the DWT system from the statistics of the coefficients, the optimized universal run-length coder should give similar or slightly less PSNR performance for the DWT system with the uniform quantizer. The actual system of the visual threshold wavelet and the run-length coder may achieve at least the same PSNR performance as the current baseline JPEG system.

4.2.5 Part II-E: Overall System Performance

This section compared the overall performance of the system in general. All transforms were allowed to be combined with any choice of the quantizer and the entropy coder to optimize their performance. According to the earlier comparisons, the universal uniform quantizer gave similar PSNR performance to the optimal uni- form quantizer for all transforms. In addition, the universal quantizer represented the practical system, which was the main focus of most applications. As a result, we decided to exclude the system with optimal uniform quantizer from this comparison.

78 Table 4.23: Effect of entropy coders on the PSNR performance of the DCT systems using the optimal uniform quantizer

Huffman Run-Length Image Bit Rate Huffman PSNR (dB) APSNR (dB) 0.50 (23.66) -0.38 0.75 (25.29) -0.28 baboon 1.00 (26.82) -0.12 1.25 (28.20) -0.04 1.50 (29.53) -0.03 1.75 (30.82) -0.01 0.50 (28.05) 0.67 0.75 (30.47) 0.82 1.00 (32.25) 1.23 barbara2 1.25 (33.88) 1.43 1.50 (35.48) 1.32 1.75 (37.00) 1.07 0.50 (27.16) 0.83 0.75 (30.00) 1.82 1.00 (32.70) 1.93 bfrag 1.25 (35.17) 1.46 1.50 (37.03) 1.26 1.75 (38.51) 1.10 0.50 (28.79) 0.37 0.75 (31.56) 0.51 1.00 (33.91) 1.05 btfrag 1.25 (35.82) 1.14 1.50 (37.43) 1.29 1.75 (38.92) 1.20

79 Table 4.24: Effect of entropy coders on the PSNR performance of the DCT systems using the optimal uniform quantizer (cont.)

Huffman Run-Length Image Bit Rate Huffman PSNR (dB) APSNR(dB) 0.50 (31.48) 0.57 0.75 (33.27) 0.83 1.00 (34.73) 0.78 goidhill 1.25 (36.04) 0.73 1.50 (37.28) 0.63 1.75 (38.54) 0.26 0.50 (32.71) 1.55 0.75 (35.00) 1.55 lena 1.00 (36.61) 1.36 1.25 (37.81) 1.07 1.50 (39.00) 0.76 1.75 (39.99) 0.69 0.50 (31.89) 1.66 0.75 (33.81) 1.49 1.00 (35.05) 0.65 peppers 1.25 (36.02) 0.05 1.50 (36.91) 0.20 1.75 (37.84) 0.45

80 Table 4.25: Effect of entropy coders on the PSNR performance of the LOT systems using the optimal uniform quantizer

Huffman Run-Length Image Bit Rate Huffman PSNR (dB) APSNR (dB) 0.50 (23.98) -0.52 0.75 (25.61) -0.37 -0.23 baboon 1.00 (27.13) 1.25 (28.49) -0.19 1.50 (29.78) -0.20 1.75 (31.03) -0.05 0.50 (28.74) 0.47 0.75 (30.95) 0.82 1.00 (32.84) 1.12 barbara2 1.25 (34.50) 1.06 1.50 (36.07) 1.02 1.75 (37.49) 0.70 0.50 (28.14) 1.01 0.75 (31.23) 1.59 bfrag 1.00 (33.96) 1.32 1.25 (35.97) 1.25 1.50 (37.57) 1.07 1.75 (38.89) 0.92 0.50 (29.34) -1.63 0.75 (32.23) -1.21 1.00 (34.51) -0.53 btfrag 1.25 (36.24) -0.32 1.50 (37.90) 0.06 1.75 (39.20) 0.37

81 Table 4.26: Effect of entropy coders on the PSNR performance of the LOT systems using the optimal uniform quantizer (cont.)

Huffman Run-Length Image Bit Rate Huffman PSNR (dB) APSNR(dB) 0.50 (31.89) 0.37 0.75 (33.63) 0.69 1.00 (35.02) 0.70 goidhill 1.25 (36.37) 0.60 1.50 (37.61) 0.37 1.75 (38.75) 0.26 0.50 (33.30) 1.04 0.75 (35.44) 1.18 lena 1.00 (36.82) 1.10 1.25 (38.12) 0.84 1.50 (39.31) 0.59 1.75 (40.26) 0.60 0.50 (32.29) 0.96 0.75 (34.07) 0.90 1.00 (35.31) 0.04 peppers 1.25 (36.24) -0.29 1.50 (37.22) -0.29 1.75 (38.11) 0.18

82 Table 4.27: Effect of entropy coders on the PSNR performance of the DWT systems using the optimal uniform quantizer

Huffman Run-Length Image Bit Rate Huffman PSNR (dB) APSNR (dB) 0.50 (23.47) 0.54 0.75 (25.12) 1.04 baboon 1.00 (26.96) 0.54 1.25 (28.13) 0.82 1.50 (29.50) 0.83 1.75 (30.70) 1.24 0.50 (27.09) 2.15 0.75 (29.72) 1.67 barbara2 1.00 (31.77) 2.12 1.25 (33.08) 2.32 1.50 (34.77) 2.00 1.75 (35.49) 2.57 0.50 (27.04) 2.36 0.75 (30.28) 2.46 1.00 (33.26) 1.05 bfrag 1.25 (34.62) 1.50 1.50 (35.69) 2.39 1.75 (36.75) 2.90 0.50 (28.95) -0.23 0.75 (30.90) -0.61 1.00 (33.04) 1.15 btfrag 1.25 (34.88) 0.87 1.50 (36.19) 2.50 1.75 (37.98) 2.14

83 Table 4.28: Effect of entropy coders on the PSNR performance of the DWT systems using the optimal uniform quantizer (cont.)

Huffman IRun-Length Image Bit Rate Huffman PSNR (dB) APSNR(dB) 0.50 (31.12) 0.70 0.75 (32.06) 2.20 goidhill 1.00 (33.04) 2.92 1.25 (35.11) 2.01 1.50 (36.81) 1.49 1.75 (37.39) 2.05 0.50 (32.86) 2.12 0.75 (34.46) 2.65 lena 1.00 (36.28) 2.23 1.25 (37.11) 2.53 1.50 (38.53) 2.23 1.75 (39.22) 2.91 0.50 (31.57) 2.16 0.75 (32.75) 3.04 1.00 (34.09) 2.76 peppers 1.25 (35.81) 2.07 1.50 (36.26) 2.71 1.75 (37.89) 2.15

84 The list of the compared systems in this section is shown in Table 4.29 below.

Table 4.29: List of selected systems for the comparison in PSNR perfor- mance

Transform Quantizer Entropy Coder DCT JPEG Uniform Run-Length Huffman LOT JPEG Uniform Run-Length Huffman 3-Level DWT Visual Threshold Run-Length Huffman 4-Level DWT EZW Adaptive Huffman

The DCT system was the simulated baseline JPEG system which is one of the JPEG standards for lossy image compression. The LOT system in this comparison was similar to the baseline JPEG. The visual threshold system is the JPEG-like system for the DWT. The output resolution of this system was set to 32 pixels/degree. According to the earlier comparison in this thesis, the EZW system used the 4-level wavelet expansion because this number of levels increased the compression ability and PSNR performance of the system. The results are summarized in Table 4.30 and 4.31 below. According to the results, the baseline LOT JPEG-like system performed better than the DCT for all images. On average, the LOT JPEG system provided 0.5 dB PSNR above the baseline DCT JPEG system, and it provided up to 1.5 dB PSNR above the DCT system in some cases. Therefore, it can be concluded that the LOT JPEG system generally provides better PSNR than the DCT JPEG system. For the wavelet system, the visual threshold system provided slightly better PSNR than the DCT system. However, the optimal, run-length encoder was used instead of the universal coder. This coder was the reason for the PSNR gain of the visual threshold system. Nevertheless, the efficient universal coder should slightly reduce the PSNR. At this point, the visual threshold system should performed comparably to the DCT JPEG system. On the other hand, the 4-level EZW system resulted about 0.5 dB less PSNR than other systems. This PSNR loss may be caused by inefficiency of the coder. In other words, the coder might use the bit resource inefficiently such that there

85 Table 4.30: Comparison of the PSNR performance of DCT, LOT, and DWT systems

DCT LOT VT DWT EZW DWT Image Bit Rate PSNR APSNR APSNR APSNR (dB) (dB) (dB) (dB) 0.50 (23.65) 0.32 0.35 0.03 0.75 (25.18) 0.31 0.75 -0.19 baboon 1.00 (26.41) 0.30 0.94 0.59 1.25 (27.55) 0.32 1.17 0.21 1.50 (28.66) 0.31 1.15 0.04 1.75 (29.78) 0.26 1.25 0.33 0.50 (28.98) 0.71 0.47 -0.46 0.75 (31.29) 0.56 0.63 -0.40 barbara2 1.00 (33.04) 0.54 0.93 0.43 1.25 (34.53) 0.54 1.09 0.04 1.50 (35.88) 0.51 0.93 -0.18 1.75 (37.13) 0.44 0.99 0.35 0.50 (28.17) 1.49 1.25 0.32 0.75 (31.28) 1.32 1.13 -0.14 1.00 (33.77) 1.04 0.50 -0.08 bfrag 1.25 (35.74) 0.86 0.26 -0.50 1.50 (37.36) 0.72 0.25 -0.88 1.75 (38.75) 0.57 0.32 -0.40 0.50 (29.53) 0.35 -1.07 0.53 0.75 (32.34) 0.30 -0.42 -0.31 1.00 (34.64) 0.16 -0.10 0.19 btfrag 1.25 (36.48) 0.17 0.33 -0.61 1.50 (38.07) 0.11 0.40 -0.24 1.75 (39.46) 0.07 0.49 0.09

86 Table 4.31: Comparison of the PSNR performance of DCT, LOT, and DWT systems (cont.)

DCT LOT VT DWT EZW DWT Image Bit Rate PSNR APSNR APSNR APSNR (dB) (dB) (dB) (dB) 0.50 (32.35) 0.37 0.10 -0.51 0.75 (34.14) 0.34 0.28 -0.12 1.00 (35.55) 0.27 0.29 -0.66 goidhill 1.25 (36.69) 0.27 0.52 -0.72 1.50 (37.73) 0.22 0.60 -0.10 1.75 (38.63) 0.23 0.69 -0.13 0.50 (34.56) 0.37 0.41 -0.04 0.75 (36.46) 0.23 0.59 -0.07 lena 1.00 (37.77) 0.18 0.71 0.09 1.25 (38.89) 0.12 0.79 0.31 1.50 (39.76) 0.16 1.02 0.15 1.75 (40.63) 0.16 1.14 -0.12 0.50 (33.78) 0.12 0.43 0.18 0.75 (35.27) 0.04 0.49 0.25 1.00 (36.28) 0.01 0.52 0.08 peppers 1.25 (36.05) 0.03 0.72 0.42 1.50 (37.76) 0.02 0.71 0.68 1.75 (38.39) 0.07 1.11 0.64

87 are not enough bits left to send more image information. The efficiency test of the adaptive Huffman for the EZW system was done by comparing the theoretical bit rate that is needed to encode the same file with the actual bit rate. The theoretical bit rate is the minimum bit rate to needed to encode a particular EZW file. The EZW encoded file contains two sections of information: the header section and the data section. The header section includes image dimensions, number of DWT levels, and an initial threshold. The data section contains coefficient information to be stored using the following six symbols, {P,N, 1, Z, 0, 1}. Definitions of all symbols can be found in Chapter 2. The first four symbols are transmitted during the dominant pass, whereas the binary digits, 0 and 1, are sent during the subordinate pass. Most of the information is in the data section. Therefore, in this calculation, the header section is ignored. Assuming the symbols to be independent, the average entropy is the weighted sum of the entropy of the dominant pass and the subordinate pass. The entropy, I(x), is given by

N I(x) = Ep,(x) ln(p,(x)), (4.1) i=1 where

ND

Nx, is number of symbols in the file, where xi can be one of the six symbols above. ND is the total symbols in the dominant pass. The entropy of the subordinate pass can be calculated in the same way. The average bit to represent each symbol in the dominant pass and the subordinate pass were calculated. The theoretical, total bits to encode the EZW encoded file, therefore, are given by,

Total bits = ID(x)ND ± Is(x)Ns, (4.2) where ID(x) and Is(x) represent the entropy of the dominant and the subordinate pass respectively, and Ns represents the number of symbols in the subordinate pass

88 respectively. The theoretical bit rate can be calculated by dividing the theoretical, total bits by the number of pixels in the image. The graphs between the theoretical bit rate and the actual bit rate of the 4-level DWT with the EZW system are shown in Figure 4-2.

baboon.raw barbara2. raw 2 2 ...... 0...... 1.5 -01.5 ...... - ...... -...... a a _1 . -. 0.5 F ...... :30.5 ...... -

0 0 S 0.5 1 1.5 2 0 0.5 1 1.5 2 bf rag. raw goidhill.raw 2 2 0. 1.5 e-1.5 --.-.-.-.-.-. -. ----...... 1 a0. 1 -0 ...... - 0.5 F 0.5

0 0 C) ) 0.5 1 1.5 2 0 0.5 1 1.5 2 lena.raw peppers.raw 2 2

.0 ...... aD 1.5 0.5 1 ...... -- ...----...... CO Ca 0.5 ..-...... j0.5 ...... C.) 0 0 Soo 0 0.5 1 1.5 2 0 0.5 1 1.5 2 Theoretical bit rate (bpp) Theoretical bit rate (bpp)

Figure 4-2: Efficiency test for the adaptive Huffman coder using the 4- level DWT with the EZW system The solid line represents the 45-degree line. The second line represents the relationship between the theoretical bit rate and the actual bit rate.

In Figure 4-2, the 45-degree line indicates the theoretical bit rate that the coder can achieve. The other line represents the actual bit rate. The improvement room for the adaptive Huffman coder can be concluded from the gap between two lines. Results in Figure 4-2 shows small gaps across all images. Therefore, given the definition of

89 the symbols, the adaptive Huffman coder encoded the file efficiently. This encoding scheme is only one way to encode the symbols of the EZW system. Other encoding scheme may provide better compression than the adaptive Huffman used in this thesis. However, the results shows that the EZW system has a potential to achieve at least the same performance as the current JPEG system.

4.3 Part III: Visual Quality

The visual quality is the most important aspect in image compression. The results in this section show the artifact of the reconstructed images at 0.5 bit/pixel of selected transfrom coding systems. attempted to indicate any artifacts of all transform coding systems. Two of the seven images, bfrag and lena, were tested and presented in this thesis. According to the simulation results, the compressed image at 1 bit/pixel could not be distinguished from the original image. The artifact becomes dominant as the bit rate decreases. The PSNR values are shown in Table 4.32. For each image, the original image is listed first and the DCT JPEG system next as references. The other systems are listed in the increasing order of magnitude of the PSNR. The images are shown in Figure 4-3 to 4-14. According to the result images, at 0.5 bit/pixel, the reconstructed images of the DCT JPEG system displayed blocking effect strongly. At the same bit rate, the LOT JPEG system significantly reduced the image blockiness. However, the LOT system introduced ringing in areas of sharp edges, but they were not prominant. The ringing artifact of the LOT system can be compared with the blocking artifact of the DCT system to see which artifact is more objectionable to the viewers. On the other hand, the DWT systems suffered from blurriness for both the visual threshold system and the EZW system. The EZW lost more details than the visual threshold system. As the number of DWT levels increased from three to four, more details were recovered, but the image was still not as sharp as those of the baseline DCT JPEG and the baseline LOT JPEG system. The loss of details in the EZW system was caused by exhaustion of the bit budgets at the encoder stage.

90 Table 4.32: Result images and the corresponding PSNRs

PSNR APSNR Name System (dB) (dB) bfrag1 Original N/A N/A bfrag2 DCT + JPEG + Run-Length Huffman 28.19 0.00 bfrag3 3-Level DWT + EZW + Adaptive Huffman 27.27 -0.92 bfrag4 4-Level DWT + EZW + Adaptive Huffman 28.50 0.31 bfrag5 3-Level DWT + VT + Run-Length Huffman 29.43 1.24 bfrag6 LOT + JPEG + Run-Length Huffman 29.67 1.48 lenal Original N/A N/A lena2 DCT + JPEG + Run-Length Huffman 34.58 0.00 lena3 3-Level DWT + EZW + Adaptive Huffman 33.19 -1.73 lena4 4-Level DWT + EZW + Adaptive Huffman 34.51 -0.07 lena5 LOT + JPEG + Run-Length Huffman 34.92 0.34 lena6 3-Level DWT + VT + Run-Length Huffman 34.98 0.60

The system comparisons in this chapter showed that the relationship between PSNR and bit rate was mainly influenced by the combination of quantizer and entropy coder. The transform did not have any impact on the PSNR performance. In the comparison between the DCT JPEG, the LOT JPEG, the visual threshold wavelet with the run-length Huffman coder, and the EZW with the adaptive Huffman coder, the LOT JPEG system gave the best performance in terms of PSNRs and the visual quality. The LOT JPEG system provided about 0.5 dB better PSNR than the DCT JPEG system. In addition, it reduced blocking artifacts. However, it introduced small ringings in areas of sharp edges. Furthermore, the cost of changing from the DCT system to the LOT system was negligible because only the transform block was affected. A few adjustments are needed to update quantization levels and code tables. The computational costs of the LOT system were only 75-85% more than the DCT system. Therefore, the LOT system is an economical choice to improve the existing DCT system. On the other hand, the DWT system introduced new ways to compress the image. The PSNR performance of the DWT systems were comparable to the DCT JPEG sys- tem. The visual threshold quantizer worked well together with the optimal run-length

91 Huffman coder. The reconstructed image suffered from blurriness due to severe quan- tization of high frequency bands. The 3-level EZW system with the adaptive Huffman coder yielded the worse PSNR performance of all four systems. Nevertheless, it had the potential to improve by using a different coder as mentioned earlier. This system exhibited no blockiness but suffered from blurriness on the reconstructed image like the visual threshold. In the case of the EZW system, the blurriness occurred because the bit resource ran out. Costs of the wavelet system were mainly the computational costs of wavelet coefficients. The algorithm used in this thesis was the circular convo- lution, which was not the optimized algorithm. Other algorithms, such as the lifting algorithm, may reduce the computational costs. The quantization and the coding cost is not the main problem with the visual threshold. However, in the case of the EZW system, the zerotree searching algorithm increases the overhead of the system. The newer version of the zerotree algorithm such as SPIHT may work better. In addition, the EZW system in this thesis used the adaptive Huffman to translate one symbol at a time. This encoding scheme may not be optimal. According to the statistics, there were a lot of zerotree root symbols in the encoded file. The run-length coder can take advantage of this situation.

92 Figure 4-3: bfragl: original image at 8 bpp

93 Figure 4-4: bfrag2: DCT + JPEG + Run-Length Huffman at 0.50 bpp

94 Figure 4-5: bfrag3: 3-level DWT + EZW + Adaptive Huffman at 0.50 bpp

95 Figure 4-6: bfrag4: 4-level DWT + EZW + Adaptive Huffman at 0.50 bpp

96 Figure 4-7: bfrag5: 3-level DWT + Visual Threshold + Run-Length Huff- man at 0.50 bpp The visual threshold quantizer used the output resolution of 32 pixels/degree

97 Figure 4-8: bfrag6: LOT + JPEG + Run-Length Huffman at 0.50 bpp

98 Figure 4-9: lenal: original image at 8 bpp

99 Figure 4-10: lena2: DCT + JPEG + Run-Length Huffman at 0.50 bpp

100 Figure 4-11: lena3: 3-level DWT + EZW + Adaptive Huffman at 0.50 bpp

101 Figure 4-12: lena4: 4-level DWT + EZW + Adaptive Huffman at 0.50 bpp

102 Figure 4-13: lena5: LOT + JPEG + Run-Length Huffman at 0.50 bpp

103 Figure 4-14: lena6: 3-level DWT + Visual Threshold + Run-Length Huff- man at 0.50 bpp The visual threshold quantizer used the output resolution of 32 pixels/degree

104 Chapter 5

Summary

Ten variants of three transform coding systems were compared in terms of their system complexity and peak signal-to-noise ratios (PSNR). Seven black & white images were used including Lena and Barbara. The transforms tested included the DCT, the

LOT, and the DWT. The quantizers tested included the optimal uniform quantizer, the JPEG uniform quantizer, the visual threshold quantizer, and the EZW quantizer.

The entropy coders tested included the Huffman coder, the adaptive Huffman coder, and the run-length Huffman coder. It was found that the relationship between PSNR and bit rate was mainly influ- enced by the choice of quantizer and entropy coder. In addition, the EZW can take advantage of the number of DWT levels to provide better compression. Finally, in terms of the visual quality given the same bit rate, the LOT JPEG ranked the first, while the DCT JPEG and the visual threshold wavelet tied the second. Finally, the EZW system ranked the last. However, the EZW system may be more desirable when the exact bit rate is required. This simulation investigated only a few combinations of transform coding systems. There are other kinds of quantizer and entropy coder left to be compared, such as the arithmetic coder. In the case of the LOT system, the quantizer and the entropy coder used in the thesis are specifically designed for the DCT JPEG system. Therefore, it may be possible to improve the LOT system by designing the quantizer and the encoder specifically for the LOT coefficients.

105 Compared to the DCT system, the wavelet system is relatively new in this field. Up to now, there is no standardized wavelet system for image compression. Many studies have been conducted about wavelet compression, but further studies should be done to improve both the computational costs and the PSNR performance the DWT system. One possible study is to design the optimal, universal run-length Huffman coder for the visual threshold. In the case of the EZW system, different encoding schemes, such as the run-length coder or the arithmetic coder, may be used to improve the PSNR of the system because there are many zerotree root symbols in the encoded file.

106 Room 14-0551 77 Massachusetts Avenue Cambridge, MA 02139 Ph: 617.253.2800 Mil~ibraries Email: [email protected] Document Services http://libraries.mit.edu/docs

DISCLAIMER

MISSING PAGE(S),

Page 107 is missing from the Archives copy. This is the most complete version available. Bibliography

[1] Vasudev Bhaskaran and Konstantinos Konstantinides. Image and Com- pression Standards: Algorithms and Architectures. Kluwer Academic Publisher, Boston, 1995.

[2] C.S. Burrus, Ramesh A. Gopinath, and Haitao Guo. Introduction to Wavelets and Wavelet Transforms: A Primer. Prentice Hall, Upper Saddle River, NJ, 1998.

[3] David Donoho et al. Wavelab 802 for MATLAB5.x. [Online Document], October 1999. Available HTTP: http://www-stat.stanford.edu/-wavelab/.

[4] Jae S. Lim. Two-Dimentional Signal and Image Processing.Prentice Hall, Upper Saddle River, NJ, 1990.

[5] Henrique S. Malvar. Signal Processing with Lapped Transforms. Artech House, Boston, MA, 1992.

[6] Henrique S. Malvar. Lapped transform algorithms. [Online Document], October 2000. Available HTTP: http://www.research.microsoft.com/-malvar/.

[7] Henrique S. Malvar and David H. Staelin. The LOT: Transform coding without blocking effects. IEEE Transactions on Acoustics, Sppech and Signal Processing, 37(4):553-559, April 1989.

[8] Alan V. Oppenheim, Ronald W. Shafer, and John R. Buck. Dicrete-Time Signal Processing. Prentice Hall, Upper Saddle River, NJ, 2 edition, 1999.

108 [9] William B. Pennebaker and Joan L. Mitchell. JPEG: Still Image Data Compres- sion Standard. Van Norstrand Reinhold, New York, 1993.

[10] A Said and W.A. Pearlman. A new, fast, and efficient image based on set partitioning in hierarchical trees. IEEE Transactions on Circuits and Systems for Video Techonology, 6(3):243-250, June 1996.

[11] J.M. Shapiro. Embedded image coding using zerotrees of wavelet coefficients. IEEE Transactions on Signal Processing, 41(12):3445-3462, December 1993.

[12] Gilbert Strang. Wavelets from filter banks. In Gordon Erlebacher, M.Yousuff Hussaini, and Leland M. Jameson, editors, Wavelets: Theory and Applications. Oxford University Press, New York, 1996.

[13] Gilbert Strang and Truong Nguyen. Wavelets and Filter Banks. Wellesly- Cambridge Press, WellesleyMA, 1996.

[14] T.D. Tran and T.Q. Nguyen. A progressive transmission image coder using linear phase uniform filter banks as block transforms. IEEE Transactions on Image Processing,8(11):1493-1507, November 1999.

[15] J.D. Villasenor, B. Belzer, and J. Liao. Wavelet filter evaluation for image com- pression. IEEE Transactions on Image Processing,4(8):1053-1060, August 1995.

[16] Andrew B. Watson, Gloria Y. Yang, Joshua A. Solomon, and John D. Villasenor. Visual thresholds for wavelet quantization error. In Bernice E. Rogowitz and Jan P. Allebach, editors, Proceedings of SPIE: Human Vision and Electronic Imaging, volume 2657, pages 382-392, April 1996.

109