From b411f30115ba2e0292e61281dfb891aa136b3f82 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 3 Aug 2024 17:47:22 +0530 Subject: [PATCH] LTV crash fix for 10dB OMASA stream, guard bit update in TonalComponentDetection [x] Guard bits updated for LTV crash: ltv-OMASA 1Dir2TC 3ISM at br sw techs 13.2 to 512 kbps start 24.4 kbps, 32kHz in, 48kHz out, 5.1.2 out, JBM Prof 5 [x] Float code updates for issue 812 and 819 --- lib_com/ivas_cnst.h | 4 +--- lib_com/options.h | 1 + lib_dec/TonalComponentDetection_fx.c | 4 ++++ lib_dec/ivas_qmetadata_dec.c | 15 +++++++++++++++ lib_enc/ivas_stereo_dft_enc_itd.c | 13 ++++++++++++- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 58e8d441b..87efbcaf9 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1221,18 +1221,16 @@ enum #define MASA_TRANSP_BITS 1 #define NO_BITS_MASA_ISM_NO_OBJ 2 -#ifdef IVAS_FLOAT_FIXED #ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL #define MASA2TOTAL_THR 0.9799999f #else #define MASA2TOTAL_THR 0.98f #endif +#ifdef IVAS_FLOAT_FIXED #define MASA2TOTAL_THR_Q30 1052266987 // 0.98f in Q30 //Maximum error in float to fixed conversion : 0.005% //Assuming the accuracy of 99.995% //New value = 99.995 / 100 * 0.98 = 0.979951 -#else -#define MASA2TOTAL_THR 0.98f #endif #define BITS_MASA2TOTTAL_DCT0 6 #define STEP_M2T 0.1f diff --git a/lib_com/options.h b/lib_com/options.h index 1dc5347c2..f658242a4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -74,6 +74,7 @@ #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 NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE /* VA: issue 1132: prevent division by extremely low energy value in SWB TBE */ #define NON_BE_FIX_807_MASA_DTX_BRSW /* Nokia: adds fix to check existence of DTX encoder for secondary channel in TD mode */ +#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_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index 6ef4f65da..eab15970b 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -114,6 +114,10 @@ void ivas_DetectTonalComponents_fx( move32(); } + /* Guard bit */ + lastMDCTSpect_exp = add( lastMDCTSpect_exp, 1 ); + scale_sig32( pScaledMdctSpectrum, nSamples, -1 ); + /* Find peak candidates in the last frame. */ findCandidates( nSamples, pScaledMdctSpectrum, lastMDCTSpect_exp, thresholdModification, floorPowerSpectrum ); diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 2d20ed689..4de07342c 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -8762,6 +8762,9 @@ void ivas_omasa_decode_masa_to_total( float q_dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], dct_data_tmp[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; int16_t n_streams, len_stream; +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL + int32_t int_tmp; +#endif /* Setup coding parameters */ n_streams = 1; @@ -8816,6 +8819,10 @@ void ivas_omasa_decode_masa_to_total( { masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL + int_tmp = (int32_t) ( MASA_SUR_COH_PRECISION * masa_to_total_energy_ratio[i][j] ); + masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA_SUR_COH_THRESHOLD ); +#endif k++; } } @@ -8827,6 +8834,10 @@ void ivas_omasa_decode_masa_to_total( for ( j = 0; j < nbands; j++ ) { masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[0][j]; +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL + int_tmp = (int32_t) ( MASA_SUR_COH_PRECISION * masa_to_total_energy_ratio[i][j] ); + masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA_SUR_COH_THRESHOLD ); +#endif } } } @@ -8838,6 +8849,10 @@ void ivas_omasa_decode_masa_to_total( for ( i = 0; i < nblocks; i++ ) { masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[i][0]; +#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL + int_tmp = (int32_t) ( MASA_SUR_COH_PRECISION * masa_to_total_energy_ratio[i][j] ); + masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA_SUR_COH_THRESHOLD ); +#endif } } } diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index 1c4298679..56f2e9ee6 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -3395,7 +3395,18 @@ void stereo_dft_enc_compute_itd( } /*calculate total cohSNR for frame in dB*/ - cohSNR = 20 * log10f( mEr ); +#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