Commit a18b9b96 authored by Manuel Jander's avatar Manuel Jander
Browse files

Apply bug fix from issue 1139 and add wmops/precision improvement macro...

Apply bug fix from issue 1139 and add wmops/precision improvement macro FIX_1010_OPT_SINGLE_RESCALE.
parent c87442fc
Loading
Loading
Loading
Loading
Loading
+152 −18
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@

#if 1
#define FIX_1010_OPT_DIV
#define FIX_1010_OPT_SINGLE_RESCALE
#define FIX_1010_OPT_GIVENS
#define FIX_1010_OPT_GIVENS_INV
// #define FIX_1010_OPT_GIVENS_AMAX_BMIN
@@ -79,7 +80,11 @@ static void biDiagonalReductionLeft_fx(
    Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
    Word32 singularValues[MAX_OUTPUT_CHANNELS],    /* exp(singularValues_e) */
    Word32 secDiag[MAX_OUTPUT_CHANNELS],           /* exp(secDiag_e) */
#ifndef FIX_1010_OPT_SINGLE_RESCALE
    Word16 *singularVectors_e,
#else
    Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS],
#endif
    Word16 singularValues_e[MAX_OUTPUT_CHANNELS],
    Word16 *secDiag_e,
    const Word16 nChannelsL,  /* Q0 */
@@ -93,7 +98,11 @@ static void biDiagonalReductionLeft_fx(
static void biDiagonalReductionRight_fx(
    Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
    Word32 secDiag[MAX_OUTPUT_CHANNELS],           /* exp(secDiag_e) */
#ifndef FIX_1010_OPT_SINGLE_RESCALE
    Word16 *singularVectors_e,
#else
    Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS],
#endif
    Word16 *secDiag_e,
    const Word16 nChannelsL,  /* Q0 */
    const Word16 nChannelsC,  /* Q0 */
@@ -1119,11 +1128,29 @@ static void HouseholderReduction_fx(
    Word16 sig_x_fx_e = 0;
    move16();

#ifdef FIX_1010_OPT_SINGLE_RESCALE
    Word16 iCh, jCh;
    Word16 singularVectors_Left_fx_e[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS];
    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
    {
        FOR( iCh = 0; iCh < nChannelsC; iCh++ )
        {
            singularVectors_Left_fx_e[jCh][iCh] = singularVectors_Left_e;
            move32();
        }
    }
#endif

    /* Bidiagonal Reduction for every channel */
    FOR( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */
    {
#ifndef FIX_1010_OPT_SINGLE_RESCALE
        biDiagonalReductionLeft_fx( singularVectors_Left_fx, singularValues_fx, secDiag_fx, &singularVectors_Left_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx );
        biDiagonalReductionRight_fx( singularVectors_Left_fx, secDiag_fx, &singularVectors_Left_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx );
#else
        biDiagonalReductionLeft_fx( singularVectors_Left_fx, singularValues_fx, secDiag_fx, singularVectors_Left_fx_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx );
        biDiagonalReductionRight_fx( singularVectors_Left_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx );
#endif

        Word16 L_temp_e;
        Word32 L_temp = BASOP_Util_Add_Mant32Exp( L_abs( singularValues_fx[nCh] ), singularValues_fx_e[nCh], L_abs( secDiag_fx[nCh] ), *secDiag_fx_e, &L_temp_e ); /* exp(L_temp_e) */
@@ -1136,6 +1163,30 @@ static void HouseholderReduction_fx(
        }
    }

#ifdef FIX_1010_OPT_SINGLE_RESCALE
    // rescaling block
    Word16 exp_max = 0;
    move16();
    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
    {
        FOR( iCh = 0; iCh < nChannelsC; iCh++ )
        {
            exp_max = s_max( exp_max, singularVectors_Left_fx_e[jCh][iCh] );
        }
    }

    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
    {
        FOR( iCh = 0; iCh < nChannelsC; iCh++ )
        {
            singularVectors_Left_fx[jCh][iCh] = L_shr_r( singularVectors_Left_fx[jCh][iCh], sub( exp_max, singularVectors_Left_fx_e[jCh][iCh] ) ); /* exp(exp_max) */
            move32();
        }
    }
    singularVectors_Left_e = exp_max;
    move16();
#endif

    /* SingularVecotr Accumulation */
    singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_e, *secDiag_fx_e, nChannelsC );

@@ -1189,7 +1240,11 @@ static void biDiagonalReductionLeft_fx(
    Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
    Word32 singularValues[MAX_OUTPUT_CHANNELS],    /* exp(singularValues_e) */
    Word32 secDiag[MAX_OUTPUT_CHANNELS],           /* exp(secDiag_e) */
#ifndef FIX_1010_OPT_SINGLE_RESCALE
    Word16 *singularVectors_e,
#else
    Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS],
#endif
    Word16 singularValues_e[MAX_OUTPUT_CHANNELS],
    Word16 *secDiag_e,
    const Word16 nChannelsL,  /* Q0 */
@@ -1203,14 +1258,16 @@ static void biDiagonalReductionLeft_fx(
    Word16 iCh, jCh, idx;
    Word32 norm_x, f, r;
    Word16 norm_x_e, f_e, r_e;
    Word16 sing_exp[MAX_OUTPUT_CHANNELS];
    Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 };
    Word32 L_temp;
    Word16 L_temp_e;
#ifndef FIX_1010_OPT_SINGLE_RESCALE
    Word16 sing_exp[MAX_OUTPUT_CHANNELS];
    Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 };
    FOR( jCh = 0; jCh < MAX_OUTPUT_CHANNELS; jCh++ )
    {
        set16_fx( sing_exp2[jCh], *singularVectors_e, MAX_OUTPUT_CHANNELS );
    }
#endif

    secDiag[currChannel] = Mpy_32_32( *sig_x, *g ); /* exp(sig_x_e) */
    move32();
@@ -1245,14 +1302,20 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */

    FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
    {
#ifndef FIX_1010_OPT_SINGLE_RESCALE
        ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), *singularVectors_e, sig_x_e ); /* exp(sig_x_e) */
