/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/* coding tables for the KLT coefficients */
#include "lpc_tables.h"
#include "settings.h"
/* cdf array for model indicator */
const uint16_t WebRtcIsac_kQKltModelCdf[4] = {
0, 15434, 37548, 65535 };
/* pointer to cdf array for model indicator */
const uint16_t *WebRtcIsac_kQKltModelCdfPtr[1] = {
WebRtcIsac_kQKltModelCdf };
/* initial cdf index for decoder of model indicator */
const uint16_t WebRtcIsac_kQKltModelInitIndex[1] = { 1 };
/* offset to go from rounded value to quantization index */
const short WebRtcIsac_kQKltQuantMinGain[12] = {
3, 6, 4, 6, 6, 9, 5, 16, 11, 34, 32, 47 };
const short WebRtcIsac_kQKltQuantMinShape[108] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 2, 2, 2, 3, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1, 1, 1,
1, 1, 1, 2, 2, 3, 0, 0, 0, 0,
1, 0, 1, 1, 1, 1, 1, 1, 1, 2,
2, 4, 3, 5, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 2, 1, 2, 2, 3, 4,
4, 7, 0, 0, 1, 1, 1, 1, 1, 1,
1, 2, 3, 2, 3, 4, 4, 5, 7, 13,
0, 1, 1, 2, 3, 2, 2, 2, 4, 4,
5, 6, 7, 11, 9, 13, 12, 26 };
/* maximum quantization index */
const uint16_t WebRtcIsac_kQKltMaxIndGain[12] = {
6, 12, 8, 14, 10, 19, 12, 31, 22, 56, 52, 138 };
const uint16_t WebRtcIsac_kQKltMaxIndShape[108] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
2, 2, 2, 2, 4, 4, 5, 6, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1, 2, 2,
2, 2, 3, 4, 5, 7, 0, 0, 0, 0,
2, 0, 2, 2, 2, 2, 3, 2, 2, 4,
4, 6, 6, 9, 0, 0, 0, 0, 2, 2,
2, 2, 2, 2, 3, 2, 4, 4, 7, 7,
9, 13, 0, 0, 2, 2, 2, 2, 2, 2,
3, 4, 5, 4, 6, 8, 8, 10, 16, 25,
0, 2, 2, 4, 5, 4, 4, 4, 7, 8,
9, 10, 13, 19, 17, 23, 25, 49 };
/* index offset */
const uint16_t WebRtcIsac_kQKltOffsetGain[12] = {
0, 7, 20, 29, 44, 55, 75, 88, 120, 143, 200, 253 };
const uint16_t WebRtcIsac_kQKltOffsetShape[108] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
11, 14, 17, 20, 23, 28, 33, 39, 46, 47,
48, 49, 50, 52, 53, 54, 55, 56, 58, 61,
64, 67, 70, 74, 79, 85, 93, 94, 95, 96,
97, 100, 101, 104, 107, 110, 113, 117, 120, 123,
128, 133, 140, 147, 157, 158, 159, 160, 161, 164,
167, 170, 173, 176, 179, 183, 186, 191, 196, 204,
212, 222, 236, 237, 238, 241, 244, 247, 250, 253,
256, 260, 265, 271, 276, 283, 292, 301, 312, 329,
355, 356, 359, 362, 367, 373, 378, 383, 388, 396,
405, 415, 426, 440, 460, 478, 502, 528 };
/* initial cdf index for KLT coefficients */
const uint16_t WebRtcIsac_kQKltInitIndexGain[12] = {
3, 6, 4, 7, 5, 10, 6, 16, 11, 28, 26, 69};
const uint16_t WebRtcIsac_kQKltInitIndexShape[108] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 2, 2, 3, 3, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1, 1, 1,
1, 1, 2, 2, 3, 4, 0, 0, 0, 0,
1, 0, 1, 1, 1, 1, 2, 1, 1, 2,
2, 3, 3, 5, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 2, 1, 2, 2, 4, 4,
5, 7, 0, 0, 1, 1, 1, 1, 1, 1,
2, 2, 3, 2, 3, 4, 4, 5, 8, 13,
0, 1, 1, 2, 3, 2, 2, 2, 4, 4,
5, 5, 7, 10, 9, 12, 13, 25 };
/* quantizer representation levels */
const double WebRtcIsac_kQKltLevelsGain[392] = {
-2.78127126, -1.76745590, -0.77913790, -0.00437329, 0.79961206,
1.81775776, 2.81389782, -5.78753143, -4.88384084, -3.89320940,
-2.88133610, -1.92859977, -0.86347396, 0.02003888, 0.86140400,
1.89667156, 2.97134967, 3.98781964, 4.91727277, 5.82865898,
-4.11195874, -2.80898424, -1.87547977, -0.80943825, -0.00679084,
0.79573851, 1.83953397, 2.67586037, 3.76274082, -6.10933968,
-4.93034581, -3.89281296, -2.91530625, -1.89684163, -0.85319130,
-0.02275767, 0.86862017, 1.91578276, 2.96107339, 3.96543056,
4.91369908, 5.91058154, 6.83848343, 8.07136925, -5.87470395,
-4.84703049, -3.84284597, -2.86168446, -1.89290192, -0.82798145,
-0.00080013, 0.82594974, 1.85754329, 2.88351798, 3.96172628,
-8.85684885, -7.87387461, -6.97811862, -5.93256270, -4.94301439,
-3.95513701, -2.96041544, -1.94031192, -0.87961478, -0.00456201,
0.89911505, 1.91723376, 2.94011511, 3.93302540, 4.97990967,
5.93133404, 7.02181199, 7.92407762, 8.80155440, 10.04665814,
-4.82396678, -3.85612158, -2.89482244, -1.89558408, -0.90036978,
-0.00677823, 0.90607989, 1.90937981, 2.91175777, 3.91637730,
4.97565723, 5.84771228, 7.11145863, -16.07879840, -15.03776309,
-13.93905670, -12.95671800, -11.89171202, -10.95820934, -9.95923714,
-8.94357334, -7.99068299, -6.97481009, -5.94826231, -4.96673988,
-3.97490466, -2.97846970, -1.95130435, -0.94215262, -0.01444043,
0.96770704, 1.95848598, 2.94107862, 3.95666119, 4.97253085,
5.97191122, 6.93277360, 7.96608727, 8.87958779, 10.00264269,
10.86560820, 12.07449071, 13.04491775, 13.97507061, 14.91845261,
-10.85696295, -9.83365357, -9.01245635, -7.95915145, -6.95625003,
-5.95362618, -4.93468444, -3.98760978, -2.95044407, -1.97041277,
-0.97701799, -0.00840234, 0.97834289, 1.98361415, 2.97802439,
3.96415871, 4.95369042, 5.94101770, 6.92756798, 7.94063998,
8.85951828, 9.97077022, 11.00068503, -33.92030406, -32.81426422,
-32.00000000, -31.13243639, -30.11886909, -29.06017570, -28.12598824,
-27.22045482, -25.81215858, -25.07849962, -23.93018013, -23.02097643,
-21.89529725, -20.99091085, -19.98889048, -18.94327044, -17.96562071,
-16.96126218, -15.95054062, -14.98516200, -13.97101012, -13.02106500,
-11.98438006, -11.03216748, -9.95930286, -8.97043946, -7.98085082,
-6.98360995, -5.98998802, -4.98668173, -4.00032906, -3.00420619,
-1.98701132, -0.99324682, -0.00609324, 0.98297834, 1.99483076,
3.00305044, 3.97142097, 4.97525759, 5.98612258, 6.97448236,
7.97575900, 9.01086211, 9.98665542, 11.00541438, 11.98078628,
12.92352471, 14.06849675, 14.99949430, 15.94904834, 16.97440321,
18.04040916, 18.88987609, 20.05312391, 21.00000000, 21.79443341,
-31.98578825, -31.00000000, -29.89060567, -28.98555686, -27.97114102,
-26.84935410, -26.02402230, -24.94195278, -23.92336849, -22.95552382,
-21.97932836, -20.96055470, -19.99649553, -19.03436122, -17.96706525,
-17.01139515, -16.01363516, -14.99154248, -14.00298333, -12.99630613,
-11.99955519, -10.99000421, -10.00819092, -8.99763648, -7.98431793,
-7.01769025, -5.99604690, -4.99980697, -3.99334671, -3.01748192,
-2.02051217, -1.00848371, -0.01942358, 1.00477757, 1.95477872,
2.98593031, 3.98779079, 4.96862849, 6.02694771, 6.93983733,
7.89874717, 8.99615862, 10.02367921, 10.96293452, 11.84351528,
12.92207187, 13.85122329, 15.05146877, 15.99371264, 17.00000000,
18.00000000, 19.00000000, 19.82763573, -47.00000000, -46.00000000,
-44.87138498, -44.00000000, -43.00000000, -42.00000000, -41.00000000,
-39.88966612, -38.98913239, -37.80306486, -37.23584325, -35.94200288,
-34.99881301, -34.11361858, -33.06507360, -32.13129135, -30.90891364,
-29.81511907, -28.99250380, -28.04535391, -26.99767800, -26.04418164,
-24.95687851, -24.04865595, -23.03392645, -21.89366707, -20.93517364,
-19.99388660, -18.91620943, -18.03749683, -16.99532379, -15.98683813,
-15.06421479, -13.99359211, -12.99714098, -11.97022520, -10.98500279,
-9.98834422, -8.95729330, -8.01232284, -7.00253661, -5.996816