Commit 513e790f authored by vaillancour's avatar vaillancour
Browse files

Fixes for stv16c_dtx_5900_16kHz.b10.COD

parent 2b8aa34a
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -73,18 +73,16 @@ cldfb_init_proto_and_twiddles(HANDLE_CLDFB_FILTER_BANK hs);
																					 rxr+=sx, rxi+=sx, ixr+=sx, ixi+=sx, cr+=sr, ci+=sr
#ifdef BASOP_NOGLOB

#define add1(y1,y2,y3,y4,rr12,ri12,ir12,ii12,s)             { Flag Overflow = 0;\
                                                                *y1 = round_fx_o(L_shl_o(L_negate(L_add_o(rr12,ii12, &Overflow)),s, &Overflow), &Overflow);                 \
                                                                *y2 = round_fx_o(L_shl_o(L_negate(L_add_o(ri12,ir12, &Overflow)),s, &Overflow), &Overflow);                 \
                                                                *y3 = round_fx_o(L_shl_o(L_sub_o(rr12,ii12, &Overflow),s, &Overflow), &Overflow);                           \
                                                                *y4 = round_fx_o(L_shl_o(L_sub_o(ir12,ri12, &Overflow),s, &Overflow), &Overflow);}                          \
#define add1(y1,y2,y3,y4,rr12,ri12,ir12,ii12,s)                 *y1 = round_fx_sat(L_shl_sat(L_negate(L_add_sat(rr12,ii12)),s));                 \
                                                                *y2 = round_fx_sat(L_shl_sat(L_negate(L_add_sat(ri12,ir12)),s));                 \
                                                                *y3 = round_fx_sat(L_shl_sat(L_sub_sat(rr12,ii12),s));                           \
                                                                *y4 = round_fx_sat(L_shl_sat(L_sub_sat(ir12,ri12),s));                           \
                                                                y1+=2, y2-=2, y3-=2, y4+=2

#define add2(y1,y2,y3,y4,rr12,ri12,ir12,ii12,s)             { Flag Overflow = 0;\
                                                                *y1 = round_fx_o(L_shl_o(L_add_o(ri12,ir12, &Overflow),s, &Overflow), &Overflow);                           \
                                                                *y2 = round_fx_o(L_shl_o(L_add_o(rr12,ii12, &Overflow),s, &Overflow), &Overflow);                           \
                                                                *y3 = round_fx_o(L_shl_o(L_sub_o(ir12,ri12, &Overflow),s, &Overflow), &Overflow);                           \
                                                                *y4 = round_fx_o(L_shl_o(L_sub_o(rr12,ii12, &Overflow),s, &Overflow), &Overflow);}                          \
#define add2(y1,y2,y3,y4,rr12,ri12,ir12,ii12,s)                 *y1 = round_fx_sat(L_shl_sat(L_add_sat(ri12,ir12),s));                           \
                                                                *y2 = round_fx_sat(L_shl_sat(L_add_sat(rr12,ii12),s));                           \
                                                                *y3 = round_fx_sat(L_shl_sat(L_sub_sat(ir12,ri12),s));                           \
                                                                *y4 = round_fx_sat(L_shl_sat(L_sub_sat(rr12,ii12),s));                          \
                                                                y1+=2, y2-=2, y3-=2, y4+=2

#else
+20 −37
Original line number Diff line number Diff line
@@ -499,15 +499,13 @@ void Scale_sig(
{
    Word16 i;
    Word16 tmp;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif

    IF (exp0 > 0)
    {
        FOR (i = 0; i < lg; i++)
        {
#ifdef BASOP_NOGLOB
            x[i] = shl_o(x[i], exp0, &Overflow);
            x[i] = shl_sat(x[i], exp0);
#else /* BASOP_NOGLOB */
            x[i] = shl(x[i], exp0);
#endif /* BASOP_NOGLOB */
@@ -518,7 +516,7 @@ void Scale_sig(
    IF (exp0 < 0)
    {
#ifdef BASOP_NOGLOB
        tmp = shl_o(-32768, exp0, &Overflow); /* we use negative to correctly represent 1.0 */
        tmp = shl_sat(-32768, exp0); /* we use negative to correctly represent 1.0 */
#else
        BASOP_SATURATE_WARNING_OFF_EVS
        tmp = shl(-32768, exp0); /* we use negative to correctly represent 1.0 */
@@ -527,7 +525,7 @@ void Scale_sig(
        FOR (i = 0; i < lg; i++)
        {
#ifdef BASOP_NOGLOB
            x[i] = msu_ro(0, x[i], tmp, &Overflow);
            x[i] = msu_r_sat(0, x[i], tmp);
#else
            x[i] = msu_r(0, x[i], tmp);
#endif
@@ -565,14 +563,11 @@ void Vr_add(
)
{
    Word16 i;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif

    FOR (i=0; i<Len; i++)
    {
#ifdef BASOP_NOGLOB
        out[i] = add_o(in1[i], in2[i], &Overflow);
        out[i] = add_sat(in1[i], in2[i]);
#else /* BASOP_NOGLOB */
        out[i] = add(in1[i], in2[i]);
#endif /* BASOP_NOGLOB */
@@ -851,9 +846,7 @@ Word32 var_fx_32( /* o: variance of vector Qx+
    Word16 i;
    Word16 tmp, exp, inv_len;
    Word32 L_tmp;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif


    L_tmp = L_add(x[0], 0);
    FOR(i=1; i<len; i++)
@@ -870,7 +863,7 @@ Word32 var_fx_32( /* o: variance of vector Qx+
    {
        tmp = sub(x[i],m); /*Qx */
#ifdef BASOP_NOGLOB
        v = L_mac0_o(v,tmp,tmp, &Overflow); /*(Qx+Qx) */
        v = L_mac0_sat(v,tmp,tmp); /*(Qx+Qx) */
#else /* BASOP_NOGLOB */
        v = L_mac0(v,tmp,tmp); /*(Qx+Qx) */
#endif /* BASOP_NOGLOB */
@@ -888,7 +881,7 @@ Word32 var_fx_32( /* o: variance of vector Qx+
 * convolution are considered.
 *-------------------------------------------------------------------*/

#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB      /*Critical overflow */
Flag conv_fx(
#else
void conv_fx(
@@ -942,9 +935,6 @@ Word16 var_fx( /* o: variance of vector Qx*/
    Word16 i;
    Word16 tmp, exp, inv_len;
    Word32 L_tmp;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif

    L_tmp = x[0];
    FOR(i=1; i<len; i++)
@@ -960,8 +950,8 @@ Word16 var_fx( /* o: variance of vector Qx*/
    FOR (i = 0; i < len; i++)
    {
#ifdef BASOP_NOGLOB
        tmp = sub_o(x[i],m, &Overflow); /*Qx */
        v = L_mac0_o(v,tmp,tmp, &Overflow); /*(Qx+Qx) */
        tmp = sub_sat(x[i],m); /*Qx */
        v = L_mac0_sat(v,tmp,tmp); /*(Qx+Qx) */
#else
        tmp = sub(x[i],m); /*Qx */
        v = L_mac0(v,tmp,tmp); /*(Qx+Qx) */
@@ -969,7 +959,7 @@ Word16 var_fx( /* o: variance of vector Qx*/
    }
    L_tmp = Mult_32_16(v,inv_len); /*Q(14-exp+Qx+Qx) */
#ifdef BASOP_NOGLOB
    v_16 = round_fx_o(L_shl_o(L_tmp,add(exp,sub(2,Qx)), &Overflow), &Overflow); /*Qx */
    v_16 = round_fx_sat(L_shl_sat(L_tmp,add(exp,sub(2,Qx)))); /*Qx */
#else /* BASOP_NOGLOB */
    v_16 = round_fx(L_shl(L_tmp,add(exp,sub(2,Qx)))); /*Qx */
#endif /* BASOP_NOGLOB */
@@ -1061,14 +1051,11 @@ void Vr_subt(
)
{
    Word16 i;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif

    FOR (i=0; i<N ; i++)
    {
#ifdef BASOP_NOGLOB
        y[i] = sub_o(x1[i], x2[i], &Overflow);
        y[i] = sub_sat(x1[i], x2[i]);
#else /* BASOP_NOGLOB */
        y[i] = sub(x1[i], x2[i]);
#endif /* BASOP_NOGLOB */
@@ -1352,9 +1339,6 @@ Word16 emaximum_fx( /* o : return index with max energy value in
    Word16 j, ind;
    Word32 L_tmp, L_tmp1;
    Word32 emax;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif

    emax = L_mult0(vec[0], vec[0]);
    ind = 0;
@@ -1373,7 +1357,7 @@ Word16 emaximum_fx( /* o : return index with max energy value in
    }

#ifdef BASOP_NOGLOB
    *ener_max = L_shr_o(emax, add(Qvec, Qvec), &Overflow);
    *ener_max = L_shr_sat(emax, add(Qvec, Qvec));
#else /* BASOP_NOGLOB */
    *ener_max = L_shr(emax, add(Qvec, Qvec));
#endif /* BASOP_NOGLOB */
@@ -1415,14 +1399,12 @@ Word32 sum32_fx( /* o : sum of all vector elements Qx*/
{
    Word16 i;
    Word32 tmp;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif

    tmp = L_deposit_l(0);
    FOR( i=0; i<lvec; i++ )
    {
#ifdef BASOP_NOGLOB
        tmp = L_add_o(tmp,vec[i], &Overflow); /*Qx */
        tmp = L_add_sat(tmp,vec[i]); /*Qx */
#else /* BASOP_NOGLOB */
        tmp = L_add(tmp,vec[i]); /*Qx */
#endif /* BASOP_NOGLOB */
@@ -1650,9 +1632,6 @@ void pz_filter_sp_fx (
    Word16 s_mem;
    Word32 Ltemp1;
    Word32 Lacc;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
    s = negate( Qa );
    s = add( s, s );  /* s=-2Qa*/
    s = add( s, 1 );
@@ -1667,7 +1646,7 @@ void pz_filter_sp_fx (

        Lacc = L_shr( Lacc, 1 );
#ifdef BASOP_NOGLOB
        Ltemp1 = L_add_o( L_shl_o( Lacc, Qa, &Overflow), 0x08000, &Overflow);
        Ltemp1 = L_add_sat( L_shl_sat( Lacc, Qa), 0x08000);
#else
        Ltemp1 = L_add( L_shl( Lacc, Qa ), 0x08000 );
#endif
@@ -1688,7 +1667,11 @@ void pz_filter_sp_fx (
        buf[0] = s_mem;
        move16();

#ifdef BASOP_NOGLOB
        Ltemp1 = L_add_sat( L_shr_sat( Lacc, s ), 0x08000 ); /*  Ltemp1 in Qc+Qa+Qn=Q(Qn) */
#else
        Ltemp1 = L_add( L_shr( Lacc, s ), 0x08000 ); /*  Ltemp1 in Qc+Qa+Qn=Q(Qn) */
#endif
        y[i] = extract_h( Ltemp1 );  /*  y[i] in Qn */
    }
}
+7 −5
Original line number Diff line number Diff line
@@ -57,9 +57,7 @@ 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;
@@ -112,9 +110,13 @@ static void DTFS_dequant_cw_fx(
    /* Power Dequantization */

    tmp_fx = shl(POWER_IDX_fx, 1); /*  tmp=2*POWER_IDX */
#ifdef BASOP_NOGLOB
    *lastLgainD_fx = add_sat(*lastLgainD_fx, PowerCB_fx[tmp_fx]); /*  Q11 */
    *lastHgainD_fx = add_sat(*lastHgainD_fx, PowerCB_fx[tmp_fx + 1]); /*  Q11 */
#else
    *lastLgainD_fx = add(*lastLgainD_fx, PowerCB_fx[tmp_fx]); /*  Q11 */
    *lastHgainD_fx = add(*lastHgainD_fx, PowerCB_fx[tmp_fx + 1]); /*  Q11 */

#endif
    L_tmp = L_deposit_h(X_fx->lag_fx); /* Q16 */
    exp = norm_l(L_tmp);
    L_tmp = L_shl(L_tmp, exp);
@@ -136,7 +138,7 @@ static void DTFS_dequant_cw_fx(
    L_tmp = Pow2(14, frac);
    exp1 = sub(exp1, 14);
#ifdef BASOP_NOGLOB
    L_temp = L_shl_o(L_tmp, add(exp1, 15), &Overflow); /* Q15 */
    L_temp = L_shl_sat(L_tmp, add(exp1, 15) ); /* Q15 */
#else
    L_temp = L_shl(L_tmp, add(exp1, 15)); /* Q15 */
#endif
+11 −1
Original line number Diff line number Diff line
@@ -240,8 +240,13 @@ ivas_error ppp_voiced_decoder_fx(


        Ltemp=log10_fx(Ltemp); /* Ltemp=10log10(eng), Q23 */
#ifdef BASOP_NOGLOB
        Ltemp=L_add_sat(L_sub_sat(Ltemp,Ltemp_q),logLag);  /* Ltemp=10*log10(lag*eng), Q23 */
        hSC_VBR->lastLgainD_fx = round_fx_sat(L_shl_sat((Word32)Mpy_32_16(extract_h(Ltemp), extract_l(Ltemp), 0x6666), 1)); /* Q11 */
#else
        Ltemp=L_add(L_sub(Ltemp,Ltemp_q),logLag);  /* Ltemp=10*log10(lag*eng), Q23 */
        hSC_VBR->lastLgainD_fx = round_fx(L_shl((Word32)Mpy_32_16(extract_h(Ltemp), extract_l(Ltemp), 0x6666), 1)); /* Q11 */
#endif



@@ -250,8 +255,13 @@ ivas_error ppp_voiced_decoder_fx(


        Ltemp=log10_fx(Ltemp);
#ifdef BASOP_NOGLOB
        Ltemp=L_add_sat(L_sub_sat(Ltemp,Ltemp_q),logLag); /* Ltemp=10*log10(lag*eng), Q23 */
        hSC_VBR->lastHgainD_fx=round_fx_sat(L_shl_sat((Word32)Mpy_32_16(extract_h(Ltemp),extract_l(Ltemp),0x6666),1)); /* Q11 */
#else
        Ltemp=L_add(L_sub(Ltemp,Ltemp_q),logLag); /* Ltemp=10*log10(lag*eng), Q23 */
        hSC_VBR->lastHgainD_fx=round_fx(L_shl((Word32)Mpy_32_16(extract_h(Ltemp),extract_l(Ltemp),0x6666),1)); /* Q11 */
#endif


        /* Need to unify the Q factors of both bands */