Commit 5b3c28cc authored by Manuel Jander's avatar Manuel Jander
Browse files

Use correct macro naming scheme.

parent e643e42e
Loading
Loading
Loading
Loading
Loading
+36 −36
Original line number Diff line number Diff line
@@ -64,11 +64,11 @@
#endif

#if 1
#define OPT_DIV
#define OPT_DIV_NORM /* 5 dB SNR precision improvement */
#define FIX_1010_OPT_DIV
#define FIX_1010_OPT_DIV_NORM /* precision improvement */

#define OPT_GIVENS
#define OPT_GIVENS_INV
#define FIX_1010_OPT_GIVENS
#define FIX_1010_OPT_GIVENS_INV
#endif

/*-----------------------------------------------------------------------*
@@ -206,7 +206,7 @@ static void ApplyRotation_fx(
    const Word16 nChannels      /* Q0 */
);

#ifdef OPT_GIVENS_INV
#ifdef FIX_1010_OPT_GIVENS_INV
static void GivensRotation2_fx(
    const Word32 x, /* exp(x_e) */
    const Word16 x_e,
@@ -638,7 +638,7 @@ static Word16 BidagonalDiagonalisation_fx(
    Word16 convergence, iteration, found_split;
    Word16 error = 0;
    move16();
#ifdef OPT_GIVENS_INV
#ifdef FIX_1010_OPT_GIVENS_INV
    Word32 temp;
#endif
    Word16 singularValues_new_e[MAX_OUTPUT_CHANNELS], secDiag_new_e[MAX_OUTPUT_CHANNELS];
@@ -711,7 +711,7 @@ static Word16 BidagonalDiagonalisation_fx(

                    c = singularValues_fx[kCh]; /* exp(singularValues_new_e) */
                    c_e = singularValues_new_e[kCh];
#ifdef OPT_GIVENS_INV
#ifdef FIX_1010_OPT_GIVENS_INV
                    GivensRotation2_fx( g, g_e, singularValues_fx[kCh], singularValues_new_e[kCh], &singularValues_fx[kCh], &temp, &singularValues_new_e[kCh], &temp_exp ); /* exp(singularValues_new_e) */
                    c = Mpy_32_32( c, temp );
                    c_e = add(c_e, temp_exp);
@@ -726,7 +726,7 @@ static Word16 BidagonalDiagonalisation_fx(
                        c_e = 0;
                        move16();
                    }
#ifdef OPT_GIVENS_INV
#ifdef FIX_1010_OPT_GIVENS_INV
                    s = Mpy_32_32( -g, temp );
                    s_e = add( g_e, temp_exp );
#else
@@ -940,7 +940,7 @@ static void ApplyQRTransform_fx(
    const Word16 nChannelsC    /* i  : number of columns in the matrix to be decomposed			Q0*/
)
{
#ifdef OPT_GIVENS_INV
#ifdef FIX_1010_OPT_GIVENS_INV
    Word32 temp;
    Word16 temp_e;
#endif
@@ -1046,7 +1046,7 @@ static void ApplyQRTransform_fx(
        g = Mpy_32_32( c, secDiag[ch + 1] ); /* exp(c_e + secDiag_e) */
        g_e = add( c_e, secDiag_e[ch + 1] );

#ifdef OPT_GIVENS_INV
#ifdef FIX_1010_OPT_GIVENS_INV
        GivensRotation2_fx( d, d_e, r, r_e, &secDiag[ch], &temp, &secDiag_e[ch], &temp_e ); /* exp(secDiag_e) */
        c = Mpy_32_32( d, temp);
        c_e = add(temp_e, d_e);
@@ -1062,7 +1062,7 @@ static void ApplyQRTransform_fx(
            c_e = 0;
            move16();
        }
#ifdef OPT_GIVENS_INV
#ifdef FIX_1010_OPT_GIVENS_INV
        s = Mpy_32_32( r, temp );
        s_e = add(r_e, temp_e);
#else
@@ -1089,7 +1089,7 @@ static void ApplyQRTransform_fx(
        // ApplyRotation(singularVectors_Right, c, s, x_ii, aux, &d, &g, ch + 1, ch, nChannelsC);
        ApplyRotation_fx( singularVectors_Right, c, c_e, s, s_e, x_ii, x_ii_e, aux, aux_e, &d, &d_e, &g, &g_e, ch + 1, ch, nChannelsC );

#ifdef OPT_GIVENS_INV
#ifdef FIX_1010_OPT_GIVENS_INV
        GivensRotation2_fx( d, d_e, r, r_e, &singularValues[ch], &aux, &singularValues_e[ch], &aux_e ); /* exp(singularValues_e) */
#else
        singularValues[ch] = GivensRotation_fx( d, d_e, r, r_e, &singularValues_e[ch] ); /* exp(singularValues_e) */
@@ -1097,7 +1097,7 @@ static void ApplyQRTransform_fx(
#endif
        IF( GT_32( L_abs( singularValues[ch] ), Mpy_32_32( CONVERGENCE_FACTOR_FX, L_abs( singularValues[ch] ) ) ) )
        {
#ifndef OPT_GIVENS_INV
#ifndef FIX_1010_OPT_GIVENS_INV
            aux = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, singularValues[ch], &aux_e ); /* exp(aux_e + (1 - singularValues_e)) */
            aux_e = add( aux_e, sub( 1, singularValues_e[ch] ) );
#endif
@@ -1373,7 +1373,7 @@ static void HouseholderReduction(
 *
 *-------------------------------------------------------------------------*/

#ifdef OPT_DIV
#ifdef FIX_1010_OPT_DIV
static
Word32 BASOP_Util_Inv32(Word32 x, Word16 *px_e)
{
@@ -1470,10 +1470,10 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */

    IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
    {
#ifdef OPT_DIV
#ifdef FIX_1010_OPT_DIV
        Word16 invVal_e, temp_e;
        Word32 invVal = BASOP_Util_Inv32(maxWithSign_fx( *sig_x ), &invVal_e);
#ifdef OPT_DIV_NORM
#ifdef FIX_1010_OPT_DIV_NORM
        temp_e = norm_l(invVal);
        invVal = L_shl(invVal, temp_e);
        invVal_e = sub(invVal_e, temp_e);
@@ -1485,14 +1485,14 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
        move16();
        FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
        {
#ifndef OPT_DIV
#ifndef FIX_1010_OPT_DIV
            singularVectors[jCh][currChannel] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[jCh][currChannel], maxWithSign_fx( *sig_x ), &sing_exp[jCh] ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
#else
            temp_e = norm_l(singularVectors[jCh][currChannel]);
            singularVectors[jCh][currChannel] = L_shl(singularVectors[jCh][currChannel], temp_e);
            singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], invVal); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
            sing_exp[jCh] = sub(invVal_e, temp_e);
#ifdef OPT_DIV_NORM
#ifdef FIX_1010_OPT_DIV_NORM
            temp_e = norm_l(singularVectors[jCh][currChannel]);
            singularVectors[jCh][currChannel] = L_shl(singularVectors[jCh][currChannel], temp_e);
            sing_exp[jCh] = sub(sing_exp[jCh], temp_e);
@@ -1535,9 +1535,9 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
#endif
        move32();

#ifdef OPT_DIV
#ifdef FIX_1010_OPT_DIV
        invVal = BASOP_Util_Inv32(maxWithSign_fx( r ), &invVal_e);
#ifdef OPT_DIV_NORM
#ifdef FIX_1010_OPT_DIV_NORM
        temp_e = norm_l(invVal);
        invVal = L_shl(invVal, temp_e);
        invVal_e = sub(invVal_e, temp_e);
@@ -1555,13 +1555,13 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
                norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), add( sing_exp[jCh], *singularVectors_e ), &norm_x_e ); /* exp(norm_x_e) */
            }

#ifndef OPT_DIV
#ifndef FIX_1010_OPT_DIV
            f = BASOP_Util_Divide3232_Scale_cadence( norm_x, maxWithSign_fx( r ), &f_e ); /* f_e + (norm_x_e - r_e) */
            f_e = add( f_e, sub( norm_x_e, r_e ) );
#else
            f = Mpy_32_32(norm_x, invVal); /* invVal_e + (norm_x_e - r_e) */
            f_e = add(invVal_e, sub( norm_x_e, r_e ) );
#ifdef OPT_DIV_NORM
#ifdef FIX_1010_OPT_DIV_NORM
            temp_e = norm_l(f);
            f = L_shl(f, temp_e);
            f_e = sub(f_e, temp_e);
@@ -1745,10 +1745,10 @@ static void biDiagonalReductionRight_fx(
            norm_x_e = 0;
            move16();

#ifdef OPT_DIV
#ifdef FIX_1010_OPT_DIV
            Word16 invVal_e, temp_e;
            Word32 invVal = BASOP_Util_Inv32(maxWithSign_fx( *sig_x ), &invVal_e);
#ifdef OPT_DIV_NORM
#ifdef FIX_1010_OPT_DIV_NORM
            temp_e = norm_l(invVal);
            invVal = L_shl(invVal, temp_e);
            invVal_e = sub(invVal_e, temp_e);
@@ -1756,7 +1756,7 @@ static void biDiagonalReductionRight_fx(
#endif
            FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */
            {
#ifndef OPT_DIV
#ifndef FIX_1010_OPT_DIV
                singularVectors[currChannel][jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( *sig_x ), &sing_exp[jCh] ); /* exp(sing_exp + (singularVectors_e - sig_x_e))  */
#else
                temp_e = norm_l(singularVectors[currChannel][jCh]);
@@ -1764,7 +1764,7 @@ static void biDiagonalReductionRight_fx(
                singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], invVal); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
                sing_exp[jCh] = sub(invVal_e, temp_e);
                move16();
#ifdef OPT_DIV_NORM
#ifdef FIX_1010_OPT_DIV_NORM
                temp_e = norm_l(singularVectors[currChannel][jCh]);
                singularVectors[currChannel][jCh] = L_shl(singularVectors[currChannel][jCh], temp_e);
                sing_exp[jCh] = sub(sing_exp[jCh], temp_e);
@@ -1801,9 +1801,9 @@ static void biDiagonalReductionRight_fx(
            singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[idx], -( *g ), 0, &sing_exp[idx] ); /* exp(sing_exp) */
            move32();

#ifdef OPT_DIV
#ifdef FIX_1010_OPT_DIV
            invVal = BASOP_Util_Inv32(maxWithSign_fx( r ), &invVal_e);
#ifdef OPT_DIV_NORM
#ifdef FIX_1010_OPT_DIV_NORM
            temp_e = norm_l(invVal);
            invVal = L_shl(invVal, temp_e);
            invVal_e = sub(invVal_e, temp_e);
@@ -1812,14 +1812,14 @@ static void biDiagonalReductionRight_fx(

            FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
            {
#ifndef OPT_DIV
#ifndef FIX_1010_OPT_DIV
                secDiag[jCh] = BASOP_Util_Divide3232_Scale_cadence( singularVectors[currChannel][jCh], maxWithSign_fx( r ), &secDiag_exp[jCh] ); /* exp(secDiag_exp + (sing_exp - r_e) */
#else
                temp_e = norm_l(singularVectors[currChannel][jCh]);
                secDiag[jCh] = L_shl(singularVectors[currChannel][jCh], temp_e);
                secDiag[jCh] = Mpy_32_32( secDiag[jCh], invVal); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
                secDiag_exp[jCh] = sub(invVal_e, temp_e);
#ifdef OPT_DIV_NORM
#ifdef FIX_1010_OPT_DIV_NORM
                temp_e = norm_l(secDiag[jCh]);
                secDiag[jCh] = L_shl(secDiag[jCh], temp_e);
                secDiag_exp[jCh] = sub(secDiag_exp[jCh], temp_e);
@@ -2009,7 +2009,7 @@ static void singularVectorsAccumulationLeft_fx(

        IF( t_ii ) /*if (fabsf(t_ii) > EPSILON *fabsf(t_ii)) {*/
        {
#ifdef OPT_DIV
#ifdef FIX_1010_OPT_DIV
            t_ii = BASOP_Util_Inv32(maxWithSign_fx(t_ii), &temp_exp);
            t_ii_e = sub(temp_exp, t_ii_e);
#else
@@ -2027,7 +2027,7 @@ static void singularVectorsAccumulationLeft_fx(
                {
                    norm_y = BASOP_Util_Add_Mant32Exp( norm_y, norm_y_e, Mpy_32_32( singularVectors_Left[k][nCh], singularVectors_Left[k][iCh] ), add( sing_exp2[k][nCh], sing_exp2[k][iCh] ), &norm_y_e ); /* exp(norm_y_e) */
                }
#ifdef OPT_DIV
#ifdef FIX_1010_OPT_DIV
                t_jj = BASOP_Util_Inv32(maxWithSign_fx(singularVectors_Left[nCh][nCh]), &temp_exp);
                t_jj = Mpy_32_32(Mpy_32_32( t_ii, norm_y ), t_jj);
                t_jj_e = add( temp_exp, sub( add( t_ii_e, norm_y_e ), sing_exp2[nCh][nCh] ) );
@@ -2175,7 +2175,7 @@ static void singularVectorsAccumulationRight_fx(

                FOR( iCh = nCh + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC*/
                {
#ifdef OPT_DIV
#ifdef FIX_1010_OPT_DIV
                    ratio_float = L_deposit_h(BASOP_Util_Divide3232_Scale( singularVectors_Left[nCh][iCh], maxWithSign_fx( singularVectors_Left[nCh][nCh + 1] ), &temp_exp1 )); /* exp(temp_exp1) */
                    singularVectors_Right[iCh][nCh] = L_deposit_h(BASOP_Util_Divide3232_Scale( ratio_float, maxWithSign_fx( t_ii ), &sing_right_exp[iCh][nCh] ));               /* exp(sing_right_exp + (temp_exp1 - secDiag_e) */
#else
@@ -2294,7 +2294,7 @@ static void singularVectorsAccumulationRight(

#ifdef IVAS_FLOAT_FIXED

#ifdef OPT_GIVENS_INV
#ifdef FIX_1010_OPT_GIVENS_INV
static void GivensRotation2_fx(
    const Word32 x, /* exp(x_e) */
    const Word16 x_e,
@@ -2326,7 +2326,7 @@ static Word32 GivensRotation_fx(
    const Word16 z_e,
    Word16 *out_e )
{
#ifdef OPT_GIVENS
#ifdef FIX_1010_OPT_GIVENS
    Word32 r;
#else
    Word32 x_abs, z_abs;
@@ -2335,7 +2335,7 @@ static Word32 GivensRotation_fx(
    Word32 L_temp;
#endif

#ifdef OPT_GIVENS
#ifdef FIX_1010_OPT_GIVENS
    r = BASOP_Util_Add_Mant32Exp( Mpy_32_32(z, z), shl(z_e, 1), Mpy_32_32(x, x), shl(x_e, 1), out_e );
    r = Sqrt32(r, out_e);
#else