MPEG编码原理
先来理解临界频带和掩蔽效应
MPEG编码由两条互相交织的主线构成:子带编码线+心理声学模型线
上面一条线是音频编码的主线部分,下面一条线的本质是为了帮助计算线性量化器的量化比特数。其中,下面一条线最为出彩的部分是心理声学模型的应用,它对去除冗余信息起到了极大的作用。
输入1152个样本,如果音频采样率是48kHz,对应的时间窗口就是24ms,观察一帧图像也就是按照24ms为单位。
反观频域:频率分辨率就是1/24,时间窗口越长(样本数越多),时域分辨率月底,而频域分辨率却越高。增大频域分辨力的同时时域分辨力必然会相应减小。
子带编码线
主要包含量化+编码
子带编码线中的使用滤波器组将原信号按时间窗口划分为32个子带,每个子带中的样值最大值结合量化表得出该子带的比例因子,输入到心理声学模型中。
线性量化器接收心理声学模型线的动态比特分配模块输出的每个子带量化bit分配值
心理声学模型线
心理声学模型
-
输入FFT(频域信号)以及比例因子
-
输出SMR(子带信号掩蔽比)
每个子带一个SMR
动态比特分配
- 输入比特预算和SMR
- 输出每个自带对应的量化数
编码器代码分析
查看命令行参数:
表示这里需要设置输入文件的名称以及输出文件的名称
查看main函数:
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]; // 存放双声道各个子带的比特分配表
static unsigned int scfsi[2][SBLIMIT];
static unsigned int scalar[2][3][SBLIMIT]; // 存放双声道3组12个样值的各个子带的比例因子
static unsigned int 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;
int nch; // 声道数
int error_protection;
static unsigned int crc;
int sb, ch;
int adb; // 比特预算 (i.e., number of bits available)
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;
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]; // exe文件名称
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); // print文件参数到窗口
/* 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) {
/* 从输入的文件读取数据到buffer */
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); // 计算比特预算
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++) /* 36个样值分为3组 */
for (bl = 0; bl < 12; bl++) /* 每组做12次子带分解 */
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
/* 选择心理声学模型,计算SMR */
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); // smr为输出
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); // 比特分配
if (error_protection)
CRC_calc(&frame, bit_alloc, scfsi, &crc);
encode_info(&frame, &bs); // 编码
if (error_protection)
encode_CRC(crc, &bs);
encode_bit_alloc(bit_alloc, &frame, &bs);
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);
}
比例因子提取模块:
void scale_factor_calc (double sb_sample[][3][SCALE_BLOCK][SBLIMIT],
unsigned int scalar[][3][SBLIMIT], int nch,
int sblimit)
{
int k, t;
/* Using '--' loops to avoid possible "cmp value + bne/beq" compiler */
/* inefficiencies. Below loops should compile to "bne/beq" only code */
for (k = nch; k--;)
for (t = 3; t--;) {
int i;
for (i = sblimit; i--;) {//12个一组寻找子带中的最大值
int j;
unsigned int l;
register double temp;
unsigned int scale_fac;
register double cur_max = fabs (sb_sample[k][t][SCALE_BLOCK - 1][i]);
for (j = SCALE_BLOCK - 1; j--;) {
if ((temp = fabs (sb_sample[k][t][j][i])) > cur_max)
cur_max = temp;
}
for (l = 16, scale_fac = 32; l; l >>= 1) {//查找比例因子表中比这个最大值大的最小值作为比例因子
if (cur_max <= multiple[scale_fac])
scale_fac += l;
else
scale_fac -= l;
}
if (cur_max > multiple[scale_fac])
scale_fac--;
scalar[k][t][i] = scale_fac;//得到比例因子
}
}
}
将需要观测的内容输出到TRACE文件,因此在文件开头位置定义宏:#define FRAME_TRACE 1
#if FRAME_TRACE
fprintf(infoFp, "========== 基本信息 ==========\n");
fprintf(infoFp, "输入文件:%s\n", inPath);
fprintf(infoFp, "输出文件:%s\n", outPath);
fprintf(infoFp, "采样频率:%.1f kHz\n", s_freq[header->version][header->sampling_frequency]);
fprintf(infoFp, "输出文件码率:%d kbps\n", bitrate[header->version][header->bitrate_index]);
#endif // FRAME_TRACE
在main函数中添加:
/* 打开文件等步骤略 */
...
#else
scale_factor_calc(*sb_sample, scalar, nch, frame.sblimit); // 计算比例因子
pick_scale(scalar, &frame, max_sc); // pick比例因子
/********** Added by S.Z.Zheng **********/
#if FRAME_TRACE
if (frameNum == 2) {
fprintf(infoFp, "声道数:%d\n", nch);
fprintf(infoFp, "目前观测第 %d 帧\n", frameNum);
fprintf(infoFp, "本帧比特预算:%d bits\n", adb);
fprintf(infoFp, "\n");
/* 比例因子 */
fprintf(infoFp, "========== 比例因子 ==========\n");
for (ch = 0; ch < nch; ch++) // 每个声道单独输出
{
fprintf(infoFp, "------ 声道%2d ------\n", ch + 1);
for (sb = 0; sb < frame.sblimit; sb++) // 每个子带
{
fprintf(infoFp, "子带[%2d]:\t", sb + 1);
for (int gr = 0; gr < 3; gr++) {
fprintf(infoFp, "%2d\t", scalar[ch][gr][sb]);
}
fprintf(infoFp, "\n");
}
}
fprintf(infoFp, "\n");
/* 比特分配表 */
fprintf(infoFp, "========== 比特分配表 ==========\n"); //输出比特分配结果
for (ch = 0; ch < nch; ch++) {
fprintf(infoFp, "------ 声道%2d ------\n", ch + 1); //按声道分配
for (sb = 0; sb < frame.sblimit; sb++) {
fprintf(infoFp, "子带[%2d]:\t%2d\n", sb + 1, bit_alloc[ch][sb]);
}
fprintf(infoFp, "\n");
}
}
#endif // FRAME_TRACE
/********** Addition ended **********/
...
心理声学模型模块
void psycho_0(double SMR[2][SBLIMIT], int nch, unsigned int scalar[2][3][SBLIMIT], FLOAT sfreq) {
int ch, sb, gr;
int minscaleindex[2][SBLIMIT];//较小的指标意味着较大的比例因子
static FLOAT ath_min[SBLIMIT];
int i;
static int init = 0;
if (!init) {
FLOAT freqperline = sfreq / 1024.0;
for (sb = 0; sb < SBLIMIT; sb++) {
ath_min[sb] = 1000; /* set it huge */
}
//在每个子带中找到最小的ATH
for (i = 0; i < 512; i++) {
FLOAT thisfreq = i * freqperline;
FLOAT ath_val = ATH_dB(thisfreq, 0);
if (ath_val < ath_min[i >> 4])
ath_min[i >> 4] = ath_val;
}
init++;
}
//找到这32个子带中最小的比例因子
for (ch = 0; ch < nch; ch++)
for (sb = 0; sb < SBLIMIT; sb++)
minscaleindex[ch][sb] = scalar[ch][0][sb];
for (ch = 0; ch < nch; ch++)
for (gr = 1; gr < 3; gr++)
for (sb = 0; sb < SBLIMIT; sb++)
if (minscaleindex[ch][sb] > scalar[ch][gr][sb])
minscaleindex[ch][sb] = scalar[ch][gr][sb];
for (ch = 0; ch < nch; ch++)
for (sb = 0; sb < SBLIMIT; sb++)
SMR[ch][sb] = 2.0 * (30.0 - minscaleindex[ch][sb]) - ath_min[sb];
}
动态比特分配
void main_bit_allocation(double perm_smr[2][SBLIMIT],
unsigned int scfsi[2][SBLIMIT],
unsigned int bit_alloc[2][SBLIMIT], int* adb,
frame_info* frame, options* glopts)
{
...
//选择动态分配码率模式
if (glopts->vbr == FALSE) {
/* Just do the old bit allocation method */
noisy_sbs = a_bit_allocation(perm_smr, scfsi, bit_alloc, adb, frame);
}
else {
/* do the VBR bit allocation method *//动态分配码率
frame->header->bitrate_index = lower;
*adb = available_bits(frame->header, glopts);
{
int brindex;
int found = FALSE;
/* Work out how many bits are needed for there to be no noise (ie all MNR > 0.0 + VBRLEVEL) */计算如果全部消除噪声情况下所需要的比特数
int req =
VBR_bits_for_nonoise(perm_smr, scfsi, frame, glopts->vbrlevel);
/* Look up this value in the bitrateindextobits table to find what bitrate we should use for
this frame */在bitrateindextobits表中查找对此帧使用的比特率
for (brindex = lower; brindex <= upper; brindex++) {
if (bitrateindextobits[brindex] > req) {
guessindex = brindex;
found = TRUE;
break;
}
}
if (found == FALSE)
guessindex = upper;
}
frame->header->bitrate_index = guessindex;
*adb = available_bits(frame->header, glopts);
/* update the statistics */
vbrstats[frame->header->bitrate_index]++;
if (glopts->verbosity > 2) {
static int count = 0;
int i;
if ((count++ % 1000) == 0) {
for (i = 1; i < 15; i++)
fprintf(stdout, "%4i ", vbrstats[i]);
fprintf(stdout, "\n");
}
if (glopts->verbosity > 5)
fprintf(stdout,
"> bitrate index %2i has %i bits available to encode the %i bits\n",
frame->header->bitrate_index, *adb,
VBR_bits_for_nonoise(perm_smr, scfsi, frame,
glopts->vbrlevel));
}
noisy_sbs =
VBR_bit_allocation(perm_smr, scfsi, bit_alloc, adb, frame, glopts);
}
}
输出输出音频的采样率和目标码率
void print_config(frame_info* frame, int* psy, char* inPath,
char* outPath)
{
frame_header* header = frame->header;
if (glopts.verbosity == 0)
return;
fprintf(stderr, "--------------------------------------------\n");
fprintf(stderr, "Input File : '%s' %.1f kHz\n",
(strcmp(inPath, "-") ? inPath : "stdin"),
s_freq[header->version][header->sampling_frequency]);//输入文件路径和音频采样率
fprintf(stderr, "Output File: '%s'\n",
(strcmp(outPath, "-") ? outPath : "stdout"));//输出文件路径
fprintf(stderr, "%d kbps ", bitrate[header->version][header->bitrate_index]);//音频采样率
fprintf(stderr, "%s ", version_names[header->version]);
if (header->mode != MPG_MD_JOINT_STEREO)
fprintf(stderr, "Layer II %s Psycho model=%d (Mode_Extension=%d)\n",
mode_names[header->mode], *psy, header->mode_ext);//采用的心理声学模型
else
fprintf(stderr, "Layer II %s Psy model %d \n", mode_names[header->mode],
*psy);
fprintf(stderr, "[De-emph:%s\tCopyright:%s\tOriginal:%s\tCRC:%s]\n",
((header->emphasis) ? "On" : "Off"),
((header->copyright) ? "Yes" : "No"),
((header->original) ? "Yes" : "No"),
((header->error_protection) ? "On" : "Off"));
fprintf(stderr, "[Padding:%s\tByte-swap:%s\tChanswap:%s\tDAB:%s]\n",
((glopts.usepadbit) ? "Normal" : "Off"),
((glopts.byteswap) ? "On" : "Off"),
((glopts.channelswap) ? "On" : "Off"),
((glopts.dab) ? "On" : "Off"));
if (glopts.vbr == TRUE)
fprintf(stderr, "VBR Enabled. Using MNR boost of %f\n", glopts.vbrlevel);
fprintf(stderr, "ATH adjustment %f\n", glopts.athlevel);
fprintf(stderr, "--------------------------------------------\n");
}
测试结果
乐音
噪音
噪音+乐音混音