Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 111 – Sept. 10 Quiz Data compression –text –images –sounds Commitment: –Please read rest of chapter 1. –Department picnic next Wednesday.

Similar presentations


Presentation on theme: "CS 111 – Sept. 10 Quiz Data compression –text –images –sounds Commitment: –Please read rest of chapter 1. –Department picnic next Wednesday."— Presentation transcript:

1 CS 111 – Sept. 10 Quiz Data compression –text –images –sounds Commitment: –Please read rest of chapter 1. –Department picnic next Wednesday

2 Text compression Goal is for a document to take up less space Techniques –Keyword encoding: replace common words by special symbols like   ╞ –Run-length encoding: replace repetitions with a number: “pppppppppppppp”  [14p] –Huffman code: common letters should take up fewer bits

3 Huffman code example Suppose you want to send a message, and you know the only letters you need are A, D, E, L, N, P, S. A Huffman code might look like this table: How would you decode this message? 01110000101001000100110001 ADELNPS 001100011010001000011

4 How to create code We’re given the set of letters used for the message, and their frequencies. –Ex. A = 5, B = 10, C = 20, D = 25, E = 30 –Ex. P = 5, N = 10, D = 10, L = 15, A = 20, S = 20, E = 30 It’s convenient to arrange the frequencies in order. Group the letters in pairs, always looking for the smallest sum of frequencies. The resulting structure is a “tree”. Each left arm = “0” in the code; each right arm is a “1”.

5 Dictionary & LZW Dictionary encoding: –Convert each word to a number –Represent this number in binary –If 50,000 words in dictionary, we can represent each with 16 bits (2 bytes) since 2 16 > 50,000 –A lot shorter than the average word LZW –Begin by encoding letters as 1-26, space as 27. –Each time you form a new word, add it to the “dictionary” as 28, 29, 30, etc. –So, we don’t need to encode every word in English language. –Ex. AB ABC AB ABC would be 1,2,27,1,2,3,28,29

6 Image compression RGB 24-bit color represented as (huge) bitmap file *.bmp Most of the time, compressing an image is “lossy”, meaning that uncompressing won’t restore original.bmp information GIF compression uses indexed color JPG entails several steps –Make tiny modifications to the image, so that neighboring pixels will have more uniform values. For example, (10, 11, 12, 90)  (11, 11, 11, 90) –Use text/numerical compression techniques like run-length encoding.

7 MPEG Motion Picture Experts Group Industry standard for compressing multimedia Note that much information in consecutive frames is the same Delete sound information that humans can’t detect Goal: to make streaming video possible: 30 frames per second at a minimal DSL connection –Ex. 5-minute 300x200 video ~ 12 MB


Download ppt "CS 111 – Sept. 10 Quiz Data compression –text –images –sounds Commitment: –Please read rest of chapter 1. –Department picnic next Wednesday."

Similar presentations


Ads by Google