Saint Louis University |
Computer Science 115
|
Dept. of Math & Computer Science |
Topic: Data Representation and Compression
Related Reading: Ch. 3.1, 3.3-3.6 and notes
Due:
8pm Monday, 20 September 2004
You may need an Internet connection for completing the assignment in order to access the lab software.
Exercise 31 of Ch. 3 (p. 86); answer in back of text
Exercise 37 of Ch. 3 (p. 86); answer in back of text
Exercise 51 of Ch. 3 (p. 88); answer in back of text
Exercise 53 of Ch. 3 (p. 88); answer in back of text
Exercise 57 of Ch. 3 (p. 89); answer in back of text
Exercise 69 of Ch. 3 (p. 90); answer in back of text
Assume that a digital camera takes a picture which is 640x480 pixels using TrueColor. How many bits are used overall to store the picture (in an uncompressed format)? (answer)
Use the Color Maker Applet, to make pink. (You can check yourself by selecting the pink from the drop-down list, that first shows cyan.)
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.
The following color patch was taken from a section of SLU's
front web page.
Use the Color Maker Applet
to match this color as best possible.
Indicate your answer based on its 24-bit TrueColor RGB value. For example, page 78 of the book described purple as (157,95,82).
Hint: SLU's color is not "pure" blue. To match it, you can either experiment with modifying the individual color components, or you may wish to set the color with the alternate controls for hue, saturation, and brightness.
Consider the Huffman encoding table given on page 89 of the text (associated with Exercise 57).
Decode each of the following bit strings according to that code.
You may use the Huffman Encoding applet if want, or use it to check. your work. If you do use the applet, be careful not to put a newline character at the end of your code.
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 57.
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:
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.)
At the end of Ch. 3 there are a series of "Thought Questions." Pick any one question from #3, #4, #5, #6 or #7 to answer. 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.