blob: 29380c5caa090b7304be1305636b7e6956b40a15 [file] [log] [blame]
Gregory Maxwellae231142011-07-30 08:18:48 -04001/***********************************************************************
2Copyright (c) 2006-2011, Skype Limited. All rights reserved.
3Redistribution and use in source and binary forms, with or without
4modification, (subject to the limitations in the disclaimer below)
5are permitted provided that the following conditions are met:
6- Redistributions of source code must retain the above copyright notice,
7this list of conditions and the following disclaimer.
8- Redistributions in binary form must reproduce the above copyright
9notice, this list of conditions and the following disclaimer in the
10documentation and/or other materials provided with the distribution.
11- Neither the name of Skype Limited, nor the names of specific
12contributors, may be used to endorse or promote products derived from
13this software without specific prior written permission.
14NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26***********************************************************************/
27
28#include "silk_structs.h"
29#include "silk_define.h"
30#include "silk_tables.h"
31
32#ifdef __cplusplus
33extern "C"
34{
35#endif
36
37/* Piece-wise linear mapping from bitrate in kbps to coding quality in dB SNR */
38const opus_int32 silk_TargetRate_table_NB[ TARGET_RATE_TAB_SZ ] = {
39 0, 8000, 9400, 11500, 13500, 17500, 25000, MAX_TARGET_RATE_BPS
40};
41const opus_int32 silk_TargetRate_table_MB[ TARGET_RATE_TAB_SZ ] = {
42 0, 9000, 12000, 14500, 18500, 24500, 35500, MAX_TARGET_RATE_BPS
43};
44const opus_int32 silk_TargetRate_table_WB[ TARGET_RATE_TAB_SZ ] = {
45 0, 10500, 14000, 17000, 21500, 28500, 42000, MAX_TARGET_RATE_BPS
46};
47const opus_int16 silk_SNR_table_Q1[ TARGET_RATE_TAB_SZ ] = {
48 19, 29, 35, 39, 44, 50, 60, 80
49};
50
51/* Tables for stereo predictor coding */
52const opus_int16 silk_stereo_pred_quant_Q13[ STEREO_QUANT_TAB_SIZE ] = {
53 -13732, -10050, -8266, -7526, -6500, -5000, -2950, -820,
54 820, 2950, 5000, 6500, 7526, 8266, 10050, 13732
55};
56const opus_uint8 silk_stereo_pred_joint_iCDF[ 25 ] = {
57 249, 247, 246, 245, 244,
58 234, 210, 202, 201, 200,
59 197, 174, 82, 59, 56,
60 55, 54, 46, 22, 12,
61 11, 10, 9, 7, 0
62};
63const opus_uint8 silk_stereo_only_code_mid_iCDF[ 2 ] = { 64, 0 };
64
65/* Tables for LBRR flags */
66const opus_uint8 silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 };
67const opus_uint8 silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 };
68const opus_uint8 * const silk_LBRR_flags_iCDF_ptr[ 2 ] = {
69 silk_LBRR_flags_2_iCDF,
70 silk_LBRR_flags_3_iCDF
71};
72
73/* Table for LSB coding */
74const opus_uint8 silk_lsb_iCDF[ 2 ] = { 120, 0 };
75
76/* Tables for LTPScale */
77const opus_uint8 silk_LTPscale_iCDF[ 3 ] = { 128, 64, 0 };
78
79/* Tables for signal type and offset coding */
80const opus_uint8 silk_type_offset_VAD_iCDF[ 4 ] = {
81 232, 158, 10, 0
82};
83const opus_uint8 silk_type_offset_no_VAD_iCDF[ 2 ] = {
84 230, 0
85};
86
87/* Tables for NLSF interpolation factor */
88const opus_uint8 silk_NLSF_interpolation_factor_iCDF[ 5 ] = { 243, 221, 192, 181, 0 };
89
90/* Quantization offsets */
91const opus_int16 silk_Quantization_Offsets_Q10[ 2 ][ 2 ] = {
92 { OFFSET_UVL_Q10, OFFSET_UVH_Q10 }, { OFFSET_VL_Q10, OFFSET_VH_Q10 }
93};
94
95/* Table for LTPScale */
96const opus_int16 silk_LTPScales_table_Q14[ 3 ] = { 15565, 12288, 8192 };
97
98/* Uniform entropy tables */
99const opus_uint8 silk_uniform3_iCDF[ 3 ] = { 171, 85, 0 };
100const opus_uint8 silk_uniform4_iCDF[ 4 ] = { 192, 128, 64, 0 };
101const opus_uint8 silk_uniform5_iCDF[ 5 ] = { 205, 154, 102, 51, 0 };
102const opus_uint8 silk_uniform6_iCDF[ 6 ] = { 213, 171, 128, 85, 43, 0 };
103const opus_uint8 silk_uniform8_iCDF[ 8 ] = { 224, 192, 160, 128, 96, 64, 32, 0 };
104
105const opus_uint8 silk_NLSF_EXT_iCDF[ 7 ] = { 100, 40, 16, 7, 3, 1, 0 };
106
107/* Elliptic/Cauer filters designed with 0.1 dB passband ripple,
108 80 dB minimum stopband attenuation, and
109 [0.95 : 0.15 : 0.35] normalized cut off frequencies. */
110
111/* Interpolation points for filter coefficients used in the bandwidth transition smoother */
112const opus_int32 silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NB ] =
113{
114{ 250767114, 501534038, 250767114 },
115{ 209867381, 419732057, 209867381 },
116{ 170987846, 341967853, 170987846 },
117{ 131531482, 263046905, 131531482 },
118{ 89306658, 178584282, 89306658 }
119};
120
121/* Interpolation points for filter coefficients used in the bandwidth transition smoother */
122const opus_int32 silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NA ] =
123{
124{ 506393414, 239854379 },
125{ 411067935, 169683996 },
126{ 306733530, 116694253 },
127{ 185807084, 77959395 },
128{ 35497197, 57401098 }
129};
130
131#ifdef __cplusplus
132}
133#endif
134