From 67d1695ed6474e9016821622ca23aee0b6be10a0 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 17 Oct 2025 19:48:47 +0200 Subject: [PATCH 1/5] MR porting --- apps/decoder.c | 163 ++++++++++++++++--------- lib_com/common_api_types.h | 1 + lib_com/ivas_error.h | 7 ++ lib_com/ivas_prot.h | 32 +++-- lib_com/options.h | 10 +- lib_dec/ivas_init_dec.c | 14 +++ lib_dec/ivas_ism_param_dec.c | 16 +-- lib_dec/ivas_jbm_dec.c | 58 +++------ lib_dec/ivas_mc_param_dec.c | 7 +- lib_dec/ivas_mc_paramupmix_dec.c | 6 +- lib_dec/ivas_osba_dec.c | 56 +++++++++ lib_dec/ivas_stat_dec.h | 3 + lib_dec/lib_dec.c | 89 +++++++++++--- lib_dec/lib_dec.h | 11 +- lib_rend/ivas_objectRenderer_sources.c | 4 +- readme.txt | 5 +- 16 files changed, 324 insertions(+), 158 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 52a617990..e0a57f0c4 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -56,11 +56,7 @@ #include "debug.h" #endif #include "wmc_auto.h" -#ifdef OBJ_EDITING_API -#ifdef OBJ_EDITING_EXAMPLE -#include -#endif -#endif + #define WMC_TOOL_SKIP @@ -157,7 +153,7 @@ typedef struct AcousticEnvironmentSequence aeSequence; bool dpidEnabled; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; -#ifdef OBJ_EDITING_EXAMPLE +#ifdef OBJ_EDITING_COMMANDLINE bool objEditEnabled; #endif @@ -196,6 +192,10 @@ static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBs static int16_t app_own_random( int16_t *seed ); static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); #endif +#ifdef OBJ_EDITING_EXAMPLE +static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters ); +#endif + /*------------------------------------------------------------------------------------------* * main() @@ -438,8 +438,13 @@ int main( uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; #ifdef LIB_DEC_REVISION +#ifdef OBJ_EDITING_COMMANDLINE + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, + arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#endif #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.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) @@ -1025,7 +1030,8 @@ static bool parseCmdlIVAS_dec( { arg->directivityPatternId[i] = 65535; } -#ifdef OBJ_EDITING_EXAMPLE + +#ifdef OBJ_EDITING_COMMANDLINE arg->objEditEnabled = false; #endif @@ -1557,7 +1563,7 @@ static bool parseCmdlIVAS_dec( i += tmp; } -#ifdef OBJ_EDITING_EXAMPLE +#ifdef OBJ_EDITING_COMMANDLINE else if ( strcmp( argv_to_upper, "-OBJ_EDIT" ) == 0 ) { arg->objEditEnabled = true; @@ -1771,13 +1777,13 @@ static void usage_dec( void ) fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); #endif fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); +#ifdef OBJ_EDITING_COMMANDLINE + fprintf( stdout, "-obj_edit : Enable objects editing\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" ); fprintf( stdout, " default is deactivated\n" ); -#ifdef OMASA_OBJECT_EDITING - fprintf( stdout, "-obj_edit : enable object editing\n" ); -#endif #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK fprintf( stdout, "-info : specify subfolder name for debug output\n" ); @@ -2170,11 +2176,6 @@ static ivas_error decodeG192( int16_t isSplitRend, isSplitCoded; IVAS_RENDER_CONFIG_DATA renderConfig; RenderConfigReader *renderConfigReader = NULL; -#ifdef OBJ_EDITING_API -#ifdef OBJ_EDITING_EXAMPLE - IVAS_EDITABLE_PARAMETERS editableParameters; -#endif -#endif #ifdef VARIABLE_SPEED_DECODING #ifdef LIB_DEC_REVISION @@ -2532,62 +2533,29 @@ static ivas_error decodeG192( } #ifdef OBJ_EDITING_API -#ifdef OBJ_EDITING_EXAMPLE + /* Object metadata editing */ if ( arg.objEditEnabled ) { + IVAS_EDITABLE_PARAMETERS editableParameters; - /* Do object info editing here */ /* get object parameters */ if ( ( error = IVAS_DEC_GetEditableParameters( hIvasDec, &editableParameters ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not get the editable parameters: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - - /* edit object parameters...*/ - - /* put the objects equally spaced at the horizontal plane */ - /* and play a little bit with the gains... */ - int16_t obj_idx, non_diegetic_obj_idx; - int16_t num_nondiegetic_objects; - - num_nondiegetic_objects = 0; - for ( obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ ) - { - if ( !editableParameters.ism_metadata[obj_idx].non_diegetic_flag ) - { - num_nondiegetic_objects++; - } - } - if ( num_nondiegetic_objects ) - { - float start_angle, angle_inc; - angle_inc = 360.0f / (float) num_nondiegetic_objects; - start_angle = angle_inc / 2.0f; - for ( obj_idx = 0, non_diegetic_obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ ) - { - if ( !editableParameters.ism_metadata[obj_idx].non_diegetic_flag ) - { - editableParameters.ism_metadata[obj_idx].elevation = 0.0f; - editableParameters.ism_metadata[obj_idx].azimuth = start_angle + (float) non_diegetic_obj_idx * angle_inc; - non_diegetic_obj_idx++; - } - } + return error; } - /* breakover object gains */ - for ( obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ ) - { - editableParameters.ism_metadata[obj_idx].gain = 0.5f + (float) ( ( frame + obj_idx * 50 ) % 250 ) / 250.0f; - } + /* Do object metadata editing here ... */ +#ifdef OBJ_EDITING_EXAMPLE + do_object_editing( &editableParameters ); - editableParameters.gain_bed = 0.5f; +#endif /* set new object parameters*/ if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not set the editable parameters: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; + return error; } } #endif @@ -2597,7 +2565,6 @@ static ivas_error decodeG192( fprintf( stderr, "\nError: could not prepare the renderer: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#endif } if ( isSplitRend ) @@ -2619,7 +2586,7 @@ static ivas_error decodeG192( if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) #endif { - fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + fprintf( stderr, "\nError in IVAS_DEC_GetSamplesRenderer(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } nSamplesRendered += nSamplesRendered_loop; @@ -3485,9 +3452,29 @@ static ivas_error decodeVoIP( } #ifdef OBJ_EDITING_API - if ( parameterAvailableForEditing == true ) + /* Object metadata editing */ + if ( arg.objEditEnabled && parameterAvailableForEditing == true ) { - /* do the object editing here */ + IVAS_EDITABLE_PARAMETERS editableParameters; + + /* get object parameters */ + if ( ( error = IVAS_DEC_GetEditableParameters( hIvasDec, &editableParameters ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: could not get the editable parameters: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + return error; + } + + /* Do object metadata editing here ... */ +#ifdef OBJ_EDITING_EXAMPLE + do_object_editing( &editableParameters ); + +#endif + /* set new object parameters */ + if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: could not set the editable parameters: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + return error; + } } #endif } /* while ( nSamplesRendered < nOutSamples ) */ @@ -3780,6 +3767,60 @@ cleanup: return error; } +#ifdef OBJ_EDITING_EXAMPLE + +/*---------------------------------------------------------------------* + * do_object_editing() + * + * Example function to edit objects parameters + *---------------------------------------------------------------------*/ + +static void do_object_editing( + IVAS_EDITABLE_PARAMETERS *editableParameters ) +{ + /* put the objects equally spaced at the horizontal plane */ + /* and play a little bit with the gains... */ + int16_t obj_idx, non_diegetic_obj_idx; + int16_t num_nondiegetic_objects; + + num_nondiegetic_objects = 0; + for ( obj_idx = 0; obj_idx < editableParameters->num_obj; obj_idx++ ) + { + if ( !editableParameters->ism_metadata[obj_idx].non_diegetic_flag ) + { + num_nondiegetic_objects++; + } + } + + if ( num_nondiegetic_objects ) + { + float start_angle, angle_inc; + angle_inc = 360.0f / (float) num_nondiegetic_objects; + start_angle = angle_inc / 2.0f; + for ( obj_idx = 0, non_diegetic_obj_idx = 0; obj_idx < editableParameters->num_obj; obj_idx++ ) + { + if ( !editableParameters->ism_metadata[obj_idx].non_diegetic_flag ) + { + editableParameters->ism_metadata[obj_idx].elevation = 0.0f; + editableParameters->ism_metadata[obj_idx].azimuth = start_angle + (float) non_diegetic_obj_idx * angle_inc; + non_diegetic_obj_idx++; + } + } + } + + /* breakover object gains */ + for ( obj_idx = 0; obj_idx < editableParameters->num_obj; obj_idx++ ) + { + editableParameters->ism_metadata[obj_idx].gain = 0.5f + (float) ( ( frame + obj_idx * 50 ) % 250 ) / 250.0f; + } + + editableParameters->gain_bed = 0.5f; + + + return; +} + +#endif #ifdef DEBUGGING /*---------------------------------------------------------------------* diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index ac26b97e4..eee9180a7 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -140,6 +140,7 @@ typedef struct _IVAS_EDITABLE_PARAMETERS int16_t num_obj; IVAS_ISM_METADATA ism_metadata[IVAS_MAX_NUM_OBJECTS]; float gain_bed; + } IVAS_EDITABLE_PARAMETERS; #endif diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 3614cd839..90c8605f4 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -77,6 +77,9 @@ typedef enum IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED, IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED, +#ifdef OBJ_EDITING_API + IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, +#endif IVAS_ERR_INVALID_HRTF, IVAS_ERR_INVALID_HRTF_SAMPLING_RATE, IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA, @@ -255,6 +258,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Directivity not supported"; case IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED: return "Acoustic environment not supported"; +#ifdef OBJ_EDITING_API + case IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED: + return "Objects editing not supported"; +#endif case IVAS_ERR_INVALID_HRTF: return "Unsupported HRTF filter set"; case IVAS_ERR_INVALID_HRTF_SAMPLING_RATE: diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b901e87a2..43f1935f8 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -854,7 +854,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( ); #ifdef OBJ_EDITING_API -void ivas_jbm_dec_prepare_renderer( +void ivas_dec_prepare_renderer( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); #endif @@ -1074,11 +1074,6 @@ ivas_error ivas_ism_metadata_dec( DEC_CORE_HANDLE st0 /* i : core-coder handle */ ); -#ifdef OBJ_EDITING_API -void ivas_ism_renderer_update_md( - Decoder_Struct *st_ivas /* i/o: main IVAS decoder handle */ -); -#endif /*----------------------------------------------------------------------------------* * Parametric ISM prototypes @@ -1146,18 +1141,18 @@ void ivas_ism_dec_digest_tc( void ivas_param_ism_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + const uint16_t nCldfbSlots, /* i : number of CLDFB slots in transport channels */ float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ); #ifdef OBJ_EDITING_API void ivas_param_ism_dec_dequant_md( - Decoder_Struct *st_ivas + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); void ivas_param_ism_dec_prepare_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nCldfbSlots /* i : number of CLFBS slots in the transport channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nCldfbSlots /* i : number of CLDFB slots in transport channels */ ); #endif @@ -3842,7 +3837,7 @@ void ivas_mc_paramupmix_dec_read_BS( void ivas_mc_paramupmix_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + const uint8_t nCldfbSlots, /* i : number of CLDFB slots in transport channels */ const int16_t nSamplesForRendering /* i : number of samples provided */ ); @@ -3919,7 +3914,7 @@ void ivas_param_mc_dec_digest_tc( #ifdef OBJ_EDITING_API void ivas_param_mc_dec_prepare_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots /* i : number of CLFBS slots in the transport channels */ + const uint8_t nCldfbSlots /* i : number of CLDFB slots in transport channels */ ); #endif @@ -5638,6 +5633,17 @@ ivas_error ivas_osba_render_sf( float *output_f[] /* o : rendered time signal */ ); +#ifdef OBJ_EDITING_API +void ivas_osba_stereo_add_channels( + float *tc_f[], /* i : transport channels */ + float *output_f[], /* i/o: output channels */ + const float gain, /* i : gain bed value */ + const int16_t nchan_out, /* i : number of output channels */ + const int16_t nchan_ism, /* i : number of ISM channels */ + const int16_t ism_mode, /* i : ISM mode */ + const int16_t n_samples_to_render /* i : output frame length per channel */ +); +#else void ivas_osba_stereo_add_channels( float *tc_f[], /* i : transport channels */ float *output_f[], /* i/o: output channels */ @@ -5646,6 +5652,7 @@ void ivas_osba_stereo_add_channels( const int16_t nchan_ism, /* i : number of ISM channels */ const int16_t n_samples_to_render /* i : output frame length per channel */ ); +#endif void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ @@ -5656,6 +5663,7 @@ ISM_MODE ivas_osba_ism_mode_select( const int16_t nchan_ism /* i : number of input ISM's */ ); + /*----------------------------------------------------------------------------------* * OMASA prototypes *---------------------------------------------------------------------------------*/ diff --git a/lib_com/options.h b/lib_com/options.h index c1da3e116..dac9b2e15 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -205,7 +205,7 @@ #endif // objject-editing feature porting -#define OBJ_EDITING_INTERFACE /* Interface for object editing */ +#define OBJ_EDITING_INTERFACE /* Interface for object editing */ #ifdef OBJ_EDITING_INTERFACE #define OBJ_EDITING_API /* object editing changes related to the API */ #ifdef OBJ_EDITING_API @@ -213,10 +213,12 @@ #define TMP_FIX_SPLIT_REND // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions) #define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE #endif -#define OBJ_EDITING_EXAMPLE /* obj editing example code in decoder.c */ +#define OBJ_EDITING_COMMANDLINE /* obj editing command-line option */ +#define OBJ_EDITING_EXAMPLE /* obj editing example code in decoder.c */ +#define OMASA_OBJECT_EDITING /* Nokia: object editing interface for OMASA */ +#define OBJ_EDITING_PARAMISM_BIN /* Nokia: object editing for ParamISM to binaural */ +#define FIX_BRATE_SWITCHING /* VA: fix bitrate switching cases in OMASA and OSBA */ #endif -#define OMASA_OBJECT_EDITING /* Nokia: object editing interface for OMASA */ -#define OBJ_EDITING_PARAMISM_BIN /* Nokia: object editing for ParamISM to binaural */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 573fff003..8f5b5fe44 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -3249,6 +3249,20 @@ static ivas_error doSanityChecks_IVAS( return IVAS_ERROR( IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED, "Wrong set-up: Acoustic environment is not supported in this output configuration." ); } } + +#ifdef OBJ_EDITING_COMMANDLINE + if ( st_ivas->hDecoderConfig->Opt_ObjEdit_on ) + { +#ifdef FIX_BRATE_SWITCHING + if ( !( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) ) ) +#else + 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." ); + } + } +#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 ) ) ) { diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 7059174c0..d2144ea84 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -818,9 +818,9 @@ void ivas_ism_dec_digest_tc( *-------------------------------------------------------------------------*/ void ivas_param_ism_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nCldfbSlots, /* i : number of CLDFB slots in transport channels */ + float *transport_channels_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { #ifndef OBJ_EDITING_API @@ -946,7 +946,6 @@ void ivas_param_ism_dec_digest_tc( } } #endif - if ( st_ivas->hDecoderConfig->Opt_tsm ) { /*TODO : FhG to check*/ @@ -993,13 +992,14 @@ void ivas_param_ism_dec_digest_tc( #ifdef OBJ_EDITING_API /*-------------------------------------------------------------------------* - * ivas_param_ism_dec_prepare_renderer() + * ivas_param_ism_dec_dequant_md() * * *-------------------------------------------------------------------------*/ void ivas_param_ism_dec_dequant_md( - Decoder_Struct *st_ivas ) + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +) { /* De-quantization */ if ( !( st_ivas->hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 || st_ivas->hDecoderConfig->ivas_total_brate == FRAME_NO_DATA ) ) @@ -1024,8 +1024,8 @@ void ivas_param_ism_dec_dequant_md( *-------------------------------------------------------------------------*/ void ivas_param_ism_dec_prepare_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint16_t nCldfbSlots /* i : number of CLFBS slots in the transport channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nCldfbSlots /* i : number of CLDFB slots in transport channels */ ) { int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 1802de085..62006552c 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -797,7 +797,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS]; int16_t n, n_render_timeslots; - push_wmops( "ivas_jbm_dec_feed_tc_to_rendererer" ); + push_wmops( "ivas_jbm_dec_feed_tc_to_renderer" ); for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ ) { p_data_f[n] = &data_f[n][0]; @@ -1247,33 +1247,10 @@ ivas_error ivas_jbm_dec_render( /* add already rendered SBA part */ #ifdef OBJ_EDITING_API - if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - float gain = st_ivas->hSbaIsmData->gain_bed; - if ( gain != 1.0f && gain >= 0.0f ) - { - int16_t i; - for ( n = 0; n < nchan_out; n++ ) - { - for ( i = 0; i < *nSamplesRendered; i++ ) - { - p_output[n][i] += p_tc[n + st_ivas->nchan_ism][i] * gain; - } - } - } - else - { - for ( n = 0; n < nchan_out; n++ ) - { - v_add( p_output[n], p_tc[n + st_ivas->nchan_ism], p_output[n], *nSamplesRendered ); - } - } - } - else + ivas_osba_stereo_add_channels( p_tc, p_output, st_ivas->hSbaIsmData->gain_bed, nchan_out, st_ivas->nchan_ism, st_ivas->ism_mode, *nSamplesRendered ); +#else + ivas_osba_stereo_add_channels( p_tc, p_output, 1.0f, nchan_out, st_ivas->nchan_ism, *nSamplesRendered ); #endif - { - ivas_osba_stereo_add_channels( p_tc, p_output, 1.0f, nchan_out, st_ivas->nchan_ism, *nSamplesRendered ); - } } else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { @@ -3071,20 +3048,21 @@ void ivas_jbm_masa_sf_to_sf_map( return; } + #ifdef OBJ_EDITING_API /*--------------------------------------------------------------------------* - * ivas_jbm_dec_prepare_renderer() + * ivas_dec_prepare_renderer() * - * prepare IVAS JBM renderer routine + * prepare IVAS renderer routine *--------------------------------------------------------------------------*/ -void ivas_jbm_dec_prepare_renderer( +void ivas_dec_prepare_renderer( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { int16_t n, n_render_timeslots; - push_wmops( "ivas_jbm_dec_feed_tc_to_rendererer" ); + push_wmops( "ivas_dec_prepare_renderer" ); n_render_timeslots = st_ivas->hTcBuffer->n_samples_available / st_ivas->hTcBuffer->n_samples_granularity; @@ -3103,7 +3081,6 @@ void ivas_jbm_dec_prepare_renderer( } else if ( st_ivas->ivas_format == ISM_FORMAT ) { - /* Rendering */ if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) @@ -3127,7 +3104,6 @@ void ivas_jbm_dec_prepare_renderer( } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { - if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { ivas_ism_dec_digest_tc( st_ivas ); @@ -3190,18 +3166,19 @@ void ivas_jbm_dec_prepare_renderer( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_DIRAC ) { - int16_t num_objects; + int16_t nchan_transport_ism; + /* Delay the signal to match CLDFB delay. Delay the whole buffer. */ - num_objects = 0; + nchan_transport_ism = 0; if ( ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC ) { - num_objects = 1; + nchan_transport_ism = 1; } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { - num_objects = st_ivas->nchan_ism; + nchan_transport_ism = st_ivas->nchan_ism; } - for ( n = 0; n < num_objects; n++ ) + for ( n = 0; n < nchan_transport_ism; n++ ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { @@ -3226,6 +3203,7 @@ void ivas_jbm_dec_prepare_renderer( delay_signal( st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); } } + #ifdef OMASA_OBJECT_EDITING if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) { @@ -3234,9 +3212,9 @@ void ivas_jbm_dec_prepare_renderer( if ( st_ivas->hMasaIsmData->masa_gain_is_edited ) { - for ( int16_t ch = 0; ch < 2; ch++ ) + for ( n = 0; n < BINAURAL_CHANNELS; n++ ) { - v_multc( st_ivas->hTcBuffer->tc[ch], st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->hTcBuffer->tc[ch], tcBufferSize ); + v_multc( st_ivas->hTcBuffer->tc[n], st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->hTcBuffer->tc[n], tcBufferSize ); } } } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index a0b356649..7333e3baf 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1331,7 +1331,7 @@ void ivas_param_mc_dec_read_BS( void ivas_param_mc_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + const uint8_t nCldfbSlots, /* i : number of CLDFB slots in transport channels */ float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ) { @@ -1546,8 +1546,8 @@ void ivas_param_mc_dec_digest_tc( *------------------------------------------------------------------------*/ void ivas_param_mc_dec_prepare_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots /* i : number of CLFBS slots in the transport channels */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots /* i : number of CLDFB slots in transport channels */ ) { PARAM_MC_DEC_HANDLE hParamMC; @@ -1609,6 +1609,7 @@ void ivas_param_mc_dec_prepare_renderer( { hParamMC->hMetadataPMC->attackIndex = (int16_t) max( 0, hParamMC->hMetadataPMC->attackIndex + ( ( nCldfbSlots - DEFAULT_JBM_CLDFB_TIMESLOTS ) / 2 ) ); } + /* adapt subframes */ hParamMC->num_slots = nCldfbSlots; hParamMC->slots_rendered = 0; diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 139b188a3..2c4aebdcf 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -186,9 +186,9 @@ void ivas_mc_paramupmix_dec_read_BS( *------------------------------------------------------------------------*/ void ivas_mc_paramupmix_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels*/ - const int16_t nSamplesForRendering /* i : number of samples provided */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLDFB slots in transport channels */ + const int16_t nSamplesForRendering /* i : number of samples provided */ ) { MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 1c73dcfea..485dbfb1b 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -240,6 +240,60 @@ ivas_error ivas_osba_ism_metadata_dec( return IVAS_ERR_OK; } + +#ifdef OBJ_EDITING_API +/*-------------------------------------------------------------------------* + * ivas_osba_stereo_add_channels() + * + * + *-------------------------------------------------------------------------*/ + +void ivas_osba_stereo_add_channels( + float *tc_f[], /* i : transport channels */ + float *output_f[], /* i/o: output channels */ + const float gain, /* i : gain bed value */ + const int16_t nchan_out, /* i : number of output channels */ + const int16_t nchan_ism, /* i : number of ISM channels */ + const int16_t ism_mode, /* i : ISM mode */ + const int16_t n_samples_to_render /* i : output frame length per channel */ +) +{ + int16_t n; + + if ( ism_mode == ISM_SBA_MODE_DISC ) + { + if ( gain != 1.0f && gain >= 0.0f ) + { + int16_t i; + for ( n = 0; n < nchan_out; n++ ) + { + for ( i = 0; i < n_samples_to_render; i++ ) + { + output_f[n][i] += tc_f[n + nchan_ism][i] * gain; + } + } + } + else + { + for ( n = 0; n < nchan_out; n++ ) + { + v_add( output_f[n], tc_f[n + nchan_ism], output_f[n], n_samples_to_render ); + } + } + } + else + { + for ( n = 0; n < nchan_out; n++ ) + { + v_add( output_f[n], tc_f[n + nchan_ism], output_f[n], n_samples_to_render ); + } + } + + return; +} +#endif + + /*-------------------------------------------------------------------------* * ivas_osba_render_sf() * @@ -297,6 +351,7 @@ ivas_error ivas_osba_render_sf( return IVAS_ERR_OK; } +#ifndef OBJ_EDITING_API /*-------------------------------------------------------------------------* * ivas_osba_stereo_add_channels() * @@ -342,3 +397,4 @@ void ivas_osba_stereo_add_channels( return; } +#endif diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 94bf01e09..c5958d8a9 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1028,6 +1028,9 @@ typedef struct decoder_config_structure int16_t Opt_ExternalOrientation; /* indicates whether external orientations are used */ int16_t Opt_dpid_on; /* indicates whether Directivity pattern option is used */ int16_t Opt_aeid_on; /* indicates whether Acoustic environment option is used */ +#ifdef OBJ_EDITING_COMMANDLINE + int16_t Opt_ObjEdit_on; /* indicates whether object editing option is used */ +#endif #ifdef DEBUGGING /* temp. development parameters */ int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 2f7723800..0a2bf3c05 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -108,10 +108,6 @@ struct IVAS_DEC uint16_t nSamplesFlushed; int16_t *flushbuffer; IVAS_DEC_PCM_TYPE pcmType; -#ifdef OBJ_EDITING_API - bool hasEditableParameters; - bool enableParameterEditing; -#endif bool hasBeenPreparedRendering; }; @@ -212,10 +208,6 @@ ivas_error IVAS_DEC_Open( #endif hIvasDec->pcmType = IVAS_DEC_PCM_INVALID; hIvasDec->nSamplesFlushed = 0; -#ifdef OBJ_EDITING_API - hIvasDec->hasEditableParameters = false; - hIvasDec->enableParameterEditing = false; -#endif hIvasDec->hasBeenPreparedRendering = false; hIvasDec->mode = mode; @@ -355,6 +347,9 @@ static void init_decoder_config( hDecoderConfig->Opt_ExternalOrientation = 0; hDecoderConfig->Opt_dpid_on = 0; hDecoderConfig->Opt_aeid_on = 0; +#ifdef OBJ_EDITING_COMMANDLINE + hDecoderConfig->Opt_ObjEdit_on = 0; +#endif return; } @@ -401,12 +396,14 @@ void IVAS_DEC_Close( { free( ( *phIvasDec )->apaExecBuffer ); } + #ifdef OBJ_EDITING_API if ( ( *phIvasDec )->flushbuffer != NULL ) { free( ( *phIvasDec )->flushbuffer ); } #endif + free( *phIvasDec ); *phIvasDec = NULL; phIvasDec = NULL; @@ -500,7 +497,10 @@ ivas_error IVAS_DEC_Configure( const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ const bool dpidEnabled, /* i : enable directivity pattern option */ const uint16_t acousticEnvironmentId, /* i : Acoustic environment ID */ - const bool delayCompensationEnabled /* i : enable delay compensation */ +#ifdef OBJ_EDITING_COMMANDLINE + const bool objEditEnabled, /* i : enable object editing */ +#endif + const bool delayCompensationEnabled /* i : enable delay compensation */ ) { Decoder_Struct *st_ivas; @@ -560,6 +560,9 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->Opt_ExternalOrientation = enableExternalOrientation; hDecoderConfig->Opt_dpid_on = (int16_t) dpidEnabled; hDecoderConfig->Opt_aeid_on = acousticEnvironmentId != 65535 ? TRUE : FALSE; +#ifdef OBJ_EDITING_COMMANDLINE + hDecoderConfig->Opt_ObjEdit_on = (int16_t) objEditEnabled; +#endif if ( renderFramesize == IVAS_RENDER_FRAMESIZE_UNKNOWN ) { @@ -1422,6 +1425,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( hIvasDec->hasBeenPreparedRendering = false; +#ifdef OBJ_EDITING_API /*-----------------------------------------------------------------* * Set editable metadata *-----------------------------------------------------------------*/ @@ -1469,6 +1473,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( } } } +#endif return IVAS_ERR_OK; } @@ -1482,8 +1487,9 @@ ivas_error IVAS_DEC_GetSamplesDecoder( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetEditableParameters( - IVAS_DEC_HANDLE hIvasDec, - IVAS_EDITABLE_PARAMETERS *hIvasEditableParameters ) + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_EDITABLE_PARAMETERS *hIvasEditableParameters /* o : object editing parameters handle */ +) { int16_t obj; Decoder_Struct *st_ivas; @@ -1500,11 +1506,18 @@ ivas_error IVAS_DEC_GetEditableParameters( st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; +#ifdef FIX_BRATE_SWITCHING + if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || + hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT || + hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT || + ( hIvasDec->st_ivas->ivas_format == MASA_FORMAT && hIvasDec->st_ivas->nchan_ism > 0 ) ) ) +#else if ( !( st_ivas->ivas_format == ISM_FORMAT || ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) ) +#endif { - return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." ); + return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Object editing is not supported in this operation mode." ); } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST @@ -1550,10 +1563,16 @@ ivas_error IVAS_DEC_GetEditableParameters( hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = 0; } } + else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_NONE ) + { + hIvasEditableParameters->num_obj = 0; + } +#ifdef DEBUGGING else { assert( 0 && "This should never happen!" ); } +#endif } #ifdef OMASA_OBJECT_EDITING else if ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) @@ -1616,8 +1635,9 @@ ivas_error IVAS_DEC_GetEditableParameters( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_SetEditableParameters( - IVAS_DEC_HANDLE hIvasDec, - IVAS_EDITABLE_PARAMETERS hIvasEditableParameters ) + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_EDITABLE_PARAMETERS hIvasEditableParameters /* i : object editing parameters handle */ +) { int16_t obj; Decoder_Struct *st_ivas; @@ -1631,12 +1651,19 @@ ivas_error IVAS_DEC_SetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef FIX_BRATE_SWITCHING + if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || + hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT || + hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT || + ( hIvasDec->st_ivas->ivas_format == MASA_FORMAT && hIvasDec->st_ivas->nchan_ism > 0 ) ) ) +#else if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) || hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) +#endif { - return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." ); + return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Object editing no supported in this operation mode." ); } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST @@ -1707,11 +1734,19 @@ ivas_error IVAS_DEC_SetEditableParameters( } #endif } + #ifdef OBJ_EDITING_PARAMISM_BIN /* MASA is not present with the ISM format */ st_ivas->hMasaIsmData->masa_gain_is_edited = 0u; #endif } + else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_NONE ) + { + if ( hIvasEditableParameters.num_obj != 0 ) + { + return IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED; + } + } else { assert( 0 && "This should never happen!" ); @@ -1844,7 +1879,7 @@ ivas_error IVAS_DEC_SetEditableParameters( /*---------------------------------------------------------------------* * IVAS_DEC_PrepareRenderer( ) * - * Main function to decode to PCM data + * prepare IVAS renderer *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_PrepareRenderer( @@ -1859,7 +1894,7 @@ ivas_error IVAS_DEC_PrepareRenderer( if ( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ #endif { - ivas_jbm_dec_prepare_renderer( hIvasDec->st_ivas ); + ivas_dec_prepare_renderer( hIvasDec->st_ivas ); } hIvasDec->hasBeenPreparedRendering = true; @@ -3478,6 +3513,13 @@ ivas_error IVAS_DEC_GetRenderConfig( return copyRendererConfigStruct( hIvasDec->st_ivas->hRenderConfig, hRCout ); } + +/*---------------------------------------------------------------------* + * IVAS_DEC_GetDefaultRenderConfig( ) + * + * + *---------------------------------------------------------------------*/ + /*! r: error code*/ ivas_error IVAS_DEC_GetDefaultRenderConfig( IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */ @@ -4166,10 +4208,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hIvasDec->nSamplesRendered = 0; #endif } -#ifdef OBJ_EDITING_API - /* :TODO: only return here if we really have editing initialized */ - if ( hIvasDec->hasBeenFedFirstGoodFrame && hIvasDec->hasEditableParameters == true && hIvasDec->enableParameterEditing == true ) +#ifdef OBJ_EDITING_API + if ( hIvasDec->hasBeenFedFirstGoodFrame ) { *parametersAvailableForEditing = true; return IVAS_ERR_OK; @@ -4196,6 +4237,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples( int16_t nSamplesToRender, nSamplesRendered_loop; bool tmp; + /* decode TCs, do TSM and prepare the renderer */ if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) { if ( hIvasDec->nSamplesAvailableNext == 0 || hIvasDec->nSamplesAvailableNext == hIvasDec->nSamplesFrame ) @@ -4659,6 +4701,13 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "Acoustic environment ID:ON\n" ); } +#ifdef OBJ_EDITING_COMMANDLINE + + if ( st_ivas->hDecoderConfig->Opt_ObjEdit_on ) + { + fprintf( stdout, "Objects editing : ON\n" ); + } +#endif } /*-----------------------------------------------------------------* diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index da34c2f45..480719599 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -135,6 +135,9 @@ ivas_error IVAS_DEC_Configure( const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ const bool dpidEnabled, /* i : enable directivity pattern option */ const uint16_t acousticEnvironmentId, /* i : Acoustic environment ID */ +#ifdef OBJ_EDITING_COMMANDLINE + const bool objEditEnabled, /* i : enable object editing */ +#endif const bool delayCompensationEnabled /* i : enable delay compensation */ ); @@ -182,13 +185,13 @@ ivas_error IVAS_DEC_GetSamples( #ifdef OBJ_EDITING_API ivas_error IVAS_DEC_GetEditableParameters( - IVAS_DEC_HANDLE hIvasDec, - IVAS_EDITABLE_PARAMETERS *hIvasEditableParameters + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_EDITABLE_PARAMETERS *hIvasEditableParameters /* o : object editing parameters handle */ ); ivas_error IVAS_DEC_SetEditableParameters( - IVAS_DEC_HANDLE hIvasDec, - IVAS_EDITABLE_PARAMETERS hIvasEditableParameters + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_EDITABLE_PARAMETERS hIvasEditableParameters /* i : object editing parameters handle */ ); ivas_error IVAS_DEC_PrepareRenderer( diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index f69661ba3..b3fa269e9 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -135,7 +135,7 @@ ivas_error TDREND_MIX_SRC_SetDir( #ifdef OBJ_EDITING_INTERFACE /*-------------------------------------------------------------------* - * TDREND_MIX_SRC_SetSourceGain() + * TDREND_MIX_SRC_SetGain() * * Set source gain --------------------------------------------------------------------*/ @@ -572,6 +572,8 @@ static void TDREND_SRC_SPATIAL_SetGain( ) { Src_p->SrcRend_p->SrcGain_p[0] = Gain; + + return; } #endif diff --git a/readme.txt b/readme.txt index 6623e52da..36566e221 100644 --- a/readme.txt +++ b/readme.txt @@ -289,7 +289,7 @@ Options: Format files, the magic word in the mime file is used to determine which of the two supported formats is in use. default bitstream file format is G.192 --fr L : render frame size in ms L=(5,10,20), default is 20 +-fr L : render frame size in ms L=(5,10,20), default is 20 -hrtf File : HRTF filter File used in BINAURAL rendering -T File : Head rotation specified by external trajectory File -otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' @@ -305,6 +305,7 @@ Options: -dpid ID : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration -aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output config. +-obj_edit : Enable objects editing -level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. -om File : Coded metadata File for BINAURAL_SPLIT_PCM OutputConf Currently, all values default to level 3 (full functionality). @@ -325,7 +326,7 @@ Options: -of Format : Audio Format of output file Alternatively, it can be a custom loudspeaker layout File -fs : Input sampling rate in kHz (16, 32, 48) - required only with raw PCM inputs --fr L : render frame size in ms L=(5,10,20), default is 20 +-fr L : render frame size in ms L=(5,10,20), default is 20 -hrtf File : Custom HRTF File for binaural rendering (only for binaural outputs) -T File : Head rotation trajectory File for simulation of head tracking (only for binaural outputs) -otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec` or `ref_vec_lev` (only for binaural outputs) -- GitLab From 2f84dc473053287a9c578584e5890ba42373427d Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Oct 2025 08:39:54 +0200 Subject: [PATCH 2/5] port MR1915 --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index dac9b2e15..cefe5e842 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -218,6 +218,7 @@ #define OMASA_OBJECT_EDITING /* Nokia: object editing interface for OMASA */ #define OBJ_EDITING_PARAMISM_BIN /* Nokia: object editing for ParamISM to binaural */ #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 /* #################### End BASOP porting switches ############################ */ -- GitLab From fff4714d53416899dd06d3219072525009278243 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Oct 2025 08:40:57 +0200 Subject: [PATCH 3/5] port MR1915 --- lib_dec/lib_dec.c | 67 +++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 0a2bf3c05..e656e678f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1503,14 +1503,23 @@ ivas_error IVAS_DEC_GetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST + if ( !hIvasDec->hasBeenFedFirstGoodFrame ) + { + hIvasEditableParameters->num_obj = 0; + + return IVAS_ERR_OK; + } +#endif + st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; -#ifdef FIX_BRATE_SWITCHING - if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || - hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT || - hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT || - ( hIvasDec->st_ivas->ivas_format == MASA_FORMAT && hIvasDec->st_ivas->nchan_ism > 0 ) ) ) +#ifdef NONBE_1217_INIT_OBJ_EDIT + if ( !( st_ivas->ivas_format == ISM_FORMAT || + st_ivas->ivas_format == SBA_ISM_FORMAT || + st_ivas->ivas_format == MASA_ISM_FORMAT || + ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) ) ) #else if ( !( st_ivas->ivas_format == ISM_FORMAT || ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || @@ -1520,15 +1529,6 @@ ivas_error IVAS_DEC_GetEditableParameters( return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Object editing is not supported in this operation mode." ); } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST - if ( !hIvasDec->hasBeenFedFirstGoodFrame ) - { - hIvasEditableParameters->num_obj = 0; - - return IVAS_ERR_OK; - } -#endif - hIvasEditableParameters->gain_bed = 1.0f; hIvasEditableParameters->num_obj = st_ivas->nchan_ism; if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -1651,21 +1651,6 @@ ivas_error IVAS_DEC_SetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef FIX_BRATE_SWITCHING - if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || - hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT || - hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT || - ( hIvasDec->st_ivas->ivas_format == MASA_FORMAT && hIvasDec->st_ivas->nchan_ism > 0 ) ) ) -#else - if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || - ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || - ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) || - hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) -#endif - { - return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Object editing no supported in this operation mode." ); - } - #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { @@ -1676,14 +1661,28 @@ ivas_error IVAS_DEC_SetEditableParameters( st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; -#ifdef DEBUGGING - assert( hIvasEditableParameters.num_obj == st_ivas->nchan_ism ); +#ifdef NONBE_1217_INIT_OBJ_EDIT + if ( !( st_ivas->ivas_format == ISM_FORMAT || + st_ivas->ivas_format == SBA_ISM_FORMAT || + st_ivas->ivas_format == MASA_ISM_FORMAT || + ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) ) ) +#else + if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || + ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || + ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) || + hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) #endif + { + return IVAS_ERROR( IVAS_ERR_OBJECTS_EDITING_NOT_SUPPORTED, "Object editing no supported in this operation mode." ); + } if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { if ( ism_mode == ISM_MODE_DISC || ism_mode == ISM_SBA_MODE_DISC ) { +#ifdef DEBUGGING + assert( hIvasEditableParameters.num_obj == st_ivas->nchan_ism ); +#endif for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) { st_ivas->hIsmMetaData[obj]->edited_azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; @@ -1705,6 +1704,9 @@ ivas_error IVAS_DEC_SetEditableParameters( } else if ( ism_mode == ISM_MODE_PARAM ) { +#ifdef DEBUGGING + assert( hIvasEditableParameters.num_obj == st_ivas->nchan_ism ); +#endif for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) { #ifdef OBJ_EDITING_PARAMISM_BIN @@ -1758,6 +1760,9 @@ ivas_error IVAS_DEC_SetEditableParameters( int32_t id_th; float threshold_azi, threshold_ele; +#ifdef DEBUGGING + assert( hIvasEditableParameters.num_obj == st_ivas->nchan_ism ); +#endif for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ ) { if ( st_ivas->hMasaIsmData != NULL ) -- GitLab From 868197820631634baf555e52ae48dad3829f6bb9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Oct 2025 12:08:15 +0200 Subject: [PATCH 4/5] address comment -> align ivas_param_mc_dec_digest_tc() parameters and comments with the float main --- lib_com/ivas_prot.h | 4 ++-- lib_dec/ivas_mc_param_dec.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 43f1935f8..a4db085e2 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3907,8 +3907,8 @@ void ivas_param_mc_dec_read_BS( void ivas_param_mc_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output*/ + const uint8_t nCldfbSlots, /* i : number of CLDFB slots in transport channels */ + float *p_data_f[] /* i/o: synthesized core-coder transport channels/DirAC output*/ ); #ifdef OBJ_EDITING_API diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 7333e3baf..77c048a06 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -1330,9 +1330,9 @@ void ivas_param_mc_dec_read_BS( *------------------------------------------------------------------------*/ void ivas_param_mc_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLDFB slots in transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLDFB slots in transport channels */ + float *p_data_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { PARAM_MC_DEC_HANDLE hParamMC; @@ -1442,7 +1442,7 @@ void ivas_param_mc_dec_digest_tc( /* CLDFB Analysis*/ for ( ch = 0; ch < nchan_transport; ch++ ) { - cldfbAnalysis_ts( &( transport_channels_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + cldfbAnalysis_ts( &( p_data_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); -- GitLab From 7936431df57e320f3c4955d252947965e5fe0d6c Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Mon, 20 Oct 2025 14:18:40 +0300 Subject: [PATCH 5/5] Change addition to be in line with float main and BASOP counterpart. --- lib_dec/lib_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index e656e678f..efddf70ce 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1742,7 +1742,7 @@ ivas_error IVAS_DEC_SetEditableParameters( st_ivas->hMasaIsmData->masa_gain_is_edited = 0u; #endif } - else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_NONE ) + else if ( ism_mode == ISM_MODE_NONE ) { if ( hIvasEditableParameters.num_obj != 0 ) { -- GitLab