Loading apps/decoder.c +192 −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,9 +50,13 @@ #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 #include "vector3_pair_file_reader.h" #include "wmc_auto.h" #include "options.h" #include "prot_fx.h" #include "stl.h" Loading Loading @@ -138,6 +145,9 @@ typedef struct #ifdef OBJ_EDITING_COMMANDLINE bool objEditEnabled; #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE char *objEditFileName; #endif } DecArguments; Loading Loading @@ -166,12 +176,21 @@ 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 OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); #else static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters ); #endif #endif /*------------------------------------------------------------------------------------------* Loading Loading @@ -203,6 +222,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 WMOPS reset_wmops(); Loading Loading @@ -396,6 +418,20 @@ 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 @@ -641,11 +677,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 @@ -703,6 +747,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 @@ -882,6 +929,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 @@ -1355,6 +1405,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 @@ -1532,7 +1600,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" ); fprintf( stdout, "-exof File : External orientation File for external orientation trajectory\n" ); fprintf( stdout, "-dpid ID : Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up\n" ); Loading @@ -1546,7 +1614,11 @@ static void usage_dec( void ) fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); 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" ); Loading Loading @@ -1883,6 +1955,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 @@ -2212,9 +2287,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 #ifdef OBJ_EDITING_EXAMPLE /* Do object metadata editing here ... */ #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing_fx( &editableParameters, objectEditFileReader ); #else do_object_editing_fx( &editableParameters ); #endif #else /* edit object parameters...*/ Loading Loading @@ -2676,6 +2766,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 @@ -2956,6 +3049,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 @@ -3066,7 +3170,11 @@ static ivas_error decodeVoIP( /* Do object metadata editing here ... */ #ifdef OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing_fx( &editableParameters, objectEditFileReader ); #else do_object_editing_fx( &editableParameters ); #endif #endif /* set new object parameters */ Loading Loading @@ -3369,13 +3477,18 @@ cleanup: #ifdef OBJ_EDITING_EXAMPLE /*---------------------------------------------------------------------* * do_object_editing() * do_object_editing_fx() * * Example function to edit objects parameters *---------------------------------------------------------------------*/ static void do_object_editing_fx( #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 @@ -3391,6 +3504,66 @@ static void do_object_editing_fx( } } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( objectEditFileReader != NULL ) { ReadObjectEditInfo *readInfo; readInfo = objectEditFileReader->readInfo; if ( readInfo->bg_gain_edited ) { editableParameters->gain_bed_fx = float_to_fix( readInfo->bg_gain, Q29 ); } 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_fx = float_to_fix( fmodf( fix_to_float( editableParameters->ism_metadata[obj_idx].azimuth_fx, Q22 ) + readInfo->obj_azi[obj_idx] + 540.f, 360.f ) - 180.f, Q22 ); } else { editableParameters->ism_metadata[obj_idx].azimuth_fx = float_to_fix( readInfo->obj_azi[obj_idx], Q22 ); } } 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_fx = float_to_fix( fmaxf( fix_to_float( fminf( editableParameters->ism_metadata[obj_idx].elevation_fx, Q22 ) + readInfo->obj_ele[obj_idx], 90.f ), -90.f ), Q22 ); } else { editableParameters->ism_metadata[obj_idx].elevation_fx = float_to_fix( readInfo->obj_ele[obj_idx], Q22 ); } } } /* 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_fx = float_to_fix( fmaxf( fminf( fix_to_float( editableParameters->ism_metadata[obj_idx].gain_fx, Q29 ) * readInfo->obj_gain[obj_idx], OBJ_EDIT_GAIN_MAX ), OBJ_EDIT_GAIN_MIN ), Q29 ); } else { editableParameters->ism_metadata[obj_idx].gain_fx = float_to_fix( readInfo->obj_gain[obj_idx], Q29 ); } } } } else { #endif if ( num_nondiegetic_objects ) { float start_angle, angle_inc; Loading @@ -3414,6 +3587,9 @@ static void do_object_editing_fx( } editableParameters->gain_bed_fx = ( 1 << 28 ); // 0.5 in Q29 #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 @@ -255,6 +258,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 @@ -140,6 +140,8 @@ #define OBJ_EDIT_BASOP #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_fx.c +8 −0 Original line number Diff line number Diff line Loading @@ -3893,5 +3893,13 @@ static ivas_error doSanityChecks_IVAS( } #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE test(); 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 return IVAS_ERR_OK; } lib_dec/lib_dec_fx.c +39 −25 Original line number Diff line number Diff line Loading @@ -4567,6 +4567,10 @@ ivas_error IVAS_DEC_SetEditableParameters( move32(); st_ivas->hParamIsmDec->edited_elevation_values_fx[obj] = hIvasEditableParameters.ism_metadata[obj].elevation_fx; move32(); #ifdef NONBE_1217_OBJ_EDIT_FOA IF( st_ivas->hMasaIsmData != NULL ) { #endif st_ivas->hMasaIsmData->gain_ism_edited_fx[obj] = shr( extract_h( hIvasEditableParameters.ism_metadata[obj].gain_fx ), Q1 ); // Q29 -> Q12 move32(); Loading @@ -4592,13 +4596,23 @@ ivas_error IVAS_DEC_SetEditableParameters( st_ivas->hMasaIsmData->ism_gain_is_edited[obj] = 0; } move16(); #ifdef NONBE_1217_OBJ_EDIT_FOA } #endif #endif } #ifdef OBJ_EDITING_PARAMISM_BIN #ifdef NONBE_1217_OBJ_EDIT_FOA IF( st_ivas->hMasaIsmData != NULL ) { #endif /* MASA is not present with the ISM format */ st_ivas->hMasaIsmData->masa_gain_is_edited = 0; move16(); #ifdef NONBE_1217_OBJ_EDIT_FOA } #endif #endif } ELSE IF( EQ_32( ism_mode, ISM_MODE_NONE ) ) Loading Loading
apps/decoder.c +192 −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,9 +50,13 @@ #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 #include "vector3_pair_file_reader.h" #include "wmc_auto.h" #include "options.h" #include "prot_fx.h" #include "stl.h" Loading Loading @@ -138,6 +145,9 @@ typedef struct #ifdef OBJ_EDITING_COMMANDLINE bool objEditEnabled; #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE char *objEditFileName; #endif } DecArguments; Loading Loading @@ -166,12 +176,21 @@ 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 OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); #else static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters ); #endif #endif /*------------------------------------------------------------------------------------------* Loading Loading @@ -203,6 +222,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 WMOPS reset_wmops(); Loading Loading @@ -396,6 +418,20 @@ 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 @@ -641,11 +677,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 @@ -703,6 +747,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 @@ -882,6 +929,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 @@ -1355,6 +1405,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 @@ -1532,7 +1600,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" ); fprintf( stdout, "-exof File : External orientation File for external orientation trajectory\n" ); fprintf( stdout, "-dpid ID : Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up\n" ); Loading @@ -1546,7 +1614,11 @@ static void usage_dec( void ) fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); 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" ); Loading Loading @@ -1883,6 +1955,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 @@ -2212,9 +2287,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 #ifdef OBJ_EDITING_EXAMPLE /* Do object metadata editing here ... */ #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing_fx( &editableParameters, objectEditFileReader ); #else do_object_editing_fx( &editableParameters ); #endif #else /* edit object parameters...*/ Loading Loading @@ -2676,6 +2766,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 @@ -2956,6 +3049,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 @@ -3066,7 +3170,11 @@ static ivas_error decodeVoIP( /* Do object metadata editing here ... */ #ifdef OBJ_EDITING_EXAMPLE #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE do_object_editing_fx( &editableParameters, objectEditFileReader ); #else do_object_editing_fx( &editableParameters ); #endif #endif /* set new object parameters */ Loading Loading @@ -3369,13 +3477,18 @@ cleanup: #ifdef OBJ_EDITING_EXAMPLE /*---------------------------------------------------------------------* * do_object_editing() * do_object_editing_fx() * * Example function to edit objects parameters *---------------------------------------------------------------------*/ static void do_object_editing_fx( #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 @@ -3391,6 +3504,66 @@ static void do_object_editing_fx( } } #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE if ( objectEditFileReader != NULL ) { ReadObjectEditInfo *readInfo; readInfo = objectEditFileReader->readInfo; if ( readInfo->bg_gain_edited ) { editableParameters->gain_bed_fx = float_to_fix( readInfo->bg_gain, Q29 ); } 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_fx = float_to_fix( fmodf( fix_to_float( editableParameters->ism_metadata[obj_idx].azimuth_fx, Q22 ) + readInfo->obj_azi[obj_idx] + 540.f, 360.f ) - 180.f, Q22 ); } else { editableParameters->ism_metadata[obj_idx].azimuth_fx = float_to_fix( readInfo->obj_azi[obj_idx], Q22 ); } } 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_fx = float_to_fix( fmaxf( fix_to_float( fminf( editableParameters->ism_metadata[obj_idx].elevation_fx, Q22 ) + readInfo->obj_ele[obj_idx], 90.f ), -90.f ), Q22 ); } else { editableParameters->ism_metadata[obj_idx].elevation_fx = float_to_fix( readInfo->obj_ele[obj_idx], Q22 ); } } } /* 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_fx = float_to_fix( fmaxf( fminf( fix_to_float( editableParameters->ism_metadata[obj_idx].gain_fx, Q29 ) * readInfo->obj_gain[obj_idx], OBJ_EDIT_GAIN_MAX ), OBJ_EDIT_GAIN_MIN ), Q29 ); } else { editableParameters->ism_metadata[obj_idx].gain_fx = float_to_fix( readInfo->obj_gain[obj_idx], Q29 ); } } } } else { #endif if ( num_nondiegetic_objects ) { float start_angle, angle_inc; Loading @@ -3414,6 +3587,9 @@ static void do_object_editing_fx( } editableParameters->gain_bed_fx = ( 1 << 28 ); // 0.5 in Q29 #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 @@ -255,6 +258,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 @@ -140,6 +140,8 @@ #define OBJ_EDIT_BASOP #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_fx.c +8 −0 Original line number Diff line number Diff line Loading @@ -3893,5 +3893,13 @@ static ivas_error doSanityChecks_IVAS( } #endif #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE test(); 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 return IVAS_ERR_OK; }
lib_dec/lib_dec_fx.c +39 −25 Original line number Diff line number Diff line Loading @@ -4567,6 +4567,10 @@ ivas_error IVAS_DEC_SetEditableParameters( move32(); st_ivas->hParamIsmDec->edited_elevation_values_fx[obj] = hIvasEditableParameters.ism_metadata[obj].elevation_fx; move32(); #ifdef NONBE_1217_OBJ_EDIT_FOA IF( st_ivas->hMasaIsmData != NULL ) { #endif st_ivas->hMasaIsmData->gain_ism_edited_fx[obj] = shr( extract_h( hIvasEditableParameters.ism_metadata[obj].gain_fx ), Q1 ); // Q29 -> Q12 move32(); Loading @@ -4592,13 +4596,23 @@ ivas_error IVAS_DEC_SetEditableParameters( st_ivas->hMasaIsmData->ism_gain_is_edited[obj] = 0; } move16(); #ifdef NONBE_1217_OBJ_EDIT_FOA } #endif #endif } #ifdef OBJ_EDITING_PARAMISM_BIN #ifdef NONBE_1217_OBJ_EDIT_FOA IF( st_ivas->hMasaIsmData != NULL ) { #endif /* MASA is not present with the ISM format */ st_ivas->hMasaIsmData->masa_gain_is_edited = 0; move16(); #ifdef NONBE_1217_OBJ_EDIT_FOA } #endif #endif } ELSE IF( EQ_32( ism_mode, ISM_MODE_NONE ) ) Loading