From e5b8632713b8ccd06a639dcd8f031143f4f42a3d Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 10 Mar 2025 11:26:36 +0100 Subject: [PATCH 01/46] issue 1289: Fix glitch when stereo signal is decoded to mono n TD->DFT switching; under NONBE_1289_STEREO_SW_TO_MONO --- lib_com/options.h | 2 ++ lib_dec/ivas_stereo_switching_dec.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index be86aa6f64..9bf56cd9f1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -176,6 +176,8 @@ #define NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL /* Nokia: add fix for precision limitation in comparison with masa2total energy ratio threshold to be aligned with BASOP*/ +#define NONBE_1289_STEREO_SW_TO_MONO /* VA: issue 1289: Fix glitch when stereo signal is decoded to mono n TD->DFT switching */ + /* ##################### End NON-BE switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 58a5b009a0..a831a74d23 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -1141,7 +1141,11 @@ void synchro_synthesis( /* handling of TD->DFT switching */ for ( n = 0; n < hCPE->nchan_out; n++ ) { +#ifdef NONBE_1289_STEREO_SW_TO_MONO + if ( ( !use_cldfb_for_last_dft && hCPE->last_element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag && dft_mono_brate_switch != -1 ) || dft_mono_brate_switch == 1 ) +#else if ( ( hCPE->last_element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag && dft_mono_brate_switch != -1 ) || dft_mono_brate_switch == 1 ) +#endif { float *pPrev_synth; float inv_fade_len = 1.f / delay_diff; -- GitLab From 9881d0fbbbae22bcf1d49738a7bdba6591cf0b53 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 13 Mar 2025 13:27:07 +0100 Subject: [PATCH 02/46] Avoid JBM ignoring safety margin and setting playout delay to 0 during DTX --- lib_com/options.h | 3 ++- lib_dec/jbm_jb4sb.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index be86aa6f64..4a4448de24 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ +#define ISSUE_1122_JBM_DO_NOT_HARDCODE_SAFETY_MARGIN /* FhG: Use safety margin defined by user instead of a hard-coded value */ /* #################### End BE switches ################################## */ @@ -173,7 +174,7 @@ #define NONBE_1279_COUNTER_OVERFLOW /* VA: issue 1279: Avoid possible overflow of counter st->Nb_ACELP_frames */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD /* VA/Eri: issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */ - +#define NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX /* FhG: Avoid JBM ignoring safety margin and setting playout delay to 0 during DTX */ #define NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL /* Nokia: add fix for precision limitation in comparison with masa2total energy ratio threshold to be aligned with BASOP*/ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index c1e728e103..2950443f4f 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -671,10 +671,24 @@ static void JB4_targetPlayoutDelay( *targetStartUp = ( *targetMin + *targetMax ) / 2; } +#ifdef NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX +#ifdef ISSUE_1122_JBM_DO_NOT_HARDCODE_SAFETY_MARGIN + *targetDtx = JB4_MAX( *targetDtx, (uint32_t) h->safetyMargin ); +#else + if ( *targetDtx < 60 ) + { + *targetDtx = 60; + } +#endif +#endif +#ifdef ISSUE_1122_JBM_DO_NOT_HARDCODE_SAFETY_MARGIN + *targetStartUp = JB4_MAX( *targetStartUp, (uint32_t) h->safetyMargin ); +#else if ( *targetStartUp < 60 ) { *targetStartUp = 60; } +#endif return; } -- GitLab From f859a9ed1e5e23776866e3d3800e0fa36817968d Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 13 Mar 2025 20:11:02 +0100 Subject: [PATCH 03/46] simplify ivas core coder functions; under SIMPLIFY_IVAS_CORE --- lib_com/ivas_prot.h | 5 +++- lib_com/options.h | 1 + lib_com/prot.h | 12 ++++---- lib_dec/core_switching_dec.c | 16 +++++++---- lib_dec/evs_dec.c | 5 +++- lib_dec/ivas_core_dec.c | 53 +++++++++++++++++++++++++++++++++++- lib_dec/ivas_mct_dec.c | 4 +++ lib_dec/ivas_tcx_core_dec.c | 10 +++++-- lib_enc/ivas_core_enc.c | 8 +++++- 9 files changed, 98 insertions(+), 16 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 102e67effa..4a736798e7 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -525,8 +525,11 @@ void stereo_tcx_core_dec( const int16_t last_element_mode, /* i : last element mode */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out, /* i : number of output channels */ + const int16_t nchan_out /* i : number of output channels */ +#ifndef SIMPLIFY_IVAS_CORE + , const IVAS_FORMAT ivas_format /* i : IVAS format */ +#endif ); void stereo_tcx_init_dec( diff --git a/lib_com/options.h b/lib_com/options.h index be86aa6f64..c1f7233068 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ +#define SIMPLIFY_IVAS_CORE /* VA: simplify ivas core coder functions */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 9716a89264..99345e8b10 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -5910,11 +5910,13 @@ void core_switching_post_enc( ); ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ + Decoder_State *st, /* i/o: decoder state structure */ + float *synth, /* i/o: output synthesis */ + float *output, /* i/o: LB synth/upsampled LB synth */ + float output_mem[], /* i : OLA memory from last TCX/HQ frame */ +#ifndef SIMPLIFY_IVAS_CORE + const IVAS_FORMAT ivas_format, /* i : IVAS format */ +#endif const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching frame flag */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index c6e7fe24c3..af0fb30bee 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -553,11 +553,13 @@ ivas_error core_switching_pre_dec( *---------------------------------------------------------------------*/ ivas_error core_switching_post_dec( - Decoder_State *st, /* i/o: decoder state structure */ - float *synth, /* i/o: output synthesis */ - float *output, /* i/o: LB synth/upsampled LB synth */ - float output_mem[], /* i : OLA memory from last TCX/HQ frame */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ + Decoder_State *st, /* i/o: decoder state structure */ + float *synth, /* i/o: output synthesis */ + float *output, /* i/o: LB synth/upsampled LB synth */ + float output_mem[], /* i : OLA memory from last TCX/HQ frame */ +#ifndef SIMPLIFY_IVAS_CORE + const IVAS_FORMAT ivas_format, /* i : IVAS format */ +#endif const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching flag */ @@ -679,7 +681,11 @@ ivas_error core_switching_post_dec( synth[i + delay_comp] = ( synth[i + delay_comp] * i + ( tmpDelta - i ) * st->previoussynth[i + delay_comp] ) / tmpDelta; } +#ifdef SIMPLIFY_IVAS_CORE + if ( ( st->element_mode == IVAS_CPE_MDCT || ( st->is_ism_format && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */ ) ) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) +#else if ( ( st->element_mode == IVAS_CPE_MDCT || ( ivas_format == ISM_FORMAT && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */ ) ) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) +#endif { /* smooth transitions to avoid pops in car noise items */ smoothTransitionDtxToTcx( synth, output_frame, delay_comp ); diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index cbd50dd1e4..b520c6a592 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -274,12 +274,15 @@ ivas_error evs_dec( * Postprocessing for ACELP/MDCT core switching *---------------------------------------------------------------------*/ +#ifdef SIMPLIFY_IVAS_CORE + if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, MONO_FORMAT, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) +#endif { return error; } - /*---------------------------------------------------------------------* * Pre-processing for bandwidth switching *---------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 86a4ef71ac..3fe0430692 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -70,6 +70,9 @@ ivas_error ivas_core_dec( Decoder_State **sts, *st; STEREO_ICBWE_DEC_HANDLE hStereoICBWE; STEREO_TD_DEC_DATA_HANDLE hStereoTD; +#ifdef SIMPLIFY_IVAS_CORE + STEREO_CNG_DEC_HANDLE hStereoCng; +#endif int16_t sharpFlag[CPE_CHANNELS]; float synth[CPE_CHANNELS][L_FRAME48k]; float tmp_buffer[L_FRAME48k]; @@ -115,6 +118,9 @@ ivas_error ivas_core_dec( last_element_brate = hSCE->last_element_brate; /* note: this parameter is unused */ last_element_mode = IVAS_SCE; hStereoTD = NULL; +#ifdef SIMPLIFY_IVAS_CORE + hStereoCng = NULL; +#endif p_output_mem = NULL; nchan_out = 1; if ( st_ivas != NULL && st_ivas->ivas_format == ISM_FORMAT ) @@ -133,6 +139,9 @@ ivas_error ivas_core_dec( last_element_mode = hCPE->last_element_mode; hStereoICBWE = hCPE->hStereoICBWE; hStereoTD = hCPE->hStereoTD; +#ifdef SIMPLIFY_IVAS_CORE + hStereoCng = hCPE->hStereoCng; +#endif p_output_mem = hCPE->output_mem[1]; nchan_out = hCPE->nchan_out; @@ -226,7 +235,11 @@ ivas_error ivas_core_dec( } /* n_channels loop */ /* MDCT stereo -> DFT stereo switching */ +#ifdef SIMPLIFY_IVAS_CORE + if ( last_element_mode == IVAS_CPE_MDCT && sts[0]->element_mode == IVAS_CPE_DFT ) +#else if ( hCPE != NULL && hCPE->last_element_mode == IVAS_CPE_MDCT && hCPE->element_mode == IVAS_CPE_DFT ) +#endif { int16_t ovl, fade_len; if ( sts[0]->L_frame != sts[0]->last_L_frame ) @@ -243,10 +256,17 @@ ivas_error ivas_core_dec( } } +#ifdef SIMPLIFY_IVAS_CORE + if ( hStereoCng != NULL ) + { + hStereoCng->flag_cna_fade = 0; + } +#else if ( hCPE != NULL && hCPE->hStereoCng != NULL ) { hCPE->hStereoCng->flag_cna_fade = 0; } +#endif if ( sba_dirac_stereo_flag && hSCE && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG ) { @@ -279,7 +299,11 @@ ivas_error ivas_core_dec( if ( hCPE != NULL && hCPE->element_mode == IVAS_CPE_DFT && hCPE->brate_surplus > 0 ) { +#ifdef SIMPLIFY_IVAS_CORE + ivas_combined_format_brate_sanity( element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &tmps ); +#else ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &tmps ); +#endif } /*------------------------------------------------------------------* @@ -348,7 +372,7 @@ ivas_error ivas_core_dec( if ( st->core == ACELP_CORE ) { /* ACELP core decoder */ - if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) + if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) { return error; } @@ -357,7 +381,11 @@ ivas_error ivas_core_dec( if ( ( st->core == TCX_20_CORE || st->core == TCX_10_CORE ) && st->element_mode != IVAS_CPE_MDCT ) { /* TCX decoder */ +#ifdef SIMPLIFY_IVAS_CORE + stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hStereoCng, nchan_out ); +#else stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); +#endif } if ( st->core == HQ_CORE ) @@ -420,10 +448,17 @@ ivas_error ivas_core_dec( * Stereo CNG updates *---------------------------------------------------------------------*/ +#ifdef SIMPLIFY_IVAS_CORE + if ( sts[0]->element_mode == IVAS_CPE_TD && hStereoCng != NULL ) + { + stereo_cng_compute_PScorr( output, &hStereoCng->c_PS_LT, sts[0]->L_frame, sts[1]->L_frame ); + } +#else if ( sts[0]->element_mode == IVAS_CPE_TD && hCPE->hStereoCng != NULL ) { stereo_cng_compute_PScorr( output, &hCPE->hStereoCng->c_PS_LT, sts[0]->L_frame, sts[1]->L_frame ); } +#endif /*---------------------------------------------------------------------* * Postprocessing, BWEs and updates @@ -462,7 +497,11 @@ ivas_error ivas_core_dec( mvr2r( synth[n], hSCE->save_synth, output_frame ); } +#ifdef SIMPLIFY_IVAS_CORE + if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, last_element_mode ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -474,7 +513,11 @@ ivas_error ivas_core_dec( } /* if we transition from inactive to active coding in MDCT-Stereo DTX and the output format is mono DMX, we need to sync the upsampled buffer between channels here */ +#ifdef SIMPLIFY_IVAS_CORE + if ( n == 0 && st->element_mode == IVAS_CPE_MDCT && st->last_core == ACELP_CORE && st->core != ACELP_CORE && ( nchan_out == 1 || last_element_mode == IVAS_CPE_DFT ) ) +#else if ( n == 0 && st->element_mode == IVAS_CPE_MDCT && st->last_core == ACELP_CORE && st->core != ACELP_CORE && ( nchan_out == 1 || ( hCPE != NULL && hCPE->last_element_mode == IVAS_CPE_DFT ) ) ) +#endif { mvr2r( sts[0]->previoussynth, sts[1]->previoussynth, st->hTcxDec->L_frameTCX ); } @@ -649,7 +692,11 @@ ivas_error ivas_core_dec( mvr2r( tmp_buffer, st->hb_prev_synth_buffer, tmps ); } +#ifdef SIMPLIFY_IVAS_CORE + if ( ( st->element_mode != IVAS_CPE_TD && !use_cldfb_for_dft ) || ( st->element_mode == IVAS_CPE_TD && tdm_LRTD_flag ) ) +#else if ( ( st->element_mode != IVAS_CPE_TD && !use_cldfb_for_dft ) || ( hCPE->element_mode == IVAS_CPE_TD && tdm_LRTD_flag ) ) +#endif { /* Delay hb_synth */ delay_signal( hb_synth[n], output_frame, st->hb_prev_synth_buffer, tmps ); @@ -702,7 +749,11 @@ ivas_error ivas_core_dec( } else /* IVAS_CPE_DFT */ { +#ifdef SIMPLIFY_IVAS_CORE + if ( last_element_mode == IVAS_CPE_MDCT ) +#else if ( hCPE->last_element_mode == IVAS_CPE_MDCT ) +#endif { stereo_mdct2dft_update( hCPE, output[0], synth[0] ); } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index fb1b637e37..164a245eaa 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -260,7 +260,11 @@ ivas_error ivas_mct_dec( } /* Postprocessing for ACELP/MDCT core switching and synchronization */ +#ifdef SIMPLIFY_IVAS_CORE + if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], 0, output_frame, 0 /*core_switching_flag*/, ( st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2 ) ? st_ivas->sba_dirac_stereo_flag : 0, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) +#else if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], st_ivas->ivas_format, 0, output_frame, 0 /*core_switching_flag*/, ( st_ivas->ivas_format != SBA_ISM_FORMAT || cpe_id >= nCPE - 2 ) ? st_ivas->sba_dirac_stereo_flag : 0, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 85e79e8b7d..4aa1283f3a 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -158,8 +158,10 @@ void stereo_tcx_core_dec( const int16_t last_element_mode, /* i : last element mode */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out, /* i : number of output channels */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ + const int16_t nchan_out /* i : number of output channels */ +#ifndef SIMPLIFY_IVAS_CORE + const IVAS_FORMAT ivas_format /* i : IVAS format */ +#endif ) { int16_t i, k; @@ -712,7 +714,11 @@ void stereo_tcx_core_dec( if ( st->element_mode != IVAS_CPE_TD ) { +#ifdef SIMPLIFY_IVAS_CORE + if ( st->is_ism_format ) +#else if ( ivas_format == ISM_FORMAT ) +#endif { float buffer[L_FRAME16k]; lerp( signal_outFB, buffer, st->L_frame, hTcxDec->L_frameTCX ); diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index d690e0a52d..573112e060 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -172,8 +172,9 @@ ivas_error ivas_core_enc( st->extl = -1; unbits[n] = 0; +#ifndef SIMPLIFY_IVAS_CORE st->element_brate = element_brate; - +#endif /*---------------------------------------------------------------------* * Pre-processing, incl. Decision matrix *---------------------------------------------------------------------*/ @@ -196,7 +197,12 @@ ivas_error ivas_core_enc( diff_nBits = 0; if ( hCPE != NULL && hCPE->element_mode == IVAS_CPE_DFT && hCPE->brate_surplus > 0 ) { +#ifdef SIMPLIFY_IVAS_CORE + ivas_combined_format_brate_sanity( element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &diff_nBits ); + +#else ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &diff_nBits ); +#endif } /*---------------------------------------------------------------------* -- GitLab From 0089595d70ec44bb10a518a3522ebd9ced8714b4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 13 Mar 2025 21:17:50 +0100 Subject: [PATCH 04/46] fix --- lib_dec/ivas_core_dec.c | 4 ++++ lib_dec/ivas_tcx_core_dec.c | 1 + lib_enc/ivas_core_enc.c | 4 +--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 3fe0430692..066aab0d6f 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -372,7 +372,11 @@ ivas_error ivas_core_dec( if ( st->core == ACELP_CORE ) { /* ACELP core decoder */ +#ifdef SIMPLIFY_IVAS_CORE if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) +#else + if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 4aa1283f3a..034370c7a8 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -160,6 +160,7 @@ void stereo_tcx_core_dec( STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ const int16_t nchan_out /* i : number of output channels */ #ifndef SIMPLIFY_IVAS_CORE + , const IVAS_FORMAT ivas_format /* i : IVAS format */ #endif ) diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 573112e060..7ee5bc83bf 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -172,9 +172,8 @@ ivas_error ivas_core_enc( st->extl = -1; unbits[n] = 0; -#ifndef SIMPLIFY_IVAS_CORE st->element_brate = element_brate; -#endif + /*---------------------------------------------------------------------* * Pre-processing, incl. Decision matrix *---------------------------------------------------------------------*/ @@ -199,7 +198,6 @@ ivas_error ivas_core_enc( { #ifdef SIMPLIFY_IVAS_CORE ivas_combined_format_brate_sanity( element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &diff_nBits ); - #else ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &diff_nBits ); #endif -- GitLab From 8e9af9faf23c1da6993e28b81aa789332250d2e9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 14 Mar 2025 10:01:37 +0100 Subject: [PATCH 05/46] more simplifications --- lib_dec/ivas_cpe_dec.c | 35 +++++++++++++++++++++ lib_enc/ivas_core_enc.c | 7 +++++ lib_enc/ivas_cpe_enc.c | 69 +++++++++++++++++++++++++++++++++++++++-- lib_enc/ivas_sce_enc.c | 4 +++ 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 97b59b1bad..59be959bd6 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -77,6 +77,9 @@ ivas_error ivas_cpe_dec( float res_buf[STEREO_DFT_N_8k]; CPE_DEC_HANDLE hCPE; Decoder_State **sts; +#ifdef SIMPLIFY_IVAS_CORE + STEREO_DFT_CONFIG_DATA_HANDLE hConfigDft; +#endif int32_t ivas_total_brate; ivas_error error; int32_t cpe_brate; @@ -116,6 +119,14 @@ ivas_error ivas_cpe_dec( return error; } +#ifdef SIMPLIFY_IVAS_CORE + hConfigDft = NULL; + IF( hCPE->hStereoDft != NULL ) + { + hConfigDft = hCPE->hStereoDft->hConfig; + } + +#endif /*------------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ @@ -172,11 +183,19 @@ ivas_error ivas_cpe_dec( { if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_config( hConfigDft, (int32_t) ( 0.7f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#else stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.7f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#endif } else { +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_config( hConfigDft, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#else stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#endif } } else @@ -184,11 +203,19 @@ ivas_error ivas_cpe_dec( /* Note: This only works for stereo operation. If DTX would be applied for multiple CPEs a different bitrate signaling is needed */ if ( ivas_total_brate <= IVAS_SID_5k2 ) { +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_config( hConfigDft, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#else stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#endif } else { +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_config( hConfigDft, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#else stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#endif } } } @@ -415,7 +442,11 @@ ivas_error ivas_cpe_dec( * Core Decoder *----------------------------------------------------------------*/ +#ifdef SIMPLIFY_IVAS_CORE + if ( hCPE->element_mode != IVAS_CPE_DFT || ( hCPE->nchan_out == 1 && hConfigDft->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) +#else if ( hCPE->element_mode != IVAS_CPE_DFT || ( hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) +#endif { if ( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) { @@ -434,7 +465,11 @@ ivas_error ivas_cpe_dec( * Stereo decoder & upmixing *----------------------------------------------------------------*/ +#ifdef SIMPLIFY_IVAS_CORE + if ( hCPE->element_mode == IVAS_CPE_DFT && !( hCPE->nchan_out == 1 && hConfigDft->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) +#else if ( hCPE->element_mode == IVAS_CPE_DFT && !( hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) +#endif { float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 7ee5bc83bf..6600c4b6e3 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -90,7 +90,11 @@ ivas_error ivas_core_enc( float *inp[CPE_CHANNELS]; float new_inp_resamp16k[CPE_CHANNELS][L_FRAME16k]; /* new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ float old_syn_12k8_16k[CPE_CHANNELS][L_FRAME16k]; /* ACELP core synthesis at 12.8kHz or 16kHz to be used by the SWB BWE */ +#ifdef SIMPLIFY_IVAS_CORE + float *shb_speech; +#else float shb_speech[L_FRAME16k]; +#endif float hb_speech[L_FRAME16k / 4]; float *new_swb_speech; float new_swb_speech_buffer[L_FRAME48k + STEREO_DFT_OVL_MAX]; @@ -363,6 +367,9 @@ ivas_error ivas_core_enc( *---------------------------------------------------------------------*/ new_swb_speech = new_swb_speech_buffer + STEREO_DFT_OVL_MAX; +#ifdef SIMPLIFY_IVAS_CORE + shb_speech = new_inp_resamp16k; /* reuse existing buffer */ +#endif if ( !st->Opt_SC_VBR && input_Fs >= 32000 && st->hBWE_TD != NULL ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 4f3a21b8a6..5dc7ded887 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -68,6 +68,9 @@ ivas_error ivas_cpe_enc( ) { CPE_ENC_HANDLE hCPE; +#ifdef SIMPLIFY_IVAS_CORE + STEREO_DFT_CONFIG_DATA_HANDLE hConfigDft; +#endif Encoder_State **sts; int16_t n, n_CoreChannels; float old_inp_12k8[CPE_CHANNELS][L_INP_12k8]; /* buffer of input signal @ 12k8 */ @@ -206,7 +209,14 @@ ivas_error ivas_cpe_enc( return error; } +#ifdef SIMPLIFY_IVAS_CORE + hConfigDft = NULL; + IF( hCPE->hStereoDft != NULL ) + { + hConfigDft = hCPE->hStereoDft->hConfig; + } +#endif /*----------------------------------------------------------------* * Set TD stereo parameters *----------------------------------------------------------------*/ @@ -281,23 +291,39 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode != IVAS_CPE_MDCT && ( hCPE->element_brate != hCPE->last_element_brate || hCPE->last_element_mode != hCPE->element_mode || sts[0]->ini_frame == 0 || +#ifdef SIMPLIFY_IVAS_CORE + ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) || sts[0]->last_core_brate <= SID_2k40 ) ) /* If the last frame was SID or NO_DATA, we need to run stereo_dft_config here since VAD decision is not known yet */ +#else ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) || sts[0]->last_core_brate <= SID_2k40 ) ) /* If the last frame was SID or NO_DATA, we need to run stereo_dft_config here since VAD decision is not known yet */ +#endif { if ( st_ivas->hQMetaData != NULL ) { if ( ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_NONE ) { +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_config( hConfigDft, (int32_t) ( 0.70f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#else stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, (int32_t) ( 0.70f * st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#endif } else { +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_config( hConfigDft, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#else stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#endif } } else { /* note; "bits_frame_nominal" needed in TD stereo as well */ +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_config( hConfigDft, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#else stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#endif } } @@ -368,13 +394,25 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode == IVAS_CPE_DFT ) { +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_hybrid_ITD_flag( hConfigDft, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max ); +#else stereo_dft_hybrid_ITD_flag( hCPE->hStereoDft->hConfig, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max ); +#endif /* Time Domain ITD compensation using extrapolation */ #ifdef DEBUG_MODE_DFT +#ifdef SIMPLIFY_IVAS_CORE + stereo_td_itd( hCPE->hStereoDft->hItd, hCPE->hStereoDft->input_mem_itd, hConfigDft->hybrid_itd_flag, hConfigDft->itd_mode, hCPE->hStereoDft->dft_ovl, sts, input_frame, hCPE->input_mem ); +#else stereo_td_itd( hCPE->hStereoDft->hItd, hCPE->hStereoDft->input_mem_itd, hCPE->hStereoDft->hConfig->hybrid_itd_flag, hCPE->hStereoDft->hConfig->itd_mode, hCPE->hStereoDft->dft_ovl, sts, input_frame, hCPE->input_mem ); +#endif +#else +#ifdef SIMPLIFY_IVAS_CORE + stereo_td_itd( hCPE->hStereoDft->hItd, hCPE->hStereoDft->input_mem_itd, hConfigDft->hybrid_itd_flag, hCPE->hStereoDft->dft_ovl, sts, input_frame, hCPE->input_mem ); #else stereo_td_itd( hCPE->hStereoDft->hItd, hCPE->hStereoDft->input_mem_itd, hCPE->hStereoDft->hConfig->hybrid_itd_flag, hCPE->hStereoDft->dft_ovl, sts, input_frame, hCPE->input_mem ); +#endif #endif /* DFT on right and left input channels */ @@ -384,8 +422,13 @@ ivas_error ivas_cpe_enc( #ifdef DEBUG_MODE_DFT hCPE->hStereoDft->res_cod_bits = (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal ); #endif + /* Update DFT Stereo memories */ +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_enc_update( hCPE->hStereoDft, max_bwidth ); +#else stereo_dft_enc_update( hCPE->hStereoDft, sts[0]->max_bwidth ); +#endif /* DFT stereo processing */ stereo_dft_enc_process( hCPE, vad_flag_dtx, vad_hover_flag, input_frame ); @@ -393,9 +436,7 @@ ivas_error ivas_cpe_enc( else if ( hCPE->element_mode == IVAS_CPE_TD ) { /* Determine the energy ratio between the 2 channels */ - tdm_ratio_idx = stereo_tdm_ener_analysis( - ivas_format, - hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM ); + tdm_ratio_idx = stereo_tdm_ener_analysis( ivas_format, hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM ); /* Compute the downmix signal based on the ratio index */ stereo_tdm_downmix( hCPE->hStereoTD, sts[0]->input, sts[1]->input, input_frame, tdm_ratio_idx, ( ( hCPE->hStereoTD->tdm_LRTD_flag == 0 ) ? tdm_SM_or_LRTD_Pri : 0 ), tdm_ratio_idx_SM ); @@ -478,7 +519,11 @@ ivas_error ivas_cpe_enc( error = pre_proc_front_ivas( NULL, hCPE, hCPE->element_brate, nb_bits_metadata, input_frame, n, old_inp_12k8[n], old_inp_16k[n], &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], +#ifdef SIMPLIFY_IVAS_CORE + fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, st_ivas->hMCT != NULL, hEncoderConfig->last_ivas_total_brate, ivas_total_brate ); +#else fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, st_ivas->hMCT != NULL, st_ivas->hEncoderConfig->last_ivas_total_brate, ivas_total_brate ); +#endif if ( error != IVAS_ERR_OK ) { return error; @@ -529,7 +574,11 @@ ivas_error ivas_cpe_enc( set_bw_stereo( hCPE ); /* reconfiguration of MDCT stereo */ +#ifdef SIMPLIFY_IVAS_CORE + if ( sts[0]->bwidth != sts[0]->last_bwidth || ( ( hCPE->last_element_brate != hCPE->element_brate || hCPE->last_element_mode != hCPE->element_mode ) && sts[0]->bwidth != max_bwidth ) ) +#else if ( sts[0]->bwidth != sts[0]->last_bwidth || ( ( hCPE->last_element_brate != hCPE->element_brate || hCPE->last_element_mode != hCPE->element_mode ) && sts[0]->bwidth != sts[0]->max_bwidth ) ) +#endif { initMdctStereoEncData( hCPE->hStereoMdct, ivas_format, hCPE->element_mode, hCPE->element_brate, sts[0]->bwidth, 0, NULL, 0 ); hCPE->hStereoMdct->isSBAStereoMode = ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && ( st_ivas->nchan_transport == 2 ) ); @@ -552,9 +601,15 @@ ivas_error ivas_cpe_enc( int16_t igf; int16_t bw; +#ifdef SIMPLIFY_IVAS_CORE + bw = ( hCPE->element_mode == IVAS_CPE_MDCT ) ? sts[n]->bwidth : max_bwidth; + igf = getIgfPresent( sts[n]->element_mode, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, bw, sts[n]->rf_mode ); + if ( ( error = IGF_Reconfig( &sts[n]->hIGFEnc, igf, 0, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ) ) != IVAS_ERR_OK ) +#else bw = ( hCPE->element_mode == IVAS_CPE_MDCT ) ? sts[n]->bwidth : sts[n]->max_bwidth; igf = getIgfPresent( sts[n]->element_mode, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, bw, sts[n]->rf_mode ); if ( ( error = IGF_Reconfig( &sts[n]->hIGFEnc, igf, 0, sts[n]->bits_frame_nominal * FRAMES_PER_SEC, sts[n]->max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -621,11 +676,19 @@ ivas_error ivas_cpe_enc( /* Reconfigure DFT Stereo for inactive frames */ if ( sts[0]->core_brate == SID_2k40 ) { +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_config( hConfigDft, IVAS_SID_5k2, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#else stereo_dft_config( hCPE->hStereoDft->hConfig, IVAS_SID_5k2, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#endif } else { +#ifdef SIMPLIFY_IVAS_CORE + stereo_dft_config( hConfigDft, FRAME_NO_DATA, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#else stereo_dft_config( hCPE->hStereoDft->hConfig, FRAME_NO_DATA, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); +#endif } stereo_dft_cng_side_gain( hCPE->hStereoDft, hCPE->hStereoCng, sts[0]->core_brate, sts[0]->last_core_brate, sts[0]->bwidth ); diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 3dc81b8101..68166262c3 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -166,7 +166,11 @@ ivas_error ivas_sce_enc( /* set flag for sampling rate of OL S/M classifier */ flag_16k_smc = 0; +#ifdef SIMPLIFY_IVAS_CORE + if ( ivas_format == SBA_FORMAT && ( st_ivas->hEncoderConfig->ivas_total_brate == IVAS_24k4 || st_ivas->hEncoderConfig->ivas_total_brate == IVAS_32k ) && hSCE->element_brate == hSCE->last_element_brate ) +#else if ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT && ( st_ivas->hEncoderConfig->ivas_total_brate == IVAS_24k4 || st_ivas->hEncoderConfig->ivas_total_brate == IVAS_32k ) && hSCE->element_brate == hSCE->last_element_brate ) +#endif { flag_16k_smc = 1; } -- GitLab From 3423233dfcb3b4307450706a07b3c4546b22a43b Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 14 Mar 2025 10:45:51 +0100 Subject: [PATCH 06/46] revert non-BE change --- lib_com/ivas_prot.h | 5 +---- lib_dec/ivas_core_dec.c | 6 +----- lib_dec/ivas_tcx_core_dec.c | 11 ++--------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4a736798e7..102e67effa 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -525,11 +525,8 @@ void stereo_tcx_core_dec( const int16_t last_element_mode, /* i : last element mode */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ -#ifndef SIMPLIFY_IVAS_CORE - , + const int16_t nchan_out, /* i : number of output channels */ const IVAS_FORMAT ivas_format /* i : IVAS format */ -#endif ); void stereo_tcx_init_dec( diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 066aab0d6f..5113856d11 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -384,12 +384,8 @@ ivas_error ivas_core_dec( if ( ( st->core == TCX_20_CORE || st->core == TCX_10_CORE ) && st->element_mode != IVAS_CPE_MDCT ) { - /* TCX decoder */ -#ifdef SIMPLIFY_IVAS_CORE - stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hStereoCng, nchan_out ); -#else + /* TCX core decoder */ stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); -#endif } if ( st->core == HQ_CORE ) diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 034370c7a8..85e79e8b7d 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -158,11 +158,8 @@ void stereo_tcx_core_dec( const int16_t last_element_mode, /* i : last element mode */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ -#ifndef SIMPLIFY_IVAS_CORE - , - const IVAS_FORMAT ivas_format /* i : IVAS format */ -#endif + const int16_t nchan_out, /* i : number of output channels */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ ) { int16_t i, k; @@ -715,11 +712,7 @@ void stereo_tcx_core_dec( if ( st->element_mode != IVAS_CPE_TD ) { -#ifdef SIMPLIFY_IVAS_CORE - if ( st->is_ism_format ) -#else if ( ivas_format == ISM_FORMAT ) -#endif { float buffer[L_FRAME16k]; lerp( signal_outFB, buffer, st->L_frame, hTcxDec->L_frameTCX ); -- GitLab From 1faa0ac149cf4bfd7c8425caeb087183298f1c97 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 14 Mar 2025 11:50:57 +0100 Subject: [PATCH 07/46] memory saving --- lib_enc/ivas_core_enc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 6600c4b6e3..d91f288622 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -92,10 +92,11 @@ ivas_error ivas_core_enc( float old_syn_12k8_16k[CPE_CHANNELS][L_FRAME16k]; /* ACELP core synthesis at 12.8kHz or 16kHz to be used by the SWB BWE */ #ifdef SIMPLIFY_IVAS_CORE float *shb_speech; + float *hb_speech; #else float shb_speech[L_FRAME16k]; -#endif float hb_speech[L_FRAME16k / 4]; +#endif float *new_swb_speech; float new_swb_speech_buffer[L_FRAME48k + STEREO_DFT_OVL_MAX]; float bwe_exc_extended[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; @@ -344,6 +345,10 @@ ivas_error ivas_core_enc( * WB BWE encoding *---------------------------------------------------------------------*/ +#ifdef SIMPLIFY_IVAS_CORE + hb_speech = new_inp_resamp16k[0]; /* reuse existing buffer: hb_speech[L_FRAME16k/4]; */ + +#endif if ( input_Fs >= 16000 && st->bwidth < SWB && st->hBWE_TD != NULL ) { /* Common pre-processing for WB TBE and WB BWE */ @@ -368,7 +373,7 @@ ivas_error ivas_core_enc( new_swb_speech = new_swb_speech_buffer + STEREO_DFT_OVL_MAX; #ifdef SIMPLIFY_IVAS_CORE - shb_speech = new_inp_resamp16k; /* reuse existing buffer */ + shb_speech = new_inp_resamp16k[0]; /* reuse existing buffer: shb_speech[L_FRAME16k] */ #endif if ( !st->Opt_SC_VBR && input_Fs >= 32000 && st->hBWE_TD != NULL ) -- GitLab From c9abae98e87d1a2552e32d8855e44bbf21060782 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 14 Mar 2025 15:38:16 +0100 Subject: [PATCH 08/46] fix --- lib_enc/ivas_core_enc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index d91f288622..945fa81f63 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -160,8 +160,9 @@ ivas_error ivas_core_enc( input_Fs = sts[0]->input_Fs; input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); +#ifndef SIMPLIFY_IVAS_CORE set_f( new_swb_speech_buffer, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); - +#endif for ( n = 0; n < n_CoreChannels; n++ ) { st = sts[n]; @@ -346,7 +347,7 @@ ivas_error ivas_core_enc( *---------------------------------------------------------------------*/ #ifdef SIMPLIFY_IVAS_CORE - hb_speech = new_inp_resamp16k[0]; /* reuse existing buffer: hb_speech[L_FRAME16k/4]; */ + hb_speech = new_swb_speech_buffer; /* reuse existing buffer: hb_speech[L_FRAME16k/4]; */ #endif if ( input_Fs >= 16000 && st->bwidth < SWB && st->hBWE_TD != NULL ) @@ -373,7 +374,8 @@ ivas_error ivas_core_enc( new_swb_speech = new_swb_speech_buffer + STEREO_DFT_OVL_MAX; #ifdef SIMPLIFY_IVAS_CORE - shb_speech = new_inp_resamp16k[0]; /* reuse existing buffer: shb_speech[L_FRAME16k] */ + set_f( new_swb_speech_buffer, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); + shb_speech = new_inp_resamp16k[n]; /* reuse existing buffer: shb_speech[L_FRAME16k] */ #endif if ( !st->Opt_SC_VBR && input_Fs >= 32000 && st->hBWE_TD != NULL ) -- GitLab From 22a30e47d312ce1c5d15674b818dc5d46d867940 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 17 Mar 2025 17:08:23 +0100 Subject: [PATCH 09/46] [cleanup] accept NONBE_FIX_GSC_BSTR --- lib_com/bits_alloc.c | 30 ------------------------------ lib_com/gs_inact_switching.c | 9 --------- lib_com/options.h | 1 - lib_com/prot.h | 7 ------- lib_dec/FEC.c | 8 -------- lib_dec/acelp_core_dec.c | 16 ---------------- lib_dec/acelp_core_switch_dec.c | 4 ---- lib_dec/dec_gen_voic.c | 4 ---- lib_dec/gs_dec.c | 4 ---- lib_enc/acelp_core_enc.c | 12 ------------ lib_enc/acelp_core_switch_enc.c | 4 ---- lib_enc/enc_gen_voic.c | 4 ---- lib_enc/ivas_core_pre_proc.c | 4 ---- lib_enc/transition_enc.c | 8 -------- 14 files changed, 115 deletions(-) diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index 281e0640e3..3edc400a47 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -542,9 +542,7 @@ ivas_error config_acelp1( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const int16_t signaling_bits, /* i : number of signaling bits */ const int16_t coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const int16_t tc_subfr, /* i : TC subfr ID */ const int16_t tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ @@ -778,13 +776,9 @@ ivas_error config_acelp1( } /* gain Q bit-budget - part 1: 'Es_pred' of memory-less gain Q */ -#ifdef NONBE_FIX_GSC_BSTR if ( ( coder_type != UNVOICED && coder_type != AUDIO && coder_type != INACTIVE && !( core_brate <= ACELP_8k00 && coder_type != TRANSITION ) ) /* mid bitrates in GC and VC, low+mid bitrates in TC */ || ( coder_type == INACTIVE && !inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - if ( ( coder_type != UNVOICED && coder_type != AUDIO && coder_type != INACTIVE && !( core_brate <= ACELP_8k00 && coder_type != TRANSITION ) ) || ( coder_type == INACTIVE && total_brate > MAX_GSC_INACTIVE_BRATE ) ) -#endif { *nBits_es_Pred = Es_pred_bits_tbl[BIT_ALLOC_IDX( core_brate, coder_type, -1, -1 )]; bits -= *nBits_es_Pred; @@ -877,11 +871,7 @@ ivas_error config_acelp1( } else if ( core_brate >= ACELP_11k60 && ( coder_type != AUDIO && !( coder_type == INACTIVE && L_frame == L_FRAME ) ) ) { -#ifdef NONBE_FIX_GSC_BSTR if ( coder_type == INACTIVE && L_frame == L_FRAME16k && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ -#else - if ( coder_type == INACTIVE && L_frame == L_FRAME16k && total_brate <= MAX_GSC_INACTIVE_BRATE ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ltf_mode = FULL_BAND; } @@ -1065,13 +1055,9 @@ ivas_error config_acelp1( acelp_cfg->fixed_cdk_index[2] = -1; acelp_cfg->fixed_cdk_index[3] = -1; } -#ifdef NONBE_FIX_GSC_BSTR else if ( ( coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO ) || /* @12.8kHz core except of GSC */ ( nb_subfr == NB_SUBFR16k && ( !inactive_coder_type_flag || coder_type != INACTIVE ) ) /* @16kHz core GC, TC, AVQ inactive */ || core == HQ_CORE /* ACELP -> HQ switching in EVS */ ) -#else - else if ( ( coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO ) || ( nb_subfr == NB_SUBFR16k && ( total_brate > MAX_GSC_INACTIVE_BRATE || coder_type != INACTIVE ) ) || core == HQ_CORE ) -#endif { /* pitch Q & gain Q bit-budget - part 2*/ for ( i = 0; i < nb_subfr; i++ ) @@ -1119,13 +1105,9 @@ ivas_error config_acelp1( } /* algebraic codebook bit-budget */ -#ifdef NONBE_FIX_GSC_BSTR if ( flag_hardcoded || /* EVS */ ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - if ( flag_hardcoded || ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) || ( total_brate > MAX_GSC_INACTIVE_BRATE && coder_type == INACTIVE ) ) -#endif { for ( i = 0; i < nb_subfr; i++ ) { @@ -1212,12 +1194,8 @@ ivas_error config_acelp1( } /* AVQ codebook */ -#ifdef NONBE_FIX_GSC_BSTR if ( ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) /* high-birate ACELP except IC */ || ( !inactive_coder_type_flag && coder_type == INACTIVE ) /* AVQ inactive */ ) -#else - if ( ( core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE ) || ( total_brate > MAX_GSC_INACTIVE_BRATE && coder_type == INACTIVE ) ) -#endif { for ( i = 0; i < nb_subfr; i++ ) { @@ -1252,13 +1230,9 @@ ivas_error config_acelp1( } } } -#ifdef NONBE_FIX_GSC_BSTR else if ( ( coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD ) /* LBR secondary channel in TD stereo */ || ( ( coder_type == INACTIVE || coder_type == AUDIO ) && nb_subfr == NB_SUBFR ) /* GSC @12.8kHz */ || ( coder_type == INACTIVE && inactive_coder_type_flag ) /* AVQ inactive */ ) -#else - else if ( ( coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD ) || ( ( coder_type == INACTIVE || coder_type == AUDIO ) && nb_subfr == NB_SUBFR ) || ( coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE ) ) -#endif { int32_t Local_BR, Pitch_BR; int16_t Pitch_CT; @@ -1351,12 +1325,8 @@ ivas_error config_acelp1( /* sanity check */ if ( ( coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO ) || nb_subfr == NB_SUBFR16k ) { -#ifdef NONBE_FIX_GSC_BSTR if ( ( L_frame == L_FRAME16k && coder_type == INACTIVE && inactive_coder_type_flag ) /* GSC Inactive @16kHz */ || ( GSC_IVAS_mode > 0 && L_frame == L_FRAME16k ) ) /* IVAS GSC @16kHz */ -#else - if ( ( L_frame == L_FRAME16k && coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE ) || ( GSC_IVAS_mode > 0 && L_frame == L_FRAME16k ) ) /* GSC Inactive @16kHz */ -#endif { acelp_cfg->ubits = 0; } diff --git a/lib_com/gs_inact_switching.c b/lib_com/gs_inact_switching.c index e7cb216da4..384980f88d 100644 --- a/lib_com/gs_inact_switching.c +++ b/lib_com/gs_inact_switching.c @@ -63,13 +63,8 @@ void inact_switch_ematch( float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ float lt_ener_per_band[], /* i/o: Long term energy per band */ const int16_t coder_type, /* i : Coder type */ -#ifdef NONBE_FIX_GSC_BSTR const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const int16_t L_frame, /* i : Frame length */ -#ifndef NONBE_FIX_GSC_BSTR - const int32_t total_brate, /* i : Total bitrate */ -#endif const int16_t bfi, /* i : frame lost indicator */ const int16_t last_core, /* i : Last core used */ const int16_t last_codec_mode, /* i : Last codec mode */ @@ -110,11 +105,7 @@ void inact_switch_ematch( lt_ener_per_band[i] = Ener_per_bd[i]; } } -#ifdef NONBE_FIX_GSC_BSTR else if ( coder_type == INACTIVE && inactive_coder_type_flag ) -#else - else if ( coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE ) -#endif { /* Find spectrum and energy per band for inactive frames */ edct( exc2, dct_exc_tmp, L_frame, element_mode ); diff --git a/lib_com/options.h b/lib_com/options.h index 6dea2ea9d7..064de7584a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,7 +169,6 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ -#define NONBE_FIX_GSC_BSTR /* VA: issue 1264: Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */ #define NONBE_1273_ISM_METADATA_COUNTER /* VA: issue 1273: fix counter overflow in ISM metadata encoder */ #define NONBE_1279_COUNTER_OVERFLOW /* VA: issue 1279: Avoid possible overflow of counter st->Nb_ACELP_frames */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 9716a89264..496bcc141f 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3568,13 +3568,8 @@ void inact_switch_ematch( float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ float lt_ener_per_band[], /* i/o: long-term energy per band */ const int16_t coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const int16_t L_frame, /* i : frame length */ -#ifndef NONBE_FIX_GSC_BSTR - const int32_t total_brate, /* i : Total bitrate */ -#endif const int16_t bfi, /* i : frame lost indicator */ const int16_t last_core, /* i : Last core used */ const int16_t last_codec_mode, /* i : Last codec mode */ @@ -9109,9 +9104,7 @@ ivas_error config_acelp1( ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ const int16_t signaling_bits, /* i : number of signaling bits */ const int16_t coder_type, /* i : coder type */ -#ifdef NONBE_FIX_GSC_BSTR const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ -#endif const int16_t tc_subfr, /* i : TC subfr ID */ const int16_t tc_call, /* i : TC call number (0,1,2) */ int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ diff --git a/lib_dec/FEC.c b/lib_dec/FEC.c index b4742e5765..7c81376368 100644 --- a/lib_dec/FEC.c +++ b/lib_dec/FEC.c @@ -332,11 +332,7 @@ void FEC_exc_estim( * Replicate the last spectrum in case the last good frame was coded by GSC *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->inactive_coder_type_flag && !st->Opt_AMR_WB ) -#else - if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= MAX_GSC_INACTIVE_BRATE && !st->Opt_AMR_WB ) -#endif { /* Replication of the last spectrum, with a slight downscaling of its dynamic */ st->GSC_noisy_speech = st->Last_GSC_noisy_speech_flag; @@ -409,11 +405,7 @@ void FEC_exc_estim( * Total excitation *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->inactive_coder_type_flag && !st->Opt_AMR_WB ) -#else - if ( ( st->last_coder_type == AUDIO || st->last_good == INACTIVE_CLAS ) && st->total_brate <= MAX_GSC_INACTIVE_BRATE && !st->Opt_AMR_WB ) -#endif { /* For GSC - the excitation is already computed */ mvr2r( exc, exc2, st->L_frame ); diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index d002403eb9..46a3ec3014 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -613,19 +613,11 @@ ivas_error acelp_core_dec( nb_bits = -1; } -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif if ( st->coder_type == TRANSITION && tc_subfr < L_SUBFR && st->L_frame == L_FRAME ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } } @@ -847,11 +839,7 @@ ivas_error acelp_core_dec( * Apply energy matching when switching to inactive frames *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR inact_switch_ematch( exc2, dct_exc_tmp, st->hGSCDec->lt_ener_per_band, st->coder_type, st->inactive_coder_type_flag, st->L_frame, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#else - inact_switch_ematch( exc2, dct_exc_tmp, st->hGSCDec->lt_ener_per_band, st->coder_type, st->L_frame, st->total_brate, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#endif /*------------------------------------------------------------* * Decode information and modify the excitation signal of stationary unvoiced frames @@ -987,11 +975,7 @@ ivas_error acelp_core_dec( } /* Apply energy matching when switching to inactive frames */ -#ifdef NONBE_FIX_GSC_BSTR inact_switch_ematch( exc2, dct_exc_tmp, st->hGSCDec->lt_ener_per_band, st->coder_type, st->inactive_coder_type_flag, st->L_frame, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#else - inact_switch_ematch( exc2, dct_exc_tmp, st->hGSCDec->lt_ener_per_band, st->coder_type, st->L_frame, st->total_brate, st->bfi, st->last_core, st->last_codec_mode, tdm_low_rate_mode, st->element_mode ); -#endif /* update past excitation signals for LD music post-filter */ if ( st->hMusicPF != NULL ) { diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index 16a3c5be2e..cedc755794 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -158,11 +158,7 @@ ivas_error acelp_core_switch_dec( * Excitation decoding *----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, st->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, st->active_cnt, 0, 0, 0 /*st->GSC_IVAS_mode*/ ); -#else - config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, st->active_cnt, 0, 0, 0 /*st->GSC_IVAS_mode*/ ); -#endif decod_gen_voic_core_switch( st, L_frame_for_cs, 0, Aq, exc, cbrate ); diff --git a/lib_dec/dec_gen_voic.c b/lib_dec/dec_gen_voic.c index 978b7c036a..06dd4f2f05 100644 --- a/lib_dec/dec_gen_voic.c +++ b/lib_dec/dec_gen_voic.c @@ -174,11 +174,7 @@ ivas_error decod_gen_voic( * Transform-domain contribution decoding (inactive frames) *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR if ( !st->inactive_coder_type_flag && st->coder_type == INACTIVE ) -#else - if ( st->total_brate >= MAX_GSC_INACTIVE_BRATE && st->coder_type == INACTIVE ) -#endif { transf_cdbk_dec( st, 0, i_subfr, Es_pred, gain_code, &gain_preQ, &norm_gain_preQ, code_preQ, unbits ); } diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index 4d019f80a0..a04a8c6837 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -111,11 +111,7 @@ void decod_audio( } /* set bit-allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, -1, 1, &nb_bits, NULL, st->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, -1, 1, &nb_bits, NULL, st->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif /*---------------------------------------------------------------* * Decode energy dynamics diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index 23a43e3061..b5bd866bed 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -379,11 +379,7 @@ ivas_error acelp_core_enc( if ( !nelp_mode && !ppp_mode ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*-----------------------------------------------------------------* @@ -503,11 +499,7 @@ ivas_error acelp_core_enc( { tc_classif_enc( st->L_frame, &tc_subfr, &position, attack_flag, st->pitch[0], res ); -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif } /*---------------------------------------------------------------* @@ -565,11 +557,7 @@ ivas_error acelp_core_enc( lsf_syn_mem_restore( st, tilt_code_bck, gc_threshold_bck, clip_var_bck, next_force_sf_bck, lsp_new, lsp_mid, clip_var, mem_AR, mem_MA, lsp_new_bck, lsp_mid_bck, Bin_E, Bin_E_old, mem_syn_bck, mem_w0_bck, streaklimit, pstreaklen ); /* Configure ACELP bit allocation */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); -#endif /* redo LSF quantization */ lsf_enc( st, lsf_new, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL ); diff --git a/lib_enc/acelp_core_switch_enc.c b/lib_enc/acelp_core_switch_enc.c index d06d6cef55..b169adc8fb 100644 --- a/lib_enc/acelp_core_switch_enc.c +++ b/lib_enc/acelp_core_switch_enc.c @@ -153,11 +153,7 @@ void acelp_core_switch_enc( * Excitation encoding *----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st->inactive_coder_type_flag, -1, -1, &j, &i, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1( ENC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, -1, -1, &j, &i, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); -#endif encod_gen_voic_core_switch( st, st->last_L_frame, inp, Aq, A, T_op, st->voicing, exc, cbrate ); diff --git a/lib_enc/enc_gen_voic.c b/lib_enc/enc_gen_voic.c index 0d2713b0f9..f05f1a87c8 100644 --- a/lib_enc/enc_gen_voic.c +++ b/lib_enc/enc_gen_voic.c @@ -255,11 +255,7 @@ void encod_gen_voic( * Transform-domain contribution (inactive frames) *-----------------------------------------------------------------*/ -#ifdef NONBE_FIX_GSC_BSTR if ( !st->inactive_coder_type_flag && st->coder_type == INACTIVE ) -#else - if ( st->total_brate >= MAX_GSC_INACTIVE_BRATE && st->coder_type == INACTIVE ) -#endif { transf_cdbk_enc( st, 0, i_subfr, cn, exc, p_Aq, p_Aw, h1, xn, xn2, y1, y2, Es_pred, &gain_pit, gain_code, g_corr, clip_gain, &gain_preQ, code_preQ, unbits ); } diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index 026a9ff3fa..969e02235a 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -209,11 +209,7 @@ ivas_error pre_proc_ivas( } else if ( st->total_brate > MAX_GSC_INACTIVE_BRATE && ( ( st->vad_flag == 0 && st->bwidth >= SWB && st->max_bwidth >= SWB ) || ( st->localVAD == 0 && ( st->bwidth <= WB || st->max_bwidth <= WB ) ) ) ) { -#ifdef NONBE_FIX_GSC_BSTR /* inactive frames will be coded by AVQ technology (exceptionally it can be later rewritten to GSC technology in ivas_combined_format_brate_sanity()) */ -#else - /* inactive frames will be coded by AVQ technology */ -#endif st->coder_type = INACTIVE; } diff --git a/lib_enc/transition_enc.c b/lib_enc/transition_enc.c index e2be62f565..016f5ba0fa 100644 --- a/lib_enc/transition_enc.c +++ b/lib_enc/transition_enc.c @@ -178,11 +178,7 @@ void transition_enc( if ( *tc_subfr == TC_0_0 ) { /* this is called only to compute unused bits */ -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#endif } *clip_gain = gp_clip( st->element_mode, st->core_brate, st->voicing, i_subfr, TRANSITION, xn, gp_cl ); @@ -278,11 +274,7 @@ void transition_enc( if ( i_subfr - *tc_subfr <= L_SUBFR ) { -#ifdef NONBE_FIX_GSC_BSTR config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#else - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); -#endif } /*-----------------------------------------------------------------* -- GitLab From d7f2126e9f4a9ff7c83e9f6c548ab8a3d7c0cfb2 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 17 Mar 2025 17:09:18 +0100 Subject: [PATCH 10/46] [cleanup] accept NONBE_1273_ISM_METADATA_COUNTER --- lib_com/options.h | 1 - lib_enc/ivas_ism_metadata_enc.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 064de7584a..c44e3d1bbb 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,7 +169,6 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ -#define NONBE_1273_ISM_METADATA_COUNTER /* VA: issue 1273: fix counter overflow in ISM metadata encoder */ #define NONBE_1279_COUNTER_OVERFLOW /* VA: issue 1279: Avoid possible overflow of counter st->Nb_ACELP_frames */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index cb2a743885..a8c224d176 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -276,9 +276,7 @@ ivas_error ivas_ism_metadata_enc( } else if ( hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX ) { -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; -#endif lowrate_metadata_flag[ch] = 1; hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; @@ -558,9 +556,7 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { hIsmMeta[ch]->ism_md_fec_cnt_enc++; -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ); -#endif } else { @@ -705,9 +701,7 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { hIsmMeta[ch]->ism_md_fec_cnt_enc++; -#ifdef NONBE_1273_ISM_METADATA_COUNTER hIsmMeta[ch]->ism_md_fec_cnt_enc = min( hIsmMeta[ch]->ism_md_fec_cnt_enc, ISM_MD_FEC_CNT_MAX ); -#endif } else { -- GitLab From ed7ce757a3988677588988218454fcf3391c3f2e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 17 Mar 2025 17:11:36 +0100 Subject: [PATCH 11/46] [cleanup] accept NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD --- lib_com/cnst.h | 2 -- lib_com/options.h | 2 -- lib_enc/acelp_core_enc.c | 4 ---- lib_enc/dtx.c | 16 ---------------- lib_enc/ivas_ism_dtx_enc.c | 4 ---- 5 files changed, 28 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index f751ae3234..2108ab81c6 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -742,9 +742,7 @@ typedef enum #define GAIN_PRED_ORDER 4 /* Gain quantization - prediction order for gain quantizer (only for AMR-WB IO mode) */ #define MEAN_ENER 30 /* Gain quantization - average innovation energy */ -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD #define DTX_THR 5 /* DTX - lp_noise threshold for DTX at higher bitrates */ -#endif #define DTX_HIST_SIZE 8 /* CNG & DTX - number of last signal frames used for CNG averaging */ #define CNG_ISF_FACT 0.9f /* CNG & DTX - CNG spectral envelope smoothing factor */ diff --git a/lib_com/options.h b/lib_com/options.h index c44e3d1bbb..06e066877b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,10 +169,8 @@ /* any switch which is non-be wrt selection floating point code */ /* all switches in this category should start with "NONBE_" */ -#define NONBE_1279_COUNTER_OVERFLOW /* VA: issue 1279: Avoid possible overflow of counter st->Nb_ACELP_frames */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ -#define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD /* VA/Eri: issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */ #define NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL /* Nokia: add fix for precision limitation in comparison with masa2total energy ratio threshold to be aligned with BASOP*/ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index b5bd866bed..cf43042ce0 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -167,14 +167,10 @@ ivas_error acelp_core_enc( { st->Nb_ACELP_frames = 0; } -#ifdef NONBE_1279_COUNTER_OVERFLOW if ( st->Nb_ACELP_frames < MAX16B ) { st->Nb_ACELP_frames++; } -#else - st->Nb_ACELP_frames++; -#endif if ( st->L_frame == L_FRAME ) { diff --git a/lib_enc/dtx.c b/lib_enc/dtx.c index bc777daf66..8c2ec5f7ab 100644 --- a/lib_enc/dtx.c +++ b/lib_enc/dtx.c @@ -66,9 +66,7 @@ #define MAX_BRATE_DTX_EVS ACELP_24k40 /* maximum bitrate to which the default DTX is applied in EVS; otherwise DTX is applied only in silence */ #define MAX_BRATE_DTX_IVAS IVAS_80k /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */ -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD #define DTX_THR_EVS 15 /* lp_noise threshold for DTX at higher bitrates in EVS */ // ToDo: to be removed once EVS is CR fixed -#endif /*-------------------------------------------------------------------* * Local function prototypes @@ -94,7 +92,6 @@ void dtx( DTX_ENC_HANDLE hDtxEnc = st->hDtxEnc; int16_t last_br_cng_flag, last_br_flag, br_dtx_flag; int32_t total_brate_ref; -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD int16_t dtx_thr; dtx_thr = DTX_THR; @@ -102,7 +99,6 @@ void dtx( { dtx_thr = DTX_THR_EVS; // ToDo: to be removed once EVS is CR fixed } -#endif total_brate_ref = st->total_brate; @@ -113,18 +109,10 @@ void dtx( } else { -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD last_br_cng_flag = st->last_total_brate_cng <= MAX_BRATE_DTX_EVS || st->lp_noise < dtx_thr || ( st->element_mode == IVAS_SCE && st->last_total_brate_cng <= MAX_BRATE_DTX_IVAS ); -#else - last_br_cng_flag = st->last_total_brate_cng <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate_cng <= MAX_BRATE_DTX_IVAS ); -#endif last_br_flag = ( st->element_mode == EVS_MONO && st->last_total_brate <= MAX_BRATE_DTX_EVS ) || ( st->element_mode != EVS_MONO && last_ivas_total_brate <= MAX_BRATE_DTX_IVAS ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD st->lp_noise < dtx_thr; -#else - st->lp_noise < 15; -#endif } /* Initialization */ @@ -203,11 +191,7 @@ void dtx( { br_dtx_flag = ( st->element_mode == EVS_MONO && st->total_brate <= MAX_BRATE_DTX_EVS ) || ( st->element_mode != EVS_MONO && ivas_total_brate <= MAX_BRATE_DTX_IVAS ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD st->lp_noise < dtx_thr; -#else - st->lp_noise < 15; -#endif } if ( st->Opt_DTX_ON && vad == 0 && diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 7c7114d6ea..77bdd62711 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -155,11 +155,7 @@ int16_t ivas_ism_dtx_enc( ( nchan_ism == 2 && ivas_total_brate <= IVAS_48k ) || ( nchan_ism == 3 && ivas_total_brate <= IVAS_80k ) || ( nchan_ism == 4 && ivas_total_brate <= IVAS_96k ) || -#ifdef NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD lp_noise_max < DTX_THR ) ) -#else - lp_noise_max < 15 ) ) -#endif { dtx_flag = 0; } -- GitLab From 0c475ebf50e1e3640bae156445fc401e73fc560e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 17 Mar 2025 17:14:03 +0100 Subject: [PATCH 12/46] [cleanup] accept NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL --- lib_com/ivas_cnst.h | 2 - lib_com/ivas_prot.h | 2 - lib_com/ivas_rom_com.c | 2 - lib_com/ivas_rom_com.h | 2 - lib_com/ivas_tools.c | 4 -- lib_com/options.h | 1 - lib_dec/ivas_qmetadata_dec.c | 107 ----------------------------------- lib_enc/ivas_qmetadata_enc.c | 66 --------------------- 8 files changed, 186 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 1931b48b36..8a9e8dea19 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1145,9 +1145,7 @@ enum #define BITS_MASA2TOTTAL_DCT0 6 #define STEP_M2T 0.1f -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #define STEP_M2T_FX 214748365 // Q31 -#endif #define MASA_HEADER_BITS 2 #define MASA_SUBFRAME_BITS 1 #define MASA_LOWBITRATE_MODE_BITS 1 diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 102e67effa..ad871926d0 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -756,7 +756,6 @@ int16_t get_igf_startline( float rand_triangular_signed( int16_t *seed ); -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL Word16 matrix_product_fx( const Word32 *X_fx, /* i : left hand matrix Qx*/ const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ @@ -780,7 +779,6 @@ Word16 matrix_product_q30_fx( const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication Q0*/ Word32 *Z_fx /* o : resulting matrix after the matrix multiplication Q30*/ ); -#endif void dtx_read_padding_bits( diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index e3b9917899..7d84b0a739 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2778,7 +2778,6 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = }; /* column wise DCT matrices for 4 5, and 8 dim */ -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL const Word32 dct4_fx[4 * 4] = { // Q31 1073741824, 1402951040, 1073741824, 581109056, 1073741824, 581109056, -1073741824, -1402951040, @@ -2819,7 +2818,6 @@ const Word32 dct12_fx[12 * 12] = { // Q31 619978560, -335436960, 0, 335436960, -619978560, 810030848, -876602816, 810030848, -619978560, 335436960, 619978560, -869301376, 846752832, -810030848, 759350208, -695569984, 619978560, -533649696, 438301408, -335436960, 226989024, -114460880 }; -#endif const float dct4[4*4] = { 0.5000f, 0.6533f, 0.5000f, 0.2706f, diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index fe51dbdf3b..3bf30289b6 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -325,12 +325,10 @@ extern const float McMASA_LFEGain_vectors[64]; *----------------------------------------------------------------------------------*/ extern const int32_t sep_object_brate[][MAX_NUM_OBJECTS]; -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL extern const Word32 dct4_fx[]; extern const Word32 dct5_fx[]; extern const Word32 dct8_fx[]; extern const Word32 dct12_fx[]; -#endif extern const float dct4[]; extern const float dct5[]; extern const float dct8[]; diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index ed41a0638f..36c626daa7 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -41,9 +41,7 @@ #include "ivas_prot.h" #include "wmc_auto.h" #include "ivas_rom_com.h" -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #include "basop_settings.h" -#endif /*--------------------------------------------------------------- * sumAbs() @@ -1277,7 +1275,6 @@ float rand_triangular_signed( return 0.5f - 0.5f * sqrtf( 1.0f - rand_val ); } } -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL Word16 matrix_product_fx( const Word32 *X_fx, /* i : left hand matrix Qx*/ const Word16 rowsX, /* i : number of rows of the left hand matrix Q0*/ @@ -1515,4 +1512,3 @@ Word16 matrix_product_q30_fx( return EXIT_SUCCESS; } -#endif diff --git a/lib_com/options.h b/lib_com/options.h index 06e066877b..f2fe9b93f2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,7 +172,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ -#define NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL /* Nokia: add fix for precision limitation in comparison with masa2total energy ratio threshold to be aligned with BASOP*/ /* ##################### End NON-BE switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 975e39a6f6..acb094019f 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -40,9 +40,7 @@ #include "ivas_rom_dec.h" #include "wmc_auto.h" #include "prot.h" -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #include "basop_settings.h" -#endif /*-----------------------------------------------------------------------* @@ -102,11 +100,7 @@ static int16_t read_surround_coherence_hr( uint16_t *bitstream, int16_t *p_bit_p static int16_t read_coherence_data_hr_512( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir, const int16_t nbits_coh ); static void read_stream_dct_coeffs_omasa( int16_t *q_idx, -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL Word32 *q_dct_data_fx, -#else - float *q_dct_data, -#endif const int16_t len_stream, uint16_t *bit_stream, int16_t *index, @@ -4261,11 +4255,7 @@ static void decode_combined_index( static void read_stream_dct_coeffs_omasa( int16_t *q_idx, -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL Word32 *q_dct_data_fx, -#else - float *q_dct_data, -#endif const int16_t len_stream, uint16_t *bit_stream, int16_t *index, @@ -4273,16 +4263,9 @@ static void read_stream_dct_coeffs_omasa( { int16_t sign; int16_t i, j, i_min; -#ifndef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL - float step; -#endif int16_t GR1, GR2; -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL int64_t step_fx; step_fx = STEP_M2T_FX; -#else - step = STEP_M2T; -#endif sign = 1; if ( first_line == 0 ) { @@ -4347,7 +4330,6 @@ static void read_stream_dct_coeffs_omasa( } /* deindex */ -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL q_dct_data_fx[0] = (Word32) ( ( step_fx * q_idx[0] ) >> 6 ); /* Q25 */ for ( i = 1; i < len_stream; i++ ) { @@ -4360,20 +4342,6 @@ static void read_stream_dct_coeffs_omasa( q_dct_data_fx[i] = (Word32) ( ( step_fx * ( q_idx[i] + 1 ) ) >> 7 ); /* Q25 */ } } -#else - q_dct_data[0] = q_idx[0] * step; - for ( i = 1; i < len_stream; i++ ) - { - if ( ( q_idx[i] % 2 ) == 0 ) - { - q_dct_data[i] = -( q_idx[i] >> 1 ) * step; - } - else - { - q_dct_data[i] = ( ( q_idx[i] + 1 ) >> 1 ) * step; - } - } -#endif return; } @@ -4392,13 +4360,8 @@ void ivas_omasa_decode_masa_to_total( { int16_t i, j, k; int16_t q_idx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL Word32 q_dct_data_fx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], dct_data_tmp_fx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; -#else - float q_dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], - dct_data_tmp[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; -#endif int16_t n_streams, len_stream; /* Setup coding parameters */ @@ -4414,16 +4377,11 @@ void ivas_omasa_decode_masa_to_total( for ( i = 0; i < n_streams; i++ ) { read_stream_dct_coeffs_omasa( &q_idx[i * len_stream], -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL &q_dct_data_fx[i * len_stream], -#else - &q_dct_data[i * len_stream], -#endif len_stream, bit_stream, index, i == 0 ); } /* inverse DCT2 transform */ -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL SWITCH( len_stream ) { case 4: @@ -4501,70 +4459,5 @@ void ivas_omasa_decode_masa_to_total( } } -#else - switch ( len_stream ) - { - case 4: - matrix_product( dct4, nblocks, nblocks, 1, q_dct_data, nblocks, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nblocks ); - break; - case 5: - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 8: - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 12: - matrix_product( dct12, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 20: - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); /* reuse of variable*/ - break; - case 32: - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); - break; - default: - printf( "Incorrect number of coefficients for OMASA.\n" ); - break; - } - - k = 0; - for ( i = 0; i < nblocks; i++ ) - { - for ( j = 0; j < nbands; j++ ) - { - masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); - masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); - k++; - } - } - - if ( nblocks == 1 ) - { - for ( i = 1; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - for ( j = 0; j < nbands; j++ ) - { - masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[0][j]; - } - } - } - - if ( nbands == 1 ) - { - for ( j = 1; j < 5; j++ ) - { - for ( i = 0; i < nblocks; i++ ) - { - masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[i][0]; - } - } - } -#endif return; } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 87a921b69b..7d0b44f599 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -41,9 +41,7 @@ #include "ivas_stat_enc.h" #include "wmc_auto.h" #include "prot.h" -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL #include "basop_settings.h" -#endif /*-----------------------------------------------------------------------* * Local function prototypes @@ -6040,13 +6038,11 @@ void ivas_omasa_encode_masa_to_total( int16_t bits_pos, nb_bits; int16_t n_streams, len_stream; -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL Word32 q_dct_data_fx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], dct_data_tmp_fx[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; int64_t step_fx; step_fx = STEP_M2T_FX; -#endif #ifdef DEBUG_MODE_QMETADATA static FILE *pF = NULL; static FILE *pF_ratio = NULL; @@ -6155,7 +6151,6 @@ void ivas_omasa_encode_masa_to_total( } /* reconstruct masa2total */ -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL q_dct_data_fx[0] = (Word32) ( ( step_fx * q_idx[0] ) >> 6 ); // Q25 for ( i = 1; i < len_stream; i++ ) { @@ -6245,67 +6240,6 @@ void ivas_omasa_encode_masa_to_total( } } -#else - q_dct_data[0] = q_idx[0] * step; - for ( i = 1; i < len_stream; i++ ) - { - if ( ( q_idx[i] % 2 ) == 0 ) - { - q_dct_data[i] = -( q_idx[i] >> 1 ) * step; - } - else - { - q_dct_data[i] = ( ( q_idx[i] + 1 ) >> 1 ) * step; - } - } - - /* inverse DCT2 transform */ - switch ( len_stream ) - { - case 4: - matrix_product( dct4, nblocks, nblocks, 1, q_dct_data, nblocks, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nblocks ); - break; - case 5: - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 8: - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 12: - matrix_product( dct12, nbands, nbands, 1, q_dct_data, nbands, 1, 0, dct_data_tmp ); - mvr2r( dct_data_tmp, q_dct_data, nbands ); - break; - case 20: - matrix_product( dct5, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); /* reuse of variable*/ - break; - case 32: - matrix_product( dct8, nbands, nbands, 1, q_dct_data, nbands, nblocks, 0, dct_data_tmp ); - matrix_product( dct_data_tmp, nbands, nblocks, 0, dct4, nblocks, nblocks, 0, q_dct_data ); - break; - default: - printf( "Incorrect number of coefficients for OMASA.\n" ); - break; - } - - k = 0; - for ( i = 0; i < nblocks; i++ ) - { - for ( j = 0; j < nbands; j++ ) - { - masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); - masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); -#ifdef NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL - int_tmp = (int32_t) ( MASA_SUR_COH_PRECISION * masa_to_total_energy_ratio[i][j] ); - masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA_SUR_COH_THRESHOLD ); -#endif - k++; - } - } -#endif assert( nb_bits == ( hMetaData->nb_bits_tot - bits_pos ) ); #ifdef DEBUG_MODE_QMETADATA -- GitLab From 33274c201bb057829304bee929d5cc3017d6875f Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 17 Mar 2025 17:15:25 +0100 Subject: [PATCH 13/46] formatting --- lib_com/bits_alloc.c | 48 ++++++++++++------------- lib_com/gs_inact_switching.c | 20 +++++------ lib_com/prot.h | 68 ++++++++++++++++++------------------ 3 files changed, 68 insertions(+), 68 deletions(-) diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index 3edc400a47..7f7e34b3f5 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -531,31 +531,31 @@ static ivas_error acelp_FCB_allocator( *--------------------------------------------------------------------*/ ivas_error config_acelp1( - const int16_t enc_dec, /* i : encoder/decoder flag */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t core_brate_inp, /* i : core bitrate */ - const int16_t core, /* i : core */ - const int16_t extl, /* i : extension layer */ - const int32_t extl_brate, /* i : extension layer bitrate */ - const int16_t L_frame, /* i : frame length at internal Fs */ - const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const int16_t signaling_bits, /* i : number of signaling bits */ - const int16_t coder_type, /* i : coder type */ + const int16_t enc_dec, /* i : encoder/decoder flag */ + const int32_t total_brate, /* i : total bitrate */ + const int32_t core_brate_inp, /* i : core bitrate */ + const int16_t core, /* i : core */ + const int16_t extl, /* i : extension layer */ + const int32_t extl_brate, /* i : extension layer bitrate */ + const int16_t L_frame, /* i : frame length at internal Fs */ + const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const int16_t signaling_bits, /* i : number of signaling bits */ + const int16_t coder_type, /* i : coder type */ const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const int16_t tc_subfr, /* i : TC subfr ID */ - const int16_t tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ - int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - int16_t *unbits, /* o : number of unused bits */ - const int16_t element_mode, /* i : element mode */ - int16_t *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const int16_t idchan, /* i : stereo channel ID */ - const int16_t active_cnt, /* i : Active frame counter */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ + const int16_t tc_subfr, /* i : TC subfr ID */ + const int16_t tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */ + int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + int16_t *unbits, /* o : number of unused bits */ + const int16_t element_mode, /* i : element mode */ + int16_t *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const int16_t idchan, /* i : stereo channel ID */ + const int16_t active_cnt, /* i : Active frame counter */ + const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ ) { int16_t i, bits, nb_subfr; diff --git a/lib_com/gs_inact_switching.c b/lib_com/gs_inact_switching.c index 384980f88d..1d6d06525f 100644 --- a/lib_com/gs_inact_switching.c +++ b/lib_com/gs_inact_switching.c @@ -59,17 +59,17 @@ *-------------------------------------------------------------------*/ void inact_switch_ematch( - float exc2[], /* i/o: CELP/GSC excitation buffer */ - float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ - float lt_ener_per_band[], /* i/o: Long term energy per band */ - const int16_t coder_type, /* i : Coder type */ + float exc2[], /* i/o: CELP/GSC excitation buffer */ + float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ + float lt_ener_per_band[], /* i/o: Long term energy per band */ + const int16_t coder_type, /* i : Coder type */ const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const int16_t L_frame, /* i : Frame length */ - const int16_t bfi, /* i : frame lost indicator */ - const int16_t last_core, /* i : Last core used */ - const int16_t last_codec_mode, /* i : Last codec mode */ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ - const int16_t element_mode /* i : element mode */ + const int16_t L_frame, /* i : Frame length */ + const int16_t bfi, /* i : frame lost indicator */ + const int16_t last_core, /* i : Last core used */ + const int16_t last_codec_mode, /* i : Last codec mode */ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ + const int16_t element_mode /* i : element mode */ ) { float Ener_per_bd[MBANDS_GN16k]; diff --git a/lib_com/prot.h b/lib_com/prot.h index 496bcc141f..96a1297f08 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3564,17 +3564,17 @@ void highband_exc_dct_in( ); void inact_switch_ematch( - float exc2[], /* i/o: CELP/GSC excitation buffer */ - float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ - float lt_ener_per_band[], /* i/o: long-term energy per band */ - const int16_t coder_type, /* i : coder type */ + float exc2[], /* i/o: CELP/GSC excitation buffer */ + float dct_exc_tmp[], /* i : GSC excitation in DCT domain */ + float lt_ener_per_band[], /* i/o: long-term energy per band */ + const int16_t coder_type, /* i : coder type */ const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const int16_t L_frame, /* i : frame length */ - const int16_t bfi, /* i : frame lost indicator */ - const int16_t last_core, /* i : Last core used */ - const int16_t last_codec_mode, /* i : Last codec mode */ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ - const int16_t element_mode /* i : element mode */ + const int16_t L_frame, /* i : frame length */ + const int16_t bfi, /* i : frame lost indicator */ + const int16_t last_core, /* i : Last core used */ + const int16_t last_codec_mode, /* i : Last codec mode */ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ + const int16_t element_mode /* i : element mode */ ); void music_postfilt_init( @@ -9093,31 +9093,31 @@ int16_t BITS_ALLOC_config_acelp( ); ivas_error config_acelp1( - const int16_t enc_dec, /* i : encoder/decoder flag */ - const int32_t total_brate, /* i : total bitrate */ - const int32_t core_brate_inp, /* i : core bitrate */ - const int16_t core, /* i : core */ - const int16_t extl, /* i : extension layer */ - const int32_t extl_brate, /* i : extension layer bitrate */ - const int16_t L_frame, /* i : frame length at internal Fs */ - const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ - ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ - const int16_t signaling_bits, /* i : number of signaling bits */ - const int16_t coder_type, /* i : coder type */ + const int16_t enc_dec, /* i : encoder/decoder flag */ + const int32_t total_brate, /* i : total bitrate */ + const int32_t core_brate_inp, /* i : core bitrate */ + const int16_t core, /* i : core */ + const int16_t extl, /* i : extension layer */ + const int32_t extl_brate, /* i : extension layer bitrate */ + const int16_t L_frame, /* i : frame length at internal Fs */ + const int16_t GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */ + ACELP_config *acelp_cfg, /* i : ACELP bit-allocation */ + const int16_t signaling_bits, /* i : number of signaling bits */ + const int16_t coder_type, /* i : coder type */ const int16_t inactive_coder_type_flag, /* i : AVQ (0) or GSC (1) IC flag */ - const int16_t tc_subfr, /* i : TC subfr ID */ - const int16_t tc_call, /* i : TC call number (0,1,2) */ - int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ - int16_t *unbits, /* o : number of unused bits */ - const int16_t element_mode, /* i : element mode */ - int16_t *uc_two_stage_flag, /* o : flag undicating two-stage UC */ - const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel*/ - const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ - const int16_t idchan, /* i : channel id */ - const int16_t active_cnt, /* i : Active frame counter */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ + const int16_t tc_subfr, /* i : TC subfr ID */ + const int16_t tc_call, /* i : TC call number (0,1,2) */ + int16_t *nBits_es_Pred, /* o : number of bits for Es_pred Q */ + int16_t *unbits, /* o : number of unused bits */ + const int16_t element_mode, /* i : element mode */ + int16_t *uc_two_stage_flag, /* o : flag undicating two-stage UC */ + const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel*/ + const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ + const int16_t idchan, /* i : channel id */ + const int16_t active_cnt, /* i : Active frame counter */ + const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ + const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ ); /*! r: ACELP16k flag */ -- GitLab From 564eb84feb0423688dcfecffc9105073399e344b Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 18 Mar 2025 09:48:12 +0100 Subject: [PATCH 14/46] issue 1298: Memory saving in ivas_core_enc(); under FIX_1298_MEMORY_OPT_IVAS_CORE_ENC --- lib_com/options.h | 1 + lib_enc/ivas_core_enc.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index f2fe9b93f2..3644edb3ca 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,6 +161,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define FIX_1285_RENDER_CONFIG_PTR_COMPARE /* Philips: Warning about pointer comparison in the render config reader */ +#define FIX_1298_MEMORY_OPT_IVAS_CORE_ENC /* VA: issue 1298: Memory saving in ivas_core_enc() */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index d690e0a52d..8cbaf6de4a 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -90,8 +90,13 @@ ivas_error ivas_core_enc( float *inp[CPE_CHANNELS]; float new_inp_resamp16k[CPE_CHANNELS][L_FRAME16k]; /* new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ float old_syn_12k8_16k[CPE_CHANNELS][L_FRAME16k]; /* ACELP core synthesis at 12.8kHz or 16kHz to be used by the SWB BWE */ +#ifdef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC + float *shb_speech; + float *hb_speech; +#else float shb_speech[L_FRAME16k]; float hb_speech[L_FRAME16k / 4]; +#endif float *new_swb_speech; float new_swb_speech_buffer[L_FRAME48k + STEREO_DFT_OVL_MAX]; float bwe_exc_extended[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; @@ -154,8 +159,9 @@ ivas_error ivas_core_enc( input_Fs = sts[0]->input_Fs; input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); - +#ifdef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC set_f( new_swb_speech_buffer, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); +#endif for ( n = 0; n < n_CoreChannels; n++ ) { @@ -336,6 +342,10 @@ ivas_error ivas_core_enc( * WB BWE encoding *---------------------------------------------------------------------*/ +#ifdef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC + hb_speech = new_swb_speech_buffer; /* reuse existing buffer: hb_speech[L_FRAME16k/4]; */ +#endif + if ( input_Fs >= 16000 && st->bwidth < SWB && st->hBWE_TD != NULL ) { /* Common pre-processing for WB TBE and WB BWE */ @@ -359,6 +369,10 @@ ivas_error ivas_core_enc( *---------------------------------------------------------------------*/ new_swb_speech = new_swb_speech_buffer + STEREO_DFT_OVL_MAX; +#ifdef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC + set_f( new_swb_speech_buffer, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); + shb_speech = new_inp_resamp16k[n]; /* reuse existing buffer: shb_speech[L_FRAME16k] */ +#endif if ( !st->Opt_SC_VBR && input_Fs >= 32000 && st->hBWE_TD != NULL ) { -- GitLab From 3f961faecebb1ddb2ad18e3bb57667a578c3df98 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 18 Mar 2025 09:50:01 +0100 Subject: [PATCH 15/46] revert memory saving part --- lib_enc/ivas_core_enc.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 945fa81f63..7ee5bc83bf 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -90,13 +90,8 @@ ivas_error ivas_core_enc( float *inp[CPE_CHANNELS]; float new_inp_resamp16k[CPE_CHANNELS][L_FRAME16k]; /* new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ float old_syn_12k8_16k[CPE_CHANNELS][L_FRAME16k]; /* ACELP core synthesis at 12.8kHz or 16kHz to be used by the SWB BWE */ -#ifdef SIMPLIFY_IVAS_CORE - float *shb_speech; - float *hb_speech; -#else float shb_speech[L_FRAME16k]; float hb_speech[L_FRAME16k / 4]; -#endif float *new_swb_speech; float new_swb_speech_buffer[L_FRAME48k + STEREO_DFT_OVL_MAX]; float bwe_exc_extended[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; @@ -160,9 +155,8 @@ ivas_error ivas_core_enc( input_Fs = sts[0]->input_Fs; input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); -#ifndef SIMPLIFY_IVAS_CORE set_f( new_swb_speech_buffer, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); -#endif + for ( n = 0; n < n_CoreChannels; n++ ) { st = sts[n]; @@ -346,10 +340,6 @@ ivas_error ivas_core_enc( * WB BWE encoding *---------------------------------------------------------------------*/ -#ifdef SIMPLIFY_IVAS_CORE - hb_speech = new_swb_speech_buffer; /* reuse existing buffer: hb_speech[L_FRAME16k/4]; */ - -#endif if ( input_Fs >= 16000 && st->bwidth < SWB && st->hBWE_TD != NULL ) { /* Common pre-processing for WB TBE and WB BWE */ @@ -373,10 +363,6 @@ ivas_error ivas_core_enc( *---------------------------------------------------------------------*/ new_swb_speech = new_swb_speech_buffer + STEREO_DFT_OVL_MAX; -#ifdef SIMPLIFY_IVAS_CORE - set_f( new_swb_speech_buffer, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); - shb_speech = new_inp_resamp16k[n]; /* reuse existing buffer: shb_speech[L_FRAME16k] */ -#endif if ( !st->Opt_SC_VBR && input_Fs >= 32000 && st->hBWE_TD != NULL ) { -- GitLab From 9fa0110aa167ca16e2c974a0f9992b1844cb760b Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 18 Mar 2025 09:52:54 +0100 Subject: [PATCH 16/46] fix --- lib_enc/ivas_core_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 8cbaf6de4a..72b1b686d4 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -159,7 +159,7 @@ ivas_error ivas_core_enc( input_Fs = sts[0]->input_Fs; input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); -#ifdef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC +#ifndef FIX_1298_MEMORY_OPT_IVAS_CORE_ENC set_f( new_swb_speech_buffer, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); #endif -- GitLab From 68a2597ef9f06502ee7c57e95997b942181dc64d Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 18 Mar 2025 10:37:41 +0100 Subject: [PATCH 17/46] Correctly exit and deallocate memory in case of errors in decoder, renderer and post-renderer applications. --- apps/decoder.c | 3 +- apps/isar_post_rend.c | 116 ++++++++------- apps/renderer.c | 339 +++++++++++++++++++++--------------------- 3 files changed, 232 insertions(+), 226 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index c6a8616449..f35d12fd0d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -665,7 +665,8 @@ int main( if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.renderFramesize ) ) != IVAS_ERR_OK ) { - return error; + fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; } if ( arg.renderFramesize != asked_frame_size ) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index bcadc691fb..4584409c4a 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -690,10 +690,10 @@ int main( int32_t inBufferSize; int32_t outBufferSize; int32_t bitsBufferSize; - int16_t *inpInt16Buffer; - float *inFloatBuffer; - int16_t *outInt16Buffer; - float *outFloatBuffer; + int16_t *inpInt16Buffer = NULL; + float *inFloatBuffer = NULL; + int16_t *outInt16Buffer = NULL; + float *outFloatBuffer = NULL; uint8_t *bitsBufferData = NULL; IVAS_REND_AudioBuffer inBuffer; IVAS_REND_AudioBuffer outBuffer; @@ -744,8 +744,8 @@ int main( { if ( RotationFileReader_open( args.headRotationFilePath, &headRotReader ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening file: %s\n", args.headRotationFilePath ); - exit( -1 ); + fprintf( stderr, "\nError opening file: %s\n", args.headRotationFilePath ); + goto cleanup; } } @@ -778,14 +778,14 @@ int main( &bitsBuffer.config.lc3plusHighRes ); if ( error != IVAS_ERR_OK ) { - fprintf( stderr, "Could not open split rend metadata file %s\n", args.inMetadataFilePaths[0] ); - exit( -1 ); + fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.inMetadataFilePaths[0] ); + goto cleanup; } if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening file: %s\n", audioFilePath ); - exit( -1 ); + fprintf( stderr, "\nError opening file: %s\n", audioFilePath ); + goto cleanup; } } @@ -802,8 +802,8 @@ int main( &bitsBuffer.config.lc3plusHighRes ); if ( error != IVAS_ERR_OK ) { - fprintf( stderr, "Could not open split rend metadata file %s\n", args.inputFilePath ); - exit( -1 ); + fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.inputFilePath ); + goto cleanup; } audioReader = NULL; } @@ -828,20 +828,20 @@ int main( /* else if sampling rate given on command line, compare with wav file */ else if ( inFileSampleRate != args.sampleRate ) { - fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath ); - exit( -1 ); + fprintf( stderr, "\nSampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath ); + goto cleanup; } break; case IVAS_ERR_SAMPLING_RATE_UNKNOWN: /* Returned when input is raw PCM */ if ( args.sampleRate == 0 ) { - fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" ); - exit( -1 ); + fprintf( stderr, "\nSampling rate must be specified on command line when using raw PCM input\n" ); + goto cleanup; } break; default: - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } int16_t inFileNumChannels = 0; @@ -850,8 +850,8 @@ int main( error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nAudioFileReader_getNumChannels failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -863,8 +863,8 @@ int main( args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_BINAURAL; if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0.0, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } /*------------------------------------------------------------------------------------------* @@ -873,8 +873,8 @@ int main( if ( ( error = ISAR_POST_REND_InitConfig( hIsarPostRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in Renderer Config Init: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in Renderer Config Init: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( args.inConfig.numBinBuses > 0 ) @@ -886,8 +886,8 @@ int main( bitsBuffer.config.isar_frame_size_ms, bitsBuffer.config.lc3plusHighRes ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in getting split renderer bitstream header: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in getting split renderer bitstream header: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -901,23 +901,23 @@ int main( { if ( ( error = ISAR_POST_REND_AddInput( hIsarPostRend, args.inConfig.binBuses[i].audioConfig, &splitBinIds[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } const int16_t totalNumInChannels = getTotalNumInChannels( hIsarPostRend, splitBinIds ); if ( inFileNumChannels != 0 /* inFileNumChannels is 0 with raw PCM input */ && totalNumInChannels != inFileNumChannels ) { - fprintf( stderr, "Number of channels in input file does not match selected configuration\n" ); - exit( -1 ); + fprintf( stderr, "\nNumber of channels in input file does not match selected configuration\n" ); + goto cleanup; } int16_t numOutChannels = 2; if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) { - fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath ); - exit( -1 ); + fprintf( stderr, "\nFailed to open file: %s\n", args.outputFilePath ); + goto cleanup; } /*------------------------------------------------------------------------------------------* @@ -1003,7 +1003,7 @@ int main( else { fprintf( stderr, "\nUnable to read from bitstream file!\n" ); - exit( -1 ); + goto cleanup; } } } @@ -1014,7 +1014,7 @@ int main( if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); - exit( -1 ); + goto cleanup; } } @@ -1040,21 +1040,21 @@ int main( if ( ( error = HeadRotationFileReading( headRotReader, &headRot, &Pos ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = ISAR_POST_REND_SetHeadRotation( hIsarPostRend, headRot, Pos, DEFAULT_AXIS, sf_idx ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError setting Head Rotation: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } } else { - fprintf( stderr, "Head Rotation should be enabled in post renderer\n" ); - exit( -1 ); + fprintf( stderr, "\nHead Rotation should be enabled in post renderer\n" ); + goto cleanup; } /* Read from split renderer bfi file if specified */ @@ -1063,14 +1063,14 @@ int main( int16_t bfi; if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1080,31 +1080,31 @@ int main( { if ( ( error = ISAR_POST_REND_GetInputNumChannels( hIsarPostRend, splitBinIds[i], &numChannels ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nISAR_POST_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } ISAR_POST_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.binBuses[i].inputChannelIndex, numChannels ); if ( ( error = ISAR_POST_REND_FeedInputAudio( hIsarPostRend, splitBinIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nISAR_POST_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } if ( splitBinNeedsNewFrame ) { if ( ( error = ISAR_POST_REND_FeedSplitBinauralBitstream( hIsarPostRend, splitBinIds[i], &bitsBuffer ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nISAR_POST_REND_FeedSplitBinauralBitstream failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } } if ( ( error = ISAR_POST_REND_GetSplitBinauralSamples( hIsarPostRend, outBuffer, &splitBinNeedsNewFrame ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nISAR_POST_REND_GetSplitBinauralSamples failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } int16_t num_out_channels; @@ -1121,7 +1121,7 @@ int main( if ( ISAR_POST_REND_GetDelay( hIsarPostRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of renderer!\n" ); - exit( -1 ); + goto cleanup; } if ( hSplitRendFileReadWrite != NULL ) @@ -1146,8 +1146,8 @@ int main( { if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error writing audio file %s\n", args.outputFilePath ); - exit( -1 ); + fprintf( stderr, "\nError writing audio file %s\n", args.outputFilePath ); + goto cleanup; } delayNumSamples = 0; } @@ -1181,7 +1181,7 @@ int main( if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, outBufferSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); - exit( -1 ); + goto cleanup; } } @@ -1189,7 +1189,7 @@ int main( if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); - exit( -1 ); + goto cleanup; } zeroPadToWrite = 0; } @@ -1217,6 +1217,8 @@ int main( * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ +cleanup: + free( inpInt16Buffer ); free( inFloatBuffer ); free( outInt16Buffer ); diff --git a/apps/renderer.c b/apps/renderer.c index 0d5398447f..2b49fc453e 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -674,7 +674,7 @@ int main( IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL; IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL; IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL; - IsmPositionProvider *positionProvider; + IsmPositionProvider *positionProvider = NULL; LfeRoutingConfig *lfeRoutingConfigs[RENDERER_MAX_MC_INPUTS]; RenderConfigReader *renderConfigReader = NULL; MasaFileReader *masaReaders[RENDERER_MAX_MASA_INPUTS]; @@ -686,10 +686,10 @@ int main( int32_t inBufferSize; int32_t outBufferSize; int32_t bitsBufferSize; - int16_t *inpInt16Buffer; - float *inFloatBuffer; - int16_t *outInt16Buffer; - float *outFloatBuffer; + int16_t *inpInt16Buffer = NULL; + float *inFloatBuffer = NULL; + int16_t *outInt16Buffer = NULL; + float *outFloatBuffer = NULL; uint8_t *bitsBufferData = NULL; IVAS_REND_AudioBuffer inBuffer; IVAS_REND_AudioBuffer outBuffer; @@ -745,13 +745,13 @@ int main( ( args.inConfig.numAudioObjects > 0 && args.inConfig.audioObjects[0].audioConfig == IVAS_AUDIO_CONFIG_OBA && args.inConfig.numAudioObjects == 1 ) ) ) { fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires mono or ISM1 input\n" ); - exit( -1 ); + goto cleanup; } if ( args.nonDiegeticPan && args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_STEREO ) { fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires stereo output\n" ); - exit( -1 ); + goto cleanup; } positionProvider = IsmPositionProvider_open(); @@ -768,8 +768,8 @@ int main( { if ( RotationFileReader_open( args.headRotationFilePath, &headRotReader ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening file: %s\n", args.headRotationFilePath ); - exit( -1 ); + fprintf( stderr, "\nError opening file: %s\n", args.headRotationFilePath ); + goto cleanup; } } @@ -777,16 +777,16 @@ int main( { if ( RotationFileReader_open( args.referenceRotationFilePath, &referenceRotReader ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening file: %s\n", args.referenceRotationFilePath ); - exit( -1 ); + fprintf( stderr, "\nError opening file: %s\n", args.referenceRotationFilePath ); + goto cleanup; } } if ( !isEmptyString( args.referenceVectorFilePath ) ) { if ( Vector3PairFileReader_open( args.referenceVectorFilePath, &referenceVectorReader ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening file: %s\n", args.referenceVectorFilePath ); - exit( -1 ); + fprintf( stderr, "\nError opening file: %s\n", args.referenceVectorFilePath ); + goto cleanup; } } @@ -800,8 +800,8 @@ int main( { if ( RotationFileReader_open( args.externalOrientationFilePath, &externalOrientationFileReader ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening file: %s\n", args.externalOrientationFilePath ); - exit( -1 ); + fprintf( stderr, "\nError opening file: %s\n", args.externalOrientationFilePath ); + goto cleanup; } } @@ -810,8 +810,8 @@ int main( { if ( RenderConfigReader_open( args.renderConfigFilePath, &renderConfigReader ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening file: %s\n", args.renderConfigFilePath ); - exit( -1 ); + fprintf( stderr, "\nError opening file: %s\n", args.renderConfigFilePath ); + goto cleanup; } } @@ -834,21 +834,21 @@ int main( { fprintf( stderr, "\nInvalid configuration - Merging to MASA output requires MASA input and at least one another input to be present\n" ); fprintf( stderr, "\nMASA input is missing\n" ); - exit( -1 ); + goto cleanup; } if ( args.inConfig.numAudioObjects == 0 && args.inConfig.numMultiChannelBuses == 0 && args.inConfig.numAmbisonicsBuses == 0 ) { fprintf( stderr, "\nInvalid configuration - Merging to MASA output requires MASA input and at least one another input to be present\n" ); fprintf( stderr, "\nNo object, multi-channel, or Ambisonic input present.\n" ); - exit( -1 ); + goto cleanup; } } if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening file: %s\n", audioFilePath ); - exit( -1 ); + fprintf( stderr, "\nError opening file: %s\n", audioFilePath ); + goto cleanup; } int32_t inFileSampleRate = 0; @@ -864,36 +864,36 @@ int main( /* else if sampling rate given on command line, compare with wav file */ else if ( inFileSampleRate != args.sampleRate ) { - fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath ); - exit( -1 ); + fprintf( stderr, "\nSampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath ); + goto cleanup; } break; case IVAS_ERR_SAMPLING_RATE_UNKNOWN: /* Returned when input is raw PCM */ if ( args.sampleRate == 0 ) { - fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" ); - exit( -1 ); + fprintf( stderr, "\nSampling rate must be specified on command line when using raw PCM input\n" ); + goto cleanup; } break; default: - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nAudioFileReader_getSamplingRate failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } int16_t inFileNumChannels = 0; error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nAudioFileReader_getNumChannels failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) ); if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, args.Opt_Headrotation, args.Opt_ExternalOrientation, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } fprintf( stdout, "Input audio file: %s\n", args.inputFilePath ); @@ -941,8 +941,8 @@ int main( { if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error opening file: %s\n", args.customHrtfFilePath ); - exit( -1 ); + fprintf( stderr, "\nError opening file: %s\n", args.customHrtfFilePath ); + goto cleanup; } if ( hrtfFileReader != NULL ) @@ -1055,8 +1055,8 @@ int main( /* === Configure === */ if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in Renderer Config Init: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in Renderer Config Init: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( args.renderConfigFilePath[0] != '\0' ) @@ -1066,19 +1066,19 @@ int main( if ( ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && !is_split_pre_rend_mode( &args ) ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split pre-rendering mode is enabled. Exiting. \n" ); - exit( -1 ); + goto cleanup; } if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + goto cleanup; } if ( RenderConfigReader_read( renderConfigReader, args.renderConfigFilePath, &renderConfig ) != IVAS_ERR_OK ) { - fprintf( stderr, "Failed to read renderer configuration from file %s\n", args.renderConfigFilePath ); - exit( -1 ); + fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath ); + goto cleanup; } if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) @@ -1088,14 +1088,14 @@ int main( { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { - fprintf( stderr, "Invalid room acoustics configuration parameters\n\n" ); - exit( -1 ); + fprintf( stderr, "\nInvalid room acoustics configuration parameters\n\n" ); + goto cleanup; } } else { - fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); - exit( -1 ); + fprintf( stderr, "\nFailed to get acoustic environment with ID: %d\n\n", aeID ); + goto cleanup; } } @@ -1106,7 +1106,7 @@ int main( if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + goto cleanup; } CLDFBframeSize_smpls = frameSize_smpls * 2; @@ -1115,8 +1115,8 @@ int main( if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_SetOrientationTrackingMode(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_SetOrientationTrackingMode(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } /* Set up output custom layout configuration */ @@ -1124,8 +1124,8 @@ int main( { if ( ( error = IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( hIvasRend, args.outConfig.outSetupCustom ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_ConfigureCustomOutputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_ConfigureCustomOutputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1135,8 +1135,8 @@ int main( MasaFileWriter_open( args.outputFilePath, true, &masaWriter ); /* No delay for audio in renderer, so calling metadata writer in delayCompensated mode, i.e., no delay applied to meta */ if ( masaWriter == NULL ) { - fprintf( stderr, "Could not open MASA metadata file %s\n", args.outputFilePath ); - exit( -1 ); + fprintf( stderr, "\nCould not open MASA metadata file %s\n", args.outputFilePath ); + goto cleanup; } } @@ -1145,14 +1145,14 @@ int main( { if ( ( error = IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1163,8 +1163,8 @@ int main( { if ( ( error = parseLfePanMtxFile( args.inLfePanningMatrixFile, &lfePanMatrix ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1195,21 +1195,21 @@ int main( if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.multiChannelBuses[i].audioConfig, &mcIds[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + goto cleanup; } if ( ( error = IVAS_REND_SetInputGain( hIvasRend, mcIds[i], args.inputGainGlobal * dBToLin( args.inConfig.multiChannelBuses[i].gain_dB ) ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_SetInputGain failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( args.inConfig.multiChannelBuses[i].audioConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = IVAS_REND_ConfigureCustomInputLoudspeakerLayout( hIvasRend, mcIds[i], args.inConfig.inSetupCustom ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_ConfigureCustomInputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_ConfigureCustomInputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1218,14 +1218,14 @@ int main( { if ( args.lfePanningEnabled ) { - fprintf( stderr, "Warning: LFE position specified as well as panning matrix! Ignoring position and using gains from panning matrix\n" ); + fprintf( stderr, "\nWarning: LFE position specified as well as panning matrix! Ignoring position and using gains from panning matrix\n" ); args.lfePanningEnabled = false; } if ( ( error = IVAS_REND_SetInputLfeMtx( hIvasRend, mcIds[i], (const IVAS_REND_LfePanMtx *) &lfePanMatrix ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_SetInputLfeMtx failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } /* set panning gains for input LFE */ @@ -1233,8 +1233,8 @@ int main( { if ( ( error = IVAS_REND_SetInputLfePos( hIvasRend, mcIds[i], args.lfeConfigGain, args.lfeConfigAzimuth, args.lfeConfigElevation ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_SetInputLfePos failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } else @@ -1247,14 +1247,14 @@ int main( { if ( ( error = parseLfePanMtxFile( lfeRoutingConfigs[i]->lfe_routing_mtx, &lfePanMatrix ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nparseLfePanMtxFile failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_SetInputLfeMtx( hIvasRend, mcIds[i], (const IVAS_REND_LfePanMtx *) &lfePanMatrix ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_SetInputLfeMtx failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } /* set position based gains */ @@ -1262,8 +1262,8 @@ int main( { if ( ( error = IVAS_REND_SetInputLfePos( hIvasRend, mcIds[i], lfeRoutingConfigs[i]->lfe_gain_dB, lfeRoutingConfigs[i]->lfe_azi, lfeRoutingConfigs[i]->lfe_ele ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_SetInputLfePos failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } } @@ -1274,14 +1274,14 @@ int main( { if ( ( error = IVAS_REND_AddInput( hIvasRend, IVAS_AUDIO_CONFIG_OBA, &ismIds[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_AddInput: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_SetInputGain( hIvasRend, ismIds[i], args.inputGainGlobal * dBToLin( args.inConfig.audioObjects[i].gain_dB ) ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_SetInputGain failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } /* With MASA output, all objects are handled at once, so add only one input having all objects in it */ @@ -1295,14 +1295,14 @@ int main( { if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.ambisonicsBuses[i].audioConfig, &sbaIds[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_AddInput failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_SetInputGain( hIvasRend, sbaIds[i], args.inputGainGlobal * dBToLin( args.inConfig.ambisonicsBuses[i].gain_dB ) ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_SetInputGain failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1310,14 +1310,14 @@ int main( { if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.masaBuses[i].audioConfig, &masaIds[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_AddInput failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_SetInputGain( hIvasRend, masaIds[i], args.inputGainGlobal * dBToLin( args.inConfig.masaBuses[i].gain_dB ) ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_SetInputGain failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1325,8 +1325,8 @@ int main( if ( inFileNumChannels != 0 /* inFileNumChannels is 0 with raw PCM input */ && totalNumInChannels != inFileNumChannels ) { - fprintf( stderr, "Number of channels in input file does not match selected configuration\n" ); - exit( -1 ); + fprintf( stderr, "\nNumber of channels in input file does not match selected configuration\n" ); + goto cleanup; } for ( i = 0; i < args.inConfig.numMasaBuses; ++i ) @@ -1340,16 +1340,16 @@ int main( int16_t numOutChannels; if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_NumOutChannels(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_NumOutChannels(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( cldfb_in_flag ) { if ( ( error = IVAS_REND_openCldfb( cldfbAna, cldfbSyn, totalNumInChannels, numOutChannels, args.sampleRate ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_openCldfb(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_openCldfb(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1358,19 +1358,19 @@ int main( if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_GetSplitRendBitstreamHeader()!\n" ); - exit( -1 ); + goto cleanup; } if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of renderer!\n" ); - exit( -1 ); + goto cleanup; } if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outputFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, args.sampleRate, bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Could not open split rend metadata file %s\n", args.outputFilePath ); - exit( -1 ); + fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.outputFilePath ); + goto cleanup; } audioWriter = NULL; } @@ -1381,26 +1381,26 @@ int main( if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_GetSplitRendBitstreamHeader()!\n" ); - exit( -1 ); + goto cleanup; } if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of renderer!\n" ); - exit( -1 ); + goto cleanup; } if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outMetadataFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, args.sampleRate, bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Could not open split rend metadata file %s\n", args.outMetadataFilePath ); - exit( -1 ); + fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.outMetadataFilePath ); + goto cleanup; } } if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) { - fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath ); - exit( -1 ); + fprintf( stderr, "\nFailed to open file: %s\n", args.outputFilePath ); + goto cleanup; } } @@ -1494,13 +1494,13 @@ int main( { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { - fprintf( stderr, "Invalid acoustic environment configuration parameters\n\n" ); + fprintf( stderr, "\nInvalid acoustic environment configuration parameters\n\n" ); goto cleanup; } } else { - fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] ); + fprintf( stderr, "\nFailed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] ); goto cleanup; } if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) @@ -1516,7 +1516,7 @@ int main( if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); - exit( -1 ); + goto cleanup; } if ( numSamplesRead == 0 ) @@ -1540,13 +1540,13 @@ int main( IVAS_VECTOR3 listenerPos, refPos; if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPos, &refPos ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nVector3PairFileReader_read failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_SetReferenceVector( hIvasRend, listenerPos, refPos ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_SetReferenceVector failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } /* Read from reference rotation trajectory file if specified */ @@ -1557,14 +1557,14 @@ int main( IVAS_QUATERNION quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; if ( ( error = HeadRotationFileReading( referenceRotReader, &quaternions[sf_idx], NULL ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_SetReferenceRotation( hIvasRend, quaternions[sf_idx] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error setting Reference Rotation: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError setting Reference Rotation: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } } @@ -1580,14 +1580,14 @@ int main( if ( ( error = HeadRotationFileReading( headRotReader, &headRot, &Pos ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, headRot, Pos, DEFAULT_AXIS, sf_idx ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError setting Head Rotation: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } } @@ -1595,8 +1595,8 @@ int main( { if ( ( error = IVAS_REND_DisableHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error disabling head rotation: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError disabling head rotation: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1612,16 +1612,16 @@ int main( { if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quatBuffer[sf_idx], &enableHeadRotation[sf_idx], &enableExternalOrientation[sf_idx], &enableRotationInterpolation[sf_idx], &numFramesToTargetOrientation[sf_idx] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in External Orientation File Reading: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in External Orientation File Reading: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ ) { if ( ( error = IVAS_REND_SetExternalOrientation( hIvasRend, &quatBuffer[sf_idx], enableHeadRotation[sf_idx], enableExternalOrientation[sf_idx], enableRotationInterpolation[sf_idx], numFramesToTargetOrientation[sf_idx], sf_idx ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error setting External Orientation: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError setting External Orientation: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } } @@ -1630,23 +1630,23 @@ int main( if ( ( error = IVAS_REND_CombineHeadAndExternalOrientation( hIvasRend ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error combining external and head orientations: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError combining external and head orientations: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) { if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, mcIds[i], &numChannels ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.multiChannelBuses[i].inputChannelIndex, numChannels ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, mcIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1660,15 +1660,15 @@ int main( if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } if ( ( error = IVAS_REND_FeedInputObjectMetadataToOMasa( hIvasRend, i, mtdBuffer.positions[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_FeedInputObjectMetadataToOMasa failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } else @@ -1677,14 +1677,14 @@ int main( if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_FeedInputObjectMetadata( hIvasRend, ismIds[i], mtdBuffer.positions[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_FeedInputObjectMetadata failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } } @@ -1693,15 +1693,15 @@ int main( { if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, sbaIds[i], &numChannels ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.ambisonicsBuses[i].inputChannelIndex, numChannels ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, sbaIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1709,15 +1709,15 @@ int main( { if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, masaIds[i], &numChannels ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "IVAS_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.masaBuses[i].inputChannelIndex, numChannels ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, masaIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "IVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( isCurrentFrameMultipleOf20ms ) @@ -1727,14 +1727,14 @@ int main( /* This will update data in hMasaMetadata[i] */ if ( ( error = MasaFileReader_readNextFrame( masaReaders[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in MASA Metadata File Reading: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in MASA Metadata File Reading: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } if ( ( error = IVAS_REND_FeedInputMasaMetadata( hIvasRend, masaIds[i], hMasaMetadata[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nIVAS_REND_FeedInputMasaMetadata failed: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } } @@ -1744,16 +1744,16 @@ int main( { if ( ( error = IVAS_REND_GetSplitBinauralBitstream( hIvasRend, outBuffer, &bitsBuffer ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_GetSplitBinauralBitstream(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_GetSplitBinauralBitstream(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } else { if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_GetSamples()%s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_GetSamples()%s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1771,7 +1771,7 @@ int main( if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of renderer!\n" ); - exit( -1 ); + goto cleanup; } delayNumSamples_orig = delayNumSamples; @@ -1789,7 +1789,7 @@ int main( &bitsBuffer.config.bitsWritten ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); - exit( -1 ); + goto cleanup; } } @@ -1799,8 +1799,8 @@ int main( { if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error writing audio file %s\n", args.outputFilePath ); - exit( -1 ); + fprintf( stderr, "\nError writing audio file %s\n", args.outputFilePath ); + goto cleanup; } delayNumSamples = 0; } @@ -1860,8 +1860,8 @@ int main( { if ( ( error = IVAS_REND_GetMasaMetadata( hIvasRend, &hMetaOutput, inputType1 ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_GetMasaMetadata(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_GetMasaMetadata(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } else @@ -1871,8 +1871,8 @@ int main( inputType2 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED; if ( ( error = IVAS_REND_MergeMasaMetadata( hIvasRend, &hMetaOutput, inputType1, inputType2 ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_MergeMasaMetadata(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_MergeMasaMetadata(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1881,8 +1881,8 @@ int main( inputType2 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA; if ( ( error = IVAS_REND_MergeMasaMetadata( hIvasRend, &hMetaOutput, inputType1, inputType2 ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_MergeMasaMetadata(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_MergeMasaMetadata(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } @@ -1891,8 +1891,8 @@ int main( inputType2 = IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED; if ( ( error = IVAS_REND_MergeMasaMetadata( hIvasRend, &hMetaOutput, inputType1, inputType2 ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error in IVAS_REND_MergeMasaMetadata(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); + fprintf( stderr, "\nError in IVAS_REND_MergeMasaMetadata(): %s\n", ivas_error_to_string( error ) ); + goto cleanup; } } } @@ -1924,7 +1924,7 @@ int main( if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, outBufferSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); - exit( -1 ); + goto cleanup; } } @@ -1932,7 +1932,7 @@ int main( if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); - exit( -1 ); + goto cleanup; } zeroPadToWrite = 0; } @@ -1961,14 +1961,17 @@ int main( } #endif - /* === Close === */ + /*------------------------------------------------------------------------------------------* + * Close files and deallocate resources + *------------------------------------------------------------------------------------------*/ + +cleanup: + free( inpInt16Buffer ); free( inFloatBuffer ); free( outInt16Buffer ); free( outFloatBuffer ); -cleanup: - if ( bitsBufferData != NULL ) { free( bitsBufferData ); -- GitLab From 1b258ec24ed5bfc7fe0fcabd0fc58568f11db1f2 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 19 Mar 2025 16:27:54 +1100 Subject: [PATCH 18/46] fix for issue 1297 --- lib_com/options.h | 1 + lib_dec/ivas_jbm_dec.c | 93 ++++++++++++++++++++++++++++-------------- lib_dec/lib_dec.c | 7 ++++ 3 files changed, 70 insertions(+), 31 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index f2fe9b93f2..568bd88536 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,7 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ +#define NONBE_FIX_1297_SPAR_JBM_MEM_SAN /*Dolby: issue 1297, SPAR + JBM + BR switch memory sanitizer*/ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 2376de298a..648f6a1060 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1533,44 +1533,75 @@ ivas_error ivas_jbm_dec_flush_renderer( } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { - float *tc_local[MAX_TRANSPORT_CHANNELS]; - int16_t last_spar_md_idx; - int16_t last_dirac_md_idx; - uint16_t nSamplesAvailableNext; +#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN + if ( ism_mode_old == ISM_SBA_MODE_DISC ) + { +#endif + float *tc_local[MAX_TRANSPORT_CHANNELS]; + int16_t last_spar_md_idx; + int16_t last_dirac_md_idx; + uint16_t nSamplesAvailableNext; +#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN + ISM_MODE ism_mode_orig; + RENDERER_TYPE renderer_type_orig; + int32_t ivas_total_brate; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + renderer_type_orig = st_ivas->renderer_type; + ism_mode_orig = st_ivas->ism_mode; + st_ivas->ism_mode = ism_mode_old; + st_ivas->renderer_type = renderer_type_old; + st_ivas->hDecoderConfig->ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; +#endif - last_spar_md_idx = st_ivas->hSpar->render_to_md_map[st_ivas->hSpar->slots_rendered - 1]; - last_dirac_md_idx = st_ivas->hSpatParamRendCom->render_to_md_map[st_ivas->hSpatParamRendCom->slots_rendered - 1]; + last_spar_md_idx = st_ivas->hSpar->render_to_md_map[st_ivas->hSpar->slots_rendered - 1]; + last_dirac_md_idx = st_ivas->hSpatParamRendCom->render_to_md_map[st_ivas->hSpatParamRendCom->slots_rendered - 1]; +#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN +#ifdef DEBUGGING + assert( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ); +#endif +#else #ifdef DEBUGGING assert( ism_mode_old == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ); #endif - /* copy from ISM delay buffer to the correct place in tcs */ - for ( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ ) - { +#endif + /* copy from ISM delay buffer to the correct place in tcs */ + for ( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ ) + { +#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN + tc_local[ch_idx] = &st_ivas->hTcBuffer->tc[ch_idx][hTcBuffer->n_samples_rendered]; +#else tc_local[ch_idx] = &st_ivas->hTcBuffer->tc[ch_idx + 2][hTcBuffer->n_samples_rendered]; - mvr2r( st_ivas->hSbaIsmData->delayBuffer[ch_idx], tc_local[ch_idx], st_ivas->hSbaIsmData->delayBuffer_size ); - } - - /* transfer adapted sf info from hTcBuffer to SPAR and DirAC */ - st_ivas->hSpar->nb_subframes = 1; - st_ivas->hSpar->subframes_rendered = 0; - st_ivas->hSpar->subframe_nbslots[0] = JBM_CLDFB_SLOTS_IN_SUBFRAME; - st_ivas->hSpar->slots_rendered = 0; - st_ivas->hSpar->num_slots = JBM_CLDFB_SLOTS_IN_SUBFRAME; - st_ivas->hSpatParamRendCom->nb_subframes = 1; - st_ivas->hSpatParamRendCom->subframes_rendered = 0; - st_ivas->hSpatParamRendCom->subframe_nbslots[0] = JBM_CLDFB_SLOTS_IN_SUBFRAME; - st_ivas->hSpatParamRendCom->slots_rendered = 0; - st_ivas->hSpatParamRendCom->num_slots = JBM_CLDFB_SLOTS_IN_SUBFRAME; - - /* also adapt md maps, just use the last index */ - set_s( st_ivas->hSpar->render_to_md_map, last_spar_md_idx, n_slots_still_available ); - set_s( st_ivas->hSpatParamRendCom->render_to_md_map, last_dirac_md_idx, n_slots_still_available ); +#endif + mvr2r( st_ivas->hSbaIsmData->delayBuffer[ch_idx], tc_local[ch_idx], st_ivas->hSbaIsmData->delayBuffer_size ); + } - /* render the last subframe */ - if ( ( error = ivas_osba_dirac_td_binaural_jbm( st_ivas, (uint16_t) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) - { - return error; + /* transfer adapted sf info from hTcBuffer to SPAR and DirAC */ + st_ivas->hSpar->nb_subframes = 1; + st_ivas->hSpar->subframes_rendered = 0; + st_ivas->hSpar->subframe_nbslots[0] = JBM_CLDFB_SLOTS_IN_SUBFRAME; + st_ivas->hSpar->slots_rendered = 0; + st_ivas->hSpar->num_slots = JBM_CLDFB_SLOTS_IN_SUBFRAME; + st_ivas->hSpatParamRendCom->nb_subframes = 1; + st_ivas->hSpatParamRendCom->subframes_rendered = 0; + st_ivas->hSpatParamRendCom->subframe_nbslots[0] = JBM_CLDFB_SLOTS_IN_SUBFRAME; + st_ivas->hSpatParamRendCom->slots_rendered = 0; + st_ivas->hSpatParamRendCom->num_slots = JBM_CLDFB_SLOTS_IN_SUBFRAME; + + /* also adapt md maps, just use the last index */ + set_s( st_ivas->hSpar->render_to_md_map, last_spar_md_idx, n_slots_still_available ); + set_s( st_ivas->hSpatParamRendCom->render_to_md_map, last_dirac_md_idx, n_slots_still_available ); + + /* render the last subframe */ + if ( ( error = ivas_osba_dirac_td_binaural_jbm( st_ivas, (uint16_t) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN + st_ivas->ism_mode = ism_mode_orig; + st_ivas->renderer_type = renderer_type_orig; + st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate; } +#endif } else { diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 7640228d3b..b4dc284a00 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1034,8 +1034,15 @@ ivas_error IVAS_DEC_ReadFormat( } } +#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN + if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || + ( st_ivas->ini_active_frame > 0 && + ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) || + ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode != ISM_SBA_MODE_DISC ) ) ) +#else if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || ( st_ivas->ini_active_frame > 0 && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) ) +#endif { /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv render what still fits in the new granularity */ -- GitLab From e2bf1c222fbd890d812ce97c081cfacdee076c22 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 19 Mar 2025 17:14:11 +1100 Subject: [PATCH 19/46] linux wARNING fix --- lib_dec/lib_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b4dc284a00..7b4eb08f99 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1037,8 +1037,8 @@ ivas_error IVAS_DEC_ReadFormat( #ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || ( st_ivas->ini_active_frame > 0 && - ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) || - ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode != ISM_SBA_MODE_DISC ) ) ) + ( ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) || + ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode != ISM_SBA_MODE_DISC ) ) ) ) #else if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || ( st_ivas->ini_active_frame > 0 && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) ) -- GitLab From 469329b7a43dc16af5bb8fcf727d1283840e3deb Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 20 Mar 2025 13:27:59 +0100 Subject: [PATCH 20/46] Put all changes in one preprocessor switch --- lib_com/options.h | 1 - lib_dec/jbm_jb4sb.c | 9 --------- 2 files changed, 10 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4a4448de24..03f3d92b2f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define ISSUE_1122_JBM_DO_NOT_HARDCODE_SAFETY_MARGIN /* FhG: Use safety margin defined by user instead of a hard-coded value */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 2950443f4f..b231594dba 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -672,16 +672,7 @@ static void JB4_targetPlayoutDelay( } #ifdef NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX -#ifdef ISSUE_1122_JBM_DO_NOT_HARDCODE_SAFETY_MARGIN *targetDtx = JB4_MAX( *targetDtx, (uint32_t) h->safetyMargin ); -#else - if ( *targetDtx < 60 ) - { - *targetDtx = 60; - } -#endif -#endif -#ifdef ISSUE_1122_JBM_DO_NOT_HARDCODE_SAFETY_MARGIN *targetStartUp = JB4_MAX( *targetStartUp, (uint32_t) h->safetyMargin ); #else if ( *targetStartUp < 60 ) -- GitLab From 8d688c8835468ab705f36c6f07f2821d427f6768 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 20 Mar 2025 13:44:14 +0100 Subject: [PATCH 21/46] Disable fix in EVS mode to keep BE --- lib_com/options.h | 1 + lib_dec/jbm_jb4sb.c | 21 ++++++++++++++++++++- lib_dec/jbm_jb4sb.h | 4 ++++ lib_dec/lib_dec.c | 6 ++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 03f3d92b2f..5bc247ef50 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD /* VA/Eri: issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */ #define NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX /* FhG: Avoid JBM ignoring safety margin and setting playout delay to 0 during DTX */ +#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_1231_BASOP_819_THRESHOLD_MASA2TOTAL /* Nokia: add fix for precision limitation in comparison with masa2total energy ratio threshold to be aligned with BASOP*/ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index b231594dba..ad3ba459a6 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -199,6 +199,9 @@ struct JB4 JB4_DATAUNIT_HANDLE freeMemorySlots[MAX_JBM_SLOTS]; uint16_t nFreeMemorySlots; /*@} */ +#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED + bool evsMode; +#endif }; /* JB4 */ @@ -293,6 +296,9 @@ ivas_error JB4_Create( h->freeMemorySlots[iter] = &h->memorySlots[iter]; } h->nFreeMemorySlots = MAX_JBM_SLOTS; +#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED + h->evsMode = false; +#endif *ph = h; return IVAS_ERR_OK; @@ -369,6 +375,12 @@ ivas_error JB4_Init( return IVAS_ERR_OK; } +#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED +void JB4_TMP_SetEvsCompatFlag( JB4_HANDLE h ) +{ + h->evsMode = true; +} +#endif /* Returns a memory slot to store a new data unit */ JB4_DATAUNIT_HANDLE JB4_AllocDataUnit( @@ -672,7 +684,14 @@ static void JB4_targetPlayoutDelay( } #ifdef NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX - *targetDtx = JB4_MAX( *targetDtx, (uint32_t) h->safetyMargin ); +#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED + if ( !h->evsMode ) + { +#endif + *targetDtx = JB4_MAX( *targetDtx, (uint32_t) h->safetyMargin ); +#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED + } +#endif *targetStartUp = JB4_MAX( *targetStartUp, (uint32_t) h->safetyMargin ); #else if ( *targetStartUp < 60 ) diff --git a/lib_dec/jbm_jb4sb.h b/lib_dec/jbm_jb4sb.h index 3d48723495..8155d66ae9 100644 --- a/lib_dec/jbm_jb4sb.h +++ b/lib_dec/jbm_jb4sb.h @@ -86,6 +86,10 @@ void JB4_Destroy( JB4_HANDLE *ph ); ivas_error JB4_Init( JB4_HANDLE h, const int16_t safetyMargin ); +#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED +void JB4_TMP_SetEvsCompatFlag( JB4_HANDLE h ); +#endif + JB4_DATAUNIT_HANDLE JB4_AllocDataUnit( JB4_HANDLE h ); void JB4_FreeDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 7640228d3b..7ec454310f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -793,6 +793,12 @@ ivas_error IVAS_DEC_EnableVoIP( { return IVAS_ERR_FAILED_ALLOC; } +#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) + { + JB4_TMP_SetEvsCompatFlag( hIvasDec->hVoIP->hJBM ); + } +#endif /* init flush buffer if necessary (only needed for binaural)*/ if ( hIvasDec->flushbuffer == NULL && ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) -- GitLab From aa796fbf0d47e251a034cbbd8714f4accb5fcb2d Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 20 Mar 2025 15:41:19 +0000 Subject: [PATCH 22/46] Apply 6 suggestion(s) to 2 file(s) Co-authored-by: Archit Tamarapu --- apps/isar_post_rend.c | 6 +++--- apps/renderer.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 4584409c4a..6ff92edc43 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -681,12 +681,12 @@ int main( int argc, char **argv ) { - ISAR_POST_REND_HANDLE hIsarPostRend; + ISAR_POST_REND_HANDLE hIsarPostRend = NULL; RotFileReader *headRotReader = NULL; RotFileReader *externalOrientationFileReader = NULL; SplitRendBFIFileReader *splitRendBFIReader = NULL; AudioFileReader *audioReader = NULL; - AudioFileWriter *audioWriter; + AudioFileWriter *audioWriter = NULL; int32_t inBufferSize; int32_t outBufferSize; int32_t bitsBufferSize; @@ -901,7 +901,7 @@ int main( { if ( ( error = ISAR_POST_REND_AddInput( hIsarPostRend, args.inConfig.binBuses[i].audioConfig, &splitBinIds[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); + fprintf( stderr, "\nISAR_POST_REND_AddInput failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; } } diff --git a/apps/renderer.c b/apps/renderer.c index 2b49fc453e..775a9d6ee9 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -659,7 +659,7 @@ int main( int argc, char **argv ) { - IVAS_REND_HANDLE hIvasRend; + IVAS_REND_HANDLE hIvasRend = NULL; RotFileReader *headRotReader = NULL; RotFileReader *externalOrientationFileReader = NULL; RotFileReader *referenceRotReader = NULL; @@ -682,7 +682,7 @@ int main( IVAS_MASA_METADATA_HANDLE hMasaMetadata[RENDERER_MAX_MASA_INPUTS]; char audioFilePath[FILENAME_MAX]; AudioFileReader *audioReader = NULL; - AudioFileWriter *audioWriter; + AudioFileWriter *audioWriter = NULL; int32_t inBufferSize; int32_t outBufferSize; int32_t bitsBufferSize; @@ -1194,7 +1194,7 @@ int main( { if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.multiChannelBuses[i].audioConfig, &mcIds[i] ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + fprintf( stderr, "\nIVAS_REND_AddInput failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; } -- GitLab From 2a40a505f9a38140a8dc16f78e6676353820c2b4 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Fri, 21 Mar 2025 15:41:44 +0100 Subject: [PATCH 23/46] Add NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS to address issue 1296 --- lib_com/options.h | 1 + lib_rend/ivas_objectRenderer_sfx.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 84ce770c97..9c51fe439b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ #define NONBE_1289_STEREO_SW_TO_MONO /* VA: issue 1289: Fix glitch when stereo signal is decoded to mono n TD->DFT switching */ +#define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index 8414394bae..2d09fd49a7 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -216,7 +216,9 @@ static void sincResample( p_forward++; p_backward--; } +#ifndef NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS tmp += ( *p_forward ) * ( *p_sinc_forward ); /* Integer index always rounded down --> 4 steps backward, 5 steps forward */ +#endif output[i] = tmp; -- GitLab From 445beba8fe6053553846137a430d1538c87ad7cf Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 21 Mar 2025 16:45:11 +0100 Subject: [PATCH 24/46] add DTX cases and keep_files support --- tests/test_be_for_jbm_neutral_dly_profile.py | 180 +++++++++++++------ 1 file changed, 125 insertions(+), 55 deletions(-) diff --git a/tests/test_be_for_jbm_neutral_dly_profile.py b/tests/test_be_for_jbm_neutral_dly_profile.py index 61bb168a2f..17e41c4038 100644 --- a/tests/test_be_for_jbm_neutral_dly_profile.py +++ b/tests/test_be_for_jbm_neutral_dly_profile.py @@ -14,69 +14,73 @@ DTX_ON = "DTX_ON" DTX_OFF = "DTX_OFF" -# TODO: Clarify if this should also be tested with DTX, see #1122 -TESTCASES = [ +# testcases where DTX is supported +TESTCASES_WITH_DTX = [ # stereo - ["stereo", 32000, "EXT", "DTX_OFF"], - ["stereo", 48000, "MONO", "DTX_OFF"], - ["stereo", 16400, "5_1", "DTX_OFF"], - ["stereo", 256000, "7_1_4", "DTX_OFF"], + ["stereo", 32000, "EXT"], + ["stereo", 48000, "MONO"], + ["stereo", 16400, "5_1"], + ["stereo", 256000, "7_1_4"], # param ISM - ["ISM4", 32000, "BINAURAL_ROOM_REVERB", "DTX_OFF"], - ["ISM3", 24400, "STEREO", "DTX_OFF"], - ["ISM4", 24400, "5_1_2", "DTX_OFF"], - ["ISM3", 32000, "HOA2", "DTX_OFF"], + ["ISM4", 32000, "BINAURAL_ROOM_REVERB"], + ["ISM3", 24400, "STEREO"], + ["ISM4", 24400, "5_1_2"], + ["ISM3", 32000, "HOA2"], # discrete ISM - ["ISM3", 64000, "BINAURAL", "DTX_OFF"], - ["ISM1", 32000, "BINAURAL_ROOM_IR", "DTX_OFF"], - ["ISM2", 96000, "7_1", "DTX_OFF"], - ["ISM1", 80000, "MONO", "DTX_OFF"], - ["ISM4", 128000, "FOA", "DTX_OFF"], + ["ISM3", 64000, "BINAURAL"], + ["ISM2", 96000, "7_1"], + ["ISM1", 80000, "MONO"], + ["ISM4", 128000, "FOA"], # MASA - ["MASA1TC", 24400, "BINAURAL_ROOM_IR", "DTX_OFF"], - ["MASA2TC", 80000, "stereo", "DTX_OFF"], - ["MASA1TC", 16400, "7_1_4", "DTX_OFF"], - ["MASA2TC", 256000, "HOA3", "DTX_OFF"], - ["MASA1TC", 128000, "EXT", "DTX_OFF"], + ["MASA1TC", 24400, "BINAURAL_ROOM_IR"], + ["MASA2TC", 80000, "stereo"], + ["MASA1TC", 16400, "7_1_4"], + ["MASA2TC", 256000, "HOA3"], + ["MASA1TC", 128000, "EXT"], + # SBA + ["HOA3", 64000, "BINAURAL"], + ["HOA2", 80000, "EXT"], + ["FOA", 13200, "stereo"], +] + +# testcases with no DTX support +TESTCASES_NO_DTX = [ + # SBA + ["FOA", 256000, "BINAURAL_ROOM_REVERB"], + ["HOA3", 512000, "5_1_4"], # MC # McMasa - ["MC_5_1", 16400, "BINAURAL_ROOM_IR", "DTX_OFF"], - ["MC_7_1_4", 80000, "mono", "DTX_OFF"], - ["MC_5_1_2", 24400, "EXT", "DTX_OFF"], + ["MC_5_1", 16400, "BINAURAL_ROOM_IR"], + ["MC_7_1_4", 80000, "mono"], + ["MC_5_1_2", 24400, "EXT"], # paramMC - ["MC_5_1_2", 48000, "BINAURAL", "DTX_OFF"], - ["MC_7_1", 80000, "EXT", "DTX_OFF"], - ["MC_7_1_4", 128000, "FOA", "DTX_OFF"], + ["MC_5_1_2", 48000, "BINAURAL"], + ["MC_7_1", 80000, "EXT"], + ["MC_7_1_4", 128000, "FOA"], # paramUpmix - ["MC_7_1_4", 160000, "stereo", "DTX_OFF"], + ["MC_7_1_4", 160000, "stereo"], # discrete MC - ["MC_5_1_2", 512000, "BINAURAL_ROOM_REVERB", "DTX_OFF"], - ["MC_7_1", 128000, "EXT", "DTX_OFF"], - ["MC_7_1_4", 256000, "5_1", "DTX_OFF"], - # SBA - ["HOA3", 64000, "BINAURAL", "DTX_OFF"], - ["FOA", 256000, "BINAURAL_ROOM_REVERB", "DTX_OFF"], - ["HOA2", 80000, "EXT", "DTX_OFF"], - ["HOA3", 512000, "5_1_4", "DTX_OFF"], - ["FOA", 80000, "stereo", "DTX_OFF"], + ["MC_5_1_2", 512000, "BINAURAL_ROOM_REVERB"], + ["MC_7_1", 128000, "EXT"], + ["MC_7_1_4", 256000, "5_1"], # OMASA - ["OMASA_ISM1", 512000, "BINAURAL", "DTX_OFF"], - ["OMASA_ISM2", 24400, "MONO", "DTX_OFF"], - ["OMASA_ISM3", 80000, "7_1_4", "DTX_OFF"], - ["OMASA_ISM4", 64000, "HOA3", "DTX_OFF"], - ["OMASA_ISM2", 32000, "EXT", "DTX_OFF"], + ["OMASA_ISM1", 512000, "BINAURAL"], + ["OMASA_ISM2", 24400, "MONO"], + ["OMASA_ISM3", 80000, "7_1_4"], + ["OMASA_ISM4", 64000, "HOA3"], + ["OMASA_ISM2", 32000, "EXT"], # OSBA - ["OSBA_ISM2_HOA2", 64000, "BINAURAL_ROOM_IR", "DTX_OFF"], - ["OSBA_ISM4_FOA", 512000, "BINAURAL_ROOM_REVERB", "DTX_OFF"], - ["OSBA_ISM3_HOA3", 128000, "EXT", "DTX_OFF"], - ["OSBA_ISM2_HOA3", 96000, "5_1", "DTX_OFF"], - ["OSBA_ISM1_HOA2", 32000, "mono", "DTX_OFF"], + ["OSBA_ISM2_HOA2", 64000, "BINAURAL_ROOM_IR"], + ["OSBA_ISM4_FOA", 512000, "BINAURAL_ROOM_REVERB"], + ["OSBA_ISM3_HOA3", 128000, "EXT"], + ["OSBA_ISM2_HOA3", 96000, "5_1"], + ["OSBA_ISM1_HOA2", 32000, "mono"], ] DLY_PROFILE = SCRIPTS_DIR.joinpath("dly_error_profiles/dly_error_profile_0.dat") JBM_NEUTRAL_DELAY_MS = 60 -def get_options(in_format, bitrate, dtx): +def get_options(in_format, dtx): options = list() if dtx: @@ -147,19 +151,82 @@ INPUT_FILES = { "OSBA_ISM1_HOA2": "stvOSBA_1ISM_2OA48c.wav", } +OUTPUT_FOLDER_IF_KEEP_FILES = pathlib.Path(__file__).parent.joinpath("output-jbm-be") +OUTPUT_FOLDER_IF_KEEP_FILES_NO_JBM = OUTPUT_FOLDER_IF_KEEP_FILES.joinpath("no-jbm") +OUTPUT_FOLDER_IF_KEEP_FILES_NEUTRAL = OUTPUT_FOLDER_IF_KEEP_FILES.joinpath( + "neutral-profile" +) + -@pytest.mark.parametrize("in_format,bitrate,out_format,dtx", TESTCASES) -def test_be_for_jbm_neutral_dly_profile( - in_format, bitrate, out_format, dtx, dut_encoder_frontend, dut_decoder_frontend +@pytest.mark.parametrize( + "in_format,bitrate,out_format", TESTCASES_NO_DTX + TESTCASES_WITH_DTX +) +def test_be_for_jbm_neutral_dly_profile_no_dtx( + in_format, + bitrate, + out_format, + dut_encoder_frontend, + dut_decoder_frontend, + keep_files, ): + run_test( + in_format, + bitrate, + out_format, + DTX_OFF, + dut_encoder_frontend, + dut_decoder_frontend, + keep_files, + ) + + +@pytest.mark.parametrize("in_format,bitrate,out_format", TESTCASES_WITH_DTX) +def test_be_for_jbm_neutral_dly_profile_with_dtx( + in_format, + bitrate, + out_format, + dut_encoder_frontend, + dut_decoder_frontend, + keep_files, +): + run_test( + in_format, + bitrate, + out_format, + DTX_ON, + dut_encoder_frontend, + dut_decoder_frontend, + keep_files, + ) + + +def run_test( + in_format, + bitrate, + out_format, + dtx, + dut_encoder_frontend, + dut_decoder_frontend, + keep_files, +): + if keep_files: + OUTPUT_FOLDER_IF_KEEP_FILES_NEUTRAL.mkdir(exist_ok=True, parents=True) + OUTPUT_FOLDER_IF_KEEP_FILES_NO_JBM.mkdir(exist_ok=True, parents=True) + with TemporaryDirectory() as tmp_dir: tmp_dir = pathlib.Path(tmp_dir) + output_dir_no_jbm = ( + OUTPUT_FOLDER_IF_KEEP_FILES_NO_JBM if keep_files else tmp_dir + ) + output_dir_neutral = ( + OUTPUT_FOLDER_IF_KEEP_FILES_NEUTRAL if keep_files else tmp_dir + ) # run encoder bitstream_file = tmp_dir.joinpath(f"{in_format}.192").absolute() sampling_rate_khz = 48 input_file = TESTV_DIR.joinpath(INPUT_FILES[in_format]) - options = get_options(in_format, bitrate, dtx == DTX_ON) + options = get_options(in_format, dtx == DTX_ON) dut_encoder_frontend.run( bitrate, sampling_rate_khz, @@ -170,11 +237,13 @@ def test_be_for_jbm_neutral_dly_profile( ) # run decoder without network simulation - output = tmp_dir.joinpath(f"{in_format}-{bitrate}-{out_format}.wav").absolute() + output = output_dir_no_jbm.joinpath( + f"{in_format}-{bitrate}-{out_format}.wav" + ).absolute() dut_decoder_frontend.run(out_format, sampling_rate_khz, bitstream_file, output) # run decoder with network simulation - output_jbm = output.with_suffix(".jbm-0.wav") + output_jbm = output_dir_neutral.joinpath(output.with_suffix(".jbm-0.wav").name) dut_decoder_frontend.run( out_format, sampling_rate_khz, @@ -188,7 +257,6 @@ def test_be_for_jbm_neutral_dly_profile( x_jbm, _ = audiofile.readfile(output_jbm) # strip jbm delay - # TODO: this may need to be adapted to handle variable offsets based on outcome of #1122 cmp_result = audioarray.compare( x, x_jbm, @@ -197,4 +265,6 @@ def test_be_for_jbm_neutral_dly_profile( test_start_offset_ms=JBM_NEUTRAL_DELAY_MS, ) if not cmp_result["bitexact"]: - pytest.fail(f"Difference between no jbm and zero-delay jbm decoding found! Max abs diff: {cmp_result['max_abs_diff']}") + pytest.fail( + f"Difference between no jbm and zero-delay jbm decoding found! Max abs diff: {cmp_result['max_abs_diff']}" + ) -- GitLab From 2339708040a7672a6ca4606c6a16deefb3b18941 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 21 Mar 2025 17:50:05 +0100 Subject: [PATCH 25/46] add noise to end of signals to prevent ending with dtx section --- tests/test_be_for_jbm_neutral_dly_profile.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/test_be_for_jbm_neutral_dly_profile.py b/tests/test_be_for_jbm_neutral_dly_profile.py index 17e41c4038..6b059ac743 100644 --- a/tests/test_be_for_jbm_neutral_dly_profile.py +++ b/tests/test_be_for_jbm_neutral_dly_profile.py @@ -2,6 +2,7 @@ import pytest import pathlib import sys import re +import numpy as np from tempfile import TemporaryDirectory from .constants import TESTV_DIR, SCRIPTS_DIR @@ -226,6 +227,22 @@ def run_test( bitstream_file = tmp_dir.joinpath(f"{in_format}.192").absolute() sampling_rate_khz = 48 input_file = TESTV_DIR.joinpath(INPUT_FILES[in_format]) + + # for DTX cases append 5 frames of white noise to the file + # this should make sure that there is no DTX segment at the very end of the signal + # DTX at the end can still cause length differences which are fine to exist, but make the comparison hard to handle + # EXCEPTION (of course there is one...): MASA. We cant append to the signal without appending some MD. Luckily, this problem does not occur with the MASA testvectors + if dtx == DTX_ON and "MASA" not in in_format: + input_signal, fs = audiofile.readfile(input_file) + noise_len = fs // 50 * 5 + noise_amplitude = np.max(input_signal) + noise = ( + np.random.random((noise_len, input_signal.shape[1])) * noise_amplitude + ) + input_signal = np.concatenate([input_signal, noise]) + input_file = tmp_dir.joinpath(f"{input_file.stem}-plus-noise.wav") + audiofile.writefile(input_file, input_signal, fs) + options = get_options(in_format, dtx == DTX_ON) dut_encoder_frontend.run( bitrate, @@ -238,7 +255,7 @@ def run_test( # run decoder without network simulation output = output_dir_no_jbm.joinpath( - f"{in_format}-{bitrate}-{out_format}.wav" + f"{in_format}-{bitrate}-{out_format}-{dtx}.wav" ).absolute() dut_decoder_frontend.run(out_format, sampling_rate_khz, bitstream_file, output) -- GitLab From 5482782aa5ac436ff2215025d1cc6242aa8f66e7 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 21 Mar 2025 17:54:17 +0100 Subject: [PATCH 26/46] use scaled-down SBA files that actually trigger DTX --- tests/test_be_for_jbm_neutral_dly_profile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_be_for_jbm_neutral_dly_profile.py b/tests/test_be_for_jbm_neutral_dly_profile.py index 6b059ac743..ec67ab22a3 100644 --- a/tests/test_be_for_jbm_neutral_dly_profile.py +++ b/tests/test_be_for_jbm_neutral_dly_profile.py @@ -137,9 +137,9 @@ INPUT_FILES = { "MC_5_1_4": "stv514MC48c.wav", "MC_7_1": "stv71MC48c.wav", "MC_7_1_4": "stv714MC48c.wav", - "FOA": "stvFOA48c.wav", - "HOA2": "stv2OA48c.wav", - "HOA3": "stv3OA48c.wav", + "FOA": "stvFOA48c_cut_.004.wav", + "HOA2": "stv2OA48c_cut_.004.wav", + "HOA3": "stv3OA48c_cut_.004.wav", "OMASA_ISM1": "stvOMASA_1ISM_2MASA2TC48c.wav", "OMASA_ISM2": "stvOMASA_2ISM_2MASA2TC48c.wav", "OMASA_ISM3": "stvOMASA_3ISM_2MASA2TC48c.wav", -- GitLab From 2c459c9baaaef44922103205840ebc391c8fe30e Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 21 Mar 2025 18:02:50 +0100 Subject: [PATCH 27/46] use scaled-down SBA testvectors for DTX cases to actually trigger DTX --- scripts/config/self_test.prm | 56 +++++++++++----------- scripts/config/self_test_basop_encoder.prm | 38 +++++++-------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 5b3df2cf08..eba5d68e86 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -628,17 +628,17 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_EXOF_OtrAvg.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FER at 5% -../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit +../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c_cut_.004.wav bit eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error -../IVAS_dec BINAURAL 32 bit_error testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_FER5.tst +../IVAS_dec BINAURAL 32 bit_error testv/stv3OA32c_cut.004.wav_SBA_24400_32-32_DTX_Binaural_FER5.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, HR -../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_Headrot.tst +../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c_cut_.004.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c_cut_.004.wav_SBA_24400_32-32_DTX_Binaural_Headrot.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, HR, exo -../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_Headrot_EXOF.tst +../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c_cut_.004.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c_cut_.004.wav_SBA_24400_32-32_DTX_Binaural_Headrot_EXOF.tst // SBA at 32 kbps, 32kHz in, 32kHz out, FOA out ../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit @@ -654,8 +654,8 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_dec BINAURAL_ROOM_IR 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_BINAURAL_ROOM.tst // SBA at 32 kbps, 48kHz in, 48kHz out, MONO out, DTX, bandwidth switching -../IVAS_cod -max_band testv/ivas_bws_20fr_start_FB.txt -dtx -sba 1 32000 48 testv/stvFOA48c.wav bit -../IVAS_dec MONO 48 bit testv/stvFOA48c.wav_SBA_32000_48-48_DTX_MONO.tst +../IVAS_cod -max_band testv/ivas_bws_20fr_start_FB.txt -dtx -sba 1 32000 48 testv/stvFOA48c_cut_.004.wav bit +../IVAS_dec MONO 48 bit testv/stvFOA48c_cut_.004.wav_SBA_32000_48-48_DTX_MONO.tst // SBA at 48 kbps, 32kHz in, 32kHz out, MONO out, random FER at 5% ../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit @@ -703,26 +703,26 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM_IR 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_EXOF_OtrRefPosLev.tst // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FER at 5% -../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit +../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c_cut_.004.wav bit eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error -../IVAS_dec BINAURAL 32 bit_error testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_FER5.tst +../IVAS_dec BINAURAL 32 bit_error testv/stv3OA32c_cut_.004.wav_SBA_48000_32-32_DTX_Binaural_FER5.tst // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, HR -../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_Headrot.tst +../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c_cut_.004.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c_cut_.004.wav_SBA_48000_32-32_DTX_Binaural_Headrot.tst // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, HR, exo -../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_Headrot_EXOF.tst +../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c_cut_.004.wav bit +../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c_cut_.004.wav_SBA_48000_32-32_DTX_Binaural_Headrot_EXOF.tst // SBA at 48 kbps, 48kHz in, 48kHz out, 5_1_2 out ../IVAS_cod -sba 3 48000 48 testv/stv3OA48c.wav bit ../IVAS_dec 5_1_2 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_5_1_2.tst // SBA at 64 kbps, 32kHz in, 32kHz out, FOA out, DTX, random FER at 5% -../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c.wav bit +../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c_cut_.004.wav bit eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error -../IVAS_dec FOA 32 bit_error testv/stvFOA32c.wav_SBA_64000_32-32_FER5_DTX_FOA.tst +../IVAS_dec FOA 32 bit_error testv/stvFOA32c_cut_.004.wav_SBA_64000_32-32_FER5_DTX_FOA.tst // SBA at 64 kbps, 48kHz in, 48kHz out, 5_1_4 out ../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit @@ -733,12 +733,12 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_dec 7_1_4 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_7_1_4.tst // SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit -../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_DTX_BINAURAL.tst +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c_cut_.004.wav bit +../IVAS_dec BINAURAL 48 bit testv/stvFOA48c_cut_.004.wav_SBA_64000_48-48_DTX_BINAURAL.tst // SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL_ROOM out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit -../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_DTX_BINAURAL_ROOM.tst +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c_cut_.004.wav bit +../IVAS_dec BINAURAL_ROOM_IR 48 bit testv/stvFOA48c_cut_.004.wav_SBA_64000_48-48_DTX_BINAURAL_ROOM.tst // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out ../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit @@ -787,8 +787,8 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_dec HOA2 48 bit_error testv/stv3OA48c.wav_SBA_192000_48-48_HOA2_FER5.tst // SBA at 48 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.wav bit -../IVAS_dec 5_1 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_DTX_5_1.tst +../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c_cut_.004.wav bit +../IVAS_dec 5_1 48 bit testv/stv3OA48c_cut_.004.wav_SBA_48000_48-48_DTX_5_1.tst // SBA at 160 kbps, 32kHz in, 32kHz out, FOA out ../IVAS_cod -sba 1 160000 32 testv/stvFOA32c.wav bit @@ -921,17 +921,17 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.wav_SBA_PCA_256000_48-48_BINAURAL.tst // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out, DTX on, EXT out -../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c.wav bit -../IVAS_dec EXT 32 bit testv/stvFOA32c.wav_sw_32-32_DTX_EXT.tst +../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c_cut_.004.wav bit +../IVAS_dec EXT 32 bit testv/stvFOA32c_cut_.004.wav_sw_32-32_DTX_EXT.tst // SBA planar 2OA bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out, DTX on, EXT out -../IVAS_cod -dtx -sba -2 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv2OA32c.wav bit -../IVAS_dec EXT 32 bit testv/stv2OA32c.wav_sw_32-32_DTX_EXT.tst +../IVAS_cod -dtx -sba -2 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv2OA32c_cut_.004.wav bit +../IVAS_dec EXT 32 bit testv/stv2OA32c_cut_.004.wav_sw_32-32_DTX_EXT.tst // SBA 3OA bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, DTX on, random FER at 5%, EXT out -../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv3OA48c.wav bit +../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv3OA48c_cut_.004.wav bit eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g192 bit_error -../IVAS_dec EXT 48 bit_error testv/stv3OA48c.wav_sw_48-48_DTX_EXT_FER5.tst +../IVAS_dec EXT 48 bit_error testv/stv3OA48c_cut_.004.wav_sw_48-48_DTX_EXT_FER5.tst // SBA planar FOA bitrate switching from 13.2 kbps to 512 kbps, 32kHz in, 32kHz out, EXT out ../IVAS_cod -sba -1 ../scripts/switchPaths/sw_13k2_512k.bin 32 testv/stvFOA32c.wav bit diff --git a/scripts/config/self_test_basop_encoder.prm b/scripts/config/self_test_basop_encoder.prm index 7169e41fdc..771287a711 100644 --- a/scripts/config/self_test_basop_encoder.prm +++ b/scripts/config/self_test_basop_encoder.prm @@ -153,7 +153,7 @@ // SBA planar FOA bitrate switching from 13.2 kbps to 512 kbps, 32kHz in, 32kHz out, FOA out ../IVAS_cod -sba -1 ../scripts/switchPaths/sw_13k2_512k.bin 32 testv/stvFOA32c.wav bit -../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_sw_32-32_DTX_FOA.tst +../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_sw_32-32_FOA.tst // SBA planar 3OA bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, HOA3 out ../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.wav bit @@ -161,11 +161,11 @@ // SBA planar 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out ../IVAS_cod -sba -3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit -../IVAS_dec HOA3 48 bit testv/stv3OA48c.wav_sw_48-48_DTX_HOA3.tst +../IVAS_dec HOA3 48 bit testv/stv3OA48c.wav_sw_48-48_HOA3.tst // SBA planar 2OA bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out, DTX on, HOA2out -../IVAS_cod -dtx -sba -2 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv2OA32c.wav bit -../IVAS_dec HOA2 32 bit testv/stv2OA32c.wav_sw_32-32_DTX_HOA2.tst +../IVAS_cod -dtx -sba -2 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv2OA32c_cut_.004.wav bit +../IVAS_dec HOA2 32 bit testv/stv2OA32c_cut_.004.wav_sw_32-32_DTX_HOA2.tst // SBA at 96 kbps, 48kHz in, 48kHz out, FOA out ../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.wav bit @@ -180,20 +180,20 @@ ../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_HOA3.tst // SBA at 64 kpbs, 48kHz in, 48kHz out, FOA out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit -../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_DTX_FOA.tst +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c_cut_.004.wav bit +../IVAS_dec FOA 48 bit testv/stvFOA48c_cut_.004.wav_SBA_64000_48-48_DTX_FOA.tst // SBA at 64 kbps, 48kHz in, 48kHz out, FOA out ../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_FOA.tst // SBA at 64 kbps, 32kHz in, 32kHz out, FOA out, DTX -../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c.wav bit -../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_SBA_64000_32-32_DTX_FOA.tst +../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c_cut_.004.wav bit +../IVAS_dec FOA 32 bit testv/stvFOA32c_cut_.004.wav_SBA_64000_32-32_DTX_FOA.tst // SBA at 48 kbps, 48kHz in, 48kHz out, DTX on, HOA3 out -../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.wav bit -../IVAS_dec HOA3 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_DTX_HOA3.tst +../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c_cut_.004.wav bit +../IVAS_dec HOA3 48 bit testv/stv3OA48c_cut_.004.wav_SBA_48000_48-48_DTX_HOA3.tst // SBA at 48 kbps, 48kHz in, 48kHz out, HOA3 out ../IVAS_cod -sba 3 48000 48 testv/stv3OA48c.wav bit @@ -204,12 +204,12 @@ ../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_HOA3.tst // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, HOA3 out -../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit -../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural.tst +../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c_cut_.004.wav bit +../IVAS_dec HOA3 32 bit testv/stv3OA32c_cut_.004.wav_SBA_48000_32-32_DTX_Binaural.tst // SBA at 32 kbps, 48kHz in, 48kHz out, FOA out, DTX, bandwidth switching -../IVAS_cod -max_band testv/ivas_bws_20fr_start_FB.txt -dtx -sba 1 32000 48 testv/stvFOA48c.wav bit -../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_SBA_32000_48-48_DTX_FOA.tst +../IVAS_cod -max_band testv/ivas_bws_20fr_start_FB.txt -dtx -sba 1 32000 48 testv/stvFOA48c_cut_.004.wav bit +../IVAS_dec FOA 48 bit testv/stvFOA48c_cut_.004.wav_SBA_32000_48-48_DTX_FOA.tst // SBA at 32 kbps, 32kHz in, 32kHz out, FOA out ../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit @@ -268,20 +268,20 @@ ../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_sw_48-48_FOA.tst // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out, DTX on, FOA out -../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c.wav bit -../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_sw_32-32_DTX_FOA.tst +../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c_cut_.004.wav bit +../IVAS_dec FOA 32 bit testv/stvFOA32c_cut_.004.wav_sw_32-32_DTX_FOA.tst // SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out ../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit ../IVAS_dec HOA3 48 bit testv/stv3OA48c.wav_sw_48-48_HOA3.tst // SBA 3OA bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, DTX on, HOA3 out -../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv3OA48c.wav bit -../IVAS_dec HOA3 48 bit testv/stv3OA48c.wav_sw_48-48_DTX_HOA3.tst +../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv3OA48c_cut_.004.wav bit +../IVAS_dec HOA3 48 bit testv/stv3OA48c_cut_.004.wav_sw_48-48_DTX_HOA3.tst // SBA 3OA bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out, DTX on, HOA3 out ../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv3OA32c_cut_.004.wav bit -../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_sw_32-32_DTX_HOA3.tst +../IVAS_dec HOA3 32 bit testv/stv3OA32c_cut_.004.wav_sw_32-32_DTX_HOA3.tst // SBA 3OA at 96 kbps, 48kHz in, 48kHz out, HOA3 out ../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.wav bit -- GitLab From 3b4d08bf8984f5850918a42cac5236e34d786635 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 23 Mar 2025 12:44:09 +0100 Subject: [PATCH 28/46] add self-test conditions to cover binaural renderers flushing --- scripts/config/self_test.prm | 21 +++++++++++++++++++++ scripts/config/self_test_ltv.prm | 23 ++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 5b3df2cf08..7d7893cf69 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1589,6 +1589,11 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP FOA 48 netsimoutput testv/stv4ISM48s.wav_32000_48-48_FOA_JBM5.tst +// 3 ISM with metadata bitrate switching from 48 kbps to 32 kbps, 48 kHz in, 32 kHz out, DTX, BINAURAL_ROOM_IR out, JBM Prof 5 +../IVAS_cod -dtx -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv ../scripts/switchPaths/sw_48-32k_10fr.bin 48 testv/stv3ISM48s.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -VOIP BINAURAL_ROOM_IR 32 netsimoutput testv/stv3ISM48s.wav_sw_48-32_DTX_BINAURAL_ROOM_IR_JBM5.tst + // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out, JBM Prof 5 ../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 @@ -1609,6 +1614,17 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/stv714MC48c.wav_MC714_256000_48-48_7_1_4_JBM5.tst +// Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5 +../IVAS_cod -mc 7_1 sw_24k4_384k.bin 48 testv/stv714MC48c.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -T testv/headrot.csv -VOIP binaural_room_reverb 32 netsimoutput testv/stv71MC48c.wav_MC71_brsw_48-32_BinauralRoomReverb_Headrot_JBM5.tst + +// Multi-channel 7_1_4 bitrate switching, 48kHz in, 48kHz out, BINAURAL out, HR, JBM Prof 5 +../IVAS_cod -mc 7_1_4 sw_24k4_384k.bin 48 testv/stv714MC48c.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -T testv/headrot.csv -VOIP BINAURAL 48 netsimoutput testv/stv714MC48c.wav_MC714_brsw_48-48_BINAURAL_Headrot_JBM5.tst + + // MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 32kHz out, 5_1 out, JBM Prof 5 ../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 @@ -1954,6 +1970,11 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g ../IVAS_cod -ism_sba 4 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stvOSBA_4ISM_3OA48c.wav bit ../IVAS_dec -render_config testv/rend_config_hospital_patientroom.cfg BINAURAL_ROOM_REVERB 48 bit testv/stvOSBA_4ISM_3OA48c.wav_BINAURAL_ROOM_REVERB_512000_48-48_custom_configuration.tst +// OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL out, JBM Prof 5 +../IVAS_cod -ism_sba 2 2 testv/stvISM1.csv testv/stvISM2.csv ../scripts/switchPaths/sw_24k4_256k.bin 32 testv/stvOSBA_2ISM_2OA32c.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -VOIP BINAURAL 48 bit testv/stvOSBA_2ISM_2OA32c.wav_BINAURAL_brsw_32-48_JBM5.tst + // OMASA 2Dir2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, BINAURAL out, default object editing, 1SEP-PARAM ../IVAS_cod -ism_masa 4 2 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv testv/stv2MASA2TC48c.met 80000 48 testv/stvOMASA_4ISM_2MASA2TC48c.wav bit diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index 2aad90886b..1d73fa7390 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1589,6 +1589,11 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP FOA 48 netsimoutput testv/ltv48_4ISM.wav_32000_48-48_FOA_JBM5.tst +// 3 ISM with metadata bitrate switching from 48 kbps to 32 kbps, 48 kHz in, 32 kHz out, DTX, BINAURAL_ROOM_IR out, JBM Prof 5 +../IVAS_cod -dtx -ism 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/stvISM3.csv ../scripts/switchPaths/sw_48-32k_10fr.bin 48 testv/ltv32_3ISM.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -VOIP BINAURAL_ROOM_IR 32 netsimoutput testv/ltv32_3ISM.wav_sw_48-32_DTX_BINAURAL_ROOM_IR_JBM5.tst + // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out, JBM Prof 5 ../IVAS_cod -sba 3 80000 32 testv/ltv32_HOA3.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 @@ -1604,11 +1609,22 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/ltv48_MC51.wav_MC51_384000_48-48_7_1_4_JBM5.tst -// Multi-channel 7_1_$ at 256 kbps, 48kHz in, 48kHz out, 7_1_4 out, JBM Prof 5 +// Multi-channel 7_1_4 at 256 kbps, 48kHz in, 48kHz out, 7_1_4 out, JBM Prof 5 ../IVAS_cod -mc 7_1_4 256000 48 testv/ltv48_MC714.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/ltv48_MC714.wav_MC714_256000_48-48_7_1_4_JBM5.tst +// Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5 +../IVAS_cod -mc 7_1 sw_24k4_384k.bin 48 testv/ltv48_MC71.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -T testv/headrot.csv -VOIP binaural_room_reverb 32 netsimoutput testv/ltv48_MC71.wav_MC71_brsw_48-32_BinauralRoomReverb_Headrot_JBM5.tst + +// Multi-channel 7_1_4 bitrate switching, 48kHz in, 48kHz out, BINAURAL out, HR, JBM Prof 5 +../IVAS_cod -mc 7_1_4 sw_24k4_384k.bin 48 testv/ltv48_MC714.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -T testv/headrot.csv -VOIP BINAURAL 48 netsimoutput testv/ltv48_MC714.wav_MC714_brsw_48-48_BINAURAL_Headrot_JBM5.tst + + // MASA 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 32kHz out, 5_1 out, JBM Prof 5 ../IVAS_cod -masa 1 testv/ltv48_MASA1TC.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/ltv48_MASA1TC.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 @@ -1954,6 +1970,11 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g ../IVAS_cod -ism_sba 4 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/ltvISM3.csv testv/ltvISM4.csv 512000 48 testv/ltv48_OSBA_4ISM_HOA3.wav bit ../IVAS_dec -render_config testv/rend_config_hospital_patientroom.cfg BINAURAL_ROOM_REVERB 48 bit testv/ltv48_OSBA_4ISM_HOA3.wav_BINAURAL_ROOM_REVERB_512000_48-48_custom_configuration.tst +// OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL out, JBM Prof 5 +../IVAS_cod -ism_sba 2 2 testv/ltvISM1.csv testv/ltvISM2.csv ../scripts/switchPaths/sw_24k4_256k.bin 32 testv/ltv32_OSBA_2ISM_HOA2.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -VOIP BINAURAL 48 bit testv/ltv32_OSBA_2ISM_HOA2.wav_BINAURAL_brsw_32-48_JBM5.tst + // OMASA 2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, BINAURAL out, default object editing, 1SEP-PARAM ../IVAS_cod -ism_masa 4 2 testv/ltv48_OMASA_4ISM_2TC_ISM1.csv testv/ltv48_OMASA_4ISM_2TC_ISM2.csv testv/ltv48_OMASA_4ISM_2TC_ISM3.csv testv/ltv48_OMASA_4ISM_2TC_ISM4.csv testv/ltv48_OMASA_4ISM_2TC.met 80000 48 testv/ltv48_OMASA_4ISM_2TC.wav bit -- GitLab From 27729b5799ac21c22b76bb7f6ec229cbccdd1503 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 23 Mar 2025 13:07:29 +0100 Subject: [PATCH 29/46] fix error profile path --- scripts/config/self_test.prm | 4 ++-- scripts/config/self_test_ltv.prm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 7d7893cf69..a15e36eb8d 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1615,12 +1615,12 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit ../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/stv714MC48c.wav_MC714_256000_48-48_7_1_4_JBM5.tst // Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5 -../IVAS_cod -mc 7_1 sw_24k4_384k.bin 48 testv/stv714MC48c.wav bit +../IVAS_cod -mc 7_1 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/stv714MC48c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -T testv/headrot.csv -VOIP binaural_room_reverb 32 netsimoutput testv/stv71MC48c.wav_MC71_brsw_48-32_BinauralRoomReverb_Headrot_JBM5.tst // Multi-channel 7_1_4 bitrate switching, 48kHz in, 48kHz out, BINAURAL out, HR, JBM Prof 5 -../IVAS_cod -mc 7_1_4 sw_24k4_384k.bin 48 testv/stv714MC48c.wav bit +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/stv714MC48c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -T testv/headrot.csv -VOIP BINAURAL 48 netsimoutput testv/stv714MC48c.wav_MC714_brsw_48-48_BINAURAL_Headrot_JBM5.tst diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index 1d73fa7390..1d879c837e 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1615,12 +1615,12 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit ../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/ltv48_MC714.wav_MC714_256000_48-48_7_1_4_JBM5.tst // Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5 -../IVAS_cod -mc 7_1 sw_24k4_384k.bin 48 testv/ltv48_MC71.wav bit +../IVAS_cod -mc 7_1 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/ltv48_MC71.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -T testv/headrot.csv -VOIP binaural_room_reverb 32 netsimoutput testv/ltv48_MC71.wav_MC71_brsw_48-32_BinauralRoomReverb_Headrot_JBM5.tst // Multi-channel 7_1_4 bitrate switching, 48kHz in, 48kHz out, BINAURAL out, HR, JBM Prof 5 -../IVAS_cod -mc 7_1_4 sw_24k4_384k.bin 48 testv/ltv48_MC714.wav bit +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/ltv48_MC714.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -T testv/headrot.csv -VOIP BINAURAL 48 netsimoutput testv/ltv48_MC714.wav_MC714_brsw_48-48_BINAURAL_Headrot_JBM5.tst -- GitLab From 12e05b688cf328afee8918cbd5d84fea10acf56e Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 23 Mar 2025 13:26:36 +0100 Subject: [PATCH 30/46] fix typo --- scripts/config/self_test.prm | 4 ++-- scripts/config/self_test_ltv.prm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index a15e36eb8d..8e6286f5bf 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1615,7 +1615,7 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit ../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/stv714MC48c.wav_MC714_256000_48-48_7_1_4_JBM5.tst // Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5 -../IVAS_cod -mc 7_1 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/stv714MC48c.wav bit +../IVAS_cod -mc 7_1 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/stv71MC48c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -T testv/headrot.csv -VOIP binaural_room_reverb 32 netsimoutput testv/stv71MC48c.wav_MC71_brsw_48-32_BinauralRoomReverb_Headrot_JBM5.tst @@ -1973,7 +1973,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g // OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL out, JBM Prof 5 ../IVAS_cod -ism_sba 2 2 testv/stvISM1.csv testv/stvISM2.csv ../scripts/switchPaths/sw_24k4_256k.bin 32 testv/stvOSBA_2ISM_2OA32c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -VOIP BINAURAL 48 bit testv/stvOSBA_2ISM_2OA32c.wav_BINAURAL_brsw_32-48_JBM5.tst +../IVAS_dec -VOIP BINAURAL 48 netsimoutput testv/stvOSBA_2ISM_2OA32c.wav_BINAURAL_brsw_32-48_JBM5.tst // OMASA 2Dir2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, BINAURAL out, default object editing, 1SEP-PARAM diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index 1d879c837e..116ea71dfe 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1973,7 +1973,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g // OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL out, JBM Prof 5 ../IVAS_cod -ism_sba 2 2 testv/ltvISM1.csv testv/ltvISM2.csv ../scripts/switchPaths/sw_24k4_256k.bin 32 testv/ltv32_OSBA_2ISM_HOA2.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -VOIP BINAURAL 48 bit testv/ltv32_OSBA_2ISM_HOA2.wav_BINAURAL_brsw_32-48_JBM5.tst +../IVAS_dec -VOIP BINAURAL 48 netsimoutput testv/ltv32_OSBA_2ISM_HOA2.wav_BINAURAL_brsw_32-48_JBM5.tst // OMASA 2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, BINAURAL out, default object editing, 1SEP-PARAM -- GitLab From 2bc5fc721363d6c67b731bb3a433475a04fa95eb Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 23 Mar 2025 13:57:53 +0100 Subject: [PATCH 31/46] add -Tracefile tracefile_dec --- scripts/config/self_test.prm | 8 ++++---- scripts/config/self_test_ltv.prm | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 8e6286f5bf..9550b0dbb1 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1592,7 +1592,7 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit // 3 ISM with metadata bitrate switching from 48 kbps to 32 kbps, 48 kHz in, 32 kHz out, DTX, BINAURAL_ROOM_IR out, JBM Prof 5 ../IVAS_cod -dtx -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv ../scripts/switchPaths/sw_48-32k_10fr.bin 48 testv/stv3ISM48s.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -VOIP BINAURAL_ROOM_IR 32 netsimoutput testv/stv3ISM48s.wav_sw_48-32_DTX_BINAURAL_ROOM_IR_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL_ROOM_IR 32 netsimoutput testv/stv3ISM48s.wav_sw_48-32_DTX_BINAURAL_ROOM_IR_JBM5.tst // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out, JBM Prof 5 ../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit @@ -1617,12 +1617,12 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit // Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5 ../IVAS_cod -mc 7_1 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/stv71MC48c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -T testv/headrot.csv -VOIP binaural_room_reverb 32 netsimoutput testv/stv71MC48c.wav_MC71_brsw_48-32_BinauralRoomReverb_Headrot_JBM5.tst +../IVAS_dec -T testv/headrot.csv -Tracefile tracefile_dec -VOIP binaural_room_reverb 32 netsimoutput testv/stv71MC48c.wav_MC71_brsw_48-32_BinauralRoomReverb_Headrot_JBM5.tst // Multi-channel 7_1_4 bitrate switching, 48kHz in, 48kHz out, BINAURAL out, HR, JBM Prof 5 ../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/stv714MC48c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -T testv/headrot.csv -VOIP BINAURAL 48 netsimoutput testv/stv714MC48c.wav_MC714_brsw_48-48_BINAURAL_Headrot_JBM5.tst +../IVAS_dec -T testv/headrot.csv -Tracefile tracefile_dec -VOIP BINAURAL 48 netsimoutput testv/stv714MC48c.wav_MC714_brsw_48-48_BINAURAL_Headrot_JBM5.tst // MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 32kHz out, 5_1 out, JBM Prof 5 @@ -1973,7 +1973,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g // OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL out, JBM Prof 5 ../IVAS_cod -ism_sba 2 2 testv/stvISM1.csv testv/stvISM2.csv ../scripts/switchPaths/sw_24k4_256k.bin 32 testv/stvOSBA_2ISM_2OA32c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -VOIP BINAURAL 48 netsimoutput testv/stvOSBA_2ISM_2OA32c.wav_BINAURAL_brsw_32-48_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL 48 netsimoutput testv/stvOSBA_2ISM_2OA32c.wav_BINAURAL_brsw_32-48_JBM5.tst // OMASA 2Dir2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, BINAURAL out, default object editing, 1SEP-PARAM diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index 116ea71dfe..fa9917c6a0 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1592,7 +1592,7 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit // 3 ISM with metadata bitrate switching from 48 kbps to 32 kbps, 48 kHz in, 32 kHz out, DTX, BINAURAL_ROOM_IR out, JBM Prof 5 ../IVAS_cod -dtx -ism 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/stvISM3.csv ../scripts/switchPaths/sw_48-32k_10fr.bin 48 testv/ltv32_3ISM.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -VOIP BINAURAL_ROOM_IR 32 netsimoutput testv/ltv32_3ISM.wav_sw_48-32_DTX_BINAURAL_ROOM_IR_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL_ROOM_IR 32 netsimoutput testv/ltv32_3ISM.wav_sw_48-32_DTX_BINAURAL_ROOM_IR_JBM5.tst // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out, JBM Prof 5 ../IVAS_cod -sba 3 80000 32 testv/ltv32_HOA3.wav bit @@ -1617,12 +1617,12 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit // Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5 ../IVAS_cod -mc 7_1 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/ltv48_MC71.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -T testv/headrot.csv -VOIP binaural_room_reverb 32 netsimoutput testv/ltv48_MC71.wav_MC71_brsw_48-32_BinauralRoomReverb_Headrot_JBM5.tst +../IVAS_dec -T testv/headrot.csv -Tracefile tracefile_dec -VOIP binaural_room_reverb 32 netsimoutput testv/ltv48_MC71.wav_MC71_brsw_48-32_BinauralRoomReverb_Headrot_JBM5.tst // Multi-channel 7_1_4 bitrate switching, 48kHz in, 48kHz out, BINAURAL out, HR, JBM Prof 5 ../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_384k.bin 48 testv/ltv48_MC714.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -T testv/headrot.csv -VOIP BINAURAL 48 netsimoutput testv/ltv48_MC714.wav_MC714_brsw_48-48_BINAURAL_Headrot_JBM5.tst +../IVAS_dec -T testv/headrot.csv -Tracefile tracefile_dec -VOIP BINAURAL 48 netsimoutput testv/ltv48_MC714.wav_MC714_brsw_48-48_BINAURAL_Headrot_JBM5.tst // MASA 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 32kHz out, 5_1 out, JBM Prof 5 @@ -1973,7 +1973,7 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g // OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL out, JBM Prof 5 ../IVAS_cod -ism_sba 2 2 testv/ltvISM1.csv testv/ltvISM2.csv ../scripts/switchPaths/sw_24k4_256k.bin 32 testv/ltv32_OSBA_2ISM_HOA2.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -VOIP BINAURAL 48 netsimoutput testv/ltv32_OSBA_2ISM_HOA2.wav_BINAURAL_brsw_32-48_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL 48 netsimoutput testv/ltv32_OSBA_2ISM_HOA2.wav_BINAURAL_brsw_32-48_JBM5.tst // OMASA 2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, BINAURAL out, default object editing, 1SEP-PARAM -- GitLab From a713dc8fe58799138c5b24682457b24681c32a8b Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 23 Mar 2025 15:16:42 +0100 Subject: [PATCH 32/46] typo --- scripts/config/self_test_ltv.prm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index fa9917c6a0..fd2c50bc16 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1590,9 +1590,9 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit ../IVAS_dec -Tracefile tracefile_dec -VOIP FOA 48 netsimoutput testv/ltv48_4ISM.wav_32000_48-48_FOA_JBM5.tst // 3 ISM with metadata bitrate switching from 48 kbps to 32 kbps, 48 kHz in, 32 kHz out, DTX, BINAURAL_ROOM_IR out, JBM Prof 5 -../IVAS_cod -dtx -ism 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/stvISM3.csv ../scripts/switchPaths/sw_48-32k_10fr.bin 48 testv/ltv32_3ISM.wav bit +../IVAS_cod -dtx -ism 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/ltvISM3.csv ../scripts/switchPaths/sw_48-32k_10fr.bin 48 testv/ltv48_3ISM.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL_ROOM_IR 32 netsimoutput testv/ltv32_3ISM.wav_sw_48-32_DTX_BINAURAL_ROOM_IR_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL_ROOM_IR 32 netsimoutput testv/ltv48_3ISM.wav_sw_48-32_DTX_BINAURAL_ROOM_IR_JBM5.tst // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out, JBM Prof 5 ../IVAS_cod -sba 3 80000 32 testv/ltv32_HOA3.wav bit -- GitLab From df14a46ec739d84f84dbfcdf9a4edfd5188a6c20 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 25 Mar 2025 09:42:44 +0100 Subject: [PATCH 33/46] add testcases with DTX + neutral JBM profile --- scripts/config/self_test.prm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 5b3df2cf08..0a400d0e1f 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1578,6 +1578,25 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_dec -non_diegetic_pan 80 STEREO 48 bit testv/stv1ISM48s.pcm_ISM_32000_48-48_STEREO_NON-DIEGETIC-PAN_80.tst +// stereo at 32 kbps, 48 kHz in, 32 kHz out, DTX on, JBM Prof 0 +../IVAS_cod -stereo -dtx 32000 48 testv/stvST48n.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_0.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -Tracefile tracefile_dec -VOIP STEREO 32 netsimoutput testv/stvST48n.wav_stereo_32000_48-32_DTX_JBM0.tst + +// 4 ISm with metadata at 64 kbps, 48 kHz in, 48 kHz out, DTX on, EXT out, JBM Prof 0 +../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48n.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_0.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -Tracefile tracefile_dec -VOIP EXT 48 netsimoutput testv/stv4ISM48s.wav_64000_48-48_EXT_JBM0.tst + +// MASA 1dir 1TC at 13.2 kbps, 48kHz in, 32kHz out, DTX on, EXT out, JBM Prof 0 +../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 13200 48 testv/stv1MASA1TC48n.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_0.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -Tracefile tracefile_dec -VOIP EXT 32 netsimoutput testv/stv1MASA1TC48n.wav_sw_48-32_EXT_JBM0.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, JBM 0 +../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c_cut_.004.wav bit +networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_0.dat bit netsimoutput tracefile_sim 2 0 +../IVAS_dec -Tracefile tracefile_dec BINAURAL 32 netsimoutput testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_JBM0.tst // stereo at 48 kbps, 16 kHz in, 16 kHz out, DTX on, JBM Prof 5 ../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.wav bit -- GitLab From bfffdff6ca4e2dd08171939752ea23aec3c7bd01 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 25 Mar 2025 10:05:35 +0100 Subject: [PATCH 34/46] add missing -voip --- scripts/config/self_test.prm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 0a400d0e1f..f996b81602 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1596,7 +1596,7 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_0.dat bit // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, JBM 0 ../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c_cut_.004.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_0.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -Tracefile tracefile_dec BINAURAL 32 netsimoutput testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_JBM0.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL 32 netsimoutput testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_JBM0.tst // stereo at 48 kbps, 16 kHz in, 16 kHz out, DTX on, JBM Prof 5 ../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.wav bit -- GitLab From c150a8866da3bed9b4681a6f10157d0b57fd3e89 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Mar 2025 17:05:37 +0100 Subject: [PATCH 35/46] issue 1303: Correctly set the granularity in OSBA, Disc mode, and BINAURAL_ROOM_REVERB output; under NONBE_1303_GRANULARITY_OSBA_REND --- lib_com/options.h | 1 + lib_dec/ivas_sba_dec.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 9c51fe439b..1d413a3310 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -175,6 +175,7 @@ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ #define NONBE_1289_STEREO_SW_TO_MONO /* VA: issue 1289: Fix glitch when stereo signal is decoded to mono n TD->DFT switching */ #define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */ +#define NONBE_1303_GRANULARITY_OSBA_REND /* VA: issue 1303: Correctly set the granularity in OSBA, Disc mode, and BINAURAL_ROOM_REVERB output */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index df7b021c9f..4bb13325b2 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -183,7 +183,11 @@ ivas_error ivas_sba_dec_reconfigure( } else { +#ifdef NONBE_1303_GRANULARITY_OSBA_REND + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#endif { renderer_type_new = RENDERER_BINAURAL_FASTCONV; } -- GitLab From 647358d2fea08a67a2d9bc995da038dc99ef6e50 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 25 Mar 2025 17:37:36 +0100 Subject: [PATCH 36/46] adapt self-test condition: BINAURAL -> BINAURAL_ROOM_REVERB --- scripts/config/self_test.prm | 4 ++-- scripts/config/self_test_ltv.prm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 9550b0dbb1..d2a4e178bf 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1970,10 +1970,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g ../IVAS_cod -ism_sba 4 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stvOSBA_4ISM_3OA48c.wav bit ../IVAS_dec -render_config testv/rend_config_hospital_patientroom.cfg BINAURAL_ROOM_REVERB 48 bit testv/stvOSBA_4ISM_3OA48c.wav_BINAURAL_ROOM_REVERB_512000_48-48_custom_configuration.tst -// OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL out, JBM Prof 5 +// OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL_ROOM_REVERB out, JBM Prof 5 ../IVAS_cod -ism_sba 2 2 testv/stvISM1.csv testv/stvISM2.csv ../scripts/switchPaths/sw_24k4_256k.bin 32 testv/stvOSBA_2ISM_2OA32c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL 48 netsimoutput testv/stvOSBA_2ISM_2OA32c.wav_BINAURAL_brsw_32-48_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL_ROOM_REVERB 48 netsimoutput testv/stvOSBA_2ISM_2OA32c.wav_BINAURAL_brsw_32-48_JBM5.tst // OMASA 2Dir2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, BINAURAL out, default object editing, 1SEP-PARAM diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index fd2c50bc16..30f33b3722 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1970,10 +1970,10 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_10pct.g ../IVAS_cod -ism_sba 4 3 testv/ltvISM1.csv testv/ltvISM2.csv testv/ltvISM3.csv testv/ltvISM4.csv 512000 48 testv/ltv48_OSBA_4ISM_HOA3.wav bit ../IVAS_dec -render_config testv/rend_config_hospital_patientroom.cfg BINAURAL_ROOM_REVERB 48 bit testv/ltv48_OSBA_4ISM_HOA3.wav_BINAURAL_ROOM_REVERB_512000_48-48_custom_configuration.tst -// OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL out, JBM Prof 5 +// OSBA 2OA 2ISM bitrate switching, 32kHz in, 48kHz out, BINAURAL_ROOM_REVERB out, JBM Prof 5 ../IVAS_cod -ism_sba 2 2 testv/ltvISM1.csv testv/ltvISM2.csv ../scripts/switchPaths/sw_24k4_256k.bin 32 testv/ltv32_OSBA_2ISM_HOA2.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL 48 netsimoutput testv/ltv32_OSBA_2ISM_HOA2.wav_BINAURAL_brsw_32-48_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP BINAURAL_ROOM_REVERB 48 netsimoutput testv/ltv32_OSBA_2ISM_HOA2.wav_BINAURAL_brsw_32-48_JBM5.tst // OMASA 2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, BINAURAL out, default object editing, 1SEP-PARAM -- GitLab From c44597ea039f5606dee07ecab1a5660594e84125 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 27 Mar 2025 15:51:00 +0100 Subject: [PATCH 37/46] enable allowed failure for complexity changes this makes it possible to distinguish between changes in complexity numbers (which would turn job yellow) and crashes in the codec (which would turn job red) --- .gitlab-ci.yml | 3 +++ ci/complexity_measurements/getWmops.sh | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2ab15a78b6..e8ebf8062a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2464,6 +2464,9 @@ coverage-test-on-main-scheduled: - *print-common-info - *update-ltv-repo - *complexity-measurements-setup + allow_failure: + exit_codes: + - 123 artifacts: name: "$CI_JOB_NAME--$CI_COMMIT_REF_NAME--sha-$CI_COMMIT_SHA" when: always diff --git a/ci/complexity_measurements/getWmops.sh b/ci/complexity_measurements/getWmops.sh index 5c2225f875..148092eb1a 100755 --- a/ci/complexity_measurements/getWmops.sh +++ b/ci/complexity_measurements/getWmops.sh @@ -72,8 +72,6 @@ wmopsFilenameFlcLast=wmops_newsletter_${ivas_format_for_filename}_to_${output_fo wmopsFilenameFlcDir=${destDir}/wmops/logs wmopsFilenameFlc=${wmopsFilenameFlcDir}/${wmopsFilenameFlcLast} -ret_val=0 - mode_arg="" # for OSBA, there are just too many modes... -> only select HOA3 ones if [ "$ivas_format" == "OSBA" ]; then @@ -83,7 +81,7 @@ fi # instrument and build ./scripts/IvasBuildAndRunChecks.py $mode_arg_script -p $config_file --checks COMPLEXITY --create_complexity_tables ${wmopsFilenameFlc} -C $ivas_format $mode_arg -f ${ep} --oc $output_format -ret_val=$? +ret_val_script=$? # TODO: only split wmops and ram files ./ci/complexity_measurements/split_by_levels.py $(ls ${wmopsFilenameFlc}*.csv) @@ -137,8 +135,11 @@ else python3 ci/complexity_measurements/genWebpageData.py --wmops_per_op_log ${wmopsFilenameFlc}_WMOPS.csv --rom_log ${log_rom_all} fi +ret_val=0 python3 ${scriptDir}/check_for_changes.py --wmops_logfiles $(ls ${destDir}/wmops/log_wmops_all*.txt) --ram_logfiles $(ls ${destDir}/wmops/log_ram_all*.txt) --rom_logfile ${destDir}/wmops/log_rom_all.txt if [ "$?" != "0" ]; then + ret_val=123 +elif [ "$ret_val_script" != "0" ]; then ret_val=1 fi -- GitLab From 6db5b3a2a595c3cd6fb60e8f2b64d0a3fed9e1b4 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Fri, 28 Mar 2025 11:16:35 +0100 Subject: [PATCH 38/46] Fix uint32_t underflow --- lib_dec/jbm_jb4_jmf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/jbm_jb4_jmf.c b/lib_dec/jbm_jb4_jmf.c index 721a6937d0..9abb3d9732 100644 --- a/lib_dec/jbm_jb4_jmf.c +++ b/lib_dec/jbm_jb4_jmf.c @@ -208,7 +208,7 @@ int16_t JB4_JMF_PushPacket( rtpTimeDiff = (int32_t) ( rtpTimeStamp - h->lastRtpTimeStamp ); sysTimeDiff = sysTime - h->lastSysTime; - offset = sysTime - rtpTimeStamp; + offset = (int32_t) sysTime - (int32_t) rtpTimeStamp; /* get the delay (yes, signed!!!!) */ delay = sysTimeDiff - rtpTimeDiff + h->lastDelay; -- GitLab From 3ee23ee6aa5d05a190d64c5d06de69133e550cd3 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Fri, 28 Mar 2025 13:25:37 +0100 Subject: [PATCH 39/46] Increase minimum required CMake version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2143c9090..d5c688e16a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ # cmake --build . --config Release -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) set(CMAKE_C_STANDARD 99) -- GitLab From bdf81dbfaf5b3624c6fd4c6e6fa3bd4babd50a3b Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 28 Mar 2025 14:05:33 +0000 Subject: [PATCH 40/46] Change project to be only C --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5c688e16a..de4727bec8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ if(WMOPS) add_definitions("-DWMOPS=1") endif() -project(stereo-evs) +project(stereo-evs LANGUAGES C) set_property(GLOBAL PROPERTY USE_FOLDERS ON) # make Visual Studio projects look nicer include(CTest) -- GitLab From ddfbe510e0db86f93647a4de626f2cc4bf935eab Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 1 Apr 2025 15:37:08 +1100 Subject: [PATCH 41/46] use scaled input to trigger AGC --- scripts/config/self_test.prm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index eba5d68e86..82357277fb 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -620,8 +620,12 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_dec -t testv/headrot.csv -exof testv/headrot_case00_3000_q_combinedRotationTest.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Headrot_EXOF.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, HR, OT -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c_cut_16.0.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c_cut_16.0.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst + +// SBA at 16.4 kbps, 48kHz in, 48kHz out, FOA out +../IVAS_cod -sba 1 16400 48 testv/stvFOA48c_cut_16.0.wav bit +../IVAS_dec FOA 48 bit testv/stvFOA48c_cut_16.0.wav_SBA_16400_48-48_FOA.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, HR, exo, OT ../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -- GitLab From 6c5c04698deb2d54f2f4a568fb754b4396aceb39 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Apr 2025 12:16:56 +0200 Subject: [PATCH 42/46] incorporate scaled signal testcases for AGC in basop enc prm file --- scripts/config/self_test_basop_encoder.prm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/config/self_test_basop_encoder.prm b/scripts/config/self_test_basop_encoder.prm index 771287a711..bd43eecb6a 100644 --- a/scripts/config/self_test_basop_encoder.prm +++ b/scripts/config/self_test_basop_encoder.prm @@ -224,8 +224,8 @@ ../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_SBA_256000_32-32_FOA.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, HOA3 out -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit -../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_HOA3.tst +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c_cut_16.0.wav bit +../IVAS_dec HOA3 32 bit testv/stv3OA32c_cut_16.0.wav_SBA_24400_32-32_HOA3.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, HOA3 out ../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit @@ -247,6 +247,10 @@ ../IVAS_cod -sba 3 16400 32 testv/stv3OA32c.wav bit ../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_16400_32-32_HOA3.tst +// SBA at 16.4 kbps, 48kHz in, 48kHz out, HOA3 out +../IVAS_cod -sba 3 16400 48 testv/stv3OA48c_cut_16.0.wav bit +../IVAS_dec HOA3 32 bit testv/stv3OA48c_cut_16.0.wav_SBA_16400_48-48_HOA3.tst + // SBA at 13.2 kbps, 48kHz in, 48kHz out, FOA out ../IVAS_cod -sba 1 13200 48 testv/stvFOA48c.wav bit ../IVAS_dec FOA 48 bit testv/stvFOA32c.wav_SBA_13200_48-48_FOA.tst -- GitLab From c86d51b9c2bbbe86aba90f62b378467d1dc624b9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Apr 2025 12:43:23 +0200 Subject: [PATCH 43/46] fix ref/cut signal order in cmp_pcm calls --- tests/codec_be_on_mr_nonselection/test_sba.py | 2 +- tests/renderer/utils.py | 81 ++++++++++--------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_sba.py b/tests/codec_be_on_mr_nonselection/test_sba.py index ce6d073942..f0e81e82d2 100644 --- a/tests/codec_be_on_mr_nonselection/test_sba.py +++ b/tests/codec_be_on_mr_nonselection/test_sba.py @@ -1252,8 +1252,8 @@ def sba_dec( sampling_rate_Hz = int(sampling_rate) * 1000 cmp_result, reason = cmp_pcm( - dut_out_file, ref_out_file, + dut_out_file, output_config, sampling_rate_Hz, get_mld=get_mld, diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 2be90224a6..aac6a3d7c8 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -325,37 +325,37 @@ def run_renderer( odg_ref = out_file_ref[0:-4] + ".BINAURAL.wav" if out_fmt not in PEAQ_SUPPORTED_FMT: - if in_fmt in PEAQ_SUPPORTED_FMT: - new_fmt = in_fmt # MONO or STEREO + if in_fmt in PEAQ_SUPPORTED_FMT: + new_fmt = in_fmt # MONO or STEREO + else: + # If input is META which contains stereo, new_fmt needs to be STEREO. + if in_fmt == "META": + with open(in_file, "r") as scene: + if "STEREO" in scene.read(): + new_fmt = "STEREO" + else: + new_fmt = "BINAURAL" else: - # If input is META which contains stereo, new_fmt needs to be STEREO. - if in_fmt == "META": - with open(in_file,"r") as scene: - if "STEREO" in scene.read(): - new_fmt = "STEREO" - else: - new_fmt = "BINAURAL" - else: - new_fmt = "BINAURAL" - - # Render test to PEAQ supported format (MONO, STEREO or BINAURAL) - cmd2 = RENDERER_CMD[:] - cmd2[2] = str(out_file) # in_file - cmd2[4] = str(out_fmt) # in_fmt - cmd2[6] = odg_test # out_file - cmd2[8] = new_fmt # out_fmt - cmd2[10] = str(sr) - cmd2[0] += BIN_SUFFIX_MERGETARGET # Use IVAS_rend_ref for re-rendering - cmd2[0] += binary_suffix - if "MASA" in str(out_fmt): - cmd2.extend(["-im", out_file + ".met"]) - run_cmd(cmd2, test_info, env) - - # Render ref to BINAURAL with same settings as test - cmd2[2] = str(out_file_ref) # in_file - cmd2[6] = odg_ref # out_file - run_cmd(cmd2, test_info, env) - out_fmt_bin = new_fmt + new_fmt = "BINAURAL" + + # Render test to PEAQ supported format (MONO, STEREO or BINAURAL) + cmd2 = RENDERER_CMD[:] + cmd2[2] = str(out_file) # in_file + cmd2[4] = str(out_fmt) # in_fmt + cmd2[6] = odg_test # out_file + cmd2[8] = new_fmt # out_fmt + cmd2[10] = str(sr) + cmd2[0] += BIN_SUFFIX_MERGETARGET # Use IVAS_rend_ref for re-rendering + cmd2[0] += binary_suffix + if "MASA" in str(out_fmt): + cmd2.extend(["-im", out_file + ".met"]) + run_cmd(cmd2, test_info, env) + + # Render ref to BINAURAL with same settings as test + cmd2[2] = str(out_file_ref) # in_file + cmd2[6] = odg_ref # out_file + run_cmd(cmd2, test_info, env) + out_fmt_bin = new_fmt else: out_fmt_bin = out_fmt odg_test = out_file @@ -365,8 +365,8 @@ def run_renderer( # Render input to match out_fmt_bin using same config as input, but with IVAS_rend_ref cmd[0] += BIN_SUFFIX_MERGETARGET cmd[0] += binary_suffix - cmd[6] = odg_input # out_file - cmd[8] = out_fmt_bin # out_fmt + cmd[6] = odg_input # out_file + cmd[8] = out_fmt_bin # out_fmt run_cmd(cmd, test_info, env) else: odg_input = in_file @@ -374,8 +374,8 @@ def run_renderer( # see constants.py ref_fs = int(cmd[10]) * 1000 output_differs, reason = cmp_pcm( - out_file, out_file_ref, + out_file, out_fmt, ref_fs, get_mld=get_mld, @@ -455,7 +455,6 @@ def binauralize_input_and_output( in_sr, out_sr, ): - # Use current folder as location for temporary directory, since scene description does not handle spaces in path with tempfile.TemporaryDirectory(dir=".") as tmp_dir: tmp_dir = Path(tmp_dir) @@ -464,7 +463,7 @@ def binauralize_input_and_output( scene_in = str(tmp_dir.joinpath("scene_in.txt")) # File names for binauralized signals, if needed - ref_input_file_binaural = ref_output_file[0:-4] + ".INPUT.BINAURAL.wav" + ref_input_file_binaural = ref_output_file[0:-4] + ".INPUT.BINAURAL.wav" dut_output_file_binaural = dut_output_file[0:-4] + ".BINAURAL.wav" ref_output_file_binaural = ref_output_file[0:-4] + ".BINAURAL.wav" @@ -492,7 +491,7 @@ def binauralize_input_and_output( ",".join(line.split(",")[:2]) + "\n" ) # Keep only first two elements: azim, elev else: - md_out_file = "NULL" # Cannot truncate NULL, just insert it without modification + md_out_file = "NULL" # Cannot truncate NULL, just insert it without modification truncated_meta_files.append(md_out_file) in_meta_files = truncated_meta_files @@ -522,7 +521,9 @@ def binauralize_input_and_output( if "OSBA" in output_config or "OMASA" in output_config: if "OSBA" in output_config: - output_config = output_config[:-1] + '3' # Temporary fix to handle than IVAS_dec produces HOA3 for all OSBA configs. Needs to be removed when this fix is ported to BASOP. + output_config = ( + output_config[:-1] + "3" + ) # Temporary fix to handle than IVAS_dec produces HOA3 for all OSBA configs. Needs to be removed when this fix is ported to BASOP. scene_description_file( output_config, scene_dut, n_obj, dut_output_file, out_meta_files ) @@ -656,7 +657,11 @@ def binauralize_input_and_output( ) else: ref_input_file_binaural = input_file - return (ref_input_file_binaural, dut_output_file_binaural, ref_output_file_binaural) + return ( + ref_input_file_binaural, + dut_output_file_binaural, + ref_output_file_binaural, + ) def findstr(exp, s, one_element=True): -- GitLab From 55b32e2041d876fdfa7b4227aa54fd8c64c23f45 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 2 Apr 2025 09:08:46 +0200 Subject: [PATCH 44/46] ignore "COMPLEXITY" folders when collecting from complexity jobs --- ci/setup_pages.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/setup_pages.py b/ci/setup_pages.py index 0430e5ca0c..b9d0b8da88 100755 --- a/ci/setup_pages.py +++ b/ci/setup_pages.py @@ -156,6 +156,11 @@ def get_artifacts_for_jobs_and_return_num_failed( tmp_dir = pathlib.Path(tmp_dir) for artifact in tmp_dir.iterdir(): + # ignore the COMPLEXITY dir from complexity measurement, that one only contins runtime logs + # and creates problems because it has the same name for every complexity job + if artifact.name == "COMPLEXITY": + continue + src = tmp_dir.joinpath(artifact).absolute() dst = PUBLIC_FOLDER.joinpath(artifact.name) print(f"{src} -> {dst}") -- GitLab From 814385b175eba0f4e5aa9cc84bc1d6300cf97d97 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 2 Apr 2025 11:17:10 +0200 Subject: [PATCH 45/46] some adjustments to basop compat CI --- .gitlab-ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1721018369..b1d952ddad 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -134,8 +134,11 @@ stages: - sed -i.bak -e "s/\/\/\ *\(#define\ *DEBUGGING\ *\)/\1/g" lib_com/options.h .get-basop-float-reference: &get-basop-float-reference - - git clone -b $BASOP_REFERENCE_BRANCH https://forge.3gpp.org/rep/sa4/audio/ivas-basop.git --single-branch - - make -j -C ivas-basop + - git clone -b $BASOP_REFERENCE_BRANCH https://forge.3gpp.org/rep/sa4/audio/ivas-basop.git --single-branch --depth 1 ivas-basop + - cd ivas-basop + - git status + - make -j + - cd - - cp ivas-basop/IVAS_cod ./ - cp ivas-basop/IVAS_dec ./ @@ -463,7 +466,7 @@ branch-is-up-to-date-with-main-post: - .test-job-linux - .rules-merge-request-to-basop-ci-branch tags: - - ivas-linux-fast + - ivas-linux before_script: - python3 ci/remove_unsupported_testcases.py $PARAM_FILE - python3 tests/create_short_testvectors.py @@ -502,6 +505,8 @@ basop-ref-compat-stv: basop-ref-compat-ltv: extends: - .basop-ci-branch-compat-template + tags: + - ivas-linux-fast variables: PARAM_FILE: scripts/config/self_test_ltv.prm script: @@ -518,6 +523,8 @@ basop-ref-compat-encoder-stv: basop-ref-compat-encoder-ltv: extends: - .basop-ci-branch-compat-template + tags: + - ivas-linux-fast variables: PARAM_FILE: scripts/config/self_test_ltv_basop_encoder.prm script: -- GitLab From 772458c220d25506fecc839b7d5cf7d74dc80c33 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 2 Apr 2025 11:44:00 +0200 Subject: [PATCH 46/46] add timeouts for basop-compat tests + new unsupported case --- .gitlab-ci.yml | 7 ++++++- ci/remove_unsupported_testcases.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1d952ddad..b6e4433136 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -477,7 +477,7 @@ branch-is-up-to-date-with-main-post: - *get-basop-float-reference - - python3 -m pytest tests/codec_be_on_mr_nonselection $PYTEST_ARGS --param_file $PARAM_FILE --update_ref 1 --ref_encoder_path IVAS_cod --ref_decoder_path IVAS_dec --html=report.html --self-contained-html --junit-xml=report-junit.xml || true + - python3 -m pytest tests/codec_be_on_mr_nonselection $PYTEST_ARGS --param_file $PARAM_FILE --update_ref 1 --ref_encoder_path IVAS_cod --ref_decoder_path IVAS_dec --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$TESTCASE_TIMEOUT || true - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - if [ $zero_errors != 1 ]; then echo "Run errors encountered with $PARAM_FILE !"; exit $EXIT_CODE_FAIL; fi @@ -499,6 +499,7 @@ basop-ref-compat-stv: - .basop-ci-branch-compat-template variables: PARAM_FILE: scripts/config/self_test.prm + TESTCASE_TIMEOUT: $TESTCASE_TIMEOUT_STV_SANITIZERS script: - exit 0 @@ -509,6 +510,7 @@ basop-ref-compat-ltv: - ivas-linux-fast variables: PARAM_FILE: scripts/config/self_test_ltv.prm + TESTCASE_TIMEOUT: $TESTCASE_TIMEOUT_LTV_SANITIZERS script: - exit 0 @@ -517,6 +519,7 @@ basop-ref-compat-encoder-stv: - .basop-ci-branch-compat-template variables: PARAM_FILE: scripts/config/self_test_basop_encoder.prm + TESTCASE_TIMEOUT: $TESTCASE_TIMEOUT_STV_SANITIZERS script: - exit 0 @@ -527,6 +530,7 @@ basop-ref-compat-encoder-ltv: - ivas-linux-fast variables: PARAM_FILE: scripts/config/self_test_ltv_basop_encoder.prm + TESTCASE_TIMEOUT: $TESTCASE_TIMEOUT_LTV_SANITIZERS script: - exit 0 @@ -537,6 +541,7 @@ basop-ref-compat-encoder-dmx-comp: PARAM_FILE: scripts/config/self_test_basop_encoder.prm # USING PYTEST_ADDOPTS env var did not work for some reason when testing locally - maybe because this is a custom option PYTEST_ARGS: "--compare_enc_dmx" + TESTCASE_TIMEOUT: $TESTCASE_TIMEOUT_STV_SANITIZERS script: - exit 0 diff --git a/ci/remove_unsupported_testcases.py b/ci/remove_unsupported_testcases.py index e5e184fa83..667463ec7a 100644 --- a/ci/remove_unsupported_testcases.py +++ b/ci/remove_unsupported_testcases.py @@ -66,6 +66,8 @@ TESTCASES_MAIN = [ "MASA 1TC at 256kbps, 48kHz in, 48 kHz out, BINAURAL_ROOM_REVERB out custom configuration", "MASA 1TC at 256 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out, HR custom configuration", "OMASA 2TC 4ISM at br sw techs 13.2 to 512 kbps start 80 kbps, 48kHz in, 48kHz out, EXT out", + "Multi-channel 7_1_4 bitrate switching, 48kHz in, 48kHz out, BINAURAL out, HR, JBM Prof 5", + "Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5", # object editing starts here "OMASA 2Dir2TC 4ISM at 80 kbps, 48kHz in, 48kHz out, BINAURAL out, default object editing, 1SEP-PARAM", "OMASA 2Dir2TC 4ISM at 256 kbps, 48kHz in, 48kHz out, BINAURAL out, object editing, JBM Prof 5, DISC", -- GitLab