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 * SWB16_KLT_Tables.c 13 * 14 * This file defines tables used for entropy coding of LPC shape of 15 * upper-band signal if the bandwidth is 16 kHz. 16 * 17 */ 18 19 #include "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h" 20 #include "modules/audio_coding/codecs/isac/main/source/settings.h" 21 22 /* 23 * Mean value of LAR 24 */ 25 const double WebRtcIsac_kMeanLarUb16[UB_LPC_ORDER] = 26 { 27 0.454978, 0.364747, 0.102999, 0.104523 28 }; 29 30 /* 31 * A rotation matrix to decorrelate intra-vector correlation, 32 * i.e. correlation among components of LAR vector. 33 */ 34 const double WebRtcIsac_kIintraVecDecorrMatUb16[UB_LPC_ORDER][UB_LPC_ORDER] = 35 { 36 {-0.020528, -0.085858, -0.002431, 0.996093}, 37 {-0.033155, 0.036102, 0.998786, 0.004866}, 38 { 0.202627, 0.974853, -0.028940, 0.088132}, 39 {-0.978479, 0.202454, -0.039785, -0.002811} 40 }; 41 42 /* 43 * A rotation matrix to remove correlation among LAR coefficients 44 * of different LAR vectors. One might guess that decorrelation matrix 45 * for the first component should differ from the second component 46 * but we haven't observed a significant benefit of having different 47 * decorrelation matrices for different components. 48 */ 49 const double WebRtcIsac_kInterVecDecorrMatUb16 50 [UB16_LPC_VEC_PER_FRAME][UB16_LPC_VEC_PER_FRAME] = 51 { 52 { 0.291675, -0.515786, 0.644927, 0.482658}, 53 {-0.647220, 0.479712, 0.289556, 0.516856}, 54 { 0.643084, 0.485489, -0.289307, 0.516763}, 55 {-0.287185, -0.517823, -0.645389, 0.482553} 56 }; 57 58 /* 59 * The following 16 vectors define CDF of 16 decorrelated LAR 60 * coefficients. 61 */ 62 const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub16[14] = 63 { 64 0, 2, 20, 159, 1034, 5688, 20892, 44653, 65 59849, 64485, 65383, 65518, 65534, 65535 66 }; 67 68 const uint16_t WebRtcIsac_kLpcShapeCdfVec1Ub16[16] = 69 { 70 0, 1, 7, 43, 276, 1496, 6681, 21653, 71 43891, 58859, 64022, 65248, 65489, 65529, 65534, 65535 72 }; 73 74 const uint16_t WebRtcIsac_kLpcShapeCdfVec2Ub16[18] = 75 { 76 0, 1, 9, 54, 238, 933, 3192, 9461, 77 23226, 42146, 56138, 62413, 64623, 65300, 65473, 65521, 78 65533, 65535 79 }; 80 81 const uint16_t WebRtcIsac_kLpcShapeCdfVec3Ub16[30] = 82 { 83 0, 2, 4, 8, 17, 36, 75, 155, 84 329, 683, 1376, 2662, 5047, 9508, 17526, 29027, 85 40363, 48997, 55096, 59180, 61789, 63407, 64400, 64967, 86 65273, 65429, 65497, 65526, 65534, 65535 87 }; 88 89 const uint16_t WebRtcIsac_kLpcShapeCdfVec4Ub16[16] = 90 { 91 0, 1, 10, 63, 361, 1785, 7407, 22242, 92 43337, 58125, 63729, 65181, 65472, 65527, 65534, 65535 93 }; 94 95 const uint16_t WebRtcIsac_kLpcShapeCdfVec5Ub16[17] = 96 { 97 0, 1, 7, 29, 134, 599, 2443, 8590, 98 22962, 42635, 56911, 63060, 64940, 65408, 65513, 65531, 99 65535 100 }; 101 102 const uint16_t WebRtcIsac_kLpcShapeCdfVec6Ub16[21] = 103 { 104 0, 1, 5, 16, 57, 191, 611, 1808, 105 4847, 11755, 24612, 40910, 53789, 60698, 63729, 64924, 106 65346, 65486, 65523, 65532, 65535 107 }; 108 109 const uint16_t WebRtcIsac_kLpcShapeCdfVec7Ub16[36] = 110 { 111 0, 1, 4, 12, 25, 55, 104, 184, 112 314, 539, 926, 1550, 2479, 3861, 5892, 8845, 113 13281, 20018, 29019, 38029, 45581, 51557, 56057, 59284, 114 61517, 63047, 64030, 64648, 65031, 65261, 65402, 65480, 115 65518, 65530, 65534, 65535 116 }; 117 118 const uint16_t WebRtcIsac_kLpcShapeCdfVec8Ub16[21] = 119 { 120 0, 1, 2, 7, 26, 103, 351, 1149, 121 3583, 10204, 23846, 41711, 55361, 61917, 64382, 65186, 122 65433, 65506, 65528, 65534, 65535 123 }; 124 125 const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub160[21] = 126 { 127 0, 6, 19, 63, 205, 638, 1799, 4784, 128 11721, 24494, 40803, 53805, 60886, 63822, 64931, 65333, 129 65472, 65517, 65530, 65533, 65535 130 }; 131 132 const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub161[28] = 133 { 134 0, 1, 3, 11, 31, 86, 221, 506, 135 1101, 2296, 4486, 8477, 15356, 26079, 38941, 49952, 136 57165, 61257, 63426, 64549, 65097, 65351, 65463, 65510, 137 65526, 65532, 65534, 65535 138 }; 139 140 const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub162[55] = 141 { 142 0, 3, 12, 23, 42, 65, 89, 115, 143 150, 195, 248, 327, 430, 580, 784, 1099, 144 1586, 2358, 3651, 5899, 9568, 14312, 19158, 23776, 145 28267, 32663, 36991, 41153, 45098, 48680, 51870, 54729, 146 57141, 59158, 60772, 62029, 63000, 63761, 64322, 64728, 147 65000, 65192, 65321, 65411, 65463, 65496, 65514, 65523, 148 65527, 65529, 65531, 65532, 65533, 65534, 65535 149 }; 150 151 const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub163[26] = 152 { 153 0, 2, 4, 10, 21, 48, 114, 280, 154 701, 1765, 4555, 11270, 24267, 41213, 54285, 61003, 155 63767, 64840, 65254, 65421, 65489, 65514, 65526, 65532, 156 65534, 65535 157 }; 158 159 const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub164[28] = 160 { 161 0, 1, 3, 6, 15, 36, 82, 196, 162 453, 1087, 2557, 5923, 13016, 25366, 40449, 52582, 163 59539, 62896, 64389, 65033, 65316, 65442, 65494, 65519, 164 65529, 65533, 65534, 65535 165 }; 166 167 const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub165[34] = 168 { 169 0, 2, 4, 8, 18, 35, 73, 146, 170 279, 524, 980, 1789, 3235, 5784, 10040, 16998, 171 27070, 38543, 48499, 55421, 59712, 62257, 63748, 64591, 172 65041, 65278, 65410, 65474, 65508, 65522, 65530, 65533, 173 65534, 65535 174 }; 175 176 const uint16_t WebRtcIsac_kLpcShapeCdfVec01Ub166[71] = 177 { 178 0, 1, 2, 6, 13, 26, 55, 92, 179 141, 191, 242, 296, 355, 429, 522, 636, 180 777, 947, 1162, 1428, 1753, 2137, 2605, 3140, 181 3743, 4409, 5164, 6016, 6982, 8118, 9451, 10993, 182 12754, 14810, 17130, 19780, 22864, 26424, 30547, 35222, 183 40140, 44716, 48698, 52056, 54850, 57162, 59068, 60643, 184 61877, 62827, 63561, 64113, 64519, 64807, 65019, 65167, 185 65272, 65343, 65399, 65440, 65471, 65487, 65500, 65509, 186 65518, 65524, 65527, 65531, 65533, 65534, 65535 187 }; 188 189 /* 190 * An array of pointers to CDFs of decorrelated LARs 191 */ 192 const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb16 193 [UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] = { 194 WebRtcIsac_kLpcShapeCdfVec01Ub16, 195 WebRtcIsac_kLpcShapeCdfVec1Ub16, 196 WebRtcIsac_kLpcShapeCdfVec2Ub16, 197 WebRtcIsac_kLpcShapeCdfVec3Ub16, 198 WebRtcIsac_kLpcShapeCdfVec4Ub16, 199 WebRtcIsac_kLpcShapeCdfVec5Ub16, 200 WebRtcIsac_kLpcShapeCdfVec6Ub16, 201 WebRtcIsac_kLpcShapeCdfVec7Ub16, 202 WebRtcIsac_kLpcShapeCdfVec8Ub16, 203 WebRtcIsac_kLpcShapeCdfVec01Ub160, 204 WebRtcIsac_kLpcShapeCdfVec01Ub161, 205 WebRtcIsac_kLpcShapeCdfVec01Ub162, 206 WebRtcIsac_kLpcShapeCdfVec01Ub163, 207 WebRtcIsac_kLpcShapeCdfVec01Ub164, 208 WebRtcIsac_kLpcShapeCdfVec01Ub165, 209 WebRtcIsac_kLpcShapeCdfVec01Ub166 210 }; 211 212 /* 213 * The smallest reconstruction points for quantiztion of LAR coefficients. 214 */ 215 const double WebRtcIsac_kLpcShapeLeftRecPointUb16 216 [UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] = 217 { 218 -0.8250, -0.9750, -1.1250, -2.1750, -0.9750, -1.1250, -1.4250, 219 -2.6250, -1.4250, -1.2750, -1.8750, -3.6750, -1.7250, -1.8750, 220 -2.3250, -5.4750 221 }; 222 223 /* 224 * Number of reconstruction points of quantizers for LAR coefficients. 225 */ 226 const int16_t WebRtcIsac_kLpcShapeNumRecPointUb16 227 [UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] = 228 { 229 13, 15, 17, 29, 15, 16, 20, 35, 20, 230 20, 27, 54, 25, 27, 33, 70 231 }; 232 233 /* 234 * Starting index for entropy decoder to search for the right interval, 235 * one entry per LAR coefficient 236 */ 237 const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb16 238 [UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] = 239 { 240 6, 7, 8, 14, 7, 8, 10, 17, 10, 241 10, 13, 27, 12, 13, 16, 35 242 }; 243 244 /* 245 * LAR quantization step-size. 246 */ 247 const double WebRtcIsac_kLpcShapeQStepSizeUb16 = 0.150000; 248