From 45585b593559ea79e90d3a6a9ae3c61b67cb9b18 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Wed, 28 May 2025 12:53:17 +0300 Subject: [PATCH 1/7] Implement MR1400 changes to float-pc. Not including changes in split rendering off path. --- lib_com/options.h | 1 + lib_dec/ivas_dirac_dec.c | 4 + lib_dec/ivas_init_dec.c | 4 + lib_dec/ivas_ism_dec.c | 8 ++ lib_rend/ivas_dirac_dec_binaural_functions.c | 90 +++++++++++++++++++- lib_rend/ivas_prot_rend.h | 4 + lib_rend/ivas_stat_rend.h | 21 ++++- lib_rend/lib_rend.c | 23 ++++- 8 files changed, 148 insertions(+), 7 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8e7f23a70..7ebb781d4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -209,6 +209,7 @@ #define FIX_1003_PARAMISM_BINAURAL_RECONFIG_USAN /* FhG: fix for #1003: fix USAN caused by ParamISM reconfig */ #define FIX_1001_ARI_HM_OVERFLOW /* FhG: fix for undef behaviour in in the harmonic TCX model arithmetic coder */ #define NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE /* FhG: issue #1005: fix TC Buffer update at a MC rate switch */ +#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 800b28aac..6c813e714 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -883,7 +883,11 @@ ivas_error ivas_dirac_dec_config( if ( st_ivas->hDiracDecBin == NULL ) #endif { +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, &( st_ivas->hHrtfParambin ) ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 741a99c2a..cbc883c0f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1928,7 +1928,11 @@ ivas_error ivas_init_decoder( } } +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, &( st_ivas->hHrtfParambin ) ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 40bb135c7..760db141f 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -267,7 +267,11 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, &( st_ivas->hHrtfParambin ) ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -298,7 +302,11 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, &( st_ivas->hHrtfParambin ) ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 558a03d1a..fb051a3b8 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -120,9 +120,17 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( COM static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF +static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, const int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t useCachedValue, HRTFS_PARAMBIN_HANDLE hHrtfParambin ); +#else static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, const int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t useCachedValue ); +#endif +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF +static void getDirectPartGains( const int16_t bin, int16_t aziDeg, int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, const uint8_t stereoMode, float Rmat[3][3], PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t isHeadtracked, HRTFS_PARAMBIN_HANDLE hHrtfParambin ); +#else static void getDirectPartGains( const int16_t bin, int16_t aziDeg, int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, const uint8_t stereoMode, float Rmat[3][3], PARAMBIN_HRTF_GAIN_CACHE *gainCache, const int16_t isHeadtracked ); +#endif static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); @@ -142,7 +150,11 @@ static void ivas_masa_ext_rend_parambin_internal( MASA_EXT_REND_HANDLE hMasaExtR ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + HRTFS_PARAMBIN_HANDLE *phHrtfParambin /* i : HRTF structure for rendering */ +#else HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ +#endif ) { DIRAC_DEC_BIN_HANDLE hDiracDecBin; @@ -180,6 +192,9 @@ ivas_error ivas_dirac_dec_init_binaural_data( hDiracDecBin->hReverb = NULL; hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + hDiracDecBin->phHrtfParambin = NULL; +#endif } output_Fs = st_ivas->hDecoderConfig->output_Fs; @@ -231,7 +246,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( } else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ { +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#else mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#endif /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || @@ -246,8 +265,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( #endif ) /* open reverb only for the main direction */ { - /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) +#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 ) +#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 { return error; } @@ -311,6 +333,10 @@ ivas_error ivas_dirac_dec_init_binaural_data( hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + hDiracDecBin->phHrtfParambin = phHrtfParambin; +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT st_ivas->hDiracDecBin[pos_idx] = hDiracDecBin; } @@ -1302,7 +1328,11 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( spreadCoh = max( spreadCoh, altSpreadCoh ); } +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex], isHeadtracked, *hDiracDecBin->phHrtfParambin ); +#else getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex], isHeadtracked ); +#endif if ( hDiracDecBin->renderStereoOutputInsteadOfBinaural ) { @@ -1345,7 +1375,11 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( rImagp *= centerMul; /* Apply the gain for the left source of the three coherent sources */ +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 1], isHeadtracked, *hDiracDecBin->phHrtfParambin ); +#else getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 1], isHeadtracked ); +#endif hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; @@ -1355,7 +1389,11 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices( /* Apply the gain for the right source of the three coherent sources. * -30 degrees to 330 wrapping due to internal functions. */ +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 2], isHeadtracked, *hDiracDecBin->phHrtfParambin ); +#else getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[gainCacheBaseIndex + 2], isHeadtracked ); +#endif hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); lRealp += sidesMul * lRealpTmp; lImagp += sidesMul * lImagpTmp; @@ -2181,7 +2219,11 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin->processMtxImPrev[chA][chB + 2][bin] = hDiracDecBin->processMtxIm[chA][chB + 2][bin]; } +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked, *hDiracDecBin->phHrtfParambin ); +#else getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked ); +#endif hDiracDecBin->processMtxRe[0][chB + 2][bin] = lRealp * gainFactor; hDiracDecBin->processMtxIm[0][chB + 2][bin] = lImagp * gainFactor; @@ -2956,7 +2998,13 @@ static void getDirectPartGains( const uint8_t renderStereoOutputInsteadOfBinaural, float Rmat[3][3], PARAMBIN_HRTF_GAIN_CACHE *gainCache, - const int16_t isHeadtracked ) +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + const int16_t isHeadtracked, + HRTFS_PARAMBIN_HANDLE hHrtfParambin +#else + const int16_t isHeadtracked +#endif +) { float aziRad, eleRad; float y, mappedX, aziRadMapped, A, A2, A3; @@ -3001,7 +3049,11 @@ static void getDirectPartGains( { if ( aziDeg == gainCache->azi && eleDeg == gainCache->ele ) { +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + hrtfShGetHrtf( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, TRUE, hHrtfParambin ); +#else hrtfShGetHrtf( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, TRUE ); +#endif } else { @@ -3011,7 +3063,11 @@ static void getDirectPartGains( { rotateAziEle( (float) aziDeg, (float) eleDeg, &aziDeg, &eleDeg, Rmat, 0 ); } +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + hrtfShGetHrtf( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, FALSE, hHrtfParambin ); +#else hrtfShGetHrtf( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, FALSE ); +#endif } } @@ -3028,9 +3084,21 @@ static void hrtfShGetHrtf( float *rRealp, float *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, - const int16_t useCachedValue ) +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + const int16_t useCachedValue, + HRTFS_PARAMBIN_HANDLE hHrtfParambin +#else + const int16_t useCachedValue +#endif +) { int16_t k; +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + float( *hrtfShCoeffsReInt )[16][60]; + float( *hrtfShCoeffsImInt )[16][60]; + hrtfShCoeffsReInt = hHrtfParambin->hrtfShCoeffsRe; + hrtfShCoeffsImInt = hHrtfParambin->hrtfShCoeffsIm; +#endif *lRealp = 0.0f; *lImagp = 0.0f; @@ -3044,10 +3112,17 @@ static void hrtfShGetHrtf( for ( k = 0; k < HRTF_SH_CHANNELS; k++ ) { +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + *lRealp += hrtfShCoeffsReInt[0][k][bin] * shVec[k]; + *lImagp += hrtfShCoeffsImInt[0][k][bin] * shVec[k]; + *rRealp += hrtfShCoeffsReInt[1][k][bin] * shVec[k]; + *rImagp += hrtfShCoeffsImInt[1][k][bin] * shVec[k]; +#else *lRealp += hrtfShCoeffsRe[0][k][bin] * shVec[k]; *lImagp += hrtfShCoeffsIm[0][k][bin] * shVec[k]; *rRealp += hrtfShCoeffsRe[1][k][bin] * shVec[k]; *rImagp += hrtfShCoeffsIm[1][k][bin] * shVec[k]; +#endif } } else @@ -3061,10 +3136,17 @@ static void hrtfShGetHrtf( for ( k = 0; k < HRTF_SH_CHANNELS; k++ ) { +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + *lRealp += hrtfShCoeffsReInt[0][k][bin] * shVec[k]; + *lImagp += hrtfShCoeffsImInt[0][k][bin] * shVec[k]; + *rRealp += hrtfShCoeffsReInt[1][k][bin] * shVec[k]; + *rImagp += hrtfShCoeffsImInt[1][k][bin] * shVec[k]; +#else *lRealp += hrtfShCoeffsRe[0][k][bin] * shVec[k]; *lImagp += hrtfShCoeffsIm[0][k][bin] * shVec[k]; *rRealp += hrtfShCoeffsRe[1][k][bin] * shVec[k]; *rImagp += hrtfShCoeffsIm[1][k][bin] * shVec[k]; +#endif gainCache->shVec[k] = shVec[k]; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index d37f770ca..226f94061 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -214,7 +214,11 @@ void ivas_masa_ext_rend_parambin_render( ); ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + HRTFS_PARAMBIN_HANDLE *phHrtfParambin /* i : HRTF structure for rendering */ +#else HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ +#endif ); void ivas_dirac_dec_close_binaural_data( diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 2f5b7e0ac..03d3dc123 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -495,6 +495,20 @@ typedef struct ivas_diffuse_distribution_data_structure } DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF +typedef struct ivas_hrtfs_parambin_struct +{ + float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; + float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; + + float parametricReverberationTimes[CLDFB_NO_CHANNELS_MAX]; + float parametricReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; + float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; + + int16_t allocatedFromFile; /* Not used and should not be here. Remove in cleanup. */ + +} HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; +#endif /* Parametric binaural data structure */ typedef struct ivas_dirac_dec_binaural_data_structure @@ -531,6 +545,10 @@ typedef struct ivas_dirac_dec_binaural_data_structure ivas_td_decorr_state_t *hTdDecorr; float reqularizationFactor; +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + HRTFS_PARAMBIN_HANDLE *phHrtfParambin; +#endif + DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; HANDLE_DIRAC_DECORR_PARAMS h_freq_domain_decorr_ap_params; @@ -1319,6 +1337,7 @@ typedef struct ivas_hrtfs_fastconv_struct } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; +#ifndef NONBE_FIX_991_PARAMBIN_BINARY_HRTF typedef struct ivas_hrtfs_parambin_struct { float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; @@ -1331,7 +1350,7 @@ typedef struct ivas_hrtfs_parambin_struct int16_t allocatedFromFile; } HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; - +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------------------* diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3d1f9b518..0a5329289 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8505,7 +8505,11 @@ static ivas_error ivas_masa_ext_rend_parambin_init( ) { DIRAC_DEC_BIN_HANDLE hDiracDecBin; +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + HRTFS_PARAMBIN_HANDLE *phHrtfParambin; +#else HRTFS_PARAMBIN_HANDLE hHrtfParambin; +#endif int16_t nBins; int32_t output_Fs; RENDERER_TYPE renderer_type; @@ -8519,7 +8523,11 @@ static ivas_error ivas_masa_ext_rend_parambin_init( error = IVAS_ERR_OK; +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + phHrtfParambin = inputMasa->hMasaExtRend->hHrtfParambin; +#else hHrtfParambin = *( inputMasa->hMasaExtRend->hHrtfParambin ); +#endif /* Set common variables and defaults */ output_Fs = *( inputMasa->base.ctx.pOutSampleRate ); @@ -8589,7 +8597,11 @@ static ivas_error ivas_masa_ext_rend_parambin_init( } else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ { +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#else mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ @@ -8597,8 +8609,11 @@ static ivas_error ivas_masa_ext_rend_parambin_init( if ( hDiracDecBin->hReverb == NULL ) #endif { - /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) +#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 ) +#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 { return error; } @@ -8639,6 +8654,10 @@ static ivas_error ivas_masa_ext_rend_parambin_init( /* External renderer uses constant regularization factor */ hDiracDecBin->reqularizationFactor = 0.4f; +#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF + hDiracDecBin->phHrtfParambin = phHrtfParambin; +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT inputMasa->hMasaExtRend->hDiracDecBin[pos_idx] = hDiracDecBin; } -- GitLab From 66132a9b942de98c07a7587fff0669f7351d7c61 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Tue, 10 Jun 2025 12:52:51 +0300 Subject: [PATCH 2/7] fix clang --- lib_rend/lib_rend.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 0804dbb64..c66039884 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7820,7 +7820,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, @@ -8741,7 +8741,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #else - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #endif #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -8752,9 +8752,9 @@ static ivas_error ivas_masa_ext_rend_parambin_init( { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES #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 ) ) != 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 ) + 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 #else /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ -- GitLab From 242f7d71156627897a2acc742f0e387b8eb51a46 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Tue, 10 Jun 2025 13:25:56 +0300 Subject: [PATCH 3/7] undef switches --- lib_com/options.h | 2 +- lib_rend/ivas_stat_rend.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 855eb92b0..d74347195 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -221,7 +221,7 @@ #define FIX_1001_ARI_HM_OVERFLOW /* FhG: fix for undef behaviour in in the harmonic TCX model arithmetic coder */ #define NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE /* FhG: issue #1005: fix TC Buffer update at a MC rate switch */ #define NONBE_FIX_1004_USAN_DTX_MASA_NO_DIRS /* Nokia: fix USAN error caused by non-setting of correctly the number of MASA directions in DTX */ -#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin */ +/* #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF */ /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to actiate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on )*/ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 6960db8cd..41ece382e 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1353,7 +1353,7 @@ typedef struct ivas_hrtfs_parambin_struct int16_t allocatedFromFile; } HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; - +#endif #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES typedef struct ivas_hrtfs_statistics_struct { -- GitLab From b807dd0befbe50cf38da3704df03704cc9721d80 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Tue, 10 Jun 2025 15:11:58 +0300 Subject: [PATCH 4/7] fix clang --- lib_rend/ivas_dirac_dec_binaural_functions.c | 6 +++--- lib_rend/lib_rend.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 14287e926..d7e9a582d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -149,7 +149,7 @@ static void ivas_masa_ext_rend_parambin_internal( MASA_EXT_REND_HANDLE hMasaExtR *------------------------------------------------------------------------*/ ivas_error ivas_dirac_dec_init_binaural_data( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF HRTFS_PARAMBIN_HANDLE *phHrtfParambin /* i : HRTF structure for rendering */ #else @@ -249,7 +249,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #else - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #endif /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ @@ -267,7 +267,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES #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, 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 ) #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/lib_rend.c b/lib_rend/lib_rend.c index c66039884..1b80eac4d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8741,13 +8741,13 @@ static ivas_error ivas_masa_ext_rend_parambin_init( #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #else - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ #else - if ( hDiracDecBin->hReverb == NULL ) + if ( hDiracDecBin->hReverb == NULL ) #endif { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES @@ -8757,8 +8757,8 @@ static ivas_error ivas_masa_ext_rend_parambin_init( 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 #else - /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) + /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ + if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) #endif { return error; -- GitLab From 387420dcf619751cb4d802aaf6754b14fe446491 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Tue, 10 Jun 2025 15:17:00 +0300 Subject: [PATCH 5/7] fix clang --- lib_rend/lib_rend.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1b80eac4d..c66039884 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8741,13 +8741,13 @@ static ivas_error ivas_masa_ext_rend_parambin_init( #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #else - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); #endif #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ #else - if ( hDiracDecBin->hReverb == NULL ) + if ( hDiracDecBin->hReverb == NULL ) #endif { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES @@ -8757,8 +8757,8 @@ static ivas_error ivas_masa_ext_rend_parambin_init( 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 #else - /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) + /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ + if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) #endif { return error; -- GitLab From 3b5fb049bef69deac14c1c734b998c0d9bd3f792 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Tue, 10 Jun 2025 16:45:34 +0300 Subject: [PATCH 6/7] fix clang --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c66039884..385a80254 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7820,7 +7820,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t ) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, -- GitLab From f166f6c3d1caa9ae0248e240881549b7d4ef35a2 Mon Sep 17 00:00:00 2001 From: Adriana Vasilache Date: Tue, 10 Jun 2025 16:48:33 +0300 Subject: [PATCH 7/7] fix clang --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 385a80254..08a2e3286 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7820,7 +7820,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( const int16_t ) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, -- GitLab