cannam@154: /*********************************************************************** cannam@154: Copyright (c) 2006-2011, Skype Limited. All rights reserved. cannam@154: Redistribution and use in source and binary forms, with or without cannam@154: modification, are permitted provided that the following conditions cannam@154: are met: cannam@154: - Redistributions of source code must retain the above copyright notice, cannam@154: this list of conditions and the following disclaimer. cannam@154: - Redistributions in binary form must reproduce the above copyright cannam@154: notice, this list of conditions and the following disclaimer in the cannam@154: documentation and/or other materials provided with the distribution. cannam@154: - Neither the name of Internet Society, IETF or IETF Trust, nor the cannam@154: names of specific contributors, may be used to endorse or promote cannam@154: products derived from this software without specific prior written cannam@154: permission. cannam@154: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" cannam@154: AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE cannam@154: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE cannam@154: ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE cannam@154: LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR cannam@154: CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF cannam@154: SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS cannam@154: INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN cannam@154: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) cannam@154: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE cannam@154: POSSIBILITY OF SUCH DAMAGE. cannam@154: ***********************************************************************/ cannam@154: cannam@154: #ifdef HAVE_CONFIG_H cannam@154: #include "config.h" cannam@154: #endif cannam@154: cannam@154: #include "structs.h" cannam@154: #include "define.h" cannam@154: #include "tables.h" cannam@154: cannam@154: #ifdef __cplusplus cannam@154: extern "C" cannam@154: { cannam@154: #endif cannam@154: cannam@154: /* Tables for stereo predictor coding */ cannam@154: const opus_int16 silk_stereo_pred_quant_Q13[ STEREO_QUANT_TAB_SIZE ] = { cannam@154: -13732, -10050, -8266, -7526, -6500, -5000, -2950, -820, cannam@154: 820, 2950, 5000, 6500, 7526, 8266, 10050, 13732 cannam@154: }; cannam@154: const opus_uint8 silk_stereo_pred_joint_iCDF[ 25 ] = { cannam@154: 249, 247, 246, 245, 244, cannam@154: 234, 210, 202, 201, 200, cannam@154: 197, 174, 82, 59, 56, cannam@154: 55, 54, 46, 22, 12, cannam@154: 11, 10, 9, 7, 0 cannam@154: }; cannam@154: const opus_uint8 silk_stereo_only_code_mid_iCDF[ 2 ] = { 64, 0 }; cannam@154: cannam@154: /* Tables for LBRR flags */ cannam@154: static const opus_uint8 silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 }; cannam@154: static const opus_uint8 silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 }; cannam@154: const opus_uint8 * const silk_LBRR_flags_iCDF_ptr[ 2 ] = { cannam@154: silk_LBRR_flags_2_iCDF, cannam@154: silk_LBRR_flags_3_iCDF cannam@154: }; cannam@154: cannam@154: /* Table for LSB coding */ cannam@154: const opus_uint8 silk_lsb_iCDF[ 2 ] = { 120, 0 }; cannam@154: cannam@154: /* Tables for LTPScale */ cannam@154: const opus_uint8 silk_LTPscale_iCDF[ 3 ] = { 128, 64, 0 }; cannam@154: cannam@154: /* Tables for signal type and offset coding */ cannam@154: const opus_uint8 silk_type_offset_VAD_iCDF[ 4 ] = { cannam@154: 232, 158, 10, 0 cannam@154: }; cannam@154: const opus_uint8 silk_type_offset_no_VAD_iCDF[ 2 ] = { cannam@154: 230, 0 cannam@154: }; cannam@154: cannam@154: /* Tables for NLSF interpolation factor */ cannam@154: const opus_uint8 silk_NLSF_interpolation_factor_iCDF[ 5 ] = { 243, 221, 192, 181, 0 }; cannam@154: cannam@154: /* Quantization offsets */ cannam@154: const opus_int16 silk_Quantization_Offsets_Q10[ 2 ][ 2 ] = { cannam@154: { OFFSET_UVL_Q10, OFFSET_UVH_Q10 }, { OFFSET_VL_Q10, OFFSET_VH_Q10 } cannam@154: }; cannam@154: cannam@154: /* Table for LTPScale */ cannam@154: const opus_int16 silk_LTPScales_table_Q14[ 3 ] = { 15565, 12288, 8192 }; cannam@154: cannam@154: /* Uniform entropy tables */ cannam@154: const opus_uint8 silk_uniform3_iCDF[ 3 ] = { 171, 85, 0 }; cannam@154: const opus_uint8 silk_uniform4_iCDF[ 4 ] = { 192, 128, 64, 0 }; cannam@154: const opus_uint8 silk_uniform5_iCDF[ 5 ] = { 205, 154, 102, 51, 0 }; cannam@154: const opus_uint8 silk_uniform6_iCDF[ 6 ] = { 213, 171, 128, 85, 43, 0 }; cannam@154: const opus_uint8 silk_uniform8_iCDF[ 8 ] = { 224, 192, 160, 128, 96, 64, 32, 0 }; cannam@154: cannam@154: const opus_uint8 silk_NLSF_EXT_iCDF[ 7 ] = { 100, 40, 16, 7, 3, 1, 0 }; cannam@154: cannam@154: /* Elliptic/Cauer filters designed with 0.1 dB passband ripple, cannam@154: 80 dB minimum stopband attenuation, and cannam@154: [0.95 : 0.15 : 0.35] normalized cut off frequencies. */ cannam@154: cannam@154: /* Interpolation points for filter coefficients used in the bandwidth transition smoother */ cannam@154: const opus_int32 silk_Transition_LP_B_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NB ] = cannam@154: { cannam@154: { 250767114, 501534038, 250767114 }, cannam@154: { 209867381, 419732057, 209867381 }, cannam@154: { 170987846, 341967853, 170987846 }, cannam@154: { 131531482, 263046905, 131531482 }, cannam@154: { 89306658, 178584282, 89306658 } cannam@154: }; cannam@154: cannam@154: /* Interpolation points for filter coefficients used in the bandwidth transition smoother */ cannam@154: const opus_int32 silk_Transition_LP_A_Q28[ TRANSITION_INT_NUM ][ TRANSITION_NA ] = cannam@154: { cannam@154: { 506393414, 239854379 }, cannam@154: { 411067935, 169683996 }, cannam@154: { 306733530, 116694253 }, cannam@154: { 185807084, 77959395 }, cannam@154: { 35497197, 57401098 } cannam@154: }; cannam@154: cannam@154: #ifdef __cplusplus cannam@154: } cannam@154: #endif cannam@154: