diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 8b8f12f43140553fb220cffa3ef13942d1a4b57d..6fb6181ba8381f9c2ba8b8d42c53b62b118832a8 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -5172,9 +5172,9 @@ Word16 ivas_is_res_channel( ); void ivas_spar_dec_agc_pca_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output[], /* i/o: input/output audio channels */ - const Word16 output_frame /* i : output frame length */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output[], /* i/o: input/output audio channels, Qin=Q14 -> Qout=Q11*/ + const Word16 output_frame /* i : output frame length */ ); void ivas_spar_dec_set_render_map_fx( diff --git a/lib_com/options.h b/lib_com/options.h index 0feca9ea2db460ac7b1da407e9eeddff353972a1..23a5aa26c110b2fd3f840f5486a32a483164f218 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,6 +100,7 @@ #define FIX_2448_RENDERER_MSAN_ERROR /* FhG: basop issue 2448: fix MSAN error with MSA rendering */ #define FIX_2283_ISM_MD_DELAY /* Dolby: Fix ISM metadata delay round-off */ #define FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING /* FhG: basop issue 2262: correct buffer update for FD-CNG buffer in case of BR switching */ +#define FIX_2440_AGC_PRESCALING /* FhG: basop issue 2440: Fix loop bounds when scaling p_output_fx before ivas_spar_dec_agc_pca_fx() */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_dec_fx.c b/lib_dec/ivas_dec_fx.c index a844b37db5005b4dc8805cc5ad5b35ee9069b9c3..525caf8e2eb2ab2b8b48b92f54c8081e2cab3b5f 100644 --- a/lib_dec/ivas_dec_fx.c +++ b/lib_dec/ivas_dec_fx.c @@ -629,7 +629,13 @@ ivas_error ivas_dec_fx( ELSE IF( NE_32( st_ivas->renderer_type, RENDERER_DISABLE ) && st_ivas->sba_dirac_stereo_flag == 0 ) { Word16 size = add( st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, sba_ch_idx ); +#ifdef FIX_2440_AGC_PRESCALING + // For nchan_transport = 3, the fourth input audio channel in ivas_spar_dec_agc_pca_fx() is also used, + // so one additional channel must be aligned to Q14. + if ( EQ_16( st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, 3 ) ) +#else if ( EQ_16( size, 3 ) ) +#endif { size = add( size, 1 ); } diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c index bc819763bab4f78b7d0ae0d1205162b3cbdb1747..f36cdc0cbfc67e314ebaa2bcd67687aa6a3ff411 100644 --- a/lib_dec/ivas_spar_decoder_fx.c +++ b/lib_dec/ivas_spar_decoder_fx.c @@ -1442,9 +1442,9 @@ static void ivas_spar_calc_smooth_facs_fx( *-------------------------------------------------------------------*/ void ivas_spar_dec_agc_pca_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output[], /* i/o: input/output audio channels Q14*/ - const Word16 output_frame /* i : output frame length Q0*/ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output[], /* i/o: input/output audio channels, Qin=Q14 -> Qout=Q11*/ + const Word16 output_frame /* i : output frame length Q0*/ ) { Word16 nchan_transport;