libtheora 1.1.1

Data Fields
th_quant_info Struct Reference

A complete set of quantization parameters. More...

`#include <codec.h>`

## Data Fields

ogg_uint16_t | dc_scale [64]
| The DC scaling factors. More...
ogg_uint16_t | ac_scale [64]
| The AC scaling factors. More...
unsigned char | loop_filter_limits [64]
| The loop filter limit values. More...
th_quant_ranges | qi_ranges [2][3]
| The qi ranges for each ci and pli. More...

## Detailed Description

A complete set of quantization parameters.

The quantizer for each coefficient is calculated as:

Q=MAX(MIN(qmin[qti][ci!=0],scale[ci!=0][qi]*base[qti][pli][qi][ci]/100),
1024).

qti is the quantization type index: 0 for intra, 1 for inter. `ci!=0` is 0 for the DC coefficient and 1 for AC coefficients. qi is the quality index, ranging between 0 (low quality) and 63 (high quality). pli is the color plane index: 0 for Y', 1 for Cb, 2 for Cr. ci is the DCT coefficient index. Coefficient indices correspond to the normal 2D DCT block ordering–row-major with low frequencies first–not zig-zag order.

Minimum quantizers are constant, and are given by:

qmin[2][2]={{4,2},{8,4}}.

Parameters that can be stored in the bitstream are as follows:

- The two scale matrices ac_scale and dc_scale.
  scale[2][64]={dc_scale,ac_scale}.
  th_quant_info::ac_scale
  ogg_uint16_t ac_scale[64]
  The AC scaling factors.
  Definition: codec.h:413
  th_quant_info::dc_scale
  ogg_uint16_t dc_scale[64]
  The DC scaling factors.
  Definition: codec.h:411

- The base matrices for each qi, qti and pli (up to 384 in all). In order to avoid storing a full 384 base matrices, only a sparse set of matrices are stored, and the rest are linearly interpolated. This is done as follows. For each qti and pli, a series of n qi ranges is defined. The size of each qi range can vary arbitrarily, but they must sum to 63. Then, `n+1` matrices are specified, one for each endpoint of the ranges. For interpolation purposes, each range's endpoints are the first qi value it contains and one past the last qi value it contains. Fractional values are rounded to the nearest integer, with ties rounded away from zero.

  Base matrices are stored by reference, so if the same matrices are used multiple times, they will only appear once in the bitstream. The bitstream is also capable of omitting an entire set of ranges and its associated matrices if they are the same as either the previous set (indexed in row-major order) or if the inter set is the same as the intra set.

- Loop filter limit values. The same limits are used for the loop filter in all color planes, despite potentially differing levels of quantization in each.

For the current encoder, `scale[ci!=0][qi]` must be no greater than `scale[ci!=0][qi-1]` and `base[qti][pli][qi][ci]` must be no greater than `base[qti][pli][qi-1][ci]`. These two conditions ensure that the actual quantizer for a given qti, pli, and ci does not increase as qi increases. This is not required by the decoder.

## Field Documentation

## ◆ ac_scale

ogg_uint16_t th_quant_info::ac_scale[64]

The AC scaling factors.

## ◆ dc_scale

ogg_uint16_t th_quant_info::dc_scale[64]

The DC scaling factors.

## ◆ loop_filter_limits

unsigned char th_quant_info::loop_filter_limits[64]

The loop filter limit values.

## ◆ qi_ranges

th_quant_ranges th_quant_info::qi_ranges[2][3]

The qi ranges for each ci and pli.

The documentation for this struct was generated from the following file:

- codec.h