From f20b379cbeaaf7ac960ecf8610f8a040e88f1f8d Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 2 Nov 2022 15:19:22 +0100 Subject: [PATCH 1/5] do not allocate PLCinfo struct in IVAS modes --- lib_com/options.h | 1 + lib_dec/init_dec.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 9bdbbc81aa..28149aafa5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,6 +153,7 @@ #define FIX_I173_I174 /* Issues 173 and 174: Remove frame and subframe index from ISm metadata and headtracking respectively. */ #define FIX_TCX_DEC_RECONF_BFI #define FIX_SBA_DTX_DECODE_ERROR /* Issue 176: SBA decoder error with DTX at 80kbps SWB, Issue 21: SBA front-VAD threshold (203) */ +#define FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS /* Issue 124: do not allocate unused plc struct in IVAS modes which is only used in EVS mono */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 4f022e2811..278f8c2d5a 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -661,7 +661,11 @@ ivas_error init_decoder( * Mode 2 initialization *-----------------------------------------------------------------*/ +#ifdef FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS + if ( st->element_mode == EVS_MONO ) +#else if ( idchan == 0 && st->element_mode != IVAS_CPE_MDCT ) +#endif { if ( ( st->hPlcInfo = (T_PLCInfo_HANDLE) count_malloc( sizeof( T_PLCInfo ) ) ) == NULL ) { -- GitLab From f358b4cce0738db21f69533c90b756bc4cd6194b Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 3 Nov 2022 10:17:13 +0100 Subject: [PATCH 2/5] removal of unnecessary assignment and one sanity condition (before the parameter `st->hPlcInfo->concealment_method` was uninitialized) --- lib_dec/dec_tcx.c | 4 ++++ lib_dec/init_dec.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 904e117851..20e4dedbe3 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -152,7 +152,11 @@ void decoder_tcx_post( if ( bfi && !st->use_partial_copy ) { /* run lpc gain compensation not for waveform adjustment */ +#ifdef FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS + if ( !st->enablePlcWaveadjust || ( st->hPlcInfo != NULL && st->hPlcInfo->concealment_method == TCX_TONAL ) ) +#else if ( !st->enablePlcWaveadjust || st->hPlcInfo->concealment_method == TCX_TONAL ) +#endif { float gainHelperFB = hTcxDec->gainHelper; float stepCompensateFB = hTcxDec->stepCompensate * st->L_frame / hTcxDec->L_frameTCX; diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 278f8c2d5a..4b74ccebb9 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -689,8 +689,9 @@ ivas_error init_decoder( st->hTECDec = NULL; } +#ifndef FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS // the initialziation is done in open_decoder_LPD() st->enablePlcWaveadjust = 0; - +#endif /* Init Core Decoder */ open_decoder_LPD( st, st->total_brate, st->last_total_brate, st->bwidth, 0, st->element_mode, 1 ); -- GitLab From b569f2af00d59d2d486089673eb0d101b6583638 Mon Sep 17 00:00:00 2001 From: knj Date: Thu, 3 Nov 2022 12:48:22 +0100 Subject: [PATCH 3/5] fix for not using recovery_gain anymore not completely BE, but conceptually the same, differences are small --- lib_dec/ivas_core_dec.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index e18f0e3e5d..4fbf75cf23 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -181,13 +181,28 @@ ivas_error ivas_core_dec( st->flagGuidedAcelp = 0; } +#ifdef FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS + if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL ) + { + float gain; + + gain = st->hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph; + v_multc( st->hHQ_core->old_out, gain, st->hHQ_core->old_out, st->hTcxDec->L_frameTCX ); + v_multc( st->hHQ_core->old_outLB, gain, st->hHQ_core->old_outLB, st->L_frame ); + + if ( !st->hTcxCfg->last_aldo ) + { + v_multc( st->hTcxDec->syn_OverlFB, gain, st->hTcxDec->syn_OverlFB, st->hTcxCfg->tcx_mdct_window_lengthFB ); + v_multc( st->hTcxDec->syn_Overl, gain, st->hTcxDec->syn_Overl, st->hTcxCfg->tcx_mdct_window_length ); + } + } +#else /* PLC: [TCX: Fade-out-recovery] - overlapping part needs to be attenuated for first good frame */ if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) ) { float gain; - gain = ( st->element_mode == IVAS_CPE_MDCT ) ? st->hTcxDec->conceal_eof_gain : ( st->hPlcInfo != NULL ) ? st->hPlcInfo->recovery_gain - : 0.0f; + gain = ( st->element_mode == IVAS_CPE_MDCT ) ? st->hTcxDec->conceal_eof_gain : ( st->hPlcInfo != NULL ) ? st->hPlcInfo->recovery_gain : 0.0f; if ( ( st->element_mode == IVAS_CPE_MDCT && hMCT == NULL ) || ( st->hPlcInfo != NULL ) ) { @@ -201,6 +216,7 @@ ivas_error ivas_core_dec( } } } +#endif set_f( voice_factors[n], 0.f, NB_SUBFR16k ); set_f( hb_synth[n], 0.0f, L_FRAME48k ); -- GitLab From 02fc63c12b16c0e1decfc66102fbd4407749c7c6 Mon Sep 17 00:00:00 2001 From: knj Date: Thu, 3 Nov 2022 16:53:47 +0100 Subject: [PATCH 4/5] add witch for fixing MCT PLC recovery - still inactive --- lib_com/options.h | 3 ++- lib_dec/ivas_core_dec.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 28149aafa5..52f4435019 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -/*#define MEM_COUNT_DETAILS*/ /* RAM counting tool: print per sub-structure details */ +#define MEM_COUNT_DETAILS /* RAM counting tool: print per sub-structure details */ /*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO @@ -154,6 +154,7 @@ #define FIX_TCX_DEC_RECONF_BFI #define FIX_SBA_DTX_DECODE_ERROR /* Issue 176: SBA decoder error with DTX at 80kbps SWB, Issue 21: SBA front-VAD threshold (203) */ #define FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS /* Issue 124: do not allocate unused plc struct in IVAS modes which is only used in EVS mono */ +/*#define FIX_MCT_PLC_RECOVERY*/ /* Issue 184: scale the old synthesis part correctly in the first good frame after lost frames in MCT modes - to be activated after previous switch is merged */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 4fbf75cf23..5c189b7d32 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -182,7 +182,11 @@ ivas_error ivas_core_dec( } #ifdef FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS +#ifdef FIX_MCT_PLC_RECOVERY if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL ) +#else + if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL && hMCT == NULL ) +#endif { float gain; -- GitLab From 089196f716d173203ba5966c1fe43133e3b07fd7 Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 4 Nov 2022 08:36:53 +0100 Subject: [PATCH 5/5] disable MEM_COUNT_DETAILS again --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 52f4435019..9ef0c7cb0e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -#define MEM_COUNT_DETAILS /* RAM counting tool: print per sub-structure details */ +/*#define MEM_COUNT_DETAILS*/ /* RAM counting tool: print per sub-structure details */ /*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO -- GitLab