• Home
  • Raw
  • Download

Lines Matching refs:psEnc

76     silk_encoder *psEnc;  in silk_InitEncoder()  local
79 psEnc = (silk_encoder *)encState; in silk_InitEncoder()
82 silk_memset( psEnc, 0, sizeof( silk_encoder ) ); in silk_InitEncoder()
84 if( ret += silk_init_encoder( &psEnc->state_Fxx[ n ], arch ) ) { in silk_InitEncoder()
89 psEnc->nChannelsAPI = 1; in silk_InitEncoder()
90 psEnc->nChannelsInternal = 1; in silk_InitEncoder()
110 silk_encoder *psEnc = (silk_encoder *)encState; in silk_QueryEncoder() local
112 state_Fxx = psEnc->state_Fxx; in silk_QueryEncoder()
114 encStatus->nChannelsAPI = psEnc->nChannelsAPI; in silk_QueryEncoder()
115 encStatus->nChannelsInternal = psEnc->nChannelsInternal; in silk_QueryEncoder()
156 silk_encoder *psEnc = ( silk_encoder * )encState; in silk_Encode() local
163 psEnc->state_Fxx[0].sCmn.first_frame_after_reset = 1; in silk_Encode()
164 psEnc->state_Fxx[1].sCmn.first_frame_after_reset = 1; in silk_Encode()
166 psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded = psEnc->state_Fxx[ 1 ].sCmn.nFramesEncoded = 0; in silk_Encode()
177 if( encControl->nChannelsInternal > psEnc->nChannelsInternal ) { in silk_Encode()
179 ret += silk_init_encoder( &psEnc->state_Fxx[ 1 ], psEnc->state_Fxx[ 0 ].sCmn.arch ); in silk_Encode()
180 silk_memset( psEnc->sStereo.pred_prev_Q13, 0, sizeof( psEnc->sStereo.pred_prev_Q13 ) ); in silk_Encode()
181 silk_memset( psEnc->sStereo.sSide, 0, sizeof( psEnc->sStereo.sSide ) ); in silk_Encode()
182 psEnc->sStereo.mid_side_amp_Q0[ 0 ] = 0; in silk_Encode()
183 psEnc->sStereo.mid_side_amp_Q0[ 1 ] = 1; in silk_Encode()
184 psEnc->sStereo.mid_side_amp_Q0[ 2 ] = 0; in silk_Encode()
185 psEnc->sStereo.mid_side_amp_Q0[ 3 ] = 1; in silk_Encode()
186 psEnc->sStereo.width_prev_Q14 = 0; in silk_Encode()
187 psEnc->sStereo.smth_width_Q14 = SILK_FIX_CONST( 1, 14 ); in silk_Encode()
188 if( psEnc->nChannelsAPI == 2 ) { in silk_Encode()
189 …silk_memcpy( &psEnc->state_Fxx[ 1 ].sCmn.resampler_state, &psEnc->state_Fxx[ 0 ].sCmn.resampler_st… in silk_Encode()
190 …silk_memcpy( &psEnc->state_Fxx[ 1 ].sCmn.In_HP_State, &psEnc->state_Fxx[ 0 ].sCmn.In_HP_State,… in silk_Encode()
194 …transition = (encControl->payloadSize_ms != psEnc->state_Fxx[ 0 ].sCmn.PacketSize_ms) || (psEnc->n… in silk_Encode()
196 psEnc->nChannelsAPI = encControl->nChannelsAPI; in silk_Encode()
197 psEnc->nChannelsInternal = encControl->nChannelsInternal; in silk_Encode()
211 save_LP = psEnc->state_Fxx[ 0 ].sCmn.sLP; in silk_Encode()
213 save_LP.saved_fs_kHz = psEnc->state_Fxx[ 0 ].sCmn.fs_kHz; in silk_Encode()
217 ret = silk_init_encoder( &psEnc->state_Fxx[ n ], psEnc->state_Fxx[ n ].sCmn.arch ); in silk_Encode()
220 psEnc->state_Fxx[ n ].sCmn.sLP = save_LP; in silk_Encode()
229 psEnc->state_Fxx[ n ].sCmn.controlled_since_last_payload = 0; in silk_Encode()
230 psEnc->state_Fxx[ n ].sCmn.prefillFlag = 1; in silk_Encode()
249 opus_int force_fs_kHz = (n==1) ? psEnc->state_Fxx[0].sCmn.fs_kHz : 0; in silk_Encode()
250 …if( ( ret = silk_control_encoder( &psEnc->state_Fxx[ n ], encControl, psEnc->allowBandwidthSwitch,… in silk_Encode()
255 if( psEnc->state_Fxx[n].sCmn.first_frame_after_reset || transition ) { in silk_Encode()
256 for( i = 0; i < psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket; i++ ) { in silk_Encode()
257 psEnc->state_Fxx[ n ].sCmn.LBRR_flags[ i ] = 0; in silk_Encode()
260 psEnc->state_Fxx[ n ].sCmn.inDTX = psEnc->state_Fxx[ n ].sCmn.useDTX; in silk_Encode()
262 …celt_assert( encControl->nChannelsInternal == 1 || psEnc->state_Fxx[ 0 ].sCmn.fs_kHz == psEnc->sta… in silk_Encode()
266 10 * nBlocksOf10ms * psEnc->state_Fxx[ 0 ].sCmn.fs_kHz; in silk_Encode()
269 psEnc->state_Fxx[ 0 ].sCmn.API_fs_Hz, in silk_Encode()
270 psEnc->state_Fxx[ 0 ].sCmn.fs_kHz * 1000 ); in silk_Encode()
273 …nSamplesToBuffer = psEnc->state_Fxx[ 0 ].sCmn.frame_length - psEnc->state_Fxx[ 0 ].sCmn.inputBufI… in silk_Encode()
275 …nSamplesFromInput = silk_DIV32_16( nSamplesToBuffer * psEnc->state_Fxx[ 0 ].sCmn.API_fs_Hz, psEnc-… in silk_Encode()
278 opus_int id = psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded; in silk_Encode()
283 if( psEnc->nPrevChannelsInternal == 1 && id==0 ) { in silk_Encode()
284 …silk_memcpy( &psEnc->state_Fxx[ 1 ].sCmn.resampler_state, &psEnc->state_Fxx[ 0 ].sCmn.resampler_st… in silk_Encode()
287 ret += silk_resampler( &psEnc->state_Fxx[ 0 ].sCmn.resampler_state, in silk_Encode()
288 …&psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx + 2 ], buf, nSamplesFr… in silk_Encode()
289 psEnc->state_Fxx[ 0 ].sCmn.inputBufIx += nSamplesToBuffer; in silk_Encode()
291 …nSamplesToBuffer = psEnc->state_Fxx[ 1 ].sCmn.frame_length - psEnc->state_Fxx[ 1 ].sCmn.inputBufI… in silk_Encode()
292 …nSamplesToBuffer = silk_min( nSamplesToBuffer, 10 * nBlocksOf10ms * psEnc->state_Fxx[ 1 ].sCmn.fs… in silk_Encode()
296 ret += silk_resampler( &psEnc->state_Fxx[ 1 ].sCmn.resampler_state, in silk_Encode()
297 …&psEnc->state_Fxx[ 1 ].sCmn.inputBuf[ psEnc->state_Fxx[ 1 ].sCmn.inputBufIx + 2 ], buf, nSamplesFr… in silk_Encode()
299 psEnc->state_Fxx[ 1 ].sCmn.inputBufIx += nSamplesToBuffer; in silk_Encode()
306 ret += silk_resampler( &psEnc->state_Fxx[ 0 ].sCmn.resampler_state, in silk_Encode()
307 …&psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx + 2 ], buf, nSamplesFr… in silk_Encode()
309 … if( psEnc->nPrevChannelsInternal == 2 && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded == 0 ) { in silk_Encode()
310 ret += silk_resampler( &psEnc->state_Fxx[ 1 ].sCmn.resampler_state, in silk_Encode()
311 …&psEnc->state_Fxx[ 1 ].sCmn.inputBuf[ psEnc->state_Fxx[ 1 ].sCmn.inputBufIx + 2 ], buf, nSamplesFr… in silk_Encode()
312 for( n = 0; n < psEnc->state_Fxx[ 0 ].sCmn.frame_length; n++ ) { in silk_Encode()
313 psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx+n+2 ] = in silk_Encode()
314 … silk_RSHIFT(psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx+n+2 ] in silk_Encode()
315 … + psEnc->state_Fxx[ 1 ].sCmn.inputBuf[ psEnc->state_Fxx[ 1 ].sCmn.inputBufIx+n+2 ], 1); in silk_Encode()
318 psEnc->state_Fxx[ 0 ].sCmn.inputBufIx += nSamplesToBuffer; in silk_Encode()
322 ret += silk_resampler( &psEnc->state_Fxx[ 0 ].sCmn.resampler_state, in silk_Encode()
323 …&psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn.inputBufIx + 2 ], buf, nSamplesFr… in silk_Encode()
324 psEnc->state_Fxx[ 0 ].sCmn.inputBufIx += nSamplesToBuffer; in silk_Encode()
331 psEnc->allowBandwidthSwitch = 0; in silk_Encode()
334 if( psEnc->state_Fxx[ 0 ].sCmn.inputBufIx >= psEnc->state_Fxx[ 0 ].sCmn.frame_length ) { in silk_Encode()
336 … celt_assert( psEnc->state_Fxx[ 0 ].sCmn.inputBufIx == psEnc->state_Fxx[ 0 ].sCmn.frame_length ); in silk_Encode()
337 …celt_assert( encControl->nChannelsInternal == 1 || psEnc->state_Fxx[ 1 ].sCmn.inputBufIx == psEnc-… in silk_Encode()
340 if( psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded == 0 && !prefillFlag ) { in silk_Encode()
343 …iCDF[ 0 ] = 256 - silk_RSHIFT( 256, ( psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket + 1 ) * encContr… in silk_Encode()
350 for( i = 0; i < psEnc->state_Fxx[ n ].sCmn.nFramesPerPacket; i++ ) { in silk_Encode()
351 LBRR_symbol |= silk_LSHIFT( psEnc->state_Fxx[ n ].sCmn.LBRR_flags[ i ], i ); in silk_Encode()
353 psEnc->state_Fxx[ n ].sCmn.LBRR_flag = LBRR_symbol > 0 ? 1 : 0; in silk_Encode()
354 if( LBRR_symbol && psEnc->state_Fxx[ n ].sCmn.nFramesPerPacket > 1 ) { in silk_Encode()
355 …ec_enc_icdf( psRangeEnc, LBRR_symbol - 1, silk_LBRR_flags_iCDF_ptr[ psEnc->state_Fxx[ n ].sCmn.nFr… in silk_Encode()
360 for( i = 0; i < psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket; i++ ) { in silk_Encode()
362 if( psEnc->state_Fxx[ n ].sCmn.LBRR_flags[ i ] ) { in silk_Encode()
366 silk_stereo_encode_pred( psRangeEnc, psEnc->sStereo.predIx[ i ] ); in silk_Encode()
368 if( psEnc->state_Fxx[ 1 ].sCmn.LBRR_flags[ i ] == 0 ) { in silk_Encode()
369 … silk_stereo_encode_mid_only( psRangeEnc, psEnc->sStereo.mid_only_flags[ i ] ); in silk_Encode()
373 if( i > 0 && psEnc->state_Fxx[ n ].sCmn.LBRR_flags[ i - 1 ] ) { in silk_Encode()
378 … silk_encode_indices( &psEnc->state_Fxx[ n ].sCmn, psRangeEnc, i, 1, condCoding ); in silk_Encode()
379 …silk_encode_pulses( psRangeEnc, psEnc->state_Fxx[ n ].sCmn.indices_LBRR[i].signalType, psEnc->stat… in silk_Encode()
380psEnc->state_Fxx[ n ].sCmn.pulses_LBRR[ i ], psEnc->state_Fxx[ n ].sCmn.frame_length ); in silk_Encode()
387 …silk_memset( psEnc->state_Fxx[ n ].sCmn.LBRR_flags, 0, sizeof( psEnc->state_Fxx[ n ].sCmn.LBRR_fla… in silk_Encode()
390 psEnc->nBitsUsedLBRR = ec_tell( psRangeEnc ); in silk_Encode()
393 silk_HP_variable_cutoff( psEnc->state_Fxx ); in silk_Encode()
399 nBits -= psEnc->nBitsUsedLBRR; in silk_Encode()
402 nBits = silk_DIV32_16( nBits, psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket ); in silk_Encode()
410 …TargetRate_bps -= silk_DIV32_16( silk_MUL( psEnc->nBitsExceeded, 1000 ), BITRESERVOIR_DECAY_TIME_M… in silk_Encode()
411 if( !prefillFlag && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded > 0 ) { in silk_Encode()
413 …opus_int32 bitsBalance = ec_tell( psRangeEnc ) - psEnc->nBitsUsedLBRR - nBits * psEnc->state_Fxx[ … in silk_Encode()
421 …silk_stereo_LR_to_MS( &psEnc->sStereo, &psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ 2 ], &psEnc->state_Fx… in silk_Encode()
422psEnc->sStereo.predIx[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded ], &psEnc->sStereo.mid_only_flags… in silk_Encode()
423 …MStargetRates_bps, TargetRate_bps, psEnc->state_Fxx[ 0 ].sCmn.speech_activity_Q8, encControl->toMo… in silk_Encode()
424 psEnc->state_Fxx[ 0 ].sCmn.fs_kHz, psEnc->state_Fxx[ 0 ].sCmn.frame_length ); in silk_Encode()
425 … if( psEnc->sStereo.mid_only_flags[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded ] == 0 ) { in silk_Encode()
427 if( psEnc->prev_decode_only_middle == 1 ) { in silk_Encode()
428 …silk_memset( &psEnc->state_Fxx[ 1 ].sShape, 0, sizeof( psEnc->state_Fxx[ 1 ].sShape … in silk_Encode()
429 …silk_memset( &psEnc->state_Fxx[ 1 ].sCmn.sNSQ, 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.sN… in silk_Encode()
430 …silk_memset( psEnc->state_Fxx[ 1 ].sCmn.prev_NLSFq_Q15, 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.pr… in silk_Encode()
431 …silk_memset( &psEnc->state_Fxx[ 1 ].sCmn.sLP.In_LP_State, 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.sL… in silk_Encode()
432 psEnc->state_Fxx[ 1 ].sCmn.prevLag = 100; in silk_Encode()
433 psEnc->state_Fxx[ 1 ].sCmn.sNSQ.lagPrev = 100; in silk_Encode()
434 psEnc->state_Fxx[ 1 ].sShape.LastGainIndex = 10; in silk_Encode()
435 psEnc->state_Fxx[ 1 ].sCmn.prevSignalType = TYPE_NO_VOICE_ACTIVITY; in silk_Encode()
436 psEnc->state_Fxx[ 1 ].sCmn.sNSQ.prev_gain_Q16 = 65536; in silk_Encode()
437 psEnc->state_Fxx[ 1 ].sCmn.first_frame_after_reset = 1; in silk_Encode()
439 silk_encode_do_VAD_Fxx( &psEnc->state_Fxx[ 1 ], activity ); in silk_Encode()
441psEnc->state_Fxx[ 1 ].sCmn.VAD_flags[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded ] = 0; in silk_Encode()
444 …silk_stereo_encode_pred( psRangeEnc, psEnc->sStereo.predIx[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEnco… in silk_Encode()
445 … if( psEnc->state_Fxx[ 1 ].sCmn.VAD_flags[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded ] == 0 ) { in silk_Encode()
446 …silk_stereo_encode_mid_only( psRangeEnc, psEnc->sStereo.mid_only_flags[ psEnc->state_Fxx[ 0 ].sCmn… in silk_Encode()
451 … silk_memcpy( psEnc->state_Fxx[ 0 ].sCmn.inputBuf, psEnc->sStereo.sMid, 2 * sizeof( opus_int16 ) ); in silk_Encode()
452 …silk_memcpy( psEnc->sStereo.sMid, &psEnc->state_Fxx[ 0 ].sCmn.inputBuf[ psEnc->state_Fxx[ 0 ].sCmn… in silk_Encode()
454 silk_encode_do_VAD_Fxx( &psEnc->state_Fxx[ 0 ], activity ); in silk_Encode()
487 silk_control_SNR( &psEnc->state_Fxx[ n ].sCmn, channelRate_bps ); in silk_Encode()
490 if( psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded - n <= 0 ) { in silk_Encode()
492 } else if( n > 0 && psEnc->prev_decode_only_middle ) { in silk_Encode()
499 …if( ( ret = silk_encode_frame_Fxx( &psEnc->state_Fxx[ n ], nBytesOut, psRangeEnc, condCoding, maxB… in silk_Encode()
503 psEnc->state_Fxx[ n ].sCmn.controlled_since_last_payload = 0; in silk_Encode()
504 psEnc->state_Fxx[ n ].sCmn.inputBufIx = 0; in silk_Encode()
505 psEnc->state_Fxx[ n ].sCmn.nFramesEncoded++; in silk_Encode()
507psEnc->prev_decode_only_middle = psEnc->sStereo.mid_only_flags[ psEnc->state_Fxx[ 0 ].sCmn.nFrames… in silk_Encode()
510 …if( *nBytesOut > 0 && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded == psEnc->state_Fxx[ 0 ].sCmn.nFra… in silk_Encode()
513 for( i = 0; i < psEnc->state_Fxx[ n ].sCmn.nFramesPerPacket; i++ ) { in silk_Encode()
515 flags |= psEnc->state_Fxx[ n ].sCmn.VAD_flags[ i ]; in silk_Encode()
518 flags |= psEnc->state_Fxx[ n ].sCmn.LBRR_flag; in silk_Encode()
521 …ec_enc_patch_initial_bits( psRangeEnc, flags, ( psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket + 1 ) … in silk_Encode()
525 …if( psEnc->state_Fxx[ 0 ].sCmn.inDTX && ( encControl->nChannelsInternal == 1 || psEnc->state_Fxx[ … in silk_Encode()
529 psEnc->nBitsExceeded += *nBytesOut * 8; in silk_Encode()
530psEnc->nBitsExceeded -= silk_DIV32_16( silk_MUL( encControl->bitRate, encControl->payloadSize_ms )… in silk_Encode()
531 psEnc->nBitsExceeded = silk_LIMIT( psEnc->nBitsExceeded, 0, 10000 ); in silk_Encode()
535 … - SPEECH_ACTIVITY_DTX_THRES ) / MAX_BANDWIDTH_SWITCH_DELAY_MS, 16 + 8 ), psEnc->timeSinceSwitchAl… in silk_Encode()
536 if( psEnc->state_Fxx[ 0 ].sCmn.speech_activity_Q8 < speech_act_thr_for_switch_Q8 ) { in silk_Encode()
537 psEnc->allowBandwidthSwitch = 1; in silk_Encode()
538 psEnc->timeSinceSwitchAllowed_ms = 0; in silk_Encode()
540 psEnc->allowBandwidthSwitch = 0; in silk_Encode()
541 psEnc->timeSinceSwitchAllowed_ms += encControl->payloadSize_ms; in silk_Encode()
554 psEnc->nPrevChannelsInternal = encControl->nChannelsInternal; in silk_Encode()
556 encControl->allowBandwidthSwitch = psEnc->allowBandwidthSwitch; in silk_Encode()
557 …encControl->inWBmodeWithoutVariableLP = psEnc->state_Fxx[ 0 ].sCmn.fs_kHz == 16 && psEnc->state_Fx… in silk_Encode()
558 encControl->internalSampleRate = silk_SMULBB( psEnc->state_Fxx[ 0 ].sCmn.fs_kHz, 1000 ); in silk_Encode()
559 encControl->stereoWidth_Q14 = encControl->toMono ? 0 : psEnc->sStereo.smth_width_Q14; in silk_Encode()
564 psEnc->state_Fxx[ n ].sCmn.controlled_since_last_payload = 0; in silk_Encode()
565 psEnc->state_Fxx[ n ].sCmn.prefillFlag = 0; in silk_Encode()
569 encControl->signalType = psEnc->state_Fxx[0].sCmn.indices.signalType; in silk_Encode()
571 [ psEnc->state_Fxx[0].sCmn.indices.signalType >> 1 ] in silk_Encode()
572 [ psEnc->state_Fxx[0].sCmn.indices.quantOffsetType ]; in silk_Encode()