FLAC__CHANNEL_ASSIGNMENT_MID_SIDE 中第二个通道的每个样本的附加位

Additional bit per sample for 2nd channel in FLAC__CHANNEL_ASSIGNMENT_MID_SIDE

我正在尝试理解 libFLAC

的以下部分 (link)
case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE:
                FLAC__ASSERT(decoder->private_->frame.header.channels == 2);
                if(channel == 1)
                    bps++;

与第一个通道相比,为什么第二个通道的预热样本以每样本额外的比特数存储?另外,我在 format spec 中没有找到任何提及 - 我是否遗漏了什么?

我也在hydrogenaudio上问过,那里得到了答案:https://hydrogenaud.io/index.php?topic=121900.0

来自 spec(不是 xiph.org 上的那个):

The side channel needs one extra bit of bit depth as the subtraction can produce sample values twice as large as the maximum possible in any given bit depth. The mid channel in mid-side stereo does not need one extra bit, as it is shifted left one bit. The left shift of the mid channel does not lead to non-lossless behavior, because an uneven sample in the mid subframe must always be accompanied by a corresponding uneven sample in the side subframe, which means the lost least significant bit can be restored by taking it from the sample in the side subframe.

来自用户 ktf:

Simply put: if you have 8-bit audio, and the left sample is +127 and the right sample -128, the diff channel becomes 127 - -128 = 255. So, you need 9 bits to code for that number.