31 #include "SigProc_FIX.h"
41 #if defined(OPUS_X86_MAY_HAVE_SSE4_1)
42 #include "x86/main_sse.h"
45 #if (defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR))
46 #include "arm/NSQ_del_dec_arm.h"
50 void silk_stereo_LR_to_MS(
51 stereo_enc_state *state,
54 opus_int8 ix[ 2 ][ 3 ],
55 opus_int8 *mid_only_flag,
56 opus_int32 mid_side_rates_bps[],
57 opus_int32 total_rate_bps,
58 opus_int prev_speech_act_Q8,
65 void silk_stereo_MS_to_LR(
66 stereo_dec_state *state,
69 const opus_int32 pred_Q13[],
75 opus_int32 silk_stereo_find_predictor(
76 opus_int32 *ratio_Q14,
79 opus_int32 mid_res_amp_Q0[],
81 opus_int smooth_coef_Q16
85 void silk_stereo_quant_pred(
86 opus_int32 pred_Q13[],
87 opus_int8 ix[ 2 ][ 3 ]
91 void silk_stereo_encode_pred(
93 opus_int8 ix[ 2 ][ 3 ]
97 void silk_stereo_encode_mid_only(
99 opus_int8 mid_only_flag
103 void silk_stereo_decode_pred(
105 opus_int32 pred_Q13[]
109 void silk_stereo_decode_mid_only(
111 opus_int *decode_only_mid
115 void silk_encode_signs(
117 const opus_int8 pulses[],
119 const opus_int signalType,
120 const opus_int quantOffsetType,
121 const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ]
125 void silk_decode_signs(
129 const opus_int signalType,
130 const opus_int quantOffsetType,
131 const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ]
135 opus_int check_control_input(
136 silk_EncControlStruct *encControl
140 opus_int silk_control_audio_bandwidth(
141 silk_encoder_state *psEncC,
142 silk_EncControlStruct *encControl
146 opus_int silk_control_SNR(
147 silk_encoder_state *psEncC,
148 opus_int32 TargetRate_bps
156 void silk_encode_pulses(
158 const opus_int signalType,
159 const opus_int quantOffsetType,
161 const opus_int frame_length
165 void silk_shell_encoder(
167 const opus_int *pulses0
171 void silk_shell_decoder(
174 const opus_int pulses4
178 void silk_gains_quant(
179 opus_int8 ind[ MAX_NB_SUBFR ],
180 opus_int32 gain_Q16[ MAX_NB_SUBFR ],
182 const opus_int conditional,
183 const opus_int nb_subfr
187 void silk_gains_dequant(
188 opus_int32 gain_Q16[ MAX_NB_SUBFR ],
189 const opus_int8 ind[ MAX_NB_SUBFR ],
191 const opus_int conditional,
192 const opus_int nb_subfr
196 opus_int32 silk_gains_ID(
197 const opus_int8 ind[ MAX_NB_SUBFR ],
198 const opus_int nb_subfr
202 void silk_interpolate(
203 opus_int16 xi[ MAX_LPC_ORDER ],
204 const opus_int16 x0[ MAX_LPC_ORDER ],
205 const opus_int16 x1[ MAX_LPC_ORDER ],
206 const opus_int ifact_Q2,
211 void silk_quant_LTP_gains(
212 opus_int16 B_Q14[ MAX_NB_SUBFR * LTP_ORDER ],
213 opus_int8 cbk_index[ MAX_NB_SUBFR ],
214 opus_int8 *periodicity_index,
215 opus_int32 *sum_gain_dB_Q7,
216 opus_int *pred_gain_dB_Q7,
217 const opus_int32 XX_Q17[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ],
218 const opus_int32 xX_Q17[ MAX_NB_SUBFR*LTP_ORDER ],
219 const opus_int subfr_len,
220 const opus_int nb_subfr,
225 void silk_VQ_WMat_EC_c(
227 opus_int32 *res_nrg_Q15,
228 opus_int32 *rate_dist_Q8,
230 const opus_int32 *XX_Q17,
231 const opus_int32 *xX_Q17,
232 const opus_int8 *cb_Q7,
233 const opus_uint8 *cb_gain_Q7,
234 const opus_uint8 *cl_Q5,
235 const opus_int subfr_len,
236 const opus_int32 max_gain_Q7,
240 #if !defined(OVERRIDE_silk_VQ_WMat_EC)
241 #define silk_VQ_WMat_EC(ind, res_nrg_Q15, rate_dist_Q8, gain_Q7, XX_Q17, xX_Q17, cb_Q7, cb_gain_Q7, cl_Q5, subfr_len, max_gain_Q7, L, arch) \
242 ((void)(arch),silk_VQ_WMat_EC_c(ind, res_nrg_Q15, rate_dist_Q8, gain_Q7, XX_Q17, xX_Q17, cb_Q7, cb_gain_Q7, cl_Q5, subfr_len, max_gain_Q7, L))
250 const silk_encoder_state *psEncC,
252 SideInfoIndices *psIndices,
253 const opus_int16 x16[],
255 const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],
256 const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],
257 const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ],
258 const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ],
259 const opus_int Tilt_Q14[ MAX_NB_SUBFR ],
260 const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ],
261 const opus_int32 Gains_Q16[ MAX_NB_SUBFR ],
262 const opus_int pitchL[ MAX_NB_SUBFR ],
263 const opus_int Lambda_Q10,
264 const opus_int LTP_scale_Q14
267 #if !defined(OVERRIDE_silk_NSQ)
268 #define silk_NSQ(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
269 HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
270 ((void)(arch),silk_NSQ_c(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
271 HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14))
275 void silk_NSQ_del_dec_c(
276 const silk_encoder_state *psEncC,
278 SideInfoIndices *psIndices,
279 const opus_int16 x16[],
281 const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ],
282 const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ],
283 const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ],
284 const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ],
285 const opus_int Tilt_Q14[ MAX_NB_SUBFR ],
286 const opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ],
287 const opus_int32 Gains_Q16[ MAX_NB_SUBFR ],
288 const opus_int pitchL[ MAX_NB_SUBFR ],
289 const opus_int Lambda_Q10,
290 const opus_int LTP_scale_Q14
293 #if !defined(OVERRIDE_silk_NSQ_del_dec)
294 #define silk_NSQ_del_dec(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
295 HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \
296 ((void)(arch),silk_NSQ_del_dec_c(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \
297 HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14))
304 opus_int silk_VAD_Init(
305 silk_VAD_state *psSilk_VAD
309 opus_int silk_VAD_GetSA_Q8_c(
310 silk_encoder_state *psEncC,
311 const opus_int16 pIn[]
314 #if !defined(OVERRIDE_silk_VAD_GetSA_Q8)
315 #define silk_VAD_GetSA_Q8(psEnC, pIn, arch) ((void)(arch),silk_VAD_GetSA_Q8_c(psEnC, pIn))
321 void silk_LP_variable_cutoff(
324 const opus_int frame_length
331 void silk_process_NLSFs(
332 silk_encoder_state *psEncC,
333 opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ],
334 opus_int16 pNLSF_Q15[ MAX_LPC_ORDER ],
335 const opus_int16 prev_NLSFq_Q15[ MAX_LPC_ORDER ]
338 opus_int32 silk_NLSF_encode(
339 opus_int8 *NLSFIndices,
340 opus_int16 *pNLSF_Q15,
341 const silk_NLSF_CB_struct *psNLSF_CB,
342 const opus_int16 *pW_QW,
343 const opus_int NLSF_mu_Q20,
344 const opus_int nSurvivors,
345 const opus_int signalType
350 opus_int32 err_Q26[],
351 const opus_int16 in_Q15[],
352 const opus_uint8 pCB_Q8[],
353 const opus_int16 pWght_Q9[],
355 const opus_int LPC_order
359 opus_int32 silk_NLSF_del_dec_quant(
361 const opus_int16 x_Q10[],
362 const opus_int16 w_Q5[],
363 const opus_uint8 pred_coef_Q8[],
364 const opus_int16 ec_ix[],
365 const opus_uint8 ec_rates_Q5[],
366 const opus_int quant_step_size_Q16,
367 const opus_int16 inv_quant_step_size_Q6,
368 const opus_int32 mu_Q20,
369 const opus_int16 order
373 void silk_NLSF_unpack(
375 opus_uint8 pred_Q8[],
376 const silk_NLSF_CB_struct *psNLSF_CB,
377 const opus_int CB1_index
383 void silk_NLSF_decode(
384 opus_int16 *pNLSF_Q15,
385 opus_int8 *NLSFIndices,
386 const silk_NLSF_CB_struct *psNLSF_CB
392 opus_int silk_init_decoder(
393 silk_decoder_state *psDec
397 opus_int silk_decoder_set_fs(
398 silk_decoder_state *psDec,
406 opus_int silk_decode_frame(
407 silk_decoder_state *psDec,
417 void silk_decode_indices(
418 silk_decoder_state *psDec,
421 opus_int decode_LBRR,
426 void silk_decode_parameters(
427 silk_decoder_state *psDec,
428 silk_decoder_control *psDecCtrl,
433 void silk_decode_core(
434 silk_decoder_state *psDec,
435 silk_decoder_control *psDecCtrl,
437 const opus_int16 pulses[ MAX_FRAME_LENGTH ],
442 void silk_decode_pulses(
445 const opus_int signalType,
446 const opus_int quantOffsetType,
447 const opus_int frame_length
456 silk_decoder_state *psDec
461 silk_decoder_state *psDec,
462 silk_decoder_control *psDecCtrl,
468 void silk_encode_indices(
469 silk_encoder_state *psEncC,
472 opus_int encode_LBRR,