Commit b13f5d51 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

add new fix: cheaper

parent e043963a
Loading
Loading
Loading
Loading
+47 −9
Original line number Diff line number Diff line
@@ -1219,23 +1219,17 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
                       const Word16 *exp_vec, /* i  : exponents of input vector                      */
                       const Word16 lvec_fx   /* i  : length of input vector                         */
)
#ifdef FIX_1981_MAXIMUM_EXP_FX_
{
    Word16 j, ind;
    Word16 tmp, exp;
    ind = 0;
    move16();
#ifndef FIX_1981_MAXIMUM_EXP_FX
    tmp = vec_fx[0];
    move16();
    exp = exp_vec[0];
    move16();
#else
    Word16 scale;

    scale = sub( norm_s( vec_fx[ind] ), 1 );
    tmp = shl( vec_fx[ind], scale );
    exp = sub( exp_vec[ind], scale );
#endif

    FOR( j = 1; j < lvec_fx; j++ )
    {
@@ -1243,22 +1237,66 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
        {
            ind = j;
            move16();
#ifdef FIX_1981_MAXIMUM_EXP_FX
            scale = sub( norm_s( vec_fx[ind] ), 1 );
            tmp = shl( vec_fx[ind], scale );
            exp = sub( exp_vec[ind], scale );
        }
    }


    return ind;
}
#elif 1
{
    Word16 j, ind;
    Word16 tmp, exp;
    ind = 0;
    move16();
    tmp = vec_fx[0];
    move16();
    exp = exp_vec[0];
    move16();

    FOR( j = 1; j < lvec_fx; j++ )
    {
        if( LT_32( L_deposit_l(vec_fx[ind]), L_shr_sat( L_deposit_l(vec_fx[j]), sub( exp_vec[ind], exp_vec[j] ) ) ) )
        {
            ind = j;
            move16();
        }
    }


    return ind;
}
#else
{
    Word16 j, ind;
    Word16 tmp, exp;
    ind = 0;
    move16();
    tmp = vec_fx[0];
    move16();
    exp = exp_vec[0];
    move16();

    FOR( j = 1; j < lvec_fx; j++ )
    {
        IF( LT_16( tmp, shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) ) ) )
        {
            ind = j;
            move16();
            tmp = vec_fx[j];
            move16();
            exp = exp_vec[j];
            move16();
#endif
        }
    }


    return ind;
}
#endif

/*---------------------------------------------------------------------*
 * maximum_abs_16_fx()