Commit 3c41678f authored by Fabian Bauer's avatar Fabian Bauer
Browse files

replaced som more overflow ops

parent a43216ec
Loading
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line
@@ -47,9 +47,11 @@ void acelp_2t32_fx(
    Word32 L_tmp;
    Word16 rrixix[NB_TRACK_FCB_2T][NB_POS_FCB_2T];
    Word16 rrixiy[MSIZE];
#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    /*----------------------------------------------------------------*
     * Compute rrixix[][] needed for the codebook search.
@@ -63,11 +65,19 @@ void acelp_2t32_fx(
    L_cor = L_deposit_h( 1 );
    FOR( i = 0; i < NB_POS_FCB_2T; i++ )
    {
#ifdef ISSUE_1867_replace_overflow_libenc
        L_cor = L_mac_sat( L_cor, *ptr_h1, *ptr_h1 );  //??sat
#else
        L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
#endif
        ptr_h1++;
        *p1-- = extract_h( L_cor );
        move16(); /*Q9 Q7*/
#ifdef ISSUE_1867_replace_overflow_libenc
        L_cor = L_mac_sat( L_cor, *ptr_h1, *ptr_h1 ); //??sat
#else
        L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
#endif
        ptr_h1++;
        *p0-- = extract_h( L_cor );
        move16(); /*Q9 Q7*/
@@ -108,17 +118,28 @@ void acelp_2t32_fx(
        L_cor = L_mult( *ptr_h1++, *ptr_h2++ ); // Q(12+12+1)
        FOR( i = k; i < NB_POS_FCB_2T - 1; i++ )
        {
#ifdef ISSUE_1867_replace_overflow_libenc
            *p1 = round_fx_sat( L_cor ); // Q(25-16)     //??sat
            L_cor = L_mac_sat( L_cor, *ptr_h1++, *ptr_h2++ ); //??sat
            *p0 = round_fx_sat( L_cor ); // Q(9)  //??sat
            L_cor = L_mac_sat( L_cor, *ptr_h1++, *ptr_h2++ );   //??sat
#else
            *p1 = round_fx_o( L_cor, &Overflow ); // Q(25-16)
            L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
            *p0 = round_fx_o( L_cor, &Overflow ); // Q(9)
            L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
#endif
            move16();
            move16();
            p1 -= ( NB_POS_FCB_2T + 1 );
            p0 -= ( NB_POS_FCB_2T + 1 );
        }

#ifdef ISSUE_1867_replace_overflow_libenc
        *p1 = round_fx_sat( L_cor ); // Q9   //??sat
#else
        *p1 = round_fx_o( L_cor, &Overflow ); // Q9
#endif
        pos -= NB_POS_FCB_2T;
        move16();
        pos2--;
@@ -221,9 +242,15 @@ void acelp_2t32_fx(
        FOR( i1 = 1; i1 < L_SUBFR; i1 += STEP )
        {
            ps2 = add( ps1, dn_p[i1] );
#ifdef ISSUE_1867_replace_overflow_libenc
            alp2 = add_sat( alp1, add_sat( *p1++, *p2++ ) );  //??sat //??sat
            sq = mult( ps2, ps2 );
            s = L_msu_sat( L_mult( alpk, sq ), psk, alp2 );  //??sat
#else
            alp2 = add_o( alp1, add_o( *p1++, *p2++, &Overflow ), &Overflow );
            sq = mult( ps2, ps2 );
            s = L_msu_o( L_mult( alpk, sq ), psk, alp2, &Overflow );
#endif
            IF( s > 0 )
            {
                psk = sq;
@@ -317,9 +344,11 @@ void acelp_2t32_ivas_fx(
    Word32 L_tmp;
    Word16 rrixix[NB_TRACK_FCB_2T][NB_POS_FCB_2T];
    Word16 rrixiy[MSIZE];
#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    /*----------------------------------------------------------------*
     * Compute rrixix[][] needed for the codebook search.
@@ -334,11 +363,19 @@ void acelp_2t32_ivas_fx(
    L_cor = L_deposit_h( 1 );
    FOR( i = 0; i < NB_POS_FCB_2T; i++ )
    {
#ifdef ISSUE_1867_replace_overflow_libenc
        L_cor = L_mac_sat( L_cor, *ptr_h1, *ptr_h1 );   //??sat
#else
        L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
#endif
        ptr_h1++;
        *p1-- = extract_h( L_cor );
        move16(); /*Q9 Q7*/
#ifdef ISSUE_1867_replace_overflow_libenc
        L_cor = L_mac_sat( L_cor, *ptr_h1, *ptr_h1 );   //??sat
#else
        L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
#endif
        ptr_h1++;
        *p0-- = extract_h( L_cor );
        move16(); /*Q9 Q7*/
@@ -379,17 +416,28 @@ void acelp_2t32_ivas_fx(
        L_cor = L_mult( *ptr_h1++, *ptr_h2++ ); // Q25
        FOR( i = k; i < NB_POS_FCB_2T - 1; i++ )
        {
#ifdef ISSUE_1867_replace_overflow_libenc
            *p1 = round_fx_sat( L_cor ); // Q9 //??sat
            L_cor = L_mac_sat( L_cor, *ptr_h1++, *ptr_h2++ ); //??sat
            *p0 = round_fx_sat( L_cor ); // Q9 //??sat
            L_cor = L_mac_sat( L_cor, *ptr_h1++, *ptr_h2++ );   //??sat
#else
            *p1 = round_fx_o( L_cor, &Overflow ); // Q9
            L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
            *p0 = round_fx_o( L_cor, &Overflow ); // Q9
            L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
#endif
            move16();
            move16();
            p1 -= ( NB_POS_FCB_2T + 1 );
            p0 -= ( NB_POS_FCB_2T + 1 );
        }

#ifdef ISSUE_1867_replace_overflow_libenc
        *p1 = round_fx_sat( L_cor );  //??sat
#else
        *p1 = round_fx_o( L_cor, &Overflow );
#endif
        pos -= NB_POS_FCB_2T;
        move16();
        pos2 = sub( pos2, 1 );
@@ -493,9 +541,15 @@ void acelp_2t32_ivas_fx(
        FOR( i1 = 1; i1 < L_SUBFR; i1 += STEP )
        {
            ps2 = add( ps1, dn_p[i1] );
#ifdef ISSUE_1867_replace_overflow_libenc
            alp2 = add_sat( alp1, add_sat( *p1++, *p2++ ) );  //??sat   //??sat
            sq = mult( ps2, ps2 );
            s = L_msu_sat( L_mult( alpk, sq ), psk, alp2 );   //??sat
#else
            alp2 = add_o( alp1, add_o( *p1++, *p2++, &Overflow ), &Overflow );
            sq = mult( ps2, ps2 );
            s = L_msu_o( L_mult( alpk, sq ), psk, alp2, &Overflow );
#endif
            IF( s > 0 )
            {
                psk = sq;
+11 −0
Original line number Diff line number Diff line
@@ -75,9 +75,11 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision *
    Word16 dummy = 0;
    move16();
    ACELP_config *acelp_cfg;
#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    acelp_cfg = &( st->acelp_cfg );
@@ -351,13 +353,22 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision *
            Ltmp = Mpy_32_16_1( gain_code2, code2[i] );
            Ltmp = L_shl( Ltmp, Q_new_p5 );
            Ltmp = L_mac( Ltmp, gain_pit, exc[i + i_subfr] );
#ifdef ISSUE_1867_replace_overflow_libenc
            exc2[i] = round_fx_sat( L_shl_sat( Ltmp, 1 ) ); //??sat
#else
            exc2[i] = round_fx_sat( L_shl_o( Ltmp, 1, &Overflow ) );
#endif
            move16();
            Ltmp2 = Mpy_32_16_1( gain_code, code[i] );
            Ltmp2 = L_shl_sat( Ltmp2, Q_new_p5 );
            Ltmp = L_add_sat( Ltmp, Ltmp2 );
#ifdef ISSUE_1867_replace_overflow_libenc
            Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here */  //??sat
            exc[i + i_subfr] = round_fx_sat( Ltmp );  //??sat
#else
            Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here */
            exc[i + i_subfr] = round_fx_o( Ltmp, &Overflow );
#endif
            move16();
        }
        /*-----------------------------------------------------------------*
+11 −11
Original line number Diff line number Diff line
@@ -1657,8 +1657,8 @@ void QuantizeSpectrum_fx(

            tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 );
            BASOP_SATURATE_WARNING_OFF_EVS
#ifdef ISSUE_1796_replace_shl_o
            hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 );
#ifdef ISSUE_1836_replace_overflow_libcom
            hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 );   //??sat
#else
            hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow );
#endif
@@ -1781,8 +1781,8 @@ void QuantizeSpectrum_fx(
            }

            /* Limit low sqGain for avoiding saturation of the gain quantizer*/
#ifdef ISSUE_1796_replace_shl_o
            tmp1 = mult_r( shl_sat( L_spec, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ );
#ifdef ISSUE_1867_replace_overflow_libenc
            tmp1 = mult_r( shl_sat( L_spec, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ );  //??sat
#else
            tmp1 = mult_r( shl_o( L_spec, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ );
#endif
@@ -2745,8 +2745,8 @@ void QuantizeSpectrum_fx(
                    BASOP_SATURATE_WARNING_OFF_EVS;
                    FOR( i = 0; i < L_frame; i++ )
                    {
#ifdef ISSUE_1796_replace_shl_o
                        xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM );
#ifdef ISSUE_1867_replace_overflow_libenc
                        xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM );   //??sat
#else
                        xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow );
#endif
@@ -3256,8 +3256,8 @@ void QuantizeTCXSpectrum_fx(

        tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 );
        BASOP_SATURATE_WARNING_OFF_EVS
#ifdef ISSUE_1796_replace_shl_o
        hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 );
#ifdef ISSUE_1836_replace_overflow_libcom
        hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 );   //??sat
#else
        hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow );
#endif
@@ -4023,7 +4023,7 @@ void InternalTCXDecoder_fx(
    Word16 Aq_old_fx[M + 1];
    Word32 sns_interpolated_scalefactors_fx[FDNS_NPTS], A_fx32[M + 1];
    Word16 *xn_buf16 = (Word16 *) xn_buf32;
#if !defined( ISSUE_1796_replace_shl_o )
#if !defined( ISSUE_1836_replace_overflow_libcom )
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
@@ -4677,8 +4677,8 @@ void InternalTCXDecoder_fx(
            BASOP_SATURATE_WARNING_OFF_EVS;
            FOR( i = 0; i < L_frame; i++ )
            {
#ifdef ISSUE_1796_replace_shl_o
                xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM );
#ifdef ISSUE_1836_replace_overflow_libcom
                xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM );   //??sat
#else
                xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow );
#endif
+34 −2
Original line number Diff line number Diff line
@@ -82,10 +82,13 @@ void core_encode_openloop_fx(
    Word16 lsp_old_q_rf[M + 1], lsf_old_q_rf[M + 1];
    (void) vad_hover_flag;
    (void) vad_flag_dtx;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
    RF_ENC_HANDLE hRF = st->hRF;

@@ -552,8 +555,8 @@ void core_encode_openloop_fx(
            /*v_sub(lsf_uq_rf, lsf_q_1st_rf, lsf_q_d_rf, M);*/
            FOR( i = 0; i < M; i++ )
            {
#ifdef ISSUE_1796_replace_shl_o
                lsf_q_d_rf[i] = shl_sat( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5 );
#ifdef ISSUE_1836_replace_overflow_libcom
                lsf_q_d_rf[i] = shl_sat( mult_r( sub_sat( lsf_uq_rf[i], lsf_q_1st_rf[i] ), 25600 ), 5 );  //??sat
#else
                lsf_q_d_rf[i] = shl_o( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5, &Overflow );
#endif
@@ -757,9 +760,11 @@ static void closest_centroid_rf(
    Word16 tmp, tmpL;
    Word64 werr_64;
    Word32 L_tmp, best_werr, werr;
#ifdef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    ind_vec[0] = 0;
@@ -775,8 +780,13 @@ static void closest_centroid_rf(
        tmpL = i_mult2( i, length );
        FOR( j = 0; j < length; j++ )
        {
#ifdef ISSUE_1836_replace_overflow_libcom
            tmp = sub_sat( data[j], quantizer[tmpL + j] );  //??sat
            L_tmp = L_mult_sat( tmp, tmp );   //??sat
#else
            tmp = sub_o( data[j], quantizer[tmpL + j], &Overflow );
            L_tmp = L_mult_o( tmp, tmp, &Overflow );
#endif
            werr_64 = W_mac_32_16( werr_64, L_tmp, weights[j] );
        }
        werr = W_sat_m( werr_64 );
@@ -828,9 +838,11 @@ void core_acelp_tcx20_switching_fx(
    Word16 snr_tcx, snr_acelp, dsnr;
    TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
    SP_MUS_CLAS_HANDLE hSpMusClas = st->hSpMusClas;
#ifdef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    /* Check minimum pitch for quantization */
@@ -1107,7 +1119,11 @@ void core_acelp_tcx20_switching_fx(

            FOR( j = 0; j < L_SUBFR; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                tmp32 = L_mac0_sat( tmp32, st->wspeech_enc[i + j], st->wspeech_enc[i + j] );  //??sat
#else
                tmp32 = L_mac0_o( tmp32, st->wspeech_enc[i + j], st->wspeech_enc[i + j], &Overflow );
#endif
            }
            tmp32 = L_shr( BASOP_Util_Log2( tmp32 ), 9 );                                                        /* 15Q16 */
            tmp32 = L_add( tmp32, L_sub( 0x1F0000, L_shl( L_deposit_h( add( Q_new, sub( shift, 1 ) ) ), 1 ) ) ); /* wspeech_enc scaling */
@@ -1125,7 +1141,11 @@ void core_acelp_tcx20_switching_fx(
        tcx_snr = L_shl( Mpy_32_16_1( tcx_snr, 0x6054 ), 2 ); /* 0x6054 -> 10/log2(10) (2Q13) */

        BASOP_SATURATE_WARNING_OFF_EVS
#ifdef ISSUE_1836_replace_overflow_libcom
        snr_tcx = round_fx_sat( L_shl_sat( tcx_snr, 8 ) ); /* 7Q8 */  //??sat   //??sat
#else
        snr_tcx = round_fx_o( L_shl_o( tcx_snr, 8, &Overflow ), &Overflow ); /* 7Q8 */
#endif
        BASOP_SATURATE_WARNING_ON_EVS

        /*--------------------------------------------------------------*
@@ -1159,11 +1179,19 @@ void core_acelp_tcx20_switching_fx(

            FOR( j = 0; j < L_SUBFR; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                signal = L_mac0_sat( signal, st->wspeech_enc[i + j], st->wspeech_enc[i + j] );  //??sat

                tmp16 = round_fx_sat( L_shl_sat( Mpy_32_16_r( gain, st->wspeech_enc[i + j - T0] ), 15 ) );  //??sat
                tmp16 = sub_sat( st->wspeech_enc[i + j], tmp16 );   //??sat
                noise = L_mac0_sat( noise, tmp16, tmp16 );  //??sat
#else
                signal = L_mac0_o( signal, st->wspeech_enc[i + j], st->wspeech_enc[i + j], &Overflow );

                tmp16 = round_fx_o( L_shl_o( Mpy_32_16_r( gain, st->wspeech_enc[i + j - T0] ), 15, &Overflow ), &Overflow );
                tmp16 = sub_o( st->wspeech_enc[i + j], tmp16, &Overflow );
                noise = L_mac0_o( noise, tmp16, tmp16, &Overflow );
#endif
            }
            /* Assume always 4 sub frames. */
            /*assert( (st->L_frame /  L_SUBFR) == 4);*/
@@ -1216,7 +1244,11 @@ void core_acelp_tcx20_switching_fx(
        test();
        if ( ( GT_16( snr_acelp, snr_tcx ) ) &&
             ( LT_16( snr_acelp, add( snr_tcx, 512 /*2.0f Q8*/ ) ) ) &&
#ifdef ISSUE_1836_replace_overflow_libcom
             ( LT_16( add_sat( st->prevTempFlatness_fx, currFlatness ), 416 /*3.25f Q7*/ ) || EQ_16( stab_fac, 0x7fff /*1 Q15*/ ) ||  //??sat
#else
             ( LT_16( add_o( st->prevTempFlatness_fx, currFlatness, &Overflow ), 416 /*3.25f Q7*/ ) || EQ_16( stab_fac, 0x7fff /*1 Q15*/ ) ||
#endif
               ( EQ_32( st->sr_core, INT_FS_12k8 ) && EQ_16( st->sp_aud_decision0, 1 ) && LT_16( add_sat( st->prevTempFlatness_fx, currFlatness ), 2560 /*20.f Q7*/ ) ) ) &&
             ( LE_16( st->acelpFramesCount, 6 ) ) )
        {
+33 −0
Original line number Diff line number Diff line
@@ -31,9 +31,11 @@ void corr_xh_fx(
{
    Word16 i, j, k;
    Word32 L_tmp, y32[L_SUBFR], L_maxloc, L_tot;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move16();
#endif
#endif

    /* first keep the result on 32 bits and find absolute maximum */
@@ -47,7 +49,11 @@ void corr_xh_fx(
            L_tmp = L_mac( 1L, x[i], h[0] ); /* 1 -> to avoid null dn[] Qx+15*/
            FOR( j = i; j < L_SUBFR - 1; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); /*Qx+15*/
#else
                L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); /*Qx+15*/
#endif
            }

            y32[i] = L_tmp; /*Qx+15*/
@@ -57,8 +63,13 @@ void corr_xh_fx(
        }
        /* tot += 3*max / 8 */
        L_maxloc = L_shr( L_maxloc, 2 );
#ifdef ISSUE_1836_replace_overflow_libcom
        L_tot = L_add_sat( L_tot, L_maxloc );             /* +max/4 */  //??sat
        L_tot = L_add_sat( L_tot, L_shr( L_maxloc, 1 ) ); /* +max/8 */  //??sat
#else
        L_tot = L_add_o( L_tot, L_maxloc, &Overflow );             /* +max/4 */
        L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */
#endif
    }

    /* Find the number of right shifts to do on y32[] so that    */
@@ -82,9 +93,11 @@ void corr_hh_ivas_fx(
{
    Word16 i, j, k;
    Word32 L_tmp, y32[L_SUBFR * 2], L_maxloc, L_tot;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move16();
#endif
#endif

    /* first keep the result on 32 bits and find absolute maximum */
@@ -98,7 +111,11 @@ void corr_hh_ivas_fx(
            L_tmp = L_mac( 1L, shr( h[i], 3 ), shr( h[0], 3 ) ); /* 1 -> to avoid null dn[] */ // 2*(15 - norm_s(h[0]) -3) - 1
            FOR( j = i; j < L_subfr - 1; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                L_tmp = L_mac_sat( L_tmp, shr( h[j + 1], 3 ), shr( h[j + 1 - i], 3 ) ); // 2*(15 - norm_s(h[0]) -3) - 1   //?sat
#else
                L_tmp = L_mac_o( L_tmp, shr( h[j + 1], 3 ), shr( h[j + 1 - i], 3 ), &Overflow ); // 2*(15 - norm_s(h[0]) -3) - 1
#endif
            }

            y32[i] = L_tmp; // 2*(15 - norm_s(h[0]) -3) - 1
@@ -108,8 +125,13 @@ void corr_hh_ivas_fx(
        }
        /* tot += 3*max / 8 */
        L_maxloc = L_shr( L_maxloc, 2 );
#ifdef ISSUE_1836_replace_overflow_libcom
        L_tot = L_add_sat( L_tot, L_maxloc );             /* +max/4 */  //??sat
        L_tot = L_add_sat( L_tot, L_shr( L_maxloc, 1 ) ); /* +max/8 */  //??sat
#else
        L_tot = L_add_o( L_tot, L_maxloc, &Overflow );             /* +max/4 */
        L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */
#endif
    }

    /* Find the number of right shifts to do on y32[] so that    */
@@ -139,9 +161,11 @@ void corr_xh_ivas_fx(
{
    Word16 i, j, k;
    Word32 L_tmp, y32[L_SUBFR * 2], L_maxloc, L_tot;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move16();
#endif
#endif

    /* first keep the result on 32 bits and find absolute maximum */
@@ -155,7 +179,11 @@ void corr_xh_ivas_fx(
            L_tmp = L_mac( 0, x[i], h[0] ); // Qx+(14 - norm_s(h[0])) + 1
            FOR( j = i; j < L_subfr - 1; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                L_tmp = L_mac_sat( L_tmp, x[j + 1], h[j + 1 - i] ); // Qx+(14 - norm_s(h[0])) + 1   //??sat
#else
                L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); // Qx+(14 - norm_s(h[0])) + 1
#endif
            }

            y32[i] = L_tmp; // Qx+(14 - norm_s(h[0])) + 1
@@ -165,8 +193,13 @@ void corr_xh_ivas_fx(
        }
        /* tot += 3*max / 8 */
        L_maxloc = L_shr( L_maxloc, 2 );
#ifdef ISSUE_1836_replace_overflow_libcom
        L_tot = L_add_sat( L_tot, L_maxloc );             /* +max/4 */  //??sat
        L_tot = L_add_sat( L_tot, L_shr( L_maxloc, 1 ) ); /* +max/8 */  //??sat
#else
        L_tot = L_add_o( L_tot, L_maxloc, &Overflow );             /* +max/4 */
        L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */
#endif
    }

    /* Find the number of right shifts to do on y32[] so that    */
Loading