diff --git a/apps/decoder.c b/apps/decoder.c index 022ccaee8ad3c58ff0af2309feb989ac7f097154..60d0ba95277f8168f2d6ab7049e6e4aef5eccef1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -3971,6 +3971,46 @@ static void do_object_editing( editableParameters->ism_metadata[obj_idx].elevation = readInfo->obj_ele[obj_idx]; } } +#ifdef FIX_2192_OBJ_EDITING_EXT_METADATA + /* object direction editing only for diegetic objects */ + if ( readInfo->obj_yaw_edited[obj_idx] ) + { + if ( readInfo->obj_yaw_relative[obj_idx] ) + { + /* yaw: apply relative edit + wrap */ + editableParameters->ism_metadata[obj_idx].yaw = fmodf( editableParameters->ism_metadata[obj_idx].yaw + readInfo->obj_yaw[obj_idx] + 540.f, 360.f ) - 180.f; + } + else + { + editableParameters->ism_metadata[obj_idx].yaw = readInfo->obj_yaw[obj_idx]; + } + } + if ( readInfo->obj_pitch_edited[obj_idx] ) + { + if ( readInfo->obj_pitch_relative[obj_idx] ) + { + /* pitch: apply relative edit + saturation */ + editableParameters->ism_metadata[obj_idx].pitch = fmaxf( fminf( editableParameters->ism_metadata[obj_idx].pitch + readInfo->obj_pitch[obj_idx], 90.f ), -90.f ); + } + else + { + editableParameters->ism_metadata[obj_idx].pitch = readInfo->obj_pitch[obj_idx]; + } + } + /* radius editing only for diegetic objects */ + if ( readInfo->obj_radius_edited[obj_idx] ) + { + if ( readInfo->obj_radius_relative[obj_idx] ) + { + /* radius: apply relative edit + saturation */ + editableParameters->ism_metadata[obj_idx].radius = fmaxf( fminf( editableParameters->ism_metadata[obj_idx].radius * readInfo->obj_radius[obj_idx], OBJ_EDIT_RADIUS_MAX ), 0.0f ); + } + else + { + editableParameters->ism_metadata[obj_idx].radius = readInfo->obj_radius[obj_idx]; + } + } +#endif } /* gain editing for all objects */ diff --git a/lib_com/options.h b/lib_com/options.h index bfc637fb086a3d3fd4b1a2b5770a14445cda532d..cb68eab0c8804af92f19b127110f58aace81088c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -212,8 +212,10 @@ #define FIX_1372_OSBA_OBJECT_EDITING /* VA: issue 1372: Fix OSBA object-editing in BINAURAL_ROOM_IR */ #define NONBE_FIX_1172_OBJ_EDIT_JBM /* VA: issue 1172: fix OMASA object editing in JBM */ #define NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES /* Nokia: Fix for issues 1399: obj edit broken with MC/SBA output in VOIP, and 1400: negative energy estimate used for gaining. */ +#define FIX_2192_OBJ_EDITING_EXT_METADATA /* Eri: Add support for extended metadata in object editing */ #define FIX_1318_ROOM_SIZE_CMD_LINE /* Philips/Nokia: Default room sizes support */ + /* #################### End BASOP porting switches ############################ */ /* clang-format on */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index f2bdfbeac7ddfd47475538ea88cd26febd04560f..b58885cc8c86040dac694893e68f1ac9eab31583 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1789,9 +1789,18 @@ ivas_error IVAS_DEC_SetEditableParameters( { st_ivas->hIsmMetaData[obj]->edited_azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; st_ivas->hIsmMetaData[obj]->edited_elevation = hIvasEditableParameters.ism_metadata[obj].elevation; +#ifdef FIX_2192_OBJ_EDITING_EXT_METADATA + if ( ism_mode == ISM_MASA_MODE_DISC ) + { + st_ivas->hIsmMetaData[obj]->edited_yaw = hIvasEditableParameters.ism_metadata[obj].yaw; + st_ivas->hIsmMetaData[obj]->edited_pitch = hIvasEditableParameters.ism_metadata[obj].pitch; + st_ivas->hIsmMetaData[obj]->edited_radius = hIvasEditableParameters.ism_metadata[obj].radius; + } +#else st_ivas->hIsmMetaData[obj]->edited_yaw = hIvasEditableParameters.ism_metadata[obj].yaw; st_ivas->hIsmMetaData[obj]->edited_pitch = hIvasEditableParameters.ism_metadata[obj].pitch; st_ivas->hIsmMetaData[obj]->edited_radius = hIvasEditableParameters.ism_metadata[obj].radius; +#endif #ifndef NONBE_FIX_1172_OBJ_EDIT_JBM st_ivas->hIsmMetaData[obj]->azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; st_ivas->hIsmMetaData[obj]->elevation = hIvasEditableParameters.ism_metadata[obj].elevation; diff --git a/lib_util/obj_edit_file_reader.c b/lib_util/obj_edit_file_reader.c index 5f28818f6f9e96cb60d2c68053fb860e09c7b2f1..212bcfbc12249dbe6d60622c950fa53accd77929 100644 --- a/lib_util/obj_edit_file_reader.c +++ b/lib_util/obj_edit_file_reader.c @@ -71,7 +71,11 @@ ivas_error ObjectEditFileReader_open( self = (ObjectEditFileReader *) calloc( 1, sizeof( ObjectEditFileReader ) ); +#ifndef FIX_2192_OBJ_EDITING_EXT_METADATA self->maxLineLen = 256; +#else + self->maxLineLen = 1024; +#endif self->editFileHandle = fileHandle; self->inLine = (char *) calloc( self->maxLineLen, sizeof( char ) ); @@ -90,6 +94,17 @@ ivas_error ObjectEditFileReader_open( self->readInfo->obj_ele[obj_idx] = 0.0f; self->readInfo->obj_ele_edited[obj_idx] = false; self->readInfo->obj_ele_relative[obj_idx] = false; +#ifdef FIX_2192_OBJ_EDITING_EXT_METADATA + self->readInfo->obj_radius[obj_idx] = 0.0f; + self->readInfo->obj_radius_edited[obj_idx] = false; + self->readInfo->obj_radius_relative[obj_idx] = false; + self->readInfo->obj_yaw[obj_idx] = 0.0f; + self->readInfo->obj_yaw_edited[obj_idx] = false; + self->readInfo->obj_yaw_relative[obj_idx] = false; + self->readInfo->obj_pitch[obj_idx] = 0.0f; + self->readInfo->obj_pitch_edited[obj_idx] = false; + self->readInfo->obj_pitch_relative[obj_idx] = false; +#endif } self->rewound = false; @@ -136,6 +151,14 @@ ivas_error ObjectEditFileReader_readNextFrame( readEdits->obj_azi_relative[obj_idx] = false; readEdits->obj_ele_edited[obj_idx] = false; readEdits->obj_ele_relative[obj_idx] = false; +#ifdef FIX_2192_OBJ_EDITING_EXT_METADATA + readEdits->obj_radius_edited[obj_idx] = false; + readEdits->obj_radius_relative[obj_idx] = false; + readEdits->obj_yaw_edited[obj_idx] = false; + readEdits->obj_yaw_relative[obj_idx] = false; + readEdits->obj_pitch_edited[obj_idx] = false; + readEdits->obj_pitch_relative[obj_idx] = false; +#endif } /* tokenize the line by comma */ @@ -207,6 +230,35 @@ ivas_error ObjectEditFileReader_readNextFrame( { readEdits->obj_ele_relative[obj_idx] = ( strcmp( paramValue, "1" ) == 0 ); } +#ifdef FIX_2192_OBJ_EDITING_EXT_METADATA + else if ( strcmp( param, "radius" ) == 0 ) + { + readEdits->obj_radius[obj_idx] = strtof( paramValue, NULL ); + readEdits->obj_radius_edited[obj_idx] = true; + } + else if ( strcmp( param, "yaw" ) == 0 ) + { + readEdits->obj_yaw[obj_idx] = strtof( paramValue, NULL ); + readEdits->obj_yaw_edited[obj_idx] = true; + } + else if ( strcmp( param, "pitch" ) == 0 ) + { + readEdits->obj_pitch[obj_idx] = strtof( paramValue, NULL ); + readEdits->obj_pitch_edited[obj_idx] = true; + } + else if ( strcmp( param, "relradius" ) == 0 ) + { + readEdits->obj_radius_relative[obj_idx] = ( strcmp( paramValue, "1" ) == 0 ); + } + else if ( strcmp( param, "relyaw" ) == 0 ) + { + readEdits->obj_yaw_relative[obj_idx] = ( strcmp( paramValue, "1" ) == 0 ); + } + else if ( strcmp( param, "relpitch" ) == 0 ) + { + readEdits->obj_pitch_relative[obj_idx] = ( strcmp( paramValue, "1" ) == 0 ); + } +#endif } } } @@ -230,6 +282,20 @@ ivas_error ObjectEditFileReader_readNextFrame( { readEdits->obj_ele[obj_idx] = max( min( readEdits->obj_ele[obj_idx], 90.f ), -90.f ); } +#ifdef FIX_2192_OBJ_EDITING_EXT_METADATA + if ( readEdits->obj_radius_edited[obj_idx] && !readEdits->obj_radius_relative[obj_idx] ) + { + readEdits->obj_radius[obj_idx] = max( min( readEdits->obj_radius[obj_idx], OBJ_EDIT_RADIUS_MAX ), 0.0f ); + } + if ( readEdits->obj_yaw_edited[obj_idx] && !readEdits->obj_yaw_relative[obj_idx] ) + { + readEdits->obj_yaw[obj_idx] = max( min( readEdits->obj_yaw[obj_idx], 180.f ), -180.f ); + } + if ( readEdits->obj_pitch_edited[obj_idx] && !readEdits->obj_pitch_relative[obj_idx] ) + { + readEdits->obj_pitch[obj_idx] = max( min( readEdits->obj_pitch[obj_idx], 90.f ), -90.f ); + } +#endif } } else diff --git a/lib_util/obj_edit_file_reader.h b/lib_util/obj_edit_file_reader.h index 0d4509a91fefd1c3f642e34cb838f0e194d1bc47..ee878c557496b864df1a9010c94d8846650169c3 100644 --- a/lib_util/obj_edit_file_reader.h +++ b/lib_util/obj_edit_file_reader.h @@ -48,7 +48,9 @@ the United Nations Convention on Contracts on the International Sales of Goods. #define OBJ_EDIT_GAIN_MIN 0.06309573f /* -24 dB */ #define OBJ_EDIT_GAIN_MAX 15.84893f /* +24 dB */ #endif - +#ifdef FIX_2192_OBJ_EDITING_EXT_METADATA +#define OBJ_EDIT_RADIUS_MAX 15.75f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ +#endif typedef struct ObjectEditFileReader ObjectEditFileReader; typedef struct ReadObjectEditInfo ReadObjectEditInfo; @@ -68,6 +70,20 @@ struct ReadObjectEditInfo float obj_ele[IVAS_MAX_NUM_OBJECTS]; bool obj_ele_edited[IVAS_MAX_NUM_OBJECTS]; bool obj_ele_relative[IVAS_MAX_NUM_OBJECTS]; + +#ifdef FIX_2192_OBJ_EDITING_EXT_METADATA + float obj_radius[IVAS_MAX_NUM_OBJECTS]; + bool obj_radius_edited[IVAS_MAX_NUM_OBJECTS]; + bool obj_radius_relative[IVAS_MAX_NUM_OBJECTS]; + + float obj_yaw[IVAS_MAX_NUM_OBJECTS]; + bool obj_yaw_edited[IVAS_MAX_NUM_OBJECTS]; + bool obj_yaw_relative[IVAS_MAX_NUM_OBJECTS]; + + float obj_pitch[IVAS_MAX_NUM_OBJECTS]; + bool obj_pitch_edited[IVAS_MAX_NUM_OBJECTS]; + bool obj_pitch_relative[IVAS_MAX_NUM_OBJECTS]; +#endif }; struct ObjectEditFileReader