Commit 002f9de6 authored by vaclav's avatar vaclav
Browse files

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

- Merge remote-tracking branch 'remotes/origin/main' into 945-wrong-return-value-in-ivas_dec_getnumorientationsubframes
parents c831ffe6 16eaf905
Loading
Loading
Loading
Loading
+65 −36
Original line number Original line Diff line number Diff line
@@ -23,7 +23,6 @@ variables:
      - 'test-long-self-test'
      - 'test-long-self-test'
      - 'ivas-conformance'
      - 'ivas-conformance'
      - 'ivas-conformance-linux'
      - 'ivas-conformance-linux'
      - 'check-float-reference'
      - 'check-clipping'
      - 'check-clipping'
      - 'test-branch-vs-input-passthrough'
      - 'test-branch-vs-input-passthrough'


@@ -70,9 +69,6 @@ workflow:
      variables:
      variables:
        IVAS_PIPELINE_NAME: 'Draft IVAS Conformance test -- Linux: $CI_COMMIT_BRANCH'        
        IVAS_PIPELINE_NAME: 'Draft IVAS Conformance test -- Linux: $CI_COMMIT_BRANCH'        
    - if: $CI_PIPELINE_SOURCE == 'trigger'
    - if: $CI_PIPELINE_SOURCE == 'trigger'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'check-float-reference'
      variables:
        IVAS_PIPELINE_NAME: 'check-float-reference: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'check-clipping'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'check-clipping'
      variables:
      variables:
        IVAS_PIPELINE_NAME: 'Check core input clipping: $CI_COMMIT_BRANCH'
        IVAS_PIPELINE_NAME: 'Check core input clipping: $CI_COMMIT_BRANCH'