#else
        ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */
#endif
    }

    IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
    {
#ifdef FIX_1010_OPT_DIV
        Word16 invVal_e;
        Word32 invVal = BASOP_Util_Inv32( maxWithSign_fx( *sig_x ), &invVal_e );
        Word32 invVal;
        /* BASOP_Util_Inv32 is not accurate enogh in this case. */
        invVal = BASOP_Util_Divide3232_Scale_cadence( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e );
#endif
        norm_x = 0;
        move32();
@@ -1265,14 +1328,21 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
            move32();
            sing_exp[jCh] = add( sing_exp[jCh], sub( *singularVectors_e, *sig_x_e ) );
            move16();
            norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */
#else
            Word16 temp_e = norm_l( singularVectors[jCh][currChannel] );
            singularVectors[jCh][currChannel] = Mpy_32_32( L_shl( singularVectors[jCh][currChannel], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
            move32();
            sing_exp[jCh] = add( sub( invVal_e, temp_e ), sub( *singularVectors_e, *sig_x_e ) );
#ifndef FIX_1010_OPT_SINGLE_RESCALE
            sing_exp[jCh] = sub( add( invVal_e, sub( *singularVectors_e, *sig_x_e ) ), temp_e );
            move16();
#endif
            norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */
#else
            singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e );
            move16();
            norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( singularVectors2_e[jCh][currChannel], 1 ), &norm_x_e ); /* exp(norm_x_e) */
#endif
#endif
        }
        IF( GT_16( norm_x_e, 0 ) )
        {
@@ -1297,8 +1367,13 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
            move32();
        }

#ifndef FIX_1010_OPT_SINGLE_RESCALE
        r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), sing_exp[currChannel], -norm_x, norm_x_e, &r_e );                       /* exp(r_e) */
        singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[currChannel], -( *g ), 0, &sing_exp[currChannel] ); /* sing_exp */
#else
        r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e );                                      /* exp(r_e) */
        singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */
#endif
        move32();

#ifdef FIX_1010_OPT_DIV
@@ -1313,7 +1388,11 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
            move16();
            FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
            {
#ifndef FIX_1010_OPT_SINGLE_RESCALE
                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) */
#else
                norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), add( singularVectors2_e[jCh][currChannel], singularVectors2_e[jCh][iCh] ), &norm_x_e ); /* exp(norm_x_e) */
#endif
            }

#ifndef FIX_1010_OPT_DIV
@@ -1326,7 +1405,11 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */

            FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
            {
#ifndef FIX_1010_OPT_SINGLE_RESCALE
                singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], *singularVectors_e, Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, sing_exp[jCh] ), &sing_exp2[jCh][iCh] ); /* exp( sing_exp2) */
#else
                singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], singularVectors2_e[jCh][iCh], Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, singularVectors2_e[jCh][currChannel] ), &singularVectors2_e[jCh][iCh] );
#endif
                move32();
            }
        }
@@ -1336,10 +1419,15 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
        {
            singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); /* sing_exp + sig_x_e */
            move32();
#ifndef FIX_1010_OPT_SINGLE_RESCALE
            sing_exp2[jCh][currChannel] = add( sing_exp[jCh], *sig_x_e );
#else
            singularVectors2_e[jCh][currChannel] = add( singularVectors2_e[jCh][currChannel], *sig_x_e );
#endif
            move16();
        }

#ifndef FIX_1010_OPT_SINGLE_RESCALE
        // rescaling block
        Word16 exp_max = *singularVectors_e;
        move16();
@@ -1361,6 +1449,7 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
        }
        *singularVectors_e = exp_max;
        move16();
#endif
    }

    // rescaling block
@@ -1382,7 +1471,11 @@ return;
static void biDiagonalReductionRight_fx(
    Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
    Word32 secDiag[MAX_OUTPUT_CHANNELS],           /* exp(secDiag_e) */
#ifndef FIX_1010_OPT_SINGLE_RESCALE
    Word16 *singularVectors_e,
#else
    Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS],
#endif
    Word16 *secDiag_e,
    const Word16 nChannelsL,  /* Q0 */
    const Word16 nChannelsC,  /* Q0 */
@@ -1395,15 +1488,17 @@ static void biDiagonalReductionRight_fx(
    Word16 iCh, jCh, idx;
    Word32 norm_x, r;
    Word16 norm_x_e, r_e;
    Word16 sing_exp[MAX_OUTPUT_CHANNELS];
    Word16 secDiag_exp[MAX_OUTPUT_CHANNELS];
    Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 };
    Word32 L_temp;
    Word16 L_temp_e;
#ifndef FIX_1010_OPT_SINGLE_RESCALE
    Word16 sing_exp[MAX_OUTPUT_CHANNELS];
    Word16 sing_exp2[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS] = { 0 };
    FOR( jCh = 0; jCh < MAX_OUTPUT_CHANNELS; jCh++ )
    {
        set16_fx( sing_exp2[jCh], *singularVectors_e, MAX_OUTPUT_CHANNELS );
    }
#endif
    set16_fx( secDiag_exp, *secDiag_e, MAX_OUTPUT_CHANNELS );

    /* Setting values to 0 */
@@ -1418,7 +1513,11 @@ static void biDiagonalReductionRight_fx(

        FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
        {
#ifndef FIX_1010_OPT_SINGLE_RESCALE
            ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[currChannel][jCh] ), *singularVectors_e, sig_x_e ); /* exp(sig_x_e) */
#else
            ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[currChannel][jCh] ), singularVectors2_e[currChannel][jCh], sig_x_e ); /* exp(sig_x_e) */
#endif
        }

        IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
