From 1e98c96c52a2f28d73c5aeafd9fcca8f22bf64bf Mon Sep 17 00:00:00 2001 From: rhb Date: Fri, 17 Feb 2023 10:47:54 +0100 Subject: [PATCH] fix crashes for SBA-to-stereo DTX --- lib_com/options.h | 3 ++- lib_dec/ivas_core_dec.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) mode change 100644 => 100755 lib_dec/ivas_core_dec.c diff --git a/lib_com/options.h b/lib_com/options.h index 55cb7e63dd..f41231a40d 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,8 @@ #define DFT_STEREO_SPAR_MIXING #ifdef DFT_STEREO_SPAR_MIXING -#define FIX_345_MSAN_ERROR /* FhG. Fix memory sanitizer error in PLC modes */ +#define FIX_345_MSAN_ERROR /* FhG: Fix memory sanitizer error in PLC modes */ +#define FIX_347_DTX_CRASH /* FhG: Fix crash that can happen with DTX */ /*#define DFT_STEREO_SPAR_MIXING_DEBUG*/ /* more debugging output for DFT_STEREO_SPAR_MIXING_DEBUG */ #define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ #endif diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c old mode 100644 new mode 100755 index 3fb50b5ca6..686f754e79 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -240,7 +240,11 @@ ivas_error ivas_core_dec( hCPE->hStereoCng->flag_cna_fade = 0; } +#ifdef FIX_347_DTX_CRASH + if ( sba_dirac_stereo_flag && hSCE && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG ) +#else if ( sba_dirac_stereo_flag && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG ) +#endif { save_hb_synth = hSCE->save_hb_synth; } @@ -457,7 +461,11 @@ ivas_error ivas_core_dec( /* for FD-CNG we need the delay compensation in the synth, so do this afterwards */ +#ifdef FIX_347_DTX_CRASH + if ( sba_dirac_stereo_flag && hSCE && st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) +#else if ( sba_dirac_stereo_flag && st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) +#endif { mvr2r( synth[n], hSCE->save_synth, output_frame ); } -- GitLab