Commit 2f23d364 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

some more overflow ops replaced

parent addc3fc3
Loading
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -35,8 +35,10 @@ void AVQ_cod_fx( /* o: comfort noise gain factor
    Word16 ebits[NSV_MAX], e_ebits, f_ebits, e_tmp, f_tmp, tmp16, l_8;
    Word32 Lener, Ltmp, Lgain, x1[8];
    Word16 tot_est_bits, Q_in;
#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif
    Q_in = sub( Q_in_ref, 1 );
    move16();
@@ -53,7 +55,11 @@ void AVQ_cod_fx( /* o: comfort noise gain factor
            Lener = L_shl( 4, shl( Q_in, 1 ) ); /* to set ebits >= 0 */
            FOR( i = 0; i < 8; i++ )
            {
#ifdef ISSUE_1867_replace_overflow_libenc
                Lener = L_mac_sat( Lener, xri[l * 8 + i], xri[l * 8 + i] ); //??sat
#else
                Lener = L_mac_o( Lener, xri[l * 8 + i], xri[l * 8 + i], &Overflow );
#endif
            }
            /* estimated bit consumption when gain=1 */
            /* ebits[l] = 5.0 * FAC_LOG2 * (Word16)log10(ener * 0.5) */
+35 −4
Original line number Diff line number Diff line
@@ -36,10 +36,12 @@ Word16 bass_pf_enc_fx(
    Word32 cross_n_d, nrg_n;
    const Word16 *pFilt;
    Word32 ener2;
#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif


    IF( NE_16( l_frame, L_FRAME16k ) )
@@ -129,8 +131,8 @@ Word16 bass_pf_enc_fx(
            /* gain = tmp/nrg; */
            gain = BASOP_Util_Divide3232_Scale( tmp, nrg, &tmp16 );
            BASOP_SATURATE_WARNING_OFF_EVS;
#ifdef ISSUE_1796_replace_shl_o
            gain = shl_sat( gain, tmp16 ); /* Q15 */
#ifdef ISSUE_1867_replace_overflow_libenc
            gain = shl_sat( gain, tmp16 ); /* Q15 */  //??sat
#else
            gain = shl_o( gain, tmp16, &Overflow );          /* Q15 */
#endif
@@ -157,6 +159,16 @@ Word16 bass_pf_enc_fx(
                FOR( i = 0; i < lg; i++ )
                {
                    tmp32 = L_msu0( 0, gain, syn[i + i_subfr - T] );
#ifdef ISSUE_1867_replace_overflow_libenc
                    tmp32 = L_msu0_sat( tmp32, gain, syn[i + i_subfr + T] );   //??sat
                    tmp16 = mac_rsat( tmp32, gain, syn[i + i_subfr] ); /* Q0 */   //`??sat

                    lp_error = Mpy_32_16_1( lp_error, 29491 /*0.9f Q15*/ );
                    lp_error = L_mac_sat( lp_error, tmp16, 0x1000 ); /* Q13 */  //??sat

                    tmp16 = round_fx_sat( L_shl_sat( lp_error, s1 ) ); /* Q0+s1-3 */  //??sat
                    ener2 = L_mac0_sat( ener2, tmp16, tmp16 );                  /* Q0+(s1-3)*2 */   //??sat
#else
                    tmp32 = L_msu0_o( tmp32, gain, syn[i + i_subfr + T], &Overflow );
                    tmp16 = mac_ro( tmp32, gain, syn[i + i_subfr], &Overflow ); /* Q0 */

@@ -165,6 +177,7 @@ Word16 bass_pf_enc_fx(

                    tmp16 = round_fx_o( L_shl_o( lp_error, s1, &Overflow ), &Overflow ); /* Q0+s1-3 */
                    ener2 = L_mac0_o( ener2, tmp16, tmp16, &Overflow );                  /* Q0+(s1-3)*2 */
#endif
                }
            }

@@ -173,6 +186,15 @@ Word16 bass_pf_enc_fx(
                FOR( i = lg; i < l_subfr; i++ )
                {
                    tmp32 = L_mult0( gain, syn[i + i_subfr] );
#ifdef ISSUE_1867_replace_overflow_libenc
                    tmp32 = L_msu0_sat( tmp32, gain, syn[i + i_subfr - T] ); /* Q0 */   //??sat
                    tmp16 = round_fx_sat( tmp32 );  //??sat
                    lp_error = Mpy_32_16_1( lp_error, 29491 /*0.9f Q15*/ );
                    lp_error = L_mac_sat( lp_error, tmp16, 0x1000 ); /* Q13 */  //??sat

                    tmp16 = round_fx_sat( L_shl_sat( lp_error, s1 ) ); /* Q0+s1-3 */  //??sat
                    ener2 = L_mac0_sat( ener2, tmp16, tmp16 );                  /* Q0+(s1-3)*2 */ //??sat
#else
                    tmp32 = L_msu0_o( tmp32, gain, syn[i + i_subfr - T], &Overflow ); /* Q0 */
                    tmp16 = round_fx_o( tmp32, &Overflow );
                    lp_error = Mpy_32_16_1( lp_error, 29491 /*0.9f Q15*/ );
@@ -180,6 +202,7 @@ Word16 bass_pf_enc_fx(

                    tmp16 = round_fx_o( L_shl_o( lp_error, s1, &Overflow ), &Overflow ); /* Q0+s1-3 */
                    ener2 = L_mac0_o( ener2, tmp16, tmp16, &Overflow );                  /* Q0+(s1-3)*2 */
#endif
                }
            }

@@ -214,8 +237,8 @@ Word16 bass_pf_enc_fx(
                tmp32 = L_deposit_l( 1 );
            tmp16 = BASOP_Util_Divide3232_Scale( tmp, tmp32, &st );
            BASOP_SATURATE_WARNING_OFF_EVS;
#ifdef ISSUE_1796_replace_shl_o
            tmp16 = shl_sat( tmp16, sub( st, 2 ) ); /* Q15 */
#ifdef ISSUE_1867_replace_overflow_libenc
            tmp16 = shl_sat( tmp16, sub( st, 2 ) ); /* Q15 */   //??sat
#else
            tmp16 = shl_o( tmp16, sub( st, 2 ), &Overflow ); /* Q15 */
#endif
@@ -244,7 +267,11 @@ Word16 bass_pf_enc_fx(
                    tmp32 = L_mac( tmp32, tmp16, syn[i + i_subfr] );
                    noise_in[i] = round_fx( L_shl( tmp32, s2 ) ); /* Q0+s2 */

#ifdef ISSUE_1867_replace_overflow_libenc
                    error_in[i] = sub_sat( orig[i + i_subfr], syn[i + i_subfr] ); /*Q0*/   //??sat
#else
                    error_in[i] = sub_o( orig[i + i_subfr], syn[i + i_subfr], &Overflow ); /*Q0*/
#endif
                    move16();
                }
            }
@@ -258,7 +285,11 @@ Word16 bass_pf_enc_fx(
                    noise_in[i] = round_fx( L_shl( tmp32, s2 ) ); /* Q0+s2 */
                    move16();

#ifdef ISSUE_1867_replace_overflow_libenc
                    error_in[i] = sub_sat( orig[i + i_subfr], syn[i + i_subfr] ); /*Q0*/   //??sat
#else
                    error_in[i] = sub_o( orig[i + i_subfr], syn[i + i_subfr], &Overflow ); /*Q0*/
#endif
                    move16();
                }
            }