Commit e5ea86ed authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch 'FhG/external-renderer' into shared/external-renderer-masa

parents 85b78c9b 9ebeea99
Loading
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -4,18 +4,20 @@
IVAS_cod
IVAS_dec
IVAS_rend
IVAS_crend_unit_test
obj/
*.a
*.o
*.P

# default CMake
build/**/*
build*/**/*

# Compiler output VS2017
IVAS_cod.exe
IVAS_dec.exe
IVAS_rend.exe
IVAS_crend_unit_test.exe
*.user
.vs/
Debug_*/
@@ -45,8 +47,8 @@ scripts/ref/
scripts/test/
scripts/out/
scripts/self_test_summary.txt
scripts/tests/cut/
scripts/tests/ref/
tests/renderer/cut
tests/renderer/ref
tests/dut
tests/ref

@@ -54,3 +56,6 @@ tests/ref
__pycache__/
*.py[cod]
*$py.class

#history
.history/
+110 −65
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ stages:
  - build
  - test
  - compare
  - validate

# ---------------------------------------------------------------
# Generic script anchors
@@ -43,6 +44,52 @@ stages:
.get-previous-merge-commit-sha: &get-previous-merge-commit-sha
  - previous_merge_commit=$(git --no-pager log --merges HEAD~1 -n 1 --pretty=format:%H)

