Compression
Why files are compressed, lossy against lossless, and run-length encoding step by step.
Transcript
Compression makes a file smaller. That saves storage space, and the file downloads and streams faster, using less bandwidth.
Lossy compression permanently removes some data. The file gets much smaller, but the quality is lower, and the original cannot be rebuilt.
An image can lose resolution or colour depth. Sound can lose sample rate or bit depth. J P E G and M P three are lossy.
Lossless compression makes the file smaller without losing any data, so the original can be rebuilt exactly. P N G and ZIP are lossless.
One lossless method is run length encoding, or R L E. It replaces a run of the same value with the value, and a count.
Take a row of twelve pixels: five white, then three black, then four white. R L E stores just three pairs: five W, three B, four W.
Twelve values become three pairs, so the file is smaller, and nothing is lost. R L E works best when there are long runs of the same value.
Compression saves space. Lossy throws data away, lossless keeps everything, and R L E is a simple lossless method.
More in this series
2:41Denary, binary and hexadecimal
Place values, converting denary to binary and back, and why hex is used for bytes.
2:30Binary addition, overflow and shifts
Adding binary numbers with carries, overflow when a ninth bit is needed, and logical shifts as multiply and divide.
2:12Two's complement
Negative numbers in binary: the -128 place value, invert and add one, and reading a signed byte.
1:45Text: ASCII and Unicode
Character sets give every character a code. ASCII's 128 codes, Unicode's millions, and the storage trade-off.
1:27Images
Pixels, resolution, colour depth, image file size and metadata.
1:38Sound
Sampling an analogue wave: sample rate, bit depth, quality against file size.
1:50Storage units and file sizes
Bit to pebibyte in steps of 1024, and calculating image and sound file sizes.
5:38Unit 1 quiz
Ten questions with a think-time countdown and explained answers.