From 825fe74664a007d93a3f30a9af3759e8a5acc6f4 Mon Sep 17 00:00:00 2001 From: kiene Date: Wed, 27 Mar 2024 12:14:45 +0100 Subject: [PATCH 1/2] move pointer arithmetic code into if ( bfi ) parts --- lib_com/options.h | 1 + lib_dec/dec_LPD.c | 8 ++++++++ lib_dec/dec_tcx.c | 16 ++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index baac651607..4c30183d77 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,6 +157,7 @@ /*#define SPLIT_REND_WITH_HEAD_ROT */ /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ +#define FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI /* FhG: move setting of pointers for parameter decoding so they are skipped in lost frames when they are not needed */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/dec_LPD.c b/lib_dec/dec_LPD.c index b23675f0ae..331e93c3f9 100644 --- a/lib_dec/dec_LPD.c +++ b/lib_dec/dec_LPD.c @@ -604,12 +604,20 @@ void decoder_LPD( for ( k = 0; k < 2; k++ ) { +#ifndef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI /* Set pointer to parameters */ prm = param + ( k * DEC_NPRM_DIV ); /* Stability Factor */ +#endif if ( !bfi ) { +#ifdef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI + /* Set pointer to parameters */ + prm = param + ( k * DEC_NPRM_DIV ); + + /* Stability Factor */ +#endif st->stab_fac = lsf_stab( &lsf[( k + 1 ) * M], &lsf[k * M], 0, st->L_frame ); } diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index d0e6f59c1d..2dda342840 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -93,6 +93,9 @@ void decoder_tcx( tmp_concealment_method = 0; nf_seed = 0; fUseTns = 0; /* flag that is set if TNS data is present */ +#ifdef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI + prm_sqQ = NULL; +#endif set_f( xn_buf, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); @@ -750,8 +753,10 @@ void decoder_tcx_invQ( noiseFillingSize = st->hIGFDec->infoIGFStartLine; } +#ifndef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI prm_ltp = &prm[1 + NOISE_FILL_RANGES]; prm_tns = prm_ltp + LTPSIZE; +#endif /*-----------------------------------------------------------* * Read TCX parameters * @@ -762,6 +767,10 @@ void decoder_tcx_invQ( if ( !bfi ) { index = prm[0]; +#ifdef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI + prm_ltp = &prm[1 + NOISE_FILL_RANGES]; + prm_tns = prm_ltp + LTPSIZE; +#endif /* read noise level (fac_ns) */ st->hTcxDec->noise_filling_index[frame_cnt] = prm[1]; @@ -777,9 +786,11 @@ void decoder_tcx_invQ( *fUseTns = 0; } +#ifndef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI prm_hm = prm_tns + tnsSize; prm_sqQ = prm_hm + NPRM_CTX_HM; *prm_sqQ1 = prm_sqQ; +#endif /*-----------------------------------------------------------* * Spectrum data * @@ -787,6 +798,11 @@ void decoder_tcx_invQ( if ( !bfi ) { +#ifdef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI + prm_hm = prm_tns + tnsSize; + prm_sqQ = prm_hm + NPRM_CTX_HM; + *prm_sqQ1 = prm_sqQ; +#endif /*-----------------------------------------------------------* * Context HM * *-----------------------------------------------------------*/ -- GitLab From b92a53714b9e40bce693c95b0a6045184a28d6d2 Mon Sep 17 00:00:00 2001 From: knj Date: Wed, 27 Mar 2024 20:47:53 +0100 Subject: [PATCH 2/2] fix MSVS build warning --- lib_dec/dec_tcx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 2dda342840..906baf3595 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -733,7 +733,15 @@ void decoder_tcx_invQ( TCX_CONFIG_HANDLE hTcxCfg = st->hTcxCfg; tnsSize = 0; +#ifndef FIX_1038_OFFSET_TO_NULL_PTR_IN_EVS_TCX_BFI prm_target = NULL; /* just to suppress MSVC warnigs */ +#else + /* just to suppress MSVC warnigs */ + prm_target = NULL; + prm_ltp = NULL; + prm_tns = NULL; + prm_sqQ = NULL; +#endif /*-----------------------------------------------------------------* * Initializations -- GitLab