Loading apps/decoder.c +38 −29 Original line number Diff line number Diff line Loading @@ -419,17 +419,28 @@ int main( } } #ifdef SPLIT_REND_WITH_HEAD_ROT /*------------------------------------------------------------------------------------------* * Configure the decoder * Binaural split rendering sanity checks *------------------------------------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { arg.enableHeadRotation = true; if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM && arg.outputMdFilename == NULL ) { fprintf( stderr, "\nError: split rendering metadata output file not specified.\n\n" ); usage_dec(); goto cleanup; } } #endif /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); Loading Loading @@ -1485,13 +1496,13 @@ static void usage_dec( void ) fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); fprintf( stdout, "-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' \n" ); fprintf( stdout, " or 'ref_vec_lev' (only for binaural rendering)\n" ); fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); fprintf( stdout, "-rf File : Reference rotation specified by external trajectory File\n" ); fprintf( stdout, " works only in combination with '-otr ref' mode \n" ); fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); fprintf( stdout, "-rvf File : Reference vector specified by external trajectory File\n" ); fprintf( stdout, " works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" ); fprintf( stdout, "-render_config File : Renderer configuration File\n" ); #ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stdout, "-om File : MD output file for BINAURAL_SPLIT_PCM output format\n" ); fprintf( stdout, "-om File : Metadata output File for BINAURAL_SPLIT_PCM OutputConf\n" ); #endif fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" ); fprintf( stdout, " left or l or 90->left, right or r or -90->right, center or c or 0->middle\n" ); Loading @@ -1507,7 +1518,7 @@ static void usage_dec( void ) fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); #endif fprintf( stdout, "-exof File : External orientation file for external orientation trajectory\n" ); fprintf( stdout, "-exof File : External orientation File for external orientation trajectory\n" ); #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK fprintf( stdout, "-info <folder> : specify subfolder name for debug output\n" ); Loading @@ -1533,6 +1544,13 @@ static int16_t app_own_random( int16_t *seed ) } #endif /*---------------------------------------------------------------------* * initOnFirstGoodFrame() * * *---------------------------------------------------------------------*/ static ivas_error initOnFirstGoodFrame( IVAS_DEC_HANDLE hIvasDec, /* i/o: */ const DecArguments arg, /* i : */ Loading Loading @@ -1590,36 +1608,28 @@ static ivas_error initOnFirstGoodFrame( } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { /* Open split rendering metadata writer */ int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ); if ( error != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); exit( -1 ); } *ppAfWriter = NULL; fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } else { if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); assert( arg.outputMdFilename != NULL ); error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ); if ( error != IVAS_ERR_OK ) if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); exit( -1 ); fprintf( stderr, "\nUnable to open split rend metadata file %s\n", arg.outputWavFilename ); return error; } } #endif if ( arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) { #endif /* Open audio writer and write all previously skipped bad frames now that frame size is known */ if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK ) { Loading @@ -1630,7 +1640,6 @@ static ivas_error initOnFirstGoodFrame( } #endif int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); Loading lib_rend/ivas_splitRend_lcld_dec.c +7 −3 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ ivas_error ivas_splitBinLCLDDecOpen( { int16_t n; BIN_HR_SPLIT_LCLD_DEC_HANDLE splitBinLCLDDec; ivas_error error; if ( ( splitBinLCLDDec = (BIN_HR_SPLIT_LCLD_DEC_HANDLE) malloc( sizeof( BIN_HR_SPLIT_LCLD_DEC ) ) ) == NULL ) { Loading Loading @@ -92,15 +93,18 @@ ivas_error ivas_splitBinLCLDDecOpen( char cldfbFilename[50] = "cldfb_out.bin"; if ( ( splitBinLCLDDec->cldfbOut = fopen( cldfbFilename, "wb" ) ) == NULL ) { fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); exit( -1 ); } int16_t num_bands = CLDFB_NO_CHANNELS_MAX; fwrite( &iChannels, sizeof( int16_t ), 1, splitBinLCLDDec->cldfbOut ); fwrite( &num_bands, sizeof( int16_t ), 1, splitBinLCLDDec->cldfbOut ); #endif ivas_splitBinRendPLCOpen( &splitBinLCLDDec->hSplitRendPLC ); if ( ( error = ivas_splitBinRendPLCOpen( &splitBinLCLDDec->hSplitRendPLC ) ) != IVAS_ERR_OK ) { return error; } *hSplitBinLCLDDec = splitBinLCLDDec; Loading lib_rend/ivas_splitRend_lcld_enc.c +1 −2 Original line number Diff line number Diff line Loading @@ -91,8 +91,7 @@ ivas_error ivas_splitBinLCLDEncOpen( char cldfbFilename[50] = "cldfb_in_ref.qmf"; if ( ( splitBinLCLDEnc->cldfbIn = fopen( cldfbFilename, "rb" ) ) == NULL ) { fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); exit( -1 ); } int16_t chan, band; Loading lib_rend/ivas_splitRendererPLC.c +1 −0 Original line number Diff line number Diff line Loading @@ -365,6 +365,7 @@ ivas_error ivas_splitBinRendPLCOpen( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for bin split renderer PLC Module \n" ) ); } hSplitRendPLC->prev_bfi = 0; hSplitRendPLC->bf_count = 0; set_zero( &hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[0][0][0], 2 * ( CLDFB_NO_COL_MAX + CLDFB_PLC_XF ) * CLDFB_NO_CHANNELS_MAX ); Loading lib_util/split_render_file_read_write.c +29 −13 Original line number Diff line number Diff line Loading @@ -74,12 +74,15 @@ ivas_error split_rend_reader_open( char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "MAIN_SPLITH"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ); if ( ( hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for split rendering writer\n" ) ); } hSplitRendFileReadWrite->file = fopen( filename, "rb" ); if ( hSplitRendFileReadWrite->file == NULL ) { fprintf( stderr, "Could not open split rend metadata file %s\n", filename ); exit( -1 ); return ( IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "\nCould not open split rend metadata file %s\n", filename ) ); } header_len = strlen( header ); Loading @@ -92,15 +95,16 @@ ivas_error split_rend_reader_open( return IVAS_ERR_FAILED_FILE_READ; } } if ( strncmp( header_read, header, header_len ) ) { fprintf( stderr, "Error split rend bitstream main header mismatch\n" ); return IVAS_ERR_FAILED_FILE_READ; return ( IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "\nError split rend bitstream main header mismatch\n" ) ); } fread( &hSplitRendFileReadWrite->delay_ns, sizeof( uint32_t ), 1, hSplitRendFileReadWrite->file ); *hhSplitRendFileReadWrite = hSplitRendFileReadWrite; return IVAS_ERR_OK; } Loading @@ -121,17 +125,25 @@ ivas_error split_rend_writer_open( size_t header_len, h; char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "MAIN_SPLITH"; hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ); if ( filename == NULL ) { return IVAS_ERR_FAILED_FILE_OPEN; } if ( ( hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for split rendering writer\n" ) ); } hSplitRendFileReadWrite->file = fopen( filename, "wb" ); if ( hSplitRendFileReadWrite->file == NULL ) { fprintf( stderr, "Could not open split rend metadata file %s\n", filename ); exit( -1 ); return IVAS_ERR_FAILED_FILE_OPEN; } header_len = strlen( header ); /*read frame header*/ /* write frame header */ for ( h = 0; h < header_len; h++ ) { if ( fwrite( &header[h], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 ) Loading @@ -143,6 +155,7 @@ ivas_error split_rend_writer_open( fwrite( &hSplitRendFileReadWrite->delay_ns, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ); *hhSplitRendFileReadWrite = hSplitRendFileReadWrite; return IVAS_ERR_OK; } Loading @@ -163,6 +176,7 @@ ivas_error split_rend_reader_writer_close( fclose( ( *hhSplitRendFileReadWrite )->file ); ( *hhSplitRendFileReadWrite )->file = NULL; } free( *hhSplitRendFileReadWrite ); *hhSplitRendFileReadWrite = NULL; } Loading Loading @@ -214,6 +228,7 @@ ivas_error split_rend_write_bitstream_to_file( { return IVAS_ERR_FAILED_FILE_WRITE; } /* Write pose correction signalling */ if ( fwrite( &poseCorrection, sizeof( poseCorrection ), 1, hSplitRendFileReadWrite->file ) != 1 ) { Loading Loading @@ -288,6 +303,7 @@ ivas_error split_rend_read_bits_from_file( { return IVAS_ERR_FAILED_FILE_READ; } /* read pose correction signalling */ if ( fread( poseCorrection, sizeof( *poseCorrection ), 1, hSplitRendFileReadWrite->file ) != 1 ) { Loading Loading
apps/decoder.c +38 −29 Original line number Diff line number Diff line Loading @@ -419,17 +419,28 @@ int main( } } #ifdef SPLIT_REND_WITH_HEAD_ROT /*------------------------------------------------------------------------------------------* * Configure the decoder * Binaural split rendering sanity checks *------------------------------------------------------------------------------------------*/ #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { arg.enableHeadRotation = true; if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM && arg.outputMdFilename == NULL ) { fprintf( stderr, "\nError: split rendering metadata output file not specified.\n\n" ); usage_dec(); goto cleanup; } } #endif /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); Loading Loading @@ -1485,13 +1496,13 @@ static void usage_dec( void ) fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); fprintf( stdout, "-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' \n" ); fprintf( stdout, " or 'ref_vec_lev' (only for binaural rendering)\n" ); fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); fprintf( stdout, "-rf File : Reference rotation specified by external trajectory File\n" ); fprintf( stdout, " works only in combination with '-otr ref' mode \n" ); fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); fprintf( stdout, "-rvf File : Reference vector specified by external trajectory File\n" ); fprintf( stdout, " works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" ); fprintf( stdout, "-render_config File : Renderer configuration File\n" ); #ifdef SPLIT_REND_WITH_HEAD_ROT fprintf( stdout, "-om File : MD output file for BINAURAL_SPLIT_PCM output format\n" ); fprintf( stdout, "-om File : Metadata output File for BINAURAL_SPLIT_PCM OutputConf\n" ); #endif fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" ); fprintf( stdout, " left or l or 90->left, right or r or -90->right, center or c or 0->middle\n" ); Loading @@ -1507,7 +1518,7 @@ static void usage_dec( void ) fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); #endif fprintf( stdout, "-exof File : External orientation file for external orientation trajectory\n" ); fprintf( stdout, "-exof File : External orientation File for external orientation trajectory\n" ); #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK fprintf( stdout, "-info <folder> : specify subfolder name for debug output\n" ); Loading @@ -1533,6 +1544,13 @@ static int16_t app_own_random( int16_t *seed ) } #endif /*---------------------------------------------------------------------* * initOnFirstGoodFrame() * * *---------------------------------------------------------------------*/ static ivas_error initOnFirstGoodFrame( IVAS_DEC_HANDLE hIvasDec, /* i/o: */ const DecArguments arg, /* i : */ Loading Loading @@ -1590,36 +1608,28 @@ static ivas_error initOnFirstGoodFrame( } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { /* Open split rendering metadata writer */ int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ); if ( error != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); exit( -1 ); } *ppAfWriter = NULL; fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } else { if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); assert( arg.outputMdFilename != NULL ); error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ); if ( error != IVAS_ERR_OK ) if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); exit( -1 ); fprintf( stderr, "\nUnable to open split rend metadata file %s\n", arg.outputWavFilename ); return error; } } #endif if ( arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) { #endif /* Open audio writer and write all previously skipped bad frames now that frame size is known */ if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK ) { Loading @@ -1630,7 +1640,6 @@ static ivas_error initOnFirstGoodFrame( } #endif int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); Loading
lib_rend/ivas_splitRend_lcld_dec.c +7 −3 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ ivas_error ivas_splitBinLCLDDecOpen( { int16_t n; BIN_HR_SPLIT_LCLD_DEC_HANDLE splitBinLCLDDec; ivas_error error; if ( ( splitBinLCLDDec = (BIN_HR_SPLIT_LCLD_DEC_HANDLE) malloc( sizeof( BIN_HR_SPLIT_LCLD_DEC ) ) ) == NULL ) { Loading Loading @@ -92,15 +93,18 @@ ivas_error ivas_splitBinLCLDDecOpen( char cldfbFilename[50] = "cldfb_out.bin"; if ( ( splitBinLCLDDec->cldfbOut = fopen( cldfbFilename, "wb" ) ) == NULL ) { fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); exit( -1 ); } int16_t num_bands = CLDFB_NO_CHANNELS_MAX; fwrite( &iChannels, sizeof( int16_t ), 1, splitBinLCLDDec->cldfbOut ); fwrite( &num_bands, sizeof( int16_t ), 1, splitBinLCLDDec->cldfbOut ); #endif ivas_splitBinRendPLCOpen( &splitBinLCLDDec->hSplitRendPLC ); if ( ( error = ivas_splitBinRendPLCOpen( &splitBinLCLDDec->hSplitRendPLC ) ) != IVAS_ERR_OK ) { return error; } *hSplitBinLCLDDec = splitBinLCLDDec; Loading
lib_rend/ivas_splitRend_lcld_enc.c +1 −2 Original line number Diff line number Diff line Loading @@ -91,8 +91,7 @@ ivas_error ivas_splitBinLCLDEncOpen( char cldfbFilename[50] = "cldfb_in_ref.qmf"; if ( ( splitBinLCLDEnc->cldfbIn = fopen( cldfbFilename, "rb" ) ) == NULL ) { fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); fprintf( stderr, "Error: CLDFB bitstream file %s could not be opened\n\n", cldfbFilename ); exit( -1 ); } int16_t chan, band; Loading
lib_rend/ivas_splitRendererPLC.c +1 −0 Original line number Diff line number Diff line Loading @@ -365,6 +365,7 @@ ivas_error ivas_splitBinRendPLCOpen( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for bin split renderer PLC Module \n" ) ); } hSplitRendPLC->prev_bfi = 0; hSplitRendPLC->bf_count = 0; set_zero( &hSplitRendPLC->CldfbPLC_state.Cldfb_Prev_BinReal[0][0][0], 2 * ( CLDFB_NO_COL_MAX + CLDFB_PLC_XF ) * CLDFB_NO_CHANNELS_MAX ); Loading
lib_util/split_render_file_read_write.c +29 −13 Original line number Diff line number Diff line Loading @@ -74,12 +74,15 @@ ivas_error split_rend_reader_open( char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "MAIN_SPLITH"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ); if ( ( hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for split rendering writer\n" ) ); } hSplitRendFileReadWrite->file = fopen( filename, "rb" ); if ( hSplitRendFileReadWrite->file == NULL ) { fprintf( stderr, "Could not open split rend metadata file %s\n", filename ); exit( -1 ); return ( IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "\nCould not open split rend metadata file %s\n", filename ) ); } header_len = strlen( header ); Loading @@ -92,15 +95,16 @@ ivas_error split_rend_reader_open( return IVAS_ERR_FAILED_FILE_READ; } } if ( strncmp( header_read, header, header_len ) ) { fprintf( stderr, "Error split rend bitstream main header mismatch\n" ); return IVAS_ERR_FAILED_FILE_READ; return ( IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "\nError split rend bitstream main header mismatch\n" ) ); } fread( &hSplitRendFileReadWrite->delay_ns, sizeof( uint32_t ), 1, hSplitRendFileReadWrite->file ); *hhSplitRendFileReadWrite = hSplitRendFileReadWrite; return IVAS_ERR_OK; } Loading @@ -121,17 +125,25 @@ ivas_error split_rend_writer_open( size_t header_len, h; char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "MAIN_SPLITH"; hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ); if ( filename == NULL ) { return IVAS_ERR_FAILED_FILE_OPEN; } if ( ( hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for split rendering writer\n" ) ); } hSplitRendFileReadWrite->file = fopen( filename, "wb" ); if ( hSplitRendFileReadWrite->file == NULL ) { fprintf( stderr, "Could not open split rend metadata file %s\n", filename ); exit( -1 ); return IVAS_ERR_FAILED_FILE_OPEN; } header_len = strlen( header ); /*read frame header*/ /* write frame header */ for ( h = 0; h < header_len; h++ ) { if ( fwrite( &header[h], sizeof( char ), 1, hSplitRendFileReadWrite->file ) != 1 ) Loading @@ -143,6 +155,7 @@ ivas_error split_rend_writer_open( fwrite( &hSplitRendFileReadWrite->delay_ns, sizeof( int32_t ), 1, hSplitRendFileReadWrite->file ); *hhSplitRendFileReadWrite = hSplitRendFileReadWrite; return IVAS_ERR_OK; } Loading @@ -163,6 +176,7 @@ ivas_error split_rend_reader_writer_close( fclose( ( *hhSplitRendFileReadWrite )->file ); ( *hhSplitRendFileReadWrite )->file = NULL; } free( *hhSplitRendFileReadWrite ); *hhSplitRendFileReadWrite = NULL; } Loading Loading @@ -214,6 +228,7 @@ ivas_error split_rend_write_bitstream_to_file( { return IVAS_ERR_FAILED_FILE_WRITE; } /* Write pose correction signalling */ if ( fwrite( &poseCorrection, sizeof( poseCorrection ), 1, hSplitRendFileReadWrite->file ) != 1 ) { Loading Loading @@ -288,6 +303,7 @@ ivas_error split_rend_read_bits_from_file( { return IVAS_ERR_FAILED_FILE_READ; } /* read pose correction signalling */ if ( fread( poseCorrection, sizeof( *poseCorrection ), 1, hSplitRendFileReadWrite->file ) != 1 ) { Loading