Commit 3339c98f authored by Nicolas Roussin's avatar Nicolas Roussin
Browse files

Fix div_w_newton when denominator is 0x40000000.

parent f2a44aee
Loading
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -3492,6 +3492,19 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx(
    return;
}

#ifdef NONBE_OPT_2193_EIG2X2
static Word32 eig2x2_div_fx( Word32 num, Word32 den );

static Word32 eig2x2_div_fx( Word32 num, Word32 den )
{
    if ( EQ_32( den, 0x40000000 ) )
    {
        return num;
    }
    return div_w_newton( num, den );
}
#endif

static void eig2x2_fx(
    const Word32 E1_fx, /*q_E*/
    const Word32 E2_fx, /*q_E*/
@@ -3729,7 +3742,7 @@ static void eig2x2_fx(
    // nvalm[0] = div_w_newton( ONE_IN_Q30, W_extract_h( nval64m[0] ) );
    // exp = sub( nvalq[0], 61 );

    nvalm[0] = div_w_newton( ONE_IN_Q30, W_extract_h( nval64m[0] ) );
    nvalm[0] = eig2x2_div_fx( ONE_IN_Q30, W_extract_h( nval64m[0] ) );
    exp = sub( nvalq[0], 61 );
    nvalm[0] = Sqrt32( nvalm[0], &exp );
    nvalq[0] = sub( 31, exp );
@@ -3742,7 +3755,7 @@ static void eig2x2_fx(
    // nvalm[1] = div_w_newton( ONE_IN_Q30, W_extract_h( nval64m[1] ) );
    // exp = sub( nvalq[1], 61 );

    nvalm[1] = div_w_newton( ONE_IN_Q30, W_extract_h( nval64m[1] ) );
    nvalm[1] = eig2x2_div_fx( ONE_IN_Q30, W_extract_h( nval64m[1] ) );
    exp = sub( nvalq[1], 61 );
    nvalm[1] = Sqrt32( nvalm[1], &exp );
    nvalq[1] = sub( 31, exp );