From bbd82764ec74887337be37e3ffc5e91b1cae82eb Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 11 May 2026 10:04:49 +0200 Subject: [PATCH 1/2] FIX_1594_TDM_LAST_RATIO --- lib_com/ivas_prot.h | 2 ++ lib_com/options.h | 1 + lib_enc/ivas_cpe_enc.c | 9 ++++++++- lib_enc/ivas_stereo_switching_enc.c | 5 ++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4a8dc7610..3538f28f7 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -2950,7 +2950,9 @@ ivas_error stereo_memory_enc( CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t max_bwidth, /* i : maximum audio bandwidth */ +#ifndef FIX_1594_TDM_LAST_RATIO float *tdm_last_ratio, /* o : TD stereo last ratio */ +#endif const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t nchan_transport /* i : number transport chans */ ); diff --git a/lib_com/options.h b/lib_com/options.h index a24b82b9a..e4ec0a97c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,6 +166,7 @@ #define FIX_FLOAT_1582_STEREO_DFT_QUANTIZE_ITD /* FhG: float issue 1582: Remove unncessary statement from stereo_dft_quantize_itd() */ #define FIX_1585_ASAN_FORMAT_SW_ALT /* VA,FhG: float issues 1585,1593: alternative fix memory leaks with format switching */ #define FIX_2570_BUF_OVFL /* Orange: basop issue 2570: global-buffer-overflow in lib_rend/ivas_objectRenderer_sources_fx.c */ +#define FIX_1594_TDM_LAST_RATIO /* VA: float issue 1594: remove obsolete argument 'tdm_last_ratio' from stereo_memory_enc () */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 9927ccb9e..8e926363c 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -95,7 +95,9 @@ ivas_error ivas_cpe_enc( float fft_buff[CPE_CHANNELS][2 * L_FFT]; /* FFT buffer */ int16_t tdm_ratio_idx, tdm_ratio_idx_SM; /* temp. TD stereo parameters */ int16_t tdm_SM_or_LRTD_Pri; /* temp. TD stereo parameters */ +#ifndef FIX_1594_TDM_LAST_RATIO float tdm_last_ratio; /* temp. TD stereo parameters */ +#endif int16_t nb_bits; /* number of DFT stereo side bits */ float fr_bands[CPE_CHANNELS][2 * NB_BANDS]; /* energy in frequency bands */ float Etot_LR[CPE_CHANNELS]; /* total energy */ @@ -133,8 +135,9 @@ ivas_error ivas_cpe_enc( tdm_SM_or_LRTD_Pri = 0; tdm_ratio_idx = -1; tdm_ratio_idx_SM = -1; +#ifndef FIX_1594_TDM_LAST_RATIO tdm_last_ratio = 0; - +#endif #ifdef DEBUGGING if ( hCPE->hCoreCoder[0]->ini_frame == 0 ) { @@ -205,7 +208,11 @@ ivas_error ivas_cpe_enc( * dynamically allocate data structures depending on the actual stereo mode *----------------------------------------------------------------*/ +#ifdef FIX_1594_TDM_LAST_RATIO + if ( ( error = stereo_memory_enc( hCPE, input_Fs, max_bwidth, ivas_format, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) +#else if ( ( error = stereo_memory_enc( hCPE, input_Fs, max_bwidth, &tdm_last_ratio, ivas_format, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c index 1040ca20c..df76600be 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -221,7 +221,9 @@ ivas_error stereo_memory_enc( CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t max_bwidth, /* i : maximum audio bandwidth */ +#ifndef FIX_1594_TDM_LAST_RATIO float *tdm_last_ratio, /* o : TD stereo last ratio */ +#endif const IVAS_FORMAT ivas_format, /* i : ivas format */ const int16_t nchan_transport /* i : number transport chans */ ) @@ -237,11 +239,12 @@ ivas_error stereo_memory_enc( * save parameters from structures that will be freed *---------------------------------------------------------------*/ +#ifndef FIX_1594_TDM_LAST_RATIO if ( hCPE->last_element_mode == IVAS_CPE_TD ) { *tdm_last_ratio = hCPE->hStereoTD->tdm_last_ratio; /* note: this must be set to local variable before data structures are allocated/deallocated */ } - +#endif if ( hCPE->hStereoTCA != NULL && hCPE->last_element_mode == IVAS_CPE_DFT ) { set_s( hCPE->hStereoTCA->prevCorrLagStats, (int16_t) hCPE->hStereoDft->hItd->itd[1], 3 ); -- GitLab From 23a2fe71fedb23975cde659b0ab09d5b50bc0d70 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 11 May 2026 10:12:44 +0200 Subject: [PATCH 2/2] clang-format --- lib_enc/ivas_cpe_enc.c | 14 +++++++------- lib_enc/ivas_stereo_switching_enc.c | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 8e926363c..ad884e3cd 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -96,14 +96,14 @@ ivas_error ivas_cpe_enc( int16_t tdm_ratio_idx, tdm_ratio_idx_SM; /* temp. TD stereo parameters */ int16_t tdm_SM_or_LRTD_Pri; /* temp. TD stereo parameters */ #ifndef FIX_1594_TDM_LAST_RATIO - float tdm_last_ratio; /* temp. TD stereo parameters */ + float tdm_last_ratio; /* temp. TD stereo parameters */ #endif - int16_t nb_bits; /* number of DFT stereo side bits */ - float fr_bands[CPE_CHANNELS][2 * NB_BANDS]; /* energy in frequency bands */ - float Etot_LR[CPE_CHANNELS]; /* total energy */ - float lf_E[CPE_CHANNELS][2 * VOIC_BINS]; /* per bin spectrum energy in lf */ - int16_t localVAD_HE_SAD[CPE_CHANNELS]; /* HE-SAD flag without hangover, LR channels */ - float band_energies_LR[2 * NB_BANDS]; /* energy in critical bands without minimum noise floor E_MIN */ + int16_t nb_bits; /* number of DFT stereo side bits */ + float fr_bands[CPE_CHANNELS][2 * NB_BANDS]; /* energy in frequency bands */ + float Etot_LR[CPE_CHANNELS]; /* total energy */ + float lf_E[CPE_CHANNELS][2 * VOIC_BINS]; /* per bin spectrum energy in lf */ + int16_t localVAD_HE_SAD[CPE_CHANNELS]; /* HE-SAD flag without hangover, LR channels */ + float band_energies_LR[2 * NB_BANDS]; /* energy in critical bands without minimum noise floor E_MIN */ float orig_input[CPE_CHANNELS][L_FRAME48k]; float Etot_last[CPE_CHANNELS]; int32_t tmp, input_Fs; diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c index df76600be..6d66bf7c9 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -218,11 +218,11 @@ static void deallocate_CoreCoder_enc( *-------------------------------------------------------------------*/ ivas_error stereo_memory_enc( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const int32_t input_Fs, /* i : input sampling rate */ - const int16_t max_bwidth, /* i : maximum audio bandwidth */ + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const int32_t input_Fs, /* i : input sampling rate */ + const int16_t max_bwidth, /* i : maximum audio bandwidth */ #ifndef FIX_1594_TDM_LAST_RATIO - float *tdm_last_ratio, /* o : TD stereo last ratio */ + float *tdm_last_ratio, /* o : TD stereo last ratio */ #endif const IVAS_FORMAT ivas_format, /* i : ivas format */ const int16_t nchan_transport /* i : number transport chans */ -- GitLab