Download presentation
Presentation is loading. Please wait.
1
Data Compression
2
How Is This Possible? Entire King James Bible : 4,834,757 bytes
Zip Archive Containing It: 1,339,843 bytes
3
More Questions Why does this file: Compress different than:
4
Behind The Scenes Compression used for: ~50% of web traffic
Most audio/video files Sometimes for every file on a drive
5
Trick 1: Describe the contents of this file in as few words as possible…
6
Trick 1: Run Length Encoding :
Describe repetition as: (How many times)What to repeat A
7
RLE Examples ABABABABABAB 6AB AAABBBBBAAACC 3A,5B,3A,2C
(5)1,(1)0,(6)01
8
RLE Fail This file doesn't just have A's:
80A,1newline,80A,1newline,80A,1newline…
9
Trick 2 Same As Earlier: ABCDEFG-b7c7
Describe patterns with instructions to go back x and copy y characters ABCDEFG-b7c7 "Write down ABCDEFG, then go back 7 characters and copy the next 7 characters to the end of what you have"
10
Same As Earlier ABCDEFG-b7c7
11
Same As Earlier ABCDEFG-b7c7 ABCDEFG
12
Same As Earlier ABCDEFG-b7c7 ABCDEFG
13
Same As Earlier ABCDEFG-b7c7 ABCDEFGA
14
Same As Earlier ABCDEFG-b7c7 ABCDEFGAB
15
Same As Earlier ABCDEFG-b7c7 ABCDEFGABC
16
Same As Earlier ABCDEFG-b7c7 ABCDEFGABCD
17
Same As Earlier ABCDEFG-b7c7 ABCDEFGABCDE
18
Same As Earlier ABCDEFG-b7c7 ABCDEFGABCDEF
19
Same As Earlier ABCDEFG-b7c7 ABCDEFGABCDEFG
20
Same As Earlier ABCDEFG-b7c7 ABCDEFGABCDEFG
21
Same As Earlier AB-b2c6
22
Same As Earlier AB-b2c6 AB
23
Same As Earlier AB-b2c6 AB
24
Same As Earlier AB-b2c6 ABA
25
Same As Earlier AB-b2c6 ABAB
26
Same As Earlier AB-b2c6 ABABA
27
Same As Earlier AB-b2c6 ABABAB
28
Same As Earlier AB-b2c6 ABABABA
29
Same As Earlier AB-b2c6 ABABABAB
30
Same As Earlier AB-b2c6 ABABABAB
31
Same As Earlier AB-b2c2-C-b3c4
32
Same As Earlier AB-b2c2-C-b2c5 AB
33
Same As Earlier AB-b2c2-C-b2c5 AB
34
Same As Earlier AB-b2c2-C-b2c5 ABAB
35
Same As Earlier AB-b2c2-C-b2c5 ABAB
36
Same As Earlier AB-b2c2-C-b2c5 ABABC
37
Same As Earlier AB-b2c2-C-b2c5 ABABC
38
Same As Earlier AB-b2c2-C-b2c5 ABABCB
39
Same As Earlier AB-b2c2-C-b2c5 ABABCBC
40
Same As Earlier AB-b2c2-C-b2c5 ABABCBCB
41
Same As Earlier AB-b2c2-C-b2c5 ABABCBCBC
42
Same As Earlier AB-b2c2-C-b2c5 ABABCBCBCB
43
Same As Earlier AB-b2c2-C-b2c5 ABABCBCBCB
44
Shorter Symbol Trick Shorter Symbol Trick:
Use minimum number of bits to represent different symbols in message More common symbols get shorter representation
45
More Common But A is more common: AAAABAAC
So maybe we can use a shorter code for it (10 bits)
46
Why Does it Work No code is a prefix for another 010110010 ABCAAB
0 : it is an A 1 : keep going ABCAAB
47
Why Does it Work A BAD code 010 010 AB DA
0 : is it an A? is it the start of a D? AB DA
48
Building a Code CS160 Reader… Huffman Code Building
49
Lossy Compression Lossless compression :
Can recreate original perfectly Algorithms: Run length encoding, same as earlier, shorter symbol Examples: zip files, www traffic
50
Lossy Compression Lossy compression
Original can NOT be recreated perfectly
51
My Kids Kb
52
Every Other Line/Column Removed
53
Remaining pixels packed back down : 320Kb
54
Blown back up vs original
Original Compressed
55
Only keep every 4th line/column : 81 Kb
56
Real JPEG Image broken into blocks of pixels
57
Real JPEG Each block processed seperately
58
Real JPEG Block processed, to look for compressible patterns
59
Real JPEG Patterns can more or less recreate image
60
JPEG 200% No compress Low compress Med compress High compress
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.