FFmpeg
ilbcdata.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, The WebRTC project authors. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  *
16  * * Neither the name of Google nor the names of its contributors may
17  * be used to endorse or promote products derived from this software
18  * without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef AVCODEC_ILBCDATA_H
34 #define AVCODEC_ILBCDATA_H
35 
36 #include "libavutil/common.h"
37 
38 static const uint8_t lsf_dim_codebook[] = { 3, 3, 4 };
39 static const uint8_t lsf_size_codebook[] = { 64, 128, 128 };
40 static const int16_t lsf_weight_20ms[] = { 12288, 8192, 4096, 0 };
41 static const int16_t lsf_weight_30ms[] = { 8192, 16384, 10923, 5461, 0, 0 };
42 
43 static const int16_t hp_out_coeffs[] = { 3849, -7699, 3849, 7918, -3833 };
44 
45 static const int16_t kPlcPfSlope[] = { 26667, 18729, 13653, 10258, 7901, 6214 };
46 
47 static const int16_t kPlcPitchFact[] = { 0, 5462, 10922, 16384, 21846, 27306 };
48 
49 static const int16_t kCbFiltersRev[] = {
50  -140, 446, -755, 3302, 2922, -590, 343, -138
51 };
52 
53 static const int16_t kPlcPerSqr[] = { 839, 1343, 2048, 2998, 4247, 5849 };
54 
55 static const int16_t alpha[] = {
56  6554, 13107, 19661, 26214
57 };
58 
59 static const int16_t kLpcChirpSyntDenum[] = {
60  32767, 29573, 26690, 24087, 21739, 19619, 17707, 15980, 14422, 13016, 11747
61 };
62 
63 static const int16_t LpcChirpWeightDenum[] = {
64  32767, 13835, 5841, 2466, 1041, 440, 186, 78, 33, 14, 6
65 };
66 
67 static const int16_t cos_tbl[64] = {
68  32767, 32729, 32610, 32413, 32138, 31786, 31357, 30853,
69  30274, 29622, 28899, 28106, 27246, 26320, 25330, 24279,
70  23170, 22006, 20788, 19520, 18205, 16846, 15447, 14010,
71  12540, 11039, 9512, 7962, 6393, 4808, 3212, 1608,
72  0, -1608, -3212, -4808, -6393, -7962, -9512, -11039,
73  -12540, -14010, -15447, -16846, -18205, -19520, -20788, -22006,
74  -23170, -24279, -25330, -26320, -27246, -28106, -28899, -29622,
75  -30274, -30853, -31357, -31786, -32138, -32413, -32610, -32729,
76 };
77 
78 static const int16_t cos_derivative_tbl[64] = {
79  -632, -1893, -3150, -4399, -5638, -6863, -8072, -9261,
80  -10428, -11570, -12684, -13767, -14817, -15832, -16808, -17744,
81  -18637, -19486, -20287, -21039, -21741, -22390, -22986, -23526,
82  -24009, -24435, -24801, -25108, -25354, -25540, -25664, -25726,
83  -25726, -25664, -25540, -25354, -25108, -24801, -24435, -24009,
84  -23526, -22986, -22390, -21741, -21039, -20287, -19486, -18637,
85  -17744, -16808, -15832, -14817, -13767, -12684, -11570, -10428,
86  -9261, -8072, -6863, -5638, -4399, -3150, -1893, -632
87 };
88 
89 static const int16_t lsf_codebook[64 * 3 + 128 * 3 + 128 * 4] = {
90  1273, 2238, 3696, 3199, 5309, 8209, 3606, 5671, 7829,
91  2815, 5262, 8778, 2608, 4027, 5493, 1582, 3076, 5945,
92  2983, 4181, 5396, 2437, 4322, 6902, 1861, 2998, 4613,
93  2007, 3250, 5214, 1388, 2459, 4262, 2563, 3805, 5269,
94  2036, 3522, 5129, 1935, 4025, 6694, 2744, 5121, 7338,
95  2810, 4248, 5723, 3054, 5405, 7745, 1449, 2593, 4763,
96  3411, 5128, 6596, 2484, 4659, 7496, 1668, 2879, 4818,
97  1812, 3072, 5036, 1638, 2649, 3900, 2464, 3550, 4644,
98  1853, 2900, 4158, 2458, 4163, 5830, 2556, 4036, 6254,
99  2703, 4432, 6519, 3062, 4953, 7609, 1725, 3703, 6187,
100  2221, 3877, 5427, 2339, 3579, 5197, 2021, 4633, 7037,
101  2216, 3328, 4535, 2961, 4739, 6667, 2807, 3955, 5099,
102  2788, 4501, 6088, 1642, 2755, 4431, 3341, 5282, 7333,
103  2414, 3726, 5727, 1582, 2822, 5269, 2259, 3447, 4905,
104  3117, 4986, 7054, 1825, 3491, 5542, 3338, 5736, 8627,
105  1789, 3090, 5488, 2566, 3720, 4923, 2846, 4682, 7161,
106  1950, 3321, 5976, 1834, 3383, 6734, 3238, 4769, 6094,
107  2031, 3978, 5903, 1877, 4068, 7436, 2131, 4644, 8296,
108  2764, 5010, 8013, 2194, 3667, 6302, 2053, 3127, 4342,
109  3523, 6595, 10010, 3134, 4457, 5748, 3142, 5819, 9414,
110  2223, 4334, 6353, 2022, 3224, 4822, 2186, 3458, 5544,
111  2552, 4757, 6870, 10905, 12917, 14578, 9503, 11485, 14485,
112  9518, 12494, 14052, 6222, 7487, 9174, 7759, 9186, 10506,
113  8315, 12755, 14786, 9609, 11486, 13866, 8909, 12077, 13643,
114  7369, 9054, 11520, 9408, 12163, 14715, 6436, 9911, 12843,
115  7109, 9556, 11884, 7557, 10075, 11640, 6482, 9202, 11547,
116  6463, 7914, 10980, 8611, 10427, 12752, 7101, 9676, 12606,
117  7428, 11252, 13172, 10197, 12955, 15842, 7487, 10955, 12613,
118  5575, 7858, 13621, 7268, 11719, 14752, 7476, 11744, 13795,
119  7049, 8686, 11922, 8234, 11314, 13983, 6560, 11173, 14984,
120  6405, 9211, 12337, 8222, 12054, 13801, 8039, 10728, 13255,
121  10066, 12733, 14389, 6016, 7338, 10040, 6896, 8648, 10234,
122  7538, 9170, 12175, 7327, 12608, 14983, 10516, 12643, 15223,
123  5538, 7644, 12213, 6728, 12221, 14253, 7563, 9377, 12948,
124  8661, 11023, 13401, 7280, 8806, 11085, 7723, 9793, 12333,
125  12225, 14648, 16709, 8768, 13389, 15245, 10267, 12197, 13812,
126  5301, 7078, 11484, 7100, 10280, 11906, 8716, 12555, 14183,
127  9567, 12464, 15434, 7832, 12305, 14300, 7608, 10556, 12121,
128  8913, 11311, 12868, 7414, 9722, 11239, 8666, 11641, 13250,
129  9079, 10752, 12300, 8024, 11608, 13306, 10453, 13607, 16449,
130  8135, 9573, 10909, 6375, 7741, 10125, 10025, 12217, 14874,
131  6985, 11063, 14109, 9296, 13051, 14642, 8613, 10975, 12542,
132  6583, 10414, 13534, 6191, 9368, 13430, 5742, 6859, 9260,
133  7723, 9813, 13679, 8137, 11291, 12833, 6562, 8973, 10641,
134  6062, 8462, 11335, 6928, 8784, 12647, 7501, 8784, 10031,
135  8372, 10045, 12135, 8191, 9864, 12746, 5917, 7487, 10979,
136  5516, 6848, 10318, 6819, 9899, 11421, 7882, 12912, 15670,
137  9558, 11230, 12753, 7752, 9327, 11472, 8479, 9980, 11358,
138  11418, 14072, 16386, 7968, 10330, 14423, 8423, 10555, 12162,
139  6337, 10306, 14391, 8850, 10879, 14276, 6750, 11885, 15710,
140  7037, 8328, 9764, 6914, 9266, 13476, 9746, 13949, 15519,
141  11032, 14444, 16925, 8032, 10271, 11810, 10962, 13451, 15833,
142  10021, 11667, 13324, 6273, 8226, 12936, 8543, 10397, 13496,
143  7936, 10302, 12745, 6769, 8138, 10446, 6081, 7786, 11719,
144  8637, 11795, 14975, 8790, 10336, 11812, 7040, 8490, 10771,
145  7338, 10381, 13153, 6598, 7888, 9358, 6518, 8237, 12030,
146  9055, 10763, 12983, 6490, 10009, 12007, 9589, 12023, 13632,
147  6867, 9447, 10995, 7930, 9816, 11397, 10241, 13300, 14939,
148  5830, 8670, 12387, 9870, 11915, 14247, 9318, 11647, 13272,
149  6721, 10836, 12929, 6543, 8233, 9944, 8034, 10854, 12394,
150  9112, 11787, 14218, 9302, 11114, 13400, 9022, 11366, 13816,
151  6962, 10461, 12480, 11288, 13333, 15222, 7249, 8974, 10547,
152  10566, 12336, 14390, 6697, 11339, 13521, 11851, 13944, 15826,
153  6847, 8381, 11349, 7509, 9331, 10939, 8029, 9618, 11909,
154  13973, 17644, 19647, 22474, 14722, 16522, 20035, 22134, 16305, 18179, 21106, 23048,
155  15150, 17948, 21394, 23225, 13582, 15191, 17687, 22333, 11778, 15546, 18458, 21753,
156  16619, 18410, 20827, 23559, 14229, 15746, 17907, 22474, 12465, 15327, 20700, 22831,
157  15085, 16799, 20182, 23410, 13026, 16935, 19890, 22892, 14310, 16854, 19007, 22944,
158  14210, 15897, 18891, 23154, 14633, 18059, 20132, 22899, 15246, 17781, 19780, 22640,
159  16396, 18904, 20912, 23035, 14618, 17401, 19510, 21672, 15473, 17497, 19813, 23439,
160  18851, 20736, 22323, 23864, 15055, 16804, 18530, 20916, 16490, 18196, 19990, 21939,
161  11711, 15223, 21154, 23312, 13294, 15546, 19393, 21472, 12956, 16060, 20610, 22417,
162  11628, 15843, 19617, 22501, 14106, 16872, 19839, 22689, 15655, 18192, 20161, 22452,
163  12953, 15244, 20619, 23549, 15322, 17193, 19926, 21762, 16873, 18676, 20444, 22359,
164  14874, 17871, 20083, 21959, 11534, 14486, 19194, 21857, 17766, 19617, 21338, 23178,
165  13404, 15284, 19080, 23136, 15392, 17527, 19470, 21953, 14462, 16153, 17985, 21192,
166  17734, 19750, 21903, 23783, 16973, 19096, 21675, 23815, 16597, 18936, 21257, 23461,
167  15966, 17865, 20602, 22920, 15416, 17456, 20301, 22972, 18335, 20093, 21732, 23497,
168  15548, 17217, 20679, 23594, 15208, 16995, 20816, 22870, 13890, 18015, 20531, 22468,
169  13211, 15377, 19951, 22388, 12852, 14635, 17978, 22680, 16002, 17732, 20373, 23544,
170  11373, 14134, 19534, 22707, 17329, 19151, 21241, 23462, 15612, 17296, 19362, 22850,
171  15422, 19104, 21285, 23164, 13792, 17111, 19349, 21370, 15352, 17876, 20776, 22667,
172  15253, 16961, 18921, 22123, 14108, 17264, 20294, 23246, 15785, 17897, 20010, 21822,
173  17399, 19147, 20915, 22753, 13010, 15659, 18127, 20840, 16826, 19422, 22218, 24084,
174  18108, 20641, 22695, 24237, 18018, 20273, 22268, 23920, 16057, 17821, 21365, 23665,
175  16005, 17901, 19892, 23016, 13232, 16683, 21107, 23221, 13280, 16615, 19915, 21829,
176  14950, 18575, 20599, 22511, 16337, 18261, 20277, 23216, 14306, 16477, 21203, 23158,
177  12803, 17498, 20248, 22014, 14327, 17068, 20160, 22006, 14402, 17461, 21599, 23688,
178  16968, 18834, 20896, 23055, 15070, 17157, 20451, 22315, 15419, 17107, 21601, 23946,
179  16039, 17639, 19533, 21424, 16326, 19261, 21745, 23673, 16489, 18534, 21658, 23782,
180  16594, 18471, 20549, 22807, 18973, 21212, 22890, 24278, 14264, 18674, 21123, 23071,
181  15117, 16841, 19239, 23118, 13762, 15782, 20478, 23230, 14111, 15949, 20058, 22354,
182  14990, 16738, 21139, 23492, 13735, 16971, 19026, 22158, 14676, 17314, 20232, 22807,
183  16196, 18146, 20459, 22339, 14747, 17258, 19315, 22437, 14973, 17778, 20692, 23367,
184  15715, 17472, 20385, 22349, 15702, 18228, 20829, 23410, 14428, 16188, 20541, 23630,
185  16824, 19394, 21365, 23246, 13069, 16392, 18900, 21121, 12047, 16640, 19463, 21689,
186  14757, 17433, 19659, 23125, 15185, 16930, 19900, 22540, 16026, 17725, 19618, 22399,
187  16086, 18643, 21179, 23472, 15462, 17248, 19102, 21196, 17368, 20016, 22396, 24096,
188  12340, 14475, 19665, 23362, 13636, 16229, 19462, 22728, 14096, 16211, 19591, 21635,
189  12152, 14867, 19943, 22301, 14492, 17503, 21002, 22728, 14834, 16788, 19447, 21411,
190  14650, 16433, 19326, 22308, 14624, 16328, 19659, 23204, 13888, 16572, 20665, 22488,
191  12977, 16102, 18841, 22246, 15523, 18431, 21757, 23738, 14095, 16349, 18837, 20947,
192  13266, 17809, 21088, 22839, 15427, 18190, 20270, 23143, 11859, 16753, 20935, 22486,
193  12310, 17667, 21736, 23319, 14021, 15926, 18702, 22002, 12286, 15299, 19178, 21126,
194  15703, 17491, 21039, 23151, 12272, 14018, 18213, 22570, 14817, 16364, 18485, 22598,
195  17109, 19683, 21851, 23677, 12657, 14903, 19039, 22061, 14713, 16487, 20527, 22814,
196  14635, 16726, 18763, 21715, 15878, 18550, 20718, 22906
197 };
198 
199 static const int16_t gain3[9]={
200  -16384, -10813, -5407, 0, 4096, 8192, 12288, 16384, 32767
201 };
202 
203 static const int16_t gain4[17]={
204  -17203, -14746, -12288, -9830, -7373, -4915, -2458, 0, 2458, 4915, 7373, 9830,
205  12288, 14746, 17203, 19661, 32767
206 };
207 
208 static const int16_t gain5[33]={
209  614, 1229, 1843, 2458, 3072, 3686,
210  4301, 4915, 5530, 6144, 6758, 7373,
211  7987, 8602, 9216, 9830, 10445, 11059,
212  11674, 12288, 12902, 13517, 14131, 14746,
213  15360, 15974, 16589, 17203, 17818, 18432,
214  19046, 19661, 32767
215 };
216 
217 static const int16_t *const ilbc_gain[] = {
218  gain5, gain4, gain3,
219 };
220 
221 static const int16_t ilbc_state[8] = {
222  -30473, -17838, -9257, -2537, 3639, 10893, 19958, 32636
223 };
224 
225 static const int16_t frg_quant_mod[64] = {
226  /* First 37 values in Q8 */
227  569, 671, 786, 916, 1077, 1278,
228  1529, 1802, 2109, 2481, 2898, 3440,
229  3943, 4535, 5149, 5778, 6464, 7208,
230  7904, 8682, 9397, 10285, 11240, 12246,
231  13313, 14382, 15492, 16735, 18131, 19693,
232  21280, 22912, 24624, 26544, 28432, 30488,
233  32720,
234  /* 22 values in Q5 */
235  4383, 4684, 5012, 5363, 5739, 6146,
236  6603, 7113, 7679, 8285, 9040, 9850,
237  10838, 11882, 13103, 14467, 15950, 17669,
238  19712, 22016, 24800, 28576,
239  /* 5 values in Q3 */
240  8240, 9792, 12040, 15440, 22472
241 };
242 
243 #endif /* AVCODEC_ILBCDATA_H */
static const int16_t cos_derivative_tbl[64]
Definition: ilbcdata.h:78
static const int16_t gain3[9]
Definition: ilbcdata.h:199
static const int16_t hp_out_coeffs[]
Definition: ilbcdata.h:43
static const int16_t frg_quant_mod[64]
Definition: ilbcdata.h:225
uint8_t
static const int16_t kPlcPfSlope[]
Definition: ilbcdata.h:45
static const uint8_t lsf_size_codebook[]
Definition: ilbcdata.h:39
static const int16_t cos_tbl[64]
Definition: ilbcdata.h:67
static const int16_t LpcChirpWeightDenum[]
Definition: ilbcdata.h:63
static const int16_t kPlcPitchFact[]
Definition: ilbcdata.h:47
static const int16_t alpha[]
Definition: ilbcdata.h:55
static const int16_t lsf_codebook[64 *3+128 *3+128 *4]
Definition: ilbcdata.h:89
static const int16_t gain4[17]
Definition: ilbcdata.h:203
static const int16_t *const ilbc_gain[]
Definition: ilbcdata.h:217
common internal and external API header
static const int16_t kPlcPerSqr[]
Definition: ilbcdata.h:53
static const int16_t kCbFiltersRev[]
Definition: ilbcdata.h:49
static const int16_t kLpcChirpSyntDenum[]
Definition: ilbcdata.h:59
static const int16_t lsf_weight_30ms[]
Definition: ilbcdata.h:41
static const int16_t gain5[33]
Definition: ilbcdata.h:208
static const int16_t ilbc_state[8]
Definition: ilbcdata.h:221
static const uint8_t lsf_dim_codebook[]
Definition: ilbcdata.h:38
static const int16_t lsf_weight_20ms[]
Definition: ilbcdata.h:40