.merge_request_comparison_setup: &merge_request_comparison_setup
  ### build test binaries, initial clean for paranoia reasons
  - make clean
  - mkdir build
  - cd build
  - cmake ..
  - make -j
  - mv IVAS_cod ../IVAS_cod_test
  - mv IVAS_dec ../IVAS_dec_test
  - cd ..
  - rm -rf build/*

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

  ### checkout version to compare against
  # first delete local target branch to avoid conflicts when branch is cached and there are merge conflicts during fetching
  # depending on chaching, the branch may not be there, so prevent failure of this command -> should maybe be done smarter later
  - git branch -D $CI_MERGE_REQUEST_TARGET_BRANCH_NAME || true
  # needed when depth is lower than the number of commits in the branch
  - git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:$CI_MERGE_REQUEST_TARGET_BRANCH_NAME

  ### compare to last target branch commit before pipeline was created
  - target_commit=$(git log $CI_MERGE_REQUEST_TARGET_BRANCH_NAME -1 --oneline --before=${CI_PIPELINE_CREATED_AT} --format=%H)
  - git checkout $target_commit

  ### build reference binaries
  - cd build
  - cmake ..
  - make -j
  - mv IVAS_cod ../IVAS_cod_ref
  - mv IVAS_dec ../IVAS_dec_ref
  - cd ..

  # rename test binaries back
  - mv IVAS_cod_test IVAS_cod
  - mv IVAS_dec_test IVAS_dec

  ### re-checkout the commit from the source branch to have up-to-date self_test.py and scripts/testv (and actually everything)
  - git checkout $source_branch_commit_sha

.merge-request-comparison-check: &merge-request-comparison-check
    - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "Non-bitexact cases without non-BE tag encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact  cases with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi
    - exit 0

# ---------------------------------------------------------------
# Job templates
@@ -107,6 +154,25 @@ stages:
      - 123


# ---------------------------------------------------------------
# Validation jobs
# ---------------------------------------------------------------

check-if-branch-is-up-to-date-with-main:
  extends:
    - .rules-merge-request
  stage: validate
  needs: []
  tags:
    - ivas-linux
  script:
    - echo $CI_COMMIT_SHA
    - echo $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
    - commits_behind_count=$(git rev-list --count $CI_COMMIT_SHA..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME)
    - echo $commits_behind_count
    - if [ $commits_behind_count -eq 0 ]; then exit 0; else exit 1; fi;


# ---------------------------------------------------------------
# Build jobs
# ---------------------------------------------------------------
@@ -252,7 +318,9 @@ external-renderer-make-pytest:
  stage: test
  script:
    - make -j IVAS_rend
    - python3 -m pytest scripts/tests/test_renderer.py -q --log-level ERROR -n auto
    - make -j unittests
    - make -j --directory scripts/td_object_renderer/object_renderer_standalone
    - python3 -m pytest tests/renderer/test_renderer.py -q --log-level ERROR -n auto -rA

# test external renderer executable with cmake + asan
external-renderer-cmake-asan-pytest:
@@ -263,9 +331,9 @@ external-renderer-cmake-asan-pytest:
  stage: test
  script:
    - python3 ci/disable_ram_counting.py
    - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_TO_ROOT=true
    - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true
    - cmake --build cmake-build -- -j
    - python3 -m pytest scripts/tests/test_renderer.py -q --log-level ERROR -n auto
    - python3 -m pytest tests/renderer/test_renderer.py -q --log-level ERROR -n auto -rA

# test external renderer executable with cmake + msan
external-renderer-cmake-msan-pytest:
@@ -276,12 +344,12 @@ external-renderer-cmake-msan-pytest:
  stage: test
  script:
    - python3 ci/disable_ram_counting.py
    - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan  -DCOPY_EXECUTABLES_TO_ROOT=true
    - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan  -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true
    - cmake --build cmake-build -- -j
    - python3 -m pytest scripts/tests/test_renderer.py -q --log-level ERROR -n auto
    - python3 -m pytest tests/renderer/test_renderer.py -q --log-level ERROR -n auto -rA

# compare bit exactness between target and source branch
pytest-on-merge-request:
ivas-pytest-on-merge-request:
  extends: 
    - .test-job-linux
    - .rules-merge-request
@@ -290,85 +358,62 @@ pytest-on-merge-request:
  timeout: "10 minutes"
  script:
    - *print-common-info
    ### build test binaries, initial clean for paranoia reasons
    - make clean
    - mkdir build
    - cd build
    - cmake ..
    - make -j
    - mv IVAS_cod ../IVAS_cod_test
    - mv IVAS_dec ../IVAS_dec_test
    - cd ..
    - rm -rf build/*

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

    ### checkout version to compare against
    # first delete local target branch to avoid conflicts when branch is cached and there are merge conflicts during fetching
    # depending on chaching, the branch may not be there, so prevent failure of this command -> should maybe be done smarter later
    - git branch -D $CI_MERGE_REQUEST_TARGET_BRANCH_NAME || true
    # needed when depth is lower than the number of commits in the branch
    - git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:$CI_MERGE_REQUEST_TARGET_BRANCH_NAME

    ### compare to last target branch commit before pipeline was created
    - target_commit=$(git log $CI_MERGE_REQUEST_TARGET_BRANCH_NAME -1 --oneline --before=${CI_PIPELINE_CREATED_AT} --format=%H)
    - git checkout $target_commit

    ### build reference binaries
    - cd build
    - cmake ..
    - make -j
    - mv IVAS_cod ../IVAS_cod_ref
    - mv IVAS_dec ../IVAS_dec_ref
    - cd ..

    ### re-checkout the commit from the source branch to have up-to-date test scripts and test vectors (and actually everything)
    - git checkout $source_branch_commit_sha
    - *merge_request_comparison_setup

    # 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
    - expected_nonbe_1=0
    - expected_nonbe_2=0
    - fail_1=0
    - fail_2=0

    ### prepare pytest
    # create short test vectors
    - python3 tests/create_short_testvectors.py
    # rename test binaries back
    - mv IVAS_cod_test IVAS_cod
    - mv IVAS_dec_test IVAS_dec
    # create references
    - python3 -m pytest tests -v --update_ref 1 -m create_ref
    - python3 -m pytest tests -v --update_ref 1 -m create_ref_part2
    - python3 -m pytest tests/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_evs.prm

    ### run pytest
    - exit_code=0
    - python3 -m pytest tests -v --junit-xml=report-junit.xml || exit_code=$?
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true

    - if [ $zero_errors != 1 ]; then echo "Run errors in pytest"; fail_1=1; fi
    - *merge-request-comparison-check

    - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures without non-BE tag encountered"; fail_1=1; fi
    - if [ $exit_code -eq 1 ] && [ $non_be_flag != 0 ]; then echo "pytest run had failures with non-BE tag encountered"; expected_nonbe_1=1; fi
  allow_failure:
    exit_codes:
      - 123
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    when: always
    paths:
      - report-junit.xml
    expose_as: 'pytest ivas results'
    reports:
      junit:
        - report-junit.xml

evs-pytest-on-merge-request:
  extends: 
    - .test-job-linux
    - .rules-merge-request
  stage: compare
  needs: [ "build-codec-linux-cmake", "codec-smoke-test" ]
  timeout: "10 minutes"
  script:
    - *print-common-info
    - *merge_request_comparison_setup

    # some helper variables - "|| true" to prevent failures from grep not finding anything
    - non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[evs[ -]*non[ -]*be\]") || true

    ### prepare pytest
    # create references
    - python3 -m pytest tests/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_evs.prm

    ### run pytest for EVS cases
    - exit_code=0
    - python3 -m pytest tests/test_param_file.py -v --param_file scripts/config/self_test_evs.prm --junit-xml=report-junit-evs.xml || exit_code=$?
    - zero_errors=$(cat report-junit-evs.xml | grep -c 'errors="0"') || true

    - if [ $zero_errors != 1 ]; then echo "Run errors in pytest for EVS"; fail_2=1; fi

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

    # Check results from both tests
    - if [ $fail_1 -eq 1 ] || [ $fail_2 -eq 1 ]; then exit $EXIT_CODE_FAIL; fi
    - if [ $expected_nonbe_1 -eq 1 ] || [ $expected_nonbe_2 -eq 1 ]; then exit $EXIT_CODE_NON_BE; fi
    - exit 0
    - *merge-request-comparison-check

  allow_failure:
    exit_codes:
@@ -377,12 +422,10 @@ pytest-on-merge-request:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    when: always
    paths:
      - report-junit.xml
      - report-junit-evs.xml
    expose_as: 'pytest results'
    expose_as: 'pytest evs results'
    reports:
      junit:
        - report-junit.xml
        - report-junit-evs.xml


@@ -507,6 +550,8 @@ codec-comparison-on-main-push:
    when: always
    paths:
      - ep_015.g192
      # second wildcard is necessary to get encoder and no-PLC run logs
      - "CLANG*/logs*"

