| 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 | #ifndef SILK_DEFINE_H |
| 29 | #define SILK_DEFINE_Hcxx . . $ `external/opusfile/opus/silk/define.h:29:9`! |
| 30 | |
| 31 | #include "errors.h"cxx . . $ `<file>/external/opusfile/opus/silk/errors.h`/ |
| 32 | #include "typedef.h"cxx . . $ `<file>/external/opusfile/opus/silk/typedef.h`/ |
| 33 | |
| 34 | #ifdef __cplusplus |
| 35 | extern "C" |
| 36 | { |
| 37 | #endif |
| 38 | |
| 39 | /* Max number of encoder channels (1/2) */ |
| 40 | #define ENCODER_NUM_CHANNELScxx . . $ `external/opusfile/opus/silk/define.h:40:9`! 2 |
| 41 | /* Number of decoder channels (1/2) */ |
| 42 | #define DECODER_NUM_CHANNELScxx . . $ `external/opusfile/opus/silk/define.h:42:9`! 2 |
| 43 | |
| 44 | #define MAX_FRAMES_PER_PACKETcxx . . $ `external/opusfile/opus/silk/define.h:44:9`! 3 |
| 45 | |
| 46 | /* Limits on bitrate */ |
| 47 | #define MIN_TARGET_RATE_BPScxx . . $ `external/opusfile/opus/silk/define.h:47:9`! 5000 |
| 48 | #define MAX_TARGET_RATE_BPScxx . . $ `external/opusfile/opus/silk/define.h:48:9`! 80000 |
| 49 | |
| 50 | /* LBRR thresholds */ |
| 51 | #define LBRR_NB_MIN_RATE_BPScxx . . $ `external/opusfile/opus/silk/define.h:51:9`! 12000 |
| 52 | #define LBRR_MB_MIN_RATE_BPScxx . . $ `external/opusfile/opus/silk/define.h:52:9`! 14000 |
| 53 | #define LBRR_WB_MIN_RATE_BPScxx . . $ `external/opusfile/opus/silk/define.h:53:9`! 16000 |
| 54 | |
| 55 | /* DTX settings */ |
| 56 | #define NB_SPEECH_FRAMES_BEFORE_DTXcxx . . $ `external/opusfile/opus/silk/define.h:56:9`! 10 /* eq 200 ms */ |
| 57 | #define MAX_CONSECUTIVE_DTXcxx . . $ `external/opusfile/opus/silk/define.h:57:9`! 20 /* eq 400 ms */ |
| 58 | #define DTX_ACTIVITY_THRESHOLDcxx . . $ `external/opusfile/opus/silk/define.h:58:9`! 0.1f |
| 59 | |
| 60 | /* VAD decision */ |
| 61 | #define VAD_NO_DECISIONcxx . . $ `external/opusfile/opus/silk/define.h:61:9`! -1 |
| 62 | #define VAD_NO_ACTIVITYcxx . . $ `external/opusfile/opus/silk/define.h:62:9`! 0 |
| 63 | #define VAD_ACTIVITYcxx . . $ `external/opusfile/opus/silk/define.h:63:9`! 1 |
| 64 | |
| 65 | /* Maximum sampling frequency */ |
| 66 | #define MAX_FS_KHZcxx . . $ `external/opusfile/opus/silk/define.h:66:9`! 16 |
| 67 | #define MAX_API_FS_KHZcxx . . $ `external/opusfile/opus/silk/define.h:67:9`! 48 |
| 68 | |
| 69 | /* Signal types */ |
| 70 | #define TYPE_NO_VOICE_ACTIVITYcxx . . $ `external/opusfile/opus/silk/define.h:70:9`! 0 |
| 71 | #define TYPE_UNVOICEDcxx . . $ `external/opusfile/opus/silk/define.h:71:9`! 1 |
| 72 | #define TYPE_VOICEDcxx . . $ `external/opusfile/opus/silk/define.h:72:9`! 2 |
| 73 | |
| 74 | /* Conditional coding types */ |
| 75 | #define CODE_INDEPENDENTLYcxx . . $ `external/opusfile/opus/silk/define.h:75:9`! 0 |
| 76 | #define CODE_INDEPENDENTLY_NO_LTP_SCALINGcxx . . $ `external/opusfile/opus/silk/define.h:76:9`! 1 |
| 77 | #define CODE_CONDITIONALLYcxx . . $ `external/opusfile/opus/silk/define.h:77:9`! 2 |
| 78 | |
| 79 | /* Settings for stereo processing */ |
| 80 | #define STEREO_QUANT_TAB_SIZEcxx . . $ `external/opusfile/opus/silk/define.h:80:9`! 16 |
| 81 | #define STEREO_QUANT_SUB_STEPScxx . . $ `external/opusfile/opus/silk/define.h:81:9`! 5 |
| 82 | #define STEREO_INTERP_LEN_MScxx . . $ `external/opusfile/opus/silk/define.h:82:9`! 8 /* must be even */ |
| 83 | #define STEREO_RATIO_SMOOTH_COEFcxx . . $ `external/opusfile/opus/silk/define.h:83:9`! 0.01 /* smoothing coef for signal norms and stereo width */ |
| 84 | |
| 85 | /* Range of pitch lag estimates */ |
| 86 | #define PITCH_EST_MIN_LAG_MScxx . . $ `external/opusfile/opus/silk/define.h:86:9`! 2 /* 2 ms -> 500 Hz */ |
| 87 | #define PITCH_EST_MAX_LAG_MScxx . . $ `external/opusfile/opus/silk/define.h:87:9`! 18 /* 18 ms -> 56 Hz */ |
| 88 | |
| 89 | /* Maximum number of subframes */ |
| 90 | #define MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! 4 |
| 91 | |
| 92 | /* Number of samples per frame */ |
| 93 | #define LTP_MEM_LENGTH_MScxx . . $ `external/opusfile/opus/silk/define.h:93:9`! 20 |
| 94 | #define SUB_FRAME_LENGTH_MScxx . . $ `external/opusfile/opus/silk/define.h:94:9`! 5 |
| 95 | #define MAX_SUB_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:95:9`! ( SUB_FRAME_LENGTH_MScxx . . $ `external/opusfile/opus/silk/define.h:94:9`! * MAX_FS_KHZcxx . . $ `external/opusfile/opus/silk/define.h:66:9`! ) |
| 96 | #define MAX_FRAME_LENGTH_MScxx . . $ `external/opusfile/opus/silk/define.h:96:9`! ( SUB_FRAME_LENGTH_MScxx . . $ `external/opusfile/opus/silk/define.h:94:9`! * MAX_NB_SUBFRcxx . . $ `external/opusfile/opus/silk/define.h:90:9`! ) |
| 97 | #define MAX_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:97:9`! ( MAX_FRAME_LENGTH_MScxx . . $ `external/opusfile/opus/silk/define.h:96:9`! * MAX_FS_KHZcxx . . $ `external/opusfile/opus/silk/define.h:66:9`! ) |
| 98 | |
| 99 | /* Milliseconds of lookahead for pitch analysis */ |
| 100 | #define LA_PITCH_MScxx . . $ `external/opusfile/opus/silk/define.h:100:9`! 2 |
| 101 | #define LA_PITCH_MAXcxx . . $ `external/opusfile/opus/silk/define.h:101:9`! ( LA_PITCH_MS * MAX_FS_KHZ ) |
| 102 | |
| 103 | /* Order of LPC used in find pitch */ |
| 104 | #define MAX_FIND_PITCH_LPC_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:104:9`! 16 |
| 105 | |
| 106 | /* Length of LPC window used in find pitch */ |
| 107 | #define FIND_PITCH_LPC_WIN_MScxx . . $ `external/opusfile/opus/silk/define.h:107:9`! ( 20 + (LA_PITCH_MS << 1) ) |
| 108 | #define FIND_PITCH_LPC_WIN_MS_2_SFcxx . . $ `external/opusfile/opus/silk/define.h:108:9`! ( 10 + (LA_PITCH_MS << 1) ) |
| 109 | #define FIND_PITCH_LPC_WIN_MAXcxx . . $ `external/opusfile/opus/silk/define.h:109:9`! ( FIND_PITCH_LPC_WIN_MS * MAX_FS_KHZ ) |
| 110 | |
| 111 | /* Milliseconds of lookahead for noise shape analysis */ |
| 112 | #define LA_SHAPE_MScxx . . $ `external/opusfile/opus/silk/define.h:112:9`! 5 |
| 113 | #define LA_SHAPE_MAXcxx . . $ `external/opusfile/opus/silk/define.h:113:9`! ( LA_SHAPE_MScxx . . $ `external/opusfile/opus/silk/define.h:112:9`! * MAX_FS_KHZcxx . . $ `external/opusfile/opus/silk/define.h:66:9`! ) |
| 114 | |
| 115 | /* Maximum length of LPC window used in noise shape analysis */ |
| 116 | #define SHAPE_LPC_WIN_MAXcxx . . $ `external/opusfile/opus/silk/define.h:116:9`! ( 15 * MAX_FS_KHZ ) |
| 117 | |
| 118 | /* dB level of lowest gain quantization level */ |
| 119 | #define MIN_QGAIN_DBcxx . . $ `external/opusfile/opus/silk/define.h:119:9`! 2 |
| 120 | /* dB level of highest gain quantization level */ |
| 121 | #define MAX_QGAIN_DBcxx . . $ `external/opusfile/opus/silk/define.h:121:9`! 88 |
| 122 | /* Number of gain quantization levels */ |
| 123 | #define N_LEVELS_QGAINcxx . . $ `external/opusfile/opus/silk/define.h:123:9`! 64 |
| 124 | /* Max increase in gain quantization index */ |
| 125 | #define MAX_DELTA_GAIN_QUANTcxx . . $ `external/opusfile/opus/silk/define.h:125:9`! 36 |
| 126 | /* Max decrease in gain quantization index */ |
| 127 | #define MIN_DELTA_GAIN_QUANTcxx . . $ `external/opusfile/opus/silk/define.h:127:9`! -4 |
| 128 | |
| 129 | /* Quantization offsets (multiples of 4) */ |
| 130 | #define OFFSET_VL_Q10cxx . . $ `external/opusfile/opus/silk/define.h:130:9`! 32 |
| 131 | #define OFFSET_VH_Q10cxx . . $ `external/opusfile/opus/silk/define.h:131:9`! 100 |
| 132 | #define OFFSET_UVL_Q10cxx . . $ `external/opusfile/opus/silk/define.h:132:9`! 100 |
| 133 | #define OFFSET_UVH_Q10cxx . . $ `external/opusfile/opus/silk/define.h:133:9`! 240 |
| 134 | |
| 135 | #define QUANT_LEVEL_ADJUST_Q10cxx . . $ `external/opusfile/opus/silk/define.h:135:9`! 80 |
| 136 | |
| 137 | /* Maximum numbers of iterations used to stabilize an LPC vector */ |
| 138 | #define MAX_LPC_STABILIZE_ITERATIONScxx . . $ `external/opusfile/opus/silk/define.h:138:9`! 16 |
| 139 | #define MAX_PREDICTION_POWER_GAINcxx . . $ `external/opusfile/opus/silk/define.h:139:9`! 1e4f |
| 140 | #define MAX_PREDICTION_POWER_GAIN_AFTER_RESETcxx . . $ `external/opusfile/opus/silk/define.h:140:9`! 1e2f |
| 141 | |
| 142 | #define MAX_LPC_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:142:9`! 16 |
| 143 | #define MIN_LPC_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:143:9`! 10 |
| 144 | |
| 145 | /* Find Pred Coef defines */ |
| 146 | #define LTP_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:146:9`! 5 |
| 147 | |
| 148 | /* LTP quantization settings */ |
| 149 | #define NB_LTP_CBKScxx . . $ `external/opusfile/opus/silk/define.h:149:9`! 3 |
| 150 | |
| 151 | /* Flag to use harmonic noise shaping */ |
| 152 | #define USE_HARM_SHAPINGcxx . . $ `external/opusfile/opus/silk/define.h:152:9`! 1 |
| 153 | |
| 154 | /* Max LPC order of noise shaping filters */ |
| 155 | #define MAX_SHAPE_LPC_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:155:9`! 24 |
| 156 | |
| 157 | #define HARM_SHAPE_FIR_TAPScxx . . $ `external/opusfile/opus/silk/define.h:157:9`! 3 |
| 158 | |
| 159 | /* Maximum number of delayed decision states */ |
| 160 | #define MAX_DEL_DEC_STATEScxx . . $ `external/opusfile/opus/silk/define.h:160:9`! 4 |
| 161 | |
| 162 | #define LTP_BUF_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:162:9`! 512 |
| 163 | #define LTP_MASKcxx . . $ `external/opusfile/opus/silk/define.h:163:9`! ( LTP_BUF_LENGTH - 1 ) |
| 164 | |
| 165 | #define DECISION_DELAYcxx . . $ `external/opusfile/opus/silk/define.h:165:9`! 40 |
| 166 | |
| 167 | /* Number of subframes for excitation entropy coding */ |
| 168 | #define SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:168:9`! 16 |
| 169 | #define LOG2_SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:169:9`! 4 |
| 170 | #define MAX_NB_SHELL_BLOCKScxx . . $ `external/opusfile/opus/silk/define.h:170:9`! ( MAX_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:97:9`! / SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:168:9`! ) |
| 171 | |
| 172 | /* Number of rate levels, for entropy coding of excitation */ |
| 173 | #define N_RATE_LEVELScxx . . $ `external/opusfile/opus/silk/define.h:173:9`! 10 |
| 174 | |
| 175 | /* Maximum sum of pulses per shell coding frame */ |
| 176 | #define SILK_MAX_PULSEScxx . . $ `external/opusfile/opus/silk/define.h:176:9`! 16 |
| 177 | |
| 178 | #define MAX_MATRIX_SIZEcxx . . $ `external/opusfile/opus/silk/define.h:178:9`! MAX_LPC_ORDER /* Max of LPC Order and LTP order */ |
| 179 | |
| 180 | # define NSQ_LPC_BUF_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:180:10`! MAX_LPC_ORDERcxx . . $ `external/opusfile/opus/silk/define.h:142:9`! |
| 181 | |
| 182 | /***************************/ |
| 183 | /* Voice activity detector */ |
| 184 | /***************************/ |
| 185 | #define VAD_N_BANDScxx . . $ `external/opusfile/opus/silk/define.h:185:9`! 4 |
| 186 | |
| 187 | #define VAD_INTERNAL_SUBFRAMES_LOG2cxx . . $ `external/opusfile/opus/silk/define.h:187:9`! 2 |
| 188 | #define VAD_INTERNAL_SUBFRAMEScxx . . $ `external/opusfile/opus/silk/define.h:188:9`! ( 1 << VAD_INTERNAL_SUBFRAMES_LOG2 ) |
| 189 | |
| 190 | #define VAD_NOISE_LEVEL_SMOOTH_COEF_Q16cxx . . $ `external/opusfile/opus/silk/define.h:190:9`! 1024 /* Must be < 4096 */ |
| 191 | #define VAD_NOISE_LEVELS_BIAScxx . . $ `external/opusfile/opus/silk/define.h:191:9`! 50 |
| 192 | |
| 193 | /* Sigmoid settings */ |
| 194 | #define VAD_NEGATIVE_OFFSET_Q5cxx . . $ `external/opusfile/opus/silk/define.h:194:9`! 128 /* sigmoid is 0 at -128 */ |
| 195 | #define VAD_SNR_FACTOR_Q16cxx . . $ `external/opusfile/opus/silk/define.h:195:9`! 45000 |
| 196 | |
| 197 | /* smoothing for SNR measurement */ |
| 198 | #define VAD_SNR_SMOOTH_COEF_Q18cxx . . $ `external/opusfile/opus/silk/define.h:198:9`! 4096 |
| 199 | |
| 200 | /* Size of the piecewise linear cosine approximation table for the LSFs */ |
| 201 | #define LSF_COS_TAB_SZ_FIXcxx . . $ `external/opusfile/opus/silk/define.h:201:9`! 128 |
| 202 | |
| 203 | /******************/ |
| 204 | /* NLSF quantizer */ |
| 205 | /******************/ |
| 206 | #define NLSF_W_Qcxx . . $ `external/opusfile/opus/silk/define.h:206:9`! 2 |
| 207 | #define NLSF_VQ_MAX_VECTORScxx . . $ `external/opusfile/opus/silk/define.h:207:9`! 32 |
| 208 | #define NLSF_QUANT_MAX_AMPLITUDEcxx . . $ `external/opusfile/opus/silk/define.h:208:9`! 4 |
| 209 | #define NLSF_QUANT_MAX_AMPLITUDE_EXTcxx . . $ `external/opusfile/opus/silk/define.h:209:9`! 10 |
| 210 | #define NLSF_QUANT_LEVEL_ADJcxx . . $ `external/opusfile/opus/silk/define.h:210:9`! 0.1 |
| 211 | #define NLSF_QUANT_DEL_DEC_STATES_LOG2cxx . . $ `external/opusfile/opus/silk/define.h:211:9`! 2 |
| 212 | #define NLSF_QUANT_DEL_DEC_STATEScxx . . $ `external/opusfile/opus/silk/define.h:212:9`! ( 1 << NLSF_QUANT_DEL_DEC_STATES_LOG2 ) |
| 213 | |
| 214 | /* Transition filtering for mode switching */ |
| 215 | #define TRANSITION_TIME_MScxx . . $ `external/opusfile/opus/silk/define.h:215:9`! 5120 /* 5120 = 64 * FRAME_LENGTH_MS * ( TRANSITION_INT_NUM - 1 ) = 64*(20*4)*/ |
| 216 | #define TRANSITION_NBcxx . . $ `external/opusfile/opus/silk/define.h:216:9`! 3 /* Hardcoded in tables */ |
| 217 | #define TRANSITION_NAcxx . . $ `external/opusfile/opus/silk/define.h:217:9`! 2 /* Hardcoded in tables */ |
| 218 | #define TRANSITION_INT_NUMcxx . . $ `external/opusfile/opus/silk/define.h:218:9`! 5 /* Hardcoded in tables */ |
| 219 | #define TRANSITION_FRAMEScxx . . $ `external/opusfile/opus/silk/define.h:219:9`! ( TRANSITION_TIME_MS / MAX_FRAME_LENGTH_MS ) |
| 220 | #define TRANSITION_INT_STEPScxx . . $ `external/opusfile/opus/silk/define.h:220:9`! ( TRANSITION_FRAMES / ( TRANSITION_INT_NUM - 1 ) ) |
| 221 | |
| 222 | /* BWE factors to apply after packet loss */ |
| 223 | #define BWE_AFTER_LOSS_Q16cxx . . $ `external/opusfile/opus/silk/define.h:223:9`! 63570 |
| 224 | |
| 225 | /* Defines for CN generation */ |
| 226 | #define CNG_BUF_MASK_MAXcxx . . $ `external/opusfile/opus/silk/define.h:226:9`! 255 /* 2^floor(log2(MAX_FRAME_LENGTH))-1 */ |
| 227 | #define CNG_GAIN_SMTH_Q16cxx . . $ `external/opusfile/opus/silk/define.h:227:9`! 4634 /* 0.25^(1/4) */ |
| 228 | #define CNG_NLSF_SMTH_Q16cxx . . $ `external/opusfile/opus/silk/define.h:228:9`! 16348 /* 0.25 */ |
| 229 | |
| 230 | #ifdef __cplusplus |
| 231 | } |
| 232 | #endif |
| 233 | |
| 234 | #endif |