Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ #define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ #define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ #define FIX_570_SF_EXT_ORIENTATION /* Nokia: Issue 570: Use correct subframe for external orientations interpolation */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading lib_rend/ivas_rotation.c +88 −0 Original line number Diff line number Diff line Loading @@ -789,8 +789,10 @@ ivas_error ivas_combined_orientation_open( { ( *hCombinedOrientationData )->enableCombinedOrientation[i] = 0; ( *hCombinedOrientationData )->Quaternions[i] = identity; #ifndef FIX_570_SF_EXT_ORIENTATION ( *hCombinedOrientationData )->Quaternions_prev_headRot[i] = identity; ( *hCombinedOrientationData )->Quaternions_prev_extOrientation[i] = identity; #endif ( *hCombinedOrientationData )->listenerPos[i] = origo; for ( j = 0; j < 3; j++ ) Loading @@ -799,6 +801,11 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->Rmat[i][j][j] = 1.0f; } } #ifdef FIX_570_SF_EXT_ORIENTATION ( *hCombinedOrientationData )->Quaternion_prev_extOrientation = identity; ( *hCombinedOrientationData )->Quaternion_frozen_ext = identity; ( *hCombinedOrientationData )->Quaternion_frozen_head = identity; #endif for ( j = 0; j < 3; j++ ) { Loading @@ -811,6 +818,11 @@ ivas_error ivas_combined_orientation_open( set_zero( ( *hCombinedOrientationData )->procChEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( ( *hCombinedOrientationData )->procChEneIIR[1], MASA_FREQUENCY_BANDS ); #ifdef FIX_570_SF_EXT_ORIENTATION ( *hCombinedOrientationData )->isExtOrientationFrozen = 0; ( *hCombinedOrientationData )->isHeadRotationFrozen = 0; #endif return IVAS_ERR_OK; } Loading Loading @@ -981,6 +993,23 @@ static ivas_error combine_external_and_head_orientations( /* External orientations */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { #ifdef FIX_570_SF_EXT_ORIENTATION /* Check for frozen external orientation */ if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) { if ( hCombinedOrientationData->isExtOrientationFrozen != 1 ) { hCombinedOrientationData->Quaternion_frozen_ext = hExtOrientationData->Quaternions[i]; hCombinedOrientationData->isExtOrientationFrozen = 1; } } else { hCombinedOrientationData->Quaternion_frozen_ext = identity; hCombinedOrientationData->isExtOrientationFrozen = 0; } #endif if ( hExtOrientationData->enableRotationInterpolation[i] == 1 && hExtOrientationData->enableExternalOrientation[i] > 0 ) { if ( hCombinedOrientationData->isInterpolationOngoing == TRUE && hCombinedOrientationData->interpolationCoefficient <= 1.0f && are_orientations_same( &hCombinedOrientationData->Quaternions_ext_interpolation_target, &hExtOrientationData->Quaternions[i] ) == true ) Loading Loading @@ -1010,7 +1039,11 @@ static ivas_error combine_external_and_head_orientations( /* Use the freezed external orientation */ else if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) { #ifdef FIX_570_SF_EXT_ORIENTATION hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_ext; #else hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternions_prev_extOrientation[i]; #endif } } } Loading @@ -1021,6 +1054,22 @@ static ivas_error combine_external_and_head_orientations( /* Combine head and external orientations */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { #ifdef FIX_570_SF_EXT_ORIENTATION /* Check for frozen head rotation */ if ( hExtOrientationData->enableHeadRotation[i] == 2 && numHeadRotQuaternions >= 0 ) { if ( hCombinedOrientationData->isHeadRotationFrozen != 1 ) { hCombinedOrientationData->Quaternion_frozen_head = headRotQuaternions[i]; hCombinedOrientationData->isHeadRotationFrozen = 1; } } else { hCombinedOrientationData->Quaternion_frozen_head = identity; hCombinedOrientationData->isHeadRotationFrozen = 0; } #endif /* Use the most recent head rotation */ if ( hExtOrientationData->enableHeadRotation[i] == 1 && numHeadRotQuaternions >= 0 ) { Loading @@ -1038,11 +1087,19 @@ static ivas_error combine_external_and_head_orientations( { if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) { #ifdef FIX_570_SF_EXT_ORIENTATION QuaternionProduct( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Quaternion_frozen_head, &hCombinedOrientationData->Quaternions[i] ); #else QuaternionProduct( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Quaternions_prev_headRot[i], &hCombinedOrientationData->Quaternions[i] ); #endif } else { #ifdef FIX_570_SF_EXT_ORIENTATION hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_head; #else hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternions_prev_headRot[i]; #endif } } Loading @@ -1066,6 +1123,16 @@ static ivas_error combine_external_and_head_orientations( /* Save the current orientations */ if ( hExtOrientationData != NULL ) { #ifdef FIX_570_SF_EXT_ORIENTATION if ( hExtOrientationData->enableExternalOrientation[MAX_PARAM_SPATIAL_SUBFRAMES - 1] > 0 ) { hCombinedOrientationData->Quaternion_prev_extOrientation = hCombinedOrientationData->Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES - 1]; } else { hCombinedOrientationData->Quaternion_prev_extOrientation = identity; } #else for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) Loading @@ -1077,11 +1144,13 @@ static ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions_prev_extOrientation[i] = identity; } } #endif } if ( headRotQuaternions != NULL ) { for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { #ifndef FIX_570_SF_EXT_ORIENTATION if ( hExtOrientationData != NULL ) { if ( hExtOrientationData->enableHeadRotation[i] > 0 && numHeadRotQuaternions >= 0 ) Loading @@ -1104,6 +1173,7 @@ static ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions_prev_headRot[i] = identity; } } #endif hCombinedOrientationData->listenerPos[i] = listenerPos[i]; } } Loading Loading @@ -1189,7 +1259,25 @@ static void external_target_interpolation( hCombinedOrientationData->Quaternions_ext_interpolation_target = hExtOrientationData->Quaternions[i]; /* Use the most recent external orientation as the starting orientation */ #ifdef FIX_570_SF_EXT_ORIENTATION if ( hExtOrientationData->enableExternalOrientation[i] == 1 ) { if ( i > 0 ) { hCombinedOrientationData->Quaternions_ext_interpolation_start = hExtOrientationData->Quaternions[i - 1]; } else { hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_prev_extOrientation; } } else if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) { hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_frozen_ext; } #else hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternions_prev_extOrientation[i]; #endif /* Calculate the interpolation increment and coefficient */ hCombinedOrientationData->interpolationIncrement = 1.0f / ( (float) hExtOrientationData->numFramesToTargetOrientation[i] * (float) MAX_PARAM_SPATIAL_SUBFRAMES ); Loading lib_rend/ivas_stat_rend.h +8 −0 Original line number Diff line number Diff line Loading @@ -304,8 +304,12 @@ typedef struct ivas_combined_orientation_struct float lrSwitchInterpVal; bool isInterpolationOngoing; IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; #ifdef FIX_570_SF_EXT_ORIENTATION IVAS_QUATERNION Quaternion_prev_extOrientation; #else IVAS_QUATERNION Quaternions_prev_headRot[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_QUATERNION Quaternions_prev_extOrientation[MAX_PARAM_SPATIAL_SUBFRAMES]; #endif IVAS_QUATERNION Quaternions_ext_interpolation_start; IVAS_QUATERNION Quaternions_ext_interpolation_target; float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; Loading @@ -314,6 +318,10 @@ typedef struct ivas_combined_orientation_struct float procChEneIIR[2][MASA_FREQUENCY_BANDS]; int16_t shd_rot_max_order; IVAS_VECTOR3 listenerPos[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_QUATERNION Quaternion_frozen_ext; IVAS_QUATERNION Quaternion_frozen_head; int8_t isExtOrientationFrozen; int8_t isHeadRotationFrozen; } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; Loading Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ #define FIX_558_PLC_DISCONT /* FhG: issue 558: fix discontinuities in DFT Stereo when switching from TCX concealment to ACELP */ #define FIX_564 /* Nokia: Issue 564: Fix gains in JBM path for SBA with parametric binaural renderer */ #define FIX_566_2DIR_MASA_384K /* Nokia: Issued 566: Bugfix in 384k MASA metadata encoding of second direction */ #define FIX_570_SF_EXT_ORIENTATION /* Nokia: Issue 570: Use correct subframe for external orientations interpolation */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading
lib_rend/ivas_rotation.c +88 −0 Original line number Diff line number Diff line Loading @@ -789,8 +789,10 @@ ivas_error ivas_combined_orientation_open( { ( *hCombinedOrientationData )->enableCombinedOrientation[i] = 0; ( *hCombinedOrientationData )->Quaternions[i] = identity; #ifndef FIX_570_SF_EXT_ORIENTATION ( *hCombinedOrientationData )->Quaternions_prev_headRot[i] = identity; ( *hCombinedOrientationData )->Quaternions_prev_extOrientation[i] = identity; #endif ( *hCombinedOrientationData )->listenerPos[i] = origo; for ( j = 0; j < 3; j++ ) Loading @@ -799,6 +801,11 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->Rmat[i][j][j] = 1.0f; } } #ifdef FIX_570_SF_EXT_ORIENTATION ( *hCombinedOrientationData )->Quaternion_prev_extOrientation = identity; ( *hCombinedOrientationData )->Quaternion_frozen_ext = identity; ( *hCombinedOrientationData )->Quaternion_frozen_head = identity; #endif for ( j = 0; j < 3; j++ ) { Loading @@ -811,6 +818,11 @@ ivas_error ivas_combined_orientation_open( set_zero( ( *hCombinedOrientationData )->procChEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( ( *hCombinedOrientationData )->procChEneIIR[1], MASA_FREQUENCY_BANDS ); #ifdef FIX_570_SF_EXT_ORIENTATION ( *hCombinedOrientationData )->isExtOrientationFrozen = 0; ( *hCombinedOrientationData )->isHeadRotationFrozen = 0; #endif return IVAS_ERR_OK; } Loading Loading @@ -981,6 +993,23 @@ static ivas_error combine_external_and_head_orientations( /* External orientations */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { #ifdef FIX_570_SF_EXT_ORIENTATION /* Check for frozen external orientation */ if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) { if ( hCombinedOrientationData->isExtOrientationFrozen != 1 ) { hCombinedOrientationData->Quaternion_frozen_ext = hExtOrientationData->Quaternions[i]; hCombinedOrientationData->isExtOrientationFrozen = 1; } } else { hCombinedOrientationData->Quaternion_frozen_ext = identity; hCombinedOrientationData->isExtOrientationFrozen = 0; } #endif if ( hExtOrientationData->enableRotationInterpolation[i] == 1 && hExtOrientationData->enableExternalOrientation[i] > 0 ) { if ( hCombinedOrientationData->isInterpolationOngoing == TRUE && hCombinedOrientationData->interpolationCoefficient <= 1.0f && are_orientations_same( &hCombinedOrientationData->Quaternions_ext_interpolation_target, &hExtOrientationData->Quaternions[i] ) == true ) Loading Loading @@ -1010,7 +1039,11 @@ static ivas_error combine_external_and_head_orientations( /* Use the freezed external orientation */ else if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) { #ifdef FIX_570_SF_EXT_ORIENTATION hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_ext; #else hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternions_prev_extOrientation[i]; #endif } } } Loading @@ -1021,6 +1054,22 @@ static ivas_error combine_external_and_head_orientations( /* Combine head and external orientations */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { #ifdef FIX_570_SF_EXT_ORIENTATION /* Check for frozen head rotation */ if ( hExtOrientationData->enableHeadRotation[i] == 2 && numHeadRotQuaternions >= 0 ) { if ( hCombinedOrientationData->isHeadRotationFrozen != 1 ) { hCombinedOrientationData->Quaternion_frozen_head = headRotQuaternions[i]; hCombinedOrientationData->isHeadRotationFrozen = 1; } } else { hCombinedOrientationData->Quaternion_frozen_head = identity; hCombinedOrientationData->isHeadRotationFrozen = 0; } #endif /* Use the most recent head rotation */ if ( hExtOrientationData->enableHeadRotation[i] == 1 && numHeadRotQuaternions >= 0 ) { Loading @@ -1038,11 +1087,19 @@ static ivas_error combine_external_and_head_orientations( { if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) { #ifdef FIX_570_SF_EXT_ORIENTATION QuaternionProduct( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Quaternion_frozen_head, &hCombinedOrientationData->Quaternions[i] ); #else QuaternionProduct( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Quaternions_prev_headRot[i], &hCombinedOrientationData->Quaternions[i] ); #endif } else { #ifdef FIX_570_SF_EXT_ORIENTATION hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_head; #else hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternions_prev_headRot[i]; #endif } } Loading @@ -1066,6 +1123,16 @@ static ivas_error combine_external_and_head_orientations( /* Save the current orientations */ if ( hExtOrientationData != NULL ) { #ifdef FIX_570_SF_EXT_ORIENTATION if ( hExtOrientationData->enableExternalOrientation[MAX_PARAM_SPATIAL_SUBFRAMES - 1] > 0 ) { hCombinedOrientationData->Quaternion_prev_extOrientation = hCombinedOrientationData->Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES - 1]; } else { hCombinedOrientationData->Quaternion_prev_extOrientation = identity; } #else for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) Loading @@ -1077,11 +1144,13 @@ static ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions_prev_extOrientation[i] = identity; } } #endif } if ( headRotQuaternions != NULL ) { for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { #ifndef FIX_570_SF_EXT_ORIENTATION if ( hExtOrientationData != NULL ) { if ( hExtOrientationData->enableHeadRotation[i] > 0 && numHeadRotQuaternions >= 0 ) Loading @@ -1104,6 +1173,7 @@ static ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions_prev_headRot[i] = identity; } } #endif hCombinedOrientationData->listenerPos[i] = listenerPos[i]; } } Loading Loading @@ -1189,7 +1259,25 @@ static void external_target_interpolation( hCombinedOrientationData->Quaternions_ext_interpolation_target = hExtOrientationData->Quaternions[i]; /* Use the most recent external orientation as the starting orientation */ #ifdef FIX_570_SF_EXT_ORIENTATION if ( hExtOrientationData->enableExternalOrientation[i] == 1 ) { if ( i > 0 ) { hCombinedOrientationData->Quaternions_ext_interpolation_start = hExtOrientationData->Quaternions[i - 1]; } else { hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_prev_extOrientation; } } else if ( hExtOrientationData->enableExternalOrientation[i] == 2 ) { hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternion_frozen_ext; } #else hCombinedOrientationData->Quaternions_ext_interpolation_start = hCombinedOrientationData->Quaternions_prev_extOrientation[i]; #endif /* Calculate the interpolation increment and coefficient */ hCombinedOrientationData->interpolationIncrement = 1.0f / ( (float) hExtOrientationData->numFramesToTargetOrientation[i] * (float) MAX_PARAM_SPATIAL_SUBFRAMES ); Loading
lib_rend/ivas_stat_rend.h +8 −0 Original line number Diff line number Diff line Loading @@ -304,8 +304,12 @@ typedef struct ivas_combined_orientation_struct float lrSwitchInterpVal; bool isInterpolationOngoing; IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; #ifdef FIX_570_SF_EXT_ORIENTATION IVAS_QUATERNION Quaternion_prev_extOrientation; #else IVAS_QUATERNION Quaternions_prev_headRot[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_QUATERNION Quaternions_prev_extOrientation[MAX_PARAM_SPATIAL_SUBFRAMES]; #endif IVAS_QUATERNION Quaternions_ext_interpolation_start; IVAS_QUATERNION Quaternions_ext_interpolation_target; float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; Loading @@ -314,6 +318,10 @@ typedef struct ivas_combined_orientation_struct float procChEneIIR[2][MASA_FREQUENCY_BANDS]; int16_t shd_rot_max_order; IVAS_VECTOR3 listenerPos[MAX_PARAM_SPATIAL_SUBFRAMES]; IVAS_QUATERNION Quaternion_frozen_ext; IVAS_QUATERNION Quaternion_frozen_head; int8_t isExtOrientationFrozen; int8_t isHeadRotationFrozen; } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; Loading