Saturday 17 September 2016

Compression Losses

We have two types of Compression Losses.


Lossless Compression:
  • This compression enables the restoration of a file to its original state, without losing a single bit of data, when the file is uncompressed.
  • This are important in text file compression because if loss of any words or numbers it change the original content.
  • Formats such as GIF, PNG, BMP are use lossless compression.
Example:
  • An example of seven gray pixels:
    • 128, 127, 126, 121, 124, 123, 120
  • Can be re-written in shorter numbers requiring less bits like:
    • 128, -1, -1, -5, +3, -1, -3

Lossy Compression:
  • This compression reduces the size of a file by eliminating bits of information.
  • It permanently deletes the unnecessary data.
  • This is useful with images, audio, graphics. Where if we loss a some bits it is not much effect that means  a loss of quality is affordable.
  • Formats like JPEG are use lossy compression.
Example:

  • The previous sequence of numbers:
    • 128, 127, 126, 121, 124, 123, 120  
  • can be re-written like:
    • 128 - 6
  • Result after decompression:
    • 128, 127, 126, 125, 124, 123, 122

Example of Compression: