Commit c757fa36 authored by vaillancour's avatar vaillancour
Browse files

Correction on compl saturations for 26.444

parent 8127afeb
Loading
Loading
Loading
Loading
+40 −8
Original line number Diff line number Diff line
@@ -1245,11 +1245,23 @@ void interpolate_3_over_1_allpass_fx(
        Vu[1] = mem[1] + filt_coeff[1] * ( Vu[0] - mem[2] );
        mem[3] = mem[2] + filt_coeff[2] * ( Vu[1] - mem[3] );*/

#ifdef BASOP_NOGLOB
        Vu[0] = add_sat( mem_fx[0], mult_r( filt_coeff_fx[0], sub_sat( input_fx[i], mem_fx[1] ) ) );
#else
        Vu[0] = add( mem_fx[0], mult_r( filt_coeff_fx[0], sub( input_fx[i], mem_fx[1] ) ) );
#endif
        move16();/* all Vu's in : Q_current*/
#ifdef BASOP_NOGLOB
        Vu[1] = add_sat( mem_fx[1], mult_r( filt_coeff_fx[1], sub_sat( Vu[0], mem_fx[2] ) ) );
#else
        Vu[1] = add( mem_fx[1], mult_r( filt_coeff_fx[1], sub( Vu[0], mem_fx[2] ) ) );
#endif
        move16();
#ifdef BASOP_NOGLOB
        mem_fx[3] = add_sat( mem_fx[2], mult_r( filt_coeff_fx[2], sub_sat( Vu[1], mem_fx[3] ) ) );
#else
        mem_fx[3] = add( mem_fx[2], mult_r( filt_coeff_fx[2], sub( Vu[1], mem_fx[3] ) ) );
#endif
        move16();


@@ -1264,9 +1276,17 @@ void interpolate_3_over_1_allpass_fx(
        /* Vm[0] = mem[0] + filt_coeff[3] * (input[i]-mem[4]);
        Vm[1] = mem[4] + filt_coeff[4] * (Vm[0]-mem[5]);
        mem[6] = mem[5] + filt_coeff[5] * (Vm[1]-mem[6]); */
#ifdef BASOP_NOGLOB
        Vm[0] = add_sat( mem_fx[0], mult_r( filt_coeff_fx[3], sub_sat( input_fx[i], mem_fx[4] ) ) );
#else
        Vm[0] = add( mem_fx[0], mult_r( filt_coeff_fx[3], sub( input_fx[i], mem_fx[4] ) ) );
#endif
        move16();
#ifdef BASOP_NOGLOB
        Vm[1] = add_sat( mem_fx[4], mult_r( filt_coeff_fx[4], sub_sat( Vm[0], mem_fx[5] ) ) );
#else
        Vm[1] = add( mem_fx[4], mult_r( filt_coeff_fx[4], sub( Vm[0], mem_fx[5] ) ) );
#endif
        move16();
#ifdef BASOP_NOGLOB
        mem_fx[6] = add_sat( mem_fx[5], mult_r( filt_coeff_fx[5], sub_sat( Vm[1], mem_fx[6] ) ) );
@@ -1286,9 +1306,17 @@ void interpolate_3_over_1_allpass_fx(
        /* Vl[0] = mem[0] + filt_coeff[6] * (input[i]-mem[7]);
        Vl[1] = mem[7] + filt_coeff[7] * (Vl[0]-mem[8]);
        mem[9] = mem[8] + filt_coeff[8] * (Vl[1]-mem[9]); */
#ifdef BASOP_NOGLOB
        Vl[0] = add_sat( mem_fx[0], mult_r( filt_coeff_fx[6], sub_sat( input_fx[i], mem_fx[7] ) ) );
#else
        Vl[0] = add( mem_fx[0], mult_r( filt_coeff_fx[6], sub( input_fx[i], mem_fx[7] ) ) );
#endif
        move16();
#ifdef BASOP_NOGLOB
        Vl[1] = add_sat( mem_fx[7], mult_r( filt_coeff_fx[7], sub_sat( Vl[0], mem_fx[8] ) ) );
#else
        Vl[1] = add( mem_fx[7], mult_r( filt_coeff_fx[7], sub( Vl[0], mem_fx[8] ) ) );
#endif
        move16();
#ifdef BASOP_NOGLOB
        mem_fx[9] = add_sat( mem_fx[8], mult_r( filt_coeff_fx[8], sub_sat( Vl[1], mem_fx[9] ) ) );
@@ -1311,7 +1339,11 @@ void interpolate_3_over_1_allpass_fx(
    {
        mem_temp = out_fx[i];
        move16();
#ifdef BASOP_NOGLOB
        out_fx[i] = sub_sat( mult_r( 18768 /*0.57276865021499168f Q15*/, add_sat( mem_fx[12], mem_fx[11] ) ), mult_r( 2425 /*0.074004974641176793f Q15*/, add_sat( mem_temp, mem_fx[10] ) ) );
#else
        out_fx[i] = sub( mult_r( 18768 /*0.57276865021499168f Q15*/, add( mem_fx[12], mem_fx[11] ) ), mult_r( 2425 /*0.074004974641176793f Q15*/, add( mem_temp, mem_fx[10] ) ) );
#endif
        mem_fx[10] = mem_fx[11];
        move16();
        mem_fx[11] = mem_fx[12];
+35 −7
Original line number Diff line number Diff line
@@ -1491,7 +1491,11 @@ void decoder_tcx_post(Decoder_State *st_fx,
#endif
            FOR( i=0; i < hTcxDec->L_frameTCX; i++ )
            {
#ifdef BASOP_NOGLOB
                synthFB[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, synthFB[i] ), 1 ) );
#else
                synthFB[i] = round_fx( L_shl( Mpy_32_16_1( conceal_eof_gainFB, synthFB[i] ), 1 ) );
#endif
                move16();
#ifdef BASOP_NOGLOB
                conceal_eof_gainFB = L_sub_o(conceal_eof_gainFB, stepFB, &Overflow);
@@ -1503,7 +1507,11 @@ void decoder_tcx_post(Decoder_State *st_fx,
        conceal_eof_gain32 = L_deposit_h(hTcxDec->conceal_eof_gain); /*Q30*/
        FOR( i=0; i < st_fx->L_frame; i++ )
        {
#ifdef BASOP_NOGLOB
            xn_buf[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gain32 /*Q30*/, xn_buf[i] ), 1 ) );
#else
            xn_buf[i] = round_fx( L_shl( Mpy_32_16_1( conceal_eof_gain32 /*Q30*/, xn_buf[i] ), 1 ) );
#endif
            move16();
#ifdef BASOP_NOGLOB
            conceal_eof_gain32 = L_sub_o(conceal_eof_gain32, step, &Overflow);
@@ -2198,13 +2206,21 @@ void IMDCT(Word32 *x, Word16 x_e,
                    FOR (i = 0; i < tmp3; i++)
                    {
                        tmp2 = add(xn_buf[i+tmp1], mult_r(old_syn_overl[i], tcx_mdct_window_half[i].v.re));
#ifdef BASOP_NOGLOB
                        xn_buf[i + tmp1] = shl_sat( tmp2, TCX_IMDCT_HEADROOM );
#else
                        xn_buf[i + tmp1] = shl( tmp2, TCX_IMDCT_HEADROOM );
#endif
                        move16();
                    }
                    FOR ( ; i < tcx_mdct_window_half_length; i++)
                    {
                        tmp2 = add(xn_buf[i+tmp1], mult_r(old_syn_overl[i], tcx_mdct_window_half[tcx_mdct_window_half_length-1-i].v.im));
#ifdef BASOP_NOGLOB
                        xn_buf[i + tmp1] = shl_sat( tmp2, TCX_IMDCT_HEADROOM );
#else
                        xn_buf[i + tmp1] = shl( tmp2, TCX_IMDCT_HEADROOM );
#endif
                        move16();
                    }
                    IF (LT_16(add(i, tmp1), L_frame))
@@ -2251,14 +2267,22 @@ void IMDCT(Word32 *x, Word16 x_e,
                    tmp1 = shr(overlap, 1);
                    FOR (i=0; i < tmp1; i++)
                    {
#ifdef BASOP_NOGLOB
                        xn_buf[i] = shl_sat( xn_buf[i], TCX_IMDCT_HEADROOM );
#else
                        xn_buf[i] = shl( xn_buf[i], TCX_IMDCT_HEADROOM );
#endif
                        move16();
                    }

                    tmpP16 = xn_buf + tmp1;
                    FOR (i=0; i < overlap; i++)
                    {
#ifdef BASOP_NOGLOB
                        tmpP16[i] = shl_sat( add( tmpP16[i], old_syn_overl[i] ), TCX_IMDCT_HEADROOM );
#else
                        tmpP16[i] = shl( add( tmpP16[i], old_syn_overl[i] ), TCX_IMDCT_HEADROOM );
#endif
                        move16();
                    }

@@ -2266,7 +2290,11 @@ void IMDCT(Word32 *x, Word16 x_e,
                    {
                        FOR (i = add(i, tmp1); i < L_frame; i++)
                        {
#ifdef BASOP_NOGLOB
                            xn_buf[i] = shl_sat( xn_buf[i], TCX_IMDCT_HEADROOM );
#else
                            xn_buf[i] = shl( xn_buf[i], TCX_IMDCT_HEADROOM );
#endif
                            move16();
                        }
                    }
+10 −2
Original line number Diff line number Diff line
@@ -1046,13 +1046,21 @@ void con_tcx(

    FOR (i=0; i<W2; i++)
    {
#ifdef BASOP_NOGLOB
        hTcxDec->syn_Overl_TDACFB[i] = add_sat( buf[i], buf[W1 - 1 - i] );
#else
        hTcxDec->syn_Overl_TDACFB[i] = add( buf[i], buf[W1 - 1 - i] );
#endif
        move16();
    }

    FOR (i=0; i<W2; i++)
    {
#ifdef BASOP_NOGLOB
        hTcxDec->syn_Overl_TDACFB[W2 + i] = add_sat( buf[W2 + i], buf[W1 - 1 - W2 - i] );
#else
        hTcxDec->syn_Overl_TDACFB[W2 + i] = add( buf[W2 + i], buf[W1 - 1 - W2 - i] );
#endif
        move16();
    }

+5 −1
Original line number Diff line number Diff line
@@ -174,7 +174,11 @@ void gain_dec_tc_fx(
    IF( GT_16(nBits,3))
    {
        wgain_code = gain_dequant_fx( index, G_CODE_MIN_TC_Q15, G_CODE_MAX_TC_Q0, nBits, &expg );
#ifdef BASOP_NOGLOB
        wgain_code = shl_sat( wgain_code, add( expg, 13 ) ); /* wgain_code in Q13*/
#else
        wgain_code = shl( wgain_code, add( expg, 13 ) ); /* wgain_code in Q13*/
#endif
    }
    ELSE /* nBits == 3 */
    {
+10 −3
Original line number Diff line number Diff line
@@ -1538,15 +1538,22 @@ void waveform_adj2_fix( Word16 *overlapbuf,
                    ratio = extract_l(L_shr(L_mult(i, ptable), tablescale));
                    dat= shl(sbuf[i],s16MaxCoefNorm);
                    temp_OUT= mult(*recovery_gain, sub(32767,ratio));
#ifdef BASOP_NOGLOB
                    outx_new[i] = round_fx_sat( L_add_sat( L_shr( L_mult( temp_OUT, dat ), s16MaxCoefNorm - 1 ), L_shr( L_mult( shl( outx_new[i], s16MaxCoefNorm2 ), ratio ), s16MaxCoefNorm2 ) ) );
#else
                    outx_new[i] = round_fx( L_add( L_shr( L_mult( temp_OUT, dat ), s16MaxCoefNorm - 1 ), L_shr( L_mult( shl( outx_new[i], s16MaxCoefNorm2 ), ratio ), s16MaxCoefNorm2 ) ) );
#endif
                    move16();
                    *recovery_gain =sub(*recovery_gain,shr_r(step_concealgain,1)); /* q14 */
                }
                FOR (i = gain_zero_start; i < Framesize; i++)
                {
                    ratio = extract_l(L_shr(L_mult(i, ptable), tablescale));
#ifdef BASOP_NOGLOB
                    outx_new[i] = round_fx_sat( L_shr( L_mult( shl( outx_new[i], s16MaxCoefNorm2 ), ratio ), s16MaxCoefNorm2 ) );
#else
                    outx_new[i] = round_fx( L_shr( L_mult( shl( outx_new[i], s16MaxCoefNorm2 ), ratio ), s16MaxCoefNorm2 ) );

#endif
                }

                if (*recovery_gain < 0)