Commit db431779 authored by multrus's avatar multrus
Browse files

Merge branch '1981-maximum_exp_fx-bug-biggest-value-in-vector-may-not-be-found' into 'main'

[non-BE] [allow regression] Resolve "maximum_exp_fx bug : biggest value in vector may not be found"

Closes #1981

See merge request !2186
parents 52762281 797ce973
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@
#define FIX_1970_SBA_CRASH                                   /* Dlb: Fix for issue 1970, SBA crash */

#define FIX_1978_SAT_MISSING_IN_GAIN_ENC                     /* VA:  Fix add saturation missing that lead to a crash in P800-10 */
#define FIX_1981_MAXIMUM_EXP_FX                              /* FhG: Fix bug in function to find maximum value in vector */
#define FIX_1981_MAXIMUM_EXP_FX_ZEROMANTISSA                 /* FhG: Fix bug in function to find maximum value in vector:zero-mantissa fix*/

#define FIX_1979_SAT_MISSING_IN_LSF_ENC                      /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */
#define FIX_1946_CRASH_JBM_PROCESSING                        /* FhG: Increased guard bits of DFT_fx */
+27 −0
Original line number Diff line number Diff line
@@ -2176,6 +2176,32 @@ Word16 maximum_exp_fx(
    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;
    ind = 0;
    move16();

    FOR( j = 1; j < lvec_fx; j++ )
    {
        Word16 scale = sub( exp_vec[j], exp_vec[ind] );
#ifdef FIX_1981_MAXIMUM_EXP_FX_ZEROMANTISSA
        test();
        if ( vec_fx[j] == 0 || vec_fx[ind] == 0 )
        {
            scale = 0;
            move16();
        }
#endif
        if ( L_mac0_sat( L_shl_sat( L_deposit_l( vec_fx[j] ), scale ), vec_fx[ind], -0x0001 ) > 0 )
        {
            ind = j;
            move16();
        }
    }
    return ind;
}
#else
{
    Word16 j, ind;
    Word16 tmp, exp;
@@ -2201,6 +2227,7 @@ Word16 maximum_exp_fx(

    return ind;
}
#endif


/*---------------------------------------------------------------------*