#include <codec.h>
Data Fields | |
ogg_uint16_t | dc_scale [64] |
The DC scaling factors. | |
ogg_uint16_t | ac_scale [64] |
The AC scaling factors. | |
unsigned char | loop_filter_limits [64] |
The loop filter limit values. | |
th_quant_ranges | qi_ranges [2][3] |
The qi ranges for each ci and pli. |
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:
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.
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.
ogg_uint16_t th_quant_info::ac_scale[64] |
The AC scaling factors.
ogg_uint16_t th_quant_info::dc_scale[64] |
The DC scaling factors.
unsigned char th_quant_info::loop_filter_limits[64] |
The loop filter limit values.
The qi ranges for each ci and pli.