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

current best solution

parent ef6b6f41
Loading
Loading
Loading
Loading
+1 −49
Original line number Diff line number Diff line
@@ -1219,71 +1219,23 @@ 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();
    Word16 scale;

    scale = sub( norm_s( vec_fx[ind] ), 1 );
    tmp = shl( vec_fx[ind], scale );
    exp = sub( exp_vec[ind], scale );
#if 1
    static int cnt = 0;
    cnt++;
#endif


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

    // printf( "\nind = %d", ind );
    return ind;
}
#elif 1
#ifdef FIX_1981_MAXIMUM_EXP_FX
{
    Word16 j, ind;
    ind = 0;
    move16();
#if 1
    static int cnt = 0;
    cnt++;
#endif


    FOR( j = 1; j < lvec_fx; j++ )
    {
#if 0
        if ( ( vec_fx[j] == 0 && vec_fx[j - 1] != 0 && vec_fx[j + 1] != 0 && lvec_fx > j ) )
        {
            assert( 0 );
        }
#endif
#if 1
        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] ) ) ) )
#else
        /* if(vec[j] > vec[ind])                                                                                                    //means   */
        /* if( GT_32(    L_shr_sat( L_deposit_l( vec_fx[j])), sub( exp_vec[ind], exp_vec[j] )  , L_deposit_l( vec_fx[ind] )))   //is like */
        if ( L_mac0_sat( L_shl_sat( L_deposit_l( vec_fx[j] ), sub( exp_vec[j], exp_vec[ind] ) ), vec_fx[ind], -0x0001 ) > 0 )
#endif
        {
            ind = j;
            move16();
        }
    }

    // printf( "\n%d:ind = %d", cnt, ind );
    return ind;
}
#else