AAC Joint coding

1. M/S stereo

M/S stereo 作用于channel pair. channel pair对于listener来说通常具有对称性,即第一个channel和第二个channel相似性较大,例如L/R和Ls/Rs。

如果ms_used flag被拉起来,并且comme_window为1则说明使用了M/S stereo.

在编码端,传送M和S,M=(L+R)/2, S=(L-R)/2.由于L/R相似,则只需要较少的bit来编码S.

在解码端,通过M/S还原出L/R。L=M+S, R=M-S.

在解码CPE时,有两个individual_channel_stream()分别解析出M/S相关数据。

通过huffman decoding,获取到M/S实际所代表的频谱系数后,进行M/S Stereo decoding,其过程如下 :

l_spec/r_spec:作为输入为M/S 频谱系数,作为输出为L/R频谱系数。

 2.Intesity stereo

instereo stereo 原理:

Intensity stereo coding

This form of joint stereo uses a technique known as joint frequency encoding, which functions on the principle of sound localization. Human hearing is predominantly less acute at perceiving the direction of certain audio frequencies. By exploiting this characteristic, intensity stereo coding can reduce the data rate of an audio stream with little or no perceived change in apparent quality.

More specifically, the dominance of inter-aural time differences (ITD) for sound localization by humans is only present for lower frequencies. That leaves inter-aural amplitude differences (IAD) as the dominant location indicator for higher frequencies. The idea of intensity stereo coding is to merge the lower spectrum into just one channel (thus reducing overall differences between channels) and to transmit a little side information about how to pan certain frequency regions to recover the IAD cues.

This type of coding does not perfectly reconstruct the original audio because of the loss of information which results in the simplification of the stereo image and can produce perceptible compression artifacts. However, for very low bit rates this type of coding usually yields a gain in perceived quality of the audio. It is supported by many audio compression formats (including MP3AAC and Vorbis) but not always by every encoder.

如果channel pair的scalefactor band中有使用huffman codebook INTENISTY_HCB和INTENISTY_HCB2,则说明有用到intensity stereo.

在同一个group中的一个scalefactor中,intesity stereo和M/S stereo是互斥的。

“intensity stereo position”描述intensity stereo中的方向信息,表示L和R之间的scaling关系。如果在一个group的scalefactor band中使用了intesnity stereo,那么right channel传送的是intensity stereo position而不是scalefactor.

intensity stereo position计算方法如下:

For each scalefactor band, the energy of the left, right and the sum channel is calculated by summing the squared spectral coefficients, resulting in values El[sfb], Er[sfb], Es[sfb].

NINT ( ) Nearest integer operator. Returns the nearest integer value to the real-valued argument. Half-integer values are rounded away from zero.

intensity stereo position也是在scale_factor_data()中解析出来,也采用差分编码的方式。第一个差分值与0差分,其他与前一个差分。intensity stereo position 与scalefactor使用同一个huffman codebook.

由L还原出R的过程如下:

原文地址:https://www.cnblogs.com/fellow1988/p/7588959.html