Skip to content
Commits on Source (16)
......@@ -86,7 +86,7 @@
#define FIX_1980_CRASH_FDCNG_ENCODESID /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */
#define FIX_1987_CRASH_OMASA_ENERGY /* FhG: Replace cldfbAnalysis_ts_fx_fix_q() with cldfbAnalysis_ts_fx_var_q() to avoid assertion error */
#define FIX_1985_SBA_714_HF_LOSS /* Dlb: Fix for issue 1985, improved dirac ref pow precision*/
#define FIX_1819_EIGENVALUE_ERROR /* FhG: Workaround for zero eigenvalue: replace with epsilon if det != 0*/
/* #################### Start BASOP porting switches ############################ */
#define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */
......
......@@ -1219,23 +1219,17 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
const Word16 *exp_vec, /* i : exponents of input vector */
const Word16 lvec_fx /* i : length of input vector */
)
#ifdef FIX_1981_MAXIMUM_EXP_FX_
{
Word16 j, ind;
Word16 tmp, exp;
ind = 0;
move16();
#ifndef FIX_1981_MAXIMUM_EXP_FX
tmp = vec_fx[0];
move16();
exp = exp_vec[0];
move16();
#else
Word16 scale;
scale = sub( norm_s( vec_fx[ind] ), 1 );
tmp = shl( vec_fx[ind], scale );
exp = sub( exp_vec[ind], scale );
#endif
FOR( j = 1; j < lvec_fx; j++ )
{
......@@ -1243,22 +1237,66 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
{
ind = j;
move16();
#ifdef FIX_1981_MAXIMUM_EXP_FX
scale = sub( norm_s( vec_fx[ind] ), 1 );
tmp = shl( vec_fx[ind], scale );
exp = sub( exp_vec[ind], scale );
}
}
return ind;
}
#elif 1
{
Word16 j, ind;
Word16 tmp, exp;
ind = 0;
move16();
tmp = vec_fx[0];
move16();
exp = exp_vec[0];
move16();
FOR( j = 1; j < lvec_fx; j++ )
{
if( LT_32( L_deposit_l(vec_fx[ind]), L_shr_sat( L_deposit_l(vec_fx[j]), sub( exp_vec[ind], exp_vec[j] ) ) ) )
{
ind = j;
move16();
}
}
return ind;
}
#else
{
Word16 j, ind;
Word16 tmp, exp;
ind = 0;
move16();
tmp = vec_fx[0];
move16();
exp = exp_vec[0];
move16();
FOR( j = 1; j < lvec_fx; j++ )
{
IF( LT_16( tmp, shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) ) ) )
{
ind = j;
move16();
tmp = vec_fx[j];
move16();
exp = exp_vec[j];
move16();
#endif
}
}
return ind;
}
#endif
/*---------------------------------------------------------------------*
* maximum_abs_16_fx()
......
......@@ -76,6 +76,10 @@ Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 };
#define ONE_DIV_EPSILON_EXP ( 40 )
#define ADAPT_HTPROTO_ROT_LIM_1 0.8f
#ifdef FIX_1819_EIGENVALUE_ERROR
#define SMALL_EIGENVALUE 50
#endif
#define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS * 3 ) + MAX_NUM_OBJECTS ) /* == different calls to get gains */
typedef struct hrtfGainCache
......@@ -4557,6 +4561,20 @@ static void formulate2x2MixingMatrix_fx(
eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D );
#ifdef FIX_1819_EIGENVALUE_ERROR
IF( D_fx[0] != 0 && D_fx[1] == 0 ) // Due to an eig2x2 error, sometimes D_fx[1] becomes zero, which implies that the input matrix should be singular (i.e., determinant = 0).
{
Word32 det_fx = L_sub_sat( Mult_32_32( tmpRe_fx[0][0], tmpRe_fx[1][1] ),
L_add_sat(
Mult_32_32( tmpRe_fx[1][0], tmpRe_fx[1][0] ),
Mult_32_32( tmpIm_fx[1][0], tmpIm_fx[1][0] ) ) );
if ( det_fx != 0 )
{
D_fx[1] = SMALL_EIGENVALUE; // Setting D_fx[1] to epsilon has no effect, as the value is too small to affect the output.
move32();
}
}
#endif
IF( D_fx[0] == 0 )
{
temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */
......