From 19ba02d0650e0300d101211213ec33d259a88c21 Mon Sep 17 00:00:00 2001 From: mave2802 <59919483+mave2802@users.noreply.github.com> Date: Mon, 24 Nov 2025 09:59:56 +0100 Subject: [PATCH 1/2] fixed scaling of x_fx after noise generation and scale xn_buf_fx correctly to Q(-2) --- lib_com/options.h | 1 + lib_dec/dec_tcx_fx.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 31b9785a4..66af6feec 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -117,6 +117,7 @@ #define NONBE_FIX_2237_ZERO_CURR_NOISE_PROBLEM /* FhG: Modify sum of hTonalMDCTConc->curr_noise_nrg to avoid inaccurate zero */ +#define NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES /* Dolby: Fix basop issue 1967 */ /* ################### End FIXES switches ########################### */ /* #################### Start BASOP porting switches ############################ */ diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index aad249425..b71c8275e 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -4049,7 +4049,11 @@ void decoder_tcx_ivas_fx( decoder_tcx_tns_fx( st, L_frame_glob, L_spec, L_frame, L_frameTCX, x_fx, fUseTns, &tnsData, bfi, frame_cnt, 0, NULL ); Scale_sig32( x_fx, N_MAX, sub( x_e, 20 ) ); // Scaling x_fx to Q11 +#ifdef NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES + Scale_sig( xn_buf_fx, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX, -( Q14 - 2 ) ); // Scaling xn_buf_fx to Q(-2) +#else Scale_sig( xn_buf_fx, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX, sub( st->Q_syn, 14 ) ); // Scaling xn_buf_fx to Q_syn +#endif x_e = sub( 31, 11 ); IF( st->igf != 0 ) @@ -5658,7 +5662,11 @@ void decoder_tcx_imdct_fx( generate_masking_noise_mdct_ivas_fx( x_fx, &x_e, st->hFdCngDec->hFdCngCom ); FOR( Word16 ind = 0; ind < L_frame; ind++ ) { +#ifdef NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES + x_fx[ind] = L_shl( x_fx[ind], sub( 31, add( x_e, q_x ) ) ); // q_x +#else x_fx[ind] = L_shr( x_fx[ind], sub( 31, add( x_e, q_x ) ) ); // q_x +#endif } } -- GitLab From f417adfece624222b87833a895219ab9f93c9560 Mon Sep 17 00:00:00 2001 From: mave2802 <59919483+mave2802@users.noreply.github.com> Date: Mon, 24 Nov 2025 10:03:48 +0100 Subject: [PATCH 2/2] clang format --- lib_dec/dec_tcx_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index b71c8275e..5f86d8752 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3975,8 +3975,8 @@ void decoder_tcx_ivas_fx( Word16 synthFB_fx[], Word16 *synth_q, #else - Word16 synth_fx[], // Q_syn - Word16 synthFB_fx[], // Q_syn + Word16 synth_fx[], // Q_syn + Word16 synthFB_fx[], // Q_syn #endif const Word16 bfi, const Word16 frame_cnt, @@ -4048,7 +4048,7 @@ void decoder_tcx_ivas_fx( decoder_tcx_tns_fx( st, L_frame_glob, L_spec, L_frame, L_frameTCX, x_fx, fUseTns, &tnsData, bfi, frame_cnt, 0, NULL ); - Scale_sig32( x_fx, N_MAX, sub( x_e, 20 ) ); // Scaling x_fx to Q11 + Scale_sig32( x_fx, N_MAX, sub( x_e, 20 ) ); // Scaling x_fx to Q11 #ifdef NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES Scale_sig( xn_buf_fx, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX, -( Q14 - 2 ) ); // Scaling xn_buf_fx to Q(-2) #else -- GitLab