Loading Workspace_msvc/lib_com.vcxproj +1 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,7 @@ <ClCompile Include="..\lib_com\ivas_mdct_imdct_fx.c" /> <ClCompile Include="..\lib_com\ivas_mdft_imdft_fx.c" /> <ClCompile Include="..\lib_com\ivas_omasa_com_fx.c" /> <ClCompile Include="..\lib_com\ivas_osba_com_fx.c" /> <ClCompile Include="..\lib_com\ivas_pca_tools_fx.c" /> <ClCompile Include="..\lib_com\ivas_qmetadata_com_fx.c" /> <ClCompile Include="..\lib_com\ivas_qspherical_com_fx.c" /> Loading Workspace_msvc/lib_com.vcxproj.filters +1 −0 Original line number Diff line number Diff line Loading @@ -512,6 +512,7 @@ <Filter>common_ivas_c</Filter> </ClCompile> <ClCompile Include="..\lib_com\ivas_rotation_com.c"> <ClCompile Include="..\lib_com\ivas_osba_com_fx.c"> <Filter>common_ivas_c</Filter> </ClCompile> </ItemGroup> Loading apps/decoder.c +257 −2 Original line number Diff line number Diff line Loading @@ -80,6 +80,18 @@ static * Local structure for storing cmdln arguments *------------------------------------------------------------------------------------------*/ #ifdef FIX_1053_REVERB_RECONFIGURATION typedef struct { uint16_t *pID; uint16_t *pValidity; uint16_t count; uint16_t selected; uint16_t frameCounter; } AcousticEnvironmentSequence; #endif typedef struct { char *inputBitstreamFilename; Loading Loading @@ -119,7 +131,11 @@ typedef struct IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; bool tsmEnabled; IVAS_RENDER_FRAMESIZE renderFramesize; #ifdef FIX_1053_REVERB_RECONFIGURATION AcousticEnvironmentSequence aeSequence; #else uint16_t acousticEnvironmentId; #endif int16_t Opt_dpid_on; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; Loading Loading @@ -383,9 +399,14 @@ int main( *------------------------------------------------------------------------------------------*/ asked_frame_size = arg.renderFramesize; #ifdef FIX_1053_REVERB_RECONFIGURATION uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx, arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx, arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -467,18 +488,30 @@ int main( goto cleanup; } #ifdef CONF_DISTATT if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK ) #else if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); goto cleanup; } #ifndef CONF_DISTATT FOR( Word16 i = 0; i < 4; i++ ) { renderConfig.directivity_fx[i * 3] = (Word16) ( renderConfig.directivity[i * 3] * ( 1u << 6 ) ); renderConfig.directivity_fx[i * 3 + 1] = (Word16) ( renderConfig.directivity[i * 3 + 1] * ( 1u << 6 ) ); renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( ( 1u << 15 ) - 1 ) ); } #endif #ifdef CONF_DISTATT if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt_fx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get Distance Attenuation \n\n" ); goto cleanup; } #endif if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Loading Loading @@ -507,7 +540,11 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef FIX_1053_REVERB_RECONFIGURATION if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #else if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #endif { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { Loading @@ -517,7 +554,11 @@ int main( } else { #ifdef FIX_1053_REVERB_RECONFIGURATION fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); #else fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId ); #endif goto cleanup; } renderConfig.roomAcoustics.override = true; Loading Loading @@ -715,6 +756,14 @@ cleanup: free( pcmBuf ); #ifdef FIX_1053_REVERB_RECONFIGURATION if ( arg.aeSequence.count > 0 ) { free( arg.aeSequence.pID ); free( arg.aeSequence.pValidity ); } #endif if ( arg.hrtfReaderEnabled ) { IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); Loading Loading @@ -904,7 +953,15 @@ static bool parseCmdlIVAS_dec( arg->non_diegetic_pan_gain = 0.f; arg->tsmEnabled = false; arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; #ifdef FIX_1053_REVERB_RECONFIGURATION arg->aeSequence.count = 0; arg->aeSequence.pID = NULL; arg->aeSequence.pValidity = NULL; arg->aeSequence.selected = 0; arg->aeSequence.frameCounter = 0; #else arg->acousticEnvironmentId = 65535; #endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { arg->directivityPatternId[i] = 65535; Loading Loading @@ -1226,11 +1283,90 @@ static bool parseCmdlIVAS_dec( if ( !is_digits_only( argv[i] ) ) { #ifdef FIX_1053_REVERB_RECONFIGURATION uint16_t k; char *s = argv[i]; char *token = argv[i]; for ( k = 0; s[k]; ) { s[k] == ',' ? k++ : *s++; } k++; if ( k == 0 ) { fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", argv[i] ); usage_dec(); return false; } if ( NULL == ( arg->aeSequence.pID = malloc( sizeof( uint16_t ) * k ) ) || NULL == ( arg->aeSequence.pValidity = malloc( sizeof( uint16_t ) * k ) ) ) { fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", argv[i] ); usage_dec(); return false; } arg->aeSequence.count = k; k = 0; token = strtok( argv[i++], ":" ); while ( token != NULL ) { if ( !is_number( token ) ) { fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] ); usage_dec(); return false; } arg->aeSequence.pID[k] = (uint16_t) atoi( token ); token = strtok( NULL, "," ); if ( !is_number( token ) ) { fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] ); usage_dec(); return false; } arg->aeSequence.pValidity[k] = (uint16_t) atoi( token ); token = strtok( NULL, ":" ); k++; } if ( k != arg->aeSequence.count ) { fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", argv[i] ); usage_dec(); return false; } #else fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] ); usage_dec(); return false; #endif } #ifdef FIX_1053_REVERB_RECONFIGURATION else { /* A single acoustic environment */ if ( NULL == ( arg->aeSequence.pID = malloc( sizeof( uint16_t ) ) ) || NULL == ( arg->aeSequence.pValidity = malloc( sizeof( uint16_t ) ) ) ) { fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", argv[i] ); usage_dec(); return false; } arg->aeSequence.count = 1; arg->aeSequence.pID[0] = (int16_t) atoi( argv[i++] ); arg->aeSequence.pValidity[0] = 0; } #else arg->acousticEnvironmentId = (int16_t) atoi( argv[i++] ); #endif } else if ( strcmp( argv_to_upper, "-DPID" ) == 0 ) { Loading Loading @@ -1454,7 +1590,15 @@ static void usage_dec( void ) fprintf( stdout, " output configuration. ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\n" ); fprintf( stdout, " ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" ); fprintf( stdout, " otherwise a default directivity pattern is used.\n" ); #ifdef FIX_1053_REVERB_RECONFIGURATION fprintf( stdout, "-aeid ID : Acoustic environment ID (number > 0) or\n" ); fprintf( stdout, " a sequence thereof in the format [ID1:duration1,ID2:duration2...]\n" ); fprintf( stdout, " without braces and spaces, with ':' character separating ID from duration and ',' separating\n" ); fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); #else fprintf( stdout, "-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" ); #endif 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" ); fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); Loading Loading @@ -1717,7 +1861,12 @@ static ivas_error initOnFirstGoodFrame( for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) #else if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); return error; Loading Loading @@ -1793,6 +1942,32 @@ static ivas_error decodeG192( int16_t vec_pos_update, vec_pos_len; SplitFileReadWrite *splitRendWriter = NULL; #ifdef FIX_1053_REVERB_RECONFIGURATION IVAS_RENDER_CONFIG_DATA renderConfig; RenderConfigReader *renderConfigReader = NULL; if ( arg.renderConfigEnabled ) { if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename ); goto cleanup; } if ( ( error = IVAS_DEC_GetRenderConfig( hIvasDec, &renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); goto cleanup; } } #endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { ismWriters[i] = NULL; Loading Loading @@ -1959,6 +2134,38 @@ static ivas_error decodeG192( { if ( needNewFrame ) { #ifdef FIX_1053_REVERB_RECONFIGURATION if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL && arg.aeSequence.count > 0 && arg.aeSequence.pValidity[arg.aeSequence.selected] != 0 ) { if ( ++arg.aeSequence.frameCounter >= arg.aeSequence.pValidity[arg.aeSequence.selected] ) { if ( ++arg.aeSequence.selected >= arg.aeSequence.count ) { arg.aeSequence.selected = 0; } arg.aeSequence.frameCounter = 0; if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" ); goto cleanup; } } else { fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] ); goto cleanup; } if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } } #endif if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK ) { if ( error == IVAS_ERR_END_OF_FILE ) Loading Loading @@ -2101,13 +2308,28 @@ static ivas_error decodeG192( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; /* delayNumSamples is zeroed, and delayNumSamples_orig is updated only on first good frame, so need to re-fetch delay info */ if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } #endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) #else if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; Loading Loading @@ -2233,13 +2455,27 @@ static ivas_error decodeG192( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } #endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) #else if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; Loading Loading @@ -2317,6 +2553,10 @@ static ivas_error decodeG192( cleanup: #ifdef FIX_1053_REVERB_RECONFIGURATION RenderConfigReader_close( &renderConfigReader ); #endif split_rend_reader_writer_close( &splitRendWriter ); AudioFileWriter_close( &afWriter ); MasaFileWriter_close( &masaWriter ); Loading Loading @@ -2785,13 +3025,28 @@ static ivas_error decodeVoIP( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; /* delayNumSamples_orig is fetched only for the first good frame, but here the delay can change between frames, so need to re-fetch */ if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } #endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) #else if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; Loading apps/renderer.c +182 −2 File changed.Preview size limit exceeded, changes collapsed. Show changes lib_com/basop_util.c +0 −4 Original line number Diff line number Diff line Loading @@ -1408,11 +1408,7 @@ Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, Word32 y, Word16 *s ) *s = 0; return ( (Word32) 0 ); } #ifdef FIX_USAN_BASOP_UTIL_DIVIDE3232 IF( EQ_32( y, (Word32) 0x80000000 ) ) #else IF( EQ_32( y, 0x80000000 ) ) #endif { /* Division by -1.0: same as negation of numerator */ /* Return normalized negated numerator */ Loading Loading
Workspace_msvc/lib_com.vcxproj +1 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,7 @@ <ClCompile Include="..\lib_com\ivas_mdct_imdct_fx.c" /> <ClCompile Include="..\lib_com\ivas_mdft_imdft_fx.c" /> <ClCompile Include="..\lib_com\ivas_omasa_com_fx.c" /> <ClCompile Include="..\lib_com\ivas_osba_com_fx.c" /> <ClCompile Include="..\lib_com\ivas_pca_tools_fx.c" /> <ClCompile Include="..\lib_com\ivas_qmetadata_com_fx.c" /> <ClCompile Include="..\lib_com\ivas_qspherical_com_fx.c" /> Loading
Workspace_msvc/lib_com.vcxproj.filters +1 −0 Original line number Diff line number Diff line Loading @@ -512,6 +512,7 @@ <Filter>common_ivas_c</Filter> </ClCompile> <ClCompile Include="..\lib_com\ivas_rotation_com.c"> <ClCompile Include="..\lib_com\ivas_osba_com_fx.c"> <Filter>common_ivas_c</Filter> </ClCompile> </ItemGroup> Loading
apps/decoder.c +257 −2 Original line number Diff line number Diff line Loading @@ -80,6 +80,18 @@ static * Local structure for storing cmdln arguments *------------------------------------------------------------------------------------------*/ #ifdef FIX_1053_REVERB_RECONFIGURATION typedef struct { uint16_t *pID; uint16_t *pValidity; uint16_t count; uint16_t selected; uint16_t frameCounter; } AcousticEnvironmentSequence; #endif typedef struct { char *inputBitstreamFilename; Loading Loading @@ -119,7 +131,11 @@ typedef struct IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; bool tsmEnabled; IVAS_RENDER_FRAMESIZE renderFramesize; #ifdef FIX_1053_REVERB_RECONFIGURATION AcousticEnvironmentSequence aeSequence; #else uint16_t acousticEnvironmentId; #endif int16_t Opt_dpid_on; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; Loading Loading @@ -383,9 +399,14 @@ int main( *------------------------------------------------------------------------------------------*/ asked_frame_size = arg.renderFramesize; #ifdef FIX_1053_REVERB_RECONFIGURATION uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx, arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx, arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -467,18 +488,30 @@ int main( goto cleanup; } #ifdef CONF_DISTATT if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK ) #else if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); goto cleanup; } #ifndef CONF_DISTATT FOR( Word16 i = 0; i < 4; i++ ) { renderConfig.directivity_fx[i * 3] = (Word16) ( renderConfig.directivity[i * 3] * ( 1u << 6 ) ); renderConfig.directivity_fx[i * 3 + 1] = (Word16) ( renderConfig.directivity[i * 3 + 1] * ( 1u << 6 ) ); renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( ( 1u << 15 ) - 1 ) ); } #endif #ifdef CONF_DISTATT if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt_fx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get Distance Attenuation \n\n" ); goto cleanup; } #endif if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Loading Loading @@ -507,7 +540,11 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef FIX_1053_REVERB_RECONFIGURATION if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #else if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #endif { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { Loading @@ -517,7 +554,11 @@ int main( } else { #ifdef FIX_1053_REVERB_RECONFIGURATION fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); #else fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId ); #endif goto cleanup; } renderConfig.roomAcoustics.override = true; Loading Loading @@ -715,6 +756,14 @@ cleanup: free( pcmBuf ); #ifdef FIX_1053_REVERB_RECONFIGURATION if ( arg.aeSequence.count > 0 ) { free( arg.aeSequence.pID ); free( arg.aeSequence.pValidity ); } #endif if ( arg.hrtfReaderEnabled ) { IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); Loading Loading @@ -904,7 +953,15 @@ static bool parseCmdlIVAS_dec( arg->non_diegetic_pan_gain = 0.f; arg->tsmEnabled = false; arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; #ifdef FIX_1053_REVERB_RECONFIGURATION arg->aeSequence.count = 0; arg->aeSequence.pID = NULL; arg->aeSequence.pValidity = NULL; arg->aeSequence.selected = 0; arg->aeSequence.frameCounter = 0; #else arg->acousticEnvironmentId = 65535; #endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { arg->directivityPatternId[i] = 65535; Loading Loading @@ -1226,11 +1283,90 @@ static bool parseCmdlIVAS_dec( if ( !is_digits_only( argv[i] ) ) { #ifdef FIX_1053_REVERB_RECONFIGURATION uint16_t k; char *s = argv[i]; char *token = argv[i]; for ( k = 0; s[k]; ) { s[k] == ',' ? k++ : *s++; } k++; if ( k == 0 ) { fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", argv[i] ); usage_dec(); return false; } if ( NULL == ( arg->aeSequence.pID = malloc( sizeof( uint16_t ) * k ) ) || NULL == ( arg->aeSequence.pValidity = malloc( sizeof( uint16_t ) * k ) ) ) { fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", argv[i] ); usage_dec(); return false; } arg->aeSequence.count = k; k = 0; token = strtok( argv[i++], ":" ); while ( token != NULL ) { if ( !is_number( token ) ) { fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] ); usage_dec(); return false; } arg->aeSequence.pID[k] = (uint16_t) atoi( token ); token = strtok( NULL, "," ); if ( !is_number( token ) ) { fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] ); usage_dec(); return false; } arg->aeSequence.pValidity[k] = (uint16_t) atoi( token ); token = strtok( NULL, ":" ); k++; } if ( k != arg->aeSequence.count ) { fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", argv[i] ); usage_dec(); return false; } #else fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] ); usage_dec(); return false; #endif } #ifdef FIX_1053_REVERB_RECONFIGURATION else { /* A single acoustic environment */ if ( NULL == ( arg->aeSequence.pID = malloc( sizeof( uint16_t ) ) ) || NULL == ( arg->aeSequence.pValidity = malloc( sizeof( uint16_t ) ) ) ) { fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", argv[i] ); usage_dec(); return false; } arg->aeSequence.count = 1; arg->aeSequence.pID[0] = (int16_t) atoi( argv[i++] ); arg->aeSequence.pValidity[0] = 0; } #else arg->acousticEnvironmentId = (int16_t) atoi( argv[i++] ); #endif } else if ( strcmp( argv_to_upper, "-DPID" ) == 0 ) { Loading Loading @@ -1454,7 +1590,15 @@ static void usage_dec( void ) fprintf( stdout, " output configuration. ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\n" ); fprintf( stdout, " ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" ); fprintf( stdout, " otherwise a default directivity pattern is used.\n" ); #ifdef FIX_1053_REVERB_RECONFIGURATION fprintf( stdout, "-aeid ID : Acoustic environment ID (number > 0) or\n" ); fprintf( stdout, " a sequence thereof in the format [ID1:duration1,ID2:duration2...]\n" ); fprintf( stdout, " without braces and spaces, with ':' character separating ID from duration and ',' separating\n" ); fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); #else fprintf( stdout, "-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" ); #endif 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" ); fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); Loading Loading @@ -1717,7 +1861,12 @@ static ivas_error initOnFirstGoodFrame( for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) #else if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); return error; Loading Loading @@ -1793,6 +1942,32 @@ static ivas_error decodeG192( int16_t vec_pos_update, vec_pos_len; SplitFileReadWrite *splitRendWriter = NULL; #ifdef FIX_1053_REVERB_RECONFIGURATION IVAS_RENDER_CONFIG_DATA renderConfig; RenderConfigReader *renderConfigReader = NULL; if ( arg.renderConfigEnabled ) { if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename ); goto cleanup; } if ( ( error = IVAS_DEC_GetRenderConfig( hIvasDec, &renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); goto cleanup; } } #endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { ismWriters[i] = NULL; Loading Loading @@ -1959,6 +2134,38 @@ static ivas_error decodeG192( { if ( needNewFrame ) { #ifdef FIX_1053_REVERB_RECONFIGURATION if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL && arg.aeSequence.count > 0 && arg.aeSequence.pValidity[arg.aeSequence.selected] != 0 ) { if ( ++arg.aeSequence.frameCounter >= arg.aeSequence.pValidity[arg.aeSequence.selected] ) { if ( ++arg.aeSequence.selected >= arg.aeSequence.count ) { arg.aeSequence.selected = 0; } arg.aeSequence.frameCounter = 0; if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" ); goto cleanup; } } else { fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] ); goto cleanup; } if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } } #endif if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK ) { if ( error == IVAS_ERR_END_OF_FILE ) Loading Loading @@ -2101,13 +2308,28 @@ static ivas_error decodeG192( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; /* delayNumSamples is zeroed, and delayNumSamples_orig is updated only on first good frame, so need to re-fetch delay info */ if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } #endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) #else if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; Loading Loading @@ -2233,13 +2455,27 @@ static ivas_error decodeG192( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } #endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) #else if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; Loading Loading @@ -2317,6 +2553,10 @@ static ivas_error decodeG192( cleanup: #ifdef FIX_1053_REVERB_RECONFIGURATION RenderConfigReader_close( &renderConfigReader ); #endif split_rend_reader_writer_close( &splitRendWriter ); AudioFileWriter_close( &afWriter ); MasaFileWriter_close( &masaWriter ); Loading Loading @@ -2785,13 +3025,28 @@ static ivas_error decodeVoIP( if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM ) { IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT int16_t fullDelayNumSamples[3]; float delayMs; /* delayNumSamples_orig is fetched only for the first good frame, but here the delay can change between frames, so need to re-fetch */ if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); } #endif if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale ); if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) #else if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; Loading
lib_com/basop_util.c +0 −4 Original line number Diff line number Diff line Loading @@ -1408,11 +1408,7 @@ Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, Word32 y, Word16 *s ) *s = 0; return ( (Word32) 0 ); } #ifdef FIX_USAN_BASOP_UTIL_DIVIDE3232 IF( EQ_32( y, (Word32) 0x80000000 ) ) #else IF( EQ_32( y, 0x80000000 ) ) #endif { /* Division by -1.0: same as negation of numerator */ /* Return normalized negated numerator */ Loading