From ed1da5d4a22b49f6a1b67920795b36f8540e9923 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Tue, 17 Dec 2024 17:20:44 +0100 Subject: [PATCH] Add fix NONBE_1246_INF_COHERENCE_IN_HIGH_LEVEL_DTX for issue 1246 --- lib_com/options.h | 1 + lib_enc/ivas_stereo_cng_enc.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index b26b2d81c5..cde0991748 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,6 +172,7 @@ #define NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR /* Ericsson: Issue 1176, fix in TDREND_firfilt for subframes shorter than the filter length */ #define NONBE_1240_FIX_CORE_SELECTION_ISM_SW /* VA: issue 1240: Remove the forcing of the TCX core in ISM when switching from a high bitarte to a low one */ +#define NONBE_1246_INF_COHERENCE_IN_HIGH_LEVEL_DTX /* Ericsson: Issue 1246: High level input which triggers DTX can lead to numerical overflow in coherence calculation */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_stereo_cng_enc.c b/lib_enc/ivas_stereo_cng_enc.c index ac938f02ed..49430f2d1f 100644 --- a/lib_enc/ivas_stereo_cng_enc.c +++ b/lib_enc/ivas_stereo_cng_enc.c @@ -95,7 +95,11 @@ void stereo_dft_enc_sid_calc_coh( for ( k = hStereoDft->band_limits[b]; k < hStereoDft->band_limits[b + 1]; k++ ) { coh_weight = hStereoDft->DFT[0][2 * k] * hStereoDft->DFT[0][2 * k] + hStereoDft->DFT[0][2 * k + 1] * hStereoDft->DFT[0][2 * k + 1]; +#ifdef NONBE_1246_INF_COHERENCE_IN_HIGH_LEVEL_DTX + cohBand[b] += coh_weight * ( ( hStereoDft->xspec_smooth[2 * k] * hStereoDft->xspec_smooth[2 * k] + hStereoDft->xspec_smooth[2 * k + 1] * hStereoDft->xspec_smooth[2 * k + 1] ) / ( hStereoDft->Spd_L_smooth[k] * hStereoDft->Spd_R_smooth[k] + EPSILON ) ); +#else cohBand[b] += coh_weight * ( hStereoDft->xspec_smooth[2 * k] * hStereoDft->xspec_smooth[2 * k] + hStereoDft->xspec_smooth[2 * k + 1] * hStereoDft->xspec_smooth[2 * k + 1] ) / ( hStereoDft->Spd_L_smooth[k] * hStereoDft->Spd_R_smooth[k] + EPSILON ); +#endif coh_weight_sum += coh_weight; } if ( coh_weight_sum > 0 ) -- GitLab