Commit a6ac7971 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'remove_evs_duplicates' into 'main'

Remove evs duplicates

See merge request !1300
parents 5cb8d86d 9d14ced3
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -439,6 +439,7 @@ static Word16 fcb_table(
 * Routine to allocate fixed innovation codebook bit-budget
 *--------------------------------------------------------------------*/

#ifndef REMOVE_EVS_DUPLICATES
static ivas_error acelp_FCB_allocator(
    Word16 *nBits,            /* i/o: available bit-budget    */
    Word16 fixed_cdk_index[], /* o  : codebook index       Q0 */
@@ -599,7 +600,7 @@ static ivas_error acelp_FCB_allocator(

    return error;
}

#endif
static ivas_error acelp_FCB_allocator_ivas(
    Word16 *nBits,            /* i/o: available bit-budget    */
    Word16 fixed_cdk_index[], /* o  : codebook index       Q0 */
@@ -761,6 +762,7 @@ static ivas_error acelp_FCB_allocator_ivas(
 *   - per channel bitrate minimum is 13250 kbps for ACELP@16kHz
 *--------------------------------------------------------------------*/

#ifndef REMOVE_EVS_DUPLICATES
ivas_error config_acelp1(
    const Word16 enc_dec,                  /* i  : encoder/decoder flag            */
    const Word32 total_brate,              /* i  : total bitrate                   */
@@ -1885,7 +1887,7 @@ ivas_error config_acelp1(
 *   - should be in range of <6700; 24350> for ACELP@12.8kHz
 *   - per channel bitrate minimum is 13250 kbps for ACELP@16kHz
 *--------------------------------------------------------------------*/

#endif
ivas_error config_acelp1_IVAS(
    const Word16 enc_dec,                  /* i  : encoder/decoder flag            */
    const Word32 total_brate,              /* i  : total bitrate                   */
+54 −16
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@
/* RETURN ARGUMENTS :													  */
/* _ None																  */
/*========================================================================*/

#ifndef REMOVE_EVS_DUPLICATES
void Inac_swtch_ematch_fx(
    Word16 exc2[],             /* i/o: CELP/GSC excitation buffer       Q_exc*/
    Word16 dct_exc_tmp[],      /* i  : GSC excitation in DCT domain          */
@@ -155,8 +157,7 @@ void Inac_swtch_ematch_fx(

    return;
}


#endif
void Inac_switch_ematch_ivas_fx(
    Word16 exc2[],                         /* i/o: CELP/GSC excitation buffer       Q_exc*/
    Word16 dct_exc_tmp[],                  /* i  : GSC excitation in DCT domain          */
@@ -250,6 +251,21 @@ void Inac_switch_ematch_ivas_fx(
            exp = sub( exp, 14 );
            IF( LT_16( i, 2 ) )
            {
#ifdef REMOVE_EVS_DUPLICATES
                IF( EQ_16( element_mode, EVS_MONO ) )
                {
                    FOR( j = 0; j < 8; j++ )
                    {
                        L_tmp = L_mult( *pt_exc, ftmp );
                        L_tmp = L_shl_sat( L_tmp, add( exp, 15 ) ); /* Q(Q_exc) -> Q(15+Q_exc)*/
                        *pt_exc = round_fx_sat( L_tmp );            /*Q_exc - 1*/
                        move16();
                        pt_exc++;
                    }
                }
                ELSE
#endif
                {
                    FOR( j = 0; j < 8; j++ )
                    {
                        L_tmp = L_mult0( *pt_exc, ftmp );
@@ -259,8 +275,24 @@ void Inac_switch_ematch_ivas_fx(
                        pt_exc++;
                    }
                }
            }
            ELSE
            {
#ifdef REMOVE_EVS_DUPLICATES
                IF( EQ_16( element_mode, EVS_MONO ) )
                {
                    FOR( j = 0; j < 16; j++ )
                    {
                        L_tmp = L_mult( *pt_exc, ftmp );
                        L_tmp = L_shl_sat( L_tmp, add( exp, 15 ) ); /* Q(Q_exc) -> Q(15+Q_exc)*/
                        *pt_exc = round_fx_sat( L_tmp );            /*Q_exc - 1*/
                        move16();
                        pt_exc++;
                    }
                }
                ELSE
#endif
                {
                    FOR( j = 0; j < 16; j++ )
                    {
                        L_tmp = L_mult0( *pt_exc, ftmp );
@@ -271,10 +303,16 @@ void Inac_switch_ematch_ivas_fx(
                    }
                }
            }
        }

        /* Going back to time */
#ifdef REMOVE_EVS_DUPLICATES
        IF( GT_16( element_mode, EVS_MONO ) )
#endif
        {
            Scale_sig( dct_exc_tmp, 240, 1 ); // Q_exc
            Scale_sig( exc2, 240, 1 );        // Q_exc
        }
        edct_16fx( dct_exc_tmp, exc2, L_frame, 5, element_mode );
    }

+42 −18
Original line number Diff line number Diff line
@@ -1332,6 +1332,21 @@ void highband_exc_dct_in_ivas_fx(
        }
    }


#ifdef REMOVE_EVS_DUPLICATES
    IF( EQ_16( element_mode, EVS_MONO ) )
    {
        Comp_and_apply_gain_fx( exc_diffQ, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 0, Qexc_diffQ, *Q_exc );

        IF( exc_wo_nf != NULL )
        {
            Comp_and_apply_gain_fx( exc_wo_nf, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 1, Qexc_diffQ, *Q_exc );
            Vr_add( exc_dct_in, exc_wo_nf, exc_wo_nf, L_frame );
        }
    }
    ELSE
    {
#endif
        Word16 Q_tmp = *Q_exc;
        move16();
        Word16 Q_old = *Q_exc;
@@ -1358,6 +1373,10 @@ void highband_exc_dct_in_ivas_fx(
        {
            Scale_sig( exc_dct_in, L_frame, sub( *Q_exc, Q_old ) );
        }
#ifdef REMOVE_EVS_DUPLICATES
    }
#endif

    /*--------------------------------------------------------------------------------------*
     * add the correction layer to the LF bins,
     * and add the quantized pulses or the noise for the higher part of the spectrum
@@ -1397,7 +1416,12 @@ void highband_exc_dct_in_ivas_fx(
            Q_hb_exc = 0;
            move16();
            envelop_modify_fx( exc_diffQ, seed_tcx, last_bin, Ener_per_bd_iQ, *Q_exc, &Q_hb_exc );
#ifdef REMOVE_EVS_DUPLICATES
            test();
            IF( GT_16( *Q_exc, Q_hb_exc ) && GT_16( element_mode, EVS_MONO ) )
#else
            IF( GT_16( *Q_exc, Q_hb_exc ) )
#endif
            {
                Scale_sig( exc_wo_nf, L_frame, sub( Q_hb_exc, *Q_exc ) );
                *Q_exc = Q_hb_exc;

lib_com/options.h

100644 → 100755
+93 −91
Original line number Diff line number Diff line
@@ -88,4 +88,6 @@

#define TEST_HR


#define REMOVE_EVS_DUPLICATES                   /* remove core-coder duplicated functions, ACELP low-band decoder */
#endif
+36 −13
Original line number Diff line number Diff line
@@ -3286,6 +3286,7 @@ void synthesise_fb_high_band_fx(
    Word16 bpf_memory_Q[],
    Word16 Qout );
#ifndef REMOVE_EVS_DUPLICATES
void prep_tbe_exc_fx(
    const Word16 L_frame_fx, /* i : length of the frame */
#ifdef ADD_IVAS_TBE_CODE
@@ -3313,6 +3314,7 @@ void prep_tbe_exc_fx(
    const Word16 tdm_LRTD_flag /* i  : LRTD stereo mode flag       */
#endif
);
#endif
void prep_tbe_exc_ivas_fx(
    const Word16 L_frame_fx, /* i : length of the frame */
@@ -4856,6 +4858,7 @@ Word16 BITS_ALLOC_config_acelp(
    const Word16 narrowband,
    const Word16 nb_subfr );
#ifndef REMOVE_EVS_DUPLICATES
ivas_error config_acelp1(
    const Word16 enc_dec,                  /* i  : encoder/decoder flag            */
    const Word32 total_brate,              /* i  : total bitrate                   */
@@ -4883,7 +4886,7 @@ ivas_error config_acelp1(
    const Word16 tdm_LRTD_flag,            /* i  : LRTD stereo mode flag           */
    const Word16 GSC_IVAS_mode             /* i  : GSC IVAS mode                   */
);
#endif
Word16 set_ACELP_flag(
    const Word16 element_mode,  /* i  : element mode                */
    const Word32 element_brate, /* i  : element bitrate             */
@@ -5830,6 +5833,7 @@ void tcx_ltp_post_fx32(
    Word32 *tcx_buf,     /* sig_q */
    Word16 sig_q );
#ifndef REMOVE_EVS_DUPLICATES
// gs_inact_switching_fx.c
void Inac_swtch_ematch_fx(
    Word16 exc2[],              /* i/o: CELP/GSC excitation buffer       Q_exc*/
@@ -5843,6 +5847,7 @@ void Inac_swtch_ematch_fx(
    const short last_core,      /* i  : Last core used                        */
    const short last_codec_mode /* i  : Last codec mode                       */
);
#endif
void Inac_switch_ematch_ivas_fx(
    Word16 exc2[],                         /* i/o: CELP/GSC excitation buffer       Q_exc*/
@@ -6089,6 +6094,7 @@ void td_bwe_dec_init_fx(
    const Word32 output_Fs     /* i  : output sampling rate    */
);
#ifndef REMOVE_EVS_DUPLICATES
// lsf_dec_fx.c
void lsf_dec_fx(
    Decoder_State *st_fx,          /* i/o: State structure                               */
@@ -6102,7 +6108,7 @@ void lsf_dec_fx(
    ,
    const Word16 tdm_lsfQ_PCh[M] /* i  : Q LSFs for primary channel          Qx*/
);
#endif
void lsf_dec_ivas_fx(
    Decoder_State *st_fx,          /* i/o: State structure                               */
    const Word16 tc_subfr,         /* i  : TC subframe index                           Q0*/
@@ -6258,6 +6264,7 @@ void lsf_mid_dec_fx(
    Word16 lsp_mid[]      /* o  : quantized LSPs					Q15*/
);
#ifndef REMOVE_EVS_DUPLICATES
// cng_dec_fx.c
void CNG_dec_fx(
    Decoder_State *st_fx,           /* i/o: State structure                          */
@@ -6268,7 +6275,7 @@ void CNG_dec_fx(
    Word16 *allow_cn_step,          /* o  : allow CN step                       Q0   */
    Word16 *sid_bw,                 /* i  : 0-NB/WB, 1-SWB SID                  Q0   */
    Word32 *q_env );
#endif
void CNG_dec_ivas_fx(
    Decoder_State *st_fx,           /* i/o: State structure                          */
    const Word16 last_element_mode, /* i  : last element mode                    Q0   */
@@ -6697,6 +6704,7 @@ void nb_post_filt_fx(
    const Word16 disable_hpf /* i  : flag to diabled HPF                     */
);
#ifndef REMOVE_EVS_DUPLICATES
void formant_post_filt_fx(
    PFSTAT_HANDLE hPFstat, /* i : core decoder parameters */
    Word16 *synth_in,      /* i  : 12k8 synthesis                    */
@@ -6707,7 +6715,7 @@ void formant_post_filt_fx(
    Word32 rate,          /* (i) : bit-rate */
    const Word16 off_flag /* i  : off flag                        */
);
#endif
void formant_post_filt_ivas_fx(
    PFSTAT_HANDLE hPFstat, /* i : core decoder parameters */
    Word16 *synth_in,      /* i  : 12k8 synthesis                    */
@@ -6882,6 +6890,7 @@ void PulseResynchronization_fx(
    Word32 /*float*/ const pitchEnd        /*i   Q16*/
);
#ifndef REMOVE_EVS_DUPLICATES
// gs_dec_fx.c
void decod_audio_fx(
    Decoder_State *st_fx,  /* i/o: decoder static memory                     */
@@ -6896,7 +6905,7 @@ void decod_audio_fx(
    ,
    Word16 *gain_buf /*Q14*/
);
#endif
void decod_audio_ivas_fx(
    Decoder_State *st_fx,  /* i/o: decoder static memory						*/
    Word16 dct_epit[],     /* o  : GSC excitation in DCT domain              Qx*/
@@ -6915,6 +6924,7 @@ void decod_audio_ivas_fx(
    const Word16 tdm_Pri_pitch_buf[]   /* i  : primary channel pitch buffer              Q6*/
);
#ifndef REMOVE_EVS_DUPLICATES
void gsc_dec_fx(
    Decoder_State *st_fx,      /* i/o: State structure                                     */
    Word16 exc_dct_in[],       /* i/o: dct of pitch-only excitation / total excitation     Q_exc*/
@@ -6927,7 +6937,7 @@ void gsc_dec_fx(
    const Word16 *lsf_new,     /* i  : ISFs at the end of the frame                        Qx*/
    Word16 *exc_wo_nf,         /* o  : excitation (in f domain) without noisefill          Q_exc*/
    Word16 Q_exc );
#endif
void gsc_dec_ivas_fx(
    Decoder_State *st_fx,      /* i/o: State structure                                     */
    Word16 exc_dct_in[],       /* i/o: dct of pitch-only excitation / total excitation     Q_exc*/
@@ -6995,6 +7005,7 @@ void gain_dec_mless_fx(
    Word32 *norm_gain_code_fx /* o  : norm. gain of the codebook excitation  Q16*/
);
#ifndef REMOVE_EVS_DUPLICATES
void gain_dec_lbr_fx(
    Decoder_State *st_fx,      /* i/o: decoder state structure                                         */
    const Word16 coder_type,   /* i  : coding type                                                     */
@@ -7009,6 +7020,7 @@ void gain_dec_lbr_fx(
    ,
    const Word16 L_subfr /* i  : subfr lenght                                                    */
);
#endif
void gain_dec_lbr_ivas_fx(
    Decoder_State *st_fx,      /* i/o: decoder state structure                                         */
@@ -7143,6 +7155,7 @@ void re8_PPV_fx(
    Word16 y[]        /* o  : point in RE8 (8-dimensional integer vector)	Q0  */
);
#ifndef REMOVE_EVS_DUPLICATES
// dec_pit_exc_fx.c
void dec_pit_exc_fx(
    Decoder_State *st_fx,    /* i/o: decoder static memory                     */
@@ -7157,7 +7170,7 @@ void dec_pit_exc_fx(
    ,
    Word16 *gain_buf /*Q14*/
);
#endif
void dec_pit_exc_ivas_fx(
    Decoder_State *st_fx,              /* i/o: decoder static memory                     */
    const Word16 *Aq_fx,               /* i  : LP filter coefficient                     */
@@ -7212,6 +7225,7 @@ void Mode2_delta_pit_dec(
    Word16 **pt_indice   /* i/o: pointer to Vector of Q indexes */
);
#ifndef REMOVE_EVS_DUPLICATES
Word16 pit_decode_fx(                          /* o  : floating pitch value                    */
                      Decoder_State *st_fx,    /* i/o: decoder state structure                 */
                      const Word32 core_brate, /* i  : core bitrate                            */
@@ -7226,7 +7240,7 @@ Word16 pit_decode_fx( /* o : floating pitch value
                      Word16 *T0_max,          /* i/o: delta search max for sf 2 & 4           */
                      const Word16 L_subfr     /* i  : subframe length                         */
);
#endif
/* o  : floating pitch value */
Word16 pit_decode_ivas_fx(
    Decoder_State *st_fx,              /* i/o: decoder state structure                 */
@@ -7589,6 +7603,7 @@ void configureFdCngDec_fx(
    const Word16 Last_L_frame,
    const Word16 element_mode );
#ifndef REMOVE_EVS_DUPLICATES
/* Apply the CLDFB-based CNG */
Word16 ApplyFdCng_fx(
    Word16 *timeDomainInput, /* i  : pointer to time domain i   */
@@ -7602,7 +7617,7 @@ Word16 ApplyFdCng_fx(
    Decoder_State *st,
    const Word16 concealWholeFrame, /* i  : binary flag indicating frame loss */
    Word16 is_music );
#endif
Word16 ApplyFdCng_ivas_fx(
    Word16 *timeDomainInput, /* i  : pointer to time domain input */
    Word16 Q,
@@ -8201,6 +8216,7 @@ void FEC_pitch_estim_fx(
    Word16 element_mode      /* i  : element mode                                  */
);
#ifndef REMOVE_EVS_DUPLICATES
// FEC_scale_sync_fx.c
void FEC_scale_syn_fx(
    const Word16 L_frame,          /* i  : length of the frame                     */
@@ -8231,7 +8247,7 @@ void FEC_scale_syn_fx(
    const Word16 avoid_lpc_burst_on_recovery, /* i  : if true the excitation energy is limited if LP has big gain */
    const Word16 force_scaling                /* i: force scaling                             */
);
#endif
void FEC_scale_syn_ivas_fx(
    const Word16 L_frame,          /* i  : length of the frame                     */
    Word16 *update_flg,            /* o: flag indicating re-synthesis after scaling*/
@@ -8258,6 +8274,9 @@ void FEC_scale_syn_ivas_fx(
    Word16 *mem_syn,               /* o:   initial synthesis filter states         */
    Word16 Q_exc,
    Word16 Q_syn,
#ifdef REMOVE_EVS_DUPLICATES
    const Word16 element_mode, /* i  : element mode                            */
#endif
    const Word16 avoid_lpc_burst_on_recovery, /* i  : if true the excitation energy is limited if LP has big gain */
    const Word16 force_scaling                /* i: force scaling                             */
);
@@ -8545,6 +8564,7 @@ Word16 FEC_synchro_exc_fx( /* o : do_WI flag
                           const Word16 Old_pitch        /* i  : Pitch use to create temporary adaptive codebook   */
);
#ifndef REMOVE_EVS_DUPLICATES
// dec_uv_fx.c
void decod_unvoiced_fx(
    Decoder_State *st_fx,     /*   i/o: decoder static memory                             */
@@ -8557,7 +8577,7 @@ void decod_unvoiced_fx(
    Word16 *exc2_fx,          /*   Q_X        o  : adapt. excitation/total exc            */
    Word16 *bwe_exc_fx,       /*   Q_X        i/o: excitation for SWB TBE                 */
    Word16 *gain_buf );
#endif
void decod_unvoiced_ivas_fx(
    Decoder_State *st_fx,            /* 					i/o: decoder static memory                  */
    const Word16 *Aq_fx,             /* 	Q12				i  : LP filter coefficient                  */
@@ -8601,6 +8621,7 @@ void gaus_L2_dec(
    Word16 *seed_acelp  /*i/o : random seed                     Q0  */
);
#ifndef REMOVE_EVS_DUPLICATES
// dec_gen_voic_fx.c
ivas_error decod_gen_voic_fx(
    Decoder_State *st_fx,      /* i/o: decoder static memory                     */
@@ -8617,7 +8638,7 @@ ivas_error decod_gen_voic_fx(
    Word16 *unbits,            /* number of unused bits                          */
    Word16 *gain_buf           /*Q14*/
);
#endif
ivas_error decod_gen_voic_ivas_fx(
    Decoder_State *st_fx,      /* i/o: decoder static memory                     */
    const Word16 L_frame,      /* i  : length of the frame                       */
@@ -9560,6 +9581,8 @@ void d_gain_pred_fx(
    Word16 *Es_pred,   /* o  : predicited scaled innovation energy       */
    Word16 **pt_indice /* i/o: pointer to the buffer of indices          */
);
#ifndef REMOVE_EVS_DUPLICATES
// acelp_core_dec_fx.c
ivas_error acelp_core_dec_fx(
    Decoder_State *st_fx,      /* i/o: decoder state structure                    */
@@ -9585,7 +9608,7 @@ ivas_error acelp_core_dec_fx(
    STEREO_CNG_DEC_HANDLE hStereoCng,    /* i  : stereo CNG handle                                                       */
    const Word16 read_sid_info           /* i  : read SID info flag                                                      */
);
#endif
// evs_dec_fx.c
ivas_error evs_dec_fx(
    Decoder_State *st_fx, /* i/o  : Decoder state structure  */
Loading