User Tools

Site Tools


atrac3p:serialized_quantization_unit_levels

This is an old revision of the document!


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 base tables 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. The usage of the base table for the levels are different from the precision base tables in that they are subtracted and not added to the data, so the no-wraparound condition means that encoding a delta of 6 (i.e. +6) while the base table says 8 (i.e. -8) is an error.

If an extended base table is selected, the entries from the extended base table is offset by a 6-bit value stored directly adjacent to the extended base table number. While the base table itself is (see above) to be interpreted negatively, the offset is positive.

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 base table is selected, and for each quantization unit a difference (delta) is stored. If a basic base table 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 base table 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 base table from the extended base tables is chosen (primitive base tables are not possible 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 base table (either primitive or extended) is chosen. For primitive the base table: 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 extended base table: a 4-bit Huffman tree is selected, the base table includes a 6-bit-offset (as extended base tables 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 not choosing from big list
    • 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 choosing from big list
    • 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: from big base table list + 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 primary base table
    • 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 data from an extended base table
    • 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 vector
    • 4 bit: level delta for quantization unit 0
    • 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.1279906536.txt.gz · Last modified: 2010/07/23 17:35 by megadiscman

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki