Commit 050eb9b5 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Scale singularVectors_Left_fx to preserve precision in SVD calculation.

parent 7c75ea90
Loading
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -866,12 +866,18 @@ static void HouseholderReduction_fx(
    Word16 singularVectors_Left_fx_e[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS];

#ifdef MERGE_REQUEST_1926_SPEEDUP_ivas_svd_dec_fx_NONBE

    Word16 sc = 0;
    sc = getScaleFactor32( singularVectors_Left_fx[0], nChannelsC );
    FOR( jCh = 1; jCh < nChannelsL; jCh++ )
    {
        sc = s_min( sc, getScaleFactor32( singularVectors_Left_fx[jCh], nChannelsC ) );
    }
    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
    {
        Scale_sig32( singularVectors_Left_fx[jCh], nChannelsC, sc );
        FOR( iCh = 0; iCh < nChannelsC; iCh++ )
        {
            singularVectors_Left_fx_e[jCh][iCh] = singularVectors_Left_e;
            singularVectors_Left_fx_e[jCh][iCh] = singularVectors_Left_e - sc;
            move16();
        }
    }
@@ -1003,7 +1009,7 @@ static void biDiagonalReductionLeft_fx(
        norm_x = W_shl_sat_l( temp, nrm );
        norm_x_e = sub( add( max_e, max_e ), nrm );

        IF( ( norm_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
        IF( norm_x ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
        {
            Word16 invVal_e;
            Word32 invVal;
@@ -1096,7 +1102,7 @@ static void biDiagonalReductionRight_fx(
            norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( singularVectors_e[currChannel][jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */
        }

        IF( ( norm_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
        IF( norm_x ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
        {
            Word16 invVal_e;
            Word32 invVal;