diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4a8dc7610e4eaca5d567ca659fe0ec79bc2767c4..3538f28f7c53a018adb1c2ca0ef52f3b47a7fb68 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 a24b82b9a94438b09210f048b4b81085683bae0b..e4ec0a97c493c6569a210b88b69d92dfbaaa915b 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 9927ccb9e4133b41e96f564381ee8729c74fb12f..ad884e3cdc69a6b5e7f03686b586fe36ce981d28 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -95,13 +95,15 @@ 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 */ - float tdm_last_ratio; /* temp. TD stereo parameters */ - 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 */ +#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 */ + 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; @@ -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 1040ca20cf0d2701113490e017c2518aa2bf3ca7..6d66bf7c9e099c2c6d0d43ecca07cf6c3d6a0b09 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -218,10 +218,12 @@ 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 */ - float *tdm_last_ratio, /* o : TD stereo last ratio */ + 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 );