0% found this document useful (0 votes)
2 views19 pages

1.3.3 Data Compression

Data compression is essential for reducing file sizes to save storage space, improve streaming times, and lower costs associated with data transfer. There are two main types of compression: lossy, which sacrifices quality for smaller file sizes, and lossless, which preserves original data. Common lossy formats include MP3 and JPEG, while lossless techniques like Run-Length Encoding (RLE) allow for complete data recovery.

Uploaded by

msfirahversiani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views19 pages

1.3.3 Data Compression

Data compression is essential for reducing file sizes to save storage space, improve streaming times, and lower costs associated with data transfer. There are two main types of compression: lossy, which sacrifices quality for smaller file sizes, and lossless, which preserves original data. Common lossy formats include MP3 and JPEG, while lossless techniques like Run-Length Encoding (RLE) allow for complete data recovery.

Uploaded by

msfirahversiani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

1.3.

3 DATA COMPRESSION

The calculations in the previous section show 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
1.3.3 DATA COMPRESSION

» 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.
1.3.4 LOSSY AND LOSSLESS FILE COMPRESSION

Lossy File Compression: is type of reduction in size where the file


size is reduced with compromise in quality

Secondly and most importantly, once the file if compressed, the


details lost cannot be recovered back

On the other hand Lossless file compression technique use an


algorithm the no compromise in quality and the original file can be
recovered back any time when required.
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.
LOSSY FILE COMPRESSION

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)
» JPEG.
LOSSY FILE COMPRESSION

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.
LOSSY FILE COMPRESSION

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.
LOSSY FILE COMPRESSION

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.
LOSSY FILE COMPRESSION

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.
LOSSY FILE COMPRESSION

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.
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

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:
1 it is a form of lossless/reversible file compression
2 it reduces the size of a string of adjacent, identical data (e.g.
repeated colours in an image)
3 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)
LOSSLESS FILE COMPRESSION

4 RLE is only effective where there is a long run of repeated


units/bits.

UsingRLE on text data Consider the following text string:


‘aaaaabbbbccddddd’. Assuming each character requires 1 byte then
this string needs 16 bytes. If we assume ASCII code is being used,
then the string can be coded as follows:
LOSSLESS FILE COMPRESSION

RLE in black images

the letter ‘F’ in a grid where each square requires 1 byte of storage. A
white square has a value 1 and a black square a value of 0:
LOSSLESS FILE COMPRESSION

RLE in colour images

see object in four colours. Each colour is made up of red, green and
blue (RGB) according to the code on the right.
LOSSLESS FILE COMPRESSION

This produces the following data: 2 0 0 0 4 0 255 0 3 0 0 0 6 255


255 255 1 0 0 0 2 0 255 0 4 255 0 0 4 0 255 0 1 255 255 255 2 255 0
0 1 255 255 255 4 0 255 0 4 255 0 0 4 0 255 0 4 255 255 255 2 0
255 0 1 0 0 0 2 255 255 255 2 255 0 0 2 255 255 255 3 0 0 0 4 0
255 0 2 0 0 0.
LOSSLESS FILE COMPRESSION

The original image (8 × 8 square) would need 3 bytes per square


(to include all three RGB values). Therefore, the uncompressed
file for this image is 8 × 8 × 3 = 192 bytes.

The RLE code has 92 values, which means the compressed file
will be 92 bytes in size. This gives a file reduction of about 52%.
It should be noted that the file reductions in reality will not be as
large as this due to other data which needs to be stored with the
compressed file (e.g. a file header).
LOSSLESS FILE COMPRESSION

0478/11/M/J/1 Q4
LOSSLESS FILE COMPRESSION

0478/11/M/J/1 Q4

You might also like