Commit 28e5f086 authored by Fabian Bauer's avatar Fabian Bauer Committed by Manuel Jander
Browse files

added assert testing

parent 9f4a6477
Loading
Loading
Loading
Loading
+23 −11
Original line number Diff line number Diff line
@@ -58,12 +58,12 @@
//#define FIX_1326_SPEEDUP_06 // div->sqrt =>isqrt                // 3.0 WMOPS //Quite bad diffs  --> DONT USE
//#define FIX_1326_SPEEDUP_07 // div->sqrt =>isqrt                //  0  WMOPS                    --> DONT USE
//#define FIX_1326_SPEEDUP_08 // "-"                              // 3.0 WMOPS //small diffs      --> USE
#define FIX_1326_SPEEDUP_09 // tiny speedup                     //  .1 WMOPS
#define FIX_1326_SPEEDUP_10 // tiny speedup                    //   .1 WMOPS
#define FIX_1326_SPEEDUP_11 // tiny speedup                    //  .1 WMOPS
//#define FIX_1326_SPEEDUP_09 // tiny speedup                     //  .1 WMOPS                      --> USE? (pipe 48851 fails --> DONTUSEYET)
//#define FIX_1326_SPEEDUP_10 // tiny speedup                    //   .1 WMOPS                      --> USE? (pipe 48851 fails --> DONTUSEYET)
//#define FIX_1326_SPEEDUP_11  // tiny speedup                    //  .1 WMOPS                      --> USE? (pipe 48851 fails --> DONTUSEYET)
//#define FIX_1326_SPEEDUP_12 // tiny speedup                     //  <.1 WMOPS                   -->DONTUSE
//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt          //   2.9 WMOPS
//#define FIX_1326_SPEEDUP_14 //
//#define FIX_1326_SPEEDUP_13 // replace div/sqrt->isqrt          //   2.9 WMOPS                  -->USE? (pipe coming)
#define FIX_1326_SPEEDUP_14 // test
Word16 slot_fx[4] = { 32767, 16384, 10922, 8192 };

/*-------------------------------------------------------------------------
@@ -3213,8 +3213,14 @@ static void eig2x2_fx(
    pm_fx = 0.5f * sqrtf(max(0.0f, a_fx))
    add_fx = 0.5f * (e1 + e2)*/

    #ifdef FIX_1326_SPEEDUP_14
    static int tstcnt = 0;
    #endif
    IF( L_and( c_re == 0, c_im == 0 ) )
    {
#ifdef FIX_1326_SPEEDUP_14
        tstcnt ++;
#endif
        /* if c_re = 0 and c_im = 0, then crossSquare_fx = (c_re * c_re) + (c_im * c_im) = 0
        a_fx = (E1 - E2)^2
        pm_fx = 0.5 * sqrt(max(0, a_fx)) = 0.5 * max(0, (e1 - e2)) */
@@ -3232,6 +3238,9 @@ static void eig2x2_fx(
        q_crossSquare = sub( add( q_c, q_c ), 31 );
        IF( EQ_32( e1, e2 ) )
        {
#ifdef FIX_1326_SPEEDUP_14
            tstcnt++;
#endif
            /* if e1 - e2 = 0, then a_fx = 4 * crossSquare_fx
            pm_fx = 0.5 * sqrt(max(0, 4 * crossSquare_fx)) =  sqrt(0, crossSquare_fx)*/
            test();
@@ -3265,6 +3274,9 @@ static void eig2x2_fx(

            IF( GT_16( sub( q_c, q_e ), Q15 ) )
            {
#ifdef FIX_1326_SPEEDUP_14
                tstcnt++;
#endif
                pm_fx = L_shr( L_max( 0, L_abs( L_sub( e1, e2 ) ) ), 1 );
                q_tmp2 = q_e;
                move16();
@@ -3288,6 +3300,10 @@ static void eig2x2_fx(
            }
        }
    }
#ifdef FIX_1326_SPEEDUP_14
    if (tstcnt>10000)
      assert(0);
#endif
    // add_fx = 0.5 * (e1 + e2)
    add_fx = L_shr( L_add( e1, e2 ), 1 );
    q_tmp1 = q_e;
@@ -4669,7 +4685,6 @@ static void formulate2x2MixingMatrix_fx(
    move32();
    pop_wmops();

    push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );
    /* Matrix multiplication, tmp = Ky' * G_hat * Q */
    FOR( chA = 0; chA < BINAURAL_CHANNELS; chA++ )
    {
@@ -4695,14 +4710,11 @@ static void formulate2x2MixingMatrix_fx(
            move32();
        }
    }
    pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q" );*/

    q_temp = sub( add( q_ky, q_GhatQ ), 31 );

    push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );
    /* A = Ky' * G_hat * Q * Kx (see publication) */
    matrixMul_fx( tmpRe_fx, tmpIm_fx, &q_temp, Kxre_fx, Kxim_fx, &q_Kx, Are_fx, Aim_fx, &q_A );
    pop_wmops(); /*push_wmops( "formulate2x2MixingMatrix MMUL K*Ghat*Q*Kx" );*/

    push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" );
    /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx
@@ -4980,7 +4992,7 @@ static void formulate2x2MixingMatrix_fx(
                         0 /*int Bscale*/,
#endif
                         Pre_fx, Pim_fx, &q_P ); /* Nearest orthonormal matrix P to matrix A formulated */
    pop_wmops();                                 /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA" );*/
    pop_wmops();                                 /*push_wmops( "formulate2x2MixingMatrix nrst orthonrm PtoA (oPtoA)" );*/

    push_wmops( "formulate2x2MixingMatrix Ky P Kx^-1" );
    /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */