音频编码的原理
MPEG-1 Audio LayerII编码器原理:
多相滤波器组(Polyphase Filter Bank)
将PCM样本变换到32个子带的频域信号,如果输入的采样频率为48kHz,那么子带的频率宽度为48/(2*32)=0.75kHz
使系统具有较高的时间分辨率(短暂冲击信号下,编码的声音信号具有足够高的质量)
比例因子的提取及选择
1.对各个子带每12个样点进行一次比例因子计算,得到12个样点中绝对值的最大值;
2.查比例因子表,若有比这个最大值大的,将其中的最小值作为比例因子,用6bit表示。
- 第2层的一帧对应36个子带样值,是第1层的三倍,原则上要传三个比例因子。每帧中每个子带的三个比例因子被一起考虑,划分成特定的几种模式。根据这些模式,1个、2个或3个比例因子和比例因子选择信息(每子带2比特)一起被传送。如果一个比例因子和下一个只有很小的差别,就只传送大的一个,这种情况对于稳态信号经常出现。
比特分配
对每个子带计算掩蔽-噪声比MNR,是信噪比 SNR–信掩比SMR,
即:MNR = SNR–SMR
算法循环:
◼ 计算NMR = SMR– SNR (dB)
◼ 对最高NMR的子带分配比特,使获益最大的子带的 量化级别增加一级
◼ 重新计算分配了更多比特子带的NMR
直至使整帧和每个子带的总噪声—掩蔽比最小,低频子带分配较多的位数(保护音调和共振峰的结构),高频子带分配较少的位数(摩擦音和类似噪声的声音)。
MPEG-I 心理声学模型
1.听觉系统中存在一个听觉阈值电平,低于这个电平的声音,信号就听不到。
2.听觉掩蔽特性:听觉阈值电平是自适应的,会随听到的不同频率声音而发生变化
临界频带
当噪声掩蔽纯音时,起作用的是以纯音频率为中心频率的一定频带宽度内的噪声频率。如这频带内的噪声功率等于在噪声中刚能听到的该纯音的功率,则这频带就称为听觉临界频带。
临界频带表征了人类最主要的听觉特性,它是在研究纯音对窄带噪声掩蔽量的规律时被发现的,在加宽噪声带宽时,最初是掩蔽量增大,但带宽超过某一定值后,掩蔽量就不再增加,这一带宽就称为临界频带。
计算信号中不可听觉感知的部分:噪声遮蔽效应
计算步骤:
1.将样本变换到频域
2.确定声压级别
3.考虑安静时阈值:也即绝对阈值。在标准中有根据输入PCM信号的采样率编制的“频率、临界频带率和绝对阈值”表。此表为多位科学家经多次心理声学实验所得。
4.将音频信号分解为“乐音”与“非乐音”
因为两种信号的掩蔽能力不同
模型1:根据音频频谱的局部功率最大值确定乐音成分, 局部峰值为乐音,然后将本临界频带内的剩余频谱合在一起,组成一个代表噪声频率(无调成份)
要列出谱线x(k) 的有调和无调,需执行下面三个步骤:
(1)标明局部最大。如果x(k)比相邻的两个谱线都大,则x(k)为局部最大值;
(2)列出有调成份,计算声压级。如果x(k)-x(k+j)>=7dB, 则x(k) 列为有调成份。j 随谱线的位置不同。
(3)列出无调成分,计算功率。在每个临界频带内将所有余留谱线的功率加起来形成临界频带内无调成分的声压级。并列出以下参数:最接近临界频带几何平均值的谱线标记k ,声压级以及无调指示。
5、音调和非音调掩蔽成分的消除
利用标准中给出的绝对阈值消除被掩蔽成分;考虑在每个临界频带内,小于0.5Bark的距离中只保留最高功率的成分
6、单个掩蔽阈值的计算
音调成分和非音调成分单个掩蔽阈值根据标准中给出的算法求得。
7、全局掩蔽阈值的计算
还要考虑别的临界频带的影响。一个掩蔽信号会对其它频带上的信号产生掩蔽效应。这种掩蔽效应称为掩蔽扩散。
8、每个子带的掩蔽阈值
选择出本子带中最小的阈值作为子带阈值
对高频不正确——高频区的临界频带很宽,可能跨越多个子带,从而导致模型1将临界带宽内所有的非音调部分集中为一个代表频率,当一个子带在很宽的频带内却远离代表频率时,无法得到准确的非音调掩蔽值。但计算量低。
9、计算每个子带信号掩蔽比(signal-to-maskratio, SMR)
SMR = 信号能量 / 掩蔽阈值
编码
在调整到固定的码率之前
先确定可用于样值编码的有效比特数
这个数值取决于比例因子、比例因子选择信息、比特分配信息以及辅助数据所需比特数
分析代码
头文件格式
typedef struct
{
int version;//版本(2bit) 00:MPEG 2.5; 01:保留;10:MPEG 2 11:MPEG 1
int lay;//layer(2bit) 00:保留;01:layer Ⅲ; 10:layer Ⅱ; 11:layer Ⅰ
int error_protection;//校验位(1bit) 0:紧跟帧头后有16位即两个字节用作CRC校验
int dab_extension;//
int dab_length;
int bitrate_index;//码率索引(4bit)
int sampling_frequency;//采样频率(2bit)
int padding;//填充空白字
int extension;//版权
int mode;//通道模式:00:分别编码一起播放;01:联合编码;10:分别编码分别播放
int mode_ext;//通道模式扩展
int copyright;//版权标志,0:无版权;1:有版权
int original;//原创,0:原创拷贝;1:原创
int emphasis;//强调(2bit),00:无;01:50/15ms;10:保留;11:CCIT J.17
}
frame_header;//帧头格式
if (frameNum == 55)
{
fprintf(output_txt, "采样频率=%.1f khz\n", s_freq[header.version][header.sampling_frequency]);
fprintf(output_txt, "目标码率=%d kbps\n", bitrate[header.version][header.bitrate_index]);
fprintf(output_txt, "第%d帧:\n", frameNum);
fprintf(output_txt, "分配比特数=%d\n", adb);
fprintf(output_txt, "比例因子:\n");
for (int i = 0; i < nch; i++) {
fprintf(output_txt, "channel[%2d]\n", i + 1);
for (int j = 0; j < frame.sblimit; j++) {
fprintf(output_txt, "subband[%2d]:", j + 1);
for (int k = 0; k < 3; k++) {
fprintf(output_txt, "%2d\t", scalar[i][k][j]);
}
fprintf(output_txt, "\n");
}
}
fprintf(output_txt, "比特分配结果:\n");
for (int i = 0; i < nch; i++) {
fprintf(output_txt, "channel[%2d]\n", i + 1);
for (int j = 0; j < frame.sblimit; j++) {
fprintf(output_txt, "subband[%2d]:%2d\n", j + 1, bit_alloc[i][j]);
}
}
}
fclose(output_txt);
程序框架
/************************************************************************
*
* main
*
* PURPOSE: MPEG II Encoder with
* psychoacoustic models 1 (MUSICAM) and 2 (AT&T)
*利用心理声学模型1和2进行MPEGⅡ编码
* SEMANTICS: One overlapping frame of audio of up to 2 channels are
* processed at a time in the following order:
* (associated routines are in parentheses)
*一次处理最多两个频道的音频重叠帧,顺序如下:
* 1. Filter sliding window of data to get 32 subband
* samples per channel.
* (window_subband,filter_subband)
*对数据的滑动窗口进行滤波,得到每个通道32个子带样本
* 2. If joint stereo mode, combine left and right channels
* for subbands above #jsbound#.
* (combine_LR)
*如果是联合立体声模式,将左声道和右声道jsbound以上的子带结合
* 3. Calculate scalefactors for the frame, and
* also calculate scalefactor select information.
* (*_scale_factor_calc)
*计算帧的比例因子以及比例因子选择信息
* 4. Calculate psychoacoustic masking levels using selected
* psychoacoustic model.
* (psycho_i, psycho_ii)
*使用选择的心理声学模型计算心理声学掩蔽阈值
* 5. Perform iterative bit allocation for subbands with low
* mask_to_noise ratios using masking levels from step 4.
* (*_main_bit_allocation)
*使用步骤4的掩蔽阈值,对具有低掩蔽比的子带执行迭代位分配
* 6. If error protection flag is active, add redundancy for
* error protection.
* (*_CRC_calc)
*若是校验位起作用,添加CRC纠错
* 7. Pack bit allocation, scalefactors, and scalefactor select
*headerrmation onto bitstream.
* (*_encode_bit_alloc,*_encode_scale,transmission_pattern)
*将比特分配,比例因子以及比例因子信息打包到比特流中
* 8. Quantize subbands and pack them into bitstream
* (*_subband_quantization, *_sample_encoding)
*量化子带并将其打包到比特流中
************************************************************************/
主程序
int main (int argc, char **argv)
{
typedef double SBS[2][3][SCALE_BLOCK][SBLIMIT];
SBS *sb_sample;
typedef double JSBS[3][SCALE_BLOCK][SBLIMIT];
JSBS *j_sample;
typedef double IN[2][HAN_SIZE];
IN *win_que;
typedef unsigned int SUB[2][3][SCALE_BLOCK][SBLIMIT];
SUB *subband;
frame_info frame;
frame_header header;
char original_file_name[MAX_NAME_SIZE];
char encoded_file_name[MAX_NAME_SIZE];
short **win_buf;
static short buffer[2][1152];
static unsigned int bit_alloc[2][SBLIMIT], scfsi[2][SBLIMIT];
static unsigned int scalar[2][3][SBLIMIT], j_scale[3][SBLIMIT];
static double smr[2][SBLIMIT], lgmin[2][SBLIMIT], max_sc[2][SBLIMIT];
// FLOAT snr32[32];
short sam[2][1344]; /* was [1056]; */
int model, nch, error_protection;
static unsigned int crc;
int sb, ch, adb;
unsigned long frameBits, sentBits = 0;
unsigned long num_samples;
int lg_frame;
int i;
/* Used to keep the SNR values for the fast/quick psy models */
static FLOAT smrdef[2][32];
static int psycount = 0;
extern int minimum;
time_t start_time, end_time;
int total_time;
//add,将某数据帧输出到txt文件
FILE* output_txt;
output_txt = fopen("information.txt", "w");
if (output_txt == NULL) {
printf("failed to open output.txt");
exit(1);
}
sb_sample = (SBS *) mem_alloc (sizeof (SBS), "sb_sample");
j_sample = (JSBS *) mem_alloc (sizeof (JSBS), "j_sample");
win_que = (IN *) mem_alloc (sizeof (IN), "Win_que");
subband = (SUB *) mem_alloc (sizeof (SUB), "subband");
win_buf = (short **) mem_alloc (sizeof (short *) * 2, "win_buf");
/* clear buffers */
memset ((char *) buffer, 0, sizeof (buffer));
memset ((char *) bit_alloc, 0, sizeof (bit_alloc));
memset ((char *) scalar, 0, sizeof (scalar));
memset ((char *) j_scale, 0, sizeof (j_scale));
memset ((char *) scfsi, 0, sizeof (scfsi));
memset ((char *) smr, 0, sizeof (smr));
memset ((char *) lgmin, 0, sizeof (lgmin));
memset ((char *) max_sc, 0, sizeof (max_sc));
//memset ((char *) snr32, 0, sizeof (snr32));
memset ((char *) sam, 0, sizeof (sam));
global_init ();
header.extension = 0;
frame.header = &header;
frame.tab_num = -1; /* no table loaded */
frame.alloc = NULL;
header.version = MPEG_AUDIO_ID; /* Default: MPEG-1 */
total_time = 0;
time(&start_time);
//以上为初始化
programName = argv[0];
if (argc == 1) /* no command-line args */
short_usage ();
else
parse_args (argc, argv, &frame, &model, &num_samples, original_file_name,
encoded_file_name);//解析命令行参数
print_config (&frame, &model, original_file_name, encoded_file_name);//输出从文件头解析出的信息
/* this will load the alloc tables and do some other stuff */
hdr_to_frps (&frame);
nch = frame.nch;
error_protection = header.error_protection;
//获取每一帧的信息
while (get_audio (musicin, buffer, num_samples, nch, &header) > 0) {
if (glopts.verbosity > 1)
if (++frameNum % 10 == 0)
fprintf (stderr, "[%4u]\r", frameNum);
fflush (stderr);
win_buf[0] = &buffer[0][0];//左声道
win_buf[1] = &buffer[1][0];//右声道
adb = available_bits (&header, &glopts);//bit预算
lg_frame = adb / 8;
if (header.dab_extension) {
/* in 24 kHz we always have 4 bytes */
if (header.sampling_frequency == 1)
header.dab_extension = 4;
/* You must have one frame in memory if you are in DAB mode */
/* in conformity of the norme ETS 300 401 http://www.etsi.org */
/* see bitstream.c */
if (frameNum == 1)
minimum = lg_frame + MINIMUM;
adb -= header.dab_extension * 8 + header.dab_length * 8 + 16;
}
{
int gr, bl, ch;
/* New polyphase filter
Combines windowing and filtering. Ricardo Feb'03 */
for( gr = 0; gr < 3; gr++ )
for ( bl = 0; bl < 12; bl++ )
for ( ch = 0; ch < nch; ch++ )
WindowFilterSubband( &buffer[ch][gr * 12 * 32 + 32 * bl], ch,
&(*sb_sample)[ch][gr][bl][0] );//多项滤波器组
}
#ifdef REFERENCECODE
{
/* Old code. left here for reference */
int gr, bl, ch;
for (gr = 0; gr < 3; gr++)
for (bl = 0; bl < SCALE_BLOCK; bl++)
for (ch = 0; ch < nch; ch++) {
window_subband (&win_buf[ch], &(*win_que)[ch][0], ch);
filter_subband (&(*win_que)[ch][0], &(*sb_sample)[ch][gr][bl][0]);
}
}
#endif
#ifdef NEWENCODE
scalefactor_calc_new(*sb_sample, scalar, nch, frame.sblimit);
find_sf_max (scalar, &frame, max_sc);
if (frame.actual_mode == MPG_MD_JOINT_STEREO) {
/* this way we calculate more mono than we need */
/* but it is cheap */
combine_LR_new (*sb_sample, *j_sample, frame.sblimit);
scalefactor_calc_new (j_sample, &j_scale, 1, frame.sblimit);
}
#else
scale_factor_calc (*sb_sample, scalar, nch, frame.sblimit);//计算比例因子
pick_scale (scalar, &frame, max_sc);
if (frame.actual_mode == MPG_MD_JOINT_STEREO) {
/* this way we calculate more mono than we need */
/* but it is cheap */
combine_LR (*sb_sample, *j_sample, frame.sblimit);//结合左右声道
scale_factor_calc (j_sample, &j_scale, 1, frame.sblimit);//计算比例因子选择信息
}
#endif
if ((glopts.quickmode == TRUE) && (++psycount % glopts.quickcount != 0)) {
/* We're using quick mode, so we're only calculating the model every
'quickcount' frames. Otherwise, just copy the old ones across */
for (ch = 0; ch < nch; ch++) {
for (sb = 0; sb < SBLIMIT; sb++)
smr[ch][sb] = smrdef[ch][sb];
}
} else {
/* calculate the psymodel */
//根据心理声学模型计算掩蔽阈值
switch (model) {
case -1:
psycho_n1 (smr, nch);
break;
case 0: /* Psy Model A */
psycho_0 (smr, nch, scalar, (FLOAT) s_freq[header.version][header.sampling_frequency] * 1000);
break;
case 1:
psycho_1 (buffer, max_sc, smr, &frame);
break;
case 2:
for (ch = 0; ch < nch; ch++) {
psycho_2 (&buffer[ch][0], &sam[ch][0], ch, &smr[ch][0], //snr32,
(FLOAT) s_freq[header.version][header.sampling_frequency] *
1000, &glopts);
}
break;
case 3:
/* Modified psy model 1 */
psycho_3 (buffer, max_sc, smr, &frame, &glopts);
break;
case 4:
/* Modified Psycho Model 2 */
for (ch = 0; ch < nch; ch++) {
psycho_4 (&buffer[ch][0], &sam[ch][0], ch, &smr[ch][0], // snr32,
(FLOAT) s_freq[header.version][header.sampling_frequency] *
1000, &glopts);
}
break;
case 5:
/* Model 5 comparse model 1 and 3 */
psycho_1 (buffer, max_sc, smr, &frame);
fprintf(stdout,"1 ");
smr_dump(smr,nch);
psycho_3 (buffer, max_sc, smr, &frame, &glopts);
fprintf(stdout,"3 ");
smr_dump(smr,nch);
break;
case 6:
/* Model 6 compares model 2 and 4 */
for (ch = 0; ch < nch; ch++)
psycho_2 (&buffer[ch][0], &sam[ch][0], ch, &smr[ch][0], //snr32,
(FLOAT) s_freq[header.version][header.sampling_frequency] *
1000, &glopts);
fprintf(stdout,"2 ");
smr_dump(smr,nch);
for (ch = 0; ch < nch; ch++)
psycho_4 (&buffer[ch][0], &sam[ch][0], ch, &smr[ch][0], // snr32,
(FLOAT) s_freq[header.version][header.sampling_frequency] *
1000, &glopts);
fprintf(stdout,"4 ");
smr_dump(smr,nch);
break;
case 7:
fprintf(stdout,"Frame: %i\n",frameNum);
/* Dump the SMRs for all models */
psycho_1 (buffer, max_sc, smr, &frame);
fprintf(stdout,"1");
smr_dump(smr, nch);
psycho_3 (buffer, max_sc, smr, &frame, &glopts);
fprintf(stdout,"3");
smr_dump(smr,nch);
for (ch = 0; ch < nch; ch++)
psycho_2 (&buffer[ch][0], &sam[ch][0], ch, &smr[ch][0], //snr32,
(FLOAT) s_freq[header.version][header.sampling_frequency] *
1000, &glopts);
fprintf(stdout,"2");
smr_dump(smr,nch);
for (ch = 0; ch < nch; ch++)
psycho_4 (&buffer[ch][0], &sam[ch][0], ch, &smr[ch][0], // snr32,
(FLOAT) s_freq[header.version][header.sampling_frequency] *
1000, &glopts);
fprintf(stdout,"4");
smr_dump(smr,nch);
break;
case 8:
/* Compare 0 and 4 */
psycho_n1 (smr, nch);
fprintf(stdout,"0");
smr_dump(smr,nch);
for (ch = 0; ch < nch; ch++)
psycho_4 (&buffer[ch][0], &sam[ch][0], ch, &smr[ch][0], // snr32,
(FLOAT) s_freq[header.version][header.sampling_frequency] *
1000, &glopts);
fprintf(stdout,"4");
smr_dump(smr,nch);
break;
default:
fprintf (stderr, "Invalid psy model specification: %i\n", model);
exit (0);
}
if (glopts.quickmode == TRUE)
/* copy the smr values and reuse them later */
for (ch = 0; ch < nch; ch++) {
for (sb = 0; sb < SBLIMIT; sb++)
smrdef[ch][sb] = smr[ch][sb];
}
if (glopts.verbosity > 4)
smr_dump(smr, nch);
}
#ifdef NEWENCODE
sf_transmission_pattern (scalar, scfsi, &frame);
main_bit_allocation_new (smr, scfsi, bit_alloc, &adb, &frame, &glopts);
//main_bit_allocation (smr, scfsi, bit_alloc, &adb, &frame, &glopts);
if (error_protection)
CRC_calc (&frame, bit_alloc, scfsi, &crc);
write_header (&frame, &bs);
//encode_info (&frame, &bs);
if (error_protection)
putbits (&bs, crc, 16);
write_bit_alloc (bit_alloc, &frame, &bs);
//encode_bit_alloc (bit_alloc, &frame, &bs);
write_scalefactors(bit_alloc, scfsi, scalar, &frame, &bs);
//encode_scale (bit_alloc, scfsi, scalar, &frame, &bs);
subband_quantization_new (scalar, *sb_sample, j_scale, *j_sample, bit_alloc,
*subband, &frame);
//subband_quantization (scalar, *sb_sample, j_scale, *j_sample, bit_alloc,
// *subband, &frame);
write_samples_new(*subband, bit_alloc, &frame, &bs);
//sample_encoding (*subband, bit_alloc, &frame, &bs);
#else
transmission_pattern (scalar, scfsi, &frame);
main_bit_allocation (smr, scfsi, bit_alloc, &adb, &frame, &glopts);//进行比特分配
//add
if (frameNum == 1)//输出第1帧的比特分配结果
{
fprintf(output_txt, "采样频率=%.1f khz\n", s_freq[frame.header->version][frame.header->sampling_frequency]);
fprintf(output_txt, "目标码率=%d kbps\n", bitrate[header.version][header.bitrate_index]);
fprintf(output_txt, "第%d帧:\n", frameNum);
fprintf(output_txt, "分配比特数=%d\n", adb);
fprintf(output_txt, "比例因子:\n");
for (int i = 0; i < nch; i++) {
fprintf(output_txt, "channel[%2d]\n", i + 1);
for (int j = 0; j < frame.sblimit; j++) {
fprintf(output_txt, "subband[%2d]:", j + 1);
for (int k = 0; k < 3; k++) {
fprintf(output_txt, "%2d\t", scalar[i][k][j]);
}
fprintf(output_txt, "\n");
}
}
fprintf(output_txt, "比特分配结果:\n");
for (int i = 0; i < nch; i++) {
fprintf(output_txt, "channel[%2d]\n", i + 1);
for (int j = 0; j < frame.sblimit; j++) {
fprintf(output_txt, "subband[%2d]:%2d\n", j + 1, bit_alloc[i][j]);
}
}
}
fclose(output_txt);
//end add
if (error_protection)
CRC_calc (&frame, bit_alloc, scfsi, &crc);//如果需要,添加CRC纠错
encode_info (&frame, &bs);
if (error_protection)
encode_CRC (crc, &bs);
encode_bit_alloc (bit_alloc, &frame, &bs);//将bit分配打包到比特流中
encode_scale (bit_alloc, scfsi, scalar, &frame, &bs);//将比例因子打包到比特流中
subband_quantization (scalar, *sb_sample, j_scale, *j_sample, bit_alloc,
*subband, &frame);//量化子带
sample_encoding (*subband, bit_alloc, &frame, &bs);//将子带打包到比特流中
#endif
/* If not all the bits were used, write out a stack of zeros */
for (i = 0; i < adb; i++)
put1bit (&bs, 0);
if (header.dab_extension) {
/* Reserve some bytes for X-PAD in DAB mode */
putbits (&bs, 0, header.dab_length * 8);
for (i = header.dab_extension - 1; i >= 0; i--) {
CRC_calcDAB (&frame, bit_alloc, scfsi, scalar, &crc, i);
/* this crc is for the previous frame in DAB mode */
if (bs.buf_byte_idx + lg_frame < bs.buf_size)
bs.buf[bs.buf_byte_idx + lg_frame] = crc;
/* reserved 2 bytes for F-PAD in DAB mode */
putbits (&bs, crc, 8);
}
putbits (&bs, 0, 16);
}
frameBits = sstell (&bs) - sentBits;
if (frameBits % 8) { /* a program failure */
fprintf (stderr, "Sent %ld bits = %ld slots plus %ld\n", frameBits,
frameBits / 8, frameBits % 8);
fprintf (stderr, "If you are reading this, the program is broken\n");
fprintf (stderr, "email [mfc at NOTplanckenerg.com] without the NOT\n");
fprintf (stderr, "with the command line arguments and other info\n");
exit (0);
}
sentBits += frameBits;
}
close_bit_stream_w (&bs);
if ((glopts.verbosity > 1) && (glopts.vbr == TRUE)) {
int i;
#ifdef NEWENCODE
extern int vbrstats_new[15];
#else
extern int vbrstats[15];
#endif
fprintf (stdout, "VBR stats:\n");
for (i = 1; i < 15; i++)
fprintf (stdout, "%4i ", bitrate[header.version][i]);
fprintf (stdout, "\n");
for (i = 1; i < 15; i++)
#ifdef NEWENCODE
fprintf (stdout,"%4i ",vbrstats_new[i]);
#else
fprintf (stdout, "%4i ", vbrstats[i]);
#endif
fprintf (stdout, "\n");
}
fprintf (stderr,
"Avg slots/frame = %.3f; b/smp = %.2f; bitrate = %.3f kbps\n",
(FLOAT) sentBits / (frameNum * 8),
(FLOAT) sentBits / (frameNum * 1152),
(FLOAT) sentBits / (frameNum * 1152) *
s_freq[header.version][header.sampling_frequency]);
if (fclose (musicin) != 0) {
fprintf (stderr, "Could not close \"%s\".\n", original_file_name);
exit (2);
}
fprintf (stderr, "\nDone\n");
time(&end_time);
total_time = end_time - start_time;
printf("total time is %d\n", total_time);
exit (0);
}
1.音乐
采样频率=44.1 khz
目标码率=192 kbps
第1帧:
分配比特数=8
比例因子:
channel[ 1]
subband[ 1]:11 11 11
subband[ 2]:12 12 12
subband[ 3]:21 18 18
subband[ 4]:25 25 25
subband[ 5]:29 29 29
subband[ 6]:28 23 26
subband[ 7]:22 22 22
subband[ 8]:21 21 21
subband[ 9]:32 28 28
subband[10]:34 30 30
subband[11]:31 31 31
subband[12]:30 30 26
subband[13]:27 24 24
subband[14]:23 23 23
subband[15]:26 22 25
subband[16]:30 25 25
subband[17]:26 26 26
subband[18]:29 29 29
subband[19]:31 31 30
subband[20]:26 26 26
subband[21]:34 34 31
subband[22]:34 31 31
subband[23]:38 38 38
subband[24]:39 50 50
subband[25]:43 51 57
subband[26]:41 54 54
subband[27]:45 52 52
subband[28]:42 54 54
subband[29]:44 52 52
subband[30]:43 52 52
比特分配结果:
channel[ 1]
subband[ 1]: 8
subband[ 2]: 8
subband[ 3]: 6
subband[ 4]: 8
subband[ 5]: 7
subband[ 6]: 8
subband[ 7]: 8
subband[ 8]: 6
subband[ 9]: 5
subband[10]: 6
subband[11]: 6
subband[12]: 7
subband[13]: 6
subband[14]: 6
subband[15]: 6
subband[16]: 5
subband[17]: 5
subband[18]: 5
subband[19]: 4
subband[20]: 6
subband[21]: 3
subband[22]: 3
subband[23]: 0
subband[24]: 0
subband[25]: 0
subband[26]: 0
subband[27]: 0
subband[28]: 0
subband[29]: 0
subband[30]: 0
2.噪音
采样频率=22.1 khz
目标码率=96 kbps
第1帧:
分配比特数=17
比例因子:
channel[ 1]
subband[ 1]:63 32 19
subband[ 2]:63 28 28
subband[ 3]:63 33 29
subband[ 4]:63 37 31
subband[ 5]:63 39 30
subband[ 6]:63 39 32
subband[ 7]:63 38 33
subband[ 8]:63 38 34
subband[ 9]:63 42 36
subband[10]:63 44 34
subband[11]:63 41 35
subband[12]:63 39 36
subband[13]:63 40 36
subband[14]:63 43 35
subband[15]:63 42 35
subband[16]:63 41 37
subband[17]:63 38 38
subband[18]:63 42 38
subband[19]:63 44 36
subband[20]:63 44 36
subband[21]:63 41 38
subband[22]:63 42 39
subband[23]:63 45 39
subband[24]:63 48 36
subband[25]:63 44 38
subband[26]:63 44 38
subband[27]:63 43 38
subband[28]:63 49 40
subband[29]:63 51 39
subband[30]:63 49 40
比特分配结果:
channel[ 1]
subband[ 1]: 8
subband[ 2]: 7
subband[ 3]: 6
subband[ 4]: 6
subband[ 5]: 5
subband[ 6]: 5
subband[ 7]: 5
subband[ 8]: 5
subband[ 9]: 4
subband[10]: 5
subband[11]: 4
subband[12]: 3
subband[13]: 3
subband[14]: 3
subband[15]: 3
subband[16]: 3
subband[17]: 3
subband[18]: 3
subband[19]: 3
subband[20]: 3
subband[21]: 3
subband[22]: 3
subband[23]: 3
subband[24]: 3
subband[25]: 3
subband[26]: 3
subband[27]: 3
subband[28]: 3
subband[29]: 3
subband[30]: 3
3.乐音加噪声
采样频率=44.1 khz
目标码率=192 kbps
第1帧:
分配比特数=2
比例因子:
channel[ 1]
subband[ 1]: 9 3 10
subband[ 2]: 8 8 8
subband[ 3]: 7 7 7
subband[ 4]: 9 9 9
subband[ 5]: 9 9 9
subband[ 6]:10 10 10
subband[ 7]:12 9 9
subband[ 8]:13 9 9
subband[ 9]:13 9 9
subband[10]:16 11 11
subband[11]:16 11 11
subband[12]:10 10 10
subband[13]:17 10 10
subband[14]:18 9 9
subband[15]:18 8 8
subband[16]:14 10 10
subband[17]:15 9 9
subband[18]:15 8 8
subband[19]:20 10 10
subband[20]:18 9 9
subband[21]:15 9 9
subband[22]:14 10 10
subband[23]:17 9 9
subband[24]:20 10 10
subband[25]:20 10 10
subband[26]:11 11 11
subband[27]:16 10 10
subband[28]:16 10 10
subband[29]:16 9 9
subband[30]:12 12 9
channel[ 2]
subband[ 1]:10 4 8
subband[ 2]: 9 9 9
subband[ 3]: 9 9 9
subband[ 4]: 9 9 9
subband[ 5]:10 10 10
subband[ 6]:10 10 10
subband[ 7]:17 8 11
subband[ 8]:13 7 7
subband[ 9]:10 10 10
subband[10]:15 9 9
subband[11]:23 12 9
subband[12]:13 9 9
subband[13]:16 10 10
subband[14]:13 9 9
subband[15]:19 10 10
subband[16]:14 10 10
subband[17]:14 8 8
subband[18]:15 10 10
subband[19]:16 10 10
subband[20]:19 11 8
subband[21]:14 10 10
subband[22]:15 10 10
subband[23]:18 9 9
subband[24]:14 10 10
subband[25]:20 8 8
subband[26]:15 11 8
subband[27]:16 9 9
subband[28]: 9 9 9
subband[29]:15 8 8
subband[30]:22 10 10
比特分配结果:
channel[ 1]
subband[ 1]: 5
subband[ 2]: 3
subband[ 3]: 3
subband[ 4]: 4
subband[ 5]: 4
subband[ 6]: 3
subband[ 7]: 4
subband[ 8]: 3
subband[ 9]: 3
subband[10]: 3
subband[11]: 3
subband[12]: 4
subband[13]: 2
subband[14]: 3
subband[15]: 3
subband[16]: 1
subband[17]: 3
subband[18]: 3
subband[19]: 2
subband[20]: 2
subband[21]: 1
subband[22]: 1
subband[23]: 2
subband[24]: 1
subband[25]: 1
subband[26]: 1
subband[27]: 1
subband[28]: 1
subband[29]: 1
subband[30]: 1
channel[ 2]
subband[ 1]: 5
subband[ 2]: 4
subband[ 3]: 3
subband[ 4]: 4
subband[ 5]: 4
subband[ 6]: 4
subband[ 7]: 4
subband[ 8]: 5
subband[ 9]: 3
subband[10]: 3
subband[11]: 3
subband[12]: 4
subband[13]: 2
subband[14]: 3
subband[15]: 3
subband[16]: 1
subband[17]: 3
subband[18]: 3
subband[19]: 2
subband[20]: 2
subband[21]: 1
subband[22]: 1
subband[23]: 2
subband[24]: 1
subband[25]: 1
subband[26]: 1
subband[27]: 1
subband[28]: 1
subband[29]: 1
subband[30]: 1