vc2_bit_widths.quantisation: VC-2 Quantisation

The vc2_bit_widths.quantisation module contains an implementation of VC-2’s quantisation scheme along with functions for analysing its properties.

Quantisation & dequantisation

The VC-2 quantisation related pseudocode functions are implemented as follows:

forward_quant(coeff, quant_index)

Quantise a value according to the informative description in (13.3.1)

inverse_quant(quantized_coeff, quant_index)

Dequantise a value using the normative method in (13.3.1)

quant_factor(index)

Compute the quantisation factor for a given quantisation index. (13.3.2)

quant_offset(index)

Compute the quantisation offset for a given quantisation index. (13.3.2)

Analysis

The following functions compute incidental information about the behaviour of the VC-2 quantisation scheme.

maximum_useful_quantisation_index(value)

Compute the smallest quantisation index which quantizes the supplied value to zero. This is considered to be the largest useful quantisation index with respect to this value.

maximum_dequantised_magnitude(value)

Find the value with the largest magnitude that the supplied value may be dequantised to for any quantisation index.

See Quantisation and affine arithmetic for a proof of this method.