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 +4 −3 Original line number Diff line number Diff line Loading @@ -158,7 +158,8 @@ #define FIX_578_PARAMMC_ILD_BS /* FhG: Issue 578: transmitt also center ILD in band 0 when LFE is active in 3TC ParamMC */ #define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ #define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #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_dec/dec_tcx.c +65 −0 Original line number Diff line number Diff line Loading @@ -377,7 +377,11 @@ void IMDCT( TCX_MDCT_Inverse( x + w * L_spec_TCX5, win, L_ola, L_win - L_ola, L_ola, st->element_mode ); } #ifndef FIX_575_LOW_OVERLAP_PLC_RECOVERY tcx_windowing_synthesis_current_frame( win, tcx_aldo_window_2, tcx_mdct_window_half, tcx_mdct_window_minimum, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir, hTcxDec->old_syn_Overl, syn_Overl_TDAC, st->old_Aq_12_8, tcx_mdct_window_trans, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core_bfi, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : st->last_is_cng, fullbandScale ); #else tcx_windowing_synthesis_current_frame( win, tcx_aldo_window_2, tcx_mdct_window_half, tcx_mdct_window_minimum, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir, hTcxDec->old_syn_Overl, syn_Overl_TDAC, st->old_Aq_12_8, tcx_mdct_window_trans, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : st->last_is_cng, fullbandScale ); #endif if ( w > 0 ) { Loading @@ -393,6 +397,14 @@ void IMDCT( /* To assure that no garbage values are passed to overlap */ set_zero( xn_buf + L_frame + tcx_offset + ( L_ola >> 1 ), overlap - tcx_offset - ( L_ola >> 1 ) ); #ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->prev_bfi && frame_cnt == 0 && st->last_core != st->last_core_bfi && st->last_core_bfi == ACELP_CORE ) { tcx_windowing_synthesis_past_frame( old_syn_overl, tcx_aldo_window_1_trunc, tcx_mdct_window_half, tcx_mdct_window_minimum, overlap, tcx_mdct_window_half_length, tcx_mdct_window_min_length, hTcxCfg->tcx_last_overlap_mode ); v_add( xn_buf, old_syn_overl, xn_buf, overlap ); } #endif } else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) ) Loading Loading @@ -1240,28 +1252,81 @@ void decoder_tcx_noisefilling( if ( ( frame_cnt == 0 ) && ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && ( st->tcxonly ) && ( !st->tonal_mdct_plc_active ) && ( st->nbLostCmpt == 1 ) && ( hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) && ( hTcxCfg->tcx_curr_overlap_mode != FULL_OVERLAP ) ) { E_2ndlast = E_last = EPSILON; #ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) { E_2ndlast += st->hTonalMDCTConc->lastBlockData.spectralData[i] * st->hTonalMDCTConc->lastBlockData.spectralData[i]; E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } else { for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { E_2ndlast += st->hTonalMDCTConc->lastBlockData.spectralData[i] * st->hTonalMDCTConc->lastBlockData.spectralData[i]; E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } #else for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { E_2ndlast += st->hTonalMDCTConc->lastBlockData.spectralData[i] * st->hTonalMDCTConc->lastBlockData.spectralData[i]; E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } #endif tmp2 = E_2ndlast / E_last; /* replace higher energy TCX5 frame by lower one to avoid energy fluctuation */ if ( tmp2 > 2 ) { #ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } else { for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } #else for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } #endif } else if ( tmp2 < 0.5 ) { #ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; } } else { for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; } } #else for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; } #endif } } noiseTiltFactor = 1.0f; 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 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 +4 −3 Original line number Diff line number Diff line Loading @@ -158,7 +158,8 @@ #define FIX_578_PARAMMC_ILD_BS /* FhG: Issue 578: transmitt also center ILD in band 0 when LFE is active in 3TC ParamMC */ #define FIX_UNCLR_ISSUE /* VoiceAge: issue 574: Fix UNCLR mis-classifications in noisy speech stereo */ #define FIX_TCX_LOWRATE_LIMITATION /* VA: issue 577: TCX bitrate limitation only when DEBUGGING is active */ #define FIX_575_LOW_OVERLAP_PLC_RECOVERY /* FhG: Issue 575 fix for PLC and transistion to TCX5*/ #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_dec/dec_tcx.c +65 −0 Original line number Diff line number Diff line Loading @@ -377,7 +377,11 @@ void IMDCT( TCX_MDCT_Inverse( x + w * L_spec_TCX5, win, L_ola, L_win - L_ola, L_ola, st->element_mode ); } #ifndef FIX_575_LOW_OVERLAP_PLC_RECOVERY tcx_windowing_synthesis_current_frame( win, tcx_aldo_window_2, tcx_mdct_window_half, tcx_mdct_window_minimum, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir, hTcxDec->old_syn_Overl, syn_Overl_TDAC, st->old_Aq_12_8, tcx_mdct_window_trans, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core_bfi, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : st->last_is_cng, fullbandScale ); #else tcx_windowing_synthesis_current_frame( win, tcx_aldo_window_2, tcx_mdct_window_half, tcx_mdct_window_minimum, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir, hTcxDec->old_syn_Overl, syn_Overl_TDAC, st->old_Aq_12_8, tcx_mdct_window_trans, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : st->last_is_cng, fullbandScale ); #endif if ( w > 0 ) { Loading @@ -393,6 +397,14 @@ void IMDCT( /* To assure that no garbage values are passed to overlap */ set_zero( xn_buf + L_frame + tcx_offset + ( L_ola >> 1 ), overlap - tcx_offset - ( L_ola >> 1 ) ); #ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->prev_bfi && frame_cnt == 0 && st->last_core != st->last_core_bfi && st->last_core_bfi == ACELP_CORE ) { tcx_windowing_synthesis_past_frame( old_syn_overl, tcx_aldo_window_1_trunc, tcx_mdct_window_half, tcx_mdct_window_minimum, overlap, tcx_mdct_window_half_length, tcx_mdct_window_min_length, hTcxCfg->tcx_last_overlap_mode ); v_add( xn_buf, old_syn_overl, xn_buf, overlap ); } #endif } else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) ) Loading Loading @@ -1240,28 +1252,81 @@ void decoder_tcx_noisefilling( if ( ( frame_cnt == 0 ) && ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && ( st->tcxonly ) && ( !st->tonal_mdct_plc_active ) && ( st->nbLostCmpt == 1 ) && ( hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) && ( hTcxCfg->tcx_curr_overlap_mode != FULL_OVERLAP ) ) { E_2ndlast = E_last = EPSILON; #ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) { E_2ndlast += st->hTonalMDCTConc->lastBlockData.spectralData[i] * st->hTonalMDCTConc->lastBlockData.spectralData[i]; E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } else { for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { E_2ndlast += st->hTonalMDCTConc->lastBlockData.spectralData[i] * st->hTonalMDCTConc->lastBlockData.spectralData[i]; E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } #else for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { E_2ndlast += st->hTonalMDCTConc->lastBlockData.spectralData[i] * st->hTonalMDCTConc->lastBlockData.spectralData[i]; E_last += st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] * st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } #endif tmp2 = E_2ndlast / E_last; /* replace higher energy TCX5 frame by lower one to avoid energy fluctuation */ if ( tmp2 > 2 ) { #ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } else { for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } } #else for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i] = st->hTonalMDCTConc->lastBlockData.spectralData[i + 1]; } #endif } else if ( tmp2 < 0.5 ) { #ifdef FIX_575_LOW_OVERLAP_PLC_RECOVERY if ( st->element_mode > EVS_MONO ) { for ( i = 0; i < L_frameTCX; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; } } else { for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; } } #else for ( i = 0; i < infoIGFStartLine; i = i + 2 ) { st->hTonalMDCTConc->lastBlockData.spectralData[i + 1] = st->hTonalMDCTConc->lastBlockData.spectralData[i]; } #endif } } noiseTiltFactor = 1.0f; 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