Commit 391fb6ac authored by emerit's avatar emerit
Browse files

Merge branch 'main' into 36-SBA-HRIR-Update

parents 66bc1a91 a83d4c06
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -1391,6 +1391,25 @@ enum
#define NPARTCLDFB                          10
#define NPART_SHAPING                       62

#ifdef ERI_FDCNGVQ_LOW_ROM
#define FDCNG_VQ_MAX_LEN        FD_CNG_maxN_37bits   
#define FDCNG_VQ_DCT_NSEGM      4   
#define FDCNG_VQ_DCT_MINTRUNC   8   
#define FDCNG_VQ_DCT_MAXTRUNC   18  
#define FDCNG_VQ_MAX_LEN_WB     21 

#define FDCNG_VQ_DCT_NPOST   8   

typedef enum _DCTTYPE
{
    DCT_T2_24_XX = 0, /* truncated DCT_T2_24 */
    IDCT_T2_XX_24 = 1,
    DCT_T2_21_XX = 2, /* truncated DCT_T2_21 */
    IDCT_T2_XX_21 = 3
} DCTTYPE;

#endif 

#define MSSUBFRLEN                          12
#define MSNUMSUBFR                          6
#define MSBUFLEN                            5
@@ -1513,7 +1532,10 @@ enum
#define TOD_NSPEC                           80                      /* number of spectral bins of the tonal detector */
#define TOD_THR_MASS                        0.86f                   /* initial value for the adaptive threshold of the tonal detector */
#define P2A_FACT                            0.9f                    /* long-term averaging factor for peak-to-average ratio */
#define THR_P2A                             80.0f                   /* threshold to detect strongly peaky signals */
#ifdef FIX_SP2A
#define THR_P2A_HIGH                        95.0f                   /* higher threshold to detect strongly peaky signals at low bitrates*/
#endif
#define THR_P2A                             80.0f                   /* lower threshold to detect strongly peaky signals at higher bitrates */

/*----------------------------------------------------------------------------------*
 * LD music post-filter constants
+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ static inline ivas_error ivas_error_wrapper( const ivas_error error_code, const

    fprintf( stderr, "\n\nIn function: %s(), %s:%d\n\n", function, file, line );
    // assert( 0 );

    return error_code;
}
#else
+17 −0
Original line number Diff line number Diff line
@@ -3386,10 +3386,27 @@ void ivas_dirac_dec(
    const int16_t i_sf
);

#ifdef FIX_417_TD_DECORR_BRATE_SW
ivas_error ivas_td_decorr_reconfig_dec(
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                             */
    const int32_t ivas_total_brate,                             /* i  : total IVAS bitrate                      */
    const int16_t nchan_transport,                              /* i  : number of transport channels            */
    const int32_t output_Fs,                                    /* i  : output sampling rate                    */
    ivas_td_decorr_state_t **hTdDecorr,                         /* i/o: TD decorrelator handle                  */
    uint16_t *useTdDecorr                                       /* i/o: TD decorrelator flag                    */
);

/*! r: Configured reqularization factor value */
float configure_reqularization_factor(
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                             */
    const int32_t ivas_total_brate                              /* i  : total IVAS bitrate                      */
);
#else
ivas_error ivas_dirac_dec_init_binaural_data(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    HRTFS_PARAMBIN_HANDLE hHrtfParambin                         /* i  : HRTF structure for rendering            */
);
#endif

void computeDiffuseness_mdft(
    float **buffer_intensity[DIRAC_NUM_DIMS],
+5 −0
Original line number Diff line number Diff line
@@ -71,6 +71,11 @@ typedef struct
    float last_true_azimuth;   /* MD smoothing in DTX- last true Q azimuth value */
    float last_true_elevation; /* MD smoothing in DTX- last true Q elevation value */

#ifdef FIX_387_ISM_MD_FEC
    int16_t ism_md_fec_cnt_enc;  /* counter of continuous frames where MD are not transmitted */
    int16_t ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */
#endif

} ISM_METADATA_FRAME, *ISM_METADATA_HANDLE;


