Commit 64d54c3c authored by bayers's avatar bayers
Browse files

fix compilation with API_5MS deactivated, fix energy compensation for ParamISM with TSM

parent 89945ee4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@
#define FIX_XXX_HEADTRACKER_INIT
#define FIX_XXX_ISM_SBA_ASAN
#define FIX_XXX_JBM_USAN                                /* FhG: fix usan in acessing transport channel buffers */
#define FIX_XXX_PARAMISM_JBM_ENER_CORRECTION            /* FhG: fix energy correction in ParamISM rendering */
#define NONBE_FIX_589_JBM_TC_OFFSETS
#define API_5MS                                         /* FhG: 5ms rendering capability */
#ifdef API_5MS 
+4 −4
Original line number Diff line number Diff line
@@ -992,15 +992,15 @@ ivas_error ivas_dirac_dec_config(
    /* Allocate transport channel buffers for SBA format when in JBM */
    if ( dec_config_flag == DIRAC_OPEN )
    {
        if (
#ifdef API_5MS
#ifdef API_5MS_BASELINE
        if ( st_ivas->hDecoderConfig->Opt_5ms && st_ivas->hTcBuffer == NULL )
#else
        if ( st_ivas->hTcBuffer == NULL )
            st_ivas->hDecoderConfig->Opt_5ms &&
#endif
#else
        if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL )
            st_ivas->hDecoderConfig->voip_active == 1 &&
#endif
            st_ivas->hTcBuffer == NULL )
        {
            if ( st_ivas->ivas_format == SBA_FORMAT )
            {
+5 −4
Original line number Diff line number Diff line
@@ -1894,15 +1894,16 @@ ivas_error ivas_init_decoder(
    /*-----------------------------------------------------------------*
     * Allocate and initialize JBM struct + buffer
     *-----------------------------------------------------------------*/
    if (
#ifdef API_5MS
#ifdef API_5MS_BASELINE
    if ( st_ivas->hDecoderConfig->Opt_5ms && st_ivas->hTcBuffer == NULL )
#else
    if ( st_ivas->hTcBuffer == NULL )
        st_ivas->hDecoderConfig->Opt_5ms &&
#endif
#else
    if ( st_ivas->hDecoderConfig->voip_active && st_ivas->hTcBuffer == NULL )
        st_ivas->hDecoderConfig->voip_active == 1 &&
#endif
        st_ivas->hTcBuffer == NULL )

    {
        /* no module has yet open the TC buffer, open a default one */
        n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas );
+3 −3
Original line number Diff line number Diff line
@@ -345,12 +345,12 @@ static ivas_error ivas_ism_bitrate_switching(
    /*-----------------------------------------------------------------*
     * Reconfigure TC buffer
     *-----------------------------------------------------------------*/
#ifdef API_5MS
#ifdef API_5MS_BASELINE
#ifndef API_5MS
    if ( st_ivas->hDecoderConfig->voip_active == 1 )
#else
    if ( st_ivas->hDecoderConfig->Opt_5ms )
#endif
#else
    if ( st_ivas->hDecoderConfig->voip_active == 1 )
#endif
    {
        int16_t tc_nchan_full_new;
+13 −9
Original line number Diff line number Diff line
@@ -594,10 +594,10 @@ ivas_error ivas_param_ism_dec_open(
    st_ivas->hDirAC = hDirAC;
    st_ivas->hSpatParamRendCom = hSpatParamRendCom;

#ifdef API_5MS_BASELINE
#ifndef API_5MS
    if ( st_ivas->hDecoderConfig->voip_active )
#else
#ifdef API_5MS_BASELINE
    if ( st_ivas->hDecoderConfig->Opt_5ms )
#endif
#endif
@@ -906,7 +906,6 @@ void ivas_param_ism_dec(
#ifdef API_5MS
    ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, output_frame / 2, p_tc );
#else
#ifdef FIX_549_DMX_GAIN
    /* Energy Compensation */
    for ( i = 0; i < output_frame; i++ )
    {
@@ -940,7 +939,6 @@ void ivas_param_ism_dec(
        }
    }
    st_ivas->hDirAC->hParamIsm->last_dmx_gain = gain;
#endif /* FIX_549_DMX_GAIN */
#endif /* API_5MS */
    for ( ch = 0; ch < nchan_transport; ch++ )
    {
@@ -1158,11 +1156,12 @@ void ivas_param_ism_dec_digest_tc(
    int16_t slot_idx, bin_idx;
    int32_t ivas_total_brate;
#ifndef API_5MS
#ifdef FIX_549_DMX_GAIN
    int16_t output_frame;
#ifdef FIX_XXX_PARAMISM_JBM_ENER_CORRECTION
    int16_t fade_len;
#endif
    float gain, ene_tc, ene_sum, grad;
    float last_gain;
#endif
#endif
    float ref_power[CLDFB_NO_CHANNELS_MAX];
    float cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX];
@@ -1177,10 +1176,13 @@ void ivas_param_ism_dec_digest_tc(
    hSpatParamRendCom = st_ivas->hSpatParamRendCom;
    assert( hSpatParamRendCom );
#ifndef API_5MS
#ifdef FIX_549_DMX_GAIN
    ene_tc = 0.0f;
    ene_sum = 0.0f;
    last_gain = st_ivas->hDirAC->hParamIsm->last_dmx_gain;
#ifdef FIX_XXX_PARAMISM_JBM_ENER_CORRECTION
    fade_len = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC );
    output_frame = nCldfbSlots * hSpatParamRendCom->num_freq_bands;
#else
    output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC );
#endif
#endif
@@ -1279,7 +1281,6 @@ void ivas_param_ism_dec_digest_tc(
        ivas_ism_param_dec_tc_gain_ajust( st_ivas, nCldfbSlots * hSpatParamRendCom->num_freq_bands, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( 2 * FRAMES_PER_SEC ) ), transport_channels_f );
    }
#else
#ifdef FIX_549_DMX_GAIN
    /* Energy Compensation */
    for ( i = 0; i < output_frame; i++ )
    {
@@ -1293,7 +1294,11 @@ void ivas_param_ism_dec_digest_tc(
        gain = 0.75f * gain + 0.25f * last_gain;
        /* 10ms ramp */
        grad = ( gain - last_gain ) * 2.0f / (float) output_frame; /* slope between two consecutive gains, 480 samples length */
        for ( i = 0; i < ( output_frame / 2 ); i++ )
#ifdef FIX_XXX_PARAMISM_JBM_ENER_CORRECTION
        for ( i = 0; i < fade_len; i++ )
#else
        for ( i = 0; i < output_frame / 2; i++ )
#endif
        {
            transport_channels_f[0][i] *= ( last_gain + i * grad );
            transport_channels_f[1][i] *= ( last_gain + i * grad );
@@ -1313,7 +1318,6 @@ void ivas_param_ism_dec_digest_tc(
        }
    }
    st_ivas->hDirAC->hParamIsm->last_dmx_gain = gain;
#endif /* FIX_549_DMX_GAIN */
#endif /* API_5MS */

    for ( ch = 0; ch < nchan_transport; ch++ )
Loading