From 2840f099237650ef1078cecfd1b6484b3efaff5a Mon Sep 17 00:00:00 2001 From: "Malenovsky, Vladimir" Date: Thu, 11 Dec 2025 13:17:49 +0100 Subject: [PATCH] Fix incorrect Q value for 0.1 in low-rate pitch gain parameter --- lib_com/options.h | 1 + lib_enc/enc_gen_voic_fx.c | 6 ++++++ lib_enc/enc_pit_exc_fx.c | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index cabe32178..fb3bf1bf5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -98,6 +98,7 @@ #define FIX_1461_CNG_BW_SWITCHING /* Eri: float issue 1461: Stereo parameters are not updated when SID/NODATA forces BW to stay the same */ #define FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES /* FhG: Using rounding in multiplication to improve precision in cngNoiseLevel[] */ #define FIX_2264_OUT_OF_BOUND_READING_IN_LOG2_NORM_LC /* VA: Fix issue 2264 by adding a proper safeguard in log2 and by adding a missing normalization in swb_pre_proc_ivas_fx()*/ +#define FIX_2282_WRONG_SCALING_LOWRATE_PITCH /* Dolby: Fix incorrect Q value for 0.1 in low-rate pitch gain parameter */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index bfe50a588..9812603bf 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -274,8 +274,14 @@ void encod_gen_voic_fx( push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } + +#ifdef FIX_2282_WRONG_SCALING_LOWRATE_PITCH + /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit_fx;*/ + hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 3277, gain_pit_fx ) ); /*Q15*Q14 + Q15*Q14 -> Q14*/ +#else /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit_fx;*/ hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit_fx ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/ +#endif /*-----------------------------------------------------------------* * Transform domain contribution encoding - active frames diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 200c22a1a..262a06e55 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -291,8 +291,13 @@ void enc_pit_exc_fx( push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } +#ifdef FIX_2282_WRONG_SCALING_LOWRATE_PITCH + /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit_fx;*/ + hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 3277, gain_pit ) ); /*Q15*Q14 + Q15*Q14 -> Q14*/ +#else /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit;*/ hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/ +#endif gpit_tmp = gain_pit; move16(); /*Q14*/ -- GitLab