1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libopus/silk/tables_LTP.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,296 @@ 1.4 +/*********************************************************************** 1.5 +Copyright (c) 2006-2011, Skype Limited. All rights reserved. 1.6 +Redistribution and use in source and binary forms, with or without 1.7 +modification, are permitted provided that the following conditions 1.8 +are met: 1.9 +- Redistributions of source code must retain the above copyright notice, 1.10 +this list of conditions and the following disclaimer. 1.11 +- Redistributions in binary form must reproduce the above copyright 1.12 +notice, this list of conditions and the following disclaimer in the 1.13 +documentation and/or other materials provided with the distribution. 1.14 +- Neither the name of Internet Society, IETF or IETF Trust, nor the 1.15 +names of specific contributors, may be used to endorse or promote 1.16 +products derived from this software without specific prior written 1.17 +permission. 1.18 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 1.19 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.20 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.21 +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 1.22 +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1.23 +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1.24 +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1.25 +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1.26 +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.27 +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 1.28 +POSSIBILITY OF SUCH DAMAGE. 1.29 +***********************************************************************/ 1.30 + 1.31 +#ifdef HAVE_CONFIG_H 1.32 +#include "config.h" 1.33 +#endif 1.34 + 1.35 +#include "tables.h" 1.36 + 1.37 +const opus_uint8 silk_LTP_per_index_iCDF[3] = { 1.38 + 179, 99, 0 1.39 +}; 1.40 + 1.41 +static const opus_uint8 silk_LTP_gain_iCDF_0[8] = { 1.42 + 71, 56, 43, 30, 21, 12, 6, 0 1.43 +}; 1.44 + 1.45 +static const opus_uint8 silk_LTP_gain_iCDF_1[16] = { 1.46 + 199, 165, 144, 124, 109, 96, 84, 71, 1.47 + 61, 51, 42, 32, 23, 15, 8, 0 1.48 +}; 1.49 + 1.50 +static const opus_uint8 silk_LTP_gain_iCDF_2[32] = { 1.51 + 241, 225, 211, 199, 187, 175, 164, 153, 1.52 + 142, 132, 123, 114, 105, 96, 88, 80, 1.53 + 72, 64, 57, 50, 44, 38, 33, 29, 1.54 + 24, 20, 16, 12, 9, 5, 2, 0 1.55 +}; 1.56 + 1.57 +const opus_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304; 1.58 + 1.59 +static const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = { 1.60 + 15, 131, 138, 138, 155, 155, 173, 173 1.61 +}; 1.62 + 1.63 +static const opus_uint8 silk_LTP_gain_BITS_Q5_1[16] = { 1.64 + 69, 93, 115, 118, 131, 138, 141, 138, 1.65 + 150, 150, 155, 150, 155, 160, 166, 160 1.66 +}; 1.67 + 1.68 +static const opus_uint8 silk_LTP_gain_BITS_Q5_2[32] = { 1.69 + 131, 128, 134, 141, 141, 141, 145, 145, 1.70 + 145, 150, 155, 155, 155, 155, 160, 160, 1.71 + 160, 160, 166, 166, 173, 173, 182, 192, 1.72 + 182, 192, 192, 192, 205, 192, 205, 224 1.73 +}; 1.74 + 1.75 +const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = { 1.76 + silk_LTP_gain_iCDF_0, 1.77 + silk_LTP_gain_iCDF_1, 1.78 + silk_LTP_gain_iCDF_2 1.79 +}; 1.80 + 1.81 +const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = { 1.82 + silk_LTP_gain_BITS_Q5_0, 1.83 + silk_LTP_gain_BITS_Q5_1, 1.84 + silk_LTP_gain_BITS_Q5_2 1.85 +}; 1.86 + 1.87 +static const opus_int8 silk_LTP_gain_vq_0[8][5] = 1.88 +{ 1.89 +{ 1.90 + 4, 6, 24, 7, 5 1.91 +}, 1.92 +{ 1.93 + 0, 0, 2, 0, 0 1.94 +}, 1.95 +{ 1.96 + 12, 28, 41, 13, -4 1.97 +}, 1.98 +{ 1.99 + -9, 15, 42, 25, 14 1.100 +}, 1.101 +{ 1.102 + 1, -2, 62, 41, -9 1.103 +}, 1.104 +{ 1.105 + -10, 37, 65, -4, 3 1.106 +}, 1.107 +{ 1.108 + -6, 4, 66, 7, -8 1.109 +}, 1.110 +{ 1.111 + 16, 14, 38, -3, 33 1.112 +} 1.113 +}; 1.114 + 1.115 +static const opus_int8 silk_LTP_gain_vq_1[16][5] = 1.116 +{ 1.117 +{ 1.118 + 13, 22, 39, 23, 12 1.119 +}, 1.120 +{ 1.121 + -1, 36, 64, 27, -6 1.122 +}, 1.123 +{ 1.124 + -7, 10, 55, 43, 17 1.125 +}, 1.126 +{ 1.127 + 1, 1, 8, 1, 1 1.128 +}, 1.129 +{ 1.130 + 6, -11, 74, 53, -9 1.131 +}, 1.132 +{ 1.133 + -12, 55, 76, -12, 8 1.134 +}, 1.135 +{ 1.136 + -3, 3, 93, 27, -4 1.137 +}, 1.138 +{ 1.139 + 26, 39, 59, 3, -8 1.140 +}, 1.141 +{ 1.142 + 2, 0, 77, 11, 9 1.143 +}, 1.144 +{ 1.145 + -8, 22, 44, -6, 7 1.146 +}, 1.147 +{ 1.148 + 40, 9, 26, 3, 9 1.149 +}, 1.150 +{ 1.151 + -7, 20, 101, -7, 4 1.152 +}, 1.153 +{ 1.154 + 3, -8, 42, 26, 0 1.155 +}, 1.156 +{ 1.157 + -15, 33, 68, 2, 23 1.158 +}, 1.159 +{ 1.160 + -2, 55, 46, -2, 15 1.161 +}, 1.162 +{ 1.163 + 3, -1, 21, 16, 41 1.164 +} 1.165 +}; 1.166 + 1.167 +static const opus_int8 silk_LTP_gain_vq_2[32][5] = 1.168 +{ 1.169 +{ 1.170 + -6, 27, 61, 39, 5 1.171 +}, 1.172 +{ 1.173 + -11, 42, 88, 4, 1 1.174 +}, 1.175 +{ 1.176 + -2, 60, 65, 6, -4 1.177 +}, 1.178 +{ 1.179 + -1, -5, 73, 56, 1 1.180 +}, 1.181 +{ 1.182 + -9, 19, 94, 29, -9 1.183 +}, 1.184 +{ 1.185 + 0, 12, 99, 6, 4 1.186 +}, 1.187 +{ 1.188 + 8, -19, 102, 46, -13 1.189 +}, 1.190 +{ 1.191 + 3, 2, 13, 3, 2 1.192 +}, 1.193 +{ 1.194 + 9, -21, 84, 72, -18 1.195 +}, 1.196 +{ 1.197 + -11, 46, 104, -22, 8 1.198 +}, 1.199 +{ 1.200 + 18, 38, 48, 23, 0 1.201 +}, 1.202 +{ 1.203 + -16, 70, 83, -21, 11 1.204 +}, 1.205 +{ 1.206 + 5, -11, 117, 22, -8 1.207 +}, 1.208 +{ 1.209 + -6, 23, 117, -12, 3 1.210 +}, 1.211 +{ 1.212 + 3, -8, 95, 28, 4 1.213 +}, 1.214 +{ 1.215 + -10, 15, 77, 60, -15 1.216 +}, 1.217 +{ 1.218 + -1, 4, 124, 2, -4 1.219 +}, 1.220 +{ 1.221 + 3, 38, 84, 24, -25 1.222 +}, 1.223 +{ 1.224 + 2, 13, 42, 13, 31 1.225 +}, 1.226 +{ 1.227 + 21, -4, 56, 46, -1 1.228 +}, 1.229 +{ 1.230 + -1, 35, 79, -13, 19 1.231 +}, 1.232 +{ 1.233 + -7, 65, 88, -9, -14 1.234 +}, 1.235 +{ 1.236 + 20, 4, 81, 49, -29 1.237 +}, 1.238 +{ 1.239 + 20, 0, 75, 3, -17 1.240 +}, 1.241 +{ 1.242 + 5, -9, 44, 92, -8 1.243 +}, 1.244 +{ 1.245 + 1, -3, 22, 69, 31 1.246 +}, 1.247 +{ 1.248 + -6, 95, 41, -12, 5 1.249 +}, 1.250 +{ 1.251 + 39, 67, 16, -4, 1 1.252 +}, 1.253 +{ 1.254 + 0, -6, 120, 55, -36 1.255 +}, 1.256 +{ 1.257 + -13, 44, 122, 4, -24 1.258 +}, 1.259 +{ 1.260 + 81, 5, 11, 3, 7 1.261 +}, 1.262 +{ 1.263 + 2, 0, 9, 10, 88 1.264 +} 1.265 +}; 1.266 + 1.267 +const opus_int8 * const silk_LTP_vq_ptrs_Q7[NB_LTP_CBKS] = { 1.268 + (opus_int8 *)&silk_LTP_gain_vq_0[0][0], 1.269 + (opus_int8 *)&silk_LTP_gain_vq_1[0][0], 1.270 + (opus_int8 *)&silk_LTP_gain_vq_2[0][0] 1.271 +}; 1.272 + 1.273 +/* Maximum frequency-dependent response of the pitch taps above, 1.274 + computed as max(abs(freqz(taps))) */ 1.275 +static const opus_uint8 silk_LTP_gain_vq_0_gain[8] = { 1.276 + 46, 2, 90, 87, 93, 91, 82, 98 1.277 +}; 1.278 + 1.279 +static const opus_uint8 silk_LTP_gain_vq_1_gain[16] = { 1.280 + 109, 120, 118, 12, 113, 115, 117, 119, 1.281 + 99, 59, 87, 111, 63, 111, 112, 80 1.282 +}; 1.283 + 1.284 +static const opus_uint8 silk_LTP_gain_vq_2_gain[32] = { 1.285 + 126, 124, 125, 124, 129, 121, 126, 23, 1.286 + 132, 127, 127, 127, 126, 127, 122, 133, 1.287 + 130, 134, 101, 118, 119, 145, 126, 86, 1.288 + 124, 120, 123, 119, 170, 173, 107, 109 1.289 +}; 1.290 + 1.291 +const opus_uint8 * const silk_LTP_vq_gain_ptrs_Q7[NB_LTP_CBKS] = { 1.292 + &silk_LTP_gain_vq_0_gain[0], 1.293 + &silk_LTP_gain_vq_1_gain[0], 1.294 + &silk_LTP_gain_vq_2_gain[0] 1.295 +}; 1.296 + 1.297 +const opus_int8 silk_LTP_vq_sizes[NB_LTP_CBKS] = { 1.298 + 8, 16, 32 1.299 +};