From cb33d3a3c0e16cbedc8cedaef17ab6c8fff2b0ee Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 7 Jun 2023 16:57:23 +0300 Subject: [PATCH 1/6] Fix issue 541. Adapt function calls correctly in paramBin for EXTERNAL_ORIENTATIONS switch. --- lib_com/options.h | 1 + lib_rend/ivas_dirac_dec_binaural_functions.c | 18 ++++++++++++++++-- lib_rend/lib_rend.c | 10 +++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4328602f5a..82b5866eec 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,6 +172,7 @@ #define FIX_395_CNG_BW /* Eri: Issue 395 - CNG bandwidth issue for unified stereo */ #define EXTERNAL_ORIENTATIONS /* Nokia: Contribution 41: (external) orientation information handling */ +#define FIX_541_EXT_REND_MASA_ROTATIONS /* Nokia: Issue 541, rotations missing in masa external renderer */ #define MASA_PREREND /* Nokia: Contribution 42: Support for IVAS_rend to merge MASA + other format to MASA */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 2eefb0e1d3..36e83bf718 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -414,7 +414,11 @@ void ivas_dirac_dec_binaural_render( for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { int16_t n_samples_sf = slot_size * hDirAC->subframe_nbslots[subframe_idx]; +#ifdef EXTERNAL_ORIENTATIONS ivas_dirac_dec_binaural_internal( st_ivas, st_ivas->hCombinedOrientationData, output_f_local, nchan_transport, subframe_idx ); +#else + ivas_dirac_dec_binaural_internal( st_ivas, output_f_local, nchan_transport, subframe_idx ); +#endif for ( ch = 0; ch < nchan_out; ch++ ) { output_f_local[ch] += n_samples_sf; @@ -712,7 +716,12 @@ static void ivas_dirac_dec_binaural_internal( } #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ); + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe, +#ifdef EXTERNAL_ORIENTATIONS + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); +#else + st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ); +#endif #else ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe ); #endif @@ -731,7 +740,12 @@ static void ivas_dirac_dec_binaural_internal( } #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH - ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat, st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ); + ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat, +#ifdef EXTERNAL_ORIENTATIONS + hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0 ); +#else + st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ); +#endif #else ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat ); #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e9d9448161..4659f94da8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6415,7 +6415,7 @@ static ivas_error renderActiveInputsMasa( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) { - int16_t i; + int16_t i, sf_idx; input_masa *pCurrentInput; ivas_error error; @@ -6427,6 +6427,14 @@ static ivas_error renderActiveInputsMasa( continue; } +#ifdef FIX_541_EXT_REND_MASA_ROTATIONS + for ( sf_idx = 0; sf_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf_idx ) + { + pCurrentInput->decDummy->hHeadTrackData->Quaternions[sf_idx] = hIvasRend->headRotData.headPositions[sf_idx]; + pCurrentInput->decDummy->hHeadTrackData->Pos[sf_idx] = hIvasRend->headRotData.Pos[sf_idx]; + } +#endif + if ( ( error = renderInputMasa( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; -- GitLab From 8678a9664ec66650ad8a0948e872546ecaac7430 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 7 Jun 2023 17:09:34 +0300 Subject: [PATCH 2/6] Wrap variable with switch --- lib_rend/lib_rend.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4659f94da8..5fafee3b72 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6415,9 +6415,12 @@ static ivas_error renderActiveInputsMasa( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) { - int16_t i, sf_idx; + int16_t i; input_masa *pCurrentInput; ivas_error error; +#ifdef FIX_541_EXT_REND_MASA_ROTATIONS + int16_t sf_idx; +#endif for ( i = 0, pCurrentInput = hIvasRend->inputsMasa; i < RENDERER_MAX_MASA_INPUTS; ++i, ++pCurrentInput ) { -- GitLab From 1ba9e4adc5a6fc19f88d2b105809d1f0224cac55 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Thu, 8 Jun 2023 10:16:47 +0300 Subject: [PATCH 3/6] Copy head rotations only in binarual rendering in ext masa path --- lib_rend/lib_rend.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 5fafee3b72..3a1077f5a6 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6431,10 +6431,13 @@ static ivas_error renderActiveInputsMasa( } #ifdef FIX_541_EXT_REND_MASA_ROTATIONS - for ( sf_idx = 0; sf_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf_idx ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && pCurrentInput->decDummy->hHeadTrackData != NULL ) { - pCurrentInput->decDummy->hHeadTrackData->Quaternions[sf_idx] = hIvasRend->headRotData.headPositions[sf_idx]; - pCurrentInput->decDummy->hHeadTrackData->Pos[sf_idx] = hIvasRend->headRotData.Pos[sf_idx]; + for ( sf_idx = 0; sf_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf_idx ) + { + pCurrentInput->decDummy->hHeadTrackData->Quaternions[sf_idx] = hIvasRend->headRotData.headPositions[sf_idx]; + pCurrentInput->decDummy->hHeadTrackData->Pos[sf_idx] = hIvasRend->headRotData.Pos[sf_idx]; + } } #endif -- GitLab From 284f16d44dde4e6b838e61d15ac8a18b7c15c69c Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Fri, 9 Jun 2023 14:16:42 +0300 Subject: [PATCH 4/6] Further fixes/adjustments for EXTERNAL_ORIENTATIONS switch --- lib_com/ivas_prot.h | 3 ++- lib_dec/ivas_binRenderer_internal.c | 30 +++++++++++++++----------- lib_dec/ivas_dirac_dec.c | 27 ++++++++++++++++++----- lib_dec/ivas_ism_param_dec.c | 9 ++++++-- lib_dec/ivas_ism_renderer.c | 21 +++++++++++++++++- lib_dec/ivas_jbm_dec.c | 12 +++++++++++ lib_dec/ivas_mc_param_dec.c | 16 ++++++++++++-- lib_dec/ivas_objectRenderer_internal.c | 7 ++++-- lib_dec/ivas_output_config.c | 29 ++++++++++++++++++++++++- lib_rend/ivas_objectRenderer.c | 7 ++++-- lib_rend/ivas_prot_rend.h | 4 +++- lib_rend/ivas_rotation.c | 16 ++++++++++++-- lib_rend/ivas_stat_rend.h | 2 ++ lib_rend/lib_rend.c | 14 ++++++++---- 14 files changed, 161 insertions(+), 36 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b4759ee720..a1950170a2 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5159,10 +5159,11 @@ void ivas_binaural_cldfb_sf( #endif void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ #ifdef EXTERNAL_ORIENTATIONS COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ int16_t subframe_idx, /* i : subframe index */ +#else + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ #endif const int16_t numTimeSlots, /* i: : number of time slots to process */ float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 074a7c3cdb..c829473ce9 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1041,7 +1041,7 @@ void ivas_binaural_cldfb( /* Implement binaural rendering */ #ifdef EXTERNAL_ORIENTATIONS - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, st_ivas->hCombinedOrientationData, subframeIdx, JBM_CLDFB_SLOTS_IN_SUBFRAME, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, subframeIdx, JBM_CLDFB_SLOTS_IN_SUBFRAME, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); #else ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, JBM_CLDFB_SLOTS_IN_SUBFRAME, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); #endif @@ -1137,7 +1137,7 @@ void ivas_binaural_cldfb_sf( /* Implement binaural rendering */ #ifdef EXTERNAL_ORIENTATIONS - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, st_ivas->hCombinedOrientationData, subframeIdx, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, subframeIdx, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); #else ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); #endif @@ -1175,10 +1175,11 @@ void ivas_binaural_cldfb_sf( void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ #ifdef EXTERNAL_ORIENTATIONS COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ int16_t subframe_idx, /* i : subframe index */ +#else + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ #endif const int16_t numTimeSlots, /* i : number of time slots to render*/ float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ @@ -1203,34 +1204,37 @@ void ivas_binRenderer( } /* Head rotation in HOA3 or CICPx */ - if ( hHeadTrackData + if ( #ifdef EXTERNAL_ORIENTATIONS - && hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[subframe_idx] + hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[subframe_idx] #else - && hHeadTrackData->num_quaternions >= 0 + hHeadTrackData && hHeadTrackData->num_quaternions >= 0 #endif && hBinRenderer->rotInCldfb ) { if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) { /* Rotation in SHD (HOA3) */ - if ( hHeadTrackData->shd_rot_max_order == -1 ) - { #ifdef EXTERNAL_ORIENTATIONS + if ( hCombinedOrientationData->shd_rot_max_order == -1 ) + { rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat[subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); + } + else if ( hCombinedOrientationData->shd_rot_max_order > 0 ) + { + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat[subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hCombinedOrientationData->shd_rot_max_order ); + } #else + if ( hHeadTrackData->shd_rot_max_order == -1 ) + { QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); -#endif } else if ( hHeadTrackData->shd_rot_max_order > 0 ) { -#ifdef EXTERNAL_ORIENTATIONS - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat[subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hHeadTrackData->shd_rot_max_order ); -#else rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hHeadTrackData->shd_rot_max_order ); -#endif } +#endif } else { diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 5877dc4738..0524ceef70 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2627,7 +2627,7 @@ void ivas_dirac_dec_render_sf( } #ifdef EXTERNAL_ORIENTATIONS - if ( st_ivas->hHeadTrackData && st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] ) + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] ) #else if ( st_ivas->hHeadTrackData ) #endif @@ -2640,7 +2640,11 @@ void ivas_dirac_dec_render_sf( p_Rmat = &st_ivas->hHeadTrackData->Rmat[0][0]; #endif +#ifdef EXTERNAL_ORIENTATIONS + if ( st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) +#else if ( st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) +#endif { num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; #ifdef FIX_393_459_460_SBA_MD @@ -2714,7 +2718,7 @@ void ivas_dirac_dec_render_sf( } } #ifdef EXTERNAL_ORIENTATIONS - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hHeadTrackData->shd_rot_max_order == 1 ) + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 1 ) #else if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 1 ) #endif @@ -2731,7 +2735,11 @@ void ivas_dirac_dec_render_sf( #endif md_idx, surCohRatio, +#ifdef EXTERNAL_ORIENTATIONS + st_ivas->hCombinedOrientationData->shd_rot_max_order, +#else st_ivas->hHeadTrackData->shd_rot_max_order, +#endif p_Rmat, hodirac_flag ); } @@ -2821,7 +2829,7 @@ void ivas_dirac_dec_render_sf( if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { #ifdef EXTERNAL_ORIENTATIONS - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) #else if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) #endif @@ -2907,7 +2915,11 @@ void ivas_dirac_dec_render_sf( #ifdef FIX_393_459_460_SBA_MD mvs2s( &hDirAC->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], hDirAC->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); mvs2s( &hDirAC->elevation[md_idx][hDirAC->hConfig->enc_param_start_band], &elevation[hDirAC->hConfig->enc_param_start_band], hDirAC->num_freq_bands - hDirAC->hConfig->enc_param_start_band ); +#ifdef EXTERNAL_ORIENTATIONS + if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 ) +#else if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) +#endif { num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); @@ -3072,7 +3084,7 @@ void ivas_dirac_dec_render_sf( /*Compute PSDs*/ #ifdef EXTERNAL_ORIENTATIONS - if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 ) #else if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) #endif @@ -3089,7 +3101,11 @@ void ivas_dirac_dec_render_sf( diffuseness_vector[slot_idx], #endif hDirAC, +#ifdef EXTERNAL_ORIENTATIONS + st_ivas->hCombinedOrientationData->shd_rot_max_order, +#else st_ivas->hHeadTrackData->shd_rot_max_order, +#endif p_Rmat, st_ivas->hVBAPdata, hDirAC->hOutSetup, @@ -3241,10 +3257,11 @@ void ivas_dirac_dec_render_sf( { /* Perform binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, - st_ivas->hHeadTrackData, #ifdef EXTERNAL_ORIENTATIONS st_ivas->hCombinedOrientationData, subframe_idx, +#else + st_ivas->hHeadTrackData, #endif hDirAC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_Binaural, diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 7bbad7aa99..04d59cfdd7 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -991,8 +991,13 @@ void ivas_ism_dec_digest_tc( azimuth = (int16_t) floorf( st_ivas->hIsmMetaData[i]->azimuth + 0.5f ); elevation = (int16_t) floorf( st_ivas->hIsmMetaData[i]->elevation + 0.5f ); - if ( ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) && st_ivas->hHeadTrackData == NULL ) - { + if ( ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) && +#ifdef EXTERNAL_ORIENTATIONS + st_ivas->hCombinedOrientationData == NULL +#else + st_ivas->hHeadTrackData == NULL +#endif + ) { if ( st_ivas->hIntSetup.is_planar_setup ) { /* If no elevation support in output format, then rendering should be done with zero elevation */ diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 2362979ff6..6422c15d29 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -242,8 +242,10 @@ void ivas_ism_render_sf( int16_t azimuth, elevation; int16_t tc_offset; int16_t interp_offset; - float Rmat[3][3]; float gain, prev_gain; +#ifndef EXTERNAL_ORIENTATIONS + float Rmat[3][3]; +#endif num_objects = st_ivas->nchan_transport; nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; @@ -256,11 +258,16 @@ void ivas_ism_render_sf( set_f( output_f[i], 0.0f, n_samples_to_render ); } +#ifdef EXTERNAL_ORIENTATIONS + if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] ) + { +#else if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) { /* Calculate rotation matrix from the quaternion */ QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], Rmat ); +#endif ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator ); @@ -269,10 +276,18 @@ void ivas_ism_render_sf( for ( i = 0; i < num_objects; i++ ) { + +#ifdef EXTERNAL_ORIENTATIONS + /* Combined rotation: rotate the object positions depending the head and external orientations */ + if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) + { + rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup ); +#else /* Head rotation: rotate the object positions depending the head's orientation */ if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 && !st_ivas->hIsmMetaData[i]->non_diegetic_flag ) { rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, Rmat, st_ivas->hIntSetup.is_planar_setup ); +#endif if ( st_ivas->hEFAPdata != NULL ) { efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], azimuth, elevation, EFAP_MODE_EFAP ); @@ -301,7 +316,11 @@ void ivas_ism_render_sf( } /* update here only in case of head rotation */ +#ifdef EXTERNAL_ORIENTATIONS + if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) +#else if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) +#endif { st_ivas->hIsmRendererData->prev_gains[i][j] = gain; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index d1132aeaa6..b086001453 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -638,6 +638,18 @@ ivas_error ivas_jbm_dec_render( p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; } +#ifdef EXTERNAL_ORIENTATIONS + /*----------------------------------------------------------------* + * Combine orientations + *----------------------------------------------------------------*/ + + if ( ( error = combine_external_and_head_orientations_dec( st_ivas->hHeadTrackData, st_ivas->hExtOrientationData, + st_ivas->hCombinedOrientationData ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + /*----------------------------------------------------------------* * Rendering *----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 78cdbfadc9..126f143467 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1583,7 +1583,11 @@ void ivas_param_mc_dec_render( { nchan_out_cldfb = BINAURAL_CHANNELS; set_s( channel_active, 1, nchan_out_cldfb ); +#ifdef EXTERNAL_ORIENTATIONS + if ( st_ivas->hCombinedOrientationData ) +#else if ( st_ivas->hHeadTrackData ) +#endif { nchan_out_init = MAX_INTERN_CHANNELS; } @@ -1692,7 +1696,13 @@ void ivas_param_mc_dec_render( if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { - if ( st_ivas->hHeadTrackData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + if ( +#ifdef EXTERNAL_ORIENTATIONS + st_ivas->hCombinedOrientationData +#else + st_ivas->hHeadTrackData +#endif + && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE ); } @@ -1754,9 +1764,11 @@ void ivas_param_mc_dec_render( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, + ivas_binRenderer( st_ivas->hBinRenderer, #ifdef EXTERNAL_ORIENTATIONS st_ivas->hCombinedOrientationData, subframe_idx, +#else + st_ivas->hHeadTrackData, #endif hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 9ba6351f63..087120d2e7 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -89,10 +89,12 @@ ivas_error ivas_td_binaural_renderer( #ifdef EXTERNAL_ORIENTATIONS ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation : NULL, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL, + ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL, #else st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, #endif - ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, ism_md_subframe_update, output, output_frame ); + ism_md_subframe_update, output, output_frame ); } @@ -185,11 +187,12 @@ ivas_error ivas_td_binaural_renderer_sf( #ifdef EXTERNAL_ORIENTATIONS ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] : 0, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL, + ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL ); #else st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[0] : NULL, -#endif ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL ); +#endif if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 07beb88996..6be1af3503 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -71,10 +71,17 @@ void ivas_renderer_select( * Binaural rendering configurations *-----------------------------------------------------------------*/ +#ifdef EXTERNAL_ORIENTATIONS + if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) + { + st_ivas->hCombinedOrientationData->shd_rot_max_order = -1; + } +#else if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { st_ivas->hHeadTrackData->shd_rot_max_order = -1; } +#endif if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) { @@ -149,25 +156,45 @@ void ivas_renderer_select( *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; } - if ( st_ivas->hDecoderConfig->Opt_Headrotation ) + if ( st_ivas->hDecoderConfig->Opt_Headrotation +#ifdef EXTERNAL_ORIENTATIONS + || st_ivas->hDecoderConfig->Opt_ExternalOrientation +#endif + ) { nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); if ( nchan_internal == 2 ) { +#ifdef EXTERNAL_ORIENTATIONS + st_ivas->hCombinedOrientationData->shd_rot_max_order = 1; +#else st_ivas->hHeadTrackData->shd_rot_max_order = 1; +#endif } else if ( nchan_internal == 4 || nchan_internal == 3 ) { +#ifdef EXTERNAL_ORIENTATIONS + st_ivas->hCombinedOrientationData->shd_rot_max_order = 0; +#else st_ivas->hHeadTrackData->shd_rot_max_order = 0; +#endif } else if ( nchan_internal == 6 || nchan_internal == 5 ) { +#ifdef EXTERNAL_ORIENTATIONS + st_ivas->hCombinedOrientationData->shd_rot_max_order = 2; +#else st_ivas->hHeadTrackData->shd_rot_max_order = 2; +#endif } else if ( nchan_internal == 8 || nchan_internal == 7 ) { +#ifdef EXTERNAL_ORIENTATIONS + st_ivas->hCombinedOrientationData->shd_rot_max_order = 3; +#else st_ivas->hHeadTrackData->shd_rot_max_order = 3; +#endif } } } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index c0eeb1ef74..2b14732dbf 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -628,9 +628,10 @@ ivas_error ivas_td_binaural_renderer_ext( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ - const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ #ifdef EXTERNAL_ORIENTATIONS const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ +#else + const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ #endif const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ @@ -697,11 +698,13 @@ ivas_error ivas_td_binaural_renderer_ext( #ifdef EXTERNAL_ORIENTATIONS ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->enableCombinedOrientation : NULL, ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->Quaternions : NULL, + ( hCombinedOrientationData != NULL ) ? ( *hCombinedOrientationData )->listenerPos : NULL, #else headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, + ( headRotData != NULL ) ? headRotData->Pos : NULL, #endif - ( headRotData != NULL ) ? headRotData->Pos : NULL, ism_md_subframe_update_ext, p_output, output_frame ) ) != IVAS_ERR_OK ) + ism_md_subframe_update_ext, p_output, output_frame ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 8b0bf1f471..c89815568f 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -246,9 +246,10 @@ ivas_error ivas_td_binaural_renderer_ext( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ - const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ #ifdef EXTERNAL_ORIENTATIONS const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ +#else + const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ #endif const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ @@ -888,6 +889,7 @@ ivas_error combine_external_and_head_orientations_rend( ivas_error combine_external_and_head_orientations( IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ + IVAS_VECTOR3 *listenerPos, /* i : listener position */ int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 7ab33cec89..58d4c7dc08 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -799,9 +799,11 @@ ivas_error ivas_combined_orientation_open( { int16_t i, j; IVAS_QUATERNION identity; + IVAS_VECTOR3 origo; identity.w = 1.0f; identity.x = identity.y = identity.z = 0.0f; + origo.x = origo.y = origo.z = 0.0f; /* Allocate handle */ if ( ( *hCombinedOrientationData = (COMBINED_ORIENTATION_HANDLE) malloc( sizeof( COMBINED_ORIENTATION_DATA ) ) ) == NULL ) @@ -827,6 +829,7 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->Quaternions[i] = identity; ( *hCombinedOrientationData )->Quaternions_prev_headRot[i] = identity; ( *hCombinedOrientationData )->Quaternions_prev_extOrientation[i] = identity; + ( *hCombinedOrientationData )->listenerPos[i] = origo; for ( j = 0; j < 3; j++ ) { @@ -885,6 +888,7 @@ ivas_error combine_external_and_head_orientations_dec( ) { IVAS_QUATERNION *headRotQuaternions = NULL; + IVAS_VECTOR3 *listenerPos = NULL; int16_t numHeadRotQuaternions = 0; if ( hHeadTrackData != NULL ) @@ -893,10 +897,11 @@ ivas_error combine_external_and_head_orientations_dec( if ( hHeadTrackData->num_quaternions >= 0 ) { headRotQuaternions = hHeadTrackData->Quaternions; + listenerPos = hHeadTrackData->Pos; } } - return combine_external_and_head_orientations( headRotQuaternions, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); + return combine_external_and_head_orientations( headRotQuaternions, listenerPos, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); } @@ -913,6 +918,7 @@ ivas_error combine_external_and_head_orientations_rend( ) { IVAS_QUATERNION *headRotQuaternions = NULL; + IVAS_VECTOR3 *listenerPos = NULL; int16_t numHeadRotQuaternions = 0; int16_t i; @@ -921,6 +927,7 @@ ivas_error combine_external_and_head_orientations_rend( if ( hHeadTrackData->headRotEnabled ) { headRotQuaternions = hHeadTrackData->headPositions; + listenerPos = hHeadTrackData->Pos; } } else if ( hExtOrientationData != NULL ) @@ -935,7 +942,7 @@ ivas_error combine_external_and_head_orientations_rend( } } - return combine_external_and_head_orientations( headRotQuaternions, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); + return combine_external_and_head_orientations( headRotQuaternions, listenerPos, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); } @@ -948,6 +955,7 @@ ivas_error combine_external_and_head_orientations_rend( ivas_error combine_external_and_head_orientations( IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ + IVAS_VECTOR3 *listenerPos, /* i : listener position */ int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ @@ -955,9 +963,11 @@ ivas_error combine_external_and_head_orientations( { int16_t i, j; IVAS_QUATERNION identity; + IVAS_VECTOR3 origo; identity.w = 1.0f; identity.x = identity.y = identity.z = 0.0f; + origo.x = origo.y = origo.z = 0.0f; /* Form combined orientations or return if no data available */ if ( hCombinedOrientationData == NULL ) @@ -983,6 +993,7 @@ ivas_error combine_external_and_head_orientations( { hCombinedOrientationData->enableCombinedOrientation[i] = 0; hCombinedOrientationData->Quaternions[i] = identity; + hCombinedOrientationData->listenerPos[i] = origo; for ( j = 0; j < 3; j++ ) { @@ -1131,6 +1142,7 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions_prev_headRot[i] = identity; } } + hCombinedOrientationData->listenerPos[i] = listenerPos[i]; } } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index bec505c4ee..719435b86d 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -315,6 +315,8 @@ typedef struct ivas_combined_orientation_struct float Rmat_prev[3][3]; float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ float procChEneIIR[2][MASA_FREQUENCY_BANDS]; + int16_t shd_rot_max_order; + IVAS_VECTOR3 listenerPos[MAX_PARAM_SPATIAL_SUBFRAMES]; } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3a1077f5a6..7e2d26a2dd 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4772,9 +4772,10 @@ static ivas_error renderIsmToBinaural( if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, - ismInput->base.ctx.pHeadRotData, #ifdef EXTERNAL_ORIENTATIONS ismInput->base.ctx.pCombinedOrientationData, +#else + ismInput->base.ctx.pHeadRotData, #endif &ismInput->currentPos, ismInput->hReverb, @@ -4855,9 +4856,10 @@ static ivas_error renderIsmToBinauralRoom( if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, - ismInput->base.ctx.pHeadRotData, #ifdef EXTERNAL_ORIENTATIONS ismInput->base.ctx.pCombinedOrientationData, +#else + ismInput->base.ctx.pHeadRotData, #endif &ismInput->currentPos, ismInput->hReverb, @@ -5323,9 +5325,11 @@ static ivas_error renderMcToBinaural( { copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, #ifdef EXTERNAL_ORIENTATIONS mcInput->base.ctx.pCombinedOrientationData, +#else + mcInput->base.ctx.pHeadRotData, #endif NULL, mcInput->hReverb, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) @@ -5439,9 +5443,11 @@ static ivas_error renderMcToBinauralRoom( { copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, #ifdef EXTERNAL_ORIENTATIONS mcInput->base.ctx.pCombinedOrientationData, +#else + mcInput->base.ctx.pHeadRotData, #endif NULL, mcInput->hReverb, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { -- GitLab From bf5c93b178349b6fae4d6b7774e994dcd6e90a42 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Fri, 9 Jun 2023 14:36:54 +0300 Subject: [PATCH 5/6] Run clang-format --- lib_dec/ivas_binRenderer_internal.c | 6 +++--- lib_dec/ivas_ism_param_dec.c | 7 ++++--- lib_dec/ivas_mc_param_dec.c | 6 +++--- lib_rend/ivas_objectRenderer.c | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index c829473ce9..c23669933a 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1206,11 +1206,11 @@ void ivas_binRenderer( /* Head rotation in HOA3 or CICPx */ if ( #ifdef EXTERNAL_ORIENTATIONS - hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[subframe_idx] + hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[subframe_idx] #else - hHeadTrackData && hHeadTrackData->num_quaternions >= 0 + hHeadTrackData && hHeadTrackData->num_quaternions >= 0 #endif - && hBinRenderer->rotInCldfb ) + && hBinRenderer->rotInCldfb ) { if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 ) { diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 04d59cfdd7..8210e4121f 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -993,11 +993,12 @@ void ivas_ism_dec_digest_tc( if ( ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) && #ifdef EXTERNAL_ORIENTATIONS - st_ivas->hCombinedOrientationData == NULL + st_ivas->hCombinedOrientationData == NULL #else - st_ivas->hHeadTrackData == NULL + st_ivas->hHeadTrackData == NULL #endif - ) { + ) + { if ( st_ivas->hIntSetup.is_planar_setup ) { /* If no elevation support in output format, then rendering should be done with zero elevation */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 126f143467..189c94e9b2 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1698,11 +1698,11 @@ void ivas_param_mc_dec_render( { if ( #ifdef EXTERNAL_ORIENTATIONS - st_ivas->hCombinedOrientationData + st_ivas->hCombinedOrientationData #else - st_ivas->hHeadTrackData + st_ivas->hHeadTrackData #endif - && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE ); } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 2b14732dbf..3bcce1e89c 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -631,7 +631,7 @@ ivas_error ivas_td_binaural_renderer_ext( #ifdef EXTERNAL_ORIENTATIONS const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ #else - const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ + const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ #endif const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ -- GitLab From 756a72bb05c82594dbf8e125fe6fec5b80bd063e Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Mon, 12 Jun 2023 16:41:27 +0300 Subject: [PATCH 6/6] Fix function call with proper use of EXTERNAL_ORIENTATIONS switch --- lib_rend/lib_rend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 094d7ed6bf..08f6536249 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5143,9 +5143,10 @@ static ivas_error renderIsmToBinauralReverb( if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, - ismInput->base.ctx.pHeadRotData, #ifdef EXTERNAL_ORIENTATIONS ismInput->base.ctx.pCombinedOrientationData, +#else + ismInput->base.ctx.pHeadRotData, #endif &ismInput->currentPos, ismInput->hReverb, -- GitLab