diff --git a/silk/PLC.c b/silk/PLC.c index 098584e16c30dec044966febd17c89f15ed45a57..7aff66ee3478773f99e280b82c33e91fbef2d70a 100644 --- a/silk/PLC.c +++ b/silk/PLC.c @@ -98,7 +98,6 @@ void silk_PLC( #ifdef NEURAL_PLC if ( psDec->sPLC.fs_kHz == 16 ) { int k; - psDec->sPLC.pre_filled = 0; for( k = 0; k < psDec->nb_subfr; k += 2 ) { lpcnet_plc_update( &psDec->sPLC.lpcnet, frame + k * psDec->subfr_length ); } @@ -389,7 +388,6 @@ static OPUS_INLINE void silk_PLC_conceal( } #ifdef NEURAL_PLC if ( psDec->sPLC.fs_kHz == 16 ) { - psDec->sPLC.pre_filled = 1; for( k = 0; k < psDec->nb_subfr; k += 2 ) { lpcnet_plc_conceal( &psDec->sPLC.lpcnet, frame + k * psDec->subfr_length ); } diff --git a/silk/structs.h b/silk/structs.h index 2228dc018baff9cdbd61f5affcc6f0b7f9ed3892..956d1975d09a14de4736b4903272246849471e9e 100644 --- a/silk/structs.h +++ b/silk/structs.h @@ -257,9 +257,7 @@ typedef struct { opus_int nb_subfr; opus_int subfr_length; #ifdef NEURAL_PLC - /* FIXME: We should include the state struct directly to preserve the state shadow copy property. */ LPCNetPLCState lpcnet; - int pre_filled; #endif } silk_PLC_struct; diff --git a/src/opus_decoder.c b/src/opus_decoder.c index 6bb14ecb1a36959857431eef7e7d1fe80e18b7d4..d2008d7cd77647271fba48ea77b9abf0f9e217cd 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -657,7 +657,8 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, lpcnet_plc_fec_clear(&silk_dec->sPLC.lpcnet); features_per_frame = frame_size/(st->Fs/100); needed_feature_frames = features_per_frame; - if (!silk_dec->sPLC.pre_filled) needed_feature_frames+=2; + /* if blend==0, the last PLC call was "update" and we need to feed two extra 10-ms frames. */ + if (silk_dec->sPLC.lpcnet.blend == 0) needed_feature_frames+=2; for (i=0;i<needed_feature_frames;i++) { int feature_offset = (needed_feature_frames-i-1 + (dred_offset/(st->Fs/100)-1)*features_per_frame); if (feature_offset <= 4*dred->nb_latents-1) {