Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /*********************************************************************** |
michael@0 | 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
michael@0 | 3 | Redistribution and use in source and binary forms, with or without |
michael@0 | 4 | modification, are permitted provided that the following conditions |
michael@0 | 5 | are met: |
michael@0 | 6 | - Redistributions of source code must retain the above copyright notice, |
michael@0 | 7 | this list of conditions and the following disclaimer. |
michael@0 | 8 | - Redistributions in binary form must reproduce the above copyright |
michael@0 | 9 | notice, this list of conditions and the following disclaimer in the |
michael@0 | 10 | documentation and/or other materials provided with the distribution. |
michael@0 | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
michael@0 | 12 | names of specific contributors, may be used to endorse or promote |
michael@0 | 13 | products derived from this software without specific prior written |
michael@0 | 14 | permission. |
michael@0 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
michael@0 | 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
michael@0 | 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
michael@0 | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
michael@0 | 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
michael@0 | 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
michael@0 | 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
michael@0 | 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
michael@0 | 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
michael@0 | 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
michael@0 | 25 | POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 26 | ***********************************************************************/ |
michael@0 | 27 | |
michael@0 | 28 | #ifdef HAVE_CONFIG_H |
michael@0 | 29 | #include "config.h" |
michael@0 | 30 | #endif |
michael@0 | 31 | |
michael@0 | 32 | #include "tables.h" |
michael@0 | 33 | |
michael@0 | 34 | const opus_uint8 silk_LTP_per_index_iCDF[3] = { |
michael@0 | 35 | 179, 99, 0 |
michael@0 | 36 | }; |
michael@0 | 37 | |
michael@0 | 38 | static const opus_uint8 silk_LTP_gain_iCDF_0[8] = { |
michael@0 | 39 | 71, 56, 43, 30, 21, 12, 6, 0 |
michael@0 | 40 | }; |
michael@0 | 41 | |
michael@0 | 42 | static const opus_uint8 silk_LTP_gain_iCDF_1[16] = { |
michael@0 | 43 | 199, 165, 144, 124, 109, 96, 84, 71, |
michael@0 | 44 | 61, 51, 42, 32, 23, 15, 8, 0 |
michael@0 | 45 | }; |
michael@0 | 46 | |
michael@0 | 47 | static const opus_uint8 silk_LTP_gain_iCDF_2[32] = { |
michael@0 | 48 | 241, 225, 211, 199, 187, 175, 164, 153, |
michael@0 | 49 | 142, 132, 123, 114, 105, 96, 88, 80, |
michael@0 | 50 | 72, 64, 57, 50, 44, 38, 33, 29, |
michael@0 | 51 | 24, 20, 16, 12, 9, 5, 2, 0 |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | const opus_int16 silk_LTP_gain_middle_avg_RD_Q14 = 12304; |
michael@0 | 55 | |
michael@0 | 56 | static const opus_uint8 silk_LTP_gain_BITS_Q5_0[8] = { |
michael@0 | 57 | 15, 131, 138, 138, 155, 155, 173, 173 |
michael@0 | 58 | }; |
michael@0 | 59 | |
michael@0 | 60 | static const opus_uint8 silk_LTP_gain_BITS_Q5_1[16] = { |
michael@0 | 61 | 69, 93, 115, 118, 131, 138, 141, 138, |
michael@0 | 62 | 150, 150, 155, 150, 155, 160, 166, 160 |
michael@0 | 63 | }; |
michael@0 | 64 | |
michael@0 | 65 | static const opus_uint8 silk_LTP_gain_BITS_Q5_2[32] = { |
michael@0 | 66 | 131, 128, 134, 141, 141, 141, 145, 145, |
michael@0 | 67 | 145, 150, 155, 155, 155, 155, 160, 160, |
michael@0 | 68 | 160, 160, 166, 166, 173, 173, 182, 192, |
michael@0 | 69 | 182, 192, 192, 192, 205, 192, 205, 224 |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | const opus_uint8 * const silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = { |
michael@0 | 73 | silk_LTP_gain_iCDF_0, |
michael@0 | 74 | silk_LTP_gain_iCDF_1, |
michael@0 | 75 | silk_LTP_gain_iCDF_2 |
michael@0 | 76 | }; |
michael@0 | 77 | |
michael@0 | 78 | const opus_uint8 * const silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = { |
michael@0 | 79 | silk_LTP_gain_BITS_Q5_0, |
michael@0 | 80 | silk_LTP_gain_BITS_Q5_1, |
michael@0 | 81 | silk_LTP_gain_BITS_Q5_2 |
michael@0 | 82 | }; |
michael@0 | 83 | |
michael@0 | 84 | static const opus_int8 silk_LTP_gain_vq_0[8][5] = |
michael@0 | 85 | { |
michael@0 | 86 | { |
michael@0 | 87 | 4, 6, 24, 7, 5 |
michael@0 | 88 | }, |
michael@0 | 89 | { |
michael@0 | 90 | 0, 0, 2, 0, 0 |
michael@0 | 91 | }, |
michael@0 | 92 | { |
michael@0 | 93 | 12, 28, 41, 13, -4 |
michael@0 | 94 | }, |
michael@0 | 95 | { |
michael@0 | 96 | -9, 15, 42, 25, 14 |
michael@0 | 97 | }, |
michael@0 | 98 | { |
michael@0 | 99 | 1, -2, 62, 41, -9 |
michael@0 | 100 | }, |
michael@0 | 101 | { |
michael@0 | 102 | -10, 37, 65, -4, 3 |
michael@0 | 103 | }, |
michael@0 | 104 | { |
michael@0 | 105 | -6, 4, 66, 7, -8 |
michael@0 | 106 | }, |
michael@0 | 107 | { |
michael@0 | 108 | 16, 14, 38, -3, 33 |
michael@0 | 109 | } |
michael@0 | 110 | }; |
michael@0 | 111 | |
michael@0 | 112 | static const opus_int8 silk_LTP_gain_vq_1[16][5] = |
michael@0 | 113 | { |
michael@0 | 114 | { |
michael@0 | 115 | 13, 22, 39, 23, 12 |
michael@0 | 116 | }, |
michael@0 | 117 | { |
michael@0 | 118 | -1, 36, 64, 27, -6 |
michael@0 | 119 | }, |
michael@0 | 120 | { |
michael@0 | 121 | -7, 10, 55, 43, 17 |
michael@0 | 122 | }, |
michael@0 | 123 | { |
michael@0 | 124 | 1, 1, 8, 1, 1 |
michael@0 | 125 | }, |
michael@0 | 126 | { |
michael@0 | 127 | 6, -11, 74, 53, -9 |
michael@0 | 128 | }, |
michael@0 | 129 | { |
michael@0 | 130 | -12, 55, 76, -12, 8 |
michael@0 | 131 | }, |
michael@0 | 132 | { |
michael@0 | 133 | -3, 3, 93, 27, -4 |
michael@0 | 134 | }, |
michael@0 | 135 | { |
michael@0 | 136 | 26, 39, 59, 3, -8 |
michael@0 | 137 | }, |
michael@0 | 138 | { |
michael@0 | 139 | 2, 0, 77, 11, 9 |
michael@0 | 140 | }, |
michael@0 | 141 | { |
michael@0 | 142 | -8, 22, 44, -6, 7 |
michael@0 | 143 | }, |
michael@0 | 144 | { |
michael@0 | 145 | 40, 9, 26, 3, 9 |
michael@0 | 146 | }, |
michael@0 | 147 | { |
michael@0 | 148 | -7, 20, 101, -7, 4 |
michael@0 | 149 | }, |
michael@0 | 150 | { |
michael@0 | 151 | 3, -8, 42, 26, 0 |
michael@0 | 152 | }, |
michael@0 | 153 | { |
michael@0 | 154 | -15, 33, 68, 2, 23 |
michael@0 | 155 | }, |
michael@0 | 156 | { |
michael@0 | 157 | -2, 55, 46, -2, 15 |
michael@0 | 158 | }, |
michael@0 | 159 | { |
michael@0 | 160 | 3, -1, 21, 16, 41 |
michael@0 | 161 | } |
michael@0 | 162 | }; |
michael@0 | 163 | |
michael@0 | 164 | static const opus_int8 silk_LTP_gain_vq_2[32][5] = |
michael@0 | 165 | { |
michael@0 | 166 | { |
michael@0 | 167 | -6, 27, 61, 39, 5 |
michael@0 | 168 | }, |
michael@0 | 169 | { |
michael@0 | 170 | -11, 42, 88, 4, 1 |
michael@0 | 171 | }, |
michael@0 | 172 | { |
michael@0 | 173 | -2, 60, 65, 6, -4 |
michael@0 | 174 | }, |
michael@0 | 175 | { |
michael@0 | 176 | -1, -5, 73, 56, 1 |
michael@0 | 177 | }, |
michael@0 | 178 | { |
michael@0 | 179 | -9, 19, 94, 29, -9 |
michael@0 | 180 | }, |
michael@0 | 181 | { |
michael@0 | 182 | 0, 12, 99, 6, 4 |
michael@0 | 183 | }, |
michael@0 | 184 | { |
michael@0 | 185 | 8, -19, 102, 46, -13 |
michael@0 | 186 | }, |
michael@0 | 187 | { |
michael@0 | 188 | 3, 2, 13, 3, 2 |
michael@0 | 189 | }, |
michael@0 | 190 | { |
michael@0 | 191 | 9, -21, 84, 72, -18 |
michael@0 | 192 | }, |
michael@0 | 193 | { |
michael@0 | 194 | -11, 46, 104, -22, 8 |
michael@0 | 195 | }, |
michael@0 | 196 | { |
michael@0 | 197 | 18, 38, 48, 23, 0 |
michael@0 | 198 | }, |
michael@0 | 199 | { |
michael@0 | 200 | -16, 70, 83, -21, 11 |
michael@0 | 201 | }, |
michael@0 | 202 | { |
michael@0 | 203 | 5, -11, 117, 22, -8 |
michael@0 | 204 | }, |
michael@0 | 205 | { |
michael@0 | 206 | -6, 23, 117, -12, 3 |
michael@0 | 207 | }, |
michael@0 | 208 | { |
michael@0 | 209 | 3, -8, 95, 28, 4 |
michael@0 | 210 | }, |
michael@0 | 211 | { |
michael@0 | 212 | -10, 15, 77, 60, -15 |
michael@0 | 213 | }, |
michael@0 | 214 | { |
michael@0 | 215 | -1, 4, 124, 2, -4 |
michael@0 | 216 | }, |
michael@0 | 217 | { |
michael@0 | 218 | 3, 38, 84, 24, -25 |
michael@0 | 219 | }, |
michael@0 | 220 | { |
michael@0 | 221 | 2, 13, 42, 13, 31 |
michael@0 | 222 | }, |
michael@0 | 223 | { |
michael@0 | 224 | 21, -4, 56, 46, -1 |
michael@0 | 225 | }, |
michael@0 | 226 | { |
michael@0 | 227 | -1, 35, 79, -13, 19 |
michael@0 | 228 | }, |
michael@0 | 229 | { |
michael@0 | 230 | -7, 65, 88, -9, -14 |
michael@0 | 231 | }, |
michael@0 | 232 | { |
michael@0 | 233 | 20, 4, 81, 49, -29 |
michael@0 | 234 | }, |
michael@0 | 235 | { |
michael@0 | 236 | 20, 0, 75, 3, -17 |
michael@0 | 237 | }, |
michael@0 | 238 | { |
michael@0 | 239 | 5, -9, 44, 92, -8 |
michael@0 | 240 | }, |
michael@0 | 241 | { |
michael@0 | 242 | 1, -3, 22, 69, 31 |
michael@0 | 243 | }, |
michael@0 | 244 | { |
michael@0 | 245 | -6, 95, 41, -12, 5 |
michael@0 | 246 | }, |
michael@0 | 247 | { |
michael@0 | 248 | 39, 67, 16, -4, 1 |
michael@0 | 249 | }, |
michael@0 | 250 | { |
michael@0 | 251 | 0, -6, 120, 55, -36 |
michael@0 | 252 | }, |
michael@0 | 253 | { |
michael@0 | 254 | -13, 44, 122, 4, -24 |
michael@0 | 255 | }, |
michael@0 | 256 | { |
michael@0 | 257 | 81, 5, 11, 3, 7 |
michael@0 | 258 | }, |
michael@0 | 259 | { |
michael@0 | 260 | 2, 0, 9, 10, 88 |
michael@0 | 261 | } |
michael@0 | 262 | }; |
michael@0 | 263 | |
michael@0 | 264 | const opus_int8 * const silk_LTP_vq_ptrs_Q7[NB_LTP_CBKS] = { |
michael@0 | 265 | (opus_int8 *)&silk_LTP_gain_vq_0[0][0], |
michael@0 | 266 | (opus_int8 *)&silk_LTP_gain_vq_1[0][0], |
michael@0 | 267 | (opus_int8 *)&silk_LTP_gain_vq_2[0][0] |
michael@0 | 268 | }; |
michael@0 | 269 | |
michael@0 | 270 | /* Maximum frequency-dependent response of the pitch taps above, |
michael@0 | 271 | computed as max(abs(freqz(taps))) */ |
michael@0 | 272 | static const opus_uint8 silk_LTP_gain_vq_0_gain[8] = { |
michael@0 | 273 | 46, 2, 90, 87, 93, 91, 82, 98 |
michael@0 | 274 | }; |
michael@0 | 275 | |
michael@0 | 276 | static const opus_uint8 silk_LTP_gain_vq_1_gain[16] = { |
michael@0 | 277 | 109, 120, 118, 12, 113, 115, 117, 119, |
michael@0 | 278 | 99, 59, 87, 111, 63, 111, 112, 80 |
michael@0 | 279 | }; |
michael@0 | 280 | |
michael@0 | 281 | static const opus_uint8 silk_LTP_gain_vq_2_gain[32] = { |
michael@0 | 282 | 126, 124, 125, 124, 129, 121, 126, 23, |
michael@0 | 283 | 132, 127, 127, 127, 126, 127, 122, 133, |
michael@0 | 284 | 130, 134, 101, 118, 119, 145, 126, 86, |
michael@0 | 285 | 124, 120, 123, 119, 170, 173, 107, 109 |
michael@0 | 286 | }; |
michael@0 | 287 | |
michael@0 | 288 | const opus_uint8 * const silk_LTP_vq_gain_ptrs_Q7[NB_LTP_CBKS] = { |
michael@0 | 289 | &silk_LTP_gain_vq_0_gain[0], |
michael@0 | 290 | &silk_LTP_gain_vq_1_gain[0], |
michael@0 | 291 | &silk_LTP_gain_vq_2_gain[0] |
michael@0 | 292 | }; |
michael@0 | 293 | |
michael@0 | 294 | const opus_int8 silk_LTP_vq_sizes[NB_LTP_CBKS] = { |
michael@0 | 295 | 8, 16, 32 |
michael@0 | 296 | }; |