Loading Workspace_msvc/lib_util.vcxproj +2 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ <ClCompile Include="..\lib_util\masa_file_reader.c" /> <ClCompile Include="..\lib_util\masa_file_writer.c" /> <ClCompile Include="..\lib_util\mime_io.c" /> <ClCompile Include="..\lib_util\obj_edit_file_reader.c" /> <ClCompile Include="..\lib_util\render_config_reader.c" /> <ClCompile Include="..\lib_util\rotation_file_reader.c" /> <ClCompile Include="..\lib_util\rtpdump.c" /> Loading @@ -145,6 +146,7 @@ <ClInclude Include="..\lib_util\jbm_file_writer.h" /> <ClInclude Include="..\lib_util\ls_custom_file_reader.h" /> <ClInclude Include="..\lib_util\mime_io.h" /> <ClInclude Include="..\lib_util\obj_edit_file_reader.h" /> <ClInclude Include="..\lib_util\masa_file_reader.h" /> <ClInclude Include="..\lib_util\masa_file_writer.h" /> <ClInclude Include="..\lib_util\render_config_reader.h" /> Loading apps/decoder.c +191 −16 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ #include "lib_dec.h" #include <string.h> #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE #include <math.h> #endif #include "cmdl_tools.h" #include "audio_file_writer.h" #include "bitstream_reader.h" Loading @@ -47,6 +50,9 @@ #include "aeid_file_reader.h" #endif #include "split_render_file_read_write.h" #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE #include "obj_edit_file_reader.h" #endif #ifdef VARIABLE_SPEED_DECODING #include "tsm_scale_file_reader.h" #include <math.h> Loading Loading @@ -156,6 +162,9 @@ typedef struct #ifdef OBJ_EDITING_COMMANDLINE bool objEditEnabled; #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE char *objEditFileName; #endif } DecArguments; Loading Loading @@ -184,8 +193,13 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); #endif static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); Loading @@ -193,8 +207,12 @@ static int16_t app_own_random( int16_t *seed ); static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); #endif #ifdef OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); #else static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters ); #endif #endif /*------------------------------------------------------------------------------------------* Loading Loading @@ -226,6 +244,9 @@ int main( int16_t *pcmBuf = NULL; IVAS_RENDER_FRAMESIZE asked_frame_size; IVAS_DEC_HRTF_BINARY_WRAPPER hHrtfBinary; #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader = NULL; #endif #ifdef DEBUGGING int32_t noClipping; int32_t cnt_frames_limited; Loading Loading @@ -429,6 +450,21 @@ int main( } } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE /*------------------------------------------------------------------------------------------* * Open object editing instruction file *------------------------------------------------------------------------------------------*/ if ( arg.objEditFileName != NULL ) { if ( ( error = ObjectEditFileReader_open( arg.objEditFileName, &objectEditFileReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open Object editing instruction file %s \n\n", arg.objEditFileName ); goto cleanup; } } #endif /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ Loading Loading @@ -765,11 +801,19 @@ int main( if ( arg.voipMode ) { #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec ); #else error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); #endif } else { #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf ); #else error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf ); #endif } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) Loading Loading @@ -834,6 +878,9 @@ cleanup: RotationFileReader_close( &refRotReader ); Vector3PairFileReader_close( &referenceVectorReader ); RenderConfigReader_close( &renderConfigReader ); #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader_close( &objectEditFileReader ); #endif if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK ) { Loading Loading @@ -1034,6 +1081,9 @@ static bool parseCmdlIVAS_dec( #ifdef OBJ_EDITING_COMMANDLINE arg->objEditEnabled = false; #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE arg->objEditFileName = NULL; #endif /*-----------------------------------------------------------------* * Initialization Loading Loading @@ -1568,6 +1618,24 @@ static bool parseCmdlIVAS_dec( { arg->objEditEnabled = true; i++; #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( argc - i <= 3 || argv[i][0] == '-' ) { fprintf( stderr, "Error: Object editing instruction filename not specified!\n\n" ); usage_dec(); return false; } if ( strcmp( argv[i], "NULL" ) == 0 || strcmp( argv[i], "null" ) == 0 ) { arg->objEditFileName = NULL; /* use the built-in editing function */ } else { arg->objEditFileName = argv[i]; /* read edit instructions from this file */ } i++; #endif } #endif Loading Loading @@ -1751,7 +1819,7 @@ static void usage_dec( void ) 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" ); fprintf( stdout, "-om File : Metadata output File for BINAURAL_SPLIT_PCM OutputConf (only for Fs = 48 kHz)\n" ); fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" ); fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with panning 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" ); #ifdef DEBUGGING fprintf( stdout, "-FEC X : Insert frame erasures, X = 0-10 is the percentage\n" ); Loading @@ -1778,7 +1846,11 @@ static void usage_dec( void ) #endif fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); #ifdef OBJ_EDITING_COMMANDLINE #ifndef FIX_1217_OBJECT_EDIT_FILE_INTERFACE fprintf( stdout, "-obj_edit : Enable objects editing\n" ); #else fprintf( stdout, "-obj_edit File : Object editing instructions file or NULL for built-in example\n" ); #endif #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" ); Loading Loading @@ -2136,6 +2208,9 @@ static ivas_error decodeG192( RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader, #endif ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) Loading Loading @@ -2545,10 +2620,24 @@ static ivas_error decodeG192( return error; } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( arg.objEditFileName != NULL ) { if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not read object editing instructions from file: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); return error; } } #endif /* Do object metadata editing here ... */ #ifdef OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing( &editableParameters, objectEditFileReader ); #else do_object_editing( &editableParameters ); #endif #endif /* set new object parameters*/ Loading Loading @@ -3076,6 +3165,9 @@ static ivas_error decodeVoIP( RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader, #endif IVAS_DEC_HANDLE hIvasDec ) { bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ Loading Loading @@ -3356,6 +3448,17 @@ static ivas_error decodeVoIP( } } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( arg.objEditEnabled && ( arg.objEditFileName != NULL ) ) { if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not read object editing instructions from file: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); return error; } } #endif /* read all packets with a receive time smaller than the system time */ while ( nextPacketRcvTime_ms <= systemTime_ms ) { Loading Loading @@ -3466,7 +3569,11 @@ static ivas_error decodeVoIP( /* Do object metadata editing here ... */ #ifdef OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing( &editableParameters, objectEditFileReader ); #else do_object_editing( &editableParameters ); #endif #endif /* set new object parameters */ Loading Loading @@ -3776,7 +3883,12 @@ cleanup: *---------------------------------------------------------------------*/ static void do_object_editing( #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ) #else IVAS_EDITABLE_PARAMETERS *editableParameters ) #endif { /* put the objects equally spaced at the horizontal plane */ /* and play a little bit with the gains... */ Loading @@ -3792,6 +3904,66 @@ static void do_object_editing( } } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( objectEditFileReader != NULL ) { ReadObjectEditInfo *readInfo; readInfo = objectEditFileReader->readInfo; if ( readInfo->bg_gain_edited ) { editableParameters->gain_bed = readInfo->bg_gain; } for ( obj_idx = 0; obj_idx < editableParameters->num_obj; obj_idx++ ) { if ( !editableParameters->ism_metadata[obj_idx].non_diegetic_flag ) { /* object direction editing only for diegetic objects */ if ( readInfo->obj_azi_edited[obj_idx] ) { if ( readInfo->obj_azi_relative[obj_idx] ) { /* azimuth: apply relative edit + wrap */ editableParameters->ism_metadata[obj_idx].azimuth = fmodf( editableParameters->ism_metadata[obj_idx].azimuth + readInfo->obj_azi[obj_idx] + 540.f, 360.f ) - 180.f; } else { editableParameters->ism_metadata[obj_idx].azimuth = readInfo->obj_azi[obj_idx]; } } if ( readInfo->obj_ele_edited[obj_idx] ) { if ( readInfo->obj_ele_relative[obj_idx] ) { /* elevation: apply relative edit + saturation */ editableParameters->ism_metadata[obj_idx].elevation = fmaxf( fminf( editableParameters->ism_metadata[obj_idx].elevation + readInfo->obj_ele[obj_idx], 90.f ), -90.f ); } else { editableParameters->ism_metadata[obj_idx].elevation = readInfo->obj_ele[obj_idx]; } } } /* gain editing for all objects */ if ( readInfo->obj_gain_edited[obj_idx] ) { if ( readInfo->obj_gain_relative[obj_idx] ) { /* gain: apply relative edit + saturation */ editableParameters->ism_metadata[obj_idx].gain = fmaxf( fminf( editableParameters->ism_metadata[obj_idx].gain * readInfo->obj_gain[obj_idx], OBJ_EDIT_GAIN_MAX ), OBJ_EDIT_GAIN_MIN ); } else { editableParameters->ism_metadata[obj_idx].gain = readInfo->obj_gain[obj_idx]; } } } } else { #endif if ( num_nondiegetic_objects ) { float start_angle, angle_inc; Loading @@ -3815,6 +3987,9 @@ static void do_object_editing( } editableParameters->gain_bed = 0.5f; #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE } #endif return; Loading lib_com/ivas_error.h +7 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ typedef enum IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED, #ifdef OBJ_EDITING_API IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED, #endif IVAS_ERR_INVALID_HRTF, IVAS_ERR_INVALID_HRTF_SAMPLING_RATE, Loading Loading @@ -261,6 +264,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) #ifdef OBJ_EDITING_API case IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED: return "Objects editing not supported"; #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE case IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED: return "Wrong use of both Object editing and Non-diegetic panning"; #endif case IVAS_ERR_INVALID_HRTF: return "Unsupported HRTF filter set"; Loading lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -220,6 +220,8 @@ #define FIX_BRATE_SWITCHING /* VA: fix bitrate switching cases in OMASA and OSBA */ #define NONBE_1217_INIT_OBJ_EDIT /* VA: issue 1217: do object editing only when objects metadata is available */ #endif #define FIX_1217_OBJECT_EDIT_FILE_INTERFACE /* Nokia: issue #1217: add decoder functionality to read object edit instructions from a file */ #define NONBE_1217_OBJ_EDIT_FOA /* VA/Nokia: isse 1217: fix crash in object editing to FOA output in ParamISM */ /* #################### End BASOP porting switches ############################ */ Loading lib_dec/ivas_init_dec.c +8 −1 Original line number Diff line number Diff line Loading @@ -3259,10 +3259,17 @@ static ivas_error doSanityChecks_IVAS( if ( !( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) ) #endif { return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Wrong set-up: Obect editing is not supported in this IVAS format." ); return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Wrong set-up: Object editing is not supported in this IVAS format." ); } } #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( st_ivas->hDecoderConfig->Opt_ObjEdit_on && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) { return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED, "Wrong set-up: Only object editing or Non-diegetic panning can be used." ); } #endif #ifdef DEBUGGING if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || ( output_config != IVAS_AUDIO_CONFIG_BINAURAL && output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) { Loading Loading
Workspace_msvc/lib_util.vcxproj +2 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,7 @@ <ClCompile Include="..\lib_util\masa_file_reader.c" /> <ClCompile Include="..\lib_util\masa_file_writer.c" /> <ClCompile Include="..\lib_util\mime_io.c" /> <ClCompile Include="..\lib_util\obj_edit_file_reader.c" /> <ClCompile Include="..\lib_util\render_config_reader.c" /> <ClCompile Include="..\lib_util\rotation_file_reader.c" /> <ClCompile Include="..\lib_util\rtpdump.c" /> Loading @@ -145,6 +146,7 @@ <ClInclude Include="..\lib_util\jbm_file_writer.h" /> <ClInclude Include="..\lib_util\ls_custom_file_reader.h" /> <ClInclude Include="..\lib_util\mime_io.h" /> <ClInclude Include="..\lib_util\obj_edit_file_reader.h" /> <ClInclude Include="..\lib_util\masa_file_reader.h" /> <ClInclude Include="..\lib_util\masa_file_writer.h" /> <ClInclude Include="..\lib_util\render_config_reader.h" /> Loading
apps/decoder.c +191 −16 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ #include "lib_dec.h" #include <string.h> #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE #include <math.h> #endif #include "cmdl_tools.h" #include "audio_file_writer.h" #include "bitstream_reader.h" Loading @@ -47,6 +50,9 @@ #include "aeid_file_reader.h" #endif #include "split_render_file_read_write.h" #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE #include "obj_edit_file_reader.h" #endif #ifdef VARIABLE_SPEED_DECODING #include "tsm_scale_file_reader.h" #include <math.h> Loading Loading @@ -156,6 +162,9 @@ typedef struct #ifdef OBJ_EDITING_COMMANDLINE bool objEditEnabled; #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE char *objEditFileName; #endif } DecArguments; Loading Loading @@ -184,8 +193,13 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); #endif static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); Loading @@ -193,8 +207,12 @@ static int16_t app_own_random( int16_t *seed ); static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); #endif #ifdef OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); #else static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters ); #endif #endif /*------------------------------------------------------------------------------------------* Loading Loading @@ -226,6 +244,9 @@ int main( int16_t *pcmBuf = NULL; IVAS_RENDER_FRAMESIZE asked_frame_size; IVAS_DEC_HRTF_BINARY_WRAPPER hHrtfBinary; #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader = NULL; #endif #ifdef DEBUGGING int32_t noClipping; int32_t cnt_frames_limited; Loading Loading @@ -429,6 +450,21 @@ int main( } } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE /*------------------------------------------------------------------------------------------* * Open object editing instruction file *------------------------------------------------------------------------------------------*/ if ( arg.objEditFileName != NULL ) { if ( ( error = ObjectEditFileReader_open( arg.objEditFileName, &objectEditFileReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open Object editing instruction file %s \n\n", arg.objEditFileName ); goto cleanup; } } #endif /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ Loading Loading @@ -765,11 +801,19 @@ int main( if ( arg.voipMode ) { #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec ); #else error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); #endif } else { #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf ); #else error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf ); #endif } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) Loading Loading @@ -834,6 +878,9 @@ cleanup: RotationFileReader_close( &refRotReader ); Vector3PairFileReader_close( &referenceVectorReader ); RenderConfigReader_close( &renderConfigReader ); #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader_close( &objectEditFileReader ); #endif if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK ) { Loading Loading @@ -1034,6 +1081,9 @@ static bool parseCmdlIVAS_dec( #ifdef OBJ_EDITING_COMMANDLINE arg->objEditEnabled = false; #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE arg->objEditFileName = NULL; #endif /*-----------------------------------------------------------------* * Initialization Loading Loading @@ -1568,6 +1618,24 @@ static bool parseCmdlIVAS_dec( { arg->objEditEnabled = true; i++; #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( argc - i <= 3 || argv[i][0] == '-' ) { fprintf( stderr, "Error: Object editing instruction filename not specified!\n\n" ); usage_dec(); return false; } if ( strcmp( argv[i], "NULL" ) == 0 || strcmp( argv[i], "null" ) == 0 ) { arg->objEditFileName = NULL; /* use the built-in editing function */ } else { arg->objEditFileName = argv[i]; /* read edit instructions from this file */ } i++; #endif } #endif Loading Loading @@ -1751,7 +1819,7 @@ static void usage_dec( void ) 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" ); fprintf( stdout, "-om File : Metadata output File for BINAURAL_SPLIT_PCM OutputConf (only for Fs = 48 kHz)\n" ); fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" ); fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with panning 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" ); #ifdef DEBUGGING fprintf( stdout, "-FEC X : Insert frame erasures, X = 0-10 is the percentage\n" ); Loading @@ -1778,7 +1846,11 @@ static void usage_dec( void ) #endif fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); #ifdef OBJ_EDITING_COMMANDLINE #ifndef FIX_1217_OBJECT_EDIT_FILE_INTERFACE fprintf( stdout, "-obj_edit : Enable objects editing\n" ); #else fprintf( stdout, "-obj_edit File : Object editing instructions file or NULL for built-in example\n" ); #endif #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" ); Loading Loading @@ -2136,6 +2208,9 @@ static ivas_error decodeG192( RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader, #endif ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) Loading Loading @@ -2545,10 +2620,24 @@ static ivas_error decodeG192( return error; } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( arg.objEditFileName != NULL ) { if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not read object editing instructions from file: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); return error; } } #endif /* Do object metadata editing here ... */ #ifdef OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing( &editableParameters, objectEditFileReader ); #else do_object_editing( &editableParameters ); #endif #endif /* set new object parameters*/ Loading Loading @@ -3076,6 +3165,9 @@ static ivas_error decodeVoIP( RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader, #endif IVAS_DEC_HANDLE hIvasDec ) { bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ Loading Loading @@ -3356,6 +3448,17 @@ static ivas_error decodeVoIP( } } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( arg.objEditEnabled && ( arg.objEditFileName != NULL ) ) { if ( ( error = ObjectEditFileReader_readNextFrame( objectEditFileReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not read object editing instructions from file: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); return error; } } #endif /* read all packets with a receive time smaller than the system time */ while ( nextPacketRcvTime_ms <= systemTime_ms ) { Loading Loading @@ -3466,7 +3569,11 @@ static ivas_error decodeVoIP( /* Do object metadata editing here ... */ #ifdef OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing( &editableParameters, objectEditFileReader ); #else do_object_editing( &editableParameters ); #endif #endif /* set new object parameters */ Loading Loading @@ -3776,7 +3883,12 @@ cleanup: *---------------------------------------------------------------------*/ static void do_object_editing( #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ) #else IVAS_EDITABLE_PARAMETERS *editableParameters ) #endif { /* put the objects equally spaced at the horizontal plane */ /* and play a little bit with the gains... */ Loading @@ -3792,6 +3904,66 @@ static void do_object_editing( } } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( objectEditFileReader != NULL ) { ReadObjectEditInfo *readInfo; readInfo = objectEditFileReader->readInfo; if ( readInfo->bg_gain_edited ) { editableParameters->gain_bed = readInfo->bg_gain; } for ( obj_idx = 0; obj_idx < editableParameters->num_obj; obj_idx++ ) { if ( !editableParameters->ism_metadata[obj_idx].non_diegetic_flag ) { /* object direction editing only for diegetic objects */ if ( readInfo->obj_azi_edited[obj_idx] ) { if ( readInfo->obj_azi_relative[obj_idx] ) { /* azimuth: apply relative edit + wrap */ editableParameters->ism_metadata[obj_idx].azimuth = fmodf( editableParameters->ism_metadata[obj_idx].azimuth + readInfo->obj_azi[obj_idx] + 540.f, 360.f ) - 180.f; } else { editableParameters->ism_metadata[obj_idx].azimuth = readInfo->obj_azi[obj_idx]; } } if ( readInfo->obj_ele_edited[obj_idx] ) { if ( readInfo->obj_ele_relative[obj_idx] ) { /* elevation: apply relative edit + saturation */ editableParameters->ism_metadata[obj_idx].elevation = fmaxf( fminf( editableParameters->ism_metadata[obj_idx].elevation + readInfo->obj_ele[obj_idx], 90.f ), -90.f ); } else { editableParameters->ism_metadata[obj_idx].elevation = readInfo->obj_ele[obj_idx]; } } } /* gain editing for all objects */ if ( readInfo->obj_gain_edited[obj_idx] ) { if ( readInfo->obj_gain_relative[obj_idx] ) { /* gain: apply relative edit + saturation */ editableParameters->ism_metadata[obj_idx].gain = fmaxf( fminf( editableParameters->ism_metadata[obj_idx].gain * readInfo->obj_gain[obj_idx], OBJ_EDIT_GAIN_MAX ), OBJ_EDIT_GAIN_MIN ); } else { editableParameters->ism_metadata[obj_idx].gain = readInfo->obj_gain[obj_idx]; } } } } else { #endif if ( num_nondiegetic_objects ) { float start_angle, angle_inc; Loading @@ -3815,6 +3987,9 @@ static void do_object_editing( } editableParameters->gain_bed = 0.5f; #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE } #endif return; Loading
lib_com/ivas_error.h +7 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ typedef enum IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED, #ifdef OBJ_EDITING_API IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED, #endif IVAS_ERR_INVALID_HRTF, IVAS_ERR_INVALID_HRTF_SAMPLING_RATE, Loading Loading @@ -261,6 +264,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) #ifdef OBJ_EDITING_API case IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED: return "Objects editing not supported"; #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE case IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED: return "Wrong use of both Object editing and Non-diegetic panning"; #endif case IVAS_ERR_INVALID_HRTF: return "Unsupported HRTF filter set"; Loading
lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -220,6 +220,8 @@ #define FIX_BRATE_SWITCHING /* VA: fix bitrate switching cases in OMASA and OSBA */ #define NONBE_1217_INIT_OBJ_EDIT /* VA: issue 1217: do object editing only when objects metadata is available */ #endif #define FIX_1217_OBJECT_EDIT_FILE_INTERFACE /* Nokia: issue #1217: add decoder functionality to read object edit instructions from a file */ #define NONBE_1217_OBJ_EDIT_FOA /* VA/Nokia: isse 1217: fix crash in object editing to FOA output in ParamISM */ /* #################### End BASOP porting switches ############################ */ Loading
lib_dec/ivas_init_dec.c +8 −1 Original line number Diff line number Diff line Loading @@ -3259,10 +3259,17 @@ static ivas_error doSanityChecks_IVAS( if ( !( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) ) #endif { return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Wrong set-up: Obect editing is not supported in this IVAS format." ); return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Wrong set-up: Object editing is not supported in this IVAS format." ); } } #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( st_ivas->hDecoderConfig->Opt_ObjEdit_on && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) { return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_AND_PANNING_NOT_SUPPORTED, "Wrong set-up: Only object editing or Non-diegetic panning can be used." ); } #endif #ifdef DEBUGGING if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || ( output_config != IVAS_AUDIO_CONFIG_BINAURAL && output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) { Loading