Commit c940b168 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for LTV crash occuring in ivas_swb_tbe_dec_fx

parent 8a17c01d
Loading
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -1972,8 +1972,11 @@ void ivas_swb_tbe_dec_fx(
#endif
        }
    }
#ifdef BASOP_NOGLOB                                                                            /* Saturation fix taken from EVS*/
    ener_fx = s_max( 1, round_fx_sat( L_shl_sat( L_ener, sub( 18, shl( Q_bwe_exc, 1 ) ) ) ) ); /* Q2: 2*Q_bwe_exc+18-2*Q_bwe_exc-16 */
#else
    ener_fx = s_max( 1, round_fx( L_shl( L_ener, sub( 18, shl( Q_bwe_exc, 1 ) ) ) ) );                                                /* Q2: 2*Q_bwe_exc+18-2*Q_bwe_exc-16 */

#endif
    /* WB/SWB bandwidth switching */
    IF( st->bws_cnt > 0 )
    {
@@ -2653,7 +2656,11 @@ void ivas_swb_tbe_dec_fx(
        tmp = div_s( 16384, tmp );
        L_tmp = L_deposit_h( tmp );
        L_tmp = Isqrt_lc( L_tmp, &exp );
#ifdef BASOP_NOGLOB                                                                /* Saturation fix taken from EVS*/
        st->prev_ener_shb_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /* Q1 */
#else
        st->prev_ener_shb_fx = round_fx( L_shl( L_tmp, sub( exp, 14 ) ) ); /* Q1 */
#endif
        move16();
    }

@@ -2671,7 +2678,11 @@ void ivas_swb_tbe_dec_fx(
            tmp = div_s( 16384, tmp );
            L_tmp = L_deposit_h( tmp );
            L_tmp = Isqrt_lc( L_tmp, &exp );
#ifdef BASOP_NOGLOB                                                   /* Saturation fix taken from EVS*/
            tmp = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /* Q1 */
#else
            tmp = round_fx( L_shl( L_tmp, sub( exp, 14 ) ) );              /* Q1 */
#endif
        }
        set16_fx( st->prev_SWB_fenv_fx, tmp, SWB_FENV ); /* Q1 */
    }