Commit 99e842f2 authored by Nicolas Roussin's avatar Nicolas Roussin
Browse files

Increase precision of numerator and denominator and use cadence division.

parent 536e3391
Loading
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -1374,7 +1374,7 @@ static UWord32 ceil_log2( UWord32 x )

static Word64 Mpy_64_32( Word64 W_var1, Word32 L_var2 )
{
#if 0
#if 1
    Word32 var1_l;
    Word64 var_out;
    var1_l = W_extract_l( W_var1 );                                               // 1
@@ -1652,15 +1652,25 @@ static void ivas_dirac_dec_binaural_formulate_input_covariance_matrices_fx(
#ifdef NONBE_2157_IVAS_DIRAC_DEC_BINAURAL_FORMULATE_INPUT_COVARIANCE_MATRICES
        Word16 exp;
        Word64 num64, den64;
#if 0
        num64 = W_add( W_shr( hDiracDecBin->ChEne[0][bin], 1 ), W_shr( hDiracDecBin->ChEne[1][bin], 1 ) );         // 2q - rsh0 - 1
        num64 = Mpy_64_32( num64, IIReneLimiterFactor_fx );                                                        // 2q - rsh0 - 1 - 5
        den64 = W_add( W_shr( hDiracDecBin->ChEnePrev[0][bin], 1 ), W_shr( hDiracDecBin->ChEnePrev[1][bin], 1 ) ); // 2q - rsh0 - 1
#else
        num64 = W_add( hDiracDecBin->ChEne[0][bin], hDiracDecBin->ChEne[1][bin] );         // 2q - rsh0
        num64 = Mpy_64_32( num64, IIReneLimiterFactor_fx );                                // 2q - rsh0 - 5
        den64 = W_add( hDiracDecBin->ChEnePrev[0][bin], hDiracDecBin->ChEnePrev[1][bin] ); // 2q - rsh0
#endif
        den64 = W_max( 1, den64 );
        num_e = W_norm( num64 );
        den_e = W_norm( den64 );
        num = W_extract_h( W_shl( num64, num_e ) ); // 2q - rsh0 - 1 - 5 + num_e - 32
        den = W_extract_h( W_shl( den64, den_e ) ); // 2q - rsh0 - 1 + den_e - 32
#if 0
        IIReneLimiter_fx[bin] = BASOP_Util_Divide3232_Scale_newton( num, den, &exp );
#else
        IIReneLimiter_fx[bin] = BASOP_Util_Divide3232_Scale_cadence( num, den, &exp );
#endif
        exp = add( sub( den_e, num_e ), add( 5, exp ) );
        IF( L_shr_sat( IIReneLimiter_fx[bin], sub( 31, exp ) ) > 0 )
        {