Commit 586ba628 authored by vaclav's avatar vaclav
Browse files

Merge branch 'main' into 233-improve-robustness-of-command-line-parameters

parents bf668044 0cd7a9f2
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
+12 −0
Original line number Diff line number Diff line
@@ -199,7 +199,11 @@ ivas_error ivas_ism_config(
        diff = 0;
        for ( ch = 0; ch < n_ISms; ch++ )
        {
#ifdef FIX_ISM_INACTIVE_BITS
            int16_t limit;
#else
            int32_t limit;
#endif

            limit = MIN_BRATE_SWB_BWE / FRMS_PER_SECOND;
            if ( element_brate[ch] < MIN_BRATE_SWB_STEREO ) /* replicate function set_bw() -> check the coded audio band-width */
@@ -219,12 +223,20 @@ ivas_error ivas_ism_config(
            else if ( ism_imp[ch] == ISM_LOW_IMP )
            {
                tmp = (int16_t) ( BETA_ISM_LOW_IMP * bits_CoreCoder[ch] );
#ifdef FIX_ISM_INACTIVE_BITS
                tmp = max( limit, tmp );
#else
                tmp = (int16_t) max( limit, bits_CoreCoder[ch] - tmp );
#endif
            }
            else if ( ism_imp[ch] == ISM_MEDIUM_IMP )
            {
                tmp = (int16_t) ( BETA_ISM_MEDIUM_IMP * bits_CoreCoder[ch] );
#ifdef FIX_ISM_INACTIVE_BITS
                tmp = max( limit, tmp );
#else
                tmp = (int16_t) max( limit, bits_CoreCoder[ch] - tmp );
#endif
            }
            else /* ism_imp[ch] == ISM_HIGH_IMP */
            {
+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(
+4 −0
Original line number Diff line number Diff line
@@ -178,6 +178,10 @@
#define IMPROVE_CMDLINE_ROBUSTNESS                      /* Issue 233: Improve robustness of command-line parameters */


#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 */
+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(
Loading