- FlexRay Protocol Specification V2.1 Rev.A
- A Novel Approach for Reversible Image Watermarking
- Q2 Scheme and SolutionMMS
- CODING
- 631F01_lec9
- Static Compression
- Said Mchaalia at Moeny Income for Any Time Tide
- Noise Info Theory 1
- hauff
- Cascaded Mpeg Rate Control for Simultaneous Improvement of Accuracy and - Copy
- 0055 Introduction to Multimedia Systems Notes
- Fundamentals of Information Theory and Coding Design
- IJAIEM-2014-06-17-37
- Image Processing Challenges
- Jpeg
- Rpms
- Dip Books
- 1
- Audio Streaming Codec Using Real Time Sound Restoration Improve (1)
- Scalable Coding of Encrypted Images
- video compression
- RFC 7049 - Concise Binary Object Representation (CBOR)
- How Android Draws Views _ Android Developers
- Data Structure Algorithms
- Ws 1621multimedia Compression Techniques
- 2-3-4 Trees
- Answers
- Interview questions
- Hy 3115071512
- Datastructure and Algorithms Mcq
- How to Use the Bayes Net Toolbox
- Hare Krishna Mahamantra Story Kali Santarana Upanishad
- Sankara
- E3634-90001.pdf
- Collabarative
- VMs Crime(Impp)
- Mahabharata12 Shanti
- Kannada Panchanga 2015-16
- ch3_4_v1
- Mg1 Numerical Inversion Methods
- Amplitude Modulation
- usbrx
- EX10
- elevatot
- Quick Intro Loops
- 05371632
- note3

Spring 2007

Dr. Markus Lumpe

**Study Project: Data Compression
**

In 1952 David A. Huffman published the paper “A Method for the Construction of Minimum-Redundancy Codes” in which he defined a greedy algorithm that constructs an optimal prefix code called a Huffman code. The algorithm begins with a set C of pairs (c,f), called HuffmanLeaf, where c is a character of an underlying alphabet (e.g., ASCII or data type byte) and f denotes the number of occurrences of c in a given source file. The set C is a partial order ! over pairs. Thus, if (‘t’,2),(‘d’,3) " C (i.e, (‘t’,2), (‘d’,3) are elements of C), then we have that pair (‘t’,2) ! (‘d’,3). Huffman’s algorithm uses the frequency f to identify the two least-frequent objects in C and merges them. The result of the merger is a new object (i.e., HuffmanNode) whose frequency is the sum of the frequency of the two objects being merged. In total, the algorithm performs a sequence of |C| - 1 “merging” operations to create a Huffman tree. How does it work? Assume a file that contains 100 characters built out of 6 different letters with the following frequency: ‘a’ : 45, ‘b’ : 13, ‘c’ : 12, ‘d’ : 16, ‘e’ : 9, and ‘f’ : 5. The Huffman algorithm creates a HuffmanTree as follows:

1

28 Byte. but not guaranteed. Huffman compression is less effective that Lempel-Ziv compression. Therefore. Markus Lumpe How we need to construct the Huffman codes. a text containing 100 characters has a size of 800 bits. Thus. We start with the ASCII encoding. The number of bits required using the calculated Huffman codes is 45*1+13*3+12*3+16*3+9*4+5*4 = 45+39+36+48+36+20 = 244. Every character in the encoding requires 8 bits. The Huffman code for a character c is the sequence of labels on the edges connecting the root to the leaf for that character. we encode: ‘a’: ‘b’: ‘c’: ‘d’: ‘e’: ‘f’: 0 101 100 111 1101 1100 The compression ratio can be calculated as follows. Savings of 20% to 90% are typical. which yields a compression ratio of 72%. 2 . or 100 Byte. An edge connecting an internal node with its children is labeled “0” if it is an edge to the left child.Com S 229 Spring 2007 Dr. In fact. and “1” if it is an edge to the right child.

In order to implement Huffman compression you need to solve the following subproblems: 1. For example. Frequency collection. That is. Huffman character/code mapping: Build a map<unsigned byte. a class for the analysis phase. T should be a super type (or interface) for Huffman leaves and Huffman nodes. Your solution will require several different classes. frequencies[c]++. 3. the class HuffmanNode to represent nodes. which contains the text from problem set 2. that is. The best data type for this purpose is set<T>. Huffman codes have flexible length. Huffman code assignment: Annotate the edges of the Huffman tree with 0 or 1. build the set C: Start with an empty map<unsigned char. to use the data type string. For example. and the class HuffmanTree to represent Huffman trees. where T is the base type of the set. Frequency). but not required. and count their occurrences. HuffmanCode> that contains mappings from characters to HuffmanCode’s. Huffman tree construction: Construct a Huffman tree according to the Huffman algorithm. long>. the class HuffmanLeaf to represent leaves. you need to define a proper < operator for Huffman leaves and nodes. You need to traverse the Huffman tree and visit all leafs. That is. 2. The expected compression ratio is 41. read all characters. you will need at least. that is.txt”.Com S 229 Spring 2007 Dr. This file is 1996 Bytes long and contains 53 different characters. to use the set. long> frequencies. HuffmanCode is the data type you chose to represent Huffman codes. 3 . To test your application you can use the file “sample. a character is represented as a unsigned char. Also. the character ‘e’ is represented as 0x65 of type unsigned char and its corresponding Huffman code as “1101” of type string. To facilitate their representation it might be usefule. and (ii) a coding phase in which a Huffman tree is constructed to determine the Huffman codes. 4. You need to process the whole input file. Start with an empty map<unsigned char. define a scheme to assign every leaf-node its corresponding Huffman code.27%. Assume as source files plain binary files. Use object-oriented techniques to solve this problem. Markus Lumpe Compression: Design idea Huffman codes are constructed in two phases: (i) an analysis phase in which the whole source file is read to construct a map<unsigned char. long> of pairs (Character. we can represent 15968 Bits (1996 Bytes) of fixed-size code by at most 9384 Bits (or 1173 Bytes) of variable-size prefix codes.

4 . 03/22. Develop a basic class structure. April 19. 2004. and possible solutions in class. Week 5 Code cleanup. Week 3 Implement the compression. Lab sessions: 03/20. Search the Internet for additional information. Deliverable An operational compression/decompression C++ console application. Start with simple tests. and 03/27 Final submission deadline: Thursday.Com S 229 Spring 2007 Dr. Week 2 Implement the frequency analysis and the construction of the Huffman tree. Familiarize yourself with the container types map and set. Markus Lumpe Week 1 Study the Huffman algorithm. We will discuss ideas. Week 4 Implement the decompression. 4:10 p. problems.m. Prepare a catalogue of questions that need to be discussed in class.

- FlexRay Protocol Specification V2.1 Rev.AUploaded byRajjan Singh Thakur
- A Novel Approach for Reversible Image WatermarkingUploaded byIRJET Journal
- Q2 Scheme and SolutionMMSUploaded bySanjay PN
- CODINGUploaded byNirmalya Fadikar
- 631F01_lec9Uploaded byramulu_492
- Static CompressionUploaded byRavish Nirvan
- Said Mchaalia at Moeny Income for Any Time TideUploaded bysfofoby
- Noise Info Theory 1Uploaded byKfor Kritika
- hauffUploaded byKaram Aneja
- Cascaded Mpeg Rate Control for Simultaneous Improvement of Accuracy and - CopyUploaded bysklove123
- 0055 Introduction to Multimedia Systems NotesUploaded byrishad93
- Fundamentals of Information Theory and Coding DesignUploaded byXavier Gualán
- IJAIEM-2014-06-17-37Uploaded byAnonymous vQrJlEN
- Image Processing ChallengesUploaded byNayan Sen
- JpegUploaded byHardeep Solanki
- RpmsUploaded byh_romeu_rs
- Dip BooksUploaded byprashantgemini
- 1Uploaded byAlhayatAli
- Audio Streaming Codec Using Real Time Sound Restoration Improve (1)Uploaded byIbrahim Elnoshokaty
- Scalable Coding of Encrypted ImagesUploaded byieeexploreprojects
- video compressionUploaded byChakshuGrover
- RFC 7049 - Concise Binary Object Representation (CBOR)Uploaded bysa4250mnpo70
- How Android Draws Views _ Android DevelopersUploaded byWojtek Owczarczyk
- Data Structure AlgorithmsUploaded byUmakant Yadav
- Ws 1621multimedia Compression TechniquesUploaded byVisakh Vijay
- 2-3-4 TreesUploaded byWaqas Rasheed
- AnswersUploaded bypepe
- Interview questionsUploaded byconnected_hum_tum123
- Hy 3115071512Uploaded byAnonymous 7VPPkWS8O
- Datastructure and Algorithms McqUploaded byShivam

- How to Use the Bayes Net ToolboxUploaded byKoushik Kashyap
- Hare Krishna Mahamantra Story Kali Santarana UpanishadUploaded byKoushik Kashyap
- SankaraUploaded byKoushik Kashyap
- E3634-90001.pdfUploaded byKoushik Kashyap
- CollabarativeUploaded byKoushik Kashyap
- VMs Crime(Impp)Uploaded byKoushik Kashyap
- Mahabharata12 ShantiUploaded byKoushik Kashyap
- Kannada Panchanga 2015-16Uploaded byKoushik Kashyap
- ch3_4_v1Uploaded byKoushik Kashyap
- Mg1 Numerical Inversion MethodsUploaded byKoushik Kashyap
- Amplitude ModulationUploaded byKoushik Kashyap
- usbrxUploaded byKoushik Kashyap
- EX10Uploaded byKoushik Kashyap
- elevatotUploaded byKoushik Kashyap
- Quick Intro LoopsUploaded byKoushik Kashyap
- 05371632Uploaded byKoushik Kashyap
- note3Uploaded byKoushik Kashyap