📄 table.c
字号:
/* ******************************************************************************** * * This material contains proprietary software of Entropic Speech, Inc. * Any reproduction, distribution, or publication without the the prior * written permission of Entropic Speech, Inc. is strictly prohibited. * Any public distribution of copies of this work authorized in writing * by Entropic Speech, Inc. must bear the notice: * * "Copyright (c) 1987 Entropic Speech, Inc.; all rights reserved" * * Program: table * * Written by: Jim Elliott * * Inverse quantization table look-up routine, plus quantization tables * for pitch and power. * ******************************************************************************** *//* * SCCS program and date keywords. */#ifndef lintstatic char *sccs_id = "@(#)table.c 1.2 11/30/87 ESI";#endif/* * ESPS include files. */#include "qlsf.h"/* ******************************************************************************** * Inverse quantization routine. ******************************************************************************** */doubletabdec( code, index, table )int code, index;struct quantable *table;{ register int i, hi; struct qtable *qt; qt = table[index].tab; hi = table[index].nval; for ( i = 0; i < hi; i++ ) if ( qt[i].code == code ) return( qt[i].dec ); return( -1.0 );}/* * Power quantization tables. */struct qtable tab_6bit[] ={ 5, 5, 0x00, 6, 6, 0x01, 7, 7, 0x02, 8, 8, 0x03, 9, 9, 0x04, 10, 10, 0x05, 11, 11, 0x06, 12, 12, 0x07, 14, 13, 0x08, 16, 15, 0x09, 18, 17, 0x0a, 20, 19, 0x0b, 22, 21, 0x0c, 25, 24, 0x0d, 28, 27, 0x0e, 32, 30, 0x0f, 36, 34, 0x10, 40, 38, 0x11, 45, 43, 0x12, 51, 48, 0x13, 57, 54, 0x14, 64, 60, 0x15, 72, 68, 0x16, 81, 76, 0x17, 91, 85, 0x18, 102, 96, 0x19, 114, 108, 0x1a, 128, 121, 0x1b, 144, 136, 0x1c, 162, 152, 0x1d, 181, 171, 0x1e, 203, 192, 0x1f, 228, 215, 0x20, 256, 242, 0x21, 287, 271, 0x22, 322, 304, 0x23, 362, 342, 0x24, 406, 384, 0x25, 456, 431, 0x26, 512, 483, 0x27, 575, 542, 0x28, 645, 609, 0x29, 724, 683, 0x2a, 813, 767, 0x2b, 912, 861, 0x2c, 1024, 967, 0x2d, 1149, 1085, 0x2e, 1290, 1218, 0x2f, 1448, 1367, 0x30, 1625, 1534, 0x31, 1825, 1722, 0x32, 2048, 1933, 0x33, 2299, 2170, 0x34, 2580, 2435, 0x35, 2896, 2734, 0x36, 3251, 3069, 0x37, 3649, 3444, 0x38, 4096, 3866, 0x39, 4598, 4340, 0x3a, 5161, 4871, 0x3b, 5793, 5468, 0x3c, 6502, 6137, 0x3d, 7298, 6889, 0x3e, 8192, 7732, 0x3f};struct qtable tab_1_5db[] ={ 5, 5, 0x00, 6, 6, 0x01, 7, 7, 0x02, 8, 8, 0x03, 11, 10, 0x04, 13, 12, 0x05, 15, 14, 0x06, 18, 17, 0x07, 21, 20, 0x08, 26, 24, 0x09, 31, 29, 0x0a, 37, 34, 0x0b, 44, 40, 0x0c, 52, 48, 0x0d, 62, 57, 0x0e, 74, 68, 0x0f, 88, 81, 0x10, 105, 96, 0x11, 125, 114, 0x12, 147, 135, 0x13, 175, 160, 0x14, 208, 190, 0x15, 247, 226, 0x16, 294, 269, 0x17, 349, 320, 0x18, 415, 380, 0x19, 493, 452, 0x1a, 586, 537, 0x1b, 697, 638, 0x1c, 828, 758, 0x1d, 984, 900, 0x1e, 1170, 1070, 0x1f, 1391, 1272, 0x20, 1653, 1512, 0x21, 1965, 1797, 0x22, 2335, 2136, 0x23, 2778, 2539, 0x24, 3302, 3018, 0x25, 3924, 3587, 0x26, 4664, 4263, 0x27, 5543, 5067, 0x28, 6588, 6022, 0x29, 8192, 7350, 0x2a};/* * Table of power quantization tables. */struct quantable pwrqtable[] ={ tab_6bit, 64, tab_1_5db, 43};/* * Pitch quantization tables. */struct qtable tab_2samp[] ={ 21, 20, 0x00, 24, 23, 0x01, 27, 26, 0x02, 30, 29, 0x03, 33, 32, 0x04, 36, 35, 0x05, 39, 38, 0x06, 42, 41, 0x07, 45, 44, 0x08, 48, 47, 0x09, 51, 50, 0x0a, 54, 53, 0x0b, 57, 56, 0x0c, 60, 59, 0x0d, 63, 62, 0x0e, 66, 65, 0x0f, 69, 68, 0x10, 72, 71, 0x11, 75, 74, 0x12, 78, 77, 0x13, 81, 80, 0x14, 85, 83, 0x15, 89, 87, 0x16, 93, 91, 0x17, 97, 95, 0x18, 101, 99, 0x19, 105, 103, 0x1a, 109, 107, 0x1b, 113, 111, 0x1c, 117, 115, 0x1d, 121, 119, 0x1e, 125, 123, 0x1f, 129, 127, 0x20, 133, 131, 0x21, 137, 135, 0x22, 141, 139, 0x23, 145, 143, 0x24, 149, 147, 0x25, 153, 151, 0x26, 157, 155, 0x27, 161, 159, 0x28,};/* * Table of pitch quantization tables. */struct quantable pitqtable[] = { tab_2samp, 41};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -