YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: FELICS

Abstract

In this project, an image compression technique is developed using both lossyand lossless image compression. The lossy image compression technique used hereis the 2D-DWT technique. It uses haar wavelet for image compression. The levelof decomposition of image is decided by required compression ratio. The losslessimage compression technique used here is the FELICS algorithm. It uses adjustedbinary coding and Golomb-Rice coding for lossless image compression. It is aVLSI-oriented algorithm.

The technique which we have developed has an encoder and a decoder. Anencoder takes the input image, performs the 2D-DWT on the image upto desiredlevel, decided by compression ratio required. The 2D-DWT block gives only LL i.e.approximate band to FELICS encoder, which further compresses the data blockin lossless manner. This compressed data block is then given to the decoder. Thedecoder has a FELICS decoder and a 2D-IDWT block. The FELICS decoderreconstructs the LL band and gives it to 2D-IDWT block. The 2D-IDWT bandappends the other bands, which are set to zero, to LL band and finally the imageis reconstructed.

The quality of images obtained using this technique, is compared using vari-ous image quality metrics such as Compression Ratio (CR), Mean Square Error(MSE), Peak Signal to Noise Ratio (PSNR), Normalized Cross-Correlation (NCC),Average Difference (AD), Structural Content (SC) and Normalized Absolute Error(NAE). The study of the technique and analysis of results is done using MATLAB.

i

Page 2: FELICS

Acknowledgment

I am pleased to present this dissertation report entitled “A Fast, Efficient,Lossless Image Compression System” to my college as part of academic activity.

I would like to express my deep sense of gratitude to my guide Prof. S. N.Kore for his valuable guidance, encouragement and kind co-operation throughoutthe dissertation work. I feel proud to present my dissertation under his guidance.

I am thankful to Dr. Mrs. S. S. Deshpande and Dr. Mrs. A. A. Aghashe fortheir encouragement and support.I am also thankful to all the teaching staff andnon-teaching staff for their co-operation to complete my dissertation work. Lastbut not the least I am very thankful to all my friends, parents and those whohelped me directly or indirectly throughout this dissertation work.

Akshay BhosaleWCE, Sangli

ii

Page 3: FELICS

Contents

Abstract i

Acknowledgments ii

List of Figures vi

List of Tables vii

1 Introduction 71.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2 Problem Description . . . . . . . . . . . . . . . . . . . . . . . . . . 71.3 Organization of Report . . . . . . . . . . . . . . . . . . . . . . . . . 8

2 Literature Survey and Related Work 92.1 JPEG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2 JPEG 2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.3 Lossless JPEG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.4 JPEG-LS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.5 FELICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3 Wavelet Transform and its Application 153.1 Method of applying transform . . . . . . . . . . . . . . . . . . . . . 153.2 Definition One level of the transform . . . . . . . . . . . . . . . . . 163.3 The Haar wavelet . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.4 Haar transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

4 Background of FELICS Algorithm 194.1 Adjusted Binary Code . . . . . . . . . . . . . . . . . . . . . . . . . 214.2 Coding Example of Adjusted Binary Coding . . . . . . . . . . . . . 224.3 Golomb-Rice Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.4 Coding Example of Golomb-Rice Coding . . . . . . . . . . . . . . . 244.5 Coding Flow of FELICS Algorithm . . . . . . . . . . . . . . . . . . 254.6 General Example of Coding . . . . . . . . . . . . . . . . . . . . . . 25

iii

Page 4: FELICS

5 2D-DWT - FELICS Algorithm 295.1 Encoder of Proposed Technique . . . . . . . . . . . . . . . . . . . . 29

5.1.1 2D-DWT Block . . . . . . . . . . . . . . . . . . . . . . . . . 305.1.2 FELICS Encoder . . . . . . . . . . . . . . . . . . . . . . . . 31

5.2 Decoder of Proposed Technique . . . . . . . . . . . . . . . . . . . . 315.2.1 FELICS Decoder . . . . . . . . . . . . . . . . . . . . . . . . 315.2.2 2D-IDWT Block . . . . . . . . . . . . . . . . . . . . . . . . 32

5.3 Modified Image Template . . . . . . . . . . . . . . . . . . . . . . . 33

6 Results Analysis 356.1 Image Quality Parameters . . . . . . . . . . . . . . . . . . . . . . . 356.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

7 Conclusion and Future Scope 447.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447.2 Future Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

References 46

Publication 49

iv

Page 5: FELICS

List of Figures

1 General block diagram of Lossless image compression system . . . . 32 Illustration of prediction template in FELICS . . . . . . . . . . . . 43 Flowchart for the FELICS Algorithm . . . . . . . . . . . . . . . . . 44 Probability distribution model in FELICS . . . . . . . . . . . . . . 5

2.1 DPCM encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.2 Block diagram of Lossless JPEG . . . . . . . . . . . . . . . . . . . . 122.3 Block diagram lossless image compression technique . . . . . . . . . 13

3.1 The “Haar” wavelet . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.2 (a) Original image (b) Image after 1-level decomposition (c) Image

after 2-level decomposition . . . . . . . . . . . . . . . . . . . . . . . 18

4.1 Illustration of prediction template used in FELICS . . . . . . . . . 194.2 Probability distribution model of intensity in FELICS . . . . . . . . 204.3 Main flowchart for FELICS Algorithm . . . . . . . . . . . . . . . . 204.4 Flowchart for Adjusted Binary Codes . . . . . . . . . . . . . . . . . 214.5 Reference pixels and Current pixel adjusted binary code example . . 224.6 Flowchart for Golomb-Rice Codes . . . . . . . . . . . . . . . . . . . 234.7 Reference pixels and Current pixel for Golomb-Rice code example . 244.8 Pixels in Case 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.9 Pixels in Case 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264.10 Pixels in Case 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274.11 Pixels in Case 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

5.1 Block Diagram of Encoder . . . . . . . . . . . . . . . . . . . . . . . 295.2 Block Diagram of 2D-DWT Block . . . . . . . . . . . . . . . . . . . 305.3 Block Diagram of FELICS Encoder . . . . . . . . . . . . . . . . . . 315.4 Block Diagram of Decoder . . . . . . . . . . . . . . . . . . . . . . . 315.5 Block Diagram of FELICS Decoder . . . . . . . . . . . . . . . . . . 325.6 Block Diagram of 2D-IDWT Block . . . . . . . . . . . . . . . . . . 325.7 Original prediction template used in FELICS . . . . . . . . . . . . . 335.8 Modified prediction template used in FELICS . . . . . . . . . . . . 33

6.1 Lenna image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS . . . . . . . . . . . . . . 38

v

Page 6: FELICS

6.2 Baboon image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS . . . . . . . . . . . . . . 39

6.3 Bridge image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS . . . . . . . . . . . . . . 40

6.4 Boat image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS . . . . . . . . . . . . . . 41

6.5 Medical image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS . . . . . . . . . . . . . . 42

6.6 Satellite image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS . . . . . . . . . . . . . . 43

vi

Page 7: FELICS

List of Tables

4.1 Pixels and corresponding Codewords . . . . . . . . . . . . . . . . . 28

6.1 Results for Lenna image . . . . . . . . . . . . . . . . . . . . . . . . 386.2 Results for Baboon image . . . . . . . . . . . . . . . . . . . . . . . 396.3 Results for Bridge image . . . . . . . . . . . . . . . . . . . . . . . . 406.4 Results for Boat image . . . . . . . . . . . . . . . . . . . . . . . . . 416.5 Results for Medical image . . . . . . . . . . . . . . . . . . . . . . . 426.6 Results for Satellite image . . . . . . . . . . . . . . . . . . . . . . . 43

vii

Page 8: FELICS

1. Name of Student : Mr. Bhosale Akshay Gajanan

2. Name of Course : M.Tech. in Electronics Engineering

3. Date of Registration : August, 2010.

4. Name of Guide : Mr. S.N.Kore

5. Proposed Title of Dissertation : Fast, Efficient, LosslessImage Compression System.

6. Synopsis of the Work :

A)Relevance and Problem Definition

RelevanceDue to the great innovation of display and information technology, the strin-

gent requirement of data capacity is drastically increased in human life. Thistrend makes a significant impact on storage and communication evolution. Thedata compression technique is extensively applied to offer acceptable solution forthis scenario, some images like satellite images or medical images have very highresolution. Such high resolution images have large file size. Computation timerequired to process such high quality images is more. Hence compression of im-ages and video has become need of hour. The image can be compressed usinglossy or lossless compression techniques. In the lossy image compression tech-nique, the reconstructed image is not exactly same as the original image. Thelossless image compression can remove redundant information and guarantee thatthe reconstructed image is without any loss to original image. Different imagecompression techniques are suggested by the researchers, but the technique with

