7Transform and Quantisation

7.1 Introduction

We have seen how a video encoder processes a video frame, predicting each block using intra prediction or motion‐compensated inter prediction. The encoder subtracts the prediction from the original block to leave a residual block. The next stage is to process the residual block using a block transform and quantisation (see Figure 7.1). After these two processes, the block can be encoded into a compressed bitstream. When the bitstream is decoded, each block is rescaled and inverse‐transformed to create a decoded residual.

A block transform has the effect of concentrating the important visual information in a block into a small number of significant values known as transform coefficients. Quantisation is used to remove less significant values, leaving a small number of visually significant coefficients to represent the block. Figure 7.2 shows an example. In the 8 × 8 residual block on the left, the pixel information is distributed across the block. After transformation, the coefficient block concentrates most of the information into a few significant coefficients at the top left. After quantisation, most of the quantised coefficients are set to zero. The quantised coefficient block can typically be coded into a much smaller number of bits than the residual block.

The amount of quantisation, i.e. the amount of information that is removed, can be adjusted to control the trade‐off between compression and quality. More quantisation gives ...

Get Coding Video now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.