Commit 55144c75 authored by vaclav's avatar vaclav
Browse files

issue 708: sanity checks for '-dpid' command-line; under FIX_708_DPID_COMMAND_LINE

parent 08510066
Loading
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -144,6 +144,9 @@ typedef struct
#endif
#endif
    uint16_t acousticEnvironmentId;
#ifdef FIX_708_DPID_COMMAND_LINE
    int16_t Opt_dpid_on;
#endif
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
    bool framing_5ms;
} DecArguments;
@@ -451,7 +454,11 @@ int main(
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

#ifdef FIX_708_DPID_COMMAND_LINE
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.Opt_dpid_on, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -996,6 +1003,9 @@ static bool parseCmdlIVAS_dec(

    arg->renderConfigEnabled = false;
    arg->renderConfigFilename = NULL;
#ifdef FIX_708_DPID_COMMAND_LINE
    arg->Opt_dpid_on = 0;
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
    arg->outputMdFilename = NULL;
@@ -1398,14 +1408,46 @@ static bool parseCmdlIVAS_dec(
        }
        else if ( strcmp( argv_to_upper, "-DPID" ) == 0 )
        {
#ifdef FIX_708_DPID_COMMAND_LINE
            arg->Opt_dpid_on = 1;
#endif
            ++i;
            int16_t tmp;
            tmp = 0;
            while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS )
            {
                arg->directivityPatternId[tmp] = (int16_t) atoi( argv[i + tmp] );

#ifdef FIX_708_DPID_COMMAND_LINE
                if ( arg->directivityPatternId[tmp] < 0 || arg->directivityPatternId[tmp] > 4 )
                {
                    fprintf( stdout, "Error: Invalid directivity pattern ID specified: %s\n\n", argv[i + tmp] );
                    usage_dec();
                    return false;
                }
#endif
                ++tmp;
            }

#ifdef FIX_708_DPID_COMMAND_LINE
            if ( tmp == 0 )
            {
                if ( argc - i <= 4 || argv[i][0] == '-' )
                {
                    fprintf( stderr, "Error: Directivity pattern ID not specified!\n\n" );
                    usage_dec();
                    return false;
                }

                if ( !is_number( argv[i + tmp] ) )
                {
                    fprintf( stdout, "Error: Invalid directivity pattern ID specified: %s\n\n", argv[i + tmp] );
                    usage_dec();
                    return false;
                }
            }
#endif

            i += tmp;
        }

@@ -1589,7 +1631,12 @@ static void usage_dec( void )
    fprintf( stdout, "-force R            : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" );
#endif
    fprintf( stdout, "-exof File          : External orientation File for external orientation trajectory\n" );
#ifdef FIX_708_DPID_COMMAND_LINE
    fprintf( stdout, "-dpid ID            : Directivity pattern ID(s) = (1,2,3,4) (space-separated list of up\n" );
    fprintf( stdout, "                      to 4 numbers can be specified) for binaural output configuration\n" );
#else
    fprintf( stdout, "-dpid ID            : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration\n" );
#endif
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
    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" );
+7 −0
Original line number Diff line number Diff line
@@ -76,6 +76,9 @@ typedef enum
    IVAS_ERR_INVALID_OUTPUT_FORMAT,
    IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED,
    IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED,
#ifdef FIX_708_DPID_COMMAND_LINE
    IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED,
#endif
    IVAS_ERR_INVALID_HRTF,
    IVAS_ERR_INVALID_INPUT_FORMAT,
    IVAS_ERR_INVALID_INDEX, /* ToDo: should be merged with IVAS_ERR_INDEX_OUT_OF_BOUNDS */
@@ -249,6 +252,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code )
#endif
        case IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED:
            return "External orientation not supported";
#ifdef FIX_708_DPID_COMMAND_LINE
        case IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED:
            return "Directivity not supported";
#endif
        case IVAS_ERR_INVALID_HRTF:
            return "Unsupported HRTF filter set";
        case IVAS_ERR_INVALID_INPUT_FORMAT:
+2 −0
Original line number Diff line number Diff line
@@ -161,6 +161,8 @@

#define FIX_718_JBM_MD_UDPATE                           /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */
#define FIX_719_CRASH_IN_CLEANUP                        /* VA: issue 719: fix Decoder crash after call to goto to cleanup */
#define FIX_708_DPID_COMMAND_LINE                       /* issue 708: sanity checks for '-dpid' command-line */



/* ################## End BE DEVELOPMENT switches ######################### */
+15 −0
Original line number Diff line number Diff line
@@ -3017,6 +3017,21 @@ static ivas_error doSanityChecks_IVAS(
        }
    }

#ifdef FIX_708_DPID_COMMAND_LINE
    if ( st_ivas->hDecoderConfig->Opt_dpid_on )
    {
        if ( st_ivas->hHrtfTD == NULL )
        {
            return IVAS_ERROR( IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, "Wrong set-up: Directivity is supported in the TD renderer only." );
        }

        if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
        {
            return IVAS_ERROR( IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, "Wrong set-up: Directivity is not supported in this output configuration." );
        }
    }
#endif

    if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
    {
        if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && output_config == AUDIO_CONFIG_EXTERNAL )
+3 −0
Original line number Diff line number Diff line
@@ -903,6 +903,9 @@ typedef struct decoder_config_structure
    float non_diegetic_pan_gain;            /* non diegetic panning gain*/
    int16_t Opt_AMR_WB;                     /* flag indicating AMR-WB IO mode */
    int16_t Opt_ExternalOrientation;        /* indiates whether external orientations are used */
#ifdef FIX_708_DPID_COMMAND_LINE
    int16_t Opt_dpid_on; /* indicates whether Directivity pattern option is used */
#endif

    /* temp. development parameters */
#ifdef DEBUGGING
Loading