Commit ee49bab8 authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent 23502c78
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -381,9 +381,15 @@ void enc_pit_exc_fx(
        ELSE
        {
            Ltmp = L_mult(xn[L_subfr - 1], 16384);
#ifdef BASOP_NOGLOB
            Ltmp = L_msu_sat( Ltmp, y1[L_subfr - 1], gain_pit );
            Ltmp = L_shl_sat(Ltmp, sub(1, shift));
            hLPDmem->mem_w0 = round_fx_sat(Ltmp);     /*Q_new-1         */
#else
            Ltmp = L_msu( Ltmp, y1[L_subfr - 1], gain_pit );
            Ltmp = L_shl(Ltmp, sub(1, shift));
            hLPDmem->mem_w0 = round_fx(Ltmp);     /*Q_new-1         */
#endif
        }

        /*-----------------------------------------------------------------*
+5 −1
Original line number Diff line number Diff line
@@ -2066,7 +2066,11 @@ static Word16 SWB_BWE_encoding_fx(
                L_tmp = L_deposit_h(tmp);
                L_tmp = Isqrt_lc(L_tmp, &exp); /*Q(31-exp) */

#ifdef BASOP_NOGLOB
                SWB_tenv_fx[n_band] = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 12 ) ) ); /*Q3           */
#else
                SWB_tenv_fx[n_band] = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /*Q3           */
#endif
            }
        }

+5 −1
Original line number Diff line number Diff line
@@ -547,7 +547,11 @@ void swb_bwe_enc_hr_fx(
            L_temp = Calc_Energy_Autoscaled(ptr16, t_audio_fx_exp, WIDTH_NONTRANS_FREQ_COEF, &temp2);
            ptr16 += WIDTH_NONTRANS_FREQ_COEF;
            L_temp = Sqrt_Ratio32(L_temp, temp2, WIDTH_NONTRANS_FREQ_COEF, /*WIDTH_TRANS_FREQ_COEF is in Q0*/0, &temp2);
#ifdef BASOP_NOGLOB
            en_band_fx[i] = round_fx_sat( L_shr_sat( L_temp, sub( 15 - 9, temp2 ) ) ); /* Put in Q9 */
#else
            en_band_fx[i] = round_fx( L_shr( L_temp, sub( 15 - 9, temp2 ) ) ); /* Put in Q9 */
#endif
        }

        /* Q energy per band */
+7 −1
Original line number Diff line number Diff line
@@ -296,9 +296,15 @@ static void tcx_ltp_find_gain( Word16 *speech, Word16 *pred_speech, Word16 L_fra

    FOR (i = 0; i < L_frame; i++)
    {
#ifdef BASOP_NOGLOB
        tmp = shl_sat( pred_speech[i], s2 );
        corr = L_mac0_sat(corr, shl(speech[i], s1), tmp);
        ener = L_mac0_sat(ener, tmp, tmp);
#else
        tmp = shl( pred_speech[i], s2 );
        corr = L_mac0(corr, shl(speech[i], s1), tmp);
        ener = L_mac0(ener, tmp, tmp);
#endif
    }

    s1 = sub(1, add(s1, s2));
+5 −2
Original line number Diff line number Diff line
@@ -1651,8 +1651,11 @@ Word16 tcx_res_Q_gain_fx(
    }

    /* bring sqGain to same exponent */
#ifdef BASOP_NOGLOB
    sqGain = shr_sat( sqGain, sub( gain_reQ_e, sqGain_e ) );
#else
    sqGain = shr( sqGain, sub( gain_reQ_e, sqGain_e ) );

#endif
    FOR (bits=0; bits < TCX_RES_Q_BITS_GAIN; bits++)
    {
        IF (LT_16(sqGain, gain_reQ))
Loading