Course: CIS451/651 Data Compression in Multimedia
Professor: Paul D. Amer
Semester: Spring 2013
Title: Homework - Chapter 7 - Lossless Image Compression
Notice
Because this assignment involves sequences of bits and pixels,
it is required that your answers be NEATLY organized. Difficult-to-read
answers will be returned without grading.
Tasks
Read Chapter 7. You may omit reading Section 7.3 and the details of JBIG in Section 7.6.3 (you need to know what JBIG is.)
-
(3 pts) Chapter 7 Projects and Problems: 1
-
assume Modified Huffman (MH) (therefore, every line is 1-D encoded)
-
(3 pts) Chapter 7 Projects and Problems: 2
-
assume Recommendation T.4-Modified Read (MR), and K=4 (therefore lines 1,5,9,..., are encoded using 1-D; all
other lines are encoded with reference to the previous line.)
-
(1 pt) Chapter 7 Projects and Problems: 3
-
assume Recommendation T.6-Modified Modified Read (MMR) (therefore, all lines are 2-D encoded,
and for line 1, assume a virtual reference line of all white pixels
-
(2 pts) Chapter 7 Projects and Problems: 4
-
(2 pts) Encode the following line using 1-D Modified Huffman (MH) Fax encoding.
W represents a white pel, and B represents a black pel.
-
WWWWWWWWBBBBBBBBBBBBBBBBBBWWWWWWWWWBWWWWWWWWWWWWWWBBBBBBBBBBWWWWWW
-
(2 pts) Decode the following single line (broken into two lines for readability)
using 1-D Modified Huffman (MH)
Fax encoding. Assume the encoding begins with a run of W pels.
-
0011010100010100011101000011101011001101111101 (continued on next line)
000000101111101011111110011010000111000000000001
-
(2 pts) Encode the following using 2-D Modified READ (MR) Fax encoding.
Only encode the coding line. Assume initially that a0
points to a virtual white pel to the left of the coding line.
-
WBWWBBWWWWWWWBW -- reference line
-
BBBBBBWBBWWWWWW -- coding line
-
(1 pt) The facsimile standard assumes each line begins with a white pel.
-
Discuss the main advantage of this assumption.
-
(Required CISC651; Extra credit CISC451; 2 pts) Describe a document that would have the worst 1-D facsimile encoding, and compute (roughly) how much compression would result. (Show your work.)
-
(Required CISC651; Extra credit CISC451; 2 pts) For your document in the prior question, compute (roughly) how much compression would result using MMR encoding. (Show your work.)
-
(2 pts) Use the lossless JPEG model 2 (see section 7.2.1) to encode the
following 4X4 "image."
-
For this and the next 3 questions, assume needed virtual pixel values of
128.
-
Ii,j represents the pixel in row i and column j. In the
example below, I1,1=130, and I2,4=129.
-
For the lossless JPEG model 2, assume differences are computed using Ii,j
- Ii,j-1, not Ii,j-1 - Ii,j)
130 132 131 135
129 129 128 129
128 128 127 130
124 126 128 131
-
(2 pts) The following 4X4 image is the result of applying the lossless
JPEG model 2. Decode the image back to its original values.
+2 +2 +1 0
+1 0 0 +1
-1 -1 -1 -1
0 +1 +1 0
-
(4 pts) Repeat the previous two questions, this time assuming the lossless
JPEG model 3
-
Note: lossless JPEG model 3 differences are computed using Ii,j
- Ii-1,j-1
- (5 pts) Extra Credit for all students - Lossless JPEG
- Use Sayood's lossless JPEG software "jpegll_enc" to encode sena.img in 8 different modes (0-7) producing sena.jpgegllmode0, ..., sena.jpegllmode7.
- Adaptive Huffman encode all of these 8 files using "adap_huff_enc" producing sena-jpegllmode0.adap-huff-encoded, ..., sena-jpegllmode7.adap-huff-encoded.
- (submit) Submit a listing showing the sizes of your 8 Adaptive Huffman encoded files. The file sizes will be different from those listed in Table 7.1 in the textbook because Sayood's jpegll_enc had an error that I discovered and fixed in March 2011. Did you find that the best compression is still JPEG5?
- (submit) Using "od", look at sena.jpegllmode1 and the file sena-diff.img that you created in Project 1. Do you see any similarity? If yes, please explain. (Ignore the first 12 bytes of sena.jpegllmode1; they are metadata.) Submit an od of the first 20 lines of each file using "od -Ad -t u1 file | head -20". Carefully compare the 0th, 256th, 512th, ... differences. Can you figure out why they are different for the two files?
Notes
-
Graduate students must do all assignments individually. Undergraduate students may collaborate in groups of
2 for assignments. Only one submission with both names should be turned in from a group.
- Clearly label your answers,
and please submit answers in the order assigned.
- (repeated from course
syllabus) Academic Honesty:
Unless explicitly stated otherwise, students are not permitted to access or compare any homework, or
program-project answers with those of any other student or group past or present, alive or dead, or any Internet
web site prior to submitting the assignment. Comparing answers, or getting answers off the Internet before
submitting one's work is considered cheating. If you do not have time to complete an assignment, it is
better to submit partial solutions than to get answers from someone else. While it is obviously difficult to
enforce this policy, students who do not follow this policy should be keenly aware that in this class, they a
re cheating, and if caught, will be prosecuted according to University guidelines. This applies both to the
student (or group) who gets answers and the student (or group) who gives answers.
- (repeated from course syllabus) Lateness Policy:
Assignments are due at the beginning of class. Unexcused late assignments will be penalized up to 10% per
school day (weekends do not count) up to a 2-day maximum penalty of 20%. Without prior discussion with the
professor, assignments will not be accepted more than two school days late without a university approved
excuse.