Lossy Compression
Lossy Compression
Lossy is derived from the word “loss,” and this refers to the way this method of compression
works. With lossy compression, data that is deemed redundant or unnecessary is removed in
the compression process. The data is removed permanently, so it is effectively “lost.” This way,
the size of the file is reduced.
Lossy compression is mostly used for multimedia such as audio, video, and image files. This is
mostly done when streaming these files, as a file can be streamed much more effectively if it is
smaller in size.
If a lossy compression method is used on a music file, it will try to remove all background noise
and noises that may not be heard by the human ear. This data isn’t hugely necessary for playing
the track; removing it will mean the track will not sound exactly as it did when recorded, but it
will be a very close representation.
Lossless Compression
Lossless refers to a method of compression that loses no data in the process. In lossless
compression, the compressed data can be reversed to reconstruct the data file exactly as it was.
Lossless compression is used when it is essential that no data is lost or discarded.
If a lossless compression method is used on a music file, it will not lose any of the data from the
file. A possible way to compress the data would be to store patterns found in the music. It would
store this pattern once along with how many times it is repeated in the music, so repeating data
is reduced. When the music track is played, the full track, exactly as it was recorded, can be
reconstructed and listened to.
People may use lossless compression when downloading a music track if they want the highest
quality possible and to hear the track exactly as it was recorded. Lossless compression can
also be used when storing text files.
Excluding spaces and full stops, the message has a total of 62 characters.
Each character requires 1 byte of storage, so we would need 62 bytes of memory to store this
message.
This is much less than the 62 bytes required originally. We have reduced storage by 25%,
achieving significant savings. To reconstruct the message, the computer retrieves the words and
places them in their allocated positions.
"ASK NOT WHAT YOUR FRIEND CAN DO FOR YOU. ASK WHAT YOU CAN DO FOR YOUR FRIEND."
Excluding spaces and full stops, the message has 59 characters, requiring 59 bytes for storage.
After compression:
We need 31 bytes to store the words and 17 bytes to store the positions, totaling 48 bytes.
This is less than the 59 bytes required originally, reducing storage needs by 19%.
Although this message was originally shorter than the first one, it requires more space after
compression than the first message due to word frequency patterns.
Compression of Images
Uncompressed image files can be huge, making uploading or emailing them difficult. Many
email providers limit the file size of attachments, making compression necessary.
Both methods reduce image size by identifying repeating color patterns within the image:
Lossless compression identifies patterns and stores them efficiently, maintaining the exact
quality of the original image.
Lossy compression removes detail unnoticeable to the human eye, reducing file size
further. However, each time an image is compressed and saved, some quality is lost (e.g.,
JPEG format).
File Formats
A file format is the method that we choose to store different data on a computer. Different file
formats store data in different ways, meaning that they organize the data into storage
differently. This makes it important for software to recognize the file format used to save the
data in order to access it.
There are many different types of file formats. Some are specific to software, and some are
more general, such as images or multimedia. The file format for a file will mostly depend on the
type of data it holds and the program that is used to create it. The format of a file is recognized
from the filename extension. This is the set of characters that appear at the end of the filename,
separated from the name with a dot.
MP3 and MP4 have developed from the original file format Motion Picture Experts Group
(MPEG), a lossy compression method for video files dating back to 1991.
JPEGs, MP3s, and MP4s are used in a variety of devices such as computers, digital cameras,
DVD/Blu-ray players, and smartphones to store content.
Summary
Definition
The transfer of data occurs either wirelessly by radio waves or over a cable, for example, by fiber
optic cable or copper twisted wire. The data is transmitted as a stream of bits. There are
different methods to transfer data.
Bit Rate
The rate at which data is transferred is called the bit rate. This refers to the number of bits
transmitted in a given period. It is measured in:
Key Terms
Serial transmission uses a single wire to transfer data bits. A single wire is cost-effective for long-
distance data transmission. The bits are transmitted sequentially, one after another, with a set
time interval between sending each bit. The time interval depends on the speed of the
transmitting and receiving devices. For example, a 56K modem can transmit 56,000 bits per
second.
If we take an 8-bit byte of data (10011001), using serial data transmission, the byte would be
sent as shown in Figure 2.02:
1.B
its get sent one at a time.
2.T
he bits are transmitted sequentially.
3.T
ransmission continues until all bits have been sent.
Parallel transmission uses several wires to transfer data bits simultaneously. For example, with
eight wires, a full byte (8 bits) can be transmitted at once. Parallel transmission is faster than
serial transmission. However, because multiple wires are used, it is more expensive and is
usually limited to shorter distances.
If we take the same 8-bit byte of data (10011001), using parallel data transmission, it would be
transferred as shown in Figure 2.03:
All bits are sent at the same time using multiple wires.