sanitizer-test-mono:
  extends: .sanitizer-test-template
+16 −3
Original line number Diff line number Diff line
@@ -108,6 +108,9 @@ if(WMOPS)
  add_definitions("-DWMOPS=1")
endif()

if(DEC_TO_REND_FLOAT_DUMP)
  add_compile_definitions(DEC_TO_REND_FLOAT_DUMP)
endif()

project(stereo-evs)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # make Visual Studio projects look nicer
@@ -152,6 +155,14 @@ file(GLOB libUtilSrcs "lib_util/*.c")
file(GLOB libUtilHeaders "lib_util/*.h")
add_library(lib_util ${libUtilSrcs} ${libUtilHeaders})

file(GLOB unitTestCRendSrcs "scripts/ivas_pytests/tests/unit_tests/crend/*.c")
file(GLOB unitTestCRendHeaders "scripts/ivas_pytests/tests/unit_tests/crend/*.h")
add_executable(IVAS_crend_unit_test ${unitTestCRendSrcs} ${unitTestCRendHeaders})
target_link_libraries(IVAS_crend_unit_test lib_rend lib_dec lib_util lib_com lib_debug)

add_executable(renderer_standalone "scripts/td_object_renderer/object_renderer_standalone/object_renderer_standalone/renderer_standalone.c")
target_link_libraries(renderer_standalone lib_rend lib_dec lib_util lib_com lib_debug)

add_executable(IVAS_cod apps/encoder.c)
target_link_libraries(IVAS_cod lib_enc lib_util)
if(WIN32)
@@ -167,9 +178,11 @@ endif()
add_executable(IVAS_rend apps/renderer.c)
target_link_libraries(IVAS_rend lib_rend lib_util lib_dec) # Todo refactor: dependency to lib_dec should be removed

if(COPY_EXECUTABLES_TO_ROOT)
  # Optionally copy executables to root directory after build
if(COPY_EXECUTABLES_FROM_BUILD_DIR)
  # Optionally copy executables to the same place where Make puts them (useful for tests that expect executables in specific places)
  add_custom_command(TARGET IVAS_cod POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_cod>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  add_custom_command(TARGET IVAS_dec POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_dec>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  add_custom_command(TARGET IVAS_rend POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_rend>" "${CMAKE_CURRENT_SOURCE_DIR}/")
  add_custom_command(TARGET IVAS_crend_unit_test POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:IVAS_crend_unit_test>" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/ivas_pytests/tests/unit_tests/crend/")
  add_custom_command(TARGET renderer_standalone POST_BUILD VERBATIM COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:renderer_standalone>" "${CMAKE_CURRENT_SOURCE_DIR}/scripts/td_object_renderer/object_renderer_standalone/")
endif()
+1 −0
Original line number Diff line number Diff line
@@ -264,6 +264,7 @@
    <ClCompile Include="..\lib_dec\init_dec.c" />
    <ClCompile Include="..\lib_dec\inov_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_agc_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_corecoder_dec_reconfig.c" />
    <ClCompile Include="..\lib_dec\ivas_core_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_cpe_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_dec.c" />
+6 −0
Original line number Diff line number Diff line
@@ -500,6 +500,12 @@
    <ClCompile Include="..\lib_dec\ivas_spar_decoder.c">
      <Filter>dec_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\ivas_spar_md_dec.c">
      <Filter>dec_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\ivas_corecoder_dec_reconfig.c">
      <Filter>dec_ivas_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_dec\jbm_jb4_inputbuffer.h">
Loading