• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 /*
12  * SWB_KLT_Tables_LPCGain.c
13  *
14  * This file defines tables used for entropy coding of LPC Gain
15  * of upper-band.
16  *
17  */
18 
19 #include "lpc_gain_swb_tables.h"
20 #include "settings.h"
21 #include "webrtc/typedefs.h"
22 
23 const double WebRtcIsac_kQSizeLpcGain = 0.100000;
24 
25 const double WebRtcIsac_kMeanLpcGain = -3.3822;
26 
27 /*
28 * The smallest reconstruction points for quantiztion of
29 * LPC gains.
30 */
31 const double WebRtcIsac_kLeftRecPointLpcGain[SUBFRAMES] =
32 {
33    -0.800000, -1.000000, -1.200000, -2.200000, -3.000000, -12.700000
34 };
35 
36 /*
37 * Number of reconstruction points of quantizers for LPC Gains.
38 */
39 const int16_t WebRtcIsac_kNumQCellLpcGain[SUBFRAMES] =
40 {
41     17,  20,  25,  45,  77, 170
42 };
43 /*
44 * Starting index for entropy decoder to search for the right interval,
45 * one entry per LAR coefficient
46 */
47 const uint16_t WebRtcIsac_kLpcGainEntropySearch[SUBFRAMES] =
48 {
49      8,  10,  12,  22,  38,  85
50 };
51 
52 /*
53 * The following 6 vectors define CDF of 6 decorrelated LPC
54 * gains.
55 */
56 const uint16_t WebRtcIsac_kLpcGainCdfVec0[18] =
57 {
58      0,    10,    27,    83,   234,   568,  1601,  4683, 16830, 57534, 63437,
59  64767, 65229, 65408, 65483, 65514, 65527, 65535
60 };
61 
62 const uint16_t WebRtcIsac_kLpcGainCdfVec1[21] =
63 {
64      0,    15,    33,    84,   185,   385,   807,  1619,  3529,  7850, 19488,
65  51365, 62437, 64548, 65088, 65304, 65409, 65484, 65507, 65522, 65535
66 };
67 
68 const uint16_t WebRtcIsac_kLpcGainCdfVec2[26] =
69 {
70      0,    15,    29,    54,    89,   145,   228,   380,   652,  1493,  4260,
71  12359, 34133, 50749, 57224, 60814, 62927, 64078, 64742, 65103, 65311, 65418,
72  65473, 65509, 65521, 65535
73 };
74 
75 const uint16_t WebRtcIsac_kLpcGainCdfVec3[46] =
76 {
77      0,     8,    12,    16,    26,    42,    56,    76,   111,   164,   247,
78    366,   508,   693,  1000,  1442,  2155,  3188,  4854,  7387, 11249, 17617,
79  30079, 46711, 56291, 60127, 62140, 63258, 63954, 64384, 64690, 64891, 65031,
80  65139, 65227, 65293, 65351, 65399, 65438, 65467, 65492, 65504, 65510, 65518,
81  65523, 65535
82 };
83 
84 const uint16_t WebRtcIsac_kLpcGainCdfVec4[78] =
85 {
86      0,    17,    29,    39,    51,    70,   104,   154,   234,   324,   443,
87    590,   760,   971,  1202,  1494,  1845,  2274,  2797,  3366,  4088,  4905,
88   5899,  7142,  8683, 10625, 12983, 16095, 20637, 28216, 38859, 47237, 51537,
89  54150, 56066, 57583, 58756, 59685, 60458, 61103, 61659, 62144, 62550, 62886,
90  63186, 63480, 63743, 63954, 64148, 64320, 64467, 64600, 64719, 64837, 64939,
91  65014, 65098, 65160, 65211, 65250, 65290, 65325, 65344, 65366, 65391, 65410,
92  65430, 65447, 65460, 65474, 65487, 65494, 65501, 65509, 65513, 65518, 65520,
93  65535
94 };
95 
96 const uint16_t WebRtcIsac_kLpcGainCdfVec5[171] =
97 {
98      0,    10,    12,    14,    16,    18,    23,    29,    35,    42,    51,
99     58,    65,    72,    78,    87,    96,   103,   111,   122,   134,   150,
100    167,   184,   202,   223,   244,   265,   289,   315,   346,   379,   414,
101    450,   491,   532,   572,   613,   656,   700,   751,   802,   853,   905,
102    957,  1021,  1098,  1174,  1250,  1331,  1413,  1490,  1565,  1647,  1730,
103   1821,  1913,  2004,  2100,  2207,  2314,  2420,  2532,  2652,  2783,  2921,
104   3056,  3189,  3327,  3468,  3640,  3817,  3993,  4171,  4362,  4554,  4751,
105   4948,  5142,  5346,  5566,  5799,  6044,  6301,  6565,  6852,  7150,  7470,
106   7797,  8143,  8492,  8835,  9181,  9547,  9919, 10315, 10718, 11136, 11566,
107  12015, 12482, 12967, 13458, 13953, 14432, 14903, 15416, 15936, 16452, 16967,
108  17492, 18024, 18600, 19173, 19736, 20311, 20911, 21490, 22041, 22597, 23157,
109  23768, 24405, 25034, 25660, 26280, 26899, 27614, 28331, 29015, 29702, 30403,
110  31107, 31817, 32566, 33381, 34224, 35099, 36112, 37222, 38375, 39549, 40801,
111  42074, 43350, 44626, 45982, 47354, 48860, 50361, 51845, 53312, 54739, 56026,
112  57116, 58104, 58996, 59842, 60658, 61488, 62324, 63057, 63769, 64285, 64779,
113  65076, 65344, 65430, 65500, 65517, 65535
114 };
115 
116 /*
117 * An array of pointers to CDFs of decorrelated LPC Gains
118 */
119 const uint16_t* WebRtcIsac_kLpcGainCdfMat[SUBFRAMES] =
120 {
121     WebRtcIsac_kLpcGainCdfVec0, WebRtcIsac_kLpcGainCdfVec1,
122     WebRtcIsac_kLpcGainCdfVec2, WebRtcIsac_kLpcGainCdfVec3,
123     WebRtcIsac_kLpcGainCdfVec4, WebRtcIsac_kLpcGainCdfVec5
124 };
125 
126 /*
127 * A matrix to decorrellate LPC gains of subframes.
128 */
129 const double WebRtcIsac_kLpcGainDecorrMat[SUBFRAMES][SUBFRAMES] =
130 {
131     {-0.150860,  0.327872,  0.367220,  0.504613,  0.559270,  0.409234},
132     { 0.457128, -0.613591, -0.289283, -0.029734,  0.393760,  0.418240},
133     {-0.626043,  0.136489, -0.439118, -0.448323,  0.135987,  0.420869},
134     { 0.526617,  0.480187,  0.242552, -0.488754, -0.158713,  0.411331},
135     {-0.302587, -0.494953,  0.588112, -0.063035, -0.404290,  0.387510},
136     { 0.086378,  0.147714, -0.428875,  0.548300, -0.570121,  0.401391}
137 };
138