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