Loading apps/decoder.c +82 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,11 @@ #include "wmc_auto.h" #include "options.h" #include "stl.h" #ifdef OBJ_EDITING_API #ifdef OBJ_EDITING_EXAMPLE #include <math.h> #endif #endif #define WMC_TOOL_SKIP Loading Loading @@ -126,6 +131,9 @@ typedef struct AcousticEnvironmentSequence aeSequence; bool dpidEnabled; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; #ifdef OBJ_EDITING_EXAMPLE bool objEditEnabled; #endif } DecArguments; Loading Loading @@ -860,6 +868,9 @@ static bool parseCmdlIVAS_dec( { arg->directivityPatternId[i] = 65535; } #ifdef OBJ_EDITING_EXAMPLE arg->objEditEnabled = false; #endif /*-----------------------------------------------------------------* * Initialization Loading Loading @@ -1328,6 +1339,13 @@ static bool parseCmdlIVAS_dec( i += tmp; } #ifdef OBJ_EDITING_EXAMPLE else if ( strcmp( argv_to_upper, "-OBJ_EDIT" ) == 0 ) { arg->objEditEnabled = true; i++; } #endif /*-----------------------------------------------------------------* * Option not recognized Loading Loading @@ -1881,6 +1899,11 @@ 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 Loading Loading @@ -2168,6 +2191,65 @@ static ivas_error decodeG192( } #ifdef OBJ_EDITING_API #ifdef OBJ_EDITING_EXAMPLE if ( arg.objEditEnabled ) { /* 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... */ Word16 obj_idx, non_diegetic_obj_idx; Word16 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_fx = 0; editableParameters.ism_metadata[obj_idx].azimuth_fx = (Word32) ( ( start_angle + (float) non_diegetic_obj_idx * angle_inc ) * powf( 2.0f, 22.0f ) ); non_diegetic_obj_idx++; } } } /* breakover object gains */ for ( obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ ) { editableParameters.ism_metadata[obj_idx].gain_fx = (Word32) ( ( 0.5f + (float) ( ( frame + obj_idx * 50 ) % 250 ) / 250.0f ) * powf( 2.0f, 29.0f ) ); } editableParameters.gain_bed_fx = ( 1 << 28 ); // 0.5 in Q29 /* 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; } } #endif /* Do the final preparations needed for rendering */ if ( ( error = IVAS_DEC_PrepareRenderer( hIvasDec ) ) != IVAS_ERR_OK ) { Loading lib_com/common_api_types.h +3 −3 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ typedef struct _IVAS_ISM_METADATA Word32 elevation_fx; /* Q22 */ Word16 radius_fx; /* Q9 */ Word32 spread_fx; /* Q22 */ Word32 gainFactor_fx; /* Q31 */ Word32 gainFactor_fx; /* Q29 */ Word32 yaw_fx; /* Q22 */ Word32 pitch_fx; /* Q22 */ float azimuth; Loading @@ -142,7 +142,7 @@ typedef struct _IVAS_ISM_METADATA float pitch; Word16 non_diegetic_flag; #ifdef OBJ_EDITING_API Word32 gain_fx; Word32 gain_fx; // Q29 #endif } IVAS_ISM_METADATA; Loading @@ -152,7 +152,7 @@ typedef struct _IVAS_EDITABLE_PARAMETERS { Word16 num_obj; IVAS_ISM_METADATA ism_metadata[IVAS_MAX_NUM_OBJECTS]; Word32 gain_bed_fx; Word32 gain_bed_fx; // Q29 } IVAS_EDITABLE_PARAMETERS; #endif Loading lib_com/ivas_cnst.h +6 −1 Original line number Diff line number Diff line Loading @@ -1256,10 +1256,15 @@ enum #define MASA_MAXIMUM_TWO_DIR_BANDS 24 #define NBITS_HR_COH 4 #define OMASA_TDREND_MATCHING_GAIN_FX 26026 //TODO: insert proper Q representations #ifdef OMASA_OBJECT_EDITING #define OMASA_GAIN_EDIT_THR_FX 246 /* OMASA gain change threshold, 0.06f in Q12 */ #define OMASA_AZI_EDIT_THR_FX ONE_IN_Q22 /* OMASA-DISC azimuth change threshold, 1.0f in Q22 */ #define OMASA_ELE_EDIT_THR_FX ONE_IN_Q23 /* OMASA-DISC elevation change threshold, 2.0f in Q22 */ #endif #define MASA_INV_ANGLE_AT_EQUATOR_DEG_Q30 1453366656l /* 1.353553128183453f in Q30 */ #define MASA_JBM_RINGBUFFER_FRAMES 3 #define TOLERANCE_360_Q22 1510033326 /* 360 in Q22 + 0.02 in Q22*/ #define MINUS_TOLERANCE_360_Q22 -1510033326 /* - (360 in Q22 + 0.02 in Q22) */ Loading lib_com/ivas_ism_com_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -471,13 +471,13 @@ void ivas_ism_reset_metadata( move16(); #ifdef OBJ_EDITING_API hIsmMeta->edited_gain_fx = ONE_IN_Q31; hIsmMeta->edited_gain_fx = ONE_IN_Q29; hIsmMeta->edited_azimuth_fx = 0; hIsmMeta->edited_elevation_fx = 0; hIsmMeta->edited_pitch_fx = 0; hIsmMeta->edited_yaw_fx = 0; hIsmMeta->edited_radius_fx = ONE_IN_Q9; hIsmMeta->gain_fx = ONE_IN_Q31; hIsmMeta->gain_fx = ONE_IN_Q29; hIsmMeta->non_diegetic_flag = 0; #endif Loading lib_com/ivas_prot_fx.h +6 −2 Original line number Diff line number Diff line Loading @@ -3956,8 +3956,11 @@ void ivas_set_ism_importance_interformat_fx( const Word16 lp_noise_CPE_fx, /* i : LP filtered total noise estimation */ Word16 ism_imp[] /* o : ISM importance flags */ ); #ifdef OMASA_OBJECT_EDITING void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( #else void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( #endif Decoder_Struct *st_ivas, Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ Loading @@ -3966,6 +3969,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( const Word16 subframe ); void ivas_omasa_decode_masa_to_total_fx( UWord16 *bit_stream, Word16 *index, Loading Loading
apps/decoder.c +82 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,11 @@ #include "wmc_auto.h" #include "options.h" #include "stl.h" #ifdef OBJ_EDITING_API #ifdef OBJ_EDITING_EXAMPLE #include <math.h> #endif #endif #define WMC_TOOL_SKIP Loading Loading @@ -126,6 +131,9 @@ typedef struct AcousticEnvironmentSequence aeSequence; bool dpidEnabled; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; #ifdef OBJ_EDITING_EXAMPLE bool objEditEnabled; #endif } DecArguments; Loading Loading @@ -860,6 +868,9 @@ static bool parseCmdlIVAS_dec( { arg->directivityPatternId[i] = 65535; } #ifdef OBJ_EDITING_EXAMPLE arg->objEditEnabled = false; #endif /*-----------------------------------------------------------------* * Initialization Loading Loading @@ -1328,6 +1339,13 @@ static bool parseCmdlIVAS_dec( i += tmp; } #ifdef OBJ_EDITING_EXAMPLE else if ( strcmp( argv_to_upper, "-OBJ_EDIT" ) == 0 ) { arg->objEditEnabled = true; i++; } #endif /*-----------------------------------------------------------------* * Option not recognized Loading Loading @@ -1881,6 +1899,11 @@ 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 Loading Loading @@ -2168,6 +2191,65 @@ static ivas_error decodeG192( } #ifdef OBJ_EDITING_API #ifdef OBJ_EDITING_EXAMPLE if ( arg.objEditEnabled ) { /* 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... */ Word16 obj_idx, non_diegetic_obj_idx; Word16 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_fx = 0; editableParameters.ism_metadata[obj_idx].azimuth_fx = (Word32) ( ( start_angle + (float) non_diegetic_obj_idx * angle_inc ) * powf( 2.0f, 22.0f ) ); non_diegetic_obj_idx++; } } } /* breakover object gains */ for ( obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ ) { editableParameters.ism_metadata[obj_idx].gain_fx = (Word32) ( ( 0.5f + (float) ( ( frame + obj_idx * 50 ) % 250 ) / 250.0f ) * powf( 2.0f, 29.0f ) ); } editableParameters.gain_bed_fx = ( 1 << 28 ); // 0.5 in Q29 /* 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; } } #endif /* Do the final preparations needed for rendering */ if ( ( error = IVAS_DEC_PrepareRenderer( hIvasDec ) ) != IVAS_ERR_OK ) { Loading
lib_com/common_api_types.h +3 −3 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ typedef struct _IVAS_ISM_METADATA Word32 elevation_fx; /* Q22 */ Word16 radius_fx; /* Q9 */ Word32 spread_fx; /* Q22 */ Word32 gainFactor_fx; /* Q31 */ Word32 gainFactor_fx; /* Q29 */ Word32 yaw_fx; /* Q22 */ Word32 pitch_fx; /* Q22 */ float azimuth; Loading @@ -142,7 +142,7 @@ typedef struct _IVAS_ISM_METADATA float pitch; Word16 non_diegetic_flag; #ifdef OBJ_EDITING_API Word32 gain_fx; Word32 gain_fx; // Q29 #endif } IVAS_ISM_METADATA; Loading @@ -152,7 +152,7 @@ typedef struct _IVAS_EDITABLE_PARAMETERS { Word16 num_obj; IVAS_ISM_METADATA ism_metadata[IVAS_MAX_NUM_OBJECTS]; Word32 gain_bed_fx; Word32 gain_bed_fx; // Q29 } IVAS_EDITABLE_PARAMETERS; #endif Loading
lib_com/ivas_cnst.h +6 −1 Original line number Diff line number Diff line Loading @@ -1256,10 +1256,15 @@ enum #define MASA_MAXIMUM_TWO_DIR_BANDS 24 #define NBITS_HR_COH 4 #define OMASA_TDREND_MATCHING_GAIN_FX 26026 //TODO: insert proper Q representations #ifdef OMASA_OBJECT_EDITING #define OMASA_GAIN_EDIT_THR_FX 246 /* OMASA gain change threshold, 0.06f in Q12 */ #define OMASA_AZI_EDIT_THR_FX ONE_IN_Q22 /* OMASA-DISC azimuth change threshold, 1.0f in Q22 */ #define OMASA_ELE_EDIT_THR_FX ONE_IN_Q23 /* OMASA-DISC elevation change threshold, 2.0f in Q22 */ #endif #define MASA_INV_ANGLE_AT_EQUATOR_DEG_Q30 1453366656l /* 1.353553128183453f in Q30 */ #define MASA_JBM_RINGBUFFER_FRAMES 3 #define TOLERANCE_360_Q22 1510033326 /* 360 in Q22 + 0.02 in Q22*/ #define MINUS_TOLERANCE_360_Q22 -1510033326 /* - (360 in Q22 + 0.02 in Q22) */ Loading
lib_com/ivas_ism_com_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -471,13 +471,13 @@ void ivas_ism_reset_metadata( move16(); #ifdef OBJ_EDITING_API hIsmMeta->edited_gain_fx = ONE_IN_Q31; hIsmMeta->edited_gain_fx = ONE_IN_Q29; hIsmMeta->edited_azimuth_fx = 0; hIsmMeta->edited_elevation_fx = 0; hIsmMeta->edited_pitch_fx = 0; hIsmMeta->edited_yaw_fx = 0; hIsmMeta->edited_radius_fx = ONE_IN_Q9; hIsmMeta->gain_fx = ONE_IN_Q31; hIsmMeta->gain_fx = ONE_IN_Q29; hIsmMeta->non_diegetic_flag = 0; #endif Loading
lib_com/ivas_prot_fx.h +6 −2 Original line number Diff line number Diff line Loading @@ -3956,8 +3956,11 @@ void ivas_set_ism_importance_interformat_fx( const Word16 lp_noise_CPE_fx, /* i : LP filtered total noise estimation */ Word16 ism_imp[] /* o : ISM importance flags */ ); #ifdef OMASA_OBJECT_EDITING void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( #else void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( #endif Decoder_Struct *st_ivas, Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ Loading @@ -3966,6 +3969,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( const Word16 subframe ); void ivas_omasa_decode_masa_to_total_fx( UWord16 *bit_stream, Word16 *index, Loading