Commit ebeb1e5f authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into 747-ism-todos

parents aaef1429 aaa35bcb
Loading
Loading
Loading
Loading
Loading
+98 −4
Original line number Diff line number Diff line
@@ -12,12 +12,14 @@ variables:
  EXIT_CODE_FAIL: 1
  PROCESSING_SCRIPTS_BIN_DIR: "/test-bin"
  TESTS_DIR_CODEC_BE_ON_MR: "tests/codec_be_on_mr_nonselection"
  IVAS_PIPELINE_NAME: ''
  MANUAL_PIPELINE_TYPE:
    description: "Type for the manual pipeline run. Use 'test-be-release' to run BE test against release codec."
    value: 'default'
    options:
      - 'default'
      - 'test-be-release'
      - 'test-long-self-test'


default:
@@ -25,14 +27,29 @@ default:

# This sets when pipelines are created. Jobs have more specific rules to restrict them.
workflow:
  name: '$IVAS_PIPELINE_NAME'
  rules:
    # see https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
      when: never
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
      variables:
        IVAS_PIPELINE_NAME: 'MR pipeline: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME'
    - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main
      variables:
        IVAS_PIPELINE_NAME: 'Push pipeline: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'schedule' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Scheduled in main
    - if: $CI_PIPELINE_SOURCE == 'web' # for testing
      variables:
        IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'default' # for testing
      variables:
        IVAS_PIPELINE_NAME: 'Web run pipeline: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-be-release'
      variables:
        IVAS_PIPELINE_NAME: 'Test BE to release pipeline: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-long-self-test'
      variables:
        IVAS_PIPELINE_NAME: 'Test long self-test against main pipeline: $CI_COMMIT_BRANCH'
    - if: $CI_PIPELINE_SOURCE == 'trigger'

stages:
@@ -161,6 +178,8 @@ stages:
      when: never
    - if: $MANUAL_PIPELINE_TYPE == 'test-be-release' # Skip all the normal jobs when testing manually against release codec
      when: never
    - if: $MANUAL_PIPELINE_TYPE == 'test-long-self-test' # Skip all the normal jobs when testing manually against release codec
      when: never
    - when: on_success

.rules-merge-request:
@@ -353,7 +372,7 @@ codec-smoke-test:
  extends:
    - .test-job-linux-needs-testv-dir
    - .rules-merge-request
  timeout: "10 minutes"
  timeout: "15 minutes"
  stage: test
  needs: ["build-codec-linux-cmake", "build-codec-linux-make", "build-codec-instrumented-linux", "build-codec-sanitizers-linux"]
  script:
@@ -372,6 +391,7 @@ codec-smoke-test:
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    when: always
    paths:
      - smoke_test_output.txt
      - smoke_test_output_plc.txt
@@ -396,6 +416,7 @@ codec-msan:
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    when: always
    paths:
      - scripts/ref/logs/
      - test_output.txt
@@ -418,6 +439,7 @@ codec-asan:
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    when: always
    paths:
      - scripts/ref/logs/
      - test_output.txt
@@ -441,6 +463,7 @@ codec-usan:
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    expire_in: 1 week
    when: always
    paths:
      - scripts/ref/logs/
    expose_as: "usan selftest results"
@@ -846,7 +869,7 @@ clang-format-check:
    expire_in: 1 day
    paths:
      - tmp-formatting-fix/
    when: on_failure
    when: always
    name: "$ARTIFACT_BASE_NAME"
    expose_as: "formatting patch"

@@ -883,7 +906,7 @@ check-first-frame-is-sid:
  artifacts:
    paths:
      - out/logs
    when: on_failure
    when: always
    name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart"
    expose_as: "logs-sidstart"
    expire_in: "5 days"
@@ -1074,6 +1097,77 @@ test-be-to-release:
      - logs/
    expose_as: "test-be-to-release results"


