From 2a9b9e8941e7d00b0753643bf1153da215b42d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Thu, 9 Jan 2025 13:54:19 +0100 Subject: [PATCH 01/21] Port renderer-pytest-on-merge-request from upstream --- .gitlab-ci.yml | 99 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4843bd3bf..9e2562a0c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -101,6 +101,7 @@ stages: - prevalidate - build - test + - compare - deploy # --------------------------------------------------------------- @@ -117,6 +118,27 @@ stages: echo "Commit time was $CI_COMMIT_TIMESTAMP" date | xargs echo "System time is" +.disable-debugging-macro: &disable-debugging-macro + # automatically disable #DEBUGGING macro in options.h using /**/-comment + - sed -i.bak -e "s/^[[:space:]]*\(#define[[:space:]]*DEBUGGING\)/\/\*\1\*\//g" lib_com/options.h + +.merge-request-comparison-setup-codec: &merge-request-comparison-setup-codec + ### build test binaries, initial clean for paranoia reasons + - *disable-debugging-macro + - make clean + - make -j + - mv IVAS_cod IVAS_cod_test + - mv IVAS_dec IVAS_dec_test + - mv IVAS_rend IVAS_rend_test + - git restore . + +.merge-request-comparison-check: &merge-request-comparison-check + - echo "--------------- Running merge-request-comparison-check anchor ---------------" + - 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 + .build-reference-binaries: &build-reference-binaries - current_commit_sha=$(git rev-parse HEAD) ### build reference binaries @@ -171,7 +193,12 @@ stages: - cd $LTV_DIR - git pull - cd - - + +.get-commits-behind-count: &get-commits-behind-count + - 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) + .copy-ltv-files-to-testv-dir: ©-ltv-files-to-testv-dir - cp "$LTV_DIR"/*.wav scripts/testv/ - cp "$LTV_DIR"/*.met scripts/testv/ @@ -245,6 +272,39 @@ stages: # Job templates # --------------------------------------------------------------- +# When designing templates, try not to use too much inheritance and +# if multiple templates and extended on, remember that on conflict, +# latest overwrites the parameter. + +# templates for rules +.rules-basis: + rules: + - if: $MIRROR_ACCESS_TOKEN # Don't run in the mirror update pipeline (only then MIRROR_ACCESS_TOKEN is defined) + when: never + - if: $CI_PIPELINE_SOURCE == 'schedule' # Don't run in any scheduled pipelines by default (use schedule templates below to enable again for certain conditions) + when: never + - if: $CI_PIPELINE_SOURCE == 'trigger' # Don't run triggered pipeline by default + when: never + - if: $MANUAL_PIPELINE_TYPE == 'test-be-release' # Skip all the normal jobs when testing manually against release codec + when: never + - if: $MANUAL_PIPELINE_TYPE == 'test-long-self-test' # Skip all the normal jobs when testing manually against release codec + when: never + - if: $MANUAL_PIPELINE_TYPE == 'ivas-conformance' + when: never + - if: $MANUAL_PIPELINE_TYPE == 'ivas-conformance-linux' + when: never + - if: $MANUAL_PIPELINE_TYPE == 'check-clipping' + - if: $MANUAL_PIPELINE_TYPE == 'test-branch-vs-input-passthrough' + when: never + - when: on_success + +.rules-merge-request: + extends: .rules-basis + rules: + - 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 + # templates to define stages and platforms .test-job-linux: tags: @@ -1145,6 +1205,43 @@ voip-be-on-merge-request: - python3 -m pytest tests/test_be_for_jbm_neutral_dly_profile.py +# compare renderer bitexactness between target and source branch +renderer-pytest-on-merge-request: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + needs: ["build-codec-linux-make"] + # TODO: set reasonable timeout, will most likely take less + timeout: "20 minutes" + stage: compare + script: + - *print-common-info + - *get-commits-behind-count + - *check-commits-behind-count-in-compare-jobs + - *merge-request-comparison-setup-codec + + # some helper variables - "|| true" to prevent failures from grep not finding anything + # write to temporary file as workaround for failures observed with piping echo + - echo $CI_MERGE_REQUEST_TITLE > tmp.txt + - non_be_flag=$(grep -c --ignore-case "\[rend\(erer\)*[ -]*non[ -]*be\]" tmp.txt) || true + - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + + ### If ref_using_main is not set, checkout the source branch to use scripts and input from there + - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi + + - exit_code=0 + - testcase_timeout=60 + - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout || exit_code=$? + + ### Run test using branch scripts and input + - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi + + # run test + - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer_.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + + - *merge-request-comparison-check + # --------------------------------------------------------------- # Complexity measurement jobs # --------------------------------------------------------------- -- GitLab From 5c4fc1ff55f83cefc220daf1a00728a646af29f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Thu, 9 Jan 2025 13:59:32 +0100 Subject: [PATCH 02/21] Port ivas-pytest-on-merge-request from upstream --- .gitlab-ci.yml | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9e2562a0c..39e19eaeb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -199,6 +199,9 @@ stages: - echo $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - commits_behind_count=$(git rev-list --count $CI_COMMIT_SHA..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) +.check-commits-behind-count-in-compare-jobs: &check-commits-behind-count-in-compare-jobs + - if [ $commits_behind_count -ne 0 ]; then echo "Your branch is not up-to-date with main -> Compare tests will not run as they can contain false negatives this way.\nMain might have changed during your pipeline run. Run 'git merge origin/main' to update."; exit 1; fi + .copy-ltv-files-to-testv-dir: ©-ltv-files-to-testv-dir - cp "$LTV_DIR"/*.wav scripts/testv/ - cp "$LTV_DIR"/*.met scripts/testv/ @@ -1205,6 +1208,42 @@ voip-be-on-merge-request: - python3 -m pytest tests/test_be_for_jbm_neutral_dly_profile.py +# --------------------------------------------------------------- +# Test jobs for merge requests +# --------------------------------------------------------------- + +# test that runs all modes with 1s input signals +codec-smoke-test: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + timeout: "20 minutes" + tags: + - ivas-basop-linux + stage: test + needs: ["build-codec-linux-make"] #, "build-codec-instrumented-linux", "build-codec-sanitizers-linux"] + script: + - *print-common-info + # LTV update needed as ltv ISM metadata files are used + - *update-ltv-repo + - bash ci/smoke_test.sh + ### analyze for failures + - if ! [ -s smoke_test_output.txt ] || ! [ -s smoke_test_output_jbm.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 JBM failed"; ret_val=1; fi + - if cat smoke_test_output_jbm.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: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + paths: + - smoke_test_output.txt + - smoke_test_output_jbm.txt + - smoke_test_output_hrtf.txt + expose_as: "Smoke test results" + # compare renderer bitexactness between target and source branch renderer-pytest-on-merge-request: extends: @@ -1242,6 +1281,59 @@ renderer-pytest-on-merge-request: - *merge-request-comparison-check +# compare bit exactness between target and source branch +ivas-pytest-on-merge-request: + extends: + - .test-job-linux-needs-testv-dir + - .rules-merge-request + stage: compare + needs: ["build-codec-linux-make", "codec-smoke-test"] + timeout: "14 minutes" + script: + - *print-common-info + - *get-commits-behind-count + - *check-commits-behind-count-in-compare-jobs + - *merge-request-comparison-setup-codec + + # some helper variables - "|| true" to prevent failures from grep not finding anything + # write to temporary file as workaround for failures observed with piping echo + - echo $CI_MERGE_REQUEST_TITLE > tmp.txt + - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true + - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + + ### If ref_using_main is not set, checkout the source branch to use scripts and input from there + - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi + + ### prepare pytest + # create references + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 + + ### Run test using branch scripts and input + - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi + + ### run pytest + - exit_code=0 + - testcase_timeout=60 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$? + - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true + + - *merge-request-comparison-check + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week + when: always + paths: + - report-junit.xml + - report.html + expose_as: "pytest ivas results" + reports: + junit: + - report-junit.xml + # --------------------------------------------------------------- # Complexity measurement jobs # --------------------------------------------------------------- -- GitLab From 62f6111162bd5752dc789a1cf3ad93b99d9537fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Fri, 20 Dec 2024 17:15:16 +0100 Subject: [PATCH 03/21] Run jobs for all merge requests Temporary measure to allow development on the CI infrastructure during the merge phase. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39e19eaeb..2f2a65a05 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -304,7 +304,7 @@ stages: .rules-merge-request: extends: .rules-basis rules: - - 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 == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'push' when: never @@ -660,7 +660,7 @@ clang-format-check: extends: - .test-job-linux rules: - - 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 == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'push' when: never - if: $CI_PIPELINE_SOURCE == 'schedule' -- GitLab From c7d71f704af5d7e8a8c7816790c9a35cf36cee65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Mon, 23 Dec 2024 10:30:35 +0100 Subject: [PATCH 04/21] Migrate branch-is-up-to-date-* jobs from upstream --- .gitlab-ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2f2a65a05..82be5ed2e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -102,6 +102,7 @@ stages: - build - test - compare + - postvalidate - deploy # --------------------------------------------------------------- @@ -652,6 +653,34 @@ uninterruptible: tags: - ivas-basop-linux +# --------------------------------------------------------------- +# Validation jobs +# --------------------------------------------------------------- + +branch-is-up-to-date-with-target-pre: + extends: + - .rules-merge-request + stage: prevalidate + needs: [] + tags: + - ivas-basop-linux + script: + - *get-commits-behind-count + - echo $commits_behind_count + - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, run 'git merge origin/main' to update."; exit 1; fi; + +branch-is-up-to-date-with-target-post: + extends: + - .rules-merge-request + stage: postvalidate + tags: + - ivas-basop-linux + script: + - *get-commits-behind-count + - echo $commits_behind_count + - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, possibly main changed during your pipeline run, run 'git merge origin/main' to update." exit 1; fi; + + # --------------------------------------------------------------- # verification jobs # --------------------------------------------------------------- -- GitLab From 117fa52ec2e214feb4566b7a1d1388ad0ff34f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Thu, 9 Jan 2025 15:38:29 +0100 Subject: [PATCH 05/21] Fix and improve branch update instructions --- .gitlab-ci.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 82be5ed2e..a72643bc0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -201,7 +201,12 @@ stages: - commits_behind_count=$(git rev-list --count $CI_COMMIT_SHA..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) .check-commits-behind-count-in-compare-jobs: &check-commits-behind-count-in-compare-jobs - - if [ $commits_behind_count -ne 0 ]; then echo "Your branch is not up-to-date with main -> Compare tests will not run as they can contain false negatives this way.\nMain might have changed during your pipeline run. Run 'git merge origin/main' to update."; exit 1; fi + - | + if [ $commits_behind_count -ne 0 ]; then + echo "Your branch is not up-to-date with main -> Compare tests will not run as they can contain false negatives this way." + echo "Main might have changed during your pipeline run. Run 'git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME' to update." + exit 1 + fi .copy-ltv-files-to-testv-dir: ©-ltv-files-to-testv-dir - cp "$LTV_DIR"/*.wav scripts/testv/ @@ -667,7 +672,11 @@ branch-is-up-to-date-with-target-pre: script: - *get-commits-behind-count - echo $commits_behind_count - - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, run 'git merge origin/main' to update."; exit 1; fi; + - | + if [ $commits_behind_count -ne 0 ]; then + echo "Your branch is behind the target branch, run 'git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME' to update." + exit 1 + fi branch-is-up-to-date-with-target-post: extends: @@ -678,7 +687,11 @@ branch-is-up-to-date-with-target-post: script: - *get-commits-behind-count - echo $commits_behind_count - - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, possibly main changed during your pipeline run, run 'git merge origin/main' to update." exit 1; fi; + - | + if [ $commits_behind_count -ne 0 ]; then + echo "Your branch is behind the target branch, possibly main changed during your pipeline run, run 'git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME' to update." + exit 1 + fi # --------------------------------------------------------------- -- GitLab From a753c19f8ef63e3485fa2098a51f184362178db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Thu, 9 Jan 2025 16:55:05 +0100 Subject: [PATCH 06/21] Temporarily disable codec-smoke-test --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a72643bc0..f0c100b71 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1255,7 +1255,8 @@ voip-be-on-merge-request: # --------------------------------------------------------------- # test that runs all modes with 1s input signals -codec-smoke-test: +# TODO: disabled temporarily, needs to be adapted to BASOP +.codec-smoke-test: extends: - .test-job-linux-needs-testv-dir - .rules-merge-request @@ -1329,7 +1330,8 @@ ivas-pytest-on-merge-request: - .test-job-linux-needs-testv-dir - .rules-merge-request stage: compare - needs: ["build-codec-linux-make", "codec-smoke-test"] + # TODO: broken dependency needs to be removed temporarily, see above + needs: ["build-codec-linux-make"] #, "codec-smoke-test"] timeout: "14 minutes" script: - *print-common-info -- GitLab From 6262626c046a5fb2bcec2b83bb4f6227ef2200d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Thu, 9 Jan 2025 17:24:33 +0100 Subject: [PATCH 07/21] Document dependency --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f0c100b71..a24f65ceb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1331,6 +1331,9 @@ ivas-pytest-on-merge-request: - .rules-merge-request stage: compare # TODO: broken dependency needs to be removed temporarily, see above + # note: this step doesn't really depend on codec-smoke-test + # it's just pointless to run this step when the smoke test fails and the smoke test should be reasonably fast + # thus, overall, this should save time needs: ["build-codec-linux-make"] #, "codec-smoke-test"] timeout: "14 minutes" script: -- GitLab From 35366b83c0a6a3ee133e569c5d28af1292cacc2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Fri, 10 Jan 2025 21:32:03 +0100 Subject: [PATCH 08/21] Port remaining build jobs --- .gitlab-ci.yml | 40 +++++- ci/build_codec_sanitizers_linux.sh | 43 ++++++ scripts/prepare_instrumentation.sh | 207 +++++++++++++++++++++++++++++ 3 files changed, 289 insertions(+), 1 deletion(-) create mode 100755 ci/build_codec_sanitizers_linux.sh create mode 100755 scripts/prepare_instrumentation.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a24f65ceb..62db22ef4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -119,6 +119,13 @@ stages: echo "Commit time was $CI_COMMIT_TIMESTAMP" date | xargs echo "System time is" +.print-common-info-windows: &print-common-info-windows + - | + echo "Printing common information for build job." + echo "Current job is run on commit $CI_COMMIT_SHA" + echo "Commit time was $CI_COMMIT_TIMESTAMP" + ("echo 'System time is'", "Get-Date -Format 'dddd dd/MM/yyyy HH:mm K'") | Invoke-Expression + .disable-debugging-macro: &disable-debugging-macro # automatically disable #DEBUGGING macro in options.h using /**/-comment - sed -i.bak -e "s/^[[:space:]]*\(#define[[:space:]]*DEBUGGING\)/\/\*\1\*\//g" lib_com/options.h @@ -216,6 +223,10 @@ stages: .activate-Werror-linux: &activate-Werror-linux - sed -i.bak "s/^# \(CFLAGS += -Werror\)/\1/" Makefile +.activate-WX-windows: &activate-WX-windows + - (Get-Content -Path "CMakeLists.txt") -replace '# \(add_compile_options\("\/WX"\)\)', '$1' | Set-Content -Path "CMakeLists.txt" + - Get-ChildItem -Path "Workspace_msvc" -Filter "*.vcxproj" | ForEach-Object { (Get-Content -Path $_.FullName) -replace 'false', 'true' | Set-Content -Path $_.FullName } + .rules-pytest-to-ref-short: rules: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-compare" @@ -326,6 +337,14 @@ stages: tags: - ivas-basop-linux +.build-job-windows: + stage: build + needs: [] + timeout: "4 minutes" + tags: + # TODO: set up ivas-basop-windows runners + - ivas-windows + # template for test jobs on linux that need the TESTV_DIR .test-job-linux-needs-testv-dir: extends: .test-job-linux @@ -775,7 +794,7 @@ 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 == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'schedule' - if: $CI_PIPELINE_SOURCE == 'push' when: never @@ -788,6 +807,25 @@ build-codec-linux-instrumented-make: - bash scripts/prepare_instrumentation.sh -m MEM_ONLY -p BASOP - make -j -C $INSTR_DIR +# make sure that the codec builds with msan, asan and usan +build-codec-sanitizers-linux: + extends: + - .build-job-linux + - .rules-basis + script: + - *print-common-info + - *activate-Werror-linux + - bash ci/build_codec_sanitizers_linux.sh + +build-codec-windows-msbuild: + extends: + - .build-job-windows + - .rules-basis + script: + - *print-common-info-windows + - *activate-WX-windows + - MSBuild.exe -maxcpucount .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug + # --------------------------------------------------------------- # Short test jobs that run in merge request pipelines # --------------------------------------------------------------- diff --git a/ci/build_codec_sanitizers_linux.sh b/ci/build_codec_sanitizers_linux.sh new file mode 100755 index 000000000..f599d607c --- /dev/null +++ b/ci/build_codec_sanitizers_linux.sh @@ -0,0 +1,43 @@ +#! /usr/bin/bash + +# (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +# contributors to this repository. All Rights Reserved. + +# This software is protected by copyright law and by international treaties. +# The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +# contributors to this repository retain full ownership rights in their respective contributions in +# the software. This notice grants no license of any kind, including but not limited to patent +# license, nor is any license granted by implication, estoppel or otherwise. + +# Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +# contributions. + +# This software is provided "AS IS", without any express or implied warranties. The software is in the +# development stage. It is intended exclusively for experts who have experience with such software and +# solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +# and fitness for a particular purpose are hereby disclaimed and excluded. + +# Any dispute, controversy or claim arising under or in relation to providing this software shall be +# submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +# the United Nations Convention on Contracts on the International Sales of Goods. + +if [ ! -d "lib_com" ]; then + echo "not in root directory! - please run in IVAS root" + exit 1 +fi + +# CI linux container would do this, can stay commented if clang (v13) is in your path +#PATH=$PATH:/usr/lib/llvm-13/bin +make clean +make CLANG=1 -j +make clean +make CLANG=2 -j +make clean +make CLANG=3 -j diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh new file mode 100755 index 000000000..4ed709844 --- /dev/null +++ b/scripts/prepare_instrumentation.sh @@ -0,0 +1,207 @@ +#!/bin/bash + +# +# (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +# contributors to this repository. All Rights Reserved. +# +# This software is protected by copyright law and by international treaties. +# The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +# contributors to this repository retain full ownership rights in their respective contributions in +# the software. This notice grants no license of any kind, including but not limited to patent +# license, nor is any license granted by implication, estoppel or otherwise. +# +# Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +# contributions. +# +# This software is provided "AS IS", without any express or implied warranties. The software is in the +# development stage. It is intended exclusively for experts who have experience with such software and +# solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +# and fitness for a particular purpose are hereby disclaimed and excluded. +# +# Any dispute, controversy or claim arising under or in relation to providing this software shall be +# submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +# the United Nations Convention on Contracts on the International Sales of Goods. +# + +function usage { + echo + echo "Usage:" + echo " $(basename $0) [OPTIONS]" + echo + echo " -m MODE one of [FULL|MEM_ONLY]" + echo " -p PROJECT one of [FLOAT|BASOP]" + exit +} + + +# default values +MODE="FULL" +PROJECT="FLOAT" + +while getopts "m:p:h" OPTIONS; do + case ${OPTIONS} in + m) + MODE=${OPTARG^^} + if [ "$MODE" != "FULL" -a "$MODE" != "MEM_ONLY" ]; then + usage + fi + ;; + p) + PROJECT=${OPTARG^^} + if [ "$PROJECT" != "FLOAT" -a "$PROJECT" != "BASOP" ]; then + usage + fi + ;; + h | *) + usage + ;; + esac +done +shift $((OPTIND-1)) + + +wmc_opt="" +if [ "$MODE" = "MEM_ONLY" ]; then + wmc_opt="-s" +fi + + +system=`uname -s` +if [[ ($system = "Linux") && (`uname -a` =~ (microsoft|Microsoft|wsl|WSL) ) ]]; then + system="Linux" +fi + +coan_exists () { + type coan &> /dev/null ; +} + +cppp_exists () { + type cppp/cppp.pl &> /dev/null ; +} + +if ! (coan_exists || cppp_exists); then + echo "Neither coan (recommended) nor cppp could be found. Requires either coan or cppp to operate properly. Exiting." + echo "Coan is available from http://coan2.sourceforge.net/; please make it available in your path" + echo "cppp is available from https://homes.cs.washington.edu/~mernst/software/#cppp; please copy to directory scripts/cppp" + exit -1 +fi + +targetdir=c-code_instrument + +currdir=`pwd` +scriptdir=`dirname $0` +ifdef_list=ifdef_instrument.list +sourcedir=$scriptdir/.. +cd $scriptdir + +rm -Rf $targetdir +mkdir $targetdir + +# copy files from source-dir +cp -R ../lib_* $targetdir +cp -R ../apps $targetdir +cp -R ../Makefile $targetdir +if [ "$PROJECT" = "FLOAT" ]; then + cp -R ../CMakeLists.txt $targetdir +fi +cp -R ../Workspace_msvc $targetdir + +# back up #ifdef-list +rm -f $ifdef_list +touch $ifdef_list + +# LC3plus-related stuff -> only in float code +if [ "$PROJECT" = "FLOAT" ]; then + # Add LC3plus feature defines to options.h so that they are stripped correctly + # Generate list of active defines in LC3plus defines.h + lc3plus_defines=$( + gcc -E -dM $targetdir/lib_lc3plus/defines.h -I $targetdir/lib_com -I $targetdir/lib_debug | + sed '/^#define [[:alnum:]][[:alnum:]_]\+[[:space:]]*$/! d' | + sed '/#define DEFINES_H/ d' + ) + + # Filter defines that come from outside of the header lib_lc3plus/defines.h + lc3plus_defines_filtered="" + while IFS=' \n' read -r line; + do + line=`echo $line | tr -d '\n'` + if grep -wqF "$line" "$targetdir/lib_lc3plus/defines.h"; then + lc3plus_defines_filtered+=$line$'\n' + fi + done <<< $lc3plus_defines + + # Append LC3plus defines to options.h + echo " + /* LC3plus switches */ + #ifndef OPTIONS_H_LC3_DEFINES + #define OPTIONS_H_LC3_DEFINES + $lc3plus_defines_filtered + #endif /* OPTIONS_H_LC3_DEFINES */ + " >>$targetdir/lib_com/options.h +fi + +# get switches from options.h and append it to $ifdef_list +parse_options_opt="" +if coan_exists; then + echo "-UDEBUGGING" >> $ifdef_list + parse_options_opt="-c" +else + echo "DEBUGGING" >> $ifdef_list +fi +./parse_options_h.sh $parse_options_opt $targetdir/lib_com/options.h >> $ifdef_list +if [ $? -ne 0 ]; then + exit -1 +fi + +# strip switches, to remove the macros (turn on extended globing to allow !(pattern*) matching) +shopt -s extglob +if coan_exists; then + # remove WMOPS and MEM_COUNT_DETAILS from the list to preserve the options in the instrumented code + sed -i "/-DWMOPS/d" $ifdef_list + sed -i "/-UMEM_COUNT_DETAILS/d" $ifdef_list + + coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/apps/*.[hc] + if [ "$PROJECT" = "FLOAT" ]; then + coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_{com,dec,enc,isar,rend,util,debug}/!(wmc_auto*).[hc] + coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_lc3plus/!(wmc_auto*).[hc] + coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_lc3plus/fft/!(wmc_auto*).[hc] + else + # same as first call from if, but without "isar" and "debug" to avoid coan warning + coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_{com,dec,enc,rend,util}/!(wmc_auto*).[hc] + fi +else + ./strip_defines_cppp.sh $targetdir $ifdef_list +fi +shopt -u extglob + +# patch code before wmc_tool: replace hexadecimal unsigned long constants (0x...UL) by regular integer constant + cast to unsigned long +find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(unsigned long\)\1\)/" \{\} \; + +# run wmc_tool +"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" >> /dev/null +"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null +# ISAR post-renderer and lc3plus sources only need to be instrumented in float code +if [ "$PROJECT" = "FLOAT" ]; then + for bak_file in $targetdir/lib_rend/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null + for bak_file in $targetdir/lib_lc3plus/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + for bak_file in $targetdir/lib_lc3plus/fft/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null +else + for bak_file in $targetdir/lib_rend/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> /dev/null +fi + +# automatically enable #define WMOPS in options.h +sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*WMOPS\)[[:space:]]*\*\//\1/g" $targetdir/lib_com/options.h +sed -i.bak -e "s/\/\/[[:space:]]*\(#define[[:space:]]*WMOPS\)/\1/g" $targetdir/lib_com/options.h + +# return to start dir +cd "$currdir" -- GitLab From 9b63410b24d9e000359496500cd16bf6fa01fade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Mon, 13 Jan 2025 11:30:59 +0100 Subject: [PATCH 09/21] fixup! Port remaining build jobs --- .gitlab-ci.yml | 2 + ci/build_codec_sanitizers_linux.sh | 43 ------ scripts/prepare_instrumentation.sh | 207 ----------------------------- 3 files changed, 2 insertions(+), 250 deletions(-) delete mode 100755 ci/build_codec_sanitizers_linux.sh delete mode 100755 scripts/prepare_instrumentation.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 62db22ef4..f18214fb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -802,6 +802,7 @@ build-codec-linux-instrumented-make: - .build-job-linux timeout: "7 minutes" script: + - *update-scripts-repo - *print-common-info - *update-scripts-repo - bash scripts/prepare_instrumentation.sh -m MEM_ONLY -p BASOP @@ -813,6 +814,7 @@ build-codec-sanitizers-linux: - .build-job-linux - .rules-basis script: + - *update-scripts-repo - *print-common-info - *activate-Werror-linux - bash ci/build_codec_sanitizers_linux.sh diff --git a/ci/build_codec_sanitizers_linux.sh b/ci/build_codec_sanitizers_linux.sh deleted file mode 100755 index f599d607c..000000000 --- a/ci/build_codec_sanitizers_linux.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! /usr/bin/bash - -# (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, -# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, -# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other -# contributors to this repository. All Rights Reserved. - -# This software is protected by copyright law and by international treaties. -# The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, -# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, -# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other -# contributors to this repository retain full ownership rights in their respective contributions in -# the software. This notice grants no license of any kind, including but not limited to patent -# license, nor is any license granted by implication, estoppel or otherwise. - -# Contributors are required to enter into the IVAS codec Public Collaboration agreement before making -# contributions. - -# This software is provided "AS IS", without any express or implied warranties. The software is in the -# development stage. It is intended exclusively for experts who have experience with such software and -# solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -# and fitness for a particular purpose are hereby disclaimed and excluded. - -# Any dispute, controversy or claim arising under or in relation to providing this software shall be -# submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -# the United Nations Convention on Contracts on the International Sales of Goods. - -if [ ! -d "lib_com" ]; then - echo "not in root directory! - please run in IVAS root" - exit 1 -fi - -# CI linux container would do this, can stay commented if clang (v13) is in your path -#PATH=$PATH:/usr/lib/llvm-13/bin -make clean -make CLANG=1 -j -make clean -make CLANG=2 -j -make clean -make CLANG=3 -j diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh deleted file mode 100755 index 4ed709844..000000000 --- a/scripts/prepare_instrumentation.sh +++ /dev/null @@ -1,207 +0,0 @@ -#!/bin/bash - -# -# (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, -# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, -# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other -# contributors to this repository. All Rights Reserved. -# -# This software is protected by copyright law and by international treaties. -# The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, -# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., -# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, -# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other -# contributors to this repository retain full ownership rights in their respective contributions in -# the software. This notice grants no license of any kind, including but not limited to patent -# license, nor is any license granted by implication, estoppel or otherwise. -# -# Contributors are required to enter into the IVAS codec Public Collaboration agreement before making -# contributions. -# -# This software is provided "AS IS", without any express or implied warranties. The software is in the -# development stage. It is intended exclusively for experts who have experience with such software and -# solely for the purpose of inspection. All implied warranties of non-infringement, merchantability -# and fitness for a particular purpose are hereby disclaimed and excluded. -# -# Any dispute, controversy or claim arising under or in relation to providing this software shall be -# submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in -# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and -# the United Nations Convention on Contracts on the International Sales of Goods. -# - -function usage { - echo - echo "Usage:" - echo " $(basename $0) [OPTIONS]" - echo - echo " -m MODE one of [FULL|MEM_ONLY]" - echo " -p PROJECT one of [FLOAT|BASOP]" - exit -} - - -# default values -MODE="FULL" -PROJECT="FLOAT" - -while getopts "m:p:h" OPTIONS; do - case ${OPTIONS} in - m) - MODE=${OPTARG^^} - if [ "$MODE" != "FULL" -a "$MODE" != "MEM_ONLY" ]; then - usage - fi - ;; - p) - PROJECT=${OPTARG^^} - if [ "$PROJECT" != "FLOAT" -a "$PROJECT" != "BASOP" ]; then - usage - fi - ;; - h | *) - usage - ;; - esac -done -shift $((OPTIND-1)) - - -wmc_opt="" -if [ "$MODE" = "MEM_ONLY" ]; then - wmc_opt="-s" -fi - - -system=`uname -s` -if [[ ($system = "Linux") && (`uname -a` =~ (microsoft|Microsoft|wsl|WSL) ) ]]; then - system="Linux" -fi - -coan_exists () { - type coan &> /dev/null ; -} - -cppp_exists () { - type cppp/cppp.pl &> /dev/null ; -} - -if ! (coan_exists || cppp_exists); then - echo "Neither coan (recommended) nor cppp could be found. Requires either coan or cppp to operate properly. Exiting." - echo "Coan is available from http://coan2.sourceforge.net/; please make it available in your path" - echo "cppp is available from https://homes.cs.washington.edu/~mernst/software/#cppp; please copy to directory scripts/cppp" - exit -1 -fi - -targetdir=c-code_instrument - -currdir=`pwd` -scriptdir=`dirname $0` -ifdef_list=ifdef_instrument.list -sourcedir=$scriptdir/.. -cd $scriptdir - -rm -Rf $targetdir -mkdir $targetdir - -# copy files from source-dir -cp -R ../lib_* $targetdir -cp -R ../apps $targetdir -cp -R ../Makefile $targetdir -if [ "$PROJECT" = "FLOAT" ]; then - cp -R ../CMakeLists.txt $targetdir -fi -cp -R ../Workspace_msvc $targetdir - -# back up #ifdef-list -rm -f $ifdef_list -touch $ifdef_list - -# LC3plus-related stuff -> only in float code -if [ "$PROJECT" = "FLOAT" ]; then - # Add LC3plus feature defines to options.h so that they are stripped correctly - # Generate list of active defines in LC3plus defines.h - lc3plus_defines=$( - gcc -E -dM $targetdir/lib_lc3plus/defines.h -I $targetdir/lib_com -I $targetdir/lib_debug | - sed '/^#define [[:alnum:]][[:alnum:]_]\+[[:space:]]*$/! d' | - sed '/#define DEFINES_H/ d' - ) - - # Filter defines that come from outside of the header lib_lc3plus/defines.h - lc3plus_defines_filtered="" - while IFS=' \n' read -r line; - do - line=`echo $line | tr -d '\n'` - if grep -wqF "$line" "$targetdir/lib_lc3plus/defines.h"; then - lc3plus_defines_filtered+=$line$'\n' - fi - done <<< $lc3plus_defines - - # Append LC3plus defines to options.h - echo " - /* LC3plus switches */ - #ifndef OPTIONS_H_LC3_DEFINES - #define OPTIONS_H_LC3_DEFINES - $lc3plus_defines_filtered - #endif /* OPTIONS_H_LC3_DEFINES */ - " >>$targetdir/lib_com/options.h -fi - -# get switches from options.h and append it to $ifdef_list -parse_options_opt="" -if coan_exists; then - echo "-UDEBUGGING" >> $ifdef_list - parse_options_opt="-c" -else - echo "DEBUGGING" >> $ifdef_list -fi -./parse_options_h.sh $parse_options_opt $targetdir/lib_com/options.h >> $ifdef_list -if [ $? -ne 0 ]; then - exit -1 -fi - -# strip switches, to remove the macros (turn on extended globing to allow !(pattern*) matching) -shopt -s extglob -if coan_exists; then - # remove WMOPS and MEM_COUNT_DETAILS from the list to preserve the options in the instrumented code - sed -i "/-DWMOPS/d" $ifdef_list - sed -i "/-UMEM_COUNT_DETAILS/d" $ifdef_list - - coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/apps/*.[hc] - if [ "$PROJECT" = "FLOAT" ]; then - coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_{com,dec,enc,isar,rend,util,debug}/!(wmc_auto*).[hc] - coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_lc3plus/!(wmc_auto*).[hc] - coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_lc3plus/fft/!(wmc_auto*).[hc] - else - # same as first call from if, but without "isar" and "debug" to avoid coan warning - coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_{com,dec,enc,rend,util}/!(wmc_auto*).[hc] - fi -else - ./strip_defines_cppp.sh $targetdir $ifdef_list -fi -shopt -u extglob - -# patch code before wmc_tool: replace hexadecimal unsigned long constants (0x...UL) by regular integer constant + cast to unsigned long -find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(unsigned long\)\1\)/" \{\} \; - -# run wmc_tool -"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" >> /dev/null -"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null -# ISAR post-renderer and lc3plus sources only need to be instrumented in float code -if [ "$PROJECT" = "FLOAT" ]; then - for bak_file in $targetdir/lib_rend/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null - for bak_file in $targetdir/lib_lc3plus/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - for bak_file in $targetdir/lib_lc3plus/fft/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null -else - for bak_file in $targetdir/lib_rend/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> /dev/null -fi - -# automatically enable #define WMOPS in options.h -sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*WMOPS\)[[:space:]]*\*\//\1/g" $targetdir/lib_com/options.h -sed -i.bak -e "s/\/\/[[:space:]]*\(#define[[:space:]]*WMOPS\)/\1/g" $targetdir/lib_com/options.h - -# return to start dir -cd "$currdir" -- GitLab From 7b59f036f84f33fc1a1540687eacef4602ccc768 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 13 Jan 2025 11:44:34 +0100 Subject: [PATCH 10/21] deactivate windows build job for now --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f18214fb9..84835bcb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -819,7 +819,8 @@ build-codec-sanitizers-linux: - *activate-Werror-linux - bash ci/build_codec_sanitizers_linux.sh -build-codec-windows-msbuild: + # TODO: reactivate once windows runners are available in BASOP project +.build-codec-windows-msbuild: extends: - .build-job-windows - .rules-basis -- GitLab From aec9c798a20eced4d909500fedf1deb4bc9a5635 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 13 Jan 2025 13:25:05 +0100 Subject: [PATCH 11/21] define forgottenci variable --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 84835bcb9..fd9396e6c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,6 +28,7 @@ variables: CI_REGRESSION_THRESH_ODG: "-0.05" GIT_CLEAN_FLAGS: -ffdxq INSTR_DIR: "scripts/c-code_instrument" + TESTS_DIR_CODEC_BE_ON_MR: "tests/codec_be_on_mr_nonselection" MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." value: 'default' -- GitLab From dc1e7235157dea29162dae0431340750210978f8 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 13 Jan 2025 13:26:06 +0100 Subject: [PATCH 12/21] apply clang format patch --- apps/decoder.c | 119 +++++---- apps/renderer.c | 172 ++++++------- lib_com/common_api_types.h | 1 - lib_com/delay_comp.c | 16 +- lib_com/gs_bitallocation.c | 35 ++- lib_com/ivas_dirac_com.c | 21 +- lib_com/prot.h | 16 +- lib_dec/bass_psfilter.c | 2 +- lib_dec/ivas_binRenderer_internal.c | 18 +- lib_dec/ivas_init_dec.c | 77 +++--- lib_dec/ivas_ism_dec.c | 10 +- lib_dec/ivas_ism_param_dec.c | 82 +++--- lib_dec/ivas_ism_renderer.c | 6 +- lib_dec/ivas_jbm_dec.c | 61 +++-- lib_dec/ivas_mc_paramupmix_dec.c | 14 +- lib_dec/ivas_mct_dec.c | 79 +++--- lib_dec/ivas_mdct_core_dec.c | 5 +- lib_dec/ivas_objectRenderer_internal.c | 6 +- lib_dec/ivas_omasa_dec.c | 12 +- lib_dec/ivas_osba_dec.c | 21 +- lib_dec/ivas_output_config.c | 9 +- lib_dec/ivas_qmetadata_dec.c | 8 +- lib_dec/ivas_rom_dec.h | 1 - lib_dec/ivas_sba_dec.c | 21 +- lib_dec/ivas_sba_rendering_internal.c | 1 - lib_dec/ivas_spar_decoder.c | 3 +- lib_dec/ivas_spar_md_dec.c | 9 +- lib_dec/ivas_stat_dec.h | 20 +- lib_dec/ivas_stereo_dft_dec.c | 12 +- lib_dec/ivas_stereo_mdct_stereo_dec.c | 24 +- lib_dec/lib_dec.c | 40 ++- lib_dec/lib_dec.h | 1 - lib_enc/acelp_core_enc.c | 2 +- lib_enc/cod_tcx.c | 12 +- lib_enc/evs_enc.c | 2 +- lib_enc/ivas_cpe_enc.c | 4 +- lib_enc/ivas_qmetadata_enc.c | 2 +- lib_enc/pre_proc.c | 16 +- lib_rend/ivas_crend.c | 22 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 215 ++++++++-------- lib_rend/ivas_objectRenderer.c | 24 +- lib_rend/ivas_prot_rend.h | 1 - lib_rend/ivas_rom_rend.h | 1 - lib_rend/ivas_rotation.c | 32 ++- lib_rend/ivas_stat_rend.h | 3 - lib_rend/lib_rend.c | 252 +++++++++---------- 46 files changed, 695 insertions(+), 815 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 7b3a5410d..08d4f7a53 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -278,8 +278,7 @@ int main( if ( arg.enableHeadRotation ) { /* sanity check */ - if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Head-rotation file file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -379,8 +378,7 @@ int main( if ( arg.renderConfigEnabled ) { /* sanity check */ - if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -1572,10 +1570,10 @@ static int16_t app_own_random( int16_t *seed ) *---------------------------------------------------------------------*/ static ivas_error initOnFirstGoodFrame( - IVAS_DEC_HANDLE hIvasDec, /* i/o: */ - const DecArguments arg, /* i : */ - const int16_t numInitialBadFrames, /* i : */ - const uint16_t numOutSamples, /* i : */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: */ + const DecArguments arg, /* i : */ + const int16_t numInitialBadFrames, /* i : */ + const uint16_t numOutSamples, /* i : */ int16_t *pFullDelayNumSamples, /* o : */ int16_t *pRemainingDelayNumSamples, /* o : */ int32_t *delayTimeScale, /* o : */ @@ -1584,7 +1582,7 @@ static ivas_error initOnFirstGoodFrame( MasaFileWriter **ppMasaWriter, /* o : */ IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS], /* o : */ int16_t *pNumOutChannels, /* o : */ - uint16_t *pNumObj /* o : */ + uint16_t *pNumObj /* o : */ ) { ivas_error error = IVAS_ERR_UNKNOWN; @@ -1617,12 +1615,12 @@ static ivas_error initOnFirstGoodFrame( return error; } - /* Open audio writer and write all previously skipped bad frames now that frame size is known */ - if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); - return error; - } + /* Open audio writer and write all previously skipped bad frames now that frame size is known */ + if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); + return error; + } int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); @@ -1631,18 +1629,18 @@ static ivas_error initOnFirstGoodFrame( { if ( *pRemainingDelayNumSamples < numOutSamples ) - { + { if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nOutput audio file writer error\n" ); - return error; - } - *pRemainingDelayNumSamples = 0; - } - else { - *pRemainingDelayNumSamples -= numOutSamples; + fprintf( stderr, "\nOutput audio file writer error\n" ); + return error; } + *pRemainingDelayNumSamples = 0; + } + else + { + *pRemainingDelayNumSamples -= numOutSamples; + } } free( zeroBuf ); @@ -1914,14 +1912,14 @@ static ivas_error decodeG192( { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < num_subframes; i++ ) + { + if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) { - if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) ); - goto cleanup; - } + fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) ); + goto cleanup; } + } for ( i = 0; i < num_subframes; i++ ) { @@ -2021,12 +2019,12 @@ static ivas_error decodeG192( if ( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, ( pcmBuf + nOutChannels * nSamplesRendered ), &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } - nSamplesRendered += nSamplesRendered_loop; - nSamplesToRender -= nSamplesRendered_loop; + { + fprintf( stderr, "\nError in IVAS_DEC_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + nSamplesRendered += nSamplesRendered_loop; + nSamplesToRender -= nSamplesRendered_loop; if ( needNewFrame ) { frame++; @@ -2075,19 +2073,19 @@ static ivas_error decodeG192( /* Write current frame */ if ( decodedGoodFrame ) { - if ( delayNumSamples < nOutSamples ) - { - if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nOutput audio file writer error\n" ); - goto cleanup; - } - delayNumSamples = 0; - } - else + if ( delayNumSamples < nOutSamples ) + { + if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) { - delayNumSamples -= nOutSamples; + fprintf( stderr, "\nOutput audio file writer error\n" ); + goto cleanup; } + delayNumSamples = 0; + } + else + { + delayNumSamples -= nOutSamples; + } } /* Write ISm metadata to external file(s) */ @@ -2320,11 +2318,11 @@ static ivas_error decodeG192( *------------------------------------------------------------------------------------------*/ memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); - goto cleanup; - } + if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); + goto cleanup; + } /*------------------------------------------------------------------------------------------* * Close files and deallocate resources @@ -2685,20 +2683,19 @@ static ivas_error decodeVoIP( { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - for ( i = 0; i < num_subframes; i++ ) + for ( i = 0; i < num_subframes; i++ ) + { + if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) { - if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), - RotationFileReader_getFilePath( headRotReader ) ); - goto cleanup; - } + fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), + RotationFileReader_getFilePath( headRotReader ) ); + goto cleanup; } + } for ( i = 0; i < num_subframes; i++ ) { - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i - ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; diff --git a/apps/renderer.c b/apps/renderer.c index 24967f2cd..11a3d7f6d 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -433,8 +433,7 @@ static int16_t getTotalNumInChannels( IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS], IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS], IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS], - IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] -) + IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] ) { int16_t totalNumInChannels = 0; int16_t i, numInputChannels; @@ -520,8 +519,7 @@ static void setupWithSingleFormatInput( CmdlnArgs args, char *audioFilePath, IsmPositionProvider *positionProvider, - MasaFileReader **masaReaders -) + MasaFileReader **masaReaders ) { /* With single-format input, inputFilePath is the path to input audio file. */ strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 ); @@ -580,8 +578,6 @@ static float dBToLin( } - - /*------------------------------------------------------------------------------------------* * main() * @@ -749,14 +745,14 @@ int main( } } - if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", audioFilePath ); - exit( -1 ); - } + if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", audioFilePath ); + exit( -1 ); + } int32_t inFileSampleRate = 0; - error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate ); + error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate ); switch ( error ) { @@ -786,12 +782,12 @@ int main( } int16_t inFileNumChannels = 0; - error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); - if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN ) - { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } + error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); + if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) ); if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) @@ -855,7 +851,6 @@ int main( fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); exit( -1 ); } - } if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK ) @@ -1091,11 +1086,11 @@ int main( } - if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath ); - exit( -1 ); - } + if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath ); + exit( -1 ); + } inBufferSize = frameSize_smpls * totalNumInChannels; outBufferSize = frameSize_smpls * numOutChannels; @@ -1136,12 +1131,12 @@ int main( num_in_channels = inBuffer.config.numChannels; const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0; - /* Read the input data */ - if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); - exit( -1 ); - } + /* Read the input data */ + if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); + exit( -1 ); + } if ( numSamplesRead == 0 && splitBinNeedsNewFrame ) { @@ -1366,12 +1361,11 @@ int main( } - - if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK ) - { + if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK ) + { fprintf( stderr, "Error in getting samples\n" ); - exit( -1 ); - } + exit( -1 ); + } int16_t num_out_channels; num_out_channels = outBuffer.config.numChannels; @@ -1400,19 +1394,19 @@ int main( zeroPad = delayNumSamples; } - if ( delayNumSamples * num_out_channels < outBufferSize ) - { - if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error writing audio file %s\n", args.outputFilePath ); - exit( -1 ); - } - delayNumSamples = 0; - } - else + if ( delayNumSamples * num_out_channels < outBufferSize ) + { + if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) { - delayNumSamples -= (int16_t) ( outBufferSize / num_out_channels ); + fprintf( stderr, "Error writing audio file %s\n", args.outputFilePath ); + exit( -1 ); } + delayNumSamples = 0; + } + else + { + delayNumSamples -= (int16_t) ( outBufferSize / num_out_channels ); + } /* Write MASA metadata for MASA outputs */ if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_MASA2 ) @@ -1517,23 +1511,23 @@ int main( } /* add zeros at the end to have equal length of synthesized signals */ - for ( zeroPadToWrite = zeroPad; zeroPadToWrite > frameSize_smpls; zeroPadToWrite -= frameSize_smpls ) - { - memset( outInt16Buffer, 0, outBufferSize * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, outBufferSize ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nOutput audio file writer error\n" ); - exit( -1 ); - } - } - - memset( outInt16Buffer, 0, zeroPadToWrite * outBuffer.config.numChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) + for ( zeroPadToWrite = zeroPad; zeroPadToWrite > frameSize_smpls; zeroPadToWrite -= frameSize_smpls ) + { + memset( outInt16Buffer, 0, outBufferSize * sizeof( int16_t ) ); + if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, outBufferSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); exit( -1 ); } - zeroPadToWrite = 0; + } + + memset( outInt16Buffer, 0, zeroPadToWrite * outBuffer.config.numChannels * sizeof( int16_t ) ); + if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nOutput audio file writer error\n" ); + exit( -1 ); + } + zeroPadToWrite = 0; if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) @@ -3270,29 +3264,28 @@ static void convertInputBuffer( const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, - float *floatBuffer -) + float *floatBuffer ) { int16_t chnl, smpl, i; i = 0; - for ( smpl = 0; smpl < numFloatSamplesPerChannel; ++smpl ) + for ( smpl = 0; smpl < numFloatSamplesPerChannel; ++smpl ) + { + for ( chnl = 0; chnl < numChannels; ++chnl ) { - for ( chnl = 0; chnl < numChannels; ++chnl ) + if ( i < numIntSamplesPerChannel ) { - if ( i < numIntSamplesPerChannel ) - { - floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = (float) intBuffer[i]; - } - else - { - floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = 0.f; - } - - ++i; + floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = (float) intBuffer[i]; } + else + { + floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = 0.f; + } + + ++i; } + } return; } @@ -3308,33 +3301,32 @@ static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, - int16_t *intBuffer -) + int16_t *intBuffer ) { int16_t chnl, smpl, i; float temp; i = 0; - for ( smpl = 0; smpl < numSamplesPerChannel; ++smpl ) + for ( smpl = 0; smpl < numSamplesPerChannel; ++smpl ) + { + for ( chnl = 0; chnl < numChannels; ++chnl ) { - for ( chnl = 0; chnl < numChannels; ++chnl ) + temp = floatBuffer[chnl * numSamplesPerChannel + smpl]; + temp = (float) floor( temp + 0.5f ); + if ( temp > IVAS_MAX16B_FLT ) { - temp = floatBuffer[chnl * numSamplesPerChannel + smpl]; - temp = (float) floor( temp + 0.5f ); - if ( temp > IVAS_MAX16B_FLT ) - { - temp = IVAS_MAX16B_FLT; - } - else if ( temp < IVAS_MIN16B_FLT ) - { - temp = IVAS_MIN16B_FLT; - } - intBuffer[i] = (int16_t) temp; - - ++i; + temp = IVAS_MAX16B_FLT; + } + else if ( temp < IVAS_MIN16B_FLT ) + { + temp = IVAS_MIN16B_FLT; } + intBuffer[i] = (int16_t) temp; + + ++i; } + } return; } diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 4870ff5d0..2152ca30a 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -195,7 +195,6 @@ typedef struct _IVAS_JBM_TRACE_DATA } IVAS_JBM_TRACE_DATA; - /*----------------------------------------------------------------------------------* * Renderer API structures and enums *----------------------------------------------------------------------------------*/ diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 73d9db9f4..0075e5106 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -51,9 +51,9 @@ /*! r: delay value in ns */ int32_t get_delay( - const int16_t enc_dec, /* i : encoder/decoder flag */ - const int32_t io_fs, /* i : input/output sampling frequency */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int16_t enc_dec, /* i : encoder/decoder flag */ + const int32_t io_fs, /* i : input/output sampling frequency */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */ ) { @@ -97,11 +97,11 @@ int32_t get_delay( { delay = IVAS_DEC_DELAY_NS; - if ( hCldfb != NULL ) - { - /* compensate for filterbank delay */ - delay += IVAS_FB_DEC_DELAY_NS; - } + if ( hCldfb != NULL ) + { + /* compensate for filterbank delay */ + delay += IVAS_FB_DEC_DELAY_NS; + } if ( ivas_format == MASA_FORMAT || ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_com/gs_bitallocation.c b/lib_com/gs_bitallocation.c index e30cf842e..7af7c1eb8 100644 --- a/lib_com/gs_bitallocation.c +++ b/lib_com/gs_bitallocation.c @@ -967,16 +967,16 @@ static float Find_bit_frac( } #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING -static Word16 Find_bit_alloc_IVAS_int( /* o : Number of band to encode */ - const Word32 core_brate, /* i : core bit rate */ - const Word16 GSC_IVAS_mode, /* i : GSC IVAS mode */ - const Word16 Diff_len, /* i : Length of the difference signal (before pure spectral)*/ - const Word16 nb_tot_bands_in, /* i : total number of band */ - const Word16 L_frame, /* i : frame length */ - Word16 *bit, /* i/o: Number of bit allowed for frequency quantization */ - Word16 *max_ener_band, /* i/o: Energy based sorted order */ - float *ener_vec_io, /* i/o: Energy per band order */ - float *bits_per_bands_o /* o : Number of bit allowed per allowed sub-band Q3 */ +static Word16 Find_bit_alloc_IVAS_int( /* o : Number of band to encode */ + const Word32 core_brate, /* i : core bit rate */ + const Word16 GSC_IVAS_mode, /* i : GSC IVAS mode */ + const Word16 Diff_len, /* i : Length of the difference signal (before pure spectral)*/ + const Word16 nb_tot_bands_in, /* i : total number of band */ + const Word16 L_frame, /* i : frame length */ + Word16 *bit, /* i/o: Number of bit allowed for frequency quantization */ + Word16 *max_ener_band, /* i/o: Energy based sorted order */ + float *ener_vec_io, /* i/o: Energy per band order */ + float *bits_per_bands_o /* o : Number of bit allowed per allowed sub-band Q3 */ ) { Word32 mp, mb, nb_bands_adj, bit_adj; @@ -1142,7 +1142,7 @@ static Word16 Find_bit_alloc_IVAS_int( /* o : Number of band to encode */ } /* Recompute the final bit distribution for HF */ - if( nb_tot_bands_loc > st_band ) + if ( nb_tot_bands_loc > st_band ) { /* This is not bit exact because of the precision lost */ /* mb = ( SWB_bit_budget * 2 / ( nb_tot_bands_loc - st_band ) ) - mp; */ @@ -1227,10 +1227,9 @@ static Word16 Find_bit_alloc_IVAS_int( /* o : Number of band to encode */ } /* Find normalized 1 / ToDivide */ -static Word16 Find_norm_inv( +static Word16 Find_norm_inv( const Word32 ToDivide, - Word16 *e_div -) + Word16 *e_div ) { Word16 d_tmp, e_tmp; @@ -1242,10 +1241,10 @@ static Word16 Find_norm_inv( return d_tmp; } -static Word16 maximum_fx( /* o : index of the maximum value in the input vector */ - const Word16 *vec_fx, /* i : input vector */ - const Word16 lvec_fx, /* i : length of input vector */ - Word16 *max_fx /* o : maximum value in the input vector */ +static Word16 maximum_fx( /* o : index of the maximum value in the input vector */ + const Word16 *vec_fx, /* i : input vector */ + const Word16 lvec_fx, /* i : length of input vector */ + Word16 *max_fx /* o : maximum value in the input vector */ ) { Word16 j, ind; diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index a490858c8..35d514f9b 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -162,10 +162,8 @@ ivas_error ivas_dirac_config( hConfig->dec_param_estim = FALSE; if ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) /* skip for MASA decoder */ { - if ( ( error = ivas_dirac_sba_config( hQMetaData, element_mode, ivas_total_brate, sba_order, hConfig->nbands - spar_dirac_split_band - , - ivas_format - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_sba_config( hQMetaData, element_mode, ivas_total_brate, sba_order, hConfig->nbands - spar_dirac_split_band, + ivas_format ) ) != IVAS_ERR_OK ) { return error; } @@ -322,10 +320,8 @@ void ivas_get_dirac_sba_max_md_bits( int16_t *bits_frame_nominal, int16_t *metadata_max_bits, int16_t *qmetadata_max_bit_req, - const int16_t nbands - , - IVAS_FORMAT ivas_format -) + const int16_t nbands, + IVAS_FORMAT ivas_format ) { if ( sba_total_brate <= IVAS_13k2 ) { @@ -402,8 +398,7 @@ ivas_error ivas_dirac_sba_config( const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int16_t nbands /* i : number of frequency bands */ , - IVAS_FORMAT ivas_format -) + IVAS_FORMAT ivas_format ) { int16_t nbands_coded; int16_t hodirac_flag; @@ -465,10 +460,8 @@ ivas_error ivas_dirac_sba_config( } } - ivas_get_dirac_sba_max_md_bits( sba_total_brate, &hQMetaData->bits_frame_nominal, &hQMetaData->metadata_max_bits, &hQMetaData->qmetadata_max_bit_req, hQMetaData->q_direction[0].cfg.nbands - , - ivas_format - ); + ivas_get_dirac_sba_max_md_bits( sba_total_brate, &hQMetaData->bits_frame_nominal, &hQMetaData->metadata_max_bits, &hQMetaData->qmetadata_max_bit_req, hQMetaData->q_direction[0].cfg.nbands, + ivas_format ); return error; } diff --git a/lib_com/prot.h b/lib_com/prot.h index f4114fd9a..8a674e982 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2301,14 +2301,14 @@ void amr_wb_enc_init( ); void pre_proc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t input_frame, /* i : frame length */ - float old_inp_12k8[], /* i/o: buffer of old input signal */ - float old_inp_16k[], /* i/o: buffer of old input signal @ 16kHz */ - float **inp, /* o : ptr. to inp. signal in the current frame*/ - float fr_bands[2 * NB_BANDS], /* i : energy in frequency bands */ - float *ener, /* o : residual energy from Levinson-Durbin */ - int16_t pitch_orig[3], /* o : open-loop pitch values for quantization */ + Encoder_State *st, /* i/o: encoder state structure */ + const int16_t input_frame, /* i : frame length */ + float old_inp_12k8[], /* i/o: buffer of old input signal */ + float old_inp_16k[], /* i/o: buffer of old input signal @ 16kHz */ + float **inp, /* o : ptr. to inp. signal in the current frame*/ + float fr_bands[2 * NB_BANDS], /* i : energy in frequency bands */ + float *ener, /* o : residual energy from Levinson-Durbin */ + int16_t pitch_orig[3], /* o : open-loop pitch values for quantization */ float A[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes */ float Aw[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes */ float epsP[M + 1], /* i/o: LP prediction errors */ diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index 09daa4ae9..cd63806c6 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -522,7 +522,7 @@ void addBassPostFilter( int16_t res_bpf_adapt( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ const float *bpf_error_signal_8k, /* i : BPF modification signal */ - float res_buf[STEREO_DFT_N_8k] /* i : residual buffer */ + float res_buf[STEREO_DFT_N_8k] /* i : residual buffer */ ) { float error_nrg; diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index baef6cd93..c6dfce0f5 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -60,7 +60,7 @@ static void ivas_binRenderer_filterModule( float CLDFB_real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : real part of LS signals */ float CLDFB_imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : imag part of LS signals */ const int16_t numTimeSlots, /* i : number of time slots to process */ - BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ + BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { int16_t bandIdx, k, chIdx, tapIdx; @@ -127,8 +127,7 @@ static ivas_error ivas_binRenderer_convModuleOpen( const int16_t renderer_type, const int16_t isLoudspeaker, const AUDIO_CONFIG input_config, - const HRTFS_FASTCONV_HANDLE hHrtf -) + const HRTFS_FASTCONV_HANDLE hHrtf ) { int16_t bandIdx, chIdx; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; @@ -884,8 +883,6 @@ static void ivas_binaural_obtain_DMX( } - - /*------------------------------------------------------------------------- * ivas_binRenderer_open() * @@ -1465,7 +1462,6 @@ void ivas_binaural_cldfb_sf( idx_in++; } } - } /* Implement binaural rendering */ @@ -1517,16 +1513,16 @@ void ivas_binaural_cldfb_sf( *-------------------------------------------------------------------------*/ void ivas_binRenderer( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ - const int16_t numTimeSlots, /* i : number of time slots to render */ + const int16_t numTimeSlots, /* i : number of time slots to render */ #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData, #endif float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ ) { int16_t chIdx, k; @@ -1611,5 +1607,3 @@ void ivas_binRenderer( pop_wmops(); return; } - - diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d93bc9dd3..c91aecdb7 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -55,7 +55,6 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_r static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); - /*-------------------------------------------------------------------* * ivas_dec_setup() * @@ -65,7 +64,7 @@ static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); ivas_error ivas_dec_setup( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { int16_t k, idx, num_bits_read; @@ -805,8 +804,7 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize Binaural Renderer configuration handle *--------------------------------------------------------------------*/ - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK ) { @@ -1069,10 +1067,8 @@ ivas_error ivas_init_decoder( } } - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) - , - st_ivas->ivas_format - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ), + st_ivas->ivas_format ) ) != IVAS_ERR_OK ) { return error; } @@ -1225,10 +1221,8 @@ ivas_error ivas_init_decoder( } } - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) - , - st_ivas->ivas_format - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ), + st_ivas->ivas_format ) ) != IVAS_ERR_OK ) { return error; } @@ -1693,13 +1687,13 @@ ivas_error ivas_init_decoder( } } - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -1733,28 +1727,28 @@ ivas_error ivas_init_decoder( st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; - if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) - { - granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); + if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) + { + granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ) != IVAS_ERR_OK ) { - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + return error; + } + } + else + { + granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) + { + return error; } + } } if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) @@ -1930,14 +1924,14 @@ ivas_error ivas_init_decoder( * Allocate floating-point output audio buffers *-----------------------------------------------------------------*/ - for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + for ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + { + /* note: these are intra-frame heap memories */ + if ( ( st_ivas->p_output_f[n] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) { - /* note: these are intra-frame heap memories */ - if ( ( st_ivas->p_output_f[n] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); - } + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); } + } for ( ; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { @@ -2700,8 +2694,7 @@ static ivas_error doSanityChecks_IVAS( if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { - if ( !( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) ) + if ( !( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { return IVAS_ERROR( IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED, "Wrong set-up: Head-rotation not supported in this configuration" ); } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index d7c0d4086..8f0291056 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -51,7 +51,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( const int16_t nchan_transport_old, /* i : last number of transport channels */ const ISM_MODE last_ism_mode, /* i : last ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { ivas_error error; @@ -171,8 +171,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* Deallocate the ParamISM struct */ ivas_param_ism_dec_close( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config ); - if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { /* close the parametric binaural renderer */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); @@ -227,8 +226,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } - if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { /* open the parametric binaural renderer */ if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -360,7 +358,7 @@ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { int32_t ivas_total_brate; diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index ee0b86682..485cd7e3d 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -578,63 +578,63 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hSpatParamRendCom = hSpatParamRendCom; - if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) - { - int16_t nchan_transport = st_ivas->nchan_transport; - int16_t nchan_full = 0; + if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) + { + int16_t nchan_transport = st_ivas->nchan_transport; + int16_t nchan_full = 0; - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + nchan_full = nchan_transport; + hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; + hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + } + else + { + int16_t n_slots_to_alloc; + if ( st_ivas->hDecoderConfig->Opt_tsm == 1 ) { - nchan_full = nchan_transport; - hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; - hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + n_slots_to_alloc = MAX_JBM_CLDFB_TIMESLOTS; } else { - int16_t n_slots_to_alloc; - if ( st_ivas->hDecoderConfig->Opt_tsm == 1 ) - { - n_slots_to_alloc = MAX_JBM_CLDFB_TIMESLOTS; - } - else - { - n_slots_to_alloc = CLDFB_SLOTS_PER_SUBFRAME * MAX_PARAM_SPATIAL_SUBFRAMES; - } - if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + n_slots_to_alloc = CLDFB_SLOTS_PER_SUBFRAME * MAX_PARAM_SPATIAL_SUBFRAMES; + } + if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); - } - set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); + } + set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); - if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); - } - set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); + if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) ); } + set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands ); + } - if ( st_ivas->hTcBuffer == NULL ) + if ( st_ivas->hTcBuffer == NULL ) + { + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) { - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } } - else + } + else + { + hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; + hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + if ( st_ivas->hTcBuffer == NULL ) { - hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; - hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; - if ( st_ivas->hTcBuffer == NULL ) + int16_t nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out; + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) { - int16_t nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out; - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } } + } pop_wmops(); return error; diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index ab922db4c..018727ba2 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -396,9 +396,9 @@ void ivas_omasa_separate_object_renderer_close( *-------------------------------------------------------------------------*/ void ivas_omasa_separate_object_render_jbm( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const uint16_t nSamplesRendered, /* i : number of samples rendered */ - float input_f_in[][L_FRAME48k], /* i : separated object signal */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const uint16_t nSamplesRendered, /* i : number of samples rendered */ + float input_f_in[][L_FRAME48k], /* i : separated object signal */ float *output_f[], /* o : rendered time signal */ const int16_t subframes_rendered, /* i : number of subframes rendered */ const int16_t slots_rendered /* i : number of CLDFB slots rendered */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index fbebfd225..884ebd0fc 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -842,12 +842,11 @@ void ivas_jbm_dec_feed_tc_to_renderer( /* delay the objects here for all renderers where it is needed */ if ( - st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || - st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || - st_ivas->renderer_type == RENDERER_OSBA_AMBI || - st_ivas->renderer_type == RENDERER_OSBA_LS || - st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL - ) + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || + st_ivas->renderer_type == RENDERER_OSBA_AMBI || + st_ivas->renderer_type == RENDERER_OSBA_LS || + st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { @@ -922,7 +921,7 @@ ivas_error ivas_jbm_dec_render( const uint16_t nSamplesAsked, /* i : number of samples wanted */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { int16_t n, nchan_out; @@ -1054,10 +1053,10 @@ ivas_error ivas_jbm_dec_render( /* Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { @@ -1247,11 +1246,11 @@ ivas_error ivas_jbm_dec_render( &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : p_tc, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } + { + return error; + } - ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -1264,12 +1263,12 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) + { + return error; + } - ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); } } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) @@ -1294,12 +1293,12 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - if ( ( error = ivas_td_binaural_renderer( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_td_binaural_renderer( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) + { + return error; + } - ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -1389,9 +1388,9 @@ ivas_error ivas_jbm_dec_render( } #ifdef DEBUGGING - st_ivas->noClipping += + st_ivas->noClipping += #endif - ivas_syn_output( p_output, *nSamplesRendered, nchan_out, data ); + ivas_syn_output( p_output, *nSamplesRendered, nchan_out, data ); *nSamplesAvailableNext = st_ivas->hTcBuffer->n_samples_available; @@ -1416,7 +1415,7 @@ ivas_error ivas_jbm_dec_flush_renderer( const MC_MODE mc_mode_old, /* i : old MC mode */ const ISM_MODE ism_mode_old, /* i : old ISM mode */ uint16_t *nSamplesRendered, /* o : number of samples flushed */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { ivas_error error; @@ -1635,10 +1634,10 @@ ivas_error ivas_jbm_dec_flush_renderer( } #ifdef DEBUGGING - st_ivas->noClipping += + st_ivas->noClipping += #endif - ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, - data ); + ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, + data ); return IVAS_ERR_OK; diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index f31a8ef5d..b91f88425 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -354,13 +354,13 @@ ivas_error ivas_mc_paramupmix_dec_open( hMCParamUpmix->free_param_interpolator = 0; hMCParamUpmix->param_interpolator = NULL; - if ( ( hMCParamUpmix->param_interpolator = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); - } - hMCParamUpmix->free_param_interpolator = 1; + if ( ( hMCParamUpmix->param_interpolator = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); + } + hMCParamUpmix->free_param_interpolator = 1; - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); if ( st_ivas->hTcBuffer == NULL ) { @@ -630,7 +630,7 @@ static void ps_pred_process_sf( static void ivas_mc_paramupmix_dec_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output_f[MAX_OUTPUT_CHANNELS] /* i/o: synthesized core-coder transport channels */ ) { diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index f583e635f..55750ed95 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -645,7 +645,7 @@ ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx, /* i : LS config. index */ uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { AUDIO_CONFIG signaled_config; @@ -697,7 +697,7 @@ ivas_error ivas_mc_dec_config( static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; @@ -755,42 +755,42 @@ static ivas_error ivas_mc_dec_reconfig( /* side effect of the renderer selection can be a changed internal config */ ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); - /* transfer subframe info from DirAC or ParamMC to central tc buffer */ - if ( last_mc_mode == MC_MODE_PARAMMC ) - { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hParamMC->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hParamMC->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hParamMC->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; - mvs2s( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } - else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->hSpatParamRendCom != NULL ) - { - st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; - st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; - st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; - st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; - mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } + /* transfer subframe info from DirAC or ParamMC to central tc buffer */ + if ( last_mc_mode == MC_MODE_PARAMMC ) + { + st_ivas->hTcBuffer->nb_subframes = st_ivas->hParamMC->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hParamMC->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hParamMC->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hParamMC->slots_rendered; + mvs2s( st_ivas->hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + else if ( last_mc_mode == MC_MODE_MCMASA && st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } - /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv - render what still fits in the new granularity */ - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); - if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { + /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv + render what still fits in the new granularity */ + tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); + if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) + { if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } + { + return error; } - /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ - else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) + } + /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ + else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) + { + if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } + } if ( st_ivas->mc_mode == MC_MODE_MCT ) { @@ -1157,8 +1157,7 @@ static ivas_error ivas_mc_dec_reconfig( output_config = st_ivas->hDecoderConfig->output_config; /* binaural renderers*/ - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { /* remove unneeded binaural renderers */ if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) @@ -1334,12 +1333,12 @@ static ivas_error ivas_mc_dec_reconfig( * floating-point output audio buffers *-----------------------------------------------------------------*/ - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); - if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } return error; } diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 0b13c274d..36ff917fa 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -285,8 +285,8 @@ static void dec_prm_tcx_spec( *-----------------------------------------------------------------*/ void ivas_mdct_dec_side_bits_frame_channel( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */ Decoder_State *st0, /* i : pointer to bitstream handle */ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ @@ -874,7 +874,6 @@ void ivas_mdct_core_reconstruct( set_f( &st->hTcxDec->syn_Overl_TDAC[0], 0.f, L_frame[ch] / 2 ); set_f( &st->hTcxDec->syn_Overl_TDACFB[0], 0.f, L_frameTCX[ch] / 2 ); #endif - } } diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 4f3300572..6e25ef7e5 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -99,7 +99,6 @@ ivas_error ivas_td_binaural_renderer( } return ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hCombinedOrientationData, ism_md_subframe_update, output, output_frame, MAX_PARAM_SPATIAL_SUBFRAMES ); - } @@ -220,8 +219,7 @@ ivas_error ivas_td_binaural_renderer_sf( if ( ( error = TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] : 0, ( st_ivas->hCombinedOrientationData != NULL ) ? &st_ivas->hCombinedOrientationData->Quaternions[st_ivas->hCombinedOrientationData->subframe_idx] : NULL, - ( st_ivas->hCombinedOrientationData != NULL ) ? &st_ivas->hCombinedOrientationData->listenerPos[st_ivas->hCombinedOrientationData->subframe_idx] : NULL - ) ) != IVAS_ERR_OK ) + ( st_ivas->hCombinedOrientationData != NULL ) ? &st_ivas->hCombinedOrientationData->listenerPos[st_ivas->hCombinedOrientationData->subframe_idx] : NULL ) ) != IVAS_ERR_OK ) { return error; } @@ -268,5 +266,3 @@ ivas_error ivas_td_binaural_renderer_sf( return IVAS_ERR_OK; } - - diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index ec200ca86..0c26dc605 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -152,7 +152,7 @@ void ivas_omasa_data_close( ivas_error ivas_omasa_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { int16_t k, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD; @@ -398,11 +398,11 @@ ivas_error ivas_omasa_dec_config( * floating-point output audio buffers *-----------------------------------------------------------------*/ - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); - if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) - { - return error; - } + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); + if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } } diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index d05bf0a46..e88f68b0d 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -151,20 +151,19 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( } + if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK ) - { - return error; - } - - for ( n = 0; n < BINAURAL_CHANNELS; n++ ) + for ( n = 0; n < BINAURAL_CHANNELS; n++ ) + { + int16_t i; + for ( i = 0; i < nSamplesAsked; i++ ) { - int16_t i; - for ( i = 0; i < nSamplesAsked; i++ ) - { - output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; - } + output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; } + } return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index c273a8948..dcca65963 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -76,8 +76,7 @@ void ivas_renderer_select( st_ivas->hCombinedOrientationData->shd_rot_max_order = -1; } - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( st_ivas->ivas_format == ISM_FORMAT ) { @@ -94,8 +93,7 @@ void ivas_renderer_select( } else /* ISM_MODE_DISC */ { - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef DEBUGGING if ( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) @@ -143,8 +141,7 @@ void ivas_renderer_select( { *internal_config = IVAS_AUDIO_CONFIG_HOA3; - if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { *renderer_type = RENDERER_BINAURAL_FASTCONV; } diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 816425197..414bef715 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -886,14 +886,14 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( #ifdef DEBUG_MODE_QMETADATA bits_diff_sum = #endif - ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[0] ) ); + ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[0] ) ); if ( hQMetaData->no_directions == 2 ) { #ifdef DEBUG_MODE_QMETADATA bits_diff_sum += #endif - ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[1] ) ); + ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[1] ) ); } @@ -986,7 +986,7 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( #ifdef DEBUG_MODE_QMETADATA bits_sur_coherence = #endif - read_surround_coherence_hr( bitstream, index, hQMetaData ); + read_surround_coherence_hr( bitstream, index, hQMetaData ); } else { @@ -4433,7 +4433,7 @@ void ivas_omasa_decode_masa_to_total( { masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[0][j]; #ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL - int_tmp = (int32_t) ( MASA2TOTAL_PREC_INV_THRESHOLD * masa_to_total_energy_ratio[i][j] ); + int_tmp = (int32_t) ( MASA2TOTAL_PREC_INV_THRESHOLD * masa_to_total_energy_ratio[i][j] ); masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA2TOTAL_PREC_THRESHOLD ); #endif } diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index 77e0fd9b1..16655db6c 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -104,7 +104,6 @@ extern const float dirac_dithering_ele_scale[DIRAC_DIFFUSE_LEVELS]; extern const float dmxmtx_table[BINAURAL_CHANNELS][11]; - /*----------------------------------------------------------------------* * MC ParamUpmix ROM tables *-----------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 774444dd3..a0ec2a888 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -103,7 +103,7 @@ void ivas_sba_set_cna_cng_flag( ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ uint16_t *nSamplesFlushed, /* o : number of samples flushed */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { int16_t nchan_transport_old, nSCE_old, nCPE_old, nchan_hp20_old; @@ -185,8 +185,7 @@ ivas_error ivas_sba_dec_reconfigure( } else { - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { renderer_type_new = RENDERER_BINAURAL_FASTCONV; } @@ -373,10 +372,8 @@ ivas_error ivas_sba_dec_reconfigure( ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer ); } - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) - , - st_ivas->ivas_format - ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ), + st_ivas->ivas_format ) ) != IVAS_ERR_OK ) { return error; } @@ -643,12 +640,12 @@ ivas_error ivas_sba_dec_reconfigure( * floating-point output audio buffers *-----------------------------------------------------------------*/ - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) + { + return error; + } return error; } diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 3d06dac2f..9bb16732d 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -340,7 +340,6 @@ int16_t ivas_sba_remapTCs( } - /*-------------------------------------------------------------------------* * ivas_ism2sba_sf() * diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index e9631c550..ac6432560 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1804,8 +1804,7 @@ void ivas_spar_dec_upmixer_sf( } else { - if ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) ) && + if ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) && !( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 2231ac14a..8c9556605 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -83,8 +83,7 @@ static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decode static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); -static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t sba_inactive_mode -); +static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, int16_t *nB, int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, const int16_t sba_inactive_mode ); /*------------------------------------------------------------------------- @@ -766,8 +765,7 @@ void ivas_spar_md_dec_process( } ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, - st_ivas->hQMetaData->sba_inactive_mode - ); + st_ivas->hQMetaData->sba_inactive_mode ); assert( nB == hMdDec->spar_md.num_bands ); assert( bw == 1 ); @@ -1528,8 +1526,7 @@ static void ivas_spar_dec_parse_md_bs( int16_t *bands_bw, int16_t *dtx_vad, const int32_t ivas_total_brate, - const int16_t sba_inactive_mode -) + const int16_t sba_inactive_mode ) { int16_t i, j, k, num_bands; int16_t ii, jj, ndec, ndm; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 9a7738aa6..9babba303 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -910,16 +910,16 @@ typedef struct ivas_masa_ism_data_structure typedef struct decoder_tc_buffer_structure { - float *tc_buffer; /* the buffer itself */ + float *tc_buffer; /* the buffer itself */ float *tc[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc */ // VE2SB: TBV - TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ - int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ - int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ - int16_t nchan_buffer_full; /* number of channels to be fully buffered */ - int16_t n_samples_available; /* samples still available for rendering in the current frame */ - int16_t n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ - int16_t n_samples_rendered; /* samples already rendered in the current frame */ - int16_t n_samples_granularity; /* render granularity */ + TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ + int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ + int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ + int16_t nchan_buffer_full; /* number of channels to be fully buffered */ + int16_t n_samples_available; /* samples still available for rendering in the current frame */ + int16_t n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ + int16_t n_samples_rendered; /* samples already rendered in the current frame */ + int16_t n_samples_granularity; /* render granularity */ int16_t n_samples_flushed; int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t nb_subframes; @@ -951,8 +951,6 @@ typedef struct jbm_metadata_structure } JBM_METADATA, *JBM_METADATA_HANDLE; - - /*----------------------------------------------------------------------------------* * Decoder configuration structure *----------------------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 558ef6e31..d187220da 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1733,9 +1733,9 @@ void stereo_dft_dec( *-------------------------------------------------------------------------*/ void stereo_dft_dec_res( - CPE_DEC_HANDLE hCPE, /* i/o: decoder CPE handle */ + CPE_DEC_HANDLE hCPE, /* i/o: decoder CPE handle */ float res_buf[STEREO_DFT_N_8k], /* i : residual buffer */ - float *output /* o : output */ + float *output /* o : output */ ) { int16_t i; @@ -1873,10 +1873,10 @@ void stereo_dft_dec_read_BS( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder stereo handle */ const int16_t bwidth, /* i : bandwidth */ const int16_t output_frame, /* i : output frame length */ - float res_buf[STEREO_DFT_N_8k], /* o : residual buffer */ - int16_t *nb_bits, /* o : number of bits read */ - float *coh, /* i/o: Coherence */ - const int16_t ivas_format /* i : ivas format */ + float res_buf[STEREO_DFT_N_8k], /* o : residual buffer */ + int16_t *nb_bits, /* o : number of bits read */ + float *coh, /* i/o: Coherence */ + const int16_t ivas_format /* i : ivas format */ ) { int16_t b, N_div, nbands; diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index bd0fa38e0..0eda835d8 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -209,18 +209,18 @@ void stereo_decoder_tcx( STEREO_MDCT_DEC_DATA *hStereoMdct, /* i/o: MDCT stereo decoder structure */ int16_t ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ float *spec_r_0[NB_DIV], /* i/o: spectrum right channel */ - float *spec_l[], /* i/o: spectrum left channel [NB_DIV][N] */ - float *spec_r[], /* i/o: spectrum right channel [NB_DIV][N] */ - const int16_t mdct_stereo_mode[], /* i : stereo mode (FB/band wise MS, dual mono */ - const int16_t core_l, /* i : core for left channel (TCX20/TCX10) */ - const int16_t core_r, /* i : core for right channel (TCX20/TCX10) */ - const int16_t igf, /* i : flag for IGF activity */ - const int16_t L_frameTCX_l, /* i : TCX frame length of left channel */ - const int16_t L_frameTCX_r, /* i : TCX frame length of right channel */ - const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ - const int16_t last_core_l, /* i : last core for left channel */ - const int16_t last_core_r, /* i : last core for right channel */ - const int16_t tmp_plc_upmix /* i : indicates temp upmix for PLC decision */ + float *spec_l[], /* i/o: spectrum left channel [NB_DIV][N] */ + float *spec_r[], /* i/o: spectrum right channel [NB_DIV][N] */ + const int16_t mdct_stereo_mode[], /* i : stereo mode (FB/band wise MS, dual mono */ + const int16_t core_l, /* i : core for left channel (TCX20/TCX10) */ + const int16_t core_r, /* i : core for right channel (TCX20/TCX10) */ + const int16_t igf, /* i : flag for IGF activity */ + const int16_t L_frameTCX_l, /* i : TCX frame length of left channel */ + const int16_t L_frameTCX_r, /* i : TCX frame length of right channel */ + const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ + const int16_t last_core_l, /* i : last core for left channel */ + const int16_t last_core_r, /* i : last core for right channel */ + const int16_t tmp_plc_upmix /* i : indicates temp upmix for PLC decision */ ) { int16_t i, k, sfb, nSubframes; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 000ed618a..b88bfc25f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -347,11 +347,11 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const uint32_t sampleRate, /* i : output sampling frequency */ - const AUDIO_CONFIG outputConfig, /* i : output configuration */ - const int16_t tsmEnabled, /* i : enable time scale modification */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const uint32_t sampleRate, /* i : output sampling frequency */ + const AUDIO_CONFIG outputConfig, /* i : output configuration */ + const int16_t tsmEnabled, /* i : enable time scale modification */ + const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -458,7 +458,6 @@ ivas_error IVAS_DEC_Configure( } - /*---------------------------------------------------------------------* * get_render_framesize_ms( ) * @@ -780,9 +779,9 @@ ivas_error IVAS_DEC_FeedFrame_Serial( ivas_error IVAS_DEC_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */ - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ - bool *needNewFrame /* o :indication that the decoder needs a new frame */ + int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ + int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ + bool *needNewFrame /* o :indication that the decoder needs a new frame */ ) { ivas_error error; @@ -938,8 +937,6 @@ ivas_error IVAS_DEC_GetSamples( } - - /*---------------------------------------------------------------------* * IVAS_DEC_Setup( ) * @@ -952,7 +949,7 @@ static ivas_error IVAS_DEC_Setup( uint8_t *nTransportChannels, /* o : number of decoded transport PCM channels */ uint8_t *nOutChannels, /* o : number of decoded out channels (PCM or CLDFB) */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { ivas_error error; @@ -1094,8 +1091,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples( const uint16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the renerer pipeline */ - int16_t *pcmBuf -) + int16_t *pcmBuf ) { Decoder_Struct *st_ivas; ivas_error error; @@ -1386,7 +1382,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ IVAS_VECTOR3 Pos, /* i : listener position */ - const int16_t subframe_idx /* i : subframe index */ + const int16_t subframe_idx /* i : subframe index */ ) { HEAD_TRACK_DATA_HANDLE hHeadTrackData; @@ -2104,9 +2100,9 @@ ivas_error IVAS_DEC_TSM_SetQuality( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_VoIP_GetSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ + int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ const uint32_t systemTimestamp_ms /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE , @@ -2291,8 +2287,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples( ivas_error IVAS_DEC_Flush( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - int16_t *nSamplesFlushed /* o : number of samples flushed */ + int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ + int16_t *nSamplesFlushed /* o : number of samples flushed */ ) { ivas_error error; @@ -3216,7 +3212,3 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( return IVAS_ERR_OK; } - - - - diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index fe75a6aae..443f9ef6e 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -75,7 +75,6 @@ typedef enum _IVAS_DEC_FORCED_REND_MODE #endif - /* bitstream formats that can be consumed */ typedef enum _IVAS_DEC_BS_FORMAT { diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index d991af80b..e9c3d7886 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -379,7 +379,7 @@ ivas_error acelp_core_enc( * After inactive period, use the most up-to-date ISPs *-----------------------------------------------------------------*/ #ifdef NON_BE_FIX_807_MASA_DTX_BRSW - if ( st->hDtxEnc != NULL && ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 )) + if ( st->hDtxEnc != NULL && ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 ) ) #else if ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 ) #endif diff --git a/lib_enc/cod_tcx.c b/lib_enc/cod_tcx.c index e2efb2c26..4b6e9f9ee 100644 --- a/lib_enc/cod_tcx.c +++ b/lib_enc/cod_tcx.c @@ -109,13 +109,13 @@ void HBAutocorrelation( #define TNS_GAIN_THRESHOLD_FOR_WHITE ( 3.0f ) void TNSAnalysisStereo( - Encoder_State **sts, /* i : encoder state handle */ + Encoder_State **sts, /* i : encoder state handle */ float *mdst_spectrum[CPE_CHANNELS][NB_DIV], /* o : MDST spectrum */ - const int16_t bWhitenedDomain, /* i : whitened domain flag */ - int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : number of tns parameters put into prm */ - int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : number of tns bits in the frame */ - int16_t param_core[][NB_DIV * NPRM_DIV], /* o : TNS parameters */ - const int16_t mct_on /* i : flag mct block (1) or stereo (0) */ + const int16_t bWhitenedDomain, /* i : whitened domain flag */ + int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : number of tns parameters put into prm */ + int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : number of tns bits in the frame */ + int16_t param_core[][NB_DIV * NPRM_DIV], /* o : TNS parameters */ + const int16_t mct_on /* i : flag mct block (1) or stereo (0) */ ) { int16_t ch, k, L_spec, L_frame, nSubframes, iFilter; diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index 0398876b9..a515fd03b 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -95,7 +95,7 @@ ivas_error evs_enc( int16_t padBits; float realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; /* real buffer */ float imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; /* imag buffer */ - int16_t pitch_orig[3]; /* original open-loop pitch values that might be altered in core_acelp_tcx20_switching() within MODE2 */ + int16_t pitch_orig[3]; /* original open-loop pitch values that might be altered in core_acelp_tcx20_switching() within MODE2 */ ivas_error error; error = IVAS_ERR_OK; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 9340d34cb..8a25b8d79 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -360,11 +360,11 @@ ivas_error ivas_cpe_enc( hCPE->hStereoMdct->fDualMono = 0; hCPE->hStereoMdct->fMSstereo = 0; - if ( hCPE->hStereoMdct->mdct_stereo_mode_cmdl == SMDCT_FORCE_LR ) + if ( hCPE->hStereoMdct->mdct_stereo_mode_cmdl == SMDCT_FORCE_LR ) { hCPE->hStereoMdct->fDualMono = 1; } - else if ( hCPE->hStereoMdct->mdct_stereo_mode_cmdl == SMDCT_FORCE_MS ) + else if ( hCPE->hStereoMdct->mdct_stereo_mode_cmdl == SMDCT_FORCE_MS ) { hCPE->hStereoMdct->fMSstereo = 1; } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index b08bb9285..9a4be19f4 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -754,7 +754,7 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += #endif - write_2dir_info( hMetaData, hQMetaData->twoDirBands, hQMetaData->q_direction[0].cfg.nbands, hQMetaData->numTwoDirBands ); + write_2dir_info( hMetaData, hQMetaData->twoDirBands, hQMetaData->q_direction[0].cfg.nbands, hQMetaData->numTwoDirBands ); d = 0; for ( i = hQMetaData->q_direction[1].cfg.start_band; i < hQMetaData->q_direction[1].cfg.nbands; i++ ) { diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index d6ddbc2b6..5301559d2 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -53,14 +53,14 @@ *--------------------------------------------------------------------*/ void pre_proc( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t input_frame, /* i : frame length */ - float old_inp_12k8[], /* i/o: buffer of old input signal */ - float old_inp_16k[], /* i/o: buffer of old input signal @ 16kHz */ - float **inp, /* o : ptr. to inp. signal in the current frame*/ - float fr_bands[2 * NB_BANDS], /* i : energy in frequency bands */ - float *ener, /* o : residual energy from Levinson-Durbin */ - int16_t pitch_orig[3], /* o : open-loop pitch values for quantization */ + Encoder_State *st, /* i/o: encoder state structure */ + const int16_t input_frame, /* i : frame length */ + float old_inp_12k8[], /* i/o: buffer of old input signal */ + float old_inp_16k[], /* i/o: buffer of old input signal @ 16kHz */ + float **inp, /* o : ptr. to inp. signal in the current frame*/ + float fr_bands[2 * NB_BANDS], /* i : energy in frequency bands */ + float *ener, /* o : residual energy from Levinson-Durbin */ + int16_t pitch_orig[3], /* o : open-loop pitch values for quantization */ float A[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes */ float Aw[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes */ float epsP[M + 1], /* i/o: LP prediction errors */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 6a407f81b..a17f6ecbf 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -179,8 +179,7 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" ); } - if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB - ) + if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported output type in Crend" ); } @@ -1122,8 +1121,7 @@ static ivas_error ivas_er_init_handle( *------------------------------------------------------------------------*/ ivas_error ivas_rend_initCrendWrapper( - CREND_WRAPPER_HANDLE *pCrend -) + CREND_WRAPPER_HANDLE *pCrend ) { int16_t i; CREND_HANDLE hCrend; @@ -1179,8 +1177,6 @@ ivas_error ivas_rend_initCrendWrapper( } - - /*------------------------------------------------------------------------- * ivas_rend_openCrend() * @@ -1193,8 +1189,7 @@ ivas_error ivas_rend_openCrend( const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, HRTFS_CREND_HANDLE hSetOfHRTF, - const int32_t output_Fs -) + const int32_t output_Fs ) { int16_t i, subframe_length; int16_t max_total_ir_len; @@ -1351,8 +1346,7 @@ ivas_error ivas_rend_openCrend( *------------------------------------------------------------------------*/ void ivas_rend_closeCrend( - CREND_WRAPPER_HANDLE *pCrend -) + CREND_WRAPPER_HANDLE *pCrend ) { int16_t i; CREND_HANDLE hCrend; @@ -1451,8 +1445,6 @@ void ivas_rend_closeCrend( } - - /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crendConvolver() * @@ -1466,8 +1458,7 @@ static ivas_error ivas_rend_crendConvolver( float *pcm_in[], float *pcm_out[], const int32_t output_Fs, - const int16_t i_ts -) + const int16_t i_ts ) { int16_t i, j, k, m; int16_t subframe_length, idx_in; @@ -1902,6 +1893,3 @@ ivas_error ivas_rend_crendProcessSubframe( return IVAS_ERR_OK; } - - - diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 95d25965b..f3fa0a604 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -141,132 +141,132 @@ ivas_error ivas_dirac_dec_init_binaural_data( float frequency_axis[CLDFB_NO_CHANNELS_MAX]; hDiracDecBin = st_ivas->hDiracDecBin; - if ( hDiracDecBin == NULL ) + if ( hDiracDecBin == NULL ) + { + if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) { - if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); - } - - hDiracDecBin->hTdDecorr = NULL; - hDiracDecBin->hReverb = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); } - output_Fs = st_ivas->hDecoderConfig->output_Fs; - nBins = st_ivas->hSpatParamRendCom->num_freq_bands; - renderer_type = st_ivas->renderer_type; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) - { - set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); - } - - for ( k = 0; k < BINAURAL_CHANNELS; k++ ) - { - set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); - } - set_zero( hDiracDecBin->ChEnePrev[j], nBins ); - set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); - } - set_zero( hDiracDecBin->ChCrossRePrev, nBins ); - set_zero( hDiracDecBin->ChCrossImPrev, nBins ); - set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); - set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; + hDiracDecBin->hTdDecorr = NULL; + hDiracDecBin->hReverb = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; + } + output_Fs = st_ivas->hDecoderConfig->output_Fs; + nBins = st_ivas->hSpatParamRendCom->num_freq_bands; + renderer_type = st_ivas->renderer_type; - for ( bin = 0; bin < nBins; bin++ ) + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) { - binCenterFreq = ( (float) bin + CLDFB_HALF_BIN_FREQUENCY_OFFSET ) / (float) nBins * ( (float) output_Fs / 2.0f ); - /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ - tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); - hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); } - for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) + for ( k = 0; k < BINAURAL_CHANNELS; k++ ) { - hDiracDecBin->diffuseFieldCoherenceX[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; - hDiracDecBin->diffuseFieldCoherenceY[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; - hDiracDecBin->diffuseFieldCoherenceZ[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; + set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); } + set_zero( hDiracDecBin->ChEnePrev[j], nBins ); + set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); + } + set_zero( hDiracDecBin->ChCrossRePrev, nBins ); + set_zero( hDiracDecBin->ChCrossImPrev, nBins ); + set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); + set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; - if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ - { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - } - else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ - { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); - /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ - if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || - ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) - { - ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); - } + for ( bin = 0; bin < nBins; bin++ ) + { + binCenterFreq = ( (float) bin + CLDFB_HALF_BIN_FREQUENCY_OFFSET ) / (float) nBins * ( (float) output_Fs / 2.0f ); + /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ + tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); + hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + } - if ( hDiracDecBin->hReverb == NULL ) - { - /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; - } - else /* Not valid renderer type for this renderer */ - { - assert( false ); - } + for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) + { + hDiracDecBin->diffuseFieldCoherenceX[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; + hDiracDecBin->diffuseFieldCoherenceY[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; + hDiracDecBin->diffuseFieldCoherenceZ[bin] = hDiracDecBin->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; + } - hDiracDecBin->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ + if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + } + else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ + { + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); - if ( hDiracDecBin->hTdDecorr == NULL ) + /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ + if ( hDiracDecBin->hReverb != NULL && ( ( hDiracDecBin->hReverb->numBins != nBins ) || + ( hDiracDecBin->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) { - hDiracDecBin->useTdDecorr = 0; + ivas_binaural_reverb_close( &( hDiracDecBin->hReverb ) ); } - if ( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) + if ( hDiracDecBin->hReverb == NULL ) { - ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); - } - - if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ + if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } + } + } + else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; + } + else /* Not valid renderer type for this renderer */ + { + assert( false ); + } - if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) - { - ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - } + hDiracDecBin->hDiffuseDist = NULL; /* Memory is allocated from stack during runtime when needed */ - hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + if ( hDiracDecBin->hTdDecorr == NULL ) + { + hDiracDecBin->useTdDecorr = 0; + } + + if ( hDiracDecBin->h_freq_domain_decorr_ap_params != NULL ) + { + ivas_dirac_dec_decorr_close( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); + } + + if ( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( !hDiracDecBin->useTdDecorr && !( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) + { + ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); st_ivas->hDiracDecBin = hDiracDecBin; @@ -708,7 +708,6 @@ static void ivas_dirac_dec_binaural_internal( } - nchanSeparateChannels = 0; if ( config_data.separateCenterChannelRendering || ( st_ivas->ivas_format == MASA_ISM_FORMAT && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) ) ) { @@ -1496,8 +1495,7 @@ static void ivas_dirac_dec_binaural_process_output( const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, - const int16_t subframe -) + const int16_t subframe ) { int16_t slot, bin, chA, chB; int16_t nBins; @@ -1518,7 +1516,7 @@ static void ivas_dirac_dec_binaural_process_output( if ( processReverb ) { /* Process second / room effect part of binaural output when needed */ - ivas_binaural_reverb_processSubframe( hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); + ivas_binaural_reverb_processSubframe( hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); } interpVal = 0.0f; @@ -1527,7 +1525,7 @@ static void ivas_dirac_dec_binaural_process_output( interpVal += 1.0f / (float) nSlots; if ( !hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) { - ivas_dirac_dec_decorrelate_slot( hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); + ivas_dirac_dec_decorrelate_slot( hDiracDecBin, nBins, slot, inRe, inIm, decSlotRe, decSlotIm ); } for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) @@ -2701,7 +2699,6 @@ static void ivas_masa_ext_rend_parambin_internal( max_band_decorr = hDiracDecBin->h_freq_domain_decorr_ap_params->max_band_decorr; - ivas_dirac_dec_binaural_determine_processing_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, max_band_decorr, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, 0, NULL ); @@ -2721,7 +2718,7 @@ void ivas_masa_ext_rend_parambin_render( MASA_EXT_REND_HANDLE hMasaExtRend, /* i/o: MASA ext rend structure */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined orientation handle */ float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t num_subframes ) /* i : number of subframes to render */ + const int16_t num_subframes ) /* i : number of subframes to render */ { int16_t subframe; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index b80732620..a5db79929 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -277,18 +277,18 @@ void ivas_td_binaural_close( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_unwrap( - const REVERB_HANDLE hReverb, /* i : Reverberator handle */ - const AUDIO_CONFIG transport_config, /* i : Transport configuration */ - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ - const int16_t num_src, /* i : number of sources to render */ - const int16_t lfe_idx, /* i : LFE channel index */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle */ + const int16_t num_src, /* i : number of sources to render */ + const int16_t lfe_idx, /* i : LFE channel index */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + ISM_METADATA_HANDLE *hIsmMetaData, /* i : ISM metadata handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientaton data handle */ - const int16_t ism_md_subframe_update, /* i : Number of subframes to delay ism metadata to sync with audio */ - float *output[], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame, /* i : output frame length */ - const int16_t num_subframes /* i : number of subframes to render */ + const int16_t ism_md_subframe_update, /* i : Number of subframes to delay ism metadata to sync with audio */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame, /* i : output frame length */ + const int16_t num_subframes /* i : number of subframes to render */ ) { int16_t subframe_length; @@ -759,8 +759,6 @@ ivas_error ivas_td_binaural_renderer_ext( } - - /*---------------------------------------------------------------------* * angles_to_vec() * diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index ef1e6f7f3..7a4c0c40c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1532,7 +1532,6 @@ void masaPrerendClose( ); - /* clang-format on */ #endif /* IVAS_PROT_REND_H */ diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index e94efb771..a6f309c26 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -148,5 +148,4 @@ extern const float ls_conversion_cicpX_stereo[12][2]; extern const LS_CONVERSION_MAPPING ls_conversion_mapping[]; - #endif /* IVAS_ROM_REND_H */ diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 234311672..a87d3c31a 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -151,17 +151,17 @@ void QuatToRotMat( float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ ) { - Rmat[0][0] = quat.w * quat.w + quat.x * quat.x - quat.y * quat.y - quat.z * quat.z; - Rmat[0][1] = 2.0f * ( quat.x * quat.y - quat.w * quat.z ); - Rmat[0][2] = 2.0f * ( quat.x * quat.z + quat.w * quat.y ); + Rmat[0][0] = quat.w * quat.w + quat.x * quat.x - quat.y * quat.y - quat.z * quat.z; + Rmat[0][1] = 2.0f * ( quat.x * quat.y - quat.w * quat.z ); + Rmat[0][2] = 2.0f * ( quat.x * quat.z + quat.w * quat.y ); - Rmat[1][0] = 2.0f * ( quat.x * quat.y + quat.w * quat.z ); - Rmat[1][1] = quat.w * quat.w - quat.x * quat.x + quat.y * quat.y - quat.z * quat.z; - Rmat[1][2] = 2.0f * ( quat.y * quat.z - quat.w * quat.x ); + Rmat[1][0] = 2.0f * ( quat.x * quat.y + quat.w * quat.z ); + Rmat[1][1] = quat.w * quat.w - quat.x * quat.x + quat.y * quat.y - quat.z * quat.z; + Rmat[1][2] = 2.0f * ( quat.y * quat.z - quat.w * quat.x ); - Rmat[2][0] = 2.0f * ( quat.x * quat.z - quat.w * quat.y ); - Rmat[2][1] = 2.0f * ( quat.y * quat.z + quat.w * quat.x ); - Rmat[2][2] = quat.w * quat.w - quat.x * quat.x - quat.y * quat.y + quat.z * quat.z; + Rmat[2][0] = 2.0f * ( quat.x * quat.z - quat.w * quat.y ); + Rmat[2][1] = 2.0f * ( quat.y * quat.z + quat.w * quat.x ); + Rmat[2][2] = quat.w * quat.w - quat.x * quat.x - quat.y * quat.y + quat.z * quat.z; return; } @@ -195,8 +195,6 @@ void Euler2Quat( } - - /*------------------------------------------------------------------------- * deg2rad() * @@ -795,8 +793,8 @@ void ivas_external_orientation_close( ivas_error ivas_combined_orientation_open( COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* o : combined orientation handle */ - const int32_t fs, /* i : sampling rate */ - const int16_t num_subframes /* i : number of subframes */ + const int32_t fs, /* i : sampling rate */ + const int16_t num_subframes /* i : number of subframes */ ) { int16_t i; @@ -971,8 +969,8 @@ ivas_error combine_external_and_head_orientations_rend( *------------------------------------------------------------------------*/ ivas_error combine_external_and_head_orientations( - IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ - IVAS_VECTOR3 *listenerPos, /* i : listener position */ + IVAS_QUATERNION *headRotQuaternions, /* i : quaternions for head rotation */ + IVAS_VECTOR3 *listenerPos, /* i : listener position */ EXTERNAL_ORIENTATION_HANDLE hExtOrientationData, /* i : external orientation handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData /* i/o: combined orientation handle */ ) @@ -1575,8 +1573,7 @@ void ivas_combined_orientation_update_index( { if ( hCombinedOrientationData != NULL ) { - if ( hCombinedOrientationData->num_subframes == 1 - ) + if ( hCombinedOrientationData->num_subframes == 1 ) { /* only one orientation available anyway or split rendering with low resolution*/ hCombinedOrientationData->subframe_idx = 0; @@ -1643,4 +1640,3 @@ void ivas_combined_orientation_update_start_index( return; } - diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 26931b63a..09376064e 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1202,7 +1202,6 @@ typedef struct ivas_binaural_crend_wrapper_struct } CREND_WRAPPER, *CREND_WRAPPER_HANDLE; - /*------------------------------------------------------------------------------------------* * HRTF structures - hrtfs from binary files *------------------------------------------------------------------------------------------*/ @@ -1269,8 +1268,6 @@ typedef struct ivas_hrtfs_parambin_struct } HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; - - /*----------------------------------------------------------------------------------* * Limiter structure *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ce38f288d..31c8e326c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -170,7 +170,6 @@ typedef struct } input_sba; - typedef struct { input_base base; @@ -486,17 +485,17 @@ static ivas_error validateOutputSampleRate( return IVAS_ERR_OK; } - /* Otherwise rendering to binaural, support the same set as IVAS decoder */ - switch ( sampleRate ) - { - case 8000: - case 16000: - case 32000: - case 48000: - return IVAS_ERR_OK; - } + /* Otherwise rendering to binaural, support the same set as IVAS decoder */ + switch ( sampleRate ) + { + case 8000: + case 16000: + case 32000: + case 48000: + return IVAS_ERR_OK; + } - return IVAS_ERR_INVALID_SAMPLING_RATE; + return IVAS_ERR_INVALID_SAMPLING_RATE; } @@ -2268,8 +2267,6 @@ static ivas_error initSbaPanGainsForSbaOut( } - - static ivas_error updateSbaPanGains( input_sba *inputSba, const AUDIO_CONFIG outConfig, @@ -2297,14 +2294,14 @@ static ivas_error updateSbaPanGains( switch ( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: - { + { if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + { + return error; } - break; + } + break; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) @@ -2338,8 +2335,6 @@ static ivas_error updateSbaPanGains( } - - static ivas_error initSbaMasaRendering( input_sba *inputSba, int32_t inSampleRate ) @@ -2407,8 +2402,6 @@ static ivas_error setRendInputActiveSba( } - - static void clearInputSba( input_sba *inputSba ) { @@ -2502,8 +2495,6 @@ static void clearInputMasa( } - - /*------------------------------------------------------------------------- * IVAS_REND_Open() * @@ -3015,8 +3006,6 @@ static ivas_error findFreeInputSlot( } - - /*-------------------------------------------------------------------* * IVAS_REND_AddInput() * @@ -3792,8 +3781,6 @@ int16_t IVAS_REND_FeedRenderConfig( } - - /*-------------------------------------------------------------------* * IVAS_REND_SetHeadRotation() * @@ -3804,7 +3791,7 @@ ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ - const int16_t sf_idx /* i : subframe index */ + const int16_t sf_idx /* i : subframe index */ ) { int16_t i; @@ -3900,8 +3887,6 @@ ivas_error IVAS_REND_DisableHeadRotation( } - - /*-------------------------------------------------------------------* * IVAS_REND_SetOrientationTrackingMode() * @@ -4840,8 +4825,6 @@ static ivas_error renderIsmToSba( } - - static void renderIsmToMasa( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -5354,8 +5337,6 @@ static void renderMcToMasa( } - - static ivas_error renderInputMc( input_mc *mcInput, const AUDIO_CONFIG outConfig, @@ -5486,7 +5467,6 @@ static void renderSbaToSba( } - static ivas_error renderSbaToBinaural( input_sba *sbaInput, const AUDIO_CONFIG outConfig, @@ -5658,8 +5638,6 @@ static ivas_error renderSbaToBinauralRoom( } - - static void renderSbaToMasa( input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) @@ -5732,8 +5710,6 @@ static ivas_error renderInputSba( } - - static ivas_error renderActiveInputsSba( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) @@ -5980,25 +5956,25 @@ static ivas_error renderInputMasa( num_subframes = (int16_t) ( masaInput->base.inputBuffer.config.numSamplesPerChannel / ( *masaInput->base.ctx.pOutSampleRate / ( IVAS_NUM_FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); - switch ( masaInput->hMasaExtRend->renderer_type ) - { - case RENDERER_DIRAC: - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); - ivas_masa_ext_dirac_render( masaInput->hMasaExtRend, tmpBuffer, num_subframes ); - break; - case RENDERER_STEREO_PARAMETRIC: - case RENDERER_BINAURAL_PARAMETRIC: - case RENDERER_BINAURAL_PARAMETRIC_ROOM: - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); + switch ( masaInput->hMasaExtRend->renderer_type ) + { + case RENDERER_DIRAC: + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); + ivas_masa_ext_dirac_render( masaInput->hMasaExtRend, tmpBuffer, num_subframes ); + break; + case RENDERER_STEREO_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC_ROOM: + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); ivas_masa_ext_rend_parambin_render( masaInput->hMasaExtRend, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, num_subframes ); - break; - case RENDERER_DISABLE: - break; /* This happens for 1TC MASA to MONO where we just copy input transport to output */ - default: - return ( IVAS_ERROR( IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, "Wrong output config for MASA input in external renderer\n" ) ); - } + break; + case RENDERER_DISABLE: + break; /* This happens for 1TC MASA to MONO where we just copy input transport to output */ + default: + return ( IVAS_ERROR( IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, "Wrong output config for MASA input in external renderer\n" ) ); + } - accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); + accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); } return IVAS_ERR_OK; @@ -6208,7 +6184,7 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( *-------------------------------------------------------------------*/ static ivas_error getSamplesInternal( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ ) { @@ -6334,8 +6310,6 @@ ivas_error IVAS_REND_GetSamples( } - - /*-------------------------------------------------------------------* * IVAS_REND_Close() * @@ -6397,8 +6371,6 @@ void IVAS_REND_Close( } - - #ifdef DEBUGGING /*-------------------------------------------------------------------* * IVAS_REND_GetNoCLipping() @@ -6809,99 +6781,99 @@ static ivas_error ivas_masa_ext_rend_parambin_init( hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin; - /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ - if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); - } + /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ + if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); + } - hDiracDecBin->hTdDecorr = NULL; - hDiracDecBin->hReverb = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; - hDiracDecBin->hDiffuseDist = NULL; /* Not used in external renderer */ - hDiracDecBin->useTdDecorr = 0; /* Always use frequency domain decorrelator in external renderer */ + hDiracDecBin->hTdDecorr = NULL; + hDiracDecBin->hReverb = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; + hDiracDecBin->hDiffuseDist = NULL; /* Not used in external renderer */ + hDiracDecBin->useTdDecorr = 0; /* Always use frequency domain decorrelator in external renderer */ - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) { - for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) - { - set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); - } - - for ( k = 0; k < BINAURAL_CHANNELS; k++ ) - { - set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); - } - set_zero( hDiracDecBin->ChEnePrev[j], nBins ); - set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); + set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); } - set_zero( hDiracDecBin->ChCrossRePrev, nBins ); - set_zero( hDiracDecBin->ChCrossImPrev, nBins ); - set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); - set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; - for ( bin = 0; bin < nBins; bin++ ) + for ( k = 0; k < BINAURAL_CHANNELS; k++ ) { - binCenterFreq = ( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f ); - /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ - tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); - hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); } + set_zero( hDiracDecBin->ChEnePrev[j], nBins ); + set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); + } + set_zero( hDiracDecBin->ChCrossRePrev, nBins ); + set_zero( hDiracDecBin->ChCrossImPrev, nBins ); + set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); + set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; - /* No SPAR in external renderer so set directive diffuse field coherence tables to zero */ - set_zero( hDiracDecBin->diffuseFieldCoherenceX, BINAURAL_COHERENCE_DIFFERENCE_BINS ); - set_zero( hDiracDecBin->diffuseFieldCoherenceY, BINAURAL_COHERENCE_DIFFERENCE_BINS ); - set_zero( hDiracDecBin->diffuseFieldCoherenceZ, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + for ( bin = 0; bin < nBins; bin++ ) + { + binCenterFreq = ( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f ); + /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ + tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); + hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + } - if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ - { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - } - else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ - { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + /* No SPAR in external renderer so set directive diffuse field coherence tables to zero */ + set_zero( hDiracDecBin->diffuseFieldCoherenceX, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + set_zero( hDiracDecBin->diffuseFieldCoherenceY, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + set_zero( hDiracDecBin->diffuseFieldCoherenceZ, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + + if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + } + else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ + { + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); if ( hDiracDecBin->hReverb == NULL ) - { - /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; - } - else /* Not valid renderer type for this renderer */ { - assert( false ); - } - - /* Always open frequency domain decorrelator */ - ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) + /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ + if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } - /* External renderer uses constant regularization factor */ - hDiracDecBin->reqularizationFactor = 0.4f; + } + } + else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; + } + else /* Not valid renderer type for this renderer */ + { + assert( false ); + } + + /* Always open frequency domain decorrelator */ + ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + /* External renderer uses constant regularization factor */ + hDiracDecBin->reqularizationFactor = 0.4f; inputMasa->hMasaExtRend->hDiracDecBin = hDiracDecBin; -- GitLab From 48deb7a81b98d1a4a4f45e8ecc2307850bb7ba2a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 13 Jan 2025 13:33:14 +0100 Subject: [PATCH 13/21] fix renderer comparison call --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fd9396e6c..6e53f1858 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1361,7 +1361,7 @@ renderer-pytest-on-merge-request: - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi # run test - - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer_.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$? + - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - *merge-request-comparison-check -- GitLab From 43a0a8677a6b0d4eee4cc10640b1c4b7c1e0d00b Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 13 Jan 2025 14:30:59 +0100 Subject: [PATCH 14/21] add missing anchor and rename variable --- .gitlab-ci.yml | 51 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e53f1858..51893066e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -131,6 +131,19 @@ stages: # automatically disable #DEBUGGING macro in options.h using /**/-comment - sed -i.bak -e "s/^[[:space:]]*\(#define[[:space:]]*DEBUGGING\)/\/\*\1\*\//g" lib_com/options.h +# From float CI +.mr-fetch-target-branch: &mr-fetch-target-branch + # 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 + +# From float CI +.mr-get-target-commit: &mr-get-target-commit # 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) + +# From float CI .merge-request-comparison-setup-codec: &merge-request-comparison-setup-codec ### build test binaries, initial clean for paranoia reasons - *disable-debugging-macro @@ -141,6 +154,28 @@ stages: - mv IVAS_rend IVAS_rend_test - git restore . + ### store the current commit hash + - source_branch_commit_sha=$(git rev-parse HEAD) + + ### checkout version to compare against + - *mr-fetch-target-branch + - *mr-get-target-commit + - git checkout $target_commit + - echo "Building reference codec at commit $target_commit" + + ### build reference binaries + - *disable-debugging-macro + - make -j + - mv IVAS_cod IVAS_cod_ref + - mv IVAS_dec IVAS_dec_ref + - mv IVAS_rend IVAS_rend_ref + - git restore . + + # rename test binaries back + - mv IVAS_cod_test IVAS_cod + - mv IVAS_dec_test IVAS_dec + - mv IVAS_rend_test IVAS_rend + .merge-request-comparison-check: &merge-request-comparison-check - echo "--------------- Running merge-request-comparison-check anchor ---------------" - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi @@ -1348,17 +1383,17 @@ renderer-pytest-on-merge-request: # write to temporary file as workaround for failures observed with piping echo - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - non_be_flag=$(grep -c --ignore-case "\[rend\(erer\)*[ -]*non[ -]*be\]" tmp.txt) || true - - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + - ref_using_target=$(grep -c --ignore-case "\[ref[ -]*using[ -]*target\]" tmp.txt) || true - ### If ref_using_main is not set, checkout the source branch to use scripts and input from there - - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi + ### If ref_using_target is not set, checkout the source branch to use scripts and input from there + - if [ $ref_using_target == 0 ]; then git checkout $source_branch_commit_sha; fi - exit_code=0 - testcase_timeout=60 - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout || exit_code=$? ### Run test using branch scripts and input - - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi + - if [ $ref_using_target == 1 ]; then git checkout $source_branch_commit_sha; fi # run test - python3 -m pytest -q --log-level ERROR -n auto -rA --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_cut --testcase_timeout=$testcase_timeout || exit_code=$? @@ -1388,17 +1423,17 @@ ivas-pytest-on-merge-request: # write to temporary file as workaround for failures observed with piping echo - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true - - ref_using_main=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + - ref_using_target=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true - ### If ref_using_main is not set, checkout the source branch to use scripts and input from there - - if [ $ref_using_main == 0 ]; then git checkout $source_branch_commit_sha; fi + ### If ref_using_target is not set, checkout the source branch to use scripts and input from there + - if [ $ref_using_target == 0 ]; then git checkout $source_branch_commit_sha; fi ### prepare pytest # create references - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 ### Run test using branch scripts and input - - if [ $ref_using_main == 1 ]; then git checkout $source_branch_commit_sha; fi + - if [ $ref_using_target == 1 ]; then git checkout $source_branch_commit_sha; fi ### run pytest - exit_code=0 -- GitLab From ce30042aaebbffc7ddccb41a1730a9c63cfc7e91 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 13 Jan 2025 14:34:07 +0100 Subject: [PATCH 15/21] disable ref_using_target tag --- .gitlab-ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 51893066e..26103486c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1383,7 +1383,9 @@ renderer-pytest-on-merge-request: # write to temporary file as workaround for failures observed with piping echo - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - non_be_flag=$(grep -c --ignore-case "\[rend\(erer\)*[ -]*non[ -]*be\]" tmp.txt) || true - - ref_using_target=$(grep -c --ignore-case "\[ref[ -]*using[ -]*target\]" tmp.txt) || true + # TODO: ref_using_target comes from float repo, but does not apply here - disable for now + # - ref_using_target=$(grep -c --ignore-case "\[ref[ -]*using[ -]*target\]" tmp.txt) || true + - ref_using_target=0 ### If ref_using_target is not set, checkout the source branch to use scripts and input from there - if [ $ref_using_target == 0 ]; then git checkout $source_branch_commit_sha; fi @@ -1423,7 +1425,9 @@ ivas-pytest-on-merge-request: # write to temporary file as workaround for failures observed with piping echo - echo $CI_MERGE_REQUEST_TITLE > tmp.txt - non_be_flag=$(grep -c --ignore-case "\[non[ -]*be\]" tmp.txt) || true - - ref_using_target=$(grep -c --ignore-case "\[ref[ -]*using[ -]*main\]" tmp.txt) || true + # TODO: ref_using_target comes from float repo, but does not apply here - disable for now + # - ref_using_target=$(grep -c --ignore-case "\[ref[ -]*using[ -]*target\]" tmp.txt) || true + - ref_using_target=0 ### If ref_using_target is not set, checkout the source branch to use scripts and input from there - if [ $ref_using_target == 0 ]; then git checkout $source_branch_commit_sha; fi -- GitLab From 67c6f12204268c068a0966d359ddb70819098122 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 13 Jan 2025 14:41:29 +0100 Subject: [PATCH 16/21] remove unsuported testcase in new comparison job --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 26103486c..0faf83bb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1420,6 +1420,7 @@ ivas-pytest-on-merge-request: - *get-commits-behind-count - *check-commits-behind-count-in-compare-jobs - *merge-request-comparison-setup-codec + - python3 ci/remove_unsupported_testcases.py $PRM_FILES # some helper variables - "|| true" to prevent failures from grep not finding anything # write to temporary file as workaround for failures observed with piping echo -- GitLab From cba043e42e138e020bf7621f38d6f8e4890054a1 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 13 Jan 2025 15:02:11 +0100 Subject: [PATCH 17/21] change from -eq 1 to -ne 0 see https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/merge_requests/1944 --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0faf83bb9..4d54eff4d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -179,8 +179,8 @@ stages: .merge-request-comparison-check: &merge-request-comparison-check - echo "--------------- Running merge-request-comparison-check anchor ---------------" - 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 + - if [ $exit_code -ne 0 ] && [ $non_be_flag == 0 ]; then echo "Non-bitexact cases without non-BE tag encountered!"; exit $EXIT_CODE_FAIL; fi + - if [ $exit_code -ne 0 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact cases with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi - exit 0 .build-reference-binaries: &build-reference-binaries -- GitLab From f95bdd1b768ac08b84d4feccd873f3ee1ebfbdc5 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 14 Jan 2025 13:15:07 +0100 Subject: [PATCH 18/21] change tags for comparison jobs --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d54eff4d..4518c56aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1372,6 +1372,8 @@ renderer-pytest-on-merge-request: needs: ["build-codec-linux-make"] # TODO: set reasonable timeout, will most likely take less timeout: "20 minutes" + tags: + - ivas-linux stage: compare script: - *print-common-info @@ -1415,6 +1417,8 @@ ivas-pytest-on-merge-request: # thus, overall, this should save time needs: ["build-codec-linux-make"] #, "codec-smoke-test"] timeout: "14 minutes" + tags: + - ivas-linux script: - *print-common-info - *get-commits-behind-count -- GitLab From 47aa359783c05c2c9af9e64e8b49d9df610b521a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 15 Jan 2025 09:45:41 +0100 Subject: [PATCH 19/21] change tag for all jobs run on the PC working branches --- .gitlab-ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4518c56aa..d018ceccf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -723,7 +723,7 @@ branch-is-up-to-date-with-target-pre: stage: prevalidate needs: [] tags: - - ivas-basop-linux + - ivas--linux script: - *get-commits-behind-count - echo $commits_behind_count @@ -738,7 +738,7 @@ branch-is-up-to-date-with-target-post: - .rules-merge-request stage: postvalidate tags: - - ivas-basop-linux + - ivas-linux script: - *get-commits-behind-count - echo $commits_behind_count @@ -765,6 +765,8 @@ clang-format-check: variables: ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--formatting-fix" stage: prevalidate + tags: + - ivas-linux needs: [] timeout: "5 minutes" script: @@ -820,6 +822,8 @@ build-codec-linux-make: when: never extends: - .build-job-linux + tags: + - ivas-linux script: - *print-common-info - *activate-Werror-linux @@ -837,6 +841,8 @@ build-codec-linux-instrumented-make: extends: - .build-job-linux timeout: "7 minutes" + tags: + - ivas-linux script: - *update-scripts-repo - *print-common-info @@ -849,6 +855,8 @@ build-codec-sanitizers-linux: extends: - .build-job-linux - .rules-basis + tags: + - ivas-linux script: - *update-scripts-repo - *print-common-info -- GitLab From e1a5d7d1642e3dcb614233e4b40ba96058fd1041 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 15 Jan 2025 09:56:23 +0100 Subject: [PATCH 20/21] do not create pipelines for draft MRs --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d018ceccf..c23921e6f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,6 +55,9 @@ workflow: # 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 + # do not spawn pipelines for Draft MRs, see https://docs.gitlab.com/ee/ci/yaml/workflow.html#skip-pipelines-for-draft-merge-requests + - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(\[Draft\]|\(Draft\)|Draft:)/ + when: never - if: $CI_PIPELINE_SOURCE == 'merge_request_event' variables: IVAS_PIPELINE_NAME: 'MR pipeline: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME' -- GitLab From 2c2cb1d37e3e509fc5def8d5599fc5c936fb5e4d Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 15 Jan 2025 11:33:14 +0100 Subject: [PATCH 21/21] fix tag --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c23921e6f..e4d954bfc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -726,7 +726,7 @@ branch-is-up-to-date-with-target-pre: stage: prevalidate needs: [] tags: - - ivas--linux + - ivas-linux script: - *get-commits-behind-count - echo $commits_behind_count -- GitLab