Commit edd28a94 authored by Manuel Jander's avatar Manuel Jander
Browse files

Fix crash because of saturation of hBWE_TD->old_speech_shb_q in...

Fix crash because of saturation of hBWE_TD->old_speech_shb_q in swb_tbe_enc_fx.c. Use Q value which fits both hBWE_TD->old_speech_shb_fx and shb_speech_fx instead, no change outside of that scope.
parent 99207ef1
Loading
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -1564,15 +1564,21 @@ void swb_tbe_enc_fx(
    }

#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT
    Word16 Q_shb2;

    Q_shb2 = s_min( Q_shb, hBWE_TD->old_speech_shb_q );
#ifndef NONBE_FIX_ISSUE_2206_DO_NOT_FLUSH_TO_ZERO
    Copy_Scale_sig_nosat( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, delay, sub( Q_shb, hBWE_TD->old_speech_shb_q ) );
    Copy_Scale_sig_nosat( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, delay, sub( Q_shb2, hBWE_TD->old_speech_shb_q ) );
#else
    Copy_Scale_sig_nosat( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, delay, s_max( -15, sub( Q_shb, hBWE_TD->old_speech_shb_q ) ) );
    Copy_Scale_sig_nosat( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, delay, s_max( -15, sub( Q_shb2, hBWE_TD->old_speech_shb_q ) ) );
#endif
    Copy( shb_speech_fx, shb_new_speech_fx, L_FRAME16k );
    Copy( shb_old_speech_fx + L_FRAME16k, hBWE_TD->old_speech_shb_fx, delay );
    Copy_Scale_sig_nosat( shb_speech_fx, shb_new_speech_fx, L_FRAME16k, sub( Q_shb2, Q_shb ) );
    // Copy( shb_old_speech_fx + L_FRAME16k, hBWE_TD->old_speech_shb_fx, delay );
    Copy( shb_speech_fx + L_FRAME16k - ( shb_new_speech_fx - shb_old_speech_fx ), hBWE_TD->old_speech_shb_fx, delay );
    hBWE_TD->old_speech_shb_q = Q_shb;
    move16();
    Q_shb = Q_shb2;
    move16();
#else
    Copy( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, delay );
    Copy( shb_speech_fx, shb_new_speech_fx, L_FRAME16k );