+102 −3
Original line number Diff line number Diff line
@@ -87,12 +87,111 @@ static const float ivas_three_pow_frac[IVAS_MAX_DECORR_APD_SECTIONS] = {
};


#ifdef FIX_417_TD_DECORR_BRATE_SW
#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN        ( 2.0f )
#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f )
#endif

/*------------------------------------------------------------------------------------------*
 * Local functions declaration
 *------------------------------------------------------------------------------------------*/

static int16_t ivas_get_APD_filt_orders( const int16_t num_out_chans, const int32_t output_Fs, int16_t *APD_filt_orders );
static ivas_error ivas_td_decorr_init( ivas_td_decorr_state_t *hTdDecorr, const int16_t num_out_chans, const int16_t ducking_flag );

static void ivas_td_decorr_init( ivas_td_decorr_state_t *hTdDecorr, const int16_t num_out_chans, const int16_t ducking_flag );


#ifdef FIX_417_TD_DECORR_BRATE_SW
/*-------------------------------------------------------------------------
 * ivas_td_decorr_reconfig_dec()
 *
 * Allocate and initialize time domain decorrelator handle
 *------------------------------------------------------------------------*/

ivas_error ivas_td_decorr_reconfig_dec(
    const IVAS_FORMAT ivas_format,      /* i  : IVAS format                     */
    const int32_t ivas_total_brate,     /* i  : total IVAS bitrate              */
    const int16_t nchan_transport,      /* i  : number of transport channels    */
    const int32_t output_Fs,            /* i  : output sampling rate            */
    ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle          */
    uint16_t *useTdDecorr               /* i/o: TD decorrelator flag            */
)
{
    uint16_t useTdDecorr_new;
    ivas_error error;

    useTdDecorr_new = 0;
    if ( ivas_format == SBA_FORMAT )
    {
        if ( nchan_transport == 1 )
        {
            useTdDecorr_new = 1;
        }
    }
    else if ( ivas_format == MASA_FORMAT )
    {
        if ( ( ivas_total_brate < IVAS_48k && nchan_transport == 1 ) || ivas_total_brate < MASA_STEREO_MIN_BITRATE )
        {
            useTdDecorr_new = 1;
        }
    }
    else if ( ivas_format == MC_FORMAT )
    {
        if ( ivas_total_brate < IVAS_48k && nchan_transport == 1 )
        {
            useTdDecorr_new = 1;
        }
    }

    if ( *useTdDecorr != useTdDecorr_new )
    {
        *useTdDecorr = useTdDecorr_new;

        if ( *useTdDecorr )
        {
            if ( ivas_total_brate >= IVAS_13k2 && ivas_format == SBA_FORMAT )
            {
                if ( *hTdDecorr == NULL )
                {
                    if ( ( error = ivas_td_decorr_dec_open( hTdDecorr, output_Fs, 3, 1 ) ) != IVAS_ERR_OK )
                    {
                        return error;
                    }
                }

                if ( ivas_total_brate < IVAS_24k4 )
                {
                    ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR;
                }
                else
                {
                    ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN;
                }
            }
            else
            {
                if ( *hTdDecorr == NULL )
                {
                    if ( ( error = ivas_td_decorr_dec_open( hTdDecorr, output_Fs, 3, 0 ) ) != IVAS_ERR_OK )
                    {
                        return error;
                    }
                }
                else
                {
                    ivas_td_decorr_init( *hTdDecorr, 3, 0 );
                }
            }
        }
        else
        {
            ivas_td_decorr_dec_close( hTdDecorr );
        }
    }

    return IVAS_ERR_OK;
}
#endif


/*-------------------------------------------------------------------------
@@ -275,7 +374,7 @@ static int16_t ivas_get_APD_filt_orders(
 * TD decorr Initialisation function
 *-----------------------------------------------------------------------------------------*/

static ivas_error ivas_td_decorr_init(
static void ivas_td_decorr_init(
    ivas_td_decorr_state_t *hTdDecorr,
    const int16_t num_out_chans,
    const int16_t ducking_flag )
@@ -295,7 +394,7 @@ static ivas_error ivas_td_decorr_init(
        }
    }

    return IVAS_ERR_OK;
    return;
}


Loading