Commit 23502c78 authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent 67554765
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -276,8 +276,11 @@ static Word16 re8_identify_absolute_leader_fx( /* o : integer indicating if y i
    {
        Ls = L_mac( Ls, y[i], y[i]);
    }
#ifdef BASOP_NOGLOB
    s = extract_h( L_shl_sat( Ls, 16 - ( 3 + 1 ) ) ); /* s can saturate here */
#else
    s = extract_h( L_shl( Ls, 16 - ( 3 + 1 ) ) ); /* s can saturate here */

#endif
    /*-----------------------------------------------------------------------*
     * compute the index 0 <= ka <= NB_LEADER+1 which identifies an absolute leader of Q0, Q2, Q3 or Q4
     *
+7 −2
Original line number Diff line number Diff line
@@ -148,11 +148,12 @@ void transf_cdbk_enc_fx(
    {
        /*fcorr += fx_tran[i]*(float)ix_norm[i];*/
        /*fener += (float)ix_norm[i]*(float)ix_norm[i];*/
        stmp = shl(x_norm[i],Q_AVQ_OUT );
#ifdef BASOP_NOGLOB
        stmp = shl_sat( x_norm[i], Q_AVQ_OUT );
        L_corr = L_mac_sat( L_corr, x_tran[i], stmp );
        L_ener = L_mac_sat(L_ener,  stmp, stmp);
#else
        stmp = shl( x_norm[i], Q_AVQ_OUT );
        L_corr = L_mac( L_corr, x_tran[i], stmp );
        L_ener = L_mac(L_ener,  stmp, stmp);
#endif
@@ -185,7 +186,11 @@ void transf_cdbk_enc_fx(
    {
        Ltmp1 = L_max(gain_code,1);
        e_den = norm_l(Ltmp1);
#ifdef BASOP_NOGLOB
        m_den = extract_h( L_shl_sat( Ltmp1, e_den ) );
#else
        m_den = extract_h( L_shl( Ltmp1, e_den ) );
#endif
        /* ensure m_corr < m_den */
        test();
        IF( m_corr>0 && m_den >0)
+5 −1
Original line number Diff line number Diff line
@@ -767,7 +767,11 @@ void gain_enc_SQ_fx(
    L_div = Mult_32_16(L_frac_num,tmp); /*Q(30-exp)*/
    exp_div = sub(exp_num,exp_den);

#ifdef BASOP_NOGLOB
    *gain_code = L_shl_sat( L_div, s_max( -31, sub( add( exp, exp_div ), 14 ) ) );
#else
    *gain_code = L_shl( L_div, s_max( -31, sub( add( exp, exp_div ), 14 ) ) );
#endif
    move32();/*Q16*/

    *gain_pit = s_max(G_PITCH_MIN_Q14,s_min(*gain_pit,G_PITCH_MAX_Q14));
+5 −1
Original line number Diff line number Diff line
@@ -587,7 +587,11 @@ Word16 gain_enc_uv_fx( /* o : quantization pitch index
    }


#ifdef BASOP_NOGLOB
    *gain_code = L_shl_sat( Mpy_32_16_1( *past_gcode, *gain_inov ), 3 );
#else
    *gain_code = L_shl( Mpy_32_16_1( *past_gcode, *gain_inov ), 3 );
#endif
    move32();

    *gain_pit = 0;
+28 −7
Original line number Diff line number Diff line
@@ -2404,11 +2404,17 @@ static void EstimateSHBGainShape_fx(
                FOR( k = 0; k < length; k++ )
                {
                    sig = mult_r( oriSHB[j + k], subwin[k + 1] );   /* Q_oriSHB */
#ifdef BASOP_NOGLOB
                    oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2* Q_oriSHB */
#else
                    oriNrg = L_mac0( oriNrg, sig, sig ); /* 2* Q_oriSHB */

#endif
                    sig = mult_r( synSHB[j + k], subwin[k + 1] );   /* Q_synSHB */
#ifdef BASOP_NOGLOB
                    synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2* Q_synSHB */
#else
                    synNrg = L_mac0( synNrg, sig, sig ); /* 2* Q_synSHB */

#endif
                }
            }
            IF( i == NUM_SHB_SUBFR / 2 - 1 )
@@ -2417,10 +2423,18 @@ static void EstimateSHBGainShape_fx(
                FOR( ; k < length_tmp; k++ )
                {
                    sig = mult_r( oriSHB[j + k], subwin[3 * length - 2 * k - 2] );  /* Q_oriSHB */
#ifdef BASOP_NOGLOB
                    oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2* Q_oriSHB */
#else
                    oriNrg = L_mac0( oriNrg, sig, sig ); /* 2* Q_oriSHB */
#endif

                    sig = mult_r( synSHB[j + k], subwin[3 * length - 2 * k - 2] );  /* Q_synSHB */
#ifdef BASOP_NOGLOB
                    synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2* Q_synSHB */
#else
                    synNrg = L_mac0( synNrg, sig, sig ); /* 2* Q_synSHB */
#endif
                }
            }
            ELSE
@@ -2428,10 +2442,17 @@ static void EstimateSHBGainShape_fx(
                FOR(; k < length2; k++ )
                {
                    sig = mult_r( oriSHB[j + k], subwin[2 * length - k - 1] ); /* Q_oriSHB */
#ifdef BASOP_NOGLOB
                    oriNrg = L_mac0_sat( oriNrg, sig, sig ); /* 2* Q_oriSHB */
#else
                    oriNrg = L_mac0( oriNrg, sig, sig ); /* 2* Q_oriSHB */

#endif
                    sig = mult_r( synSHB[j + k], subwin[2 * length - k - 1] ); /* Q_synSHB */
#ifdef BASOP_NOGLOB
                    synNrg = L_mac0_sat( synNrg, sig, sig ); /* 2* Q_synSHB */
#else
                    synNrg = L_mac0( synNrg, sig, sig ); /* 2* Q_synSHB */
#endif
                }
            }