test-long-self-test:
  tags:
    - ivas-linux-fast
  stage: compare
  resource_group: ivas-long-self-test-resource
  timeout: "50 minutes"
  rules:
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'test-long-self-test'
  allow_failure:
    exit_codes:
      - 123
  script:
    - *print-common-info
    - *update-ltv-repo

    ### build branch binaries
    - cmake . -Bbuild-test
    - cmake --build build-test -- -j
    - mv build-test/IVAS_cod ./IVAS_cod
    - mv build-test/IVAS_dec ./IVAS_dec

    ### store the current commit hash
    - source_branch_commit_sha=$(git rev-parse HEAD)

    ### switch to main
    - git checkout main

    ### build main (ref) binaries
    - cmake . -Bbuild-ref
    - cmake --build build-ref -- -j
    - mv build-ref/IVAS_cod ./IVAS_cod_ref
    - mv build-ref/IVAS_dec ./IVAS_dec_ref

    ### Switch back to branch, this could probably be removed later
    - git checkout $source_branch_commit_sha

    ### prepare pytest

    # Copy test vectors from LTV to TESTV
    - cp "$LTV_DIR"/*.wav scripts/testv/
    - cp "$LTV_DIR"/*.met scripts/testv/
    - cp "$LTV_DIR"/*.csv scripts/testv/

    # create references
    - exit_code_ref=0
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_ltv.prm || exit_code_ref=$?

    ### run pytest self-test using long test vectors
    - exit_code=0
    - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR/test_param_file.py -v --param_file scripts/config/self_test_ltv.prm --html=report-ltv.html --self-contained-html --junit-xml=report-junit-ltv.xml || exit_code=$?
    - 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 [ $exit_code -eq 1 ]; then echo "Non-bitexact cases encountered!"; exit $EXIT_CODE_NON_BE; fi
    - exit 0


  artifacts:
    name: "test-long-self-test--sha-$CI_COMMIT_SHORT_SHA--results"
    when: always
    expire_in: 4 mos
    paths:
      - report-junit-ltv.xml
      - report-ltv.html
    expose_as: "test-long-self-test results"
    reports:
      junit:
        - report-junit-ltv.xml


# ---------------------------------------------------------------
# Scheduled jobs on main
# ---------------------------------------------------------------
+25 −0
Original line number Diff line number Diff line
<!--- Basic information that is useful -->
- Related issues:
- Requested reviewers: 

### Reason why this change is needed

* This may be a direct copy from the issue.

### Description of the change

* Describe what is done.

### Affected operating points

* Describe here as well as possible what operating points are affected and how
* In minimum, there should be a status for bitstream compatibility and output bit exactness
* For bitstream compatibility, the following levels are helpful for describing encoder
  1. Produced bitstream is BE compared to previous state.
  2. Produced bitstream is non-BE but it is fully backwards compatible for decoding. Decoded output may differ.
  3. Produced bitstream is non-BC. Old decoder cannot decode the produced bitstream correctly.
* For output difference, use BE or non-BE. Additionally, amount of difference can be presented.


<!--- By default, no labels are added as they often come from the issue. Add labels if there is no issue for this. -->
+2 −6
Original line number Diff line number Diff line
@@ -439,9 +439,6 @@
    <ClCompile Include="..\lib_dec\lead_deindexing.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\lib_dec.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\lp_exc_d.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
@@ -520,6 +517,7 @@
    <ClCompile Include="..\lib_dec\waveadjust_fec_dec.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\lib_dec.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_dec\ivas_stat_dec.h">
@@ -558,9 +556,7 @@
    <ClInclude Include="..\lib_dec\rom_dec.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_dec\lib_dec.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_dec\lib_dec.h" />
  </ItemGroup>
  <ItemGroup>
    <Filter Include="decoder_all_c">
+4 −2
Original line number Diff line number Diff line
@@ -590,10 +590,12 @@
    <ClCompile Include="..\lib_enc\ivas_mc_paramupmix_enc.c">
      <Filter>enc_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_enc\ivas_osba_enc.c" />
    <ClCompile Include="..\lib_enc\ivas_omasa_enc.c">
      <Filter>enc_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_enc\ivas_osba_enc.c">
      <Filter>enc_ivas_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_enc\ivas_stat_enc.h">
+104 −9
Original line number Diff line number Diff line
@@ -146,6 +146,9 @@ typedef struct
#endif
#endif
    uint16_t acousticEnvironmentId;
#ifdef FIX_708_DPID_COMMAND_LINE
    int16_t Opt_dpid_on;
#endif
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
} DecArguments;

@@ -473,9 +476,6 @@ int main(
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------*
 * Configure the decoder
 *------------------------------------------------------------------------------------------*/
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
@@ -494,9 +494,15 @@ int main(
    }
#endif

    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig,
                                       arg.tsmEnabled, arg.enable5ms,
                                       arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.enable5ms,
                                       arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain,
#ifdef FIX_708_DPID_COMMAND_LINE
                                       arg.Opt_dpid_on,
#endif
#ifdef FIX_708_AEID_COMMAND_LINE
                                       arg.acousticEnvironmentId,
#endif
                                       arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -674,13 +680,17 @@ int main(

        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK )
        {
#ifdef FIX_730_DPID_NOT_SET_CORRECTLY
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
#else
            fprintf( stderr, "Failed to get directivity for objects: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
#endif
            goto cleanup;
        }

        if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK )
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
@@ -688,12 +698,16 @@ int main(
                    goto cleanup;
                }
            }
#ifdef FIX_708_AEID_COMMAND_LINE
            else
#else
            else if ( error != IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING )
#endif
            {
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId );
                goto cleanup;
            }
            renderConfig.room_acoustics.override = true;
            renderConfig.roomAcoustics.override = true;
        }

        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
@@ -702,6 +716,7 @@ int main(
            goto cleanup;
        }
    }

    /*------------------------------------------------------------------------------------------*
     * Load custom loudspeaker layout data
     *------------------------------------------------------------------------------------------*/
@@ -1035,6 +1050,9 @@ static bool parseCmdlIVAS_dec(

    arg->renderConfigEnabled = false;
    arg->renderConfigFilename = NULL;
#ifdef FIX_708_DPID_COMMAND_LINE
    arg->Opt_dpid_on = 0;
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
    arg->outputMdFilename = NULL;
@@ -1058,12 +1076,20 @@ static bool parseCmdlIVAS_dec(
    arg->noBadFrameDelay = false;
#endif
#endif

#ifdef FIX_708_AEID_COMMAND_LINE
    arg->acousticEnvironmentId = 65535;
#else
    arg->acousticEnvironmentId = 0;
#endif
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
#ifdef FIX_730_DPID_NOT_SET_CORRECTLY
        arg->directivityPatternId[i] = 65535;
#else
        arg->directivityPatternId[i] = 0;
#endif
    }

    /*-----------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/
@@ -1433,18 +1459,71 @@ static bool parseCmdlIVAS_dec(
        else if ( strcmp( argv_to_upper, "-AEID" ) == 0 )
        {
            ++i;
#ifdef FIX_708_AEID_COMMAND_LINE
            if ( argc - i <= 4 )
            {
                fprintf( stderr, "Error: Acoustic environment ID not specified!\n\n" );
                usage_dec();
                return false;
            }

            if ( !is_digits_only( argv[i] ) )
            {
                fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] );
                usage_dec();
                return false;
            }
#endif
            arg->acousticEnvironmentId = (int16_t) atoi( argv[i++] );
        }
        else if ( strcmp( argv_to_upper, "-DPID" ) == 0 )
        {
#ifdef FIX_708_DPID_COMMAND_LINE
            int16_t id;

            arg->Opt_dpid_on = 1;
#endif
            ++i;
            int16_t tmp;
            tmp = 0;
            while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS )
            {
#ifdef FIX_708_DPID_COMMAND_LINE
                id = (int16_t) atoi( argv[i + tmp] );

                if ( !is_digits_only( argv[i + tmp] ) || id < 0 )
                {
                    fprintf( stdout, "Error: Invalid directivity pattern ID specified: %s\n\n", argv[i + tmp] );
                    usage_dec();
                    return false;
                }

                arg->directivityPatternId[tmp] = id;
#else
                arg->directivityPatternId[tmp] = (int16_t) atoi( argv[i + tmp] );
#endif
                ++tmp;
            }

#ifdef FIX_708_DPID_COMMAND_LINE
            if ( tmp == 0 )
            {
                if ( argc - i <= 4 || argv[i][0] == '-' )
                {
                    fprintf( stderr, "Error: Directivity pattern ID not specified!\n\n" );
                    usage_dec();
                    return false;
                }

                if ( !is_digits_only( argv[i + tmp] ) )
                {
                    fprintf( stdout, "Error: Invalid directivity pattern ID specified: %s\n\n", argv[i + tmp] );
                    usage_dec();
                    return false;
                }
            }
#endif

            i += tmp;
        }

@@ -1633,7 +1712,15 @@ static void usage_dec( void )
    fprintf( stdout, "-force R            : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" );
#endif
    fprintf( stdout, "-exof File          : External orientation File for external orientation trajectory\n" );
#ifdef FIX_708_DPID_COMMAND_LINE
    fprintf( stdout, "-dpid ID            : Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up\n" );
    fprintf( stdout, "                      to 4 numbers (unsigned integers) can be specified for BINAURAL output configuration.\n" );
    fprintf( stdout, "                      ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for ISMs 1,2,3 and 4 respectively.\n" );
    fprintf( stdout, "                      This options needs to be accompanied by a render_config file, otherwise a default\n" );
    fprintf( stdout, "                      directivity pattern is used.\n" );
#else
    fprintf( stdout, "-dpid ID            : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration\n" );
#endif
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
@@ -2470,10 +2557,18 @@ static ivas_error decodeG192(
        if ( vec_pos_update == 0 )
        {
            update_wmops();
#ifdef FIX_RAM_COUNTING_5MS_RENDERING
            update_mem();
#ifdef MEM_COUNT_DETAILS
            export_mem( "mem_analysis.csv" );
#endif
#endif
        }
#ifndef FIX_RAM_COUNTING_5MS_RENDERING
#ifdef MEM_COUNT_DETAILS
        export_mem( "mem_analysis.csv" );
#endif
#endif
#endif
    }

Loading