Department of Electronics, Walchand College of Engineering, Sangli 1

Page 9: FELICS

high data compression with low loss is always preferred. Because of the advance-ment in Internet, world has come very close and can afford and avail the servicessuch as medical, tourism, education etc., remotely. Data compression is the key ingiving such fast and efficient communication. It has made large impact on servicesector to provide best services to all sections of society. High code efficiency ismeasurement parameter for performance of data compression system.

Problem DefinitionDevelopment of Fast, Efficient, Lossless Image Compression System (FELICS)

for image data.

B) Present TheoriesUsing present techniques, we can compress image either by using lossy or loss-

less compression algorithms. For lossy compression technique, many sophisticatedstandards have been intensively developed such as JPEG [1] and JPEG 2000 [2] forstill image, and MPEG-4 and H.264 for multimedia communications and high-endvideo applications, respectively. Many articles put more effort on related VLSIarchitecture designs [3]. Therefore, both algorithm and hardware implementa-tion have attracted massive research effort for the evolution of lossy compressiontechnique. Lossless compression can remove redundant information and guaran-tee that the reconstructed procedure is without any loss to original information.This can ensure that the decoded information is exactly identical to original in-formation. According to the coding principle of lossless compression technique,it can be categorized into two fields: dictionary-based and prediction-based. Indictionary-based, frequently occurring and repetitive patterns are assigned to ashorter codeword. The less efficient codeword is assigned to the others. Basedon this principle, the codeword table should be constructed to provide the fixedmapping relationship. Many famous methods, including Huffman coding [4], runlength coding , arithmetic coding, and LZW [5], have been widely developed, andsome of them are further applied in lossy compression standards.

C) IntroductionThe dictionary-based algorithm exploits almost identical mapping relation-

ship; prediction technique is utilized to improve coding efficiency. Prediction-based algorithms apply prediction technique to generate the residual, and utilizethe entropy coding tool to encode it. Many methods, including fast, efficient,lossless image compression system (FELICS)[6], context-based, adaptive, losslessimage coding (CALIC)[7] and JPEG-LS, have been extensively developed in thisfield. Among these methods, the JPEG-LS presents better performance and isfurther adopted as lossless/near-lossless standard, but it possesses serious datadependency and complex coding procedure that limits the hardware performancein high-throughput applications. The fast, efficient, lossless image compressionsystem (FELICS) algorithm, which consists of simplified adjusted binary code

Department of Electronics, Walchand College of Engineering, Sangli 2

Page 10: FELICS

and Golomb-Rice code with storage-less k parameter selection, is proposed toprovide the lossless compression method for high-throughput applications. Thesimplified adjusted binary code reduces the number of arithmetic operations andimproves processing speed. According to theoretical analysis, the storage-less kparameter selection applies a fixed k value in Golomb-Rice code to remove datadependency and extra storage for cumulation table. Besides, the colour differencepre-processing is also proposed to improve coding efficiency with simple arithmeticoperation. The FELICS [6], proposed by P. G. Howard and J. S. Vitter in 1993,is a lossless compression algorithm with the advantage of fast and efficient codingprinciple. Furthermore, FELICS presents competitive coding efficiency in com-parison with other sophisticated lossless compression algorithms.

D) The Proposed WorkMost lossless image compression methods consists of four main components as

shown in Fir. a selector, a predictor, an error modeller and a statistical coder.Pixel Selector: - A selector is used to choose the next pixel which is to beencoded, from the image data.

Figure 1: General block diagram of Lossless image compression system

Intensity Predictor: - A predictor is used to estimate the intensity of the cur-rent pixel depending on the intensities of the two reference pixels.Error modeller: - It is used to estimate the distribution of the prediction error.Statistical coder: - It is used to code the prediction error using the error dis-tribution. By using an appropriate pixel sequence we can obtain a progressiveencoding, and by using sophisticated prediction and error modelling techniquesin conjunction with arithmetic coding we can obtain state-of-the-art compressionefficiency. These techniques are computation intensive. The FELICS is a simplesystem for lossless image compression that runs very fast with only minimal lossof compression efficiency [10]. In this algorithm raster-scan order is used, and apixel’s two nearest neighbours are used to directly obtain an approximate prob-ability distribution for its intensity, in effect combining the prediction and errormodelling steps.

FELICS utilizes two reference pixels around current pixel to yield the pre-diction template as shown in Fig. , and it can be divided into four cases. Incase 1, since surrounding reference pixels are not available for the first two pixels,P1 and P2, both current pixels are directly packed into bit stream with originalpixel intensity. For case 2, successive pixels, N1 and N2, are regarded as referencepixels for current pixel P5. For non-first row, cases 3 and 4 clearly define therelationship between current pixel and reference pixels. Between N1 and N2, the

Department of Electronics, Walchand College of Engineering, Sangli 3

Page 11: FELICS

Figure 2: Illustration of prediction template in FELICS

smaller reference pixel is represented as L, and the other one is H. As in Fig. , theintensity distribution model is exploited to predict the correlation between currentpixel and reference pixels. In this model, the intensity that occurs between L andH is with almost uniform distribution, and regarded as in-range. The intensitieshigher than H or smaller than L are regarded as above range and below range,respectively. For in-range, the adjusted binary code is adopted, and GolombRicecode is for both above range and below range [10].

Figure 3: Flowchart for the FELICS Algorithm

1) Adjusted Binary CodeFig. shows that the adjusted binary code is adopted in in-range, where

the intensity of current pixel is between H and L. For in-range, the probabilitydistribution is slightly higher in the middle section and lower in both side sections.Therefore, the feature of adjusted binary code claims that the shorter codeword

Department of Electronics, Walchand College of Engineering, Sangli 4

Page 12: FELICS

Figure 4: Probability distribution model in FELICS

is assigned to the middle section, and longer one is assigned to both side sections.To describe the coding flow of adjusted binary code, the coding parameters shouldbe first declared as follows:

delta = H − Lrange = delta+ 1upperbound = dlog2(range)elowerbound = blog2(range)cthreshold = 2upperbound − rangeshiftnumber =

(range− threshold)

2

The adjusted binary code takes the sample of P-L to be encoded, and rangeindicates that the number of possible samples should be encoded for a given delta.The upper bound and lower bound denote the maximum and minimum numberof bits to represent the codeword for each sample, respectively. Particularly, thelower bound is identical to upper bound, while the range is exactly equal to thepower of two. The threshold and shift number are utilized to determine whichsample should be encoded with upper bound bit or lower bound bit.Example: - If delta = 4, the range is equal to [0, 4]. According to coding pa-rameters, the required number of bits is 2 for lower bound and 3 for upper bound.With the intensity distribution in in-range, 2 bits are allocated for the middlesection, including sample of [1, 2, 3], and 3 bits for side section, including sampleof [0, 4]. Possible sample of P-L with delta = 4 range = delta+ 1range = 4 + 1 = 5upperbound = dlog2(range)e = dlog2(5)e = 3lowerbound = floorlog2(range) = blog2(5)c = 2threshold = 2upperbound − rangethreshold = 23− 5 = 8− 5 = 3

shiftnumber =(range− threshold)

2shiftnumber = (5− 3)/2 = 1

Department of Electronics, Walchand College of Engineering, Sangli 5

Page 13: FELICS

2) Golomb-Rice CodeFor both above range and below range, the probability distribution sharply

varies with exponential decay rate, and the efficient codeword should be moreintensively assigned to the intensity with high probability. Therefore, Golomb-Rice code is adopted as the coding tool for both above range and below range.With Golomb-Rice code, the codeword of sample x is partitioned into unary andbinary parts.

Golomb-Rice code: - Unary part: b( x2k

)cBinary part: x mod 2k

where k is a positive integer.The entire codeword is concatenated with unary part and binary part, and one

bit is inserted between both for identification. Therefore, the Golomb-Rice codeis a special case of Golomb code, and its k parameter, exactly equal to power of2, is efficient for hardware implementation. The selection procedure of k parame-ter induces serious data dependency and consumes considerable storage capacity.The resulting compressor runs about five times as fast as an implementation ofthe lossless mode of the JPEG proposed standard while obtaining slightly bettercompression on many images.

E) Facilities Available : Library, Computer Lab, Internet etc.

F) Estimated Cost : 10,000/-(Approx.)

G) Expected Date of Completion: July, 2012.

Akshay Gajanan Bhosale Prof. Mr. S.N.KoreStudent Guide

Dr.Mrs.S.S.Deshpande

H.O.D.

Electronics Department

Walchand College of Engg., Sangli.

Department of Electronics, Walchand College of Engineering, Sangli 6

Page 14: FELICS

Chapter 1

Introduction

1.1 Motivation

