⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layer2.h

📁 mpeg层3音频编码程序
💻 H
字号:
/* this file is a part of amp software, (C) tomislav uzelac 1996,1997
*/
/* layer2.h
 * Tomislav Uzelac - cca. Feb 1996
 */


extern int layer2_frame(struct AUDIO_HEADER *header,int cnt);

#ifdef LAYER2

int layer2_frame(struct AUDIO_HEADER *header,int cnt);
float requantize_sample(unsigned short s4,unsigned short nlevels,float c,float d,float factor);
void convert_samplecode(unsigned int samplecode,unsigned int nlevels,unsigned short* sb_sample_buf);

char t_nbal0[27]={4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2};
char t_nbal1[30]={4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2};
char t_nbal2[8] ={4,4,3,3,3,3,3,3};
char t_nbal3[12]={4,4,3,3,3,3,3,3,3,3,3,3};
char t_nbalMPG2[30]={4,4,4,4,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};

char t_alloc0[27][16] = {	/* table B.2a ISO/IEC 11172-3 */
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,17},
{0,1,2,17},
{0,1,2,17},
{0,1,2,17}};

char t_alloc1[30][16] = {        /* table B.2b ISO/IEC 11172-3 */
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
{0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,3,4,5,6,17},
{0,1,2,17},
{0,1,2,17},
{0,1,2,17},
{0,1,2,17},
{0,1,2,17},
{0,1,2,17},
{0,1,2,17}};

char t_alloc2[8][16] = {       /* table B.2c ISO/IEC 11172-3 */
{0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16},
{0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127}};

char t_alloc3[12][16] = {       /* table B.2d ISO/IEC 11172-3 */
{0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16},
{0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127},
{0,1,2,4,5,6,7,127}};

char t_allocMPG2[30][16] = {	/* table B.1. ISO/IEC 13818-3 */
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
{0,1,2,4,5,6,7,8},
{0,1,2,4,5,6,7,8},
{0,1,2,4,5,6,7,8},
{0,1,2,4,5,6,7,8},
{0,1,2,4,5,6,7,8},
{0,1,2,4,5,6,7,8},
{0,1,2,4,5,6,7,8},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4},
{0,1,2,4}};

double t_scalefactor[64] = {
2.00000000000000, 1.58740105196820, 1.25992104989487,
1.00000000000000, 0.79370052598410, 0.62996052494744, 0.50000000000000,
0.39685026299205, 0.31498026247372, 0.25000000000000, 0.19842513149602,
0.15749013123686, 0.12500000000000, 0.09921256574801, 0.07874506561843,
0.06250000000000, 0.04960628287401, 0.03937253280921, 0.03125000000000,
0.02480314143700, 0.01968626640461, 0.01562500000000, 0.01240157071850,
0.00984313320230, 0.00781250000000, 0.00620078535925, 0.00492156660115,
0.00390625000000, 0.00310039267963, 0.00246078330058, 0.00195312500000,
0.00155019633981, 0.00123039165029, 0.00097656250000, 0.00077509816991,
0.00061519582514, 0.00048828125000, 0.00038754908495, 0.00030759791257,
0.00024414062500, 0.00019377454248, 0.00015379895629, 0.00012207031250,
0.00009688727124, 0.00007689947814, 0.00006103515625, 0.00004844363562,
0.00003844973907, 0.00003051757813, 0.00002422181781, 0.00001922486954,
0.00001525878906, 0.00001211090890, 0.00000961243477, 0.00000762939453,
0.00000605545445, 0.00000480621738, 0.00000381469727, 0.00000302772723,
0.00000240310869, 0.00000190734863, 0.00000151386361, 0.00000120155435,
1E-20};

double t_c[18] = { 0,
		 1.33333333333, 1.60000000000, 1.14285714286,
                 1.77777777777, 1.06666666666, 1.03225806452,
                 1.01587301587, 1.00787401575, 1.00392156863,
                 1.00195694716, 1.00097751711, 1.00048851979,
                 1.00024420024, 1.00012208522, 1.00006103888,
                 1.00003051851, 1.00001525902 };
                 
double t_d[18] = {0,
   0.500000000,  0.500000000,  0.250000000,  0.500000000,
   0.125000000,  0.062500000,  0.031250000,  0.015625000,
   0.007812500,  0.003906250,  0.001953125,  0.0009765625,
   0.00048828125,0.00024414063,0.00012207031,
   0.00006103516,0.00003051758 };

float t_dd[18]={ -1, -0.5, -0.5, -0.75, -0.5, -0.875, -0.9375, -0.96875, -0.984375,
-0.992188, -0.996094, -0.998047, -0.999023, -0.999512, -0.999756, -0.999878, -0.999939,
-0.999969};
   
char t_grouping[18]={0,3,5,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0};

/*
int t_nlevels[18] = {0,3,5,7,9,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};
*/
int t_nlevels[18] = {0,3,7,7,15,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};


float t_nli[18]={ 0, 0.5, 0.25, 0.25, 0.125, 0.125, 0.0625, 0.03125, 0.015625, 0.0078125, 0.00390625,
0.00195313, 0.000976563, 0.000488281, 0.000244141, 0.00012207, 6.10352e-05, 3.05176e-05}; 

int t_bpc[18] = {0,5,7,3,10,4,5,6,7,8,9,10,11,12,13,14,15,16};

#endif /* LAYER2 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -