From 47cfc0a17b596efdccfeb64499505a3820c737f8 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 22 Aug 2025 10:50:15 +0300 Subject: [PATCH 1/2] Fix issue 1371 by not touching earlyPartEneCorrection when FASTCONV path is used. --- lib_com/options.h | 1 + lib_dec/ivas_binRenderer_internal.c | 8 +++++++- lib_rend/ivas_reverb.c | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index e6081dee4f..b1f68c2f4d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,6 +165,7 @@ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define FIX_1348_OVERFLOW /* FhG: fix BASOP overflow in hq_lr_dec(), brings floating-point code inline with FX */ #define FIX_1369_HQ_LR_OVERFLOW /* FhG: fix BASOP overflow in hq_lr_enc(), brings floating-point code inline with FX */ +#define FIX_1371_EARLY_PART_INIT_FASTCONV /* Nokia: fix uninitialized variable in FASTCONV path of binaural reverb init */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 4b2c4c7d07..7cd919233e 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1007,7 +1007,13 @@ ivas_error ivas_binRenderer_open( st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections, - hBinRenderer->earlyPartEneCorrection ) ) != IVAS_ERR_OK ) +#ifdef FIX_1371_EARLY_PART_INIT_FASTCONV + NULL +#else + hBinRenderer->earlyPartEneCorrection +#endif + ) ) != IVAS_ERR_OK ) + { return error; } diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 2811a3c4d0..097057cffb 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1924,13 +1924,27 @@ ivas_error ivas_binaural_reverb_init( energyModifier = ( adjustedRevTime - revTimes[bin] ) / adjustedRevTime; /* Adjust early and late energies, by moving late energy to early energy */ +#ifdef FIX_1371_EARLY_PART_INIT_FASTCONV + if ( earlyEne != NULL ) + { + adjustedEarlyEne = earlyEne[bin] + revEne[bin] * energyModifier; + } +#else adjustedEarlyEne = earlyEne[bin] + revEne[bin] * energyModifier; +#endif adjustedLateEne = revEne[bin] * ( 1.0f - energyModifier ); /* Store adjusted room effect parameters to be used in reverb processing */ revTimes[bin] = adjustedRevTime; revEne[bin] = adjustedLateEne; +#ifdef FIX_1371_EARLY_PART_INIT_FASTCONV + if ( earlyEne != NULL ) + { + earlyEne[bin] = adjustedEarlyEne; + } +#else earlyEne[bin] = adjustedEarlyEne; +#endif } } -- GitLab From c53bfa5597ae0921af37a36f9b57d19a3d791852 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 22 Aug 2025 11:31:11 +0300 Subject: [PATCH 2/2] Satisfy Windows warning --- lib_rend/ivas_reverb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 097057cffb..3119f5fdf9 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1928,6 +1928,7 @@ ivas_error ivas_binaural_reverb_init( if ( earlyEne != NULL ) { adjustedEarlyEne = earlyEne[bin] + revEne[bin] * energyModifier; + earlyEne[bin] = adjustedEarlyEne; /* Store already here */ } #else adjustedEarlyEne = earlyEne[bin] + revEne[bin] * energyModifier; @@ -1937,12 +1938,7 @@ ivas_error ivas_binaural_reverb_init( /* Store adjusted room effect parameters to be used in reverb processing */ revTimes[bin] = adjustedRevTime; revEne[bin] = adjustedLateEne; -#ifdef FIX_1371_EARLY_PART_INIT_FASTCONV - if ( earlyEne != NULL ) - { - earlyEne[bin] = adjustedEarlyEne; - } -#else +#ifndef FIX_1371_EARLY_PART_INIT_FASTCONV earlyEne[bin] = adjustedEarlyEne; #endif } -- GitLab