Commit 5479c69f authored by Nishant S Kulgod's avatar Nishant S Kulgod
Browse files

some saturations + fix in avq_enc

parent 02e7aab0
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -966,7 +966,7 @@ ivas_error acelp_core_enc(
        Word16 Q_exc2 = add( Q_new, 1 );
#ifdef IVAS_FLOAT_FIXED_CONVERSIONS
        Word16 shift;
        shift = -4;
        shift = -2;
        move16();
#endif
        IF( tdm_low_rate_mode ) /* tdm stereo low rate mode */
+6 −1
Original line number Diff line number Diff line
@@ -814,7 +814,12 @@ void AVQ_encmux_ivas_fx(
    IF( avq_bit_sFlag > 0 && bits > 8 )
    {
        // PMT("code not validated yet")
        bitsMod = s_and( bits, 4 /*bits%5*/ );
        //bitsMod = bits%5;
        bitsMod = bits;
        WHILE(GE_16(bitsMod, 5)) {
            bitsMod = sub(bitsMod, 5);
        }
        assert(bitsMod == bits % 5);
        i = svOrder[Nsvm1];
        move16();
        IF( NE_16( i, Nsvm1 ) )
+2 −2
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ static void E_ACELP_1pulse_search( UWord8 tracks[2],
    move16();
    sqk[0] = -1;
    move16();
    if ( mac_r( alp0, cor_x[shr( tracks[0], 2 )], _1_ ) < 0 )
    if ( mac_r_sat( alp0, cor_x[shr( tracks[0], 2 )], _1_ ) < 0 )
    {
        sqk[0] = 1;
        move16();
@@ -382,7 +382,7 @@ static void E_ACELP_1pulse_search( UWord8 tracks[2],
            ps1 = add( ps0, dn[x] );

            /*alp1 = alp0 + cor_x[x>>2];                     SHIFT(1);ADD(1);*/
            alp1 = mac_r( alp0, cor_x[shr( x, 2 )], _1_ ); /*Q6*/
            alp1 = mac_r_sat( alp0, cor_x[shr( x, 2 )], _1_ ); /*Q6*/
            alpk[1 - ik] = alp1;
            move16();

+7 −1
Original line number Diff line number Diff line
@@ -463,21 +463,27 @@ void encod_unvoiced_ivas_fx(
                {
                    /* code in Q9, gain_pit in Q14; exc Q_new */
                    Ltmp = Mpy_32_16_1( gain_code2, code2[i] );
#ifdef BASOP_NOGLOB
                    Ltmp = L_shl_sat(Ltmp, Q_new_p5);
                    Ltmp = L_mac_sat(Ltmp, gain_pit_fx, exc_fx[i + i_subfr]);
#else
                    Ltmp = L_shl( Ltmp, Q_new_p5 );
                    Ltmp = L_mac( Ltmp, gain_pit_fx, exc_fx[i + i_subfr] );
#endif
#if 0
                    BASOP_SATURATE_WARNING_OFF_EVS
                    exc2[i] = round_fx(L_shl(Ltmp, 1));
                    BASOP_SATURATE_WARNING_ON_EVS
#endif
                    Ltmp2 = Mpy_32_16_1( gain_code_vect[j], code_fx[i] );
                    Ltmp2 = L_shl( Ltmp2, Q_new_p5 );
#ifdef BASOP_NOGLOB
                    Ltmp2 = L_shl_sat(Ltmp2, Q_new_p5);
                    Ltmp = L_add_sat(Ltmp, Ltmp2);
                    Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here */
                    exc_fx[i + i_subfr] = round_fx_sat( Ltmp );
#else
                    BASOP_SATURATE_WARNING_OFF_EVS
                    Ltmp2 = L_shl( Ltmp2, Q_new_p5 );
                    Ltmp = L_add( Ltmp, Ltmp2 );
                    Ltmp = L_shl( Ltmp, 1 ); /* saturation can occur here */
                    BASOP_SATURATE_WARNING_ON_EVS