Skip to content
Snippets Groups Projects
Commit f7479653 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Fixes a bug in the handling of the first packet after DTX

We were using the last frame's DTX decision at the beginning
of the encoding
parent 20832a6c
No related branches found
No related tags found
No related merge requests found
......@@ -47,24 +47,6 @@ SKP_int SKP_Silk_encode_frame_FLP(
TIC(ENCODE_FRAME)
if( psEnc->sCmn.nFramesAnalyzed == 0 && !psEnc->sCmn.prefillFlag && !( psEnc->sCmn.useDTX && psEnc->sCmn.inDTX ) ) {
/* Create space at start of payload for VAD and FEC flags */
SKP_uint8 iCDF[ 2 ] = { 0, 0 };
iCDF[ 0 ] = 256 - SKP_RSHIFT( 256, psEnc->sCmn.nFramesPerPacket + 1 );
ec_enc_icdf( psRangeEnc, 0, iCDF, 8 );
/* Encode any LBRR data from previous packet */
SKP_Silk_LBRR_embed( &psEnc->sCmn, psRangeEnc );
/* Reduce coding SNR depending on how many bits used by LBRR */
nBits = ec_tell( psRangeEnc );
psEnc->inBandFEC_SNR_comp = ( 6.0f * nBits ) /
( psEnc->sCmn.nFramesPerPacket * psEnc->sCmn.frame_length );
/* Reset LBRR flags */
SKP_memset( psEnc->sCmn.LBRR_flags, 0, sizeof( psEnc->sCmn.LBRR_flags ) );
}
psEnc->sCmn.indices.Seed = psEnc->sCmn.frameCounter++ & 3;
/**************************************************************/
......@@ -102,6 +84,25 @@ TOC(VAD)
psEnc->sCmn.VAD_flags[ psEnc->sCmn.nFramesAnalyzed ] = 1;
}
if( psEnc->sCmn.nFramesAnalyzed == 0 && !psEnc->sCmn.prefillFlag && !( psEnc->sCmn.useDTX && psEnc->sCmn.inDTX ) ) {
/* Create space at start of payload for VAD and FEC flags */
SKP_uint8 iCDF[ 2 ] = { 0, 0 };
iCDF[ 0 ] = 256 - SKP_RSHIFT( 256, psEnc->sCmn.nFramesPerPacket + 1 );
ec_enc_icdf( psRangeEnc, 0, iCDF, 8 );
/* Encode any LBRR data from previous packet */
SKP_Silk_LBRR_embed( &psEnc->sCmn, psRangeEnc );
/* Reduce coding SNR depending on how many bits used by LBRR */
nBits = ec_tell( psRangeEnc );
psEnc->inBandFEC_SNR_comp = ( 6.0f * nBits ) /
( psEnc->sCmn.nFramesPerPacket * psEnc->sCmn.frame_length );
/* Reset LBRR flags */
SKP_memset( psEnc->sCmn.LBRR_flags, 0, sizeof( psEnc->sCmn.LBRR_flags ) );
}
/*******************************************/
/* High-pass filtering of the input signal */
/*******************************************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment