Loading lib_com/ivas_cnst.h +3 −0 Original line number Diff line number Diff line Loading @@ -1413,6 +1413,9 @@ typedef enum #ifdef FIX_563_PARAMMC_LIMITER #define PARAM_MC_ENER_LIMIT_MAX_DELTA_FAC (15.0f) #endif #ifdef FIX_580_PARAMMC_ENER_BURSTS #define PARAM_MC_NUM_ATTACK_ILD_THRESH (3) #endif #define PARAM_MC_LFE_ON_THRESH (8000.0f) #define PARAM_MC_BAND_TO_MDCT_BAND_RATIO 16 /* Ratio of resolution of CLDFB Bands to MDCT Bands */ #define PARAM_MC_SLOT_ENC_NS 2500000L Loading lib_com/ivas_rom_com.c +0 −1 Original line number Diff line number Diff line Loading @@ -1803,7 +1803,6 @@ const int16_t param_mc_band_grouping_14[14 + 1] = 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 28, 40, 60 }; const int16_t param_mc_coding_band_mapping_14[14] = { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 Loading lib_com/options.h +5 −2 Original line number Diff line number Diff line Loading @@ -160,6 +160,9 @@ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define FIX_488_SYNC_DELAY /* Eri: Issue 488: Waveform and MD desynchronized in external renderer */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading lib_enc/ivas_mc_param_enc.c +87 −2 Original line number Diff line number Diff line Loading @@ -35,6 +35,9 @@ #include "options.h" #include "cnst.h" #include "rom_enc.h" #ifdef FIX_580_PARAMMC_ENER_BURSTS #include "ivas_rom_enc.h" #endif #include "rom_com.h" #include "prot.h" #include "ivas_prot.h" Loading Loading @@ -75,7 +78,6 @@ static void ivas_param_mc_encode_parameter( int16_t *idx_in, HANDLE_IVAS_PARAM_M static void ivas_param_mc_range_encoder( const int16_t *seq_in, const int16_t num_symbols, const uint16_t *cum_freq, const uint16_t *sym_freq, const uint16_t tot_shift, const int16_t max_nb_bits, uint16_t *bit_buffer, int16_t *bit_pos ); /*------------------------------------------------------------------------- * ivas_param_mc_enc_open() * Loading Loading @@ -213,6 +215,14 @@ ivas_error ivas_param_mc_enc_open( /* Init total/dmx ener factors */ set_f( hParamMC->ener_fac, 0.0f, PARAM_MC_MAX_PARAMETER_BANDS ); #ifdef FIX_580_PARAMMC_ENER_BURSTS /* init previous ILDs */ for ( i = 0; i < PARAM_MC_MAX_PARAMETER_BANDS; i++ ) { set_zero( hParamMC->prev_ilds[i], PARAM_MC_SZ_ILD_MAP ); } #endif st_ivas->hParamMC = hParamMC; return error; Loading Loading @@ -349,6 +359,7 @@ ivas_error ivas_param_mc_enc_reconfig( /* Init total/dmx ener factors */ set_f( hParamMC->ener_fac, 0.0f, PARAM_MC_MAX_PARAMETER_BANDS ); return error; } Loading Loading @@ -483,7 +494,9 @@ void ivas_param_mc_enc( hParamMC->hMetadataPMC.attackIndex = 0; } #ifndef FIX_580_PARAMMC_ENER_BURSTS band_step = hParamMC->hMetadataPMC.bAttackPresent ? PARAM_MC_TRANSIENT_BAND_STEP : 1; #endif } break; #ifdef DEBUGGING Loading @@ -493,10 +506,14 @@ void ivas_param_mc_enc( } /* Encoding */ /* parameter estimation*/ ivas_param_mc_param_est_enc( hParamMC, data_f, Cy_sum, Cx_sum, input_frame, nchan_inp, st_ivas->nchan_transport ); #ifdef FIX_580_PARAMMC_ENER_BURSTS band_step = hParamMC->hMetadataPMC.bAttackPresent ? PARAM_MC_TRANSIENT_BAND_STEP : 1; #endif /* ILD parameter quantization */ for ( k = 0; k < hParamMC->hMetadataPMC.nbands_coded; k += band_step ) { Loading Loading @@ -830,6 +847,65 @@ static void ivas_param_mc_param_est_enc( } } #ifdef FIX_580_PARAMMC_ENER_BURSTS if ( !hParamMC->hMetadataPMC.bAttackPresent ) { const PARAM_MC_ILD_MAPPING *h_ild_mapping; int16_t ild_attack; ild_attack = 0; h_ild_mapping = hParamMC->hMetadataPMC.ild_mapping_conf; /* create ILDs for to non transmitted parameter bands (only lower half) */ for ( cur_param_band = 0; cur_param_band < hParamMC->hMetadataPMC.num_parameter_bands / 2; cur_param_band++ ) { float ILD[PARAM_MC_SZ_ILD_MAP]; int16_t k; int16_t num_ilds_to_code; if ( cur_param_band >= PARAM_MC_MAX_BAND_LFE ) { num_ilds_to_code = hParamMC->hMetadataPMC.ild_mapping_conf->ild_map_size_wo_lfe; } else { num_ilds_to_code = hParamMC->hMetadataPMC.ild_mapping_conf->ild_map_size_lfe; } if ( hParamMC->hMetadataPMC.param_frame_idx != hParamMC->hMetadataPMC.coding_band_mapping[cur_param_band] ) { float Nrg[MAX_CICP_CHANNELS]; /* get ICLDs */ for ( k = 0; k < nchan_input; ++k ) { Nrg[k] = Cy_sum[cur_param_band][k][k]; } for ( k = 0; k < num_ilds_to_code; ++k ) { float ref_ener = 0.0f; int16_t ref_channel_cnt; int16_t ref_channel_idx; for ( ref_channel_cnt = 0; ref_channel_cnt < h_ild_mapping->num_ref_channels[k]; ref_channel_cnt++ ) { ref_channel_idx = h_ild_mapping->ref_channel_idx[k][ref_channel_cnt]; ref_ener += Cx_sum[cur_param_band][ref_channel_idx][ref_channel_idx]; } ILD[k] = 10.0f * log10f( ( Nrg[h_ild_mapping->ild_index[k]] + EPSILON ) / ( hParamMC->hMetadataPMC.ild_factors[k] * ref_ener + EPSILON ) ); if ( hParamMC->prev_ilds[cur_param_band][k] - ILD[k] > param_mc_ild_diff_threshold[cur_param_band] ) { ild_attack++; } } } } /* check if the ILDs change too much -> go into transient mode... */ if ( ild_attack > PARAM_MC_NUM_ATTACK_ILD_THRESH ) { hParamMC->hMetadataPMC.bAttackPresent = 1; } } #endif if ( hParamMC->hMetadataPMC.bAttackPresent ) { /* combine bands */ Loading Loading @@ -883,6 +959,7 @@ static void ivas_param_mc_param_est_enc( band_step = 2; } /* map complex covariances to real values */ for ( cur_param_band = 0; cur_param_band < hParamMC->max_param_band_abs_cov; cur_param_band += band_step ) { Loading Loading @@ -1289,7 +1366,15 @@ static void ivas_param_mc_quantize_ilds( ref_ener += Cx[ref_channel_idx][ref_channel_idx]; } ILD[k] = 10.0f * log10f( ( Nrg[h_ild_mapping->ild_index[k]] + EPSILON ) / ( hParamMC->hMetadataPMC.ild_factors[k] * ref_ener + EPSILON ) ); #ifdef FIX_580_PARAMMC_ENER_BURSTS hParamMC->prev_ilds[freq_idx][k] = ILD[k]; if ( hParamMC->hMetadataPMC.bAttackPresent && ( ( freq_idx + 1 ) < hParamMC->hMetadataPMC.nbands_coded ) ) { hParamMC->prev_ilds[freq_idx + 1][k] = ILD[k]; } #endif } /* quantize parameters */ ivas_param_mc_parameter_quantizer( ILD, num_ilds_to_code, hParamMC->hMetadataPMC.ild_coding.quantizer_size, hParamMC->hMetadataPMC.ild_coding.quantizer, ILD_idx, ILD_q ); Loading lib_enc/ivas_rom_enc.c +8 −0 Original line number Diff line number Diff line Loading @@ -837,5 +837,13 @@ const HUFF_TABLE huff_beta_table[2] = const int16_t mc_paramupmix_fb_remix_order[4] = {0, 1, 2, 3}; #ifdef FIX_580_PARAMMC_ENER_BURSTS /*----------------------------------------------------------------------------------* * ParamMC ROM tables *----------------------------------------------------------------------------------*/ const float param_mc_ild_diff_threshold[20] = { 8.0f, 8.0f, 10.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f }; #endif /* clang-format on */ Loading
lib_com/ivas_cnst.h +3 −0 Original line number Diff line number Diff line Loading @@ -1413,6 +1413,9 @@ typedef enum #ifdef FIX_563_PARAMMC_LIMITER #define PARAM_MC_ENER_LIMIT_MAX_DELTA_FAC (15.0f) #endif #ifdef FIX_580_PARAMMC_ENER_BURSTS #define PARAM_MC_NUM_ATTACK_ILD_THRESH (3) #endif #define PARAM_MC_LFE_ON_THRESH (8000.0f) #define PARAM_MC_BAND_TO_MDCT_BAND_RATIO 16 /* Ratio of resolution of CLDFB Bands to MDCT Bands */ #define PARAM_MC_SLOT_ENC_NS 2500000L Loading
lib_com/ivas_rom_com.c +0 −1 Original line number Diff line number Diff line Loading @@ -1803,7 +1803,6 @@ const int16_t param_mc_band_grouping_14[14 + 1] = 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 28, 40, 60 }; const int16_t param_mc_coding_band_mapping_14[14] = { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 Loading
lib_com/options.h +5 −2 Original line number Diff line number Diff line Loading @@ -160,6 +160,9 @@ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #define FIX_488_SYNC_DELAY /* Eri: Issue 488: Waveform and MD desynchronized in external renderer */ #define FIX_580_PARAMMC_ENER_BURSTS /* FhG: issue 580: energy bursts due to ILD holding when energy relations change too much */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading
lib_enc/ivas_mc_param_enc.c +87 −2 Original line number Diff line number Diff line Loading @@ -35,6 +35,9 @@ #include "options.h" #include "cnst.h" #include "rom_enc.h" #ifdef FIX_580_PARAMMC_ENER_BURSTS #include "ivas_rom_enc.h" #endif #include "rom_com.h" #include "prot.h" #include "ivas_prot.h" Loading Loading @@ -75,7 +78,6 @@ static void ivas_param_mc_encode_parameter( int16_t *idx_in, HANDLE_IVAS_PARAM_M static void ivas_param_mc_range_encoder( const int16_t *seq_in, const int16_t num_symbols, const uint16_t *cum_freq, const uint16_t *sym_freq, const uint16_t tot_shift, const int16_t max_nb_bits, uint16_t *bit_buffer, int16_t *bit_pos ); /*------------------------------------------------------------------------- * ivas_param_mc_enc_open() * Loading Loading @@ -213,6 +215,14 @@ ivas_error ivas_param_mc_enc_open( /* Init total/dmx ener factors */ set_f( hParamMC->ener_fac, 0.0f, PARAM_MC_MAX_PARAMETER_BANDS ); #ifdef FIX_580_PARAMMC_ENER_BURSTS /* init previous ILDs */ for ( i = 0; i < PARAM_MC_MAX_PARAMETER_BANDS; i++ ) { set_zero( hParamMC->prev_ilds[i], PARAM_MC_SZ_ILD_MAP ); } #endif st_ivas->hParamMC = hParamMC; return error; Loading Loading @@ -349,6 +359,7 @@ ivas_error ivas_param_mc_enc_reconfig( /* Init total/dmx ener factors */ set_f( hParamMC->ener_fac, 0.0f, PARAM_MC_MAX_PARAMETER_BANDS ); return error; } Loading Loading @@ -483,7 +494,9 @@ void ivas_param_mc_enc( hParamMC->hMetadataPMC.attackIndex = 0; } #ifndef FIX_580_PARAMMC_ENER_BURSTS band_step = hParamMC->hMetadataPMC.bAttackPresent ? PARAM_MC_TRANSIENT_BAND_STEP : 1; #endif } break; #ifdef DEBUGGING Loading @@ -493,10 +506,14 @@ void ivas_param_mc_enc( } /* Encoding */ /* parameter estimation*/ ivas_param_mc_param_est_enc( hParamMC, data_f, Cy_sum, Cx_sum, input_frame, nchan_inp, st_ivas->nchan_transport ); #ifdef FIX_580_PARAMMC_ENER_BURSTS band_step = hParamMC->hMetadataPMC.bAttackPresent ? PARAM_MC_TRANSIENT_BAND_STEP : 1; #endif /* ILD parameter quantization */ for ( k = 0; k < hParamMC->hMetadataPMC.nbands_coded; k += band_step ) { Loading Loading @@ -830,6 +847,65 @@ static void ivas_param_mc_param_est_enc( } } #ifdef FIX_580_PARAMMC_ENER_BURSTS if ( !hParamMC->hMetadataPMC.bAttackPresent ) { const PARAM_MC_ILD_MAPPING *h_ild_mapping; int16_t ild_attack; ild_attack = 0; h_ild_mapping = hParamMC->hMetadataPMC.ild_mapping_conf; /* create ILDs for to non transmitted parameter bands (only lower half) */ for ( cur_param_band = 0; cur_param_band < hParamMC->hMetadataPMC.num_parameter_bands / 2; cur_param_band++ ) { float ILD[PARAM_MC_SZ_ILD_MAP]; int16_t k; int16_t num_ilds_to_code; if ( cur_param_band >= PARAM_MC_MAX_BAND_LFE ) { num_ilds_to_code = hParamMC->hMetadataPMC.ild_mapping_conf->ild_map_size_wo_lfe; } else { num_ilds_to_code = hParamMC->hMetadataPMC.ild_mapping_conf->ild_map_size_lfe; } if ( hParamMC->hMetadataPMC.param_frame_idx != hParamMC->hMetadataPMC.coding_band_mapping[cur_param_band] ) { float Nrg[MAX_CICP_CHANNELS]; /* get ICLDs */ for ( k = 0; k < nchan_input; ++k ) { Nrg[k] = Cy_sum[cur_param_band][k][k]; } for ( k = 0; k < num_ilds_to_code; ++k ) { float ref_ener = 0.0f; int16_t ref_channel_cnt; int16_t ref_channel_idx; for ( ref_channel_cnt = 0; ref_channel_cnt < h_ild_mapping->num_ref_channels[k]; ref_channel_cnt++ ) { ref_channel_idx = h_ild_mapping->ref_channel_idx[k][ref_channel_cnt]; ref_ener += Cx_sum[cur_param_band][ref_channel_idx][ref_channel_idx]; } ILD[k] = 10.0f * log10f( ( Nrg[h_ild_mapping->ild_index[k]] + EPSILON ) / ( hParamMC->hMetadataPMC.ild_factors[k] * ref_ener + EPSILON ) ); if ( hParamMC->prev_ilds[cur_param_band][k] - ILD[k] > param_mc_ild_diff_threshold[cur_param_band] ) { ild_attack++; } } } } /* check if the ILDs change too much -> go into transient mode... */ if ( ild_attack > PARAM_MC_NUM_ATTACK_ILD_THRESH ) { hParamMC->hMetadataPMC.bAttackPresent = 1; } } #endif if ( hParamMC->hMetadataPMC.bAttackPresent ) { /* combine bands */ Loading Loading @@ -883,6 +959,7 @@ static void ivas_param_mc_param_est_enc( band_step = 2; } /* map complex covariances to real values */ for ( cur_param_band = 0; cur_param_band < hParamMC->max_param_band_abs_cov; cur_param_band += band_step ) { Loading Loading @@ -1289,7 +1366,15 @@ static void ivas_param_mc_quantize_ilds( ref_ener += Cx[ref_channel_idx][ref_channel_idx]; } ILD[k] = 10.0f * log10f( ( Nrg[h_ild_mapping->ild_index[k]] + EPSILON ) / ( hParamMC->hMetadataPMC.ild_factors[k] * ref_ener + EPSILON ) ); #ifdef FIX_580_PARAMMC_ENER_BURSTS hParamMC->prev_ilds[freq_idx][k] = ILD[k]; if ( hParamMC->hMetadataPMC.bAttackPresent && ( ( freq_idx + 1 ) < hParamMC->hMetadataPMC.nbands_coded ) ) { hParamMC->prev_ilds[freq_idx + 1][k] = ILD[k]; } #endif } /* quantize parameters */ ivas_param_mc_parameter_quantizer( ILD, num_ilds_to_code, hParamMC->hMetadataPMC.ild_coding.quantizer_size, hParamMC->hMetadataPMC.ild_coding.quantizer, ILD_idx, ILD_q ); Loading
lib_enc/ivas_rom_enc.c +8 −0 Original line number Diff line number Diff line Loading @@ -837,5 +837,13 @@ const HUFF_TABLE huff_beta_table[2] = const int16_t mc_paramupmix_fb_remix_order[4] = {0, 1, 2, 3}; #ifdef FIX_580_PARAMMC_ENER_BURSTS /*----------------------------------------------------------------------------------* * ParamMC ROM tables *----------------------------------------------------------------------------------*/ const float param_mc_ild_diff_threshold[20] = { 8.0f, 8.0f, 10.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f }; #endif /* clang-format on */