From 6b82ff1d40a7564615d61968079999856da0c2b2 Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Fri, 16 Feb 2024 09:53:28 +0100 Subject: [PATCH 1/6] remove obsolete code and tables for ParamMC --- lib_com/ivas_cnst.h | 4 ++++ lib_com/ivas_mc_param_com.c | 18 ++++++++++++------ lib_com/ivas_prot.h | 4 ++++ lib_com/ivas_rom_com.c | 11 ++++++++++- lib_com/ivas_stat_com.h | 4 ++++ lib_com/options.h | 3 ++- lib_dec/ivas_mc_param_dec.c | 14 +++++++++++--- lib_enc/ivas_mc_param_enc.c | 25 +++++++++++++++++++++---- 8 files changed, 68 insertions(+), 15 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index e9173e6e93..48b1715412 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1390,7 +1390,11 @@ typedef enum #define PARAM_MC_MAX_DECORR_CLDFB_BANDS 20 /* Maximum number of CLDFB bands with decorrelation */ #define PARAM_MC_MAX_TRANSPORT_CHANS 4 /* Number of down mix channels */ #define PARAM_MC_MAX_ILD_REF_CHANNELS 2 /* Maximum number of reference channels for a coded ILD */ +#ifdef FIX_901_PARAMMC_DEAD_CODE +#define PARAM_MC_NUM_CONFIGS 14 /* Number of available Parametric MC configurations */ +#else #define PARAM_MC_NUM_CONFIGS 15 /* Number of available Parametric MC configurations */ +#endif #define PARAM_MC_MAX_BAND_LFE 1 /* Number of parameter bands for LFE coding */ #define PARAM_MC_SZ_ICC_MAP 11 /* Maximum number of transmitted ICCs per parameter band */ #define PARAM_MC_SZ_ILD_MAP 12 /* Maximum number of transmitted channel energies per band*/ diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index 44efdebe2e..429d28e131 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -128,22 +128,26 @@ void ivas_param_mc_metadata_open( { assert( 0 && "nbands must be 20 or 14!" ); } - +#ifndef FIX_901_PARAMMC_DEAD_CODE /* create map of all possible ICCs */ ivas_param_mc_create_full_icc_mapping( nchan_setup, lfe_index, hMetadataPMC->icc_map_full, &hMetadataPMC->icc_map_size_full ); +#endif hMetadataPMC->icc_mapping_conf = ivas_param_mc_conf[config_index].icc_mapping_conf; hMetadataPMC->ild_mapping_conf = ivas_param_mc_conf[config_index].ild_mapping_conf; hMetadataPMC->ild_factors = ivas_param_mc_conf[config_index].ild_factors; +#ifndef FIX_901_PARAMMC_DEAD_CODE /* set default ICC maps */ for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) { ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[i] ); } - +#endif /* init remaining flags and indices */ hMetadataPMC->param_frame_idx = 0; +#ifndef FIX_901_PARAMMC_DEAD_CODE hMetadataPMC->flag_use_adaptive_icc_map = 0; +#endif hMetadataPMC->bAttackPresent = 0; hMetadataPMC->attackIndex = 0; hMetadataPMC->lfe_on = 1; @@ -198,7 +202,7 @@ void ivas_param_mc_set_coded_bands( return; } - +#ifndef FIX_901_PARAMMC_DEAD_CODE /*------------------------------------------------------------------------- * ivas_param_mc_metadata_close() * @@ -223,7 +227,7 @@ void ivas_param_mc_metadata_close( return; } - +#endif /*------------------------------------------------------------------------- * ivas_param_mc_getNumTransportChannels() @@ -247,7 +251,7 @@ int16_t ivas_param_mc_getNumTransportChannels( return nchan_transport; } - +#ifndef FIX_901_PARAMMC_DEAD_CODE /*------------------------------------------------------------------------- * ivas_param_mc_create_full_icc_mapping() * @@ -303,7 +307,6 @@ void ivas_param_mc_create_full_icc_mapping( return; } - /*------------------------------------------------------------------------- * ivas_param_mc_default_icc_map() * @@ -326,6 +329,7 @@ void ivas_param_mc_default_icc_map( return; } +#endif /*------------------------------------------------------------------------- @@ -408,9 +412,11 @@ static int16_t ivas_param_mc_get_num_param_bands( case IVAS_128k: num_parameter_bands = 14; break; +#ifndef FIX_901_PARAMMC_DEAD_CODE case IVAS_160k: num_parameter_bands = 20; break; +#endif } break; default: diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 594d00ee30..e736949e86 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3835,9 +3835,11 @@ void ivas_param_mc_set_coded_bands( HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ ); +#ifndef FIX_901_PARAMMC_DEAD_CODE void ivas_param_mc_metadata_close( HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ ); +#endif void ivas_param_mc_create_full_icc_mapping( const int16_t n_channels, /* i : number of channels with LFE for the internal setup */ @@ -3910,10 +3912,12 @@ void ivas_param_mc_dec( float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); +#ifndef FIX_901_PARAMMC_DEAD_CODE void ivas_param_mc_default_icc_map( const PARAM_MC_ICC_MAPPING * hIccMapping, /* i : handle to ICC mapping configuration */ int16_t icc_map[PARAM_MC_SZ_ICC_MAP][2] /* o : copy of map from the configuration */ ); +#endif /*! r: number of cldfb synthesis instances */ int16_t param_mc_get_num_cldfb_syntheses( diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 50892fcf53..704b4355b1 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -1973,6 +1973,7 @@ const float ivas_param_mc_ild_fac_CICP19_3tc[12] = 0.5f }; +#ifndef FIX_901_PARAMMC_DEAD_CODE const float ivas_param_mc_ild_fac_CICP19_4tc[12] = { 0.35f, @@ -1988,6 +1989,7 @@ const float ivas_param_mc_ild_fac_CICP19_4tc[12] = 0.5f, 0.2f, }; +#endif const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP6_2tc = { @@ -2052,6 +2054,7 @@ const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_3tc = {{0},{1},{0},{1},{0},{1},{0},{1},{0},{1},{2},{2}} }; +#ifndef FIX_901_PARAMMC_DEAD_CODE const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_4tc = { 11, @@ -2060,6 +2063,7 @@ const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_4tc = {1,1,2,1,1,1,1,1,1,1,1,2}, {{0},{1},{0,1},{0},{1},{0},{1},{2},{3},{2},{3},{0,1}} }; +#endif const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP6_2tc = { @@ -2161,6 +2165,7 @@ const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_3tc = } }; +#ifndef FIX_901_PARAMMC_DEAD_CODE const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_4tc = { 8, @@ -2176,6 +2181,7 @@ const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_4tc = { 2, 3 } /* C/LFE */ } }; +#endif const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] = { @@ -2332,7 +2338,9 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] = &ivas_param_mc_icc_mapping_CICP19_3tc, &ivas_param_mc_dmx_fac_CICP19_3tc[0], &ivas_param_mc_ild_fac_CICP19_3tc[0] - }, + } +#ifndef FIX_901_PARAMMC_DEAD_CODE + , /* CICP19 160000 */ { MC_LS_SETUP_7_1_4, @@ -2344,6 +2352,7 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] = &ivas_param_mc_dmx_fac_CICP19_4tc[0], &ivas_param_mc_ild_fac_CICP19_4tc[0] } + #endif }; const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 566abcb443..438cd4b102 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -595,11 +595,15 @@ typedef struct ivas_parametric_mc_metadata_struct { const PARAM_MC_ILD_MAPPING *ild_mapping_conf; const PARAM_MC_ICC_MAPPING *icc_mapping_conf; +#ifndef FIX_901_PARAMMC_DEAD_CODE int16_t icc_mapping[PARAM_MC_PARAMETER_FRAMES][PARAM_MC_SZ_ICC_MAP][2]; int16_t *icc_map_full[2]; +#endif int16_t icc_map_size_full; int16_t param_frame_idx; +#ifndef FIX_901_PARAMMC_DEAD_CODE int16_t flag_use_adaptive_icc_map; +#endif const float *ild_factors; int16_t coding_band_mapping[PARAM_MC_MAX_PARAMETER_BANDS]; int16_t nbands_in_param_frame[PARAM_MC_PARAMETER_FRAMES]; diff --git a/lib_com/options.h b/lib_com/options.h index a4eab8337d..b8e746503e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,8 +151,9 @@ /*#define SPLIT_REND_WITH_HEAD_ROT */ /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #define FIX_643_PCA_OPTION /* VA: issue 643: rename PCA bypass command-line option */ +#define FIX_901_PARAMMC_DEAD_CODE /* FhG: issue 901: remove dead ParamMC code */ -/* #################### End BE switches ################################## */ + /* #################### End BE switches ################################## */ #define FIX_899_VARIABLE_SPEED_DECODING /* FhG: Fix variable speed decoding */ /* #################### Start NON-BE switches ############################ */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 3352a79781..f12eaba92c 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -629,6 +629,7 @@ ivas_error ivas_param_mc_dec_reconfig( hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; +#ifndef FIX_901_PARAMMC_DEAD_CODE /* deallocate the full icc map, gets newly allocated in the metadata open function */ for ( k = 0; k < 2; k++ ) @@ -642,6 +643,7 @@ ivas_error ivas_param_mc_dec_reconfig( hParamMC->hMetadataPMC->icc_map_full[k] = NULL; } } +#endif mvs2s( hParamMC->band_grouping, band_grouping_old, hParamMC->hMetadataPMC->num_parameter_bands + 1 ); @@ -1104,8 +1106,9 @@ void ivas_param_mc_dec_close( /* parameter decoding */ if ( hParamMC->hMetadataPMC != NULL ) { +#ifndef FIX_901_PARAMMC_DEAD_CODE ivas_param_mc_metadata_close( hParamMC->hMetadataPMC ); - +#endif free( hParamMC->hMetadataPMC ); hParamMC->hMetadataPMC = NULL; } @@ -1310,6 +1313,7 @@ void ivas_param_mc_dec_read_BS( num_lfe_bands = 0; } +#ifndef FIX_901_PARAMMC_DEAD_CODE if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) { int16_t icc_mapping_index[PARAM_MC_SZ_ICC_MAP]; @@ -1368,6 +1372,7 @@ void ivas_param_mc_dec_read_BS( ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx] ); } } +#endif ivas_param_mc_bs_decode_parameter_values( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->icc_coding, icc_map_size_wo_lfe, icc_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icc_q ); @@ -1905,7 +1910,6 @@ void ivas_param_mc_dec_render( return; } - /*------------------------------------------------------------------------- * ivas_param_mc_dec() * @@ -1946,7 +1950,6 @@ void ivas_param_mc_dec( return; } - /*------------------------------------------------------------------------- * param_mc_dec_init() * @@ -2771,8 +2774,13 @@ static void ivas_param_mc_dequantize_cov( /* replace some estimated ICCs with transmitted values */ for ( k = 0; k < hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe; k++ ) { +#ifndef FIX_901_PARAMMC_DEAD_CODE Cy_state_int[hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][0] + nY_int * hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][1]] = icc_q[k]; Cy_state_int[hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][1] + nY_int * hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][0]] = icc_q[k]; +#else + Cy_state_int[hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][0] + nY_int * hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][1]] = icc_q[k]; + Cy_state_int[hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][1] + nY_int * hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][0]] = icc_q[k]; +#endif } if ( param_band_index >= PARAM_MC_MAX_BAND_LFE || !hParamMC->hMetadataPMC->lfe_on ) diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index fba2975665..ec050bf9b0 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -62,7 +62,9 @@ static void ivas_param_mc_parameter_quantizer( const float *x, const int16_t L, static void ivas_param_mc_transient_detection( PARAM_MC_ENC_HANDLE hParamMC, TRAN_DET_HANDLE hTranDet, int16_t *bAttackPresent, int16_t *attackIdx ); +#ifndef FIX_901_PARAMMC_DEAD_CODE static void ivas_param_mc_enc_find_icc_map( PARAM_MC_ENC_HANDLE hParamMC, float Cx_sum[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], float Cy_sum[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], float ILD_q[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_SZ_ILD_MAP], const int16_t nchan_input, const int16_t nchan_transport ); +#endif static void ivas_param_mc_quantize_iccs( PARAM_MC_ENC_HANDLE hParamMC, float Cy[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], const int16_t freq_idx, const int16_t nchan_input, int16_t *ICC_idx_out ); @@ -154,6 +156,7 @@ ivas_error ivas_param_mc_enc_open( /* open/init parameter coding */ ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); +#ifndef FIX_901_PARAMMC_DEAD_CODE /* init icc index states */ for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) { @@ -170,6 +173,7 @@ ivas_error ivas_param_mc_enc_open( } } } +#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC.num_parameter_bands == 20 ) @@ -280,6 +284,7 @@ ivas_error ivas_param_mc_enc_reconfig( /* get dmx factors */ hParamMC->dmx_factors = ivas_param_mc_conf[config_index].dmx_fac; +#ifndef FIX_901_PARAMMC_DEAD_CODE /* deallocate the full icc map, gets newly allocated in the metadata open function */ for ( i = 0; i < 2; i++ ) { @@ -292,10 +297,12 @@ ivas_error ivas_param_mc_enc_reconfig( hParamMC->hMetadataPMC.icc_map_full[i] = NULL; } } +#endif /* open/init parameter coding */ ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); +#ifndef FIX_901_PARAMMC_DEAD_CODE /* init icc index states */ for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) { @@ -312,6 +319,7 @@ ivas_error ivas_param_mc_enc_reconfig( } } } +#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC.num_parameter_bands == 20 ) @@ -374,9 +382,9 @@ void ivas_param_mc_enc_close( { return; } - +#ifndef FIX_901_PARAMMC_DEAD_CODE ivas_param_mc_metadata_close( &( *hParamMC )->hMetadataPMC ); - +#endif ivas_FB_mixer_close( &( *hParamMC )->hFbMixer, sampling_rate, 0 ); free( ( *hParamMC ) ); @@ -510,6 +518,7 @@ void ivas_param_mc_enc( ivas_param_mc_quantize_ilds( hParamMC, Cy_sum[k], Cx_sum[k], k, nchan_inp, st_ivas->nchan_transport, ILD_idx, ILD_q[k] ); } +#ifndef FIX_901_PARAMMC_DEAD_CODE /* get icc map */ if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) { @@ -519,6 +528,7 @@ void ivas_param_mc_enc( { ivas_param_mc_default_icc_map( hParamMC->hMetadataPMC.icc_mapping_conf, hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx] ); } +#endif /* ICC parameter quantization */ for ( k = 0; k < hParamMC->hMetadataPMC.nbands_coded; k += band_step ) @@ -986,7 +996,7 @@ static void ivas_param_mc_param_est_enc( return; } - +#ifndef FIX_901_PARAMMC_DEAD_CODE /*------------------------------------------------------------------------- * ivas_param_mc_enc_find_icc_map() * @@ -1209,7 +1219,7 @@ static void ivas_param_mc_enc_find_icc_map( return; } - +#endif /*------------------------------------------------------------------------- * ivas_param_mc_quantize_ilds() @@ -1447,8 +1457,13 @@ static void ivas_param_mc_quantize_iccs( /* Reduce set of parameters and quantize them */ for ( k = 0; k < num_iccs_to_code; ++k ) { +#ifndef FIX_901_PARAMMC_DEAD_CODE tmp_map[0] = hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][k][0]; tmp_map[1] = hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][k][1]; +#else + tmp_map[0] = hParamMC->hMetadataPMC.icc_mapping_conf->icc_mapping[k][0]; + tmp_map[1] = hParamMC->hMetadataPMC.icc_mapping_conf->icc_mapping[k][1]; +#endif ICC_vect[k] = Cy[tmp_map[0]][tmp_map[1]]; } @@ -1626,6 +1641,7 @@ static void ivas_param_mc_write_bs( nbands = hParamMC->hMetadataPMC.nbands_coded / band_step + ( ( hParamMC->hMetadataPMC.nbands_coded % band_step ) ? 1 : 0 ); } +#ifndef FIX_901_PARAMMC_DEAD_CODE /* Encoding of the ICC mapping done as simple bitmap */ if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) { @@ -1643,6 +1659,7 @@ static void ivas_param_mc_write_bs( *bit_pos += hParamMC->hMetadataPMC.icc_map_size_full - 1; } +#endif ivas_param_mc_encode_parameter( ICC_idx, &hParamMC->hMetadataPMC, &hParamMC->hMetadataPMC.icc_coding, nbands, band_step, icc_map_size_wo_lfe, icc_map_size, bit_buffer, bit_pos ); -- GitLab From 61e9983fe110a13f1c1325db82b19b9990c1d71b Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Fri, 16 Feb 2024 10:14:55 +0100 Subject: [PATCH 2/6] fix #901, remove dead ParamMC code and tables, change a few more defines, fix compiler warnings --- lib_com/ivas_cnst.h | 4 ++++ lib_com/ivas_mc_param_com.c | 8 ++++++-- lib_com/ivas_prot.h | 5 +++-- lib_dec/ivas_mc_param_dec.c | 14 ++++++++++++-- lib_enc/ivas_mc_param_enc.c | 19 ++++++++++++++++--- 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 447c7b6e55..e409c2a891 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1392,7 +1392,11 @@ typedef enum #define PARAM_MC_ICC_ERROR_BIAS_FAC (1.15f) /* factor for favouring past ICC maps in the adaptive ICC map decision */ #define PARAM_MC_TRANSIENT_BAND_STEP 2 /* Number of parameter bands combined in case of a transient frame*/ #define PARAM_MC_MAX_DECORR_CLDFB_BANDS 20 /* Maximum number of CLDFB bands with decorrelation */ +#ifdef FIX_901_PARAMMC_DEAD_CODE +#define PARAM_MC_MAX_TRANSPORT_CHANS 3 /* Number of down mix channels */ +#else #define PARAM_MC_MAX_TRANSPORT_CHANS 4 /* Number of down mix channels */ +#endif #define PARAM_MC_MAX_ILD_REF_CHANNELS 2 /* Maximum number of reference channels for a coded ILD */ #ifdef FIX_901_PARAMMC_DEAD_CODE #define PARAM_MC_NUM_CONFIGS 14 /* Number of available Parametric MC configurations */ diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index 4584b01194..f38f071920 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -86,13 +86,17 @@ uint16_t ivas_param_mc_get_configuration_index( *------------------------------------------------------------------------*/ void ivas_param_mc_metadata_open( - const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ - const int16_t lfe_index, /* i : channel index of LFE */ + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ +#ifndef FIX_901_PARAMMC_DEAD_CODE + const int16_t lfe_index, /* i : channel index of LFE */ +#endif const int32_t ivas_total_brate, /* i : IVAS total bitrate */ HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ ) { +#ifndef FIX_901_PARAMMC_DEAD_CODE int16_t i; +#endif uint16_t config_index; int16_t nchan_setup; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index bd8a91b5d0..dfa2b05456 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3805,7 +3805,9 @@ void ivas_mc_paramupmix_dec_render( void ivas_param_mc_metadata_open( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ + #ifndef FIX_901_PARAMMC_DEAD_CODE const int16_t lfe_index, /* i : channel index of LFE */ + #endif const int32_t ivas_total_brate, /* i : IVAS total bitrate */ HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ ); @@ -3818,7 +3820,6 @@ void ivas_param_mc_set_coded_bands( void ivas_param_mc_metadata_close( HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ ); -#endif void ivas_param_mc_create_full_icc_mapping( const int16_t n_channels, /* i : number of channels with LFE for the internal setup */ @@ -3826,7 +3827,7 @@ void ivas_param_mc_create_full_icc_mapping( int16_t *icc_map[2], /* o : map of all possible ICCs */ int16_t *icc_map_size_full /* o : number of all possible ICCs */ ); - +#endif /*! r: number of IVAS transport channels */ int16_t ivas_param_mc_getNumTransportChannels( const int32_t ivas_total_bitrate, /* i : IVAS total bitrate */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index a5035ade02..937cc87339 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -228,7 +228,11 @@ ivas_error ivas_param_mc_dec_open( hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; +#ifndef FIX_901_PARAMMC_DEAD_CODE ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); +#else + ivas_param_mc_metadata_open( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); +#endif /* init arrays for quantized parameters */ if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) @@ -642,8 +646,11 @@ ivas_error ivas_param_mc_dec_reconfig( #endif mvs2s( hParamMC->band_grouping, band_grouping_old, hParamMC->hMetadataPMC->num_parameter_bands + 1 ); - +#ifndef FIX_901_PARAMMC_DEAD_CODE ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); +#else + ivas_param_mc_metadata_open( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); +#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC->num_parameter_bands == 20 ) @@ -1218,7 +1225,10 @@ void ivas_param_mc_dec_read_BS( int16_t num_lfe_bands; int16_t num_param_bands; int16_t metadata_bit_pos; - int16_t i, j, k, l; + int16_t i, j, k; +#ifndef FIX_901_PARAMMC_DEAD_CODE + int16_t l; +#endif int16_t icc_map_size; int16_t icc_map_size_wo_lfe; int16_t ild_map_size; diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 6d9e31be10..eac2d3d194 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -88,7 +88,10 @@ ivas_error ivas_param_mc_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ) { - int16_t i, k, l; + int16_t i; +#ifndef FIX_901_PARAMMC_DEAD_CODE + int16_t k, l; +#endif IVAS_FB_CFG *fb_cfg; PARAM_MC_ENC_HANDLE hParamMC; uint16_t config_index; @@ -154,8 +157,11 @@ ivas_error ivas_param_mc_enc_open( } /* open/init parameter coding */ +#ifndef FIX_901_PARAMMC_DEAD_CODE ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); - +#else + ivas_param_mc_metadata_open( mc_input_setup, ivas_total_brate, &hParamMC->hMetadataPMC ); +#endif #ifndef FIX_901_PARAMMC_DEAD_CODE /* init icc index states */ for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) @@ -239,7 +245,10 @@ ivas_error ivas_param_mc_enc_reconfig( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ) { - int16_t i, k, l; + int16_t i; +#ifndef FIX_901_PARAMMC_DEAD_CODE + int16_t k, l; +#endif PARAM_MC_ENC_HANDLE hParamMC; uint16_t config_index; MC_LS_SETUP mc_input_setup; @@ -300,7 +309,11 @@ ivas_error ivas_param_mc_enc_reconfig( #endif /* open/init parameter coding */ +#ifndef FIX_901_PARAMMC_DEAD_CODE ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); +#else + ivas_param_mc_metadata_open( mc_input_setup, ivas_total_brate, &hParamMC->hMetadataPMC ); +#endif #ifndef FIX_901_PARAMMC_DEAD_CODE /* init icc index states */ -- GitLab From cd4e1cae44889d33b96fa4a5c36076d358de5709 Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Fri, 16 Feb 2024 10:25:40 +0100 Subject: [PATCH 3/6] fix for #901, remove dead ParamMC code, fix a compiler warning --- lib_com/ivas_mc_param_com.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index f38f071920..b1c0bdedd4 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -98,9 +98,11 @@ void ivas_param_mc_metadata_open( int16_t i; #endif uint16_t config_index; +#ifndef FIX_901_PARAMMC_DEAD_CODE int16_t nchan_setup; nchan_setup = ivas_mc_ls_setup_get_num_channels( mc_ls_setup ); +#endif /* get coding band mappings */ set_s( hMetadataPMC->coding_band_mapping, 0, PARAM_MC_MAX_PARAMETER_BANDS ); -- GitLab From fa4094af079bfe7c23ba31dec4ab3206002821ab Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Fri, 16 Feb 2024 10:29:19 +0100 Subject: [PATCH 4/6] fix for #901, remove dead ParamMC code, fix Linux compiler warnings --- lib_dec/ivas_mc_param_dec.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 937cc87339..512e83a134 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -114,7 +114,9 @@ ivas_error ivas_param_mc_dec_open( { int16_t k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; +#ifndef FIX_901_PARAMMC_DEAD_CODE IVAS_OUTPUT_SETUP hTransportSetup; +#endif int16_t nchan_out_transport; int16_t nchan_out_cov; float proto_matrix[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -146,8 +148,9 @@ ivas_error ivas_param_mc_dec_open( output_Fs = st_ivas->hDecoderConfig->output_Fs; output_config = st_ivas->hDecoderConfig->output_config; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - +#ifndef FIX_901_PARAMMC_DEAD_CODE hTransportSetup = st_ivas->hTransSetup; +#endif mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; hParamMC->hoa_encoder = NULL; @@ -555,7 +558,9 @@ ivas_error ivas_param_mc_dec_reconfig( { int16_t k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; +#ifndef FIX_901_PARAMMC_DEAD_CODE IVAS_OUTPUT_SETUP hTransportSetup; +#endif int16_t nchan_out_transport; int16_t nchan_out_cov; float proto_matrix[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -584,8 +589,9 @@ ivas_error ivas_param_mc_dec_reconfig( output_Fs = st_ivas->hDecoderConfig->output_Fs; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - +#ifndef FIX_901_PARAMMC_DEAD_CODE hTransportSetup = st_ivas->hTransSetup; +#endif mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; @@ -2724,11 +2730,15 @@ static void ivas_param_mc_dequantize_cov( int16_t l; float *Cyp; float ap; +#ifndef FIX_901_PARAMMC_DEAD_CODE int16_t param_frame_idx; +#endif const PARAM_MC_ILD_MAPPING *h_ild_mapping; float Cy_state_int[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; +#ifndef FIX_901_PARAMMC_DEAD_CODE param_frame_idx = hParamMC->hMetadataPMC->param_frame_idx; +#endif set_zero( Nrqq, MAX_OUTPUT_CHANNELS ); h_ild_mapping = hParamMC->hMetadataPMC->ild_mapping_conf; -- GitLab From df38406c3610acd080b1c243cb3bbc92edc59526 Mon Sep 17 00:00:00 2001 From: Stefan Bayer Date: Fri, 16 Feb 2024 10:45:23 +0100 Subject: [PATCH 5/6] fix for #901, remove dead ParamMC code, fix formatting --- lib_com/ivas_prot.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index dfa2b05456..c77bc25bf4 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3805,9 +3805,9 @@ void ivas_mc_paramupmix_dec_render( void ivas_param_mc_metadata_open( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ - #ifndef FIX_901_PARAMMC_DEAD_CODE +#ifndef FIX_901_PARAMMC_DEAD_CODE const int16_t lfe_index, /* i : channel index of LFE */ - #endif +#endif const int32_t ivas_total_brate, /* i : IVAS total bitrate */ HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ ); -- GitLab From dc1087e079865b176217f4a77f1de9acb2edf69c Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 16 Feb 2024 12:51:54 +0100 Subject: [PATCH 6/6] formatting of empty lines --- lib_com/ivas_mc_param_com.c | 1 + lib_com/ivas_prot.h | 2 +- lib_com/ivas_rom_com.c | 8 ++++---- lib_dec/ivas_mc_param_dec.c | 5 +++-- lib_enc/ivas_mc_param_enc.c | 11 ++++++----- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index b1c0bdedd4..5a11a90d86 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -134,6 +134,7 @@ void ivas_param_mc_metadata_open( { assert( 0 && "nbands must be 20 or 14!" ); } + #ifndef FIX_901_PARAMMC_DEAD_CODE /* create map of all possible ICCs */ ivas_param_mc_create_full_icc_mapping( nchan_setup, lfe_index, hMetadataPMC->icc_map_full, &hMetadataPMC->icc_map_size_full ); diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c77bc25bf4..2fea7f535b 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3897,8 +3897,8 @@ void ivas_param_mc_default_icc_map( const PARAM_MC_ICC_MAPPING * hIccMapping, /* i : handle to ICC mapping configuration */ int16_t icc_map[PARAM_MC_SZ_ICC_MAP][2] /* o : copy of map from the configuration */ ); -#endif +#endif /*! r: number of cldfb synthesis instances */ int16_t param_mc_get_num_cldfb_syntheses( Decoder_Struct *st_ivas /* i : IVAS decoder structure */ diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index cae38ec552..8ab2c86821 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -1989,8 +1989,8 @@ const float ivas_param_mc_ild_fac_CICP19_4tc[12] = 0.5f, 0.2f, }; -#endif +#endif const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP6_2tc = { 5, @@ -2063,8 +2063,8 @@ const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_4tc = {1,1,2,1,1,1,1,1,1,1,1,2}, {{0},{1},{0,1},{0},{1},{0},{1},{2},{3},{2},{3},{0,1}} }; -#endif +#endif const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP6_2tc = { 4, @@ -2181,8 +2181,8 @@ const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_4tc = { 2, 3 } /* C/LFE */ } }; -#endif +#endif const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] = { /* CICP6 48000 */ @@ -2352,7 +2352,7 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] = &ivas_param_mc_dmx_fac_CICP19_4tc[0], &ivas_param_mc_ild_fac_CICP19_4tc[0] } - #endif +#endif }; const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 512e83a134..45ed71c978 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -649,9 +649,10 @@ ivas_error ivas_param_mc_dec_reconfig( hParamMC->hMetadataPMC->icc_map_full[k] = NULL; } } -#endif +#endif mvs2s( hParamMC->band_grouping, band_grouping_old, hParamMC->hMetadataPMC->num_parameter_bands + 1 ); + #ifndef FIX_901_PARAMMC_DEAD_CODE ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); #else @@ -1382,8 +1383,8 @@ void ivas_param_mc_dec_read_BS( ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx] ); } } -#endif +#endif ivas_param_mc_bs_decode_parameter_values( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->icc_coding, icc_map_size_wo_lfe, icc_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icc_q ); if ( !st->BER_detect ) diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index eac2d3d194..b32bb1ce5d 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -64,8 +64,8 @@ static void ivas_param_mc_transient_detection( PARAM_MC_ENC_HANDLE hParamMC, TRA #ifndef FIX_901_PARAMMC_DEAD_CODE static void ivas_param_mc_enc_find_icc_map( PARAM_MC_ENC_HANDLE hParamMC, float Cx_sum[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], float Cy_sum[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], float ILD_q[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_SZ_ILD_MAP], const int16_t nchan_input, const int16_t nchan_transport ); -#endif +#endif static void ivas_param_mc_quantize_iccs( PARAM_MC_ENC_HANDLE hParamMC, float Cy[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], const int16_t freq_idx, const int16_t nchan_input, int16_t *ICC_idx_out ); static void ivas_param_mc_quantize_ilds( PARAM_MC_ENC_HANDLE hParamMC, float Cy[MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], float Cx[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], const int16_t freq_idx, const int16_t nchan_input, const int16_t nchan_transport, int16_t *ILD_idx_out, float ILD_q[PARAM_MC_SZ_ILD_MAP] ); @@ -306,8 +306,8 @@ ivas_error ivas_param_mc_enc_reconfig( hParamMC->hMetadataPMC.icc_map_full[i] = NULL; } } -#endif +#endif /* open/init parameter coding */ #ifndef FIX_901_PARAMMC_DEAD_CODE ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); @@ -332,8 +332,8 @@ ivas_error ivas_param_mc_enc_reconfig( } } } -#endif +#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC.num_parameter_bands == 20 ) { @@ -395,6 +395,7 @@ void ivas_param_mc_enc_close( { return; } + #ifndef FIX_901_PARAMMC_DEAD_CODE ivas_param_mc_metadata_close( &( *hParamMC )->hMetadataPMC ); #endif @@ -541,8 +542,8 @@ void ivas_param_mc_enc( { ivas_param_mc_default_icc_map( hParamMC->hMetadataPMC.icc_mapping_conf, hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx] ); } -#endif +#endif /* ICC parameter quantization */ for ( k = 0; k < hParamMC->hMetadataPMC.nbands_coded; k += band_step ) { @@ -1672,8 +1673,8 @@ static void ivas_param_mc_write_bs( *bit_pos += hParamMC->hMetadataPMC.icc_map_size_full - 1; } -#endif +#endif ivas_param_mc_encode_parameter( ICC_idx, &hParamMC->hMetadataPMC, &hParamMC->hMetadataPMC.icc_coding, nbands, band_step, icc_map_size_wo_lfe, icc_map_size, bit_buffer, bit_pos ); -- GitLab