Loading lib_enc/ivas_stereo_td_analysis.c +42 −3 Original line number Diff line number Diff line Loading @@ -587,7 +587,7 @@ static void Get_LR_rms( static int16_t Get_dt_lt_ener( CPE_ENC_HANDLE hCPE, const int16_t IsSideMono, const int16_t IsSideMono, /* 0 = normal mode, 1 = SideMono (SM) mode*/ const int16_t input_frame, const int16_t tdm_last_SM_flag, const float rms_L, Loading Loading @@ -647,7 +647,11 @@ static int16_t Get_dt_lt_ener( *----------------------------------------------------------------*/ Get_corr_n( Left_in, Right_in, corr_LM, corr_RM, input_frame, &es_em, IsSideMono ); /*----------------------------------------------------------------* * Save the correlation/energy difference for signal classification * Smooth long term side to mono energy difference and save if for * signal classification *----------------------------------------------------------------*/ hCPE->hStereoClassif->xtalk_fv[E_diff_corrLM_corrRM] = *corr_LM - *corr_RM; if ( sts[0]->hVAD->hangover_cnt != 0 ) Loading @@ -660,13 +664,48 @@ static int16_t Get_dt_lt_ener( } hCPE->hStereoClassif->xtalk_fv[E_tdm_LT_es_em] = *tdm_LT_es_em; /*----------------------------------------------------------------* * First steps to verify if the signal could be out of phase * (more information in the side channel than in the mono) * The minimum if the auto-correlation of left and right channel * has some correlation but are not highly correlated ]0.85,0.92[ * the long term energy difference between side and mono is > 2.0 or * the the instantaneous energy difference between side and mono is > 2.5 * and the VAD hangover of the primary channel is <= 1 * and the VAD hangover of the secondary channel is <= 3 * and the input signal is considered having some correlation (normal TD) * When all these conditions are met, a first temporary SM flag allowing * switching to side/mono coding mode is set to 1 (tmp_SM_flag) *----------------------------------------------------------------*/ tmp_SM_flag = 0; if ( min( sts[0]->old_corr, sts[1]->old_corr ) < 0.85f && max( sts[0]->old_corr, sts[1]->old_corr < 0.92f ) && ( *tdm_LT_es_em > 2.0f || es_em > 2.5f ) && ( sts[0]->hVAD->hangover_cnt <= 1 && sts[1]->hVAD->hangover_cnt <= 3 && sts[0]->tdm_LRTD_flag == 0 ) ) { tmp_SM_flag = 1; } /*----------------------------------------------------------------* * In normal mode (mono/side) * tdm_NOOP_SM_flag_loc is updated with the value of * tdm_last_SM_flag (tdm_SM_flag_loc) * Then * if the temporary flag set above is different from the * previous SM state (tdm_SM_flag_loc), * then * if the hysteresis is >= 2 and the temporary SM flag * has been set to 1 above and the pitch stability of the primary * or the secondary channel is larger than 64 * then, * the flag allowing preliminary switching to SM mode is set to 1 * and the hysteriesis is reset to 0 * else if the hysteresis is >= 20 and the temporary SM flag * has been set to 0 above and the pitch stability of the primary * or the secondary channel is larger than 64 and the long * term energy difference between side and mono is <=0.5 * or the instantaneous energy difference between side and mono is <-10 * then, * the flag allowing preliminary switching to SM mode is set to 0 * and the hysteriesis is reset to 0 *----------------------------------------------------------------*/ if ( IsSideMono == 0 ) { *tdm_NOOP_SM_flag_loc = tdm_SM_flag_loc; Loading Loading
lib_enc/ivas_stereo_td_analysis.c +42 −3 Original line number Diff line number Diff line Loading @@ -587,7 +587,7 @@ static void Get_LR_rms( static int16_t Get_dt_lt_ener( CPE_ENC_HANDLE hCPE, const int16_t IsSideMono, const int16_t IsSideMono, /* 0 = normal mode, 1 = SideMono (SM) mode*/ const int16_t input_frame, const int16_t tdm_last_SM_flag, const float rms_L, Loading Loading @@ -647,7 +647,11 @@ static int16_t Get_dt_lt_ener( *----------------------------------------------------------------*/ Get_corr_n( Left_in, Right_in, corr_LM, corr_RM, input_frame, &es_em, IsSideMono ); /*----------------------------------------------------------------* * Save the correlation/energy difference for signal classification * Smooth long term side to mono energy difference and save if for * signal classification *----------------------------------------------------------------*/ hCPE->hStereoClassif->xtalk_fv[E_diff_corrLM_corrRM] = *corr_LM - *corr_RM; if ( sts[0]->hVAD->hangover_cnt != 0 ) Loading @@ -660,13 +664,48 @@ static int16_t Get_dt_lt_ener( } hCPE->hStereoClassif->xtalk_fv[E_tdm_LT_es_em] = *tdm_LT_es_em; /*----------------------------------------------------------------* * First steps to verify if the signal could be out of phase * (more information in the side channel than in the mono) * The minimum if the auto-correlation of left and right channel * has some correlation but are not highly correlated ]0.85,0.92[ * the long term energy difference between side and mono is > 2.0 or * the the instantaneous energy difference between side and mono is > 2.5 * and the VAD hangover of the primary channel is <= 1 * and the VAD hangover of the secondary channel is <= 3 * and the input signal is considered having some correlation (normal TD) * When all these conditions are met, a first temporary SM flag allowing * switching to side/mono coding mode is set to 1 (tmp_SM_flag) *----------------------------------------------------------------*/ tmp_SM_flag = 0; if ( min( sts[0]->old_corr, sts[1]->old_corr ) < 0.85f && max( sts[0]->old_corr, sts[1]->old_corr < 0.92f ) && ( *tdm_LT_es_em > 2.0f || es_em > 2.5f ) && ( sts[0]->hVAD->hangover_cnt <= 1 && sts[1]->hVAD->hangover_cnt <= 3 && sts[0]->tdm_LRTD_flag == 0 ) ) { tmp_SM_flag = 1; } /*----------------------------------------------------------------* * In normal mode (mono/side) * tdm_NOOP_SM_flag_loc is updated with the value of * tdm_last_SM_flag (tdm_SM_flag_loc) * Then * if the temporary flag set above is different from the * previous SM state (tdm_SM_flag_loc), * then * if the hysteresis is >= 2 and the temporary SM flag * has been set to 1 above and the pitch stability of the primary * or the secondary channel is larger than 64 * then, * the flag allowing preliminary switching to SM mode is set to 1 * and the hysteriesis is reset to 0 * else if the hysteresis is >= 20 and the temporary SM flag * has been set to 0 above and the pitch stability of the primary * or the secondary channel is larger than 64 and the long * term energy difference between side and mono is <=0.5 * or the instantaneous energy difference between side and mono is <-10 * then, * the flag allowing preliminary switching to SM mode is set to 0 * and the hysteriesis is reset to 0 *----------------------------------------------------------------*/ if ( IsSideMono == 0 ) { *tdm_NOOP_SM_flag_loc = tdm_SM_flag_loc; Loading