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.c 13 * 14 * This file defines tables used for entropy coding of LPC shape of 15 * upper-band signal if the bandwidth is 12 kHz. 16 * 17 */ 18 19 #include "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_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_kMeanLarUb12[UB_LPC_ORDER] = 26 { 27 0.03748928306641, 0.09453441192543, -0.01112522344398, 0.03800237516842 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_kIntraVecDecorrMatUb12[UB_LPC_ORDER][UB_LPC_ORDER] = 35 { 36 {-0.00075365493856, -0.05809964887743, -0.23397966154116, 0.97050367376411}, 37 { 0.00625021257734, -0.17299965610679, 0.95977735920651, 0.22104179375008}, 38 { 0.20543384258374, -0.96202143495696, -0.15301870801552, -0.09432375099565}, 39 {-0.97865075648479, -0.20300322280841, -0.02581111653779, -0.01913568980258} 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_kInterVecDecorrMatUb12 50 [UB_LPC_VEC_PER_FRAME][UB_LPC_VEC_PER_FRAME] = 51 { 52 { 0.70650597970460, -0.70770707262373}, 53 {-0.70770707262373, -0.70650597970460} 54 }; 55 56 /* 57 * LAR quantization step-size. 58 */ 59 const double WebRtcIsac_kLpcShapeQStepSizeUb12 = 0.150000; 60 61 /* 62 * The smallest reconstruction points for quantiztion of LAR coefficients. 63 */ 64 const double WebRtcIsac_kLpcShapeLeftRecPointUb12 65 [UB_LPC_ORDER*UB_LPC_VEC_PER_FRAME] = 66 { 67 -0.900000, -1.050000, -1.350000, -1.800000, -1.350000, -1.650000, 68 -2.250000, -3.450000 69 }; 70 71 /* 72 * Number of reconstruction points of quantizers for LAR coefficients. 73 */ 74 const int16_t WebRtcIsac_kLpcShapeNumRecPointUb12 75 [UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME] = 76 { 77 13, 15, 19, 27, 19, 24, 32, 48 78 }; 79 80 /* 81 * Starting index for entropy decoder to search for the right interval, 82 * one entry per LAR coefficient 83 */ 84 const uint16_t WebRtcIsac_kLpcShapeEntropySearchUb12 85 [UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME] = 86 { 87 6, 7, 9, 13, 9, 12, 16, 24 88 }; 89 90 /* 91 * The following 8 vectors define CDF of 8 decorrelated LAR 92 * coefficients. 93 */ 94 const uint16_t WebRtcIsac_kLpcShapeCdfVec0Ub12[14] = 95 { 96 0, 13, 95, 418, 1687, 6498, 21317, 44200, 59029, 63849, 65147, 97 65449, 65525, 65535 98 }; 99 100 const uint16_t WebRtcIsac_kLpcShapeCdfVec1Ub12[16] = 101 { 102 0, 10, 59, 255, 858, 2667, 8200, 22609, 42988, 57202, 62947, 103 64743, 65308, 65476, 65522, 65535 104 }; 105 106 const uint16_t WebRtcIsac_kLpcShapeCdfVec2Ub12[20] = 107 { 108 0, 18, 40, 118, 332, 857, 2017, 4822, 11321, 24330, 41279, 109 54342, 60637, 63394, 64659, 65184, 65398, 65482, 65518, 65535 110 }; 111 112 const uint16_t WebRtcIsac_kLpcShapeCdfVec3Ub12[28] = 113 { 114 0, 21, 38, 90, 196, 398, 770, 1400, 2589, 4650, 8211, 115 14933, 26044, 39592, 50814, 57452, 60971, 62884, 63995, 64621, 65019, 65273, 116 65410, 65480, 65514, 65522, 65531, 65535 117 }; 118 119 const uint16_t WebRtcIsac_kLpcShapeCdfVec4Ub12[20] = 120 { 121 0, 7, 46, 141, 403, 969, 2132, 4649, 10633, 24902, 43254, 122 54665, 59928, 62674, 64173, 64938, 65293, 65464, 65523, 65535 123 }; 124 125 const uint16_t WebRtcIsac_kLpcShapeCdfVec5Ub12[25] = 126 { 127 0, 7, 22, 72, 174, 411, 854, 1737, 3545, 6774, 13165, 128 25221, 40980, 52821, 58714, 61706, 63472, 64437, 64989, 65287, 65430, 65503, 129 65525, 65529, 65535 130 }; 131 132 const uint16_t WebRtcIsac_kLpcShapeCdfVec6Ub12[33] = 133 { 134 0, 11, 21, 36, 65, 128, 228, 401, 707, 1241, 2126, 135 3589, 6060, 10517, 18853, 31114, 42477, 49770, 54271, 57467, 59838, 61569, 136 62831, 63772, 64433, 64833, 65123, 65306, 65419, 65466, 65499, 65519, 65535 137 }; 138 139 const uint16_t WebRtcIsac_kLpcShapeCdfVec7Ub12[49] = 140 { 141 0, 14, 34, 67, 107, 167, 245, 326, 449, 645, 861, 142 1155, 1508, 2003, 2669, 3544, 4592, 5961, 7583, 9887, 13256, 18765, 143 26519, 34077, 40034, 44349, 47795, 50663, 53262, 55473, 57458, 59122, 60592, 144 61742, 62690, 63391, 63997, 64463, 64794, 65045, 65207, 65309, 65394, 65443, 145 65478, 65504, 65514, 65523, 65535 146 }; 147 148 /* 149 * An array of pointers to CDFs of decorrelated LARs 150 */ 151 const uint16_t* WebRtcIsac_kLpcShapeCdfMatUb12 152 [UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME] = 153 { 154 WebRtcIsac_kLpcShapeCdfVec0Ub12, WebRtcIsac_kLpcShapeCdfVec1Ub12, 155 WebRtcIsac_kLpcShapeCdfVec2Ub12, WebRtcIsac_kLpcShapeCdfVec3Ub12, 156 WebRtcIsac_kLpcShapeCdfVec4Ub12, WebRtcIsac_kLpcShapeCdfVec5Ub12, 157 WebRtcIsac_kLpcShapeCdfVec6Ub12, WebRtcIsac_kLpcShapeCdfVec7Ub12 158 }; 159