Due to the great innovation of display and information technology, the strin-gent requirement of data capacity is drastically increased in human life. Thistrend makes a significant impact on storage and communication evolution. Thedata compression technique is extensively applied to offer acceptable solution forthis scenario, some images like satellite images or medical images have very highresolution. Such high resolution images have large file size and computation timerequired to process such high quality images is more. Hence compression of im-ages and video has become need of hour. The image can be compressed usinglossy or lossless compression techniques. In the lossy image compression tech-nique, the reconstructed image is not exactly same as the original image. Thelossless image compression can remove redundant information and guarantee thatthe reconstructed image is without any loss to original image. Different imagecompression techniques are suggested by the researchers, but the technique withhigh data compression with low loss is always preferred.

Because of the advancement in Internet, world has come very close and canafford and avail the services such as medical, tourism, education etc., remotely.Data compression is the key in giving such fast and efficient communication. Ithas made large impact on service sector to provide best services to all sections ofsociety. High code efficiency is measurement parameter for performance of datacompression system.

1.2 Problem Description

Development of an image compression technique, which provides an improvedcompression ratio and also maintains the quality of image. This technique is tobe developed using a combination of both lossy and lossless techniques. The lossytechnique used here will be 2D-DWT and lossless technique used here will beFELICS algorithm.

7

Page 15: FELICS

1.3 Organization of Report

1.3 Organization of Report

The dissertation report is organized into six chapters. Chapter 1 consists ofmotivation behind work and problem description. Chapter 2 provides literaturesurvey which describes the present techniques of both lossy and lossless imagecompression.

Chapter 3 describes the lossy 2D-DWT technique and its scope in the proposedtechnique. Chapter 4 describes the background of lossless FELICS algorithm.Chapter 5 describes the developed method using 2D-DWT and FELICS algorithmfor image compression. Chapter 6 includes results analysis. Chapter 7 includesconclusion about work, future scope and the references.

Department of Electronics, Walchand College of Engineering, Sangli 8

Page 16: FELICS

Chapter 2

Literature Survey and RelatedWork

Various Methods for Image Compression

2.1 JPEG

The term ”JPEG” is an acronym for the Joint Photographic Experts Groupwhich created the standard. The JPEG compression algorithm is at its best onphotographs and paintings of realistic scenes with smooth variations of tone andcolor. For web usage, where the amount of data used for an image is important,JPEG is very popular [1].

JPEG has been working to establish the first international compression stan-dard for continuous tone still images, both grayscale and color. JPEGs proposedstandard aims to be generic, to support a wide variety of applications for contin-uous tone images. To meet the differing needs of many applications, the JPEGstandard includes two basic compression methods, each with various modes of op-eration. A DCT based method is specified for lossy compression, and a predictivemethod for lossless compression. JPEG features a simple lossy technique knownas the Baseline method, a subset of the other DCT based modes of operation.

As the typical use of JPEG is a lossy compression method, which somewhatreduces the image fidelity, it should not be used in scenarios where the exact re-production of the data is required (such as some scientific and medical imagingapplications and certain technical image processing work). JPEG is also not wellsuited to files that will undergo multiple edits, as some image quality will usuallybe lost each time the image is decompressed and recompressed, particularly if theimage is cropped or shifted, or if encoding parameters are changed.The compres-sion method is usually lossy, meaning that some original image information is lostand cannot be restored, possibly affecting image quality.

JPEG is a commonly used method of lossy compression for digital photography(image). The degree of compression can be adjusted, allowing a selectable trade-off

9

Page 17: FELICS

2.2 JPEG 2000

between storage size and image quality. JPEG typically achieves 10:1 compressionwith little perceptible loss in image quality.

JPEG codec example Although a JPEG file can be encoded in various ways,most commonly it is done with JFIF encoding. The encoding process consists ofseveral steps:

1. The representation of the colors in the image is converted from RGB toYCBCR, consisting of one luma component (Y’), representing brightness,and two chroma components, (CB and CR), representing color. This step issometimes skipped.

2. The resolution of the chroma data is reduced, usually by a factor of 2. Thisreflects the fact that the eye is less sensitive to fine color details than to finebrightness details.

3. The image is split into blocks of 88 pixels, and for each block, each of the Y,CB, and CR data undergoes a discrete cosine transform (DCT). A DCT issimilar to a Fourier transform in the sense that it produces a kind of spatialfrequency spectrum.

4. The amplitudes of the frequency components are quantized. Human visionis much more sensitive to small variations in color or brightness over largeareas than to the strength of high-frequency brightness variations. Therefore,the magnitudes of the high-frequency components are stored with a loweraccuracy than the low-frequency components. The quality setting of theencoder affects to what extent the resolution of each frequency componentis reduced. If an excessively low quality setting is used, the high-frequencycomponents are discarded altogether.

5. The resulting data for all 88 blocks is further compressed with a losslessalgorithm, a variant of Huffman encoding.

The decoding process reverses these steps, except the quantization because itis irreversible.

2.2 JPEG 2000

JPEG 2000 is an image compression standard and coding system. While thereis a modest increase in compression performance of JPEG 2000 compared to JPEG,the main advantage offered by JPEG 2000 is the significant flexibility of the code-stream [2]. The codestream obtained after compression of an image with JPEG2000 is scalable in nature, meaning that it can be decoded in a number of ways;for instance, by truncating the codestream at any point, one may obtain a repre-sentation of the image at a lower resolution, or signal-to-noise ratio. By ordering

Department of Electronics, Walchand College of Engineering, Sangli 10

Page 18: FELICS

2.2 JPEG 2000

the codestream in various ways, applications can achieve significant performanceincreases.

However, as a consequence of this flexibility, JPEG 2000 requires encoders anddecoders that are complex and computationally demanding. Another difference,in comparison with JPEG, is in terms of visual artifacts: JPEG 2000 producesringing artifacts, manifested as blur and rings near edges in the image, while JPEGproduces ringing artifacts and ’blocking’ artifacts, due to its 88 blocks.

Features

1. Superior compression performance: at high bit rates, where artifacts becomenearly imperceptible, JPEG 2000 has a small machine-measured fidelity ad-vantage over JPEG. At lower bit rates, JPEG 2000 has a much more signif-icant advantage over certain modes of JPEG: artifacts are less visible andthere is almost no blocking. The compression gains over JPEG are attributedto the use of DWT and a more sophisticated entropy encoding scheme.

2. Multiple resolution representation: JPEG 2000 decomposes the image intoa multiple resolution representation in the course of its compression process.This representation can be put to use for other image presentation purposesbeyond compression as such.

3. Progressive transmission by pixel and resolution accuracy, commonly re-ferred to as progressive decoding and signal-to-noise ratio (SNR) scalability:JPEG 2000 provides efficient code-stream organizations which are progres-sive by pixel accuracy and by image resolution (or by image size). Thisway, after a smaller part of the whole file has been received, the viewer cansee a lower quality version of the final picture. The quality then improvesprogressively through downloading more data bits from the source.

4. Lossless and lossy compression: Like JPEG, the JPEG 2000 standard pro-vides both lossless and lossy compression in a single compression architec-ture. Lossless compression is provided by the use of a reversible integerwavelet transform in JPEG 2000.

5. Random code-stream access and processing, also referred as Region Of In-terest (ROI): JPEG 2000 code streams offer several mechanisms to supportspatial random access or region of interest access at varying degrees of gran-ularity. This way it is possible to store different parts of the same pictureusing different quality.

6. Error resilience: JPEG 2000 is robust to bit errors introduced by noisycommunication channels, due to the coding of data in relatively small inde-pendent blocks.

Department of Electronics, Walchand College of Engineering, Sangli 11

Page 19: FELICS

2.3 Lossless JPEG

2.3 Lossless JPEG

Lossless JPEG was developed as a late addition to JPEG in 1993, using acompletely different technique from the lossy JPEG standard. It uses a predictivescheme based on the three nearest (causal) neighbors (upper, left, and upper-left),and entropy coding is used on the prediction error.

Lossless mode of operation Lossless JPEG is actually a mode of operation ofJPEG. This mode exists because the Discrete Cosine Transform (DCT) basedform cannot guarantee that encoder input would exactly match decoder outputsince the Inverse DCT is not rigorously defined. Unlike the lossy mode whichis based on the DCT, the lossless coding process employs a simple predictivecoding model called differential pulse code modulation (DPCM). This is a modelin which predictions of the sample values are estimated from the neighboringsamples that are already coded in the image. Most predictors take the averageof the samples immediately above and to the left of the target sample. DPCMencodes the differences between the predicted samples instead of encoding eachsample independently. The differences from one sample to the next are usuallyclose to zero.

Figure 2.1: DPCM encoder

A typical DPCM encoder is displayed in Fig.2.1 The block in the figure actsas a storage of the current sample which will later be a previous sample.

Figure 2.2: Block diagram of Lossless JPEG

