Commit 7d4f4e90 authored by emerit's avatar emerit
Browse files

VoiceAge suggestions

parent e25da5be
Loading
Loading
Loading
Loading
+39 −16
Original line number Diff line number Diff line
@@ -50,11 +50,6 @@
#endif
#include "wmc_auto.h"
#include "render_config_reader.h"
#ifdef NON_DIEGETIC_PAN
#ifndef FLT_MAX
#define FLT_MAX ( 3.402823466e+38F )
#endif
#endif
#include "hrtf_file_reader.h"


@@ -111,7 +106,12 @@ typedef struct
    bool customLsOutputEnabled;
    char *customLsSetupFilename;
    int16_t orientation_tracking;
    float non_diegetic_pan;
#ifdef NON_DIEGETIC_PAN
    int16_t non_diegetic_pan;
    float non_diegetic_pan_gain;
#else
    float no_diegetic_pan;
#endif
    bool renderConfigEnabled;
    char *renderConfigFilename;

@@ -195,7 +195,11 @@ int main(
     * Open decoder handle
     *------------------------------------------------------------------------------------------*/

    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking, arg.non_diegetic_pan ) ) != IVAS_ERR_OK )
#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking, arg.non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking, arg.no_diegetic_pan ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -793,11 +797,11 @@ static bool parseCmdlIVAS_dec(

    arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192;
#ifdef NON_DIEGETIC_PAN
    arg->non_diegetic_pan = FLT_MAX;
    arg->non_diegetic_pan = 0;
    arg->non_diegetic_pan_gain = 0.f;
#else
    arg->non_diegetic_pan = 0.f;
    arg->no_diegetic_pan = 0.f;
