diff options
author | Jean-Marc Valin <jmvalin@amazon.com> | 2023-10-18 09:56:43 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@amazon.com> | 2023-10-18 09:56:43 +0300 |
commit | 938892ecf74fd2791dbcc1a4d1fd4950e40293ef (patch) | |
tree | 3ccd632987deb5fc5ecc5a4d192f26d153fe3672 | |
parent | 8c7c03e568ae6430018959f3f91d1f5745950069 (diff) |
simplifying a bit
-rw-r--r-- | dnn/lpcnet_plc.c | 11 | ||||
-rw-r--r-- | src/opus_decoder.c | 1 |
2 files changed, 1 insertions, 11 deletions
diff --git a/dnn/lpcnet_plc.c b/dnn/lpcnet_plc.c index 761c9075..70e13dc5 100644 --- a/dnn/lpcnet_plc.c +++ b/dnn/lpcnet_plc.c @@ -154,13 +154,6 @@ static int get_fec_or_pred(LPCNetPLCState *st, float *out) { } } -static void fec_rewind(LPCNetPLCState *st, int offset) { - st->fec_read_pos -= offset; - if (st->fec_read_pos < st->fec_keep_pos) { - st->fec_read_pos = st->fec_keep_pos; - } -} - /* In this causal version of the code, the DNN model implemented by compute_plc_pred() needs to generate two feature vectors to conceal the first lost packet.*/ @@ -172,7 +165,6 @@ int lpcnet_plc_update(LPCNetPLCState *st, opus_int16 *pcm) { burg_cepstral_analysis(plc_features, x); if (st->blend) { if (FEATURES_DELAY > 0) st->plc_net = st->plc_copy[FEATURES_DELAY-1]; - fec_rewind(st, FEATURES_DELAY); } /* Update state. */ /*fprintf(stderr, "update state\n");*/ @@ -185,9 +177,6 @@ int lpcnet_plc_update(LPCNetPLCState *st, opus_int16 *pcm) { plc_features[2*NB_BANDS+NB_FEATURES] = 1; compute_plc_pred(st, st->features, plc_features); /* Discard an FEC frame that we know we will no longer need. */ - if (st->fec_skip) st->fec_skip--; - else if (st->fec_read_pos < st->fec_fill_pos) st->fec_read_pos++; - st->fec_keep_pos = IMAX(0, IMAX(st->fec_keep_pos, st->fec_read_pos-FEATURES_DELAY-1)); OPUS_MOVE(&st->cont_features[0], &st->cont_features[NB_FEATURES], (CONT_VECTORS-1)*NB_FEATURES); } OPUS_COPY(&st->cont_features[(CONT_VECTORS-1)*NB_FEATURES], st->enc.features, NB_FEATURES); diff --git a/src/opus_decoder.c b/src/opus_decoder.c index 0a500398..1bdb6ad4 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -678,6 +678,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, init_frames = (st->lpcnet.blend == 0) ? 2 : 0; features_per_frame = IMAX(1, frame_size/F10); needed_feature_frames = init_frames + features_per_frame; + lpcnet_plc_fec_clear(&st->lpcnet); for (i=0;i<needed_feature_frames;i++) { int feature_offset; /* We floor instead of rounding because 5-ms overlap compensates for the missing 0.5 rounding offset. */ |