ref: ef4f459ec3e0ce2e0587009ef71dfd9dd8cf3f93
parent: 40b944b0baf7d8230845b1263172f2cd27b08b94
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Tue May 30 23:30:59 EDT 2023
Cleanup (no change in behaviour)
--- a/silk/PLC.c
+++ b/silk/PLC.c
@@ -98,7 +98,6 @@
#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 @@
}
#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 );
}
--- a/silk/structs.h
+++ b/silk/structs.h
@@ -257,9 +257,7 @@
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;
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -657,7 +657,8 @@
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) {
--
⑨