Commit dd560359 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Replaced zero eigenvalue with epsilon if det!=0.

parent b480684c
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -148,4 +148,6 @@
#define FIX_1824
#define FIX_1822

#define FIX_1819_EIGENVALUE_ERROR                 /* FhG: Workaround for zero eigenvalue: replace with epsilon if det != 0*/

#endif
+17 −0
Original line number Diff line number Diff line
@@ -78,6 +78,10 @@ Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 };

#define MAX_GAIN_CACHE_SIZE ( ( MASA_MAXIMUM_DIRECTIONS * 3 ) + MAX_NUM_OBJECTS ) /* == different calls to get gains */

#ifdef FIX_1819_EIGENVALUE_ERROR
#define EPSILON_EIGENVALUE         50
#endif

typedef struct hrtfGainCache
{
    Word16 azi;
@@ -4399,6 +4403,19 @@ 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 )
    {
        Word32 det_fx = L_sub( Mult_32_32( tmpRe_fx[0][0], tmpRe_fx[1][1] ),
                               L_add(
                                   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] = EPSILON_EIGENVALUE;
        }
    }
#endif
    IF( D_fx[0] == 0 )
    {
        temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */