diff --git a/lib_com/options.h b/lib_com/options.h index b1d98931d142e92bc91c4ee518d947dfef8b8788..2e14c9035f87cce4af8be30be59f102ba3d039c7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -115,6 +115,8 @@ #define NONBE_FIX_BASOP_2233_RTPDUMP_DIFFERING_BITSTREAMS /* Nokia: fix basop issue 2233: Fix differing rtpdump streams */ +#define NONBE_FIX_2237_ZERO_CURR_NOISE_PROBLEM /* FhG: Modify sum of hTonalMDCTConc->curr_noise_nrg to avoid inaccurate zero */ + /* ################### End FIXES switches ########################### */ /* #################### Start BASOP porting switches ############################ */ diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index d098eaa15e4e9700ed11759342775554694c8c15..9e880b9f12151408ffeb7b0db74442987c1a972c 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -3098,7 +3098,19 @@ void TonalMdctConceal_create_concealment_noise_ivas_fx( move32(); IF( concealment_noise[i] != 0 ) { +#ifdef NONBE_FIX_2237_ZERO_CURR_NOISE_PROBLEM + Word32 cnp; + Word16 cnp_e; + + cnp_e = norm_l( concealment_noise[i] ); + cnp = L_shl( concealment_noise[i], cnp_e ); + cnp = Mpy_32_32( cnp, cnp ); + cnp_e = shl( sub( *concealment_noise_exp, cnp_e ), 1 ); + + hTonalMDCTConc->curr_noise_nrg = BASOP_Util_Add_Mant32Exp( hTonalMDCTConc->curr_noise_nrg, hTonalMDCTConc->curr_noise_nrg_exp, cnp, cnp_e, &temp_e ); // Q31-temp_e +#else hTonalMDCTConc->curr_noise_nrg = BASOP_Util_Add_Mant32Exp( hTonalMDCTConc->curr_noise_nrg, hTonalMDCTConc->curr_noise_nrg_exp, Mpy_32_32( concealment_noise[i], concealment_noise[i] ), shl( *concealment_noise_exp, 1 ), &temp_e ); // Q31-temp_e +#endif } hTonalMDCTConc->curr_noise_nrg_exp = temp_e; move16(); @@ -3118,7 +3130,19 @@ void TonalMdctConceal_create_concealment_noise_ivas_fx( move32(); IF( concealment_noise[i] != 0 ) { +#ifdef NONBE_FIX_2237_ZERO_CURR_NOISE_PROBLEM + Word32 cnp; + Word16 cnp_e; + + cnp_e = norm_l( concealment_noise[i] ); + cnp = L_shl( concealment_noise[i], cnp_e ); + cnp = Mpy_32_32( cnp, cnp ); + cnp_e = shl( sub( *concealment_noise_exp, cnp_e ), 1 ); + + hTonalMDCTConc->curr_noise_nrg = BASOP_Util_Add_Mant32Exp( hTonalMDCTConc->curr_noise_nrg, hTonalMDCTConc->curr_noise_nrg_exp, cnp, cnp_e, &temp_e ); // Q31-temp_e +#else hTonalMDCTConc->curr_noise_nrg = BASOP_Util_Add_Mant32Exp( hTonalMDCTConc->curr_noise_nrg, hTonalMDCTConc->curr_noise_nrg_exp, Mpy_32_32( concealment_noise[i], concealment_noise[i] ), shl( *concealment_noise_exp, 1 ), &temp_e ); // Q31-temp_e +#endif } hTonalMDCTConc->curr_noise_nrg_exp = temp_e; move16();