Commit 0ed91fad authored by emerit's avatar emerit
Browse files

add sanity check

parent 9f62fc0a
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1037,13 +1037,13 @@ static bool parseCmdlIVAS_dec(
    {
        arg->outputFormat = IVAS_DEC_OUTPUT_MONO;
        arg->decMode = IVAS_DEC_MODE_EVS;
    }
#ifdef NO_DIEGETIC_PAN
    if ( ( arg->no_diegetic_pan <= 1.f ) && ( arg->no_diegetic_pan >= -1.f ) )
    {
        arg->outputFormat = IVAS_DEC_OUTPUT_STEREO;
    }
#endif
    }

    /*-----------------------------------------------------------------*
     * Output sampling frequency
+30 −0
Original line number Diff line number Diff line
@@ -2053,6 +2053,12 @@ static ivas_error doSanityChecks_IVAS(
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Wrong output configuration specified for Stereo!" );
        }
#ifdef NO_DIEGETIC_PAN
        if ( ( fabs( st_ivas->hDecoderConfig->no_diegetic_pan ) <= 1.0f ) )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Wrong output configuration specified for Stereo!" );
        }
#endif
    }
    else if ( st_ivas->ivas_format == ISM_FORMAT )
    {
@@ -2061,6 +2067,12 @@ static ivas_error doSanityChecks_IVAS(
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for ISm" );
        }
#ifdef NO_DIEGETIC_PAN
        if ( ( fabs( st_ivas->hDecoderConfig->no_diegetic_pan ) <= 1.0f ) && ( st_ivas->transport_config != AUDIO_CONFIG_ISM1 ) )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for ISm" );
        }
#endif
    }
    else if ( st_ivas->ivas_format == SBA_FORMAT )
    {
@@ -2069,6 +2081,12 @@ static ivas_error doSanityChecks_IVAS(
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for SBA" );
        }
#ifdef NO_DIEGETIC_PAN
        if ( ( fabs( st_ivas->hDecoderConfig->no_diegetic_pan ) <= 1.0f ) )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for SBA" );
        }
#endif
    }
    else if ( st_ivas->ivas_format == MASA_FORMAT )
    {
@@ -2076,6 +2094,12 @@ static ivas_error doSanityChecks_IVAS(
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for MASA!" );
        }
#ifdef NO_DIEGETIC_PAN
        if ( ( fabs( st_ivas->hDecoderConfig->no_diegetic_pan ) <= 1.0f ) )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for MASA!" );
        }
#endif
    }
    else if ( st_ivas->ivas_format == MC_FORMAT )
    {
@@ -2084,6 +2108,12 @@ static ivas_error doSanityChecks_IVAS(
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for Multi-channel" );
        }
#ifdef NO_DIEGETIC_PAN
        if ( ( fabs( st_ivas->hDecoderConfig->no_diegetic_pan ) <= 1.0f ) )
        {
            return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for Multi-channel" );
        }
#endif
    }

    if ( st_ivas->hDecoderConfig->Opt_Headrotation )
+1 −1
Original line number Diff line number Diff line
@@ -423,7 +423,7 @@ ivas_error IVAS_DEC_Configure(
    }

#ifdef NO_DIEGETIC_PAN
    if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && outputFormat != IVAS_DEC_OUTPUT_MONO && ( fabs( hIvasDec->st_ivas->hDecoderConfig->no_diegetic_pan ) > 1.0f ) )
    if ( ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) && ( outputFormat != IVAS_DEC_OUTPUT_MONO ) && ( fabs( hIvasDec->st_ivas->hDecoderConfig->no_diegetic_pan ) > 1.0f ) )
    {
        return IVAS_ERR_WRONG_MODE;
    }