Commit 31d931b9 authored by vaclav's avatar vaclav
Browse files

- formatting

- introduce "ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;" in order to minimize spaghetti-like calls
parent 1a6b2dee
Loading
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -667,17 +667,18 @@ static ivas_error ivas_mc_dec_reconfig(
#else
    int16_t numCldfbAnalyses_old, numCldfbAnalyses, numCldfbSyntheses, numCldfbSyntheses_old, i;
#endif
    int32_t new_brate_SCE, new_brate_CPE;
    int32_t new_brate_SCE, new_brate_CPE, ivas_total_brate;
    RENDERER_TYPE renderer_type_old;
    ivas_error error;
    MC_MODE mc_mode, last_mc_mode;

    last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */

    error = IVAS_ERR_OK;

    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
    nchan_transport_old = st_ivas->nchan_transport;

    last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */

    /* we have to temporally set the current mc_mode back to the previous one to make sure the following call to
       ivas_init_dec_get_num_cldfb_instances() returns the correct counts */
    mc_mode = st_ivas->mc_mode;
@@ -703,6 +704,7 @@ static ivas_error ivas_mc_dec_reconfig(
    /* renderer might have changed, reselect */
    renderer_type_old = st_ivas->renderer_type;
    ivas_renderer_select( st_ivas );

    /* side effect of the renderer selection can be a changed internal config */
    ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config );

@@ -755,6 +757,7 @@ static ivas_error ivas_mc_dec_reconfig(
            {
                ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion );
            }

            if ( ( error = ivas_param_mc_dec_open( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
@@ -796,7 +799,7 @@ static ivas_error ivas_mc_dec_reconfig(
    }
    else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
    {
        ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), st_ivas->hDecoderConfig->ivas_total_brate );
        ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate );

        if ( last_mc_mode != MC_MODE_MCMASA )
        {
@@ -805,6 +808,7 @@ static ivas_error ivas_mc_dec_reconfig(
                return error;
            }
        }

        if ( ( error = ivas_mcmasa_dec_reconfig( st_ivas ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -903,7 +907,7 @@ static ivas_error ivas_mc_dec_reconfig(
            }
        }

        st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st_ivas->hDecoderConfig->ivas_total_brate, st->igf, st->element_mode, st->mct_chan_mode );
        st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode, st->mct_chan_mode );
    }
    else if ( last_mc_mode == MC_MODE_PARAMMC && st_ivas->mc_mode == MC_MODE_MCT && nchan_transport_old > 2 )
    {
@@ -919,19 +923,20 @@ static ivas_error ivas_mc_dec_reconfig(
    {
        uint8_t separateChannelEnabled;
        int16_t separateChannelIndex;
        ivas_mcmasa_set_separate_channel_mode( &separateChannelEnabled, &separateChannelIndex, st_ivas->hDecoderConfig->ivas_total_brate );
        ivas_mcmasa_split_brate( separateChannelEnabled, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE );
        ivas_mcmasa_set_separate_channel_mode( &separateChannelEnabled, &separateChannelIndex, ivas_total_brate );
        ivas_mcmasa_split_brate( separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE );
    }
    else if ( st_ivas->mc_mode == MC_MODE_MCT )
    {
        new_brate_SCE = 0;
        new_brate_CPE = ( st_ivas->hDecoderConfig->ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS;
        new_brate_CPE = ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS;
    }
    else
    {
        new_brate_SCE = 0; /*st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport;*/
        new_brate_CPE = ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS;
        new_brate_SCE = 0; /* ivas_total_brate / st_ivas->nchan_transport;*/
        new_brate_CPE = ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS;
    }

    if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, new_brate_SCE, new_brate_CPE ) ) != IVAS_ERR_OK )
    {
        return error;
@@ -1132,6 +1137,7 @@ static ivas_error ivas_mc_dec_reconfig(
                {
                    /* useTdDecorr may change => close and re-open */
                    ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin );

                    if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK )
                    {
                        return error;
+1 −0
Original line number Diff line number Diff line
@@ -746,6 +746,7 @@ static ivas_error ivas_mc_enc_reconfig(
                ivas_lfe_enc_close( st_ivas->hLFE );
                st_ivas->hLFE = NULL;
            }

            if ( st_ivas->hMCT != NULL )
            {
                ivas_mct_enc_close( st_ivas->hMCT );