Second Assignment (2)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.