The main steps of lossless operation mode are depicted in Fig.2.2. The threeneighboring samples must be already predicted samples. Once all the samples arepredicted, the differences between the samples can be obtained and entropy-codedin a lossless fashion using Huffman coding or arithmetic coding.

Department of Electronics, Walchand College of Engineering, Sangli 12

Page 20: FELICS

2.4 JPEG-LS

2.4 JPEG-LS

JPEG-LS is a simple and efficient baseline algorithm which consists of twoindependent and distinct stages called modeling and encoding. JPEG-LS wasdeveloped with the aim of providing a low-complexity lossless and near-losslessimage compression standard that could offer better compression efficiency thanlossless JPEG. It was developed because at the time, the Huffman coding-basedJPEG lossless standard and other standards were limited in their compressionperformance. Total decorrelation cannot be achieved by first order entropy ofthe prediction residuals employed by these inferior standards. JPEG-LS, on theother hand, can obtain good decorrelation. The core of JPEG-LS is based on theLOCO-I algorithm, that relies on prediction, residual modeling and context-basedcoding of the residuals. Most of the low complexity of this technique comes fromthe assumption that prediction residuals follow a two-sided geometric distribution(also called a discrete Laplace distribution) and from the use of Golomb-like codes,which are known to be approximately optimal for geometric distributions. Besideslossless compression, JPEG-LS also provides a lossy mode (”near-lossless”) wherethe maximum absolute error can be controlled by the encoder. Compression forJPEG-LS is generally much faster than JPEG 2000 and much better than theoriginal lossless JPEG standard.

2.5 FELICS

Most lossless image compression methods in the literature consist of four maincomponents as shown in Fig. 2.3 : a selector to choose the next pixel to beencoded, a predictor to estimate the intensity of the pixel, an error modeler toestimate the distribution of the prediction error, and a statistical coder to codethe prediction error using the error distribution. By using an appropriate pixelsequence we can obtain a progressive encoding, and by using sophisticated predic-tion and error modeling techniques in conjunction with arithmetic coding we canobtain state-of-the-art compression efficiency. These techniques are computationintensive. A simpler system for lossless image compression that runs very fast

Figure 2.3: Block diagram lossless image compression technique

with only minimal loss of compression efficiency is developed.This technique iscalled FELICS, for Fast, Efficient, Lossless Image Compression System [3]. Here,raster-scan order is used, and a pixel’s two nearest neighbors to directly obtainan approximate probability distribution for its intensity, in effect combining the

Department of Electronics, Walchand College of Engineering, Sangli 13

Page 21: FELICS

2.5 FELICS

prediction and error modeling steps. A novel technique to select the closest of aset of error models, each corresponding to a simple prefix code is used. Finally, theintensity is encoded using the selected prefix code. The FELICS uses the adjustedbinary codes and Golomb-Rice codes for encoding. The resulting compressor runsabout five times as fast as an implementation of the lossless mode of the JPEGproposed standard while obtaining slightly better compression on many images.

Department of Electronics, Walchand College of Engineering, Sangli 14

Page 22: FELICS

Chapter 3

Wavelet Transform and itsApplication

Wavelet compression is a form of data compression well suited for image com-pression (sometimes also video compression and audio compression). The goal isto store image data in as little space as possible in a file. Wavelet compressioncan be either lossless or lossy.

Using a wavelet transform, the wavelet compression methods are adequate forrepresenting transients, such as high-frequency components in two-dimensionalimages, for example an image of stars on a night sky. This means that the transientelements of a data signal can be represented by a smaller amount of informationthan would be the case if some other transform, such as the more widespreaddiscrete cosine transform, had been used.

Wavelet compression is not good for all kinds of data: transient signal char-acteristics mean good wavelet compression, while smooth, periodic signals arebetter compressed by other methods, particularly traditional harmonic compres-sion (frequency domain, as by Fourier transforms and related). Data statisticallyindistinguishable from random noise is not compressible by any means.

3.1 Method of applying transform

When a wavelet transform is applied to an image, first it is applied row-wiseand then applied to the generated data, coloumn-wise. This produces as manycoefficients as there are pixels in the image (i.e.: there is no compression yet sinceit is only a transform). These coefficients can then be compressed more easilybecause the information is statistically concentrated in just a few coefficients. Thisprinciple is called transform coding. After that, the coefficients are quantizedand the quantized values are entropy encoded and/or run length encoded. Innumerical analysis and functional analysis, a discrete wavelet transform (DWT) isany wavelet transform for which the wavelets are discretely sampled. As with otherwavelet transforms, a key advantage it has over Fourier transforms is temporal

15

Page 23: FELICS

3.2 Definition One level of the transform

resolution: it captures both frequency and location information (location in time).

3.2 Definition One level of the transform

The DWT of a signal x is calculated by passing it through a series of filters.First the samples are passed through a low pass filter with impulse response gresulting in a convolution of the two:

y[n] = x[n] ∗ g[n] =∞∑

k=−∞

x[k]g[n− k] (3.1)

The signal is also decomposed simultaneously using a high-pass filter h. Theoutputs giving the detail coefficients (from the high-pass filter) and approximationcoefficients (from the low-pass). It is important that the two filters are related toeach other and they are known as a quadrature mirror filter.

However, since half the frequencies of the signal have now been removed, halfthe samples can be discarded according to Nyquist’s rule. The filter outputs arethen subsampled by 2 (Mallat’s and the common notation is the opposite, g- highpass and h- low pass):

ylow[n] =∞∑

k=−∞

x[k]g[2n− k] (3.2)

yhigh[n] =∞∑

k=−∞

x[k]h[2n− k] (3.3)

This decomposition has halved the time resolution since only half of each filteroutput characterises the signal. However, each output has half the frequency bandof the input so the frequency resolution has been doubled.

3.3 The Haar wavelet

The Haar sequence was proposed in 1909 by Alfrd Haar. Haar used thesefunctions to give an example of a countable orthonormal system for the space ofsquare-integrable functions on the real line. As a special case of the Daubechieswavelet, the Haar wavelet is also known as D2.

In mathematics, the Haar wavelet is a sequence of rescaled “square-shaped”functions which together form a wavelet family or basis. Wavelet analysis is sim-ilar to Fourier analysis in that it allows a target function over an interval to berepresented in terms of an orthonormal function basis. The Haar sequence is now

Department of Electronics, Walchand College of Engineering, Sangli 16

Page 24: FELICS

3.3 The Haar wavelet

recognised as the first known wavelet basis and extensively used as a teachingexample.

The Haar wavelet is also the simplest possible wavelet. The technical dis-advantage of the Haar wavelet is that it is not continuous, and therefore notdifferentiable. This property can, however, be an advantage for the analysis ofsignals with sudden transitions, such as monitoring of tool failure in machines.For an input represented by a list of 2n numbers, the Haar wavelet transform maybe considered to simply pair up input values, storing the difference and passingthe sum. This process is repeated recursively, pairing up the sums to provide thenext scale: finally resulting in 2n−1 differences and one final sum. it is used forsignal coding, to represent a discrete signal in a more redundant form, often as apreconditioning for data compression.

Figure 3.1: The “Haar” wavelet

The Haar wavelet’s mother wavelet function ψ(t) can be described as

ψ(t) =

1 0 ≤ t < 1/2,

−1 1/2 ≤ t < 1,

0 otherwise.

Its scaling function φ(t) can be described as

φ(t) =

