From 187bdeffeb164ee1310a5a70b53348692734d972 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 12 Aug 2025 13:19:53 +0300 Subject: [PATCH 1/3] Port of float MR 1787 to float reference. To be adjusted with incoming changes for default reverb. --- lib_com/options.h | 1 + lib_dec/ivas_binRenderer_internal.c | 15 ++++- lib_dec/lib_dec.c | 30 ++++++++- lib_rend/ivas_dirac_dec_binaural_functions.c | 14 +++- lib_rend/ivas_prot_rend.h | 4 ++ lib_rend/ivas_reverb.c | 69 ++++++++++++++++++++ lib_rend/lib_rend.c | 42 +++++++++++- 7 files changed, 168 insertions(+), 7 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 218c6a4ab..8748ab522 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -205,6 +205,7 @@ #define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */ #define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */ #define NONBE_FIX_1052_SBA_EXT_FIX /* VA: SBA external output support fix - do not overwrite "output_config" parameter */ +#define FIX_1139_REV_COLORATION_SHORT_T60 /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index fd7c313db..30a14c934 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1189,10 +1189,23 @@ ivas_error ivas_binRenderer_open( } } + // Todo 1892 /* Allocate memories needed for reverb module */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - if ( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), + st_ivas->hHrtfStatistics, + hBinRenderer->conv_band, + hBinRenderer->timeSlots, + &( st_ivas->hRenderConfig->roomAcoustics ), + st_ivas->hDecoderConfig->output_Fs, + st_ivas->hHrtfFastConv->fastconvReverberationTimes, + st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + , + hBinRenderer->earlyPartEneCorrection +#endif + ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b6e424853..53a585b56 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2226,21 +2226,47 @@ ivas_error IVAS_DEC_FeedRenderConfig( } } + // Todo 1892 /* FB reverberator */ if ( hIvasDec->st_ivas->hDiracDecBin[0] != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ) ); - if ( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), + hIvasDec->st_ivas->hHrtfStatistics, + hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, + &( hRenderConfig->roomAcoustics ), + hIvasDec->st_ivas->hDecoderConfig->output_Fs, + NULL, + NULL +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + , + NULL +#endif + ) ) != IVAS_ERR_OK ) { return error; } } + // Todo 1892 /* Fastconv CLDFB reverberator */ if ( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL ) { ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hBinRenderer->hReverb ) ); - if ( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), + hIvasDec->st_ivas->hHrtfStatistics, + hIvasDec->st_ivas->hBinRenderer->conv_band, + hIvasDec->st_ivas->hBinRenderer->timeSlots, + &( hRenderConfig->roomAcoustics ), + hIvasDec->st_ivas->hDecoderConfig->output_Fs, + NULL, + NULL +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + , + NULL +#endif + ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 9c92a9d3d..e07d1f580 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -257,7 +257,19 @@ ivas_error ivas_dirac_dec_init_binaural_data( if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ { #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF - if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, ( *phHrtfParambin )->parametricReverberationTimes, ( *phHrtfParambin )->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, // Todo 1892 + st_ivas->hHrtfStatistics, + nBins, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, + &( st_ivas->hRenderConfig->roomAcoustics ), + output_Fs, + ( *phHrtfParambin )->parametricReverberationTimes, + ( *phHrtfParambin )->parametricReverberationEneCorrections +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + , + hDiracDecBin->earlyPartEneCorrection +#endif + ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, st_ivas->hHrtfParambin->parametricReverberationTimes, st_ivas->hHrtfParambin->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index ef22e92c6..60ee847b8 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -927,6 +927,10 @@ ivas_error ivas_binaural_reverb_init( const int32_t sampling_rate, /* i : sampling rate */ const float *defaultTimes, /* i : default reverberation times */ const float *defaultEne /* i : default reverberation energies */ +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + , + float *earlyEne /* i/o: Early part energies to be modified */ +#endif ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index b8afc9520..8ab17f51d 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -56,6 +56,10 @@ #define CLDFB_SLOTS_PER_SECOND 800 /* Used for initializing reverb */ +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 +#define REV_TIME_THRESHOLD ( 0.2f ) +#endif + #define INNER_BLK_SIZE 80 /* size of data blocks used for more efficient delay line and IIR filter processing */ /* should be a divisor of the frame length at any sampling rate and an even number*/ #define FFT_FILTER_WND_FLAT_REGION ( 0.40f ) /* flat section (==1) length of FFT filter window, in proportion to overlap */ @@ -259,6 +263,19 @@ static void ivas_binaural_reverb_setReverbTimes( } currentEnergy *= attenuationFactorPerSampleSq; } +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + /* In some configurations with small T60s it is possible the number of taps randomizes to zero. + Ensure at least 1 filter tap. */ + if ( tap == 0 ) + { + hReverb->tapPhaseShiftType[bin][ch][0] = (int16_t) ( binRend_rand( hReverb ) % 4 ); + hReverb->tapPointersReal[bin][ch][0] = &( hReverb->loopBufReal[bin][0] ); + hReverb->tapPointersImag[bin][ch][0] = &( hReverb->loopBufImag[bin][0] ); + tap = 1; + actualizedEnergy = 1; + } +#endif + hReverb->taps[bin][ch] = tap; /* Number of taps determined at the above random procedure */ } @@ -1956,23 +1973,39 @@ ivas_error ivas_binaural_reverb_init( const int32_t sampling_rate, /* i : sampling rate */ const float *defaultTimes, /* i : default reverberation times */ const float *defaultEne /* i : default reverberation energies */ +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + , + float *earlyEne /* i/o: Early part energies to be modified */ +#endif ) { ivas_error error; +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + int16_t preDelay, bin; + float revTimes[CLDFB_NO_CHANNELS_MAX]; + float revEne[CLDFB_NO_CHANNELS_MAX]; +#else const float *revTimes; const float *revEne; float t60[CLDFB_NO_CHANNELS_MAX]; float ene[CLDFB_NO_CHANNELS_MAX]; int16_t preDelay; +#endif error = IVAS_ERR_OK; if ( ( roomAcoustics != NULL ) && roomAcoustics->override ) { +#ifndef FIX_1139_REV_COLORATION_SHORT_T60 revTimes = t60; revEne = ene; +#endif +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfStatistics, sampling_rate, revTimes, revEne ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfStatistics, sampling_rate, t60, ene ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1980,11 +2013,47 @@ ivas_error ivas_binaural_reverb_init( } else { +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + { + revTimes[bin] = defaultTimes[bin]; + revEne[bin] = defaultEne[bin]; + } +#else revTimes = defaultTimes; revEne = defaultEne; +#endif preDelay = 10; } +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + for ( bin = 0; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + { + /* Adjust the room effect parameters when the reverberation time is less than a threshold value, to avoid + spectral artefacts with the synthetic reverberator. */ + if ( revTimes[bin] < REV_TIME_THRESHOLD ) + { + float adjustedEarlyEne, adjustedLateEne, adjustedRevTime; + float revTimeModifier, energyModifier; + + /* Adjust reverberation times, higher towards a threshold */ + revTimeModifier = fmaxf( 0.0f, 1.0f - ( revTimes[bin] / REV_TIME_THRESHOLD ) ); + adjustedRevTime = ( 1.0f - revTimeModifier ) * revTimes[bin]; + adjustedRevTime += revTimeModifier * ( revTimes[bin] + REV_TIME_THRESHOLD ) * 0.5f; + energyModifier = ( adjustedRevTime - revTimes[bin] ) / adjustedRevTime; + + /* Adjust early and late energies, by moving late energy to early energy */ + adjustedEarlyEne = earlyEne[bin] + revEne[bin] * energyModifier; + adjustedLateEne = revEne[bin] * ( 1.0f - energyModifier ); + + /* Store adjusted room effect parameters to be used in reverb processing */ + revTimes[bin] = adjustedRevTime; + revEne[bin] = adjustedLateEne; + earlyEne[bin] = adjustedEarlyEne; + } + } +#endif + error = ivas_binaural_reverb_open( hReverbPr, numBins, numCldfbSlotsPerFrame, sampling_rate, revTimes, revEne, preDelay ); return error; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e5f94fc2f..d1cf7dab8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4290,7 +4290,19 @@ int16_t IVAS_REND_FeedRenderConfig( if ( pMasaInput->hMasaExtRend->hDiracDecBin[0] != NULL && pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb ); - if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb, // Todo 1892 + hIvasRend->hHrtfs.hHrtfStatistics, + pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, + &( hRenderConfig->roomAcoustics ), + *pMasaInput->base.ctx.pOutSampleRate, + NULL, + NULL +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + , + NULL +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -4298,7 +4310,19 @@ int16_t IVAS_REND_FeedRenderConfig( if ( pMasaInput->hMasaExtRend->hReverb != NULL ) { ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hReverb ); - if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, // Todo 1892 + hIvasRend->hHrtfs.hHrtfStatistics, + pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, + &( hRenderConfig->roomAcoustics ), + *pMasaInput->base.ctx.pOutSampleRate, + NULL, + NULL +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + , + NULL +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -8378,7 +8402,19 @@ static ivas_error ivas_masa_ext_rend_parambin_init( if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ { #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF - if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRendCfg->roomAcoustics ), output_Fs, ( *phHrtfParambin )->parametricReverberationTimes, ( *phHrtfParambin )->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, + hHrtfStatistics, + nBins, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, + &( hRendCfg->roomAcoustics ), + output_Fs, + ( *phHrtfParambin )->parametricReverberationTimes, + ( *phHrtfParambin )->parametricReverberationEneCorrections +#ifdef FIX_1139_REV_COLORATION_SHORT_T60 + , + hDiracDecBin->earlyPartEneCorrection +#endif + ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRendCfg->roomAcoustics ), output_Fs, hHrtfParambin->parametricReverberationTimes, hHrtfParambin->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) #endif -- GitLab From 7bcbe97253c3807df0b4ac1ee4f0d345110871fa Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 21 Aug 2025 10:07:18 +0300 Subject: [PATCH 2/3] Format and remove todos --- lib_dec/ivas_binRenderer_internal.c | 16 ++++++++-------- lib_dec/lib_dec.c | 2 -- lib_rend/ivas_dirac_dec_binaural_functions.c | 16 ++++++++-------- lib_rend/lib_rend.c | 16 ++++++++-------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 0728ffcde..e0b61368a 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1201,18 +1201,18 @@ ivas_error ivas_binRenderer_open( #ifdef FIX_587_DEFAULT_REVERB pRoomAcoustics = ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ? &( st_ivas->hRenderConfig->roomAcoustics ) : NULL; if ( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), - st_ivas->hHrtfStatistics, - hBinRenderer->conv_band, - hBinRenderer->timeSlots, - pRoomAcoustics, - st_ivas->hDecoderConfig->output_Fs, - st_ivas->hHrtfFastConv->fastconvReverberationTimes, - st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections + st_ivas->hHrtfStatistics, + hBinRenderer->conv_band, + hBinRenderer->timeSlots, + pRoomAcoustics, + st_ivas->hDecoderConfig->output_Fs, + st_ivas->hHrtfFastConv->fastconvReverberationTimes, + st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections #ifdef FIX_1139_REV_COLORATION_SHORT_T60 , hBinRenderer->earlyPartEneCorrection #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index c26e5cc96..8c1e5d104 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2241,7 +2241,6 @@ ivas_error IVAS_DEC_FeedRenderConfig( } } - // Todo 1892 /* FB reverberator */ if ( hIvasDec->st_ivas->hDiracDecBin[0] != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL ) { @@ -2264,7 +2263,6 @@ ivas_error IVAS_DEC_FeedRenderConfig( } } - // Todo 1892 /* Fastconv CLDFB reverberator */ if ( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 56d1baa86..85f265da3 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -267,18 +267,18 @@ ivas_error ivas_dirac_dec_init_binaural_data( #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF #ifdef FIX_587_DEFAULT_REVERB if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, - st_ivas->hHrtfStatistics, - nBins, - CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, - pRoomAcoustics, - output_Fs, - ( *phHrtfParambin )->parametricReverberationTimes, - ( *phHrtfParambin )->parametricReverberationEneCorrections + st_ivas->hHrtfStatistics, + nBins, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, + pRoomAcoustics, + output_Fs, + ( *phHrtfParambin )->parametricReverberationTimes, + ( *phHrtfParambin )->parametricReverberationEneCorrections #ifdef FIX_1139_REV_COLORATION_SHORT_T60 , hDiracDecBin->earlyPartEneCorrection #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, ( *phHrtfParambin )->parametricReverberationTimes, ( *phHrtfParambin )->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 2325a602f..81fba46f1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8501,18 +8501,18 @@ static ivas_error ivas_masa_ext_rend_parambin_init( #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF #ifdef FIX_587_DEFAULT_REVERB if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, - hHrtfStatistics, - nBins, - CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, - pRoomAcoustics, - output_Fs, - ( *phHrtfParambin )->parametricReverberationTimes, - ( *phHrtfParambin )->parametricReverberationEneCorrections + hHrtfStatistics, + nBins, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, + pRoomAcoustics, + output_Fs, + ( *phHrtfParambin )->parametricReverberationTimes, + ( *phHrtfParambin )->parametricReverberationEneCorrections #ifdef FIX_1139_REV_COLORATION_SHORT_T60 , hDiracDecBin->earlyPartEneCorrection #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRendCfg->roomAcoustics ), output_Fs, ( *phHrtfParambin )->parametricReverberationTimes, ( *phHrtfParambin )->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) #endif -- GitLab From 57f2c3dcae6b3332d20c3bd56b6b5dd49395fe6b Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Thu, 21 Aug 2025 15:22:23 +0300 Subject: [PATCH 3/3] Fixes unitialized earlyPartEneCorrection for FASTCONV path. Issue 1371 in IVAS float PC repo. --- lib_dec/ivas_binRenderer_internal.c | 2 +- lib_rend/ivas_reverb.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index e0b61368a..0c37769c3 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1210,7 +1210,7 @@ ivas_error ivas_binRenderer_open( st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections #ifdef FIX_1139_REV_COLORATION_SHORT_T60 , - hBinRenderer->earlyPartEneCorrection + NULL #endif ) ) != IVAS_ERR_OK ) #else diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 263090f0e..e54b75cab 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -2049,13 +2049,19 @@ ivas_error ivas_binaural_reverb_init( energyModifier = ( adjustedRevTime - revTimes[bin] ) / adjustedRevTime; /* Adjust early and late energies, by moving late energy to early energy */ - adjustedEarlyEne = earlyEne[bin] + revEne[bin] * energyModifier; + IF( earlyEne != NULL ) + { + adjustedEarlyEne = earlyEne[bin] + revEne[bin] * energyModifier; + } adjustedLateEne = revEne[bin] * ( 1.0f - energyModifier ); /* Store adjusted room effect parameters to be used in reverb processing */ revTimes[bin] = adjustedRevTime; revEne[bin] = adjustedLateEne; - earlyEne[bin] = adjustedEarlyEne; + IF( earlyEne != NULL ) + { + earlyEne[bin] = adjustedEarlyEne; + } } } #endif -- GitLab