Commit 0cd7a9f2 authored by vaclav's avatar vaclav
Browse files
parents 687d6682 1c3972f0
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -469,6 +469,11 @@ enum
#define STEREO_DFT_OFFSET                       1
#define STEREO_DFT_NBDIV                        2

#ifdef FIX_ITD_CNG
#define STEREO_DFT_ITD_CNG_XFADE                100
#define STEREO_DFT_ITD_CNG_XFADE_RESET          2
#endif

#define STEREO_DFT_DELAY_DEC_BWE_NS             ( STEREO_DFT_OFFSET * STEREO_DFT_HOP_NS - ACELP_LOOK_NS ) /* 1.25ms/2.5ms: max delay for core decoder*/

#define STEREO_DFT_ENC_DFT_NB                   ( STEREO_DFT_OFFSET + 1 )                     /*frame + lookahead*/
@@ -534,6 +539,10 @@ typedef enum
#define STEREO_DFT_SID_GIPD_NBITS               2
#define STEREO_DFT_FD_FILT                      0.9f

#ifdef FIX_ITD_CNG
#define STEREO_DFT_CNG_ITD_CNT                  8
#endif

/*Residual prediction*/
#define STEREO_DFT_PAST_MAX                     4
#define STEREO_DFT_RES_PRED_BAND_MAX            12
+25 −0
Original line number Diff line number Diff line
@@ -925,6 +925,10 @@ float stereo_dft_enc_synthesize(

void stereo_dft_enc_process(
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure               */
#ifdef FIX_ITD_CNG
    const int16_t vad_flag_dtx[],                               /* i: VAD dtx flags                         */
    const int16_t vad_hover_flag[],                             /* i: VAD hangover flags                    */
#endif
    const int16_t input_frame                                   /* i  : input frame length                  */
);

@@ -973,7 +977,11 @@ void stereo_dft_dequantize_itd(

void stereo_dft_enc_sid_calc_coh(
    STEREO_DFT_ENC_DATA_HANDLE hStereoDft,                      /* i/o: DFT stereo handle                   */
#ifdef FIX_ITD_CNG
    float prev_cohBand[2*(STEREO_DFT_BAND_MAX/2)],              /* i/o: Previous coherence                  */
#else
    float coh_crossfade[STEREO_DFT_BAND_MAX / 2],               /* i/o: Coherence crossfade memory          */
#endif
    int16_t *td_active,                                         /* i/o: TD stereo mode indicator            */
    int16_t *first_SID,                                         /* i/o: First SID indicator                 */
    float *cohBand                                              /* i/o: Coherence per band                  */
@@ -1126,6 +1134,11 @@ void stereo_dft_dec_read_BS(
void stereo_dft_dec_smooth_parameters(
    STEREO_DFT_DEC_DATA_HANDLE hStereoDft,                      /* i/o: decoder DFT stereo handle           */
    const int16_t prev_sid_nodata                               /* i  : Previous SID/No data indicator      */
#ifdef FIX_ITD_CNG
    ,
    const int16_t active_frame_counter,                         /* i  : Active frame counter                */
    const int32_t element_brate                                 /* i  : Element bitrate                     */
#endif
);

void stereo_dft_generate_res_pred(
@@ -1281,6 +1294,10 @@ void stereo_dft_enc_compute_itd(
    float *DFT_R,
    const int16_t k_offset,
    const int16_t input_frame,
#ifdef FIX_ITD_CNG
    const int16_t vad_flag_dtx[],  
    const int16_t vad_hover_flag[],
#endif
    float *bin_nrgL,
    float *bin_nrgR 
);
@@ -1836,6 +1853,10 @@ void deindex_lvq_SHB(

void stereo_td_itd_mdct_stereo( 
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder handle                      */
#ifdef FIX_ITD_CNG
    const int16_t vad_flag_dtx[],                               /* i: VAD dtx flags                             */
    const int16_t vad_hover_flag[],                             /* i: VAD hangover flags                        */
#endif
    const int16_t input_frame                                   /* i  : frame length                            */
);

@@ -2395,6 +2416,10 @@ void stereo_cng_upd_counters(
    const int16_t nbands,                                       /* i  : Number of bands in active               */
    const float sidSideGain[],                                  /* i  : SID side gains                          */
    const int16_t burst_ho_count                                /* i  : Hang-over count                         */
#ifdef FIX_ITD_CNG
    ,
    int16_t *coh_fade_counter                                   /* i  : Coherence fade counter                  */
#endif
);

void stereo_cng_init_dec(
+2 −0
Original line number Diff line number Diff line
@@ -179,6 +179,8 @@
#define FIX_ISM_INACTIVE_BITS                           /* fix bitbudget distribution in inactive frames in ISM format */


#define FIX_ITD_CNG                                     /* Eri: Fix for CNG ITD */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+4 −0
Original line number Diff line number Diff line
@@ -3837,6 +3837,10 @@ int16_t dtx_hangover_addition(
    int16_t *vad_hover_flag,         /* o  : VAD hangover flag                          */
    VAD_HANDLE hVAD,                 /* i/o: VAD handle for L or R channel              */
    NOISE_EST_HANDLE hNoiseEst       /* i  : Noise estimation handle                    */
#ifdef FIX_ITD_CNG
    ,
    int16_t *rem_dtx_ho /* o  : Expected remaining hangover frames         */
#endif
);

int16_t wb_vad(
+12 −0
Original line number Diff line number Diff line
@@ -147,6 +147,18 @@ typedef struct stereo_dft_dec_data_struct

    float itd[STEREO_DFT_DEC_DFT_NB];

#ifdef FIX_ITD_CNG
    float itd_xfade_step;
    float itd_xfade_target;
    int16_t itd_xfade_counter;
    float itd_xfade_prev;
    int32_t last_active_element_brate;
    float ipd_xfade_target;
    float ipd_xfade_step;
    int16_t ipd_xfade_counter;
    float ipd_xfade_prev;
#endif

    /*residual prediction*/
    int16_t res_pred_mode[STEREO_DFT_DEC_DFT_NB];                     /* residual prediction mode: 0(off), 1(stereo filling only), 2(enhanced stereo filling) */
    float res_pred_gain[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* prediction gain for the residual HFs */
Loading