@@ -179,8 +175,8 @@ stages:
.merge-request-comparison-check: &merge-request-comparison-check
.merge-request-comparison-check: &merge-request-comparison-check
  - echo "--------------- Running merge-request-comparison-check anchor ---------------"
  - echo "--------------- Running merge-request-comparison-check anchor ---------------"
  - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
  - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
  - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "Non-bitexact cases without non-BE tag encountered!"; exit $EXIT_CODE_FAIL; fi
  - if [ $exit_code -ne 0 ] && [ $non_be_flag == 0 ]; then echo "Non-bitexact cases without non-BE tag encountered!"; exit $EXIT_CODE_FAIL; fi
  - if [ $exit_code -eq 1 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact cases with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi
  - if [ $exit_code -ne 0 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact cases with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi
  - exit 0
  - exit 0


.update-ltv-repo: &update-ltv-repo
.update-ltv-repo: &update-ltv-repo
@@ -277,9 +273,8 @@ stages:
      when: never      
      when: never      
    - if: $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux'
    - if: $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux'
      when: never      
      when: never      
    - if: $MANUAL_PIPELINE_TYPE == 'check-float-reference'
      when: never
    - if: $MANUAL_PIPELINE_TYPE == 'check-clipping'
    - if: $MANUAL_PIPELINE_TYPE == 'check-clipping'
      when: never
    - if: $MANUAL_PIPELINE_TYPE == 'test-branch-vs-input-passthrough'
    - if: $MANUAL_PIPELINE_TYPE == 'test-branch-vs-input-passthrough'
      when: never
      when: never
    - when: on_success
    - when: on_success
@@ -421,6 +416,16 @@ check-self-test-names-pre:
  script:
  script:
    - python3 ci/check_self_test_names.py scripts/config/self_test.prm 135
    - python3 ci/check_self_test_names.py scripts/config/self_test.prm 135


check-no-duplicates-in-self-tests:
  extends:
    - .rules-merge-request
  stage: prevalidate
  needs: []
  tags:
    - ivas-linux
  script:
    - python3 ci/find_duplicates_in_prm_files.py

branch-is-up-to-date-with-main-post:
branch-is-up-to-date-with-main-post:
  extends:
  extends:
    - .rules-merge-request
    - .rules-merge-request
@@ -432,8 +437,7 @@ branch-is-up-to-date-with-main-post:
    - echo $commits_behind_count
    - echo $commits_behind_count
    - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, possibly main changed during your pipeline run, run 'git merge origin/main' to update." exit 1; fi;
    - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, possibly main changed during your pipeline run, run 'git merge origin/main' to update." exit 1; fi;


# for merges to basop-ci-branch, run the long test suite in reference generation mode to catch problems already here and not only in the BASOP repo
.basop-ci-branch-compat-template:
check-compatibility-with-basop-reference-branch:
  extends:
  extends:
    - .test-job-linux
    - .test-job-linux
  rules:
  rules:
@@ -441,29 +445,24 @@ check-compatibility-with-basop-reference-branch:
      changes:
      changes:
        - tests/**/*
        - tests/**/*
        - scripts/**/*
        - scripts/**/*
        - ci/**/*
    - if: ($CI_PIPELINE_SOURCE == 'web' || $CI_PIPELINE_SOURCE == 'trigger') && $MANUAL_PIPELINE_TYPE == 'check-float-reference'
    - if: $CI_PIPELINE_SOURCE == 'push'
    - if: $CI_PIPELINE_SOURCE == 'push'
      when: never
      when: never
  tags:
  tags:
    - ivas-linux-fast
    - ivas-linux-fast
  script:
  before_script:
    - git clone -b $BASOP_REFERENCE_BRANCH https://forge.3gpp.org/rep/sa4/audio/ivas-basop.git --single-branch
    - git clone -b $BASOP_REFERENCE_BRANCH https://forge.3gpp.org/rep/sa4/audio/ivas-basop.git --single-branch
    - make -j -C ivas-basop
    - make -j -C ivas-basop
    - cp ivas-basop/IVAS_cod ./IVAS_cod_ref
    - python3 ci/remove_unsupported_testcases.py $PARAM_FILE
    - cp ivas-basop/IVAS_dec ./IVAS_dec_ref
    - cp ivas-basop/IVAS_cod ./IVAS_cod # Not used but needed to launch the pytest
    - cp ivas-basop/IVAS_dec ./IVAS_dec # Not used but needed to launch the pytest
    - python3 ci/remove_unsupported_testcases.py scripts/config/self_test.prm
    - python3 tests/create_short_testvectors.py
    - python3 tests/create_short_testvectors.py
    - exit_code1=0
    - *update-ltv-repo
    - exit_code2=0
    - *copy-ltv-files-to-testv-dir
    - python3 -m pytest tests/codec_be_on_mr_nonselection -v --update_ref 1 --html=report.html --self-contained-html --junit-xml=report-junit.xml || exit_code1=$?

    - python3 -m pytest tests/codec_be_on_mr_nonselection --param_file $PARAM_FILE --update_ref 1 --ref_encoder_path ivas-basop/IVAS_cod --ref_decoder_path ivas-basop/IVAS_dec --html=report.html --self-contained-html --junit-xml=report-junit.xml || true
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
    - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $zero_errors != 1 ]; then echo "Run errors encountered with $PARAM_FILE !"; exit $EXIT_CODE_FAIL; fi
    - exit 0

  artifacts:
  artifacts:
    name: "check-float-reference--sha-$CI_COMMIT_SHORT_SHA--results"
    name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results"
    when: always
    when: always
    expire_in: 1 month
    expire_in: 1 month
    paths:
    paths:
@@ -475,6 +474,38 @@ check-compatibility-with-basop-reference-branch:
      junit:
      junit:
        - report-junit.xml
        - report-junit.xml


check-compatibility-with-basop-reference-branch-stv:
  extends:
    - .basop-ci-branch-compat-template
  variables:
    PARAM_FILE: scripts/config/self_test.prm
  script:
    - exit 0

check-compatibility-with-basop-reference-branch-ltv:
  extends:
    - .basop-ci-branch-compat-template
  variables:
    PARAM_FILE: scripts/config/self_test_ltv.prm
  script:
    - exit 0

check-compatibility-with-basop-reference-branch-encoder-stv:
  extends:
    - .basop-ci-branch-compat-template
  variables:
    PARAM_FILE: scripts/config/self_test_basop_encoder.prm
  script:
    - exit 0

check-compatibility-with-basop-reference-branch-encoder-ltv:
  extends:
    - .basop-ci-branch-compat-template
  variables:
    PARAM_FILE: scripts/config/self_test_ltv_basop_encoder.prm
  script:
    - exit 0

# ---------------------------------------------------------------
# ---------------------------------------------------------------
# Build jobs
# Build jobs
# ---------------------------------------------------------------
# ---------------------------------------------------------------
@@ -508,7 +539,6 @@ build-codec-instrumented-linux:
  timeout: "10 minutes"
  timeout: "10 minutes"
  script:
  script:
    - *print-common-info
    - *print-common-info
    - *activate-Werror-linux
    - ./scripts/prepare_instrumentation.sh
    - ./scripts/prepare_instrumentation.sh
    - make -j -C scripts/c-code_instrument
    - make -j -C scripts/c-code_instrument


@@ -643,9 +673,9 @@ pytest-compare-20ms-and-5ms-rendering:
    - if [ $zero_errors5 != 1 ]; then echo "run error in with 5ms rendering encountered"; zero_errors=0 ; fi
    - if [ $zero_errors5 != 1 ]; then echo "run error in with 5ms rendering encountered"; zero_errors=0 ; fi
    - if [ $zero_errors10 != 1 ]; then echo "run error in with 10ms rendering encountered"; zero_errors=0 ; fi
    - if [ $zero_errors10 != 1 ]; then echo "run error in with 10ms rendering encountered"; zero_errors=0 ; fi
    - if [ $zero_errors != 1 ]; then exit $EXIT_CODE_FAIL; fi
    - if [ $zero_errors != 1 ]; then exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code5 -eq 1 ]; then echo "Non-bitexact cases encountered with 5ms rendering!"; exit_code=1; fi
    - if [ $exit_code5 -ne 0 ]; then echo "Non-bitexact cases encountered with 5ms rendering!"; exit_code=1; fi
    - if [ $exit_code10 -eq 1 ]; then echo "Non-bitexact cases encountered with 10ms rendering!"; exit_code=1; fi
    - if [ $exit_code10 -ne 0 ]; then echo "Non-bitexact cases encountered with 10ms rendering!"; exit_code=1; fi
    - if [ $exit_code -eq 1 ]; then exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -ne 0 ]; then exit $EXIT_CODE_FAIL; fi
  artifacts:
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    expire_in: 1 week
@@ -791,7 +821,7 @@ renderer-pytest-on-merge-request:
    - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi
    - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi


    # run test
    # run test
    - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer_.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$?
    - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$?
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true


    - *merge-request-comparison-check
    - *merge-request-comparison-check
