Loading apps/decoder.c +76 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,10 @@ typedef struct bool voipMode; bool enableHeadRotation; char *headrotTrajFileName; #ifdef FIX_I109_ORIENTATION_TRACKING bool enableReferenceRotation; char *refrotTrajFileName; #endif #ifdef SUPPORT_JBM_TRACEFILE char *jbmTraceFilename; #endif Loading Loading @@ -128,7 +132,11 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); #ifdef FIX_I109_ORIENTATION_TRACKING static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #endif static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); Loading @@ -154,6 +162,9 @@ int main( LsCustomFileReader *hLsCustomReader = NULL; hrtfFileReader *hrtfReader = NULL; HeadRotFileReader *headRotReader = NULL; #ifdef FIX_I109_ORIENTATION_TRACKING HeadRotFileReader *refRotReader = NULL; #endif ivas_error error = IVAS_ERR_UNKNOWN; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; RenderConfigReader *renderConfigReader = NULL; Loading Loading @@ -247,6 +258,20 @@ int main( } } #ifdef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------------------------* * Open reference rotation file *------------------------------------------------------------------------------------------*/ if ( arg.enableReferenceRotation ) { if ( ( error = HeadRotationFileReader_open( arg.refrotTrajFileName, &refRotReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open reference rotation file %s \n\n", arg.refrotTrajFileName ); goto cleanup; } } #endif /*------------------------------------------------------------------------------------------* * Open custom loudspeaker layout file *------------------------------------------------------------------------------------------*/ Loading Loading @@ -496,7 +521,11 @@ int main( } else { #ifdef FIX_I109_ORIENTATION_TRACKING error = decodeG192( arg, hBsReader, headRotReader, refRotReader, hIvasDec, pcmBuf ); #else error = decodeG192( arg, hBsReader, headRotReader, hIvasDec, pcmBuf ); #endif } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) Loading Loading @@ -548,6 +577,9 @@ cleanup: CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); HeadRotationFileReader_close( &headRotReader ); #ifdef FIX_I109_ORIENTATION_TRACKING HeadRotationFileReader_close( &refRotReader ); #endif RenderConfigReader_close( &renderConfigReader ); Loading Loading @@ -688,6 +720,8 @@ static bool parseCmdlIVAS_dec( arg->headrotTrajFileName = NULL; #ifdef FIX_I109_ORIENTATION_TRACKING arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; arg->enableReferenceRotation = false; arg->headrotTrajFileName = NULL; #else arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; #endif Loading Loading @@ -902,6 +936,23 @@ static bool parseCmdlIVAS_dec( } i += 2; } #ifdef FIX_I109_ORIENTATION_TRACKING else if ( strcmp( argv_to_upper, "-RF" ) == 0 ) { arg->enableReferenceRotation = true; i++; if ( argc - i <= 4 || argv[i][0] == '-' ) { fprintf( stderr, "Error: Reference rotation file name not specified!\n\n" ); usage_dec(); return false; } arg->refrotTrajFileName = argv[i]; i++; } #endif else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 ) { arg->renderConfigEnabled = true; Loading Loading @@ -1100,6 +1151,10 @@ static void usage_dec( void ) fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); #endif fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering)\n" ); #ifdef FIX_I109_ORIENTATION_TRACKING fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); fprintf( stdout, " works only in combination with -otr ref mode\n" ); #endif fprintf( stdout, "-render_config file : Renderer configuration file\n" ); fprintf( stdout, "-no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1,\n" ); fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); Loading Loading @@ -1295,6 +1350,9 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, #ifdef FIX_I109_ORIENTATION_TRACKING HeadRotFileReader *refRotReader, #endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) Loading Loading @@ -1412,6 +1470,24 @@ static ivas_error decodeG192( } } #ifdef FIX_I109_ORIENTATION_TRACKING /* Reference rotation */ if ( arg.enableReferenceRotation ) { IVAS_QUATERNION quaternion; if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); goto cleanup; } if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } #endif /* Run decoder for one frame (get rendered output) */ if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) { Loading lib_dec/lib_dec.c +29 −0 Original line number Diff line number Diff line Loading @@ -915,6 +915,35 @@ ivas_error IVAS_DEC_FeedHeadTrackData( return IVAS_ERR_OK; } #ifdef FIX_I109_ORIENTATION_TRACKING /*---------------------------------------------------------------------* * IVAS_DEC_FeedRefRotData( ) * * Feed the decoder with the reference rotation *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedRefRotData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION rotation /* i : reference rotation data */ ) { ivas_orient_trk_state_t *pOtr; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHeadTrackData || hIvasDec->st_ivas->hHeadTrackData->OrientationTracker ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } pOtr = hIvasDec->st_ivas->hHeadTrackData->OrientationTracker; pOtr->refRot.w = rotation.w; pOtr->refRot.x = rotation.x; pOtr->refRot.z = rotation.z; pOtr->refRot.y = rotation.y; return IVAS_ERR_OK; } #endif /*---------------------------------------------------------------------* * IVAS_DEC_FeedCustomLsData( ) Loading lib_dec/lib_dec.h +8 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,14 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_QUATERNION *orientation /* i : head-tracking data */ ); #ifdef FIX_I109_ORIENTATION_TRACKING /*! r: error code */ ivas_error IVAS_DEC_FeedRefRotData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION rotation /* i : reference rotation data */ ); #endif /*! r: error code */ ivas_error IVAS_DEC_VoIP_FeedFrame( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ Loading Loading
apps/decoder.c +76 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,10 @@ typedef struct bool voipMode; bool enableHeadRotation; char *headrotTrajFileName; #ifdef FIX_I109_ORIENTATION_TRACKING bool enableReferenceRotation; char *refrotTrajFileName; #endif #ifdef SUPPORT_JBM_TRACEFILE char *jbmTraceFilename; #endif Loading Loading @@ -128,7 +132,11 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); #ifdef FIX_I109_ORIENTATION_TRACKING static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #endif static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); Loading @@ -154,6 +162,9 @@ int main( LsCustomFileReader *hLsCustomReader = NULL; hrtfFileReader *hrtfReader = NULL; HeadRotFileReader *headRotReader = NULL; #ifdef FIX_I109_ORIENTATION_TRACKING HeadRotFileReader *refRotReader = NULL; #endif ivas_error error = IVAS_ERR_UNKNOWN; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; RenderConfigReader *renderConfigReader = NULL; Loading Loading @@ -247,6 +258,20 @@ int main( } } #ifdef FIX_I109_ORIENTATION_TRACKING /*------------------------------------------------------------------------------------------* * Open reference rotation file *------------------------------------------------------------------------------------------*/ if ( arg.enableReferenceRotation ) { if ( ( error = HeadRotationFileReader_open( arg.refrotTrajFileName, &refRotReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open reference rotation file %s \n\n", arg.refrotTrajFileName ); goto cleanup; } } #endif /*------------------------------------------------------------------------------------------* * Open custom loudspeaker layout file *------------------------------------------------------------------------------------------*/ Loading Loading @@ -496,7 +521,11 @@ int main( } else { #ifdef FIX_I109_ORIENTATION_TRACKING error = decodeG192( arg, hBsReader, headRotReader, refRotReader, hIvasDec, pcmBuf ); #else error = decodeG192( arg, hBsReader, headRotReader, hIvasDec, pcmBuf ); #endif } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) Loading Loading @@ -548,6 +577,9 @@ cleanup: CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); HeadRotationFileReader_close( &headRotReader ); #ifdef FIX_I109_ORIENTATION_TRACKING HeadRotationFileReader_close( &refRotReader ); #endif RenderConfigReader_close( &renderConfigReader ); Loading Loading @@ -688,6 +720,8 @@ static bool parseCmdlIVAS_dec( arg->headrotTrajFileName = NULL; #ifdef FIX_I109_ORIENTATION_TRACKING arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; arg->enableReferenceRotation = false; arg->headrotTrajFileName = NULL; #else arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; #endif Loading Loading @@ -902,6 +936,23 @@ static bool parseCmdlIVAS_dec( } i += 2; } #ifdef FIX_I109_ORIENTATION_TRACKING else if ( strcmp( argv_to_upper, "-RF" ) == 0 ) { arg->enableReferenceRotation = true; i++; if ( argc - i <= 4 || argv[i][0] == '-' ) { fprintf( stderr, "Error: Reference rotation file name not specified!\n\n" ); usage_dec(); return false; } arg->refrotTrajFileName = argv[i]; i++; } #endif else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 ) { arg->renderConfigEnabled = true; Loading Loading @@ -1100,6 +1151,10 @@ static void usage_dec( void ) fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); #endif fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering)\n" ); #ifdef FIX_I109_ORIENTATION_TRACKING fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); fprintf( stdout, " works only in combination with -otr ref mode\n" ); #endif fprintf( stdout, "-render_config file : Renderer configuration file\n" ); fprintf( stdout, "-no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1,\n" ); fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); Loading Loading @@ -1295,6 +1350,9 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, #ifdef FIX_I109_ORIENTATION_TRACKING HeadRotFileReader *refRotReader, #endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) Loading Loading @@ -1412,6 +1470,24 @@ static ivas_error decodeG192( } } #ifdef FIX_I109_ORIENTATION_TRACKING /* Reference rotation */ if ( arg.enableReferenceRotation ) { IVAS_QUATERNION quaternion; if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); goto cleanup; } if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } #endif /* Run decoder for one frame (get rendered output) */ if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) { Loading
lib_dec/lib_dec.c +29 −0 Original line number Diff line number Diff line Loading @@ -915,6 +915,35 @@ ivas_error IVAS_DEC_FeedHeadTrackData( return IVAS_ERR_OK; } #ifdef FIX_I109_ORIENTATION_TRACKING /*---------------------------------------------------------------------* * IVAS_DEC_FeedRefRotData( ) * * Feed the decoder with the reference rotation *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedRefRotData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION rotation /* i : reference rotation data */ ) { ivas_orient_trk_state_t *pOtr; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHeadTrackData || hIvasDec->st_ivas->hHeadTrackData->OrientationTracker ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } pOtr = hIvasDec->st_ivas->hHeadTrackData->OrientationTracker; pOtr->refRot.w = rotation.w; pOtr->refRot.x = rotation.x; pOtr->refRot.z = rotation.z; pOtr->refRot.y = rotation.y; return IVAS_ERR_OK; } #endif /*---------------------------------------------------------------------* * IVAS_DEC_FeedCustomLsData( ) Loading
lib_dec/lib_dec.h +8 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,14 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_QUATERNION *orientation /* i : head-tracking data */ ); #ifdef FIX_I109_ORIENTATION_TRACKING /*! r: error code */ ivas_error IVAS_DEC_FeedRefRotData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION rotation /* i : reference rotation data */ ); #endif /*! r: error code */ ivas_error IVAS_DEC_VoIP_FeedFrame( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ Loading