Commit 9c543b01 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Fix ISM rate switching in JBM. Apply same fix to SBA and MC pre-emptively.

parent edcd2e30
Loading
Loading
Loading
Loading
Loading
+12 −15
Original line number Diff line number Diff line
@@ -65,14 +65,11 @@ static ivas_error ivas_ism_bitrate_switching(
    AUDIO_CONFIG intern_config_old;
    IVAS_OUTPUT_SETUP hIntSetupOld;
    RENDERER_TYPE renderer_type_old;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data;

    error = IVAS_ERR_OK;
    nCPE_old = st_ivas->nCPE;
    nSCE_old = st_ivas->nSCE;

    rend_common_data = st_ivas->rend_common_data;

    /* we have to temporarily set the ism mode back to the old one, otherwise this can give wrong results*/
    ism_mode = st_ivas->ism_mode;
    st_ivas->ism_mode = last_ism_mode;
@@ -125,13 +122,13 @@ static ivas_error ivas_ism_bitrate_switching(
    if ( st_ivas->hDecoderConfig->voip_active )
    {
        /* transfer subframe info from DirAC or ParamMC to central tc buffer */
        if ( last_ism_mode == ISM_MODE_PARAM && rend_common_data != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) )
        if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->rend_common_data != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) )
        {
            st_ivas->hTcBuffer->nb_subframes = rend_common_data->nb_subframes;
            st_ivas->hTcBuffer->subframes_rendered = rend_common_data->subframes_rendered;
            st_ivas->hTcBuffer->num_slots = rend_common_data->num_slots;
            st_ivas->hTcBuffer->slots_rendered = rend_common_data->slots_rendered;
            mvs2s( rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
            st_ivas->hTcBuffer->nb_subframes = st_ivas->rend_common_data->nb_subframes;
            st_ivas->hTcBuffer->subframes_rendered = st_ivas->rend_common_data->subframes_rendered;
            st_ivas->hTcBuffer->num_slots = st_ivas->rend_common_data->num_slots;
            st_ivas->hTcBuffer->slots_rendered = st_ivas->rend_common_data->slots_rendered;
            mvs2s( st_ivas->rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        }

        /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
@@ -342,14 +339,14 @@ static ivas_error ivas_ism_bitrate_switching(
        }

        /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */
        if ( rend_common_data != NULL )
        if ( st_ivas->rend_common_data != NULL )
        {
            rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes;
            rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
            rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots;
            rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered;
            st_ivas->rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes;
            st_ivas->rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
            st_ivas->rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots;
            st_ivas->rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered;

            mvs2s( st_ivas->hTcBuffer->subframe_nbslots, rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
            mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        }
    }

+12 −14
Original line number Diff line number Diff line
@@ -684,13 +684,11 @@ static ivas_error ivas_mc_dec_reconfig(
    int16_t tc_granularity_new;
    AUDIO_CONFIG intern_config_old;
    IVAS_OUTPUT_SETUP hIntSetupOld;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data;

    error = IVAS_ERR_OK;

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

    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 */

@@ -739,13 +737,13 @@ static ivas_error ivas_mc_dec_reconfig(
            st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered;
            mvs2s( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        }
        else if ( last_mc_mode == MC_MODE_MCMASA && rend_common_data != NULL )
        else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->rend_common_data != NULL )
        {
            st_ivas->hTcBuffer->nb_subframes = rend_common_data->nb_subframes;
            st_ivas->hTcBuffer->subframes_rendered = rend_common_data->subframes_rendered;
            st_ivas->hTcBuffer->num_slots = rend_common_data->num_slots;
            st_ivas->hTcBuffer->slots_rendered = rend_common_data->slots_rendered;
            mvs2s( rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
            st_ivas->hTcBuffer->nb_subframes = st_ivas->rend_common_data->nb_subframes;
            st_ivas->hTcBuffer->subframes_rendered = st_ivas->rend_common_data->subframes_rendered;
            st_ivas->hTcBuffer->num_slots = st_ivas->rend_common_data->num_slots;
            st_ivas->hTcBuffer->slots_rendered = st_ivas->rend_common_data->slots_rendered;
            mvs2s( st_ivas->rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        }

        /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv
@@ -1263,13 +1261,13 @@ static ivas_error ivas_mc_dec_reconfig(
        }

        /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */
        if ( rend_common_data != NULL )
        if ( st_ivas->rend_common_data != NULL )
        {
            rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes;
            rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
            rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots;
            rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered;
            mvs2s( st_ivas->hTcBuffer->subframe_nbslots, rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
            st_ivas->rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes;
            st_ivas->rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
            st_ivas->rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots;
            st_ivas->rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered;
            mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        }
        else if ( st_ivas->hParamMC != NULL )
        {
+12 −14
Original line number Diff line number Diff line
@@ -112,14 +112,12 @@ ivas_error ivas_sba_dec_reconfigure(
    int32_t last_ivas_total_brate;

    DECODER_CONFIG_HANDLE hDecoderConfig;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE rend_common_data;
    ivas_error error;
    error = IVAS_ERR_OK;

    hDecoderConfig = st_ivas->hDecoderConfig;
    ivas_total_brate = hDecoderConfig->ivas_total_brate;
    last_ivas_total_brate = st_ivas->last_active_ivas_total_brate;
    rend_common_data = st_ivas->rend_common_data;

    /*-----------------------------------------------------------------*
     * Set SBA high-level parameters
@@ -144,13 +142,13 @@ ivas_error ivas_sba_dec_reconfigure(
        st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpar->subframes_rendered;
        mvs2s( st_ivas->hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
    }
    else if ( rend_common_data != NULL )
    else if ( st_ivas->rend_common_data != NULL )
    {
        st_ivas->hTcBuffer->num_slots = rend_common_data->num_slots;
        st_ivas->hTcBuffer->nb_subframes = rend_common_data->nb_subframes;
        st_ivas->hTcBuffer->slots_rendered = rend_common_data->slots_rendered;
        st_ivas->hTcBuffer->subframes_rendered = rend_common_data->subframes_rendered;
        mvs2s( rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        st_ivas->hTcBuffer->num_slots = st_ivas->rend_common_data->num_slots;
        st_ivas->hTcBuffer->nb_subframes = st_ivas->rend_common_data->nb_subframes;
        st_ivas->hTcBuffer->slots_rendered = st_ivas->rend_common_data->slots_rendered;
        st_ivas->hTcBuffer->subframes_rendered = st_ivas->rend_common_data->subframes_rendered;
        mvs2s( st_ivas->rend_common_data->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
    }

    /*-----------------------------------------------------------------*
@@ -257,13 +255,13 @@ ivas_error ivas_sba_dec_reconfigure(
        }

        /* synchronize subframe info */
        if ( rend_common_data != NULL )
        if ( st_ivas->rend_common_data != NULL )
        {
            rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots;
            rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes;
            rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered;
            rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
            mvs2s( st_ivas->hTcBuffer->subframe_nbslots, rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
            st_ivas->rend_common_data->num_slots = st_ivas->hTcBuffer->num_slots;
            st_ivas->rend_common_data->nb_subframes = st_ivas->hTcBuffer->nb_subframes;
            st_ivas->rend_common_data->slots_rendered = st_ivas->hTcBuffer->slots_rendered;
            st_ivas->rend_common_data->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
            mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->rend_common_data->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        }
    }