Compression

Cards (8)

  • Define compression
    To reduce the storage space required to store a file
  • What is lossy compression?
    Compression where data is lost to reduce the file size
  • What is lossless compression?
    Compression where we keep all the data, but store it in different formats/ways. The quality of the file isn't lost
  • What information could be lost in lossy compression?
    Reducing the resolution of an image or lowering the sample rate
  • Run Length Encoding
    This reduces the file size by removing repeated information and replacing it with one occurrence of the info followed by the number of times it is repeated.

    RLE is used in the image below to replace repeated pixels with the binary value and then how many repetitions.

    However, the third row has no repeated values and therefore RLE wouldn't work, so not all data is suitable for RLE (especially text)
  • Dictionary-based compression
    A dictionary can be used, like in the example below.
    Repeated data is appended to the dictionary.
    This method results in a significant reduction in file size, but the dictionary also needs to be in the file (therefore increasing the size)
    RLE and dictionary-based methods are most effective on files that contain a lot of repeated data!
  • 3 main points about lossy compression
    > Some information is lost in the process
    > Quality of the file is reduced
    > There is no limit to how much the file size can be reduced
  • 3 main points about lossless compression
    > No information is lost
    > No loss of quality
    > There is a limit to how much a file can be compressed