Commit 27f02fb0 authored by vaillancour's avatar vaillancour
Browse files

using only EVS + adapt, maybe small issus in generic mode, tbc

parent d5a40ced
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -84,24 +84,25 @@
//#define FORCE_GENERIC
//#define ALLOW_TM  /* To allow some transition mode */

//#define REMOVE_A_SCALE




//#define USE_EVS_FUNC_LP        // -> BE for IVAS, but condition seems missing compared to float for rf condition
#define USE_EVS_FUNC_LP        // -> BE for IVAS, but condition seems missing compared to float for rf condition
#ifdef USE_EVS_FUNC_LP        
    //#define USE_EVS_FUNC_LP_GAIN  /* (BE) Deactivate gain Q function as they are identical to EVS, except for a couple of lines now added */
    // Keep deactivated as they are only replaced in generic so far
#endif

//#define USE_EVS_FUNC_FT_T      // replacing the 32 bits find target with the EVS find target for transition
#if 0        // diminish MLD by ~1 on NO_S
#if 1        // diminish MLD by ~1 on NO_S

#define TRY_SHIFT_ACELP         // Adding similar mecanism as shift for EVS, allows to use only 1 bit headroom instead of 2
#define USE_EVS_FUNC_FT_G      // replacing the 32 bits find target with the EVS find target for generic    
#define TRY_SHIFT_ACELP         // incease MDL (09/04) Adding similar mecanism as shift for EVS, allows to use only 1 bit headroom instead of 2
//#define USE_EVS_FUNC_FT_G      // replacing the 32 bits find target with the EVS find target for generic    
#ifdef TRY_SHIFT_ACELP
    #define USE_EVS_Est_tilt2_FUNC
    #define TRY_SHIFT_ACELP_2
    #define REMOVE_A_SCALE
#endif

#define USE_EVS_FCB_1
+2 −10
Original line number Diff line number Diff line
@@ -1265,11 +1265,6 @@ ivas_error acelp_core_enc_ivas_fx(
        }
        // Scaling Aq to Q12
#ifndef REMOVE_A_SCALE
        FOR( Word16 k = 0; k < NB_SUBFR16k; k++ )
        {
            Scale_sig( &Aq[( M + 1 ) * k], M + 1, sub( norm_s( Aq[( M + 1 ) * k] ), 2 ) );
        }
#else
        FOR( Word16 k = 0; k < NB_SUBFR16k; k++ )
        {
            Scale_sig( &Aq[( M + 1 ) * k], M + 1, sub( norm_s( Aq[( M + 1 ) * k] ), 2 ) );
@@ -1329,6 +1324,7 @@ ivas_error acelp_core_enc_ivas_fx(
         * Calculation of prediction for scaled innovation energy
         * (for memory-less gain quantizer)
         *---------------------------------------------------------------*/
//#undef TRY_SHIFT_ACELP
#ifdef TRY_SHIFT_ACELP        // This should be moved outside of ACELP
        {
            Word16 tmp, max;
@@ -1381,7 +1377,7 @@ ivas_error acelp_core_enc_ivas_fx(
        }
        ELSE IF( EQ_16( st->coder_type, TRANSITION ) )
        {
#if 0//def TRY_SHIFT_ACELP 
#ifdef TRY_SHIFT_ACELP 
            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, shift, Q_new );
@@ -1423,11 +1419,7 @@ ivas_error acelp_core_enc_ivas_fx(
        {
            /* GENERIC, VOICED and INACTIVE frames (coded by AVQ technology) */
#ifdef TRY_SHIFT_ACELP
#if 1
            encod_gen_voic_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, shift, Q_new );
#else
            encod_gen_voic_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, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, shift, Q_new );
#endif
#else
            encod_gen_voic_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, unbits, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, 0, Q_new );
#endif
+7 −7
Original line number Diff line number Diff line
@@ -170,9 +170,9 @@ void encod_gen_voic_fx(

    shift_wsp = add( Q_new, shift );
#ifdef TRY_SHIFT_ACELP
    if ( st_fx->element_mode > EVS_MONO )
    if ( st_fx->element_mode > EVS_MONO && LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        //shift_wsp = sub( shift_wsp, 1 );
        shift_wsp = sub( shift_wsp, 1 );
    }
#endif
    /* set and write harmonicity flag */
@@ -205,7 +205,7 @@ void encod_gen_voic_fx(
         *----------------------------------------------------------------*/

        Copy( &res_fx[i_subfr_fx], &exc_fx[i_subfr_fx], L_SUBFR ); /*Q_new*/
//#undef TRY_SHIFT_ACELP_2

#ifdef TRY_SHIFT_ACELP_2
        IF( st_fx->element_mode > EVS_MONO )
        {
@@ -573,10 +573,10 @@ void encod_gen_voic_ivas_fx(
//        shift_wsp = sub( shift_wsp, 1 );
//    }
//#endif
#if 1//def TRY_SHIFT_ACELP
#ifdef USE_EVS_FUNC_LP
    if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        //shift_wsp = sub( shift_wsp, 1 );
        shift_wsp = sub( shift_wsp, 1 );
    }
#endif
    FOR( i_subfr_fx = 0; i_subfr_fx < L_frame; i_subfr_fx += L_SUBFR )
@@ -666,7 +666,7 @@ void encod_gen_voic_ivas_fx(
        test();
        IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && NE_16( st_fx->coder_type, INACTIVE ) )
        {
#ifndef USE_EVS_FCB_5
#ifndef USE_EVS_FCB_HR_1
            transf_cdbk_enc_ivas_fx( st_fx, harm_flag_acelp, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx,
                                     xn2_fx, y1_fx, y2_fx, Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift );
#else
@@ -751,7 +751,7 @@ void encod_gen_voic_ivas_fx(
        test();
        IF( !st_fx->inactive_coder_type_flag && EQ_16( st_fx->coder_type, INACTIVE ) )
        {
#ifndef USE_EVS_FCB_5
#ifndef USE_EVS_FCB_HR_1
            transf_cdbk_enc_ivas_fx( st_fx, 0, i_subfr_fx, cn_fx, exc_fx, p_Aq_fx, p_Aw_fx, h1_fx, xn_fx, xn2_fx, y1_fx, y2_fx,
                                     Es_pred_fx, &gain_pit_fx, gain_code_fx, g_corr_fx, clip_gain_fx, &gain_preQ_fx, code_preQ_fx, unbits_fx, Q_new, shift );
#else
+12 −10
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 TRY_SHIFT_ACELP_2
    Word16 q_h1;
#endif
    BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
    SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
@@ -145,7 +148,7 @@ Word16 encod_tran_fx(
    shift_wsp = add( Q_new, shift );

#ifdef TRY_SHIFT_ACELP
    if ( st_fx->element_mode > EVS_MONO )
    if ( st_fx->element_mode > EVS_MONO && LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        shift_wsp = sub( shift_wsp, 1 );
    }
@@ -164,15 +167,14 @@ Word16 encod_tran_fx(

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

//#undef TRY_SHIFT_ACELP_2
#ifdef TRY_SHIFT_ACELP_2
        IF( st_fx->element_mode > EVS_MONO )
        {
            find_targets_ivas_new_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx,
                                      res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx );
            q_h1 = sub( 14, norm_s( h1_fx[0] ) );
            Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/
            Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) + shift );     /* set h1[] in Q14 with scaling for convolution Q14*/
            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
@@ -546,10 +548,10 @@ Word16 encod_tran_ivas_fx(
//    //if ( st_fx->core_brate < MIN_BRATE_AVQ_EXC )
//        shift_wsp = sub( shift_wsp, 1 );
//#endif
#if 1//def TRY_SHIFT_ACELP
#ifdef USE_EVS_FUNC_LP
    if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        //shift_wsp = sub( shift_wsp, 1 );
        shift_wsp = sub( shift_wsp, 1 );
    }
#endif
    /*----------------------------------------------------------------*
@@ -602,7 +604,7 @@ Word16 encod_tran_ivas_fx(
         * TC: subframe determination &
         * adaptive/glottal part of excitation construction
         *-----------------------------------------------------------------*/
#ifndef USE_EVS_FCB_5
#ifndef USE_EVS_FCB_HR_1
        transition_enc_ivas_fx( st_fx, i_subfr, &tc_subfr, &Jopt_flag, &position, &T0, &T0_frac, &T0_min, &T0_max, exc_fx, y1,
                                h1, xn, xn2, st_fx->clip_var_fx, &gain_pit, g_corr, &clip_gain, &pt_pitch, bwe_exc_fx, &unbits_ACELP, Q_new, shift );
#else
+4 −0
Original line number Diff line number Diff line
@@ -586,6 +586,10 @@ ivas_error pre_proc_front_ivas_fx(
    headroom = 2;
#else
    headroom = 1;
    if ( EQ_16( st->L_frame, L_FRAME) )
    {
        headroom = 2;
    }
#endif
    move16();

Loading