Commit 9d9e93b1 authored by ber's avatar ber
Browse files

add some submacros and activate all but one - check if pipeline still fails

parent e7acabe3
Loading
Loading
Loading
Loading
Loading
+32 −20
Original line number Diff line number Diff line
@@ -57,10 +57,21 @@
//#define FIX_1072_SPEEDUP_matrixTransp2Mul_fx_scaleSwitch
//#define FIX_1072_SPEEDUP_matrixTransp2Mul_fx_reducetest

/*16 Mhz*/
#define FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT //testing...
#define FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT
#ifdef FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT
#include <stdio.h>
  
  #define FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_0
  #define FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_1
  #define FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_2
  //#define FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_3
  #define FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_4
  #define FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_5
#endif

//#define FIX_1072_REDUCE_DIVS


#ifndef FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT
//#define FIX_1072_SET_DIV3232_RETURN_VAL /*only meaningful if FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT is not defined*/
#else
@@ -3330,13 +3341,12 @@ static void eig2x2_fx(
            exp = sub( norm_l( s_fx ), 1 );
            tmp2 = Mpy_32_32( s_fx, s_fx );
            q_tmp2 = sub( add( q_tmp1, q_tmp1 ), 31 );

            tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 );
            q_tmp2 = sub( 31, q_tmp2 );

            tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 );
#ifdef FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT
            /*8.5 Mhz*/

#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT ) && defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_0 )
            exp = exp_tmp3;
            normVal_fx = ISqrt32( tmp3, &exp );
            q_tmp2 = sub( 31, exp );
@@ -3360,7 +3370,6 @@ static void eig2x2_fx(
                q_tmp1 = q_c;
                move16();
            }

            Ure_fx[0][ch] = Mpy_32_32( s_fx, normVal_fx );
            move32();
            Ure_fx[1][ch] = Mpy_32_32( c_re, normVal_fx );
@@ -3409,7 +3418,7 @@ static void eig2x2_fx(
            tmp2 = BASOP_Util_Add_Mant32Exp( crossSquare_fx, sub( 31, q_crossSquare ), tmp2, sub( 31, q_tmp2 ), &q_tmp2 );
            q_tmp2 = sub( 31, q_tmp2 );

#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT )
#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT ) && defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_1 )
            /*8Mhz*/
            exp = sub( 31, q_tmp2 );

@@ -4045,7 +4054,6 @@ static void matrixTransp2Mul_fx(

#else  /*FIX_1072_SPEEDUP_matrixTransp2Mul_fx_reducetest*/


            test();
            test();
            test();
@@ -4640,7 +4648,7 @@ static void formulate2x2MixingMatrix_fx(
    temp = Mpy_32_32( E_in2, 2147484 ); // 2147484 = 0.001f in Q31
    temp = L_max( temp, E_in1 );

#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT )
#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT ) && defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_2 )
    /*IF (E_out1 == 0)*/
    {
        Ghat_fx[0] = 0;
@@ -4652,7 +4660,6 @@ static void formulate2x2MixingMatrix_fx(
    {
        IF( temp == 0 )
        {
            // ASSERT for testing
            temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, 4611686, &exp ); // 4611686 = Q62
            exp = sub( exp, sub( q_eout, 62 ) );
            Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp
@@ -4660,17 +4667,20 @@ static void formulate2x2MixingMatrix_fx(
        }
        ELSE
        {
            Word16 exp_eout;
            Word32 tmp_ = temp;
#ifndef FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_ADDEPSIILONOBSOLETE
            temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); // obsolete?
            tmp_ = BASOP_Util_Add_Mant32Exp( tmp_, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); // obsolete?
            exp_temp = add( exp_temp, sub( 31, q_eout ) );
#else
            exp_temp = add( sub( 31, q_ein ), sub( 31, q_eout ) );
#endif
            temp = Mpy_32_32( temp, E_out1 );
            temp = ISqrt32( temp, &exp_temp );
            Ghat_fx[0] = Mpy_32_32( temp, E_out1 );
            exp_eout = sub( 31, q_eout );
            tmp_ = Mpy_32_32( tmp_, E_out1 );
            tmp_ = ISqrt32( tmp_, &exp_temp );
            Ghat_fx[0] = Mpy_32_32( tmp_, E_out1 );
            move32();
            exp = add( exp_temp, sub( 31, q_eout ) );
            exp = add( exp_temp, exp_eout );
        }
    }

@@ -4695,11 +4705,12 @@ static void formulate2x2MixingMatrix_fx(
    move32();
#endif /*FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT*/


    temp = Mpy_32_32( E_in1, 2147484 ); // 2147484 = 0.001f in Q31
    temp = L_max( temp, E_in2 );        // q_ein


#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT )
#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT ) && defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_3 )
    // IF( E_out2 == 0 )
    {
        Ghat_fx[1] = 0;
@@ -4711,7 +4722,6 @@ static void formulate2x2MixingMatrix_fx(
    {
        IF( temp == 0 )
        {
            /*ASSERT for testing*/
            temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, 4611686, &exp1 ); // 4611686 = Q62
            exp1 = sub( exp1, sub( q_eout, 62 ) );
            Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1
@@ -4719,17 +4729,19 @@ static void formulate2x2MixingMatrix_fx(
        }
        ELSE
        {
            Word16 exp_eout;
#ifndef FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_ADDEPSIILONOBSOLETE
            temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); // obsolete?
            exp1 = add( sub( 31, q_eout ), exp_temp );
#else
            exp1 = add( sub( 31, q_eout ), sub( 31, q_ein ) );
#endif
            exp_eout = sub( 31, q_eout );
            temp = Mpy_32_32( E_out2, temp );
            temp = ISqrt32( temp, &exp1 );
            Ghat_fx[1] = Mpy_32_32( temp, E_out2 );
            move32();
            exp1 = add( sub( 31, q_eout ), exp1 );
            exp1 = add( exp_eout, exp1 );
        }
    }
#else
@@ -4798,7 +4810,7 @@ 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 );

#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT )
#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT ) && defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_4 )
    IF( D_fx[0] == 0 )
    {
        temp = 2047986068;
@@ -4827,7 +4839,7 @@ static void formulate2x2MixingMatrix_fx(
    move32();
#endif /*FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT*/

#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT )
#if defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT ) && defined( FIX_1072_REPLACE_DIV_SQRT_BY_ISQRT_5 )
    IF( D_fx[1] == 0 )
    {
        temp = 2047986068;