@@ -1337,9 +1367,9 @@ codec-comparison-on-main-push:
    ### run pytest
    ### run pytest
    - exit_code=0
    - exit_code=0
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$?
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$?
    - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -ne 0 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
    - if [ $exit_code -eq 1 ] && [ $zero_errors == 1 ]; then echo "pytest run had failures, but no errors and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi
    - if [ $exit_code -ne 0 ] && [ $zero_errors == 1 ]; then echo "pytest run had failures, but no errors and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi
    - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $EXIT_CODE_FAIL; fi;
    - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $EXIT_CODE_FAIL; fi;
  allow_failure:
  allow_failure:
    exit_codes:
    exit_codes:
@@ -1563,7 +1593,7 @@ ivas-conformance-linux:
    - genhtml coverage.info -o coverage -t "Coverage on main @ $commit_sha"
    - genhtml coverage.info -o coverage -t "Coverage on main @ $commit_sha"


    # Check for failures
    # Check for failures
    - if [ $exit_code -eq 1 ]; then echo "Test failures encountered"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -ne 0 ]; then echo "Test failures encountered"; exit $EXIT_CODE_FAIL; fi
    
    
  artifacts:
  artifacts:
    name: "ivas-conformance-linux-$CI_COMMIT_SHORT_SHA"
    name: "ivas-conformance-linux-$CI_COMMIT_SHORT_SHA"
@@ -1640,7 +1670,7 @@ test-long-self-test:
    - zero_errors=$(cat report-junit-ltv.xml | grep -c 'errors="0"') || true
    - zero_errors=$(cat report-junit-ltv.xml | grep -c 'errors="0"') || true


    - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ]; then echo "Non-bitexact cases encountered!"; exit $EXIT_CODE_NON_BE; fi
    - if [ $exit_code -ne 0 ]; then echo "Non-bitexact cases encountered!"; exit $EXIT_CODE_NON_BE; fi
    - exit 0
    - exit 0




