Unit 04 - Compression Flashcards
(90 cards)
Why does compression matter?
People generate a ton of data.
A very good digital photo = about 12 MegaPixels (MP)
12 MP x 3 bytes per pixel = 36 MB
… which is already a lot
But with video, we have to multiply each frame size by 24 or 30 frames per second
So why does compression matter?
Basically, compression enables us to store data more efficiently
What are some common media types?
Compression is widely used across media types.
Some common ones:
Images: jpeg, png, gif
Videos: mpeg 1, 2, 4, 7 (21)
Audio: mp3, m4a
Data files: rar, zip (lzw)
What are some fundamental principles about compression?
Compression relies on both spatial coherence and temporal coherence.
What is spatial coherence?
Similarity with neighbour across space
What is temporal coherence?
Similarity with neighbour over time
Spatial
Our visual system is more sensitive to differences in light than colour, so we need to store less chroma information than luminance.
Chroma: intensity of colour
Luminance: intensity of light
Spatial continued
Spatial coherence reduces redundancy through chroma subsampling.
Divide the image into macroblocks to reduce file size.
Spatial continued. What are consequences of high compression?
Consequence of high
compression:
Compression artifacts
(noticeably distorted)
Temporal is also known as?
Inter-frame
Temporal
AKA inter-frame
Reduce redundancy between frames, which often have lots in common.
Instead of storing data for every pixel, each macroblock gets instructions on how to change from their current state using keyframes.
Temporal continued. What is a keyframe?
Keyframe: Defines the starting and ending points of a smooth transition
Lossless vs lossy?
Lossless compression: output data is identical to input data
Lossy compression: output data is not identical to input data
-Acceptable for data that is only viewed or heard
What is lossless commonly used for?
Lossless commonly used for:
Sensitive documents
Confidential info
PNG, RAW, GIF, BMP files
What is lossy commonly used for?
JPEG
MPEG, MP3
Higher compression = ____ files = ___ loss
Higher compression = smaller files = more loss
Lower compression = ____ files = ____ loss
Lower compression = bigger files = less loss
Encoding. Vocabulary
Character: a basic data unit in the input stream that forms words and phrases (e.g. English latin letter a, Chinese ideograph 請)
Strings: sequences of characters
char letter = ‘a’;
string word = ‘apple’;
Another word for encoding?
Compression
Another word for decoding?
Decompression
What is codeword?
Data elements used to represent input characters or character strings
Codetable
Codetable: stores the mapping between display value and stored (data) values
Codetables are like dictionaries for encoded messages
Compression ratio
Compression ratio: the relative reduction in size produced by a data compression algorithm
(higher = better)
How do you calculate the compression ratio?
Compression ratio = uncompressed size / compressed size
Example - mp3: 32-megabyte/3-megabyte = 10.66 or 10:1