GCSE Link: 3.08 (Compression)
There is nothing new about compression from GCSE. The following information has been copied from the GCSE pages.
Compression means reducing the file size, while trying to keep the compressed file as close to the original file as possible.
Table 1 shows the differences between lossy and lossless compression.
Table 1
| Lossy | Lossless | |
|---|---|---|
| Examples | JPEG (image), MP3 (audio) |
PNG (image), WAV (audio) |
| Data loss | Some data is permanently lost, even after decompression. | The file can be exactly decompressed into the original so no data is lost. |
| Quality | This means that the file will be of worse quality than the original. | The file will be of the same quality as the original after decompression. |
| Compression | Can compress files more, leading to lower file sizes than lossless compression. | Cannot compress files as much, leading to higher file sizes than lossy compression. |
Run-Length Encoding (RLE) is a form of lossless compression where "runs" (groups) of consecutive data which have the same value are grouped together in length/data pairs.
Huffman Coding is a form of lossless data compression which can be used on text files.
Use RLE to encode the following binary sequence:
0010 1000 0111 1001.
(2, 0)
(1, 1)
(1, 0)
(1, 1)
(4, 0)
(4, 1)
(2, 0)
(1, 1)