Commit 6f7d6581 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into 387-ism-metadata-discontinuity-in-fec

parents a263f451 e2686739
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],
+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;
}


+2 −1
Original line number Diff line number Diff line
@@ -162,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
 *-------------------------------------------------------------------*/
+34 −0
Original line number Diff line number Diff line
@@ -1077,6 +1077,9 @@ ivas_error ivas_masa_dec_reconfigure(
    uint16_t *bit_stream;
    Decoder_State **sts;
    int32_t ivas_total_brate, last_ivas_total_brate;
#ifdef FIX_417_TD_DECORR_BRATE_SW
    int16_t numCldfbAnalyses_old, numCldfbSyntheses_old;
#endif
    ivas_error error;

    error = IVAS_ERR_OK;
@@ -1084,6 +1087,10 @@ ivas_error ivas_masa_dec_reconfigure(
    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
    last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate;

#ifdef FIX_417_TD_DECORR_BRATE_SW
    ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
#endif

    /*-----------------------------------------------------------------*
     * Allocate and initialize SCE/CPE and other handles
     *-----------------------------------------------------------------*/
@@ -1141,6 +1148,33 @@ ivas_error ivas_masa_dec_reconfigure(
        }
    }

#ifdef FIX_417_TD_DECORR_BRATE_SW
    /*-----------------------------------------------------------------*
     * TD Decorrelator
     *-----------------------------------------------------------------*/

    if ( st_ivas->hDiracDecBin != NULL )
    {
        if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK )
        {
            return error;
        }
    }

    /*-----------------------------------------------------------------*
     * CLDFB instances
     *-----------------------------------------------------------------*/

    if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, st_ivas->nchan_transport, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /*-----------------------------------------------------------------*
     * Set-up MASA coding elements and bitrates
     *-----------------------------------------------------------------*/
#endif

    ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp );

    return error;
Loading