User Tools

Site Tools


atrac3p:serialized_quantization_unit_levels

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

  • 2 bit: Coding mode

Mode 0: direct coding

  • for each untrimmed quantization unit
    • 6 bit: Level

Coding mode 1 on master channel: base + direct delta

  • 2 bit: selection of basic level prediction vector, 3 meaning choose from big list
  • if using a basic prediction vector
    • 5 bit: number of quantization units with full precision level delta (n)
    • 3 bit: bits of non-full-precision deltas (b), 7 being invalid
    • 6 bit: base value for non-full-precision deltas (c)
    • for each full-precision quantization unit
      • 6 bits of level
    • for each reduced-precision quantization unit
      • b bits of level.
  • if using an extended prediction vector
    • 6 bit: level of quantization unit 0/1/2 for base
    • 6 bit: selection of level table from extended level prediction vectors
    • 5 bit: number of quantization units with high precision level delta (n)
    • 2 bit: bits of low-precision deltas (b)
    • 4 bit: base value for low-precision deltas (c), offset by 7
    • for each high-precision quantization unit
      • 4 bits of level delta (offset by 7, no sign expansion)
    • for each low-precision quantization unit
      • b bits of level delta (not sign expanded. offset already in base value)

Coding mode 1 on slave channel: delta to first

  • 2 bit: selection of level delta encoding huffman tree, 6-bit-tree used
  • for each quantization unit:
    • huffman code for delta (gets added to master channel level, wrapping around)

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

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

  • 2 bit: selection of 6-bit level delta encoding huffman tree
  • for each quantization unit:
    • huffman code for delta (being a difference to previous delta value except for the first one which is absolute; wrapping)

Coding mode 3 on master channel: base + walking delta

  • 2 bit: selection of basic level prediction vector, 3 meaning choose from big table
  • if using a basic prediction vector
    • 2 bit: selection of 6-bit level delta encoding huffman tree
    • 6 bit: level delta for quantization unit 0
    • for remaining quantization units
      • huffman code representing delta between previous and this level
  • if using an extended prediction vector
    • 2 bit: selection of 4-bit level delta encoding huffman tree
    • 6 bit: level of quantization unit 0/1/2 for base
    • 6 bit: selection of level table from extended level prediction vectors
    • 4 bit: level delta for quantization unit 0, offset by 8 (so -8..7 are possible)
    • for remaining quantization units
      • huffman code representing delta between previous and this level (sign expanded)

Coding mode 3 on slave channel: clone master

  • no data
atrac3p/serialized_quantization_unit_levels.txt · Last modified: 2010/10/25 13:01 by megadiscman

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki