Assignment
Contents:
Overview
Topic: Data Representation and Compression
Related Reading: Ch. 3.1, 3.3-3.6, pp.69-70 and notes
Due:
Internet Requirements
You may need an Internet connection for completing the assignment in
order to access the lab software.
Practice Problems
Problems to be Submitted (20 points)
-
(3 points)
In the notes, we stated that CD quality music requires 44100 samples
per second. The amplitude of the sound wave is recorded using 16 bits per
channel. (Recorded in stereo, there are two separate channels). Based on
this information, please answer the following:
-
Calculate how many bits of information would be used to represent a 4 minute
song, recorded in stereo. Express your answer using the most natural unit
of magnitude (e.g., bytes, KB, MB, GB). Please explain the details of your
calculations so that we can better understand your method in case of a
wrong answer.
-
Assume that a single compact disk, formatted for audio, holds up to 700MB
of information. Approximately how many of those 4-minute songs will fit
on the CD.
-
(3 points)
Use the Color Maker Applet
to match the "salmon" color at the left.
Hint: How do you think this color compares to red? to pink?
Indicate your answer in the form R-###, G-###, B-###.
- (3 points)
Exercise 24 of Ch. 3 (p. 83). You may use the
Huffman Encoding
applet if want, or use it to check. If you use the applet, be careful
not to put a new-line at the end of your code.
-
(8 points)
Consider the text "PETER PIPER PICKED PICKLED PEPPER PECKS" (a
slight variation on the classic tongue-twister to simplify your problem).
It contains 39 characters, with the following frequencies:
Letter |
Frequency |
P |
9 |
E |
8 |
blank |
5 |
C |
3 |
I |
3 |
K |
3 |
R |
3 |
D |
2 |
L |
1 |
S |
1 |
T |
1 |
-
If using a fixed-length code for this message, how many bits per character
must be used, and thus how many overall bits would be used to represent
all 39 characters of the message.
-
Based on the method discussed in the lecture notes, generate a Huffman
code for this set of frequencies (Note: this method was not discussed in
the text). Your answer should be a table of codes, formatted similarly
to the one given in the text for Exercise 24.
-
Based on your Huffman code, how many overall bits would be used to represent
all 39 characters in the message? You can use the Huffman encoding
applet to work this out or check your answer. The applet is a bit
finicky. Be careful of two things:
-
Make sure you do not end the message text with a new-line.
-
Make the first character in each line of the code box be the character
coded, including a blank space character on one line, then have at least
one blank before the binary code-- that makes two blanks at least for the
line with the code for blank.
-
What compression ratio was achieved over the fixed-length code in part
a? (Be careful if you are using the applet -- it compares to
a fixed
eight-bit code. Also, it indicates the compression percentage by the amount removed, not the amount left as we have defined it in class.)
-
(3 points)
At the end of Ch. 3 there are a series of "Thought Questions." Pick
any one question to answer (though you would need to read Ch. 3.2
to answer 1c). The length of your answer should be appropriate for the
question, however I envision answers in the range of 1/2-page to 1-page.
Overall, please type your answers to all of the problems in a single
document to be submitted electronically. Please see details about the submission
process.
Extra Credit (3 points)
Play with graphics. Draw me a picture of your favorite animal using various
shapes and colors from scratch. Please include your name within part of
the graphics.
Windows has an imaging program that you should find under the menu,
Start
-> Programs -> Accessories -> imaging. Once you start the program,
you can create a new document, at which point a menu will appear which
allows you to specify things such as the color scheme, the file format,
compression scheme and so on. There is a Help menu within that program,
though you might be able to feel your way around if you've ever used any
such drawing programs.
For two points extra credit, save your picture to a file and submit
it along with the rest of your homework.
For a third point, I want to you save a copy of your file under
each of the following three formats (Using the "Save As" option): TIFF,
Bitmap, JPEG. You do not need to submit all three, but save them somewhere.
In
your main assignment writeup, please include information on the number
of bytes which were used by each of the three formats. To find the
number of bytes for a file, you can locate the icon in whatever folder
you used to save it and then click the right mouse button and select "Properties"
at the bottom of the menu that appears. You will see the size among the
properties.
Last modified: 4 February 2003