#endif

    /*-----------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/
@@ -1044,6 +1048,7 @@ static bool parseCmdlIVAS_dec(
                    return false;
                }
            }
            arg->non_diegetic_pan = 1;
#else
            if ( argc - i <= 4 || ( argv[i][0] == '-' ) )
            {
@@ -1056,21 +1061,39 @@ static bool parseCmdlIVAS_dec(
            argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
            if ( ( strcmp( argv_to_upper, "CENTER" ) == 0 ) || ( strchr( argv_to_upper, 'C' ) != NULL ) )
            {
                arg->non_diegetic_pan = 0.f;
#ifdef NON_DIEGETIC_PAN
                arg->non_diegetic_pan_gain = 0.f;
#else
                arg->no_diegetic_pan = 0.f;
#endif
            }
            else if ( ( strcmp( argv_to_upper, "LEFT" ) == 0 ) || ( strchr( argv_to_upper, 'L' ) != NULL ) )
            {
                arg->non_diegetic_pan = -1.f;
#ifdef NON_DIEGETIC_PAN
                arg->non_diegetic_pan_gain = 1.f;
#else
                arg->no_diegetic_pan = 1.f;
#endif
            }
            else if ( ( strcmp( argv_to_upper, "RIGHT" ) == 0 ) || ( strchr( argv_to_upper, 'R' ) != NULL ) )
            {
                arg->non_diegetic_pan = 1.f;
#ifdef NON_DIEGETIC_PAN
                arg->non_diegetic_pan_gain = -1.f;
#else
                arg->no_diegetic_pan = -1.f;
#endif
            }
            else
            {
                arg->non_diegetic_pan = (float) atof( argv_to_upper );
#ifdef NON_DIEGETIC_PAN
                arg->non_diegetic_pan_gain = (float) atof( argv_to_upper );

                if ( arg->non_diegetic_pan > 1.0f || arg->non_diegetic_pan < -1.0f )
                if ( arg->non_diegetic_pan_gain > 1.0f || arg->non_diegetic_pan_gain < -1.0f )
#else
                arg->no_diegetic_pan = (float) atof( argv_to_upper );

                if ( arg->no_diegetic_pan > 1.0f || arg->no_diegetic_pan < -1.0f )
#endif
                {
                    fprintf( stderr, "Error: Incorrect value for panning option argument specified: %s\n\n", argv[i] );
                    usage_dec();
@@ -1114,7 +1137,7 @@ static bool parseCmdlIVAS_dec(
        arg->decMode = IVAS_DEC_MODE_EVS;
    }
#ifdef NON_DIEGETIC_PAN
    if ( ( arg->non_diegetic_pan <= 1.f ) && ( arg->non_diegetic_pan >= -1.f ) )
    if ( ( arg->non_diegetic_pan ) )
    {
        arg->outputFormat = IVAS_DEC_OUTPUT_STEREO;
    }
+50 −8
Original line number Diff line number Diff line
@@ -136,7 +136,12 @@ typedef struct
    char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    int8_t orientationTracking;
#ifdef NON_DIEGETIC_PAN
    int16_t nonDiegeticPan;
    float nonDiegeticPanGain;
#else
    float noDiegeticPan;
#endif
    bool delayCompensationEnabled;
    bool quietModeEnabled;
    bool sceneDescriptionInput;
@@ -552,12 +557,12 @@ int main(
    CmdlnArgs args = parseCmdlnArgs( argc, argv );

#ifdef NON_DIEGETIC_PAN
    if ( ( fabs( args.noDiegeticPan ) <= 1.f ) && ( args.inConfig.multiChannelBuses[0].audioConfig != IVAS_REND_AUDIO_CONFIG_MONO ) && ( args.inConfig.numAudioObjects != 1 ) )
    if ( ( args.nonDiegeticPan ) && ( args.inConfig.multiChannelBuses[0].audioConfig != IVAS_REND_AUDIO_CONFIG_MONO ) && ( args.inConfig.numAudioObjects != 1 ) )
    {
        fprintf( stderr, "invalid configuration non diegetic pan flag required mono input" );
        exit( -1 );
    }
    if ( fabs( args.noDiegeticPan ) <= 1.0f )
    if ( args.nonDiegeticPan )
    {
        args.outConfig.audioConfig = IVAS_REND_AUDIO_CONFIG_STEREO;
    }
@@ -678,7 +683,7 @@ int main(
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] = { 0 };

#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.noDiegeticPan ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
#endif
@@ -1350,6 +1355,38 @@ static bool parseOutConfig(
    return true;
}

#ifdef NON_DIEGETIC_PAN
static bool parseDiegeticPan(
    char *value,
    float *nonDiegeticPan )
{
    to_upper( value );

    if ( ( strcmp( value, "CENTER" ) == 0 ) || ( strchr( value, 'C' ) != NULL ) )
    {
        *nonDiegeticPan = 0.f;
    }
    else if ( ( strcmp( value, "LEFT" ) == 0 ) || ( strchr( value, 'L' ) != NULL ) )
    {
        *nonDiegeticPan = 1.f;
    }
    else if ( ( strcmp( value, "RIGHT" ) == 0 ) || ( strchr( value, 'R' ) != NULL ) )
    {
        *nonDiegeticPan = -1.f;
    }
    else
    {
        *nonDiegeticPan = (float) atof( value );

        if ( *nonDiegeticPan > 1.0f || *nonDiegeticPan < -1.0f )
        {
            fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" );
            return false;
        }
    }
    return true;

#else
static bool parseDiegeticPan(
    char *value,
    float *noDiegeticPan )
@@ -1378,9 +1415,6 @@ static bool parseDiegeticPan(
            return false;
        }
    }
#ifdef NON_DIEGETIC_PAN
    return true;
#else
    return false;
#endif
}
@@ -1636,7 +1670,8 @@ static CmdlnArgs defaultArgs(

    args.orientationTracking = IVAS_ORIENT_TRK_NONE;
#ifdef NON_DIEGETIC_PAN
    args.noDiegeticPan = FLT_MAX; /* intialize with a value such as abs(value) > 1 */
    args.nonDiegeticPan = 0; /* intialize with a value such as abs(value) > 1 */
    args.nonDiegeticPanGain = 0.f;
#else
    args.noDiegeticPan = 0.0f;
