Published by Patrick Mutisya · 14 days ago
Show understanding of lossy and lossless compression and justify the use of a method in a given situation.
Compression is the process of reducing the number of bits required to represent data. It exploits redundancy or perceptual limitations to store or transmit information more efficiently.
Used when exact data recovery is essential (e.g., text files, executable programs, medical images).
Common techniques:
Example – Huffman coding:
Given symbol probabilities \$p_i\$, the optimal average code length is bounded by the entropy:
\$H = -\sum{i=1}^{n} pi \log2 pi\$
Used when a perfect replica is not required and higher compression ratios are desired (e.g., audio, video, photographs).
Common techniques:
Example – JPEG compression steps:
| Aspect | Lossless | Lossy |
|---|---|---|
| Data integrity | Exact reconstruction | Approximate reconstruction |
| Typical applications | Text, source code, archives, medical imaging | Photographs, audio, video streaming |
| Common algorithms | RLE, Huffman, LZW, DEFLATE | JPEG, MP3, MPEG, AAC |
| Compression ratio | Usually 2:1 – 3:1 | Often 10:1 – 100:1 or higher |
| Impact on quality | No loss of quality | Quality degrades with higher compression |
When selecting a compression technique, consider the following factors:
Legal documents must retain every character exactly as originally written. A lossless method such as ZIP (DEFLATE) is appropriate, providing a moderate reduction while guaranteeing perfect recovery.
Live video requires high compression to fit limited bandwidth. A lossy codec like H.264 (MPEG‑4 A \cdot C) is justified because viewers accept minor artefacts, and the priority is low latency and smooth playback.
Medical imaging demands diagnostic accuracy. Lossless compression (e.g., JPEG‑2000 lossless mode) preserves pixel values exactly, ensuring no diagnostic information is lost.