diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index e8160527021164c336145a677fdb13f3db36cb9e..ac0589a308e2731bc144e1069aaadf428687e30b 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -36,6 +36,7 @@ #include "options.h" #include "ivas_cnst.h" #include "prot.h" +#include "prot_fx1.h" #include "ivas_prot.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" @@ -55,6 +56,26 @@ static void ivas_param_mc_set_coding_scheme( const MC_LS_SETUP mc_ls_setup, cons * *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +UWord16 ivas_param_mc_get_configuration_index( + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +) +{ + UWord16 cur_idx; + + FOR( cur_idx = 0; cur_idx < PARAM_MC_NUM_CONFIGS; cur_idx++ ) + { + IF( EQ_16( (Word16) ivas_param_mc_conf[cur_idx].mc_ls_setup, (Word16) mc_ls_setup ) && EQ_32( ivas_param_mc_conf[cur_idx].ivas_total_brate, ivas_total_brate ) ) + { + return cur_idx; + } + } + return PARAM_MC_NUM_CONFIGS; +} + +#else + uint16_t ivas_param_mc_get_configuration_index( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ @@ -71,7 +92,7 @@ uint16_t ivas_param_mc_get_configuration_index( } return PARAM_MC_NUM_CONFIGS; } - +#endif /*------------------------------------------------------------------------- * ivas_param_mc_metadata_open() @@ -79,6 +100,87 @@ uint16_t ivas_param_mc_get_configuration_index( * Parametric MC parameter coding state open function *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_metadata_open( + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ + const Word16 lfe_index, /* i : channel index of LFE */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ +) +{ + Word16 i; + UWord16 config_index; + Word16 nchan_setup; + + nchan_setup = ivas_mc_ls_setup_get_num_channels( mc_ls_setup ); + + /* get coding band mappings */ + set16_fx( hMetadataPMC->coding_band_mapping, 0, PARAM_MC_MAX_PARAMETER_BANDS ); + + /* set coding scheme */ + ivas_param_mc_set_coding_scheme( mc_ls_setup, ivas_total_brate, hMetadataPMC ); + + /* get configuration index */ + config_index = ivas_param_mc_get_configuration_index( mc_ls_setup, ivas_total_brate ); + IF ( EQ_16((Word16)config_index , PARAM_MC_NUM_CONFIGS) ) + { + assert( 0 && "ParamMC configuration index not found!" ); + } + + /* Band Grouping */ + IF ( EQ_16(hMetadataPMC->num_parameter_bands , 20) ) + { + Copy( param_mc_coding_band_mapping_20, hMetadataPMC->coding_band_mapping, 20 ); + } + ELSE IF ( EQ_16(hMetadataPMC->num_parameter_bands , 14) ) + { + Copy( param_mc_coding_band_mapping_14, hMetadataPMC->coding_band_mapping, 14 ); + } + ELSE IF ( EQ_16(hMetadataPMC->num_parameter_bands , 10) ) + { + Copy( param_mc_coding_band_mapping_10, hMetadataPMC->coding_band_mapping, 10 ); + } + ELSE + { + assert( 0 && "nbands must be 20 or 14!" ); + } + + /* 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 ); + 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; //float + hMetadataPMC->ild_factors_fx = ivas_param_mc_conf[config_index].ild_factors_fx; + + /* 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] ); + } + + /* init remaining flags and indices */ + hMetadataPMC->param_frame_idx = 0; + move16(); + hMetadataPMC->flag_use_adaptive_icc_map = 0; + move16(); + hMetadataPMC->bAttackPresent = 0; + move16(); + hMetadataPMC->attackIndex = 0; + move16(); + hMetadataPMC->lfe_on = 1; + move16(); + + /* set coded bwidth to FB at the beginning */ + hMetadataPMC->coded_bwidth = FB; + move16(); + hMetadataPMC->last_coded_bwidth = FB; + move16(); + + ivas_param_mc_set_coded_bands( hMetadataPMC ); + + return; +} +#else 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 */ @@ -150,7 +252,7 @@ void ivas_param_mc_metadata_open( return; } - +#endif /*------------------------------------------------------------------------- * ivas_param_mc_set_coded_bands() @@ -159,6 +261,44 @@ void ivas_param_mc_metadata_open( * coded band width *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_set_coded_bands( + HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ +) +{ + Word16 i; + + /* set number of coded bands*/ + SWITCH( hMetadataPMC->num_parameter_bands ) + { + case 20: + hMetadataPMC->nbands_coded = param_mc_bands_coded_20[hMetadataPMC->coded_bwidth]; + move16(); + BREAK; + case 14: + hMetadataPMC->nbands_coded = param_mc_bands_coded_14[hMetadataPMC->coded_bwidth]; + move16(); + BREAK; + case 10: + hMetadataPMC->nbands_coded = param_mc_bands_coded_10[hMetadataPMC->coded_bwidth]; + move16(); + } + + /* set number of bands per parameter frame set */ + FOR( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) + { + hMetadataPMC->nbands_in_param_frame[i] = 0; + move16(); + } + + FOR( i = 0; i < hMetadataPMC->nbands_coded; i++ ) + { + hMetadataPMC->nbands_in_param_frame[hMetadataPMC->coding_band_mapping[i]]++; + } + + return; +} +#else void ivas_param_mc_set_coded_bands( HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ ) @@ -191,7 +331,7 @@ void ivas_param_mc_set_coded_bands( return; } - +#endif /*------------------------------------------------------------------------- * ivas_param_mc_metadata_close() @@ -199,6 +339,26 @@ void ivas_param_mc_set_coded_bands( * Parametric MC parameter coding state close function *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_metadata_close( + HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ +) +{ + UWord16 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; +} +#else void ivas_param_mc_metadata_close( HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ ) @@ -217,6 +377,7 @@ void ivas_param_mc_metadata_close( return; } +#endif /*------------------------------------------------------------------------- @@ -226,6 +387,23 @@ void ivas_param_mc_metadata_close( *------------------------------------------------------------------------*/ /* r : number of IVAS transport channels */ +#ifdef IVAS_FLOAT_FIXED +Word16 ivas_param_mc_getNumTransportChannels( + const Word32 ivas_total_bitrate, /* i : IVAS total bitrate */ + const MC_LS_SETUP mc_ls_setup /* i : MC ls setup */ +) +{ + Word16 nchan_transport; + Word16 config_index; + + config_index = ivas_param_mc_get_configuration_index( mc_ls_setup, ivas_total_bitrate ); + + nchan_transport = ivas_param_mc_conf[config_index].num_transport_chan; + move16(); + + return nchan_transport; +} +#else int16_t ivas_param_mc_getNumTransportChannels( const int32_t ivas_total_bitrate, /* i : IVAS total bitrate */ const MC_LS_SETUP mc_ls_setup /* i : MC ls setup */ @@ -240,6 +418,7 @@ int16_t ivas_param_mc_getNumTransportChannels( return nchan_transport; } +#endif /*------------------------------------------------------------------------- @@ -249,6 +428,60 @@ int16_t ivas_param_mc_getNumTransportChannels( * indicated by the number of channels and LFE index *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_create_full_icc_mapping( + const Word16 n_channels, /* i : number of channels with LFE for the internal setup */ + const Word16 lfe_index, /* i : channel index of the LFE */ + Word16 *icc_map[2], /* o : map of all possible ICCs */ + Word16 *icc_map_size_full /* o : number of all possible ICCs */ +) +{ + Word16 i, k, l; + + l = 0; + move16(); + + /* 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 = add( shr( i_mult( ( sub( n_channels, 2 ) ), sub( n_channels, 1 ) ), 1 ), 1 ); + + /* allocate memory for the map */ + FOR( i = 0; i < 2; i++ ) + { + icc_map[i] = (Word16 *) malloc( *icc_map_size_full * sizeof( Word16 ) ); + } + + /* create map (non-LFE ICCs) */ + FOR( i = 0; i < n_channels; i++ ) + { + IF( NE_16( i, lfe_index ) ) + { + FOR( k = i + 1; k < n_channels; k++ ) + { + IF( NE_16( k, lfe_index ) ) + { + icc_map[0][l] = i; + move16(); + icc_map[1][l] = k; + move16(); + l++; + } + } + } + } + + /* last one is the fixed mapping center -> LFE */ + assert( l == *icc_map_size_full - 1 ); + + icc_map[0][l] = 2; + move16(); + icc_map[1][l] = lfe_index; + move16(); + + return; +} +#else 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 */ @@ -296,6 +529,7 @@ void ivas_param_mc_create_full_icc_mapping( return; } +#endif /*------------------------------------------------------------------------- @@ -305,6 +539,25 @@ void ivas_param_mc_create_full_icc_mapping( * indicated by the number of channels from the table ROM *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_param_mc_default_icc_map( + const PARAM_MC_ICC_MAPPING *hIccMapping, /* i : ICC mapping table */ + Word16 icc_map[PARAM_MC_SZ_ICC_MAP][2] /* o : copy of map from ROM table */ +) +{ + Word16 i; + + FOR( i = 0; i < hIccMapping->icc_map_size_lfe; i++ ) + { + icc_map[i][0] = hIccMapping->icc_mapping[i][0]; + move16(); + icc_map[i][1] = hIccMapping->icc_mapping[i][1]; + move16(); + } + + return; +} +#else 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 */ @@ -320,6 +573,7 @@ void ivas_param_mc_default_icc_map( return; } +#endif /*------------------------------------------------------------------------- @@ -327,7 +581,107 @@ void ivas_param_mc_default_icc_map( * * *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static Word16 ivas_param_mc_get_num_param_bands( + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +) +{ + Word16 num_parameter_bands; + + num_parameter_bands = 0; + move16(); + + /* parameter bands */ + SWITCH( mc_ls_setup ) + { + case MC_LS_SETUP_5_1: + SWITCH( ivas_total_brate ) + { + case IVAS_48k: + num_parameter_bands = 10; + move16(); + BREAK; + case IVAS_64k: + case IVAS_80k: + num_parameter_bands = 14; + move16(); + BREAK; + default: + assert( 0 && "PARAM_MC: bitrate for CICP6 not supported!" ); + } + BREAK; + + case MC_LS_SETUP_7_1: + SWITCH( ivas_total_brate ) + { + case IVAS_48k: + num_parameter_bands = 10; + move16(); + BREAK; + case IVAS_64k: + case IVAS_80k: + num_parameter_bands = 14; + move16(); + BREAK; + case IVAS_96k: + num_parameter_bands = 20; + move16(); + BREAK; + } + BREAK; + case MC_LS_SETUP_5_1_2: + SWITCH( ivas_total_brate ) + { + case IVAS_48k: + num_parameter_bands = 10; + move16(); + BREAK; + case IVAS_64k: + case IVAS_80k: + num_parameter_bands = 14; + move16(); + BREAK; + case IVAS_96k: + num_parameter_bands = 20; + move16(); + BREAK; + } + BREAK; + case MC_LS_SETUP_5_1_4: + SWITCH( ivas_total_brate ) + { + case IVAS_96k: + num_parameter_bands = 14; + move16(); + BREAK; + case IVAS_128k: + num_parameter_bands = 20; + move16(); + BREAK; + } + BREAK; + case MC_LS_SETUP_7_1_4: + SWITCH( ivas_total_brate ) + { + case IVAS_128k: + num_parameter_bands = 14; + move16(); + BREAK; + case IVAS_160k: + num_parameter_bands = 20; + move16(); + BREAK; + } + BREAK; + default: + assert( 0 && "PARAM_MC: channel configuration not supportet!" ); + } + return num_parameter_bands; +} + +#else static int16_t ivas_param_mc_get_num_param_bands( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ @@ -413,6 +767,7 @@ static int16_t ivas_param_mc_get_num_param_bands( return num_parameter_bands; } +#endif /*------------------------------------------------------------------------- @@ -425,6 +780,123 @@ static int16_t ivas_param_mc_get_num_param_bands( * set Parametric MC parameter coding tables based on format and bitrate *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void ivas_param_mc_set_coding_scheme( + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: Parametric MC metadata handle */ +) +{ + /* quantizer and coding tables */ + SWITCH( mc_ls_setup ) + { + case MC_LS_SETUP_5_1: + /* ICC */ + hMetadataPMC->icc_coding.cum_freq = &ivas_param_mc_cum_freq_icc_cicp6_48_16bits[0]; + hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_cicp6_48_16bits[0]; + hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[0]; + hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[0]; + hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; //float + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; + move16(); + hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; + move16(); + /* ILD */ + hMetadataPMC->ild_coding.cum_freq = &ivas_param_mc_cum_freq_ild_cicp6_48_16bits[0]; + hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_cicp6_48_16bits[0]; + hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[0]; + hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[0]; + hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; //float + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; + move16(); + hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; + move16(); + BREAK; + case MC_LS_SETUP_7_1: + /* ICC */ + hMetadataPMC->icc_coding.cum_freq = &ivas_param_mc_cum_freq_icc_cicp12_48_16bits[0]; + hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_cicp12_48_16bits[0]; + hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[0]; + hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[0]; + hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; //float + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; + move16(); + hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; + move16(); + /* ILD */ + hMetadataPMC->ild_coding.cum_freq = &ivas_param_mc_cum_freq_ild_cicp12_48_16bits[0]; + hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_cicp12_48_16bits[0]; + hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[0]; + hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[0]; + hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; //float + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; + move16(); + hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; + move16(); + BREAK; + case MC_LS_SETUP_5_1_2: + /* ICC */ + hMetadataPMC->icc_coding.cum_freq = &ivas_param_mc_cum_freq_icc_cicp14_48_16bits[0]; + hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_cicp14_48_16bits[0]; + hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[0]; + hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[0]; + hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; //float + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; + move16(); + hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; + move16(); + /* ILD */ + hMetadataPMC->ild_coding.cum_freq = &ivas_param_mc_cum_freq_ild_cicp14_48_16bits[0]; + hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_cicp14_48_16bits[0]; + hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[0]; + hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[0]; + hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; //float + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; + move16(); + hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; + move16(); + BREAK; + case MC_LS_SETUP_5_1_4: + case MC_LS_SETUP_7_1_4: + /* ICC */ + hMetadataPMC->icc_coding.cum_freq = &ivas_param_mc_cum_freq_icc_combined_48_16bits[0]; + hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_combined_48_16bits[0]; + hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[0]; + hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[0]; + hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; //float + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; + move16(); + hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; + move16(); + /* ILD */ + hMetadataPMC->ild_coding.cum_freq = &ivas_param_mc_cum_freq_ild_combined_48_16bits[0]; + hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_combined_48_16bits[0]; + hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[0]; + hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[0]; + hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; //float + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; + move16(); + hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; + move16(); + BREAK; + default: + assert( 0 && "PARAM_MC: channel configuration not supported!" ); + } + + hMetadataPMC->num_parameter_bands = ivas_param_mc_get_num_param_bands( mc_ls_setup, ivas_total_brate ); + + return; +} +#else + static void ivas_param_mc_set_coding_scheme( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ @@ -515,3 +987,5 @@ static void ivas_param_mc_set_coding_scheme( return; } + +#endif diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 15b707d3f14ddbbe210a51fb0210b732d009474c..97a3b2f77e1c0b98e71b062ea1e21635e3941de7 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2371,12 +2371,28 @@ const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = -8.0f, -5.5f, -3.5f, -1.5f, 0.0f, 1.5f, 3.5f, 5.5f, 8.0f, 10.0f, 13.0f, 20.0f }; +#ifdef IVAS_FLOAT_FIXED +//Q7 +const Word16 ivas_param_mc_quant_ild_5d1_48_fx[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = +{ + -25600 ,-5120 ,-3328 ,-2560 ,-2048 ,-1408 ,-896 ,-384 ,0 ,384 ,896 ,1408 ,2048 ,2560 ,3328 ,5120 , +}; +#endif + /* Quantizer for ICCs in Parametric MC Processing */ const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER] = { -0.99f, -0.589f, 0.0f, 0.36764f, 0.60092f, 0.84118f, 0.937f, 1.0f }; +#ifdef IVAS_FLOAT_FIXED +//Q14 +const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER] = +{ + -16220 ,-9650 ,0 ,6023 ,9845 ,13782 ,15352 ,16384 , +}; +#endif + /* Alphabet for delta coding for the ICCs in Parametric MC processing */ const uint16_t ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = { diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 04b80872ee563b9d46850e60d7fcdb1dac5fd73c..70495f00c36c3324850638213e194bc2a40485be 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -225,6 +225,8 @@ extern const int16_t Param_MC_index[MAX_CICP_CHANNELS]; extern const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS]; extern const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; extern const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER]; +extern const Word16 ivas_param_mc_quant_ild_5d1_48_fx[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER]; extern const uint16_t ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; extern const uint16_t ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; extern const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index c94c94d72a11451f730e2f19897c1b6961282340..eae5ae99ae75bf93434d58d4a5411df3559d09ea 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -589,6 +589,9 @@ typedef struct ivas_param_mc_conf_struct /* structure for ROM Table */ const PARAM_MC_ICC_MAPPING *icc_mapping_conf; const float *dmx_fac; const float *ild_factors; +#ifdef IVAS_FLOAT_FIXED + const Word16 *ild_factors_fx; +#endif } PARAM_MC_CONF; @@ -599,6 +602,9 @@ typedef struct ivas_parametric_mc_metadata_value_coding_info_struct const uint16_t *cum_freq_delta; const uint16_t *sym_freq_delta; const float *quantizer; +#ifdef IVAS_FLOAT_FIXED + const Word16 *quantizer_fx; +#endif int16_t quantizer_size; int16_t uni_bits; @@ -614,6 +620,9 @@ typedef struct ivas_parametric_mc_metadata_struct int16_t param_frame_idx; int16_t flag_use_adaptive_icc_map; const float *ild_factors; +#ifdef IVAS_FLOAT_FIXED + const Word16 *ild_factors_fx; +#endif int16_t coding_band_mapping[PARAM_MC_MAX_PARAMETER_BANDS]; int16_t nbands_in_param_frame[PARAM_MC_PARAMETER_FRAMES]; int16_t bAttackPresent; diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 77fc1a2ab9d3eadcc2da2708763ccfca8a5b2de5..ef622eca12ebb68cbdf5927a0dc834b661fede7d 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -10188,7 +10188,7 @@ const Word16 bpf_weights_16_ivas_fx[16] = 9/*0.000270f Q15*/, 3/*0.000080f Q15*/, 1/*0.000030f Q15*/, 3/*0.000082f Q15*/, 3/*0.000081f Q15*/, 2/*0.000052f Q15*/, 1/*0.000017f Q15*/, 1/*0.000016f Q15*/ }; -const Word16 bpf_weights_16_ivas_fx_32[16] = +const Word32 bpf_weights_16_ivas_fx_32[16] = { 1073784774/*0.999969f Q15*/, 754369130/*0.702561f Q15*/, 224238095/*0.208838f Q15*/, 1667521/*0.001553f Q15*/, 1908039/*0.001777f Q15*/, 1435593/*0.001370f Q15*/, 994285/*0.000926f Q15*/, 594853/*0.000554f Q15*/, diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 51523dddc810280c568f6992e09bbd246d20c93b..75a3047543c5e294650ec616956388fb7a3ca464 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -1622,7 +1622,7 @@ extern const Word32 rot_vec_syn_im_L60_fx[30]; extern const float bpf_weights_16[CLDFB_NO_COL_MAX]; extern const Word16 bpf_weights_16_Fx[16]; extern const Word16 bpf_weights_16_ivas_fx[16]; -extern const Word16 bpf_weights_16_ivas_fx_32[16]; +extern const Word32 bpf_weights_16_ivas_fx_32[16]; extern const float CNG_details_codebook[64][NUM_ENV_CNG]; extern const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG]; diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index cd4a75705c3834ab97b91c29b3bb51779fdf1399..a7253074835b2bcda79c6abd0500359373fb038d 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -530,7 +530,7 @@ void addBassPostFilter_fx( Word32 cldfbBufferImag_fx[CLDFB_NO_COL_MAX][20]; Word16 i, b; Word16 maxBand; - const Word16 *weights_fx; + const Word32 *weights_fx; Word16 nCol = cldfb->no_col; Word16 nColToProcess = nCol; Word16 nChan = cldfb->no_channels;