Commit 98cade9b authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge remote-tracking branch 'origin/main' into...

Merge remote-tracking branch 'origin/main' into 511-optimise-target-gain-computation-in-parametric-binauralizer
parents 68dc3a82 d9d21b15
Loading
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@
IVAS_cod
IVAS_dec
IVAS_rend
IVAS_crend_unit_test
obj/
*.a
*.o
@@ -17,7 +16,6 @@ build*/**/*
IVAS_cod.exe
IVAS_dec.exe
IVAS_rend.exe
IVAS_crend_unit_test.exe
*.user
.vs/
Debug_*/
@@ -25,12 +23,6 @@ Release_*/
*.obj
*.pdb

# Unittests
scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test
scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test.exe
scripts/ivas_pytests/tests/unit_tests/crend/Debug_*/
scripts/ivas_pytests/tests/unit_tests/crend/Release_*/

# Standalone TD object renderer
scripts/td_object_renderer/object_renderer_standalone/renderer_standalone
scripts/td_object_renderer/object_renderer_standalone/renderer_standalone.exe
+28 −1
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ build-codec-instrumented-linux:
  extends:
    - .build-job-linux
    - .rules-basis
  timeout: "6 minutes"
  script:
    - *print-common-info
    - bash ci/build_codec_instrumented_linux.sh
@@ -658,12 +659,38 @@ clang-format-check:
    name: "$ARTIFACT_BASE_NAME"
    expose_as: 'formatting patch'

# check for crashes if first received frame on decoder side is an SID
.check-first-frame-is-sid:
  extends:
    - .test-job-linux-needs-testv-dir
    - .rules-merge-request
  tags:
    - ivas-linux
  stage: test
  needs: ["build-codec-linux-cmake"]
  script:
    - *print-common-info
    - *update-ltv-repo
    - cmake .
    - make -j

    # TODO: for some MASA modes, we currently do not have testvectors that actually trigger DTX
    - modes=$(scripts/runIvasCodec.py -l | grep dtx | grep -v MASA)
    - echo $modes
    - scripts/runIvasCodec.py -p scripts/config/ci_linux_sidstart_test.json -m $modes -s --bs_length 500
  artifacts:
    paths:
      - out/logs
    when: on_failure
    name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart"
    expose_as: "logs-sidstart"

# ---------------------------------------------------------------
# Test jobs for main branch
# ---------------------------------------------------------------

# check bitexactness to EVS windows binaries
be-2-evs-windows:
.be-2-evs-windows: # Temporarily disabled -- Ericsson Windows runner used for HL activities which the reduces capacity for this job. To be resumed after selection
  extends:
    - .rules-main-push
  tags:
+33 −1
Original line number Diff line number Diff line
@@ -98,6 +98,9 @@ typedef struct
    char *outputBitstreamFilename;
    int32_t inputFs;
    IVAS_ENC_INPUT_FORMAT inputFormat;
#ifdef BINAURAL_AUDIO_CMDLINE
    bool is_binaural;
#endif
    EncInputFormatConfig inputFormatConfig;
    bool max_bwidth_user;
    IVAS_ENC_BANDWIDTH maxBandwidth;
