webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
main.h
Go to the documentation of this file.
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_MAIN_H
29 #define SILK_MAIN_H
30 
31 #include "SigProc_FIX.h"
32 #include "define.h"
33 #include "structs.h"
34 #include "tables.h"
35 #include "PLC.h"
36 #include "control.h"
37 #include "debug.h"
38 #include "entenc.h"
39 #include "entdec.h"
40 
41 #if defined(OPUS_X86_MAY_HAVE_SSE4_1)
42 #include "x86/main_sse.h"
43 #endif
44 
45 /* Convert Left/Right stereo signal to adaptive Mid/Side representation */
47  stereo_enc_state *state, /* I/O State */
48  opus_int16 x1[], /* I/O Left input signal, becomes mid signal */
49  opus_int16 x2[], /* I/O Right input signal, becomes side signal */
50  opus_int8 ix[ 2 ][ 3 ], /* O Quantization indices */
51  opus_int8 *mid_only_flag, /* O Flag: only mid signal coded */
52  opus_int32 mid_side_rates_bps[], /* O Bitrates for mid and side signals */
53  opus_int32 total_rate_bps, /* I Total bitrate */
54  opus_int prev_speech_act_Q8, /* I Speech activity level in previous frame */
55  opus_int toMono, /* I Last frame before a stereo->mono transition */
56  opus_int fs_kHz, /* I Sample rate (kHz) */
57  opus_int frame_length /* I Number of samples */
58 );
59 
60 /* Convert adaptive Mid/Side representation to Left/Right stereo signal */
62  stereo_dec_state *state, /* I/O State */
63  opus_int16 x1[], /* I/O Left input signal, becomes mid signal */
64  opus_int16 x2[], /* I/O Right input signal, becomes side signal */
65  const opus_int32 pred_Q13[], /* I Predictors */
66  opus_int fs_kHz, /* I Samples rate (kHz) */
67  opus_int frame_length /* I Number of samples */
68 );
69 
70 /* Find least-squares prediction gain for one signal based on another and quantize it */
71 opus_int32 silk_stereo_find_predictor( /* O Returns predictor in Q13 */
72  opus_int32 *ratio_Q14, /* O Ratio of residual and mid energies */
73  const opus_int16 x[], /* I Basis signal */
74  const opus_int16 y[], /* I Target signal */
75  opus_int32 mid_res_amp_Q0[], /* I/O Smoothed mid, residual norms */
76  opus_int length, /* I Number of samples */
77  opus_int smooth_coef_Q16 /* I Smoothing coefficient */
78 );
79 
80 /* Quantize mid/side predictors */
82  opus_int32 pred_Q13[], /* I/O Predictors (out: quantized) */
83  opus_int8 ix[ 2 ][ 3 ] /* O Quantization indices */
84 );
85 
86 /* Entropy code the mid/side quantization indices */
88  ec_enc *psRangeEnc, /* I/O Compressor data structure */
89  opus_int8 ix[ 2 ][ 3 ] /* I Quantization indices */
90 );
91 
92 /* Entropy code the mid-only flag */
94  ec_enc *psRangeEnc, /* I/O Compressor data structure */
95  opus_int8 mid_only_flag
96 );
97 
98 /* Decode mid/side predictors */
100  ec_dec *psRangeDec, /* I/O Compressor data structure */
101  opus_int32 pred_Q13[] /* O Predictors */
102 );
103 
104 /* Decode mid-only flag */
106  ec_dec *psRangeDec, /* I/O Compressor data structure */
107  opus_int *decode_only_mid /* O Flag that only mid channel has been coded */
108 );
109 
110 /* Encodes signs of excitation */
111 void silk_encode_signs(
112  ec_enc *psRangeEnc, /* I/O Compressor data structure */
113  const opus_int8 pulses[], /* I pulse signal */
114  opus_int length, /* I length of input */
115  const opus_int signalType, /* I Signal type */
116  const opus_int quantOffsetType, /* I Quantization offset type */
117  const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */
118 );
119 
120 /* Decodes signs of excitation */
121 void silk_decode_signs(
122  ec_dec *psRangeDec, /* I/O Compressor data structure */
123  opus_int16 pulses[], /* I/O pulse signal */
124  opus_int length, /* I length of input */
125  const opus_int signalType, /* I Signal type */
126  const opus_int quantOffsetType, /* I Quantization offset type */
127  const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum of absolute pulses per block */
128 );
129 
130 /* Check encoder control struct */
132  silk_EncControlStruct *encControl /* I Control structure */
133 );
134 
135 /* Control internal sampling rate */
137  silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */
138  silk_EncControlStruct *encControl /* I Control structure */
139 );
140 
141 /* Control SNR of redidual quantizer */
143  silk_encoder_state *psEncC, /* I/O Pointer to Silk encoder state */
144  opus_int32 TargetRate_bps /* I Target max bitrate (bps) */
145 );
146 
147 /***************/
148 /* Shell coder */
149 /***************/
150 
151 /* Encode quantization indices of excitation */
152 void silk_encode_pulses(
153  ec_enc *psRangeEnc, /* I/O compressor data structure */
154  const opus_int signalType, /* I Signal type */
155  const opus_int quantOffsetType, /* I quantOffsetType */
156  opus_int8 pulses[], /* I quantization indices */
157  const opus_int frame_length /* I Frame length */
158 );
159 
160 /* Shell encoder, operates on one shell code frame of 16 pulses */
161 void silk_shell_encoder(
162  ec_enc *psRangeEnc, /* I/O compressor data structure */
163  const opus_int *pulses0 /* I data: nonnegative pulse amplitudes */
164 );
165 
166 /* Shell decoder, operates on one shell code frame of 16 pulses */
167 void silk_shell_decoder(
168  opus_int16 *pulses0, /* O data: nonnegative pulse amplitudes */
169  ec_dec *psRangeDec, /* I/O Compressor data structure */
170  const opus_int pulses4 /* I number of pulses per pulse-subframe */
171 );
172 
173 /* Gain scalar quantization with hysteresis, uniform on log scale */
174 void silk_gains_quant(
175  opus_int8 ind[ MAX_NB_SUBFR ], /* O gain indices */
176  opus_int32 gain_Q16[ MAX_NB_SUBFR ], /* I/O gains (quantized out) */
177  opus_int8 *prev_ind, /* I/O last index in previous frame */
178  const opus_int conditional, /* I first gain is delta coded if 1 */
179  const opus_int nb_subfr /* I number of subframes */
180 );
181 
182 /* Gains scalar dequantization, uniform on log scale */
183 void silk_gains_dequant(
184  opus_int32 gain_Q16[ MAX_NB_SUBFR ], /* O quantized gains */
185  const opus_int8 ind[ MAX_NB_SUBFR ], /* I gain indices */
186  opus_int8 *prev_ind, /* I/O last index in previous frame */
187  const opus_int conditional, /* I first gain is delta coded if 1 */
188  const opus_int nb_subfr /* I number of subframes */
189 );
190 
191 /* Compute unique identifier of gain indices vector */
192 opus_int32 silk_gains_ID( /* O returns unique identifier of gains */
193  const opus_int8 ind[ MAX_NB_SUBFR ], /* I gain indices */
194  const opus_int nb_subfr /* I number of subframes */
195 );
196 
197 /* Interpolate two vectors */
198 void silk_interpolate(
199  opus_int16 xi[ MAX_LPC_ORDER ], /* O interpolated vector */
200  const opus_int16 x0[ MAX_LPC_ORDER ], /* I first vector */
201  const opus_int16 x1[ MAX_LPC_ORDER ], /* I second vector */
202  const opus_int ifact_Q2, /* I interp. factor, weight on 2nd vector */
203  const opus_int d /* I number of parameters */
204 );
205 
206 /* LTP tap quantizer */
208  opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ], /* I/O (un)quantized LTP gains */
209  opus_int8 cbk_index[ MAX_NB_SUBFR ], /* O Codebook Index */
210  opus_int8 *periodicity_index, /* O Periodicity Index */
211  opus_int32 *sum_gain_dB_Q7, /* I/O Cumulative max prediction gain */
212  const opus_int32 W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ], /* I Error Weights in Q18 */
213  opus_int mu_Q9, /* I Mu value (R/D tradeoff) */
214  opus_int lowComplexity, /* I Flag for low complexity */
215  const opus_int nb_subfr, /* I number of subframes */
216  int arch /* I Run-time architecture */
217 );
218 
219 /* Entropy constrained matrix-weighted VQ, for a single input data vector */
220 void silk_VQ_WMat_EC_c(
221  opus_int8 *ind, /* O index of best codebook vector */
222  opus_int32 *rate_dist_Q14, /* O best weighted quant error + mu * rate */
223  opus_int *gain_Q7, /* O sum of absolute LTP coefficients */
224  const opus_int16 *in_Q14, /* I input vector to be quantized */
225  const opus_int32 *W_Q18, /* I weighting matrix */
226  const opus_int8 *cb_Q7, /* I codebook */
227  const opus_uint8 *cb_gain_Q7, /* I codebook effective gain */
228  const opus_uint8 *cl_Q5, /* I code length for each codebook vector */
229  const opus_int mu_Q9, /* I tradeoff betw. weighted error and rate */
230  const opus_int32 max_gain_Q7, /* I maximum sum of absolute LTP coefficients */
231  opus_int L /* I number of vectors in codebook */
232 );
233 
234 #if !defined(OVERRIDE_silk_VQ_WMat_EC)
235 #define silk_VQ_WMat_EC(ind, rate_dist_Q14, gain_Q7, in_Q14, W_Q18, cb_Q7, cb_gain_Q7, cl_Q5, \
236  mu_Q9, max_gain_Q7, L, arch) \
237  ((void)(arch),silk_VQ_WMat_EC_c(ind, rate_dist_Q14, gain_Q7, in_Q14, W_Q18, cb_Q7, cb_gain_Q7, cl_Q5, \
238  mu_Q9, max_gain_Q7, L))
239 #endif
240 
241 /************************************/
242 /* Noise shaping quantization (NSQ) */
243 /************************************/
244 
245 void silk_NSQ_c(
246  const silk_encoder_state *psEncC, /* I/O Encoder State */
247  silk_nsq_state *NSQ, /* I/O NSQ state */
248  SideInfoIndices *psIndices, /* I/O Quantization Indices */
249  const opus_int32 x_Q3[], /* I Prefiltered input signal */
250  opus_int8 pulses[], /* O Quantized pulse signal */
251  const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */
252  const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */
253  const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */
254  const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */
255  const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */
256  const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I Low frequency shaping coefs */
257  const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I Quantization step sizes */
258  const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */
259  const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */
260  const opus_int LTP_scale_Q14 /* I LTP state scaling */
261 );
262 
263 #if !defined(OVERRIDE_silk_NSQ)
264 #define silk_NSQ(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
265  HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
266  ((void)(arch),silk_NSQ_c(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
267  HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14))
268 #endif
269 
270 /* Noise shaping using delayed decision */
271 void silk_NSQ_del_dec_c(
272  const silk_encoder_state *psEncC, /* I/O Encoder State */
273  silk_nsq_state *NSQ, /* I/O NSQ state */
274  SideInfoIndices *psIndices, /* I/O Quantization Indices */
275  const opus_int32 x_Q3[], /* I Prefiltered input signal */
276  opus_int8 pulses[], /* O Quantized pulse signal */
277  const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */
278  const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */
279  const opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */
280  const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */
281  const opus_int Tilt_Q14[ MAX_NB_SUBFR ], /* I Spectral tilt */
282  const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ], /* I Low frequency shaping coefs */
283  const opus_int32 Gains_Q16[ MAX_NB_SUBFR ], /* I Quantization step sizes */
284  const opus_int pitchL[ MAX_NB_SUBFR ], /* I Pitch lags */
285  const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */
286  const opus_int LTP_scale_Q14 /* I LTP state scaling */
287 );
288 
289 #if !defined(OVERRIDE_silk_NSQ_del_dec)
290 #define silk_NSQ_del_dec(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
291  HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
292  ((void)(arch),silk_NSQ_del_dec_c(psEncC, NSQ, psIndices, x_Q3, pulses, PredCoef_Q12, LTPCoef_Q14, AR2_Q13, \
293  HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14))
294 #endif
295 
296 /************/
297 /* Silk VAD */
298 /************/
299 /* Initialize the Silk VAD */
300 opus_int silk_VAD_Init( /* O Return value, 0 if success */
301  silk_VAD_state *psSilk_VAD /* I/O Pointer to Silk VAD state */
302 );
303 
304 /* Get speech activity level in Q8 */
305 opus_int silk_VAD_GetSA_Q8_c( /* O Return value, 0 if success */
306  silk_encoder_state *psEncC, /* I/O Encoder state */
307  const opus_int16 pIn[] /* I PCM input */
308 );
309 
310 #if !defined(OVERRIDE_silk_VAD_GetSA_Q8)
311 #define silk_VAD_GetSA_Q8(psEnC, pIn, arch) ((void)(arch),silk_VAD_GetSA_Q8_c(psEnC, pIn))
312 #endif
313 
314 /* Low-pass filter with variable cutoff frequency based on */
315 /* piece-wise linear interpolation between elliptic filters */
316 /* Start by setting transition_frame_no = 1; */
318  silk_LP_state *psLP, /* I/O LP filter state */
319  opus_int16 *frame, /* I/O Low-pass filtered output signal */
320  const opus_int frame_length /* I Frame length */
321 );
322 
323 /******************/
324 /* NLSF Quantizer */
325 /******************/
326 /* Limit, stabilize, convert and quantize NLSFs */
327 void silk_process_NLSFs(
328  silk_encoder_state *psEncC, /* I/O Encoder state */
329  opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ], /* O Prediction coefficients */
330  opus_int16 pNLSF_Q15[ MAX_LPC_ORDER ], /* I/O Normalized LSFs (quant out) (0 - (2^15-1)) */
331  const opus_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ] /* I Previous Normalized LSFs (0 - (2^15-1)) */
332 );
333 
334 opus_int32 silk_NLSF_encode( /* O Returns RD value in Q25 */
335  opus_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */
336  opus_int16 *pNLSF_Q15, /* I/O Quantized NLSF vector [ LPC_ORDER ] */
337  const silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook object */
338  const opus_int16 *pW_QW, /* I NLSF weight vector [ LPC_ORDER ] */
339  const opus_int NLSF_mu_Q20, /* I Rate weight for the RD optimization */
340  const opus_int nSurvivors, /* I Max survivors after first stage */
341  const opus_int signalType /* I Signal type: 0/1/2 */
342 );
343 
344 /* Compute quantization errors for an LPC_order element input vector for a VQ codebook */
345 void silk_NLSF_VQ(
346  opus_int32 err_Q26[], /* O Quantization errors [K] */
347  const opus_int16 in_Q15[], /* I Input vectors to be quantized [LPC_order] */
348  const opus_uint8 pCB_Q8[], /* I Codebook vectors [K*LPC_order] */
349  const opus_int K, /* I Number of codebook vectors */
350  const opus_int LPC_order /* I Number of LPCs */
351 );
352 
353 /* Delayed-decision quantizer for NLSF residuals */
354 opus_int32 silk_NLSF_del_dec_quant( /* O Returns RD value in Q25 */
355  opus_int8 indices[], /* O Quantization indices [ order ] */
356  const opus_int16 x_Q10[], /* I Input [ order ] */
357  const opus_int16 w_Q5[], /* I Weights [ order ] */
358  const opus_uint8 pred_coef_Q8[], /* I Backward predictor coefs [ order ] */
359  const opus_int16 ec_ix[], /* I Indices to entropy coding tables [ order ] */
360  const opus_uint8 ec_rates_Q5[], /* I Rates [] */
361  const opus_int quant_step_size_Q16, /* I Quantization step size */
362  const opus_int16 inv_quant_step_size_Q6, /* I Inverse quantization step size */
363  const opus_int32 mu_Q20, /* I R/D tradeoff */
364  const opus_int16 order /* I Number of input values */
365 );
366 
367 /* Unpack predictor values and indices for entropy coding tables */
368 void silk_NLSF_unpack(
369  opus_int16 ec_ix[], /* O Indices to entropy tables [ LPC_ORDER ] */
370  opus_uint8 pred_Q8[], /* O LSF predictor [ LPC_ORDER ] */
371  const silk_NLSF_CB_struct *psNLSF_CB, /* I Codebook object */
372  const opus_int CB1_index /* I Index of vector in first LSF codebook */
373 );
374 
375 /***********************/
376 /* NLSF vector decoder */
377 /***********************/
378 void silk_NLSF_decode(
379  opus_int16 *pNLSF_Q15, /* O Quantized NLSF vector [ LPC_ORDER ] */
380  opus_int8 *NLSFIndices, /* I Codebook path vector [ LPC_ORDER + 1 ] */
381  const silk_NLSF_CB_struct *psNLSF_CB /* I Codebook object */
382 );
383 
384 /****************************************************/
385 /* Decoder Functions */
386 /****************************************************/
388  silk_decoder_state *psDec /* I/O Decoder state pointer */
389 );
390 
391 /* Set decoder sampling rate */
393  silk_decoder_state *psDec, /* I/O Decoder state pointer */
394  opus_int fs_kHz, /* I Sampling frequency (kHz) */
395  opus_int32 fs_API_Hz /* I API Sampling frequency (Hz) */
396 );
397 
398 /****************/
399 /* Decode frame */
400 /****************/
402  silk_decoder_state *psDec, /* I/O Pointer to Silk decoder state */
403  ec_dec *psRangeDec, /* I/O Compressor data structure */
404  opus_int16 pOut[], /* O Pointer to output speech frame */
405  opus_int32 *pN, /* O Pointer to size of output frame */
406  opus_int lostFlag, /* I 0: no loss, 1 loss, 2 decode fec */
407  opus_int condCoding, /* I The type of conditional coding to use */
408  int arch /* I Run-time architecture */
409 );
410 
411 /* Decode indices from bitstream */
413  silk_decoder_state *psDec, /* I/O State */
414  ec_dec *psRangeDec, /* I/O Compressor data structure */
415  opus_int FrameIndex, /* I Frame number */
416  opus_int decode_LBRR, /* I Flag indicating LBRR data is being decoded */
417  opus_int condCoding /* I The type of conditional coding to use */
418 );
419 
420 /* Decode parameters from payload */
422  silk_decoder_state *psDec, /* I/O State */
423  silk_decoder_control *psDecCtrl, /* I/O Decoder control */
424  opus_int condCoding /* I The type of conditional coding to use */
425 );
426 
427 /* Core decoder. Performs inverse NSQ operation LTP + LPC */
428 void silk_decode_core(
429  silk_decoder_state *psDec, /* I/O Decoder state */
430  silk_decoder_control *psDecCtrl, /* I Decoder control */
431  opus_int16 xq[], /* O Decoded speech */
432  const opus_int16 pulses[ MAX_FRAME_LENGTH ], /* I Pulse signal */
433  int arch /* I Run-time architecture */
434 );
435 
436 /* Decode quantization indices of excitation (Shell coding) */
437 void silk_decode_pulses(
438  ec_dec *psRangeDec, /* I/O Compressor data structure */
439  opus_int16 pulses[], /* O Excitation signal */
440  const opus_int signalType, /* I Sigtype */
441  const opus_int quantOffsetType, /* I quantOffsetType */
442  const opus_int frame_length /* I Frame length */
443 );
444 
445 /******************/
446 /* CNG */
447 /******************/
448 
449 /* Reset CNG */
450 void silk_CNG_Reset(
451  silk_decoder_state *psDec /* I/O Decoder state */
452 );
453 
454 /* Updates CNG estimate, and applies the CNG when packet was lost */
455 void silk_CNG(
456  silk_decoder_state *psDec, /* I/O Decoder state */
457  silk_decoder_control *psDecCtrl, /* I/O Decoder control */
458  opus_int16 frame[], /* I/O Signal */
459  opus_int length /* I Length of residual */
460 );
461 
462 /* Encoding of various parameters */
464  silk_encoder_state *psEncC, /* I/O Encoder state */
465  ec_enc *psRangeEnc, /* I/O Compressor data structure */
466  opus_int FrameIndex, /* I Frame number */
467  opus_int encode_LBRR, /* I Flag indicating LBRR data is being encoded */
468  opus_int condCoding /* I The type of conditional coding to use */
469 );
470 
471 #endif
void silk_decode_parameters(silk_decoder_state *psDec, silk_decoder_control *psDecCtrl, opus_int condCoding)
Definition: decode_parameters.c:35
void silk_shell_encoder(ec_enc *psRangeEnc, const opus_int *pulses0)
Definition: shell_coder.c:78
void silk_NSQ_del_dec_c(const silk_encoder_state *psEncC, silk_nsq_state *NSQ, SideInfoIndices *psIndices, const opus_int32 x_Q3[], opus_int8 pulses[], const opus_int16 PredCoef_Q12[2 *MAX_LPC_ORDER], const opus_int16 LTPCoef_Q14[LTP_ORDER *MAX_NB_SUBFR], const opus_int16 AR2_Q13[MAX_NB_SUBFR *MAX_SHAPE_LPC_ORDER], const opus_int HarmShapeGain_Q14[MAX_NB_SUBFR], const opus_int Tilt_Q14[MAX_NB_SUBFR], const opus_int32 LF_shp_Q14[MAX_NB_SUBFR], const opus_int32 Gains_Q16[MAX_NB_SUBFR], const opus_int pitchL[MAX_NB_SUBFR], const opus_int Lambda_Q10, const opus_int LTP_scale_Q14)
Definition: NSQ_del_dec.c:115
Definition: conditional.py:1
void silk_decode_signs(ec_dec *psRangeDec, opus_int16 pulses[], opus_int length, const opus_int signalType, const opus_int quantOffsetType, const opus_int sum_pulses[MAX_NB_SHELL_BLOCKS])
Definition: code_signs.c:75
opus_int silk_decode_frame(silk_decoder_state *psDec, ec_dec *psRangeDec, opus_int16 pOut[], opus_int32 *pN, opus_int lostFlag, opus_int condCoding, int arch)
Definition: decode_frame.c:39
Definition: structs.h:83
short opus_int16
Definition: opus_types.h:144
Definition: structs.h:260
opus_int silk_control_SNR(silk_encoder_state *psEncC, opus_int32 TargetRate_bps)
Definition: control_SNR.c:36
#define MAX_FRAME_LENGTH
Definition: define.h:92
#define opus_int
Definition: opus_types.h:151
opus_int silk_decoder_set_fs(silk_decoder_state *psDec, opus_int fs_kHz, opus_int32 fs_API_Hz)
Definition: decoder_set_fs.c:35
#define opus_int8
Definition: opus_types.h:153
void silk_stereo_LR_to_MS(stereo_enc_state *state, opus_int16 x1[], opus_int16 x2[], opus_int8 ix[2][3], opus_int8 *mid_only_flag, opus_int32 mid_side_rates_bps[], opus_int32 total_rate_bps, opus_int prev_speech_act_Q8, opus_int toMono, opus_int fs_kHz, opus_int frame_length)
Definition: stereo_LR_to_MS.c:36
opus_int32 silk_stereo_find_predictor(opus_int32 *ratio_Q14, const opus_int16 x[], const opus_int16 y[], opus_int32 mid_res_amp_Q0[], opus_int length, opus_int smooth_coef_Q16)
Definition: stereo_find_predictor.c:35
opus_int silk_VAD_GetSA_Q8_c(silk_encoder_state *psEncC, const opus_int16 pIn[])
Definition: VAD.c:82
void silk_process_NLSFs(silk_encoder_state *psEncC, opus_int16 PredCoef_Q12[2][MAX_LPC_ORDER], opus_int16 pNLSF_Q15[MAX_LPC_ORDER], const opus_int16 prev_NLSFq_Q15[MAX_LPC_ORDER])
Definition: process_NLSFs.c:35
Definition: structs.h:312
void silk_shell_decoder(opus_int16 *pulses0, ec_dec *psRangeDec, const opus_int pulses4)
Definition: shell_coder.c:119
Definition: control.h:46
void silk_decode_indices(silk_decoder_state *psDec, ec_dec *psRangeDec, opus_int FrameIndex, opus_int decode_LBRR, opus_int condCoding)
Definition: decode_indices.c:35
#define K
Definition: gcc-loops.cpp:16
void silk_interpolate(opus_int16 xi[MAX_LPC_ORDER], const opus_int16 x0[MAX_LPC_ORDER], const opus_int16 x1[MAX_LPC_ORDER], const opus_int ifact_Q2, const opus_int d)
Definition: interpolate.c:35
#define LTP_ORDER
Definition: define.h:141
opus_int silk_init_decoder(silk_decoder_state *psDec)
Definition: init_decoder.c:37
void silk_encode_signs(ec_enc *psRangeEnc, const opus_int8 pulses[], opus_int length, const opus_int signalType, const opus_int quantOffsetType, const opus_int sum_pulses[MAX_NB_SHELL_BLOCKS])
Definition: code_signs.c:41
void silk_stereo_encode_mid_only(ec_enc *psRangeEnc, opus_int8 mid_only_flag)
Definition: stereo_encode_pred.c:55
void silk_NLSF_decode(opus_int16 *pNLSF_Q15, opus_int8 *NLSFIndices, const silk_NLSF_CB_struct *psNLSF_CB)
Definition: NLSF_decode.c:63
EGLSurface EGLint x
Definition: eglext.h:950
int opus_int32
Definition: opus_types.h:146
void silk_stereo_encode_pred(ec_enc *psRangeEnc, opus_int8 ix[2][3])
Definition: stereo_encode_pred.c:35
opus_int32 silk_NLSF_encode(opus_int8 *NLSFIndices, opus_int16 *pNLSF_Q15, const silk_NLSF_CB_struct *psNLSF_CB, const opus_int16 *pW_QW, const opus_int NLSF_mu_Q20, const opus_int nSurvivors, const opus_int signalType)
Definition: NLSF_encode.c:38
void silk_CNG_Reset(silk_decoder_state *psDec)
Definition: CNG.c:62
opus_int32 silk_gains_ID(const opus_int8 ind[MAX_NB_SUBFR], const opus_int nb_subfr)
Definition: gain_quant.c:127
Definition: structs.h:115
#define opus_uint8
Definition: opus_types.h:157
opus_int silk_control_audio_bandwidth(silk_encoder_state *psEncC, silk_EncControlStruct *encControl)
Definition: control_audio_bandwidth.c:36
void silk_LP_variable_cutoff(silk_LP_state *psLP, opus_int16 *frame, const opus_int frame_length)
Definition: LP_variable_cutoff.c:100
opus_int silk_VAD_Init(silk_VAD_state *psSilk_VAD)
Definition: VAD.c:46
void silk_VQ_WMat_EC_c(opus_int8 *ind, opus_int32 *rate_dist_Q14, opus_int *gain_Q7, const opus_int16 *in_Q14, const opus_int32 *W_Q18, const opus_int8 *cb_Q7, const opus_uint8 *cb_gain_Q7, const opus_uint8 *cl_Q5, const opus_int mu_Q9, const opus_int32 max_gain_Q7, opus_int L)
Definition: VQ_WMat_EC.c:35
Definition: entcode.h:62
void silk_encode_indices(silk_encoder_state *psEncC, ec_enc *psRangeEnc, opus_int FrameIndex, opus_int encode_LBRR, opus_int condCoding)
Definition: encode_indices.c:35
AudioFrame frame
Definition: audio_processing_impl_locking_unittest.cc:105
void silk_NSQ_c(const silk_encoder_state *psEncC, silk_nsq_state *NSQ, SideInfoIndices *psIndices, const opus_int32 x_Q3[], opus_int8 pulses[], const opus_int16 PredCoef_Q12[2 *MAX_LPC_ORDER], const opus_int16 LTPCoef_Q14[LTP_ORDER *MAX_NB_SUBFR], const opus_int16 AR2_Q13[MAX_NB_SUBFR *MAX_SHAPE_LPC_ORDER], const opus_int HarmShapeGain_Q14[MAX_NB_SUBFR], const opus_int Tilt_Q14[MAX_NB_SUBFR], const opus_int32 LF_shp_Q14[MAX_NB_SUBFR], const opus_int32 Gains_Q16[MAX_NB_SUBFR], const opus_int pitchL[MAX_NB_SUBFR], const opus_int Lambda_Q10, const opus_int LTP_scale_Q14)
Definition: NSQ.c:77
Definition: structs.h:109
EGLSurface EGLint EGLint y
Definition: eglext.h:950
Definition: structs.h:45
Definition: structs.h:97
opus_int32 silk_NLSF_del_dec_quant(opus_int8 indices[], const opus_int16 x_Q10[], const opus_int16 w_Q5[], const opus_uint8 pred_coef_Q8[], const opus_int16 ec_ix[], const opus_uint8 ec_rates_Q5[], const opus_int quant_step_size_Q16, const opus_int16 inv_quant_step_size_Q6, const opus_int32 mu_Q20, const opus_int16 order)
Definition: NLSF_del_dec_quant.c:35
void silk_CNG(silk_decoder_state *psDec, silk_decoder_control *psDecCtrl, opus_int16 frame[], opus_int length)
Definition: CNG.c:79
void silk_gains_dequant(opus_int32 gain_Q16[MAX_NB_SUBFR], const opus_int8 ind[MAX_NB_SUBFR], opus_int8 *prev_ind, const opus_int conditional, const opus_int nb_subfr)
Definition: gain_quant.c:93
string arch
Definition: runtests.py:65
void silk_stereo_decode_pred(ec_dec *psRangeDec, opus_int32 pred_Q13[])
Definition: stereo_decode_pred.c:35
void silk_stereo_MS_to_LR(stereo_dec_state *state, opus_int16 x1[], opus_int16 x2[], const opus_int32 pred_Q13[], opus_int fs_kHz, opus_int frame_length)
Definition: stereo_MS_to_LR.c:35
#define MAX_SHAPE_LPC_ORDER
Definition: define.h:150
Definition: structs.h:132
#define MAX_LPC_ORDER
Definition: define.h:137
void silk_NLSF_VQ(opus_int32 err_Q26[], const opus_int16 in_Q15[], const opus_uint8 pCB_Q8[], const opus_int K, const opus_int LPC_order)
Definition: NLSF_VQ.c:35
#define MAX_NB_SUBFR
Definition: define.h:85
void silk_decode_pulses(ec_dec *psRangeDec, opus_int16 pulses[], const opus_int signalType, const opus_int quantOffsetType, const opus_int frame_length)
Definition: decode_pulses.c:37
#define MAX_NB_SHELL_BLOCKS
Definition: define.h:166
void silk_decode_core(silk_decoder_state *psDec, silk_decoder_control *psDecCtrl, opus_int16 xq[], const opus_int16 pulses[MAX_FRAME_LENGTH], int arch)
Definition: decode_core.c:38
void silk_stereo_quant_pred(opus_int32 pred_Q13[], opus_int8 ix[2][3])
Definition: stereo_quant_pred.c:35
void silk_encode_pulses(ec_enc *psRangeEnc, const opus_int signalType, const opus_int quantOffsetType, opus_int8 pulses[], const opus_int frame_length)
Definition: encode_pulses.c:60
void silk_gains_quant(opus_int8 ind[MAX_NB_SUBFR], opus_int32 gain_Q16[MAX_NB_SUBFR], opus_int8 *prev_ind, const opus_int conditional, const opus_int nb_subfr)
Definition: gain_quant.c:39
Definition: structs.h:62
string state
Definition: buildtests.py:34
#define d
Definition: float-mm.c:30
void silk_stereo_decode_mid_only(ec_dec *psRangeDec, opus_int *decode_only_mid)
Definition: stereo_decode_pred.c:66
Definition: structs.h:76
opus_int check_control_input(silk_EncControlStruct *encControl)
Definition: check_control_input.c:37
GLuint GLsizei GLsizei * length
Definition: gl2.h:435
void silk_quant_LTP_gains(opus_int16 B_Q14[MAX_NB_SUBFR *LTP_ORDER], opus_int8 cbk_index[MAX_NB_SUBFR], opus_int8 *periodicity_index, opus_int32 *sum_gain_dB_Q7, const opus_int32 W_Q18[MAX_NB_SUBFR *LTP_ORDER *LTP_ORDER], opus_int mu_Q9, opus_int lowComplexity, const opus_int nb_subfr, int arch)
Definition: quant_LTP_gains.c:35
void silk_NLSF_unpack(opus_int16 ec_ix[], opus_uint8 pred_Q8[], const silk_NLSF_CB_struct *psNLSF_CB, const opus_int CB1_index)
Definition: NLSF_unpack.c:35
GLsizei GLenum const void * indices
Definition: gl2.h:422