diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c index 4279065b043f8ebf4767bccca68e997997ac77c6..ee1bc958e4dc1f9220339acb8dc30704def7b222 100644 --- a/lib_com/ivas_dirac_com_fx.c +++ b/lib_com/ivas_dirac_com_fx.c @@ -1026,6 +1026,7 @@ void computeDiffuseness_fixed( q_intensity_slow = sub( add( q_intensity, q_intensity ), 31 ); /* Compute Diffuseness */ +#ifndef OPT_SBA_DEC_PATH p_tmp = intensity_slow_abs; exp2 = 0; move16(); @@ -1064,6 +1065,31 @@ void computeDiffuseness_fixed( move32(); } } +#else /* OPT_SBA_DEC_PATH */ + Word16 diff = sub( 62, q_ene ); + p_tmp = intensity_slow_abs; + FOR( i = 0; i < num_freq_bands; ++i ) + { + + exp1 = sub( 31, q_intensity_slow ); + tmp = Sqrt32( p_tmp[i], &exp1 ); + + tmp = BASOP_Util_Divide3232_Scale_newton( tmp, L_add( energy_slow[i], EPSILLON_FX ), &exp2 ); + q_tmp = sub( diff, add( exp1, exp2 ) ); + // bring to Q30 + tmp = L_shl_sat( tmp, sub( Q30, q_tmp ) ); + diffuseness[i] = L_sub( ONE_IN_Q30, tmp ); + move32(); + + if ( LT_32( diffuseness[i], 0 ) ) + { + diffuseness[i] = 0; + move32(); + } + } + +#endif /* OPT_SBA_DEC_PATH */ + *q_diffuseness = Q30; move16(); diff --git a/lib_com/options.h b/lib_com/options.h index a5d5a4846c8ca6a0005aa7ef7bd9e2c4e3582dbd..f685c5541e6927fac9c1a050190a8d621a2cd732 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -106,4 +106,6 @@ #define FIX_1713_EXP /* VA: proposed correction to exp in ic-BWE*/ +#define OPT_SBA_DEC_PATH + #endif