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

Add normalization under FIX_1010_OPT_DIV again but without overwriting source...

Add normalization under FIX_1010_OPT_DIV again but without overwriting source data which format should not be changed.
parent 964c80d5
Loading
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -1252,7 +1252,7 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
    IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
    {
#ifdef FIX_1010_OPT_DIV
        Word16 invVal_e;
        Word16 invVal_e, temp_e;
        Word32 invVal = BASOP_Util_Inv32( maxWithSign_fx( *sig_x ), &invVal_e );
#endif
        norm_x = 0;
@@ -1267,9 +1267,10 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
            sing_exp[jCh] = add( sing_exp[jCh], sub( *singularVectors_e, *sig_x_e ) );
            move16();
#else
            singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
            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( invVal_e, sub( *singularVectors_e, *sig_x_e ) );
            sing_exp[jCh] = add( sub(invVal_e, temp_e), sub( *singularVectors_e, *sig_x_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) */
@@ -1438,8 +1439,7 @@ static void biDiagonalReductionRight_fx(
                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] );
                singularVectors[currChannel][jCh] = L_shl( singularVectors[currChannel][jCh], temp_e );
                singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
                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
@@ -1484,8 +1484,7 @@ static void biDiagonalReductionRight_fx(
                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[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 );
                move16();
#endif
@@ -1622,9 +1621,10 @@ 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 FIX_1010_OPT_DIV
                t_jj = BASOP_Util_Inv32( maxWithSign_fx( singularVectors_Left[nCh][nCh] ), &temp_exp );
                Word16 temp_e = norm_l(singularVectors_Left[nCh][nCh]);
                t_jj = BASOP_Util_Inv32( maxWithSign_fx( L_shl(singularVectors_Left[nCh][nCh], temp_e) ), &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] ) );
                t_jj_e = add( add(temp_exp, temp_e), sub( add( t_ii_e, norm_y_e ), sing_exp2[nCh][nCh] ) );
#else
                t_jj = BASOP_Util_Divide3232_Scale_cadence( Mpy_32_32( t_ii, norm_y ), maxWithSign_fx( singularVectors_Left[nCh][nCh] ), &temp_exp ); // t_ii_e+norm_y_e-*singularVectors_e,
                t_jj_e = add( temp_exp, sub( add( t_ii_e, norm_y_e ), sing_exp2[nCh][nCh] ) );