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

LTV crash fixes

parent 4e5c5a18
Loading
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -171,6 +171,44 @@ void Residu3_fx(
#endif
    }
}
#ifdef IVAS_FLOAT_FIXED
void Residu3_ivas_fx(
    const Word16 a[], /* i :  prediction coefficients                 Q12 */
    const Word16 x[], /* i :  input signal (usually speech)           Qx  */
                      /*      (note that values x[-M..-1] are needed)     */
    Word16 y[],       /* o :  output signal (usually residual)        Qx  */
    const Word16 lg,  /* i :  vector size                             Q0  */
    const Word16 shift )
{
    Word16 i, j;
    Word64 s64;
    Word32 s32;
    Word16 q;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
    q = add( norm_s( a[0] ), 1 );
    if ( shift != 0 )
        q = add( q, shift );
    FOR( i = 0; i < lg; i++ )
    {
        s64 = 0;
        move64();
        FOR( j = 1; j <= M; j++ )
        {
            s64 = W_mac_16_16( s64, x[i - j], a[j] );
        }
        s32 = W_shl_sat_l( s64, q );
#ifdef BASOP_NOGLOB
        y[i] = round_fx_o( s32, &Overflow );
#else /* BASOP_NOGLOB */
        y[i] = round_fx( s32 );
#endif
        move32();
    }
}
#endif
/*==========================================================================*/
/* FUNCTION      : 	void calc_residu()									    */
/*--------------------------------------------------------------------------*/
+10 −1
Original line number Diff line number Diff line
@@ -1150,7 +1150,16 @@ static void IGF_CalculateEnvelope_ivas_fx(
                        hPrivateData->sfb_tb_e[sfb] = BASOP_Util_Add_MantExp( tmp_tb, tmp_tb_e, x1, x1_e, &hPrivateData->SFM_tb_fx[sfb] ); // hPrivateData->sfb_sb_e[sfb]
                        hPrivateData->SFM_tb_fx[sfb] = extract_l( L_min( L_shl( 22118 /*2.7f Q13*/, sub( 2, hPrivateData->sfb_tb_e[sfb] ) ), hPrivateData->SFM_tb_fx[sfb] ) );
                        hPrivateData->sfb_sb_e[sfb] = BASOP_Util_Add_MantExp( tmp_sb, tmp_sb_e, x2, x2_e, &hPrivateData->SFM_sb_fx[sfb] ); // hPrivateData->sfb_tb_e[sfb]
                        IF( LT_16( hPrivateData->sfb_sb_e[sfb], 2 ) )
                        {
                            hPrivateData->SFM_sb_fx[sfb] = extract_l( L_min( 22118 /*2.7f Q13*/, L_shr( hPrivateData->SFM_sb_fx[sfb], sub( 2, hPrivateData->sfb_sb_e[sfb] ) ) ) );
                            hPrivateData->sfb_sb_e[sfb] = 2;
                            move16();
                        }
                        ELSE
                        {
                            hPrivateData->SFM_sb_fx[sfb] = extract_l( L_min( L_shl( 22118 /*2.7f Q13*/, sub( 2, hPrivateData->sfb_sb_e[sfb] ) ), hPrivateData->SFM_sb_fx[sfb] ) );
                        }
                        move16();
                        move16();
                        move16();
+1 −1
Original line number Diff line number Diff line
@@ -2488,7 +2488,7 @@ void tcx_encoder_memory_update_ivas_fx(
    IF( st->tcxonly == 0 )
    {
        /* Update weighted synthesis */
        Residu3_fx( Ai + imult1616( sub( st->nb_subfr, 1 ), ( M + 1 ) ), synth + sub( L_frame_glob, 1 ), &tmp, 1, 0 );
        Residu3_ivas_fx( Ai + imult1616( sub( st->nb_subfr, 1 ), ( M + 1 ) ), synth + sub( L_frame_glob, 1 ), &tmp, 1, 0 );
        LPDmem->mem_w0 = sub( wsig[sub( L_frame_glob, 1 )], tmp );
        move16();
    }