From e8a6ab3542f4debffdd2a3e2077feb71ba0b4166 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 25 Feb 2025 15:58:41 +0100 Subject: [PATCH 1/3] add FIX_PARAMMC_DEAD_CODE_FL901 - port float MR !1231 --- lib_com/ivas_cnst.h | 8 +++++++ lib_com/ivas_mc_param_com.c | 22 ++++++++++++++++-- lib_com/ivas_prot.h | 8 +++++-- lib_com/ivas_rom_com.c | 14 ++++++++---- lib_com/ivas_stat_com.h | 4 ++++ lib_com/options.h | 1 + lib_dec/ivas_mc_param_dec.c | 42 +++++++++++++++++++++++++++++----- lib_enc/ivas_mc_param_enc.c | 45 ++++++++++++++++++++++++++++++------- 8 files changed, 122 insertions(+), 22 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index b3f2f932c..add491d10 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1385,9 +1385,17 @@ 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_PARAMMC_DEAD_CODE_FL901 +#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_PARAMMC_DEAD_CODE_FL901 +#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 44efdebe2..56ee0c030 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -86,17 +86,23 @@ 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_PARAMMC_DEAD_CODE_FL901 + 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_PARAMMC_DEAD_CODE_FL901 int16_t i; +#endif uint16_t config_index; +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 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 ); @@ -129,21 +135,27 @@ void ivas_param_mc_metadata_open( assert( 0 && "nbands must be 20 or 14!" ); } +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 /* 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_PARAMMC_DEAD_CODE_FL901 /* 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_PARAMMC_DEAD_CODE_FL901 hMetadataPMC->flag_use_adaptive_icc_map = 0; +#endif hMetadataPMC->bAttackPresent = 0; hMetadataPMC->attackIndex = 0; hMetadataPMC->lfe_on = 1; @@ -199,6 +211,7 @@ void ivas_param_mc_set_coded_bands( } +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 /*------------------------------------------------------------------------- * ivas_param_mc_metadata_close() * @@ -223,6 +236,7 @@ void ivas_param_mc_metadata_close( return; } +#endif /*------------------------------------------------------------------------- @@ -248,6 +262,7 @@ int16_t ivas_param_mc_getNumTransportChannels( } +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 /*------------------------------------------------------------------------- * ivas_param_mc_create_full_icc_mapping() * @@ -326,6 +341,7 @@ void ivas_param_mc_default_icc_map( return; } +#endif /*------------------------------------------------------------------------- @@ -408,9 +424,11 @@ static int16_t ivas_param_mc_get_num_param_bands( case IVAS_128k: num_parameter_bands = 14; break; +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 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 a55aacc85..9096d0cd0 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3802,7 +3802,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_PARAMMC_DEAD_CODE_FL901 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 */ ); @@ -3811,6 +3813,7 @@ 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_PARAMMC_DEAD_CODE_FL901 void ivas_param_mc_metadata_close( HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ ); @@ -3821,7 +3824,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 */ @@ -3886,11 +3889,12 @@ void ivas_param_mc_dec( float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 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( 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 481abd06f..901f856f2 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_PARAMMC_DEAD_CODE_FL901 const float ivas_param_mc_ild_fac_CICP19_4tc[12] = { 0.35f, @@ -1988,7 +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 = { 5, @@ -2052,6 +2053,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_PARAMMC_DEAD_CODE_FL901 const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_4tc = { 11, @@ -2060,7 +2062,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 = { 4, @@ -2161,6 +2163,7 @@ const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_3tc = } }; +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_4tc = { 8, @@ -2176,7 +2179,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] = { /* CICP6 48000 */ @@ -2332,7 +2335,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_PARAMMC_DEAD_CODE_FL901 + , /* CICP19 160000 */ { MC_LS_SETUP_7_1_4, @@ -2344,6 +2349,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 566abcb44..213203355 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_PARAMMC_DEAD_CODE_FL901 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_PARAMMC_DEAD_CODE_FL901 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 ab9f2bd72..df1dba4f5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,6 +180,7 @@ #define NONBE_FIX_GSC_BSTR /* VA: issue 1264 FLP (1189 BASOP): Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */ #define NONBE_1319_M2R_PRECISION_ALIGN /* Nokia: bring updates from PC code related to OMASA masa2total ratios */ +#define FIX_PARAMMC_DEAD_CODE_FL901 /* FhG: port MR 1231 from float to BASOP */ /* #################### End FIXES switches ############################ */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 5a321314b..f00b48ca9 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -122,7 +122,9 @@ ivas_error ivas_param_mc_dec_open( { int16_t k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 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]; @@ -154,8 +156,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_PARAMMC_DEAD_CODE_FL901 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; @@ -236,7 +239,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_PARAMMC_DEAD_CODE_FL901 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 ) @@ -559,7 +566,9 @@ ivas_error ivas_param_mc_dec_reconfig( { int16_t k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 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]; @@ -588,8 +597,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_PARAMMC_DEAD_CODE_FL901 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; @@ -633,6 +643,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_PARAMMC_DEAD_CODE_FL901 /* deallocate the full icc map, gets newly allocated in the metadata open function */ for ( k = 0; k < 2; k++ ) @@ -646,10 +657,14 @@ 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 ); +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 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 ) @@ -1106,8 +1121,9 @@ void ivas_param_mc_dec_close( /* parameter decoding */ if ( hParamMC->hMetadataPMC != NULL ) { +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 ivas_param_mc_metadata_close( hParamMC->hMetadataPMC ); - +#endif free( hParamMC->hMetadataPMC ); hParamMC->hMetadataPMC = NULL; } @@ -1223,7 +1239,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_PARAMMC_DEAD_CODE_FL901 + int16_t l; +#endif int16_t icc_map_size; int16_t icc_map_size_wo_lfe; int16_t ild_map_size; @@ -1312,6 +1331,7 @@ void ivas_param_mc_dec_read_BS( num_lfe_bands = 0; } +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) { int16_t icc_mapping_index[PARAM_MC_SZ_ICC_MAP]; @@ -1370,7 +1390,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 ); if ( !st->BER_detect ) @@ -2939,11 +2959,15 @@ static void ivas_param_mc_dequantize_cov( int16_t l; float *Cyp; float ap; +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 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_PARAMMC_DEAD_CODE_FL901 param_frame_idx = hParamMC->hMetadataPMC->param_frame_idx; +#endif set_zero( Nrqq, MAX_OUTPUT_CHANNELS ); h_ild_mapping = hParamMC->hMetadataPMC->ild_mapping_conf; @@ -2984,8 +3008,14 @@ 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_PARAMMC_DEAD_CODE_FL901 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 fba297566..51893179a 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_PARAMMC_DEAD_CODE_FL901 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 ); @@ -86,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_PARAMMC_DEAD_CODE_FL901 + int16_t k, l; +#endif IVAS_FB_CFG *fb_cfg; PARAM_MC_ENC_HANDLE hParamMC; uint16_t config_index; @@ -152,8 +157,12 @@ ivas_error ivas_param_mc_enc_open( } /* open/init parameter coding */ +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 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_PARAMMC_DEAD_CODE_FL901 /* init icc index states */ for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) { @@ -170,6 +179,7 @@ ivas_error ivas_param_mc_enc_open( } } } +#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC.num_parameter_bands == 20 ) @@ -235,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_PARAMMC_DEAD_CODE_FL901 + int16_t k, l; +#endif PARAM_MC_ENC_HANDLE hParamMC; uint16_t config_index; MC_LS_SETUP mc_input_setup; @@ -280,6 +293,7 @@ ivas_error ivas_param_mc_enc_reconfig( /* get dmx factors */ hParamMC->dmx_factors = ivas_param_mc_conf[config_index].dmx_fac; +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 /* deallocate the full icc map, gets newly allocated in the metadata open function */ for ( i = 0; i < 2; i++ ) { @@ -292,10 +306,15 @@ ivas_error ivas_param_mc_enc_reconfig( hParamMC->hMetadataPMC.icc_map_full[i] = NULL; } } - +#endif /* open/init parameter coding */ +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 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_PARAMMC_DEAD_CODE_FL901 /* init icc index states */ for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) { @@ -312,7 +331,7 @@ ivas_error ivas_param_mc_enc_reconfig( } } } - +#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC.num_parameter_bands == 20 ) { @@ -375,8 +394,9 @@ void ivas_param_mc_enc_close( return; } +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 ivas_param_mc_metadata_close( &( *hParamMC )->hMetadataPMC ); - +#endif ivas_FB_mixer_close( &( *hParamMC )->hFbMixer, sampling_rate, 0 ); free( ( *hParamMC ) ); @@ -510,6 +530,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_PARAMMC_DEAD_CODE_FL901 /* get icc map */ if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) { @@ -520,6 +541,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 ) { @@ -987,6 +1009,7 @@ static void ivas_param_mc_param_est_enc( } +#ifndef FIX_PARAMMC_DEAD_CODE_FL901 /*------------------------------------------------------------------------- * ivas_param_mc_enc_find_icc_map() * @@ -1209,7 +1232,7 @@ static void ivas_param_mc_enc_find_icc_map( return; } - +#endif /*------------------------------------------------------------------------- * ivas_param_mc_quantize_ilds() @@ -1447,8 +1470,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_PARAMMC_DEAD_CODE_FL901 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 +1654,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_PARAMMC_DEAD_CODE_FL901 /* Encoding of the ICC mapping done as simple bitmap */ if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) { @@ -1643,7 +1672,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 df261f08c808abe65b93351351a8639f4ff2a981 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 27 Feb 2025 14:40:41 +0100 Subject: [PATCH 2/3] accept switch FIX_PARAMMC_DEAD_CODE_FL901 --- lib_com/ivas_cnst.h | 8 - lib_com/ivas_mc_param_com.c | 136 --------------- lib_com/ivas_prot.h | 21 --- lib_com/ivas_rom_com.c | 58 ------- lib_com/ivas_stat_com.h | 7 - lib_com/options.h | 1 - lib_dec/ivas_mc_param_dec.c | 112 ------------ lib_enc/ivas_mc_param_enc.c | 330 ------------------------------------ 8 files changed, 673 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index add491d10..bc67c69db 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1385,17 +1385,9 @@ 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_PARAMMC_DEAD_CODE_FL901 #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_PARAMMC_DEAD_CODE_FL901 #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 56ee0c030..cbf09044f 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -87,22 +87,11 @@ 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 */ -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - 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_PARAMMC_DEAD_CODE_FL901 - int16_t i; -#endif uint16_t config_index; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - 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 ); @@ -135,27 +124,13 @@ void ivas_param_mc_metadata_open( assert( 0 && "nbands must be 20 or 14!" ); } -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - /* 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_PARAMMC_DEAD_CODE_FL901 - /* 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_PARAMMC_DEAD_CODE_FL901 - hMetadataPMC->flag_use_adaptive_icc_map = 0; -#endif hMetadataPMC->bAttackPresent = 0; hMetadataPMC->attackIndex = 0; hMetadataPMC->lfe_on = 1; @@ -211,32 +186,6 @@ void ivas_param_mc_set_coded_bands( } -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 -/*------------------------------------------------------------------------- - * ivas_param_mc_metadata_close() - * - * Parametric MC parameter coding state close function - *------------------------------------------------------------------------*/ - -void ivas_param_mc_metadata_close( - HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ -) -{ - uint16_t i; - - /* adaptive ICC mapping */ - for ( i = 0; i < 2; i++ ) - { - if ( hMetadataPMC->icc_map_full[i] ) - { - free( hMetadataPMC->icc_map_full[i] ); - hMetadataPMC->icc_map_full[i] = NULL; - } - } - - return; -} -#endif /*------------------------------------------------------------------------- @@ -262,86 +211,6 @@ int16_t ivas_param_mc_getNumTransportChannels( } -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 -/*------------------------------------------------------------------------- - * ivas_param_mc_create_full_icc_mapping() - * - * create the map of all possible ICCs for a certain internal setup - * indicated by the number of channels and LFE index - *------------------------------------------------------------------------*/ - -void ivas_param_mc_create_full_icc_mapping( - const int16_t n_channels, /* i : number of channels with LFE for the internal setup */ - const int16_t lfe_index, /* i : channel index of the LFE */ - int16_t *icc_map[2], /* o : map of all possible ICCs */ - int16_t *icc_map_size_full /* o : number of all possible ICCs */ -) -{ - int16_t i, k, l; - - l = 0; - - /* number of all possible ICCs is the number of non-diagonal upper elements of a - * ICC matrix for all channels not including the LFE plus one static ICC for the - * combination (LFE/center) */ - *icc_map_size_full = ( n_channels - 2 ) * ( n_channels - 1 ) / 2 + 1; - - /* allocate memory for the map */ - for ( i = 0; i < 2; i++ ) - { - icc_map[i] = (int16_t *) malloc( *icc_map_size_full * sizeof( int16_t ) ); - } - - /* create map (non-LFE ICCs) */ - for ( i = 0; i < n_channels; i++ ) - { - if ( i != lfe_index ) - { - for ( k = i + 1; k < n_channels; k++ ) - { - if ( k != lfe_index ) - { - icc_map[0][l] = i; - icc_map[1][l] = k; - l++; - } - } - } - } - - /* last one is the fixed mapping center -> LFE */ - assert( l == *icc_map_size_full - 1 ); - - icc_map[0][l] = 2; - icc_map[1][l] = lfe_index; - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_param_mc_default_icc_map() - * - * get the default ICC map for a certain internal setup - * indicated by the number of channels from the table ROM - *------------------------------------------------------------------------*/ - -void ivas_param_mc_default_icc_map( - const PARAM_MC_ICC_MAPPING *hIccMapping, /* i : ICC mapping table */ - int16_t icc_map[PARAM_MC_SZ_ICC_MAP][2] /* o : copy of map from ROM table */ -) -{ - int16_t i; - - for ( i = 0; i < hIccMapping->icc_map_size_lfe; i++ ) - { - icc_map[i][0] = hIccMapping->icc_mapping[i][0]; - icc_map[i][1] = hIccMapping->icc_mapping[i][1]; - } - - return; -} -#endif /*------------------------------------------------------------------------- @@ -424,11 +293,6 @@ static int16_t ivas_param_mc_get_num_param_bands( case IVAS_128k: num_parameter_bands = 14; break; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - 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 9096d0cd0..d21c08a1d 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3802,9 +3802,6 @@ 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_PARAMMC_DEAD_CODE_FL901 - 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 */ ); @@ -3813,18 +3810,6 @@ 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_PARAMMC_DEAD_CODE_FL901 -void ivas_param_mc_metadata_close( - HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ -); - -void ivas_param_mc_create_full_icc_mapping( - const int16_t n_channels, /* i : number of channels with LFE for the internal setup */ - const int16_t lfe_index, /* i : channel index of the LFE */ - 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 */ @@ -3889,12 +3874,6 @@ void ivas_param_mc_dec( float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 -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( 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 901f856f2..1ad5fc8ef 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -1973,23 +1973,6 @@ const float ivas_param_mc_ild_fac_CICP19_3tc[12] = 0.5f }; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 -const float ivas_param_mc_ild_fac_CICP19_4tc[12] = -{ - 0.35f, - 0.35f, - 0.17f, - 0.22f, - 0.2f, - 0.2f, - 0.2f, - 0.5f, - 0.5f, - 0.5f, - 0.5f, - 0.2f, -}; -#endif const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP6_2tc = { 5, @@ -2053,16 +2036,6 @@ 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_PARAMMC_DEAD_CODE_FL901 -const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_4tc = -{ - 11, - 12, - {0,1,2,4,5,6,7,8,9,10,11,3}, - {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 = { 4, @@ -2163,23 +2136,6 @@ const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_3tc = } }; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 -const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_4tc = -{ - 8, - 9, - { { 0, 4 }, /* L/LS */ - { 1, 5 }, /* R/RS */ - { 0, 2 }, /* L/C */ - { 1, 2 }, /* R/C */ - { 0, 6 }, /* L/LBS */ - { 1, 7 }, /* R/RBS */ - { 8, 10 }, /*UFL/UBL */ - { 9, 11 }, /*UFR/UBR */ - { 2, 3 } /* C/LFE */ - } -}; -#endif const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] = { /* CICP6 48000 */ @@ -2336,20 +2292,6 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] = &ivas_param_mc_dmx_fac_CICP19_3tc[0], &ivas_param_mc_ild_fac_CICP19_3tc[0] } -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - , - /* CICP19 160000 */ - { - MC_LS_SETUP_7_1_4, - 12, - 4, - IVAS_160k, - &ivas_param_mc_ild_mapping_CICP19_4tc, - &ivas_param_mc_icc_mapping_CICP19_4tc, - &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 213203355..9345e0bf7 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -595,15 +595,8 @@ 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_PARAMMC_DEAD_CODE_FL901 - 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_PARAMMC_DEAD_CODE_FL901 - 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 df1dba4f5..ab9f2bd72 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -180,7 +180,6 @@ #define NONBE_FIX_GSC_BSTR /* VA: issue 1264 FLP (1189 BASOP): Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */ #define NONBE_1319_M2R_PRECISION_ALIGN /* Nokia: bring updates from PC code related to OMASA masa2total ratios */ -#define FIX_PARAMMC_DEAD_CODE_FL901 /* FhG: port MR 1231 from float to BASOP */ /* #################### End FIXES switches ############################ */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index f00b48ca9..06fef9713 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -122,9 +122,6 @@ ivas_error ivas_param_mc_dec_open( { int16_t k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - 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]; @@ -156,9 +153,6 @@ 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_PARAMMC_DEAD_CODE_FL901 - 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; @@ -239,11 +233,7 @@ 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_PARAMMC_DEAD_CODE_FL901 - 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 ) @@ -566,9 +556,6 @@ ivas_error ivas_param_mc_dec_reconfig( { int16_t k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - 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]; @@ -597,9 +584,6 @@ 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_PARAMMC_DEAD_CODE_FL901 - 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; @@ -643,28 +627,9 @@ 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_PARAMMC_DEAD_CODE_FL901 - /* deallocate the full icc map, gets newly allocated in the metadata open function */ - - for ( k = 0; k < 2; k++ ) - { -#ifdef DEBUGGING - assert( hParamMC->hMetadataPMC->icc_map_full[k] != NULL ); -#endif - if ( hParamMC->hMetadataPMC->icc_map_full[k] != NULL ) - { - free( hParamMC->hMetadataPMC->icc_map_full[k] ); - hParamMC->hMetadataPMC->icc_map_full[k] = NULL; - } - } -#endif mvs2s( hParamMC->band_grouping, band_grouping_old, hParamMC->hMetadataPMC->num_parameter_bands + 1 ); -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - 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 ) @@ -1121,9 +1086,6 @@ void ivas_param_mc_dec_close( /* parameter decoding */ if ( hParamMC->hMetadataPMC != NULL ) { -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - ivas_param_mc_metadata_close( hParamMC->hMetadataPMC ); -#endif free( hParamMC->hMetadataPMC ); hParamMC->hMetadataPMC = NULL; } @@ -1240,9 +1202,6 @@ void ivas_param_mc_dec_read_BS( int16_t num_param_bands; int16_t metadata_bit_pos; int16_t i, j, k; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - int16_t l; -#endif int16_t icc_map_size; int16_t icc_map_size_wo_lfe; int16_t ild_map_size; @@ -1331,66 +1290,6 @@ void ivas_param_mc_dec_read_BS( num_lfe_bands = 0; } -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) - { - int16_t icc_mapping_index[PARAM_MC_SZ_ICC_MAP]; - - k = 0; - for ( i = 0; i < hMetadataPMC->icc_map_size_full - 1; i++ ) - { - if ( bit_buffer[bit_pos++] == 1 ) - { - icc_mapping_index[k++] = i; - } - } - - /* last one is always C/LFE */ - icc_mapping_index[k] = hMetadataPMC->icc_map_size_full - 1; - - /* save icc mapping of the previous frame*/ - /* build icc map for the current frame */ - for ( k = 0; k < icc_map_size; k++ ) - { - hMetadataPMC->icc_mapping[param_frame_idx][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; - hMetadataPMC->icc_mapping[param_frame_idx][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; - } - - if ( hMetadataPMC->bAttackPresent ) - { - for ( k = 0; k < icc_map_size; k++ ) - { - for ( l = 0; l < PARAM_MC_PARAMETER_FRAMES; l++ ) - { - hMetadataPMC->icc_mapping[l][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; - hMetadataPMC->icc_mapping[l][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; - } - } - } - else - { - for ( k = 0; k < icc_map_size; k++ ) - { - hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; - hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; - } - } - } - else - { - if ( hMetadataPMC->bAttackPresent ) - { - for ( l = 0; l < PARAM_MC_PARAMETER_FRAMES; l++ ) - { - ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[param_frame_idx] ); - } - } - else - { - 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 ); if ( !st->BER_detect ) @@ -2959,15 +2858,9 @@ static void ivas_param_mc_dequantize_cov( int16_t l; float *Cyp; float ap; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - 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_PARAMMC_DEAD_CODE_FL901 - param_frame_idx = hParamMC->hMetadataPMC->param_frame_idx; -#endif set_zero( Nrqq, MAX_OUTPUT_CHANNELS ); h_ild_mapping = hParamMC->hMetadataPMC->ild_mapping_conf; @@ -3008,14 +2901,9 @@ 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_PARAMMC_DEAD_CODE_FL901 - 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 51893179a..b6d90bad4 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -62,9 +62,6 @@ 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_PARAMMC_DEAD_CODE_FL901 -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 ); @@ -89,9 +86,6 @@ ivas_error ivas_param_mc_enc_open( ) { int16_t i; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - int16_t k, l; -#endif IVAS_FB_CFG *fb_cfg; PARAM_MC_ENC_HANDLE hParamMC; uint16_t config_index; @@ -157,29 +151,7 @@ ivas_error ivas_param_mc_enc_open( } /* open/init parameter coding */ -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - 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_PARAMMC_DEAD_CODE_FL901 - /* init icc index states */ - for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) - { - set_s( hParamMC->icc_map_index[i], -1, PARAM_MC_SZ_ICC_MAP ); - - for ( l = 0; l < hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_lfe; l++ ) - { - for ( k = 0; k < hParamMC->hMetadataPMC.icc_map_size_full; k++ ) - { - if ( hParamMC->hMetadataPMC.icc_mapping[i][l][0] == hParamMC->hMetadataPMC.icc_map_full[0][k] && hParamMC->hMetadataPMC.icc_mapping[i][l][1] == hParamMC->hMetadataPMC.icc_map_full[1][k] ) - { - hParamMC->icc_map_index[i][l] = k; - } - } - } - } -#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC.num_parameter_bands == 20 ) @@ -246,9 +218,6 @@ ivas_error ivas_param_mc_enc_reconfig( ) { int16_t i; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - int16_t k, l; -#endif PARAM_MC_ENC_HANDLE hParamMC; uint16_t config_index; MC_LS_SETUP mc_input_setup; @@ -293,45 +262,9 @@ ivas_error ivas_param_mc_enc_reconfig( /* get dmx factors */ hParamMC->dmx_factors = ivas_param_mc_conf[config_index].dmx_fac; -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - /* deallocate the full icc map, gets newly allocated in the metadata open function */ - for ( i = 0; i < 2; i++ ) - { -#ifdef DEBUGGING - assert( hParamMC->hMetadataPMC.icc_map_full[i] != NULL ); -#endif - if ( hParamMC->hMetadataPMC.icc_map_full[i] != NULL ) - { - free( hParamMC->hMetadataPMC.icc_map_full[i] ); - hParamMC->hMetadataPMC.icc_map_full[i] = NULL; - } - } -#endif /* open/init parameter coding */ -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - 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_PARAMMC_DEAD_CODE_FL901 - /* init icc index states */ - for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) - { - set_s( hParamMC->icc_map_index[i], -1, PARAM_MC_SZ_ICC_MAP ); - - for ( l = 0; l < hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_lfe; l++ ) - { - for ( k = 0; k < hParamMC->hMetadataPMC.icc_map_size_full; k++ ) - { - if ( hParamMC->hMetadataPMC.icc_mapping[i][l][0] == hParamMC->hMetadataPMC.icc_map_full[0][k] && hParamMC->hMetadataPMC.icc_mapping[i][l][1] == hParamMC->hMetadataPMC.icc_map_full[1][k] ) - { - hParamMC->icc_map_index[i][l] = k; - } - } - } - } -#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC.num_parameter_bands == 20 ) { @@ -394,9 +327,6 @@ void ivas_param_mc_enc_close( return; } -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - ivas_param_mc_metadata_close( &( *hParamMC )->hMetadataPMC ); -#endif ivas_FB_mixer_close( &( *hParamMC )->hFbMixer, sampling_rate, 0 ); free( ( *hParamMC ) ); @@ -530,18 +460,6 @@ 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_PARAMMC_DEAD_CODE_FL901 - /* get icc map */ - if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) - { - ivas_param_mc_enc_find_icc_map( hParamMC, Cx_sum, Cy_sum, ILD_q, nchan_inp, st_ivas->nchan_transport ); - } - else - { - 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 ) { @@ -1009,230 +927,6 @@ static void ivas_param_mc_param_est_enc( } -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 -/*------------------------------------------------------------------------- - * ivas_param_mc_enc_find_icc_map() - * - * decide which ICCs out of all possible ICCs should be sent - *------------------------------------------------------------------------*/ - -static void ivas_param_mc_enc_find_icc_map( - PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ - float Cx_sum[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], /* i : Covariance matrix for the downmixed frame */ - float Cy_sum[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], /* i : Covariance matrix for the original frame */ - float ILD_q[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_SZ_ILD_MAP], /* i : quantized ILDs */ - const int16_t nchan_input, /* i : number of input channels */ - const int16_t nchan_transport /* i : number of transport channels */ -) -{ - float Cproto_band[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - float Cx_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float mat_mult_buffer1[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - float mapped_error[55]; /* max number of possible mappings for 7.1+4 */ - int16_t icc_map_index[PARAM_MC_SZ_ICC_MAP]; - int16_t map_idx; - float *sorted_error_desc[PARAM_MC_SZ_ICC_MAP]; - int16_t cur_param_band, k, m, i; - int16_t bandstep; - int16_t last_element, el; - int16_t num_parameter_bands; - int16_t ch_idx1, ch_idx2; - int16_t icc_map_size; - int16_t icc_map_size_wo_lfe; - float Nrqq[MAX_OUTPUT_CHANNELS]; - float a[MAX_OUTPUT_CHANNELS]; - float Cy_band[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - - /* Initialisations */ - num_parameter_bands = hParamMC->hMetadataPMC.nbands_coded; - bandstep = hParamMC->hMetadataPMC.bAttackPresent ? 2 : 1; - set_f( mapped_error, 0.0f, 55 ); - set_s( icc_map_index, -1, PARAM_MC_SZ_ICC_MAP ); - icc_map_size_wo_lfe = hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_wo_lfe; - icc_map_size = hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_lfe; - - set_zero( Cy_band, nchan_input * nchan_input ); - - /* Estimate the target covariance like in the decoder using the - * already available qunantised ICLDs */ - for ( cur_param_band = 0; cur_param_band < num_parameter_bands; cur_param_band += bandstep ) - { - if ( hParamMC->hMetadataPMC.bAttackPresent || hParamMC->hMetadataPMC.coding_band_mapping[cur_param_band] == hParamMC->hMetadataPMC.param_frame_idx ) - { - /* transfer Cx_sum band to columnwise matrix */ - for ( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) - { - for ( ch_idx2 = 0; ch_idx2 < nchan_transport; ++ch_idx2 ) - { - Cx_band[ch_idx1 + nchan_transport * ch_idx2] = Cx_sum[cur_param_band][ch_idx1][ch_idx2]; - } - } - - /* get estimated Cy from Cx and proto matrix */ - matrix_product( hParamMC->dmx_factors, nchan_input, nchan_transport, 0, - Cx_band, nchan_transport, nchan_transport, 0, - mat_mult_buffer1 ); - - matrix_product( mat_mult_buffer1, nchan_input, nchan_transport, 0, - hParamMC->dmx_factors, nchan_input, nchan_transport, 1, - Cproto_band ); - - set_zero( Nrqq, MAX_OUTPUT_CHANNELS ); - - /*get back Nrg*/ - for ( k = 0; k < nchan_input; k++ ) - { - float ref_ener = 0.0f; - int16_t ref_channel_cnt; - int16_t ref_channel_idx; - - for ( ref_channel_cnt = 0; ref_channel_cnt < hParamMC->hMetadataPMC.ild_mapping_conf->num_ref_channels[k]; ref_channel_cnt++ ) - { - ref_channel_idx = hParamMC->hMetadataPMC.ild_mapping_conf->ref_channel_idx[k][ref_channel_cnt]; - ref_ener += Cx_band[ref_channel_idx + ref_channel_idx * nchan_transport]; - } - Nrqq[hParamMC->hMetadataPMC.ild_mapping_conf->ild_index[k]] = powf( 10, ILD_q[cur_param_band][k] / 10.0f ) * hParamMC->hMetadataPMC.ild_factors[k] * ref_ener; - } - - /* apply quantized ICLDs in the estimated covariance */ - for ( k = 0; k < nchan_input; k++ ) - { - a[k] = sqrtf( Nrqq[k] ) / ( sqrtf( Cproto_band[k + nchan_input * k] ) + EPSILON ); - v_multc( Cproto_band + k * nchan_input, a[k], Cproto_band + k * nchan_input, nchan_input ); - } - - for ( k = 0; k < nchan_input; k++ ) - { - int16_t l; - float *Cyp = Cproto_band + k; - float ap = a[k]; - - for ( l = 0; l < nchan_input; l++ ) - { - ( *Cyp ) *= ap; - Cyp += nchan_input; - } - } - - /* transfer Cy_sum band to columnwise matrix */ - for ( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) - { - for ( ch_idx2 = 0; ch_idx2 < nchan_input; ++ch_idx2 ) - { - Cy_band[ch_idx1 + nchan_transport * ch_idx2] = Cy_sum[cur_param_band][ch_idx1][ch_idx2]; - } - } - - /* apply quantized ICLDs on the input covariance */ - for ( k = 0; k < nchan_input; k++ ) - { - a[k] = sqrtf( Nrqq[k] ) / ( sqrtf( Cy_band[k + nchan_input * k] ) + EPSILON ); - v_multc( Cy_band + k * nchan_input, a[k], Cy_band + k * nchan_input, nchan_input ); - } - - for ( k = 0; k < nchan_input; k++ ) - { - int16_t l; - float *Cyp = Cy_band + k; - float ap = a[k]; - - for ( l = 0; l < nchan_input; l++ ) - { - ( *Cyp ) *= ap; - Cyp += nchan_input; - } - } - - /* for all possible mappings, get the cumulated error between estimated and real Cy */ - for ( map_idx = 0; map_idx < hParamMC->hMetadataPMC.icc_map_size_full - 1; map_idx++ ) - { - int16_t idx0 = hParamMC->hMetadataPMC.icc_map_full[0][map_idx]; - int16_t idx1 = hParamMC->hMetadataPMC.icc_map_full[1][map_idx]; - mapped_error[map_idx] += fabsf( Cproto_band[idx0 + idx1 * nchan_input] - Cy_band[idx0 + idx1 * nchan_input] ); - } - } - } - - /* put a small bias on the error for the past transmitted indices*/ - if ( !hParamMC->hMetadataPMC.bAttackPresent ) - { - for ( i = 0; i < icc_map_size_wo_lfe; i++ ) - { - mapped_error[hParamMC->icc_map_index[hParamMC->hMetadataPMC.param_frame_idx][i]] *= PARAM_MC_ICC_ERROR_BIAS_FAC; - } - } - - /* get the mappings with the biggest expected errors as those who will be transmitted */ - for ( i = 0; i < hParamMC->hMetadataPMC.icc_map_size_full - 1; i++ ) - { - for ( k = 0; k < icc_map_size_wo_lfe; k++ ) - { - if ( icc_map_index[k] == -1 ) - { - /* not filled yet, take the value */ - icc_map_index[k] = i; - sorted_error_desc[k] = &mapped_error[i]; - break; - } - else if ( mapped_error[i] > *sorted_error_desc[k] ) - { - /* push all others down and insert value here */ - for ( m = icc_map_size_wo_lfe - 1; m >= k + 1; m-- ) - { - icc_map_index[m] = icc_map_index[m - 1]; - sorted_error_desc[m] = sorted_error_desc[m - 1]; - } - icc_map_index[k] = i; - sorted_error_desc[k] = &mapped_error[i]; - break; - } - } - } - - /* the indices in ascending order, simple bubble sort */ - for ( last_element = icc_map_size_wo_lfe - 1; last_element >= 0; last_element-- ) - { - for ( el = 0; el < last_element; el++ ) - { - if ( icc_map_index[el] > icc_map_index[el + 1] ) - { - int16_t swp_el = icc_map_index[el]; - icc_map_index[el] = icc_map_index[el + 1]; - icc_map_index[el + 1] = swp_el; - } - } - } - - /* last icc map element is always the C/LFE icc */ - icc_map_index[icc_map_size - 1] = hParamMC->hMetadataPMC.icc_map_size_full - 1; - - /* create map and map index, map index is sorted in ascending order*/ - if ( hParamMC->hMetadataPMC.bAttackPresent ) - { - for ( k = 0; k < PARAM_MC_PARAMETER_FRAMES; k++ ) - { - for ( i = 0; i < icc_map_size; i++ ) - { - hParamMC->hMetadataPMC.icc_mapping[k][i][0] = hParamMC->hMetadataPMC.icc_map_full[0][icc_map_index[i]]; - hParamMC->hMetadataPMC.icc_mapping[k][i][1] = hParamMC->hMetadataPMC.icc_map_full[1][icc_map_index[i]]; - } - mvs2s( icc_map_index, hParamMC->icc_map_index[k], icc_map_size ); - } - } - else - { - for ( i = 0; i < icc_map_size; i++ ) - { - hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][i][0] = hParamMC->hMetadataPMC.icc_map_full[0][icc_map_index[i]]; - hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][i][1] = hParamMC->hMetadataPMC.icc_map_full[1][icc_map_index[i]]; - } - - mvs2s( icc_map_index, hParamMC->icc_map_index[hParamMC->hMetadataPMC.param_frame_idx], icc_map_size ); - } - - return; -} -#endif /*------------------------------------------------------------------------- * ivas_param_mc_quantize_ilds() @@ -1470,13 +1164,8 @@ 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_PARAMMC_DEAD_CODE_FL901 - 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]]; } @@ -1654,25 +1343,6 @@ static void ivas_param_mc_write_bs( nbands = hParamMC->hMetadataPMC.nbands_coded / band_step + ( ( hParamMC->hMetadataPMC.nbands_coded % band_step ) ? 1 : 0 ); } -#ifndef FIX_PARAMMC_DEAD_CODE_FL901 - /* Encoding of the ICC mapping done as simple bitmap */ - if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) - { - uint16_t *bit_buffer_icc_mapping = &bit_buffer[*bit_pos]; - - for ( i = 0; i < hParamMC->hMetadataPMC.icc_map_size_full - 1; i++ ) - { - bit_buffer_icc_mapping[i] = 0; - } - - for ( i = 0; i < icc_map_size_wo_lfe; i++ ) - { - bit_buffer_icc_mapping[hParamMC->icc_map_index[hParamMC->hMetadataPMC.param_frame_idx][i]] = 1; - } - - *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 008122e2ad807b68dda687d7be3746f11836ff9f Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 27 Feb 2025 14:59:26 +0100 Subject: [PATCH 3/3] clang-format --- lib_com/ivas_mc_param_com.c | 6 +----- lib_dec/ivas_mc_param_dec.c | 1 - lib_enc/ivas_mc_param_enc.c | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index 59e56e43c..7029851d8 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -86,7 +86,7 @@ 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 MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ 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 */ ) @@ -186,8 +186,6 @@ void ivas_param_mc_set_coded_bands( } - - /*------------------------------------------------------------------------- * ivas_param_mc_getNumTransportChannels() * @@ -211,8 +209,6 @@ int16_t ivas_param_mc_getNumTransportChannels( } - - /*------------------------------------------------------------------------- * ivas_param_mc_get_num_param_bands() * diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index ef1376a02..1716abb57 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -2903,7 +2903,6 @@ static void ivas_param_mc_dequantize_cov( { 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]; - } 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 534661c02..820b9614b 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -927,7 +927,6 @@ static void ivas_param_mc_param_est_enc( } - /*------------------------------------------------------------------------- * ivas_param_mc_quantize_ilds() * -- GitLab