mp3audio.h
来自「ESS3890+SL原代码(1*16内存)」· C头文件 代码 · 共 1,156 行 · 第 1/5 页
H
1,156 行
/* Copyright 1999, ESS Technology, Inc. *//* SCCSID @(#)mp3audio.h 4.6 03/16/04 *//* * $Log$ */#ifndef __MP3AUDIO_H__#define __MP3AUDIO_H__#include "common.h"/* General Definitions */#define SBLIMIT 32#define SSLIMIT 18#define CRC16_POLYNOMIAL 0x8005/* MPEG Header Definitions - Mode Values */#define MPG_MD_STEREO 0#define MPG_MD_JOINT_STEREO 1#define MPG_MD_DUAL_CHANNEL 2#define MPG_MD_MONO 3/* channel selection */#define LEFT_LEFT 0#define RIGHT_RIGHT 1#define LEFT_RIGHT 2 /* stereo */#define LEFT_RIGHT_AVG 3 /* average both channels */#define MIN(A, B) ((A) < (B) ? (A) : (B))/************************************************************************ Global Type Definitions***********************************************************************//* Layer III side information. */typedef struct { unsigned main_data_begin; unsigned private_bits; struct { unsigned scfsi[4]; struct gr_info_s { unsigned part2_3_length; unsigned big_values; unsigned global_gain; unsigned scalefac_compress; unsigned window_switching_flag; unsigned block_type; unsigned mixed_block_flag; unsigned table_select[3]; unsigned subblock_gain[3]; unsigned maxband[3]; unsigned maxbandl; unsigned maxb; unsigned region0_count; unsigned region1_count; unsigned preflag; unsigned scalefac_scale; unsigned count1table_select; } gr[2]; } ch[2];} side_info_t;/* Layer III scale factors. */typedef struct { int l[23]; int s[3][13];} gr_t;typedef struct { gr_t gr[2]; /* two graunles */} scalefacs_t[2]; /* [ch] *//*********************************************************************** * Global Variable External Declarations ***********************************************************************/#ifdef MP3_STUD/* nothing */#else#if defined(XSEG4_ON_FLY) || defined(MKTABLE)ushort sample_rate[6] = {44100, 48000, 32000, 22050, 24000, 16000};uchar lsfbtable[5] = {0, 6, 11, 16, 21};uchar ssfbtable[3] = {0, 6, 12}; uchar pretab1[22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0};uchar pretab2[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};uchar cos36_index[12] = { 0,4,6,2,16,12,10,14,8,8,8,8};uchar cos9_index[3][8] = { {2,4,6,8,10,12,14,16}, {10,24,6,4,14,22,2,8}, {14,20,6,24,2,12,10,4}};uchar slen[2][16] = { {0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4}, {0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3}};uchar win_index[48] = { 54,56,58,60,52,50,48,46,64,66,68,70, 42,40,38,36,62,62,62,62,44,44,44,44, 18,20,22,24,16,14,12,10,28,30,32,34, 6, 4, 2, 0,26,26,26,26, 8, 8, 8, 8};/* 32bits each, most significant first. */ushort COS6[4] = { 0x376c, 0xf5d0, 0x2000, 0x0000};ushort COS9[26] = { 0x4000, 0x0000, 0x3f07, 0x1719, 0x3c23, 0xec84, 0x376c, 0xf5d0, 0x3106, 0xdf45, 0x2923, 0x6ea4, 0x2000, 0x0000, 0x15e3, 0xa874, 0x0b1d, 0x0d3f, 0xc3dc, 0x137c, 0xcef9, 0x20bb, 0xe000, 0x0000, 0xf4e2, 0xf2c1};ushort COS12[6] = { 0x1090, 0x7dc1,0x16a0, 0x9e66,0x3dd1, 0xba8e};ushort COS36[18] = { 0x0403, 0xe958, 0x0424, 0x1f70, 0x0469, 0xdbe6, 0x04e2, 0x12bb, 0x05a8, 0x2799, 0x06f9, 0x4a1d, 0x0976, 0xfd8c, 0x0f74, 0x6ea3, 0x2de5, 0x1515};#ifdef MPEG2_LSF ushort longIdx[6][23] = { /* MPEG1 */ {0,4, 8,12,16,20,24,30,36,44,52,62, 74, 90,110,134,162,196,238,288,342,418,576}, {0,4, 8,12,16,20,24,30,36,42,50,60, 72, 88,106,128,156,190,230,276,330,384,576}, {0,4, 8,12,16,20,24,30,36,44,54,66, 82,102,126,156,194,240,296,364,448,550,576}, /* MPEG2_LSF */ {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,330,394,464,540,576}, {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}}; uchar longDiff[6][22] = { /* MPEG1 */ {4,4,4,4,4,4,6, 6, 8, 8,10,12,16,20,24,28,34,42,50,54, 76,158}, {4,4,4,4,4,4,6, 6, 6, 8,10,12,16,18,22,28,34,40,46,54, 54,192}, {4,4,4,4,4,4,6, 6, 8,10,12,16,20,24,30,38,46,56,68,84,102, 26}, /* MPEG2_LSF */ {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68, 58, 54}, {6,6,6,6,6,6,8,10,12,14,16,18,22,26,32,38,46,52,64,70, 76, 36}, {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68, 58, 54}};uchar shortIdx[6][14] = { /* MPEG1 */ {0,4,8,12,16,22,30,40,52,66, 84,106,136,192}, {0,4,8,12,16,22,28,38,50,64, 80,100,126,192}, {0,4,8,12,16,22,30,42,58,78,104,138,180,192}, /* MPEG2_LSF */ {0,4,8,12,18,24,32,42,56,74,100,132,174,192}, {0,4,8,12,18,26,36,48,62,80,104,136,180,192}, {0,4,8,12,18,26,36,48,62,80,104,134,174,192}};uchar shortDiff[6][13] = { /* MPEG1 */ {4,4,4,4,6, 8,10,12,14,18,22,30,56}, {4,4,4,4,6, 6,10,12,14,16,20,26,66}, {4,4,4,4,6, 8,12,16,20,26,34,42,12}, /* MPEG2_LSF */ {4,4,4,6,6, 8,10,14,18,26,32,42,18}, {4,4,4,6,8,10,12,14,18,24,32,44,12}, {4,4,4,6,8,10,12,14,18,24,30,40,18}}; /* only MPEG-1 *//* ====== changed the 1st entries to avoid bad audio to repeat itself ====== */ushort mp3_framesize[6][15] = { /* MPEG1 */ {4,104,130,156,182,208,261,313,365,417,522,626, 731, 835,1044}, {4, 96,120,144,168,192,240,288,336,384,480,576, 672, 768, 960}, {4,144,180,216,252,288,360,432,504,576,720,864,1008,1152,1440}, /* MPEG2_LSF */ {4, 26, 52, 78,104,130,156,182,208,261,313,365,417,470,522}, {4, 24, 48, 72, 96,120,144,168,192,240,288,336,384,432,480}, {4, 36, 72,108,144,180,216,252,288,360,432,504,576,648,720}};uchar stab[3][6][4] = { {{ 6, 5, 5, 5}, { 6, 5, 7, 3}, { 11,10,0, 0}, { 7, 7, 7, 0}, { 6, 6, 6, 3}, { 8, 8,5, 0}}, {{ 9, 9, 9, 9}, { 9, 9,12, 6}, { 18,18,0, 0}, {12,12,12, 0}, {12, 9, 9, 6}, { 15,12,9, 0}}, {{ 6, 9, 9, 9}, { 6, 9,12, 6}, { 15,18,0, 0}, { 6,15,12, 0}, { 6,12, 9, 6}, { 6,18,9, 0}}};#elseushort longIdx[3][23] = { /* MPEG1 */ {0,4, 8,12,16,20,24,30,36,44,52,62, 74, 90,110,134,162,196,238,288,342,418,576}, {0,4, 8,12,16,20,24,30,36,42,50,60, 72, 88,106,128,156,190,230,276,330,384,576}, {0,4, 8,12,16,20,24,30,36,44,54,66, 82,102,126,156,194,240,296,364,448,550,576}}; uchar longDiff[3][22] = { /* MPEG1 */ {4,4,4,4,4,4,6, 6, 8, 8,10,12,16,20,24,28,34,42,50,54, 76,158}, {4,4,4,4,4,4,6, 6, 6, 8,10,12,16,18,22,28,34,40,46,54, 54,192}, {4,4,4,4,4,4,6, 6, 8,10,12,16,20,24,30,38,46,56,68,84,102, 26}};uchar shortIdx[3][14] = { /* MPEG1 */ {0,4,8,12,16,22,30,40,52,66, 84,106,136,192}, {0,4,8,12,16,22,28,38,50,64, 80,100,126,192}, {0,4,8,12,16,22,30,42,58,78,104,138,180,192}};uchar shortDiff[3][13] = { /* MPEG1 */ {4,4,4,4,6, 8,10,12,14,18,22,30,56}, {4,4,4,4,6, 6,10,12,14,16,20,26,66}, {4,4,4,4,6, 8,12,16,20,26,34,42,12}}; /* only MPEG-1 *//* ====== changed the 1st entries to avoid bad audio to repeat itself ====== */ushort mp3_framesize[3][15] = { /* MPEG1 */ {4,104,130,156,182,208,261,313,365,417,522,626, 731, 835,1044}, {4, 96,120,144,168,192,240,288,336,384,480,576, 672, 768, 960}, {4,144,180,216,252,288,360,432,504,576,720,864,1008,1152,1440}};#endifint qua1to3[7] = { 0x260dfc14, 0x2d413ccc, 0x35d13f32, 0x40000000, 0x260dfc14, 0x2d413ccc,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?