From b46163d3577be8ae0792bf3623e3e1daed5e29d3 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 9 Jan 2024 22:01:13 +0530 Subject: [PATCH 1/4] Fixes the overflow issue for file with 10dB gain. [x] Fixes the overflow issue by using 64-bit operations in for loop and then using the MSB for further calculations. --- lib_dec/bass_psfilter.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index c0b445fcb..72bebb691 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -589,7 +589,7 @@ int16_t res_bpf_adapt( Word16 res_bpf_adapt_fx( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ - Word32 res_buf[STEREO_DFT_N_8k] /* i : residual buffer */ + Word32 res_buf[STEREO_DFT_N_8k] /* i : residual buffer Q12 */ ) { Word32 error_nrg; @@ -601,6 +601,8 @@ Word16 res_bpf_adapt_fx( Word16 i_start; Word16 i_end; Word16 bw_inv; + Word16 shift; + Word64 W_tmp; IF( EQ_16( hStereoDft->res_cod_band_max, 6 ) ) { @@ -617,11 +619,20 @@ Word16 res_bpf_adapt_fx( /* Measure energy of high frequency band in MDCT domain */ res_hb_nrg = L_deposit_l( 0 ); + W_tmp = W_deposit32_l( 0 ); FOR( i = i_start; i < i_end; i++ ) { - res_hb_nrg = Madd_32_32_r( res_hb_nrg, res_buf[i], res_buf[i] ); + W_tmp = W_add_nosat( W_tmp, W_mult0_32_32( res_buf[i], res_buf[i] ) ); } - res_hb_nrg = L_shl( (Word32) res_hb_nrg, Q7 ); // Q0 + + shift = W_norm( W_tmp ); + W_tmp = W_shl( W_tmp, shift ); + res_hb_nrg = W_extract_h( W_tmp ); + IF( GT_16( add( Q24, shift ), 32 ) ) + { + res_hb_nrg = L_shr( res_hb_nrg, sub( add( Q24, shift ), 32 ) ); // Q0 + } + res_hb_nrg = Mpy_32_16_1( res_hb_nrg, bw_inv ); res_hb_nrg = L_add( Mpy_32_16_1( res_hb_nrg, STEREO_DFT_BPF_ADAPT_ALPHA_FX ), Mpy_32_16_1( hStereoDft->res_hb_nrg_mem_fx, sub( MAX_16, STEREO_DFT_BPF_ADAPT_ALPHA_FX ) ) ); hStereoDft->res_hb_nrg_mem_fx = res_hb_nrg; -- GitLab From a1dfd5953000e7d353a09c4095dc81b630dff691 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 10 Jan 2024 12:12:58 +0530 Subject: [PATCH 2/4] GITLAB CI updates from MLD jobs branch --- .gitlab-ci.yml | 294 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 242 insertions(+), 52 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 632760c1c..7d7a0b726 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,16 @@ variables: + LTV_DIR: "/usr/local/ltv" + EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop" REFERENCE_TAG: "20231128_Update_Ittiam" BUILD_OUTPUT: "build_output.txt" SCRIPTS_DIR: "/usr/local/scripts" EXIT_CODE_NON_BE: 123 EXIT_CODE_FAIL: 1 - TESTS_DIR_CODEC_BE_ON_MR: "tests/codec_be_on_mr_nonselection" + LONG_TEST_SUITE: "tests/codec_be_on_mr_nonselection tests/test_param_file_ltv.py tests/renderer" + SHORT_TEST_SUITE: "tests/codec_be_on_mr_nonselection" + USE_REF_ENC: "1" + TEST_SUITE: "" + LEVEL_SCALING: "1.0" IVAS_PIPELINE_NAME: '' 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 @@ -12,6 +18,8 @@ variables: options: - 'default' - 'pytest-mld' + - 'pytest-mld-long' + - 'evs-26444' default: @@ -35,6 +43,16 @@ workflow: - 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-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 == 'evs-26444' + variables: + IVAS_PIPELINE_NAME: 'EVS 26.444 test: $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch + variables: + IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH' + stages: - build @@ -73,8 +91,9 @@ stages: # create short test vectors - python3 tests/create_short_testvectors.py # create references - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref -n auto - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 -n auto + - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref -n auto + - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto + .update-scripts-repo: &update-scripts-repo - cd $SCRIPTS_DIR @@ -89,6 +108,21 @@ stages: .remove-unsupported-testcases: &remove-unsupported-testcases - sed -i '1649,1655d' scripts/config/self_test.prm + +.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" @@ -96,6 +130,17 @@ stages: - 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 # --------------------------------------------------------------- # Job templates @@ -120,47 +165,34 @@ stages: - if [ ! -d "$TESTV_DIR" ]; then mkdir -p $TESTV_DIR; fi - cp -r scripts/testv/* $TESTV_DIR/ -# --------------------------------------------------------------- -# 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 == 'push' - when: never - extends: - - .build-job-linux - script: - - *print-common-info - - make -j - -# --------------------------------------------------------------- -# Test jobs -# --------------------------------------------------------------- -ivas-pytest-mld-enc-dec: - extends: - - .test-job-linux - - .rules-pytest-mld +.ivas-pytest-mld-anchor: &ivas-pytest-mld-anchor stage: test needs: ["build-codec-linux-make"] timeout: "30 minutes" script: - *print-common-info - *update-scripts-repo + - if [ $USE_LTV -eq 1 ]; then + - *update-ltv-repo + - *copy-ltv-files-to-testv-dir + - fi - *remove-unsupported-testcases + - if [ $LEVEL_SCALING != "1.0" ];then + - *apply-testv-scaling + - fi - *mld-test-setup-codec ### run pytest - exit_code=0 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld -n auto || exit_code=$? + - if [ $USE_REF_ENC -eq 1 ]; then + - python3 -m pytest $TEST_SUITE -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path ./IVAS_cod_ref -n auto || exit_code=$? + - else + - python3 -m pytest $TEST_SUITE -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld -n auto || exit_code=$? + - fi - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - python3 scripts/parse_mld.py report.html mld.csv + - 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 @@ -182,43 +214,201 @@ ivas-pytest-mld-enc-dec: junit: - report-junit.xml +# --------------------------------------------------------------- +# Build jobs +# --------------------------------------------------------------- -ivas-pytest-mld-dec: +# 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 + +# --------------------------------------------------------------- +# Short test jobs +# --------------------------------------------------------------- + +ivas-pytest-mld-enc-dec: extends: + - .rules-pytest-mld - .test-job-linux + before_script: + - USE_LTV=0 + - USE_REF_ENC=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 + - USE_REF_ENC=1 + - 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 + - USE_REF_ENC=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 + - USE_REF_ENC=1 + - 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 + - USE_REF_ENC=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 + - USE_REF_ENC=1 + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-mld-anchor + +# --------------------------------------------------------------- +# Long test jobs +# --------------------------------------------------------------- + +ivas-pytest-mld-long-enc-dec: + extends: + - .rules-pytest-mld-long + - .test-job-linux + before_script: + - USE_LTV=1 + - USE_REF_ENC=0 + - 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 + - USE_REF_ENC=1 + - 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 + - USE_REF_ENC=0 + - 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 + - USE_REF_ENC=1 + - 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 + - USE_REF_ENC=0 + - 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 + - USE_REF_ENC=1 + - TEST_SUITE="$LONG_TEST_SUITE" + - LEVEL_SCALING=3.162 + <<: *ivas-pytest-mld-anchor + +# --------------------------------------------------------------- +# 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" + tags: + - be-2-evs-basop stage: test - needs: ["build-codec-linux-make"] - timeout: "30 minutes" + timeout: "120 minutes" # To be revisited script: - *print-common-info - - *update-scripts-repo - - *remove-unsupported-testcases - - *mld-test-setup-codec - - ### run pytest - - exit_code=0 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path ./IVAS_cod_ref -n auto || exit_code=$? - - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + - *update-scripts-repo + - sed -i".bak" "s/\(#define EVS_FLOAT\)/\/\/\1/" lib_com/options.h + - make -j - - python3 scripts/parse_mld.py report.html mld.csv + # 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 - - 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 + - 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 - - allow_failure: - exit_codes: - - 123 + artifacts: - name: "mld--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + name: "evs-26444--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" expire_in: 1 week when: always paths: - report-junit.xml - report.html - - mld.csv - expose_as: "pytest mld results" + expose_as: "EVS 26444 result" reports: junit: - - report-junit.xml + - report-junit.xml -- GitLab From 18c1e92417a9c6faf2f44a6cb11f99e3db173350 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 12 Jan 2024 14:07:24 +0530 Subject: [PATCH 3/4] crash fix updates --- lib_com/ivas_sns_com_fx.c | 17 ++++++++++++----- lib_dec/tonalMDCTconcealment.c | 12 +++++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index 1440cc4ea..a059cc6f7 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -57,7 +57,8 @@ void sns_compute_scf_fx( Word32 *scf ) { Word16 i, n, k; - Word32 x[FDNS_NPTS], xs[FDNS_NPTS], sum, mean, xl4[SNS_NPTS], nf, xl[FDNS_NPTS]; + Word32 x[FDNS_NPTS], xs[FDNS_NPTS], mean, xl4[SNS_NPTS], nf, xl[FDNS_NPTS]; + Word64 sum; Word32 L_tmp; const Word16 *pow_tilt; const UWord8 nBands = pPsychParams->nBands; @@ -139,8 +140,11 @@ void sns_compute_scf_fx( } /* Noise floor at -40dB */ - sum = sum32_fx( xs, FDNS_NPTS ); - mean = L_shr( sum, 6 ); + sum = 0; + for (Word16 ind = 0; ind < FDNS_NPTS; ind++) { + sum += (Word64)xs[i]; + } + mean = (Word32)(sum >> 6); nf = Mpy_32_16_1( mean, 3 ); // 3 => powf( 10.0f, -4.0f ) in Q15 nf = L_max( nf, 0 ); // 0 => powf( 2.0f, -32.0f ) in Q15 @@ -198,8 +202,11 @@ void sns_compute_scf_fx( xl4[SNS_NPTS - 1] = L_tmp; /* Remove mean and scaling */ - sum = sum32_fx( xl4, SNS_NPTS ); - mean = L_shr( sum, 4 ); + sum = 0; + for (Word16 ind = 0; ind < SNS_NPTS; ind++) { + sum += (Word64)xl4[i]; + } + mean = (Word32)(sum >> 4); FOR( i = 0; i < SNS_NPTS; i++ ) { diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index 1862d5036..51c1afd4e 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -45,6 +45,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" +#include "prot_fx2.h" #endif // IVAS_FLOAT_FIXED @@ -1214,9 +1215,18 @@ void TonalMdctConceal_whiten_noise_shape_ivas( Word32 whitenend_noise_shape_fx[L_FRAME16k]; Word32 scfs_int_fx[FDNS_NPTS], scfs_bg_fx[FDNS_NPTS]; + Word16 q = 31; FOR( Word16 k = 0; k < L_FRAME16k; k++ ) { - whitenend_noise_shape_fx[k] = (Word32) ( whitenend_noise_shape[k] * ONE_IN_Q7 ); + if(abs((Word32)whitenend_noise_shape[k])!=0) q = s_min(q, norm_l( whitenend_noise_shape[k] )); + } + + q -= find_guarded_bits_fx(L_frame) + 2; + //q -= 1; + + FOR( Word16 k = 0; k < L_FRAME16k; k++ ) + { + whitenend_noise_shape_fx[k] = q>=0 ? ((Word32) ( whitenend_noise_shape[k] *(1<< q) )):((Word32) ( whitenend_noise_shape[k] / (1<< q) )); } sns_compute_scf_fx( whitenend_noise_shape_fx, psychParams, L_frame, scf_fx ); -- GitLab From 97479730c6974e286455f749f2f09efbfce27d23 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 12 Jan 2024 14:27:00 +0530 Subject: [PATCH 4/4] reverting ci changes --- .gitlab-ci.yml | 294 +++++++++---------------------------------------- 1 file changed, 52 insertions(+), 242 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7d7a0b726..632760c1c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,16 +1,10 @@ variables: - LTV_DIR: "/usr/local/ltv" - EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop" REFERENCE_TAG: "20231128_Update_Ittiam" BUILD_OUTPUT: "build_output.txt" SCRIPTS_DIR: "/usr/local/scripts" EXIT_CODE_NON_BE: 123 EXIT_CODE_FAIL: 1 - LONG_TEST_SUITE: "tests/codec_be_on_mr_nonselection tests/test_param_file_ltv.py tests/renderer" - SHORT_TEST_SUITE: "tests/codec_be_on_mr_nonselection" - USE_REF_ENC: "1" - TEST_SUITE: "" - LEVEL_SCALING: "1.0" + 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 'pytest-mld' to run MLD test against reference float codec." # Not implemented yet, but may be good to have a manual pipeline trigger @@ -18,8 +12,6 @@ variables: options: - 'default' - 'pytest-mld' - - 'pytest-mld-long' - - 'evs-26444' default: @@ -43,16 +35,6 @@ workflow: - 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-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 == 'evs-26444' - variables: - IVAS_PIPELINE_NAME: 'EVS 26.444 test: $CI_COMMIT_BRANCH' - - if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch - variables: - IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH' - stages: - build @@ -91,9 +73,8 @@ stages: # create short test vectors - python3 tests/create_short_testvectors.py # create references - - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref -n auto - - python3 -m pytest $TEST_SUITE -v --update_ref 1 -m create_ref_part2 -n auto - + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref -n auto + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -m create_ref_part2 -n auto .update-scripts-repo: &update-scripts-repo - cd $SCRIPTS_DIR @@ -108,21 +89,6 @@ stages: .remove-unsupported-testcases: &remove-unsupported-testcases - sed -i '1649,1655d' scripts/config/self_test.prm - -.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" @@ -130,17 +96,6 @@ stages: - 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 # --------------------------------------------------------------- # Job templates @@ -165,34 +120,47 @@ stages: - if [ ! -d "$TESTV_DIR" ]; then mkdir -p $TESTV_DIR; fi - cp -r scripts/testv/* $TESTV_DIR/ +# --------------------------------------------------------------- +# 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 == 'push' + when: never + extends: + - .build-job-linux + script: + - *print-common-info + - make -j + +# --------------------------------------------------------------- +# Test jobs +# --------------------------------------------------------------- -.ivas-pytest-mld-anchor: &ivas-pytest-mld-anchor +ivas-pytest-mld-enc-dec: + extends: + - .test-job-linux + - .rules-pytest-mld stage: test needs: ["build-codec-linux-make"] timeout: "30 minutes" script: - *print-common-info - *update-scripts-repo - - if [ $USE_LTV -eq 1 ]; then - - *update-ltv-repo - - *copy-ltv-files-to-testv-dir - - fi - *remove-unsupported-testcases - - if [ $LEVEL_SCALING != "1.0" ];then - - *apply-testv-scaling - - fi - *mld-test-setup-codec ### run pytest - exit_code=0 - - if [ $USE_REF_ENC -eq 1 ]; then - - python3 -m pytest $TEST_SUITE -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path ./IVAS_cod_ref -n auto || exit_code=$? - - else - - python3 -m pytest $TEST_SUITE -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld -n auto || exit_code=$? - - fi + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld -n auto || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - python3 scripts/parse_mld_xml.py report-junit.xml mld.csv + - python3 scripts/parse_mld.py report.html 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 @@ -214,201 +182,43 @@ stages: 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 - -# --------------------------------------------------------------- -# Short test jobs -# --------------------------------------------------------------- -ivas-pytest-mld-enc-dec: - extends: - - .rules-pytest-mld - - .test-job-linux - before_script: - - USE_LTV=0 - - USE_REF_ENC=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 - - USE_REF_ENC=1 - - 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 - - USE_REF_ENC=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 - - USE_REF_ENC=1 - - 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 - - USE_REF_ENC=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 - - USE_REF_ENC=1 - - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=3.162 - <<: *ivas-pytest-mld-anchor - -# --------------------------------------------------------------- -# Long test jobs -# --------------------------------------------------------------- - -ivas-pytest-mld-long-enc-dec: - extends: - - .rules-pytest-mld-long - - .test-job-linux - before_script: - - USE_LTV=1 - - USE_REF_ENC=0 - - 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 - - USE_REF_ENC=1 - - 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 - - USE_REF_ENC=0 - - 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 - - USE_REF_ENC=1 - - 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 - - USE_REF_ENC=0 - - 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 - - USE_REF_ENC=1 - - TEST_SUITE="$LONG_TEST_SUITE" - - LEVEL_SCALING=3.162 - <<: *ivas-pytest-mld-anchor - -# --------------------------------------------------------------- -# 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" - tags: - - be-2-evs-basop + - .rules-pytest-mld stage: test - timeout: "120 minutes" # To be revisited + needs: ["build-codec-linux-make"] + timeout: "30 minutes" script: - *print-common-info - - *update-scripts-repo - - sed -i".bak" "s/\(#define EVS_FLOAT\)/\/\/\1/" lib_com/options.h - - make -j + - *update-scripts-repo + - *remove-unsupported-testcases + - *mld-test-setup-codec - # 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 + ### run pytest + - exit_code=0 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --mld --dut_encoder_path ./IVAS_cod_ref -n auto || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + + - python3 scripts/parse_mld.py report.html mld.csv - - 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 + - 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: "evs-26444--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + name: "mld--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" expire_in: 1 week when: always paths: - report-junit.xml - report.html - expose_as: "EVS 26444 result" + - mld.csv + expose_as: "pytest mld results" reports: junit: - - report-junit.xml + - report-junit.xml -- GitLab