Commit 0786a396 authored by Manuel Jander's avatar Manuel Jander
Browse files

Fix LTV crashes that did occur due to saturation assert().

parent 273c21f4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1472,7 +1472,6 @@ void Copy_Scale_sig_32_16_nosat(
    Word16 i;
    Word16 tmp;

    assert( exp0 <= 31 && exp0 >= -31 );
    tmp = add( 16, exp0 );
    IF( tmp != 0 )
    {
+4 −0
Original line number Diff line number Diff line
@@ -894,7 +894,11 @@ void CNG_enc_fx(
        L_tmp = L_add_sat( L_tmp, L_tmp );                    /* 2*Q_new+1 */
        L_tmp = Mult_32_16( L_tmp, 128 );                     /* 2*Q_new+1 */
        tmp1 = add( add( Q_new, Q_new ), 1 );
#ifdef NONBE_FIX_ISSUE_2206
        env[i] = L_shr_sat( L_tmp, sub( tmp1, 6 ) );
#else
        env[i] = L_shr( L_tmp, sub( tmp1, 6 ) );
#endif
        move32(); /* Q6 */
        ptR++;
        ptI--;
+5 −0
Original line number Diff line number Diff line
@@ -34,7 +34,12 @@ static void rem_offset(
    tmp = round_fx_sat( loffset );
    FOR( i = 0; i < l_subfr; i++ )
    {
#ifdef NONBE_FIX_ISSUE_2206
        /* The need of sub_sat() here should be revisited. */
        out[i] = sub_sat( in[i], tmp );
#else
        out[i] = sub( in[i], tmp );
#endif
        move16();
    }

+2 −1
Original line number Diff line number Diff line
@@ -1277,7 +1277,8 @@ void ivas_compute_core_buffers_fx(
            tmp_fx = st->mem_preemph16k_fx;
            move16();
#ifdef NONBE_FIX_ISSUE_2206
            st->mem_preemph16k_fx = shl( st->mem_preemph16k_fx, sub( -1, Q_old_inp_16k ) );
            /* Saturation can occur. To avoid that the format of st->mem_preemph16k_fx needs to become variable. */
            st->mem_preemph16k_fx = shl_sat( st->mem_preemph16k_fx, sub( -1, Q_old_inp_16k ) );
            move16();
#endif
            preemph_copy_32fx2( new_inp_16k_fx + L_FRAME16k, sig_out + L_FRAME16k, PREEMPH_FAC_16k, L_FILT16k, &tmp_fx ); /* Q(-1) */
+5 −1
Original line number Diff line number Diff line
@@ -2656,7 +2656,11 @@ static Word16 SWB_BWE_encoding_fx(
                    expn = sub( 30, add( expn, q_SWB_fenv[n_band] ) );
                }
                L_tmp = Mpy_32_16( expn, tmp, 24660 ); /* Q14 */ /*10log10(2) in Q13 */
#ifdef NONBE_FIX_ISSUE_2206
                SWB_fenv_fx[n_band] = round_fx( L_shl_sat( L_tmp, 10 ) ); /* Q8 */
#else
                SWB_fenv_fx[n_band] = round_fx( L_shl( L_tmp, 10 ) ); /* Q8 */
#endif
                move16();
            }
            ELSE
Loading