{1 0 ≤ t < 1,

0 otherwise.

Haar matrixThe 2× 2 Haar matrix that is associated with the Haar wavelet is

Department of Electronics, Walchand College of Engineering, Sangli 17

Page 25: FELICS

3.4 Haar transform

H2 =

[1 11 −1

]Using the discrete wavelet transform, one can transform any sequence

(a0, a1, . . . , a2n, a2n+1)of even length into a sequence of two-component-vectors((a0, a1) , . . . , (a2n, a2n+1)). If one right-multiplies each vector with the matrix H2,one gets the result ((s0, d0) , . . . , (sn, dn)) of one stage of the fast Haar-wavelettransform. Usually one separates the sequences s and d and continues with trans-forming the sequence s.

3.4 Haar transform

The Haar transform is the simplest of the wavelet transforms. This trans-form cross-multiplies a function against the Haar wavelet with various shifts andstretches, like the Fourier transform cross-multiplies a function against a sine wavewith two phases and many stretches.

The Haar transform can be thought of as a sampling process in which rows ofthe transformation matrix act as samples of finer and finer resolution.

The resulting decomposition after 1-level and 2-level is visible in the Fig. 3.2

Figure 3.2: (a) Original image (b) Image after 1-level decomposition (c) Imageafter 2-level decomposition

The LL1 block in Fig. 3.2(b), has the approximate information after 1-leveldecomposition, while HH1 block has the detail information after 1-level decompo-sition. Similarly, LL2 block in Fig. 3.2(c), has the approximate information after2-level decomposition, while HH2 block has the detail information after 2-leveldecomposition.

Department of Electronics, Walchand College of Engineering, Sangli 18

Page 26: FELICS

Chapter 4

Background of FELICSAlgorithm

The FELICS algorithm, proposed by P. G. Howard and J. S. Vitter in 1993,is a lossless compression algorithm with the advantage of fast and efficient codingprinciple. In FELICS, three primary techniques, including intensity distributionmodel, adjusted binary code and Golomb-Rice code, are incorporated to constructcomplete coding flow.

Figure 4.1: Illustration of prediction template used in FELICS

As shown in Fig. 4.1, FELICS utilizes two reference pixels around currentpixel to yield the prediction template, and it can be divided into four cases. Incase 1, since surrounding reference pixels are not available for the first two pixels,P1 and P2, both current pixels are directly packed into bitstream with originalpixel intensity. For case 2, successive pixels, N1 and N2, are regarded as referencepixels for current pixel P5. For non-first row, cases 3 and 4 clearly define therelationship between current pixel and reference pixels. Between N1 and N2, thesmaller reference pixel is represented as L, and the other one is H. As depicted inFig. 4.1, the intensity distribution model is exploited to predict the correlationbetween current pixel and reference pixels. In this model, the intensity that occurs

19

Page 27: FELICS

between L and H is with almost uniform distribution, and regarded as in range.The intensity higher than H or smaller than L is regarded as above range andbelow range, respectively. For in range, the adjusted binary code is adopted, andGolomb-Rice code is for both above range and below range [5].

Figure 4.2: Probability distribution model of intensity in FELICS

Figure 4.3: Main flowchart for FELICS Algorithm

Fig. 4.3 shows the main flowchart of the FELICS algorithm. Here, the firsttwo pixels are directly encoded because no reference pixels are available to thosepixels. Then next pixel is encoded, taking previous two pixels as reference pixels.The greater one of two pixels is assigned to H, while smaller one is assigned toL. Now, if the value of current pixel is between H and L, then adjusted binarycoding is used for encoding of that pixel, else that pixel is encoded by Golomb-Ricecoding.

Department of Electronics, Walchand College of Engineering, Sangli 20

Page 28: FELICS

4.1 Adjusted Binary Code

4.1 Adjusted Binary Code

Fig. 4.2 shows that the adjusted binary code is adopted in in-range, wherethe intensity of current pixel is between H and L. For in range, the probabilitydistribution is slightly higher in the middle section and lower in both side sections.Therefore, the feature of adjusted binary code claims that the shorter codewordis assigned to the middle section, and longer one is assigned to both side sections.To describe the coding flow of adjusted binary code, the coding parameters shouldbe first declared as follows:

delta = H − Lrange = delta+ 1upperbound = d(log2(range))elowerbound = b(log2(range))cthreshold = 2upperbound − rangeshiftnumber =

range− threshold2

Figure 4.4: Flowchart for Adjusted Binary Codes

The adjusted binary code takes the sample of P −L to be encoded, and rangeindicates that the number of possible samples should be encoded for a given delta.The upperbound and lowerbound denote the maximum and minimum number ofbits to represent the codeword for each sample, respectively. Particularly, thelowerbound is identical to upperbound, while the range is exactly equal to thepower of two. The threshold and shiftnumber are utilized to determine whichsample should be encoded with upperbound bit or lowerbound bit. After com-puting the various parameters required for adjusted binary codes, the samples

Department of Electronics, Walchand College of Engineering, Sangli 21

Page 29: FELICS

4.2 Coding Example of Adjusted Binary Coding

are available in the range 0 to delta. If the samples are kept as it is i.e. in theascending order starting from zero, then the number of bits required to representa particular sample will go on increasing as value of sample increases.

If the residual has a smaller sample value then, it can be encoded using lessnumber of bits, but if the residual has larger sample value then it requires morenumber of bits. Thus, if there is an image having smaller residual values, thenthe image will be compressed with higher compression ratio. On the other hand,if the image is having higher values of residuals, then the codewords required forrepresenting such residuals require more number of bits and hence, for such animage, instead of compression, the image will get expanded.

To avoid such a situation, the residuals having smaller as well as larger samplevalues are shifted to the centre by the amount equal to shift number which iscalculated previously.

If delta = 4, the range is equal to [0, 4]. The required number of bits is 2 forlowerbound and 3 for upperbound. With the intensity distribution in in-range, 2bits are allocated for the middle section, including sample of [1, 2, 3], and 3 bitsfor side section, including sample of [0, 4].

4.2 Coding Example of Adjusted Binary Coding

Figure 4.5: Reference pixels and Current pixel adjusted binary code example

Fig. 4.5 shows the block of pixels from other than first row and left edge ofimage template i.e. case 4.11 of image template. The current pixel has a value46; its neighboring pixels 40 and 47 are considered as the reference pixels.

Since, the value of current pixel is between the values of two reference pixels;adjusted binary coding is used for encoding of the current pixel.So here,

P = 46, N1 = 40, N2 = 47where, P : Current pixel

N1, N2: Reference pixels

Now, H = max(N1, N2) and L = min(N1, N2), so we haveH = max(40, 47) = 47and L = min(40, 47) = 40. Parameters required are computed as follows,delta = H − L = 7

range = delta+ 1 = 7 + 1 = 8

Department of Electronics, Walchand College of Engineering, Sangli 22

Page 30: FELICS

4.3 Golomb-Rice Code

upperbound = dlog2(range)e = dlog2(8)e = 3

lowerbound = blog2(range)c = blog2(8)c = 2

threshold = 2upperbound − range = 23 − 8 = 0

shiftnumber =(range− threshold)

2=

(8− 0)

2= 4

Samples: 0 1 2 3 4 5 6 7Samples shifted 4 5 6 7 0 1 2 3by shift number

threshold is added 4 5 6 7 0 1 2 3to samples ≥ threshold

The residual of pixel to be encoded is x = P − L = 46 − 40 = 6.Now the sample ‘6’, is encoded as ‘2’, so we have the binary equivalent of ‘2’,asthe codeword, ‘10’. To indicate that the current pixel is encoded using adjustedbinary coding, another ‘1’ is prefixed to the codeword. So the codeword becomes‘110’. The pixel 46 is encoded as ‘110’.

4.3 Golomb-Rice Code

Figure 4.6: Flowchart for Golomb-Rice Codes

For both above range and below range, the probability distribution sharply

Department of Electronics, Walchand College of Engineering, Sangli 23

Page 31: FELICS

4.4 Coding Example of Golomb-Rice Coding

varies with exponential decay rate, and the efficient codeword should be moreintensively assigned to the intensity with high probability. Therefore, Golomb-Rice code is adopted as the coding tool for both above range and below range.With Golomb-Rice code, the codeword of sample x is partitioned into unary andbinary parts

Golomb-Rice Code

Unary part : floor(

x

2k)

Binary part : x mod 2k

(4.1)

where, x is the value of residual and k is a positive integer and it is called asGolomb-Rice coding parameter. The entire codeword is concatenated with unarypart and binary part, and two bits are pre-fixed for identification. Therefore, theGolomb-Rice code is a special case of Golomb code, and its k parameter, exactlyequal to power of 2, is efficient for hardware implementation.

4.4 Coding Example of Golomb-Rice Coding

Figure 4.7: Reference pixels and Current pixel for Golomb-Rice code example

Fig. 4.7 shows the block of pixels from other than first row and left edge ofimage template i.e. case 4 of image template. The current pixel has a value 183;its neighboring pixels 177 and 179 are considered as the reference pixels.

Since, the value of current pixel is not in between the values of two referencepixels; Golomb-Rice coding is used for encoding of the current pixel.So here, P = 183, N1 = 177, N2 = 179where, P : Current pixel

N1, N2: Reference pixelsNow, H = max(N1, N2) and L = min(N1, N2), So we have H = max(177, 179) =179 and L = min(177, 179) = 177. The current pixel is above range since it isgreater than H, so we have to apply Golomb-Rice coding for encoding it. Theresidual for above range is given by x = P −H − 1 = 183− 179− 1 = 3The Golomb-Rice code has three parts: a) prefix code b) unary part c) binarypart.In the prefix code first bit is always ‘0’ and second bit depends on whether thecurrent pixel is above range or below range. Second bit is ‘1’ for above range and‘0’ for below range.

Department of Electronics, Walchand College of Engineering, Sangli 24

Page 32: FELICS

4.5 Coding Flow of FELICS Algorithm

The second part of code is unary part. Unarypart : b x2kc = b 3

22c = 0, ‘0’ in unary

