Top Banner

of 116

Compression & Decompression

Oct 22, 2014



A Project Report On

COMPRESSION & DECOMPRESSIONSubmitted in partial fulfillment of the requirement for the Award of the degree of

Bachelor of TechnologyIn

Information TechnologyBy

RAHUL SINGH SHAKUN GARG 0407713057, 0407713042

Dr. K.N.MODI INSTITUTE OF ENGINEERING & TECHNOLOGYApproved by A.I.C.T.E. Affiliated to U. P. Technical University, Lucknow Modianagar 201204, (Batch: 2004-2008)


CONTENTSACKNOWLEDGEMENT CERTIFICATE LIST OF TABLES LIST OF FIGURES ABSTRACT SYNOPSIS OF THE PROJECT 1 OBJECTIVE 2 SCOPE 3 DESIGN PRINCIPLE & EXPLANATION 3.1 Module Description 3.1.1 Huffman Zip 3.1.2 Encoder 3.1.3 Decoder 3.1.4 Table 3.1.5 DLNode 3.1.6 Priority Queue 3.1.7 Huffman Node 4 HARDWARE & SOFTWARE REQUIREMENTS 18 4 5 6 6 7-13 14-18 14 14 16-17


MAIN REPORT 1 2 Objective & Scope of the Project Theoretical Background 2.1 Introduction 2.2 Theory 2.3 Definition 2.3.1 Lossless vs Lossy Compression 2.3.2 Image Compression 2.3.3 Video Compression 2.3.4 Text Compression 2.3.4 LZW Algorithm 3 4 Problem Statement System analysis and design 4.1 Analysis 4.2 Design 4.2.1 System design 4.2.2 Design objective 4.2.3 Design principle 5 Stages in System Life Cycle 5.1 Requirement Determination 5.2 Requirement Specifications 5.3 Feasibility Analysis 5.4 Final Specification 5.5 Hardware Study 5.6 System Design 5.7 System Implementation 5.8 System Evaluation 5.9 System Modification 5.10 System Planning 6 7 Hardware & Software Requirement Project Description 7.1 Huffman Algorithm 7.2 Code Construction

20-118 20 23 23 23 24-35

36 39 39 40-48

49 49 49 50 50 51 51 52 52 52 53 60 61 61 68


7.3 Huffing Program 7.4 Building Table 7.5 Decompressing 8 9 Working of Project 8.1 Module & their description Data Flow Diagram 10 Print Layouts 11 Implementation 12 Testing 12.1 Test plan 12.2 Terms in testing fundamentals 13 14 Conclusion Future Enhancement & New Direction 14.1 New Direction 14.2 Scope of future work 14.3 Scope of future application 15 16 Source Code References

68 69 70 73 73 75 82 85 87 87 88 94 95 95 96 96 97-118 119

7.6 Transmission & storage of Huffman encoded data 72



Keep away from people who try to belittle your ambitions. Small people always do that, but the really great make you feel that you too, can become great. We take this opportunity to express my sincere thanks and deep gratitude to all those people who extended their wholehearted co-operation and have helped me in completing this project successfully.

First of all, we would like to thank Mr. Gaurav Vajpai (Project Guide) for his strict supervision, constant encouragement, inspiration and guidance, which ensure the worthiness of my work. Working under him was an enrich experience. His inspiring suggestions and timely guidance enabled us to perceive the various aspects of the project in a new light.

We would also thank to Head Dept. of IT, Prof. Jaideep Kumar,H.O.D., who guided us a lot in completing this project. We would also like to thank my parents & project mate for guiding and encouraging me throughout the duration of the project.

We will be failing in our mission if we do not thank other people who directly or indirectly helped us in the successful completion of this project. So, our heartfull thanks to all the teaching and non- teaching staff of computer science and engineering department of our institution for their valuable guidance throughout the working of this project.



Dr. K.N. Modi Institute of Engineering and Technology ModinagarAffiliated to UP Technical University, Lucknow


CERTIFICATEThis is to certify that RAHUL SINGH (0407713057), SHAKUN GARG (0407713042) and MANISH SRIVASTAVA (0407713021) of the final year B. Tech. (IT) have carried out a project work on COMPRESSION & DECOMPRESSION under the guidance of Mr. GAURAV VAJPAI in Department IT for the partial fulfillment of the award of the degree of Bachelor of Technology in Computer Science & Engineering in Meerut Institute of Engineering & Technology, Meerut (Affiliated to U.P. Technical University, Lucknow) is a bonafide record of work done by them during the year 2007 2008.

