Data Compression - Notes
6.1. Need for data compression
Data compression is essential in today's digital world where large amounts of data are stored, transferred,
and processed. The main reasons for data compression include:
- Reducing storage space requirements.
- Decreasing transmission time over networks.
- Improving performance in data handling and processing.
- Lowering costs associated with data storage and transfer.
- Enhancing efficiency in bandwidth usage, especially in mobile and satellite communication.
6.2. Compression basics
Data compression involves encoding information using fewer bits than the original representation. The key
concepts in compression include:
- Redundancy: Repeating patterns in data that can be eliminated.
- Entropy: Measure of randomness or information content in data.
- Encoding: Transforming data into a compressed format using specific algorithms.
Compression can be classified into two main types: Lossless and Lossy compression.
6.3. Lossless compression
Lossless compression techniques allow the original data to be perfectly reconstructed from the compressed
data. These methods are used when every bit of information is important, such as in text or executable files.
Common lossless compression techniques include:
- Huffman Coding
- Run-Length Encoding (RLE)
Data Compression - Notes
- Lempel-Ziv-Welch (LZW) Compression
Applications: ZIP files, PNG images, text files.
6.4. Lossy compression
Lossy compression techniques result in some loss of data, but the loss is often imperceptible or acceptable.
These are mostly used in multimedia data like audio, video, and images.
Common lossy compression techniques include:
- JPEG (for images)
- MP3 (for audio)
- MPEG (for video)
Lossy compression achieves higher compression ratios than lossless methods.
6.5. LZW Compression
LZW (Lempel-Ziv-Welch) is a popular lossless data compression algorithm. It works by finding repeated
sequences in data and replacing them with shorter codes.
Steps involved in LZW:
1. Initialize the dictionary with all possible symbols.
2. Read input symbols and build longer sequences.
3. If the sequence is in the dictionary, continue.
4. If not, add it to the dictionary and output the code for the previous sequence.
Advantages of LZW:
- Fast encoding and decoding.
- No need to transmit the dictionary.
Data Compression - Notes
Used in formats like GIF and TIFF.