Course: CIS451/651 Data Compression
in Multimedia
Professor: Paul D. Amer
Semester: Spring 2009
Title: Homework - Chapter 11 - Differential Encoding
Due Date:
Tasks
Read Chapter 11. Omit Section 11.5.
-
(4 pts) Write a well-documented program or find existing software to count the frequency
of each pixel value in an ".img" image file. Run this program on
sinan.img and
earth.img
- (submit) Using Microsoft Excel (or any other histogram-making
software), produce histograms of the computed frequencies for each image. Your
sinan histogram should look like the histogram in the textbook's Figure 11.2.
- (submit) a copy of your program if you wrote one, else indicate which existing software you used.
- (submit) Indicate the exact number of pixels in each orginal image having the values 0,1,2,3 and 127,128,129 and 252,253,254,255
-
(4 pts) Differential encoding
- Create an "8-bit differential encoding" of sinan.img
(and
earth.img)
named sinan.diff.img
(and earth.diff.img)
using the program you wrote in Project 1.
- (submit) Use the program from the previous question to create a histogram for
the frequency of difference values 0-255 for sinan.diff.img
(and earth.diff.img).
Your sinan histogram should contain the same info as contained in Figure 11.3. The two histograms will appear different since Figure 11.3's x-axis goes from -255 to +255, while your histogram's x-axis goes from 0-255. Remember that a difference of -255 is the same as a difference of +1.
- (submit) Indicate the exact number of pixel differences your historgrams have for differences of 0, 1, and 255
-
(3 pts) (submit) Use xv, GIMP or other software to view and print copies of
sinan.img and sinan.diff.img (and
earth.img and earth.diff.img.)
To view an ".img" image, use Sayood's program "convpgm.c"
to produce a well-known format ".pgm" file, and then view/print the
".pgm" file. Take some time to understand why the difference images look like they do.
- (4 pts Extra Credit for all students) Use Sayood's huff_enc program to compute a huffman code for both sinan.img and sinan.diff.img.
Save the two code files separately. huff_enc
generates a fixed length code file of 1280 bytes. The format of the
code file is 256 4-byte "codes" followed by 256 1-byte "lengths". The
first length tells how many least significant bits of the first 4-byte
code are the Huffman code for a pixel value (or pixel difference value
for a difference image) of 0. The second length tells how many least
significant bits of the second 4-byte code are the Huffman code for the
pixel value of 1, and so on. What are the Huffman codes for both sinan.img and sinan.diff.img for the pixel values and pixel
difference values, respectively, of: 126,127,128,129,130 and 253,254,255,0,1,2,3,4,5,6? Looking at the two code files, argue
whether the generated Huffman codes are consistent with the histograms
you produced in parts 1 and 2 above.
Notes
-
Students may work individually or in groups of 2. Students
in different groups may NOT compare answers prior to submitting their work.
See the
syllabus for a full statement of the lateness and academic honesty policies.
-
All source programs must be well documented.