From 88b261ec8835ba2c79d01348ea082734ef514ef3 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 13 Feb 2025 15:59:36 +0530 Subject: [PATCH 1/2] Fix for 3GPP issue 1247: Basop Encoder: Noise introduced for Stereo DTX @32kbps Link #1247 --- lib_com/options.h | 1 + lib_enc/ivas_cpe_enc.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index d6bbaf88a..c380ea8e7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,4 +160,5 @@ #define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ #define FIX_ISSUE_1279 /* VA: correction of wrong scaling update */ +#define FIX_ISSUE_1247 #endif diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 6ea59adb3..f0c9a04c1 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -394,6 +394,25 @@ ivas_error ivas_cpe_enc_fx( /*----------------------------------------------------------------* * Resets/updates in case of stereo switching *----------------------------------------------------------------*/ +#ifdef FIX_ISSUE_1247 + shift = norm_arr( sts[1]->old_input_signal_fx, input_frame ); + Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ + sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); + move16(); + shift = norm_arr( sts[1]->input_fx, input_frame ); + Scale_sig( sts[1]->input_fx, input_frame, shift ); /* sts[1]->q_inp + shift */ + sts[1]->q_inp = add( sts[1]->q_inp, shift ); + move16(); + + shift = norm_arr( sts[0]->old_input_signal_fx, input_frame ); + Scale_sig( sts[0]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ + sts[0]->q_old_inp = add( sts[0]->q_old_inp, shift ); + move16(); + shift = norm_arr( sts[0]->input_fx, input_frame ); + Scale_sig( sts[0]->input_fx, input_frame, shift ); /* sts[1]->q_inp, shift */ + sts[0]->q_inp = add( sts[0]->q_inp, shift ); + move16(); +#else shift = getScaleFactor16( sts[1]->old_input_signal_fx, input_frame ); Scale_sig( sts[1]->old_input_signal_fx, input_frame, shift ); /* sts[1]->q_old_inp + shift */ sts[1]->q_old_inp = add( sts[1]->q_old_inp, shift ); @@ -411,6 +430,7 @@ ivas_error ivas_cpe_enc_fx( Scale_sig( sts[0]->input_fx, input_frame, shift ); /* sts[1]->q_inp, shift */ sts[0]->q_inp = add( sts[0]->q_inp, shift ); move16(); +#endif Word16 q_inp = s_min( s_min( sts[0]->q_inp, sts[0]->q_old_inp ), s_min( sts[1]->q_inp, sts[1]->q_old_inp ) ); -- GitLab From 2660ef93ce3c87949688e900716e5fdafa3f8f1e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 13 Feb 2025 16:46:47 +0530 Subject: [PATCH 2/2] Clang formatting changes --- lib_enc/ivas_cpe_enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index f0c9a04c1..cc91df0e1 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -365,8 +365,8 @@ ivas_error ivas_cpe_enc_fx( Copy_Scale_sig_16_32_no_sat( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( Q11, sts[1]->q_inp ) ); /* Q11 */ Copy_Scale_sig_16_32_no_sat( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( Q11, sts[0]->q_inp ) ); /* Q11 */ #else - Copy_Scale_sig_16_32_DEPREC( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( Q11, sts[1]->q_inp ) ); /* Q11 */ - Copy_Scale_sig_16_32_DEPREC( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( Q11, sts[0]->q_inp ) ); /* Q11 */ + Copy_Scale_sig_16_32_DEPREC( sts[1]->input_fx, sts[1]->input32_fx, input_frame, sub( Q11, sts[1]->q_inp ) ); /* Q11 */ + Copy_Scale_sig_16_32_DEPREC( sts[0]->input_fx, sts[0]->input32_fx, input_frame, sub( Q11, sts[0]->q_inp ) ); /* Q11 */ #endif Word16 shift = getScaleFactor32( sts[1]->input32_fx, input_frame ); scale_sig32( sts[1]->input32_fx, input_frame, shift ); /* Q11 + shift */ -- GitLab