windows-nt/Source/XPSP1/NT/enduser/netmeeting/av/codecs/lh/data.c
2020-09-26 16:20:57 +08:00

233 lines
9.8 KiB
C
Raw Blame History

/*
* Project: Direct Subband about 13000 bps coder and SBCELP 4800 bps coder
* Workfile: data.c
* Author: Georges Zanellato, Alfred Wiesen
* Created: 30 August 1995
* Last update: 26 October 1995
* DLL Version: 1.00
* Revision: Single DLL for coder and decoder.
* Comment:
*
* (C) Copyright 1993-95 Lernout & Hauspie Speech Products N.V. (TM)
* All rights reserved. Company confidential.
*/
//#include <math.h>
#include <windows.h>
#include "data.h"
// ------------------------------------------------------------------------
// ROM tables :
// ------------------------------------------------------------------------
short coef_I[Fil_Lenght] = // QMF filter coefficients
{ 94, -62, -528, 3499,
15641, -3122, 1178, -326 };
/****/
short B3_I[2]={-3072, 3072};
short B4_I[3]={-4233, 0, 4233};
short B5_I[4]={-4915,-1638, 1638, 4915};
short B6_I[5]={-5406,-2703, 0, 2703, 5406};
short B7_I[6]={-5802,-3481,-1160, 1160, 3481, 5802};
short B8_I[7]={-6144,-4096,-2048, 0, 2048, 4096, 6144};
short B9_I[8]={-6451,-4607,-2764, -921, 921, 2764, 4607, 6451};
short V3_I[3]={-6144, 0, 6144}; // 75 %
short V4_I[4]={-6349,-2116, 2116, 6349}; // 77.5 %
short V5_I[5]={-6554,-3277, 0, 3277, 6554}; // 80 %
short V6_I[6]={-6758,-4055,-1352, 1352, 4055, 6758}; // 82.5 %
short V7_I[7]={-6963,-4642,-2321, 0, 2321, 4642, 6963}; // 85 %
short V8_I[8]={-7168,-5120,-3072,-1024, 1024, 3072, 5120, 7168}; // 87.5 %
short V9_I[9]={-7373,-5529,-3686,-1843, 0, 1843, 3686, 5529, 7373};// 90 %
/**** Nouvelles tables ****/
//short B9_I[8]={-6707,-4791,-2874, -958, 958, 2874, 4791, 6707}; //lineaires
//short V9_I[9]={-7666,-5749,-3833,-1916, 0, 1916, 3833, 5749, 7666};
//short B9_I[8]={-5702,-3154,-1745, -965, 965, 1745, 3154, 5702}; //log
//short V9_I[9]={-7666,-4241,-2346,-1298, 0, 1298, 2346, 4241, 7666};
/****/
/**** Quantif du maximum des ss bandes avec calcul des distances; ****/
/**** les ech. des ss bandes peuvent etre superieurs a 1 ****/
/****/
short max_level[32] = {
10, 30, 60, 100, 117, 138, 162, 190,
223, 262, 308, 361, 425, 499, 586, 688,
808, 949, 1114, 1308, 1536, 1804, 2119, 2488,
2922, 3431, 4030, 4732, 5557, 6526, 7664, 9000
};
short d_max_level[32] = { // Division des petites valeurs pour r<>duire le bruit
2, 10, 30, 60, 100, 138, 162, 190,
223, 262, 308, 361, 425, 499, 586, 688,
808, 949, 1114, 1308, 1536, 1804, 2119, 2488,
2922, 3431, 4030, 4732, 5557, 6526, 7664, 9000
};
/****/
/**** Cette table est la meme que la precedente mais avec comparaison ****/
/**** simple (les ech des ss bandes seront alors tjs inferieurs a 1) ****/
/****
short max_level[32] = { // Quantified maximum sample level
20, 45, 80, 109, 128, 150, 176, 207,
243, 285, 335, 393, 462, 543, 637, 748,
879, 1032, 1211, 1422, 1670, 1962, 2304, 2705,
3177, 3731, 4381, 5145, 6042, 7095, 8332,16000
};
/****/
/*** New table with new structure (variable threshold) ***
short max_level[32] = {
100, 125, 150, 200, 250, 285, 326, 372,
425, 485, 554, 633, 723, 825, 943, 1076,
1229, 1404, 1603, 1830, 2090, 2387, 2726, 3113,
3554, 4059, 4635, 5293, 6044, 6902, 7881, 9000,
};
/****/
// Masques utilis<69>s pour le multiplexage et d<>multiplexage des trames cod<6F>es
// Mask[i] donne acc<63>s aux i bits de poids faible d'un long
long Mask[9]={0,1,3,7,15,31,63,127,255};
// PhilF: Since these depend on the bit rate, moved them from global to instance data...
//short quantif[2*NBSB_SP_MAX1]={QUANT_LEVELS};
//short bits[NBSB_SP_MAX1]={CODING_BITS};
//short bytes[NBSB_SP_MAX1+1]={OUTPUT_BYTES};
/*short quantif[16]={9,9,7,7,7,6,5,5,5,5,0,0,0,0,0,0};
short bits[8]={52,46,44,38,38,0,0,0};
short bytes[9]={1,9,15,21,26,32,0,0,0};*/
// Hamming window
short hamming[220] =
{ 2621, 2628, 2646, 2677, 2721, 2776, 2844, 2924, 3017, 3121,
3237, 3366, 3506, 3658, 3821, 3996, 4182, 4379, 4587, 4806,
5035, 5275, 5525, 5786, 6056, 6335, 6624, 6922, 7229, 7544,
7868, 8200, 8540, 8887, 9242, 9603, 9971, 10346, 10726, 11113,
11504, 11901, 12303, 12709, 13119, 13533, 13950, 14370, 14793, 15219,
15646, 16076, 16506, 16938, 17370, 17802, 18235, 18667, 19098, 19528,
19956, 20382, 20807, 21229, 21648, 22063, 22475, 22883, 23287, 23686,
24081, 24470, 24853, 25231, 25602, 25967, 26325, 26676, 27019, 27355,
27683, 28003, 28314, 28616, 28910, 29194, 29469, 29734, 29989, 30234,
30469, 30693, 30907, 31109, 31301, 31481, 31650, 31808, 31954, 32088,
32211, 32321, 32419, 32506, 32580, 32642, 32691, 32728, 32753, 32765,
32765, 32753, 32728, 32691, 32642, 32580, 32506, 32419, 32321, 32211,
32088, 31954, 31808, 31650, 31481, 31301, 31109, 30907, 30693, 30469,
30234, 29989, 29734, 29469, 29194, 28910, 28616, 28314, 28003, 27683,
27355, 27019, 26676, 26325, 25967, 25602, 25231, 24853, 24470, 24081,
23686, 23287, 22883, 22475, 22063, 21648, 21229, 20807, 20382, 19956,
19528, 19098, 18667, 18235, 17802, 17370, 16938, 16506, 16076, 15646,
15219, 14793, 14370, 13950, 13533, 13119, 12709, 12303, 11901, 11504,
11113, 10726, 10346, 9971, 9603, 9242, 8887, 8540, 8200, 7868,
7544, 7229, 6922, 6624, 6335, 6056, 5786, 5525, 5275, 5035,
4806, 4587, 4379, 4182, 3996, 3821, 3658, 3506, 3366, 3237,
3121, 3017, 2924, 2844, 2776, 2721, 2677, 2646, 2628, 2621
};
short A0[11] = { 32767, 29491, 26542, 23887, 21499, 19349, 17414, 15672, 14105, 12694, 11425};
short LSP0ROM[10] = {1638, 4915, 8192, 11468, 14745, 18022, 21299, 24576, 27852, 31129};
short tabcos[292] =
{ 32767, 32512, 32256, 32000, 31744, 31488, 31232, 30976, 30720, 30464,
30208, 29952, 29696, 29440, 29184, 28928, 28672, 28416, 28160, 27904,
27648, 27392, 27136, 26880, 26624, 26368, 26112, 25856, 25600, 25344,
25088, 24832, 24576, 24320, 24064, 23808, 23552, 23296, 23040, 22784,
22528, 22272, 22016, 21760, 21504, 21248, 20992, 20736, 20480, 20224,
19968, 19712, 19456, 19200, 18944, 18688, 18432, 18176, 17920, 17664,
17408, 17152, 16896, 16640, 16384, 16128, 15872, 15616, 15360, 15104,
14848, 14592, 14336, 14080, 13824, 13568, 13312, 13056, 12800, 12544,
12288, 12032, 11776, 11520, 11264, 11008, 10752, 10496, 10240, 9984,
9728, 9472, 9216, 8960, 8704, 8448, 8192, 7936, 7680, 7424,
7168, 6912, 6656, 6400, 6144, 5888, 5632, 5376, 5120, 4864,
4608, 4352, 4096, 3840, 3584, 3328, 3072, 2816, 2560, 2304,
2048, 1792, 1536, 1280, 1024, 768, 512, 256, 0, 0,
1304, 1846, 2262, 2614, 2924, 3206, 3465, 3707, 3934, 4150,
4355, 4552, 4741, 4923, 5100, 5271, 5437, 5598, 5755, 5909,
6059, 6206, 6350, 6491, 6630, 6766, 6899, 7031, 7160, 7288,
7414, 7538, 7660, 7781, 7900, 8018, 8135, 8250, 8364, 8477,
8589, 8699, 8809, 8917, 9025, 9131, 9237, 9342, 9446, 9549,
9651, 9753, 9854, 9954, 10053, 10152, 10251, 10348, 10445, 10542,
10638, 10733, 10828, 10922, 11016, 11109, 11202, 11295, 11387, 11478,
11570, 11660, 11751, 11841, 11931, 12020, 12109, 12198, 12286, 12374,
12462, 12549, 12637, 12723, 12810, 12896, 12983, 13068, 13154, 13240,
13325, 13410, 13495, 13579, 13664, 13748, 13832, 13916, 14000, 14083,
14167, 14250, 14333, 14416, 14499, 14582, 14665, 14747, 14830, 14912,
14994, 15076, 15158, 15240, 15322, 15404, 15486, 15568, 15650, 15731,
15813, 15894, 15976, 16058, 16139, 16221, 16302, 16384, 32767, 32735,
32703, 32671, 32639, 32607, 32575, 32543, 32511, 32479, 32447, 32415,
32383, 32351, 32319, 32287, 32255, 8, 461, 652, 798, 922,
1031, 1129, 1220, 1304, 1383, 1458, 1530, 1598, 1663, 1726,
1787, 1846 };
// First table for LSP quantification
short LSP_Q[56] =
{ 819, 1392, 1843, 2048, 2293, 2785, 3440, 4096, 3440, 3768,
4096, 4423, 4792, 5242, 5775, 6348, 6963, 7782, 8601, 9420,
10240, 11059, 11878, 12697, 8192, 8601, 9256, 9912, 10526, 11059,
11714, 12369, 13025, 13680, 14336, 15155, 15974, 16793, 17612, 18432,
14745, 15400, 16056, 17203, 18841, 20316, 22118, 23756, 22609, 23592,
24576, 25395, 26214, 27115, 28098, 29081
};
short TAB_DI[38] =
{ 1604, 3522, 5816, 8559, 11839, 15761, 20451, 26060, 32767,
1825, 4057, 6787, 10125, 14207, 19199, 25303,
3110, 7402, 13324, 21494, 32767,
4057, 10125, 19199,
3110, 7402, 13324, 21494, 32767,
4057, 10125, 19199, 5816, 15761, 32767,
10125, 10125, 32767
};
short GQ[17] = { 0, 37, 81, 132, 194, 266, 352, 454, 575,
717, 887, 1087, 1324, 1606, 1939, 2333, 2800 };
short GV[17] = { 0, 9, 58, 105, 162, 228, 307, 401, 512,
643, 798, 983, 1201, 1459, 1765, 2127, 2557 };
short BQ[11] = { 0, 328, 757, 1320, 2058, 3026, 4295, 5958,
8139, 10998, 14746 };
short BV[11] = { 0, 153, 528, 1020, 1664, 2509, 3617, 5070,
6975, 9471, 12745 };
short NBB[25] = {8,16,16,8,8,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0};
short BITDD[5] = {9,5,5,3,2};
long coef_i[9] = { -626684736, 7274874, 1238819712, 7274874, -626684736,
-4058, -23341, 1585, 10127 };
// } ROM TABLES
// -------------------------------------------------------------------------
// RAM variables :
// -------------------------------------------------------------------------
// All in data structures.
// ------------------------------------------------------------------------
void InitializeROM(void)
// Global initializations of ROM tables : should only be called once
{
// All data hardcoded. no initialization needed.
return;
}