===== Atrac3+ substream bit stream ===== The bytes of the ATRAC3+ frame make up a bitstream. The most significant bit of the input bytes is consumed first. In multi-bit-fields, also the first of the bits that make up the field is the most significant one. The substream data first contains the number of [[ATRAC spectrum anatomy|quantization units]] that are present in this block. For some reason, the total number of quantization units should not be 29, 30 or 31. The maximum number of quantization units, 32, is fine, though. For the quantization units, the quantization precisions are encoded. The precision may be 0, meaning that no data for that quantization unit is present. For each quantization unit (regardless of it's precision being zero or not, a level is stored); for units with non-zero precision, tree-choice info and encoded spectral coefficients are stored; for all dither groups touched by the present quantization units, dither info might be stored. For each band, joint stereo info, MDCT window shape and and enveloping info is stored next, followed by the non-MDCT encoding tonal component data and finally info about extra dithering noise to be added after synthesis. ===== Encoding ===== * 5 bits: Count of quantization units in this block-1 (should not be 28, 29 or 30). * 1 bit: Mute if set (but frequency-space decoding is still done) * For each channel: [[serialized quantization unit quantization precisions]] * If there are quantization units with non-zero quantization precision * For each channel: [[serialized quantization unit levels]] * 1 bit: Enable full spectral data tree access (if clear, only most common trees are accessible) * For each channel: [[serialized quantization unit tree choice info]] * For each channel: [[serialized quantization unit spectral data and dither noise levels]] * On 2-channel substreams only * For each channel: [[serialized band joint stereo info]] * For each channel: [[serialized window shape info]] * For each channel: [[serialized band envelopes]] * 1 bit: Enable tone data. If that bit is set: * [[serialized tone data]] * 1 bit: enable time domain dither * if enabled: 4 bits noise level * if enabled: 4 bits noise phase