This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: #21 ECE 253a Digital Image Processing Pamela Cosman 11/30/10 Solutions to homework 5 These solutions are written by Dawei Wang. Problem 1: Huffman Coding a) One possible codeword assignment is: Symbol Probability Codeword Length Codeword A 0.5 1 B 0.25 2 10 C 0.1 3 110 D 0.05 4 1110 E 0.05 5 11110 F 0.05 5 11111 Other correct answers are also acceptable, and the average length is 2 bits. The entropy of this R.V. is H ( 1 2 , 1 4 , 1 10 , 1 20 , 1 20 , 1 20 ) 1 . 98 bits. b) For quaternary Huffman coding, we merge 4 nodes with smallest probability to one node in every iteration. For this particular example, one possible code can be: Symbol Probability Codeword Length Codeword A 0.5 1 a B 0.25 1 b C 0.1 2 ca D 0.05 2 cb E 0.05 2 cc F 0.05 2 cd and the average length is 1.25 quaternary units. The quaternary alphabet symbol d is not used in the first position of the codeword, and this encoding method is not efficient. In general, if the cardinality of input symbols is not in the form of 3 N + 1, N Q + for quaternary code (( M- 1) N + 1, N Q + for M-ary code), we would waste some codeword length in the final step of the iteration. To solve this problem, a zero-probability symbol padding is used. Basically, we introduce some dummy symbols with zero probability to make the starting number of input symbols be of the form 3 N + 1, N Q + . For this particular example: Symbol Probability Codeword Length Codeword A 0.5 1 a B 0.25 1 b C 0.1 1 c D 0.05 2 da E 0.05 2 db F 0.05 2 dc G(dummy) 2 dd 1 and the average length is 1.15 quaternary units. Because the use of dummy symbols was not explained to you, both answers to this problem are acceptable....
View Full Document
This note was uploaded on 01/15/2012 for the course ECE ece253A taught by Professor Cosman during the Fall '11 term at UCSD.
- Fall '11
- Image processing