Data compression
It is known that sound and image files can be very large. It is therefore necessary to reduce (or compress) the size
of a file for the following reasons:
• to save storage space on devices such as the hard disk drive/solid state drive
• to reduce the time taken to stream a music or video file
• to reduce the time taken to upload, download or transfer a file across a network
• the download/upload process uses up network bandwidth – this is the maximum rate of transfer of data
across a network, measured in bits per second. This occurs whenever a file is downloaded, for example,
from a server.
Compressed files contain fewer bits of data than uncompressed files and therefore use less bandwidth, which
results in a faster data transfer rate. reduced file size also reduces costs. For example, when using cloud storage,
the cost is based on the size of the files stored. Also, an internet service provider (ISP) may charge a user based on
the amount of data downloaded.
Ther are two compression techniques used for file compression:
Lossy and Lossless file compression
File compression can either be lossless or lossy.
Lossy file compression
With this technique, the file compression algorithm eliminates unnecessary data from the file. This means the
original file cannot be reconstructed once it has been compressed. Lossy file compression results in some loss of
detail when compared to the original file. The algorithms used in the lossy technique have to decide which
parts of the file need to be retained and which parts can be discarded. For example, when applying a lossy file
compression algorithm to:
• an image, it may reduce the resolution and/or the bit/colour depth
• a sound file, it may reduce the sampling rate and/or the resolution.
Lossy files are smaller than lossless files which is of great benefit when considering storage and data transfer rate
requirements. Common lossy file compression algorithms are:
• MPEG-3 (MP3) and MPEG-4 (MP4) (Moving Picture Experts Group)
• JPEG. (Joint Photographic Experts Group)
MPEG-3 (MP3) and MPEG-4 (MP4)
MP3 files are used for playing music on computers or mobile phones. This compression technology will reduce the
size of a normal music file by about 90%. While MP3 music files can never match the sound quality found on a
DVD or CD, the quality is satisfactory for most general purposes. But how can the original music file be reduced by
90% while still retaining most of the music quality? Essentially the algorithm removes sounds that the human
ear can’t hear properly. For example:
• removal of sounds outside the human ear range
• if two sounds are played at the same time, only the louder one can be heard by the ear, so the softer
sound is eliminated. This is called perceptual music shaping.
MP4 files are slightly different to MP3 files. This format allows the storage of multimedia files rather than just
sound – music, videos, photos and animation can all be stored in the MP4 format. As with MP3, this is a lossy file
compression format, but it still retains an acceptable quality of sound and video. Movies, for example, could be
streamed over the internet using the MP4 format without losing any real discernible quality.
JPEG
When a camera takes a photograph, it produces a raw bitmap file which can be very large in size. These files are
temporary in nature. JPEG is a lossy file compression algorithm used for bitmap images. As with MP3, once the
image is subjected to the JPEG compression algorithm, a new file is formed and the original file can no longer be
constructed.
The JPEG file reduction process is based on two key concepts:
• human eyes don’t detect differences in colour shades quite as well as they detect differences in image
brightness (the eye is less sensitive to colour variations than it is to variations in brightness)
• by separating pixel colour from brightness, images can be split into 8 × 8-pixel blocks, for example, which
then allows certain ‘information’ to be discarded from the image without causing any real noticeable
deterioration in quality.
Lossless file compression
With this technique, all the data from the original uncompressed file can be reconstructed. This is particularly
important for files where any loss of data would be disastrous (e.g., when transferring a large and complex
spreadsheet or when downloading a large computer application).
Lossless file compression is designed so that none of the original detail from the file is lost.
Run-length encoding (RLE) can be used for lossless compression of a number of different file formats:
• it is a form of lossless/reversible file compression
• it reduces the size of a string of adjacent, identical data (e.g., repeated colours in an image)
• a repeating string is encoded into two values:
– the first value represents the number of identical data items (e.g., characters) in the run
– the second value represents the code of the data item (such as ASCII code if it is a keyboard character)
RLE is only effective where there is a long run of repeated units/bits.
Benefits of Compression
There are multiple advantages to opting for the file and folder compression method; some of the main ones are
mentioned hereafter:
· Users can expect a faster data transmission speed.
· You can remove excess elements from storage space and leave room for adding more app
data/files.
· The file integrity and backup storage are at optimal levels.
· Keep the data in files safer.
· Share the files easily via email addresses.
· This is a cost-saving solution since you can avoid investing in multiple extra storage spaces.
Disadvantages of Compression
Like the benefits, certain factors file compression as a solution lacks. Here are the main ones:
· The decompression process requires a higher RAM processing power, affecting the PC's speed
as it might pause.
· When you decompress the file afterward, the file size can sometimes increase in the new form.
· Compressing and decompressing file types can take longer if the size is large.
· The best anti-virus software can fail to analyse the compression files thoroughly, and
malware/viruses within these files can enter systems undetected.
Which pictures above is original and which is lossy
Sound Exploration — Listening to Waves
Summary