From 2b74dee859fd2a7a809e218eed9086d8a28180ea Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 24 Oct 2022 15:04:28 +1100 Subject: [PATCH 01/14] SBA bitrate switching changes with re-init function --- lib_com/ivas_prot.h | 18 +- lib_com/ivas_sba_config.c | 22 +- lib_com/options.h | 2 +- lib_debug/mem_count.c | 5 +- lib_dec/ivas_init_dec.c | 19 +- lib_dec/ivas_sba_dec.c | 460 ++++++++++++++++++++++ lib_enc/ivas_enc.c | 22 +- lib_enc/ivas_sba_enc.c | 219 ++++++++++ scripts/config/self_test.prm | 15 + scripts/switchPaths/sw_13k2_192k_50fr.bin | 3 + scripts/switchPaths/sw_16k4_512k_50fr.bin | 3 + 11 files changed, 778 insertions(+), 10 deletions(-) create mode 100644 scripts/switchPaths/sw_13k2_192k_50fr.bin create mode 100644 scripts/switchPaths/sw_16k4_512k_50fr.bin diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ff23fb7ebf..d8de806183 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -106,7 +106,17 @@ ivas_error mct_enc_reconfigure( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const uint16_t b_nchan_change /* i : flag indicating different channel count */ ); - +#ifdef SBA_BR_SWITCHING +ivas_error ivas_sba_enc_reinit( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); +#endif +#ifdef SBA_BR_SWITCHING +int16_t get_sba_reinit_flag( + int32_t ivas_total_bitrate, /* i: current bitrate */ + int32_t last_ivas_total_brate /* i: previous bitrate */ +); +#endif ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -3053,7 +3063,11 @@ void ivas_sba_config( int16_t *nCPE, /* o : number of CPEs */ int16_t *element_mode /* o : element mode of the core coder */ ); - +#ifdef SBA_BR_SWITCHING +ivas_error ivas_sba_dec_reinit( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +#endif ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index d7e47960b0..fecb7ac8e4 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -71,8 +71,26 @@ SBA_MODE ivas_sba_mode_select( return sba_mode; } - - +#ifdef SBA_BR_SWITCHING +/*-------------------------------------------------------------------* + * get_sba_reinit_flag() + * + * Get SBA reinitialisation flag + *-------------------------------------------------------------------*/ +int16_t get_sba_reinit_flag( + int32_t ivas_total_bitrate, /* i : Current bitrate */ + int32_t last_ivas_total_brate /* i : Previous bitrate */ +) +{ + int16_t sba_reinit_flag; + sba_reinit_flag = 0; + if ( ivas_total_bitrate != last_ivas_total_brate && ( last_ivas_total_brate > IVAS_SID_5k2 ) && ( ivas_total_bitrate > IVAS_SID_5k2 ) ) + { + sba_reinit_flag = 1; + } + return sba_reinit_flag; +} +#endif /*-------------------------------------------------------------------* * ivas_sba_config() * diff --git a/lib_com/options.h b/lib_com/options.h index b988fcb581..261f3a0845 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,7 +152,7 @@ #define FIX_155_HP20_ISSUE /* Issue 155: apply hp20 on all input channels instead of just 2 channels */ #define EFAP_FIX_POLY /* Issue 167: fix bug in EFAP polygon selection */ #define SBA_HOA_HBR_IMPROV /* issue 91: Improvements to SBA high bitrate HOA3 coding */ - +#define SBA_BR_SWITCHING /* Issue 114: Changes for sba bit rate switching*/ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_debug/mem_count.c b/lib_debug/mem_count.c index b12639ae3f..a4ec2fb8d7 100644 --- a/lib_debug/mem_count.c +++ b/lib_debug/mem_count.c @@ -93,8 +93,11 @@ typedef INT64 int64_t; /* This is the maximum number of allocations for which to keep information. It can be increased if required. */ +#ifdef SBA_BR_SWITCHING +#define MAX_INFO_RECORDS 3200 +#else #define MAX_INFO_RECORDS 3000 - +#endif /* This is the length after which the function name will be truncated when the summary is printed. */ #define MAX_FUNCTION_NAME_LENGTH 18 diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e3849dfbe0..fec237719a 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -69,7 +69,6 @@ ivas_error ivas_dec_setup( Decoder_State *st; int32_t ivas_total_brate; ivas_error error; - error = IVAS_ERR_OK; num_bits_read = 0; @@ -128,10 +127,24 @@ ivas_error ivas_dec_setup( num_bits_read += SBA_ORDER_BITS; if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 ) { - if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) +#ifdef SBA_BR_SWITCHING + if ( get_sba_reinit_flag( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { - return error; + if ( ( error = ivas_sba_dec_reinit( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } + else + { +#endif + if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef SBA_BR_SWITCHING + } +#endif } else { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 2180cb79a3..564abeee6a 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -335,7 +335,467 @@ void ivas_ism2sba( return; } +#ifdef SBA_BR_SWITCHING +/*-------------------------------------------------------------------* + * ivas_sba_dec_reinit() + * + * Reinitialisation of IVAS SBA decoder + *-------------------------------------------------------------------*/ + +ivas_error ivas_sba_dec_reinit( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t i, k, n; + int16_t sce_id, cpe_id; + int16_t numCldfbAnalyses; + int16_t numCldfbSyntheses; + int32_t output_Fs, ivas_total_brate; + AUDIO_CONFIG output_config; + DECODER_CONFIG_HANDLE hDecoderConfig; + ivas_error error; + + error = IVAS_ERR_OK; + + output_Fs = st_ivas->hDecoderConfig->output_Fs; + hDecoderConfig = st_ivas->hDecoderConfig; + output_config = hDecoderConfig->output_config; + ivas_total_brate = hDecoderConfig->ivas_total_brate; + + hDecoderConfig->last_ivas_total_brate = ivas_total_brate; + /*------------------------------------------------------------------------------------------* + * Closing Decoder handles before Reinitialisation + *------------------------------------------------------------------------------------------*/ + /* Qmetadata handle */ + ivas_qmetadata_close( &st_ivas->hQMetaData ); + + /* DirAC handle */ + if ( st_ivas->hDirAC != NULL ) + { + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + ivas_param_ism_dec_close( st_ivas->hDirAC, st_ivas->hDecoderConfig->output_config ); + } + else + { + ivas_dirac_dec_close( st_ivas->hDirAC ); + } + st_ivas->hDirAC = NULL; + } + + /* Spar handle */ + if ( st_ivas->hSpar != NULL ) + { + ivas_spar_dec_close( st_ivas->hSpar, st_ivas->hDecoderConfig->output_Fs ); + st_ivas->hSpar = NULL; + } + + /* SCE handles */ + for ( i = 0; i < MAX_SCE; i++ ) + { + if ( st_ivas->hSCE[i] != NULL ) + { + destroy_sce_dec( st_ivas->hSCE[i] ); + st_ivas->hSCE[i] = NULL; + } + } + + /* CPE handles */ + for ( i = 0; i < MAX_CPE; i++ ) + { + if ( st_ivas->hCPE[i] != NULL ) + { + /* set pointer to NULL as core coder already deallocated in destroy_sce_dec() */ + if ( st_ivas->sba_dirac_stereo_flag ) + { + st_ivas->hCPE[i]->hCoreCoder[0] = NULL; + st_ivas->hCPE[i]->hCoreCoder[1] = NULL; + } + destroy_cpe_dec( st_ivas->hCPE[i] ); + st_ivas->hCPE[i] = NULL; + } + } + + /* MCT handle */ + ivas_mct_dec_close( &st_ivas->hMCT ); + + /* HP20 filter handles */ + if ( st_ivas->mem_hp20_out != NULL ) + { + for ( i = 0; i < getNumChanSynthesis( st_ivas ); i++ ) + { + count_free( st_ivas->mem_hp20_out[i] ); + st_ivas->mem_hp20_out[i] = NULL; + } + count_free( st_ivas->mem_hp20_out ); + st_ivas->mem_hp20_out = NULL; + } + + /* HOA decoder matrix */ + if ( st_ivas->hoa_dec_mtx != NULL ) + { + count_free( st_ivas->hoa_dec_mtx ); + st_ivas->hoa_dec_mtx = NULL; + } + + /* Parametric MC handle */ + ivas_param_mc_dec_close( &st_ivas->hParamMC ); + + /* EFAP handle */ + efap_free_data( &st_ivas->hEFAPdata ); + + /* VBAP handle */ + vbap_free_data( &( st_ivas->hVBAPdata ) ); + + /* Fastconv binaural renderer handle */ + ivas_binRenderer_close( &st_ivas->hBinRenderer ); + + /* Parametric binaural renderer handle */ + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + + /* Crend handle */ + ivas_crend_close( st_ivas ); + + /* LS config converter handle */ + ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); + + /* Custom LS configuration handle */ + if ( st_ivas->hLsSetupCustom != NULL ) + { + count_free( st_ivas->hLsSetupCustom ); + st_ivas->hLsSetupCustom = NULL; + } + + /* MASA decoder structure */ + if ( st_ivas->hMasa != NULL ) + { + ivas_masa_dec_close( st_ivas->hMasa ); + st_ivas->hMasa = NULL; + } + + /* Downmix structure */ + if ( st_ivas->hMonoDmxRenderer != NULL ) + { + count_free( st_ivas->hMonoDmxRenderer ); + st_ivas->hMonoDmxRenderer = NULL; + } + + /* Head track data handle */ + if ( st_ivas->hHeadTrackData != NULL ) + { + count_free( st_ivas->hHeadTrackData ); + st_ivas->hHeadTrackData = NULL; + } + + /* Time Domain binaural renderer handle */ + if ( st_ivas->hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + } + else if ( st_ivas->hHrtfTD != NULL ) + { + /* Case when HRTF filter is mistakenly specified but TD renderer was not active */ + if ( st_ivas->hHrtfTD->ModelParams.UseItdModel && !st_ivas->hHrtfTD->ModelParams.modelROM ) + { + BSplineModelEvalITDDealloc( &st_ivas->hHrtfTD->ModelParamsITD ); + } + + BSplineModelEvalDealloc( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); + + ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); + } + + /* Config. Renderer */ + ivas_render_config_close( &( st_ivas->hRenderConfig ) ); + + for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + { + if ( st_ivas->cldfbAnaDec[i] != NULL ) + { + deleteCldfb( &( st_ivas->cldfbAnaDec[i] ) ); + st_ivas->cldfbAnaDec[i] = NULL; + } + } + + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + if ( st_ivas->cldfbSynDec[i] != NULL ) + { + deleteCldfb( &( st_ivas->cldfbSynDec[i] ) ); + st_ivas->cldfbSynDec[i] = NULL; + } + } + + st_ivas->sba_dirac_stereo_flag = 0; + /*Reconfigure output paramaters*/ + ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init ); + ivas_renderer_select( st_ivas ); + ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); + /*------------------------------------------------------------------------------------------* + * Reopening Decoder handles for Reinitialisation + *------------------------------------------------------------------------------------------*/ + if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) + { + if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) + { + if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( k = 0; k < DIRAC_MAX_NBANDS; k++ ) + { + st_ivas->hSpar->dirac_to_spar_md_bands[k] = st_ivas->hDirAC->dirac_to_spar_md_bands[k]; + } + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; + } + else + { + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; + + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); + } + } + else + { + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ); + + if ( ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup ) + { + int16_t ambisonics_order; + + ambisonics_order = ivas_sba_get_order_transport( st_ivas->nchan_transport ); // VE: is it needed ? + + if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, ambisonics_order ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) && !st_ivas->hIntSetup.is_loudspeaker_setup ) + { + IVAS_OUTPUT_SETUP out_setup; + + ivas_output_init( &out_setup, AUDIO_CONFIG_7_1_4 ); + if ( ( error = ivas_sba_get_hoa_dec_matrix( out_setup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && + st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) + { + if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + if ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + if ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + /* create CPE element for DFT Stereo like upmix */ + if ( st_ivas->sba_dirac_stereo_flag ) + { + if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ + } + + /* set CNA/CNG flags */ + if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) + { + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ + st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; + } + else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) + { + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; + st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; + } + else if ( st_ivas->nchan_transport == 2 ) + { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + st_ivas->hCPE[0]->hCoreCoder[n]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ + st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; + } + } + if ( st_ivas->nCPE > 1 ) + { + if ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + /* set number of output channels used for synthesis/decoding */ + n = getNumChanSynthesis( st_ivas ); + + if ( n > 0 ) + { + if ( ( st_ivas->mem_hp20_out = (float **) count_malloc( n * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + } + else + { + st_ivas->mem_hp20_out = NULL; + } + + for ( i = 0; i < n; i++ ) + { + if ( ( st_ivas->mem_hp20_out[i] = (float *) count_malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + + set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM ); + } + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) + { + if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) + { + if ( ( st_ivas->hCrend = (CREND_HANDLE) count_malloc( sizeof( CREND_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR Crend\n" ); + } + } + } + else if ( st_ivas->renderer_type == RENDERER_MC ) + { + if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) + { + if ( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "ivas_crend_open failed" ); + } + } + ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); + + for ( i = 0; i < numCldfbAnalyses; i++ ) + { + if ( ( error = openCldfb( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + for ( ; i < MAX_INTERN_CHANNELS; i++ ) + { + st_ivas->cldfbAnaDec[i] = NULL; + } + + for ( i = 0; i < numCldfbSyntheses; i++ ) + { + if ( ( error = openCldfb( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + for ( ; i < MAX_OUTPUT_CHANNELS; i++ ) + { + st_ivas->cldfbSynDec[i] = NULL; + } + + /* CLDFB Interpolation weights */ + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) + { + ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); + } + return error; +} +#endif /*-------------------------------------------------------------------* * ivas_sba_dec_decoder() diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 75ffc5212d..7be1f11c49 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -65,7 +65,9 @@ ivas_error ivas_enc( float data_f[MAX_INPUT_CHANNELS][L_FRAME48k]; /* IVAS_fmToDo: buffer can be allocated dynamically based on the number of analysed channels */ int32_t ivas_total_brate; ivas_error error; - +#ifdef SBA_BR_SWITCHING + int16_t sba_reinit_flag; +#endif error = IVAS_ERR_OK; wmops_sub_start( "ivas_enc" ); @@ -85,6 +87,20 @@ ivas_error ivas_enc( n_samples_chan = n_samples / nchan_inp; set_s( nb_bits_metadata, 0, MAX_SCE ); +#ifdef SBA_BR_SWITCHING + sba_reinit_flag = 0; + if ( ivas_format == SBA_FORMAT ) + { + sba_reinit_flag = get_sba_reinit_flag( ivas_total_brate, st_ivas->hEncoderConfig->last_ivas_total_brate ); + if ( sba_reinit_flag ) + { + if ( ( error = ivas_sba_enc_reinit( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } +#endif /*----------------------------------------------------------------* * convert 'short' input data to 'float' @@ -189,7 +205,11 @@ ivas_error ivas_enc( /* SBA/MASA configuration */ if ( ivas_format == SBA_FORMAT ) { +#ifndef SBA_BR_SWITCHING if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) +#else + if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( !sba_reinit_flag ) ) +#endif { if ( ( error = ivas_sba_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index d4c7c70b21..fe400bb378 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -93,7 +93,226 @@ void ivas_sba_getTCs( return; } +#ifdef SBA_BR_SWITCHING +/*-------------------------------------------------------------------* + * ivas_sba_enc_reinit() + * + * Reinitialise IVAS SBA encoder + *-------------------------------------------------------------------*/ + +ivas_error ivas_sba_enc_reinit( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +) +{ + int16_t nSCE_old; + int16_t nCPE_old; + int16_t sce_id; + int16_t cpe_id; + int16_t n; + Indice *ind_list_metadata; + int32_t ivas_total_brate; + int16_t i, nchan_inp; + ivas_error error; + ENCODER_CONFIG_HANDLE hEncoderConfig; + + Indice *ind_list; + BSTR_ENC_HANDLE hBstr; + BSTR_ENC_HANDLE hMetaData; + hEncoderConfig = st_ivas->hEncoderConfig; + ivas_total_brate = hEncoderConfig->ivas_total_brate; + error = IVAS_ERR_OK; + nchan_inp = st_ivas->hEncoderConfig->nchan_inp; + ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; + + nCPE_old = st_ivas->nCPE; + nSCE_old = st_ivas->nSCE; + ind_list_metadata = NULL; + + + ind_list = NULL; + hBstr = NULL; + hMetaData = NULL; + + /* get the index list pointers */ + if ( nSCE_old ) + { + hBstr = st_ivas->hSCE[0]->hCoreCoder[0]->hBstr; + hMetaData = st_ivas->hSCE[0]->hMetaData; + } + else if ( nCPE_old ) + { + hBstr = st_ivas->hCPE[0]->hCoreCoder[0]->hBstr; + hMetaData = st_ivas->hCPE[nCPE_old - 1]->hMetaData; + } + + /* save bitstream information */ + ind_list = hBstr->ind_list; + ind_list_metadata = hMetaData->ind_list; + + /*------------------------------------------------------------------------------------------* + * Closing Encoder handles before Reinitialisation + *------------------------------------------------------------------------------------------*/ + + /* Q Metadata handle */ + ivas_qmetadata_close( &( st_ivas->hQMetaData ) ); + /* DirAC handle */ + if ( st_ivas->hDirAC != NULL ) + { + ivas_dirac_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); + + st_ivas->hDirAC = NULL; + } + + /* SPAR handle */ + if ( st_ivas->hSpar != NULL ) + { + ivas_spar_enc_close( st_ivas->hSpar, st_ivas->hEncoderConfig->input_Fs, nchan_inp ); + st_ivas->hSpar = NULL; + } + /* SCE handles */ + for ( i = 0; i < MAX_SCE; i++ ) + { + if ( st_ivas->hSCE[i] != NULL ) + { + destroy_sce_enc( st_ivas->hSCE[i] ); + st_ivas->hSCE[i] = NULL; + } + } + + /* CPE handles */ + for ( i = 0; i < MAX_CPE; i++ ) + { + if ( st_ivas->hCPE[i] != NULL ) + { + destroy_cpe_enc( st_ivas->hCPE[i] ); + st_ivas->hCPE[i] = NULL; + } + } + /* MCT handle */ + if ( st_ivas->hMCT != NULL ) + { + ivas_mct_enc_close( st_ivas->hMCT ); + st_ivas->hMCT = NULL; + } + if ( st_ivas->mem_hp20_in != NULL ) + { + n = getNumChanAnalysis( st_ivas ); + + for ( i = 0; i < n; i++ ) + { + count_free( st_ivas->mem_hp20_in[i] ); + st_ivas->mem_hp20_in[i] = NULL; + } + count_free( st_ivas->mem_hp20_in ); + st_ivas->mem_hp20_in = NULL; + } + + /*------------------------------------------------------------------------------------------* + * Reopening Encoder handles for Reinitialisation + *------------------------------------------------------------------------------------------*/ + + if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); + st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); + + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + if ( ( error = ivas_spar_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( ( error = ivas_dirac_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + + for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + if ( ( error = create_sce_enc( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* prepare bitstream buffers */ + st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list + sce_id * MAX_NUM_INDICES; + reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); + + st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata + sce_id * MAX_BITS_METADATA; + reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); + + if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->hEncoderConfig->Opt_DTX_ON ) + { + st_ivas->hSCE[sce_id]->hCoreCoder[0]->dtx_sce_sba = 1; + } + } + + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* prepare bitstream buffers */ + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n ) * MAX_NUM_INDICES; + reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); + + if ( hEncoderConfig->Opt_DTX_ON ) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 1; + } + } + + /* Metadata only initialized for the last CPE index */ + if ( cpe_id == st_ivas->nCPE - 1 ) + { + st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata + sce_id * MAX_BITS_METADATA; + reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); + } + } + + if ( st_ivas->nCPE > 1 ) + { + if ( ( error = create_mct_enc( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + n = getNumChanAnalysis( st_ivas ); + + if ( n > 0 ) + { + if ( ( st_ivas->mem_hp20_in = (float **) count_malloc( n * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + } + else + { + st_ivas->mem_hp20_in = NULL; + } + for ( i = 0; i < n; i++ ) + { + if ( ( st_ivas->mem_hp20_in[i] = (float *) count_malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + + set_f( st_ivas->mem_hp20_in[i], 0.0f, L_HP20_MEM ); + } + return error; +} +#endif /*-------------------------------------------------------------------* * ivas_sba_enc_reconfigure() * diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 470b649ce0..fda5d04295 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -585,6 +585,21 @@ ../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.pcm bit ../IVAS_dec binaural 48 bit testv/stv3OA48c.pcm_SBA_512000_48-48_binaural.tst +// SBA FOA bitrate switching from 16.4 kbps to 512 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -sba 1 ../scripts/switchPaths/sw_16k4_512k_50fr.bin 48 testv/stvFOA48c.pcm bit +../IVAS_dec FOA 48 bit testv/stvFOA48c.pcm_sw_48-48_FOA.tst + +// SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 48 testv/stvFOA48c.pcm bit +../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.pcm_sw_48-48_BINAURAL.tst + +// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.pcm bit +../IVAS_dec HOA3 48 bit testv/stv3OA48c.pcm_sw_48-48_HOA3.tst + +// SBA 3OA bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, 7_1_4 out +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stvFOA48c.pcm bit +../IVAS_dec 7_1_4 48 bit testv/stvFOA48c.pcm_sw_48-48_7_1_4.tst // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out ../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 13200 48 testv/stv_IVASMASA_1dir1TC.pcm bit diff --git a/scripts/switchPaths/sw_13k2_192k_50fr.bin b/scripts/switchPaths/sw_13k2_192k_50fr.bin new file mode 100644 index 0000000000..cd833ebd24 --- /dev/null +++ b/scripts/switchPaths/sw_13k2_192k_50fr.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58b5dfb78c283c6d9d5f52502a695c1f9e9e62589507736af5667e00dac4a890 +size 3996 diff --git a/scripts/switchPaths/sw_16k4_512k_50fr.bin b/scripts/switchPaths/sw_16k4_512k_50fr.bin new file mode 100644 index 0000000000..6f57a5afe8 --- /dev/null +++ b/scripts/switchPaths/sw_16k4_512k_50fr.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8abe2e5fb8110fa5f79f8df67986f4ac00809db9b7c19b9824a520a437b00250 +size 3996 -- GitLab From bd0762f1dbcba304927ffba537152334e92ff0b6 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 26 Oct 2022 11:22:32 +1100 Subject: [PATCH 02/14] changes as per review comments --- lib_com/ivas_prot.h | 4 ++++ lib_debug/mem_count.c | 2 +- lib_dec/ivas_spar_decoder.c | 7 ++++++- lib_dec/ivas_spar_md_dec.c | 17 ++++++++++++----- lib_enc/ivas_spar_md_enc.c | 7 +++---- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index d8de806183..ed67a41986 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4024,6 +4024,10 @@ ivas_error ivas_spar_md_dec_init( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ +#ifdef SBA_HOA_HBR_IMPROV + , + const int16_t sba_order /* i : SBA order */ +#endif ); void ivas_spar_md_dec_process( diff --git a/lib_debug/mem_count.c b/lib_debug/mem_count.c index a4ec2fb8d7..02ec086f10 100644 --- a/lib_debug/mem_count.c +++ b/lib_debug/mem_count.c @@ -94,7 +94,7 @@ typedef INT64 int64_t; /* This is the maximum number of allocations for which to keep information. It can be increased if required. */ #ifdef SBA_BR_SWITCHING -#define MAX_INFO_RECORDS 3200 +#define MAX_INFO_RECORDS 5000 #else #define MAX_INFO_RECORDS 3000 #endif diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 7a0590e6c1..10a5a96430 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -666,7 +666,12 @@ static void ivas_spar_dec_MD( hSpar->hMdDec->table_idx = table_idx; hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[table_idx].td_ducking; - ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels ); + ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels +#ifdef SBA_HOA_HBR_IMPROV + , + sba_order +#endif + ); } } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 3d5f03b208..30684bbf8e 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -271,12 +271,14 @@ ivas_error ivas_spar_md_dec_open( return error; } -#ifdef SBA_HOA_HBR_IMPROV - hMdDec->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate ); -#endif hMdDec->table_idx = 0; /* just to initialize state variables*/ - if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels +#ifdef SBA_HOA_HBR_IMPROV + , + sba_order +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -438,6 +440,10 @@ ivas_error ivas_spar_md_dec_init( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ +#ifdef SBA_HOA_HBR_IMPROV + , + const int16_t sba_order /* i : SBA order */ +#endif ) { int16_t i, j, k; @@ -447,6 +453,7 @@ ivas_error ivas_spar_md_dec_init( hMdDec->spar_md_cfg.gen_bs = 1; // VE2DB : always 1 - can it be removed? #ifdef SBA_HOA_HBR_IMPROV + hMdDec->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate ); hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); #else hMdDec->spar_md.num_bands = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); @@ -1419,7 +1426,7 @@ void ivas_spar_dec_gen_umx_mat( } } } - + #ifdef DEBUG_SBA_MD_DUMP { static FILE *f_mat = 0; diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 2624389cc4..76b2495b24 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -121,10 +121,6 @@ ivas_error ivas_spar_md_enc_open( num_channels = 2 * sba_order + 2; -#ifdef SBA_HOA_HBR_IMPROV - hMdEnc->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hEncoderConfig->ivas_total_brate ); -#endif - if ( ( hMdEnc->spar_md.band_coeffs = (ivas_band_coeffs_t *) count_malloc( IVAS_MAX_NUM_BANDS * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" ); @@ -319,6 +315,9 @@ static ivas_error ivas_spar_md_enc_init( float PR_minmax[2]; int16_t num_channels, i, j, k; +#ifdef SBA_HOA_HBR_IMPROV + hMdEnc->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hEncoderConfig->ivas_total_brate ); +#endif num_channels = ivas_sba_get_nchan_metadata( sba_order ); table_idx = ivas_get_spar_table_idx( hEncoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); -- GitLab From f14f9fd882f1ab2f9ccd1c922cd99e35ff7644c3 Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 26 Oct 2022 12:30:37 +0200 Subject: [PATCH 03/14] enable SBA rate switching conditions in smoke test --- ci/smoke_test.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ci/smoke_test.sh b/ci/smoke_test.sh index b8c4bdd3f0..e3caac3533 100755 --- a/ci/smoke_test.sh +++ b/ci/smoke_test.sh @@ -8,8 +8,5 @@ fi make clean make all -j 8 -# get all modes except SBA rate switching (which is broken currently) -list=$(./scripts/runIvasCodec.py -l | grep -v "SBA.*rs") -./scripts/runIvasCodec.py -p ./scripts/config/ci_linux.json -m $list -U 1 | tee smoke_test_output.txt - -./scripts/runIvasCodec.py -p ./scripts/config/ci_linux.json -m $list -U 1 -D="-fec 15" --decoder_only | tee smoke_test_output_plc.txt +./scripts/runIvasCodec.py -p ./scripts/config/ci_linux.json -U 1 | tee smoke_test_output.txt +./scripts/runIvasCodec.py -p ./scripts/config/ci_linux.json -U 1 -D="-fec 15" --decoder_only | tee smoke_test_output_plc.txt -- GitLab From 433bde48a04506a1f5af0fa796dc90f1cb79c60b Mon Sep 17 00:00:00 2001 From: knj Date: Thu, 27 Oct 2022 13:22:50 +0200 Subject: [PATCH 04/14] do not filter out rate switching modes for SBA anymore --- ci/run_scheduled_sanitizer_test.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/ci/run_scheduled_sanitizer_test.py b/ci/run_scheduled_sanitizer_test.py index 4f3cd25c0b..8d257edf99 100644 --- a/ci/run_scheduled_sanitizer_test.py +++ b/ci/run_scheduled_sanitizer_test.py @@ -48,9 +48,6 @@ def get_modes(in_format: str) -> list: in_format = "MC_" + in_format + "_b" mode_list = [m for m in output.splitlines() if in_format in m] - if "SBA" in in_format: - # rate switching not implemented yet - mode_list = [m for m in mode_list if not "_rs" in m] return mode_list -- GitLab From 35faa10618078bae4e9be2afcdc5c1b5193c8738 Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 11:22:51 +1100 Subject: [PATCH 05/14] Fix memory leak with binaural and binaural room output --- lib_debug/mem_count.c | 2 +- lib_dec/ivas_sba_dec.c | 44 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/lib_debug/mem_count.c b/lib_debug/mem_count.c index 02ec086f10..ca4832399f 100644 --- a/lib_debug/mem_count.c +++ b/lib_debug/mem_count.c @@ -94,7 +94,7 @@ typedef INT64 int64_t; /* This is the maximum number of allocations for which to keep information. It can be increased if required. */ #ifdef SBA_BR_SWITCHING -#define MAX_INFO_RECORDS 5000 +#define MAX_INFO_RECORDS 8000 #else #define MAX_INFO_RECORDS 3000 #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 564abeee6a..3d09b77903 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -364,8 +364,8 @@ ivas_error ivas_sba_dec_reinit( hDecoderConfig->last_ivas_total_brate = ivas_total_brate; /*------------------------------------------------------------------------------------------* - * Closing Decoder handles before Reinitialisation - *------------------------------------------------------------------------------------------*/ + * Closing Decoder handles before Reinitialisation + *------------------------------------------------------------------------------------------*/ /* Qmetadata handle */ ivas_qmetadata_close( &st_ivas->hQMetaData ); @@ -526,14 +526,42 @@ ivas_error ivas_sba_dec_reinit( } } + /*------------------------------------------------------------------------------------------* + * Reopening Decoder handles for Reinitialisation + *------------------------------------------------------------------------------------------*/ + + /* Allocate and initialize Custom loudspeaker layout handle */ + if ( st_ivas->hDecoderConfig->Opt_LsCustom ) + { + if ( ( error = ivas_ls_custom_open( &( st_ivas->hLsSetupCustom ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* Allocate and initialize Head-Tracking handle */ + if ( st_ivas->hDecoderConfig->Opt_Headrotation ) + { + if ( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* Allocate HRTF binary handle */ + if ( st_ivas->hDecoderConfig->Opt_HRTF_binary ) + { + if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + st_ivas->sba_dirac_stereo_flag = 0; /*Reconfigure output paramaters*/ ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init ); ivas_renderer_select( st_ivas ); ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); - /*------------------------------------------------------------------------------------------* - * Reopening Decoder handles for Reinitialisation - *------------------------------------------------------------------------------------------*/ if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { return error; @@ -577,7 +605,7 @@ ivas_error ivas_sba_dec_reinit( st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, ( int16_t )( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } } @@ -711,6 +739,10 @@ ivas_error ivas_sba_dec_reinit( { return error; } + if ( ivas_render_config_init_from_rom( &st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) != IVAS_ERR_OK ) + { + return IVAS_ERR_INTERNAL_FATAL; + } } if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { -- GitLab From 80cdfd71d8505159435953ecfd2c4b91815fc1a8 Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 12:05:09 +1100 Subject: [PATCH 06/14] Fix a bad merge --- lib_enc/ivas_spar_md_enc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index d459b5b3cf..4bd23dee47 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -317,9 +317,6 @@ static ivas_error ivas_spar_md_enc_init( float PR_minmax[2]; int16_t num_channels, i, j, k; -#ifdef SBA_HOA_HBR_IMPROV - hMdEnc->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hEncoderConfig->ivas_total_brate ); -#endif num_channels = ivas_sba_get_nchan_metadata( sba_order ); table_idx = ivas_get_spar_table_idx( hEncoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); -- GitLab From bd8dcf588925f2747c38fabbe4742b20f3f8ecc5 Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 12:06:54 +1100 Subject: [PATCH 07/14] Fix a bad merge part 2 --- lib_dec/ivas_spar_md_dec.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 024a1083b8..5d39aee9a0 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -434,10 +434,6 @@ ivas_error ivas_spar_md_dec_init( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ -#ifdef SBA_HOA_HBR_IMPROV - , - const int16_t sba_order /* i : SBA order */ -#endif ) { int16_t i, j, k; @@ -446,7 +442,6 @@ ivas_error ivas_spar_md_dec_init( hMdDec->spar_md_cfg.gen_bs = 1; // VE2DB : always 1 - can it be removed? - hMdDec->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate ); hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, -- GitLab From f018c908584760fac24208ee5c3d05f3f22175ce Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 12:36:24 +1100 Subject: [PATCH 08/14] Remove additional self_tests to prepare to push only C changes first --- scripts/config/self_test.prm | 15 --------------- scripts/switchPaths/sw_13k2_192k_50fr.bin | 3 --- scripts/switchPaths/sw_16k4_512k_50fr.bin | 3 --- 3 files changed, 21 deletions(-) delete mode 100644 scripts/switchPaths/sw_13k2_192k_50fr.bin delete mode 100644 scripts/switchPaths/sw_16k4_512k_50fr.bin diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index fda5d04295..470b649ce0 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -585,21 +585,6 @@ ../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.pcm bit ../IVAS_dec binaural 48 bit testv/stv3OA48c.pcm_SBA_512000_48-48_binaural.tst -// SBA FOA bitrate switching from 16.4 kbps to 512 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -sba 1 ../scripts/switchPaths/sw_16k4_512k_50fr.bin 48 testv/stvFOA48c.pcm bit -../IVAS_dec FOA 48 bit testv/stvFOA48c.pcm_sw_48-48_FOA.tst - -// SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 48 testv/stvFOA48c.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.pcm_sw_48-48_BINAURAL.tst - -// SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out -../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.pcm bit -../IVAS_dec HOA3 48 bit testv/stv3OA48c.pcm_sw_48-48_HOA3.tst - -// SBA 3OA bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -sba 3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stvFOA48c.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stvFOA48c.pcm_sw_48-48_7_1_4.tst // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out ../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 13200 48 testv/stv_IVASMASA_1dir1TC.pcm bit diff --git a/scripts/switchPaths/sw_13k2_192k_50fr.bin b/scripts/switchPaths/sw_13k2_192k_50fr.bin deleted file mode 100644 index cd833ebd24..0000000000 --- a/scripts/switchPaths/sw_13k2_192k_50fr.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:58b5dfb78c283c6d9d5f52502a695c1f9e9e62589507736af5667e00dac4a890 -size 3996 diff --git a/scripts/switchPaths/sw_16k4_512k_50fr.bin b/scripts/switchPaths/sw_16k4_512k_50fr.bin deleted file mode 100644 index 6f57a5afe8..0000000000 --- a/scripts/switchPaths/sw_16k4_512k_50fr.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8abe2e5fb8110fa5f79f8df67986f4ac00809db9b7c19b9824a520a437b00250 -size 3996 -- GitLab From 3f3a1e90d501ecc30fee874d9756952a167f8b02 Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 13:26:23 +1100 Subject: [PATCH 09/14] Tiny bug fix and editorial change which should be BE --- lib_com/ivas_spar_com.c | 2 +- lib_enc/ivas_spar_md_enc.c | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index fa5e65460e..630497e14c 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -2131,7 +2131,7 @@ void ivas_spar_set_bitrate_config( ivas_total_brate = ivas_spar_br_table_consts[table_idx].ivas_total_brate; sba_order = ivas_spar_br_table_consts[table_idx].sba_order; - ivas_get_spar_table_idx( ivas_total_brate, sba_order, ivas_spar_br_table_consts[table_idx].bwidth, &code, &length ); + ivas_get_spar_table_idx( ivas_total_brate, sba_order, ivas_spar_br_table_consts[table_idx].bwidth, &length, &code ); for ( i = 0; i < pSpar_md_cfg->nchan_transport; i++ ) { diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 4bd23dee47..cf71589fb3 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -601,24 +601,17 @@ ivas_error ivas_spar_md_enc_process( for ( j = 0; j < nchan_inp; j++ ) { cov_real[i][j] = cov_dtx_real[i][j]; - for ( k = num_bands_bw; k < IVAS_MAX_NUM_BANDS; k++ ) - { - cov_real[i][j][k] = 0; - } } } } - else + + for ( i = 0; i < nchan_inp; i++ ) { - for ( i = 0; i < nchan_inp; i++ ) + for ( j = 0; j < nchan_inp; j++ ) { - for ( j = 0; j < nchan_inp; j++ ) + for ( k = num_bands_bw; k < IVAS_MAX_NUM_BANDS; k++ ) { - cov_real[i][j] = cov_real[i][j]; - for ( k = num_bands_bw; k < IVAS_MAX_NUM_BANDS; k++ ) - { - cov_real[i][j][k] = 0; - } + cov_real[i][j][k] = 0; } } } -- GitLab From aa52d718e31148f2195abdbf7c6a627003afd411 Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 13:32:28 +1100 Subject: [PATCH 10/14] Sigh, remnants of the bad merge are still there --- lib_dec/ivas_spar_decoder.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 4bd12a921a..444a14457e 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -659,12 +659,7 @@ static void ivas_spar_dec_MD( hSpar->hMdDec->table_idx = table_idx; hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[table_idx].td_ducking; - ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels -#ifdef SBA_HOA_HBR_IMPROV - , - sba_order -#endif - ); + ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels ); } } -- GitLab From 6f58a3371acb66da7990ebcbcff9619ffe7def71 Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 13:34:34 +1100 Subject: [PATCH 11/14] There is even more remnants! Hopefully this is the last one --- lib_com/ivas_prot.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c488b6260c..40bec75984 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4007,10 +4007,6 @@ ivas_error ivas_spar_md_dec_init( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels /* i : number of internal channels */ -#ifdef SBA_HOA_HBR_IMPROV - , - const int16_t sba_order /* i : SBA order */ -#endif ); void ivas_spar_md_dec_process( -- GitLab From 21f6a20e6e9929e2822dd725db388e2a35d570dd Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 15:28:11 +1100 Subject: [PATCH 12/14] Sorry, I got very confused. Those "bad" merges were indeed fine and were new to this branch. Added them back in. --- lib_com/ivas_prot.h | 3 ++- lib_dec/ivas_spar_decoder.c | 2 +- lib_dec/ivas_spar_md_dec.c | 11 ++++++----- lib_enc/ivas_spar_md_enc.c | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 40bec75984..7c43565510 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4006,7 +4006,8 @@ void ivas_spar_get_parameters( ivas_error ivas_spar_md_dec_init( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ - const int16_t num_channels /* i : number of internal channels */ + const int16_t num_channels, /* i : number of internal channels */ + const int16_t sba_order /* i : SBA order */ ); void ivas_spar_md_dec_process( diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 444a14457e..116d1f1926 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -659,7 +659,7 @@ static void ivas_spar_dec_MD( hSpar->hMdDec->table_idx = table_idx; hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[table_idx].td_ducking; - ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels ); + ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels, sba_order ); } } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 5d39aee9a0..e9f4b5b2e6 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -249,9 +249,8 @@ static ivas_error ivas_spar_md_dec_matrix_open( ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ - const int16_t num_channels /* i : number of internal channels */ - , - const int16_t sba_order /* i : SBA order */ + const int16_t num_channels, /* i : number of internal channels */ + const int16_t sba_order /* i : SBA order */ ) { ivas_spar_md_dec_state_t *hMdDec; @@ -272,7 +271,7 @@ ivas_error ivas_spar_md_dec_open( hMdDec->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate ); hMdDec->table_idx = 0; /* just to initialize state variables*/ - if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK ) { return error; } @@ -433,7 +432,8 @@ void ivas_spar_md_dec_close( ivas_error ivas_spar_md_dec_init( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ - const int16_t num_channels /* i : number of internal channels */ + const int16_t num_channels, /* i : number of internal channels */ + const int16_t sba_order /* i : SBA order */ ) { int16_t i, j, k; @@ -442,6 +442,7 @@ ivas_error ivas_spar_md_dec_init( hMdDec->spar_md_cfg.gen_bs = 1; // VE2DB : always 1 - can it be removed? + hMdDec->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate ); hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index cf71589fb3..cd78eb65dc 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -317,6 +317,7 @@ static ivas_error ivas_spar_md_enc_init( float PR_minmax[2]; int16_t num_channels, i, j, k; + hMdEnc->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hEncoderConfig->ivas_total_brate ); num_channels = ivas_sba_get_nchan_metadata( sba_order ); table_idx = ivas_get_spar_table_idx( hEncoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); -- GitLab From 1b8d42095f16b9e1209acb0ff1ac2f715beef337 Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 15:34:59 +1100 Subject: [PATCH 13/14] Algin the */ in the comments --- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_spar_md_dec.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 7c43565510..39d9d237c0 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4007,7 +4007,7 @@ ivas_error ivas_spar_md_dec_init( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels, /* i : number of internal channels */ - const int16_t sba_order /* i : SBA order */ + const int16_t sba_order /* i : SBA order */ ); void ivas_spar_md_dec_process( diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index e9f4b5b2e6..3ed2e252fd 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -250,7 +250,7 @@ ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels, /* i : number of internal channels */ - const int16_t sba_order /* i : SBA order */ + const int16_t sba_order /* i : SBA order */ ) { ivas_spar_md_dec_state_t *hMdDec; @@ -433,7 +433,7 @@ ivas_error ivas_spar_md_dec_init( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels, /* i : number of internal channels */ - const int16_t sba_order /* i : SBA order */ + const int16_t sba_order /* i : SBA order */ ) { int16_t i, j, k; -- GitLab From a93655da922e1370a84b4bdc2ad287e198e446fc Mon Sep 17 00:00:00 2001 From: Shanush Prema Thasarathan Date: Thu, 3 Nov 2022 16:00:20 +1100 Subject: [PATCH 14/14] Remove setting spar_hoa_md_flag in open function since it is done within init --- lib_dec/ivas_spar_md_dec.c | 1 - lib_enc/ivas_spar_md_enc.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 3ed2e252fd..b345674c99 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -268,7 +268,6 @@ ivas_error ivas_spar_md_dec_open( return error; } - hMdDec->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate ); hMdDec->table_idx = 0; /* just to initialize state variables*/ if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index cd78eb65dc..1fa39f13bf 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -121,8 +121,6 @@ ivas_error ivas_spar_md_enc_open( num_channels = 2 * sba_order + 2; - hMdEnc->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hEncoderConfig->ivas_total_brate ); - if ( ( hMdEnc->spar_md.band_coeffs = (ivas_band_coeffs_t *) count_malloc( IVAS_MAX_NUM_BANDS * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" ); -- GitLab