#endif
@@ -1731,11 +1766,18 @@ static void parseOption(
            break;
        case CmdLnOptionId_noDiegeticPan:
            assert( numOptionValues == 1 );
#ifdef NON_DIEGETIC_PAN
            if ( !parseDiegeticPan( optionValues[0], &args->nonDiegeticPanGain ) )
#else
            if ( !parseDiegeticPan( optionValues[0], &args->noDiegeticPan ) )
#endif
            {
                fprintf( stderr, "Unknown option for diegetic panning: %s\n", optionValues[0] );
                exit( -1 );
            }
#ifdef NON_DIEGETIC_PAN
            args->nonDiegeticPan = 1;
#endif
            break;
        case CmdLnOptionId_orientationTracking:
            assert( numOptionValues == 1 );
+1 −14
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ typedef enum
    RENDERER_PARAM_ISM,
    RENDERER_BINAURAL_MIXER_CONV,
    RENDERER_BINAURAL_MIXER_CONV_ROOM
#ifdef NON_DIEGETIC_PAN
#if defined NON_DIEGETIC_PAN || defined ISM_NON_DIEGETIC_PAN
    ,
    RENDERER_NON_DIEGETIC_DOWNMIX
#endif
@@ -374,11 +374,6 @@ typedef enum
enum
{
    IND_ISM_NUM_OBJECTS,
#ifdef ISM_NON_DIEGETIC_PAN_SID    
    IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS,   
    IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
    IND_ISM_NOISY_SPEECH_FLAG,
#else
    IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS,
#ifdef ISM_NON_DIEGETIC_PAN    
    IND_ISM_EXTENDED_NDP_FLAG, 
@@ -386,18 +381,10 @@ enum
    IND_ISM_METADATA_FLAG,
    IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
    IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS,
#endif    
    IND_ISM_SCE_ID_DTX,
    IND_ISM_DTX_COH_SCA,
#ifdef ISM_NON_DIEGETIC_PAN_SID    
    IND_ISM_EXTENDED_FLAG = IND_ISM_DTX_COH_SCA + MAX_NUM_OBJECTS,
    IND_ISM_EXTENDED_NDP_FLAG, 
    /* ------------- loop for objects -------------- */
    TAG_ISM_LOOP_START = IND_ISM_EXTENDED_NDP_FLAG + MAX_NUM_OBJECTS,
#else    
    /* ------------- loop for objects -------------- */
    TAG_ISM_LOOP_START = IND_ISM_DTX_COH_SCA + MAX_NUM_OBJECTS,
#endif
#ifdef ISM_NON_DIEGETIC_PAN    
    IND_ISM_NDP_FLAG = TAG_ISM_LOOP_START,
#endif    
+3 −0
Original line number Diff line number Diff line
@@ -69,6 +69,9 @@ typedef enum
    IVAS_ERR_DTX_NOT_SUPPORTED,
    IVAS_ERR_UNEXPECTED_NULL_POINTER,
    IVAS_ERR_METADATA_NOT_EXPECTED,
#ifdef ISM_NON_DIEGETIC_PAN
    IVAS_ERR_NON_DIEGETIC_PAN_METADATA_NOT_EXPECTED,
#endif
    IVAS_ERR_INVALID_SPAR_CONFIG,
    IVAS_ERR_WRONG_PARAMS,
    IVAS_ERR_INIT_ERROR,
+0 −14
Original line number Diff line number Diff line
@@ -346,18 +346,6 @@ void ivas_ism_reset_metadata(
    hIsmMeta->yaw = 0.0f;
    hIsmMeta->pitch = 0.0f;
    hIsmMeta->radius = 1.0f;
#ifdef ISM_NON_DIEGETIC_PAN
    // hIsmMeta->last_azimuth = 0.f;
    // hIsmMeta->last_true_azimuth = 0.f;
    // hIsmMeta->last_elevation = 0.f;
    // hIsmMeta->last_true_elevation = 0.f;
    hIsmMeta->ism_metadata_flag = 1;
    // hIsmMeta->radius_diff_cnt = 0;
    // hIsmMeta->position_angle.angle1_diff_cnt = 0;
    // hIsmMeta->position_angle.angle2_diff_cnt = 0;
    // hIsmMeta->orientation_angle.angle1_diff_cnt = 0;
    // hIsmMeta->orientation_angle.angle2_diff_cnt = 0;
#endif

    return;
}
@@ -373,9 +361,7 @@ void ivas_ism_reset_metadata_API(
    ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle     */
)
{
#ifndef ISM_NON_DIEGETIC_PAN
    hIsmMeta->ism_metadata_flag = 0;
#endif
    ivas_ism_reset_metadata( hIsmMeta );

    return;
Loading