Types of Compression Cambridge IGCSE™ Computer
Types of Compression Cambridge IGCSE™ Computer
$ &
Overview
1. Data representation / 1.3 Data storage and compression
Types of compression
Table of
contents
!
Notebook
*
As discussed in the previous section , compressing data as much as possible
Glossary is very important, and in some cases necessary for data storage. The act of
compression usually takes place within three different file types:
Reading
assistance
Most of the file types mentioned above fall into one of two categories of
compression: ‘lossy’ or ‘lossless’. In this section you will learn about both
types of compression, the benefits and drawbacks. Some file types apply no
compression and are known as RAW files.
Lossy compression
Lossy compression permanently removes some data from the original source
file. For example, in an image file, some pixels may be removed, and the
computer then uses an algorithm (based on the particular compression
technique) to ‘guess’ the removed content. Compressing sound files removes
sounds that are outside the human hearing range.
size = sa e * l th * bi
iz = st (size)
byt = tr(by s)
As you can see in the example above, the original uncompressed image
(visible when you move the slider to the right) is much higher quality than
the compressed version of the image (visible when you move the slider to
the left). But the compressed image file size is roughly 90% smaller than the
original. At what point does loss of quality become acceptable in favour of
saving storage space?
Lossless compression
The alternative, lossless compression, does not lose any data from the
original file. After the file has been uncompressed, the result is exactly the
same as the original file. A lossless compression algorithm achieves this by
finding groups of repeating data and recording this data only once, along
with the number of times it was repeated. This is demonstrated below using
an algorithm known as run-length encoding (RLE).
Instead of storing all 8 pixels, only the pattern is stored. When the data is
uncompressed, the algorithm will take this pattern and recreate it exactly as
the original file.
This method works well with some images, but particularly well with text
compression, as it encodes each pattern (word) in a dictionary. Look at an
Uncompressed Compressed
example below, which stores the phrase ‘it will be what it will be.’:
it 0 000
will 1 001
be 2 010
what 3 011
. 4 100
0 1 2 3 0 1 2 4
Activity
Show solution
Reflection
There are two types of compression methods: lossy and lossless. Lossy
compression can greatly reduce file sizes, but the quality of the file is also
greatly reduced. Lossless compression stores patterns of data and rebuilds a
perfect replica of the original file, but the compressed file will be larger than
one using lossy compression.
Start questions
〈 Previous Next 〉