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

added faster method

parent b8a8f1cb
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -1230,6 +1230,11 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
    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++ )
    {
@@ -1243,7 +1248,7 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
        }
    }


    //printf( "\nind = %d", ind );
    return ind;
}
#elif 1
@@ -1251,17 +1256,29 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
    Word16 j, ind;
    ind = 0;
    move16();
#if 1
    static int cnt = 0;
    cnt++;
#endif


    FOR( j = 1; j < lvec_fx; j++ )
    {
#if 0
        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_shr_sat( L_mult0( vec_fx[j], 0x0001 ), sub( exp_vec[ind], exp_vec[j] ) ), vec_fx[ind], -0x0001 ) > 0 )
#endif
        {
            ind = j;
            move16();
        }
    }

   }

    //printf( "\n%d:ind = %d", cnt, ind );
    return ind;
}
#else
@@ -1288,7 +1305,7 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
        }
    }


    // printf( "\nind = %d", ind );
    return ind;
}
#endif