Table of Contents

Serialized quantization unit levels

The quantization unit levels are logarithmically scaled scale factor for the band coefficients. An increase of three in the quantization unit level value gives rise to an factor of two in the scaling value. The range of the level values is between 1 and 63. There are four level encoding modes, and all but mode 0 are different for the master and the slave channel.

Trailing bands with a quantization precision of zero (i.e. no data) are trimmed, i.e. no data for these quantization units are encoded. This does not apply to quantization units with a precision of zero in between non-zero quantization units.

Prediction Vectors

The prediction vectors (common distributions) of the levels fall into two classes. Three basic level prediction vectors (one of them completely zero) and 64 different extended level prediction vectors. The prediction vectors are used in all non-primitive master encoding modes. While modes basing on the extended tables generally wrap around, modes based on the basic tables do not.

For the basic vectors only, the prediction vectors are to be subtracted from the data instead of added,so the no-wraparound condition means that encoding a delta of 6 (i.e. +6) while the prediction vector says 8 (i.e. -8) is an error.

If an extended prediction vector is selected, the entries from the extended prediction vector are offset by a 6-bit value stored directly adjacent to the extended prediction vector number. The extended vector is taken positive unlike the basic vectors.

Encoding Modes

0: Directly encoded

The 6-bit quantities for all not-trimmed quantization units are directly encoded as 6-bit values.

1 (on master channel): Direct encoded delta

A prediction vector is selected, and for each quantization unit a difference (delta) is stored. If a basic vector is used, for the first (n quantization units) a full 6-bit delta is stored (but still note the no-wraparound restriction), for the later quantization units a reduced delta value with only b bits is obtained, which is added to a baseline constant c. If extended an extended prediction vector is used, deltas are generally just 4 bits instead of 6 bits, interpreted with an offset of 7, so the bit sequence "0000" means -7 and "1100" means +5. For the reduced-precision deltas, the -7 offset is applied only to the base value. The reduced-precision deltas themselves are always non-negative.

1 (on slave channel): Diffence to master

First, one of the four 6-bit-trees is chosen. For each quantization unit, a huffman code from that tree is used as difference between master and slave channel. The calculation wraps around.

2 (on master channel): Huffman-encoded delta

A vector from the extended prediction vectors is chosen (basic vectors are not accessible in this mode). For each quantization unit, a 4-bit-delta value is stored as a huffman code in the selected 4-bit-tree. The difference is applied with sign expansion (so the tree codes are -7 to 7) and wrap-around.

2 (on slave channel): Delta-encoded difference to master

This mode stores the differences between master and slave channel as difference to the previous difference, except for the first master-to-slave difference, which is stored as absolute value. The whole difference/addition processing wraps around

3 (on master channel): Delta-encoded deltas to base

A prediction vector (either basic or extended) is chosen. For a primitive the vector: a 6-bit Huffman tree is selected. The level delta for the first quantization unit is directly encoded, the difference between the deltas of each other band to its previous band is encoded by the given Huffman tree. For an extended vector: a 4-bit Huffman tree is selected, the vector selection comes with a 6-bit-offset (as extended vectors always do), the delta for quantization unit 0 is a plain 4 bit number, the deltas for the following quantization units are encoded by the difference to the previous one, represented as Huffman code.

3 (on slave channel): Copy from master channel

The quantization unit level table on master and slave channels are identical

Encoding

Serialized Quantization unit Levels Block

Mode 0: direct coding

Coding mode 1 on master channel: base + direct delta

Coding mode 1 on slave channel: delta to first

Coding mode 2 on master channel: extended prediction vector + huffman delta

Coding mode 2 on slave channel: delta encoded delta to first

Coding mode 3 on master channel: base + walking delta

Coding mode 3 on slave channel: clone master