Data Storage and Compression

Units of Data Storage

  • Definition: A unit of data describes different amounts of binary digits on digital devices.
  • Key Units for IGCSE:
    • Bit (b): 1 or 0
    • Nibble: 4 bits
    • Byte (B): 8 bits
    • Kibibyte (KiB): 1024 bytes (2^10)
    • Mebibyte (MiB): 1,048,576 bytes (2^20)
    • Gibibyte (GiB): 1,073,741,824 bytes (2^30)
    • Tebibyte (TiB): 1,099,511,627,776 bytes (2^40)
  • Megabyte vs. Mebibyte:
    • 1 Kibibyte (KiB) = 1024 bytes
    • 1 Kilobyte (KB) = 1000 bytes

Converting Between Units

  • Conversion Process:
    • For larger to smaller units: Multiply or divide by 1024 for KiB, MiB, GiB, TiB, or by 8 for bits and bytes.
    • Example:
    • 2000 KiB to MiB: 2000 / 1024 = 1.95 MiB
    • 2 TiB to GiB: 2 * 1024 = 2048 GiB

File Size Calculations

  • Bitmap Image Size Calculation:

    • Formula:
    • Size = Resolution x Colour Depth
    • Resolution = width x height
    • Example:
    • For a resolution of 250,000 with a colour depth of 24 bits:
      • Size = 250,000 x 24 bits (3 bytes)
      • Convert to bytes: 750,000 bytes
      • Convert to KiB: 732 KiB
  • Sound File Size Calculation:

    • Formula:
    • Size = Sample Rate x Duration x Sample Resolution
    • Example:
    • Sample Rate = 100, Duration = 60 seconds, Sample Resolution = 24 bits:
      • Size = 100 x 60 x 24 bits
      • Final size: 18 KiB

Compression

  • Definition: Reducing the size of a file to take up less storage, requiring less bandwidth and shorter transmission time.

  • Types of Compression:

    1. Lossy Compression:
    • Description: Data is permanently removed to reduce size, resulting in quality loss.
    • Examples: Suitable for images, video, sound (like JPEG, MP3).
    • Benefit: Smaller file sizes, suitable for sharing, quicker transfers.
    1. Lossless Compression:
    • Description: Data is encoded and can be restored to original state, no data loss.
    • Examples: Suitable for documents (like DOCX, PDF), uses techniques like Run Length Encoding (RLE).
    • Benefit: Quality preserved, reversible.
  • Run Length Encoding (RLE):

    • Condenses sequences of identical elements.
    • Example: "AAAABBBCCDAA" compressed to "4A3B2C1D2A".
    • Used in bitmap images to compress color sequences.

Key Differences Between Lossy and Lossless

  • Lossy Compression: Decreases file size significantly but loses some data which may be acceptable (for multimedia).
  • Lossless Compression: Reduces file size without losing data, suitable for documents where every bit of data is vital.

Worked Examples

  • Example Question: Explain two benefits of using lossy compression for sound files:

    1. Reduces file size [1 mark].
    2. Quicker to share via email [1 mark].
  • Practice Question: Differentiate between lossy and lossless, with benefits.

    1. Lossy decreases file size [1 mark] so it can be sent quicker [1 mark].
    2. Lossy means data is lost [1 mark] but the difference may not be noticeable [1 mark].