@@ -1705,7 +1735,7 @@ test-branch-vs-input-passthrough:
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
    - python3 scripts/parse_xml_report.py report-junit.xml report.csv
    - python3 scripts/parse_xml_report.py report-junit.xml report.csv
    - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ]; then echo "Differences encountered."; exit $EXIT_CODE_NON_BE; fi
    - if [ $exit_code -ne 0 ]; then echo "Differences encountered."; exit $EXIT_CODE_NON_BE; fi
    - exit 0
    - exit 0


  artifacts:
  artifacts:
@@ -1721,7 +1751,6 @@ test-branch-vs-input-passthrough:
      junit:
      junit:
        - report-junit.xml
        - report-junit.xml



# ---------------------------------------------------------------
# ---------------------------------------------------------------
# Scheduled jobs on main
# Scheduled jobs on main
# ---------------------------------------------------------------
# ---------------------------------------------------------------
@@ -2386,7 +2415,7 @@ coverage-test-on-main-scheduled:
  &complexity-measurements-prepare-artifacts # prepare artifacts -> move to public directory
  &complexity-measurements-prepare-artifacts # prepare artifacts -> move to public directory
  - public_dir="$CI_JOB_NAME-public"
  - public_dir="$CI_JOB_NAME-public"
  - mkdir $public_dir
  - mkdir $public_dir
  - mv -f wmops/log_*_all.txt wmops/*.js ${public_dir}/
  - mv -f wmops/log_*_all.txt ./*.js ${public_dir}/
  # move logfiles for links
  # move logfiles for links
  - mkdir $public_dir/logs
  - mkdir $public_dir/logs
  # first move logs
  # first move logs
+2 −0
Original line number Original line Diff line number Diff line
@@ -120,6 +120,7 @@
    <ClCompile Include="..\lib_util\masa_file_reader.c" />
    <ClCompile Include="..\lib_util\masa_file_reader.c" />
    <ClCompile Include="..\lib_util\masa_file_writer.c" />
    <ClCompile Include="..\lib_util\masa_file_writer.c" />
    <ClCompile Include="..\lib_util\mime_io.c" />
    <ClCompile Include="..\lib_util\mime_io.c" />
    <ClCompile Include="..\lib_util\obj_edit_file_reader.c" />
    <ClCompile Include="..\lib_util\render_config_reader.c" />
    <ClCompile Include="..\lib_util\render_config_reader.c" />
    <ClCompile Include="..\lib_util\rotation_file_reader.c" />
    <ClCompile Include="..\lib_util\rotation_file_reader.c" />
    <ClCompile Include="..\lib_util\rtpdump.c" />
    <ClCompile Include="..\lib_util\rtpdump.c" />
@@ -146,6 +147,7 @@
    <ClInclude Include="..\lib_util\jbm_file_writer.h" />
    <ClInclude Include="..\lib_util\jbm_file_writer.h" />
    <ClInclude Include="..\lib_util\ls_custom_file_reader.h" />
    <ClInclude Include="..\lib_util\ls_custom_file_reader.h" />
    <ClInclude Include="..\lib_util\mime_io.h" />
    <ClInclude Include="..\lib_util\mime_io.h" />
    <ClInclude Include="..\lib_util\obj_edit_file_reader.h" />
    <ClInclude Include="..\lib_util\masa_file_reader.h" />
    <ClInclude Include="..\lib_util\masa_file_reader.h" />
    <ClInclude Include="..\lib_util\masa_file_writer.h" />
    <ClInclude Include="..\lib_util\masa_file_writer.h" />
    <ClInclude Include="..\lib_util\render_config_reader.h" />
    <ClInclude Include="..\lib_util\render_config_reader.h" />
+6 −0
Original line number Original line Diff line number Diff line
@@ -58,6 +58,9 @@
    <ClCompile Include="..\lib_util\mime_io.c">
    <ClCompile Include="..\lib_util\mime_io.c">
      <Filter>util_c</Filter>
      <Filter>util_c</Filter>
    </ClCompile>
    </ClCompile>
    <ClCompile Include="..\lib_util\obj_edit_file_reader.c">
      <Filter>util_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_util\render_config_reader.c">
    <ClCompile Include="..\lib_util\render_config_reader.c">
      <Filter>util_c</Filter>
      <Filter>util_c</Filter>
    </ClCompile>
    </ClCompile>
@@ -138,6 +141,9 @@
    <ClInclude Include="..\lib_util\mime_io.h">
    <ClInclude Include="..\lib_util\mime_io.h">
      <Filter>util_h</Filter>
      <Filter>util_h</Filter>
    </ClInclude>
    </ClInclude>
    <ClInclude Include="..\lib_util\obj_edit_file_reader.h">
      <Filter>util_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_util\render_config_reader.h">
    <ClInclude Include="..\lib_util\render_config_reader.h">
      <Filter>util_h</Filter>
      <Filter>util_h</Filter>
    </ClInclude>
    </ClInclude>
+214 −60

File changed.

Preview size limit exceeded, changes collapsed.

+137 −37
Original line number Original line Diff line number Diff line
@@ -158,7 +158,7 @@ typedef struct
    int32_t sampleRate;
    int32_t sampleRate;
    InputConfig inConfig;
    InputConfig inConfig;
    OutputConfig outConfig;
    OutputConfig outConfig;
    char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][RENDERER_MAX_CLI_ARG_LENGTH];
    char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS + RENDERER_MAX_MASA_INPUTS][RENDERER_MAX_CLI_ARG_LENGTH];
    int16_t numInMetadataFiles;
    int16_t numInMetadataFiles;
    char outMetadataFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char outMetadataFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
@@ -238,7 +238,7 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_inputMetadata,
        .id = CmdLnOptionId_inputMetadata,
        .match = "input_metadata",
        .match = "input_metadata",
        .matchShort = "im",
        .matchShort = "im",
        .description = "Space-separated list of path to metadata files for ISM or MASA inputs or BINAURAL_SPLIT_PCM input mode",
        .description = "Space-separated list of path to metadata files for ISM or MASA inputs or BINAURAL_SPLIT_PCM input mode. For OMASA, ISM files must be specified first.",
    },
    },
    {
    {
        .id = CmdLnOptionId_outputFile,
        .id = CmdLnOptionId_outputFile,
@@ -397,6 +397,8 @@ static IVAS_AUDIO_CONFIG ambisonicsOrderToEnum( const int16_t order );


static void parseSceneDescriptionFile( char *path, char *audioFilePath, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders, LfeRoutingConfig **lfeRoutingConfigs );
static void parseSceneDescriptionFile( char *path, char *audioFilePath, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders, LfeRoutingConfig **lfeRoutingConfigs );


static void parseCombinedFormatInput( InputConfig *inConfig, char **configString );

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


static CmdlnArgs parseCmdlnArgs( const int argc, char **argv );
static CmdlnArgs parseCmdlnArgs( const int argc, char **argv );
@@ -555,25 +557,7 @@ static void setupWithSingleFormatInput(
    strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 );
    strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 );


    /* Depending on input format, prepare metadata reading for ISM or MASA */
    /* Depending on input format, prepare metadata reading for ISM or MASA */
    if ( args.inConfig.numMasaBuses != 0 )
    if ( args.inConfig.numAudioObjects != 0 )
    {
        if ( args.inConfig.numMasaBuses != args.numInMetadataFiles )
        {
            fprintf( stderr, "Error: all MASA inputs must have a corresponding metadata file" );
            exit( -1 );
        }

        for ( int16_t i = 0; i < args.numInMetadataFiles; ++i )
        {
            masaReaders[i] = MasaFileReader_open( args.inMetadataFilePaths[i] );
            if ( masaReaders[i] == NULL )
            {
                fprintf( stderr, "Could not open MASA metadata file %s\n", args.inMetadataFilePaths[i] );
                exit( -1 );
            }
        }
    }
    else if ( args.inConfig.numAudioObjects != 0 )
    {
    {
        positionProvider->numObjects = args.inConfig.numAudioObjects;
        positionProvider->numObjects = args.inConfig.numAudioObjects;
        for ( int16_t i = 0; i < positionProvider->numObjects; ++i )
        for ( int16_t i = 0; i < positionProvider->numObjects; ++i )
@@ -596,6 +580,26 @@ static void setupWithSingleFormatInput(
            }
            }
        }
        }
    }
    }
    if ( args.inConfig.numMasaBuses != 0 )
    {
        if ( args.inConfig.numMasaBuses != ( args.numInMetadataFiles - args.inConfig.numAudioObjects ) )
        {
            fprintf( stderr, "Error: all MASA inputs must have a corresponding metadata file" );
            exit( -1 );
        }

        int16_t reader_idx = 0;
        for ( int16_t i = args.inConfig.numAudioObjects; i < args.numInMetadataFiles; ++i )
        {
            reader_idx = i - args.inConfig.numAudioObjects;
            masaReaders[reader_idx] = MasaFileReader_open( args.inMetadataFilePaths[i] );
            if ( masaReaders[reader_idx] == NULL )
            {
                fprintf( stderr, "Could not open MASA metadata file %s\n", args.inMetadataFilePaths[i] );
                exit( -1 );
            }
        }
    }


    return;
    return;
}
}
@@ -665,7 +669,7 @@ int main(
    SplitRendBFIFileReader *splitRendBFIReader = NULL;
    SplitRendBFIFileReader *splitRendBFIReader = NULL;
    Vector3PairFileReader *referenceVectorReader = NULL;
    Vector3PairFileReader *referenceVectorReader = NULL;
    hrtfFileReader *hrtfFileReader = NULL;
    hrtfFileReader *hrtfFileReader = NULL;
    IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
    IVAS_DEC_HRTF_CREND_HANDLE *hHrtfCrend = NULL;
    IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
    IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
    IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
    IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
@@ -733,6 +737,10 @@ int main(
        lfeRoutingConfigs[i] = NULL;
        lfeRoutingConfigs[i] = NULL;
    }
    }


