Commit 5e897c98 authored by vaillancour's avatar vaillancour
Browse files

adding one more critical overflow

parent 50bffeb8
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -119,7 +119,10 @@ Word16 GetSubbandCorrIndex2_har_fx( /* o : best correlation index
        {
            /*energy += *predBuf * *predBuf; */
#ifdef BASOP_NOGLOB        /* Critical Overflow , as well as those below*/
            L_energy = L_mac_o(L_energy, *ptr_pbuf, *ptr_pbuf, &Overflow);                        /* Q*2-1; */
#else
            L_energy = L_mac(L_energy, *ptr_pbuf, *ptr_pbuf);                        /* Q*2-1; */
#endif
            ptr_pbuf++;
        }

@@ -132,7 +135,11 @@ Word16 GetSubbandCorrIndex2_har_fx( /* o : best correlation index
            FOR(j = 0; j < nZero_fx; j++)
            {
                /*corr += inBuf[G_item[j].gainIndex]* predBuf[G_item[j].gainIndex]; */
#ifdef BASOP_NOGLOB        /* Critical Overflow */
                L_corr = L_mac_o(L_corr, ibuf_fx[G_item_fx[j].gainIndex_fx], ptr_pbuf[G_item_fx[j].gainIndex_fx], &Overflow);                    /* Q*2-1 */
#else
                L_corr = L_mac(L_corr, ibuf_fx[G_item_fx[j].gainIndex_fx], ptr_pbuf[G_item_fx[j].gainIndex_fx]);                    /* Q*2-1 */
#endif
            }

            /*corr_sq = corr*corr; */
@@ -140,9 +147,14 @@ Word16 GetSubbandCorrIndex2_har_fx( /* o : best correlation index
            exp_norm = sub(exp_norm, 1); /* added for Overflow  0x8000 * 0x8000  -> Overflow */
            L_corr_sq = L_shl(L_corr, exp_norm);
            corr_sq_hi_fx = extract_h(L_corr_sq);

#ifdef BASOP_NOGLOB        /* Critical Overflow */
            L_corr_sq = L_mult_o(corr_sq_hi_fx, corr_sq_hi_fx, &Overflow); /* (((Qhi:Qsh+exp_norm_hi-16)+Qss+1)+exp_norm-16)*2+1 */
            L_corr_sq = L_shr_o(L_corr_sq, s_min(shl(exp_norm, 1), 31), &Overflow); /* (QCorr-16)*2+1 */
#else
            L_corr_sq = L_mult(corr_sq_hi_fx, corr_sq_hi_fx); /* (((Qhi:Qsh+exp_norm_hi-16)+Qss+1)+exp_norm-16)*2+1 */
            L_corr_sq = L_shr(L_corr_sq, s_min(shl(exp_norm, 1), 31)); /* (QCorr-16)*2+1 */

#endif
            IF(Overflow != 0)
            {
                L_corr_sq = 0x0L;