is encoded as ’0’.Binary part: x mod 2k = 3 mod 22 = 3, 3 in binary is encoded as ‘11’.So the complete codeword for current pixel 183 becomes ‘01011’.

4.5 Coding Flow of FELICS Algorithm

Based on intensity distribution model, adjusted binary code and Golomb-Ricecode, the FELICS coding flow can be summarized as following steps.

1. The first two pixels at first row are directly packed into bitstream withoutany encoding procedure.

2. According to the prediction template in Fig. 4.1, find the corresponding tworeference pixels, N1 and N2.

3. Assign L = min(N1, N2), H = max(N1, N2) and delta = H − L.

4. Apply adjusted binary code for P − L in in-range, Golomb-Rice code forL − P − 1 in below range, and Golomb-Rice code for P − H − 1 in aboverange.

Except first two pixels at first row, the others are directly started from step 2to step 4. The entire coding flow can be reversely performed as decoding flow.

4.6 General Example of Coding

There are different cases available for image template. Consider I be any gen-eral matrix of size 4× 4, from an image matrix, which is to be encoded. Since theimage is going to be a gray-scale image of bit depth 8, so the pixel values rangefrom 0 to 255. A 0 value indicates a black pixel and a 255 indicates a white pixel.

I =

254 251 245 220244 220 244 200250 210 220 238200 222 219 180

Department of Electronics, Walchand College of Engineering, Sangli 25

Page 33: FELICS

4.6 General Example of Coding

Case 1

Figure 4.8: Pixels in Case 1

In case 1, the two pixels from left top corner are selected, according to imagetemplate in Fig. 5.7, the first two pixels i.e 254 and 251 are directly encoded using8 bits and are sent directly without any encoding procedure. So the codewordsfor 254 and 251 are ‘11110101’ and ‘11111011’ respectively.

Case 2Now, according to case 2 from image template in Fig. 5.7, 245 is the current

pixel, P and previous two pixels are the reference pixels, N1 and N2. The circledpixel is the current pixel and since it is in first row it belongs to case 2 andremaining pixels are the reference pixels for this case.

Figure 4.9: Pixels in Case 2

The greater of the two reference pixels is assigned to H and smaller is assignedto L. So H has a value 254 and L has a value 251. Since the current pixel isin between H and L, adjusted binary coding is applied to encoded that pixel.The parameters required for encoding are computed as shown in section 4.2. Weget the values of the parameters as delta = 6, range = 7, lowerbound = 2,upperbound = 3, threshold = 1 and shiftnumber = 3. So the codeword for cur-rent pixel is evaluated to ‘1101’, according to section 4.2.Similarly, the next pixel 220 is also included in case 2. For this pixel the previoustwo pixels i.e. 251 and 245 are the reference pixels and rest of the encoding pro-cedure is same.

Case 3In case 3, the current pixel is present at the left edge of the image matrix.

Now the next pixel which is to be encoded is 244. This pixel belongs to case 3,according to Fig. 4.1.

For case 3, the reference pixels are the pixels to the top and top right of currentpixel.So we have 245 and 251 as reference pixels. Since the current pixel is less

Department of Electronics, Walchand College of Engineering, Sangli 26

Page 34: FELICS

4.6 General Example of Coding

Figure 4.10: Pixels in Case 3

than lower reference pixel L, it is regarded as out of range and hence it is encodedusing Golomb-Rice coding.Golomb-Rice code has three parts. In first part thereare two bits, first bit is always ‘0’ to indicate that the current pixel is encodedusing Golomb-Rice coding. The second bit is to indicate whether the current pixelis above range or below range. Now here since the current pixel is below range,the second bit will be ’0’. So, first part of Golomb-Rice code consists of ‘00’.The second part of Golomb-Rice code is the unary part. It is calculated accordingto equation 4.1. A unary number, say x is represented by x, 1’s followed by a ‘0’.Here the value of residual is x = L − P − 1 = 245 − 244 − 1 = 0, 0 in unary isrepresented by ‘0’. So the unary part has a ‘0’.The third part of Golomb-Rice code is the binary part.It is calculated accordingto equation 4.1. The binary part is represented using minimum possible binarybits. 0 in binary is represented by ‘0’. So the binary part has a ‘0’.Now, the total codeword is formed by concatenating all the three parts of Golomb-Rice code, so we get the codeword for 244 as ‘0000’.

Case 4The next pixel which is to be encoded, comes from case 4 category of image

template of Fig. 4.1. The current pixel value is 220. The reference pixels to thiscurrent pixel are the pixels to the left and top of current pixel. So we have 251and 244 as reference pixels.

Figure 4.11: Pixels in Case 4

Since the current pixel is less than lower reference pixel L, it is regarded asout of range and hence it is encoded using Golomb-Rice coding.Golomb-Rice codehas three parts. In first part there are two bits, first bit is always ‘0’ to indicatethat the current pixel is encoded using Golomb-Rice coding. The second bit isto indicate whether the current pixel is above range or below range. Now heresince the current pixel is below range, the second bit will be ‘0’. So, first part ofGolomb-Rice code consists of ‘00’.The unary part is calculated according to equation 4.1. Here the value of residual

Department of Electronics, Walchand College of Engineering, Sangli 27

Page 35: FELICS

4.6 General Example of Coding

is x = L − P − 1 = 244 − 220 − 1 = 23, for this the unary number will be 5. Sothe unary part has a ‘111110’.The third part of Golomb-Rice code is the binary part.The binary number will be3, it is represented by ‘11’. So the binary part has a ‘11’.Now, the total codeword is formed by concatenating all the three parts of Golomb-Rice code, so we get the codeword for 220 as ‘0011111011’.

Similarly, the remaining pixels are also encoded and their codewords alongwith the length of each codeword is also sent to the decoder for reconstruction ofcompressed image. The Table 4.1 shows the pixels from the image matrix and thecorresponding codeword for that particular pixel.

Table 4.1: Pixels and corresponding Codewords

Pixel Codeword254 11111110251 11111011245 001001220 00111111000244 001010220 0011111011244 110100200 001111011250 011001210 0011001220 1111238 011111001200 0011001222 0111011219 0000180 00111111111010

Department of Electronics, Walchand College of Engineering, Sangli 28

Page 36: FELICS

Chapter 5

2D-DWT - FELICS Algorithm

The proposed technique for image compression uses two techniques, first , 2D-DWT which provides lossy image compression and second, FELICS algorithmwhich provides lossless image compression. As discussed in chapter 3, the waveletdecomposition is done using haar wavelet. The level of decomposition dependson the desired image compression ratio or image quality. Higher the level ofdecomposition, higher is the compression, and poorer is the image quality. Thelossless FELICS algorithm uses adjusted binary codes and Golomb-Rice codes forcompression as discussed in chapter 4. FELICS is a predictive coding algorithm.It reduces the number of bits required for representing a pixel, by prediction. Thecodewords generated by FELICS algorithm are of variable length. The minimumcodeword length is 2 bits and maximum codeword length can be as long as 30bits.

The proposed technique has two main blocks an encoder and a decoder. Theencoder compresses the image using a 2D-DWT and encodes it losslessly , whiledecoder decodes it losslessly and then reconstructed using 2D-IDWT.

5.1 Encoder of Proposed Technique

Figure 5.1: Block Diagram of Encoder

The encoder has two main blocks, first a 2D-DWT and second, a FELICSencoder as shown in Fig. 5.1.

29

Page 37: FELICS

5.1 Encoder of Proposed Technique

5.1.1 2D-DWT Block

The image which is to be compressed, is given as input to the 2D-DWT block.The 2D-DWT block performs the DWT on the image and decomposes it in 4bands, LL, LH, HL and HH. The LL band is called the approximate band, sinceit has most of the information of the image. It is obtained by passing the imagethrough low pass filter. First, the image is filtered row-wise and then coloumn-wise. After single level decomposition all the 4 bands obtained have exactly halfthe dimensions of the original image. Out of these 4 bands only LL band is usedin the proposed technique and other bands are discarded i.e they are made zero.Now input to the FELICS encoder is only LL band. Similarly , if we apply 2-levelor 3-level decomposition to the image, the dimensions of LL band go on reducingaccordingly. In the 2D-DWT block, the image which is to be compressed is givenas input.

Figure 5.2: Block Diagram of 2D-DWT Block

Suppose the input image has dimensions 512× 512, then after 1-level decom-position using haar wavelet, image will have four bands. Each band will havedimensions of 256× 256.

Now if further decomposition is required then only the LL block, i.e. approx-imate band is used. This 256× 256 block of LL band is again decomposed using2D-DWT. This is called 2-level decomposition. Now the dimensions of LL bandafter 2-level decomposition will be 128× 128.