#ifdef FIX_1225_DISCLAIMER
    IVAS_REND_PrintDisclaimer();

#endif
    CmdlnArgs args = parseCmdlnArgs( argc, argv );
    CmdlnArgs args = parseCmdlnArgs( argc, argv );


    if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_AUDIO_CONFIG_MONO ) ||
    if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_AUDIO_CONFIG_MONO ) ||
@@ -890,6 +898,49 @@ int main(
        exit( -1 );
        exit( -1 );
    }
    }


#ifdef FIX_1225_DISCLAIMER
    fprintf( stdout, "Input audio file:       %s\n", args.inputFilePath );
    fprintf( stdout, "Output audio file:      %s\n\n", args.outputFilePath );

    if ( args.inConfig.numAudioObjects > 0 )
    {
        if ( args.inConfig.numAudioObjects == 1 )
        {
            IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM1 );
        }
        else if ( args.inConfig.numAudioObjects == 2 )
        {
            IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM2 );
        }
        else if ( args.inConfig.numAudioObjects == 3 )
        {
            IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM3 );
        }
        else if ( args.inConfig.numAudioObjects == 4 )
        {
            IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM4 );
        }
    }
    for ( i = 0; i < args.inConfig.numMultiChannelBuses; i++ )
    {
        IVAS_REND_PrintInputConfig( args.inConfig.multiChannelBuses[i].audioConfig );
    }
    for ( i = 0; i < args.inConfig.numMasaBuses; i++ )
    {
        IVAS_REND_PrintInputConfig( args.inConfig.masaBuses[i].audioConfig );
    }
    for ( i = 0; i < args.inConfig.numAmbisonicsBuses; i++ )
    {
        IVAS_REND_PrintInputConfig( args.inConfig.ambisonicsBuses[i].audioConfig );
    }

    if ( ( error = IVAS_REND_PrintConfig( hIvasRend ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\n IVAS_REND_PrintConfig failed: %s\n\n", ivas_error_to_string( error ) );
        goto cleanup;
    }

#endif
    if ( !isEmptyString( args.customHrtfFilePath ) )
    if ( !isEmptyString( args.customHrtfFilePath ) )
    {
    {
        if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK )
        if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK )
@@ -906,7 +957,7 @@ int main(
                goto cleanup;
                goto cleanup;
            }
            }


            if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfFileReader ) ) != IVAS_ERR_OK )
            if ( ( error = load_TDrend_HRTF_binary( *hHrtfTD, args.sampleRate, hrtfFileReader ) ) != IVAS_ERR_OK )
            {
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                {
@@ -920,13 +971,19 @@ int main(
            }
            }




            if ( ( error = IVAS_REND_GetHrtfCRendHandle( hIvasRend, &hSetOfHRTF ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_REND_GetHrtfCRendHandle( hIvasRend, &hHrtfCrend ) ) != IVAS_ERR_OK )
            {
            {
                fprintf( stderr, "\nIVAS_Rend_GetHrtfCRendHandle failed: %s\n\n", ivas_error_to_string( error ) );
                fprintf( stderr, "\nIVAS_Rend_GetHrtfCRendHandle failed: %s\n\n", ivas_error_to_string( error ) );
                goto cleanup;
                goto cleanup;
            }
            }


            if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfFileReader, args.sampleRate ) ) != IVAS_ERR_OK )
            IVAS_AUDIO_CONFIG hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_7_1_4;
            if ( args.inConfig.ambisonicsBuses->audioConfig != IVAS_AUDIO_CONFIG_INVALID && args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
            {
                hrtf_set_audio_cfg = args.inConfig.ambisonicsBuses->audioConfig;
            }

            if ( ( error = load_Crend_HRTF_from_binary( *hHrtfCrend, hrtfFileReader, args.outConfig.audioConfig, hrtf_set_audio_cfg, args.sampleRate ) ) != IVAS_ERR_OK )
            {
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                {
@@ -935,7 +992,7 @@ int main(
                }
                }
                else
                else
                {
                {
                    destroy_SetOfHRTF( hSetOfHRTF );
                    destroy_crend_hrtf( hHrtfCrend );
                }
                }
            }
            }


@@ -945,7 +1002,7 @@ int main(
                goto cleanup;
                goto cleanup;
            }
            }


            if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, 0, IVAS_AUDIO_CONFIG_INVALID, hrtfFileReader ) ) != IVAS_ERR_OK )
            if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, args.outConfig.audioConfig, args.inConfig.ambisonicsBuses->audioConfig, hrtfFileReader ) ) != IVAS_ERR_OK )
            {
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
                {
@@ -1952,7 +2009,6 @@ cleanup:


    Vector3PairFileReader_close( &referenceVectorReader );
    Vector3PairFileReader_close( &referenceVectorReader );
    destroy_td_hrtf( hHrtfTD );
    destroy_td_hrtf( hHrtfTD );
    destroy_SetOfHRTF( hSetOfHRTF );
    destroy_hrtf_statistics( hHrtfStatistics );
    destroy_hrtf_statistics( hHrtfStatistics );
    IVAS_REND_Close( &hIvasRend );
    IVAS_REND_Close( &hIvasRend );
    IsmPositionProvider_close( positionProvider );
    IsmPositionProvider_close( positionProvider );
@@ -2061,16 +2117,11 @@ static bool parseInConfig(
            inConfig->masaBuses[0].gain_dB = 0.0f;
            inConfig->masaBuses[0].gain_dB = 0.0f;
            break;
            break;
        case IVAS_AUDIO_CONFIG_OBA:
        case IVAS_AUDIO_CONFIG_OBA:
            /* If input format is objects, parse the characters after "ISM" to get number of objects */
            /* If input format is objects, parse the characters after "ISM" to get
             * number of objects and check for combined formats. */
            {
            {
                char *ptr = NULL;
                char *ptr = NULL;
                inConfig->numAudioObjects = (uint16_t) strtol( inFormatStr + 3, &ptr, 10 );
                inConfig->numAudioObjects = (uint16_t) strtol( inFormatStr + 3, &ptr, 10 );
                if ( ptr == NULL || *ptr != '\0' )
                {
                    /* Failed to parse string as a number */
                    fprintf( stderr, "Cannot parse string \"%s\" as a valid input format", inFormatStr );
                    return false;
                }
                if ( inConfig->numAudioObjects > RENDERER_MAX_ISM_INPUTS )
                if ( inConfig->numAudioObjects > RENDERER_MAX_ISM_INPUTS )
                {
                {
                    fprintf( stderr, "Too many objects at input. Max %d supported.", RENDERER_MAX_ISM_INPUTS );
                    fprintf( stderr, "Too many objects at input. Max %d supported.", RENDERER_MAX_ISM_INPUTS );
@@ -2082,6 +2133,17 @@ static bool parseInConfig(
                    inConfig->audioObjects[i].inputChannelIndex = i;
                    inConfig->audioObjects[i].inputChannelIndex = i;
                    inConfig->audioObjects[i].gain_dB = 0.0f;
                    inConfig->audioObjects[i].gain_dB = 0.0f;
                }
                }
                if ( *ptr != '\0' )
                {
                    /* Try to parse combined format */
                    parseCombinedFormatInput( inConfig, &ptr );
                }
                if ( ptr == NULL || *ptr != '\0' )
                {
                    /* Failed to parse string as a number */
                    fprintf( stderr, "Cannot parse string \"%s\" as a valid input format", inFormatStr );
                    return false;
                }
            }
            }
            break;
            break;
        case IVAS_AUDIO_CONFIG_INVALID:
        case IVAS_AUDIO_CONFIG_INVALID:
@@ -2496,6 +2558,7 @@ static CmdlnArgs defaultArgs(
    args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_INVALID;
    args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_INVALID;
    args.outConfig.outSetupCustom.num_spk = 0;
    args.outConfig.outSetupCustom.num_spk = 0;
    args.outConfig.outSetupCustom.num_lfe = 0;
    args.outConfig.outSetupCustom.num_lfe = 0;
    args.inConfig.ambisonicsBuses->audioConfig = IVAS_AUDIO_CONFIG_INVALID;


    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    {
    {
@@ -2574,7 +2637,7 @@ static void parseOption(
            }
            }
            break;
            break;
        case CmdLnOptionId_inputMetadata:
        case CmdLnOptionId_inputMetadata:
            assert( numOptionValues <= RENDERER_MAX_ISM_INPUTS );
            assert( numOptionValues <= RENDERER_MAX_ISM_INPUTS + RENDERER_MAX_MASA_INPUTS );
            for ( int16_t i = 0; i < numOptionValues; ++i )
            for ( int16_t i = 0; i < numOptionValues; ++i )
            {
            {
                strncpy( args->inMetadataFilePaths[i], optionValues[i], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
                strncpy( args->inMetadataFilePaths[i], optionValues[i], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
@@ -3402,6 +3465,41 @@ static void parseMasa(
    return;
    return;
}
}


static void parseCombinedFormatInput(
    InputConfig *inConfig,
    char **configString )
{
    IVAS_AUDIO_CONFIG audioConfig;
    audioConfig = parseAudioConfig( *configString );

    if ( audioConfig == IVAS_AUDIO_CONFIG_FOA || audioConfig == IVAS_AUDIO_CONFIG_HOA2 || audioConfig == IVAS_AUDIO_CONFIG_HOA3 )
    {
        /* OSBA */
        inConfig->numAmbisonicsBuses = 1;
        inConfig->ambisonicsBuses[0].audioConfig = audioConfig;
        inConfig->ambisonicsBuses[0].inputChannelIndex = inConfig->numAudioObjects;
        inConfig->ambisonicsBuses[0].gain_dB = -6.f;
        *configString += 4;

        /* Modify input gain for objects too */
        for ( int16_t i = 0; i < inConfig->numAudioObjects; ++i )
        {
            inConfig->audioObjects[i].gain_dB = -6.f;
        }
    }
    else if ( audioConfig == IVAS_AUDIO_CONFIG_MASA1 || audioConfig == IVAS_AUDIO_CONFIG_MASA2 )
    {
        /* OMASA */
        inConfig->numMasaBuses = 1;
        inConfig->masaBuses[0].audioConfig = audioConfig;
        inConfig->masaBuses[0].inputChannelIndex = inConfig->numAudioObjects;
        inConfig->masaBuses[0].gain_dB = 0.0f;
        *configString += 5;
    }

    return;
}

static ivas_error parseCustomLayoutFile(
static ivas_error parseCustomLayoutFile(
    const char *filePath,
    const char *filePath,
    IVAS_CUSTOM_LS_DATA *pLsSetupCustom )
    IVAS_CUSTOM_LS_DATA *pLsSetupCustom )
@@ -3618,6 +3716,8 @@ static void printSupportedAudioConfigs( void )
        "HOA2",
        "HOA2",
        "HOA3",
        "HOA3",
        "ISMx (input only)",
        "ISMx (input only)",
        "ISMxSBAy (OSBA, input only)",
        "ISMxMASAy (OMASA, input only)",
        "MASAx",
        "MASAx",
        "BINAURAL (output only)",
        "BINAURAL (output only)",
        "BINAURAL_SPLIT_PCM",
        "BINAURAL_SPLIT_PCM",
Loading