From 5cff117a514fa5a19953ea0c109a144a5d9607c7 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Thu, 25 Jul 2024 09:14:32 +0200 Subject: [PATCH] fix for issue 812 nan values for CohSNR --- lib_com/options.h | 1 + lib_enc/ivas_stereo_dft_enc_itd.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 47e6a2721..752f2ab26 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -71,6 +71,7 @@ #define NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES /* FhG: issue 1133: skip de-whitening of bg noise shape after frameloss period if the first good frame is an SID */ #define NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID /* FhG: issue 1133: in TCX PLC, don't scale hHQ_core->old_out after applying fade to noise in burst frame error */ #define NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING /* VA: Add fix point bit allocation for special GSC mode such that float and fixed point have the same final bit allocation */ +#define FIX_BASOP_812_NAN_COHSNR /* FhG: BASOP issue 812: fix nan values in sparse frames for cohSNR value in ITD estimation*/ /* #################### End FIXES switches ############################ */ diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index 2d43e3d30..de66c780f 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -1026,8 +1026,19 @@ void stereo_dft_enc_compute_itd( mEr = calc_mean_E_ratio( hItd, nbands, band_limits, sfm_L, pNrgL, pNrgR, &total_mEr ); } - /*calculate total cohSNR for frame in dB*/ - cohSNR = 20 * log10f( mEr ); +/*calculate total cohSNR for frame in dB*/ +#ifdef FIX_BASOP_812_NAN_COHSNR + if ( mEr > 1.0f ) + { +#endif + cohSNR = 20 * log10f( mEr ); +#ifdef FIX_BASOP_812_NAN_COHSNR + } + else + { + cohSNR = 0; + } +#endif /* collect UNCLR classifier parameters */ { -- GitLab