@@ -1436,16 +1535,25 @@ static void biDiagonalReductionRight_fx(
            {
#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))  */
                move32();
                sing_exp[jCh] = add( sing_exp[jCh], sub( *singularVectors_e, *sig_x_e ) );
                move16();
                norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */
#else
                temp_e = norm_l( singularVectors[currChannel][jCh] );
                singularVectors[currChannel][jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
                sing_exp[jCh] = sub( invVal_e, temp_e );
                move16();
#endif
                move32();
                sing_exp[jCh] = add( sing_exp[jCh], sub( *singularVectors_e, *sig_x_e ) );

#ifndef FIX_1010_OPT_SINGLE_RESCALE
                sing_exp[jCh] = add( sub( invVal_e, temp_e ), sub( *singularVectors_e, *sig_x_e ) );
                move16();
                norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( sing_exp[jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */
#else
                singularVectors2_e[currChannel][jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], *sig_x_e ) );
                move16();
                norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( singularVectors2_e[currChannel][jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */
#endif
#endif
            }
            IF( GT_16( norm_x_e, 0 ) )
            {
@@ -1469,8 +1577,13 @@ static void biDiagonalReductionRight_fx(
                move32();
            }

#ifndef FIX_1010_OPT_SINGLE_RESCALE
            r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), sing_exp[idx], -norm_x, norm_x_e, &r_e );               /* exp(r_e) */
            singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[idx], -( *g ), 0, &sing_exp[idx] ); /* exp(sing_exp) */
#else
            r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e );                                      /* exp(r_e) */
            singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* exp(sing_exp) */
#endif
            move32();

#ifdef FIX_1010_OPT_DIV
@@ -1481,15 +1594,20 @@ static void biDiagonalReductionRight_fx(
            {
#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) */
                move32();
                secDiag_exp[jCh] = add( secDiag_exp[jCh], sub( sing_exp[jCh], r_e ) );
                move32();
#else
                temp_e = norm_l( singularVectors[currChannel][jCh] );
                secDiag[jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
                secDiag_exp[jCh] = sub( invVal_e, temp_e );
                move32();
#ifndef FIX_1010_OPT_SINGLE_RESCALE
                secDiag_exp[jCh] = add( sub( invVal_e, temp_e ), sub( sing_exp[jCh], r_e ) );
#else
                secDiag_exp[jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], r_e ) );
#endif
                move16();
#endif
                move32();
                secDiag_exp[jCh] = add( secDiag_exp[jCh], sub( sing_exp[jCh], r_e ) );
                move32();
            }

            FOR( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /*  nChannelsL */
@@ -1500,12 +1618,20 @@ static void biDiagonalReductionRight_fx(
                move16();
                FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
                {
#ifndef FIX_1010_OPT_SINGLE_RESCALE
                    norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( *singularVectors_e, sing_exp[jCh] ), &norm_x_e ); /* exp(norm_x_e) */
#else
                    norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( singularVectors2_e[iCh][jCh], singularVectors2_e[currChannel][jCh] ), &norm_x_e ); /* exp(norm_x_e) */
#endif
                }

                FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /*  nChannelsC */
                {
#ifndef FIX_1010_OPT_SINGLE_RESCALE
                    singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], *singularVectors_e, Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &sing_exp2[iCh][jCh] ); /* exp(sing_exp2) */
#else
                    singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */
#endif
                    move32();
                }
            }
@@ -1514,10 +1640,15 @@ static void biDiagonalReductionRight_fx(
            {
                singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], ( *sig_x ) ); /* exp(sing_exp + sig_x_e) */
                move32();
#ifndef FIX_1010_OPT_SINGLE_RESCALE
                sing_exp2[currChannel][jCh] = add( sing_exp[jCh], *sig_x_e );
#else
                singularVectors2_e[currChannel][jCh] = add( singularVectors2_e[currChannel][jCh], *sig_x_e );
#endif
                move16();
            }


            /*rescaling block*/
            Word16 exp_max = *secDiag_e;
            move16();
@@ -1530,8 +1661,10 @@ static void biDiagonalReductionRight_fx(
                secDiag[jCh] = L_shr_r( secDiag[jCh], sub( exp_max, secDiag_exp[jCh] ) ); /* exp(exp_max) */
                move32();
            }
            *secDiag_e = exp_max;
            move16();


#ifndef FIX_1010_OPT_SINGLE_RESCALE
            exp_max = *singularVectors_e;
            move16();
            FOR( iCh = 0; iCh < nChannelsL; iCh++ )
@@ -1552,6 +1685,7 @@ static void biDiagonalReductionRight_fx(
            }
            *singularVectors_e = exp_max;
            move16();
#endif
        }
    }