Reference book "Introduction to Data Compression (4th edition)" Page
2 Use the program Huff_enc and Huff_dec to do the following (in each case, using the codebook generated by the compressed image).
(a) Encode Sena, Sensin, and Omaha images.
(b) Write a procedure to get the difference between adjacent, and then encode the difference image using Huffman.
(c) Use Adap_huff to repeat (a) and (b).
Solution :
Filename |
Before compression |
After compression |
Compression ratio |
SENA. Img |
64.0 KB (65,536 bytes) |
56.1 KB (57,503 bytes) |
1.14:1 |
Sinan. Img |
64.0 KB (65,536 bytes) |
60.2 KB (61,649 bytes) |
1.06:1 |
OMAHA. Img |
64.0 KB (65,536 bytes) |
57.0 KB (58,374 bytes) |
1.12:1 |
41 Sources Select letters from the symbol set A={A1, A2, A3, A4, A5}, with a probability of P (A1) =0.15,p (A2) =0.04,p (A3) =0.26,p (A4) =0.05,p (A5) = 0.50.
(a) Calculate the entropy of the source.
(b) To seek the Huffman code of this source.
(c) Ask for the average length and redundancy of the code in (b).
Solution : (a) The entropy of this source is:
H=-P (A1) log2p (A1)-P (A2) log2p (A2)-P (A3) log2p (A3)-P (A4) log2p (A4)-P (A5) log2p (A5)
=-0.15 * LOG2 (0.15)-0.04 * LOG2 (0.04)-0.26 * LOG2 (0.26)-0.05 * LOG2 (0.05)-0.5 * LOG2 (0.5)
=
51 Symbols Set A={A1, A2, A3, A4,}, with a probability of P (A1) =0.1,p (A2) =0.3,p (A3) =0.25,p (A4) = 0.35, use the following procedure to find a Huffman code:
(a) The first process outlined in this chapter:
(b) The minimum variance process.
Explain the differences between the two Huffman codes.
Solution :
Second Assignment (2)