Commit fe51cca8 authored by emerit's avatar emerit
Browse files

replace no_diegetic by non_diegetic; reuse in code azimut for non diegitic pan

parent fda6a041
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@
#endif
#include "wmc_auto.h"
#include "render_config_reader.h"
#ifdef NO_DIEGETIC_PAN
#ifdef NON_DIEGETIC_PAN
#ifndef FLT_MAX
#define FLT_MAX ( 3.402823466e+38F )
#endif
@@ -111,7 +111,9 @@ typedef struct
    bool customLsOutputEnabled;
    char *customLsSetupFilename;
    int16_t orientation_tracking;
    float no_diegetic_pan;
#ifdef NON_DIEGETIC_PAN    
    float non_diegetic_pan;
#endif
    bool renderConfigEnabled;
    char *renderConfigFilename;

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

    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking, arg.no_diegetic_pan ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking, arg.non_diegetic_pan ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -792,10 +794,10 @@ static bool parseCmdlIVAS_dec(
    arg->renderConfigFilename = NULL;

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

    /*-----------------------------------------------------------------*
@@ -1022,10 +1024,10 @@ static bool parseCmdlIVAS_dec(
            }
            i += 2;
        }
        else if ( strcmp( argv_to_upper, "-NO_DIEGETIC_PAN" ) == 0 )
        else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 )
        {
            i++;
#ifdef NO_DIEGETIC_PAN
#ifdef NON_DIEGETIC_PAN
            if ( argv[i][0] == '-' ) /* negative value or error*/
            {
                if ( strlen( argv[i] ) > 1 )
@@ -1056,21 +1058,21 @@ 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->no_diegetic_pan = 0.f;
                arg->non_diegetic_pan = 0.f;
            }
            else if ( ( strcmp( argv_to_upper, "LEFT" ) == 0 ) || ( strchr( argv_to_upper, 'L' ) != NULL ) )
            {
                arg->no_diegetic_pan = -1.f;
                arg->non_diegetic_pan = -1.f;
            }
            else if ( ( strcmp( argv_to_upper, "RIGHT" ) == 0 ) || ( strchr( argv_to_upper, 'R' ) != NULL ) )
            {
                arg->no_diegetic_pan = 1.f;
                arg->non_diegetic_pan = 1.f;
            }
            else
            {
                arg->no_diegetic_pan = (float) atof( argv_to_upper );
                arg->non_diegetic_pan = (float) atof( argv_to_upper );

                if ( arg->no_diegetic_pan > 1.0f || arg->no_diegetic_pan < -1.0f )
                if ( arg->non_diegetic_pan > 1.0f || arg->non_diegetic_pan < -1.0f )
                {
                    fprintf( stderr, "Error: Incorrect value for panning option argument specified: %s\n\n", argv[i] );
                    usage_dec();
@@ -1113,8 +1115,8 @@ 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 ) )
#ifdef NON_DIEGETIC_PAN
    if ( ( arg->non_diegetic_pan <= 1.f ) && ( arg->non_diegetic_pan >= -1.f ) )
    {
        arg->outputFormat = IVAS_DEC_OUTPUT_STEREO;
    }
@@ -1225,7 +1227,7 @@ static void usage_dec( void )
    fprintf( stdout, "-rvf File           : Reference vector specified by external trajectory file\n" );
    fprintf( stdout, "                      works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" );
    fprintf( stdout, "-render_config File : Renderer configuration File\n" );
    fprintf( stdout, "-no_diegetic_pan    : panning mono non-diegetic sound to stereo -1<= pan <=1,\n" );
    fprintf( stdout, "-non_diegetic_pan    : panning mono non-diegetic sound to stereo -1<= pan <=1,\n" );
    fprintf( stdout, "                      left or l or 1->left, right or r or -1->right, center or c or  0->middle\n" );
    fprintf( stdout, "-q                  : Quiet mode, no frame counter\n" );
    fprintf( stdout, "                      default is deactivated\n" );
+7 −7
Original line number Diff line number Diff line
@@ -235,9 +235,9 @@ static const CmdLnParser_Option cliOptions[] = {
    },
    {
        .id = CmdLnOptionId_noDiegeticPan,
        .match = "no_diegetic_pan",
        .match = "non_diegetic_pan",
        .matchShort = "ndp",
        .description = "Panning mono no diegetic sound to stereo -1<= pan <= 1\nleft or l or 1->left, right or r or -1->right, center or c or 0 ->middle\n(todo: implementation)",
        .description = "Panning mono non diegetic sound to stereo -1<= pan <= 1\nleft or l or 1->left, right or r or -1->right, center or c or 0 ->middle\n(todo: implementation)",
    },
    {
        .id = CmdLnOptionId_orientationTracking,
@@ -551,10 +551,10 @@ int main(

    CmdlnArgs args = parseCmdlnArgs( argc, argv );

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

#ifdef NO_DIEGETIC_PAN
#ifdef NON_DIEGETIC_PAN
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.noDiegeticPan ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
@@ -1389,7 +1389,7 @@ static bool parseDiegeticPan(
            return false;
        }
    }
#ifdef NO_DIEGETIC_PAN
#ifdef NON_DIEGETIC_PAN
    return true;
#else
    return false;
@@ -1646,7 +1646,7 @@ static CmdlnArgs defaultArgs(
    clearString( args.renderConfigFilePath );

    args.orientationTracking = IVAS_ORIENT_TRK_NONE;
#ifdef NO_DIEGETIC_PAN
#ifdef NON_DIEGETIC_PAN
    args.noDiegeticPan = FLT_MAX; /* intialize with a value such as abs(value) > 1 */
#else
    args.noDiegeticPan = 0.0f;
+2 −2
Original line number Diff line number Diff line
@@ -80,9 +80,9 @@ typedef struct _IVAS_ISM_METADATA
    float gainFactor;
    float yaw;
    float pitch;
#ifdef ISM_NO_DIEGETIC_PAN
#ifdef ISM_NON_DIEGETIC_PAN
    uint16_t metadata_flag;
    float no_diegetic_pan;
//    float non_diegetic_pan;
#endif
} IVAS_ISM_METADATA;

+14 −14
Original line number Diff line number Diff line
@@ -153,9 +153,9 @@ typedef enum
    RENDERER_PARAM_ISM,
    RENDERER_BINAURAL_MIXER_CONV,
    RENDERER_BINAURAL_MIXER_CONV_ROOM
#ifdef NO_DIEGETIC_PAN
#ifdef NON_DIEGETIC_PAN
    ,
    RENDERER_NO_DIEGETIC_DOWNMIX
    RENDERER_NON_DIEGETIC_DOWNMIX
#endif

} RENDERER_TYPE;
@@ -170,8 +170,8 @@ typedef enum
#define HEAD_ROTATION_HOA_ORDER                 3                           /* HOA 3rd order */
#define MAX_CICP_CHANNELS                       16                          /* max channels for loudspeaker layouts (16 for custom layouts)*/
#define MAX_OUTPUT_CHANNELS                     16                          /* Maximum number of output channels (HOA 3rd order) */
#ifdef NO_DIEGETIC_PAN
#define MAX_OUTPUT_CHANNELS_NI_DIEGETIC_PAN     2                          /* Maximum number of output channels with no diegetic pan */
#ifdef NON_DIEGETIC_PAN
#define MAX_OUTPUT_CHANNELS_NI_DIEGETIC_PAN     2                          /* Maximum number of output channels with non diegetic pan */
#endif

#define BINAURAL_CHANNELS                       2                           /* number of channels for binaural output configuration */
@@ -313,11 +313,11 @@ typedef enum
#define ISM_MEDIUM_IMP                          2
#define ISM_HIGH_IMP                            3

#ifdef ISM_NO_DIEGETIC_PAN
#define ISM_NO_DIEGETIC_PAN_NBITS                       5
#define ISM_NO_DIEGETIC_PAN_MIN                         -1.0f
#define ISM_NO_DIEGETIC_PAN_DELTA                        0.125f /* Max Pan = ISM_NO_DIEGETIC_PAN_MIN + (2^ISM_RADIUS_NBITS-1)*0.125 = 1 */
#endif
// #ifdef ISM_NON_DIEGETIC_PAN
// #define ISM_NON_DIEGETIC_PAN_NBITS                       5
// #define ISM_NON_DIEGETIC_PAN_MIN                         -1.0f
// #define ISM_NON_DIEGETIC_PAN_DELTA                        0.125f /* Max Pan = ISM_NON_DIEGETIC_PAN_MIN + (2^ISM_RADIUS_NBITS-1)*0.125 = 1 */
// #endif

#define ISM_AZIMUTH_NBITS                       7
#define ISM_AZIMUTH_MIN                         -180.0f
@@ -412,9 +412,9 @@ enum
    IND_ISM_ELEVATION = TAG_ISM_LOOP_START,
    IND_ISM_RADIUS_DIFF_FLAG = TAG_ISM_LOOP_START,
    IND_ISM_RADIUS = TAG_ISM_LOOP_START,
#ifdef ISM_NO_DIEGETIC_PAN
    IND_ISM_NO_DIEGETIC_PAN_DIFF_FLAG = TAG_ISM_LOOP_START,
    IND_ISM_NO_DIEGETIC_PAN = TAG_ISM_LOOP_START,
#ifdef ISM_NON_DIEGETIC_PAN
    IND_ISM_NON_DIEGETIC_PAN_DIFF_FLAG = TAG_ISM_LOOP_START,
    IND_ISM_NON_DIEGETIC_PAN = TAG_ISM_LOOP_START,
#endif 
    TAG_ISM_LOOP_END = TAG_ISM_LOOP_START + 100, /* IVAS_fmToDo: to be reviewed once the final metadata are defined */
    /* --------- end of loop for objects ----------- */
@@ -1510,9 +1510,9 @@ typedef enum
{
    TDREND_PLAYSTATUS_INITIAL,
    TDREND_PLAYSTATUS_PLAYING
#ifdef ISM_NO_DIEGETIC_PAN    
#ifdef ISM_NON_DIEGETIC_PAN    
    ,
    TDREND_PLAYSTATUS_PLAYING_NO_DIEGETIC
    TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC
#endif    
} TDREND_PlayStatus_t;

+12 −5
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@
#define BETA_ISM_LOW_IMP    0.6f
#define BETA_ISM_MEDIUM_IMP 0.8f


/*-------------------------------------------------------------------*
 * bitbudget_to_brate()
 *
@@ -94,7 +93,7 @@ ivas_error ivas_ism_config(
    ISM_METADATA_HANDLE hIsmMeta[],          /* i/o: ISM metadata handles        	*/
    const int16_t localVAD[MAX_NUM_OBJECTS], /* i  : local VAD flag              	*/
    const int16_t ism_imp[],                 /* i  : ISM importance flags        	*/
#ifdef ISM_NO_DIEGETIC_PAN
#ifdef ISM_NON_DIEGETIC_PAN
    const int16_t ism_extended_metadata_flag, /* i  : Extended metadata flag          */
#endif
    int32_t element_brate[],   /* o  : element bitrate per object  */
@@ -143,7 +142,7 @@ ivas_error ivas_ism_config(

        for ( ch = 0; ch < n_ISms; ch++ )
        {
#ifdef ISM_NO_DIEGETIC_PAN
#ifdef ISM_NON_DIEGETIC_PAN
            if ( ( hIsmMeta[ch]->ism_metadata_flag == 0 ) || ( ism_extended_metadata_flag ) )
            {
                nb_bits_metadata[0] += ISM_METADATA_VAD_FLAG_BITS;
@@ -347,9 +346,17 @@ void ivas_ism_reset_metadata(
    hIsmMeta->yaw = 0.0f;
    hIsmMeta->pitch = 0.0f;
    hIsmMeta->radius = 1.0f;
#ifdef ISM_NO_DIEGETIC_PAN
    hIsmMeta->no_diegetic_pan = FLT_MAX;
#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 = 0;
    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;
Loading