Crisp Notes: Data Storage and Compression
1. Data Storage Units
• Bit: Smallest unit (0 or 1).
• Byte: 8 bits = 1 byte; 4 bits = 1 nibble.
• Memory Size (IEC System):
o 1 KiB (kibibyte) = 1024 bytes (210)
o 1 MiB (mebibyte) = 1024 KiB (220)
o 1 GiB (gibibyte) = 1024 MiB (230)
o 1 TiB (tebibyte) = 1024 GiB (240)
Conversion:
• Bytes → KiB → MiB → GiB: Divide by 1024.
• GiB → MiB → KiB → Bytes: Multiply by 1024.
2. Calculating File Sizes
A. Images:
Size (bits) = Resolution (pixels) × Colour Depth (bits)
Example: 2048 × 2048 image, 16-bit depth:
2048 × 2048 × 16 = 67,108,864 bits = 8,388,608 bytes [bits / 8 = bytes]
B. Sound (Mono):
Size (bits) = Sample Rate (Hz) × Resolution (bits) × Time (s)
Example: 44.1 kHz, 8-bit, 20s → 44,100 × 8× 20 = 7,056,000 bits
= 8,82,000 bytes
= 861.3281KiB
Stereo Sound: Double the bits (2 channels).
3. Data Compression
Why Compress?
✓ Saves storage, speeds up transfers, reduces bandwidth/costs.
A. Lossy Compression:
• Irreversible; discards "less important" data.
• Formats: JPEG (images), MP3 (audio), MP4 (video).
• Techniques: Reduce resolution, color depth, or sample rate.
B. Lossless Compression:
• Reversible; no data lost (e.g., ZIP, PNG).
• Example: Run-Length Encoding (RLE)
▪ Compresses repeated data (e.g., "aaaaabbbcddddd" → "5a3b1c5d").
Key Takeaways
• Use IEC units (KiB, MiB) for memory.
• Image size: Resolution × Colour Depth.
• Sound size: Sample Rate × Resolution × Time (×2 for stereo).
• Lossy: Smaller files, permanent data loss.
• Lossless: No data loss, reversible.
Applications:
• JPEG/MP3/MP4 = Lossy (streaming, storage).
• PNG/ZIP = Lossless (critical data like spreadsheets).