Home | History | Annotate | Download | only in silk

Lines Matching refs:psEnc

43     silk_encoder_state_Fxx          *psEnc,             /* I/O                      */
48 silk_encoder_state_Fxx *psEnc, /* I/O */
66 silk_encoder_state_Fxx *psEnc, /* I/O Pointer to Silk encoder state */
76 psEnc->sCmn.useDTX = encControl->useDTX;
77 psEnc->sCmn.useCBR = encControl->useCBR;
78 psEnc->sCmn.API_fs_Hz = encControl->API_sampleRate;
79 psEnc->sCmn.maxInternal_fs_Hz = encControl->maxInternalSampleRate;
80 psEnc->sCmn.minInternal_fs_Hz = encControl->minInternalSampleRate;
81 psEnc->sCmn.desiredInternal_fs_Hz = encControl->desiredInternalSampleRate;
82 psEnc->sCmn.useInBandFEC = encControl->useInBandFEC;
83 psEnc->sCmn.nChannelsAPI = encControl->nChannelsAPI;
84 psEnc->sCmn.nChannelsInternal = encControl->nChannelsInternal;
85 psEnc->sCmn.allow_bandwidth_switch = allow_bw_switch;
86 psEnc->sCmn.channelNb = channelNb;
88 if( psEnc->sCmn.controlled_since_last_payload != 0 && psEnc->sCmn.prefillFlag == 0 ) {
89 if( psEnc->sCmn.API_fs_Hz != psEnc->sCmn.prev_API_fs_Hz && psEnc->sCmn.fs_kHz > 0 ) {
91 ret += silk_setup_resamplers( psEnc, psEnc->sCmn.fs_kHz );
101 fs_kHz = silk_control_audio_bandwidth( &psEnc->sCmn, encControl );
108 ret += silk_setup_resamplers( psEnc, fs_kHz );
113 ret += silk_setup_fs( psEnc, fs_kHz, encControl->payloadSize_ms );
118 ret += silk_setup_complexity( &psEnc->sCmn, encControl->complexity );
123 psEnc->sCmn.PacketLoss_perc = encControl->packetLossPercentage;
128 ret += silk_setup_LBRR( &psEnc->sCmn, TargetRate_bps );
130 psEnc->sCmn.controlled_since_last_payload = 1;
136 silk_encoder_state_Fxx *psEnc, /* I/O */
143 if( psEnc->sCmn.fs_kHz != fs_kHz || psEnc->sCmn.prev_API_fs_Hz != psEnc->sCmn.API_fs_Hz )
145 if( psEnc->sCmn.fs_kHz == 0 ) {
147 ret += silk_resampler_init( &psEnc->sCmn.resampler_state, psEnc->sCmn.API_fs_Hz, fs_kHz * 1000, 1 );
152 opus_int16 *x_bufFIX = psEnc->x_buf;
161 buf_length_ms = silk_LSHIFT( psEnc->sCmn.nb_subfr * 5, 1 ) + LA_SHAPE_MS;
162 old_buf_samples = buf_length_ms * psEnc->sCmn.fs_kHz;
168 silk_float2short_array( x_bufFIX, psEnc->x_buf, old_buf_samples );
173 ret += silk_resampler_init( temp_resampler_state, silk_SMULBB( psEnc->sCmn.fs_kHz, 1000 ), psEnc->sCmn.API_fs_Hz, 0 );
176 api_buf_samples = buf_length_ms * silk_DIV32_16( psEnc->sCmn.API_fs_Hz, 1000 );
183 ret += silk_resampler_init( &psEnc->sCmn.resampler_state, psEnc->sCmn.API_fs_Hz, silk_SMULBB( fs_kHz, 1000 ), 1 );
186 ret += silk_resampler( &psEnc->sCmn.resampler_state, x_bufFIX, x_buf_API_fs_Hz, api_buf_samples );
189 silk_short2float_array( psEnc->x_buf, x_bufFIX, new_buf_samples);
194 psEnc->sCmn.prev_API_fs_Hz = psEnc->sCmn.API_fs_Hz;
201 silk_encoder_state_Fxx *psEnc, /* I/O */
209 if( PacketSize_ms != psEnc->sCmn.PacketSize_ms ) {
217 psEnc->sCmn.nFramesPerPacket = 1;
218 psEnc->sCmn.nb_subfr = PacketSize_ms == 10 ? 2 : 1;
219 psEnc->sCmn.frame_length = silk_SMULBB( PacketSize_ms, fs_kHz );
220 psEnc->sCmn.pitch_LPC_win_length = silk_SMULBB( FIND_PITCH_LPC_WIN_MS_2_SF, fs_kHz );
221 if( psEnc->sCmn.fs_kHz == 8 ) {
222 psEnc->sCmn.pitch_contour_iCDF = silk_pitch_contour_10_ms_NB_iCDF;
224 psEnc->sCmn.pitch_contour_iCDF = silk_pitch_contour_10_ms_iCDF;
227 psEnc->sCmn.nFramesPerPacket = silk_DIV32_16( PacketSize_ms, MAX_FRAME_LENGTH_MS );
228 psEnc->sCmn.nb_subfr = MAX_NB_SUBFR;
229 psEnc->sCmn.frame_length = silk_SMULBB( 20, fs_kHz );
230 psEnc->sCmn.pitch_LPC_win_length = silk_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
231 if( psEnc->sCmn.fs_kHz == 8 ) {
232 psEnc->sCmn.pitch_contour_iCDF = silk_pitch_contour_NB_iCDF;
234 psEnc->sCmn.pitch_contour_iCDF = silk_pitch_contour_iCDF;
237 psEnc->sCmn.PacketSize_ms = PacketSize_ms;
238 psEnc->sCmn.TargetRate_bps = 0; /* trigger new SNR computation */
243 silk_assert( psEnc->sCmn.nb_subfr == 2 || psEnc->sCmn.nb_subfr == 4 );
244 if( psEnc->sCmn.fs_kHz != fs_kHz ) {
246 silk_memset( &psEnc->sShape, 0, sizeof( psEnc->sShape ) );
247 silk_memset( &psEnc->sPrefilt, 0, sizeof( psEnc->sPrefilt ) );
248 silk_memset( &psEnc->sCmn.sNSQ, 0, sizeof( psEnc->sCmn.sNSQ ) );
249 silk_memset( psEnc->sCmn.prev_NLSFq_Q15, 0, sizeof( psEnc->sCmn.prev_NLSFq_Q15 ) );
250 silk_memset( &psEnc->sCmn.sLP.In_LP_State, 0, sizeof( psEnc->sCmn.sLP.In_LP_State ) );
251 psEnc->sCmn.inputBufIx = 0;
252 psEnc->sCmn.nFramesEncoded = 0;
253 psEnc->sCmn.TargetRate_bps = 0; /* trigger new SNR computation */
256 psEnc->sCmn.prevLag = 100;
257 psEnc->sCmn.first_frame_after_reset = 1;
258 psEnc->sPrefilt.lagPrev = 100;
259 psEnc->sShape.LastGainIndex = 10;
260 psEnc->sCmn.sNSQ.lagPrev = 100;
261 psEnc->sCmn.sNSQ.prev_gain_Q16 = 65536;
262 psEnc->sCmn.prevSignalType = TYPE_NO_VOICE_ACTIVITY;
264 psEnc->sCmn.fs_kHz = fs_kHz;
265 if( psEnc->sCmn.fs_kHz == 8 ) {
266 if( psEnc->sCmn.nb_subfr == MAX_NB_SUBFR ) {
267 psEnc->sCmn.pitch_contour_iCDF = silk_pitch_contour_NB_iCDF;
269 psEnc->sCmn.pitch_contour_iCDF = silk_pitch_contour_10_ms_NB_iCDF;
272 if( psEnc->sCmn.nb_subfr == MAX_NB_SUBFR ) {
273 psEnc->sCmn.pitch_contour_iCDF = silk_pitch_contour_iCDF;
275 psEnc->sCmn.pitch_contour_iCDF = silk_pitch_contour_10_ms_iCDF;
278 if( psEnc->sCmn.fs_kHz == 8 || psEnc->sCmn.fs_kHz == 12 ) {
279 psEnc->sCmn.predictLPCOrder = MIN_LPC_ORDER;
280 psEnc->sCmn.psNLSF_CB = &silk_NLSF_CB_NB_MB;
282 psEnc->sCmn.predictLPCOrder = MAX_LPC_ORDER;
283 psEnc->sCmn.psNLSF_CB = &silk_NLSF_CB_WB;
285 psEnc->sCmn.subfr_length = SUB_FRAME_LENGTH_MS * fs_kHz;
286 psEnc->sCmn.frame_length = silk_SMULBB( psEnc->sCmn.subfr_length, psEnc->sCmn.nb_subfr );
287 psEnc->sCmn.ltp_mem_length = silk_SMULBB( LTP_MEM_LENGTH_MS, fs_kHz );
288 psEnc->sCmn.la_pitch = silk_SMULBB( LA_PITCH_MS, fs_kHz );
289 psEnc->sCmn.max_pitch_lag = silk_SMULBB( 18, fs_kHz );
290 if( psEnc->sCmn.nb_subfr == MAX_NB_SUBFR ) {
291 psEnc->sCmn.pitch_LPC_win_length = silk_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
293 psEnc->sCmn.pitch_LPC_win_length = silk_SMULBB( FIND_PITCH_LPC_WIN_MS_2_SF, fs_kHz );
295 if( psEnc->sCmn.fs_kHz == 16 ) {
296 psEnc->sCmn.mu_LTP_Q9 = SILK_FIX_CONST( MU_LTP_QUANT_WB, 9 );
297 psEnc->sCmn.pitch_lag_low_bits_iCDF = silk_uniform8_iCDF;
298 } else if( psEnc->sCmn.fs_kHz == 12 ) {
299 psEnc->sCmn.mu_LTP_Q9 = SILK_FIX_CONST( MU_LTP_QUANT_MB, 9 );
300 psEnc->sCmn.pitch_lag_low_bits_iCDF = silk_uniform6_iCDF;
302 psEnc->sCmn.mu_LTP_Q9 = SILK_FIX_CONST( MU_LTP_QUANT_NB, 9 );
303 psEnc->sCmn.pitch_lag_low_bits_iCDF = silk_uniform4_iCDF;
308 silk_assert( ( psEnc->sCmn.subfr_length * psEnc->sCmn.nb_subfr ) == psEnc->sCmn.frame_length );