Moved all SILK source code to the silk/ directory
[opus.git] / silk / SKP_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 SKP_SILK_MAIN_H\r
29 #define SKP_SILK_MAIN_H\r
30 \r
31 #ifdef __cplusplus\r
32 extern "C"\r
33 {\r
34 #endif\r
35 \r
36 #include "SKP_Silk_SigProc_FIX.h"\r
37 #include "SKP_Silk_define.h"\r
38 #include "SKP_Silk_structs.h"\r
39 #include "SKP_Silk_tables.h"\r
40 #include "SKP_Silk_PLC.h"\r
41 #include "SKP_Silk_control.h"\r
42 #include "SKP_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 SKP_Silk_stereo_LR_to_MS( \r
55     stereo_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_int             *predictorIx,                   /* O    Index for predictor filter                  */\r
59     SKP_int             fs_kHz,                         /* I    Samples rate (kHz)                          */\r
60     SKP_int             frame_length                    /* I    Number of samples                           */\r
61 );\r
62 \r
63 /* Convert adaptive Mid/Side representation to Left/Right stereo signal */\r
64 void SKP_Silk_stereo_MS_to_LR( \r
65     stereo_state        *state,                         /* I/O  State                                       */\r
66     SKP_int16           x1[],                           /* I/O  Left input signal, becomes mid signal       */\r
67     SKP_int16           x2[],                           /* I/O  Right input signal, becomes side signal     */\r
68     SKP_int             predictorIx,                    /* I    Index for predictor filter                  */\r
69     SKP_int             fs_kHz,                         /* I    Samples rate (kHz)                          */\r
70     SKP_int             frame_length                    /* I    Number of samples                           */\r
71 );\r
72 \r
73 /* Encodes signs of excitation */\r
74 void SKP_Silk_encode_signs(\r
75     ec_enc                      *psRangeEnc,                        /* I/O  Compressor data structure                   */\r
76     const SKP_int8              pulses[],                           /* I    pulse signal                                */\r
77     SKP_int                     length,                             /* I    length of input                             */\r
78     const SKP_int               signalType,                         /* I    Signal type                                 */\r
79     const SKP_int               quantOffsetType,                    /* I    Quantization offset type                    */\r
80     const SKP_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */\r
81 );\r
82 \r
83 /* Decodes signs of excitation */\r
84 void SKP_Silk_decode_signs(\r
85     ec_dec                      *psRangeDec,                        /* I/O  Compressor data structure                   */\r
86     SKP_int                     pulses[],                           /* I/O  pulse signal                                */\r
87     SKP_int                     length,                             /* I    length of input                             */\r
88     const SKP_int               signalType,                         /* I    Signal type                                 */\r
89     const SKP_int               quantOffsetType,                    /* I    Quantization offset type                    */\r
90     const SKP_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */\r
91 );\r
92 \r
93 /* Check encoder control struct */\r
94 SKP_int check_control_input( \r
95     SKP_SILK_SDK_EncControlStruct        *encControl     /* I:   Control structure                               */\r
96 );\r
97 \r
98 /* Control internal sampling rate */\r
99 SKP_int SKP_Silk_control_audio_bandwidth(\r
100     SKP_Silk_encoder_state      *psEncC             /* I/O  Pointer to Silk encoder state               */\r
101 );\r
102 \r
103 /* Control SNR of redidual quantizer */\r
104 SKP_int SKP_Silk_control_SNR(\r
105     SKP_Silk_encoder_state      *psEncC,            /* I/O  Pointer to Silk encoder state               */\r
106     SKP_int32                   TargetRate_bps      /* I    Target max bitrate (bps)                    */\r
107 );\r
108 \r
109 /***************/\r
110 /* Shell coder */\r
111 /***************/\r
112 \r
113 /* Encode quantization indices of excitation */\r
114 void SKP_Silk_encode_pulses(\r
115     ec_enc                      *psRangeEnc,        /* I/O  compressor data structure                   */\r
116     const SKP_int               signalType,         /* I    Signal type                                 */\r
117     const SKP_int               quantOffsetType,    /* I    quantOffsetType                             */\r
118     SKP_int8                    pulses[],           /* I    quantization indices                        */\r
119     const SKP_int               frame_length        /* I    Frame length                                */\r
120 );\r
121 \r
122 /* Shell encoder, operates on one shell code frame of 16 pulses */\r
123 void SKP_Silk_shell_encoder(\r
124     ec_enc                      *psRangeEnc,        /* I/O  compressor data structure                   */\r
125     const SKP_int               *pulses0            /* I    data: nonnegative pulse amplitudes          */\r
126 );\r
127 \r
128 /* Shell decoder, operates on one shell code frame of 16 pulses */\r
129 void SKP_Silk_shell_decoder(\r
130     SKP_int                     *pulses0,           /* O    data: nonnegative pulse amplitudes          */\r
131     ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */\r
132     const SKP_int               pulses4             /* I    number of pulses per pulse-subframe         */\r
133 );\r
134 \r
135 /* Gain scalar quantization with hysteresis, uniform on log scale */\r
136 void SKP_Silk_gains_quant(\r
137     SKP_int8                        ind[ MAX_NB_SUBFR ],        /* O    gain indices                            */\r
138     SKP_int32                       gain_Q16[ MAX_NB_SUBFR ],   /* I/O  gains (quantized out)                   */\r
139     SKP_int8                        *prev_ind,                  /* I/O  last index in previous frame            */\r
140     const SKP_int                   conditional,                /* I    first gain is delta coded if 1          */\r
141     const SKP_int                   nb_subfr                    /* I    number of subframes                     */\r
142 );\r
143 \r
144 /* Gains scalar dequantization, uniform on log scale */\r
145 void SKP_Silk_gains_dequant(\r
146     SKP_int32                       gain_Q16[ MAX_NB_SUBFR ],   /* O    quantized gains                         */\r
147     const SKP_int8                  ind[ MAX_NB_SUBFR ],        /* I    gain indices                            */\r
148     SKP_int8                        *prev_ind,                  /* I/O  last index in previous frame            */\r
149     const SKP_int                   conditional,                /* I    first gain is delta coded if 1          */\r
150     const SKP_int                   nb_subfr                    /* I    number of subframes                     */\r
151 );\r
152 \r
153 /* Convert NLSF parameters to stable AR prediction filter coefficients */\r
154 void SKP_Silk_NLSF2A_stable(\r
155     SKP_int16                   pAR_Q12[ MAX_LPC_ORDER ],   /* O    Stabilized AR coefs [LPC_order]     */ \r
156     const SKP_int16             pNLSF[ MAX_LPC_ORDER ],     /* I    NLSF vector         [LPC_order]     */\r
157     const SKP_int               LPC_order                   /* I    LPC/LSF order                       */\r
158 );\r
159 \r
160 /* Interpolate two vectors */\r
161 void SKP_Silk_interpolate(\r
162     SKP_int16                       xi[ MAX_LPC_ORDER ],    /* O    interpolated vector                     */\r
163     const SKP_int16                 x0[ MAX_LPC_ORDER ],    /* I    first vector                            */\r
164     const SKP_int16                 x1[ MAX_LPC_ORDER ],    /* I    second vector                           */\r
165     const SKP_int                   ifact_Q2,               /* I    interp. factor, weight on 2nd vector    */\r
166     const SKP_int                   d                       /* I    number of parameters                    */\r
167 );\r
168 \r
169 /* LTP tap quantizer */\r
170 void SKP_Silk_quant_LTP_gains(\r
171     SKP_int16           B_Q14[ MAX_NB_SUBFR * LTP_ORDER ],              /* I/O  (un)quantized LTP gains     */\r
172     SKP_int8            cbk_index[ MAX_NB_SUBFR ],                      /* O    Codebook Index              */\r
173     SKP_int8            *periodicity_index,                             /* O    Periodicity Index           */\r
174     const SKP_int32     W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ],      /* I    Error Weights in Q18        */\r
175     SKP_int             mu_Q9,                                          /* I    Mu value (R/D tradeoff)     */\r
176     SKP_int             lowComplexity,                                  /* I    Flag for low complexity     */\r
177     const SKP_int       nb_subfr                                        /* I    number of subframes         */\r
178 );\r
179 \r
180 /* Entropy constrained matrix-weighted VQ, for a single input data vector */\r
181 void SKP_Silk_VQ_WMat_EC(\r
182     SKP_int8                        *ind,               /* O    index of best codebook vector               */\r
183     SKP_int32                       *rate_dist_Q14,     /* O    best weighted quantization error + mu * rate*/\r
184     const SKP_int16                 *in_Q14,            /* I    input vector to be quantized                */\r
185     const SKP_int32                 *W_Q18,             /* I    weighting matrix                            */\r
186     const SKP_int8                  *cb_Q7,             /* I    codebook                                    */\r
187     const SKP_uint8                 *cl_Q5,             /* I    code length for each codebook vector        */\r
188     const SKP_int                   mu_Q9,              /* I    tradeoff between weighted error and rate    */\r
189     SKP_int                         L                   /* I    number of vectors in codebook               */\r
190 );\r
191 \r
192 /***********************************/\r
193 /* Noise shaping quantization (NSQ)*/\r
194 /***********************************/\r
195 void SKP_Silk_NSQ(\r
196     const SKP_Silk_encoder_state    *psEncC,                                    /* I/O  Encoder State                       */\r
197     SKP_Silk_nsq_state              *NSQ,                                       /* I/O  NSQ state                           */\r
198     SideInfoIndices                 *psIndices,                                 /* I/O  Quantization Indices                */\r
199     const SKP_int16                 x[],                                        /* I    prefiltered input signal            */\r
200     SKP_int8                        pulses[],                                   /* O    quantized qulse signal              */\r
201     const SKP_int16                 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Short term prediction coefficients  */\r
202     const SKP_int16                 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],    /* I    Long term prediction coefficients   */\r
203     const SKP_int16                 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I                                     */\r
204     const SKP_int                   HarmShapeGain_Q14[ MAX_NB_SUBFR ],          /* I                                        */\r
205     const SKP_int                   Tilt_Q14[ MAX_NB_SUBFR ],                   /* I    Spectral tilt                       */\r
206     const SKP_int32                 LF_shp_Q14[ MAX_NB_SUBFR ],                 /* I                                        */\r
207     const SKP_int32                 Gains_Q16[ MAX_NB_SUBFR ],                  /* I                                        */\r
208     const SKP_int                   pitchL[ MAX_NB_SUBFR ],                     /* I                                        */\r
209     const SKP_int                   Lambda_Q10,                                 /* I                                        */\r
210     const SKP_int                   LTP_scale_Q14                               /* I    LTP state scaling                   */\r
211 );\r
212 \r
213 /* Noise shaping using delayed decision */\r
214 void SKP_Silk_NSQ_del_dec(\r
215     const SKP_Silk_encoder_state    *psEncC,                                    /* I/O  Encoder State                       */\r
216     SKP_Silk_nsq_state              *NSQ,                                       /* I/O  NSQ state                           */\r
217     SideInfoIndices                 *psIndices,                                 /* I/O  Quantization Indices                */\r
218     const SKP_int16                 x[],                                        /* I    Prefiltered input signal            */\r
219     SKP_int8                        pulses[],                                   /* O    Quantized pulse signal              */\r
220     const SKP_int16                 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],          /* I    Prediction coefs                    */\r
221     const SKP_int16                 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],    /* I    LT prediction coefs                 */\r
222     const SKP_int16                 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I                                     */\r
223     const SKP_int                   HarmShapeGain_Q14[ MAX_NB_SUBFR ],          /* I                                        */\r
224     const SKP_int                   Tilt_Q14[ MAX_NB_SUBFR ],                   /* I    Spectral tilt                       */\r
225     const SKP_int32                 LF_shp_Q14[ MAX_NB_SUBFR ],                 /* I                                        */\r
226     const SKP_int32                 Gains_Q16[ MAX_NB_SUBFR ],                  /* I                                        */\r
227     const SKP_int                   pitchL[ MAX_NB_SUBFR ],                     /* I                                        */\r
228     const SKP_int                   Lambda_Q10,                                 /* I                                        */\r
229     const SKP_int                   LTP_scale_Q14                               /* I    LTP state scaling                   */\r
230 );\r
231 \r
232 /************/\r
233 /* Silk VAD */\r
234 /************/\r
235 /* Initialize the Silk VAD */\r
236 SKP_int SKP_Silk_VAD_Init(                          /* O    Return value, 0 if success                  */ \r
237     SKP_Silk_VAD_state          *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */ \r
238 ); \r
239 \r
240 /* Silk VAD noise level estimation */\r
241 void SKP_Silk_VAD_GetNoiseLevels(\r
242     const SKP_int32             pX[ VAD_N_BANDS ],  /* I    subband energies                            */\r
243     SKP_Silk_VAD_state          *psSilk_VAD         /* I/O  Pointer to Silk VAD state                   */ \r
244 );\r
245 \r
246 /* Get speech activity level in Q8 */\r
247 SKP_int SKP_Silk_VAD_GetSA_Q8(                      /* O    Return value, 0 if success                  */\r
248     SKP_Silk_encoder_state      *psEncC,            /* I/O  Encoder state                               */\r
249     const SKP_int16             pIn[]               /* I    PCM input                                   */\r
250 );\r
251 \r
252 /* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */\r
253 void SKP_Silk_HP_variable_cutoff(\r
254     SKP_Silk_encoder_state          *psEncC,        /* I/O  Encoder state                               */\r
255     SKP_int16                       *out,           /* O    high-pass filtered output signal            */\r
256     const SKP_int16                 *in,            /* I    input signal                                */\r
257     const SKP_int                   frame_length    /* I    length of input                             */\r
258 );\r
259 \r
260 /* Low-pass filter with variable cutoff frequency based on  */\r
261 /* piece-wise linear interpolation between elliptic filters */\r
262 /* Start by setting transition_frame_no = 1;                */\r
263 void SKP_Silk_LP_variable_cutoff(\r
264     SKP_Silk_LP_state           *psLP,              /* I/O  LP filter state                             */\r
265     SKP_int16                   *signal,            /* I/O  Low-pass filtered output signal             */\r
266     const SKP_int               frame_length        /* I    Frame length                                */\r
267 );\r
268 \r
269 /******************/\r
270 /* NLSF Quantizer */\r
271 /******************/\r
272 /* Limit, stabilize, convert and quantize NLSFs */ \r
273 void SKP_Silk_process_NLSFs(\r
274     SKP_Silk_encoder_state          *psEncC,                                /* I/O  Encoder state                               */\r
275     SKP_int16                       PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ],     /* O    Prediction coefficients                     */\r
276     SKP_int16                       pNLSF_Q15[         MAX_LPC_ORDER ],     /* I/O  Normalized LSFs (quant out) (0 - (2^15-1))  */\r
277     const SKP_int16                 prev_NLSFq_Q15[    MAX_LPC_ORDER ]      /* I    Previous Normalized LSFs (0 - (2^15-1))     */\r
278 );\r
279 \r
280 SKP_int32 SKP_Silk_NLSF_encode(                             /* O    Returns RD value in Q25                 */\r
281           SKP_int8                  *NLSFIndices,           /* I    Codebook path vector [ LPC_ORDER + 1 ]  */\r
282           SKP_int16                 *pNLSF_Q15,             /* I/O  Quantized NLSF vector [ LPC_ORDER ]     */\r
283     const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,             /* I    Codebook object                         */\r
284     const SKP_int16                 *pW_Q5,                 /* I    NLSF weight vector [ LPC_ORDER ]        */\r
285     const SKP_int                   NLSF_mu_Q20,            /* I    Rate weight for the RD optimization     */\r
286     const SKP_int                   nSurvivors,             /* I    Max survivors after first stage         */\r
287     const SKP_int                   signalType              /* I    Signal type: 0/1/2                      */\r
288 );\r
289 \r
290 /* Compute quantization errors for an LPC_order element input vector for a VQ codebook */\r
291 void SKP_Silk_NLSF_VQ(\r
292     SKP_int32                   err_Q26[],              /* O    Quantization errors [K]                     */\r
293     const SKP_int16             in_Q15[],               /* I    Input vectors to be quantized [LPC_order]   */\r
294     const SKP_uint8             pCB_Q8[],               /* I    Codebook vectors [K*LPC_order]              */\r
295     const SKP_int               K,                      /* I    Number of codebook vectors                  */\r
296     const SKP_int               LPC_order               /* I    Number of LPCs                              */\r
297 );\r
298 \r
299 /* Delayed-decision quantizer for NLSF residuals */\r
300 SKP_int32 SKP_Silk_NLSF_del_dec_quant(                  /* O    Returns RD value in Q25                     */\r
301     SKP_int8                    indices[],              /* O    Quantization indices [ order ]              */\r
302     const SKP_int16             x_Q10[],                /* I    Input [ order ]                             */\r
303     const SKP_int16             w_Q5[],                 /* I    Weights [ order ]                           */\r
304     const SKP_uint8             pred_coef_Q8[],         /* I    Backward predictor coefs [ order ]          */\r
305     const SKP_int16             ec_ix[],                /* I    Indices to entropy coding tables [ order ]  */\r
306     const SKP_uint8             ec_rates_Q5[],          /* I    Rates []                                    */\r
307     const SKP_int               quant_step_size_Q16,    /* I    Quantization step size                      */\r
308     const SKP_int16             inv_quant_step_size_Q6, /* I    Inverse quantization step size              */\r
309     const SKP_int32             mu_Q20,                 /* I    R/D tradeoff                                */\r
310     const SKP_int16             order                   /* I    Number of input values                      */\r
311 );\r
312 \r
313 /* Unpack predictor values and indices for entropy coding tables */\r
314 void SKP_Silk_NLSF_unpack(\r
315           SKP_int16                 ec_ix[],                /* O    Indices to entropy tales [ LPC_ORDER ]  */\r
316           SKP_uint8                 pred_Q8[],              /* O    LSF predictor [ LPC_ORDER ]             */\r
317     const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,             /* I    Codebook object                         */\r
318     const SKP_int                   CB1_index               /* I    Index of vector in first LSF codebook   */\r
319 );\r
320 \r
321 /***********************/\r
322 /* NLSF vector decoder */\r
323 /***********************/\r
324 void SKP_Silk_NLSF_decode(\r
325           SKP_int16                 *pNLSF_Q15,             /* O    Quantized NLSF vector [ LPC_ORDER ]     */\r
326           SKP_int8                  *NLSFIndices,           /* I    Codebook path vector [ LPC_ORDER + 1 ]  */\r
327     const SKP_Silk_NLSF_CB_struct   *psNLSF_CB              /* I    Codebook object                         */\r
328 );\r
329 \r
330 /****************************************************/\r
331 /* Decoder Functions                                */\r
332 /****************************************************/\r
333 SKP_int SKP_Silk_create_decoder(\r
334     SKP_Silk_decoder_state          **ppsDec            /* I/O  Decoder state pointer pointer               */\r
335 );\r
336 \r
337 SKP_int SKP_Silk_free_decoder(\r
338     SKP_Silk_decoder_state          *psDec              /* I/O  Decoder state pointer                       */\r
339 );\r
340 \r
341 SKP_int SKP_Silk_init_decoder(\r
342     SKP_Silk_decoder_state          *psDec              /* I/O  Decoder state pointer                       */\r
343 );\r
344 \r
345 /* Set decoder sampling rate */\r
346 void SKP_Silk_decoder_set_fs(\r
347     SKP_Silk_decoder_state          *psDec,             /* I/O  Decoder state pointer                       */\r
348     SKP_int                         fs_kHz              /* I    Sampling frequency (kHz)                    */\r
349 );\r
350 \r
351 /****************/\r
352 /* Decode frame */\r
353 /****************/\r
354 SKP_int SKP_Silk_decode_frame(\r
355     SKP_Silk_decoder_state      *psDec,             /* I/O  Pointer to Silk decoder state               */\r
356     ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */\r
357     SKP_int16                   pOut[],             /* O    Pointer to output speech frame              */\r
358     SKP_int32                   *pN,                /* O    Pointer to size of output frame             */\r
359     SKP_int                     lostFlag            /* I    0: no loss, 1 loss, 2 decode fec            */\r
360 );\r
361 \r
362 /* Decode LBRR side info and excitation */\r
363 void SKP_Silk_LBRR_extract(\r
364     SKP_Silk_decoder_state      *psDec,             /* I/O  State                                       */\r
365     ec_dec                      *psRangeDec         /* I/O  Compressor data structure                   */\r
366 );\r
367 \r
368 /* Decode indices from payload v4 Bitstream */\r
369 void SKP_Silk_decode_indices(\r
370     SKP_Silk_decoder_state      *psDec,             /* I/O  State                                       */\r
371     ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */\r
372     SKP_int                     FrameIndex,         /* I    Frame number                                */\r
373     SKP_int                     decode_LBRR         /* I    Flag indicating LBRR data is being decoded  */\r
374 );\r
375 \r
376 /* Decode parameters from payload */\r
377 void SKP_Silk_decode_parameters(\r
378     SKP_Silk_decoder_state      *psDec,                             /* I/O  State                                    */\r
379     SKP_Silk_decoder_control    *psDecCtrl                          /* I/O  Decoder control                          */\r
380 );\r
381 \r
382 /* Core decoder. Performs inverse NSQ operation LTP + LPC */\r
383 void SKP_Silk_decode_core(\r
384     SKP_Silk_decoder_state      *psDec,                             /* I/O  Decoder state               */\r
385     SKP_Silk_decoder_control    *psDecCtrl,                         /* I    Decoder control             */\r
386     SKP_int16                   xq[],                               /* O    Decoded speech              */\r
387     const SKP_int               pulses[ MAX_FRAME_LENGTH ]          /* I    Pulse signal                */\r
388 );\r
389 \r
390 /* Decode quantization indices of excitation (Shell coding) */\r
391 void SKP_Silk_decode_pulses(\r
392     ec_dec                          *psRangeDec,        /* I/O  Compressor data structure                   */\r
393     SKP_int                         pulses[],           /* O    Excitation signal                           */\r
394     const SKP_int                   signalType,         /* I    Sigtype                                     */\r
395     const SKP_int                   quantOffsetType,    /* I    quantOffsetType                             */\r
396     const SKP_int                   frame_length        /* I    Frame length                                */\r
397 );\r
398 \r
399 /******************/\r
400 /* CNG */\r
401 /******************/\r
402 \r
403 /* Reset CNG */\r
404 void SKP_Silk_CNG_Reset(\r
405     SKP_Silk_decoder_state      *psDec              /* I/O  Decoder state                               */\r
406 );\r
407 \r
408 /* Updates CNG estimate, and applies the CNG when packet was lost */\r
409 void SKP_Silk_CNG(\r
410     SKP_Silk_decoder_state      *psDec,             /* I/O  Decoder state                               */\r
411     SKP_Silk_decoder_control    *psDecCtrl,         /* I/O  Decoder control                             */\r
412     SKP_int16                   signal[],           /* I/O  Signal                                      */\r
413     SKP_int                     length              /* I    Length of residual                          */\r
414 );\r
415 \r
416 /* Encoding of various parameters */\r
417 void SKP_Silk_encode_indices(\r
418     SKP_Silk_encoder_state      *psEncC,            /* I/O  Encoder state                               */\r
419     ec_enc                      *psRangeEnc,        /* I/O  Compressor data structure                   */\r
420     SKP_int                     FrameIndex,         /* I    Frame number                                */\r
421     SKP_int                     encode_LBRR         /* I    Flag indicating LBRR data is being encoded  */\r
422 );\r
423 \r
424 #ifdef __cplusplus\r
425 }\r
426 #endif\r
427 \r
428 #endif\r