Commit b1b8a0b8 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

some more ovfl replacements

parent 3c41678f
Loading
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -74,9 +74,11 @@ void dtx_ivas_fx(
    TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc;

    Word16 last_br_cng_flag, last_br_flag, br_dtx_flag;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    Word32 total_brate_ref;

@@ -461,7 +463,11 @@ void dtx_ivas_fx(
                speech++;
                FOR( i = 1; i < L_FRAME / 16; i++ )
                {
#ifdef ISSUE_1836_replace_overflow_libcom
                    L_tmp = L_mac0_sat( L_tmp, *speech, *speech ); /*2*Q_speech*/  //??sat
#else
                    L_tmp = L_mac0_o( L_tmp, *speech, *speech, &Overflow ); /*2*Q_speech*/
#endif
                    speech++;
                }
                hDtxEnc->frame_ener_fx = L_add( hDtxEnc->frame_ener_fx, L_shr( L_tmp, Q_speech2 ) ); /* Q(-7) */
@@ -631,9 +637,11 @@ void dtx_fx(
    TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc;

    Word16 last_br_cng_flag, last_br_flag, br_dtx_flag;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    IF( st_fx->dtx_sce_sba != 0 )
@@ -931,7 +939,11 @@ void dtx_fx(
                speech++;
                FOR( i = 1; i < L_FRAME / 16; i++ )
                {
#ifdef ISSUE_1836_replace_overflow_libcom
                    L_tmp = L_mac0_sat( L_tmp, *speech, *speech ); /*2*Q_speech*/  //??sat
#else
                    L_tmp = L_mac0_o( L_tmp, *speech, *speech, &Overflow ); /*2*Q_speech*/
#endif
                    speech++;
                }
                hDtxEnc->frame_ener_fx = L_add( hDtxEnc->frame_ener_fx, L_shr( L_tmp, Q_speech2 ) ); /*Q(-7) */
@@ -1236,8 +1248,10 @@ void dtx_hangover_control_fx(
    VAD_HANDLE hVAD = st_fx->hVAD;
    DTX_ENC_HANDLE hDtxEnc = st_fx->hDtxEnc;
    TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    /* get current frame exc energy in log2 */
@@ -1407,7 +1421,11 @@ void dtx_hangover_control_fx(
            move16();
            FOR( j = 0; j < m; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                lsp_est[i] = add_sat( lsp_est[i], tmp[j * M + i] ); /*Q15 */   //??sat
#else
                lsp_est[i] = add_o( lsp_est[i], tmp[j * M + i], &Overflow ); /*Q15 */
#endif
            }

            lsp_est[i] = sub( lsp_est[i], tmp[max_idx[0] * M + i] ); /*Q15 */
@@ -1423,10 +1441,18 @@ void dtx_hangover_control_fx(
            move16();
            FOR( j = 0; j < m; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                lsp_est[i] = add_sat( lsp_est[i], tmp[j * M + i] ); /*Q15 */  //??sat
#else
                lsp_est[i] = add_o( lsp_est[i], tmp[j * M + i], &Overflow ); /*Q15 */
#endif
            }

#ifdef ISSUE_1836_replace_overflow_libcom
            lsp_est[i] = sub_sat( lsp_est[i], add_sat( tmp[max_idx[0] * M + i], tmp[max_idx[1] * M + i] ) ); /*Q15 */   //??sat
#else
            lsp_est[i] = sub_o( lsp_est[i], add_o( tmp[max_idx[0] * M + i], tmp[max_idx[1] * M + i], &Overflow ), &Overflow ); /*Q15 */
#endif
            S_tmp = div_s( 1, sub( m, 2 ) );                                                                                   /*Q15 */
            lsp_est[i] = mult_r( lsp_est[i], S_tmp );                                                                          /*Q15 */
        }
@@ -1436,7 +1462,11 @@ void dtx_hangover_control_fx(
    move16();
    FOR( i = 0; i < M; i++ )
    {
#ifdef ISSUE_1836_replace_overflow_libcom
        Dlsp_n2e = add_sat( Dlsp_n2e, abs_s( sub( lsp_new_fx[i], lsp_est[i] ) ) ); /*Q15 */   //??sat
#else
        Dlsp_n2e = add_o( Dlsp_n2e, abs_s( sub( lsp_new_fx[i], lsp_est[i] ) ), &Overflow ); /*Q15 */
#endif
        lsp_est[i] = add( mult_r( 26214, lsp_est[i] ), mult_r( 6554, lsp_new_fx[i] ) );     /*Q15 */
    }

@@ -1449,7 +1479,11 @@ void dtx_hangover_control_fx(
    FOR( i = 0; i < M; i++ )
    {
        S_tmp = abs_s( sub( hDtxEnc->lspCNG_fx[i], lsp_est[i] ) ); /*Q15 */
#ifdef ISSUE_1836_replace_overflow_libcom
        Dlsp = add_sat( Dlsp, S_tmp );                    /*Q15 */  //??sat
#else
        Dlsp = add_o( Dlsp, S_tmp, &Overflow );                    /*Q15 */
#endif
        IF( GT_16( S_tmp, S_max ) )
        {
            S_max = S_tmp; /*Q15 */
+40 −1
Original line number Diff line number Diff line
@@ -139,9 +139,11 @@ static void E_ACELP_2pulse_searchx_fx(
    Word32 alp0, alp1, alp2, s;
    Word16 *pR, sgnx;
    Word16 sqk[2], alpk[2], ik;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    /* eight dn2 max positions per track */
@@ -167,8 +169,11 @@ static void E_ACELP_2pulse_searchx_fx(
    {
        sgnx = negate( sgnx );
    }
#ifdef ISSUE_1836_replace_overflow_libcom
    if ( mac_r_sat( L_mac_sat( L_mac_sat( alp0, cor[x], sign[x] ), cor[track_y], sign[track_y] ), R[track_y - x], sgnx ) < 0 )  //??sat //??sat //??sat
#else
    if ( mac_ro( L_mac_o( L_mac_o( alp0, cor[x], sign[x], &Overflow ), cor[track_y], sign[track_y], &Overflow ), R[track_y - x], sgnx, &Overflow ) < 0 )

#endif
    {
        sqk[0] = 1;
        move16();
@@ -189,7 +194,11 @@ static void E_ACELP_2pulse_searchx_fx(
        /*ps1 = ps0 + dn[x];                            INDIRECT(1);ADD(1);*/
        ps1 = add_sat( ps0, dn[x] ); /*Qdn*/
        /*alp1 = alp0 + 2*sgnx*cor[x];                  INDIRECT(1);MULT(1); MAC(1);*/
#ifdef ISSUE_1836_replace_overflow_libcom
        alp1 = L_mac_sat( alp0, cor[x], sgnx ); /* Qalp = (Q_R=Q_cor)*Q_signval */
#else
        alp1 = L_mac_o( alp0, cor[x], sgnx, &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
#endif
        pR = R - x;                                      /*Q9+scale*/

        FOR( y = track_y; y < L_SUBFR; y += 4 )
@@ -204,14 +213,26 @@ static void E_ACELP_2pulse_searchx_fx(
            assert( sgnx != 0 );
            alp2_16 = 0;

#ifdef ISSUE_1836_replace_overflow_libcom
            alp2 = L_mac_sat( alp1, cor[y], sign[y] ); /* Qalp = (Q_R=Q_cor)*Q_signval */  //??sat
#else
            alp2 = L_mac_o( alp1, cor[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
#endif
            if ( sgnx > 0 )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                alp2_16 = mac_r_sat( alp2, pR[y], sign[y] ); /* Qalp = (Q_R=Q_cor)*Q_signval */
#else
                alp2_16 = mac_ro( alp2, pR[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
#endif
            }
            if ( sgnx < 0 )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                alp2_16 = msu_r_sat( alp2, pR[y], sign[y] ); /* Qalp = (Q_R=Q_cor)*Q_signval */   //??sat
#else
                alp2_16 = msu_ro( alp2, pR[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
#endif
            }
            alpk[1 - ik] = alp2_16; /* Qalp */
            move16();
@@ -223,7 +244,11 @@ static void E_ACELP_2pulse_searchx_fx(


            /*s = (alpk * sq) - (sqk * alp2);            MULT(1);MAC(1);*/
#ifdef ISSUE_1836_replace_overflow_libcom
            s = L_msu_sat( L_mult( alpk[ik], sq ), sqk[ik], alp2_16 ); /* Q_sq = Q_sqk, Q_alpk = Q_alp */   //??sat
#else
            s = L_msu_o( L_mult( alpk[ik], sq ), sqk[ik], alp2_16, &Overflow ); /* Q_sq = Q_sqk, Q_alpk = Q_alp */
#endif
            if ( s > 0 )
            {
                ik = sub( 1, ik );
@@ -281,9 +306,11 @@ static void E_ACELP_1pulse_searchx_fx(
    Word16 ntracks, t;
    Word16 sqk[2], alpk[2], ik;
    move16();
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    /* save these to limit memory searches */
    /*alp0 = *alp + R[0];                              INDIRECT(1);*/
@@ -299,7 +326,11 @@ static void E_ACELP_1pulse_searchx_fx(
    sqk[0] = -1;
    ik = 0;
    move16();
#ifdef ISSUE_1836_replace_overflow_libcom
    if ( mac_r_sat( alp0, cor[tracks[0]], sign[tracks[0]] ) < 0 )   //??sat
#else
    if ( mac_ro( alp0, cor[tracks[0]], sign[tracks[0]], &Overflow ) < 0 )
#endif
    {
        sqk[0] = 1;
        move16();
@@ -323,7 +354,11 @@ static void E_ACELP_1pulse_searchx_fx(
            ps1 = add( ps0, dn[x] );
            /* alp1 = alp0 + 2*sign[x]*cor[x];                MAC(1); MULT(1);*/
            assert( sign[x] == sign_val_1 << 1 || sign[x] == -( sign_val_1 << 1 ) );
#ifdef ISSUE_1836_replace_overflow_libcom
            alp1 = mac_r_Sat( alp0, cor[x], sign[x] ); /* Qalp = (Q_R=Q_cor)*Q_signval */   //??sat
#else
            alp1 = mac_ro( alp0, cor[x], sign[x], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
#endif
            alpk[1 - ik] = alp1;                               /* Qalp */
            move16();

@@ -334,7 +369,11 @@ static void E_ACELP_1pulse_searchx_fx(
            move16();

            /*s = (alpk[ik] * sq) - (sqk[ik] * alp1);                MULT(1);MAC(1);*/
#ifdef ISSUE_1836_replace_overflow_libcom
            s = L_msu_sat( L_mult_sat( alpk[ik], sq ), sqk[ik], alp1 ); /* Q9+Qalp+1 */   //??sat
#else
            s = L_msu_o( L_mult_o( alpk[ik], sq, &Overflow ), sqk[ik], alp1, &Overflow ); /* Q9+Qalp+1 */
#endif
            if ( s > 0 )
            {
                ik = sub( 1, ik );