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

Fix for 3GPP issue 1007: Decoder crash for ISM 3 FER, Bandwidth Switching at 96kbps, 128 kbps

link: #1007
parent 4eaf9a37
Loading
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -2939,19 +2939,16 @@ void GenShapedSHBExcitation_ivas_fx(
    }
    Q_pow1 = shl( *Q_bwe_exc, 1 );

    test();
#if 1 // ADD_IVAS_TBE_CODE
    IF( EQ_16( flag_ACELP16k, 0 ) )
#else
    IF( ( LE_32( bitrate, ACELP_13k20 ) ) && ( GE_32( bitrate, ACELP_7k20 ) ) )
#endif
    IF( flag_ACELP16k == 0 )
    {
        /* varEnvShape = mean_fx(voice_factors, 4); */
        /* unroll the loop */
        L_tmp = L_mult( voice_factors[0], 8192 );
        L_tmp = L_mac( L_tmp, voice_factors[1], 8192 );
        L_tmp = L_mac( L_tmp, voice_factors[2], 8192 );
        varEnvShape = mac_r( L_tmp, voice_factors[3], 8192 ); /* varEnvShape in Q15 */
        varEnvShape = mac_r_sat( L_tmp, voice_factors[3], 8192 ); /* varEnvShape in Q15 */
        /* varEnvShape is the mean value of voice_factors (Q15)
           In any case, varEnvShape is not expected to exceed 32767, hence saturation is added */
    }
    ELSE /* 16k core */
    {
@@ -2961,7 +2958,9 @@ void GenShapedSHBExcitation_ivas_fx(
        L_tmp = L_mac( L_tmp, voice_factors[1], 6554 );
        L_tmp = L_mac( L_tmp, voice_factors[2], 6554 );
        L_tmp = L_mac( L_tmp, voice_factors[3], 6554 );
        varEnvShape = mac_r( L_tmp, voice_factors[4], 6554 ); /* varEnvShape in Q15 */
        varEnvShape = mac_r_sat( L_tmp, voice_factors[4], 6554 ); /* varEnvShape in Q15 */
        /* varEnvShape is the mean value of voice_factors (Q15)
           In any case, varEnvShape is not expected to exceed 32767, hence saturation is added */
    }

    IF( EQ_16( extl, FB_TBE ) )