diff --git a/lib_com/options.h b/lib_com/options.h index e985a75ef692e2bca8b617b23d74e09798ba70a1..fca9b4b0f646c849ef65c960f065f9722b2511ae 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -101,6 +101,7 @@ #define NONBE_FIX2614_LP_CNG_ASSERT /* FhG: */ #define FIX_FLOAT_1600_OMASA_WRONG_RENDER_PATH /* Nokia: float issue 1600: fix initialization condition of stereo type detection for OMASA */ #define FIX_BASOP_1765_MASA1TC_CNG_MISMATCH /* Nokia: BASOP issue 1765: Improve accuracy of FD CNG noise estimation */ +#define FIX_BASOP_2627_PARAM_MC_ILD_REMAP_EXP /* FhG: BASOP #2627: accumulate 10^(ILD/10) using a dynamic exponent */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c index 4a191876ceba2636d140195202f3821748567b92..ac13c315f98ee993c140c0984d0c50d1ebab47bd 100644 --- a/lib_dec/ivas_mc_param_dec_fx.c +++ b/lib_dec/ivas_mc_param_dec_fx.c @@ -756,9 +756,11 @@ ivas_error ivas_param_mc_dec_reconfig_fx( Word16 num_param_lfe; Word16 *p_icc_new_fx = hParamMC->icc_q_fx; // Q15 Word16 *p_ild_new_fx = hParamMC->icld_q_fx; // Q8 +#ifndef FIX_BASOP_2627_PARAM_MC_ILD_REMAP_EXP Word16 p_ild_new_e = 23; move16(); Word16 p_ild_new_tmp; +#endif /* ICC */ num_param_lfe = hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe; @@ -785,6 +787,23 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { FOR( param_idx = 0; param_idx < num_param_lfe; param_idx++ ) { +#ifdef FIX_BASOP_2627_PARAM_MC_ILD_REMAP_EXP + Word32 acc_m = 0; + move32(); + Word16 acc_e = 0; + move16(); + FOR( source_param_idx = 0; source_param_idx < parameter_band_mapping.n_source_bands[new_param_band_idx]; source_param_idx++ ) + { + Word32 term_m; + Word16 term_e; + term_m = BASOP_util_Pow2( L_mult0( 10885 /*log2(10)/10*2^15*/, ild_q_old_fx[parameter_band_mapping.source_band_idx[new_param_band_idx][source_param_idx] * num_param_lfe + param_idx] ), 8, &term_e ); + term_m = Mpy_32_16_1( term_m, parameter_band_mapping.source_band_factor_fx[new_param_band_idx][source_param_idx] ); /* * factor (Q15) */ + acc_m = BASOP_Util_Add_Mant32Exp( acc_m, acc_e, term_m, term_e, &acc_e ); + } + /* log2 term is Q25; Mpy_32_16_1( Q25, Q13 ) -> Q(25+13-15) = Q23; L_shl( Q23, 1 ) -> Q24 - Q16 = Q8 */ + *p_ild_new_fx = extract_h( L_shl( Mpy_32_16_1( L_add( BASOP_Util_Log2( acc_m ), L_shl( acc_e, Q25 ) ), 24660 /*10*log10(2) in Q13*/ ), 1 ) ); // Q8 + move16(); +#else *p_ild_new_fx = 0; move16(); FOR( source_param_idx = 0; source_param_idx < parameter_band_mapping.n_source_bands[new_param_band_idx]; source_param_idx++ ) @@ -795,6 +814,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( } *p_ild_new_fx = extract_l( L_shr( Mpy_32_16_1( L_add( BASOP_Util_Log2( *p_ild_new_fx ), L_add( 16 << Q25, L_shl( p_ild_new_e, 25 ) ) ), 24660 /*3.Q13*/ ), 15 ) ); // Q8 move16(); +#endif p_ild_new_fx++; } }