Types of compression suited to different scenarios
Perceptual coding is a lossy compression technique applied to
sound. MP3 sound files make use of perceptual coding.
Algorithms are used to remove some data from sound files
which focus on removing sound captured at frequencies out
with the dynamic range of human hearing and to remove
frequencies which cannot be picked up by the human ear.
Free Lossless Audio Codec
This is lossless compression technique applied to sound files that are saved as .flac files. FLAC is open source which means users can access the code to achieve compression. It compresses sound files by trying to predict the frequency of future samples and then trying to balance the difference between what was predicted and what was actually sampled.
LZW compression is commonly used for animated GIF files
This file format supports a maximum frame rate of 30 frames per
second and a resolution of 320 * 240 pixels per frame. AVI files do not have built in compression.
This file format stores a few key frames as
compressed JPEGs. Subsequent frames after a key frame are
compared to the key frame, and only the changes are saved.
GIF uses LZW lossless compression. Each pixel is represented in 8 bits which allows
for 256 colours. GIFs have a transparency feature where a specific colour can be
made transparent so that parts of an image do not obscure the one behind.
24-bit bitmap graphics give true colour with 224 colours but are heavy on storage
requirements. RLE and LZW can be used to reduce the file size.
This file format uses lossy compression. The loss in the detail can range from
barely noticeable to seriously reducing the quality of the image.
This is a lossless file format intended to replace GIF by adding extra features. The
PNG file format has a higher compression factor than GIF files and also has the
Difference between lossy and lossless compression
Lossy compression removes data. The removed data cannot be restored
Lossless compression does not remove data. It codes the data in such a way that it can be uncompressed.
Situations in which lossy or lossless compression would be used
Lossy compression works well on photographic images where
there are not likely to be solid colours. Simple graphics and
logos would benefit from lossless compression.
Lossless compression works well when there are large blocks of repeating pixels
Why compression is required
Compression is required because uncompressed files can be too large for everyday use on a regular computer
For example, HD movies
have a resolution of 1920 by 1080 pixels, using 24 bits per pixel
for colour and a frame rate of 50fps. This means:
1920 x 1080 x 24 x 50 bits per second
= 2488320000 bits per second
= 2.3 Gbps
2.3 gigabytes per second is too demanding for a movie