User Tools

Site Tools


atrac3p:serialized_tone_data

This is an old revision of the document!


Serialized tone data

Tonal components are sine-shaped signals that get added after IMDCT on decoding.

Tonal components have their own stereo processing which is not connected to the residual spectrum stereo processing, this is the cause that the serialized tone data has a header that is not replicated per channel. The first bit in the tone info header defines the dynamic range. In the high-dynamic-range mode, the levels for each tone are chosen on a 64 step exponential amplitude scale, while in low-dynamic range, only an overall level is chosen on the exponential scale, and the individual tones have the level chosen on a 16-level linear scale.

The number of bands with tones encoded is independent of the number of bands with residual spectral data and given after the choice of dynamic range. For stereo streams, flags for each band follow, namely whether tones in these band are shared between channels, whether master is left or right and whether the right channel should receive a 180° phase shift.

Finally, for each channel the tone info is stored. For the master channel, tone info for all bands is stored while for the slave channel, tone info for the shared bands is missing, as it was already encoded for the master channel. Each band with at least one tone has one common optional start and optional end time for all tones in that band, while each individual tone has pitch, level and phase info.

Start/End info

For the master channel, start/end info is always directly encoded: Both the start and end time are encoded as one bit indicating whether there is a star or end time followed by 5 bits for the start/end time. On the slave channel, there is one mode bit indicating whether the start/end info is present for the slave just as it is for the master channel, or the master channel info should be copied to the slave channel.

Tone count info

For each band, the count of tones in this band is encoded in one out of two modes for the master channel, or one out of four modes for the slave channel. The sum of all tone counts (shared master/slave bands have their tones counted only once) should not be bigger than 48.

Encoding Modes

0: plain

For each band with tones, a four-bit number tells the number of tones in that band.

1: variable-length encoded

For each band with tones, a VLC symbol is stored giving the number of tones in that band (maximum is 7 in this case).

2 (only in slave channel): variable-length encoded difference to master channel

For each band with tones, a VLC symbol is stored telling the difference of the tone count between master and slave channel. The difference is a signed 3-bit numbers, while the tone count is 4 bits, and wraparound occurs after 15

3 (only in slave channel): clone master channel info

No data is stored in this case.

Tone pitches

For each tone, the pitch is stored, using near-plain encoding or difference-to-master encoding (obviously available only on the slave channel)

Encoding Modes

0: near-plain

If there is more than one tone in the band, a bit flag tells whether the tones are stored in ascending or descending pitch order. (for only one tone, order obviously doesn't matter). Tone pitches are numbers between 0 and 1023, duplicates are encodable (i.e. two times the same pitch in succession). The first tone is always encoded using ten bits. In ascending mode: each further tone is encoded with a bit count depending on the pitch of the last tone. If the previous tone was below 512, 10 bits are used. If the tone was above or equal to 512, but below 768, 9 bits are used, and 512 is added to the number to obtain the pitch, and so on, up 2 bits if the previous tone was between 1020 (inclusive) and 1022 (exclusive), where 1020 is added to obtain the pitch and finally 1 bit if the previous tone was 1022 or 1023 using a base of 1023. Following the pattern a zero-bit encoding would be expected if the last tone was 1023; this is not the case.

In descending mode: Tones are encoded with 10 bits if the previous tone has a pitch above or equal to 512, encoded with 9 bits if the previous tone has a pitch above or equal to 256 and so on, up to a 1 bit encoding if the previous tone had a pitch of one or zero. The pitches are then reversed (to re-obtain an increasing order) before they are stored into the tones. That means even in decreasing-pitch storage orders, the tone with the lowest index is the one with the lowest pitch.

1: variable-length-encoded difference-to-master

The slave pitch is encoded as difference to the master pitch with the same tone index (if present) or the master tone with the highest index that is present, or, if there are no master tones at all, as difference to 0. Difference application wraps at 1024.

Tone Linking

complicated stuff trying to associated tones between master and slave channel

Tone Levels

depending on high/low dynamic range mode different, also complicated

Tone Phase

The phase is encoded as plain 5-bit-number for each tone.

atrac3p/serialized_tone_data.1279821120.txt.gz · Last modified: 2010/07/22 17:52 by megadiscman

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki