From 155ce856892a6934bed7cee5eb06c1b540987f4e Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Thu, 6 Nov 2025 11:54:56 +0100 Subject: [PATCH 1/3] Port MR 2337 from float --- apps/decoder.c | 41 ++++++++++++++++++++ lib_com/options.h | 2 +- lib_util/obj_edit_file_reader.c | 66 +++++++++++++++++++++++++++++++++ lib_util/obj_edit_file_reader.h | 17 +++++++++ 4 files changed, 125 insertions(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index 871738ec0..e5432016d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -3883,6 +3883,47 @@ 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 af4dc1014..b4a9ee986 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -208,7 +208,7 @@ #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 */ /* #################### End BASOP porting switches ############################ */ /* clang-format on */ diff --git a/lib_util/obj_edit_file_reader.c b/lib_util/obj_edit_file_reader.c index 5f28818f6..212bcfbc1 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 06b92a74d..11095b8c9 100644 --- a/lib_util/obj_edit_file_reader.h +++ b/lib_util/obj_edit_file_reader.h @@ -43,6 +43,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 */ +#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; @@ -63,6 +66,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 -- GitLab From 8602a06fca96c5ca566ab917e97e115bc3cc2ed0 Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Mon, 10 Nov 2025 09:47:06 +0100 Subject: [PATCH 2/3] Updates from float to limit editing to Discrete ISM and combined formats Disc ISM --- apps/decoder.c | 1 - lib_dec/lib_dec.c | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index e5432016d..b42fabcb6 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -3883,7 +3883,6 @@ 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] ) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 57e3ad030..b37739577 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1713,9 +1713,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; -- GitLab From 4753fcd10a195861c808d77a9488c5f9304e242f Mon Sep 17 00:00:00 2001 From: Sumeyra Kanik Date: Mon, 10 Nov 2025 09:50:48 +0100 Subject: [PATCH 3/3] Fix merging --- lib_util/obj_edit_file_reader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_util/obj_edit_file_reader.h b/lib_util/obj_edit_file_reader.h index ba38c79e2..ee878c557 100644 --- a/lib_util/obj_edit_file_reader.h +++ b/lib_util/obj_edit_file_reader.h @@ -50,7 +50,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. #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; -- GitLab