From abbafbab372ea2d0da82e79801ef12894114d1d9 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Thu, 19 Dec 2024 17:26:28 +0100 Subject: [PATCH 01/10] corrected HQ_MDCT PHECU-PLC beta_mute final muting after 200ms for IVAS operation, EVS_MONO operation kept BE --- lib_com/options.h | 1 + lib_dec/FEC_HQ_phase_ecu.c | 62 +++++++++++++++++++------- scripts/testv/FEC_burstl_1_to_20.bin | 3 ++ scripts/testv/PL_perc30_itut_bfer.g192 | 1 + scripts/testv/ep_stats_bin_files.m | 37 +++++++++++++++ 5 files changed, 87 insertions(+), 17 deletions(-) create mode 100644 scripts/testv/FEC_burstl_1_to_20.bin create mode 100644 scripts/testv/PL_perc30_itut_bfer.g192 create mode 100644 scripts/testv/ep_stats_bin_files.m diff --git a/lib_com/options.h b/lib_com/options.h index b26b2d81c5..9f31f1e4d4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,6 +172,7 @@ #define NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR /* Ericsson: Issue 1176, fix in TDREND_firfilt for subframes shorter than the filter length */ #define NONBE_1240_FIX_CORE_SELECTION_ISM_SW /* VA: issue 1240: Remove the forcing of the TCX core in ISM when switching from a high bitarte to a low one */ +#define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 425ff21fe9..652a884a52 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -263,10 +263,13 @@ static void trans_ana( const int16_t time_offs, /* i : Time offset */ const float est_mus_content, /* i : 0.0=speech_like ... 1.0=Music (==st->env_stab ) */ const int16_t last_fec, /* i : signal that previous frame was concealed with fec_alg*/ - float *alpha, /* o : Magnitude modification factors for fade to average */ - float *beta, /* o : Magnitude modification factors for fade to average */ - float *beta_mute, /* o : Factor for long-term mute */ - float Xavg[LGW_MAX] /* o : Frequency group average gain to fade to */ +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING + const int16_t element_mode, /* i : element_mode req to handle EVS_MONO specific BE path */ +#endif + float *alpha, /* o : Magnitude modification factors for fade to average */ + float *beta, /* o : Magnitude modification factors for fade to average */ + float *beta_mute, /* o : Factor for long-term mute */ + float Xavg[LGW_MAX] /* o : Frequency group average gain to fade to */ ) { const float *w_hamm; @@ -288,9 +291,9 @@ static void trans_ana( *ph_dith = 0.0f; /* softly shift attenuation just a bit later for estimated "stable" music_content */ - burst_phdith_thresh = BURST_PHDITH_THRESH + (int16_t) ( est_mus_content * 1.0f + 0.5f ); - burst_att_thresh = BURST_ATT_THRESH + (int16_t) ( est_mus_content * 1.0f + 0.5f ); - att_per_frame = (float) ( ATT_PER_FRAME - (int16_t) ( est_mus_content * 1.0f + 0.5f ) ); /* only slighty less att for music */ + burst_phdith_thresh = BURST_PHDITH_THRESH + ( int16_t )( est_mus_content * 1.0f + 0.5f ); + burst_att_thresh = BURST_ATT_THRESH + ( int16_t )( est_mus_content * 1.0f + 0.5f ); + att_per_frame = (float) ( ATT_PER_FRAME - ( int16_t )( est_mus_content * 1.0f + 0.5f ) ); /* only slighty less att for music */ att_per_frame *= 0.1f; if ( burst_len > burst_phdith_thresh ) @@ -416,10 +419,27 @@ static void trans_ana( { mag_chg[k] = 0; } +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING + if ( element_mode != EVS_MONO ) + { + if ( k == 0 && burst_len > BETA_MUTE_THR ) /* beta_mute final long term attenuation adjusted only once per frame in the first sub-band */ + { + *beta_mute *= BETA_MUTE_FAC; + } + } + else + { + if ( burst_len > BETA_MUTE_THR ) /* legacy incorrect EVS_MONO operation, kept for BE, to be updated after EVS CR */ + { + *beta_mute *= BETA_MUTE_FAC; + } + } +#else if ( burst_len > BETA_MUTE_THR ) { *beta_mute *= BETA_MUTE_FAC; } +#endif alpha[k] = mag_chg[k]; beta[k] = (float) ( sqrt( 1.0f - SQR( alpha[k] ) ) * *beta_mute ); if ( k >= LGW32k - 1 ) @@ -974,7 +994,7 @@ static void subst_spec( float beta_local; sincos = sincos_t_ext + 128; - Lprot = (int16_t) ( L_PROT32k * output_frame / 640 ); + Lprot = ( int16_t )( L_PROT32k * output_frame / 640 ); Lprot_1 = 1.0f / Lprot; Lecu = output_frame * 2; @@ -1092,7 +1112,7 @@ static void subst_spec( Xph = corr_phase[m]; /* extract fractional phase integer index in the range [0...1023] */ - Xph_short = (int16_t) ( 0x000003ff & (int32_t) ( ( Xph * 512 ) / EVS_PI ) ); + Xph_short = ( int16_t )( 0x000003ff & ( int32_t )( ( Xph * 512 ) / EVS_PI ) ); if ( Xph_short >= 512 ) @@ -1138,7 +1158,7 @@ static void subst_spec( mag_chg_local *= 0.5f + ( 1.0f - ( 1.0f / PHASE_DITH ) * ph_dith ) * 0.5f; } - Xph_short = (int16_t) ( ( (int32_t) ( ( Xph * 512 ) / EVS_PI ) ) & 0x000003ff ); + Xph_short = ( int16_t )( ( ( int32_t )( ( Xph * 512 ) / EVS_PI ) ) & 0x000003ff ); if ( Xph_short >= 512 ) { @@ -1355,12 +1375,12 @@ static void rec_wtda( else { /* Smoothen onset of ECU frame */ - xf_len = (int16_t) ( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ) - ( output_frame - Lprot / 2 ); + xf_len = ( int16_t )( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ) - ( output_frame - Lprot / 2 ); p_ecu = xsubst_ + 2 * output_frame - Lprot + timesh; tbl_delta = 64.f / xf_len; /* 64 samples = 1/4 cycle in sincos_t */ for ( i = 0; i < xf_len; i++, p_ecu++ ) { - g = sincos_t[( (int16_t) ( i * tbl_delta ) )]; + g = sincos_t[( ( int16_t )( i * tbl_delta ) )]; g *= g; *p_ecu = g * ( *p_ecu ); } @@ -1532,7 +1552,7 @@ static void fec_ecu_pitch( /* Resampling to work at 8Khz */ fir_dwn( prevsynth, Asr_LP, prevsynth_LP, 2 * L, filt_size, *decimatefator ); /* resampling without delay */ - Lon20 = (int16_t) ( ( L / 20 ) / *decimatefator ); + Lon20 = ( int16_t )( ( L / 20 ) / *decimatefator ); /* Correlation analysis */ *min_corr = 0; @@ -1953,7 +1973,7 @@ static void fec_noise_filling( kk = 0; } - Rnd_N_noise = (int16_t) ( (float) N_noise * tmp ); + Rnd_N_noise = ( int16_t )( (float) N_noise * tmp ); sinq( (const float) EVS_PI / ( 2.0f * (float) Rnd_N_noise ), (const float) EVS_PI / ( 4.0f * (float) Rnd_N_noise ), (const int16_t) Rnd_N_noise, SS ); @@ -2031,7 +2051,7 @@ static void fec_alg( fec_noise_filling( prevsynth, synthesis, output_frame, N * decimatefactor, HqVoicing, gapsynth, ni_seed_forfec, element_mode, old_out ); - n = (int16_t) ( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ); + n = ( int16_t )( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ); wtda( synthesis + ( output_frame - n ), ecu_rec, NULL, ALDO_WINDOW, ALDO_WINDOW, output_frame ); return; @@ -2098,7 +2118,11 @@ static void hq_phase_ecu( *time_offs = 0; } - trans_ana( prevsynth + 2 * output_frame - Lprot - *time_offs + ph_ecu_lookahead, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, *last_fec, alpha, beta, beta_mute, Xavg ); + trans_ana( prevsynth + 2 * output_frame - Lprot - *time_offs + ph_ecu_lookahead, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, *last_fec, +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING + element_mode, +#endif + alpha, beta, beta_mute, Xavg ); spec_ana( prevsynth + 2 * output_frame - Lprot - *time_offs + ph_ecu_lookahead, plocs, plocsi, num_p, X_sav, output_frame, bwidth, element_mode, &noise_fac, pcorr ); if ( prev_bfi && *last_fec ) @@ -2115,7 +2139,11 @@ static void hq_phase_ecu( *time_offs = MAX16B; /* continued muting will ensure that the now fixed seeds are not creating tones */ } - trans_ana( prevsynth + 2 * output_frame - Lprot, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, 0, alpha, beta, beta_mute, Xavg ); /* 1.0 stable-music, 0.0 speech-like */ + trans_ana( prevsynth + 2 * output_frame - Lprot, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, 0, +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING + element_mode, +#endif + alpha, beta, beta_mute, Xavg ); /* 1.0 stable-music, 0.0 speech-like */ } mvr2r( X_sav, X, Lprot ); diff --git a/scripts/testv/FEC_burstl_1_to_20.bin b/scripts/testv/FEC_burstl_1_to_20.bin new file mode 100644 index 0000000000..da46bd5531 --- /dev/null +++ b/scripts/testv/FEC_burstl_1_to_20.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce4900a50bf68e4c8c856d8e88aa233d10e5c1897957d0ef315487134baf3614 +size 1100 diff --git a/scripts/testv/PL_perc30_itut_bfer.g192 b/scripts/testv/PL_perc30_itut_bfer.g192 new file mode 100644 index 0000000000..f287a231cb --- /dev/null +++ b/scripts/testv/PL_perc30_itut_bfer.g192 @@ -0,0 +1 @@ +!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k k k k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k k k k k k k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k k!k!k!k!k!k k k k!k!k k k k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k k k k k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k!k k k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k k k!k k k k!k!k!k k k k k!k!k!k!k!k k k!k k k k k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k k k k!k k k k k!k!k!k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k!k k k k!k!k!k k k k k k k k k k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k k k k k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k k k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k!k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k k k k!k!k!k k k k k!k!k!k!k k k k k k!k!k!k!k!k!k!k k k!k k k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k k k k k k k k k!k k k k k k k k k k k!k k k k k k!k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k k k!k!k!k!k!k!k!k k k k k k k k k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k k!k!k!k k k k k k k!k!k!k!k!k!k k k k k k k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k k k k!k!k k k!k k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k k k k k k k k k k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k k k k k k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k k!k!k!k!k!k!k!k!k!k k k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k k!k!k!k!k!k!k k k k k k!k!k k k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k k k!k k k k k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k k!k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k k k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k k k!k!k!k!k!k k k k k k k!k!k!k!k k!k!k!k k k k k k!k!k!k!k!k k k!k!k!k!k k k k k!k k k!k k!k!k!k!k!k k!k k k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k k k k k k k k k!k!k k k k!k!k k k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k k k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k k k k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k!k k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k k k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k k k k k k k!k!k k k k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k k k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k k k k k k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k k k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k k k k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k k k k!k k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k k k k k k!k!k!k!k k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k k k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k k!k!k k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k k k k!k!k!k k k k k k k k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k k!k!k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k k k k k k!k!k!k k k k k k!k!k k k k k k k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k!k!k k k k k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k!k k k k k k k k k!k!k!k!k!k k k k!k!k!k!k!k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k!k!k k k k k k k!k!k!k!k!k!k!k k k k k k k!k k k k k k!k k k k!k!k!k k k!k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k k k k k k k k k k!k!k k k k k k k k k!k!k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k!k!k!k k k k!k!k!k!k!k k k k!k!k!k!k k k k k k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k!k!k!k!k!k!k!k!k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k!k!k k k k k k!k!k!k!k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k!k!k!k!k!k k k k!k!k!k!k!k k k k k k k k k!k!k!k!k!k!k k k k k k k k k!k!k!k!k k!k!k!k k k k k k k!k!k!k!k!k!k!k!k!k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k \ No newline at end of file diff --git a/scripts/testv/ep_stats_bin_files.m b/scripts/testv/ep_stats_bin_files.m new file mode 100644 index 0000000000..376a0d6a67 --- /dev/null +++ b/scripts/testv/ep_stats_bin_files.m @@ -0,0 +1,37 @@ +function bl=ep_stats_bin_files(name) +%function bl=eps_stats_bin_files(name) +% +% Check burst length and total fer of .bin files +% format PC/Linux signed 16 bit words, int16_t value 1=BAD, value 0 = GOOD +% + +if nargin <1 + % name='FEC_burstl_1_to_20' + % name='FEC_burstl_1_to_30' + % name='FEC_burstl_1_to_65' + name='./FEC_burstl_1_to_65flip' + name= [ name, '.bin']; + % evaluate + % or find first file in folder +end + +name2 = strrep(name,'_','\_'); +[fid, msg] = fopen(name,'r','n') ; +e=fread(fid,inf,'int16'); +fclose(fid); + +a=find(diff(e)==1); +b=find(diff(e)==-1); +bl=b-a; + +fer_pct = 100*sum(e==1)/length(e); + +h=histogram(bl,0.5:max(bl+.5),'normalization','probability'); +title(sprintf("%s, Total FER=%.2f %%, frames=%d, Av. burstlen=%.2f",name2, fer_pct, length(e),mean(bl) )) +set(gca,'xtick',1:max(bl)) +ylabel('probablility'); +xlabel('burst length') +grid + + +return -- GitLab From 13a94d66a3016423d69c38cd285baade0b64da37 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Thu, 19 Dec 2024 17:40:18 +0100 Subject: [PATCH 02/10] corrected formatting --- lib_dec/FEC_HQ_phase_ecu.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 652a884a52..45562a8c77 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -264,7 +264,7 @@ static void trans_ana( const float est_mus_content, /* i : 0.0=speech_like ... 1.0=Music (==st->env_stab ) */ const int16_t last_fec, /* i : signal that previous frame was concealed with fec_alg*/ #ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING - const int16_t element_mode, /* i : element_mode req to handle EVS_MONO specific BE path */ + const int16_t element_mode, /* i : element_mode req to handle EVS_MONO specific BE path */ #endif float *alpha, /* o : Magnitude modification factors for fade to average */ float *beta, /* o : Magnitude modification factors for fade to average */ @@ -291,9 +291,9 @@ static void trans_ana( *ph_dith = 0.0f; /* softly shift attenuation just a bit later for estimated "stable" music_content */ - burst_phdith_thresh = BURST_PHDITH_THRESH + ( int16_t )( est_mus_content * 1.0f + 0.5f ); - burst_att_thresh = BURST_ATT_THRESH + ( int16_t )( est_mus_content * 1.0f + 0.5f ); - att_per_frame = (float) ( ATT_PER_FRAME - ( int16_t )( est_mus_content * 1.0f + 0.5f ) ); /* only slighty less att for music */ + burst_phdith_thresh = BURST_PHDITH_THRESH + (int16_t) ( est_mus_content * 1.0f + 0.5f ); + burst_att_thresh = BURST_ATT_THRESH + (int16_t) ( est_mus_content * 1.0f + 0.5f ); + att_per_frame = (float) ( ATT_PER_FRAME - (int16_t) ( est_mus_content * 1.0f + 0.5f ) ); /* only slighty less att for music */ att_per_frame *= 0.1f; if ( burst_len > burst_phdith_thresh ) @@ -994,7 +994,7 @@ static void subst_spec( float beta_local; sincos = sincos_t_ext + 128; - Lprot = ( int16_t )( L_PROT32k * output_frame / 640 ); + Lprot = (int16_t) ( L_PROT32k * output_frame / 640 ); Lprot_1 = 1.0f / Lprot; Lecu = output_frame * 2; @@ -1112,7 +1112,7 @@ static void subst_spec( Xph = corr_phase[m]; /* extract fractional phase integer index in the range [0...1023] */ - Xph_short = ( int16_t )( 0x000003ff & ( int32_t )( ( Xph * 512 ) / EVS_PI ) ); + Xph_short = (int16_t) ( 0x000003ff & (int32_t) ( ( Xph * 512 ) / EVS_PI ) ); if ( Xph_short >= 512 ) @@ -1158,7 +1158,7 @@ static void subst_spec( mag_chg_local *= 0.5f + ( 1.0f - ( 1.0f / PHASE_DITH ) * ph_dith ) * 0.5f; } - Xph_short = ( int16_t )( ( ( int32_t )( ( Xph * 512 ) / EVS_PI ) ) & 0x000003ff ); + Xph_short = (int16_t) ( ( (int32_t) ( ( Xph * 512 ) / EVS_PI ) ) & 0x000003ff ); if ( Xph_short >= 512 ) { @@ -1375,12 +1375,12 @@ static void rec_wtda( else { /* Smoothen onset of ECU frame */ - xf_len = ( int16_t )( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ) - ( output_frame - Lprot / 2 ); + xf_len = (int16_t) ( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ) - ( output_frame - Lprot / 2 ); p_ecu = xsubst_ + 2 * output_frame - Lprot + timesh; tbl_delta = 64.f / xf_len; /* 64 samples = 1/4 cycle in sincos_t */ for ( i = 0; i < xf_len; i++, p_ecu++ ) { - g = sincos_t[( ( int16_t )( i * tbl_delta ) )]; + g = sincos_t[( (int16_t) ( i * tbl_delta ) )]; g *= g; *p_ecu = g * ( *p_ecu ); } @@ -1552,7 +1552,7 @@ static void fec_ecu_pitch( /* Resampling to work at 8Khz */ fir_dwn( prevsynth, Asr_LP, prevsynth_LP, 2 * L, filt_size, *decimatefator ); /* resampling without delay */ - Lon20 = ( int16_t )( ( L / 20 ) / *decimatefator ); + Lon20 = (int16_t) ( ( L / 20 ) / *decimatefator ); /* Correlation analysis */ *min_corr = 0; @@ -1973,7 +1973,7 @@ static void fec_noise_filling( kk = 0; } - Rnd_N_noise = ( int16_t )( (float) N_noise * tmp ); + Rnd_N_noise = (int16_t) ( (float) N_noise * tmp ); sinq( (const float) EVS_PI / ( 2.0f * (float) Rnd_N_noise ), (const float) EVS_PI / ( 4.0f * (float) Rnd_N_noise ), (const int16_t) Rnd_N_noise, SS ); @@ -2051,7 +2051,7 @@ static void fec_alg( fec_noise_filling( prevsynth, synthesis, output_frame, N * decimatefactor, HqVoicing, gapsynth, ni_seed_forfec, element_mode, old_out ); - n = ( int16_t )( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ); + n = (int16_t) ( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ); wtda( synthesis + ( output_frame - n ), ecu_rec, NULL, ALDO_WINDOW, ALDO_WINDOW, output_frame ); return; -- GitLab From e5d93c90abb7399d21b852c36d156bc4a4fad525 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Mon, 23 Dec 2024 17:04:05 +0100 Subject: [PATCH 03/10] enabled HQ -FORCE MUSIC simuations at 32kbps and 64 kbps with DEBUGGING On in MSVC --- lib_com/options.h | 6 +++++- lib_enc/mdct_classifier.c | 7 +++++++ lib_enc/mdct_selector.c | 6 ++++++ lib_enc/pre_proc.c | 2 +- lib_enc/speech_music_classif.c | 5 +++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index cb05d5efec..99532e6825 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -48,7 +48,8 @@ /* ################### Start DEBUGGING switches ########################### */ #ifndef RELEASE -/*#define DEBUGGING*/ /* Activate debugging part of the code */ +/* #define DEBUGGING */ /* Activate debugging part of the code */ + #endif /*#define WMOPS*/ /* Activate complexity and memory counters */ /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ @@ -176,6 +177,9 @@ #define NONBE_1211_DTX_BR_SWITCHING /* VA: issue 1211: fix crash in MASA DTX bitrate switching */ #define NONBE_1217_INIT_OBJ_EDIT /* VA: issue 1217: do object editing only when objects metadata is available */ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ +# ifdef DEBUGGING +# define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG /* Ericsson FORCE HQ music mode at 32 kbps for PLC simulations, -force HQ is not working at 32 kbps */ +# endif /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/mdct_classifier.c b/lib_enc/mdct_classifier.c index a01482b47f..38b1262857 100644 --- a/lib_enc/mdct_classifier.c +++ b/lib_enc/mdct_classifier.c @@ -347,6 +347,13 @@ int16_t mdct_classifier( hTcxEnc->last_gain1 = gain1; hTcxEnc->last_gain2 = gain2; + +#ifdef DEBUGGING +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG + clas_final = HQ_CORE; +#endif +#endif + return clas_final; } diff --git a/lib_enc/mdct_selector.c b/lib_enc/mdct_selector.c index 0c2bd3a0a5..fe5e9dec2f 100644 --- a/lib_enc/mdct_selector.c +++ b/lib_enc/mdct_selector.c @@ -255,6 +255,12 @@ void MDCT_selector( st->core = TCX_20_CORE; } +#ifdef DEBUGGING +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG + st->core = HQ_CORE; +#endif +#endif + /* Update memories */ if ( hi_sparse <= 0 ) diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 7db0c9c433..7c3080fe83 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -606,7 +606,7 @@ void pre_proc( { SetModeIndex( st, st->last_total_brate, EVS_MONO, 0 ); st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, 0 ); - st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); + st->L_frame = ( int16_t )( st->sr_core / FRAMES_PER_SEC ); st->encoderLookahead_enc = NS2SA( st->sr_core, ACELP_LOOK_NS ); st->encoderPastSamples_enc = ( st->L_frame * 9 ) >> 4; diff --git a/lib_enc/speech_music_classif.c b/lib_enc/speech_music_classif.c index 3d17233c40..c5f2dec2db 100644 --- a/lib_enc/speech_music_classif.c +++ b/lib_enc/speech_music_classif.c @@ -352,6 +352,11 @@ void speech_music_classif( st->sp_aud_decision0 = st->sp_aud_decision1; } +#ifdef FORCE_AUDIO_DECISION + st->sp_aud_decision1 = 1; + sp_aud_decision +#endif + return; } -- GitLab From 49fdf5cc40b9d40fb5485545dc35f09af731f5e9 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Mon, 23 Dec 2024 17:30:55 +0100 Subject: [PATCH 04/10] added ISM2 simulations to cmd lines to show effect of 1180 bugfix --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 99532e6825..c9fd8d7a1c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -48,7 +48,7 @@ /* ################### Start DEBUGGING switches ########################### */ #ifndef RELEASE -/* #define DEBUGGING */ /* Activate debugging part of the code */ + #define DEBUGGING /* */ /* Activate debugging part of the code */ #endif /*#define WMOPS*/ /* Activate complexity and memory counters */ -- GitLab From 1fd9cae1f3728e97feaf1be7842f116237dcc0a2 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Mon, 30 Dec 2024 17:54:29 +0100 Subject: [PATCH 05/10] added new long fer burst script and fer files for better regression tests of PLC algorithms --- lib_com/options.h | 7 +- scripts/testv/FEC_burstlens_10to20_in30.g192 | 1 + scripts/testv/FEC_burstlens_10to34_in40.g192 | 1 + scripts/testv/ep_stats_bin_files.m | 4 +- scripts/testv/gen_ep_long_bursts.m | 191 +++++++++++++++++++ 5 files changed, 199 insertions(+), 5 deletions(-) create mode 100644 scripts/testv/FEC_burstlens_10to20_in30.g192 create mode 100644 scripts/testv/FEC_burstlens_10to34_in40.g192 create mode 100644 scripts/testv/gen_ep_long_bursts.m diff --git a/lib_com/options.h b/lib_com/options.h index c9fd8d7a1c..af75962705 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -177,9 +177,10 @@ #define NONBE_1211_DTX_BR_SWITCHING /* VA: issue 1211: fix crash in MASA DTX bitrate switching */ #define NONBE_1217_INIT_OBJ_EDIT /* VA: issue 1217: do object editing only when objects metadata is available */ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ -# ifdef DEBUGGING -# define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG /* Ericsson FORCE HQ music mode at 32 kbps for PLC simulations, -force HQ is not working at 32 kbps */ -# endif + +//# ifdef DEBUGGING +//# define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG /* Ericsson FORCE HQ in music mode at 32 kbps for PLC simulations, -force HQ is not working at 32 kbps */ +//# endif /* ##################### End NON-BE switches ########################### */ diff --git a/scripts/testv/FEC_burstlens_10to20_in30.g192 b/scripts/testv/FEC_burstlens_10to20_in30.g192 new file mode 100644 index 0000000000..c74dec59e5 --- /dev/null +++ b/scripts/testv/FEC_burstlens_10to20_in30.g192 @@ -0,0 +1 @@ +!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k \ No newline at end of file diff --git a/scripts/testv/FEC_burstlens_10to34_in40.g192 b/scripts/testv/FEC_burstlens_10to34_in40.g192 new file mode 100644 index 0000000000..8ccc1b9e0b --- /dev/null +++ b/scripts/testv/FEC_burstlens_10to34_in40.g192 @@ -0,0 +1 @@ +!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k!k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k \ No newline at end of file diff --git a/scripts/testv/ep_stats_bin_files.m b/scripts/testv/ep_stats_bin_files.m index 376a0d6a67..0f78eb90e4 100644 --- a/scripts/testv/ep_stats_bin_files.m +++ b/scripts/testv/ep_stats_bin_files.m @@ -7,9 +7,9 @@ function bl=ep_stats_bin_files(name) if nargin <1 % name='FEC_burstl_1_to_20' - % name='FEC_burstl_1_to_30' + name='FEC_burstl_1_to_30' % name='FEC_burstl_1_to_65' - name='./FEC_burstl_1_to_65flip' + % name='./FEC_burstl_1_to_65flip' name= [ name, '.bin']; % evaluate % or find first file in folder diff --git a/scripts/testv/gen_ep_long_bursts.m b/scripts/testv/gen_ep_long_bursts.m new file mode 100644 index 0000000000..dee5626b84 --- /dev/null +++ b/scripts/testv/gen_ep_long_bursts.m @@ -0,0 +1,191 @@ +function pat_ser = gen_ep_long_bursts(l_min, l_max, period_frames, n_periods, file_name_no_ext, seed_in ) +%function gen_ep_long_bursts(l_min, l_max, period_frames, file_name ) +% +% examples: +% gen_ep_long_bursts(10, 35, 40, 25,'FEC_burstlen_10to35in40') +% gen_ep_long_bursts(38, 39, 40, 2,'FEC_burstlen_38to39in40') +% +% generate long burst sequences for regression testing of PLC algorithms +% if n_periods is less than n_burstlens = l_max-lmin+1 , then +% a random selection of burst lengths between l_min and l_max takes place +% but l_min and l_max is always a part of the generated set +% +% first frame in any period of period_frames is always a good frame ! +% +% generates a .bin file and a .g192 FER file +% l_min smallest burst length +% l_max largest burst length : l_max > l_min, l_max < periodframes +% period frames period : period_frames > l_max, period_frames >=2 +% n_periods number of periods, default one period per possible burst length +% filename_no_ext filename , default filename FEC_burstlens_XtoYinZ{.bin,.g192} +% seed_in seed , seed for burst positions in a period and period scrambling +% outputs +% pat_ser 0= good, 1 == bad +% bin file in format PC/Linux signed 16 bit words, int16_t value 1=BAD, value 0 = GOOD +% g192 file in format PC/Linux GOOD synchword = "0x6b21", bad synchword "0x6b20", + +local_dbg = 1; + +if nargin < 3 + help gen_ep_long_bursts + disp('exiting') + return +end + +if nargin < 4 + n_periods = l_max-l_min+1; + % generates all possible burts lengths +end + +if nargin < 5 + base_name = sprintf("FEC_burstlens_%dto%d_in%d",l_min,l_max,period_frames) +else + base_name=file_name_no_ext; +end + +if nargin < 6 + rng('default') +else + rng(seed_in) +end + +assert(l_min>0 , "gen_ep_long_bursts:l_min"," invalid l_min"); +assert(l_max>l_min , "gen_ep_long_bursts:l_max"," invalid l_max"); +assert(period_frames>l_max , "gen_ep_long_bursts:period_frames"," invalid period_frames"); +assert(n_periods>=2 , "gen_ep_long_bursts:n_periods"," invalid n_periods"); + +namebin= sprintf('%s.bin',base_name); +nameg192= sprintf('%s.g192',base_name); + +n_burstlens= l_max-l_min+1; + + +%generate the patterns matrix +% (will be flattened in the end) + +pat = zeros(n_periods,period_frames); +taken=zeros(1,n_periods); + +if ( n_periods==2 ) + % min length + startp = randi( [ 2 period_frames-l_min+1 ]) + pat(1,startp:(startp+l_min-1))=1; + assert( sum(pat(1,:))==l_min); + taken(1)=1; + + % max length + startp = randi( [ 2 period_frames-l_max+1 ]); + pat(2, startp:(startp+l_max-1))=1; + assert( sum(pat(2,:))==l_max); + taken(2)=1; +else + % pseudo random assignment + % always include min and max lengths first + + % min length + p=randi([1 n_periods]); + startp = randi( [ 2 period_frames-l_min+1 ]); + pat(p,startp:(startp+l_min-1))=1; + assert( sum(pat(p,:))==l_min); + taken(p)=1; + + % max length + p = randi([1 n_periods]); + while taken(p)==1, + p = randi([1 n_periods]); + end + assert(taken(p)==0); + startp = randi( [ 2 period_frames-l_max+1 ]); + pat(p, startp:(startp+l_max-1))=1; + assert( sum(pat(p,:))==l_max); + taken(p)=1; + +end + + disp pat + + % now inject all remaining possible burstlengths as far as possible + n_rem = n_burstlens - 2; % = l_max-l_min+1 -2 ; + unique_blens = l_min + randperm ( n_rem, n_rem); + n_left = min(numel(unique_blens), n_periods-2 ) + + for bidx=1:n_left, + p = find( taken==0,1,'first'); + assert(taken(p)==0); + blen =unique_blens(bidx); + startp = randi( [ 2 period_frames-blen+1 ]); + pat(p, startp:(startp+blen-1))=1; + assert( sum(pat(p,:))==blen); + taken(p)=1; + end + + % if any remaining periods + % simply randomize the burst length + % random fil of the rest + while sum(taken) < n_periods, + p = find( taken==0, 1,'first'); + assert(taken(p)==0); + blen =randi( [l_min l_max]); + startp = randi( [ 2 period_frames-blen+1 ]); + pat(p, startp:(startp+blen-1))=1; + assert( sum(pat(p,:))==blen); + taken(p)=1; + end + + disp pat + + + % serialize + pat_ser=transpose(pat); + pat_ser=pat_ser(:); + + % write FER files + [fid, msg] = fopen(namebin,'w','n') ; + cnt=fwrite(fid,pat_ser,'int16'); + fclose(fid); + + disp(sprintf ("Wrote FER file %s (0's or 1's) ", namebin)); + + assert(cnt== numel(pat_ser) ) + + [fid, msg] = fopen(nameg192,'w','n') ; + % Linux GOOD synchword = "0x6b21", bad synchword "0x6b20", + for i=1:numel(pat_ser) + sym = 0x6b21 ; % 27425 good synch , bfi==0 + if( pat_ser(i) == 1) + sym= 0x6b20 ; % 27424 bad synch , BFI==1 + end + cnt=fwrite(fid,sym,'uint16'); + assert(cnt==1); + end + fclose(fid); + disp(sprintf ("Wrote FER file %s (0x6b21's or 0x6b20's) ", nameg192)); + + + if local_dbg + name2 = strrep(base_name,'_','\_'); + %[fid, msg] = fopen(name,'r','n') ; + %e=fread(fid,inf,'int16'); + %fclose(fid); + + e = pat_ser; + if e(end)==1, + e(end+1)=0; % terminate last burst + end + a=find(diff(e)==1); + b=find(diff(e)==-1); + assert(numel(a)== numel(b)); + + bl=b-a; + + fer_pct = 100*sum(e==1)/length(e); + + h=histogram(bl,0.5:max(bl+.5),'normalization','probability'); + title(sprintf("%s, Total FER=%.2f %%, frames=%d, Av. burstlen=%.2f",name2, fer_pct, length(e),mean(bl) )) + set(gca,'xtick',1:max(bl)) + ylabel('probablility'); + xlabel('burst length') + grid + end + +return -- GitLab From 0f59dc3d7cc9883a8a2344fb42de5f57a8806dfb Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Mon, 30 Dec 2024 17:59:17 +0100 Subject: [PATCH 06/10] format fix --- lib_enc/mdct_classifier.c | 10 +++++----- lib_enc/mdct_selector.c | 2 +- lib_enc/pre_proc.c | 2 +- lib_enc/speech_music_classif.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_enc/mdct_classifier.c b/lib_enc/mdct_classifier.c index 38b1262857..f275e2e151 100644 --- a/lib_enc/mdct_classifier.c +++ b/lib_enc/mdct_classifier.c @@ -348,11 +348,11 @@ int16_t mdct_classifier( hTcxEnc->last_gain2 = gain2; -#ifdef DEBUGGING -#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG - clas_final = HQ_CORE; -#endif -#endif +#ifdef DEBUGGING +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG + clas_final = HQ_CORE; +#endif +#endif return clas_final; } diff --git a/lib_enc/mdct_selector.c b/lib_enc/mdct_selector.c index fe5e9dec2f..e5f35a0e00 100644 --- a/lib_enc/mdct_selector.c +++ b/lib_enc/mdct_selector.c @@ -259,7 +259,7 @@ void MDCT_selector( #ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG st->core = HQ_CORE; #endif -#endif +#endif /* Update memories */ diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 7c3080fe83..7db0c9c433 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -606,7 +606,7 @@ void pre_proc( { SetModeIndex( st, st->last_total_brate, EVS_MONO, 0 ); st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, 0 ); - st->L_frame = ( int16_t )( st->sr_core / FRAMES_PER_SEC ); + st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); st->encoderLookahead_enc = NS2SA( st->sr_core, ACELP_LOOK_NS ); st->encoderPastSamples_enc = ( st->L_frame * 9 ) >> 4; diff --git a/lib_enc/speech_music_classif.c b/lib_enc/speech_music_classif.c index c5f2dec2db..4f917aae5d 100644 --- a/lib_enc/speech_music_classif.c +++ b/lib_enc/speech_music_classif.c @@ -354,11 +354,11 @@ void speech_music_classif( #ifdef FORCE_AUDIO_DECISION st->sp_aud_decision1 = 1; - sp_aud_decision + sp_aud_decision #endif - return; + return; } -- GitLab From df00f5a64f91911dca0bef7c6d4e115fba8de4c0 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Mon, 30 Dec 2024 18:03:17 +0100 Subject: [PATCH 07/10] deactivated DEBUGGING define --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index af75962705..1b1b8a1681 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -48,7 +48,7 @@ /* ################### Start DEBUGGING switches ########################### */ #ifndef RELEASE - #define DEBUGGING /* */ /* Activate debugging part of the code */ +/* #define DEBUGGING */ /* Activate debugging part of the code */ #endif /*#define WMOPS*/ /* Activate complexity and memory counters */ -- GitLab From 76f46ee7c77f6a0fbe45668c606f93ea19d626bf Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 8 Jan 2025 15:28:58 +0100 Subject: [PATCH 08/10] modified ISM rate handling to test HQ rates from 16.4 to 48 kbps only . new burst files --- lib_com/ivas_ism_com.c | 24 ++++++++++ lib_com/options.h | 6 +-- lib_dec/FEC_HQ_phase_ecu.c | 9 ++-- lib_enc/ivas_ism_metadata_enc.c | 9 ++++ lib_enc/mdct_classifier.c | 13 +++--- scripts/testv/FEC_burstlens_10to20_in30.g192 | 1 - scripts/testv/FEC_burstlens_10to34_in40.g192 | 1 - scripts/testv/ep_stats_bin_files.m | 1 + scripts/testv/gen_ep_long_bursts.m | 47 +++++++++++++++++--- 9 files changed, 93 insertions(+), 18 deletions(-) delete mode 100644 scripts/testv/FEC_burstlens_10to20_in30.g192 delete mode 100644 scripts/testv/FEC_burstlens_10to34_in40.g192 diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 82aec26acc..949c9013eb 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -212,6 +212,8 @@ ivas_error ivas_ism_config( } } + + n_higher = sum_s( flag_higher, n_ISms ); if ( diff > 0 && n_higher > 0 ) @@ -252,6 +254,17 @@ ivas_error ivas_ism_config( limit = ( ACELP_16k_LOW_LIMIT + SWB_TBE_1k6 ) / FRAMES_PER_SEC; } +#ifdef DEBUGGING +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG + /* for dbg testing of HQ decoder, high rate HQ coding requires 16.4kbps to 48kbps */ + if ( limit < 16400 / 50 ) + { + limit = 16400 / 50; + } +#endif +#endif + + if ( ism_imp[ch] == ISM_NO_META ) { tmp = BITS_ISM_INACTIVE; @@ -305,6 +318,17 @@ ivas_error ivas_ism_config( limit_high = ACELP_12k8_HIGH_LIMIT / FRAMES_PER_SEC; } +#ifdef DEBUGGING +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG + /* for dbg testing of HQ decoder, high rate HQ coding requires 16.4kbps to 48kbps */ + if ( limit_high > 48000 / 50 ) + { + limit_high = 48000 / 50; + } +#endif +#endif + + tmp = (int16_t) min( bits_CoreCoder[ch], limit_high ); diff += bits_CoreCoder[ch] - tmp; diff --git a/lib_com/options.h b/lib_com/options.h index 1b1b8a1681..85ec991fb6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -178,9 +178,9 @@ #define NONBE_1217_INIT_OBJ_EDIT /* VA: issue 1217: do object editing only when objects metadata is available */ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ -//# ifdef DEBUGGING -//# define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG /* Ericsson FORCE HQ in music mode at 32 kbps for PLC simulations, -force HQ is not working at 32 kbps */ -//# endif +# ifdef DEBUGGING +# define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG /* Ericsson FORCE HQ in music mode at 32 kbps for PLC simulations, -force HQ is not working at 32 kbps */ +# endif /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 45562a8c77..5a0f3598dd 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -422,14 +422,14 @@ static void trans_ana( #ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING if ( element_mode != EVS_MONO ) { - if ( k == 0 && burst_len > BETA_MUTE_THR ) /* beta_mute final long term attenuation adjusted only once per frame in the first sub-band */ + if ( k == 0 && burst_len > BETA_MUTE_THR ) /* beta_mute final long term attenuation adjusted only once per frame in the first sub-band, Ref Eq(184) in 26.447 */ { *beta_mute *= BETA_MUTE_FAC; } } else { - if ( burst_len > BETA_MUTE_THR ) /* legacy incorrect EVS_MONO operation, kept for BE, to be updated after EVS CR */ + if ( burst_len > BETA_MUTE_THR ) /* legacy incorrect(too fast) EVS_MONO operation, still kept for BE. To be updated after EVS CR, ref Eq (184) in 26.447 */ { *beta_mute *= BETA_MUTE_FAC; } @@ -2229,7 +2229,10 @@ void hq_ecu( ( st->total_brate < 48000 && ( ( ph_ecu_HqVoicing || corr > 0.85 ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) ); ivas_mode_selection = ( N < PH_ECU_N_LIMIT ) || ( corr < PH_ECU_CORR_LIMIT ); - +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG + evs_mode_selection = 0; + ivas_mode_selection = 0; +#endif if ( ( ( st->element_mode == EVS_MONO ) && evs_mode_selection ) || ( ( st->element_mode != EVS_MONO ) && evs_mode_selection && ivas_mode_selection ) ) diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index c7b991e2f6..9f08bdf805 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -141,6 +141,15 @@ static void rate_ism_importance( if ( ( hIsmMeta[ch]->ism_metadata_flag == 0 || lowrate_metadata_flag[ch] == 1 ) && hSCE[ch]->hCoreCoder[0]->localVAD == 0 ) { ism_imp[ch] = ISM_NO_META; + #ifdef DEBUGGING +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG + if ( nchan_transport > 1 ) + { + ism_imp[ch] = ISM_LOW_IMP; /*use of ISM_NO_META may cause too low rate sum when forcing to HQ encoding modes */ + } +#endif +#endif + } else if ( ctype == INACTIVE || ctype == UNVOICED ) { diff --git a/lib_enc/mdct_classifier.c b/lib_enc/mdct_classifier.c index f275e2e151..f894ea86e8 100644 --- a/lib_enc/mdct_classifier.c +++ b/lib_enc/mdct_classifier.c @@ -336,6 +336,13 @@ int16_t mdct_classifier( /* Restrict usage of HQ_core to supported operating range */ /* EVS: brate == st->total_brate */ /* IVAS: brate is the nominal bitrate while st->total_brate may fluctuate. This sets a hard limit for HQ at HQ_16k40 */ +#ifdef DEBUGGING +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG + clas_final = HQ_CORE; + /* note for ISM the bitrate can adaptively drop below 16.4 kbps , or be higher than 8kbps, thus activating TCX20 */ +#endif +#endif + if ( st->total_brate <= HQ_16k40 || brate < HQ_16k40 || st->bwidth == NB || brate > IVAS_48k ) { clas_final = TCX_20_CORE; @@ -348,11 +355,7 @@ int16_t mdct_classifier( hTcxEnc->last_gain2 = gain2; -#ifdef DEBUGGING -#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG - clas_final = HQ_CORE; -#endif -#endif + return clas_final; } diff --git a/scripts/testv/FEC_burstlens_10to20_in30.g192 b/scripts/testv/FEC_burstlens_10to20_in30.g192 deleted file mode 100644 index c74dec59e5..0000000000 --- a/scripts/testv/FEC_burstlens_10to20_in30.g192 +++ /dev/null @@ -1 +0,0 @@ -!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k \ No newline at end of file diff --git a/scripts/testv/FEC_burstlens_10to34_in40.g192 b/scripts/testv/FEC_burstlens_10to34_in40.g192 deleted file mode 100644 index 8ccc1b9e0b..0000000000 --- a/scripts/testv/FEC_burstlens_10to34_in40.g192 +++ /dev/null @@ -1 +0,0 @@ -!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k!k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k \ No newline at end of file diff --git a/scripts/testv/ep_stats_bin_files.m b/scripts/testv/ep_stats_bin_files.m index 0f78eb90e4..9aec939505 100644 --- a/scripts/testv/ep_stats_bin_files.m +++ b/scripts/testv/ep_stats_bin_files.m @@ -4,6 +4,7 @@ function bl=ep_stats_bin_files(name) % Check burst length and total fer of .bin files % format PC/Linux signed 16 bit words, int16_t value 1=BAD, value 0 = GOOD % +% Copyright Ericsson AB(2024-2025) if nargin <1 % name='FEC_burstl_1_to_20' diff --git a/scripts/testv/gen_ep_long_bursts.m b/scripts/testv/gen_ep_long_bursts.m index dee5626b84..32980d943c 100644 --- a/scripts/testv/gen_ep_long_bursts.m +++ b/scripts/testv/gen_ep_long_bursts.m @@ -1,9 +1,9 @@ function pat_ser = gen_ep_long_bursts(l_min, l_max, period_frames, n_periods, file_name_no_ext, seed_in ) -%function gen_ep_long_bursts(l_min, l_max, period_frames, file_name ) +%function gen_ep_long_bursts(l_min, l_max, period_frames, file_name, seed_in, ) % % examples: -% gen_ep_long_bursts(10, 35, 40, 25,'FEC_burstlen_10to35in40') -% gen_ep_long_bursts(38, 39, 40, 2,'FEC_burstlen_38to39in40') +% gen_ep_long_bursts(10, 35, 40, 25,'FEC_burstlens_10to35in40') +% gen_ep_long_bursts(38, 39, 40, 2,'FEC_burstlens_38to39in40') % % generate long burst sequences for regression testing of PLC algorithms % if n_periods is less than n_burstlens = l_max-lmin+1 , then @@ -23,9 +23,19 @@ function pat_ser = gen_ep_long_bursts(l_min, l_max, period_frames, n_periods, fi % pat_ser 0= good, 1 == bad % bin file in format PC/Linux signed 16 bit words, int16_t value 1=BAD, value 0 = GOOD % g192 file in format PC/Linux GOOD synchword = "0x6b21", bad synchword "0x6b20", +% wav file at 48kHz 20ms frames , showing the BFi flag as 16384(bad) or 0(good) +% Copyright Ericsson AB(2024-2025) + local_dbg = 1; + +% wav plot to see the error pattern in synch with wav synthesis file +fs=48000; +fps=50; % 50 Hz +samplesPerFrame = floor(fs/fps); + + if nargin < 3 help gen_ep_long_bursts disp('exiting') @@ -34,11 +44,11 @@ end if nargin < 4 n_periods = l_max-l_min+1; - % generates all possible burts lengths + % generates all possible burst lengths end if nargin < 5 - base_name = sprintf("FEC_burstlens_%dto%d_in%d",l_min,l_max,period_frames) + base_name = sprintf("FEC_bl%dto%din%d",l_min,l_max,period_frames) else base_name=file_name_no_ext; end @@ -56,6 +66,8 @@ assert(n_periods>=2 , "gen_ep_long_bursts:n_periods"," invalid n_periods"); namebin= sprintf('%s.bin',base_name); nameg192= sprintf('%s.g192',base_name); +namewav= sprintf('%s.frsize.%d.fs.%d.wav',base_name, samplesPerFrame, fs); + n_burstlens= l_max-l_min+1; @@ -162,7 +174,23 @@ end disp(sprintf ("Wrote FER file %s (0x6b21's or 0x6b20's) ", nameg192)); + % write wav file + + % create matrix + n_frames = numel(pat_ser); + y=repmat(int16(16384*(1-pat_ser)),1, samplesPerFrame ) ;% 16384=good, 0 = bad + y=transpose(y); + y=y(:); + + audiowrite(namewav,y,fs) + + disp(sprintf ("Wrote fer pattern wave file %s (0's for bad or 16384 for good) ", namewav)); + + if local_dbg + figure(1) + clf; + name2 = strrep(base_name,'_','\_'); %[fid, msg] = fopen(name,'r','n') ; %e=fread(fid,inf,'int16'); @@ -186,6 +214,15 @@ end ylabel('probablility'); xlabel('burst length') grid + + figure(2) + clf; + clear yy + [yy, Fs_y] = audioread(namewav, 'native'); + plot(yy); + name2wav = strrep(namewav,'_','\_'); + title( sprintf('%s, frSize=%d, Fs=%d, length: %.2fs (%d frames)', name2wav,samplesPerFrame, Fs_y, numel(yy)/Fs_y, int16(floor(numel(yy)/samplesPerFrame)))); + legend("16384=good, 0=bad"); end return -- GitLab From 534c9baa46657429081ce087dbd2d664d090bc3f Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 8 Jan 2025 15:30:30 +0100 Subject: [PATCH 09/10] added long FEr burst file --- scripts/sim_bursts.sh | 150 ++++++++++++++++++++++++++++ scripts/testv/FEC_bl10to69in70.g192 | 1 + 2 files changed, 151 insertions(+) create mode 100644 scripts/sim_bursts.sh create mode 100644 scripts/testv/FEC_bl10to69in70.g192 diff --git a/scripts/sim_bursts.sh b/scripts/sim_bursts.sh new file mode 100644 index 0000000000..bfb24b71f4 --- /dev/null +++ b/scripts/sim_bursts.sh @@ -0,0 +1,150 @@ +#!/bin/bash -xv + +# +# (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +# contributors to this repository. All Rights Reserved. +# +# This software is protected by copyright law and by international treaties. +# The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +# contributors to this repository retain full ownership rights in their respective contributions in +# the software. This notice grants no license of any kind, including but not limited to patent +# license, nor is any license granted by implication, estoppel or otherwise. +# +# Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +# contributions. +# +# This software is provided "AS IS", without any express or implied warranties. The software is in the +# development stage. It is intended exclusively for experts who have experience with such software and +# solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +# and fitness for a particular purpose are hereby disclaimed and excluded. +# +# Any dispute, controversy or claim arising under or in relation to providing this software shall be +# submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +# the United Nations Convention on Contracts on the International Sales of Goods. +# + +set -euo pipefail # find when variables are not set but used anyway +IFS=$'\n\t' # space is not a separator in bash vectors definitions, for simple matrix row creation +#IFS=$' ' # space is a separation, for matrix row adressing + +NARG="$#" +echo NARG=$NARG + +help=0 +deconly=0 +#opt_cnt=0 + +if [ $NARG -gte 1 ] ; then +if [ "$1" == "-h" ] || [ "$1" == "-help" ]; then + help=1; + if [ $help -ne 0 ]; then + echo "Usage: $0 [-d] " + echo " -d: deconly (do not rerun encoder)" + exit + fi +fi + +if [ "$1" == "-d" ] || [ "$1" == "-deconly" ]; then + deconly=1; +fi + +fi + + + +echo POSTARGS +#MONOFILE="./testv/stv_muting_tones_and_noise3p2s_L48n" +#STEREOFILE="./testv/stv_muting_tones_and_noise3p2s_ST48n" + +#MONOFILE="./testv/stv_mut3x20s_L48n" +#STEREOFILE="./testv/stv_mut3x20s_ST48n" + +#MONOFILE="./testv/stv1MASA1TC48n" +#STEREOFILE="./testv/stv1MASA2TC48n" + +MONOFILE="./testv/stv_mut_pink20s_L48n" +STEREOFILE="./testv/stv_mut3x20s_ST48n" + + +#FECFILE="./testv/FEC_burstlens_10to34in40.g192" + +#FECFILE="./testv/FEC_bl10to34in40.g192" +#FERTAG="bl10to34" + +FECFILE="./testv/FEC_bl10to69in70.g192" +FERTAG="bl10to69" + + +#FECFILE="./testv/FEC_bl35to65in70.g192" +#FERTAG="bl35to65" + +IO="48" + +BR_ISM1="32000" +BR_ISM2="64000" + +#COND="HQLOCK" +#COND="DEFAULT" + +declare -a cond_arr=(HQONLY DEFAULT) + +## now loop through the condition array +for cond in "${cond_arr[@]}" +do + ENCOPT=(-FORCE MUSIC) # as array, working expand as ${ENCOPT[@]} + # ENCOPT="-FORCE MUSIC" # as string not ! working + + IVASCOD="../IVAS_cod_$cond.exe" + IVASDEC="../IVAS_dec_$cond.exe" + + if [ "$cond" == "DEFAULT" ] ; then + ENCOPT=() + + IVASCOD="../IVAS_cod.exe" + IVASDEC="../IVAS_dec.exe" + fi + + + echo ISM1 + #ISM1 + if [ $deconly -ne 1 ] ; then + rm -f $MONOFILE.ism1.$cond.ana + $IVASCOD ${ENCOPT[@]} -ISM 1 NULL $BR_ISM1 $IO $MONOFILE.wav $MONOFILE.ism1.$cond.ana + fi + $IVASDEC MONO $IO $MONOFILE.ism1.$cond.ana $MONOFILE.ism1.$cond.dec.no.fer.wav + rm -f tmp.ana + ~/bin/eid-xor -fer $MONOFILE.ism1.$cond.ana $FECFILE tmp.ana + #$IVASDEC -FEC $FECFILE MONO $IO $MONOFILE.ism1.$cond.ana $MONOFILE.ism1.$cond.dec.$FERTAG.fer.wav + $IVASDEC MONO $IO tmp.ana $MONOFILE.ism1.$cond.dec.$FERTAG.fer.wav + + #ISM2 + if [ $deconly -ne 1 ] ; then + \rm -f $STEREOFILE.ism2.$cond.ana + $IVASCOD ${ENCOPT[@]} -ISM 2 NULL NULL $BR_ISM2 $IO $STEREOFILE.wav $STEREOFILE.ism2.$cond.ana + fi + $IVASDEC STEREO $IO $STEREOFILE.ism2.$cond.ana $STEREOFILE.ism2.$cond.dec.no.fer.wav + rm -f tmp.ana + ~/bin/eid-xor -fer $STEREOFILE.ism2.$cond.ana $FECFILE tmp.ana + $IVASDEC STEREO $IO tmp.ana $MONOFILE.ism2.$cond.dec.$FERTAG.fer.wav + + #stereo + if [ $deconly -ne 1 ] ; then + \rm -f $STEREOFILE.stereo.$cond.ana + $IVASCOD ${ENCOPT[@]} -stereo $BR_ISM2 $IO $STEREOFILE.wav $STEREOFILE.stereo.$cond.ana + fi + $IVASDEC STEREO $IO $STEREOFILE.stereo.$cond.ana $STEREOFILE.stereo.$cond.dec.no.fer.wav + rm -f tmp.ana + ~/bin/eid-xor -fer $STEREOFILE.stereo.$cond.ana $FECFILE tmp.ana + $IVASDEC STEREO $IO tmp.ana $STEREOFILE.stereo.$cond.dec.$FERTAG.fer.wav + + #EVS (TBD) + echo $0 done with cond $cond + +done diff --git a/scripts/testv/FEC_bl10to69in70.g192 b/scripts/testv/FEC_bl10to69in70.g192 new file mode 100644 index 0000000000..c79e472fdb --- /dev/null +++ b/scripts/testv/FEC_bl10to69in70.g192 @@ -0,0 +1 @@ +!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k!k k k k k k k k k k k!k!k!k!k!k!k!k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k!k!k!k!k!k!k \ No newline at end of file -- GitLab From b941f297496c7b9f9d5adb60e8c3bc8a3d2de800 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 8 Jan 2025 15:36:58 +0100 Subject: [PATCH 10/10] format fix --- lib_com/ivas_ism_com.c | 1 - lib_dec/FEC_HQ_phase_ecu.c | 4 ++-- lib_enc/ivas_ism_metadata_enc.c | 5 ++--- lib_enc/mdct_classifier.c | 4 +--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 949c9013eb..b6f2e5bc3b 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -213,7 +213,6 @@ ivas_error ivas_ism_config( } - n_higher = sum_s( flag_higher, n_ISms ); if ( diff > 0 && n_higher > 0 ) diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 5a0f3598dd..2c5a9512b9 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -2229,10 +2229,10 @@ void hq_ecu( ( st->total_brate < 48000 && ( ( ph_ecu_HqVoicing || corr > 0.85 ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) ); ivas_mode_selection = ( N < PH_ECU_N_LIMIT ) || ( corr < PH_ECU_CORR_LIMIT ); -#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG +#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG evs_mode_selection = 0; ivas_mode_selection = 0; -#endif +#endif if ( ( ( st->element_mode == EVS_MONO ) && evs_mode_selection ) || ( ( st->element_mode != EVS_MONO ) && evs_mode_selection && ivas_mode_selection ) ) diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 9f08bdf805..9f6984f676 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -141,15 +141,14 @@ static void rate_ism_importance( if ( ( hIsmMeta[ch]->ism_metadata_flag == 0 || lowrate_metadata_flag[ch] == 1 ) && hSCE[ch]->hCoreCoder[0]->localVAD == 0 ) { ism_imp[ch] = ISM_NO_META; - #ifdef DEBUGGING +#ifdef DEBUGGING #ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG if ( nchan_transport > 1 ) { - ism_imp[ch] = ISM_LOW_IMP; /*use of ISM_NO_META may cause too low rate sum when forcing to HQ encoding modes */ + ism_imp[ch] = ISM_LOW_IMP; /*use of ISM_NO_META may cause too low rate sum when forcing to HQ encoding modes */ } #endif #endif - } else if ( ctype == INACTIVE || ctype == UNVOICED ) { diff --git a/lib_enc/mdct_classifier.c b/lib_enc/mdct_classifier.c index f894ea86e8..c0ad724da7 100644 --- a/lib_enc/mdct_classifier.c +++ b/lib_enc/mdct_classifier.c @@ -339,7 +339,7 @@ int16_t mdct_classifier( #ifdef DEBUGGING #ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING_DEBUG clas_final = HQ_CORE; - /* note for ISM the bitrate can adaptively drop below 16.4 kbps , or be higher than 8kbps, thus activating TCX20 */ + /* note for ISM the bitrate can adaptively drop below 16.4 kbps , or be higher than 8kbps, thus activating TCX20 */ #endif #endif @@ -355,8 +355,6 @@ int16_t mdct_classifier( hTcxEnc->last_gain2 = gain2; - - return clas_final; } -- GitLab