Commit 7321d00c authored by bayers's avatar bayers
Browse files

[fix] fix MONO and STEREO output for MC bitrate switching, only for switching ParamMC <-> MCT

parent 16650c8a
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -526,9 +526,6 @@ ivas_error ivas_param_mc_dec_reconfig(
    nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe;
    hParamMC->hoa_encoder = NULL;


    hParamMC->ls_conv_dmx_matrix = NULL;

    if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO )
    {
        nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe;
@@ -619,13 +616,13 @@ ivas_error ivas_param_mc_dec_reconfig(
        float *icc_q_old = hParamMC->icc_q;


        /* init arrays for quantized parameters */
        /* init arrays for the quantized parameters */
        hParamMC->icc_q = (float *) count_malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) );
        hParamMC->icld_q = (float *) count_malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) );
        set_f( hParamMC->icld_q, PARAM_MC_DEFAULT_MIN_ILD, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe );
        set_f( hParamMC->icc_q, 0.0f, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe );

        /* map old to new parameter banding, only for same number of TCs, needs some more thought for changing number of TCs */
        /* map old to new parameter banding, only for same number of TCs, needs some more thought for a changing number of TCs */
        if ( num_param_bands_old != hParamMC->hMetadataPMC->num_parameter_bands && nchan_transport_old == nchan_transport )
        {
            int16_t new_param_band_idx, param_idx, source_param_idx;
+27 −5
Original line number Diff line number Diff line
@@ -682,6 +682,8 @@ ivas_error ivas_mc_dec_reconfig(
            {
                ivas_param_mc_dec_close( &st_ivas->hParamMC );
                st_ivas->hParamMC = NULL;
                /* remove ls conversion if it was allocated by ParamMC */
                ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion );
            }

            /* De-allocate McMasa-related handles */
@@ -696,12 +698,26 @@ ivas_error ivas_mc_dec_reconfig(
                ivas_qmetadata_close( &st_ivas->hQMetaData );
                st_ivas->hQMetaData = NULL;
            }

            /* init LS conversion if the renderer type asks for it */
            if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL)
            {
                if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
        }
    }
    else if ( st_ivas->mc_mode == MC_MODE_PARAMMC )
    {
        if ( last_mc_mode != MC_MODE_PARAMMC )
        {
            /* remove old ls conversion for MCT if open, gets reopened correctly within ivas_param_mc_dec_open when needed */
            if ( renderer_type_old == RENDERER_MC && st_ivas->hLsSetUpConversion != NULL )
            {
                ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion );
            }
            if ( ( error = ivas_param_mc_dec_open( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
@@ -757,6 +773,12 @@ ivas_error ivas_mc_dec_reconfig(
            }
        }

        /* ls conversion */
        if ( st_ivas->hLsSetUpConversion != NULL )
        {
            ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion );
        }

        if ( st_ivas->hParamMC != NULL )
        {
            ivas_param_mc_dec_close( &st_ivas->hParamMC );
@@ -885,7 +907,7 @@ ivas_error ivas_mc_dec_reconfig(
    }

    /* Allocat the LFE handle that is coded seperately after the allocation of the core coders*/
    if ( st_ivas->mc_mode == MC_MODE_MCT )
    if ( st_ivas->mc_mode == MC_MODE_MCT && st_ivas->hLFE == NULL )
    {

        if ( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtf != NULL ? st_ivas->hHrtf->latency_s : 0 ) ) != IVAS_ERR_OK )