Commit c7d050df authored by vaillancour's avatar vaillancour
Browse files

fixes more saturations

parent 92b403d4
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -442,11 +442,18 @@ Word16 DTFS_alignment_full_fx(
    /* Calculating the expected alignment shift */
    Eshift = mult_r(ph_offset_fx, shl(X2_DTFS_fx.lag_fx, 7));      /* confirmed I<2 by smv12.org, Q7 */
    find_rem((Word16)L_FRAME, shr(add(X2_DTFS_fx.lag_fx, X1_DTFS_fx.lag_fx), 1), &temp);
#ifdef BASOP_NOGLOB
    temp = add_sat( shl( temp, 7 ), Eshift ); /*  Q7 */
#else
    temp = add( shl( temp, 7 ), Eshift ); /*  Q7 */

#endif
    IF (temp<0)
    {
#ifdef BASOP_NOGLOB
        temp = add_sat( temp, shl_sat( X1_DTFS_fx.lag_fx, 7 ) ); /*  Q7 */
#else
        temp = add( temp, shl( X1_DTFS_fx.lag_fx, 7 ) ); /*  Q7 */
#endif
    }
    find_rem(temp, shl(X1_DTFS_fx.lag_fx, 7), &Eshift);                   /*  Q7 */
    Eshift=shl(shr(Eshift,7),1); /* Q1 but integer */
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ void hf_cod_fx(
    L_tmp = L_mult(ener_hf_fx, HF_calc_gain_fx); /*30-q1+q2 */
    q2 = sub(q1, q2); /*30-q2 */
#ifdef BASOP_NOGLOB
    HF_calc_gain_fx = round_fx_o(Isqrt(L_shl(L_tmp, sub(q2, 20))), &Overflow); /*Q10  */
    HF_calc_gain_fx = round_fx_o(Isqrt(L_shl_sat(L_tmp, sub(q2, 20))), &Overflow); /*Q10  */
#else /* BASOP_NOGLOB */
    HF_calc_gain_fx = round_fx(Isqrt(L_shl(L_tmp, sub(q2, 20)))); /*Q10  */
#endif
+5 −1
Original line number Diff line number Diff line
@@ -253,7 +253,11 @@ static void IGF_CalculateEnvelope(const IGF_ENC_INSTANCE_HANDLE hInstanc
                    zeroNrg              = 1;
                    move16();
                }
#ifdef BASOP_NOGLOB
                BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyR[sfb] ),
#else
                BASOP_Util_Divide_MantExp( round_fx( sfbEnergyR[sfb] ),
#endif
                sfbEnergyR_exp[sfb],
                width,
                15,
+2 −1
Original line number Diff line number Diff line
@@ -161,11 +161,12 @@ void set_impulse_fx(
#ifdef BASOP_NOGLOB
                Lrr = L_mac_o(Lrr, gh_fx[0], gh_fx[0], &Overflow);
                Ldd = L_mac_o(Ldd, gh_fx[0], xn_fx[0], &Overflow);
                dd_fx[i] = round_fx_sat( Ldd );
#else /* BASOP_NOGLOB */
                Lrr = L_mac(Lrr, gh_fx[0], gh_fx[0]);
                Ldd = L_mac(Ldd, gh_fx[0], xn_fx[0]);
#endif
                dd_fx[i] = round_fx( Ldd );
#endif
                rr_fx[i] = L_max(Lrr, 1);
                move32();
                /* move rr and dd into rr[i] and dd[i] */
+14 −1
Original line number Diff line number Diff line
@@ -2385,18 +2385,31 @@ static void EstimateSHBGainShape_fx(
                FOR( k = 0; k < length / 2; k++ )
                {
                    sig = mult_r( oriSHB[j + k], subwin[2 * k + 2] ); /* Q_oriSHB */
#ifdef BASOP_NOGLOB
                    oriNrg = L_mac0_sat( oriNrg, sig, sig );              /* 2* Q_oriSHB */
                    sig = mult_r( synSHB[j + k], subwin[2 * k + 2] ); /* Q_synSHB */
                    synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2* Q_synSHB */
#else
                    oriNrg = L_mac0( oriNrg, sig, sig );              /* 2* Q_oriSHB */
                    sig = mult_r( synSHB[j + k], subwin[2 * k + 2] ); /* Q_synSHB */
                    synNrg = L_mac0( synNrg, sig, sig ); /* 2* Q_synSHB */
#endif
                }
                FOR( k = length / 2; k < length; k++ )
                {
                    sig = oriSHB[j + k];
                    move16();
#ifdef BASOP_NOGLOB
                    oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2* Q_oriSHB */
                    sig = synSHB[j + k];
                    move16();
                    synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2* Q_synSHB */
#else
                    oriNrg = L_mac0( oriNrg, sig, sig ); /* 2* Q_oriSHB */
                    sig = synSHB[j + k];
                    move16();
                    synNrg = L_mac0( synNrg, sig, sig ); /* 2* Q_synSHB */
#endif
                }
            }
            ELSE
Loading