Commit 2a4d33a2 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Accumulate 10^(ILD/10) using a dynamic exponent.

parent e764e9dc
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,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 ########################### */

+20 −0
Original line number Diff line number Diff line
@@ -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_shr( Q23, 15 ) -> Q8 */
                    *p_ild_new_fx = extract_l( L_shr( Mpy_32_16_1( L_add( BASOP_Util_Log2( acc_m ), L_shl( acc_e, Q25 ) ), 24660 /*10*log10(2) in Q13*/ ), 15 ) ); // 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++;
                }
            }