How to calculate the Compression ratio
5 views (last 30 days)
Hi, could someone explain to me how to calculate the compression ratio of an image from the quantization bit allocation? I thought calculating the ratio from the the image sizes was correct but no, there seems to be a way of calculating it from the quantization bits. Please guide me through this. Thank you
Walter Roberson on 18 Jan 2013
Under limited circumstances in which quantization (and repacking of binary) is the only compression algorithm, then the compression ratio approaches the number of bits in the original pixel, divided by the number of bits in the quantized pixel.
If the number of quantization states is not a power of 2 (e.g., you quantize to 50 shades), then in the limit use log2 of the number of quantization states, provided you are usual optimal packing (but you would normally use arithmetic encoding instead in such a situation; it makes the calculations much easier.) A less efficient packing that is much easier to process would use ceil(log2(num_quantization_states)) -- e.g., ceil(log2(50)) bits per pixel.