Commit db50fd50 authored by vaclav's avatar vaclav
Browse files

add sanity check for using objects editing; define related API error;...

add sanity check for using objects editing; define related API error; print-out an info when objects editing is enabled
parent e9c84ee4
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -432,8 +432,13 @@ int main(
    asked_frame_size = arg.renderFramesize;
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;

#ifdef OBJ_EDITING_EXAMPLE
    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;
@@ -1768,13 +1773,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 OMASA_OBJECT_EDITING
    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" );
+7 −0
Original line number Diff line number Diff line
@@ -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,
@@ -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:
+9 −0
Original line number Diff line number Diff line
@@ -2922,6 +2922,15 @@ static ivas_error doSanityChecks_IVAS(
        }
    }

#ifdef OBJ_EDITING_API
    if ( st_ivas->hDecoderConfig->Opt_ObjEdit_on )
    {
        if ( !( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) )
        {
            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 ) ) )
    {
+3 −0
Original line number Diff line number Diff line
@@ -1030,6 +1030,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_API
    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) */
+18 −2
Original line number Diff line number Diff line
@@ -323,6 +323,9 @@ static void init_decoder_config(
    hDecoderConfig->Opt_ExternalOrientation = 0;
    hDecoderConfig->Opt_dpid_on = 0;
    hDecoderConfig->Opt_aeid_on = 0;
#ifdef OBJ_EDITING_API
    hDecoderConfig->Opt_ObjEdit_on = 0;
#endif

    return;
}
@@ -439,6 +442,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_API
    const bool objEditEnabled, /* i  : enable object editing                            */
#endif
    const bool delayCompensationEnabled /* i  : enable delay compensation                        */
)
{
@@ -498,6 +504,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_API
    hDecoderConfig->Opt_ObjEdit_on = (int16_t) objEditEnabled;
#endif

    if ( renderFramesize == IVAS_RENDER_FRAMESIZE_UNKNOWN )
    {
@@ -1071,7 +1080,7 @@ ivas_error IVAS_DEC_GetEditableParameters(
            ( 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 ) ) ) )
    {
        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." );
    }

    if ( hIvasEditableParameters == NULL || hIvasDec == NULL || hIvasDec->st_ivas == NULL )
@@ -3929,6 +3938,13 @@ static ivas_error printConfigInfo_dec(
        {
            fprintf( stdout, "Acoustic environment ID:ON\n" );
        }
#ifdef OBJ_EDITING_API

        if ( st_ivas->hDecoderConfig->Opt_ObjEdit_on )
        {
            fprintf( stdout, "Objects editing :       ON\n" );
        }
#endif
    }

    /*-----------------------------------------------------------------*
Loading