I am new to the field of image compression. While going through various texts, I read about how transforming the image to another domain using, for example, the wavelet transform, or the DCT, makes it suitable for lossy compression.

I have been trying to play around with wavelet transforms on a sample bmp in MATLAB. Using the MATLAB library function, I created transform coefficients using Daubechies wavelets.

Now a given pixel when read from bmp is in uint8 format, i.e., it uses up 1 byte of memory. This is because in most image formats the range of values a pixel can take is from 0 to 255. After wavelet transformation however, one gets double precision floating point for each element of the transformed matrix. This would typically consume about 4 bytes for each element.

My goal was to try out some very basic compression using quantization and entropy coding of quantized elements. Quantizing the low magnitude values of the transformed elements to zero does give good compression. But trouble is I have to still use double precision floating point. The moment I convert all the wavelet coefficients to some integer format, the reconstructed image becomes very poor in quality as compared to the original.

In standard compression techniques, how are the transformed coefficients handled, given that they are not integer in format? Each transformed coefficient, due to its double precision nature, takes up more bytes than the original. Can you point out resources where this issue has been explained?

  • $\begingroup$ Why you have to use double precision floating point after compression? $\endgroup$
    – Premnath D
    Commented Nov 17, 2013 at 12:52
  • $\begingroup$ Double precision is 8 bytes (64 bits); single precision is 4 bytes (32 bits). At least, that's the normal IEEE 754 definition. $\endgroup$
    – MSalters
    Commented Nov 18, 2013 at 15:22

2 Answers 2


Oftentimes some rounding occurs in storing the coefficients. This is why many image compression algorithms are lossy, i.e. they lose information when converting the floating point coefficients to integer format. The process of rounding is called quantization. See this wikipedia article for an example.



It's often possible to come up with a scale factor such that the largest coefficient has the value 255. You'd need to store this scale factor once per set of coefficients. This saves 3 bytes per coefficient. Usually you can live without coefficients smaller than 1/255th of the largest.

DC is of course an exception and should be treated separately. The DC components may have quite some spatial correlation and could possibly benefit from a higher level DCT. I.e. if you have 8x8 DCT transforms, each of 8x8 pixels (total 64x64 pixels) then you also have 8x8 DC components that you can feed to your DCT again.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.