Loading apps/renderer.c +143 −27 Original line number Diff line number Diff line Loading @@ -157,6 +157,9 @@ typedef struct float lfeConfigElevation; bool lfeCustomRoutingEnabled; char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH]; #ifdef LIB_REND_API_5MS bool framing_5ms; #endif } CmdlnArgs; typedef enum Loading @@ -181,6 +184,9 @@ typedef enum CmdLnOptionId_inputGain, CmdLnOptionId_referenceVectorFile, CmdLnOptionId_exteriorOrientationFile, #ifdef LIB_REND_API_5MS CmdLnOptionId_framing5ms, #endif } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { Loading Loading @@ -302,6 +308,14 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "exof", .description = "External orientation trajectory file for simulation of external orientations", }, #ifdef LIB_REND_API_5MS { .id = CmdLnOptionId_framing5ms, .match = "framing_5ms", .matchShort = "fr5", .description = "Process audio with 5 ms framing. Time resolution of metadata (e.g. ISM positions) remains unchanged w.r.t. 20 ms framing", }, #endif }; Loading Loading @@ -560,7 +574,9 @@ int main( int32_t delayTimeScale = 0; int16_t i, numChannels; ivas_error error = IVAS_ERR_OK; #ifndef LIB_REND_API_5MS IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; #endif #ifdef WMOPS reset_wmops(); Loading Loading @@ -733,7 +749,13 @@ int main( fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); const int16_t frameSize_smpls = (int16_t) ( #ifdef LIB_REND_API_5MS ( args.framing_5ms ? 5 : 20 ) #else 20 #endif * args.sampleRate / 1000 ); IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 }; Loading Loading @@ -1019,10 +1041,17 @@ int main( fprintf( stdout, "\n\n-- Start the renderer (quiet mode) --\n\n" ); } #ifdef LIB_REND_API_5MS ObjectPositionBuffer mtdBuffer; #endif while ( 1 ) { int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; #ifdef LIB_REND_API_5MS const bool isCurrentFrameMultipleOf20ms = !args.framing_5ms || frame % 4 == 0; #endif /* Read the input data */ if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) Loading @@ -1040,8 +1069,12 @@ int main( /* Convert from int to float and from interleaved to packed */ convertInputBuffer( inpInt16Buffer, numSamplesRead, frameSize_smpls, num_in_channels, inFloatBuffer ); #ifdef LIB_REND_API_5MS if ( isCurrentFrameMultipleOf20ms ) { #else ObjectPositionBuffer mtdBuffer; #endif IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); if ( referenceVectorReader != NULL ) Loading Loading @@ -1074,10 +1107,41 @@ int main( exit( -1 ); } } #ifdef LIB_REND_API_5MS } #endif /* Read from head rotation trajectory file if specified */ if ( headRotReader != NULL ) { #ifdef LIB_REND_API_5MS IVAS_QUATERNION headRot; IVAS_VECTOR3 Pos; if ( ( error = HeadRotationFileReading( headRotReader, &headRot, &Pos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, headRot, Pos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } if ( !args.framing_5ms ) { /* Skip over 3 following head positions - they are given on 5ms grid */ for ( int16_t i = 0; i < 3; ++i ) { if ( ( error = HeadRotationFileReading( headRotReader, &headRot, &Pos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } } #else IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) Loading @@ -1093,20 +1157,61 @@ int main( fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } #endif } else { #ifdef LIB_REND_API_5MS if ( ( error = IVAS_REND_DisableHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error disabling head rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } #else error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ); if ( error != IVAS_ERR_OK && error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } #endif } /* Read from external orientation file if specified */ if ( externalOrientationFileReader != NULL ) { #ifdef LIB_REND_API_5MS IVAS_QUATERNION quat; int8_t enableHeadRotation; int8_t enableExternalOrientation; int8_t enableRotationInterpolation; int16_t numFramesToTargetOrientation; if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quat, &enableHeadRotation, &enableExternalOrientation, &enableRotationInterpolation, &numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in External Orientation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } if ( ( error = IVAS_REND_SetExternalOrientation( hIvasRend, &quat, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error setting External Orientation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } if ( !args.framing_5ms ) { /* Skip over 3 following entries in file - they are given on 5ms grid */ for ( int16_t i = 0; i < 3; ++i ) { if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quat, &enableHeadRotation, &enableExternalOrientation, &enableRotationInterpolation, &numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in External Orientation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } } #else IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; int8_t enableHeadRotation[RENDERER_HEAD_POSITIONS_PER_FRAME]; int8_t enableExternalOrientation[RENDERER_HEAD_POSITIONS_PER_FRAME]; Loading @@ -1127,6 +1232,7 @@ int main( fprintf( stderr, "Error setting External Orientation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } #endif } /* Combine external orientations and head rotation */ Loading Loading @@ -1281,6 +1387,7 @@ int main( delayNumSamples -= (int16_t) outBufferSize; } /* TODO(sgi): Masa output most likely broken with 5ms framing */ /* Write MASA metadata for MASA outputs */ if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) { Loading Loading @@ -1900,6 +2007,9 @@ static CmdlnArgs defaultArgs( args.lfeCustomRoutingEnabled = false; clearString( args.inLfePanningMatrixFile ); #ifdef LIB_REND_API_5MS args.framing_5ms = false; #endif return args; } Loading Loading @@ -2029,6 +2139,12 @@ static void parseOption( exit( -1 ); } break; #ifdef LIB_REND_API_5MS case CmdLnOptionId_framing5ms: assert( numOptionValues == 0 ); args->framing_5ms = false; break; #endif default: assert( 0 && "This should be unreachable - all command line options should be explicitly handled." ); break; Loading lib_com/common_api_types.h +2 −0 Original line number Diff line number Diff line Loading @@ -50,7 +50,9 @@ #define IVAS_CLDFB_NO_CHANNELS_MAX ( 60 ) #define IVAS_MAX_INPUT_LFE_CHANNELS 4 #ifndef LIB_REND_API_5MS #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 #endif /*----------------------------------------------------------------------------------* Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,7 @@ #define FIX_XXX_TDOBJRENDERER_INPUT #define FIX_XXX_ISM_SBA_ASAN #define API_5MS #define LIB_REND_API_5MS /* FhG: Adds 5ms framing capability to lib_rend */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading lib_rend/ivas_prot_rend.h +4 −0 Original line number Diff line number Diff line Loading @@ -857,7 +857,11 @@ ivas_error combine_external_and_head_orientations_rend( ); ivas_error combine_external_and_head_orientations( #ifdef LIB_REND_API_5MS IVAS_QUATERNION *headRotQuaternion, /* i : quaternion for head rotation */ #else IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ #endif IVAS_VECTOR3 *listenerPos, /* i : listener position */ #ifndef API_5MS int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ Loading lib_rend/ivas_rotation.c +69 −0 Original line number Diff line number Diff line Loading @@ -902,7 +902,11 @@ ivas_error combine_external_and_head_orientations_dec( #endif } #ifdef API_5MS #ifdef LIB_REND_API_5MS return combine_external_and_head_orientations( headRotQuaternions, listenerPos, hExtOrientationData, hCombinedOrientationData ); #else return combine_external_and_head_orientations( headRotQuaternions, listenerPos, hExtOrientationData, hCombinedOrientationData ); #endif #else return combine_external_and_head_orientations( headRotQuaternions, listenerPos, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); #endif Loading Loading @@ -932,8 +936,13 @@ ivas_error combine_external_and_head_orientations_rend( { if ( hHeadTrackData->headRotEnabled ) { #ifdef LIB_REND_API_5MS headRotQuaternions = &hHeadTrackData->headPosition; listenerPos = &hHeadTrackData->Pos; #else headRotQuaternions = hHeadTrackData->headPositions; listenerPos = hHeadTrackData->Pos; #endif } } else if ( hExtOrientationData != NULL ) Loading Loading @@ -971,7 +980,11 @@ ivas_error combine_external_and_head_orientations_rend( *------------------------------------------------------------------------*/ ivas_error combine_external_and_head_orientations( #ifdef LIB_REND_API_5MS IVAS_QUATERNION *headRotQuaternion, /* i : quaternion for head rotation */ #else IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ #endif IVAS_VECTOR3 *listenerPos, /* i : listener position */ #ifndef API_5MS int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ Loading @@ -994,7 +1007,11 @@ ivas_error combine_external_and_head_orientations( /* Form combined orientations or return if no data available */ if ( hCombinedOrientationData == NULL ) { #ifdef LIB_REND_API_5MS if ( headRotQuaternion != NULL || hExtOrientationData != NULL ) #else if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) #endif { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } Loading @@ -1003,7 +1020,11 @@ ivas_error combine_external_and_head_orientations( return IVAS_ERR_OK; } } #ifdef LIB_REND_API_5MS else if ( headRotQuaternion == NULL && hExtOrientationData == NULL ) #else else if ( headRotQuaternions == NULL && hExtOrientationData == NULL ) #endif { /* Reset the combined orientations and rotations */ hCombinedOrientationData->isInterpolationOngoing = FALSE; Loading Loading @@ -1037,11 +1058,19 @@ ivas_error combine_external_and_head_orientations( } #endif } #ifdef LIB_REND_API_5MS else if ( hExtOrientationData == NULL && headRotQuaternion != NULL ) #else else if ( hExtOrientationData == NULL && headRotQuaternions != NULL ) #endif { /* Head rotation only */ #ifdef API_5MS #ifdef LIB_REND_API_5MS hCombinedOrientationData->Quaternion = *headRotQuaternion; #else hCombinedOrientationData->Quaternion = *headRotQuaternions; #endif #else if ( numHeadRotQuaternions >= 0 ) Loading Loading @@ -1130,7 +1159,11 @@ ivas_error combine_external_and_head_orientations( #endif } #ifdef LIB_REND_API_5MS if ( hExtOrientationData != NULL && headRotQuaternion != NULL ) #else if ( hExtOrientationData != NULL && headRotQuaternions != NULL ) #endif { /* Combine head and external orientations */ #ifdef API_5MS Loading @@ -1140,11 +1173,19 @@ ivas_error combine_external_and_head_orientations( { if ( hExtOrientationData->enableExternalOrientation > 0 ) { #ifdef LIB_REND_API_5MS QuaternionProduct( hCombinedOrientationData->Quaternion, *headRotQuaternion, &hCombinedOrientationData->Quaternion ); #else QuaternionProduct( hCombinedOrientationData->Quaternion, *headRotQuaternions, &hCombinedOrientationData->Quaternion ); #endif } else { #ifdef LIB_REND_API_5MS hCombinedOrientationData->Quaternion = *headRotQuaternion; #else hCombinedOrientationData->Quaternion = *headRotQuaternions; #endif } } /* Use the freezed head rotation */ Loading Loading @@ -1203,7 +1244,11 @@ ivas_error combine_external_and_head_orientations( #endif } #ifdef LIB_REND_API_5MS if ( headRotQuaternion != NULL || hExtOrientationData != NULL ) #else if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) #endif { /* Calculate the combined rotation matrix */ #ifdef API_5MS Loading Loading @@ -1243,14 +1288,22 @@ ivas_error combine_external_and_head_orientations( } #endif } #ifdef LIB_REND_API_5MS if ( headRotQuaternion != NULL ) #else if ( headRotQuaternions != NULL ) #endif { #ifdef API_5MS if ( hExtOrientationData != NULL ) { if ( hExtOrientationData->enableHeadRotation > 0 ) { #ifdef LIB_REND_API_5MS hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternion; #else hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternions; #endif } else { Loading @@ -1259,7 +1312,11 @@ ivas_error combine_external_and_head_orientations( } else { #ifdef LIB_REND_API_5MS hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternion; #else hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternions; #endif } hCombinedOrientationData->listenerPos = *listenerPos; Loading Loading @@ -1294,7 +1351,11 @@ ivas_error combine_external_and_head_orientations( } /* Check if combined orientation is enabled */ #ifdef LIB_REND_API_5MS if ( headRotQuaternion != NULL && hExtOrientationData == NULL ) #else if ( headRotQuaternions != NULL && hExtOrientationData == NULL ) #endif { #ifdef API_5MS hCombinedOrientationData->enableCombinedOrientation = 1; Loading @@ -1313,7 +1374,11 @@ ivas_error combine_external_and_head_orientations( } #endif } #ifdef LIB_REND_API_5MS else if ( headRotQuaternion == NULL && hExtOrientationData != NULL ) #else else if ( headRotQuaternions == NULL && hExtOrientationData != NULL ) #endif { #ifdef API_5MS if ( hExtOrientationData->enableExternalOrientation > 0 ) Loading @@ -1338,7 +1403,11 @@ ivas_error combine_external_and_head_orientations( } #endif } #ifdef LIB_REND_API_5MS else if ( headRotQuaternion != NULL && hExtOrientationData != NULL ) #else else if ( headRotQuaternions != NULL && hExtOrientationData != NULL ) #endif { #ifdef API_5MS if ( hExtOrientationData->enableExternalOrientation > 0 || hExtOrientationData->enableHeadRotation > 0 ) Loading Loading
apps/renderer.c +143 −27 Original line number Diff line number Diff line Loading @@ -157,6 +157,9 @@ typedef struct float lfeConfigElevation; bool lfeCustomRoutingEnabled; char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH]; #ifdef LIB_REND_API_5MS bool framing_5ms; #endif } CmdlnArgs; typedef enum Loading @@ -181,6 +184,9 @@ typedef enum CmdLnOptionId_inputGain, CmdLnOptionId_referenceVectorFile, CmdLnOptionId_exteriorOrientationFile, #ifdef LIB_REND_API_5MS CmdLnOptionId_framing5ms, #endif } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { Loading Loading @@ -302,6 +308,14 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "exof", .description = "External orientation trajectory file for simulation of external orientations", }, #ifdef LIB_REND_API_5MS { .id = CmdLnOptionId_framing5ms, .match = "framing_5ms", .matchShort = "fr5", .description = "Process audio with 5 ms framing. Time resolution of metadata (e.g. ISM positions) remains unchanged w.r.t. 20 ms framing", }, #endif }; Loading Loading @@ -560,7 +574,9 @@ int main( int32_t delayTimeScale = 0; int16_t i, numChannels; ivas_error error = IVAS_ERR_OK; #ifndef LIB_REND_API_5MS IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; #endif #ifdef WMOPS reset_wmops(); Loading Loading @@ -733,7 +749,13 @@ int main( fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); const int16_t frameSize_smpls = (int16_t) ( #ifdef LIB_REND_API_5MS ( args.framing_5ms ? 5 : 20 ) #else 20 #endif * args.sampleRate / 1000 ); IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 }; Loading Loading @@ -1019,10 +1041,17 @@ int main( fprintf( stdout, "\n\n-- Start the renderer (quiet mode) --\n\n" ); } #ifdef LIB_REND_API_5MS ObjectPositionBuffer mtdBuffer; #endif while ( 1 ) { int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; #ifdef LIB_REND_API_5MS const bool isCurrentFrameMultipleOf20ms = !args.framing_5ms || frame % 4 == 0; #endif /* Read the input data */ if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) Loading @@ -1040,8 +1069,12 @@ int main( /* Convert from int to float and from interleaved to packed */ convertInputBuffer( inpInt16Buffer, numSamplesRead, frameSize_smpls, num_in_channels, inFloatBuffer ); #ifdef LIB_REND_API_5MS if ( isCurrentFrameMultipleOf20ms ) { #else ObjectPositionBuffer mtdBuffer; #endif IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); if ( referenceVectorReader != NULL ) Loading Loading @@ -1074,10 +1107,41 @@ int main( exit( -1 ); } } #ifdef LIB_REND_API_5MS } #endif /* Read from head rotation trajectory file if specified */ if ( headRotReader != NULL ) { #ifdef LIB_REND_API_5MS IVAS_QUATERNION headRot; IVAS_VECTOR3 Pos; if ( ( error = HeadRotationFileReading( headRotReader, &headRot, &Pos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, headRot, Pos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } if ( !args.framing_5ms ) { /* Skip over 3 following head positions - they are given on 5ms grid */ for ( int16_t i = 0; i < 3; ++i ) { if ( ( error = HeadRotationFileReading( headRotReader, &headRot, &Pos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } } #else IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) Loading @@ -1093,20 +1157,61 @@ int main( fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } #endif } else { #ifdef LIB_REND_API_5MS if ( ( error = IVAS_REND_DisableHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error disabling head rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } #else error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ); if ( error != IVAS_ERR_OK && error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) { fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } #endif } /* Read from external orientation file if specified */ if ( externalOrientationFileReader != NULL ) { #ifdef LIB_REND_API_5MS IVAS_QUATERNION quat; int8_t enableHeadRotation; int8_t enableExternalOrientation; int8_t enableRotationInterpolation; int16_t numFramesToTargetOrientation; if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quat, &enableHeadRotation, &enableExternalOrientation, &enableRotationInterpolation, &numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in External Orientation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } if ( ( error = IVAS_REND_SetExternalOrientation( hIvasRend, &quat, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error setting External Orientation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } if ( !args.framing_5ms ) { /* Skip over 3 following entries in file - they are given on 5ms grid */ for ( int16_t i = 0; i < 3; ++i ) { if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quat, &enableHeadRotation, &enableExternalOrientation, &enableRotationInterpolation, &numFramesToTargetOrientation ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error in External Orientation File Reading: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } } } #else IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; int8_t enableHeadRotation[RENDERER_HEAD_POSITIONS_PER_FRAME]; int8_t enableExternalOrientation[RENDERER_HEAD_POSITIONS_PER_FRAME]; Loading @@ -1127,6 +1232,7 @@ int main( fprintf( stderr, "Error setting External Orientation: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } #endif } /* Combine external orientations and head rotation */ Loading Loading @@ -1281,6 +1387,7 @@ int main( delayNumSamples -= (int16_t) outBufferSize; } /* TODO(sgi): Masa output most likely broken with 5ms framing */ /* Write MASA metadata for MASA outputs */ if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) { Loading Loading @@ -1900,6 +2007,9 @@ static CmdlnArgs defaultArgs( args.lfeCustomRoutingEnabled = false; clearString( args.inLfePanningMatrixFile ); #ifdef LIB_REND_API_5MS args.framing_5ms = false; #endif return args; } Loading Loading @@ -2029,6 +2139,12 @@ static void parseOption( exit( -1 ); } break; #ifdef LIB_REND_API_5MS case CmdLnOptionId_framing5ms: assert( numOptionValues == 0 ); args->framing_5ms = false; break; #endif default: assert( 0 && "This should be unreachable - all command line options should be explicitly handled." ); break; Loading
lib_com/common_api_types.h +2 −0 Original line number Diff line number Diff line Loading @@ -50,7 +50,9 @@ #define IVAS_CLDFB_NO_CHANNELS_MAX ( 60 ) #define IVAS_MAX_INPUT_LFE_CHANNELS 4 #ifndef LIB_REND_API_5MS #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 #endif /*----------------------------------------------------------------------------------* Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,7 @@ #define FIX_XXX_TDOBJRENDERER_INPUT #define FIX_XXX_ISM_SBA_ASAN #define API_5MS #define LIB_REND_API_5MS /* FhG: Adds 5ms framing capability to lib_rend */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading
lib_rend/ivas_prot_rend.h +4 −0 Original line number Diff line number Diff line Loading @@ -857,7 +857,11 @@ ivas_error combine_external_and_head_orientations_rend( ); ivas_error combine_external_and_head_orientations( #ifdef LIB_REND_API_5MS IVAS_QUATERNION *headRotQuaternion, /* i : quaternion for head rotation */ #else IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ #endif IVAS_VECTOR3 *listenerPos, /* i : listener position */ #ifndef API_5MS int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ Loading
lib_rend/ivas_rotation.c +69 −0 Original line number Diff line number Diff line Loading @@ -902,7 +902,11 @@ ivas_error combine_external_and_head_orientations_dec( #endif } #ifdef API_5MS #ifdef LIB_REND_API_5MS return combine_external_and_head_orientations( headRotQuaternions, listenerPos, hExtOrientationData, hCombinedOrientationData ); #else return combine_external_and_head_orientations( headRotQuaternions, listenerPos, hExtOrientationData, hCombinedOrientationData ); #endif #else return combine_external_and_head_orientations( headRotQuaternions, listenerPos, numHeadRotQuaternions, hExtOrientationData, hCombinedOrientationData ); #endif Loading Loading @@ -932,8 +936,13 @@ ivas_error combine_external_and_head_orientations_rend( { if ( hHeadTrackData->headRotEnabled ) { #ifdef LIB_REND_API_5MS headRotQuaternions = &hHeadTrackData->headPosition; listenerPos = &hHeadTrackData->Pos; #else headRotQuaternions = hHeadTrackData->headPositions; listenerPos = hHeadTrackData->Pos; #endif } } else if ( hExtOrientationData != NULL ) Loading Loading @@ -971,7 +980,11 @@ ivas_error combine_external_and_head_orientations_rend( *------------------------------------------------------------------------*/ ivas_error combine_external_and_head_orientations( #ifdef LIB_REND_API_5MS IVAS_QUATERNION *headRotQuaternion, /* i : quaternion for head rotation */ #else IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ #endif IVAS_VECTOR3 *listenerPos, /* i : listener position */ #ifndef API_5MS int16_t numHeadRotQuaternions, /* i : number of head rotation quaternions */ Loading @@ -994,7 +1007,11 @@ ivas_error combine_external_and_head_orientations( /* Form combined orientations or return if no data available */ if ( hCombinedOrientationData == NULL ) { #ifdef LIB_REND_API_5MS if ( headRotQuaternion != NULL || hExtOrientationData != NULL ) #else if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) #endif { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } Loading @@ -1003,7 +1020,11 @@ ivas_error combine_external_and_head_orientations( return IVAS_ERR_OK; } } #ifdef LIB_REND_API_5MS else if ( headRotQuaternion == NULL && hExtOrientationData == NULL ) #else else if ( headRotQuaternions == NULL && hExtOrientationData == NULL ) #endif { /* Reset the combined orientations and rotations */ hCombinedOrientationData->isInterpolationOngoing = FALSE; Loading Loading @@ -1037,11 +1058,19 @@ ivas_error combine_external_and_head_orientations( } #endif } #ifdef LIB_REND_API_5MS else if ( hExtOrientationData == NULL && headRotQuaternion != NULL ) #else else if ( hExtOrientationData == NULL && headRotQuaternions != NULL ) #endif { /* Head rotation only */ #ifdef API_5MS #ifdef LIB_REND_API_5MS hCombinedOrientationData->Quaternion = *headRotQuaternion; #else hCombinedOrientationData->Quaternion = *headRotQuaternions; #endif #else if ( numHeadRotQuaternions >= 0 ) Loading Loading @@ -1130,7 +1159,11 @@ ivas_error combine_external_and_head_orientations( #endif } #ifdef LIB_REND_API_5MS if ( hExtOrientationData != NULL && headRotQuaternion != NULL ) #else if ( hExtOrientationData != NULL && headRotQuaternions != NULL ) #endif { /* Combine head and external orientations */ #ifdef API_5MS Loading @@ -1140,11 +1173,19 @@ ivas_error combine_external_and_head_orientations( { if ( hExtOrientationData->enableExternalOrientation > 0 ) { #ifdef LIB_REND_API_5MS QuaternionProduct( hCombinedOrientationData->Quaternion, *headRotQuaternion, &hCombinedOrientationData->Quaternion ); #else QuaternionProduct( hCombinedOrientationData->Quaternion, *headRotQuaternions, &hCombinedOrientationData->Quaternion ); #endif } else { #ifdef LIB_REND_API_5MS hCombinedOrientationData->Quaternion = *headRotQuaternion; #else hCombinedOrientationData->Quaternion = *headRotQuaternions; #endif } } /* Use the freezed head rotation */ Loading Loading @@ -1203,7 +1244,11 @@ ivas_error combine_external_and_head_orientations( #endif } #ifdef LIB_REND_API_5MS if ( headRotQuaternion != NULL || hExtOrientationData != NULL ) #else if ( headRotQuaternions != NULL || hExtOrientationData != NULL ) #endif { /* Calculate the combined rotation matrix */ #ifdef API_5MS Loading Loading @@ -1243,14 +1288,22 @@ ivas_error combine_external_and_head_orientations( } #endif } #ifdef LIB_REND_API_5MS if ( headRotQuaternion != NULL ) #else if ( headRotQuaternions != NULL ) #endif { #ifdef API_5MS if ( hExtOrientationData != NULL ) { if ( hExtOrientationData->enableHeadRotation > 0 ) { #ifdef LIB_REND_API_5MS hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternion; #else hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternions; #endif } else { Loading @@ -1259,7 +1312,11 @@ ivas_error combine_external_and_head_orientations( } else { #ifdef LIB_REND_API_5MS hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternion; #else hCombinedOrientationData->Quaternion_prev_headRot = *headRotQuaternions; #endif } hCombinedOrientationData->listenerPos = *listenerPos; Loading Loading @@ -1294,7 +1351,11 @@ ivas_error combine_external_and_head_orientations( } /* Check if combined orientation is enabled */ #ifdef LIB_REND_API_5MS if ( headRotQuaternion != NULL && hExtOrientationData == NULL ) #else if ( headRotQuaternions != NULL && hExtOrientationData == NULL ) #endif { #ifdef API_5MS hCombinedOrientationData->enableCombinedOrientation = 1; Loading @@ -1313,7 +1374,11 @@ ivas_error combine_external_and_head_orientations( } #endif } #ifdef LIB_REND_API_5MS else if ( headRotQuaternion == NULL && hExtOrientationData != NULL ) #else else if ( headRotQuaternions == NULL && hExtOrientationData != NULL ) #endif { #ifdef API_5MS if ( hExtOrientationData->enableExternalOrientation > 0 ) Loading @@ -1338,7 +1403,11 @@ ivas_error combine_external_and_head_orientations( } #endif } #ifdef LIB_REND_API_5MS else if ( headRotQuaternion != NULL && hExtOrientationData != NULL ) #else else if ( headRotQuaternions != NULL && hExtOrientationData != NULL ) #endif { #ifdef API_5MS if ( hExtOrientationData->enableExternalOrientation > 0 || hExtOrientationData->enableHeadRotation > 0 ) Loading