From 3b65ce59bf9e256326753af0031a9392e25a8ffd Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 9 Jan 2026 13:11:52 -0500 Subject: [PATCH] possible fix for 2312, condition missing in GSC-dec --- lib_com/gs_gains_fx.c | 72 ++++++++++++++++++++++++------------------- lib_com/options.h | 2 +- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index 87aa64ec8..55ced4ea0 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -1193,45 +1193,55 @@ Word16 gsc_gaindec_ivas_fx( /* o : average frequenc *--------------------------------------------------------------------------------------*/ idx_g_fx = (Word16) get_next_indice_fx( st_fx, 5 ); VDQ_vec_fx( y_gainQ_fx, YGain_mean_LR_fx, YGain_dic1_LR_fx, idx_g_fx, 3 ); +#ifdef FIX_2312_CONDITION_MISSING_GSC_DEC_LR + IF( !( coder_type == INACTIVE && st_fx->tdm_LRTD_flag == 0 && EQ_16( st_fx->idchan, 1 ) ) || GT_32( st_fx->core_brate, GSC_LRES_GAINQ_LIMIT ) ) + { +#endif + idx_g_fx = (Word16) get_next_indice_fx( st_fx, 5 ); + VDQ_vec_fx( y_gainQ_fx + 3, YGain_mean_LR_fx + 3, YGain_dic2_LR_fx, idx_g_fx, 4 ); - idx_g_fx = (Word16) get_next_indice_fx( st_fx, 5 ); - VDQ_vec_fx( y_gainQ_fx + 3, YGain_mean_LR_fx + 3, YGain_dic2_LR_fx, idx_g_fx, 4 ); - - /*----------------------------------------------------------------------* - * Interpolation of the last 4 Q bands to create bands 8-16 - * And scaling - *----------------------------------------------------------------------*/ + /*----------------------------------------------------------------------* + * Interpolation of the last 4 Q bands to create bands 8-16 + * And scaling + *----------------------------------------------------------------------*/ - idx_g_fx = (Word16) get_next_indice_fx( st_fx, 5 ); + idx_g_fx = (Word16) get_next_indice_fx( st_fx, 5 ); - VDQ_vec_fx( y_gainQ_fx + 7, YGain_mean_LR_fx + 7, YGain_dic3_LR_fx, idx_g_fx, 5 ); + VDQ_vec_fx( y_gainQ_fx + 7, YGain_mean_LR_fx + 7, YGain_dic3_LR_fx, idx_g_fx, 5 ); - Copy( y_gainQ_fx + 8, y_gain_tmp3_fx, 4 ); - set16_fx( y_gainQ_fx + 12, 0, 4 ); + Copy( y_gainQ_fx + 8, y_gain_tmp3_fx, 4 ); + set16_fx( y_gainQ_fx + 12, 0, 4 ); - fft_rel_fx( y_gainQ_fx + 8, 4, 2 ); + fft_rel_fx( y_gainQ_fx + 8, 4, 2 ); - y_gainQ_fx[15] = y_gainQ_fx[11]; - move16(); - y_gainQ_fx[11] = 0; - move16(); - ifft_rel_fx( y_gainQ_fx + 8, 8, 3 ); - FOR( i = 8; i < 16; i++ ) - { - y_gainQ_fx[i] = round_fx( L_shl( L_mult( y_gainQ_fx[i], 23101 ), 1 ) ); /*Q12 */ + y_gainQ_fx[15] = y_gainQ_fx[11]; + move16(); + y_gainQ_fx[11] = 0; + move16(); + ifft_rel_fx( y_gainQ_fx + 8, 8, 3 ); + FOR( i = 8; i < 16; i++ ) + { + y_gainQ_fx[i] = round_fx( L_shl( L_mult( y_gainQ_fx[i], 23101 ), 1 ) ); /*Q12 */ + move16(); + } + /*----------------------------------------------------------------------* + * Copy the true Q values in the specific bands + *----------------------------------------------------------------------*/ + y_gainQ_fx[8] = y_gain_tmp3_fx[0]; /*Q12*/ + move16(); + y_gainQ_fx[10] = y_gain_tmp3_fx[1]; /*Q12*/ + move16(); + y_gainQ_fx[12] = y_gain_tmp3_fx[2]; /*Q12*/ move16(); + y_gainQ_fx[14] = y_gain_tmp3_fx[3]; /*Q12*/ + move16(); +#ifdef FIX_2312_CONDITION_MISSING_GSC_DEC_LR } - /*----------------------------------------------------------------------* - * Copy the true Q values in the specific bands - *----------------------------------------------------------------------*/ - y_gainQ_fx[8] = y_gain_tmp3_fx[0]; /*Q12*/ - move16(); - y_gainQ_fx[10] = y_gain_tmp3_fx[1]; /*Q12*/ - move16(); - y_gainQ_fx[12] = y_gain_tmp3_fx[2]; /*Q12*/ - move16(); - y_gainQ_fx[14] = y_gain_tmp3_fx[3]; /*Q12*/ - move16(); + ELSE + { + set16_fx( y_gainQ_fx + 3, 0, MBANDS_GN16k - 3 ); + } +#endif } ELSE { diff --git a/lib_com/options.h b/lib_com/options.h index a24403788..ecb665620 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -133,7 +133,7 @@ #define FIX_2285_CODE_DECODER_INIT_BW /* VA: basop issue 2285: fix core-decoder initialization bandwidth */ #define FIX_2306_MISSING_UPDATE_LOWRATE_PITCH_GAIN /* Dolby: Fix missing update of low-rate pitch gain in the S/M classifier */ #define FIX_2297_SBA_SCALING_32KHZ /* VA: basop issue 2297: Fix scaling factor before the SBA decoder for output_Fs = 32 or 16 */ - +#define FIX_2312_CONDITION_MISSING_GSC_DEC_LR /* VA: basop issue 2297: addition of condition missing in the GSC gain decoder at low-rate */ /* ##################### End NON-BE switches ########################### */ /* ################## End MAINTENANCE switches ######################### */ -- GitLab