Commit cd2912bd authored by bayers's avatar bayers
Browse files

Merge remote-tracking branch 'remotes/origin/main' into...

Merge remote-tracking branch 'remotes/origin/main' into 416-ism-bitrate-switching-broken-missing-cldfbs-when-not-starting-with-a-paramism-bitrate
parents 18801a18 a83d4c06
Loading
Loading
Loading
Loading
Loading
+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;
}


+4 −2
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@
/*#define DEBUG_MODE_TCX*/                      /* output most important TCX core parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_DFT*/                      /* output most important DFT stereo parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_TD*/                       /* output most important TD stereo parameters to the subdirectory "res/ */
//#define DEBUG_MODE_DIRAC                   /* output most important DIRAC parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_DIRAC*/                    /* output most important DIRAC parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_MDCT*/                     /* output most important MDCT parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_PARAM_MC */                /* output Parametric MC paramters to the subdirectory "res/" */
/*#define DEBUG_MODE_PARAM_ISM*/                /* output Parametric ISM paramters to the subdirectory "res/" */
@@ -149,6 +149,7 @@
#define SNS_MSVQ                                        /* FhG: contribution 33 - MSVQ for SNS parameters at stereo mid bitrates */

#define FIX_379_GAININTP                                /* Eri: Adds a gain interpolation for directional/distance gain to handle abrupt changes in metadata (Non BE) */
#define FIX_387_ISM_MD_FEC                              /* VA: Issue 387: fix MD discontinuity in ISM FEC */

#define FIX_418_SID_BITRATE                             /* Eri: Issue 418: Using the correct bitrate for unified stereo SID */
#define PARAMMC_SHORT_ENC_MDFT                          /* FhG: Issue 410: complexity optimization for parametric Multichannel modes */
@@ -161,6 +162,7 @@
#define FIX_416_ISM_BR_SWITCHING                        /* FhG: add missing CLDFB reconfig to ISM BR switching */
#define FIX_SP2A                                        /* VA: Issue 412: Adjust threshold for the S_p2a feature in the tonal detector */
#define FIX_413_SBA_DTX                                 /* Dlb: Fix for issue 413, SBA DTX CNG in 2TC mode*/
#define FIX_417_TD_DECORR_BRATE_SW                      /* VA: Issue 417: fix incorrect use of TD decorrelator in bitrate switching */


/* ################## End DEVELOPMENT switches ######################### */
+1 −1
Original line number Diff line number Diff line
@@ -1776,7 +1776,7 @@ void ivas_destroy_dec(


/*-------------------------------------------------------------------*
 * ivas_init_dec_get_num_cldfb_analyses()
 * ivas_init_dec_get_num_cldfb_instances()
 *
 * Return number of CLDFB analysis & synthesis instances
 *-------------------------------------------------------------------*/
Loading