diff --git a/lib_com/options.h b/lib_com/options.h index c8740088c3757b7c65b709c1192b588320dfaa30..eab7ee2e60f8451aeb991346232be9968083c6da 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,6 +153,8 @@ #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 */ +/*#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 */ #define FIX_MSAN_ERROR_STEREO_RATE_SWITCHING /* addresses Issue 177 */ #define SBA_BR_SWITCHING /* Issue 114: Changes for sba bit rate switching*/ #define FIX_AGC_WINFUNC_MEMORY /* Issue 62: lower agc_com.winFunc memory consumption */ diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 904e1178513ab66c956966235378bf1642c585a0..20e4dedbe327dbbb2f9b22a6477c661995d0ae5d 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 4f022e2811f7f65320fdd24964d493715f1473b4..4b74ccebb92a9bc0282d91c145f1da6bbd897144 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 ) { @@ -685,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 ); diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index e18f0e3e5db2f8bb869ac20949eec75cf949bb38..5c189b7d32d08ae33d4975fc180a3636198d1d8e 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -181,13 +181,32 @@ ivas_error ivas_core_dec( st->flagGuidedAcelp = 0; } +#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; + + 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 +220,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 );