diff --git a/lib_com/options.h b/lib_com/options.h index 595a1581056f4f0a64832ac158021a31c0068813..d74347195e1a39d8db41b73e652f2ae01b148637 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -221,6 +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 (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_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 800b28aacc0cac4fa3719e60c6f659dc873cd153..6c813e7144a8ec6c68d58c0c5a2fc4a510da44c6 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 e4f5df6e1a4749bdc6ff397ee6fb6d9db804208e..cafc8126a0c988273d9f627bbf469c08a524e117 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1949,7 +1949,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 072f79a07d678ef97e3eaa739c8436d30d6aa4aa..007a4f07e05dbd188680bf317bb860f7556662b0 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -280,7 +280,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; } @@ -311,7 +315,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 f39f50eb0eac0e287ddc1423486b0929e86fd6ba..d7e9a582d05ace4ed32cf56c1f0473c96d7e7740 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] ); @@ -141,8 +149,12 @@ 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 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 */ { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#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 ) || @@ -247,7 +266,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( ) /* open reverb only for the main direction */ { #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 ) +#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 #else /* 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 ) @@ -315,6 +338,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; } @@ -1306,7 +1333,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 ) { @@ -1349,7 +1380,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; @@ -1359,7 +1394,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; @@ -2185,7 +2224,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; @@ -2960,7 +3003,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; @@ -3005,7 +3054,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 { @@ -3015,7 +3068,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 } } @@ -3032,9 +3089,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; @@ -3048,10 +3117,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 @@ -3065,10 +3141,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 548b65767fbe6742f1a040689bc5c1368e153f8d..49203db068df58458a397d38bba715026c8b214d 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 69426e70601d99cf1e3da9d3d6be3e8daaee3781..41ece382ee75e5e4c1bab1df6b6b2ce2bb2747ef 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; @@ -1322,6 +1340,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]; @@ -1334,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 { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 9c4147a01cea48f08780ff3ec8ac63f9474bc87b..08a2e3286b50f0d9dee297607099fa9c5e35f110 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8646,7 +8646,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; @@ -8660,7 +8664,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 ); @@ -8730,7 +8738,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 */ { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#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 */ @@ -8739,7 +8751,11 @@ static ivas_error ivas_masa_ext_rend_parambin_init( #endif { #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 ) +#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 #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 ) @@ -8784,6 +8800,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; }