User Tools

Site Tools


atrac3p:serialized_bandlet_levels

This is an old revision of the document!


Serialized bandlet levels

The bandlet levels are logarithmically scaled scale factor for the band coefficients. An increase of three in the bandlet 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 quantizer of zero (i.e. no data) are trimmed, i.e. no data for these bandlets are encoded. This does not apply to bandlets with a quantizer of zero in between non-zero bandlets.

Base tables

The base tabels (common distributions) of the levels fall into two classes. Three basic base tables (one of them completely zero) and 64 different extended base tables. 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 base table for the levels are different from the quantizer 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 bandlets are directly encoded as 6-bit values.

1 (on master channel): Direct encoded delta

A base table is selected, and for each bandlet a difference (delta) is stored. If a basic base table is used, for the first (n bandlets) a full 6-bit delta is stored (but still note the no-wraparound restriction), for the later bandlets 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 bandlet, 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 bandlet, 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 bandlet 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 bandlet 0 is a plain 4 bit number, the deltas for the following bandlets are encoded by the difference to the previous one, represented as Huffman code.

3 (on slave channel): Copy from master channel

The bandlet level table on master and slave channels are identical

Encoding

Serialized Bandlet Levels Block

  • 2 bit: Coding mode

Mode 0: direct coding

  • for each untrimmed bandlet
    • 6 bit: Level

Coding mode 1 on master channel: base + direct delta

  • 2 bit: selection of level base table, 3 meaning choose from big list
  • if not choosing from big list
    • 5 bit: number of bandlets 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 bandlet
      • 6 bits of level
    • for each reduced-precision bandlet
      • b bits of level.
  • if choosing from big list
    • 6 bit: level of bandlet 0/1/2 for base
    • 6 bit: selection of level table from big level table list
    • 5 bit: number of bandlets 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 bandlet
      • 4 bits of level delta (offset by 7, no sign expansion)
    • for each low-precision bandlet
      • 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 bandlet:
    • huffman code for delta (gets added to master channel quantizer, 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

  • for each bandlet:
    • huffman code for delta (being a difference to previous delta value except for the first one which is absolute; 6-bit-tree, wrapping)

Coding mode 3 on master channel: base + walking delta

  • 2 bit: selection of level base table, 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 bandlet 0
    • for remaining bandlets
      • 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 bandlet 0/1/2 for base
    • 6 bit: selection of level table from big level table list
    • 4 bit: level delta for bandlet 0
    • for remaining bandlets
      • huffman code representing delta between previous and this level (sign expanded)

Coding mode 3 on slave channel: clone master

  • no data
atrac3p/serialized_bandlet_levels.1258849682.txt.gz ยท Last modified: 2009/11/22 00:28 by megadiscman

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki