From bfb495d3309336737e0a171d04f4eccd91953d9d Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 11 May 2024 14:21:06 +0530 Subject: [PATCH 01/10] Enable CI for original float code --- .gitlab-ci.yml | 594 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 594 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..02e28fa0e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,594 @@ +variables: + TESTV_DIR: "/usr/local/testv" + LTV_DIR: "/usr/local/ltv" + EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop" + REFERENCE_BRANCH: "ivas-float-update" + BUILD_OUTPUT: "build_output.txt" + SCRIPTS_DIR: "/usr/local/scripts" + EXIT_CODE_NON_BE: 123 + EXIT_CODE_FAIL: 1 + LONG_TEST_SUITE: "tests/test_param_file_ltv.py tests/renderer" + SHORT_TEST_SUITE: "tests/codec_be_on_mr_nonselection" + TEST_SUITE: "" + DUT_ENCODER_PATH: "./IVAS_cod" + DUT_DECODER_PATH: "./IVAS_dec" + LEVEL_SCALING: "1.0" + IVAS_PIPELINE_NAME: '' + BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" + PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm" + MANUAL_PIPELINE_TYPE: + description: "Type for the manual pipeline run. Use 'pytest-mld' to run MLD test against reference float codec." # Not implemented yet, but may be good to have a manual pipeline trigger + value: 'default' + options: + - 'default' + - 'pytest-mld' + - 'pytest-mld-interop' + - 'pytest-mld-long' + - 'pytest-saturation-smoke-test' + - 'evs-26444' + - 'sanitizer-stv' + + +default: + interruptible: true # Make all jobs by default interruptible + +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' + ### disabled for now because pipeline setup is redundant with MR pipeline with current workflow + # - 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 == '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 == 'pytest-mld' + variables: + IVAS_PIPELINE_NAME: 'Run MLD tool against float ref: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-mld-interop' + variables: + IVAS_PIPELINE_NAME: 'Run MLD tool agains float ref - interop: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-mld-long' + variables: + IVAS_PIPELINE_NAME: 'Run MLD tool against float ref (long test vectors): $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-saturation-smoke-test' + variables: + IVAS_PIPELINE_NAME: 'Run saturation smoke-test: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'evs-26444' + variables: + IVAS_PIPELINE_NAME: 'EVS 26.444 test: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'sanitizer-stv' + variables: + IVAS_PIPELINE_NAME: 'Short testvectors sanitizers' + - if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch + variables: + IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH' + + +stages: + - build + - test + +# --------------------------------------------------------------- +# Generic script anchors +# --------------------------------------------------------------- + +# These can be used later on to do common tasks + +# Prints useful information for every job and should be used at the beginning of each job +.print-common-info: &print-common-info + - | + echo "Printing common information for build job." + echo "Current job is run on commit $CI_COMMIT_SHA" + echo "Commit time was $CI_COMMIT_TIMESTAMP" + date | xargs echo "System time is" + +.setup-codec: &setup-codec + - current_commit_sha=$(git rev-parse HEAD) + ### build reference binaries + - git checkout $REFERENCE_BRANCH + - git pull + - make clean + - make -j + - mv ./IVAS_cod ./IVAS_cod_ref + - mv ./IVAS_dec ./IVAS_dec_ref + - mv ./IVAS_rend ./IVAS_rend_ref + + ### build test binaries + - git checkout $current_commit_sha + - make clean + - make -j + + +.mld-test-setup-codec: &mld-test-setup-codec + - *setup-codec + + ### prepare pytest + # create short test vectors + - python3 tests/create_short_testvectors.py + # create references + - exit_code=0 + - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto || exit_code=$? + - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests + + +.update-scripts-repo: &update-scripts-repo + - cd $SCRIPTS_DIR + - git remote set-branches --add origin $BASOP_CI_BRANCH_PC_REPO + - git remote prune origin + - git branch + - git fetch + - git checkout $BASOP_CI_BRANCH_PC_REPO + - git pull + - cd - + - cp -r $SCRIPTS_DIR/ci . + - cp -r $SCRIPTS_DIR/scripts . + - cp -r $SCRIPTS_DIR/tests . + - cp $SCRIPTS_DIR/pytest.ini . + +.apply-testv-scaling: &apply-testv-scaling + - echo "Applying level scaling in scripts/testv using scale=$LEVEL_SCALING" + - tests/scale_pcm.py ./scripts/testv/ $LEVEL_SCALING + +.update-ltv-repo: &update-ltv-repo + - cd $LTV_DIR + - git pull + - cd - + +.copy-ltv-files-to-testv-dir: ©-ltv-files-to-testv-dir + - cp "$LTV_DIR"/*.wav scripts/testv/ + - cp "$LTV_DIR"/*.met scripts/testv/ + - cp "$LTV_DIR"/*.csv scripts/testv/ + +.rules-pytest-mld: + rules: + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-mld" + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + - if: $CI_PIPELINE_SOURCE == 'schedule' + when: never + +.rules-pytest-mld-long: + rules: + - if: $PYTEST_MLD_LONG # Set by scheduled pipeline + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-mld-long" + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + when: never + + +.rules-pytest-mld-interop: + rules: + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-mld-interop" + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + when: never + +.rules-pytest-saturation-smoke-test: + rules: + - if: $PYTEST_SMOKE_TEST # Set by scheduled pipeline + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-saturation-smoke-test" + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + when: never + +# --------------------------------------------------------------- +# Job templates +# --------------------------------------------------------------- + +# templates to define stages and platforms +.test-job-linux: + tags: + - ivas-basop-linux + +.build-job-linux: + stage: build + timeout: "2 minutes" + needs: [] + tags: + - ivas-basop-linux + +# template for test jobs on linux that need the TESTV_DIR +.test-job-linux-needs-testv-dir: + extends: .test-job-linux + before_script: + - *update-scripts-repo + - if [ ! -d "$TESTV_DIR" ]; then mkdir -p $TESTV_DIR; fi + - cp -r scripts/testv/* $TESTV_DIR/ + +.ivas-pytest-mld-anchor: &ivas-pytest-mld-anchor + stage: test + needs: ["build-codec-linux-make"] + timeout: "240 minutes" + script: + - *print-common-info + - *update-scripts-repo + - if [ $USE_LTV -eq 1 ]; then + - *update-ltv-repo + - *copy-ltv-files-to-testv-dir + - fi + - python3 ci/remove_unsupported_testcases.py $PRM_FILES + - if [ $LEVEL_SCALING != "1.0" ];then + - *apply-testv-scaling + - fi + - *mld-test-setup-codec + + ### run pytest + - exit_code=0 + # timeout of 15 min per individual testcase - hopefully too much, but better be safe for now + - testcase_timeout=900 + - python3 -m pytest $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + + - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv + + - 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 + - exit 0 + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + - report.html + - mld.csv + expose_as: "pytest mld results" + reports: + junit: + - report-junit.xml + + +.ivas-pytest-sanitizers-anchor: &ivas-pytest-sanitizers-anchor + stage: test + needs: ["build-codec-linux-make"] + timeout: "90 minutes" + rules: + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + when: never + - if: $CI_PIPELINE_SOURCE == 'schedule' && $IVAS_PYTEST_MSAN + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "sanitizer-stv" + script: + - *print-common-info + - *update-scripts-repo + - python3 ci/remove_unsupported_testcases.py $PRM_FILES + - *setup-codec + - make clean + - make -j CLANG=$CLANG_NUM + - if [[ $CLANG_NUM == 3 ]]; then export UBSAN_OPTIONS="suppressions=scripts/ubsan.supp,report_error_type=1"; fi + - testcase_timeout=300 + - python3 -m pytest $SHORT_TEST_SUITE -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path ./IVAS_cod_ref --ref_decoder_path ./IVAS_dec + artifacts: + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" + when: always + expire_in: "2 weeks" + paths: + - report-junit.xml + - report.html + reports: + junit: + - report-junit.xml + +# --------------------------------------------------------------- +# Build jobs +# --------------------------------------------------------------- + +# ensure that codec builds on linux +build-codec-linux-make: + rules: + - if: $CI_PIPELINE_SOURCE == 'web' + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'schedule' + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + extends: + - .build-job-linux + script: + - *print-common-info + - make -j + +# ensure that codec builds on linux with instrumentation active +build-codec-linux-instrumented-make: + rules: + - if: $CI_PIPELINE_SOURCE == 'web' + - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'schedule' + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + extends: + - .build-job-linux + script: + - *print-common-info + - sed -i".bak" "s/\/\*#define WMOPS 1\*\//#define WMOPS 1/g" lib_com/count.h + - make -j + +# --------------------------------------------------------------- +# Short test jobs +# --------------------------------------------------------------- + +#ivas-pytest-mld-enc-dec: +# extends: +# - .rules-pytest-mld +# - .test-job-linux +# before_script: +# - USE_LTV=0 +# - TEST_SUITE="$SHORT_TEST_SUITE" +# - LEVEL_SCALING=1.0 +# <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-dec: + extends: + - .rules-pytest-mld + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-mld-anchor + +#ivas-pytest-mld-enc-dec-lev-10: +# extends: +# - .rules-pytest-mld +# - .test-job-linux +# before_script: +# - USE_LTV=0 +# - TEST_SUITE="$SHORT_TEST_SUITE" +# - LEVEL_SCALING=0.3162 +# <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-dec-lev-10: + extends: + - .rules-pytest-mld + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=0.3162 + <<: *ivas-pytest-mld-anchor + +#ivas-pytest-mld-enc-dec-lev+10: +# extends: +# - .rules-pytest-mld +# - .test-job-linux +# before_script: +# - USE_LTV=0 +# - TEST_SUITE="$SHORT_TEST_SUITE" +# - LEVEL_SCALING=3.162 +# <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-dec-lev+10: + extends: + - .rules-pytest-mld + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-long-enc-fx-dec-flt-interop: + extends: + - .rules-pytest-mld-interop + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_DECODER_PATH=./IVAS_dec_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-long-enc-fx-dec-flt-lev-10-interop: + extends: + - .rules-pytest-mld-interop + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_DECODER_PATH=./IVAS_dec_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=0.3162 + <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-long-enc-fx-dec-flt-lev+10-interop: + extends: + - .rules-pytest-mld-interop + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_DECODER_PATH=./IVAS_dec_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-mld-anchor + +ivas-pytest-dec-msan: + extends: + - .test-job-linux + before_script: + - CLANG_NUM=1 + <<: *ivas-pytest-sanitizers-anchor + +ivas-pytest-dec-asan: + extends: + - .test-job-linux + before_script: + - CLANG_NUM=2 + <<: *ivas-pytest-sanitizers-anchor + +ivas-pytest-dec-usan: + extends: + - .test-job-linux + before_script: + - CLANG_NUM=3 + <<: *ivas-pytest-sanitizers-anchor + +# --------------------------------------------------------------- +# Long test jobs +# --------------------------------------------------------------- + +ivas-pytest-mld-long-enc-dec: + extends: + - .rules-pytest-mld-long + - .test-job-linux + before_script: + - USE_LTV=1 + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-long-dec: + extends: + - .rules-pytest-mld-long + - .test-job-linux + before_script: + - USE_LTV=1 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-long-enc-dec-lev-10: + extends: + - .rules-pytest-mld-long + - .test-job-linux + before_script: + - USE_LTV=1 + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=0.3162 + <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-long-dec-lev-10: + extends: + - .rules-pytest-mld-long + - .test-job-linux + before_script: + - USE_LTV=1 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=0.3162 + <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-long-enc-dec-lev+10: + extends: + - .rules-pytest-mld-long + - .test-job-linux + before_script: + - USE_LTV=1 + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-mld-anchor + +ivas-pytest-mld-long-dec-lev+10: + extends: + - .rules-pytest-mld-long + - .test-job-linux + before_script: + - USE_LTV=1 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-mld-anchor + +ivas-smoke-test-saturation: + extends: + - .rules-pytest-saturation-smoke-test + - .test-job-linux-needs-testv-dir + script: + - USE_LTV=1 + - LEVEL_SCALING=32768 + + - *print-common-info + - *update-scripts-repo + - if [ $USE_LTV -eq 1 ]; then + - *update-ltv-repo + - *copy-ltv-files-to-testv-dir + - fi + - if [ $LEVEL_SCALING != "1.0" ];then + - *apply-testv-scaling + - fi + - cp -r scripts/testv/* $TESTV_DIR/ + + # skip prepare_mem_dryrun.py script in smoke_test.sh + - sed -i 's/python3 .\/scripts\/prepare_mem_dryrun.py/#python3 .\/scripts\/prepare_mem_dryrun.py/g' ci/smoke_test.sh + + - bash ci/smoke_test.sh + ### analyze for failures + - if ! [ -s smoke_test_output.txt ] || ! [ -s smoke_test_output_plc.txt ] || ! [ -s smoke_test_output_jbm_noEXT.txt ] || ! [ -s smoke_test_output_hrtf.txt ]; then echo "Error in smoke test"; exit 1; fi + - ret_val=0 + - if cat smoke_test_output.txt | grep -c "failed" ; then echo "Smoke test without PLC failed"; ret_val=1; fi + - if cat smoke_test_output_plc.txt | grep -c "failed"; then echo "Smoke test with PLC failed"; ret_val=1; fi + - if cat smoke_test_output_jbm_noEXT.txt | grep -c "failed"; then echo "Smoke test JBM part failed"; ret_val=1; fi + - if cat smoke_test_output_hrtf.txt | grep -c "failed"; then echo "Smoke test with external hrtf files failed"; ret_val=1; fi + - exit $ret_val + artifacts: + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" + expire_in: 1 week + when: always + paths: + - smoke_test_output.txt + - smoke_test_output_plc.txt + - smoke_test_output_jbm_noEXT.txt + - smoke_test_output_hrtf.txt + expose_as: "saturation smoke test results" + +# --------------------------------------------------------------- +# EVS 26.444 test job +# --------------------------------------------------------------- + +# check bitexactness to EVS +be-2-evs-26444: + extends: + - .test-job-linux + rules: + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "evs-26444" + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" + tags: + - be-2-evs-basop + stage: test + timeout: "120 minutes" # To be revisited + script: + - *print-common-info + - *update-scripts-repo + - sed -i".bak" "s/\(#define EVS_FLOAT\)/\/\/\1/" lib_com/options.h + - make -j + + # copy over to never change the testvector dir + - cp -r $EVS_BE_TEST_DIR_BASOP ./evs_be_test + - mkdir -p ./evs_be_test/output/decoded ./evs_be_test/output/bitstreams + + - exit_code=0 + - python3 -m pytest tests/test_26444.py -v --html=report.html --self-contained-html --junit-xml=report-junit.xml -n auto || exit_code=$? + - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_FAIL; fi + - exit 0 + + artifacts: + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + - report.html + expose_as: "EVS 26444 result" + reports: + junit: + - report-junit.xml -- GitLab From 39972794b5c540b0c4565b5cc85b71d488c8cfd6 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Thu, 16 May 2024 11:19:54 +0200 Subject: [PATCH 02/10] fix ASAN errors: backport fixes 1033, 976 --- lib_com/options.h | 2 ++ lib_dec/ivas_mct_dec.c | 11 +++++++++-- lib_dec/ivas_omasa_dec.c | 23 +++++++++++++++++++---- lib_dec/pvq_core_dec.c | 19 ++++++++++++++++++- lib_enc/pvq_core_enc.c | 5 +++++ 5 files changed, 53 insertions(+), 7 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5fc586e96..4059b58d5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -61,6 +61,8 @@ #define NON_BE_FIX_1048_THRESHOLD_COH_BASOP /* Nokia: Fix 1048 replace comparison with 0 with comparison to threshold, to align with BASOP*/ #define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */ #define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Philips: issue 738: Quaternion spherical linear interpolation precision handling issues */ +#define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ +#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ /* #################### End FIXES switches ############################ */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 0212b00b5..df074a1d0 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1140,8 +1140,15 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - st_ivas->hHrtfTD = NULL; +#ifdef FIX_1033_MEMORY_LEAK_OMASA + if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) + { +#endif + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + st_ivas->hHrtfTD = NULL; +#ifdef FIX_1033_MEMORY_LEAK_OMASA + } +#endif } if ( st_ivas->hDiracDecBin != NULL ) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 6bf9cdfdd..9f8039495 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -310,10 +310,17 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { /* Allocate TD renderer for the objects in DISC mode */ - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) +#ifdef FIX_1033_MEMORY_LEAK_OMASA + if ( st_ivas->hBinRendererTd == NULL ) { - return error; +#endif + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1033_MEMORY_LEAK_OMASA } +#endif /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -324,8 +331,16 @@ ivas_error ivas_omasa_dec_config( else { /* TD renderer handle */ - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - st_ivas->hHrtfTD = NULL; +#ifdef FIX_1033_MEMORY_LEAK_OMASA + if ( st_ivas->hBinRendererTd != NULL && st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) + { +#endif + /* TD renderer handle */ + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + st_ivas->hHrtfTD = NULL; +#ifdef FIX_1033_MEMORY_LEAK_OMASA + } +#endif /* ISM renderer handle + ISM data handle */ ivas_omasa_separate_object_renderer_close( st_ivas ); diff --git a/lib_dec/pvq_core_dec.c b/lib_dec/pvq_core_dec.c index 677b80f5c..b7b0d7775 100644 --- a/lib_dec/pvq_core_dec.c +++ b/lib_dec/pvq_core_dec.c @@ -109,8 +109,17 @@ static void pvq_decode_band( for ( j = 0; j < Np; j++ ) { - g_part[j] = -( (float) g_part_s[j] ) / 32768; +#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR + /* note: here g_part needs to be become exactly 1.0(float) thus in BASOP Word16 g_part_s is in the negative Q15 domain */ +#endif + + +#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR + /* aligned to BASOP to avoid USAN undefined negation warning for -(-32768) */ + g_part_s[j] = negate( g_part_s[j] ); +#else g_part_s[j] = -g_part_s[j]; +#endif } srt_vec_ind( g_part_s, sg_part, idx_sort, Np ); @@ -416,7 +425,11 @@ static void densitySymbolIndexDecode( { tot = res * ( res + 1 ) + 1; dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); +#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR + alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( ( res + 1 ) * ( res + 1 ) - dec_freq ) ) + res + 1; +#else alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( res + 1 ) * ( res + 1 ) - dec_freq ) + res + 1; +#endif sym_freq = 2 * ( res - alpha ) + 1; cum_freq = alpha * ( 2 * ( res + 1 ) - alpha ); } @@ -434,7 +447,11 @@ static void densitySymbolIndexDecode( dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); if ( dec_freq < tot - ( res + 1 ) - ( res - ( c + 1 ) ) * ( res - c ) * c + c + 1 ) { +#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR + alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) ( res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) ) / ( 2 * res_c ); +#else alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) / ( 2 * res_c ); +#endif sym_freq = 2 * alpha * res_c + 1; cum_freq = alpha * ( ( alpha - 1 ) * res_c + 1 ); } diff --git a/lib_enc/pvq_core_enc.c b/lib_enc/pvq_core_enc.c index 0a8b7954d..03d5b1995 100644 --- a/lib_enc/pvq_core_enc.c +++ b/lib_enc/pvq_core_enc.c @@ -121,7 +121,12 @@ static void pvq_encode_band( for ( j = 0; j < Np; j++ ) { g_part[j] = -( (float) g_part_s[j] ) / 32768; +#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR + /* aligned to BASOP to avoid USAN undefined negation warning with -(-32768) */ + g_part_s[j] = negate( g_part_s[j] ); +#else g_part_s[j] = -g_part_s[j]; +#endif } srt_vec_ind( g_part_s, sg_part, idx_sort, Np ); -- GitLab From 68237a36ec8e4bcb7e6895e8eb4a516f97ddc6e7 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Thu, 16 May 2024 14:11:20 +0200 Subject: [PATCH 03/10] backport fix 1027 --- lib_com/options.h | 1 + lib_dec/gs_dec.c | 4 ++++ lib_enc/gs_enc.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 4059b58d5..8852e4988 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -63,6 +63,7 @@ #define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Philips: issue 738: Quaternion spherical linear interpolation precision handling issues */ #define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ #define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ +#define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ /* #################### End FIXES switches ############################ */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index ba9c574af..0395f5419 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -640,7 +640,11 @@ void gsc_dec( } if ( concat_out[j] < 0 ) { +#ifdef FIX_1027_GSC_INT_OVERFLOW + seed_init = (int16_t) ( (int32_t) seed_init + 3 ); +#else seed_init += 3; +#endif } } diff --git a/lib_enc/gs_enc.c b/lib_enc/gs_enc.c index c22285436..02456d250 100644 --- a/lib_enc/gs_enc.c +++ b/lib_enc/gs_enc.c @@ -542,7 +542,11 @@ void gsc_enc( } if ( concat_out[j] < 0 ) { +#ifdef FIX_1027_GSC_INT_OVERFLOW + seed_init = (int16_t) ( (int32_t) seed_init + 3 ); +#else seed_init += 3; +#endif } } -- GitLab From 830667b9f20d2d3c68eb43954f0cdc3ae79a2af5 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Fri, 17 May 2024 11:23:06 +0200 Subject: [PATCH 04/10] deactivate fix 976 --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8852e4988..21698df8f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -62,7 +62,7 @@ #define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */ #define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Philips: issue 738: Quaternion spherical linear interpolation precision handling issues */ #define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ -#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ +//#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ #define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ /* #################### End FIXES switches ############################ */ -- GitLab From e29aba03f2bfa0a41584813c7a9154c7a0bcc9b9 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Fri, 17 May 2024 11:29:57 +0200 Subject: [PATCH 05/10] Revert "deactivate fix 976" This reverts commit 830667b9f20d2d3c68eb43954f0cdc3ae79a2af5. --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 21698df8f..8852e4988 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -62,7 +62,7 @@ #define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */ #define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Philips: issue 738: Quaternion spherical linear interpolation precision handling issues */ #define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ -//#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ +#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ #define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ /* #################### End FIXES switches ############################ */ -- GitLab From cfbc5f481e54897258f8e5bbaaad5532c3b9c73f Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Wed, 22 May 2024 11:51:35 +0200 Subject: [PATCH 06/10] backport fix 1096 --- lib_dec/ivas_sba_dirac_stereo_dec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index d8487479f..77da09008 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -384,10 +384,23 @@ static void map_params_dirac_to_stereo( } } +#ifdef NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO + /* Clamp values here. [-1, 1] is the allowed range, but due to precision issues they can be slightly off which can cause problems later. */ side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); + side_gain[b] = max( min( side_gain[b], 1 ), -1 ); side_gain[b + STEREO_DFT_BAND_MAX] *= sqrtf( 1.f - diffuseness[b] ); + side_gain[b + STEREO_DFT_BAND_MAX] = max( min( side_gain[b + STEREO_DFT_BAND_MAX], 1 ), -1 ); + /* for residual prediction gain, allowed range is [0, 1]*/ res_pred_gain[b] = diffuseness[b] * ( 1.0f - surrCoh[b] ); + res_pred_gain[b] = max( min( res_pred_gain[b], 1 ), 0 ); res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); + res_pred_gain[b + STEREO_DFT_BAND_MAX] = max( min( res_pred_gain[b + STEREO_DFT_BAND_MAX], 1 ), 0 ); +#else + side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); + side_gain[b + STEREO_DFT_BAND_MAX] *= sqrtf( 1.f - diffuseness[b] ); + res_pred_gain[b] = diffuseness[b] * ( 1.0f - surrCoh[b] ); + res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); +#endif } } -- GitLab From 8a79ebcd80d405430f8a5457d7567f5c02e038e7 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Wed, 22 May 2024 13:03:44 +0200 Subject: [PATCH 07/10] activate fix 1096 --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index 8852e4988..57a7331ee 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -64,6 +64,7 @@ #define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ #define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ #define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ +#define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */ /* #################### End FIXES switches ############################ */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ -- GitLab From df21a8ac89fbf5a798bd3a5c473265e3f7ea9fdc Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Thu, 23 May 2024 11:07:55 +0200 Subject: [PATCH 08/10] backport fix 1055 --- lib_com/options.h | 1 + lib_dec/updt_dec.c | 4 ++++ lib_enc/core_enc_updt.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 57a7331ee..14da881e6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -65,6 +65,7 @@ #define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ #define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ #define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */ +#define NON_BE_1055_RESET_LP_MEMORIES /* VA: issue 1055: Correctly reset LP filter MA and AR memories in bitrate switching */ /* #################### End FIXES switches ############################ */ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ diff --git a/lib_dec/updt_dec.c b/lib_dec/updt_dec.c index 9ee8093ff..658c362df 100644 --- a/lib_dec/updt_dec.c +++ b/lib_dec/updt_dec.c @@ -518,7 +518,11 @@ void updt_dec_common( st->stab_fac_smooth_lt = ENV_SMOOTH_FAC * st->stab_fac + ( 1.0f - ENV_SMOOTH_FAC ) * st->stab_fac_smooth_lt; } +#ifdef NON_BE_1055_RESET_LP_MEMORIES + if ( ( st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) ) ) +#else if ( ( st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && st->codec_mode == MODE2 ) ) +#endif { /* reset LP memories */ set_zero( st->mem_MA, M ); diff --git a/lib_enc/core_enc_updt.c b/lib_enc/core_enc_updt.c index 1e17f7822..16a2118d5 100644 --- a/lib_enc/core_enc_updt.c +++ b/lib_enc/core_enc_updt.c @@ -89,7 +89,11 @@ void core_encode_update( } } +#ifdef NON_BE_1055_RESET_LP_MEMORIES + if ( ( st->Opt_DTX_ON && st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) ) ) +#else if ( ( st->Opt_DTX_ON && st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && st->codec_mode == MODE2 ) ) +#endif { /* reset LP memories */ set_zero( st->mem_MA, M ); -- GitLab From 5c55ad3a843ca4ad8a93817868161880ae3afccf Mon Sep 17 00:00:00 2001 From: malenov Date: Tue, 28 May 2024 12:27:10 +0200 Subject: [PATCH 09/10] missing normalization step inside FIX_976_USAN_PVQ_ENC_DEC_EVS_CR --- lib_dec/pvq_core_dec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_dec/pvq_core_dec.c b/lib_dec/pvq_core_dec.c index b7b0d7775..49a3e4f97 100644 --- a/lib_dec/pvq_core_dec.c +++ b/lib_dec/pvq_core_dec.c @@ -110,6 +110,7 @@ static void pvq_decode_band( for ( j = 0; j < Np; j++ ) { #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR + g_part[j] = -( (float) g_part_s[j] ) / 32768; /* note: here g_part needs to be become exactly 1.0(float) thus in BASOP Word16 g_part_s is in the negative Q15 domain */ #endif -- GitLab From f4be2686faa39aa6565b99c66e16610681438188 Mon Sep 17 00:00:00 2001 From: norvell Date: Thu, 30 May 2024 13:20:47 +0000 Subject: [PATCH 10/10] Delete .gitlab-ci.yml --- .gitlab-ci.yml | 594 ------------------------------------------------- 1 file changed, 594 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 02e28fa0e..000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,594 +0,0 @@ -variables: - TESTV_DIR: "/usr/local/testv" - LTV_DIR: "/usr/local/ltv" - EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop" - REFERENCE_BRANCH: "ivas-float-update" - BUILD_OUTPUT: "build_output.txt" - SCRIPTS_DIR: "/usr/local/scripts" - EXIT_CODE_NON_BE: 123 - EXIT_CODE_FAIL: 1 - LONG_TEST_SUITE: "tests/test_param_file_ltv.py tests/renderer" - SHORT_TEST_SUITE: "tests/codec_be_on_mr_nonselection" - TEST_SUITE: "" - DUT_ENCODER_PATH: "./IVAS_cod" - DUT_DECODER_PATH: "./IVAS_dec" - LEVEL_SCALING: "1.0" - IVAS_PIPELINE_NAME: '' - BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" - PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm" - MANUAL_PIPELINE_TYPE: - description: "Type for the manual pipeline run. Use 'pytest-mld' to run MLD test against reference float codec." # Not implemented yet, but may be good to have a manual pipeline trigger - value: 'default' - options: - - 'default' - - 'pytest-mld' - - 'pytest-mld-interop' - - 'pytest-mld-long' - - 'pytest-saturation-smoke-test' - - 'evs-26444' - - 'sanitizer-stv' - - -default: - interruptible: true # Make all jobs by default interruptible - -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' - ### disabled for now because pipeline setup is redundant with MR pipeline with current workflow - # - 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 == '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 == 'pytest-mld' - variables: - IVAS_PIPELINE_NAME: 'Run MLD tool against float ref: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-mld-interop' - variables: - IVAS_PIPELINE_NAME: 'Run MLD tool agains float ref - interop: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-mld-long' - variables: - IVAS_PIPELINE_NAME: 'Run MLD tool against float ref (long test vectors): $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-saturation-smoke-test' - variables: - IVAS_PIPELINE_NAME: 'Run saturation smoke-test: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'evs-26444' - variables: - IVAS_PIPELINE_NAME: 'EVS 26.444 test: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'sanitizer-stv' - variables: - IVAS_PIPELINE_NAME: 'Short testvectors sanitizers' - - if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch - variables: - IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH' - - -stages: - - build - - test - -# --------------------------------------------------------------- -# Generic script anchors -# --------------------------------------------------------------- - -# These can be used later on to do common tasks - -# Prints useful information for every job and should be used at the beginning of each job -.print-common-info: &print-common-info - - | - echo "Printing common information for build job." - echo "Current job is run on commit $CI_COMMIT_SHA" - echo "Commit time was $CI_COMMIT_TIMESTAMP" - date | xargs echo "System time is" - -.setup-codec: &setup-codec - - current_commit_sha=$(git rev-parse HEAD) - ### build reference binaries - - git checkout $REFERENCE_BRANCH - - git pull - - make clean - - make -j - - mv ./IVAS_cod ./IVAS_cod_ref - - mv ./IVAS_dec ./IVAS_dec_ref - - mv ./IVAS_rend ./IVAS_rend_ref - - ### build test binaries - - git checkout $current_commit_sha - - make clean - - make -j - - -.mld-test-setup-codec: &mld-test-setup-codec - - *setup-codec - - ### prepare pytest - # create short test vectors - - python3 tests/create_short_testvectors.py - # create references - - exit_code=0 - - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref --create_ref -n auto || exit_code=$? - - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto || exit_code=$? # Catch exit code to prevent halt in case this step produces zero tests - - -.update-scripts-repo: &update-scripts-repo - - cd $SCRIPTS_DIR - - git remote set-branches --add origin $BASOP_CI_BRANCH_PC_REPO - - git remote prune origin - - git branch - - git fetch - - git checkout $BASOP_CI_BRANCH_PC_REPO - - git pull - - cd - - - cp -r $SCRIPTS_DIR/ci . - - cp -r $SCRIPTS_DIR/scripts . - - cp -r $SCRIPTS_DIR/tests . - - cp $SCRIPTS_DIR/pytest.ini . - -.apply-testv-scaling: &apply-testv-scaling - - echo "Applying level scaling in scripts/testv using scale=$LEVEL_SCALING" - - tests/scale_pcm.py ./scripts/testv/ $LEVEL_SCALING - -.update-ltv-repo: &update-ltv-repo - - cd $LTV_DIR - - git pull - - cd - - -.copy-ltv-files-to-testv-dir: ©-ltv-files-to-testv-dir - - cp "$LTV_DIR"/*.wav scripts/testv/ - - cp "$LTV_DIR"/*.met scripts/testv/ - - cp "$LTV_DIR"/*.csv scripts/testv/ - -.rules-pytest-mld: - rules: - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-mld" - - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - - if: $CI_PIPELINE_SOURCE == 'push' - when: never - - if: $CI_PIPELINE_SOURCE == 'schedule' - when: never - -.rules-pytest-mld-long: - rules: - - if: $PYTEST_MLD_LONG # Set by scheduled pipeline - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-mld-long" - - if: $CI_PIPELINE_SOURCE == 'push' - when: never - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - when: never - - -.rules-pytest-mld-interop: - rules: - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-mld-interop" - - if: $CI_PIPELINE_SOURCE == 'push' - when: never - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - when: never - -.rules-pytest-saturation-smoke-test: - rules: - - if: $PYTEST_SMOKE_TEST # Set by scheduled pipeline - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-saturation-smoke-test" - - if: $CI_PIPELINE_SOURCE == 'push' - when: never - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - when: never - -# --------------------------------------------------------------- -# Job templates -# --------------------------------------------------------------- - -# templates to define stages and platforms -.test-job-linux: - tags: - - ivas-basop-linux - -.build-job-linux: - stage: build - timeout: "2 minutes" - needs: [] - tags: - - ivas-basop-linux - -# template for test jobs on linux that need the TESTV_DIR -.test-job-linux-needs-testv-dir: - extends: .test-job-linux - before_script: - - *update-scripts-repo - - if [ ! -d "$TESTV_DIR" ]; then mkdir -p $TESTV_DIR; fi - - cp -r scripts/testv/* $TESTV_DIR/ - -.ivas-pytest-mld-anchor: &ivas-pytest-mld-anchor - stage: test - needs: ["build-codec-linux-make"] - timeout: "240 minutes" - script: - - *print-common-info - - *update-scripts-repo - - if [ $USE_LTV -eq 1 ]; then - - *update-ltv-repo - - *copy-ltv-files-to-testv-dir - - fi - - python3 ci/remove_unsupported_testcases.py $PRM_FILES - - if [ $LEVEL_SCALING != "1.0" ];then - - *apply-testv-scaling - - fi - - *mld-test-setup-codec - - ### run pytest - - exit_code=0 - # timeout of 15 min per individual testcase - hopefully too much, but better be safe for now - - testcase_timeout=900 - - python3 -m pytest $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? - - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv - - - 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 - - exit 0 - - allow_failure: - exit_codes: - - 123 - artifacts: - name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - - report.html - - mld.csv - expose_as: "pytest mld results" - reports: - junit: - - report-junit.xml - - -.ivas-pytest-sanitizers-anchor: &ivas-pytest-sanitizers-anchor - stage: test - needs: ["build-codec-linux-make"] - timeout: "90 minutes" - rules: - - if: $CI_PIPELINE_SOURCE == 'push' - when: never - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - when: never - - if: $CI_PIPELINE_SOURCE == 'schedule' && $IVAS_PYTEST_MSAN - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "sanitizer-stv" - script: - - *print-common-info - - *update-scripts-repo - - python3 ci/remove_unsupported_testcases.py $PRM_FILES - - *setup-codec - - make clean - - make -j CLANG=$CLANG_NUM - - if [[ $CLANG_NUM == 3 ]]; then export UBSAN_OPTIONS="suppressions=scripts/ubsan.supp,report_error_type=1"; fi - - testcase_timeout=300 - - python3 -m pytest $SHORT_TEST_SUITE -v --tb=no --update_ref 1 -m create_ref --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path ./IVAS_cod_ref --ref_decoder_path ./IVAS_dec - artifacts: - name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" - when: always - expire_in: "2 weeks" - paths: - - report-junit.xml - - report.html - reports: - junit: - - report-junit.xml - -# --------------------------------------------------------------- -# Build jobs -# --------------------------------------------------------------- - -# ensure that codec builds on linux -build-codec-linux-make: - rules: - - if: $CI_PIPELINE_SOURCE == 'web' - - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'push' - when: never - extends: - - .build-job-linux - script: - - *print-common-info - - make -j - -# ensure that codec builds on linux with instrumentation active -build-codec-linux-instrumented-make: - rules: - - if: $CI_PIPELINE_SOURCE == 'web' - - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - - if: $CI_PIPELINE_SOURCE == 'schedule' - - if: $CI_PIPELINE_SOURCE == 'push' - when: never - extends: - - .build-job-linux - script: - - *print-common-info - - sed -i".bak" "s/\/\*#define WMOPS 1\*\//#define WMOPS 1/g" lib_com/count.h - - make -j - -# --------------------------------------------------------------- -# Short test jobs -# --------------------------------------------------------------- - -#ivas-pytest-mld-enc-dec: -# extends: -# - .rules-pytest-mld -# - .test-job-linux -# before_script: -# - USE_LTV=0 -# - TEST_SUITE="$SHORT_TEST_SUITE" -# - LEVEL_SCALING=1.0 -# <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-dec: - extends: - - .rules-pytest-mld - - .test-job-linux - before_script: - - USE_LTV=0 - - DUT_ENCODER_PATH=./IVAS_cod_ref - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=1.0 - <<: *ivas-pytest-mld-anchor - -#ivas-pytest-mld-enc-dec-lev-10: -# extends: -# - .rules-pytest-mld -# - .test-job-linux -# before_script: -# - USE_LTV=0 -# - TEST_SUITE="$SHORT_TEST_SUITE" -# - LEVEL_SCALING=0.3162 -# <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-dec-lev-10: - extends: - - .rules-pytest-mld - - .test-job-linux - before_script: - - USE_LTV=0 - - DUT_ENCODER_PATH=./IVAS_cod_ref - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=0.3162 - <<: *ivas-pytest-mld-anchor - -#ivas-pytest-mld-enc-dec-lev+10: -# extends: -# - .rules-pytest-mld -# - .test-job-linux -# before_script: -# - USE_LTV=0 -# - TEST_SUITE="$SHORT_TEST_SUITE" -# - LEVEL_SCALING=3.162 -# <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-dec-lev+10: - extends: - - .rules-pytest-mld - - .test-job-linux - before_script: - - USE_LTV=0 - - DUT_ENCODER_PATH=./IVAS_cod_ref - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=3.162 - <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-long-enc-fx-dec-flt-interop: - extends: - - .rules-pytest-mld-interop - - .test-job-linux - before_script: - - USE_LTV=0 - - DUT_DECODER_PATH=./IVAS_dec_ref - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=1.0 - <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-long-enc-fx-dec-flt-lev-10-interop: - extends: - - .rules-pytest-mld-interop - - .test-job-linux - before_script: - - USE_LTV=0 - - DUT_DECODER_PATH=./IVAS_dec_ref - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=0.3162 - <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-long-enc-fx-dec-flt-lev+10-interop: - extends: - - .rules-pytest-mld-interop - - .test-job-linux - before_script: - - USE_LTV=0 - - DUT_DECODER_PATH=./IVAS_dec_ref - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=3.162 - <<: *ivas-pytest-mld-anchor - -ivas-pytest-dec-msan: - extends: - - .test-job-linux - before_script: - - CLANG_NUM=1 - <<: *ivas-pytest-sanitizers-anchor - -ivas-pytest-dec-asan: - extends: - - .test-job-linux - before_script: - - CLANG_NUM=2 - <<: *ivas-pytest-sanitizers-anchor - -ivas-pytest-dec-usan: - extends: - - .test-job-linux - before_script: - - CLANG_NUM=3 - <<: *ivas-pytest-sanitizers-anchor - -# --------------------------------------------------------------- -# Long test jobs -# --------------------------------------------------------------- - -ivas-pytest-mld-long-enc-dec: - extends: - - .rules-pytest-mld-long - - .test-job-linux - before_script: - - USE_LTV=1 - - TEST_SUITE="$LONG_TEST_SUITE" - - LEVEL_SCALING=1.0 - <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-long-dec: - extends: - - .rules-pytest-mld-long - - .test-job-linux - before_script: - - USE_LTV=1 - - DUT_ENCODER_PATH=./IVAS_cod_ref - - TEST_SUITE="$LONG_TEST_SUITE" - - LEVEL_SCALING=1.0 - <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-long-enc-dec-lev-10: - extends: - - .rules-pytest-mld-long - - .test-job-linux - before_script: - - USE_LTV=1 - - TEST_SUITE="$LONG_TEST_SUITE" - - LEVEL_SCALING=0.3162 - <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-long-dec-lev-10: - extends: - - .rules-pytest-mld-long - - .test-job-linux - before_script: - - USE_LTV=1 - - DUT_ENCODER_PATH=./IVAS_cod_ref - - TEST_SUITE="$LONG_TEST_SUITE" - - LEVEL_SCALING=0.3162 - <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-long-enc-dec-lev+10: - extends: - - .rules-pytest-mld-long - - .test-job-linux - before_script: - - USE_LTV=1 - - TEST_SUITE="$LONG_TEST_SUITE" - - LEVEL_SCALING=3.162 - <<: *ivas-pytest-mld-anchor - -ivas-pytest-mld-long-dec-lev+10: - extends: - - .rules-pytest-mld-long - - .test-job-linux - before_script: - - USE_LTV=1 - - DUT_ENCODER_PATH=./IVAS_cod_ref - - TEST_SUITE="$LONG_TEST_SUITE" - - LEVEL_SCALING=3.162 - <<: *ivas-pytest-mld-anchor - -ivas-smoke-test-saturation: - extends: - - .rules-pytest-saturation-smoke-test - - .test-job-linux-needs-testv-dir - script: - - USE_LTV=1 - - LEVEL_SCALING=32768 - - - *print-common-info - - *update-scripts-repo - - if [ $USE_LTV -eq 1 ]; then - - *update-ltv-repo - - *copy-ltv-files-to-testv-dir - - fi - - if [ $LEVEL_SCALING != "1.0" ];then - - *apply-testv-scaling - - fi - - cp -r scripts/testv/* $TESTV_DIR/ - - # skip prepare_mem_dryrun.py script in smoke_test.sh - - sed -i 's/python3 .\/scripts\/prepare_mem_dryrun.py/#python3 .\/scripts\/prepare_mem_dryrun.py/g' ci/smoke_test.sh - - - bash ci/smoke_test.sh - ### analyze for failures - - if ! [ -s smoke_test_output.txt ] || ! [ -s smoke_test_output_plc.txt ] || ! [ -s smoke_test_output_jbm_noEXT.txt ] || ! [ -s smoke_test_output_hrtf.txt ]; then echo "Error in smoke test"; exit 1; fi - - ret_val=0 - - if cat smoke_test_output.txt | grep -c "failed" ; then echo "Smoke test without PLC failed"; ret_val=1; fi - - if cat smoke_test_output_plc.txt | grep -c "failed"; then echo "Smoke test with PLC failed"; ret_val=1; fi - - if cat smoke_test_output_jbm_noEXT.txt | grep -c "failed"; then echo "Smoke test JBM part failed"; ret_val=1; fi - - if cat smoke_test_output_hrtf.txt | grep -c "failed"; then echo "Smoke test with external hrtf files failed"; ret_val=1; fi - - exit $ret_val - artifacts: - name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" - expire_in: 1 week - when: always - paths: - - smoke_test_output.txt - - smoke_test_output_plc.txt - - smoke_test_output_jbm_noEXT.txt - - smoke_test_output_hrtf.txt - expose_as: "saturation smoke test results" - -# --------------------------------------------------------------- -# EVS 26.444 test job -# --------------------------------------------------------------- - -# check bitexactness to EVS -be-2-evs-26444: - extends: - - .test-job-linux - rules: - - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "evs-26444" - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" - tags: - - be-2-evs-basop - stage: test - timeout: "120 minutes" # To be revisited - script: - - *print-common-info - - *update-scripts-repo - - sed -i".bak" "s/\(#define EVS_FLOAT\)/\/\/\1/" lib_com/options.h - - make -j - - # copy over to never change the testvector dir - - cp -r $EVS_BE_TEST_DIR_BASOP ./evs_be_test - - mkdir -p ./evs_be_test/output/decoded ./evs_be_test/output/bitstreams - - - exit_code=0 - - python3 -m pytest tests/test_26444.py -v --html=report.html --self-contained-html --junit-xml=report-junit.xml -n auto || exit_code=$? - - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit $EXIT_CODE_FAIL; fi - - exit 0 - - artifacts: - name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - - report.html - expose_as: "EVS 26444 result" - reports: - junit: - - report-junit.xml -- GitLab