Commit 912cd006 authored by vaillancour's avatar vaillancour
Browse files

Reuse EVS for TC

parent 2693e3ff
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -88,5 +88,6 @@
#define TEST_HR
#define REUSE_EVS_ACELP
#define REUSE_EVS_ACELP_SHIFT
#define REUSE_EVS_ACELP_TC

#endif
+4 −0
Original line number Diff line number Diff line
@@ -1369,7 +1369,11 @@ ivas_error acelp_core_enc_ivas_fx(
        }
        ELSE IF( EQ_16( st->coder_type, TRANSITION ) )
        {
#ifdef REUSE_EVS_ACELP_TC
            encod_tran_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tc_subfr, position, unbits, shift, Q_new );
#else
            encod_tran_ivas_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tc_subfr, position, unbits, 0, Q_new );
#endif
        }
        ELSE IF( ppp_mode )
        {
+26 −7
Original line number Diff line number Diff line
@@ -96,6 +96,9 @@ Word16 encod_tran_fx(
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#ifdef REUSE_EVS_ACELP_TC
    Word16 q_h1;
#endif
    BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
    SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
@@ -143,7 +146,12 @@ Word16 encod_tran_fx(
    move16();
    set16_fx( code_preQ, 0, L_SUBFR );
    shift_wsp = add( Q_new, shift );

#ifdef REUSE_EVS_ACELP_TC
    if ( st_fx->element_mode > EVS_MONO && LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        shift_wsp = sub( shift_wsp, 1 );
    }
#endif
    /*----------------------------------------------------------------*
     * ACELP subframe loop
     *----------------------------------------------------------------*/
@@ -157,13 +165,24 @@ Word16 encod_tran_fx(
         *----------------------------------------------------------------*/

        Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */

#ifdef REUSE_EVS_ACELP_TC
        IF( st_fx->element_mode > EVS_MONO )
        {
            find_targets_ivas_new_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq,
                                      res_fx, L_SUBFR, p_Aw, st_fx->preemph_fac, xn, cn, h1 );
            q_h1 = sub( 14, norm_s( h1[0] ) );
            Copy_Scale_sig( h1, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/
            Scale_sig( h1, L_SUBFR, sub( 14, q_h1 ) + shift );     /* set h1[] in Q14 with scaling for convolution Q14*/
        }
        ELSE
#endif
        {
            find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq,
                             res_fx, L_SUBFR, p_Aw, st_fx->preemph_fac, xn, cn, h1 );

            Copy_Scale_sig( h1, h2_fx, L_SUBFR, -2 );
            Scale_sig( h1, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */

        }
        /* scaling of xn[] to limit dynamic at 12 bits */
        Scale_sig( xn, L_SUBFR, shift );