Generally, the wavelet decomposition upto 2-level is used. If we further de-compose the image, the dimensions of LL block will get reduced but the qualityof image gets degraded drastically. So after 2-level decomposition, the LL band isgiven as input to next block of FELICS encoder. Generally only upto 2-level de-composition of image is prefered, unless using this technique for surveillance kindof application, where only detection is required and not exact image. For 3-leveldecomposition, the image compression increases drastically but at the same timeimage quality gets poorer.

Department of Electronics, Walchand College of Engineering, Sangli 30

Page 38: FELICS

5.2 Decoder of Proposed Technique

5.1.2 FELICS Encoder

The LL band obtained after desired decomposition level from 2D-DWT block,has both positive and negative decimal point values. So before applying FELICSencoding procedure we have to first round-off the values in LL band to the nearestintegers. Then use that matrix as original image matrix. Now the values fromthis matrix are encoded according to four cases as shown in fig 4.1.

Figure 5.3: Block Diagram of FELICS Encoder

The FELICS encoder further compresses the band in lossless manner. It appliesadjusted binary coding and Golomb-Rice coding to compress. After compression,the generated codewords are sent to decoder along with the length of each code-word, since the codewords are of variable length. So the output of encoder iscompressed image data which consists of codewords and their lengths.

5.2 Decoder of Proposed Technique

Figure 5.4: Block Diagram of Decoder

The decoder has two main blocks, first a FELICS decoder and second a 2D-IDWT block as shown in Fig. 5.4. The compressed image data from output ofencoder is given as input to decoder.

5.2.1 FELICS Decoder

Here in FELICS decoder, the codeword is taken from codewords file and itscorresponding length is taken from length file. After getting the codeword andand its length, the reverse coding flow of FELICS is applied. The first bit ofcodeword indicates whether that current pixel is encoded using adjusted binarycode or Golomb-Rice code. If the first bit is ’1’, then that pixel is encoded usingadjusted binary coding and if it is ’0’, pixel is encoded using Golomb-Rice coding.

Department of Electronics, Walchand College of Engineering, Sangli 31

Page 39: FELICS

5.2 Decoder of Proposed Technique

Figure 5.5: Block Diagram of FELICS Decoder

If the pixel is encoded using Golomb-Rice coding, then again we must knowwhether the pixel is above range or below range. For that we have to check thesecond bit of codeword.

Now if the second bit is ’1’, then that current pixel is above range i.e. it isgreater than the higher reference pixel H and if if the second bit is ’0’, then thatpixel is below range i.e. it is less than the smaller reference pixel L.

After that the binary and unary parts are obtained from codeword and thecorresponding residual is generated. Finally the pixel value ia calculated. For apixel below range we can calculate the actual pixel value as L− 1− residual andfor the above range, the pixel value is calculated as, residual +H + 1.

In this way the pixel values are reconstructed using FELICS decoder and wholematrix is then given to the 2D-IDWT block.

5.2.2 2D-IDWT Block

In 2D-IDWT block, the actual image is reconstructed. The image matrix whichis formed by the FELICS decoder is actually the LL band which was formed after2-level decomposition of image during encoding. The other bands i.e. LH, HLand HH are considered to be zero. So the zero matrices of same dimensions as LLband are appended to LL band as shown in fig. . Then the total appended matrixis given as input to 2D-IDWT block.

Figure 5.6: Block Diagram of 2D-IDWT Block

The image which is constructed, has dimensions equal to those of the appendedmatrix which is given as input to 2D-IDWT block. The LL band obtained at theoutput of FELICS decoder is given as input to 2D-IDWT block. In the 2D-DWTblock, LL band of higher level is reconstructed by considering other three bands

Department of Electronics, Walchand College of Engineering, Sangli 32

Page 40: FELICS

5.3 Modified Image Template

as zero. Finally, at the output of decoder, we get the reconstructed compressedimage.

5.3 Modified Image Template

The image template which is used in original FELICS algorithm has 4 casesas shown in Fig.5.7 Case 1 is for first two pixels of the left corner of the image.Case 2 is for pixels in 1st row other than first two pixels. Case 3 is for pixels atthe left edge of the image and Case 4 is for pixels which are not in first row andat the left edge of image.

Figure 5.7: Original prediction template used in FELICS

Figure 5.8: Modified prediction template used in FELICS

In the modified image template, as shown in Fig. 5.8, we have added one morecase in the template. The first two cases are same as original template. In case 4of original template, two reference pixels were used. But here in new template weare using 4 pixels as reference pixels. The highest of four pixels is assigned to Hand lowest of the four pixels is assigned to L.

Department of Electronics, Walchand College of Engineering, Sangli 33

Page 41: FELICS

5.3 Modified Image Template

The case 5 was not included in original template. The case 5 is for pixel atthe right edge of the image. For a pixel at the right edge, three reference pixelsare taken and highest of those pixels is assigned to H and lowest is assigned to L.The template is just used to decide the reference pixels. The encoding procedureis same as in original FELICS algorithm.

Department of Electronics, Walchand College of Engineering, Sangli 34

Page 42: FELICS

Chapter 6

Results Analysis

6.1 Image Quality Parameters

For comparing the images obtained from the three techniques we have consid-ered various image quality parameters such as Compression Ratio (CR), MeanSquare Error (MSE), Peak Signal to Noise Ratio (PSNR), Normalized Cross-Correlation (NCC), Average Difference (AD), Structural Content (SC) and Nor-malized Absolute Error (NAE) [7]. Here for calculating various image quality pa-rameters original image matrix and compressed image matrix are used. I1(m,n)indicates an element of original image matrix and I2(m,n) indicates an elementfrom compressed image matrix. Also M and N indicate the number of rows andcolumns of image matrix. For calculating the image quality parameters the di-mensions of original and compressed images must be same.

1. Compression Ratio (CR)

The compression ratio is calculated as the ratio of the file size of originalimage to file size of reconstructed image.

CR =Original image file size

Compressed image file size(6.1)

Higher value of compression ratio indicates that the reconstructed image ismore compressed. As the compression ratio increases the quality of imagedegrades.

2. Mean Square Error (MSE)

The Mean Square Error is defined as,

MSE =

∑M,N [I1(m,n)− I2(m,n)]2

M ∗N(6.2)

The large value of MSE indicates that image is of poor quality.

35

Page 43: FELICS

6.1 Image Quality Parameters

3. Peak-Signal to Noise Ratio (PSNR)

Peak Signal to Noise Ratio (PSNR) is defined as,

PSNR = 10 log10(2552

MSE) (6.3)

PSNR should be as high as possible, low value of PSNR means the imagequality is poor.

4. Normalized Cross-Correlation (NCC)

Normalized Cross-Correlation (NCC) is defined as,

NCC =

∑M,N [I1(m,n). ∗ I2(m,n)]∑M,N [I1(m,n). ∗ I1(m,n)]

(6.4)

Value of NCC close to 1, means the image quality is good.

5. Structural Content (SC)

Structural Content is defined as,

SC =

∑M,N [I1(m,n). ∗ I1(m,n)]∑M,N [I2(m,n). ∗ I2(m,n)]

(6.5)

The large value of Structural Content (SC) means that image is of poorquality.

6. Average Difference (AD)

Average Difference is defined as,

AD =

∑M,N [I1(m,n)− I2(m,n)]

M ∗N(6.6)

The large value of AD means that the pixel values in the reconstructed imageare more deviated from actual pixel value. Larger value of AD indicatesimage is of poor quality.

7. Normalized Absolute Error (NAE)

Normalized Absolute Error (NAE) is defined as,

NAE =

∑M,N [abs(I1(m,n)− I2(m,n))]∑

M,N I1(m,n)(6.7)

Value of NAE close to 0, means the image is of good quality.

Department of Electronics, Walchand College of Engineering, Sangli 36

Page 44: FELICS

6.2 Results

6.2 Results

Here, a same image is compressed by three different image compression tech-niques. First technique consists of FELICS algorithm, second technique consistsof JPEG. The third technique is the proposed technique which consists of theDWT technique followed by the FELICS algorithm. This third technique has twovariants, first is having 2-level 2D-DWT and the second having 3-level 2D-DWT.

This experiment is carried out on different class of images these images aretaken from the website http://sipi.usc.edu/database and the performance ofthese techniques is compared on the basis of various image quality measures suchas Compression Ratio (CR), Mean Square Error (MSE), Peak-Signal to NoiseRatio (PSNR), Normalized Cross-Correlation (NCC), Average Difference (AD),Structural Content (SC) and Normalized Absolute Error (NAE).

Here, six different types of images are used. Standard images like Lenna, Ba-boon, Bridge, Boat, Medical image and Satellite image are used for analysis. TheLenna image contains a nice mixture of detail, flat regions, shading, and texturethat do a good job of testing various image processing algorithms. The Baboonimage has details and texture information. The Bridge and Boat images havemixture of detail, edges and shading. The Medical image has flat regions andminute edges.

