Commit 31560a87 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '846-crash-in-ivas_calc_tilt_bwe_fx' into 'main'

propsed fix to 846

See merge request !524
parents 7cade764 8c66d656
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@
#define NONE_BE_FIX_816_LFE_PLC_FLOAT                   /* DLB: issue 816: reduce required precision to float for LFE-PLC*/
#define FIX_844_Q_SYN_INIT                          /* VA : proposed fix to 844, initializing q_old_synth when switching to MDCT*/
#define FIX_839_FB_CONTENT_SOMETIME_MISSING     /* VA : Fix scaling error for FB TB BWE */
#define FIX_846_TILT_BWE                        /* VA : Proposed fix to 846, to solve saturation */
/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */
+16 −1
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 */
    ptr = sp;

    L_ener_tot = L_deposit_l( 1 );

#ifndef FIX_846_TILT_BWE
    /* Divide Frame Length by 32 */
    FOR( j = shr( N, 5 ); j > 0; j-- )
    {
@@ -781,6 +781,21 @@ Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 */

        L_ener_tot = L_add( L_ener_tot, L_ener );
    }
#else
    /* Divide Frame Length by 32 */
    Word64 W_ener;
    W_ener = Mpy_32_32( *ptr, *ptr );
    ptr++;
    FOR( j = 1; j < N; j++ )
    {
        /* With the shift by 4 and the L_mult0, no overflow possible for 32 samples */
        W_ener = W_mac_32_32( W_ener, *ptr, *ptr );
        ptr++;
    }
    L_ener_tot = W_round64_L( W_ener );
    L_ener_tot = L_max( L_ener_tot, 1 ); /* L_ener_tot is energy, it is always positive, but have to be > 0 for the following division */

#endif
    L_ener = L_abs( L_sub( sp[1], sp[0] ) );

    FOR( i = 2; i < N; i++ )