Head of the Department:

Internal Guide: Mr. GAURAV VAJPAI

(Mr. JAIDEEP KUMAR)Head, Department of IT



Table No.

Table Name

Page No.

1 2



Figure No.

Figure Name

Page No.

1. 2 3.


19 36 38




In todays world of computing, it is hardly possible to do without graphics, images and sounds. Just by looking at the applications around us, the Internet, development of Video CDs (Compact Disk) ,Video Conferencing, and much more, all these applications use graphics and sound intensively. I guess many of us have surfed the Internet, have you ever become so frustrated in waiting for a graphics intensive web page to be opened that you stopped the transfer I bet you have. Guess what will happened if those graphics are not compressed? Uncompressed graphics, audio And video data consumes very large amount of physical storage which for the case of uncompressed video, even present CD technology is unable to handle.

WHY IS THE PARTICULAR TOPIC CHOSEN?Files available for transfer from one host to another over a network (or via modem) are often stored in a compressed format or some other special format well-suited to the storage medium and/or transfer method. There are many reasons for compressing/archiving files. The more common are:


File compression can significantly reduce the size of a file (or group of files). Smaller files take up less storage space on the host and less time to transfer over the network, saving both time and money

OBJECTIVE AND SCOPE OF THE PROJECTThe objective of this system is to compress and decompress files. This system will be used to compress files , so that they may take less memory for storage and transmission from one computer to another. This system will work in following ways:

To compress a text and image file using Huffman coding. To decompress the compressed file to original format. To show the compression ratio.

Our project will be able to Compress message in such a form that can be easily transmitted over the network or from one system to another. At the receiver end after decompressing the message receiver will get the original message. This is how effective transmission of data that take place between sender and receiver.

Reusability:Reusability is possible as and when we require in this application. We can update it next version. Reusable software reduces design, coding and testing cost by amortizing effort over several designs. Reducing the amount of code also simplifies understanding, which increases


the likelihood that the code is correct. We follow up both types of reusability: Sharing of newly written code within a project and reuse of previously written code on new projects.

Extensibility:This software is extended in ways that its original developers may not expect. The following principles enhance extensibility like Hide data structure, Avoid traversing multiple links or methods, Avoid case statements on object type and distinguish public and private operations.

Robustness:Its method is robust if it does not fail even if it receives improper parameters. There are some facilities like Protect against errors, Optimize after the program runs, validating arguments and Avoid predefined limits.

Understandability:A method is understandable if someone other than the creator of the method can understand the code (as well as the creator after a time lapse). We use the method, which small and coherent helps to accomplish this.

Cost-effectiveness:Its cost is under the budget and make within given time period. It is desirable to aim for a system with a minimum cost subject to the condition that it must satisfy all the requirements.

Scope of this document is to put down the requirements, clearly identifying the information needed by the user, the source of the information and outputs expected from the system

- 10 -

METHODOLOGY ADOPTEDThe methodology used is the classic Life-cycle model the WATERFALL MODEL

- 11 -

HARDWARE & SOFTWARE REQUIREMENTSHARDWARE SPECIFICATIONS: Processor Ram Monitor Keyboard Mouse Pentium- I\II\III\higher 128 MB RAM or higher 15 Inch (Digital) with 800 X 600 support 101 Keys keyboard 2 Button Serial/ PS-2

Tools / Platform Language Used:

Language: Java OS: Any OS such as Windows XP/98/NT/Vista

- 12 -

TESTING TECHNOLOGIESSome of the commonly used Strategies for Testing are as follows:-

Unit testing Module testing Integration testing TEST Testing System testing Acceptance testing

UNIT TESTING Unit testing is the testing of a single program module in an isolated environment. Testing of the processing procedures is the main focus

MODULE TESTING A module encapsulates related component. So can be tested without other system modules.


Integration testing is the testing of the interface among the system modules. In other words it ensures that the module is handles as intended.

. - 13 -

SYSTEM TESTING System testing is the testing of the system against its initial objectives. It is done either in a simulated environment or in a live environmen