Addresses a bitstream bug for stereo FEC and minor fixes that make Opus compile again...
[opus.git] / silk / silk_main.h
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, (subject to the limitations in the disclaimer below)
5 are permitted provided that the following conditions 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 Skype Limited, nor the names of specific
12 contributors, may be used to endorse or promote products derived from
13 this software without specific prior written permission.
14 NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***********************************************************************/
27
28 #ifndef SILK_MAIN_H
29 #define SILK_MAIN_H
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35
36 #include "silk_SigProc_FIX.h"
37 #include "silk_define.h"
38 #include "silk_structs.h"
39 #include "silk_tables.h"
40 #include "silk_PLC.h"
41 #include "silk_control.h"
42 #include "silk_debug.h"
43 #include "entenc.h"
44 #include "entdec.h"
45
46
47 /* Uncomment the next line to store intermadiate data to files */
48 //#define SAVE_ALL_INTERNAL_DATA      1
49 /* Uncomment the next line to force a fixed internal sampling rate (independent of what bitrate is used */
50 //#define FORCE_INTERNAL_FS_KHZ       16
51
52
53 /* Convert Left/Right stereo signal to adaptive Mid/Side representation */
54 void silk_stereo_LR_to_MS(
55     stereo_enc_state    *state,                         /* I/O  State                                       */
56     opus_int16           x1[],                           /* I/O  Left input signal, becomes mid signal       */
57     opus_int16           x2[],                           /* I/O  Right input signal, becomes side signal     */
58     opus_int8            ix[ 2 ][ 3 ],                   /* O    Quantization indices                        */
59     opus_int8            *mid_only_flag,                 /* O    Flag: only mid signal coded                 */
60     opus_int32           mid_side_rates_bps[],           /* O    Bitrates for mid and side signals           */
61     opus_int32           total_rate_bps,                 /* I    Total bitrate                               */
62     opus_int             prev_speech_act_Q8,             /* I    Speech activity level in previous frame     */
63     opus_int             fs_kHz,                         /* I    Sample rate (kHz)                           */
64     opus_int             frame_length                    /* I    Number of samples                           */
65 );
66
67 /* Convert adaptive Mid/Side representation to Left/Right stereo signal */
68 void silk_stereo_MS_to_LR(
69     stereo_dec_state    *state,                         /* I/O  State                                       */
70     opus_int16           x1[],                           /* I/O  Left input signal, becomes mid signal       */
71     opus_int16           x2[],                           /* I/O  Right input signal, becomes side signal     */
72     const opus_int32     pred_Q13[],                     /* I    Predictors                                  */
73     opus_int             fs_kHz,                         /* I    Samples rate (kHz)                          */
74     opus_int             frame_length                    /* I    Number of samples                           */
75 );
76
77 /* Find least-squares prediction gain for one signal based on another and quantize it */
78 opus_int32 silk_stereo_find_predictor(                   /* O    Returns predictor in Q13                    */
79     opus_int32           *ratio_Q14,                     /* O    Ratio of residual and mid energies          */
80     const opus_int16     x[],                            /* I    Basis signal                                */
81     const opus_int16     y[],                            /* I    Target signal                               */
82     opus_int32           mid_res_amp_Q0[],               /* I/O  Smoothed mid, residual norms                */
83     opus_int             length,                         /* I    Number of samples                           */
84     opus_int             smooth_coef_Q16                 /* I    Smoothing coefficient                       */
85 );
86
87 /* Quantize mid/side predictors */
88 void silk_stereo_quant_pred(
89     stereo_enc_state    *state,                         /* I/O  State                                       */
90     opus_int32           pred_Q13[],                     /* I/O  Predictors (out: quantized)                 */
91     opus_int8            ix[ 2 ][ 3 ]                    /* O    Quantization indices                        */
92 );
93
94 /* Entropy code the mid/side quantization indices */
95 void silk_stereo_encode_pred(
96     ec_enc              *psRangeEnc,                    /* I/O  Compressor data structure                   */
97     opus_int8            ix[ 2 ][ 3 ]                    /* I    Quantization indices                        */
98 );
99
100 /* Entropy code the mid-only flag */
101 void silk_stereo_encode_mid_only(
102     ec_enc              *psRangeEnc,                    /* I/O  Compressor data structure                   */
103     opus_int8            mid_only_flag
104 );
105
106 /* Decode mid/side predictors */
107 void silk_stereo_decode_pred(
108     ec_dec              *psRangeDec,                    /* I/O  Compressor data structure                   */
109     opus_int32           pred_Q13[]                      /* O    Predictors                                  */
110 );
111
112 /* Decode mid-only flag */
113 void silk_stereo_decode_mid_only(
114     ec_dec              *psRangeDec,                    /* I/O  Compressor data structure                   */
115     opus_int             *decode_only_mid                /* O    Flag that only mid channel has been coded   */
116 );
117
118 /* Encodes signs of excitation */
119 void silk_encode_signs(
120     ec_enc                      *psRangeEnc,                        /* I/O  Compressor data structure                   */
121     const opus_int8              pulses[],                           /* I    pulse signal                                */
122     opus_int                     length,                             /* I    length of input                             */
123     const opus_int               signalType,                         /* I    Signal type                                 */
124     const opus_int               quantOffsetType,                    /* I    Quantization offset type                    */
125     const opus_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
126 );
127
128 /* Decodes signs of excitation */
129 void silk_decode_signs(
130     ec_dec                      *psRangeDec,                        /* I/O  Compressor data structure                   */
131     opus_int                     pulses[],                           /* I/O  pulse signal                                */
132     opus_int                     length,                             /* I    length of input                             */
133     const opus_int               signalType,                         /* I    Signal type                                 */
134     const opus_int               quantOffsetType,                    /* I    Quantization offset type                    */
135     const opus_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
136 );
137
138 /* Check encoder control struct */
139 opus_int check_control_input(
140     silk_EncControlStruct        *encControl     /* I:   Control structure                               */
141 );
142
143 /* Control internal sampling rate */
144 opus_int silk_control_audio_bandwidth(
145     silk_encoder_state          *psEncC             /* I/O  Pointer to Silk encoder state               */
146 );
147
148 /* Control SNR of redidual quantizer */
149 opus_int silk_control_SNR(
150     silk_encoder_state          *psEncC,            /* I/O  Pointer to Silk encoder state               */
151     opus_int32                   TargetRate_bps      /* I    Target max bitrate (bps)                    */
152 );
153
154 /***************/
155 /* Shell coder */
156 /***************/
157
158 /* Encode quantization indices of excitation */
159 void silk_encode_pulses(
160     ec_enc                      *psRangeEnc,        /* I/O  compressor data structure                   */
161     const opus_int               signalType,         /* I    Signal type                                 */
162     const opus_int               quantOffsetType,    /* I    quantOffsetType                             */
163     opus_int8                    pulses[],           /* I    quantization indices                        */
164     const opus_int               frame_length        /* I    Frame length                                */
165 );
166
167 /* Shell encoder, operates on one shell code frame of 16 pulses */
168 void silk_shell_encoder(
169     ec_enc                      *psRangeEnc,        /* I/O  compressor data structure                   */
170     const opus_int               *pulses0            /* I    data: nonnegative pulse amplitudes          */
171 );
172
173 /* Shell decoder, operates on one shell code frame of 16 pulses */
174 void silk_shell_decoder(
175     opus_int                     *pulses0,           /* O    data: nonnegative pulse amplitudes          */
176     ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */
177     const opus_int               pulses4             /* I    number of pulses per pulse-subframe         */
178 );
179
180 /* Gain scalar quantization with hysteresis, uniform on log scale */
181 void silk_gains_quant(
182     opus_int8                        ind[ MAX_NB_SUBFR ],        /* O    gain indices                            */
183     opus_int32                       gain_Q16[ MAX_NB_SUBFR ],   /* I/O  gains (quantized out)                   */
184     opus_int8                        *prev_ind,                  /* I/O  last index in previous frame            */
185     const opus_int                   conditional,                /* I    first gain is delta coded if 1          */
186     const opus_int                   nb_subfr                    /* I    number of subframes                     */
187 );
188
189 /* Gains scalar dequantization, uniform on log scale */
190 void silk_gains_dequant(
191     opus_int32                       gain_Q16[ MAX_NB_SUBFR ],   /* O    quantized gains                         */
192     const opus_int8                  ind[ MAX_NB_SUBFR ],        /* I    gain indices                            */
193     opus_int8                        *prev_ind,                  /* I/O  last index in previous frame            */
194     const opus_int                   conditional,                /* I    first gain is delta coded if 1          */
195     const opus_int                   nb_subfr                    /* I    number of subframes                     */
196 );
197
198 /* Interpolate two vectors */
199 void silk_interpolate(
200     opus_int16                       xi[ MAX_LPC_ORDER ],    /* O    interpolated vector                     */
201     const opus_int16                 x0[ MAX_LPC_ORDER ],    /* I    first vector                            */
202     const opus_int16                 x1[ MAX_LPC_ORDER ],    /* I    second vector                           */
203     const opus_int                   ifact_Q2,               /* I    interp. factor, weight on 2nd vector    */
204     const opus_int                   d                       /* I    number of parameters                    */
205 );
206
207 /* LTP tap quantizer */
208 void silk_quant_LTP_gains(
209     opus_int16           B_Q14[ MAX_NB_SUBFR * LTP_ORDER ],              /* I/O  (un)quantized LTP gains     */
210     opus_int8            cbk_index[ MAX_NB_SUBFR ],                      /* O    Codebook Index              */
211     opus_int8            *periodicity_index,                             /* O    Periodicity Index           */
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 );
217
218 /* Entropy constrained matrix-weighted VQ, for a single input data vector */
219 void silk_VQ_WMat_EC(
220     opus_int8                        *ind,               /* O    index of best codebook vector               */
221     opus_int32                       *rate_dist_Q14,     /* O    best weighted quantization error + mu * rate*/
222     const opus_int16                 *in_Q14,            /* I    input vector to be quantized                */
223     const opus_int32                 *W_Q18,             /* I    weighting matrix                            */
224     const opus_int8                  *cb_Q7,             /* I    codebook                                    */
225     const opus_uint8                 *cl_Q5,             /* I    code length for each codebook vector        */
226     const opus_int                   mu_Q9,              /* I    tradeoff between weighted error and rate    */
227     opus_int                         L                   /* I    number of vectors in codebook               */
228 );
229
230 /***********************************/
231 /* Noise shaping quantization (NSQ)*/
232 /***********************************/
233 void silk_NSQ(
234     const silk_encoder_state        *psEncC,                                    /* I/O  Encoder State                       */
235     silk_nsq_state                  *NSQ,                                       /* I/O  NSQ state                           */
236     SideInfoIndices                 *psIndices,                                 /* I/O  Quantization Indices                */
237     const opus_int16                 x[],                                        /* I    prefiltered input signal            */
238     opus_int8                        pulses[],                                   /* O    quantized qulse signal              */
239     const opus_int16                 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Short term prediction coefficients  */
240     const opus_int16                 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],    /* I    Long term prediction coefficients   */
241     const opus_int16                 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I                                     */
242     const opus_int                   HarmShapeGain_Q14[ MAX_NB_SUBFR ],          /* I                                        */
243     const opus_int                   Tilt_Q14[ MAX_NB_SUBFR ],                   /* I    Spectral tilt                       */
244     const opus_int32                 LF_shp_Q14[ MAX_NB_SUBFR ],                 /* I                                        */
245     const opus_int32                 Gains_Q16[ MAX_NB_SUBFR ],                  /* I                                        */
246     const opus_int                   pitchL[ MAX_NB_SUBFR ],                     /* I                                        */
247     const opus_int                   Lambda_Q10,                                 /* I                                        */
248     const opus_int                   LTP_scale_Q14                               /* I    LTP state scaling                   */
249 );
250
251 /* Noise shaping using delayed decision */
252 void silk_NSQ_del_dec(
253     const silk_encoder_state        *psEncC,                                    /* I/O  Encoder State                       */
254     silk_nsq_state                  *NSQ,                                       /* I/O  NSQ state                           */
255     SideInfoIndices                 *psIndices,                                 /* I/O  Quantization Indices                */
256     const opus_int16                 x[],                                        /* I    Prefiltered input signal            */
257     opus_int8                        pulses[],                                   /* O    Quantized pulse signal              */
258     const opus_int16                 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Prediction coefs                    */
259     const opus_int16                 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],    /* I    LT prediction coefs                 */
260     const opus_int16                 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I                                     */
261     const opus_int                   HarmShapeGain_Q14[ MAX_NB_SUBFR ],          /* I                                        */
262     const opus_int                   Tilt_Q14[ MAX_NB_SUBFR ],                   /* I    Spectral tilt                       */
263     const opus_int32                 LF_shp_Q14[ MAX_NB_SUBFR ],                 /* I                                        */
264     const opus_int32                 Gains_Q16[ MAX_NB_SUBFR ],                  /* I                                        */
265     const opus_int                   pitchL[ MAX_NB_SUBFR ],                     /* I                                        */
266     const opus_int                   Lambda_Q10,                                 /* I                                        */
267     const opus_int                   LTP_scale_Q14                               /* I    LTP state scaling                   */
268 );
269
270 /************/
271 /* Silk VAD */
272 /************/
273 /* Initialize the Silk VAD */
274 opus_int silk_VAD_Init(                              /* O    Return value, 0 if success                  */
275     silk_VAD_state              *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */
276 );
277
278 /* Silk VAD noise level estimation */
279 void silk_VAD_GetNoiseLevels(
280     const opus_int32             pX[ VAD_N_BANDS ],  /* I    subband energies                            */
281     silk_VAD_state              *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */
282 );
283
284 /* Get speech activity level in Q8 */
285 opus_int silk_VAD_GetSA_Q8(                          /* O    Return value, 0 if success                  */
286     silk_encoder_state          *psEncC,            /* I/O  Encoder state                               */
287     const opus_int16             pIn[]               /* I    PCM input                                   */
288 );
289
290 /* Low-pass filter with variable cutoff frequency based on  */
291 /* piece-wise linear interpolation between elliptic filters */
292 /* Start by setting transition_frame_no = 1;                */
293 void silk_LP_variable_cutoff(
294     silk_LP_state               *psLP,              /* I/O  LP filter state                             */
295     opus_int16                   *signal,            /* I/O  Low-pass filtered output signal             */
296     const opus_int               frame_length        /* I    Frame length                                */
297 );
298
299 /******************/
300 /* NLSF Quantizer */
301 /******************/
302 /* Limit, stabilize, convert and quantize NLSFs */
303 void silk_process_NLSFs(
304     silk_encoder_state              *psEncC,                                /* I/O  Encoder state                               */
305     opus_int16                       PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ],     /* O    Prediction coefficients                     */
306     opus_int16                       pNLSF_Q15[         MAX_LPC_ORDER ],     /* I/O  Normalized LSFs (quant out) (0 - (2^15-1))  */
307     const opus_int16                 prev_NLSFq_Q15[    MAX_LPC_ORDER ]      /* I    Previous Normalized LSFs (0 - (2^15-1))     */
308 );
309
310 opus_int32 silk_NLSF_encode(                                 /* O    Returns RD value in Q25                 */
311           opus_int8                  *NLSFIndices,           /* I    Codebook path vector [ LPC_ORDER + 1 ]  */
312           opus_int16                 *pNLSF_Q15,             /* I/O  Quantized NLSF vector [ LPC_ORDER ]     */
313     const silk_NLSF_CB_struct       *psNLSF_CB,             /* I    Codebook object                         */
314     const opus_int16                 *pW_QW,                 /* I    NLSF weight vector [ LPC_ORDER ]        */
315     const opus_int                   NLSF_mu_Q20,            /* I    Rate weight for the RD optimization     */
316     const opus_int                   nSurvivors,             /* I    Max survivors after first stage         */
317     const opus_int                   signalType              /* I    Signal type: 0/1/2                      */
318 );
319
320 /* Compute quantization errors for an LPC_order element input vector for a VQ codebook */
321 void silk_NLSF_VQ(
322     opus_int32                   err_Q26[],              /* O    Quantization errors [K]                     */
323     const opus_int16             in_Q15[],               /* I    Input vectors to be quantized [LPC_order]   */
324     const opus_uint8             pCB_Q8[],               /* I    Codebook vectors [K*LPC_order]              */
325     const opus_int               K,                      /* I    Number of codebook vectors                  */
326     const opus_int               LPC_order               /* I    Number of LPCs                              */
327 );
328
329 /* Delayed-decision quantizer for NLSF residuals */
330 opus_int32 silk_NLSF_del_dec_quant(                      /* O    Returns RD value in Q25                     */
331     opus_int8                    indices[],              /* O    Quantization indices [ order ]              */
332     const opus_int16             x_Q10[],                /* I    Input [ order ]                             */
333     const opus_int16             w_Q5[],                 /* I    Weights [ order ]                           */
334     const opus_uint8             pred_coef_Q8[],         /* I    Backward predictor coefs [ order ]          */
335     const opus_int16             ec_ix[],                /* I    Indices to entropy coding tables [ order ]  */
336     const opus_uint8             ec_rates_Q5[],          /* I    Rates []                                    */
337     const opus_int               quant_step_size_Q16,    /* I    Quantization step size                      */
338     const opus_int16             inv_quant_step_size_Q6, /* I    Inverse quantization step size              */
339     const opus_int32             mu_Q20,                 /* I    R/D tradeoff                                */
340     const opus_int16             order                   /* I    Number of input values                      */
341 );
342
343 /* Unpack predictor values and indices for entropy coding tables */
344 void silk_NLSF_unpack(
345           opus_int16                 ec_ix[],                /* O    Indices to entropy tales [ LPC_ORDER ]  */
346           opus_uint8                 pred_Q8[],              /* O    LSF predictor [ LPC_ORDER ]             */
347     const silk_NLSF_CB_struct       *psNLSF_CB,             /* I    Codebook object                         */
348     const opus_int                   CB1_index               /* I    Index of vector in first LSF codebook   */
349 );
350
351 /***********************/
352 /* NLSF vector decoder */
353 /***********************/
354 void silk_NLSF_decode(
355           opus_int16                 *pNLSF_Q15,             /* O    Quantized NLSF vector [ LPC_ORDER ]     */
356           opus_int8                  *NLSFIndices,           /* I    Codebook path vector [ LPC_ORDER + 1 ]  */
357     const silk_NLSF_CB_struct       *psNLSF_CB              /* I    Codebook object                         */
358 );
359
360 /****************************************************/
361 /* Decoder Functions                                */
362 /****************************************************/
363 opus_int silk_create_decoder(
364     silk_decoder_state              **ppsDec            /* I/O  Decoder state pointer pointer               */
365 );
366
367 opus_int silk_free_decoder(
368     silk_decoder_state              *psDec              /* I/O  Decoder state pointer                       */
369 );
370
371 opus_int silk_init_decoder(
372     silk_decoder_state              *psDec              /* I/O  Decoder state pointer                       */
373 );
374
375 /* Set decoder sampling rate */
376 void silk_decoder_set_fs(
377     silk_decoder_state              *psDec,             /* I/O  Decoder state pointer                       */
378     opus_int                         fs_kHz              /* I    Sampling frequency (kHz)                    */
379 );
380
381 /****************/
382 /* Decode frame */
383 /****************/
384 opus_int silk_decode_frame(
385     silk_decoder_state          *psDec,             /* I/O  Pointer to Silk decoder state               */
386     ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */
387     opus_int16                   pOut[],             /* O    Pointer to output speech frame              */
388     opus_int32                   *pN,                /* O    Pointer to size of output frame             */
389     opus_int                     lostFlag            /* I    0: no loss, 1 loss, 2 decode fec            */
390 );
391
392 /* Decode LBRR side info and excitation */
393 void silk_LBRR_extract(
394     silk_decoder_state          *psDec,             /* I/O  State                                       */
395     ec_dec                      *psRangeDec         /* I/O  Compressor data structure                   */
396 );
397
398 /* Decode indices from payload v4 Bitstream */
399 void silk_decode_indices(
400     silk_decoder_state          *psDec,             /* I/O  State                                       */
401     ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */
402     opus_int                     FrameIndex,         /* I    Frame number                                */
403     opus_int                     decode_LBRR         /* I    Flag indicating LBRR data is being decoded  */
404 );
405
406 /* Decode parameters from payload */
407 void silk_decode_parameters(
408     silk_decoder_state      *psDec,                             /* I/O  State                                    */
409     silk_decoder_control    *psDecCtrl                          /* I/O  Decoder control                          */
410 );
411
412 /* Core decoder. Performs inverse NSQ operation LTP + LPC */
413 void silk_decode_core(
414     silk_decoder_state          *psDec,                             /* I/O  Decoder state               */
415     silk_decoder_control        *psDecCtrl,                         /* I    Decoder control             */
416     opus_int16                   xq[],                               /* O    Decoded speech              */
417     const opus_int               pulses[ MAX_FRAME_LENGTH ]          /* I    Pulse signal                */
418 );
419
420 /* Decode quantization indices of excitation (Shell coding) */
421 void silk_decode_pulses(
422     ec_dec                          *psRangeDec,        /* I/O  Compressor data structure                   */
423     opus_int                         pulses[],           /* O    Excitation signal                           */
424     const opus_int                   signalType,         /* I    Sigtype                                     */
425     const opus_int                   quantOffsetType,    /* I    quantOffsetType                             */
426     const opus_int                   frame_length        /* I    Frame length                                */
427 );
428
429 /******************/
430 /* CNG */
431 /******************/
432
433 /* Reset CNG */
434 void silk_CNG_Reset(
435     silk_decoder_state          *psDec              /* I/O  Decoder state                               */
436 );
437
438 /* Updates CNG estimate, and applies the CNG when packet was lost */
439 void silk_CNG(
440     silk_decoder_state          *psDec,             /* I/O  Decoder state                               */
441     silk_decoder_control        *psDecCtrl,         /* I/O  Decoder control                             */
442     opus_int16                   signal[],           /* I/O  Signal                                      */
443     opus_int                     length              /* I    Length of residual                          */
444 );
445
446 /* Encoding of various parameters */
447 void silk_encode_indices(
448     silk_encoder_state          *psEncC,            /* I/O  Encoder state                               */
449     ec_enc                      *psRangeEnc,        /* I/O  Compressor data structure                   */
450     opus_int                     FrameIndex,         /* I    Frame number                                */
451     opus_int                     encode_LBRR         /* I    Flag indicating LBRR data is being encoded  */
452 );
453
454 #ifdef __cplusplus
455 }
456 #endif
457
458 #endif