Commit a1883462 authored by vaillancour's avatar vaillancour
Browse files

Fixes for stv16c_dtx_9600_16kHz.COD, fixes a critical carry/ovf

parent 2b9b2451
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -71,7 +71,9 @@ void CNG_dec_fx(

    Word16 LSF_Q_prediction;  /* o  : LSF prediction mode - just temporary variable in CNG                */
    TD_CNG_DEC_HANDLE hTdCngDec;

#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
    hTdCngDec = st_fx->hTdCngDec;

    m = 0;
@@ -505,7 +507,11 @@ void CNG_dec_fx(
            FOR ( i=0; i<M; i++ )
            {
                dev = abs_s(sub(lsp_tmp[i],lsp_new[i])); /*Q15*/
#ifdef BASOP_NOGLOB
                dist = add_o(dist,dev, &Overflow); /*Q15*/
#else
                dist = add(dist,dev); /*Q15*/
#endif
                if ( GT_16(dev,max_dev))
                {
                    max_dev = dev;
+18 −2
Original line number Diff line number Diff line
@@ -652,9 +652,15 @@ static void IGF_appl(IGF_DEC_PRIVATE_DATA_HANDLE hPrivate
    FOR (tb = 0; tb < 24; tb++)
    {
        Carry    = 0;
#ifdef BASOP_NOGLOB           /* Critical Carry/Overflow*/
        L_tmp    = L_add_co(L_tmp, energyTmp[tb], &Carry, &Overflow);
        Overflow = 0;
        L_c = L_macNs_co(L_c, 0, 0, &Carry, &Overflow);
#else
        L_tmp = L_add_c(L_tmp, energyTmp[tb]);
        Overflow = 0;
        L_c = L_macNs(L_c, 0, 0);
#endif
    }
    L_tmp = norm_llQ31(L_c, L_tmp, &shift);
    /* float: dE = (float)sqrt(dE / 24.f); basop: */
@@ -957,7 +963,11 @@ static void IGF_appl(IGF_DEC_PRIVATE_DATA_HANDLE hPrivate
        sum       = shl(sum, shift);                                          /* exponent of sum: sub(15, shift) */

        /* divide E by sum */
#ifdef BASOP_NOGLOB           /* Critical Carry/Overflow*/
        tmp       = div_s(shr(round_fx_o(E, &Overflow), 1), sum);                          /* shift E 1 bit to the right in order to make it smaller than sum */
#else
        tmp       = div_s(shr(round_fx(E), 1), sum);                          /* shift E 1 bit to the right in order to make it smaller than sum */
#endif
        tmp_e     = sub(add(E_e, 1), sub(15, shift));                         /* 15Q0 | sum is 15Q0 */

        /* multiply the result by the hopsize */
@@ -1270,7 +1280,9 @@ static void IGF_RefineGrid(H_IGF_GRID hGrid
    Word16 sfb;
    Word16 tmp;
    Word16 delta;

#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif

    set16_fx(a, 0, IGF_MAX_SFB+1);

@@ -1284,7 +1296,11 @@ static void IGF_RefineGrid(H_IGF_GRID hGrid
        move16();
        tmp    = add(tmp, 1);
        delta  = sub(hGrid->swb_offset[sfb+1], hGrid->swb_offset[sfb]);
#ifdef BASOP_NOGLOB  /* TBV for 16 kHz, 9.6kbps dtx condition, hGrid->swb_offset[sfb+1] points to an uninit value */
        delta  = mac_r(0x00195000, 29491/*0.45f Q16*/, shl_o(delta, 5, &Overflow));
#else
        delta  = mac_r(0x00195000, 29491/*0.45f Q16*/, shl(delta, 5));
#endif
        a[tmp] = add(hGrid->swb_offset[sfb], shr(delta, 6));
        move16();
        if (s_and(a[tmp], 1) != 0)
+10 −3
Original line number Diff line number Diff line
@@ -57,7 +57,9 @@ static void DTFS_dequant_cw_fx(
    Word16 exp, frac, exp1;
    Word32 L_tmp, L_temp;
    Word32 L_tmp2;

#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
    IF(num_erb_fx == NUM_ERB_NB)
    {
        PowerCB_fx = PowerCB_NB_fx;
@@ -133,8 +135,11 @@ static void DTFS_dequant_cw_fx(
    frac = L_Extract_lc(L_tmp, &exp1); /* Extract exponent  */
    L_tmp = Pow2(14, frac);
    exp1 = sub(exp1, 14);
#ifdef BASOP_NOGLOB
    L_temp = L_shl_o(L_tmp, add(exp1, 15), &Overflow); /* Q15 */
#else
    L_temp = L_shl(L_tmp, add(exp1, 15)); /* Q15 */

#endif
    L_tmp2 = L_temp;
    if (GE_32(L_temp, 2147483647))
    {
@@ -258,7 +263,9 @@ ivas_error ppp_quarter_decoder_fx(
    Word32 L_tmp, L_tmp1;
    Word16 tmp, exp;
    ivas_error error;

#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
    error = IVAS_ERR_OK;
    move16();
    IF ((error = DTFS_new_fx(&PREVDTFS_FX)) != IVAS_ERR_OK)