Commit 14a7d630 authored by vaillancour's avatar vaillancour
Browse files

Fix part 2 of specific OV

parent 436a1250
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -2118,21 +2118,39 @@ Word32 Calc_Energy_Autoscaled(/* o: Result (Energy) */
    FOR (i = 0; i < j; i++)
    {
        /* divide by 2 so energy will be divided by 4 */
#ifdef BASOP_NOGLOB
        temp = mult_ro(*signal++, 16384, &Overflow);
        L_Energy = L_mac0_o(L_Energy, temp, temp, &Overflow);
#else
        temp = mult_r(*signal++, 16384);
        L_Energy = L_mac0(L_Energy, temp, temp);
#endif
    }
    FOR (i = j; i < len; i+=8) /* Process 8 Samples at a time */
    {
        /* divide by 2 so energy will be divided by 4 */
#ifdef BASOP_NOGLOB
        temp = mult_ro(*signal++, 16384, &Overflow);
#else
        temp = mult_r(*signal++, 16384);
#endif
        L_temp = L_mult0(temp, temp);
        FOR (j = 1; j < 8; j++)
        {
#ifdef BASOP_NOGLOB
            temp = mult_ro(*signal++, 16384, &Overflow);
            L_temp = L_mac0_o(L_temp, temp, temp, &Overflow);
#else
            temp = mult_r(*signal++, 16384);
            L_temp = L_mac0(L_temp, temp, temp);
#endif
        }

#ifdef BASOP_NOGLOB
        L_temp = L_shr_o(L_temp, temp2, &Overflow);
#else
        L_temp = L_shr(L_temp, temp2);
#endif
        /* Here we try the addition just to check if we can sum
           the energy of the small (8 Iterations) loop with the
           total energy calculated so far without an overflow.
@@ -2153,7 +2171,11 @@ Word32 Calc_Energy_Autoscaled(/* o: Result (Energy) */
            Overflow = 0;
            move16();
        }
#ifdef BASOP_NOGLOB
        L_Energy = L_add_o(L_Energy, L_temp, &Overflow);
#else
        L_Energy = L_add(L_Energy, L_temp);
#endif
    }
    /* Calc Final Exponent (sub 2 because of the mult_r by 16384 that already divs the ener by 4) */
    temp2 = sub(sub(shl(signal_exp, 1), temp2), 2);