Loading lib_dec/ivas_mct_dec.c +20 −11 Original line number Diff line number Diff line Loading @@ -685,10 +685,9 @@ static ivas_error ivas_mc_dec_reconfig( /* renderer might have changed, reselect */ renderer_type_old = st_ivas->renderer_type; ivas_renderer_select( st_ivas ); if ( st_ivas->mc_mode == MC_MODE_MCT ) { st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); st_ivas->nSCE = 0; st_ivas->nCPE = st_ivas->nchan_transport / 2; Loading Loading @@ -766,6 +765,7 @@ static ivas_error ivas_mc_dec_reconfig( ivas_mct_dec_close( &st_ivas->hMCT ); st_ivas->hMCT = NULL; } /* LFE handle */ if ( st_ivas->hLFE != NULL ) { Loading Loading @@ -810,6 +810,7 @@ static ivas_error ivas_mc_dec_reconfig( ivas_mct_dec_close( &st_ivas->hMCT ); st_ivas->hMCT = NULL; } /* LFE handle */ if ( st_ivas->hLFE != NULL ) { Loading @@ -828,8 +829,10 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->element_mode_init = IVAS_CPE_MDCT; } /*-----------------------------------------------------------------* * Reconfigure core coder *-----------------------------------------------------------------*/ /* re-configure core coder*/ /* special case: MCT->ParamMC with more than 2 TC, CPE 1 stays, but has the wrong mct_chan_mode in channel 1 and might have IGF static memory not allocated and the bit stream index list not set, set correct mct_chan_mode and init missing static mem Loading @@ -837,6 +840,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS ) { Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; if ( st_ivas->nchan_transport == 3 ) { st->mct_chan_mode = MCT_CHAN_MODE_IGNORE; Loading @@ -862,8 +866,7 @@ static ivas_error ivas_mc_dec_reconfig( #ifdef DEBUGGING assert( st_ivas->hCPE[1] != NULL ); #endif Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; st->mct_chan_mode = MCT_CHAN_MODE_LFE; st_ivas->hCPE[1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_LFE; } if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old ) ) != IVAS_ERR_OK ) Loading Loading @@ -924,10 +927,12 @@ static ivas_error ivas_mc_dec_reconfig( } } /* Allocat the LFE handle that is coded seperately after the allocation of the core coders*/ /*-----------------------------------------------------------------* * Allocate the LFE handle that is coded seperately after the allocation of the core coders *-----------------------------------------------------------------*/ 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 ) { return error; Loading @@ -941,9 +946,8 @@ static ivas_error ivas_mc_dec_reconfig( set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); } /*-----------------------------------------------------------------* * Renderers * Reconfigure renderers *-----------------------------------------------------------------*/ if ( renderer_type_old != st_ivas->renderer_type ) Loading @@ -951,6 +955,7 @@ static ivas_error ivas_mc_dec_reconfig( AUDIO_CONFIG output_config; output_config = st_ivas->hDecoderConfig->output_config; /* binaural renderers*/ if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) { Loading @@ -959,18 +964,22 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_binRenderer_close( &st_ivas->hBinRenderer ); } if ( st_ivas->hCrend != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hRenderConfig->roomAcoustics.late_reverb_on == 0 ) ) ) { ivas_crend_close( st_ivas ); } if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) { ivas_td_binaural_close( &st_ivas->hBinRendererTd ); } if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } /* init necessary new renderers */ if ( st_ivas->hBinRenderer == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { Loading Loading @@ -1009,7 +1018,7 @@ static ivas_error ivas_mc_dec_reconfig( } } } /* stereo */ /* mono/stereo */ else if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) { /* nothing should happen here... */ Loading @@ -1025,7 +1034,7 @@ static ivas_error ivas_mc_dec_reconfig( else if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) { /* FOA/HOA output */ /* Nothing to do, is always RENDERER_SBA_LINEAR_ENC */ /* Nothing to do, renderer is always RENDERER_SBA_LINEAR_ENC */ assert( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC && renderer_type_old == RENDERER_SBA_LINEAR_ENC ); } #endif Loading lib_enc/ivas_mct_enc.c +18 −5 Original line number Diff line number Diff line Loading @@ -620,6 +620,10 @@ static ivas_error ivas_mc_enc_reconfig( nSCE_old = st_ivas->nSCE; nCPE_old = st_ivas->nCPE; /*-----------------------------------------------------------------* * Reconfigure MC modules *-----------------------------------------------------------------*/ if ( st_ivas->mc_mode == MC_MODE_MCT ) { st_ivas->nSCE = 0; Loading @@ -634,6 +638,7 @@ static ivas_error ivas_mc_enc_reconfig( { return error; } /*De-allocate handles for other MC modes*/ if ( st_ivas->hParamMC != NULL ) { Loading @@ -647,6 +652,7 @@ static ivas_error ivas_mc_enc_reconfig( ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); st_ivas->hMcMasa = NULL; } if ( st_ivas->hMasa != NULL ) { ivas_masa_enc_close( st_ivas->hMasa, nchan_transport_old, MC_FORMAT ); Loading Loading @@ -698,6 +704,7 @@ static ivas_error ivas_mc_enc_reconfig( ivas_mct_enc_close( st_ivas->hMCT ); st_ivas->hMCT = NULL; } if ( last_mc_mode == MC_MODE_MCT && st_ivas->hLFE != NULL ) { /* LFE handle */ Loading Loading @@ -732,6 +739,7 @@ static ivas_error ivas_mc_enc_reconfig( ivas_param_mc_enc_close( st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); st_ivas->hParamMC = NULL; } if ( last_mc_mode == MC_MODE_MCT ) { /* LFE handle */ Loading @@ -757,7 +765,10 @@ static ivas_error ivas_mc_enc_reconfig( st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } /* re-configure core coder*/ /*-----------------------------------------------------------------* * Reconfigure core coder *-----------------------------------------------------------------*/ /* special case: MCT->ParamMC with more than 2 TC, CPE 1 stays, but has the wrong mct_chan_mode in channel 1 and might have IGF and TranDet static memory not allocated and the bit stream index list not set, set correct mct_chan_mode and init missing static mem Loading @@ -765,6 +776,7 @@ static ivas_error ivas_mc_enc_reconfig( if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS ) { Encoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; if ( st_ivas->nchan_transport == 3 ) { st->mct_chan_mode = MCT_CHAN_MODE_IGNORE; Loading @@ -773,15 +785,17 @@ static ivas_error ivas_mc_enc_reconfig( { st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; } if ( st->hTranDet == NULL ) { if ( ( st->hTranDet = (TRAN_DET_HANDLE) count_malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) ); } InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); } if ( st->hIGFEnc == NULL ) { if ( ( st->hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) count_malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL ) Loading @@ -789,6 +803,7 @@ static ivas_error ivas_mc_enc_reconfig( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hIGFEnc\n" ) ); } } st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); } else if ( last_mc_mode == MC_MODE_PARAMMC && st_ivas->mc_mode == MC_MODE_MCT && nchan_transport_old > 2 ) Loading @@ -796,11 +811,9 @@ static ivas_error ivas_mc_enc_reconfig( #ifdef DEBUGGING assert( st_ivas->hCPE[1] != NULL ); #endif Encoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; st->mct_chan_mode = MCT_CHAN_MODE_LFE; st_ivas->hCPE[1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_LFE; } if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old ) ) != IVAS_ERR_OK ) { return error; Loading Loading
lib_dec/ivas_mct_dec.c +20 −11 Original line number Diff line number Diff line Loading @@ -685,10 +685,9 @@ static ivas_error ivas_mc_dec_reconfig( /* renderer might have changed, reselect */ renderer_type_old = st_ivas->renderer_type; ivas_renderer_select( st_ivas ); if ( st_ivas->mc_mode == MC_MODE_MCT ) { st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); st_ivas->nSCE = 0; st_ivas->nCPE = st_ivas->nchan_transport / 2; Loading Loading @@ -766,6 +765,7 @@ static ivas_error ivas_mc_dec_reconfig( ivas_mct_dec_close( &st_ivas->hMCT ); st_ivas->hMCT = NULL; } /* LFE handle */ if ( st_ivas->hLFE != NULL ) { Loading Loading @@ -810,6 +810,7 @@ static ivas_error ivas_mc_dec_reconfig( ivas_mct_dec_close( &st_ivas->hMCT ); st_ivas->hMCT = NULL; } /* LFE handle */ if ( st_ivas->hLFE != NULL ) { Loading @@ -828,8 +829,10 @@ static ivas_error ivas_mc_dec_reconfig( st_ivas->element_mode_init = IVAS_CPE_MDCT; } /*-----------------------------------------------------------------* * Reconfigure core coder *-----------------------------------------------------------------*/ /* re-configure core coder*/ /* special case: MCT->ParamMC with more than 2 TC, CPE 1 stays, but has the wrong mct_chan_mode in channel 1 and might have IGF static memory not allocated and the bit stream index list not set, set correct mct_chan_mode and init missing static mem Loading @@ -837,6 +840,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS ) { Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; if ( st_ivas->nchan_transport == 3 ) { st->mct_chan_mode = MCT_CHAN_MODE_IGNORE; Loading @@ -862,8 +866,7 @@ static ivas_error ivas_mc_dec_reconfig( #ifdef DEBUGGING assert( st_ivas->hCPE[1] != NULL ); #endif Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; st->mct_chan_mode = MCT_CHAN_MODE_LFE; st_ivas->hCPE[1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_LFE; } if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old ) ) != IVAS_ERR_OK ) Loading Loading @@ -924,10 +927,12 @@ static ivas_error ivas_mc_dec_reconfig( } } /* Allocat the LFE handle that is coded seperately after the allocation of the core coders*/ /*-----------------------------------------------------------------* * Allocate the LFE handle that is coded seperately after the allocation of the core coders *-----------------------------------------------------------------*/ 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 ) { return error; Loading @@ -941,9 +946,8 @@ static ivas_error ivas_mc_dec_reconfig( set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); } /*-----------------------------------------------------------------* * Renderers * Reconfigure renderers *-----------------------------------------------------------------*/ if ( renderer_type_old != st_ivas->renderer_type ) Loading @@ -951,6 +955,7 @@ static ivas_error ivas_mc_dec_reconfig( AUDIO_CONFIG output_config; output_config = st_ivas->hDecoderConfig->output_config; /* binaural renderers*/ if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) { Loading @@ -959,18 +964,22 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_binRenderer_close( &st_ivas->hBinRenderer ); } if ( st_ivas->hCrend != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hRenderConfig->roomAcoustics.late_reverb_on == 0 ) ) ) { ivas_crend_close( st_ivas ); } if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) { ivas_td_binaural_close( &st_ivas->hBinRendererTd ); } if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } /* init necessary new renderers */ if ( st_ivas->hBinRenderer == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { Loading Loading @@ -1009,7 +1018,7 @@ static ivas_error ivas_mc_dec_reconfig( } } } /* stereo */ /* mono/stereo */ else if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) { /* nothing should happen here... */ Loading @@ -1025,7 +1034,7 @@ static ivas_error ivas_mc_dec_reconfig( else if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) { /* FOA/HOA output */ /* Nothing to do, is always RENDERER_SBA_LINEAR_ENC */ /* Nothing to do, renderer is always RENDERER_SBA_LINEAR_ENC */ assert( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC && renderer_type_old == RENDERER_SBA_LINEAR_ENC ); } #endif Loading
lib_enc/ivas_mct_enc.c +18 −5 Original line number Diff line number Diff line Loading @@ -620,6 +620,10 @@ static ivas_error ivas_mc_enc_reconfig( nSCE_old = st_ivas->nSCE; nCPE_old = st_ivas->nCPE; /*-----------------------------------------------------------------* * Reconfigure MC modules *-----------------------------------------------------------------*/ if ( st_ivas->mc_mode == MC_MODE_MCT ) { st_ivas->nSCE = 0; Loading @@ -634,6 +638,7 @@ static ivas_error ivas_mc_enc_reconfig( { return error; } /*De-allocate handles for other MC modes*/ if ( st_ivas->hParamMC != NULL ) { Loading @@ -647,6 +652,7 @@ static ivas_error ivas_mc_enc_reconfig( ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); st_ivas->hMcMasa = NULL; } if ( st_ivas->hMasa != NULL ) { ivas_masa_enc_close( st_ivas->hMasa, nchan_transport_old, MC_FORMAT ); Loading Loading @@ -698,6 +704,7 @@ static ivas_error ivas_mc_enc_reconfig( ivas_mct_enc_close( st_ivas->hMCT ); st_ivas->hMCT = NULL; } if ( last_mc_mode == MC_MODE_MCT && st_ivas->hLFE != NULL ) { /* LFE handle */ Loading Loading @@ -732,6 +739,7 @@ static ivas_error ivas_mc_enc_reconfig( ivas_param_mc_enc_close( st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); st_ivas->hParamMC = NULL; } if ( last_mc_mode == MC_MODE_MCT ) { /* LFE handle */ Loading @@ -757,7 +765,10 @@ static ivas_error ivas_mc_enc_reconfig( st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } /* re-configure core coder*/ /*-----------------------------------------------------------------* * Reconfigure core coder *-----------------------------------------------------------------*/ /* special case: MCT->ParamMC with more than 2 TC, CPE 1 stays, but has the wrong mct_chan_mode in channel 1 and might have IGF and TranDet static memory not allocated and the bit stream index list not set, set correct mct_chan_mode and init missing static mem Loading @@ -765,6 +776,7 @@ static ivas_error ivas_mc_enc_reconfig( if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS ) { Encoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; if ( st_ivas->nchan_transport == 3 ) { st->mct_chan_mode = MCT_CHAN_MODE_IGNORE; Loading @@ -773,15 +785,17 @@ static ivas_error ivas_mc_enc_reconfig( { st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; } if ( st->hTranDet == NULL ) { if ( ( st->hTranDet = (TRAN_DET_HANDLE) count_malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) ); } InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); } if ( st->hIGFEnc == NULL ) { if ( ( st->hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) count_malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL ) Loading @@ -789,6 +803,7 @@ static ivas_error ivas_mc_enc_reconfig( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hIGFEnc\n" ) ); } } st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); } else if ( last_mc_mode == MC_MODE_PARAMMC && st_ivas->mc_mode == MC_MODE_MCT && nchan_transport_old > 2 ) Loading @@ -796,11 +811,9 @@ static ivas_error ivas_mc_enc_reconfig( #ifdef DEBUGGING assert( st_ivas->hCPE[1] != NULL ); #endif Encoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; st->mct_chan_mode = MCT_CHAN_MODE_LFE; st_ivas->hCPE[1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_LFE; } if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old ) ) != IVAS_ERR_OK ) { return error; Loading