Quantization and DCT

Quantization and DCT

This will be a super basic explanation of a couple of concepts that are used in video encoding. This explanation is not meant to be comprehensive, it is there to give basic information, and give you a practical approach on how they are used.


Discrete Cosine Transform is a heavily used compression technique in both video and image compression (and lots more). It's a trigonometric function that is weighted using a coefficient matrix.

Blocks of the image are converted into multiple "frequency waves" (varying cosine), and weighted. The frequencies that see the most use in the block will be weighted higher, and we can potentially remove the less used ones to get further compression.

I would heavily encourage watching this video if you want to have a better understanding of the concept, as it will do a much better job of explaining it more in-depth, and also show you good visuals. This will help your understanding a lot.


Quantization refers to reducing the number of values needed to represent the information.

If we had a picture that had 256 values possible between black, shades of gray and white, we can probably get away with reducing this value substantially without too much loss to perceptual visual quality.

Its all about dividing up the signal into smaller quanta (partitions), or levels if you will, and using these values instead. We dont need all of the values to get a visually decent images displayed.

Example converting a signal into fewer levels (blue).

Quantization can be used in different ways, you can reduce the possible color (chroma), brightness (luma), or signal values (like DCT) to save on bits (compress).

Adaptive Quantizer (AQ)

Modern compression standards (like h264) allows for the quantizer scale to be varied as is necessary. Very useful for aligning data where it will see the most use/effect.


Using DCT and Quantization together (Huffman coding) we can turn the coefficient matrix very small, and save lots of data. This is one of base concepts for a lot of video/image compression.

I just want to reiterate that this was a very shallow explanation of a lot of complicated concepts. I really encourage you to watch the video, and perhaps do some more digging yourself.

Further reading