Commit cfd033c9 authored by sagnowski's avatar sagnowski
Browse files

Replace overflowing basops, pt 4

parent bbee7e97
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -107,9 +107,16 @@ Word32 Mpy_32_32_r (Word32 L_var1, Word32 L_var2) {

Word32 Madd_32_16 (Word32 L_var3, Word32 L_var1, Word16 var2) {
  Word32 L_var_out;
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif /* BASOP_NOGLOB */

  L_var_out = Mpy_32_16_1 (L_var1, var2);
#ifdef BASOP_NOGLOB
  L_var_out = L_add_o (L_var3, L_var_out, &Overflow);
#else /* BASOP_NOGLOB */
  L_var_out = L_add (L_var3, L_var_out);
#endif /* BASOP_NOGLOB */
  
#if (WMOPS)
  multiCounter[currCounter].Mpy_32_16_1--;
@@ -135,9 +142,16 @@ Word32 Madd_32_16_r (Word32 L_var3, Word32 L_var1, Word16 var2) {

Word32 Msub_32_16 (Word32 L_var3, Word32 L_var1, Word16 var2) {
  Word32 L_var_out;
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif /* BASOP_NOGLOB */

  L_var_out = Mpy_32_16_1 (L_var1, var2);
#ifdef BASOP_NOGLOB
  L_var_out = L_sub_o(L_var3, L_var_out, &Overflow);
#else /* BASOP_NOGLOB */
  L_var_out = L_sub(L_var3, L_var_out);
#endif /* BASOP_NOGLOB */
  
#if (WMOPS)
  multiCounter[currCounter].Mpy_32_16_1--;
+8 −0
Original line number Diff line number Diff line
@@ -79,7 +79,11 @@ static void filter_2nd_order(
    L_y2  = L_shl(L_sum, HP20_COEFF_SCALE);
    BASOP_SATURATE_ERROR_OFF
    BASOP_SATURATE_WARNING_OFF
#ifdef BASOP_NOGLOB
    signal[0*stride] = round_fx_o(L_shl_o(L_y2, prescale, &Overflow), &Overflow);
#else /* BASOP_NOGLOB */
    signal[0*stride] = round_fx(L_shl(L_y2, prescale));
#endif /* BASOP_NOGLOB */
    BASOP_SATURATE_WARNING_ON

    BASOP_SATURATE_ERROR_ON
@@ -93,7 +97,11 @@ static void filter_2nd_order(
    L_y1  = L_shl(L_sum, HP20_COEFF_SCALE);
    BASOP_SATURATE_ERROR_OFF
    BASOP_SATURATE_WARNING_OFF
#ifdef BASOP_NOGLOB
    signal[1*stride] = round_fx_o(L_shl_o(L_y1, prescale, &Overflow), &Overflow);
#else /* BASOP_NOGLOB */
    signal[1*stride] = round_fx(L_shl(L_y1, prescale));
#endif /* BASOP_NOGLOB */
    BASOP_SATURATE_WARNING_ON

    /* New we use a trick and toggle x1/x2 and L_y1/L_y2 to save a few cycles unrolling the loop by 2 */
+7 −0
Original line number Diff line number Diff line
@@ -1262,10 +1262,17 @@ Word32 sum32_fx( /* o : sum of all vector elements Qx*/
{
    Word16 i;
    Word32 tmp;
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif /* BASOP_NOGLOB */
    tmp = L_deposit_l(0);
    FOR( i=0; i<lvec; i++ )
    {
#ifdef BASOP_NOGLOB
        tmp = L_add_o(tmp,vec[i], &Overflow); /*Qx */
#else /* BASOP_NOGLOB */
        tmp = L_add(tmp,vec[i]); /*Qx */
#endif /* BASOP_NOGLOB */
    }

    return tmp;
+19 −0
Original line number Diff line number Diff line
@@ -222,6 +222,9 @@ static void find_enr(
    Word32 etot;
    Word16 exp_etot;
    Word32 *tmpptr;
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif /* BASOP_NOGLOB */


    ptR = &data[1];        /* first real */
@@ -269,7 +272,11 @@ static void find_enr(
            /* *ptE *= 4.0 / (L_FFT*L_FFT) */
            /* normalization - corresponds to FFT normalization by 2/L_FFT */
            BASOP_SATURATE_WARNING_OFF; /* saturation seems to have no effect (tested by simulation) */
#ifdef BASOP_NOGLOB
            *ptE = L_shl_o(Ltmp, diff_scaleM2, &Overflow);
#else /* BASOP_NOGLOB */
            *ptE = L_shl(Ltmp, diff_scaleM2);
#endif /* BASOP_NOGLOB */
            move32(); /* scaled by Q_new + QSCALE - 2 */
            BASOP_SATURATE_WARNING_ON;
            /*band[i] += *ptE++;*/
@@ -295,7 +302,11 @@ static void find_enr(
        exp_band = sub(exp_band, shift_to_norm);
        exp_band = sub(diff_scaleP1, exp_band);
        BASOP_SATURATE_WARNING_OFF; /* saturation seems to have no effect (tested by simulation) */
#ifdef BASOP_NOGLOB
        band[i] = L_shl_o(Ltmp1, exp_band, &Overflow);
#else /* BASOP_NOGLOB */
        band[i] = L_shl(Ltmp1, exp_band);
#endif /* BASOP_NOGLOB */
        move32();/* band scaled by Q_new + QSCALE */
        BASOP_SATURATE_WARNING_ON;

@@ -346,7 +357,11 @@ static void find_enr(
                /* *ptE *= 4.0 / (L_FFT*L_FFT) */
                /* normalization - corresponds to FFT normalization by 2/L_FFT  */
                BASOP_SATURATE_WARNING_OFF; /* saturation seems to have no effect (tested by simulation) */
#ifdef BASOP_NOGLOB
                *Bin_E = L_shl_o(Ltmp, diff_scaleM2, &Overflow);
#else /* BASOP_NOGLOB */
                *Bin_E = L_shl(Ltmp, diff_scaleM2);
#endif /* BASOP_NOGLOB */
                move32();   /* scaled by Q_new + QSCALE - 2 */
                BASOP_SATURATE_WARNING_ON;
                Bin_E++;
@@ -368,7 +383,11 @@ static void find_enr(
            exp_band = sub(exp_band, shift_to_norm);
            exp_band = sub(diff_scaleP1, exp_band);
            BASOP_SATURATE_WARNING_OFF; /* saturation seems to have no effect (tested by simulation) */
#ifdef BASOP_NOGLOB
            band[i] = L_shl_o(Ltmp1, exp_band, &Overflow);
#else /* BASOP_NOGLOB */
            band[i] = L_shl(Ltmp1, exp_band);
#endif /* BASOP_NOGLOB */
            move32();/* band scaled by Q_new + QSCALE */
            BASOP_SATURATE_WARNING_ON;

+7 −0
Original line number Diff line number Diff line
@@ -67,6 +67,9 @@ void bw_detect_fx(
#ifndef IVAS_CODE_BWD
    MY_UNUSED_Array(spectrum)
#endif
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif /* BASOP_NOGLOB */

    bwd_count_wider_bw = BWD_COUNT_WIDER_BW;    move16();
    test();test();test();test();test();
@@ -283,7 +286,11 @@ void bw_detect_fx(

                FOR(i = 0; i < BWD_TOTAL_WIDTH; i++)
                {
#ifdef BASOP_NOGLOB
                    spect[i] = round_fx_o(L_shr_o(spect32[i],Q_dct, &Overflow), &Overflow);
#else /* BASOP_NOGLOB */
                    spect[i] = round_fx(L_shr(spect32[i],Q_dct));
#endif /* BASOP_NOGLOB */
                }
                Q_dct = -2;
                move16();
Loading