From 037f0bc0aa581295b3ea8df2b7e3a50b112da58c Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 23 Jan 2026 18:51:08 +0100 Subject: [PATCH] FIX_2370_UNUSED_BUFFERS_CORE_ENC --- lib_com/options.h | 1 + lib_enc/ivas_core_enc_fx.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index c7cd38dd8..f1f5baa53 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -107,6 +107,7 @@ #define FIX_2330_CLANG_18_WARNINGS_REND /* FhG: Fix renderer warnings */ #define FIX_BASOP_2350_HARM_0B_BWE /* VA: basop issue 2350: harmonization of the 0b BWE */ #define FIX_2349_HARM_FIND_UV /* VA: basop issue 2349: harmonization of find_uv() function */ +#define FIX_2370_UNUSED_BUFFERS_CORE_ENC /* VA: basop issue 2370: remove temporary input buffers in core-encoder */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 3a19ad171..402d4085b 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -628,8 +628,9 @@ ivas_error ivas_core_enc_fx( * Postprocessing, BWEs and Updates *---------------------------------------------------------------------*/ +#ifndef FIX_2370_UNUSED_BUFFERS_CORE_ENC Word16 tmp_input_fx[L_FRAME48k], tmp_old_input_fx[L_FRAME48k], q_inp[2]; - +#endif FOR( n = 0; n < n_CoreChannels; n++ ) { st = sts[n]; @@ -644,6 +645,7 @@ ivas_error ivas_core_enc_fx( move16(); } +#ifndef FIX_2370_UNUSED_BUFFERS_CORE_ENC Copy( st->input_fx - input_frame, tmp_old_input_fx, input_frame ); Copy( st->input_fx, tmp_input_fx, input_frame ); q_inp[0] = st->q_old_inp; @@ -654,6 +656,7 @@ ivas_error ivas_core_enc_fx( move16(); st->q_old_inp = -1; move16(); +#endif /*---------------------------------------------------------------------* * Postprocessing for ACELP/HQ core switching @@ -694,6 +697,21 @@ ivas_error ivas_core_enc_fx( * SWB(FB) BWE encoding *---------------------------------------------------------------------*/ +#ifdef FIX_2370_UNUSED_BUFFERS_CORE_ENC + Word16 q_inp_orig; + q_inp_orig = st->q_inp; + move16(); + test(); + IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL ) + { + st->q_inp = -1; + st->q_old_inp = -1; + move16(); + move16(); + Scale_sig( st->input_fx - input_frame, shl( input_frame, 1 ), sub( st->q_inp, q_inp_orig ) ); + } +#endif + new_swb_speech_fx = new_swb_speech_buffer_fx + STEREO_DFT_OVL_MAX; new_swb_speech_fx_16 = new_swb_speech_buffer_fx_16 + STEREO_DFT_OVL_MAX; set16_fx( new_swb_speech_buffer_fx_16, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); @@ -788,6 +806,15 @@ ivas_error ivas_core_enc_fx( Scale_sig( old_syn_12k8_16k_fx[n], L_FRAME16k, sub( Q1, Q_new[n] ) ); // Q0 +#ifdef FIX_2370_UNUSED_BUFFERS_CORE_ENC + IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL ) + { + Scale_sig( st->input_fx, input_frame, sub( q_inp_orig, st->q_inp ) ); + st->q_inp = q_inp_orig; + move16(); + } + +#endif /*---------------------------------------------------------------------* * SWB DTX/CNG encoding *---------------------------------------------------------------------*/ @@ -842,6 +869,7 @@ ivas_error ivas_core_enc_fx( } } +#ifndef FIX_2370_UNUSED_BUFFERS_CORE_ENC Copy( tmp_old_input_fx, st->input_fx - input_frame, input_frame ); Copy( tmp_input_fx, st->input_fx, input_frame ); st->q_old_inp = q_inp[0]; @@ -849,6 +877,7 @@ ivas_error ivas_core_enc_fx( st->q_inp = q_inp[1]; move16(); +#endif /*---------------------------------------------------------------------* * Common updates *---------------------------------------------------------------------*/ -- GitLab