Commit 652586ce authored by norvell's avatar norvell
Browse files

Merge with main

parents 96598c47 7416232d
Loading
Loading
Loading
Loading
Loading
+200 −32
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@ variables:
  TESTV_DIR: "/usr/local/testv"
  BUILD_OUTPUT: "build_output.txt"
  EVS_BE_TEST_DIR: "/usr/local/be_2_evs_test"
  SANITIZER_TESTS: "CLANG1 CLANG2"
  OUT_FORMATS_CHANNEL_BASED: "stereo mono 5_1 5_1_2 5_1_4 7_1 7_1_4"
  OUT_FORMATS_SCENE_BASED: "FOA HOA2 HOA3"
  OUT_FORMATS_BINAURAL: "BINAURAL BINAURAL_ROOM"


# This sets when pipelines are created. Jobs have more specific rules to restrict them.
@@ -297,34 +301,50 @@ self-test-on-merge-request:
    ### run selftest
    - ls -altr scripts/testv
    - python3 ./scripts/self_test.py --encref IVAS_cod_ref --decref IVAS_dec_ref --enctest IVAS_cod_test --dectest IVAS_dec_test | tee test_output.txt

    - python3 ./scripts/self_test.py --encref IVAS_cod_ref --decref IVAS_dec_ref --enctest IVAS_cod_test --dectest IVAS_dec_test scripts/config/self_test_evs.prm | tee test_output_evs.txt
    ### analyse test output

    # some helper variables - "|| true" to prevent failures from grep not finding anything
    - evs_non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[evs[ -]non[ -]*be\]") || true
    - non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[non[ -]*be\]") || true
    - run_errors=$(cat test_output.txt | grep -c "test conditions had run errors") || true
    - run_errors=$(cat test_output.txt test_output_evs.txt | grep -c "test conditions had run errors") || true
    - bitexact=$(cat test_output.txt | grep -c "All [0-9]* tests are bitexact") || true
    - bitexact_evs=$(cat test_output_evs.txt | grep -c "All [0-9]* tests are bitexact") || true
    - EXIT_CODE_NON_BE=123
    - EXIT_CODE_FAIL=1

    - selftest_exit_code=0
    - expected_nonbe_1=0
    - expected_nonbe_2=0
    - expected_nonbe_3=0
    - fail_1=0
    - fail_2=0
    - fail_3=0

    # check for crashes during the test, if any happened, fail the test
    - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py"; exit $EXIT_CODE_FAIL; fi
    - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py"; fail_1=1; fi

    # check for non bitexact output and store exit code to also always run the SBA pytest
    - if [ $bitexact == 0 ] && [ $non_be_flag == 0 ] ; then echo "Non-bitexact cases without non-BE tag encountered"; selftest_exit_code=$EXIT_CODE_FAIL; fi
    - if [ $bitexact == 0 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact cases with non-BE tag encountered"; selftest_exit_code=$EXIT_CODE_NON_BE; fi
    - if [ $bitexact == 0 ] && [ $non_be_flag == 0 ] ; then echo "Non-bitexact cases without non-BE tag encountered"; fail_1=1; fi
    - if [ $bitexact == 0 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact cases with non-BE tag encountered"; expected_nonbe_1=1; fi

    # check for non bitexact EVS output
    - if [ $bitexact_evs == 0 ] && [ $evs_non_be_flag == 0 ] ; then echo "Non-bitexact EVS cases without EVS-non-BE tag encountered"; fail_2=1; fi
    - if [ $bitexact_evs == 0 ] && [ $evs_non_be_flag != 0 ] ; then echo "Non-bitexact EVS cases with EVS-non-BE tag encountered"; expected_nonbe_2=1; fi

    ### run SBA pytest
    - exit_code=0
    - python3 ./scripts/ivas_pytests/self_test_b.py --encref IVAS_cod_ref --decref IVAS_dec_ref --encdut IVAS_cod_test --decdut IVAS_dec_test || exit_code=$?
    - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true
    - if [ $exit_code -eq 1 ] && [ $zero_errors == 1 ]; then echo "pytest run had failures, but no errors and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi
    - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $EXIT_CODE_FAIL; fi;
    # return exit code from selftest if everything went well with the pytest run
    - exit $selftest_exit_code
    
    - if [ $zero_errors != 1 ]; then echo "Run errors in SBA pytest"; fail_3=1; fi
    
    - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures without non-BE tag encountered"; fail_3=1; fi
    - if [ $exit_code -eq 1 ] && [ $non_be_flag == 1 ]; then echo "pytest run had failures with non-BE tag encountered"; expected_nonbe_3=1; fi
    
    # Check results from all three tests
    - if [ $fail_1 -eq 1 ] || [ $fail_2 -eq 1 ] || [ $fail_3 -eq 1 ]; then exit $EXIT_CODE_FAIL; fi
    - if [ $expected_nonbe_1 -eq 1 ] || [ $expected_nonbe_2 -eq 1 ] || [ $expected_nonbe_3 -eq 1 ]; then exit $EXIT_CODE_NON_BE; fi
    - exit 0
    
  allow_failure:
    exit_codes:
      - 123
@@ -333,6 +353,7 @@ self-test-on-merge-request:
    when: always
    paths:
      - test_output.txt
      - test_output_evs.txt
      - scripts/test/logs/
      - scripts/ref/logs/
      - report-junit.xml
@@ -462,33 +483,180 @@ codec-comparison-on-main-push:
      junit: report-junit.xml


# parameterizable job for sanitizer tests per format
# how to set up: create a schedule (CI/CD -> schedules) and enter the respective values for the environment variables:
#   - SANITIZER_TEST_IN_FMT: input format
#   - SANITIZER_TEST_OUT_FMTS: list of output formats, blank-separated, e.g.: stereo mono 5_1
#   - SANITIZER_TEST_TESTS: list of checks to do, can be one of CLANG1, CLANG2, CLANG3, VALGRIND
sanitizer-test-on-main-scheduled:
# ---------------------------------------------------------------
# Scheduled jobs on main
# ---------------------------------------------------------------
.sanitizer-test-template:
  extends:
    - .test-job-linux-needs-testv-dir
    # this next one is maybe not really needed, since there is the rule checking for the existence of the env vars below, but use for clarity
    - .rules-main-scheduled
  stage: test
  tags:
    - sanitizer_test_main

sanitizer-test-mono:
  extends: .sanitizer-test-template
  rules:
    - if: $IS_SANITIZER_TEST_RUN
  script:
    - python3 ci/run_scheduled_sanitizer_test.py mono mono --tests $SANITIZER_TESTS

sanitizer-test-stereo:
  extends: .sanitizer-test-template
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 20 minutes
  script:
    - python3 ci/run_scheduled_sanitizer_test.py stereo $OUT_FORMATS_CHANNEL_BASED --tests $SANITIZER_TESTS

sanitizer-test-stereodmxevs:
  extends: .sanitizer-test-template
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 40 minutes
  script:
    - python3 ci/run_scheduled_sanitizer_test.py StereoDmxEvs mono --tests $SANITIZER_TESTS

sanitizer-test-ism1:
  extends: .sanitizer-test-template
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 1 hour
  script:
    - python3 ci/run_scheduled_sanitizer_test.py ISM1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS

sanitizer-test-ism2:
  extends: .sanitizer-test-template
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 1 hour 30 minutes
  script:
    - python3 ci/run_scheduled_sanitizer_test.py ISM2 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS

sanitizer-test-ism3:
  extends: .sanitizer-test-template
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 2 hours
  script:
    - python3 ci/run_scheduled_sanitizer_test.py ISM3 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS

sanitizer-test-ism4:
  extends: .sanitizer-test-template
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 2 hours 30 minutes
  script:
    - python3 ci/run_scheduled_sanitizer_test.py ISM4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS

sanitizer-test-mc-5_1:
  extends:
    - .test-job-linux-needs-testv-dir
  stage: test
  tags:
    - sanitizer_test_main
  rules:
    # only run in scheduled pipeline that passes this env vars
    - if: $SANITIZER_TEST_IN_FMT && $SANITIZER_TEST_OUT_FMTS && $SANITIZER_TEST_TESTS
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 3 hours
  script:
    - *print-common-info
    - echo "Running scheduled sanitizer tests $SANITIZER_TEST_TESTS for input format $SANITIZER_TEST_IN_FMT and output format(s) $SANITIZER_TEST_OUT_FMTS"
    - python3 ci/run_scheduled_sanitizer_test.py 5_1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS

    - python3 ci/run_scheduled_sanitizer_test.py $SANITIZER_TEST_IN_FMT $SANITIZER_TEST_OUT_FMTS --tests $SANITIZER_TEST_TESTS
  artifacts:
    name: "sanitizer-test-results-and-error_pattern-$SANITIZER_TEST_IN_FMT-in-$SANITIZER_TEST_OUT_FMTS-out"
    when: always
    paths:
      - ep_015.g192
      - "./*/logs"
sanitizer-test-mc-5_1_2:
  extends:
    - .test-job-linux-needs-testv-dir
  stage: test
  tags:
    - sanitizer_test_main
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 4 hours
  script:
    - python3 ci/run_scheduled_sanitizer_test.py 5_1_2 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS

sanitizer-test-mc-5_1_4:
  extends:
    - .test-job-linux-needs-testv-dir
  stage: test
  tags:
    - sanitizer_test_main
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 5 hours
  script:
    - python3 ci/run_scheduled_sanitizer_test.py 5_1_4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS

sanitizer-test-mc-7_1:
  extends:
    - .test-job-linux-needs-testv-dir
  stage: test
  tags:
    - sanitizer_test_main
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 6 hours
  script:
    - python3 ci/run_scheduled_sanitizer_test.py 7_1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS

sanitizer-test-mc-7_1_4:
  extends:
    - .test-job-linux-needs-testv-dir
  stage: test
  tags:
    - sanitizer_test_main
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 7 hours
  script:
    - python3 ci/run_scheduled_sanitizer_test.py 7_1_4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS

sanitizer-test-masa:
  extends:
    - .test-job-linux-needs-testv-dir
  stage: test
  tags:
    - sanitizer_test_main
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 8 hours
  script:
    - python3 ci/run_scheduled_sanitizer_test.py MASA $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS

sanitizer-test-sba:
  extends:
    - .test-job-linux-needs-testv-dir
  stage: test
  tags:
    - sanitizer_test_main
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 9 hours
  script:
    - python3 ci/run_scheduled_sanitizer_test.py SBA $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS

sanitizer-test-planarsba:
  extends:
    - .test-job-linux-needs-testv-dir
  stage: test
  tags:
    - sanitizer_test_main
  rules:
    - if: $IS_SANITIZER_TEST_RUN
      when: delayed
      start_in: 10 hours
  script:
    - python3 ci/run_scheduled_sanitizer_test.py PlanarSBA $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL --tests $SANITIZER_TESTS

# GCOV/LCOV coverage analysis of self_test suite
coverage-test-on-main-scheduled:
+14 −3
Original line number Diff line number Diff line
@@ -32,16 +32,27 @@ def main(args):


def get_modes(in_format: str) -> list:
    cmd = [SCRIPT_DIR.joinpath("runIvasCodec.py"), "-l"]

    cmd = [
            SCRIPT_DIR.joinpath("runIvasCodec.py"),
            "-C",
            "MC" if in_format in MC_MODES else in_format,
            "-l"
        ]
    list_process = subprocess.run(cmd, capture_output=True)

    output = list_process.stdout.decode("utf8")

    # correction for multichannel modes to avoid selecting some mono modes...
    if in_format in MC_MODES:
        in_format = "MC_" + in_format
        in_format = "MC_" + in_format + "_b"

    mode_list = [m for m in output.splitlines() if in_format in m]
    if "SBA" in in_format:
        # rate switching not implemented yet
        mode_list = [m for m in mode_list if not "_rs" in m]

    return [m for m in output.splitlines() if in_format in m]
    return mode_list


def run_check(modes: list, out_formats: list, tests: list, run_fec: bool = True):
+23 −9
Original line number Diff line number Diff line
@@ -4243,16 +4243,30 @@ int16_t ivas_map_num_decd_r_to_idx( const int16_t num_quant_points_decd_r );

/* Quantization utilities */
void ivas_quantise_real_values(
#ifdef QUANTISE_REAL_FCN_CLEAN_UP
        const float *values,
#else
        float **values,
#endif
        const int16_t q_levels,
        const float min_value,
        const float max_value,
#ifdef QUANTISE_REAL_FCN_CLEAN_UP
        int16_t *index,
        float *quant,
#else
        int16_t **index,
        float **quant,
#endif
#ifdef QUANTISE_REAL_FCN_CLEAN_UP
    const int16_t dim
#else
    const int16_t dim1,
    const int16_t dim2
#endif
);


void ivas_spar_get_uniform_quant_strat(
    ivas_spar_md_com_cfg *pSpar_md_com_cfg,
    const int16_t table_idx
+49 −10
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@
#include "ivas_rom_com.h"
#include <assert.h>
#include "wmops.h"

#ifndef QUANTISE_REAL_FCN_CLEAN_UP
/*-----------------------------------------------------------------------------------------*
 * Function ivas_limit_values()
 *
@@ -56,7 +56,6 @@ static void ivas_limit_values(
    const int16_t dim2 )
{
    int16_t i, j;

    for ( i = 0; i < dim1; i++ )
    {
        for ( j = 0; j < dim2; j++ )
@@ -64,48 +63,73 @@ static void ivas_limit_values(
            ppValues[i][j] = max( min_value, min( ppValues[i][j], max_value ) );
        }
    }

    return;
}

#endif

/*-----------------------------------------------------------------------------------------*
 * Function ivas_quantise_real_values()
 *
 * Quantize real values
 *-----------------------------------------------------------------------------------------*/

void ivas_quantise_real_values(
#ifdef QUANTISE_REAL_FCN_CLEAN_UP
    const float *values,
#else
    float **values,
#endif
    const int16_t q_levels,
    const float min_value,
    const float max_value,
#ifdef QUANTISE_REAL_FCN_CLEAN_UP
    int16_t *index,
    float *quant,
#else
    int16_t **index,
    float **quant,
#endif
#ifdef QUANTISE_REAL_FCN_CLEAN_UP
    const int16_t dim
#else
    const int16_t dim1,
    const int16_t dim2 )
    const int16_t dim2
#endif
)
{
#ifndef QUANTISE_REAL_FCN_CLEAN_UP
    int16_t i, j;
#else
    int16_t i;
#endif
    float q_step, one_by_q_step;

    if ( q_levels == 1 )
    {
#ifndef QUANTISE_REAL_FCN_CLEAN_UP
        for ( i = 0; i < dim1; i++ )
        {
            for ( j = 0; j < dim2; j++ )
            {

                quant[i][j] = 0;
                index[i][j] = 0;
            }
        }
#else
        for ( i = 0; i < dim; i++ )
        {
            quant[i] = 0;
            index[i] = 0;
        }
#endif
    }
    else if ( q_levels && max_value != min_value )
    {
#ifndef QUANTISE_REAL_FCN_CLEAN_UP
        ivas_limit_values( values, min_value, max_value, dim1, dim2 );

#endif
        q_step = ( max_value - min_value ) / ( q_levels - 1 );
        one_by_q_step = ( q_levels - 1 ) / ( max_value - min_value );

#ifndef QUANTISE_REAL_FCN_CLEAN_UP
        for ( i = 0; i < dim1; i++ )
        {
            for ( j = 0; j < dim2; j++ )
@@ -114,9 +138,19 @@ void ivas_quantise_real_values(
                quant[i][j] = index[i][j] * q_step;
            }
        }
#else
        float val;
        for ( i = 0; i < dim; i++ )
        {
            val = max( min_value, min( values[i], max_value ) );
            index[i] = (int16_t) round( one_by_q_step * val );
            quant[i] = index[i] * q_step;
        }
#endif
    }
    else
    {
#ifndef QUANTISE_REAL_FCN_CLEAN_UP
        for ( i = 0; i < dim1; i++ )
        {
            for ( j = 0; j < dim2; j++ )
@@ -124,8 +158,13 @@ void ivas_quantise_real_values(
                quant[i][j] = values[i][j];
            }
        }
#else
        for ( i = 0; i < dim; i++ )
        {
            quant[i] = values[i];
        }
#endif
    }

    return;
}

+2 −0
Original line number Diff line number Diff line
@@ -150,6 +150,8 @@
#define SBA_INTERN_CONFIG_FIX_HOA2                      /* Issue 99 : Fix for incorrect internal_config when output format is HOA2 or FOA*/
#define FIX_I98_HANDLES_TO_NULL                         /* Issue 98: do the setting of all handles to NULL in one place */
#define FIX_I106_TDREND_5MS                             /* Issue 106: 5 ms update rate in TD object renderer */
#define QUANTISE_REAL_FCN_CLEAN_UP                      /*Clean up the ivas_quantise_real_values() function*/


/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
Loading