Loading apps/decoder.c +139 −82 Original line number Diff line number Diff line Loading @@ -54,11 +54,6 @@ #include "debug.h" #endif #include "wmc_auto.h" #ifdef OBJ_EDITING_API #ifdef OBJ_EDITING_EXAMPLE #include <math.h> #endif #endif #define WMC_TOOL_SKIP Loading Loading @@ -155,7 +150,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 Loading Loading @@ -202,6 +197,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() Loading Loading @@ -452,8 +451,13 @@ int main( asked_frame_size = arg.renderFramesize; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; #ifdef OBJ_EDITING_COMMANDLINE 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.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) #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 ) #endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -1155,11 +1159,10 @@ static bool parseCmdlIVAS_dec( arg->directivityPatternId[i] = 65535; } #ifdef OBJ_EDITING_EXAMPLE #ifdef OBJ_EDITING_COMMANDLINE arg->objEditEnabled = false; #endif #endif /*-----------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ Loading Loading @@ -1612,8 +1615,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; Loading Loading @@ -1821,13 +1823,13 @@ static void usage_dec( void ) fprintf( stdout, "-aeid ID | File : Acoustic environment ID (number > 0)\n" ); fprintf( stdout, " alternatively, it can be a text file where each line contains \"ID duration\"\n" ); 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 <folder> : specify subfolder name for debug output\n" ); Loading Loading @@ -2198,10 +2200,6 @@ static ivas_error decodeG192( return error; } #ifdef OBJ_EDITING_API IVAS_EDITABLE_PARAMETERS editableParameters; #endif IVAS_RENDER_CONFIG_DATA renderConfig; RenderConfigReader *renderConfigReader = NULL; Loading Loading @@ -2502,16 +2500,19 @@ static ivas_error decodeG192( } } #endif #ifdef FIX_HRTF_LOAD /* Feed into decoder and decode transport channels */ if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi ) ) != IVAS_ERR_OK ) #else /* Feed into decoder */ if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi #ifndef FIX_HRTF_LOAD #ifdef OBJ_EDITING_API , isSplitRend, splitRendBits #endif #endif ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError: could not feed frame to decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -2547,74 +2548,41 @@ static ivas_error decodeG192( #endif #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++; } } } /* 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; return error; } editableParameters.gain_bed = 0.5f; /* 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 ) ); goto cleanup; return error; } } #endif /* Do the final preparations needed for rendering */ if ( ( error = IVAS_DEC_PrepareRenderer( hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not prepare the renderer: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif } #endif /* Render */ if ( isSplitRend ) { if ( ( error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), splitRendBits, &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) Loading @@ -2628,14 +2596,24 @@ static ivas_error decodeG192( } else { #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_GetSamplesRenderer( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetSamplesRenderer(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #else if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif nSamplesRendered += nSamplesRendered_loop; nSamplesToRender -= nSamplesRendered_loop; } if ( needNewFrame ) { frame++; Loading Loading @@ -3459,29 +3437,34 @@ static ivas_error decodeVoIP( while ( nSamplesRendered < nOutSamples ) { #endif #ifdef SUPPORT_JBM_TRACEFILE if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter #ifdef FIX_HRTF_LOAD , &bitstreamReadDone #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, ¶meterAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #else #ifdef OBJ_EDITING_API , &nSamplesRendered, ¶meterAvailableForEditing if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &nSamplesRendered, ¶meterAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #endif ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, &nSamplesRendered, ¶meterAvailableForEditing #ifdef FIX_HRTF_LOAD , &bitstreamReadDone #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &bitstreamReadDone, &nSamplesRendered, ¶meterAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &bitstreamReadDone, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #else #ifdef OBJ_EDITING_API & nSamplesRendered, ¶meterAvailableForEditing if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, &nSamplesRendered, ¶meterAvailableForEditing ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #endif ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); Loading Loading @@ -3515,9 +3498,29 @@ static ivas_error decodeVoIP( #endif #ifdef OBJ_EDITING_API if ( parameterAvailableForEditing == true ) /* Object metadata editing */ if ( arg.objEditEnabled && parameterAvailableForEditing == true ) { IVAS_EDITABLE_PARAMETERS editableParameters; /* get object parameters */ if ( ( error = IVAS_DEC_GetEditableParameters( hIvasDec, &editableParameters ) ) != IVAS_ERR_OK ) { /* do the object editing here */ 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; } } } /* while ( nSamplesRendered < nOutSamples ) */ #endif Loading Loading @@ -3803,6 +3806,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 Loading lib_com/common_api_types.h +1 −0 Original line number Diff line number Diff line Loading @@ -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 Loading lib_com/ivas_error.h +7 −0 Original line number Diff line number Diff line Loading @@ -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_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA, IVAS_ERR_INVALID_INPUT_FORMAT, Loading Loading @@ -254,6 +257,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_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA: Loading lib_com/ivas_prot.h +24 −15 Original line number Diff line number Diff line Loading @@ -822,7 +822,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 Loading Loading @@ -1036,11 +1036,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 Loading Loading @@ -1114,18 +1109,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 */ const uint16_t nCldfbSlots /* i : number of CLDFB slots in transport channels */ ); #endif Loading Loading @@ -3811,7 +3806,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 */ ); Loading Loading @@ -3881,14 +3876,14 @@ 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 *transport_channels_f[] /* i/o: synthesized core-coder transport channels/DirAC output*/ ); #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 the transport channels */ ); #endif Loading Loading @@ -5630,6 +5625,18 @@ 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 */ ); #endif void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); Loading @@ -5638,6 +5645,8 @@ ISM_MODE ivas_osba_ism_mode_select( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t nchan_ism /* i : number of input ISM's */ ); /*----------------------------------------------------------------------------------* * OMASA prototypes *---------------------------------------------------------------------------------*/ Loading lib_com/ivas_spar_com.c +4 −0 Original line number Diff line number Diff line Loading @@ -1257,7 +1257,11 @@ static void ivas_calc_mat_inv( int16_t sign = 1; ivas_calc_mat_det( dbl_in_re, dim, &det_re ); #ifdef NONBE_FIX_1213_SBA_DET_MAT_INV_3BY3 det = det_re > 0 ? 1 / max( IVAS_DBL_EPS, det_re ) : 1 / min( det_re, -IVAS_DBL_EPS ); #else det = det_re > 0 ? 1 / max( IVAS_DBL_EPS, det_re ) : min( det_re, -IVAS_DBL_EPS ); #endif for ( i = 0; i < dim; i++ ) { Loading Loading
apps/decoder.c +139 −82 Original line number Diff line number Diff line Loading @@ -54,11 +54,6 @@ #include "debug.h" #endif #include "wmc_auto.h" #ifdef OBJ_EDITING_API #ifdef OBJ_EDITING_EXAMPLE #include <math.h> #endif #endif #define WMC_TOOL_SKIP Loading Loading @@ -155,7 +150,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 Loading Loading @@ -202,6 +197,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() Loading Loading @@ -452,8 +451,13 @@ int main( asked_frame_size = arg.renderFramesize; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; #ifdef OBJ_EDITING_COMMANDLINE 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.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) #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 ) #endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -1155,11 +1159,10 @@ static bool parseCmdlIVAS_dec( arg->directivityPatternId[i] = 65535; } #ifdef OBJ_EDITING_EXAMPLE #ifdef OBJ_EDITING_COMMANDLINE arg->objEditEnabled = false; #endif #endif /*-----------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ Loading Loading @@ -1612,8 +1615,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; Loading Loading @@ -1821,13 +1823,13 @@ static void usage_dec( void ) fprintf( stdout, "-aeid ID | File : Acoustic environment ID (number > 0)\n" ); fprintf( stdout, " alternatively, it can be a text file where each line contains \"ID duration\"\n" ); 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 <folder> : specify subfolder name for debug output\n" ); Loading Loading @@ -2198,10 +2200,6 @@ static ivas_error decodeG192( return error; } #ifdef OBJ_EDITING_API IVAS_EDITABLE_PARAMETERS editableParameters; #endif IVAS_RENDER_CONFIG_DATA renderConfig; RenderConfigReader *renderConfigReader = NULL; Loading Loading @@ -2502,16 +2500,19 @@ static ivas_error decodeG192( } } #endif #ifdef FIX_HRTF_LOAD /* Feed into decoder and decode transport channels */ if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi ) ) != IVAS_ERR_OK ) #else /* Feed into decoder */ if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi #ifndef FIX_HRTF_LOAD #ifdef OBJ_EDITING_API , isSplitRend, splitRendBits #endif #endif ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError: could not feed frame to decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -2547,74 +2548,41 @@ static ivas_error decodeG192( #endif #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++; } } } /* 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; return error; } editableParameters.gain_bed = 0.5f; /* 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 ) ); goto cleanup; return error; } } #endif /* Do the final preparations needed for rendering */ if ( ( error = IVAS_DEC_PrepareRenderer( hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not prepare the renderer: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif } #endif /* Render */ if ( isSplitRend ) { if ( ( error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), splitRendBits, &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) Loading @@ -2628,14 +2596,24 @@ static ivas_error decodeG192( } else { #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_GetSamplesRenderer( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetSamplesRenderer(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #else if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, IVAS_DEC_PCM_INT16, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif nSamplesRendered += nSamplesRendered_loop; nSamplesToRender -= nSamplesRendered_loop; } if ( needNewFrame ) { frame++; Loading Loading @@ -3459,29 +3437,34 @@ static ivas_error decodeVoIP( while ( nSamplesRendered < nOutSamples ) { #endif #ifdef SUPPORT_JBM_TRACEFILE if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter #ifdef FIX_HRTF_LOAD , &bitstreamReadDone #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, ¶meterAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #else #ifdef OBJ_EDITING_API , &nSamplesRendered, ¶meterAvailableForEditing if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &nSamplesRendered, ¶meterAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #endif ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, &nSamplesRendered, ¶meterAvailableForEditing #ifdef FIX_HRTF_LOAD , &bitstreamReadDone #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &bitstreamReadDone, &nSamplesRendered, ¶meterAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &bitstreamReadDone, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #else #ifdef OBJ_EDITING_API & nSamplesRendered, ¶meterAvailableForEditing if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, &nSamplesRendered, ¶meterAvailableForEditing ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms ) ) != IVAS_ERR_OK ) #endif #endif ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); Loading Loading @@ -3515,9 +3498,29 @@ static ivas_error decodeVoIP( #endif #ifdef OBJ_EDITING_API if ( parameterAvailableForEditing == true ) /* Object metadata editing */ if ( arg.objEditEnabled && parameterAvailableForEditing == true ) { IVAS_EDITABLE_PARAMETERS editableParameters; /* get object parameters */ if ( ( error = IVAS_DEC_GetEditableParameters( hIvasDec, &editableParameters ) ) != IVAS_ERR_OK ) { /* do the object editing here */ 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; } } } /* while ( nSamplesRendered < nOutSamples ) */ #endif Loading Loading @@ -3803,6 +3806,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 Loading
lib_com/common_api_types.h +1 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
lib_com/ivas_error.h +7 −0 Original line number Diff line number Diff line Loading @@ -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_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA, IVAS_ERR_INVALID_INPUT_FORMAT, Loading Loading @@ -254,6 +257,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_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA: Loading
lib_com/ivas_prot.h +24 −15 Original line number Diff line number Diff line Loading @@ -822,7 +822,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 Loading Loading @@ -1036,11 +1036,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 Loading Loading @@ -1114,18 +1109,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 */ const uint16_t nCldfbSlots /* i : number of CLDFB slots in transport channels */ ); #endif Loading Loading @@ -3811,7 +3806,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 */ ); Loading Loading @@ -3881,14 +3876,14 @@ 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 *transport_channels_f[] /* i/o: synthesized core-coder transport channels/DirAC output*/ ); #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 the transport channels */ ); #endif Loading Loading @@ -5630,6 +5625,18 @@ 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 */ ); #endif void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); Loading @@ -5638,6 +5645,8 @@ ISM_MODE ivas_osba_ism_mode_select( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t nchan_ism /* i : number of input ISM's */ ); /*----------------------------------------------------------------------------------* * OMASA prototypes *---------------------------------------------------------------------------------*/ Loading
lib_com/ivas_spar_com.c +4 −0 Original line number Diff line number Diff line Loading @@ -1257,7 +1257,11 @@ static void ivas_calc_mat_inv( int16_t sign = 1; ivas_calc_mat_det( dbl_in_re, dim, &det_re ); #ifdef NONBE_FIX_1213_SBA_DET_MAT_INV_3BY3 det = det_re > 0 ? 1 / max( IVAS_DBL_EPS, det_re ) : 1 / min( det_re, -IVAS_DBL_EPS ); #else det = det_re > 0 ? 1 / max( IVAS_DBL_EPS, det_re ) : min( det_re, -IVAS_DBL_EPS ); #endif for ( i = 0; i < dim; i++ ) { Loading