1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libopus/silk/main.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,438 @@ 1.4 +/*********************************************************************** 1.5 +Copyright (c) 2006-2011, Skype Limited. All rights reserved. 1.6 +Redistribution and use in source and binary forms, with or without 1.7 +modification, are permitted provided that the following conditions 1.8 +are met: 1.9 +- Redistributions of source code must retain the above copyright notice, 1.10 +this list of conditions and the following disclaimer. 1.11 +- Redistributions in binary form must reproduce the above copyright 1.12 +notice, this list of conditions and the following disclaimer in the 1.13 +documentation and/or other materials provided with the distribution. 1.14 +- Neither the name of Internet Society, IETF or IETF Trust, nor the 1.15 +names of specific contributors, may be used to endorse or promote 1.16 +products derived from this software without specific prior written 1.17 +permission. 1.18 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 1.19 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.20 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.21 +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 1.22 +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1.23 +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1.24 +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1.25 +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1.26 +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.27 +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 1.28 +POSSIBILITY OF SUCH DAMAGE. 1.29 +***********************************************************************/ 1.30 + 1.31 +#ifndef SILK_MAIN_H 1.32 +#define SILK_MAIN_H 1.33 + 1.34 +#include "SigProc_FIX.h" 1.35 +#include "define.h" 1.36 +#include "structs.h" 1.37 +#include "tables.h" 1.38 +#include "PLC.h" 1.39 +#include "control.h" 1.40 +#include "debug.h" 1.41 +#include "entenc.h" 1.42 +#include "entdec.h" 1.43 + 1.44 +/* Convert Left/Right stereo signal to adaptive Mid/Side representation */ 1.45 +void silk_stereo_LR_to_MS( 1.46 + stereo_enc_state *state, /* I/O State */ 1.47 + opus_int16 x1[], /* I/O Left input signal, becomes mid signal */ 1.48 + opus_int16 x2[], /* I/O Right input signal, becomes side signal */ 1.49 + opus_int8 ix[ 2 ][ 3 ], /* O Quantization indices */ 1.50 + opus_int8 *mid_only_flag, /* O Flag: only mid signal coded */ 1.51 + opus_int32 mid_side_rates_bps[], /* O Bitrates for mid and side signals */ 1.52 + opus_int32 total_rate_bps, /* I Total bitrate */ 1.53 + opus_int prev_speech_act_Q8, /* I Speech activity level in previous frame */ 1.54 + opus_int toMono, /* I Last frame before a stereo->mono transition */ 1.55 + opus_int fs_kHz, /* I Sample rate (kHz) */ 1.56 + opus_int frame_length /* I Number of samples */ 1.57 +); 1.58 + 1.59 +/* Convert adaptive Mid/Side representation to Left/Right stereo signal */ 1.60 +void silk_stereo_MS_to_LR( 1.61 + stereo_dec_state *state, /* I/O State */ 1.62 + opus_int16 x1[], /* I/O Left input signal, becomes mid signal */ 1.63 + opus_int16 x2[], /* I/O Right input signal, becomes side signal */ 1.64 + const opus_int32 pred_Q13[], /* I Predictors */ 1.65 + opus_int fs_kHz, /* I Samples rate (kHz) */ 1.66 + opus_int frame_length /* I Number of samples */ 1.67 +); 1.68 + 1.69 +/* Find least-squares prediction gain for one signal based on another and quantize it */ 1.70 +opus_int32 silk_stereo_find_predictor( /* O Returns predictor in Q13 */ 1.71 + opus_int32 *ratio_Q14, /* O Ratio of residual and mid energies */ 1.72 + const opus_int16 x[], /* I Basis signal */ 1.73 + const opus_int16 y[], /* I Target signal */ 1.74 + opus_int32 mid_res_amp_Q0[], /* I/O Smoothed mid, residual norms */ 1.75 + opus_int length, /* I Number of samples */ 1.76 + opus_int smooth_coef_Q16 /* I Smoothing coefficient */ 1.77 +); 1.78 + 1.79 +/* Quantize mid/side predictors */ 1.80 +void silk_stereo_quant_pred( 1.81 + opus_int32 pred_Q13[], /* I/O Predictors (out: quantized) */ 1.82 + opus_int8 ix[ 2 ][ 3 ] /* O Quantization indices */ 1.83 +); 1.84 + 1.85 +/* Entropy code the mid/side quantization indices */ 1.86 +void silk_stereo_encode_pred( 1.87 + ec_enc *psRangeEnc, /* I/O Compressor data structure */ 1.88 + opus_int8 ix[ 2 ][ 3 ] /* I Quantization indices */ 1.89 +); 1.90 + 1.91 +/* Entropy code the mid-only flag */ 1.92 +void silk_stereo_encode_mid_only( 1.93 + ec_enc *psRangeEnc, /* I/O Compressor data structure */ 1.94 + opus_int8 mid_only_flag 1.95 +); 1.96 + 1.97 +/* Decode mid/side predictors */ 1.98 +void silk_stereo_decode_pred( 1.99 + ec_dec *psRangeDec, /* I/O Compressor data structure */ 1.100 + opus_int32 pred_Q13[] /* O Predictors */ 1.101 +); 1.102 + 1.103 +/* Decode mid-only flag */ 1.104 +void silk_stereo_decode_mid_only( 1.105 + ec_dec *psRangeDec, /* I/O Compressor data structure */ 1.106 + opus_int *decode_only_mid /* O Flag that only mid channel has been coded */ 1.107 +); 1.108 + 1.109 +/* Encodes signs of excitation */ 1.110 +void silk_encode_signs( 1.111 + ec_enc *psRangeEnc, /* I/O Compressor data structure */ 1.112 + const opus_int8 pulses[], /* I pulse signal */ 1.113 + opus_int length, /* I length of input */ 1.114 + const opus_int signalType, /* I Signal type */ 1.115 + const opus_int quantOffsetType, /* I Quantization offset type */ 1.116 + const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ 1.117 +); 1.118 + 1.119 +/* Decodes signs of excitation */ 1.120 +void silk_decode_signs( 1.121 + ec_dec *psRangeDec, /* I/O Compressor data structure */ 1.122 + opus_int pulses[], /* I/O pulse signal */ 1.123 + opus_int length, /* I length of input */ 1.124 + const opus_int signalType, /* I Signal type */ 1.125 + const opus_int quantOffsetType, /* I Quantization offset type */ 1.126 + const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */ 1.127 +); 1.128 + 1.129 +/* Check encoder control struct */ 1.130 +opus_int check_control_input( 1.131 + silk_EncControlStruct *encControl /* I Control structure */ 1.132 +); 1.133 + 1.134 +/* Control internal sampling rate */ 1.135 +opus_int silk_control_audio_bandwidth( 1.136 + silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */ 1.137 + silk_EncControlStruct *encControl /* I Control structure */ 1.138 +); 1.139 + 1.140 +/* Control SNR of redidual quantizer */ 1.141 +opus_int silk_control_SNR( 1.142 + silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */ 1.143 + opus_int32 TargetRate_bps /* I Target max bitrate (bps) */ 1.144 +); 1.145 + 1.146 +/***************/ 1.147 +/* Shell coder */ 1.148 +/***************/ 1.149 + 1.150 +/* Encode quantization indices of excitation */ 1.151 +void silk_encode_pulses( 1.152 + ec_enc *psRangeEnc, /* I/O compressor data structure */ 1.153 + const opus_int signalType, /* I Signal type */ 1.154 + const opus_int quantOffsetType, /* I quantOffsetType */ 1.155 + opus_int8 pulses[], /* I quantization indices */ 1.156 + const opus_int frame_length /* I Frame length */ 1.157 +); 1.158 + 1.159 +/* Shell encoder, operates on one shell code frame of 16 pulses */ 1.160 +void silk_shell_encoder( 1.161 + ec_enc *psRangeEnc, /* I/O compressor data structure */ 1.162 + const opus_int *pulses0 /* I data: nonnegative pulse amplitudes */ 1.163 +); 1.164 + 1.165 +/* Shell decoder, operates on one shell code frame of 16 pulses */ 1.166 +void silk_shell_decoder( 1.167 + opus_int *pulses0, /* O data: nonnegative pulse amplitudes */ 1.168 + ec_dec *psRangeDec, /* I/O Compressor data structure */ 1.169 + const opus_int pulses4 /* I number of pulses per pulse-subframe */ 1.170 +); 1.171 + 1.172 +/* Gain scalar quantization with hysteresis, uniform on log scale */ 1.173 +void silk_gains_quant( 1.174 + opus_int8 ind[ MAX_NB_SUBFR ], /* O gain indices */ 1.175 + opus_int32 gain_Q16[ MAX_NB_SUBFR ], /* I/O gains (quantized out) */ 1.176 + opus_int8 *prev_ind, /* I/O last index in previous frame */ 1.177 + const opus_int conditional, /* I first gain is delta coded if 1 */ 1.178 + const opus_int nb_subfr /* I number of subframes */ 1.179 +); 1.180 + 1.181 +/* Gains scalar dequantization, uniform on log scale */ 1.182 +void silk_gains_dequant( 1.183 + opus_int32 gain_Q16[ MAX_NB_SUBFR ], /* O quantized gains */ 1.184 + const opus_int8 ind[ MAX_NB_SUBFR ], /* I gain indices */ 1.185 + opus_int8 *prev_ind, /* I/O last index in previous frame */ 1.186 + const opus_int conditional, /* I first gain is delta coded if 1 */ 1.187 + const opus_int nb_subfr /* I number of subframes */ 1.188 +); 1.189 + 1.190 +/* Compute unique identifier of gain indices vector */ 1.191 +opus_int32 silk_gains_ID( /* O returns unique identifier of gains */ 1.192 + const opus_int8 ind[ MAX_NB_SUBFR ], /* I gain indices */ 1.193 + const opus_int nb_subfr /* I number of subframes */ 1.194 +); 1.195 + 1.196 +/* Interpolate two vectors */ 1.197 +void silk_interpolate( 1.198 + opus_int16 xi[ MAX_LPC_ORDER ], /* O interpolated vector */ 1.199 + const opus_int16 x0[ MAX_LPC_ORDER ], /* I first vector */ 1.200 + const opus_int16 x1[ MAX_LPC_ORDER ], /* I second vector */ 1.201 + const opus_int ifact_Q2, /* I interp. factor, weight on 2nd vector */ 1.202 + const opus_int d /* I number of parameters */ 1.203 +); 1.204 + 1.205 +/* LTP tap quantizer */ 1.206 +void silk_quant_LTP_gains( 1.207 + opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */ 1.208 + opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */ 1.209 + opus_int8 *periodicity_index, /* O Periodicity Index */ 1.210 + opus_int32 *sum_gain_dB_Q7, /* I/O Cumulative max prediction gain */ 1.211 + const opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */ 1.212 + opus_int mu_Q9, /* I Mu value (R/D tradeoff) */ 1.213 + opus_int lowComplexity, /* I Flag for low complexity */ 1.214 + const opus_int nb_subfr /* I number of subframes */ 1.215 +); 1.216 + 1.217 +/* Entropy constrained matrix-weighted VQ, for a single input data vector */ 1.218 +void silk_VQ_WMat_EC( 1.219 + opus_int8 *ind, /* O index of best codebook vector */ 1.220 + opus_int32 *rate_dist_Q14, /* O best weighted quant error + mu * rate */ 1.221 + opus_int *gain_Q7, /* O sum of absolute LTP coefficients */ 1.222 + const opus_int16 *in_Q14, /* I input vector to be quantized */ 1.223 + const opus_int32 *W_Q18, /* I weighting matrix */ 1.224 + const opus_int8 *cb_Q7, /* I codebook */ 1.225 + const opus_uint8 *cb_gain_Q7, /* I codebook effective gain */ 1.226 + const opus_uint8 *cl_Q5, /* I code length for each codebook vector */ 1.227 + const opus_int mu_Q9, /* I tradeoff betw. weighted error and rate */ 1.228 + const opus_int32 max_gain_Q7, /* I maximum sum of absolute LTP coefficients */ 1.229 + opus_int L /* I number of vectors in codebook */ 1.230 +); 1.231 + 1.232 +/************************************/ 1.233 +/* Noise shaping quantization (NSQ) */ 1.234 +/************************************/ 1.235 +void silk_NSQ( 1.236 + const silk_encoder_state *psEncC, /* I/O Encoder State */ 1.237 + silk_nsq_state *NSQ, /* I/O NSQ state */ 1.238 + SideInfoIndices *psIndices, /* I/O Quantization Indices */ 1.239 + const opus_int32 x_Q3[], /* I Prefiltered input signal */ 1.240 + opus_int8 pulses[], /* O Quantized pulse signal */ 1.241 + const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ 1.242 + const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ 1.243 + const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ 1.244 + const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ 1.245 + const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ 1.246 + const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I Low frequency shaping coefs */ 1.247 + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I Quantization step sizes */ 1.248 + const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */ 1.249 + const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */ 1.250 + const opus_int LTP_scale_Q14 /* I LTP state scaling */ 1.251 +); 1.252 + 1.253 +/* Noise shaping using delayed decision */ 1.254 +void silk_NSQ_del_dec( 1.255 + const silk_encoder_state *psEncC, /* I/O Encoder State */ 1.256 + silk_nsq_state *NSQ, /* I/O NSQ state */ 1.257 + SideInfoIndices *psIndices, /* I/O Quantization Indices */ 1.258 + const opus_int32 x_Q3[], /* I Prefiltered input signal */ 1.259 + opus_int8 pulses[], /* O Quantized pulse signal */ 1.260 + const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ 1.261 + const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ 1.262 + const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ 1.263 + const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ 1.264 + const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */ 1.265 + const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I Low frequency shaping coefs */ 1.266 + const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I Quantization step sizes */ 1.267 + const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */ 1.268 + const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */ 1.269 + const opus_int LTP_scale_Q14 /* I LTP state scaling */ 1.270 +); 1.271 + 1.272 +/************/ 1.273 +/* Silk VAD */ 1.274 +/************/ 1.275 +/* Initialize the Silk VAD */ 1.276 +opus_int silk_VAD_Init( /* O Return value, 0 if success */ 1.277 + silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */ 1.278 +); 1.279 + 1.280 +/* Get speech activity level in Q8 */ 1.281 +opus_int silk_VAD_GetSA_Q8( /* O Return value, 0 if success */ 1.282 + silk_encoder_state *psEncC, /* I/O Encoder state */ 1.283 + const opus_int16 pIn[] /* I PCM input */ 1.284 +); 1.285 + 1.286 +/* Low-pass filter with variable cutoff frequency based on */ 1.287 +/* piece-wise linear interpolation between elliptic filters */ 1.288 +/* Start by setting transition_frame_no = 1; */ 1.289 +void silk_LP_variable_cutoff( 1.290 + silk_LP_state *psLP, /* I/O LP filter state */ 1.291 + opus_int16 *frame, /* I/O Low-pass filtered output signal */ 1.292 + const opus_int frame_length /* I Frame length */ 1.293 +); 1.294 + 1.295 +/******************/ 1.296 +/* NLSF Quantizer */ 1.297 +/******************/ 1.298 +/* Limit, stabilize, convert and quantize NLSFs */ 1.299 +void silk_process_NLSFs( 1.300 + silk_encoder_state *psEncC, /* I/O Encoder state */ 1.301 + opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */ 1.302 + opus_int16 pNLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */ 1.303 + const opus_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */ 1.304 +); 1.305 + 1.306 +opus_int32 silk_NLSF_encode( /* O Returns RD value in Q25 */ 1.307 + opus_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ 1.308 + opus_int16 *pNLSF_Q15, /* I/O Quantized NLSF vector [ LPC_ORDER ] */ 1.309 + const silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook object */ 1.310 + const opus_int16 *pW_QW, /* I NLSF weight vector [ LPC_ORDER ] */ 1.311 + const opus_int NLSF_mu_Q20, /* I Rate weight for the RD optimization */ 1.312 + const opus_int nSurvivors, /* I Max survivors after first stage */ 1.313 + const opus_int signalType /* I Signal type: 0/1/2 */ 1.314 +); 1.315 + 1.316 +/* Compute quantization errors for an LPC_order element input vector for a VQ codebook */ 1.317 +void silk_NLSF_VQ( 1.318 + opus_int32 err_Q26[], /* O Quantization errors [K] */ 1.319 + const opus_int16 in_Q15[], /* I Input vectors to be quantized [LPC_order] */ 1.320 + const opus_uint8 pCB_Q8[], /* I Codebook vectors [K*LPC_order] */ 1.321 + const opus_int K, /* I Number of codebook vectors */ 1.322 + const opus_int LPC_order /* I Number of LPCs */ 1.323 +); 1.324 + 1.325 +/* Delayed-decision quantizer for NLSF residuals */ 1.326 +opus_int32 silk_NLSF_del_dec_quant( /* O Returns RD value in Q25 */ 1.327 + opus_int8 indices[], /* O Quantization indices [ order ] */ 1.328 + const opus_int16 x_Q10[], /* I Input [ order ] */ 1.329 + const opus_int16 w_Q5[], /* I Weights [ order ] */ 1.330 + const opus_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */ 1.331 + const opus_int16 ec_ix[], /* I Indices to entropy coding tables [ order ] */ 1.332 + const opus_uint8 ec_rates_Q5[], /* I Rates [] */ 1.333 + const opus_int quant_step_size_Q16, /* I Quantization step size */ 1.334 + const opus_int16 inv_quant_step_size_Q6, /* I Inverse quantization step size */ 1.335 + const opus_int32 mu_Q20, /* I R/D tradeoff */ 1.336 + const opus_int16 order /* I Number of input values */ 1.337 +); 1.338 + 1.339 +/* Unpack predictor values and indices for entropy coding tables */ 1.340 +void silk_NLSF_unpack( 1.341 + opus_int16 ec_ix[], /* O Indices to entropy tables [ LPC_ORDER ] */ 1.342 + opus_uint8 pred_Q8[], /* O LSF predictor [ LPC_ORDER ] */ 1.343 + const silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook object */ 1.344 + const opus_int CB1_index /* I Index of vector in first LSF codebook */ 1.345 +); 1.346 + 1.347 +/***********************/ 1.348 +/* NLSF vector decoder */ 1.349 +/***********************/ 1.350 +void silk_NLSF_decode( 1.351 + opus_int16 *pNLSF_Q15, /* O Quantized NLSF vector [ LPC_ORDER ] */ 1.352 + opus_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */ 1.353 + const silk_NLSF_CB_struct *psNLSF_CB /* I Codebook object */ 1.354 +); 1.355 + 1.356 +/****************************************************/ 1.357 +/* Decoder Functions */ 1.358 +/****************************************************/ 1.359 +opus_int silk_init_decoder( 1.360 + silk_decoder_state *psDec /* I/O Decoder state pointer */ 1.361 +); 1.362 + 1.363 +/* Set decoder sampling rate */ 1.364 +opus_int silk_decoder_set_fs( 1.365 + silk_decoder_state *psDec, /* I/O Decoder state pointer */ 1.366 + opus_int fs_kHz, /* I Sampling frequency (kHz) */ 1.367 + opus_int32 fs_API_Hz /* I API Sampling frequency (Hz) */ 1.368 +); 1.369 + 1.370 +/****************/ 1.371 +/* Decode frame */ 1.372 +/****************/ 1.373 +opus_int silk_decode_frame( 1.374 + silk_decoder_state *psDec, /* I/O Pointer to Silk decoder state */ 1.375 + ec_dec *psRangeDec, /* I/O Compressor data structure */ 1.376 + opus_int16 pOut[], /* O Pointer to output speech frame */ 1.377 + opus_int32 *pN, /* O Pointer to size of output frame */ 1.378 + opus_int lostFlag, /* I 0: no loss, 1 loss, 2 decode fec */ 1.379 + opus_int condCoding /* I The type of conditional coding to use */ 1.380 +); 1.381 + 1.382 +/* Decode indices from bitstream */ 1.383 +void silk_decode_indices( 1.384 + silk_decoder_state *psDec, /* I/O State */ 1.385 + ec_dec *psRangeDec, /* I/O Compressor data structure */ 1.386 + opus_int FrameIndex, /* I Frame number */ 1.387 + opus_int decode_LBRR, /* I Flag indicating LBRR data is being decoded */ 1.388 + opus_int condCoding /* I The type of conditional coding to use */ 1.389 +); 1.390 + 1.391 +/* Decode parameters from payload */ 1.392 +void silk_decode_parameters( 1.393 + silk_decoder_state *psDec, /* I/O State */ 1.394 + silk_decoder_control *psDecCtrl, /* I/O Decoder control */ 1.395 + opus_int condCoding /* I The type of conditional coding to use */ 1.396 +); 1.397 + 1.398 +/* Core decoder. Performs inverse NSQ operation LTP + LPC */ 1.399 +void silk_decode_core( 1.400 + silk_decoder_state *psDec, /* I/O Decoder state */ 1.401 + silk_decoder_control *psDecCtrl, /* I Decoder control */ 1.402 + opus_int16 xq[], /* O Decoded speech */ 1.403 + const opus_int pulses[ MAX_FRAME_LENGTH ] /* I Pulse signal */ 1.404 +); 1.405 + 1.406 +/* Decode quantization indices of excitation (Shell coding) */ 1.407 +void silk_decode_pulses( 1.408 + ec_dec *psRangeDec, /* I/O Compressor data structure */ 1.409 + opus_int pulses[], /* O Excitation signal */ 1.410 + const opus_int signalType, /* I Sigtype */ 1.411 + const opus_int quantOffsetType, /* I quantOffsetType */ 1.412 + const opus_int frame_length /* I Frame length */ 1.413 +); 1.414 + 1.415 +/******************/ 1.416 +/* CNG */ 1.417 +/******************/ 1.418 + 1.419 +/* Reset CNG */ 1.420 +void silk_CNG_Reset( 1.421 + silk_decoder_state *psDec /* I/O Decoder state */ 1.422 +); 1.423 + 1.424 +/* Updates CNG estimate, and applies the CNG when packet was lost */ 1.425 +void silk_CNG( 1.426 + silk_decoder_state *psDec, /* I/O Decoder state */ 1.427 + silk_decoder_control *psDecCtrl, /* I/O Decoder control */ 1.428 + opus_int16 frame[], /* I/O Signal */ 1.429 + opus_int length /* I Length of residual */ 1.430 +); 1.431 + 1.432 +/* Encoding of various parameters */ 1.433 +void silk_encode_indices( 1.434 + silk_encoder_state *psEncC, /* I/O Encoder state */ 1.435 + ec_enc *psRangeEnc, /* I/O Compressor data structure */ 1.436 + opus_int FrameIndex, /* I Frame number */ 1.437 + opus_int encode_LBRR, /* I Flag indicating LBRR data is being encoded */ 1.438 + opus_int condCoding /* I The type of conditional coding to use */ 1.439 +); 1.440 + 1.441 +#endif