Department of Electronics, Walchand College of Engineering, Sangli 37

Page 45: FELICS

6.2 Results

Figure 6.1: Lenna image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS

Table 6.1: Results for Lenna image

Technique/Parameter

FELICS JPEG 2-levelDWT+FELICS

3-levelDWT+FELICS

CR 1.72 11.13 14.8 33.38MSE 0 17.16 132.26 279.806PSNR 99 35.43 26.91 23.66NCC 1 0.999 0.9947 0.9861SC 1 1 1.003 1.012AD 0 0.004 -0.3107 -0.2781NAE 0 0.024 0.0509 0.0769

Department of Electronics, Walchand College of Engineering, Sangli 38

Page 46: FELICS

6.2 Results

Figure 6.2: Baboon image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS

Table 6.2: Results for Baboon image

Technique/Parameter

FELICS JPEG 2-levelDWT+FELICS

3-levelDWT+FELICS

CR 1.26 5.3 11.84 34.13MSE 49.22 101.3 540.11 700PSNR 31.2 27.17 20.8 19.679NCC 0.9988 0.9971 0.9732 0.964SC 0.9995 1.0001 1.0249 1.0352AD 0.0017 -0.0113 -0.3108 -0.2707NAE 0.0414 0.0581 0.1268 0.1484

Department of Electronics, Walchand College of Engineering, Sangli 39

Page 47: FELICS

6.2 Results

Figure 6.3: Bridge image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS

Table 6.3: Results for Bridge image

Technique/Parameter

FELICS JPEG 2-levelDWT+FELICS

3-levelDWT+FELICS

CR 1.37 5.8 12.22 32.6MSE 0 72.23 358.26 609.02PSNR 99 29.54 22.27 20.28NCC 1 0.996 0.9772 0.9629SC 1 1.001 1.0217 1.0371AD 0 0.0085 -0.2048 -0.1682NAE 0 0.054 0.1192 0.1558

Department of Electronics, Walchand College of Engineering, Sangli 40

Page 48: FELICS

6.2 Results

Figure 6.4: Boat image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS

Table 6.4: Results for Boat image

Technique/Parameter

FELICS JPEG 2-levelDWT+FELICS

3-levelDWT+FELICS

CR 1.55 8.67 14.51 35.43MSE 0 29.07 225.593 406.35PSNR 99 33.49 24.59 22.041NCC 1 0.9989 0.9902 0.9805SC 1 1 1.0076 1.0177AD 0 0.0097 -0.311 -0.2856NAE 0 0.031 0.06885 0.096

Department of Electronics, Walchand College of Engineering, Sangli 41

Page 49: FELICS

6.2 Results

Figure 6.5: Medical image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS

Table 6.5: Results for Medical image

Technique/Parameter

FELICS JPEG 2-levelDWT+FELICS

3-levelDWT+FELICS

CR 2.32 18.19 21.09 52.84MSE 1.44 2.82 73.006 130.17PSNR 46.53 43.62 29.49 26.98NCC 1.0003 0.9995 0.9976 0.9974SC 0.9993 1 1.0027 1.0016AD -0.059 0.0685 0.3802 0.1901NAE 0.0044 0.0064 0.0318 0.039

Department of Electronics, Walchand College of Engineering, Sangli 42

Page 50: FELICS

6.2 Results

Figure 6.6: Satellite image compressed using (a) FELICS (b) JPEG (c) 2-levelDWT+FELICS (d) 3-level DWT+FELICS

Table 6.6: Results for Satellite image

Technique/Parameter

FELICS JPEG 2-levelDWT+FELICS

3-levelDWT+FELICS

CR 0.99 3.52 12.145 33.61MSE 0.2144 302.787 1002.5 1134.34PSNR 54.8185 23.31 18.119 17.58NCC 1 1.0078 0.99293 0.9202SC 0.99 0.96 1.0796 1.0905AD -0.005 -0.15 1.0369 0.9991NAE 0.0004 0.1147 0.198 0.2313

Department of Electronics, Walchand College of Engineering, Sangli 43

Page 51: FELICS

Chapter 7

Conclusion and Future Scope

7.1 Conclusion

The 2D-DWT (lossy technique) and FELICS (lossless technique) are used todevelop the proposed technique which provides high compression ratio, while main-taining considerable image quality. Since 2D-DWT is a lossy technique, it provideshigh compression ratio with some loss in image quality. At the same time, sinceFELICS is a lossless technique it provides small compression ratio but maintainsthe image quality. Thus using this technique which is a combination of lossyand lossless techniques, we can get high compression ratio which is desired forsurveillance kind of applications.

Different parameters are used for comparison of images produced by differenttechniques. We have considered seven different parameters like CR, MSE, PSNR,NCC, SC, AD and NAE for different Class of Images (COI). We have includedimages like Lenna, Boat, Baboon, Bridge, Medical image and Satellite image asdifferent Class of Images. The compression ratio for all these images is higherfor DWT+FELICS technique than for JPEG. All the image parameter values arewithin acceptable range for DWT+FELICS technique. For Baboon, Medical andSatellite image, even the FELICS algorithm cannot reconstruct the image withoutloss. Particularly, for Satellite image, using original FELICS algorithm, the imagewas not compressible instead it was expanding with CR of 0.99. So after usingthe new modified image template, the FELICS algorithm was able to compressSatellite image with CR of 1.15. So the new image template will definitely increasethe CR by small amount.

44

Page 52: FELICS

7.2 Future Scope

7.2 Future Scope

The technique using 2D-DWT and FELICS gives gives better compressionratios than other techniques. But the quality of image and compression ratiocan be further improved by employing encoding techniques like Huffman encodingor Arithmetic encoding. These encoding techniques are lossless, so using thesetechniques can improve compression ratio at the same time the image quality ismaintained.

Department of Electronics, Walchand College of Engineering, Sangli 45

Page 53: FELICS

References

[1] Information Technology-Digital Compression and Coding of Continuous-ToneStill Image, ISO/IEC 10918-1 and ITU-T Recommendation T.81, 1994.

[2] JPEG 2000 Part 1 Final Draft International Standard, ISO/IEC FDIS15444-1,Dec. 2000.

[3] P.-C. Tseng, Y.-C. Chang, Y.-W. Huang, H.-C. Fang, C.-T. Huang, and L.-G.Chen, Advances in hardware architectures for image and video coding-a survey,Proc. IEEE, vol. 93, no. 1, pp. 184197, Jan. 2005.

[4] D. Huffman, A method for the construction of minimum redundancy codes,Proc. IRE, vol. 140, pp. 10981011, Sep. 1952.

[5] T.Welsh, A technique for high-performance data compression IEEE Comput.,vol. 17, no. 6, pp. 810, Jun. 1984.

[6] P. G. Howard and J. S. Vitter, Fast and Efficient lossless image compres-sion,Proc. IEEE Int. Conf. Data Compression, 1993, pp. 501510.

[7] X. Wu and N. D. Memon, Context-based, adaptive, lossless image coding,IEEE Trans. Commun., vol. 45, no. 4, pp. 437444, Apr. 1997.

[8] M. J. Weinberger, G. Seroussi, and G. Sapiro, The LOCO-I lossless imagecompression algorithm: Principles and standardization into JPEG-LS , IEEETrans. Image Process., vol. 9, no. 8, pp. 13091324, Aug. 2000.

[9] Yi-Qiang Hu, Hung-Hseng Hsu and Bing-Fei WuAn, Integrated Method to Im-age Compression Using the Discrete Wavelet Transform, IEEE InternationalSymposium on Circuits and Systems, June 9-12, 1997, Hong Kong.

[10] Tsung-Han Tsai, Yu-Hsuan Lee, and Yu-Yu Lee, Design and Analysis of High-Throughput Lossless Image Compression Engine using VLSI-Oriented FELICSAlgorithm, IEEE trans. on VLSI Systems, Vol. 18, No.1, January 2010.

[11] Vellaiappan Elamaran and Angam Praveen, Comparison of DCT andWavelets in Image coding, 2012 International Conference on Computer Com-munication and Informatics (ICCCI -2012), Jan. 10 12, 2012, Coimbatore,INDIA.

46

Page 54: FELICS

REFERENCES

[12] V.S.Vora, Prof.A.C.Suthar, Y.N.Makwana, and S.J. Davda Analysis of Com-pressed Image Quality Assessments, Published in International Journal of Ad-vanced Engineering and Application, Jan. 2010.

Books:

1. Rafael Gonzalez, Richard E. Woods, Digital Image Processing, PearsonEducation, India (2002).

Department of Electronics, Walchand College of Engineering, Sangli 47

Page 55: FELICS

REFERENCES

Department of Electronics, Walchand College of Engineering, Sangli 48

Page 56: FELICS

Publication

49