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