Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture # 20 Image and Data Compression. Data Compression.

Similar presentations


Presentation on theme: "Lecture # 20 Image and Data Compression. Data Compression."— Presentation transcript:

1 Lecture # 20 Image and Data Compression

2 Data Compression

3 How big? Image 1024x1024x3 –3 Million bytes (3 MB) Audio x 10 min x 60 sec/min x 2 –58 million bytes (58 MB) Video –640 x 480 x 10 minutes –307,200 x 600 sec x 30 fps –16.6 billion pixels (17 GB) Compression (reduce the size)

4 Problem Reduce the size of a data object –Text –Image –Audio –Video How to do it –Cheat in ways that the user can ’ t see –Coherence

5 Ways to cheat Text generally only has less than 128 possible characters. –Use 7 bits instead of 8 (12%) For text, some characters are more common than others –Use fewer bits for common characters, more bits for infrequently used characters

6 Ways to cheat People can ’ t see more than 64 levels of gray –Use 6 bits instead of 8 (25%) People don ’ t see color as well as B/W –Use 6 bits for B/W and much less for color

7 Coherence If we know the previous value of something, then we generally have a good idea what the next value will be 3 Techniques –Run length encoding –Reuse of subsequences –Prediction and error

8 Run length encoding Values are frequently repeated. –Instead of storing each value, store a single value with a count of how many times to repeat

9 12 x 10 = 120 pixels 120 pixels x 3 bytes/pixel = 360 bytes

10 Run encoded RGB - 3 bytes Count - 1 byte Entries - 23 Space - 4*23 = 92 Compression (360-92)/360 = 74%

11 Run encoded - with indexed color 4 colors - 12 bytes index - 2 bits Count - 6 bits Entries - 23 Space *23 = 35 Compression (360-35)/360 = 90%

12 Run encoding HELLO Works well

13 Run encoding Works Badly

14 Run encoding Works well

15 Run encoding Not good Too much variation in the rose

16 Run encoding - text four score and seven years ago, our fathers brought forth on this continent Not good no repetition

17 Run Encoding - Audio Not good No repetition

18 Run Encoding - Audio Not good No repetition

19 Reuse common sequences

20

21

22

23

24

25

26 Works really well Used in GIF format

27 Reuse common sequences Works fair Blacks are good Rose has some similarities

28 Reuse common sequences

29 Works really well

30 Reuse common sequences Works poorly

31 Reuse common sequences Video Works really well Copy pieces from last frame into this frame One technique in MPEG

32 Reuse common sequences Text Reuses words and phrases Works fairly well Most common text compression technique

33 Prediction + error Given previous values, predict what the next value will be When it is not quite right, store the error The error almost always takes fewer bits than the value

34 Linear prediction line through previous predicts next Little error

35 Linear prediction line through previous predicts next More error

36 Linear prediction line through previous predicts next Still more error

37 Linear prediction line through previous predicts next less error

38 Linear prediction line through previous predicts next less error

39 Linear prediction line through previous predicts next little error

40 Linear Prediction

41 Look closer Little Error More error

42 Linear Prediction Prediction + error Shades of black Follows shade of rose Rose detail is error off shade Prediction + error + cheating = JPEG

43 JPEG Comparisons

44 Video Copy from previous frame Store error for small details MPEG

45 Text N-Grams Use the last N letters to predict the next letter Store errors English is quite regular

46 Review Cheat –Exploit weakness in what people can perceive Coherence –Run encoding (count repetitions) –Reuse (reference pieces from previous data) –Predict + error Know when each technique will or will not work


Download ppt "Lecture # 20 Image and Data Compression. Data Compression."

Similar presentations


Ads by Google