Commit 0e12e1b9 authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent 6e9b00db
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -422,9 +422,17 @@ Word16 E_UTIL_enhancer(
    L_tmp = L_msu0(L_tmp,tmp,code[1]);
    if (gain)
    {
#ifdef BASOP_NOGLOB
        L_tmp = L_shl_sat( L_tmp, gain );
#else
        L_tmp = L_shl( L_tmp, gain );
#endif
    }
#ifdef BASOP_NOGLOB
    exc2[0] = msu_r_sat( L_tmp, -32768, exc2[0] );
#else
    exc2[0] = msu_r( L_tmp, -32768, exc2[0] );
#endif
    move16();

    FOR (i=1; i<L_subfr-1; i++)
+6 −1
Original line number Diff line number Diff line
@@ -4337,8 +4337,13 @@ void prep_tbe_exc_fx(
        FOR ( i = 0; i < L_subfr* HIBND_ACB_L_FAC; i++ )
        {
            L_tmp = L_mult( gain_code16, tmp_code_fx[i] );   /* Q9 + Q_exc + 1*/
#ifdef BASOP_NOGLOB
            L_tmp = L_shl_sat( L_tmp, 5 );                                                         /* Q9 + Q_exc + Q6*/
            L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */
#else
            L_tmp = L_shl( L_tmp, 5 );                                                         /* Q9 + Q_exc + Q6*/
            L_tmp = L_mac( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */
#endif
#ifdef BASOP_NOGLOB
            L_tmp = L_shl_o( L_tmp, 1 , &Overflow); /*16+Q_exc */ /* saturation can occur here */
            bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o(L_tmp, &Overflow);  /*Q_exc */
+1 −1
Original line number Diff line number Diff line
@@ -379,7 +379,7 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision */
            Ltmp = L_shl(Ltmp, Q_new_p5);
            Ltmp = L_mac(Ltmp, gain_pit, exc[i+i_subfr]);
#ifdef BASOP_NOGLOB
            exc2[i] = round_fx(L_shl_o(Ltmp, 1, &Overflow));
            exc2[i] = round_fx_sat(L_shl_o(Ltmp, 1, &Overflow));
#else
            BASOP_SATURATE_WARNING_OFF_EVS
            exc2[i] = round_fx(L_shl(Ltmp, 1));
+5 −1
Original line number Diff line number Diff line
@@ -1244,7 +1244,11 @@ void core_acelp_tcx20_switching_fx(
        test();test();test();
        if ((LT_16(snr_acelp, snr_tcx))&&
                (GT_16(snr_acelp, sub(snr_tcx, 512/*2.0f Q8*/)) ) &&
#ifdef BASOP_NOGLOB
             ( GT_16( add_sat( st->prevTempFlatness_fx, currFlatness ), 416 /*3.25f Q7*/ ) ) &&
#else
             ( GT_16( add( st->prevTempFlatness_fx, currFlatness ), 416 /*3.25f Q7*/ ) ) &&
#endif
                (GE_16(st->acelpFramesCount, 6) ))
        {
            dsnr = 512/*2.0f Q8*/;
+6 −1
Original line number Diff line number Diff line
@@ -416,8 +416,13 @@ void enc_pit_exc_fx(
            {

                Ltmp = L_mult(exc[i + i_subfr], gain_pit);
#ifdef BASOP_NOGLOB
                Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here */
                exc[i + i_subfr] = round_fx_sat(Ltmp);
#else
                Ltmp = L_shl( Ltmp, 1 ); /* saturation can occur here */
                exc[i + i_subfr] = round_fx(Ltmp);
#endif
            }
        }