AQA GCSE Computer Science (8525), section 3.3.8 (Data compression)
What is compression?
Data compression means making files smaller, so they use fewer bits.
Why compress data?
- Less storage space is needed, so more files fit on a device.
- Files can be sent faster over a network or the internet (less data to send).
- It uses less bandwidth and so costs less.
- Streaming and downloads work better on slow connections.
Examples: photos (JPEG), music (MP3), video, and zipped folders.
Different ways to compress
There are different methods of compression. At GCSE you need to know two:
- Huffman coding: gives common characters shorter codes.
- Run length encoding (RLE): replaces repeated data with a count and a value.
(These two methods are described on the next pages.)
Lossy and lossless
| Type | What happens | Example |
|---|---|---|
| Lossless | the original can be recovered exactly | Huffman coding, RLE, ZIP files |
| Lossy | some detail is permanently removed to get a smaller file | JPEG images, MP3 sound |
Huffman coding and RLE are lossless. You can restore the original text, which is important for text, programs and data where nothing can be lost.
Summary
Compression reduces file size, which saves storage and transmission time.
Common mistake: saying compression "deletes the file's unnecessary parts" for all methods. Lossless methods lose nothing. Also, a compressed file must be decompressed before it can be used in its original form.
Exam tip: give two clear reasons for compression: it takes up less storage and it is quicker to send over a network.
Check yourself
What is data compression?
Reducing the size of a file so that it uses fewer bits.
Give two reasons for compressing data.
It saves storage space and makes files quicker to transmit.
What is the difference between lossy and lossless compression?
Lossless lets the original be restored exactly, but lossy permanently removes some data.