Commit 470a1b45 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

activate macro

parent 7dd58fee
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@
#define FIX_1944_CRASH_FOR_STEREO                            /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */
#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                              /* FhG: Fix bug in function to find maximum value in vector */

#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 */
+36 −4
Original line number Diff line number Diff line
@@ -1230,21 +1230,44 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
    exp = exp_vec[0];
    move16();
#else
    Word16 tmp, exp, scale;
    ind = 0;
    move16();
#endif

#if 0

        float vec_float[1024];
    for ( int ii = 0; ii < lvec_fx; ii++ )
            vec_float[ii] = vec_fx[ii] * pow( 2, exp_vec[ii] - 31 );

#endif


#ifdef FIX_1981_MAXIMUM_EXP_FX
    scale = sub( norm_s( vec_fx[ind] ), 1 );

    FOR( j = 1; j < lvec_fx; j++ )
    {
#ifdef FIX_1981_MAXIMUM_EXP_FX
        if ( LE_16( vec_fx[ind], shr_sat( vec_fx[j], sub( exp_vec[ind], exp_vec[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[j], scale);
            exp = sub( exp_vec[j], scale );
        }
    }
#else
    FOR( j = 1; j < lvec_fx; j++ )
    {
#if 0
        // insert assert to find critical bitstreams
        {
            static int calls = 0;
            calls++;
            Word16 tmp16, tmp16_1;
            Word32 tmp32, tmp32_1;
            tmp16 = tmp;
@@ -1252,8 +1275,14 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
            tmp16_1 = shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) );
            tmp32_1 = L_shr_sat( L_deposit_l( vec_fx[j] ), sub( exp, exp_vec[j] ) );

            assert( LT_16( tmp16, tmp16_1 ) == LT_32( tmp32, tmp32_1 ) );
            if ( ( LT_16( tmp16, tmp16_1 ) != LT_32( tmp32, tmp32_1 ) ) )
            {
                tmp16 = LT_16( tmp16, tmp16_1 );
                tmp32 = LT_32( tmp32, tmp32_1 );
                assert( tmp16 == tmp32 );
            }
        }
#endif

        IF( LT_16( tmp, shr_sat( vec_fx[j], sub( exp, exp_vec[j] ) ) ) )
        {
@@ -1264,8 +1293,11 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
            exp = exp_vec[j];
            move16();
        }
#endif
    }
#endif
#if 0 /*value out*/
    printf( "\n val= %15.15f", vec_fx[ind] * pow(2,exp_vec[ind] - 15) );
#endif

    return ind;
}