Commit 5cc822f3 authored by multrus's avatar multrus
Browse files

various smaller improvements

parent 48f8f337
Loading
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -1162,7 +1162,11 @@ void con_tcx_ivas_fx(
    ELSE
    {
        /* apply pre-emphasis to the signal */
#ifndef HARMONIZE_2446_CON_TCX_FX
        mem = shl( synth[( -L_frame - 1 )], st->Q_syn_factor ); /*hTcxDec->Q_synth_factor_old*/
#else
        mem = shl_sat( synth[( -L_frame - 1 )], st->Q_syn_factor ); /* hTcxDec->Q_synth_factor_old */
#endif
        move16();
#ifndef HARMONIZE_2446_CON_TCX_FX
        Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-L_frame] ), st->preemph_fac, L_frame, &mem, 1 );
@@ -1237,13 +1241,13 @@ void con_tcx_ivas_fx(
            tcxltp_pitch_tmp = L_add( L_deposit_h( hTcxLtpDec->tcxltp_pitch_int ), L_shl( L_deposit_l( div_s( hTcxLtpDec->tcxltp_pitch_fr, st->pit_res_max ) ), 1 ) ); /*15Q16*/
            scale_tmp = mult_r( hTcxDec->L_frameTCX, getInvFrameLen( st->L_frame ) );                                                                                  /*getInvFrameLen()->9Q6*/
            tmp_shift = norm_s( scale_tmp );

#ifndef HARMONIZE_2446_CON_TCX_FX
            predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/
#else
            predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl_sat( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/
#endif // !HARMONIZE_2446_CON_TCX_FX


            T0 = round_fx( predPitchLag ); /*Q0*/

            test();
@@ -1528,11 +1532,7 @@ void con_tcx_ivas_fx(
    /*-----------------------------------------------------------------*
     * Construct the random part of excitation
     *-----------------------------------------------------------------*/
#ifndef HARMONIZE_2446_CON_TCX_FX
    IF( NE_16( coh, -16384 ) )
#else
    IF( NE_16( coh, -16384 ) )
#endif // !HARMONIZE_2446_CON_TCX_FX
    {
        Word16 tmpSeed1;
        Word16 alpha_coh;
@@ -1600,7 +1600,7 @@ void con_tcx_ivas_fx(
#ifndef HARMONIZE_2446_CON_TCX_FX
        tmp_loop = add(add(L_frame, shr(L_frame, 1)), shl((L_FIR_FER2, 1));
#else
        tmp_loop = add( add( L_frame, shr( L_frame, 1 ) ), shl_sat( L_FIR_FER2, 1 ) );
        tmp_loop = add( add( L_frame, shr( L_frame, 1 ) ), 2 * L_FIR_FER2 );
#endif // !HARMONIZE_2446_CON_TCX_FX
       
        FOR( ; i < tmp_loop; i++ )
@@ -1805,7 +1805,6 @@ void con_tcx_ivas_fx(

#endif // !HARMONIZE_2446_CON_TCX_FX


    test();
    test();
    IF( EQ_16( st->last_good, UNVOICED_CLAS ) && NE_16( st->core_ext_mode, UNVOICED ) )
@@ -1908,6 +1907,7 @@ void con_tcx_ivas_fx(

    syn = buf + M;             /*Q_syn*/
    Copy( synth - M, buf, M ); /*Q_syn*/

#ifndef HARMONIZE_2446_CON_TCX_FX
    scf = norm_s( tmp_deemph );
    new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow
@@ -1931,7 +1931,6 @@ void con_tcx_ivas_fx(
    }
#endif // !HARMONIZE_2446_CON_TCX_FX


    tmp16 = s_min( new_Q, st->prev_Q_syn );
    st->prev_Q_syn = new_Q;
    move16();
@@ -1941,8 +1940,8 @@ void con_tcx_ivas_fx(
    move16();

    Copy_Scale_sig( buf, mem_syn, M, exp_scale ); /* Q: tmp16 */
#ifndef HARMONIZE_2446_CON_TCX_FX

#ifndef HARMONIZE_2446_CON_TCX_FX
    if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) )
    {
        Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf;
@@ -1951,7 +1950,6 @@ void con_tcx_ivas_fx(

    st->Q_syn = Q_syn;
    move16();

#else
    IF( NE_16( st->element_mode, EVS_MONO ) )
    {
@@ -1985,6 +1983,7 @@ void con_tcx_ivas_fx(
        move16();
    }
#endif // !HARMONIZE_2446_CON_TCX_FX

    /*buf[OLD_EXC_SIZE_DEC;3/2 L_frame] Q1: exc*/
    /*buf[0;M] Q0: mem_syn*/
    IF( A_cng != NULL )