@@ -362,17 +365,29 @@ int main(
    switch ( arg.inputFormat )
    {
        case IVAS_ENC_INPUT_MONO:
#ifdef BINAURAL_AUDIO_CMDLINE
            if ( ( error = IVAS_ENC_ConfigureForMono( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, caConfig, arg.inputFormatConfig.stereoToMonoDownmix, arg.is_binaural ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForMono( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, caConfig, arg.inputFormatConfig.stereoToMonoDownmix ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForMono failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                goto cleanup;
            }
            break;
        case IVAS_ENC_INPUT_STEREO:
#ifdef BINAURAL_AUDIO_CMDLINE
#ifdef DEBUGGING
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef DEBUGGING
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig ) ) != IVAS_ERR_OK )
#endif
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForStereo failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
@@ -865,6 +880,9 @@ static void initArgStruct( EncArguments *arg )
    arg->outputBitstreamFilename = NULL;
    arg->inputFs = 0;
    arg->inputFormat = IVAS_ENC_INPUT_MONO;
#ifdef BINAURAL_AUDIO_CMDLINE
    arg->is_binaural = false;
#endif
    arg->inputFormatConfig.stereoToMonoDownmix = false;
    arg->max_bwidth_user = false;
    arg->maxBandwidth = IVAS_ENC_BANDWIDTH_UNDEFINED;
@@ -1207,6 +1225,16 @@ static bool parseCmdlIVAS_enc(
         * IVAS Formats
         *-----------------------------------------------------------------*/

#ifdef BINAURAL_AUDIO_CMDLINE
        else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
        {
            i++;
            if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
            {
                arg->is_binaural = true;
            }
        }
#endif
        else if ( strcmp( argv_to_upper, "-STEREO" ) == 0 )
        {
            i++;
@@ -1487,9 +1515,10 @@ static bool parseCmdlIVAS_enc(
        {
            arg->inputFormat = IVAS_ENC_INPUT_MONO;
            arg->inputFormatConfig.stereoToMonoDownmix = true;

            i++;
        }
        else if ( strcmp( argv_to_upper, "-BYPASS" ) == 0 ) // VE: should be renamed to "-pca"
        else if ( strcmp( argv_to_upper, "-BYPASS" ) == 0 ) // TODO: should be renamed to "-pca"
        {
            i++;
            if ( i < argc - 4 )
@@ -1674,6 +1703,9 @@ static void usage_enc( void )
    fprintf( stdout, "Options:\n" );
    fprintf( stdout, "--------\n" );
    fprintf( stdout, "EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc\n" );
#ifdef BINAURAL_AUDIO_CMDLINE
    fprintf( stdout, "-binaural           : Optional indication that input is binaural audio (to be used with -stereo or -stereo_dmx_evs)\n" );
#endif
    fprintf( stdout, "-stereo             : Stereo format \n" );
    fprintf( stdout, "-ism (+)Ch Files    : ISM format \n" );
    fprintf( stdout, "                      where Ch specifies the number of ISMs (1-4)\n" );
+280 −3
Original line number Diff line number Diff line
@@ -88,6 +88,15 @@ typedef struct
    uint16_t durationCounters[RENDERER_MAX_ISM_INPUTS];                /* Number of frames spent at current position */
} IsmPositionProvider;

#ifdef FIX_296_CFG_LFE_SCENE_DESC
typedef struct
{
    float lfe_azi;
    float lfe_ele;
    float lfe_gain_dB;
    char lfe_routing_mtx[FILENAME_MAX];
} LfeRoutingConfig;
#endif
typedef struct
{
    IVAS_REND_AudioConfig audioConfig;
@@ -242,7 +251,11 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_nonDiegeticPan,
        .match = "non_diegetic_pan",
        .matchShort = "ndp",
#ifdef FIX_TODO_NON_DIEGETIC_PAN_NOT_IMPLELENTED_IN_RENDERER
        .description = "Panning mono non diegetic sound to stereo -90<= pan <= 90\nleft or l or 90->left, right or r or -90->right, center or c or 0 ->middle\n",
#else
        .description = "Panning mono non diegetic sound to stereo -90<= pan <= 90\nleft or l or 90->left, right or r or -90->right, center or c or 0 ->middle\n(todo: implementation)",
#endif
    },
    {
        .id = CmdLnOptionId_orientationTracking,
@@ -301,7 +314,11 @@ static const int32_t numCliOptions = sizeof( cliOptions ) / sizeof( CmdLnParser_

static IVAS_REND_AudioConfig ambisonicsOrderToEnum( const int16_t order );

#ifdef FIX_296_CFG_LFE_SCENE_DESC
static void parseSceneDescriptionFile( char *path, char *audioFilePath, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders, LfeRoutingConfig **lfeRoutingConfigs );
#else
static void parseSceneDescriptionFile( char *path, char *audioFilePath, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders );
#endif

static ivas_error parseCustomLayoutFile( const char *filePath, IVAS_CUSTOM_LS_DATA *pLsSetupCustom );

@@ -313,6 +330,11 @@ static void IsmPositionProvider_getNextFrame( IsmPositionProvider *positionProvi

static void IsmPositionProvider_close( IsmPositionProvider *positionProvider );

#ifdef FIX_296_CFG_LFE_SCENE_DESC
static LfeRoutingConfig *LfeRoutingConfig_open( void );
static void LfeRoutingConfig_close( LfeRoutingConfig *lfeRoutingCfg );
#endif

static void readFromShorthandMetadata( IsmPositionProvider *positionProvider, ObjectPositionBuffer *objectMetadataBuffer, const uint32_t objIdx );

void getMetadataFromFileReader( IsmFileReader *ismReader, ObjectPositionBuffer *objectMetadataBuffer, const uint32_t objIdx );
@@ -331,7 +353,11 @@ static int8_t parseInt32( const char *line, int32_t *ret );

static void parseObjectPosition( char *line, IVAS_REND_AudioObjectPosition *position, uint16_t *positionDuration );

#ifdef FIX_296_CFG_LFE_SCENE_DESC
static void parseMetadata( char *metadataString, char *inDir, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders, LfeRoutingConfig **lfeRoutingConfigs );
#else
static void parseMetadata( char *metadataString, char *inDir, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders );
#endif

static ivas_error parseLfePanMtxFile( const char *lfeRoutingMatrixFilePath, IVAS_REND_LfePanMtx *lfePanMtx );

@@ -520,6 +546,9 @@ int main(
    HeadRotFileReader *referenceRotReader = NULL;
    hrtfFileReader *hrtfFileReader = NULL;
    IsmPositionProvider *positionProvider;
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    LfeRoutingConfig *lfeRoutingConfigs[RENDERER_MAX_MC_INPUTS];
#endif
    RenderConfigReader *renderConfigReader = NULL;
    MasaFileReader *masaReaders[RENDERER_MAX_MASA_INPUTS];
    IVAS_MASA_METADATA_HANDLE hMasaMetadata[RENDERER_MAX_MASA_INPUTS];
@@ -554,6 +583,13 @@ int main(
        hMasaMetadata[i] = NULL;
    }

#ifdef FIX_296_CFG_LFE_SCENE_DESC
    for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i )
    {
        lfeRoutingConfigs[i] = NULL;
    }
#endif

    CmdlnArgs args = parseCmdlnArgs( argc, argv );

    if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_MONO ) ||
@@ -626,7 +662,16 @@ int main(
    if ( args.sceneDescriptionInput )
    {
        /* With scene description input, inputFilePath is the path to the scene description file. Parse it. */
#ifdef FIX_296_CFG_LFE_SCENE_DESC
        parseSceneDescriptionFile( args.inputFilePath,
                                   audioFilePath,
                                   &args.inConfig,
                                   positionProvider,
                                   masaReaders,
                                   lfeRoutingConfigs );
#else
        parseSceneDescriptionFile( args.inputFilePath, audioFilePath, &args.inConfig, positionProvider, masaReaders );
#endif
    }
    else
    {
@@ -749,7 +794,6 @@ int main(
    /* parse input LFE panning matrix */
    if ( args.lfeCustomRoutingEnabled && !isEmptyString( args.inLfePanningMatrixFile ) )
    {
        /* TODO tmu: how should we handle this on CLI for multiple MC inputs? */
        if ( ( error = parseLfePanMtxFile( args.inLfePanningMatrixFile, &lfePanMatrix ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
@@ -771,7 +815,6 @@ int main(
            exit( -1 );
        }

        /* TODO(sgi): Command line only supports one custom LS input for now, extend */
        if ( args.inConfig.multiChannelBuses[i].audioConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM )
        {
            if ( ( error = IVAS_REND_ConfigureCustomInputLoudspeakerLayout( hIvasRend, mcIds[i], args.inConfig.inSetupCustom ) ) != IVAS_ERR_OK )
@@ -785,7 +828,11 @@ int main(
        {
            if ( args.lfePanningEnabled )
            {
#ifdef FIX_296_CFG_LFE_SCENE_DESC
                fprintf( stderr, "Warning: LFE position specified as well as panning matrix! Ignoring position and using gains from panning matrix\n" );
#else
                fprintf( stdout, "Warning LFE position specified as well as panning matrix! Ignoring position and using gains from panning matrix\n" );
#endif
                args.lfePanningEnabled = false;
            }

@@ -804,6 +851,39 @@ int main(
                exit( -1 );
            }
        }
#ifdef FIX_296_CFG_LFE_SCENE_DESC
        else
        {
            /* check for configuration from scene description file */
            if ( lfeRoutingConfigs[i] != NULL )
            {
                /* prioritise panning matrix if configured */
                if ( !isEmptyString( lfeRoutingConfigs[i]->lfe_routing_mtx ) )
                {
                    if ( ( error = parseLfePanMtxFile( lfeRoutingConfigs[i]->lfe_routing_mtx, &lfePanMatrix ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                        exit( -1 );
                    }

                    if ( ( error = IVAS_REND_SetInputLfeMtx( hIvasRend, mcIds[i], (const IVAS_REND_LfePanMtx *) &lfePanMatrix ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                        exit( -1 );
                    }
                }
                /* set position based gains */
                else
                {
                    if ( ( error = IVAS_REND_SetInputLfePos( hIvasRend, mcIds[i], lfeRoutingConfigs[i]->lfe_gain_dB, lfeRoutingConfigs[i]->lfe_azi, lfeRoutingConfigs[i]->lfe_ele ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                        exit( -1 );
                    }
                }
            }
        }
#endif
    }

    for ( i = 0; i < args.inConfig.numAudioObjects; ++i )
@@ -987,7 +1067,7 @@ int main(
        else
        {
            error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL );
            if ( ( error != IVAS_ERR_OK ) && ( error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC
            if ( error != IVAS_ERR_OK && error != IVAS_ERR_INVALID_OUTPUT_FORMAT )
            {
                fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                exit( -1 );
@@ -1164,6 +1244,12 @@ int main(
    {
        MasaFileReader_close( &masaReaders[i] );
    }
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i )
    {
        LfeRoutingConfig_close( lfeRoutingConfigs[i] );
    }
#endif
    AudioFileReader_close( &audioReader );
    AudioFileWriter_close( &audioWriter );
    HeadRotationFileReader_close( &headRotReader );
@@ -1675,8 +1761,13 @@ static CmdlnArgs defaultArgs(

    args.lfePanningEnabled = false;
    args.lfeConfigGain = 1.0f;
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    args.lfeConfigAzimuth = 0.f;
    args.lfeConfigElevation = 0.f;
#else
    args.lfeConfigAzimuth = 0;
    args.lfeConfigElevation = 0;
#endif

    args.lfeCustomRoutingEnabled = false;
    clearString( args.inLfePanningMatrixFile );
@@ -1859,6 +1950,34 @@ IsmPositionProvider *IsmPositionProvider_open(
    return ipp;
}

#ifdef FIX_296_CFG_LFE_SCENE_DESC
LfeRoutingConfig *LfeRoutingConfig_open(
    void )
{
    LfeRoutingConfig *lrc;

    lrc = (LfeRoutingConfig *) malloc( sizeof( LfeRoutingConfig ) );
    lrc->lfe_azi = 0.f;
    lrc->lfe_ele = 0.f;
    lrc->lfe_gain_dB = 0.f;
    lrc->lfe_routing_mtx[0] = '\0';

    return lrc;
}

void LfeRoutingConfig_close(
    LfeRoutingConfig *lfeRoutingCfg )
{
    if ( lfeRoutingCfg != NULL )
    {

        free( lfeRoutingCfg );
    }

    return;
}
#endif

void getMetadataFromFileReader(
    IsmFileReader *ismReader,
    ObjectPositionBuffer *objectMetadataBuffer,
@@ -2148,6 +2267,12 @@ static int8_t parseInt32(

static void parseOptionalInputValues(
    char *line,
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    float *lfe_gain_dB,
    float *lfe_pos_azi,
    float *lfe_pos_ele,
    char *lfe_pan_mtx_filename,
#endif
    float *gain_dB )
{
    char *parse_pos;
@@ -2159,6 +2284,24 @@ static void parseOptionalInputValues(

    /* Set default values, in case some values are not specified */
    *gain_dB = 0.f;
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    if ( lfe_gain_dB != NULL )
    {
        *lfe_gain_dB = 0.f;
    }
    if ( lfe_pos_azi != NULL )
    {
        *lfe_pos_azi = 0.f;
    }
    if ( lfe_pos_ele != NULL )
    {
        *lfe_pos_ele = 0.f;
    }
    if ( lfe_pan_mtx_filename != NULL )
    {
        *lfe_pan_mtx_filename = '\0';
    }
#endif

    /* Save parsing position - will have to be passed to strtok to resume parsing after using strtok with non-NULL value below */
    parse_pos = readNextMetadataChunk( line, "\n" );
@@ -2175,10 +2318,50 @@ static void parseOptionalInputValues(

            if ( *endptr != '\0' )
            {
#ifdef FIX_296_CFG_LFE_SCENE_DESC
                fprintf( stderr, "Cannot parse string \"%s\" as a float value\n", value );
#else
                fprintf( stderr, "Cannot parse string string \"%s\" as a float value\n", value );
#endif
                exit( -1 );
            }
        }
#ifdef FIX_296_CFG_LFE_SCENE_DESC
        else if ( ( strcmp( key, "lfe_gain_dB" ) == 0 ) && lfe_gain_dB != NULL )
        {
            *lfe_gain_dB = (float) strtod( value, &endptr );

            if ( *endptr != '\0' )
            {
                fprintf( stderr, "Cannot parse string \"%s\" as a float value\n", value );
                exit( -1 );
            }
        }
        else if ( ( strcmp( key, "lfe_azi" ) == 0 ) && lfe_pos_azi != NULL )
        {
            *lfe_pos_azi = (float) strtod( value, &endptr );

            if ( *endptr != '\0' )
            {
                fprintf( stderr, "Cannot parse string \"%s\" as a float value\n", value );
                exit( -1 );
            }
        }
        else if ( ( strcmp( key, "lfe_ele" ) == 0 ) && lfe_pos_ele != NULL )
        {
            *lfe_pos_ele = (float) strtod( value, &endptr );

            if ( *endptr != '\0' )
            {
                fprintf( stderr, "Cannot parse string \"%s\" as a float value\n", value );
                exit( -1 );
            }
        }
        else if ( strcmp( key, "lfe_matrix" ) == 0 )
        {
            strncpy( lfe_pan_mtx_filename, value, FILENAME_MAX - 1 );
        }
#endif
        else
        {
            fprintf( stderr, "Unsupported optional key: %s\n", key );
@@ -2264,7 +2447,11 @@ static void parseIsm(
    }

    /* Read optional values */
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    parseOptionalInputValues( line, NULL, NULL, NULL, NULL, &inConfig->audioObjects[idx].gain_dB );
#else
    parseOptionalInputValues( line, &inConfig->audioObjects[idx].gain_dB );
#endif

    return;
}
@@ -2285,7 +2472,11 @@ static void parseSba(
    inConfig->ambisonicsBuses[idx].audioConfig = ambisonicsOrderToEnum( ambiOrder );

    /* Read optional values */
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    parseOptionalInputValues( line, NULL, NULL, NULL, NULL, &inConfig->ambisonicsBuses[idx].gain_dB );
#else
    parseOptionalInputValues( line, &inConfig->ambisonicsBuses[idx].gain_dB );
#endif

    return;
}
@@ -2293,6 +2484,9 @@ static void parseSba(
static void parseMc(
    char *line,
    InputConfig *inConfig,
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    LfeRoutingConfig **lfeRoutingConfigs,
#endif
    const int32_t idx )
{
    readNextMetadataChunk( line, "\n" );
@@ -2301,17 +2495,70 @@ static void parseMc(

    readNextMetadataChunk( line, "\n" );
    IVAS_REND_AudioConfig cfg = parseAudioConfig( line );
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    /* Try to use the given string as a path to a custom loudspeaker layout file. */
    if ( cfg == IVAS_REND_AUDIO_CONFIG_UNKNOWN )
    {
        ivas_error error = parseCustomLayoutFile( line, &inConfig->inSetupCustom );

        if ( error != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error while parsing input format %s\n", line );
            exit( -1 );
        }
        inConfig->numMultiChannelBuses = 1;
        inConfig->multiChannelBuses[idx].audioConfig = IVAS_REND_AUDIO_CONFIG_LS_CUSTOM;
        inConfig->multiChannelBuses[idx].inputChannelIndex = 0;
        inConfig->multiChannelBuses[idx].gain_dB = 0.0f;
    }
#else
    if ( cfg == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM )
    {
        parseCustomLayoutFile( line, &inConfig->inSetupCustom );
    }
#endif
    else
    {
        inConfig->multiChannelBuses[idx].audioConfig = cfg;
    }

    /* Read optional values */
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    bool lfe_panningEnabled;
    float lfe_gain_dB, lfe_azi, lfe_ele;
    char lfe_routing_mtx[FILENAME_MAX];

    parseOptionalInputValues( line, &lfe_gain_dB, &lfe_azi, &lfe_ele, lfe_routing_mtx, &inConfig->multiChannelBuses[idx].gain_dB );

    lfe_panningEnabled = ( lfe_gain_dB != 0.f || lfe_azi != 0.f || lfe_ele != 0.f ) ? true : false;

    if ( lfe_panningEnabled && !isEmptyString( lfe_routing_mtx ) )
    {
        fprintf( stderr, "Warning: LFE position specified as well as panning matrix! Ignoring position and using gains from panning matrix\n" );
        lfe_panningEnabled = false;
    }

    if ( lfe_panningEnabled || !isEmptyString( lfe_routing_mtx ) )
    {
        /* a configuration was specified, set the values */
        lfeRoutingConfigs[idx] = LfeRoutingConfig_open();

        if ( lfe_panningEnabled )
        {
            lfeRoutingConfigs[idx]->lfe_gain_dB = lfe_gain_dB;
            lfeRoutingConfigs[idx]->lfe_azi = lfe_azi;
            lfeRoutingConfigs[idx]->lfe_ele = lfe_ele;
        }

        if ( !isEmptyString( lfe_routing_mtx ) )
        {
            strncpy( lfeRoutingConfigs[idx]->lfe_routing_mtx, lfe_routing_mtx, FILENAME_MAX );
            convert_backslash( lfeRoutingConfigs[idx]->lfe_routing_mtx );
        }
    }
#else
    parseOptionalInputValues( line, &inConfig->multiChannelBuses[idx].gain_dB );
#endif

    return;
}
@@ -2352,7 +2599,11 @@ static void parseMasa(
    }

    /* Read optional values */
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    parseOptionalInputValues( line, NULL, NULL, NULL, NULL, &inConfig->masaBuses[idx].gain_dB );
#else
    parseOptionalInputValues( line, &inConfig->masaBuses[idx].gain_dB );
#endif

    return;
}
@@ -2393,7 +2644,12 @@ static void parseMetadata(
    char *inDir,
    InputConfig *inConfig,
    IsmPositionProvider *positionProvider,
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    MasaFileReader **masaReaders,
    LfeRoutingConfig **lfeRoutingConfigs )
#else
    MasaFileReader **masaReaders )
#endif
{
    char line[RENDERER_MAX_METADATA_LINE_LENGTH];
    char *delimiter;
@@ -2445,7 +2701,11 @@ static void parseMetadata(
                fprintf( stderr, "Metadata exceeds the supported number of MC inputs\n" );
                exit( -1 );
            }
#ifdef FIX_296_CFG_LFE_SCENE_DESC
            parseMc( line, inConfig, lfeRoutingConfigs, counterChannelAudioObjects - 1 );
#else
            parseMc( line, inConfig, counterChannelAudioObjects - 1 );
#endif
        }
        else if ( strcmp( line, "SBA" ) == 0 )
        {
@@ -2513,7 +2773,12 @@ static void parseSceneDescriptionFile(
    char *audioFilePath,
    InputConfig *inConfig,
    IsmPositionProvider *positionProvider,
#ifdef FIX_296_CFG_LFE_SCENE_DESC
    MasaFileReader **masaReaders,
    LfeRoutingConfig **lfeRoutingConfigs )
#else
    MasaFileReader **masaReaders )
#endif
{
    uint32_t inAudioFilePathLen;
    char inAudioFilePath[FILENAME_MAX];
@@ -2542,7 +2807,11 @@ static void parseSceneDescriptionFile(
    strcpy( audioFilePath, inDir );
    strncat( audioFilePath, inAudioFilePath, inAudioFilePathLen );

#ifdef FIX_296_CFG_LFE_SCENE_DESC
    parseMetadata( mtdStr, inDir, inConfig, positionProvider, masaReaders, lfeRoutingConfigs );
#else
    parseMetadata( mtdStr, inDir, inConfig, positionProvider, masaReaders );
#endif

    return;
}
@@ -2605,8 +2874,16 @@ static ivas_error parseLfePanMtxFile(
        set_zero( ( *lfePanMtx )[lfe_in], IVAS_MAX_OUTPUT_CHANNELS );
    }

#ifdef FIX_296_CFG_LFE_SCENE_DESC
    for ( lfe_in = 0; lfe_in < IVAS_MAX_INPUT_LFE_CHANNELS; lfe_in++ )
#else
    for ( lfe_in = 0, ch_out = 0; lfe_in < IVAS_MAX_INPUT_LFE_CHANNELS; lfe_in++ )
#endif
    {
#ifdef FIX_296_CFG_LFE_SCENE_DESC
        ch_out = 0;

#endif
        /* if EOF or a blank line is encountered, simply return */
        if ( ( fgets( line, 200, mtxFile ) == NULL ) && ( strcmp( line, "\n" ) == 0 ) && ( strcmp( line, "\r\n" ) == 0 ) )
        {
+9 −8

File changed.

Preview size limit exceeded, changes collapsed.

Loading