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 * spectrum_ar_model_tables.c 13 * 14 * This file contains tables with AR coefficients, Gain coefficients 15 * and cosine tables. 16 * 17 */ 18 19 #include "spectrum_ar_model_tables.h" 20 #include "settings.h" 21 22 /********************* AR Coefficient Tables ************************/ 23 24 /* cdf for quantized reflection coefficient 1 */ 25 const uint16_t WebRtcIsacfix_kRc1Cdf[12] = { 26 0, 2, 4, 129, 7707, 57485, 65495, 65527, 65529, 65531, 27 65533, 65535 28 }; 29 30 /* cdf for quantized reflection coefficient 2 */ 31 const uint16_t WebRtcIsacfix_kRc2Cdf[12] = { 32 0, 2, 4, 7, 531, 25298, 64525, 65526, 65529, 65531, 33 65533, 65535 34 }; 35 36 /* cdf for quantized reflection coefficient 3 */ 37 const uint16_t WebRtcIsacfix_kRc3Cdf[12] = { 38 0, 2, 4, 6, 620, 22898, 64843, 65527, 65529, 65531, 39 65533, 65535 40 }; 41 42 /* cdf for quantized reflection coefficient 4 */ 43 const uint16_t WebRtcIsacfix_kRc4Cdf[12] = { 44 0, 2, 4, 6, 35, 10034, 60733, 65506, 65529, 65531, 45 65533, 65535 46 }; 47 48 /* cdf for quantized reflection coefficient 5 */ 49 const uint16_t WebRtcIsacfix_kRc5Cdf[12] = { 50 0, 2, 4, 6, 36, 7567, 56727, 65385, 65529, 65531, 51 65533, 65535 52 }; 53 54 /* cdf for quantized reflection coefficient 6 */ 55 const uint16_t WebRtcIsacfix_kRc6Cdf[12] = { 56 0, 2, 4, 6, 14, 6579, 57360, 65409, 65529, 65531, 57 65533, 65535 58 }; 59 60 /* representation levels for quantized reflection coefficient 1 */ 61 const int16_t WebRtcIsacfix_kRc1Levels[11] = { 62 -32104, -29007, -23202, -15496, -9279, -2577, 5934, 17535, 24512, 29503, 32104 63 }; 64 65 /* representation levels for quantized reflection coefficient 2 */ 66 const int16_t WebRtcIsacfix_kRc2Levels[11] = { 67 -32104, -29503, -23494, -15261, -7309, -1399, 6158, 16381, 24512, 29503, 32104 68 }; 69 70 /* representation levels for quantized reflection coefficient 3 */ 71 const int16_t WebRtcIsacfix_kRc3Levels[11] = { 72 -32104, -29503, -23157, -15186, -7347, -1359, 5829, 17535, 24512, 29503, 32104 73 }; 74 75 /* representation levels for quantized reflection coefficient 4 */ 76 const int16_t WebRtcIsacfix_kRc4Levels[11] = { 77 -32104, -29503, -24512, -15362, -6665, -342, 6596, 14585, 24512, 29503, 32104 78 }; 79 80 /* representation levels for quantized reflection coefficient 5 */ 81 const int16_t WebRtcIsacfix_kRc5Levels[11] = { 82 -32104, -29503, -24512, -15005, -6564, -106, 7123, 14920, 24512, 29503, 32104 83 }; 84 85 /* representation levels for quantized reflection coefficient 6 */ 86 const int16_t WebRtcIsacfix_kRc6Levels[11] = { 87 -32104, -29503, -24512, -15096, -6656, -37, 7036, 14847, 24512, 29503, 32104 88 }; 89 90 /* quantization boundary levels for reflection coefficients */ 91 const int16_t WebRtcIsacfix_kRcBound[12] = { 92 -32768, -31441, -27566, -21458, -13612, -4663, 93 4663, 13612, 21458, 27566, 31441, 32767 94 }; 95 96 /* initial index for AR reflection coefficient quantizer and cdf table search */ 97 const uint16_t WebRtcIsacfix_kRcInitInd[6] = { 98 5, 5, 5, 5, 5, 5 99 }; 100 101 /* pointers to AR cdf tables */ 102 const uint16_t *WebRtcIsacfix_kRcCdfPtr[AR_ORDER] = { 103 WebRtcIsacfix_kRc1Cdf, 104 WebRtcIsacfix_kRc2Cdf, 105 WebRtcIsacfix_kRc3Cdf, 106 WebRtcIsacfix_kRc4Cdf, 107 WebRtcIsacfix_kRc5Cdf, 108 WebRtcIsacfix_kRc6Cdf 109 }; 110 111 /* pointers to AR representation levels tables */ 112 const int16_t *WebRtcIsacfix_kRcLevPtr[AR_ORDER] = { 113 WebRtcIsacfix_kRc1Levels, 114 WebRtcIsacfix_kRc2Levels, 115 WebRtcIsacfix_kRc3Levels, 116 WebRtcIsacfix_kRc4Levels, 117 WebRtcIsacfix_kRc5Levels, 118 WebRtcIsacfix_kRc6Levels 119 }; 120 121 122 /******************** GAIN Coefficient Tables ***********************/ 123 124 /* cdf for Gain coefficient */ 125 const uint16_t WebRtcIsacfix_kGainCdf[19] = { 126 0, 2, 4, 6, 8, 10, 12, 14, 16, 1172, 127 11119, 29411, 51699, 64445, 65527, 65529, 65531, 65533, 65535 128 }; 129 130 /* representation levels for quantized squared Gain coefficient */ 131 const int32_t WebRtcIsacfix_kGain2Lev[18] = { 132 128, 128, 128, 128, 128, 215, 364, 709, 1268, 133 1960, 3405, 6078, 11286, 17827, 51918, 134498, 487432, 2048000 134 }; 135 136 /* quantization boundary levels for squared Gain coefficient */ 137 const int32_t WebRtcIsacfix_kGain2Bound[19] = { 138 0, 21, 35, 59, 99, 166, 280, 475, 815, 1414, 139 2495, 4505, 8397, 16405, 34431, 81359, 240497, 921600, 0x7FFFFFFF 140 }; 141 142 /* pointers to Gain cdf table */ 143 const uint16_t *WebRtcIsacfix_kGainPtr[1] = { 144 WebRtcIsacfix_kGainCdf 145 }; 146 147 /* gain initial index for gain quantizer and cdf table search */ 148 const uint16_t WebRtcIsacfix_kGainInitInd[1] = { 149 11 150 }; 151 152 153 /************************* Cosine Tables ****************************/ 154 155 /* cosine table */ 156 const int16_t WebRtcIsacfix_kCos[6][60] = { 157 { 512, 512, 511, 510, 508, 507, 505, 502, 499, 496, 158 493, 489, 485, 480, 476, 470, 465, 459, 453, 447, 159 440, 433, 426, 418, 410, 402, 394, 385, 376, 367, 160 357, 348, 338, 327, 317, 306, 295, 284, 273, 262, 161 250, 238, 226, 214, 202, 190, 177, 165, 152, 139, 162 126, 113, 100, 87, 73, 60, 47, 33, 20, 7 }, 163 { 512, 510, 508, 503, 498, 491, 483, 473, 462, 450, 164 437, 422, 406, 389, 371, 352, 333, 312, 290, 268, 165 244, 220, 196, 171, 145, 120, 93, 67, 40, 13, 166 -13, -40, -67, -93, -120, -145, -171, -196, -220, -244, 167 -268, -290, -312, -333, -352, -371, -389, -406, -422, -437, 168 -450, -462, -473, -483, -491, -498, -503, -508, -510, -512 }, 169 { 512, 508, 502, 493, 480, 465, 447, 426, 402, 376, 170 348, 317, 284, 250, 214, 177, 139, 100, 60, 20, 171 -20, -60, -100, -139, -177, -214, -250, -284, -317, -348, 172 -376, -402, -426, -447, -465, -480, -493, -502, -508, -512, 173 -512, -508, -502, -493, -480, -465, -447, -426, -402, -376, 174 -348, -317, -284, -250, -214, -177, -139, -100, -60, -20 }, 175 { 511, 506, 495, 478, 456, 429, 398, 362, 322, 279, 176 232, 183, 133, 80, 27, -27, -80, -133, -183, -232, 177 -279, -322, -362, -398, -429, -456, -478, -495, -506, -511, 178 -511, -506, -495, -478, -456, -429, -398, -362, -322, -279, 179 -232, -183, -133, -80, -27, 27, 80, 133, 183, 232, 180 279, 322, 362, 398, 429, 456, 478, 495, 506, 511 }, 181 { 511, 502, 485, 459, 426, 385, 338, 284, 226, 165, 182 100, 33, -33, -100, -165, -226, -284, -338, -385, -426, 183 -459, -485, -502, -511, -511, -502, -485, -459, -426, -385, 184 -338, -284, -226, -165, -100, -33, 33, 100, 165, 226, 185 284, 338, 385, 426, 459, 485, 502, 511, 511, 502, 186 485, 459, 426, 385, 338, 284, 226, 165, 100, 33 }, 187 { 510, 498, 473, 437, 389, 333, 268, 196, 120, 40, 188 -40, -120, -196, -268, -333, -389, -437, -473, -498, -510, 189 -510, -498, -473, -437, -389, -333, -268, -196, -120, -40, 190 40, 120, 196, 268, 333, 389, 437, 473, 498, 510, 191 510, 498, 473, 437, 389, 333, 268, 196, 120, 40, 192 -40, -120, -196, -268, -333, -389, -437, -473, -498, -510 } 193 }; 194