diff --git a/.gitignore b/.gitignore index a7a1d7a7ef6e4ef25555af59845006cffcc95815..c87c691a4af7f6c50a681db4a373b100e84c7558 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ scripts/td_object_renderer/object_renderer_standalone/renderer_standalone.exe .cache *.log *.bak +.\#* scripts/c-code_instrument/ scripts/ifdef_instrument.list scripts/ref/ @@ -63,7 +64,7 @@ __pycache__/ *.py[cod] *$py.class -#history +# history .history/ #externals diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b56bf35e8a23e0467d57bf5cb2914580464a4dcb..ea7344210a5234091b5ed814aec7dd838f2bb52f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ variables: LTV_DIR: "/usr/local/ltv" BUILD_OUTPUT: "build_output.txt" EVS_BE_TEST_DIR: "/usr/local/be_2_evs_test" + EVS_BE_WIN_TEST_DIR: "C:/Users/gitlab-runner/testvec" SANITIZER_TESTS: "CLANG1 CLANG2" OUT_FORMATS_CHANNEL_BASED: "stereo mono 5_1 5_1_2 5_1_4 7_1 7_1_4" OUT_FORMATS_SCENE_BASED: "FOA HOA2 HOA3" @@ -19,7 +20,7 @@ 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 - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' # Runs for merge requests + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main - if: $CI_PIPELINE_SOURCE == 'schedule' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Scheduled in main - if: $CI_PIPELINE_SOURCE == 'web' # for testing @@ -47,6 +48,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 + .get-previous-merge-commit-sha: &get-previous-merge-commit-sha - previous_merge_commit=$(git --no-pager log --merges HEAD~1 -n 1 --pretty=format:%H) @@ -128,7 +136,7 @@ stages: .rules-merge-request: extends: .rules-basis rules: - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + - 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 @@ -154,6 +162,11 @@ stages: tags: - ivas-linux +.build-job-windows: + stage: build + timeout: "4 minutes" + tags: + - ivas-windows # template for test jobs on linux that need the TESTV_DIR .test-job-linux-needs-testv-dir: @@ -170,6 +183,12 @@ stages: exit_codes: - 123 +.build-job-windows-with-check-for-warnings: + extends: .build-job-windows + stage: build + allow_failure: + exit_codes: + - 123 # --------------------------------------------------------------- @@ -260,6 +279,31 @@ build-codec-sanitizers-linux: - *print-common-info - bash ci/build_codec_sanitizers_linux.sh +build-codec-windows-cmake: + extends: + - .build-job-windows-with-check-for-warnings + - .rules-basis + script: + - *print-common-info-windows + - $winoutdata = $null + - cmake -G "Visual Studio 15 2017" . -Bbuild + - cmake --build build -j | tee -variable winoutdata + - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 + - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'") | Invoke-Expression + - ("exit $LASTEXITCODE") | Invoke-Expression + +build-codec-windows-msbuild: + extends: + - .build-job-windows-with-check-for-warnings + - .rules-basis + script: + - *print-common-info-windows + - $winoutdata = $null + - MSBuild.exe .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Debug | tee -variable winoutdata + - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 + - ("& python ci/check_for_warnings.py '$BUILD_OUTPUT'") | Invoke-Expression + - ("exit $LASTEXITCODE") | Invoke-Expression + # --------------------------------------------------------------- # Test jobs for merge requests # --------------------------------------------------------------- @@ -269,7 +313,7 @@ codec-smoke-test: extends: - .test-job-linux-needs-testv-dir - .rules-merge-request - timeout: "5 minutes" + timeout: "10 minutes" stage: test needs: ["build-codec-linux-cmake"] script: @@ -282,8 +326,8 @@ codec-smoke-test: - if cat smoke_test_output_hrtf.txt | grep -c "failed"; then echo "Smoke test with external hrtf files failed"; exit 1; fi artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week paths: - - out/logs/ - smoke_test_output.txt - smoke_test_output_plc.txt - smoke_test_output_jbm_noEXT.txt @@ -307,6 +351,7 @@ codec-msan: - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang memory-sanitizer"; exit 1; fi artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week paths: - scripts/ref/logs/ - test_output.txt @@ -329,6 +374,7 @@ codec-asan: - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang address-sanitizer"; exit 1; fi artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 1 week paths: - scripts/ref/logs/ - test_output.txt @@ -346,6 +392,7 @@ renderer-smoke-test: - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week when: always paths: - report-junit.xml @@ -369,6 +416,7 @@ renderer-asan: artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week when: always paths: - report-junit.xml @@ -392,6 +440,7 @@ renderer-msan: artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 1 week when: always paths: - report-junit.xml @@ -445,6 +494,7 @@ renderer-pytest-on-merge-request: - 123 artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" + expire_in: 2 week when: always paths: - report-junit.xml @@ -495,6 +545,7 @@ ivas-pytest-on-merge-request: - 123 artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 2 week when: always paths: - report-junit.xml @@ -541,6 +592,7 @@ evs-pytest-on-merge-request: - 123 artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 2 week when: always paths: - report-junit-evs.xml @@ -599,6 +651,7 @@ clang-format-check: - exit $format_problems artifacts: + expire_in: 2 days paths: - tmp-formatting-fix/ when: on_failure @@ -609,6 +662,30 @@ clang-format-check: # Test jobs for main branch # --------------------------------------------------------------- +# check bitexactness to EVS windows binaries +be-2-evs-windows: + extends: + - .rules-main-push + tags: + - ivas-windows + stage: test + needs: ["build-codec-windows-msbuild"] + timeout: "20 minutes" # To be revisited + script: + - *print-common-info-windows + + - $winoutdata = $null + - MSBuild.exe .\Workspace_msvc\Workspace_msvc.sln /property:Configuration=Release | tee -variable winoutdata + - $winoutdata | Out-File $BUILD_OUTPUT -Encoding Utf8 + + # copy over to never change the testvector dir + - cp -r $EVS_BE_WIN_TEST_DIR ./evs_be_win_test + - cp IVAS_cod.exe ./evs_be_win_test/bin/IVAS_cod.exe + - cp IVAS_dec.exe ./evs_be_win_test/bin/IVAS_dec.exe + + - cd evs_be_win_test + - python ../ci/run_evs_be_win_test.py + # check bitexactness to EVS be-2-evs-linux: extends: @@ -707,6 +784,7 @@ codec-comparison-on-main-push: - 123 artifacts: name: "main-push--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" + expire_in: 2 week when: always paths: - report-junit.xml @@ -728,6 +806,7 @@ codec-comparison-on-main-push: - sanitizer_test_main artifacts: name: "$CI_JOB_NAME--main--sha-$CI_COMMIT_SHORT_SHA" + expire_in: 1 week when: always paths: - ep_015.g192 @@ -739,13 +818,13 @@ codec-comparison-on-main-push: .sanitizer-test-schedule-A: extends: - .sanitizer-test-template - timeout: 2 hours 30 minutes sanitizer-test-mono: extends: .sanitizer-test-schedule-A rules: - if: $SANITIZER_SCHEDULE_A + timeout: 2 hour script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py mono mono --tests $SANITIZER_TESTS @@ -755,7 +834,8 @@ sanitizer-test-stereo: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 2 hours 30 minutes + start_in: 2 hour + timeout: 2 hour script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py stereo $OUT_FORMATS_CHANNEL_BASED --tests $SANITIZER_TESTS @@ -765,7 +845,8 @@ sanitizer-test-stereodmxevs: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 5 hours + start_in: 4 hours + timeout: 2 hour script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py StereoDmxEVS mono --tests $SANITIZER_TESTS @@ -775,7 +856,8 @@ sanitizer-test-ism1: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 7 hours 30 minutes + start_in: 6 hours + timeout: 2 hours script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py ISM1 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS @@ -785,7 +867,8 @@ sanitizer-test-ism2: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 10 hours + start_in: 8 hours + timeout: 3 hours script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py ISM2 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS @@ -795,7 +878,8 @@ sanitizer-test-ism3: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 12 hours 30 minutes + start_in: 11 hours + timeout: 3 hour script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py ISM3 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS @@ -805,7 +889,8 @@ sanitizer-test-ism4: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 15 hours + start_in: 14 hours + timeout: 4 hours script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py ISM4 $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS @@ -815,7 +900,8 @@ sanitizer-test-masa: rules: - if: $SANITIZER_SCHEDULE_A when: delayed - start_in: 17 hours 30 minutes + start_in: 18 hours + timeout: 3 hours script: - *update-ltv-repo - python3 ci/run_scheduled_sanitizer_test.py MASA $OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT --tests $SANITIZER_TESTS @@ -928,6 +1014,7 @@ coverage-test-on-main-scheduled: artifacts: name: "main-coverage-sha-$CI_COMMIT_SHORT_SHA" when: always + expire_in: 1 week paths: - coverage.info - coverage @@ -983,6 +1070,7 @@ coverage-test-on-main-scheduled: stage: test artifacts: name: "$CI_JOB_NAME--$CI_COMMIT_REF_NAME--sha-$CI_COMMIT_SHA" + expire_in: 1 week paths: - $CI_JOB_NAME-public @@ -1013,7 +1101,7 @@ complexity-ism-in-binaural-out: - *complexity-measurements-setup - in_format=ISM - out_format=BINAURAL - - bash ci/complexity_measurements/getWmops.sh "ISM1 ISM2 ISM3 ISM4" "$out_format" + - bash ci/complexity_measurements/getWmops.sh "ISM+1 ISM+2 ISM+3 ISM+4" "$out_format" - *complexity-measurements-prepare-artifacts complexity-sba-hoa3-in-hoa3-out: diff --git a/.gitlab/issue_templates/generic_issue.md b/.gitlab/issue_templates/default.md similarity index 100% rename from .gitlab/issue_templates/generic_issue.md rename to .gitlab/issue_templates/default.md diff --git a/.gitlab/issue_templates/sanitizer_error.md b/.gitlab/issue_templates/sanitizer_error.md new file mode 100644 index 0000000000000000000000000000000000000000..10ba7c7991ee472add8e72ec93d480c6d5f2ea4e --- /dev/null +++ b/.gitlab/issue_templates/sanitizer_error.md @@ -0,0 +1,39 @@ +### Basic info + +- Commit SHA: + +### Bug description + +Clang (msan/asan?) sanitizer test in pipeline found an error: + + +``` + +``` + + +Link to test pipeline: XXX + +### Ways to reproduce + +Using the [scripts](https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/wikis/Software-development/pyivastest-howto#how-to-reproduce-tests): + + +``` +python3 scripts/IvasBuildAndRunChecks.py --checks CLANGX -m MODE -p /path/to/my/local/ci_linux_ltv_local.json +``` +or directly: + +``` +make clean +make -j CLANG=X +./IVAS_cod ... +eid-xor -vbr -fer bit ep_015.g192 bit_fer +./IVAS_dec ... +``` + + + +/label ~"Priority::Critical" ~Company: ~Subpart: +/label ~Type:Bug ~Status::ToDo diff --git a/CMakeLists.txt b/CMakeLists.txt index 5299db65aee7bf9177e3ec13fa6d41edc9e8c60f..8098dc1c6896db669b7b31edfd2717f703442fcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,45 +112,42 @@ project(stereo-evs) set_property(GLOBAL PROPERTY USE_FOLDERS ON) # make Visual Studio projects look nicer include(CTest) -include_directories( - lib_com - lib_debug - lib_dec - lib_enc - lib_rend - lib_util -) - file(GLOB libComSrcs "lib_com/*.c") file(GLOB libComHeaders "lib_com/*.h") add_library(lib_com ${libComSrcs} ${libComHeaders}) if(UNIX) target_link_libraries(lib_com m) endif() +target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_enc lib_dec lib_rend lib_debug) file(GLOB libDebugSrcs "lib_debug/*.c") file(GLOB libDebugHeaders "lib_debug/*.h") add_library(lib_debug ${libDebugSrcs} ${libDebugHeaders}) target_link_libraries(lib_debug lib_com) +target_include_directories(lib_debug PUBLIC lib_debug PRIVATE lib_enc lib_dec lib_rend) file(GLOB libEncSrcs "lib_enc/*.c") file(GLOB libEncHeaders "lib_enc/*.h") add_library(lib_enc ${libEncSrcs} ${libEncHeaders}) target_link_libraries(lib_enc lib_com lib_debug) +target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend) file(GLOB libRendSrcs "lib_rend/*.c") file(GLOB libRendHeaders "lib_rend/*.h") add_library(lib_rend ${libRendSrcs} ${libRendHeaders}) target_link_libraries(lib_rend lib_dec lib_com lib_debug) # Todo refactor: This dependency on lib_dec should be removed. +target_include_directories(lib_rend PUBLIC lib_rend PRIVATE lib_enc) file(GLOB libDecSrcs "lib_dec/*.c") file(GLOB libDecHeaders "lib_dec/*.h") add_library(lib_dec ${libDecSrcs} ${libDecHeaders}) target_link_libraries(lib_dec lib_com lib_rend lib_debug) +target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc) file(GLOB libUtilSrcs "lib_util/*.c") file(GLOB libUtilHeaders "lib_util/*.h") add_library(lib_util ${libUtilSrcs} ${libUtilHeaders}) +target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug) add_executable(IVAS_cod apps/encoder.c) target_link_libraries(IVAS_cod lib_enc lib_util) @@ -166,6 +163,7 @@ endif() add_executable(IVAS_rend apps/renderer.c) target_link_libraries(IVAS_rend lib_rend lib_util) +target_include_directories(IVAS_rend PRIVATE lib_enc) if(COPY_EXECUTABLES_FROM_BUILD_DIR) # Optionally copy executables to the same place where Make puts them (useful for tests that expect executables in specific places) diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj index 0bccec7978e9d997b8a1faa1975cb8b97859ff75..e59992847c71b085235a5232aad1afa7d710d17f 100644 --- a/Workspace_msvc/decoder.vcxproj +++ b/Workspace_msvc/decoder.vcxproj @@ -68,7 +68,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) EnableFastChecks @@ -112,7 +112,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index 755e404b67a52507e54da9b60b2690d42ab4b6d5..bcfe92a4db2218e2e04ae78a7cf7ea35cdc24349 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) EnableFastChecks @@ -198,7 +198,7 @@ Neither false false - ..\lib_enc;..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) + ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 994b1ec4291fcd5b010f022167796fcb4921f7f9..bfe36b1f4812b8e44a7cb32fca8793c1b443c962 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -78,7 +78,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -244,9 +244,9 @@ + - @@ -268,6 +268,7 @@ + @@ -358,4 +359,4 @@ - + \ No newline at end of file diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index f9d7920ca2d85337fc08ed083b6d6eb2242def73..7b6854e7184cd0ec212f9819aa783944db688a6a 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -379,9 +379,6 @@ common_evs_c - - common_ivas_c - common_ivas_c @@ -463,6 +460,12 @@ common_ivas_c + + common_ivas_c + + + common_ivas_c + diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 8a14cbdd31a94c0c1a8bdd4e55df18145f74c557..9b7b5806615c336f40e3f5850ded7b2c2d4103ec 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -73,7 +73,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) false @@ -124,7 +124,7 @@ AnySuitable false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true @@ -149,8 +149,6 @@ - - diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index 34b63eba780daaa19b319666d1510a4bf97d2d09..760621d7a40ce2113110aed02262c1d0f8f40ff9 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -169,7 +169,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) true @@ -264,6 +264,7 @@ + @@ -271,25 +272,31 @@ - + + + + + + + @@ -299,6 +306,7 @@ + @@ -317,7 +325,6 @@ - diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters index 4dcff8d503d594bb101ae9d579828038b11b58e7..6284884920f332ea486df52e269e1eb51e5ef8f3 100644 --- a/Workspace_msvc/lib_dec.vcxproj.filters +++ b/Workspace_msvc/lib_dec.vcxproj.filters @@ -13,9 +13,6 @@ dec_ivas_c - - dec_ivas_c - dec_ivas_c @@ -473,9 +470,6 @@ dec_ivas_c - - dec_ivas_c - dec_ivas_c @@ -503,6 +497,33 @@ dec_ivas_c + + dec_ivas_c + + + dec_ivas_c + + + dec_ivas_c + + + dec_ivas_c + + + dec_ivas_c + + + dec_ivas_c + + + dec_ivas_c + + + dec_ivas_c + + + dec_ivas_c + diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index a2d1e13ae78d01533bbbbd6520a5f4a010a48388..d9f8e974f0a9fbb885386ff137db1a0b8ef49c0c 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -89,7 +89,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -211,7 +211,9 @@ + + diff --git a/Workspace_msvc/lib_enc.vcxproj.filters b/Workspace_msvc/lib_enc.vcxproj.filters index 8fe608e0a69d52dffb9b576a8c26b439a5f62954..b3970764c0f9218533e6f7e63c8f1d270540c0e1 100644 --- a/Workspace_msvc/lib_enc.vcxproj.filters +++ b/Workspace_msvc/lib_enc.vcxproj.filters @@ -584,6 +584,12 @@ enc_ivas_c + + enc_ivas_c + + + enc_ivas_c + diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index e0660f54cb03ef6a92e51b7a3a99af9b4e8eefa7..4bd0ca9a93af1b4580271f339f0670bdc1a26bac 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -197,15 +197,13 @@ + + - - - - @@ -229,7 +227,7 @@ - + diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 3e269dab4bf714878ae0e69689dab54d7d2f5eb9..72ff2dfe6182abfbe7d1a6783c324a3958d398a6 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -73,7 +73,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) false @@ -117,7 +117,7 @@ AnySuitable false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) true @@ -146,6 +146,7 @@ + @@ -157,6 +158,7 @@ + @@ -167,6 +169,7 @@ + @@ -181,6 +184,7 @@ + diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index 6ca03f67dd3d36153fa63d572f02a805b572b23a..94ad9f774e7bd050c4e940eb9a47911f18d783ef 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -86,7 +86,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) EnableFastChecks @@ -180,7 +180,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/apps/decoder.c b/apps/decoder.c index f018814423aefb3a2eaaf61ed84d57ea134d939c..9b6b85676508d94c60b728bf651da78c8332a555 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -33,7 +33,6 @@ #include #include #include -#include "options.h" #include "lib_dec.h" #include "cmdl_tools.h" #include "audio_file_writer.h" @@ -43,13 +42,18 @@ #include "ls_custom_file_reader.h" #include "hrtf_file_reader.h" #include "head_rotation_file_reader.h" +#include "vector3_pair_file_reader.h" #include "jbm_file_writer.h" #include "evs_rtp_payload.h" +#ifdef VARIABLE_SPEED_DECODING +#include "tsm_scale_file_reader.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif #include "wmc_auto.h" #include "render_config_reader.h" +#include "hrtf_file_reader.h" #define WMC_TOOL_SKIP @@ -69,9 +73,19 @@ static #define MAX_NUM_OUTPUT_CHANNELS 16 #define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) -#define IVAS_PUBLIC_ORIENT_TRK_REF 0 -#define IVAS_PUBLIC_ORIENT_TRK_AVG 1 +#define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) +#define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 ) +#define IVAS_PUBLIC_ORIENT_TRK_AVG ( 2 ) +#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC ( 3 ) +#define IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ( 4 ) +#ifdef VARIABLE_SPEED_DECODING +#define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20 +#endif +#ifdef JBM_TSM_ON_TCS +#define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20 +#define FRAME_SIZE_NS 20000000L +#endif typedef struct { @@ -85,6 +99,10 @@ typedef struct bool voipMode; bool enableHeadRotation; char *headrotTrajFileName; + bool enableReferenceRotation; + char *refrotTrajFileName; + bool enableReferenceVectorTracking; + char *referenceVectorTrajFileName; #ifdef SUPPORT_JBM_TRACEFILE char *jbmTraceFilename; #endif @@ -93,25 +111,44 @@ typedef struct float FER; bool hrtfReaderEnabled; char *hrtfFileName; -#ifdef HRTF_BINARY_FILE bool hrtfCRendReaderEnabled; char *hrtfCRendFileName; -#endif IVAS_DEC_INPUT_FORMAT inputFormat; bool customLsOutputEnabled; char *customLsSetupFilename; int16_t orientation_tracking; +#ifdef NON_DIEGETIC_PAN + int16_t Opt_non_diegetic_pan; + float non_diegetic_pan_gain; +#else float no_diegetic_pan; +#endif bool renderConfigEnabled; char *renderConfigFilename; +#ifdef COMPLEXITY_LEVEL_INDICATION + IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; +#endif #ifdef DEBUGGING - bool forceSubframeBinauralization; IVAS_DEC_FORCED_REND_MODE forcedRendMode; #ifdef DEBUG_FOA_AGC FILE *agcBitstream; /* temporary */ #endif +#endif +#ifdef DEBUG_JBM_CMD_OPTION + bool noBadFrameDelay; +#endif +#ifdef VARIABLE_SPEED_DECODING + bool variableSpeedMode; + bool tsmScaleFileEnabled; + char *tsmScaleFileName; + uint16_t tsmScale; +#endif +#ifdef JBM_TSM_ON_TCS +#ifdef DEBUG_JBM_CMD_OPTION + uint16_t frontendFetchSizeMs; +#endif #endif } DecArguments; @@ -123,8 +160,11 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); -static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); +static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); +#ifdef VARIABLE_SPEED_DECODING +static ivas_error decodeVariableSpeed( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, HeadRotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); +#endif #ifdef DEBUGGING static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); static int16_t app_own_random( int16_t *seed ); @@ -149,6 +189,8 @@ int main( LsCustomFileReader *hLsCustomReader = NULL; hrtfFileReader *hrtfReader = NULL; HeadRotFileReader *headRotReader = NULL; + HeadRotFileReader *refRotReader = NULL; + Vector3PairFileReader *referenceVectorReader = NULL; ivas_error error = IVAS_ERR_UNKNOWN; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; RenderConfigReader *renderConfigReader = NULL; @@ -184,7 +226,11 @@ int main( * Open decoder handle *------------------------------------------------------------------------------------------*/ +#ifdef NON_DIEGETIC_PAN + if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking, arg.no_diegetic_pan ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -222,8 +268,17 @@ int main( if ( arg.hrtfReaderEnabled ) { + /* sanity check */ + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + { + arg.hrtfReaderEnabled = false; + fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" ); + goto cleanup; + } + if ( ( error = hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) ) != IVAS_ERR_OK ) { + arg.hrtfReaderEnabled = false; fprintf( stderr, "\nError: Can't open HRTF binary file %s \n\n", arg.hrtfFileName ); goto cleanup; } @@ -235,6 +290,13 @@ int main( if ( arg.enableHeadRotation ) { + /* sanity check */ + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + { + fprintf( stderr, "\nError: Head-rotation file file cannot be used in this output configuration.\n\n" ); + goto cleanup; + } + if ( ( error = HeadRotationFileReader_open( arg.headrotTrajFileName, &headRotReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open head-rotation file %s \n\n", arg.headrotTrajFileName ); @@ -242,6 +304,60 @@ int main( } } + /*------------------------------------------------------------------------------------------* + * Open reference rotation file + *------------------------------------------------------------------------------------------*/ + + if ( arg.enableReferenceRotation ) + { + /* sanity check */ + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + { + fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" ); + goto cleanup; + } + + /* sanity check */ + if ( arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF ) + { + fprintf( stderr, "\nError: Reference rotation file can be used in '-otr ref' mode only.\n\n" ); + goto cleanup; + } + + if ( ( error = HeadRotationFileReader_open( arg.refrotTrajFileName, &refRotReader ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: Can't open reference rotation file %s \n\n", arg.refrotTrajFileName ); + goto cleanup; + } + } + + /*------------------------------------------------------------------------------------------* + * Open reference vector trajectory file + *------------------------------------------------------------------------------------------*/ + + if ( arg.enableReferenceVectorTracking ) + { + /* sanity check */ + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + { + fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" ); + goto cleanup; + } + + /* sanity check */ + if ( arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF_VEC && arg.orientation_tracking != IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV ) + { + fprintf( stderr, "\nError: Reference trajectory file can be used in '-otr ref_vec' or '-otr ref_vec_lev' mode only.\n\n" ); + goto cleanup; + } + + if ( ( error = Vector3PairFileReader_open( arg.referenceVectorTrajFileName, &referenceVectorReader ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: Can't open reference vector trajectory file %s \n\n", arg.referenceVectorTrajFileName ); + goto cleanup; + } + } + /*------------------------------------------------------------------------------------------* * Open custom loudspeaker layout file *------------------------------------------------------------------------------------------*/ @@ -261,6 +377,13 @@ int main( if ( arg.renderConfigEnabled ) { + /* sanity check */ + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + { + fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" ); + goto cleanup; + } + if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename ); @@ -272,10 +395,10 @@ int main( * Configure the decoder *------------------------------------------------------------------------------------------*/ -#ifdef DEBUGGING - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK ) +#ifdef NON_DIEGETIC_PAN + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK ) #else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -382,9 +505,9 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM ) + if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL ) { - fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n\n" ); + fprintf( stderr, "\nExternal Renderer Config is supported only for BINAURAL and BINAURAL_ROOM. Exiting. \n\n" ); goto cleanup; } @@ -445,7 +568,6 @@ int main( goto cleanup; } -#ifdef HRTF_BINARY_FILE IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF; IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); @@ -453,9 +575,7 @@ int main( if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfCRendFileName ); -#ifndef FIX_FOR_TEST goto cleanup; -#endif } IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv; IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ); @@ -471,7 +591,6 @@ int main( { fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfCRendFileName ); } -#endif } /*-----------------------------------------------------------------* @@ -480,8 +599,15 @@ int main( if ( arg.voipMode ) { - +#ifdef JBM_TSM_ON_TCS + if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VOIP, 100, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) +#else +#ifdef VARIABLE_SPEED_DECODING + if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VOIP, 100, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) +#endif +#endif { fprintf( stderr, "\nCould not enable VOIP: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -489,9 +615,20 @@ int main( error = decodeVoIP( arg, hBsReader, hIvasDec ); } +#ifdef VARIABLE_SPEED_DECODING + else if ( arg.variableSpeedMode ) + { + if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VARIABLE_SPEED, arg.tsmScale, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nCould not enable Variable Play Speed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + error = decodeVariableSpeed( arg, hBsReader, headRotReader, refRotReader, referenceVectorReader, hIvasDec ); + } +#endif else { - error = decodeG192( arg, hBsReader, headRotReader, hIvasDec, pcmBuf ); + error = decodeG192( arg, hBsReader, headRotReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf ); } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) @@ -533,17 +670,22 @@ cleanup: #ifdef DEBUG_SBA_AUDIO_DUMP IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels ); #endif + if ( arg.hrtfReaderEnabled ) { IVAS_DEC_HRTF_HANDLE hHrtfTD; IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); dealloc_HRTF_binary( hHrtfTD ); + IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF; + IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); + destroy_SetOfHRTF( hSetOfHRTF ); } IVAS_DEC_Close( &hIvasDec ); CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); HeadRotationFileReader_close( &headRotReader ); - + HeadRotationFileReader_close( &refRotReader ); + Vector3PairFileReader_close( &referenceVectorReader ); RenderConfigReader_close( &renderConfigReader ); if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK ) @@ -586,6 +728,7 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( char argv_to_upper[FILENAME_MAX]; strncpy( argv_to_upper, argv, sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; to_upper( argv_to_upper ); if ( strcmp( argv_to_upper, "EXT" ) == 0 ) /* external renderer */ @@ -664,10 +807,8 @@ static bool parseCmdlIVAS_dec( char argv_to_upper[FILENAME_MAX]; #ifdef DEBUGGING float ftmp; - char stmp[FILENAME_MAX]; arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED; - arg->forceSubframeBinauralization = false; #ifdef DEBUG_FOA_AGC arg->agcBitstream = NULL; #endif @@ -678,10 +819,17 @@ static bool parseCmdlIVAS_dec( arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; arg->voipMode = false; +#ifdef COMPLEXITY_LEVEL_INDICATION + arg->complexityLevel = IVAS_DEC_COMPLEXITY_LEVEL_THREE; +#endif arg->enableHeadRotation = false; arg->headrotTrajFileName = NULL; - arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; + arg->enableReferenceRotation = false; + arg->headrotTrajFileName = NULL; + arg->enableReferenceVectorTracking = false; + arg->referenceVectorTrajFileName = NULL; #ifdef SUPPORT_JBM_TRACEFILE arg->jbmTraceFilename = NULL; @@ -694,10 +842,8 @@ static bool parseCmdlIVAS_dec( arg->hrtfReaderEnabled = false; arg->hrtfFileName = NULL; -#ifdef HRTF_BINARY_FILE arg->hrtfCRendReaderEnabled = false; arg->hrtfCRendFileName = NULL; -#endif arg->customLsOutputEnabled = false; arg->customLsSetupFilename = NULL; @@ -706,7 +852,26 @@ static bool parseCmdlIVAS_dec( arg->renderConfigFilename = NULL; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; +#ifdef NON_DIEGETIC_PAN + arg->Opt_non_diegetic_pan = 0; + arg->non_diegetic_pan_gain = 0.f; +#else arg->no_diegetic_pan = 0.f; +#endif +#ifdef VARIABLE_SPEED_DECODING + arg->variableSpeedMode = 0; + arg->tsmScale = 100; + arg->tsmScaleFileEnabled = false; + arg->tsmScaleFileName = NULL; +#endif +#ifdef JBM_TSM_ON_TCS +#ifdef DEBUG_JBM_CMD_OPTION + arg->frontendFetchSizeMs = JBM_FRONTEND_FETCH_FRAMESIZE_MS; +#endif +#endif +#ifdef DEBUG_JBM_CMD_OPTION + arg->noBadFrameDelay = false; +#endif /*-----------------------------------------------------------------* * Initialization @@ -728,6 +893,7 @@ static bool parseCmdlIVAS_dec( while ( argv[i][0] == '-' ) { strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; to_upper( argv_to_upper ); if ( strcmp( argv_to_upper, "-VOIP" ) == 0 ) @@ -735,13 +901,13 @@ static bool parseCmdlIVAS_dec( arg->voipMode = 1; i++; } - else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=0" ) == 0 ) + else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 ) { arg->voipMode = 1; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP; i++; } - else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=1" ) == 0 ) + else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 ) { arg->voipMode = 1; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF; @@ -814,21 +980,15 @@ static bool parseCmdlIVAS_dec( i++; if ( i < argc - 3 ) { - strncpy( stmp, argv[i], sizeof( stmp ) ); - arg->forcedRendMode = parseForcedRendModeDec( stmp ); + strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; + arg->forcedRendMode = parseForcedRendModeDec( argv_to_upper ); i++; } } - else if ( strcmp( argv_to_upper, "-FORCE_SUBFRAME_BIN" ) == 0 ) /* Force binauralization to subframe (5 ms) resolution */ - { - arg->forceSubframeBinauralization = true; - i++; - } #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK - /*-----------------------------------------------------------------* - * Define additional subfolder for debug info output in ./res - *-----------------------------------------------------------------*/ + /* Define additional subfolder for debug info output in ./res */ else if ( strcmp( argv_to_upper, "-INFO" ) == 0 ) { extern char infoFolder[FILENAME_MAX]; @@ -838,6 +998,62 @@ static bool parseCmdlIVAS_dec( #endif /* #ifdef DEBUG_MODE_INFO_TWEAK */ #endif /* #ifdef DEBUG_MODE_INFO */ #endif /* #ifdef DEBUGGING */ +#ifdef DEBUG_JBM_CMD_OPTION + else if ( strcmp( argv_to_upper, "-VOIP_NO_BAD_FRAME" ) == 0 ) + { + arg->noBadFrameDelay = true; + i++; + } +#endif +#ifdef VARIABLE_SPEED_DECODING + + else if ( strcmp( argv_to_upper, "-VS" ) == 0 ) + { + i++; + int tmp = 100; + arg->variableSpeedMode = true; + if ( i < argc - 3 ) + { + if ( !is_digits_only( argv[i] ) ) + { + arg->tsmScaleFileEnabled = true; + arg->tsmScaleFileName = argv[i]; + i++; + } + + else + { + if ( ( sscanf( argv[i], "%d", &tmp ) > 0 ) ) + { + i++; + } + } + arg->tsmScale = (uint16_t) tmp; + } + } +#endif +#ifdef JBM_TSM_ON_TCS +#ifdef DEBUG_JBM_CMD_OPTION + else if ( strcmp( argv_to_upper, "-VOIP_FRAMESIZE" ) == 0 ) + { + i++; + int tmp; + if ( i < argc - 3 ) + { + if ( !is_digits_only( argv[i] ) ) + { + return false; + } + + if ( sscanf( argv[i], "%d", &tmp ) > 0 ) + { + i++; + } + arg->frontendFetchSizeMs = (uint16_t) tmp; + } + } +#endif +#endif else if ( strcmp( argv_to_upper, "-MIME" ) == 0 ) { @@ -861,30 +1077,69 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( argv_to_upper, "-OTR" ) == 0 ) { - if ( strlen( argv[i + 1] ) > 3 ) + + strncpy( argv_to_upper, argv[i + 1], sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; + to_upper( argv_to_upper ); + + if ( strcmp( argv_to_upper, "NONE" ) == 0 ) { - fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] ); - usage_dec(); - return false; + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_NONE; } - char tmp[4]; - strcpy( tmp, argv[i + 1] ); - if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) + else if ( strcmp( argv_to_upper, "REF" ) == 0 ) { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; } - else if ( strcmp( to_upper( tmp ), "AVG" ) == 0 ) + else if ( strcmp( argv_to_upper, "AVG" ) == 0 ) { arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG; } + else if ( strcmp( argv_to_upper, "REF_VEC" ) == 0 ) + { + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC; + } + else if ( strcmp( argv_to_upper, "REF_VEC_LEV" ) == 0 ) + { + arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF_VEC_LEV; + } else { - fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", tmp ); + fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] ); usage_dec(); return false; } i += 2; } + else if ( strcmp( argv_to_upper, "-RF" ) == 0 ) + { + arg->enableReferenceRotation = true; + i++; + + if ( argc - i <= 4 || argv[i][0] == '-' ) + { + fprintf( stderr, "Error: Reference rotation file name not specified!\n\n" ); + usage_dec(); + return false; + } + + arg->refrotTrajFileName = argv[i]; + i++; + } + else if ( strcmp( argv_to_upper, "-RVF" ) == 0 ) + { + arg->enableReferenceVectorTracking = true; + i++; + + if ( argc - i <= 4 || argv[i][0] == '-' ) + { + fprintf( stderr, "Error: reference vector trajectory file name not specified!\n\n" ); + usage_dec(); + return false; + } + + arg->referenceVectorTrajFileName = argv[i]; + i++; + } else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 ) { arg->renderConfigEnabled = true; @@ -898,43 +1153,86 @@ static bool parseCmdlIVAS_dec( } i += 2; } - else if ( strcmp( argv_to_upper, "-NO_DIEGETIC_PAN" ) == 0 ) + else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 ) { i++; - - if ( argc - i <= 4 || argv[i][0] == '-' ) +#ifdef NON_DIEGETIC_PAN + arg->Opt_non_diegetic_pan = 1; +#else + if ( argc - i <= 4 || ( argv[i][0] == '-' ) ) { fprintf( stderr, "Error: Argument for panning option not specified!\n\n" ); usage_dec(); return false; } - - char *param = to_upper( argv[i] ); - if ( ( strcmp( param, "CENTER" ) == 0 ) || ( strchr( param, 'C' ) != NULL ) ) +#endif + strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; +#ifdef NON_DIEGETIC_PAN + to_upper( argv_to_upper ); +#endif + if ( ( strcmp( argv_to_upper, "CENTER" ) == 0 ) || ( strchr( argv_to_upper, 'C' ) != NULL ) ) { +#ifdef NON_DIEGETIC_PAN + arg->non_diegetic_pan_gain = 0.f; +#else arg->no_diegetic_pan = 0.f; +#endif } - else if ( ( strcmp( param, "LEFT" ) == 0 ) || ( strchr( param, 'L' ) != NULL ) ) + else if ( ( strcmp( argv_to_upper, "LEFT" ) == 0 ) || ( strchr( argv_to_upper, 'L' ) != NULL ) ) { - arg->no_diegetic_pan = -1.f; +#ifdef NON_DIEGETIC_PAN + arg->non_diegetic_pan_gain = 1.f; +#else + arg->no_diegetic_pan = 1.f; +#endif } - else if ( ( strcmp( param, "RIGHT" ) == 0 ) || ( strchr( param, 'R' ) != NULL ) ) + else if ( ( strcmp( argv_to_upper, "RIGHT" ) == 0 ) || ( strchr( argv_to_upper, 'R' ) != NULL ) ) { - arg->no_diegetic_pan = 1.f; +#ifdef NON_DIEGETIC_PAN + arg->non_diegetic_pan_gain = -1.f; +#else + arg->no_diegetic_pan = -1.f; +#endif } else { - arg->no_diegetic_pan = (float) atof( param ); +#ifdef NON_DIEGETIC_PAN + arg->non_diegetic_pan_gain = (float) atof( argv_to_upper ) / 90.f; + + if ( arg->non_diegetic_pan_gain > 1.0f || arg->non_diegetic_pan_gain < -1.0f ) +#else + arg->no_diegetic_pan = (float) atof( argv_to_upper ); if ( arg->no_diegetic_pan > 1.0f || arg->no_diegetic_pan < -1.0f ) +#endif { - fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" ); + fprintf( stderr, "Error: Incorrect value for panning gain value specified: %s\n\n", argv[i] ); usage_dec(); return false; } } i++; } +#ifdef COMPLEXITY_LEVEL_INDICATION + else if ( strcmp( argv_to_upper, "-LEVEL" ) == 0 ) + { + int16_t level; + + ++i; + level = (int16_t) atoi( argv[i++] ); + if ( level < IVAS_DEC_COMPLEXITY_LEVEL_ONE || level > IVAS_DEC_COMPLEXITY_LEVEL_THREE ) + { + fprintf( stdout, "Invalid complexity level specified.\n" ); + usage_dec(); + return false; + } + else if ( level == IVAS_DEC_COMPLEXITY_LEVEL_ONE || level == IVAS_DEC_COMPLEXITY_LEVEL_TWO ) + { + fprintf( stdout, "Complexity levels 1 and 2 will be defined after characterisation - default to level 3 (full functionality).\n" ); + } + } +#endif /*-----------------------------------------------------------------* * Option not recognized @@ -963,11 +1261,25 @@ static bool parseCmdlIVAS_dec( arg->customLsSetupFilename = argv[i]; } i++; +#ifdef NON_DIEGETIC_PAN + if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputFormat != IVAS_DEC_OUTPUT_STEREO ) ) + { + fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" ); + usage_dec(); + return false; + } +#endif } else { arg->outputFormat = IVAS_DEC_OUTPUT_MONO; arg->decMode = IVAS_DEC_MODE_EVS; +#ifdef NON_DIEGETIC_PAN + if ( ( arg->Opt_non_diegetic_pan ) ) + { + arg->outputFormat = IVAS_DEC_OUTPUT_STEREO; + } +#endif } /*-----------------------------------------------------------------* @@ -1050,6 +1362,18 @@ static void usage_dec( void ) fprintf( stdout, "-VOIP : VoIP mode: RTP in G192\n" ); fprintf( stdout, "-VOIP_hf_only=0 : VoIP mode: EVS RTP Payload Format hf_only=0 in rtpdump\n" ); fprintf( stdout, "-VOIP_hf_only=1 : VoIP mode: EVS RTP Payload Format hf_only=1 in rtpdump\n" ); +#ifdef DEBUG_JBM_CMD_OPTION + fprintf( stdout, "-VOIP_no_bad_frame : VoIP mode: do not put out bad frames in the beginning as silence \n" ); +#endif +#ifdef VARIABLE_SPEED_DECODING + fprintf( stdout, "-VS fac : Varaible Speed mode: change speed of playout fac as integer in percent. fac<100 faster, fac>100 slower\n" ); +#endif +#ifdef JBM_TSM_ON_TCS +#ifdef DEBUG_JBM_CMD_OPTION + fprintf( stdout, "-VOIP_framesize : VoIP mode: acoustic frontend fetch frame size (must be multiples of 5!)\n" ); +#endif + +#endif fprintf( stdout, " The decoder may read rtpdump files containing TS26.445 Annex A.2.2\n" ); fprintf( stdout, " EVS RTP Payload Format. The SDP parameter hf_only is required.\n" ); fprintf( stdout, " Reading RFC4867 AMR/AMR-WB RTP payload format is not supported.\n" ); @@ -1066,28 +1390,31 @@ static void usage_dec( void ) fprintf( stdout, " Format files, the magic word in the mime file is used to determine\n" ); fprintf( stdout, " which of the two supported formats is in use.\n" ); fprintf( stdout, " default bitstream file format is G.192\n" ); - fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); -#ifdef HRTF_BINARY_FILE fprintf( stdout, "-hrtf File : HRTF filter File used in BINAURAL output configuration\n" ); -#else - fprintf( stdout, "-hrtf File : HRTF filter File used in ISm format and BINAURAL output configuration\n" ); -#endif + fprintf( stdout, "-T File : Head rotation specified by external trajectory File\n" ); + fprintf( stdout, "-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' \n" ); + fprintf( stdout, " or 'ref_vec_lev' (only for binaural rendering)\n" ); + fprintf( stdout, "-rf File : Reference rotation specified by external trajectory file\n" ); + fprintf( stdout, " works only in combination with '-otr ref' mode \n" ); + fprintf( stdout, "-rvf File : Reference vector specified by external trajectory file\n" ); + fprintf( stdout, " works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" ); + fprintf( stdout, "-render_config File : Renderer configuration File\n" ); + fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with paning P, -90<= P <=90,\n" ); + fprintf( stdout, " left or l or 90->left, right or r or -90->right, center or c or 0->middle\n" ); + fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); + fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUGGING - fprintf( stdout, "-force_subframe_bin : Forces parametric binauralizer code to use 5 ms time resolution even when\n" ); - fprintf( stdout, " output time resolution is larger.\n" ); fprintf( stdout, "-FEC X : Insert frame erasures, X = 0-10 is the percentage\n" ); fprintf( stdout, " of erased frames, or X may be the name of binary file or \n" ); fprintf( stdout, " file with G192 headers indicating GOOD FRAME or BAD FRAME\n" ); fprintf( stdout, " containing FEC pattern (short values of 0 (good) or 1 (bad))\n" ); fprintf( stdout, " default is OFF, if this option is not used\n" ); fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); +#ifdef COMPLEXITY_LEVEL_INDICATION + fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); + fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); +#endif #endif - fprintf( stdout, "-otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering)\n" ); - fprintf( stdout, "-render_config file : Renderer configuration file\n" ); - fprintf( stdout, "-no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1,\n" ); - fprintf( stdout, " left or l or 1->left, right or r or -1->right, center or c or 0->middle\n" ); - fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); - fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUG_MODE_INFO #ifdef DEBUG_MODE_INFO_TWEAK fprintf( stdout, "-info : specify subfolder name for debug output\n" ); @@ -1132,19 +1459,17 @@ static ivas_error initOnFirstGoodFrame( ivas_error error = IVAS_ERR_UNKNOWN; /* Now delay, number of output channels and frame size are known */ - if ( arg.delayCompensationEnabled ) + if ( ( error = IVAS_DEC_GetDelay( hIvasDec, pFullDelayNumSamples, delayTimeScale ) ) != IVAS_ERR_OK ) { - if ( ( error = IVAS_DEC_GetDelay( hIvasDec, pFullDelayNumSamples, delayTimeScale ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); - return error; - } + fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); + return error; } - else + + if ( !arg.delayCompensationEnabled ) { - *pFullDelayNumSamples = 0; + pFullDelayNumSamples[0] = 0; } - *pRemainingDelayNumSamples = *pFullDelayNumSamples; + *pRemainingDelayNumSamples = pFullDelayNumSamples[0]; if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, pNumOutChannels ) ) != IVAS_ERR_OK ) { @@ -1240,15 +1565,15 @@ static ivas_error initOnFirstGoodFrame( /* If outputting MASA, open output file and write metadata for initial bad frames */ else if ( *pBsFormat == IVAS_DEC_BS_MASA ) { - if ( ( error = MasaFileWriter_open( arg.outputWavFilename, ppMasaWriter ) ) != IVAS_ERR_OK ) + if ( ( error = MasaFileWriter_open( arg.outputWavFilename, arg.delayCompensationEnabled, ppMasaWriter ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Error opening MASA decoded metadata file %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); return error; } /* Duplicate good first frame metadata to fill the beginning of stream. */ - IVAS_MASA_QMETADATA_HANDLE qMetadata = NULL; - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK ) + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); return error; @@ -1256,7 +1581,7 @@ static ivas_error initOnFirstGoodFrame( for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { - if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, qMetadata ) ) != IVAS_ERR_OK ) + if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); return error; @@ -1278,6 +1603,8 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, + HeadRotFileReader *refRotReader, + Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ) @@ -1295,12 +1622,13 @@ static ivas_error decodeG192( int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */ int16_t nOutChannels = 0; int16_t delayNumSamples = -1; - int16_t delayNumSamples_orig = 0; + int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */ int16_t nOutSamples = 0; int32_t delayTimeScale = 0; ivas_error error = IVAS_ERR_UNKNOWN; uint16_t numObj = 0; IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) @@ -1318,6 +1646,8 @@ static ivas_error decodeG192( fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" ); } + delayNumSamples_orig[0] = -1; + #ifdef WMOPS reset_stack(); reset_wmops(); @@ -1366,24 +1696,58 @@ static ivas_error decodeG192( goto cleanup; } + /* reference vector */ + if ( arg.enableReferenceVectorTracking ) + { + IVAS_VECTOR3 listenerPosition, referencePosition; + if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } + /* Reference rotation */ + if ( arg.enableReferenceRotation ) + { + IVAS_QUATERNION quaternion; + if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) { IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; - if ( ( error = HeadRotationFileReading( headRotReader, Quaternions, frame ) ) != IVAS_ERR_OK ) + for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) ); - goto cleanup; + 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 ), HeadRotationFileReader_getFilePath( headRotReader ) ); + goto cleanup; + } } - if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } } - /* Run decoder for one frame (get rendered output) */ if ( ( error = IVAS_DEC_GetSamples( hIvasDec, pcmBuf, &nOutSamples ) ) != IVAS_ERR_OK ) { @@ -1408,7 +1772,7 @@ static ivas_error decodeG192( arg, numInitialBadFrames, nOutSamples, - &delayNumSamples_orig, + delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, @@ -1447,7 +1811,7 @@ static ivas_error decodeG192( } } - /* Write ISm metadata to external file(s) */ + /* Write ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) @@ -1477,14 +1841,14 @@ static ivas_error decodeG192( } else if ( bsFormat == IVAS_DEC_BS_MASA ) { - IVAS_MASA_QMETADATA_HANDLE qMetadata; - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK ) + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } - if ( ( error = MasaFileWriter_writeFrame( masaWriter, qMetadata ) ) != IVAS_ERR_OK ) + if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; @@ -1504,24 +1868,39 @@ static ivas_error decodeG192( #endif } #ifdef WMOPS + update_mem(); update_wmops(); -#ifdef MEM_COUNT_DETAILS - export_mem( "mem_analysis.csv" ); -#endif #endif } /*------------------------------------------------------------------------------------------* - * Printouts after decoding has finished + * Add zeros at the end to have equal length of synthesized signals *------------------------------------------------------------------------------------------*/ - if ( !arg.quietModeEnabled ) + memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); + if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) { - fprintf( stdout, "\nDecoder delay: %-5u [samples] - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale ); + fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); + goto cleanup; } - /* Print output metadata file name(s) */ - if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + /*------------------------------------------------------------------------------------------* + * Printouts after decoding has finished + *------------------------------------------------------------------------------------------*/ + + if ( !arg.quietModeEnabled ) + { + printf( "\n\nDecoder+renderer delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale ); + + if ( delayNumSamples_orig[2] > 0 ) + { + printf( "HRIR/BRIR delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale ); + printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale ); + } + } + + /* Print output metadata file name(s) */ + if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -1537,14 +1916,6 @@ static ivas_error decodeG192( } } - /* add zeros at the end to have equal length of synthesized signals */ - memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); - goto cleanup; - } - /*------------------------------------------------------------------------------------------* * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ @@ -1694,8 +2065,13 @@ static ivas_error decodeVoIP( uint32_t nextPacketRcvTime_ms = 0; uint32_t systemTime_ms = 0; +#ifdef JBM_TSM_ON_TCS + uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS; + int32_t nFramesWritten = 0; +#endif int32_t nFramesFed = 0; + uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3]; int16_t auSize; uint16_t rtpSequenceNumber; @@ -1714,7 +2090,7 @@ static ivas_error decodeVoIP( #endif JbmOffsetFileWriter *jbmOffsetWriter = NULL; - int16_t delayNumSamples_orig = -1; + int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */ int16_t delayNumSamples = -1; int32_t delayTimeScale = -1; @@ -1728,11 +2104,13 @@ static ivas_error decodeVoIP( IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; + for ( int16_t i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { ismWriters[i] = NULL; } + delayNumSamples_orig[0] = -1; rtpdumpDepacker.rtpdump = NULL; switch ( arg.inputFormat ) @@ -1826,10 +2204,27 @@ static ivas_error decodeVoIP( * Main receiving/decoding loop *------------------------------------------------------------------------------------------*/ +#ifdef JBM_TSM_ON_TCS +#ifdef DEBUG_JBM_CMD_OPTION + systemTimeInc_ms = arg.frontendFetchSizeMs; +#endif +#endif + while ( 1 ) { int16_t nOutSamples = 0; - +#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) + uint16_t nSamplesAvailableNext = 0; +#endif +#ifdef JBM_TSM_ON_TCS +#ifdef DEBUG_JBM_CMD_OPTION + nOutSamples = (int16_t) ( arg.output_Fs / 1000 * arg.frontendFetchSizeMs ); +#else + nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS ); +#endif +#else + nOutSamples = (int16_t) ( arg.output_Fs / 50 ); +#endif /* read all packets with a receive time smaller than the system time */ while ( nextPacketRcvTime_ms <= systemTime_ms ) { @@ -1873,15 +2268,24 @@ static ivas_error decodeVoIP( /* we are finished when all packets have been received and jitter buffer is empty */ /* also stop when the input file contains less than two frames, because JBM cannot calculate a delay value and won't start decoding */ +#ifdef JBM_TSM_ON_TCS + /* last clause should make sure that for BE tests we end up with the same number of samples...*/ + if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples ) || nFramesFed < 2 ) ) +#else if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec ) || nFramesFed < 2 ) ) +#endif { break; } - nOutSamples = (int16_t) ( arg.output_Fs / 50 ); /* decode and get samples */ - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, + pcmBuf, systemTime_ms +#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) + , + &nSamplesAvailableNext +#endif #ifdef SUPPORT_JBM_TRACEFILE , writeJbmTraceFileFrameWrapper, @@ -1929,7 +2333,7 @@ static ivas_error decodeVoIP( arg, numInitialBadFrames, nOutSamples, - &delayNumSamples_orig, + delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, @@ -1943,7 +2347,11 @@ static ivas_error decodeVoIP( goto cleanup; } } +#ifdef DEBUG_JBM_CMD_OPTION + else if ( arg.noBadFrameDelay == false ) +#else else +#endif { ++numInitialBadFrames; } @@ -1966,6 +2374,55 @@ static ivas_error decodeVoIP( { delayNumSamples -= nOutSamples; } + +#ifdef JBM_TSM_ON_TCS + /* Write ISM metadata to external file(s) */ + if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + { + int16_t i; + + if ( bsFormat == IVAS_DEC_BS_OBJ ) + { + if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + for ( i = 0; i < numObj; ++i ) + { + IVAS_ISM_METADATA IsmMetadata; + + if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); + goto cleanup; + } + } + } + else if ( bsFormat == IVAS_DEC_BS_MASA ) + { + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); + goto cleanup; + } + } + } +#endif } if ( !arg.quietModeEnabled ) @@ -1974,19 +2431,25 @@ static ivas_error decodeVoIP( } frame++; +#ifdef JBM_TSM_ON_TCS + systemTime_ms += systemTimeInc_ms; + nFramesWritten++; +#else systemTime_ms += 20; +#endif #ifdef WMOPS + update_mem(); update_wmops(); -#ifdef MEM_COUNT_DETAILS - export_mem( "mem_analysis.csv" ); -#endif #endif } - /* add zeros at the end to have equal length of synthesized signals */ - memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK ) + /*------------------------------------------------------------------------------------------* + * Add zeros at the end to have equal length of synthesized signals + *------------------------------------------------------------------------------------------*/ + + 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; @@ -1998,7 +2461,13 @@ static ivas_error decodeVoIP( if ( !arg.quietModeEnabled ) { - printf( "\nDecoder delay: %5u [samples] - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale ); + printf( "\n\nDecoder+renderer delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale ); + + if ( delayNumSamples_orig[2] > 0 ) + { + printf( "HRIR/BRIR delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale ); + printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale ); + } } /*------------------------------------------------------------------------------------------* @@ -2025,6 +2494,547 @@ cleanup: } +#ifdef VARIABLE_SPEED_DECODING +/*---------------------------------------------------------------------* + * decodeVariableSpeed() + * + * Read G.192 or decode with variable Speed + *---------------------------------------------------------------------*/ + +static ivas_error decodeVariableSpeed( + DecArguments arg, + BS_READER_HANDLE hBsReader, + HeadRotFileReader *headRotReader, + HeadRotFileReader *refRotReader, + Vector3PairFileReader *referenceVectorReader, + IVAS_DEC_HANDLE hIvasDec ) + +{ + bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ + uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8]; + int16_t i, num_bits; + int16_t bfi = 0; +#ifdef DEBUGGING + int16_t fec_seed = 12558; /* FEC_SEED */ +#endif + AudioFileWriter *afWriter = NULL; + MasaFileWriter *masaWriter = NULL; + bool decodedGoodFrame = false; + int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */ + int16_t nOutChannels = 0; + int16_t delayNumSamples = -1; + int16_t delayNumSamples_orig[3]; + int16_t nOutSamples = 0; + int32_t delayTimeScale = 0; + ivas_error error = IVAS_ERR_UNKNOWN; + uint16_t numObj = 0; + IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; + uint16_t nSamplesAvailableNext; + int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; +#ifdef SUPPORT_JBM_TRACEFILE + JbmTraceFileWriter *jbmTraceWriter = NULL; +#endif + TsmScaleFileReader *tsmScaleFileReader = NULL; + IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t scale; + for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) + { + ismWriters[i] = NULL; + } + + /*------------------------------------------------------------------------------------------* + * Open TSM scale file + *------------------------------------------------------------------------------------------*/ + + if ( arg.tsmScaleFileEnabled ) + { + if ( ( tsmScaleFileReader = TsmScaleFileReader_open( arg.tsmScaleFileName ) ) == NULL ) + { + fprintf( stderr, "\nError: Can't open TSM scale file %s \n\n", arg.tsmScaleFileName ); + goto cleanup; + } + } + + if ( !arg.quietModeEnabled ) + { + fprintf( stdout, "\n------ Running the decoder ------\n\n" ); + fprintf( stdout, "Frames processed: " ); + } + else + { + fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" ); + } + + delayNumSamples_orig[0] = -1; + +#ifdef WMOPS + reset_stack(); + reset_wmops(); +#endif + nSamplesAvailableNext = 0; + nOutSamples = (int16_t) ( arg.output_Fs / 1000 * VARIABLE_SPEED_FETCH_FRAMESIZE_MS ); + /*------------------------------------------------------------------------------------------* + * Loop for every packet (frame) of bitstream data + * - Read the bitstream packet + * - Run the decoder + * - Write the synthesized signal into output file + *------------------------------------------------------------------------------------------*/ + + while ( 1 ) + { + /* Read next frame if not enough samples availble */ + + /* reference vector */ + if ( arg.enableReferenceVectorTracking ) + { + IVAS_VECTOR3 listenerPosition, referencePosition; + if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } + /* Reference rotation */ + if ( arg.enableReferenceRotation ) + { + IVAS_QUATERNION quaternion; + if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } + /* Head-tracking input simulation */ + if ( arg.enableHeadRotation ) + { + IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; + + for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + 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 ), HeadRotationFileReader_getFilePath( headRotReader ) ); + goto cleanup; + } + } + + if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } + + /* decode and get samples */ + do + { + error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, + pcmBuf, 0, + &nSamplesAvailableNext +#ifdef SUPPORT_JBM_TRACEFILE + , + writeJbmTraceFileFrameWrapper, + jbmTraceWriter +#endif + ); + if ( error != IVAS_ERR_OK && error != IVAS_ERR_VS_FRAME_NEEDED ) + + { + fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + if ( error == IVAS_ERR_VS_FRAME_NEEDED ) + { + if ( arg.tsmScaleFileEnabled ) + { + if ( ( error = TsmScaleFileReader_readScale( tsmScaleFileReader, &scale ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); + goto cleanup; + } + IVAS_DEC_VoIP_SetScale( hIvasDec, scale ); + } + + if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK ) + { + if ( error == IVAS_ERR_END_OF_FILE ) + { + break; + } + fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); + goto cleanup; + } + +#ifdef DEBUGGING + /* Random FEC simulation */ + if ( arg.FER > 0.0f ) + { + float ftmp = (float) app_own_random( &fec_seed ) + 32768.0f; + if ( ftmp <= arg.FER / 100.0f * 65535.0f ) + { + bfi = 1; + } + else + { + bfi = 0; + } + } +#endif + + /* Feed into decoder */ + if ( ( error = IVAS_DEC_FeedFrame_Serial( hIvasDec, bit_stream, num_bits, bfi ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: could not feed frame to decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + error = IVAS_ERR_VS_FRAME_NEEDED; + } + } while ( error != IVAS_ERR_OK ); + + if ( error == IVAS_ERR_END_OF_FILE ) + { + break; + } + + /* Continue checking for first good frame until it is found */ + if ( !decodedGoodFrame ) + { + if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error ); + goto cleanup; + } + + /* Once good frame decoded, catch up */ + if ( decodedGoodFrame ) + { + error = initOnFirstGoodFrame( + hIvasDec, + arg, + numInitialBadFrames, + nOutSamples, + delayNumSamples_orig, + &delayNumSamples, + &delayTimeScale, + &bsFormat, + &afWriter, + &masaWriter, + ismWriters, + &nOutChannels, + &numObj ); + if ( error != IVAS_ERR_OK ) + { + goto cleanup; + } + } + else + { + ++numInitialBadFrames; + } + } + + + /* 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 + { + delayNumSamples -= nOutSamples; + } + } + + /* Write ISm metadata to external file(s) */ + if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + { + if ( bsFormat == IVAS_DEC_BS_OBJ ) + { + if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + for ( i = 0; i < numObj; ++i ) + { + IVAS_ISM_METADATA IsmMetadata; + + if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); + goto cleanup; + } + } + } + else if ( bsFormat == IVAS_DEC_BS_MASA ) + { + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); + goto cleanup; + } + } + } + + frame++; + if ( !arg.quietModeEnabled ) + { + fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); +#ifdef DEBUGGING + if ( IVAS_DEC_GetBerDetectFlag( hIvasDec ) ) + { + fprintf( stdout, "\n Decoding error: BER detected in frame %d !!!!!\n", frame - 1 ); + } +#endif + } +#ifdef WMOPS + update_wmops(); +#ifdef MEM_COUNT_DETAILS + export_mem( "mem_analysis.csv" ); +#endif +#endif + } + + + /*------------------------------------------------------------------------------------------* + * Flush what is still left in the VoIP Buffers.... + *------------------------------------------------------------------------------------------*/ + while ( nSamplesAvailableNext > 0 ) + { + int16_t nSamplesFlushed; + + /* Feed into decoder */ + + /* reference vector */ + if ( arg.enableReferenceVectorTracking ) + { + IVAS_VECTOR3 listenerPosition, referencePosition; + if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } + /* Reference rotation */ + if ( arg.enableReferenceRotation ) + { + IVAS_QUATERNION quaternion; + if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } + /* Head-tracking input simulation */ + if ( arg.enableHeadRotation ) + { + IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES]; + + for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + 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 ), HeadRotationFileReader_getFilePath( headRotReader ) ); + goto cleanup; + } + } + + if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + } + + /* decode and get samples */ + if ( ( error = IVAS_DEC_VoIP_Flush( hIvasDec, nOutSamples, + pcmBuf, + &nSamplesAvailableNext, + &nSamplesFlushed ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + + /* Write current frame */ + + if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, nSamplesFlushed * nOutChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nOutput audio file writer error\n" ); + goto cleanup; + } + + + /* Write ISm metadata to external file(s) */ + if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + { + if ( bsFormat == IVAS_DEC_BS_OBJ ) + { + if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + for ( i = 0; i < numObj; ++i ) + { + IVAS_ISM_METADATA IsmMetadata; + + if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); + goto cleanup; + } + } + } + else if ( bsFormat == IVAS_DEC_BS_MASA ) + { + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta; + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); + goto cleanup; + } + } + } + + frame++; + if ( !arg.quietModeEnabled ) + { + fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); +#ifdef DEBUGGING + if ( IVAS_DEC_GetBerDetectFlag( hIvasDec ) ) + { + fprintf( stdout, "\n Decoding error: BER detected in frame %d !!!!!\n", frame - 1 ); + } +#endif + } + } + /*------------------------------------------------------------------------------------------* + * Printouts after decoding has finished + *------------------------------------------------------------------------------------------*/ + + if ( !arg.quietModeEnabled ) + { + printf( "\n\nDecoder+renderer delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale ); + + if ( delayNumSamples_orig[2] > 0 ) + { + printf( "HRIR/BRIR delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[2] / (float) delayTimeScale, delayNumSamples_orig[2], delayTimeScale ); + printf( "Total delay: %4.2f ms (%3u samples at timescale %5u)\n", 1000.f * ( delayNumSamples_orig[1] + delayNumSamples_orig[2] ) / (float) delayTimeScale, delayNumSamples_orig[1] + delayNumSamples_orig[2], delayTimeScale ); + } + } + + /* Print output metadata file name(s) */ + if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + { + if ( bsFormat == IVAS_DEC_BS_OBJ ) + { + for ( i = 0; i < numObj; i++ ) + { + fprintf( stdout, "\nOutput metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); + } + fprintf( stdout, "\n" ); + } + else if ( bsFormat == IVAS_DEC_BS_MASA ) + { + fprintf( stdout, "\nOutput metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); + } + } + + /* add zeros at the end to have equal length of synthesized signals */ + 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; + } + + /*------------------------------------------------------------------------------------------* + * Close files and deallocate resources + *------------------------------------------------------------------------------------------*/ + + decodingFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ + +cleanup: + + AudioFileWriter_close( &afWriter ); + MasaFileWriter_close( &masaWriter ); + TsmScaleFileReader_close( &tsmScaleFileReader ); + for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) + { + IsmFileWriter_close( &ismWriters[i] ); + } + + if ( decodingFailed && error == IVAS_ERR_OK ) + { + return IVAS_ERR_UNKNOWN; + } + + return error; +} + +#endif + #ifdef DEBUGGING /*---------------------------------------------------------------------* * parseForcedRendModeDec() diff --git a/apps/encoder.c b/apps/encoder.c index 205043d19dd19278c30eb48aa76286df766b69d3..fe78bb017ae9f565dd860f1f2af3761365f463e9 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -33,7 +33,6 @@ #include #include #include -#include "options.h" #include "lib_enc.h" #include "cmdl_tools.h" #include "audio_file_reader.h" @@ -112,6 +111,9 @@ typedef struct IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig; const char *ca_config_file; bool mimeOutput; +#ifdef COMPLEXITY_LEVEL_INDICATION + IVAS_ENC_COMPLEXITY_LEVEL complexityLevel; +#endif #ifdef DEBUGGING IVAS_ENC_FORCED_MODE forcedMode; @@ -127,6 +129,7 @@ typedef struct #endif #endif bool pca; + bool ism_extended_metadata; } EncArguments; @@ -230,24 +233,6 @@ int main( goto cleanup; } - /*------------------------------------------------------------------------------------------* - * Open input audio file - *------------------------------------------------------------------------------------------*/ - - int32_t inFileSampleRate = 0; - - if ( AudioFileReader_open( &audioReader, arg.inputWavFilename, &inFileSampleRate ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nCan't open %s\n\n", arg.inputWavFilename ); - goto cleanup; - } - if ( inFileSampleRate != 0 && /* inFileSampleRate will remain zero if input file is raw PCM */ - inFileSampleRate != arg.inputFs ) - { - fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", arg.inputFs, inFileSampleRate, arg.inputWavFilename ); - goto cleanup; - } - /*------------------------------------------------------------------------------------------* * Open output bitstream file *------------------------------------------------------------------------------------------*/ @@ -418,7 +403,7 @@ int main( } break; case IVAS_ENC_INPUT_ISM: - if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects, arg.ism_extended_metadata ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; @@ -476,6 +461,65 @@ int main( goto cleanup; } + /*------------------------------------------------------------------------------------------* + * Open input audio file + *------------------------------------------------------------------------------------------*/ + + if ( AudioFileReader_open( &audioReader, arg.inputWavFilename ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nCan't open %s\n\n", arg.inputWavFilename ); + goto cleanup; + } + + /* Validate input sampling rate */ + int32_t inFileSampleRate = 0; + error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate ); + switch ( error ) + { + case IVAS_ERR_OK: + if ( inFileSampleRate != arg.inputFs ) + { + fprintf( stderr, "\nSampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n\n", arg.inputFs, inFileSampleRate, arg.inputWavFilename ); + goto cleanup; + } + break; + case IVAS_ERR_SAMPLING_RATE_UNKNOWN: + /* IVAS_ERR_SAMPLING_RATE_UNKNOWN will be returned for raw PCM files. + * Nothing to check here */ + break; + default: + fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); + goto cleanup; + } + + + /* Validate number of channels */ + int16_t encInNumChannels = 0; + if ( ( error = IVAS_ENC_GetNumInChannels( hIvasEnc, &encInNumChannels ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); + goto cleanup; + } + int16_t inFileNumChannels = 0; + error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); + switch ( error ) + { + case IVAS_ERR_OK: + if ( inFileNumChannels != encInNumChannels ) + { + fprintf( stderr, "\nNumber of input audio channels mismatch: %d accepted by encoder, but %d found in file %s\n\n", encInNumChannels, inFileNumChannels, arg.inputWavFilename ); + goto cleanup; + } + break; + case IVAS_ERR_NUM_CHANNELS_UNKNOWN: + /* IVAS_ERR_NUM_CHANNELS_UNKNOWN will be returned for raw PCM files. + * Nothing to check here */ + break; + default: + fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); + goto cleanup; + } + /*------------------------------------------------------------------------------------------* * Open input metadata files *------------------------------------------------------------------------------------------*/ @@ -726,7 +770,7 @@ int main( } #endif - /* Read ISm input metadata */ + /* Read ISM input metadata */ for ( i = 0; i < numIsmInputs; ++i ) { if ( ismReaders[i] == NULL ) @@ -786,10 +830,8 @@ int main( } #ifdef WMOPS + update_mem(); update_wmops(); -#ifdef MEM_COUNT_DETAILS - export_mem( "mem_analysis.csv" ); -#endif #endif } @@ -905,6 +947,10 @@ static void initArgStruct( EncArguments *arg ) arg->caConfig = IVAS_ENC_GetDefaultChannelAwareConfig(); arg->ca_config_file = NULL; arg->mimeOutput = false; + arg->ism_extended_metadata = false; +#ifdef COMPLEXITY_LEVEL_INDICATION + arg->complexityLevel = IVAS_ENC_COMPLEXITY_LEVEL_THREE; +#endif #ifdef DEBUGGING arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; @@ -961,7 +1007,9 @@ static bool parseCmdlIVAS_enc( while ( i < argc - 4 ) { strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); + argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; to_upper( argv_to_upper ); + /*-----------------------------------------------------------------* * Bandwidth limitation *-----------------------------------------------------------------*/ @@ -971,6 +1019,7 @@ static bool parseCmdlIVAS_enc( arg->max_bwidth_user = true; strncpy( stmp, argv[i + 1], sizeof( stmp ) - 1 ); + stmp[sizeof( stmp ) - 1] = '\0'; to_upper( stmp ); if ( strcmp( stmp, "-NB" ) == 0 || strcmp( stmp, "NB" ) == 0 ) @@ -1158,19 +1207,32 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { strncpy( stmp, argv[i], sizeof( stmp ) ); - + stmp[sizeof( stmp ) - 1] = '\0'; +#ifdef FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING + to_upper( stmp ); + if ( strcmp( stmp, "LO" ) == 0 ) +#else to_upper( argv[i] ); if ( strcmp( argv[i], "LO" ) == 0 ) +#endif { arg->caConfig.fec_indicator = IVAS_ENC_FEC_LO; } +#ifdef FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING + else if ( strcmp( stmp, "HI" ) == 0 ) +#else else if ( strcmp( argv[i], "HI" ) == 0 ) +#endif { arg->caConfig.fec_indicator = IVAS_ENC_FEC_HI; } else { +#ifdef FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING + arg->ca_config_file = argv[i]; +#else arg->ca_config_file = stmp; +#endif } i++; @@ -1206,6 +1268,32 @@ static bool parseCmdlIVAS_enc( ++i; } + +#ifdef COMPLEXITY_LEVEL_INDICATION + /*-----------------------------------------------------------------* + * Complexity Level + *-----------------------------------------------------------------*/ + + /* actual parsing of level will be implemented after characterization */ + else if ( strcmp( argv_to_upper, "-LEVEL" ) == 0 ) + { + int16_t level; + + ++i; + level = (int16_t) atoi( argv[i++] ); + if ( level < IVAS_ENC_COMPLEXITY_LEVEL_ONE || level > IVAS_ENC_COMPLEXITY_LEVEL_THREE ) + { + fprintf( stdout, "Invalid complexity level specified.\n" ); + usage_enc(); + return false; + } + else if ( level == IVAS_ENC_COMPLEXITY_LEVEL_ONE || level == IVAS_ENC_COMPLEXITY_LEVEL_TWO ) + { + fprintf( stdout, "Complexity levels 1 and 2 will be defined after characterisation - default to level 3 (full functionality).\n" ); + } + } +#endif + /*-----------------------------------------------------------------* * IVAS Formats *-----------------------------------------------------------------*/ @@ -1294,6 +1382,11 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { + if ( argv[i][0] == '+' ) + { + argv[i]++; + arg->ism_extended_metadata = true; + } if ( !is_digits_only( argv[i] ) ) { fprintf( stderr, "Error: Number of ISM channels must be an integer number!\n\n" ); @@ -1446,23 +1539,23 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { - if ( strcmp( to_upper( argv[i] ), "5_1" ) == 0 ) + if ( strcmp( argv[i], "5_1" ) == 0 ) { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1; } - else if ( strcmp( to_upper( argv[i] ), "7_1" ) == 0 ) + else if ( strcmp( argv[i], "7_1" ) == 0 ) { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1; } - else if ( strcmp( to_upper( argv[i] ), "5_1_2" ) == 0 ) + else if ( strcmp( argv[i], "5_1_2" ) == 0 ) { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_2; } - else if ( strcmp( to_upper( argv[i] ), "5_1_4" ) == 0 ) + else if ( strcmp( argv[i], "5_1_4" ) == 0 ) { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4; } - else if ( strcmp( to_upper( argv[i] ), "7_1_4" ) == 0 ) + else if ( strcmp( argv[i], "7_1_4" ) == 0 ) { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1_4; } @@ -1663,8 +1756,13 @@ static void usage_enc( void ) fprintf( stdout, " *VBR mode (average bitrate),\n" ); fprintf( stdout, " for AMR-WB IO modes R = (6600, 8850, 12650, 14250, 15850, 18250,\n" ); fprintf( stdout, " 19850, 23050, 23850) \n" ); - fprintf( stdout, " for IVAS stereo & ISm R =(13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" ); + fprintf( stdout, " for IVAS stereo R = (13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" ); fprintf( stdout, " 96000, 128000, 160000, 192000, 256000) \n" ); + fprintf( stdout, " for IVAS ISM R = 13200 for 1 ISM, 16400 for 1 ISM and 2 ISM, \n" ); + fprintf( stdout, " (24400, 32000, 48000, 64000, 80000, 96000, 128000) \n" ); + fprintf( stdout, " for 2 ISM, 3 ISM and 4 ISM also 160000, 192000, 256000) \n" ); + fprintf( stdout, " for 3 ISM and 4 ISM also 384000 \n" ); + fprintf( stdout, " for 4 ISM also 512000 \n" ); fprintf( stdout, " for IVAS SBA, MASA, MC R=(13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" ); fprintf( stdout, " 96000, 128000, 160000, 192000, 256000, 384000, 512000) \n" ); fprintf( stdout, " Alternatively, R can be a bitrate switching file which consists of R values\n" ); @@ -1678,10 +1776,10 @@ static void usage_enc( void ) fprintf( stdout, "Options:\n" ); fprintf( stdout, "--------\n" ); fprintf( stdout, "EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc\n" ); - fprintf( stdout, "-stereo [Mode] : Stereo format, default is unified stereo \n" ); - fprintf( stdout, " optional for Mode: 1: DFT Stereo, 2: TD Stereo, 3: MDCT Stereo\n" ); - fprintf( stdout, "-ism Channels Files : ISm format \n" ); - fprintf( stdout, " where Channels specifies the number of ISms (1-4)\n" ); + fprintf( stdout, "-stereo : Stereo format \n" ); + fprintf( stdout, "-ism (+)Ch Files : ISM format \n" ); + fprintf( stdout, " where Ch specifies the number of ISMs (1-4)\n" ); + fprintf( stdout, " where positive (+) indicates extended metadata (only 64 kbps and up) \n" ); fprintf( stdout, " and Files specify input files containing metadata, one file per object\n" ); fprintf( stdout, " (use NULL for no input metadata)\n" ); fprintf( stdout, "-sba +/-Order : Scene Based Audio input format (Ambisonics ACN/SN3D),\n" ); @@ -1689,7 +1787,7 @@ static void usage_enc( void ) fprintf( stdout, " where positive (+) means full 3D and negative (-) only 2D/planar components to be coded\n" ); fprintf( stdout, "-masa Ch File : MASA format \n" ); fprintf( stdout, " where Ch specifies the number of input/transport channels (1 or 2): \n" ); - fprintf( stdout, " and File specifies input file containing parametric metadata \n" ); + fprintf( stdout, " and File specifies input file containing parametric MASA metadata \n" ); fprintf( stdout, "-mc InputConf : Multi-channel format\n" ); fprintf( stdout, " where InputConf specifies the channel configuration: 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4\n" ); fprintf( stdout, " Loudspeaker positions are assumed to have azimuth and elevation as per \n" ); @@ -1699,8 +1797,7 @@ static void usage_enc( void ) fprintf( stdout, " where 0 = adaptive, 3-100 = fixed in number of frames,\n" ); fprintf( stdout, " default is deactivated\n" ); fprintf( stdout, "-dtx : Activate DTX mode with a SID update rate of 8 frames\n" ); - fprintf( stdout, " Note: DTX is currently supported in EVS, stereo, 1 ISm, \n" ); - fprintf( stdout, " SBA (up to 128kbps) and MASA (up to 128kbps)\n" ); + fprintf( stdout, " Note: DTX is supported in EVS, stereo, ISM, SBA up to 80kbps and MASA up to 128kbps \n" ); fprintf( stdout, "-rf p o : Activate channel-aware mode for WB and SWB signal at 13.2kbps, \n" ); fprintf( stdout, " where FEC indicator, p: LO or HI, and FEC offset, o: 2, 3, 5, or 7 in number of frames.\n" ); fprintf( stdout, " Alternatively p and o can be replaced by a rf configuration file with each line \n" ); @@ -1715,6 +1812,8 @@ static void usage_enc( void ) fprintf( stdout, " default output bitstream file format is G.192\n" ); fprintf( stdout, "-bypass mode : SBA PCA by-pass, mode = (1, 2), 1 = PCA off, 2 = signal adaptive, default is 1\n" ); + fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); + fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); #ifdef DEBUGGING fprintf( stdout, "-force T : Force specific mode, T = (speech, music, ACELP, GSC, TCX, HQ),\n" ); fprintf( stdout, " alternatively, T can be a text file where each line contains \"nb_frames T\"\n" ); @@ -1862,7 +1961,7 @@ static ivas_error configureEnc( } break; case IVAS_ENC_INPUT_ISM: - if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects, arg.ism_extended_metadata ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); return error; @@ -1870,24 +1969,17 @@ static ivas_error configureEnc( break; case IVAS_ENC_INPUT_SBA: if ( ( error = - IVAS_ENC_ConfigureForAmbisonics( - hIvasEnc, - arg.inputFs, - totalBitrate, - arg.max_bwidth_user, - bandwidth, - arg.dtxConfig, - arg.inputFormatConfig.sba.order, - arg.inputFormatConfig.sba.isPlanar, + IVAS_ENC_ConfigureForAmbisonics( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, + bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba.order, arg.inputFormatConfig.sba.isPlanar, #ifdef DEBUG_AGC_ENCODER_CMD_OPTION - arg.agc, + arg.agc, #endif - arg.pca + arg.pca #ifdef DEBUG_SBA_AUDIO_DUMP - , - &numTransportChannels + , + &numTransportChannels #endif - ) ) != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForAmbisonics failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); return error; diff --git a/apps/renderer.c b/apps/renderer.c index e5c6aebfd648f68392ae740eda194b5bd5c40b8d..533472b428c854c7a0deba8804e75de4d1c562a4 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -30,23 +30,21 @@ *******************************************************************************************************/ +#include "lib_rend.h" #include #include #include #include -#include #include #include -#include "options.h" #include "audio_file_reader.h" #include "audio_file_writer.h" #include "cmdl_tools.h" #include "cmdln_parser.h" -#include "common_api_types.h" #include "head_rotation_file_reader.h" +#include "vector3_pair_file_reader.h" #include "hrtf_file_reader.h" #include "ism_file_reader.h" -#include "lib_rend.h" #include "ls_custom_file_reader.h" #include "masa_file_reader.h" #include "prot.h" @@ -54,6 +52,10 @@ #include "wmc_auto.h" +/*------------------------------------------------------------------------------------------* + * Local constants + *------------------------------------------------------------------------------------------*/ + #define RENDERER_MAX_CLI_ARG_LENGTH ( FILENAME_MAX ) #define RENDERER_MAX_METADATA_LENGTH 8192 #define RENDERER_MAX_METADATA_LINE_LENGTH 1024 @@ -69,6 +71,11 @@ static #define SEP_FOLDER '/' #endif + +/*------------------------------------------------------------------------------------------* + * Local structures + *------------------------------------------------------------------------------------------*/ + typedef struct { uint32_t frameCounter; @@ -124,10 +131,17 @@ typedef struct char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][RENDERER_MAX_CLI_ARG_LENGTH]; int16_t numInMetadataFiles; char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; + char referenceVectorFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; + char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; int8_t orientationTracking; +#ifdef NON_DIEGETIC_PAN + int16_t nonDiegeticPan; + float nonDiegeticPanGain; +#else float noDiegeticPan; +#endif bool delayCompensationEnabled; bool quietModeEnabled; bool sceneDescriptionInput; @@ -148,9 +162,10 @@ typedef enum CmdLnOptionId_outputFormat, CmdLnOptionId_sampleRate, CmdLnOptionId_trajFile, + CmdLnOptionId_refRotFile, CmdLnOptionId_customHrtfFile, CmdLnOptionId_renderConfigFile, - CmdLnOptionId_noDiegeticPan, + CmdLnOptionId_nonDiegeticPan, CmdLnOptionId_orientationTracking, CmdlnOptionId_lfePosition, CmdlnOptionId_lfeMatrix, @@ -159,6 +174,7 @@ typedef enum CmdLnOptionId_inputMetadata, CmdLnOptionId_listFormats, CmdLnOptionId_inputGain, + CmdLnOptionId_referenceVectorFile, } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { @@ -204,6 +220,12 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "tf", .description = "Head rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", }, + { + .id = CmdLnOptionId_refRotFile, + .match = "reference_rotation_file", + .matchShort = "rf", + .description = "Reference rotation trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", + }, { .id = CmdLnOptionId_customHrtfFile, .match = "custom_hrtf", @@ -217,16 +239,16 @@ static const CmdLnParser_Option cliOptions[] = { .description = "Binaural renderer configuration file (only for BINAURAL and BINAURAL_ROOM outputs)", }, { - .id = CmdLnOptionId_noDiegeticPan, - .match = "no_diegetic_pan", + .id = CmdLnOptionId_nonDiegeticPan, + .match = "non_diegetic_pan", .matchShort = "ndp", - .description = "Panning mono no diegetic sound to stereo -1<= pan <= 1\nleft or l or 1->left, right or r or -1->right, center or c or 0 ->middle\n(todo: implementation)", + .description = "Panning mono non diegetic sound to stereo -90<= pan <= 90\nleft or l or 90->left, right or r or -90->right, center or c or 0 ->middle\n(todo: implementation)", }, { .id = CmdLnOptionId_orientationTracking, .match = "tracking_type", .matchShort = "otr", - .description = "Head orientation tracking type: 'ref' or 'avg' (only for BINAURAL and BINAURAL_ROOM) (todo: check implementation)", + .description = "Head orientation tracking type: 'none', 'ref', 'avg' or `ref_vec` or `ref_vec_lev` (only for BINAURAL and BINAURAL_ROOM)", }, { .id = CmdlnOptionId_lfePosition, @@ -262,98 +284,56 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "l", .description = "List supported audio formats", }, + { + .id = CmdLnOptionId_referenceVectorFile, + .match = "reference_vector_file", + .matchShort = "rvf", + .description = "Reference vector trajectory file for simulation of head tracking (only for BINAURAL and BINAURAL_ROOM outputs)", + }, }; -static const int32_t numCliOptions = sizeof( cliOptions ) / sizeof( CmdLnParser_Option ); -static IVAS_REND_AudioConfig ambisonicsOrderToEnum( - const int16_t order ); +/*------------------------------------------------------------------------------------------* + * Local function prototypes + *------------------------------------------------------------------------------------------*/ -static void parseSceneDescriptionFile( - char *path, - char *audioFilePath, - InputConfig *inConfig, - IsmPositionProvider *positionProvider, - MasaFileReader **masaReaders ); +static const int32_t numCliOptions = sizeof( cliOptions ) / sizeof( CmdLnParser_Option ); -static ivas_error parseCustomLayoutFile( - const char *filePath, - IVAS_CUSTOM_LS_DATA *pLsSetupCustom ); +static IVAS_REND_AudioConfig ambisonicsOrderToEnum( const int16_t order ); -static CmdlnArgs parseCmdlnArgs( - const int argc, - char **argv ); +static void parseSceneDescriptionFile( char *path, char *audioFilePath, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders ); -static IsmPositionProvider *IsmPositionProvider_open( - void ); +static ivas_error parseCustomLayoutFile( const char *filePath, IVAS_CUSTOM_LS_DATA *pLsSetupCustom ); -static void IsmPositionProvider_getNextFrame( - IsmPositionProvider *positionProvider, - ObjectPositionBuffer *objectMetadataBuffer ); +static CmdlnArgs parseCmdlnArgs( const int argc, char **argv ); -static void IsmPositionProvider_close( - IsmPositionProvider *positionProvider ); +static IsmPositionProvider *IsmPositionProvider_open( void ); -static void readFromShorthandMetadata( - IsmPositionProvider *positionProvider, - ObjectPositionBuffer *objectMetadataBuffer, - const uint32_t objIdx ); +static void IsmPositionProvider_getNextFrame( IsmPositionProvider *positionProvider, ObjectPositionBuffer *objectMetadataBuffer ); -void getMetadataFromFileReader( - IsmFileReader *ismReader, - ObjectPositionBuffer *objectMetadataBuffer, - const uint32_t objIdx ); +static void IsmPositionProvider_close( IsmPositionProvider *positionProvider ); -static void splitConfigFile( - const char *mdfFilePath, - char *metadataString, - uint32_t *metadataStringLength, - char *wavFileName, - uint32_t *wavFileNameLength ); - -static char *readNextMetadataChunk( - char *line, - const char *delimiter ); - -static void parseUint8( - const char *line, - uint8_t *ret ); +static void readFromShorthandMetadata( IsmPositionProvider *positionProvider, ObjectPositionBuffer *objectMetadataBuffer, const uint32_t objIdx ); -static void parseUint16( - const char *line, - uint16_t *ret ); +void getMetadataFromFileReader( IsmFileReader *ismReader, ObjectPositionBuffer *objectMetadataBuffer, const uint32_t objIdx ); -static int8_t parseUint32( - const char *line, - uint32_t *ret ); +static void splitConfigFile( const char *mdfFilePath, char *metadataString, uint32_t *metadataStringLength, char *wavFileName, uint32_t *wavFileNameLength ); -static int8_t parseInt32( - const char *line, - int32_t *ret ); +static char *readNextMetadataChunk( char *line, const char *delimiter ); -static void parseObjectPosition( - char *line, - IVAS_REND_AudioObjectPosition *position, - uint16_t *positionDuration ); +static void parseUint8( const char *line, uint8_t *ret ); -static void parseMetadata( - char *metadataString, - char *inDir, - InputConfig *inConfig, - IsmPositionProvider *positionProvider, - MasaFileReader **masaReaders ); +static void parseUint16( const char *line, uint16_t *ret ); -static ivas_error parseLfePanMtxFile( - const char *lfeRoutingMatrixFilePath, - IVAS_REND_LfePanMtx *lfePanMtx ); +static int8_t parseUint32( const char *line, uint32_t *ret ); -static void convert_backslash( char *str ); +static int8_t parseInt32( const char *line, int32_t *ret ); -static void remove_cr( char *str ); +static void parseObjectPosition( char *line, IVAS_REND_AudioObjectPosition *position, uint16_t *positionDuration ); -static void clearString( char *str ); +static void parseMetadata( char *metadataString, char *inDir, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders ); -static bool isEmptyString( const char *str ); +static ivas_error parseLfePanMtxFile( const char *lfeRoutingMatrixFilePath, IVAS_REND_LfePanMtx *lfePanMtx ); static void printSupportedAudioConfigs( void ); @@ -364,7 +344,14 @@ static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSa static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer ); -static IVAS_REND_ReadOnlyAudioBuffer getReadOnlySubBuffer( IVAS_REND_AudioBuffer buffer, const int16_t chBeginIdx, const int16_t numChannels ) +/*------------------------------------------------------------------------------------------* + * Local functions + *------------------------------------------------------------------------------------------*/ + +static IVAS_REND_ReadOnlyAudioBuffer getReadOnlySubBuffer( + IVAS_REND_AudioBuffer buffer, + const int16_t chBeginIdx, + const int16_t numChannels ) { IVAS_REND_ReadOnlyAudioBuffer subBuffer; @@ -375,6 +362,7 @@ static IVAS_REND_ReadOnlyAudioBuffer getReadOnlySubBuffer( IVAS_REND_AudioBuffer return subBuffer; } + static int16_t getTotalNumInChannels( IVAS_REND_HANDLE hIvasRend, IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS], @@ -454,6 +442,7 @@ static int16_t getTotalNumInChannels( return totalNumInChannels; } + static void setupWithSingleFormatInput( CmdlnArgs args, char *audioFilePath, @@ -490,6 +479,7 @@ static void setupWithSingleFormatInput( /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */ char charBuf[FILENAME_MAX]; strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 ); + charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0'; to_upper( charBuf ); if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 ) { @@ -506,6 +496,7 @@ static void setupWithSingleFormatInput( } } + static float dBToLin( const float gain_dB ) { @@ -513,7 +504,11 @@ static float dBToLin( } -/* ============================================================================ */ +/*------------------------------------------------------------------------------------------* + * main() + * + * Main External renderer function for command-line interface + *------------------------------------------------------------------------------------------*/ int main( int argc, @@ -521,6 +516,8 @@ int main( { IVAS_REND_HANDLE hIvasRend; HeadRotFileReader *headRotReader = NULL; + Vector3PairFileReader *referenceVectorReader = NULL; + HeadRotFileReader *referenceRotReader = NULL; hrtfFileReader *hrtfFileReader = NULL; IsmPositionProvider *positionProvider; RenderConfigReader *renderConfigReader = NULL; @@ -544,6 +541,7 @@ int main( int32_t delayTimeScale = 0; int16_t i, numChannels; ivas_error error = IVAS_ERR_OK; + IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; #ifdef WMOPS reset_wmops(); @@ -558,26 +556,72 @@ int main( CmdlnArgs args = parseCmdlnArgs( argc, argv ); +#ifdef NON_DIEGETIC_PAN + if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_MONO ) || + ( args.inConfig.numAudioObjects > 0 && args.inConfig.audioObjects[0].audioConfig == IVAS_REND_AUDIO_CONFIG_OBJECT && args.inConfig.numAudioObjects == 1 ) ) ) + { + fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires mono or ISM1 input\n" ); + exit( -1 ); + } + + if ( args.nonDiegeticPan && args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_STEREO ) + { + fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires stereo output\n" ); + exit( -1 ); + } +#endif + positionProvider = IsmPositionProvider_open(); convert_backslash( args.inputFilePath ); convert_backslash( args.outputFilePath ); convert_backslash( args.headRotationFilePath ); + convert_backslash( args.referenceVectorFilePath ); + convert_backslash( args.referenceRotationFilePath ); convert_backslash( args.inLfePanningMatrixFile ); if ( !isEmptyString( args.headRotationFilePath ) ) { - HeadRotationFileReader_open( args.headRotationFilePath, &headRotReader ); + if ( HeadRotationFileReader_open( args.headRotationFilePath, &headRotReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.headRotationFilePath ); + exit( -1 ); + } + } + + if ( !isEmptyString( args.referenceRotationFilePath ) ) + { + if ( HeadRotationFileReader_open( args.referenceRotationFilePath, &referenceRotReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.referenceRotationFilePath ); + exit( -1 ); + } + } + if ( !isEmptyString( args.referenceVectorFilePath ) ) + { + if ( Vector3PairFileReader_open( args.referenceVectorFilePath, &referenceVectorReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.referenceVectorFilePath ); + exit( -1 ); + } } if ( !isEmptyString( args.customHrtfFilePath ) ) { - hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ); + if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.customHrtfFilePath ); + exit( -1 ); + } } if ( !isEmptyString( args.renderConfigFilePath ) ) { - RenderConfigReader_open( args.renderConfigFilePath, &renderConfigReader ); + if ( RenderConfigReader_open( args.renderConfigFilePath, &renderConfigReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", args.renderConfigFilePath ); + exit( -1 ); + } } /* Initialize main input files, i.e. audio and metadata */ @@ -592,26 +636,48 @@ int main( setupWithSingleFormatInput( args, audioFilePath, positionProvider, masaReaders ); } - int32_t inFileSampleRate = 0; - if ( AudioFileReader_open( &audioReader, audioFilePath, &inFileSampleRate ) != IVAS_ERR_OK ) + if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) { fprintf( stderr, "Error opening file: %s\n", audioFilePath ); exit( -1 ); } - if ( args.sampleRate == 0 && inFileSampleRate == 0 ) + + int32_t inFileSampleRate = 0; + error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate ); + switch ( error ) { - fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" ); - exit( -1 ); + case IVAS_ERR_OK: + /* If sampling rate not given on command line, use the one from wav file */ + if ( args.sampleRate == 0 ) + { + args.sampleRate = inFileSampleRate; + } + /* else if sampling rate given on command line, compare with wav file */ + else if ( inFileSampleRate != args.sampleRate ) + { + fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath ); + exit( -1 ); + } + break; + case IVAS_ERR_SAMPLING_RATE_UNKNOWN: /* Returned when input is raw PCM */ + if ( args.sampleRate == 0 ) + { + fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" ); + exit( -1 ); + } + break; + default: + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); } - if ( args.sampleRate != 0 && inFileSampleRate != 0 && args.sampleRate != inFileSampleRate ) + + int16_t inFileNumChannels = 0; + error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); + if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN ) { - fprintf( stderr, "Sampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath ); + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } - if ( args.sampleRate == 0 ) - { - args.sampleRate = inFileSampleRate; - } const int16_t frameSize_smpls = (int16_t) ( 20 * args.sampleRate / 1000 ); IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 }; @@ -619,15 +685,20 @@ int main( IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS] = { 0 }; IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] = { 0 }; +#ifdef NON_DIEGETIC_PAN + if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) ); exit( -1 ); } /* === Configure === */ - if ( ( error = IVAS_REND_InitConfig( hIvasRend, strlen( args.renderConfigFilePath ) != 0 ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { + fprintf( stderr, "Error in Renderer Config Init\n" ); exit( -1 ); } @@ -636,9 +707,9 @@ int main( IVAS_RENDER_CONFIG_DATA renderConfig; /* sanity check */ - if ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) + if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) { - fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n" ); + fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL or BINAURAL_ROOM is used as output. Exiting. \n" ); exit( -1 ); } @@ -661,6 +732,11 @@ int main( } } + if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) != IVAS_ERR_OK ) + { + return error; + } + /* Set up output custom layout configuration */ if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { @@ -779,8 +855,7 @@ int main( const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds ); - if ( AudioFileReader_getNumChannels( audioReader ) != 0 /* If input file is raw PCM, audio reader has no info about number of channels */ - && totalNumInChannels != AudioFileReader_getNumChannels( audioReader ) ) + if ( inFileNumChannels != 0 /* inFileNumChannels is 0 with raw PCM input */ && totalNumInChannels != inFileNumChannels ) { fprintf( stderr, "Number of channels in input file does not match selected configuration\n" ); exit( -1 ); @@ -861,16 +936,64 @@ int main( ObjectPositionBuffer mtdBuffer; IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); + if ( referenceVectorReader != NULL ) + { + IVAS_VECTOR3 listenerPos, refPos; + if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPos, &refPos ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + if ( ( error = IVAS_REND_SetReferenceVector( hIvasRend, listenerPos, refPos ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + } + /* Read from reference rotation trajectory file if specified */ + if ( referenceRotReader != NULL ) + { + IVAS_QUATERNION quaternion; + if ( ( error = HeadRotationFileReading( referenceRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + + if ( ( error = IVAS_REND_SetReferenceRotation( hIvasRend, quaternion ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error setting Reference Rotation: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + } + /* Read from head rotation trajectory file if specified */ if ( headRotReader != NULL ) { IVAS_QUATERNION quatBuffer[RENDERER_HEAD_POSITIONS_PER_FRAME]; - HeadRotationFileReading( headRotReader, quatBuffer, frame ); - IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ); + + for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ ) + { + if ( ( error = HeadRotationFileReading( headRotReader, &quatBuffer[i], &Pos[i] ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } + } + if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, Pos ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } } else { - IVAS_REND_SetHeadRotation( hIvasRend, NULL ); + error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ); + if ( ( error != IVAS_ERR_OK ) && ( error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC + { + fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } } for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) @@ -950,7 +1073,11 @@ int main( } } - IVAS_REND_GetSamples( hIvasRend, outBuffer ); + if ( IVAS_REND_GetSamples( hIvasRend, outBuffer ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error in getting samples\n" ); + exit( -1 ); + } int16_t num_out_channels; num_out_channels = outBuffer.config.numChannels; @@ -998,10 +1125,8 @@ int main( } #ifdef WMOPS + update_mem(); update_wmops(); -#ifdef MEM_COUNT_DETAILS - export_mem( "mem_analysis.csv" ); -#endif #endif } @@ -1044,6 +1169,8 @@ int main( AudioFileReader_close( &audioReader ); AudioFileWriter_close( &audioWriter ); HeadRotationFileReader_close( &headRotReader ); + Vector3PairFileReader_close( &referenceVectorReader ); + HeadRotationFileReader_close( &referenceRotReader ); hrtfFileReader_close( &hrtfFileReader ); IVAS_REND_Close( &hIvasRend ); IsmPositionProvider_close( positionProvider ); @@ -1057,6 +1184,11 @@ int main( return 0; } + +/*------------------------------------------------------------------------------------------* + * Local functions + *------------------------------------------------------------------------------------------*/ + static IVAS_REND_AudioConfig ambisonicsOrderToEnum( const int16_t order ) { @@ -1102,6 +1234,7 @@ static bool parseInConfig( /* First check if input is being set to scene description file - this is not covered by parseAudioConfig(). */ strncpy( charBuf, inFormatStr, sizeof( charBuf ) - 1 ); + charBuf[sizeof( charBuf ) - 1] = '\0'; to_upper( charBuf ); if ( strcmp( charBuf, "META" ) == 0 ) { @@ -1225,6 +1358,38 @@ static bool parseOutConfig( return true; } +#ifdef NON_DIEGETIC_PAN +static bool parseDiegeticPan( + char *value, + float *nonDiegeticPan ) +{ + to_upper( value ); + + if ( ( strcmp( value, "CENTER" ) == 0 ) || ( strchr( value, 'C' ) != NULL ) ) + { + *nonDiegeticPan = 0.f; + } + else if ( ( strcmp( value, "LEFT" ) == 0 ) || ( strchr( value, 'L' ) != NULL ) ) + { + *nonDiegeticPan = 1.f; + } + else if ( ( strcmp( value, "RIGHT" ) == 0 ) || ( strchr( value, 'R' ) != NULL ) ) + { + *nonDiegeticPan = -1.f; + } + else + { + *nonDiegeticPan = (float) atof( value ) / 90.f; + + if ( *nonDiegeticPan > 1.0f || *nonDiegeticPan < -1.0f ) + { + fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" ); + return false; + } + } + return true; + +#else static bool parseDiegeticPan( char *value, float *noDiegeticPan ) @@ -1254,6 +1419,7 @@ static bool parseDiegeticPan( } } return false; +#endif } static bool parseOrientationTracking( @@ -1263,7 +1429,11 @@ static bool parseOrientationTracking( to_upper( value ); - if ( strcmp( value, "REF" ) == 0 ) + if ( strcmp( value, "NONE" ) == 0 ) + { + *tracking_type = IVAS_ORIENT_TRK_NONE; + } + else if ( strcmp( value, "REF" ) == 0 ) { *tracking_type = IVAS_ORIENT_TRK_REF; } @@ -1271,6 +1441,14 @@ static bool parseOrientationTracking( { *tracking_type = IVAS_ORIENT_TRK_AVG; } + else if ( strcmp( value, "REF_VEC" ) == 0 ) + { + *tracking_type = IVAS_ORIENT_TRK_REF_VEC; + } + else if ( strcmp( value, "REF_VEC_LEV" ) == 0 ) + { + *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV; + } else { fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", value ); @@ -1287,6 +1465,7 @@ static IVAS_REND_AudioConfig parseAudioConfig( charBuf[13] = '\0'; strncpy( charBuf, configString, sizeof( charBuf ) - 1 ); + charBuf[sizeof( charBuf ) - 1] = '\0'; to_upper( charBuf ); if ( ( strcmp( charBuf, "MONO" ) == 0 ) || ( strcmp( charBuf, "HOA0" ) == 0 ) || ( strcmp( charBuf, "SBA0" ) == 0 ) ) @@ -1487,11 +1666,18 @@ static CmdlnArgs defaultArgs( args.numInMetadataFiles = 0; clearString( args.headRotationFilePath ); + clearString( args.referenceVectorFilePath ); + clearString( args.referenceRotationFilePath ); clearString( args.customHrtfFilePath ); clearString( args.renderConfigFilePath ); - args.orientationTracking = IVAS_ORIENT_TRK_REF; + args.orientationTracking = IVAS_ORIENT_TRK_NONE; +#ifdef NON_DIEGETIC_PAN + args.nonDiegeticPan = 0; + args.nonDiegeticPanGain = 0.f; +#else args.noDiegeticPan = 0.0f; +#endif args.delayCompensationEnabled = true; args.quietModeEnabled = false; @@ -1565,6 +1751,14 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; + case CmdLnOptionId_referenceVectorFile: + assert( numOptionValues == 1 ); + strncpy( args->referenceVectorFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); + break; + case CmdLnOptionId_refRotFile: + assert( numOptionValues == 1 ); + strncpy( args->referenceRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); + break; case CmdLnOptionId_customHrtfFile: assert( numOptionValues == 1 ); strncpy( args->customHrtfFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); @@ -1573,13 +1767,20 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->renderConfigFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; - case CmdLnOptionId_noDiegeticPan: + case CmdLnOptionId_nonDiegeticPan: assert( numOptionValues == 1 ); +#ifdef NON_DIEGETIC_PAN + if ( !parseDiegeticPan( optionValues[0], &args->nonDiegeticPanGain ) ) +#else if ( !parseDiegeticPan( optionValues[0], &args->noDiegeticPan ) ) +#endif { fprintf( stderr, "Unknown option for diegetic panning: %s\n", optionValues[0] ); exit( -1 ); } +#ifdef NON_DIEGETIC_PAN + args->nonDiegeticPan = 1; +#endif break; case CmdLnOptionId_orientationTracking: assert( numOptionValues == 1 ); @@ -1655,7 +1856,7 @@ IsmPositionProvider *IsmPositionProvider_open( IsmPositionProvider *ipp; uint16_t i; - ipp = (IsmPositionProvider *) malloc_( sizeof( IsmPositionProvider ) ); + ipp = (IsmPositionProvider *) malloc( sizeof( IsmPositionProvider ) ); ipp->frameCounter = 0; ipp->numObjects = 0; @@ -1681,12 +1882,18 @@ void getMetadataFromFileReader( if ( ( error = IsmFileReader_readNextFrame( ismReader, &ismMetadata ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError (%s) while reading ism metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) ); + fprintf( stderr, "\nError (%s) while reading ISM metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) ); exit( -1 ); } objectMetadataBuffer->positions[objIdx].azimuth = ismMetadata.azimuth; objectMetadataBuffer->positions[objIdx].elevation = ismMetadata.elevation; + objectMetadataBuffer->positions[objIdx].radius = ismMetadata.radius; + objectMetadataBuffer->positions[objIdx].yaw = ismMetadata.yaw; + objectMetadataBuffer->positions[objIdx].pitch = ismMetadata.pitch; +#ifdef ISM_NON_DIEGETIC_PAN + objectMetadataBuffer->positions[objIdx].non_diegetic_flag = ismMetadata.non_diegetic_flag; +#endif return; } @@ -1716,7 +1923,7 @@ void readFromShorthandMetadata( return; } -void IsmPositionProvider_getNextFrame( +static void IsmPositionProvider_getNextFrame( IsmPositionProvider *positionProvider, ObjectPositionBuffer *objectMetadataBuffer ) { @@ -1741,6 +1948,12 @@ void IsmPositionProvider_getNextFrame( { objectMetadataBuffer->positions[objIdx].azimuth = 0.0f; objectMetadataBuffer->positions[objIdx].elevation = 0.0f; + objectMetadataBuffer->positions[objIdx].radius = 1.0f; + objectMetadataBuffer->positions[objIdx].yaw = 0.0f; + objectMetadataBuffer->positions[objIdx].pitch = 0.0f; +#ifdef ISM_NON_DIEGETIC_PAN + objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0; +#endif } /* Wrap azimuth to lie within (-180, 180] range */ @@ -1755,6 +1968,18 @@ void IsmPositionProvider_getNextFrame( /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */ objectMetadataBuffer->positions[objIdx].elevation = min( max( objectMetadataBuffer->positions[objIdx].elevation, -90 ), 90 ); + /* Wrap yaw to lie within (-180, 180] range */ + while ( objectMetadataBuffer->positions[objIdx].yaw < 0.0f ) + { + objectMetadataBuffer->positions[objIdx].yaw += 360.0f; + } + while ( objectMetadataBuffer->positions[objIdx].yaw >= 360.0f ) + { + objectMetadataBuffer->positions[objIdx].yaw -= 360.0f; + } + + /* Clamp pitch to lie within [-90, 90] range (can't be wrapped easily) */ + objectMetadataBuffer->positions[objIdx].pitch = min( max( objectMetadataBuffer->positions[objIdx].pitch, -90 ), 90 ); } ++positionProvider->frameCounter; @@ -1762,7 +1987,8 @@ void IsmPositionProvider_getNextFrame( return; } -void IsmPositionProvider_close( IsmPositionProvider *positionProvider ) +static void IsmPositionProvider_close( + IsmPositionProvider *positionProvider ) { uint32_t i; @@ -1988,33 +2214,38 @@ static void parseObjectPosition( uint16_t *positionDuration ) { char *endptr; + int16_t read_values; +#ifdef ISM_NON_DIEGETIC_PAN + float meta_prm[8] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f }; +#else + float meta_prm[7] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }; +#endif - readNextMetadataChunk( line, "," ); - *positionDuration = (uint16_t) strtol( line, &endptr, 10 ); - - if ( *endptr != '\0' ) - { - fprintf( stderr, "Error reading metadata\n" ); - exit( -1 ); - } readNextMetadataChunk( line, "," ); - position->azimuth = strtof( line, &endptr ); + *positionDuration = (uint16_t) strtol( line, &endptr, 10 ); + readNextMetadataChunk( line, "\n" ); - if ( *endptr != '\0' ) - { - fprintf( stderr, "Error reading metadata\n" ); - exit( -1 ); - } +#ifdef ISM_NON_DIEGETIC_PAN + read_values = (int16_t) sscanf( line, "%f,%f,%f,%f,%f,%f,%f,%f", &meta_prm[0], &meta_prm[1], &meta_prm[2], &meta_prm[3], &meta_prm[4], &meta_prm[5], &meta_prm[6], &meta_prm[7] ); +#else + read_values = (int16_t) sscanf( line, "%f,%f,%f,%f,%f,%f,%f", &meta_prm[0], &meta_prm[1], &meta_prm[2], &meta_prm[3], &meta_prm[4], &meta_prm[5], &meta_prm[6] ); +#endif - readNextMetadataChunk( line, "\n" ); - position->elevation = strtof( line, &endptr ); - if ( *endptr != '\0' ) + if ( read_values < 2 ) { fprintf( stderr, "Error reading metadata\n" ); exit( -1 ); } + position->azimuth = meta_prm[0]; + position->elevation = meta_prm[1]; + position->radius = meta_prm[2]; + position->yaw = meta_prm[5]; + position->pitch = meta_prm[6]; +#ifdef ISM_NON_DIEGETIC_PAN + position->non_diegetic_flag = (int16_t) meta_prm[7]; +#endif return; } @@ -2038,8 +2269,8 @@ static void parseIsm( if ( parseUint32( line, &numberOfObjectPositionsToRead ) == 0 ) { positionProvider->numPositions[idx] = numberOfObjectPositionsToRead; - positionProvider->positions[idx] = malloc_( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) ); - positionProvider->positionDurations[idx] = malloc_( numberOfObjectPositionsToRead * sizeof( uint16_t ) ); + positionProvider->positions[idx] = malloc( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) ); + positionProvider->positionDurations[idx] = malloc( numberOfObjectPositionsToRead * sizeof( uint16_t ) ); for ( i = 0; i < numberOfObjectPositionsToRead; ++i ) { @@ -2339,6 +2570,8 @@ static void parseSceneDescriptionFile( strncat( audioFilePath, inAudioFilePath, inAudioFilePathLen ); parseMetadata( mtdStr, inDir, inConfig, positionProvider, masaReaders ); + + return; } static void printSupportedAudioConfigs() @@ -2432,64 +2665,10 @@ static ivas_error parseLfePanMtxFile( } fclose( mtxFile ); - return IVAS_ERR_OK; -} - -// VE2AT: possibly move these functions to cmdln_parser.c ? -static void convert_backslash( - char *str ) -{ - int16_t i, len; - - /* check that all backslashes are correct on the given platform */ - len = (int16_t) strlen( str ); - - for ( i = 0; i < len; i++ ) - { -#ifdef _WIN32 - if ( str[i] == '/' ) - { - str[i] = '\\'; - } -#else - if ( str[i] == '\\' ) - { - str[i] = '/'; - } -#endif - } - - return; -} - -static void remove_cr( char *str ) -{ - char *pos; - - /* remove all \r characters from the string */ - pos = strchr( str, '\r' ); - while ( pos != NULL ) - { - strcpy( pos, pos + 1 ); - pos = strchr( pos, '\r' ); - } - - return; -} - -static void clearString( - char *str ) -{ - str[0] = '\0'; - return; + return IVAS_ERR_OK; } -static bool isEmptyString( - const char *str ) -{ - return str[0] == '\0'; -} /*--------------------------------------------------------------------------* * convertInputBuffer() diff --git a/ci/run_evs_be_win_test.py b/ci/run_evs_be_win_test.py new file mode 100644 index 0000000000000000000000000000000000000000..f1bcd7f3a4e7e69634878431d56a29be111642b3 --- /dev/null +++ b/ci/run_evs_be_win_test.py @@ -0,0 +1,149 @@ +""" + (C) 2022-2023 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. +""" + +from multiprocessing import Pool +import argparse +import subprocess +import os +import shutil +import sys + + +def run_condition(eval_cmd, diff_cmd, id_count): + """ Run ENC or DEC command string and compare output with EVS test vectors. """ + + cmd = subprocess.run(eval_cmd.split(), capture_output=True, text=True, check=True) + + # diff + diff_success = 1 + if ';' in diff_cmd: + diff_cmd1, diff_cmd2 = diff_cmd.split(';') + cmd1 = subprocess.run(diff_cmd1.split(), capture_output=True, text=True, check=True) + cmd2 = subprocess.run(diff_cmd2.split(), capture_output=True, text=True, check=True) + diff_success = cmd1.returncode + cmd2.returncode + else: + cmd = subprocess.run(diff_cmd.split(), capture_output=True, text=True, check=True) + diff_success = cmd.returncode + if diff_success == 0: + return None + else: + return f'[{str(id_count).rjust(3)}] FAIL: {" ".join(eval_cmd)}\n {diff_cmd}\n' + + +def environment_is_correct(paths): + """ + Check that the folder with the test resources is set up correctly: + - all Readme files there + - EVS binaries available in bin/ + - testv and switchPaths folder exist - Content is not checked, though + """ + ret = True + + for pth in paths: + if not os.path.exists(pth): + print(f"Environment setup is incorrect - {pth} not found.") + ret = False + + return ret + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description='Run 26.444 test with parallel processes ') + parser.add_argument('-p', type=int, default=os.cpu_count(), + help='Number of processes (default cpu_count)') + parser.add_argument('-test_dir', type=str, default='./', + help='testvec directory from 26.444)') + parser.add_argument('-enc_bin', type=str, default='./bin/IVAS_cod.exe', + help='Encoder binary (default ./bin/IVAS_cod.exe)') + parser.add_argument('-dec_bin', type=str, default='./bin/IVAS_dec.exe', + help='Decoder binary (default ./bin/IVAS_dec.exe)') + + args = parser.parse_args() + test_vec_dir = args.test_dir + processes = args.p + enc_bin = args.enc_bin + dec_bin = args.dec_bin + + README_FILES = ['Readme_AMRWB_IO_dec.txt', 'Readme_AMRWB_IO_enc.txt', 'Readme_EVS_dec.txt', + 'Readme_EVS_enc.txt', 'Readme_JBM_dec.txt'] + + scripts = [os.path.join(test_vec_dir, script) for script in README_FILES] + + if not environment_is_correct([f'{test_vec_dir}/testv'] + scripts + [enc_bin, dec_bin]): + sys.exit(1) + + pool = Pool(processes) + results = [] + id_count = 0 + + for script in scripts: + with open(script) as file: + tmp_dir = None + eval_cmd = None + diff_cmd = '' + for line in file: + if line.startswith('TMP='): + assert tmp_dir is None + tmp_dir = line.split('"')[1] + if os.path.exists(tmp_dir): + shutil.rmtree(tmp_dir) + os.makedirs(tmp_dir) + line = line if tmp_dir is None else line.replace( + '$TMP/', f'{tmp_dir}/') + if '$CUT_DEC_BIN' in line: + eval_cmd = dec_bin + ' -q ' + ' '.join(line.split()[1:]) + if '$CUT_ENC_BIN' in line: + eval_cmd = enc_bin + ' -q ' + ' '.join(line.split()[1:]) + if '$DIFF_BIN' in line: + if 'Readme_JBM_dec.txt' in script: + if '-w' not in line.split()[1]: + diff_cmd = 'FC.exe ' + ' '.join(line.split()[1:]).replace('/', '\\').replace('\n', '/n') + continue + diff_cmd += '; FC.exe ' + ' '.join(line.split()[1:]).replace('/', '\\').replace('\n', '/n').replace('-w', '/W') + else: + diff_cmd = 'FC.exe ' + ' '.join(line.split()[1:]).replace('/', '\\').replace('\n', '/n') + results.append(pool.apply_async( + run_condition, args=(eval_cmd, diff_cmd, id_count))) + id_count = id_count + 1 + print('Total number of conditions for', '"' + + os.path.basename(script) + '": ' + str(id_count - 1)) + + results = [r.get() for r in results if r.get()] + if results: + print(f'\n{len(results)} test conditions failed:') + print('\n'.join(results)) + with open('failed.txt', 'w') as f: + print(f'\n{len(results)} test conditions failed:', file=f) + print('\n'.join(results), file=f) + sys.exit(1) + else: + print('\n *** All tests passed! ***') + sys.exit(0) diff --git a/ci/run_scheduled_sanitizer_test.py b/ci/run_scheduled_sanitizer_test.py index aa6f2636a44848c9505034aac8f2511961bfc66a..9886de42916bddbd7fea609c28b87978016742cd 100755 --- a/ci/run_scheduled_sanitizer_test.py +++ b/ci/run_scheduled_sanitizer_test.py @@ -63,8 +63,7 @@ def main(args): assert all([t in SUPPORTED_TESTS for t in tests]) - modes = get_modes(in_format) - returncode = run_check(modes, out_formats, tests, run_fec=run_fec) + returncode = run_check(in_format, out_formats, tests, run_fec=run_fec) collect_for_sanitizer_test(CONSOLE_OUT_FILE) @@ -92,7 +91,22 @@ def get_modes(in_format: str) -> list: return mode_list -def run_check(modes: list, out_formats: list, tests: list, run_fec: bool = True): +def get_md_file_command(in_format: str) -> list: + + cmd = list() + if in_format.startswith("ISM"): + cmd.append("--metadata_files") + md_filename = "/usr/local/ltv/ltvISM{}.csv" + n = int(in_format[-1]) + cmd.extend([md_filename.format(i) for i in range(1, n + 1)]) + + return cmd + + +def run_check(in_format: str, out_formats: list, tests: list, run_fec: bool = True): + + modes = get_modes(in_format) + md_file_command = get_md_file_command(in_format) ### always run encoder and decoder with no frameloss cmd_no_fec = [ @@ -107,6 +121,7 @@ def run_check(modes: list, out_formats: list, tests: list, run_fec: bool = True) *modes, "--oc", *out_formats, + *md_file_command, ] print( diff --git a/ci/smoke_test.sh b/ci/smoke_test.sh index c11c72fbaaef154e4e08cd3c961f35a207a1368f..b1b9e024b46711fc7b8ced20dfb3d1f1b19b3144 100755 --- a/ci/smoke_test.sh +++ b/ci/smoke_test.sh @@ -55,6 +55,7 @@ fi cfg=./scripts/config/ci_linux.json dly_profile=./scripts/dly_error_profiles/dly_error_profile_10.dat +ism_md_cmd="--metadata_files /usr/local/testv/stvISM1.csv /usr/local/testv/stvISM2.csv /usr/local/testv/stvISM3.csv /usr/local/testv/stvISM4.csv" if [ $BUILD -eq 1 ];then # Enable memory macros to find unbalanced memory allocations/deallocations @@ -62,7 +63,7 @@ if [ $BUILD -eq 1 ];then make clean # Replace free -> free_, malloc -> malloc_, calloc -> calloc_ - ./scripts/prepare_mem_dryrun.py + python3 ./scripts/prepare_mem_dryrun.py # Enable WMOPS and disable DEBUGGING sed -i.bak -e "s/\/\*\s*\(#define\s*WMOPS\)\s*\*\//\1/g" lib_com/options.h @@ -74,27 +75,40 @@ if [ $BUILD -eq 1 ];then fi # run all modes vanilla-fashion -./scripts/runIvasCodec.py -p $cfg -U 1 $WORKERS | tee smoke_test_output.txt +# treat ISM modes separately because passing the metadata files to MASA modes causes crashes +ism_modes=$(./scripts/runIvasCodec.py -l | grep ISM) +non_ism_modes=$(./scripts/runIvasCodec.py -l | grep -v ISM) +echo "\n======================= 1. non-ism modes no FEC =======================\n\n" +./scripts/runIvasCodec.py -m $non_ism_modes -p $cfg -U 1 $WORKERS | tee smoke_test_output.txt +echo "\n======================= 2. ism modes no FEC =======================\n\n" +./scripts/runIvasCodec.py -m $ism_modes -p $cfg -U 1 $WORKERS $ism_md_cmd | tee smoke_test_output.txt # run the decoding again, but with 15% frame loss +echo "\n======================= 3. all modes with FEC =======================\n\n" ./scripts/runIvasCodec.py -p $cfg -U 1 $WORKERS -D="-fec 15" --decoder_only | tee smoke_test_output_plc.txt # run JBM modes - EXT is excluded as not supported yet modes_with_no_ext_out=$(./scripts/runIvasCodec.py -l | grep -v MASA | grep -v ISM) +modes_with_ext_out=$(./scripts/runIvasCodec.py -l | grep 'MASA\|ISM' | grep -v ISM+) +echo "\n======================= 4. JBM, modes with no EXT =======================\n\n" ./scripts/runIvasCodec.py -m $modes_with_no_ext_out -p $cfg -U 1 $WORKERS --decoder_only --jbm_file $dly_profile | tee smoke_test_output_jbm_noEXT.txt -./scripts/runIvasCodec.py -C MASA ISM1 ISM2 ISM3 ISM4 -p $cfg -U 1 $WORKERS --decoder_only --jbm_file $dly_profile --oc BINAURAL BINAURAL_ROOM mono stereo FOA HOA3 5_1 7_1_4 | tee -a smoke_test_output_jbm_noEXT.txt +echo "\n======================= 5. JBM, modes with EXT =======================\n\n" +./scripts/runIvasCodec.py -m $modes_with_ext_out -p $cfg -U 1 $WORKERS --decoder_only --jbm_file $dly_profile --oc BINAURAL BINAURAL_ROOM mono stereo FOA HOA3 5_1 7_1_4 | tee -a smoke_test_output_jbm_noEXT.txt # run all modes with binaural output using external files modes_with_bin_out="SBA PlanarSBA MASA MC ISM1 ISM2 ISM3 ISM4" bin_out_modes="BINAURAL BINAURAL_ROOM" +echo "\n======================= 6. binaural out with HRTF files - WB =======================\n\n" wb_modes=$(./scripts/runIvasCodec.py -l -C $modes_with_bin_out | grep _wb_) hrtf_wb="../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin" -./scripts/runIvasCodec.py -p $cfg -m $wb_modes -U 1 $WORKERS -D="-hrtf ${hrtf_wb}" --decoder_only | tee -a smoke_test_output_hrtf.txt +./scripts/runIvasCodec.py -p $cfg -m $wb_modes -U 1 $WORKERS -D="-hrtf ${hrtf_wb}" --decoder_only --oc $bin_out_modes | tee -a smoke_test_output_hrtf.txt +echo "\n======================= 7. binaural out with HRTF files - SWB =======================\n\n" swb_modes=$(./scripts/runIvasCodec.py -l -C $modes_with_bin_out | grep _swb_) hrtf_swb="../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin" -./scripts/runIvasCodec.py -p $cfg -m $swb_modes -U 1 $WORKERS -D="-hrtf ${hrtf_swb}" --decoder_only | tee -a smoke_test_output_hrtf.txt +./scripts/runIvasCodec.py -p $cfg -m $swb_modes -U 1 $WORKERS -D="-hrtf ${hrtf_swb}" --decoder_only --oc $bin_out_modes | tee -a smoke_test_output_hrtf.txt +echo "\n======================= 8. binaural out with HRTF files - FB =======================\n\n" fb_modes=$(./scripts/runIvasCodec.py -l -C $modes_with_bin_out | grep _fb_) hrtf_fb="../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin" -./scripts/runIvasCodec.py -p $cfg -m $fb_modes -U 1 $WORKERS -D="-hrtf ${hrtf_fb}" --decoder_only | tee -a smoke_test_output_hrtf.txt +./scripts/runIvasCodec.py -p $cfg -m $fb_modes -U 1 $WORKERS -D="-hrtf ${hrtf_fb}" --decoder_only --oc $bin_out_modes | tee -a smoke_test_output_hrtf.txt diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index 41acc25b48329646c859750c26c8ff86a9f049a4..5ae9cb84d02ca54dcb42c640e33ab79da1cf4182 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -536,6 +536,7 @@ ivas_error config_acelp1( const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ const int16_t idchan, /* i : stereo channel ID */ + const int16_t active_cnt, /* i : Active frame counter */ const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ @@ -753,12 +754,11 @@ ivas_error config_acelp1( bits -= acelp_cfg->mid_lsf_bits; } -#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE - else if ( tdm_lp_reuse_flag == 1 && idchan == 1 ) + else if ( tdm_lp_reuse_flag == 1 && idchan == 1 && active_cnt != 1 ) { bits -= TDM_IC_LSF_PRED_BITS; } -#endif + /* gain Q bit-budget - part 1 */ if ( ( coder_type != UNVOICED && coder_type != AUDIO && coder_type != INACTIVE && !( core_brate <= ACELP_8k00 && coder_type != TRANSITION ) ) || ( coder_type == INACTIVE && total_brate > MAX_GSC_INACTIVE_BRATE ) ) { @@ -1314,7 +1314,6 @@ ivas_error config_acelp1( { if ( idchan > 0 && element_mode == IVAS_CPE_TD ) { -#ifdef LSF_RE_USE_SECONDARY_CHANNEL if ( !tdm_lp_reuse_flag ) { acelp_cfg->lsf_bits += bits; /* increase LSF Q bits */ @@ -1323,6 +1322,7 @@ ivas_error config_acelp1( else { int16_t nb_prm = 4; + if ( tdm_low_rate_mode == 1 ) { nb_prm = 2; @@ -1343,33 +1343,6 @@ ivas_error config_acelp1( bits -= allocate_unused( core_brate, coder_type, bits, 1, 0, LSFPRM, &acelp_cfg->lsf_bits ); } } -#else - int16_t nb_prm = 4; - - if ( tdm_low_rate_mode == 1 ) - { - nb_prm = 2; - } - - /* First add remaining bits on gains */ - if ( !( *uc_two_stage_flag ) ) - { - bits -= allocate_unused( core_brate, coder_type, bits, nb_prm, 0, GAINSPRM, acelp_cfg->gains_mode ); - } - - /* Then, Increase pitch bit budget */ - if ( tdm_Pitch_reuse_flag == 0 && bits > 0 ) - { - bits -= allocate_unused( core_brate, coder_type, bits, nb_prm, 0, PITCHPRM, acelp_cfg->pitch_bits ); - } - - /* Increase mid-lsf bit budget */ - if ( tdm_lp_reuse_flag == 0 && bits > 0 ) - { - bits -= allocate_unused( core_brate, coder_type, bits, 1, 0, MID_LSFSPRM, &acelp_cfg->mid_lsf_bits ); - bits -= allocate_unused( core_brate, coder_type, bits, 1, 0, LSFPRM, &acelp_cfg->lsf_bits ); - } -#endif #ifdef DEBUGGING if ( idchan > 0 && bits > 0 && ( coder_type > UNVOICED || tdm_low_rate_mode == 0 ) ) { diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index e5f72590a60dc700b31ed3d3f6b089f9d6a333b9..886509b5ac96d65923b4f13872021fd74414c2f2 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -833,12 +833,6 @@ static ivas_error write_indices_element( /* restore previous pointer position */ pt_stream_loc = pt_stream_backup; } - - /* TODO implemented only for MCT for now */ - if ( ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_MCT ) && ( element_id * CPE_CHANNELS + n == LFE_CHANNEL ) ) - { - continue; - } #ifdef ENABLE_BITRATE_VERIFICATION total_nb_bits = #endif @@ -1807,7 +1801,7 @@ ivas_error preview_indices( if ( bit_stream[2] == 0 ) { st_ivas->ivas_format = SBA_FORMAT; - st_ivas->sba_mode = ivas_sba_mode_select( total_brate ); + st_ivas->sba_mode = ivas_sba_mode_select(); } else { @@ -1920,7 +1914,11 @@ ivas_error preview_indices( k = IVAS_FORMAT_SIGNALING_NBITS; if ( st_ivas->ivas_format == MASA_FORMAT ) { +#ifdef COMBINED_FORMAT_SIGNALING + k = IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; +#else k = IVAS_FORMAT_SIGNALING_NBITS_SBA; +#endif } if ( total_brate < MIN_BRATE_MDCT_STEREO ) @@ -1960,9 +1958,15 @@ ivas_error preview_indices( else if ( st_ivas->ivas_format == SBA_FORMAT ) { /* Read SBA planar flag and SBA order */ +#ifdef COMBINED_FORMAT_SIGNALING + st_ivas->sba_planar = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED] == 1 ); + st_ivas->sba_order = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + 2] == 1 ); + st_ivas->sba_order += 2 * ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + 1] == 1 ); +#else st_ivas->sba_planar = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_SBA] == 1 ); st_ivas->sba_order = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_SBA + 2] == 1 ); st_ivas->sba_order += 2 * ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_SBA + 1] == 1 ); +#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( total_brate, st_ivas->sba_order ); @@ -2112,12 +2116,12 @@ ivas_error read_indices( } /* AMRWB 26.173 G.192 file reader (read_serial) does not declare/use SID_BAD ft, - it declares every bad synch marked frame initially as a lost_speech frame, - and then the RXDTX handler CNG state decides the decoding mode CNG/SPEECH. - While In the AMRWB ETSI/3GPP format eid a CRC error in a detected SID_UPDATE frames triggers SID_BAD. + it declares every bad synch marked frame initially as a lost_speech frame, + and then the RXDTX handler CNG state decides the decoding mode CNG/SPEECH. + While In the AMRWB ETSI/3GPP format eid a CRC error in a detected SID_UPDATE frames triggers SID_BAD. - Here we inhibit use of the SID-length info, even though it is available in the G.192 file format after STL/EID-XOR . - */ + Here we inhibit use of the SID-length info, even though it is available in the G.192 file format after STL/EID-XOR . + */ if ( sid_upd_bad ) { sid_upd_bad = 0; @@ -2129,10 +2133,10 @@ ivas_error read_indices( { g192_sid_first = 1; /* SID_FIRST detected for previous AMRWB/AMRWBIO active frames only */ /* It is not possible to perfectly simulate rate switching conditions EVS->AMRWBIO where: - the very first SID_FIRST detection is based on a past EVS active frame - and a good length 0 "SID_FIRST"(NO_DATA) frame is sent in AMRWBIO, - due to the one frame state memory in the AMRWB legacy G.192 SID_FIRST encoding - */ + the very first SID_FIRST detection is based on a past EVS active frame + and a good length 0 "SID_FIRST"(NO_DATA) frame is sent in AMRWBIO, + due to the one frame state memory in the AMRWB legacy G.192 SID_FIRST encoding + */ } speech_bad = 0; @@ -2148,7 +2152,7 @@ ivas_error read_indices( } /* Do not allow decoder to enter CNG-synthesis for any instantly received GOOD+LENGTH==0 frame - as this frame was never transmitted, one can not know it is good and has a a length of zero ) */ + as this frame was never transmitted, one can not know it is good and has a a length of zero ) */ if ( *CNG != 0 ) { /* We were in CNG synthesis */ @@ -2346,7 +2350,7 @@ static Word32 read_indices_mime_handle_dtx( /* Now modify bfi flag for the decoder's SPEECH/CNG synthesis logic */ /* in SPEECH synthesis, make sure to activate speech PLC for a received NO_DATA frame, - no_data frames may be injected by the network or by the dejitter buffer */ + no_data frames may be injected by the network or by the dejitter buffer */ /* modify bfi_flag to stay/move into the correct decoder PLC section */ if ( ( *CNG == 0 ) && ( no_data != 0 ) ) { @@ -2366,10 +2370,10 @@ static Word32 read_indices_mime_handle_dtx( /* now bfi, total_brate are set by RX-DTX handler:: - bfi==0, total_brate!=0 CNG or speech pending bitrate - bfi==0, total_brate==0 CNG will continue or start(sid_first, sid_bad) - bfi==1, total_brate!=0 speech PLC - bfi==1, total_brate==0 , speech PLC */ + bfi==0, total_brate!=0 CNG or speech pending bitrate + bfi==0, total_brate==0 CNG will continue or start(sid_first, sid_bad) + bfi==1, total_brate!=0 speech PLC + bfi==1, total_brate==0 , speech PLC */ /* handle available AMRWB/AMRWBIO MIME header ToC rate-info at startup */ if ( ( st->bfi == 1 && st->ini_frame == 0 ) && ( ( amrwb_rfc4867_flag != 0 ) || ( amrwb_rfc4867_flag == 0 && isAMRWB_IOmode != 0 ) ) ) /*AMRWB ToC */ diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 61539e2355ec5d9db3603452ca0f257c09c449ed..1490703aeed53e88f6c690fa27b9118425d87ca0 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -706,8 +706,7 @@ ivas_error openCldfb( HANDLE_CLDFB_FILTER_BANK hs; int16_t buf_len; - hs = (HANDLE_CLDFB_FILTER_BANK) malloc( sizeof( CLDFB_FILTER_BANK ) ); - if ( hs == NULL ) + if ( ( hs = (HANDLE_CLDFB_FILTER_BANK) malloc( sizeof( CLDFB_FILTER_BANK ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" ); } @@ -728,8 +727,7 @@ ivas_error openCldfb( buf_len = hs->p_filter_length; } - hs->cldfb_state = (float *) malloc( buf_len * sizeof( float ) ); - if ( hs->cldfb_state == NULL ) + if ( ( hs->cldfb_state = (float *) malloc( buf_len * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" ); } @@ -885,16 +883,19 @@ void deleteCldfb( { HANDLE_CLDFB_FILTER_BANK hs = *h_cldfb; - if ( hs ) + if ( h_cldfb == NULL || *h_cldfb == NULL ) { - if ( hs->cldfb_state ) - { - free( hs->cldfb_state ); - } - free( hs ); - *h_cldfb = NULL; + return; } + if ( hs->cldfb_state ) + { + free( hs->cldfb_state ); + } + + free( hs ); + *h_cldfb = NULL; + return; } @@ -1148,8 +1149,7 @@ ivas_error cldfb_save_memory( hs->memory_length = hs->p_filter_length; } - hs->memory = (float *) malloc( hs->memory_length * sizeof( float ) ); - if ( hs->memory == NULL ) + if ( ( hs->memory = (float *) malloc( hs->memory_length * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n" ); } diff --git a/lib_com/cnst.h b/lib_com/cnst.h index db1dc3d8982a768eff807f35d083dbabeae15f58..cd3aa07c48a2d43d95ae7c88e0bb1ee667dacc59 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -294,9 +294,7 @@ enum IND_ISF_1_2, IND_ISF_1_3, IND_ISF_1_4, -#ifdef LSF_RE_USE_SECONDARY_CHANNEL IND_IC_LSF_PRED, -#endif IND_GSC_ATTACK, IND_GSC_SWB_SPEECH, IND_NOISE_LEVEL, @@ -1391,6 +1389,23 @@ enum #define NPARTCLDFB 10 #define NPART_SHAPING 62 +#define FDCNG_VQ_MAX_LEN FD_CNG_maxN_37bits +#define FDCNG_VQ_DCT_NSEGM 4 +#define FDCNG_VQ_DCT_MINTRUNC 8 +#define FDCNG_VQ_DCT_MAXTRUNC 18 +#define FDCNG_VQ_MAX_LEN_WB 21 + +#define FDCNG_VQ_DCT_NPOST 8 + +typedef enum _DCTTYPE +{ + DCT_T2_24_XX = 0, /* truncated DCT_T2_24 */ + IDCT_T2_XX_24 = 1, + DCT_T2_21_XX = 2, /* truncated DCT_T2_21 */ + IDCT_T2_XX_21 = 3 +} DCTTYPE; + + #define MSSUBFRLEN 12 #define MSNUMSUBFR 6 #define MSBUFLEN 5 @@ -1415,7 +1430,12 @@ enum #define CHEAP_NORM_SIZE 161 #define CNA_MAX_BRATE ACELP_13k20 -#define MAX_CNA_NBANDS 12 + +#ifdef FIX_I414_OOA_CNA +#define CNA_INIT_NBANDS 6 +#else +#define MAX_CNA_NBANDS 12 +#endif #define GAIN_Q_OFFSET_EVS 60.f #define GAIN_Q_OFFSET_IVAS 45.f @@ -1513,7 +1533,10 @@ enum #define TOD_NSPEC 80 /* number of spectral bins of the tonal detector */ #define TOD_THR_MASS 0.86f /* initial value for the adaptive threshold of the tonal detector */ #define P2A_FACT 0.9f /* long-term averaging factor for peak-to-average ratio */ -#define THR_P2A 80.0f /* threshold to detect strongly peaky signals */ +#ifdef FIX_SP2A +#define THR_P2A_HIGH 95.0f /* higher threshold to detect strongly peaky signals at low bitrates*/ +#endif +#define THR_P2A 80.0f /* lower threshold to detect strongly peaky signals at higher bitrates */ /*----------------------------------------------------------------------------------* * LD music post-filter constants @@ -2119,7 +2142,7 @@ enum #define IGF_GRID_LB_SHORT 2 /* constants for IGFSCFDecoder and IGFSCFEncoder */ -#define IGF_CTX_OFFSET 3 /* offset added to make the context values nonnegative, for array indexing */ +#define IGF_CTX_OFFSET 3 /* offset added to make the context values non negative, for array indexing */ #define IGF_CTX_COUNT ( 2 * IGF_CTX_OFFSET + 1 ) /* number of contexts for the AC statistical model */ #define IGF_MIN_ENC_SEPARATE -12 /* minimum residual value coded separately, without escape coding */ #define IGF_MAX_ENC_SEPARATE +12 /* maximum residual value coded separately, without escape coding */ diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index a24e03f248de30a26ddda7320f1287a19d81ccd4..a1ab432ead3a38ca56c0098160a6139ada36c7ed 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -38,6 +38,7 @@ #include "options.h" #include #include +#include "ivas_error.h" /*----------------------------------------------------------------------------------* * Common API constants @@ -49,6 +50,9 @@ #define IVAS_CLDFB_NO_CHANNELS_MAX ( 60 ) #define IVAS_MAX_INPUT_LFE_CHANNELS 4 +#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 + + /*----------------------------------------------------------------------------------* * Common API structures *----------------------------------------------------------------------------------*/ @@ -67,7 +71,6 @@ typedef struct _IVAS_ENC_CHANNEL_AWARE_CONFIG int16_t fec_offset; } IVAS_ENC_CHANNEL_AWARE_CONFIG; - typedef struct _IVAS_ISM_METADATA { float azimuth; @@ -75,6 +78,11 @@ typedef struct _IVAS_ISM_METADATA float radius; float spread; float gainFactor; + float yaw; + float pitch; +#ifdef ISM_NON_DIEGETIC_PAN + int16_t non_diegetic_flag; +#endif } IVAS_ISM_METADATA; typedef struct @@ -83,18 +91,19 @@ typedef struct } IVAS_QUATERNION; +typedef struct +{ + float x, y, z; +} IVAS_VECTOR3; + + typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; -typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE; +typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE; typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; -#endif -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; - typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; -#endif #ifdef DEBUGGING typedef enum @@ -105,6 +114,18 @@ typedef enum } IVAS_RENDER_TYPE_OVERRIDE; #endif +typedef struct +{ + float azimuth; + float elevation; + float radius; + float yaw; + float pitch; +#ifdef ISM_NON_DIEGETIC_PAN + int16_t non_diegetic_flag; +#endif +} IVAS_REND_AudioObjectPosition; + typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { int16_t override; @@ -124,6 +145,7 @@ typedef struct _IVAS_RENDER_CONFIG IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; #endif IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics; + float directivity[3]; } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; typedef struct _IVAS_LS_CUSTOM_LAYOUT @@ -156,5 +178,4 @@ typedef struct _IVAS_JBM_TRACE_DATA } IVAS_JBM_TRACE_DATA; - #endif /* COMMON_API_TYPES_H */ diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 120d0876d1f32569cf4bd8afe3b5089af9924789..7f9b385c3f3d38c569307a13f15032c0dcb62582 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -247,28 +247,24 @@ int16_t getResq( *-------------------------------------------------------------------*/ int16_t getTnsAllowed( - const int32_t total_brate, /* i : total bitrate */ - const int16_t igf, /* i : flag indicating IGF activity*/ - const int16_t element_mode, /* i : IVAS element mode */ - const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ + const int32_t total_brate, /* i : total bitrate */ + const int16_t igf, /* i : flag indicating IGF activity*/ + const int16_t element_mode /* i : IVAS element mode */ ) { int16_t tnsAllowed = 0; - if ( mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( igf ) { - if ( igf ) - { - if ( total_brate > HQ_16k40 || ( ( total_brate > HQ_13k20 ) && element_mode == IVAS_CPE_DFT ) ) - { - tnsAllowed = 1; - } - } - else if ( total_brate > HQ_32k ) + if ( total_brate > HQ_16k40 || ( ( total_brate > HQ_13k20 ) && element_mode == IVAS_CPE_DFT ) ) { tnsAllowed = 1; } } + else if ( total_brate > HQ_32k ) + { + tnsAllowed = 1; + } return tnsAllowed; } @@ -411,16 +407,11 @@ int16_t getIgfPresent( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ const int16_t bwidth, /* i : audio bandwidth */ - const int16_t rf_mode, /* i : flag to signal the RF mode */ - const int16_t mct_chan_mode /* i : MCT channel mode */ + const int16_t rf_mode /* i : flag to signal the RF mode */ ) { int16_t igfPresent = 0; - if ( mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - return igfPresent; - } if ( bwidth == SWB ) { @@ -808,9 +799,7 @@ void init_tcx_cfg( const int16_t infoIGFStopFreq, const int16_t element_mode, const int16_t ini_frame, - const int16_t MCT_flag, - const MCT_CHAN_MODE mct_chan_mode /* i : MDCT channel mode */ -) + const int16_t MCT_flag ) { int16_t i; int16_t mdctWindowLength; @@ -840,13 +829,9 @@ void init_tcx_cfg( /* set number of coded lines */ hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth ); - if ( mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - hTcxCfg->tcx_coded_lines = MCT_LFE_MAX_LINE; - } /* TNS in TCX */ hTcxCfg->pCurrentTnsConfig = NULL; - hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode, mct_chan_mode ); + hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode ); if ( hTcxCfg->fIsTNSAllowed ) { diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c index 32f2f47303ba50bfac3567e237d6494badab266e..5557a88606fc789954b3637e793bc0e101f4b89b 100644 --- a/lib_com/delay_comp.c +++ b/lib_com/delay_comp.c @@ -51,11 +51,10 @@ /*! 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 */ - HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */ - const int32_t binaural_latency_ns /* i : binauralization delay in ns */ + 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 */ ) { int32_t delay = 0; @@ -69,6 +68,11 @@ int32_t get_delay( else /* IVAS */ { delay = IVAS_ENC_DELAY_NS; + + if ( ivas_format == MASA_FORMAT ) + { + delay = 0; /* All delay is compensated in the decoder with MASA */ + } } if ( ivas_format == SBA_FORMAT ) @@ -100,8 +104,11 @@ int32_t get_delay( delay += IVAS_FB_DEC_DELAY_NS; } - /* compensate for binauralization delay */ - delay += binaural_latency_ns; + + if ( ivas_format == MASA_FORMAT ) + { + delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with MASA */ + } } } diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c index ed55a45b063d596dea4b6d4968633533c8c3e177..10a31d94c079da17168d2a3c79591fadc728f47b 100644 --- a/lib_com/disclaimer.c +++ b/lib_com/disclaimer.c @@ -55,3 +55,5 @@ int16_t print_disclaimer( FILE *fPtr ) return 0; } + +#undef WMC_TOOL_SKIP diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index 0203cd4fb75dd6eeb234c7fddcf30a3d692d34e3..99ae9894f44a26c5b29d70b3cb5e8bc4497f39ce 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -68,9 +68,7 @@ ivas_error createFdCngCom( HANDLE_FD_CNG_COM hs; /* Allocate memory */ - hs = (HANDLE_FD_CNG_COM) malloc( sizeof( FD_CNG_COM ) ); - - if ( hs == NULL ) + if ( ( hs = (HANDLE_FD_CNG_COM) malloc( sizeof( FD_CNG_COM ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FD CNG COM" ); } @@ -942,6 +940,74 @@ void SynthesisSTFT( return; } +#ifdef JBM_TSM_ON_TCS +/*------------------------------------------------------------------- + * SynthesisSTFT_dirac() + * + * STFT synthesis filterbank + *-------------------------------------------------------------------*/ + +void SynthesisSTFT_dirac( + float *fftBuffer, /* i : FFT bins */ + float *timeDomainOutput, + float *olapBuffer, + const float *olapWin, + const int16_t samples_out, + HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ +) +{ + int16_t i; + float buf[M + 1 + 320], tmp; + + /* Perform IFFT */ + RFFTN( fftBuffer, hFdCngCom->fftSineTab, hFdCngCom->fftlen, 1 ); + + /* Handle overlap in P/S domain for stereo */ + mvr2r( olapBuffer + hFdCngCom->frameSize, olapBuffer, hFdCngCom->frameSize ); + set_f( olapBuffer + hFdCngCom->frameSize, 0.0f, hFdCngCom->frameSize ); /*olapBuffer, fftBuffer, olapWin*/ + + + for ( i = hFdCngCom->frameSize / 4; i < 3 * hFdCngCom->frameSize / 4; i++ ) + { + olapBuffer[i] += fftBuffer[i] * olapWin[i - hFdCngCom->frameSize / 4]; + } + for ( ; i < 5 * hFdCngCom->frameSize / 4; i++ ) + { + olapBuffer[i] = fftBuffer[i]; + } + + for ( ; i < 7 * hFdCngCom->frameSize / 4; i++ ) + { + olapBuffer[i] = fftBuffer[i]; + } + + for ( ; i < hFdCngCom->fftlen; i++ ) + { + olapBuffer[i] = 0; + } + + /* Get time-domain signal */ + v_multc( olapBuffer + hFdCngCom->frameSize / 4, (float) ( hFdCngCom->fftlen / 2 ), timeDomainOutput, samples_out ); + + /* Get excitation */ + v_multc( olapBuffer + hFdCngCom->frameSize / 4 - ( M + 1 ), (float) ( hFdCngCom->fftlen / 2 ), buf, M + 1 + hFdCngCom->frameSize ); + tmp = buf[0]; + preemph( buf + 1, PREEMPH_FAC, M + hFdCngCom->frameSize, &tmp ); + residu( hFdCngCom->A_cng, M, buf + 1 + M, hFdCngCom->exc_cng, hFdCngCom->frameSize ); + + /* update and window olapBuf if we have a output frame that is shorter than the default frame size...*/ + if ( samples_out < hFdCngCom->frameSize ) + { + mvr2r( olapBuffer + samples_out, olapBuffer + hFdCngCom->frameSize, 3 * hFdCngCom->frameSize / 4 ); + } + for ( i = 5 * hFdCngCom->frameSize / 4; i < 7 * hFdCngCom->frameSize / 4; i++ ) + { + olapBuffer[i] *= olapWin[i - 3 * hFdCngCom->frameSize / 4]; + } + + return; +} +#endif /*------------------------------------------------------------------- * mhvals() diff --git a/lib_com/hp50.c b/lib_com/hp50.c index 57c297e1b142750f0a944c9b1cdc91c4ab8654fc..3624fabb449fd153e55b2c3ed0fb44b00e19bbc1 100644 --- a/lib_com/hp50.c +++ b/lib_com/hp50.c @@ -34,7 +34,6 @@ EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0 ====================================================================================*/ -#include "typedef.h" #include #include "options.h" #ifdef DEBUGGING diff --git a/lib_com/hq_tools.c b/lib_com/hq_tools.c index 1d89d0314597493852e85af60f0e57247410d33c..0008cb957ce7b5a85d8c0b50478b02995f5f7eeb 100644 --- a/lib_com/hq_tools.c +++ b/lib_com/hq_tools.c @@ -1290,7 +1290,6 @@ int16_t calc_nor_delta_hf( ynrm[i] += delta; add_bits_denv += bitsforDelta; - temp_num++; } } diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h old mode 100644 new mode 100755 index fe99d826100be907d3476c44f806422a54d64043..91f1127788e07d7575689fdc2c3dd96dfcc48427 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -36,7 +36,6 @@ #include #include "options.h" #include "cnst.h" -#include "ivas_error.h" /* clang-format off */ @@ -79,7 +78,11 @@ typedef enum *----------------------------------------------------------------------------------*/ #define IVAS_FORMAT_SIGNALING_NBITS 2 /* number of bits for signaling the IVAS format */ +#ifdef COMBINED_FORMAT_SIGNALING +#define IVAS_FORMAT_SIGNALING_NBITS_EXTENDED ( IVAS_FORMAT_SIGNALING_NBITS + 1 ) +#else #define IVAS_FORMAT_SIGNALING_NBITS_SBA ( IVAS_FORMAT_SIGNALING_NBITS + 1 ) +#endif /*----------------------------------------------------------------------------------* @@ -153,7 +156,12 @@ typedef enum RENDERER_MCMASA_MONO_STEREO, RENDERER_PARAM_ISM, RENDERER_BINAURAL_MIXER_CONV, +#if defined NON_DIEGETIC_PAN || defined ISM_NON_DIEGETIC_PAN + RENDERER_BINAURAL_MIXER_CONV_ROOM, + RENDERER_NON_DIEGETIC_DOWNMIX +#else RENDERER_BINAURAL_MIXER_CONV_ROOM +#endif } RENDERER_TYPE; @@ -167,10 +175,17 @@ typedef enum #define HEAD_ROTATION_HOA_ORDER 3 /* HOA 3rd order */ #define MAX_CICP_CHANNELS 16 /* max channels for loudspeaker layouts (16 for custom layouts)*/ #define MAX_OUTPUT_CHANNELS 16 /* Maximum number of output channels (HOA 3rd order) */ +#ifdef NON_DIEGETIC_PAN +#define MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN 2 /* Maximum number of output channels with non diegetic panning */ +#endif #define BINAURAL_CHANNELS 2 /* number of channels for binaural output configuration */ #define CPE_CHANNELS 2 /* number of CPE (stereo) channels */ #define FOA_CHANNELS 4 /* number of FOA channels */ +#ifdef HODIRAC +#define HOA2_CHANNELS 9 +#endif + #define MAX_NUM_OBJECTS 4 /* max. number of audio objects */ #define MAX_SCE MAX_NUM_OBJECTS /* max. number of SCEs */ @@ -193,6 +208,25 @@ typedef enum #define IVAS_NUM_SUPPORTED_FS 3 /* number of supported sampling-rates in IVAS */ +#ifdef JBM_TSM_ON_TCS +#define CLDFB_SLOT_NS 1250000L /* 1.25ms: CLDFB slot length */ +#define MAX_JBM_SUBFRAMES_5MS 8 +#define DEFAULT_JBM_SUBFRAMES_5MS 4 +#define JBM_CLDFB_SLOTS_IN_SUBFRAME 4 +#define MAX_JBM_CLDFB_TIMESLOTS 32 +#define DEFAULT_JBM_CLDFB_TIMESLOTS 16 +#define MAX_JBM_L_FRAME48k 1920 +#define MAX_JBM_L_FRAME_NS 40000000L +#define MAX_SPAR_INTERNAL_CHANNELS IVAS_SPAR_MAX_CH +#define MAX_CLDFB_DIGEST_CHANNELS 4 +typedef enum +{ + TC_BUFFER_MODE_NONE = 0, + TC_BUFFER_MODE_RENDERER, + TC_BUFFER_MODE_BUFFER +} TC_BUFFER_MODE; +#endif + /*----------------------------------------------------------------------------------* * IVAS Bitrates *----------------------------------------------------------------------------------*/ @@ -294,7 +328,7 @@ typedef enum /*----------------------------------------------------------------------------------* - * ISm Constants + * ISM Constants *----------------------------------------------------------------------------------*/ #define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */ @@ -321,6 +355,16 @@ typedef enum #define ISM_Q_STEP 2.5f #define ISM_Q_STEP_BORDER 5.0f +#define ISM_RADIUS_NBITS 6 +#define ISM_RADIUS_MIN 0.0f +#define ISM_RADIUS_DELTA 0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ +#define ISM_EXTENDED_METADATA_BRATE IVAS_64k +#ifdef ISM_NON_DIEGETIC_PAN +#define ISM_METADATA_IS_NDP_BITS 1 +#endif +#define ISM_EXTENDED_METADATA_BITS 1 +#define ISM_METADATA_RS_MAX_FRAMES 5 /* Number of frames with opposite extended metadata flags before switching */ + /* Parametric ISM */ #define MAX_PARAM_ISM_NBANDS 11 #define MAX_PARAM_ISM_NBANDS_WB 9 @@ -334,6 +378,18 @@ typedef enum #define PARAM_ISM_MAX_CHAN 16 #define PARAM_ISM_HYS_BUF_SIZE 10 +/* ISM DTX */ +#define ISM_DTX_COH_SCA_BITS 4 +#define ISM_DTX_AZI_BITS_HIGH 8 +#define ISM_DTX_ELE_BITS_HIGH 7 +#define ISM_Q_STEP_HIGH (ISM_Q_STEP / 2) +#define ISM_Q_STEP_BORDER_HIGH (ISM_Q_STEP_BORDER / 2) +#define ISM_DTX_AZI_BITS_LOW 6 +#define ISM_DTX_ELE_BITS_LOW 5 +#define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) +#define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) + + typedef enum { ISM_MODE_NONE, @@ -342,19 +398,31 @@ typedef enum } ISM_MODE; -/* ISm metadata bitstream */ +/* ISM metadata bitstream */ enum { IND_ISM_NUM_OBJECTS, - IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, + IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, +#ifdef ISM_NON_DIEGETIC_PAN + IND_ISM_EXTENDED_NDP_FLAG, +#endif + IND_ISM_METADATA_FLAG, IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, + IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, + IND_ISM_SCE_ID_DTX, + IND_ISM_DTX_COH_SCA, /* ------------- loop for objects -------------- */ - TAG_ISM_LOOP_START = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, + TAG_ISM_LOOP_START = IND_ISM_DTX_COH_SCA + MAX_NUM_OBJECTS, +#ifdef ISM_NON_DIEGETIC_PAN + IND_ISM_NDP_FLAG = TAG_ISM_LOOP_START, +#endif IND_ISM_AZIMUTH_DIFF_FLAG = TAG_ISM_LOOP_START, IND_ISM_AZIMUTH = TAG_ISM_LOOP_START, IND_ISM_ELEVATION_DIFF_FLAG = TAG_ISM_LOOP_START, IND_ISM_ELEVATION = TAG_ISM_LOOP_START, + IND_ISM_RADIUS_DIFF_FLAG = TAG_ISM_LOOP_START, + IND_ISM_RADIUS = TAG_ISM_LOOP_START, TAG_ISM_LOOP_END = TAG_ISM_LOOP_START + 100, /* IVAS_fmToDo: to be reviewed once the final metadata are defined */ /* --------- end of loop for objects ----------- */ @@ -570,7 +638,9 @@ typedef enum #define NO_SYMB_GR_PRED_G 8 #define STEREO_DFT_RES_BW_MAX 66 /*Maximum number of bin for residual signal in each frame (res_cod_band_max == 6 in 48kHz)*/ -#define SBA_DIRAC_STEREO_NUM_BANDS 5 + +#define SBA_DIRAC_STEREO_NUM_BANDS 12 + #define SBA_DIRAC_NRG_SMOOTH_LONG 10 #define SBA_DIRAC_NRG_SMOOTH_SHORT 3 @@ -765,11 +835,7 @@ enum fea_names #define TDM_LP_REUSE_BITS 1 /* number of bits to code LP reuse flag for secondary channel */ #define TDM_LR_CONTENT_BITS 1 /* number of bits to code flag when the content is LR or not */ #define TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS ( TDM_SECONDARY_SIGNALLING + TDM_RATIO_BITS + TDM_LP_REUSE_BITS + TDM_LR_CONTENT_BITS + STEREO_BITS_TCA ) -#ifdef LSF_RE_USE_SECONDARY_CHANNEL -#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE -#define TDM_IC_LSF_PRED_BITS 1 /* Number of bits to code the inter channel lsf prediction mode */ -#endif -#endif +#define TDM_IC_LSF_PRED_BITS 1 /* number of bits to code the inter channel LSF prediction mode */ /*----------------------------------------------------------------------------------* @@ -803,6 +869,18 @@ enum fea_names #define SNS_LOW_BR_MODE -1 #define SNS_NPTS 16 /* Number of downsampled SNS parameters */ +#ifdef SNS_MSVQ +#define SNS_STEREO_MODE_LR 0 +#define SNS_STEREO_MODE_MS 1 +#define SNS_STEREO_MODE_OFFSET_INDICES 4 +#define SNS_MSVQ_NSTAGES_TCX20 4 +#define SNS_MSVQ_NSTAGES_TCX10 3 +#define SNS_MSVQ_NSTAGES_SIDE 2 +#endif +#ifdef FIX_445_SNS_BUGFIXES +#define SNS_CDBKS_BITS_4_FRAC 12 +#define SNS_MEANS_BITS_4_FRAC 14 +#endif #define MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG 0.001f #define MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME 2 * FRAMES_PER_SEC @@ -834,6 +912,9 @@ typedef enum { // VE: this should be renamed to e.g. N_SPATIAL_SUBFRAMES #define MAX_PARAM_SPATIAL_SUBFRAMES 4 /* Maximum number of subframes for parameteric spatial coding */ #define L_SPATIAL_SUBFR_48k (L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES) +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +#define CLDFB_SLOTS_PER_SUBFRAME ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ) /* Number of CLDFB slots per subframe */ +#endif /*----------------------------------------------------------------------------------* @@ -864,7 +945,11 @@ typedef enum * DirAC Constants *----------------------------------------------------------------------------------*/ +#ifdef HODIRAC +#define DIRAC_MAX_ANA_CHANS 11 /* Maximum number of channels for DirAC analysis */ +#else #define DIRAC_MAX_ANA_CHANS FOA_CHANNELS /* Maximum number of channels for DirAC analysis */ +#endif #define DIRAC_NUM_DIMS 3 /* number of directions to estimate (X,Y,Z) */ #define DIRAC_MAX_NBANDS 12 /* Maximum number of frequency bands for the DirAC Side Parameter decoding */ @@ -878,6 +963,11 @@ typedef enum #define DIRAC_NO_FB_BANDS_MAX MDFT_FB_BANDS_240 #define DELAY_DIRAC_ENC_CMP_NS_PARAM_ISM ( IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ) /* == 12 ms */ +#ifdef HODIRAC +#define DIRAC_HO_NUMSECTORS 2 +#define NUM_ANA_SECTORS 2 +#endif + /* DirAC renderer setup */ typedef enum @@ -915,6 +1005,9 @@ typedef enum #define DELAY_DIRAC_SPAR_ENC_CMP_NS 500000L /* here we may set the 24 samples (at 48 kHz) additional delay to something else, leave as is for now*/ #define DELAY_DIRAC_PARAM_DEC_SFR 2 /* Delay to be compensation for DirAC parameters in the decoder (subframes) */ +#define DELAY_MASA_PARAM_DEC_SFR 2 /* Delay to be compensation for MASA parameters in the decoder (subframes) */ +#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ + #define DIRAC_SLOT_NS 1250000L /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */ #define DIRAC_SLOT_ENC_NS 5000000L @@ -922,10 +1015,8 @@ typedef enum { DIRAC_OPEN, /* initialize to default value */ DIRAC_RECONFIGURE /* HOA3 */ -#ifdef SBA_BR_SWITCHING , DIRAC_RECONFIGURE_MODE -#endif } DIRAC_CONFIG_FLAG; @@ -935,7 +1026,17 @@ typedef enum #define SPAR_CONFIG_BW FB +#ifndef SPAR_TUNING #define IVAS_SPAR_MAX_CH (FOA_CHANNELS + 2 * ( IVAS_MAX_SBA_ORDER - 1 )) /* FOA + planar HOA */ +#else +#define IVAS_SPAR_MAX_CH ((( IVAS_MAX_SBA_ORDER ) * ( IVAS_MAX_SBA_ORDER )) + 2) /* HOA2 + pHOA3*/ +#define IVAS_HBR_MAX_DECOR_CHS (2) +#endif + +#ifdef HODIRAC +#define IVAS_SPAR_MAX_FB_IN_CHAN 11 +#endif + #define IVAS_SPAR_P_LOWERTRI ((IVAS_SPAR_MAX_CH - 1) * (IVAS_SPAR_MAX_CH - 2)) >> 1 #define IVAS_SPAR_MAX_C_COEFF (IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS) * ( IVAS_SPAR_MAX_DMX_CHS - 1) @@ -951,6 +1052,7 @@ typedef enum /* Common SPAR metadata constants */ #define IVAS_ACTIVEW_DM_F_SCALE 0.5f #define IVAS_ACTIVEW_DM_F_SCALE_DTX 0.25f +#define IVAS_ACTIVEW_DM_F_SCALE_VLBR 0.25f #define IVAS_SPAR_FOA_DFLT_FREQ_PER_CHAN 24000 #define MAX_QUANT_STRATS 3 @@ -983,7 +1085,7 @@ typedef enum DECX_COEFF } ivas_coeffs_type_t; -#define IVAS_SPAR_BR_TABLE_LEN 18 +#define IVAS_SPAR_BR_TABLE_LEN 20 /* TD decorr */ // VE: not all 16CH are currently supported -> t be revisited later enum @@ -1086,7 +1188,8 @@ enum #define MASA_MAXIMUM_CODING_SUBBANDS 24 #define MASA_MAXIMUM_DIRECTIONS 2 #define MASA_MAX_TRANSPORT_CHANNELS 2 -#define MASA_ENC_DELAY_SLOTS 7 + + #define MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS 5 #define MASA_DELTA_AZI_DCT0 30 @@ -1104,6 +1207,9 @@ enum #define MASA_DIRECTION_MAX_BITS 11 #define MASA_NO_INDEX 32767 #define MASA_BITS_ER 3 +#ifdef HR_METADATA +#define MASA_BITS_ER_HR 4 +#endif #define MASA_MIN_BITS_TF 4 #define MASA_LIMIT_2D 2 #define MASA_NO_CV_COH 8 @@ -1122,6 +1228,12 @@ enum #define MASA_COH_LIMIT_2IDX 144 /* limit for sum of values across components for having two joint indexes */ #define QMETADATA_MAX_NO_DIRECTIONS 2 #define MASA_MAX_BITS 1300 /* max. bit-budget for MASA metadata */ + +#ifdef HR_METADATA +#define MASA_MAX_BITS_HR 2000 /* max. bit-budget for MASA metadata in HR mode*/ +#define HR_MASA_ER_LEVELS 16 +#endif + #define LIMIT_ER_ELEVATION_ENC 4 #define LIMIT_ER_SIMPLE_ENC 6 #define LIMIT_USE_COMMON 3 @@ -1133,7 +1245,11 @@ enum #define MASA_ANGLE_TOLERANCE 0.5f #define MASA_LIMIT_NO_BANDS_SUR_COH 8 #define MINIMUM_BIT_BUDGET_NORMAL_META 100 +#ifdef HODIRAC +#define DIFF_DFRATIO_2BIT_LIMIT_IDX_HODIRAC 4 +#endif #define DIFF_DFRATIO_2BIT_LIMIT_IDX 3 + #define DIFF_DFRATIO_1BIT_LIMIT_IDX 6 #define DIFF_EC_HUFF_BAND_LIMIT 8 #define DIFF_EC_HUFF_GR0_LIMIT 8 @@ -1150,7 +1266,12 @@ enum #define MASA_STEREO_MIN_BITRATE IVAS_24k4 #define MASA_BIT_REDUCT_PARAM 10 +#ifdef HR_METADATA +#define MASA_MAXIMUM_TWO_DIR_BANDS 24 +#define NBITS_HR_COH 4 +#else #define MASA_MAXIMUM_TWO_DIR_BANDS 18 +#endif typedef enum { MASA_STEREO_NOT_DEFINED, @@ -1158,6 +1279,11 @@ typedef enum MASA_STEREO_DOWNMIX } MASA_TRANSPORT_SIGNAL_TYPE; +typedef enum +{ + MASA_FRAME_1SF, + MASA_FRAME_4SF +} MASA_FRAME_MODE; /*----------------------------------------------------------------------------------* * Multichannel format @@ -1171,7 +1297,12 @@ typedef enum MC_MODE_NONE, MC_MODE_MCT, MC_MODE_PARAMMC, +#ifndef MC_PARAMUPMIX_MODE MC_MODE_MCMASA +#else + MC_MODE_MCMASA, + MC_MODE_PARAMUPMIX +#endif } MC_MODE; typedef enum @@ -1223,19 +1354,65 @@ typedef enum #define NBBITS_MCT_RATIO 4 #define BITRATE_MCT_RATIO_RANGE ( 1 << NBBITS_MCT_RATIO ) /* Range of the coded bitrate distribution ratio */ -#define LFE_BITS 180 - -#define MCT_LFE_MAX_LINE 24 #define MCT_NUM_BLOCK_DATA_BITS 4 typedef enum { MCT_CHAN_MODE_REGULAR, - MCT_CHAN_MODE_LFE, MCT_CHAN_MODE_IGNORE } MCT_CHAN_MODE; +#ifdef MC_PARAMUPMIX_MODE +/*----------------------------------------------------------------------------------* + * MC Param-Upmix Mode Constants + *----------------------------------------------------------------------------------*/ +#define MC_PARAMUPMIX_MAX_TRANSPORT_CHANS 8 +#define MC_PARAMUPMIX_MAX_INPUT_CHANS 12 +#define MC_PARAMUPMIX_MAX_BITS 1024 /* Maximum number of bits for the MC Param-Upmix metadata */ +#define MC_PARAMUPMIX_COMBINATIONS 4 /* number of sets of 2 channels combined */ +#define MC_PARAMUPMIX_NCH 2 /* number of channels to combine into 1 */ +#define MC_PARAMUPMIX_MIN_CLDFB 8 + +typedef struct { + const int32_t *value; + const uint16_t *length; +} HUFF_TAB; + +typedef struct { + int32_t value[81]; + unsigned short length[81]; +} HUFF_ELEMENTS; + +typedef struct { + HUFF_ELEMENTS df0; + HUFF_ELEMENTS df; + HUFF_ELEMENTS dt; +} HUFF_TABLE; + +typedef enum { + ALPHA, + BETA +} PAR_TYPE; +typedef enum { + FINE, + COARSE +} QUANT_TYPE; + +typedef struct { + int16_t nquant; + int16_t offset; + float data[35]; +} ACPL_QUANT_TABLE; + +typedef struct +{ + const int16_t (*alpha[2])[2]; + const int16_t (*beta[2])[2]; +} HUFF_NODE_TABLE; + + +#endif /*----------------------------------------------------------------------------------* * Parametric MC Constants *----------------------------------------------------------------------------------*/ @@ -1252,7 +1429,11 @@ typedef enum #define PARAM_MC_REG_GHAT (0.001f) /* Regularization factor for mixing matrix calculation */ #define PARAM_MC_MAX_PARAMETER_BANDS 20 /* Maximum number of parameter bands */ #define PARAM_MC_MAX_PARAMETER_BANDS_RES 14 /* Maximum number of parameter bands with decorrelation */ +#ifdef JBM_TSM_ON_TCS +#define PARAM_MC_MAX_NSLOTS MAX_JBM_CLDFB_TIMESLOTS /* Maximum number of CLDFB slots in a frame */ +#else #define PARAM_MC_MAX_NSLOTS 16 /* Maximum number of CLDFB slots in a frame */ +#endif #define PARAM_MC_MAX_NSLOTS_IN_SUBFRAME 4 /* Maximum number of CLDFB slots in a subframe */ #define PARAM_MC_NSUBFRAMES_DEC 4 /* Number of subframes for the synthesis in the decoder */ #define PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND 30 /* Maximum number of CLDFB frequency bands within a parameter band */ @@ -1283,6 +1464,9 @@ typedef enum #define PARAM_MC_BAND_TO_MDCT_BAND_RATIO 16 /* Ratio of resolution of CLDFB Bands to MDCT Bands */ #define PARAM_MC_SLOT_ENC_NS 2500000L #define PARAM_MC_MDFT_NO_SLOTS 8 +#ifdef PARAMMC_SHORT_ENC_MDFT +#define PARAM_MC_CLDFB_TO_MDFT_FAC 2 +#endif /*----------------------------------------------------------------------------------* * LFE Coding Constants @@ -1358,16 +1542,12 @@ typedef enum #define BINAURAL_MAXBANDS 60 /* Max number of bands */ #define BINAURAL_CONVBANDS 50 /* Bands upto which convolution is performed */ -#ifdef HRTF_BINARY_FILE #define BINAURAL_NTAPS 7 -#endif #define BINAURAL_NTAPS_MAX 96 #define HRTF_SH_ORDER 3 #define HRTF_SH_CHANNELS 16 -#ifdef HRTF_BINARY_FILE #define HRTF_LS_CHANNELS 15 -#endif #define HRTF_NUM_BINS 60 #define REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ #define GAIN_LFE 1.88364911f /* Gain applied to LFE during renderering */ @@ -1376,17 +1556,15 @@ typedef enum #define BINAURAL_COHERENCE_DIFFERENCE_BINS 9 /* Number of bins for direction-dependent diffuse-field binaural coherence */ -#ifdef HRTF_BINARY_FILE typedef enum { BINAURAL_INPUT_AUDIO_CONFIG_INVALID, - BINAURAL_INPUT_AUDIO_CONFIG_COMBINED, // 5_1, 5_1_2, 5_1_4, 7_1, 7_1_4 - BINAURAL_INPUT_AUDIO_CONFIG_HOA, // FOA, HOA2, HOA3 - BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED // Not used + BINAURAL_INPUT_AUDIO_CONFIG_COMBINED, /* 5_1, 5_1_2, 5_1_4, 7_1, 7_1_4 */ + BINAURAL_INPUT_AUDIO_CONFIG_HOA, /* FOA, HOA2, HOA3 */ + BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED /* Not used */ } BINAURAL_INPUT_AUDIO_CONFIG; -#endif #define HEADROT_ORDER 3 #define HEADROT_SHMAT_DIM ( ( HEADROT_ORDER + 1 ) * ( HEADROT_ORDER + 1 ) ) #define HEADROT_SHMAT_DIM2 ( HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM ) @@ -1409,10 +1587,13 @@ typedef enum #define SFX_SPAT_BIN_NUM_SUBSAMPLES 64 #define ITD_MEM_LEN (MAX_ITD + SFX_SPAT_BIN_SINC_M) #define L_SUBFRAME5MS_48k (L_FRAME48k/4) -#define MAX_ANGULAR_STEP (15.0f) +#ifdef FIX_421_TD_INT_TUNE +#define MAX_ANGULAR_STEP (0.01f) +#else +#define MAX_ANGULAR_STEP (1.0f) +#endif #define MAX_ANGULAR_STEP_INV ( 1.0f / MAX_ANGULAR_STEP ) #define MAX_INTERPOLATION_STEPS 12 -#define BINAURAL_TD_LATENCY_S 0.0f /* ITD fix removes TD renderer delay -- should be cleaned out */ /* ----- Enums - TD Renderer ----- */ @@ -1431,7 +1612,12 @@ typedef enum typedef enum { TDREND_PLAYSTATUS_INITIAL, +#ifdef ISM_NON_DIEGETIC_PAN + TDREND_PLAYSTATUS_PLAYING, + TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC +#else TDREND_PLAYSTATUS_PLAYING +#endif } TDREND_PlayStatus_t; typedef enum @@ -1459,15 +1645,20 @@ typedef enum *----------------------------------------------------------------------------------*/ /* Orientation tracking types */ -#define IVAS_ORIENT_TRK_REF 0 -#define IVAS_ORIENT_TRK_AVG 1 +#define IVAS_ORIENT_TRK_NONE 0 +#define IVAS_ORIENT_TRK_REF 1 +#define IVAS_ORIENT_TRK_AVG 2 +#define IVAS_ORIENT_TRK_REF_VEC 3 +#define IVAS_ORIENT_TRK_REF_VEC_LEV 4 typedef enum { - OTR_TRACKING_NONE = IVAS_ORIENT_TRK_REF-1, /* track orientation relative to external reference orientation (default: yaw=pitch=roll=0) */ // VE: not really used in IVAS (only in unit-test) - OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: yaw=pitch=roll=0) */ + OTR_TRACKING_NONE = IVAS_ORIENT_TRK_NONE, + OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: no rotation) */ OTR_TRACKING_AVG_ORIENT = IVAS_ORIENT_TRK_AVG /* track orientation relative to average orientation */ - + , + OTR_TRACKING_REF_VEC = IVAS_ORIENT_TRK_REF_VEC, /* track orientation relative to external reference vector */ + OTR_TRACKING_REF_VEC_LEV = IVAS_ORIENT_TRK_REF_VEC_LEV /* track orientation relative to level component of external reference vector */ } OTR_TRACKING_T; @@ -1495,6 +1686,9 @@ typedef enum #define IVAS_320_PT_LEN 320 #define IVAS_240_PT_LEN 240 #define IVAS_160_PT_LEN 160 +#ifdef PARAMMC_SHORT_ENC_MDFT +#define IVAS_120_PT_LEN 120 +#endif #define IVAS_80_PT_LEN 80 #define IVAS_40_PT_LEN 40 diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index 90be8b53853740b72bf8b1c9daa51df03af81de4..7a2439660671bbdf529b1a62cc38dd159809f7ab 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -39,7 +39,7 @@ #include "wmc_auto.h" #include "prot.h" - +#define BAND_SMOOTH_REST_START_IDX ( 2 ) /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * @@ -50,27 +50,96 @@ static void ivas_set_up_cov_smoothing( ivas_cov_smooth_state_t *hCovState, ivas_filterbank_t *pFb, const float max_update_rate, - const int16_t min_pool_size ) + const int16_t min_pool_size +#ifndef FIX_331_ALL_BRS + , + const int16_t nchan_inp /* i : number of input channels */ +#endif + , + const int32_t ivas_total_brate ) { int16_t j, k; - - for ( j = 0; j < pFb->filterbank_num_bands; j++ ) + if ( ivas_total_brate < IVAS_24k4 ) { - float update_factor = 0.0f; - - for ( k = 0; k < pFb->fb_bin_to_band.pFb_active_bins_per_band[j]; k++ ) + for ( j = 0; j < pFb->filterbank_num_bands; j++ ) { - update_factor += pFb->fb_bin_to_band.pFb_bin_to_band[j][k]; + float update_factor; + float *p_bin_to_band; + update_factor = 0.0f; + p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j]; + int16_t active_bins; + active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j]; + + for ( k = 0; k < active_bins; k++ ) + { + update_factor += p_bin_to_band[k]; + } + + hCovState->pSmoothing_factor[j] = update_factor / min_pool_size; + float smooth_fact; + if ( ivas_total_brate < IVAS_24k4 ) + { + smooth_fact = 0.5f; + } + else + { + smooth_fact = 0.75; + } + hCovState->pSmoothing_factor[j] *= ( j + 1 ) * smooth_fact; + + if ( hCovState->pSmoothing_factor[j] > max_update_rate ) + { + hCovState->pSmoothing_factor[j] = max_update_rate; + } } + } + else +#ifndef FIX_331_ALL_BRS + if ( nchan_inp <= FOA_CHANNELS ) + { + for ( j = 0; j < pFb->filterbank_num_bands; j++ ) + { + float update_factor; + update_factor = 0.0f; + + for ( k = 0; k < pFb->fb_bin_to_band.pFb_active_bins_per_band[j]; k++ ) + { + update_factor += pFb->fb_bin_to_band.pFb_bin_to_band[j][k]; + } - hCovState->pSmoothing_factor[j] = update_factor / min_pool_size; + hCovState->pSmoothing_factor[j] = update_factor / min_pool_size; - if ( hCovState->pSmoothing_factor[j] > max_update_rate ) + if ( hCovState->pSmoothing_factor[j] > max_update_rate ) + { + hCovState->pSmoothing_factor[j] = max_update_rate; + } + } + } + else + { +#endif + for ( j = 0; j < pFb->filterbank_num_bands; j++ ) { - hCovState->pSmoothing_factor[j] = max_update_rate; + float update_factor; + float *p_bin_to_band; + int16_t active_bins; + update_factor = 0.0f; + p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j]; + active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j]; + for ( k = 0; k < active_bins; k++ ) + { + update_factor += p_bin_to_band[k]; + } + hCovState->pSmoothing_factor[j] = update_factor / min_pool_size; + hCovState->pSmoothing_factor[j] *= ( j + 1 ) * 0.75f; + if ( hCovState->pSmoothing_factor[j] > max_update_rate ) + { + hCovState->pSmoothing_factor[j] = max_update_rate; + } } +#ifndef FIX_331_ALL_BRS } - +#endif hCovState->prior_bank_idx = -1; return; @@ -88,6 +157,8 @@ ivas_error ivas_spar_covar_smooth_enc_open( const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t nchan_inp /* i : number of input channels */ + , + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_cov_smooth_state_t *hCovState; @@ -115,7 +186,12 @@ ivas_error ivas_spar_covar_smooth_enc_open( } } - ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size ); + +#ifndef FIX_331_ALL_BRS + ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, nchan_inp, ivas_total_brate ); +#else + ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, ivas_total_brate ); +#endif *hCovState_out = hCovState; @@ -176,15 +252,18 @@ static void ivas_compute_smooth_cov( const int16_t start_band, const int16_t end_band, const int16_t num_ch, - const int16_t transient_det ) + const int16_t transient_det[2] ) { int16_t i, j, k; int16_t prev_idx = hCovState->prior_bank_idx; float factor = 0; + int16_t sm_b; + int16_t non_sm_b_idx; + sm_b = BAND_SMOOTH_REST_START_IDX; assert( end_band <= pFb->filterbank_num_bands ); - if ( prev_idx == -1 || transient_det == 1 ) + if ( prev_idx == -1 || transient_det[1] == 1 ) { for ( i = 0; i < num_ch; i++ ) { @@ -194,6 +273,36 @@ static void ivas_compute_smooth_cov( } } } + else if ( transient_det[0] == 1 ) + { + non_sm_b_idx = min( sm_b, end_band ); + for ( i = 0; i < num_ch; i++ ) + { + for ( j = 0; j < num_ch; j++ ) + { + if ( i == j ) + { + factor = fac; + } + else + { + factor = 0.0f; + } + + for ( k = start_band; k < non_sm_b_idx; k++ ) + { + pCov_buf[i][j][k] = pPrior_cov_buf[i][j][k] + ( hCovState->pSmoothing_factor[k] * ( pCov_buf[i][j][k] - pPrior_cov_buf[i][j][k] + factor ) ); + } + } + } + for ( i = 0; i < num_ch; i++ ) + { + for ( k = non_sm_b_idx; k < end_band; k++ ) + { + pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac ); + } + } + } else if ( prev_idx == 0 ) { for ( i = 0; i < num_ch; i++ ) @@ -234,7 +343,7 @@ void ivas_cov_smooth_process( const int16_t start_band, const int16_t end_band, const int16_t num_ch, - const int16_t transient_det ) + const int16_t transient_det[2] ) { int16_t i, j; int16_t num_bands = end_band - start_band; diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 01f133a3b7f2fc2d6bd0c5e24ef94419c0dca733..2792efc1963d0578d932c6952be61d65ab88ad42 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -71,8 +71,10 @@ ivas_error ivas_dirac_config( int16_t spar_dirac_split_band; IVAS_FB_MIXER_HANDLE hFbMdft; SBA_MODE sba_mode; + int16_t *dirac_to_spar_md_bands; + error = IVAS_ERR_OK; if ( enc_dec == ENC ) @@ -128,7 +130,14 @@ ivas_error ivas_dirac_config( if ( sba_mode == SBA_MODE_SPAR ) { hConfig->nbands = IVAS_MAX_NUM_BANDS; + spar_dirac_split_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); +#ifdef HODIRAC + if ( sba_order > 1 && ivas_total_brate > IVAS_256k ) + { + spar_dirac_split_band = 0; + } +#endif } else { @@ -137,7 +146,9 @@ ivas_error ivas_dirac_config( } hConfig->enc_param_start_band = 0; hConfig->dec_param_estim = FALSE; - +#ifdef FIX_391_SBA + hConfig->dec_param_estim_old = hConfig->dec_param_estim; +#endif if ( ivas_format == SBA_FORMAT ) /* skip for MASA decoder */ { if ( ( error = ivas_dirac_sba_config( hQMetaData, nchan_transport, nSCE, nCPE, element_mode, ivas_total_brate, sba_order, sba_mode, hConfig->nbands - spar_dirac_split_band ) ) != IVAS_ERR_OK ) @@ -162,6 +173,16 @@ ivas_error ivas_dirac_config( { hConfig->enc_param_start_band = spar_dirac_split_band; } +#ifdef HODIRAC + if ( sba_order > 1 && ivas_total_brate > IVAS_256k ) + { + hConfig->dec_param_estim = FALSE; + hConfig->enc_param_start_band = 0; + + set_c( (int8_t *) hQMetaData->twoDirBands, (int8_t) 1, hQMetaData->q_direction[0].cfg.nbands ); + hQMetaData->numTwoDirBands = (uint8_t) hQMetaData->q_direction[0].cfg.nbands; + } +#endif } else { @@ -174,7 +195,9 @@ ivas_error ivas_dirac_config( if ( sba_mode == SBA_MODE_SPAR ) { - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + ivas_dirac_config_bands( band_grouping, + IVAS_MAX_NUM_BANDS, + (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft ); } else @@ -259,9 +282,10 @@ void ivas_dirac_config_bands( { band_grouping[reduced_band] = max_band; } - for ( band = enc_param_start_band + 1; band < DIRAC_MAX_NBANDS; band++ ) + for ( band = enc_param_start_band + ( DIRAC_MAX_NBANDS - enc_param_start_band ) / 2 - 1, reduced_band = DIRAC_MAX_NBANDS - 1; band >= enc_param_start_band; band--, reduced_band -= step ) { - dirac_to_spar_md_bands[band] = dirac_to_spar_md_bands[band - 1]; + dirac_to_spar_md_bands[reduced_band] = dirac_to_spar_md_bands[band]; + dirac_to_spar_md_bands[reduced_band - 1] = dirac_to_spar_md_bands[band]; } } else @@ -351,12 +375,44 @@ ivas_error ivas_dirac_sba_config( else { hQMetaData->useLowerBandRes = 0; - nbands_coded = nbands - 1; /* always combine the last two bands */ +#ifdef HODIRAC + if ( !( sba_order > 1 && sba_total_brate > IVAS_256k ) ) +#endif + { + nbands_coded = nbands - 1; /* always combine the last two bands */ + } } - if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, nbands_coded, 1, 0 ) ) != IVAS_ERR_OK ) { - return error; + int16_t no_dirs = 1; +#ifdef HODIRAC + if ( sba_order > 1 && sba_total_brate > IVAS_256k ) + { + no_dirs = 2; + } +#endif + + if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, nbands_coded, no_dirs, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } +#if defined( HODIRAC_FIX_BR_SWITCHING_DTX ) && !defined( FIX_DTX_428 ) + if ( sba_order > 1 && sba_total_brate > IVAS_256k ) + { + int16_t dir, j; + for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) + { + for ( j = 0; j < nbands_coded; j++ ) + { + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + hQMetaData->q_direction[dir].band_data[j].energy_ratio_index[i] = 0; + hQMetaData->q_direction[dir].band_data[j].energy_ratio_index_mod[i] = 0; + } + } + } + } +#endif } if ( sba_total_brate <= IVAS_13k2 ) @@ -449,11 +505,19 @@ ivas_error ivas_dirac_sba_config( } if ( sba_total_brate >= IVAS_96k ) { - if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, 6, 1, 0 ) ) != IVAS_ERR_OK ) { - return error; + int16_t no_dirs = 1; +#ifdef HODIRAC + if ( sba_order > 1 && sba_total_brate > IVAS_256k ) + { + no_dirs = 2; + } +#endif + if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, 6, no_dirs, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } } - nbands_wb = 4; } else @@ -481,7 +545,16 @@ ivas_error ivas_dirac_sba_config( for ( i = 0; i < hQMetaData->no_directions; i++ ) { hQMetaData->q_direction[i].cfg.search_effort = 1; - hQMetaData->q_direction[i].cfg.start_band = nbands_wb; +#ifdef HODIRAC + if ( sba_order > 1 && sba_total_brate > IVAS_256k ) + { + hQMetaData->q_direction[i].cfg.start_band = 0; + } + else +#endif + { + hQMetaData->q_direction[i].cfg.start_band = nbands_wb; + } } *element_mode = IVAS_CPE_MDCT; @@ -784,6 +857,220 @@ void deindex_spherical_component( return; } +#ifdef HODIRAC +void calculate_hodirac_sector_parameters( + float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i: signal vector (L+1)^2 x N_bins, real part */ + float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i: signal vector, imaginary part*/ + const int16_t N_bins, /* i: number of bins */ + const float beta, /* i: forgetting factor for average filtering */ + const int16_t *band_grouping, /* i: indices of band groups */ + const int16_t N_bands, /* i: number of bands (groups) */ + const int16_t enc_param_start_band, /* i: first band to process */ + float *azi, /* o: array of sector azimuth angles, flat */ + float *ele, /* o: array of sector elevation angles, flat */ + float *diff, /* o: array of sector diffuseness values, flat*/ + float *ene /* o: array of sector energy values, flat*/ +) +{ + int16_t i_sec, i_bin, i_band; + + float p_real, p_imag, normI, energy, tmp_diff; + + float sec_I_vec_x[NUM_ANA_SECTORS]; + float sec_I_vec_y[NUM_ANA_SECTORS]; + float sec_I_vec_z[NUM_ANA_SECTORS]; + + static int16_t firstrun_sector_params = 1; + + static float sec_I_vec_smth_x[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; + static float sec_I_vec_smth_y[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; + static float sec_I_vec_smth_z[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; + + static float energy_smth[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; + static float azi_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; + static float ele_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; + +#ifdef DEBUGGING + assert( N_bins <= DIRAC_NO_FB_BANDS_MAX ); +#endif + + for ( i_sec = 0; i_sec < NUM_ANA_SECTORS; i_sec++ ) + { + + float *p_sec_I_vec_x = &sec_I_vec_x[i_sec]; + float *p_sec_I_vec_y = &sec_I_vec_y[i_sec]; + float *p_sec_I_vec_z = &sec_I_vec_z[i_sec]; + + const float *p_c_weights = c_weights; + + float *p_ImagBuffer_0 = ImagBuffer[0]; + float *p_ImagBuffer_1 = ImagBuffer[1]; + float *p_ImagBuffer_2 = ImagBuffer[2]; + float *p_ImagBuffer_3 = ImagBuffer[3]; + float *p_ImagBuffer_4 = ImagBuffer[4]; + float *p_ImagBuffer_5 = ImagBuffer[5]; + float *p_ImagBuffer_6 = ImagBuffer[6]; + float *p_ImagBuffer_8 = ImagBuffer[8]; + + float *p_RealBuffer_0 = RealBuffer[0]; + float *p_RealBuffer_1 = RealBuffer[1]; + float *p_RealBuffer_2 = RealBuffer[2]; + float *p_RealBuffer_3 = RealBuffer[3]; + float *p_RealBuffer_4 = RealBuffer[4]; + float *p_RealBuffer_5 = RealBuffer[5]; + float *p_RealBuffer_6 = RealBuffer[6]; + float *p_RealBuffer_8 = RealBuffer[8]; + + for ( i_band = enc_param_start_band; i_band < N_bands; i_band++ ) + { + float *p_azi = &azi[i_sec * N_bands + i_band]; + float *p_ele = &ele[i_sec * N_bands + i_band]; + float *p_ene = &ene[i_sec * N_bands + i_band]; + + float *p_diff = &diff[i_sec * N_bands + i_band]; + float *p_azi_prev = &azi_prev[i_sec * N_bands + i_band]; + float *p_ele_prev = &ele_prev[i_sec * N_bands + i_band]; + + float *p_energy_smth = &energy_smth[i_sec][i_band]; + float *p_sec_I_vec_smth_x = &sec_I_vec_smth_x[i_sec][i_band]; + float *p_sec_I_vec_smth_y = &sec_I_vec_smth_y[i_sec][i_band]; + float *p_sec_I_vec_smth_z = &sec_I_vec_smth_z[i_sec][i_band]; + + *p_sec_I_vec_x = 0.f; + *p_sec_I_vec_y = 0.f; + *p_sec_I_vec_z = 0.f; + energy = 0.f; + + if ( i_sec == 0 ) + { + for ( i_bin = band_grouping[i_band]; i_bin < band_grouping[i_band + 1]; i_bin++ ) + { + float w = *( p_c_weights++ ); + float sec_w_imag, sec_x_imag, sec_y_imag, sec_z_imag; + float sec_w_real, sec_x_real, sec_y_real, sec_z_real; + + sec_w_imag = 1.772454f * *( p_ImagBuffer_0 ) + 1.772454f * *( p_ImagBuffer_1 ); + sec_x_imag = 1.772454f * *( p_ImagBuffer_3++ ) + 1.023326f * *( p_ImagBuffer_4++ ); + sec_y_imag = 0.590818f * *( p_ImagBuffer_0++ ) + 1.772454f * *( p_ImagBuffer_1++ ) - 0.590817f * *( p_ImagBuffer_6++ ) - 1.023326f * *( p_ImagBuffer_8++ ); + sec_z_imag = 1.772454f * *( p_ImagBuffer_2++ ) + 1.023326f * *( p_ImagBuffer_5++ ); + + sec_w_real = 1.772454f * *( p_RealBuffer_0 ) + 1.772454f * *( p_RealBuffer_1 ); + sec_x_real = 1.772454f * *( p_RealBuffer_3++ ) + 1.023326f * *( p_RealBuffer_4++ ); + sec_y_real = 0.590818f * *( p_RealBuffer_0++ ) + 1.772454f * *( p_RealBuffer_1++ ) - 0.590817f * *( p_RealBuffer_6++ ) - 1.023326f * *( p_RealBuffer_8++ ); + sec_z_real = 1.772454f * *( p_RealBuffer_2++ ) + 1.023326f * *( p_RealBuffer_5++ ); + + p_real = sec_w_real * w; + p_imag = sec_w_imag * w; + + *p_sec_I_vec_x += p_real * sec_x_real + p_imag * sec_x_imag; + *p_sec_I_vec_y += p_real * sec_y_real + p_imag * sec_y_imag; + *p_sec_I_vec_z += p_real * sec_z_real + p_imag * sec_z_imag; + + energy += 0.5f * ( p_real * p_real + p_imag * p_imag + sec_x_real * sec_x_real + sec_x_imag * sec_x_imag + + sec_y_real * sec_y_real + sec_y_imag * sec_y_imag + + sec_z_real * sec_z_real + sec_z_imag * sec_z_imag ); + } + } + else + { + for ( i_bin = band_grouping[i_band]; i_bin < band_grouping[i_band + 1]; i_bin++ ) + { + float w = *( p_c_weights++ ); + float sec_w_imag, sec_x_imag, sec_y_imag, sec_z_imag; + float sec_w_real, sec_x_real, sec_y_real, sec_z_real; + + sec_w_imag = 1.772454f * *(p_ImagBuffer_0) -1.772454f * *( p_ImagBuffer_1 ); + sec_x_imag = 1.772454f * *( p_ImagBuffer_3++ ) - 1.023326f * *( p_ImagBuffer_4++ ); + sec_y_imag = -0.590818f * *( p_ImagBuffer_0++ ) + 1.772454f * *( p_ImagBuffer_1++ ) + 0.590817f * *( p_ImagBuffer_6++ ) + 1.023326f * *( p_ImagBuffer_8++ ); + sec_z_imag = 1.772454f * *( p_ImagBuffer_2++ ) - 1.023326f * *( p_ImagBuffer_5++ ); + + sec_w_real = 1.772454f * *(p_RealBuffer_0) -1.772454f * *( p_RealBuffer_1 ); + sec_x_real = 1.772454f * *( p_RealBuffer_3++ ) - 1.023326f * *( p_RealBuffer_4++ ); + sec_y_real = -0.590818f * *( p_RealBuffer_0++ ) + 1.772454f * *( p_RealBuffer_1++ ) + 0.590817f * *( p_RealBuffer_6++ ) + 1.023326f * *( p_RealBuffer_8++ ); + sec_z_real = 1.772454f * *( p_RealBuffer_2++ ) - 1.023326f * *( p_RealBuffer_5++ ); + + p_real = sec_w_real * w; + p_imag = sec_w_imag * w; + + *p_sec_I_vec_x += p_real * sec_x_real + p_imag * sec_x_imag; + *p_sec_I_vec_y += p_real * sec_y_real + p_imag * sec_y_imag; + *p_sec_I_vec_z += p_real * sec_z_real + p_imag * sec_z_imag; + + energy += 0.5f * ( p_real * p_real + p_imag * p_imag + sec_x_real * sec_x_real + sec_x_imag * sec_x_imag + + sec_y_real * sec_y_real + sec_y_imag * sec_y_imag + + sec_z_real * sec_z_real + sec_z_imag * sec_z_imag ); + } + } + + if ( firstrun_sector_params ) + { + *p_sec_I_vec_smth_x = *p_sec_I_vec_x; + *p_sec_I_vec_smth_y = *p_sec_I_vec_y; + *p_sec_I_vec_smth_z = *p_sec_I_vec_z; + *p_energy_smth = energy; + } + else + { + float w = ( 1.0f - beta ); + *p_sec_I_vec_smth_x = w * *p_sec_I_vec_x + beta * *p_sec_I_vec_smth_x; + *p_sec_I_vec_smth_y = w * *p_sec_I_vec_y + beta * *p_sec_I_vec_smth_y; + *p_sec_I_vec_smth_z = w * *p_sec_I_vec_z + beta * *p_sec_I_vec_smth_z; + *p_energy_smth = w * energy + beta * *p_energy_smth; + } + + if ( energy < EPSILON ) + { + *p_azi = 0.f; + *p_ele = 0.f; + *p_ene = 0.f; + *p_diff = 1.f; + } + else + { + normI = sqrtf( *p_sec_I_vec_smth_x * *p_sec_I_vec_smth_x + + *p_sec_I_vec_smth_y * *p_sec_I_vec_smth_y + + *p_sec_I_vec_smth_z * *p_sec_I_vec_smth_z ); + *p_azi = atan2f( *p_sec_I_vec_smth_y, *p_sec_I_vec_smth_x ) * _180_OVER_PI; + *p_ele = asinf( *p_sec_I_vec_smth_z / ( normI + EPSILON ) ) * _180_OVER_PI; + *p_ene = *p_energy_smth; + *p_diff = 1.f - normI / ( *p_energy_smth + EPSILON ); + } + + tmp_diff = *p_diff; + + if ( tmp_diff < 0.0f ) + { + *p_diff = 0.f; + } + if ( tmp_diff > 0.5f ) + { + if ( firstrun_sector_params ) + { + *p_azi = 0.f; + *p_ele = 0.f; + } + else + { + *p_azi = 2.f * ( 1.f - tmp_diff ) * *p_azi + ( 2.f * tmp_diff - 1.f ) * *p_azi_prev; + *p_ele = 2.f * ( 1.f - tmp_diff ) * *p_ele + ( 2.f * tmp_diff - 1.f ) * *p_ele_prev; + } + } + else + { + *p_azi_prev = *p_azi; + *p_ele_prev = *p_ele; + } +#ifdef HODIRAC_CHECK_VALUE_RANGE + assert( *p_azi >= -180.f && *p_azi <= 180.f ); + assert( *p_ele >= -90.f && *p_ele <= 90.f ); +#endif + } // i_band + } // i_sec + + firstrun_sector_params = 0; +} +#endif + /*-----------------------------------------------------------------------* * Local functions diff --git a/lib_com/ivas_entropy_coder_common.c b/lib_com/ivas_entropy_coder_common.c index 3b4b0142dcb9c8d1431c0aa3230797ad74c8fb6e..a2fa26cad9f53c6a8f50eaf139331277e3f95f8a 100644 --- a/lib_com/ivas_entropy_coder_common.c +++ b/lib_com/ivas_entropy_coder_common.c @@ -127,7 +127,7 @@ int16_t ivas_map_num_pred_r_to_idx( pred_r_to_idx = PRED_Q_31; break; default: - assert( "Forbidden value for prediction quantization strategy index" ); + assert( !"Forbidden value for prediction quantization strategy index" ); break; } } @@ -145,7 +145,7 @@ int16_t ivas_map_num_pred_r_to_idx( pred_r_to_idx = PRED_Q_21_ACTIVE_W; break; default: - assert( "Forbidden value for prediction quantization strategy index" ); + assert( !"Forbidden value for prediction quantization strategy index" ); break; } } @@ -179,7 +179,7 @@ int16_t ivas_map_num_drct_r_to_idx( drct_r_to_idx = DRCT_Q_11; break; default: - assert( "Forbidden value for DRCT quantization strategy index" ); + assert( !"Forbidden value for DRCT quantization strategy index" ); break; } return drct_r_to_idx; @@ -217,7 +217,7 @@ int16_t ivas_map_num_decd_r_to_idx( decd_r_to_idx = DECD_Q_11; break; default: - assert( "Forbidden value for DECD quantization strategy index" ); + assert( !"Forbidden value for DECD quantization strategy index" ); break; } diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 6503249b342eb0f063865d7d3de97a75e686bb3b..ce5110920740c3238ef0642c0c26275ddbe6d798 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -86,6 +86,10 @@ typedef enum IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT, IVAS_ERR_ISM_INVALID_METADATA_VALUE, IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE, + IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, +#ifdef VARIABLE_SPEED_DECODING + IVAS_ERR_VS_FRAME_NEEDED, +#endif #ifdef DEBUGGING IVAS_ERR_INVALID_FORCE_MODE, #ifdef DEBUG_AGC_ENCODER_CMD_OPTION @@ -120,6 +124,8 @@ typedef enum IVAS_ERR_BITSTREAM_WRITER_INVALID_FORMAT, IVAS_ERR_BITSTREAM_READER_INVALID_DATA, IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT, + IVAS_ERR_NO_FILE_OPEN, + IVAS_ERR_SAMPLING_RATE_UNKNOWN, /*----------------------------------------* * renderer (lib_rend only) * @@ -141,18 +147,7 @@ typedef enum static inline const char *ivas_error_to_string( ivas_error error_code ) { - /* For error categories that are likely to still have many changes to - * specific error codes, return one string per category */ - if ( ( error_code & 0xF000 ) == 0x1000 ) - { - return "API error"; - } - if ( ( error_code & 0xF000 ) == 0x2000 ) - { - return "data error"; - } - - /* For categories that are unlikely to change, use more specific strings */ + /* Try to match to a specific string */ switch ( error_code ) { case IVAS_ERR_OK: @@ -175,6 +170,8 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) return "Wrong number of channels"; case IVAS_ERR_INVALID_BUFFER_SIZE: return "Invalid buffer size"; + case IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED: + return "Unsupported input/output config pair"; case IVAS_ERR_FAILED_FILE_OPEN: return "File open error"; case IVAS_ERR_FAILED_FILE_WRITE: @@ -189,6 +186,17 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) break; } + /* For error categories that are likely to still have many changes to + * specific error codes, return one string per category */ + if ( ( error_code & 0xF000 ) == 0x1000 ) + { + return "API error"; + } + if ( ( error_code & 0xF000 ) == 0x2000 ) + { + return "data error"; + } + return "Unknown error"; } diff --git a/lib_com/ivas_error_utils.h b/lib_com/ivas_error_utils.h index 034369656bc8e54c703e986e3479a514eafa1c2b..b9a6b3f872443e35368c4d802054d6f47eaafc42 100644 --- a/lib_com/ivas_error_utils.h +++ b/lib_com/ivas_error_utils.h @@ -84,6 +84,7 @@ static inline ivas_error ivas_error_wrapper( const ivas_error error_code, const fprintf( stderr, "\n\nIn function: %s(), %s:%d\n\n", function, file, line ); // assert( 0 ); + return error_code; } #else diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 5787470e0fbfef766b2b14b562e2800f60befd75..3f54709bfff0ffafa5551aed85cbf27900f4c1d2 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -106,6 +106,10 @@ ivas_error ivas_fb_set_cfg( const int16_t num_out_chans, /* i : number of FB output channels*/ const int16_t active_w_mixing, /* i : active_w_mixing flag */ const int32_t sampling_rate /* i : sampling rate */ +#ifdef HODIRAC + , + const int16_t nchan_fb_in /* i: number of dirac analysis channels */ +#endif ) { IVAS_FB_CFG *pFb_cfg; @@ -117,6 +121,9 @@ ivas_error ivas_fb_set_cfg( pFb_cfg->num_in_chans = num_in_chans; pFb_cfg->num_out_chans = num_out_chans; +#ifdef HODIRAC + pFb_cfg->nchan_fb_in = nchan_fb_in; +#endif pFb_cfg->pcm_offset = 0; /* note: in SPAR decoder, this parameter is overwritten later */ pFb_cfg->active_w_mixing = active_w_mixing; @@ -156,7 +163,11 @@ ivas_error ivas_fb_set_cfg( { pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_1_NS ); pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_1_NS ); +#ifdef PARAMMC_SHORT_ENC_MDFT + pFb_cfg->prior_input_length = NS2SA( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ) + NS2SA( sampling_rate, PARAM_MC_SLOT_ENC_NS ); +#else pFb_cfg->prior_input_length = NS2SA( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ) + 3 * NS2SA( sampling_rate, PARAM_MC_SLOT_ENC_NS ); +#endif } *pFb_cfg_out = pFb_cfg; @@ -174,7 +185,8 @@ ivas_error ivas_fb_set_cfg( ivas_error ivas_FB_mixer_open( IVAS_FB_MIXER_HANDLE *hFbMixer_out, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate */ - IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ + IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { IVAS_FB_MIXER_HANDLE hFbMixer; @@ -186,34 +198,47 @@ ivas_error ivas_FB_mixer_open( frame_len = (int16_t) ( sampling_rate / FRAMES_PER_SEC ); + hFbMixer = *hFbMixer_out; - if ( ( hFbMixer = (IVAS_FB_MIXER_HANDLE) malloc( sizeof( IVAS_FB_MIXER_DATA ) ) ) == NULL ) + if ( !spar_reconfig_flag ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); - } - - if ( fb_cfg->num_out_chans > 0 ) - { - if ( ( hFbMixer->pFb = (ivas_filterbank_t *) malloc( sizeof( ivas_filterbank_t ) ) ) == NULL ) + if ( ( hFbMixer = (IVAS_FB_MIXER_HANDLE) malloc( sizeof( IVAS_FB_MIXER_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); } + + if ( fb_cfg->num_out_chans > 0 ) + { + if ( ( hFbMixer->pFb = (ivas_filterbank_t *) malloc( sizeof( ivas_filterbank_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + } + } + else + { + hFbMixer->pFb = NULL; + } } - else - { - hFbMixer->pFb = NULL; - } + if ( fb_cfg->active_w_mixing == -1 ) { num_chs_alloc = 0; } else if ( fb_cfg->active_w_mixing ) { +#ifdef HODIRAC + num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); +#else num_chs_alloc = fb_cfg->num_in_chans; +#endif } else { +#ifdef SBA_TD_RESIDUAL + num_chs_alloc = 1; /* only W channel processed for predicting YZX */ +#else num_chs_alloc = fb_cfg->num_out_chans; +#endif } for ( i = 0; i < num_chs_alloc; i++ ) @@ -245,8 +270,13 @@ ivas_error ivas_FB_mixer_open( } else { +#ifdef HODIRAC + num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); +#else num_chs_alloc = fb_cfg->num_in_chans; +#endif } + for ( i = 0; i < num_chs_alloc; i++ ) { if ( ( hFbMixer->ppFilterbank_prior_input[i] = (float *) malloc( sizeof( float ) * fb_cfg->prior_input_length ) ) == NULL ) @@ -259,8 +289,11 @@ ivas_error ivas_FB_mixer_open( if ( ( fb_cfg->active_w_mixing != -1 ) && ( fb_cfg->num_out_chans > 0 ) ) { float *pTemp_mem; - +#ifdef HODIRAC + if ( ( pTemp_mem = (float *) malloc( sizeof( float ) * fb_cfg->num_out_chans * max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ) * IVAS_MAX_NUM_BANDS ) ) == NULL ) +#else if ( ( pTemp_mem = (float *) malloc( sizeof( float ) * fb_cfg->num_out_chans * fb_cfg->num_in_chans * IVAS_MAX_NUM_BANDS ) ) == NULL ) +#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer" ); } @@ -275,60 +308,68 @@ ivas_error ivas_FB_mixer_open( } } - if ( fb_cfg->num_out_chans > 0 ) + if ( !spar_reconfig_flag ) { - const int16_t *pActive_bins_per_band, *pActive_bins_per_band_abs, *pStart_offset, *pStart_offset_abs; + if ( fb_cfg->num_out_chans > 0 ) + { + const int16_t *pActive_bins_per_band, *pActive_bins_per_band_abs, *pStart_offset, *pStart_offset_abs; - num_bands = ivas_get_num_bands( sampling_rate ); + num_bands = ivas_get_num_bands( sampling_rate ); - ivas_get_active_bins( &pActive_bins_per_band, &pActive_bins_per_band_abs, &pStart_offset, &pStart_offset_abs, sampling_rate ); + ivas_get_active_bins( &pActive_bins_per_band, &pActive_bins_per_band_abs, &pStart_offset, &pStart_offset_abs, sampling_rate ); - if ( fb_cfg->active_w_mixing != -1 ) - { - for ( i = 0; i < num_bands; i++ ) + if ( fb_cfg->active_w_mixing != -1 ) { - if ( ( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] = (float *) malloc( sizeof( float ) * pActive_bins_per_band_abs[i] ) ) == NULL ) + for ( i = 0; i < num_bands; i++ ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + if ( ( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] = (float *) malloc( sizeof( float ) * pActive_bins_per_band_abs[i] ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + } } } - } - if ( sampling_rate != 48000 ) - { - int16_t num_diff_bands, start_diff_band_non48k; + if ( sampling_rate != 48000 ) + { + int16_t num_diff_bands, start_diff_band_non48k; - num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; - start_diff_band_non48k = num_bands - num_diff_bands; + num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; + start_diff_band_non48k = num_bands - num_diff_bands; - hFbMixer->num_diff_bands = num_diff_bands; + hFbMixer->num_diff_bands = num_diff_bands; - for ( j = start_diff_band_non48k; j < num_bands; j++ ) - { - if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) + for ( j = start_diff_band_non48k; j < num_bands; j++ ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); - } + if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + } - if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); + } } } } - } - else - { + else + { - /* ignore all the deeper filter bank stuff for now */ - hFbMixer->num_diff_bands = 0; + /* ignore all the deeper filter bank stuff for now */ + hFbMixer->num_diff_bands = 0; + } } hFbMixer->fb_cfg = fb_cfg; + set_s( hFbMixer->first_frame, 1, hFbMixer->fb_cfg->num_out_chans ); + set_s( hFbMixer->first_frame + hFbMixer->fb_cfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - hFbMixer->fb_cfg->num_out_chans ); - if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK ) + if ( !spar_reconfig_flag ) { - return error; + if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK ) + { + return error; + } } *hFbMixer_out = hFbMixer; @@ -344,8 +385,9 @@ ivas_error ivas_FB_mixer_open( *------------------------------------------------------------------------*/ void ivas_FB_mixer_close( - IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ - const int32_t sampling_rate /* i : sampling rate in Hz */ + IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */ + const int32_t sampling_rate, /* i : sampling rate in Hz */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { IVAS_FB_MIXER_HANDLE hFbMixer; @@ -362,11 +404,19 @@ void ivas_FB_mixer_close( } else if ( fb_cfg->active_w_mixing ) { +#ifdef HODIRAC + num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); +#else num_chs_alloc = fb_cfg->num_in_chans; +#endif } else { +#ifdef SBA_TD_RESIDUAL + num_chs_alloc = 1; /* only W channel processed for predicting YZX */ +#else num_chs_alloc = fb_cfg->num_out_chans; +#endif } if ( hFbMixer != NULL ) @@ -391,8 +441,14 @@ void ivas_FB_mixer_close( } else { +#ifdef HODIRAC + num_chs_alloc = max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); +#else num_chs_alloc = fb_cfg->num_in_chans; +#endif } + + for ( i = 0; i < num_chs_alloc; i++ ) { free( hFbMixer->ppFilterbank_prior_input[i] ); @@ -405,39 +461,41 @@ void ivas_FB_mixer_close( hFbMixer->prior_mixer[0][0] = NULL; } - if ( fb_cfg->num_out_chans > 0 ) + if ( !spar_reconfig_flag ) { - num_bands = hFbMixer->pFb->filterbank_num_bands; - - if ( fb_cfg->active_w_mixing != -1 ) + if ( fb_cfg->num_out_chans > 0 ) { - for ( i = 0; i < num_bands; i++ ) + num_bands = hFbMixer->pFb->filterbank_num_bands; + + if ( fb_cfg->active_w_mixing != -1 ) { - free( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] ); - hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] = NULL; + for ( i = 0; i < num_bands; i++ ) + { + free( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] ); + hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] = NULL; + } } - } - - if ( sampling_rate != 48000 ) - { - int16_t start_diff_band_non48k; - start_diff_band_non48k = num_bands - hFbMixer->num_diff_bands; - for ( j = start_diff_band_non48k; j < num_bands; j++ ) + if ( sampling_rate != 48000 ) { - free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] ); - hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = NULL; + int16_t start_diff_band_non48k; + start_diff_band_non48k = num_bands - hFbMixer->num_diff_bands; + + for ( j = start_diff_band_non48k; j < num_bands; j++ ) + { + free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] ); + hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = NULL; - free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] ); - hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = NULL; + free( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] ); + hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = NULL; + } } } - } - - if ( hFbMixer->pFb != NULL ) - { - free( hFbMixer->pFb ); - hFbMixer->pFb = NULL; + if ( hFbMixer->pFb != NULL ) + { + free( hFbMixer->pFb ); + hFbMixer->pFb = NULL; + } } if ( hFbMixer->fb_cfg != NULL ) @@ -446,8 +504,11 @@ void ivas_FB_mixer_close( hFbMixer->fb_cfg = NULL; } - free( hFbMixer ); - hFbMixer = NULL; + if ( !spar_reconfig_flag ) + { + free( hFbMixer ); + hFbMixer = NULL; + } } return; @@ -465,6 +526,10 @@ void ivas_fb_mixer_pcm_ingest( float pcm_in[][L_FRAME48k], /* i : input audio channels */ float **ppOut_pcm, /* o : output audio channels */ const int16_t frame_len /* i : frame length */ +#ifdef SPAR_TUNING + , + const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] +#endif ) { int16_t i; @@ -477,13 +542,25 @@ void ivas_fb_mixer_pcm_ingest( } else { +#ifdef SBA_TD_RESIDUAL + num_chs_ingest = 1; /* forward Filterbank MDFT only on W */ +#else num_chs_ingest = fb_cfg->num_out_chans; +#endif } for ( i = 0; i < fb_cfg->num_in_chans; i++ ) { mvr2r( &hFbMixer->ppFilterbank_prior_input[i][fb_cfg->prior_input_length - frame_len], ppOut_pcm[i], frame_len ); +#ifdef HODIRAC +#ifdef SPAR_TUNING + mvr2r( pcm_in[HOA_md_ind[i]], &ppOut_pcm[i][frame_len], frame_len ); +#else + mvr2r( pcm_in[HOA_keep_ind_spar[i]], &ppOut_pcm[i][frame_len], frame_len ); +#endif +#else mvr2r( pcm_in[i], &ppOut_pcm[i][frame_len], frame_len ); +#endif } for ( i = 0; i < num_chs_ingest; i++ ) @@ -505,11 +582,21 @@ void ivas_fb_mixer_update_prior_input( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ float *pcm_in[], /* i : input audio channels */ const int16_t length /* i : length of time slot */ +#ifdef HODIRAC + , + const int16_t nchan_fb_in +#endif ) { int16_t i; - for ( i = 0; i < hFbMixer->fb_cfg->num_in_chans; i++ ) + for ( i = 0; i < +#ifdef HODIRAC + nchan_fb_in; +#else + hFbMixer->fb_cfg->num_in_chans; +#endif + i++ ) { mvr2r( &hFbMixer->ppFilterbank_prior_input[i][length], hFbMixer->ppFilterbank_prior_input[i], hFbMixer->fb_cfg->prior_input_length - length ); mvr2r( pcm_in[i], &hFbMixer->ppFilterbank_prior_input[i][hFbMixer->fb_cfg->prior_input_length - length], length ); @@ -532,6 +619,10 @@ void ivas_fb_mixer_get_windowed_fr( float *frame_f_imag[], /* o : imag freq domain values */ const int16_t length, /* i : number of new samples in time slot */ const int16_t mdft_len /* i : MDFT frame length */ +#ifdef HODIRAC + , + int16_t nchan_fb_in +#endif ) { int16_t ch_idx, j, offset, rev_offset; @@ -546,7 +637,14 @@ void ivas_fb_mixer_get_windowed_fr( rev_offset = (int16_t) ( 2 * mdft_len - hFbMixer->ana_window_offset ); set_zero( fr_in_block, offset ); - for ( ch_idx = 0; ch_idx < hFbMixer->fb_cfg->num_in_chans; ch_idx++ ) + for ( ch_idx = 0; ch_idx < +#ifdef HODIRAC + nchan_fb_in +#else + hFbMixer->fb_cfg->num_in_chans +#endif + ; + ch_idx++ ) { mvr2r( &hFbMixer->ppFilterbank_prior_input[ch_idx][offset + hFbMixer->fb_cfg->windowed_fr_offset], &fr_in_block[offset], n_old_samples - offset ); mvr2r( pcm_in[ch_idx], &fr_in_block[n_old_samples], n_new_samples ); @@ -671,6 +769,7 @@ void ivas_fb_mixer_process( { int16_t start_offset = pFb->fb_consts.pFilterbank_bins_start_offset[i]; int16_t num_bins = pFb->fb_consts.pFilterbank_bins_per_band[i]; + float mixer_const = hFbMixer->prior_mixer[ch][j][i]; pFilterbank_bin_to_band_re = pFb->fb_consts.ppFilterbank_FRs[0][i]; @@ -743,7 +842,9 @@ void ivas_fb_mixer_get_in_out_mapping( for ( i = 1; i < fb_cfg->num_out_chans; i++ ) { in_out_mixer_map[i][0] = 1; +#ifndef SBA_TD_RESIDUAL in_out_mixer_map[i][order[i]] = 1; +#endif } } } @@ -1028,10 +1129,6 @@ static ivas_error ivas_filterbank_setup( error = IVAS_ERR_OK; - set_s( hFbMixer->first_frame, 1, pCfg->num_out_chans ); - set_s( hFbMixer->first_frame + pCfg->num_out_chans, 0, IVAS_SPAR_MAX_CH - pCfg->num_out_chans ); - - if ( pCfg->num_out_chans > 0 ) { hFbMixer->pFb->filterbank_num_bands = ivas_get_num_bands( sampling_rate ); diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_com.c similarity index 71% rename from lib_com/ivas_ism_config.c rename to lib_com/ivas_ism_com.c index b22d82a9da0c1dc1cade26bcaa9919b6b28c32a2..d14b252fd87b163b23d6e27062b53bed5cf948fc 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_com.c @@ -37,6 +37,7 @@ #include "rom_com.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_stat_com.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" @@ -50,7 +51,7 @@ #define FRMS_PER_SECOND ( 1000000000 / FRAME_SIZE_NS ) -#define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISm inactive frames */ +#define BRATE_ISM_INACTIVE 2450 /* CoreCoder bitrate in ISM inactive frames */ #define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRMS_PER_SECOND ) #define BETA_ISM_LOW_IMP 0.6f @@ -87,15 +88,18 @@ static void bitbudget_to_brate( *-------------------------------------------------------------------*/ ivas_error ivas_ism_config( - const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t num_obj, /* i : number of objects */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ - const int16_t ism_imp[], /* i : ISM importance flags */ - int32_t element_brate[], /* o : element bitrate per object */ - int32_t total_brate[], /* o : total bitrate per object */ - int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nchan_ism, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ +#ifdef ISM_NON_DIEGETIC_PAN + const int16_t ism_extended_metadata_flag, /* i : extended metadata flag */ +#endif + const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ + const int16_t ism_imp[], /* i : ISM importance flags */ + int32_t element_brate[], /* o : element bitrate per object */ + int32_t total_brate[], /* o : total bitrate per object */ + int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ ) { int16_t ch; @@ -128,10 +132,21 @@ ivas_error ivas_ism_config( bits_element[n_ISms - 1] += bits_ism % n_ISms; bitbudget_to_brate( bits_element, element_brate, n_ISms ); - /* count ISm common signaling bits */ + /* count ISM common signaling bits */ if ( hIsmMeta != NULL ) { - nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + num_obj; + if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) + { + nb_bits_metadata[0] += ISM_EXTENDED_METADATA_BITS; + +#ifdef ISM_NON_DIEGETIC_PAN + if ( ism_extended_metadata_flag ) + { + nb_bits_metadata[0] += ISM_METADATA_IS_NDP_BITS; + } +#endif + } + nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + nchan_ism; for ( ch = 0; ch < n_ISms; ch++ ) { @@ -289,7 +304,7 @@ ivas_error ivas_ism_config( #ifdef DEBUGGING if ( bits_CoreCoder[ch] == SID_2k40 / FRAMES_PER_SEC ) { - printf( "\nWarning: ISm bitbudget equal to SID!\n" ); + printf( "\nWarning: ISM bitbudget equal to SID!\n" ); } #endif break; @@ -308,7 +323,7 @@ ivas_error ivas_ism_config( tmpL = sum_l( total_brate, n_ISms ) + bits_side * FRMS_PER_SECOND; if ( sum_l( element_brate, n_ISms ) != tmpL ) { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISm bit-budget distribution. Exiting!\n" ); + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\nError: Mismatch in ISM bit-budget distribution. Exiting!\n" ); } } #endif @@ -320,7 +335,7 @@ ivas_error ivas_ism_config( /*-------------------------------------------------------------------* * ivas_ism_reset_metadata() * - * Reset ISm metadata parameters + * Reset ISM metadata parameters *-------------------------------------------------------------------*/ void ivas_ism_reset_metadata( @@ -329,25 +344,37 @@ void ivas_ism_reset_metadata( { hIsmMeta->azimuth = 0.0f; hIsmMeta->elevation = 0.0f; + hIsmMeta->yaw = 0.0f; + hIsmMeta->pitch = 0.0f; + hIsmMeta->radius = 1.0f; +#ifdef ISM_NON_DIEGETIC_PAN + hIsmMeta->ism_metadata_flag = 0; + hIsmMeta->non_diegetic_flag = 0; +#endif return; } + /*-------------------------------------------------------------------* * ivas_ism_reset_metadata_API() * - * Reset ISm metadata parameters + * Reset ISM metadata parameters *-------------------------------------------------------------------*/ + void ivas_ism_reset_metadata_API( ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */ ) { +#ifndef ISM_NON_DIEGETIC_PAN hIsmMeta->ism_metadata_flag = 0; +#endif ivas_ism_reset_metadata( hIsmMeta ); return; } + /*-------------------------------------------------------------------* * ism_quant_meta() * @@ -356,10 +383,12 @@ void ivas_ism_reset_metadata_API( /*! r: index of the winning codeword */ int16_t ism_quant_meta( - const float val, /* i : scalar value to quantize */ - float *valQ, /* o : quantized value */ - const float borders[], /* i : level borders */ - const int16_t cbsize /* i : codebook size */ + const float val, /* i : scalar value to quantize */ + float *valQ, /* o : quantized value */ + const float borders[], /* i : level borders */ + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ + const int16_t cbsize /* i : codebook size */ ) { int16_t idx, idx_start; @@ -369,19 +398,19 @@ int16_t ism_quant_meta( { qlow = borders[0]; idx_start = 0; - step = ISM_Q_STEP_BORDER; + step = q_step_border; } else if ( val <= borders[2] ) { qlow = borders[1]; - idx_start = (int16_t) ( ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP; + idx_start = (int16_t) ( ( borders[1] - borders[0] ) / q_step_border ); + step = q_step; } else { qlow = borders[2]; - idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP_BORDER; + idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); + step = q_step_border; } idx = idx_start + (int16_t) max( 0.f, min( cbsize - 1, ( ( val - qlow ) / step + 0.5f ) ) ); @@ -399,31 +428,33 @@ int16_t ism_quant_meta( /*! r: dequantized value */ float ism_dequant_meta( - const int16_t idx, /* i : quantizer index */ - const float borders[], /* i : level borders */ - const int16_t cbsize /* i : codebook size */ + const int16_t idx, /* i : quantizer index */ + const float borders[], /* i : level borders */ + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ + const int16_t cbsize /* i : codebook size */ ) { int16_t idx_start; float qlow, step, valQ; - if ( idx <= ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ) + if ( idx <= ( borders[1] - borders[0] ) / q_step_border ) { qlow = borders[0]; idx_start = 0; - step = ISM_Q_STEP_BORDER; + step = q_step_border; } - else if ( idx <= cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ) + else if ( idx <= cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ) { qlow = borders[1]; - idx_start = (int16_t) ( ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP; + idx_start = (int16_t) ( ( borders[1] - borders[0] ) / q_step_border ); + step = q_step; } else { qlow = borders[2]; - idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP_BORDER; + idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); + step = q_step_border; } valQ = ( idx - idx_start ) * step + qlow; @@ -439,13 +470,13 @@ float ism_dequant_meta( * ---------------------------------------------------------------*/ void ivas_param_ism_config( - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ + PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i/o: IVAS Param ISM Config Structure */ + const int16_t nchan_obj /* i : number of ISM channels */ ) { - int16_t i, num_obj; + int16_t i; hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; - num_obj = hParamIsm->num_obj; for ( i = 0; i < hParamIsm->nbands; i++ ) { @@ -453,7 +484,7 @@ void ivas_param_ism_config( } /* for elevation zero compute the max azi quantization indices */ - for ( i = 0; i < num_obj; i++ ) + for ( i = 0; i < nchan_obj; i++ ) { hParamIsm->last_az_diff[i] = 0; hParamIsm->last_az_sgn[i] = 1; @@ -490,3 +521,96 @@ ISM_MODE ivas_ism_mode_select( return ism_mode; } + + +/*--------------------------------------------------------------- + * ivas_ism_metadata_close() + * + * Deallocate ISM metadata handles + * ---------------------------------------------------------------*/ + +void ivas_ism_metadata_close( + ISM_METADATA_HANDLE hIsmMetaData[] /* i/o : object metadata handles */ +) +{ + int16_t n; + + if ( hIsmMetaData == NULL || hIsmMetaData == NULL ) + { + return; + } + + for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) + { + if ( hIsmMetaData[n] != NULL ) + { + free( hIsmMetaData[n] ); + hIsmMetaData[n] = NULL; + } + } + + return; +} + + +/*-------------------------------------------------------------------* + * update_last_metadata() + * + * Store last metadata values + *-------------------------------------------------------------------*/ + +void update_last_metadata( + const int16_t nchan_ism, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t updt_flag[] /* i : last metadata update flag */ +) +{ + int16_t ch; + + for ( ch = 0; ch < nchan_ism; ch++ ) + { + if ( updt_flag[ch] == 1 ) + { + hIsmMeta[ch]->last_azimuth = hIsmMeta[ch]->azimuth; + hIsmMeta[ch]->last_elevation = hIsmMeta[ch]->elevation; + } + } + + return; +} + + +/*----------------------------------------------------------------* + * ivas_get_ism_sid_quan_bitbudget() + * + * Set quantization bits based on the number of coded objects + *----------------------------------------------------------------*/ + +void ivas_get_ism_sid_quan_bitbudget( + const int16_t nchan_ism, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + float *q_step, /* o : quantization step */ + float *q_step_border, /* o : quantization step at the border */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +) +{ + *nBits_azimuth = ISM_DTX_AZI_BITS_HIGH; + *nBits_elevation = ISM_DTX_ELE_BITS_HIGH; + *q_step = ISM_Q_STEP_HIGH; + *q_step_border = ISM_Q_STEP_BORDER_HIGH; + *nBits_coh = ISM_DTX_COH_SCA_BITS; + *nBits_sce_id = 1; + + if ( nchan_ism >= 3 ) + { + *nBits_azimuth = ISM_DTX_AZI_BITS_LOW; + *nBits_elevation = ISM_DTX_ELE_BITS_LOW; + *q_step = ISM_Q_STEP_LOW; + *q_step_border = ISM_Q_STEP_BORDER_LOW; + *nBits_sce_id = 2; + } + + return; +} diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 421b2882f4022f10e68722422dd9aef94dbb6173..02d9939dc49ef33e237293183fec208494287dd3 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -302,6 +302,7 @@ void ivas_masa_set_coding_config( return; } + /*--------------------------------------------------------------- * masa_sample_rate_band_correction() * @@ -313,6 +314,8 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : Sampling rate */ + , + MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ) { uint8_t band, sf; @@ -385,6 +388,203 @@ void masa_sample_rate_band_correction( hQMetaData->twoDirBands[band] = 0; } } + if ( hExtOutMeta != NULL ) + { + /* in decoder, zero the EXT out MASA meta buffer */ + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + for ( band = config->numCodingBands; band < MASA_FREQUENCY_BANDS; band++ ) + { + hExtOutMeta->directionIndex[0][sf][band] = SPH_IDX_FRONT; + hExtOutMeta->directToTotalRatio[0][sf][band] = 0u; + hExtOutMeta->spreadCoherence[0][sf][band] = 0u; + + hExtOutMeta->directionIndex[1][sf][band] = SPH_IDX_FRONT; + hExtOutMeta->directToTotalRatio[1][sf][band] = 0u; + hExtOutMeta->spreadCoherence[1][sf][band] = 0u; + + hExtOutMeta->surroundCoherence[sf][band] = 0u; + hExtOutMeta->diffuseToTotalRatio[sf][band] = UINT8_MAX; + } + } + } return; } + +#ifdef HR_METADATA +/* !r: output index for direction */ +uint16_t index_theta_phi_16( + float *p_theta, /* i/o : input elevation to be indexed */ + float *p_phi, /* i/o : input azimuth to be indexed */ + SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ +) +{ + float abs_theta; + int16_t sign_th, id_phi, id_th; + uint16_t idx_sph; + uint16_t cum_n; + float theta_hat, phi_hat; + float theta, phi; + + theta = *p_theta; + phi = *p_phi; + phi_hat = 0; + theta_hat = 0; + phi = phi + 180; + + if ( theta < 0 ) + { + abs_theta = -theta; + sign_th = -1; + } + else + { + abs_theta = theta; + sign_th = 1; + } + + id_th = quantize_theta( abs_theta, gridData->no_theta, &theta_hat ); + if ( gridData->no_theta > 1 ) + { + if ( gridData->no_phi[id_th] > 1 ) + { + id_phi = quantize_phi_masa( phi, ( id_th % 2 == 1 ), &phi_hat, gridData->no_phi[id_th] ); + } + else + { + id_phi = 0; + phi_hat = 180; + } + } + else + { + id_phi = quantize_phi_masa( phi, ( id_th % 2 == 1 ), &phi_hat, gridData->no_phi[id_th] ); + } + *p_theta = sign_th * theta_hat; + *p_phi = phi_hat - 180; + + /* Starting from Equator, alternating positive and negative */ + if ( id_th == 0 ) + { + idx_sph = id_phi; + } + else + { + if ( id_th == gridData->no_theta - 1 ) + { + idx_sph = 65534 + ( sign_th < 0 ); + } + else + { + theta = MASA_ANGLE_AT_EQUATOR * (float) ( id_th + 0.5f ); + if ( id_th == 1 ) + { + cum_n = 2 * (uint16_t) ceilf( MASA_NTOT2_FAC * ( sinf( theta ) - MASA_ASIN_OFFSET ) ); + } + else + { + cum_n = 2 * (uint16_t) roundf( MASA_NTOT2_FAC * ( sinf( theta ) - MASA_ASIN_OFFSET ) ); + } + + cum_n += gridData->no_phi[0]; + + if ( sign_th > 0 ) + { + cum_n -= 2 * gridData->no_phi[id_th]; + } + else + { + cum_n -= gridData->no_phi[id_th]; + } + idx_sph = cum_n + id_phi; + } + } + + + return idx_sph; +} + +int16_t quantize_theta( + float x, /* i : theta value to be quantized */ + int16_t no_cb, /* i : number of codewords */ + float *xhat /* o : quantized value */ +) +{ + int16_t imin; + float diff1, diff2; + + imin = (int16_t) ( x * MASA_INV_ANGLE_AT_EQUATOR_DEG + 0.5f ); + + if ( imin >= no_cb - 1 ) + { + imin = no_cb - 1; + diff1 = x - 90; + diff2 = x - MASA_ANGLE_AT_EQUATOR_DEG * ( imin - 1 ); + if ( fabsf( diff1 ) > fabsf( diff2 ) ) + { + imin--; + *xhat = imin * MASA_ANGLE_AT_EQUATOR_DEG; + } + else + { + *xhat = 90; + } + } + else + { + *xhat = imin * MASA_ANGLE_AT_EQUATOR_DEG; + } + + return imin; +} + + +/* !r: index azimuth */ +int16_t quantize_phi_masa( + float phi, /* i : azimuth value */ + int16_t flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ + float *phi_hat, /* o : quantized azimuth */ + const int16_t n /* i : azimuth codebook size */ +) +{ + int16_t id_phi; + float dd; + float delta_phi; + + delta_phi = 360.0f / (float) n; + + if ( n == 1 ) + { + *phi_hat = 0; + + return 0; + } + + if ( flag_delta == 1 ) + { + dd = delta_phi / 2.0f; + } + else + { + dd = 0; + } + + id_phi = (int16_t) ( ( phi - dd + delta_phi / 2.0f ) / (float) delta_phi ); + + if ( id_phi == n ) + { + id_phi = 0; + } + + if ( id_phi == -1 ) + { + id_phi = n - 1; + } + + *phi_hat = id_phi * delta_phi + dd; + + return id_phi; +} + +#endif diff --git a/lib_com/ivas_mc_com.c b/lib_com/ivas_mc_com.c index 1b3e00adb06c0eed2e8f4ff518cddb249ec7944b..9bda9d49a4d27edd80a390f1a702c332acf801a0 100644 --- a/lib_com/ivas_mc_com.c +++ b/lib_com/ivas_mc_com.c @@ -103,10 +103,21 @@ MC_MODE ivas_mc_mode_select( { mc_mode = MC_MODE_MCMASA; } +#ifndef MC_PARAMUPMIX_MODE else if ( total_brate < IVAS_192k ) { mc_mode = MC_MODE_PARAMMC; } +#else + else if ( total_brate < IVAS_160k ) + { + mc_mode = MC_MODE_PARAMMC; + } + else if ( total_brate < IVAS_192k ) + { + mc_mode = MC_MODE_PARAMUPMIX; + } +#endif break; default: assert( 0 && "LS Setup not supported or defined for MC mode!\n" ); @@ -115,6 +126,7 @@ MC_MODE ivas_mc_mode_select( return mc_mode; } + /*--------------------------------------------------------------- * ivas_mc_setup_get_num_channels() * @@ -154,6 +166,7 @@ int16_t ivas_mc_ls_setup_get_num_channels( return nchan; } + /*--------------------------------------------------------------- * ivas_mc_map_output_config_to_mc_ls_setup() * @@ -193,6 +206,7 @@ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( return mc_ls_setup; } + /*--------------------------------------------------------------- * ivas_mc_map_ls_setup_to_output_config * diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index 502f33b2b487da863c688ae6526d5079c4269368..acf7a8eae2c97e5a2a5092ad5d970c734f126de7 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -141,7 +141,6 @@ void ivas_param_mc_metadata_open( ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[i] ); } - /* init remaining flags and indices */ hMetadataPMC->param_frame_idx = 0; hMetadataPMC->flag_use_adaptive_icc_map = 0; @@ -212,7 +211,6 @@ void ivas_param_mc_metadata_close( { uint16_t i; - /* adaptive ICC mapping */ for ( i = 0; i < 2; i++ ) { @@ -422,6 +420,7 @@ static int16_t ivas_param_mc_get_num_param_bands( return num_parameter_bands; } + /*------------------------------------------------------------------------- * Local functions *------------------------------------------------------------------------*/ @@ -438,7 +437,6 @@ static void ivas_param_mc_set_coding_scheme( HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: Parametric MC metadata handle */ ) { - /* quantizer and coding tables */ switch ( mc_ls_setup ) { @@ -520,5 +518,6 @@ static void ivas_param_mc_set_coding_scheme( } hMetadataPMC->num_parameter_bands = ivas_param_mc_get_num_param_bands( mc_ls_setup, ivas_total_brate ); + return; } diff --git a/lib_com/ivas_mcmasa_com.c b/lib_com/ivas_mcmasa_com.c index 27becd16a8c688d21d7c72098c8a2a51fd827408..1b7db4ff01a7c1426c65eb74c0cba4ab76cc8eaa 100644 --- a/lib_com/ivas_mcmasa_com.c +++ b/lib_com/ivas_mcmasa_com.c @@ -65,6 +65,7 @@ void ivas_mcmasa_setNumTransportChannels( return; } + /*--------------------------------------------------------------------------* * ivas_mcmasa_set_separate_channel_mode() * diff --git a/lib_com/ivas_mct_com.c b/lib_com/ivas_mct_com.c index 01dd1721192e961909c59fc43a5629260e33b454..97c5f5dd8c982fda7ff0b57fc6507869fb957d94 100644 --- a/lib_com/ivas_mct_com.c +++ b/lib_com/ivas_mct_com.c @@ -66,11 +66,6 @@ void splitAvailableBitsMCT( int16_t min_chan_bits[MCT_MAX_CHANNELS], min_bits_tot, remaining_bits; int16_t core[MCT_MAX_CHANNELS]; MCT_CHAN_MODE mct_chan_mode[MCT_MAX_CHANNELS]; - int16_t num_lfe; - int16_t lfe_channel; - - num_lfe = 0; - lfe_channel = -1; min_bits_tot = 0; for ( i = 0; i < nchan; i++ ) @@ -85,19 +80,12 @@ void splitAvailableBitsMCT( mct_chan_mode[i] = ( (Decoder_State *) sts[i] )->mct_chan_mode; core[i] = ( (Decoder_State *) sts[i] )->core; } - - if ( mct_chan_mode[i] == MCT_CHAN_MODE_LFE ) - { - num_lfe++; - lfe_channel = i; - assert( lfe_channel == LFE_CHANNEL ); - } } - for ( i = 0; i < nchan; i++ ) { - if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) + if ( + mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) { min_chan_bits[i] = 0; @@ -129,7 +117,8 @@ void splitAvailableBitsMCT( bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel; } - if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) + if ( + mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) { assert( split_ratio[i] >= 1 && split_ratio[i] < BITRATE_MCT_RATIO_RANGE ); *bits_frame_channel = split_ratio[i] * remaining_bits / BITRATE_MCT_RATIO_RANGE + min_chan_bits[i]; @@ -163,7 +152,8 @@ void splitAvailableBitsMCT( bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel; } - if ( mct_chan_mode[i] != MCT_CHAN_MODE_LFE && mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) + if ( + mct_chan_mode[i] != MCT_CHAN_MODE_IGNORE ) { *bits_frame_channel -= diff * split_ratio[i] / BITRATE_MCT_RATIO_RANGE; *bits_frame_channel = max( min_chan_bits[i], *bits_frame_channel ); diff --git a/lib_com/ivas_mdft_imdft.c b/lib_com/ivas_mdft_imdft.c index e6f276575e1bc9672abd30b6be0c414e2bd9498d..a9f5bac5320fd73094f64617b505aa32253e7373 100644 --- a/lib_com/ivas_mdft_imdft.c +++ b/lib_com/ivas_mdft_imdft.c @@ -82,6 +82,11 @@ static void ivas_get_mdft_twid_factors( case IVAS_160_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_160[0]; break; +#ifdef PARAMMC_SHORT_ENC_MDFT + case IVAS_120_PT_LEN: + *ppTwid = &ivas_mdft_coeff_cos_twid_120[0]; + break; +#endif case IVAS_80_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_80[0]; break; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 847bddabccd8b85269c0271442eb9c3698881db1..0a36bd884f5d479884a922ccc04e7228749260e0 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -40,9 +40,6 @@ #include "stat_enc.h" #include "stat_dec.h" #include "stat_com.h" -#ifdef FIX_197_CREND_INTERFACE -#include "ivas_stat_rend.h" -#endif #include "ivas_stat_enc.h" #include "ivas_stat_dec.h" #include "ivas_stat_com.h" @@ -108,30 +105,12 @@ ivas_error mct_enc_reconfigure( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const uint16_t b_nchan_change /* i : flag indicating different channel count */ ); -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -ivas_error ivas_sba_enc_reinit( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -); -#endif -#endif -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -int16_t get_sba_reinit_flag( - int32_t ivas_total_bitrate, /* i : Current bitrate */ - int32_t last_ivas_total_brate /* i : Previous bitrate */ - , int16_t sba_order -); -#endif -#endif -#ifdef SBA_BR_SWITCHING ivas_error ivas_spar_md_enc_init ( ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ const int16_t sba_order /* i : Ambisonic (SBA) order */ ); -#endif ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -145,7 +124,7 @@ void destroy_cpe_enc( ); void ivas_mct_enc_close( - MCT_ENC_HANDLE hMCT /* i/o: MCT encoder structure */ + MCT_ENC_HANDLE *hMCT /* i/o: MCT encoder structure */ ); ivas_error ivas_corecoder_enc_reconfig( @@ -223,8 +202,7 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_flag, /* i : front-VAD flag to overwrite VAD decision */ const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const int16_t ivas_format /* i : IVAS format */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); ivas_error pre_proc_ivas( @@ -273,12 +251,25 @@ ivas_error ivas_compute_core_buffers( /*! r: number of clipped samples */ uint32_t ivas_syn_output( - float synth[][L_FRAME48k], /* i/o: float synthesis signal */ +#ifdef JBM_TSM_ON_TCS + float *synth[], /* i/o: float synthesis signal */ +#else + float synth[][L_FRAME48k], /* i/o: float synthesis signal */ +#endif const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ int16_t *synth_out /* o : integer 16 bits synthesis signal */ ); +#ifdef JBM_TSM_ON_TCS +void ivas_syn_output_f( + float *synth[], /* i/o: float synthesis signal */ + const int16_t output_frame, /* i : output frame length (one channel) */ + const int16_t n_channels, /* i : number of output channels */ + float *synth_out /* o : integer 16 bits synthesis signal */ + ); +#endif + void ivas_initialize_handles_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -311,7 +302,7 @@ ivas_error stereo_dmx_evs_init_encoder( ); void stereo_dmx_evs_close_encoder( - STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ + STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ ); ivas_error ivas_dec( @@ -321,6 +312,11 @@ ivas_error ivas_dec( ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + #ifdef JBM_TSM_ON_TCS + , + uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ + int16_t *data /* o : flushed PCM samples */ +#endif ); ivas_error create_sce_dec( @@ -532,7 +528,8 @@ void stereo_tcx_core_dec( const int16_t last_element_mode, /* i : last element mode */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ + const int16_t nchan_out, /* i : number of output channels */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ ); void stereo_tcx_init_dec( @@ -669,6 +666,11 @@ ivas_error ivas_mc_enc_config( ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx /* i : LS config. index */ + #ifdef JBM_TSM_ON_TCS + , + uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ + int16_t *data /* o : flushed samples (JBM) */ +#endif ); /*! r: MC format mode (MCT, McMASA, ParamMC) */ @@ -692,33 +694,6 @@ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( const AUDIO_CONFIG output_config /* i : output audio configuration */ ); -/*! r: limiter struct handle */ -IVAS_LIMITER_HANDLE ivas_limiter_open( - const int16_t num_channels, /* i : number of I/O channels */ - const int32_t sampling_rate /* i : sampling rate for processing */ -); - -void ivas_limiter_close( - IVAS_LIMITER_HANDLE* phLimiter /* i/o: pointer to limiter handle, can be NULL */ -); - -void ivas_limiter_dec -( - IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ - float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], /* i/o: input/output buffer */ - const int16_t num_channels, /* i : number of channels to be processed */ - const int16_t output_frame, /* i : number of samples per channel in the buffer */ - const int16_t BER_detect /* i : BER detect flag */ -); - -void limiter_process( - IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ - const int16_t output_frame, /* i : number of samples to be processed per channel in the I/O buffer */ - const float threshold, /* i : signal amplitude above which limiting starts to be applied */ - const int16_t BER_detect, /* i : BER detect flag */ - int16_t *strong_saturation_cnt /* i/o: counter of strong saturations (can be NULL) */ -); - void smooth_dft2td_transition( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float output[CPE_CHANNELS][L_FRAME48k], /* i/o: synthesis @external Fs */ @@ -795,16 +770,117 @@ void dtx_read_padding_bits( const int16_t num_bits ); +#ifdef JBM_TSM_ON_TCS +/*----------------------------------------------------------------------------------* + * JBM prototypes + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_jbm_dec_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *data /* o : output synthesis signal */ +); + +ivas_error ivas_jbm_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + 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 */ +); + +ivas_error ivas_jbm_dec_flush_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t tc_granularity_new, /* i : new renderer granularity */ + const RENDERER_TYPE renderer_type_old, /* i : old renderer type */ + const AUDIO_CONFIG intern_config_old, /* i : old internal config */ + const IVAS_OUTPUT_SETUP_HANDLE hIntSetupOld, /* i : old internal output setup */ + 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 : rendered samples */ +); + +ivas_error ivas_jbm_dec_feed_tc_to_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t nSamplesForRendering, /* i: : number of TC samples available for rendering */ + int16_t *nSamplesResidual, /* o: : number of samples not fitting into the renderer grid and buffer for the next call*/ + float *data /* i/o: transport channels/output synthesis signal */ +); + +ivas_error ivas_jbm_dec_set_discard_samples( + Decoder_Struct *st_ivas /* i/o: main IVAS decoder structre */ +); + +void ivas_jbm_dec_get_adapted_linear_interpolator( + const int16_t default_interp_length, /* i : default length of the (full-frame) interpolator */ + const int16_t interp_length, /* i : length of the interpolator to be created */ + float *interpolator /* o : the interpolator */ +); + +void ivas_jbm_dec_get_adapted_subframes( + const int16_t nCldfbTs, /* i : number of time slots in the current frame */ + int16_t *subframe_nbslots, /* i/o: subframe grid */ + int16_t *nb_subframes /* i/o: number of subframes in the frame */ +); + +void ivas_jbm_dec_get_md_map( + const int16_t default_len, /* i : default frame length in metadata slots */ + const int16_t len, /* i : length of the modfied frames in metadata slots */ + const int16_t subframe_len, /* i : default length of a subframe */ + const int16_t offset, /* i : current read offset into the md buffer */ + const int16_t buf_len, /* i : length of the metadata buffer */ + int16_t *map /* o : metadata index map */ +); + +int16_t ivas_jbm_dec_get_num_tc_channels( Decoder_Struct *st_ivas ); /* i : IVAS decoder handle */ + +TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( + Decoder_Struct *st_ivas /* i : IVAS decoder handle */ +); + +int16_t ivas_jbm_dec_get_render_granularity( /* o : render granularity */ + const RENDERER_TYPE rendererType, /* i : renderer type */ + const int32_t output_Fs /* i : sampling rate */ +); + +ivas_error ivas_jbm_dec_tc_buffer_open( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const TC_BUFFER_MODE tc_buffer_mode, /* i : buffer mode */ + const int16_t nchan_transport_jbm, /* i : number of real transport channels */ + const int16_t nchan_transport_internal, /* i : number of totally buffered channels */ + const int16_t nchan_full, /* i : nubmer of channels to fully store */ + const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ +); + +ivas_error ivas_jbm_dec_tc_buffer_reconfigure( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const TC_BUFFER_MODE tc_buffer_mode, /* i : new buffer mode */ + const int16_t nchan_transport_jbm, /* i : new number of real transport channels */ + const int16_t nchan_transport_internal, /* i : new number of totally buffered channels */ + const int16_t nchan_full, /* i : new number of channels to fully store */ + const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ +); + +void ivas_jbm_dec_tc_buffer_close( + DECODER_TC_BUFFER_HANDLE *phTcBuffer /* i/o: TC buffer handle */ +); +void ivas_jbm_dec_td_renderers_adapt_subframes( + Decoder_Struct *st_ivas +); +#endif /*----------------------------------------------------------------------------------* - * ISm prototypes + * ISM prototypes *----------------------------------------------------------------------------------*/ ivas_error ivas_ism_config( - const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t num_trans_ch, /* i : number of trans channels */ - const int16_t num_obj, /* i : number of objects */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ +#ifdef ISM_NON_DIEGETIC_PAN + const int16_t ism_extended_metadata_flag, /* i : extended metadata flag */ +#endif const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ const int16_t ism_imp[], /* i : ISM importance flags */ int32_t element_brate[], /* o : element bitrate per object */ @@ -825,6 +901,8 @@ int16_t ism_quant_meta( const float val, /* i : scalar value to quantize */ float *valQ, /* o : quantized value */ const float borders[], /* i : level borders */ + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ const int16_t cbsize /* i : codebook size */ ); @@ -832,22 +910,32 @@ int16_t ism_quant_meta( float ism_dequant_meta( const int16_t idx, /* i : quantizer index */ const float borders[], /* i : level borders */ + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ const int16_t cbsize /* i : codebook size */ ); -ivas_error set_ism_metadata( - ISM_METADATA_HANDLE hIsmMeta, /* i/o: ISM metadata handle */ - float azimuth, /* i : azimuth */ - float elevation /* i : elevation */ +ivas_error ivas_set_ism_metadata( + ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ + const float azimuth, /* i : azimuth value */ + const float elevation, /* i : elevation value */ + const float radius_meta, /* i : radius */ + const float yaw, /* i : yaw */ +#ifdef ISM_NON_DIEGETIC_PAN + const float pitch, /* i : pitch */ + const int16_t non_diegetic_flag /* i : non-diegetic object flag */ +#else + const float pitch /* i : pitch */ +#endif ); -ivas_error create_ism_metadata_enc( +ivas_error ivas_ism_metadata_enc_create( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t n_ISms, /* i : number of objects */ int32_t element_brate_tmp[] /* o : element bitrate per object */ ); -ivas_error create_ism_metadata_dec( +ivas_error ivas_ism_metadata_dec_create( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_ISms, /* i : number of objects */ int32_t element_brate_tmp[] /* o : element bitrate per object */ @@ -861,7 +949,8 @@ ivas_error ivas_ism_enc( ); ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_ism, /* i : number of ISM channels */ const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -869,18 +958,23 @@ ivas_error ivas_ism_metadata_enc( int16_t nb_bits_metadata[], /* o : number of metadata bits */ const int16_t localVAD[], /* i : VAD flag */ const int16_t ism_mode, /* i : ISM mode */ - const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ + const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ + const int16_t ism_extended_metadata_flag /* i : Extended metadata flag */ ); ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_ism, /* i : number of ISM channels */ int16_t *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ const int16_t bfi, /* i : bfi flag */ - int16_t nb_bits_metadata[], /* o : number of metadata bits */ + int16_t nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ - const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ + ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ + const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ + int16_t *ism_extended_metadata_flag, /* i/o: Extended metadata active in renderer */ + int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed */ ); @@ -905,10 +999,14 @@ void ivas_param_ism_enc( ); void ivas_param_ism_enc_close( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ + DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ const int32_t input_Fs /* i : input sampling_rate */ ); +void ivas_ism_metadata_close( + ISM_METADATA_HANDLE hIsmMetaData[] /* i/o : object metadata handles */ +); + void ivas_param_ism_stereo_dmx( Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ float data[MAX_NUM_OBJECTS][L_FRAME48k], /* i/o: input signal/stereo dmx */ @@ -917,6 +1015,8 @@ void ivas_param_ism_stereo_dmx( void ivas_param_ism_config( PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ + , + const int16_t nchan_ism /* i : number of ISM channels */ ); ivas_error ivas_ism_enc_config( @@ -924,8 +1024,14 @@ ivas_error ivas_ism_enc_config( ); ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t num_obj /* i : number of objects in the bitstream */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + , + const ISM_MODE last_ism_mode /* i/o: last ISM mode */ +#ifdef JBM_TSM_ON_TCS + , + uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change */ + int16_t *data /* o : flushed PCM samples */ +#endif ); ivas_error ivas_param_ism_dec_open( @@ -933,7 +1039,7 @@ ivas_error ivas_param_ism_dec_open( ); void ivas_param_ism_dec_close( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + DIRAC_DEC_HANDLE *hDirAC, /* i/o: decoder DirAC handle */ const AUDIO_CONFIG output_config /* i : output audio configuration */ ); @@ -942,10 +1048,118 @@ void ivas_param_ism_dec( float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ ); +#ifdef JBM_TSM_ON_TCS +void ivas_ism_dec_digest_tc( + Decoder_Struct *st_ivas +); + +void ivas_param_ism_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ +); + +void ivas_param_ism_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ +); +#endif + void ivas_param_ism_params_to_masa_param_mapping( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); + +/*----------------------------------------------------------------------------------* + * ISM DTX prototypes + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_ism_dtx_open( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +/*! r: indication of DTX frame */ +int16_t ivas_ism_dtx_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t nchan_ism, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t md_diff_flag[], /* o : metadata differential flag */ + int16_t *sid_flag /* o : indication of SID frame */ +); + +ivas_error ivas_ism_dtx_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t *nb_bits_metadata /* o : number of metadata bits */ +); + +void ivas_ism_metadata_sid_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + const int16_t flag_noisy_speech, /* i : noisy speech flag */ + const int16_t nchan_ism, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t sid_flag, /* i : indication of SID frame */ + const int16_t md_diff_flag[], /* i : metadata differental flag */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +); + +void ivas_ism_metadata_sid_dec( + SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t bfi, /* i : bfi flag */ + const int16_t nchan_ism, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + int16_t *flag_noisy_speech, /* o : noisy speech flag */ + int16_t *sce_id_dtx, /* o : SCE DTX ID */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +); + +void ivas_ism_get_sce_id_dtx( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t input_frame /* i : input frame length per channel */ +); + +void ivas_param_ism_compute_noisy_speech_flag( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +void ivas_ism_coh_estim_dtx_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t input_frame /* i : input frame length */ +); + +void update_last_metadata( + const int16_t nchan_ism, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t updt_flag[] /* i : last metadata update flag */ +); + +void ivas_get_ism_sid_quan_bitbudget( + const int16_t nchan_ism, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + float *q_step, /* o : quantization step */ + float *q_step_border, /* o : quantization step at the border */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +); + + /*----------------------------------------------------------------------------------* * DFT Stereo prototypes *----------------------------------------------------------------------------------*/ @@ -1069,7 +1283,8 @@ ivas_error stereo_dft_dec_create( STEREO_DFT_DEC_DATA_HANDLE *hStereoDft, /* i/o: decoder DFT stereo handle */ const int32_t element_brate, /* i : element bitrate */ const int32_t output_Fs, /* i : output sampling rate */ - const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ + const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + const int16_t nchan_transport /* i : number of transport channels */ ); void stereo_dft_dec_reset( @@ -1112,7 +1327,12 @@ void stereo_dft_dec( float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */ float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ - const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ + const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + const int16_t sba_mono_flag, /* i : signal mono output for SBA DirAC */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ + const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ + const int32_t output_Fs, /* i : Fs for delay calculation */ + const int16_t nchan_transport /* i : number of transpor channels */ ); void stereo_dft_res_ecu( @@ -1860,25 +2080,21 @@ void tdm_low_rate_dec( const float *lsf_new /* i : ISFs at the end of the frame */ ); -#ifdef LSF_RE_USE_SECONDARY_CHANNEL void tdm_SCh_LSF_intra_pred( const int32_t element_brate, /* i : element bitrate */ const float *tdm_lsfQ_PCh, /* i : primary channel LSFs */ - float *pred_lsf_secondary /* o : predicted secondary channel LSFs */ + float *pred_lsf_SCh /* o : predicted secondary channel LSFs */ ); -#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE void tdm_SCh_lsf_reuse( - const int16_t enc_dec, /* i : encoder/decoder flag */ - const int32_t element_brate, /* i : element bitrate */ + const int16_t enc_dec, /* i : encoder/decoder flag */ + const int32_t element_brate, /* i : element bitrate */ float lsf_new[M], /* i/o: LSFs at the end of the frame */ float lsp_new[M], /* i/o: LSPs at the end of the frame */ const float tdm_lsfQ_PCh[M], /* i : primary channel LSFs */ const float lsf_wgts[M], /* i : LSF weights */ - int16_t beta_index[] /* i/o: quantization index */ + int16_t *beta_index /* i/o: quantization index */ ); -#endif -#endif void first_VQstages( const float *const *cb, @@ -2128,7 +2344,6 @@ void decoder_tcx_imdct( float synthFB[], const int16_t bfi, /* i : Bad frame indicator */ const int16_t frame_cnt, /* i : frame counter in the super frame */ - const int16_t isLFE, /* i : is LFE */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ); @@ -2337,6 +2552,23 @@ void sns_shape_spectrum( const int16_t L_frame /* i : frame length */ ); +#ifdef SNS_MSVQ +int16_t quantize_sns( + float sns_in[CPE_CHANNELS][NB_DIV][M], + float snsQ_out[CPE_CHANNELS][NB_DIV][M], + Encoder_State **sts, + int16_t *indices, + int16_t *zero_side_flag, + int16_t *sns_stereo_mode +); + +void dequantize_sns( + int16_t indices[CPE_CHANNELS][NPRM_LPC_NEW], + float snsQ_out[CPE_CHANNELS][NB_DIV][M], + Decoder_State **sts +); +#endif + void sns_avq_cod( const float *sns, /* i : Input sns vectors */ const float *snsmid, /* i : Input mid-sns vectors */ @@ -2344,12 +2576,18 @@ void sns_avq_cod( float *snsmid_q, /* o : Quantized mid-LFS vectors */ int16_t *index, /* o : Quantization indices */ const int16_t core, /* i : core */ +#ifdef FIX_445_SNS_BUGFIXES + const int16_t L_frame, +#endif const int16_t low_brate_mode /* i : flag low bit operating mode */ ); void sns_avq_cod_stereo( const float *snsl, /* i : Input sns vector (left channel) */ const float *snsr, /* i : Input sns vector (right channel) */ +#ifdef FIX_445_SNS_BUGFIXES + const int16_t L_frame, +#endif float *snsl_q, /* o : Quantized sns vector (left channel) */ float *snsr_q, /* o : Quantized sns vector (right channel) */ int16_t *indexl, /* o : Quantization indices (left channel) */ @@ -2358,13 +2596,23 @@ void sns_avq_cod_stereo( void sns_avq_dec( int16_t *index, /* i : Quantization indices */ +#ifdef SNS_MSVQ + float SNS_Q[NB_DIV][M], /* o : Quantized SNS vectors */ +#else float *SNS_Q, /* o : Quantized SNS vectors */ +#endif +#ifdef FIX_445_SNS_BUGFIXES + const int16_t L_frame, +#endif const int16_t numlpc /* i : Number of sets of lpc */ ); void sns_avq_dec_stereo( int16_t *indexl, /* i : Quantization indices (left channel) */ int16_t *indexr, /* i : Quantization indices (right channe) */ +#ifdef FIX_445_SNS_BUGFIXES + const int16_t L_frame, +#endif float *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ float *SNS_Qr /* o : Quantized SNS vectors (right channe) */ ); @@ -2568,7 +2816,11 @@ float sumAbs( void mvc2c( const uint8_t x[], /* i : input vector */ uint8_t y[], /* o : output vector */ +#ifdef FIX_XXX_JBM_FIFO_BUFFER + const int32_t n +#else const int16_t n /* i : vector size */ +#endif ); /*! r: the dot product x'*A*A'*x */ @@ -2693,7 +2945,6 @@ void ivas_mdct_core_whitening_enc( int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t *LFE_off, /* o : flag if LFE has content */ const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ const int16_t nChannels /* i : total number of coded channels */ ); @@ -2711,7 +2962,6 @@ void ivas_mct_core_enc( void ivas_mdct_quant_coder( CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ - const int16_t LFE_off, /* i : flag if LFE has content */ int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ @@ -2762,7 +3012,6 @@ void ivas_mdct_dec_side_bits_frame_channel( int16_t param_lpc[MCT_MAX_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 *LFE_off, /* o : flag if LFE has content */ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ @@ -2782,7 +3031,6 @@ void ivas_mct_side_bits( void ivas_mdct_core_invQ( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ - const int16_t LFE_off, /* i : flag if LFE content */ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ @@ -2800,14 +3048,12 @@ void ivas_mdct_core_reconstruct( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *x[][NB_DIV], /* i/o: pointers to synthesis @internal_FS */ float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ - const int16_t LFE_off, /* i : flag if LFE content */ int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); void ivas_mdct_core_tns_ns( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const int16_t LFE_off, /* i : flag if LFE has content */ int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ @@ -2865,8 +3111,58 @@ void mdct_read_IGF_bits( ivas_error ivas_qmetadata_enc_encode( BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ IVAS_QMETADATA *hQMetaData /* i/o: q_metadata handle */ +#ifdef HODIRAC + , + int16_t hodirac /* i: flag to indicate sector processing */ +#endif +); + +#ifdef HR_METADATA + +ivas_error ivas_qmetadata_enc_encode_hr_384_512( + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ + int16_t bits_sph_idx, + int16_t bits_sp_coh +); +int16_t ivas_qmetadata_dec_decode_hr_384_512( + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ + uint16_t *bitstream, /* i : bitstream */ + int16_t *index, /* i/o: bitstream position */ + SPHERICAL_GRID_DATA *sph_grid16, /* i: spherical grid for deindexing */ + int16_t bits_sph_idx, + int16_t bits_sp_coh +); + +void deindex_sph_idx( + const uint16_t sphIndex, /* i : Spherical index */ + const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ + float *theta, /* o : Elevation */ + float *phi /* o : Azimuth */ +); + + +uint16_t index_theta_phi_16( + float * p_theta, /* i/o : input elevation to be indexed */ + float * p_phi, /* i/o : input azimuth to be indexed */ + SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ ); + int16_t quantize_theta( + float x, /* i : theta value to be quantized */ + int16_t no_cb, /* i : number of codewords */ + float *xhat /* o : quantized value */ +); + +/* !r: index azimuth */ + int16_t quantize_phi_masa( + float phi, /* i : azimuth value */ + int16_t flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ + float *phi_hat, /* o : quantized azimuth */ + const int16_t n /* i : azimuth codebook size */ +); +#endif + void reset_metadata_spatial( const IVAS_FORMAT ivas_format, /* i : IVAS format */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ @@ -2891,8 +3187,14 @@ int16_t ivas_qmetadata_dec_decode( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ uint16_t *bitstream, /* i : bitstream */ int16_t *index /* i/o: bitstream position */ +#ifdef HODIRAC + , + int16_t hodirac /* i: flag to indicate sector processing */ +#endif ); + + /*! r: number of bits read */ int16_t ivas_qmetadata_dec_sid_decode( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ @@ -2910,6 +3212,9 @@ void ivas_qmetadata_to_dirac( MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const SBA_MODE sba_mode, /* i : SBA mode */ +#ifdef HODIRAC + const int16_t sba_analysis_order, /* i sba order*/ +#endif int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); @@ -2967,6 +3272,10 @@ void quantize_direction_frame( IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] +#ifdef HR_METADATA + , + int16_t is_hr +#endif ); /* !r: quantized spherical index */ @@ -3105,16 +3414,22 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame, - const SBA_MODE sba_mode + const SBA_MODE sba_mode +#ifdef HODIRAC + , + const int16_t hodirac, + const int16_t nchan_fb_in +#endif ); + /*----------------------------------------------------------------------------------* * SBA format prototypes *----------------------------------------------------------------------------------*/ /*! r: SBA format mode */ SBA_MODE ivas_sba_mode_select( - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + void ); void ivas_sba_config( @@ -3128,15 +3443,22 @@ void ivas_sba_config( int16_t *element_mode /* o : element mode of the core coder */ ); -ivas_error ivas_sba_dec_reconfigure( +void ivas_sba_set_cna_cng_flag( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -ivas_error ivas_sba_dec_reinit( + +ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#endif + +#ifdef JBM_TSM_ON_TCS +ivas_error ivas_sba_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nCldfbSlots, /* i : number of CLDFB slots */ + const int16_t nSamplesForRendering, /* i : number of samples provided */ + float *data[] /* i : transport channel samples */ + ); #endif void ivas_init_dec_get_num_cldfb_instances( @@ -3151,6 +3473,7 @@ ivas_error ivas_cldfb_dec_reconfig( int16_t numCldfbAnalyses_old, /* i : number of CLDFB analysis instances in previous frame */ const int16_t numCldfbSyntheses_old /* i : number of CLDFB synthesis instances in previous frame */ ); + /*! r: Ambisonic (SBA) order */ int16_t ivas_sba_get_order( const int16_t nb_channels, /* i : Number of ambisonic channels */ @@ -3172,14 +3495,31 @@ int16_t ivas_sba_get_nchan( /*! r: number of ambisonics metadata channels */ int16_t ivas_sba_get_nchan_metadata( const int16_t sba_order /* i : Ambisonic (SBA) order */ +#ifdef SPAR_TUNING + , + const int32_t ivas_total_brate +#endif ); +#ifdef SPAR_TUNING +void ivas_sba_get_spar_hoa_ch_ind( + const int16_t num_md_chs, /* i : number of MD channels */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] ); + +/*! r: flag indicating to code SPAR HOA MD for all bands */ +void ivas_sba_get_spar_hoa_md_flag( + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + int16_t *spar_hoa_md_flag, + int16_t *spar_hoa_dirac2spar_md_flag ); +#else /*! r: flag indicating to code SPAR HOA MD for all bands */ int16_t ivas_sba_get_spar_hoa_md_flag( const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); - +#endif void ivas_sba_zero_vert_comp( float sba_data[][L_FRAME48k], /* i/o: SBA data frame */ const int16_t sba_order, /* i : Ambisonic (SBA) order */ @@ -3193,15 +3533,6 @@ void ivas_sba_getTCs( const int16_t input_frame /* i : frame length */ ); -ivas_error ivas_sba_linear_renderer( - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t nchan_in, /* i : number of input ambisonics channels */ - const AUDIO_CONFIG output_config, /* i : output audio configuration */ - const IVAS_OUTPUT_SETUP output_setup, /* i : output format setup */ - const float hoa_dec_mtx[] /* i : HOA decoding mtx */ -); - int16_t ivas_sba_remapTCs( float sba_data[][L_FRAME48k], /* i/o: SBA signals */ Decoder_Struct *st_ivas, /* i/o: decoder struct */ @@ -3211,31 +3542,38 @@ int16_t ivas_sba_remapTCs( void ivas_sba_dirac_stereo_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[CPE_CHANNELS][L_FRAME48k], /* o : output synthesis signal */ - const int16_t output_frame /* i : output frame length per channel */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t mcmasa /* i : McMASA flag */ ); void ivas_sba_dirac_stereo_config( STEREO_DFT_CONFIG_DATA_HANDLE hConfig /* o : DFT stereo configuration */ ); -void ivas_sba_dirac_stereo_smooth_parameters( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: encoder DFT stereo handle */ +int16_t ivas_get_sba_dirac_stereo_flag( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -ivas_error ivas_sba_get_hoa_dec_matrix( - const IVAS_OUTPUT_SETUP hOutSetup, /* i : target output setup */ - float **hoa_dec_mtx, /* o : ALLRAD decoder matrix */ - const int16_t ambisonics_order /* i : Ambisonics order */ +void ivas_sba_dirac_stereo_smooth_parameters( + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: encoder DFT stereo handle */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ + const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ + const int32_t output_Fs /* i : Fs for delay calculation */ ); -void ivas_sba_mtx_mult( - float output_f[][L_FRAME48k], /* i/o: synthesized core-corder transport channels/DirAC output */ - const int16_t output_frame, /* i : frame length per channel */ - const int16_t nchan_in, /* i : Number of ambisonic channels */ - const IVAS_OUTPUT_SETUP output_setup, /* i : Output configuration */ - const float *mtx_hoa_decoder /* o : HOA decoding matrix */ +void ivas_sba2mc_cldfb( + IVAS_OUTPUT_SETUP hInSetup, /* i : Format of input layout */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb real part */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part */ + const int16_t nb_channels_out, /* i : nb of output channels */ + const int16_t nb_bands, /* i : nb of CLDFB bands to process */ +#ifdef JBM_TSM_ON_TCS + const int16_t nb_timeslots, /* i : number of time slots to process */ +#endif + const float *hoa_dec_mtx /* i : HOA decoding mtx */ ); + /*----------------------------------------------------------------------------------* * DirAC prototypes *----------------------------------------------------------------------------------*/ @@ -3249,7 +3587,7 @@ ivas_error ivas_dirac_enc_reconfigure( ); void ivas_dirac_enc_close( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ + DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ const int32_t input_Fs /* i : input sampling_rate */ ); @@ -3301,7 +3639,7 @@ ivas_error ivas_dirac_dec_config( ); void ivas_dirac_dec_close( - DIRAC_DEC_HANDLE hDirAC /* i/o: decoder DirAC handle */ + DIRAC_DEC_HANDLE *hDirAC /* i/o: decoder DirAC handle */ ); void ivas_dirac_dec_read_BS( @@ -3311,85 +3649,83 @@ void ivas_dirac_dec_read_BS( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q metadata */ int16_t *nb_bits, /* o : number of bits read */ const SBA_MODE sba_mode, /* i : SBA mode */ +#ifdef HODIRAC + const int16_t sba_analysis_order, /* i sba order*/ +#endif int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); -void ivas_dirac_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t nchan_transport, /* i : number of transport channels */ - float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - const int16_t i_sf +#ifdef JBM_TSM_ON_TCS +void generate_masking_noise_lb_dirac( + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + float *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ + const int16_t nCldfbTs, /* i : number of CLDFB slots that will be rendered */ + const int16_t cna_flag /* i : CNA flag for LB and HB */ ); -#ifdef HRTF_BINARY_FILE -ivas_error ivas_dirac_dec_init_binaural_data( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ -); -#else -ivas_error ivas_dirac_dec_init_binaural_data( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif +void ivas_dirac_dec_set_md_map( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t nCldfbTs ); -void ivas_dirac_dec_close_binaural_data( - DIRAC_DEC_BIN_HANDLE *hBinaural /* i/o: decoder DirAC binaural data handle */ +void ivas_dirac_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_transport /* i : number of transport channels */ ); +#endif -#ifdef HRTF_BINARY_FILE -ivas_error ivas_dirac_dec_binaural_copy_hrtfs( - HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ +#ifdef JBM_TSM_ON_TCS +void ivas_dirac_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ ); #endif -void ivas_dirac_dec_binaural( +#ifndef JBM_TSM_ON_TCS +void ivas_dirac_dec( +#else +void ivas_dirac_dec_render_sf( +#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t nchan_transport /* i : number of transport channels */ -); - -ivas_error ivas_binaural_reverb_open( - REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ - const int16_t numBins, /* i : number of CLDFB bins */ - const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ - ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ - const AUDIO_CONFIG output_config, /* i : output audio configuration */ - const int32_t sampling_rate, /* i : sampling rate */ - const RENDERER_TYPE renderer_type /* i : renderer type */ -#ifdef HRTF_BINARY_FILE +#ifdef JBM_TSM_ON_TCS + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif + const int16_t nchan_transport, /* i : number of transport channels */ + float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], + float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] +#ifndef JBM_TSM_ON_TCS , - const HRTFS_FASTCONV_HANDLE hHrtfFastConv, /* i : FastConv HRTF handle */ - const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ + const int16_t i_sf #endif ); -void ivas_binaural_reverb_close( - REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ -); - -void ivas_binaural_reverb_setReverbTimes( - REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ - const int32_t output_Fs, /* i : sampling_rate */ - const float *revTimes, /* i : reverberation times T60 for each CLDFB bin in seconds */ - const float *revEnes /* i : spectrum for reverberated sound at each CLDFB bin */ +#ifdef FIX_417_TD_DECORR_BRATE_SW +ivas_error ivas_td_decorr_reconfig_dec( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate, /* i : total IVAS bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs, /* i : output sampling rate */ + ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */ + uint16_t *useTdDecorr /* i/o: TD decorrelator flag */ ); -void ivas_binaural_reverb_setPreDelay( - REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ - const int16_t delaySamples /* i : reverb pre-delay in CLDFB slots */ +/*! r: Configured reqularization factor value */ +float configure_reqularization_factor( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate /* i : total IVAS bitrate */ ); - -void ivas_binaural_reverb_processFrame( - REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ - const int16_t numInChannels, /* i : num input channels to be processed */ - float inReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real */ - float inImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ - float outReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ - float outImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data imag */ - const uint8_t offsetSamplesIO /* i : number of offset samples */ +#else +ivas_error ivas_dirac_dec_init_binaural_data( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ ); +#endif void computeDiffuseness_mdft( float **buffer_intensity[DIRAC_NUM_DIMS], @@ -3417,7 +3753,7 @@ void computeDiffuseness( float *diffuseness ); -void ivas_dirac_dec_onset_detection_open( +ivas_error ivas_dirac_dec_onset_detection_open( const int16_t num_channels, const int16_t num_freq_bands, const int16_t max_band_decorr, @@ -3433,7 +3769,7 @@ void ivas_dirac_dec_onset_detection_process( DIRAC_ONSET_DETECTION_STATE h_dirac_onset_detection_state ); -void ivas_dirac_dec_decorr_open( +ivas_error ivas_dirac_dec_decorr_open( DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, const int16_t num_freq_bands, @@ -3466,16 +3802,24 @@ void ivas_dirac_dec_decorr_close( ); -void ivas_dirac_dec_output_synthesis_open( +ivas_error ivas_dirac_dec_output_synthesis_open( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t nchan_transport, /* i : number of transport channels */ const int32_t output_Fs /* i : output sampling rate */ +#ifdef HODIRAC + , + const int16_t hodirac /* i : flag to indicate HO-DirAC mode*/ +#endif ); void ivas_dirac_dec_output_synthesis_init( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_out_woLFE /* i : number of output audio channels without LFE */ +#ifdef HODIRAC + , + const int16_t hodirac /* flag to indicate HO-DirAC mode */ +#endif ); void ivas_dirac_dec_output_synthesis_close( @@ -3485,26 +3829,55 @@ void ivas_dirac_dec_output_synthesis_close( void ivas_dirac_dec_output_synthesis_process_slot( const float *reference_power, /* i : Estimated power */ const float *onset, /* i : onset filter */ +#ifdef JBM_TSM_ON_TCS + const int16_t *azimuth, + const int16_t *elevation, + const float *diffuseness, +#endif DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ +#ifdef JBM_TSM_ON_TCS + const int16_t sh_rot_max_order, +#endif const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t index_slot -); + const int16_t nchan_transport /* i : number of transport channels */ +#if !defined( HODIRAC ) || defined( JBM_TSM_ON_TCS ) + , + const int16_t index_slot +#endif +#ifdef HODIRAC + , + const int16_t hodirac +#endif +); void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( 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 */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ +#ifdef JBM_TSM_ON_TCS + const int16_t nbslots, /* i : number of slots to process */ +#endif const float *onset_filter +#ifdef HODIRAC + , +#ifdef JBM_TSM_ON_TCS + const int16_t md_idx, +#endif + const int16_t hodirac /* i: flag for sector-based processing */ +#endif ); void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( - 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 */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + 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 */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ +#ifdef JBM_TSM_ON_TCS + const int16_t nbslots, /* i : number of slots to process */ + const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ +#endif float *reference_power_smooth, float qualityBasedSmFactor ); @@ -3543,11 +3916,18 @@ void ivas_dirac_dec_compute_directional_responses( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - const int16_t direction_idx, /* i : index for direction (azi and ele) */ - const int16_t subframe_idx, /* i : subframe index */ +#ifdef JBM_TSM_ON_TCS + const int16_t *azimuth, + const int16_t *elevation, + const int16_t md_idx, +#endif const float *surCohRatio, - const int16_t shd_rot_max_order, /* i : split-order rotation method */ - const float *p_Rmat /* i : rotation matrix */ + const int16_t shd_rot_max_order, /* i : split-order rotation method */ + const float *p_Rmat /* i : rotation matrix */ +#ifdef HODIRAC + , + const int16_t hodirac /* i : flag for sector based dirac processing */ +#endif ); void ivas_dirac_dec_get_frequency_axis( @@ -3555,6 +3935,58 @@ void ivas_dirac_dec_get_frequency_axis( const int32_t output_Fs, /* i : sampling frequency */ const int16_t num_freq_bands ); /* i : number of frequency bands */ +#ifdef HODIRAC +void calculate_hodirac_sector_parameters( + float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i: signal vector (L+1)^2 x N_bins, real part */ + float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i: signal vector, imaginary part*/ + const int16_t N_bins, /* i: number of bins */ + const float beta, /* i: forgetting factor for average filtering */ + const int16_t *band_grouping, /* i: indices of band groups */ + const int16_t N_bands, /* i: number of bands (groups) */ + const int16_t enc_param_start_band, /* i: first band to process */ + float *azi, /* o: array of sector azimuth angles, flat */ + float *ele, /* o: array of sector elevation angles, flat */ + float *diff, /* o: array of sector diffuseness values, flat*/ + float *ene /* o: array of sector energy values, flat*/ +); +#endif + +#ifdef MC_PARAMUPMIX_MODE +void ivas_mc_paramupmix_enc( + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ + const int16_t input_frame /* i : input frame length */ +); +ivas_error ivas_mc_paramupmix_enc_open( + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +); +void ivas_mc_paramupmix_enc_close( + MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ + const int32_t sampling_rate +); +void ivas_mc_paramupmix_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +); +int16_t ivas_mc_paramupmix_getNumTransportChannels( + void +); +ivas_error ivas_mc_paramupmix_dec_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); +void ivas_mc_paramupmix_dec_close( + MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix_out /* i/o: Parametric MC decoder handle */ +); +void ivas_mc_paramupmix_dec_read_BS( + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + Decoder_State *st, /* i/o: decoder state structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + int16_t *nb_bits /* o : number of bits written */ +); +#endif + void ivas_param_mc_metadata_open( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ const int16_t lfe_index, /* i : channel index of LFE */ @@ -3592,7 +4024,7 @@ ivas_error ivas_param_mc_enc_reconfig( ); void ivas_param_mc_enc_close( - PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ + PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle */ const int32_t input_Fs /* i : input sampling rate */ ); @@ -3622,9 +4054,29 @@ void ivas_param_mc_dec_read_BS( int16_t *nb_bits /* o : number of bits written */ ); +#ifdef JBM_TSM_ON_TCS +void ivas_param_mc_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ +); + +void ivas_param_mc_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ +); +#endif + void ivas_param_mc_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +#ifdef JBM_TSM_ON_TCS + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +#else + float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif ); void ivas_param_mc_default_icc_map( @@ -3743,7 +4195,7 @@ int16_t svd( const int16_t nChannelsC /* i : number of columns in the matrix to be decomposed */ ); -void ivas_dirac_dec_output_synthesis_cov_open( +ivas_error ivas_dirac_dec_output_synthesis_cov_open( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: handle for the covariance synthesis state */ const int16_t max_band_decorr, /* i : uppermost frequency band where decorrelation is applied */ @@ -3755,6 +4207,12 @@ void ivas_dirac_dec_output_synthesis_cov_open( const float *proto_matrix /* i : the prototype (upmix) matrix (only used if mode == 1) */ ); +#ifdef JBM_TSM_ON_TCS +void ivas_dirac_dec_output_synthesis_get_interpolator( + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ + const uint16_t interp_length ); +#endif + void ivas_dirac_dec_output_synthesis_cov_init( DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: pointer to the state of the covariance synthesis */ const int16_t nchan_in, /* i : number of input (tranport) channels */ @@ -3769,27 +4227,45 @@ void ivas_dirac_dec_output_synthesis_cov_close( ); void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( - float RealBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ - float ImagBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part */ - float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ - float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ - PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ - const int16_t nchan_in, /* i : number of input channels */ - const int16_t idx_slot /* i : index of the slot to be added to the input covariance */ -); - +#ifdef JBM_TSM_ON_TCS + float *RealBuffer, /* i : input channel filter bank samples (real part) */ + float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ +#else + float RealBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ + float ImagBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part */ +#endif + float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ + float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ + PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ + const int16_t nchan_in /* i : number of input channels */ +#ifndef JBM_TSM_ON_TCS + , + const int16_t idx_slot /* i : index of the slot to be added to the input covariance */ +#endif +); + void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( - float Cldfb_RealBuffer_in[][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ - float Cldfb_ImagBuffer_in[][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part) */ - float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ - float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : parameter band wise mixing matrices (direct part) */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : parameter band wise mixing matrices (residual part) */ - const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ - const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ - const int16_t nX, /* i : number of input channels */ - const int16_t nY, /* i : number of output channels */ - PARAM_MC_DEC_HANDLE hMetadataPMC /* i : handle to the Parametric MC decoder state */ +#ifdef JBM_TSM_ON_TCS + float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ + float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ +#else + float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (real part) */ + float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (imaginary part) */ +#endif + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ +#ifdef JBM_TSM_ON_TCS + float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ + float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ +#else + float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : parameter band wise mixing matrices (direct part) */ + float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : parameter band wise mixing matrices (residual part) */ +#endif + const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ + const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ + const int16_t nX, /* i : number of input channels */ + const int16_t nY, /* i : number of output channels */ + PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ ); int16_t computeMixingMatricesISM( @@ -3822,12 +4298,14 @@ void FdCngDecodeDiracMDCTStereoSID( ivas_error ivas_spar_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + ,const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_spar_enc_close( - SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ + SPAR_ENC_HANDLE *hSpar, /* i/o: SPAR encoder handle */ const int32_t input_Fs, /* i : input sampling rate */ - const int16_t nchan_inp /* i : number of input channels */ + const int16_t nchan_inp, /* i : number of input channels */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); ivas_error ivas_spar_enc( @@ -3839,12 +4317,14 @@ ivas_error ivas_spar_enc( ); ivas_error ivas_spar_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_spar_dec_close( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - const int32_t output_Fs /* i : output sampling rate */ + SPAR_DEC_HANDLE *hSpar, /* i/o: SPAR decoder handle */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); ivas_error ivas_spar_dec( @@ -3868,6 +4348,19 @@ void ivas_sba_upmixer_renderer( const int16_t output_frame /* i : output frame length */ ); +ivas_error ivas_sba_linear_renderer( +#ifdef JBM_TSM_ON_TCS + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t nchan_in, /* i : number of input ambisonics channels */ + const AUDIO_CONFIG output_config, /* i : output audio configuration */ + const IVAS_OUTPUT_SETUP output_setup, /* i : output format setup */ + const float hoa_dec_mtx[] /* i : HOA decoding mtx */ +); + void ivas_sba_mix_matrix_determiner( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ float output[][L_FRAME48k], /* i/o: transport/output audio channels */ @@ -3876,13 +4369,13 @@ void ivas_sba_mix_matrix_determiner( const int16_t output_frame /* i : output frame length */ ); -void ivas_sba_prototype_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ - float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ - float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ - const int16_t firstSubframe, /* i : First subframe to map */ - const int16_t nSubframes /* i : Number of subframes to map */ +#ifdef JBM_TSM_ON_TCS +void ivas_sba_prototype_renderer_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* i : Input audio in CLDFB domain, imag */ ); +#endif /* AGC */ /*! r: AGC enable flag */ @@ -3991,11 +4484,41 @@ void ivas_spar_bitrate_dist( const int16_t bwidth /* i : audio bandwidth */ ); -void ivas_mdct( const float *pIn, float *pOut, const int16_t length ); -void ivas_dct_windowing( const int16_t fade_len, const int16_t full_len, const int16_t dct_len, const int16_t zero_pad_len, const float *pWindow_coeffs, const int16_t frame_len, float *pOut_buf, float *pBuffer_prev, float *pTemp_lfe ); -void ivas_tda( const float *pIn, float *pOut, const int16_t length ); -void ivas_imdct( const float *pIn, float *pOut, const int16_t length ); -void ivas_itda( const float *re, float *pOut, const int16_t length ); +void ivas_mdct( + const float *pIn, + float *pOut, + const int16_t length +); + +void ivas_dct_windowing( + const int16_t fade_len, + const int16_t full_len, + const int16_t dct_len, + const int16_t zero_pad_len, + const float *pWindow_coeffs, + const int16_t frame_len, + float *pOut_buf, + float *pBuffer_prev, + float *pTemp_lfe +); + +void ivas_tda( + const float *pIn, + float *pOut, + const int16_t length +); + +void ivas_imdct( + const float *pIn, + float *pOut, + const int16_t length +); + +void ivas_itda( + const float *re, + float *pOut, + const int16_t length +); void ivas_spar_get_cldfb_gains( SPAR_DEC_HANDLE hSpar, @@ -4010,6 +4533,51 @@ int16_t ivas_is_res_channel( const int16_t nchan_transport /* i : number of transport channels (1-4) */ ); +#ifdef JBM_TSM_ON_TCS +void ivas_spar_dec_agc_pca( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output[][L_FRAME48k], /* i/o: input/output audio channels */ + const int16_t output_frame /* i : output frame length */ +); + +void ivas_spar_dec_set_render_map( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t nCldfbTs +); + +void ivas_spar_dec_set_render_params( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t n_cldfb_slots /* i : number of cldfb slots in this frame */ +); + +void ivas_spar_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nCldfbSlots, /* i : number of CLDFB slots */ + const int16_t nSamplesForRendering /* i : number of samples provided */ +); + +ivas_error ivas_sba_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nCldfbSlots, /* i : number of CLDFB slots */ + const int16_t nSamplesForRendering /* i : number of samples provided */ +); + +void ivas_sba_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ +); + +void ivas_spar_dec_upmixer_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float *output[], /* o : output audio channels */ + const int16_t nchan_internal /* i : number of internal channels */ +); +#endif + void ivas_spar_dec_upmixer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float output[][L_FRAME48k], /* i/o: input/output audio channels */ @@ -4037,6 +4605,8 @@ ivas_error ivas_spar_md_enc_process( const int16_t dtx_vad, const int16_t nchan_inp, const int16_t sba_order /* i : Ambisonic (SBA) order */ + , + float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i : prior mixer_matrix */ ); void ivas_compute_spar_params( @@ -4050,6 +4620,7 @@ void ivas_compute_spar_params( const int16_t num_ch, const int16_t bands_bw, const int16_t active_w, + const int16_t active_w_vlbr, ivas_spar_md_com_cfg *hSparCfg, ivas_spar_md_t *hSparMd, float *pWscale, @@ -4093,13 +4664,23 @@ void ivas_get_spar_md_from_dirac( const int16_t order, const int16_t dtx_vad, float Wscale_d[IVAS_MAX_NUM_BANDS] + , + const uint8_t useLowerRes, + const int16_t active_w_vlbr ); +#ifdef SPAR_TUNING +int16_t ivas_get_spar_dec_md_num_subframes( + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int32_t ivas_total_brate ); +#endif + ivas_error ivas_spar_md_dec_open( ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels, /* i : number of internal channels */ - const int16_t sba_order /* i : SBA order */ + const int16_t sba_order, /* i : SBA order */ + const int16_t sid_format /* i : SID format */ ); void ivas_spar_md_dec_close( @@ -4135,6 +4716,8 @@ void ivas_spar_to_dirac( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t dtx_vad, /* i : DTX frame flag */ const int16_t num_bands_out /* i : number of output bands */ + , + const int16_t bw /* i : band joining factor */ ); void ivas_spar_update_md_hist( @@ -4144,11 +4727,19 @@ void ivas_spar_update_md_hist( void ivas_spar_smooth_md_dtx( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out /* i : number of output bands */ + #ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames /* i : number of metadata subframes */ +#endif ); void ivas_spar_setup_md_smoothing( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out /* i : number of output bands */ +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames /* i : number of metadata subframes */ +#endif ); void ivas_spar_dec_gen_umx_mat( @@ -4156,6 +4747,10 @@ void ivas_spar_dec_gen_umx_mat( const int16_t nchan_transport, /* i : number of transport channels */ const int16_t num_bands_out, /* i : number of output bands */ const int16_t bfi /* i : bad frame indicator */ +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames +#endif ); /* Covariance module */ @@ -4164,6 +4759,8 @@ ivas_error ivas_spar_covar_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ + , + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_spar_covar_enc_close( @@ -4182,7 +4779,11 @@ void ivas_enc_cov_handler_process( const int16_t end_band, const int16_t nchan_inp, const int16_t dtx_vad, - const int16_t transient_det + const int16_t transient_det[2] +#ifdef SPAR_TUNING + , + const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] +#endif ); ivas_error ivas_spar_covar_smooth_enc_open( @@ -4190,6 +4791,8 @@ ivas_error ivas_spar_covar_smooth_enc_open( const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t nchan_inp /* i : number of input channels */ + , + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); void ivas_spar_covar_smooth_enc_close( @@ -4204,27 +4807,28 @@ void ivas_cov_smooth_process( const int16_t start_band, const int16_t end_band, const int16_t num_ch, - const int16_t transient_det + const int16_t transient_det[2] ); /* Transient detector module */ -ivas_error ivas_spar_transient_det_open( - ivas_trans_det_state_t **hTranDet, /* i/o: SPAR TD handle */ +ivas_error ivas_transient_det_open( + ivas_trans_det_state_t **hTranDet, /* i/o: Transient detector handle */ const int32_t sampling_rate /* i : sampling rate */ ); -void ivas_spar_transient_det_close( - ivas_trans_det_state_t **hTranDet /* i/o: SPAR TD handle */ +void ivas_transient_det_close( + ivas_trans_det_state_t **hTranDet /* i/o: Transient detector handle */ ); -int16_t ivas_transient_det_process( +void ivas_transient_det_process( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ float *pIn_pcm, /* i : input audio channels */ - const int16_t frame_len /* i : frame length in samples */ + const int16_t frame_len, /* i : frame length in samples */ + int16_t transient_det[2] /* o : transient det outputs */ ); void ivas_td_decorr_get_ducking_gains( - ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ + ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ float *pIn_pcm, float *pIn_duck_gains, float *pOut_duck_gains, @@ -4232,24 +4836,36 @@ void ivas_td_decorr_get_ducking_gains( const int16_t tdet_flag ); -ivas_error ivas_spar_td_decorr_dec_open( - ivas_td_decorr_state_t **hTdDecorr, /* i/o: SPAR Covar. decoder handle */ +ivas_error ivas_td_decorr_dec_open( + ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */ const int32_t output_Fs, /* i : output sampling rate */ const int16_t nchan_internal, /* i : number of internal channels */ const int16_t ducking_flag /* i : ducking flag */ ); -void ivas_spar_td_decorr_dec_close( - ivas_td_decorr_state_t **hTdDecorr /* i/o: SPAR Covar. decoder handle */ +void ivas_td_decorr_dec_close( + ivas_td_decorr_state_t **hTdDecorr /* i/o: TD decorrelator handle */ ); void ivas_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr, /* i/o: SPAR Covar. decoder handle */ +#ifdef JBM_TSM_ON_TCS + float *pcm_in[], /* i : input audio channels */ +#else float pcm_in[][L_FRAME48k], /* i : input audio channels */ +#endif float **ppOut_pcm, /* o : output audio channels */ const int16_t output_frame /* i : output frame length */ ); +#ifdef MC_PARAMUPMIX_MODE +void ivas_td_decorr_APD_iir_filter( + ivas_td_decorr_APD_filt_state_t *filter_state, + float *pIn_out, + const int16_t num_APD_sections, + const int16_t length +); +#endif #define IVAS_CMULT_FLOAT( in1_re, in1_im, in2_re, in2_im, out1_re, out1_im ) \ out1_re = ( in1_re * in2_re ) - ( in1_im * in2_im ); MAC(1); MULT(1); \ @@ -4412,7 +5028,6 @@ void ivas_quantise_real_values( const int16_t dim ); - void ivas_spar_get_uniform_quant_strat( ivas_spar_md_com_cfg *pSpar_md_com_cfg, const int16_t table_idx @@ -4459,7 +5074,7 @@ ivas_error ivas_masa_dec_open( ); void ivas_masa_dec_close( - MASA_DECODER_HANDLE hMasa /* i/o: MASA metadata structure */ + MASA_DECODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); ivas_error ivas_masa_decode( @@ -4477,9 +5092,7 @@ ivas_error ivas_masa_enc_open( ); void ivas_masa_enc_close( - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA metadata structure */ - const int16_t nchan_transport, /* i : Number of transport channels */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ + MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ); void ivas_masa_enc_reconfigure( @@ -4490,7 +5103,7 @@ ivas_error ivas_masa_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -void ivas_masa_encode( +ivas_error ivas_masa_encode( MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ @@ -4544,6 +5157,10 @@ void masa_compensate_two_dir_energy_ratio_index( const int16_t ratio_index_2, /* i : Input ratio for direction 2 */ int16_t *ratio_index_mod1, /* o : Output modified ratio for direction 1 */ int16_t *ratio_index_mod2 /* o : Output modified ratio for direction 2 */ +#ifdef HODIRAC + , + int16_t hodirac /* i: flag to indicate sector processing */ +#endif ); void ivas_set_qmetadata_maxbit_req( @@ -4551,6 +5168,13 @@ void ivas_set_qmetadata_maxbit_req( const IVAS_FORMAT ivas_format /* i : IVAS format */ ); +#ifdef HODIRAC +/*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */ +int16_t ivas_get_df_ratio_bits_hodirac( + int16_t index_diff /* i : Index of quantized diffuse-to-total ratio */ +); +#endif + /*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */ int16_t ivas_get_df_ratio_bits( int16_t index_diff /* i : Index of quantized diffuse-to-total ratio */ @@ -4561,6 +5185,7 @@ void masa_sample_rate_band_correction( int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ const int32_t sampling_rate /* i : sampling rate */ + , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ); void invdct4_transform( @@ -4582,6 +5207,29 @@ void ivas_masa_prerender( const int16_t output_frame /* i : output frame length per channel */ ); +#ifdef JBM_TSM_ON_TCS +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS +void ivas_spar_param_to_masa_param_mapping_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + int16_t azimuth[CLDFB_NO_CHANNELS_MAX], + int16_t elevation[CLDFB_NO_CHANNELS_MAX], + float energy_ratio1[CLDFB_NO_CHANNELS_MAX], + float spreadCoherence[CLDFB_NO_CHANNELS_MAX], + float surroundingCoherence[CLDFB_NO_CHANNELS_MAX], + float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* i : Input audio in CLDFB domain, imag */ +); +#endif +#endif + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +void ivas_spar_param_to_masa_param_mapping( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ + const int16_t subframe /* i : Subframe to map */ +); +#else void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -4589,25 +5237,11 @@ void ivas_spar_param_to_masa_param_mapping( const int16_t firstSubframe, /* i : First subframe to map */ const int16_t nSubframes /* i : Number of subframes to map */ ); - - -/*----------------------------------------------------------------------------------* - * output setup prototypes - *----------------------------------------------------------------------------------*/ - -/*! r: number of output channels */ -int16_t audioCfg2channels( - const AUDIO_CONFIG output_config /* i : output audio configuration */ -); - -void ivas_output_init( - IVAS_OUTPUT_SETUP *hOutSetup, /* o : output setup structure */ - const AUDIO_CONFIG output_config /* i : output audio configuration */ -); +#endif /*---------------------------------------------------------------------------------* - * Binaural Renderer Prototypes + * Binaural FastConv Renderer Prototypes *-----------------------------------------------------------------------------------*/ ivas_error ivas_binRenderer_open( @@ -4621,12 +5255,28 @@ void ivas_binRenderer_close( #ifdef DEBUGGING void ivas_binaural_cldfb( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef JBM_TSM_ON_TCS + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +#else float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif +); + +#ifdef JBM_TSM_ON_TCS +void ivas_binaural_cldfb_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t n_samples_to_render, + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); +#endif + #endif void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ +#ifdef JBM_TSM_ON_TCS + const int16_t numTimeSlots, /* i: : number of time slots to process */ +#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 */ @@ -4636,98 +5286,12 @@ void ivas_binRenderer( void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ +#ifdef JBM_TSM_ON_TCS + float *input_f[], /* i : transport channels */ + float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ +#else float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -); - -#ifdef HRTF_BINARY_FILE -ivas_error ivas_HRTF_fastconv_binary_open( - HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ -); - -void ivas_HRTF_fastconv_binary_close( - HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ -); - -ivas_error ivas_HRTF_parambin_binary_open( - HRTFS_PARAMBIN **hHrtfParambin /* i/o: Parametric binauralizer HRTF structure */ -); - -void ivas_HRTF_parambin_binary_close( - HRTFS_PARAMBIN **hHrtfParambin /* i/o: Parametric binauralizer HRTF structure */ -); #endif - -void QuatToRotMat( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ -); - -void Quat2Euler( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - float *yaw, /* o : yaw */ - float *pitch, /* o : pitch */ - float *roll /* o : roll */ -); - -void SHrotmatgen( - float SHrotmat[SBA_NHARM_HOA3][SBA_NHARM_HOA3], /* o : SHD rotation matrix */ - float Rmat[3][3], /* i : real-space rotation matrix */ - const int16_t order /* i : ambisonics order */ -); - -void rotateAziEle( - float azi_in, /* i : output elevation */ - float ele_in, /* i : input elevation */ - int16_t *azi, /* o : rotated azimuth */ - int16_t *ele, /* o : rotated elevation */ - float Rmat[3][3], /* i : real-space rotation matrix */ - const int16_t isPlanar /* i : is roation planar and elevation meaningless? */ -); - -void rotateAziEle_DirAC( - int16_t *azi, /* i/o: array of azimuth values */ - int16_t *ele, /* i/o: array of elevation values */ - const int16_t band1, /* i : bands to work on (lower limit) */ - const int16_t band2, /* i : bands to work on (upper bound) */ - const float *p_Rmat /* i : pointer to real-space rotation matrix */ -); - -ivas_error ivas_headTrack_open( - HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o : head track handle */ -); - -void rotateFrame_shd( - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - float output[][L_FRAME48k], /* i/o: unrotated HOA3 signal buffer in TD */ - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const int16_t subframe_idx /* i : subframe index */ -); - -void rotateFrame_sd( - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - float output[][L_FRAME48k], /* i/o: unrotated SD signal buffer in TD */ - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t subframe_idx /* i : subframe index */ -); - -void rotateFrame_shd_cldfb( - float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ - float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ - float Rmat[3][3], /* i : real-space rotation matrix */ - const int16_t nInChannels, /* i : number of channels */ - const int16_t shd_rot_max_order /* i : split-order rotation method */ -); - -void rotateFrame_sd_cldfb( - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ - float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ - const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ - const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t nb_band /* i : number of CLDFB bands to process */ ); @@ -4741,10 +5305,22 @@ ivas_error ivas_ism_renderer_open( void ivas_ism_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef JBM_TSM_ON_TCS + float *output_f[], /* i/o: core-coder transport channels/object output */ +#else float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ +#endif const int16_t output_frame /* i : output frame length per channel */ ); +#ifdef JBM_TSM_ON_TCS +void ivas_ism_render_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[], /* i/o: core-coder transport channels/object output */ + const int16_t n_samples_to_render /* i : output frame length per channel */ +); +#endif + void ivas_ism_get_stereo_gains( const float azimuth, /* i : object azimuth */ const float elevation, /* i : object elevation */ @@ -4754,33 +5330,43 @@ void ivas_ism_get_stereo_gains( void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ - float buffer_td[][L_FRAME48k], /* i/o: MC signals (on input) and the HOA3 (on output) */ +#ifdef JBM_TSM_ON_TCS + float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ + float *buffer_td[], /* o : MC signals (on input) and the HOA3 (on output) */ +#else + float buffer_td[][L_FRAME48k], /* i/o: MC signals (on input) and the HOA3 (on output) */ +#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order, /* i : SBA order */ const float gain_lfe /* i : gain for LFE, 0=ignore LFE */ ); -void ivas_sba2mc_cldfb( - IVAS_OUTPUT_SETUP hInSetup, /* i : Format of input layout */ - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb real part */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part */ - const int16_t nb_channels_out, /* i : nb of output channels */ - const int16_t nb_bands, /* i : nb of CLDFB bands to process */ - const float *hoa_dec_mtx /* i : HOA decoding mtx */ -); - void ivas_ism2sba( - float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ +#ifdef JBM_TSM_ON_TCS + float *buffer_td[], /* i/o: TD signal buffers */ +#else + float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ +#endif ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ - const int16_t num_objects, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order /* i : SBA order */ ); - +#ifdef JBM_TSM_ON_TCS +void ivas_ism2sba_sf( + float *buffer_in[], /* i : TC buffer */ + float *buffer_out[], /* o : TD signal buffers */ + ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ + const int16_t num_objects, /* i : number of objects */ + const int16_t n_samples_to_render, /* i : output frame length per channel */ + const int16_t offset, /* i : offset for the interpolatr */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ +); +#endif /*----------------------------------------------------------------------------------* - * Amplitude Panning (EFAP, VBAP) prototypes + * Amplitude Panning VBAP prototypes *----------------------------------------------------------------------------------*/ void panning_wrap_angles( @@ -4790,26 +5376,6 @@ void panning_wrap_angles( float *ele_wrapped /* o : wrapped elevation component */ ); -ivas_error efap_init_data( - EFAP_HANDLE *hEFAPdata, /* i/o: handle for EFAP data structure that will be initialized */ - const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ - const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ - const int16_t num_speaker_nodes, /* i : number of speaker nodes in the set */ - const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ -); - -void efap_free_data( - EFAP_HANDLE *hEFAPdata /* i/o: EFAP handle to be freed */ -); - -void efap_determine_gains( - EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - float *gains, /* o : gain vector for speaker nodes for given direction */ - const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ - const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ - const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ -); - ivas_error vbap_init_data( VBAP_HANDLE *hVBAPdata, /* i/o: handle for VBAP data structure that will be initialized */ const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ @@ -4846,10 +5412,19 @@ void ivas_ls_setup_conversion_close( LSSETUP_CONVERSION_HANDLE *hLsSetUpConversion /* i/o: LS converter handle */ ); + void ivas_ls_setup_conversion( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ +#ifdef MC_PARAMUPMIX_MODE + const int16_t input_chans, /* i : number of input channels to the renderer */ +#endif const int16_t output_frame, /* i : frame length */ - float output[][L_FRAME48k] /* i/o: LS input/output synthesis signal */ +#ifdef JBM_TSM_ON_TCS + float *input[], /* i : LS input/output synthesis signal */ + float *output[] /* i/o: LS input/output synthesis signal */ +#else + float output[][L_FRAME48k] /* i/o: LS input/output synthesis signal */ +#endif ); void ivas_ls_setup_conversion_process_mdct( @@ -4864,6 +5439,9 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( void ivas_lssetupconversion_process_param_mc( Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ +#ifdef JBM_TSM_ON_TCS + int16_t num_timeslots, /* i : number of time slots to process */ +#endif float Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ float Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ int16_t channel_active[MAX_CICP_CHANNELS] /* i : bitmap indicating which output channels are active */ @@ -4897,7 +5475,7 @@ ivas_error ivas_mcmasa_enc_open( ); void ivas_mcmasa_enc_close( - MCMASA_ENC_HANDLE hMcMasa, /* i/o: encoder McMASA handle */ + MCMASA_ENC_HANDLE *hMcMasa, /* i/o: encoder McMASA handle */ const int32_t input_Fs /* i : input sampling rate */ ); @@ -4983,9 +5561,12 @@ void computeReferencePower_enc( const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands, /* i : Number of frequency bands */ const SBA_MODE sba_mode /* i : SBA mode */ +#ifdef HODIRAC + , + int16_t nchan_ana /* i : no of analysis channels */ +#endif ); - ivas_error ivas_mono_dmx_renderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); @@ -5010,6 +5591,7 @@ void ivas_lfe_synth_with_filters( const int16_t lfeChannelIndex /* i : LFE channel index */ ); + /*----------------------------------------------------------------------------------* * LFE Coding prototypes *----------------------------------------------------------------------------------*/ @@ -5020,7 +5602,7 @@ ivas_error ivas_create_lfe_enc( ); void ivas_lfe_enc_close( - LFE_ENC_HANDLE hLFE /* i/o: LFE encoder handle */ + LFE_ENC_HANDLE *hLFE /* i/o: LFE encoder handle */ ); void ivas_lfe_enc( @@ -5037,7 +5619,7 @@ ivas_error ivas_create_lfe_dec( ); void ivas_lfe_dec_close( - LFE_DEC_HANDLE hLFE /* i/o: LFE encoder handle */ + LFE_DEC_HANDLE *hLFE /* i/o: LFE encoder handle */ ); void ivas_lfe_dec( @@ -5084,217 +5666,28 @@ void ivas_filter_process( * TD Binaural Object renderer *----------------------------------------------------------------------------------*/ -ivas_error ivas_HRTF_binary_open( - TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ -); - -void ivas_HRTF_binary_close( - TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ -); - -void DefaultBSplineModel( - TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* o : Loaded HR filter set */ - const int32_t output_Fs /* i : Output sampling rate */ -); - ivas_error ivas_td_binaural_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -void ivas_td_binaural_close( - BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd /* i/o: TD binaural object renderer handle */ -); - -void ObjRenderIVASFrame( +ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: SCE channels / Binaural synthesis */ +#else + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ +#endif const int16_t output_frame /* i : output frame length */ ); -void BSplineModelEvalAlloc( - ModelParams_t *model, /* i : Model parameters */ - ModelEval_t *modelEval /* i/o: Model evaluation structure */ -); - -/* ----- Object renderer - hrfilt ----- */ - -void GetFilterFromAngle( - TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ - const float Elev, /* i : Elevation, degrees */ - float Azim, /* i : Azimuth, degrees */ - float *LeftFilter, /* o : Left HR filter */ - float *RightFilter, /* o : Right HR filter */ - int16_t *itd /* o : ITD value */ -); - -void HRTF_model_precalc( - ModelParams_t *model /* i/o: HRTF Model parameters */ -); - -void BSplineModelEvalDealloc( - ModelParams_t *model, /* i : Model parameters */ - ModelEval_t *modelEval /* i : Model evaluation structure */ -); - - - -ivas_error TDREND_REND_RenderSourceHRFilt( - TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ - const float *hrf_left_delta, /* i: Left filter interpolation delta */ - const float *hrf_right_delta, /* i: Right filter interpolation delta */ - const int16_t intp_count, /* i: Interpolation count */ - float output_buf[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ - const int16_t subframe_length /* i : Subframe length in use */ -); - -/* ----- Object renderer - sources ----- */ - -ivas_error TDREND_MIX_SRC_SetPos( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const int16_t SrcInd, /* i : Source index */ - const float *Vec_p /* i : Position vector */ -); - -ivas_error TDREND_MIX_SRC_SetDir( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const int16_t SrcInd, /* i : Source index */ - const float *Vec_p /* i : Direction vector */ -); - -ivas_error TDREND_MIX_SRC_SetDirAtten( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const int16_t SrcInd, /* i : Source index */ - const TDREND_DirAtten_t *DirAtten_p /* i : Directional attenuation specifier */ -); - -ivas_error TDREND_MIX_SRC_SetPlayState( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const int16_t SrcInd, /* i : Source index */ - const TDREND_PlayStatus_t PlayStatus /* i : Play state */ -); - -void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ - TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i : Spatial aspects of source */ - float *hrf_left_prev, /* o: Left filter */ - float *hrf_right_prev, /* o: Right filter */ - float *hrf_left_delta, /* o: Left filter interpolation delta */ - float *hrf_right_delta, /* o: Right filter interpolation delta */ - int16_t *intp_count, /* o: Interpolation count */ - int16_t *filterlength, /* o: Length of filters */ - int16_t *itd, /* o: ITD value */ - float *Gain, /* o: Gain value */ - TDREND_SRC_t *Src_p, - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -); - -ivas_error TDREND_SRC_Alloc( - TDREND_SRC_t **Src_pp /* i/o: Source */ -); - -void TDREND_SRC_Dealloc( - TDREND_SRC_t *Src_p /* i/o: Source to deallocate */ -); - -void TDREND_SRC_Init( - TDREND_SRC_t *Src_p, /* i/o: Source to initialize */ - const TDREND_PosType_t PosType /* i : Position type specifier */ -); - -/* ----- Object renderer - vec ----- */ - -void TDREND_SPATIAL_VecInit( - float *Pos_p, /* o : Output vector */ - const float PosX, /* i : X value */ - const float PosY, /* i : Y value */ - const float PosZ /* i : Z value */ -); - -/*! r: Euclidian norm value */ -float TDREND_SPATIAL_VecNorm( - const float *Vec_p /* i : Vector for norm calculation */ -); - -void TDREND_SPATIAL_VecNormalize( - const float *Vec_p, /* i : Input vector */ - float *VecNorm_p /* o : Output vector */ -); - -void TDREND_SPATIAL_VecMapToNewCoordSystem( - const float *Vec_p, /* i : Input vector */ - const float *TranslVec_p, /* i : Translation vector */ - const float *DirVec_p, /* i : Direction vector */ - const float *UpVec_p, /* i : Up vector */ - const float *RightVec_p, /* i : Right vector */ - float *MappedVec_p /* o : Transformed vector */ -); - -/*! r: Flag if the orientation has been updated */ -int16_t TDREND_SPATIAL_EvalOrthonormOrient( - float *FrontVecON_p, /* o : Normalized front vector */ - float *UpVecON_p, /* o : Normalized up vector */ - float *RightVecON_p, /* o : Normalized right vector */ - const float *FrontVec_p, /* i : Input front vector */ - const float *UpVec_p /* i : Input up vector */ -); - -/* ----- Object renderer - mix ----- */ - -ivas_error TDREND_MIX_AddSrc( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - int16_t *SrcInd, /* o : Source index */ - const TDREND_PosType_t PosType /* i : Position type (absolute/relative) */ -); - -ivas_error TDREND_MIX_SetDistAttenModel( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const TDREND_DistAttenModel_t DistAttenModel /* i : Distance attenuation model */ -); - -void TDREND_MIX_LIST_SetPos( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const float *Pos_p /* i : Listener's position */ -); - -ivas_error TDREND_MIX_LIST_SetOrient( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const float *FrontVec_p, /* i : Listener's orientation front vector */ - const float *UpVec_p /* i : Listener's orientation up vector */ -); - -void TDREND_MIX_Dealloc( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd /* i/o: TD renderer handle */ -); - -ivas_error TDREND_MIX_Init( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HRTF data (initialized in case of NULL) */ - const TDREND_MixSpatSpec_t *MixSpatSpec_p, /* i : Mixer spatial specification */ - const int32_t output_Fs /* i : Output sampling rate */ -); - - /* ----- Object renderer - sfx ----- */ - -void TDREND_Apply_ITD( - float *input, /* i: Input SCE subframe to be time adjusted */ - float *out_left, /* o: Output left channels with ITD applied */ - float *out_right, /* o: Output right channels with ITD applied */ - int16_t *previtd, /*i/o: Previous ITD value */ - const int16_t itd, /* i: Current subframe ITD value */ - float *mem_itd, /*i/o: ITD buffer memory */ - const int16_t length /* i: Subframe length */ +#ifdef JBM_TSM_ON_TCS +void ObjRenderIVASSubframe( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ ); +#endif -void TDREND_firfilt( - float *signal, /* i/o: Input signal / Filtered signal */ - float *filter, /* i/o: FIR filter */ - const float *filter_delta, /* i : FIR filter delta */ - const int16_t intp_count, /* i : interpolation count */ - float *mem, /* i/o: filter memory */ - const int16_t subframe_length, /* i : Length of signal */ - const int16_t filterlength /* i : Filter length */ -); /*----------------------------------------------------------------------------------* * Filter-bank (FB) Mixer *----------------------------------------------------------------------------------*/ @@ -5307,17 +5700,23 @@ ivas_error ivas_fb_set_cfg( const int16_t num_out_chans, /* i : number of FB output channels */ const int16_t active_w_mixing, /* i : active_w_mixing flag */ const int32_t sampling_Fs /* i : sampling rate */ +#ifdef HODIRAC + , + const int16_t nachan_dirac_ana /* i: number of dirac analysis channels */ +#endif ); ivas_error ivas_FB_mixer_open( IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate */ - IVAS_FB_CFG *fb_cfg /* i : FB config. handle */ + IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_FB_mixer_close( IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ - const int32_t sampling_rate /* i : sampling rate in Hz */ + const int32_t sampling_rate, /* i : sampling rate in Hz */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); void ivas_fb_mixer_pcm_ingest( @@ -5325,6 +5724,10 @@ void ivas_fb_mixer_pcm_ingest( float pcm_in[][L_FRAME48k], /* i : input audio channels */ float **ppOut_pcm, /* o : output audio channels */ const int16_t frame_length /* i : frame length */ +#ifdef SPAR_TUNING + , + const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] +#endif ); void ivas_dirac_enc_spar_delay_synchro( @@ -5337,6 +5740,10 @@ void ivas_fb_mixer_update_prior_input( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ float *pcm_in[], /* i : input audio channels */ const int16_t length /* i : length of time slot */ +#ifdef HODIRAC + , + const int16_t nchan_fb_in +#endif ); void ivas_fb_mixer_get_windowed_fr( @@ -5346,6 +5753,10 @@ void ivas_fb_mixer_get_windowed_fr( float *frame_f_imag[], /* o : imag freq domain values */ const int16_t length, /* i : number of new samples in time slot */ const int16_t mdft_len /* i : MDFT frame length */ +#ifdef HODIRAC + , + int16_t nchan_fb_in +#endif ); void ivas_fb_mixer_process( @@ -5370,359 +5781,6 @@ int16_t ivas_get_num_bands_from_bw_idx( ); -/*----------------------------------------------------------------------------------* - * Crend renderer - *----------------------------------------------------------------------------------*/ - -#ifdef HRTF_BINARY_FILE - -ivas_error ivas_HRTF_CRend_binary_open( - HRTFS_CREND **hSetOfHRTF /* i/o: Set of HRTF handle */ -); - -void ivas_HRTF_CRend_binary_close( - HRTFS_CREND **hSetOfHRTF /* i/o: Set of HRTF handle */ -); - -#ifndef FIX_197_CREND_INTERFACE - -ivas_error ivas_crend_init_from_setofhrtf( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); - -ivas_error ivas_crend_init_from_hrtf_handle( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - HRTFS_HANDLE hrtf); -#endif - -ivas_error destroy_SetOfHRTF( - HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ -); - -#endif - -#ifndef FIX_197_CREND_INTERFACE - -ivas_error ivas_crend_init_from_rom( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); - -ivas_error ivas_crend_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); - -ivas_error ivas_crend_close( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); - -ivas_error ivas_crend_process( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output[][L_FRAME48k] /* i/o: input/output audio channels */ -); - -#else - -IVAS_REND_AudioConfigType getAudioConfigType( - const IVAS_REND_AudioConfig config ); - -ivas_error getAudioConfigNumChannels( - const IVAS_REND_AudioConfig config, - int16_t *numChannels ); - -IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( - AUDIO_CONFIG config ); - -ivas_error ivas_rend_initCrend( - CREND_WRAPPER *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, - RENDER_CONFIG_DATA *hRendCfg, -#ifdef HRTF_BINARY_FILE - HRTFS_CREND_HANDLE hSetOfHRTF, -#endif - const int32_t output_Fs ); - -ivas_error ivas_rend_openCrend( - CREND_WRAPPER_HANDLE *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, - RENDER_CONFIG_DATA *hRendCfg, - int16_t Opt_Headrotation, -#ifdef HRTF_BINARY_FILE - HRTFS_CREND_HANDLE hSetOfHRTF, -#endif - const int32_t output_Fs ); - -#ifdef FIX_197_CREND_INTERFACE -void ivas_rend_closeCrend( -#else -ivas_error ivas_rend_closeCrend( -#endif - CREND_WRAPPER_HANDLE *pCrend ); - -ivas_error ivas_rend_crendProcess( - const CREND_WRAPPER *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, - DECODER_CONFIG_HANDLE hDecoderConfig, - HEAD_TRACK_DATA_HANDLE hHeadTrackData, - IVAS_OUTPUT_SETUP_HANDLE hIntSetup, - EFAP_HANDLE hEFAPdata, - float output[][L_FRAME48k], /* i/o: input/output audio channels */ - const int32_t output_Fs ); -#endif - -/*----------------------------------------------------------------------------------* - * Renderer configuration - *----------------------------------------------------------------------------------*/ - -ivas_error ivas_render_config_open( - RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */ -); - -void ivas_render_config_close( - RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */ -); - -ivas_error ivas_render_config_init_from_rom( - RENDER_CONFIG_HANDLE *hRenderConfig, /* i/o: Renderer config handle */ - const int16_t room_flag_on /* i : room effect on/off flag */ -); - - -/*----------------------------------------------------------------------------------* - * Reverberator - *----------------------------------------------------------------------------------*/ - -ivas_error ivas_reverb_open( - REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ - const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ - const HRTFS_HANDLE hHrtf, /* i : HRTF handle */ - RENDER_CONFIG_DATA *pConfig, /* i : Reverb configuration */ - const int32_t output_Fs /* i : output sampling rate */ -); - -void ivas_reverb_close( - REVERB_HANDLE *hReverb /* i/o: Reverberator handle */ -); - -ivas_error ivas_reverb_process( - REVERB_HANDLE hReverb, /* i/o: reverb state */ - const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ - const int16_t mix_signals, /* i : add reverb to output signal */ - float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ - float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ - const int16_t i_ts -); - -void ivas_rev_delay_line_init( - ivas_rev_delay_line_t *pDelay, /* o : the delay line to initialize */ - float *memory_buffer, /* i : the memory buffer to use for the delay line */ - const uint16_t delay, /* i : the delay */ - const uint16_t maxdelay /* i : maximum delay to be supported */ -); - -/* !r: sample gotten out of delay line, and amplified by set gain */ -float ivas_rev_delay_line_get_sample( - ivas_rev_delay_line_t *pDelay /* i/o: the delay line */ -); - -void ivas_rev_delay_line_feed_sample( - ivas_rev_delay_line_t *pDelay, /* i : the delay line */ - float input /* i : the sample to feed */ -); - -void ivas_rev_delay_line_get_sample_blk( - ivas_rev_delay_line_t *pDelay, /* i : the delay line */ - const uint16_t blk_size, /* i : number of samples in the data block */ - float *output /* i/o: amples gotten out of delay line, and amplified by set gainin */ -); - -void ivas_rev_delay_line_feed_sample_blk( - ivas_rev_delay_line_t *pDelay, /* i/o: the delay line */ - const uint16_t blk_size, /* i : number of samples in the input data block */ - float *input /* i : the samples to feed */ -); - -void ivas_reverb_iir_filt_init( - ivas_rev_iir_filter_t *iirFilter, /* o : IIR filter */ - const uint16_t maxTaps /* i : maximum number of filter taps */ -); - -void ivas_reverb_iir_filt_set( - ivas_rev_iir_filter_t *iirFilter, /* i/o: IIR filter */ - uint16_t nr_taps, /* i : number of IIR filter taps */ - const float *coefA, /* i : A filter coefficients to set */ - const float *coefB /* i : the B filter coefficients to set */ -); - -void ivas_reverb_iir_filt_2taps_feed_blk( - ivas_rev_iir_filter_t *iirFilter, /* i/o: IIR filter */ - const uint16_t blk_size, /* i : size */ - const float *input, /* i : input buffer */ - float *output /* i : output buffer */ -); - -uint16_t int_log2( - uint32_t powerOf2 -); - -int16_t ivas_reverb_t2f_f2t_init( - ivas_reverb_t2f_f2t_t *t2f_f2t, - const int16_t fft_size, - const int16_t block_size -); - -void ivas_reverb_t2f_f2t_ClearHistory( - ivas_reverb_t2f_f2t_t *t2f_f2t -); - -void ivas_reverb_t2f_f2t_in( - ivas_reverb_t2f_f2t_t *t2f_f2t, - float *input_L, - float *input_R, float *buffer_L, - float *buffer_R -); - -void ivas_reverb_t2f_f2t_out( - ivas_reverb_t2f_f2t_t *t2f_f2t, - float *buffer_L, - float *buffer_R, - float *output_L, - float *output_R -); - -int16_t ivas_reverb_fft_filter_init( - ivas_reverb_fft_filter_t *fft_filter, - const int16_t fft_size -); - -void ivas_reverb_fft_filter_ComplexMul( - ivas_reverb_fft_filter_t *fft_filter, - float *buffer -); - -void ivas_reverb_fft_filter_CrossMix( - float *buffer0, - float *buffer1, - const int16_t fft_size -); - -void ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( - rv_fftwf_type_complex *spectrum, - float *fft_real, - const int16_t fft_size -); - -void ivas_reverb_define_window_fft( - float *pWindow, - const int16_t transitionStart, - const int16_t transitionLength, - const int16_t spectrumLength -); - -int16_t ivas_reverb_calc_color_filters( - const float *pTargetL, - const float *pTargetR, - const float *pWindow, - const int16_t fft_size, - const float delay, - rv_fftwf_type_complex *pBeqL, - rv_fftwf_type_complex *pBeqR -); - -int16_t ivas_reverb_calc_correl_filters( - const float *pTargetICC, - const float *pWindow, - const int16_t fft_size, - const float delay, - rv_fftwf_type_complex *pU, - rv_fftwf_type_complex *pV -); - -void ivas_reverb_calc_color_levels( - const int32_t output_Fs, - const int16_t freq_count, - const int16_t loop_count, - const float *pFc, - const float *pAcoustic_dsr, - const float *pHrtf_avg_pwr_L, - const float *pHrtf_avg_pwr_R, - const int16_t *pLoop_delays, - const float *pT60_filter_coeff, - float *pTarget_color_L, - float *pTarget_color_R -); - -void ivas_reverb_prepare_cldfb_params( - ivas_roomAcoustics_t *pInput_params, -#ifdef HRTF_BINARY_FILE - const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif - const AUDIO_CONFIG input_audio_config, - const int16_t use_brir, - const int32_t output_Fs, - float *pOutput_t60, - float *pOutput_ene ); - -void ivas_reverb_interpolate_acoustic_data( - const int16_t input_table_size, - const float *pInput_fc, - const float *pInput_t60, - const float *pInput_dsrR, - const int16_t output_table_size, - const float *pOutput_fc, - float *pOutput_t60, - float *pOutput_dsr -); - -void ivas_reverb_get_hrtf_set_properties( - float **ppHrtf_set_L_re, - float **ppHrtf_set_L_im, - float **ppHrtf_set_R_re, - float **ppHrtf_set_R_im, - const AUDIO_CONFIG input_audio_config, - const int16_t hrtf_count, - const int16_t in_freq_count, - const int16_t out_freq_count, - float *pOut_avg_pwr_L, - float *pOut_avg_pwr_R, - float *pOut_i_a_coherence -); - - -/*----------------------------------------------------------------------------------* - * Orientation tracking - *----------------------------------------------------------------------------------*/ - -void ivas_orient_trk_Init( - ivas_orient_trk_state_t *pOTR -); - -ivas_error ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, - OTR_TRACKING_T trackingType -); - -ivas_error ivas_orient_trk_SetAbsoluteOrientation( - ivas_orient_trk_state_t *pOTR, - float yaw, - float pitch, - float roll -); - -ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR -); - -ivas_error ivas_orient_trk_GetTrackedOrientation( - ivas_orient_trk_state_t *pOTR, - float *yaw, - float *pitch, - float *roll -); - - /* clang-format on */ #endif /* IVAS_PROT_H */ diff --git a/lib_com/ivas_qmetadata_com.c b/lib_com/ivas_qmetadata_com.c index 4f1fe47a1ea9e78eb92fbe5ed017e2088652237f..4bd135ec981ad288f319f6543c1718bfa54d5c16 100644 --- a/lib_com/ivas_qmetadata_com.c +++ b/lib_com/ivas_qmetadata_com.c @@ -98,9 +98,8 @@ ivas_error ivas_qmetadata_allocate_memory( const int16_t coherence_flag /* i : new coherence coding status */ ) { - int16_t dir; + int16_t j, dir; uint8_t do_realloc; - uint8_t reservationFailed = 0; #ifdef DEBUGGING assert( hQMetaData != NULL ); @@ -126,68 +125,63 @@ ivas_error ivas_qmetadata_allocate_memory( hQMetaData->no_directions = ndirs; hQMetaData->coherence_flag = coherence_flag; - hQMetaData->q_direction = (IVAS_QDIRECTION *) malloc( sizeof( IVAS_QDIRECTION ) * ndirs ); - reservationFailed = hQMetaData->q_direction == NULL; + if ( ( hQMetaData->q_direction = (IVAS_QDIRECTION *) malloc( sizeof( IVAS_QDIRECTION ) * ndirs ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" ); + } - if ( !reservationFailed ) + + for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) { - for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) + hQMetaData->q_direction[dir].cfg.nbands = nbands; + if ( nbands == 0 ) { - hQMetaData->q_direction[dir].cfg.nbands = nbands; - if ( nbands == 0 ) - { - hQMetaData->q_direction[dir].band_data = NULL; - } - else + hQMetaData->q_direction[dir].band_data = NULL; + } + else + { + if ( ( hQMetaData->q_direction[dir].band_data = (IVAS_QDIRECTION_BAND_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_DATA ) * hQMetaData->q_direction[dir].cfg.nbands ) ) == NULL ) { - hQMetaData->q_direction[dir].band_data = (IVAS_QDIRECTION_BAND_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_DATA ) * hQMetaData->q_direction[dir].cfg.nbands ); - { - int16_t j; - for ( j = 0; j < nbands; j++ ) - { - set_zero( hQMetaData->q_direction[dir].band_data[j].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[dir].band_data[j].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - - - reservationFailed |= hQMetaData->q_direction[dir].band_data == NULL; + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" ); } - if ( coherence_flag ) - { - hQMetaData->q_direction[dir].coherence_band_data = (IVAS_QDIRECTION_BAND_COHERENCE_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_COHERENCE_DATA ) * hQMetaData->q_direction[dir].cfg.nbands ); - reservationFailed |= hQMetaData->q_direction[dir].coherence_band_data == NULL; - } - else + for ( j = 0; j < nbands; j++ ) { - hQMetaData->q_direction[dir].coherence_band_data = NULL; + set_zero( hQMetaData->q_direction[dir].band_data[j].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); + set_zero( hQMetaData->q_direction[dir].band_data[j].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); } - - /* These default values are set here to get them conveniently in one place */ - hQMetaData->q_direction[dir].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; - hQMetaData->q_direction[dir].cfg.search_effort = 3; - hQMetaData->q_direction[dir].cfg.start_band = 0; - hQMetaData->q_direction[dir].cfg.mc_ls_setup = MC_LS_SETUP_INVALID; } if ( coherence_flag ) { - hQMetaData->surcoh_band_data = (IVAS_SURROUND_COHERENCE_BAND_DATA *) malloc( sizeof( IVAS_SURROUND_COHERENCE_BAND_DATA ) * hQMetaData->q_direction[0].cfg.nbands ); - reservationFailed |= hQMetaData->surcoh_band_data == NULL; + hQMetaData->q_direction[dir].coherence_band_data = (IVAS_QDIRECTION_BAND_COHERENCE_DATA *) malloc( sizeof( IVAS_QDIRECTION_BAND_COHERENCE_DATA ) * hQMetaData->q_direction[dir].cfg.nbands ); } else { - hQMetaData->surcoh_band_data = NULL; + hQMetaData->q_direction[dir].coherence_band_data = NULL; } + + /* These default values are set here to get them conveniently in one place */ + hQMetaData->q_direction[dir].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; + hQMetaData->q_direction[dir].cfg.search_effort = 3; + hQMetaData->q_direction[dir].cfg.start_band = 0; + hQMetaData->q_direction[dir].cfg.mc_ls_setup = MC_LS_SETUP_INVALID; } - } - if ( reservationFailed ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Q MetaData\n" ) ); + if ( coherence_flag ) + { + if ( ( hQMetaData->surcoh_band_data = (IVAS_SURROUND_COHERENCE_BAND_DATA *) malloc( sizeof( IVAS_SURROUND_COHERENCE_BAND_DATA ) * hQMetaData->q_direction[0].cfg.nbands ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Q MetaData" ); + } + } + else + { + hQMetaData->surcoh_band_data = NULL; + } } + return IVAS_ERR_OK; } @@ -514,24 +508,41 @@ void masa_compensate_two_dir_energy_ratio_index( const int16_t ratio_index_2, /* i : Input ratio for direction 2 */ int16_t *ratio_index_mod1, /* o : Output modified ratio for direction 1 */ int16_t *ratio_index_mod2 /* o : Output modified ratio for direction 2 */ +#ifdef HODIRAC + , + int16_t hodirac /* i: flag to indicate sector processing */ +#endif ) { - float ratio1, ratio2, ratioSum; + float ratio1, ratio2; +#ifndef HODIRAC + float ratioSum; +#endif ratio1 = 1.0f - diffuseness_reconstructions[ratio_index_1]; ratio2 = 1.0f - diffuseness_reconstructions[ratio_index_2]; - ratioSum = ratio1 + ratio2; - if ( ratio1 >= ratio2 ) - { - ratio2 = ratio2 / ratio1 * ratioSum; - ratio1 = ratioSum; - } - else +#ifdef HODIRAC + if ( !hodirac ) +#endif { - ratio1 = ratio1 / ratio2 * ratioSum; - ratio2 = ratioSum; +#ifdef HODIRAC + float ratioSum; +#endif + + ratioSum = ratio1 + ratio2; + if ( ratio1 >= ratio2 ) + { + ratio2 = ratio2 / ratio1 * ratioSum; + ratio1 = ratioSum; + } + else + { + ratio1 = ratio1 / ratio2 * ratioSum; + ratio2 = ratioSum; + } } + *ratio_index_mod1 = masa_sq( 1.0f - ratio1, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); *ratio_index_mod2 = masa_sq( 1.0f - ratio2, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); @@ -615,6 +626,30 @@ void ivas_qmetadata_direction_vector_to_azimuth_elevation( return; } +#ifdef HODIRAC +/*! r: bits to be used for quantizing ratio of ratios */ +int16_t ivas_get_df_ratio_bits_hodirac( + int16_t index_diff /* i : index of quantized diffuse-to-total ratio */ +) +{ + int16_t dfRatio_bits; + + if ( index_diff >= DIFF_DFRATIO_1BIT_LIMIT_IDX ) + { + dfRatio_bits = 1; + } + else if ( index_diff >= DIFF_DFRATIO_2BIT_LIMIT_IDX_HODIRAC ) + { + dfRatio_bits = 2; + } + else + { + dfRatio_bits = 3; + } + + return dfRatio_bits; +} +#endif /*--------------------------------------------------------------- * ivas_get_df_ratio_bits() diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index f04538c4790ca72f0a52ecd09c9cf9ecf9c4269e..7ed0ec4a827c377d327ecab4b4edad4de6a620d3 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -628,7 +628,6 @@ const float tdm_den_ratio_tabl[TDM_NQ+1] = /* 1.0f/(2*LR_ratio*LR_ratio-2*LR_ra 1.2088f, 1.1429f, 1.0902f, 1.0501f, 1.0221f, 1.0000f, 1.0000f, 1.0000f }; -#ifdef LSF_RE_USE_SECONDARY_CHANNEL const int16_t tdm_bit_allc_tbl[5][6] = { /* IC -- UC -- GC -- TM --AC */ @@ -638,21 +637,8 @@ const int16_t tdm_bit_allc_tbl[5][6] = { 1650, 6050, 0, 10000, 0, 10000 }, /* IVAS_32k */ { 1650, 6050, 0, 13000, 0, 14000 } /* IVAS_48k */ }; -#else -const int16_t tdm_bit_allc_tbl[5][6] = -{ - /* IC -- UC -- GC -- TM --AC */ - { 1600, 3450, 0, 4400, 0, 5000 }, /* IVAS_13k2 */ - { 1600, 3450, 0, 5000, 0, 5000 }, /* IVAS_16k4 */ - { 1600, 3450, 0, 6000, 0, 5000 }, /* IVAS_24k4 */ - { 1600, 6000, 0, 10000, 0, 10000 }, /* IVAS_32k */ - { 1600, 6000, 0, 13000, 0, 14000 } /* IVAS_48k */ -}; -#endif -#ifdef LSF_RE_USE_SECONDARY_CHANNEL /* LSFs Intra-frame prediction tables */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE const float tdm_LSF_MEAN_RE_USE_OUT[M] = { 301.292f, 521.300f, 870.818f, 1340.278f, 1712.099f, 2091.456f, 2488.523f, 2841.096f, 3196.565f, 3593.040f, 3958.366f, 4293.334f, 4710.319f, 5118.806f, 5546.761f, 5918.579f, @@ -669,10 +655,10 @@ const float tdm_LSF_MEAN_RE_USE[M] = 3299.107307F, 3686.249102F, 4034.473656F, 4393.818819F, 4781.683038F, 5155.954294F, 5542.569582F, 5927.377309F }; -const float tdm_Beta_Q1bit_re_use_132[2] = { 0.97F, 0.75F }; -const float tdm_Beta_Q1bit_re_use_164[2] = { 0.95F, 0.71F }; -const float tdm_Beta_Q1bit_re_use_244_320[2] = { 0.93F, 0.73F }; -const float tdm_Beta_Q1bit_re_use_480[2] = { 0.97F, 0.77F }; +const float tdm_Beta_Q1bit_re_use_13k2[2] = { 0.97F, 0.75F }; +const float tdm_Beta_Q1bit_re_use_16k4[2] = { 0.95F, 0.71F }; +const float tdm_Beta_Q1bit_re_use_24k4_32k[2] = { 0.93F, 0.73F }; +const float tdm_Beta_Q1bit_re_use_48k[2] = { 0.97F, 0.77F }; const float tdm_RE_USE_adaptive_beta_prd_diag_3[15 + 16 + 15] = { @@ -693,7 +679,6 @@ const float tdm_RE_USE_adaptive_beta_prd_diag_3[15 + 16 + 15] = 0.2043f, 0.6317f, 0.0543f, 0.1767f, 0.5396f, }; -#endif const float tdm_LSF_MEAN_PRED_QNT[M] = { @@ -729,7 +714,6 @@ const float tdm_PRED_QNT_fixed_beta_prd_diag_3[15 + 16 + 15] = 0.1709f, 0.6372f, 0.1060f, 0.1193f, 0.6574f, }; -#endif const int16_t fast_FCB_bits_2sfr[] = {8, 14, 18, 20, 24, 128/*stop value*/}; @@ -893,7 +877,9 @@ const int16_t DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1] = 0, 1, 2, 3, 4 }; - +#ifdef HODIRAC +const float c_weights[DIRAC_NO_FB_BANDS_MAX] = { 9.962447e-02f, 9.627997e-01f, 9.926667e-01f, 9.981028e-01f, 9.996648e-01f, 1.000000e+00f, 9.997692e-01f, 9.992002e-01f, 9.983890e-01f, 9.973818e-01f, 9.962037e-01f, 9.948692e-01f, 9.933876e-01f, 9.917654e-01f, 9.900073e-01f, 9.881169e-01f, 9.860975e-01f, 9.839516e-01f, 9.816818e-01f, 9.792906e-01f, 9.767801e-01f, 9.741527e-01f, 9.714106e-01f, 9.685560e-01f, 9.655913e-01f, 9.625187e-01f, 9.593406e-01f, 9.560594e-01f, 9.526774e-01f, 9.491970e-01f, 9.456208e-01f, 9.419512e-01f, 9.381908e-01f, 9.343420e-01f, 9.304075e-01f, 9.263898e-01f, 9.222915e-01f, 9.181152e-01f, 9.138636e-01f, 9.095392e-01f, 9.051447e-01f, 9.006827e-01f, 8.961559e-01f, 8.915668e-01f, 8.869181e-01f, 8.822123e-01f, 8.774521e-01f, 8.726400e-01f, 8.677785e-01f, 8.628702e-01f, 8.579176e-01f, 8.529231e-01f, 8.478893e-01f, 8.428184e-01f, 8.377130e-01f, 8.325753e-01f, 8.274077e-01f, 8.222124e-01f, 8.169917e-01f, 8.117478e-01f, 8.064829e-01f, 8.011990e-01f, 7.958982e-01f, 7.905827e-01f, 7.852543e-01f, 7.799150e-01f, 7.745667e-01f, 7.692112e-01f, 7.638505e-01f, 7.584861e-01f, 7.531199e-01f, 7.477535e-01f, 7.423885e-01f, 7.370265e-01f, 7.316691e-01f, 7.263176e-01f, 7.209736e-01f, 7.156384e-01f, 7.103134e-01f, 7.049999e-01f, 6.996990e-01f, 6.944121e-01f, 6.891403e-01f, 6.838847e-01f, 6.786464e-01f, 6.734265e-01f, 6.682258e-01f, 6.630455e-01f, 6.578863e-01f, 6.527492e-01f, 6.476350e-01f, 6.425445e-01f, 6.374784e-01f, 6.324376e-01f, 6.274226e-01f, 6.224341e-01f, 6.174729e-01f, 6.125393e-01f, 6.076341e-01f, 6.027577e-01f, 5.979106e-01f, 5.930932e-01f, 5.883061e-01f, 5.835497e-01f, 5.788242e-01f, 5.741301e-01f, 5.694676e-01f, 5.648372e-01f, 5.602390e-01f, 5.556734e-01f, 5.511404e-01f, 5.466405e-01f, 5.421737e-01f, 5.377402e-01f, 5.333402e-01f, 5.289738e-01f, 5.246411e-01f, 5.203422e-01f, 5.160771e-01f, 5.118460e-01f, 5.076489e-01f, 5.034858e-01f, 4.993567e-01f, 4.952616e-01f, 4.912005e-01f, 4.871734e-01f, 4.831802e-01f, 4.792209e-01f, 4.752955e-01f, 4.714037e-01f, 4.675457e-01f, 4.637212e-01f, 4.599302e-01f, 4.561725e-01f, 4.524481e-01f, 4.487567e-01f, 4.450983e-01f, 4.414728e-01f, 4.378799e-01f, 4.343195e-01f, 4.307915e-01f, 4.272956e-01f, 4.238318e-01f, 4.203997e-01f, 4.169993e-01f, 4.136303e-01f, 4.102926e-01f, 4.069859e-01f, 4.037101e-01f, 4.004649e-01f, 3.972501e-01f, 3.940655e-01f, 3.909109e-01f, 3.877861e-01f, 3.846909e-01f, 3.816250e-01f, 3.785882e-01f, 3.755803e-01f, 3.726010e-01f, 3.696501e-01f, 3.667275e-01f, 3.638328e-01f, 3.609658e-01f, 3.581263e-01f, 3.553141e-01f, 3.525289e-01f, 3.497705e-01f, 3.470387e-01f, 3.443331e-01f, 3.416537e-01f, 3.390001e-01f, 3.363720e-01f, 3.337694e-01f, 3.311919e-01f, 3.286393e-01f, 3.261114e-01f, 3.236079e-01f, 3.211286e-01f, 3.186733e-01f, 3.162418e-01f, 3.138337e-01f, 3.114490e-01f, 3.090872e-01f, 3.067484e-01f, 3.044321e-01f, 3.021382e-01f, 2.998664e-01f, 2.976166e-01f, 2.953885e-01f, 2.931819e-01f, 2.909966e-01f, 2.888323e-01f, 2.866889e-01f, 2.845661e-01f, 2.824637e-01f, 2.803816e-01f, 2.783194e-01f, 2.762770e-01f, 2.742543e-01f, 2.722509e-01f, 2.702667e-01f, 2.683014e-01f, 2.663550e-01f, 2.644271e-01f, 2.625177e-01f, 2.606264e-01f, 2.587531e-01f, 2.568977e-01f, 2.550599e-01f, 2.532395e-01f, 2.514364e-01f, 2.496503e-01f, 2.478811e-01f, 2.461287e-01f, 2.443928e-01f, 2.426732e-01f, 2.409698e-01f, 2.392824e-01f, 2.376109e-01f, 2.359550e-01f, 2.343146e-01f, 2.326895e-01f, 2.310797e-01f, 2.294848e-01f, 2.279047e-01f, 2.263394e-01f, 2.247886e-01f, 2.232521e-01f, 2.217299e-01f, 2.202217e-01f, 2.187274e-01f, 2.172469e-01f, 2.157800e-01f, 2.143266e-01f, 2.128865e-01f, 2.114596e-01f, 2.100457e-01f, 2.086447e-01f, 2.072564e-01f, 2.058808e-01f }; +#endif /*----------------------------------------------------------------------* * SPAR ROM tables @@ -903,6 +889,14 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] = { /* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */ + /* preferred tuning (3.2/4.9kbps) with/out TDD */ + { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, + { { 10000, 8300, 13150 } }, + { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, + + { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, + { { 13200, 11500, 16350 } }, + { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, { 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0,{ { 16400, 14850, 24350 } }, { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, @@ -950,11 +944,19 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] = { 512000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } }, // not yet optimized { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, +#ifdef SPAR_TUNING + { 512000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 124000, 124000, 128000 },{ 124000, 124000, 128000 },{ 125200, 118450, 128000 },{ 76300, 73000, 128000 } }, // not yet optimized + { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, + + { 512000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 118000, 118000, 128000 },{ 118000, 118000, 128000 },{ 117200, 109250, 128000 },{ 72300, 69000, 128000 } }, // not yet optimized + { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, +#else { 512000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 97700, 93300, 128000 } }, // not yet optimized { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, { 512000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 127200, 122550, 128000 },{ 76300, 73550, 128000 } }, // not yet optimized { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 }, +#endif }; const ivas_freq_models_t ivas_arith_pred_r_consts[TOTAL_PRED_QUANT_STRATS_ARITH] = @@ -1471,11 +1473,31 @@ const int16_t dtx_pr_real_q_levels[3][3] = { { 9,9,9 },{ 9,7,9 },{ 9,5,7 } }; const int16_t pr_pr_idx_pairs[3][3][2] = { { { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 1, 3 },{ 0, 0 } } }; const int16_t pr_pd_idx_pairs[3][3][2] = { { { 1, 1 },{ 2, 2 },{ 3, 3 } },{ { 1, 1 },{ 3, 2 },{ 2, 0 } },{ { 2, 1 },{ 0, 0 },{ 0, 0 } } }; +#ifdef HODIRAC +const int16_t remix_order_set[1][DIRAC_MAX_ANA_CHANS] = { /* WYZX --> WYXZ... */ + { 0, 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 } +}; +#else const int16_t remix_order_set[1][IVAS_SPAR_MAX_CH] = { /* WYZX --> WYXZ... */ { 0, 1, 3, 2, 4, 5, 6, 7} }; +#endif +#ifdef SPAR_TUNING +const int16_t keep_planar[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS] = { 1, 1, 1, 1, 1, 1 }; +#else const int16_t keep_planar[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS] = { 1, 1, 1, 1 }; +#endif +#ifdef HODIRAC +const int16_t HOA_keep_ind[IVAS_SPAR_MAX_FB_IN_CHAN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15}; +#ifdef SPAR_TUNING +const int16_t HOA_keep_ind_spar[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 8, 9, 10, 10, 10, 10}; +const int16_t HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; +#else +const int16_t HOA_keep_ind_spar[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 8, 9, 10}; +#endif +#else const int16_t HOA_keep_ind[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 8, 9, 15}; +#endif /*----------------------------------------------------------------------* @@ -2531,7 +2553,48 @@ const uint16_t ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_ /*----------------------------------------------------------------------------------* * MASA ROM tables *----------------------------------------------------------------------------------*/ - +#ifdef HR_METADATA + +const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS] = +{ + 0.00f, + 0.0142822265625f, + 0.030029296875f, + 0.052001953125f, + 0.07708740234375f, + 0.10528564453125f, + 0.14483642578125f, + 0.19573974609375f, + 0.26568603515625f, + 0.35467529296875f, + 0.436279296875f, + 0.510498046875f, + 0.5943603515625f, + 0.6878662109375f, + 0.80096435546875f, + 0.93365478515625f +}; +const float diffuseness_thresholds_hr[HR_MASA_ER_LEVELS + 1] = +{ + 0.0f, + 0.009521484375f, + 0.01904296875f, + 0.0410156250f, + 0.06298828125f, + 0.0911865234375f, + 0.119384765625f, + 0.1702880859375f, + 0.22119140625f, + 0.3101806640625f, + 0.399169921875f, + 0.473388671875f, + 0.547607421875f, + 0.641113281250f, + 0.734619140625f, + 0.8673095703125f, + 2.0f /* out-of-range large value to make searching easier */ +}; +#endif const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS] = { 11, @@ -2544,6 +2607,7 @@ const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS] = 3 }; + const float coherence_cb0_masa[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH] = { /* this is the same */ @@ -2726,7 +2790,11 @@ const uint8_t masa_joined_nbands[IVAS_NUM_ACTIVE_BRATES] = const uint8_t masa_twodir_bands[IVAS_NUM_ACTIVE_BRATES] = { +#ifdef HR_METADATA + 0, 0, 0, 0, 0, 1, 1, 1, 3, 4, 6, 6, 9, 24 +#else 0, 0, 0, 0, 0, 1, 1, 1, 3, 4, 6, 6, 9, 12 +#endif }; const uint8_t masa_twodir_bands_joined[IVAS_NUM_ACTIVE_BRATES] = @@ -3980,6 +4048,30 @@ const float ivas_cos_twiddle_160[IVAS_160_PT_LEN >> 1] = 0.0760120586092433f, 0.0564205163668375f, 0.0368072229413588f, 0.0171797396307788f }; +#ifdef PARAMMC_SHORT_ENC_MDFT +const float ivas_mdft_coeff_cos_twid_120[IVAS_120_PT_LEN + 1] = +{ + 1.0000000000f, 0.9999143276f, 0.9996573250f, 0.9992290362f, 0.9986295348f, 0.9978589232f, 0.9969173337f, + 0.9958049276f, 0.9945218954f, 0.9930684570f, 0.9914448614f, 0.9896513868f, 0.9876883406f, 0.9855560591f, + 0.9832549076f, 0.9807852804f, 0.9781476007f, 0.9753423205f, 0.9723699204f, 0.9692309097f, 0.9659258263f, + 0.9624552365f, 0.9588197349f, 0.9550199445f, 0.9510565163f, 0.9469301295f, 0.9426414911f, 0.9381913359f, + 0.9335804265f, 0.9288095529f, 0.9238795325f, 0.9187912101f, 0.9135454576f, 0.9081431738f, 0.9025852843f, + 0.8968727415f, 0.8910065242f, 0.8849876375f, 0.8788171127f, 0.8724960071f, 0.8660254038f, 0.8594064115f, + 0.8526401644f, 0.8457278217f, 0.8386705679f, 0.8314696123f, 0.8241261886f, 0.8166415552f, 0.8090169944f, + 0.8012538127f, 0.7933533403f, 0.7853169309f, 0.7771459615f, 0.7688418321f, 0.7604059656f, 0.7518398075f, + 0.7431448255f, 0.7343225094f, 0.7253743710f, 0.7163019434f, 0.7071067812f, 0.6977904598f, 0.6883545757f, + 0.6788007455f, 0.6691306064f, 0.6593458151f, 0.6494480483f, 0.6394390020f, 0.6293203910f, 0.6190939493f, + 0.6087614290f, 0.5983246006f, 0.5877852523f, 0.5771451900f, 0.5664062369f, 0.5555702330f, 0.5446390350f, + 0.5336145159f, 0.5224985647f, 0.5112930861f, 0.5000000000f, 0.4886212415f, 0.4771587603f, 0.4656145203f, + 0.4539904997f, 0.4422886902f, 0.4305110968f, 0.4186597375f, 0.4067366431f, 0.3947438564f, 0.3826834324f, + 0.3705574375f, 0.3583679495f, 0.3461170571f, 0.3338068592f, 0.3214394653f, 0.3090169944f, 0.2965415750f, + 0.2840153447f, 0.2714404499f, 0.2588190451f, 0.2461532930f, 0.2334453639f, 0.2206974350f, 0.2079116908f, + 0.1950903220f, 0.1822355255f, 0.1693495038f, 0.1564344650f, 0.1434926220f, 0.1305261922f, 0.1175373975f, + 0.1045284633f, 0.0915016187f, 0.0784590957f, 0.0654031292f, 0.0523359562f, 0.0392598158f, 0.0261769483f, + 0.0130895956f, 0.0000000000f +}; +#endif + const float ivas_sin_twiddle_80[IVAS_80_PT_LEN >> 1] = { -0.00490871880799799f, -0.0441642771270674f, -0.0833517373318975f, -0.122410675199216f, @@ -5530,5 +5622,1452 @@ const int16_t ivas_num_active_bands[FB - WB + 1] = IVAS_16K_12BANDS_ACTIVE_BANDS, IVAS_FB_BANDS_12, IVAS_FB_BANDS_12 }; +#ifdef SNS_MSVQ +const int16_t ivas_sns_cdbks_tcx20_levels[SNS_MSVQ_NSTAGES_TCX20] = { 128, 64, 32, 32 }; +const int16_t ivas_sns_cdbks_tcx20_bits[SNS_MSVQ_NSTAGES_TCX20] = { 7, 6, 5, 5 }; + +#ifdef FIX_445_SNS_BUGFIXES +/* pre-rounded codebook vectors for singed Q4.12 represantation */ +const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = { + -1.8305664f, -2.0878906f, -0.9638672f, 2.8059082f, 2.668213f, 1.1638184f, 1.390625f, 1.217041f, 1.3850098f, 0.44555664f, -0.47045898f, -0.5307617f, -0.810791f, -1.1647949f, -1.4560547f, -1.7612305f, + -2.5979004f, -3.3308105f, -1.8554688f, -0.3605957f, 1.6828613f, 2.5871582f, 0.98168945f, 0.22436523f, -0.13110352f, 0.16699219f, 1.5004883f, 0.3293457f, 0.33569336f, 1.1591797f, 0.1796875f, -0.8718262f, + 1.982666f, 2.2011719f, 1.1525879f, 0.8093262f, 0.86499023f, 1.1618652f, 1.2888184f, 1.3618164f, 1.0827637f, 0.83251953f, 0.12011719f, -0.7182617f, -2.1948242f, -3.0500488f, -3.3571777f, -3.53833f, + 0.15771484f, 1.1040039f, 0.39282227f, -0.6479492f, -1.0939941f, -1.0437012f, -1.2055664f, -1.1469727f, -0.998291f, -0.37768555f, 0.3486328f, 1.081543f, 1.2700195f, 1.2143555f, 0.8371582f, 0.107666016f, + 0.24438477f, -0.70751953f, -1.1660156f, -1.1777344f, -0.24536133f, 0.39624023f, 1.112793f, 1.232666f, 1.3540039f, 1.088623f, 0.9001465f, 0.9003906f, -0.030761719f, -0.83740234f, -1.2800293f, -1.7849121f, + -0.91918945f, -0.18603516f, -0.7397461f, -1.5285645f, -1.7453613f, -1.2680664f, -0.9445801f, 0.2434082f, 1.3000488f, 1.6604004f, 1.2814941f, 1.0026855f, 0.71484375f, 0.56347656f, 0.47509766f, 0.09008789f, + 2.4824219f, 1.4541016f, 0.91064453f, 0.6765137f, 0.5678711f, 0.6965332f, 0.7609863f, 0.70410156f, 0.36108398f, -0.032470703f, -0.69140625f, -1.1281738f, -1.4833984f, -1.5556641f, -1.7043457f, -2.0187988f, + 2.41333f, 1.4936523f, 0.9902344f, 0.9104004f, 0.7211914f, 0.5522461f, 0.09326172f, -0.21655273f, -0.49560547f, -0.4873047f, -0.7363281f, -0.9211426f, -1.0041504f, -0.9875488f, -1.0681152f, -1.2578125f, + -0.814209f, 1.2546387f, 1.6965332f, 1.420166f, 0.99560547f, 1.1420898f, 1.0039062f, 0.9289551f, 0.6604004f, 0.22485352f, -0.6530762f, -1.2009277f, -1.2949219f, -1.3759766f, -1.7175293f, -2.2705078f, + -1.3979492f, 0.18896484f, 0.34814453f, -0.052001953f, -0.38623047f, -0.25878906f, -0.3371582f, -0.109375f, -0.08227539f, 0.07495117f, -0.019042969f, 0.1184082f, 0.30566406f, 0.5102539f, 0.6755371f, 0.4206543f, + 1.0683594f, 1.9543457f, 2.1296387f, 2.071045f, 1.5754395f, 1.1333008f, 0.4248047f, -0.19799805f, -0.84350586f, -1.079834f, -1.3415527f, -1.3908691f, -1.3967285f, -1.3078613f, -1.3322754f, -1.4663086f, + 2.3891602f, 2.5097656f, 1.144043f, 0.36572266f, -0.16894531f, -0.23388672f, 0.26879883f, 0.7692871f, 0.54589844f, 0.5180664f, -0.26879883f, -0.92211914f, -1.2089844f, -1.4658203f, -1.9033203f, -2.338623f, + -1.3549805f, 1.3427734f, 1.5871582f, 1.9365234f, 0.58935547f, 0.4892578f, -0.17675781f, -0.19458008f, 0.11352539f, 0.01928711f, 0.30419922f, -0.23291016f, -2.1499023f, -1.2368164f, -0.20922852f, -0.8269043f, + 0.8769531f, -1.5319824f, -1.6025391f, -1.3833008f, -0.57299805f, -0.8847656f, -0.90600586f, -0.986084f, -1.1860352f, -1.3520508f, -1.2216797f, -0.49902344f, 1.5070801f, 4.0805664f, 2.208496f, 3.4538574f, + 4.114258f, 3.3249512f, 2.2033691f, 1.0500488f, 0.14770508f, -0.36547852f, -0.748291f, -0.8503418f, -1.0917969f, -1.0305176f, -1.1955566f, -1.2768555f, -1.1767578f, -1.0061035f, -0.9506836f, -1.1477051f, + 0.7878418f, 2.513916f, 1.0112305f, -0.767334f, -1.3525391f, -0.86865234f, 0.42456055f, 1.4470215f, 1.2680664f, 1.1574707f, -0.41333008f, -0.92993164f, -0.9226074f, -0.92285156f, -0.80859375f, -1.6242676f, + -2.2216797f, -1.2346191f, -0.4008789f, 0.59765625f, -0.49389648f, 1.1911621f, 0.032470703f, 1.3654785f, 0.43139648f, 1.2021484f, 1.6652832f, 0.58862305f, -0.29541016f, -0.99560547f, -1.0366211f, -0.39526367f, + -1.8601074f, -2.9248047f, 0.14648438f, 0.61157227f, 0.6274414f, -1.3579102f, 0.48095703f, -0.4399414f, 0.57006836f, 1.1831055f, -1.1950684f, 0.828125f, 1.2575684f, 1.5888672f, 0.5510254f, -0.06762695f, + 2.1816406f, 2.8918457f, 2.9243164f, 2.5839844f, 2.2548828f, 1.7543945f, 0.92626953f, 0.45751953f, -0.17285156f, -0.9650879f, -1.7875977f, -2.3608398f, -2.6245117f, -2.6313477f, -2.6652832f, -2.767334f, + 2.0964355f, 0.20458984f, -1.2553711f, -2.0012207f, -1.9951172f, -1.407959f, -1.0788574f, -0.47460938f, -0.01928711f, 0.45239258f, 0.73779297f, 0.9333496f, 1.0112305f, 1.1274414f, 0.90893555f, 0.7597656f, + -1.2897949f, 0.13867188f, 0.4831543f, 0.6274414f, 0.5175781f, 0.54541016f, 0.46826172f, 0.548584f, 0.39135742f, 0.4975586f, 0.38671875f, -0.022705078f, -0.36083984f, -0.8190918f, -1.0593262f, -1.0527344f, + 0.80029297f, 0.57250977f, 0.068359375f, -0.70996094f, -1.0571289f, -0.92041016f, -0.74121094f, -0.3017578f, 0.1850586f, 0.7922363f, 0.76171875f, 0.55859375f, 0.39135742f, 0.22363281f, -0.09790039f, -0.5253906f, + 4.5966797f, 2.5993652f, 0.8737793f, -0.9536133f, -0.07006836f, 2.6501465f, 1.3757324f, -0.8967285f, -1.6777344f, -1.2912598f, -0.5917969f, -1.3334961f, -1.4775391f, -0.6760254f, -1.0019531f, -2.1257324f, + -1.0061035f, 0.67407227f, 0.9157715f, 0.9851074f, 0.78564453f, -0.009277344f, -0.40039062f, -0.12524414f, -0.18310547f, -0.0029296875f, -0.38989258f, -0.40820312f, -0.37158203f, -0.15551758f, 0.010253906f, -0.3178711f, + -1.3325195f, 0.7138672f, 1.6359863f, 2.2177734f, 1.659668f, 1.9414062f, 1.0874023f, 1.3305664f, 1.4523926f, 1.2883301f, -0.56225586f, -2.0280762f, -2.8566895f, -2.5690918f, -2.1638184f, -1.8144531f, + 0.0925293f, 1.5366211f, 2.095459f, 1.9145508f, 1.4782715f, 0.8676758f, -0.34643555f, -0.21826172f, -1.1254883f, -1.1550293f, -0.92211914f, -0.5473633f, -0.89868164f, -0.77441406f, -0.8112793f, -1.1855469f, + 2.2070312f, 3.5219727f, 1.9643555f, 0.5649414f, -0.021728516f, 0.14941406f, 0.15991211f, 0.21850586f, -1.1708984f, -1.1306152f, -0.32299805f, -0.064453125f, -1.4772949f, -1.6064453f, -1.3984375f, -1.5932617f, + 2.5195312f, 2.3515625f, 1.3063965f, 0.20825195f, -0.609375f, -1.088623f, -1.3623047f, -1.2600098f, -1.3369141f, -1.0693359f, -0.8010254f, -0.42773438f, -0.15234375f, 0.44799805f, 0.5998535f, 0.6743164f, + 1.5209961f, 1.0463867f, 0.74560547f, 0.51342773f, 0.34448242f, 0.21533203f, -0.028320312f, -0.084228516f, 0.08618164f, 0.12475586f, -0.3557129f, -0.5698242f, -0.63012695f, -0.6933594f, -0.9638672f, -1.2717285f, + -0.5739746f, -0.20629883f, -0.9890137f, -1.8708496f, -1.9855957f, -1.6159668f, -1.6103516f, -1.3623047f, -0.9399414f, -0.067871094f, 0.9128418f, 1.7995605f, 2.1074219f, 2.2941895f, 2.331787f, 1.7766113f, + 3.6323242f, 1.9743652f, 0.3935547f, -0.6862793f, -1.1130371f, -1.0187988f, -0.8935547f, -0.5998535f, -0.4345703f, -0.2290039f, -0.26416016f, -0.21484375f, -0.13208008f, 0.009765625f, -0.16601562f, -0.2578125f, + -0.0871582f, 1.651123f, 1.8327637f, 0.54125977f, 0.23999023f, 1.421875f, 0.79663086f, 1.309082f, 0.98217773f, 1.2548828f, -1.8842773f, -1.8806152f, -1.5390625f, -1.3496094f, -1.2785645f, -2.0100098f, + -2.2109375f, -0.70288086f, 1.1103516f, 2.2207031f, 2.3356934f, 2.010498f, 1.638916f, 1.4345703f, 1.0351562f, 0.5690918f, -0.11035156f, -0.88256836f, -1.5859375f, -2.0117188f, -2.31958f, -2.5310059f, + -1.6091309f, -2.519287f, -2.4504395f, 0.26660156f, 2.321289f, 2.5898438f, 3.5390625f, -1.0505371f, -1.2543945f, -0.27734375f, 0.94873047f, 1.3859863f, 0.7109375f, -1.0185547f, -1.2666016f, -0.31689453f, + 0.94433594f, 2.465332f, 2.668457f, 1.9997559f, 1.2949219f, 1.0178223f, 0.888916f, 0.7038574f, 0.29248047f, -0.050048828f, -0.77001953f, -1.4472656f, -2.0839844f, -2.5202637f, -2.6381836f, -2.7663574f, + -0.14160156f, -0.3083496f, -0.5864258f, -1.2387695f, -1.4682617f, -1.1057129f, -0.7817383f, -0.5292969f, -0.06323242f, 0.54003906f, 0.8947754f, 1.3034668f, 1.3681641f, 1.1462402f, 0.7866211f, 0.18408203f, + 0.40478516f, -0.94018555f, -1.2241211f, -1.1057129f, -0.43066406f, -0.07324219f, 2.0061035f, 4.0029297f, 0.48828125f, 0.20117188f, 0.16235352f, -0.4182129f, -0.7751465f, -0.74072266f, -0.7463379f, -0.81152344f, + -2.7770996f, -2.1079102f, -1.5097656f, -1.515625f, -1.0080566f, -0.036621094f, 0.3708496f, 1.060791f, 1.3742676f, 1.2963867f, 0.9782715f, 1.0876465f, 0.9584961f, 0.8691406f, 0.7578125f, 0.20092773f, + 1.8244629f, 2.9589844f, 2.7573242f, 1.1542969f, 0.87109375f, 1.3430176f, 0.9003906f, 0.8564453f, 0.41308594f, -0.40551758f, -2.0913086f, -2.3833008f, -2.1589355f, -1.9533691f, -1.9741211f, -2.1125488f, + 2.1027832f, 1.2624512f, 1.0627441f, 0.8051758f, 0.22583008f, -0.12939453f, -0.3996582f, -0.54052734f, -0.74975586f, -0.7180176f, -0.7895508f, -0.7229004f, -0.6113281f, -0.2956543f, -0.21484375f, -0.28710938f, + 0.15161133f, 2.585205f, 1.7568359f, 0.9177246f, 0.37329102f, -0.16088867f, -0.4633789f, -0.21801758f, -0.09277344f, -0.021484375f, -0.22631836f, -0.42382812f, -0.66625977f, -0.8803711f, -1.0666504f, -1.5649414f, + -2.6091309f, -1.9162598f, -1.4050293f, -1.5510254f, -1.4436035f, -0.76904297f, -0.6994629f, -0.28881836f, -0.09326172f, 0.4140625f, 0.6401367f, 1.267334f, 1.7597656f, 2.1586914f, 2.4848633f, 2.0510254f, + -0.08935547f, 1.982666f, 2.4018555f, 1.3012695f, 0.122802734f, 0.8886719f, 1.3410645f, 1.0705566f, 0.115234375f, -0.2043457f, -0.97094727f, -2.4370117f, -2.147705f, -1.3283691f, -0.74731445f, -1.298584f, + 2.5476074f, 0.140625f, -0.8376465f, -1.244873f, -1.2324219f, -0.7644043f, -0.34521484f, 0.3581543f, 0.60839844f, 0.5698242f, 0.3034668f, 0.06274414f, 0.27563477f, 0.35498047f, -0.28588867f, -0.5109863f, + -0.5878906f, 1.0141602f, 1.5241699f, 1.2287598f, 0.76123047f, 0.6047363f, 0.2199707f, 0.21044922f, 0.15185547f, 0.15307617f, -0.115478516f, -0.46313477f, -0.689209f, -0.9284668f, -1.3129883f, -1.770752f, + 1.4040527f, -0.9628906f, -1.3322754f, -0.79785156f, 0.06591797f, -0.045166016f, -0.33520508f, -0.6257324f, -0.91748047f, -0.9824219f, -0.9892578f, -0.84472656f, -0.66137695f, -0.057861328f, 2.248291f, 4.8339844f, + 2.727539f, 3.736084f, 3.4023438f, 2.6699219f, 1.3686523f, 0.091308594f, -0.7897949f, -1.1069336f, -1.4260254f, -1.4335938f, -1.5388184f, -1.5930176f, -1.5603027f, -1.5078125f, -1.473877f, -1.565918f, + 1.2629395f, 2.5461426f, 1.8774414f, -0.051513672f, -1.0480957f, -0.94873047f, -0.40551758f, 0.21875f, 0.01977539f, -0.1484375f, -0.44140625f, -0.5810547f, -0.5349121f, -0.4650879f, -0.51831055f, -0.7819824f, + -2.1455078f, -0.25683594f, 1.3151855f, 1.635498f, 1.4401855f, 0.89624023f, 0.8405762f, 0.9350586f, 0.9802246f, 0.67041016f, -0.13085938f, -0.59521484f, -0.9729004f, -1.145752f, -1.4951172f, -1.9714355f, + -2.1291504f, -2.1418457f, -0.46704102f, 0.73291016f, 1.2219238f, -0.27856445f, -0.30517578f, 1.1865234f, 0.87231445f, -0.060791016f, 0.060058594f, 0.43701172f, 0.79174805f, 0.9128418f, -0.046142578f, -0.7866211f, + 3.130127f, 2.7661133f, 1.8110352f, 1.4995117f, 1.095459f, 0.8935547f, 0.8383789f, 0.5913086f, 0.21923828f, -0.1965332f, -0.982666f, -1.7121582f, -2.2011719f, -2.409912f, -2.5390625f, -2.803711f, + 1.5769043f, 0.34960938f, -0.17211914f, -0.4428711f, -0.62597656f, -0.57055664f, -0.6516113f, -0.43676758f, -0.38208008f, -0.18725586f, -0.16992188f, -0.0034179688f, 0.15356445f, 0.39404297f, 0.56396484f, 0.60424805f, + 0.12768555f, 0.2109375f, 0.16137695f, 0.063964844f, 0.13012695f, 0.39526367f, 0.5834961f, 0.62353516f, 0.50683594f, 0.37402344f, 0.060546875f, -0.13232422f, -0.37719727f, -0.6010742f, -0.8376465f, -1.2895508f, + 0.6723633f, 1.9140625f, 0.3737793f, -1.2988281f, -1.7912598f, -1.2351074f, -0.44628906f, 0.5895996f, 0.6838379f, 0.58935547f, 0.22460938f, -0.013183594f, -0.16479492f, 0.072021484f, 0.14501953f, -0.3149414f, + 4.0183105f, 2.2834473f, 1.317627f, 1.2583008f, 1.5627441f, 0.9851074f, 0.12817383f, -0.2944336f, -0.65527344f, -0.9675293f, -1.3979492f, -1.5356445f, -1.5737305f, -1.5908203f, -1.6887207f, -1.8493652f, + 0.8132324f, 0.6748047f, 0.44433594f, 0.35375977f, 0.09863281f, 0.048095703f, -0.15063477f, -0.12646484f, -0.18432617f, -0.15258789f, -0.30517578f, -0.29101562f, -0.31201172f, -0.23876953f, -0.26635742f, -0.40551758f, + 0.29345703f, 2.6530762f, 3.4177246f, 2.5812988f, 2.1159668f, 1.3947754f, 0.9523926f, 0.41479492f, -0.15844727f, -0.9025879f, -1.5444336f, -1.9780273f, -2.2106934f, -2.2788086f, -2.3234863f, -2.4267578f, + 0.75805664f, 2.5563965f, 2.8410645f, 2.2597656f, 0.3876953f, -1.067627f, -1.425293f, -0.795166f, -0.6105957f, -0.66381836f, -0.9675293f, -1.0371094f, -0.88916016f, -0.5444336f, -0.19042969f, -0.6118164f, + 1.7177734f, 3.0668945f, 3.2519531f, 2.4799805f, 0.7363281f, -0.8156738f, -0.8125f, 0.1430664f, 0.34375f, -0.27563477f, -1.4462891f, -1.4350586f, -1.4143066f, -1.6706543f, -1.8481445f, -2.0212402f, + 2.756836f, 1.090332f, 0.61572266f, 0.1928711f, -0.34521484f, -0.47509766f, -0.36767578f, -0.0637207f, 0.14233398f, 0.19580078f, -0.16015625f, -0.43286133f, -0.6472168f, -0.5493164f, -0.80737305f, -1.1452637f, + 1.0544434f, 1.0671387f, 1.1149902f, 1.1230469f, 0.78637695f, 0.64282227f, 0.4868164f, 0.3413086f, 0.13769531f, -0.13085938f, -0.64990234f, -0.89453125f, -1.074707f, -1.114502f, -1.3056641f, -1.5842285f, + -1.8156738f, -1.3222656f, -1.4528809f, -1.8908691f, -1.8740234f, -1.1118164f, -1.1750488f, -0.5734863f, 0.16308594f, 1.5822754f, 2.0114746f, 1.8625488f, 1.6049805f, 1.5942383f, 1.5368652f, 0.8605957f, + 3.2451172f, 2.7807617f, 1.2692871f, 0.5222168f, 0.119384766f, -0.06616211f, -0.15722656f, -0.10424805f, -0.27197266f, -0.45263672f, -0.83618164f, -1.1611328f, -1.333252f, -1.2722168f, -1.2016602f, -1.0800781f, + 0.17333984f, 2.4299316f, 2.3254395f, 1.3701172f, 0.47509766f, 0.72216797f, 0.072753906f, -0.037597656f, -0.41845703f, -0.8137207f, -1.5649414f, -2.4125977f, -1.3486328f, -0.53027344f, -0.10546875f, -0.33740234f, + -2.5983887f, -1.9645996f, -0.5678711f, 0.48999023f, 0.86743164f, 0.62158203f, 1.189209f, 1.3269043f, 1.182373f, 1.0024414f, 0.54785156f, 0.25634766f, -0.12133789f, -0.44140625f, -0.7026367f, -1.0881348f, + 0.071777344f, -2.279541f, -2.057373f, -0.25512695f, 2.2199707f, 2.541748f, 0.8342285f, 0.7907715f, 0.5048828f, -0.1303711f, 0.2631836f, -0.37036133f, -0.5187988f, -0.42285156f, -0.66845703f, -0.52368164f, + 1.3261719f, 3.1193848f, 2.583496f, 0.6767578f, -0.022460938f, 0.5214844f, 0.6105957f, 1.0021973f, 0.66845703f, 0.8640137f, -0.37353516f, -2.0703125f, -2.3225098f, -2.136963f, -2.057129f, -2.3894043f, + 1.4580078f, 2.0153809f, 1.0583496f, -0.12792969f, -0.6064453f, -0.7011719f, -0.96118164f, -0.8588867f, -0.7414551f, -0.18896484f, 0.1550293f, 0.46166992f, 0.3881836f, 0.16113281f, -0.37109375f, -1.140625f, + 1.6044922f, 0.8898926f, -0.053222656f, -0.26611328f, 0.084228516f, 0.5666504f, 0.9013672f, 1.1362305f, 1.1520996f, 0.74243164f, 0.5168457f, 0.11206055f, -0.8305664f, -1.7199707f, -2.109375f, -2.7270508f, + -1.3208008f, -0.083984375f, -0.24169922f, -0.95043945f, -1.2331543f, -0.564209f, -0.018798828f, 0.95654297f, 1.142334f, 1.1772461f, 0.8063965f, 0.43359375f, 0.08227539f, 0.07446289f, 0.099853516f, -0.359375f, + 2.0480957f, 2.739746f, 2.1257324f, 1.1525879f, 0.7644043f, 0.5031738f, 0.2758789f, 0.19311523f, -0.08642578f, -0.15893555f, -0.89990234f, -1.2700195f, -1.5583496f, -1.791748f, -1.9023438f, -2.135254f, + 2.2700195f, 2.2856445f, 1.5393066f, 0.77563477f, 0.23632812f, -0.017578125f, -0.23071289f, -0.19995117f, -0.26342773f, -0.17700195f, -0.5046387f, -0.6687012f, -0.8383789f, -1.057373f, -1.3330078f, -1.8166504f, + 0.66015625f, 1.6772461f, 1.604248f, 1.5366211f, 1.1013184f, 0.8173828f, 0.5605469f, 0.7155762f, 0.5270996f, 0.23291016f, -0.37719727f, -0.8352051f, -1.3342285f, -1.7580566f, -2.2695312f, -2.8588867f, + 0.21484375f, -0.44580078f, -0.85253906f, -1.0334473f, -0.95043945f, -0.592041f, -0.47558594f, -0.20092773f, -0.06323242f, 0.16040039f, 0.24414062f, 0.5144043f, 0.70947266f, 0.8796387f, 0.9663086f, 0.92529297f, + -0.047851562f, 1.6748047f, 2.0949707f, 2.3344727f, 1.7766113f, 1.7685547f, 0.35913086f, 0.47509766f, -0.055664062f, -0.08251953f, -0.76049805f, -1.8425293f, -2.8457031f, -2.4018555f, -1.144043f, -1.3034668f, + 2.0942383f, 1.1809082f, 0.54345703f, 0.18408203f, -0.44360352f, -0.5373535f, 0.12182617f, 0.7114258f, 0.8088379f, 0.7709961f, -0.12866211f, -1.1555176f, -1.4138184f, -1.0009766f, -0.83081055f, -0.90478516f, + -1.0332031f, 1.6005859f, 0.46875f, 1.6149902f, -0.23095703f, 1.0908203f, 0.068359375f, 0.5266113f, 0.18701172f, -0.12792969f, -0.22509766f, -0.4819336f, -0.5058594f, -0.390625f, -1.2128906f, -1.3486328f, + 1.7792969f, 0.7167969f, -0.40039062f, -1.1201172f, -1.5458984f, -1.5344238f, -1.5107422f, -1.3601074f, -1.2751465f, -0.93847656f, -0.40795898f, 0.49145508f, 1.2475586f, 2.0236816f, 2.0373535f, 1.7973633f, + 2.8059082f, 2.769043f, 1.6977539f, 0.44458008f, -0.41308594f, -0.6376953f, -0.80566406f, -0.81030273f, -0.93115234f, -0.66845703f, -0.7155762f, -0.6870117f, -0.6052246f, -0.46142578f, -0.41967773f, -0.56225586f, + 1.9963379f, 2.9060059f, 1.5930176f, -0.34716797f, -0.7993164f, 0.061279297f, 1.0302734f, 1.1359863f, 0.7434082f, -0.07397461f, -1.3549805f, -1.2399902f, -1.2802734f, -1.2973633f, -1.4362793f, -1.6364746f, + -2.3041992f, -0.73999023f, 0.11791992f, 0.3215332f, 0.45092773f, 0.45751953f, 0.7368164f, 0.7216797f, 0.19238281f, 0.75439453f, 0.17822266f, -0.46679688f, -0.41210938f, 0.029785156f, 0.20996094f, -0.24829102f, + -0.9016113f, -1.2150879f, -0.13208008f, 0.7023926f, 0.81225586f, -0.57055664f, -1.0405273f, -0.5344238f, 0.1706543f, 0.579834f, 0.80810547f, 0.4790039f, 0.3671875f, 0.24829102f, 0.32202148f, -0.095214844f, + 1.4807129f, 1.8234863f, 1.7661133f, 2.5449219f, 2.6020508f, 1.9316406f, 1.3154297f, 1.1328125f, 0.5263672f, -0.17895508f, -1.1706543f, -2.199707f, -2.7531738f, -2.8725586f, -2.9294434f, -3.0187988f, + 2.6689453f, 0.5949707f, -0.45043945f, -0.7963867f, -0.91625977f, -0.90722656f, -0.98413086f, -0.8354492f, -0.6953125f, -0.3955078f, -0.2849121f, 0.04296875f, 0.43066406f, 0.7241211f, 0.81591797f, 0.9880371f, + -0.15112305f, -0.33618164f, -0.3256836f, -0.111083984f, -0.048339844f, 0.08129883f, 0.068115234f, 0.17138672f, 0.20385742f, 0.2590332f, 0.123291016f, 0.11621094f, 0.03100586f, 0.06201172f, 0.06591797f, -0.2097168f, + 1.2731934f, 0.29223633f, -0.14038086f, -0.29956055f, -0.6376953f, -0.56762695f, -0.15844727f, 0.46020508f, 0.6569824f, 0.68188477f, 0.28393555f, -0.18676758f, -0.43164062f, -0.3347168f, -0.38256836f, -0.5083008f, + 4.678711f, 2.80542f, 1.126709f, -0.48461914f, -0.8273926f, 0.7895508f, 2.3266602f, 0.4375f, -1.6252441f, -1.8422852f, -1.4978027f, -0.8730469f, -1.3171387f, -1.671875f, -1.0270996f, -0.998291f, + -1.3620605f, 0.63916016f, 1.1337891f, 0.3178711f, 0.06591797f, 1.0673828f, 0.91503906f, 0.4387207f, -0.18359375f, -0.22875977f, -0.6660156f, -0.69799805f, -0.17236328f, -0.21118164f, -0.24951172f, -0.8066406f, + -0.44873047f, 1.4709473f, 2.5039062f, 2.7050781f, 1.9462891f, 0.3642578f, -0.30078125f, 0.6467285f, 0.9680176f, 0.9716797f, -1.498291f, -1.8183594f, -1.8544922f, -1.847168f, -1.605957f, -2.2028809f, + 0.47460938f, 1.574707f, 1.7148438f, 2.1083984f, 1.7241211f, 0.44189453f, -0.40551758f, -0.18847656f, 0.13232422f, -0.0031738281f, -0.79467773f, -1.1843262f, -1.2902832f, -1.2416992f, -1.3430176f, -1.7194824f, + 1.9831543f, 3.927246f, 2.9868164f, 1.2749023f, 0.265625f, 0.02734375f, 0.079833984f, 0.47070312f, -0.7956543f, -1.2663574f, -1.638916f, -1.8222656f, -1.3908691f, -1.4194336f, -1.3027344f, -1.3791504f, + 0.2097168f, 1.8005371f, 1.479248f, 0.62109375f, 0.091552734f, -0.38549805f, -0.93530273f, -0.923584f, -0.91259766f, -0.6557617f, -0.5842285f, -0.27563477f, 0.007080078f, 0.25585938f, 0.25219727f, -0.044677734f, + 0.51293945f, 1.0280762f, 0.84033203f, 0.62841797f, 0.5317383f, 0.5251465f, 0.26953125f, 0.09423828f, 0.032958984f, -0.052734375f, -0.48999023f, -0.6513672f, -0.6411133f, -0.6369629f, -0.84375f, -1.1477051f, + -1.2319336f, -0.08203125f, -0.23632812f, -0.8339844f, -1.0866699f, -0.88793945f, -1.0917969f, -0.83251953f, -0.79467773f, -0.45751953f, -0.25830078f, 0.43041992f, 1.1853027f, 1.7946777f, 2.3452148f, 2.0378418f, + 4.881592f, 2.1987305f, 0.6430664f, -0.15478516f, -0.36206055f, -0.4753418f, -0.5410156f, -0.1965332f, -0.072753906f, -0.10888672f, -0.5263672f, -0.8588867f, -0.94506836f, -0.99487305f, -1.1523438f, -1.3347168f, + -0.5546875f, 2.1118164f, 2.2026367f, 0.70703125f, -0.21142578f, 0.8679199f, 1.1367188f, 1.012207f, 0.9904785f, 1.2463379f, 0.21801758f, -1.9433594f, -2.9155273f, -2.2661133f, -0.97631836f, -1.6257324f, + -0.80908203f, 1.0163574f, 1.546875f, 2.0847168f, 1.9309082f, 1.6364746f, 1.057373f, 1.1618652f, 0.76049805f, 0.29858398f, -0.46484375f, -1.0957031f, -1.6264648f, -2.0043945f, -2.5080566f, -2.9853516f, + -0.29760742f, -1.7080078f, -1.5229492f, 1.3574219f, 4.701172f, 1.6962891f, 4.1030273f, -0.4194336f, -1.0739746f, -1.0820312f, 0.4255371f, -1.0825195f, -1.3613281f, -1.1777344f, -1.3232422f, -1.2341309f, + 1.7912598f, 1.7314453f, 1.8457031f, 2.1989746f, 1.9145508f, 1.0024414f, 0.51538086f, 0.44506836f, -0.075683594f, -0.5439453f, -1.1616211f, -1.5820312f, -1.8642578f, -1.9123535f, -2.0385742f, -2.2666016f, + -0.03100586f, -1.7485352f, -1.767334f, -1.9833984f, -1.4570312f, -0.84716797f, -0.50390625f, 0.040771484f, 0.43554688f, 0.62402344f, 0.9133301f, 1.4772949f, 1.7192383f, 1.2922363f, 0.80029297f, 1.0356445f, + -1.1809082f, -2.032959f, -2.0617676f, -1.9443359f, -1.6447754f, -0.8874512f, 3.0722656f, 2.6242676f, 2.3166504f, 3.4455566f, 1.090332f, -0.19970703f, -0.23510742f, -0.6906738f, -0.40576172f, -1.2653809f, + -2.2512207f, -1.9179688f, -2.1035156f, -2.3461914f, -2.14917f, -1.1347656f, -0.56689453f, 0.8166504f, 1.857666f, 2.114502f, 1.755127f, 1.9160156f, 1.6611328f, 1.1904297f, 0.8239746f, 0.33398438f, + 0.8227539f, 2.0544434f, 2.3171387f, 0.90234375f, 0.515625f, 1.0241699f, 0.6188965f, 0.296875f, -0.171875f, -0.6345215f, -1.2004395f, -1.1652832f, -1.1635742f, -1.2021484f, -1.3903809f, -1.6240234f, + 1.2287598f, 1.5820312f, 1.2756348f, 0.6843262f, 0.33911133f, 0.09472656f, -0.26733398f, -0.4711914f, -0.3137207f, -0.19116211f, -0.56884766f, -0.67944336f, -0.5612793f, -0.55444336f, -0.69506836f, -0.90234375f, + 1.5776367f, 2.6791992f, 2.3059082f, 1.375f, 0.7619629f, 0.08251953f, -0.6166992f, -0.8574219f, -1.0148926f, -1.0390625f, -1.0976562f, -0.8730469f, -0.7844238f, -0.7331543f, -0.7426758f, -1.0231934f, + -2.173584f, -1.3400879f, -0.8208008f, -0.95996094f, -0.6999512f, -0.010253906f, -0.19384766f, 0.25561523f, 0.3786621f, 0.72998047f, 0.4699707f, 0.4416504f, 0.49975586f, 0.9416504f, 1.4606934f, 1.0205078f, + -0.2631836f, 1.3510742f, 1.3837891f, 2.0864258f, 1.8503418f, 1.8864746f, 0.8581543f, 0.5866699f, 0.103759766f, -0.9616699f, -1.8740234f, -2.5600586f, -1.1362305f, -0.9301758f, -1.4404297f, -0.94091797f, + 2.7443848f, 0.5695801f, -0.21679688f, -0.6513672f, -0.14672852f, 0.5019531f, 0.23754883f, -0.19091797f, -0.27685547f, -0.15332031f, -0.31201172f, -0.35742188f, -0.2529297f, -0.25024414f, -0.62646484f, -0.61816406f, + 0.045898438f, 0.24243164f, 0.36865234f, 0.9145508f, 0.96777344f, 1.0041504f, 0.9550781f, 0.9213867f, 0.7089844f, 0.4296875f, -0.1328125f, -0.5522461f, -0.9333496f, -1.2285156f, -1.607666f, -2.1037598f, + 4.209961f, 1.2607422f, -0.85791016f, -1.416748f, -1.4013672f, -0.8574219f, -1.0410156f, -1.4523926f, -1.7346191f, -1.7731934f, -1.5373535f, -1.026123f, 0.8515625f, 0.21533203f, 2.2263184f, 4.3342285f, + 4.5341797f, 4.130371f, 2.7658691f, 2.1801758f, 0.90478516f, 0.5617676f, -0.1303711f, -1.1745605f, -1.5371094f, -1.5292969f, -1.6901855f, -1.7126465f, -1.7119141f, -1.7536621f, -1.8623047f, -1.9750977f, + 0.6777344f, 2.2624512f, 1.1889648f, -0.5876465f, -0.81347656f, 0.38916016f, 0.11694336f, 0.15283203f, -0.5698242f, -0.5168457f, -0.41845703f, -0.3544922f, -0.46191406f, -0.24804688f, -0.14038086f, -0.6772461f, + -1.3227539f, -0.38085938f, 0.23852539f, 0.76123047f, 1.0078125f, 1.1433105f, 0.9753418f, 0.7734375f, 0.32373047f, 0.08959961f, -0.19482422f, -0.43603516f, -0.5715332f, -0.6135254f, -0.7351074f, -1.0581055f, + -1.3225098f, -1.4675293f, -1.3000488f, -0.59375f, 0.022705078f, 0.57299805f, 0.5710449f, 0.36547852f, 0.5119629f, 0.77685547f, 0.623291f, 0.43408203f, 0.41210938f, 0.5258789f, 0.2434082f, -0.37597656f, + 2.3742676f, 3.3117676f, 3.0449219f, 2.4208984f, 1.2329102f, 0.63793945f, 0.32666016f, 0.15161133f, -0.25610352f, -1.0283203f, -1.7250977f, -1.9707031f, -2.0761719f, -2.1174316f, -2.1105957f, -2.2165527f, + 0.87109375f, 0.5085449f, 0.19018555f, -0.10913086f, -0.36328125f, -0.3725586f, -0.4946289f, -0.38671875f, -0.38183594f, -0.21801758f, -0.2331543f, -0.088378906f, 0.0234375f, 0.24194336f, 0.40649414f, 0.40600586f, + 1.0517578f, 0.5126953f, 0.23608398f, 0.31835938f, 0.3605957f, 0.39941406f, 0.38012695f, 0.50390625f, 0.54541016f, 0.37329102f, -0.24731445f, -0.5891113f, -0.6791992f, -0.7324219f, -1.0258789f, -1.407959f, + -0.66625977f, 1.7709961f, 1.2971191f, 0.15283203f, -1.0664062f, -0.7583008f, 0.16821289f, 0.5007324f, 0.35058594f, 0.14086914f, 0.5217285f, -0.13452148f, -1.2158203f, -0.34375f, 0.033447266f, -0.751709f, + 3.684082f, 3.3139648f, 2.0878906f, 1.1911621f, 0.607666f, 0.1472168f, 0.15258789f, 0.10083008f, -0.2355957f, -0.45239258f, -1.2746582f, -1.7348633f, -1.8305664f, -1.8266602f, -1.8925781f, -2.03833f, + 0.5786133f, 0.7692871f, 0.4777832f, 0.05493164f, -0.12597656f, -0.08227539f, -0.095703125f, 0.05444336f, 0.19848633f, 0.3190918f, 0.030273438f, -0.06738281f, -0.17138672f, -0.2854004f, -0.59375f, -1.0615234f, + -0.98413086f, 1.059082f, 2.3671875f, 2.3381348f, 2.529541f, 2.1052246f, 1.887207f, 1.2434082f, 0.54956055f, -0.12646484f, -0.9199219f, -1.6921387f, -2.3168945f, -2.5715332f, -2.6733398f, -2.7949219f, + 2.5153809f, 3.854248f, 2.8759766f, 1.9558105f, -0.30126953f, -1.3845215f, -1.4958496f, -1.2636719f, -1.1201172f, -0.84887695f, -1.1677246f, -0.63061523f, -0.4970703f, -0.76904297f, -0.72998047f, -0.9926758f, + 0.4025879f, 2.572998f, 3.1643066f, 2.5009766f, 1.3688965f, -0.08691406f, -0.63500977f, -0.119140625f, 0.0073242188f, -0.5070801f, -0.7023926f, -2.0339355f, -2.0788574f, -1.8864746f, -0.9301758f, -1.0368652f, + 2.1965332f, 1.2878418f, 0.50878906f, -0.119140625f, -0.49267578f, -0.6008301f, -0.75219727f, -0.56518555f, -0.5427246f, -0.4038086f, -0.43408203f, -0.28198242f, -0.13745117f, 0.06958008f, 0.14331055f, 0.1237793f, + 0.5012207f, 2.1748047f, 1.7189941f, 0.1274414f, -0.2644043f, 0.46875f, 0.37963867f, 0.7302246f, 0.23413086f, 0.41845703f, -0.7944336f, -0.8984375f, -0.6816406f, -1.0744629f, -1.190918f, -1.8496094f, + -2.3083496f, -2.19458f, -2.2111816f, -2.4804688f, -2.3293457f, -1.651123f, -1.3820801f, -0.78125f, -0.14477539f, 0.8547363f, 1.6848145f, 2.4699707f, 2.5429688f, 2.793457f, 2.9118652f, 2.2253418f, + 1.7553711f, 2.8996582f, 1.9260254f, 0.40551758f, -0.0234375f, 0.44506836f, 0.31152344f, 0.1809082f, -0.47607422f, -0.4807129f, -1.204834f, -1.3293457f, -1.2412109f, -1.0134277f, -0.89501953f, -1.2602539f, + 0.2253418f, 2.2539062f, 2.265625f, 0.57128906f, -0.7661133f, -0.6245117f, 0.21313477f, 1.2248535f, 0.8737793f, -0.12524414f, -0.9609375f, -2.416504f, -1.1223145f, -0.70532227f, -0.31469727f, -0.592041f, +}; +const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = { + -1.1569824f, -0.4765625f, 0.008056641f, 0.47802734f, 0.38330078f, -0.075683594f, -0.3737793f, -0.29516602f, -0.1352539f, 0.012939453f, 0.22241211f, 0.375f, 0.31689453f, 0.20874023f, 0.2541504f, 0.25439453f, + -0.40600586f, -0.22070312f, -0.04272461f, 0.15893555f, -0.25195312f, -0.6623535f, -0.27172852f, 0.28735352f, 0.35742188f, 0.20166016f, 0.052246094f, -0.3647461f, -0.4506836f, 0.1862793f, 0.66796875f, 0.7585449f, + 0.02734375f, -0.2097168f, -0.39819336f, -0.54296875f, -0.46850586f, -0.25146484f, -0.26953125f, -0.07495117f, 0.375f, 0.9343262f, 0.91625977f, 0.4267578f, 0.026123047f, -0.15576172f, -0.11425781f, -0.22021484f, + 0.011230469f, 0.37573242f, 0.8432617f, 0.7006836f, 0.5830078f, -0.49658203f, -0.84155273f, -0.46069336f, -0.16894531f, -0.006591797f, -0.075683594f, -0.2253418f, -0.2097168f, -0.12719727f, 0.006591797f, 0.092041016f, + 0.42382812f, 0.19360352f, 0.076171875f, 0.44091797f, 0.11401367f, -0.39819336f, -0.12207031f, 0.34960938f, 0.51660156f, -0.024902344f, -0.5324707f, -0.068359375f, 0.5083008f, -0.06591797f, -0.68359375f, -0.7277832f, + -0.12182617f, 0.15332031f, 0.3022461f, 0.23754883f, 0.2722168f, 0.8046875f, 0.76831055f, 0.28808594f, -0.05493164f, -0.29711914f, -0.45629883f, -0.42944336f, -0.42871094f, -0.4416504f, -0.35107422f, -0.24536133f, + -0.19873047f, -0.010253906f, -0.030517578f, -0.041748047f, 0.052490234f, 0.07446289f, 0.026123047f, -0.026611328f, 0.18579102f, 0.22485352f, 0.1965332f, 0.1538086f, 0.044677734f, -0.111328125f, -0.24853516f, -0.29052734f, + 0.7648926f, 0.47973633f, 0.31347656f, 0.1496582f, 0.23242188f, 0.16918945f, 0.05859375f, -0.12548828f, -0.18017578f, -0.19555664f, -0.17138672f, -0.19165039f, -0.23510742f, -0.3330078f, -0.37939453f, -0.3564453f, + -0.6201172f, -0.2915039f, -0.15234375f, 0.15966797f, 0.41430664f, 0.61206055f, 0.4453125f, 0.19360352f, -0.107666016f, -0.40429688f, -0.10424805f, 0.40649414f, 0.37817383f, -0.012939453f, -0.3857422f, -0.53100586f, + -0.6376953f, -0.01953125f, 0.32958984f, -0.27905273f, -0.21191406f, 0.8327637f, 0.28515625f, -0.31225586f, -0.4375f, -0.34204102f, -0.010498047f, 0.0546875f, 0.099365234f, 0.114746094f, 0.22973633f, 0.30444336f, + -0.76538086f, -0.5390625f, -0.38330078f, -0.39501953f, -0.21923828f, 0.19311523f, 0.1899414f, -0.08642578f, -0.044921875f, 0.13500977f, 0.4543457f, 0.6777344f, 0.5891113f, 0.30078125f, 0.04321289f, -0.14990234f, + 0.34838867f, -0.21826172f, 0.018066406f, 0.06689453f, 0.40063477f, 0.34570312f, -0.548584f, -0.86035156f, -0.24023438f, 0.60668945f, 0.22363281f, -0.05053711f, 0.13916016f, 0.02709961f, -0.07470703f, -0.18383789f, + 0.13842773f, 0.05444336f, 0.20629883f, -0.11450195f, -0.77563477f, -0.57543945f, 0.7011719f, 0.20117188f, -0.33984375f, 0.18481445f, 0.38232422f, -0.2097168f, -0.040771484f, 0.13476562f, 0.0769043f, -0.024658203f, + -0.24829102f, -0.47998047f, -0.7248535f, -0.64575195f, -0.2529297f, 0.43725586f, 0.6335449f, 0.6464844f, 0.53930664f, 0.33398438f, 0.13891602f, 0.30639648f, 0.3293457f, -0.07446289f, -0.3918457f, -0.54711914f, + -0.043945312f, -0.5168457f, -0.3779297f, 0.67089844f, 0.2548828f, -0.4663086f, -0.5402832f, -0.22338867f, 0.092285156f, 0.016845703f, 0.24780273f, 0.46850586f, 0.49902344f, 0.2734375f, -0.0925293f, -0.26245117f, + 0.014892578f, 0.3540039f, 0.35229492f, -0.13085938f, -0.49829102f, -0.52563477f, -0.05883789f, 0.024658203f, -0.29492188f, -0.4638672f, -0.17333984f, 0.3791504f, 0.47314453f, 0.29516602f, 0.19165039f, 0.060791016f, + -0.21264648f, -0.875f, -0.82958984f, -0.5048828f, -0.31835938f, -0.1430664f, 0.19580078f, 0.29174805f, 0.28637695f, 0.15356445f, 0.16894531f, 0.2241211f, 0.27734375f, 0.31835938f, 0.4091797f, 0.55810547f, + -1.2670898f, 0.016845703f, 0.36254883f, 0.65893555f, 0.59814453f, 0.49389648f, 0.18041992f, 0.1821289f, 0.15942383f, -0.016357422f, -0.18847656f, -0.36547852f, -0.3413086f, -0.2553711f, -0.14868164f, -0.06958008f, + 0.10644531f, 0.7878418f, 0.09643555f, -0.5786133f, -0.40966797f, 0.07055664f, 0.39819336f, 0.31030273f, 0.10986328f, 0.14013672f, 0.2680664f, 0.32861328f, 0.04296875f, -0.39648438f, -0.6052246f, -0.66967773f, + -0.49658203f, 0.26416016f, 0.657959f, 0.41137695f, 0.28881836f, 0.22338867f, 0.15527344f, -0.08325195f, -0.118652344f, 0.08544922f, 0.2841797f, 0.15258789f, -0.18554688f, -0.48388672f, -0.5810547f, -0.5734863f, + 0.22314453f, 0.37402344f, 0.2163086f, -0.5078125f, -0.95703125f, -1.1442871f, -0.35302734f, 0.68359375f, 0.67089844f, 0.31811523f, 0.12792969f, -0.15478516f, -0.0026855469f, 0.18237305f, 0.16870117f, 0.15429688f, + 0.26464844f, -0.11401367f, -0.106933594f, 0.26538086f, 0.51660156f, 0.5373535f, 0.35888672f, 0.16870117f, 0.20825195f, 0.2409668f, 0.14013672f, -0.0546875f, -0.3334961f, -0.58691406f, -0.74243164f, -0.7624512f, + 0.73779297f, -0.14477539f, -0.37646484f, -0.1003418f, 0.1027832f, 0.14160156f, 0.06738281f, -0.05444336f, -0.016357422f, -0.0234375f, -0.022216797f, -0.049316406f, -0.061035156f, -0.10864258f, -0.09057617f, -0.0017089844f, + 1.0466309f, 0.6826172f, 0.1315918f, -0.21020508f, -0.104003906f, -0.21191406f, -0.3256836f, -0.4729004f, -0.59765625f, -0.50805664f, -0.2043457f, 0.033935547f, 0.115722656f, 0.09423828f, 0.18017578f, 0.34960938f, + -0.9074707f, -0.25634766f, 0.14331055f, 0.03515625f, -0.076171875f, -0.1340332f, -0.0073242188f, 0.20922852f, 0.40063477f, 0.5883789f, 0.64868164f, 0.50024414f, 0.19238281f, -0.22338867f, -0.47998047f, -0.6333008f, + 0.40429688f, 0.021972656f, 0.059814453f, 0.5866699f, 1.2155762f, 0.35351562f, -0.17480469f, -0.0703125f, -0.09448242f, -0.24975586f, -0.39672852f, -0.3347168f, -0.3479004f, -0.38671875f, -0.36743164f, -0.21948242f, + 0.71850586f, -0.052246094f, -0.3918457f, -0.13745117f, 0.13793945f, 0.20458984f, 0.13623047f, -0.15039062f, -0.22436523f, -0.2446289f, 0.12158203f, 0.58496094f, 0.5527344f, -0.028320312f, -0.60180664f, -0.6254883f, + 0.007080078f, 0.32910156f, 0.41210938f, 0.033203125f, -0.2097168f, -0.06665039f, -0.15307617f, 0.020507812f, 0.33203125f, 0.8874512f, 0.7089844f, -0.4128418f, -0.71484375f, -0.4958496f, -0.29223633f, -0.38476562f, + -0.84765625f, 0.3466797f, 0.107910156f, -0.3659668f, -0.48583984f, -0.41552734f, -0.38232422f, -0.26953125f, 0.019042969f, 0.25219727f, 0.40039062f, 0.3984375f, 0.38427734f, 0.29785156f, 0.29589844f, 0.26391602f, + 0.47680664f, -0.0056152344f, -0.15307617f, -0.33764648f, -0.30737305f, 0.24511719f, 0.8847656f, 0.61035156f, -0.32861328f, -0.6430664f, -0.43823242f, -0.1899414f, -0.12475586f, -0.084228516f, 0.111328125f, 0.28393555f, + 1.0576172f, -0.23535156f, -0.9638672f, -0.84716797f, 0.3137207f, 1.1804199f, 0.7871094f, 0.14257812f, -0.018798828f, -0.21801758f, -0.20703125f, -0.11816406f, -0.10449219f, -0.16210938f, -0.3491211f, -0.25708008f, + -0.028564453f, -0.43652344f, -0.20336914f, 0.13623047f, 0.17822266f, 0.2175293f, -0.026367188f, -0.4050293f, -0.6472168f, -0.670166f, -0.26391602f, 0.3864746f, 0.685791f, 0.53808594f, 0.29077148f, 0.24853516f, + -0.32836914f, -0.09106445f, -0.11254883f, -0.34277344f, -0.5786133f, -0.5319824f, -0.45410156f, -0.34716797f, -0.2163086f, -0.1862793f, -0.09448242f, 0.14550781f, 0.32739258f, 0.6513672f, 1.0861816f, 1.0732422f, + 0.17163086f, 0.26391602f, 0.19165039f, 0.028320312f, -0.05517578f, 0.14355469f, 0.09057617f, 0.03125f, -0.20532227f, -0.36889648f, -0.58569336f, -0.7468262f, -0.75634766f, -0.04272461f, 0.84814453f, 0.9921875f, + 0.61376953f, -0.18969727f, -0.4868164f, -0.45410156f, -0.42089844f, -0.39868164f, -0.34399414f, -0.25610352f, -0.104003906f, 0.11791992f, 0.3408203f, 0.4416504f, 0.40942383f, 0.31689453f, 0.22802734f, 0.18603516f, + -0.5876465f, 0.19213867f, 0.30737305f, 0.46264648f, 0.37817383f, 0.08276367f, -0.36279297f, -0.51904297f, -0.53125f, -0.42382812f, -0.27075195f, -0.15063477f, -0.026611328f, 0.21655273f, 0.5439453f, 0.6879883f, + -0.5786133f, -0.046875f, 0.0390625f, -0.026123047f, 0.034423828f, -0.28442383f, -0.5217285f, 0.07299805f, 0.7167969f, 0.84106445f, -0.34570312f, -0.3466797f, 0.25512695f, 0.31958008f, 0.12207031f, -0.2512207f, + -0.19604492f, 0.11645508f, 0.17895508f, 0.2697754f, 0.4050293f, 0.2927246f, 0.09667969f, -0.12817383f, -0.14550781f, -0.1706543f, -0.16308594f, -0.13354492f, -0.11376953f, -0.14282227f, -0.12866211f, -0.037353516f, + -0.2084961f, -0.2878418f, -0.23657227f, -0.11816406f, 0.016357422f, 0.059326172f, 0.067871094f, -0.033447266f, -0.013427734f, 0.0029296875f, 0.068603516f, 0.12548828f, 0.14624023f, 0.11279297f, 0.11254883f, 0.18530273f, + -0.13549805f, 1.1516113f, 0.5197754f, -0.064453125f, -0.2409668f, -0.1274414f, -0.021484375f, -0.07104492f, -0.095458984f, -0.11987305f, -0.12573242f, -0.18701172f, -0.20874023f, -0.21459961f, -0.08081055f, 0.021484375f, + -0.33520508f, -0.6520996f, -0.2927246f, 0.8496094f, 0.6022949f, 0.35229492f, 0.1484375f, 0.06347656f, -0.13232422f, -0.390625f, -0.41137695f, -0.27294922f, -0.1694336f, -0.027832031f, 0.18310547f, 0.48510742f, + 0.22802734f, 0.8112793f, 0.25610352f, -0.5793457f, 0.18774414f, 0.74902344f, 0.122802734f, -0.38842773f, -0.57714844f, -0.842041f, -0.97314453f, -0.74975586f, 0.20605469f, 1.4348145f, 0.22973633f, -0.115722656f, + -0.103759766f, 0.055664062f, -0.29663086f, -0.3864746f, -0.36743164f, -0.38549805f, -0.22802734f, -0.19311523f, -0.11816406f, -0.11645508f, 0.2578125f, 1.0197754f, 1.0957031f, 0.7624512f, -0.19189453f, -0.8034668f, + 0.31860352f, -0.32495117f, -0.25756836f, 0.4501953f, 0.74731445f, 0.26293945f, -0.5578613f, -0.6347656f, 0.056152344f, 1.1223145f, 0.27783203f, -0.8347168f, -0.96850586f, -0.2019043f, 0.5266113f, 0.018798828f, + 0.2434082f, 0.05126953f, -0.16088867f, -0.2434082f, -0.15234375f, 0.037353516f, 0.06982422f, -0.015136719f, -0.607666f, 0.14428711f, 0.94433594f, 0.37109375f, -0.3083496f, -0.34765625f, -0.12060547f, 0.09448242f, + 0.13427734f, 0.47021484f, -0.4387207f, -0.8562012f, -0.6101074f, -0.10913086f, 0.1430664f, 0.18334961f, 0.103759766f, -0.034423828f, -0.06738281f, 0.036376953f, 0.12670898f, 0.18603516f, 0.33496094f, 0.39697266f, + 1.0314941f, -0.5073242f, 0.050048828f, 0.31860352f, -0.055908203f, -0.6105957f, -0.31860352f, -0.056396484f, 0.072753906f, 0.056884766f, -0.053466797f, -0.06933594f, -0.08666992f, -0.038330078f, 0.047851562f, 0.21875f, + 0.47192383f, 0.58447266f, 0.6154785f, -0.078125f, -0.6315918f, -0.92626953f, -0.89501953f, -0.46069336f, -0.14819336f, -0.03125f, 0.046142578f, 0.14086914f, 0.12646484f, 0.25390625f, 0.47753906f, 0.4543457f, + -1.1186523f, -0.5427246f, -0.36108398f, -0.13378906f, -0.0048828125f, 0.2939453f, 0.45581055f, 0.3972168f, 0.2421875f, -0.18725586f, -0.576416f, -0.25805664f, 0.115722656f, 0.517334f, 0.6699219f, 0.4909668f, + -0.8635254f, -0.1977539f, -0.067871094f, -0.060058594f, 0.08251953f, 0.5378418f, 0.0007324219f, -0.067871094f, -0.0053710938f, 0.513916f, 0.42993164f, -0.3544922f, -0.6711426f, -0.15454102f, 0.5522461f, 0.3256836f, + 0.62231445f, 0.44702148f, 0.3725586f, 0.15454102f, -0.13916016f, -0.40576172f, -0.49829102f, -0.3881836f, -0.13867188f, 0.2355957f, 0.5095215f, 0.3972168f, 0.0793457f, -0.22802734f, -0.44213867f, -0.5776367f, + -0.64086914f, 0.17944336f, 1.0073242f, 0.46972656f, -0.33007812f, -0.33569336f, -0.016357422f, -0.064208984f, -0.08105469f, -0.14916992f, -0.05444336f, 0.016845703f, -0.010009766f, -0.08911133f, -0.012207031f, 0.10961914f, + 0.47485352f, -0.13232422f, 0.21044922f, 0.36645508f, -0.11303711f, -0.8552246f, -0.7819824f, 0.8149414f, 1.0595703f, -0.46044922f, -0.359375f, -0.04296875f, -0.21948242f, -0.24584961f, 0.037353516f, 0.24707031f, + 0.28710938f, -0.68530273f, 0.22631836f, 0.119384766f, -0.17114258f, -0.29833984f, 0.33618164f, 0.49438477f, 0.4248047f, 0.171875f, 0.20385742f, 0.08935547f, -0.20922852f, -0.38671875f, -0.3569336f, -0.24584961f, + 0.33544922f, 0.27172852f, 0.040283203f, -0.072509766f, -0.008544922f, -0.095458984f, -0.19897461f, -0.2980957f, -0.17480469f, -0.12133789f, -0.060791016f, 0.012451172f, 0.087890625f, 0.059814453f, 0.068115234f, 0.1550293f, + 1.1574707f, 0.5593262f, -0.16137695f, -0.44140625f, -0.38305664f, -0.24731445f, -0.0056152344f, 0.10961914f, 0.21948242f, 0.22314453f, -0.0036621094f, -0.20166016f, -0.27416992f, -0.28295898f, -0.21240234f, -0.055419922f, + -0.75561523f, -0.84399414f, -0.079589844f, 0.29614258f, 0.24389648f, 0.3671875f, 0.5605469f, 0.3630371f, 0.26220703f, 0.17895508f, 0.06274414f, -0.052734375f, -0.14526367f, -0.21069336f, -0.1550293f, -0.091796875f, + 0.32055664f, 0.47436523f, 0.56640625f, 0.517334f, 0.42260742f, 0.2890625f, 0.12719727f, -0.23291016f, -0.5283203f, -0.7036133f, -0.6333008f, -0.40454102f, -0.23364258f, -0.1628418f, -0.011962891f, 0.19335938f, + -0.05493164f, 0.5136719f, 0.30395508f, 0.49072266f, 0.3581543f, -0.09301758f, -0.38183594f, -0.4338379f, -0.57299805f, -0.4794922f, -0.17651367f, 0.42651367f, 0.56103516f, 0.28149414f, -0.22875977f, -0.51416016f, + 0.2709961f, -0.26635742f, -0.44995117f, -0.079589844f, 0.21728516f, 0.43017578f, 0.4206543f, 0.47827148f, 0.58691406f, 0.27612305f, -0.26391602f, -0.65771484f, -0.67944336f, -0.3935547f, -0.11791992f, 0.2277832f, + -0.80078125f, 0.18066406f, 0.12036133f, -0.39575195f, -0.60009766f, -0.13134766f, 0.77685547f, 0.5834961f, 0.4248047f, 0.15820312f, 0.08520508f, -0.060058594f, -0.1652832f, -0.17700195f, -0.0234375f, 0.023925781f, + 0.28100586f, 0.4013672f, 0.5695801f, 0.1394043f, -0.20532227f, -0.18286133f, 0.40698242f, 0.703125f, 0.54907227f, 0.09301758f, -0.47631836f, -0.62597656f, -0.4975586f, -0.39160156f, -0.41259766f, -0.3515625f, + 0.3227539f, -1.0678711f, -1.1435547f, 0.068603516f, 0.7546387f, 0.38745117f, 0.09008789f, -0.0007324219f, -0.12792969f, 0.076416016f, 0.24853516f, 0.28735352f, 0.076660156f, -0.041748047f, -0.01977539f, 0.08911133f, + 0.6101074f, -0.22070312f, -0.5324707f, -0.119384766f, 0.10473633f, 0.16333008f, -0.15112305f, -0.34472656f, -0.39746094f, -0.43652344f, -0.23876953f, 0.0017089844f, 0.056152344f, 0.22973633f, 0.50024414f, 0.7751465f, +}; +const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = { + -0.12109375f, -0.32348633f, -0.25976562f, 0.21435547f, 0.4814453f, 0.14819336f, -0.22363281f, -0.31030273f, -0.13256836f, 0.10107422f, 0.33276367f, 0.32495117f, 0.16577148f, -0.079833984f, -0.16210938f, -0.15527344f, + 0.088378906f, -0.0146484375f, -0.13378906f, -0.29003906f, 0.873291f, -0.3125f, -0.19384766f, 0.19311523f, -0.09863281f, 0.052734375f, -0.13110352f, -0.021972656f, -0.07861328f, -0.01977539f, -0.07373047f, 0.1616211f, + -0.115722656f, 0.28100586f, 0.2697754f, -0.10522461f, -0.107910156f, -0.2866211f, -0.36694336f, -0.33862305f, -0.15844727f, 0.01928711f, 0.17382812f, 0.21118164f, 0.2697754f, 0.17260742f, 0.07299805f, 0.009033203f, + 0.08154297f, 0.037841797f, -0.25878906f, -0.30444336f, -0.064208984f, 0.1303711f, 0.36669922f, 0.39916992f, 0.3400879f, 0.14331055f, -0.01171875f, -0.12060547f, -0.17041016f, -0.23071289f, -0.20825195f, -0.13012695f, + -0.024902344f, -0.6298828f, 0.7861328f, -0.010986328f, -0.12695312f, -0.08618164f, 0.022705078f, 0.049316406f, 0.004638672f, -0.13647461f, -0.09863281f, 0.0f, 0.06518555f, 0.014404297f, 0.060546875f, 0.111083984f, + -0.39404297f, 0.16821289f, 0.28564453f, -0.08666992f, -0.16088867f, 0.052246094f, 0.26000977f, 0.057128906f, -0.050048828f, -0.07836914f, 0.016601562f, 0.05883789f, 0.07373047f, -0.03955078f, -0.08520508f, -0.07763672f, + 0.011962891f, -0.114990234f, -0.10229492f, -0.07080078f, 0.009765625f, -0.03125f, -0.15600586f, -0.014892578f, 0.10546875f, -0.040283203f, -0.48095703f, -0.2783203f, 0.5905762f, 0.66137695f, 0.13842773f, -0.22802734f, + 0.48706055f, 0.18286133f, -0.20678711f, -0.17651367f, -0.19750977f, -0.3178711f, -0.2524414f, 0.0087890625f, 0.2866211f, 0.25708008f, 0.18969727f, 0.11694336f, 0.049316406f, -0.05517578f, -0.17700195f, -0.19482422f, + 0.122802734f, -0.09667969f, 0.05444336f, 0.17358398f, 0.22924805f, 0.35229492f, 0.40307617f, 0.031982422f, -0.16064453f, -0.14819336f, -0.103027344f, -0.088134766f, -0.13623047f, -0.23510742f, -0.2434082f, -0.15600586f, + -0.5810547f, -0.0146484375f, -0.43432617f, -0.07397461f, 0.30444336f, 0.36035156f, 0.19213867f, 0.12890625f, 0.13061523f, 0.031982422f, -0.024902344f, -0.059326172f, -0.048583984f, -0.030517578f, 0.03149414f, 0.087646484f, + -0.1171875f, 0.016357422f, 0.15234375f, 0.38916016f, 0.2783203f, -0.007080078f, -0.07373047f, -0.2055664f, -0.30004883f, -0.35839844f, -0.23388672f, -0.033935547f, 0.08520508f, 0.10913086f, 0.125f, 0.17480469f, + -0.107666016f, 0.06274414f, -0.0048828125f, 0.12792969f, -0.023925781f, -0.2199707f, -0.084228516f, 0.34399414f, 0.22753906f, -0.39697266f, -0.32421875f, 0.48779297f, 0.43554688f, -0.15429688f, -0.22436523f, -0.14550781f, + 0.0031738281f, -0.03955078f, 0.06738281f, -0.017822266f, -0.2644043f, 0.30493164f, 0.30200195f, -0.32495117f, -0.5007324f, 0.15478516f, 0.60961914f, 0.15527344f, -0.1899414f, -0.14526367f, 0.017822266f, -0.1315918f, + 0.036621094f, -0.11669922f, -0.33691406f, -0.5373535f, -0.13598633f, 0.3046875f, 0.3215332f, -0.10620117f, -0.1640625f, -0.08569336f, 0.012451172f, 0.10839844f, 0.20117188f, 0.17553711f, 0.15258789f, 0.16967773f, + -0.4362793f, -0.47265625f, -0.16870117f, -0.111083984f, -0.1772461f, -0.1430664f, 0.015136719f, 0.12719727f, 0.13647461f, 0.12988281f, 0.19238281f, 0.22827148f, 0.23266602f, 0.17504883f, 0.14453125f, 0.12768555f, + -0.07495117f, 0.19604492f, 0.13110352f, -0.10131836f, -0.0078125f, -0.18847656f, -0.048828125f, 0.33862305f, 0.2578125f, -0.17089844f, -0.40698242f, -0.28857422f, -0.048339844f, 0.048828125f, 0.14916992f, 0.21459961f, + -0.27734375f, -0.072509766f, 0.26049805f, 0.39038086f, 0.2277832f, 0.020751953f, -0.12109375f, -0.080322266f, 0.171875f, 0.36743164f, 0.107421875f, -0.19311523f, -0.22607422f, -0.20654297f, -0.19799805f, -0.17041016f, + 0.1352539f, 0.40039062f, -0.15649414f, -0.25341797f, 0.31054688f, 0.5410156f, -0.32958984f, -0.42871094f, 0.14794922f, 0.17333984f, -0.17871094f, -0.23730469f, -0.026611328f, -0.013427734f, -0.046142578f, -0.037841797f, + -0.30395508f, 0.12841797f, 0.20825195f, -0.119628906f, -0.3317871f, -0.3190918f, -0.11206055f, 0.10205078f, 0.32470703f, 0.36254883f, 0.2626953f, 0.016113281f, -0.12890625f, -0.16479492f, -0.005126953f, 0.080566406f, + 0.34375f, 0.35888672f, 0.4765625f, 0.13623047f, -0.115722656f, -0.053222656f, 0.080566406f, -0.012207031f, -0.022216797f, -0.09863281f, -0.080566406f, -0.13574219f, -0.18383789f, -0.26123047f, -0.2578125f, -0.17504883f, + 0.01171875f, -0.015625f, 0.2680664f, -0.23461914f, -0.35717773f, 0.6381836f, -0.30664062f, 0.08129883f, -0.05493164f, 0.10058594f, -0.026855469f, -0.10180664f, -0.013671875f, -0.06347656f, 0.00048828125f, 0.07446289f, + -0.1015625f, 0.05053711f, 0.092285156f, 0.038330078f, -0.03491211f, 0.16479492f, 0.0859375f, 0.0036621094f, -0.15454102f, -0.09106445f, 0.026367188f, -0.23950195f, -0.43676758f, -0.27783203f, 0.21850586f, 0.6555176f, + -0.16064453f, 0.032958984f, 0.08325195f, 0.052978516f, -0.041748047f, 0.08959961f, 0.16552734f, 0.057373047f, -0.08154297f, 0.21362305f, 0.048583984f, -0.7026367f, -0.27685547f, 0.51000977f, 0.27197266f, -0.26245117f, + 0.62109375f, 0.00390625f, 0.08081055f, 0.16748047f, 0.08276367f, -0.11254883f, -0.20825195f, -0.3076172f, -0.24926758f, -0.15332031f, 0.0007324219f, 0.087646484f, 0.11303711f, 0.022705078f, -0.068847656f, -0.080322266f, + 0.40844727f, -0.390625f, -0.35473633f, 0.21777344f, 0.21972656f, -0.0107421875f, 0.111328125f, 0.21459961f, 0.1430664f, -0.08935547f, -0.19165039f, -0.2368164f, -0.1340332f, -0.034179688f, 0.030761719f, 0.09667969f, + -0.2199707f, 0.8208008f, -0.32104492f, 0.118896484f, -0.006591797f, -0.1328125f, 0.0078125f, -0.013183594f, -0.05493164f, -0.024414062f, 0.06542969f, -0.0014648438f, -0.055664062f, -0.06762695f, -0.07055664f, -0.044677734f, + -0.14770508f, -0.16967773f, -0.1105957f, 0.6333008f, -0.4025879f, -0.3515625f, 0.29736328f, 0.0859375f, 0.024414062f, -0.07128906f, 0.010253906f, 0.0007324219f, -0.021728516f, 0.01977539f, 0.083496094f, 0.12060547f, + -0.06738281f, 0.030517578f, 0.019042969f, 0.16308594f, 0.16796875f, 0.037109375f, 0.059326172f, 0.07397461f, 0.03540039f, 0.05517578f, 0.06982422f, 0.061523438f, 0.1940918f, 0.20605469f, -0.3178711f, -0.7878418f, + 0.1274414f, -0.040771484f, -0.21704102f, -0.025634766f, 0.012451172f, -0.033203125f, -0.15771484f, 0.052001953f, -0.19165039f, -0.26342773f, 0.032226562f, 0.7976074f, -0.4807129f, -0.21582031f, 0.36499023f, 0.2397461f, + 0.46044922f, 0.21435547f, 0.0847168f, -0.24414062f, -0.49902344f, -0.16577148f, 0.30151367f, 0.049560547f, -0.07470703f, -0.21459961f, -0.13256836f, -0.009277344f, 0.06665039f, 0.029052734f, 0.0390625f, 0.095214844f, + 0.17895508f, -0.31396484f, -0.033203125f, -0.02734375f, -0.0637207f, -0.11791992f, -0.03466797f, 0.0061035156f, 0.07324219f, 0.072753906f, 0.14916992f, 0.13671875f, 0.12524414f, 0.017333984f, -0.08178711f, -0.08618164f, + 0.13330078f, -0.15893555f, -0.22045898f, -0.032226562f, -0.07739258f, -0.25463867f, -0.32299805f, -0.2614746f, 0.039794922f, 0.18554688f, 0.1262207f, -0.04321289f, -0.010498047f, 0.13330078f, 0.31860352f, 0.44506836f, +}; +const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = { + -0.0056152344f, -0.03955078f, 0.071777344f, 0.26879883f, 0.44140625f, -0.08203125f, -0.20092773f, -0.009277344f, 0.05810547f, -0.06347656f, -0.07910156f, -0.05126953f, -0.07006836f, -0.068847656f, -0.07885742f, -0.09082031f, + -0.011962891f, -0.060302734f, 0.011962891f, 0.049804688f, -0.044677734f, 0.037841797f, 0.099121094f, 0.06274414f, 0.022216797f, -0.09057617f, 0.00390625f, 0.38452148f, 0.1027832f, -0.5292969f, -0.3269043f, 0.28881836f, + -0.3557129f, 0.3815918f, 0.10839844f, 0.08203125f, 0.03149414f, -0.0024414062f, -0.0036621094f, -0.02758789f, -0.03125f, -0.096191406f, -0.09326172f, -0.103515625f, -0.07006836f, 0.008056641f, 0.06616211f, 0.10644531f, + 0.038330078f, 0.022460938f, -0.22070312f, 0.529541f, -0.3540039f, 0.29907227f, -0.16235352f, -0.03955078f, 0.053222656f, -0.07348633f, -0.051513672f, 0.021484375f, 0.04638672f, 0.029541016f, -0.052001953f, -0.08618164f, + 0.075927734f, -0.19604492f, 0.046875f, -0.00048828125f, -0.052978516f, -0.03491211f, 0.19067383f, 0.08520508f, -0.16113281f, -0.29785156f, -0.22558594f, -0.07006836f, 0.053955078f, 0.1550293f, 0.19042969f, 0.2409668f, + 0.08227539f, 0.26464844f, -0.15332031f, -0.140625f, -0.0068359375f, 0.060302734f, -0.05126953f, -0.23339844f, -0.28442383f, -0.14160156f, 0.0793457f, 0.23828125f, 0.20678711f, 0.09716797f, 0.014892578f, -0.032470703f, + 0.20581055f, -0.19702148f, 0.053466797f, 0.026855469f, -0.011962891f, -0.04663086f, -0.11254883f, 0.060058594f, 0.33984375f, 0.33447266f, -0.14257812f, -0.37719727f, -0.21850586f, 0.016845703f, 0.08325195f, -0.013916016f, + 0.34375f, -0.38623047f, -0.06542969f, -0.07348633f, -0.107421875f, 0.037353516f, 0.14477539f, 0.01586914f, 0.0026855469f, 0.08959961f, 0.19433594f, 0.1027832f, -0.03149414f, -0.060058594f, -0.1003418f, -0.10668945f, + 0.12841797f, 0.01953125f, 0.16333008f, 0.22827148f, -0.16015625f, -0.42016602f, -0.19067383f, 0.08642578f, 0.08520508f, -0.022705078f, 0.011230469f, 0.013671875f, -0.0034179688f, 0.019042969f, -0.005859375f, 0.047851562f, + 0.02734375f, 0.008056641f, -0.07470703f, 0.114990234f, 0.0021972656f, -0.41796875f, 0.5605469f, -0.28735352f, 0.022949219f, -0.07739258f, -0.028808594f, 0.1928711f, 0.056152344f, 0.0053710938f, -0.048583984f, -0.055419922f, + -0.037109375f, 0.12939453f, -0.38671875f, -0.095214844f, 0.0021972656f, -0.012451172f, 0.19677734f, 0.2578125f, 0.12670898f, -0.10180664f, -0.087890625f, 0.009521484f, 0.1418457f, 0.14526367f, -0.076660156f, -0.21166992f, + 0.29711914f, 0.06616211f, -0.375f, -0.080566406f, 0.1484375f, -0.0007324219f, -0.020996094f, 0.013427734f, -0.014160156f, -0.11279297f, -0.08081055f, -0.056152344f, -0.13769531f, -0.060546875f, 0.10595703f, 0.30810547f, + -0.025146484f, 0.023925781f, -0.02758789f, -0.0009765625f, 0.08178711f, -0.13452148f, -0.022949219f, 0.6875f, -0.39794922f, -0.123046875f, 0.06738281f, 0.04345703f, -0.053955078f, -0.0146484375f, -0.045410156f, -0.05810547f, + 0.0146484375f, 0.041748047f, -0.024902344f, 0.005126953f, -0.079589844f, -0.04638672f, -0.028320312f, 0.021972656f, -0.11450195f, -0.118896484f, -0.041748047f, -0.001953125f, -0.2783203f, 0.33154297f, 0.64575195f, -0.32543945f, + -0.13989258f, -0.020019531f, 0.3137207f, -0.53271484f, 0.3154297f, 0.037353516f, -0.04272461f, -0.059326172f, -0.05444336f, -0.009765625f, -0.0073242188f, 0.015380859f, 0.0769043f, 0.08251953f, 0.01171875f, 0.013427734f, + -0.049804688f, 0.022949219f, -0.08227539f, -0.08544922f, 0.012451172f, 0.015380859f, -0.2241211f, 0.15625f, -0.19750977f, 0.5703125f, -0.3684082f, 0.072753906f, 0.4711914f, -0.35888672f, 0.14697266f, -0.10205078f, + -0.17138672f, -0.19067383f, -0.21411133f, -0.030517578f, 0.09667969f, -0.087402344f, -0.09643555f, 0.017089844f, 0.08666992f, 0.041503906f, 0.05908203f, 0.034179688f, 0.08129883f, 0.12841797f, 0.12011719f, 0.12548828f, + -0.044921875f, 0.0061035156f, 0.037841797f, 0.017089844f, 0.064453125f, 0.008300781f, -0.20532227f, -0.025146484f, 0.07397461f, 0.06225586f, -0.15991211f, -0.27612305f, 0.44873047f, 0.14111328f, -0.40893555f, 0.26049805f, + -0.14941406f, 0.17773438f, 0.022949219f, -0.125f, 0.00048828125f, 0.19018555f, 0.03857422f, -0.039794922f, 0.09448242f, 0.20214844f, 0.22436523f, 0.111572266f, -0.08081055f, -0.16992188f, -0.25146484f, -0.24633789f, + -0.09350586f, 0.028076172f, -0.04272461f, 0.05419922f, 0.01586914f, -0.16870117f, -0.30395508f, -0.17285156f, 0.0690918f, 0.30541992f, 0.23266602f, -0.09082031f, 0.1340332f, 0.3449707f, 0.036621094f, -0.3486328f, + -0.20019531f, -0.10449219f, 0.041992188f, 0.09350586f, 0.010253906f, 0.04711914f, 0.26342773f, 0.23852539f, 0.13598633f, -0.04296875f, -0.063964844f, -0.13769531f, -0.18164062f, -0.10083008f, -0.033691406f, 0.03491211f, + 0.14648438f, 0.02758789f, 0.33984375f, -0.005126953f, -0.09887695f, 0.04272461f, -0.18652344f, -0.33129883f, -0.14208984f, 0.040039062f, 0.036376953f, -0.072509766f, -0.119628906f, -0.0017089844f, 0.09448242f, 0.23046875f, + 0.23852539f, 0.26513672f, 0.034179688f, 0.04272461f, 0.05053711f, 0.03466797f, 0.12182617f, 0.03930664f, -0.018066406f, -0.095947266f, -0.107666016f, -0.16040039f, -0.17211914f, -0.12524414f, -0.09716797f, -0.05078125f, + -0.08178711f, -0.05126953f, -0.20507812f, 0.115478516f, 0.14453125f, -0.010986328f, -0.16357422f, -0.05102539f, 0.037597656f, 0.24365234f, 0.38452148f, 0.05444336f, -0.40283203f, -0.21972656f, 0.0793457f, 0.12695312f, + -0.2548828f, -0.28222656f, 0.19628906f, 0.2890625f, 0.047851562f, -0.034179688f, 0.012451172f, -0.1159668f, -0.20947266f, -0.08154297f, 0.13427734f, 0.16333008f, 0.07885742f, 0.05078125f, 0.013427734f, -0.0078125f, + -0.067871094f, 0.02368164f, -0.010986328f, -0.037109375f, -0.19140625f, 0.118896484f, -0.020019531f, -0.3955078f, 0.5673828f, -0.02758789f, -0.23950195f, 0.103759766f, -0.04736328f, 0.029785156f, 0.07495117f, 0.118896484f, + 0.095214844f, -0.0078125f, 0.36035156f, -0.075927734f, -0.20385742f, 0.0625f, 0.15332031f, 0.044921875f, 0.0041503906f, -0.13793945f, -0.1472168f, 0.015136719f, 0.17504883f, 0.1105957f, -0.14648438f, -0.30151367f, + 0.063964844f, -0.0234375f, 0.07739258f, -0.24169922f, 0.041015625f, 0.18823242f, -0.43701172f, 0.25976562f, 0.25097656f, -0.37182617f, 0.040771484f, 0.2590332f, 0.0036621094f, -0.044677734f, -0.03173828f, -0.03466797f, + 0.025390625f, 0.09301758f, 0.11328125f, -0.027832031f, -0.0087890625f, -0.0703125f, 0.028320312f, -0.052734375f, -0.1953125f, -0.32617188f, 0.67871094f, -0.07397461f, -0.15039062f, -0.0703125f, -0.02758789f, 0.064697266f, + -0.049560547f, 0.15551758f, -0.016113281f, -0.27661133f, -0.30371094f, -0.13427734f, 0.08203125f, 0.09814453f, 0.07495117f, 0.038330078f, 0.055664062f, -0.00390625f, -0.018554688f, 0.0390625f, 0.10620117f, 0.15283203f, + -0.04321289f, -0.18408203f, -0.045654297f, -0.05029297f, 0.21191406f, 0.5300293f, 0.09716797f, -0.12866211f, -0.09423828f, -0.08666992f, -0.087890625f, -0.09643555f, -0.045166016f, 0.021972656f, -0.013183594f, 0.014160156f, + -0.0017089844f, -0.014160156f, -0.048339844f, -0.037109375f, -0.0949707f, -0.005859375f, 0.48388672f, -0.17480469f, -0.19140625f, 0.5727539f, -0.18920898f, -0.26391602f, 0.0048828125f, 0.067871094f, -0.045654297f, -0.06201172f, +}; + +const float *const ivas_sns_cdbks_tcx20[SNS_MSVQ_NSTAGES_TCX20] = { ivas_sns_cdbk_tcx20_stage1, ivas_sns_cdbk_tcx20_stage2, ivas_sns_cdbk_tcx20_stage3, ivas_sns_cdbk_tcx20_stage4 }; + +const int16_t ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 }; +const int16_t ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 }; + +const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = { + 1.0144043f, 1.1826172f, 0.3269043f, -0.6411133f, -1.2163086f, -1.1411133f, -1.1525879f, -0.8898926f, -0.19604492f, 0.7402344f, 1.1782227f, 1.0830078f, 0.78222656f, 0.26953125f, -0.33203125f, -1.0080566f, + -0.38916016f, -0.31347656f, -1.1826172f, -2.036621f, -2.086914f, -1.8569336f, -1.637207f, -1.3156738f, -0.4182129f, 0.50634766f, 1.2770996f, 1.3771973f, 1.8566895f, 2.3503418f, 2.3015137f, 1.5678711f, + 0.43652344f, 1.8859863f, 2.8059082f, 2.2385254f, 1.5480957f, 0.14331055f, 0.07299805f, -1.1218262f, -1.1103516f, -0.7336426f, -0.4194336f, -0.89624023f, -1.0429688f, -0.79785156f, -1.204834f, -1.8046875f, + 1.5612793f, 0.9321289f, 0.58740234f, 0.46313477f, 0.21899414f, 0.0625f, -0.16918945f, -0.34423828f, -0.44726562f, -0.61035156f, -0.6398926f, -0.57177734f, -0.38500977f, -0.25927734f, -0.20898438f, -0.18945312f, + 1.0131836f, 1.9333496f, 0.8395996f, -0.4963379f, -0.66015625f, -0.38012695f, 0.056396484f, 0.31201172f, 0.810791f, 0.66674805f, -0.022705078f, -0.7980957f, -0.9230957f, -0.63134766f, -0.68530273f, -1.034668f, + -0.842041f, -0.08642578f, 0.49243164f, 0.5827637f, 1.1630859f, 1.3693848f, 0.7233887f, 0.2705078f, 0.34692383f, 0.0068359375f, -0.2319336f, -0.33032227f, -0.5895996f, -0.67626953f, -0.9953613f, -1.2033691f, + 2.0810547f, 1.8205566f, 1.1000977f, 0.47216797f, 0.08251953f, -0.48510742f, -0.67285156f, -0.55322266f, -0.4777832f, -0.546875f, -0.579834f, -0.5891113f, -0.5119629f, -0.4255371f, -0.32910156f, -0.38500977f, + 1.730957f, 1.3063965f, 0.53466797f, 0.23144531f, 0.04248047f, 0.0036621094f, 0.0949707f, 0.15942383f, 0.1977539f, 0.19946289f, 0.21899414f, 0.064697266f, -0.43408203f, -0.94750977f, -1.5297852f, -1.8735352f, + 1.6611328f, 2.8601074f, 1.7668457f, -0.12988281f, -0.27978516f, 1.199707f, 1.4865723f, 1.220459f, 0.61865234f, -1.2509766f, -1.5700684f, -1.3425293f, -1.3532715f, -1.3083496f, -1.5671387f, -2.0112305f, + 1.8820801f, 0.6086426f, -0.52319336f, -1.5842285f, -1.2685547f, -0.9067383f, -0.6323242f, -0.203125f, -0.25878906f, 0.091796875f, 0.18286133f, 1.2060547f, 1.0129395f, -0.049560547f, -0.1274414f, 0.5698242f, + 0.60498047f, 1.1367188f, 1.5297852f, 1.9936523f, 1.9726562f, 1.9311523f, 1.7668457f, 1.3752441f, 0.939209f, 0.020019531f, -0.72558594f, -1.3706055f, -2.269043f, -2.7990723f, -3.010254f, -3.0957031f, + -0.9187012f, 0.107177734f, 0.32495117f, -0.051513672f, -0.2746582f, 0.2043457f, 0.8605957f, 0.30737305f, 0.064208984f, -0.1743164f, -0.5998535f, -0.7624512f, -0.10864258f, 0.49975586f, 0.40283203f, 0.118896484f, + 1.0822754f, 0.7507324f, 0.47460938f, 0.00390625f, -0.28881836f, -0.5131836f, -0.62158203f, -0.6550293f, -0.59228516f, -0.42895508f, -0.17675781f, 0.061035156f, 0.119140625f, 0.037109375f, 0.24267578f, 0.5046387f, + -2.3117676f, -1.2453613f, -0.7062988f, -0.83813477f, -0.5036621f, 0.040039062f, 0.6281738f, 0.93115234f, 0.826416f, 0.3791504f, 0.19970703f, -0.023925781f, 0.35913086f, 0.953125f, 0.87280273f, 0.43969727f, + 3.8930664f, 4.2009277f, 3.1296387f, 2.685791f, 2.1108398f, 2.032959f, 0.046142578f, -1.3862305f, -1.6176758f, -1.9997559f, -2.130371f, -2.1767578f, -2.213623f, -2.2236328f, -2.1501465f, -2.201416f, + -1.3452148f, -0.43041992f, 0.38720703f, 1.0549316f, 1.4541016f, 1.6882324f, 1.3688965f, 0.44335938f, -0.037109375f, -0.23144531f, -0.5349121f, -0.7902832f, -0.81152344f, -0.73876953f, -0.6965332f, -0.78027344f, + 2.1210938f, 2.654541f, 2.0202637f, 1.1313477f, 0.42333984f, -0.13598633f, -0.31591797f, -0.38500977f, -0.37548828f, -0.7619629f, -0.9873047f, -1.046875f, -0.9699707f, -0.99975586f, -1.0686035f, -1.3034668f, + 2.0297852f, 0.09301758f, -1.026123f, -1.6860352f, -0.5925293f, 0.7067871f, 1.1433105f, -0.31152344f, -0.8725586f, -0.37524414f, 0.09326172f, -0.4165039f, -0.375f, -0.32592773f, 0.65185547f, 1.2634277f, + 0.49169922f, 1.6848145f, 1.8188477f, 2.048584f, 1.3818359f, 1.3059082f, 0.8100586f, 0.15429688f, -0.40161133f, -1.7539062f, -2.8208008f, -1.5043945f, -0.54663086f, -0.9963379f, -0.7890625f, -0.8833008f, + 0.60131836f, 1.9431152f, 1.1845703f, -0.50927734f, -0.51708984f, 0.7182617f, 0.6542969f, 0.06665039f, -0.48120117f, -0.9313965f, -1.0275879f, -0.9108887f, -0.48168945f, 0.055664062f, 0.17333984f, -0.5378418f, + 0.5378418f, 0.47216797f, 0.17480469f, -0.3022461f, -0.19726562f, -0.030517578f, -0.008544922f, 0.009277344f, -0.033935547f, -0.022705078f, 0.20629883f, 0.45239258f, 0.18237305f, -0.14233398f, -0.50561523f, -0.7922363f, + -2.0576172f, -2.215088f, -1.0456543f, -0.07910156f, 1.4833984f, 1.3276367f, -0.119140625f, -0.638916f, -0.06713867f, 0.8666992f, -0.25634766f, -0.041503906f, 1.1413574f, 1.0339355f, 0.5041504f, 0.16333008f, + 2.7668457f, 2.9187012f, 1.6850586f, 0.47216797f, -0.3696289f, -0.70288086f, -0.7890625f, -1.034668f, -0.8354492f, -0.69262695f, -0.6418457f, -0.70751953f, -0.6467285f, -0.49682617f, -0.49023438f, -0.43530273f, + 0.104003906f, 0.9812012f, 1.1506348f, 0.9128418f, 0.81933594f, 0.8522949f, 0.7446289f, 0.46069336f, 0.31347656f, -0.06542969f, -0.49536133f, -0.85302734f, -1.0515137f, -1.0839844f, -1.2729492f, -1.5166016f, + 0.5107422f, 1.4162598f, 2.0109863f, 2.331787f, 1.6552734f, 0.8979492f, 0.6035156f, 0.2487793f, 0.26049805f, -0.26416016f, -0.7624512f, -1.2497559f, -1.8212891f, -1.807373f, -1.8876953f, -2.1430664f, + 0.23461914f, 0.3942871f, -0.2163086f, -1.0683594f, -1.3544922f, -1.2963867f, -1.2163086f, -1.192627f, -0.8947754f, -0.36083984f, 0.29248047f, 0.6989746f, 1.1608887f, 1.6723633f, 1.8217773f, 1.324707f, + 3.0012207f, 3.3725586f, 2.8825684f, 2.7036133f, 2.4111328f, 2.5178223f, 1.418457f, 0.048583984f, -0.7297363f, -1.8293457f, -2.4519043f, -2.5717773f, -2.6826172f, -2.7434082f, -2.6733398f, -2.673584f, + 0.061035156f, 0.7324219f, 1.2775879f, 0.8625488f, 0.2524414f, 0.092285156f, -0.13500977f, -0.41674805f, -0.52075195f, -0.7026367f, -0.69262695f, -0.5744629f, -0.4494629f, -0.08886719f, 0.17211914f, 0.1303711f, + 2.1413574f, 1.7810059f, 0.7092285f, -0.37304688f, -0.6828613f, -0.54296875f, -0.5942383f, -0.9050293f, -0.97558594f, -0.8232422f, -0.6015625f, -0.57128906f, 0.021484375f, 0.59887695f, 0.5192871f, 0.29882812f, + -1.3076172f, -0.99609375f, -0.7758789f, -0.83374023f, -0.8322754f, -0.72924805f, -0.5461426f, -0.1652832f, 0.4482422f, 1.0227051f, 1.440918f, 1.338623f, 0.89331055f, 0.6164551f, 0.42700195f, -0.0009765625f, + 2.084961f, 3.2036133f, 2.5375977f, 0.7463379f, 0.24682617f, 0.7133789f, 0.46118164f, -0.16430664f, -0.31347656f, -1.1755371f, -1.5986328f, -1.6252441f, -1.3684082f, -1.1738281f, -1.1335449f, -1.440918f, + -0.22070312f, 0.74121094f, 0.9091797f, 0.25f, 0.15161133f, 0.5371094f, 0.74902344f, 1.0612793f, 1.1540527f, 0.22924805f, -0.74438477f, -1.1445312f, -1.0881348f, -0.7956543f, -0.7746582f, -1.0144043f, + 1.8095703f, 2.084961f, 0.859375f, -0.22167969f, -0.49951172f, -0.58496094f, -0.548584f, -0.35595703f, -0.23828125f, 0.018066406f, -0.119384766f, 0.16845703f, 0.03491211f, -0.8540039f, -1.0222168f, -0.53027344f, + -2.2055664f, -2.6103516f, -2.4230957f, -2.2021484f, -0.9482422f, 1.682373f, 2.345459f, 2.1347656f, 1.9140625f, 1.019043f, 0.6623535f, 0.62719727f, 0.85546875f, 0.8095703f, -0.23144531f, -1.4296875f, + 3.0585938f, 3.8530273f, 2.633789f, 0.8532715f, -0.09008789f, -0.52685547f, -0.60375977f, -0.7915039f, -0.861084f, -1.2512207f, -1.3881836f, -1.3081055f, -1.1264648f, -0.88378906f, -0.6906738f, -0.8774414f, + 0.91845703f, 1.7211914f, 0.89575195f, -0.07543945f, -0.3798828f, -0.49023438f, -0.5810547f, -0.57666016f, -0.4921875f, -0.36206055f, -0.23706055f, -0.22924805f, -0.15600586f, 0.03100586f, 0.0703125f, -0.057128906f, + 1.3344727f, 1.2441406f, 0.20483398f, -1.0561523f, -1.0715332f, -0.12084961f, 0.96728516f, 1.5930176f, 1.1330566f, 0.115722656f, -0.45532227f, -0.44140625f, -0.5053711f, -0.8222656f, -0.96972656f, -1.1499023f, + -1.8754883f, -2.5437012f, -2.1186523f, 0.6845703f, 1.7653809f, 3.8078613f, 1.5759277f, -0.59228516f, -0.22167969f, 0.5510254f, 1.770752f, 1.2670898f, -0.85180664f, -1.3605957f, -1.5881348f, -0.27026367f, + 2.5178223f, 2.0725098f, 1.2094727f, 0.30126953f, -0.29370117f, -0.095947266f, 0.45141602f, 0.4663086f, 0.22338867f, -0.5546875f, -1.3134766f, -1.3378906f, -0.842041f, -0.87231445f, -1.0029297f, -0.92944336f, + 2.199707f, 1.7602539f, 1.2255859f, 0.74243164f, 0.45288086f, 0.3161621f, 0.076660156f, -0.23266602f, -0.5065918f, -0.6386719f, -0.6906738f, -0.6977539f, -0.798584f, -0.9692383f, -1.0688477f, -1.1706543f, + 0.3564453f, 1.670166f, 2.1064453f, 0.765625f, 0.767334f, 1.4802246f, 1.4580078f, 0.8364258f, 0.5427246f, -1.2788086f, -1.7922363f, -1.552002f, -1.4414062f, -0.9494629f, -1.151123f, -1.8183594f, + 0.35375977f, -0.44604492f, -1.1108398f, -1.5837402f, -1.3947754f, -0.6669922f, -0.16113281f, 0.10571289f, 0.3190918f, 0.5788574f, 0.6821289f, 0.7907715f, 0.7709961f, 0.59375f, 0.5800781f, 0.58813477f, + 1.2800293f, 2.3510742f, 2.9519043f, 2.9152832f, 2.5854492f, 1.7675781f, 1.0688477f, 0.4387207f, -0.19555664f, -1.513916f, -2.340332f, -2.5202637f, -2.3115234f, -2.1765137f, -2.1308594f, -2.1696777f, + -1.6928711f, -0.26049805f, 0.19189453f, -0.04711914f, 0.061279297f, 0.15258789f, 0.17089844f, 0.10205078f, 0.08691406f, 0.076660156f, 0.039794922f, 0.025878906f, 0.0014648438f, 0.265625f, 0.46240234f, 0.3630371f, + 1.4794922f, 0.9511719f, 0.1184082f, -0.7175293f, -1.15625f, -0.8388672f, 0.068847656f, 0.49609375f, 0.45629883f, -0.12768555f, -0.79907227f, -0.7434082f, -0.20336914f, -0.00390625f, 0.27514648f, 0.74438477f, + -1.628418f, -0.46142578f, 0.087402344f, -0.056152344f, 0.10913086f, 0.58813477f, 0.9543457f, 1.532959f, 1.3303223f, 0.35180664f, -0.21435547f, -0.49267578f, -0.5546875f, -0.34765625f, -0.4658203f, -0.7324219f, + 2.887207f, 4.0615234f, 3.1860352f, 1.532959f, 0.4165039f, 0.19067383f, 0.57055664f, -0.7878418f, -1.2619629f, -1.8005371f, -1.6381836f, -1.4213867f, -1.5876465f, -1.5568848f, -1.2424316f, -1.548584f, + 0.1184082f, 0.16186523f, 0.17089844f, 0.52856445f, 0.48364258f, 0.23583984f, 0.091796875f, 0.4477539f, 0.56103516f, 0.3972168f, 0.27197266f, 0.17138672f, -0.1850586f, -0.74194336f, -1.204834f, -1.5085449f, + 3.7294922f, 2.5002441f, 1.5256348f, 0.701416f, 0.19116211f, 0.07861328f, 0.24267578f, 0.4243164f, 0.23217773f, -0.4404297f, -1.0891113f, -1.3295898f, -1.3798828f, -1.6437988f, -1.8586426f, -1.8840332f, + -1.0793457f, -0.54956055f, -0.53271484f, -0.8959961f, -0.7878418f, -0.50390625f, -0.45898438f, -0.45410156f, -0.14868164f, 0.07495117f, 0.30126953f, 0.5197754f, 0.8623047f, 1.3652344f, 1.3466797f, 0.9406738f, + 0.8203125f, 1.934082f, 2.6530762f, 2.293457f, 1.5932617f, 0.25708008f, 0.46289062f, 0.7038574f, 0.39990234f, -1.3444824f, -1.871582f, -1.7602539f, -1.8720703f, -1.1584473f, -1.3552246f, -1.7556152f, + 0.6022949f, 1.5651855f, 2.024414f, 1.043457f, 0.5551758f, 0.29516602f, -0.059326172f, -0.29589844f, -0.28930664f, -0.6899414f, -0.87158203f, -0.8222656f, -0.8574219f, -0.74438477f, -0.65722656f, -0.7980957f, + 0.7392578f, 1.7915039f, 1.7841797f, 1.0437012f, 0.2434082f, -0.5f, -0.76123047f, -0.9995117f, -0.77856445f, -0.61450195f, -0.4025879f, -0.36132812f, -0.16894531f, 0.123046875f, -0.3190918f, -0.8190918f, + -3.3479004f, -2.8823242f, -1.7409668f, -0.01928711f, 1.5759277f, 1.565918f, -0.14379883f, -1.1428223f, -0.46923828f, 1.5456543f, 0.080566406f, 0.15551758f, 1.5246582f, 1.2470703f, 1.1359863f, 0.9152832f, + 3.6564941f, 2.3999023f, 1.4855957f, 0.71728516f, 0.45483398f, 0.25854492f, -0.13500977f, -0.5534668f, -0.7763672f, -1.0727539f, -1.2416992f, -1.2087402f, -1.0163574f, -1.0344238f, -0.97924805f, -0.9543457f, + -0.26391602f, 0.7937012f, 1.5644531f, 1.7453613f, 1.2094727f, 1.2302246f, 1.0932617f, 1.0627441f, 1.1040039f, 0.16601562f, -1.6494141f, -2.2905273f, -1.9121094f, -1.423584f, -0.94140625f, -1.487793f, + 1.7485352f, 1.9509277f, 1.1413574f, 0.23828125f, 0.20532227f, 0.71972656f, 1.0627441f, 0.84375f, 0.6599121f, 0.11010742f, -0.41723633f, -1.0415039f, -1.4494629f, -1.7270508f, -1.9189453f, -2.126709f, + 1.7670898f, -0.14770508f, -0.9782715f, 0.0007324219f, 2.0344238f, 0.28637695f, -0.53125f, -1.2973633f, -1.4816895f, -1.2402344f, -1.1208496f, -1.1516113f, -0.68237305f, -0.05883789f, 1.3154297f, 3.286377f, + 2.586914f, 3.0708008f, 3.369629f, 2.663086f, 1.8154297f, 0.54467773f, 0.5966797f, 0.45703125f, -0.5554199f, -1.7521973f, -2.234375f, -2.2390137f, -2.147461f, -2.0239258f, -2.0800781f, -2.0722656f, + -0.17993164f, 0.5961914f, 0.1184082f, -0.6855469f, -0.8725586f, -0.7883301f, -0.72094727f, -0.5744629f, -0.20922852f, 0.171875f, 0.41430664f, 0.54711914f, 0.49438477f, 0.564209f, 0.64819336f, 0.4765625f, + 2.9692383f, 1.6333008f, 0.5463867f, -0.6401367f, -1.1271973f, -1.4199219f, -1.4353027f, -1.2783203f, -1.0517578f, -0.7229004f, -0.4267578f, -0.39233398f, 0.44873047f, 0.67211914f, 0.89453125f, 1.3300781f, + -0.7512207f, 0.11035156f, 0.47998047f, -0.0949707f, -0.30981445f, 0.028808594f, 0.04272461f, 0.25756836f, 0.88378906f, 1.1179199f, 0.33569336f, -0.30126953f, -0.36132812f, -0.29223633f, -0.4194336f, -0.7260742f, + 3.871582f, 3.6723633f, 2.5690918f, 1.3596191f, 1.0322266f, 1.0532227f, 0.7524414f, 0.15966797f, -0.42114258f, -1.3811035f, -1.967041f, -2.2060547f, -2.1699219f, -2.125f, -2.0786133f, -2.121582f, + 0.41601562f, 0.4086914f, 0.12915039f, 0.44995117f, 1.0292969f, 1.5f, 1.4731445f, 1.0021973f, 0.53149414f, -0.10473633f, -0.49121094f, -0.6335449f, -1.0283203f, -1.3818359f, -1.5666504f, -1.7338867f, + 1.0354004f, 0.7351074f, -0.04321289f, -0.86328125f, -1.1411133f, -0.89990234f, -0.3876953f, 0.2421875f, 0.7763672f, 0.7036133f, 0.4814453f, 0.25952148f, 0.16503906f, -0.0925293f, -0.35668945f, -0.6142578f, + -2.5014648f, -2.2893066f, -2.4162598f, -2.5559082f, -2.2287598f, -1.3945312f, -0.8725586f, -0.30419922f, 0.30200195f, 1.078125f, 1.8603516f, 1.8320312f, 2.2028809f, 2.7680664f, 2.5114746f, 2.0083008f, + 1.4338379f, 2.6071777f, 2.8693848f, 1.9367676f, 1.357666f, 0.54052734f, 0.0073242188f, -0.39257812f, -0.7956543f, -1.501709f, -1.6374512f, -1.4631348f, -1.3227539f, -1.2058105f, -1.0966797f, -1.3371582f, + 0.41577148f, 0.41992188f, 0.01171875f, -0.041748047f, 0.022460938f, 0.24536133f, 0.36010742f, 0.3203125f, 0.16088867f, -0.055664062f, -0.23950195f, -0.4645996f, -0.37817383f, -0.17480469f, -0.19140625f, -0.4104004f, + 0.1303711f, 1.1894531f, 0.9506836f, -0.5930176f, -1.2092285f, -0.53027344f, 0.7734375f, 0.6401367f, 0.54956055f, 0.3388672f, -0.5241699f, -0.9995117f, -0.2709961f, 0.33789062f, -0.091552734f, -0.69140625f, + -2.5305176f, -1.4348145f, -0.14941406f, 0.8322754f, 1.2192383f, 1.2817383f, 0.94140625f, 0.5319824f, 0.37402344f, 0.31469727f, 0.23120117f, 0.010498047f, -0.21533203f, -0.3239746f, -0.45751953f, -0.6254883f, + 1.7978516f, 2.154541f, 1.6486816f, 0.77490234f, 0.38378906f, 0.24902344f, -0.34985352f, -0.9355469f, -1.130127f, -1.3525391f, -1.317627f, -1.0749512f, -0.7229004f, -0.31201172f, 0.06225586f, 0.12475586f, + 0.8828125f, 0.72802734f, 0.59594727f, 0.3737793f, 0.5258789f, 0.72753906f, 0.43017578f, 0.18725586f, 0.06640625f, -0.23266602f, -0.42578125f, -0.50512695f, -0.5432129f, -0.6281738f, -0.92529297f, -1.2570801f, + 1.46875f, 2.616455f, 2.7822266f, 1.1652832f, 0.45581055f, 1.2355957f, 1.2653809f, 0.935791f, 0.5776367f, -0.87597656f, -2.5498047f, -2.6628418f, -2.2028809f, -1.3466797f, -0.9621582f, -1.9025879f, + 1.5563965f, 0.4855957f, -0.31933594f, -0.8959961f, -1.0634766f, -1.0183105f, -0.9716797f, -0.8378906f, -0.4987793f, -0.14331055f, 0.14428711f, 0.31445312f, 0.6821289f, 0.88623047f, 0.87890625f, 0.8005371f, + 1.9968262f, 2.7993164f, 2.0898438f, 0.9248047f, 0.85009766f, 1.4089355f, 1.6706543f, 1.3681641f, 1.1982422f, 0.33544922f, -0.95288086f, -2.145996f, -2.8188477f, -2.941162f, -2.8947754f, -2.8886719f, + -0.75439453f, 0.16137695f, 0.33740234f, -0.19702148f, 0.5197754f, 1.2861328f, 0.42236328f, -0.20092773f, -0.11743164f, -0.69018555f, -1.1972656f, -0.7453613f, -0.053466797f, 0.39208984f, 0.7512207f, 0.08544922f, + 2.1848145f, 1.0153809f, 0.14331055f, -0.6489258f, -0.71435547f, -0.55566406f, -0.40966797f, -0.25634766f, -0.08081055f, -0.01586914f, -0.0053710938f, -0.09667969f, -0.12231445f, -0.03466797f, -0.11303711f, -0.2902832f, + -1.2324219f, -0.42993164f, -0.30273438f, -0.8486328f, -0.9147949f, -0.7001953f, 0.03955078f, 0.7734375f, 0.99438477f, 0.46484375f, 0.13891602f, 0.11425781f, 0.41381836f, 0.7363281f, 0.6113281f, 0.14208984f, + 3.2854004f, 4.0998535f, 3.8623047f, 2.496582f, 1.4880371f, -0.044189453f, -0.55981445f, -1.1950684f, -1.519043f, -1.6992188f, -1.7475586f, -1.7741699f, -1.7507324f, -1.697998f, -1.6628418f, -1.5812988f, + -0.28393555f, 0.36254883f, 0.7150879f, 1.1523438f, 1.5422363f, 1.6831055f, 0.8269043f, -0.0107421875f, -0.48364258f, -0.6828613f, -0.78930664f, -0.6608887f, -0.6298828f, -0.8183594f, -0.8984375f, -1.0241699f, + 2.4472656f, 3.3598633f, 2.1152344f, 0.58740234f, 0.088134766f, 0.080566406f, 0.12768555f, -0.83447266f, -0.66308594f, 0.3178711f, -0.046875f, -1.7287598f, -1.8405762f, -1.4956055f, -1.1696777f, -1.3449707f, + 0.053955078f, -0.54907227f, -0.64941406f, -0.40527344f, -0.1496582f, -0.067871094f, -0.1328125f, -0.15991211f, 0.044677734f, 0.25585938f, 0.31835938f, 0.16113281f, 0.25756836f, 0.36523438f, 0.30444336f, 0.3527832f, + 0.20654297f, 1.2531738f, 1.6928711f, 2.6262207f, 2.7858887f, 2.2766113f, 1.0957031f, 0.32495117f, -0.79711914f, -1.7229004f, -2.0270996f, -1.2214355f, -1.1369629f, -2.0170898f, -1.7719727f, -1.5671387f, + 2.3149414f, 2.991455f, 1.5952148f, -0.14819336f, -0.6477051f, -0.16430664f, 0.07470703f, -0.28759766f, -0.4309082f, -0.782959f, -0.9194336f, -0.9182129f, -0.76708984f, -0.43164062f, -0.51586914f, -0.96240234f, + -0.13427734f, 0.3479004f, 0.4909668f, 0.038330078f, -0.26342773f, -0.3449707f, -0.41430664f, -0.3930664f, -0.16748047f, 0.009521484f, 0.1977539f, 0.0703125f, 0.20703125f, 0.43969727f, 0.24658203f, -0.33032227f, + -2.4680176f, -2.8671875f, -1.8813477f, 0.0925293f, 2.0136719f, 1.6013184f, 0.009277344f, -0.20214844f, 0.53344727f, 1.6809082f, 0.20605469f, 0.18408203f, 1.1643066f, 0.7697754f, -0.21728516f, -0.6196289f, + 3.2966309f, 3.043457f, 1.8188477f, 0.35595703f, -0.5317383f, -1.1340332f, -1.4089355f, -1.5368652f, -1.5805664f, -1.4577637f, -1.1005859f, -0.7077637f, 0.3149414f, 0.13671875f, 0.09887695f, 0.39257812f, + 1.1394043f, 2.0166016f, 1.6103516f, 0.43041992f, 0.8642578f, 1.6750488f, 0.87231445f, -0.23657227f, -1.2756348f, -1.3154297f, -1.0163574f, -0.611084f, -0.8654785f, -0.96191406f, -0.888916f, -1.4370117f, + 1.2382812f, 2.4553223f, 2.6896973f, 1.0947266f, 0.8881836f, 0.6599121f, 0.5114746f, 0.54296875f, 0.5046387f, -0.7314453f, -1.0595703f, -1.0734863f, -1.7263184f, -1.8920898f, -1.9853516f, -2.1169434f, + 1.7275391f, 1.0910645f, 0.24316406f, -1.076416f, -1.8234863f, -2.0952148f, -1.9289551f, -1.7150879f, -1.1884766f, -0.40429688f, 0.6279297f, 1.0185547f, 1.0893555f, 1.3093262f, 1.5356445f, 1.5893555f, + 2.8112793f, 3.1445312f, 2.5549316f, 0.8642578f, 0.45751953f, 1.5227051f, 1.6352539f, 0.92749023f, -0.56347656f, -1.8974609f, -2.1052246f, -2.085205f, -1.9211426f, -1.7441406f, -1.8710938f, -1.7302246f, + 0.46118164f, 0.93188477f, 0.859375f, 0.25732422f, -0.083496094f, -0.11010742f, -0.5197754f, -0.7607422f, -0.90966797f, -1.2976074f, -1.0537109f, -0.685791f, 0.013183594f, 0.83984375f, 1.1577148f, 0.9003906f, + 3.130371f, 1.8466797f, 0.7558594f, -0.33569336f, -0.7277832f, -0.85498047f, -0.7219238f, -0.6804199f, -0.5666504f, -0.50097656f, -0.49169922f, -0.2824707f, -0.16015625f, -0.3659668f, -0.2529297f, 0.20898438f, + -1.7817383f, -0.7636719f, -0.35620117f, -0.9194336f, -0.89990234f, -0.30371094f, 0.16333008f, 0.53393555f, 1.2219238f, 1.6164551f, 1.0964355f, 0.36914062f, 0.19091797f, 0.19116211f, -0.06689453f, -0.2919922f, + 2.9470215f, 2.9702148f, 2.4978027f, 1.8425293f, 1.1940918f, 0.48754883f, 0.040771484f, -0.4560547f, -0.71777344f, -1.255127f, -1.7084961f, -1.8168945f, -1.6584473f, -1.5026855f, -1.380127f, -1.4846191f, + -0.42797852f, 0.39672852f, 1.0322266f, 0.8232422f, 0.57055664f, 0.99194336f, 1.0778809f, 0.47460938f, 0.11987305f, -0.65625f, -1.3706055f, -1.3859863f, -0.93652344f, -0.296875f, -0.060302734f, -0.35253906f, + 3.0546875f, 1.5651855f, 0.72753906f, 0.024658203f, -0.087646484f, -0.13623047f, -0.22338867f, -0.051513672f, -0.01977539f, -0.13867188f, -0.29052734f, -0.4897461f, -0.6779785f, -0.89501953f, -1.0483398f, -1.3132324f, + -2.329834f, -1.6538086f, -1.5170898f, -1.8430176f, -1.7233887f, -0.94091797f, -0.39746094f, 0.51293945f, 1.3725586f, 1.703125f, 1.6044922f, 1.3227539f, 1.2766113f, 1.1901855f, 0.91308594f, 0.5095215f, + 2.1574707f, 3.0603027f, 2.765625f, 1.7712402f, 0.6225586f, -0.6166992f, -1.060791f, -1.5693359f, -1.4384766f, -1.7651367f, -1.7729492f, -1.0949707f, -0.46020508f, -0.0690918f, -0.05444336f, -0.47509766f, + 2.2287598f, 2.074707f, 1.065918f, 0.068603516f, -0.88061523f, -1.3867188f, -1.3818359f, -1.2768555f, -0.8725586f, -0.45751953f, -0.083984375f, -0.022460938f, 0.36108398f, 0.47192383f, 0.12597656f, -0.03466797f, + 1.2832031f, 2.3029785f, 1.6501465f, -0.19360352f, -0.94384766f, -0.11206055f, 1.2709961f, 1.0712891f, 0.9008789f, -0.6833496f, -1.9458008f, -1.3894043f, -0.7553711f, -0.17016602f, -0.6489258f, -1.637207f, + -0.5410156f, -1.4377441f, -0.87109375f, 0.72143555f, 2.3781738f, 1.8154297f, 0.05834961f, -0.24487305f, 0.27124023f, 1.1665039f, -0.2692871f, -0.24609375f, 0.4802246f, -0.34033203f, -1.2138672f, -1.7270508f, + 2.6340332f, 1.8164062f, 0.6784668f, -0.16235352f, -0.64208984f, -0.7529297f, -0.32080078f, 0.12548828f, 0.14257812f, -0.51123047f, -1.1225586f, -1.2424316f, -0.41625977f, -0.21459961f, -0.12768555f, 0.115722656f, + 1.6694336f, 1.4055176f, 1.2404785f, 1.4047852f, 1.1928711f, 0.6352539f, 0.19091797f, 0.040527344f, -0.056884766f, -0.5456543f, -0.94018555f, -1.1928711f, -1.1975098f, -1.208252f, -1.2277832f, -1.4104004f, + 0.92211914f, 2.1171875f, 1.9343262f, 0.67529297f, 0.21362305f, 0.7409668f, 0.51538086f, 0.0625f, -0.16113281f, -0.91918945f, -1.6809082f, -1.9360352f, -1.3974609f, -0.3359375f, 0.015625f, -0.7668457f, + 0.25463867f, 0.27246094f, -0.6647949f, -1.6083984f, -1.6931152f, -1.6413574f, -1.2963867f, 0.03149414f, 1.244873f, 0.9958496f, 0.88183594f, 0.7229004f, 0.6281738f, 1.152832f, 0.7297363f, -0.010498047f, + 0.27026367f, 1.5710449f, 2.415039f, 2.5617676f, 2.4665527f, 2.0825195f, 1.2067871f, 1.4360352f, 1.3601074f, -0.64990234f, -2.3432617f, -2.7763672f, -2.7404785f, -2.4682617f, -2.0534668f, -2.338623f, + -1.222168f, -0.23828125f, 0.42578125f, 0.41064453f, 0.033203125f, -0.22485352f, -0.31201172f, -0.5358887f, -0.5847168f, -0.4008789f, 0.018066406f, 0.2524414f, 0.36035156f, 0.55249023f, 0.7241211f, 0.74121094f, + 1.2573242f, 1.1115723f, 0.8808594f, 0.30810547f, -0.3330078f, -0.22290039f, 0.3894043f, 0.5810547f, 0.515625f, -0.11450195f, -0.8071289f, -0.9470215f, -0.68603516f, -0.69140625f, -0.68188477f, -0.5600586f, + -0.8679199f, -0.78100586f, -0.484375f, -0.22045898f, 0.21899414f, 0.6074219f, 0.4650879f, 0.6303711f, 0.52783203f, 0.1328125f, 0.10913086f, 0.28027344f, 0.15795898f, -0.02734375f, -0.22827148f, -0.52075195f, + 4.7766113f, 4.218994f, 2.694336f, 1.4052734f, 0.46484375f, 0.12695312f, -0.52441406f, -1.1826172f, -1.3425293f, -1.4343262f, -1.5407715f, -1.5932617f, -1.5834961f, -1.5500488f, -1.4814453f, -1.4541016f, + -1.1142578f, 0.16772461f, 1.0881348f, 0.9880371f, 0.6081543f, 0.39868164f, 0.22387695f, 0.01953125f, 0.011230469f, 0.06982422f, -0.13208008f, -0.43896484f, -0.5744629f, -0.34423828f, -0.4321289f, -0.5390625f, + 2.583496f, 2.133545f, 1.5522461f, 1.1113281f, 1.237793f, 1.3144531f, 0.93115234f, 0.35742188f, -0.20263672f, -0.76342773f, -1.1687012f, -1.4487305f, -1.6181641f, -1.8156738f, -2.0007324f, -2.203125f, + -2.0124512f, -1.4799805f, -1.4538574f, -1.4958496f, -1.1079102f, -0.4272461f, -0.17285156f, 0.080322266f, 0.3112793f, 0.5344238f, 0.6477051f, 0.64208984f, 1.0615234f, 1.8166504f, 1.7543945f, 1.3015137f, + 0.86035156f, 1.9960938f, 2.592041f, 2.7302246f, 2.2209473f, 1.1103516f, 0.720459f, -0.033691406f, -0.48901367f, -1.1772461f, -2.2160645f, -2.621338f, -2.5187988f, -1.5297852f, -0.41210938f, -1.2324219f, + -0.0390625f, 0.7182617f, 1.293457f, 1.6416016f, 1.7243652f, 0.44335938f, -0.36767578f, -0.62646484f, -0.14038086f, -0.39379883f, -1.5004883f, -1.2729492f, -0.65112305f, -0.21801758f, -0.15991211f, -0.45117188f, + 0.4506836f, 1.1796875f, 1.0358887f, 0.4663086f, 0.12597656f, -0.20898438f, -0.2524414f, -0.18115234f, -0.17993164f, -0.23266602f, -0.12768555f, -0.010009766f, -0.23925781f, -0.46972656f, -0.58251953f, -0.7739258f, + -3.7177734f, -3.4355469f, -1.828125f, 0.23046875f, 1.5246582f, 1.4841309f, 0.20214844f, -0.1538086f, 0.41015625f, 1.4714355f, 0.095214844f, 0.12524414f, 1.3300781f, 1.3466797f, 0.51538086f, 0.40014648f, + 4.776123f, 2.9377441f, 1.6135254f, 0.27954102f, -0.32666016f, -0.5793457f, -0.78466797f, -0.77001953f, -0.76538086f, -0.8562012f, -0.86694336f, -0.8532715f, -0.77905273f, -0.9621582f, -1.0119629f, -1.0510254f, + -0.8840332f, -0.5324707f, 0.2368164f, 2.0664062f, 2.5444336f, 1.9240723f, 1.4997559f, 1.230957f, 0.736084f, 0.2121582f, -0.61987305f, -0.9506836f, -1.2260742f, -1.7910156f, -2.0410156f, -2.4060059f, + 1.1203613f, 2.241455f, 1.5061035f, 0.26416016f, 0.083496094f, 0.087646484f, 0.00390625f, 0.03100586f, 0.08154297f, -0.39648438f, -0.56689453f, -0.62158203f, -0.7219238f, -0.796875f, -0.9807129f, -1.3356934f, + 0.8803711f, -0.5605469f, -0.89404297f, -1.1616211f, -0.9255371f, -1.3374023f, -1.1962891f, -1.2824707f, -1.3156738f, -1.2546387f, -1.0393066f, -0.041015625f, 1.5158691f, 1.6071777f, 2.4050293f, 4.5998535f, + 2.1367188f, 3.0183105f, 2.89917f, 2.105713f, 1.6914062f, 1.2595215f, 1.072998f, 0.5095215f, 0.26293945f, -0.62719727f, -1.6728516f, -2.331543f, -2.5375977f, -2.6152344f, -2.5966797f, -2.5751953f, + 0.45410156f, 0.56274414f, -0.091552734f, -0.82177734f, -0.8930664f, -0.40722656f, 0.024902344f, 0.008056641f, -0.09692383f, -0.19360352f, -0.25634766f, -0.25048828f, 0.14941406f, 0.73461914f, 0.7668457f, 0.31030273f, + 0.8791504f, 1.3742676f, 0.6760254f, -0.22192383f, -0.8535156f, -1.0957031f, -1.0690918f, -1.1728516f, -0.9848633f, -0.6647949f, -0.11669922f, 0.06738281f, 0.6196289f, 1.0905762f, 0.9074707f, 0.5654297f, + -0.26635742f, -0.29956055f, -0.8881836f, -1.2294922f, -0.69311523f, 0.011230469f, 0.5498047f, 0.9824219f, 1.184082f, 1.0895996f, 0.5878906f, 0.06738281f, -0.08911133f, -0.05029297f, -0.27319336f, -0.68359375f, + 3.256836f, 3.5593262f, 2.2746582f, 1.1318359f, 0.3149414f, -0.02368164f, 0.27172852f, -0.19335938f, -0.48779297f, -0.9663086f, -0.9187012f, -1.0222168f, -1.512207f, -1.6816406f, -1.8964844f, -2.1069336f, + -0.057617188f, -0.45092773f, -0.9638672f, -0.72143555f, 0.20703125f, 1.4692383f, 1.921875f, 1.6833496f, 1.3933105f, 0.6699219f, 0.17333984f, -0.43798828f, -0.9772949f, -1.1477051f, -1.3552246f, -1.4057617f, +}; +const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = { + 0.30615234f, 0.48828125f, -0.02709961f, -0.47680664f, -0.5300293f, -0.25463867f, -0.13305664f, -0.14941406f, -0.14819336f, 0.08666992f, 0.28833008f, 0.27514648f, 0.099365234f, -0.017578125f, 0.033203125f, 0.15893555f, + 0.40942383f, -0.044189453f, -0.088378906f, 0.38720703f, 0.5151367f, 0.42236328f, 0.34960938f, 0.2680664f, 0.037597656f, -0.19970703f, -0.31054688f, -0.32617188f, -0.38452148f, -0.38085938f, -0.38598633f, -0.2692871f, + -0.16040039f, -0.37548828f, -0.41479492f, -0.1237793f, 0.25708008f, 0.29589844f, 0.045410156f, -0.04345703f, -0.11450195f, -0.2019043f, 0.032470703f, 0.5847168f, 1.074707f, 0.3178711f, -0.43847656f, -0.73535156f, + -0.72021484f, 0.0859375f, 0.36450195f, 0.07739258f, -0.03857422f, -0.020263672f, 0.2277832f, 0.23657227f, -0.061523438f, -0.6010742f, -0.5341797f, -0.014160156f, 0.3154297f, 0.35327148f, 0.27368164f, 0.05517578f, + 0.17041016f, -0.1340332f, -0.17480469f, -0.16430664f, -0.15039062f, -0.16210938f, 0.20776367f, 0.78881836f, 0.8288574f, 0.2783203f, -0.099609375f, -0.26513672f, -0.29541016f, -0.31860352f, -0.3034668f, -0.20629883f, + 0.66967773f, 0.6286621f, 0.5107422f, 0.36791992f, 0.0949707f, -0.26904297f, -0.43603516f, -0.5292969f, -0.50219727f, -0.28881836f, -0.08081055f, 0.07861328f, -0.040771484f, -0.15014648f, -0.076416016f, 0.022705078f, + -0.14648438f, -0.46923828f, -0.43554688f, -0.11254883f, 0.021728516f, -0.06274414f, -0.10620117f, -0.23876953f, -0.34277344f, -0.21069336f, 0.010009766f, 0.26293945f, 0.36938477f, 0.4560547f, 0.5004883f, 0.5041504f, + -0.6381836f, -0.37841797f, -0.12036133f, 0.46875f, 0.6027832f, 0.40478516f, 0.3227539f, 0.2175293f, 0.029296875f, 0.009521484f, 0.091552734f, 0.014160156f, -0.19921875f, -0.27270508f, -0.3071289f, -0.24560547f, + 1.0043945f, 0.034423828f, -0.36523438f, -0.1628418f, -0.17504883f, -0.16357422f, 0.01977539f, 0.041992188f, -0.092041016f, -0.12548828f, -0.1381836f, -0.15527344f, -0.13720703f, -0.041992188f, 0.11791992f, 0.33789062f, + -0.29882812f, -0.056640625f, 0.22631836f, 0.35375977f, 0.40576172f, 0.053466797f, -0.33154297f, -0.58374023f, -0.59887695f, -0.13867188f, 0.35302734f, 0.4267578f, 0.12548828f, -0.052490234f, 0.022949219f, 0.09301758f, + -0.62060547f, -0.6557617f, -0.3918457f, -0.23461914f, -0.10498047f, -0.024169922f, 0.10473633f, 0.2746582f, 0.33642578f, 0.2866211f, 0.2980957f, 0.35498047f, 0.22167969f, 0.06298828f, 0.0036621094f, 0.087890625f, + -0.24169922f, 0.39331055f, 0.45410156f, -0.013671875f, -0.028076172f, 0.032226562f, -0.03491211f, 0.13916016f, 0.57006836f, 0.30078125f, -0.028564453f, -0.08300781f, -0.23266602f, -0.25585938f, -0.40356445f, -0.56762695f, + -0.25463867f, 0.20141602f, 0.13623047f, 0.021972656f, 0.018798828f, 0.35424805f, 0.30541992f, -0.043945312f, -0.032226562f, 0.4873047f, 0.2692871f, -0.57910156f, -0.86279297f, -0.46435547f, 0.21459961f, 0.2277832f, + 0.10083008f, -0.0048828125f, 0.15429688f, 0.58935547f, 0.58325195f, 0.15014648f, -0.1394043f, -0.30566406f, -0.39794922f, -0.42016602f, -0.4350586f, -0.49121094f, -0.24169922f, 0.07788086f, 0.3359375f, 0.4440918f, + -0.8688965f, -0.12646484f, 0.37768555f, 0.3232422f, -0.09790039f, -0.3017578f, -0.11328125f, 0.06982422f, 0.10864258f, 0.10180664f, 0.019042969f, -0.020751953f, -0.025878906f, 0.01977539f, 0.15820312f, 0.37646484f, + 0.04272461f, 0.020996094f, 0.31860352f, 0.23291016f, -0.33081055f, -0.80322266f, -0.73657227f, -0.34106445f, 0.011962891f, 0.27807617f, 0.45922852f, 0.49145508f, 0.3022461f, 0.14160156f, -0.017333984f, -0.07055664f, + -0.33544922f, 0.075683594f, -0.29907227f, -0.7363281f, -0.6525879f, -0.17797852f, 0.36279297f, 0.41870117f, 0.25170898f, 0.10473633f, 0.030273438f, -0.11254883f, 0.026855469f, 0.3503418f, 0.42382812f, 0.26904297f, + 0.3544922f, 0.67529297f, 0.38671875f, 0.009521484f, -0.040771484f, 0.08984375f, 0.2446289f, 0.16455078f, -0.17333984f, -0.4404297f, -0.46533203f, -0.40039062f, -0.28222656f, -0.1875f, -0.036865234f, 0.10205078f, + 0.4255371f, 0.16113281f, -0.11669922f, -0.16040039f, -0.14379883f, -0.2055664f, -0.0769043f, -0.055419922f, -0.19677734f, -0.44921875f, -0.3100586f, 0.10839844f, 0.5698242f, 0.5554199f, 0.11328125f, -0.21850586f, + -0.2980957f, -0.51660156f, -0.51000977f, -0.23046875f, 0.24658203f, 0.49682617f, 0.44580078f, 0.4501953f, 0.15917969f, -0.25317383f, -0.34301758f, -0.25146484f, -0.045898438f, 0.07885742f, 0.19018555f, 0.38085938f, + 0.32836914f, 0.41186523f, 0.40966797f, 0.23071289f, -0.27294922f, -0.7373047f, -0.33129883f, 0.2084961f, 0.29248047f, 0.023925781f, -0.22290039f, -0.2241211f, -0.10595703f, -0.109375f, -0.049072266f, 0.14770508f, + -0.17578125f, 0.35791016f, 0.71240234f, 0.55444336f, 0.37963867f, 0.25317383f, 0.0007324219f, -0.17456055f, -0.19921875f, -0.18261719f, -0.1381836f, -0.13476562f, -0.2697754f, -0.36523438f, -0.3803711f, -0.23730469f, + 0.18774414f, -0.33813477f, -0.40356445f, -0.16430664f, -0.35253906f, -0.5744629f, -0.40454102f, 0.03930664f, 0.28295898f, 0.24194336f, 0.11450195f, -0.011962891f, 0.15576172f, 0.29174805f, 0.39453125f, 0.5402832f, + 0.22485352f, -0.44970703f, -0.048583984f, 0.5905762f, 0.5395508f, -0.08300781f, -0.50219727f, -0.24121094f, 0.2331543f, 0.15942383f, -0.044433594f, 0.043701172f, -0.01928711f, -0.19824219f, -0.17260742f, -0.03173828f, + 0.86157227f, 0.21875f, 0.039794922f, 0.023925781f, -0.0925293f, -0.16845703f, -0.11669922f, 0.080322266f, 0.061279297f, 0.123535156f, 0.23388672f, 0.23022461f, 0.0056152344f, -0.33666992f, -0.5786133f, -0.5854492f, + 0.5175781f, 0.14453125f, -0.21850586f, -0.46777344f, 0.28515625f, 0.9855957f, 0.04296875f, -0.60424805f, -0.40625f, 0.07104492f, -0.0793457f, -0.111083984f, 0.017333984f, 0.021728516f, -0.1381836f, -0.060791016f, + 0.48950195f, -0.4885254f, -0.7644043f, -0.43164062f, -0.08203125f, 0.11401367f, 0.2331543f, 0.1472168f, 0.03540039f, 0.18945312f, 0.30737305f, 0.25976562f, 0.095458984f, -0.0234375f, -0.07739258f, -0.00390625f, + -0.111816406f, 0.22485352f, 0.00048828125f, -0.32177734f, -0.1508789f, 0.43017578f, 0.7011719f, 0.35229492f, -0.12060547f, -0.23291016f, 0.15258789f, 0.19702148f, -0.064208984f, -0.21606445f, -0.3857422f, -0.4543457f, + -0.22290039f, -0.33740234f, 0.068359375f, 0.09277344f, 0.04638672f, 0.21899414f, -0.03564453f, 0.036621094f, 0.6125488f, 0.5058594f, -0.4128418f, -0.69140625f, -0.5534668f, 0.16235352f, 0.54418945f, -0.034179688f, + -0.013916016f, 0.41259766f, 0.28393555f, -0.13085938f, -0.35058594f, -0.3713379f, -0.2619629f, -0.2854004f, -0.36401367f, -0.41210938f, -0.30444336f, -0.16552734f, 0.076416016f, 0.40722656f, 0.72143555f, 0.75878906f, + -0.78149414f, 0.05517578f, 0.09863281f, -0.35083008f, -0.29174805f, 0.1352539f, 0.10620117f, -0.3515625f, -0.27514648f, 0.15917969f, 0.34326172f, 0.2626953f, 0.39916992f, 0.42089844f, 0.20947266f, -0.1394043f, + -0.20361328f, -0.21557617f, -0.16308594f, -0.041748047f, -0.111083984f, -0.057617188f, 0.0390625f, 0.013183594f, 0.17358398f, 0.74902344f, 0.9448242f, 0.4477539f, -0.09423828f, -0.32739258f, -0.50634766f, -0.6467285f, +}; +const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = { + 0.15209961f, -0.12768555f, 0.09375f, -0.083496094f, -0.25390625f, 0.12524414f, 0.2993164f, -0.09863281f, -0.34814453f, -0.2434082f, -0.11254883f, -0.060058594f, 0.032470703f, 0.15527344f, 0.23413086f, 0.2355957f, + -0.16235352f, -0.111083984f, -0.3173828f, -0.25634766f, 0.13842773f, 0.29858398f, 0.10498047f, 0.11743164f, 0.26611328f, 0.05444336f, -0.1459961f, -0.19238281f, 0.041748047f, 0.2097168f, 0.07421875f, -0.12011719f, + -0.05078125f, 0.14770508f, -0.1003418f, -0.32104492f, -0.17504883f, -0.18652344f, -0.27148438f, -0.07788086f, 0.0036621094f, -0.04296875f, 0.10131836f, 0.34985352f, 0.3083496f, 0.10107422f, 0.0769043f, 0.13696289f, + -0.19140625f, -0.030273438f, 0.22509766f, 0.079589844f, -0.27148438f, -0.19604492f, 0.27929688f, 0.3503418f, 0.10424805f, 0.0061035156f, 0.06542969f, 0.11669922f, 0.036865234f, -0.1303711f, -0.22705078f, -0.21655273f, + 0.26538086f, -0.20825195f, -0.25073242f, 0.119628906f, 0.27270508f, 0.17797852f, -0.0024414062f, -0.12768555f, -0.22802734f, 0.0075683594f, 0.2133789f, 0.19482422f, 0.045898438f, -0.1184082f, -0.17797852f, -0.18383789f, + 0.2565918f, 0.24658203f, 0.1015625f, -0.029296875f, -0.14355469f, -0.13989258f, -0.20751953f, -0.19677734f, 0.17504883f, 0.41601562f, 0.13085938f, -0.20532227f, -0.16235352f, 0.040771484f, -0.037353516f, -0.24511719f, + -0.0871582f, 0.022949219f, 0.00048828125f, 0.07397461f, 0.14379883f, 0.067871094f, 0.0036621094f, 0.1171875f, 0.087402344f, 0.0012207031f, -0.075927734f, -0.11352539f, -0.31420898f, -0.38916016f, -0.022949219f, 0.484375f, + -0.1821289f, 0.060058594f, 0.24780273f, 0.41674805f, 0.2890625f, -0.1472168f, -0.20581055f, -0.083984375f, -0.060302734f, -0.19921875f, -0.17651367f, -0.08984375f, 0.011230469f, 0.13110352f, 0.080078125f, -0.09106445f, +}; + +const float *const ivas_sns_cdbks_tcx10[SNS_MSVQ_NSTAGES_TCX10] = { ivas_sns_cdbk_tcx10_stage1, ivas_sns_cdbk_tcx10_stage2, ivas_sns_cdbk_tcx10_stage3}; + +const int16_t ivas_sns_cdbks_side_tcx20_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 32 }; +const int16_t ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 }; +const int16_t ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 }; +const int16_t ivas_sns_cdbks_side_tcx10_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 3 }; + +const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = { + -0.11376953f, -0.06591797f, 0.041992188f, 0.044677734f, 0.17871094f, -0.02758789f, -0.32592773f, -0.21069336f, -0.049072266f, 0.0126953125f, 0.012939453f, 0.015136719f, 0.08203125f, 0.12670898f, 0.12695312f, 0.15112305f, + -0.017089844f, 0.09326172f, 0.2355957f, 0.2241211f, 0.107421875f, 0.05029297f, 0.039794922f, -0.0073242188f, -0.048339844f, -0.0871582f, -0.08520508f, -0.12060547f, -0.111572266f, -0.10620117f, -0.08911133f, -0.078125f, + -0.26635742f, 0.27368164f, 0.4543457f, 0.1821289f, 0.6513672f, 0.18066406f, 0.14575195f, -0.008056641f, 0.2631836f, -0.045898438f, -0.52001953f, -0.1628418f, 0.038330078f, -0.31811523f, -0.4321289f, -0.43603516f, + -0.044189453f, -0.10449219f, -0.091796875f, -0.10620117f, -0.09423828f, 0.09326172f, 0.2697754f, 0.16577148f, 0.06201172f, 0.010986328f, 0.021728516f, -0.023925781f, -0.036621094f, -0.03930664f, -0.04345703f, -0.03930664f, + 0.4099121f, 0.06323242f, -0.021972656f, -0.014404297f, -0.013916016f, -0.018554688f, -0.052246094f, -0.051757812f, -0.03173828f, -0.03491211f, -0.02758789f, -0.05859375f, -0.045410156f, -0.042236328f, -0.038085938f, -0.021484375f, + 0.0024414062f, 0.030761719f, 0.020263672f, 0.013671875f, -0.009033203f, 0.012939453f, 0.009521484f, -0.030273438f, -0.048339844f, -0.022216797f, 0.011962891f, -0.017333984f, -0.011474609f, -0.0007324219f, 0.011962891f, 0.025634766f, + 0.17358398f, 0.22387695f, 0.19702148f, -0.019042969f, -0.27514648f, -0.5378418f, -0.30688477f, -0.03540039f, 0.0007324219f, -0.049560547f, 0.07519531f, 0.052246094f, 0.12670898f, 0.16308594f, 0.12133789f, 0.09033203f, + -0.32006836f, -0.29125977f, -0.24731445f, -0.17797852f, -0.140625f, -0.10595703f, -0.12670898f, -0.10864258f, -0.08618164f, -0.07421875f, 0.030517578f, 0.15917969f, 0.24975586f, 0.31518555f, 0.40893555f, 0.5151367f, + -0.49658203f, -0.033691406f, 0.083740234f, 0.04272461f, 0.03466797f, 0.053955078f, 0.03466797f, 0.02368164f, 0.037597656f, 0.03173828f, 0.028320312f, 0.00024414062f, 0.028564453f, 0.030761719f, 0.044189453f, 0.055419922f, + -0.040527344f, 0.022460938f, 0.009765625f, 0.036865234f, 0.055664062f, 0.046875f, 0.032470703f, 0.08105469f, 0.095703125f, 0.04296875f, -0.0087890625f, -0.064697266f, -0.057373047f, -0.04711914f, -0.09765625f, -0.107666016f, + 0.27148438f, 0.3696289f, 0.39672852f, 0.38427734f, 0.30151367f, 0.21655273f, 0.15551758f, 0.12133789f, -0.008056641f, -0.12792969f, -0.22973633f, -0.39111328f, -0.4465332f, -0.46826172f, -0.35986328f, -0.18530273f, + -0.3166504f, -0.2758789f, -0.22290039f, -0.1850586f, -0.15771484f, -0.1184082f, -0.04638672f, 0.032470703f, 0.10961914f, 0.16821289f, 0.20336914f, 0.1665039f, 0.20019531f, 0.19970703f, 0.14233398f, 0.1003418f, + -0.028076172f, -0.02734375f, -0.06665039f, -0.099365234f, -0.10522461f, -0.10546875f, -0.056884766f, 0.017333984f, 0.061523438f, 0.07836914f, 0.087890625f, 0.051513672f, 0.05419922f, 0.051757812f, 0.04272461f, 0.043945312f, + -0.14404297f, -0.3088379f, -0.07885742f, 0.053222656f, 0.064208984f, 0.032226562f, 0.057617188f, 0.05810547f, 0.05126953f, 0.041748047f, 0.053955078f, 0.015136719f, 0.028808594f, 0.033691406f, 0.0234375f, 0.018554688f, + 0.49609375f, 0.45263672f, 0.2915039f, 0.15649414f, 0.052246094f, 0.017578125f, -0.050048828f, -0.06640625f, -0.10839844f, -0.15063477f, -0.17138672f, -0.20532227f, -0.18432617f, -0.17553711f, -0.19213867f, -0.16235352f, + -0.0056152344f, -0.030761719f, -0.092285156f, -0.1262207f, -0.15917969f, -0.12011719f, -0.1105957f, -0.13354492f, -0.12915039f, -0.09863281f, 0.017578125f, 0.12866211f, 0.21850586f, 0.24853516f, 0.1875f, 0.20532227f, + -0.011230469f, -0.061035156f, -0.032226562f, 0.18139648f, 0.068359375f, -0.13916016f, -0.1015625f, 0.0017089844f, -0.004638672f, 0.009765625f, 0.03149414f, -0.0068359375f, 0.0043945312f, 0.023925781f, 0.017333984f, 0.018066406f, + -0.045166016f, -0.05493164f, -0.04296875f, 0.053710938f, 0.2121582f, 0.25195312f, 0.08911133f, -0.034179688f, -0.049560547f, -0.06225586f, -0.061523438f, -0.07836914f, -0.052490234f, -0.044189453f, -0.046142578f, -0.03540039f, + 0.08129883f, 0.20532227f, 0.04296875f, 0.11010742f, 0.3720703f, 0.4272461f, 0.31884766f, 0.19335938f, 0.015625f, -0.17895508f, -0.20214844f, -0.38330078f, -0.2487793f, -0.20581055f, -0.24560547f, -0.30297852f, + -0.40112305f, -0.2043457f, -0.048828125f, 0.018798828f, -0.080322266f, 0.016113281f, 0.13427734f, 0.2734375f, 0.3503418f, 0.35766602f, 0.19165039f, -0.056884766f, -0.11645508f, -0.1574707f, -0.14990234f, -0.12719727f, + 0.2763672f, 0.27905273f, 0.2241211f, 0.035888672f, -0.10253906f, -0.061523438f, -0.08544922f, -0.19848633f, -0.25634766f, -0.22729492f, -0.20019531f, -0.12548828f, -0.0026855469f, 0.08178711f, 0.14819336f, 0.21411133f, + -0.11425781f, -0.068603516f, 0.2446289f, -0.0031738281f, -0.04321289f, -0.033203125f, 0.024414062f, -0.0036621094f, -0.022460938f, 0.0017089844f, 0.018554688f, -0.014892578f, -0.010253906f, 0.0021972656f, 0.0068359375f, 0.015380859f, + 0.080322266f, 0.23852539f, 0.16894531f, 0.029052734f, -0.043701172f, -0.10571289f, -0.07788086f, -0.037109375f, -0.0063476562f, -0.025878906f, -0.036865234f, -0.06347656f, -0.04321289f, -0.03173828f, -0.032470703f, -0.012451172f, + -0.072265625f, -0.17602539f, -0.29736328f, -0.35253906f, -0.34814453f, -0.25732422f, -0.2097168f, -0.1850586f, -0.11230469f, -0.052978516f, 0.09643555f, 0.3071289f, 0.3930664f, 0.56689453f, 0.40625f, 0.2939453f, + -0.24194336f, -0.11010742f, -0.05102539f, 0.03930664f, -0.061523438f, -0.018554688f, 0.010986328f, 0.04296875f, -0.21557617f, -0.01928711f, 0.009277344f, 0.048095703f, 0.26342773f, 0.36791992f, 0.13232422f, -0.19604492f, + 0.16210938f, 0.16381836f, 0.14404297f, 0.1081543f, 0.08959961f, 0.11450195f, 0.11743164f, 0.11645508f, 0.13110352f, 0.11303711f, 0.021240234f, -0.15844727f, -0.21166992f, -0.27368164f, -0.33813477f, -0.29956055f, + -0.14624023f, 0.068603516f, 0.24731445f, 0.38916016f, 0.31860352f, 0.27416992f, 0.19165039f, 0.13793945f, 0.06958008f, -0.018798828f, -0.1159668f, -0.2849121f, -0.3581543f, -0.3803711f, -0.25952148f, -0.1328125f, + -0.64819336f, -0.5800781f, -0.15527344f, -0.07104492f, -0.08300781f, 0.009765625f, 0.10620117f, 0.10571289f, 0.13989258f, 0.12988281f, 0.1743164f, 0.18408203f, 0.09375f, 0.12524414f, 0.20678711f, 0.26220703f, + 0.07836914f, 0.16430664f, -0.014404297f, -0.20898438f, -0.08984375f, 0.04296875f, 0.06713867f, 0.0075683594f, -0.037109375f, -0.029296875f, -0.020019531f, -0.03173828f, 0.0036621094f, 0.016113281f, 0.015380859f, 0.035888672f, + -0.02368164f, -0.14282227f, -0.36645508f, -0.11279297f, 0.042236328f, 0.14086914f, 0.041503906f, 0.009277344f, 0.039794922f, 0.055419922f, 0.061523438f, 0.040771484f, 0.056152344f, 0.064208984f, 0.052490234f, 0.041503906f, + 0.23120117f, 0.21533203f, 0.16748047f, 0.15649414f, 0.1262207f, 0.10498047f, 0.08691406f, 0.020019531f, -0.03466797f, -0.12841797f, -0.18579102f, -0.29492188f, -0.2705078f, -0.17236328f, -0.06933594f, 0.04736328f, + -0.19580078f, -0.14624023f, -0.11303711f, -0.055908203f, -0.052001953f, -0.009033203f, 0.022949219f, -0.0068359375f, -0.032470703f, 0.0017089844f, 0.045410156f, 0.025146484f, 0.039794922f, 0.07543945f, 0.1574707f, 0.24267578f, +}; + +const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = { + -0.013916016f, 0.0007324219f, 0.017089844f, 0.005859375f, 0.056152344f, -0.08178711f, -0.2927246f, 0.00390625f, 0.140625f, 0.03881836f, 0.010498047f, 0.038330078f, 0.042236328f, 0.020751953f, 0.005859375f, 0.0075683594f, + -0.07104492f, -0.10253906f, 0.038085938f, 0.091552734f, 0.118896484f, 0.13476562f, 0.05078125f, -0.111328125f, -0.13842773f, -0.20727539f, -0.25732422f, -0.15063477f, 0.032470703f, 0.08129883f, 0.17578125f, 0.31469727f, + 0.0715332f, 0.029052734f, 0.01953125f, 0.008056641f, 0.0234375f, 0.020751953f, 0.032226562f, 0.021972656f, 0.03466797f, 0.017822266f, -0.037841797f, -0.14038086f, -0.21679688f, -0.11035156f, 0.057617188f, 0.16845703f, + -0.1081543f, -0.02734375f, -0.08251953f, -0.08227539f, -0.07910156f, 0.049804688f, 0.10253906f, 0.23876953f, 0.25683594f, 0.03173828f, -0.15820312f, -0.14648438f, -0.008056641f, -0.00048828125f, -0.014404297f, 0.02734375f, + -0.022705078f, 0.028076172f, 0.14111328f, -0.06762695f, -0.07348633f, 0.16259766f, -0.0073242188f, -0.06567383f, -0.028564453f, -0.0107421875f, -0.023925781f, 0.0126953125f, -0.005859375f, -0.006591797f, -0.014160156f, -0.018066406f, + -0.09741211f, -0.092041016f, -0.061523438f, -0.011962891f, 0.006591797f, 0.041748047f, 0.008300781f, -0.017578125f, -0.08520508f, -0.12573242f, -0.06298828f, 0.13696289f, 0.25195312f, 0.15332031f, 0.001953125f, -0.04663086f, + -0.20239258f, 0.2705078f, 0.059326172f, 0.0041503906f, 0.022216797f, -0.009765625f, -0.026611328f, -0.02734375f, -0.032714844f, -0.016845703f, -0.025878906f, -0.0014648438f, -0.0075683594f, -0.009521484f, 0.004638672f, -0.0009765625f, + 0.064453125f, -0.26708984f, 0.122802734f, 0.025634766f, -0.0063476562f, 0.0043945312f, 0.008544922f, -0.0017089844f, 0.0061035156f, -0.007080078f, -0.018798828f, 0.011962891f, 0.008544922f, 0.010009766f, 0.020263672f, 0.018310547f, + -0.0007324219f, -0.037597656f, -0.036376953f, -0.015625f, 0.0056152344f, -0.0056152344f, -0.0029296875f, 0.032714844f, 0.047607422f, 0.019042969f, -0.010498047f, 0.017578125f, 0.0126953125f, 0.0043945312f, -0.013427734f, -0.016845703f, + 0.06933594f, 0.052978516f, 0.061035156f, 0.13378906f, 0.13427734f, 0.0053710938f, -0.099365234f, -0.18334961f, -0.21850586f, -0.083496094f, 0.020263672f, 0.05883789f, 0.013427734f, 0.011474609f, 0.01953125f, 0.0041503906f, + 0.0036621094f, -0.05053711f, -0.005126953f, 0.19091797f, -0.18798828f, -0.0546875f, 0.00048828125f, -0.021728516f, -0.001953125f, 0.0017089844f, 0.0041503906f, 0.024902344f, 0.022216797f, 0.02758789f, 0.02709961f, 0.01928711f, + 0.024658203f, -0.0041503906f, -0.026611328f, -0.0859375f, -0.06323242f, -0.068603516f, -0.07495117f, -0.050048828f, -0.061035156f, -0.0061035156f, 0.056396484f, 0.088378906f, 0.05883789f, 0.06738281f, 0.07763672f, 0.06738281f, + 0.13696289f, 0.08496094f, 0.07104492f, 0.046875f, 0.024658203f, 0.0048828125f, -0.0107421875f, -0.006591797f, 0.014160156f, -0.0073242188f, -0.041503906f, -0.02709961f, -0.041503906f, -0.060791016f, -0.09277344f, -0.095214844f, + -0.16772461f, 0.06665039f, 0.1821289f, 0.07397461f, -0.020019531f, 0.055419922f, 0.0390625f, -0.12011719f, -0.107910156f, 0.123291016f, 0.37939453f, 0.032714844f, -0.16137695f, -0.15234375f, -0.10546875f, -0.11743164f, + -0.013183594f, -0.011230469f, -0.037353516f, 0.0026855469f, -0.04638672f, -0.24438477f, 0.099853516f, 0.1105957f, 0.008544922f, 0.010253906f, 0.013183594f, 0.03857422f, 0.016601562f, 0.014892578f, 0.01928711f, 0.018066406f, + 0.044189453f, 0.07763672f, -0.03491211f, -0.18359375f, 0.15722656f, 0.061279297f, -0.029541016f, -0.018798828f, -0.023925781f, 0.0007324219f, -0.010498047f, 0.0087890625f, -0.0056152344f, -0.009277344f, -0.014892578f, -0.018798828f, + 0.13696289f, 0.011230469f, -0.033447266f, -0.017333984f, -0.07763672f, -0.122558594f, -0.076416016f, -0.017333984f, 0.14257812f, 0.21313477f, 0.14575195f, 0.032226562f, -0.083740234f, -0.12036133f, -0.076171875f, -0.057373047f, + 0.029541016f, -0.12231445f, -0.2475586f, 0.0949707f, 0.18896484f, 0.026123047f, 0.012939453f, 0.030029297f, 0.009033203f, -0.009277344f, -0.025634766f, 0.0087890625f, -0.0024414062f, -0.0017089844f, 0.0087890625f, -0.00024414062f, + -0.03857422f, -0.03881836f, -0.08886719f, -0.068847656f, 0.022216797f, 0.10229492f, 0.12841797f, 0.083984375f, 0.06567383f, 0.08178711f, 0.075927734f, 0.040039062f, -0.047851562f, -0.09448242f, -0.103515625f, -0.119140625f, + 0.009277344f, 0.046875f, 0.08178711f, 0.037597656f, 0.0063476562f, -0.038330078f, -0.01171875f, 0.28222656f, 0.027832031f, -0.25195312f, -0.12817383f, 0.01586914f, 0.011474609f, -0.014404297f, -0.044189453f, -0.030761719f, + 0.0637207f, 0.12426758f, 0.095458984f, -0.13378906f, -0.26293945f, -0.06323242f, 0.033203125f, 0.06591797f, 0.048583984f, 0.026367188f, 0.005859375f, 0.01977539f, -0.0029296875f, -0.005859375f, -0.0007324219f, -0.013183594f, + -0.016845703f, -0.052246094f, -0.057373047f, 0.008056641f, -0.01171875f, -0.068847656f, -0.0859375f, -0.016357422f, -0.012207031f, 0.046875f, 0.18164062f, 0.2692871f, 0.13476562f, -0.024414062f, -0.1274414f, -0.16723633f, + -0.021972656f, -0.053955078f, -0.022705078f, -0.00048828125f, 0.072021484f, 0.083496094f, 0.056640625f, -0.014892578f, 0.028320312f, 0.09399414f, 0.061279297f, -0.48779297f, -0.018554688f, 0.1550293f, 0.05859375f, 0.0107421875f, + 0.38476562f, -0.049316406f, -0.0793457f, -0.025146484f, -0.02319336f, -0.020751953f, 0.026855469f, -0.00048828125f, -0.052490234f, -0.033935547f, -0.04638672f, -0.0107421875f, -0.018066406f, -0.022216797f, -0.016113281f, -0.013427734f, + -0.23852539f, -0.064941406f, -0.018066406f, -0.0034179688f, 0.040283203f, 0.01928711f, 0.018310547f, 0.030761719f, 0.030029297f, 0.028564453f, 0.010253906f, 0.037109375f, 0.021484375f, 0.03491211f, 0.03515625f, 0.018798828f, + 0.03857422f, 0.028808594f, 0.025878906f, 0.04321289f, 0.03491211f, -0.021972656f, -0.03466797f, -0.01953125f, -0.02368164f, -0.095214844f, -0.13891602f, -0.032714844f, 0.013671875f, 0.05883789f, 0.064697266f, 0.057861328f, + -0.014892578f, 0.014892578f, 0.0126953125f, 0.045410156f, 0.0073242188f, 0.08300781f, 0.17797852f, 0.030761719f, -0.11743164f, -0.071777344f, -0.048095703f, -0.007080078f, -0.016113281f, -0.024414062f, -0.033203125f, -0.03881836f, + 0.0690918f, -0.049072266f, -0.23413086f, -0.3227539f, -0.15258789f, -0.028320312f, 0.05883789f, 0.055908203f, 0.08618164f, 0.08203125f, 0.052246094f, 0.0546875f, 0.022216797f, 0.07885742f, 0.13061523f, 0.095947266f, + -0.13452148f, -0.026855469f, 0.107177734f, 0.16040039f, 0.13305664f, 0.043701172f, 0.0087890625f, 0.020019531f, 0.040039062f, 0.017578125f, -0.030029297f, -0.024902344f, -0.067871094f, -0.08666992f, -0.076416016f, -0.083740234f, + -0.01953125f, -0.059814453f, -0.061279297f, 0.008056641f, 0.031982422f, 0.08203125f, -0.045166016f, -0.25561523f, -0.02758789f, 0.10522461f, 0.06274414f, 0.046875f, 0.029052734f, 0.03173828f, 0.04248047f, 0.028564453f, + -0.050048828f, 0.084472656f, 0.27172852f, 0.053222656f, -0.063964844f, -0.12988281f, -0.07299805f, -0.051757812f, -0.036621094f, -0.0014648438f, -0.0009765625f, 0.021728516f, 0.009033203f, -0.0007324219f, -0.013183594f, -0.018554688f, + 0.0847168f, 0.18920898f, -0.1796875f, -0.01586914f, -0.017822266f, -0.021728516f, 0.006591797f, -0.0075683594f, -0.019042969f, -0.0107421875f, -0.0146484375f, 0.014160156f, 0.0034179688f, -0.0056152344f, -0.0036621094f, -0.0017089844f, +}; + +const float *const ivas_sns_cdbks_side_tcx20[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx20_stage1, ivas_sns_cdbks_side_tcx20_stage2 }; + +const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = { + -0.23950195f, -0.203125f, -0.17822266f, -0.1315918f, -0.123291016f, -0.095947266f, -0.106933594f, -0.16552734f, -0.14941406f, -0.075683594f, 0.026367188f, 0.1015625f, 0.17041016f, 0.2770996f, 0.37890625f, 0.5148926f, + 0.12890625f, 0.20825195f, 0.22924805f, 0.2998047f, 0.24267578f, 0.14477539f, 0.07861328f, 0.024658203f, -0.076171875f, -0.18432617f, -0.26660156f, -0.33251953f, -0.2758789f, -0.13964844f, -0.030517578f, -0.05126953f, + -0.14160156f, -0.13305664f, -0.111816406f, -0.037353516f, -0.038085938f, 0.051513672f, 0.07348633f, 0.0073242188f, 0.044921875f, -0.0234375f, -0.123291016f, -0.01171875f, 0.28100586f, 0.24194336f, 0.0703125f, -0.1496582f, + 0.053466797f, 0.122802734f, 0.1394043f, 0.099853516f, 0.078125f, 0.018554688f, 0.034423828f, 0.103759766f, 0.06542969f, -0.030273438f, -0.09887695f, -0.099609375f, -0.060058594f, -0.119628906f, -0.18237305f, -0.12451172f, + -0.04345703f, -0.033447266f, -0.06665039f, -0.06518555f, -0.048828125f, -0.11645508f, -0.2055664f, -0.20263672f, -0.15576172f, -0.0009765625f, 0.103759766f, 0.21191406f, 0.24414062f, 0.14526367f, 0.09863281f, 0.13476562f, + 0.05810547f, 0.22558594f, 0.10180664f, -0.08618164f, -0.07470703f, 0.052246094f, 0.052490234f, -0.042236328f, -0.07055664f, -0.037109375f, -0.024169922f, -0.03149414f, -0.031982422f, -0.040527344f, -0.038085938f, -0.013183594f, + 0.020019531f, -0.033447266f, -0.14550781f, -0.42089844f, -0.19604492f, 0.038085938f, 0.026611328f, 0.016357422f, 0.038330078f, 0.057861328f, 0.06762695f, 0.08081055f, 0.091308594f, 0.10180664f, 0.11987305f, 0.13720703f, + 0.13671875f, 0.30566406f, 0.4716797f, 0.54785156f, 0.39819336f, 0.27075195f, 0.17602539f, 0.092041016f, -0.013183594f, -0.17163086f, -0.3166504f, -0.42138672f, -0.53271484f, -0.45898438f, -0.27416992f, -0.21044922f, + -0.38989258f, -0.37597656f, -0.3696289f, -0.2915039f, -0.26098633f, -0.19921875f, -0.15136719f, -0.09057617f, -0.040771484f, 0.13354492f, 0.30126953f, 0.3857422f, 0.40649414f, 0.31103516f, 0.30004883f, 0.3317871f, + 0.35107422f, 0.5229492f, 0.41870117f, 0.14355469f, -0.037597656f, -0.13134766f, -0.18383789f, -0.18066406f, -0.15771484f, -0.17480469f, -0.17041016f, -0.15209961f, -0.08251953f, -0.06616211f, -0.064453125f, -0.03466797f, + -0.66845703f, -0.31030273f, -0.21435547f, -0.11987305f, -0.103271484f, 0.080322266f, 0.21801758f, 0.20874023f, 0.1015625f, 0.032958984f, -0.043945312f, 0.078125f, 0.07324219f, 0.07763672f, 0.20727539f, 0.38208008f, + -0.17163086f, -0.1171875f, -0.03491211f, 0.060302734f, 0.1809082f, 0.33666992f, 0.3955078f, 0.27172852f, 0.12841797f, -0.036865234f, -0.17163086f, -0.21289062f, -0.20800781f, -0.17333984f, -0.125f, -0.12231445f, + -0.1875f, -0.3996582f, -0.017822266f, 0.10058594f, 0.057617188f, 0.028320312f, 0.05493164f, 0.04272461f, 0.041503906f, 0.046875f, 0.041748047f, 0.0546875f, 0.06201172f, 0.03149414f, 0.013427734f, 0.028564453f, + 0.34814453f, 0.234375f, -0.05493164f, -0.1821289f, -0.2878418f, -0.31176758f, -0.28100586f, -0.19824219f, -0.15673828f, -0.08251953f, 0.030273438f, 0.13647461f, 0.2211914f, 0.20776367f, 0.16455078f, 0.21240234f, + -0.057861328f, -0.10571289f, 0.08984375f, 0.30444336f, 0.18945312f, 0.14770508f, 0.09082031f, -0.020996094f, -0.053466797f, -0.044433594f, -0.07128906f, -0.08886719f, -0.079833984f, -0.0859375f, -0.09790039f, -0.1159668f, + 0.17626953f, 0.26049805f, 0.2175293f, 0.21020508f, 0.20141602f, 0.27734375f, 0.21606445f, -0.0012207031f, -0.010986328f, -0.11694336f, -0.2331543f, -0.15844727f, -0.08081055f, -0.08886719f, -0.35717773f, -0.5114746f, + -0.38134766f, -0.4855957f, -0.35986328f, -0.16137695f, -0.026123047f, 0.009033203f, -0.0126953125f, 0.040283203f, 0.095458984f, 0.15454102f, 0.16333008f, 0.19140625f, 0.21142578f, 0.203125f, 0.17993164f, 0.1784668f, + 0.05834961f, 0.06298828f, 0.041015625f, 0.031982422f, 0.07910156f, 0.06713867f, -0.028808594f, -0.05053711f, -0.024902344f, -0.17822266f, -0.3227539f, -0.1665039f, -0.0053710938f, 0.05517578f, 0.119384766f, 0.26123047f, + 0.047851562f, -0.042236328f, -0.24145508f, -0.038330078f, 0.052734375f, 0.068603516f, 0.05810547f, 0.011962891f, -0.013916016f, -0.010986328f, 0.020019531f, 0.02758789f, 0.03100586f, 0.02319336f, 0.014160156f, -0.008056641f, + -0.0036621094f, 0.0014648438f, 0.013671875f, 0.0f, 0.021240234f, 0.033447266f, 0.014892578f, 0.004638672f, 0.056884766f, 0.13427734f, 0.08691406f, -0.005126953f, -0.072753906f, -0.095214844f, -0.10961914f, -0.08105469f, + -0.15966797f, -0.110839844f, -0.13012695f, -0.071777344f, -0.064941406f, -0.056396484f, -0.046142578f, -0.012207031f, 0.048583984f, 0.036865234f, -0.00048828125f, -0.024414062f, -0.012939453f, 0.092041016f, 0.21435547f, 0.29858398f, + 0.55981445f, 0.15820312f, -0.012451172f, -0.04321289f, -0.05810547f, -0.014892578f, -0.021484375f, -0.038330078f, -0.033691406f, -0.037597656f, -0.0690918f, -0.076416016f, -0.0637207f, -0.064697266f, -0.0847168f, -0.099853516f, + -0.039794922f, -0.032714844f, -0.030273438f, -0.051513672f, -0.03564453f, -0.041015625f, -0.0390625f, 0.017822266f, 0.051513672f, 0.013916016f, -0.044677734f, -0.061035156f, -0.012207031f, 0.07299805f, 0.123291016f, 0.10888672f, + 0.45117188f, 0.46704102f, 0.38916016f, 0.23242188f, 0.16430664f, 0.1809082f, 0.20922852f, 0.033935547f, -0.13720703f, -0.2758789f, -0.39941406f, -0.3840332f, -0.31054688f, -0.28466797f, -0.28955078f, -0.04663086f, + -0.088134766f, -0.22973633f, -0.4194336f, -0.49487305f, -0.4038086f, -0.27734375f, -0.2253418f, -0.1315918f, -0.044677734f, 0.12036133f, 0.24951172f, 0.31103516f, 0.52124023f, 0.484375f, 0.32739258f, 0.30126953f, + 0.33203125f, 0.29614258f, 0.1796875f, 0.06689453f, 0.100097656f, 0.13867188f, 0.03491211f, -0.032714844f, -0.12060547f, -0.2097168f, -0.29638672f, -0.20898438f, -0.08227539f, -0.16821289f, -0.16015625f, 0.13134766f, + -0.44189453f, 0.017578125f, 0.07397461f, 0.033447266f, 0.044189453f, 0.04711914f, 0.030273438f, 0.040771484f, 0.041015625f, 0.022949219f, 0.004638672f, 0.018798828f, 0.028564453f, 0.018798828f, -0.00048828125f, 0.020751953f, + -0.36621094f, -0.23388672f, -0.08178711f, -0.015136719f, -0.049072266f, 0.07910156f, 0.23120117f, 0.28320312f, 0.38378906f, 0.29223633f, 0.099365234f, -0.0087890625f, -0.09814453f, -0.16455078f, -0.18945312f, -0.16186523f, + -0.17041016f, -0.18359375f, -0.19018555f, -0.15820312f, -0.20239258f, -0.21875f, -0.13110352f, 0.010009766f, 0.12011719f, 0.25097656f, 0.25024414f, 0.2055664f, 0.14526367f, 0.13964844f, 0.103759766f, 0.029052734f, + 0.06982422f, 0.072265625f, 0.18261719f, 0.025390625f, -0.2475586f, -0.2861328f, -0.111572266f, -0.037109375f, 0.0036621094f, 0.031982422f, 0.043945312f, 0.057373047f, 0.078125f, 0.072021484f, 0.028564453f, 0.016357422f, + 0.07836914f, 0.13549805f, 0.1743164f, 0.15478516f, 0.12573242f, -0.009521484f, -0.1508789f, -0.1965332f, -0.19604492f, -0.103027344f, -0.045898438f, -0.026123047f, 0.020263672f, 0.023925781f, 0.013183594f, 0.0014648438f, + 0.25341797f, 0.22558594f, 0.2241211f, 0.17114258f, 0.18164062f, 0.16894531f, 0.16503906f, 0.20239258f, 0.17041016f, 0.025878906f, -0.16625977f, -0.24121094f, -0.31982422f, -0.4008789f, -0.38256836f, -0.27783203f, +}; + +const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = { + -0.13989258f, -0.024658203f, 0.12670898f, 0.027832031f, 0.06689453f, 0.12817383f, 0.07495117f, -0.01977539f, -0.05834961f, -0.07543945f, -0.06542969f, -0.0546875f, -0.04345703f, -0.0063476562f, 0.034179688f, 0.029541016f, + -0.06713867f, -0.11450195f, -0.09790039f, -0.091308594f, -0.12182617f, -0.010009766f, 0.10986328f, 0.115478516f, 0.060058594f, 0.038085938f, 0.020507812f, 0.017333984f, 0.024169922f, 0.028320312f, 0.038330078f, 0.05053711f, + 0.05517578f, 0.030517578f, 0.0390625f, 0.05810547f, 0.021484375f, 0.032470703f, 0.040039062f, -0.0087890625f, -0.055908203f, -0.023925781f, 0.037109375f, 0.06347656f, 0.02709961f, -0.07373047f, -0.1274414f, -0.115234375f, + 0.11206055f, 0.2006836f, 0.045410156f, -0.10839844f, -0.1418457f, -0.08520508f, -0.032470703f, 0.033935547f, 0.044189453f, 0.006591797f, -0.012451172f, -0.018554688f, -0.013427734f, -0.010498047f, -0.0078125f, -0.012207031f, + -0.041748047f, -0.07373047f, -0.14819336f, 0.021240234f, 0.16015625f, 0.119140625f, 0.055908203f, 0.08081055f, 0.12548828f, 0.05419922f, -0.030761719f, -0.040771484f, -0.060302734f, -0.07128906f, -0.07763672f, -0.072509766f, + -0.07446289f, -0.041259766f, -0.040527344f, -0.068603516f, -0.042236328f, -0.03857422f, -0.05126953f, -0.08886719f, -0.055419922f, 0.036865234f, 0.09033203f, 0.06689453f, 0.08911133f, 0.13110352f, 0.08129883f, 0.0053710938f, + -0.052978516f, 0.033691406f, 0.16015625f, 0.171875f, 0.024658203f, -0.1328125f, -0.1394043f, -0.041992188f, 0.0068359375f, 0.020263672f, 0.008544922f, 0.0014648438f, -0.011474609f, -0.030273438f, -0.022460938f, 0.00390625f, + 0.20898438f, -0.011230469f, -0.08496094f, -0.010986328f, 0.032958984f, -0.013183594f, -0.057861328f, -0.07104492f, -0.06689453f, -0.056396484f, -0.047851562f, -0.03491211f, -0.011962891f, 0.032714844f, 0.08178711f, 0.11035156f, +}; + +const float *const ivas_sns_cdbks_side_tcx10[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx10_stage1, ivas_sns_cdbks_side_tcx10_stage2 }; +#else +/* codebooks trained for no adaptive tilt */ +const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = { + -3.24881770f, -1.99497051f, -0.04725080f, 1.02318508f, 1.51589220f, 1.44649178f, 1.27858728f, 1.15137095f, 0.98029724f, 0.69167126f, 0.33414576f, 0.11759238f, -0.27510520f, -0.63610342f, -1.05394049f, -1.28304590f, + -3.24340413f, -4.15075396f, -2.86242117f, -1.11561919f, 1.12899983f, 1.98341478f, 0.56638511f, -0.05841474f, -0.14875192f, 0.31098029f, 1.87121037f, 0.91347082f, 1.02548459f, 1.98227488f, 1.30278860f, 0.49435585f, + 1.23065598f, 0.87793778f, 0.28294330f, 0.02972172f, 0.42574775f, 0.83386805f, 0.95758438f, 1.21299710f, 1.15042593f, 1.00234403f, 0.60083169f, -0.06520030f, -1.53941239f, -2.26801783f, -2.42116011f, -2.31126766f, + 0.06088614f, 0.02623315f, -0.61781539f, -1.23181247f, -1.40815590f, -1.42831471f, -1.44033232f, -1.33353337f, -0.99555917f, -0.36554180f, 0.55314618f, 1.56114474f, 2.01339157f, 1.99106535f, 1.51097476f, 1.10422329f, + -0.46337128f, -1.76230281f, -2.14514561f, -1.74284853f, -0.74943182f, 0.04642704f, 0.99955801f, 1.04344919f, 1.33994604f, 1.17515394f, 1.38810800f, 1.59087304f, 0.68196542f, -0.13955087f, -0.49622391f, -0.76660607f, + -2.07291483f, -1.16133507f, -1.23972694f, -1.55319745f, -1.53709378f, -0.89687815f, -0.30493476f, 0.53566030f, 0.90463531f, 1.12789938f, 1.18233130f, 1.05231063f, 0.85029894f, 0.96079862f, 1.14041844f, 1.01172838f, + 2.12762247f, 0.85938708f, 0.01404337f, -0.21119526f, -0.23292897f, -0.20800178f, 0.17965021f, 0.51517794f, 0.58450068f, 0.57289696f, 0.08413189f, -0.34604446f, -0.63957268f, -0.82541169f, -1.16686648f, -1.30738935f, + 1.40474083f, 0.32307263f, 0.16419111f, 0.38346550f, 0.50108274f, 0.37590359f, 0.08846238f, -0.23008300f, -0.45942672f, -0.45977478f, -0.43670746f, -0.36727746f, -0.35363526f, -0.33341415f, -0.31539698f, -0.28520292f, + -1.63093109f, 0.32670603f, 1.08393314f, 0.58998372f, 0.53843053f, 0.88612683f, 0.92734321f, 0.85881168f, 0.60801083f, 0.37502839f, -0.29325438f, -0.61636624f, -0.51913318f, -0.70035895f, -0.99754553f, -1.43678500f, + -1.93833343f, -0.69005518f, -0.75170110f, -1.07591216f, -1.13136476f, -0.91057037f, -0.96360579f, -0.81544927f, -0.72636191f, -0.36468519f, 0.13935276f, 1.01589488f, 1.62003238f, 2.00743696f, 2.33078654f, 2.25453582f, + 0.79346182f, 0.75880356f, 0.99941121f, 1.41339988f, 1.42679902f, 1.10135650f, 0.67724856f, 0.16701926f, -0.44226147f, -0.83565024f, -0.96240506f, -0.97710726f, -1.05267194f, -1.07354671f, -1.04194230f, -0.95191489f, + 1.32136151f, -0.10247792f, -0.44723017f, -0.36075427f, -0.71183851f, -0.78401615f, 0.03854040f, 0.61579422f, 0.72990899f, 0.74660263f, 0.27260947f, -0.45511245f, -0.57501743f, -0.20707029f, -0.10728071f, 0.02598055f, + -2.38997175f, -0.94335853f, 0.22486968f, 0.68758389f, 0.77400708f, 0.48551812f, 0.16770824f, 0.18451833f, 0.33722182f, 0.44300618f, 0.45730356f, 0.25903292f, 0.07348018f, -0.18351294f, -0.34985810f, -0.22754861f, + -0.04011386f, -2.74627791f, -2.64617639f, -2.12344376f, -1.04417531f, -1.19773434f, -1.09890378f, -1.14847926f, -1.25163399f, -1.37182360f, -0.92453053f, 0.26852562f, 2.49004087f, 5.03865317f, 3.18845554f, 4.60761675f, + 1.14142799f, 2.34150710f, 1.12597821f, 0.18025034f, -0.06854703f, 0.11882225f, -0.04029384f, -0.10117108f, -1.28130702f, -1.15721800f, 0.11730029f, 0.68335719f, -0.86449861f, -0.91274565f, -0.63726145f, -0.64560064f, + 0.13591417f, 1.45701293f, 0.18328994f, -1.33736241f, -1.63073739f, -1.11748160f, 0.33426081f, 1.38341076f, 1.23963779f, 1.15857921f, -0.19884512f, -0.46649971f, -0.23043753f, -0.16721531f, -0.08938742f, -0.65413930f, + -3.20422583f, -2.18732518f, -1.06476764f, -0.35148934f, 0.10909386f, 0.39065642f, 0.55826648f, 0.44049157f, 0.21409388f, 0.73508456f, 0.80931151f, 0.46688874f, 0.41272044f, 0.76516296f, 1.00398863f, 0.90204888f, + -2.87971458f, -4.23728027f, -0.84454748f, -0.07411834f, 0.21882417f, -1.73386520f, 0.44502397f, -0.29845675f, 0.51877264f, 1.16767994f, -0.80604089f, 1.51749444f, 2.06387385f, 2.42941495f, 1.48054035f, 1.03239888f, + 0.41502416f, 1.92937242f, 2.34493885f, 2.24663449f, 1.97723622f, 1.21219002f, 0.63995779f, 0.11201995f, -0.55860561f, -1.24739776f, -1.54711086f, -1.65155024f, -1.60927011f, -1.56104438f, -1.42473910f, -1.27765585f, + 0.97567115f, -1.33363678f, -2.33351304f, -2.63770798f, -2.22869213f, -1.57504148f, -1.07402035f, -0.47932319f, 0.18065985f, 0.66105619f, 1.18623833f, 1.66207325f, 1.92650802f, 1.89672632f, 1.54070829f, 1.63229361f, + -1.83309029f, -1.12088085f, -0.69053368f, -0.04697322f, 0.16614312f, 0.20653379f, 0.18628141f, 0.29156151f, 0.23415032f, 0.18998435f, 0.46020416f, 0.73218863f, 0.60617333f, 0.33402310f, 0.20549266f, 0.07874144f, + 1.16879643f, -0.94945093f, -1.28153207f, -1.43119528f, -1.63599975f, -1.48906283f, -0.72189452f, 0.19212127f, 0.62604095f, 0.71399312f, 0.84540884f, 0.67919451f, 0.73724815f, 0.94849167f, 0.74181449f, 0.85602585f, + 3.95026110f, 1.56392643f, -0.09370037f, -1.55546296f, -0.28400433f, 2.65160213f, 1.72026891f, -1.03325487f, -2.07533128f, -1.61929448f, -0.37408941f, -0.62936182f, -0.97909452f, -0.16160269f, -0.16361090f, -0.91725088f, + 0.53671249f, -1.03786958f, -1.08801981f, -0.37356699f, -0.22489401f, 0.02309705f, 0.14784551f, 0.19793732f, 0.12472343f, 0.09506024f, 0.05869315f, 0.14383214f, 0.10038818f, 0.25076267f, 0.40789510f, 0.63740306f, + -1.95841389f, 0.03478956f, 1.04981544f, 1.45141888f, 1.01368780f, 1.76553008f, 0.97518033f, 0.87744500f, 1.11998177f, 1.49531245f, 0.43867723f, -1.39588091f, -2.49552623f, -2.06407734f, -1.18465117f, -1.12328885f, + -1.17302983f, 0.17875585f, 0.89193716f, 1.29461477f, 1.14616923f, 0.04577007f, -0.87252250f, -0.55960184f, -0.58720665f, -0.52949712f, -0.37526793f, 0.00605696f, -0.15490600f, 0.06404177f, 0.40280720f, 0.22187871f, + 0.64131376f, 1.75231910f, 2.22508888f, 1.98484418f, 0.78172753f, -0.67005650f, -0.79535378f, 0.16537851f, 0.46442966f, -0.37889506f, -1.24009244f, -0.92537177f, -0.87140953f, -1.04472250f, -1.06971265f, -1.01948730f, + 0.34969434f, 1.41127416f, 0.95134631f, -0.49521902f, -1.13459218f, -1.02414143f, -0.54470763f, 0.04902381f, -0.01765934f, -0.09518271f, -0.07199094f, -0.00398826f, 0.14565429f, 0.17470642f, 0.18302401f, 0.12275814f, + -0.44981302f, -0.20165042f, -0.00073479f, 0.26315901f, 0.44473473f, 0.36317865f, 0.17484972f, 0.03171990f, 0.07343634f, 0.04543774f, -0.09709362f, -0.05624873f, -0.00866747f, -0.02410679f, -0.21651202f, -0.34168925f, + -1.24451525f, -1.23251652f, -1.59614073f, -2.03789978f, -1.96213854f, -1.71444999f, -1.60613134f, -1.51978903f, -1.00014591f, 0.04117804f, 1.34166006f, 2.42925461f, 2.88303472f, 2.83027230f, 2.48737677f, 1.90095093f, + 1.96467234f, 1.49818482f, 0.23737321f, -0.11314831f, -0.14050512f, -0.25201114f, -0.17389748f, -0.07042668f, -0.18426976f, -0.34937744f, -0.42674607f, -0.50442879f, -0.58679768f, -0.52836378f, -0.35445903f, -0.01579900f, + -0.99933612f, 1.11819495f, 1.29449512f, -0.02576221f, -0.61170357f, 0.30864176f, 0.87998806f, 0.96699269f, 0.98082342f, 1.27485776f, 0.52941745f, -1.29529727f, -1.88922976f, -1.36858904f, -0.37094568f, -0.79254774f, + -2.00039877f, -0.30176543f, 0.62981832f, 1.66518235f, 1.71899440f, 1.30408052f, 0.82774193f, 1.00586191f, 0.86017140f, 0.54233910f, -0.13420070f, -0.66585251f, -0.96492148f, -1.18998336f, -1.56871158f, -1.72835605f, + -2.69937742f, -3.72437438f, -3.23623013f, -0.25624354f, 1.96357307f, 2.46814215f, 3.53069303f, -1.06174110f, -1.09336853f, -0.07686535f, 1.29279961f, 1.80354460f, 1.27988399f, -0.42606045f, -0.44754574f, 0.68316996f, + -0.09822772f, 1.26120245f, 1.70052823f, 1.56502837f, 1.15694639f, 0.88838189f, 0.57465867f, 0.31853596f, 0.03466567f, -0.25958767f, -0.49911919f, -0.76007985f, -1.16055649f, -1.53569625f, -1.61195549f, -1.57472513f, + -1.14376495f, -1.43799067f, -1.45325578f, -1.52444742f, -1.38528757f, -1.09797958f, -0.89118095f, -0.62608417f, -0.00250085f, 0.94458366f, 1.51363028f, 1.81223868f, 1.83008829f, 1.56737959f, 1.18148735f, 0.71308420f, + -0.16148812f, -2.04769833f, -2.09471486f, -1.43005703f, -0.50205979f, -0.54822778f, 1.68195446f, 4.00061129f, 1.03275735f, 0.41847912f, 0.66770340f, -0.11822564f, -0.63042447f, -0.32785779f, -0.23825248f, 0.29750055f, + -3.59916102f, -3.16769339f, -2.44843270f, -2.08077491f, -1.31387103f, -0.17348440f, 0.36398119f, 1.21172207f, 1.38864588f, 1.46347831f, 1.46684451f, 1.84157730f, 1.58044756f, 1.35394187f, 1.27155115f, 0.84122764f, + 1.12168796f, 1.77011301f, 0.80501182f, -0.65059510f, -0.86885740f, -0.21223750f, 0.66413611f, 0.77827963f, 0.37800197f, -0.26796888f, -0.97801860f, -0.64966444f, -0.50047252f, -0.44549810f, -0.47750530f, -0.46641261f, + 1.69417025f, 0.14170351f, -0.30309571f, -0.50074499f, -0.60597114f, -0.65756500f, -0.62775844f, -0.41013834f, -0.07761611f, 0.16510349f, 0.25158511f, 0.34758291f, 0.28289899f, 0.29273919f, 0.09829950f, -0.09119332f, + -0.86153928f, 1.09981825f, 0.79441249f, 0.41436072f, 0.25807562f, -0.33355863f, -0.51983659f, -0.25841284f, 0.00191053f, 0.13240503f, 0.19942573f, 0.24363814f, 0.08478089f, -0.15773770f, -0.37897853f, -0.71876393f, + -3.54840520f, -3.31670990f, -2.41138986f, -1.93012869f, -1.20864357f, -0.47291818f, -0.18678664f, 0.02177990f, 0.31458995f, 0.70059621f, 1.23845973f, 1.82707181f, 2.12918865f, 2.27071260f, 2.36659938f, 2.20598371f, + -1.13771731f, 0.39368618f, 0.69608234f, 1.45165188f, 1.41884327f, 1.47720631f, 0.71071536f, 0.51669579f, 0.07379070f, -0.91725636f, -1.46431524f, -2.01818354f, -0.45034354f, -0.20458063f, -0.61685389f, 0.07057863f, + 1.94180196f, -0.43938181f, -1.45235723f, -1.62714803f, -0.56602083f, 0.17861664f, -0.11574800f, -0.55042921f, -0.26385634f, 0.14973980f, 0.40358646f, 0.57744006f, 0.91363053f, 0.71399177f, -0.04044356f, 0.17657766f, + -2.29623160f, 0.37017475f, -0.14625619f, 1.40510672f, -0.18688173f, 0.98162341f, -0.08351923f, 0.30727120f, 0.21088276f, 0.00882905f, 0.20930156f, 0.07859582f, 0.11868622f, 0.19357924f, -0.59940040f, -0.57176126f, + 0.32770546f, -2.17703619f, -2.14694909f, -1.21327174f, -0.09787592f, -0.38390569f, -0.54684876f, -0.76275935f, -1.00614562f, -1.06555455f, -0.70232123f, -0.12667989f, 0.23719344f, 0.82854727f, 3.01646153f, 5.81943998f, + 1.74451794f, 2.61728252f, 2.50084081f, 2.14806463f, 1.03256213f, -0.14230845f, -0.89600957f, -1.26996454f, -1.47590648f, -1.42717085f, -1.20779572f, -0.98498624f, -0.82778555f, -0.73610012f, -0.59428320f, -0.48095729f, + -1.63200590f, 0.23028801f, -0.00907184f, -0.79978843f, -1.00748376f, -0.12526203f, 0.79168097f, 0.90826744f, 0.57548955f, 0.65151547f, 0.37307684f, -0.12047965f, -0.13538324f, 0.00756611f, 0.31705141f, -0.02546129f, + -2.96255244f, -1.89398578f, -1.11705055f, -0.49587679f, -0.64879460f, 0.52145289f, -0.11691144f, 1.02365070f, 0.12124424f, 1.06613244f, 2.03450026f, 1.32855094f, 0.54450823f, -0.09583278f, -0.09304639f, 0.78401059f, + -2.74846388f, -3.29381816f, -1.69589747f, 0.09992536f, 1.19730664f, -0.16362356f, -0.15703004f, 0.55042720f, 0.31568131f, 0.18156842f, 0.68590339f, 1.08986889f, 1.58662197f, 1.58930878f, 0.65286724f, 0.10935410f, + 2.40977200f, 1.75366309f, 0.74979137f, 0.75357579f, 0.58888421f, 0.34045829f, 0.41658500f, 0.41731179f, 0.35825939f, 0.03048901f, -0.69808452f, -1.34206657f, -1.51950247f, -1.45414323f, -1.40318331f, -1.40180996f, + -0.45462369f, -0.79464966f, -0.73449499f, -0.64030961f, -0.59804980f, -0.52688087f, -0.50966580f, -0.32241860f, -0.22751147f, -0.05981052f, 0.18569777f, 0.50293633f, 0.68570837f, 0.93799600f, 1.18364242f, 1.37243415f, + 0.71230959f, -0.15258830f, -0.30639043f, -0.10789426f, 0.13596677f, 0.06139692f, -0.05906250f, -0.09243858f, 0.16058801f, 0.19962984f, -0.02914953f, -0.05986174f, -0.00798730f, -0.03679071f, -0.19035654f, -0.22737122f, + 0.20985119f, 0.67531452f, -0.76482923f, -1.95548615f, -2.01335569f, -1.31859418f, -0.44117933f, 0.43598020f, 0.63898416f, 0.59260283f, 0.59660664f, 0.64364003f, 0.57962656f, 0.72198795f, 0.77431143f, 0.62453906f, + 3.37266827f, 1.16546541f, 0.15487771f, 0.57979973f, 1.63054771f, 1.04524609f, -0.13961184f, -0.53246008f, -0.51061506f, -0.83238697f, -1.04232388f, -0.96061103f, -0.90339873f, -0.99671658f, -1.06027762f, -0.97020325f, + -2.45339028f, 0.22870307f, 0.50079654f, 0.82545821f, -0.45080889f, -0.16537387f, -0.25306064f, -0.33349906f, 0.26143456f, 0.09313222f, 0.86160665f, 0.75164534f, -1.22179547f, -0.18801375f, 1.02457992f, 0.51858541f, + -1.46171297f, 0.63898461f, 2.15634917f, 1.94818588f, 2.12627540f, 1.70759626f, 1.43815259f, 0.82410049f, 0.20479176f, -0.43378728f, -0.89783731f, -1.30555797f, -1.66597981f, -1.80440934f, -1.79291067f, -1.68224086f, + -0.10170911f, 1.63842605f, 2.05629785f, 1.72760611f, 0.13751598f, -1.26847816f, -1.58069540f, -1.04510855f, -0.88231099f, -0.68616151f, -0.59891556f, -0.49054331f, -0.18451655f, 0.19151542f, 0.64619056f, 0.44088718f, + -0.86655238f, 0.59030963f, 1.14256838f, 1.66795450f, 1.50058628f, 1.34944192f, 0.08257813f, 0.24901720f, -0.18852178f, -0.03650931f, -0.27994508f, -1.06110568f, -2.06900429f, -1.73358377f, -0.24057835f, -0.10665549f, + 1.50872779f, 1.31070374f, 0.39357214f, -0.46407462f, -0.92397447f, -1.13436545f, -1.23237146f, -1.13209159f, -1.03095318f, -0.62563255f, -0.17705075f, 0.30244717f, 0.51989500f, 0.80258928f, 0.87034201f, 1.01223693f, + -0.30437289f, -0.88801487f, -0.86107707f, -0.28285107f, 0.28699382f, 0.45911485f, 0.48852566f, 0.45550239f, 0.58082722f, 0.55866427f, 0.31299044f, 0.14102370f, 0.07480087f, -0.08720185f, -0.35323153f, -0.58169395f, + -2.81842263f, -2.50111842f, -2.46829445f, -2.46942172f, -2.16241013f, -1.43881623f, -1.42903221f, -0.83291045f, 0.08734224f, 1.62875243f, 2.38321450f, 2.57841755f, 2.43444406f, 2.45552669f, 2.52427006f, 2.02845861f, + 3.37066045f, 1.49218725f, 0.55470586f, 0.13748306f, -0.13402053f, -0.39589325f, -0.44410867f, -0.48568748f, -0.51085663f, -0.42397560f, -0.53871831f, -0.60800303f, -0.57632384f, -0.50071998f, -0.46558245f, -0.47114696f, + -0.62183100f, 1.32484675f, 1.39280525f, 0.63916764f, 0.07573329f, 0.57096453f, 0.11014546f, -0.13955579f, -0.60839590f, -0.77966466f, -1.07179154f, -1.77671234f, -0.71411508f, 0.13441149f, 0.72184010f, 0.74215154f, + -2.90081845f, -3.29359883f, -1.89249569f, 2.35796037f, 2.47210792f, 0.89083303f, 1.25230145f, 1.03281210f, 1.34506489f, 0.48347288f, -0.08158884f, 0.21388757f, 0.05047384f, -0.37546417f, -0.70672331f, -0.84822525f, + -0.68878586f, -3.17765901f, -2.72677654f, -0.83696096f, 1.93901658f, 2.45806994f, 0.77003930f, 0.58220309f, 0.28500621f, -0.15305225f, 0.53711675f, 0.20321993f, 0.20435459f, 0.27124049f, 0.02126411f, 0.31170327f, + 1.03813940f, 1.60082720f, 1.24608760f, 0.78739775f, 0.96747591f, 1.10068123f, 1.15134869f, 0.74915981f, 0.42167811f, 0.15553718f, -0.33259317f, -0.97385519f, -1.61082594f, -2.05590168f, -2.15737100f, -2.08778582f, + -0.64496025f, 0.35212582f, -0.04908282f, -1.05504457f, -1.19731005f, -0.73315350f, -0.66929749f, -0.60130627f, -0.33236585f, 0.23014025f, 0.69893111f, 1.09565077f, 1.08466375f, 0.94366305f, 0.65639554f, 0.22095053f, + 0.48358349f, -0.37847120f, -1.02753771f, -0.73518795f, -0.11326269f, 0.53003780f, 0.88038488f, 0.88882395f, 0.97329253f, 0.69212641f, 0.87373175f, 0.80871682f, -0.03656343f, -0.94980974f, -1.26081773f, -1.62904720f, + -2.23244251f, -1.79490434f, -1.96001543f, -2.27380061f, -2.07255037f, -1.46415033f, -1.04393033f, 0.20282312f, 1.57244767f, 1.97591827f, 1.77648956f, 1.75160994f, 1.62357252f, 1.47414518f, 1.35930993f, 1.10547779f, + 0.79628045f, 0.95200921f, 0.49234542f, 0.09199320f, -0.05724590f, -0.07118046f, -0.04634766f, -0.00096416f, -0.17970825f, -0.09563800f, -0.01779017f, 0.13120319f, -0.03610489f, -0.35895498f, -0.62415601f, -0.97574095f, + 1.23786391f, -0.05332070f, 0.12142715f, 0.41317442f, 0.15674045f, -0.23609842f, -0.45604039f, -0.60612644f, -0.72063869f, -0.65773356f, -0.45446098f, -0.19856125f, -0.01567566f, 0.31093945f, 0.48567017f, 0.67284050f, + -0.38959317f, 0.48417975f, 0.67846195f, 0.96883427f, 0.97152360f, 0.77479838f, 0.58711345f, 0.71066957f, 0.54730033f, 0.30078955f, -0.00792413f, -0.23889729f, -0.71320215f, -1.17067509f, -1.60334166f, -1.90003738f, + -0.58748774f, -1.47663922f, -1.69196885f, -1.58982061f, -1.20534794f, -0.84425696f, -0.58959522f, -0.30927859f, 0.05320947f, 0.43265601f, 0.78002809f, 1.13478063f, 1.29240277f, 1.39914925f, 1.52607187f, 1.67609674f, + 0.21900175f, 0.90198746f, 1.47152638f, 1.60585024f, 1.28627552f, 0.62955762f, -0.10179136f, -0.53979665f, -0.95849172f, -1.05549774f, -0.93249423f, -0.63224235f, -0.54606380f, -0.47048197f, -0.44721628f, -0.43012290f, + 1.16598857f, -0.44883323f, -0.35990019f, 0.55867022f, 0.76350144f, 0.40336553f, -0.17899520f, -0.32789312f, 0.39266043f, 1.31706823f, 0.14239671f, -1.37351682f, -1.43994906f, -0.44961849f, 0.22694761f, -0.39189263f, + -2.38540927f, -1.62852954f, -0.88269400f, -0.07377225f, 0.58356450f, 0.88990527f, 0.91596948f, 0.64591793f, 0.36616944f, 0.38677852f, 0.46220080f, 0.31194777f, 0.22940934f, 0.16539664f, 0.07914516f, -0.06599966f, + 0.72463355f, -0.52958069f, -1.48068920f, -1.78301927f, -1.84235585f, -1.64970240f, -1.53867955f, -1.38956832f, -1.22397576f, -0.84685537f, -0.05213558f, 1.07240247f, 1.81984926f, 2.69693629f, 2.99963897f, 3.02310102f, + 1.19409909f, 2.68519772f, 1.98964488f, 0.67968388f, -0.01774621f, -0.15701839f, -0.09104235f, 0.24620030f, -0.83163859f, -1.22467182f, -1.23467957f, -1.15083406f, -0.63344301f, -0.72619249f, -0.46989224f, -0.25766714f, + -0.36982280f, 1.17012486f, 0.65527007f, -0.63203416f, -0.41714099f, 0.81639854f, 0.54164978f, 0.77650051f, 0.59880614f, 0.82660687f, -1.04749065f, -0.62911908f, -0.34368981f, -0.45351210f, -0.51314098f, -0.97940604f, + -2.68285677f, -0.85691687f, -0.20235026f, -0.01759520f, -0.00179021f, 0.11451343f, 0.27056934f, 0.20577824f, -0.23029364f, 0.11388472f, -0.05166620f, 0.07283122f, 0.56553984f, 0.81068091f, 1.04931803f, 0.84035365f, + -1.52932955f, -1.34785922f, -0.57071683f, -0.20686289f, 0.08155976f, -0.47381873f, -0.77622457f, -0.57310159f, -0.22137986f, 0.13834100f, 0.49481460f, 0.80177416f, 0.88568748f, 1.02957744f, 1.20356068f, 1.06397834f, + 0.85311314f, 1.33739225f, 1.91363915f, 1.93231248f, 2.08304754f, 1.71778606f, 0.86773094f, 0.43475180f, 0.03661492f, -0.61728713f, -1.15699401f, -1.66982248f, -1.98244609f, -2.00151078f, -1.93416224f, -1.81416574f, + 1.60126279f, -0.81833805f, -1.38880039f, -1.40634796f, -1.32149763f, -1.28036492f, -1.07256373f, -0.72500244f, -0.46550137f, -0.10403512f, 0.28677127f, 0.67644278f, 1.00944110f, 1.34460513f, 1.63359356f, 2.03033498f, + -1.12256198f, -1.95155583f, -1.32316561f, -0.63266570f, -0.15627220f, 0.07123786f, 0.13550620f, 0.25890778f, 0.47783453f, 0.57057758f, 0.68332609f, 0.73453078f, 0.66233264f, 0.62861164f, 0.56744294f, 0.39591321f, + 0.06875844f, -0.77557401f, -1.05293353f, -1.03197877f, -0.85111938f, -0.61756528f, -0.16943921f, 0.22208891f, 0.49771452f, 0.66450860f, 0.73241467f, 0.72611275f, 0.63156506f, 0.52604468f, 0.30774149f, 0.12166125f, + 3.80400584f, 1.75988157f, 0.24665703f, -1.24851564f, -1.25633571f, 0.32422259f, 2.13094918f, 0.70439664f, -1.53713254f, -1.71622823f, -1.08819715f, -0.50716458f, -0.74087437f, -0.99402032f, -0.10491345f, 0.22326928f, + -0.65058475f, -0.32678303f, -0.20547132f, -0.11041511f, -0.11848885f, -0.20790889f, -0.31102714f, -0.27474061f, -0.20625644f, -0.08260245f, 0.09887987f, 0.33251986f, 0.41319745f, 0.49892877f, 0.56061378f, 0.59013885f, + -2.39642240f, -0.73872271f, 0.49057636f, 1.16325658f, 0.79747808f, 1.34021740f, 0.82073194f, 1.17831994f, 1.25881141f, 0.84489551f, -0.77511278f, -1.30893620f, -1.25529283f, -0.65601516f, -0.34679935f, -0.41698601f, + -0.54371008f, 0.45990001f, 0.73230478f, 1.41706822f, 1.07142705f, 0.82233755f, -0.15928811f, -0.34139895f, -0.08643862f, -0.24274513f, -0.48172279f, -0.46452865f, -0.44837803f, -0.43356299f, -0.59008965f, -0.71117480f, + -0.36854343f, 1.40608712f, 2.13291678f, 1.80061219f, 1.15989238f, -0.32896337f, -0.86683083f, -0.45937605f, -0.17796119f, -0.40226921f, -0.30363529f, -1.08494615f, -0.97269428f, -0.91102639f, -0.31526836f, -0.30799363f, + 0.16771127f, 1.28284008f, 0.25724837f, -1.11750032f, -1.04368583f, 0.13121741f, 0.10609539f, 0.02437401f, -0.56098948f, -0.38744327f, 0.07855531f, 0.20548373f, 0.06560664f, 0.24342662f, 0.39885137f, 0.14820870f, + 0.20792769f, -0.15663987f, -0.04445993f, 0.27319064f, 0.51281629f, 0.57962552f, 0.54535177f, 0.41567183f, 0.41718141f, 0.20916435f, -0.10574785f, -0.26957618f, -0.44861183f, -0.55143961f, -0.71969549f, -0.86475851f, + -2.53854175f, -2.10301056f, -1.97482174f, -2.12277877f, -1.80824545f, -1.32660134f, -1.25816793f, -0.90711327f, -0.59056817f, -0.05426883f, 0.60446374f, 1.61001048f, 2.40601840f, 3.00689095f, 3.60110855f, 3.45562566f, + 1.07778822f, 2.19172459f, 1.44013405f, 0.27222350f, 0.03173527f, -0.04691321f, 0.06376916f, 0.63907484f, -0.17949007f, 0.10010871f, -0.52495472f, -0.90729516f, -0.89428983f, -1.02410889f, -1.09546364f, -1.14404292f, + 0.76276530f, 1.59524592f, 1.47474021f, 0.18145014f, 0.13550913f, 0.88510912f, 1.03412929f, 1.01111065f, 0.77539585f, 0.20329499f, -1.35508663f, -1.83340559f, -1.40465488f, -1.14514789f, -1.16420913f, -1.15624650f, + -2.56605999f, -0.69575164f, 0.80693890f, 1.72778867f, 2.34339014f, 2.09042055f, 1.74382199f, 1.18476481f, 0.71416221f, 0.16808900f, -0.19808303f, -0.77842890f, -1.40866559f, -1.73499872f, -1.76586854f, -1.63151971f, + -0.32618212f, -2.76955063f, -2.78043449f, 0.51956703f, 4.34383806f, 1.88716237f, 4.47289205f, -0.68129863f, -1.52511041f, -1.32636741f, 0.65997777f, -0.52682311f, -0.69581956f, -0.43799624f, -0.50098243f, -0.31287245f, + 1.11744895f, 0.76474262f, 0.68913317f, 0.77356058f, 0.73021025f, 0.55480731f, 0.41334472f, 0.23384124f, 0.00040865f, -0.18384701f, -0.30336471f, -0.46628578f, -0.73968976f, -1.02792872f, -1.19473003f, -1.36165137f, + -1.09856438f, -2.65937422f, -2.23447552f, -2.36127808f, -1.92601400f, -1.29606162f, -0.86847602f, -0.41112389f, 0.27059515f, 0.62653494f, 1.25539083f, 2.16718498f, 2.40401093f, 1.97246907f, 1.87623832f, 2.28294385f, + -2.23812017f, -3.37112518f, -3.06489410f, -2.44639779f, -1.77205118f, -0.96847500f, 3.20788062f, 2.74986128f, 2.48376367f, 3.58855607f, 1.46558359f, 0.58208141f, 0.58647621f, -0.03336968f, -0.01161197f, -0.75815742f, + -3.34068874f, -3.31330139f, -3.27624195f, -3.18776773f, -2.60176738f, -1.35466356f, -0.47112724f, 0.80847853f, 1.80958348f, 2.21285031f, 2.26554713f, 2.76880679f, 2.60017886f, 2.04062204f, 1.67575322f, 1.36373732f, + 0.04677635f, 1.13691098f, 1.30914680f, 0.25672818f, 0.15799852f, 0.60568291f, 0.31771628f, 0.07597951f, -0.26589647f, -0.54972118f, -0.86844552f, -0.61094603f, -0.47072310f, -0.40511943f, -0.38309528f, -0.35299238f, + 0.22528620f, 0.31743905f, 0.31483553f, 0.17720192f, 0.16231355f, -0.06831057f, -0.29693139f, -0.45560458f, -0.21127731f, -0.08624191f, -0.20781580f, -0.12232125f, 0.08133224f, 0.09984234f, 0.03187445f, 0.03837752f, + 0.45404525f, 1.31244734f, 1.09193858f, 0.46595512f, 0.31516414f, -0.08250116f, -0.64154502f, -0.86897307f, -0.92275973f, -0.84086567f, -0.63886704f, -0.14652849f, 0.08165072f, 0.18249933f, 0.18288233f, 0.05545734f, + -2.78701578f, -2.31409561f, -1.68556203f, -1.40144529f, -0.74842449f, -0.07375189f, -0.20211385f, 0.09260002f, 0.29898930f, 0.66465229f, 0.75558861f, 0.96729187f, 1.14177838f, 1.55174084f, 1.99705535f, 1.74271247f, + -0.10464683f, -0.94242352f, -0.57955843f, 1.29762166f, 1.68516688f, 1.09852539f, 0.72099378f, 0.51323036f, -0.24285175f, -0.55888513f, -0.50577021f, -0.46366004f, -0.55836815f, -0.58550721f, -0.50078205f, -0.27308479f, + 3.45286440f, 0.59611628f, -0.69351346f, -1.14674518f, -1.07854543f, -0.89938730f, -0.76263547f, -0.52068670f, -0.36216337f, -0.17157688f, -0.01447939f, 0.15778389f, 0.27944020f, 0.35739675f, 0.34083744f, 0.46529411f, + -1.28927442f, 0.10726691f, 0.86158650f, 0.06273348f, -0.04085696f, 1.13928101f, 0.37886132f, 0.13576595f, -0.53530704f, -0.37566277f, -0.10613359f, -0.03059598f, -0.04857175f, -0.00612681f, 0.00516239f, -0.25812835f, + 2.89076531f, -0.04664344f, -1.93237643f, -2.19996964f, -1.86412035f, -1.18315371f, -1.10120931f, -1.31680378f, -1.30399765f, -1.28669610f, -0.94489947f, -0.60614659f, 1.58599312f, 0.95842154f, 2.94815038f, 5.40268579f, + 3.83455417f, 3.13869337f, 1.72510455f, 1.17236146f, 0.33356711f, 0.11348813f, -0.29704182f, -1.13829975f, -1.48383443f, -1.43388842f, -1.35163818f, -1.16938088f, -1.02627819f, -0.92590386f, -0.82058768f, -0.67091549f, + -0.93172509f, 0.85237993f, 1.34276319f, 0.25174685f, -0.79705618f, -0.63895111f, 0.21118680f, 0.97143052f, 0.70458966f, -0.18635616f, -0.52911893f, -1.85150883f, -0.43982599f, 0.04075634f, 0.50586277f, 0.49382650f, + -3.79516923f, -3.31533743f, -1.55672619f, 0.02918112f, 0.69887327f, 0.58481500f, 1.07030510f, 1.26562384f, 1.20349632f, 1.07269840f, 0.89773042f, 0.88137053f, 0.60964812f, 0.28884498f, 0.12262285f, -0.05797732f, + -0.08660073f, -3.36745835f, -3.82012977f, -2.75147711f, -0.36352096f, 0.85747874f, 1.11140604f, 0.65593665f, 0.35792228f, 0.54619342f, 0.99489751f, 1.28924616f, 0.96663509f, 1.40602119f, 1.12645860f, 1.07699149f, + 1.92634136f, 2.07569243f, 1.90024169f, 1.55333140f, 1.00662166f, 0.59662392f, 0.41735113f, 0.03712017f, -0.30033462f, -0.70147399f, -1.26150322f, -1.36946469f, -1.49306813f, -1.53593901f, -1.47859712f, -1.37294294f, + 0.41088895f, -0.68758389f, -0.85837881f, -0.86844724f, -0.85475992f, -0.88373397f, -0.82636157f, -0.54233624f, -0.33497780f, -0.06884329f, 0.24209832f, 0.60199869f, 0.83678079f, 1.05727685f, 1.27867768f, 1.49770152f, + -0.45442780f, -0.39381771f, -0.35575987f, -0.28279611f, -0.03460671f, 0.02188475f, -0.06207990f, -0.02068513f, 0.24104453f, 0.35743869f, 0.26392307f, 0.33209979f, 0.34550175f, 0.24362296f, 0.00439669f, -0.20573886f, + -1.38047831f, 0.78167658f, 0.42055729f, -0.93786054f, -1.72548724f, -1.52410071f, -0.47028251f, 0.81491117f, 0.82382622f, 0.46806997f, 0.95867097f, 0.52433344f, -0.02522016f, 0.39885676f, 0.61128096f, 0.26124617f, + 1.92925285f, 1.70790963f, 1.15526536f, 0.66461298f, 0.67490541f, 0.23892474f, -0.12861693f, -0.33635752f, -0.52286346f, -0.56868795f, -0.86695874f, -0.88842939f, -0.86631615f, -0.80495760f, -0.73812023f, -0.64956301f, + -0.46329214f, 0.55823622f, 0.34966614f, -0.14855330f, -0.35757896f, -0.52459469f, -0.85251369f, -0.95064429f, -0.99468342f, -0.76192580f, -0.41419015f, 0.12436151f, 0.64925405f, 1.13684199f, 1.33630964f, 1.31330685f, + 0.86356450f, 0.34381018f, -0.02085849f, 1.83539444f, 2.32518759f, 1.67398143f, 1.25867313f, 1.20615444f, 0.52697956f, -0.09144588f, -0.76159106f, -1.51187022f, -1.92351238f, -1.95050372f, -1.91438733f, -1.85957587f, + 1.24350337f, 2.40332737f, 1.88241131f, 1.35749721f, -0.42200494f, -1.44428015f, -1.39178301f, -0.93577948f, -0.61036359f, -0.51298915f, -0.79745508f, 0.00259692f, 0.20231677f, -0.31281818f, -0.31072767f, -0.35345154f, + -1.27391584f, 0.23665237f, 1.44085187f, 2.06602253f, 1.71605896f, 0.13376293f, -0.37509412f, 0.40922525f, 0.84118074f, 0.94717998f, -0.77859633f, -1.07717911f, -1.15385313f, -1.14774662f, -0.82654451f, -1.15800495f, + 1.30848084f, 0.08937934f, -0.37852967f, -0.65194579f, -0.75067573f, -0.79649158f, -0.77379985f, -0.60797455f, -0.51295495f, -0.32714998f, -0.08812522f, 0.24492207f, 0.48331843f, 0.72894883f, 0.89967800f, 1.13292004f, + -1.59837663f, -0.80221740f, -0.23176726f, 0.53351299f, 0.66646844f, 0.70631763f, 0.72180374f, 0.68847102f, 0.63073539f, 0.46683184f, 0.29870291f, 0.24285644f, -0.04345483f, -0.36903735f, -0.77735195f, -1.13349493f, + -3.27008180f, -3.34427840f, -3.19628867f, -2.98677397f, -2.40944350f, -1.63513906f, -1.40569428f, -0.88190894f, -0.25273952f, 0.84351501f, 1.96278949f, 2.92570176f, 3.17223429f, 3.47899460f, 3.70716828f, 3.29194486f, + 2.58466208f, 2.01534437f, 1.28252767f, 0.44865967f, -0.33100837f, -0.81011259f, -1.06701187f, -1.12743988f, -1.21505758f, -0.99337144f, -0.66853937f, -0.46093443f, -0.22132067f, 0.00996599f, 0.24481197f, 0.30882455f, + -0.62864502f, 1.04984327f, 1.56877053f, 0.77975000f, 0.01037804f, 0.92352492f, 1.12297462f, 0.76284403f, -0.16106015f, -0.21398417f, -0.62673537f, -1.68917053f, -1.60748063f, -0.79116243f, -0.06290217f, -0.43694470f +}; +const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = { + -0.14487037f, 0.32346300f, 0.29798679f, -0.52393127f, -0.25671033f, 0.85717754f, -0.09030235f, -0.41110330f, -0.32938564f, -0.36580017f, -0.13142117f, -0.06404494f, 0.10671000f, 0.18731030f, 0.26606878f, 0.27885301f, + 0.52707061f, 0.35016312f, 0.54090507f, 0.82023896f, 0.46675870f, -0.60012182f, -0.76783382f, -0.39198749f, -0.17916696f, -0.17307722f, -0.10507731f, -0.09327542f, -0.12176361f, -0.12715624f, -0.11980175f, -0.02587481f, + -0.71420988f, -0.65927011f, -0.35007906f, -0.01478187f, 0.15375095f, 0.11149616f, 0.08819131f, 0.11537168f, 0.18041243f, 0.28846009f, 0.61920238f, 0.78709602f, 0.49945852f, -0.03863360f, -0.42339912f, -0.64306599f, + -0.81717379f, 0.06122156f, 0.05823003f, 0.10166328f, 0.27940347f, 0.24198679f, 0.13036228f, 0.07594383f, 0.21865219f, 0.19571948f, 0.11860502f, 0.04836758f, -0.03211315f, -0.14926357f, -0.23274285f, -0.29886216f, + -0.68529960f, -0.60305257f, -0.55080408f, -0.31252031f, 0.02732556f, 0.58303818f, 0.67638004f, 0.45008305f, 0.44400610f, 0.24064307f, 0.01598330f, -0.02342002f, -0.05864021f, -0.08903495f, -0.06326312f, -0.05142446f, + 0.89939472f, 0.31232066f, -0.27153630f, -0.52911639f, -0.58173141f, -0.63610440f, -0.61689761f, -0.43424024f, -0.23705022f, -0.00031150f, 0.15363335f, 0.19705513f, 0.25413198f, 0.35648787f, 0.53897823f, 0.59498626f, + 0.29798691f, 0.08114488f, 0.25286730f, -0.14155021f, -0.55163298f, -0.91534601f, -0.57551866f, 0.56064647f, 0.80731933f, -0.19474923f, -0.20126966f, 0.06517040f, 0.06866947f, 0.09059095f, 0.13444783f, 0.22122305f, + -0.19554741f, -1.08027678f, -0.01182563f, 0.56474090f, 0.41996725f, 0.08237738f, 0.08022205f, 0.10168343f, 0.06794579f, -0.08037661f, -0.20594204f, -0.13493371f, -0.05614077f, 0.03317273f, 0.14216415f, 0.27276933f, + -0.23050462f, -0.75246507f, -0.69868854f, -0.48346371f, -0.40917848f, -0.36594095f, -0.07600729f, 0.12198463f, 0.35806061f, 0.42664099f, 0.36253664f, 0.28721164f, 0.28501428f, 0.31580309f, 0.39290382f, 0.46609294f, + -0.67820482f, -0.00872112f, 0.40025028f, 0.70327670f, 0.42493234f, -0.57698003f, -0.97061329f, -0.62910745f, -0.24969320f, -0.09521511f, 0.04433478f, 0.16549806f, 0.17050527f, 0.26401941f, 0.52200672f, 0.51371134f, + 1.15515222f, -0.29885937f, -0.45759359f, -0.16519237f, -0.04117621f, -0.07252194f, -0.02430911f, -0.04766781f, -0.02328497f, -0.05048145f, -0.05153410f, -0.06528098f, -0.04522347f, -0.01163017f, 0.03517569f, 0.16442759f, + 1.26308471f, 0.47631737f, 0.20702857f, 0.04885555f, 0.01820924f, -0.04929548f, -0.00848071f, -0.02414509f, -0.04549576f, -0.16589601f, -0.22069993f, -0.30533811f, -0.30611208f, -0.31300078f, -0.32636395f, -0.24866742f, + -0.64451248f, -0.26649107f, 0.11640199f, 0.09050698f, -0.25875099f, -0.58989672f, -0.18201608f, 0.56293201f, 0.69520096f, 0.55973258f, 0.03137457f, -0.53909145f, -0.42689946f, 0.14106379f, 0.40632407f, 0.30412130f, + 0.15140746f, 0.14125954f, -0.08456824f, -0.13219101f, 0.06042009f, 0.33575532f, 0.35779441f, 0.19239547f, -0.11511443f, -0.41291307f, -0.06796502f, 0.62883409f, 0.54647417f, -0.03056743f, -0.64102233f, -0.92999908f, + -0.20214866f, 0.33358969f, 0.69126333f, 0.34454972f, 0.05105591f, 0.16949466f, 0.15791728f, -0.06633089f, -0.02155995f, 0.20242418f, 0.31712646f, 0.04823767f, -0.30694375f, -0.55917643f, -0.61612875f, -0.54337052f, + 0.11822897f, -0.04039421f, 0.70914148f, 0.55687588f, 0.06691609f, -0.01671241f, 0.38831368f, 0.48498674f, 0.23982281f, -0.11333950f, -0.44950589f, -0.59143612f, -0.55439378f, -0.42178388f, -0.28206333f, -0.09465644f, + -0.14336086f, 0.05638831f, -0.01441642f, -0.42382782f, -0.38698654f, 0.24817171f, 0.77752198f, 0.25906019f, -0.48986881f, -0.97798705f, -0.62796677f, 0.10790457f, 0.39301453f, 0.49075265f, 0.45648021f, 0.27511976f, + 0.57860103f, -0.01948333f, -0.01550826f, 0.52219942f, 0.68939814f, 0.35139876f, -0.01666617f, -0.21673535f, -0.47658403f, -0.68042929f, -0.65034996f, -0.34910948f, -0.19976833f, -0.03318456f, 0.13815711f, 0.37806438f, + 0.37246276f, -0.08878862f, -0.58662283f, -0.58539914f, -0.25552364f, 0.03268078f, 0.23525090f, 0.52779846f, 0.89804404f, 0.85582758f, 0.41881201f, -0.00512611f, -0.24135956f, -0.44973199f, -0.57601809f, -0.55230687f, + -0.32189259f, -0.20721675f, -0.09742343f, -0.05501794f, -0.02597120f, -0.10341441f, -0.07152803f, 0.00321003f, 0.14348106f, 0.13459909f, 0.13417173f, 0.08360042f, 0.09862647f, 0.09372765f, 0.07551569f, 0.11553216f, + 0.23782332f, 0.49257946f, 0.16314649f, -0.21082378f, -0.15908458f, 0.19948076f, 0.80829724f, 0.74048420f, 0.31470714f, -0.11736674f, -0.41702302f, -0.38958905f, -0.30642209f, -0.41287171f, -0.48993898f, -0.45339847f, + -0.64636094f, -0.04385833f, 0.14399510f, -0.43842603f, -0.73607781f, -0.26594508f, 0.62882301f, 0.35001150f, 0.28828962f, 0.02070640f, 0.04274640f, 0.10066767f, 0.01277906f, 0.02855391f, 0.23224313f, 0.28185233f, + 0.47046627f, 0.94887935f, 0.24713839f, -0.23737461f, -0.23876072f, -0.07439994f, -0.09495447f, -0.13384673f, -0.10919962f, 0.11561096f, 0.34750397f, 0.22863541f, -0.07880257f, -0.39830725f, -0.49574485f, -0.49684374f, + -0.40909559f, -0.18655327f, 0.13106838f, 0.38799987f, 0.49861722f, 0.83281701f, 0.69114756f, 0.20069371f, -0.12792677f, -0.35587040f, -0.42614275f, -0.34440943f, -0.28876141f, -0.27425834f, -0.22103645f, -0.10828931f, + -1.18999475f, -0.19958884f, -0.14983643f, 0.01470880f, -0.02795637f, -0.14641321f, -0.31784893f, -0.46245588f, -0.18208072f, 0.19701783f, 0.59261157f, 0.51921614f, 0.35016513f, 0.38054069f, 0.38692917f, 0.23498570f, + 0.09958109f, -0.26177154f, -0.09010091f, 0.31898761f, 0.75461690f, 0.12276914f, -0.81281416f, -0.78184322f, -0.24358470f, 0.82758568f, 0.36579631f, -0.14176577f, -0.08975069f, -0.12652615f, 0.12350150f, -0.06468093f, + 0.08899403f, -0.19355344f, -0.19424186f, -0.07670148f, -0.01129831f, -0.12185644f, -0.22497393f, -0.43014230f, -0.38336267f, -0.26093033f, -0.06975312f, 0.14762185f, 0.34014822f, 0.41134546f, 0.45027987f, 0.52842445f, + 0.21499436f, 0.50168679f, 0.45504898f, 0.25411634f, -0.47901658f, -0.45717782f, -0.14093183f, 0.17265389f, 0.11115764f, -0.41915721f, -0.31922857f, 0.22345448f, 0.48226916f, 0.07143490f, -0.26830399f, -0.40300051f, + 0.12687524f, 0.05171471f, -0.07690770f, 0.26252085f, 0.27712144f, 0.23952572f, 0.03309903f, 0.01500629f, 0.06484326f, 0.06571283f, -0.16817282f, -0.63246792f, -0.98935090f, -0.44804742f, 0.39837118f, 0.78015619f, + -0.27518648f, -0.48420415f, -0.24141667f, 0.57134912f, 0.65714603f, 0.42293616f, -0.10408493f, -0.38791089f, -0.61076554f, -0.57292363f, -0.09457207f, 0.54285737f, 0.61562883f, 0.23132651f, -0.13569709f, -0.13448269f, + -0.44830103f, 0.90540056f, 0.00072142f, -0.39226111f, -0.46186317f, -0.43645456f, -0.37826714f, -0.24360826f, -0.04123674f, 0.14260549f, 0.22801709f, 0.22668095f, 0.21516528f, 0.17002730f, 0.24853909f, 0.26483493f, + 0.82582984f, -0.18396730f, -0.69977925f, -0.51672827f, 0.33935958f, 1.15275754f, 0.74107352f, 0.01951258f, -0.25558033f, -0.43304939f, -0.34099848f, -0.20947442f, -0.14398117f, -0.10182217f, -0.18238069f, -0.01077166f, + -0.05956926f, -0.06776164f, 0.03443600f, -0.24779379f, -0.39446507f, 0.19355305f, 0.85153169f, -0.02976018f, -0.70253585f, 0.23290277f, 0.42513902f, -0.02301892f, -0.00892405f, -0.00056059f, -0.02586520f, -0.17730813f, + -0.10475355f, -0.12240226f, 0.23596905f, 0.84034179f, 1.10352903f, -0.04380181f, -0.55005573f, -0.07517667f, 0.38548284f, 0.23177362f, -0.44010180f, -0.37858708f, -0.16160512f, -0.18482124f, -0.37409253f, -0.36169852f, + -0.66969186f, 0.05371874f, -0.03936352f, -0.29928720f, -0.41624260f, -0.41299981f, -0.08577629f, 0.31675281f, 0.52331795f, 0.62411866f, 0.60734652f, 0.31853824f, 0.22382100f, -0.00426635f, -0.24809569f, -0.49189053f, + 0.42558925f, -0.08740923f, -0.12413315f, 0.07160194f, 0.21621681f, 0.18737853f, 0.20692231f, 0.06594840f, 0.06316038f, -0.01455973f, -0.09736051f, -0.19278266f, -0.20576965f, -0.20479396f, -0.19511934f, -0.11488934f, + 0.36293062f, -0.57831316f, -0.52476107f, -0.18291608f, 0.05956296f, 0.17827873f, 0.56052629f, 0.90619512f, 0.33375509f, -0.31016948f, -0.35518802f, -0.18057272f, -0.07051228f, -0.11858827f, -0.10671145f, 0.02648366f, + -0.47233802f, -0.10696118f, -0.17385597f, -0.31283671f, -0.54242892f, -0.48720345f, -0.41705631f, -0.17742297f, 0.04283104f, -0.05195671f, -0.10468624f, -0.03852503f, 0.06812391f, 0.59475499f, 1.17499043f, 1.00457125f, + 0.33658160f, 0.35011487f, 0.45187233f, -0.02492518f, -0.55350758f, -0.59303580f, -0.31109052f, 0.13779098f, 0.55888251f, 0.84708841f, 0.47270673f, -0.43127783f, -0.54032183f, -0.34904867f, -0.17752966f, -0.17430036f, + 0.44845114f, -0.49717161f, -0.47780018f, 0.51116217f, 0.25239415f, -0.46774617f, -0.37660723f, -0.11699702f, 0.09542037f, -0.01250943f, 0.20050057f, 0.40176439f, 0.32380431f, 0.15297561f, -0.14232876f, -0.29531216f, + 0.58997624f, 0.33423174f, -0.49272429f, -0.77991590f, -0.63691990f, -0.16375248f, 0.20892044f, 0.18843065f, 0.17599488f, 0.14061586f, 0.15322675f, 0.18367503f, 0.13457790f, 0.01264192f, -0.03498125f, -0.01399761f, + 0.11883889f, -0.17653462f, -0.07102121f, -0.16170325f, -0.31396815f, -0.45007863f, -0.66549732f, -0.56194237f, -0.04368741f, 0.74826150f, 1.05944395f, 0.45896665f, 0.13555009f, 0.05510292f, 0.02009383f, -0.15182464f, + 0.07240272f, -0.58533213f, -0.60637060f, -0.30890106f, -0.02128210f, 0.09681284f, 0.16938452f, 0.09862013f, 0.19046479f, 0.19100352f, 0.26416808f, 0.26993362f, 0.23648423f, 0.09763257f, -0.04637479f, -0.11864633f, + 1.00841842f, 0.48487093f, -0.06341281f, -0.08270476f, 0.05744570f, 0.01750478f, -0.34725114f, -0.56805040f, -0.46574885f, -0.30005483f, -0.09520550f, 0.06924440f, 0.18895007f, 0.12019539f, -0.01497133f, -0.00923003f, + -0.11951983f, -0.09981565f, -0.02725746f, -0.30082482f, 0.20230754f, 0.13666509f, -0.43246623f, 0.35244293f, 0.18119722f, 1.02992782f, -0.88125774f, 0.02331986f, 0.31122766f, -0.27229286f, 0.03194423f, -0.13559793f, + 0.30038871f, 0.08947897f, -0.39317595f, -0.46247446f, -0.42411556f, -0.42404287f, -0.31600225f, -0.23970776f, -0.22563637f, -0.14999339f, 0.24040805f, 0.88216954f, 0.90562440f, 0.49896646f, -0.00532430f, -0.27656328f, + -1.03852817f, -0.43685628f, 0.97570249f, 0.40073542f, -0.16567993f, -0.21536660f, 0.12504130f, 0.05185039f, 0.10097880f, 0.11493671f, 0.11604106f, 0.09278894f, 0.06924125f, -0.04393053f, -0.08352009f, -0.06343456f, + 0.63612744f, 0.65518210f, 0.45922163f, 0.32046049f, 0.42927283f, 0.43905062f, 0.21015594f, -0.14220340f, -0.37678678f, -0.46507109f, -0.45569496f, -0.37686899f, -0.32849396f, -0.33044372f, -0.35635326f, -0.31755504f, + 0.41636915f, 0.62005731f, 0.06636205f, -0.59228655f, 0.33311937f, 0.75787668f, 0.00941011f, -0.45161756f, -0.65103077f, -1.10958672f, -1.02188609f, -0.67703448f, 0.33622739f, 1.61684726f, 0.14432118f, 0.20285196f, + -0.54161629f, 0.29651460f, 0.48390239f, 0.54479388f, 0.45539891f, 0.27213590f, -0.06343843f, -0.24873747f, -0.31972562f, -0.38332671f, -0.30589718f, -0.21560606f, -0.11351916f, -0.04853252f, 0.04142231f, 0.14623145f, + -0.21538006f, -0.50670918f, -0.02385513f, 0.35315677f, 0.10824776f, 0.03860134f, 0.48712274f, 0.49283326f, 0.39503514f, 0.30292369f, 0.35920722f, 0.11075640f, -0.28306221f, -0.52442456f, -0.56662428f, -0.52782887f, + 0.24246654f, 0.15496835f, 0.07742345f, -0.00816546f, -0.02214009f, -0.12207666f, -0.09321134f, -0.14020839f, -0.02096415f, 0.02403039f, -0.00227972f, -0.07257466f, -0.06385085f, -0.03120190f, -0.01017645f, 0.08796095f, + 0.55718201f, 0.39817200f, 0.01585643f, -0.42726280f, -0.49946467f, -0.23926890f, 0.12647764f, 0.16539668f, -0.09322228f, -0.28903514f, -0.36248464f, -0.37621498f, -0.21830881f, 0.12546719f, 0.47757747f, 0.63913280f, + 0.07202509f, -0.30917825f, 0.26796130f, 0.18122649f, -0.74238320f, -0.65070972f, 0.20487278f, -0.03910861f, -0.13788223f, -0.13927704f, 0.30951126f, 0.22564689f, 0.18217460f, 0.23128586f, 0.20552209f, 0.13831273f, + 0.81154454f, 0.16848402f, -0.17973760f, -0.10712113f, -0.08562767f, -0.33154566f, -0.24733460f, -0.19259111f, 0.09705231f, 0.36926093f, 0.39058223f, 0.34681425f, 0.16685070f, -0.13716590f, -0.45775544f, -0.61170978f, + -1.33280729f, -0.16122649f, -0.09275794f, 0.58345947f, 0.61239977f, 0.50766167f, 0.06032890f, 0.13414746f, 0.18885722f, 0.13865434f, 0.23772269f, -0.25267260f, -0.54709895f, -0.31230173f, 0.07737009f, 0.15826345f, + -1.08561454f, -0.71787872f, -0.33522393f, 0.09636394f, 0.26521236f, 0.37639836f, 0.31311513f, 0.09537412f, -0.07885832f, -0.23990515f, -0.16502660f, 0.10895014f, 0.26463981f, 0.29732376f, 0.35578048f, 0.44934924f, + -0.29274363f, 0.08361693f, 0.01766194f, -0.22807328f, -0.16950675f, 0.28608384f, 0.00299181f, 0.07025513f, -0.20633117f, 0.48438844f, 0.91263549f, 0.04231580f, -0.66916627f, -0.44689801f, 0.06041835f, 0.05235140f, + 0.18067823f, -0.43833102f, -0.91255750f, -0.38799121f, 0.28155095f, 0.40506215f, 0.07352559f, -0.10582149f, -0.13688260f, -0.20626464f, -0.13280234f, -0.02533342f, 0.03247104f, 0.20876704f, 0.46466759f, 0.69926172f, + 0.51511088f, 0.81421556f, 0.82445640f, 0.01131859f, -0.32041051f, -0.39839079f, -0.43152495f, -0.42594915f, -0.41684800f, -0.38010709f, -0.25091606f, -0.15334343f, -0.03594408f, 0.06862608f, 0.21814936f, 0.36155722f, + -0.74835512f, -0.03907167f, -0.02730968f, 0.01017743f, 0.06598847f, 0.36210429f, 0.29611340f, 0.34006521f, 0.09628113f, -0.15142368f, -0.62878543f, -0.79996695f, -0.45331571f, 0.20593004f, 0.80186308f, 0.66970511f, + -0.25432502f, 0.38418428f, 0.43145928f, 0.30498956f, 0.19189249f, -0.25021553f, -0.53882666f, -0.61584834f, -0.43654724f, -0.03402395f, 0.45760398f, 0.60327277f, 0.53610474f, 0.16098234f, -0.30297334f, -0.63772932f, + -0.42321919f, 0.85086362f, 0.60159420f, 0.08633772f, -0.28445894f, -0.22512885f, 0.23909004f, 0.20046697f, 0.01484137f, -0.11652413f, -0.12017169f, -0.26922922f, -0.26311675f, -0.18921524f, -0.06712212f, -0.03500777f, + 0.58209071f, -0.26533411f, -0.20240535f, 0.27577532f, 0.65478295f, 0.66491349f, 0.41026256f, 0.22123940f, 0.15813271f, 0.07048989f, -0.03133192f, -0.19389440f, -0.34519672f, -0.53017394f, -0.73238212f, -0.73696843f +}; +const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = { + -0.08443224f, -0.18703635f, -0.02297765f, 0.35108322f, -0.47365404f, 0.60080101f, -0.14560352f, 0.01413276f, 0.01222370f, 0.01369841f, 0.05509108f, 0.03233707f, 0.01187713f, -0.08225931f, -0.08910713f, -0.00617424f, + -0.45134081f, -0.18205893f, -0.21886586f, -0.27082278f, -0.18872267f, -0.08438255f, 0.11808124f, 0.11472340f, 0.08049694f, 0.05868671f, 0.08856118f, 0.10686811f, 0.14792971f, 0.16522330f, 0.21823435f, 0.29738868f, + -0.11328915f, 0.10130429f, -0.14943437f, 0.15645630f, 0.63935450f, 0.37821704f, -0.21310801f, -0.24867988f, -0.01659672f, 0.03328198f, -0.08180066f, -0.05657044f, 0.10906149f, 0.03196869f, -0.22137928f, -0.34878580f, + 0.05458665f, -0.05919364f, -0.13460386f, 0.10683925f, 0.02486665f, -0.03996090f, -0.07800776f, -0.00646458f, -0.21155480f, -0.27387617f, 0.02240932f, 0.70908553f, -0.66258796f, -0.11916859f, 0.46104817f, 0.20658280f, + -0.18236160f, -0.42556974f, -0.01518583f, 0.40249814f, 0.16028064f, -0.31751965f, -0.32775039f, -0.07115151f, 0.14131570f, 0.25092515f, 0.30150209f, 0.11921413f, 0.03049898f, 0.00963513f, -0.00838672f, -0.06794450f, + 0.43233298f, 0.11411029f, -0.14415844f, -0.34176452f, -0.41588457f, -0.29962161f, 0.10637969f, 0.23407196f, 0.10305969f, -0.00062410f, 0.02900924f, 0.03866877f, 0.08640844f, 0.05154612f, 0.00161694f, 0.00484903f, + -0.21512794f, 0.25425865f, 0.27105566f, -0.05213586f, -0.05906940f, -0.26548344f, -0.44413633f, 0.03920286f, 0.46845996f, 0.41236263f, -0.31903770f, -0.32961136f, 0.22647316f, 0.19335126f, -0.03700087f, -0.14356117f, + 0.21924285f, -0.02083234f, -0.21264229f, -0.32008443f, 0.85787441f, -0.31109029f, -0.11710511f, 0.15258065f, -0.05422604f, 0.04703640f, 0.03138786f, 0.00284139f, -0.14128648f, -0.12246651f, -0.12553053f, 0.11430042f, + -0.06983219f, 0.15566395f, 0.00257636f, -0.43107600f, -0.19146497f, 0.19866667f, 0.23130140f, -0.15042179f, -0.31509935f, -0.19492938f, 0.13173040f, 0.34976123f, 0.35522809f, 0.15128504f, -0.03897684f, -0.18441264f, + 0.03835343f, -0.41781092f, -0.09130119f, 0.23649600f, 0.31864720f, 0.31965077f, 0.31997092f, 0.09379415f, -0.07805132f, -0.17350540f, -0.16066354f, -0.15534991f, -0.10595695f, -0.07769963f, -0.06267573f, -0.00389790f, + -0.06072967f, -0.08529762f, -0.25895528f, -0.11410745f, -0.03994694f, 0.00520744f, 0.13029546f, 0.20924505f, 0.20033325f, 0.00128218f, -0.48912530f, -0.29001748f, 0.59798769f, 0.57708579f, -0.00334114f, -0.37991599f, + 0.67709987f, 0.24479940f, 0.09839041f, 0.09240624f, 0.04874621f, -0.07903978f, -0.10677716f, -0.20070119f, -0.12618873f, -0.06680438f, -0.05551493f, -0.11559282f, -0.11011740f, -0.12021879f, -0.12904082f, -0.05144612f, + -0.24390844f, -0.02971498f, 0.26491058f, 0.32477805f, 0.15268137f, -0.03230336f, -0.09305650f, -0.07114758f, -0.26964124f, -0.44939594f, -0.31245133f, 0.05828219f, 0.30712838f, 0.31280972f, 0.10713241f, -0.02610336f, + 0.19735739f, -0.09060264f, 0.00825537f, -0.36599055f, 0.05585799f, 0.37908316f, -0.38413173f, 0.35027949f, 0.34555851f, -0.34241207f, -0.18091006f, 0.16295794f, 0.08399265f, -0.12258257f, -0.08886776f, -0.00784505f, + 0.18552089f, -0.05448505f, -0.06090343f, 0.28995307f, -0.00222442f, -0.38233148f, -0.18031475f, 0.21268787f, 0.02073848f, -0.18932508f, -0.18523794f, -0.18812600f, -0.12671694f, 0.01228197f, 0.22055935f, 0.42792350f, + 0.12799222f, 0.22968936f, 0.03802711f, -0.14099927f, -0.08635323f, 0.16987494f, 0.35348472f, 0.04505467f, -0.26388915f, -0.34916901f, -0.22942166f, -0.17684250f, -0.08724829f, -0.00054213f, 0.12610262f, 0.24423959f, + -0.08038187f, -0.16879152f, -0.00176772f, 0.35376535f, -0.37011098f, -0.36320739f, 0.66636341f, -0.06773157f, -0.07814045f, -0.04765960f, -0.03365673f, 0.02181851f, 0.03254002f, 0.03483427f, 0.02717800f, 0.07494827f, + -0.34868864f, 0.17040333f, 0.25260784f, 0.10076787f, 0.06839398f, -0.02800665f, -0.06848675f, -0.16826923f, -0.07268923f, 0.01087754f, 0.05460110f, 0.00431011f, 0.03885215f, 0.00975901f, -0.01527130f, -0.00916121f, + 0.18571700f, 0.08336153f, 0.02979922f, -0.39409904f, -0.12098272f, 0.43026379f, -0.26722488f, -0.41282119f, 0.02970150f, 0.49897713f, 0.10843837f, -0.24094187f, -0.08115504f, 0.00006204f, 0.10433840f, 0.04656578f, + 0.00538329f, -0.07750994f, -0.10910098f, 0.04048538f, 0.03334399f, 0.28342260f, 0.14581840f, -0.24746813f, -0.34416074f, 0.06151045f, 0.68745611f, 0.19063398f, -0.23771814f, -0.28316033f, -0.12688702f, -0.02204889f, + -0.60521242f, -0.06124017f, 0.11564466f, 0.07475615f, 0.11824730f, 0.14189819f, 0.27204580f, 0.27978428f, 0.25196977f, 0.13866750f, 0.00205101f, -0.10150602f, -0.11644945f, -0.18929950f, -0.17648802f, -0.14486907f, + 0.06856566f, -0.13844197f, -0.26691240f, -0.18845012f, -0.05126065f, 0.00304429f, 0.11414309f, 0.06950182f, 0.19286717f, 0.29037166f, 0.27053650f, 0.17652627f, 0.09171994f, -0.09001258f, -0.24528745f, -0.29691120f, + -0.13004111f, 0.35130055f, 0.29363124f, -0.18853208f, -0.39468716f, -0.19791109f, -0.04383464f, 0.00894901f, 0.12616722f, 0.23070746f, 0.26441755f, 0.01948829f, -0.23089364f, -0.30363455f, -0.02382649f, 0.21869951f, + 0.11164215f, 0.03116967f, -0.06353187f, 0.16924336f, -0.01461062f, -0.19152070f, 0.03686445f, 0.20477538f, -0.03967336f, -0.32744743f, -0.17088429f, 0.63829176f, 0.35280729f, -0.43549735f, -0.27277762f, -0.02885087f, + -0.30725406f, 0.74701729f, -0.39274145f, 0.04302180f, 0.07483049f, -0.03413902f, 0.09344659f, 0.09169015f, 0.04345559f, -0.04477331f, -0.00176985f, -0.03585142f, -0.03405962f, -0.07575575f, -0.09739054f, -0.06972689f, + 0.28265268f, -0.39222951f, -0.42695953f, -0.10897533f, 0.07424889f, 0.08797478f, 0.00908971f, -0.13637855f, -0.12075776f, -0.04977985f, 0.06395383f, 0.09442120f, 0.15174794f, 0.13939497f, 0.13041070f, 0.20118587f, + -0.06637296f, 0.10778732f, -0.07433513f, -0.03524749f, -0.17212396f, -0.11995773f, 0.04291853f, -0.06480863f, -0.07793575f, 0.16559639f, 0.16476497f, -0.45667097f, -0.18714125f, 0.71725922f, 0.42534599f, -0.36907862f, + 0.15419735f, 0.13519411f, 0.37767798f, 0.23431801f, -0.02281061f, -0.05079690f, 0.14170781f, 0.09854410f, 0.01337290f, -0.01979078f, -0.01296254f, -0.03126860f, -0.07566643f, -0.16863998f, -0.32784959f, -0.44522679f, + -0.24074183f, 0.08320241f, 0.21818929f, 0.23760260f, 0.19352113f, 0.17458723f, -0.14563963f, -0.24861723f, -0.22656746f, -0.05362363f, 0.00368164f, -0.25389215f, -0.34172497f, -0.16702059f, 0.23332537f, 0.53371777f, + 0.03933551f, -0.61436501f, 0.74997308f, -0.14605678f, -0.06355008f, -0.07845237f, 0.03677743f, -0.01381658f, 0.03542562f, 0.01940321f, 0.04277388f, 0.01439240f, 0.05417023f, -0.03165523f, -0.04388511f, -0.00047013f, + 0.19660049f, -0.03582845f, -0.21224511f, -0.09633821f, 0.02140122f, 0.06690902f, 0.14753796f, 0.23491232f, 0.40075372f, 0.33318442f, -0.21453422f, -0.44835823f, -0.31995723f, -0.14770359f, -0.02720588f, 0.10087175f, + 0.22313452f, 0.23174662f, 0.13588360f, -0.01979092f, -0.17483898f, -0.36387601f, -0.35104947f, -0.34545228f, -0.17072761f, 0.01654692f, 0.12560464f, 0.14070090f, 0.18025650f, 0.13082045f, 0.10588357f, 0.13515746f +}; +const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = { + -0.01178932f, -0.08216325f, 0.00009975f, 0.07861932f, 0.10639093f, 0.10607783f, -0.11972309f, 0.01910820f, -0.05635505f, 0.02765448f, -0.08840101f, -0.09623400f, 0.34917350f, -0.19835894f, -0.46938213f, 0.43528268f, + -0.08636054f, 0.13923351f, -0.15932705f, -0.10849641f, -0.02303533f, -0.23968519f, -0.02192257f, 0.50128910f, 0.27139459f, -0.07262939f, -0.06622134f, -0.01073419f, -0.04308095f, -0.05629457f, -0.03175020f, 0.00762044f, + 0.24815560f, 0.14657944f, 0.07172491f, 0.02302382f, 0.01991109f, -0.10204469f, -0.24960876f, -0.07085594f, 0.12223419f, 0.06999865f, 0.10986748f, 0.13492392f, 0.05865008f, -0.10366906f, -0.23987720f, -0.23901358f, + -0.15438243f, -0.04559005f, 0.16760111f, 0.26289859f, 0.24002732f, 0.06333052f, -0.04293731f, 0.16191749f, 0.12993586f, -0.15916904f, -0.24049436f, -0.13688115f, -0.13764233f, -0.11140102f, -0.01899323f, 0.02178000f, + -0.09362153f, -0.06475772f, -0.01949932f, -0.04249530f, -0.05109865f, 0.07410551f, -0.01006480f, 0.04753318f, -0.02781557f, 0.07745214f, 0.06146913f, -0.16546467f, -0.41512457f, 0.10097607f, 0.66727071f, -0.13886467f, + -0.07368760f, 0.36035427f, 0.21605884f, -0.01438276f, -0.11360433f, -0.05644934f, 0.03063785f, -0.05006328f, -0.07521149f, -0.13595728f, -0.01277458f, 0.04492285f, 0.01200858f, -0.04176021f, -0.04570247f, -0.04438907f, + 0.09516185f, -0.01929782f, 0.00494854f, -0.09763747f, -0.07344490f, 0.12994610f, 0.48094184f, -0.48192847f, -0.05573409f, 0.26426544f, -0.27655157f, -0.08642901f, 0.08435032f, 0.13304512f, -0.05782422f, -0.04381160f, + -0.09313450f, 0.05540574f, 0.01201341f, -0.06726039f, -0.10451812f, 0.02669040f, -0.05484815f, 0.07449424f, -0.34344135f, 0.56109258f, -0.27428709f, -0.09301413f, 0.41965904f, -0.13902794f, 0.18473846f, -0.16456202f, + 0.08693855f, 0.01453042f, -0.11107078f, 0.06241724f, 0.10204906f, -0.07064796f, -0.13846291f, 0.08293345f, -0.10757619f, -0.22863306f, 0.03213009f, 0.19644778f, 0.16452805f, 0.34110370f, 0.09006750f, -0.51675482f, + -0.18423905f, 0.01384230f, 0.26714303f, -0.40934167f, 0.39275996f, -0.01237613f, -0.25919307f, -0.08619564f, -0.04046283f, -0.01126873f, -0.01664395f, 0.01744563f, 0.10282249f, 0.09607820f, 0.04998616f, 0.07964328f, + -0.02274322f, 0.17908332f, -0.02788687f, 0.00807798f, -0.14435131f, -0.02676761f, 0.10369709f, -0.23851723f, 0.57714821f, -0.24897036f, -0.18048434f, 0.02001729f, -0.12740088f, -0.09982727f, 0.00840552f, 0.22051971f, + 0.13771932f, -0.17471600f, 0.18563016f, 0.18284665f, 0.11307352f, 0.20075992f, -0.03584593f, -0.25044388f, -0.20529947f, -0.11730357f, 0.05388263f, 0.08544750f, 0.04416102f, -0.02585125f, -0.09278592f, -0.10127474f, + 0.08834726f, 0.11313223f, -0.16483942f, -0.28318232f, -0.23943962f, -0.10440104f, -0.03978272f, -0.07375089f, -0.00562577f, 0.02329676f, 0.14600550f, 0.17681015f, 0.14410817f, 0.09264978f, 0.05695417f, 0.06971767f, + 0.14265864f, -0.42999794f, -0.17884255f, -0.08097949f, -0.04680661f, -0.04620171f, 0.02411542f, 0.04266824f, 0.15894248f, 0.24773695f, 0.15192868f, -0.01414995f, -0.13102813f, -0.07567236f, 0.04332535f, 0.19230306f, + -0.21142675f, -0.18455704f, -0.13706857f, -0.09760966f, -0.00844340f, 0.14865602f, 0.20607338f, 0.12012844f, -0.00914924f, -0.14368559f, -0.00265126f, 0.10043210f, 0.09154737f, 0.03443178f, 0.02422327f, 0.06909914f, + 0.18450361f, 0.00435351f, 0.27864126f, 0.17704943f, -0.20479796f, -0.29862599f, -0.17089168f, -0.09881143f, 0.04783000f, 0.14260548f, -0.02349078f, -0.20487241f, -0.13745683f, 0.05546335f, 0.10019847f, 0.14830206f, + 0.10317471f, -0.16998911f, 0.09734737f, 0.06796242f, -0.01161580f, -0.18371589f, -0.08936939f, 0.07107444f, -0.09565406f, -0.23557438f, 0.42834066f, 0.31175412f, -0.11511657f, -0.28572113f, -0.06889545f, 0.17599802f, + 0.11312034f, 0.08666296f, 0.02086535f, 0.12656018f, -0.12520471f, 0.04702581f, 0.39113807f, 0.09775371f, -0.00094471f, 0.08191930f, 0.07626151f, -0.13554986f, -0.29383511f, -0.25857022f, -0.15738811f, -0.06981449f, + 0.07590872f, 0.10290609f, -0.14618577f, 0.13491216f, 0.33869686f, -0.04072549f, -0.30046897f, -0.07243681f, 0.07180300f, 0.23060158f, 0.21642544f, -0.13575731f, -0.31781641f, -0.19431392f, -0.02233810f, 0.05878895f, + -0.11105764f, -0.05437616f, -0.00379085f, 0.08951467f, 0.39169243f, -0.38233560f, 0.34492699f, -0.09947370f, -0.08648526f, -0.03340088f, -0.02593483f, 0.11572014f, 0.01899877f, -0.03965890f, -0.06421047f, -0.06012863f, + -0.01630162f, 0.17784241f, -0.29989778f, 0.10469439f, 0.14861228f, -0.00722859f, -0.10711587f, -0.18435390f, -0.22539717f, -0.21441284f, 0.00336383f, 0.04362196f, 0.03914130f, 0.10650815f, 0.16959322f, 0.26133027f, + -0.45700261f, 0.07282251f, 0.00944859f, 0.03968330f, -0.02457975f, 0.11148291f, -0.02109853f, -0.18417192f, 0.02503845f, 0.10733751f, 0.21565042f, 0.09727523f, 0.00466877f, -0.01572810f, -0.00245341f, 0.02162664f, + 0.01471341f, -0.09796256f, 0.37685840f, -0.27373841f, -0.22809280f, 0.20207443f, 0.12508033f, 0.16172866f, 0.15442152f, -0.03971152f, -0.03731565f, 0.04320052f, -0.02493079f, -0.08894232f, -0.13155708f, -0.15582618f, + -0.04063466f, 0.14873431f, 0.10076527f, -0.09442471f, 0.02133939f, -0.04747602f, 0.02176493f, 0.52606315f, -0.60183613f, -0.05056878f, 0.18858100f, -0.00936749f, -0.17007143f, -0.00822640f, 0.01473704f, 0.00062041f, + -0.01851982f, 0.07661957f, -0.30452796f, 0.64817852f, -0.21819667f, -0.15094971f, -0.02014064f, 0.04976562f, 0.03988913f, 0.00229505f, -0.01596447f, -0.00497683f, 0.01888521f, 0.00912230f, -0.04741494f, -0.06406442f, + -0.18646693f, -0.25658854f, 0.20567339f, 0.06671960f, -0.24836724f, -0.23737029f, 0.03275858f, 0.09293590f, 0.06861982f, 0.01487215f, 0.10808605f, 0.17546010f, 0.16832370f, 0.12557457f, -0.00949461f, -0.12073619f, + -0.08559046f, -0.16350668f, -0.28729498f, 0.01179878f, 0.06195939f, 0.06121501f, -0.29667937f, -0.19145944f, 0.41150010f, 0.18707789f, -0.21406932f, 0.19248440f, 0.16889573f, 0.10825101f, 0.07412737f, -0.03870938f, + 0.00652202f, -0.15316918f, 0.25343593f, -0.09299964f, -0.22861167f, 0.06865193f, 0.02064443f, -0.10488496f, -0.18017250f, -0.21898191f, -0.08742146f, 0.02608617f, 0.05046582f, 0.08687786f, 0.21515984f, 0.33839723f, + 0.12533507f, 0.27191291f, 0.06056226f, -0.10872799f, 0.01799135f, 0.17589055f, -0.05514906f, -0.01148984f, 0.01373578f, -0.08944541f, -0.35717808f, -0.38014180f, 0.05531840f, 0.30742910f, 0.08016039f, -0.10620357f, + -0.01190022f, -0.24441497f, -0.07461266f, 0.02317252f, 0.05704737f, 0.16442883f, 0.06955004f, 0.05748732f, 0.05251523f, 0.22879327f, 0.21860705f, -0.37376474f, 0.03987437f, 0.33071525f, -0.23228300f, -0.30521565f, + -0.00581916f, 0.24592784f, -0.27266538f, -0.28914327f, 0.09129356f, 0.42079957f, 0.05815983f, 0.01136363f, 0.03980200f, -0.04215296f, 0.01465284f, 0.03859289f, -0.13354970f, -0.16935580f, -0.05814064f, 0.05023468f, + 0.44241891f, -0.06885632f, -0.14130761f, -0.04771012f, -0.00863562f, 0.00586591f, 0.12381405f, 0.08059256f, -0.06764947f, -0.22513354f, -0.10536820f, 0.02669478f, 0.01147300f, -0.01584685f, -0.02845628f, 0.01810479f +}; + +const float *const ivas_sns_cdbks_tcx20[SNS_MSVQ_NSTAGES_TCX20] = { ivas_sns_cdbk_tcx20_stage1, ivas_sns_cdbk_tcx20_stage2, ivas_sns_cdbk_tcx20_stage3, ivas_sns_cdbk_tcx20_stage4 }; + +const float ivas_sns_means_tcx20[M] = { + 0.9155f , 1.2408f , 1.0050f , 0.5846f, + 0.2472f , 0.1902f , 0.0984f , 0.1039f, + -0.0139f , -0.0856f , -0.4157f , -0.6148f, + -0.7026f , -0.7216f , -0.8052f , -1.0262f +}; + +const int16_t ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 }; +const int16_t ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 }; + +const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = { + 0.06343891f, -0.00651786f, -0.56994713f, -0.98772396f, -1.35099293f, -1.24848646f, -1.20301995f, -0.81089507f, -0.06563095f, 1.11147581f, 1.73933309f, 1.65859611f, 1.26237806f, 0.68028141f, 0.12449909f, -0.39678907f, + -1.34007175f, -1.50272189f, -2.07958791f, -2.38322761f, -2.22156614f, -1.96435669f, -1.68760863f, -1.23664935f, -0.28772180f, 0.87765579f, 1.83822720f, 1.95281398f, 2.33671266f, 2.76119687f, 2.75790597f, 2.17899850f, + -0.51450332f, 0.69692757f, 1.90898730f, 1.89179379f, 1.41350404f, 0.03604267f, 0.02251128f, -1.04270018f, -0.97981089f, -0.36225564f, 0.14171617f, -0.32050715f, -0.56272675f, -0.38710633f, -0.74842203f, -1.19345103f, + 0.61027733f, -0.25705654f, -0.30960961f, 0.11651829f, 0.08424358f, -0.04474594f, -0.21961636f, -0.26522327f, -0.31681379f, -0.23903185f, -0.07879718f, 0.00383111f, 0.09522293f, 0.15157026f, 0.24747985f, 0.42175137f, + 0.06215930f, 0.74417332f, -0.05737044f, -0.84302341f, -0.79474372f, -0.48758880f, 0.00597663f, 0.39113473f, 0.94133689f, 1.03804127f, 0.53832521f, -0.22235026f, -0.44306288f, -0.22065599f, -0.22880587f, -0.42354568f, + -1.79298887f, -1.27561542f, -0.40453013f, 0.23597108f, 1.02842032f, 1.26211371f, 0.67302878f, 0.34945977f, 0.47749022f, 0.37809966f, 0.32913783f, 0.24544337f, -0.10938763f, -0.26555659f, -0.53889493f, -0.59219154f, + 1.13009762f, 0.63132036f, 0.20308733f, 0.12539517f, -0.05215684f, -0.59255734f, -0.72324525f, -0.47416068f, -0.34730473f, -0.17547668f, -0.01869868f, -0.01336213f, -0.03177292f, -0.01470495f, 0.12726970f, 0.22627027f, + 0.77990892f, 0.11720033f, -0.36217078f, -0.11533103f, -0.09211988f, -0.10379850f, 0.04466728f, 0.23851356f, 0.32838480f, 0.57072608f, 0.78005115f, 0.64032724f, 0.04609407f, -0.53665387f, -1.07338898f, -1.26240993f, + 0.71007500f, 1.67092184f, 0.87004285f, -0.47652190f, -0.41457815f, 1.09228787f, 1.43629613f, 1.29941339f, 0.74914490f, -0.87973861f, -1.00898687f, -0.76690679f, -0.87310138f, -0.89762148f, -1.11083002f, -1.39989674f, + 0.93106313f, -0.58060200f, -1.42018765f, -1.93078113f, -1.40332079f, -1.01406592f, -0.68270775f, -0.12421160f, -0.12818640f, 0.46306788f, 0.74384671f, 1.78170251f, 1.49298768f, 0.36128067f, 0.32905160f, 1.18106291f, + -0.34612942f, -0.05241863f, 0.63278953f, 1.64696186f, 1.83789559f, 1.82381570f, 1.71656555f, 1.45437140f, 1.06980287f, 0.39137818f, -0.16457688f, -0.79497784f, -1.78896933f, -2.38820658f, -2.55386733f, -2.48443600f, + -1.86975241f, -1.08195483f, -0.57202727f, -0.39808906f, -0.40936508f, 0.09703771f, 0.81017115f, 0.38629167f, 0.19481800f, 0.19706778f, -0.03872708f, -0.18683058f, 0.37148725f, 0.91055817f, 0.85929760f, 0.73001606f, + 0.13134993f, -0.43834896f, -0.42233235f, -0.34270675f, -0.42348478f, -0.62064185f, -0.67185252f, -0.57602218f, -0.46183286f, -0.05757593f, 0.38429775f, 0.63679540f, 0.59933007f, 0.44800121f, 0.69922041f, 1.11580320f, + -3.26282616f, -2.43458949f, -1.60312382f, -1.18490625f, -0.63841390f, -0.06739227f, 0.57790279f, 1.01010243f, 0.95682720f, 0.75035821f, 0.76084039f, 0.55166704f, 0.83933875f, 1.36392702f, 1.32925064f, 1.05103737f, + 2.94202112f, 3.01169534f, 2.23272878f, 2.33910012f, 1.97620433f, 1.92572769f, -0.00413067f, -1.30712114f, -1.48714461f, -1.62849896f, -1.56921600f, -1.60110814f, -1.73339679f, -1.81275951f, -1.69381023f, -1.59029306f, + -2.29630904f, -1.61967905f, -0.50968315f, 0.70826746f, 1.31943393f, 1.58078613f, 1.31857322f, 0.52237224f, 0.09330352f, 0.13994471f, 0.02623813f, -0.21467602f, -0.33140340f, -0.32793129f, -0.24016399f, -0.16907333f, + 1.17007844f, 1.46542856f, 1.12327460f, 0.78468376f, 0.28858044f, -0.24345469f, -0.36619581f, -0.30604001f, -0.24486928f, -0.39076408f, -0.42628982f, -0.47126418f, -0.48974406f, -0.58899141f, -0.61209496f, -0.69233731f, + 1.07869290f, -1.09624499f, -1.92296142f, -2.03260639f, -0.72727691f, 0.59938120f, 1.09296276f, -0.23244761f, -0.74213456f, -0.00394467f, 0.65433789f, 0.15922442f, 0.10516506f, 0.08483738f, 1.10833114f, 1.87468404f, + -0.45930662f, 0.49568081f, 0.92195224f, 1.70200988f, 1.24720421f, 1.19845895f, 0.75959352f, 0.23323360f, -0.27099240f, -1.38259199f, -2.25979609f, -0.92875900f, -0.06647214f, -0.58552485f, -0.33254823f, -0.27214292f, + -0.34979667f, 0.75395625f, 0.28769469f, -0.85592098f, -0.65167816f, 0.61099639f, 0.60402617f, 0.14561560f, -0.35073645f, -0.56010271f, -0.46661447f, -0.33527423f, -0.00166125f, 0.46634881f, 0.62977271f, 0.07337395f, + -0.41325825f, -0.71696540f, -0.72218212f, -0.64886200f, -0.33204525f, -0.13777071f, -0.05902665f, 0.08826462f, 0.09668422f, 0.34870144f, 0.76742933f, 1.02820877f, 0.66254418f, 0.26837143f, -0.04920095f, -0.18089312f, + -3.00863529f, -3.40420466f, -1.94263495f, -0.42577604f, 1.34874808f, 1.22039392f, -0.16945247f, -0.55999693f, 0.06330206f, 1.23795253f, 0.30477631f, 0.53425336f, 1.62154688f, 1.44462099f, 0.96061888f, 0.77448714f, + 1.81574209f, 1.72942805f, 0.78817895f, 0.12550764f, -0.50423190f, -0.81032090f, -0.83940826f, -0.95575724f, -0.70482913f, -0.32127670f, -0.08073867f, -0.13170408f, -0.16649118f, -0.08610719f, -0.03381103f, 0.17581953f, + -0.84693001f, -0.20800644f, 0.25371425f, 0.56604831f, 0.68467374f, 0.74501557f, 0.69436428f, 0.53975035f, 0.44393852f, 0.30580817f, 0.06566139f, -0.27742827f, -0.57148395f, -0.67328070f, -0.81658998f, -0.90525565f, + -0.44018762f, 0.22712975f, 1.11402502f, 1.98499541f, 1.52065113f, 0.79057891f, 0.55313940f, 0.32776632f, 0.39113088f, 0.10707747f, -0.20138118f, -0.67412788f, -1.34113027f, -1.39661518f, -1.43118002f, -1.53187281f, + -0.71632657f, -0.79492959f, -1.11328698f, -1.41494496f, -1.48929785f, -1.40383584f, -1.26657215f, -1.11367689f, -0.76426307f, 0.01056535f, 0.85354567f, 1.27473730f, 1.64108006f, 2.08311127f, 2.27822947f, 1.93586484f, + 2.05008554f, 2.18328135f, 1.98567996f, 2.35703511f, 2.27653310f, 2.41056123f, 1.36801069f, 0.12761937f, -0.59913124f, -1.45799255f, -1.89092221f, -1.99613693f, -2.20251841f, -2.33272106f, -2.21702011f, -2.06236397f, + -0.88997509f, -0.45675689f, 0.38059457f, 0.51582524f, 0.11775375f, -0.01509768f, -0.18542670f, -0.33776632f, -0.39018689f, -0.33129536f, -0.13149667f, 0.00113524f, 0.03060501f, 0.32190251f, 0.62848970f, 0.74169479f, + 1.19033790f, 0.59193623f, -0.18758267f, -0.71960274f, -0.81756997f, -0.65024529f, -0.64463404f, -0.82612299f, -0.84513928f, -0.45206413f, -0.04059069f, 0.00434486f, 0.50165507f, 1.00958611f, 0.97568033f, 0.91001135f, + -2.25864394f, -2.18529992f, -1.67272884f, -1.18053068f, -0.96703519f, -0.83661833f, -0.59641534f, -0.08623307f, 0.57868270f, 1.39398557f, 2.00205076f, 1.91429603f, 1.37348845f, 1.02732012f, 0.88340938f, 0.61027091f, + 1.13384373f, 2.01444926f, 1.64076134f, 0.39967630f, 0.11211256f, 0.60599786f, 0.41069653f, -0.08528479f, -0.18299306f, -0.80418851f, -1.03743576f, -1.04941914f, -0.88831874f, -0.76292972f, -0.67716107f, -0.82980704f, + -1.17168042f, -0.44794963f, 0.01219570f, -0.09679638f, 0.01681223f, 0.42983884f, 0.69873962f, 1.14025903f, 1.28455301f, 0.60046712f, -0.18327995f, -0.56883208f, -0.60793720f, -0.38487681f, -0.31833900f, -0.40317432f, + 0.85846316f, 0.89573242f, -0.03759975f, -0.56845446f, -0.63431292f, -0.69230128f, -0.59890012f, -0.27699442f, -0.10781577f, 0.38926803f, 0.44176667f, 0.74409936f, 0.51508281f, -0.44324047f, -0.56579214f, 0.08099815f, + -3.15663729f, -3.79941004f, -3.31993311f, -2.54887019f, -1.08297819f, 1.57490155f, 2.29511481f, 2.21386433f, 2.04448334f, 1.39028095f, 1.22351492f, 1.20294900f, 1.33557966f, 1.22044095f, 0.22504752f, -0.81835038f, + 2.10765319f, 2.66375515f, 1.73697111f, 0.50664812f, -0.22472176f, -0.63409486f, -0.65405139f, -0.71248479f, -0.73053296f, -0.87990271f, -0.82710167f, -0.73244187f, -0.64629112f, -0.47294253f, -0.23431056f, -0.26615160f, + -0.03257826f, 0.53214066f, -0.00109639f, -0.42211164f, -0.51464982f, -0.59747387f, -0.63145473f, -0.49761105f, -0.36163571f, 0.00923799f, 0.32394200f, 0.34648466f, 0.32420111f, 0.44177392f, 0.52684150f, 0.55398991f, + 0.38342101f, 0.05503415f, -0.69210895f, -1.40291256f, -1.20627913f, -0.22810180f, 0.91689677f, 1.67212414f, 1.26349034f, 0.48698570f, 0.10567292f, 0.13423949f, -0.02515828f, -0.41152165f, -0.51320898f, -0.53857267f, + -2.82653388f, -3.73292024f, -3.01554952f, 0.33800837f, 1.63071077f, 3.70049918f, 1.52548217f, -0.51327972f, -0.09119392f, 0.92240352f, 2.33190356f, 1.84268123f, -0.37179294f, -0.94969237f, -1.13179438f, 0.34106773f, + 1.56686851f, 0.88339322f, 0.31264631f, -0.04528796f, -0.42838354f, -0.20342114f, 0.40102389f, 0.54537791f, 0.35383369f, -0.18334298f, -0.75234358f, -0.76217615f, -0.36188398f, -0.46147282f, -0.54662536f, -0.31820590f, + 1.24862641f, 0.57117898f, 0.32856394f, 0.39564440f, 0.31824468f, 0.20893064f, 0.02628416f, -0.15359328f, -0.37616872f, -0.26748355f, -0.12954661f, -0.12215355f, -0.31835718f, -0.55834118f, -0.61233860f, -0.55948996f, + -0.59446013f, 0.48100057f, 1.20941553f, 0.41887505f, 0.63264306f, 1.37297652f, 1.40760513f, 0.91551762f, 0.67322895f, -0.90761879f, -1.23123057f, -0.97622159f, -0.96118737f, -0.53857839f, -0.69473239f, -1.20723297f, + -0.59728936f, -1.63533369f, -2.00769344f, -1.93041740f, -1.52949359f, -0.77428525f, -0.21146300f, 0.18478098f, 0.44962772f, 0.95017605f, 1.24326918f, 1.36658626f, 1.25105966f, 1.00442735f, 1.03660313f, 1.19944572f, + 0.32910504f, 1.16199966f, 2.05499236f, 2.56854877f, 2.45081012f, 1.66017811f, 1.01838813f, 0.51773322f, -0.06505376f, -1.14261830f, -1.77930778f, -1.94467446f, -1.83142606f, -1.76577923f, -1.67433287f, -1.55856482f, + -2.64386625f, -1.44973884f, -0.70503582f, -0.39387129f, -0.07345342f, 0.04530383f, 0.12054861f, 0.18110856f, 0.21747675f, 0.44785123f, 0.60100453f, 0.60149054f, 0.48165166f, 0.67654040f, 0.91879547f, 0.97419414f, + 0.52841759f, -0.23803980f, -0.77847320f, -1.06415798f, -1.29095335f, -0.94613842f, 0.01856631f, 0.57516289f, 0.58685158f, 0.24351075f, -0.23807950f, -0.16772309f, 0.27674343f, 0.40698887f, 0.73162063f, 1.35570347f, + -2.57939825f, -1.65066455f, -0.80960514f, -0.40285025f, -0.02550543f, 0.48071345f, 0.90391140f, 1.61193038f, 1.46090124f, 0.72305123f, 0.34664153f, 0.08297581f, -0.07460306f, 0.06306698f, -0.00946438f, -0.12110157f, + 1.93616583f, 2.87229439f, 2.28910932f, 1.18636717f, 0.28185288f, 0.08337698f, 0.52019726f, -0.70876138f, -1.13139506f, -1.42927692f, -1.07719650f, -0.84569529f, -1.10761102f, -1.14612879f, -0.78606400f, -0.93723475f, + -0.83260061f, -1.02726632f, -0.72610655f, 0.18186308f, 0.34897446f, 0.12845730f, 0.04139028f, 0.52688618f, 0.69166145f, 0.76853602f, 0.83316573f, 0.74702270f, 0.29499833f, -0.33104569f, -0.74851736f, -0.89741947f, + 2.77837874f, 1.31099865f, 0.62870774f, 0.35471489f, 0.05642577f, -0.02869061f, 0.19231930f, 0.50340721f, 0.36258783f, -0.06924684f, -0.52796695f, -0.75396481f, -0.89969036f, -1.23296254f, -1.40215690f, -1.27286039f, + -2.03034497f, -1.73876167f, -1.42952672f, -1.24259095f, -0.92252541f, -0.61137126f, -0.50926746f, -0.37515247f, -0.01804868f, 0.44616051f, 0.86247078f, 1.09558380f, 1.34244283f, 1.77606518f, 1.80302809f, 1.55183866f, + -0.13073542f, 0.74480506f, 1.75612393f, 1.94677409f, 1.45854395f, 0.14973385f, 0.41257896f, 0.78276795f, 0.53033406f, -0.97322979f, -1.31039960f, -1.18457724f, -1.39195239f, -0.74765434f, -0.89874803f, -1.14436551f, + -0.34864040f, 0.37594126f, 1.12760599f, 0.69668388f, 0.42042319f, 0.18779444f, -0.10969643f, -0.21695083f, -0.15889803f, -0.31866683f, -0.31049579f, -0.24646351f, -0.37724204f, -0.33366480f, -0.20076896f, -0.18696143f, + -0.21183487f, 0.60232151f, 0.88716970f, 0.69703105f, 0.10878166f, -0.60737034f, -0.81172315f, -0.92047926f, -0.64811892f, -0.24324457f, 0.15840527f, 0.21438269f, 0.31129327f, 0.53391758f, 0.13740501f, -0.20793704f, + -4.29885487f, -4.07150539f, -2.63799263f, -0.36599561f, 1.44131158f, 1.45858072f, -0.19422385f, -1.06386090f, -0.33862479f, 1.91691551f, 0.64172657f, 0.73115700f, 2.00475202f, 1.65789788f, 1.59229150f, 1.52642575f, + 2.70538594f, 1.21062684f, 0.58857880f, 0.37060452f, 0.32021415f, 0.15108056f, -0.18531087f, -0.47434646f, -0.64590620f, -0.70151444f, -0.68058335f, -0.63299041f, -0.53628956f, -0.62363375f, -0.52279857f, -0.34311771f, + -1.21504940f, -0.39554896f, 0.66755826f, 1.39859234f, 1.07486796f, 1.12290637f, 1.04295204f, 1.14165077f, 1.23441664f, 0.53720217f, -1.08842200f, -1.71470800f, -1.43192570f, -1.01274229f, -0.48508172f, -0.87666906f, + 0.79744189f, 0.76166108f, 0.24454768f, -0.10831092f, 0.07052421f, 0.61249105f, 1.01239329f, 0.92265182f, 0.79053239f, 0.48135056f, 0.14383439f, -0.46575922f, -0.96925167f, -1.31622221f, -1.46252773f, -1.51535724f, + 0.81612871f, -1.33697557f, -1.87521893f, -0.34596308f, 1.89973642f, 0.17905631f, -0.58156390f, -1.21825474f, -1.35128034f, -0.86896364f, -0.55987250f, -0.57592082f, -0.20226923f, 0.35191711f, 1.77194975f, 3.89749413f, + 1.63600586f, 1.88172004f, 2.47282363f, 2.31646225f, 1.68082996f, 0.43732883f, 0.54619537f, 0.53604274f, -0.42499034f, -1.38097531f, -1.67316581f, -1.66333999f, -1.66730967f, -1.61301407f, -1.62366867f, -1.46094527f, + -1.13086259f, -0.59286092f, -0.77851750f, -1.03233519f, -1.00728739f, -0.89574050f, -0.77142682f, -0.49554543f, -0.07881573f, 0.54315382f, 0.97530238f, 1.12272839f, 0.97460042f, 0.97504778f, 1.10466703f, 1.08789246f, + 2.01814493f, 0.44413768f, -0.35041288f, -0.98686383f, -1.26200527f, -1.52732432f, -1.48571248f, -1.19925108f, -0.92116223f, -0.35166881f, 0.13444272f, 0.18334560f, 0.92894956f, 1.08294765f, 1.35106569f, 1.94136698f, + -1.70233870f, -1.07878027f, -0.41699769f, -0.44160483f, -0.44460656f, -0.07853597f, -0.00754784f, 0.33653711f, 1.01426686f, 1.48915964f, 0.89682530f, 0.27439080f, 0.11875833f, 0.11843921f, 0.03694301f, -0.11490828f, + 2.92061289f, 2.48313078f, 1.67219449f, 1.01289511f, 0.89753859f, 0.94593326f, 0.70215728f, 0.23868842f, -0.29061326f, -1.00973596f, -1.40595256f, -1.63034802f, -1.68974684f, -1.71427450f, -1.62221007f, -1.51026992f, + -0.53491548f, -0.78055602f, -0.76775254f, 0.10333314f, 0.89464100f, 1.39260245f, 1.42278905f, 1.08133696f, 0.66191720f, 0.26667076f, 0.06990779f, -0.05792125f, -0.54825802f, -0.97098851f, -1.11014442f, -1.12266153f, + 0.08434699f, -0.45396949f, -0.94011771f, -1.20989965f, -1.27570370f, -1.00735662f, -0.43812010f, 0.32116477f, 0.90682311f, 1.07490930f, 1.04265682f, 0.83531254f, 0.64508330f, 0.31821119f, 0.09966431f, -0.00300507f, + -3.45239663f, -3.47846075f, -3.31323927f, -2.90259299f, -2.36355887f, -1.50192157f, -0.92288952f, -0.22530010f, 0.43258717f, 1.44935400f, 2.42148671f, 2.40769873f, 2.68306011f, 3.17878912f, 2.96783805f, 2.61954501f, + 0.48284645f, 1.41799541f, 1.97243102f, 1.59009976f, 1.22294070f, 0.43320660f, -0.04294311f, -0.31344005f, -0.66525145f, -1.13038241f, -1.07639821f, -0.88736938f, -0.84264379f, -0.79497080f, -0.64026957f, -0.72585115f, + -0.53516472f, -0.76920408f, -0.88526173f, -0.38845075f, -0.11227754f, 0.13805981f, 0.30967527f, 0.39937585f, 0.29135651f, 0.31552367f, 0.32154879f, 0.11114380f, 0.10183365f, 0.23587895f, 0.26513073f, 0.20083182f, + -0.82074713f, 0.00036242f, 0.05382877f, -0.93967714f, -1.34393534f, -0.63769734f, 0.72309703f, 0.71909478f, 0.67996995f, 0.71025231f, 0.03684615f, -0.42385779f, 0.20909277f, 0.74865506f, 0.36478854f, -0.08007303f, + -3.48156475f, -2.62401860f, -1.04625145f, 0.48561624f, 1.08462887f, 1.17430353f, 0.89095108f, 0.61098007f, 0.50455996f, 0.68603781f, 0.79217569f, 0.58623668f, 0.26474313f, 0.08681209f, -0.00104191f, -0.01416800f, + 0.84688039f, 0.96543736f, 0.75181222f, 0.42822852f, 0.24904957f, 0.14177234f, -0.40028407f, -0.85658294f, -0.99971434f, -0.98122097f, -0.75656716f, -0.49934498f, -0.24276416f, 0.09868884f, 0.51868958f, 0.73591908f, + -0.06813618f, -0.46119843f, -0.30096714f, 0.02701580f, 0.39106072f, 0.62007470f, 0.37968778f, 0.26617731f, 0.19689970f, 0.13864013f, 0.13523990f, 0.07059597f, -0.06298216f, -0.21734863f, -0.46878891f, -0.64597009f, + 0.51769554f, 1.42736951f, 1.88530137f, 0.81872770f, 0.32102451f, 1.12825115f, 1.21494458f, 1.01472394f, 0.70810844f, -0.50467729f, -1.98880367f, -2.08711611f, -1.72264586f, -0.93580475f, -0.50571272f, -1.29138527f, + 0.60536537f, -0.70354528f, -1.21617652f, -1.24262631f, -1.19828977f, -1.12565262f, -1.02203112f, -0.75894521f, -0.36826442f, 0.22795933f, 0.70544758f, 0.89015550f, 1.16228260f, 1.29703247f, 1.33542695f, 1.41186140f, + 1.04571798f, 1.61006483f, 1.19302962f, 0.57809989f, 0.71546259f, 1.30149630f, 1.62036473f, 1.44726990f, 1.32882491f, 0.70680094f, -0.39181833f, -1.57019972f, -2.33882246f, -2.53038720f, -2.43836110f, -2.27754281f, + -1.70543716f, -1.02771491f, -0.55943640f, -0.54366014f, 0.38503076f, 1.17876631f, 0.37193454f, -0.12189347f, 0.01303672f, -0.31900986f, -0.63608524f, -0.16956145f, 0.42659413f, 0.80300802f, 1.20767125f, 0.69675704f, + 1.23368326f, -0.17372473f, -0.75359852f, -0.99565343f, -0.84904797f, -0.66289765f, -0.45993622f, -0.17721316f, 0.04972474f, 0.35539595f, 0.55580381f, 0.47907626f, 0.35782172f, 0.37623101f, 0.34327632f, 0.32105845f, + -2.18352213f, -1.61901373f, -1.19957932f, -1.19527760f, -1.04950866f, -0.80750101f, -0.01092868f, 0.85242547f, 1.12490981f, 0.83609667f, 0.69994996f, 0.68985497f, 0.89390672f, 1.14712210f, 1.06776086f, 0.75330468f, + 2.33432113f, 2.91068592f, 2.96537876f, 2.14989074f, 1.35332201f, -0.15166191f, -0.61009155f, -1.11607408f, -1.38841709f, -1.32795548f, -1.18652766f, -1.19841345f, -1.27066378f, -1.28720326f, -1.20653804f, -0.97005218f, + -1.23488338f, -0.82668707f, -0.18190692f, 0.80577567f, 1.40765006f, 1.57572199f, 0.77649472f, 0.06817818f, -0.35316133f, -0.31163295f, -0.22814807f, -0.08516639f, -0.14974413f, -0.40747307f, -0.44196718f, -0.41305033f, + 1.49614141f, 2.17073361f, 1.21828130f, 0.24082715f, -0.04653730f, -0.02674890f, 0.07730547f, -0.75552212f, -0.53247648f, 0.68923075f, 0.51413502f, -1.15304142f, -1.36047405f, -1.08476009f, -0.71333064f, -0.73376398f, + -0.89704242f, -1.73833976f, -1.54624918f, -0.75197415f, -0.28436966f, -0.17513881f, -0.18327761f, -0.08090335f, 0.17526730f, 0.62711579f, 0.87938919f, 0.73687059f, 0.73766468f, 0.77613800f, 0.76077200f, 0.96407748f, + -0.74442989f, 0.06393849f, 0.79593747f, 2.27945407f, 2.65112193f, 2.16937280f, 1.04534068f, 0.40390110f, -0.66651353f, -1.35166042f, -1.46612345f, -0.64581600f, -0.65681647f, -1.60629861f, -1.31557834f, -0.95583049f, + 1.36402643f, 1.80223774f, 0.69837068f, -0.49496040f, -0.78242114f, -0.27168915f, 0.02445085f, -0.20866271f, -0.30035706f, -0.41170635f, -0.35841577f, -0.34242299f, -0.28692410f, -0.02094657f, -0.05934480f, -0.35123483f, + -1.08520561f, -0.84120058f, -0.40604501f, -0.30838475f, -0.39817946f, -0.45244145f, -0.46460261f, -0.31407296f, -0.03689281f, 0.38084328f, 0.75874597f, 0.64589942f, 0.68713572f, 0.85059140f, 0.70295555f, 0.28085506f, + -3.41901495f, -4.05624120f, -2.77833774f, -0.25403214f, 1.87889428f, 1.49402114f, -0.04104013f, -0.12322346f, 0.66403332f, 2.05218773f, 0.76725378f, 0.75987949f, 1.64445951f, 1.18046450f, 0.23904189f, -0.00834539f, + 2.34563559f, 1.85433514f, 0.92188091f, 0.00938003f, -0.66632165f, -1.24128642f, -1.45925477f, -1.45794931f, -1.45009658f, -1.08637380f, -0.53948104f, -0.13215543f, 0.79501605f, 0.54741060f, 0.55538134f, 1.00387907f, + 0.18830608f, 0.82743615f, 0.71353361f, 0.08375013f, 0.72945362f, 1.56781385f, 0.82203061f, -0.15761113f, -1.14514559f, -0.94404839f, -0.45524505f, -0.03539938f, -0.38522988f, -0.55123197f, -0.43254198f, -0.82587158f, + 0.28717168f, 1.26620628f, 1.79284485f, 0.74811924f, 0.75340319f, 0.55244948f, 0.46108770f, 0.62189892f, 0.63524206f, -0.36020964f, -0.49840190f, -0.49783437f, -1.24630499f, -1.48121128f, -1.52882801f, -1.50563245f, + 0.77651863f, -0.09801613f, -0.65368548f, -1.42314584f, -1.95826046f, -2.20248886f, -1.97940063f, -1.63600078f, -1.05805019f, -0.03308653f, 1.18890487f, 1.59425997f, 1.56951997f, 1.72023665f, 1.99206238f, 2.20063258f, + 1.86036810f, 1.95524352f, 1.65802754f, 0.51762484f, 0.32278641f, 1.41534130f, 1.58480385f, 1.00644422f, -0.43304110f, -1.52615221f, -1.54409319f, -1.50951389f, -1.44095494f, -1.33336688f, -1.41459830f, -1.11891940f, + -0.48994782f, -0.25738925f, -0.03744629f, -0.08936731f, -0.21819055f, -0.21749988f, -0.57009207f, -0.68163031f, -0.77904329f, -0.92638722f, -0.49253451f, -0.11015934f, 0.49328977f, 1.25069491f, 1.61419932f, 1.51150480f, + 2.17925129f, 0.65744215f, -0.14102877f, -0.68226531f, -0.86240255f, -0.96233313f, -0.77240075f, -0.60150667f, -0.43620670f, -0.12974041f, 0.06940761f, 0.29313968f, 0.32005914f, 0.04484663f, 0.20342365f, 0.82031433f, + -2.73276927f, -1.95293295f, -1.25302447f, -1.26607638f, -1.03464322f, -0.41097672f, 0.11299908f, 0.61306244f, 1.35234054f, 1.98785456f, 1.65758988f, 0.94482039f, 0.67093436f, 0.60201696f, 0.38959545f, 0.31920903f, + 1.99599002f, 1.78113188f, 1.60094449f, 1.49585133f, 1.05949606f, 0.38027999f, -0.00956917f, -0.37696778f, -0.58734884f, -0.88374264f, -1.14734587f, -1.24114441f, -1.17843206f, -1.09199503f, -0.92371805f, -0.87342960f, + -1.37903570f, -0.79248227f, 0.13536234f, 0.47656459f, 0.43589978f, 0.88461367f, 1.02738581f, 0.55354663f, 0.25049941f, -0.28501314f, -0.80941419f, -0.81019030f, -0.45648923f, 0.11389766f, 0.39621982f, 0.25863532f, + 2.10361489f, 0.37593562f, -0.16944555f, -0.32212923f, -0.22241176f, -0.24351656f, -0.27375398f, 0.02762124f, 0.11073362f, 0.23273069f, 0.27063497f, 0.08607178f, -0.19792432f, -0.48410706f, -0.59195084f, -0.70210352f, + -3.28081022f, -2.84286219f, -2.41405615f, -2.18965898f, -1.85813828f, -1.04835079f, -0.44771380f, 0.59206456f, 1.50301948f, 2.07448941f, 2.16550955f, 1.89856464f, 1.75678779f, 1.60095964f, 1.36941840f, 1.12077632f, + 1.20650745f, 1.87107653f, 1.86883453f, 1.42456949f, 0.48789223f, -0.72412798f, -1.11112426f, -1.49029508f, -1.30798779f, -1.39394685f, -1.21186297f, -0.51923241f, 0.01995250f, 0.34176002f, 0.40195072f, 0.13603383f, + 1.27785134f, 0.88553037f, 0.16900733f, -0.27809430f, -1.01525323f, -1.49395836f, -1.43232130f, -1.19784251f, -0.74210861f, -0.08619940f, 0.47709237f, 0.55331864f, 0.84110624f, 0.88279667f, 0.58250791f, 0.57656718f, + 0.33221429f, 1.11386403f, 0.75316099f, -0.54031614f, -1.07863165f, -0.21932249f, 1.22065947f, 1.15034668f, 1.03141160f, -0.31201434f, -1.38480174f, -0.81360834f, -0.27523041f, 0.24071536f, -0.19254386f, -1.02590322f, + -1.49213877f, -2.62687029f, -1.76800978f, 0.37484393f, 2.24342021f, 1.70797214f, 0.00785579f, -0.16576749f, 0.40170467f, 1.53774796f, 0.29192482f, 0.32972463f, 0.96040034f, 0.07052406f, -0.75744205f, -1.11588939f, + 1.68310221f, 0.62723214f, -0.21848789f, -0.50907306f, -0.77679516f, -0.86027718f, -0.37120564f, 0.20445818f, 0.27312526f, -0.13982446f, -0.56141448f, -0.66669228f, 0.06397763f, 0.19621457f, 0.32877219f, 0.72688794f, + 0.71839263f, 0.21641507f, 0.34358239f, 1.05799089f, 1.05814284f, 0.52787967f, 0.14046002f, 0.11966559f, 0.07361240f, -0.17447064f, -0.37909417f, -0.61722985f, -0.71730019f, -0.79744166f, -0.77133987f, -0.79926472f, + -0.02890014f, 0.92802997f, 1.03744813f, 0.32870919f, 0.07886022f, 0.63362031f, 0.46497182f, 0.14157700f, -0.03057580f, -0.54785692f, -1.11970728f, -1.36023434f, -0.91731394f, 0.07493639f, 0.47210281f, -0.15566707f, + -0.69638941f, -0.91666102f, -1.56178072f, -1.95501706f, -1.82786692f, -1.74880889f, -1.34684465f, 0.11048340f, 1.37545972f, 1.36714659f, 1.44286472f, 1.29857548f, 1.10826459f, 1.56371080f, 1.18624590f, 0.60061806f, + -0.68066861f, 0.38195183f, 1.51822296f, 2.21510524f, 2.33189221f, 1.97513513f, 1.15635207f, 1.51498823f, 1.49065161f, -0.27868821f, -1.78208773f, -2.20070549f, -2.26038069f, -2.05737950f, -1.59696081f, -1.72742716f, + -2.17324712f, -1.42748120f, -0.47105336f, 0.06399853f, -0.10139724f, -0.33208523f, -0.36226578f, -0.45684329f, -0.45421750f, -0.02950979f, 0.57908509f, 0.82823657f, 0.84044612f, 0.96336259f, 1.18058199f, 1.35238916f, + 0.30637595f, -0.07750454f, -0.01603143f, -0.03845729f, -0.46768884f, -0.33028351f, 0.33893858f, 0.66006523f, 0.64603598f, 0.25681503f, -0.24604284f, -0.37133227f, -0.20588021f, -0.28072164f, -0.22555667f, 0.05126849f, + -1.81904207f, -1.97008939f, -1.38138723f, -0.56721565f, 0.08439254f, 0.50012417f, 0.41461731f, 0.70946239f, 0.65844196f, 0.50418711f, 0.67016347f, 0.85608609f, 0.63818532f, 0.38340644f, 0.22816114f, 0.09050718f, + 3.82551321f, 3.02994002f, 1.79732057f, 1.05862951f, 0.33021546f, 0.01969982f, -0.57482284f, -1.10367492f, -1.21202781f, -1.06293594f, -0.97966329f, -1.01767532f, -1.10340104f, -1.13918652f, -1.02503523f, -0.84289579f, + -2.06530906f, -1.02138773f, 0.19121847f, 0.64135688f, 0.47353945f, 0.29125589f, 0.17346435f, 0.09846354f, 0.14173379f, 0.44108119f, 0.42909595f, 0.13671490f, -0.09429711f, 0.06651142f, 0.02429001f, 0.07226851f, + 1.63249192f, 0.94436017f, 0.65530634f, 0.76476367f, 1.10302458f, 1.20701875f, 0.88073298f, 0.43640158f, -0.07220279f, -0.39214092f, -0.60759685f, -0.87296187f, -1.13810886f, -1.40490240f, -1.54422408f, -1.59196182f, + -2.96354446f, -2.66922503f, -2.35080143f, -1.84250497f, -1.24255764f, -0.53451683f, -0.22318900f, 0.15923121f, 0.44185767f, 0.90571587f, 1.20883041f, 1.21786822f, 1.54160670f, 2.22751201f, 2.21090650f, 1.91281110f, + -0.09062710f, 0.80687377f, 1.69510603f, 2.38364009f, 2.08626387f, 1.00304738f, 0.66997543f, 0.04541459f, -0.35848319f, -0.80600051f, -1.65487629f, -2.04562701f, -2.03869244f, -1.11898388f, 0.04427361f, -0.62130392f, + -0.99015493f, -0.47096904f, 0.39660329f, 1.29486538f, 1.58962509f, 0.33608325f, -0.41798602f, -0.54749259f, -0.00991716f, -0.02240745f, -0.93933104f, -0.69735917f, -0.17095973f, 0.19272004f, 0.29655039f, 0.16013060f, + -0.50032252f, -0.00936927f, 0.13895740f, 0.11955067f, -0.00882381f, -0.31634261f, -0.30280409f, -0.10222302f, -0.04951847f, 0.13870349f, 0.43344396f, 0.56559398f, 0.24092822f, -0.05903140f, -0.12616386f, -0.16257807f, + -4.66891396f, -4.62476618f, -2.72504562f, -0.11626174f, 1.38983931f, 1.37676145f, 0.15183709f, -0.07491020f, 0.54070200f, 1.84266982f, 0.65624201f, 0.70100510f, 1.81013255f, 1.75739872f, 0.97189375f, 1.01141647f, + 3.82513926f, 1.74864093f, 0.71663856f, -0.06702053f, -0.46144066f, -0.68679697f, -0.83513366f, -0.69088271f, -0.63484378f, -0.48492965f, -0.30596681f, -0.27767202f, -0.29901877f, -0.55135905f, -0.55561568f, -0.43973879f, + -1.83506374f, -1.72166910f, -0.66010462f, 1.71984506f, 2.40983158f, 1.81667012f, 1.44944523f, 1.31000271f, 0.86661928f, 0.58345030f, -0.05866711f, -0.37487717f, -0.74598532f, -1.38021702f, -1.58454113f, -1.79473786f, + 0.16939787f, 1.05222199f, 0.60925979f, -0.08245082f, -0.05127361f, -0.01958411f, -0.04649851f, 0.11008216f, 0.21213694f, -0.02520358f, -0.00574917f, -0.04591061f, -0.24174211f, -0.38605009f, -0.52417208f, -0.72446423f, + -0.07063893f, -1.74970518f, -1.79098807f, -1.50819293f, -1.06029380f, -1.44474701f, -1.24662095f, -1.20341521f, -1.18506899f, -0.88327503f, -0.47818767f, 0.53478172f, 1.99588317f, 2.01785324f, 2.86156101f, 5.21105441f, + 1.18577996f, 1.82923029f, 2.00218590f, 1.75897045f, 1.55666666f, 1.15213194f, 1.02264996f, 0.58845201f, 0.39345304f, -0.25590088f, -1.11168611f, -1.75581078f, -2.05745836f, -2.20440070f, -2.14031291f, -1.96395016f, + -0.49703383f, -0.62650520f, -0.98853522f, -1.16849765f, -1.02786508f, -0.51447634f, -0.02538523f, 0.08704333f, 0.03359763f, 0.17774887f, 0.30484412f, 0.32520735f, 0.62948522f, 1.14552041f, 1.22336987f, 0.92148234f, + -0.07188198f, 0.18500810f, -0.22096354f, -0.56851679f, -0.98832362f, -1.20304996f, -1.11943691f, -1.09383807f, -0.85446062f, -0.29360582f, 0.44439822f, 0.64306330f, 1.09971537f, 1.50142342f, 1.36382024f, 1.17664847f, + -1.21730935f, -1.48884440f, -1.78500620f, -1.57607634f, -0.82775565f, -0.09612994f, 0.49933981f, 1.06136160f, 1.31463011f, 1.46090638f, 1.14896512f, 0.64320117f, 0.39111587f, 0.36061229f, 0.18325675f, -0.07226660f, + 2.30575156f, 2.37005513f, 1.37776397f, 0.78509487f, 0.18022242f, -0.13093354f, 0.22126477f, -0.11444642f, -0.35716968f, -0.59492665f, -0.35765935f, -0.44655201f, -1.03213345f, -1.27074059f, -1.44000075f, -1.49558947f, + -1.00874079f, -1.64011865f, -1.86084729f, -1.06805908f, 0.07222945f, 1.36179475f, 1.87160360f, 1.76248472f, 1.52374330f, 1.04119855f, 0.73448166f, 0.13768018f, -0.49711929f, -0.73696841f, -0.89885406f, -0.79450886f +}; +const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = { + 0.30627323f, 0.48836579f, -0.02716944f, -0.47680077f, -0.52992614f, -0.25467720f, -0.13298242f, -0.14929291f, -0.14808149f, 0.08665801f, 0.28830653f, 0.27526330f, 0.09942358f, -0.01755061f, 0.03315580f, 0.15903469f, + 0.40931263f, -0.04412117f, -0.08826419f, 0.38716891f, 0.51515595f, 0.42227845f, 0.34963425f, 0.26800736f, 0.03770000f, -0.19967080f, -0.31044249f, -0.32623294f, -0.38445978f, -0.38085950f, -0.38590829f, -0.26929836f, + -0.16037262f, -0.37557223f, -0.41481262f, -0.12384627f, 0.25702942f, 0.29593484f, 0.04534352f, -0.04349856f, -0.11439445f, -0.20184919f, 0.03250628f, 0.58473249f, 1.07468564f, 0.31789485f, -0.43837532f, -0.73540590f, + -0.72021067f, 0.08601834f, 0.36444345f, 0.07734969f, -0.03855524f, -0.02016363f, 0.22787880f, 0.23660595f, -0.06162934f, -0.60111840f, -0.53416841f, -0.01411490f, 0.31545914f, 0.35328934f, 0.27371155f, 0.05520477f, + 0.17033204f, -0.13395098f, -0.17486207f, -0.16431307f, -0.15028250f, -0.16217158f, 0.20788205f, 0.78892741f, 0.82887028f, 0.27828798f, -0.09961411f, -0.26525390f, -0.29531330f, -0.31862369f, -0.30357092f, -0.20634333f, + 0.66971623f, 0.62862982f, 0.51073654f, 0.36780819f, 0.09494981f, -0.26895298f, -0.43607248f, -0.52929484f, -0.50226353f, -0.28888748f, -0.08077826f, 0.07870787f, -0.04066089f, -0.15014043f, -0.07631337f, 0.02281584f, + -0.14637266f, -0.46934298f, -0.43556714f, -0.11250329f, 0.02177593f, -0.06273200f, -0.10608254f, -0.23883852f, -0.34273025f, -0.21064510f, 0.01000878f, 0.26290329f, 0.36940740f, 0.45606583f, 0.50057089f, 0.50408231f, + -0.63822919f, -0.37848043f, -0.12025765f, 0.46869706f, 0.60287599f, 0.40487467f, 0.32284423f, 0.21760285f, 0.02923608f, 0.00961581f, 0.09146575f, 0.01422525f, -0.19921025f, -0.27268562f, -0.30705403f, -0.24552069f, + 1.00438179f, 0.03452909f, -0.36528888f, -0.16282387f, -0.17507552f, -0.16366972f, 0.01988929f, 0.04208138f, -0.09195065f, -0.12550201f, -0.13827904f, -0.15519976f, -0.13718296f, -0.04187317f, 0.11795197f, 0.33801187f, + -0.29872646f, -0.05673935f, 0.22627715f, 0.35384240f, 0.40583411f, 0.05342130f, -0.33165017f, -0.58372192f, -0.59880799f, -0.13860904f, 0.35292935f, 0.42680564f, 0.12541820f, -0.05244271f, 0.02304693f, 0.09312233f, + -0.62056798f, -0.65569894f, -0.39193684f, -0.23470135f, -0.10487732f, -0.02415277f, 0.10485475f, 0.27475842f, 0.33639795f, 0.28659695f, 0.29816270f, 0.35486347f, 0.22178257f, 0.06294332f, 0.00371302f, 0.08786182f, + -0.24167361f, 0.39335919f, 0.45401345f, -0.01359878f, -0.02799250f, 0.03219280f, -0.03498926f, 0.13917253f, 0.56998817f, 0.30076805f, -0.02861530f, -0.08301223f, -0.23268793f, -0.25582563f, -0.40349390f, -0.56760551f, + -0.25453749f, 0.20141031f, 0.13622118f, 0.02192458f, 0.01884274f, 0.35426017f, 0.30533029f, -0.04383371f, -0.03213904f, 0.48723585f, 0.26916690f, -0.57914714f, -0.86274497f, -0.46431975f, 0.21456299f, 0.22776732f, + 0.10091242f, -0.00486621f, 0.15438553f, 0.58933636f, 0.58327809f, 0.15020643f, -0.13942120f, -0.30560120f, -0.39802935f, -0.42014770f, -0.43506227f, -0.49122908f, -0.24162334f, 0.07789107f, 0.33589368f, 0.44407700f, + -0.86901291f, -0.12649490f, 0.37769660f, 0.32335451f, -0.09778731f, -0.30169760f, -0.11330902f, 0.06975956f, 0.10852794f, 0.10187023f, 0.01908335f, -0.02063501f, -0.02583787f, 0.01976747f, 0.15814638f, 0.37656868f, + 0.04263499f, 0.02090495f, 0.31860242f, 0.23302977f, -0.33090591f, -0.80333458f, -0.73651770f, -0.34102413f, 0.01204330f, 0.27818705f, 0.45925162f, 0.49138398f, 0.30213637f, 0.14165342f, -0.01743260f, -0.07061291f, + -0.33546750f, 0.07559517f, -0.29917689f, -0.73625773f, -0.65250278f, -0.17791468f, 0.36283358f, 0.41870726f, 0.25167625f, 0.10475438f, 0.03036614f, -0.11264997f, 0.02694511f, 0.35023967f, 0.42385566f, 0.26899640f, + 0.35439950f, 0.67540976f, 0.38662754f, 0.00957348f, -0.04081569f, 0.08980026f, 0.24456400f, 0.16454453f, -0.17326799f, -0.44054817f, -0.46528410f, -0.40046956f, -0.28220380f, -0.18741583f, -0.03688613f, 0.10197206f, + 0.42543134f, 0.16124378f, -0.11664388f, -0.16052109f, -0.14380996f, -0.20548992f, -0.07681681f, -0.05550879f, -0.19682147f, -0.44926335f, -0.31008693f, 0.10843293f, 0.56978845f, 0.55547148f, 0.11319503f, -0.21860065f, + -0.29805544f, -0.51653600f, -0.50993841f, -0.23042275f, 0.24667415f, 0.49673729f, 0.44572321f, 0.45012593f, 0.15926189f, -0.25316153f, -0.34302757f, -0.25146569f, -0.04585493f, 0.07882198f, 0.19017230f, 0.38094576f, + 0.32844224f, 0.41193928f, 0.40958218f, 0.23076367f, -0.27298459f, -0.73724149f, -0.33139249f, 0.20850941f, 0.29246785f, 0.02387269f, -0.22298162f, -0.22401730f, -0.10602946f, -0.10948655f, -0.04914188f, 0.14769834f, + -0.17579666f, 0.35780877f, 0.71235588f, 0.55448086f, 0.37958752f, 0.25325181f, 0.00067976f, -0.17449727f, -0.19933258f, -0.18272217f, -0.13825657f, -0.13482936f, -0.26973501f, -0.36527057f, -0.38046021f, -0.23726392f, + 0.18763378f, -0.33806505f, -0.40345471f, -0.16420458f, -0.35258917f, -0.57440801f, -0.40444473f, 0.03937379f, 0.28301143f, 0.24202773f, 0.11450746f, -0.01201630f, 0.15584175f, 0.29186178f, 0.39454798f, 0.54037647f, + 0.22483690f, -0.44980090f, -0.04869487f, 0.59069175f, 0.53952189f, -0.08294351f, -0.50222392f, -0.24118691f, 0.23316504f, 0.15935219f, -0.04441873f, 0.04368785f, -0.01936622f, -0.19829407f, -0.17269697f, -0.03162974f, + 0.86145933f, 0.21872440f, 0.03989593f, 0.02383014f, -0.09253274f, -0.16857595f, -0.11671737f, 0.08021353f, 0.06125647f, 0.12344152f, 0.23383136f, 0.23023986f, 0.00554465f, -0.33666994f, -0.57850362f, -0.58543742f, + 0.51765053f, 0.14453794f, -0.21849231f, -0.46766148f, 0.28518641f, 0.98554209f, 0.04290847f, -0.60417524f, -0.40619174f, 0.07096948f, -0.07934046f, -0.11108689f, 0.01736604f, 0.02182622f, -0.13816306f, -0.06087569f, + 0.48940455f, -0.48846716f, -0.76449136f, -0.43167975f, -0.08214146f, 0.11409731f, 0.23323066f, 0.14717357f, 0.03539665f, 0.18939153f, 0.30742449f, 0.25985980f, 0.09542412f, -0.02333196f, -0.07732568f, -0.00396539f, + -0.11187535f, 0.22479868f, 0.00043228f, -0.32181417f, -0.15096473f, 0.43016822f, 0.70121781f, 0.35219596f, -0.12050155f, -0.23287073f, 0.15265180f, 0.19690580f, -0.06424055f, -0.21596133f, -0.38579166f, -0.45435087f, + -0.22289529f, -0.33733328f, 0.06840735f, 0.09280703f, 0.04636627f, 0.21910935f, -0.03558133f, 0.03650325f, 0.61258277f, 0.50575298f, -0.41287364f, -0.69151766f, -0.55346043f, 0.16231747f, 0.54407303f, -0.03425754f, + -0.01396139f, 0.41256481f, 0.28386076f, -0.13079544f, -0.35049882f, -0.37139357f, -0.26190236f, -0.28543916f, -0.36404168f, -0.41216213f, -0.30446824f, -0.16554805f, 0.07635435f, 0.40718475f, 0.72148357f, 0.75876291f, + -0.78143464f, 0.05520810f, 0.09851993f, -0.35088396f, -0.29183273f, 0.13535467f, 0.10630173f, -0.35151176f, -0.27502696f, 0.15923208f, 0.34325564f, 0.26263384f, 0.39924614f, 0.42088604f, 0.20935571f, -0.13930422f, + -0.20363163f, -0.21557857f, -0.16300691f, -0.04183005f, -0.11100316f, -0.05771045f, 0.03898740f, 0.01316220f, 0.17362802f, 0.74914331f, 0.94477958f, 0.44778038f, -0.09421183f, -0.32736334f, -0.50631884f, -0.64682642f +}; +const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = { + 0.15213764f, -0.12778955f, 0.09362990f, -0.08343056f, -0.25379718f, 0.12518895f, 0.29943288f, -0.09857322f, -0.34816031f, -0.24349585f, -0.11266650f, -0.05996015f, 0.03254247f, 0.15532134f, 0.23410563f, 0.23551447f, + -0.16242282f, -0.11097776f, -0.31747514f, -0.25628076f, 0.13836003f, 0.29861681f, 0.10506779f, 0.11734717f, 0.26608658f, 0.05454060f, -0.14603348f, -0.19239843f, 0.04173306f, 0.20966631f, 0.07432020f, -0.12015035f, + -0.05086737f, 0.14763099f, -0.10027459f, -0.32093478f, -0.17515530f, -0.18641303f, -0.27141947f, -0.07787662f, 0.00378069f, -0.04285463f, 0.10140687f, 0.34974771f, 0.30832793f, 0.10107726f, 0.07691200f, 0.13691240f, + -0.19149570f, -0.03034820f, 0.22501633f, 0.07949802f, -0.27147765f, -0.19613243f, 0.27922429f, 0.35035416f, 0.10414276f, 0.00614821f, 0.06550601f, 0.11675054f, 0.03695278f, -0.13039057f, -0.22716902f, -0.21657951f, + 0.26536712f, -0.20814302f, -0.25065997f, 0.11971631f, 0.27275427f, 0.17786545f, -0.00254739f, -0.12770659f, -0.22797897f, 0.00768447f, 0.21340357f, 0.19482691f, 0.04586545f, -0.11847485f, -0.17809566f, -0.18387694f, + 0.25667429f, 0.24654641f, 0.10151031f, -0.02938848f, -0.14360442f, -0.13987667f, -0.20754252f, -0.19670735f, 0.17496815f, 0.41594389f, 0.13093074f, -0.20541061f, -0.16236246f, 0.04068170f, -0.03728146f, -0.24508149f, + -0.08722397f, 0.02295918f, 0.00051204f, 0.07408103f, 0.14389321f, 0.06786859f, 0.00359252f, 0.11717038f, 0.08740562f, 0.00119184f, -0.07592203f, -0.11362449f, -0.31422561f, -0.38910675f, -0.02291088f, 0.48433932f, + -0.18216919f, 0.06012195f, 0.24774113f, 0.41673922f, 0.28902704f, -0.14711768f, -0.20580810f, -0.08400793f, -0.06024452f, -0.19915854f, -0.17662518f, -0.08993148f, 0.01116638f, 0.13122555f, 0.08011919f, -0.09107791f +}; + +const float *const ivas_sns_cdbks_tcx10[SNS_MSVQ_NSTAGES_TCX10] = { ivas_sns_cdbk_tcx10_stage1, ivas_sns_cdbk_tcx10_stage2, ivas_sns_cdbk_tcx10_stage3}; + +const float ivas_sns_means_tcx10[M] = { + 0.9510f , 1.1892f , 0.8969f , 0.3467f, + 0.1347f , 0.1074f , 0.0504f , -0.0790f, + -0.1305f , -0.3713f , -0.5611f , -0.5757f, + -0.4801f , -0.4108f , -0.4564f , -0.6112f +}; + +const int16_t ivas_sns_cdbks_side_tcx20_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 32 }; +const int16_t ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 }; +const int16_t ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 }; +const int16_t ivas_sns_cdbks_side_tcx10_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 3 }; + +const float ivas_sns_means_side_tcx20[M] = { + -0.0181f , 0.0044f , 0.0133f , 0.0096f, + 0.0073f , 0.0038f , 0.0058f , 0.0015f, + -0.0046f , -0.0096f , -0.0099f , -0.0173f, + -0.0075f , 0.0049f , 0.0023f , 0.0141f +}; + +const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = { + -0.09561560f, -0.07036320f, 0.02878750f, 0.03511974f, 0.17132389f, -0.03138941f, -0.33178799f, -0.21216198f, -0.04445341f, 0.02221417f, 0.02283919f, 0.03233147f, 0.08941267f, 0.12190493f, 0.12476806f, 0.13706984f, + 0.00109929f, 0.08875231f, 0.22238215f, 0.21457590f, 0.10015343f, 0.04638508f, 0.03393346f, -0.00874452f, -0.04376851f, -0.07742100f, -0.07534945f, -0.10337673f, -0.10407952f, -0.11112585f, -0.09133646f, -0.09207950f, + -0.24818594f, 0.26921203f, 0.44107852f, 0.17248048f, 0.64417785f, 0.17680036f, 0.13990282f, -0.00956079f, 0.26766161f, -0.03617849f, -0.51006953f, -0.14559280f, 0.04585566f, -0.32296828f, -0.43440915f, -0.45020472f, + -0.02603883f, -0.10893371f, -0.10500311f, -0.11573136f, -0.10145701f, 0.08950274f, 0.26393655f, 0.16421642f, 0.06653788f, 0.02055681f, 0.03165200f, -0.00660730f, -0.02920382f, -0.04413712f, -0.04586630f, -0.05342379f, + 0.42792206f, 0.05873236f, -0.03519993f, -0.02404930f, -0.02129021f, -0.02228539f, -0.05794333f, -0.05329147f, -0.02713142f, -0.02536622f, -0.01781476f, -0.04129741f, -0.03786846f, -0.04699464f, -0.04049980f, -0.03562223f, + 0.02055988f, 0.02639971f, 0.00689886f, 0.00418128f, -0.01634280f, 0.00921734f, 0.00364626f, -0.03176210f, -0.04382792f, -0.01247039f, 0.02183370f, -0.00002241f, -0.00402301f, -0.00566646f, 0.00978385f, 0.01159419f, + 0.19157117f, 0.21950742f, 0.18377101f, -0.02875442f, -0.28243126f, -0.54171973f, -0.31264637f, -0.03676636f, 0.00528891f, -0.04001921f, 0.08505054f, 0.06946939f, 0.13428842f, 0.15810925f, 0.11903950f, 0.07624180f, + -0.30190937f, -0.29575446f, -0.26060885f, -0.18754051f, -0.14798754f, -0.10966049f, -0.13245975f, -0.11017279f, -0.08153340f, -0.06447313f, 0.04034392f, 0.17641778f, 0.25731939f, 0.31027339f, 0.40673221f, 0.50101364f, + -0.47842978f, -0.03818905f, 0.07056377f, 0.03300345f, 0.02730699f, 0.05007915f, 0.02893237f, 0.02226785f, 0.04222222f, 0.04128904f, 0.03830734f, 0.01743857f, 0.03607951f, 0.02582752f, 0.04198512f, 0.04131589f, + -0.02242885f, 0.01802990f, -0.00361209f, 0.02714255f, 0.04843318f, 0.04306928f, 0.02675985f, 0.07964815f, 0.10019006f, 0.05262710f, 0.00113825f, -0.04747375f, -0.04988074f, -0.05204562f, -0.09989329f, -0.12170389f, + 0.28967652f, 0.36512749f, 0.38343313f, 0.37459919f, 0.29419461f, 0.21272806f, 0.14963422f, 0.11987446f, -0.00354946f, -0.11817788f, -0.21991893f, -0.37389500f, -0.43897693f, -0.47312318f, -0.36222971f, -0.19939667f, + -0.29847367f, -0.28024953f, -0.23616334f, -0.19456539f, -0.16497910f, -0.12215408f, -0.05213406f, 0.03088777f, 0.11427925f, 0.17777695f, 0.21315635f, 0.18382103f, 0.20758797f, 0.19478448f, 0.14014366f, 0.08628162f, + -0.01005369f, -0.03186180f, -0.07995901f, -0.10893772f, -0.11257191f, -0.10933952f, -0.06260446f, 0.01592879f, 0.06618622f, 0.08792663f, 0.09779631f, 0.06871009f, 0.06158038f, 0.04699408f, 0.04045205f, 0.02975352f, + -0.12591171f, -0.31330699f, -0.09207505f, 0.04353844f, 0.05691547f, 0.02830292f, 0.05190188f, 0.05663181f, 0.05579546f, 0.05136184f, 0.06373287f, 0.03243363f, 0.03631576f, 0.02886726f, 0.02108611f, 0.00441022f, + 0.51424359f, 0.44825357f, 0.27826391f, 0.14692419f, 0.04486213f, 0.01374316f, -0.05577450f, -0.06790050f, -0.10394906f, -0.14111342f, -0.16141165f, -0.18795338f, -0.17689540f, -0.18030471f, -0.19451666f, -0.17647134f, + 0.01250082f, -0.03513855f, -0.10558904f, -0.13589106f, -0.16642959f, -0.12403555f, -0.11639493f, -0.13504470f, -0.12448111f, -0.08902796f, 0.02742439f, 0.14597597f, 0.22586358f, 0.24372767f, 0.18517594f, 0.19136417f, + 0.00690369f, -0.06536790f, -0.04560492f, 0.17183296f, 0.06108150f, -0.14297504f, -0.10743566f, 0.00028842f, -0.00000737f, 0.01948888f, 0.04144583f, 0.01034213f, 0.01186359f, 0.01904016f, 0.01513936f, 0.00396440f, + -0.02696488f, -0.05930555f, -0.05635944f, 0.04417762f, 0.20483421f, 0.24818872f, 0.08337011f, -0.03555721f, -0.04496794f, -0.05268211f, -0.05177582f, -0.06105043f, -0.04493356f, -0.04903822f, -0.04844764f, -0.04948792f, + 0.09934599f, 0.20097988f, 0.02959104f, 0.10059414f, 0.36489123f, 0.42345991f, 0.31306867f, 0.19189664f, 0.02025838f, -0.16920767f, -0.19221388f, -0.36590851f, -0.24124038f, -0.21069901f, -0.24782116f, -0.31699542f, + -0.38302159f, -0.20867958f, -0.06199247f, 0.00929974f, -0.08763027f, 0.01230753f, 0.12845035f, 0.27194101f, 0.35480151f, 0.36726532f, 0.20142240f, -0.03957218f, -0.10891503f, -0.16235951f, -0.15207841f, -0.14123875f, + 0.29448433f, 0.27467021f, 0.21093907f, 0.02636253f, -0.10971996f, -0.06520899f, -0.09114815f, -0.19988466f, -0.25173695f, -0.21777001f, -0.19036007f, -0.10825290f, 0.00468462f, 0.07695453f, 0.14592570f, 0.20006079f, + -0.09613522f, -0.07305197f, 0.23140183f, -0.01276782f, -0.05046178f, -0.03690868f, 0.01854782f, -0.00516658f, -0.01794740f, 0.01127293f, 0.02845775f, 0.00246563f, -0.00285605f, -0.00274282f, 0.00447526f, 0.00141708f, + 0.09853152f, 0.23398475f, 0.15560679f, 0.01939291f, -0.05095939f, -0.10951335f, -0.08366621f, -0.03852663f, -0.00171258f, -0.01619636f, -0.02703945f, -0.04625883f, -0.03573599f, -0.03656223f, -0.03486191f, -0.02648302f, + -0.05407938f, -0.18042914f, -0.31075117f, -0.36223570f, -0.35545274f, -0.26114190f, -0.21540173f, -0.18652814f, -0.10764184f, -0.04326102f, 0.10627938f, 0.32432791f, 0.40043785f, 0.56193174f, 0.40395999f, 0.27998606f, + -0.22375901f, -0.11453094f, -0.06437672f, 0.02966050f, -0.06882505f, -0.02229970f, 0.00519106f, 0.04139490f, -0.21099529f, -0.00965469f, 0.01906172f, 0.06535794f, 0.27085374f, 0.36298568f, 0.13009871f, -0.21016295f, + 0.18023915f, 0.15936182f, 0.13064987f, 0.09848966f, 0.08230524f, 0.11068418f, 0.11168088f, 0.11505046f, 0.13567778f, 0.12259236f, 0.03115883f, -0.14115321f, -0.20420262f, -0.27855554f, -0.34034745f, -0.31363132f, + -0.12817652f, 0.06412346f, 0.23407500f, 0.37946648f, 0.31127015f, 0.27044470f, 0.18591463f, 0.13643852f, 0.07403884f, -0.00928348f, -0.10609226f, -0.26765738f, -0.35056732f, -0.38530570f, -0.26185421f, -0.14683496f, + -0.63004591f, -0.58451443f, -0.16857245f, -0.08058005f, -0.09034904f, 0.00601978f, 0.10036174f, 0.10417477f, 0.14447621f, 0.13945086f, 0.18409447f, 0.20139949f, 0.10118410f, 0.12033491f, 0.20454736f, 0.24801829f, + 0.09650912f, 0.15979369f, -0.02778062f, -0.21860304f, -0.09723043f, 0.03923136f, 0.06141602f, 0.00600025f, -0.03251321f, -0.01956117f, -0.01004770f, -0.01435564f, 0.01114831f, 0.01113413f, 0.01304939f, 0.02180959f, + -0.00555466f, -0.14717213f, -0.37968771f, -0.12250216f, 0.03497204f, 0.13708345f, 0.03564652f, 0.00785509f, 0.04438533f, 0.06495152f, 0.07142555f, 0.05800545f, 0.06370878f, 0.05930816f, 0.05015268f, 0.02742217f, + 0.24931986f, 0.21084678f, 0.15421842f, 0.14679305f, 0.11899038f, 0.10112391f, 0.08120544f, 0.01848917f, -0.03021656f, -0.11872087f, -0.17582510f, -0.27756371f, -0.26300284f, -0.17730239f, -0.07164775f, 0.03329224f, + -0.17764482f, -0.15058551f, -0.12627503f, -0.06547272f, -0.05935809f, -0.01277874f, 0.01723090f, -0.00829920f, -0.02788840f, 0.01142219f, 0.05531784f, 0.04254613f, 0.04730144f, 0.07050022f, 0.15526930f, 0.22871460f +}; + +const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = { + -0.01387178f, 0.00066194f, 0.01705500f, 0.00585076f, 0.05625865f, -0.08189174f, -0.29272907f, 0.00394582f, 0.14068978f, 0.03888049f, 0.01046905f, 0.03828706f, 0.04214951f, 0.02083198f, 0.00583650f, 0.00757601f, + -0.07101791f, -0.10250166f, 0.03818920f, 0.09162373f, 0.11895681f, 0.13465195f, 0.05088923f, -0.11144198f, -0.13846971f, -0.20720284f, -0.25737659f, -0.15071919f, 0.03249921f, 0.08124332f, 0.17587328f, 0.31480317f, + 0.07163217f, 0.02904662f, 0.01959293f, 0.00805967f, 0.02343380f, 0.02069451f, 0.03232257f, 0.02206815f, 0.03462995f, 0.01790113f, -0.03778174f, -0.14048245f, -0.21681559f, -0.11035045f, 0.05755451f, 0.16849432f, + -0.10816723f, -0.02739052f, -0.08241511f, -0.08220118f, -0.07911491f, 0.04976754f, 0.10255540f, 0.23875558f, 0.25687913f, 0.03165525f, -0.15819986f, -0.14652796f, -0.00803674f, -0.00055281f, -0.01439374f, 0.02738701f, + -0.02270156f, 0.02799492f, 0.14119353f, -0.06753253f, -0.07348415f, 0.16270911f, -0.00726861f, -0.06576199f, -0.02852827f, -0.01072544f, -0.02385080f, 0.01259492f, -0.00575096f, -0.00670975f, -0.01412345f, -0.01805497f, + -0.09730804f, -0.09207854f, -0.06155676f, -0.01193574f, 0.00669004f, 0.04165295f, 0.00840306f, -0.01763756f, -0.08511468f, -0.12564582f, -0.06302424f, 0.13694410f, 0.25188182f, 0.15335399f, 0.00198570f, -0.04661036f, + -0.20229607f, 0.27055253f, 0.05937269f, 0.00423687f, 0.02212468f, -0.00979552f, -0.02654450f, -0.02737173f, -0.03263414f, -0.01695365f, -0.02587673f, -0.00157241f, -0.00766337f, -0.00946241f, 0.00474761f, -0.00086382f, + 0.06446543f, -0.26714355f, 0.12269745f, 0.02565502f, -0.00628892f, 0.00430942f, 0.00862473f, -0.00170779f, 0.00617105f, -0.00718104f, -0.01871731f, 0.01193483f, 0.00860795f, 0.00997801f, 0.02026700f, 0.01832765f, + -0.00061741f, -0.03771131f, -0.03643531f, -0.01560727f, 0.00567664f, -0.00566226f, -0.00287572f, 0.03281006f, 0.04750282f, 0.01895354f, -0.01051254f, 0.01765380f, 0.01259038f, 0.00436097f, -0.01332776f, -0.01679868f, + 0.06930783f, 0.05302917f, 0.06102093f, 0.13367091f, 0.13415662f, 0.00542245f, -0.09926086f, -0.18333294f, -0.21849319f, -0.08349384f, 0.02026711f, 0.05881583f, 0.01345789f, 0.01158885f, 0.01962784f, 0.00421544f, + 0.00361302f, -0.05045316f, -0.00509374f, 0.19082766f, -0.18804365f, -0.05470887f, 0.00052718f, -0.02162397f, -0.00194290f, 0.00166374f, 0.00419055f, 0.02490528f, 0.02211515f, 0.02768455f, 0.02704636f, 0.01929285f, + 0.02476472f, -0.00405085f, -0.02659682f, -0.08596413f, -0.06315428f, -0.06855039f, -0.07500519f, -0.05011866f, -0.06108486f, -0.00618761f, 0.05634272f, 0.08835189f, 0.05894742f, 0.06729406f, 0.07762828f, 0.06738369f, + 0.13702164f, 0.08497052f, 0.07105828f, 0.04681336f, 0.02464482f, 0.00482884f, -0.01068152f, -0.00650854f, 0.01424842f, -0.00735400f, -0.04158832f, -0.02704081f, -0.04141575f, -0.06089035f, -0.09289456f, -0.09521199f, + -0.16780678f, 0.06667456f, 0.18201515f, 0.07399154f, -0.01999438f, 0.05535422f, 0.03900328f, -0.12016656f, -0.10793461f, 0.12328733f, 0.37944090f, 0.03265145f, -0.16138072f, -0.15224770f, -0.10548425f, -0.11740339f, + -0.01321210f, -0.01125461f, -0.03726540f, 0.00275729f, -0.04632781f, -0.24449670f, 0.09996640f, 0.11060024f, 0.00843480f, 0.01020953f, 0.01323100f, 0.03866782f, 0.01652133f, 0.01477176f, 0.01931947f, 0.01807687f, + 0.04427139f, 0.07762448f, -0.03500615f, -0.18353333f, 0.15726631f, 0.06121580f, -0.02944487f, -0.01882019f, -0.02386520f, 0.00077271f, -0.01038885f, 0.00869168f, -0.00564164f, -0.00937383f, -0.01500538f, -0.01876296f, + 0.13690793f, 0.01111401f, -0.03351651f, -0.01725554f, -0.07761571f, -0.12250939f, -0.07631311f, -0.01738486f, 0.14254332f, 0.21322328f, 0.14586930f, 0.03233900f, -0.08363281f, -0.12036013f, -0.07612890f, -0.05727984f, + 0.02949784f, -0.12225020f, -0.24763790f, 0.09504104f, 0.18885156f, 0.02619185f, 0.01292378f, 0.03000215f, 0.00909582f, -0.00936785f, -0.02571287f, 0.00889712f, -0.00234566f, -0.00169068f, 0.00871879f, -0.00021486f, + -0.03852054f, -0.03889437f, -0.08884280f, -0.06896184f, 0.02214326f, 0.10225505f, 0.12832898f, 0.08401269f, 0.06576567f, 0.08182152f, 0.07603111f, 0.04006712f, -0.04791395f, -0.09454805f, -0.10354215f, -0.11920167f, + 0.00938218f, 0.04681937f, 0.08173506f, 0.03766262f, 0.00645705f, -0.03830769f, -0.01180921f, 0.28211251f, 0.02788724f, -0.25197511f, -0.12812732f, 0.01575526f, 0.01158131f, -0.01435589f, -0.04416799f, -0.03064940f, + 0.06374854f, 0.12417689f, 0.09544838f, -0.13379816f, -0.26304159f, -0.06323982f, 0.03308697f, 0.06602140f, 0.04869582f, 0.02626429f, 0.00579212f, 0.01966626f, -0.00288156f, -0.00594553f, -0.00083407f, -0.01315989f, + -0.01689007f, -0.05224654f, -0.05732359f, 0.00797541f, -0.01178359f, -0.06878838f, -0.08592686f, -0.01631491f, -0.01215461f, 0.04690048f, 0.18175850f, 0.26923595f, 0.13470179f, -0.02451530f, -0.12744548f, -0.16718270f, + -0.02187075f, -0.05395855f, -0.02263713f, -0.00045869f, 0.07200871f, 0.08343703f, 0.05673476f, -0.01486174f, 0.02824052f, 0.09407959f, 0.06117651f, -0.48782246f, -0.01849447f, 0.15501071f, 0.05869060f, 0.01072538f, + 0.38479396f, -0.04937867f, -0.07935772f, -0.02506650f, -0.02316760f, -0.02067798f, 0.02695150f, -0.00054291f, -0.05256493f, -0.03399701f, -0.04629317f, -0.01085654f, -0.01817534f, -0.02213798f, -0.01605045f, -0.01347864f, + -0.23847427f, -0.06501920f, -0.01803515f, -0.00348509f, 0.04039109f, 0.01940591f, 0.01835329f, 0.03075053f, 0.03001602f, 0.02853897f, 0.01016726f, 0.03707260f, 0.02160199f, 0.03493100f, 0.03506401f, 0.01872098f, + 0.03862266f, 0.02890076f, 0.02592629f, 0.04317070f, 0.03495444f, -0.02192080f, -0.03469867f, -0.01962511f, -0.02362473f, -0.09521267f, -0.13881717f, -0.03271523f, 0.01372571f, 0.05875682f, 0.06459397f, 0.05796305f, + -0.01487374f, 0.01485744f, 0.01264233f, 0.04546350f, 0.00733058f, 0.08289797f, 0.17793293f, 0.03071348f, -0.11739129f, -0.07170388f, -0.04800450f, -0.00719781f, -0.01613242f, -0.02445791f, -0.03329781f, -0.03877884f, + 0.06919396f, -0.04913878f, -0.23414589f, -0.32278902f, -0.15262688f, -0.02830432f, 0.05881428f, 0.05602689f, 0.08630162f, 0.08206753f, 0.05235369f, 0.05459854f, 0.02224523f, 0.07894449f, 0.13055514f, 0.09590365f, + -0.13456165f, -0.02675728f, 0.10718846f, 0.16038985f, 0.13314470f, 0.04370885f, 0.00879630f, 0.02004215f, 0.04004457f, 0.01767300f, -0.03006764f, -0.02489721f, -0.06793547f, -0.08666415f, -0.07647774f, -0.08362676f, + -0.01963376f, -0.05985601f, -0.06123515f, 0.00802984f, 0.03197310f, 0.08198580f, -0.04518129f, -0.25550460f, -0.02763673f, 0.10534295f, 0.06276998f, 0.04687612f, 0.02909544f, 0.03184387f, 0.04253063f, 0.02859974f, + -0.05005194f, 0.08455623f, 0.27160784f, 0.05333258f, -0.06395559f, -0.12989814f, -0.07303311f, -0.05166257f, -0.03661287f, -0.00149673f, -0.00090933f, 0.02163393f, 0.00899793f, -0.00065646f, -0.01328460f, -0.01856715f, + 0.08465235f, 0.18910437f, -0.17964239f, -0.01596332f, -0.01786381f, -0.02173723f, 0.00655794f, -0.00747303f, -0.01909382f, -0.01073786f, -0.01461080f, 0.01419150f, 0.00349640f, -0.00567498f, -0.00358136f, -0.00162392f +}; + +const float *const ivas_sns_cdbks_side_tcx20[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx20_stage1, ivas_sns_cdbks_side_tcx20_stage2 }; + +const float ivas_sns_means_side_tcx10[M] = { + -0.0085f , 0.0070f , 0.0074f , 0.0045f, + -0.0038f , 0.0071f , 0.0040f , -0.0068f, + -0.0104f , -0.0095f , -0.0259f , -0.0163f, + 0.0127f , 0.0087f , 0.0036f , 0.0262f +}; + +const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = { + -0.23085418f, -0.21005449f, -0.18570241f, -0.13606880f, -0.11948469f, -0.10308038f, -0.11104958f, -0.15882089f, -0.13896854f, -0.06621316f, 0.05217852f, 0.11795393f, 0.15762859f, 0.26837024f, 0.37542593f, 0.48873907f, + 0.13745600f, 0.20131847f, 0.22182278f, 0.29526068f, 0.24656821f, 0.13757111f, 0.07460669f, 0.03134436f, -0.06561883f, -0.17480962f, -0.24070771f, -0.31627147f, -0.28865063f, -0.14849001f, -0.03399112f, -0.07740884f, + -0.13299250f, -0.14002491f, -0.11936499f, -0.04179630f, -0.03438902f, 0.04431344f, 0.06951552f, 0.01403797f, 0.05531963f, -0.01394528f, -0.09745552f, 0.00448586f, 0.26823524f, 0.23321159f, 0.06675539f, -0.17590634f, + 0.06191756f, 0.11582434f, 0.13192343f, 0.09527126f, 0.08193836f, 0.01139745f, 0.03044540f, 0.11065563f, 0.07578016f, -0.02083963f, -0.07297648f, -0.08340844f, -0.07282079f, -0.12840160f, -0.18605485f, -0.15065167f, + -0.03483375f, -0.04038755f, -0.07410056f, -0.06961358f, -0.04495163f, -0.12359739f, -0.20954724f, -0.19583867f, -0.14529606f, 0.00841374f, 0.12968518f, 0.22831580f, 0.23147392f, 0.13653895f, 0.09511995f, 0.10861877f, + 0.06658553f, 0.21860187f, 0.09436141f, -0.09071645f, -0.07082980f, 0.04518200f, 0.04859027f, -0.03547180f, -0.06006165f, -0.02756024f, 0.00158143f, -0.01511772f, -0.04477551f, -0.04937419f, -0.04159366f, -0.03940128f, + 0.02864506f, -0.04039106f, -0.15284948f, -0.42538299f, -0.19236357f, 0.03104685f, 0.02253710f, 0.02311004f, 0.04867318f, 0.06745871f, 0.09338212f, 0.09710035f, 0.07856015f, 0.09301454f, 0.11632315f, 0.11113598f, + 0.14528623f, 0.29868967f, 0.46429789f, 0.54323288f, 0.40204138f, 0.26355278f, 0.17207026f, 0.09889195f, -0.00279626f, -0.16206412f, -0.29083020f, -0.40501466f, -0.54537297f, -0.46768767f, -0.27766915f, -0.23662804f, + -0.38143153f, -0.38286102f, -0.37711911f, -0.29609917f, -0.25719669f, -0.20628984f, -0.15545466f, -0.08387721f, -0.03028209f, 0.14307072f, 0.32718172f, 0.40216059f, 0.39369890f, 0.30234268f, 0.29650354f, 0.30565312f, + 0.35958422f, 0.51604595f, 0.41116626f, 0.13914238f, -0.03378266f, -0.13855653f, -0.18788816f, -0.17389274f, -0.14739128f, -0.16521614f, -0.14451729f, -0.13567903f, -0.09514774f, -0.07488226f, -0.06811874f, -0.06086662f, + -0.66004345f, -0.31718869f, -0.22177390f, -0.12449418f, -0.09939825f, 0.07331022f, 0.21408044f, 0.21558931f, 0.11208625f, 0.04257974f, -0.01807639f, 0.09442548f, 0.06053141f, 0.06888331f, 0.20357028f, 0.35591847f, + -0.16304924f, -0.12420037f, -0.04222860f, 0.05588216f, 0.18467874f, 0.32957705f, 0.39156897f, 0.27848510f, 0.13897139f, -0.02741662f, -0.14580317f, -0.19651482f, -0.22072919f, -0.18213237f, -0.12846721f, -0.14862176f, + -0.17887269f, -0.40659902f, -0.02516902f, 0.09601495f, 0.06138763f, 0.02130781f, 0.05102018f, 0.04939750f, 0.05199909f, 0.05639114f, 0.06766195f, 0.07106289f, 0.04938017f, 0.02276475f, 0.00986626f, 0.00238653f, + 0.35668951f, 0.22742896f, -0.06232152f, -0.18667516f, -0.28394315f, -0.31893226f, -0.28501785f, -0.19154472f, -0.14625471f, -0.07293625f, 0.05620192f, 0.15269426f, 0.20840665f, 0.19892856f, 0.16095072f, 0.18632539f, + -0.04935166f, -0.11272268f, 0.08233717f, 0.29988006f, 0.19331526f, 0.14054174f, 0.08680898f, -0.01410902f, -0.04313985f, -0.03494681f, -0.04540697f, -0.07243925f, -0.09250963f, -0.09472804f, -0.10148439f, -0.14204503f, + 0.18485137f, 0.25341568f, 0.21009944f, 0.20568550f, 0.20518381f, 0.27019582f, 0.21216885f, 0.00546777f, -0.00044021f, -0.10735443f, -0.20735090f, -0.14224940f, -0.09351389f, -0.09761419f, -0.36078632f, -0.53775866f, + -0.37281135f, -0.49261999f, -0.36727842f, -0.16577288f, -0.02238290f, 0.00199674f, -0.01679564f, 0.04714198f, 0.10589472f, 0.16394573f, 0.18921056f, 0.20782063f, 0.19861654f, 0.19447370f, 0.17625681f, 0.15230414f, + 0.06686853f, 0.05611921f, 0.03365910f, 0.02756852f, 0.08295478f, 0.06008045f, -0.03273553f, -0.04364718f, -0.01449926f, -0.16865975f, -0.29690154f, -0.15022460f, -0.01812698f, 0.04654261f, 0.11587511f, 0.23512676f, + 0.05629958f, -0.04922929f, -0.24893641f, -0.04282766f, 0.05664299f, 0.06157661f, 0.05406340f, 0.01868661f, -0.00352496f, -0.00155314f, 0.04576544f, 0.04384907f, 0.01829060f, 0.01451148f, 0.01064548f, -0.03425997f, + 0.00489548f, -0.00560306f, 0.00615573f, -0.00441324f, 0.02514502f, 0.02634783f, 0.01098806f, 0.01133668f, 0.06739798f, 0.14368795f, 0.11283267f, 0.01118776f, -0.08555990f, -0.10393666f, -0.11315265f, -0.10730981f, + -0.15112519f, -0.11783557f, -0.13754019f, -0.07632290f, -0.06121828f, -0.06360113f, -0.05018035f, -0.00549590f, 0.05908192f, 0.04630727f, 0.02538631f, -0.00811102f, -0.02567731f, 0.08327373f, 0.21071206f, 0.27234661f, + 0.56834545f, 0.15133540f, -0.01992277f, -0.04770211f, -0.05432411f, -0.02191499f, -0.02550971f, -0.03144176f, -0.02317891f, -0.02811835f, -0.04327235f, -0.06018613f, -0.07647819f, -0.07349573f, -0.08821391f, -0.12592196f, + -0.03137272f, -0.03974785f, -0.03770784f, -0.05600026f, -0.03191645f, -0.04815164f, -0.04304812f, 0.02455638f, 0.06207261f, 0.02331568f, -0.01876696f, -0.04473163f, -0.02498340f, 0.06425271f, 0.11960865f, 0.08262092f, + 0.45973777f, 0.45999547f, 0.38173824f, 0.22785755f, 0.16821465f, 0.17382620f, 0.20517627f, 0.04061839f, -0.12685907f, -0.26643193f, -0.37356030f, -0.36765140f, -0.32336919f, -0.29335060f, -0.29318189f, -0.07275984f, + -0.07969188f, -0.23669686f, -0.42690692f, -0.49932686f, -0.40006183f, -0.28450852f, -0.22942850f, -0.12475617f, -0.03421007f, 0.12993786f, 0.27530393f, 0.32731838f, 0.50859567f, 0.47553443f, 0.32383390f, 0.27506335f, + 0.34046042f, 0.28909102f, 0.17226731f, 0.06244214f, 0.10377957f, 0.13146006f, 0.03081777f, -0.02599206f, -0.11020633f, -0.20031818f, -0.27040991f, -0.19266314f, -0.09502591f, -0.17705982f, -0.16383079f, 0.10518781f, + -0.43345226f, 0.01054419f, 0.06653837f, 0.02899912f, 0.04789640f, 0.03995846f, 0.02631173f, 0.04744618f, 0.05142942f, 0.03249742f, 0.03044055f, 0.03518159f, 0.01592359f, 0.00998224f, -0.00417209f, -0.00552518f, + -0.35779590f, -0.24084024f, -0.08920896f, -0.01964746f, -0.04518980f, 0.07193759f, 0.22722040f, 0.28999718f, 0.39417664f, 0.30171530f, 0.12526317f, 0.00759665f, -0.11081727f, -0.17325866f, -0.19301481f, -0.18813416f, + -0.16184582f, -0.19051919f, -0.19758934f, -0.16274525f, -0.19869541f, -0.22576659f, -0.13506612f, 0.01672518f, 0.13044875f, 0.26035967f, 0.27598891f, 0.22195891f, 0.13262193f, 0.13096192f, 0.10021772f, 0.00294471f, + 0.07825952f, 0.06525092f, 0.17527642f, 0.02096373f, -0.24373383f, -0.29324959f, -0.11558339f, -0.03040273f, 0.01406029f, 0.04150557f, 0.06984124f, 0.07372710f, 0.06551062f, 0.06332513f, 0.02509070f, -0.00984142f, + 0.08701726f, 0.12843394f, 0.16700094f, 0.15034452f, 0.12947411f, -0.01656238f, -0.15483649f, -0.18970569f, -0.18557831f, -0.09352705f, -0.01998975f, -0.00988876f, 0.00753489f, 0.01530672f, 0.00965047f, -0.02467425f, + 0.26197082f, 0.21849905f, 0.21673972f, 0.16654799f, 0.18547759f, 0.16177425f, 0.16111117f, 0.20927596f, 0.18073438f, 0.03535012f, -0.14032550f, -0.22486416f, -0.33259461f, -0.40957544f, -0.38613800f, -0.30398287f +}; + +const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = { + -0.13993218f, -0.02453874f, 0.12672628f, 0.02785695f, 0.06681568f, 0.12811808f, 0.07492973f, -0.01977524f, -0.05822869f, -0.07547464f, -0.06553072f, -0.05473233f, -0.04357434f, -0.00634272f, 0.03406826f, 0.02961442f, + -0.06711216f, -0.11444162f, -0.09789788f, -0.09123304f, -0.12190348f, -0.00995424f, 0.10989921f, 0.11555575f, 0.06002452f, 0.03801973f, 0.02047622f, 0.01721280f, 0.02414692f, 0.02829613f, 0.03827912f, 0.05063187f, + 0.05523005f, 0.03052467f, 0.03910551f, 0.05802321f, 0.02158461f, 0.03249705f, 0.04015871f, -0.00878163f, -0.05597684f, -0.02391125f, 0.03722223f, 0.06349026f, 0.02718346f, -0.07380323f, -0.12743287f, -0.11511406f, + 0.11202279f, 0.20074913f, 0.04546646f, -0.10844616f, -0.14193153f, -0.08529745f, -0.03252409f, 0.03394947f, 0.04414551f, 0.00658101f, -0.01249852f, -0.01845361f, -0.01335408f, -0.01042434f, -0.00769413f, -0.01229041f, + -0.04167890f, -0.07371348f, -0.14826543f, 0.02126701f, 0.16009313f, 0.11910639f, 0.05602141f, 0.08082496f, 0.12544839f, 0.05415940f, -0.03080142f, -0.04070302f, -0.06024186f, -0.07129750f, -0.07769974f, -0.07251926f, + -0.07457123f, -0.04115197f, -0.04049765f, -0.06857318f, -0.04225051f, -0.03861733f, -0.05120942f, -0.08876715f, -0.05537668f, 0.03678654f, 0.09038235f, 0.06681871f, 0.08915640f, 0.13108744f, 0.08129597f, 0.00548771f, + -0.05294641f, 0.03370244f, 0.16024587f, 0.17199155f, 0.02454307f, -0.13278320f, -0.13945295f, -0.04199699f, 0.00678627f, 0.02029543f, 0.00856028f, 0.00137417f, -0.01135502f, -0.03017687f, -0.02257884f, 0.00379131f, + 0.20898804f, -0.01113044f, -0.08488316f, -0.01088633f, 0.03304903f, -0.01306932f, -0.05782260f, -0.07100917f, -0.06682249f, -0.05645623f, -0.04781041f, -0.03500698f, -0.01196148f, 0.03266111f, 0.08176223f, 0.11039842f +}; + +const float *const ivas_sns_cdbks_side_tcx10[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx10_stage1, ivas_sns_cdbks_side_tcx10_stage2 }; +#endif +#endif // SNS_MSVQ + +#ifdef FIX_445_SNS_BUGFIXES +const int16_t sns_1st_cdbk[2][2][8 * 32] = { + { /* split 1 */ + { /* TCX 20 */ + -10900, -11064, -10637, -10471, -9051, -6381, -4688, -2438, + -2119, -5087, -6702, -8118, -7586, -6343, -4828, -3406, + 2004, -3443, -4289, -3757, -3234, -2952, -2313, -1781, + 1749, 5598, 3916, 732, -1472, -2964, -3275, -2332, + -11978, -14369, -5600, -545, 981, -929, -57, 1903, + 1745, 391, 202, 115, 256, -291, -862, -1637, + -4052, 2059, 4709, 6768, 5595, 1975, -1723, -1218, + 2093, 7263, 8679, 7576, 3701, -2438, -4389, -2686, + -7120, -6279, -5715, -5520, -4752, -3125, -1856, -438, + 8131, -2543, -6285, -6723, -5588, -4321, -3264, -2164, + -653, -1301, -660, 608, 1598, 1805, 1698, 760, + 4882, 9309, 6333, 1734, 284, 364, 560, 1015, + -7686, -5737, -3443, -1642, 245, 1531, 1827, 1769, + -1468, 3782, 144, -5130, -6883, -5165, -1497, 2072, + -12937, -8429, -2619, 2894, 5004, 4710, 4627, 3740, + 3198, 3928, 4358, 4554, 3887, 2844, 1299, 129, + -13828, -12296, -9364, -7918, -5571, -1909, 307, 2047, + -4314, -1211, -559, -1061, -1928, -2228, -2359, -1902, + -309, -3224, -3404, -1895, -743, -59, 757, 908, + 10914, 5865, 1599, -386, -1392, -2285, -2236, -2042, + -11825, -16241, -11402, -3627, 6556, 8953, 6421, 1546, + 6102, 777, -301, 536, 902, 541, 210, -429, + -3052, 3997, 5389, 1842, -344, 1556, 2667, 2428, + 11788, 10894, 7448, 5423, 2372, -677, -2385, -3839, + -45, -7602, -8923, -7179, -3273, 65, 4500, 6726, + 5895, 626, -1610, -2598, -3240, -3540, -2930, -2156, + -971, 461, 1494, 4907, 5859, 5199, 3678, 2502, + 10766, 5297, 1844, 1236, 2498, 3503, 2846, 838, + -7816, -1212, 891, 2387, 1317, 2225, 1859, 1602, + 2376, 5357, 2088, -2719, -3419, -420, 2431, 2943, + -8383, -795, 4351, 7026, 7460, 7191, 5262, 3796, + 1522, 6283, 8714, 8222, 7434, 5768, 3586, 1499, + }, + { /* TCX 10 */ + -15596, -16321, -10264, -1002, 5955, 5543, -29, -1688, + 17, -3794, -6207, -7356, -6998, -6081, -4453, -2448, + -12543, -11530, -10186, -8817, -7083, -4440, -1946, 892, + 5198, 2751, -274, -2574, -4561, -6087, -5944, -4600, + -683, -2640, -2753, -1195, -239, -217, -286, 90, + -1400, -1146, -1853, -2845, -3456, -3788, -3171, -1969, + -1835, 392, 1725, 1209, -392, -1640, -2001, -1608, + 5770, 7707, 5210, 2112, -382, -2088, -2634, -3007, + -10766, -8101, -5137, -3754, -1881, 331, 2339, 3679, + -2637, -4640, -5811, -5651, -3790, -1359, 913, 1893, + -7793, -4768, -1762, -545, -717, -837, -441, -75, + 4030, 1770, 467, 379, 10, -1330, -2398, -2290, + -9395, -6952, -2494, 2022, 4753, 5614, 4443, 2642, + -1486, 1748, 859, -2586, -3368, -638, 2761, 3269, + -2408, 306, 3633, 6567, 5950, 2474, -621, -1421, + 5478, 7986, 9498, 8165, 5477, 1244, -523, -1586, + -13564, -14673, -10597, -5504, 1575, 8248, 7662, 4025, + 4978, -682, -3586, -4305, -3703, -3001, -2227, -1278, + -8002, -6831, -5558, -4868, -4243, -3393, -2486, -1110, + 11485, 5472, 1645, -533, -1792, -2814, -3169, -2706, + 1617, 421, 232, 1382, 2162, 2017, 1318, 744, + 3677, 5212, 1990, -1514, -2894, -2441, -451, 592, + 731, 4295, 5860, 3756, 1991, 1437, 869, 127, + 12736, 11722, 7768, 4682, 1574, -744, -1989, -3131, + -3490, -4269, -3681, -1531, 1111, 3327, 4138, 3815, + 7344, 1400, -1302, -1502, -1015, 57, 1212, 1498, + -4836, -1881, 1071, 2055, 2114, 2465, 2093, 1458, + 8569, 5879, 3654, 2879, 2530, 1703, 781, -233, + -3709, -990, 2338, 6227, 7083, 7102, 5657, 3401, + 3389, 6392, 5267, 1011, 275, 3519, 5236, 4339, + 599, 3752, 6943, 9211, 8152, 5568, 3337, 1838, + 9885, 9591, 7905, 8068, 7929, 7421, 4234, 757, + } + }, + { /* split 2 */ + { /* TCX 20 */ + -178, -3476, -5982, -7081, -7548, -7440, -6859, -5798, + -3596, -3670, -1501, 770, 812, -286, -2001, -3377, + -3998, -5191, -4988, -4421, -3889, -3571, -2738, -1969, + -2981, -2687, -1501, -83, 1136, 2377, 3248, 4105, + 1842, -41, -1972, -4282, -6779, -8405, -8674, -7835, + -259, 571, 2124, 3344, 2959, 1407, -750, -2523, + -524, -1956, -2855, -3202, -3939, -4666, -4907, -4782, + -5110, -4768, -3017, -663, 4188, 9210, 16602, 21081, + 4373, 4846, -603, -6495, -7289, -5540, -4749, -5527, + -1448, -1043, -619, -105, 356, 362, 542, 857, + 1373, -752, -5334, -6244, -3001, -932, -1040, -3125, + -2403, -1397, 612, 2449, 3920, 5231, 6819, 8581, + 2183, 1211, -111, -1084, -2836, -4977, -6701, -7284, + -751, 1255, 3408, 6474, 7503, 7026, 5413, 4464, + 935, 850, 589, 353, 160, -434, -939, -931, + 268, 2284, 3884, 5423, 6680, 7996, 9244, 9472, + 1075, 113, -1289, -4457, -7512, -5930, -1799, -571, + -3689, -4254, -3755, -2995, -1581, -135, 1049, 1589, + -1166, -1752, -1790, -1897, -1927, -1831, -1359, -805, + -1494, -735, 635, 1993, 2909, 3546, 4226, 4956, + 4435, 4299, 4269, 1328, -3731, -7621, -9319, -9170, + 1358, 2227, 3873, 4469, 4692, 4057, 2601, 1608, + 813, 398, -499, -666, -1286, -2271, -3316, -4025, + -3300, -1255, 2181, 6431, 10002, 12760, 13549, 12584, + 3714, 4180, 484, -2905, -2864, -1359, -1256, -2477, + 308, 868, 1373, 1629, 1793, 1834, 1814, 1746, + 1472, 798, -282, -1935, -1818, 320, 2221, 2914, + 2281, 3240, 2988, 1400, 2383, 4072, 5667, 6675, + 2672, 2678, 2874, 2096, -226, -2301, -3861, -4534, + 4988, 7231, 7641, 7731, 7061, 6447, 5411, 3513, + 3978, 4156, 4126, 2896, 1469, 759, 368, -68, + -264, 4210, 8534, 11008, 11606, 11888, 11072, 8949, + }, + { /* TCX 10 */ + -2852, -6158, -7231, -7830, -8012, -7922, -7556, -6706, + -3911, -5340, -5053, -4741, -4805, -4484, -3727, -3037, + -966, -1461, -1694, -2427, -3081, -3037, -2547, -2230, + -3455, -3315, -2451, -836, 1383, 3196, 3720, 3379, + 3052, 281, -3351, -6866, -9051, -9586, -8983, -8236, + -748, -4465, -4314, -2251, 29, -40, -3963, -6195, + 200, 1293, 2535, 2803, 1603, -186, -1397, -1697, + -1707, -265, 2196, 5295, 5894, 4216, 3440, 3826, + -237, -2133, -2279, -3149, -4377, -5638, -6520, -6764, + -2407, -2049, -1246, -664, -521, -430, -349, -211, + 3874, 1335, -1501, -2055, -1268, -990, -1852, -2871, + -1883, -1845, -1681, -484, 384, 2035, 5839, 9597, + 275, 380, 1048, 424, -1146, -3012, -4431, -5104, + -1699, -484, 756, 1261, 1279, 1377, 1975, 2590, + 2139, 4502, 3645, 4975, 6491, 5972, 5012, 4346, + -3821, -2581, -433, 2667, 6436, 10038, 11311, 8783, + 2359, -2689, -6604, -7039, -5992, -4268, -3711, -4840, + -2776, -4251, -4539, -3672, -2494, -1055, 280, 695, + 491, 866, 822, -44, -1009, -1165, -831, -538, + -1024, 91, 786, 1295, 2433, 3910, 4975, 5403, + 3117, 2590, 2337, -667, -4580, -8147, -9400, -9523, + -103, -630, -831, 669, 3062, 3398, 549, -1690, + 2113, 3467, 4279, 5047, 5344, 3361, 127, -2313, + -1199, 1153, 2914, 3688, 4260, 5421, 7471, 8831, + 2815, 2184, 316, -3058, -5596, -5564, -4343, -3793, + 922, 126, -1414, -1731, -1007, 359, 2029, 3088, + 4889, 4619, 2537, 1114, 950, 946, 799, 419, + -4271, -3750, -3359, -484, 1448, 4106, 10487, 20479, + 3818, 4687, 4064, 2212, -172, -2287, -3535, -4041, + 884, 2456, 3394, 2925, 2182, 2323, 2583, 2507, + 4767, 8057, 8263, 6461, 5003, 4055, 2923, 1845, + 19, 3813, 6926, 8432, 10141, 10850, 9692, 8383, + } + } +}; +const int16_t sns_1st_means_16k[2][16] = { + { /* TCX 20 */ + 14210, 19017, 14362, 9309, 5385, 2674, 1055, -211, -1407, -3059, -4393, -8597, -11180, -11756, -12131, -13281, + }, + { /* TCX 10*/ + 12018, 15915, 11089, 6015, 847, -705, -539, -1548, -893, -2163, -1806, -4189, -7017, -8670, -8874, -9480, + } +}; +const int16_t sns_1st_means_25k6[2][16] = { + { /* TCX 20 */ + 14973, 20323, 16461, 9554, 4017, 3103, 1602, 1694, -221, -1401, -6817, -10071, -11503, -11805, -13158, -16749, + }, + { /* TCX 10 */ + 15560, 19489, 14623, 5595, 2084, 1699, 775, -1312, -2195, -6101, -9078, -9465, -7825, -6603, -7281, -9960, + } +}; +const int16_t sns_1st_means_32k[2][16] = { + { /* TCX 20 */ + 15041, 20603, 16969, 10289, 4973, 4283, 3003, 3316, 1684, -259, -6614, -9535, -10363, -11834, -16625, -24930, + }, + { /* TCX 10 */ + 16510, 20660, 16025, 7224, 3921, 3868, 2623, 742, -1316, -6269, -8284, -7288, -6380, -8410, -13351, -20277, + } +}; +#endif + +#ifdef MC_PARAMUPMIX_MODE +ACPL_QUANT_TABLE alpha_quant_table[] = +{ + { /* Alfa Fine */ + 33, /* nquant */ + 16, /* offset */ + { -2.000000e+000f, -1.809375e+000f, -1.637500e+000f, -1.484375e+000f, -1.350000e+000f, -1.234375e+000f, -1.137500e+000f, -1.059375e+000f, -1.000000e+000f, -9.406250e-001f, + -8.625000e-001f, -7.656250e-001f, -6.500000e-001f, -5.156250e-001f, -3.625000e-001f, -1.906250e-001f, +0.000000e+000f, +1.906250e-001f, +3.625000e-001f, +5.156250e-001f, + +6.500000e-001f, +7.656250e-001f, +8.625000e-001f, +9.406250e-001f, +1.000000e+000f, +1.059375e+000f, +1.137500e+000f, +1.234375e+000f, +1.350000e+000f, +1.484375e+000f, + +1.637500e+000f, +1.809375e+000f, +2.000000e+000f } /* data */ + }, /* End Alfa Fine */ + { /* Alfa Coarse */ + 17, /* nquant */ + 8, /* offset */ + { -2.000000e+000f, -1.637500e+000f, -1.350000e+000f, -1.137500e+000f, -1.000000e+000f, -8.625000e-001f, -6.500000e-001f, -3.625000e-001f, +0.000000e+000f, +3.625000e-001f, + +6.500000e-001f, +8.625000e-001f, +1.000000e+000f, +1.137500e+000f, +1.350000e+000f, +1.637500e+000f, +2.000000e+000f } /* data */ + } /* End Alfa Coarse */ +}; + +ACPL_QUANT_TABLE beta_quant_table[2][9] = +{ + { + { /* Beta Fine #1 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +2.375000e-001f, +5.500000e-001f, +9.375000e-001f, +1.400000e+000f, +1.937500e+000f, +2.550000e+000f, +3.237500e+000f, +4.000000e+000f } /* data */ + }, /* End Beta Fine #1 */ + { /* Beta Fine #2 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +2.035449e-001f, +4.713672e-001f, +8.034668e-001f, +1.199844e+000f, +1.660498e+000f, +2.185430e+000f, +2.774639e+000f, +3.428125e+000f } /* data */ + }, /* End Beta Fine #2 */ + { /* Beta Fine #3 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.729297e-001f, +4.004688e-001f, +6.826172e-001f, +1.019375e+000f, +1.410742e+000f, +1.856719e+000f, +2.357305e+000f, +2.912500e+000f } /* data */ + }, /* End Beta Fine #3 */ + { /* Beta Fine #4 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.456543e-001f, +3.373047e-001f, +5.749512e-001f, +8.585938e-001f, +1.188232e+000f, +1.563867e+000f, +1.985498e+000f, +2.453125e+000f } /* data */ + }, /* End Beta Fine #4 */ + { /* Beta Fine #5 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.217188e-001f, +2.818750e-001f, +4.804688e-001f, +7.175000e-001f, +9.929688e-001f, +1.306875e+000f, +1.659219e+000f, +2.050000e+000f } /* data */ + }, /* End Beta Fine #5 */ + { /* Beta Fine #6 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.011230e-001f, +2.341797e-001f, +3.991699e-001f, +5.960938e-001f, +8.249512e-001f, +1.085742e+000f, +1.378467e+000f, +1.703125e+000f } /* data */ + }, /* End Beta Fine #6 */ + { /* Beta Fine #7 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +8.386719e-002f, +1.942188e-001f, +3.310547e-001f, +4.943750e-001f, +6.841797e-001f, +9.004688e-001f, +1.143242e+000f, +1.412500e+000f } /* data */ + }, /* End Beta Fine #7 */ + { /* Beta Fine #8 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +6.995117e-002f, +1.619922e-001f, +2.761230e-001f, +4.123438e-001f, +5.706543e-001f, +7.510547e-001f, +9.535449e-001f, +1.178125e+000f } /* data */ + }, /* End Beta Fine #8 */ + { /* Beta Fine #9 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +5.937500e-002f, +1.375000e-001f, +2.343750e-001f, +3.500000e-001f, +4.843750e-001f, +6.375000e-001f, +8.093750e-001f, +1.000000e+000f } /* data */ + } /* End Beta Fine #9 */ + }, + { + { /* Beta Coarse #1 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +5.500000e-001f, +1.400000e+000f, +2.550000e+000f, +4.000000e+000f } /* data */ + }, /* End Beta Coarse #1 */ + { /* Beta Coarse #2 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +4.004688e-001f, +1.019375e+000f, +1.856719e+000f, +2.912500e+000f } /* data */ + }, /* End Beta Coarse #2 */ + { /* Beta Coarse #3 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +2.818750e-001f, +7.175000e-001f, +1.306875e+000f, +2.050000e+000f } /* data */ + }, /* End Beta Coarse #3 */ + { /* Beta Coarse #4 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.942188e-001f, +4.943750e-001f, +9.004688e-001f, +1.412500e+000f } /* data */ + }, /* End Beta Coarse #4 */ + { /* Beta Coarse #5 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.375000e-001f, +3.500000e-001f, +6.375000e-001f, +1.000000e+000f } /* data */ + } /* End Beta Coarse #5 */ + } +}; +#endif /* clang-format on */ diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 725e3922d72c393ae0aa49ae7fccbfbb0dea89ef..fd8bd41a3034cbf94686cf6f51c0896dbef503a2 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -37,7 +37,6 @@ #include "options.h" #include "cnst.h" #include "ivas_cnst.h" -#include "typedef.h" #include "stat_com.h" #include "ivas_stat_com.h" #ifdef DEBUGGING @@ -109,26 +108,22 @@ extern const float tdm_ratio_tabl[]; extern const float tdm_den_ratio_tabl[]; extern const int16_t tdm_bit_allc_tbl[5][6]; -#ifdef LSF_RE_USE_SECONDARY_CHANNEL /* LSFs Intra-frame prediction tables */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE extern const float tdm_LSF_MEAN_RE_USE_OUT[M]; extern const float tdm_LSF_MEAN_RE_USE_IN[M]; extern const float tdm_LSF_MEAN_RE_USE[M]; -extern const float tdm_Beta_Q1bit_re_use_132[2]; -extern const float tdm_Beta_Q1bit_re_use_164[2]; -extern const float tdm_Beta_Q1bit_re_use_244_320[2]; -extern const float tdm_Beta_Q1bit_re_use_480[2]; +extern const float tdm_Beta_Q1bit_re_use_13k2[2]; +extern const float tdm_Beta_Q1bit_re_use_16k4[2]; +extern const float tdm_Beta_Q1bit_re_use_24k4_32k[2]; +extern const float tdm_Beta_Q1bit_re_use_48k[2]; extern const float tdm_RE_USE_adaptive_beta_prd_diag_3[15 + 16 + 15]; -#endif extern const float tdm_LSF_MEAN_PRED_QNT_OUT[M]; extern const float tdm_LSF_MEAN_PRED_QNT_IN[M]; extern const float tdm_LSF_MEAN_PRED_QNT[M]; extern const float tdm_PRED_QNT_fixed_beta_prd_diag_3[15 + 16 + 15]; -#endif extern const int16_t fast_FCB_bits_2sfr[]; extern const int16_t fast_FCB_rates_2sfr[]; @@ -166,6 +161,23 @@ extern const int16_t DirAC_band_grouping_5[5 + 1]; extern const int16_t DirAC_block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES + 1]; extern const int16_t DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1]; +#ifdef HODIRAC +extern const float c_weights[DIRAC_NO_FB_BANDS_MAX]; +#endif + +#ifdef HODIRAC +extern const float w_nm[NUM_ANA_SECTORS][9]; +extern const float x_nm[NUM_ANA_SECTORS][9]; +extern const float y_nm[NUM_ANA_SECTORS][9]; +extern const float z_nm[NUM_ANA_SECTORS][9]; +#else +#define NUM_ANA_SECTORS 1 +extern const float w_nm[NUM_ANA_SECTORS][9]; +extern const float x_nm[NUM_ANA_SECTORS][9]; +extern const float y_nm[NUM_ANA_SECTORS][9]; +extern const float z_nm[NUM_ANA_SECTORS][9]; +#endif + /*------------------------------------------------------------------------------------------* * SPAR ROM tables *------------------------------------------------------------------------------------------*/ @@ -177,9 +189,19 @@ extern const ivas_huff_models_t ivas_huff_pred_r_consts[TOTAL_PRED_QUANT_STRATS_ extern const ivas_huff_models_t ivas_huff_drct_r_consts[TOTAL_DRCT_QUANT_STRATS]; extern const ivas_huff_models_t ivas_huff_decd_r_consts[TOTAL_DECD_QUANT_STRATS]; extern const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN]; +#ifdef HODIRAC +extern const int16_t remix_order_set[1][DIRAC_MAX_ANA_CHANS]; +#else extern const int16_t remix_order_set[1][IVAS_SPAR_MAX_CH]; +#endif extern const int16_t keep_planar[IVAS_SPAR_MAX_CH - FOA_CHANNELS]; +#ifdef HODIRAC +extern const int16_t HOA_keep_ind[IVAS_SPAR_MAX_FB_IN_CHAN]; +extern const int16_t HOA_keep_ind_spar[IVAS_SPAR_MAX_CH]; +extern const int16_t HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH]; +#else extern const int16_t HOA_keep_ind[IVAS_SPAR_MAX_CH]; +#endif extern const float dtx_pd_real_min_max[2]; extern const int16_t dtx_pd_real_q_levels[3][3]; @@ -294,6 +316,11 @@ extern const uint8_t masa_joined_nbands[]; extern const uint8_t masa_twodir_bands[]; extern const uint8_t masa_twodir_bands_joined[]; +#ifdef HR_METADATA +extern const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS]; +extern const float diffuseness_thresholds_hr[HR_MASA_ER_LEVELS + 1]; +#endif + /* Multi-channel input and output setups */ extern const float ls_azimuth_CICP2[2]; extern const float ls_elevation_CICP2[2]; @@ -319,6 +346,7 @@ extern const float McMASA_LFEGain_vectors[64]; extern const float ism_azimuth_borders[4]; extern const float ism_elevation_borders[4]; + /*----------------------------------------------------------------------------------* * Param ISM ROM tables *----------------------------------------------------------------------------------*/ @@ -364,6 +392,9 @@ extern const float ivas_cos_twiddle_80[IVAS_80_PT_LEN >> 1]; extern const float ivas_mdft_coeff_cos_twid_240[IVAS_240_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_160[IVAS_160_PT_LEN + 1]; +#ifdef PARAMMC_SHORT_ENC_MDFT +extern const float ivas_mdft_coeff_cos_twid_120[IVAS_120_PT_LEN + 1]; +#endif extern const float ivas_mdft_coeff_cos_twid_80[IVAS_80_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_40[IVAS_40_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_960[IVAS_960_PT_LEN + 1]; @@ -400,5 +431,63 @@ extern const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1]; extern const int16_t ivas_num_active_bands[FB - WB + 1]; +#ifdef SNS_MSVQ +/*------------------------------------------------------------------------------------------* + * SNS MSVQ codebooks and means + *------------------------------------------------------------------------------------------*/ +#ifdef FIX_445_SNS_BUGFIXES +extern const int16_t ivas_sns_cdbks_tcx20_levels[]; +extern const int16_t ivas_sns_cdbks_tcx20_bits[]; + +extern const int16_t ivas_sns_cdbks_tcx10_levels[]; +extern const int16_t ivas_sns_cdbks_tcx10_bits[]; + +extern const float *const ivas_sns_cdbks_tcx20[]; +extern const float *const ivas_sns_cdbks_tcx10[]; + +extern const int16_t ivas_sns_cdbks_side_tcx20_levels[]; +extern const int16_t ivas_sns_cdbks_side_tcx20_bits[]; +extern const int16_t ivas_sns_cdbks_side_tcx10_levels[]; +extern const int16_t ivas_sns_cdbks_side_tcx10_bits[]; + +extern const float *const ivas_sns_cdbks_side_tcx20[]; +extern const float *const ivas_sns_cdbks_side_tcx10[]; +#else +extern const int16_t ivas_sns_cdbks_tcx20_levels[]; +extern const int16_t ivas_sns_cdbks_tcx20_bits[]; + +extern const int16_t ivas_sns_cdbks_tcx10_levels[]; +extern const int16_t ivas_sns_cdbks_tcx10_bits[]; + +extern const float *const ivas_sns_cdbks_tcx20[]; +extern const float *const ivas_sns_cdbks_tcx10[]; + +extern const float ivas_sns_means_tcx20[]; +extern const float ivas_sns_means_tcx10[]; + +extern const int16_t ivas_sns_cdbks_side_tcx20_levels[]; +extern const int16_t ivas_sns_cdbks_side_tcx20_bits[]; +extern const int16_t ivas_sns_cdbks_side_tcx10_levels[]; +extern const int16_t ivas_sns_cdbks_side_tcx10_bits[]; + +extern const float *const ivas_sns_cdbks_side_tcx20[]; +extern const float ivas_sns_means_side_tcx20[]; +extern const float *const ivas_sns_cdbks_side_tcx10[]; +extern const float ivas_sns_means_side_tcx10[]; +#endif +#endif + +#ifdef MC_PARAMUPMIX_MODE +extern ACPL_QUANT_TABLE alpha_quant_table[]; +extern ACPL_QUANT_TABLE beta_quant_table[2][9]; +#endif + +#ifdef FIX_445_SNS_BUGFIXES +/* means and codebooks for the split VQ in the 2-stage SNS VQ */ +extern const int16_t sns_1st_cdbk[2][2][8 * 32]; +extern const int16_t sns_1st_means_16k[2][16]; +extern const int16_t sns_1st_means_25k6[2][16]; +extern const int16_t sns_1st_means_32k[2][16]; +#endif /* IVAS_ROM_COM_H */ #endif diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index d8ad889c3c5937a663726912ae24509ebd79e11e..f5e0c53e3a6b5414a0dca415caf2c9f3b6726c63 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -54,59 +54,10 @@ *-------------------------------------------------------------------*/ /*! r: SBA format mode */ -SBA_MODE ivas_sba_mode_select( - const int32_t ivas_total_brate /* i : IVAS total bitrate */ -) +SBA_MODE ivas_sba_mode_select() { - SBA_MODE sba_mode; - - if ( ivas_total_brate == IVAS_13k2 || ivas_total_brate == IVAS_16k4 ) - { - sba_mode = SBA_MODE_DIRAC; - } - else - { - sba_mode = SBA_MODE_SPAR; - } - - return sba_mode; -} -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -/*-------------------------------------------------------------------* - * get_sba_reinit_flag() - * - * Get SBA reinitialisation flag - *-------------------------------------------------------------------*/ - -int16_t get_sba_reinit_flag( - int32_t ivas_total_bitrate, /* i : Current bitrate */ - int32_t last_ivas_total_brate, /* i : Previous bitrate */ - int16_t sba_order ) -{ - int16_t sba_reinit_flag; - - sba_reinit_flag = 0; - if ( ivas_total_bitrate != last_ivas_total_brate && ( ivas_total_bitrate > IVAS_SID_5k2 ) ) - { - int16_t sba_analysis_order, nchan_transport_old, nchan_transport_new; - SBA_MODE last_sba_mode, current_sba_mode; - sba_analysis_order = ivas_sba_get_analysis_order( last_ivas_total_brate, sba_order ); - nchan_transport_old = ivas_get_sba_num_TCs( last_ivas_total_brate, min( sba_analysis_order, IVAS_MAX_SBA_ORDER ) ); - last_sba_mode = ivas_sba_mode_select( last_ivas_total_brate ); - current_sba_mode = ivas_sba_mode_select( ivas_total_bitrate ); - sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_bitrate, sba_order ); - nchan_transport_new = ivas_get_sba_num_TCs( ivas_total_bitrate, min( sba_analysis_order, IVAS_MAX_SBA_ORDER ) ); - if ( ( current_sba_mode != last_sba_mode ) || ( nchan_transport_new != nchan_transport_old ) ) - { - sba_reinit_flag = 1; - } - } - - return sba_reinit_flag; + return SBA_MODE_SPAR; } -#endif -#endif /*-------------------------------------------------------------------* * ivas_sba_config() * @@ -271,6 +222,10 @@ int16_t ivas_sba_get_nchan( /*! r: number of ambisonics metadata channels */ int16_t ivas_sba_get_nchan_metadata( const int16_t sba_order /* i : Ambisonic (SBA) order */ +#ifdef SPAR_TUNING + , + const int32_t ivas_total_brate +#endif ) { int16_t nb_channels; @@ -281,8 +236,19 @@ int16_t ivas_sba_get_nchan_metadata( } else { - /* FOA + planar HOA */ - nb_channels = FOA_CHANNELS + 2 * ( sba_order - 1 ); +#ifdef SPAR_TUNING + if ( ivas_total_brate >= IVAS_512k ) + { + nb_channels = ( SBA_HOA2_ORDER + 1 ) * ( SBA_HOA2_ORDER + 1 ); + nb_channels += 2; + nb_channels = min( nb_channels, ( sba_order + 1 ) * ( sba_order + 1 ) ); + } + else +#endif + { + /* FOA + planar HOA */ + nb_channels = FOA_CHANNELS + 2 * ( sba_order - 1 ); + } } return ( nb_channels ); @@ -295,6 +261,58 @@ int16_t ivas_sba_get_nchan_metadata( *-------------------------------------------------------------------*/ /*! r: flag indicating to code SPAR HOA MD for all bands */ +#ifdef SPAR_TUNING +void ivas_sba_get_spar_hoa_ch_ind( + const int16_t num_md_chs, /* i : number of MD channels */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] ) +{ + int16_t ch; + const int16_t *hoa_ind; + + if ( ivas_total_brate >= IVAS_512k ) + { + hoa_ind = HOA_keep_ind_spar512; + } + else + { + hoa_ind = HOA_keep_ind_spar; + } + for ( ch = 0; ch < num_md_chs; ch++ ) + { + HOA_md_ind[ch] = hoa_ind[ch]; + } + + return; +} + +void ivas_sba_get_spar_hoa_md_flag( + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + int16_t *spar_hoa_md_flag, + int16_t *spar_hoa_dirac2spar_md_flag ) +{ + if ( sba_order > 1 && ivas_total_brate >= IVAS_256k ) + { + *spar_hoa_md_flag = 1; + } + else + { + *spar_hoa_md_flag = 0; + } + + if ( sba_order > 1 && ivas_total_brate >= IVAS_512k ) + { + *spar_hoa_dirac2spar_md_flag = 0; + } + else + { + *spar_hoa_dirac2spar_md_flag = 1; + } + + return; +} +#else int16_t ivas_sba_get_spar_hoa_md_flag( const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ @@ -313,6 +331,8 @@ int16_t ivas_sba_get_spar_hoa_md_flag( return spar_hoa_md_flag; } +#endif + /*-------------------------------------------------------------------* * ivas_sba_zero_vert_comp() diff --git a/lib_com/ivas_sns_com.c b/lib_com/ivas_sns_com.c index e4515a98547ce096ec8f1ebcbb46b2a1ce0a0f7d..b109ef87d6978833b560e3ab34f0005ba12fde7d 100644 --- a/lib_com/ivas_sns_com.c +++ b/lib_com/ivas_sns_com.c @@ -36,6 +36,9 @@ #include "prot.h" #include "ivas_prot.h" #include "rom_com.h" +#ifdef FIX_445_SNS_BUGFIXES +#include "ivas_rom_com.h" +#endif #include #include #ifdef DEBUGGING @@ -118,6 +121,23 @@ void sns_compute_scf( xs[FDNS_NPTS - 1] = 0.75f * x[FDNS_NPTS - 1] + 0.25f * x[FDNS_NPTS - 2]; /* Pre-emphasis */ +#ifdef FIX_445_SNS_BUGFIXES + switch ( L_frame ) + { + case L_FRAME16k: + tilt = 19.f; + break; + case L_FRAME25_6k: + tilt = 22.f; + break; + case L_FRAME32k: + tilt = 23.5f; + break; + default: + tilt = 0.f; + assert( !"illegal frame length in sns_compute_scf" ); + } +#else if ( L_frame == L_FRAME16k ) { tilt = 18.f; @@ -143,6 +163,7 @@ void sns_compute_scf( tilt = 0.f; assert( 0 && "illegal frame length in sns_compute_scf" ); } +#endif for ( i = 0; i < FDNS_NPTS; i++ ) { diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index cb6ff23fc011ccfe3ca4364a1b38bb2a4143f6e0..7ca2d417159fb59b38284516609240168f887111 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -61,6 +61,7 @@ #define IVAS_ACTIVEW_DM_F ( 1.0f ) #define IVAS_ACTIVEW_DM_F_DTX ( 0.25f ) +#define IVAS_ACTIVEW_DM_F_VLBR ( 0.25f ) #define IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH ( 3.0f ) #define IVAS_P_NORM_SCALING ( 1.0f ) @@ -76,11 +77,11 @@ *------------------------------------------------------------------------------------------*/ -static void ivas_get_pred_coeffs( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ppPred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ppDM_Fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], const int16_t in_chans, const int16_t start_band, const int16_t end_band, const int16_t active_w, const int16_t dtx_vad, const int16_t from_dirac ); +static void ivas_get_pred_coeffs( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ppPred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ppDM_Fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], const int16_t in_chans, const int16_t start_band, const int16_t end_band, const int16_t active_w, const int16_t active_w_vlbr, const int16_t dtx_vad, const int16_t from_dirac ); static void ivas_reorder_array( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS], const int16_t in_chans, const int16_t order[IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t start_band, const int16_t end_band ); -static void ivas_get_Wscaling_factor( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ***mixer_mat, const int16_t start_band, const int16_t end_band, const int16_t dtx_vad, const int16_t num_ch, const int16_t *pNum_dmx, const int16_t bands_bw, const int16_t active_w, float *pWscale ); +static void ivas_get_Wscaling_factor( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ***mixer_mat, const int16_t start_band, const int16_t end_band, const int16_t dtx_vad, const int16_t num_ch, const int16_t *pNum_dmx, const int16_t bands_bw, const int16_t active_w, const int16_t active_w_vlbr, float *pWscale ); static void ivas_calc_post_pred_per_band( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t num_ch, const int16_t num_dmx, const int16_t band_idx, float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ); @@ -338,8 +339,7 @@ void ivas_spar_config( { ivas_total_brate = IVAS_32k; } - - assert( ivas_total_brate == IVAS_32k || ivas_total_brate == IVAS_24k4 ); + assert( ivas_total_brate == IVAS_32k || ivas_total_brate == IVAS_24k4 || ivas_total_brate == IVAS_16k4 || ivas_total_brate == IVAS_13k2 ); if ( ivas_total_brate == IVAS_32k ) { *core_nominal_brate = ACELP_24k40; @@ -348,6 +348,14 @@ void ivas_spar_config( { *core_nominal_brate = ACELP_16k40; } + else if ( ivas_total_brate == IVAS_16k4 ) + { + *core_nominal_brate = ACELP_13k20; + } + else if ( ivas_total_brate == IVAS_13k2 ) + { + *core_nominal_brate = ACELP_9k60; + } } return; @@ -427,7 +435,7 @@ int16_t ivas_get_sba_num_TCs( { nchan_transport = 1; } - else if ( ivas_sba_mode_select( ivas_total_brate ) == SBA_MODE_DIRAC ) + else if ( ivas_sba_mode_select() == SBA_MODE_DIRAC ) { nchan_transport = 1; } @@ -456,6 +464,7 @@ static void ivas_get_pred_coeffs( const int16_t start_band, const int16_t end_band, const int16_t active_w, + const int16_t active_w_vlbr, const int16_t dtx_vad, const int16_t from_dirac ) { @@ -546,7 +555,7 @@ static void ivas_get_pred_coeffs( } else { - dm_f_local = IVAS_ACTIVEW_DM_F; + dm_f_local = ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_VLBR : IVAS_ACTIVEW_DM_F; } for ( b = start_band; b < end_band; b++ ) @@ -645,6 +654,7 @@ static void ivas_get_Wscaling_factor( const int16_t *pNum_dmx, const int16_t bands_bw, const int16_t active_w, + const int16_t active_w_vlbr, float *pWscale ) { int16_t b, ch; @@ -657,7 +667,7 @@ static void ivas_get_Wscaling_factor( } else { - dm_f_local = IVAS_ACTIVEW_DM_F_SCALE; + dm_f_local = ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR : IVAS_ACTIVEW_DM_F_SCALE; } for ( b = start_band; b < end_band; b++ ) @@ -1538,6 +1548,7 @@ void ivas_compute_spar_params( const int16_t num_ch, const int16_t bands_bw, const int16_t active_w, + const int16_t active_w_vlbr, ivas_spar_md_com_cfg *hSparCfg, ivas_spar_md_t *hSparMd, float *pWscale, @@ -1546,7 +1557,9 @@ void ivas_compute_spar_params( float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; int16_t b, i, ndm; - ivas_get_pred_coeffs( cov_real, pred_coeffs_re, dm_fv_re, num_ch, start_band, end_band, active_w, dtx_vad, from_dirac ); + ivas_get_pred_coeffs( cov_real, pred_coeffs_re, dm_fv_re, num_ch, start_band, end_band, active_w, + active_w_vlbr, + dtx_vad, from_dirac ); #ifdef SPAR_HOA_DBG /*fprintf(stderr, "\n\n Prediction Coefficients:\n"); @@ -1578,7 +1591,9 @@ void ivas_compute_spar_params( #endif ivas_get_Wscaling_factor( cov_real, pred_coeffs_re, mixer_mat, start_band, end_band, dtx_vad, num_ch, - hSparCfg->num_dmx_chans_per_band, bands_bw, active_w, pWscale ); + hSparCfg->num_dmx_chans_per_band, bands_bw, active_w, + active_w_vlbr, + pWscale ); for ( b = start_band; b < end_band; b++ ) { @@ -1648,7 +1663,9 @@ void ivas_get_spar_md_from_dirac( const int16_t end_band, const int16_t order, const int16_t dtx_vad, - float Wscale_d[IVAS_MAX_NUM_BANDS] ) + float Wscale_d[IVAS_MAX_NUM_BANDS], + const uint8_t useLowerRes, + const int16_t active_w_vlbr ) { int16_t num_ch, band, i, j; int16_t block, ch; @@ -1662,14 +1679,27 @@ void ivas_get_spar_md_from_dirac( float **ppMixer_mat[IVAS_MAX_FB_MIXER_OUT_CH]; float *pMixer_mat[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]; float en_ratio_fac, diff_norm_order1, diff_norm_order2, diff_norm_order3; + int16_t ndm, foa_ch, hoa2_ch; float P_dir_fact[IVAS_SPAR_MAX_CH - 1]; const int16_t *remix_order; remix_order = remix_order_set[hSpar_md_cfg->remix_unmix_order]; - num_ch = ivas_sba_get_nchan_metadata( order ); - hoa2_ch = ivas_sba_get_nchan_metadata( SBA_HOA2_ORDER ); + num_ch = ivas_sba_get_nchan_metadata( order +#ifdef SPAR_TUNING + , + IVAS_256k /*dummy value as order is always 1 in this function*/ +#endif + ); + + hoa2_ch = ivas_sba_get_nchan_metadata( SBA_HOA2_ORDER +#ifdef SPAR_TUNING + , + IVAS_256k /*dummy value as order is always 1 in this function*/ +#endif + ); + foa_ch = FOA_CHANNELS; diff_norm_order1 = 3.0f; diff_norm_order2 = 5.0f; @@ -1684,7 +1714,7 @@ void ivas_get_spar_md_from_dirac( ppMixer_mat[i] = pMixer_mat[i]; } - if ( start_band >= 6 && hSpar_md_cfg->nchan_transport <= 2 && ( dtx_vad == 1 ) ) + if ( ( start_band >= 6 && hSpar_md_cfg->nchan_transport <= 2 && ( dtx_vad == 1 ) ) || ( useLowerRes && start_band >= 3 && hSpar_md_cfg->nchan_transport <= 2 && ( dtx_vad == 1 ) ) ) { float P_norm[3]; int16_t idx; @@ -1739,10 +1769,15 @@ void ivas_get_spar_md_from_dirac( /*SPAR from DirAC*/ set_f( response_avg, 0.0f, MAX_OUTPUT_CHANNELS ); + if ( n_ts > 1 ) { ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][i_ts], (int16_t) ele_dirac[band][i_ts], response_avg, order ); } + else if ( useLowerRes ) + { + ivas_dirac_dec_get_response( (int16_t) azi_dirac[band][0], (int16_t) ele_dirac[band][0], response_avg, order ); + } else { for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) @@ -1809,64 +1844,69 @@ void ivas_get_spar_md_from_dirac( { response_avg[i] = response_avg[HOA_keep_ind[i]]; } + en_ratio_fac = ( 1.0f - diffuseness[band] ); - for ( i = 0; i < num_ch; i++ ) { - for ( j = 0; j < num_ch; j++ ) + for ( i = 0; i < num_ch; i++ ) { - if ( i == j ) + for ( j = 0; j < num_ch; j++ ) { - if ( i == 0 ) - { - cov_real_dirac[i][i][band] = 1.0f; - } - else + if ( i == j ) { - cov_real_dirac[i][j][band] = en_ratio_fac * response_avg[i] * response_avg[j]; - if ( hSpar_md_cfg->nchan_transport <= 2 ) + if ( i == 0 ) + { + cov_real_dirac[i][i][band] = 1.0f; + } + else { - cov_real_dirac[i][j][band] *= en_ratio_fac; - if ( ( i >= ndm ) && ( dtx_vad == 1 ) ) + cov_real_dirac[i][j][band] = en_ratio_fac * response_avg[i] * response_avg[j]; + + if ( hSpar_md_cfg->nchan_transport <= 2 ) { - cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) * P_dir_fact[i - ndm]; + + cov_real_dirac[i][j][band] *= en_ratio_fac; + if ( ( i >= ndm ) && ( dtx_vad == 1 ) ) + { + cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) * P_dir_fact[i - ndm]; + } + else + { + if ( i < foa_ch ) + { + cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order1; + } + else if ( i < hoa2_ch ) + { + cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order2; + } + else + { + cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order3; + } + } } else { if ( i < foa_ch ) { - cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order1; + cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order1; } else if ( i < hoa2_ch ) { - cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order2; + cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order2; } else { - cov_real_dirac[i][j][band] += ( 1.0f - ( en_ratio_fac * en_ratio_fac ) ) / diff_norm_order3; + cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order3; } } } - else - { - if ( i < foa_ch ) - { - cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order1; - } - else if ( i < hoa2_ch ) - { - cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order2; - } - else - { - cov_real_dirac[i][j][band] += ( 1.0f - en_ratio_fac ) / diff_norm_order3; - } - } } - } - else - { - cov_real_dirac[i][j][band] = en_ratio_fac * response_avg[i] * response_avg[j]; + else + { + cov_real_dirac[i][j][band] = en_ratio_fac * response_avg[i] * response_avg[j]; + } } } } @@ -1880,7 +1920,7 @@ void ivas_get_spar_md_from_dirac( } } -#ifdef DEBUG_SPAR_WRITE_OUT_COV +#ifdef DEBUG_SBA_MD_DUMP { static FILE *fid = 0; int16_t k = 0; @@ -1905,7 +1945,9 @@ void ivas_get_spar_md_from_dirac( #endif ivas_compute_spar_params( pCov_real, dm_fv_re, i_ts, ppMixer_mat, start_band, end_band, dtx_vad, - num_ch, 1, hSpar_md_cfg->active_w, hSpar_md_cfg, hSpar_md, Wscale, 1 ); + num_ch, 1, hSpar_md_cfg->active_w, + active_w_vlbr, + hSpar_md_cfg, hSpar_md, Wscale, 1 ); if ( mixer_mat != NULL ) { @@ -2131,8 +2173,13 @@ void ivas_spar_set_bitrate_config( max_bits += (int16_t) ( ivas_spar_br_table_consts[table_idx].core_brs[i][1] / FRAMES_PER_SEC ); } +#ifdef COMBINED_FORMAT_SIGNALING + pSpar_md_cfg->tgt_bits_per_blk = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ) - IVAS_FORMAT_SIGNALING_NBITS_EXTENDED - SBA_PLANAR_BITS - SBA_ORDER_BITS - length - total_bits; + pSpar_md_cfg->max_bits_per_blk = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ) - IVAS_FORMAT_SIGNALING_NBITS_EXTENDED - SBA_PLANAR_BITS - SBA_ORDER_BITS - length - max_bits; +#else pSpar_md_cfg->tgt_bits_per_blk = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ) - IVAS_FORMAT_SIGNALING_NBITS_SBA - SBA_PLANAR_BITS - SBA_ORDER_BITS - length - total_bits; pSpar_md_cfg->max_bits_per_blk = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ) - IVAS_FORMAT_SIGNALING_NBITS_SBA - SBA_PLANAR_BITS - SBA_ORDER_BITS - length - max_bits; +#endif md_coding_bits_header = SPAR_NUM_CODING_STRAT_BITS + pSpar_md_cfg->quant_strat_bits; diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 5c9b60aceba75d6555209328a8e29556147167f1..e2f2e0f1f28605512ca05562788e267b0ca68b08 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -41,22 +41,48 @@ /*----------------------------------------------------------------------------------* - * Declaration of ISm common (encoder & decoder) structure + * Declaration of ISM common (encoder & decoder) structure *----------------------------------------------------------------------------------*/ +typedef struct +{ + int16_t last_angle1_idx; /* last frame index of coded azimuth/yaw */ + int16_t angle1_diff_cnt; /* FEC counter of consecutive differentially azimuth/yaw coded frames */ + int16_t last_angle2_idx; /* last frame index of coded elevation/pitch */ + int16_t angle2_diff_cnt; /* FEC counter of consecutive differentially elevation/pitch coded frames */ + +} ISM_METADATA_ANGLE, *ISM_METADATA_ANGLE_HANDLE; + /* ISM metadata handle (storage for one frame of read ISM metadata) */ typedef struct { int16_t ism_metadata_flag; /* flag whether metadata are coded in particular frame of particular object */ int16_t last_ism_metadata_flag; /* last frame ism_metadata_flag */ - +#ifdef ISM_NON_DIEGETIC_PAN + int16_t non_diegetic_flag; /* Non-diegetic (non-headtracked) object flag */ +#endif float azimuth; /* azimuth value read from the input metadata file */ float elevation; /* azimuth value read from the input metadata file */ - - int16_t last_azimuth_idx; /* last frame index of coded azimuth */ - int16_t azimuth_diff_cnt; /* FEC counter of consecutive differentially azimuth coded frames */ - int16_t last_elevation_idx; /* last frame index of coded elevation */ - int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ + float radius; + float yaw; /* azimuth orientation value read from the input metadata file */ + float pitch; /* elevation orientation value read from the input metadata file */ + ISM_METADATA_ANGLE position_angle; /* Angle structs for azimuth and elevation */ + ISM_METADATA_ANGLE orientation_angle; /* Angle structs for yaw and pitch */ + int16_t last_radius_idx; /* last frame index of coded radius */ + int16_t radius_diff_cnt; /* FEC counter of consecutive differentially radius coded frames */ + + float last_azimuth; /* MD smoothing in DTX- last Q azimuth value */ + float last_elevation; /* MD smoothing in DTX - last Q elevation value */ + float last_true_azimuth; /* MD smoothing in DTX- last true Q azimuth value */ + float last_true_elevation; /* MD smoothing in DTX- last true Q elevation value */ + +#ifdef FIX_387_ISM_MD_FEC + int16_t ism_md_fec_cnt_enc; /* counter of continuous frames where MD are not transmitted */ + int16_t ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */ +#endif +#ifdef FIX_435_ISM_MERGE_BUG + float last_true_radius; /* last true Q radius value */ +#endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; @@ -130,7 +156,6 @@ typedef struct ivas_param_ism_data_structure int16_t nbands; int16_t nblocks[MAX_PARAM_ISM_NBANDS]; int16_t band_grouping[MAX_PARAM_ISM_NBANDS + 1]; - int16_t num_obj; int16_t azi_index[MAX_NUM_OBJECTS]; int16_t ele_index[MAX_NUM_OBJECTS]; @@ -145,6 +170,9 @@ typedef struct ivas_param_ism_data_structure int16_t flag_noisy_speech; int16_t noisy_speech_buffer[PARAM_ISM_HYS_BUF_SIZE]; +#ifdef FIX_440_PARAM_ISM_DIR_NOISE + int16_t flag_equal_energy; +#endif } PARAM_ISM_CONFIG_DATA, *PARAM_ISM_CONFIG_HANDLE; @@ -157,6 +185,9 @@ typedef struct ivas_dirac_config_data_struct { int16_t enc_param_start_band; int16_t dec_param_estim; +#ifdef FIX_391_SBA + int16_t dec_param_estim_old; +#endif int16_t nbands; } DIRAC_CONFIG_DATA, *DIRAC_CONFIG_DATA_HANDLE; @@ -323,7 +354,7 @@ typedef struct ivas_agc_chan_data_t typedef struct ivas_agc_com_state_t { float *winFunc; - int16_t in_delay; + int16_t in_delay; /* TODO: JBM check if this needs to be adjusted in the dec */ uint16_t absEmin; uint16_t betaE; uint16_t maxAttExp; @@ -403,6 +434,9 @@ typedef struct ivas_masa_directional_spatial_meta_struct float elevation[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float spread_coherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#ifdef HR_METADATA + uint16_t spherical_index[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#endif } MASA_DIRECTIONAL_SPATIAL_META; @@ -478,7 +512,6 @@ typedef struct ivas_qdirection_band_coherence_data_struct uint8_t spread_coherence[MAX_PARAM_SPATIAL_SUBFRAMES]; uint16_t spread_coherence_dct0_index; uint16_t spread_coherence_dct1_index; - } IVAS_QDIRECTION_BAND_COHERENCE_DATA; typedef struct ivas_surround_coherence_band_data_struct @@ -655,6 +688,36 @@ typedef struct ivas_trans_det_state_t } ivas_trans_det_state_t; +/*----------------------------------------------------------------------------------* + * Time domain decorrelator + *----------------------------------------------------------------------------------*/ + +typedef struct ivas_td_decorr_APD_filt_state_t +{ + int16_t order[IVAS_MAX_DECORR_APD_SECTIONS]; + int16_t idx[IVAS_MAX_DECORR_APD_SECTIONS]; + float coeffs[IVAS_MAX_DECORR_APD_SECTIONS]; + float *state[IVAS_MAX_DECORR_APD_SECTIONS]; + +} ivas_td_decorr_APD_filt_state_t; + +typedef struct ivas_td_decorr_state_t +{ + ivas_trans_det_state_t *pTrans_det; + float *look_ahead_buf; + ivas_td_decorr_APD_filt_state_t APD_filt_state[IVAS_MAX_DECORR_CHS]; + + int16_t num_apd_outputs; + int16_t num_apd_sections; + int16_t ducking_flag; + +#ifdef JBM_TSM_ON_TCS + int16_t offset; +#endif + +} ivas_td_decorr_state_t; + + /*----------------------------------------------------------------------------------* * Filter Bank (FB) structures *----------------------------------------------------------------------------------*/ @@ -664,6 +727,9 @@ typedef struct ivas_fb_mixer_cfg_t int16_t fb_latency; int16_t num_in_chans; int16_t num_out_chans; +#ifdef HODIRAC + int16_t nchan_fb_in; +#endif int16_t pcm_offset; int16_t fade_len; /* this sets the stride length; no delay is introduced */ int16_t prior_input_length; diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 8b93558b219ea63fce4c737e2436d6221ff40ad0..dee56c5dff17f6b34fb245fcf8beb729603e6b09 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -478,7 +478,6 @@ void td_stereo_param_updt( } -#ifdef LSF_RE_USE_SECONDARY_CHANNEL /*-------------------------------------------------------------------* * tdm_SCh_LSF_intra_pred_zero_bits() * @@ -487,7 +486,7 @@ void td_stereo_param_updt( static void tdm_SCh_LSF_intra_pred_zero_bits( const float *tdm_lsfQ_PCh, /* i : primary channel LSFs */ - float *pred_lsf_secondary, /* o : predicted secondary channel LSFs */ + float *pred_lsf_SCh, /* o : predicted secondary channel LSFs */ const float *lsf_mean, /* i : secondary channel mean LSFs */ const float beta /* i : pull to average beta factor */ ) @@ -497,7 +496,7 @@ static void tdm_SCh_LSF_intra_pred_zero_bits( /* pulling the LSFs closer to the average */ for ( i = 0; i < M; i++ ) { - pred_lsf_secondary[i] = beta * tdm_lsfQ_PCh[i] + ( 1.0f - beta ) * lsf_mean[i]; + pred_lsf_SCh[i] = beta * tdm_lsfQ_PCh[i] + ( 1.0f - beta ) * lsf_mean[i]; } return; @@ -511,7 +510,7 @@ static void tdm_SCh_LSF_intra_pred_zero_bits( *-------------------------------------------------------------------*/ static void tdm_SCh_LSF_intra_pred_tri_diag_mat( - float *lsf_secondary, /* i/o: secondary channel LSFs */ + float *lsf_SCh, /* i/o: secondary channel LSFs */ const float *lsf_mean_in, /* i : secondary channel mean LSFs (in) */ const float *lsf_mean_out, /* i : secondary channel mean LSFs (out) */ const float *prd_diag_3 /* i : secondary channel mean LSFs */ @@ -522,37 +521,38 @@ static void tdm_SCh_LSF_intra_pred_tri_diag_mat( const float *prd_ptr; float *lsf_tmp_ptr1; float *lsf_tmp_ptr2; - float *lsf_second_ptr; + float *lsf_SCh_ptr; prd_ptr = prd_diag_3; - v_sub( lsf_secondary, lsf_mean_in, lsf_tmp, M ); + v_sub( lsf_SCh, lsf_mean_in, lsf_tmp, M ); lsf_tmp_ptr1 = lsf_tmp; - lsf_second_ptr = lsf_secondary; + lsf_SCh_ptr = lsf_SCh; lsf_tmp_ptr2 = lsf_tmp_ptr1; - *lsf_second_ptr = ( *lsf_tmp_ptr1++ ) * ( *prd_ptr++ ); - ( *lsf_second_ptr++ ) += ( *lsf_tmp_ptr1 ) * ( *prd_ptr++ ); + *lsf_SCh_ptr = ( *lsf_tmp_ptr1++ ) * ( *prd_ptr++ ); + ( *lsf_SCh_ptr++ ) += ( *lsf_tmp_ptr1 ) * ( *prd_ptr++ ); for ( i = 1; i < M - 1; i++ ) { lsf_tmp_ptr1 = lsf_tmp_ptr2; - *lsf_second_ptr = ( *lsf_tmp_ptr1++ ) * ( *prd_ptr++ ); + *lsf_SCh_ptr = ( *lsf_tmp_ptr1++ ) * ( *prd_ptr++ ); lsf_tmp_ptr2 = lsf_tmp_ptr1; - *lsf_second_ptr += ( *lsf_tmp_ptr1++ ) * ( *prd_ptr++ ); - ( *lsf_second_ptr++ ) += ( *lsf_tmp_ptr1 ) * ( *prd_ptr++ ); + *lsf_SCh_ptr += ( *lsf_tmp_ptr1++ ) * ( *prd_ptr++ ); + ( *lsf_SCh_ptr++ ) += ( *lsf_tmp_ptr1 ) * ( *prd_ptr++ ); } lsf_tmp_ptr1 = lsf_tmp_ptr2; - *lsf_second_ptr = ( *lsf_tmp_ptr1++ ) * ( *prd_ptr++ ); - *lsf_second_ptr += ( *lsf_tmp_ptr1 ) * ( *prd_ptr ); + *lsf_SCh_ptr = ( *lsf_tmp_ptr1++ ) * ( *prd_ptr++ ); + *lsf_SCh_ptr += ( *lsf_tmp_ptr1 ) * ( *prd_ptr ); - v_add( lsf_secondary, lsf_mean_out, lsf_secondary, M ); + v_add( lsf_SCh, lsf_mean_out, lsf_SCh, M ); return; } + /*-------------------------------------------------------------------* * tdm_SCh_LSF_intra_pred() * @@ -562,7 +562,7 @@ static void tdm_SCh_LSF_intra_pred_tri_diag_mat( void tdm_SCh_LSF_intra_pred( const int32_t element_brate, /* i : element bitrate */ const float *tdm_lsfQ_PCh, /* i : primary channel LSFs */ - float *pred_lsf_secondary /* o : predicted secondary channel LSFs */ + float *pred_lsf_SCh /* o : predicted secondary channel LSFs */ ) { float fixed_beta; @@ -588,15 +588,43 @@ void tdm_SCh_LSF_intra_pred( fixed_beta = 0.91F; } - tdm_SCh_LSF_intra_pred_zero_bits( tdm_lsfQ_PCh, pred_lsf_secondary, tdm_LSF_MEAN_PRED_QNT, fixed_beta ); + tdm_SCh_LSF_intra_pred_zero_bits( tdm_lsfQ_PCh, pred_lsf_SCh, tdm_LSF_MEAN_PRED_QNT, fixed_beta ); + + tdm_SCh_LSF_intra_pred_tri_diag_mat( pred_lsf_SCh, tdm_LSF_MEAN_PRED_QNT_IN, tdm_LSF_MEAN_PRED_QNT_OUT, tdm_PRED_QNT_fixed_beta_prd_diag_3 ); + + return; +} + + +/*-------------------------------------------------------------------* + * tdm_SCh_LSF_intra_pred_one_bit_dec() + * + * + *-------------------------------------------------------------------*/ + +static void tdm_SCh_LSF_intra_pred_one_bit_dec( + const float *tdm_lsfQ_PCh, /* i : primary channel LSFs */ + float *pred_lsf_SCh, /* o : predicted secondary channel LSFs */ + const float *lsf_mean, /* i : secondary channel mean LSFs */ + const float *Beta_Q_x, /* i : beta quantization values */ + const int16_t beta_index /* i : the quantization bits for beta (-1 if beta fixed)*/ +) +{ + int16_t i; + float beta; + + beta = Beta_Q_x[beta_index]; - tdm_SCh_LSF_intra_pred_tri_diag_mat( pred_lsf_secondary, tdm_LSF_MEAN_PRED_QNT_IN, tdm_LSF_MEAN_PRED_QNT_OUT, tdm_PRED_QNT_fixed_beta_prd_diag_3 ); + /* pulling the LSFs closer to the avergae */ + for ( i = 0; i < M; i++ ) + { + pred_lsf_SCh[i] = beta * tdm_lsfQ_PCh[i] + ( 1.0f - beta ) * lsf_mean[i]; + } return; } -#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE /*-------------------------------------------------------------------* * tdm_SCh_LSF_intra_pred_one_bit_enc() * @@ -604,29 +632,28 @@ void tdm_SCh_LSF_intra_pred( *-------------------------------------------------------------------*/ static void tdm_SCh_LSF_intra_pred_one_bit_enc( - const float *lsf_secondary, /* i : secondary channel LSFs */ - const float *tdm_lsfQ_PCh, /* i : primary channel LSFs */ - float *pred_lsf_secondary, /* o : predicted secondary channel LSFs */ - const float *lsf_mean, /* i : secondary channel mean LSFs */ - const float *lsf_wgts_new, /* i : Improved wgts for LSFs */ - const float *Beta_Q_x, /* i : beta quantization values */ - int16_t *beta_index /* o : the quantization bits for beta (-1 if beta fixed) */ + const float *lsf_SCh, /* i : secondary channel LSFs */ + const float *tdm_lsfQ_PCh, /* i : primary channel LSFs */ + float *pred_lsf_SCh, /* o : predicted secondary channel LSFs */ + const float *lsf_mean, /* i : secondary channel mean LSFs */ + const float *lsf_wgts_new, /* i : Improved wgts for LSFs */ + const float *Beta_Q_x, /* i : beta quantization values */ + int16_t *beta_index /* o : the quantization bits for beta (-1 if beta fixed) */ ) { int16_t i; float A_temp[M]; float B_temp[M]; float WD[2]; - float beta; for ( i = 0; i < M; i++ ) { - A_temp[i] = lsf_secondary[i] - lsf_mean[i]; + A_temp[i] = lsf_SCh[i] - lsf_mean[i]; B_temp[i] = lsf_mean[i] - tdm_lsfQ_PCh[i]; } - WD[0] = 0.; - WD[1] = 0.; + WD[0] = 0.f; + WD[1] = 0.f; for ( i = 0; i < M; i++ ) { WD[0] += lsf_wgts_new[i] * SQR( A_temp[i] ) + 2.0f * Beta_Q_x[0] * lsf_wgts_new[i] * A_temp[i] * B_temp[i] + lsf_wgts_new[i] * SQR( Beta_Q_x[0] ) * SQR( B_temp[i] ); @@ -635,49 +662,14 @@ static void tdm_SCh_LSF_intra_pred_one_bit_enc( if ( WD[0] < WD[1] ) { - beta = Beta_Q_x[0]; *beta_index = 0; } else { - beta = Beta_Q_x[1]; *beta_index = 1; } - /* pulling the LSFs closer to the avergae */ - for ( i = 0; i < M; i++ ) - { - pred_lsf_secondary[i] = beta * tdm_lsfQ_PCh[i] + ( 1.0f - beta ) * lsf_mean[i]; - } - - return; -} - - -/*-------------------------------------------------------------------* - * tdm_SCh_LSF_intra_pred_one_bit_dec() - * - * - *-------------------------------------------------------------------*/ - -static void tdm_SCh_LSF_intra_pred_one_bit_dec( - const float *tdm_lsfQ_PCh, /* i : primary channel LSFs */ - float *pred_lsf_secondary, /* o : predicted secondary channel LSFs */ - const float *lsf_mean, /* i : secondary channel mean LSFs */ - const float *Beta_Q_x, /* i : beta quantization values */ - const int16_t beta_index /* i : the quantization bits for beta (-1 if beta fixed)*/ -) -{ - int16_t i; - float beta; - - beta = Beta_Q_x[beta_index]; - - /* pulling the LSFs closer to the avergae */ - for ( i = 0; i < M; i++ ) - { - pred_lsf_secondary[i] = beta * tdm_lsfQ_PCh[i] + ( 1.0f - beta ) * lsf_mean[i]; - } + tdm_SCh_LSF_intra_pred_one_bit_dec( tdm_lsfQ_PCh, pred_lsf_SCh, tdm_LSF_MEAN_RE_USE, Beta_Q_x, *beta_index ); return; } @@ -696,26 +688,26 @@ void tdm_SCh_lsf_reuse( float lsp_new[M], /* i/o: LSPs at the end of the frame */ const float tdm_lsfQ_PCh[M], /* i : primary channel LSFs */ const float lsf_wgts[M], /* i : LSF weights */ - int16_t beta_index[] /* i/o: quantization index */ + int16_t *beta_index /* i/o: quantization index */ ) { const float *Beta_Q1bit_re_use; if ( element_brate <= IVAS_13k2 ) { - Beta_Q1bit_re_use = &tdm_Beta_Q1bit_re_use_132[0]; + Beta_Q1bit_re_use = tdm_Beta_Q1bit_re_use_13k2; } else if ( element_brate <= IVAS_16k4 ) { - Beta_Q1bit_re_use = &tdm_Beta_Q1bit_re_use_164[0]; + Beta_Q1bit_re_use = tdm_Beta_Q1bit_re_use_16k4; } else if ( element_brate <= IVAS_32k ) { - Beta_Q1bit_re_use = &tdm_Beta_Q1bit_re_use_244_320[0]; + Beta_Q1bit_re_use = tdm_Beta_Q1bit_re_use_24k4_32k; } else { - Beta_Q1bit_re_use = &tdm_Beta_Q1bit_re_use_480[0]; + Beta_Q1bit_re_use = tdm_Beta_Q1bit_re_use_48k; } if ( enc_dec == ENC ) @@ -729,10 +721,7 @@ void tdm_SCh_lsf_reuse( tdm_SCh_LSF_intra_pred_tri_diag_mat( lsf_new, tdm_LSF_MEAN_RE_USE_IN, tdm_LSF_MEAN_RE_USE_OUT, tdm_RE_USE_adaptive_beta_prd_diag_3 ); - lsf2lsp( lsf_new, lsp_new, M, 12800 ); + lsf2lsp( lsf_new, lsp_new, M, INT_FS_12k8 ); return; } -#endif - -#endif diff --git a/lib_dec/ivas_td_decorr.c b/lib_com/ivas_td_decorr.c similarity index 70% rename from lib_dec/ivas_td_decorr.c rename to lib_com/ivas_td_decorr.c index 34f88aeb03f6dba603f86456f311ead88788f8f3..9a08c06f6a3fd08d11edc45bdc83253e07324bef 100644 --- a/lib_dec/ivas_td_decorr.c +++ b/lib_com/ivas_td_decorr.c @@ -67,7 +67,7 @@ static const float ivas_hadamard_decorr_APD_coeff[IVAS_APD_16_SECT][IVAS_APD_16_ /* For R = 3.^([0:obj.parm_APD_nSections-1]/4); */ -const float ivas_three_pow_frac[IVAS_MAX_DECORR_APD_SECTIONS] = { +static const float ivas_three_pow_frac[IVAS_MAX_DECORR_APD_SECTIONS] = { 1.000000000000000f, 1.316074013710022f, 1.732050776481628f, @@ -87,92 +87,193 @@ const float ivas_three_pow_frac[IVAS_MAX_DECORR_APD_SECTIONS] = { }; +#ifdef FIX_417_TD_DECORR_BRATE_SW +#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) +#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) +#endif + /*------------------------------------------------------------------------------------------* * Local functions declaration *------------------------------------------------------------------------------------------*/ static int16_t ivas_get_APD_filt_orders( const int16_t num_out_chans, const int32_t output_Fs, int16_t *APD_filt_orders ); -static ivas_error ivas_td_decorr_init( ivas_td_decorr_state_t *hTdDecorr, const int16_t num_out_chans, const int16_t ducking_flag ); +static void ivas_td_decorr_init( ivas_td_decorr_state_t *hTdDecorr, const int16_t num_out_chans, const int16_t ducking_flag ); + +#ifdef FIX_417_TD_DECORR_BRATE_SW /*------------------------------------------------------------------------- - * ivas_spar_td_decorr_dec_open() + * ivas_td_decorr_reconfig_dec() * - * Allocate and initialize SPAR time domain decorrelator handle + * Allocate and initialize time domain decorrelator handle *------------------------------------------------------------------------*/ -ivas_error ivas_spar_td_decorr_dec_open( - ivas_td_decorr_state_t **hTdDecorr, /* i/o: SPAR Covar. decoder handle */ - const int32_t output_Fs, /* i : output sampling rate */ - const int16_t nchan_internal, /* i : number of internal channels */ - const int16_t ducking_flag /* i : ducking flag */ +ivas_error ivas_td_decorr_reconfig_dec( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate, /* i : total IVAS bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs, /* i : output sampling rate */ + ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */ + uint16_t *useTdDecorr /* i/o: TD decorrelator flag */ +) +{ + uint16_t useTdDecorr_new; + ivas_error error; + + useTdDecorr_new = 0; + if ( ivas_format == SBA_FORMAT ) + { + if ( nchan_transport == 1 ) + { + useTdDecorr_new = 1; + } + } + else if ( ivas_format == MASA_FORMAT ) + { + if ( ( ivas_total_brate < IVAS_48k && nchan_transport == 1 ) || ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + useTdDecorr_new = 1; + } + } + else if ( ivas_format == MC_FORMAT ) + { + if ( ivas_total_brate < IVAS_48k && nchan_transport == 1 ) + { + useTdDecorr_new = 1; + } + } + + if ( *useTdDecorr != useTdDecorr_new ) + { + *useTdDecorr = useTdDecorr_new; + + if ( *useTdDecorr ) + { + if ( ivas_total_brate >= IVAS_13k2 && ivas_format == SBA_FORMAT ) + { + if ( *hTdDecorr == NULL ) + { + if ( ( error = ivas_td_decorr_dec_open( hTdDecorr, output_Fs, 3, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( ivas_total_brate < IVAS_24k4 ) + { + ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR; + } + else + { + ( *hTdDecorr )->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN; + } + } + else + { + if ( *hTdDecorr == NULL ) + { + if ( ( error = ivas_td_decorr_dec_open( hTdDecorr, output_Fs, 3, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + ivas_td_decorr_init( *hTdDecorr, 3, 0 ); + } + } + } + else + { + ivas_td_decorr_dec_close( hTdDecorr ); + } + } + + return IVAS_ERR_OK; +} +#endif + + +/*------------------------------------------------------------------------- + * ivas_td_decorr_dec_open() + * + * Allocate and initialize time domain decorrelator handle + *------------------------------------------------------------------------*/ + +ivas_error ivas_td_decorr_dec_open( + ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t nchan_internal, /* i : number of internal channels */ + const int16_t ducking_flag /* i : ducking flag */ ) { int16_t i, j, len; int16_t num_out_chans; - ivas_td_decorr_state_t *hCovState; + ivas_td_decorr_state_t *hTdDecorr_loc; ivas_error error; num_out_chans = nchan_internal - 1; error = IVAS_ERR_OK; - if ( ( hCovState = (ivas_td_decorr_state_t *) malloc( sizeof( ivas_td_decorr_state_t ) ) ) == NULL ) + if ( ( hTdDecorr_loc = (ivas_td_decorr_state_t *) malloc( sizeof( ivas_td_decorr_state_t ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV decoder" ); } - if ( ( hCovState->look_ahead_buf = (float *) malloc( sizeof( float ) * (int16_t) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ) ) ) == NULL ) + if ( ( hTdDecorr_loc->look_ahead_buf = (float *) malloc( sizeof( float ) * (int16_t) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV decoder" ); } - set_f( hCovState->look_ahead_buf, 0, (int16_t) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ) ); - - hCovState->num_apd_sections = ivas_get_APD_filt_orders( num_out_chans, output_Fs, hCovState->APD_filt_state[0].order ); + set_f( hTdDecorr_loc->look_ahead_buf, 0, (int16_t) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ) ); +#ifdef JBM_TSM_ON_TCS + hTdDecorr_loc->offset = (int16_t) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); +#endif + hTdDecorr_loc->num_apd_sections = ivas_get_APD_filt_orders( num_out_chans, output_Fs, hTdDecorr_loc->APD_filt_state[0].order ); for ( j = 0; j < num_out_chans; j++ ) { - for ( i = 0; i < hCovState->num_apd_sections; i++ ) + for ( i = 0; i < hTdDecorr_loc->num_apd_sections; i++ ) { - len = hCovState->APD_filt_state[0].order[i]; + len = hTdDecorr_loc->APD_filt_state[0].order[i]; - if ( ( hCovState->APD_filt_state[j].state[i] = (float *) malloc( sizeof( float ) * len ) ) == NULL ) + if ( ( hTdDecorr_loc->APD_filt_state[j].state[i] = (float *) malloc( sizeof( float ) * len ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV decoder" ); } - set_f( hCovState->APD_filt_state[j].state[i], 0, len ); + set_f( hTdDecorr_loc->APD_filt_state[j].state[i], 0, len ); } } - ivas_td_decorr_init( hCovState, num_out_chans, ducking_flag ); + ivas_td_decorr_init( hTdDecorr_loc, num_out_chans, ducking_flag ); if ( ducking_flag ) { - if ( ( error = ivas_spar_transient_det_open( &hCovState->pTrans_det, output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_transient_det_open( &hTdDecorr_loc->pTrans_det, output_Fs ) ) != IVAS_ERR_OK ) { return error; } } else { - hCovState->pTrans_det = NULL; + hTdDecorr_loc->pTrans_det = NULL; } - *hTdDecorr = hCovState; + *hTdDecorr = hTdDecorr_loc; return error; } /*------------------------------------------------------------------------- - * ivas_spar_td_decorr_dec_close() + * ivas_td_decorr_dec_close() * - * Deallocate SPAR time domain decorrelator handle + * Deallocate time domain decorrelator handle *------------------------------------------------------------------------*/ -void ivas_spar_td_decorr_dec_close( - ivas_td_decorr_state_t **hTdDecorr /* i/o: SPAR Covar. decoder handle */ +void ivas_td_decorr_dec_close( + ivas_td_decorr_state_t **hTdDecorr /* i/o: TD decorrelator handle */ ) { int16_t i, j; @@ -196,7 +297,7 @@ void ivas_spar_td_decorr_dec_close( if ( ( *hTdDecorr )->pTrans_det != NULL ) { - ivas_spar_transient_det_close( &( *hTdDecorr )->pTrans_det ); + ivas_transient_det_close( &( *hTdDecorr )->pTrans_det ); } free( ( *hTdDecorr ) ); @@ -275,7 +376,7 @@ static int16_t ivas_get_APD_filt_orders( * TD decorr Initialisation function *-----------------------------------------------------------------------------------------*/ -static ivas_error ivas_td_decorr_init( +static void ivas_td_decorr_init( ivas_td_decorr_state_t *hTdDecorr, const int16_t num_out_chans, const int16_t ducking_flag ) @@ -295,7 +396,7 @@ static ivas_error ivas_td_decorr_init( } } - return IVAS_ERR_OK; + return; } @@ -304,8 +405,11 @@ static ivas_error ivas_td_decorr_init( * * APD IIR filter *-----------------------------------------------------------------------------------------*/ - +#ifdef MC_PARAMUPMIX_MODE +void ivas_td_decorr_APD_iir_filter( +#else static void ivas_td_decorr_APD_iir_filter( +#endif ivas_td_decorr_APD_filt_state_t *filter_state, float *pIn_out, const int16_t num_APD_sections, @@ -375,20 +479,32 @@ static void ivas_td_decorr_APD_sections( void ivas_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr, /* i/o: SPAR Covar. decoder handle */ - float pcm_in[][L_FRAME48k], /* i : input audio channels */ - float **ppOut_pcm, /* o : output audio channels */ - const int16_t output_frame /* i : output frame length */ +#ifdef JBM_TSM_ON_TCS + float *pcm_in[], +#else + float pcm_in[][L_FRAME48k], /* i : input audio channels */ +#endif + float **ppOut_pcm, /* o : output audio channels */ + const int16_t output_frame /* i : output frame length */ ) { int16_t i, j; +#ifndef JBM_TSM_ON_TCS int16_t offset; +#endif float in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k]; +#ifndef JBM_TSM_ON_TCS offset = (int16_t) ( output_frame * FRAMES_PER_SEC * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); +#endif /* Look-ahead delay */ mvr2r( pcm_in[0], ppOut_pcm[0], output_frame ); +#ifdef JBM_TSM_ON_TCS + delay_signal( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, hTdDecorr->offset ); +#else delay_signal( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, offset ); +#endif /* In ducking gains */ if ( hTdDecorr->ducking_flag ) diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index b75c08379121fbeab38909b5b787ca0fec8a31e2..ce4abafeb5d8cda10fa6ff720e89e7a1322c2e32 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -75,10 +75,18 @@ float sumAbs( void mvc2c( const uint8_t x[], /* i : input vector */ uint8_t y[], /* o : output vector */ - const int16_t n /* i : vector size */ +#ifdef FIX_XXX_JBM_FIFO_BUFFER + const int32_t n +#else + const int16_t n /* i : vector size */ +#endif ) { +#ifdef FIX_XXX_JBM_FIFO_BUFFER + int32_t i; +#else int16_t i; +#endif if ( n <= 0 ) { @@ -114,14 +122,22 @@ void mvc2c( /*! r: number of clipped samples */ uint32_t ivas_syn_output( - float synth[][L_FRAME48k], /* i/o: float synthesis signal */ +#ifdef JBM_TSM_ON_TCS + float *synth[], /* i/o: float synthesis signal */ +#else + float synth[][L_FRAME48k], /* i/o: float synthesis signal */ +#endif const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ int16_t *synth_out /* o : integer 16 bits synthesis signal */ ) { int16_t i, n; +#ifdef JBM_TSM_ON_TCS + int16_t synth_loc[MAX_JBM_L_FRAME48k]; +#else int16_t synth_loc[L_FRAME48k]; +#endif uint32_t noClipping = 0; /*-----------------------------------------------------------------* @@ -147,6 +163,40 @@ uint32_t ivas_syn_output( return noClipping; } +#ifdef JBM_TSM_ON_TCS +/*-------------------------------------------------------------------* + * ivas_syn_output_f() + * + * Output ivas synthesis signal with compensation for saturation + * returns number of clipped samples + *-------------------------------------------------------------------*/ + +/*! r: number of clipped samples */ +void ivas_syn_output_f( + float *synth[], /* i/o: float synthesis signal */ + const int16_t output_frame, /* i : output frame length (one channel) */ + const int16_t n_channels, /* i : number of output channels */ + float *synth_out /* o : integer 16 bits synthesis signal */ +) +{ + int16_t i, n; + + /*-----------------------------------------------------------------* + * float to integer conversion with saturation control + *-----------------------------------------------------------------*/ + + for ( n = 0; n < n_channels; n++ ) + { + for ( i = 0; i < output_frame; i++ ) + { + synth_out[i * n_channels + n] = synth[n][i]; + } + } + + return; +} +#endif + /*-------------------------------------------------------------------* * mvr2r_inc() * diff --git a/lib_com/ivas_transient_det.c b/lib_com/ivas_transient_det.c index 01a4374f93fbcbe981957e4bc3618f28cb7b4e4e..1e8f53c7ca5a1d17b7d49501169deaf7634914a6 100644 --- a/lib_com/ivas_transient_det.c +++ b/lib_com/ivas_transient_det.c @@ -84,8 +84,8 @@ *-----------------------------------------------------------------------------------------*/ static void ivas_transient_det_init( - ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ - const int32_t sampling_rate /* i : sampling rate */ + ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ + const int32_t sampling_rate /* i : sampling rate */ ) { float filt_coeff_arr[3][IVAS_BIQUAD_FILT_LEN << 1] = { { 0 } }; @@ -159,14 +159,14 @@ static void ivas_transient_det_init( /*------------------------------------------------------------------------- - * ivas_spar_transient_det_open() + * ivas_transient_det_open() * * Allocate and initialize SPAR TD handle *------------------------------------------------------------------------*/ -ivas_error ivas_spar_transient_det_open( - ivas_trans_det_state_t **hTranDet_in, /* i/o: SPAR TD handle */ - const int32_t sampling_rate /* i : sampling rate */ +ivas_error ivas_transient_det_open( + ivas_trans_det_state_t **hTranDet_in, /* i/o: Transient detector handle */ + const int32_t sampling_rate /* i : sampling rate */ ) { ivas_trans_det_state_t *hTranDet; @@ -185,13 +185,13 @@ ivas_error ivas_spar_transient_det_open( /*------------------------------------------------------------------------- - * ivas_spar_transient_det_close() + * ivas_transient_det_close() * - * Deallocate and initialize SPAR TD handle + * Deallocate and initialize Transient detector handle *------------------------------------------------------------------------*/ -void ivas_spar_transient_det_close( - ivas_trans_det_state_t **hTranDet /* i/o: SPAR TD handle */ +void ivas_transient_det_close( + ivas_trans_det_state_t **hTranDet /* i/o: Transient detector handle */ ) { if ( hTranDet == NULL || *hTranDet == NULL ) @@ -211,28 +211,39 @@ void ivas_spar_transient_det_close( * * Transient detection process call *-----------------------------------------------------------------------------------------*/ - -int16_t ivas_transient_det_process( - ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ - float *pIn_pcm, /* i : input audio channels */ - const int16_t frame_len /* i : frame length in samples */ +void ivas_transient_det_process( + ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ + float *pIn_pcm, /* i : input audio channels */ + const int16_t frame_len, /* i : frame length in samples */ + int16_t transient_det[2] /* o: transient det outputs */ ) { + float in_duck_gain[L_FRAME48k]; + int16_t num_sf, sf, sf_samp, idx; float mem = hTranDet->in_duck_gain; - int16_t trans; - ivas_td_decorr_get_ducking_gains( hTranDet, pIn_pcm, NULL, NULL, frame_len, IVAS_TDET_ONLY ); + ivas_td_decorr_get_ducking_gains( hTranDet, pIn_pcm, in_duck_gain, NULL, frame_len, IVAS_TDET_ONLY ); + transient_det[0] = 0; + transient_det[1] = 0; if ( mem - hTranDet->in_duck_gain > IVAS_TDET_PARM_TRANS_THR ) { - trans = 1; + transient_det[0] = 1; } - else + + num_sf = 16; + sf_samp = frame_len / num_sf; + for ( sf = 1; sf <= num_sf; sf++ ) { - trans = 0; + idx = ( sf_samp * sf ) - 1; + if ( ( mem - in_duck_gain[idx] ) > ( IVAS_TDET_PARM_TRANS_THR * 1.1f ) ) + { + transient_det[1] = 1; + } + mem = in_duck_gain[idx]; } - return trans; + return; } @@ -269,7 +280,7 @@ static float ivas_calc_duck_gain( *-----------------------------------------------------------------------------------------*/ void ivas_td_decorr_get_ducking_gains( - ivas_trans_det_state_t *hTranDet, + ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ float *pIn_pcm, float *pIn_duck_gains, float *pOut_duck_gains, @@ -301,11 +312,12 @@ void ivas_td_decorr_get_ducking_gains( /* env slow */ ivas_filter_process( &hTranDet->env_slow, e_slow, frame_len ); - if ( tdet_flag == IVAS_TDET_ONLY ) + if ( tdet_flag ) { for ( i = 0; i < frame_len; i++ ) { in_duck_gain = ivas_calc_duck_gain( in_duck_gain, in_duck_coeff, e_slow[i], e_fast[i], duck_mult_fac ); + pIn_duck_gains[i] = in_duck_gain; } hTranDet->in_duck_gain = in_duck_gain; } diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 19321e21d9bcea526d92d3f0fc6cebc6be6c87f2..02a735e80c0baf8914c90526bd7fde29581f5dd8 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -2027,6 +2027,62 @@ int16_t tcxlpc_get_cdk( return cdk; } +void dec_FDCNG_MSVQ_stage1( + int16_t j_full, /* i: index full range */ + int16_t n, /* i: dimension to generate */ + const float *invTrfMatrix, /* i: IDCT matrix for synthesis */ + const DCTTYPE idcttype, /* i: specify which IDCT */ + float *uq, /* o: synthesized stage1 vector */ + Word16 *uq_ind /* o: synthesized stage1 vector in BASOP */ +) +{ + int16_t col, segm_ind, j; + float dct_vec[FDCNG_VQ_MAX_LEN]; + float idct_vec[FDCNG_VQ_MAX_LEN]; + const Word8 *cbpW8; + const Word16 *dct_col_shift_tab; + + assert( n <= FDCNG_VQ_MAX_LEN ); + assert( n >= FDCNG_VQ_DCT_MINTRUNC ); + + segm_ind = 0; + for ( col = 1; col <= FDCNG_VQ_DCT_NSEGM; col++ ) + { + if ( j_full >= cdk1_ivas_cum_entries_per_segment[col] ) + { + segm_ind++; + } + } + + j = j_full - cdk1_ivas_cum_entries_per_segment[segm_ind]; /* j is the local segment index */ + + assert( j < cdk1_ivas_entries_per_segment[segm_ind] ); + + /* Word8 column variable Qx storage*/ + cbpW8 = cdk_37bits_ivas_stage1_W8Qx_dct_sections[segm_ind]; /* Word8 storage fixed ptr_init */ + cbpW8 += j * cdk1_ivas_cols_per_segment[segm_ind]; /* adaptive ptr init */ + dct_col_shift_tab = stage1_dct_col_syn_shift[segm_ind]; + + for ( col = 0; col < cdk1_ivas_cols_per_segment[segm_ind]; col++ ) + { + dct_vec[col] = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); + /* LOGIC( 1 ); SHIFT( 1 ); ADD( 1 ); + in BASOP: s_and(for W8->W16), shl(), sub() + */ + } + dctT2_N_apply_matrix( (const float *) dct_vec, idct_vec, cdk1_ivas_cols_per_segment[segm_ind], n, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, idcttype ); + + /*scale down to original fdcngvq domain and move to Q0 */ + v_multc( idct_vec, fdcng_dct_scaleF[1], idct_vec, n ); + /* fdcng_dct_scaleF[1] --> 0.0625-->scale down from search Q4 domain to Q0 , + not really relevant for BASOP loop */ + + /*add common mid fdcng vector, in fdcng bands domain */ + v_add( idct_vec, cdk1r_tr_midQ_truncQ, uq, n ); + assert( uq_ind == NULL ); +} + + /*--------------------------------------------------------------------------* * msvq_dec() * @@ -2035,15 +2091,17 @@ int16_t tcxlpc_get_cdk( void msvq_dec( - const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ - const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ - const int16_t offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */ - const int16_t stages, /* i : Number of stages */ - const int16_t N, /* i : Vector dimension */ - const int16_t maxN, /* i : Codebook dimension */ - const int16_t Idx[], /* i : Indices */ - float *uq, /* o : quantized vector */ - Word16 *uq_ind /* o : quantized vector (fixed point) */ + const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ + const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ + const int16_t offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */ + const int16_t stages, /* i : Number of stages */ + const int16_t N, /* i : Vector dimension */ + const int16_t maxN, /* i : Codebook dimension */ + const int16_t Idx[], /* i : Indices */ + const int16_t applyIDCT_flag, /* i : applyIDCT flag */ + const float *invTrfMatrix, /* i: matrix for IDCT synthesis */ + float *uq, /* o : quantized vector */ + Word16 *uq_ind /* o : quantized vector (fixed point) */ ) { int16_t i, n, maxn, start; @@ -2079,9 +2137,17 @@ void msvq_dec( start = 0; } -#define WMC_TOOL_SKIP - v_add( uq + start, cb[i] + Idx[i] * maxn, uq + start, n ); + if ( i == 0 && applyIDCT_flag != 0 ) + { + assert( start == 0 ); + dec_FDCNG_MSVQ_stage1( Idx[0], N, invTrfMatrix, IDCT_T2_XX_24, uq, uq_ind ); /* IDCT_T2 N=24 used for all synthesis */ + } + else + { + v_add( uq + start, cb[i] + Idx[i] * maxn, uq + start, n ); + } +#define WMC_TOOL_SKIP IF( uq_ind != NULL ) { FOR( j = 0; j < n; ++j ) @@ -2358,3 +2424,193 @@ void a2isf( return; } + +/*-------------------------------------------------------------------* + * dctT2_N_apply_matrix() + * + * dct/idct truncated matrix appl. for DCT basis vector lengths of N + *-------------------------------------------------------------------*/ +void dctT2_N_apply_matrix( + const float *input, + float *output, + const int16_t dct_dim, + int16_t fdcngvq_dim, + const float *matrix, + const int16_t matrix_row_dim, + DCTTYPE dcttype ) +{ + int16_t i, j, dim_in, dim_out; + int16_t mat_step_col, mat_step_row, mat_step_col_flag; + const float *pt_x, *pt_A; + float tmp_y[FDCNG_VQ_MAX_LEN]; + float *pt_y; + + /* non-square DCT_N and IDCT_N matrix application, + using a stored format of an IDCT_Nx(FDCNG_VQ_DCT_MAXTRUNC) matrix */ + /* efficiently parallelized in SIMD */ + + assert( dct_dim <= FDCNG_VQ_DCT_MAXTRUNC ); + assert( fdcngvq_dim <= FDCNG_VQ_MAX_LEN ); + + if ( ( dcttype & 1 ) == 0 ) /* even entries are DCTs */ + { + /* DCT_typeII 24,21 -> XX in worst case */ + dim_in = fdcngvq_dim; + dim_out = dct_dim; + mat_step_col = matrix_row_dim; /* matrix maximum storage size dependent, width of first row in matrix */ + mat_step_row = 0; + mat_step_col_flag = 1; + assert( dcttype == DCT_T2_21_XX || dcttype == DCT_T2_24_XX ); + } + else + { + assert( ( dcttype & 1 ) != 0 ); /* idct */ + dim_in = dct_dim; + dim_out = fdcngvq_dim; + mat_step_col = 1; + mat_step_row = matrix_row_dim; + mat_step_col_flag = 0; + assert( dcttype == IDCT_T2_XX_24 ); + } + + pt_y = tmp_y; + for ( i = 0; i < dim_out; i++ ) + { + pt_x = input; + *pt_y = 0; + + /* +i(DCT) or +i*maxTrunc(IDCT) */ +#define WMC_TOOL_SKIP + pt_A = &( matrix[i * ( mat_step_row + mat_step_col_flag )] ); /* ptr indexing */ + PTR_INIT( 1 ); +#undef WMC_TOOL_SKIP + for ( j = 0; j < dim_in; j++ ) + { +#define WMC_TOOL_SKIP + *pt_y += ( *pt_x++ ) * ( *pt_A ); + pt_A += mat_step_col; /* step +maxtrunc or +1 */ /* ptr indexing*/ + MAC( 1 ); +#undef WMC_TOOL_SKIP + } + pt_y++; + } + mvr2r( tmp_y, output, dim_out ); +} + +/*-------------------------------------------------------------------* + * extend_dctN_input() + * + * (inputN, dctN) -> idct(N_ext) idct_N matrix application loop for + * extending, extrapolating a DCT basis vector length of N to N_ext + *-------------------------------------------------------------------*/ + +void extend_dctN_input( + const float *input, /* i: input in fdcng domain */ + const float *dct_input, /* i: input in dctN(fdcng) domain */ + const int16_t in_dim, /* i: in_dim == N */ + float *ext_sig, /* o: extended output in fdcng domain */ + const int16_t out_dim, /* i: output total dim */ + float *matrix, /* i: idct synthesis matrix N rows, n_cols columns */ + const int16_t n_cols, /* i: number of columns == DCT truncation length */ + DCTTYPE dcttype ) /* i: matrix operation type */ +{ + int16_t i, j, i_rev; + const float( *ptr )[FDCNG_VQ_DCT_MAXTRUNC] = (void *) matrix; + + /* stored format is an IDCT_Nx(FDCNG_VQ_DCT_MAXTRUNC) matrix */ + assert( in_dim < FDCNG_VQ_MAX_LEN ); + assert( out_dim <= FDCNG_VQ_MAX_LEN ); + assert( out_dim > in_dim ); + assert( n_cols == FDCNG_VQ_DCT_MAXTRUNC ); /* for *ptr[MAX_TRUNC] adressing*/ + assert( ( dcttype & 1 ) != 0 ); /* idct tables always in use for this basis vector extension */ + + mvr2r( input, ext_sig, in_dim ); /* copy initial part, i.e. only last/tail parts are extended */ + set_f( &( ext_sig[in_dim] ), 0.0, out_dim - in_dim ); + + i_rev = in_dim; /*ptr init*/ + for ( i = in_dim; i < out_dim; i++ ) + { /* for each extension sample */ + /* i = 21 22 23; + i_rev = 20 19 18; for odd dctII reflect basis vector + */ + i_rev--; + + for ( j = 0; j < n_cols; j++ ) /* for each available DCT coeff */ + { + /* DCTcoeff * reflected basis vector */ +#define WMC_TOOL_SKIP + /* pure ptr MAC operations */ + ext_sig[i] += dct_input[j] * ptr[i_rev][j]; /* sum up scaled and extended basis vector */ + MAC( 1 ); +#undef WMC_TOOL_SKIP + } + } +} + + +/* inititate idct24 FDCNG_VQ_DCT_MAXTRUNCx N matrix in RAM from a quantized compressed ROM format */ +void create_IDCT_N_Matrix( float *inv_matrixFloatQ, const int16_t N, const int16_t n_cols, const int16_t alloc_size ) +{ + int16_t c, c1, r, r_flip, W16_val; + int16_t len; + int16_t mat_cpy_size; + const Word16 *absval_ptr; + const Word8 *idx_ptr; + Word16 idx; + float( *ptr )[FDCNG_VQ_DCT_MAXTRUNC] = (void *) inv_matrixFloatQ; /* fixed number of columns pointers, to simplifies adressing in ANSIC */ + + absval_ptr = unique_idctT2_24coeffsQ16; + idx_ptr = idctT2_24_compressed_idx; + len = FDCNG_VQ_MAX_LEN; + + if ( N == FDCNG_VQ_MAX_LEN_WB ) + { + absval_ptr = unique_idctT2_21coeffsQ16; + idx_ptr = idctT2_21_compressed_idx; + len = N; + } + + assert( alloc_size >= ( n_cols * len ) ); /* enough space for the full expanded IDCT matrix */ + assert( N <= len ); + + mat_cpy_size = ( n_cols ) * ( len >> 1 ); /* NB integer division of "len" */ + + if ( ( len & 1 ) != 0 ) + { /* odd sized DCT with a non-reflected center row */ + mat_cpy_size += n_cols; + } + + for ( c = 0; c < mat_cpy_size; c++ ) + { + idx = (Word16) ( idx_ptr[c] ); + W16_val = absval_ptr[abs( idx )]; + + if ( idx < 0 ) + { + W16_val = -( W16_val ); + } + inv_matrixFloatQ[c] = ( +1.52587890625e-05f ) * ( (float) W16_val ); /* 1.0/2.^16 scaling to a float-"Q0" , a scaling that is not done in BASOP */ + } + + /* for even number of coeffs DCT24, + flip symmetry for odd, even is used to save 50% IDCT Table ROM */ + /* for an odd DCT center is not flipped e.g for DCT21 */ + + assert( n_cols == FDCNG_VQ_DCT_MAXTRUNC ); + assert( ( n_cols & 1 ) == 0 ); + + for ( c = 0; c < ( n_cols ); c += 2 ) + { + c1 = c + 1; + r_flip = len - 1; + for ( r = 0; r < ( len / 2 ); r++, r_flip-- ) + { +#define WMC_TOOL_SKIP + ptr[r_flip][c] = ptr[r][c]; /* flipped */ + ptr[r_flip][c1] = -( ptr[r][c1] ); /* flipped and sign swapped */ + MOVE( 2 ); + MULT( 1 ); /* for negate */ +#undef WMC_TOOL_SKIP + } + } +} diff --git a/lib_com/options.h b/lib_com/options.h old mode 100644 new mode 100755 index e2b82be9dfbbb556172c2128cf74bfdf6b5e5080..6a5d86684406ef65d47216a9a58ba9cd6cc7f9c2 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -68,7 +68,7 @@ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC */ /* output Parametric MC paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ -#define DEBUG_MODE_INFO_TWEAK /* enable command line switch to specify subdirectory for debug info output inside "./res/" */ +/*#define DEBUG_MODE_INFO_TWEAK*/ /* enable command line switch to specify subdirectory for debug info output inside "./res/" */ /*#define DEBUG_MODE_INFO_PLC */ /* define to output PLC related parameters */ /*#define DEBUG_MODE_INFO_ALLRAD*/ /* define to output generated HOA decoding mtx */ /*#define DEBUG_MODE_LFE */ /* define to output LFE relevant parameters */ @@ -83,7 +83,7 @@ /*#define ALLOW_BYTE_EP*/ /* allow byte fer pattern files and check fer pattern file validity */ #define WRAP_AS_EIDXOR /* wraps FER file (as in STL_eid-xor.c/softbit.c) */ -#define DEBUG_FORCE_MDCT_STEREO_MODE /* Force stereo mode decision for MDCT stereo: -stere 3 1 forces L/R coding and -stereo 3 2 forces full M/S coding */ +#define DEBUG_FORCE_MDCT_STEREO_MODE /* Force stereo mode decision for MDCT stereo: -stereo 3 1 forces L/R coding and -stereo 3 2 forces full M/S coding */ /*#define DEBUG_STEREO_DFT_NOCORE*/ /* DFT stereo: by-pass core coder at decoder side*/ /*#define DEBUG_STEREO_DFT_NOSTEREO*/ /* DFT stereo: by-pass stereo processing at encoder and decoder side*/ /*#define DEBUG_STEREO_DFT_NOQRES*/ @@ -112,8 +112,9 @@ /*#define TDREND_HRTF_TABLE_METHODS*/ /* Enable HRTF lookup from tables, for testing & evaluation. Supply file in table format to use. Note that a suitable HR filter lookup method should be written if the filters sample point grids are not in the formats. */ /*#define TDREND_STANDALONE*/ /* Used when renderer is built in standalone form, without IVAS encoding/decoding (see scripts/object_renderer_standalone). This is just here to ensure this is cleaned out by prepare_instrumentation.sh */ -/*#define DEBUG_SBA*/ /* debug DIRAC/SPAR in-out */ +/*#define DEBUG_SBA*/ /* debug DIRAC/SPAR in-out */ #ifdef DEBUG_SBA +/*#define DEBUG_LBR_SBA*/ /* debug low bitrate SBA (SPAR+DirAC) */ /*#define DEBUG_SBA_AUDIO_DUMP*/ /* SBA intermediate audio wav file dumping */ /*#define DEBUG_SBA_MD_DUMP*/ /* SBA metadata and variable file dumping */ /*#define DEBUG_SPAR_MD_TARGET_TUNING*/ /* SPAR MD target bitrate tuning debug code */ @@ -125,6 +126,7 @@ /*#define SPAR_HOA_DBG*/ /* SPAR HOA debug statements */ /*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ #define DEBUG_AGC_ENCODER_CMD_OPTION /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ +#define DEBUG_JBM_CMD_OPTION /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ #endif /* #################### End DEBUGGING switches ############################ */ @@ -134,39 +136,96 @@ #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ #define BITSTREAM_INDICES_MEMORY /* Don't count memory for bitstream Indice at the encoder - it is a temporary solution for development only */ -#define LSF_RE_USE_SECONDARY_CHANNEL /* TD stereo Secondary channel LSF Q improvement */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL -/*#define LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE */ /* switch to isolate the reuse mode case */ -#endif #define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */ -/*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define SBA_BR_SWITCHING /* Issue 114: Changes for SBA bit rate switching with reconfiguration for bitrates with same number of transport channels*/ -#ifdef SBA_BR_SWITCHING -#define SBA_BR_SWITCHING_RECONFIG /* Issue 114: Changes for SBA bitrate switching with reconfiguration for bitrates with different number of transport channels*/ -#define SBA_BR_SWITCHING_COMPLEXITY_FIX /* VA: fix complexity overhead */ +#define NON_DIEGETIC_PAN /* Orange: Contribution 34: non diegetic panning in decoder */ +#define ISM_NON_DIEGETIC_PAN /* Orange: Contribution 34: non diegetic panning for ism objects */ +#define FIX_103_RA_PARAMS_PARAM_BIN_REND /* Issue 103: Digest room acoustics parameters for Parametric Binaural Renderer*/ +/*#define SBA_HPF_TUNING_DEC*/ +#define SMOOTH_WITH_TRANS_DET +#define FIX_331_ALL_BRS /*Enable the fix_331 across all the bitrates and sba modes*/ +#define FIX_ISM_DTX_CNG_BWIDTH_ALT /* VA: issue 396 - alternative fix for bw changes on CNG frames in ISM DTX for objects that use the decoder-side noise estimation */ + +#define FIX_398_MASA_DIRECTION_ALIGNMENT /* Nokia: Issue 398: in 2dir MASA, dynamically adjust directions to be consistent */ +#define REND_DEBUGGING_REVISION /* VA: encapsulate rendering debugging options with DEBUGGING */ +#define FIX_419_ISM_MD_FIX /* VA: Issue 419: fix the upper value limitation for parameter angle1_diff_cnt */ +#define FIX_I414_OOA_CNA /* VA: Issue 414: Fixing out-of-array write operation in stereo CNA */ + + +#define SNS_MSVQ /* FhG: contribution 33 - MSVQ for SNS parameters at stereo mid bitrates */ +/*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ + +#define FIX_379_GAININTP /* Eri: Adds a gain interpolation for directional/distance gain to handle abrupt changes in metadata (Non BE) */ +#define FIX_387_ISM_MD_FEC /* VA: Issue 387: fix MD discontinuity in ISM FEC */ + +#define FIX_418_SID_BITRATE /* Eri: Issue 418: Using the correct bitrate for unified stereo SID */ +#define PARAMMC_SHORT_ENC_MDFT /* FhG: Issue 410: complexity optimization for parametric Multichannel modes */ +#define FIX_421_TD_INT_TUNE /* Eri: Issue 421: Increase use of interpolation in TD renderer filter transition */ +#define FIX_419_ISM_BRATE_SW_DTX /* VA: issue 419: fix ISM Bitrate Switching with dtx */ +#define FIX_422 /* FhG: Issue 422: re-introduce fix for noisy speech buffer in ParamISM */ + + +#define ERI_MSVQ_CLEANUP /* Eri: Contribution #31 BE modularization of msvq encoder side DCT21&DCT24 within msvq_enc() */ + + +#define FIX_416_ISM_BR_SWITCHING /* FhG: add missing CLDFB reconfig to ISM BR switching */ +#define FIX_SP2A /* VA: Issue 412: Adjust threshold for the S_p2a feature in the tonal detector */ + +#define FIX_413_SBA_DTX /* Dlb: Fix for issue 413, SBA DTX CNG in 2TC mode*/ +#define FIX_417_TD_DECORR_BRATE_SW /* VA: Issue 417: fix incorrect use of TD decorrelator in bitrate switching */ +#define FIX_368_SBA_MODE /* Dlb: Fix for issue 368 */ +#define FIX_427_MAXIMUM_S_INDEX /* VA: issue 427: fix return index of function maximum_s() */ +#define FIX_431_PARAMMC_PLC_INTERPOLATOR /* FhG: Issue 431: fix missing interpolator reset for ParamMC PCL */ +#define FIX_391_SBA /* Dlb: Fix for issue 391 for SBA */ +#define LBR_ADAP_SMOOTHING_OPT /* FhG: Issue 436: complexity optimization of adaptive smoothing in low-bitrate SBA */ + +#define FIX_425_MASA_BRSW_RENDERER /* Nokia: Issue 425: renderer not reconfigure in MASA bitrate switching */ + +#define EUALER2QUAT_FIX /* Dlb :fix for issue 430 issue in euler2quat, sign of quat y is inverted */ +#define HR_METADATA /* Nok: encode directional MASA metadata with more bits at 384k and 512k */ +#define SBA_TD_RESIDUAL /* Dlb : Issue 426: SBA encoder complexity optimization */ + +#define FIX_357_DTX_32K /* Eri: issue 357 - Forced LP-CNG at 32k */ +#define FIX_435_ISM_MERGE_BUG /* Eri: Merge bug fix for ISM NULL metadata and tcx_only cases */ +#define FIX_355_REFACTOR_PARAMBIN_TO_5MS /* Nokia: Fixes issue 355 by refactoring parametric binauralizer code to 5 ms mode */ +#define FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING /* Eri: Fix incorrect use of stack variable used for channel aware config file */ +#define COMBINED_FORMAT_SIGNALING /* VA: Introduce a signaling bit for combined format coding */ +#define FIX_446_STEREO_DMX_CRASH /* FhG: fix discrepancy with EVS code that could cause crashes in rare cases */ + +#define FIX_386_CORECODER_RECONFIG_2 /* VA: Issue 386: Resolve remaining ToDo comments in CoreCoder reconfig. */ +#define FIX_440_PARAM_ISM_DIR_NOISE /* FhG: Issue 440: Fix directional background noise becoming diffuse in ParamISM */ + +#define LBR_SBA_DIRAC_FIX /* DLB: Bug fix for DirAC at low bitrates */ +#define FIX_445_SNS_BUGFIXES /* FhG: bug fix for spectral tilt in SNS computation + necessary update of codebooks and converison to fixedpoint-compatible tables */ + +#define FIX_447_PARAMBIN_MASA_REGU_FAC /* Nokia: Issue 447: Fix issue by adjusting regularization factor minimum value. */ +#define FIX_441_SBA_PARAMBIN_GAINS /* Nokia: Fix issue 441 by changing gains in SBA path of parametric binauralizer */ + +#define MC_PARAMUPMIX_MODE /* Dlb: Contribution 39: Multichannel Parametric Upmix */ + +#define HODIRAC /* FhG: Sector-based HO-DirAC method for SBA at high bitrates */ + +#ifdef HODIRAC +#define SPAR_TUNING /* Dlb: tune SPAR for better quality */ +#define HODIRAC_FIX_BR_SWITCHING_DTX #endif -#define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ -#define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ -#define FIX_245_RANGE_CODER_VOIP_MSAN /* Issue 245: fix use-of-uninitialized-value in range coder in VoIP mode */ -#define REND_CFG_LFE /* Issue 110: Configurable LFE handling for external renderer */ -#define FIX_235 /* Issue 235: Deallocation of HR filter memory separately for lib_rend (ROM) and lib_util (from file) */ -#define ENV_STAB_FIX /* Contribution 23: HQ envelope stability memory fix */ -#define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ -#define FIX_292_VBAP_CALLOC_REMOVAL /* Nokia: Fixes issue 292 by removing the remnant callocs */ -#define FIX_293_EXT_RENDERER_CLI /* FhG: Fix bugs in external renderer CLI */ -#define FIX_268 /* Issue 268: Add low cost dry-run of memory analysis */ -#define HRTF_BINARY_FILE /* HRTF filters' binary file used for binaural rendering. */ -#define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ - -#define FIX_197_CREND_INTERFACE -#define SET_TNS_FLAG_IN_EVERY_FRAME /* FhG: issue 288 - mismatch between encoder and decoder wrt TNS usage in unified stereo with frameloss */ -#define FIX_FOR_TEST /* allows tests to pass using old TD binary file, to be removed after merge*/ -#define FIX_299_ISM_BWS /* VA: issue 299 - fix Band-width switching issues in ISM format */ -#define FIX_309_PREMPH_MEM_SCE /* FhG: issue 309 - fix overwriting of mem_preemph_enc in ivas preprocessing for SCE and tcxonly modes*/ - -#define FIX_317 /* FhG: issue 317 - address sanitizer error in MDCT-Stereo PLC */ +/*#define HODIRAC_DEBUG*/ + +#ifdef HODIRAC_DEBUG +//#define HODIRAC_CHECK_VALUE_RANGE +//#define HODIRAC_WRITE_PARAMS +//#define HODIRAC_READ_PARAMS +#endif + +#define COMPLEXITY_LEVEL_INDICATION + +#define FIX_642 /* FhG: Fix for issue 642, buggy DoA-array access in DirAC head rotation*/ + +#define VARIABLE_SPEED_DECODING /* FhG: variable speed decoding employing the JBM functioniality */ +#define JBM_TSM_ON_TCS /* FhG: run the TSM part of JBM on the TCs instead of the final output pcm waveforms */ + +#define FIX_DTX_428 /* FhG: fix for issue 428, crash with DTX and bitrate switching */ #define SWITCHING_FORMAT_DEC /* VA: issue 326: Bitstream Switching (Decoder side) */ #define SWITCHING_FORMAT_ENC /* VA: issue 325: Encoder Input format Switching */ @@ -175,4 +234,5 @@ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ + #endif diff --git a/lib_com/prot.h b/lib_com/prot.h index 784527e1bfadd8b7252f2c5ef9de827bafbc598c..8c6fdd674f7cc674b1059abde2f0205c9f949bce 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -177,7 +177,11 @@ float sum2_f( void set_c( int8_t y[], /* i/o: Vector to set */ const int8_t a, /* i : Value to set the vector to */ - const int16_t N /* i : Lenght of the vector */ +#ifdef JBM_TSM_ON_TCS + const int32_t N /* i : Length of the vector */ +#else + const int16_t N /* i : Length of the vector */ +#endif ); void set_s( @@ -677,11 +681,10 @@ int16_t lev_dur( /*! 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 */ - HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */ - const int32_t binaural_latency_ns /* i : binauralization delay in ns */ + 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 */ ); void decision_matrix_enc( @@ -2221,18 +2224,19 @@ void read_next_force( ); #endif ivas_error init_encoder( - Encoder_State *st, /* i/o: state structure */ - const int16_t idchan, /* i : channel ID */ - const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ + Encoder_State *st, /* i/o: state structure */ + const int16_t idchan, /* i : channel ID */ + const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ - const int16_t vad_only_flag /* i : flag to indicate front-VAD structure */ + const int16_t vad_only_flag, /* i : flag to indicate front-VAD structure */ + const ISM_MODE ism_mode /* i : ISM mode */ ); void LPDmem_enc_init( LPD_state_HANDLE hLPDmem /* i/o: LP memories */ ); -void destroy_encoder( +void destroy_cldfb_encoder( Encoder_State *st /* i/o: state structure */ ); ivas_error evs_enc( @@ -2323,7 +2327,6 @@ ivas_error acelp_core_enc( float pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe */ int16_t *unbits, /* o : number of unused bits */ STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ - const float tdm_lspQ_PCh[M], /* i : Q LSPs for primary channel */ const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ); @@ -3022,10 +3025,8 @@ void lsf_enc( float *Aq, /* o : quantized A(z) for 4 subframes */ const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL , const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -#endif ); void isf_enc_amr_wb( @@ -3823,8 +3824,11 @@ void bw_detect( const float signal_in[], /* i : input signal */ float *spectrum, /* i : MDCT spectrum */ const float *enerBuffer /* i : energy buffer */ + , + const int16_t mct_on /* i : flag MCT mode */ ); + void set_bw( const int16_t element_mode, /* i : element mode */ const int32_t element_brate, /* i : element bitrate */ @@ -4497,6 +4501,10 @@ ivas_error acelp_core_dec( const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ const int16_t nchan_out, /* i : number of output channels */ STEREO_CNG_DEC_HANDLE hStereoCng /* i : stereo CNG handle */ +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + , + const int16_t read_sid_info /* i : read SID info flag */ +#endif ); void bass_psfilter_init( @@ -4577,10 +4585,8 @@ void lsf_dec( float *lsp_new, /* o : de-quantized LSP vector */ float *lsp_mid, /* o : de-quantized mid-frame LSP vector */ const int16_t tdm_low_rate_mode /* i : secondary channel low rate mode flag */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL , const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -#endif ); void isf_dec_amr_wb( @@ -5116,7 +5122,7 @@ ivas_error init_decoder( const MC_MODE mc_mode /* i : MC mode */ ); -void destroy_decoder( +void destroy_cldfb_decoder( Decoder_State *st /* o : Decoder static variables structure */ ); @@ -5855,6 +5861,7 @@ ivas_error core_switching_post_dec( float *synth, /* i/o: output synthesis */ float *output, /* i/o: LB synth/upsampled LB synth */ float output_mem[], /* i : OLA memory from last TCX/HQ frame */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching frame flag */ @@ -7145,8 +7152,7 @@ void WindowSignal( int16_t *L_frame, /* i/o: frame length */ float out[], /* o : output windowed signal */ const int16_t truncate_aldo, /* i : nonzero to truncate long ALDO slope */ - const int16_t fullband, /* i : fullband flag */ - const int16_t isLfe /* i : LFE flag */ + const int16_t fullband /* i : fullband flag */ ); void HBAutocorrelation( @@ -7299,8 +7305,7 @@ void tcx_get_windows( const float **left_win, /* o : left overlap window */ int16_t *right_overlap, /* o : right overlap length */ const float **right_win, /* o : right overlap window */ - const int16_t fullband, /* i : fullband flag */ - const int16_t isLfe /* i : LFE flag */ + const int16_t fullband /* i : fullband flag */ ); void tcx_windowing_analysis( @@ -8052,24 +8057,101 @@ void msvq_enc( const int16_t *levels, /* i : Number of levels in each stage */ const int16_t maxC, /* i : Tree search size (number of candidates kept from */ /* one stage to the next == M-best) */ - const int16_t stages, /* i : Number of stages */ - const float w[], /* i : Weights */ - const int16_t N, /* i : Vector dimension */ - const int16_t maxN, /* i : Codebook dimension */ - int16_t Idx[] /* o : Indices */ + const int16_t stages, /* i : Number of stages */ + const float w[], /* i : Weights */ + const int16_t N, /* i : Vector dimension */ + const int16_t maxN, /* i : Codebook dimension */ + const int16_t applyDCT_flag, /* i : applyDCT flag */ + float *invTrfMatrix, /* i:/o expanded synthesis matrix */ + int16_t Idx[] /* o : Indices */ ); void msvq_dec( - const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ - const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ - const int16_t offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */ - const int16_t stages, /* i : Number of stages */ - const int16_t N, /* i : Vector dimension */ - const int16_t maxN, /* i : Codebook dimension */ - const int16_t Idx[], /* i : Indices */ - float *uq, /* o : quantized vector */ - Word16 *uq_ind /* o : quantized vector (fixed point) */ + const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ + const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ + const int16_t offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */ + const int16_t stages, /* i : Number of stages */ + const int16_t N, /* i : Vector dimension */ + const int16_t maxN, /* i : Codebook dimension */ + const int16_t Idx[], /* i : Indices */ + const int16_t applyIDCT_flag, /* i : applyIDCT flag */ + const float *invTrfMatrix, /* i: synthesis matrix */ + float *uq, /* o : quantized vector */ + Word16 *uq_ind /* o : quantized vector (fixed point) */ +); + + +void dec_FDCNG_MSVQ_stage1( + int16_t j_full, /* i: index full range */ + int16_t n, /* i: dimension to generate */ + const float *invTrfMatrix, /* i: synthesis matrix */ + DCTTYPE idcttype, /* i: idct type */ + float *uq, /* o: synthesized stage1 vector */ + Word16 *uq_ind /* o: synthesized stage1 vector in BASOP */ +); + +void create_IDCT_N_Matrix( + float *inv_matrixFloatQ, /* i/o: RAM buffer */ + const int16_t N, /* i: DCT length , number of time samples */ + const int16_t n_cols, /* i: number of dct coeffs (as DCT may be truncated) */ + const int16_t alloc_size /* i: RAM buffer size in elements*/ +); + + +void dctT2_N_apply_matrix( + const float *input, /* i: input in fdcng or DCT(fdcng) domain */ + float *output, /* o: output in DCT(fdcng) or fdcng ordomain */ + const int16_t dct_dim, /* i: dct processing dim possibly truncated */ + int16_t fdcngvq_dim, /* i: fdcng domain length */ + const float *idctT2_N_16matrixQ16, /* i: IDCT matrix */ + const int16_t matrix_1st_dim, /* i: */ + DCTTYPE dcttype ); /* i: matrix operation type */ + +void extend_dctN_input( + const float *input, /* i: input in fdcng domain */ + const float *dct_input, /* i: input in dctN(fdcng) domain */ + const int16_t in_dim, /* i: in_dim==N */ + float *ext_sig, /* o: extended output in fdcng domain */ + const int16_t out_dim, /* i: output total dim */ + float *matrix, /* i: idct matrix of size N rows , n_cols columns*/ + const int16_t n_cols, /* i: number of columns == truncation length */ + DCTTYPE dcttype ); /* i: matrix type */ + +#ifdef ERI_MSVQ_CLEANUP +int16_t msvq_stage1_dct_search( /* o : (p_max , best candidate sofar ) */ + const float *u, /* i : target */ + const int16_t N, /* i : target length and IDCT synthesis length */ + const int16_t maxC_st1, /* i : number of final stage 1 candidates to provide */ + const DCTTYPE dcttype, /* e.g. DCT_T2_16_XX, DCT_T2_24_XX; */ + const int16_t max_dct_trunc, /* i: maximum of truncation lenghts */ + float *invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ + const float *midQ_truncQ, /* i: midQ vector */ + const float *dct_invScaleF, /* i: global inv scale factors*/ + const float *dct_scaleF, /* i: global scale factors*/ + const Word16 n_segm, /* i: number of segments */ + const Word16 *cols_per_segment, /* i: remaining length per segment */ + const Word16 *trunc_dct_cols_per_segment, /* i: trunc length per segment */ + const Word16 *entries_per_segment, /* i: number of rows per segment */ + const Word16 *cum_entries_per_segment, /* i: number of cumulative entries */ + const Word8 *const W8Qx_dct_sections[], /*i: Word8(byte) segment table ptrs */ + const Word16 *col_syn_shift[], /*i: columnwise syn shift tables */ + const Word8 *segm_neighbour_fwd, /*i: circular neighbour list fwd */ + const Word8 *segm_neighbour_rev, /*i: circular neighbour list reverse */ + const Word16 npost_check, /*i: number of neigbours to check , should be even */ + float *st1_mse_ptr, /*i: dynRAM buffer for MSEs */ + int16_t *indices_st1_local, /*o: selected cand indices */ + float *st1_syn_vec_ptr, /*i/o: buffer for IDCT24 synthesis */ + float *dist1_ptr /*o: resulting stage 1 MSEs in DCT-N domain */ +); + +int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( + /* o : (updated p_max) */ + const float *st1_syn_vec_ptr, /* i : IDCT24 synthesis vectors */ + const float *u, /* i : target signal */ + const int16_t maxC_st1, /* i : number of candidates in stage1 */ + float *dist_ptr /* i/o: updated MSE vector for stage1 */ ); +#endif void PulseResynchronization( const float *src_exc, /* i : Input excitation buffer */ @@ -8200,26 +8282,21 @@ void lsf_end_enc( int16_t *lpc_param, int16_t *no_stages, int16_t *bits_param_lpc, - const int16_t coder_type_raw -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , + const int16_t coder_type_raw, const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -#endif ); void lsf_end_dec( - Decoder_State *st, - const int16_t coder_type_org, - const int16_t bwidth, - const int16_t nBits, - float *qlsf, - int16_t *lpc_param, - int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ - int16_t *nb_indices -#ifdef LSF_RE_USE_SECONDARY_CHANNEL + Decoder_State *st, /* i/o: decoder state structure */ + const int16_t coder_type_org, /* i : coding type */ + const int16_t bwidth, /* i : input signal bandwidth */ + const int16_t nBits, /* i : number of bits used for ISF quantization*/ + float *qlsf, /* o : quantized LSFs in the cosine domain */ + int16_t *lpc_param, /* i : LPC parameters */ + int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ + int16_t *nb_indices /* o : number of indices */ , const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -#endif ); ivas_error find_pred_mode( @@ -8514,9 +8591,10 @@ void generate_comfort_noise_dec( ); void generate_comfort_noise_dec_hf( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ - HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + const int16_t cng_flag /* i : CNG Flag */ ); void generate_masking_noise( @@ -8540,6 +8618,17 @@ void generate_masking_noise_mdct( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ); +#ifdef JBM_TSM_ON_TCS +void SynthesisSTFT_dirac( + float *fftBuffer, /* i : FFT bins */ + float *timeDomainOutput, + float *olapBuffer, + const float *olapWin, + const int16_t samples_out, + HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ +); +#endif + void generate_masking_noise_dirac( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */ @@ -8652,17 +8741,13 @@ void ApplyFdCng( const int16_t concealWholeFrame, /* i : binary flag indicating frame loss */ const int16_t is_music ); -void perform_noise_estimation_dec( - const float *timeDomainInput, - float *power_spectrum, - HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure */ - const int16_t element_mode, /* i : element mode type */ - const int16_t bwidth, /* i : audio bandwidth */ - const int16_t L_frame, /* i : frame length at internal Fs */ - const int16_t last_L_frame, /* i : frame length of the last frame at internal Fs */ - const int32_t last_core_brate, /* i : previous frame core bitrate */ - const int16_t VAD /* i : VAD flag in the decoder */ +void generate_comfort_noise_dec( + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ + Decoder_State *st, /* i/o: decoder state structure */ + const int16_t nchan_out /* i : number of output channels */ ); + /*! r: CNG energy */ float cng_energy( const int16_t element_mode, /* i : element mode */ @@ -8766,40 +8851,40 @@ void ReadFromBitstream( int16_t **pStream, int16_t *pnSize ); -void const *GetTnsFilterOrder( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsFilterOrder( void *p, int16_t index, int16_t value ); -void const *GetNumOfTnsFilters( void const *p, int16_t index, int16_t *pValue ); -void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value ); -void const *GetTnsEnabled( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsEnabled( void *p, int16_t index, int16_t value ); -void const *GetTnsEnabledSingleFilter( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsEnabledSingleFilter( void *p, int16_t index, int16_t value ); -void const *GetTnsFilterCoeff( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsFilterCoeff( void *p, int16_t index, int16_t value ); - -void const *GetTnsOnWhite( void const *p, int16_t index, int16_t *pValue ); -void *SetTnsOnWhite( void *p, int16_t index, int16_t value ); - -int16_t GetSWBTCX10TnsFilterCoeffBits( int16_t value, int16_t index ); -int16_t EncodeSWBTCX10TnsFilterCoeff( int16_t value, int16_t index ); -int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ); -int16_t GetSWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index ); -int16_t EncodeSWBTCX20TnsFilterCoeff( int16_t value, int16_t index ); -int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ); - -int16_t GetWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index ); -int16_t EncodeWBTCX20TnsFilterCoeff( int16_t, int16_t index ); -int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ); - -int16_t GetTnsFilterOrderBitsSWBTCX10( int16_t value, int16_t index ); -int16_t EncodeTnsFilterOrderSWBTCX10( int16_t value, int16_t index ); -int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, int16_t index, int16_t *pValue ); -int16_t GetTnsFilterOrderBitsSWBTCX20( int16_t value, int16_t index ); -int16_t EncodeTnsFilterOrderSWBTCX20( int16_t value, int16_t index ); -int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, int16_t index, int16_t *pValue ); -int16_t GetTnsFilterOrderBits( int16_t value, int16_t index ); -int16_t EncodeTnsFilterOrder( int16_t value, int16_t index ); -int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue ); +void const *GetTnsFilterOrder( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsFilterOrder( void *p, const int16_t index, const int16_t value ); +void const *GetNumOfTnsFilters( void const *p, const int16_t index, int16_t *pValue ); +void *SetNumOfTnsFilters( void *p, const int16_t index, const int16_t value ); +void const *GetTnsEnabled( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsEnabled( void *p, const int16_t index, const int16_t value ); +void const *GetTnsEnabledSingleFilter( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsEnabledSingleFilter( void *p, const int16_t index, const int16_t value ); +void const *GetTnsFilterCoeff( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsFilterCoeff( void *p, const int16_t index, const int16_t value ); + +void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ); +void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ); + +int16_t GetSWBTCX10TnsFilterCoeffBits( const int16_t value, const int16_t index ); +int16_t EncodeSWBTCX10TnsFilterCoeff( const int16_t value, const int16_t index ); +int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ); +int16_t GetSWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index ); +int16_t EncodeSWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index ); +int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ); + +int16_t GetWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index ); +int16_t EncodeWBTCX20TnsFilterCoeff( const int16_t, const int16_t index ); +int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ); + +int16_t GetTnsFilterOrderBitsSWBTCX10( const int16_t value, const int16_t index ); +int16_t EncodeTnsFilterOrderSWBTCX10( const int16_t value, const int16_t index ); +int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, const int16_t index, int16_t *pValue ); +int16_t GetTnsFilterOrderBitsSWBTCX20( const int16_t value, const int16_t index ); +int16_t EncodeTnsFilterOrderSWBTCX20( const int16_t value, const int16_t index ); +int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, const int16_t index, int16_t *pValue ); +int16_t GetTnsFilterOrderBits( const int16_t value, const int16_t index ); +int16_t EncodeTnsFilterOrder( const int16_t value, const int16_t index ); +int16_t DecodeTnsFilterOrder( Decoder_State *st, const int16_t index, int16_t *pValue ); void ResetTnsData( STnsData *pTnsData ); @@ -8983,6 +9068,7 @@ ivas_error config_acelp1( const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel*/ const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ const int16_t idchan, /* i : channel id */ + const int16_t active_cnt, /* i : Active frame counter */ const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ @@ -9490,11 +9576,11 @@ void TonalMDCTConceal_SaveTimeSignal( const int16_t numSamples ); void TonalMDCTConceal_Detect( - const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ - const float pitchLag, /*IN */ - int16_t *umIndices, /*OUT*/ - const PsychoacousticParameters *psychParamsCurrent, /*IN*/ - const int16_t isLfe ); + const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ + const float pitchLag, /*IN */ + int16_t *umIndices, /*OUT*/ + const PsychoacousticParameters *psychParamsCurrent /*IN*/ +); void TonalMDCTConceal_Apply( TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ @@ -9626,10 +9712,9 @@ int16_t getTcxonly( ); int16_t getTnsAllowed( - const int32_t total_brate, /* i : total bitrate */ - const int16_t igf, /* i : flag indicating IGF activity*/ - const int16_t element_mode, /* i : IVAS element mode */ - const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ + const int32_t total_brate, /* i : total bitrate */ + const int16_t igf, /* i : flag indicating IGF activity*/ + const int16_t element_mode /* i : IVAS element mode */ ); int16_t getCtxHm( @@ -9671,8 +9756,7 @@ int16_t getIgfPresent( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ const int16_t bwidth, /* i : audio bandwidth */ - const int16_t rf_mode, /* i : flag to signal the RF mode */ - const int16_t mct_chan_mode /* i : MCT channel mode */ + const int16_t rf_mode /* i : flag to signal the RF mode */ ); int16_t getCnaPresent( @@ -9969,6 +10053,5 @@ void init_tcx_cfg( const int16_t infoIGFStopFreq, const int16_t element_mode, const int16_t ini_frame, - const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */ + const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index b0c0c61978cd93adcbd9db91a0c0bf6768d711cb..25a5d6ee9e2bc576521784a27abdc242d86344dd 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -6036,138 +6036,297 @@ const FD_CNG_SETUP FdCngSetup_swb2 = { 640, 320, sizeof(sidPartitions_swb2)/size const int16_t levels_37bits[FD_CNG_stages_37bits] = { 128, 64, 64, 64, 64, 64 }; const int16_t bits_37bits[FD_CNG_stages_37bits] = { 7, 6, 6, 6, 6, 6 }; -const float cdk_37bits_1_ivas[3072] = -{ - 33.94763184f , 23.04196358f , 19.02036476f , 15.61426640f , 9.84622097f , 6.74968624f , 8.78495407f , 6.55844116f , 6.41478300f , 3.65438509f , 2.53205872f , 0.20947371f , -3.68736625f , -6.96642828f , -8.93218231f , -10.77195358f , -14.39207268f , -19.83006287f , -25.90260124f , -30.72169685f , -32.16821671f , -35.03061295f , -35.84580231f , -35.98442459f , - 23.05311012f , 15.34062386f , 11.67077923f , 9.03463936f , 7.33119154f , 6.01164532f , 4.86430264f , 3.36793089f , 2.00524712f , 1.02420747f , -0.28395364f , -1.14369977f , -2.29296756f , -3.49234462f , -4.55691099f , -5.82124615f , -7.01340151f , -8.19280529f , -9.51517677f , -11.88930511f , -12.41490746f , -13.91690540f , -15.41597271f , -17.46363640f , - 6.34591007f , 5.83291101f , 1.82374179f , 1.64918160f , 2.46284771f , 3.21434593f , 4.79773092f , 6.78620768f , 7.17590570f , 7.29561472f , 6.46074152f , 4.26570177f , 0.29191878f , -5.68994617f , -8.93541527f , -12.17100811f , -15.95464516f , -19.82475090f , -28.43348694f , -31.13560677f , -30.82723999f , -33.92724228f , -37.10982895f , -39.15046310f , - -1.97859216f , -1.29728901f , -0.68513793f , -0.59703761f , -0.19596121f , -0.48437589f , 0.41912374f , 0.32082281f , 0.42840490f , 0.33297276f , 0.00419650f , 0.25515109f , 0.07341246f , -0.05156118f , -0.17369615f , -0.39090252f , -0.53758574f , -0.97013980f , -1.37499487f , -2.59367585f , -2.67291665f , -3.56308174f , -5.09242105f , -7.33598137f , - 44.73780441f , 32.42730713f , 26.58676720f , 20.32800293f , 15.91747665f , 11.15012264f , 7.68650007f , 10.27048969f , 9.52919579f , 5.18821383f , 1.79746056f , -0.50318158f , -4.92894411f , -9.36254311f , -14.76678371f , -15.57420921f , -16.40379715f , -19.38558006f , -24.47130203f , -28.18117905f , -26.27810097f , -28.22804451f , -30.44338608f , -33.63451004f , - 27.92958260f , 17.48978424f , 9.02943993f , 2.00556946f , 0.77582097f , 1.75702107f , 2.96648121f , 4.17692900f , 5.20950508f , 4.89404440f , 3.14809656f , 2.02777839f , 0.06399647f , -2.44093847f , -5.23348236f , -7.73788691f , -9.60736561f , -11.49096489f , -12.88784599f , -14.62041187f , -14.05591011f , -13.97139835f , -13.55158806f , -12.38661575f , - 4.40041780f , 6.02715492f , 8.63421249f , 11.23643303f , 10.21946526f , 7.12535143f , 3.97593451f , 1.47885716f , -0.34547061f , -2.21350408f , -3.58581519f , -3.49226046f , 1.64697266f , -0.80884248f , -6.61078739f , -0.83386075f , -6.55604124f , -8.50729084f , -13.99620533f , -22.11815453f , -23.36925316f , -25.26130867f , -27.82377815f , -31.91535187f , - -0.31119800f , -0.22902243f , -0.18182723f , -0.17193857f , -0.22133952f , -0.25048682f , -0.19776741f , -0.20502391f , -0.15689729f , -0.08497809f , -0.04383328f , 0.10558389f , 0.22994623f , 0.27078405f , 0.26461646f , 0.21337126f , 0.07602444f , -0.07640435f , -0.08624625f , -0.01901877f , -0.37278932f , -0.55278486f , -0.50081939f , -0.57718313f , - 11.09673309f , 12.25163174f , 11.92947292f , 11.36766434f , 10.26155853f , 10.59420109f , 11.28228855f , 9.29032898f , 7.86474180f , 5.81516743f , 3.32581139f , 0.59270757f , -2.99105382f , -7.64252663f , -12.32353687f , -16.56275558f , -19.50693130f , -21.39342690f , -23.04017448f , -26.55841255f , -27.89498329f , -29.63920593f , -31.31513977f , -34.91411972f , - 14.63949299f , 9.97996807f , 7.52127123f , 6.06751871f , 4.64821386f , 3.74143553f , 3.04003358f , 2.11276221f , 1.27838099f , 0.61896890f , -0.12750353f , -0.75742245f , -1.50008225f , -2.24619722f , -2.86748576f , -3.65039921f , -4.29070568f , -5.12242794f , -6.06238365f , -7.87343836f , -7.91463709f , -9.02013016f , -10.03069305f , -11.15602875f , - 6.92497873f , 3.86428881f , 3.33403730f , 3.50285769f , 5.03133297f , 5.47784615f , 5.12933731f , 4.11465311f , 3.29701447f , 2.28059053f , 0.75228900f , -0.37691337f , -1.86169589f , -3.51180482f , -5.11985493f , -6.74894667f , -8.46384716f , -10.43132973f , -12.40718174f , -14.97575378f , -15.92234325f , -14.67680931f , -16.35786247f , -21.92259026f , - 9.03859520f , 6.23588181f , 4.69891214f , 3.76419306f , 2.91222286f , 2.25166726f , 2.02948308f , 1.35998511f , 0.74028724f , 0.50349784f , -0.12927644f , -0.45801210f , -0.88480383f , -1.52290273f , -1.84748936f , -2.22180009f , -2.73286033f , -3.21036029f , -3.73283100f , -5.33005810f , -4.96555710f , -5.72577906f , -6.40969419f , -7.14143419f , - 38.57890320f , 31.23274040f , 23.27908325f , 16.41319847f , 12.96908092f , 11.89987564f , 11.08193970f , 10.02814865f , 9.20901966f , 5.84658241f , 1.48919916f , -2.57032323f , -7.26163483f , -11.23550892f , -13.34285927f , -13.96859360f , -14.14492226f , -14.77427292f , -15.53306389f , -16.79932404f , -15.12855816f , -14.29256630f , -13.92473507f , -13.23437977f , - 23.30056572f , 13.31616783f , 10.53007698f , 7.97990513f , 7.58186388f , 6.05487776f , 6.38700247f , 4.46871328f , 3.73780274f , 1.15311646f , -0.16795112f , -1.00963080f , -2.99656630f , -4.04802418f , -5.87744474f , -7.26942492f , -8.01433468f , -8.85430908f , -8.93447399f , -10.80081940f , -10.03588772f , -9.56312180f , -9.49805927f , -9.08203316f , - 27.72716713f , 15.70166302f , 12.12497234f , 9.82916641f , 8.54480648f , 7.48498583f , 6.46852112f , 4.42398930f , 2.79946446f , 1.41388083f , -0.10821334f , -0.99111170f , -2.64519501f , -4.05361032f , -6.13559484f , -7.88495255f , -9.31697083f , -11.29918480f , -13.29217148f , -15.89776802f , -16.73270416f , -15.78193951f , -16.71963501f , -20.72499275f , - 0.09654448f , 0.05992651f , 0.07271793f , 0.06090590f , -0.01909172f , -0.02661837f , 0.00184859f , 0.00821958f , 0.01826876f , 0.00751956f , -0.02172063f , 0.03389538f , -0.00261579f , 0.00331171f , -0.00514964f , 0.00147764f , 0.00065488f , 0.01022588f , 0.00899184f , 0.02156001f , 0.01748813f , 0.01100880f , 0.01848303f , -0.00200717f , - 35.99007034f , 24.20862198f , 19.41031075f , 16.17420769f , 10.83719921f , 7.76013374f , 9.00250912f , 6.69725418f , 5.31352282f , 3.62490821f , 2.61681867f , 0.34085435f , -3.79527760f , -7.07614565f , -9.08049870f , -11.36665630f , -14.87462139f , -21.07974815f , -27.34793472f , -31.39986610f , -32.07981873f , -27.78803635f , -28.28388596f , -28.39242935f , - 13.10489750f , 20.89344025f , 21.64855194f , 15.43504715f , 10.25371075f , 3.34968066f , 1.78396285f , 0.43690255f , 0.33645880f , 2.18413949f , 0.30379224f , 2.14339352f , 2.11168623f , -3.22490501f , -5.35176468f , -6.71944952f , -7.60760832f , -7.25716639f , -9.25983143f , -10.88946342f , -12.36510563f , -14.32815361f , -16.37483597f , -19.41078377f , - 6.47920799f , 6.26157904f , 4.08267021f , 3.55930829f , 4.81190968f , 5.21526289f , 6.64490366f , 6.17979145f , 5.88209581f , 5.32573366f , 4.89284468f , 2.50707030f , -1.80236220f , -4.32998514f , -7.66879225f , -12.10674191f , -15.55172729f , -17.02550125f , -22.69219017f , -24.15981102f , -21.53298187f , -24.35451317f , -30.13893318f , -32.50536728f , - -1.27988362f , -1.28642356f , -0.84176970f , -0.75768483f , -0.62176520f , -0.62706548f , -0.67682666f , -0.86569685f , -0.75184637f , -0.68499511f , -0.73107177f , -0.44849658f , 0.61550426f , 3.18549967f , 2.15541792f , 0.41898161f , -0.96763957f , -2.28376174f , -2.21816230f , -1.44123793f , -1.10070240f , -1.48757422f , -1.94006848f , -2.04375577f , - 44.99568176f , 33.17905807f , 28.70528412f , 24.13981819f , 16.39375496f , 12.74631882f , 12.26308346f , 7.28386831f , 3.65083528f , 1.09594464f , -0.70640332f , -0.90420610f , -5.15652418f , -8.39927197f , -9.75838566f , -12.33563995f , -16.17337418f , -20.72145081f , -21.89005280f , -22.08177948f , -22.01576805f , -28.49225616f , -28.58443069f , -28.66851044f , - 27.27372360f , 16.82239342f , 9.52775478f , 4.54592752f , 2.38096476f , 1.92719686f , 2.83496809f , 3.88023591f , 4.84239244f , 4.33260632f , 2.40358329f , 1.26160026f , -0.59154904f , -2.84664989f , -5.20095921f , -7.12129021f , -8.10309982f , -9.32675076f , -10.37824821f , -12.16980839f , -11.58549690f , -11.62355518f , -11.35874844f , -10.43139648f , - 16.01709366f , 12.10370731f , 10.30418873f , 9.84315491f , 9.04705238f , 8.59515572f , 8.13945866f , 5.33055639f , 3.59784794f , 2.10469317f , 0.74735385f , -0.35173890f , -3.04881167f , -5.32683229f , -7.84610510f , -9.60193539f , -11.38669300f , -12.69159031f , -15.22157860f , -17.92496300f , -18.30335999f , -19.30245590f , -20.96332741f , -29.99128151f , - -1.49891376f , -0.94159925f , -1.59718812f , -2.73734355f , -4.95862293f , -5.62506247f , -3.84028316f , -1.86409163f , -1.10922730f , -0.37675977f , 0.54625863f , 1.08458769f , 2.59583378f , 4.74187803f , 4.85828352f , 2.72942448f , 1.21778154f , 0.61253220f , -0.12000842f , -0.42560402f , -0.47587356f , -0.59399730f , -0.54576296f , -0.64007539f , - 27.21817589f , 25.04722404f , 19.98665237f , 18.40707970f , 15.35737038f , 12.12910748f , 10.67379093f , 8.65770626f , 6.83053064f , 4.53696156f , 1.99311268f , -2.65666389f , -5.61365652f , -8.72017097f , -11.54872608f , -14.03052521f , -17.60883713f , -18.92860985f , -19.26733208f , -21.02047348f , -20.41023064f , -24.96704483f , -27.28151131f , -32.13149261f , - 16.58616257f , 6.07702732f , 3.20051527f , 2.19352865f , 1.25951850f , 0.52847487f , 0.36339840f , 1.22322381f , 1.40252435f , 0.78051162f , -0.14960484f , -0.19245568f , 0.80768329f , -0.03997936f , -0.45896211f , -1.94675004f , -3.57758331f , -4.74786758f , -6.30557394f , -7.96810246f , -7.85797882f , -8.40102768f , -8.70696068f , -14.50718975f , - 5.83877993f , 8.64909840f , 10.36191940f , 10.75121212f , 10.87299442f , 9.20523739f , 6.57943916f , 2.45789552f , 0.32793057f , -0.19492692f , -0.50667870f , -0.82865268f , -3.29967546f , -5.41881037f , -5.00245380f , -7.02534580f , -7.16695213f , -10.07062340f , -13.29201317f , -15.16228962f , -14.82801533f , -13.98322010f , -16.56229019f , -25.20559120f , - 6.31290579f , 4.29846334f , 3.09123778f , 2.35388660f , 2.08894801f , 1.51627553f , 1.61039710f , 1.01586986f , 0.50589812f , 0.34378609f , -0.11773424f , -0.29939151f , -0.59060657f , -1.10041618f , -1.30399191f , -1.66196144f , -2.00707245f , -2.30241942f , -2.72166705f , -4.15126562f , -3.61430144f , -4.17390060f , -4.64368582f , -5.19181061f , - 45.07491302f , 31.96612358f , 24.59359169f , 15.32010937f , 11.66156387f , 10.47190285f , 8.21482182f , 6.91866159f , 6.46052694f , 2.31078482f , -0.97819418f , -3.39280653f , -5.75906181f , -7.82967377f , -8.74781990f , -9.47419548f , -9.85650921f , -10.05874729f , -10.25747013f , -11.21096134f , -9.55652142f , -8.75567627f , -8.43642902f , -7.74934912f , - 29.56493187f , 22.29573250f , 13.46729183f , 9.18490410f , 7.02603865f , 5.38271475f , 3.58497858f , 2.35314894f , 2.17064548f , 0.43121719f , -0.60757560f , -1.00088501f , -1.82668996f , -2.00680733f , -4.21636438f , -5.02670193f , -6.26371956f , -6.65761995f , -7.37742567f , -9.00110912f , -9.04595757f , -10.59253120f , -12.24499798f , -13.79708004f , - 18.81605339f , 15.10544109f , 13.69033337f , 12.55228615f , 12.10694313f , 9.87893867f , 7.45830679f , 3.83573604f , 1.58222044f , 0.19975230f , -0.48743680f , -1.03465378f , -3.26008105f , -6.03337908f , -6.72951269f , -8.16258240f , -9.35424900f , -11.36496258f , -14.10615826f , -16.52154922f , -15.71789932f , -14.28701687f , -15.86503506f , -21.98985291f , - 0.58833683f , 1.93554544f , 1.01621759f , 0.17751050f , 1.44273913f , 1.63168383f , 0.87785423f , 0.63285774f , 0.44776136f , 0.05703505f , -0.13712768f , 0.28278413f , -0.80131322f , -0.86604142f , -1.59806752f , -0.93005019f , -1.04011548f , -0.89366192f , -0.64847207f , -0.61214101f , -0.55340266f , -0.16991313f , -0.15702423f , -0.17067310f , - 39.23077011f , 28.73466682f , 25.17003059f , 18.13150215f , 12.30397224f , 10.44106960f , 8.78819275f , 7.09760094f , 4.76503944f , 3.22303295f , 1.15491402f , -0.03009734f , -3.15244532f , -7.48607492f , -9.52877903f , -12.40654850f , -15.16987514f , -18.84217262f , -22.60379219f , -26.15986252f , -28.55947685f , -31.27477455f , -36.50263596f , -45.15930557f , - 17.17733002f , 11.81043625f , 8.99961948f , 7.02285528f , 5.70868826f , 4.43369055f , 3.63820124f , 2.49104285f , 1.49823487f , 0.74478340f , -0.16968371f , -0.91984361f , -1.82045591f , -2.59034872f , -3.43512726f , -4.35373259f , -5.22545052f , -6.16511250f , -7.18896103f , -9.18914032f , -9.45307922f , -10.67428303f , -11.84619045f , -13.22418404f , - -0.55165589f , 0.54447228f , -1.45378113f , 0.62164629f , 1.57039273f , 1.95998776f , 2.55171132f , 3.54153609f , 4.37655210f , 5.13829708f , 4.63276052f , 3.44003415f , 1.41755366f , -1.65012610f , -4.90518045f , -8.74811363f , -13.32540989f , -16.67502213f , -25.04341888f , -28.74816895f , -26.61729050f , -30.89074135f , -36.89068222f , -40.54713821f , - 0.52585047f , 0.25778684f , -0.68478346f , -0.63753521f , -0.85982674f , -0.45736870f , -0.39972550f , 0.19919159f , 0.21982291f , -0.21426015f , -0.17481731f , -0.30233619f , 0.35445356f , 0.53019482f , 0.62357306f , 0.10003661f , 0.38106197f , 0.59916449f , 0.29353949f , 0.19449981f , -2.91975641f , -2.99291539f , -3.24024558f , -3.85247374f , - 47.57529449f , 35.40103149f , 28.51466560f , 21.36822510f , 16.31501770f , 12.05416298f , 8.92814922f , 10.24798870f , 9.38683319f , 5.06438446f , 1.55697119f , -0.90166509f , -5.27530479f , -10.13637447f , -14.91060257f , -15.56597614f , -16.76358414f , -19.75214577f , -22.57003212f , -24.67880249f , -22.22905731f , -23.92941093f , -26.02715302f , -29.14421463f , - 32.45030594f , 18.47647858f , 10.55478764f , 2.66163707f , 0.48469192f , 0.89728785f , 2.66320086f , 4.46394491f , 5.75276375f , 5.15140963f , 3.30917573f , 2.07156634f , 0.32162985f , -2.37937927f , -5.25204325f , -7.75560665f , -9.72864151f , -11.49621296f , -12.90788174f , -14.53592110f , -14.00264931f , -13.90744686f , -13.50663280f , -12.31781673f , - 15.12892532f , 10.85012150f , 9.24257946f , 7.17304945f , 5.39838934f , 4.54048777f , 4.45172882f , 4.02888584f , 4.08525467f , 3.34242988f , 1.18552935f , 0.14054979f , -1.31041145f , -4.10797310f , -6.60405207f , -7.35080433f , -7.80001211f , -10.14729309f , -14.88454437f , -18.54398346f , -20.49944305f , -23.77704430f , -28.38242531f , -32.21464920f , - -0.70120311f , -0.36598748f , -0.27498749f , -0.18644568f , -0.13108316f , -0.05633634f , -0.12568842f , -0.05810567f , 0.00805399f , 0.04813070f , 0.01124786f , 0.06457995f , 0.05968979f , 0.04663355f , 0.04679099f , 0.04774757f , 0.03833918f , -0.06331048f , -0.10397947f , 0.00857244f , 0.29188818f , 0.54560822f , 0.49374610f , -0.00754885f , - 24.01022911f , 20.44940186f , 18.33339310f , 13.47519684f , 11.34601212f , 10.42150116f , 9.00321579f , 7.93997908f , 7.78757143f , 4.54246807f , 3.10096765f , -1.79380953f , -4.57441616f , -8.99514294f , -11.16653728f , -12.33127975f , -15.28052711f , -18.40486145f , -21.08405685f , -23.96353531f , -24.15535736f , -27.96574211f , -31.00701714f , -35.18267441f , - 10.95846939f , 7.75293112f , 5.94634438f , 4.67962313f , 3.86481786f , 3.06800008f , 2.68010044f , 1.77875984f , 1.08723342f , 0.60881591f , -0.11699903f , -0.66425866f , -1.27388847f , -1.93990111f , -2.43955994f , -3.04650831f , -3.60661364f , -4.21451235f , -4.87673521f , -6.57435703f , -6.46493149f , -7.41116762f , -8.24285698f , -8.84710217f , - 16.32924080f , 6.70306444f , 4.40889025f , 4.39005423f , 5.66961336f , 5.49213505f , 5.14747572f , 4.57054806f , 3.82850742f , 2.47304583f , 0.96936250f , -0.07546291f , -1.78923011f , -3.94788241f , -5.62404537f , -7.41395044f , -9.30011559f , -11.32884693f , -13.38846397f , -15.90376568f , -16.61722183f , -15.37379074f , -16.91991615f , -22.64369392f , - 20.29391861f , 10.14759159f , 7.41714382f , 5.43669033f , 4.22476673f , 3.05457902f , 2.12789893f , 1.46166980f , 0.68013304f , 0.10416872f , -0.62377477f , -0.69513589f , -1.11597610f , -1.73416364f , -2.00164723f , -2.48846936f , -2.99404836f , -3.36779451f , -4.50076723f , -6.23718977f , -6.32519245f , -7.00517225f , -7.63285732f , -8.34685898f , - 44.62683868f , 33.65060043f , 28.74439240f , 23.09117126f , 16.70447159f , 13.63468075f , 10.38835239f , 5.27151346f , 3.37364483f , 0.80086398f , -1.61115754f , -1.84962809f , -4.63047361f , -7.54744434f , -8.66370773f , -11.56917572f , -14.30193806f , -18.52358246f , -19.55438995f , -20.00398636f , -19.80403900f , -20.08826447f , -20.32636070f , -20.57789421f , - 25.43884087f , 14.71314049f , 10.84564495f , 7.29425287f , 5.99180174f , 4.52135897f , 4.43509150f , 2.96715736f , 2.20721149f , 0.85104460f , -0.42902783f , -1.01505911f , -1.67976689f , -3.03431702f , -4.04744673f , -5.05236149f , -5.71568680f , -7.14737368f , -7.96077490f , -9.41807270f , -8.88839054f , -8.62583065f , -8.43768692f , -8.79677773f , - 33.08629990f , 21.98393631f , 16.71452332f , 13.11685467f , 10.53023720f , 8.59362793f , 6.77428055f , 4.80111885f , 2.96947551f , 1.50105977f , -0.29485464f , -1.76483214f , -3.38473845f , -5.02232218f , -6.55174637f , -8.24214268f , -9.90916348f , -11.56876373f , -13.40682983f , -16.22795105f , -17.44435501f , -19.50963020f , -21.48133469f , -22.37619972f , - 0.14234349f , 0.00043129f , -0.46088508f , -0.47227818f , 0.19577537f , 0.57165289f , 0.14063163f , -0.08314086f , -0.17897955f , 0.26915708f , 0.29296365f , 0.25751004f , -0.29272652f , -0.35612249f , -0.45116535f , -0.22750567f , -0.13805020f , -0.08609761f , -0.08811182f , -0.00370739f , 0.04999773f , 0.10020024f , 0.12026346f , 0.12320870f , - 37.20217514f , 25.50048447f , 26.05090904f , 21.39400101f , 14.80546665f , 10.78633976f , 9.48393726f , 6.51000643f , 4.64587116f , 2.54244065f , 1.88398576f , -0.17826277f , -3.92847228f , -7.94585609f , -9.83112335f , -12.51981831f , -16.25451469f , -22.52105331f , -26.16354942f , -28.17800331f , -28.44519234f , -28.99005890f , -29.07491684f , -29.13504791f , - 22.87589455f , 20.69346428f , 16.08814049f , 12.09293556f , 8.58536339f , 6.12085295f , 5.03096294f , 2.46971536f , 1.38820446f , 0.41556263f , -0.71674269f , -1.87001503f , -1.97099841f , -3.12624931f , -4.61008024f , -5.90624523f , -5.81033182f , -7.63588858f , -9.32999802f , -11.98378181f , -13.66734123f , -15.22948647f , -17.72668266f , -22.15813255f , - 17.13776016f , 7.48015785f , 3.87183666f , 3.80275106f , 3.69309711f , 2.47135592f , 3.28866863f , 5.23638964f , 5.97343540f , 3.02334547f , 1.66290724f , 1.17763150f , 0.56503248f , -4.12660456f , -4.84892178f , -8.03931713f , -10.07701778f , -12.74638939f , -15.61114883f , -18.82812119f , -20.06874847f , -20.77385521f , -23.02597237f , -28.41068077f , - -0.68962491f , -0.67818958f , -0.47791985f , -0.18780768f , 0.07656835f , 0.29909450f , 0.36705506f , 0.60864949f , 0.66434783f , 0.54813319f , 0.31165063f , 0.41151917f , 0.27194378f , -0.09006688f , -0.59337950f , -1.27168393f , -1.60383165f , -2.03537226f , -1.01842117f , -1.12101495f , -2.20869303f , -2.13650179f , -1.40165854f , -1.00871158f , - 49.11537170f , 34.27339554f , 29.03029442f , 23.60639191f , 19.18561935f , 16.01621819f , 10.65990448f , 5.50423098f , 3.26754117f , 0.54238629f , -2.50046039f , -1.85086572f , -5.88433218f , -8.55415058f , -9.42830467f , -11.97149277f , -14.98629475f , -17.55759621f , -17.94509125f , -18.13786888f , -17.94290543f , -28.52441216f , -28.69857025f , -28.89863968f , - 32.58505249f , 18.45134735f , 10.62341118f , 4.82959938f , 2.78050184f , 2.30071044f , 2.89666629f , 3.55971622f , 4.36246777f , 3.80749893f , 2.22673583f , 1.03990865f , -0.54025501f , -2.73137355f , -4.92715406f , -6.82418060f , -7.95124388f , -9.07779884f , -9.96023846f , -11.46563911f , -10.75256252f , -10.58728790f , -10.22681522f , -9.05898476f , - 16.11109161f , 14.82219410f , 13.34882832f , 7.98469877f , 9.43520164f , 7.92174578f , 5.07156849f , 3.38034701f , 3.45362854f , 2.55894756f , 0.36423218f , -0.89059198f , -2.32811356f , -5.22609854f , -8.06139755f , -8.08888912f , -7.59058094f , -9.63050747f , -13.39019203f , -16.84990501f , -16.90269279f , -20.11418533f , -23.25974846f , -26.99926376f , - -1.15594578f , -1.16174018f , -1.02029443f , -0.85063583f , -0.73866522f , -0.75481141f , -0.86772621f , -1.00807703f , -1.13209546f , -1.11179471f , -1.20630574f , -1.01733243f , 0.24630366f , 3.09700346f , 3.12491417f , 1.54673541f , -0.17814836f , -1.87219131f , -0.85840708f , 1.11508834f , 1.62732244f , 0.97436380f , -0.19077510f , -0.80510545f , - 32.42321777f , 27.32720947f , 20.86049461f , 15.20588684f , 12.79125309f , 12.29267693f , 12.11658001f , 11.01210213f , 10.89878845f , 7.15270519f , 2.06876802f , -2.13045192f , -6.80808592f , -11.65817642f , -14.62570095f , -16.24762154f , -16.86284065f , -17.20292854f , -18.81791878f , -20.65732384f , -19.57567215f , -19.88597488f , -22.49367523f , -26.33296204f , - 25.36096573f , 13.31346798f , 8.91108418f , 5.01322508f , 3.48370409f , 2.18634796f , 2.12754703f , 1.25077868f , 0.72989434f , 0.29854974f , -0.73259068f , -0.59268522f , 0.14181496f , -0.68818730f , -1.80540454f , -2.34638786f , -4.05338144f , -5.46354723f , -7.10088396f , -9.38928127f , -8.44892311f , -9.48880005f , -9.86396503f , -10.07871723f , - 7.17678213f , 9.03277683f , 10.13266754f , 10.24296856f , 10.17098331f , 8.09959507f , 5.65843153f , 1.62803376f , -0.36960009f , -0.74838853f , -0.79447383f , -0.80214244f , -2.22858644f , -4.54312086f , -4.46352482f , -5.71911240f , -5.88809395f , -8.41744232f , -10.94176769f , -12.21683311f , -12.21341038f , -11.48782635f , -14.09292316f , -23.15090752f , - 18.21541405f , 14.70297527f , 14.13050365f , 12.94417000f , 11.81984806f , 9.76036167f , 6.53366423f , 4.50655460f , 0.83037621f , -0.42548206f , -1.35710704f , -2.34608483f , -3.56638503f , -5.17272615f , -5.63396835f , -7.03527308f , -7.91377544f , -8.77217388f , -10.20801735f , -12.21526527f , -12.12676907f , -11.62418461f , -12.46908951f , -15.99641514f , - 44.82578278f , 29.92639542f , 27.50827789f , 23.80286217f , 17.65353203f , 14.31119919f , 9.68513775f , 4.39934206f , 2.73908210f , 0.84895563f , -2.34653950f , -2.60779619f , -5.48460007f , -7.85637569f , -8.35718441f , -10.63293934f , -12.35181427f , -14.18777370f , -14.52088261f , -15.19802761f , -14.50250244f , -14.72802734f , -15.11614609f , -15.65816784f , - 22.81040764f , 18.14611626f , 15.16109562f , 7.86977768f , 8.17525578f , 4.43149519f , 3.84347200f , 1.57480264f , 0.94041783f , 0.21524446f , -0.86289990f , -1.21070933f , -2.15402818f , -2.98346281f , -3.67899656f , -4.07589436f , -4.21469736f , -4.80487633f , -5.08027840f , -6.07973146f , -5.15939760f , -4.76911354f , -4.57167721f , -4.45344400f , - 24.49489975f , 17.31044769f , 13.22760391f , 10.45895958f , 8.42623138f , 6.75540257f , 5.42271709f , 3.69801641f , 2.30738783f , 1.11391723f , -0.26593676f , -1.45248365f , -2.67149425f , -4.03488445f , -5.14615870f , -6.45010090f , -7.70261431f , -9.10985470f , -10.61737823f , -13.08172894f , -13.92179298f , -15.81127357f , -17.59627724f , -19.73897552f , - 8.98934364f , 4.76031303f , 2.62020183f , 1.48485959f , 0.28737816f , 0.05866807f , -0.01028116f , -0.07208341f , -0.13242376f , -0.04422715f , -0.09028641f , -0.04876806f , 0.10697100f , 0.04797191f , 0.01100808f , -0.07014611f , -0.04378227f , -0.04009765f , -0.17876917f , -0.72032106f , -0.11678807f , -0.05392319f , -0.07008670f , -0.21385938f , - 36.29371643f , 24.65291214f , 21.01904678f , 16.67200279f , 11.48446560f , 8.12246799f , 9.78220177f , 7.74590874f , 5.69669485f , 4.02027988f , 3.36120009f , 0.58418810f , -3.89836407f , -7.63864374f , -10.03672886f , -12.67631626f , -16.54735374f , -22.06600380f , -27.53655815f , -31.70346832f , -32.28223419f , -33.58357620f , -33.78388596f , -33.85955811f , - 20.20799255f , 13.75940609f , 10.45750713f , 8.23875809f , 6.45997095f , 5.16953897f , 4.34209776f , 2.95543051f , 1.74270713f , 0.87219697f , -0.25581297f , -1.09575856f , -2.07853103f , -3.06528211f , -3.94644260f , -5.01998711f , -6.08012724f , -7.13329268f , -8.25736523f , -10.45005131f , -10.79236698f , -12.32848263f , -13.70973110f , -15.25794792f , - 7.88285303f , 6.51488161f , 3.92537451f , 4.23367739f , 4.89059639f , 5.43539810f , 6.37946939f , 8.50651741f , 9.33964443f , 8.69559956f , 6.91200352f , 3.63401532f , -0.99519163f , -7.15117836f , -11.47043896f , -15.28446960f , -18.89196777f , -23.08573532f , -28.80813408f , -30.38180542f , -29.53565407f , -31.03279877f , -32.39319229f , -33.27596664f , - 0.40477216f , 0.24463084f , -0.76651365f , -0.71309596f , -0.87443089f , -0.30846810f , -0.39305758f , 0.23431541f , 0.22700633f , -0.23816873f , -0.20784868f , -0.32913551f , 0.34776384f , 0.50111002f , 0.59345955f , 0.10497253f , 0.34248179f , 0.54556167f , 0.25770640f , 0.16739839f , -4.25213432f , -4.33188486f , -4.59072590f , -5.18169022f , - 44.52682495f , 33.44413376f , 27.75477028f , 20.87782860f , 15.96038628f , 11.38267708f , 8.04888916f , 10.34346294f , 9.36942101f , 5.06397772f , 1.65765107f , -0.60627878f , -5.02781725f , -9.60684490f , -14.71248531f , -15.51352501f , -16.35951424f , -19.44139671f , -23.93828964f , -27.02204704f , -23.39621544f , -25.11229706f , -27.06189728f , -29.88434029f , - 30.53590775f , 18.24347496f , 10.48498344f , 3.34677172f , 1.29623032f , 1.39035857f , 2.45928121f , 3.70242572f , 4.65490055f , 4.28991556f , 2.71830440f , 1.69632769f , 0.22320883f , -2.12041640f , -4.55487108f , -6.90537930f , -8.85028553f , -10.44450092f , -11.88594723f , -13.62341404f , -13.19523811f , -13.18412113f , -12.81897163f , -11.68476582f , - 5.23515940f , 11.02192688f , 12.84599209f , 11.99070740f , 7.98806524f , 4.52272415f , 4.08583927f , 2.00564265f , -0.15996964f , -2.10115862f , -4.96646547f , -5.90554714f , 4.82052660f , 0.89168262f , -6.95808125f , 2.50679994f , -6.73005676f , -6.52649450f , -14.76829720f , -15.44077110f , -21.42759705f , -23.35196304f , -25.43357277f , -27.50794983f , - 1.84942830f , 0.77272046f , 0.24707772f , -0.08593588f , -0.23682129f , -0.24805132f , -0.09850720f , -0.04999159f , -0.00995130f , 0.02216339f , 0.08926903f , 0.20275106f , 0.22498472f , 0.26662621f , 0.16996276f , -0.06895026f , -0.26348418f , -0.41196167f , -0.47150335f , -0.43742141f , -0.53234649f , -0.56433624f , -0.59429443f , -0.65639752f , - 14.08870220f , 13.32911205f , 10.19654274f , 6.80626822f , 6.89704180f , 6.85630465f , 6.28267908f , 6.48725128f , 6.74154425f , 5.72381783f , 4.45444155f , 2.14331675f , -1.56116712f , -5.51466084f , -8.73317051f , -13.38193130f , -16.39547157f , -18.36110878f , -22.47372246f , -24.78481865f , -23.78740883f , -25.83082390f , -28.30295181f , -29.63710213f , - 12.11153984f , 11.18265629f , 8.56032085f , 6.07614088f , 4.32917595f , 3.62714767f , 2.88151503f , 0.00486909f , 0.16551718f , 0.11766627f , -1.01007175f , -1.58863187f , -0.66722620f , -1.26095092f , -2.03257895f , -2.68355250f , -1.88288093f , -2.89664102f , -3.82705688f , -5.15467978f , -5.96337652f , -7.68645287f , -9.75820160f , -14.60475540f , - 10.68691158f , 5.49249125f , 4.08632946f , 3.73180628f , 5.00127029f , 5.47980690f , 5.41938591f , 4.71624136f , 3.67419004f , 2.41826725f , 0.86259502f , -0.22994517f , -1.90842390f , -3.87555194f , -5.49712229f , -7.17735624f , -8.88335800f , -10.96466255f , -12.92337704f , -15.48291206f , -16.37232208f , -15.13042545f , -16.82096863f , -22.42011452f , - 15.85285378f , 10.13984489f , 8.02905941f , 4.50967121f , 2.95999980f , 2.60214114f , 0.53660029f , 0.86555701f , 0.22102003f , -0.33034071f , -0.07463158f , 0.21286504f , -0.93098062f , -1.75468397f , -1.58335686f , -1.24065292f , -1.48353171f , -1.76630950f , -2.04288220f , -3.12292504f , -2.45715189f , -2.74685717f , -3.16709018f , -5.91369343f , - 40.10007477f , 32.17766190f , 23.94418526f , 17.08811951f , 13.37568951f , 12.24086761f , 11.66988850f , 10.55005550f , 9.33296108f , 5.75441313f , 1.48114145f , -2.81252980f , -7.79981041f , -11.41279602f , -13.67298222f , -14.21839428f , -14.48849964f , -15.18556213f , -15.61604404f , -16.76811600f , -15.01851368f , -14.17923927f , -13.81790257f , -13.10479736f , - 24.85771179f , 14.51553345f , 11.72882080f , 8.90813828f , 8.43283081f , 6.32554102f , 6.22324610f , 3.79361701f , 4.27097321f , 0.56961524f , -1.24056125f , -1.41678429f , -3.11242867f , -4.09969568f , -5.68787241f , -6.75505066f , -7.30343008f , -8.00887489f , -7.82331944f , -9.66470909f , -8.76680851f , -8.39351845f , -8.12993431f , -7.16756201f , - 28.97707558f , 19.26215744f , 14.32650089f , 11.15691090f , 8.93038845f , 7.45748949f , 5.97504330f , 4.08204174f , 2.51096678f , 1.17593741f , -0.48250875f , -1.45828211f , -2.81734180f , -4.23465633f , -5.64280844f , -7.11844778f , -8.37782097f , -10.01226807f , -11.81233501f , -14.42724609f , -15.63475609f , -17.08984566f , -18.90253639f , -21.68543816f , - -0.37224483f , -0.21122639f , 0.15951714f , 0.02087032f , 1.22483158f , 0.00348772f , -0.18272802f , -0.44353136f , -0.08490600f , -0.11233181f , -0.16806731f , -0.22428627f , -0.01276036f , 0.06931113f , 0.01195190f , -0.11203818f , 0.03106703f , 0.26289529f , 0.23697743f , 0.22796448f , 0.04144126f , 0.09472501f , 0.14482924f , 0.17954086f , - 39.73665619f , 26.81943703f , 21.29967880f , 18.16204262f , 13.44168472f , 11.03711700f , 11.62625027f , 7.02647495f , 4.79233932f , 3.35499501f , 2.79116821f , -0.41337949f , -4.65079498f , -8.28630638f , -10.48777294f , -13.31785393f , -16.91392136f , -22.94918823f , -27.85824203f , -29.88930130f , -30.09802246f , -28.58382988f , -28.66120720f , -28.70516014f , - 19.10952950f , 22.74327850f , 23.97905540f , 21.18729591f , 11.64360809f , 6.94751596f , 4.65807104f , 0.78640783f , -0.24381419f , 1.02887869f , 0.82303244f , -0.54234630f , -0.94865251f , -1.77358091f , -5.30440760f , -8.68288422f , -8.39182663f , -8.75503826f , -11.02817535f , -13.34524441f , -13.31265545f , -13.47730160f , -16.70124626f , -23.44244576f , - 5.32545233f , 7.05786848f , 6.26387453f , 5.78526258f , 5.88421535f , 5.73053551f , 5.83421803f , 6.25754404f , 5.95633888f , 5.21652365f , 3.57697511f , 1.02363062f , -2.68831611f , -5.48803329f , -7.67456436f , -10.52217293f , -13.10689449f , -14.01679230f , -18.51670074f , -20.16453171f , -19.27928925f , -21.94375420f , -27.47334480f , -29.79807281f , - -2.60717487f , -1.83319664f , -1.31210554f , -0.76391363f , -0.20487705f , -0.30073228f , -0.07237651f , 0.09489144f , -0.11017539f , -0.08628271f , -0.06826403f , 0.06346101f , 0.18584041f , 0.16889001f , 0.13889854f , 0.14046463f , 0.05026200f , -0.19259109f , 0.12724322f , 0.05020098f , -0.06773847f , -0.35614878f , -0.63952541f , -0.86939591f , - 43.34894180f , 31.48630524f , 28.12536430f , 24.63106918f , 16.25746918f , 12.06399059f , 10.17741966f , 6.35993147f , 4.57542324f , 1.64055872f , 0.70682496f , -0.49986696f , -4.10422993f , -8.01978779f , -9.94273472f , -12.91026783f , -16.30473137f , -20.63467598f , -21.94548988f , -22.36483765f , -22.45355415f , -22.54744720f , -22.58737946f , -22.65038681f , - 30.95190620f , 18.16899109f , 9.72149658f , 4.10552931f , 2.30458689f , 2.12724614f , 2.85707808f , 4.13076019f , 5.31916714f , 4.81190920f , 3.00600863f , 1.67334628f , -0.53532135f , -3.10476613f , -5.73052549f , -7.79181433f , -9.06767464f , -10.22359562f , -11.19510365f , -12.66148758f , -12.00313091f , -11.91836929f , -11.49621868f , -10.27651405f , - 19.52749825f , 13.26932335f , 10.77497768f , 9.87707806f , 8.94397163f , 8.45470905f , 7.96926117f , 5.37859535f , 3.56771731f , 1.95985627f , 0.70804149f , -0.21590416f , -3.00161719f , -5.06863308f , -7.59307814f , -9.56244850f , -11.54047012f , -12.52976322f , -14.91271400f , -17.65096283f , -17.99032593f , -18.96465111f , -20.50286484f , -29.15997505f , - -0.41770393f , -0.57753342f , -1.20728409f , -2.88331747f , -5.34745789f , -6.08694220f , -3.71453929f , -2.12419772f , -1.18535638f , -0.59698033f , 0.42981535f , 1.32175910f , 2.83778572f , 4.84865475f , 5.04370260f , 3.07809186f , 1.49566460f , 0.65009278f , 0.04541466f , -0.15811041f , -0.29866409f , -0.41704908f , -0.46928179f , -0.48526672f , - 30.59598160f , 24.69124985f , 19.35356522f , 17.04518127f , 12.47758865f , 9.30305386f , 9.31541252f , 8.18128777f , 5.78386831f , 3.40561008f , 1.86525965f , -2.05713415f , -3.91759825f , -7.05117083f , -9.88467789f , -11.80012417f , -15.62137604f , -16.45769119f , -16.11259651f , -17.03925705f , -16.63202477f , -20.41814423f , -23.23829842f , -27.13690567f , - 22.04087639f , 9.82030296f , 6.62304544f , 3.54571700f , 2.28869224f , 1.43831360f , 1.01925826f , 0.60685647f , 0.52726758f , 0.28217983f , -0.60519862f , -0.40057555f , 0.33728161f , 0.16425660f , -0.30877599f , -1.72851086f , -3.62104511f , -5.35534239f , -7.36662674f , -9.61280251f , -9.84184837f , -9.76028061f , -10.30779839f , -12.96220016f , - 7.59925270f , 9.89327908f , 11.32660198f , 11.55432892f , 11.11032295f , 9.16942692f , 6.63248444f , 2.69755864f , 0.57976800f , 0.05171308f , -0.55509138f , -1.34203660f , -3.50475025f , -5.48786688f , -5.35051298f , -6.98438931f , -7.01662779f , -9.47507668f , -12.24847126f , -13.41042137f , -12.92720699f , -12.06966019f , -14.46927357f , -23.34392357f , - 6.96612597f , 5.00931787f , 3.76138091f , 3.18334484f , 2.03293252f , 1.34288895f , 1.58868873f , 1.00840783f , 0.40005356f , 0.06600340f , -0.13207078f , -0.20888096f , -0.49867839f , -0.91563702f , -1.39049554f , -1.52579367f , -1.76741624f , -2.06173539f , -2.48300815f , -3.86886954f , -3.38073707f , -3.92400837f , -4.47162819f , -5.09745169f , - 47.14703751f , 30.38273811f , 21.96264458f , 14.39871597f , 10.23386383f , 8.95710278f , 6.93860054f , 5.62253952f , 4.24646330f , 1.48851633f , -1.20669615f , -3.14844489f , -5.07624435f , -6.20617819f , -6.85559320f , -7.39740086f , -7.59652758f , -7.76342344f , -7.96090555f , -8.85080433f , -7.36783743f , -6.51624918f , -6.18211889f , -5.45559025f , - 33.12013626f , 16.84858894f , 12.65143013f , 8.74576950f , 7.71503162f , 5.75152826f , 5.57081461f , 3.33705091f , 2.19604564f , 0.46275416f , -1.08203483f , -1.74722302f , -2.23058796f , -3.73542142f , -4.79898882f , -5.51074600f , -5.92822361f , -7.29669523f , -7.87425613f , -9.19938278f , -8.26733780f , -7.79288721f , -7.17766953f , -6.91147518f , - 22.72534180f , 16.73917770f , 15.96501827f , 15.48456001f , 14.21817970f , 11.09321880f , 7.22196627f , 3.27875924f , 0.86349517f , -0.35276374f , -0.96022642f , -1.97590554f , -4.21987820f , -5.87952375f , -6.43021441f , -8.40103912f , -8.45606804f , -10.49744606f , -12.33858109f , -13.72036362f , -13.35521221f , -11.95208740f , -13.21454906f , -18.77292252f , - 0.89415503f , 2.55427527f , 2.19861484f , 1.76997423f , 1.68467879f , 1.11462021f , 0.72990263f , 0.68752390f , 0.55451417f , 0.46162665f , -0.10212867f , 0.08975709f , -1.02394462f , -0.74809217f , -1.54942429f , -0.89107299f , -1.00796068f , -0.70048058f , -0.53988647f , -0.51691598f , -0.45218167f , -0.00372395f , -0.01138951f , -0.04693869f , - 42.55582428f , 31.86493301f , 25.10536003f , 19.38906479f , 13.20624542f , 10.70058155f , 8.71647072f , 6.43070078f , 4.15740585f , 2.91404939f , 0.74730510f , -0.24514204f , -2.99233270f , -7.08516312f , -9.33087540f , -12.22711372f , -14.99213314f , -18.51732445f , -22.07689285f , -25.69321823f , -27.76980782f , -30.33328629f , -35.40525818f , -43.80059433f , - 17.17425156f , 15.04495525f , 13.74315548f , 9.50892258f , 6.63219738f , 3.98290706f , 2.99513650f , 0.72657228f , 0.40510508f , -0.37188929f , -0.42712122f , -0.44993770f , -0.85454285f , -2.16015244f , -2.33109641f , -3.77121162f , -4.37596750f , -5.36669207f , -5.62877464f , -7.46640444f , -6.83423185f , -7.70908165f , -7.39536428f , -11.27804089f , - 2.52714753f , 2.49289870f , -0.13784029f , -0.12163699f , 1.75517499f , 2.99553514f , 4.49444866f , 5.77764273f , 6.11328125f , 5.99628973f , 5.25506210f , 3.72307754f , 0.61337721f , -3.33252883f , -7.41996574f , -11.31843758f , -14.65295410f , -17.27932930f , -23.77917290f , -26.47192383f , -24.69055176f , -28.23755074f , -33.64114761f , -36.70846558f , - 0.26897269f , 0.29896018f , -0.59694219f , -0.58600718f , -0.59563857f , -0.14940611f , -0.22029303f , 0.11002608f , 0.09471268f , -0.08665721f , -0.04912328f , -0.19163008f , 0.17407294f , 0.29674888f , 0.32706621f , 0.06863109f , 0.22149041f , 0.41376126f , 0.17968638f , 0.12345629f , -1.91504288f , -1.83034718f , -1.79148746f , -2.04030466f , - 46.61645508f , 34.87612534f , 28.30528450f , 21.24158478f , 16.02840996f , 11.78007889f , 8.85846806f , 10.30448627f , 9.45803833f , 5.21806145f , 1.68192971f , -0.74372375f , -5.16118431f , -10.11946869f , -14.85457230f , -15.61676884f , -16.83375549f , -19.81565475f , -22.77931786f , -24.86022949f , -19.57012367f , -21.15659714f , -22.98768044f , -25.62114906f , - 33.50306320f , 20.94828606f , 11.29131508f , 3.76779723f , 1.88436973f , 2.24041677f , 3.07290483f , 3.88969660f , 4.82355642f , 4.29338741f , 2.81698418f , 1.50617039f , -0.22714122f , -2.44629383f , -5.18593407f , -7.46794319f , -9.20017433f , -10.38420296f , -11.62056923f , -13.33395100f , -12.78791428f , -12.68239403f , -12.26134491f , -11.07050896f , - 14.10636425f , 12.71654224f , 11.35340214f , 6.63278866f , 7.45038319f , 5.69565058f , 3.01491594f , 1.82628620f , 2.48782039f , 2.02510524f , 0.75415736f , -0.22476493f , -1.60228145f , -3.62377214f , -6.14920473f , -6.03494453f , -5.61935091f , -7.92571545f , -12.52105999f , -15.74191380f , -16.80817795f , -20.57492828f , -24.48945808f , -28.24258423f , - 0.19937749f , 0.12145615f , -0.77132010f , -0.71175891f , -0.93605912f , -0.31743777f , -0.29512858f , 0.09480342f , 0.14056028f , -0.12526789f , -0.09476471f , -0.30501965f , 0.25228870f , 0.52946067f , 0.56253082f , 0.14792542f , 0.34610838f , 0.49112254f , 0.26700655f , 0.18578406f , -0.02644314f , -0.05281431f , -0.03051598f , -0.05372978f , - 27.67247200f , 21.21397018f , 19.23110199f , 14.58107758f , 9.06582832f , 6.16479349f , 5.19902563f , 4.85638475f , 5.00597048f , 5.02013874f , 4.74315405f , 1.14152813f , -2.22816443f , -4.39935923f , -7.21801662f , -11.83607006f , -15.51521206f , -16.95382690f , -19.09778404f , -21.91887093f , -22.66965294f , -25.31122971f , -28.42613792f , -31.17256165f , - 11.87517643f , 8.35047531f , 6.28900909f , 4.94152260f , 3.84217644f , 2.98525238f , 2.59193397f , 1.77286649f , 1.13057005f , 0.57406390f , -0.14166087f , -0.61366737f , -1.26566494f , -1.89665902f , -2.40094352f , -3.00182557f , -3.57644248f , -4.17064571f , -4.82954073f , -6.52423048f , -6.40167952f , -7.34070396f , -8.16668510f , -8.83840561f , - 22.19146919f , 12.36240387f , 9.77023125f , 7.21114588f , 6.19833231f , 5.60523272f , 5.27842569f , 4.64398146f , 4.52219105f , 2.91414714f , 0.94011378f , 0.25184512f , -1.67108417f , -4.17819881f , -6.24735117f , -8.17109394f , -10.08654118f , -12.12491417f , -14.44429111f , -16.77396011f , -16.61188507f , -15.37945271f , -16.77342606f , -22.42259216f , - 24.26110077f , 14.98621845f , 11.37115288f , 7.53246927f , 5.87425423f , 4.31526375f , 3.63155198f , 2.21215534f , 1.20856023f , 0.27279723f , -0.83065307f , -1.13145101f , -1.61203635f , -2.64372611f , -3.19713020f , -3.79212451f , -4.30746126f , -5.19196177f , -6.05636358f , -7.64335585f , -7.13419104f , -7.34445190f , -7.59247351f , -8.24604034f , - 49.59980774f , 36.70146179f , 26.21045494f , 18.96593857f , 14.66215992f , 12.35246658f , 7.91571426f , 4.46859789f , 4.55067158f , 3.66973281f , -0.18894276f , -1.13036156f , -2.81119108f , -7.01159000f , -10.32988167f , -12.34438610f , -13.80298901f , -15.68917179f , -16.59648895f , -18.04370117f , -16.93032265f , -17.15782166f , -17.23012543f , -16.81400299f , - 26.24615288f , 16.32177734f , 12.63861752f , 8.90179348f , 7.98338699f , 5.88846350f , 5.62527227f , 3.35444164f , 2.27727008f , 0.38706595f , -1.15045261f , -1.47619927f , -2.39863658f , -3.88151002f , -5.00069237f , -5.60923672f , -5.99917269f , -7.16092062f , -7.55632973f , -8.88112926f , -7.98447180f , -7.57788992f , -7.00798178f , -6.71480894f , - 34.06352615f , 26.54057884f , 17.68980789f , 12.03931808f , 10.71124458f , 6.47080278f , 4.33683681f , 3.58446765f , 0.97453946f , 0.07721954f , -0.66921860f , -1.29634130f , -1.56973386f , -3.47828341f , -5.09566927f , -5.83764601f , -8.20822048f , -10.21011162f , -11.12835598f , -12.94603825f , -13.56561852f , -18.43250847f , -19.20955467f , -19.59786224f , - 0.95227748f , 0.58713847f , 0.31188840f , 0.27555063f , 0.34262455f , 0.30559424f , 0.15511483f , 0.24209952f , -0.01565590f , 0.27935538f , -0.07689041f , 0.16362046f , -0.12529252f , -0.41308093f , -0.45669210f , -0.33647329f , -0.06432384f , -0.04425672f , -0.05423176f , -0.09260799f , 1.18880558f , 1.71499527f , 1.66458070f , 1.84440422f , - 40.51910782f , 28.87430191f , 26.44847679f , 22.61171722f , 14.58166790f , 10.04493809f , 8.90122890f , 6.69188166f , 4.74618101f , 1.55060208f , 0.26953381f , -0.23009424f , -3.10289311f , -7.76883173f , -9.03342628f , -11.38734531f , -15.26344204f , -20.89108467f , -23.61590576f , -24.70707703f , -24.72460747f , -25.31776428f , -25.42388153f , -25.48863602f , - 21.86741066f , 19.33110237f , 16.09799957f , 12.12207603f , 7.65350389f , 5.31046820f , 4.50258398f , 3.46295428f , 1.98402655f , 0.36231637f , -0.75526041f , -2.47129464f , -1.34295225f , -2.90498233f , -4.77146578f , -5.83896399f , -5.19093323f , -5.94871426f , -6.67448521f , -9.30622387f , -10.69075203f , -13.05691051f , -14.45488358f , -18.82699394f , - 17.39302254f , 10.72895432f , 7.20909882f , 6.08006477f , 5.16837120f , 5.15259743f , 5.89495230f , 6.39498520f , 6.43017626f , 4.73164368f , 2.29907250f , 0.83655185f , -1.61507225f , -4.66745806f , -6.97347021f , -10.42446899f , -13.22788048f , -15.54260540f , -18.53327751f , -21.36825371f , -21.31904602f , -21.81181335f , -22.37908173f , -22.59859848f , - -0.01662111f , -0.25115231f , -0.21056390f , -0.29628995f , 0.14847504f , 0.01114315f , -0.00287740f , -0.02265828f , 0.20096491f , 0.01801417f , 0.01865144f , 0.08115936f , 0.06854093f , 0.03268814f , -0.06264148f , -0.19867666f , -0.29278329f , -0.48747075f , -0.51964116f , -0.52115518f , -0.62580901f , -0.67440128f , -0.64710861f , -0.70800090f , - 50.63159180f , 32.35544586f , 28.22938156f , 26.12494469f , 19.17036057f , 15.54605675f , 10.90270996f , 5.06216860f , 2.83115578f , 0.26169294f , -2.59751272f , -2.23182607f , -6.02089071f , -9.04337597f , -9.29519939f , -11.44281673f , -13.14252472f , -13.87999630f , -14.00658417f , -14.13973713f , -14.08796120f , -28.49422073f , -28.55380249f , -28.66899681f , - 32.93387222f , 21.26923561f , 12.45925331f , 7.33453608f , 4.77903414f , 2.72644329f , 2.77173924f , 3.24125862f , 4.11953831f , 3.23369288f , 1.40657330f , 0.18600486f , -0.99559313f , -2.52648664f , -4.61264372f , -6.59295559f , -7.73660517f , -8.74180222f , -9.62380314f , -10.94507694f , -10.15025043f , -10.08863640f , -9.69090939f , -8.64610767f , - 19.57560349f , 16.97666168f , 15.32033443f , 9.42695236f , 10.81062126f , 9.27347946f , 6.17076063f , 3.87660646f , 4.01463747f , 2.81778264f , -0.01208094f , -1.53821909f , -3.11120200f , -6.04038715f , -9.02472019f , -8.91995525f , -8.31732368f , -9.97514439f , -13.60401344f , -16.95523643f , -16.28038406f , -19.30029488f , -21.93006134f , -25.31139183f , - -0.42336991f , -0.69359350f , -0.79506743f , -0.19419681f , -0.43531519f , -0.60549897f , -0.57378924f , -0.71198583f , -0.67573565f , -0.92463225f , -0.75932795f , -0.88697869f , -0.09116954f , 0.78057998f , 1.43234348f , 2.25282049f , 1.19868934f , 0.34737879f , 0.56014186f , 0.85799438f , 3.28324819f , 3.73368144f , 2.45774937f , 1.97252631f , - 34.38531113f , 33.28102493f , 22.44291687f , 21.71539307f , 14.89051437f , 12.06779766f , 11.31605339f , 6.32059956f , 6.47309685f , 2.75739145f , -0.72276920f , -4.60511971f , -2.12165952f , -3.55129719f , -10.11487579f , -14.52775002f , -18.18198204f , -20.44789314f , -21.58519745f , -22.53190994f , -22.04618073f , -22.58295822f , -22.41326904f , -22.20569420f , - 28.00102234f , 14.65698147f , 10.06700230f , 6.12028360f , 4.52054358f , 2.66990614f , 2.51413369f , 1.24868000f , 1.04878569f , 0.22633910f , -1.12691772f , -1.15263200f , -0.74640560f , -1.10290110f , -2.06341290f , -2.48550367f , -3.55061507f , -4.52637577f , -6.00973654f , -8.38346672f , -7.37356853f , -8.63987446f , -9.06530762f , -8.95927715f , - 9.00067616f , 10.26587391f , 11.45584679f , 11.44188595f , 10.68400574f , 8.38729477f , 5.69343138f , 1.98902297f , 0.07958379f , -0.50896430f , -0.83697474f , -1.44278872f , -2.87292027f , -4.73982143f , -4.71389008f , -5.85515070f , -5.86282825f , -7.65532827f , -9.99789906f , -11.01864147f , -10.61325741f , -9.58348751f , -12.15856743f , -21.34374619f , - 21.37445641f , 22.85872078f , 20.62342262f , 13.71718597f , 8.38479900f , 4.66404533f , 2.74082160f , 0.35184097f , -0.49886125f , -0.66627383f , -0.80947453f , -1.35072243f , -1.72979438f , -2.81121135f , -2.55301118f , -3.12950158f , -2.59265637f , -3.53384900f , -4.62459230f , -8.21864986f , -9.64109135f , -9.61122894f , -11.18858528f , -17.21859741f , - 52.95914078f , 32.75603485f , 30.16634941f , 25.88944244f , 19.02377129f , 16.02350807f , 11.37754154f , 4.71347761f , 3.22399068f , 0.38588712f , -2.36943150f , -3.03161478f , -6.27093697f , -9.42517185f , -9.90064812f , -11.53384590f , -12.21652794f , -12.39763260f , -12.44114876f , -12.50287819f , -12.35077858f , -12.41636753f , -12.45803928f , -12.50715065f , - 28.04634666f , 16.86526871f , 13.82318878f , 9.40035915f , 8.49054623f , 4.69572687f , 4.31990623f , 2.24289536f , 1.52588129f , -0.15709598f , -1.59520829f , -0.06550518f , -1.94989491f , -3.66548038f , -4.27683449f , -4.56677961f , -4.99815702f , -5.49210978f , -5.61179161f , -6.72458935f , -5.75457907f , -5.41288614f , -5.03387022f , -3.80432510f , - 25.75157547f , 17.28746796f , 13.10127354f , 10.33002377f , 8.27671814f , 6.59895802f , 5.40835238f , 3.63577080f , 2.23206282f , 1.08383977f , -0.28453460f , -1.38477814f , -2.64369345f , -3.91356444f , -5.05506754f , -6.35320854f , -7.60085487f , -8.91501999f , -10.29950809f , -12.61900711f , -13.07838917f , -14.44057560f , -15.59240627f , -16.55293274f , - 24.60115242f , 11.35327435f , 6.30881643f , 4.50763512f , 0.50214702f , -0.71103203f , 2.54261613f , -0.67276359f , -1.09342635f , 1.93361044f , 1.37798584f , 1.15170944f , 1.77881491f , -0.16942300f , -3.11068201f , -2.93669724f , -0.59286201f , 1.04607284f , 4.16106987f , 6.48291349f , 11.32464409f , 15.29464436f , 15.33285236f , 7.41661787f , +/* IDCT_MATRIX_ROM: 18*24 Word16 = 432 Word16 */ +/* or compressed IDCT_MATRIX_ROM: 18*24 Word8 + 25 = 230 Word16 + WMOPS (INDIRECT(432) and STORE(432) ) */ + +/* Stage1 Word8 tables 16x8+ 17*10+ 17*16 + 78*18 = = 1974 Word8 -> 987 Word16 */ + +/* ROM storeSizeW8 = W8reduction (3072- (987+230) )/3072 = 1207/3072 --> 39.3 % */ +/* ROM with DCTII-24 in PROM = W8reduction (3072- (987) )/3072 = /3072 --> 31.8 % */ + +/* additional minor Table ROM ( dct_mid points 18 Word16, dct_col_upshifts 52, scaleFactors 2*2 = ~= 74 Word16s */ + + +const Word16 cdk1_ivas_entries_per_segment[FDCNG_VQ_DCT_NSEGM] = { 16, 17, 17, 78 }; +const Word16 cdk1_ivas_cum_entries_per_segment[FDCNG_VQ_DCT_NSEGM + 1] = { 0, 16 ,33, 50, 128 }; +const Word16 /* DCT trunc_len */ cdk1_ivas_cols_per_segment[FDCNG_VQ_DCT_NSEGM] = { FDCNG_VQ_DCT_MINTRUNC, 10, 16, FDCNG_VQ_DCT_MAXTRUNC }; /* 8, 10, 16, 18 */ +const Word16 /* segment inner DCT trunc_len */ cdk1_ivas_trunc_dct_cols_per_segment[FDCNG_VQ_DCT_NSEGM] = { FDCNG_VQ_DCT_MAXTRUNC - FDCNG_VQ_DCT_MINTRUNC, FDCNG_VQ_DCT_MAXTRUNC - 10 , FDCNG_VQ_DCT_MAXTRUNC - 16 , 0 }; + +/* to get back to FDCNG VQ domain for segment S use : idct as follows */ +/* cdk1r_vec[col, row] = cdk1r_tr_midQ_truncQ(col 1:24 ) + invScaleFQ * idctMat( cdk1_ivas_dct_sS_W8[1:col]<tcx_mdct_window_length; - *left_win = hTcxCfg->tcx_mdct_window; - } - else - { - *left_overlap = hTcxCfg->tcx_mdct_window_length; - *left_win = hTcxCfg->tcx_aldo_window_1_trunc; - } + *left_overlap = hTcxCfg->tcx_mdct_window_length; + *left_win = hTcxCfg->tcx_aldo_window_1_trunc; } else { @@ -121,16 +106,8 @@ void tcx_get_windows( } else if ( right_mode == FULL_OVERLAP ) { - if ( isLfe ) - { - *right_overlap = hTcxCfg->tcx_mdct_window_length; - *right_win = hTcxCfg->tcx_mdct_window; - } - else - { - *right_overlap = hTcxCfg->tcx_mdct_window_delay; - *right_win = hTcxCfg->tcx_aldo_window_2; - } + *right_overlap = hTcxCfg->tcx_mdct_window_delay; + *right_win = hTcxCfg->tcx_aldo_window_2; } else { @@ -164,16 +141,8 @@ void tcx_get_windows( } else if ( left_mode == FULL_OVERLAP ) { - if ( isLfe ) - { - *left_overlap = hTcxCfg->tcx_mdct_window_lengthFB; - *left_win = hTcxCfg->tcx_mdct_windowFB; - } - else - { - *left_overlap = hTcxCfg->tcx_mdct_window_lengthFB; - *left_win = hTcxCfg->tcx_aldo_window_1_FB_trunc; - } + *left_overlap = hTcxCfg->tcx_mdct_window_lengthFB; + *left_win = hTcxCfg->tcx_aldo_window_1_FB_trunc; } else { @@ -199,16 +168,8 @@ void tcx_get_windows( } else if ( right_mode == FULL_OVERLAP ) { - if ( isLfe ) - { - *right_overlap = hTcxCfg->tcx_mdct_window_lengthFB; - *right_win = hTcxCfg->tcx_mdct_windowFB; - } - else - { - *right_overlap = hTcxCfg->tcx_mdct_window_delayFB; - *right_win = hTcxCfg->tcx_aldo_window_2_FB; - } + *right_overlap = hTcxCfg->tcx_mdct_window_delayFB; + *right_win = hTcxCfg->tcx_aldo_window_2_FB; } else { @@ -276,8 +237,7 @@ void WindowSignal( int16_t *L_frame, /* i/o: frame length */ float out[], /* o : output windowed signal */ const int16_t truncate_aldo, /* i : nonzero to truncate long ALDO slope */ - const int16_t fullband, /* i : fullband flag */ - const int16_t isLfe /* i : LFE flag */ + const int16_t fullband /* i : fullband flag */ ) { int16_t l, r; @@ -288,7 +248,7 @@ void WindowSignal( * Init * *-----------------------------------------------------------*/ - tcx_get_windows( hTcxCfg, left_overlap_mode, right_overlap_mode, &l, &left_win, &r, &right_win, fullband, isLfe ); + tcx_get_windows( hTcxCfg, left_overlap_mode, right_overlap_mode, &l, &left_win, &r, &right_win, fullband ); /* Init lengths */ @@ -314,7 +274,7 @@ void WindowSignal( tcx_windowing_analysis( in - l / 2 + offset, *L_frame, l, left_win, r, right_win, out ); - if ( left_overlap_mode == FULL_OVERLAP && truncate_aldo && !isLfe ) + if ( left_overlap_mode == FULL_OVERLAP && truncate_aldo ) { /* fade truncated ALDO window to avoid discontinuities */ if ( !fullband ) diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 881d7845cacfc257f4aff3225a8c129a81f0f9ca..20e679c3167406981d5131f6f325e9defa87e545 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -287,67 +287,67 @@ static int16_t DecodeUsingTable( Decoder_State *st, int16_t *pValue, const Codin /* TNS filter coefficients */ -void const *GetTnsFilterCoeff( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsFilterCoeff( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (int16_t const *) p )[index] + INDEX_SHIFT; return NULL; } -void *SetTnsFilterCoeff( void *p, int16_t index, int16_t value ) +void *SetTnsFilterCoeff( void *p, const int16_t index, const int16_t value ) { ( (int16_t *) p )[index] = value - INDEX_SHIFT; return NULL; } -int16_t GetSWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index ) +int16_t GetSWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return GetBitsFromTable( value, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes ); } -int16_t EncodeSWBTCX20TnsFilterCoeff( int16_t value, int16_t index ) +int16_t EncodeSWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return EncodeUsingTable( value, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes ); } -int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeSWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return DecodeUsingTable( st, pValue, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes ); } -int16_t GetSWBTCX10TnsFilterCoeffBits( int16_t value, int16_t index ) +int16_t GetSWBTCX10TnsFilterCoeffBits( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return GetBitsFromTable( value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes ); } -int16_t EncodeSWBTCX10TnsFilterCoeff( int16_t value, int16_t index ) +int16_t EncodeSWBTCX10TnsFilterCoeff( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return EncodeUsingTable( value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes ); } -int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeSWBTCX10TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return DecodeUsingTable( st, pValue, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes ); } -int16_t GetWBTCX20TnsFilterCoeffBits( int16_t value, int16_t index ) +int16_t GetWBTCX20TnsFilterCoeffBits( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return GetBitsFromTable( value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes ); } -int16_t EncodeWBTCX20TnsFilterCoeff( int16_t value, int16_t index ) +int16_t EncodeWBTCX20TnsFilterCoeff( const int16_t value, const int16_t index ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return EncodeUsingTable( value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes ); } -int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, const int16_t index, int16_t *pValue ) { assert( ( index >= 0 ) && ( index < nTnsCoeffTables ) ); return DecodeUsingTable( st, pValue, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes ); @@ -356,67 +356,67 @@ int16_t DecodeWBTCX20TnsFilterCoeff( Decoder_State *st, int16_t index, int16_t * /* TNS filter order */ -void const *GetTnsFilterOrder( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsFilterOrder( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (STnsFilter const *) p )[index].order; return ( (STnsFilter const *) p )[index].coefIndex; } -void *SetTnsFilterOrder( void *p, int16_t index, int16_t value ) +void *SetTnsFilterOrder( void *p, const int16_t index, const int16_t value ) { ( (STnsFilter *) p )[index].order = value; return ( (STnsFilter *) p )[index].coefIndex; } -int16_t GetTnsFilterOrderBitsSWBTCX20( int16_t value, int16_t index ) +int16_t GetTnsFilterOrderBitsSWBTCX20( const int16_t value, const int16_t index ) { (void) index; return GetBitsFromTable( value - 1, codesTnsOrderTCX20, nTnsOrderCodes ); } -int16_t EncodeTnsFilterOrderSWBTCX20( int16_t value, int16_t index ) +int16_t EncodeTnsFilterOrderSWBTCX20( const int16_t value, const int16_t index ) { (void) index; return EncodeUsingTable( value - 1, codesTnsOrderTCX20, nTnsOrderCodes ); } -int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeTnsFilterOrderSWBTCX20( Decoder_State *st, const int16_t index, int16_t *pValue ) { (void) index; return DecodeUsingTable( st, pValue, codesTnsOrderTCX20, nTnsOrderCodes ); } -int16_t GetTnsFilterOrderBitsSWBTCX10( int16_t value, int16_t index ) +int16_t GetTnsFilterOrderBitsSWBTCX10( const int16_t value, const int16_t index ) { (void) index; return GetBitsFromTable( value - 1, codesTnsOrderTCX10, nTnsOrderCodes ); } -int16_t EncodeTnsFilterOrderSWBTCX10( int16_t value, int16_t index ) +int16_t EncodeTnsFilterOrderSWBTCX10( const int16_t value, const int16_t index ) { (void) index; return EncodeUsingTable( value - 1, codesTnsOrderTCX10, nTnsOrderCodes ); } -int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeTnsFilterOrderSWBTCX10( Decoder_State *st, const int16_t index, int16_t *pValue ) { (void) index; return DecodeUsingTable( st, pValue, codesTnsOrderTCX10, nTnsOrderCodes ); } -int16_t GetTnsFilterOrderBits( int16_t value, int16_t index ) +int16_t GetTnsFilterOrderBits( const int16_t value, const int16_t index ) { (void) index; return GetBitsFromTable( value - 1, codesTnsOrder, nTnsOrderCodes ); } -int16_t EncodeTnsFilterOrder( int16_t value, int16_t index ) +int16_t EncodeTnsFilterOrder( const int16_t value, const int16_t index ) { (void) index; return EncodeUsingTable( value - 1, codesTnsOrder, nTnsOrderCodes ); } -int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue ) +int16_t DecodeTnsFilterOrder( Decoder_State *st, const int16_t index, int16_t *pValue ) { (void) index; return DecodeUsingTable( st, pValue, codesTnsOrder, nTnsOrderCodes ); @@ -424,13 +424,13 @@ int16_t DecodeTnsFilterOrder( Decoder_State *st, int16_t index, int16_t *pValue /* Number of TNS filters */ -void const *GetNumOfTnsFilters( void const *p, int16_t index, int16_t *pValue ) +void const *GetNumOfTnsFilters( void const *p, const int16_t index, int16_t *pValue ) { *pValue = (int16_t) abs( ( (STnsData const *) p )[index].nFilters ); return ( (STnsData const *) p )[index].filter; } -void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value ) +void *SetNumOfTnsFilters( void *p, const int16_t index, const int16_t value ) { ( (STnsData *) p )[index].nFilters = (int16_t) abs( value ); return ( (STnsData *) p )[index].filter; @@ -438,13 +438,13 @@ void *SetNumOfTnsFilters( void *p, int16_t index, int16_t value ) /* TNS enabled/disabled flag */ -void const *GetTnsEnabled( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsEnabled( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (STnsData const *) p )[index].nFilters != 0 ? 1 : 0; return NULL; } -void *SetTnsEnabled( void *p, int16_t index, int16_t value ) +void *SetTnsEnabled( void *p, const int16_t index, const int16_t value ) { (void) p, (void) index, (void) value; return NULL; @@ -452,25 +452,25 @@ void *SetTnsEnabled( void *p, int16_t index, int16_t value ) /* TNS on whitened spectra flag */ -void const *GetTnsOnWhite( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (STnsData const *) p )[index].tnsOnWhitenedSpectra > 0 ? 1 : 0; return NULL; } -void *SetTnsOnWhite( void *p, int16_t index, int16_t value ) +void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ) { ( (STnsData *) p )[index].tnsOnWhitenedSpectra = value; return NULL; } -void const *GetTnsEnabledSingleFilter( void const *p, int16_t index, int16_t *pValue ) +void const *GetTnsEnabledSingleFilter( void const *p, const int16_t index, int16_t *pValue ) { *pValue = ( (STnsData const *) p )[index].nFilters != 0 ? 1 : 0; return ( (STnsData const *) p )[index].filter; } -void *SetTnsEnabledSingleFilter( void *p, int16_t index, int16_t value ) +void *SetTnsEnabledSingleFilter( void *p, const int16_t index, const int16_t value ) { ( (STnsData *) p )[index].nFilters = value; return ( (STnsData *) p )[index].filter; diff --git a/lib_com/tools.c b/lib_com/tools.c index db7c5a3f8e7a82c0653b81c6ba08031b6abf47a9..b730564580e892b85eee18f9a391e4540e3ac555 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -210,7 +210,11 @@ float sum2_f( void set_c( int8_t y[], /* i/o: Vector to set */ const int8_t a, /* i : Value to set the vector to */ +#ifdef JBM_TSM_ON_TCS + const int32_t N /* i : Length of the vector */ +#else const int16_t N /* i : Length of the vector */ +#endif ) { int16_t i; @@ -387,7 +391,11 @@ uint32_t mvr2s( return 0; } +#ifdef JBM_TSM_ON_TCS + if ( (void *) y <= (const void *) x ) +#else if ( (void *) y < (const void *) x ) +#endif { for ( i = 0; i < n; i++ ) { @@ -553,6 +561,9 @@ int16_t maximum_s( { if ( vec[i] > tmp ) { +#ifdef FIX_427_MAXIMUM_S_INDEX + ind = i; +#endif tmp = vec[i]; } } diff --git a/lib_com/wi.c b/lib_com/wi.c index 7710f75789516faae113d2ffaa8b69cda4e42a83..7ec30010fe0365b2eb6a84cc8a295790afd98ca8 100644 --- a/lib_com/wi.c +++ b/lib_com/wi.c @@ -73,9 +73,7 @@ ivas_error DTFS_new( int16_t i; DTFS_STRUCTURE *dtfs = NULL; - dtfs = (DTFS_STRUCTURE *) malloc( sizeof( DTFS_STRUCTURE ) ); - - if ( dtfs == NULL ) + if ( ( dtfs = (DTFS_STRUCTURE *) malloc( sizeof( DTFS_STRUCTURE ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTFS (SC-VBR) structure\n" ) ); } diff --git a/lib_debug/debug.c b/lib_debug/debug.c index ed22f3f65108eff68807e1bc1e386a9e8c57c656..ce10231876d27e76b141333f2fa70423abb4430e 100644 --- a/lib_debug/debug.c +++ b/lib_debug/debug.c @@ -36,7 +36,6 @@ #include #include #include "options.h" -#include "prot.h" #ifdef DEBUGGING #include "debug.h" #ifdef DEBUG_MODE_INFO @@ -46,6 +45,7 @@ #endif #endif #endif +#include "cnst.h" #include #include #include @@ -201,6 +201,7 @@ int16_t dbgwrite( return 0; } + /*-------------------------------------------------------------------* * dbgwrite_mat_repeat() * diff --git a/lib_debug/sba_debug.c b/lib_debug/sba_debug.c index cce06a0423d803a93202837d57eca5f83b834c04..73bb630b5fe54dee3600127f19cf5882c425bdbc 100644 --- a/lib_debug/sba_debug.c +++ b/lib_debug/sba_debug.c @@ -37,7 +37,6 @@ #include #include "options.h" #include "ivas_cnst.h" -#include "prot.h" #include "sba_debug.h" #include #include "wmc_auto.h" @@ -52,11 +51,11 @@ #define MAX_IN_FILE_LEN ( 1000 ) #define MAX_PLUG_IN_FILE_LEN ( MAX_IN_FILE_LEN ) #define MAX_DEBUG_TAG_LEN ( 50 ) -#define NUM_DEBUG_FILES ( 4 ) +#define NUM_DEBUG_FILES ( 5 ) #define MAX_TAG_LEN ( 200 ) WAVEFILEOUT *spar_foa_enc_wav[3]; -WAVEFILEOUT *spar_foa_dec_wav[4]; +WAVEFILEOUT *spar_foa_dec_wav[NUM_DEBUG_FILES]; float max_diff = 0; int32_t dbg_frm_num; int32_t dbg_band; @@ -203,6 +202,7 @@ void ivas_spar_dump_signal_wav( { for ( i = 0; i < no_channel; i++, k++ ) { +#if 0 if ( ppPcm ) { tmp_value = roundf( ppPcm[i][j] * PCM16_TO_FLT_FAC ); @@ -211,6 +211,16 @@ void ivas_spar_dump_signal_wav( { tmp_value = roundf( pcm_array[i][j] * PCM16_TO_FLT_FAC ); } +#else + if ( ppPcm ) + { + tmp_value = roundf( ppPcm[i][j] ); + } + else + { + tmp_value = roundf( pcm_array[i][j] ); + } +#endif if ( tmp_value > MAX16B_FLT ) { largest_value = (float) fabs( tmp_value ) > largest_value ? (float) fabs( tmp_value ) : largest_value; @@ -273,6 +283,12 @@ void ivas_close_sba_decoder_debug_files( CloseWav( spar_foa_dec_wav[3] ); } + if ( spar_foa_dec_wav[4] != NULL ) + { + UpdateWave( fs, n_ch, 16, spar_foa_dec_wav[4] ); + CloseWav( spar_foa_dec_wav[4] ); + } + return; } @@ -316,7 +332,7 @@ void ivas_open_sba_decoder_debug_files( const int16_t n_ch, const int16_t n_transport ) { - int8_t fb_wav_dump_path[4][MAX_PLUG_IN_FILE_LEN] = { "", "", "", "" }; + int8_t fb_wav_dump_path[NUM_DEBUG_FILES][MAX_PLUG_IN_FILE_LEN] = { "", "", "", "", "" }; cstrcat( (char *) fb_wav_dump_path[0], sizeof( fb_wav_dump_path[0] ), "dec_out.wav" ); spar_foa_dec_wav[0] = CreateWav( (const char *) fb_wav_dump_path[0], fs, n_ch, 32 /* const uint32_t writeWaveExt */ ); @@ -330,6 +346,9 @@ void ivas_open_sba_decoder_debug_files( cstrcat( (char *) fb_wav_dump_path[3], sizeof( fb_wav_dump_path[3] ), "cldfbSynthesis.wav" ); spar_foa_dec_wav[3] = CreateWav( (const char *) fb_wav_dump_path[3], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + cstrcat( (char *) fb_wav_dump_path[4], sizeof( fb_wav_dump_path[4] ), "cldfbAnalysis.wav" ); + spar_foa_dec_wav[4] = CreateWav( (const char *) fb_wav_dump_path[4], fs, n_transport, 16 /* const uint32_t writeWaveExt */ ); + return; } diff --git a/lib_debug/sba_debug.h b/lib_debug/sba_debug.h index cd4fd58c11a22f39e99b8d73a6c6dd12ce7212d1..a314d1568cc2df74be82d26610a30b00e78b6866 100644 --- a/lib_debug/sba_debug.h +++ b/lib_debug/sba_debug.h @@ -41,9 +41,10 @@ #include "ivas_cnst.h" #include "tinywaveout_c.h" + #ifdef DEBUG_SBA_AUDIO_DUMP extern WAVEFILEOUT *spar_foa_enc_wav[3]; -extern WAVEFILEOUT *spar_foa_dec_wav[4]; +extern WAVEFILEOUT *spar_foa_dec_wav[5]; #endif #ifdef DEBUG_AGC diff --git a/lib_debug/snr.c b/lib_debug/snr.c index b9d47864d1ffaf091893a91ddde19838a7628b96..f6e6fa9d5219bbb0d41e3394571bd770794bc97a 100644 --- a/lib_debug/snr.c +++ b/lib_debug/snr.c @@ -32,15 +32,15 @@ #include #include "options.h" -#include "rom_com.h" #ifdef DEBUGGING #include "debug.h" #endif #include #include +#include #include "wmc_auto.h" #include "cnst.h" -#include "prot.h" +#include "ivas_cnst.h" #ifdef DEBUGGING @@ -79,6 +79,150 @@ static float mem_deemph_y[MAX_INPUT_CHANNELS] = { 0 }; static float mem_synth_snr[MAX_INPUT_CHANNELS][M]; +/*-------------------------------------------------------------------* + * Local functions - they are copies of functions declared in prot.h but + here we do not want to include prot.h due to its dependencies + *--------------------------------------------------------------------*/ + +static void set_f( + float y[], /* i/o: Vector to set */ + const float a, /* i : Value to set the vector to */ + const int16_t N /* i : Lenght of the vector */ +) +{ + int16_t i; + + for ( i = 0; i < N; i++ ) + { + y[i] = a; + } + + return; +} + + +static float sum2_f( + const float *vec, /* i : input vector */ + const int16_t lvec /* i : length of input vector */ +) +{ + int16_t i; + float tmp; + + tmp = 0.0f; + for ( i = 0; i < lvec; i++ ) + { + tmp += vec[i] * vec[i]; + } + + return tmp; +} + + +static void mvr2r( + const float x[], /* i : input vector */ + float y[], /* o : output vector */ + const int16_t n /* i : vector size */ +) +{ + int16_t i; + + if ( n <= 0 ) + { + /* cannot transfer vectors with size 0 */ + return; + } + + if ( y < x ) + { + for ( i = 0; i < n; i++ ) + { + y[i] = x[i]; + } + } + else + { + for ( i = n - 1; i >= 0; i-- ) + { + y[i] = x[i]; + } + } + + return; +} + +static void residu( + const float *a, /* i : LP filter coefficients */ + const int16_t m, /* i : order of LP filter */ + const float *x, /* i : input signal (usually speech) */ + float *y, /* o : output signal (usually residual) */ + const int16_t l /* i : size of filtering */ +) +{ + float s; + int16_t i, j; + + for ( i = 0; i < l; i++ ) + { + s = x[i]; + for ( j = 1; j <= m; j++ ) + { + s += a[j] * x[i - j]; + } + y[i] = s; + } + + return; +} + +static void deemph( + float *signal, /* i/o: signal */ + const float mu, /* i : deemphasis factor */ + const int16_t L, /* i : vector size */ + float *mem /* i/o: memory (y[-1]) */ +) +{ + int16_t i; + + signal[0] = signal[0] + mu * ( *mem ); + for ( i = 1; i < L; i++ ) + { + signal[i] = signal[i] + mu * signal[i - 1]; + } + + *mem = signal[L - 1]; + + if ( ( *mem < 1e-10 ) & ( *mem > -1e-10 ) ) + { + *mem = 0; + } + + return; +} + +static void weight_a( + const float *a, /* i : LP filter coefficients */ + float *ap, /* o : weighted LP filter coefficients */ + const float gamma, /* i : weighting factor */ + const int16_t m /* i : order of LP filter */ +) +{ + float f; + int16_t i; + + ap[0] = a[0]; + f = gamma; + + for ( i = 1; i <= m; i++ ) + { + ap[i] = f * a[i]; + f *= gamma; + } + + return; +} + + /*-------------------------------------------------------------------* * snr() * @@ -252,7 +396,7 @@ void snr_celp( noise2 = sum2_f( &noise[i], L_subfr ) + 0.001f; if ( signal2 < noise2 ) signal2 = noise2; - subframe_snr = 10.0f * (float) log10( signal2 / noise2 ); + subframe_snr = 10.0f * log10f( signal2 / noise2 ); if ( L_frame == L_FRAME ) { diff --git a/lib_debug/wmc_auto.c b/lib_debug/wmc_auto.c index 6c71a6d37df2e1ac66dd499dabbce96235524251..029640a1dba8bce33cafd82907ef5bb5e5d5dabe 100644 --- a/lib_debug/wmc_auto.c +++ b/lib_debug/wmc_auto.c @@ -341,12 +341,6 @@ void update_wmops( void ) start_cnt = ops_cnt; - if ( heap_allocation_call_tree_size > 0 ) - { - /* update intra-frame heap memory and inter-frame heap memory*/ - update_mem(); - } - /* increment frame counter */ update_cnt++; @@ -387,7 +381,7 @@ void print_wmops( void ) } fprintf( stdout, sfmts, "---------------", "------", "------", "------", "------" ); - fprintf( stdout, dfmts, "total", (float) update_cnt, FAC * min_cnt, FAC * max_cnt, update_cnt == 0 ? 0 : FAC * ops_cnt / update_cnt ); + fprintf( stdout, dfmts, "total", (float) update_cnt, update_cnt == 0 ? 0 : FAC * min_cnt, FAC * max_cnt, update_cnt == 0 ? 0 : FAC * ops_cnt / update_cnt ); fprintf( stdout, "\n" ); #ifdef WMOPS_WC_FRAME_ANALYSIS @@ -554,6 +548,11 @@ void print_wmops( void ) #define ROUND_BLOCK_SIZE( n ) ( ( ( n ) + BLOCK_ROUNDING - 1 ) & ~( BLOCK_ROUNDING - 1 ) ) #define IS_CALLOC( str ) ( str[0] == 'c' ) +#ifdef MEM_COUNT_DETAILS +const char *csv_filename = "mem_analysis.csv"; +static FILE *fid_csv_filename = NULL; +#endif + typedef struct { char function_name[MAX_FUNCTION_NAME_LENGTH + 1]; @@ -688,6 +687,25 @@ void reset_mem( Counting_Size cnt_size ) size_wc_inter_frame_heap = 0; location_wc_inter_frame_heap = -1; +#ifdef MEM_COUNT_DETAILS + /* Check, if the .csv file has already been opened */ + if ( fid_csv_filename == NULL ) + { + fid_csv_filename = fopen( csv_filename, "wb" ); + + if ( fid_csv_filename == NULL ) + { + fprintf( stderr, "\nCannot open %s!\n\n", csv_filename ); + exit( -1 ); + } + } + else + { + /* reset file */ + rewind( fid_csv_filename ); + } +#endif + return; } @@ -960,6 +978,11 @@ void *mem_alloc( ptr_record->block_size = size; ptr_record->total_block_size += size; +#ifdef MEM_COUNT_DETAILS + /* Export heap memory allocation record to the .csv file */ + fprintf( fid_csv_filename, "A,%d,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size ); +#endif + if ( ptr_record->frame_allocated != -1 ) { fprintf( stderr, "Fct=%s, Ln=%i: %s!\n", func_name, func_lineno, "Error: Attempt to Allocate the Same Memory Block with Freeing it First!" ); @@ -1295,6 +1318,11 @@ void mem_free( const char *func_name, int func_lineno, void *ptr ) /* Check, if Out-Of-Bounds Access has been Detected */ ptr_record->OOB_Flag = mem_check_OOB( ptr_record ); +#ifdef MEM_COUNT_DETAILS + /* Export heap memory de-allocation record to the .csv file */ + fprintf( fid_csv_filename, "D,%d,%s,%d,%d\n", update_cnt, ptr_record->name, ptr_record->lineno, ptr_record->block_size ); +#endif + /* De-Allocate Memory Block */ tmp_ptr = (char *) ptr; tmp_ptr -= BLOCK_ROUNDING; @@ -1333,11 +1361,11 @@ void mem_free( const char *func_name, int func_lineno, void *ptr ) void update_mem( void ) { int i, j, flag_alloc = -1, i_record; - int32_t size_current_intra_frame_heap; + int size_current_intra_frame_heap; int *list_current_intra_frame_heap = NULL, n_items_current_intra_frame_heap; allocator_record *ptr_record; - /* process the heap allocation call tree */ + /* process the heap allocation call tree and prepare lists of intra-frame and inter-frame heap memory blocks for this frame */ n_items_current_intra_frame_heap = 0; size_current_intra_frame_heap = 0; for ( i = 0; i < heap_allocation_call_tree_size; i++ ) @@ -1365,7 +1393,7 @@ void update_mem( void ) memset( list_current_intra_frame_heap, -1, heap_allocation_call_tree_size * sizeof( int ) ); } - /* zero index doesn't have sign to determine whether it's allocated or de-allocated -> we need to search the list */ + /* zero index doesn't have sign to determine whether it's allocated or de-allocated -> we need to search the list */ if ( i_record == 0 ) { flag_alloc = 1; @@ -1385,23 +1413,7 @@ void update_mem( void ) list_current_intra_frame_heap[n_items_current_intra_frame_heap++] = i_record; size_current_intra_frame_heap += ptr_record->block_size; - /* check, if this is the new worst-case */ - if ( size_current_intra_frame_heap > size_wc_intra_frame_heap ) - { - if ( n_items_current_intra_frame_heap >= max_items_wc_intra_frame_heap ) - { - /* resize list, if needed */ - max_items_wc_intra_frame_heap = n_items_current_intra_frame_heap + MAX_NUM_RECORDS_REALLOC_STEP; - list_wc_intra_frame_heap = realloc( list_wc_intra_frame_heap, max_items_wc_intra_frame_heap * sizeof( int ) ); - } - - /* save to wc list */ - memmove( list_wc_intra_frame_heap, list_current_intra_frame_heap, n_items_current_intra_frame_heap * sizeof( int ) ); - n_items_wc_intra_frame_heap = n_items_current_intra_frame_heap; - size_wc_intra_frame_heap = size_current_intra_frame_heap; - location_wc_intra_frame_heap = update_cnt; - ptr_record->wc_heap_size_intra_frame = ptr_record->block_size; - } + /* no need to re-size the list -> the initially allocated size should be large enough */ } else { @@ -1452,23 +1464,6 @@ void update_mem( void ) list_current_inter_frame_heap[n_items_current_inter_frame_heap++] = i_record; size_current_inter_frame_heap += ptr_record->block_size; - - /* check, if this is the new worst-case */ - if ( size_current_inter_frame_heap > size_wc_inter_frame_heap ) - { - if ( n_items_current_inter_frame_heap >= max_items_wc_inter_frame_heap ) - { - /* resize list, if needed */ - max_items_wc_inter_frame_heap = n_items_current_inter_frame_heap + MAX_NUM_RECORDS_REALLOC_STEP; - list_wc_inter_frame_heap = realloc( list_wc_inter_frame_heap, max_items_wc_inter_frame_heap * sizeof( int ) ); - } - - memmove( list_wc_inter_frame_heap, list_current_inter_frame_heap, n_items_current_inter_frame_heap * sizeof( int ) ); - n_items_wc_inter_frame_heap = n_items_current_inter_frame_heap; - size_wc_inter_frame_heap = size_current_inter_frame_heap; - location_wc_inter_frame_heap = update_cnt; - ptr_record->wc_heap_size_inter_frame = ptr_record->block_size; - } } else { @@ -1491,9 +1486,60 @@ void update_mem( void ) } } + /* check, if this is the new worst-case for intra-frame heap memory */ + if ( size_current_intra_frame_heap > size_wc_intra_frame_heap ) + { + if ( n_items_current_intra_frame_heap >= max_items_wc_intra_frame_heap ) + { + /* resize the list, if needed */ + max_items_wc_intra_frame_heap = n_items_current_intra_frame_heap + MAX_NUM_RECORDS_REALLOC_STEP; + list_wc_intra_frame_heap = realloc( list_wc_intra_frame_heap, max_items_wc_intra_frame_heap * sizeof( int ) ); + } + + /* copy current-frame list to worst-case list */ + memmove( list_wc_intra_frame_heap, list_current_intra_frame_heap, n_items_current_intra_frame_heap * sizeof( int ) ); + n_items_wc_intra_frame_heap = n_items_current_intra_frame_heap; + size_wc_intra_frame_heap = size_current_intra_frame_heap; + location_wc_intra_frame_heap = update_cnt; + + /* update the wc numbers in all individual records */ + for ( i = 0; i < n_items_wc_intra_frame_heap; i++ ) + { + i_record = list_wc_intra_frame_heap[i]; + ptr_record = &( allocation_list[i_record] ); + ptr_record->wc_heap_size_intra_frame = ptr_record->block_size; + } + } + + /* check, if this is the new worst-case for inter-frame heap memory */ + if ( size_current_inter_frame_heap > size_wc_inter_frame_heap ) + { + if ( n_items_current_inter_frame_heap >= max_items_wc_inter_frame_heap ) + { + /* resize list, if needed */ + max_items_wc_inter_frame_heap = n_items_current_inter_frame_heap + MAX_NUM_RECORDS_REALLOC_STEP; + list_wc_inter_frame_heap = realloc( list_wc_inter_frame_heap, max_items_wc_inter_frame_heap * sizeof( int ) ); + } + + /* copy current-frame list to worst-case list */ + memmove( list_wc_inter_frame_heap, list_current_inter_frame_heap, n_items_current_inter_frame_heap * sizeof( int ) ); + n_items_wc_inter_frame_heap = n_items_current_inter_frame_heap; + size_wc_inter_frame_heap = size_current_inter_frame_heap; + location_wc_inter_frame_heap = update_cnt; + + /* update the wc numbers in all individual records */ + for ( i = 0; i < n_items_wc_inter_frame_heap; i++ ) + { + i_record = list_wc_inter_frame_heap[i]; + ptr_record = &( allocation_list[i_record] ); + ptr_record->wc_heap_size_inter_frame = ptr_record->block_size; + } + } + /* reset heap allocation call tree */ heap_allocation_call_tree_size = 0; + /* de-allocate list of intra-frame heap memory blocks in the current fraeme - it's needed only inside this function */ if ( list_current_intra_frame_heap ) { free( list_current_intra_frame_heap ); @@ -1608,7 +1654,7 @@ static void mem_count_summary( void ) if ( ptr_record->noccurances > 1 ) { - sprintf( size_str, "%dx%d %s", ptr_record->noccurances, (int) ( ( ptr_record->noccurances * ptr_record->wc_heap_size_intra_frame ) >> Stat_Cnt_Size ), Count_Unit[Stat_Cnt_Size] ); + sprintf( size_str, "%dx%d %s", ptr_record->noccurances, (int) ( ptr_record->wc_heap_size_intra_frame >> Stat_Cnt_Size ), Count_Unit[Stat_Cnt_Size] ); } else { @@ -1637,7 +1683,7 @@ static void mem_count_summary( void ) continue; } ptr_record = &( allocation_list[index_record] ); - ptr_record->noccurances = 1; /* reset the counter because som blocks may be both, intra-frame and inter-frame */ + ptr_record->noccurances = 1; /* reset the counter as some blocks may have been both, intra-frame and inter-frame */ for ( j = i + 1; j < n_items_wc_inter_frame_heap; j++ ) { index = list_wc_inter_frame_heap[j]; @@ -1656,7 +1702,7 @@ static void mem_count_summary( void ) } /* Print Header */ - sprintf( buf, format_str, "Function Name", "Line", "Type", "Function Parameters", "Maximum Size", "Usage" ); + sprintf( buf, format_str, "Function Name", "Line", "Type", "Function Parameters", "Memory Size", "Usage" ); puts( buf ); length = strlen( buf ); sprintf( buf, "%0*d\n", (int) length - 1, 0 ); @@ -1691,11 +1737,11 @@ static void mem_count_summary( void ) sprintf( line_str, "%d", ptr_record->lineno ); /* prepare average usage & memory size strings */ - sprintf( usage_str, "%d%%", (int) ( ( (float) ptr_record->total_used_size / ( ptr_record->total_block_size + 1 ) ) * 100.0f ) ); + sprintf( usage_str, "%d%%", (int) ( ( (float) ptr_record->total_used_size / ( ptr_record->total_block_size + 0.1f ) ) * 100.0f + 0.5f ) ); if ( ptr_record->noccurances > 1 ) { - sprintf( size_str, "%dx%d %s", ptr_record->noccurances, (int) ( ( ptr_record->noccurances * ptr_record->wc_heap_size_inter_frame ) >> Stat_Cnt_Size ), Count_Unit[Stat_Cnt_Size] ); + sprintf( size_str, "%dx%d %s", ptr_record->noccurances, (int) ( ptr_record->wc_heap_size_inter_frame >> Stat_Cnt_Size ), Count_Unit[Stat_Cnt_Size] ); } else { @@ -1713,45 +1759,6 @@ static void mem_count_summary( void ) return; } -/*-------------------------------------------------------------------* - * export_mem() - * - * Export detailed (per-item) information about heap memory usage to a .csv file - *--------------------------------------------------------------------*/ - -void export_mem( const char *csv_filename ) -{ - int i; - static FILE *fid = NULL; - allocator_record *record_ptr; - - if ( csv_filename == NULL || strcmp( csv_filename, "" ) == 0 ) - { - return; - } - - /* Check, if the .csv file has already been opened */ - if ( fid == NULL ) - { - fid = fopen( csv_filename, "wb" ); - - if ( fid == NULL ) - { - fprintf( stderr, "\nCannot open %s!\n\n", csv_filename ); - exit( -1 ); - } - } - - /* Export individual heap memory records to a .csv file */ - for ( i = 0; i < Num_Records; i++ ) - { - record_ptr = &( allocation_list[i] ); - fprintf( fid, "%s:%d,%d;", record_ptr->name, record_ptr->lineno, record_ptr->block_size ); - } - fprintf( fid, "\n" ); - - return; -} #endif /*-------------------------------------------------------------------* @@ -1902,6 +1909,13 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] ) free( list_wc_inter_frame_heap ); } +#ifdef MEM_COUNT_DETAILS + if ( fid_csv_filename != NULL ) + { + fclose( fid_csv_filename ); + } +#endif + return; } diff --git a/lib_debug/wmc_auto.h b/lib_debug/wmc_auto.h index 578be9b53239d9e031d424e4e7a8b00b03f69144..9e20a4c7c8162126ead7cf45fbc8aab5f506c435 100644 --- a/lib_debug/wmc_auto.h +++ b/lib_debug/wmc_auto.h @@ -1007,9 +1007,6 @@ void mem_free( const char *func_name, int func_lineno, void *ptr ); void reset_mem( Counting_Size cnt_size ); void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] ); -#ifdef MEM_COUNT_DETAILS -void export_mem( const char *csv_filename ); -#endif int push_stack( const char *filename, const char *fctname ); int pop_stack( const char *filename, const char *fctname ); @@ -1031,7 +1028,6 @@ void reset_stack( void ); #define free_( ptr ) free( ptr ) #define reset_mem( cnt_size ) #define print_mem( Const_Data_PROM_Table ) -#define export_mem( csv_filename ) #define push_stack( file, fct ) #define pop_stack( file, fct ) diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 7fcc65f6f76c205133836324497a888c918ac9ab..f7b7465028a3f9a29da82a35dd02fa27be3c8500 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -45,9 +45,7 @@ #include "prot.h" #include "ivas_cnst.h" #include "ivas_prot.h" -#ifdef LSF_RE_USE_SECONDARY_CHANNEL #include "ivas_rom_com.h" -#endif #include "wmc_auto.h" /*-------------------------------------------------------------------* @@ -77,6 +75,10 @@ ivas_error acelp_core_dec( const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ const int16_t nchan_out, /* i : number of output channels */ STEREO_CNG_DEC_HANDLE hStereoCng /* i : stereo CNG handle */ +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + , + const int16_t read_sid_info /* i : read SID info flag */ +#endif ) { float old_exc[L_EXC_DEC], *exc; /* excitation signal buffer */ @@ -512,7 +514,11 @@ ivas_error acelp_core_dec( } else { +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT if ( st->core_brate == SID_2k40 && st->element_mode != IVAS_CPE_MDCT ) +#else + if ( st->core_brate == SID_2k40 && st->element_mode != IVAS_CPE_MDCT && st->read_sid_info ) +#endif { FdCng_decodeSID( st ); *sid_bw = 0; @@ -529,6 +535,22 @@ ivas_error acelp_core_dec( ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); } +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + if ( !read_sid_info ) +#else + if ( !st->read_sid_info ) + // if (!st->read_sid_info && st->cng_ism_flag) /* read_sid_info can only be 0 in ParamISM mode */ +#endif + { + float noise_lvl_highest; + + noise_lvl_highest = st->hFdCngDec->hFdCngCom->cngNoiseLevel[st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand - 1]; + for ( int16_t b = st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand; b < st->hFdCngDec->hFdCngCom->stopBand; b++ ) + { + st->hFdCngDec->hFdCngCom->cngNoiseLevel[b] = noise_lvl_highest; + } + } + generate_comfort_noise_dec( NULL, NULL, st, nchan_out ); FdCng_exc( st->hFdCngDec->hFdCngCom, &st->CNG_mode, st->L_frame, st->lsp_old, st->first_CNG, st->lspCNG, Aq, lsp_new, lsf_new, exc, exc2, bwe_exc ); @@ -603,11 +625,11 @@ ivas_error acelp_core_dec( nb_bits = -1; } - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); + config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); if ( st->coder_type == TRANSITION && tc_subfr < L_SUBFR && st->L_frame == L_FRAME ) /* ISfm: why is this called again after above */ { - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); + config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); } } @@ -639,25 +661,25 @@ ivas_error acelp_core_dec( if ( !tdm_lp_reuse_flag ) { - lsf_dec( st, tc_subfr, Aq, &LSF_Q_prediction, lsf_new, lsp_new, lsp_mid, tdm_low_rate_mode -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , - tdm_lsfQ_PCh -#endif - ); + lsf_dec( st, tc_subfr, Aq, &LSF_Q_prediction, lsf_new, lsp_new, lsp_mid, tdm_low_rate_mode, tdm_lsfQ_PCh ); } else { const float *pt_interp_2; -#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE - int16_t beta_index[1]; - beta_index[0] = get_next_indice( st, TDM_IC_LSF_PRED_BITS ); - tdm_SCh_lsf_reuse( DEC, st->element_brate, lsf_new, lsp_new, tdm_lsfQ_PCh, NULL, beta_index ); -#else - mvr2r( tdm_lspQ_PCh, lsp_new, M ); - mvr2r( tdm_lsfQ_PCh, lsf_new, M ); -#endif + if ( st->active_cnt != 1 ) + { + int16_t beta_index; + + beta_index = get_next_indice( st, TDM_IC_LSF_PRED_BITS ); + tdm_SCh_lsf_reuse( DEC, st->element_brate, lsf_new, lsp_new, tdm_lsfQ_PCh, NULL, &beta_index ); + } + else + { + mvr2r( tdm_lspQ_PCh, lsp_new, M ); + mvr2r( tdm_lsfQ_PCh, lsf_new, M ); + } + if ( st->rate_switching_reset ) { /* extrapolation in case of unstable LSF convert */ @@ -1114,7 +1136,7 @@ ivas_error acelp_core_dec( st->lp_noise = st->hFdCngDec->lp_noise; } - if ( st->element_mode != IVAS_CPE_TD ) + if ( st->element_mode != IVAS_CPE_TD && !st->cng_ism_flag ) { /*Noise estimate*/ ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); @@ -1290,7 +1312,7 @@ ivas_error acelp_core_dec( /*WB/SWB-FD_CNG*/ if ( ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && ( st->cng_type == FD_CNG ) && ( st->hFdCngDec->hFdCngCom->numCoreBands < st->cldfbSyn->no_channels ) ) { - generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom ); + generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom, st->cng_ism_flag ); if ( st->hFdCngDec->hFdCngCom->regularStopBand < st->cldfbSyn->no_channels ) { diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index 6953551452220ee793e544469e2d4f379acb1228..51d459b205e980505dd12a2d5c87795b95244c8b 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -158,7 +158,7 @@ ivas_error acelp_core_switch_dec( * Excitation decoding *----------------------------------------------------------------*/ - config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, 0, 0, 0 /*st->GSC_IVAS_mode*/ ); + config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, st->active_cnt, 0, 0, 0 /*st->GSC_IVAS_mode*/ ); decod_gen_voic_core_switch( st, L_frame_for_cs, 0, Aq, exc, cbrate ); diff --git a/lib_dec/cng_dec.c b/lib_dec/cng_dec.c index b780db062f4d416a2fbcf2bde7dbb15b79bd18c4..64403736c43fae6a323f248a586792506f0bac99 100644 --- a/lib_dec/cng_dec.c +++ b/lib_dec/cng_dec.c @@ -109,12 +109,7 @@ void CNG_dec( } else { - lsf_dec( st, 0, Aq, &LSF_Q_prediction, lsf_new, lsp_new, 0, 0 -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , - NULL -#endif - ); + lsf_dec( st, 0, Aq, &LSF_Q_prediction, lsf_new, lsp_new, 0, 0, NULL ); } } else diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index ec673cd19c31c2921b689d3bd782a8e05efeca76..aa8f576cec3f5b277eaf4a1c8b980e6c96f0d167 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -190,7 +190,7 @@ void open_decoder_LPD( { if ( !is_init || st->element_mode != IVAS_CPE_MDCT ) { - init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag, st->mct_chan_mode ); + init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag ); } else { @@ -279,7 +279,7 @@ void open_decoder_LPD( st->last_core_bfi = ACELP_CORE; } - if ( st->element_mode != IVAS_CPE_DFT && st->last_codec_mode == MODE1 && st->last_core == ACELP_CORE ) + if ( ( ( st->element_mode != IVAS_CPE_DFT ) || ( st->element_mode == IVAS_CPE_DFT && st->prev_bfi ) ) && st->last_codec_mode == MODE1 && st->last_core == ACELP_CORE ) { /* Switching from Mode 1 ACELP */ st->last_core_bfi = ACELP_CORE; @@ -670,13 +670,12 @@ void open_decoder_LPD( st->last_tns_active = 0; st->second_last_tns_active = 0; st->second_last_core = -1; -#ifdef SET_TNS_FLAG_IN_EVERY_FRAME - /* TODO: also apply for MCT modes, once issue #24 is solved */ - if ( st->hTcxCfg != NULL && !MCT_flag && st->element_mode != EVS_MONO ) + + if ( st->hTcxCfg != NULL && + st->element_mode != EVS_MONO ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode ); } -#endif if ( hTcxDec != NULL ) { hTcxDec->tcxltp_second_last_pitch = st->old_fpitch; diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index a092255a38897557b1260d1cd9860907a810aa15..ef0a12696f448598703f5635ee0b0510f49cec17 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -91,7 +91,7 @@ void mode_switch_decoder_LPD( switchWB = 1; /*force init when coming from MODE1*/ } - st->igf = getIgfPresent( st->element_mode, total_brate, bwidth, st->rf_flag, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, total_brate, bwidth, st->rf_flag ); if ( st->hIGFDec != NULL ) { @@ -140,7 +140,7 @@ void mode_switch_decoder_LPD( if ( st->hTcxCfg != NULL ) { st->hTcxCfg->pCurrentTnsConfig = NULL; - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, st->igf, st->element_mode ); } if ( st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL ) diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 6ea717d07ea5543a3d8ef45b880bc8332c138d3b..9ae8550e40faf6e4db9ed51c99c883ae38eac6f4 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -51,7 +51,7 @@ *---------------------------------------------------------------------*/ static void core_switch_lb_upsamp( Decoder_State *st, float *output ); -static void smoothTransitionMdctStereoDtx( float synth[], const int16_t output_frame, const int16_t delay_comp ); +static void smoothTransitionDtxToTcx( float synth[], const int16_t output_frame, const int16_t delay_comp ); /*---------------------------------------------------------------------* * core_switching_pre_dec() @@ -556,6 +556,7 @@ ivas_error core_switching_post_dec( float *synth, /* i/o: output synthesis */ float *output, /* i/o: LB synth/upsampled LB synth */ float output_mem[], /* i : OLA memory from last TCX/HQ frame */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ const int16_t output_frame, /* i : frame length */ const int16_t core_switching_flag, /* i : ACELP->HQ switching flag */ @@ -677,10 +678,10 @@ ivas_error core_switching_post_dec( synth[i + delay_comp] = ( synth[i + delay_comp] * i + ( tmpDelta - i ) * st->previoussynth[i + delay_comp] ) / tmpDelta; } - if ( st->element_mode == IVAS_CPE_MDCT && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) + if ( ( st->element_mode == IVAS_CPE_MDCT || ( ivas_format == ISM_FORMAT && st->core == TCX_20_CORE /* <- means TCX in general, TCX10 is forbidden after ACELP */ ) ) && st->last_core_brate <= SID_2k40 && st->core_brate > SID_2k40 ) { /* smooth transitions to avoid pops in car noise items */ - smoothTransitionMdctStereoDtx( synth, output_frame, delay_comp ); + smoothTransitionDtxToTcx( synth, output_frame, delay_comp ); } /* Reset memories of CLDFBs */ @@ -1028,11 +1029,7 @@ void bandwidth_switching_detect( { st->bws_cnt1 = 0; } - else if ( st->total_brate > ACELP_9k60 && st->last_core_brate < ACELP_9k60 && st->bwidth == SWB && st->last_bwidth == WB -#ifdef FIX_299_ISM_BWS - && st->last_low_rate_mode == 0 -#endif - ) + else if ( st->total_brate > ACELP_9k60 && st->last_core_brate < ACELP_9k60 && st->bwidth == SWB && st->last_bwidth == WB && st->last_low_rate_mode == 0 ) { st->bws_cnt1++; } @@ -1249,16 +1246,16 @@ static void core_switch_lb_upsamp( } /*---------------------------------------------------------------------* - * smoothTransitionMdctStereoDtx() + * smoothTransitionDtxToTcx() * - * apply smoothing to the transition part for MDCT-Stereo DTX + * apply smoothing to the transition part for inactive to active transitions in DTX *---------------------------------------------------------------------*/ #define TRANSITION_SMOOTHING_LEN_16k 15 #define TRANSITION_SMOOTHING_LEN_32k 31 #define TRANSITION_SMOOTHING_LEN_48k 47 -static void smoothTransitionMdctStereoDtx( +static void smoothTransitionDtxToTcx( float synth[], /* i/o: synthesis */ const int16_t output_frame, /* i : output frame length */ const int16_t delay_comp /* i : delay compensation in samples */ diff --git a/lib_dec/d_gain2p.c b/lib_dec/d_gain2p.c index 246500d26ac95189ea7c34232e67ee59d1df3698..d2fe3e8757f6d0d2ed5443615b6318a80a2f8180 100644 --- a/lib_dec/d_gain2p.c +++ b/lib_dec/d_gain2p.c @@ -40,7 +40,6 @@ #include "debug.h" #endif #include -#include "typedef.h" #include "prot.h" #include "cnst.h" #include "rom_com.h" diff --git a/lib_dec/dec_acelp.c b/lib_dec/dec_acelp.c index ab2bebe69603aaeec160b277da744d45bb1a9e9b..615fa8eae1a0e14a0e2788a2cc61e897b3ca9178 100644 --- a/lib_dec/dec_acelp.c +++ b/lib_dec/dec_acelp.c @@ -37,7 +37,6 @@ #include #include #include "options.h" -#include "typedef.h" #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 9c8172589405790afab9bd795820260975bbb10b..9896d1d8c024016b4b074c4b25a73a8e5dbe503f 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -107,7 +107,8 @@ void decoder_tcx( decoder_tcx_tns( st, L_frame_glob, L_spec, L_frame, L_frameTCX, &x[0], fUseTns, &tnsData, bfi, frame_cnt, 0 ); decoder_tcx_imdct( st, L_frame_glob, L_frameTCX_glob, L_spec, tcx_offset, tcx_offsetFB, L_frame, L_frameTCX, left_rect, &x[0], &xn_buf[0], MDCT_IV, - fUseTns, &synth[0], &synthFB[0], bfi, frame_cnt, 0, sba_dirac_stereo_flag ); + fUseTns, &synth[0], &synthFB[0], bfi, frame_cnt, + sba_dirac_stereo_flag ); return; } @@ -335,7 +336,8 @@ void IMDCT( v_multc( old_syn_overl, hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph, old_syn_overl, overlap ); } - if ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 || st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && ( st->tcxonly ) ) + if ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && + ( st->tcxonly ) ) { /* Mode decision in PLC @@ -354,7 +356,6 @@ void IMDCT( if ( ( !bfi && hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) || ( bfi && ( hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP ) && ( hTcxCfg->tcx_curr_overlap_mode != FULL_OVERLAP ) ) ) { - assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); /* minimum or half overlap, two transforms, grouping into one window */ L_win = L_frame >> 1; L_ola = ( hTcxCfg->tcx_last_overlap_mode == MIN_OVERLAP ) ? tcx_mdct_window_min_length : tcx_mdct_window_half_length; @@ -392,7 +393,7 @@ void IMDCT( /* To assure that no garbage values are passed to overlap */ set_zero( xn_buf + L_frame + tcx_offset + ( L_ola >> 1 ), overlap - tcx_offset - ( L_ola >> 1 ) ); } - else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + else if ( !bfi && ( frame_cnt == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) ) { /* special overlap attempt, two transforms, grouping into one window */ @@ -553,7 +554,9 @@ void IMDCT( /* Window and overlap-add past frame if past frame is TCX */ if ( ( frame_cnt != 0 ) || ( st->last_core_bfi > ACELP_CORE ) ) { - if ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 || st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && ( st->tcxonly ) ) || ( hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ) + if ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && + ( st->tcxonly ) ) || + ( hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ) { if ( !bfi && ( frame_cnt > 0 ) && ( index == 0 ) && ( hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP ) && ( st->last_core != ACELP_CORE ) ) { @@ -616,7 +619,7 @@ void IMDCT( } } - if ( !aldo && ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && frame_cnt > 0 ) || L_frameTCX != ( hTcxDec->L_frameTCX >> 1 ) ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( !aldo && ( ( ( L_frameTCX == hTcxDec->L_frameTCX >> 1 ) && frame_cnt > 0 ) || L_frameTCX != ( hTcxDec->L_frameTCX >> 1 ) ) ) { /* Compute windowed synthesis in case of switching to ALDO windows in next frame */ mvr2r( xn_buf + L_frame - nz, old_out, nz + overlap ); @@ -1559,7 +1562,6 @@ void decoder_tcx_imdct( float synthFB[], const int16_t bfi, /* i : Bad frame indicator */ const int16_t frame_cnt, /* i : frame counter in the super frame */ - const int16_t isLFE, /* i : is LFE */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ) { @@ -1591,7 +1593,8 @@ void decoder_tcx_imdct( hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; } - if ( !isLFE && st->igf ) + if ( + st->igf ) { proc = st->hIGFDec->flatteningTrigger; @@ -1689,7 +1692,10 @@ void decoder_tcx_imdct( if ( st->element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag ) { - IMDCT( xn_bufFB, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_window : hTcxCfg->tcx_aldo_window_1_trunc, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_window : hTcxCfg->tcx_aldo_window_2, hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, + IMDCT( xn_bufFB, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf, + hTcxCfg->tcx_aldo_window_1_trunc, + hTcxCfg->tcx_aldo_window_2, + hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_outLB, 0, st, 0, acelp_zir ); } @@ -1709,7 +1715,9 @@ void decoder_tcx_imdct( if ( st->element_mode != EVS_MONO ) { - IMDCT( x_tmp, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_windowFB : hTcxCfg->tcx_aldo_window_1_FB_trunc, st->mct_chan_mode == MCT_CHAN_MODE_LFE ? hTcxCfg->tcx_mdct_windowFB : hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, + IMDCT( x_tmp, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB, + hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, + hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); } else diff --git a/lib_dec/dlpc_stoch.c b/lib_dec/dlpc_stoch.c index 1bbba46b1b2c9c18fcddd5a3eaf0123d95318d18..22a1cda26cef68a9207dd93e0a80742a8304283d 100644 --- a/lib_dec/dlpc_stoch.c +++ b/lib_dec/dlpc_stoch.c @@ -81,32 +81,17 @@ void lpc_unquantize( { if ( st->sr_core == INT_FS_16k && coder_type == UNVOICED ) { - lsf_end_dec( st, GENERIC, 1 - st->narrowBand /* st->bwidth */, ENDLSF_NBITS, &lsf[M], param_lpc, LSF_Q_prediction, &nb_indices -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , - NULL -#endif - ); + lsf_end_dec( st, GENERIC, 1 - st->narrowBand /* st->bwidth */, ENDLSF_NBITS, &lsf[M], param_lpc, LSF_Q_prediction, &nb_indices, NULL ); } else { if ( st->core == TCX_20_CORE ) { - lsf_end_dec( st, AUDIO, 1 - st->narrowBand /* st->bwidth */, ENDLSF_NBITS, &lsf[M], param_lpc, LSF_Q_prediction, &nb_indices -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , - NULL -#endif - ); + lsf_end_dec( st, AUDIO, 1 - st->narrowBand /* st->bwidth */, ENDLSF_NBITS, &lsf[M], param_lpc, LSF_Q_prediction, &nb_indices, NULL ); } else { - lsf_end_dec( st, coder_type, 1 - st->narrowBand /* st->bwidth */, ENDLSF_NBITS, &lsf[M], param_lpc, LSF_Q_prediction, &nb_indices -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , - NULL -#endif - ); + lsf_end_dec( st, coder_type, 1 - st->narrowBand /* st->bwidth */, ENDLSF_NBITS, &lsf[M], param_lpc, LSF_Q_prediction, &nb_indices, NULL ); } } diff --git a/lib_dec/er_util.c b/lib_dec/er_util.c index 809b0134d9653d91a028804f78eee5468a801782..5326f28e904ef627af30b8f7a4aa926f4a857320 100644 --- a/lib_dec/er_util.c +++ b/lib_dec/er_util.c @@ -318,8 +318,7 @@ int16_t GetPLCModeDecision( { TonalMDCTConceal_Detect( st->hTonalMDCTConc, ( hTcxDec->tcxltp_last_gain_unmodified > 0 ) ? st->old_fpitch : 0, &numIndices, - ( st->element_mode == IVAS_CPE_MDCT ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ), - st->mct_chan_mode == MCT_CHAN_MODE_LFE ); + ( st->element_mode == IVAS_CPE_MDCT ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ) ); if ( ( numIndices > 10 ) || ( ( numIndices > 5 ) && ( fabs( hTcxDec->tcxltp_third_last_pitch - hTcxDec->tcxltp_second_last_pitch ) < 0.5f ) ) || ( ( numIndices > 0 ) && ( ( st->last_good <= UNVOICED_TRANSITION ) || ( hTcxDec->tcxltp_last_gain_unmodified <= 0.4f ) ) && ( fabs( hTcxDec->tcxltp_third_last_pitch - hTcxDec->tcxltp_second_last_pitch ) < 0.5f ) ) ) { diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 23914302375ae1e39dd2cf8bccdc03c1a485d997..8ea2d71159fd155c3219b3e6ed165ed887d736cb 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -261,7 +261,11 @@ ivas_error evs_dec( if ( st->core == ACELP_CORE ) { /* ACELP core decoder */ +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + if ( ( error = acelp_core_dec( st, NULL, synth, NULL, bwe_exc_extended, voice_factors, old_syn_12k8_16k, sharpFlag, pitch_buf, &unbits, &sid_bw, NULL, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK ) +#else if ( ( error = acelp_core_dec( st, NULL, synth, NULL, bwe_exc_extended, voice_factors, old_syn_12k8_16k, sharpFlag, pitch_buf, &unbits, &sid_bw, NULL, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -276,7 +280,7 @@ ivas_error evs_dec( * Postprocessing for ACELP/MDCT core switching *---------------------------------------------------------------------*/ - if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) + if ( ( error = core_switching_post_dec( st, synth, NULL, NULL, 0, MONO_FORMAT, output_frame, core_switching_flag, 0, -1, EVS_MONO ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index cf55b4a619cc83cfd51bb79f89a60b156a9ce81a..7f8eba27c0e5a7f9dd7ff5f953e1818e7e3b5de0 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -35,7 +35,6 @@ ====================================================================================*/ #include -#include "typedef.h" #include #include "options.h" #ifdef DEBUGGING @@ -59,6 +58,14 @@ #define CNA_ACT_DN_FACT 0.7 /* downward updating factor for CNA during active frames */ #define FIRST_CNA_NOISE_UPD_FRAMES 5 /* minimum number of CN initialization frames */ + +/*------------------------------------------------------------------- + * Local fucntions declarations + *-------------------------------------------------------------------*/ + +static void perform_noise_estimation_dec( const float *timeDomainInput, float *power_spectrum, HANDLE_FD_CNG_DEC hFdCngDec, const int16_t element_mode, const int16_t bwidth, const int16_t L_frame, const int16_t last_L_frame, const int32_t last_core_brate, const int16_t VAD ); + + /*------------------------------------------------------------------- * createFdCngDec() * @@ -76,8 +83,7 @@ ivas_error createFdCngDec( *hFdCngDec = NULL; /* Allocate memory */ - hs = (HANDLE_FD_CNG_DEC) malloc( sizeof( FD_CNG_DEC ) ); - if ( hs == NULL ) + if ( ( hs = (HANDLE_FD_CNG_DEC) malloc( sizeof( FD_CNG_DEC ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FD CNG DEC structure" ); } @@ -152,8 +158,13 @@ void initFdCngDec( hFdCngDec->cna_ILD_LT = 0.0f; hFdCngDec->first_cna_noise_updated = 0; hFdCngDec->first_cna_noise_update_cnt = 0; +#ifdef FIX_I414_OOA_CNA + hFdCngDec->cna_nbands = CNA_INIT_NBANDS; + mvs2s( cna_init_bands, hFdCngDec->cna_band_limits, CNA_INIT_NBANDS + 1 ); +#else hFdCngDec->cna_nbands = 6; mvs2s( cna_init_bands, hFdCngDec->cna_band_limits, MAX_CNA_NBANDS + 1 ); +#endif hFdCngDec->cna_act_fact = 1.0f; hFdCngDec->cna_rescale_fact = 0.0f; hFdCngDec->cna_seed = 5687; @@ -419,7 +430,7 @@ void ApplyFdCng( ( *timeDomainInput( -FLT_MAX ) && *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && - ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD ) && + ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || ( st->ini_frame < 100 && st->is_ism_format ) ) && !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) @@ -620,7 +631,7 @@ void ApplyFdCng( * Perform noise estimation at the decoder *-------------------------------------------------------------------*/ -void perform_noise_estimation_dec( +static void perform_noise_estimation_dec( const float *timeDomainInput, float *power_spectrum, HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure containing all buffers and variables */ @@ -960,10 +971,13 @@ void FdCng_decodeSID( float v[32]; int16_t indices[32]; HANDLE_FD_CNG_COM hFdCngCom; + float *invTrfMatrix; + float tmpRAM[FDCNG_VQ_MAX_LEN][FDCNG_VQ_DCT_MAXTRUNC]; - const float *const *codebooks = ( st->element_mode == EVS_MONO ) ? cdk_37bits : cdk_37bits_ivas; const float gain_q_offset = ( st->element_mode == EVS_MONO ) ? GAIN_Q_OFFSET_EVS : GAIN_Q_OFFSET_IVAS; + invTrfMatrix = (float *) tmpRAM; + hFdCngCom = ( st->hFdCngDec )->hFdCngCom; sidNoiseEst = hFdCngCom->sidNoiseEst; @@ -981,7 +995,17 @@ void FdCng_decodeSID( index = get_next_indice( st, 7 ); /* MSVQ decoder */ - msvq_dec( codebooks, NULL, NULL, FD_CNG_stages_37bits, N, FD_CNG_maxN_37bits, indices, v, NULL ); + + if ( st->element_mode != EVS_MONO ) + { + create_IDCT_N_Matrix( invTrfMatrix, FDCNG_VQ_MAX_LEN, FDCNG_VQ_DCT_MAXTRUNC, sizeof( tmpRAM ) / ( sizeof( float ) ) ); + msvq_dec( cdk_37bits_ivas, NULL, NULL, FD_CNG_stages_37bits, N, FD_CNG_maxN_37bits, indices, 1, invTrfMatrix, v, NULL ); + } + else + { /* Legacy EVS_MONO MSVQ tables */ + msvq_dec( cdk_37bits, NULL, NULL, FD_CNG_stages_37bits, N, FD_CNG_maxN_37bits, indices, 0, NULL, v, NULL ); + } + /* Decode gain */ gain = ( (float) index - gain_q_offset ) / 1.5f; @@ -1085,7 +1109,7 @@ void generate_comfort_noise_dec( c2 = (float) sqrt( 1 - hFdCngCom->coherence ); seed2 = &( hFdCngCom->seed2 ); - if ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) + if ( ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) { seed2 = &( hFdCngCom->seed3 ); } @@ -1095,7 +1119,7 @@ void generate_comfort_noise_dec( if ( hFdCngCom->startBand == 0 ) { - if ( st->element_mode == IVAS_CPE_MDCT ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1120,7 +1144,7 @@ void generate_comfort_noise_dec( for ( ; ptr_level < cngNoiseLevel + hFdCngCom->stopFFTbin - hFdCngCom->startBand; ptr_level++ ) { /* Real part in FFT bins */ - if ( st->element_mode == IVAS_CPE_MDCT ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1134,7 +1158,7 @@ void generate_comfort_noise_dec( ptr_r += 2; /* Imaginary part in FFT bins */ - if ( st->element_mode == IVAS_CPE_MDCT ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1212,7 +1236,7 @@ void generate_comfort_noise_dec( for ( i = 0; i < hFdCngCom->numSlots; i++ ) { /* Real part in CLDFB band */ - if ( st->element_mode == IVAS_CPE_MDCT ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1225,7 +1249,7 @@ void generate_comfort_noise_dec( bufferReal[i][j] *= (float) sqrt( ( scaleCldfb * *ptr_level ) * 0.5f ); /* Imaginary part in CLDFB band */ - if ( st->element_mode == IVAS_CPE_MDCT ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) { rand_gauss( &tmp1, seed ); rand_gauss( &tmp2, seed2 ); @@ -1322,16 +1346,29 @@ void generate_comfort_noise_dec( *-------------------------------------------------------------------*/ void generate_comfort_noise_dec_hf( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ - HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ ) { int16_t i, j; float *ptr_level; + int16_t *seed = &( hFdCngCom->seed ); float scale = CLDFB_SCALING / hFdCngCom->scalingFactor; + int16_t *seed2 = &( hFdCngCom->seed ); + float tmp1, tmp2, c1 = 0.f, c2 = 0.f; + + if ( cng_coh_flag ) + { + seed2 = &( hFdCngCom->seed3 ); + + c1 = (float) sqrt( hFdCngCom->coherence ); // VE!!!!! all occurences of "(float) sqrt()" should be replaced by "sqrtf()" + c2 = (float) sqrt( 1 - hFdCngCom->coherence ); + } + ptr_level = hFdCngCom->cngNoiseLevel + hFdCngCom->stopFFTbin - hFdCngCom->startBand; /* Generate Gaussian random noise in real and imaginary parts of the CLDFB bands @@ -1343,12 +1380,29 @@ void generate_comfort_noise_dec_hf( { for ( i = 0; i < hFdCngCom->numSlots; i++ ) { - /* Real part in CLDFB band */ - rand_gauss( &bufferReal[i][j], seed ); - bufferReal[i][j] *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); - /* Imaginary part in CLDFB band */ - rand_gauss( &bufferImag[i][j], seed ); - bufferImag[i][j] *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); + if ( cng_coh_flag ) + { + /* Real part in CLDFB band */ + rand_gauss( &tmp1, seed ); + rand_gauss( &tmp2, seed2 ); + bufferReal[i][j] = tmp1 * c1 + tmp2 * c2; + bufferReal[i][j] *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); + + /* Imaginary part in CLDFB band */ + rand_gauss( &tmp1, seed ); + rand_gauss( &tmp2, seed2 ); + bufferImag[i][j] = tmp1 * c1 + tmp2 * c2; + bufferImag[i][j] *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); + } + else + { + /* Real part in CLDFB band */ + rand_gauss( &bufferReal[i][j], seed ); + bufferReal[i][j] *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); + /* Imaginary part in CLDFB band */ + rand_gauss( &bufferImag[i][j], seed ); + bufferImag[i][j] *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); + } } ptr_level++; } @@ -1744,6 +1798,162 @@ void generate_stereo_masking_noise( return; } +#ifdef JBM_TSM_ON_TCS +/*------------------------------------------------------------------- + * generate_masking_noise_hf_cldfb() + * + * Generate additional comfort noise (kind of noise filling) + *-------------------------------------------------------------------*/ + +void generate_masking_noise_lb_dirac( + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + float *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ + const int16_t nCldfbTs, /* i : number of CLDFB slots that will be rendered */ + const int16_t cna_flag /* i : CNA flag for LB and HB */ +) +{ + int16_t i; + float *cngNoiseLevel = hFdCngCom->cngNoiseLevel; + float *fftBuffer = hFdCngCom->fftBuffer; + float *ptr_r; + float *ptr_i; + float *ptr_level; + int16_t *seed = &( hFdCngCom->seed ); + float scale; + int16_t n_samples_out, n_samples_start, n_samples_out_loop; + + push_wmops( "fd_cng_dirac" ); + + /* Init */ + scale = 0.f; + n_samples_out = hFdCngCom->frameSize / DEFAULT_JBM_CLDFB_TIMESLOTS * nCldfbTs; + n_samples_start = 0; + + + /*LB CLDFB - CNA from STFT*/ +#ifdef DEBUG_MODE_DIRAC + { + int16_t tmp_s; + tmp_s = (int16_t) ( 32768.f * 0.5f * hFdCngCom->likelihood_noisy_speech * cna_flag + 0.5f ); + dbgwrite( &tmp_s, sizeof( int16_t ), 1, hFdCngCom->frameSize / 16, "./res/ivas_dirac_likelihood_noisy.pcm" ); + } +#endif + if ( cna_flag ) + { + /* skip noise generating if level is very low, to avoid problems with possibly running into denormals */ + if ( hFdCngCom->likelihood_noisy_speech > DELTA_MASKING_NOISE ) + { + /* Compute additional CN level */ + for ( i = 0; i < 15; i++ ) + { + if ( ( hFdCngCom->CngBandwidth == scaleTable_cn_dirac[i].bwmode ) && + ( hFdCngCom->CngBitrate >= scaleTable_cn_dirac[i].bitrateFrom ) && + ( hFdCngCom->CngBitrate < scaleTable_cn_dirac[i].bitrateTo ) ) + { + break; + } + } + + scale = (float) pow( 10.f, -scaleTable_cn_dirac[i].scale / 10.f ) - 1.f; + scale *= hFdCngCom->likelihood_noisy_speech; + } + } + + /* LB CLDFB - CNA from STFT: CNA applied only in channel 0*/ + if ( cna_flag && tdBuffer != NULL ) + { + while ( n_samples_out > 0 ) + { + n_samples_out_loop = min( hFdCngCom->frameSize, n_samples_out ); + if ( scale != 0 ) + { + /*Generate LF comfort noise only at first slot, for the whole frame*/ + ptr_level = cngNoiseLevel; + + /* Generate Gaussian random noise in real and imaginary parts of the FFT bins + Amplitudes are adjusted to the estimated noise level cngNoiseLevel in each bin */ + if ( hFdCngCom->startBand == 0 ) + { + rand_gauss( &fftBuffer[0], seed ); + ptr_r = fftBuffer + 2; + fftBuffer[0] *= (float) sqrt( scale * *ptr_level ); /* DC component in FFT */ + ptr_level++; + } + else + { + fftBuffer[0] = 0.f; + set_f( fftBuffer + 2, 0.0f, 2 * ( hFdCngCom->startBand - 1 ) ); + ptr_r = fftBuffer + 2 * hFdCngCom->startBand; + } + ptr_i = ptr_r + 1; + + for ( ; ptr_level < cngNoiseLevel + hFdCngCom->stopFFTbin - hFdCngCom->startBand; ptr_level++ ) + { + /* Real part in FFT bins */ + rand_gauss( ptr_r, seed ); + ( *ptr_r ) *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); + ptr_r += 2; + /* Imaginary part in FFT bins */ + rand_gauss( ptr_i, seed ); + ( *ptr_i ) *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); + ptr_i += 2; + } + + /* Remaining FFT bins are set to zero */ + set_f( fftBuffer + 2 * hFdCngCom->stopFFTbin, 0.0f, hFdCngCom->fftlen - 2 * hFdCngCom->stopFFTbin ); + /* Nyquist frequency is discarded */ + fftBuffer[1] = 0.f; + + /* Perform STFT synthesis */ + SynthesisSTFT_dirac( fftBuffer, tdBuffer + n_samples_start, hFdCngCom->olapBufferSynth2, hFdCngCom->olapWinSyn, n_samples_out_loop, hFdCngCom ); + +#ifdef DEBUG_MODE_DIRAC + { + int16_t tmp[1000]; + + for ( i = 0; i < hFdCngCom->frameSize; i++ ) + { + tmp[i] = (int16_t) ( tdBuffer[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), hFdCngCom->frameSize, 1, "./res/ivas_dirac_cna_fft.pcm" ); + } +#endif + } + + else + { + /* very low level case - update random seeds */ + generate_masking_noise_update_seed( hFdCngCom ); + + set_f( fftBuffer, 0.f, hFdCngCom->fftlen ); + + /* Perform STFT synthesis */ + SynthesisSTFT_dirac( fftBuffer, tdBuffer + n_samples_start, hFdCngCom->olapBufferSynth2, hFdCngCom->olapWinSyn, n_samples_out_loop, hFdCngCom ); + +#ifdef DEBUG_MODE_DIRAC + { + int16_t tmp[1000]; + + for ( i = 0; i < hFdCngCom->frameSize; i++ ) + { + tmp[i] = (int16_t) ( tdBuffer[i] + 0.5f ); + } + dbgwrite( tmp, sizeof( int16_t ), hFdCngCom->frameSize, 1, "./res/ivas_dirac_cna_fft.pcm" ); + } +#endif + } + n_samples_out -= hFdCngCom->frameSize; + n_samples_start += hFdCngCom->frameSize; + } + } + + pop_wmops(); + + return; +} + +#endif + /*------------------------------------------------------------------- * generate_masking_noise_hf_cldfb() @@ -1763,10 +1973,12 @@ void generate_masking_noise_dirac( ) { int16_t i; +#ifndef JBM_TSM_ON_TCS float *cngNoiseLevel = hFdCngCom->cngNoiseLevel; float *fftBuffer = hFdCngCom->fftBuffer; float *ptr_r; float *ptr_i; +#endif float *ptr_level; int16_t *seed = &( hFdCngCom->seed ); float scale; @@ -1813,12 +2025,12 @@ void generate_masking_noise_dirac( scale *= hFdCngCom->likelihood_noisy_speech; } } - /* LB CLDFB - CNA from STFT: CNA applied only in channel 0*/ if ( cna_flag && tdBuffer != NULL ) { if ( scale != 0 ) { +#ifndef JBM_TSM_ON_TCS /*Generate LF comfort noise only at first slot, for the whole frame*/ if ( slot_index == 0 ) { @@ -1873,12 +2085,13 @@ void generate_masking_noise_dirac( } #endif } - +#endif /* LF CLDFB*/ cldfbAnalysis_ts( &( tdBuffer[hFdCngCom->numCoreBands * slot_index] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, hFdCngCom->numCoreBands, h_cldfb ); } else { +#ifndef JBM_TSM_ON_TCS if ( slot_index == 0 ) { /* very low level case - update random seeds */ @@ -1901,7 +2114,7 @@ void generate_masking_noise_dirac( } #endif } - +#endif /* LB ana CLDFB*/ cldfbAnalysis_ts( &( tdBuffer[hFdCngCom->numCoreBands * slot_index] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, hFdCngCom->numCoreBands, h_cldfb ); } @@ -1956,6 +2169,12 @@ void FdCngDecodeMDCTStereoSID( int16_t indices[FD_CNG_stages_37bits]; int16_t N, i, ch, p, stages; int16_t is_out_ms; + float *invTrfMatrix; + float tmpRAM[FDCNG_VQ_MAX_LEN][FDCNG_VQ_DCT_MAXTRUNC]; + + + invTrfMatrix = (float *) tmpRAM; + create_IDCT_N_Matrix( invTrfMatrix, FDCNG_VQ_MAX_LEN, FDCNG_VQ_DCT_MAXTRUNC, sizeof( tmpRAM ) / ( sizeof( float ) ) ); is_out_ms = 0; if ( hCPE->hCoreCoder[0]->cng_sba_flag ) @@ -1999,7 +2218,7 @@ void FdCngDecodeMDCTStereoSID( } /* MSVQ decoder */ - msvq_dec( cdk_37bits_ivas, NULL, NULL, stages, N, FD_CNG_maxN_37bits, indices, ms_ptr[ch], NULL ); + msvq_dec( cdk_37bits_ivas, NULL, NULL, stages, N, FD_CNG_maxN_37bits, indices, 1, invTrfMatrix, ms_ptr[ch], NULL ); } dtx_read_padding_bits( sts[1], ( IVAS_SID_5k2 - 4400 ) / FRAMES_PER_SEC ); @@ -2043,7 +2262,7 @@ void FdCngDecodeMDCTStereoSID( /*------------------------------------------------------------------- * FdCngDecodeDiracMDCTStereoSID() * - * Decode FD-Cng parameters for CNG in 2TC DirAC mode from the bitstream + * Decode FD-CNG parameters for CNG in 2TC DirAC mode from the bitstream *-------------------------------------------------------------------*/ void FdCngDecodeDiracMDCTStereoSID( @@ -2058,6 +2277,12 @@ void FdCngDecodeDiracMDCTStereoSID( float gain[CPE_CHANNELS]; int16_t indices[FD_CNG_stages_37bits]; int16_t N, i, ch, p; + float *invTrfMatrix; + float tmpRAM[FDCNG_VQ_MAX_LEN][FDCNG_VQ_DCT_MAXTRUNC]; + + + invTrfMatrix = (float *) tmpRAM; /* dynamically filled */ + create_IDCT_N_Matrix( invTrfMatrix, FDCNG_VQ_MAX_LEN, FDCNG_VQ_DCT_MAXTRUNC, sizeof( tmpRAM ) / ( sizeof( float ) ) ); for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -2080,7 +2305,7 @@ void FdCngDecodeDiracMDCTStereoSID( gain[1] = gain[0]; /* MSVQ decoder */ - msvq_dec( cdk_37bits_ivas, NULL, NULL, FD_CNG_stages_37bits, N, FD_CNG_maxN_37bits, indices, ms_ptr[0], NULL ); + msvq_dec( cdk_37bits_ivas, NULL, NULL, FD_CNG_stages_37bits, N, FD_CNG_maxN_37bits, indices, 1, invTrfMatrix, ms_ptr[0], NULL ); mvr2r( ms_ptr[0], ms_ptr[1], N ); /*inverseMS( N, ms_ptr[0], ms_ptr[1], 1.f );*/ diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index e8112c6c4da76ee0a2eb5e970a749427acd9a494..2e7fb267ab9cc29bcbf59c8dcaded51a698907b5 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -111,7 +111,7 @@ void decod_audio( } /* set bit-allocation */ - config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, -1, 1, &nb_bits, NULL, st->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); + config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, -1, 1, &nb_bits, NULL, st->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); /*---------------------------------------------------------------* * Decode energy dynamics diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index 81f4c1b284460f451ce60e2b6b367250089a34a4..774720844c56abf7a28ea7cd13c4c312153f9077 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -238,7 +238,7 @@ void hq_lr_dec( if ( flag_spt == 1 ) { - /* initalize the desired parameters for SPT */ + /* initialize the desired parameters for SPT */ spt_shorten_domain_band_save( bands, band_start, band_end, band_width, org_band_start, org_band_end, org_band_width ); spt_shorten_domain_pre( band_start, band_end, hHQ_core->prev_SWB_peak_pos, bands, bwe_br, new_band_start, new_band_end, new_band_width ); spt_shorten_domain_set_dec( st, p2a_flags, new_band_start, new_band_end, new_band_width, bands, band_start, band_end, band_width, &bit_budget ); diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 05183e12f587add5b95c0247abc4c56afbbc537c..173623db6589f4e672d76673014d0ce540229fe6 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -107,9 +107,7 @@ ivas_error init_decoder( st->last_good = UNVOICED_CLAS; st->clas_dec = UNVOICED_CLAS; st->low_rate_mode = 0; -#ifdef FIX_299_ISM_BWS st->last_low_rate_mode = 0; -#endif st->lp_gainp = 0.0f; st->lp_gainc = 0.0f; @@ -328,7 +326,7 @@ ivas_error init_decoder( set_f( st->old_synth_sw, 0.0f, NS2SA( 48000, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ) ); } - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT || st->element_mode == IVAS_SCE || st->element_mode == EVS_MONO ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT || st->element_mode == IVAS_SCE || st->element_mode == EVS_MONO ) ) { if ( ( st->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL ) { @@ -521,16 +519,9 @@ ivas_error init_decoder( } /* open synthesis for output sampling rate */ - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { - if ( ( error = openCldfb( &st->cldfbSyn, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else + if ( ( error = openCldfb( &st->cldfbSyn, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) { - st->cldfbSyn = NULL; + return error; } st->cldfbSynHB = NULL; @@ -587,7 +578,7 @@ ivas_error init_decoder( *-----------------------------------------------------------------*/ /* TCX-LTP */ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hTcxLtpDec = (TCX_LTP_DEC_HANDLE) malloc( sizeof( TCX_LTP_DEC_DATA ) ) ) == NULL ) { @@ -600,7 +591,7 @@ ivas_error init_decoder( } /* TCX core */ - // VE: reduction possible for MCT_CHAN_MODE_LFE channel - see I1-172 + if ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) { if ( ( st->hTcxDec = (TCX_DEC_HANDLE) malloc( sizeof( TCX_DEC_DATA ) ) ) == NULL ) @@ -619,7 +610,7 @@ ivas_error init_decoder( } /* TCX config. data structure */ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL ) { @@ -632,7 +623,7 @@ ivas_error init_decoder( } /* Tonal MDCT concealment data structure */ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hTonalMDCTConc = (TonalMDCTConcealPtr) malloc( sizeof( TonalMDCTConceal_INSTANCE ) ) ) == NULL ) { @@ -648,7 +639,7 @@ ivas_error init_decoder( * IGF *-----------------------------------------------------------------*/ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hIGFDec = (IGF_DEC_INSTANCE_HANDLE) malloc( sizeof( IGFDEC_INSTANCE ) ) ) == NULL ) { @@ -711,7 +702,11 @@ ivas_error init_decoder( * FD-CNG decoder *-----------------------------------------------------------------*/ +#ifdef MC_PARAMUPMIX_MODE + if ( ( st->element_mode == IVAS_CPE_MDCT || idchan == 0 ) && mc_mode != MC_MODE_MCT && mc_mode != MC_MODE_PARAMUPMIX ) +#else if ( ( st->element_mode == IVAS_CPE_MDCT || idchan == 0 ) && mc_mode != MC_MODE_MCT ) +#endif { /* Create FD_CNG instance */ if ( ( error = createFdCngDec( &st->hFdCngDec ) ) != IVAS_ERR_OK ) @@ -740,6 +735,11 @@ ivas_error init_decoder( st->tdm_LRTD_flag = 0; st->cna_dirac_flag = 0; st->cng_sba_flag = 0; + st->cng_ism_flag = 0; +#ifndef FIX_ISM_DTX_CNG_BWIDTH_ALT + st->read_sid_info = 1; /* by default read the sid info from bitstream */ +#endif + st->is_ism_format = 0; return error; @@ -770,12 +770,12 @@ void reset_preecho_dec( /*----------------------------------------------------------------------* - * destroy_decoder() + * destroy_cldfb_decoder() * * Free memory which was allocated in init_decoder() *----------------------------------------------------------------------*/ -void destroy_decoder( +void destroy_cldfb_decoder( Decoder_State *st /* o : Decoder static variables structure */ ) { diff --git a/lib_dec/ivas_agc_dec.c b/lib_dec/ivas_agc_dec.c index 1397ce1111f4aadbcc1f3898e427cf742530bf95..72ae68a57b34d61132eee2944adf4b6f27e52a4f 100644 --- a/lib_dec/ivas_agc_dec.c +++ b/lib_dec/ivas_agc_dec.c @@ -142,22 +142,24 @@ void ivas_spar_agc_dec_close( { ivas_agc_dec_state_t *hAgc; + if ( hAgcDec == NULL || *hAgcDec == NULL ) + { + return; + } + hAgc = *hAgcDec; - if ( hAgc != NULL ) - { - free( hAgc->agc_com.winFunc ); - hAgc->agc_com.winFunc = NULL; + free( hAgc->agc_com.winFunc ); + hAgc->agc_com.winFunc = NULL; - free( hAgc->gain_state ); - hAgc->gain_state = NULL; + free( hAgc->gain_state ); + hAgc->gain_state = NULL; - free( hAgc->gain_data ); - hAgc->gain_data = NULL; + free( hAgc->gain_data ); + hAgc->gain_data = NULL; - free( hAgc ); - *hAgcDec = NULL; - } + free( *hAgcDec ); + *hAgcDec = NULL; return; } diff --git a/lib_rend/ivas_binauralRenderer.c b/lib_dec/ivas_binRenderer_internal.c similarity index 82% rename from lib_rend/ivas_binauralRenderer.c rename to lib_dec/ivas_binRenderer_internal.c index d0eaa6407cbd7019f5c92a2486fb39fd7a2c7bfc..bfe0a4bb533681ebb76b93d73f03380014b20f97 100644 --- a/lib_rend/ivas_binauralRenderer.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -33,11 +33,13 @@ #include #include "options.h" #include -#include "ivas_prot.h" #include "prot.h" +#include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "cnst.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" +#include "ivas_rom_dec.h" #include "ivas_rom_com.h" #include "ivas_rom_binauralRenderer.h" #ifdef DEBUGGING @@ -57,7 +59,10 @@ static void ivas_binRenderer_filterModule( float out_Conv_CLDFB_imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : imag part of Binaural signals */ 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 */ - BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ +#ifdef JBM_TSM_ON_TCS + const int16_t numTimeSlots, /* i : number of time slots to process */ +#endif + BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { int16_t bandIdx, k, chIdx, tapIdx; @@ -76,7 +81,11 @@ static void ivas_binRenderer_filterModule( filterTapsRightRealPtr = hBinRenderer->hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx]; filterTapsRightImagPtr = hBinRenderer->hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx]; +#ifdef JBM_TSM_ON_TCS + for ( k = 0; k < numTimeSlots; k++ ) +#else for ( k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) +#endif { float outRealLeft = 0.0f, outRealRight = 0.0f, outImagLeft = 0.0f, outImagRight = 0.0f; @@ -124,12 +133,8 @@ static ivas_error ivas_binRenderer_convModuleOpen( const int16_t renderer_type, const int16_t isLoudspeaker, const AUDIO_CONFIG input_config, - const RENDER_CONFIG_DATA *hRenderConfig -#ifdef HRTF_BINARY_FILE - , - const HRTFS_FASTCONV_HANDLE hHrtf -#endif -) + const RENDER_CONFIG_DATA *hRenderConfig, + const HRTFS_FASTCONV_HANDLE hHrtf ) { int16_t bandIdx, chIdx; BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; @@ -316,17 +321,10 @@ static ivas_error ivas_binRenderer_convModuleOpen( if ( isLoudspeaker ) { -#ifdef HRTF_BINARY_FILE hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftBRIRReal[bandIdx][tmp]; hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftBRIRImag[bandIdx][tmp]; hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightBRIRReal[bandIdx][tmp]; hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightBRIRImag[bandIdx][tmp]; -#else - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = leftBRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = leftBRIRImag[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = rightBRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = rightBRIRImag[bandIdx][tmp]; -#endif } #ifdef DEBUGGING else @@ -344,32 +342,18 @@ static ivas_error ivas_binRenderer_convModuleOpen( if ( isLoudspeaker ) { -#ifdef HRTF_BINARY_FILE hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal[bandIdx][tmp]; hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftHRIRImag[bandIdx][tmp]; hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightHRIRReal[bandIdx][tmp]; hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightHRIRImag[bandIdx][tmp]; -#else - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = leftHRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = leftHRIRImag[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = rightHRIRReal[bandIdx][tmp]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = rightHRIRImag[bandIdx][tmp]; -#endif } else { /* HOA3 filter coefficients */ -#ifdef HRTF_BINARY_FILE hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA3[bandIdx][chIdx]; hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA3[bandIdx][chIdx]; hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA3[bandIdx][chIdx]; hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA3[bandIdx][chIdx]; -#else - hBinRenConvModule->filterTapsLeftReal[bandIdx][chIdx] = leftHRIRReal_HOA3[bandIdx][chIdx]; - hBinRenConvModule->filterTapsLeftImag[bandIdx][chIdx] = leftHRIRImag_HOA3[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx] = rightHRIRReal_HOA3[bandIdx][chIdx]; - hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx] = rightHRIRImag_HOA3[bandIdx][chIdx]; -#endif } } } @@ -380,7 +364,6 @@ static ivas_error ivas_binRenderer_convModuleOpen( return IVAS_ERR_OK; } -#ifdef HRTF_BINARY_FILE /*-------------------------------------------------------------------------* * ivas_binaural_HRTF_open() * @@ -443,7 +426,6 @@ static ivas_error ivas_binaural_hrtf_open( return IVAS_ERR_OK; } -#endif /*-------------------------------------------------------------------------* * ivas_binaural_obtain_DMX() @@ -451,6 +433,15 @@ static ivas_error ivas_binaural_hrtf_open( * *-------------------------------------------------------------------------*/ +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_binaural_obtain_DMX( + const int16_t numTimeSlots, + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ + float RealBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Contains the LS signals */ + float ImagBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Contains the LS signals */ + float realDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float imagDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] ) +#else static void ivas_binaural_obtain_DMX( const int16_t numTimeSlots, BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ @@ -458,6 +449,7 @@ static void ivas_binaural_obtain_DMX( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : Contains the LS signals */ float realDMX[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float imagDMX[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] ) +#endif { int16_t chIdx, bandIdx, k; @@ -631,26 +623,20 @@ ivas_error ivas_binRenderer_open( hBinRenderer->render_lfe = 1; } -#ifdef HRTF_BINARY_FILE /* Load HRTF tables */ ivas_binaural_hrtf_open( &st_ivas->hHrtfFastConv ); -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && ( st_ivas->hIntSetup.is_loudspeaker_setup == 0 ) ) { IVAS_OUTPUT_SETUP out_setup; /* Allocate memories and buffers needed for convolutional module in CICP19 */ -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, AUDIO_CONFIG_7_1_4, st_ivas->hRenderConfig, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, 1, AUDIO_CONFIG_7_1_4, st_ivas->hRenderConfig ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -666,70 +652,42 @@ ivas_error ivas_binRenderer_open( } hBinRenderer->hoa_dec_mtx = st_ivas->hoa_dec_mtx; -#ifdef HRTF_BINARY_FILE st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_BRIR_latency_s * 1000000000.f ); -#endif } else { /* Allocate memories and buffers needed for convolutional module */ -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, st_ivas->renderer_type, st_ivas->hIntSetup.is_loudspeaker_setup, st_ivas->hIntSetup.output_config, st_ivas->hRenderConfig ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef FIX_FIX_I59 if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { if ( hBinRenderer->ivas_format == MC_FORMAT ) { - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_HRIR_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); } else { - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_HOA3_latency_s * 1000000000.f ); + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); } } else { /* same value for MC or HOA both use MC BRIR*/ - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_BRIR_latency_s * 1000000000.f ); - } -#else - if ( hBinRenderer->ivas_format == MC_FORMAT ) - { -#ifdef HRTF_BINARY_FILE - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HRIR_latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_HRIR_latency_s * 1000000000.f ); -#endif - } - else - { -#ifdef HRTF_BINARY_FILE - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_HOA3_latency_s * 1000000000.f ); -#else - st_ivas->binaural_latency_ns = (int32_t) ( FASTCONV_HOA3_latency_s * 1000000000.f ); -#endif + st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s * 1000000000.f ); } -#endif } /* Allocate memories needed for reverb module */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, @@ -739,9 +697,6 @@ ivas_error ivas_binRenderer_open( RENDERER_BINAURAL_FASTCONV_ROOM, st_ivas->hHrtfFastConv, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binaural_reverb_open( &( hBinRenderer->hReverb ), hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hIntSetup.output_config, st_ivas->hDecoderConfig->output_Fs, RENDERER_BINAURAL_FASTCONV_ROOM ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -751,7 +706,7 @@ ivas_error ivas_binRenderer_open( { for ( k = 0; k < hBinRenderer->nInChannels; k++ ) { - hBinRenderer->hReverb->dmxmtx[chIdx][k] = dmxmtx[chIdx][k]; + hBinRenderer->hReverb->dmxmtx[chIdx][k] = dmxmtx_table[chIdx][k]; } } } @@ -909,9 +864,14 @@ void ivas_binRenderer_close( *-------------------------------------------------------------------------*/ void ivas_binaural_add_LFE( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - int16_t output_frame, /* i : length of input frame */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t output_frame, /* i : length of input frame */ +#ifdef JBM_TSM_ON_TCS + float *input_f[], /* i : transport channels */ + float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ +#else float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif ) { int16_t render_lfe, idx_lfe; @@ -928,17 +888,27 @@ void ivas_binaural_add_LFE( if ( render_lfe ) { -#ifdef FIX_197_CREND_INTERFACE - gain = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; -#else - gain = st_ivas->hHrtf != NULL ? st_ivas->hHrtf->gain_lfe : GAIN_LFE; -#endif + if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + gain = GAIN_LFE; + } + else + { + gain = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE; + } for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ ) { +#ifdef JBM_TSM_ON_TCS + v_multc( input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain, input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_frame ); + /* copy LFE to left and right channels */ + v_add( output_f[0], input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[0], output_frame ); + v_add( output_f[1], input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[1], output_frame ); +#else v_multc( output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain, output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_frame ); /* copy LFE to left and right channels */ v_add( output_f[0], output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[0], output_frame ); v_add( output_f[1], output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[1], output_frame ); +#endif } } @@ -954,8 +924,12 @@ void ivas_binaural_add_LFE( *-------------------------------------------------------------------------*/ void ivas_binaural_cldfb( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef JBM_TSM_ON_TCS + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +#else float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif ) { float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -998,8 +972,11 @@ void ivas_binaural_cldfb( } /* Implement binaural rendering */ +#ifdef JBM_TSM_ON_TCS + ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, JBM_CLDFB_SLOTS_IN_SUBFRAME, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); +#else ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - +#endif /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { @@ -1020,6 +997,99 @@ void ivas_binaural_cldfb( return; } +#ifdef JBM_TSM_ON_TCS +/*-------------------------------------------------------------------------* + * ivas_binaural_cldfb() + * + * Perform CLDFB analysis, fastconv binaural rendering and CLDFB synthesis + *-------------------------------------------------------------------------*/ + +void ivas_binaural_cldfb_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t n_samples_to_render, + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +) +{ + float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + int16_t slot_idx, subframeIdx, index_slot, idx_in, idx_lfe, maxBand, ch; + int16_t slot_size, slots_to_render, first_sf, last_sf; + int16_t slot_index_start, slot_index_start_cldfb; + + /* Implement a 5 msec loops */ + maxBand = (int16_t) ( ( CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs ) / 48000 ); + slot_size = st_ivas->hTcBuffer->nb_subframes; + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_to_render / slot_size ); + first_sf = st_ivas->hTcBuffer->subframes_rendered; + last_sf = first_sf; + slot_index_start = st_ivas->hTcBuffer->slots_rendered; + slot_index_start_cldfb = 0; + st_ivas->hTcBuffer->slots_rendered += slots_to_render; + while ( slots_to_render > 0 ) + { + slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf]; + last_sf++; + } + for ( subframeIdx = first_sf; subframeIdx < last_sf; subframeIdx++ ) + { + for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ ) + { + index_slot = slot_index_start + slot_idx; + + /* Implement CLDFB analysis */ + idx_in = 0; + idx_lfe = 0; + + for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ ) + { + if ( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( st_ivas->hIntSetup.index_lfe[idx_lfe] == ch ) ) + { + if ( idx_lfe < ( st_ivas->hIntSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else + { + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[ch][maxBand * index_slot] ), + Cldfb_RealBuffer[idx_in][slot_idx], + Cldfb_ImagBuffer[idx_in][slot_idx], + maxBand, st_ivas->cldfbAnaDec[idx_in] ); + idx_in++; + } + } + } + + /* Implement binaural rendering */ +#ifdef JBM_TSM_ON_TCS + ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); +#else + ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); +#endif + /* Implement CLDFB synthesis */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + + for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ ) + { + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch][slot_idx]; + } + + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_index_start_cldfb * maxBand] ), maxBand * st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], st_ivas->cldfbSynDec[ch] ); + } + slot_index_start += st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; + slot_index_start_cldfb += st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; + } + st_ivas->hTcBuffer->subframes_rendered = last_sf; + return; +} +#endif #endif @@ -1030,8 +1100,11 @@ void ivas_binaural_cldfb( *-------------------------------------------------------------------------*/ void ivas_binRenderer( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ +#ifdef JBM_TSM_ON_TCS + const int16_t numTimeSlots, /* i : number of time slots to render*/ +#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 */ @@ -1039,7 +1112,9 @@ void ivas_binRenderer( ) { int16_t chIdx, k; +#ifndef JBM_TSM_ON_TCS int16_t numTimeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; +#endif push_wmops( "fastconv_binaural_rendering" ); @@ -1063,37 +1138,62 @@ void ivas_binRenderer( if ( hHeadTrackData->shd_rot_max_order == -1 ) { QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); - +#ifdef JBM_TSM_ON_TCS + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); +#else rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); +#endif } else if ( hHeadTrackData->shd_rot_max_order > 0 ) { +#ifdef JBM_TSM_ON_TCS + rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hHeadTrackData->shd_rot_max_order ); +#else rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, hHeadTrackData->shd_rot_max_order ); +#endif } } else { /* Rotation in SD (CICPx) */ +#ifdef JBM_TSM_ON_TCS + rotateFrame_sd_cldfb( hHeadTrackData, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); +#else rotateFrame_sd_cldfb( hHeadTrackData, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, hBinRenderer->conv_band ); +#endif } } /* HOA decoding to CICP19 if needed*/ if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) { +#ifdef JBM_TSM_ON_TCS + ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx ); +#else ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, hBinRenderer->hoa_dec_mtx ); +#endif } +#ifdef JBM_TSM_ON_TCS + ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer ); +#else ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, hBinRenderer ); +#endif /* Obtain the binaural dmx and compute the reverb */ if ( hBinRenderer->hReverb != NULL ) { +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float inRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float inIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#else float reverbRe[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float reverbIm[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float inRe[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float inIm[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - +#endif ivas_binaural_obtain_DMX( numTimeSlots, hBinRenderer, RealBuffer, ImagBuffer, inRe, inIm ); for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) @@ -1105,7 +1205,15 @@ void ivas_binRenderer( } } +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +#ifdef JBM_TSM_ON_TCS + ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe, inIm, reverbRe, reverbIm ); +#else + ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, inRe, inIm, reverbRe, reverbIm ); +#endif +#else ivas_binaural_reverb_processFrame( hBinRenderer->hReverb, BINAURAL_CHANNELS, inRe, inIm, reverbRe, reverbIm, 0u ); +#endif /* Add the conv module and reverb module output */ for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 186a624f4d44ff157384ef3fc995f4da329c254b..516e027f90db764e863ccec371bbb212e532b0c2 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -90,6 +90,9 @@ ivas_error ivas_core_dec( int16_t use_cldfb_for_dft; float *p_output_mem; int16_t flag_sec_CNA; +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + int16_t read_sid_info; +#endif int16_t last_element_mode; int16_t nchan_out; float *save_hb_synth; @@ -105,6 +108,9 @@ ivas_error ivas_core_dec( use_cldfb_for_dft = 0; tdm_LRTD_flag = -1; +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + read_sid_info = 1; /* read SID by default */ +#endif if ( hSCE != NULL ) { @@ -116,6 +122,15 @@ ivas_error ivas_core_dec( hStereoTD = NULL; p_output_mem = NULL; nchan_out = 1; +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + if ( st_ivas != NULL && st_ivas->ivas_format == ISM_FORMAT ) + { + if ( st_ivas->hISMDTX.sce_id_dtx != hSCE->sce_id ) + { + read_sid_info = 0; + } + } +#endif } else { @@ -240,7 +255,7 @@ ivas_error ivas_core_dec( hCPE->hStereoCng->flag_cna_fade = 0; } - if ( sba_dirac_stereo_flag && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG ) + if ( sba_dirac_stereo_flag && hSCE && sts[0]->total_brate <= SID_2k40 && sts[0]->cng_type == FD_CNG ) { save_hb_synth = hSCE->save_hb_synth; } @@ -332,7 +347,11 @@ ivas_error ivas_core_dec( if ( st->core == ACELP_CORE ) { /* ACELP core decoder */ +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) +#else if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -341,7 +360,7 @@ ivas_error ivas_core_dec( if ( ( st->core == TCX_20_CORE || st->core == TCX_10_CORE ) && st->element_mode != IVAS_CPE_MDCT ) { /* TCX decoder */ - stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out ); + stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); } if ( st->core == HQ_CORE ) @@ -441,19 +460,19 @@ ivas_error ivas_core_dec( *---------------------------------------------------------------------*/ /* save synth and output in case of SBA DirAC stereo output as core switching is done outside of core decoder */ - if ( sba_dirac_stereo_flag && !( st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) ) + if ( sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT && !( st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) ) { mvr2r( synth[n], hSCE->save_synth, output_frame ); } - if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) + if ( ( error = core_switching_post_dec( st, synth[n], output[n], p_output_mem, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE ) ) != IVAS_ERR_OK ) { return error; } /* for FD-CNG we need the delay compensation in the synth, so do this afterwards */ - if ( sba_dirac_stereo_flag && st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) + if ( sba_dirac_stereo_flag && hSCE && st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) { mvr2r( synth[n], hSCE->save_synth, output_frame ); } @@ -660,7 +679,7 @@ ivas_error ivas_core_dec( } } - if ( sba_dirac_stereo_flag ) + if ( sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT ) { /* for SBA DirAC stereo output DFT Stereo core switching and updates are done in ivas_sba_dirac_stereo_dec() as hCPE is not available at this point */ break; @@ -675,13 +694,16 @@ ivas_error ivas_core_dec( if ( st->element_mode != IVAS_CPE_DFT ) { - if ( st->element_mode != IVAS_CPE_MDCT ) + if ( st->element_mode != IVAS_CPE_MDCT || sba_dirac_stereo_flag ) { - ivas_post_proc( hSCE, hCPE, n, synth[n], NULL, output_frame, 0 ); + ivas_post_proc( hSCE, hCPE, n, synth[n], NULL, output_frame, sba_dirac_stereo_flag ); } /* update OLA buffers - needed for switching to DFT stereo */ - stereo_td2dft_update( hCPE, n, output[n], synth[n], hb_synth[n], output_frame ); + if ( !sba_dirac_stereo_flag ) + { + stereo_td2dft_update( hCPE, n, output[n], synth[n], hb_synth[n], output_frame ); + } } else /* IVAS_CPE_DFT */ { diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 5bc68227355c5b348304ae811fe9312857b61de1..9d15f1bdfc34b2e98ccff7f0b8595648f67f654a 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -33,12 +33,7 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_prot.h" -#include "ivas_rom_com.h" -#include "ivas_stat_enc.h" -#include "lib_dec.h" #include "prot.h" -#include -#include #include #ifdef DEBUGGING #include "debug.h" @@ -75,9 +70,9 @@ ivas_error ivas_corecoder_dec_reconfig( hDecoderConfig = st_ivas->hDecoderConfig; ivas_total_brate = hDecoderConfig->ivas_total_brate; + output_frame = (int16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); error = IVAS_ERR_OK; - output_frame = (int16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); if ( st_ivas->ivas_format == MC_FORMAT ) { last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ @@ -86,13 +81,14 @@ ivas_error ivas_corecoder_dec_reconfig( { last_mc_mode = MC_MODE_NONE; } + /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SCE/CPE/MCT handles + * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ /* remove dummy CPE element for DFT stereo-like upmix */ - if ( ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) || - ( st_ivas->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) ) + if ( ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && nchan_transport_old == 1 && ( !st_ivas->sba_dirac_stereo_flag || st_ivas->nchan_transport > 1 ) ) || + ( st_ivas->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && nchan_transport_old == 1 && ( !st_ivas->sba_dirac_stereo_flag || st_ivas->nchan_transport > 1 ) ) ) { st_ivas->hCPE[0]->hCoreCoder[0] = NULL; st_ivas->hCPE[0]->hCoreCoder[1] = NULL; @@ -120,6 +116,7 @@ ivas_error ivas_corecoder_dec_reconfig( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = brate_CPE; + /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -140,7 +137,6 @@ ivas_error ivas_corecoder_dec_reconfig( nSCE_existing = min( nSCE_old, st_ivas->nSCE ); nCPE_existing = min( nCPE_old, st_ivas->nCPE ); - // VE: TBV - try to reuse the CoreCoder /* destroy superfluous core coder elements */ for ( sce_id = st_ivas->nSCE; sce_id < nSCE_old; sce_id++ ) { @@ -150,6 +146,21 @@ ivas_error ivas_corecoder_dec_reconfig( for ( cpe_id = st_ivas->nCPE; cpe_id < nCPE_old; cpe_id++ ) { + /* don't deallocate first CPE in case of mono/stereo output of 1 TC SBA, only deallocate core coder */ + if ( cpe_id == 0 && st_ivas->sba_dirac_stereo_flag && sba_dirac_stereo_flag_old ) + { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + if ( st_ivas->hCPE[cpe_id]->hCoreCoder[n] != NULL ) + { + destroy_core_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + + free( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + st_ivas->hCPE[cpe_id]->hCoreCoder[n] = NULL; + } + } + continue; + } destroy_cpe_dec( st_ivas->hCPE[cpe_id] ); st_ivas->hCPE[cpe_id] = NULL; } @@ -189,10 +200,16 @@ ivas_error ivas_corecoder_dec_reconfig( return error; } } + if ( st_ivas->sba_dirac_stereo_flag && sba_dirac_stereo_flag_old && st_ivas->nchan_transport == 1 && nSCE_old == 0 ) + { + st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ + st_ivas->hCPE[0]->hCoreCoder[1] = NULL; + } for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = brate_CPE; + /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -248,7 +265,6 @@ ivas_error ivas_corecoder_dec_reconfig( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->use_itd = 0; st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->reverse_dmx = 0; st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->smooth_ratio = 1.f; -#ifdef SBA_BR_SWITCHING_RECONFIG set_s( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->prev_ms_mask[0], 0, MAX_SFB ); set_s( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->prev_ms_mask[1], 0, MAX_SFB ); st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->lastCoh = 1.f; @@ -256,7 +272,6 @@ ivas_error ivas_corecoder_dec_reconfig( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->mdct_stereo_mode[1] = SMDCT_DUAL_MONO; st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->IGFStereoMode[0] = -1; st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->IGFStereoMode[1] = -1; -#endif for ( n = 0; n < CPE_CHANNELS; n++ ) { /* reset mct_chan_mode */ @@ -269,12 +284,23 @@ ivas_error ivas_corecoder_dec_reconfig( if ( ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_dirac_stereo_flag && !sba_dirac_stereo_flag_old ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->sba_dirac_stereo_flag && !sba_dirac_stereo_flag_old ) ) { - if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + /* if at least one CPE is already available, only allocate DFT Stereo struct */ + if ( st_ivas->nCPE > 0 ) { - return error; + if ( ( error = stereo_dft_dec_create( &( st_ivas->hCPE[0]->hStereoDft ), st_ivas->hCPE[0]->element_brate, st_ivas->hDecoderConfig->output_Fs, st_ivas->sba_dirac_stereo_flag, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + } + /* otherwise create extra dummy CPE */ + else + { + if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + { + return error; + } } - // VE: TBV - just reset for now set_f( st_ivas->hCPE[0]->hStereoDft->buff_LBTCX_mem, 0, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ @@ -303,37 +329,9 @@ ivas_error ivas_corecoder_dec_reconfig( * Set CNA/CNG flags *-----------------------------------------------------------------*/ - /// VE: this could be merged with part of ivas_init_decoder() - if ( st_ivas->ivas_format == SBA_FORMAT ) + if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) { - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) - { - /* skip as done in init function */ - } - else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; - } - else if ( st_ivas->nchan_transport == 2 ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[0]->hCoreCoder[n]->cna_dirac_flag = 0; - st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; - } - } - else - { - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cna_dirac_flag = 0; - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 0; - } - } - } + ivas_sba_set_cna_cng_flag( st_ivas ); } /* special case, if the decoder goes from 1TC DTX to 2TC active frame (in case the bitstream started with an SBA SID frame), allocate DTX memories */ @@ -459,7 +457,6 @@ ivas_error ivas_cldfb_dec_reconfig( if ( st_ivas->ivas_format == SBA_FORMAT && nchan_transport_old == 1 && numCldfbAnalyses_old == 2 && st_ivas->nchan_transport > 1 ) { deleteCldfb( &( st_ivas->cldfbAnaDec[1] ) ); - st_ivas->cldfbAnaDec[1] = NULL; numCldfbAnalyses_old--; } @@ -479,7 +476,6 @@ ivas_error ivas_cldfb_dec_reconfig( for ( i = numCldfbAnalyses; i < numCldfbAnalyses_old; i++ ) { deleteCldfb( &( st_ivas->cldfbAnaDec[i] ) ); - st_ivas->cldfbAnaDec[i] = NULL; } } else if ( numCldfbAnalyses_old < numCldfbAnalyses ) @@ -501,7 +497,6 @@ ivas_error ivas_cldfb_dec_reconfig( for ( i = numCldfbSyntheses; i < numCldfbSyntheses_old; i++ ) { deleteCldfb( &( st_ivas->cldfbSynDec[i] ) ); - st_ivas->cldfbSynDec[i] = NULL; } } else if ( numCldfbSyntheses_old < numCldfbSyntheses ) @@ -515,12 +510,12 @@ ivas_error ivas_cldfb_dec_reconfig( } } } -#ifdef SBA_BR_SWITCHING_RECONFIG + /* CLDFB Interpolation weights */ - if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) ) + if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) && numCldfbAnalyses != 0 && numCldfbSyntheses != 0 ) { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } -#endif + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c old mode 100644 new mode 100755 index 972f1304f7515b782cd96a81ccb75f61faf1fa6a..186d1c4c7daade77a393d4542142f78836852a11 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -291,7 +291,6 @@ ivas_error ivas_cpe_dec( } } else - { /* subtract metadata bitbudget */ /* IVAS_fmToDo: TBC whether it is not better to distribute the metadata bits equally between 2 channels */ sts[0]->bits_frame_channel -= nb_bits_metadata; @@ -361,7 +360,7 @@ ivas_error ivas_cpe_dec( if ( hCPE->element_mode != IVAS_CPE_DFT || ( hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) { - if ( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB, NULL, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -406,7 +405,7 @@ ivas_error ivas_cpe_dec( } else { - stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0 ); + stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0 ); } /* synthesis iFFT */ @@ -455,7 +454,10 @@ ivas_error ivas_cpe_dec( * Synthesis synchronization between CPE modes *----------------------------------------------------------------*/ - synchro_synthesis( ivas_total_brate, hCPE, output, output_frame, 0 ); + if ( !st_ivas->sba_dirac_stereo_flag ) + { + synchro_synthesis( ivas_total_brate, hCPE, output, output_frame, 0 ); + } if ( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->nchan_out == 1 && ( is_DTXrate( ivas_total_brate ) == 0 || ( is_DTXrate( ivas_total_brate ) == 1 && is_DTXrate( st_ivas->hDecoderConfig->last_ivas_total_brate ) == 0 ) ) ) { @@ -670,7 +672,7 @@ ivas_error create_cpe_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { - if ( st_ivas->sba_dirac_stereo_flag ) + if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 ) { /* for SBA DirAC stereo output CPE element is only used for upmix, core coder is found in SCE element used for core decoding */ break; @@ -685,10 +687,6 @@ ivas_error create_cpe_dec( st->total_brate = hCPE->element_brate / ( CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT && ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) - { - st->mct_chan_mode = MCT_CHAN_MODE_LFE; - } if ( ( error = init_decoder( st, n, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) { @@ -702,9 +700,9 @@ ivas_error create_cpe_dec( * DFT stereo initialization *-----------------------------------------------------------------*/ - if ( hCPE->element_mode == IVAS_CPE_DFT || st_ivas->sba_dirac_stereo_flag ) + if ( hCPE->element_mode == IVAS_CPE_DFT || ( st_ivas->sba_dirac_stereo_flag && hCPE->cpe_id == 0 ) ) { - if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) + if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, st_ivas->sba_dirac_stereo_flag, st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) { return error; } @@ -829,8 +827,8 @@ void destroy_cpe_dec( int16_t n; Decoder_State *st; - /* make sure we deallocate a potential distinct hTcxCfg for a MCT LFE channel (can only happen in rs) */ - if ( hCPE->hCoreCoder[1] != NULL && hCPE->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_LFE && hCPE->hCoreCoder[1]->hTcxCfg != hCPE->hCoreCoder[0]->hTcxCfg ) + /* make sure we deallocate a potential distinct hTcxCfg for a MCT LFE channel (can only happen in rs) */ /*TODO Check this again with LFE clean up!*/ + if ( hCPE->hCoreCoder[1] != NULL && hCPE->hCoreCoder[1]->hTcxCfg != hCPE->hCoreCoder[0]->hTcxCfg ) { hCPE->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -961,7 +959,7 @@ static void read_stereo_mode_and_bwidth( hCPE->element_mode = IVAS_CPE_MDCT; break; case SID_SBA_1TC: - assert( "Forbidden value for SID format in CPE (SBA 1TC), should have already been adressed earlier" ); + assert( !"Forbidden value for SID format in CPE (SBA 1TC), should have already been adressed earlier" ); break; case SID_MASA_1TC: hCPE->element_mode = IVAS_SCE; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index e4a08b0540fbb3f8a9fd3af399fd02f415d5d54a..62dab78ef5d7977c0a86c8a06c3c83c2730bf0aa 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -37,6 +37,7 @@ #include "rom_com.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" @@ -63,7 +64,13 @@ ivas_error ivas_dec( int16_t nb_bits_metadata[MAX_SCE]; int32_t output_Fs, ivas_total_brate; AUDIO_CONFIG output_config; +#ifdef NON_DIEGETIC_PAN + float pan_left, pan_right; +#endif ivas_error error; +#ifdef JBM_TSM_ON_TCS + float *p_output[MAX_OUTPUT_CHANNELS]; +#endif error = IVAS_ERR_OK; @@ -79,7 +86,11 @@ ivas_error ivas_dec( if ( st_ivas->bfi == 0 ) { +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_dec_setup( st_ivas, NULL, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_dec_setup( st_ivas ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -96,6 +107,13 @@ ivas_error ivas_dec( output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); +#ifdef JBM_TSM_ON_TCS + for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) + { + p_output[n] = &output[n][0]; + } +#endif + /*----------------------------------------------------------------* * Decoding + Rendering *----------------------------------------------------------------*/ @@ -133,19 +151,45 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_MC ) { +#ifdef JBM_TSM_ON_TCS +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, output_frame, p_output, p_output ); +#endif +#else +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output ); +#else ivas_ls_setup_conversion( st_ivas, output_frame, output ); +#endif +#endif } } else if ( st_ivas->ivas_format == ISM_FORMAT ) { /* Metadata decoding and configuration */ - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) { - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); + if ( ( error = ivas_ism_dtx_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + // VE: call ivas_ism_metadata_dec() with 'st_ivas' - TBD + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) + { + return error; + } } else /* ISM_MODE_DISC */ { - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL ); + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) + { + return error; + } } for ( n = 0; n < st_ivas->nchan_transport; n++ ) @@ -165,12 +209,22 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { ivas_param_ism_params_to_masa_param_mapping( st_ivas ); + ivas_dirac_dec_binaural( st_ivas, output, st_ivas->nchan_transport ); } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); } +#ifdef NON_DIEGETIC_PAN + else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) + { + pan_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; + pan_right = 1.f - pan_left; + v_multc( output[0], pan_right, output[1], output_frame ); + v_multc( output[0], pan_left, output[0], output_frame ); + } +#endif else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { ivas_param_ism_dec( st_ivas, output ); @@ -178,7 +232,11 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { /* Convert CICP19 -> Ambisonics */ +#ifdef JBM_TSM_ON_TCS + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#else ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#endif } } } @@ -189,46 +247,86 @@ ivas_error ivas_dec( { ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); } +#ifdef NON_DIEGETIC_PAN + else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) + { + pan_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; + pan_right = 1.f - pan_left; + v_multc( output[0], pan_right, output[1], output_frame ); + v_multc( output[0], pan_left, output[0], output_frame ); + } +#endif else if ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ +#ifdef JBM_TSM_ON_TCS + ivas_ism_render( st_ivas, p_output, output_frame ); +#else ivas_ism_render( st_ivas, output, output_frame ); +#endif } +#ifdef REND_DEBUGGING_REVISION +#ifdef DEBUGGING + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) +#else + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) +#endif +#else else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) +#endif { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ - ivas_ism2sba( output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_transport, output_frame, st_ivas->hIntSetup.ambisonics_order ); +#ifdef JBM_TSM_ON_TCS + ivas_ism2sba( p_output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_ism, output_frame, st_ivas->hIntSetup.ambisonics_order ); +#else + ivas_ism2sba( output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_ism, output_frame, st_ivas->hIntSetup.ambisonics_order ); +#endif } /* Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - ObjRenderIVASFrame( st_ivas, output, output_frame ); +#ifdef JBM_TSM_ON_TCS + if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) +#else + if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef FIX_197_CREND_INTERFACE if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, - IVAS_REND_AUDIO_CONFIG_7_1_4, - IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM, + AUDIO_CONFIG_7_1_4, + AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, +#ifdef JBM_TSM_ON_TCS + p_output, +#else output, +#endif output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#ifdef JBM_TSM_ON_TCS + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); #else - ivas_crend_process( st_ivas, output ); -#endif ivas_binaural_add_LFE( st_ivas, output_frame, output ); +#endif } #ifdef DEBUGGING else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { +#ifdef JBM_TSM_ON_TCS + ivas_binaural_cldfb( st_ivas, p_output ); +#else ivas_binaural_cldfb( st_ivas, output ); +#endif } #endif } @@ -244,7 +342,11 @@ ivas_error ivas_dec( if ( st_ivas->ivas_format == SBA_FORMAT ) { - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, 0 ); + ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, +#ifdef HODIRAC + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k, +#endif + 0 ); } else { @@ -259,7 +361,17 @@ ivas_error ivas_dec( if ( st_ivas->hQMetaData != NULL ) { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, st_ivas->hSpar->dirac_to_spar_md_bands ); + ivas_dirac_dec_read_BS( + ivas_total_brate, + st, + st_ivas->hDirAC, + st_ivas->hQMetaData, + &nb_bits_metadata[0], + st_ivas->sba_mode, +#ifdef HODIRAC + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k, +#endif + st_ivas->hSpar->dirac_to_spar_md_bands ); } if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) @@ -295,17 +407,46 @@ ivas_error ivas_dec( return error; } } - +#ifdef DEBUG_LBR_SBA + /* SCE Decoder Output */ + for ( int t = 0; t < 960; t++ ) + { + for ( int c = 0; c < st_ivas->nchan_transport; c++ ) + { + float val = output[c][t] / MAX16B_FLT; + dbgwrite( &val, sizeof( float ), 1, 1, "int_dec_core_out.raw" ); + } + } +#endif #ifdef DEBUG_SBA_AUDIO_DUMP /* Dump audio signal after core-decoding */ ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[0], "core-decoding" ); #endif + /* TCs remapping */ nchan_remapped = st_ivas->nchan_transport; if ( st_ivas->sba_dirac_stereo_flag ) { - nchan_remapped = CPE_CHANNELS; - ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame ); + nchan_remapped = nchan_out; + + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); + + if ( st_ivas->hSpar->hPCA != NULL ) + { + ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); + } + + ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi +#ifdef SPAR_TUNING + , + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) +#endif + ); + } + + ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame, st_ivas->ivas_format == MC_FORMAT ); } else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( ivas_total_brate > IVAS_SID_5k2 || ( ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) { @@ -327,6 +468,12 @@ ivas_error ivas_dec( { ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); } +#ifdef JBM_TSM_ON_TCS + else if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->renderer_type != RENDERER_DISABLE ) + { + ivas_spar_dec_agc_pca( st_ivas, output, output_frame ); + } +#endif } if ( st_ivas->ivas_format == MASA_FORMAT ) @@ -335,7 +482,20 @@ ivas_error ivas_dec( } else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { +#ifdef FIX_441_SBA_PARAMBIN_GAINS + float gain; + + if ( nchan_remapped == 1 ) + { + gain = 1.4454f; + } + else + { + gain = 1.3657f; + } +#else float gain = 0.8414f; /* Todo: Temporary gain for roughly matching the loudness. To be tuned later together with other outputs. */ +#endif for ( n = 0; n < nchan_remapped; n++ ) { @@ -352,14 +512,25 @@ ivas_error ivas_dec( { if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { - ivas_sba_linear_renderer( output, output_frame, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_sba_linear_renderer( p_output, output_frame, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_sba_linear_renderer( output, output_frame, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } } else if ( st_ivas->renderer_type == RENDERER_DIRAC ) { +#ifdef JBM_TSM_ON_TCS + ivas_dirac_dec( st_ivas, output, nchan_remapped ); +#else ivas_dirac_dec( st_ivas, output, nchan_remapped, NULL, NULL, -1 ); +#endif } } - else /* SBA_MODE_SPAR */ + else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) { ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ } @@ -371,10 +542,6 @@ ivas_error ivas_dec( /* LFE channel decoder */ if ( st_ivas->mc_mode == MC_MODE_MCT ) { - if ( st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg == NULL ) - { - st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg = st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg; - } ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); } @@ -398,45 +565,176 @@ ivas_error ivas_dec( if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) { +#ifdef JBM_TSM_ON_TCS + ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); +#else ivas_mc2sba( st_ivas->hTransSetup, output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); +#endif } /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef FIX_197_CREND_INTERFACE if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, - getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), - getRendAudioConfigFromIvasAudioConfig( st_ivas->hOutSetup.output_config ), + st_ivas->intern_config, + st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, +#ifdef JBM_TSM_ON_TCS + p_output, +#else output, +#endif output_Fs ) ) != IVAS_ERR_OK ) { return error; } + +#ifdef JBM_TSM_ON_TCS + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); #else - ivas_crend_process( st_ivas, output ); + ivas_binaural_add_LFE( st_ivas, output_frame, output ); #endif + } + else if ( st_ivas->renderer_type == RENDERER_MC ) + { +#ifdef JBM_TSM_ON_TCS +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, output_frame, p_output, p_output ); +#endif +#else +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output ); +#else + ivas_ls_setup_conversion( st_ivas, output_frame, output ); +#endif +#endif + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { +#ifdef JBM_TSM_ON_TCS + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#else + ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#endif + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { +#ifdef JBM_TSM_ON_TCS + if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); +#else + if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } + ivas_binaural_add_LFE( st_ivas, output_frame, output ); +#endif + } + } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); + + ivas_mc_paramupmix_dec_read_BS( ivas_total_brate, st, st_ivas, st_ivas->hMCParamUpmix, &nb_bits_metadata[0] ); + + if ( ( error = ivas_mct_dec( st_ivas, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + + mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); + + ivas_mc_paramupmix_dec( st_ivas, output ); + + /* HP filtering */ + for ( n = 0; n < st_ivas->nchan_transport; n++ ) + { + if ( n != LFE_CHANNEL ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + } + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) + { +#ifdef JBM_TSM_ON_TCS + ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); +#else + ivas_mc2sba( st_ivas->hTransSetup, output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); +#endif + } + + /* Rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, output, output_Fs ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } +#ifdef JBM_TSM_ON_TCS + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); +#else ivas_binaural_add_LFE( st_ivas, output_frame, output ); +#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { - ivas_ls_setup_conversion( st_ivas, output_frame, output ); + if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) + { +#ifdef JBM_TSM_ON_TCS + ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, output ); +#endif + } + else + { +#ifdef JBM_TSM_ON_TCS + ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output_frame, p_output, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output_frame, output ); +#endif + } } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { +#ifdef JBM_TSM_ON_TCS + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#else ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { - ObjRenderIVASFrame( st_ivas, output, output_frame ); +#ifdef JBM_TSM_ON_TCS + if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) +#else + if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } +#ifdef JBM_TSM_ON_TCS + ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); +#else ivas_binaural_add_LFE( st_ivas, output_frame, output ); +#endif } } +#endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { /* read Parametric MC parameters from the bitstream */ @@ -466,11 +764,28 @@ ivas_error ivas_dec( /* Rendering */ if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) { +#ifdef JBM_TSM_ON_TCS +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, output_frame, p_output, p_output ); +#endif +#else +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output ); +#else + ivas_ls_setup_conversion( st_ivas, output_frame, output ); +#endif +#endif } else { +#ifdef JBM_TSM_ON_TCS + ivas_param_mc_dec( st_ivas, p_output ); +#else ivas_param_mc_dec( st_ivas, output ); +#endif } } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -536,7 +851,7 @@ ivas_error ivas_dec( if ( st_ivas->sba_dirac_stereo_flag ) /* use the flag to trigger the DFT upmix */ { - ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame ); + ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame, 1 ); } /* HP filtering */ @@ -552,11 +867,19 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) /* rendering to CICPxx and Ambisonics */ { +#ifdef JBM_TSM_ON_TCS + ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport ); +#else ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); +#endif if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { +#ifdef JBM_TSM_ON_TCS + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#else ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); +#endif } else if ( st_ivas->intern_config == AUDIO_CONFIG_5_1 && ( output_config == AUDIO_CONFIG_5_1_2 || output_config == AUDIO_CONFIG_5_1_4 || output_config == AUDIO_CONFIG_7_1 ) ) { @@ -579,14 +902,21 @@ ivas_error ivas_dec( * - compensation for saturation * - float to integer conversion *----------------------------------------------------------------*/ +#ifdef JBM_TSM_ON_TCS + ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, output_frame, st_ivas->BER_detect ); +#ifdef DEBUGGING + st_ivas->noClipping += +#endif + ivas_syn_output( p_output, output_frame, nchan_out, data ); +#else ivas_limiter_dec( st_ivas->hLimiter, output, nchan_out, output_frame, st_ivas->BER_detect ); #ifdef DEBUGGING st_ivas->noClipping += #endif ivas_syn_output( output, output_frame, nchan_out, data ); - +#endif /*----------------------------------------------------------------* * Common updates *----------------------------------------------------------------*/ @@ -594,9 +924,7 @@ ivas_error ivas_dec( if ( !st_ivas->bfi ) /* do not update if first frame(s) are lost or NO_DATA */ { st_ivas->hDecoderConfig->last_ivas_total_brate = ivas_total_brate; -#ifdef SBA_BR_SWITCHING st_ivas->last_active_ivas_total_brate = ( ivas_total_brate <= IVAS_SID_5k2 ) ? st_ivas->last_active_ivas_total_brate : ivas_total_brate; -#endif } if ( st_ivas->ini_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) ) /* keep "st_ivas->ini_frame = 0" until first good received frame */ diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index 2a99953d23d441566b52f8058d4aaf3194202dce..e5be65ae24dc7204e3eb20cf21e643f4f150f566 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -134,7 +134,7 @@ void ivas_decision_matrix_dec( } else if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) { - /* ISm Low-rate mode -> always WB, ACELP core, IC coder_type */ + /* ISM Low-rate mode -> always WB, ACELP core, IC coder_type */ st->core = ACELP_CORE; } else if ( st->element_mode == IVAS_CPE_MDCT ) @@ -167,7 +167,7 @@ void ivas_decision_matrix_dec( { if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) { - /* ISm Low-rate mode */ + /* ISM Low-rate mode */ st->bwidth = WB; st->coder_type = INACTIVE; *sharpFlag = 0; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 557af7a49782c4bdc14cd7a5491c38a110e67fea..cb7c9f5b9afe00a869f2a6d93fcadef4e3caa299 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -37,6 +37,7 @@ #include "cnst.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" @@ -49,43 +50,35 @@ /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ -static void ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); + +static ivas_error ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem +#ifdef HODIRAC + , + int16_t hodirac +#endif +); static void ivas_dirac_free_mem( DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); -static void initDiffuseResponses( - float *diffuse_response_function, - const int16_t num_channels, - AUDIO_CONFIG output_config, - IVAS_OUTPUT_SETUP hOutSetup, - const int16_t ambisonics_order, - const IVAS_FORMAT ivas_format, - int16_t *num_ele_spk_no_diffuse_rendering, - AUDIO_CONFIG transport_config ); +static void initDiffuseResponses( float *diffuse_response_function, const int16_t num_channels, AUDIO_CONFIG output_config, IVAS_OUTPUT_SETUP hOutSetup, const int16_t ambisonics_order, const IVAS_FORMAT ivas_format, int16_t *num_ele_spk_no_diffuse_rendering, AUDIO_CONFIG transport_config ); static void computeIntensityVector_dec( float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const int16_t num_frequency_bands, float *intensity_real_x, float *intensity_real_y, float *intensity_real_z ); -static void protoSignalComputation_shd( - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], - float *proto_direct_buffer_f, - float *proto_diffuse_buffer_f, - float *reference_power, - const int16_t slot_index, - const int16_t num_inputs, - const int16_t num_outputs_diff, - const int16_t num_freq_bands, - float *p_Rmat ); +static void protoSignalComputation_shd( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_direct_buffer_f, float *proto_diffuse_buffer_f, float *reference_power, const int16_t slot_index, const int16_t num_inputs, const int16_t num_outputs_diff, const int16_t num_freq_bands, float *p_Rmat ); static void protoSignalComputation1( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t slot_index, const int16_t num_outputs_diff, const int16_t num_freq_bands ); static void protoSignalComputation2( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t isloudspeaker, const int16_t slot_index, const int16_t num_freq_bands, MASA_STEREO_TYPE_DETECT *stereo_type_detect ); -static void protoSignalComputation4( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t slot_index, const int16_t num_outputs_diff, const int16_t num_freq_bands, const float *mtx_hoa_decoder, const int16_t nchan_transport ); +static void protoSignalComputation4( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, float *proto_direct_buffer_f, float *reference_power, float *proto_power_smooth, const int16_t slot_index, const int16_t num_outputs_diff, const int16_t num_freq_bands, const float *mtx_hoa_decoder, const int16_t nchan_transport +#ifdef SPAR_TUNING + , + const int16_t *sba_map_tc_ind +#endif +); static void ivas_dirac_dec_compute_diffuse_proto( DIRAC_DEC_HANDLE hDirAC, const int16_t slot_idx ); - static void computeDirectionAngles( float *intensity_real_x, float *intensity_real_y, float *intensity_real_z, const int16_t num_frequency_bands, int16_t *azimuth, int16_t *elevation ); static void ivas_masa_init_stereotype_detection( MASA_STEREO_TYPE_DETECT *stereo_type_detect ); @@ -94,6 +87,8 @@ static void ivas_masa_stereotype_detection( MASA_STEREO_TYPE_DETECT *stereo_type static void ivas_lfe_synth_with_cldfb( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float RealBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float ImagBufferLfe[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const int16_t slot_index, const int16_t subframe_index, const int16_t nchan_transport ); +static void rotateAziEle_DirAC( int16_t *azi, int16_t *ele, const int16_t band1, const int16_t band2, const float *p_Rmat ); + /*------------------------------------------------------------------------- * ivas_dirac_dec_open() @@ -125,12 +120,8 @@ ivas_error ivas_dirac_dec_open( *-------------------------------------------------------------------------*/ ivas_error ivas_dirac_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef SBA_BR_SWITCHING + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ -#else - const DIRAC_CONFIG_FLAG flag_config /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ -#endif ) { DIRAC_DEC_HANDLE hDirAC; @@ -149,17 +140,16 @@ ivas_error ivas_dirac_dec_config( int32_t output_Fs, ivas_total_brate; ivas_error error; int16_t nchan_transport_orig; -#ifdef SBA_BR_SWITCHING DIRAC_CONFIG_FLAG flag_config; flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; -#endif error = IVAS_ERR_OK; hDirAC = NULL; output_Fs = st_ivas->hDecoderConfig->output_Fs; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + if ( flag_config == DIRAC_RECONFIGURE ) { hDirAC = st_ivas->hDirAC; @@ -180,7 +170,10 @@ ivas_error ivas_dirac_dec_config( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) ); } nchan_transport_old = 0; - +#ifdef JBM_TSM_ON_TCS + hDirAC->hParamIsm = NULL; + hDirAC->hParamIsmRendering = NULL; +#endif st_ivas->hDirAC = hDirAC; } @@ -193,7 +186,12 @@ ivas_error ivas_dirac_dec_config( nchan_transport_orig = st_ivas->nchan_transport; if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { - st_ivas->nchan_transport = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order ); + st_ivas->nchan_transport = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order +#ifdef SPAR_TUNING + , + st_ivas->hDecoderConfig->ivas_total_brate +#endif + ); } nchan_transport = st_ivas->nchan_transport; @@ -205,11 +203,7 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_RECONFIGURE && st_ivas->ivas_format == SBA_FORMAT ) { int16_t tmp1, tmp2, tmp3; -#ifdef SBA_BR_SWITCHING_RECONFIG ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &nchan_transport_old, st_ivas->sba_planar, &tmp1, &tmp2, &tmp3 ); -#else - ivas_sba_config( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->sba_analysis_order, -1, &nchan_transport_old, st_ivas->sba_planar, &tmp1, &tmp2, &tmp3 ); -#endif } /*-----------------------------------------------------------------* @@ -275,17 +269,76 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); +#ifdef JBM_TSM_ON_TCS + set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hDirAC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + hDirAC->subframes_rendered = 0; + hDirAC->slots_rendered = 0; + hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; +#else hDirAC->subframe_nbslots = (int16_t) ( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); hDirAC->nb_subframes = CLDFB_NO_COL_MAX / hDirAC->subframe_nbslots; assert( hDirAC->nb_subframes <= MAX_PARAM_SPATIAL_SUBFRAMES ); +#endif + } + +#ifdef HODIRAC + if ( st_ivas->ivas_format == SBA_FORMAT && flag_config == DIRAC_RECONFIGURE && ( ( ivas_total_brate > IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate <= IVAS_256k ) || ( ivas_total_brate <= IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate > IVAS_256k ) ) ) + { + if ( st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k && hDirAC->azimuth2 == NULL ) + { + hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); + hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); + hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); + hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); + for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + { + hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + set_s( hDirAC->azimuth2[i], 0, hDirAC->num_freq_bands ); + hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + set_s( hDirAC->elevation2[i], 0, hDirAC->num_freq_bands ); + hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + set_f( hDirAC->energy_ratio2[i], 0.0f, hDirAC->num_freq_bands ); + hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + set_f( hDirAC->spreadCoherence2[i], 0.0f, hDirAC->num_freq_bands ); + } + } + else if ( st_ivas->hDecoderConfig->ivas_total_brate <= IVAS_256k && hDirAC->azimuth2 != NULL ) + { + for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + { + free( hDirAC->azimuth2[i] ); + free( hDirAC->elevation2[i] ); + free( hDirAC->energy_ratio2[i] ); + free( hDirAC->spreadCoherence2[i] ); + } + + free( hDirAC->azimuth2 ); + free( hDirAC->elevation2 ); + free( hDirAC->energy_ratio2 ); + free( hDirAC->spreadCoherence2 ); + + hDirAC->azimuth2 = NULL; + hDirAC->elevation2 = NULL; + hDirAC->energy_ratio2 = NULL; + hDirAC->spreadCoherence2 = NULL; + } } +#endif /* band config needed only for SPAR with FOA output */ - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->sba_mode == SBA_MODE_SPAR ) + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->sba_mode == SBA_MODE_SPAR +#ifdef HODIRAC + /*DLB : why is this needed ?*/ + && ivas_total_brate < IVAS_256k +#endif + ) { return IVAS_ERR_OK; } + if ( nchan_transport_orig > 2 && hDirAC->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC ) { hDirAC->synthesisConf = DIRAC_SYNTHESIS_PSD_LS; @@ -322,7 +375,10 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); - hDirAC->frequency_axis = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + if ( ( hDirAC->frequency_axis = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->frequency_axis, 0.0f, hDirAC->num_freq_bands ); ivas_dirac_dec_get_frequency_axis( hDirAC->frequency_axis, output_Fs, hDirAC->num_freq_bands ); @@ -332,7 +388,10 @@ ivas_error ivas_dirac_dec_config( { if ( ( flag_config == DIRAC_RECONFIGURE && hDirAC->masa_stereo_type_detect == NULL ) || flag_config == DIRAC_OPEN ) { - hDirAC->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ); + if ( ( hDirAC->masa_stereo_type_detect = (MASA_STEREO_TYPE_DETECT *) malloc( sizeof( MASA_STEREO_TYPE_DETECT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } ivas_masa_init_stereotype_detection( hDirAC->masa_stereo_type_detect ); } @@ -400,25 +459,48 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { num_outputs_dir_old = hDirAC->num_outputs_dir; - hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ); + if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } num_outputs_diff_old = hDirAC->num_outputs_diff; - hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ); + if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } if ( hDirAC->num_outputs_dir != num_outputs_dir_old && flag_config == DIRAC_RECONFIGURE ) { free( hDirAC->proto_index_dir ); - hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ); + if ( ( hDirAC->proto_index_dir = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } set_s( hDirAC->proto_index_dir, 0, hDirAC->num_outputs_dir ); if ( hDirAC->num_outputs_diff != num_outputs_diff_old && flag_config == DIRAC_RECONFIGURE ) { free( hDirAC->proto_index_diff ); - hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ); + if ( ( hDirAC->proto_index_diff = (int16_t *) malloc( sizeof( int16_t ) * hDirAC->num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } set_s( hDirAC->proto_index_diff, 0, hDirAC->num_outputs_diff ); +#ifdef SPAR_TUNING + hDirAC->sba_map_tc = sba_map_tc; + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) + { + if ( st_ivas->sba_order > SBA_FOA_ORDER && ivas_total_brate >= IVAS_512k ) + { + hDirAC->sba_map_tc = sba_map_tc_512; + } + } +#endif + if ( nchan_transport == 1 ) { hDirAC->num_protos_ambi = 1; @@ -524,10 +606,17 @@ ivas_error ivas_dirac_dec_config( for ( k = 0; k < min( hDirAC->num_outputs_dir, hDirAC->num_protos_dir ); k++ ) { +#ifdef SPAR_TUNING + if ( hDirAC->sba_map_tc[k] < hDirAC->num_outputs_dir ) + { + hDirAC->proto_index_dir[hDirAC->sba_map_tc[k]] = k; + } +#else if ( sba_map_tc[k] < hDirAC->num_outputs_dir ) { hDirAC->proto_index_dir[sba_map_tc[k]] = k; } +#endif } } } @@ -535,14 +624,20 @@ ivas_error ivas_dirac_dec_config( /* direct/diffuse responses */ if ( flag_config == DIRAC_OPEN ) { - hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ); + if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } /* reallocate static memory */ else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->num_outputs_dir != num_outputs_dir_old ) { free( hDirAC->diffuse_response_function ); hDirAC->diffuse_response_function = NULL; - hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ); + if ( ( hDirAC->diffuse_response_function = (float *) malloc( sizeof( float ) * hDirAC->num_outputs_dir ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } if ( ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) || ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) ) @@ -560,13 +655,19 @@ ivas_error ivas_dirac_dec_config( { if ( flag_config == DIRAC_OPEN ) { - hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->hoa_encoder && ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) { free( hDirAC->hoa_encoder ); hDirAC->hoa_encoder = NULL; - hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( hDirAC->hoa_encoder = (float *) malloc( nchan_out_woLFE * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } set_f( hDirAC->hoa_encoder, 0.0f, nchan_out_woLFE * hDirAC->num_outputs_diff ); compute_hoa_encoder_mtx( ls_azimuth, ls_elevation, hDirAC->hoa_encoder, hDirAC->num_outputs_diff, hDirAC->hOutSetup.ambisonics_order ); @@ -588,10 +689,11 @@ ivas_error ivas_dirac_dec_config( if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) { - if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata ) + if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { vbap_free_data( &( st_ivas->hVBAPdata ) ); } + if ( ( error = vbap_init_data( &( st_ivas->hVBAPdata ), ls_azimuth, ls_elevation, nchan_out_woLFE ) ) != IVAS_ERR_OK ) { return error; @@ -599,13 +701,13 @@ ivas_error ivas_dirac_dec_config( } else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata ) + if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { vbap_free_data( &( st_ivas->hVBAPdata ) ); } hDirAC->hoa_decoder = NULL; } - else if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata ) + else if ( flag_config == DIRAC_RECONFIGURE && st_ivas->hVBAPdata != NULL ) { vbap_free_data( &( st_ivas->hVBAPdata ) ); } @@ -648,15 +750,18 @@ ivas_error ivas_dirac_dec_config( if ( ( flag_config == DIRAC_OPEN && hDirAC->proto_signal_decorr_on ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->proto_signal_decorr_on && !proto_signal_decorr_on_old ) ) ) { - ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, - nchan_transport > 2 ? 4 : nchan_transport, - output_Fs ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), + &( hDirAC->h_freq_domain_decorr_ap_state ), + hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + hDirAC->frequency_axis, + nchan_transport > 2 ? 4 : nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( flag_config == DIRAC_RECONFIGURE && ( !hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) ) { @@ -664,37 +769,53 @@ ivas_error ivas_dirac_dec_config( } else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) { -#ifdef SBA_BR_SWITCHING if ( nchan_transport != nchan_transport_old || hDirAC->num_outputs_diff != num_outputs_diff_old || flag_config_inp == DIRAC_RECONFIGURE_MODE ) -#else - if ( ( nchan_transport != nchan_transport_old ) || ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) -#endif { /* close and reopen the decorrelator */ ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); - ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), - &( hDirAC->h_freq_domain_decorr_ap_state ), - hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - hDirAC->frequency_axis, - nchan_transport > 2 ? 4 : nchan_transport, - output_Fs ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDirAC->h_freq_domain_decorr_ap_params ), + &( hDirAC->h_freq_domain_decorr_ap_state ), + hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + hDirAC->frequency_axis, + nchan_transport > 2 ? 4 : nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } } } /* output synthesis */ if ( flag_config == DIRAC_OPEN ) { - ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs ); + if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k +#endif + ) ) != IVAS_ERR_OK ) + { + return error; + } hDirAC->h_output_synthesis_psd_params.use_onset_filters = hDirAC->proto_signal_decorr_on; } else if ( ( flag_config == DIRAC_RECONFIGURE ) && ( ( nchan_transport != nchan_transport_old ) || ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) ) { ivas_dirac_dec_output_synthesis_close( hDirAC ); - ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs ); + + if ( ( ivas_dirac_dec_output_synthesis_open( hDirAC, st_ivas->renderer_type, nchan_transport, output_Fs +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k +#endif + ) ) != IVAS_ERR_OK ) + { + return error; + } hDirAC->h_output_synthesis_psd_params.use_onset_filters = hDirAC->proto_signal_decorr_on; } @@ -719,13 +840,19 @@ ivas_error ivas_dirac_dec_config( { if ( flag_config == DIRAC_OPEN || ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_frame_f == NULL ) ) { - hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ); + if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } else if ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->num_protos_diff != num_protos_diff_old ) ) { proto_frame_f_old = hDirAC->proto_frame_f; free( proto_frame_f_old ); - hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ); + if ( ( hDirAC->proto_frame_f = (float *) malloc( sizeof( float ) * 2 * hDirAC->num_protos_diff * hDirAC->num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } } @@ -742,13 +869,19 @@ ivas_error ivas_dirac_dec_config( { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - hDirAC->buffer_intensity_real[i][j] = (float *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + if ( ( hDirAC->buffer_intensity_real[i][j] = (float *) malloc( CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->buffer_intensity_real[i][j], 0.0f, CLDFB_NO_CHANNELS_MAX ); } } if ( hDirAC->buffer_energy == NULL ) { - hDirAC->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); + if ( ( hDirAC->buffer_energy = (float *) malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } } set_f( hDirAC->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); } @@ -773,14 +906,27 @@ ivas_error ivas_dirac_dec_config( } /* output synthesis */ - ivas_dirac_dec_output_synthesis_init( hDirAC, nchan_out_woLFE ); + ivas_dirac_dec_output_synthesis_init( hDirAC, nchan_out_woLFE +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k +#endif + ); /* Allocate stack memory */ if ( flag_config != DIRAC_OPEN ) { ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); } - ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ) ); + if ( ( error = ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ) +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k +#endif + ) ) != IVAS_ERR_OK ) + { + return error; + } mvs2s( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); @@ -790,10 +936,37 @@ ivas_error ivas_dirac_dec_config( hDirAC->dirac_bs_md_write_idx = 0; hDirAC->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; - - if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->mc_mode == MC_MODE_MCMASA ) +#ifdef FIX_391_SBA + hDirAC->hConfig->dec_param_estim_old = hDirAC->hConfig->dec_param_estim; +#endif + if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; +#ifdef JBM_TSM_ON_TCS + { + int16_t map_idx; + set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) + { + hDirAC->render_to_md_map[map_idx] = map_idx; + } + } +#endif + } + else if ( st_ivas->ivas_format == MASA_FORMAT ) + { + hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; + hDirAC->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; +#ifdef JBM_TSM_ON_TCS + { + int16_t map_idx; + set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) + { + hDirAC->render_to_md_map[map_idx] = map_idx; + } + } +#endif } else { @@ -816,47 +989,137 @@ ivas_error ivas_dirac_dec_config( hDirAC->dirac_read_idx = 0; hDirAC->dirac_estimator_idx = 0; } +#ifdef JBM_TSM_ON_TCS + { + int16_t map_idx; + set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; map_idx++ ) + { + hDirAC->render_to_md_map[map_idx] = hDirAC->dirac_read_idx + map_idx * num_slots_in_subfr / JBM_CLDFB_SLOTS_IN_SUBFRAME; + } + } +#endif + } + + if ( ( hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->diffuseness_vector = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } - hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->diffuseness_vector = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { - hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + if ( ( hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_s( hDirAC->azimuth[i], 0, hDirAC->num_freq_bands ); - hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_s( hDirAC->elevation[i], 0, hDirAC->num_freq_bands ); - hDirAC->diffuseness_vector[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->diffuseness_vector[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->diffuseness_vector[i], 1.0f, hDirAC->num_freq_bands ); - hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + if ( ( hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->spreadCoherence[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); } - if ( st_ivas->ivas_format == MASA_FORMAT ) + if ( st_ivas->ivas_format == MASA_FORMAT +#ifdef HODIRAC + || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ) +#endif + ) { - hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); + if ( ( hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { - hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + if ( ( hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_s( hDirAC->azimuth2[i], 0, hDirAC->num_freq_bands ); - hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_s( hDirAC->elevation2[i], 0, hDirAC->num_freq_bands ); - hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + if ( ( hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->energy_ratio2[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->spreadCoherence2[i], 0.0f, hDirAC->num_freq_bands ); } } @@ -873,31 +1136,216 @@ ivas_error ivas_dirac_dec_config( hDirAC->dithering_seed = DIRAC_DITH_SEED; st_ivas->hDirAC = hDirAC; } - - return error; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_close() - * - * Close DirAC memories - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_close( - DIRAC_DEC_HANDLE hDirAC /* i/o: decoder DirAC handle */ -) -{ - int16_t i, j; - - /* Config & CLDFB */ - if ( hDirAC->hConfig != NULL ) +#ifdef FIX_391_SBA + else if ( hDirAC->hConfig->dec_param_estim_old != hDirAC->hConfig->dec_param_estim ) { - free( hDirAC->hConfig ); - hDirAC->hConfig = NULL; - } - - /* close Output synthesis sub-module */ + int16_t num_slots_in_subfr; + num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + if ( ( hDirAC->hConfig->dec_param_estim_old != hDirAC->hConfig->dec_param_estim ) ) + { + + for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + { + if ( hDirAC->azimuth[i] != NULL ) + { + free( hDirAC->azimuth[i] ); + hDirAC->azimuth[i] = NULL; + } + if ( hDirAC->elevation[i] != NULL ) + { + free( hDirAC->elevation[i] ); + hDirAC->elevation[i] = NULL; + } + if ( hDirAC->diffuseness_vector[i] != NULL ) + { + free( hDirAC->diffuseness_vector[i] ); + hDirAC->diffuseness_vector[i] = NULL; + } + if ( hDirAC->energy_ratio1[i] != NULL ) + { + free( hDirAC->energy_ratio1[i] ); + hDirAC->energy_ratio1[i] = NULL; + } + if ( hDirAC->spreadCoherence[i] != NULL ) + { + free( hDirAC->spreadCoherence[i] ); + hDirAC->spreadCoherence[i] = NULL; + } + if ( hDirAC->surroundingCoherence[i] != NULL ) + { + free( hDirAC->surroundingCoherence[i] ); + hDirAC->surroundingCoherence[i] = NULL; + } + } + if ( hDirAC->azimuth != NULL ) + { + free( hDirAC->azimuth ); + hDirAC->azimuth = NULL; + } + if ( hDirAC->elevation != NULL ) + { + free( hDirAC->elevation ); + hDirAC->elevation = NULL; + } + if ( hDirAC->diffuseness_vector != NULL ) + { + free( hDirAC->diffuseness_vector ); + hDirAC->diffuseness_vector = NULL; + } + if ( hDirAC->energy_ratio1 != NULL ) + { + free( hDirAC->energy_ratio1 ); + hDirAC->energy_ratio1 = NULL; + } + if ( hDirAC->spreadCoherence != NULL ) + { + free( hDirAC->spreadCoherence ); + hDirAC->spreadCoherence = NULL; + } + if ( hDirAC->surroundingCoherence != NULL ) + { + free( hDirAC->surroundingCoherence ); + hDirAC->surroundingCoherence = NULL; + } + } + hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ) * num_slots_in_subfr; + hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; + hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; + hDirAC->dirac_read_idx = 0; + hDirAC->dirac_estimator_idx = 0; + if ( ( hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->diffuseness_vector = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + + if ( ( hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) + { + if ( ( hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hDirAC->azimuth[i], 0, hDirAC->num_freq_bands ); + + if ( ( hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_s( hDirAC->elevation[i], 0, hDirAC->num_freq_bands ); + + if ( ( hDirAC->diffuseness_vector[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hDirAC->diffuseness_vector[i], 1.0f, hDirAC->num_freq_bands ); + + if ( ( hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); + + if ( ( hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hDirAC->spreadCoherence[i], 0.0f, hDirAC->num_freq_bands ); + + if ( ( hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } + set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); + } + } + } +#endif +#ifdef JBM_TSM_ON_TCS + /* allocate transport channels*/ + if ( flag_config == DIRAC_OPEN ) + { + if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) + { + if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) + { + int16_t nchan_to_allocate; + + nchan_to_allocate = nchan_transport; + if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) + { + nchan_to_allocate++; /* we need a channel for the CNG in this case*/ + } + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + nchan_to_allocate = 2 * BINAURAL_CHANNELS; + } + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_to_allocate, nchan_to_allocate, hDirAC->slot_size ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + } + +#endif /* JBM_TMS_ON_TCS*/ + + return error; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_close() + * + * Close DirAC memories + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec_close( + DIRAC_DEC_HANDLE *hDirAC_out /* i/o: decoder DirAC handle */ +) +{ + int16_t i, j; + DIRAC_DEC_HANDLE hDirAC; + + if ( hDirAC_out == NULL || *hDirAC_out == NULL ) + { + return; + } + + hDirAC = *hDirAC_out; + + /* Config & CLDFB */ + if ( hDirAC->hConfig != NULL ) + { + free( hDirAC->hConfig ); + hDirAC->hConfig = NULL; + } + + /* close Output synthesis sub-module */ ivas_dirac_dec_output_synthesis_close( hDirAC ); /* close Decorrelator sub-module */ @@ -1108,7 +1556,8 @@ void ivas_dirac_dec_close( ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); - free( hDirAC ); + free( *hDirAC_out ); + *hDirAC_out = NULL; return; } @@ -1120,12 +1569,21 @@ void ivas_dirac_dec_close( * Allocate stack memory for DirAC renderer *------------------------------------------------------------------------*/ -static void ivas_dirac_alloc_mem( +static ivas_error ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, - DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ) + DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem +#ifdef HODIRAC + , + int16_t hodirac +#endif +) { int16_t num_freq_bands, num_freq_bands_diff, size; +#ifdef HODIRAC + int16_t size_ho; + int16_t size_pf; +#endif int16_t num_outputs_dir, num_outputs_diff; int16_t num_protos_dir; @@ -1138,6 +1596,18 @@ static void ivas_dirac_alloc_mem( num_outputs_diff = hDirAC->num_outputs_diff; size = num_freq_bands * num_outputs_dir; +#ifdef HODIRAC + if ( hodirac ) + { + size_ho = size * DIRAC_HO_NUMSECTORS; + size_pf = num_freq_bands * DIRAC_HO_NUMSECTORS; + } + else + { + size_ho = size; + size_pf = num_freq_bands; + } +#endif /* PSD related buffers */ hDirAC_mem->cy_auto_dir_smooth = NULL; @@ -1147,17 +1617,35 @@ static void ivas_dirac_alloc_mem( hDirAC_mem->frame_dec_f = NULL; if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ); + if ( ( hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->cy_auto_dir_smooth, size ); - hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ); + + if ( ( hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->proto_power_smooth, size ); - hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ); + + if ( ( hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->proto_power_diff_smooth, size ); - hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ); + + if ( ( hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->direct_responses_square, size ); if ( hDirAC->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) { - hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ); + if ( ( hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } hDirAC->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; @@ -1166,24 +1654,47 @@ static void ivas_dirac_alloc_mem( hDirAC->h_output_synthesis_psd_state.direct_responses_square = hDirAC_mem->direct_responses_square; /* Target and smoothed nrg factors/gains */ - hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size ); +#ifdef HODIRAC + if ( ( hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) +#else + if ( ( hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) +#endif + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); + if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * size ); + if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->cy_auto_diff_smooth, size ); } else { - hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands_diff ); + if ( ( hDirAC_mem->cy_auto_diff_smooth = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->cy_auto_diff_smooth, num_outputs_diff * num_freq_bands_diff ); } hDirAC->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; hDirAC->h_output_synthesis_psd_state.cy_auto_diff_smooth = hDirAC_mem->cy_auto_diff_smooth; /*Responses (gains/factors)*/ - hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size ); +#ifdef HODIRAC + if ( ( hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) +#else + if ( ( hDirAC_mem->direct_responses = (float *) malloc( sizeof( float ) * size ) ) == NULL ) +#endif + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } set_zero( hDirAC_mem->direct_responses, size ); + + hDirAC->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; /* Prototypes */ @@ -1191,16 +1702,26 @@ static void ivas_dirac_alloc_mem( hDirAC_mem->proto_diffuse_buffer_f = NULL; if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { - hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ); + if ( ( hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + if ( hDirAC->proto_signal_decorr_on ) { if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ); + if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } else { - hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ); + if ( ( hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } } @@ -1210,11 +1731,27 @@ static void ivas_dirac_alloc_mem( /* Gains/power factors*/ hDirAC_mem->direct_power_factor = NULL; hDirAC_mem->diffuse_power_factor = NULL; + if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { - hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ); - hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ); +#ifdef HODIRAC + if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) +#else + if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ) ) == NULL ) +#endif + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } +#ifdef HODIRAC + if ( ( hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) +#else + if ( ( hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ) ) == NULL ) +#endif + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } + hDirAC->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; hDirAC->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; @@ -1224,10 +1761,16 @@ static void ivas_dirac_alloc_mem( { if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { - hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ); + if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } if ( hDirAC->proto_signal_decorr_on ) { - hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ); + if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } } @@ -1235,15 +1778,22 @@ static void ivas_dirac_alloc_mem( { if ( num_protos_dir > 2 ) { - hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ); + if ( ( hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } + if ( hDirAC->proto_signal_decorr_on ) { - hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ); + if ( ( hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } } } - return; + return IVAS_ERR_OK; } @@ -1324,12 +1874,14 @@ void ivas_dirac_dec_read_BS( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata */ int16_t *nb_bits, /* o : number of bits read */ const SBA_MODE sba_mode, /* i : SBA mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ +#ifdef HODIRAC + const int16_t hodirac, /* i : HO-Dirac flag */ +#endif + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { int16_t i, j, b, dir, orig_dirac_bands; int16_t next_bit_pos_orig; - *nb_bits = 0; if ( !st->bfi && ivas_total_brate > IVAS_SID_5k2 ) { @@ -1419,7 +1971,12 @@ void ivas_dirac_dec_read_BS( hQMetaData->q_direction[0].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES; } - *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ) ); + *nb_bits += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ) +#ifdef HODIRAC + , + hodirac +#endif + ); } #ifdef DEBUGGING @@ -1486,7 +2043,13 @@ void ivas_dirac_dec_read_BS( if ( hDirAC != NULL ) { - ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, sba_mode, dirac_to_spar_md_bands ); + ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, sba_mode +#ifdef HODIRAC + , + hodirac +#endif + , + dirac_to_spar_md_bands ); } return; @@ -1505,7 +2068,10 @@ void ivas_qmetadata_to_dirac( MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const SBA_MODE sba_mode, /* i : SBA mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ +#ifdef HODIRAC + const int16_t hodirac, /* i : HO-DirAC flag*/ +#endif + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { int16_t block, band; @@ -1518,44 +2084,59 @@ void ivas_qmetadata_to_dirac( int16_t *band_mapping; int16_t *band_grouping; int16_t start_band; - int16_t nbands; - int16_t nblocks; + int16_t nbands = 0; + int16_t nblocks = 0; int16_t qBand_idx; +#ifdef HODIRAC + int16_t idx_sec = 0; + int16_t no_secs = 1; +#endif + +#ifdef HODIRAC_READ_PARAMS + static FILE *f_secparams = 0; + if ( f_secparams == 0 ) + { + f_secparams = fopen( "sector_params.txt", "r" ); + } +#endif q_direction = &( hQMetaData->q_direction[0] ); hDirAC->numSimultaneousDirections = hQMetaData->no_directions; if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) { + int16_t meta_write_index; band_mapping = hMasa->data.band_mapping; - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; + + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { - hDirAC->azimuth[block][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - hDirAC->elevation[block][b] = (int16_t) q_direction->band_data[band].elevation[block]; - hDirAC->energy_ratio1[block][b] = q_direction->band_data[band].energy_ratio[block]; - hDirAC->diffuseness_vector[block][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; + hDirAC->azimuth[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + hDirAC->elevation[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + hDirAC->energy_ratio1[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + hDirAC->diffuseness_vector[meta_write_index][b] = 1.0f - q_direction->band_data[band].energy_ratio[block]; if ( q_direction->coherence_band_data != NULL ) { - hDirAC->spreadCoherence[block][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + hDirAC->spreadCoherence[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; } else { - hDirAC->spreadCoherence[block][b] = 0.0f; + hDirAC->spreadCoherence[meta_write_index][b] = 0.0f; } if ( hQMetaData->surcoh_band_data != NULL ) { - hDirAC->surroundingCoherence[block][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; + hDirAC->surroundingCoherence[meta_write_index][b] = hQMetaData->surcoh_band_data[band].surround_coherence[block] / 255.0f; } else { - hDirAC->surroundingCoherence[block][b] = 0.0f; + hDirAC->surroundingCoherence[meta_write_index][b] = 0.0f; } } } @@ -1564,37 +2145,55 @@ void ivas_qmetadata_to_dirac( if ( hQMetaData->no_directions == 2 ) { q_direction = &( hQMetaData->q_direction[1] ); - for ( band = 0; band < hMasa->config.numCodingBands; ++band ) + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) { - for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) + meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; + + for ( band = 0; band < hMasa->config.numCodingBands; ++band ) { - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + for ( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { - hDirAC->azimuth2[block][b] = (int16_t) q_direction->band_data[band].azimuth[block]; - hDirAC->elevation2[block][b] = (int16_t) q_direction->band_data[band].elevation[block]; - hDirAC->energy_ratio2[block][b] = q_direction->band_data[band].energy_ratio[block]; - hDirAC->diffuseness_vector[block][b] -= q_direction->band_data[band].energy_ratio[block]; + hDirAC->azimuth2[meta_write_index][b] = (int16_t) q_direction->band_data[band].azimuth[block]; + hDirAC->elevation2[meta_write_index][b] = (int16_t) q_direction->band_data[band].elevation[block]; + hDirAC->energy_ratio2[meta_write_index][b] = q_direction->band_data[band].energy_ratio[block]; + hDirAC->diffuseness_vector[meta_write_index][b] -= q_direction->band_data[band].energy_ratio[block]; if ( q_direction->coherence_band_data != NULL ) { - hDirAC->spreadCoherence2[block][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; + hDirAC->spreadCoherence2[meta_write_index][b] = q_direction->coherence_band_data[band].spread_coherence[block] / 255.0f; } else { - hDirAC->spreadCoherence2[block][b] = 0.0f; + hDirAC->spreadCoherence2[meta_write_index][b] = 0.0f; } } } } } + else if ( hDirAC->azimuth2 != NULL && hDirAC->elevation2 != NULL && hDirAC->energy_ratio2 != NULL && hDirAC->spreadCoherence2 != NULL ) + { + /* zero out old dir2 data */ + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; ++block ) + { + meta_write_index = ( hDirAC->dirac_bs_md_write_idx + block ) % hDirAC->dirac_md_buffer_length; + set_s( hDirAC->azimuth2[meta_write_index], 0, hDirAC->num_freq_bands ); + set_s( hDirAC->elevation2[meta_write_index], 0, hDirAC->num_freq_bands ); + set_zero( hDirAC->energy_ratio2[meta_write_index], hDirAC->num_freq_bands ); + set_zero( hDirAC->spreadCoherence2[meta_write_index], hDirAC->num_freq_bands ); + } + } } else /* SBA mode/SID/Zero frame*/ { int16_t num_slots_in_subfr; int16_t tmp_write_idx_param_band; int16_t tmp_write_idx_band; +#ifdef HODIRAC + float diffuseness_sec = 0.f; +#endif num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; + /* ungroup */ seed_ptr = &hDirAC->dithering_seed; nblocks = q_direction->cfg.nblocks; @@ -1611,7 +2210,9 @@ void ivas_qmetadata_to_dirac( } else { +#ifndef HODIRAC assert( ( hQMetaData->no_directions == 1 ) && "Only 1 direction supported in SBA mode!" ); +#endif start_band = hDirAC->hConfig->enc_param_start_band; if ( sba_mode == SBA_MODE_SPAR ) @@ -1634,133 +2235,278 @@ void ivas_qmetadata_to_dirac( } } - /* Low-Bands with no spatial data transmitted, analysis at decoder side */ - for ( band = 0; band < start_band; band++ ) +#ifdef HODIRAC_READ_PARAMS + /* popular sector parameters from file */ + int16_t idx_f; + int idx_f_f, idx_sec_f; + float azi_secs[4][4][DIRAC_MAX_NBANDS], ele_secs[4][4][DIRAC_MAX_NBANDS], ene_secs[4][4][DIRAC_MAX_NBANDS], diff_secs[4][4][DIRAC_MAX_NBANDS], diff[4][DIRAC_MAX_NBANDS]; + assert( hDirAC->nb_subframes <= 4 ); + for ( block = 0; block < hDirAC->nb_subframes; block++ ) { - band_start = band_grouping[band]; - band_end = band_grouping[band + 1]; - for ( block = 0; block < hDirAC->nb_subframes; block++ ) + int16_t block_qmetadata; + + block_qmetadata = min( block, nblocks - 1 ); + block_qmetadata = max( block_qmetadata, 0 ); + + assert( block_qmetadata == block ); // does this ever happen? + for ( idx_f = 0; idx_f < nbands; idx_f++ ) { - for ( b = band_start; b < band_end; b++ ) + for ( idx_sec = 0; idx_sec < 4; idx_sec++ ) { - hDirAC->spreadCoherence[block][b] = 0.0f; - hDirAC->surroundingCoherence[block][b] = 0.0f; + if ( 7 != fscanf( f_secparams, "%i %i %f %f %f %f %f\n", &idx_f_f, &idx_sec_f, &azi_secs[block_qmetadata][idx_sec][idx_f], &ele_secs[block_qmetadata][idx_sec][idx_f], &ene_secs[block_qmetadata][idx_sec][idx_f], &diff_secs[block_qmetadata][idx_sec][idx_f], &diff[block_qmetadata][idx_f] ) ) + { + printf( "ERROR reading parameters!\n" ); + exit( -1 ); + } + if ( azi_secs[block_qmetadata][idx_sec][idx_f] < 0.f ) + { + azi_secs[block_qmetadata][idx_sec][idx_f] += 360.f; + } } } } +#endif - /* Bands with spatial data transmitted */ - - for ( band = start_band; band < nbands; band++ ) + /* Low-Bands with no spatial data transmitted, analysis at decoder side */ + for ( band = 0; band < start_band; band++ ) { band_start = band_grouping[band]; band_end = band_grouping[band + 1]; +#ifdef JBM_TSM_ON_TCS tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; - - if ( sba_mode == SBA_MODE_SPAR ) - { - qBand_idx = dirac_to_spar_md_bands[band] - start_band; - } - else - { - qBand_idx = band; - } - diffuseness = 1.0f - q_direction->band_data[qBand_idx].energy_ratio[0]; -#ifdef DEBUG_MODE_DIRAC - dbgwrite( &diffuseness, sizeof( float ), 1, 1, "./res/dirac_dec_diffuseness.dat" ); -#endif - diff_idx = q_direction->band_data[qBand_idx].energy_ratio_index[0]; - + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) +#else for ( block = 0; block < hDirAC->nb_subframes; block++ ) +#endif { - int16_t block_qmetadata; - +#ifdef JBM_TSM_ON_TCS ts_start = hDirAC->block_grouping[block]; ts_end = hDirAC->block_grouping[block + 1]; - - block_qmetadata = min( block, nblocks - 1 ); - block_qmetadata = max( block_qmetadata, 0 ); - - if ( q_direction->band_data[qBand_idx].azimuth[block_qmetadata] < 0.f ) - { - q_direction->band_data[qBand_idx].azimuth[block_qmetadata] += 360.f; - } - azimuth = q_direction->band_data[qBand_idx].azimuth[block_qmetadata]; - elevation = q_direction->band_data[qBand_idx].elevation[block_qmetadata]; - +#endif for ( b = band_start; b < band_end; b++ ) { +#ifdef JBM_TSM_ON_TCS tmp_write_idx_band = tmp_write_idx_param_band; - azi = (int16_t) ( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); - ele = (int16_t) ( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); - /* limit the elevation to [-90, 90] */ - ele = min( 90, ele ); - ele = max( -90, ele ); - - if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) +#endif + hDirAC->spreadCoherence[block][b] = 0.0f; + hDirAC->surroundingCoherence[block][b] = 0.0f; +#ifdef JBM_TSM_ON_TCS + if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - hDirAC->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; + hDirAC->elevation[tmp_write_idx_band][b] = 0; + hDirAC->azimuth[tmp_write_idx_band][b] = 0; + hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; + + hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; } else { - hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + for ( ts = ts_start; ts < ts_end; ts++ ) + { + hDirAC->elevation[tmp_write_idx_band][b] = 0; + hDirAC->azimuth[tmp_write_idx_band][b] = 0; +#if 0 + hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; +#endif + hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; + } + } +#endif + } + } + } + + /* Bands with spatial data transmitted */ +#ifdef HODIRAC + if ( hodirac ) + { + no_secs = DIRAC_HO_NUMSECTORS; + } + for ( idx_sec = 0; idx_sec < no_secs; idx_sec++ ) +#endif + { + for ( band = start_band; band < nbands; band++ ) + { + band_start = band_grouping[band]; + band_end = band_grouping[band + 1]; + tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; + + if ( sba_mode == SBA_MODE_SPAR ) + { + qBand_idx = dirac_to_spar_md_bands[band] - start_band; + } + else + { + qBand_idx = band; + } + diffuseness = 1.0f - q_direction->band_data[qBand_idx].energy_ratio[0]; +#ifdef DEBUG_MODE_DIRAC + dbgwrite( &diffuseness, sizeof( float ), 1, 1, "./res/dirac_dec_diffuseness.dat" ); +#endif + diff_idx = q_direction->band_data[qBand_idx].energy_ratio_index[0]; + +#ifdef JBM_TSM_ON_TCS + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) +#else + for ( block = 0; block < hDirAC->nb_subframes; block++ ) +#endif + { + int16_t block_qmetadata; + + ts_start = hDirAC->block_grouping[block]; + ts_end = hDirAC->block_grouping[block + 1]; + + block_qmetadata = min( block, nblocks - 1 ); + block_qmetadata = max( block_qmetadata, 0 ); + +#ifdef HODIRAC + if ( q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] < 0.f ) + { + q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata] += 360.f; + } +#else + if ( q_direction->band_data[qBand_idx].azimuth[block_qmetadata] < 0.f ) + { + q_direction->band_data[qBand_idx].azimuth[block_qmetadata] += 360.f; } +#endif + - if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) +#ifdef HODIRAC + if ( hMasa == NULL && hodirac ) { - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = hQMetaData->surcoh_band_data[qBand_idx].surround_coherence[0] / 255.0f; + azimuth = q_direction[idx_sec].band_data[qBand_idx].azimuth[block_qmetadata]; + elevation = q_direction[idx_sec].band_data[qBand_idx].elevation[block_qmetadata]; + diffuseness = 1.f - q_direction[0].band_data[qBand_idx].energy_ratio[block_qmetadata]; + diffuseness_sec = q_direction[1].band_data[qBand_idx].energy_ratio[block_qmetadata]; + assert( diffuseness_sec < 1.0001f && diffuseness_sec > -0.0001f ); } else +#endif { - hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + azimuth = q_direction->band_data[qBand_idx].azimuth[block_qmetadata]; + elevation = q_direction->band_data[qBand_idx].elevation[block_qmetadata]; } - hDirAC->energy_ratio1[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio[0]; +#ifdef HODIRAC_READ_PARAMS + int16_t tmp_i; + tmp_i = 0; + ( idx_sec == 0 ) ? ( tmp_i = 1 ) : ( ( idx_sec == 1 ) ? ( tmp_i = 2 ) : ( tmp_i = -99 ) ); + assert( tmp_i < 3 ); + azimuth = azi_secs[block_qmetadata][tmp_i][qBand_idx]; + elevation = ele_secs[block_qmetadata][tmp_i][qBand_idx]; + diffuseness = diff[block_qmetadata][qBand_idx]; - if ( hDirAC->hConfig->dec_param_estim == FALSE ) + if ( azimuth < 0.f ) { - hDirAC->elevation[tmp_write_idx_band][b] = ele; - hDirAC->azimuth[tmp_write_idx_band][b] = azi; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; + azimuth += 360.f; } - else + diffuseness_sec = 1.f - ( diff_secs[block_qmetadata][1][qBand_idx] / ( diff_secs[block_qmetadata][1][qBand_idx] + diff_secs[block_qmetadata][2][qBand_idx] + EPSILON ) ); +#endif + + for ( b = band_start; b < band_end; b++ ) { - for ( ts = ts_start; ts < ts_end; ts++ ) + tmp_write_idx_band = tmp_write_idx_param_band; + +#ifdef HODIRAC + if ( hodirac ) { - hDirAC->elevation[tmp_write_idx_band][b] = ele; - hDirAC->azimuth[tmp_write_idx_band][b] = azi; - hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; - tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; + azi = (int16_t) ( azimuth + 0.5f ); + ele = (int16_t) ( elevation + 0.5f ); + } + else +#endif + { + azi = (int16_t) ( azimuth + rand_triangular_signed( seed_ptr ) * dirac_dithering_azi_scale[diff_idx] + 0.5f ); + ele = (int16_t) ( elevation + rand_triangular_signed( seed_ptr ) * dirac_dithering_ele_scale[diff_idx] + 0.5f ); + /* limit the elevation to [-90, 90] */ + ele = min( 90, ele ); + ele = max( -90, ele ); } - } - } /* for ( band = ...) */ - tmp_write_idx_param_band = ( tmp_write_idx_param_band + num_slots_in_subfr ) % hDirAC->dirac_md_buffer_length; - } /* for ( block =...) */ - } -#ifdef DEBUG_MODE_DIRAC - { - for ( block = 0; block < hDirAC->nb_subframes; block++ ) - { - int16_t block_qmetadata; + if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) + { + hDirAC->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; + } + else + { + hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + } - block_qmetadata = min( block, nblocks - 1 ); - block_qmetadata = max( block_qmetadata, 0 ); - for ( band = start_band; band < nbands; band++ ) - { - dbgwrite( &q_direction->band_data[band].azimuth[block_qmetadata], sizeof( float ), 1, 1, "./res/dirac_dec_azi.dat" ); - dbgwrite( &q_direction->band_data[band].elevation[block_qmetadata], sizeof( float ), 1, 1, "./res/dirac_dec_ele.dat" ); - } - } - } + if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) + { + hDirAC->surroundingCoherence[tmp_write_idx_band][b] = hQMetaData->surcoh_band_data[qBand_idx].surround_coherence[0] / 255.0f; + } + else + { + hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + } + + hDirAC->energy_ratio1[tmp_write_idx_band][b] = q_direction->band_data[qBand_idx].energy_ratio[0]; + + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + + hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; + +#ifdef HODIRAC + if ( hodirac ) + { + if ( idx_sec == 0 ) + { + hDirAC->elevation[tmp_write_idx_band][b] = ele; + hDirAC->azimuth[tmp_write_idx_band][b] = azi; + hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0.f; // not in use + } + else + { + assert( idx_sec == 1 ); + hDirAC->elevation2[tmp_write_idx_band][b] = ele; + hDirAC->azimuth2[tmp_write_idx_band][b] = azi; + hDirAC->energy_ratio2[tmp_write_idx_band][b] = 1.f - diffuseness_sec; + } + } + else #endif + { + hDirAC->elevation[tmp_write_idx_band][b] = ele; + hDirAC->azimuth[tmp_write_idx_band][b] = azi; + } + } + else + { + for ( ts = ts_start; ts < ts_end; ts++ ) + { + hDirAC->elevation[tmp_write_idx_band][b] = ele; + hDirAC->azimuth[tmp_write_idx_band][b] = azi; + hDirAC->diffuseness_vector[tmp_write_idx_band][b] = diffuseness; + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; + } + } + } + + tmp_write_idx_param_band = ( tmp_write_idx_param_band + num_slots_in_subfr ) % hDirAC->dirac_md_buffer_length; + + } /* for ( block =...) */ + } /* for ( band = ...) */ + } /* for ( idx_sec = ...)*/ /* Bands not transmitted -> zeroed*/ for ( b = band_grouping[band]; b < hDirAC->num_freq_bands; b++ ) { tmp_write_idx_band = hDirAC->dirac_bs_md_write_idx; +#ifdef JBM_TSM_ON_TCS + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) +#else for ( block = 0; block < hDirAC->nb_subframes; block++ ) +#endif { ts_start = hDirAC->block_grouping[block]; ts_end = hDirAC->block_grouping[block + 1]; @@ -1774,6 +2520,11 @@ void ivas_qmetadata_to_dirac( hDirAC->elevation[tmp_write_idx_band][b] = 0; hDirAC->azimuth[tmp_write_idx_band][b] = 0; hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; +#ifdef JBM_TSM_ON_TCS + hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; +#endif tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; } else @@ -1783,6 +2534,11 @@ void ivas_qmetadata_to_dirac( hDirAC->elevation[tmp_write_idx_band][b] = 0; hDirAC->azimuth[tmp_write_idx_band][b] = 0; hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; +#ifdef JBM_TSM_ON_TCS + hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; + hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; + hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; +#endif tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; } } @@ -1790,6 +2546,38 @@ void ivas_qmetadata_to_dirac( } } +#ifdef HODIRAC_WRITE_PARAMS + if ( hMasa == NULL && sba_analysis_order > 1 && ivas_total_brate > IVAS_256k ) + { + static FILE *f_params = 0; + int16_t tmp_write_idx_band = 0; + + if ( f_params == 0 ) + f_params = fopen( "param_dec", "w" ); + + tmp_write_idx_band = hDirAC->dirac_bs_md_write_idx; + for ( block = 0; block < hDirAC->nb_subframes; block++ ) + { + int16_t block_qmetadata; + + block_qmetadata = min( block, nblocks - 1 ); + block_qmetadata = max( block_qmetadata, 0 ); + + for ( band = 0; band < hDirAC->num_freq_bands; band++ ) + { + fprintf( f_params, "%d ", hDirAC->azimuth[tmp_write_idx_band][band] ); + fprintf( f_params, "%d ", hDirAC->elevation[tmp_write_idx_band][band] ); + fprintf( f_params, "%f ", hDirAC->diffuseness_vector[tmp_write_idx_band][band] ); + + fprintf( f_params, "%d ", hDirAC->azimuth2[tmp_write_idx_band][band] ); + fprintf( f_params, "%d ", hDirAC->elevation2[tmp_write_idx_band][band] ); + fprintf( f_params, "%f\n", 1.0f - hDirAC->energy_ratio2[tmp_write_idx_band][band] ); + } + tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; + } + } +#endif + /* update buffer write index */ if ( hDirAC->hConfig->dec_param_estim == FALSE ) { @@ -1804,19 +2592,222 @@ void ivas_qmetadata_to_dirac( } +#ifdef JBM_TSM_ON_TCS +/*------------------------------------------------------------------------- + * ivas_dirac_dec_set_md_map() + * + * Set metadata index mapping for DirAC + *------------------------------------------------------------------------*/ +void ivas_dirac_dec_set_md_map( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t nCldfbTs ) +{ + int16_t num_slots_in_subfr; + DIRAC_DEC_HANDLE hDirAC; + + hDirAC = st_ivas->hDirAC; +#ifdef DEBUGGING + assert( hDirAC ); +#endif + + /* adapt subframes */ + hDirAC->num_slots = nCldfbTs; + hDirAC->slots_rendered = 0; + if ( hDirAC->hParamIsm != NULL || hDirAC->hConfig->dec_param_estim == 0 ) + { + num_slots_in_subfr = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; + } + else + { + num_slots_in_subfr = 1; + } + hDirAC->subframes_rendered = 0; + + ivas_jbm_dec_get_adapted_subframes( nCldfbTs, hDirAC->subframe_nbslots, &hDirAC->nb_subframes ); + + /* set mapping according to dirac_read_idx */ + + set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + + if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) + { + ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, 0, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map ); + } + else + { + ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, num_slots_in_subfr, hDirAC->dirac_read_idx, hDirAC->dirac_md_buffer_length, hDirAC->render_to_md_map ); + } + + if ( hDirAC->hConfig == NULL || hDirAC->hConfig->dec_param_estim == 0 ) + { + float tmp; + int16_t sf_idx, slot_idx, slot_idx_abs; + slot_idx_abs = 0; + for ( sf_idx = 0; sf_idx < hDirAC->nb_subframes; sf_idx++ ) + { + tmp = 0.0f; + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[sf_idx]; slot_idx++ ) + { + tmp += (float) hDirAC->render_to_md_map[slot_idx_abs]; + slot_idx_abs++; + } + hDirAC->render_to_md_map[sf_idx] = ( (int16_t) roundf( tmp / (float) hDirAC->subframe_nbslots[sf_idx] ) + hDirAC->dirac_read_idx ) % hDirAC->dirac_md_buffer_length; + } + set_s( &hDirAC->render_to_md_map[hDirAC->nb_subframes], 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME - hDirAC->nb_subframes ); + } + + return; +} + /*------------------------------------------------------------------------- * ivas_dirac_dec() * * DirAC decoding process *------------------------------------------------------------------------*/ +void ivas_dirac_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_transport /* i : number of transport channels */ +) +{ + int16_t subframe_idx; + float *output_f_local[MAX_OUTPUT_CHANNELS]; + float cng_td_buffer[L_FRAME16k]; + int16_t nchan_out, n, n_samples_sf; + nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; + n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * st_ivas->hDirAC->slot_size; + + for ( n = 0; n < nchan_out; n++ ) + { + output_f_local[n] = &output_f[n][0]; + } + for ( n = 0; n < nchan_transport; n++ ) + { + st_ivas->hTcBuffer->tc[n] = output_f[n]; + } + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) + { + Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; + st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; + generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna ); + } + ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); + for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) + { + ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); + for ( n = 0; n < nchan_out; n++ ) + { + output_f_local[n] += n_samples_sf; + } + } + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) + { + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + } + else + { + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + } + for ( n = 0; n < nchan_transport; n++ ) + { + st_ivas->hTcBuffer->tc[n] = NULL; + } + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) + { + st_ivas->hTcBuffer->tc[nchan_transport] = NULL; + } + + return; +} + +void ivas_dirac_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ +) +{ + int16_t slots_to_render, first_sf, last_sf, subframe_idx; + uint16_t slot_size, n_samples_sf, ch, nchan_intern; + DIRAC_DEC_HANDLE hDirAC; + float *output_f_local[MAX_OUTPUT_CHANNELS]; + + hDirAC = st_ivas->hDirAC; + + nchan_intern = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; +#ifdef DEBUGGING + assert( hDirAC ); +#endif + for ( ch = 0; ch < nchan_intern; ch++ ) + { + output_f_local[ch] = output_f[ch]; + } + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( hDirAC->num_slots - hDirAC->slots_rendered, nSamplesAsked / slot_size ); + *nSamplesRendered = slots_to_render * slot_size; + first_sf = hDirAC->subframes_rendered; + last_sf = first_sf; + while ( slots_to_render > 0 ) + { + slots_to_render -= hDirAC->subframe_nbslots[last_sf]; + last_sf++; + } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL ); + n_samples_sf = hDirAC->subframe_nbslots[subframe_idx] * st_ivas->hDirAC->slot_size; + for ( ch = 0; ch < nchan_intern; ch++ ) + { + output_f_local[ch] += n_samples_sf; + } + } + if ( hDirAC->slots_rendered == hDirAC->num_slots ) + { + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) + { + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + } + else + { + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + } + } + *nSamplesAvailable = ( hDirAC->num_slots - hDirAC->slots_rendered ) * slot_size; + return; +} +#endif + +/*------------------------------------------------------------------------- + * ivas_dirac_dec() + * + * DirAC decoding process + *------------------------------------------------------------------------*/ +#ifndef JBM_TSM_ON_TCS void ivas_dirac_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else +void ivas_dirac_dec_render_sf( +#endif + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef JBM_TSM_ON_TCS + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif const int16_t nchan_transport, /* i : number of transport channels */ float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - const int16_t i_sf ) + float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] +#ifndef JBM_TSM_ON_TCS + , + const int16_t i_sf +#endif +) { int16_t i, ch, idx_in, idx_lfe; DIRAC_DEC_HANDLE hDirAC; @@ -1824,9 +2815,14 @@ void ivas_dirac_dec( float surCohEner; float surCohRatio[CLDFB_NO_CHANNELS_MAX]; int16_t subframe_idx; +#ifndef JBM_TSM_ON_TCS int16_t sf1, sf2; +#endif int16_t slot_idx, index_slot; float *p_Rmat; +#ifdef JBM_TSM_ON_TCS + int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; +#endif /*CLDFB: last output channels reserved to LFT for CICPx*/ float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -1835,11 +2831,23 @@ void ivas_dirac_dec( float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; int16_t index, num_freq_bands; +#ifdef JBM_TSM_ON_TCS + /* local copies of azi, ele, diffuseness */ + int16_t azimuth[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + int16_t elevation[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float diffuseness_vector[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#endif + DIRAC_DEC_STACK_MEM DirAC_mem; float *reference_power, *reference_power_smooth; float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; uint16_t coherence_flag; + +#ifndef JBM_TSM_ON_TCS push_wmops( "ivas_dirac_dec" ); +#else + push_wmops( "ivas_dirac_dec_render" ); +#endif /* Initialize aux buffers */ hDirAC = st_ivas->hDirAC; @@ -1879,7 +2887,7 @@ void ivas_dirac_dec( #endif /* Subframe loop */ - +#ifndef JBM_TSM_ON_TCS if ( i_sf == -1 ) { sf1 = 0; @@ -1890,631 +2898,1015 @@ void ivas_dirac_dec( sf1 = i_sf; sf2 = i_sf + 1; } +#endif +#ifdef JBM_TSM_ON_TCS + slot_idx_start = hDirAC->slots_rendered; + slot_idx_start_cldfb_synth = 0; +#endif +#ifdef JBM_TSM_ON_TCS + subframe_idx = hDirAC->subframes_rendered; +#else for ( subframe_idx = sf1; subframe_idx < sf2; subframe_idx++ ) { - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) +#endif +#ifdef JBM_TSM_ON_TCS + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + md_idx = hDirAC->render_to_md_map[subframe_idx]; + } + else + { + md_idx = hDirAC->render_to_md_map[slot_idx_start]; + } +#endif +#ifdef JBM_TSM_ON_TCS + /* Another workaround for self test BE */ +#ifndef FIX_642 + if ( st_ivas->hHeadTrackData && st_ivas->hDecoderConfig->voip_active == 0 ) + { + QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); + + p_Rmat = &st_ivas->hHeadTrackData->Rmat[0][0]; + + if ( st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) { - set_zero( reference_power_smooth, hDirAC->num_freq_bands ); + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + index_slot = slot_idx_start + slot_idx; + rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); + } } - else + } + else + { + p_Rmat = 0; + } +#endif + + /* copy parameters into local buffers*/ + + if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + mvs2s( hDirAC->azimuth[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], azimuth[slot_idx], hDirAC->num_freq_bands ); + mvs2s( hDirAC->elevation[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], elevation[slot_idx], hDirAC->num_freq_bands ); + mvr2r( hDirAC->diffuseness_vector[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], diffuseness_vector[slot_idx], hDirAC->num_freq_bands ); + } + } + else + { + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) { - set_zero( onset_filter_subframe, hDirAC->num_freq_bands ); + mvs2s( hDirAC->azimuth[hDirAC->render_to_md_map[subframe_idx]], azimuth[slot_idx], hDirAC->num_freq_bands ); + mvs2s( hDirAC->elevation[hDirAC->render_to_md_map[subframe_idx]], elevation[slot_idx], hDirAC->num_freq_bands ); + mvr2r( hDirAC->diffuseness_vector[hDirAC->render_to_md_map[subframe_idx]], diffuseness_vector[slot_idx], hDirAC->num_freq_bands ); } + } + +#endif + + if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + set_zero( reference_power_smooth, hDirAC->num_freq_bands ); + } + else + { + set_zero( onset_filter_subframe, hDirAC->num_freq_bands ); + } +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hHeadTrackData +#ifndef FIX_642 + && st_ivas->hDecoderConfig->voip_active == 1 +#endif + ) +#else if ( st_ivas->hHeadTrackData ) - { - QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); +#endif + { + QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); - p_Rmat = &st_ivas->hHeadTrackData->Rmat[0][0]; + p_Rmat = &st_ivas->hHeadTrackData->Rmat[0][0]; - if ( st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) - { - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + if ( st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) + { + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; +#ifdef JBM_TSM_ON_TCS + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) +#else for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) - { +#endif + { +#ifdef JBM_TSM_ON_TCS + rotateAziEle_DirAC( azimuth[slot_idx], elevation[slot_idx], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); +#else + /* note, this seems wrong since it does not take the dirac read ptr into account */ index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; + /* Todo: This access to azimuth & elevation may use wrong indices as access should probably be based on hDirAC->dirac_read_idx */ rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); - } +#endif } } + } +#if defined( JBM_TSM_ON_TCS ) & !defined( FIX_642 ) + else if ( !st_ivas->hHeadTrackData ) +#else else - { - p_Rmat = 0; - } +#endif + { + p_Rmat = 0; + } + + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { - if ( hDirAC->hConfig->dec_param_estim == FALSE ) + /* compute response */ + if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - /* compute response */ - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_compute_power_factors( hDirAC->num_freq_bands, + ivas_dirac_dec_compute_power_factors( hDirAC->num_freq_bands, +#ifdef JBM_TSM_ON_TCS + diffuseness_vector[0], +#else hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], - hDirAC->h_output_synthesis_psd_params.max_band_decorr, - hDirAC->h_output_synthesis_psd_state.direct_power_factor, - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); +#endif + hDirAC->h_output_synthesis_psd_params.max_band_decorr, + hDirAC->h_output_synthesis_psd_state.direct_power_factor, + hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); - if ( coherence_flag ) + if ( coherence_flag ) + { + for ( i = 0; i < hDirAC->num_freq_bands; i++ ) { - for ( i = 0; i < hDirAC->num_freq_bands; i++ ) - { - dirEne = hDirAC->h_output_synthesis_psd_state.direct_power_factor[i]; - surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[subframe_idx][i]; - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; - hDirAC->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; + dirEne = hDirAC->h_output_synthesis_psd_state.direct_power_factor[i]; +#ifdef JBM_TSM_ON_TCS + surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[md_idx][i]; +#else + surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; +#endif + hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; + hDirAC->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; - surCohRatio[i] = surCohEner / ( 1e-12f + dirEne + surCohEner ); - } - } - else - { - set_zero( surCohRatio, hDirAC->num_freq_bands ); + surCohRatio[i] = surCohEner / ( 1e-12f + dirEne + surCohEner ); } } else { - ivas_dirac_dec_compute_gain_factors( hDirAC->num_freq_bands, + set_zero( surCohRatio, hDirAC->num_freq_bands ); + } + } + else + { + ivas_dirac_dec_compute_gain_factors( hDirAC->num_freq_bands, +#ifdef JBM_TSM_ON_TCS + hDirAC->diffuseness_vector[md_idx], +#else hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], - hDirAC->h_output_synthesis_psd_params.max_band_decorr, - hDirAC->h_output_synthesis_psd_state.direct_power_factor, - hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); +#endif + hDirAC->h_output_synthesis_psd_params.max_band_decorr, + hDirAC->h_output_synthesis_psd_state.direct_power_factor, + hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); - if ( coherence_flag ) + if ( coherence_flag ) + { + for ( i = 0; i < hDirAC->num_freq_bands; i++ ) { - for ( i = 0; i < hDirAC->num_freq_bands; i++ ) - { +#ifdef JBM_TSM_ON_TCS + surCohRatio[i] = hDirAC->surroundingCoherence[md_idx][i]; +#else surCohRatio[i] = hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; - } - } - else - { - set_zero( surCohRatio, hDirAC->num_freq_bands ); +#endif } } - - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 1 ) - { - ivas_dirac_dec_compute_directional_responses( hDirAC, - st_ivas->hVBAPdata, - st_ivas->hMasa, - subframe_idx, - subframe_idx, - surCohRatio, - st_ivas->hHeadTrackData->shd_rot_max_order, - p_Rmat ); - } else { - ivas_dirac_dec_compute_directional_responses( hDirAC, - st_ivas->hVBAPdata, - st_ivas->hMasa, - subframe_idx, - subframe_idx, - surCohRatio, - 0, - 0 ); + set_zero( surCohRatio, hDirAC->num_freq_bands ); } } + + if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 1 ) + { + ivas_dirac_dec_compute_directional_responses( hDirAC, + st_ivas->hVBAPdata, + st_ivas->hMasa, +#ifdef JBM_TSM_ON_TCS + hDirAC->azimuth[md_idx], + hDirAC->elevation[md_idx], + md_idx, +#endif + surCohRatio, + st_ivas->hHeadTrackData->shd_rot_max_order, + p_Rmat +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k +#endif + ); + } + else + { + ivas_dirac_dec_compute_directional_responses( hDirAC, + st_ivas->hVBAPdata, + st_ivas->hMasa, +#ifdef JBM_TSM_ON_TCS + hDirAC->azimuth[md_idx], + hDirAC->elevation[md_idx], + md_idx, +#endif + surCohRatio, + 0, + NULL +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k +#endif + ); + } + } + + +#ifdef JBM_TSM_ON_TCS + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) +#else for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) +#endif + { +#ifdef JBM_TSM_ON_TCS + index_slot = slot_idx_start + slot_idx; + if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + md_idx = hDirAC->render_to_md_map[index_slot]; + } + else { + md_idx = hDirAC->render_to_md_map[subframe_idx]; + } +#else index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; +#endif - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + for ( ch = 0; ch < nchan_transport; ch++ ) { - for ( ch = 0; ch < nchan_transport; ch++ ) - { - mvr2r( pppQMfFrame_ts_re[ch][slot_idx], Cldfb_RealBuffer[ch][0], hDirAC->num_freq_bands ); - mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands ); - } + mvr2r( pppQMfFrame_ts_re[ch][slot_idx], Cldfb_RealBuffer[ch][0], hDirAC->num_freq_bands ); + mvr2r( pppQMfFrame_ts_im[ch][slot_idx], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands ); } - else + } + else + { + /* CLDFB Analysis*/ + for ( ch = 0; ch < nchan_transport; ch++ ) { - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { +#ifdef JBM_TSM_ON_TCS +#ifdef SPAR_TUNING + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), + Cldfb_RealBuffer[ch][0], + Cldfb_ImagBuffer[ch][0], + hDirAC->num_freq_bands, + st_ivas->cldfbAnaDec[ch] ); +#else + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), + Cldfb_RealBuffer[ch][0], + Cldfb_ImagBuffer[ch][0], + hDirAC->num_freq_bands, + st_ivas->cldfbAnaDec[ch] ); +#endif +#else +#ifdef SPAR_TUNING + cldfbAnalysis_ts( &( output_f[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), + Cldfb_RealBuffer[ch][0], + Cldfb_ImagBuffer[ch][0], + hDirAC->num_freq_bands, + st_ivas->cldfbAnaDec[ch] ); +#else cldfbAnalysis_ts( &( output_f[sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), Cldfb_RealBuffer[ch][0], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - } + +#endif +#endif } + } - /* CNG in DirAC, extra CLDFB ana for CNA*/ - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; + /* CNG in DirAC, extra CLDFB ana for CNA*/ + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) + { + Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, - st_ivas->cldfbAnaDec[1], + generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], +#ifdef JBM_TSM_ON_TCS + st_ivas->hTcBuffer->tc[1], +#else &( output_f[1][L_FRAME48k - L_FRAME16k] ), - Cldfb_RealBuffer[1][0], - Cldfb_ImagBuffer[1][0], - index_slot, - st->cna_dirac_flag && st->flag_cna, - ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_sba_flag ); - } +#endif + Cldfb_RealBuffer[1][0], + Cldfb_ImagBuffer[1][0], + index_slot, + st->cna_dirac_flag && st->flag_cna, + ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_sba_flag ); + } - /* LFE synthesis */ - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled && !( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && hDirAC->hOutSetup.num_lfe == 0 ) ) - { - ivas_lfe_synth_with_cldfb( st_ivas->hMasa->hMasaLfeSynth, - Cldfb_RealBuffer, Cldfb_ImagBuffer, - Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1], - slot_idx, + /* LFE synthesis */ + if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled && !( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && hDirAC->hOutSetup.num_lfe == 0 ) ) + { + ivas_lfe_synth_with_cldfb( st_ivas->hMasa->hMasaLfeSynth, + Cldfb_RealBuffer, Cldfb_ImagBuffer, + Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1], + slot_idx, +#ifdef JBM_TSM_ON_TCS + md_idx, +#else subframe_idx, - nchan_transport ); - } +#endif + nchan_transport ); + } - /*-----------------------------------------------------------------* - * protoype signal computation - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * protoype signal computation + *-----------------------------------------------------------------*/ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) { - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) - { - protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f, - reference_power, slot_idx, nchan_transport, - hDirAC->num_outputs_diff, - hDirAC->num_freq_bands, - p_Rmat ); - } - else - { - protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f, - reference_power, slot_idx, nchan_transport, - hDirAC->num_outputs_diff, - hDirAC->num_freq_bands, - 0 ); - } + protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f, + reference_power, slot_idx, nchan_transport, + hDirAC->num_outputs_diff, + hDirAC->num_freq_bands, + p_Rmat ); } - else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + else { - protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - 0, slot_idx, hDirAC->num_freq_bands, hDirAC->masa_stereo_type_detect ); + protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, + hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f, + reference_power, slot_idx, nchan_transport, + hDirAC->num_outputs_diff, + hDirAC->num_freq_bands, + 0 ); } - else + } + else if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) + { + protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC->proto_frame_f, + hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, hDirAC->h_output_synthesis_psd_state.proto_power_smooth, + 0, slot_idx, hDirAC->num_freq_bands, hDirAC->masa_stereo_type_detect ); + } + else + { + switch ( nchan_transport ) { - switch ( nchan_transport ) - { - case 8: - case 6: - case 4: - protoSignalComputation4( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - slot_idx, hDirAC->num_outputs_diff, - hDirAC->num_freq_bands, - hDirAC->hoa_decoder, - nchan_transport ); - break; - case 2: - protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - hDirAC->hOutSetup.is_loudspeaker_setup, - slot_idx, - hDirAC->num_freq_bands, - hDirAC->masa_stereo_type_detect ); - break; - case 1: - protoSignalComputation1( Cldfb_RealBuffer, Cldfb_ImagBuffer, - hDirAC->proto_frame_f, - hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, - reference_power, - hDirAC->h_output_synthesis_psd_state.proto_power_smooth, - slot_idx, - hDirAC->num_protos_diff, - hDirAC->num_freq_bands ); - break; - default: - return; - } - } - - /*-----------------------------------------------------------------* - * Compute DirAC parameters at decoder side - *-----------------------------------------------------------------*/ - - if ( hDirAC->hConfig->dec_param_estim == TRUE ) - { - hDirAC->index_buffer_intensity = ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ - - index = hDirAC->index_buffer_intensity; - - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - - computeIntensityVector_dec( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - num_freq_bands, - hDirAC->buffer_intensity_real[0][index - 1], - hDirAC->buffer_intensity_real[1][index - 1], - hDirAC->buffer_intensity_real[2][index - 1] ); - - computeDirectionAngles( hDirAC->buffer_intensity_real[0][index - 1], - hDirAC->buffer_intensity_real[1][index - 1], - hDirAC->buffer_intensity_real[2][index - 1], - num_freq_bands, - - hDirAC->azimuth[hDirAC->dirac_estimator_idx], - hDirAC->elevation[hDirAC->dirac_estimator_idx] ); - - mvr2r( reference_power, &( hDirAC->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); +#ifdef HODIRAC + case 11: +#endif + case 8: + case 6: + case 4: + protoSignalComputation4( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirAC->proto_frame_f, + hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, + hDirAC->h_output_synthesis_psd_state.proto_power_smooth, + slot_idx, hDirAC->num_outputs_diff, + hDirAC->num_freq_bands, + hDirAC->hoa_decoder, + nchan_transport +#ifdef SPAR_TUNING + , + hDirAC->sba_map_tc +#endif + ); + break; + case 2: + protoSignalComputation2( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirAC->proto_frame_f, + hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, + hDirAC->h_output_synthesis_psd_state.proto_power_smooth, + hDirAC->hOutSetup.is_loudspeaker_setup, + slot_idx, + hDirAC->num_freq_bands, + hDirAC->masa_stereo_type_detect ); + break; + case 1: + protoSignalComputation1( Cldfb_RealBuffer, Cldfb_ImagBuffer, + hDirAC->proto_frame_f, + hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f, + reference_power, + hDirAC->h_output_synthesis_psd_state.proto_power_smooth, + slot_idx, + hDirAC->num_protos_diff, + hDirAC->num_freq_bands ); + break; + default: + return; + } + } - computeDiffuseness( hDirAC->buffer_intensity_real, - hDirAC->buffer_energy, - num_freq_bands, - hDirAC->diffuseness_vector[hDirAC->dirac_estimator_idx] ); - hDirAC->dirac_estimator_idx = ( hDirAC->dirac_estimator_idx + 1 ) % hDirAC->dirac_md_buffer_length; - } + /*-----------------------------------------------------------------* + * Compute DirAC parameters at decoder side + *-----------------------------------------------------------------*/ -#ifdef DEBUG_MODE_DIRAC - { - static FILE *fp_direction_vector = NULL, *fp_diffuseness = NULL, *fp_referencePower = NULL; + if ( hDirAC->hConfig->dec_param_estim == TRUE ) + { + hDirAC->index_buffer_intensity = ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */ + index = hDirAC->index_buffer_intensity; - if ( fp_direction_vector == NULL ) - fp_direction_vector = fopen( "./res/dbg_direction_vector_C_dec.bin", "wb" ); - if ( fp_diffuseness == NULL ) - fp_diffuseness = fopen( "./res/dbg_diffuseness_C_dec.bin", "wb" ); - if ( fp_referencePower == NULL ) - fp_referencePower = fopen( "./res/dbg_reference_power_C_dec.bin", "wb" ); + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + computeIntensityVector_dec( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + num_freq_bands, + hDirAC->buffer_intensity_real[0][index - 1], + hDirAC->buffer_intensity_real[1][index - 1], + hDirAC->buffer_intensity_real[2][index - 1] ); + computeDirectionAngles( hDirAC->buffer_intensity_real[0][index - 1], + hDirAC->buffer_intensity_real[1][index - 1], + hDirAC->buffer_intensity_real[2][index - 1], + num_freq_bands, +#ifdef JBM_TSM_ON_TCS + azimuth[slot_idx], + elevation[slot_idx] +#else + hDirAC->azimuth[hDirAC->dirac_estimator_idx], + hDirAC->elevation[hDirAC->dirac_estimator_idx] +#endif + ); - for ( i = 0; i < hDirAC->num_freq_bands; i++ ) - { - float radius_length; - float dv[3]; + mvr2r( reference_power, &( hDirAC->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); - if ( hDirAC->hConfig->dec_param_estim == FALSE ) - { - radius_length = cos( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); - dv[0] = radius_length * cos( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); - dv[1] = radius_length * sin( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); - dv[2] = sin( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); - - fwrite( dv, sizeof( float ), 3, fp_direction_vector ); - fwrite( &( hDirAC->diffuseness_vector[0][i] ), sizeof( float ), 1, fp_diffuseness ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - reference_power[i] = Cldfb_RealBuffer[0][0][i] * Cldfb_RealBuffer[0][0][i] + Cldfb_ImagBuffer[0][0][i] * Cldfb_ImagBuffer[0][0][i]; - } - fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); - } - else - { - radius_length = cos( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); - dv[0] = radius_length * cos( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); - dv[1] = radius_length * sin( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); - dv[2] = sin( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); - - fwrite( dv, sizeof( float ), 3, fp_direction_vector ); - fwrite( &( hDirAC->diffuseness_vector[index_slot][i] ), sizeof( float ), 1, fp_diffuseness ); - fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); - } - } - } + computeDiffuseness( hDirAC->buffer_intensity_real, + hDirAC->buffer_energy, + num_freq_bands, +#ifdef JBM_TSM_ON_TCS + diffuseness_vector[slot_idx] +#else + hDirAC->diffuseness_vector[hDirAC->dirac_estimator_idx] #endif + ); - /*-----------------------------------------------------------------* - * frequency domain decorrelation - *-----------------------------------------------------------------*/ +#ifndef JBM_TSM_ON_TCS + hDirAC->dirac_estimator_idx = ( hDirAC->dirac_estimator_idx + 1 ) % hDirAC->dirac_md_buffer_length; +#endif + } - if ( hDirAC->proto_signal_decorr_on == 1 ) - { - /* decorrelate prototype frame */ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) - { - ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - nchan_transport, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hDirAC->num_freq_bands * hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->proto_index_diff, - hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hDirAC->num_freq_bands * hDirAC->num_outputs_diff + 2 * hDirAC->num_freq_bands * min( 4, nchan_transport ), - onset_filter, - hDirAC->h_freq_domain_decorr_ap_params, - hDirAC->h_freq_domain_decorr_ap_state ); +#ifdef DEBUG_MODE_DIRAC + { + static FILE *fp_direction_vector = NULL, *fp_diffuseness = NULL, *fp_referencePower = NULL; - v_multc( onset_filter, 0.25f, onset_filter, hDirAC->num_freq_bands ); - v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, hDirAC->num_freq_bands ); - p_onset_filter = onset_filter_subframe; - } - else - { - ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - nchan_transport, - hDirAC->proto_frame_f, - hDirAC->num_protos_diff, - hDirAC->proto_index_diff, - DirAC_mem.frame_dec_f, - onset_filter, - hDirAC->h_freq_domain_decorr_ap_params, - hDirAC->h_freq_domain_decorr_ap_state ); - hDirAC->proto_frame_dec_f = DirAC_mem.frame_dec_f; - p_onset_filter = onset_filter; - } - } - else + if ( fp_direction_vector == NULL ) + fp_direction_vector = fopen( "./res/dbg_direction_vector_C_dec.bin", "wb" ); + if ( fp_diffuseness == NULL ) + fp_diffuseness = fopen( "./res/dbg_diffuseness_C_dec.bin", "wb" ); + if ( fp_referencePower == NULL ) + fp_referencePower = fopen( "./res/dbg_reference_power_C_dec.bin", "wb" ); + + + for ( i = 0; i < hDirAC->num_freq_bands; i++ ) { - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + float radius_length; + float dv[3]; + + if ( hDirAC->hConfig->dec_param_estim == FALSE ) { - set_f( onset_filter_subframe, 1.f, hDirAC->num_freq_bands ); - p_onset_filter = onset_filter_subframe; + radius_length = cos( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); + dv[0] = radius_length * cos( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); + dv[1] = radius_length * sin( hDirAC->azimuth[subframe_idx][i] * PI_OVER_180 ); + dv[2] = sin( hDirAC->elevation[subframe_idx][i] * PI_OVER_180 ); + + fwrite( dv, sizeof( float ), 3, fp_direction_vector ); + fwrite( &( hDirAC->diffuseness_vector[0][i] ), sizeof( float ), 1, fp_diffuseness ); + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + reference_power[i] = Cldfb_RealBuffer[0][0][i] * Cldfb_RealBuffer[0][0][i] + Cldfb_ImagBuffer[0][0][i] * Cldfb_ImagBuffer[0][0][i]; + } + fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); } else { - /* no frequency domain decorrelation: use prototype frame */ - hDirAC->proto_frame_dec_f = hDirAC->proto_frame_f; - p_onset_filter = NULL; + radius_length = cos( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); + dv[0] = radius_length * cos( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); + dv[1] = radius_length * sin( hDirAC->azimuth[index_slot][i] * PI_OVER_180 ); + dv[2] = sin( hDirAC->elevation[index_slot][i] * PI_OVER_180 ); + + fwrite( dv, sizeof( float ), 3, fp_direction_vector ); + fwrite( &( hDirAC->diffuseness_vector[index_slot][i] ), sizeof( float ), 1, fp_diffuseness ); + fwrite( &( reference_power[i] ), sizeof( float ), 1, fp_referencePower ); } } + } +#endif - /*-----------------------------------------------------------------* - * output synthesis - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * frequency domain decorrelation + *-----------------------------------------------------------------*/ - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + if ( hDirAC->proto_signal_decorr_on == 1 ) + { + /* decorrelate prototype frame */ + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + nchan_transport, + hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hDirAC->num_freq_bands * hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->proto_index_diff, + hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f + slot_idx * 2 * hDirAC->num_freq_bands * hDirAC->num_outputs_diff + 2 * hDirAC->num_freq_bands * min( 4, nchan_transport ), + onset_filter, + hDirAC->h_freq_domain_decorr_ap_params, + hDirAC->h_freq_domain_decorr_ap_state ); + + v_multc( onset_filter, 0.25f, onset_filter, hDirAC->num_freq_bands ); + v_add( onset_filter, onset_filter_subframe, onset_filter_subframe, hDirAC->num_freq_bands ); + p_onset_filter = onset_filter_subframe; + } + else + { + ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + nchan_transport, + hDirAC->proto_frame_f, + hDirAC->num_protos_diff, + hDirAC->proto_index_diff, + DirAC_mem.frame_dec_f, + onset_filter, + hDirAC->h_freq_domain_decorr_ap_params, + hDirAC->h_freq_domain_decorr_ap_state ); + + hDirAC->proto_frame_dec_f = DirAC_mem.frame_dec_f; + p_onset_filter = onset_filter; + } + } + else + { + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - /*Compute diffuse prototypes*/ - ivas_dirac_dec_compute_diffuse_proto( hDirAC, slot_idx ); + set_f( onset_filter_subframe, 1.f, hDirAC->num_freq_bands ); + p_onset_filter = onset_filter_subframe; } + else + { + /* no frequency domain decorrelation: use prototype frame */ + hDirAC->proto_frame_dec_f = hDirAC->proto_frame_f; + p_onset_filter = NULL; + } + } + + /*-----------------------------------------------------------------* + * output synthesis + *-----------------------------------------------------------------*/ + + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) + { + /*Compute diffuse prototypes*/ + ivas_dirac_dec_compute_diffuse_proto( hDirAC, slot_idx ); + } + + /*Compute PSDs*/ +#ifndef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 2 ) + { + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, + hDirAC, + p_Rmat, + st_ivas->hVBAPdata, + hDirAC->hOutSetup, + nchan_transport +#ifndef HODIRAC + , + index_slot +#endif +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && + st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k +#endif + ); + } + else + { + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, + hDirAC, + 0, + st_ivas->hVBAPdata, + hDirAC->hOutSetup, + nchan_transport +#ifndef HODIRAC + , + index_slot +#endif +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && + st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k +#endif - /*Compute PSDs*/ - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 2 ) + ); + } +#else + if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) { ivas_dirac_dec_output_synthesis_process_slot( reference_power, p_onset_filter, + azimuth[slot_idx], + elevation[slot_idx], + diffuseness_vector[slot_idx], hDirAC, + st_ivas->hHeadTrackData->shd_rot_max_order, p_Rmat, st_ivas->hVBAPdata, hDirAC->hOutSetup, nchan_transport, - index_slot ); + md_idx, +#ifdef HODIRAC + st_ivas->sba_analysis_order > 1 && + st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k +#endif + + ); } else { ivas_dirac_dec_output_synthesis_process_slot( reference_power, p_onset_filter, + azimuth[slot_idx], + elevation[slot_idx], + diffuseness_vector[slot_idx], hDirAC, 0, + 0, st_ivas->hVBAPdata, hDirAC->hOutSetup, nchan_transport, - index_slot ); - } - - if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) - { - v_add( reference_power, reference_power_smooth, reference_power_smooth, hDirAC->num_freq_bands ); + md_idx, +#ifdef HODIRAC + st_ivas->sba_analysis_order > 1 && + st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k +#endif + ); } +#endif - if ( hDirAC->hConfig->dec_param_estim ) - { - hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; - } + if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + { + v_add( reference_power, reference_power_smooth, reference_power_smooth, hDirAC->num_freq_bands ); } - if ( hDirAC->hConfig->dec_param_estim == 0 ) +#ifndef JBM_TSM_ON_TCS + if ( hDirAC->hConfig->dec_param_estim ) { hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; } +#endif + } +#ifndef JBM_TSM_ON_TCS + if ( hDirAC->hConfig->dec_param_estim == 0 ) + { + hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; + } +#endif +#ifdef JBM_TSM_ON_TCS + ivas_dirac_dec_output_synthesis_get_interpolator( &hDirAC->h_output_synthesis_psd_params, hDirAC->subframe_nbslots[subframe_idx] ); - if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + if ( hDirAC->hConfig->dec_param_estim == FALSE ) + { + md_idx = hDirAC->render_to_md_map[subframe_idx]; + } + else + { + md_idx = hDirAC->render_to_md_map[slot_idx_start]; + } + + /* Workaround for BE (should be gone when #393 is adressed and diffuseness index in the gain SHD renderer with HO-DirAC is fixed) */ + /* :TODO: remove */ + /* get the correct md index for the diffuseness in direction smoothing and HO-DirAC, it is always the first slot of the next subframe*/ + if ( slot_idx_start + hDirAC->subframe_nbslots[subframe_idx] == hDirAC->num_slots ) + { + /* we are at the end, get the next one using the normal dirac read idx...*/ + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) { - ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - hDirAC, - nchan_transport, - p_onset_filter ); + md_idx = ( hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % hDirAC->dirac_md_buffer_length; } else { - /* Determine encoding quality based additional smoothing factor */ - float qualityBasedSmFactor = 1.0f; - if ( st_ivas->hMasa != NULL ) + md_idx = ( hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % hDirAC->dirac_md_buffer_length; + } + } + else + { + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) + { + md_idx = hDirAC->render_to_md_map[slot_idx_start + hDirAC->subframe_nbslots[subframe_idx]]; + } + else + { + md_idx = hDirAC->render_to_md_map[subframe_idx + 1]; + } + } + +#endif + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + hDirAC, + nchan_transport, +#ifdef JBM_TSM_ON_TCS + hDirAC->subframe_nbslots[subframe_idx], +#endif + p_onset_filter +#ifdef HODIRAC + , +#ifdef JBM_TSM_ON_TCS + md_idx, +#endif + st_ivas->sba_analysis_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k +#endif + ); + } + else + { + /* Determine encoding quality based additional smoothing factor */ + float qualityBasedSmFactor = 1.0f; + + if ( st_ivas->hMasa != NULL ) + { + qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; + qualityBasedSmFactor *= qualityBasedSmFactor; + } +#ifdef JBM_TSM_ON_TCS + /* Workaround for BE (should be gone when #393 is adressed) */ + if ( hDirAC->hConfig->dec_param_estim == 1 ) + { + num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) { - qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; - qualityBasedSmFactor *= qualityBasedSmFactor; + mvs2s( azimuth[slot_idx], hDirAC->azimuth[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], num_freq_bands ); + mvs2s( elevation[slot_idx], hDirAC->elevation[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], num_freq_bands ); + mvr2r( diffuseness_vector[slot_idx], hDirAC->diffuseness_vector[hDirAC->render_to_md_map[slot_idx + slot_idx_start]], num_freq_bands ); } - - ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, - Cldfb_ImagBuffer, - hDirAC, - reference_power_smooth, - qualityBasedSmFactor ); } - /*-----------------------------------------------------------------* - * CLDFB synthesis (and binaural rendering) - *-----------------------------------------------------------------*/ - index_slot = subframe_idx * hDirAC->subframe_nbslots; +#endif + ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, + Cldfb_ImagBuffer, + hDirAC, +#ifdef JBM_TSM_ON_TCS + hDirAC->subframe_nbslots[subframe_idx], + md_idx, +#endif + reference_power_smooth, + qualityBasedSmFactor ); + } - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - /* Perform binaural rendering */ - ivas_binRenderer( st_ivas->hBinRenderer, - st_ivas->hHeadTrackData, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - Cldfb_RealBuffer, - Cldfb_ImagBuffer ); + /*-----------------------------------------------------------------* + * CLDFB synthesis (and binaural rendering) + *-----------------------------------------------------------------*/ +#ifdef JBM_TSM_ON_TCS + index_slot = slot_idx_start_cldfb_synth; +#else + index_slot = subframe_idx * hDirAC->subframe_nbslots; +#endif - /* Inverse CLDFB*/ - for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + /* Perform binaural rendering */ + ivas_binRenderer( st_ivas->hBinRenderer, + st_ivas->hHeadTrackData, +#ifdef JBM_TSM_ON_TCS + hDirAC->subframe_nbslots[subframe_idx], +#endif + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + Cldfb_RealBuffer, + Cldfb_ImagBuffer ); + /* Inverse CLDFB*/ + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) +#else for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; - } +#endif + { + RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; + } +#ifdef JBM_TSM_ON_TCS + cldfbSynthesis( RealBuffer, + ImagBuffer, + &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), + hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], + st_ivas->cldfbSynDec[ch] ); +#else cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[ch] ); - } +#endif } - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + } + else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + for ( ch = 0; ch < hDirAC->hOutSetup.nchan_out_woLFE; ch++ ) { - for ( ch = 0; ch < hDirAC->hOutSetup.nchan_out_woLFE; ch++ ) - { +#ifdef JBM_TSM_ON_TCS + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) +#else for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) - { - mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hDirAC->num_freq_bands ); - mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hDirAC->num_freq_bands ); - } +#endif + { + mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hDirAC->num_freq_bands ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hDirAC->num_freq_bands ); } } - else - { - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - int16_t outchannels; + } + else + { + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + int16_t outchannels; - idx_in = 0; - idx_lfe = 0; + idx_in = 0; + idx_lfe = 0; - outchannels = hDirAC->hOutSetup.nchan_out_woLFE + hDirAC->hOutSetup.num_lfe; - if ( hDirAC->hOutSetup.separateChannelEnabled && ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || - hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || - ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) - { - outchannels++; - } + outchannels = hDirAC->hOutSetup.nchan_out_woLFE + hDirAC->hOutSetup.num_lfe; + if ( hDirAC->hOutSetup.separateChannelEnabled && ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1 || + hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1 || + hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_2 || + hDirAC->hOutSetup.output_config == AUDIO_CONFIG_5_1_4 || + hDirAC->hOutSetup.output_config == AUDIO_CONFIG_7_1_4 || + ( hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hLsSetupCustom->separate_ch_found ) ) ) + { + outchannels++; + } - if ( hDirAC->hOutSetup.separateChannelEnabled && hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM ) - { - float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; - const int16_t subframe_start_sample = index_slot * hDirAC->num_freq_bands; + if ( hDirAC->hOutSetup.separateChannelEnabled && hDirAC->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + const int16_t subframe_start_sample = index_slot * hDirAC->num_freq_bands; +#ifdef JBM_TSM_ON_TCS + const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx]; +#else const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots; +#endif - /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ - mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); - mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); + /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ + mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); + mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); - for ( ch = 0; ch < outchannels; ch++ ) + for ( ch = 0; ch < outchannels; ch++ ) + { + if ( ( hDirAC->hOutSetup.num_lfe > 0 ) && ( hDirAC->hOutSetup.index_lfe[idx_lfe] == ch ) ) { - if ( ( hDirAC->hOutSetup.num_lfe > 0 ) && ( hDirAC->hOutSetup.index_lfe[idx_lfe] == ch ) ) - { - /* Move the LFE channel to the correct place */ - mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + /* Move the LFE channel to the correct place */ + mvr2r( tmp_lfe, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirAC->hOutSetup.separateChannelIndex == ch ) ) + if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) { - /* Move the separated channel to the correct place. Thus, the separated channel is - * combined with the synthesized channels here when there is a matching channel. */ - mvr2r( tmp_separated, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + idx_lfe++; } - else - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + } + else if ( ( st_ivas->hLsSetupCustom->separate_ch_found ) && ( hDirAC->hOutSetup.separateChannelIndex == ch ) ) + { + /* Move the separated channel to the correct place. Thus, the separated channel is + * combined with the synthesized channels here when there is a matching channel. */ + mvr2r( tmp_separated, &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); + } + else + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) +#else for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); - - if ( !st_ivas->hLsSetupCustom->separate_ch_found ) - { - /* Pan the separated channel and mix with the synthesized channels. Thus, the separated channel - * is combined with the synthesized channels here when there is no matching channel. */ - v_multc_acc( tmp_separated, st_ivas->hLsSetupCustom->separate_ch_gains[idx_in], &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); - } +#endif + { + RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; + } + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][subframe_start_sample] ), num_samples_subframe, st_ivas->cldfbSynDec[idx_in] ); - idx_in++; + if ( !st_ivas->hLsSetupCustom->separate_ch_found ) + { + /* Pan the separated channel and mix with the synthesized channels. Thus, the separated channel + * is combined with the synthesized channels here when there is no matching channel. */ + v_multc_acc( tmp_separated, st_ivas->hLsSetupCustom->separate_ch_gains[idx_in], &( output_f[ch][subframe_start_sample] ), num_samples_subframe ); } + + idx_in++; } } - else + } + else + { + for ( ch = 0; ch < outchannels; ch++ ) { - for ( ch = 0; ch < outchannels; ch++ ) + if ( ( hDirAC->hOutSetup.num_lfe > 0 ) && ( hDirAC->hOutSetup.index_lfe[idx_lfe] == ch ) ) { - if ( ( hDirAC->hOutSetup.num_lfe > 0 ) && ( hDirAC->hOutSetup.index_lfe[idx_lfe] == ch ) ) + if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled ) { - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled ) - { +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) +#else for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); - } - else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirAC->hOutSetup.separateChannelEnabled ) - { - /* LFE has been synthesized in the time domain, do nothing. */ - } - else - { - set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots * hDirAC->num_freq_bands ); - } - - if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) +#endif { - idx_lfe++; + RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; } +#ifdef JBM_TSM_ON_TCS + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); +#else + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); +#endif } - else if ( ( hDirAC->hOutSetup.separateChannelEnabled ) && ( hDirAC->hOutSetup.separateChannelIndex == ch ) ) + else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirAC->hOutSetup.separateChannelEnabled ) { - /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated - * channel is combined with the synthesized channels here. */ + /* LFE has been synthesized in the time domain, do nothing. */ } else { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ +#ifdef JBM_TSM_ON_TCS + set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); +#else + set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots * hDirAC->num_freq_bands ); +#endif + } + + if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else if ( ( hDirAC->hOutSetup.separateChannelEnabled ) && ( hDirAC->hOutSetup.separateChannelIndex == ch ) ) + { + /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated + * channel is combined with the synthesized channels here. */ + } + else + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) +#else for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[idx_in] ); - idx_in++; +#endif + { + RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } +#ifdef JBM_TSM_ON_TCS + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); +#else + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[idx_in] ); +#endif + idx_in++; } } } } +#ifdef JBM_TSM_ON_TCS + hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe_idx]; + hDirAC->subframes_rendered++; +#endif +#ifndef JBM_TSM_ON_TCS +} +#endif - pop_wmops(); +pop_wmops(); - return; +return; } @@ -3202,7 +4594,12 @@ static void protoSignalComputation4( const int16_t num_outputs_diff, const int16_t num_freq_bands, const float *mtx_hoa_decoder, - const int16_t nchan_transport ) + const int16_t nchan_transport +#ifdef SPAR_TUNING + , + const int16_t *sba_map_tc_ind +#endif +) { int16_t k, l; int16_t n; @@ -3228,8 +4625,13 @@ static void protoSignalComputation4( proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] = 0.f; for ( n = 0; n < nchan_transport; n++ ) { - proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc[n]]; - proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc[n]]; +#ifdef SPAR_TUNING + proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; + proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc_ind[n]]; +#else + proto_frame_f[2 * l * num_freq_bands + 2 * k] += RealBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc[n]]; + proto_frame_f[2 * l * num_freq_bands + 2 * k + 1] += ImagBuffer[n][0][k] * mtx_hoa_decoder[l * 16 + sba_map_tc[n]]; +#endif } } } @@ -3249,6 +4651,7 @@ static void protoSignalComputation4( return; } + /*------------------------------------------------------------------------- * ivas_dirac_dec_compute_diffuse_proto() * @@ -3256,8 +4659,9 @@ static void protoSignalComputation4( *------------------------------------------------------------------------*/ static void ivas_dirac_dec_compute_diffuse_proto( - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t slot_idx ) + DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + const int16_t slot_idx /* i : slot index */ +) { int16_t k, l; int16_t num_freq_bands, num_freq_bands_diff; @@ -3265,7 +4669,6 @@ static void ivas_dirac_dec_compute_diffuse_proto( float *p_proto_diff, *p_power_smooth, *proto_frame_dec_f; DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; - int16_t m; float *p_hoa_enc; @@ -3377,6 +4780,7 @@ static void computeDirectionAngles( return; } + /*------------------------------------------------------------------------- * ivas_masa_init_stereotype_detection() * @@ -3539,6 +4943,7 @@ static void computeIntensityVector_dec( */ int16_t i; float real, img; + for ( i = 0; i < num_frequency_bands; ++i ) { real = Cldfb_RealBuffer[0][0][i]; @@ -3617,3 +5022,48 @@ static void ivas_lfe_synth_with_cldfb( return; } + + +/*------------------------------------------------------------------------- + * rotateAziEle_DirAC() + * + * Apply rotation to DirAC DOAs + *------------------------------------------------------------------------*/ + +static void rotateAziEle_DirAC( + int16_t *azi, /* i/o: array of azimuth values */ + int16_t *ele, /* i/o: array of elevation values */ + const int16_t band1, /* i : bands to work on (lower limit) */ + const int16_t band2, /* i : bands to work on (upper bound) */ + const float *p_Rmat /* i : pointer to real-space rotation matrix */ +) +{ + int16_t b; + float dv_0, dv_1, dv_2; + float dv_r_0, dv_r_1, dv_r_2; + float w; + + push_wmops( "rotateAziEle_DirAC" ); + + for ( b = band1; b < band2; b++ ) + { + + /*Conversion spherical to cartesian coordinates*/ + w = cosf( ele[b] * PI_OVER_180 ); + dv_0 = w * cosf( azi[b] * PI_OVER_180 ); + dv_1 = w * sinf( azi[b] * PI_OVER_180 ); + dv_2 = sinf( ele[b] * PI_OVER_180 ); + + dv_r_0 = p_Rmat[0] * dv_0 + p_Rmat[1] * dv_1 + p_Rmat[2] * dv_2; + dv_r_1 = p_Rmat[3] * dv_0 + p_Rmat[4] * dv_1 + p_Rmat[5] * dv_2; + dv_r_2 = p_Rmat[6] * dv_0 + p_Rmat[7] * dv_1 + p_Rmat[8] * dv_2; + + /*Conversion spherical to cartesian coordinates*/ + azi[b] = (int16_t) ( atan2f( dv_r_1, dv_r_0 ) * _180_OVER_PI ); + ele[b] = (int16_t) ( atan2f( dv_r_2, sqrtf( dv_r_0 * dv_r_0 + dv_r_1 * dv_r_1 ) ) * _180_OVER_PI ); + } + + pop_wmops(); + + return; +} diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c deleted file mode 100644 index 7cdd0cc12778250979c9d1075106d3ec02ac1d1d..0000000000000000000000000000000000000000 --- a/lib_dec/ivas_dirac_dec_binaural_functions.c +++ /dev/null @@ -1,1886 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2023 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. - -*******************************************************************************************************/ -// VE2AT: move to lib_rend ? -#include -#include "options.h" -#include -#include -#include "prot.h" -#include "ivas_prot.h" -#include "ivas_cnst.h" -#include "ivas_rom_binauralRenderer.h" // VE2AT: what about to put these includes ust into ivas_rom_rend.c ? -#include "ivas_rom_dec.h" -#ifdef DEBUGGING -#include "debug.h" -#endif -#include "wmc_auto.h" - - -/*------------------------------------------------------------------------- - * Local constants - *------------------------------------------------------------------------*/ - -#define CLDFB_HALF_BIN_FREQUENCY_OFFSET 0.5f -#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) -#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) - -/*------------------------------------------------------------------------- - * Local function prototypes - *------------------------------------------------------------------------*/ - -static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], const int16_t nchan_transport, const uint8_t firstSubframe, const uint8_t nSubframes ); - -static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_HANDLE hDirAC, const int8_t slot, float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); - -static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const uint8_t firstSubframe, const uint8_t nSubFrames ); - -static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struct *st_ivas, const int16_t max_band_decorr, float Rmat[3][3] ); - -static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const uint8_t numInputChannels, const uint8_t firstSlot, const uint8_t slotEnd ); - -static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); - -static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); - -static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, const int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp ); - -static void getDirectPartGains( const int16_t bin, int16_t aziDeg, int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, const uint8_t stereoMode, float Rmat[3][3] ); - -static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); - -static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_init_binaural_data() - * - * Initialize parametric binaural renderer - *------------------------------------------------------------------------*/ - -#ifdef HRTF_BINARY_FILE -ivas_error ivas_dirac_dec_init_binaural_data( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ -) -#else -ivas_error ivas_dirac_dec_init_binaural_data( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -#endif -{ - DIRAC_DEC_BIN_HANDLE hBinaural; - int16_t nBins; - int32_t output_Fs; - RENDERER_TYPE renderer_type; - int16_t j, k, bin; - float binCenterFreq, tmpFloat; - ivas_error error; - - hBinaural = st_ivas->hDiracDecBin; - - if ( hBinaural == NULL ) - { - if ( ( hBinaural = (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 " ); - } - - hBinaural->hTdDecorr = NULL; - hBinaural->hReverb = NULL; - } - - nBins = st_ivas->hDirAC->num_freq_bands; - output_Fs = st_ivas->hDecoderConfig->output_Fs; - renderer_type = st_ivas->renderer_type; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - for ( k = 0; k < BINAURAL_CHANNELS + 1; k++ ) - { - set_zero( hBinaural->processMtxRe[j][k], nBins ); - set_zero( hBinaural->processMtxIm[j][k], nBins ); - } - - for ( k = 0; k < BINAURAL_CHANNELS; k++ ) - { - set_zero( hBinaural->processMtxDecRe[j][k], nBins ); - set_zero( hBinaural->processMtxDecIm[j][k], nBins ); - } - set_zero( hBinaural->ChEnePrev[j], nBins ); - set_zero( hBinaural->ChEneOutPrev[j], nBins ); - } - set_zero( hBinaural->ChCrossRePrev, nBins ); - set_zero( hBinaural->ChCrossImPrev, nBins ); - set_zero( hBinaural->ChCrossReOutPrev, nBins ); - set_zero( hBinaural->ChCrossImOutPrev, nBins ); - hBinaural->renderStereoOutputInsteadOfBinaural = 0; - - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) /* Use subframe-mode with SPAR, since the metadata is not in sync on a frame level */ - { - hBinaural->useSubframeMode = 1; - } - else - { -#ifdef DEBUGGING - hBinaural->useSubframeMode = st_ivas->hDecoderConfig->forceSubframeBinauralization; -#else - hBinaural->useSubframeMode = 0; /* Default to 20 ms mode. */ -#endif - } - - hBinaural->useTdDecorr = 0; - if ( st_ivas->ivas_format == SBA_FORMAT ) - { - if ( st_ivas->nchan_transport == 1 ) - { - hBinaural->useTdDecorr = 1; - } - } - else if ( st_ivas->ivas_format == MASA_FORMAT ) - { - if ( ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_48k && st_ivas->nchan_transport == 1 ) || st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - hBinaural->useTdDecorr = 1; - } - } - else if ( st_ivas->ivas_format == MC_FORMAT ) - { - if ( ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_48k && st_ivas->nchan_transport == 1 ) ) - { - hBinaural->useTdDecorr = 1; - } - } - - 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 ); - hBinaural->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); - } - - for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) - { - hBinaural->diffuseFieldCoherenceX[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; - hBinaural->diffuseFieldCoherenceY[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; - hBinaural->diffuseFieldCoherenceZ[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; - } - - if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ - { - set_f( hBinaural->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hBinaural->hReverb = NULL; - } - else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ - { -#ifdef HRTF_BINARY_FILE - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins ); -#else - mvr2r( parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins ); -#endif - - /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ - if ( hBinaural->hReverb != NULL && ( ( hBinaural->hReverb->numBins != nBins ) || - ( hBinaural->useSubframeMode && hBinaural->hReverb->blockSize != CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ) || - ( !hBinaural->useSubframeMode && hBinaural->hReverb->blockSize != CLDFB_NO_COL_MAX ) ) ) - { - ivas_binaural_reverb_close( &( hBinaural->hReverb ) ); - } - - if ( hBinaural->hReverb == NULL ) - { - if ( hBinaural->useSubframeMode ) - { -#ifdef HRTF_BINARY_FILE - if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, - nBins, - CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, - st_ivas->hIntSetup.output_config, - output_Fs, - RENDERER_BINAURAL_PARAMETRIC_ROOM, - st_ivas->hHrtfFastConv, - st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) != IVAS_ERR_OK ) -#endif - { - return error; - } - } - else - { -#ifdef HRTF_BINARY_FILE - if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, - nBins, - CLDFB_NO_COL_MAX, - NULL, - st_ivas->hIntSetup.output_config, - output_Fs, - RENDERER_BINAURAL_PARAMETRIC_ROOM, - st_ivas->hHrtfFastConv, - st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, nBins, CLDFB_NO_COL_MAX, NULL, st_ivas->hIntSetup.output_config, output_Fs, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) != IVAS_ERR_OK ) -#endif - { - return error; - } - } - } - } - else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - set_f( hBinaural->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hBinaural->hReverb = NULL; - hBinaural->renderStereoOutputInsteadOfBinaural = 1; - } - else /* Not valid renderer type for this renderer */ - { - assert( false ); - } - - if ( hBinaural->useTdDecorr ) - { - if ( st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_13k2 && st_ivas->ivas_format == SBA_FORMAT ) - { - if ( hBinaural->hTdDecorr == NULL ) - { - ivas_spar_td_decorr_dec_open( &( hBinaural->hTdDecorr ), output_Fs, 3, 1 ); - } - - if ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 ) - { - hBinaural->hTdDecorr->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR; - } - else - { - hBinaural->hTdDecorr->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN; - } - } - else - { - ivas_spar_td_decorr_dec_open( &( hBinaural->hTdDecorr ), output_Fs, 3, 0 ); - } - } - else - { - ivas_spar_td_decorr_dec_close( &( hBinaural->hTdDecorr ) ); - } - - st_ivas->hDiracDecBin = hBinaural; - - return IVAS_ERR_OK; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_close_binaural_data() - * - * Close parametric binaural renderer - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_close_binaural_data( - DIRAC_DEC_BIN_HANDLE *hBinaural /* i/o: decoder DirAC binaural data handle */ -) -{ - if ( *hBinaural == NULL ) - { - return; - } - - if ( ( *hBinaural )->hReverb != NULL ) - { - ivas_binaural_reverb_close( &( ( *hBinaural )->hReverb ) ); - } - - ivas_spar_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); - - free( *hBinaural ); - *hBinaural = NULL; - - return; -} - -#ifdef HRTF_BINARY_FILE -/*------------------------------------------------------------------------- - * ivas_dirac_dec_binaural_copy_hrtfs() - * - * Temporary function for copying HRTF data from rom tables if no binary - * file was given. - *------------------------------------------------------------------------*/ - -ivas_error ivas_dirac_dec_binaural_copy_hrtfs( - HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ -) -{ - int16_t i, j; - if ( hHrtfParambin != NULL && *hHrtfParambin != NULL ) - { - /* Tables already loaded from file */ - return IVAS_ERR_OK; - } - else - { - /* Initialise tables from ROM */ - HRTFS_PARAMBIN *hrtfParambin; - - if ( ( hrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for parametric binauralizer HRTF tables" ); - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { - mvr2r( hrtfShCoeffsRe[i][j], hrtfParambin->hrtfShCoeffsRe[i][j], HRTF_NUM_BINS ); - mvr2r( hrtfShCoeffsIm[i][j], hrtfParambin->hrtfShCoeffsIm[i][j], HRTF_NUM_BINS ); - } - } - - mvr2r( parametricReverberationTimes, hrtfParambin->parametricReverberationTimes, CLDFB_NO_CHANNELS_MAX ); - mvr2r( parametricReverberationEneCorrections, hrtfParambin->parametricReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); - mvr2r( parametricEarlyPartEneCorrection, hrtfParambin->parametricEarlyPartEneCorrection, CLDFB_NO_CHANNELS_MAX ); - - *hHrtfParambin = hrtfParambin; - } - - return IVAS_ERR_OK; -} -#endif - -/*------------------------------------------------------------------------- - * ivas_dirac_dec_binaural() - * - * Parametric binaural renderer main function - *------------------------------------------------------------------------*/ - -void ivas_dirac_dec_binaural( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t nchan_transport /* i : number of transport channels */ -) -{ - if ( st_ivas->hDiracDecBin->useTdDecorr ) - { - float *decorr_signal[BINAURAL_CHANNELS]; - int16_t ch; - int16_t output_frame; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - decorr_signal[ch] = (float *) &( output_f[ch + BINAURAL_CHANNELS][0] ); - } - output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - - ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, output_f, decorr_signal, output_frame ); - } - - if ( st_ivas->hDiracDecBin->useSubframeMode ) - { - uint8_t subframe; - for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) - { - ivas_dirac_dec_binaural_internal( st_ivas, output_f, nchan_transport, subframe, 1u ); - } - } - else - { - ivas_dirac_dec_binaural_internal( st_ivas, output_f, nchan_transport, 0u, (uint8_t) MAX_PARAM_SPATIAL_SUBFRAMES ); - } - - return; -} - - -/*------------------------------------------------------------------------- - * Local functions - *------------------------------------------------------------------------*/ - -static void ivas_dirac_dec_binaural_internal( - Decoder_Struct *st_ivas, - float output_f[][L_FRAME48k], - const int16_t nchan_transport, - const uint8_t firstSubframe, - const uint8_t nSubframes ) -{ - DIRAC_DEC_HANDLE hDirAC; - uint8_t slot, ch, nBins, numInChannels; - float Cldfb_RealBuffer_in[4][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_in[4][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float Rmat[3][3]; - uint8_t firstSlot, slotEnd; - int16_t max_band_decorr; - DIFFUSE_DISTRIBUTION_DATA diffuseDistData; - - firstSlot = firstSubframe * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); - slotEnd = ( firstSubframe + nSubframes ) * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); - - hDirAC = st_ivas->hDirAC; - nBins = (uint8_t) hDirAC->num_freq_bands; - - /* The input channel number at this processing function (not nchan_transport) */ - numInChannels = BINAURAL_CHANNELS; - if ( st_ivas->hOutSetup.separateChannelEnabled ) - { - numInChannels++; - } - - Rmat[0][0] = 1.0f; - Rmat[0][1] = 0.0f; - Rmat[0][2] = 0.0f; - - Rmat[1][0] = 0.0f; - Rmat[1][1] = 1.0f; - Rmat[1][2] = 0.0f; - - Rmat[2][0] = 0.0f; - Rmat[2][1] = 0.0f; - Rmat[2][2] = 1.0f; - - /* CLDFB Analysis of input */ - for ( slot = firstSlot; slot < slotEnd; slot++ ) - { - for ( ch = 0; ch < numInChannels; ch++ ) - { - if ( ch == 0 || nchan_transport == 2 ) - { - cldfbAnalysis_ts( &( output_f[ch][nBins * slot] ), - Cldfb_RealBuffer_in[ch][slot], - Cldfb_ImagBuffer_in[ch][slot], - nBins, st_ivas->cldfbAnaDec[ch] ); - } - else if ( st_ivas->nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ - { - /* At mono input duplicate the channel to dual-mono */ - mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); - mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); - } - else /* when nchan_transport == 1 and ch == 1 */ - { - /* CNA and HB FD-CNG*/ - if ( st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) - { - int16_t numCoreBands, b; - - numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; - - generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, - st_ivas->cldfbAnaDec[1], - &( output_f[1][L_FRAME48k - L_FRAME16k] ), /*used as temporary static buffer for the whole frame*/ - Cldfb_RealBuffer_in[2][slot], Cldfb_ImagBuffer_in[2][slot], - slot, - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, - ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); - - generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, - st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ - NULL, - Cldfb_RealBuffer_in[1][slot], Cldfb_ImagBuffer_in[1][slot], - slot, - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, - ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); - - /* LB: Copy first channel + LB-CNG to first and second channels with same scaling (dual-mono)*/ - for ( b = 0; b < numCoreBands; b++ ) - { - Cldfb_RealBuffer_in[0][slot][b] = INV_SQRT2 * ( Cldfb_RealBuffer_in[0][slot][b] + Cldfb_RealBuffer_in[2][slot][b] ); - Cldfb_RealBuffer_in[1][slot][b] = Cldfb_RealBuffer_in[0][slot][b]; - Cldfb_ImagBuffer_in[0][slot][b] = INV_SQRT2 * ( Cldfb_ImagBuffer_in[0][slot][b] + Cldfb_ImagBuffer_in[2][slot][b] ); - Cldfb_ImagBuffer_in[1][slot][b] = Cldfb_ImagBuffer_in[0][slot][b]; - } - - /* HB: Copy first channel to second channel and add HB-CNGs with different scalings*/ - for ( ; b < nBins; b++ ) - { - Cldfb_RealBuffer_in[0][slot][b] *= INV_SQRT2; - Cldfb_RealBuffer_in[1][slot][b] = Cldfb_RealBuffer_in[0][slot][b] + 0.5f * Cldfb_RealBuffer_in[1][slot][b] + Cldfb_RealBuffer_in[0][slot][b]; - Cldfb_RealBuffer_in[0][slot][b] += 0.5f * Cldfb_RealBuffer_in[2][slot][b]; - - Cldfb_ImagBuffer_in[0][slot][b] *= INV_SQRT2; - Cldfb_ImagBuffer_in[1][slot][b] = Cldfb_ImagBuffer_in[0][slot][b] + 0.5f * Cldfb_ImagBuffer_in[1][slot][b]; - Cldfb_ImagBuffer_in[0][slot][b] += 0.5f * Cldfb_ImagBuffer_in[2][slot][b]; - } - } - else - { - /* At mono input duplicate the channel to dual-mono, and apply gain - correction to ensure same overall level as in stereo mode */ - v_multc( Cldfb_RealBuffer_in[0][slot], INV_SQRT_2, Cldfb_RealBuffer_in[0][slot], nBins ); - v_multc( Cldfb_ImagBuffer_in[0][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[0][slot], nBins ); - - mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); - mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); - } - } - } - - if ( st_ivas->hDiracDecBin->useTdDecorr ) - { - for ( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) - { - cldfbAnalysis_ts( &( output_f[ch][nBins * slot] ), - Cldfb_RealBuffer_in[ch][slot], - Cldfb_ImagBuffer_in[ch][slot], - nBins, st_ivas->cldfbAnaDec[ch] ); - - if ( st_ivas->nchan_transport == 1 && st_ivas->ivas_format == SBA_FORMAT ) - { - v_multc( Cldfb_RealBuffer_in[ch][slot], INV_SQRT_2, Cldfb_RealBuffer_in[ch][slot], nBins ); - v_multc( Cldfb_ImagBuffer_in[ch][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[ch][slot], nBins ); - } - } - } - } - - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) - { - st_ivas->hDirAC->hDiffuseDist = &diffuseDistData; - - ivas_spar_param_to_masa_param_mapping( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSubframe, nSubframes ); - - ivas_sba_prototype_renderer( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSubframe, nSubframes ); - } - - if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) - { - QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[firstSubframe], Rmat ); - - if ( nchan_transport == 2 ) - { - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_ImagBuffer_in, Cldfb_RealBuffer_in, firstSlot, slotEnd, nBins, Rmat ); - } - } - - ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, firstSubframe, nSubframes ); - - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - max_band_decorr = 0; - } - else if ( st_ivas->hDiracDecBin->useTdDecorr ) - { - max_band_decorr = CLDFB_NO_CHANNELS_MAX; - } - else - { - max_band_decorr = st_ivas->hDirAC->h_freq_domain_decorr_ap_params->max_band_decorr; - } - - ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat ); - - ivas_dirac_dec_binaural_process_output( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, firstSlot, slotEnd ); - - st_ivas->hDirAC->hDiffuseDist = NULL; - - return; -} - - -static void ivas_dirac_dec_decorrelate_slot( - DIRAC_DEC_HANDLE hDirAC, - const int8_t slot, - float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float decRe[][CLDFB_NO_CHANNELS_MAX], - float decIm[][CLDFB_NO_CHANNELS_MAX] ) -{ - int16_t offset, ch, bin; - float onset_filter[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, 60 bins */ - float decorrelatedFrameInterleaved[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ - - /* Decorrelation needs interleaved data. Copy left and right signals to proto_frame_f */ - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; - for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) - { - hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; - hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; - } - } - - /* Decorrelate proto signal to decorrelatedFrameInterleaved */ - ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, - hDirAC->num_outputs_diff, - hDirAC->num_protos_diff, - hDirAC->synthesisConf, - BINAURAL_CHANNELS, - hDirAC->proto_frame_f, - hDirAC->num_protos_diff, - hDirAC->proto_index_diff, - decorrelatedFrameInterleaved, - onset_filter, - hDirAC->h_freq_domain_decorr_ap_params, - hDirAC->h_freq_domain_decorr_ap_state ); - - /* De-interleave decorrelated signals*/ - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; - for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) - { - decRe[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset]; - decIm[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset + 1]; - } - } - - return; -} - - -static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( - Decoder_Struct *st_ivas, - float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Rmat[3][3], - const uint8_t firstSubframe, - const uint8_t nSubframes ) -{ - uint8_t ch, slot, bin, subframe; - uint8_t separateCenterChannelRendering; - int16_t nBins, idx; - float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; - DIRAC_DEC_HANDLE hDirAC; - DIRAC_DEC_BIN_HANDLE h; - float IIReneLimiterFactor; - float qualityBasedSmFactor; - float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; - uint8_t applyLowBitRateEQ; - int16_t dirac_read_idx; - - hDirAC = st_ivas->hDirAC; - h = st_ivas->hDiracDecBin; - separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; - nBins = hDirAC->num_freq_bands; /* Actually bins */ - - set_zero( h->ChCrossRe, nBins ); - set_zero( h->ChCrossIm, nBins ); - set_zero( h->ChCrossReOut, nBins ); - set_zero( h->ChCrossImOut, nBins ); - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - set_zero( h->ChEne[ch], nBins ); - set_zero( h->ChEneOut[ch], nBins ); - } - set_zero( h->frameMeanDiffuseness, nBins ); - - set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); - - /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ - applyLowBitRateEQ = 0; - if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MC_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - applyLowBitRateEQ = 1; - if ( st_ivas->hDecoderConfig->ivas_total_brate == IVAS_16k4 ) - { - for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) - { - lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin] * 0.5f + 0.5f; - } - } - else - { - for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) - { - lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin]; - } - } - } - - /* Formulate input and target covariance matrices combining all subframes */ - for ( subframe = firstSubframe; subframe < ( firstSubframe + nSubframes ); subframe++ ) - { - float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; - - set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - dirac_read_idx = hDirAC->dirac_read_idx; - - /* Calculate input covariance matrix */ - for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots; slot++ ) - { - int16_t slotThis = slot + ( hDirAC->subframe_nbslots * subframe ); - - for ( bin = 0; bin < nBins; bin++ ) - { - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - float instEne; - - instEne = ( inRe[ch][slotThis][bin] * inRe[ch][slotThis][bin] ); - instEne += ( inIm[ch][slotThis][bin] * inIm[ch][slotThis][bin] ); - h->ChEne[ch][bin] += instEne; - subFrameTotalEne[bin] += instEne; - } - h->ChCrossRe[bin] += inRe[0][slotThis][bin] * inRe[1][slotThis][bin]; - h->ChCrossRe[bin] += inIm[0][slotThis][bin] * inIm[1][slotThis][bin]; - h->ChCrossIm[bin] += inRe[0][slotThis][bin] * inIm[1][slotThis][bin]; - h->ChCrossIm[bin] -= inIm[0][slotThis][bin] * inRe[1][slotThis][bin]; - } - } - - /* Apply EQ at low bit rates */ - if ( applyLowBitRateEQ ) - { - int16_t lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; - - for ( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) - { - subFrameTotalEne[bin] *= lowBitRateEQ[bin]; - } - for ( ; bin < nBins; bin++ ) - { - subFrameTotalEne[bin] *= lowBitRateEQ[lastEqBin]; - } - } - - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 2 ) - { - float tempRe, tempIm; - - set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); - - for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots; slot++ ) - { - int16_t slotThis = slot + ( hDirAC->subframe_nbslots * subframe ); - - for ( bin = 0; bin < nBins; bin++ ) - { - tempRe = inRe[0][slotThis][bin] + inRe[1][slotThis][bin]; - tempIm = inIm[0][slotThis][bin] + inIm[1][slotThis][bin]; - subFrameTotalEne[bin] += tempRe * tempRe + tempIm * tempIm; - } - } - } - - /* Determine target covariance matrix containing target binaural properties */ - for ( bin = 0; bin < nBins; bin++ ) - { - float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ - float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ - float diffEne, dirEne, meanEnePerCh; - uint16_t dirIndex; - - /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. - * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the - * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match - * the early spectrum of the BRIR data, using the spectral correction data in - * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ - meanEnePerCh = h->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; - - /* Determine direct part target covariance matrix (for 1 or 2 directions) */ - for ( dirIndex = 0; dirIndex < hDirAC->numSimultaneousDirections; dirIndex++ ) - { - int16_t aziDeg, eleDeg; - float lRealp, lImagp, rRealp, rImagp; - float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; - float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; - - if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ - { - aziDeg = hDirAC->azimuth[dirac_read_idx][bin]; - eleDeg = hDirAC->elevation[dirac_read_idx][bin]; - ratio = hDirAC->energy_ratio1[dirac_read_idx][bin]; - spreadCoh = hDirAC->spreadCoherence[dirac_read_idx][bin]; - } - else /* For second of the two simultaneous directions */ - { - aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; - eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; - ratio = hDirAC->energy_ratio2[dirac_read_idx][bin]; - spreadCoh = hDirAC->spreadCoherence2[dirac_read_idx][bin]; - } - diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ - - if ( separateCenterChannelRendering ) - { - /* In masa + mono rendering mode, the center directions originate from phantom sources, so the - * spread coherence is increased */ - float aziRad, eleRad, doaVectorX, spatialAngleDeg, altSpreadCoh; - - aziRad = (float) aziDeg * PI_OVER_180; - eleRad = (float) eleDeg * PI_OVER_180; - doaVectorX = cosf( aziRad ) * cosf( eleRad ); - spatialAngleDeg = acosf( doaVectorX ) * _180_OVER_PI; - altSpreadCoh = 1.0f - ( spatialAngleDeg / 30.0f ); - spreadCoh = max( spreadCoh, altSpreadCoh ); - } - - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); - - if ( h->renderStereoOutputInsteadOfBinaural ) - { - /* Synthesizing spread coherence is not needed for stereo loudspeaker output, - * as directional sound is reproduced with two loudspeakers in any case */ - spreadCoh = 0.0f; - } - - if ( spreadCoh > 0.0f ) - { - float centerMul, sidesMul; - float hrtfEneCenter, hrtfEneSides, hrtfEneRealized, eneCorrectionFactor; - float w1, w2, w3, eq; - - hrtfEneCenter = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); - - /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. - * The following formulas determine the gains for these sources. - * spreadCoh = 0: Only panning - * spreadCoh = 0.5: Three sources coherent panning (e.g. 30 0 -30 deg azi) - * spreadCoh = 1.0: Two sources coherent panning with gap (as above, but center is silent) */ - if ( spreadCoh < 0.5f ) - { - /* 0.0f < spreadCoh < 0.5f */ - sidesMul = 0.5774f * spreadCoh * 2.0f; /* sqrt(1/3) = 0.5774f */ - centerMul = 1.0f - ( spreadCoh * 2.0f ) + sidesMul; - } - else - { - /* 0.5f <= spreadCoh < 1.0f */ - centerMul = 2.0f - ( 2.0f * spreadCoh ); - sidesMul = inv_sqrt( centerMul + 2.0f ); - centerMul *= sidesMul; - } - - /* Apply the gain for the center source of the three coherent sources */ - lRealp *= centerMul; - lImagp *= centerMul; - rRealp *= centerMul; - rImagp *= centerMul; - - /* Apply the gain for the left source of the three coherent sources */ - getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); - - hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); - lRealp += sidesMul * lRealpTmp; - lImagp += sidesMul * lImagpTmp; - rRealp += sidesMul * rRealpTmp; - rImagp += sidesMul * rImagpTmp; - - /* Apply the gain for the right source of the three coherent sources. - * -30 degrees to 330 wrapping due to internal functions. */ - getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); - - hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); - lRealp += sidesMul * lRealpTmp; - lImagp += sidesMul * lImagpTmp; - rRealp += sidesMul * rRealpTmp; - rImagp += sidesMul * rImagpTmp; - - /* Formulate an eneCorrectionFactor that compensates for the coherent summation of the HRTFs */ - hrtfEneRealized = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); - eneCorrectionFactor = ( ( hrtfEneSides * sidesMul * sidesMul ) + - ( hrtfEneCenter * centerMul * centerMul ) ) / - max( 1e-12f, hrtfEneRealized ); - - /* Weighting factors to determine appropriate target spectrum for spread coherent sound */ - if ( spreadCoh < 0.5 ) - { - w1 = 1.0f - 2.0f * spreadCoh; - w2 = 2.0f * spreadCoh; - w3 = 0.0f; - } - else - { - w1 = 0.0f; - w2 = 2.0f - 2.0f * spreadCoh; - w3 = 2.0f * spreadCoh - 1.0f; - } - - if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) - { - idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); - - /* Apply the target spectrum to the eneCorrectionFactor */ - if ( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */ - { - eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[idx]; - } - else - { - eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[idx] + w3 * spreadCohEne1[idx]; - } - } - - /* Equalize the spread coherent combined HRTFs */ - eq = min( 4.0f, sqrtf( eneCorrectionFactor ) ); - lRealp *= eq; - lImagp *= eq; - rRealp *= eq; - rImagp *= eq; - } - - hrtfEne[0] = ( lRealp * lRealp ) + ( lImagp * lImagp ); - hrtfEne[1] = ( rRealp * rRealp ) + ( rImagp * rImagp ); - hrtfCrossRe = ( lRealp * rRealp ) + ( lImagp * rImagp ); - hrtfCrossIm = ( -lImagp * rRealp ) + ( lRealp * rImagp ); - - /* Add direct part (1 or 2) covariance matrix */ - dirEne = ratio * meanEnePerCh; - h->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ - h->ChEneOut[1][bin] += dirEne * hrtfEne[1]; - h->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ - h->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ - } - - /* Add diffuse / ambient part covariance matrix */ - diffuseness = max( 0.0f, diffuseness ); - diffEne = diffuseness * meanEnePerCh; - surCoh = hDirAC->surroundingCoherence[dirac_read_idx][bin]; - if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) - { - if ( !h->renderStereoOutputInsteadOfBinaural ) - { - idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); - /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ - diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; - } - } - h->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ - h->ChEneOut[1][bin] += diffEne; - - if ( h->renderStereoOutputInsteadOfBinaural ) - { - /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ - h->ChCrossReOut[bin] += surCoh * diffEne; - } - else /* When rendering binaural, ambience has frequency dependent ICC. */ - { - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) - { - float diffuseFieldCoherence; - diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[subframe][bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[subframe][bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[subframe][bin] * h->diffuseFieldCoherenceZ[bin]; - h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; - } - else - { - h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * h->diffuseFieldCoherence[bin] + surCoh ) * diffEne; - } - } - - /* Store parameters for formulating average diffuseness over frame */ - h->frameMeanDiffuseness[bin] += diffEne; - frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; - } - - hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; - } - - /* Formulate average diffuseness over frame */ - for ( bin = 0; bin < nBins; bin++ ) - { - h->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); - } - - /* Determine encoding quality based additional smoothing factor */ - qualityBasedSmFactor = 1.0f; - if ( st_ivas->hMasa != NULL ) - { - qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; - qualityBasedSmFactor *= qualityBasedSmFactor; - } - - /* Temporal IIR-type smoothing of covariance matrices */ - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - IIReneLimiterFactor = 16.0f / (float) nSubframes + ( 1.0f - qualityBasedSmFactor ); - } - else - { - IIReneLimiterFactor = 8.0f / (float) nSubframes + ( 1.0f - qualityBasedSmFactor ); - } - for ( bin = 0; bin < nBins; bin++ ) - { - float eneRatio, IIReneLimiter; - - /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that - * the energy history (IIR) must not be more than double of the current frame energy. This provides more - * robust performance at energy offsets when compared to typical IIR averaging. */ - eneRatio = ( h->ChEne[0][bin] + h->ChEne[1][bin] ) / fmaxf( 1e-12f, ( h->ChEnePrev[0][bin] + h->ChEnePrev[1][bin] ) ); - IIReneLimiter = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); - - h->ChCrossRe[bin] *= qualityBasedSmFactor; - h->ChCrossIm[bin] *= qualityBasedSmFactor; - h->ChCrossReOut[bin] *= qualityBasedSmFactor; - h->ChCrossImOut[bin] *= qualityBasedSmFactor; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - h->ChEne[ch][bin] *= qualityBasedSmFactor; - h->ChEneOut[ch][bin] *= qualityBasedSmFactor; - } - - h->ChCrossRe[bin] += IIReneLimiter * h->ChCrossRePrev[bin]; - h->ChCrossIm[bin] += IIReneLimiter * h->ChCrossImPrev[bin]; - h->ChCrossReOut[bin] += IIReneLimiter * h->ChCrossReOutPrev[bin]; - h->ChCrossImOut[bin] += IIReneLimiter * h->ChCrossImOutPrev[bin]; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - h->ChEne[ch][bin] += IIReneLimiter * h->ChEnePrev[ch][bin]; - h->ChEneOut[ch][bin] += IIReneLimiter * h->ChEneOutPrev[ch][bin]; - } - - /* Store energy values and coefficients for next round */ - h->ChCrossRePrev[bin] = h->ChCrossRe[bin]; - h->ChCrossImPrev[bin] = h->ChCrossIm[bin]; - h->ChCrossReOutPrev[bin] = h->ChCrossReOut[bin]; - h->ChCrossImOutPrev[bin] = h->ChCrossImOut[bin]; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - h->ChEnePrev[ch][bin] = h->ChEne[ch][bin]; - h->ChEneOutPrev[ch][bin] = h->ChEneOut[ch][bin]; - } - } - - return; -} - - -static void ivas_dirac_dec_binaural_determine_processing_matrices( - Decoder_Struct *st_ivas, - const int16_t max_band_decorr, - float Rmat[3][3] ) -{ - uint8_t chA, chB, bin; - uint8_t separateCenterChannelRendering; - int16_t nBins; - DIRAC_DEC_BIN_HANDLE h; - h = st_ivas->hDiracDecBin; - separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; - nBins = st_ivas->hDirAC->num_freq_bands; /* Actually bins */ - - for ( bin = 0; bin < nBins; bin++ ) - { - float tmpMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], gain; - float CxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], CxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; /* Input covariance matrix */ - float realizedOutputEne, targetOutputEne, missingOutputEne; - float CrEneL, CrEneR; /* Cr = residual decorrelated sound covariance matrix */ - float CrCrossRe, CrCrossIm; - float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; /* M = mixing matrix; Mdec = residual decorrelated signal mixing matrix */ - float prototypeMtx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] = { { 1.0f, 0.05f }, { 0.05f, 1.0f } }; /* Prototype matrix determines a reference signal in mixing matrix determination */ - - CrEneL = 0.0f; - CrEneR = 0.0f; - - /* Formulate main processing matrix M */ - formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], - h->ChCrossRe[bin], h->ChCrossIm[bin], - h->ChEneOut[0][bin], h->ChEneOut[1][bin], - h->ChCrossReOut[bin], h->ChCrossImOut[bin], - prototypeMtx, Mre, Mim, 1.0f ); - - /* Load estimated covariance matrix to the [2][2] matrix form */ - CxRe[0][0] = h->ChEne[0][bin]; - CxRe[1][1] = h->ChEne[1][bin]; - CxRe[1][0] = h->ChCrossRe[bin]; - CxRe[0][1] = h->ChCrossRe[bin]; - CxIm[0][0] = 0.0f; - CxIm[1][1] = 0.0f; - CxIm[1][0] = h->ChCrossIm[bin]; - CxIm[0][1] = -h->ChCrossIm[bin]; - - /* Make matrix multiplication M*Cx*M' to determine resulting covariance matrix of processing input with M */ - matrixMul( Mre, Mim, CxRe, CxIm, tmpMtxRe, tmpMtxIm ); - matrixTransp2Mul( tmpMtxRe, tmpMtxIm, Mre, Mim, resultMtxRe, resultMtxIm ); - - /* When below the frequency limit where decorrelation is applied, we inject the decorrelated - * residual (or missing) signal component. The procedure is active when there are not enough independent - * signal energy to synthesize a signal with the target covariance matrix from the non-decorrelated signals */ - if ( bin < max_band_decorr ) - { - float decorrelationReductionFactor; - - /* Subtract the resulting covariance matrix from the target covariance matrix to determine - * what signal component is missing. The result is the target covariance matrix for the residual signal, i.e., - * a residual covariance matrix. */ - CrEneL = max( 0.0f, h->ChEneOut[0][bin] - resultMtxRe[0][0] ); - CrEneR = max( 0.0f, h->ChEneOut[1][bin] - resultMtxRe[1][1] ); - CrCrossRe = h->ChCrossReOut[bin] - resultMtxRe[1][0]; - CrCrossIm = h->ChCrossImOut[bin] - resultMtxIm[1][0]; - - /* The amount of the decorrelated sound is further controlled based on the spatial metadata, - * by determining an energy-suppressed residual covariance matrix that is a control parameter - * that guides the processing of the decorrelated sound to a residual signal. - * The procedure improves quality in e.g. double-talk 2-direction rendering situations.*/ - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) - { - decorrelationReductionFactor = 1.0f; - } - else if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 1 ) ) - { - decorrelationReductionFactor = sqrtf( fmaxf( 0.0f, h->frameMeanDiffuseness[bin] ) ); - } - else if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 1 ) - { - decorrelationReductionFactor = 1.0f; - } - else - { - decorrelationReductionFactor = fmaxf( 0.0f, h->frameMeanDiffuseness[bin] ); - } - CrEneL *= decorrelationReductionFactor; - CrEneR *= decorrelationReductionFactor; - CrCrossRe *= decorrelationReductionFactor; - CrCrossIm *= decorrelationReductionFactor; - - /* Determine a residual mixing matrix Mdec for processing the decorrelated signal to obtain - * the residual signal (that has the residual covariance matrix) */ - formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], - 0.0f, 0.0f, /* Decorrelated signal has ideally no cross-terms */ - CrEneL, CrEneR, - CrCrossRe, CrCrossIm, - prototypeMtx, MdecRe, MdecIm, 0.2f ); - } - else - { - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - set_zero( MdecRe[chA], BINAURAL_CHANNELS ); - set_zero( MdecIm[chA], BINAURAL_CHANNELS ); - } - } - - /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ - realizedOutputEne = CrEneL + CrEneR + resultMtxRe[0][0] + resultMtxRe[1][1]; - targetOutputEne = h->ChEneOut[0][bin] + h->ChEneOut[1][bin]; - missingOutputEne = fmaxf( 0.0f, targetOutputEne - realizedOutputEne ); - - gain = sqrtf( ( resultMtxRe[0][0] + resultMtxRe[1][1] + missingOutputEne ) / - fmaxf( 1e-12f, resultMtxRe[0][0] + resultMtxRe[1][1] ) ); - gain = fminf( 4.0f, gain ); - - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - Mre[chA][chB] *= gain; - Mim[chA][chB] *= gain; - } - } - - /* Store processing matrices */ - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - h->processMtxRePrev[chA][chB][bin] = h->processMtxRe[chA][chB][bin]; - h->processMtxImPrev[chA][chB][bin] = h->processMtxIm[chA][chB][bin]; - h->processMtxDecRePrev[chA][chB][bin] = h->processMtxDecRe[chA][chB][bin]; - h->processMtxDecImPrev[chA][chB][bin] = h->processMtxDecIm[chA][chB][bin]; - - h->processMtxRe[chA][chB][bin] = Mre[chA][chB]; - h->processMtxIm[chA][chB][bin] = Mim[chA][chB]; - h->processMtxDecRe[chA][chB][bin] = MdecRe[chA][chB]; - h->processMtxDecIm[chA][chB][bin] = MdecIm[chA][chB]; - } - } - - if ( separateCenterChannelRendering ) - { - /* The rendering of the separate center channel in masa + mono mode. - * The center channel is processed with a gain factor 0.8414f to match the loudness of different processing paths */ - float lRealp, lImagp, rRealp, rImagp; - float gainFactor; - int16_t aziDeg = 0; - int16_t eleDeg = 0; - - gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - h->processMtxRePrev[chA][2][bin] = h->processMtxRe[chA][2][bin]; - h->processMtxImPrev[chA][2][bin] = h->processMtxIm[chA][2][bin]; - } - - getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); - - h->processMtxRe[0][2][bin] = lRealp * gainFactor; - h->processMtxIm[0][2][bin] = lImagp * gainFactor; - h->processMtxRe[1][2][bin] = rRealp * gainFactor; - h->processMtxIm[1][2][bin] = rImagp * gainFactor; - } - } - - return; -} - - -static void ivas_dirac_dec_binaural_process_output( - Decoder_Struct *st_ivas, - float output_f[][L_FRAME48k], - float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t max_band_decorr, - const uint8_t numInChannels, - const uint8_t firstSlot, - const uint8_t slotEnd ) -{ - uint8_t slot, bin, chA, chB; - int16_t nBins; - float outSlotRe[CLDFB_NO_CHANNELS_MAX], outSlotIm[CLDFB_NO_CHANNELS_MAX]; - float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float reverbRe[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float reverbIm[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - uint8_t numSlots; - DIRAC_DEC_BIN_HANDLE h; - float interpVal; - float *decSlotRePointer; - float *decSlotImPointer; - - numSlots = slotEnd - firstSlot; - h = st_ivas->hDiracDecBin; - nBins = st_ivas->hDirAC->num_freq_bands; - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) - { - /* Process second / room effect part of binaural output when needed */ - ivas_binaural_reverb_processFrame( st_ivas->hDiracDecBin->hReverb, numInChannels, inRe, inIm, reverbRe, reverbIm, firstSlot ); - } - - interpVal = 0.0f; - for ( slot = firstSlot; slot < ( firstSlot + numSlots ); slot++ ) - { - interpVal += 1.0f / (float) numSlots; - if ( !st_ivas->hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) - { - ivas_dirac_dec_decorrelate_slot( st_ivas->hDirAC, slot, inRe, inIm, decSlotRe, decSlotIm ); - } - - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - float *outSlotRePr, *outSlotImPr; /* Pointers needed for function call compatibility */ - - set_zero( outSlotRe, CLDFB_NO_CHANNELS_MAX ); - set_zero( outSlotIm, CLDFB_NO_CHANNELS_MAX ); - - /* Processing of the first / HRTF part of the binaural output. */ - for ( chB = 0; chB < numInChannels; chB++ ) - { - if ( st_ivas->hDiracDecBin->useTdDecorr ) - { - decSlotRePointer = inRe[chB + 2][slot]; - decSlotImPointer = inIm[chB + 2][slot]; - } - else - { - decSlotRePointer = decSlotRe[chB]; - decSlotImPointer = decSlotIm[chB]; - } - - for ( bin = 0; bin < nBins; bin++ ) - { - float gain; - - /* Mixing using the formulated processing matrix M */ - gain = ( 1.0f - interpVal ) * h->processMtxRePrev[chA][chB][bin] + - interpVal * h->processMtxRe[chA][chB][bin]; - outSlotRe[bin] += gain * inRe[chB][slot][bin]; - outSlotIm[bin] += gain * inIm[chB][slot][bin]; - - gain = ( 1.0f - interpVal ) * h->processMtxImPrev[chA][chB][bin] + - interpVal * h->processMtxIm[chA][chB][bin]; - outSlotRe[bin] -= gain * inIm[chB][slot][bin]; - outSlotIm[bin] += gain * inRe[chB][slot][bin]; - - /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ - if ( bin < max_band_decorr && chB < 2 ) - { - gain = ( 1.0f - interpVal ) * h->processMtxDecRePrev[chA][chB][bin] + - interpVal * h->processMtxDecRe[chA][chB][bin]; - outSlotRe[bin] += gain * decSlotRePointer[bin]; - outSlotIm[bin] += gain * decSlotImPointer[bin]; - - gain = ( 1.0f - interpVal ) * h->processMtxDecImPrev[chA][chB][bin] + - interpVal * h->processMtxDecIm[chA][chB][bin]; - outSlotRe[bin] -= gain * decSlotImPointer[bin]; - outSlotIm[bin] += gain * decSlotRePointer[bin]; - } - } - } - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) - { - /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ - v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); - v_add( outSlotIm, reverbIm[chA][slot], outSlotIm, CLDFB_NO_CHANNELS_MAX ); - } - - outSlotRePr = &( outSlotRe[0] ); - outSlotImPr = &( outSlotIm[0] ); - - /* Inverse filter bank */ - cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot] ), nBins, st_ivas->cldfbSynDec[chA] ); - } - } - - return; -} - - -static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( - HEAD_TRACK_DATA_HANDLE hHeadTrackData, - float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const uint8_t firstSlot, - const uint8_t slotEnd, - const uint8_t nBins, - float Rmat[3][3] ) -{ - uint8_t slot, bin, ch; - float tmpVal; - - /* When not currently in prototype signal left-right switching procedure, check if such switching is needed */ - if ( hHeadTrackData->lrSwitchedNext == hHeadTrackData->lrSwitchedCurrent ) - { - float thresholdDotProduct = 0.17f; /* Corresponds to 10-degree switching threshold */ - if ( ( hHeadTrackData->lrSwitchedCurrent == 0 ) && ( Rmat[1][1] < -thresholdDotProduct ) ) - { - hHeadTrackData->lrSwitchedNext = 1; - } - if ( ( hHeadTrackData->lrSwitchedCurrent == 1 ) && ( Rmat[1][1] > thresholdDotProduct ) ) - { - hHeadTrackData->lrSwitchedNext = 0; - } - } - - /* When currently in interpolation */ - if ( hHeadTrackData->lrSwitchedNext != hHeadTrackData->lrSwitchedCurrent ) - { - for ( slot = firstSlot; slot < slotEnd; slot++ ) - { - float switchOrderFactor, origOrderFactor; - - hHeadTrackData->lrSwitchInterpVal += 0.0025f; /* Corresponds to 0.5 seconds interpolation time */ - - if ( hHeadTrackData->lrSwitchInterpVal > 0.999f ) - { - /* Stop interpolation, reset values */ - hHeadTrackData->lrSwitchInterpVal = 0.0f; - hHeadTrackData->lrSwitchedCurrent = hHeadTrackData->lrSwitchedNext; - } - - /* Gains for determining portion of switched channel order and original channel order */ - tmpVal = (float) hHeadTrackData->lrSwitchedNext * hHeadTrackData->lrSwitchInterpVal; - tmpVal += (float) hHeadTrackData->lrSwitchedCurrent * ( 1.0f - hHeadTrackData->lrSwitchInterpVal ); - switchOrderFactor = sqrtf( tmpVal ); - origOrderFactor = sqrtf( 1.0f - tmpVal ); - - for ( bin = 0; bin < nBins; bin++ ) - { - /* determine original order (1) signals and switched order (2) signals */ - float re1[BINAURAL_CHANNELS], re2[BINAURAL_CHANNELS], im1[BINAURAL_CHANNELS], im2[BINAURAL_CHANNELS]; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - re1[ch] = inRe[ch][slot][bin] * origOrderFactor; - re2[ch] = inRe[1 - ch][slot][bin] * switchOrderFactor; - im1[ch] = inIm[ch][slot][bin] * origOrderFactor; - im2[ch] = inIm[1 - ch][slot][bin] * switchOrderFactor; - } - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - float eneRef, ene, eq; - - /* Interpolate / mix original and switched order signals */ - inRe[ch][slot][bin] = re1[ch] + re2[ch]; - inIm[ch][slot][bin] = im1[ch] + im2[ch]; - - /* Equalize interpolated signals to preserve energy per bin */ - eneRef = ( re1[ch] * re1[ch] ) + ( re2[ch] * re2[ch] ) + ( im1[ch] * im1[ch] ) + ( im2[ch] * im2[ch] ); - ene = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); - eq = sqrtf( eneRef / fmaxf( 1e-12f, ene ) ); - eq = fminf( 4.0f, eq ); - inRe[ch][slot][bin] *= eq; - inIm[ch][slot][bin] *= eq; - } - } - } - } - else - { - /* If not in interpolation, but in switched prototype situation, then switch left and right channels */ - if ( hHeadTrackData->lrSwitchedCurrent == 1 ) - { - for ( slot = firstSlot; slot < slotEnd; slot++ ) - { - for ( bin = 0; bin < nBins; bin++ ) - { - tmpVal = inRe[0][slot][bin]; - inRe[0][slot][bin] = inRe[1][slot][bin]; - inRe[1][slot][bin] = tmpVal; - tmpVal = inIm[0][slot][bin]; - inIm[0][slot][bin] = inIm[1][slot][bin]; - inIm[1][slot][bin] = tmpVal; - } - } - } - } - - return; -} - - -static void eig2x2( - const float E1, - const float E2, - const float Cre, - const float Cim, - float Ure[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Uim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float D[BINAURAL_CHANNELS] ) -{ - int16_t chA, chB, ch; - float s, normVal, crossSquare, a, pm, add; - - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - Ure[chA][chB] = 0.0f; - Uim[chA][chB] = 0.0f; - } - } - - crossSquare = ( Cre * Cre ) + ( Cim * Cim ); - a = ( E1 + E2 ) * ( E1 + E2 ) - 4.0f * ( ( E1 * E2 ) - crossSquare ); - pm = 0.5f * sqrtf( max( 0.0f, a ) ); - add = 0.5f * ( E1 + E2 ); - - D[0] = add + pm; - D[1] = max( 0.0f, add - pm ); - - /* Numeric case, when input is practically zeros */ - if ( D[0] < 1e-12f ) - { - Ure[0][0] = 1.0f; - Ure[1][1] = 1.0f; - - return; - } - - /* Numeric case, when input is near an identity matrix with a gain */ - if ( pm < ( 1e-3f * add ) ) - { - Ure[0][0] = 1.0f; - Ure[1][1] = 1.0f; - - return; - } - - /* Eigenvectors */ - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - if ( fabsf( E2 - D[ch] ) > fabsf( E1 - D[ch] ) ) - { - s = D[ch] - E2; - normVal = sqrtf( 1.0f / ( 1e-12f + crossSquare + s * s ) ); - - Ure[0][ch] = s * normVal; - Ure[1][ch] = Cre * normVal; - Uim[1][ch] = Cim * normVal; - } - else - { - s = D[ch] - E1; - normVal = sqrtf( 1.0f / ( 1e-12f + crossSquare + s * s ) ); - - Ure[1][ch] = s * normVal; - Ure[0][ch] = Cre * normVal; - Uim[0][ch] = -Cim * normVal; - } - } - - return; -} - - -static void matrixDiagMul( - float reIn[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float imIn[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - const float D[BINAURAL_CHANNELS], - float reOut[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float imOut[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) -{ - int16_t chA, chB; - - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - reOut[chA][chB] = reIn[chA][chB] * D[chB]; - imOut[chA][chB] = imIn[chA][chB] * D[chB]; - } - } - - return; -} - - -static void matrixMul( - float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) -{ - int16_t chA, chB; - - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - outRe[chA][chB] = Are[chA][0] * Bre[0][chB] + Are[chA][1] * Bre[1][chB]; - outRe[chA][chB] -= Aim[chA][0] * Bim[0][chB] + Aim[chA][1] * Bim[1][chB]; - outIm[chA][chB] = Aim[chA][0] * Bre[0][chB] + Aim[chA][1] * Bre[1][chB]; - outIm[chA][chB] += Are[chA][0] * Bim[0][chB] + Are[chA][1] * Bim[1][chB]; - } - } - - return; -} - - -static void matrixTransp1Mul( - float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) -{ - int16_t chA, chB; - - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - outRe[chA][chB] = Are[0][chA] * Bre[0][chB] + Are[1][chA] * Bre[1][chB]; - outRe[chA][chB] -= -Aim[0][chA] * Bim[0][chB] - Aim[1][chA] * Bim[1][chB]; - outIm[chA][chB] = -Aim[0][chA] * Bre[0][chB] - Aim[1][chA] * Bre[1][chB]; - outIm[chA][chB] += Are[0][chA] * Bim[0][chB] + Are[1][chA] * Bim[1][chB]; - } - } - - return; -} - - -static void matrixTransp2Mul( - float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) -{ - int16_t chA, chB; - - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - outRe[chA][chB] = Are[chA][0] * Bre[chB][0] + Are[chA][1] * Bre[chB][1]; - outRe[chA][chB] -= Aim[chA][0] * ( -Bim[chB][0] ) + Aim[chA][1] * ( -Bim[chB][1] ); - outIm[chA][chB] = Aim[chA][0] * Bre[chB][0] + Aim[chA][1] * Bre[chB][1]; - outIm[chA][chB] += Are[chA][0] * ( -Bim[chB][0] ) + Are[chA][1] * ( -Bim[chB][1] ); - } - } - - return; -} - - -static void chol2x2( - const float E1, - const float E2, - const float Cre, - const float Cim, - float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) -{ - int16_t chA, chB; - float sqrtVal; - - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - outRe[chA][chB] = 0.0f; - outIm[chA][chB] = 0.0f; - } - } - - if ( E1 > E2 ) /* Perform Cholesky decomposition according to louder channel first */ - { - outRe[0][0] = sqrtf( E1 ); - outRe[1][0] = Cre / ( 1e-12f + outRe[0][0] ); - outIm[1][0] = Cim / ( 1e-12f + outRe[0][0] ); - sqrtVal = E2 - ( Cre * Cre + Cim * Cim ) / ( 1e-12f + E1 ); - outRe[1][1] = sqrtf( max( 0.0f, sqrtVal ) ); - } - else - { - outRe[1][1] = sqrtf( E2 ); - outRe[0][1] = Cre / ( 1e-12f + outRe[1][1] ); - outIm[0][1] = -Cim / ( 1e-12f + outRe[1][1] ); - sqrtVal = E1 - ( Cre * Cre + Cim * Cim ) / ( 1e-12f + E2 ); - outRe[0][0] = sqrtf( max( 0.0f, sqrtVal ) ); - } - - return; -} - - -static void formulate2x2MixingMatrix( - float Ein1, - float Ein2, - float CinRe, - float CinIm, - float Eout1, - float Eout2, - float CoutRe, - float CoutIm, - float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], - const float regularizationFactor ) -{ - /* - This function implements a 2x2 solution for an optimized spatial audio rendering algorithm - Vilkamo, J., Bäckström, T. and Kuntz, A., 2013. - "Optimized covariance domain framework for time–frequency processing of spatial audio." - Journal of the Audio Engineering Society, 61(6), pp.403-411. - - The result of the formulas below are the same as those in the publication, however, some - derivation details differ for as simple as possible 2x2 formulattion - */ - int16_t chA, chB; - float maxEne, maxEneDiv; - float KyRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], KyIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float Uxre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Uxim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float Sx[BINAURAL_CHANNELS], Kxre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Kxim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float tmpRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float Ure[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Uim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float D[BINAURAL_CHANNELS]; - float div[BINAURAL_CHANNELS]; - float Ghat[BINAURAL_CHANNELS]; - float GhatQ[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - float Pre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Pim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - - /* Normalize energy values */ - maxEne = Ein1; - maxEne = max( maxEne, Ein2 ); - maxEne = max( maxEne, Eout1 ); - maxEne = max( maxEne, Eout2 ); - maxEneDiv = 1.0f / ( maxEne + 1e-12f ); - Ein1 *= maxEneDiv; - Ein2 *= maxEneDiv; - CinRe *= maxEneDiv; - CinIm *= maxEneDiv; - Eout1 *= maxEneDiv; - Eout2 *= maxEneDiv; - CoutRe *= maxEneDiv; - CoutIm *= maxEneDiv; - - /* Cholesky decomposition of target / output covariance matrix */ - chol2x2( Eout1, Eout2, CoutRe, CoutIm, KyRe, KyIm ); - - /* Eigendecomposition of input covariance matrix */ - eig2x2( Ein1, Ein2, CinRe, CinIm, Uxre, Uxim, Sx ); - - /* Eigendecomposition to Kx -- Ux Sx Ux' -> Kx Kx'*/ - Sx[0] = sqrtf( Sx[0] ); - Sx[1] = sqrtf( Sx[1] ); - matrixDiagMul( Uxre, Uxim, Sx, Kxre, Kxim ); - - /* Regularize the diagonal Sx for matrix inversion */ - Sx[0] = max( Sx[0], regularizationFactor * Sx[1] ); - Sx[1] = max( Sx[1], regularizationFactor * Sx[0] ); - - /* This is equivalent to the prototype signal energy normalization in the publication */ - Ghat[0] = sqrtf( Eout1 / ( 1e-12f + max( Ein1, 0.001f * Ein2 ) ) ); - Ghat[1] = sqrtf( Eout2 / ( 1e-12f + max( Ein2, 0.001f * Ein1 ) ) ); - - /* Matrix multiplication, tmp = Ky' * G_hat * Q */ - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - GhatQ[chA][0] = Q[chA][0] * Ghat[chA]; - GhatQ[chA][1] = Q[chA][1] * Ghat[chA]; - } - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - tmpRe[chA][chB] = KyRe[0][chA] * GhatQ[0][chB] + KyRe[1][chA] * GhatQ[1][chB]; - tmpIm[chA][chB] = -KyIm[0][chA] * GhatQ[0][chB] - KyIm[1][chA] * GhatQ[1][chB]; - } - } - - /* A = Ky' * G_hat * Q * Kx (see publication) */ - matrixMul( tmpRe, tmpIm, Kxre, Kxim, Are, Aim ); - - /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx - For matrix A that is P = A(A'A)^0.5 - */ - matrixTransp1Mul( Are, Aim, Are, Aim, tmpRe, tmpIm ); - - eig2x2( tmpRe[0][0], tmpRe[1][1], tmpRe[1][0], tmpIm[1][0], Ure, Uim, D ); - - div[0] = min( 10000.0f, sqrtf( 1.0f / ( 1e-12f + D[0] ) ) ); - div[1] = min( 10000.0f, sqrtf( 1.0f / ( 1e-12f + D[1] ) ) ); - - matrixMul( Are, Aim, Ure, Uim, tmpRe, tmpIm ); - - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - tmpRe[chA][chB] *= div[chB]; - tmpIm[chA][chB] *= div[chB]; - } - } - - matrixTransp2Mul( tmpRe, tmpIm, Ure, Uim, Pre, Pim ); /* Nearest orthonormal matrix P to matrix A formulated */ - - /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ - for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) - { - for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) - { - Pre[chA][chB] /= Sx[chB] + 1e-12f; - Pim[chA][chB] /= Sx[chB] + 1e-12f; - } - } - - matrixMul( KyRe, KyIm, Pre, Pim, tmpRe, tmpIm ); - - matrixTransp2Mul( tmpRe, tmpIm, Uxre, Uxim, Mre, Mim ); - - return; -} - - -static void getDirectPartGains( - const int16_t bin, - int16_t aziDeg, - int16_t eleDeg, - float *lRealp, - float *lImagp, - float *rRealp, - float *rImagp, - const uint8_t renderStereoOutputInsteadOfBinaural, - float Rmat[3][3] ) -{ - float aziRad, eleRad; - float y, mappedX, aziRadMapped, A, A2, A3; - const float LsAngleRad = 30.0f * PI_OVER_180; - - if ( renderStereoOutputInsteadOfBinaural ) /* In stereo (i.e. non-binaural) rendering mode */ - { - /* Convert azi and ele to an azi value of the cone of confusion */ - aziRad = (float) aziDeg * PI_OVER_180; - eleRad = (float) eleDeg * PI_OVER_180; - y = ( sinf( aziRad ) * cosf( eleRad ) ); - mappedX = sqrtf( max( 0.0f, 1.0f - ( y * y ) ) ); - aziRadMapped = atan2f( y, mappedX ); - - /* Determine the real valued amplitude panning gains */ - *lImagp = 0.0f; - *rImagp = 0.0f; - if ( aziRadMapped >= LsAngleRad ) - { /* Left side */ - *lRealp = 1.0f; - *rRealp = 0.0f; - } - else if ( aziRadMapped <= -LsAngleRad ) - { /* Right side */ - *lRealp = 0.0f; - *rRealp = 1.0f; - } - else /* Tangent panning law */ - { - A = tanf( aziRadMapped ) / tanf( LsAngleRad ); - A2 = ( A - 1.0f ) / max( 0.001f, A + 1.0f ); - A3 = 1.0f / ( A2 * A2 + 1.0f ); - *lRealp = sqrtf( A3 ); - *rRealp = sqrtf( 1.0f - A3 ); - } - - /* Scaling to have the same expected gain as for the HRTF rendering */ - *lRealp *= SQRT2; - *rRealp *= SQRT2; - } - else /* In regular binaural rendering mode */ - { - rotateAziEle( (float) aziDeg, (float) eleDeg, &aziDeg, &eleDeg, Rmat, 0 ); - hrtfShGetHrtf( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp ); - } - - return; -} - - -static void hrtfShGetHrtf( - const int16_t bin, - const int16_t aziDeg, - const int16_t eleDeg, - float *lRealp, - float *lImagp, - float *rRealp, - float *rImagp ) -{ - int16_t k; - float shVec[HRTF_SH_CHANNELS]; - - ivas_dirac_dec_get_response( aziDeg, - eleDeg, - shVec, - HRTF_SH_ORDER ); - - *lRealp = 0.0f; - *lImagp = 0.0f; - *rRealp = 0.0f; - *rImagp = 0.0f; - for ( k = 0; k < HRTF_SH_CHANNELS; k++ ) - { - *lRealp += hrtfShCoeffsRe[0][k][bin] * shVec[k]; - *lImagp += hrtfShCoeffsIm[0][k][bin] * shVec[k]; - *rRealp += hrtfShCoeffsRe[1][k][bin] * shVec[k]; - *rImagp += hrtfShCoeffsIm[1][k][bin] * shVec[k]; - } - - return; -} diff --git a/lib_dec/ivas_dirac_decorr_dec.c b/lib_dec/ivas_dirac_decorr_dec.c index 2d82bb0a3a6f334c13d22682272c7f653d138c1b..bcaa6cf2a13916ccb0b68bd275d0f243ba4df33d 100644 --- a/lib_dec/ivas_dirac_decorr_dec.c +++ b/lib_dec/ivas_dirac_decorr_dec.c @@ -70,10 +70,10 @@ static void lattice2allpass( const int16_t filter_length, const float *lattice_c /*------------------------------------------------------------------------- * ivas_dirac_dec_decorr_open() * - * + * Allocate and initialize TD decorrelator decoder handle *------------------------------------------------------------------------*/ -void ivas_dirac_dec_decorr_open( +ivas_error ivas_dirac_dec_decorr_open( DIRAC_DECORR_PARAMS **ph_freq_domain_decorr_ap_params, DIRAC_DECORR_STATE **ph_freq_domain_decorr_ap_state, const int16_t num_freq_bands, @@ -91,6 +91,7 @@ void ivas_dirac_dec_decorr_open( int16_t split_frequencies_bands[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] = { 0, 0, 0, 23768 }; int16_t *split_freq_ptr; float cur_lattice_delta_phi, lattice_coeffs[2 * DIRAC_MAX_DECORR_FILTER_LEN]; + ivas_error error; /* pointers to structs for allocation */ DIRAC_DECORR_PARAMS *freq_domain_decorr_ap_params = NULL; @@ -101,8 +102,15 @@ void ivas_dirac_dec_decorr_open( *-----------------------------------------------------------------*/ /* allocate structs */ - freq_domain_decorr_ap_params = (DIRAC_DECORR_PARAMS *) malloc( sizeof( DIRAC_DECORR_PARAMS ) ); - freq_domain_decorr_ap_state = (DIRAC_DECORR_STATE *) malloc( sizeof( DIRAC_DECORR_STATE ) ); + if ( ( freq_domain_decorr_ap_params = (DIRAC_DECORR_PARAMS *) malloc( sizeof( DIRAC_DECORR_PARAMS ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_state = (DIRAC_DECORR_STATE *) malloc( sizeof( DIRAC_DECORR_STATE ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } /*-----------------------------------------------------------------* * check input parameters @@ -164,7 +172,6 @@ void ivas_dirac_dec_decorr_open( } } - /*-----------------------------------------------------------------* * open sub-modules *-----------------------------------------------------------------*/ @@ -173,21 +180,17 @@ void ivas_dirac_dec_decorr_open( if ( synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /*Onset detector up to Nyquist and not only up to max_band_decorr*/ - ivas_dirac_dec_onset_detection_open( - num_protos_diff, - num_freq_bands, - num_freq_bands, - &freq_domain_decorr_ap_params->h_onset_detection_power_params, - &freq_domain_decorr_ap_state->h_onset_detection_power_state ); + if ( ( error = ivas_dirac_dec_onset_detection_open( num_protos_diff, num_freq_bands, num_freq_bands, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ) != IVAS_ERR_OK ) + { + return error; + } } else { - ivas_dirac_dec_onset_detection_open( - num_protos_diff, - num_freq_bands, - freq_domain_decorr_ap_params->max_band_decorr, - &freq_domain_decorr_ap_params->h_onset_detection_power_params, - &freq_domain_decorr_ap_state->h_onset_detection_power_state ); + if ( ( error = ivas_dirac_dec_onset_detection_open( num_protos_diff, num_freq_bands, freq_domain_decorr_ap_params->max_band_decorr, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ) != IVAS_ERR_OK ) + { + return error; + } } /*-----------------------------------------------------------------* @@ -215,7 +218,10 @@ void ivas_dirac_dec_decorr_open( } } - freq_domain_decorr_ap_params->split_frequency_bands = (int16_t *) malloc( sizeof( int16_t ) * ( freq_domain_decorr_ap_params->num_split_frequency_bands + 1 ) ); + if ( ( freq_domain_decorr_ap_params->split_frequency_bands = (int16_t *) malloc( sizeof( int16_t ) * ( freq_domain_decorr_ap_params->num_split_frequency_bands + 1 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } mvs2s( &split_frequencies_bands[0], freq_domain_decorr_ap_params->split_frequency_bands, freq_domain_decorr_ap_params->num_split_frequency_bands + 1 ); /* calc buffer size and allocate arrays */ @@ -232,18 +238,50 @@ void ivas_dirac_dec_decorr_open( if ( num_outputs_diff > 0 ) { buffer_size_decorr = ( ap_pre_delay[split_band_index_start] + ap_filter_length[split_band_index_start] ); - freq_domain_decorr_ap_state->decorr_buffer = (float *) malloc( sizeof( float ) * 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ); + if ( ( freq_domain_decorr_ap_state->decorr_buffer = (float *) malloc( sizeof( float ) * 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } set_f( freq_domain_decorr_ap_state->decorr_buffer, 0.0f, 2 * buffer_size_decorr * num_outputs_diff * freq_domain_decorr_ap_params->max_band_decorr ); - freq_domain_decorr_ap_params->filter_coeff_num_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_params->filter_coeff_den_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_params->phase_coeff_real = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_params->phase_coeff_imag = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_state->direct_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); - freq_domain_decorr_ap_state->reverb_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); + if ( ( freq_domain_decorr_ap_params->filter_coeff_num_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } - freq_domain_decorr_ap_params->pre_delay = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ); - freq_domain_decorr_ap_params->filter_length = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ); + if ( ( freq_domain_decorr_ap_params->filter_coeff_den_real = (float *) malloc( sizeof( float ) * ( ap_filter_length[split_band_index_start] + 1 ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_params->phase_coeff_real = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_params->phase_coeff_imag = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_state->direct_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_state->reverb_energy_smooth = (float *) malloc( sizeof( float ) * freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + + if ( ( freq_domain_decorr_ap_params->pre_delay = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } + if ( ( freq_domain_decorr_ap_params->filter_length = (int16_t *) malloc( sizeof( int16_t ) * freq_domain_decorr_ap_params->num_split_frequency_bands ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); + } set_f( freq_domain_decorr_ap_state->direct_energy_smooth, 0.0f, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); set_f( freq_domain_decorr_ap_state->reverb_energy_smooth, 0.0f, freq_domain_decorr_ap_params->max_band_decorr * num_outputs_diff ); @@ -280,7 +318,7 @@ void ivas_dirac_dec_decorr_open( *ph_freq_domain_decorr_ap_params = freq_domain_decorr_ap_params; *ph_freq_domain_decorr_ap_state = freq_domain_decorr_ap_state; - return; + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_dirac_onsets_dec.c b/lib_dec/ivas_dirac_onsets_dec.c index 050ec5acddaf17a39a0492972f1b1b0d84106fb7..c094b45ff68aa32a7770f677b3c61e70b763f127 100644 --- a/lib_dec/ivas_dirac_onsets_dec.c +++ b/lib_dec/ivas_dirac_onsets_dec.c @@ -51,7 +51,7 @@ * onset detection *------------------------------------------------------------------------*/ -void ivas_dirac_dec_onset_detection_open( +ivas_error ivas_dirac_dec_onset_detection_open( const int16_t num_protos_diff, const int16_t num_freq_bands, const int16_t max_band_decorr, @@ -69,14 +69,20 @@ void ivas_dirac_dec_onset_detection_open( dirac_onset_detection_params->max_band_decorr = max_band_decorr; /* memory allocation */ - dirac_onset_detection_state->onset_detector_1 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ); - dirac_onset_detection_state->onset_detector_2 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ); + if ( ( dirac_onset_detection_state->onset_detector_1 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); + } + if ( ( dirac_onset_detection_state->onset_detector_2 = (float *) malloc( sizeof( float ) * num_protos_diff * dirac_onset_detection_params->max_band_decorr ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for onset detection\n" ) ); + } /* init to zero */ set_zero( dirac_onset_detection_state->onset_detector_1, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); set_zero( dirac_onset_detection_state->onset_detector_2, num_protos_diff * dirac_onset_detection_params->max_band_decorr ); - return; + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 79560aae63f2ffd3ef2e0a7511ea0be63a025989..892cfe4acbd1120a7f3d2f4b90eae08a2fa2ad76 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -58,7 +58,7 @@ * Sets up the state and parameters for the Covariance Synthesis *-------------------------------------------------------------------*/ -void ivas_dirac_dec_output_synthesis_cov_open( +ivas_error ivas_dirac_dec_output_synthesis_cov_open( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: hanlde for the covariance synthesis state */ const int16_t max_band_decorr, /* i : uppermost frequency band where decorrelation is applied */ @@ -80,33 +80,62 @@ void ivas_dirac_dec_output_synthesis_cov_open( /* buffer length and interpolator */ h_dirac_output_synthesis_params->alpha_synthesis = NULL; - h_dirac_output_synthesis_params->proto_matrix = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ); + if ( ( h_dirac_output_synthesis_params->proto_matrix = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } /* cov buffers */ for ( idx = 0; idx < num_param_bands; idx++ ) { - h_dirac_output_synthesis_state->cx_old[idx] = (float *) malloc( nchan_in * nchan_in * sizeof( float ) ); - h_dirac_output_synthesis_state->cy_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ); - h_dirac_output_synthesis_state->mixing_matrix_old[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ); + if ( ( h_dirac_output_synthesis_state->cx_old[idx] = (float *) malloc( nchan_in * nchan_in * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } + if ( ( h_dirac_output_synthesis_state->cy_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } + if ( ( h_dirac_output_synthesis_state->mixing_matrix_old[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } set_zero( h_dirac_output_synthesis_state->cx_old[idx], nchan_in * nchan_in ); set_zero( h_dirac_output_synthesis_state->cy_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); +#ifdef JBM_TSM_ON_TCS + h_dirac_output_synthesis_state->mixing_matrix[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ); + set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); +#endif } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { h_dirac_output_synthesis_state->cx_old[idx] = NULL; h_dirac_output_synthesis_state->cy_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix_old[idx] = NULL; +#ifdef JBM_TSM_ON_TCS + h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; +#endif } for ( idx = 0; idx < num_param_bands_residual; idx++ ) { - h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ); + if ( ( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } set_zero( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx], nchan_out * nchan_out ); +#ifdef JBM_TSM_ON_TCS + h_dirac_output_synthesis_state->mixing_matrix_res[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ); + set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); +#endif } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = NULL; +#ifdef JBM_TSM_ON_TCS + h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; +#endif } /*-----------------------------------------------------------------* @@ -114,7 +143,11 @@ void ivas_dirac_dec_output_synthesis_cov_open( *-----------------------------------------------------------------*/ /* compute interpolator */ - h_dirac_output_synthesis_params->interpolator = (float *) malloc( interp_length * sizeof( float ) ); + if ( ( h_dirac_output_synthesis_params->interpolator = (float *) malloc( interp_length * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } + for ( idx = 1; idx <= interp_length; ++idx ) { h_dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) interp_length; @@ -122,8 +155,30 @@ void ivas_dirac_dec_output_synthesis_cov_open( mvr2r( proto_matrix, h_dirac_output_synthesis_params->proto_matrix, nchan_in * nchan_out ); + return IVAS_ERR_OK; +} + +#ifdef JBM_TSM_ON_TCS +/*-------------------------------------------------------------------* + * ivas_dirac_dec_output_synthesis_cov_open() + * + * Sets up the state and parameters for the Covariance Synthesis + *-------------------------------------------------------------------*/ + +void ivas_dirac_dec_output_synthesis_get_interpolator( + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ + const uint16_t interp_length ) +{ + int16_t idx; + + for ( idx = 1; idx <= interp_length; ++idx ) + { + h_dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) interp_length; + } + return; } +#endif /*-------------------------------------------------------------------* @@ -149,11 +204,17 @@ void ivas_dirac_dec_output_synthesis_cov_init( set_zero( h_dirac_output_synthesis_state->cx_old[idx], nchan_in * nchan_in ); set_zero( h_dirac_output_synthesis_state->cy_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); +#ifdef JBM_TSM_ON_TCS + set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); +#endif } for ( idx = 0; idx < n_param_bands_res; idx++ ) { set_zero( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx], nchan_out * nchan_out ); +#ifdef JBM_TSM_ON_TCS + set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); +#endif } return; @@ -171,7 +232,6 @@ void ivas_dirac_dec_output_synthesis_cov_close( DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state /* i/o: handle for the covariance synthesis state */ ) { - int16_t idx; /*-----------------------------------------------------------------* @@ -225,6 +285,19 @@ void ivas_dirac_dec_output_synthesis_cov_close( free( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] ); h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = NULL; } +#ifdef JBM_TSM_ON_TCS + if ( h_dirac_output_synthesis_state->mixing_matrix[idx] != NULL ) + { + free( h_dirac_output_synthesis_state->mixing_matrix[idx] ); + h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; + } + + if ( h_dirac_output_synthesis_state->mixing_matrix_res[idx] != NULL ) + { + free( h_dirac_output_synthesis_state->mixing_matrix_res[idx] ); + h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; + } +#endif } return; @@ -238,13 +311,21 @@ void ivas_dirac_dec_output_synthesis_cov_close( *-------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( - float RealBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ - float ImagBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part */ +#ifdef JBM_TSM_ON_TCS + float *RealBuffer, /* i : input channel filter bank samples (real part) */ + float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ +#else + float RealBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ + float ImagBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part */ +#endif float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ - const int16_t nchan_in, /* i : number of input channels */ - const int16_t idx_slot /* i : index of the slot to be added to the input covariance */ + const int16_t nchan_in /* i : number of input channels */ +#ifndef JBM_TSM_ON_TCS + , + const int16_t idx_slot /* i : index of the slot to be added to the input covariance */ +#endif ) { int16_t param_band, band_idx, ch_idx; @@ -270,8 +351,13 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( int16_t band = brange[0] + band_idx; for ( ch_idx = 0; ch_idx < nchan_in; ch_idx++ ) { +#ifdef JBM_TSM_ON_TCS + real_in_buffer[band_idx + num_bands * ch_idx] = RealBuffer[ch_idx * hParamMC->num_freq_bands + band]; + imag_in_buffer[band_idx + num_bands * ch_idx] = ImagBuffer[ch_idx * hParamMC->num_freq_bands + band]; +#else real_in_buffer[band_idx + num_bands * ch_idx] = RealBuffer[ch_idx][idx_slot][band]; imag_in_buffer[band_idx + num_bands * ch_idx] = ImagBuffer[ch_idx][idx_slot][band]; +#endif } } @@ -294,17 +380,27 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( *-------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( - float Cldfb_RealBuffer_in[][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ - float Cldfb_ImagBuffer_in[][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part) */ - float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ - float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ +#ifdef JBM_TSM_ON_TCS + float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ + float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ +#else + float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (real part) */ + float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (imaginary part) */ +#endif + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ +#ifdef JBM_TSM_ON_TCS + float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ + float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ +#else float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : parameter band wise mixing matrices (direct part) */ float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : parameter band wise mixing matrices (residual part) */ - const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ - const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ - const int16_t nX, /* i : number of input channels */ - const int16_t nY, /* i : number of output channels */ - PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ +#endif + const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ + const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ + const int16_t nX, /* i : number of input channels */ + const int16_t nY, /* i : number of output channels */ + PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ ) { int16_t param_band_idx, band, ch_idx; @@ -389,8 +485,13 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( /* collect input signals, still in cldfb buffers */ for ( ch_idx = 0; ch_idx < nX; ch_idx++ ) { +#ifdef JBM_TSM_ON_TCS + input_f_real[ch_idx] = Cldfb_RealBuffer_in[ch_idx * hParamMC->num_freq_bands + band]; + input_f_imag[ch_idx] = Cldfb_ImagBuffer_in[ch_idx * hParamMC->num_freq_bands + band]; +#else input_f_real[ch_idx] = Cldfb_RealBuffer_in[ch_idx][slot_idx_tot][band]; input_f_imag[ch_idx] = Cldfb_ImagBuffer_in[ch_idx][slot_idx_tot][band]; +#endif } /* apply mixing matrix */ diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 5cf1c8b2daa46594166905ef4d81e8a7a66cdfc7..a7bb8e504d67758f2111602c107bf46ffcae078e 100644 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -86,14 +86,21 @@ static void normalizePanningGains( float *direct_response, const int16_t num_cha * *------------------------------------------------------------------------*/ -void ivas_dirac_dec_output_synthesis_open( +ivas_error ivas_dirac_dec_output_synthesis_open( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ RENDERER_TYPE renderer_type, /* i : renderer type */ const int16_t nchan_transport, /* i : number of transport channels*/ const int32_t output_Fs /* i : output sampling rate */ +#ifdef HODIRAC + , + const int16_t hodirac /* i : flag to indicate HO-DirAC mode*/ +#endif ) { int16_t idx, ch_idx; +#ifdef HODIRAC + int16_t size; +#endif float tmp; uint16_t num_diffuse_responses; float temp_alpha_synthesis[CLDFB_NO_CHANNELS_MAX]; @@ -126,22 +133,34 @@ void ivas_dirac_dec_output_synthesis_open( dirac_output_synthesis_state->diffuse_responses_square = NULL; if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) { - dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( 2 * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( 2 * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->diffuse_responses_square = (float *) malloc( hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } /* prototype power buffers */ dirac_output_synthesis_state->proto_power_smooth_prev = NULL; if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_protos_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_protos_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } if ( dirac_output_synthesis_params->max_band_decorr > 0 && ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) ) { - dirac_output_synthesis_state->proto_power_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->proto_power_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else { @@ -149,41 +168,100 @@ void ivas_dirac_dec_output_synthesis_open( } /* buffer length and interpolator */ - dirac_output_synthesis_params->interpolator = (float *) malloc( hDirAC->subframe_nbslots * sizeof( float ) ); +#ifdef JBM_TSM_ON_TCS + if ( ( dirac_output_synthesis_params->interpolator = (float *) malloc( JBM_CLDFB_SLOTS_IN_SUBFRAME * sizeof( float ) ) ) == NULL ) +#else + if ( ( dirac_output_synthesis_params->interpolator = (float *) malloc( hDirAC->subframe_nbslots * sizeof( float ) ) ) == NULL ) +#endif + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } /* target PSD buffers */ - dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); +#ifdef HODIRAC + if ( hodirac ) + { + size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir * DIRAC_HO_NUMSECTORS; + } + else + { + size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir; + } + if ( ( dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( size * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } +#else + if ( ( dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } +#endif + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { dirac_output_synthesis_state->cy_auto_dir_smooth_prev = NULL; - dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else { - dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { - dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else { - dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } } /* direct and diffuse gain buffers */ - dirac_output_synthesis_state->gains_dir_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); +#ifdef HODIRAC + if ( ( dirac_output_synthesis_state->gains_dir_prev = (float *) malloc( size * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } +#else + if ( ( dirac_output_synthesis_state->gains_dir_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } +#endif + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_PSD_SHD && hDirAC->synthesisConf != DIRAC_SYNTHESIS_MONO ) { - dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } else { - dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->gains_diff_prev = (float *) malloc( hDirAC->num_freq_bands * hDirAC->num_outputs_dir * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } } /*-----------------------------------------------------------------* @@ -194,15 +272,27 @@ void ivas_dirac_dec_output_synthesis_open( if ( !( renderer_type == RENDERER_BINAURAL_PARAMETRIC || renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) { computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS, DIRAC_ALPHA_MAX, &dirac_output_synthesis_params->numAlphas, hDirAC->slot_size, hDirAC->num_freq_bands, hDirAC->frequency_axis, output_Fs ); - dirac_output_synthesis_params->alpha_synthesis = (float *) malloc( dirac_output_synthesis_params->numAlphas * sizeof( float ) ); + if ( ( dirac_output_synthesis_params->alpha_synthesis = (float *) malloc( dirac_output_synthesis_params->numAlphas * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis, dirac_output_synthesis_params->numAlphas ); computeAlphaSynthesis( temp_alpha_synthesis, DIRAC_AVG_LENGTH_SYNTH_MS_FAST, DIRAC_ALPHA_MAX_FAST, &dirac_output_synthesis_params->numAlphasFast, hDirAC->slot_size, hDirAC->num_freq_bands, hDirAC->frequency_axis, output_Fs ); - dirac_output_synthesis_params->alpha_synthesis_fast = (float *) malloc( dirac_output_synthesis_params->numAlphasFast * sizeof( float ) ); + if ( ( dirac_output_synthesis_params->alpha_synthesis_fast = (float *) malloc( dirac_output_synthesis_params->numAlphasFast * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } mvr2r( temp_alpha_synthesis, dirac_output_synthesis_params->alpha_synthesis_fast, dirac_output_synthesis_params->numAlphasFast ); - dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); - dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + if ( ( dirac_output_synthesis_state->reference_power_smooth_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } + if ( ( dirac_output_synthesis_state->direction_smoothness_prev = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); + } set_zero( dirac_output_synthesis_state->reference_power_smooth_prev, hDirAC->num_freq_bands ); set_zero( dirac_output_synthesis_state->direction_smoothness_prev, hDirAC->num_freq_bands ); } @@ -215,9 +305,17 @@ void ivas_dirac_dec_output_synthesis_open( } /* compute interpolator */ +#ifdef JBM_TSM_ON_TCS + for ( idx = 1; idx <= JBM_CLDFB_SLOTS_IN_SUBFRAME; ++idx ) +#else for ( idx = 1; idx <= hDirAC->subframe_nbslots; ++idx ) +#endif { +#ifdef JBM_TSM_ON_TCS + dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) JBM_CLDFB_SLOTS_IN_SUBFRAME; +#else dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) hDirAC->subframe_nbslots; +#endif } /* prepare diffuse response function */ @@ -276,7 +374,7 @@ void ivas_dirac_dec_output_synthesis_open( dirac_output_synthesis_params->diffuse_compensation_factor_decorr = 0.f; } - return; + return IVAS_ERR_OK; } @@ -289,8 +387,16 @@ void ivas_dirac_dec_output_synthesis_open( void ivas_dirac_dec_output_synthesis_init( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_out_woLFE /* i : number of output audio channels without LFE */ +#ifdef HODIRAC + , + const int16_t hodirac /* flag to indicate HO-DirAC mode */ +#endif ) { +#ifdef HODIRAC + int16_t size; +#endif + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; @@ -307,7 +413,19 @@ void ivas_dirac_dec_output_synthesis_init( set_zero( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_dir ); } +#ifdef HODIRAC + if ( hodirac ) + { + size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir * DIRAC_HO_NUMSECTORS; + } + else + { + size = hDirAC->num_freq_bands * hDirAC->num_outputs_dir; + } + set_zero( h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev, size ); +#else set_zero( h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_dir ); +#endif if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, h_dirac_output_synthesis_params->max_band_decorr * hDirAC->num_outputs_diff ); @@ -325,8 +443,11 @@ void ivas_dirac_dec_output_synthesis_init( { set_zero( h_dirac_output_synthesis_state->proto_power_smooth_prev, hDirAC->num_freq_bands * hDirAC->num_protos_dir ); } - +#ifdef HODIRAC + set_zero( h_dirac_output_synthesis_state->gains_dir_prev, size ); +#else set_zero( h_dirac_output_synthesis_state->gains_dir_prev, hDirAC->num_freq_bands * hDirAC->num_outputs_dir ); +#endif if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { @@ -454,25 +575,45 @@ void ivas_dirac_dec_output_synthesis_close( *------------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_process_slot( - const float *reference_power, /* i : Estimated power */ - const float *onset, /* i : onset filter */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ + const float *reference_power, /* i : Estimated power */ + const float *onset, /* i : onset filter */ +#ifdef JBM_TSM_ON_TCS + const int16_t *azimuth, + const int16_t *elevation, + const float *diffuseness, +#endif + DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ +#ifdef JBM_TSM_ON_TCS + const int16_t sh_rot_max_order, +#endif const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ - const int16_t nchan_transport, /* i : number of transport channels*/ - const int16_t index_slot ) + const int16_t nchan_transport /* i : number of transport channels*/ +#if !defined( HODIRAC ) || defined( JBM_TSM_ON_TCS ) + , + const int16_t md_idx +#endif +#ifdef HODIRAC + , + const int16_t hodirac +#endif +) { int16_t num_freq_bands, num_channels_dir; int16_t num_freq_bands_diff, num_channels_diff; int16_t ch_idx; float aux_buf[CLDFB_NO_CHANNELS_MAX]; int16_t diff_start_band; +#ifndef JBM_TSM_ON_TCS const float *diffuseness; +#endif DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; +#ifndef JBM_TSM_ON_TCS diffuseness = hDirAC->diffuseness_vector[hDirAC->dirac_read_idx]; +#endif h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); @@ -493,16 +634,115 @@ void ivas_dirac_dec_output_synthesis_process_slot( num_channels_dir = hOutSetup.nchan_out_woLFE; } - if ( hDirAC->hConfig->dec_param_estim == TRUE ) +#ifdef HODIRAC + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD && hodirac ) + { + ivas_dirac_dec_compute_directional_responses( hDirAC, + hVBAPdata, + NULL, +#ifdef JBM_TSM_ON_TCS + azimuth, + elevation, + md_idx, +#endif + NULL, + 2, + p_Rmat, + hodirac ); + } + if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac ) + { + if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { +#ifdef JBM_TSM_ON_TCS + v_multc( hDirAC->energy_ratio1[md_idx], -1.f, aux_buf, num_freq_bands ); + v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); + mvr2r( hDirAC->energy_ratio1[md_idx], + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + mvr2r( aux_buf, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); + + v_multc( hDirAC->energy_ratio2[md_idx], -1.f, aux_buf, num_freq_bands ); + v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); + mvr2r( hDirAC->energy_ratio2[md_idx], + &h_dirac_output_synthesis_state->direct_power_factor[hDirAC->num_freq_bands], + num_freq_bands ); + mvr2r( aux_buf, + &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands], + num_freq_bands ); +#else + v_multc( hDirAC->energy_ratio1[hDirAC->dirac_read_idx], -1.f, aux_buf, num_freq_bands ); + v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); + mvr2r( hDirAC->energy_ratio1[hDirAC->dirac_read_idx], + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + mvr2r( aux_buf, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); + + v_multc( hDirAC->energy_ratio2[hDirAC->dirac_read_idx], -1.f, aux_buf, num_freq_bands ); + v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); + mvr2r( hDirAC->energy_ratio2[hDirAC->dirac_read_idx], + &h_dirac_output_synthesis_state->direct_power_factor[hDirAC->num_freq_bands], + num_freq_bands ); + mvr2r( aux_buf, + &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands], + num_freq_bands ); +#endif + } + else + { +#ifdef JBM_TSM_ON_TCS + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + hDirAC->diffuseness_vector[md_idx], + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); +#else + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); +#endif + } + } + else // ( hDirAC->hConfig->dec_param_estim == TRUE ) +#endif + if ( hDirAC->hConfig->dec_param_estim == TRUE ) { + /* compute direct responses */ +#ifdef JBM_TSM_ON_TCS + ivas_dirac_dec_compute_directional_responses( hDirAC, + hVBAPdata, + NULL, + azimuth, + elevation, + md_idx, + NULL, + sh_rot_max_order, + p_Rmat +#ifdef HODIRAC + , + hodirac /* i : flag for sector based dirac processing */ +#endif + ); +#else ivas_dirac_dec_compute_directional_responses( hDirAC, hVBAPdata, NULL, - index_slot, - index_slot / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, + NULL, 2, - p_Rmat ); + p_Rmat +#ifdef HODIRAC + , + 0 +#endif + ); +#endif if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { @@ -512,6 +752,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor ); + v_multc( h_dirac_output_synthesis_state->direct_power_factor, 0.25f, h_dirac_output_synthesis_state->direct_power_factor, @@ -521,7 +762,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( h_dirac_output_synthesis_state->diffuse_power_factor, num_freq_bands ); - /*Direct gain*/ for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) { @@ -559,6 +799,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( } } } + /*Directional gain (panning)*/ for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) { @@ -592,7 +833,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( else { /* compute reference and diffuse power factor for this frame */ - ivas_dirac_dec_compute_power_factors( num_freq_bands, diffuseness, h_dirac_output_synthesis_params->max_band_decorr, @@ -639,7 +879,18 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ - const float *onset_filter ) +#ifdef JBM_TSM_ON_TCS + const int16_t nbslots, /* i : number of slots to process */ +#endif + const float *onset_filter +#ifdef HODIRAC + , +#ifdef JBM_TSM_ON_TCS + const int16_t md_idx, +#endif + const int16_t hodirac /* i: flag for sector-based processing */ +#endif +) { int16_t buf_idx, ch_idx, i, l; int16_t num_freq_bands, num_freq_bands_diff; @@ -659,6 +910,12 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( int16_t nchan_transport_foa; int16_t ch_idx_diff; +#ifdef HODIRAC + float aux_buf[CLDFB_NO_CHANNELS_MAX]; + float ratio[DIRAC_HO_NUMSECTORS * CLDFB_NO_CHANNELS_MAX]; + const float *diffuseness; +#endif + /* collect some often used parameters */ h_dirac_output_synthesis_params = hDirAC->h_output_synthesis_psd_params; h_dirac_output_synthesis_state = hDirAC->h_output_synthesis_psd_state; @@ -671,11 +928,75 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( num_channels_diff = hDirAC->num_outputs_diff; nchan_transport_foa = min( 4, nchan_transport ); +#ifdef HODIRAC +#ifdef JBM_TSM_ON_TCS + diffuseness = hDirAC->diffuseness_vector[md_idx]; +#else + diffuseness = hDirAC->diffuseness_vector[hDirAC->dirac_read_idx]; +#endif +#endif + /*-----------------------------------------------------------------* * comput target Gains *-----------------------------------------------------------------*/ - if ( hDirAC->hConfig->dec_param_estim == FALSE ) +#ifdef HODIRAC + if ( hodirac ) + { + assert( hDirAC->hConfig->dec_param_estim == FALSE ); + /*Direct gain*/ + for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) + { + v_multc( diffuseness, + 1.f, + &h_dirac_output_synthesis_state.cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); + v_multc( &h_dirac_output_synthesis_state.cy_cross_dir_smooth[ch_idx * num_freq_bands], + h_dirac_output_synthesis_params.diffuse_compensation_factor - 1.f, + &h_dirac_output_synthesis_state.cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); + + for ( l = 0; l < num_freq_bands; l++ ) + { + h_dirac_output_synthesis_state.cy_cross_dir_smooth[ch_idx * num_freq_bands + l] = sqrtf( 1.f + h_dirac_output_synthesis_state.cy_cross_dir_smooth[ch_idx * num_freq_bands + l] ); + } + } + + /*Directional gain*/ + for ( ch_idx = nchan_transport_foa; ch_idx < num_channels_dir; ch_idx++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + aux_buf[l] = 1.f - diffuseness[l]; + ratio[l] = 1.f - h_dirac_output_synthesis_state.direct_power_factor[hDirAC->num_freq_bands + l]; + ratio[l + num_freq_bands] = 1.f - ratio[l]; + } + + v_mult( aux_buf, ratio, ratio, num_freq_bands ); + v_mult( aux_buf, &ratio[num_freq_bands], &ratio[num_freq_bands], num_freq_bands ); + + v_mult( ratio, + &h_dirac_output_synthesis_state.direct_responses[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state.cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); + v_mult( &ratio[num_freq_bands], + &h_dirac_output_synthesis_state.direct_responses[ch_idx * num_freq_bands + num_freq_bands * num_channels_dir], + &h_dirac_output_synthesis_state.cy_cross_dir_smooth[ch_idx * num_freq_bands + num_freq_bands * num_channels_dir], + num_freq_bands ); + } + + /*Diffuse gain*/ + for ( ch_idx = nchan_transport_foa; ch_idx < num_channels_diff; ch_idx++ ) + { + v_multc( h_dirac_output_synthesis_state.diffuse_power_factor, + hDirAC->diffuse_response_function[ch_idx], + &h_dirac_output_synthesis_state.cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); + } + } + else +#endif + if ( hDirAC->hConfig->dec_param_estim == FALSE ) { /*Direct gain*/ for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) @@ -721,17 +1042,37 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( p_cy_cross_dir_smooth = h_dirac_output_synthesis_state.cy_cross_dir_smooth; p_gains_dir = h_dirac_output_synthesis_state.cy_cross_dir_smooth_prev; - /*Direct gains*/ - for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) +/*Direct gains*/ +#ifdef HODIRAC + if ( hodirac ) { - for ( l = 0; l < num_freq_bands; l++ ) + for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) { - g1 = 0.3679f + onset_filter[l] * ( 0.1175f - 0.3679f ); - g2 = ( 1.f - g1 ) * *( p_gains_dir ); - g2 += g1 * ( *( p_cy_cross_dir_smooth++ ) ); - g2 = max( g2, 0.85f ); - g2 = min( g2, 1.15f ); - *( p_gains_dir++ ) = g2; + for ( l = 0; l < num_freq_bands; l++ ) + { + g1 = 0.3679f + onset_filter[l] * ( 0.1175f - 0.3679f ); + g2 = ( 1.f - g1 ) * *( p_gains_dir ); + g2 += g1 * ( *( p_cy_cross_dir_smooth++ ) ); + g2 = max( g2, 0.99f ); + g2 = min( g2, 2.0f ); + *( p_gains_dir++ ) = g2; + } + } + } + else +#endif + { + for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + g1 = 0.3679f + onset_filter[l] * ( 0.1175f - 0.3679f ); + g2 = ( 1.f - g1 ) * *( p_gains_dir ); + g2 += g1 * ( *( p_cy_cross_dir_smooth++ ) ); + g2 = max( g2, 0.85f ); + g2 = min( g2, 1.15f ); + *( p_gains_dir++ ) = g2; + } } } @@ -748,6 +1089,39 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( *( p_gains_dir++ ) = g2; } } +#ifdef HODIRAC + if ( hodirac ) + { + // wkr: additional gains for second sector, hard coded to two sectors + p_cy_cross_dir_smooth = h_dirac_output_synthesis_state.cy_cross_dir_smooth + num_freq_bands * num_channels_dir; + p_gains_dir = h_dirac_output_synthesis_state.cy_cross_dir_smooth_prev + num_freq_bands * num_channels_dir; + + /*Direct gains*/ + for ( ch_idx = 0; ch_idx < nchan_transport_foa; ch_idx++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + p_cy_cross_dir_smooth++; + p_gains_dir++; + } + } + + /*Directional gains*/ + for ( ch_idx = nchan_transport_foa; ch_idx < num_channels_dir; ch_idx++ ) + { + for ( l = 0; l < num_freq_bands; l++ ) + { + g1 = 0.3679f + onset_filter[l] * ( 0.1175f - 0.3679f ); + g2 = ( 1.f - g1 ) * *( p_gains_dir ); + g2 += g1 * ( *( p_cy_cross_dir_smooth++ ) ); + g2 = max( g2, -DIRAC_GAIN_LIMIT ); + g2 = min( g2, DIRAC_GAIN_LIMIT ); + *( p_gains_dir++ ) = g2; + } + } + } +#endif + /*Diffuse gains*/ p_cy_auto_diff_smooth = h_dirac_output_synthesis_state.cy_auto_diff_smooth + nchan_transport_foa * num_freq_bands_diff; @@ -769,7 +1143,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( * gain interpolation and output streams *-----------------------------------------------------------------*/ +#ifdef JBM_TSM_ON_TCS + for ( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) +#else for ( buf_idx = 0; buf_idx < hDirAC->subframe_nbslots; ++buf_idx ) +#endif { g1 = h_dirac_output_synthesis_params.interpolator[buf_idx]; g2 = 1.f - g1; @@ -791,26 +1169,76 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( /*Directional stream*/ for ( ch_idx = nchan_transport_foa; ch_idx < num_channels_dir; ch_idx++ ) { - p_proto = h_dirac_output_synthesis_state.proto_direct_buffer_f + - buf_idx * 2 * num_freq_bands * num_protos_dir + - proto_direct_index[ch_idx] * 2 * num_freq_bands; - if ( proto_direct_index[ch_idx] == 0 ) +#ifdef HODIRAC + if ( hodirac ) { - for ( l = 0; l < num_freq_bands; l++ ) + if ( proto_direct_index[ch_idx] == 0 ) + { + float *p_proto2; + float gs1, gs2; + p_proto = h_dirac_output_synthesis_state.proto_direct_buffer_f + + buf_idx * 2 * num_freq_bands * num_protos_dir + + proto_direct_index[0] * 2 * num_freq_bands; + p_proto2 = h_dirac_output_synthesis_state.proto_direct_buffer_f + + buf_idx * 2 * num_freq_bands * num_protos_dir + + proto_direct_index[1] * 2 * num_freq_bands; + for ( l = 0; l < num_freq_bands; l++ ) + { + gs1 = g1 * ( *( p_gains_dir ) ) + g2 * ( *( p_gains_dir_prev ) ); + gs2 = g1 * ( *( p_gains_dir + num_freq_bands * num_channels_dir ) ) + g2 * ( *( p_gains_dir_prev + num_freq_bands * num_channels_dir ) ); + p_gains_dir++; + p_gains_dir_prev++; + + output_real[l * num_channels_dir + ch_idx] = 0.5f * gs1 * ( 1.772454e+00f * ( *p_proto ) + 1.023327e+00f * ( *p_proto2 ) ) + // s1 + 0.5f * gs2 * ( 1.772454e+00f * ( *p_proto ) - 1.023327e+00f * ( *p_proto2 ) ); // s2 + p_proto++; + p_proto2++; + output_imag[l * num_channels_dir + ch_idx] = 0.5f * gs1 * ( 1.772454e+00f * ( *p_proto ) + 1.023327e+00f * ( *p_proto2 ) ) + + 0.5f * gs2 * ( 1.772454e+00f * ( *p_proto ) - 1.023327e+00f * ( *p_proto2 ) ); + p_proto++; + p_proto2++; + } + } + else { - g = g1 * ( *( p_gains_dir++ ) ) + g2 * ( *( p_gains_dir_prev++ ) ); - output_real[l * num_channels_dir + ch_idx] = g * ( *( p_proto++ ) ); - output_imag[l * num_channels_dir + ch_idx] = g * ( *( p_proto++ ) ); + p_proto = h_dirac_output_synthesis_state.proto_direct_buffer_f + + buf_idx * 2 * num_freq_bands * num_protos_dir + + proto_direct_index[ch_idx] * 2 * num_freq_bands; + for ( l = 0; l < num_freq_bands; l++ ) + { + p_gains_dir++; + p_gains_dir_prev++; + + + output_real[l * num_channels_dir + ch_idx] = *( p_proto++ ); + output_imag[l * num_channels_dir + ch_idx] = *( p_proto++ ); + } } } else +#endif { - for ( l = 0; l < num_freq_bands; l++ ) + p_proto = h_dirac_output_synthesis_state.proto_direct_buffer_f + + buf_idx * 2 * num_freq_bands * num_protos_dir + + proto_direct_index[ch_idx] * 2 * num_freq_bands; + if ( proto_direct_index[ch_idx] == 0 ) { - p_gains_dir++; - p_gains_dir_prev++; - output_real[l * num_channels_dir + ch_idx] = *( p_proto++ ); - output_imag[l * num_channels_dir + ch_idx] = *( p_proto++ ); + for ( l = 0; l < num_freq_bands; l++ ) + { + g = g1 * ( *( p_gains_dir++ ) ) + g2 * ( *( p_gains_dir_prev++ ) ); + output_real[l * num_channels_dir + ch_idx] = g * ( *( p_proto++ ) ); + output_imag[l * num_channels_dir + ch_idx] = g * ( *( p_proto++ ) ); + } + } + else + { + for ( l = 0; l < num_freq_bands; l++ ) + { + p_gains_dir++; + p_gains_dir_prev++; + output_real[l * num_channels_dir + ch_idx] = *( p_proto++ ); + output_imag[l * num_channels_dir + ch_idx] = *( p_proto++ ); + } } } } @@ -828,8 +1256,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( for ( l = 0; l < num_freq_bands_diff; l++ ) { g = g1 * ( *( p_gains_diff++ ) ) + g2 * ( *( p_gains_diff_prev++ ) ); +#ifdef SPAR_TUNING + output_real[l * num_channels_dir + hDirAC->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); /* maps ch_idx 5 to 8 */ + output_imag[l * num_channels_dir + hDirAC->sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); +#else output_real[l * num_channels_dir + sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); /* maps ch_idx 5 to 8 */ output_imag[l * num_channels_dir + sba_map_tc[ch_idx]] += g * ( *( p_proto++ ) ); +#endif } } else @@ -888,16 +1321,37 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( } } - /*-----------------------------------------------------------------* - * update buffers - *-----------------------------------------------------------------*/ +/*-----------------------------------------------------------------* + * update buffers + *-----------------------------------------------------------------*/ + +/* store estimates for next synthesis block */ +#ifdef HODIRAC + if ( hodirac ) + { + mvr2r( h_dirac_output_synthesis_state.cy_cross_dir_smooth_prev, h_dirac_output_synthesis_state.gains_dir_prev, num_freq_bands * num_channels_dir * DIRAC_HO_NUMSECTORS ); + } + else +#endif + { + mvr2r( h_dirac_output_synthesis_state.cy_cross_dir_smooth_prev, h_dirac_output_synthesis_state.gains_dir_prev, num_freq_bands * num_channels_dir ); + } - /* store estimates for next synthesis block */ - mvr2r( h_dirac_output_synthesis_state.cy_cross_dir_smooth_prev, h_dirac_output_synthesis_state.gains_dir_prev, num_freq_bands * num_channels_dir ); mvr2r( h_dirac_output_synthesis_state.cy_auto_diff_smooth_prev, h_dirac_output_synthesis_state.gains_diff_prev, num_freq_bands_diff * num_channels_diff ); - /* reset values */ - set_zero( h_dirac_output_synthesis_state.cy_cross_dir_smooth, num_freq_bands * num_channels_dir ); +/* reset values */ +#ifdef HODIRAC + if ( hodirac ) + { + set_zero( h_dirac_output_synthesis_state.cy_cross_dir_smooth, num_freq_bands * num_channels_dir * DIRAC_HO_NUMSECTORS ); + } + else +#endif + { + set_zero( h_dirac_output_synthesis_state.cy_cross_dir_smooth, num_freq_bands * num_channels_dir ); + } + + set_zero( h_dirac_output_synthesis_state.cy_auto_diff_smooth, num_freq_bands_diff * num_channels_diff ); return; @@ -914,10 +1368,15 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( 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 */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ +#ifdef JBM_TSM_ON_TCS + const int16_t nbslots, /* i : number of slots to process */ + const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ +#endif float *reference_power_smooth, float qualityBasedSmFactor ) { - int16_t buf_idx, num_freq_bands, diff_start_band; + int16_t buf_idx, num_freq_bands; + int16_t diff_start_band; int16_t k, l; int16_t nchan_out_woLFE; float *p_power_smooth_prev, *p_power_diff_smooth_prev; @@ -959,7 +1418,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /*-----------------------------------------------------------------* * compute target PSDs *-----------------------------------------------------------------*/ - if ( hDirAC->hConfig->enc_param_start_band == 0 ) { diff_start_band = h_dirac_output_synthesis_params->use_onset_filters == 1 ? h_dirac_output_synthesis_params->max_band_decorr : 0; @@ -987,7 +1445,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->cy_auto_diff_smooth ); } - /*-----------------------------------------------------------------* * compute variables for stereo transport signal type detection *-----------------------------------------------------------------*/ @@ -1040,7 +1497,14 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( indexFast = min( l, alphaMaxBinFast ); /* Estimate the smoothness of the directions based on the diffuseness parameter */ + /* TODO: check this, seems buggy in the case of parame estim on the decoder side, + because the pointer here points already to the following subframe, ist this intended?*/ +#ifdef JBM_TSM_ON_TCS + /* Workaround for BE */ + instDirectionSmoothness = 1.0f - hDirAC->diffuseness_vector[diff_md_idx][l]; /* Currently, all subframes have same energy ratio value. */ +#else instDirectionSmoothness = 1.0f - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx][l]; /* Currently, all subframes have same energy ratio value. */ +#endif instDirectionSmoothness = min( max( instDirectionSmoothness, 0.0f ), 1.0f ); /* Average the direction smoothness parameter over time */ @@ -1184,8 +1648,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /*-----------------------------------------------------------------* * gain interpolation and output streams *-----------------------------------------------------------------*/ - +#ifdef JBM_TSM_ON_TCS + for ( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) +#else for ( buf_idx = 0; buf_idx < hDirAC->subframe_nbslots; ++buf_idx ) +#endif { g1 = h_dirac_output_synthesis_params->interpolator[buf_idx]; g2 = 1.f - g1; @@ -1427,11 +1894,18 @@ void ivas_dirac_dec_compute_directional_responses( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - const int16_t direction_idx, /* i : index for direction (azi and ele), can slot index (>2TCs) or subrame index (<=2TCs) */ - const int16_t subframe_idx, /* i : subframe index */ +#ifdef JBM_TSM_ON_TCS + const int16_t *azimuth, + const int16_t *elevation, + const int16_t md_idx, +#endif const float *surCohRatio, const int16_t shd_rot_max_order, /* i : split-order rotation method */ const float *p_Rmat /* i : rotation matrix */ +#ifdef HODIRAC + , + const int16_t hodirac /* i : flag for sector based dirac processing */ +#endif ) { int16_t k, l; @@ -1440,7 +1914,9 @@ void ivas_dirac_dec_compute_directional_responses( float direct_response_ls[MAX_OUTPUT_CHANNELS]; float direct_response_square[MAX_OUTPUT_CHANNELS]; float *direct_response; +#ifndef JBM_TSM_ON_TCS const int16_t *azimuth, *elevation; +#endif const int16_t *azimuth2, *elevation2; float direct_response_dir2[MAX_OUTPUT_CHANNELS]; float directRatio[MASA_MAXIMUM_DIRECTIONS]; @@ -1461,13 +1937,21 @@ void ivas_dirac_dec_compute_directional_responses( } num_channels_dir = hDirAC->num_outputs_dir; +#ifdef JBM_TSM_ON_TCS + if ( hDirAC->numSimultaneousDirections == 2 ) + { + azimuth2 = hDirAC->azimuth2[md_idx]; + elevation2 = hDirAC->elevation2[md_idx]; + } +#else azimuth = hDirAC->azimuth[hDirAC->dirac_read_idx]; elevation = hDirAC->elevation[hDirAC->dirac_read_idx]; if ( hDirAC->numSimultaneousDirections == 2 ) { - azimuth2 = hDirAC->azimuth2[direction_idx]; - elevation2 = hDirAC->elevation2[direction_idx]; + azimuth2 = hDirAC->azimuth2[hDirAC->dirac_read_idx]; + elevation2 = hDirAC->elevation2[hDirAC->dirac_read_idx]; } +#endif codingBand = -1; assert( num_channels_dir <= MAX_OUTPUT_CHANNELS && "Number of channels is too high" ); @@ -1500,6 +1984,35 @@ void ivas_dirac_dec_compute_directional_responses( /* HOA3 PANNING */ if ( hDirAC->panningConf == DIRAC_PANNING_HOA3 ) { +#ifdef HODIRAC + set_f( direct_response_hoa, 1.0f, MAX_OUTPUT_CHANNELS ); + set_f( direct_response_dir2, 1.0f, MAX_OUTPUT_CHANNELS ); + if ( p_Rmat != 0 ) + { + ivas_dirac_dec_get_response_split_order( azimuth[k], elevation[k], direct_response_hoa, shd_rot_max_order, p_Rmat ); + if ( hodirac ) + { + ivas_dirac_dec_get_response_split_order( azimuth2[k], elevation2[k], direct_response_dir2, shd_rot_max_order, p_Rmat ); + } + } + else + { + ivas_dirac_dec_get_response( azimuth[k], elevation[k], direct_response_hoa, hDirAC->hOutSetup.ambisonics_order ); + if ( hodirac ) + { + ivas_dirac_dec_get_response( azimuth2[k], elevation2[k], direct_response_dir2, hDirAC->hOutSetup.ambisonics_order ); + } + } + + if ( hMasa == NULL && hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + { + mvr2r_inc( direct_response_hoa, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k], hDirAC->num_freq_bands, num_channels_dir ); + if ( hodirac ) + { + mvr2r_inc( direct_response_dir2, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k + hDirAC->num_freq_bands * num_channels_dir], hDirAC->num_freq_bands, num_channels_dir ); + } + } +#else set_f( direct_response_hoa, 1.0f, MAX_OUTPUT_CHANNELS ); if ( p_Rmat != 0 ) { @@ -1514,21 +2027,34 @@ void ivas_dirac_dec_compute_directional_responses( { mvr2r_inc( direct_response_hoa, 1, &hDirAC->h_output_synthesis_psd_state.direct_responses[k], hDirAC->num_freq_bands, num_channels_dir ); } +#endif else if ( ( ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) && ( hMasa != NULL ) ) || hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) { /* Synthesize the first direction */ - spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[subframe_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); - +#ifdef JBM_TSM_ON_TCS + spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); +#else + spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); +#endif /* Synthesize the second direction and combine the gains */ if ( hDirAC->numSimultaneousDirections == 2 ) { - spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[subframe_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); - +#ifdef JBM_TSM_ON_TCS + spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); +#else + spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); +#endif /* Combine gains from the two directions */ - totalDirect = hDirAC->energy_ratio1[subframe_idx][k] + hDirAC->energy_ratio2[subframe_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[subframe_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[subframe_idx][k] / totalDirect; +#ifdef JBM_TSM_ON_TCS + totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; + directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; + directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; +#else + totalDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] + EPSILON; + directRatio[0] = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] / totalDirect; + directRatio[1] = hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] / totalDirect; +#endif for ( l = 0; l < num_channels_dir; l++ ) { direct_response_hoa[l] *= directRatio[0]; @@ -1576,20 +2102,33 @@ void ivas_dirac_dec_compute_directional_responses( else if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/ { /* Synthesize the first direction */ - spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[subframe_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); +#ifdef JBM_TSM_ON_TCS + spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); +#else + spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); +#endif normalizePanningGains( direct_response_ls, num_channels_dir ); /* Synthesize the second direction and combine the gains */ if ( hDirAC->numSimultaneousDirections == 2 ) { - spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[subframe_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); - +#ifdef JBM_TSM_ON_TCS + spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); +#else + spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); +#endif normalizePanningGains( direct_response_dir2, num_channels_dir ); /* Combine gains from the two directions */ - totalDirect = hDirAC->energy_ratio1[subframe_idx][k] + hDirAC->energy_ratio2[subframe_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[subframe_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[subframe_idx][k] / totalDirect; +#ifdef JBM_TSM_ON_TCS + totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; + directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; + directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; +#else + totalDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] + EPSILON; + directRatio[0] = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] / totalDirect; + directRatio[1] = hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] / totalDirect; +#endif for ( l = 0; l < num_channels_dir; l++ ) { direct_response_ls[l] *= directRatio[0]; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2aa8db73c7845997af189923fe9c3a4b8b79553b..5f77e442b45e1195edd0c3e009365f4f959792ea 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -33,9 +33,9 @@ #include "options.h" #include "ivas_cnst.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_stat_enc.h" -#include "lib_dec.h" #include "prot.h" #include #include @@ -51,6 +51,7 @@ *-------------------------------------------------------------------*/ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_read ); + static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); @@ -62,10 +63,15 @@ static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +#ifdef JBM_TSM_ON_TCS + , + uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ + int16_t *data /* o : flushed PCM samples */ +#endif ) { int16_t k, idx, num_bits_read; - int16_t num_obj, element_mode_flag; + int16_t nchan_ism, element_mode_flag; Decoder_State *st; int32_t ivas_total_brate; ivas_error error; @@ -124,15 +130,27 @@ ivas_error ivas_dec_setup( { /* read the number of objects */ st_ivas->nchan_transport = 1; - num_obj = 1; + nchan_ism = 1; k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); - while ( st_ivas->bit_stream[k] && num_obj < MAX_NUM_OBJECTS ) + while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) { - num_obj++; + nchan_ism++; k--; } - ivas_ism_dec_config( st_ivas, num_obj ); + st_ivas->nchan_ism = nchan_ism; + +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + return error; + } +#else + if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { @@ -148,40 +166,17 @@ ivas_error ivas_dec_setup( st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); num_bits_read += SBA_ORDER_BITS; -#ifdef SBA_BR_SWITCHING if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 ) -#endif { -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING - int16_t sba_reinit_flag = get_sba_reinit_flag( ivas_total_brate, st_ivas->last_active_ivas_total_brate, st_ivas->sba_order ); - if ( sba_reinit_flag ) - { - if ( ( error = ivas_sba_dec_reinit( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else + if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { -#endif -#endif - if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING + return error; } -#endif -#endif } else { #ifdef SWITCHING_FORMAT_DEC - st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); + st_ivas->sba_mode = ivas_sba_mode_select(); #endif ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init ); @@ -233,7 +228,11 @@ ivas_error ivas_dec_setup( num_bits_read += MC_LS_SETUP_BITS; /* select MC format mode; reconfigure the MC format decoder */ +#ifdef JBM_TSM_ON_TCS + ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, data ); +#else ivas_mc_dec_config( st_ivas, idx ); +#endif } /*-------------------------------------------------------------------* @@ -272,6 +271,9 @@ ivas_error ivas_dec_setup( case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; break; + case SID_ISM: + st_ivas->element_mode_init = IVAS_SCE; + break; case SID_MASA_1TC: st_ivas->element_mode_init = IVAS_SCE; st_ivas->nchan_transport = 1; @@ -294,6 +296,35 @@ ivas_error ivas_dec_setup( st_ivas->element_mode_init = IVAS_CPE_MDCT; break; } + + if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == SBA_FORMAT ) + { + int16_t nchan_transport_old, nchan_transport; + SBA_MODE sba_mode_old; + sba_mode_old = ivas_sba_mode_select(); + nchan_transport_old = st_ivas->nchan_transport; + nchan_transport = ( st_ivas->sid_format == SID_SBA_2TC ) ? 2 : 1; + + if ( ( nchan_transport_old != nchan_transport ) || ( sba_mode_old != st_ivas->sba_mode ) ) + { + /*Setting the default bitrate for the reconfig function*/ + if ( st_ivas->sid_format == SID_SBA_2TC ) + { + st_ivas->hDecoderConfig->ivas_total_brate = IVAS_48k; + } + else + { + st_ivas->hDecoderConfig->ivas_total_brate = ( st_ivas->sba_mode == SBA_MODE_SPAR ) ? IVAS_24k4 : IVAS_13k2; + } + + if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + st_ivas->last_active_ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate; + } + } } /*-------------------------------------------------------------------* @@ -329,6 +360,7 @@ ivas_error ivas_dec_setup( st->next_bit_pos = num_bits_read; st->total_brate = ACELP_8k00; /* only temporary initialization - this is needed for get_next_indice() in the frame following NO_DATA frame */ } + return error; } @@ -380,8 +412,24 @@ static ivas_error ivas_read_format( st_ivas->ivas_format = MC_FORMAT; break; case 2: +#ifdef COMBINED_FORMAT_SIGNALING st_ivas->ivas_format = ISM_FORMAT; + if ( ivas_total_brate >= IVAS_24k4 ) + { + if ( st_ivas->bit_stream[*num_bits_read] ) + { + /* placeholder for combined format signaling */ + + ( *num_bits_read )++; + } + + ( *num_bits_read )++; + } +#else + st_ivas->ivas_format = ISM_FORMAT; +#endif + break; case 3: if ( st_ivas->bit_stream[*num_bits_read] ) @@ -392,7 +440,7 @@ static ivas_error ivas_read_format( { st_ivas->ivas_format = SBA_FORMAT; #ifndef SWITCHING_FORMAT_DEC - st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); + st_ivas->sba_mode = ivas_sba_mode_select(); #endif } ( *num_bits_read )++; @@ -419,7 +467,7 @@ static ivas_error ivas_read_format( break; case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; - ivas_ism_dec_config( st_ivas, 1 ); /* currently DTX supported for 1ISM only */ + break; case SID_MULTICHANNEL: st_ivas->ivas_format = MC_FORMAT; @@ -611,7 +659,6 @@ ivas_error ivas_init_decoder_front( { return error; } -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_HRTF_CRend_binary_open( &( st_ivas->hSetOfHRTF ) ) ) != IVAS_ERR_OK ) { return error; @@ -626,7 +673,6 @@ ivas_error ivas_init_decoder_front( { return error; } -#endif } /*-------------------------------------------------------------------* @@ -640,9 +686,9 @@ ivas_error ivas_init_decoder_front( return error; } - if ( ivas_render_config_init_from_rom( &st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) != IVAS_ERR_OK ) + if ( ( error = ivas_render_config_init_from_rom( &st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) != IVAS_ERR_OK ) { - return IVAS_ERR_INTERNAL_FATAL; + return error; } } @@ -677,9 +723,7 @@ ivas_error ivas_init_decoder( ivas_total_brate = hDecoderConfig->ivas_total_brate; hDecoderConfig->last_ivas_total_brate = ivas_total_brate; -#ifdef SBA_BR_SWITCHING st_ivas->last_active_ivas_total_brate = ivas_total_brate; -#endif if ( output_config == AUDIO_CONFIG_EXTERNAL ) { @@ -707,6 +751,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) { ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); + ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hOutSetup.separateChannelEnabled ), &( st_ivas->hOutSetup.separateChannelIndex ), ivas_total_brate ); } @@ -714,7 +759,10 @@ ivas_error ivas_init_decoder( if ( output_config == AUDIO_CONFIG_LS_CUSTOM ) { - ivas_ls_custom_output_init( st_ivas ); + if ( ( error = ivas_ls_custom_output_init( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); @@ -722,6 +770,7 @@ ivas_error ivas_init_decoder( if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) { ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hIntSetup.separateChannelEnabled ), &( st_ivas->hIntSetup.separateChannelIndex ), ivas_total_brate ); + if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.separateChannelEnabled ) { st_ivas->hLsSetupCustom->separate_ch_found = 0; @@ -741,6 +790,53 @@ ivas_error ivas_init_decoder( } } + /*-----------------------------------------------------------------* + * Set head/orientation tracking + *-----------------------------------------------------------------*/ + + if ( st_ivas->hDecoderConfig->Opt_Headrotation ) + { + if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_NONE ) + { + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_NONE ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) + { + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_AVG_ORIENT ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF ) + { + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_ORIENT ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC ) + { + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC_LEV ) + { + if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC_LEV ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + return IVAS_ERR_WRONG_MODE; + } + } + /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles *-----------------------------------------------------------------*/ @@ -795,11 +891,13 @@ ivas_error ivas_init_decoder( st_ivas->nSCE = st_ivas->nchan_transport; /* "st_ivas->nchan_transport" is known from ivas_dec_setup */ st_ivas->nCPE = 0; + st_ivas->ism_extmeta_active = -1; + st_ivas->ism_extmeta_cnt = 0; if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->nchan_transport = 2; - st_ivas->nSCE = 2; + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; + st_ivas->nSCE = MAX_PARAM_ISM_WAVE; if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -807,7 +905,7 @@ ivas_error ivas_init_decoder( } } - if ( ( error = create_ism_metadata_dec( st_ivas, st_ivas->nSCE, element_brate_tmp ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nSCE, element_brate_tmp ) ) != IVAS_ERR_OK ) { return error; } @@ -820,6 +918,17 @@ ivas_error ivas_init_decoder( } reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + + st_ivas->hSCE[sce_id]->hCoreCoder[0]->is_ism_format = 1; + } + +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + st_ivas->hISMDTX.sce_id_dtx = 0; +#endif + + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed3 = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2; } } else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) @@ -839,12 +948,12 @@ ivas_error ivas_init_decoder( else if ( st_ivas->ivas_format == SBA_FORMAT ) { #ifdef SWITCHING_FORMAT_DEC - st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); + st_ivas->sba_mode = ivas_sba_mode_select(); #endif if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { - if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -857,7 +966,21 @@ ivas_error ivas_init_decoder( } } - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_dirac_sba_config( + st_ivas->hQMetaData, + &st_ivas->nchan_transport, + &st_ivas->nSCE, + &st_ivas->nCPE, + &st_ivas->element_mode_init, + ivas_total_brate, + st_ivas->sba_analysis_order, + st_ivas->sba_mode, +#ifdef HODIRAC + st_ivas->sba_analysis_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) +#else + IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -880,10 +1003,20 @@ ivas_error ivas_init_decoder( int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); +#ifdef HODIRAC + if ( st_ivas->sba_analysis_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ) + { + st_ivas->hSpar->enc_param_start_band = 0; + + set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); + st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; + } +#endif ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); } else /* SBA_MODE_DIRAC */ { @@ -892,7 +1025,7 @@ ivas_error ivas_init_decoder( return error; } - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ); + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); } } @@ -929,7 +1062,7 @@ ivas_error ivas_init_decoder( } /* create CPE element for DFT Stereo like upmix */ - if ( st_ivas->sba_dirac_stereo_flag ) + if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nCPE == 0 ) { if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) { @@ -949,24 +1082,7 @@ ivas_error ivas_init_decoder( } /* set CNA/CNG flags */ - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; - } - else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; - } - else if ( st_ivas->nchan_transport == 2 ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[0]->hCoreCoder[n]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ - st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; - } - } + ivas_sba_set_cna_cng_flag( st_ivas ); } else if ( st_ivas->ivas_format == MC_FORMAT ) { @@ -980,6 +1096,7 @@ ivas_error ivas_init_decoder( return error; } } + st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); st_ivas->nSCE = 0; st_ivas->nCPE = st_ivas->nchan_transport / 2; @@ -1004,6 +1121,48 @@ ivas_error ivas_init_decoder( return error; } } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + /* init EFAP for custom LS setup */ + if ( output_config == AUDIO_CONFIG_LS_CUSTOM ) + { + if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + st_ivas->nSCE = 0; + st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / 2; + st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; + + if ( ( error = ivas_mc_paramupmix_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->element_mode_init = IVAS_CPE_MDCT; + + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + if ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) * CPE_CHANNELS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + if ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { /* init EFAP for custom LS setup */ @@ -1057,7 +1216,7 @@ ivas_error ivas_init_decoder( return error; } - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ); + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) { @@ -1096,6 +1255,7 @@ ivas_error ivas_init_decoder( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { st_ivas->element_mode_init = IVAS_CPE_MDCT; /* element_mode_init was IVAS_SCE for SCE initialization */ + if ( ( error = create_cpe_dec( st_ivas, cpe_id, brate_cpe ) ) != IVAS_ERR_OK ) { return error; @@ -1178,7 +1338,6 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { -#ifdef HRTF_BINARY_FILE if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -1191,15 +1350,10 @@ ivas_error ivas_init_decoder( { return error; } -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -1207,19 +1361,24 @@ ivas_error ivas_init_decoder( if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { -#ifdef FIX_197_CREND_INTERFACE - if ( ( st_ivas->hCrendWrapper = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); + return error; } - if ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) -#else - if ( ( st_ivas->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) -#endif + } +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active ) + { + int16_t granularity; + int16_t n_channels_transport_jbm; + 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 IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); + return error; } } +#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -1237,36 +1396,32 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef FIX_197_CREND_INTERFACE if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && st_ivas->hDecoderConfig->Opt_Headrotation ) { - if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), - st_ivas->hIntSetup.ls_azimuth, - st_ivas->hIntSetup.ls_elevation, - st_ivas->hIntSetup.nchan_out_woLFE, - EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; } } - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), - getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), - getRendAudioConfigFromIvasAudioConfig( st_ivas->hDecoderConfig->output_config ), - st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, -#ifdef HRTF_BINARY_FILE - st_ivas->hSetOfHRTF, -#endif - st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, + st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#else - if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "ivas_crend_open failed" ); +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active ) + { + int16_t granularity; + int16_t n_channels_transport_jbm; + 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; + } } #endif } @@ -1274,6 +1429,9 @@ ivas_error ivas_init_decoder( if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC && ( st_ivas->renderer_type == RENDERER_TD_PANNING || +#if defined NON_DIEGETIC_PAN || defined ISM_NON_DIEGETIC_PAN + st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX || +#endif st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || @@ -1288,8 +1446,11 @@ ivas_error ivas_init_decoder( /*-----------------------------------------------------------------* * LFE handles for rendering after rendering to adjust LFE delay to binaural filter delay *-----------------------------------------------------------------*/ - +#ifdef MC_PARAMUPMIX_MODE + if ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) +#else if ( st_ivas->mc_mode == MC_MODE_MCT ) +#endif { binauralization_delay_ns = st_ivas->binaural_latency_ns; if ( st_ivas->hBinRenderer != NULL ) @@ -1310,13 +1471,6 @@ ivas_error ivas_init_decoder( return error; } - /* reuse core-coder buffers for LFE decoder */ - cpe_id = LFE_CHANNEL / CPE_CHANNELS; - n = LFE_CHANNEL % CPE_CHANNELS; - - st_ivas->hLFE->prevsynth_buf = &st_ivas->hCPE[cpe_id]->hCoreCoder[n]->old_synth_sw[0]; - st_ivas->hLFE->prior_out_buffer = &st_ivas->hCPE[cpe_id]->hCoreCoder[n]->previoussynth[0]; - set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); } @@ -1352,7 +1506,7 @@ ivas_error ivas_init_decoder( } /* CLDFB Interpolation weights */ - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !st_ivas->sba_dirac_stereo_flag && st_ivas->hDecoderConfig->nchan_out != 1 ) { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } @@ -1361,12 +1515,37 @@ ivas_error ivas_init_decoder( * Allocate and initialize limiter struct *-----------------------------------------------------------------*/ - st_ivas->hLimiter = ivas_limiter_open( hDecoderConfig->nchan_out, output_Fs ); + if ( ( st_ivas->hLimiter = ivas_limiter_open( hDecoderConfig->nchan_out, output_Fs ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); + } +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active && st_ivas->hTcBuffer == NULL ) + { + /* no module has yet open the TC buffer, open a default one */ + int16_t n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + if ( st_ivas->hTcBuffer == NULL ) + { + /* we need the handle anyway, but without the buffer*/ + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif return error; } +#ifdef JBM_TSM_ON_TCS + +#endif /*------------------------------------------------------------------------- * destroy_core_dec() @@ -1378,7 +1557,7 @@ void destroy_core_dec( DEC_CORE_HANDLE hCoreCoder /* i/o: core decoder structure */ ) { - destroy_decoder( hCoreCoder ); + destroy_cldfb_decoder( hCoreCoder ); if ( hCoreCoder->hGSCDec != NULL ) { @@ -1470,7 +1649,7 @@ void destroy_core_dec( hCoreCoder->hTcxDec = NULL; } - if ( hCoreCoder->hTcxCfg != NULL && hCoreCoder->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( hCoreCoder->hTcxCfg != NULL ) { free( hCoreCoder->hTcxCfg ); hCoreCoder->hTcxCfg = NULL; @@ -1560,6 +1739,9 @@ void ivas_initialize_handles_dec( st_ivas->hMasa = NULL; st_ivas->hQMetaData = NULL; st_ivas->hMCT = NULL; +#ifdef MC_PARAMUPMIX_MODE + st_ivas->hMCParamUpmix = NULL; +#endif st_ivas->hParamMC = NULL; st_ivas->hLFE = NULL; @@ -1572,17 +1754,11 @@ void ivas_initialize_handles_dec( st_ivas->hIsmRendererData = NULL; st_ivas->hBinRendererTd = NULL; st_ivas->hMonoDmxRenderer = NULL; -#ifdef FIX_197_CREND_INTERFACE st_ivas->hCrendWrapper = NULL; -#else - st_ivas->hCrend = NULL; - st_ivas->hHrtf = NULL; -#endif -#ifdef HRTF_BINARY_FILE + st_ivas->hReverb = NULL; st_ivas->hSetOfHRTF = NULL; st_ivas->hHrtfFastConv = NULL; st_ivas->hHrtfParambin = NULL; -#endif st_ivas->hoa_dec_mtx = NULL; st_ivas->hHeadTrackData = NULL; @@ -1590,15 +1766,19 @@ void ivas_initialize_handles_dec( st_ivas->hLsSetupCustom = NULL; st_ivas->hRenderConfig = NULL; +#ifdef JBM_TSM_ON_TCS + st_ivas->hTcBuffer = NULL; +#endif + return; } #ifdef SWITCHING_FORMAT_DEC /*----------------------------------------------------------------- - * ivas_initialize_handles_dec() + * ivas_decoder_init_highlevel_params() * - * initialize high-level parameters + * Initialize high-level parameters *-----------------------------------------------------------------*/ void ivas_decoder_init_highlevel_params( @@ -1655,7 +1835,7 @@ void ivas_destroy_dec( #endif ) { - int16_t i, n; + int16_t i; /* CLDFB handles */ for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) @@ -1663,7 +1843,6 @@ void ivas_destroy_dec( if ( st_ivas->cldfbAnaDec[i] != NULL ) { deleteCldfb( &( st_ivas->cldfbAnaDec[i] ) ); - st_ivas->cldfbAnaDec[i] = NULL; } } @@ -1672,7 +1851,6 @@ void ivas_destroy_dec( if ( st_ivas->cldfbSynDec[i] != NULL ) { deleteCldfb( &( st_ivas->cldfbSynDec[i] ) ); - st_ivas->cldfbSynDec[i] = NULL; } } @@ -1692,7 +1870,7 @@ void ivas_destroy_dec( if ( st_ivas->hCPE[i] != NULL ) { /* set pointer to NULL as core coder already deallocated in destroy_sce_dec() */ - if ( st_ivas->sba_dirac_stereo_flag ) + if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 ) { st_ivas->hCPE[i]->hCoreCoder[0] = NULL; st_ivas->hCPE[i]->hCoreCoder[1] = NULL; @@ -1702,13 +1880,6 @@ void ivas_destroy_dec( } } - /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_dec_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } - /* HP20 filter handles */ if ( st_ivas->mem_hp20_out != NULL ) { @@ -1722,43 +1893,31 @@ void ivas_destroy_dec( } /* ISM metadata handles */ - for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) - { - if ( st_ivas->hIsmMetaData[n] != NULL ) - { - free( st_ivas->hIsmMetaData[n] ); - st_ivas->hIsmMetaData[n] = NULL; - } - } + ivas_ism_metadata_close( st_ivas->hIsmMetaData ); - /* ISm renderer handle */ + /* ISM renderer handle */ if ( st_ivas->hIsmRendererData != NULL ) { +#ifdef JBM_TSM_ON_TCS + free( st_ivas->hIsmRendererData->interpolator ); +#endif free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } /* DirAC handle */ - if ( st_ivas->hDirAC != NULL ) + if ( st_ivas->ivas_format == ISM_FORMAT ) { - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - ivas_param_ism_dec_close( st_ivas->hDirAC, st_ivas->hDecoderConfig->output_config ); - } - else - { - ivas_dirac_dec_close( st_ivas->hDirAC ); - } - st_ivas->hDirAC = NULL; + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), st_ivas->hDecoderConfig->output_config ); } - - /* Spar handle */ - if ( st_ivas->hSpar != NULL ) + else { - ivas_spar_dec_close( st_ivas->hSpar, st_ivas->hDecoderConfig->output_Fs ); - st_ivas->hSpar = NULL; + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); } + /* SPAR handle */ + ivas_spar_dec_close( &( st_ivas->hSpar ), st_ivas->hDecoderConfig->output_Fs, 0 ); + /* HOA decoder matrix */ if ( st_ivas->hoa_dec_mtx != NULL ) { @@ -1766,12 +1925,23 @@ void ivas_destroy_dec( st_ivas->hoa_dec_mtx = NULL; } + /* MASA decoder structure */ + ivas_masa_dec_close( &( st_ivas->hMasa ) ); + /* Qmetadata handle */ ivas_qmetadata_close( &st_ivas->hQMetaData ); /* MCT handle */ ivas_mct_dec_close( &st_ivas->hMCT ); + /* LFE handle */ + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); + +#ifdef MC_PARAMUPMIX_MODE + /* Param-Upmix MC handle */ + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); +#endif + /* Parametric MC handle */ ivas_param_mc_dec_close( &st_ivas->hParamMC ); @@ -1788,11 +1958,10 @@ void ivas_destroy_dec( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); /* Crend handle */ -#ifdef FIX_197_CREND_INTERFACE ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#else - ivas_crend_close( st_ivas ); -#endif + + /* Reverb handle */ + ivas_reverb_close( &st_ivas->hReverb ); /* LS config converter handle */ ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); @@ -1804,13 +1973,6 @@ void ivas_destroy_dec( st_ivas->hLsSetupCustom = NULL; } - /* MASA decoder structure */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_dec_close( st_ivas->hMasa ); - st_ivas->hMasa = NULL; - } - /* Downmix structure */ if ( st_ivas->hMonoDmxRenderer != NULL ) { @@ -1823,11 +1985,7 @@ void ivas_destroy_dec( { #endif /* Head track data handle */ - if ( st_ivas->hHeadTrackData != NULL ) - { - free( st_ivas->hHeadTrackData ); - st_ivas->hHeadTrackData = NULL; - } + ivas_headTrack_close( &st_ivas->hHeadTrackData ); /* Time Domain binaural renderer handle */ if ( st_ivas->hBinRendererTd != NULL ) @@ -1841,26 +1999,14 @@ void ivas_destroy_dec( ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); } -#ifdef HRTF_BINARY_FILE /* CRend binaural renderer handle */ - if ( st_ivas->hSetOfHRTF != NULL ) - { - destroy_SetOfHRTF( st_ivas->hSetOfHRTF ); - ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); - } + ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); /* Fastconv HRTF filters */ - if ( st_ivas->hHrtfFastConv != NULL ) - { - ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv ); - } + ivas_HRTF_fastconv_binary_close( &st_ivas->hHrtfFastConv ); /* Parametric binauralizer HRTF filters */ - if ( st_ivas->hHrtfParambin != NULL ) - { - ivas_HRTF_parambin_binary_close( &st_ivas->hHrtfParambin ); - } -#endif + ivas_HRTF_parambin_binary_close( &st_ivas->hHrtfParambin ); /* Config. Renderer */ ivas_render_config_close( &( st_ivas->hRenderConfig ) ); @@ -1879,6 +2025,10 @@ void ivas_destroy_dec( st_ivas->hDecoderConfig = NULL; } +#ifdef JBM_TSM_ON_TCS + ivas_jbm_dec_tc_buffer_close( &st_ivas->hTcBuffer ); +#endif + /* main IVAS handle */ free( st_ivas ); #endif @@ -1888,7 +2038,7 @@ void ivas_destroy_dec( /*-------------------------------------------------------------------* - * ivas_init_dec_get_num_cldfb_analyses() + * ivas_init_dec_get_num_cldfb_instances() * * Return number of CLDFB analysis & synthesis instances *-------------------------------------------------------------------*/ @@ -1923,6 +2073,9 @@ void ivas_init_dec_get_num_cldfb_instances( *numCldfbAnalyses += 2; } break; +#ifdef NON_DIEGETIC_PAN + case RENDERER_NON_DIEGETIC_DOWNMIX: +#endif case RENDERER_MONO_DOWNMIX: if ( st_ivas->ivas_format == ISM_FORMAT ) { @@ -1992,19 +2145,27 @@ void ivas_init_dec_get_num_cldfb_instances( case RENDERER_BINAURAL_FASTCONV_ROOM: if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { - *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; - - if ( st_ivas->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC ) + if ( st_ivas->sba_dirac_stereo_flag ) { - *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE; - } - else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) - { - *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans; + *numCldfbAnalyses = 0; + *numCldfbSyntheses = 0; } else { - *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; + *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; + + if ( st_ivas->hOutSetup.is_loudspeaker_setup && st_ivas->renderer_type == RENDERER_DIRAC ) + { + *numCldfbSyntheses = st_ivas->hOutSetup.nchan_out_woLFE; + } + else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) + { + *numCldfbSyntheses = st_ivas->hSpar->hFbMixer->fb_cfg->num_out_chans; + } + else + { + *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; + } } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -2042,6 +2203,13 @@ void ivas_init_dec_get_num_cldfb_instances( default: assert( 0 && "Renderer not handled for CLDFB reservation." ); } +#ifdef MC_PARAMUPMIX_MODE + if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) + { + *numCldfbAnalyses = max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbAnalyses ); + *numCldfbSyntheses = max( MC_PARAMUPMIX_MIN_CLDFB, *numCldfbSyntheses ); + } +#endif return; } @@ -2076,6 +2244,14 @@ static ivas_error doSanityChecks_IVAS( assert( st_ivas->ivas_format != UNDEFINED_FORMAT && "\n IVAS format undefined" ); assert( st_ivas->ivas_format != MONO_FORMAT && "\n Wrong IVAS format: MONO" ); + /* Verify output configuration compatible with non-diegetic panning */ +#ifdef NON_DIEGETIC_PAN + if ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan && ( st_ivas->ivas_format != MONO_FORMAT ) && ( st_ivas->transport_config != AUDIO_CONFIG_ISM1 ) ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Non-diegetic panning not supported in this IVAS format" ); + } +#endif + /* Verify stereo output configuration */ if ( st_ivas->ivas_format == STEREO_FORMAT ) { @@ -2089,7 +2265,7 @@ static ivas_error doSanityChecks_IVAS( /* Verify ISM output configuration */ if ( output_config == AUDIO_CONFIG_INVALID ) { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for ISm" ); + return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for ISM" ); } } else if ( st_ivas->ivas_format == SBA_FORMAT ) @@ -2118,50 +2294,22 @@ static ivas_error doSanityChecks_IVAS( if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { - if ( !( output_config == AUDIO_CONFIG_BINAURAL || - output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) + if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) { return IVAS_ERROR( IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED, "Wrong set-up: Head-rotation not supported in this configuration" ); } } #ifdef DEBUGGING - if ( st_ivas->hDecoderConfig->forceSubframeBinauralization ) - { - /* Note about resolution of Binaural Renderers: * - * - Parametric Binaural Renderer: 20 ms by default, can be forced to subframe (5 ms) resolution * - * - FastConv Binaural Renderer: 5 ms by default * - * - TD objects Binaural Renderer: 20 ms by default */ - - if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) || !( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MC_FORMAT || st_ivas->ivas_format == ISM_FORMAT ) ) - { - return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Wrong set-up: Forced subframe resolution parametric binauralization activated for non-binaural output." ); - } - } -#endif - -#ifdef HRTF_BINARY_FILE -#ifdef DEBUGGING - if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || output_config != AUDIO_CONFIG_BINAURAL || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration: Time Domain object renderer not supported in this configuration" ); - } -#endif - -#else - -#ifdef DEBUGGING - if ( ( st_ivas->hDecoderConfig->Opt_HRTF_binary || st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || output_config != AUDIO_CONFIG_BINAURAL || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) +#ifdef MC_PARAMUPMIX_MODE + if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || output_config != AUDIO_CONFIG_BINAURAL || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && ( st_ivas->mc_mode != MC_MODE_MCT && st_ivas->mc_mode != MC_MODE_PARAMUPMIX ) ) ) ) #else - if ( st_ivas->hDecoderConfig->Opt_HRTF_binary && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || output_config != AUDIO_CONFIG_BINAURAL || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) ) ) + if ( ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) && ( ( st_ivas->ivas_format != MC_FORMAT && st_ivas->ivas_format != ISM_FORMAT ) || output_config != AUDIO_CONFIG_BINAURAL || ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCT ) ) ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration: Time Domain object renderer not supported in this configuration" ); } -#endif - -#ifdef DEBUGGING if ( ( st_ivas->hHrtfTD != NULL && st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_FORCE_MODE, "Incorrect debug configuration: Cannot force CLDFB renderer in combination with TD renderer HRTF file" ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c new file mode 100644 index 0000000000000000000000000000000000000000..5706261093a102b3ffe66ee887b8fc8fd0bea19f --- /dev/null +++ b/lib_dec/ivas_ism_dec.c @@ -0,0 +1,477 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include "options.h" +#ifdef JBM_TSM_ON_TCS +#include "prot.h" +#endif +#include "ivas_prot.h" +#include "ivas_prot_rend.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" + + +/*-------------------------------------------------------------------------* + * ivas_ism_bitrate_switching() + * + * + *-------------------------------------------------------------------------*/ + +static ivas_error ivas_ism_bitrate_switching( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t nchan_transport_old, /* i : last number of transport channels */ + const ISM_MODE last_ism_mode /* i : last ISM mode */ +#ifdef JBM_TSM_ON_TCS + , + uint16_t *nSamplesRendered, + int16_t *data +#endif +) +{ + ivas_error error; + int32_t element_brate_tmp[MAX_NUM_OBJECTS]; + int16_t nSCE_old, nCPE_old; +#ifdef FIX_416_ISM_BR_SWITCHING + int16_t numCldfbAnalyses_old, numCldfbSyntheses_old, ism_mode; +#endif + +#ifdef JBM_TSM_ON_TCS + TC_BUFFER_MODE tc_buffer_mode_new; + int16_t tc_nchan_tc_new; + int16_t tc_nchan_allocate_new; + int16_t tc_granularity_new; + AUDIO_CONFIG intern_config_old; + IVAS_OUTPUT_SETUP hIntSetupOld; + RENDERER_TYPE renderer_type_old; +#endif + + error = IVAS_ERR_OK; + + nCPE_old = st_ivas->nCPE; + nSCE_old = st_ivas->nSCE; + +#ifdef FIX_416_ISM_BR_SWITCHING + /* we have to temporarily set the ism mode back to the old one, otherwise this can give wrong results*/ + ism_mode = st_ivas->ism_mode; + st_ivas->ism_mode = last_ism_mode; + ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); + st_ivas->ism_mode = ism_mode; +#endif + +#ifdef ISM_NON_DIEGETIC_PAN + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + + st_ivas->nSCE = st_ivas->nchan_transport; + + /*-----------------------------------------------------------------* + * Allocate, initialize, and configure SCE/CPE/MCT handles + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*-----------------------------------------------------------------* + * HP20 memories + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) + { + return error; + } + +#ifdef JBM_TSM_ON_TCS + /* save old IntSetup, might be needed for JBM flushing...*/ + intern_config_old = st_ivas->intern_config; + hIntSetupOld = st_ivas->hIntSetup; + tc_granularity_new = 1; + renderer_type_old = st_ivas->renderer_type; +#endif + + /*-----------------------------------------------------------------* + * Initialize the needed renderer struct and destroy the unnecessary renderer struct + *-----------------------------------------------------------------*/ + + /* select the renderer */ + ivas_renderer_select( st_ivas ); + ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); + if ( ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->ism_mode == ISM_MODE_DISC ) ) + { + ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config ); + } + +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active ) + { + /* transfer subframe info from DirAC or ParamMC to central tc buffer */ + if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hDirAC != NULL && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) ) + { + st_ivas->hTcBuffer->nb_subframes = st_ivas->hDirAC->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hDirAC->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; + mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM 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->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, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + 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 ) + { + if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } +#endif + + if ( st_ivas->ism_mode != last_ism_mode ) + { + /* EFAP handle */ + efap_free_data( &st_ivas->hEFAPdata ); + } + + /*-----------------------------------------------------------------* + * Switching between ParamISM and DiscISM + *-----------------------------------------------------------------*/ + + /* switching from ParamISM to DiscISM */ + if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) + { + /* Deallocate the ParamISM struct */ + ivas_param_ism_dec_close( &( st_ivas->hDirAC ), st_ivas->hDecoderConfig->output_config ); + + if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL ) + { + /* close the parametric binaural renderer */ + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + + /* Open the TD Binaural renderer */ + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + /* close the ISM renderer and reinitialize */ + if ( st_ivas->hIsmRendererData != NULL ) + { +#ifdef JBM_TSM_ON_TCS + free( st_ivas->hIsmRendererData->interpolator ); +#endif + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } + + if ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) + { + /* close the parametric binaural renderer */ + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + + /* Open Crend Binaural renderer */ + if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), + st_ivas->intern_config, + st_ivas->hOutSetup.output_config, + st_ivas->hRenderConfig, + st_ivas->hSetOfHRTF, + st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; + } + } + + /* switching from Discrete ISM to ParamISM */ + if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC ) + { + /* Allocate and initialize the ParamISM struct */ + if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL ) + { + /* open the parametric binaural renderer */ + if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Close the TD Binaural renderer */ + if ( st_ivas->hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + } + + if ( st_ivas->hHrtfTD != NULL ) + { + st_ivas->hHrtfTD = NULL; + } + } + else + { + /* Close the ISM renderer */ + if ( st_ivas->hIsmRendererData != NULL ) + { +#ifdef JBM_TSM_ON_TCS + free( st_ivas->hIsmRendererData->interpolator ); +#endif + free( st_ivas->hIsmRendererData ); + st_ivas->hIsmRendererData = NULL; + } + } + + if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) + { + /* open the parametric binaural renderer */ + if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* close the crend binaural renderer */ + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); + } + } + +#ifdef FIX_416_ISM_BR_SWITCHING + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + +#ifdef JBM_TSM_ON_TCS + /*-----------------------------------------------------------------* + * Reconfigure TC buffer + *-----------------------------------------------------------------*/ + if ( st_ivas->hDecoderConfig->voip_active == 1 ) + { + int16_t tc_nchan_full_new; + DECODER_TC_BUFFER_HANDLE hTcBuffer; + + hTcBuffer = st_ivas->hTcBuffer; + tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); + tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + tc_nchan_allocate_new = tc_nchan_tc_new; + tc_nchan_full_new = tc_nchan_tc_new; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; + tc_nchan_full_new = tc_nchan_allocate_new; + } + if ( st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + { + tc_nchan_full_new = 0; + } + /* reconfigure buffer */ + if ( hTcBuffer->tc_buffer_mode != tc_buffer_mode_new || hTcBuffer->nchan_transport_jbm != tc_nchan_tc_new || + hTcBuffer->nchan_buffer_full != tc_nchan_full_new || hTcBuffer->nchan_transport_internal != tc_nchan_allocate_new ) + { + if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ) != IVAS_ERR_OK ) + { + return error; + } + } + /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ + if ( st_ivas->hDirAC != NULL ) + { + st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + } +#endif + + return error; +} + + +/*------------------------------------------------------------------------- + * ivas_ism_dec_config() + * + * - select ISM format mode + * - reconfigure the ISM format decoder + *-------------------------------------------------------------------------*/ + +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 */ +#ifdef JBM_TSM_ON_TCS + , + uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ + int16_t *data +#endif +) +{ + int32_t ivas_total_brate; + ivas_error error; + int16_t nchan_transport_old; + + error = IVAS_ERR_OK; + + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + + + /* Assumes that num of input objects are constant */ + nchan_transport_old = st_ivas->nchan_ism; + + if ( last_ism_mode == ISM_MODE_PARAM ) + { + nchan_transport_old = MAX_PARAM_ISM_WAVE; + } + + if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA ) + { + /* select ISM format mode */ + st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->nchan_ism, ivas_total_brate ); + + st_ivas->nchan_transport = st_ivas->nchan_ism; + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism; + } + } + + if ( st_ivas->ini_active_frame != 0 ) + { + /* ISM bit-rate switching */ + { + if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) + { +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + } + } + } + } + else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) + { + st_ivas->nchan_transport = st_ivas->nchan_ism; + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism; + } + } + + /* ISM mode switching */ + if ( st_ivas->ism_mode != last_ism_mode ) + { +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + } + } + + switch ( st_ivas->nchan_ism ) + { + case 1: + st_ivas->transport_config = AUDIO_CONFIG_ISM1; + break; + case 2: + st_ivas->transport_config = AUDIO_CONFIG_ISM2; + break; + case 3: + st_ivas->transport_config = AUDIO_CONFIG_ISM3; + break; + case 4: + st_ivas->transport_config = AUDIO_CONFIG_ISM4; + break; + default: + st_ivas->transport_config = AUDIO_CONFIG_INVALID; + break; + } + + return error; +} diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c new file mode 100644 index 0000000000000000000000000000000000000000..b2bc737fa20367b0ce9f3271f4c82a7567d8c2d7 --- /dev/null +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -0,0 +1,204 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include "ivas_prot.h" +#include "prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" + +#ifndef FIX_ISM_DTX_CNG_BWIDTH_ALT +/*-------------------------------------------------------------------* + * ivas_ism_preprocessing() + * + * + *-------------------------------------------------------------------*/ + +static void ivas_ism_preprocessing( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t sce_id /* i : SCE # identifier */ +) +{ + Decoder_State *st; + + st = st_ivas->hSCE[sce_id]->hCoreCoder[0]; + + { + /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ + st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; + st->next_bit_pos = 0; /* note: needed in paramISM -> discISM switching */ + + if ( sce_id == st_ivas->hISMDTX.sce_id_dtx ) + { + st->read_sid_info = 1; /* read the sid info from bitstream */ + } + else + { + st->read_sid_info = 0; /* do not read the sid info from bitstream but use the estimated noise */ + } + + st->cng_ism_flag = 1; + } + + return; +} +#endif + +/*-------------------------------------------------------------------* + * ivas_ism_dtx_dec() + * + * ISM DTX Metadata decoding routine + *-------------------------------------------------------------------*/ + +ivas_error ivas_ism_dtx_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t *nb_bits_metadata /* o : number of metadata bits */ +) +{ + int16_t ch, pos, nchan_ism, nchan_ism_prev; + int32_t ivas_total_brate; + int16_t md_diff_flag[MAX_NUM_OBJECTS]; + int16_t idx, flag_noisy_speech, sce_id_dtx; + ISM_MODE last_ism_mode, ism_mode_bstr; + ivas_error error; +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + Decoder_State *st; +#endif + + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + + + nchan_ism_prev = st_ivas->nchan_ism; + + if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) + { + /* read number of objects */ + nchan_ism = 1; + pos = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); + + while ( get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ) == 1 && nchan_ism < MAX_NUM_OBJECTS ) + { + ( nchan_ism )++; + pos--; + } + st_ivas->nchan_ism = nchan_ism; + pos--; + + if ( nchan_ism != nchan_ism_prev ) + { + /* IVAS_fmToDo: more work needed when the number of transported objects is not constant */ + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); + } + + last_ism_mode = st_ivas->ism_mode; + + /* read ism_mode */ + if ( nchan_ism > 2 ) + { + pos -= nchan_ism; /* SID metadata flags */ + + idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ); + ism_mode_bstr = (ISM_MODE) ( idx + 1 ); + st_ivas->ism_mode = ism_mode_bstr; + } +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, NULL, NULL ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + } + else + { + nchan_ism = nchan_ism_prev; + } + + /* Metadata decoding and dequantization */ + ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, nchan_ism, st_ivas->nchan_transport, st_ivas->ism_mode, + &flag_noisy_speech, &sce_id_dtx, st_ivas->hIsmMetaData, nb_bits_metadata ); + + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + { + if ( st_ivas->hDirAC != NULL ) + { + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = flag_noisy_speech; + } + + st_ivas->hISMDTX.sce_id_dtx = sce_id_dtx; + } + + set_s( md_diff_flag, 1, nchan_ism ); + + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + for ( ch = 0; ch < nchan_ism; ch++ ) + { + st_ivas->hDirAC->azimuth_values[ch] = st_ivas->hIsmMetaData[ch]->azimuth; + st_ivas->hDirAC->elevation_values[ch] = st_ivas->hIsmMetaData[ch]->elevation; + } + } + + update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); + + st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; + + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + { + for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) + { + nb_bits_metadata[ch] = nb_bits_metadata[sce_id_dtx]; + } + } + + if ( !st_ivas->bfi ) + { + for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) + { +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + st = st_ivas->hSCE[ch]->hCoreCoder[0]; + st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; + st->next_bit_pos = 0; /* note: needed in paramISM -> discISM switching */ + st->cng_ism_flag = 1; + st->L_frame = min( st->L_frame, L_FRAME16k ); /* note: needed for switching from active frame with L_frame=640 to CNG in object with no SID */ +#else + ivas_ism_preprocessing( st_ivas, ch ); // VE: after the acceptance of switches, replace the function call by its content +#endif + } + } + + return IVAS_ERR_OK; +} diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 75c8e6c6b78c9e09c044f2d3567401b8765f62e8..b7bf89e026c874793b942f96e2e0b8f798cc0591 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -37,69 +37,151 @@ #include "ivas_rom_com.h" #include "prot.h" #include "ivas_stat_enc.h" +#include #ifdef DEBUGGING #include "debug.h" #endif #include "wmc_auto.h" +/*-----------------------------------------------------------------------* + * Local functions + *-----------------------------------------------------------------------*/ + +#ifdef ISM_NON_DIEGETIC_PAN +static void decode_angle_indices( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, const int16_t non_diegetic_flag, int16_t *flag_abs_azimuth ); +#else +static void decode_angle_indices( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, int16_t *flag_abs_azimuth ); +#endif + + +static int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *flag_abs_radius ); + +/*-------------------------------------------------------------------------* + * Local constants + *-------------------------------------------------------------------------*/ + +#define IVAS_ISM_DTX_HO_MAX 5 + +#define CNG_MD_MAX_DIFF_AZIMUTH 5 +#define CNG_MD_MAX_DIFF_ELEVATION 5 + + +/*-------------------------------------------------------------------* + * ism_metadata_smooth() + * + * Smooth the metadata evolution + *-------------------------------------------------------------------*/ + +static void ism_metadata_smooth( + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t nchan_ism /* i : number of objects */ +) +{ + ISM_METADATA_HANDLE hIsmMetaData; + int16_t ch; + float diff; + + for ( ch = 0; ch < nchan_ism; ch++ ) + { + hIsmMetaData = hIsmMeta[ch]; + + /* smooth azimuth */ + diff = hIsmMetaData->last_true_azimuth - hIsmMetaData->last_azimuth; + + if ( diff > ISM_AZIMUTH_MAX ) + { + diff -= ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + hIsmMetaData->last_azimuth += ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + } + else if ( diff < ISM_AZIMUTH_MIN ) + { + diff += ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + } + + if ( ism_total_brate > IVAS_SID_5k2 && fabsf( diff ) > IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_AZIMUTH ) + { + /* skip the smoothing */ + } + else if ( fabsf( diff ) > CNG_MD_MAX_DIFF_AZIMUTH ) + { + hIsmMetaData->azimuth = hIsmMetaData->last_azimuth + sign( diff ) * CNG_MD_MAX_DIFF_AZIMUTH; + } + else if ( diff != 0 ) + { + hIsmMetaData->azimuth = hIsmMetaData->last_true_azimuth; + } + + if ( hIsmMetaData->azimuth > ISM_AZIMUTH_MAX ) + { + hIsmMetaData->azimuth -= ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + } + + /* smooth elevation */ + diff = hIsmMetaData->last_true_elevation - hIsmMetaData->last_elevation; + + if ( ism_total_brate > IVAS_SID_5k2 && diff > IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_ELEVATION ) + { + /* skip the smoothing */ + } + else if ( fabsf( diff ) > CNG_MD_MAX_DIFF_ELEVATION ) + { + hIsmMetaData->elevation = hIsmMetaData->last_elevation + sign( diff ) * CNG_MD_MAX_DIFF_ELEVATION; + } + } + + return; +} + + /*-------------------------------------------------------------------------* * ivas_ism_metadata_dec() * - * decode and dequantize ISm metadata + * decode and dequantize ISM metadata *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISms total bitrate */ - int16_t *nchan_transport, /* o : number of transport channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ - const int16_t bfi, /* i : bfi flag */ - int16_t nb_bits_metadata[], /* o : number of metadata bits */ - ISM_MODE ism_mode, /* i : ISM mode */ - const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_ism, /* i : number of ISM channels */ + int16_t *nchan_transport, /* o : number of transport channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ + const int16_t bfi, /* i : bfi flag */ + int16_t nb_bits_metadata[], /* o : number of metadata bits */ + ISM_MODE ism_mode, /* i : ISM mode */ + ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ + const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ + int16_t *ism_extmeta_active, /* i/o: Extended metadata active in renderer*/ + int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed*/ ) { - int16_t ch, nb_bits_start = 0, last_bit_pos, sgn, diff; + int16_t ch, nb_bits_start = 0, last_bit_pos; + int16_t idx_radius; int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; DEC_CORE_HANDLE st0; - int16_t idx_azimuth, nbits_diff_azimuth, flag_abs_azimuth; - int16_t idx_elevation, nbits_diff_elevation; + int16_t ism_extmeta_bitstream; +#ifdef ISM_NON_DIEGETIC_PAN + int16_t non_diegetic_flag_global; +#endif + float yaw, pitch, radius; + int16_t flag_abs_radius; + int16_t flag_abs_orientation; + int16_t flag_abs_position; + int16_t idx_angle1; + int16_t idx_angle2; int16_t next_bit_pos_orig; uint16_t i, bstr_meta[MAX_BITS_METADATA], *bstr_orig; ISM_METADATA_HANDLE hIsmMetaData; int16_t nchan_transport_prev, ism_metadata_flag_global; int16_t localVAD[MAX_NUM_OBJECTS]; int16_t ism_imp[MAX_NUM_OBJECTS]; - int16_t num_obj = 0, nbands, nblocks; + int16_t nbands, nblocks; + int16_t md_diff_flag[MAX_NUM_OBJECTS]; ivas_error error; - error = IVAS_ERR_OK; - push_wmops( "ism_meta_dec" ); - if ( ism_total_brate == IVAS_SID_5k2 || ism_total_brate == FRAME_NO_DATA ) - { - /* no metadata decoding in CNG */ - for ( ch = 0; ch < *nchan_transport; ch++ ) - { - hIsmMeta[ch]->ism_metadata_flag = 0; - } - - /* set padding bits as metadata bits to keep later bitrate checks valid */ - nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; - -#ifdef DEBUGGING - /* sanity check */ - if ( *nchan_transport != 1 ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\n!!! Error: SID/CNG frame not expect for decoding more than 1 object. Exiting.\n\n" ); - } -#endif - - pop_wmops(); - return error; - } /* initialization */ st0 = hSCE[0]->hCoreCoder[0]; @@ -110,6 +192,10 @@ ivas_error ivas_ism_metadata_dec( bstr_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; st0->next_bit_pos = 0; + ism_extmeta_bitstream = 0; +#ifdef ISM_NON_DIEGETIC_PAN + non_diegetic_flag_global = 0; +#endif /* reverse the bitstream for easier reading of indices */ for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) @@ -122,25 +208,21 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { /*----------------------------------------------------------------* - * Read ISm common signaling + * Read ISM common signaling *----------------------------------------------------------------*/ - /* read number of objects */ - num_obj = 1; - while ( get_next_indice( st0, 1 ) == 1 && num_obj < MAX_NUM_OBJECTS ) - { - ( num_obj )++; - } + /* number of objects was read in ivas_dec_setup() */ + st0->next_bit_pos += nchan_ism; - ism_mode = ivas_ism_mode_select( num_obj, ism_total_brate ); + ism_mode = ivas_ism_mode_select( nchan_ism, ism_total_brate ); if ( ism_mode == ISM_MODE_PARAM ) { - hParamIsm->num_obj = num_obj; + *nchan_transport = MAX_PARAM_ISM_WAVE; } else if ( ism_mode == ISM_MODE_DISC ) { - *nchan_transport = num_obj; + *nchan_transport = nchan_ism; } if ( *nchan_transport != nchan_transport_prev ) @@ -149,7 +231,36 @@ ivas_error ivas_ism_metadata_dec( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); } - /* Read ISm present flags (one per object) */ + /* read extended metadata presence flag */ + if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) + { + ism_extmeta_bitstream = get_next_indice( st0, ISM_EXTENDED_METADATA_BITS ); + +#ifdef ISM_NON_DIEGETIC_PAN + /* read global non-diegetic object flag */ + if ( ism_extmeta_bitstream ) + { + non_diegetic_flag_global = get_next_indice( st0, ISM_METADATA_IS_NDP_BITS ); + } +#endif + } + /* Apply hysteresis in case rate switching causes fluctuation in presence of extended metadata */ + if ( *ism_extmeta_active == -1 || *ism_extmeta_active == ism_extmeta_bitstream ) /* If first frame or bitstream matches internal state */ + { + *ism_extmeta_active = ism_extmeta_bitstream; + *ism_extmeta_cnt = 0; + } + else + { + ( *ism_extmeta_cnt )++; + if ( *ism_extmeta_cnt == ISM_METADATA_RS_MAX_FRAMES ) /* ISM_METADATA_RS_MAX_FRAMES change frames observed - update state */ + { + *ism_extmeta_active = ism_extmeta_bitstream; + *ism_extmeta_cnt = 0; + } + } + + /* Read ISM present flags (one per object) */ for ( ch = 0; ch < *nchan_transport; ch++ ) { ism_imp[ch] = get_next_indice( st0, ISM_METADATA_FLAG_BITS ); @@ -166,7 +277,7 @@ ivas_error ivas_ism_metadata_dec( ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; } - for ( ; ch < num_obj; ch++ ) + for ( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->ism_metadata_flag = 1; ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; @@ -199,168 +310,104 @@ ivas_error ivas_ism_metadata_dec( nb_bits_start = st0->next_bit_pos; } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; if ( ism_mode == ISM_MODE_DISC ) { nb_bits_start = st0->next_bit_pos; } - - flag_abs_azimuth = 0; + flag_abs_position = 0; + flag_abs_orientation = 0; + flag_abs_radius = 0; if ( hIsmMeta[ch]->ism_metadata_flag ) { - /*----------------------------------------------------------------* - * Azimuth decoding and dequantization - *----------------------------------------------------------------*/ - - /* Decode azimuth index */ - if ( get_next_indice( st0, 1 ) == 1 ) /* azimuth_abs_flag */ +#ifdef ISM_NON_DIEGETIC_PAN + if ( non_diegetic_flag_global ) { - idx_azimuth = get_next_indice( st0, ISM_AZIMUTH_NBITS ); - flag_abs_azimuth = 1; + /* read non-diegetic flag for each object */ + hIsmMetaData->non_diegetic_flag = get_next_indice( st0, ISM_METADATA_IS_NDP_BITS ); } else { - diff = 0; - sgn = 1; - - if ( get_next_indice( st0, 1 ) == 0 ) - { - nbits_diff_azimuth = 1; - } - else - { - nbits_diff_azimuth = 1; - - if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ - { - sgn = -1; - } - - nbits_diff_azimuth++; - - /* read until the stop bit */ - while ( ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) && ( get_next_indice( st0, 1 ) == 1 ) ) - { - diff++; - nbits_diff_azimuth++; - } - - if ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) - { - /* count stop bit */ - nbits_diff_azimuth++; - } - } - - idx_azimuth = hIsmMetaData->last_azimuth_idx + sgn * diff; - } - - /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ - } - else if ( idx_azimuth < 0 ) - { - idx_azimuth += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ - } - - /* +180° == -180° */ - if ( idx_azimuth == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = 0; - } - - /* sanity check in case of FER or BER */ - if ( idx_azimuth < 0 || idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = hIsmMetaData->last_azimuth_idx; + hIsmMetaData->non_diegetic_flag = 0; } - /* Azimuth dequantization */ - if ( ism_mode == ISM_MODE_PARAM ) + if ( hIsmMetaData->non_diegetic_flag ) { - hParamIsm->azi_index[ch] = idx_azimuth; - } - else /* ISM_MODE_DISC */ - { - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); - } - - /*----------------------------------------------------------------* - * Elevation decoding and dequantization - *----------------------------------------------------------------*/ - - /* Decode elevation index */ - if ( flag_abs_azimuth == 0 && get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */ - { - idx_elevation = get_next_indice( st0, ISM_ELEVATION_NBITS ); + /* Panning gain decoding */ + decode_angle_indices( st0, &( hIsmMetaData->position_angle ), hIsmMetaData->non_diegetic_flag, &flag_abs_position ); + idx_angle1 = hIsmMetaData->position_angle.last_angle1_idx; + idx_angle2 = 1 << ( ISM_ELEVATION_NBITS - 1 ); + + /* Panning gain dequantization */ + hIsmMetaData->azimuth = ism_dequant_meta( idx_angle1, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + hIsmMetaData->elevation = 0.0f; + + /* save for smoothing metadata evolution */ + hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; + hIsmMetaData->last_true_elevation = hIsmMetaData->elevation; } else { - diff = 0; - sgn = 1; + decode_angle_indices( st0, &( hIsmMetaData->position_angle ), hIsmMeta[ch]->non_diegetic_flag, &flag_abs_position ); +#else + decode_angle_indices( st0, &( hIsmMetaData->position_angle ), &flag_abs_position ); +#endif + idx_angle1 = hIsmMetaData->position_angle.last_angle1_idx; + idx_angle2 = hIsmMetaData->position_angle.last_angle2_idx; - if ( get_next_indice( st0, 1 ) == 0 ) + /* Azimuth/Elevation dequantization */ + if ( ism_mode == ISM_MODE_PARAM ) { - nbits_diff_elevation = 1; + hParamIsm->azi_index[ch] = idx_angle1; + hParamIsm->ele_index[ch] = idx_angle2; } - else + else /* ISM_MODE_DISC */ { - nbits_diff_elevation = 1; + hIsmMetaData->azimuth = ism_dequant_meta( idx_angle1, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + hIsmMetaData->elevation = ism_dequant_meta( idx_angle2, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); - if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + /* radius/raw/pitch dequantization */ + if ( ism_extmeta_bitstream ) { - sgn = -1; +#ifdef ISM_NON_DIEGETIC_PAN + decode_angle_indices( st0, &( hIsmMetaData->orientation_angle ), hIsmMeta[ch]->non_diegetic_flag, &flag_abs_orientation ); +#else + decode_angle_indices( st0, &( hIsmMetaData->orientation_angle ), &flag_abs_orientation ); +#endif + idx_angle1 = hIsmMetaData->orientation_angle.last_angle1_idx; + idx_angle2 = hIsmMetaData->orientation_angle.last_angle2_idx; + yaw = ism_dequant_meta( idx_angle1, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + pitch = ism_dequant_meta( idx_angle2, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); + + idx_radius = decode_radius( st0, &hIsmMetaData->last_radius_idx, &flag_abs_radius ); + radius = usdequant( idx_radius, ISM_RADIUS_MIN, ISM_RADIUS_DELTA ); + if ( *ism_extmeta_active == 1 ) + { + hIsmMetaData->yaw = yaw; + hIsmMetaData->pitch = pitch; + hIsmMetaData->radius = radius; + } } - - nbits_diff_elevation++; - - /* read until the stop bit */ - while ( ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) + else { - diff++; - nbits_diff_elevation++; - } - - if ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) - { - /* count stop bit */ - nbits_diff_elevation++; + if ( *ism_extmeta_active == 0 ) + { + hIsmMetaData->yaw = 0.0f; + hIsmMetaData->pitch = 0.0f; + hIsmMetaData->radius = 1.0f; + } } } - - idx_elevation = hIsmMetaData->last_elevation_idx + sgn * diff; - } - - /* sanity check in case of FER or BER */ - if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) - { - idx_elevation = hIsmMetaData->last_elevation_idx; - } - - /* Elevation dequantization */ - if ( ism_mode == ISM_MODE_PARAM ) - { - hParamIsm->ele_index[ch] = idx_elevation; - } - else /* ISM_MODE_DISC */ - { - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + /* save for smoothing metadata evolution */ + hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; + hIsmMetaData->last_true_elevation = hIsmMetaData->elevation; } - - /*----------------------------------------------------------------* - * Final updates - *----------------------------------------------------------------*/ - - /* updates */ - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; +#ifdef ISM_NON_DIEGETIC_PAN } - +#endif /* save number of metadata bits read */ if ( ism_mode == ISM_MODE_DISC ) { @@ -421,12 +468,7 @@ ivas_error ivas_ism_metadata_dec( } else /* BFI */ { - /* "*nISms", "hIsmMeta->azimuth" and "hIsmMeta->elevation" are recycled from the last frame */ - for ( ch = 0; ch < *nchan_transport; ch++ ) - { - hIsmMeta[ch]->ism_metadata_flag = hIsmMeta[ch]->last_ism_metadata_flag; - } - for ( ; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -435,35 +477,49 @@ ivas_error ivas_ism_metadata_dec( if ( ism_mode == ISM_MODE_PARAM ) { - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; - /*hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] % hParamIsm->az_alpha[ch];*/ - hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch]; hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] + hParamIsm->last_el_sgn[ch] * hParamIsm->last_el_diff[ch]; - /*hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch] % hParamIsm->ele_alpha;*/ - hParamIsm->ele_index[ch] = hParamIsm->ele_index[ch]; - hIsmMeta[ch]->last_azimuth_idx = hParamIsm->azi_index[ch]; - hIsmMeta[ch]->last_elevation_idx = hParamIsm->ele_index[ch]; + hIsmMeta[ch]->position_angle.last_angle1_idx = hParamIsm->azi_index[ch]; + hIsmMeta[ch]->position_angle.last_angle2_idx = hParamIsm->ele_index[ch]; } } } + if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) + { + ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); + hISMDTX.ism_dtx_hangover_cnt += 1; + } + /*----------------------------------------------------------------* * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ if ( !bfi ) { - ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); +#ifdef ISM_NON_DIEGETIC_PAN + if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_extmeta_bitstream, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } for ( ch = 0; ch < *nchan_transport; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; +#ifdef FIX_419_ISM_BRATE_SW_DTX + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; +#endif if ( ism_mode == ISM_MODE_DISC ) { +#ifndef FIX_419_ISM_BRATE_SW_DTX hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; +#endif if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 && ism_metadata_flag_global ) { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; @@ -474,7 +530,7 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; } - for ( ; ch < num_obj; ch++ ) + for ( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -483,58 +539,500 @@ ivas_error ivas_ism_metadata_dec( { for ( ch = 0; ch < *nchan_transport; ch++ ) { - hSCE[ch]->element_brate = hSCE[ch]->last_element_brate; hSCE[ch]->hCoreCoder[0]->total_brate = hSCE[ch]->hCoreCoder[0]->last_total_brate; } } + /*----------------------------------------------------------------* + * Set bitsream pointers + *----------------------------------------------------------------*/ + /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; - /* set bitstream pointers for each ISm */ + /* set bitstream pointers for each ISM */ for ( ch = 1; ch < *nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->bit_stream = hSCE[ch - 1]->hCoreCoder[0]->bit_stream + ( hSCE[ch - 1]->hCoreCoder[0]->total_brate / FRAMES_PER_SEC ); } + /*----------------------------------------------------------------* + * Updates + *----------------------------------------------------------------*/ + + set_s( md_diff_flag, 1, nchan_ism ); + + update_last_metadata( nchan_ism, hIsmMeta, md_diff_flag ); + + for ( ch = 0; ch < *nchan_transport; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->cng_ism_flag = 0; + } + pop_wmops(); - return error; + return IVAS_ERR_OK; } /*------------------------------------------------------------------------- - * create_ism_metadata_dec() + * ivas_ism_metadata_dec_create() * - * Create, allocate, initialize and configure IVAS decoder ISM handles + * Create, allocate, initialize and configure IVAS decoder ISM metadata handles *-------------------------------------------------------------------------*/ -ivas_error create_ism_metadata_dec( +ivas_error ivas_ism_metadata_dec_create( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_ISms, /* i : number of objects */ int32_t element_brate_tmp[] /* o : element bitrate per object */ ) { int16_t ch; + ivas_error error; - /* allocate ISm metadata handles */ + /* allocate ISM metadata handles */ for ( ch = 0; ch < MAX_NUM_OBJECTS; ch++ ) { if ( ( st_ivas->hIsmMetaData[ch] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM MetaData\n" ) ); } st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; - st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; - st_ivas->hIsmMetaData[ch]->last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); + st_ivas->hIsmMetaData[ch]->position_angle.last_angle1_idx = 0; + st_ivas->hIsmMetaData[ch]->position_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); + st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle1_idx = 0; + st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); + st_ivas->hIsmMetaData[ch]->last_radius_idx = 8; /* Init to radius 1.0 */ + + st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0; + st_ivas->hIsmMetaData[ch]->last_true_elevation = 0; ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } - ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); +#ifdef ISM_NON_DIEGETIC_PAN + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + + st_ivas->hISMDTX.ism_dtx_hangover_cnt = IVAS_ISM_DTX_HO_MAX; return IVAS_ERR_OK; } + + +/*------------------------------------------------------------------------- + * decode_angle_indices() + * + * Decoding of an angle + *-------------------------------------------------------------------------*/ + +static void decode_angle_indices( + DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ + ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ +#ifdef ISM_NON_DIEGETIC_PAN + const int16_t non_diegetic_flag, /* i : Non diegetic flag */ +#endif + int16_t *flag_abs_angle1 /* o : Azimuth/yaw encoding mode */ +) +{ + int16_t idx_angle1, nbits_diff_angle1, diff, sgn; + int16_t idx_angle2, nbits_diff_angle2; + + /*----------------------------------------------------------------* + * Azimuth/yaw decoding and dequantization + *----------------------------------------------------------------*/ + + /* Decode azimuth/yaw index */ + if ( get_next_indice( st0, 1 ) == 1 ) /* azimuth_abs_flag */ + { + idx_angle1 = get_next_indice( st0, ISM_AZIMUTH_NBITS ); + *flag_abs_angle1 = 1; + } + else + { + diff = 0; + sgn = 1; + + if ( get_next_indice( st0, 1 ) == 0 ) + { + nbits_diff_angle1 = 1; + } + else + { + nbits_diff_angle1 = 1; + + if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + { + sgn = -1; + } + + nbits_diff_angle1++; + + /* read until the stop bit */ + while ( ( nbits_diff_angle1 < ISM_AZIMUTH_NBITS - 1 ) && ( get_next_indice( st0, 1 ) == 1 ) ) + { + diff++; + nbits_diff_angle1++; + } + + if ( nbits_diff_angle1 < ISM_AZIMUTH_NBITS - 1 ) + { + /* count stop bit */ + nbits_diff_angle1++; + } + } + idx_angle1 = angle->last_angle1_idx + sgn * diff; + } + + /* azimuth/yaw is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ + if ( idx_angle1 > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_angle1 -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ + } + else if ( idx_angle1 < 0 ) + { + idx_angle1 += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ + } + + /* +180° == -180° */ + if ( idx_angle1 == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_angle1 = 0; + } + + /* sanity check in case of FER or BER */ + if ( idx_angle1 < 0 || idx_angle1 > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_angle1 = angle->last_angle1_idx; + } + + /*----------------------------------------------------------------* + * Elevation/pitch decoding and dequantization + *----------------------------------------------------------------*/ + +#ifdef ISM_NON_DIEGETIC_PAN + if ( non_diegetic_flag == 0 ) + { +#endif + /* Decode elevation/pitch index */ + if ( *flag_abs_angle1 == 0 && get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */ + { + idx_angle2 = get_next_indice( st0, ISM_ELEVATION_NBITS ); + } + else + { + diff = 0; + sgn = 1; + + if ( get_next_indice( st0, 1 ) == 0 ) + { + nbits_diff_angle2 = 1; + } + else + { + nbits_diff_angle2 = 1; + + if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + { + sgn = -1; + } + + nbits_diff_angle2++; + + /* read until the stop bit */ + while ( ( nbits_diff_angle2 < ISM_ELEVATION_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) + { + diff++; + nbits_diff_angle2++; + } + + if ( nbits_diff_angle2 < ISM_ELEVATION_NBITS ) + { + /* count stop bit */ + nbits_diff_angle2++; + } + } + + idx_angle2 = angle->last_angle2_idx + sgn * diff; + } + + /* sanity check in case of FER or BER */ + if ( idx_angle2 < 0 || idx_angle2 > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) + { + idx_angle2 = angle->last_angle2_idx; + } + +#ifdef ISM_NON_DIEGETIC_PAN + } + else + { + idx_angle2 = angle->last_angle2_idx; /* second MD parameter is not transmitted for non-diegetic object */ + } +#endif + + /*----------------------------------------------------------------* + * Final updates + *----------------------------------------------------------------*/ + + angle->last_angle2_idx = idx_angle2; + angle->last_angle1_idx = idx_angle1; +#ifndef ISM_NON_DIEGETIC_PAN + angle->last_angle2_idx = idx_angle2; +#endif + + return; +} + + +/*------------------------------------------------------------------------- + * decode_radius() + * + * Radius decoding and dequantization + *-------------------------------------------------------------------------*/ + +static int16_t decode_radius( + DEC_CORE_HANDLE st0, /* i/o: bitstream handle */ + int16_t *last_radius_idx, /* i/o: last radius index */ + int16_t *flag_abs_radius /* o : Radius encoding mode */ +) +{ + int16_t idx_radius, nbits_diff_radius, diff, sgn; + + /* Decode radius index */ + if ( get_next_indice( st0, 1 ) == 1 ) /* elevation_abs_flag */ + { + *flag_abs_radius = 1; + idx_radius = get_next_indice( st0, ISM_RADIUS_NBITS ); + } + else + { + diff = 0; + sgn = 1; + + if ( get_next_indice( st0, 1 ) == 0 ) + { + nbits_diff_radius = 1; + } + else + { + nbits_diff_radius = 1; + + if ( get_next_indice( st0, 1 ) == 1 ) /* negative sign */ + { + sgn = -1; + } + + nbits_diff_radius++; + + /* read until the stop bit */ + while ( ( nbits_diff_radius < ISM_RADIUS_NBITS ) && ( get_next_indice( st0, 1 ) == 1 ) ) + { + diff++; + nbits_diff_radius++; + } + + if ( nbits_diff_radius < ISM_RADIUS_NBITS ) + { + /* count stop bit */ + nbits_diff_radius++; + } + } + idx_radius = *last_radius_idx + sgn * diff; + } + + /* sanity check in case of FER or BER */ + if ( idx_radius < 0 || idx_radius > ( 1 << ISM_RADIUS_NBITS ) - 1 ) + { + idx_radius = *last_radius_idx; + } + + /* Final updates */ + *last_radius_idx = idx_radius; + + return idx_radius; +} + + +/*-------------------------------------------------------------------* + * ivas_ism_metadata_sid_dec() + * + * Decode ISM metadata in SID frame + *-------------------------------------------------------------------*/ + +void ivas_ism_metadata_sid_dec( + SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t bfi, /* i : bfi flag */ + const int16_t nchan_ism, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels*/ + const ISM_MODE ism_mode, /* i : ISM mode */ + int16_t *flag_noisy_speech, /* o : noisy speech flag */ + int16_t *sce_id_dtx, /* o : SCE DTX ID */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +) +{ + int16_t i, ch, last_bit_pos; + float q_step, q_step_border; + int16_t idx, idx_azimuth, idx_elevation; + int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; + int16_t md_diff_flag[MAX_NUM_OBJECTS]; + ISM_MODE ism_mode_bstr; + DEC_CORE_HANDLE st0; + ISM_METADATA_HANDLE hIsmMetaData; + int16_t next_bit_pos_orig; + uint16_t bstr_meta[IVAS_SID_5k2 / FRAMES_PER_SEC], *bstr_orig; + + if ( ism_total_brate == FRAME_NO_DATA ) + { + ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); + + return; + } + + /* initialization */ + st0 = hSCE[0]->hCoreCoder[0]; + + last_bit_pos = (int16_t) ( ( ism_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); + bstr_orig = st0->bit_stream; + next_bit_pos_orig = st0->next_bit_pos; + st0->next_bit_pos = 0; + + /* reverse the bitstream for easier reading of indices */ + for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) + { + bstr_meta[i] = st0->bit_stream[last_bit_pos - i]; + } + st0->bit_stream = bstr_meta; + st0->total_brate = ism_total_brate; /* needed for BER detection in get_next_indice() */ + + if ( !bfi ) + { + /*----------------------------------------------------------------* + * ISm common signaling + *----------------------------------------------------------------*/ + + /* number of objects was already read in ivas_ism_get_dtx_dec() */ + /* update the position in the bitstream */ + st0->next_bit_pos += nchan_ism; + + /* read SID metadata flag( one per object ) */ + for ( ch = 0; ch < nchan_ism; ch++ ) + { + md_diff_flag[ch] = get_next_indice( st0, 1 ); + } + + /*----------------------------------------------------------------* + * Set quantization bits based on the number of coded objects + *----------------------------------------------------------------*/ + + ivas_get_ism_sid_quan_bitbudget( nchan_ism, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); + + /*----------------------------------------------------------------* + * Spatial parameters, loop over TCs - 1 + *----------------------------------------------------------------*/ + + *flag_noisy_speech = 0; + *sce_id_dtx = 0; + + /* read ISM mode flag to explicitly signal number of spatial parameters */ + if ( nchan_ism > 2 ) + { + idx = get_next_indice( st0, 1 ); + ism_mode_bstr = (ISM_MODE) ( idx + 1 ); + /* note: ISM mode was already read and used for configuration in in ivas_ism_dtx_dec() */ + + if ( ism_mode_bstr == ISM_MODE_PARAM ) + { + /* read noisy speech flag */ + *flag_noisy_speech = get_next_indice( st0, 1 ); + nBits_sce_id = 1; + } + } + + if ( nchan_transport > 1 ) + { + /* read sce id */ + *sce_id_dtx = get_next_indice( st0, nBits_sce_id ); + + /* decode the coherence */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + if ( ch == *sce_id_dtx ) + { + hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = 1.0f; + continue; + } + + idx = get_next_indice( st0, nBits_coh ); + hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = (float) ( idx ) / (float) ( ( 1 << nBits_coh ) - 1 ); + } + } +#ifndef FIX_ISM_DTX_CNG_BWIDTH_ALT + else + { + *sce_id_dtx = 0; + } +#endif + + if ( ism_mode == ISM_MODE_PARAM ) + { + hSCE[*sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = hSCE[!*sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence; + } + + /*----------------------------------------------------------------* + * Metadata decoding and dequantization, loop over all objects + *----------------------------------------------------------------*/ + + for ( ch = 0; ch < nchan_ism; ch++ ) + { + hIsmMetaData = hIsmMeta[ch]; + if ( md_diff_flag[ch] == 1 ) + { + /* Azimuth decoding */ + idx_azimuth = get_next_indice( st0, nBits_azimuth ); + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); + + /* Elevation decoding */ + idx_elevation = get_next_indice( st0, nBits_elevation ); + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); + + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) + { + hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->position_angle.last_angle2_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + } + else + { + hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); + } + + /* save for smoothing metadata evolution */ + hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; + hIsmMetaData->last_true_elevation = hIsmMetaData->elevation; + } + } + + /* take into account padding bits as metadata bits to keep later bitrate checks valid */ + nb_bits_metadata[*sce_id_dtx] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + + /* set the bitstream pointer to its original position */ + st0->bit_stream = bstr_orig; + st0->next_bit_pos = next_bit_pos_orig; + } + + /* smooth the metadata evolution */ + ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); + + return; +} diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 2b6d0b687665f9404f4b7498dd04cd2232b16dd0..d58887f2da3f5c94448a97e47b1295dbea144bcb 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -35,6 +35,7 @@ #include #include "options.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "prot.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" @@ -50,6 +51,8 @@ static void ivas_param_ism_dec_dequant_DOA( DIRAC_DEC_HANDLE hDirAC /* i/o: decoder DirAC handle */ + , + const int16_t nchan_ism /* i : number of ISM channels */ ) { int16_t i; @@ -57,13 +60,13 @@ static void ivas_param_ism_dec_dequant_DOA( hParamIsm = hDirAC->hParamIsm; - assert( hParamIsm->num_obj <= MAX_NUM_OBJECTS ); + assert( nchan_ism <= MAX_NUM_OBJECTS ); /* Get the azimuth and elevation values */ - for ( i = 0; i < hParamIsm->num_obj; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { - hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); - hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); } return; @@ -154,9 +157,137 @@ static void ivas_ism_get_proto_matrix( return; } +#ifdef JBM_TSM_ON_TCS +static void ivas_param_ism_collect_slot( + DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + float *Cldfb_RealBuffer_in, + float *Cldfb_ImagBuffer_in, + const int16_t ch, + float ref_power[], + float cx_diag[][PARAM_ISM_MAX_DMX] ) +{ + + int16_t band_idx, bin_idx; + int16_t brange[2]; + float tmp; + + /* loop over parameter bands to collect transport channel energies */ + for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) + { + brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; + brange[1] = hDirAC->hParamIsm->band_grouping[band_idx + 1]; + for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) + { + tmp = 0.0f; + tmp += ( Cldfb_RealBuffer_in[bin_idx] * Cldfb_RealBuffer_in[bin_idx] ); + tmp += ( Cldfb_ImagBuffer_in[bin_idx] * Cldfb_ImagBuffer_in[bin_idx] ); + cx_diag[bin_idx][ch] += tmp; + ref_power[bin_idx] += tmp; + } + } + return; +} static void ivas_param_ism_compute_mixing_matrix( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + const int16_t nchan_ism, /* i : number of ISM channels */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + ISM_DTX_DATA_DEC hISMDTX, /* i : ISM DTX handle */ + float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN], + const int16_t nchan_transport, + const int16_t nchan_out_woLFE, + float cx_diag[][PARAM_ISM_MAX_DMX], + float ref_power[], + float mixing_matrix[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX] ) +{ + int16_t band_idx, bin_idx; + int16_t i, w, obj_indx; + int16_t brange[2]; + float direct_power[MAX_NUM_OBJECTS]; + float cy_diag[PARAM_ISM_MAX_CHAN]; + float cy_diag_tmp[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN]; + float *dir_res_ptr; + float *proto_matrix; + float response_matrix[PARAM_ISM_MAX_CHAN * MAX_NUM_OBJECTS]; + int16_t num_wave; + + proto_matrix = hDirAC->hParamIsmRendering->proto_matrix; + + assert( ( nchan_ism == 3 ) || ( nchan_ism == 4 ) ); + assert( nchan_transport == 2 ); + + if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) + { + num_wave = nchan_ism; + } + else + { + num_wave = MAX_PARAM_ISM_WAVE; + } + set_zero( response_matrix, PARAM_ISM_MAX_CHAN * MAX_NUM_OBJECTS ); + + /* loop over parameter bands to compute the mixing matrix */ + for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) + { + brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; + brange[1] = hDirAC->hParamIsm->band_grouping[band_idx + 1]; + + /* Compute covaraince matrix from direct response*/ + for ( w = 0; w < num_wave; w++ ) + { + set_zero( cy_diag_tmp[w], nchan_out_woLFE ); + + if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) + { + dir_res_ptr = direct_response[w]; + } + else + { + obj_indx = hDirAC->hParamIsm->obj_indices[band_idx][0][w]; + dir_res_ptr = direct_response[obj_indx]; + } + mvr2r( dir_res_ptr, response_matrix + w * nchan_out_woLFE, nchan_out_woLFE ); + /* we only need the diagonal of Cy*/ + matrix_product_diag( dir_res_ptr, nchan_out_woLFE, 1, 0, dir_res_ptr, 1, nchan_out_woLFE, 0, cy_diag_tmp[w] ); + } + + for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) + { + + set_zero( cy_diag, nchan_out_woLFE ); + for ( w = 0; w < num_wave; w++ ) + { + if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) + { + direct_power[w] = ( 1.0f / nchan_ism ) * ref_power[bin_idx]; + } + else + { + direct_power[w] = hDirAC->power_ratios[band_idx][0][w] * ref_power[bin_idx]; + } + + if ( direct_power[w] != 0.f ) + { + for ( i = 0; i < nchan_out_woLFE; i++ ) + { + cy_diag[i] += direct_power[w] * cy_diag_tmp[w][i]; + } + } + direct_power[w] = sqrtf( direct_power[w] ); + } + /* Compute mixing matrix */ + computeMixingMatricesISM( nchan_transport, num_wave, nchan_out_woLFE, response_matrix, direct_power, cx_diag[bin_idx], cy_diag, proto_matrix, 1, + PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix[bin_idx] ); + } + } + + return; +} + +#else +static void ivas_param_ism_compute_mixing_matrix( + const int16_t nchan_ism, /* i : number of ISM channels */ + DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ + ISM_DTX_DATA_DEC hISMDTX, /* i : ISM DTX handle */ float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN], @@ -181,12 +312,12 @@ static void ivas_param_ism_compute_mixing_matrix( proto_matrix = hDirAC->hParamIsmRendering->proto_matrix; - assert( ( hDirAC->hParamIsm->num_obj == 3 ) || ( hDirAC->hParamIsm->num_obj == 4 ) ); + assert( ( nchan_ism == 3 ) || ( nchan_ism == 4 ) ); assert( nchan_transport == 2 ); - if ( hDirAC->hParamIsm->flag_noisy_speech ) + if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) { - num_wave = hDirAC->hParamIsm->num_obj; + num_wave = nchan_ism; } else { @@ -206,7 +337,7 @@ static void ivas_param_ism_compute_mixing_matrix( { set_zero( cy_diag_tmp[w], nchan_out_woLFE ); - if ( hDirAC->hParamIsm->flag_noisy_speech ) + if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) { dir_res_ptr = direct_response[w]; } @@ -245,9 +376,9 @@ static void ivas_param_ism_compute_mixing_matrix( set_zero( cy_diag, nchan_out_woLFE ); for ( w = 0; w < num_wave; w++ ) { - if ( hDirAC->hParamIsm->flag_noisy_speech ) + if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) { - direct_power[w] = ( 1.0f / hDirAC->hParamIsm->num_obj ) * ref_power; + direct_power[w] = ( 1.0f / nchan_ism ) * ref_power; } else { @@ -271,7 +402,45 @@ static void ivas_param_ism_compute_mixing_matrix( return; } +#endif + +#ifdef JBM_TSM_ON_TCS +static void ivas_param_ism_render_slot( + DIRAC_DEC_HANDLE hDirAC, + float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX], + float *Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX], + float Cldfb_RealBuffer[PARAM_ISM_MAX_CHAN][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float Cldfb_ImagBuffer[PARAM_ISM_MAX_CHAN][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float mixing_matrix[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX], + const int16_t interpolator_idx, + const int16_t out_slot_idx, + const int16_t num_ch_LS, + const int16_t nchan_transport ) +{ + int16_t outchIdx, inchIdx, bin_idx; + float tmp_1, mixing_matrix_smooth; + + tmp_1 = hDirAC->hParamIsmRendering->interpolator[interpolator_idx]; + + for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + { + /* smooth the mixing matrix */ + for ( outchIdx = 0; outchIdx < num_ch_LS; outchIdx++ ) + { + for ( inchIdx = 0; inchIdx < nchan_transport; inchIdx++ ) + { + mixing_matrix_smooth = tmp_1 * mixing_matrix[bin_idx][outchIdx + inchIdx * num_ch_LS] + + ( 1 - tmp_1 ) * hDirAC->hParamIsmRendering->mixing_matrix_lin_old[bin_idx][outchIdx + inchIdx * num_ch_LS]; + + Cldfb_RealBuffer[outchIdx][out_slot_idx][bin_idx] += mixing_matrix_smooth * Cldfb_RealBuffer_in[inchIdx][bin_idx]; + Cldfb_ImagBuffer[outchIdx][out_slot_idx][bin_idx] += mixing_matrix_smooth * Cldfb_ImagBuffer_in[inchIdx][bin_idx]; + } + } + } + return; +} +#endif static void ivas_param_ism_rendering( DIRAC_DEC_HANDLE hDirAC, @@ -393,7 +562,6 @@ ivas_error ivas_param_ism_dec_open( IVAS_OUTPUT_SETUP hOutSetup; AUDIO_CONFIG output_config; int32_t output_Fs; - int16_t nchan_out; ivas_error error; error = IVAS_ERR_OK; @@ -422,26 +590,27 @@ ivas_error ivas_param_ism_dec_open( output_Fs = st_ivas->hDecoderConfig->output_Fs; output_config = st_ivas->hDecoderConfig->output_config; - nchan_out = st_ivas->hDecoderConfig->nchan_out; - if ( output_config == AUDIO_CONFIG_EXTERNAL ) - { - hDirAC->hParamIsm->num_obj = nchan_out; - } - else - { - hDirAC->hParamIsm->num_obj = MAX_NUM_OBJECTS; - } - ivas_param_ism_config( hDirAC->hParamIsm ); + ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->nchan_ism ); /*-----------------------------------------------------------------* * set input parameters *-----------------------------------------------------------------*/ hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); +#ifdef JBM_TSM_ON_TCS + hDirAC->hConfig = NULL; + set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hDirAC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + hDirAC->subframes_rendered = 0; + hDirAC->slots_rendered = 0; + hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; +#else hDirAC->subframe_nbslots = (int16_t) ( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); hDirAC->nb_subframes = CLDFB_NO_COL_MAX / hDirAC->subframe_nbslots; assert( hDirAC->nb_subframes <= MAX_PARAM_SPATIAL_SUBFRAMES ); +#endif hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -464,7 +633,7 @@ ivas_error ivas_param_ism_dec_open( if ( output_config == AUDIO_CONFIG_EXTERNAL ) { /* nchan_out is essential for memory initialization for CLDFB Synthesis */ - st_ivas->hIntSetup.nchan_out_woLFE = hDirAC->hParamIsm->num_obj; + st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->nchan_ism; st_ivas->hIntSetup.is_loudspeaker_setup = 1; } @@ -473,10 +642,24 @@ ivas_error ivas_param_ism_dec_open( if ( !( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) { /* Initialize Param ISM Rendering handle */ - if ( ( error = ivas_param_ism_rendering_init( hDirAC->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, CLDFB_NO_COL_MAX, output_config ) ) != IVAS_ERR_OK ) +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active ) { - return error; + if ( ( error = ivas_param_ism_rendering_init( hDirAC->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, MAX_JBM_CLDFB_TIMESLOTS, output_config ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { +#endif + if ( ( error = ivas_param_ism_rendering_init( hDirAC->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, CLDFB_NO_COL_MAX, output_config ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef JBM_TSM_ON_TCS } +#endif } if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM || output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) @@ -492,47 +675,174 @@ ivas_error ivas_param_ism_dec_open( set_zero( hDirAC->azimuth_values, MAX_NUM_OBJECTS ); set_zero( hDirAC->elevation_values, MAX_NUM_OBJECTS ); +#ifdef JBM_TSM_ON_TCS + hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; +#else hDirAC->dirac_md_buffer_length = 0; +#endif hDirAC->dirac_bs_md_write_idx = 0; hDirAC->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; if ( ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) { +#ifndef JBM_TSM_ON_TCS hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; - hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ); - hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); - hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ); +#endif + if ( ( hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->azimuth2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->elevation2 = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->energy_ratio2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->spreadCoherence2 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + + if ( ( hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } + for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { - hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + if ( ( hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_s( hDirAC->azimuth[i], 0, hDirAC->num_freq_bands ); - hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_s( hDirAC->elevation[i], 0, hDirAC->num_freq_bands ); - hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->azimuth2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_s( hDirAC->azimuth2[i], 0, hDirAC->num_freq_bands ); - hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ); + + if ( ( hDirAC->elevation2[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_s( hDirAC->elevation2[i], 0, hDirAC->num_freq_bands ); - hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->spreadCoherence[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->energy_ratio2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->energy_ratio2[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->spreadCoherence2[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->spreadCoherence2[i], 0.0f, hDirAC->num_freq_bands ); - hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ); + + if ( ( hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM Rendering handle\n" ) ); + } set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); } } + st_ivas->hISMDTX.dtx_flag = 0; + st_ivas->hDirAC = hDirAC; +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active ) + { + 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 ) + { + nchan_full = nchan_transport; + hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; + hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + } + else + { + hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands * sizeof( float ) ); + set_zero( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands ); + hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands * sizeof( float ) ); + set_zero( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hDirAC->num_freq_bands ); + } + 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 ) + { + return error; + } + } + } + else + { + hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; + hDirAC->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 ) + { + return error; + } + } + } + } + else + { + hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; + hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + } +#endif pop_wmops(); return error; @@ -546,11 +856,19 @@ ivas_error ivas_param_ism_dec_open( *-------------------------------------------------------------------------*/ void ivas_param_ism_dec_close( - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - AUDIO_CONFIG output_config /* i : output audio configuration */ + DIRAC_DEC_HANDLE *hDirAC_out, /* i/o: decoder DirAC handle */ + AUDIO_CONFIG output_config /* i : output audio configuration */ ) { int16_t i; + DIRAC_DEC_HANDLE hDirAC; + + if ( hDirAC_out == NULL || *hDirAC_out == NULL ) + { + return; + } + + hDirAC = *hDirAC_out; /* Config & CLDFB */ if ( hDirAC->hParamIsm != NULL ) @@ -701,13 +1019,27 @@ void ivas_param_ism_dec_close( } } +#ifdef JBM_TSM_ON_TCS + if ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc != NULL ) + { + free( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc ); + hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; + } + if ( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc != NULL ) + { + free( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc ); + hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; + } +#endif + if ( hDirAC->hParamIsmRendering != NULL ) { free( hDirAC->hParamIsmRendering ); hDirAC->hParamIsmRendering = NULL; } - free( hDirAC ); + free( *hDirAC_out ); + *hDirAC_out = NULL; return; } @@ -726,7 +1058,11 @@ void ivas_param_ism_dec( { int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i; int16_t subframe_idx, slot_idx, index_slot, bin_idx; - + int32_t ivas_total_brate; +#ifdef JBM_TSM_ON_TCS + float ref_power[CLDFB_NO_CHANNELS_MAX]; + float cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; +#endif /* CLDFB Input Buffers */ float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -752,7 +1088,7 @@ void ivas_param_ism_dec( nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { - nchan_out = st_ivas->hDirAC->hParamIsm->num_obj; + nchan_out = st_ivas->nchan_ism; nchan_out_woLFE = nchan_out; st_ivas->hDecoderConfig->nchan_out = nchan_out; } @@ -762,19 +1098,38 @@ void ivas_param_ism_dec( nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; } + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + hSetup = st_ivas->hIntSetup; push_wmops( "ivas_param_ism_dec" ); +#ifdef JBM_TSM_ON_TCS + /* set buffers to zero */ + for ( bin_idx = 0; bin_idx < CLDFB_NO_CHANNELS_MAX; bin_idx++ ) + { + set_zero( cx_diag[bin_idx], PARAM_ISM_MAX_DMX ); + } + set_zero( ref_power, CLDFB_NO_CHANNELS_MAX ); +#endif + /* Frame-level Processing */ /* De-quantization */ - ivas_param_ism_dec_dequant_DOA( hDirAC ); - ivas_param_ism_dec_dequant_powrat( hDirAC ); + if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) + { + ivas_param_ism_dec_dequant_DOA( hDirAC, st_ivas->nchan_ism ); + ivas_param_ism_dec_dequant_powrat( hDirAC ); + st_ivas->hISMDTX.dtx_flag = 0; + } + else + { + st_ivas->hISMDTX.dtx_flag = 1; + } /* obtain the direct response using EFAP */ if ( !( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) ) { - for ( i = 0; i < hDirAC->hParamIsm->num_obj; i++ ) + for ( i = 0; i < st_ivas->nchan_ism; i++ ) { efap_determine_gains( st_ivas->hEFAPdata, direct_response[i], hDirAC->azimuth_values[i], hDirAC->elevation_values[i], EFAP_MODE_EFAP ); } @@ -783,7 +1138,7 @@ void ivas_param_ism_dec( { int16_t j; - for ( i = 0; i < hDirAC->hParamIsm->num_obj; i++ ) + for ( i = 0; i < st_ivas->nchan_ism; i++ ) { for ( j = 0; j < nchan_out_woLFE; j++ ) { @@ -822,6 +1177,10 @@ void ivas_param_ism_dec( for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) { cldfbAnalysis_ts( &( output_f[ch][hDirAC->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + +#ifdef JBM_TSM_ON_TCS + ivas_param_ism_collect_slot( hDirAC, Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], ch, ref_power, cx_diag ); +#endif } } @@ -832,26 +1191,41 @@ void ivas_param_ism_dec( } /* Compute mixing matrix */ - ivas_param_ism_compute_mixing_matrix( hDirAC, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); - +#ifdef JBM_TSM_ON_TCS + ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, mixing_matrix ); +#else + ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); +#endif /* subframe loop for synthesis*/ for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ ) { +#ifdef JBM_TSM_ON_TCS + uint16_t slot_idx_start = subframe_idx * hDirAC->subframe_nbslots[subframe_idx]; +#else uint16_t slot_idx_start = subframe_idx * hDirAC->subframe_nbslots; +#endif uint16_t idx_in; uint16_t idx_lfe; /* Set some memories to zero */ for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { +#ifdef JBM_TSM_ON_TCS + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) +#else for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) +#endif { set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); } } +#ifdef JBM_TSM_ON_TCS + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) +#else for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) +#endif { index_slot = slot_idx_start + slot_idx; @@ -869,8 +1243,11 @@ void ivas_param_ism_dec( { if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) { +#ifdef JBM_TSM_ON_TCS + set_zero( &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); +#else set_zero( &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots * hDirAC->num_freq_bands ); - +#endif if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -882,14 +1259,22 @@ void ivas_param_ism_dec( float *ImagBuffer[16]; /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) +#else for ( i = 0; i < hDirAC->subframe_nbslots; i++ ) +#endif { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } - +#ifdef JBM_TSM_ON_TCS + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), + hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); +#else cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[ch] ); +#endif idx_in++; } @@ -901,7 +1286,7 @@ void ivas_param_ism_dec( ivas_param_ism_update_mixing_matrix( hDirAC, mixing_matrix, nchan_transport, nchan_out_woLFE ); /* store MetaData parameters */ - for ( ch = 0; ch < hDirAC->hParamIsm->num_obj; ch++ ) + for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) { if ( st_ivas->hDirAC->azimuth_values[ch] > 180.0f ) { @@ -920,337 +1305,519 @@ void ivas_param_ism_dec( return; } - -/*-------------------------------------------------------------------------* - * ivas_param_ism_params_to_masa_param_mapping() - * - * - *-------------------------------------------------------------------------*/ - -void ivas_param_ism_params_to_masa_param_mapping( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) +#ifdef JBM_TSM_ON_TCS +void ivas_ism_dec_digest_tc( + Decoder_Struct *st_ivas ) { - DIRAC_DEC_HANDLE hDirAC; - int16_t nBins; - int16_t band_idx, bin_idx, sf_idx; - int16_t brange[2]; - int16_t azimuth[2]; - int16_t elevation[2]; - float power_ratio[2]; - hDirAC = st_ivas->hDirAC; - nBins = hDirAC->num_freq_bands; - ivas_param_ism_dec_dequant_DOA( hDirAC ); - ivas_param_ism_dec_dequant_powrat( hDirAC ); - if ( hDirAC->hParamIsm->num_obj > 1 ) + ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); + + if ( + st_ivas->renderer_type == RENDERER_TD_PANNING || + st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || + ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->hDecoderConfig->Opt_Headrotation == 0 ) ) { - hDirAC->numSimultaneousDirections = 2; - for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) + int16_t i, num_objects; + int16_t azimuth, elevation; + /* we have a full frame interpolator, adapt it */ + /* for BE testing */ + if ( ( st_ivas->hDecoderConfig->output_Fs / (int32_t) FRAMES_PER_SECOND ) == st_ivas->hTcBuffer->n_samples_available ) { - brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; - brange[1] = hDirAC->hParamIsm->band_grouping[band_idx + 1]; - - azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[hDirAC->hParamIsm->obj_indices[band_idx][0][0]] ); - elevation[0] = (int16_t) roundf( hDirAC->elevation_values[hDirAC->hParamIsm->obj_indices[band_idx][0][0]] ); - power_ratio[0] = hDirAC->power_ratios[band_idx][0][0]; - - azimuth[1] = (int16_t) roundf( hDirAC->azimuth_values[hDirAC->hParamIsm->obj_indices[band_idx][0][1]] ); - elevation[1] = (int16_t) roundf( hDirAC->elevation_values[hDirAC->hParamIsm->obj_indices[band_idx][0][1]] ); - power_ratio[1] = hDirAC->power_ratios[band_idx][0][1]; - - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + int16_t interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / (int32_t) FRAMES_PER_SECOND ); + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { - for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) + st_ivas->hIsmRendererData->interpolator[0] = 0.0f; + for ( i = 1; i < interpolator_length; i++ ) { - hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; - hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; - hDirAC->energy_ratio1[sf_idx][bin_idx] = power_ratio[0]; - hDirAC->azimuth2[sf_idx][bin_idx] = azimuth[1]; - hDirAC->elevation2[sf_idx][bin_idx] = elevation[1]; - hDirAC->energy_ratio2[sf_idx][bin_idx] = power_ratio[1]; + st_ivas->hIsmRendererData->interpolator[i] = st_ivas->hIsmRendererData->interpolator[i - 1] + 1.f / ( interpolator_length - 1 ); } } - } - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) - { - for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) + else { - hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; - hDirAC->spreadCoherence2[sf_idx][bin_idx] = 0.0f; - hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + for ( i = 0; i < interpolator_length; i++ ) + { + st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); + } } } - } - else - { - hDirAC->numSimultaneousDirections = 1; - azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[0] ); - elevation[0] = (int16_t) roundf( hDirAC->elevation_values[0] ); - for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + else { - for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) + ivas_jbm_dec_get_adapted_linear_interpolator( (int16_t) ( st_ivas->hDecoderConfig->output_Fs / (int32_t) FRAMES_PER_SECOND ), + st_ivas->hTcBuffer->n_samples_available, + st_ivas->hIsmRendererData->interpolator ); + } + /* also get the gains here */ + num_objects = st_ivas->nchan_transport; + for ( i = 0; i < num_objects; i++ ) + { + mvr2r( st_ivas->hIsmRendererData->gains[i], st_ivas->hIsmRendererData->prev_gains[i], MAX_OUTPUT_CHANNELS ); + if ( st_ivas->intern_config == AUDIO_CONFIG_STEREO ) { - hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; - hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; - hDirAC->energy_ratio1[sf_idx][bin_idx] = 1.0f; - hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; - hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + ivas_ism_get_stereo_gains( st_ivas->hIsmMetaData[i]->azimuth, + st_ivas->hIsmMetaData[i]->elevation, + &st_ivas->hIsmRendererData->gains[i][0], + &st_ivas->hIsmRendererData->gains[i][1] ); + } + else + { + // TODO tmu review when #215 is resolved + azimuth = (int16_t) floorf( st_ivas->hIsmMetaData[i]->azimuth + 0.5f ); + elevation = (int16_t) floorf( st_ivas->hIsmMetaData[i]->elevation + 0.5f ); + if ( ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) && st_ivas->hHeadTrackData == NULL ) + { + + + if ( st_ivas->hIntSetup.is_planar_setup ) + { + /* If no elevation support in output format, then rendering should be done with zero elevation */ + elevation = 0; + } + if ( st_ivas->hEFAPdata != NULL ) + { + efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], azimuth, elevation, EFAP_MODE_EFAP ); + } + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + /*get HOA gets for direction (ACN/SN3D)*/ + ivas_dirac_dec_get_response( azimuth, elevation, st_ivas->hIsmRendererData->gains[i], st_ivas->hIntSetup.ambisonics_order ); + } } } } - return; } - -/*-------------------------------------------------------------------------* - * ivas_ism_bitrate_switching() - * - * - *-------------------------------------------------------------------------*/ - -static ivas_error ivas_ism_bitrate_switching( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nchan_transport_old, /* i : last number of transport channels */ - const ISM_MODE last_ism_mode, /* i : last ISM mode */ - const int16_t num_obj /* i : number of objects in the bitstream */ +void ivas_param_ism_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ) { - ivas_error error; - int32_t element_brate_tmp[MAX_NUM_OBJECTS]; - int16_t nSCE_old, nCPE_old; + int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i; + int16_t slot_idx, bin_idx; + int32_t ivas_total_brate; + float ref_power[CLDFB_NO_CHANNELS_MAX]; + float cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; + /* Direct Response/EFAP Gains */ + float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN]; - error = IVAS_ERR_OK; + DIRAC_DEC_HANDLE hDirAC; - nCPE_old = st_ivas->nCPE; - nSCE_old = st_ivas->nSCE; + /* Initialization */ + hDirAC = st_ivas->hDirAC; + assert( hDirAC ); + + nchan_transport = st_ivas->nchan_transport; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); - st_ivas->nSCE = st_ivas->nchan_transport; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + nchan_out = st_ivas->nchan_ism; + nchan_out_woLFE = nchan_out; + st_ivas->hDecoderConfig->nchan_out = nchan_out; + } + else + { + nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; + nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; + } - ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ); + push_wmops( "ivas_param_ism_dec" ); - ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ); + /* general setup */ + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hDirAC->hParamIsmRendering->interpolator ); - /* Initialize the needed renderer struct and destroy the unnecessary renderer struct */ + ivas_dirac_dec_set_md_map( st_ivas, nCldfbSlots ); - /* select the renderer */ - ivas_renderer_select( st_ivas ); - ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); - if ( ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->ism_mode == ISM_MODE_DISC ) ) + /* set buffers to zero */ + for ( bin_idx = 0; bin_idx < CLDFB_NO_CHANNELS_MAX; bin_idx++ ) { - ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config ); + set_zero( cx_diag[bin_idx], PARAM_ISM_MAX_DMX ); } + set_zero( ref_power, CLDFB_NO_CHANNELS_MAX ); - if ( st_ivas->ism_mode != last_ism_mode ) + /* Frame-level Processing */ + /* De-quantization */ + if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) { - /* EFAP handle */ - efap_free_data( &st_ivas->hEFAPdata ); + ivas_param_ism_dec_dequant_DOA( hDirAC, st_ivas->nchan_ism ); + ivas_param_ism_dec_dequant_powrat( hDirAC ); + st_ivas->hISMDTX.dtx_flag = 0; } - - if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) + else { - /* switching from ParamISM to DiscISM */ + st_ivas->hISMDTX.dtx_flag = 1; + } - /* Deallocate the ParamISM struct */ - if ( st_ivas->hDirAC != NULL ) + /* obtain the direct response using EFAP */ + if ( !( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) ) + { + for ( i = 0; i < st_ivas->nchan_ism; i++ ) { - ivas_param_ism_dec_close( st_ivas->hDirAC, st_ivas->hDecoderConfig->output_config ); - st_ivas->hDirAC = NULL; + efap_determine_gains( st_ivas->hEFAPdata, direct_response[i], hDirAC->azimuth_values[i], hDirAC->elevation_values[i], EFAP_MODE_EFAP ); } + } + else + { + int16_t j; - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL ) - { - /* close the parametric binaural renderer */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - - /* Open the TD Binaural renderer */ - ivas_td_binaural_open( st_ivas ); - } - else + for ( i = 0; i < st_ivas->nchan_ism; i++ ) { - /* close the ISM renderer and reinitialize */ - if ( st_ivas->hIsmRendererData != NULL ) + for ( j = 0; j < nchan_out_woLFE; j++ ) { - free( st_ivas->hIsmRendererData ); - st_ivas->hIsmRendererData = NULL; + if ( i == j ) + { + direct_response[i][j] = 1.0f; + } + else + { + direct_response[i][j] = 0.0f; + } } - ivas_ism_renderer_open( st_ivas ); } - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) + for ( i = 0; i < nchan_transport; i++ ) { - /* close the parametric binaural renderer */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - - /* Open Crend Binaural renderer */ -#ifdef FIX_197_CREND_INTERFACE - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), - getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), - getRendAudioConfigFromIvasAudioConfig( st_ivas->hOutSetup.output_config ), - st_ivas->hRenderConfig, - st_ivas->hDecoderConfig->Opt_Headrotation, -#ifdef HRTF_BINARY_FILE - st_ivas->hSetOfHRTF, -#endif - st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + for ( j = 0; j < nchan_out_woLFE; j++ ) { - return error; + if ( i == j ) + { + hDirAC->hParamIsmRendering->proto_matrix[( i * nchan_out_woLFE ) + j] = 1.0f; + } + else + { + hDirAC->hParamIsmRendering->proto_matrix[( i * nchan_out_woLFE ) + j] = 0.0f; + } } - st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#else - ivas_crend_open( st_ivas ); -#endif } } - if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC ) + for ( ch = 0; ch < nchan_transport; ch++ ) + { + /*-----------------------------------------------------------------* + * CLDFB Analysis + *-----------------------------------------------------------------*/ + for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) + { + float RealBuffer[CLDFB_NO_CHANNELS_MAX]; + float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; + + cldfbAnalysis_ts( &( transport_channels_f[ch][hDirAC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + mvr2r( RealBuffer, &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands], hDirAC->num_freq_bands ); + mvr2r( ImagBuffer, &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands], hDirAC->num_freq_bands ); + + ivas_param_ism_collect_slot( hDirAC, RealBuffer, ImagBuffer, ch, ref_power, cx_diag ); + } + } + + /* Obtain Mixing Matrix on a frame-level */ + for ( bin_idx = 0; bin_idx < hDirAC->num_freq_bands; bin_idx++ ) + { + set_f( hDirAC->hParamIsmRendering->mixing_matrix_lin[bin_idx], 0.0f, nchan_transport * nchan_out_woLFE ); + } + + /* Compute mixing matrix */ + ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, hDirAC->hParamIsmRendering->mixing_matrix_lin ); + + + pop_wmops(); + + return; +} + +static void ivas_ism_param_dec_render_sf( Decoder_Struct *st_ivas, + IVAS_OUTPUT_SETUP hSetup, + const int16_t nchan_transport, + const int16_t nchan_out, + const int16_t nchan_out_woLFE, + float *output_f[] /* o : rendered time signal */ +) +{ + + int16_t ch, slot_idx, i, index_slot; + /* CLDFB Output Buffers */ + float Cldfb_RealBuffer[PARAM_ISM_MAX_CHAN][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[PARAM_ISM_MAX_CHAN][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX]; + float *Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX]; + DIRAC_DEC_HANDLE hDirAC; + + int16_t slot_idx_start; + int16_t idx_in; + int16_t idx_lfe; + int16_t subframe_idx; + + hDirAC = st_ivas->hDirAC; + slot_idx_start = hDirAC->slots_rendered; + subframe_idx = hDirAC->subframes_rendered; + + /* Set some memories to zero */ + for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { - /* switching from Discrete ISM to ParamISM */ + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); + set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); + } + } - /* Allocate and initialize the ParamISM struct */ - ivas_param_ism_dec_open( st_ivas ); + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + index_slot = slot_idx_start + slot_idx; - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL ) + for ( ch = 0; ch < nchan_transport; ch++ ) { - /* open the parametric binaural renderer */ -#ifdef HRTF_BINARY_FILE - ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ); - ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ); -#else - ivas_dirac_dec_init_binaural_data( st_ivas ); -#endif + Cldfb_RealBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc[index_slot * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands]; + Cldfb_ImagBuffer_in[ch] = &hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc[index_slot * hDirAC->num_freq_bands * nchan_transport + ch * hDirAC->num_freq_bands]; + } - /* Close the TD Binaural renderer */ - if ( st_ivas->hBinRendererTd != NULL ) - { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - } - if ( st_ivas->hHrtfTD != NULL ) + /* Compute bandwise rendering to target LS using covariance rendering */ + ivas_param_ism_render_slot( hDirAC, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC->hParamIsmRendering->mixing_matrix_lin, index_slot, slot_idx, + nchan_out_woLFE, nchan_transport ); + } + + /* CLDFB Synthesis */ + idx_in = 0; + idx_lfe = 0; + + for ( ch = 0; ch < nchan_out; ch++ ) + { + if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) + { + set_zero( output_f[ch], hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); + if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { - st_ivas->hHrtfTD = NULL; + idx_lfe++; } } else { - /* Close the ISM renderer */ - if ( st_ivas->hIsmRendererData != NULL ) + float *RealBuffer[16]; + float *ImagBuffer[16]; + + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) { - free( st_ivas->hIsmRendererData ); - st_ivas->hIsmRendererData = NULL; + RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } + cldfbSynthesis( RealBuffer, ImagBuffer, output_f[ch], + hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); + idx_in++; } + } + hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe_idx]; + hDirAC->subframes_rendered++; +} - if ( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) - { - /* open the parametric binaural renderer */ -#ifdef HRTF_BINARY_FILE - ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ); - ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ); -#else - ivas_dirac_dec_init_binaural_data( st_ivas ); -#endif +void ivas_param_ism_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ +) +{ + int16_t ch, slots_to_render, first_sf, last_sf, subframe_idx; + uint16_t slot_size, n_samples_sf; + DIRAC_DEC_HANDLE hDirAC; + IVAS_OUTPUT_SETUP hSetup; + int16_t nchan_transport, nchan_out, nchan_out_woLFE; + float *output_f_local[MAX_OUTPUT_CHANNELS]; - /* close the crend binaural renderer */ -#ifdef FIX_197_CREND_INTERFACE - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#else - ivas_crend_close( st_ivas ); + hDirAC = st_ivas->hDirAC; + hSetup = st_ivas->hIntSetup; +#ifdef DEBUGGING + assert( hDirAC ); +#endif + nchan_transport = st_ivas->nchan_transport; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + nchan_out = st_ivas->nchan_ism; + nchan_out_woLFE = nchan_out; + st_ivas->hDecoderConfig->nchan_out = nchan_out; + } + else + { + nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; + nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; + } + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( hDirAC->num_slots - hDirAC->slots_rendered, nSamplesAsked / slot_size ); + *nSamplesRendered = slots_to_render * slot_size; + first_sf = hDirAC->subframes_rendered; + last_sf = first_sf; + while ( slots_to_render > 0 ) + { + slots_to_render -= hDirAC->subframe_nbslots[last_sf]; + last_sf++; + } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif + for ( ch = 0; ch < nchan_out; ch++ ) + { + output_f_local[ch] = &output_f[ch][0]; + } + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + ivas_ism_param_dec_render_sf( st_ivas, hSetup, nchan_transport, nchan_out, nchan_out_woLFE, output_f_local ); + n_samples_sf = hDirAC->subframe_nbslots[subframe_idx] * st_ivas->hDirAC->slot_size; + for ( ch = 0; ch < nchan_out; ch++ ) + { + output_f_local[ch] += n_samples_sf; + } + } + if ( hDirAC->slots_rendered == hDirAC->num_slots ) + { + /* copy the memories */ + /* store mixing matrix for next subframe */ + ivas_param_ism_update_mixing_matrix( hDirAC, hDirAC->hParamIsmRendering->mixing_matrix_lin, nchan_transport, nchan_out_woLFE ); - if ( st_ivas->hHrtf != NULL ) + /* store MetaData parameters */ + for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) + { + if ( st_ivas->hDirAC->azimuth_values[ch] > 180.0f ) { - st_ivas->hHrtf = NULL; + st_ivas->hIsmMetaData[ch]->azimuth = st_ivas->hDirAC->azimuth_values[ch] - 360.0f; } -#endif + else + { + st_ivas->hIsmMetaData[ch]->azimuth = st_ivas->hDirAC->azimuth_values[ch]; + } + + st_ivas->hIsmMetaData[ch]->elevation = st_ivas->hDirAC->elevation_values[ch]; } } - - return error; + *nSamplesAvailable = ( hDirAC->num_slots - hDirAC->slots_rendered ) * slot_size; + return; } -/*------------------------------------------------------------------------- - * ivas_ism_dec_config() +#endif + + +/*-------------------------------------------------------------------------* + * ivas_param_ism_params_to_masa_param_mapping() + * * - * - select ISM format mode - * - reconfigure the ISM format decoder *-------------------------------------------------------------------------*/ -/*! r : ISM format mode */ -ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t num_obj /* i : number of objects in the bitstream */ +void ivas_param_ism_params_to_masa_param_mapping( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { + DIRAC_DEC_HANDLE hDirAC; + int16_t nBins; + int16_t band_idx, bin_idx, sf_idx; + int16_t brange[2]; + int16_t azimuth[2]; + int16_t elevation[2]; + float power_ratio[2]; int32_t ivas_total_brate; - ISM_MODE last_ism_mode; - ivas_error error; - int16_t nchan_transport_old; - error = IVAS_ERR_OK; + hDirAC = st_ivas->hDirAC; + nBins = hDirAC->num_freq_bands; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - /* store last frame ISM mode */ - last_ism_mode = st_ivas->ism_mode; - /* Assumes that num of input objects are constant */ - nchan_transport_old = num_obj; - if ( last_ism_mode == ISM_MODE_PARAM ) + if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) { - nchan_transport_old = 2; + ivas_param_ism_dec_dequant_DOA( hDirAC, st_ivas->nchan_ism ); + ivas_param_ism_dec_dequant_powrat( hDirAC ); + st_ivas->hISMDTX.dtx_flag = 0; } - - if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA ) + else { - /* select ISM format mode */ - st_ivas->ism_mode = ivas_ism_mode_select( num_obj, ivas_total_brate ); + st_ivas->hISMDTX.dtx_flag = 1; + } - st_ivas->nchan_transport = num_obj; - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + if ( st_ivas->nchan_ism > 1 ) + { + if ( st_ivas->hISMDTX.dtx_flag ) { - st_ivas->nchan_transport = 2; - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + float energy_ratio; + energy_ratio = powf( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence, 2.0f ); + + hDirAC->numSimultaneousDirections = 1; + azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[0] ); + elevation[0] = (int16_t) roundf( hDirAC->elevation_values[0] ); + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { - st_ivas->hDecoderConfig->nchan_out = num_obj; + for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) + { + hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; + hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; + + hDirAC->energy_ratio1[sf_idx][bin_idx] = energy_ratio; + + hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; + hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + } } } - - if ( st_ivas->ini_active_frame != 0 ) + else { - /* ISM bit-rate switching */ - if ( st_ivas->hDecoderConfig->last_ivas_total_brate != IVAS_SID_5k2 && st_ivas->hDecoderConfig->last_ivas_total_brate != FRAME_NO_DATA ) + hDirAC->numSimultaneousDirections = 2; + for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) + { + brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; + brange[1] = hDirAC->hParamIsm->band_grouping[band_idx + 1]; + + azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[hDirAC->hParamIsm->obj_indices[band_idx][0][0]] ); + elevation[0] = (int16_t) roundf( hDirAC->elevation_values[hDirAC->hParamIsm->obj_indices[band_idx][0][0]] ); + power_ratio[0] = hDirAC->power_ratios[band_idx][0][0]; + + azimuth[1] = (int16_t) roundf( hDirAC->azimuth_values[hDirAC->hParamIsm->obj_indices[band_idx][0][1]] ); + elevation[1] = (int16_t) roundf( hDirAC->elevation_values[hDirAC->hParamIsm->obj_indices[band_idx][0][1]] ); + power_ratio[1] = hDirAC->power_ratios[band_idx][0][1]; + + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) + { + hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; + hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; + hDirAC->energy_ratio1[sf_idx][bin_idx] = power_ratio[0]; + hDirAC->azimuth2[sf_idx][bin_idx] = azimuth[1]; + hDirAC->elevation2[sf_idx][bin_idx] = elevation[1]; + hDirAC->energy_ratio2[sf_idx][bin_idx] = power_ratio[1]; + } + } + } + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) { - if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) + for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) { - ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ); + hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; + hDirAC->spreadCoherence2[sf_idx][bin_idx] = 0.0f; + hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; } } } } - else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) - { - st_ivas->nchan_transport = num_obj; - } - - switch ( num_obj ) + else { - case 1: - st_ivas->transport_config = AUDIO_CONFIG_ISM1; - break; - case 2: - st_ivas->transport_config = AUDIO_CONFIG_ISM2; - break; - case 3: - st_ivas->transport_config = AUDIO_CONFIG_ISM3; - break; - case 4: - st_ivas->transport_config = AUDIO_CONFIG_ISM4; - break; - default: - st_ivas->transport_config = AUDIO_CONFIG_INVALID; - break; + hDirAC->numSimultaneousDirections = 1; + azimuth[0] = (int16_t) roundf( hDirAC->azimuth_values[0] ); + elevation[0] = (int16_t) roundf( hDirAC->elevation_values[0] ); + for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + for ( bin_idx = 0; bin_idx < nBins; bin_idx++ ) + { + hDirAC->azimuth[sf_idx][bin_idx] = azimuth[0]; + hDirAC->elevation[sf_idx][bin_idx] = elevation[0]; + hDirAC->energy_ratio1[sf_idx][bin_idx] = 1.0f; + hDirAC->spreadCoherence[sf_idx][bin_idx] = 0.0f; + hDirAC->surroundingCoherence[sf_idx][bin_idx] = 0.0; + } + } } - return error; + return; } diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 462fedfdc6d0e9320474c7489de8eca2323c3a7a..95c153fc807fd19d529eecd4aa4de64a2d4c8ed6 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -29,12 +29,13 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -// VE2AT: move to lib_rend ? + #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot.h" +#include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_stat_com.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" @@ -57,6 +58,9 @@ ivas_error ivas_ism_renderer_open( { int16_t i; uint16_t interpolator_length; +#ifdef JBM_TSM_ON_TCS + uint16_t init_interpolator_length; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -77,14 +81,34 @@ ivas_error ivas_ism_renderer_open( for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); +#ifdef JBM_TSM_ON_TCS + set_f( st_ivas->hIsmRendererData->gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); +#endif } +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active ) + { + init_interpolator_length = NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_CLDFB_TIMESLOTS * CLDFB_SLOT_NS ); + interpolator_length = (uint16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + } + else + { + init_interpolator_length = (uint16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + interpolator_length = init_interpolator_length; + } + st_ivas->hIsmRendererData->interpolator = (float *) malloc( sizeof( float ) * init_interpolator_length ); + for ( i = 0; i < interpolator_length; i++ ) + { + st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); + } +#else interpolator_length = (uint16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); for ( i = 0; i < interpolator_length; i++ ) { st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); } - +#endif return error; } @@ -96,9 +120,13 @@ ivas_error ivas_ism_renderer_open( *-------------------------------------------------------------------------*/ void ivas_ism_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef JBM_TSM_ON_TCS + float *output_f[], /* i/o: core-coder transport channels/object output */ +#else float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ - const int16_t output_frame /* i : output frame length per channel */ +#endif + const int16_t output_frame /* i : output frame length per channel */ ) { int16_t i, j, k, j2; @@ -106,11 +134,11 @@ void ivas_ism_render( float tmp_output_f[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float gains[MAX_NUM_OBJECTS][MAX_OUTPUT_CHANNELS]; float g1, g2; - int16_t num_objects, nchan_out_woLFE, lfe_index; + int16_t nchan_ism, nchan_out_woLFE, lfe_index; int16_t azimuth, elevation; float Rmat[3][3]; - num_objects = st_ivas->nchan_transport; + nchan_ism = st_ivas->nchan_ism; nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; lfe_index = 0; @@ -120,7 +148,7 @@ void ivas_ism_render( set_f( tmp_output_f[j], 0.0f, output_frame ); } - for ( i = 0; i < num_objects; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { mvr2r( output_f[i], input_f[i], output_frame ); } @@ -136,7 +164,7 @@ void ivas_ism_render( QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], Rmat ); } - for ( i = 0; i < num_objects; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { if ( st_ivas->intern_config == AUDIO_CONFIG_STEREO ) { @@ -148,7 +176,11 @@ void ivas_ism_render( else { /* Head rotation: rotate the object positions depending the head's orientation */ +#ifdef ISM_NON_DIEGETIC_PAN + if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 && !st_ivas->hIsmMetaData[i]->non_diegetic_flag ) +#else if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) +#endif { rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, Rmat, st_ivas->hIntSetup.is_planar_setup ); } @@ -186,6 +218,7 @@ void ivas_ism_render( st_ivas->hIsmRendererData->prev_gains[i][j] = gains[i][j]; } } + /* Move to output skipping LFE */ for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ ) { @@ -195,8 +228,97 @@ void ivas_ism_render( } mvr2r( tmp_output_f[j], output_f[j2], output_frame ); } + + return; +} + +#ifdef JBM_TSM_ON_TCS +void ivas_ism_render_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[], /* i/o: core-coder transport channels/object output */ + const int16_t n_samples_to_render /* i : output frame length per channel */ +) +{ + int16_t i, j, k, j2; + float *g1, g2, *tc; + int16_t num_objects, nchan_out_woLFE, lfe_index; + int16_t azimuth, elevation; + int16_t tc_offset; + int16_t interp_offset; + float Rmat[3][3]; + float gain, prev_gain; + + num_objects = st_ivas->nchan_transport; + nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; + + tc_offset = st_ivas->hTcBuffer->n_samples_rendered; + interp_offset = st_ivas->hTcBuffer->n_samples_rendered; + + for ( i = 0; i < nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ ) + { + set_f( output_f[i], 0.0f, n_samples_to_render ); + } + + if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) + { + /* Calculate rotation matrix from the quaternion */ + QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], Rmat ); + ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, + n_samples_to_render, + st_ivas->hIsmRendererData->interpolator ); + interp_offset = 0; + } + + for ( i = 0; i < num_objects; i++ ) + { + + /* Head rotation: rotate the object positions depending the head's orientation */ + if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) + { + rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, Rmat, st_ivas->hIntSetup.is_planar_setup ); + if ( st_ivas->hEFAPdata != NULL ) + { + efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], azimuth, elevation, EFAP_MODE_EFAP ); + } + } + + lfe_index = 0; + for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ ) + { + if ( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( st_ivas->hIntSetup.index_lfe[lfe_index] == j ) ) + { + ( lfe_index < ( st_ivas->hIntSetup.num_lfe - 1 ) ) ? ( lfe_index++, j2++ ) : j2++; + } + + gain = st_ivas->hIsmRendererData->gains[i][j]; + prev_gain = st_ivas->hIsmRendererData->prev_gains[i][j]; + if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f ) + { + g1 = &st_ivas->hIsmRendererData->interpolator[interp_offset]; + tc = &st_ivas->hTcBuffer->tc[i][tc_offset]; + for ( k = 0; k < n_samples_to_render; k++ ) + { + g2 = 1.0f - *g1; + output_f[j2][k] += ( *( g1++ ) * gain + g2 * prev_gain ) * *( tc++ ); + } + } + /* update here only in case of head rotation */ + if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) + { + st_ivas->hIsmRendererData->prev_gains[i][j] = gain; + } + } + } return; } +#endif + + +/*-------------------------------------------------------------------------* + * ivas_ism_get_stereo_gains() + * + * + *-------------------------------------------------------------------------*/ void ivas_ism_get_stereo_gains( const float azimuth, /* i : object azimuth */ @@ -235,4 +357,6 @@ void ivas_ism_get_stereo_gains( *left_gain = sqrtf( A3 ); *right_gain = sqrtf( 1.0f - A3 ); } + + return; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c new file mode 100644 index 0000000000000000000000000000000000000000..13a062fd9312a68e0d2b27d22c07c5a2f7a180e5 --- /dev/null +++ b/lib_dec/ivas_jbm_dec.c @@ -0,0 +1,1742 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include "cnst.h" +#include "ivas_cnst.h" +#include "rom_com.h" +#include "prot.h" +#include "ivas_prot.h" +#include "ivas_prot_rend.h" +#include "ivas_rom_com.h" +#include +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" + + +#ifdef JBM_TSM_ON_TCS + +/*-----------------------------------------------------------------------* + * Local function prototypes + *-----------------------------------------------------------------------*/ +static void ivas_jbm_dec_copy_tc( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *data, float *tc_digest_f[] ); +static void ivas_jbm_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, uint16_t *nSamplesRendered, float *output[] ); + + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_tc() + * + * Principal IVAS decoder routine, decoding of metadata and transport channels + *--------------------------------------------------------------------------*/ +ivas_error ivas_jbm_dec_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *data /* o : transport channel signal */ +) +{ + int16_t n, output_frame, nchan_out; + Decoder_State *st; /* used for bitstream handling */ + float output[MAX_TRANSPORT_CHANNELS][L_FRAME48k]; /* 'float' buffer for transport channels, MAX_TRANSPORT_CHANNELS channels */ /* IVAS_fmToDo: buffer can be allocated dynamically based on the actual number of output channels */ + int16_t nchan_remapped; + float output_lfe_ch[L_FRAME48k]; + int16_t nb_bits_metadata[MAX_SCE]; + int32_t output_Fs, ivas_total_brate; + AUDIO_CONFIG output_config; + ivas_error error; + float *p_output[MAX_TRANSPORT_CHANNELS]; + + error = IVAS_ERR_OK; + + push_wmops( "ivas_jbm_dec_tc" ); + + /*----------------------------------------------------------------* + * Initialization of local vars after struct has been set + *----------------------------------------------------------------*/ + + output_Fs = st_ivas->hDecoderConfig->output_Fs; + nchan_out = st_ivas->hTcBuffer->nchan_transport_jbm; + output_config = st_ivas->hDecoderConfig->output_config; + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + + output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); + + for ( n = 0; n < MAX_TRANSPORT_CHANNELS; n++ ) + { + p_output[n] = &output[n][0]; + } + + /*----------------------------------------------------------------* + * Decoding + Rendering + *----------------------------------------------------------------*/ + + if ( st_ivas->bfi && st_ivas->ini_frame == 0 ) + { + /* zero output when first frame(s) is lost */ + for ( n = 0; n < nchan_out; n++ ) + { + set_f( output[n], 0.0f, output_frame ); + } + +#ifdef DEBUG_MODE_INFO + create_sce_dec( st_ivas, 0, ivas_total_brate ); + output_debug_mode_info_dec( st_ivas->hSCE[0]->hCoreCoder, 1, output_frame, NULL ); + destroy_sce_dec( st_ivas->hSCE[0] ); + st_ivas->hSCE[0] = NULL; +#endif + } + else if ( st_ivas->ivas_format == STEREO_FORMAT ) + { + st_ivas->hCPE[0]->element_brate = ivas_total_brate; + + if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* HP filtering */ + for ( n = 0; n < min( nchan_out, st_ivas->nchan_transport ); n++ ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hDecoderConfig->nchan_out == 1 ) + { +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, output_frame, p_output, p_output ); +#endif + } + } + else if ( st_ivas->ivas_format == ISM_FORMAT ) + { + /* Metadata decoding and configuration */ + if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) + { + if ( ( error = ivas_ism_dtx_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + // VE: call ivas_ism_metadata_dec() with 'st_ivas' - TBD + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else /* ISM_MODE_DISC */ + { + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + for ( n = 0; n < st_ivas->nchan_transport; n++ ) + { + if ( ( error = ivas_sce_dec( st_ivas, n, &output[n], output_frame, nb_bits_metadata[n] ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* HP filtering */ + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) + { + ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + { + set_s( nb_bits_metadata, 0, MAX_SCE ); + + /* read parameters from the bitstream */ + if ( st_ivas->hQMetaData != NULL && st_ivas->sba_mode != SBA_MODE_SPAR ) + { + st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; + + if ( st_ivas->ivas_format == SBA_FORMAT ) + { + ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, +#ifdef HODIRAC + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k, +#endif + 0 ); + } + else + { + if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + if ( st_ivas->hQMetaData != NULL ) + { + st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; + ivas_dirac_dec_read_BS( + ivas_total_brate, + st, + st_ivas->hDirAC, + st_ivas->hQMetaData, + &nb_bits_metadata[0], + st_ivas->sba_mode, +#ifdef HODIRAC + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k, +#endif + st_ivas->hSpar->dirac_to_spar_md_bands ); + } + + if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( st_ivas->nchan_transport == CPE_CHANNELS && st_ivas->nCPE >= 1 ) + { + st_ivas->hCPE[0]->element_brate = ivas_total_brate; + } + + /* core-decoding of transport channels */ + if ( st_ivas->nSCE == 1 ) + { + if ( ( error = ivas_sce_dec( st_ivas, 0, &output[0], output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->nCPE == 1 ) + { + if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->nCPE > 1 ) + { + if ( ( error = ivas_mct_dec( st_ivas, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after core-decoding */ + ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[0], "core-decoding" ); +#endif + /* TCs remapping */ + nchan_remapped = st_ivas->nchan_transport; + if ( st_ivas->sba_dirac_stereo_flag ) + { + nchan_remapped = nchan_out; + + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); + + if ( st_ivas->hSpar->hPCA != NULL ) + { + ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); + } + + ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi +#ifdef SPAR_TUNING + , + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) +#endif + ); + } + + ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame, st_ivas->ivas_format == MC_FORMAT ); + } + else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( ivas_total_brate > IVAS_SID_5k2 || ( ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) + { + nchan_remapped = 1; /* Only one channel transported */ + } + + /* HP filtering */ +#ifndef DEBUG_SPAR_BYPASS_EVS_CODEC + for ( n = 0; n < nchan_remapped; n++ ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } +#endif + if ( st_ivas->ivas_format == SBA_FORMAT ) + { + nchan_remapped = ivas_sba_remapTCs( output, st_ivas, output_frame ); + + if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + { + ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); + } + else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + ivas_spar_dec_agc_pca( st_ivas, output, output_frame ); + } + } + + if ( st_ivas->ivas_format == MASA_FORMAT ) + { + ivas_masa_prerender( st_ivas, output, output_frame ); + } + else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + { + float gain = 0.8414f; /* Todo: Temporary gain for roughly matching the loudness. To be tuned later together with other outputs. */ + + for ( n = 0; n < nchan_remapped; n++ ) + { + v_multc( output[n], gain, output[n], output_frame ); + } + } + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; + + /* LFE channel decoder */ + if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + if ( st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg == NULL ) + { + st_ivas->hCPE[1]->hCoreCoder[1]->hTcxCfg = st_ivas->hCPE[1]->hCoreCoder[0]->hTcxCfg; + } + ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch ); + } + + if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + if ( ( error = ivas_mct_dec( st_ivas, output, output_frame, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + mvr2r( output_lfe_ch, output[LFE_CHANNEL], output_frame ); + + /* HP filtering */ + for ( n = 0; n < st_ivas->nchan_transport; n++ ) + { + if ( n != LFE_CHANNEL ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + } + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) + { + if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) <= ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) ) + { + ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); + } + } + if ( ( st_ivas->renderer_type == RENDERER_MC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) >= ( st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ) ) + { + if ( st_ivas->renderer_type == RENDERER_MC ) + { +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, output_frame, p_output, p_output ); +#endif + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + } + } + else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + /* read Parametric MC parameters from the bitstream */ + ivas_param_mc_dec_read_BS( ivas_total_brate, st, st_ivas->hParamMC, &nb_bits_metadata[0] ); + + if ( st_ivas->nCPE == 1 ) + { + if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->nCPE > 1 ) + { + if ( ( error = ivas_mct_dec( st_ivas, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* HP filtering */ + for ( n = 0; n < st_ivas->nchan_transport; n++ ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + + /* Rendering */ + if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) + { +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, output_frame, p_output, p_output ); +#endif + } + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + st = st_ivas->hCPE[0]->hCoreCoder[0]; /* Metadata is always with CPE in the case of separated channel */ + } + + /* read McMASA parameters from the bitstream */ + if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + /* Decode the transport audio signals */ + if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Identify the index of the separated channel, always LFE_CHANNEL-1 here */ + n = LFE_CHANNEL - 1; + + /* Decode the separated channel to output[n] to be combined with the synthesized channels */ + if ( ( error = ivas_sce_dec( st_ivas, 0, &output[n], output_frame, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */ + if ( output_config == AUDIO_CONFIG_5_1 || output_config == AUDIO_CONFIG_7_1 || + output_config == AUDIO_CONFIG_5_1_4 || output_config == AUDIO_CONFIG_7_1_4 || + output_config == AUDIO_CONFIG_5_1_2 || ( output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) + { + ivas_lfe_synth_with_filters( st_ivas->hMasa->hMasaLfeSynth, output, output_frame, n, LFE_CHANNEL ); + } + else if ( output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) + { + /* Delay the separated channel to sync with the DirAC rendering */ + delay_signal( output[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); + } + } + else + { + if ( st_ivas->nSCE == 1 ) + { + if ( ( error = ivas_sce_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->nCPE == 1 ) + { + if ( ( error = ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + if ( st_ivas->sba_dirac_stereo_flag ) /* use the flag to trigger the DFT upmix */ + { + ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame, 1 ); + } + + /* HP filtering */ + for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) + { + hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + } + + if ( st_ivas->renderer_type == RENDERER_MCMASA_MONO_STEREO ) + { + ivas_mono_stereo_downmix_mcmasa( st_ivas, output, output_frame ); + } + } + } + + + /*----------------------------------------------------------------* + * Write IVAS transport channels + *----------------------------------------------------------------*/ + + ivas_syn_output_f( p_output, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data ); + + + /*----------------------------------------------------------------* + * Common updates + *----------------------------------------------------------------*/ + + if ( !st_ivas->bfi ) /* do not update if first frame(s) are lost or NO_DATA */ + { + st_ivas->hDecoderConfig->last_ivas_total_brate = ivas_total_brate; + st_ivas->last_active_ivas_total_brate = ( ivas_total_brate <= IVAS_SID_5k2 ) ? st_ivas->last_active_ivas_total_brate : ivas_total_brate; + } + + if ( st_ivas->ini_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) ) /* keep "st_ivas->ini_frame = 0" until first good received frame */ + { + st_ivas->ini_frame++; + } + + if ( st_ivas->ini_active_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) && ivas_total_brate > IVAS_SID_5k2 ) /* needed in MASA decoder in case the first active frame is BFI, and there were SID-frames decoded before */ + { + st_ivas->ini_active_frame++; + } + +#ifdef DEBUG_MODE_INFO + dbgwrite( &st_ivas->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" ); + dbgwrite( &st_ivas->BER_detect, sizeof( int16_t ), 1, output_frame, "res/BER_detect" ); + { + float tmpF = ivas_total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, output_frame, "res/ivas_total_brate.dec" ); + } +#endif + + pop_wmops(); + return error; +} + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_feed_tc_to_renderer() + * + * Feed decoded transport channels and metadata to the IVAS renderer routine + *--------------------------------------------------------------------------*/ + +ivas_error ivas_jbm_dec_feed_tc_to_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t nSamplesForRendering, /* i: : number of TC samples available for rendering */ + int16_t *nSamplesResidual, /* o: : number of samples not fitting into the renderer grid and buffer for the next call*/ + float *data /* i : transport channels */ +) +{ + + float data_f[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k]; /* 'float' buffer for transport channels that will be directly converted with the CLDFB */ + float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS]; + int16_t n_render_timeslots; + int16_t n; + ivas_error error; + + error = IVAS_ERR_OK; + + push_wmops( "ivas_jbm_dec_feed_tc_to_rendererer" ); + + for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ ) + { + p_data_f[n] = &data_f[n][0]; + } + ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data, p_data_f ); + n_render_timeslots = st_ivas->hTcBuffer->n_samples_available / st_ivas->hTcBuffer->n_samples_granularity; + + if ( st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_BUFFER ) + { + ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); + } + else if ( st_ivas->ivas_format == STEREO_FORMAT ) + { + ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); + } + else if ( st_ivas->ivas_format == ISM_FORMAT ) + { + /* Rendering */ + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_set_md_map( st_ivas, n_render_timeslots ); + ivas_param_ism_params_to_masa_param_mapping( st_ivas ); + } + else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_param_ism_dec_digest_tc( st_ivas, n_render_timeslots, p_data_f ); + } + } + else /* ISM_MODE_DISC */ + { + ivas_ism_dec_digest_tc( st_ivas ); + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + { + ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); + } + else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + ivas_param_mc_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, p_data_f ); + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { + ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); + } + } + + pop_wmops(); + + return error; +} + + +/*--------------------------------------------------------------------------* + * ivas_dec_render() + * + * Principal IVAS rendering routine + *--------------------------------------------------------------------------*/ +ivas_error ivas_jbm_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + 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 n, nchan_out; + int16_t nchan_transport; + float output[MAX_OUTPUT_CHANNELS][L_FRAME48k]; /* 'float' buffer for output synthesis, MAX_OUTPUT_CHANNELS channels */ /* IVAS_fmToDo: buffer can be allocated dynamically based on the actual number of output channels */ + int16_t nchan_remapped; + int32_t output_Fs; + AUDIO_CONFIG output_config; + int16_t nSamplesAskedLocal; + ivas_error error; + float *p_output[MAX_OUTPUT_CHANNELS]; + float *p_tc[MAX_TRANSPORT_CHANNELS]; + + error = IVAS_ERR_OK; + + push_wmops( "ivas_dec_render" ); + + /*----------------------------------------------------------------* + * Initialization of local vars after struct has been set + *----------------------------------------------------------------*/ + + output_Fs = st_ivas->hDecoderConfig->output_Fs; + nchan_out = st_ivas->hDecoderConfig->nchan_out; + nchan_transport = st_ivas->hTcBuffer->nchan_transport_jbm; + output_config = st_ivas->hDecoderConfig->output_config; + nSamplesAskedLocal = nSamplesAsked + st_ivas->hTcBuffer->n_samples_discard; + for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) + { + p_output[n] = &output[n][0]; + } + + for ( n = 0; n < st_ivas->hTcBuffer->nchan_transport_internal; n++ ) + { + p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; + } + + /*----------------------------------------------------------------* + * Rendering + *----------------------------------------------------------------*/ + + if ( st_ivas->ivas_format == UNDEFINED_FORMAT ) + { + assert( 0 ); + } + else if ( st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_BUFFER ) + { + ivas_jbm_dec_tc_buffer_playout( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output ); + } + else if ( st_ivas->ivas_format == STEREO_FORMAT ) + { + /* Rendering */ + if ( st_ivas->renderer_type == RENDERER_MC ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, output_frame, p_output, p_output ); +#endif + } + } + else if ( st_ivas->ivas_format == ISM_FORMAT ) + { + /* Rendering */ + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, st_ivas->nchan_transport, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_param_ism_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + /* Convert CICP19 -> Ambisonics */ + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + } + } + else /* ISM_MODE_DISC */ + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + /* Loudspeaker or Ambisonics rendering */ + if ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ + ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ + ivas_ism2sba_sf( st_ivas->hTcBuffer->tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); + } + + /* Binaural rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + ObjRenderIVASSubframe( st_ivas, p_output, *nSamplesRendered ); + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, + AUDIO_CONFIG_7_1_4, + AUDIO_CONFIG_BINAURAL_ROOM, + st_ivas->hDecoderConfig, + NULL, + NULL, + NULL, + st_ivas->hTcBuffer, + p_output, + p_output, + *nSamplesRendered, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); + } +#ifdef DEBUGGING + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + ivas_binaural_cldfb_sf( st_ivas, *nSamplesRendered, p_output ); + } +#endif + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + { + nchan_remapped = nchan_transport; + /* Loudspeakers, Ambisonics or Binaural rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); + } + else if ( st_ivas->sba_mode == SBA_MODE_DIRAC || st_ivas->ivas_format == MASA_FORMAT ) + { + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + for ( n = 0; n < nchan_remapped; n++ ) + { + mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); + } + ivas_sba_linear_renderer( p_output, *nSamplesRendered, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); + } + else if ( st_ivas->renderer_type == RENDERER_DIRAC ) + { + ivas_dirac_dec_render( st_ivas, nchan_remapped, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + } + } + else /* SBA_MODE_SPAR */ + { + ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + } + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) + { + ivas_mc2sba( st_ivas->hTransSetup, p_tc, p_output, *nSamplesRendered, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); + } + + /* Rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, + st_ivas->intern_config, + st_ivas->hOutSetup.output_config, + st_ivas->hDecoderConfig, + st_ivas->hHeadTrackData, + &st_ivas->hIntSetup, + st_ivas->hEFAPdata, + st_ivas->hTcBuffer, + p_tc, + p_output, + *nSamplesRendered, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->tc, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_MC ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); +#ifdef MC_PARAMUPMIX_MODE + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc, p_output ); +#else + ivas_ls_setup_conversion( st_ivas, *nSamplesRendered, p_tc, p_output ); +#endif + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_mc2sba( st_ivas->hIntSetup, p_tc, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + ObjRenderIVASSubframe( st_ivas, p_output, *nSamplesRendered ); + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->tc, p_output ); + } + } + else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + ivas_param_mc_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { + + /* Rendering */ + int16_t offset = st_ivas->hDirAC->slots_rendered * st_ivas->hDirAC->slot_size; + nchan_remapped = st_ivas->nchan_transport; + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) /* rendering to CICPxx and Ambisonics */ + { + ivas_dirac_dec_render( st_ivas, nchan_remapped, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + /* we still need to copy the separate channel if available */ + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); + } + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + else if ( st_ivas->intern_config == AUDIO_CONFIG_5_1 && ( output_config == AUDIO_CONFIG_5_1_2 || output_config == AUDIO_CONFIG_5_1_4 || output_config == AUDIO_CONFIG_7_1 ) ) + { + for ( n = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; n < st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; n++ ) + { + set_zero( output[n], *nSamplesRendered ); + } + } + } + /* copy discrete C and TD LFE from internal TC to output */ + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + if ( output_config == AUDIO_CONFIG_5_1 || output_config == AUDIO_CONFIG_7_1 || + output_config == AUDIO_CONFIG_5_1_4 || output_config == AUDIO_CONFIG_7_1_4 || + output_config == AUDIO_CONFIG_5_1_2 || ( output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) + { + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL] + offset, output[LFE_CHANNEL], *nSamplesRendered ); + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); + } + else if ( output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) + { + /* Delay the separated channel to sync with the DirAC rendering */ + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); + } + } + } + } + + /*----------------------------------------------------------------* + * Write IVAS output channels + * - compensation for saturation + * - float to integer conversion + *----------------------------------------------------------------*/ + st_ivas->hTcBuffer->n_samples_available -= *nSamplesRendered; + st_ivas->hTcBuffer->n_samples_rendered += *nSamplesRendered; + if ( st_ivas->hTcBuffer->n_samples_discard > 0 ) + { + for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) + { + p_output[n] += st_ivas->hTcBuffer->n_samples_discard; + } + *nSamplesRendered -= st_ivas->hTcBuffer->n_samples_discard; + st_ivas->hTcBuffer->n_samples_discard = 0; + } + + ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, *nSamplesRendered, st_ivas->BER_detect ); + +#ifdef DEBUGGING + st_ivas->noClipping += +#endif + ivas_syn_output( p_output, *nSamplesRendered, nchan_out, data ); + + *nSamplesAvailableNext = st_ivas->hTcBuffer->n_samples_available; + + pop_wmops(); + return error; +} + + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_dec_flush_renderer() + * + * Flush samples if renderer granularity changes on a bitrate change + *--------------------------------------------------------------------------*/ +ivas_error ivas_jbm_dec_flush_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t tc_granularity_new, /* i : new renderer granularity */ + const RENDERER_TYPE renderer_type_old, /* i : old renderer type */ + const AUDIO_CONFIG intern_config_old, /* i : old internal config */ + const IVAS_OUTPUT_SETUP_HANDLE hIntSetupOld, /* i : old internal output setup */ + 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 : rendered samples */ +) +{ + ivas_error error; + int16_t n_samples_still_available; + int16_t n_slots_still_available; + int16_t n_samples_to_render; + DECODER_TC_BUFFER_HANDLE hTcBuffer; + float output[MAX_CICP_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + float *p_output[MAX_CICP_CHANNELS]; + + error = IVAS_ERR_OK; + + *nSamplesRendered = 0; + hTcBuffer = st_ivas->hTcBuffer; + /* get number of possible slots in new granularity */ + n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered; + n_slots_still_available = n_samples_still_available / tc_granularity_new; + *nSamplesRendered = n_slots_still_available * tc_granularity_new; + n_samples_to_render = *nSamplesRendered; + n_samples_still_available -= n_samples_to_render; + assert( n_samples_still_available < tc_granularity_new ); + if ( n_slots_still_available ) + { + int ch_idx; + /* render what is still there with zero padding */ + for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) + { + /* move it at the beginning of the TC buffer with zero padding */ + mvr2r( hTcBuffer->tc[ch_idx] + hTcBuffer->n_samples_rendered, hTcBuffer->tc[ch_idx], n_samples_to_render ); + set_zero( hTcBuffer->tc[ch_idx] + n_samples_to_render, hTcBuffer->n_samples_granularity - n_samples_to_render ); + mvr2r( hTcBuffer->tc[ch_idx] + hTcBuffer->n_samples_rendered + n_samples_to_render, hTcBuffer->tc[ch_idx] + hTcBuffer->n_samples_granularity, n_samples_still_available ); + } + /* simple change of the slot info */ + hTcBuffer->num_slots = 1; + hTcBuffer->nb_subframes = 1; + hTcBuffer->subframes_rendered = 0; + hTcBuffer->slots_rendered = 0; + hTcBuffer->subframe_nbslots[0] = 1; + hTcBuffer->n_samples_buffered = hTcBuffer->n_samples_granularity + n_samples_still_available; + hTcBuffer->n_samples_available = 0; + hTcBuffer->n_samples_flushed = n_samples_to_render; + hTcBuffer->n_samples_rendered = hTcBuffer->n_samples_granularity; + + for ( ch_idx = 0; ch_idx < MAX_CICP_CHANNELS; ch_idx++ ) + { + p_output[ch_idx] = output[ch_idx]; + } + + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + if ( ism_mode_old == ISM_MODE_DISC ) + { + /* Binaural rendering */ + if ( renderer_type_old == RENDERER_BINAURAL_OBJECTS_TD ) + { + ObjRenderIVASSubframe( st_ivas, p_output, hTcBuffer->n_samples_granularity ); + } + else if ( renderer_type_old == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ + set_f( st_ivas->hIsmRendererData->interpolator, 1.0f, hTcBuffer->n_samples_granularity ); + ivas_ism_render_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ); + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, + AUDIO_CONFIG_7_1_4, + AUDIO_CONFIG_BINAURAL_ROOM, + st_ivas->hDecoderConfig, + NULL, + NULL, + NULL, + st_ivas->hTcBuffer, + p_output, + p_output, + hTcBuffer->n_samples_granularity, + st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + ivas_binaural_add_LFE( st_ivas, hTcBuffer->n_samples_granularity, p_output, p_output ); + } + } + else + { + return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Wrong ISM_MODE in VoIP renderer flushing!" ); + } + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + if ( mc_mode_old == MC_MODE_MCT ) + { + if ( renderer_type_old == RENDERER_BINAURAL_MIXER_CONV || renderer_type_old == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, + intern_config_old, + st_ivas->hOutSetup.output_config, + st_ivas->hDecoderConfig, + st_ivas->hHeadTrackData, + hIntSetupOld, + st_ivas->hEFAPdata, + st_ivas->hTcBuffer, + hTcBuffer->tc, + p_output, + hTcBuffer->n_samples_granularity, + st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + ivas_binaural_add_LFE( st_ivas, hTcBuffer->n_samples_granularity, st_ivas->hTcBuffer->tc, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + ObjRenderIVASSubframe( st_ivas, p_output, hTcBuffer->n_samples_granularity ); + ivas_binaural_add_LFE( st_ivas, hTcBuffer->n_samples_granularity, st_ivas->hTcBuffer->tc, p_output ); + } + } + else + { + return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Wrong MC_MODE in VoIP renderer flushing!" ); + } + } + else + { + return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Wrong IVAS format in VoIP renderer flushing!" ); + } + } + + /* Only write out the valid data*/ + ivas_limiter_dec( st_ivas->hLimiter, p_output, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, st_ivas->BER_detect ); + +#ifdef DEBUGGING + st_ivas->noClipping += +#endif + ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, data ); + + + return error; +} + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_set_discard_samples() + * + * Set number of samples to discard in the first subframe if the renderer granularity changes on a bitrate change + *--------------------------------------------------------------------------*/ +ivas_error ivas_jbm_dec_set_discard_samples( + Decoder_Struct *st_ivas /* i/o: main IVAS decoder structre */ +) +{ + int16_t nMaxSlotsPerSubframe, nSlotsInFirstSubframe; + ivas_error error; + + error = IVAS_ERR_OK; + + /* render first frame with front zero padding and discarding those samples */ + nMaxSlotsPerSubframe = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / st_ivas->hTcBuffer->n_samples_granularity; + nSlotsInFirstSubframe = nMaxSlotsPerSubframe - st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; + if ( nSlotsInFirstSubframe > 0 ) + { + st_ivas->hTcBuffer->n_samples_discard = ( nMaxSlotsPerSubframe - nSlotsInFirstSubframe ) * st_ivas->hTcBuffer->n_samples_granularity; + /* set last subframes number to max to ensure correct continuation */ + st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1] = nMaxSlotsPerSubframe; + } + return error; +} + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_get_adapted_linear_interpolator() + * + * Get an interpolator that is adapted to time scale modified IVAS frame + *--------------------------------------------------------------------------*/ + +void ivas_jbm_dec_get_adapted_linear_interpolator( + const int16_t default_interp_length, /* i : default length of the (full-frame) interpolator */ + const int16_t interp_length, /* i : length of the interpolator to be created */ + float *interpolator /* o : the interpolator */ +) +{ + int16_t jbm_segment_len, idx; + float dec; +#ifdef DEBUGGING + assert( default_interp_length % 2 == 0 ); +#endif + + jbm_segment_len = ( default_interp_length >> 1 ); + dec = 1.0f / default_interp_length; + + interpolator[interp_length - 1] = 1.0f; + for ( idx = interp_length - 2; idx >= jbm_segment_len; idx-- ) + { + interpolator[idx] = max( 0.0f, interpolator[idx + 1] - dec ); + } + if ( interpolator[idx + 1] > 0.0f ) + { + dec = interpolator[idx + 1] / ( jbm_segment_len + 1 ); + for ( ; idx >= 0; idx-- ) + { + interpolator[idx] = interpolator[idx + 1] - dec; + } + } + else + { + set_f( interpolator, 0.0f, idx + 1 ); + } +} + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_get_adapted_subframes() + * + * Get an interpolator that is adapted to time scale modified IVAS frame + *--------------------------------------------------------------------------*/ +void ivas_jbm_dec_get_adapted_subframes( + const int16_t nCldfbTs, /* i : number of time slots in the current frame */ + int16_t *subframe_nbslots, /* i/o: subframe grid */ + int16_t *nb_subframes /* i/o: number of subframes in the frame */ +) +{ + uint16_t nSlotsInLastSubframe, nSlotsInFirstSubframe; + uint16_t nCldfbSlotsLocal = nCldfbTs; + /* get last subframe size from previous frame, determine how many slots have to be processed + in the first subframe (i.e. potential leftover of a 5ms subframe) */ + nSlotsInFirstSubframe = ( PARAM_MC_MAX_NSLOTS_IN_SUBFRAME - subframe_nbslots[*nb_subframes - 1] ); + *nb_subframes = 0; + if ( nSlotsInFirstSubframe > 0 ) + { + *nb_subframes = 1; + nCldfbSlotsLocal -= nSlotsInFirstSubframe; + } + *nb_subframes += (int16_t) ceilf( (float) nCldfbSlotsLocal / (float) PARAM_MC_MAX_NSLOTS_IN_SUBFRAME ); + nSlotsInLastSubframe = nCldfbSlotsLocal % PARAM_MC_MAX_NSLOTS_IN_SUBFRAME; + set_s( subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, *nb_subframes ); + if ( nSlotsInFirstSubframe > 0 ) + { + subframe_nbslots[0] = nSlotsInFirstSubframe; + } + if ( nSlotsInLastSubframe > 0 ) + { + subframe_nbslots[*nb_subframes - 1] = nSlotsInLastSubframe; + } + return; +} + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_get_adapted_linear_interpolator() + * + * Get an meta data map adapted to a time scale modified IVAS frame + *--------------------------------------------------------------------------*/ +void ivas_jbm_dec_get_md_map( + const int16_t default_len, /* i : default frame length in metadata slots */ + const int16_t len, /* i : length of the modfied frames in metadata slots */ + const int16_t subframe_len, /* i : default length of a subframe */ + const int16_t offset, /* i : current read offset into the md buffer */ + const int16_t buf_len, /* i : length of the metadata buffer */ + int16_t *map /* o : metadata index map */ +) +{ + int16_t jbm_segment_len, map_idx, src_idx, src_idx_map; + float dec, src_idx_f; +#ifdef DEBUGGING + assert( default_len % 2 == 0 ); +#endif + + jbm_segment_len = ( default_len >> 1 ); + dec = 1.0f / default_len; + + + for ( map_idx = len - 1, src_idx = default_len - 1; map_idx >= jbm_segment_len; map_idx--, src_idx-- ) + { + src_idx_map = max( 0, src_idx / subframe_len ); + map[map_idx] = ( offset + src_idx_map ) % buf_len; + } + /* changed part (first segment), interpolate index to parameters + (we do not want to interpolate and smooth acutal direction/diffuseness values even more) */ + if ( src_idx >= 0 ) + { + dec = ( (float) ( src_idx + 1 ) ) / ( (float) jbm_segment_len ); + src_idx_f = (float) ( src_idx + 1 ) - dec; + for ( ; map_idx >= 0; map_idx-- ) + { + src_idx = max( 0, ( (int16_t) round_f( src_idx_f ) ) / subframe_len ); + map[map_idx] = ( offset + src_idx ) % buf_len; + src_idx_f -= dec; + } + } + else + { + set_s( map, offset, map_idx + 1 ); + } +} + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_get_num_tc_channels() + * + * Get the number of transport channels provided by the JBM transport channel decode function + *--------------------------------------------------------------------------*/ +int16_t ivas_jbm_dec_get_num_tc_channels( Decoder_Struct *st_ivas ) /* i : IVAS decoder handle */ +{ + int16_t num_tc; + int32_t ivas_total_brate; + AUDIO_CONFIG output_config; + + if ( st_ivas->renderer_type == RENDERER_DISABLE ) + { + num_tc = st_ivas->hDecoderConfig->nchan_out; + } + else + { + num_tc = st_ivas->nchan_transport; + } + output_config = st_ivas->hDecoderConfig->output_config; + + ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; + if ( st_ivas->ivas_format == STEREO_FORMAT && st_ivas->hDecoderConfig->nchan_out == 1 ) + { + num_tc = 1; + } + else if ( st_ivas->ivas_format == ISM_FORMAT ) + { + if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) + { + num_tc = 1; + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + { + if ( st_ivas->sba_dirac_stereo_flag ) + { + num_tc = CPE_CHANNELS; + } + else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( ivas_total_brate > IVAS_SID_5k2 || ( ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) + { + num_tc = 1; /* Only one channel transported */ + } + + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL && st_ivas->nchan_transport == 2 && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) + { + num_tc = CPE_CHANNELS; + } + if ( st_ivas->ivas_format == SBA_FORMAT ) + { + if ( ( st_ivas->sba_mode != SBA_MODE_SPAR && st_ivas->sba_planar && num_tc >= 3 ) || + ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && num_tc == 3 ) ) + { + num_tc++; + } + } + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) + { + num_tc = 1; + } + else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) + { + num_tc = 2; + } + else if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + /* do all static dmx already in the TC decoder if less channels than transported... */ + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) + { + if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) > ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) ) + { + num_tc = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; + } + } + else if ( ( st_ivas->renderer_type == RENDERER_MC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) >= ( st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ) ) + { + num_tc = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + num_tc++; + } + if ( st_ivas->hOutSetup.separateChannelEnabled && ( output_config == AUDIO_CONFIG_5_1 || output_config == AUDIO_CONFIG_7_1 || + output_config == AUDIO_CONFIG_5_1_4 || output_config == AUDIO_CONFIG_7_1_4 || + output_config == AUDIO_CONFIG_5_1_2 || ( output_config == AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) ) + { + /* LFE is synthesized in TD with the TCs*/ + num_tc++; + } + } + } + + return num_tc; +} + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_copy_tc() + * + * Copy interleaved transport chnannels to the correct buffers, update the TC + * buffer handle + *--------------------------------------------------------------------------*/ +void ivas_jbm_dec_copy_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t nSamplesForRendering, /* i : number of samples to digest */ + int16_t *nSamplesResidual, /* o : number of samples that will be left for the next frame */ + float *data, /* i : (interleaved) transport channel samples */ + float *tc_digest_f[] /* o : samples that will be directly digestest (eg. by CLDFB) */ +) +{ + int16_t ch; + DECODER_TC_BUFFER_HANDLE hTcBuffer; + int16_t n_samples_still_available, m; + int16_t n_ch_full_copy; + int16_t n_ch_res_copy; + + + hTcBuffer = st_ivas->hTcBuffer; + n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered; + hTcBuffer->n_samples_buffered = n_samples_still_available + nSamplesForRendering + hTcBuffer->n_samples_discard; + hTcBuffer->n_samples_available = hTcBuffer->n_samples_granularity * ( hTcBuffer->n_samples_buffered / hTcBuffer->n_samples_granularity ); + *nSamplesResidual = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_available; + n_ch_full_copy = min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); + n_ch_res_copy = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; + + for ( ch = 0; ch < n_ch_full_copy; ch++ ) + { + set_zero( hTcBuffer->tc[ch], hTcBuffer->n_samples_discard ); + mvr2r( hTcBuffer->tc[ch] + hTcBuffer->n_samples_rendered, hTcBuffer->tc[ch] + hTcBuffer->n_samples_discard, n_samples_still_available ); + for ( m = 0; m < nSamplesForRendering; m++ ) + { + hTcBuffer->tc[ch][n_samples_still_available + hTcBuffer->n_samples_discard + m] = data[m * st_ivas->hTcBuffer->nchan_transport_jbm + ch]; + } + } + if ( n_ch_res_copy > 0 ) + { + for ( ; ch < hTcBuffer->nchan_transport_jbm; ch++ ) + { + mvr2r( hTcBuffer->tc[ch], tc_digest_f[ch], n_samples_still_available ); + for ( m = 0; m < nSamplesForRendering; m++ ) + { + tc_digest_f[ch][n_samples_still_available + m] = data[m * st_ivas->hTcBuffer->nchan_transport_jbm + ch]; + } + mvr2r( tc_digest_f[ch] + hTcBuffer->n_samples_available, hTcBuffer->tc[ch], *nSamplesResidual ); + } + } + hTcBuffer->n_samples_rendered = 0; + return; +} + + +int16_t ivas_jbm_dec_get_render_granularity( const RENDERER_TYPE rendererType, + const int32_t output_Fs ) +{ + int16_t render_granularity; + + if ( rendererType == RENDERER_BINAURAL_OBJECTS_TD || rendererType == RENDERER_BINAURAL_MIXER_CONV || rendererType == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + render_granularity = NS2SA( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + } + else + { + render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); + } + + return render_granularity; +} + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_tc_buffer_open() + * + * open and initialize the transport channel buffer + *--------------------------------------------------------------------------*/ +ivas_error ivas_jbm_dec_tc_buffer_open( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const TC_BUFFER_MODE tc_buffer_mode, /* i : buffer mode */ + const int16_t nchan_transport_jbm, /* i : number of real transport channels */ + const int16_t nchan_transport_internal, /* i : number of totally buffered channels */ + const int16_t nchan_full, /* i : nubmer of channels to fully store */ + const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ +) +{ + int16_t nsamp_to_allocate; + DECODER_TC_BUFFER_HANDLE hTcBuffer; + ivas_error error; + int16_t nMaxSlotsPerSubframe; + int16_t nchan_residual; + int16_t ch_idx; + + error = IVAS_ERR_OK; + + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hTcBuffer = (DECODER_TC_BUFFER_HANDLE) malloc( sizeof( DECODER_TC_BUFFER ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TC Buffer\n" ) ); + } + hTcBuffer->tc_buffer_mode = tc_buffer_mode; + hTcBuffer->nchan_transport_jbm = nchan_transport_jbm; + hTcBuffer->nchan_transport_internal = nchan_transport_internal; + hTcBuffer->nchan_buffer_full = nchan_full; + nchan_residual = nchan_transport_internal - nchan_full; + hTcBuffer->n_samples_granularity = n_samples_granularity; + hTcBuffer->n_samples_available = 0; + hTcBuffer->n_samples_buffered = 0; + hTcBuffer->n_samples_rendered = 0; + hTcBuffer->slots_rendered = 0; + hTcBuffer->subframes_rendered = 0; + hTcBuffer->n_samples_discard = 0; + hTcBuffer->n_samples_flushed = 0; + hTcBuffer->nb_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + nsamp_to_allocate = 0; + nMaxSlotsPerSubframe = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / hTcBuffer->n_samples_granularity; + hTcBuffer->num_slots = nMaxSlotsPerSubframe * MAX_PARAM_SPATIAL_SUBFRAMES; + set_s( hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, MAX_PARAM_SPATIAL_SUBFRAMES ); + + if ( hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_NONE ) + { + hTcBuffer->tc_buffer = NULL; + for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = NULL; + } + } + else + { + int16_t n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); + int16_t n_samp_residual = hTcBuffer->n_samples_granularity - 1; + int32_t offset; + nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; + nsamp_to_allocate += nchan_residual * n_samp_residual; + hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ); + set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); + offset = 0; + for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + offset += n_samp_full; + } + for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + offset += n_samp_residual; + } + for ( ; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = NULL; + } + } + + st_ivas->hTcBuffer = hTcBuffer; + return error; +} + +/*--------------------------------------------------------------------------* + * ivas_jbm_dec_tc_buffer_reconfigure() + * + * open and initialize the transport channel buffer + *--------------------------------------------------------------------------*/ +ivas_error ivas_jbm_dec_tc_buffer_reconfigure( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const TC_BUFFER_MODE tc_buffer_mode, /* i : new buffer mode */ + const int16_t nchan_transport_jbm, /* i : new number of real transport channels */ + const int16_t nchan_transport_internal, /* i : new number of totally buffered channels */ + const int16_t nchan_full, /* i : new number of channels to fully store */ + const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ +) +{ + ivas_error error; + int16_t nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual; + int16_t ch_idx; + DECODER_TC_BUFFER_HANDLE hTcBuffer; + + error = IVAS_ERR_OK; + + hTcBuffer = st_ivas->hTcBuffer; + + /* if granularity changes, adapt subframe_nb_slots */ + if ( n_samples_granularity != hTcBuffer->n_samples_granularity ) + { +#ifdef DEBUGGING + int16_t nMaxSlotsPerSubframeOld; +#endif + int16_t nMaxSlotsPerSubframeNew; + + nMaxSlotsPerSubframeNew = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / n_samples_granularity; +#ifdef DEBUGGING + nMaxSlotsPerSubframeOld = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / st_ivas->hTcBuffer->n_samples_granularity; + assert( hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered - 1] == nMaxSlotsPerSubframeOld ); + if ( n_samples_granularity < hTcBuffer->n_samples_granularity ) + { + assert( ( hTcBuffer->n_samples_granularity % n_samples_granularity ) == 0 ); + } + else + { + assert( ( n_samples_granularity % hTcBuffer->n_samples_granularity ) == 0 ); + } +#endif + /* if samples were flushed, take that into account here */ + if ( n_samples_granularity < hTcBuffer->n_samples_granularity && hTcBuffer->n_samples_flushed > 0 ) + { + hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered - 1] = hTcBuffer->n_samples_flushed / n_samples_granularity; + hTcBuffer->n_samples_flushed = 0; + } + else + { + hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered - 1] = nMaxSlotsPerSubframeNew; + } + } + + hTcBuffer->tc_buffer_mode = tc_buffer_mode; + hTcBuffer->nchan_transport_jbm = nchan_transport_jbm; + hTcBuffer->nchan_transport_internal = nchan_transport_internal; + hTcBuffer->nchan_buffer_full = nchan_full; + nchan_residual = nchan_transport_internal - nchan_full; + hTcBuffer->n_samples_granularity = n_samples_granularity; + /* what is remaining from last frames needs always be smaller than n_samples_granularity */ + assert( ( hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered ) < n_samples_granularity ); + + /* realloc buffers */ + free( hTcBuffer->tc_buffer ); + n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); + n_samp_residual = hTcBuffer->n_samples_granularity - 1; + nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; + nsamp_to_allocate += nchan_residual * n_samp_residual; + hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ); + set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); + offset = 0; + for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + offset += n_samp_full; + } + for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + offset += n_samp_residual; + } + for ( ; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++ ) + { + hTcBuffer->tc[ch_idx] = NULL; + } + + return error; +} + +void ivas_jbm_dec_tc_buffer_playout( + Decoder_Struct *st_ivas, + const uint16_t nSamplesAsked, + uint16_t *nSamplesRendered, + float *output[] ) +{ + + int16_t ch_idx, slot_size, slots_to_render, first_sf, last_sf; + + slot_size = st_ivas->hTcBuffer->n_samples_granularity; + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, nSamplesAsked / slot_size ); + st_ivas->hTcBuffer->slots_rendered += slots_to_render; + *nSamplesRendered = (uint16_t) slots_to_render * slot_size; + first_sf = st_ivas->hTcBuffer->subframes_rendered; + last_sf = first_sf; + while ( slots_to_render > 0 ) + { + slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf]; + last_sf++; + } + for ( ch_idx = 0; ch_idx < st_ivas->hTcBuffer->nchan_transport_jbm; ch_idx++ ) + { + mvr2r( st_ivas->hTcBuffer->tc[ch_idx] + st_ivas->hTcBuffer->n_samples_rendered, output[ch_idx], *nSamplesRendered ); + } + + st_ivas->hTcBuffer->subframes_rendered = last_sf; +} + +void ivas_jbm_dec_tc_buffer_close( + DECODER_TC_BUFFER_HANDLE *phTcBuffer /* i/o: TC buffer handle */ +) +{ + int16_t i; + + if ( *phTcBuffer != NULL ) + { + for ( i = 0; i < MAX_TRANSPORT_CHANNELS; i++ ) + { + ( *phTcBuffer )->tc[i] = NULL; + } + if ( ( *phTcBuffer )->tc_buffer != NULL ) + { + free( ( *phTcBuffer )->tc_buffer ); + ( *phTcBuffer )->tc_buffer = NULL; + } + + free( *phTcBuffer ); + *phTcBuffer = NULL; + } + return; +} + +void ivas_jbm_dec_td_renderers_adapt_subframes( + Decoder_Struct *st_ivas ) +{ + int16_t nMaxSlotsPerSubframe, nSlotsAvailable; + uint16_t nSlotsInLastSubframe, nSlotsInFirstSubframe; + nMaxSlotsPerSubframe = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / st_ivas->hTcBuffer->n_samples_granularity; + nSlotsAvailable = st_ivas->hTcBuffer->n_samples_available / st_ivas->hTcBuffer->n_samples_granularity; + st_ivas->hTcBuffer->num_slots = nSlotsAvailable; + st_ivas->hTcBuffer->n_samples_available = nSlotsAvailable * st_ivas->hTcBuffer->n_samples_granularity; + nSlotsInFirstSubframe = nMaxSlotsPerSubframe - st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; + st_ivas->hTcBuffer->nb_subframes = 0; + if ( nSlotsInFirstSubframe > 0 ) + { + st_ivas->hTcBuffer->nb_subframes = 1; + nSlotsAvailable -= nSlotsInFirstSubframe; + } + st_ivas->hTcBuffer->nb_subframes += (int16_t) ceilf( (float) nSlotsAvailable / (float) nMaxSlotsPerSubframe ); + nSlotsInLastSubframe = nSlotsAvailable % nMaxSlotsPerSubframe; + set_s( st_ivas->hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( st_ivas->hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, st_ivas->hTcBuffer->nb_subframes ); + if ( nSlotsInFirstSubframe > 0 ) + { + st_ivas->hTcBuffer->subframe_nbslots[0] = nSlotsInFirstSubframe; + } + if ( nSlotsInLastSubframe > 0 ) + { + st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1] = nSlotsInLastSubframe; + } + st_ivas->hTcBuffer->slots_rendered = 0; + st_ivas->hTcBuffer->subframes_rendered = 0; +} + +TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( Decoder_Struct *st_ivas ) +{ + TC_BUFFER_MODE buffer_mode; + buffer_mode = TC_BUFFER_MODE_BUFFER; + + /*:TODO: wrap this maybe nicer without directly accessing the st_ivas struct...*/ + switch ( st_ivas->renderer_type ) + { + /* all renderers where we are done after TC decoding (might include DMX to mono/stereo */ + case RENDERER_DISABLE: + case RENDERER_MCMASA_MONO_STEREO: + case RENDERER_MONO_DOWNMIX: + buffer_mode = TC_BUFFER_MODE_BUFFER; + break; + case RENDERER_TD_PANNING: + case RENDERER_BINAURAL_OBJECTS_TD: + case RENDERER_BINAURAL_FASTCONV: + case RENDERER_BINAURAL_FASTCONV_ROOM: + case RENDERER_BINAURAL_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC_ROOM: + case RENDERER_STEREO_PARAMETRIC: + case RENDERER_DIRAC: + case RENDERER_PARAM_ISM: + case RENDERER_BINAURAL_MIXER_CONV: + case RENDERER_BINAURAL_MIXER_CONV_ROOM: + buffer_mode = TC_BUFFER_MODE_RENDERER; + break; + case RENDERER_MC_PARAMMC: + if ( st_ivas->hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + buffer_mode = TC_BUFFER_MODE_BUFFER; /* TCs are already the DMX to mono or stereo */ + } + else + { + buffer_mode = TC_BUFFER_MODE_RENDERER; + } + break; + case RENDERER_MC: + if ( ivas_jbm_dec_get_num_tc_channels( st_ivas ) != st_ivas->hDecoderConfig->nchan_out ) + { + buffer_mode = TC_BUFFER_MODE_RENDERER; + } + break; + case RENDERER_SBA_LINEAR_ENC: + if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT && ( st_ivas->renderer_type == RENDERER_MC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) && ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) >= ( st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ) ) + { + buffer_mode = TC_BUFFER_MODE_BUFFER; + } + else + { + buffer_mode = TC_BUFFER_MODE_RENDERER; + } + break; + case RENDERER_SBA_LINEAR_DEC: + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) + { + buffer_mode = TC_BUFFER_MODE_BUFFER; + } + else + { + buffer_mode = TC_BUFFER_MODE_RENDERER; + } + break; +#ifdef DEBUGGING + default: + assert( 0 ); +#endif + } + + + return buffer_mode; +} +#endif diff --git a/lib_dec/ivas_lfe_dec.c b/lib_dec/ivas_lfe_dec.c index 1487a279718daee3f640816a2256d1e1a0109a0a..5c250286eedfd2291b691c92b3587f71ea484674 100644 --- a/lib_dec/ivas_lfe_dec.c +++ b/lib_dec/ivas_lfe_dec.c @@ -437,11 +437,7 @@ ivas_error ivas_create_lfe_dec( lfe_addl_delay_s = block_offset_s - hLFE->lfe_block_delay_s; lfe_addl_delay_s = max( 0.0f, lfe_addl_delay_s ); -#ifdef FIX_FIX_I59 add_delay_sa = (int16_t) roundf( (float) binauralization_delay_ns * output_Fs / 1000000000.f ); -#else - add_delay_sa = NS2SA( output_Fs, binauralization_delay_ns + 0.5f ); -#endif hLFE->lfe_addl_delay = (int16_t) ( lfe_addl_delay_s * output_Fs ) + add_delay_sa; hLFE->lfe_block_delay_s += lfe_addl_delay_s + add_delay_sa / output_Fs; @@ -481,19 +477,25 @@ ivas_error ivas_create_lfe_dec( *-------------------------------------------------------------------------*/ void ivas_lfe_dec_close( - LFE_DEC_HANDLE hLFE /* i/o: LFE decoder handle */ + LFE_DEC_HANDLE *hLFE /* i/o: LFE decoder handle */ ) { - free( hLFE->pWindow_state ); - hLFE->pWindow_state = NULL; + if ( hLFE == NULL || *hLFE == NULL ) + { + return; + } - if ( hLFE->lfe_delay_buf != NULL ) + free( ( *hLFE )->pWindow_state ); + ( *hLFE )->pWindow_state = NULL; + + if ( ( *hLFE )->lfe_delay_buf != NULL ) { - free( hLFE->lfe_delay_buf ); - hLFE->lfe_delay_buf = NULL; + free( ( *hLFE )->lfe_delay_buf ); + ( *hLFE )->lfe_delay_buf = NULL; } - free( hLFE ); + free( ( *hLFE ) ); + ( *hLFE ) = NULL; return; } diff --git a/lib_rend/ivas_ls_custom_dec.c b/lib_dec/ivas_ls_custom_dec.c similarity index 99% rename from lib_rend/ivas_ls_custom_dec.c rename to lib_dec/ivas_ls_custom_dec.c index 0e3a4d980120b7629efdf38d71d6fd14642ffb29..ef3698ab8c87c4929ffe12a01e4f29eedaafff23 100644 --- a/lib_rend/ivas_ls_custom_dec.c +++ b/lib_dec/ivas_ls_custom_dec.c @@ -29,7 +29,6 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ - #include #include "options.h" #include "ivas_prot.h" diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 18d42cb91073dbf59b862dd2f1e92aa54c2bb00a..e69cedc6a2f2e5ff24a6631f7297b20d50720d8a 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -47,22 +47,25 @@ /*-----------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------*/ -#define SPAR_META_DELAY_SUBFRAMES 2 /* Number of subframes to delay the SPAR metadata */ +#define SPAR_META_DELAY_SUBFRAMES 2 /* Number of subframes to delay the SPAR metadata */ +#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ - +#ifndef HR_METADATA static int16_t quantize_theta( float x, int16_t no_cb, float *xhat ); static uint16_t index_theta_phi_16( float theta, float phi, SPHERICAL_GRID_DATA *Sph_Grid16 ); static int16_t quantize_phi_masa( float phi, int16_t flag_delta, float *phi_hat, const int16_t n ); +#endif static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ); +static void create_masa_ext_out_meta( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, const int16_t nchan_transport ); static void replicate_subframes( IVAS_QMETADATA_HANDLE hQMetaData ); static void restore_lowbitrate_masa( IVAS_QMETADATA_HANDLE hQMetaData, const int16_t low_bitrate_mode, const int16_t numCodingBands ); -static void init_lfe_synth_data( Decoder_Struct *st_ivas, MASA_DECODER_HANDLE hMasa ); +static ivas_error init_lfe_synth_data( Decoder_Struct *st_ivas, MASA_DECODER_HANDLE hMasa ); static void compute_foa_cov_matrix( float foaCov[FOA_CHANNELS][FOA_CHANNELS], float inCov[FOA_CHANNELS][FOA_CHANNELS], float mixMtx[FOA_CHANNELS][FOA_CHANNELS] ); @@ -169,7 +172,6 @@ ivas_error ivas_masa_decode( return error; } - /* If we are under metadata bit budget limit and joined subframes is not signalled, then read LBR mode. */ if ( hMasa->config.max_metadata_bits < MINIMUM_BIT_BUDGET_NORMAL_META && hMasa->config.joinedSubframes == FALSE ) { @@ -190,9 +192,30 @@ ivas_error ivas_masa_decode( /* Remove already read bits from the bit budget */ hQMetaData->metadata_max_bits -= *nb_bits_read; - - *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos ); - +#ifdef HR_METADATA + if ( ivas_total_brate >= IVAS_384k ) + { + if ( ivas_total_brate >= IVAS_512k ) + { + *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 16, 4 ); + } + else + { + *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 11, 3 ); + } + } + else + { +#endif + *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos +#ifdef HODIRAC + , + 0 +#endif + ); +#ifdef HR_METADATA + } +#endif /* Get direction decoding quality. EC 1 and 2 are handled by the default value. */ if ( hQMetaData->ec_flag == 2 ) { @@ -236,7 +259,6 @@ ivas_error ivas_masa_decode( return error; } - hQMetaData->numTwoDirBands = hMasa->config.numTwoDirBands; hQMetaData->useLowerRes = 0; @@ -254,8 +276,7 @@ ivas_error ivas_masa_decode( } tmp_elem_mode = -1; - *nb_bits_read += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), st_ivas->nchan_transport, &tmp_elem_mode, ivas_format, - SBA_MODE_NONE ); + *nb_bits_read += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), st_ivas->nchan_transport, &tmp_elem_mode, ivas_format, SBA_MODE_NONE ); if ( st_ivas->nchan_transport == 2 ) { @@ -277,7 +298,13 @@ ivas_error ivas_masa_decode( if ( st_ivas->hDirAC != NULL ) { ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, - SBA_MODE_NONE, 0 ); + SBA_MODE_NONE +#ifdef HODIRAC + , + 0 +#endif + , + 0 ); } st->next_bit_pos = next_bit_pos_orig; @@ -306,6 +333,11 @@ ivas_error ivas_masa_decode( } } + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + create_masa_ext_out_meta( hMasa, hQMetaData, st_ivas->nchan_transport ); + } + return error /* *nb_bits_read*/; } @@ -321,6 +353,9 @@ ivas_error ivas_masa_dec_open( ) { MASA_DECODER_HANDLE hMasa; + ivas_error error; + + error = IVAS_ERR_OK; if ( ( hMasa = (MASA_DECODER_HANDLE) malloc( sizeof( MASA_DECODER ) ) ) == NULL ) { @@ -337,17 +372,26 @@ ivas_error ivas_masa_dec_open( /* Create spherical grid only for external output */ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { - hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ); + if ( ( hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } + generate_gridEq( hMasa->data.sph_grid16 ); + if ( ( hMasa->data.extOutMeta = (MASA_DECODER_EXT_OUT_META *) malloc( sizeof( MASA_DECODER_EXT_OUT_META ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } } else { hMasa->data.sph_grid16 = NULL; + hMasa->data.extOutMeta = NULL; } if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { - init_lfe_synth_data( st_ivas, hMasa ); + error = init_lfe_synth_data( st_ivas, hMasa ); } else { @@ -356,7 +400,26 @@ ivas_error ivas_masa_dec_open( st_ivas->hMasa = hMasa; - return IVAS_ERR_OK; +#ifdef JBM_TSM_ON_TCS + /* allocate transport channels*/ + if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + int16_t nchan_to_allocate; + TC_BUFFER_MODE buffer_mode; + buffer_mode = TC_BUFFER_MODE_RENDERER; + if ( st_ivas->mc_mode == MC_MODE_MCMASA && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) ) + { + buffer_mode = TC_BUFFER_MODE_BUFFER; + } + nchan_to_allocate = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif /* JBM_TMS_ON_TCS*/ + + return error; } @@ -367,9 +430,18 @@ ivas_error ivas_masa_dec_open( *-----------------------------------------------------------------------*/ void ivas_masa_dec_close( - MASA_DECODER_HANDLE hMasa /* i/o: MASA metadata structure */ + MASA_DECODER_HANDLE *hMasa_out /* i/o: MASA metadata structure */ ) { + MASA_DECODER_HANDLE hMasa; + + if ( hMasa_out == NULL || *hMasa_out == NULL ) + { + return; + } + + hMasa = *hMasa_out; + /* Free spherical grid memory if in use */ if ( hMasa->data.sph_grid16 != NULL ) { @@ -377,6 +449,12 @@ void ivas_masa_dec_close( hMasa->data.sph_grid16 = NULL; } + if ( hMasa->data.extOutMeta != NULL ) + { + free( hMasa->data.extOutMeta ); + hMasa->data.extOutMeta = NULL; + } + if ( hMasa->hMasaLfeSynth != NULL ) { if ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer != NULL ) @@ -403,8 +481,8 @@ void ivas_masa_dec_close( hMasa->hMasaLfeSynth = NULL; } - free( hMasa ); - hMasa = NULL; + free( *hMasa_out ); + *hMasa_out = NULL; return; } @@ -425,12 +503,24 @@ static ivas_error ivas_masa_dec_config( ivas_error error; error = IVAS_ERR_OK; - hMasa = st_ivas->hMasa; ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); + +#ifdef HR_METADATA + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_512k ) + { + hMasa->config.mergeRatiosOverSubframes = 0; + /* initialize spherical grid */ + if ( hMasa->data.sph_grid16 == NULL ) + { + hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ); + generate_gridEq( hMasa->data.sph_grid16 ); + } + } +#endif st_ivas->hQMetaData->metadata_max_bits = hMasa->config.max_metadata_bits; st_ivas->hQMetaData->bandMap = hMasa->data.band_mapping; st_ivas->hQMetaData->nchan_transport = st_ivas->nchan_transport; @@ -440,7 +530,6 @@ static ivas_error ivas_masa_dec_config( return error; } - st_ivas->hQMetaData->numTwoDirBands = st_ivas->hMasa->config.numTwoDirBands; st_ivas->hQMetaData->useLowerRes = 0; @@ -461,7 +550,15 @@ static ivas_error ivas_masa_dec_config( ivas_set_qmetadata_maxbit_req( st_ivas->hQMetaData, st_ivas->ivas_format ); - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs ); + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + /* need to apply the sampling rate correction also for the EXT output MASA meta buffer */ + masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, hMasa->data.extOutMeta ); + } + else + { + masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, NULL ); + } return error; } @@ -501,7 +598,7 @@ void ivas_masa_prerender( /*-------------------------------------------------------------------* * Local functions *-------------------------------------------------------------------*/ - +#ifndef HR_METADATA /* !r: index of quantized value */ static int16_t quantize_theta( float x, /* i : theta value to be quantized */ @@ -670,7 +767,7 @@ static uint16_t index_theta_phi_16( return idx_sph; } - +#endif static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, @@ -685,8 +782,8 @@ static void index_16bits( { for ( block = 0; block < hQMetaData->q_direction[0].cfg.nblocks; block++ ) { - hQMetaData->q_direction[d].band_data[band].spherical_index[block] = index_theta_phi_16( hQMetaData->q_direction[d].band_data[band].elevation[block], - hQMetaData->q_direction[d].band_data[band].azimuth[block], Sph_Grid16 ); + hQMetaData->q_direction[d].band_data[band].spherical_index[block] = index_theta_phi_16( &( hQMetaData->q_direction[d].band_data[band].elevation[block] ), + &( hQMetaData->q_direction[d].band_data[band].azimuth[block] ), Sph_Grid16 ); } } } @@ -792,7 +889,7 @@ static void restore_lowbitrate_masa( } -static void init_lfe_synth_data( +static ivas_error init_lfe_synth_data( Decoder_Struct *st_ivas, /* i : IVAS decoder struct */ MASA_DECODER_HANDLE hMasa /* i/o: MASA decoder structure */ ) @@ -803,7 +900,10 @@ static void init_lfe_synth_data( output_Fs = st_ivas->hDecoderConfig->output_Fs; output_config = st_ivas->hDecoderConfig->output_config; - hMasa->hMasaLfeSynth = (MCMASA_LFE_SYNTH_DATA_HANDLE) malloc( sizeof( MCMASA_LFE_SYNTH_DATA ) ); + if ( ( hMasa->hMasaLfeSynth = (MCMASA_LFE_SYNTH_DATA_HANDLE) malloc( sizeof( MCMASA_LFE_SYNTH_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } hMasa->hMasaLfeSynth->transportEneSmooth = 0.0f; hMasa->hMasaLfeSynth->protoLfeEneSmooth = 0.0f; @@ -827,7 +927,10 @@ static void init_lfe_synth_data( /* Ring buffer for the filterbank of the LFE synthesis. * The filterbank is using moving average lowpass filter with the crossover of 120 Hz. */ bufferSize = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES ); - hMasa->hMasaLfeSynth->lfeSynthRingBuffer = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->lfeSynthRingBuffer, bufferSize ); hMasa->hMasaLfeSynth->ringBufferLoPointer = 0; hMasa->hMasaLfeSynth->ringBufferHiPointer = bufferSize / 2; @@ -837,7 +940,10 @@ static void init_lfe_synth_data( /* Ring buffer for additional lowpass filter for the LFE signal. * Moving average lowpass filter with the crossover of 240 Hz. */ bufferSize /= 2; - hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2 = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->lfeSynthRingBuffer2, bufferSize ); hMasa->hMasaLfeSynth->ringBufferLoPointer2 = 0; hMasa->hMasaLfeSynth->lowpassSum2 = 0.0f; @@ -845,13 +951,19 @@ static void init_lfe_synth_data( /* Delay buffer for matching the delay of the lowpass filter */ bufferSize /= 2; /* The delay of the moving average lowpass filter is bufferSize / 2 */ - hMasa->hMasaLfeSynth->delayBuffer_syncLp = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->delayBuffer_syncLp = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->delayBuffer_syncLp, bufferSize ); hMasa->hMasaLfeSynth->delayBuffer_syncLp_size = bufferSize; /* Delay buffer for syncing with DirAC rendering */ bufferSize = NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ) - hMasa->hMasaLfeSynth->ringBufferSize / 2 - hMasa->hMasaLfeSynth->ringBufferSize2 / 2; - hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, bufferSize ); hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size = bufferSize; @@ -870,7 +982,10 @@ static void init_lfe_synth_data( /* Delay buffer for syncing with DirAC rendering */ bufferSize = NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ); - hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, bufferSize ); hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size = bufferSize; @@ -886,7 +1001,7 @@ static void init_lfe_synth_data( hMasa->hMasaLfeSynth->delayBuffer_syncDirAC = NULL; } - return; + return IVAS_ERR_OK; } @@ -1023,6 +1138,9 @@ ivas_error ivas_masa_dec_reconfigure( uint16_t *bit_stream; Decoder_State **sts; int32_t ivas_total_brate, last_ivas_total_brate; +#ifdef FIX_417_TD_DECORR_BRATE_SW + int16_t numCldfbAnalyses_old, numCldfbSyntheses_old; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -1030,6 +1148,30 @@ ivas_error ivas_masa_dec_reconfigure( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; +#ifdef FIX_417_TD_DECORR_BRATE_SW + ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); +#endif + +#ifdef FIX_425_MASA_BRSW_RENDERER + /* renderer might have changed, reselect */ + ivas_renderer_select( st_ivas ); + + if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->hDirAC == NULL ) + { + /* init a new DirAC dec */ + if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) + { + /* close unnecessary DirAC dec */ + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); + } + /* possible reconfigure is done later */ +#endif + /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles *-----------------------------------------------------------------*/ @@ -1086,19 +1228,583 @@ ivas_error ivas_masa_dec_reconfigure( } } } +#ifdef FIX_425_MASA_BRSW_RENDERER + if ( st_ivas->hDiracDecBin != NULL ) + { + /* regularization factor is bitrate-dependent */ + st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + } +#endif +#ifdef FIX_417_TD_DECORR_BRATE_SW + /*-----------------------------------------------------------------* + * TD Decorrelator + *-----------------------------------------------------------------*/ + + if ( st_ivas->hDiracDecBin != NULL ) + { + 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, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, st_ivas->nchan_transport, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*-----------------------------------------------------------------* + * Set-up MASA coding elements and bitrates + *-----------------------------------------------------------------*/ +#endif ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp ); +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active == 1 ) + { + int16_t tc_nchan_to_allocate; + int16_t tc_nchan_transport; + TC_BUFFER_MODE buffer_mode_new; + + buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); + tc_nchan_transport = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + tc_nchan_to_allocate = tc_nchan_transport; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; + } + if ( tc_nchan_transport != st_ivas->hTcBuffer->nchan_transport_jbm || tc_nchan_to_allocate != st_ivas->hTcBuffer->nchan_transport_internal || buffer_mode_new != st_ivas->hTcBuffer->tc_buffer_mode ) + { + if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, buffer_mode_new, tc_nchan_transport, tc_nchan_to_allocate, tc_nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } +#endif return error; } +#ifdef JBM_TSM_ON_TCS +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS /*-------------------------------------------------------------------* * ivas_spar_param_to_masa_param_mapping() * * Determine MASA metadata from the SPAR metadata *-------------------------------------------------------------------*/ +void ivas_spar_param_to_masa_param_mapping_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + int16_t azimuth[CLDFB_NO_CHANNELS_MAX], + int16_t elevation[CLDFB_NO_CHANNELS_MAX], + float energy_ratio1[CLDFB_NO_CHANNELS_MAX], + float spreadCoherence[CLDFB_NO_CHANNELS_MAX], + float surroundingCoherence[CLDFB_NO_CHANNELS_MAX], + float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* i : Input audio in CLDFB domain, imag */ +) +{ + int16_t i, j, sf, band, bin, slot, ch, nBins, nchan_transport; + int16_t mixer_mat_index; + DIRAC_DEC_HANDLE hDirAC; + SPAR_DEC_HANDLE hSpar; + DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; + float mixer_mat_sf_bands_real[SPAR_DIRAC_SPLIT_START_BAND][FOA_CHANNELS][FOA_CHANNELS]; + float mixer_mat_sf_bins_real[CLDFB_NO_CHANNELS_MAX][FOA_CHANNELS][FOA_CHANNELS]; + int16_t *band_grouping; + int16_t band_start, band_end; + float transportSignalEnergies[2][CLDFB_NO_CHANNELS_MAX]; + float transportSignalCrossCorrelation[CLDFB_NO_CHANNELS_MAX]; + float instEne; + float inCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; + float foaCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; + float Iy, Iz, Ix, E, azi, ele, I, ratio; + float diffuseGainX, diffuseGainY, diffuseGainZ, diffuseGainSum; + int16_t slot_idx_start; + int16_t slot_idx; + float slot_fac; + int16_t subframe_idx; + + + /* Set values */ + hDirAC = st_ivas->hDirAC; + hSpar = st_ivas->hSpar; + hDirAC->numSimultaneousDirections = 1; + hDiffuseDist = st_ivas->hDirAC->hDiffuseDist; + nchan_transport = st_ivas->nchan_transport; + band_grouping = hDirAC->band_grouping; + subframe_idx = hSpar->subframes_rendered; + slot_idx_start = hSpar->slots_rendered; + + /* Init arrays */ + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + set_zero( inCovarianceMtx[i], FOA_CHANNELS ); + } + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) + { + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + mixer_mat_sf_bands_real[band][i][j] = 0.0f; + } + } + } + + + slot_fac = 1.0f / (float) hSpar->subframe_nbslots[subframe_idx]; + + /* Delay the SPAR mixing matrices to have them synced with the audio */ + for ( slot_idx = 0; slot_idx < hSpar->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + sf = hSpar->render_to_md_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME; + if ( sf < SPAR_META_DELAY_SUBFRAMES ) + { + mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) + { + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + mixer_mat_sf_bands_real[band][i][j] += slot_fac * st_ivas->hSpar->hMdDec->mixer_mat_prev[mixer_mat_index][i][j][band]; + } + } + } + } + else + { + mixer_mat_index = sf - SPAR_META_DELAY_SUBFRAMES; + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) + { + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + mixer_mat_sf_bands_real[band][i][j] += slot_fac * st_ivas->hSpar->hMdDec->mixer_mat[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS]; + } + } + } + } + } + + /* Map the mixing matrices from the frequency bands to frequency bins */ + bin = 0; + + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) + { + band_start = band_grouping[band]; + band_end = band_grouping[band + 1]; + for ( bin = band_start; bin < band_end; bin++ ) + { + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + mixer_mat_sf_bins_real[bin][i][j] = mixer_mat_sf_bands_real[band][i][j]; + } + } + } + } + + nBins = bin; + + + /* Determine MASA metadata */ + + /* Determine transport signal energies and cross correlations when more than 1 TC */ + if ( nchan_transport == 2 ) + { + set_zero( transportSignalEnergies[0], nBins ); + set_zero( transportSignalEnergies[1], nBins ); + set_zero( transportSignalCrossCorrelation, nBins ); + for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe_idx]; slot++ ) + + { + for ( bin = 0; bin < nBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); + instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + transportSignalEnergies[ch][bin] += instEne; + } + transportSignalCrossCorrelation[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; + transportSignalCrossCorrelation[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; + } + } + } + + if ( hDiffuseDist != NULL ) + { + set_zero( hDiffuseDist->diffuseRatioX, CLDFB_NO_CHANNELS_MAX ); + set_zero( hDiffuseDist->diffuseRatioY, CLDFB_NO_CHANNELS_MAX ); + set_zero( hDiffuseDist->diffuseRatioZ, CLDFB_NO_CHANNELS_MAX ); + } + + for ( bin = 0; bin < nBins; bin++ ) + { + /* Set the energy of the first transport signal */ + if ( nchan_transport == 1 ) + { + inCovarianceMtx[0][0] = 1.0f; /* In case of 1TC, fixed value can be used */ + } + else + { + inCovarianceMtx[0][0] = transportSignalEnergies[0][bin]; /* In case of 2TC, use actual energies */ + } + /* Decorrelated channels assumed to have the same energy as the source channel */ + inCovarianceMtx[1][1] = inCovarianceMtx[0][0]; + inCovarianceMtx[2][2] = inCovarianceMtx[0][0]; + inCovarianceMtx[3][3] = inCovarianceMtx[0][0]; + + /* In case residuals were transmitted, use their actual energies and cross correlations */ + if ( nchan_transport == 2 ) + { + inCovarianceMtx[1][1] = transportSignalEnergies[1][bin]; + inCovarianceMtx[0][1] = transportSignalCrossCorrelation[bin]; + inCovarianceMtx[1][0] = inCovarianceMtx[0][1]; + } + + compute_foa_cov_matrix( foaCovarianceMtx, inCovarianceMtx, mixer_mat_sf_bins_real[bin] ); + + /* Estimate MASA metadata */ + Iy = foaCovarianceMtx[0][1]; /* Intensity in Y direction */ + Iz = foaCovarianceMtx[0][2]; /* Intensity in Z direction */ + Ix = foaCovarianceMtx[0][3]; /* Intensity in X direction */ + I = sqrtf( Ix * Ix + Iy * Iy + Iz * Iz ); /* Intensity vector length */ + E = ( foaCovarianceMtx[0][0] + foaCovarianceMtx[1][1] + foaCovarianceMtx[2][2] + foaCovarianceMtx[3][3] ) / 2.0f; /* Overall energy */ + azi = atan2f( Iy, Ix ); /* Azimuth */ + ele = atan2f( Iz, sqrtf( Ix * Ix + Iy * Iy ) ); /* Elevation */ + ratio = I / fmaxf( 1e-12f, E ); /* Energy ratio */ + ratio = fmaxf( 0.0f, fminf( 1.0f, ratio ) ); + + azimuth[bin] = (int16_t) roundf( azi / PI_OVER_180 ); + elevation[bin] = (int16_t) roundf( ele / PI_OVER_180 ); + energy_ratio1[bin] = ratio; + spreadCoherence[bin] = 0.0f; + surroundingCoherence[bin] = 0.0f; + + /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */ + if ( hDiffuseDist != NULL ) + { + if ( nchan_transport == 1 ) + { + diffuseGainY = fabsf( mixer_mat_sf_bins_real[bin][1][1] ); + diffuseGainX = fabsf( mixer_mat_sf_bins_real[bin][3][2] ); + diffuseGainZ = fabsf( mixer_mat_sf_bins_real[bin][2][3] ); + } + else if ( nchan_transport == 2 ) + { + diffuseGainY = fabsf( mixer_mat_sf_bins_real[bin][1][1] * transportSignalEnergies[1][bin] ); + diffuseGainX = fabsf( mixer_mat_sf_bins_real[bin][3][2] * transportSignalEnergies[0][bin] ) + fabsf( mixer_mat_sf_bins_real[bin][3][1] * transportSignalEnergies[1][bin] ); + diffuseGainZ = fabsf( mixer_mat_sf_bins_real[bin][2][3] * transportSignalEnergies[0][bin] ) + fabsf( mixer_mat_sf_bins_real[bin][2][1] * transportSignalEnergies[1][bin] ); + } + else + { + diffuseGainY = 1.0f; + diffuseGainX = 1.0f; + diffuseGainZ = 1.0f; + } + + diffuseGainSum = diffuseGainY + diffuseGainX + diffuseGainZ; + + if ( diffuseGainSum == 0.0f ) + { + hDiffuseDist->diffuseRatioX[bin] = 1.0f / 3.0f; + hDiffuseDist->diffuseRatioY[bin] = 1.0f / 3.0f; + hDiffuseDist->diffuseRatioZ[bin] = 1.0f / 3.0f; + } + else + { + hDiffuseDist->diffuseRatioX[bin] = diffuseGainX / ( diffuseGainSum + EPSILON ); + hDiffuseDist->diffuseRatioY[bin] = diffuseGainY / ( diffuseGainSum + EPSILON ); + hDiffuseDist->diffuseRatioZ[bin] = diffuseGainZ / ( diffuseGainSum + EPSILON ); + } + } + } + + return; +} +#endif +#endif + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +void ivas_spar_param_to_masa_param_mapping( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ + const int16_t subframe /* i : Subframe to map */ +) +{ + int16_t i, j, band, bin, slot, ch, nBins, nchan_transport; + int16_t mixer_mat_index; + int16_t dirac_write_idx; + DIRAC_DEC_HANDLE hDirAC; + DIFFUSE_DISTRIBUTION_HANDLE hDiffuseDist; + float mixer_mat_sf_bands_real[SPAR_DIRAC_SPLIT_START_BAND][FOA_CHANNELS][FOA_CHANNELS]; + float mixer_mat_sf_bins_real[CLDFB_NO_CHANNELS_MAX][FOA_CHANNELS][FOA_CHANNELS]; + int16_t *band_grouping; + int16_t band_start, band_end; + float transportSignalEnergies[2][CLDFB_NO_CHANNELS_MAX]; + float transportSignalCrossCorrelation[CLDFB_NO_CHANNELS_MAX]; + float instEne; + float inCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; + float foaCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; + float Iy, Iz, Ix, E, azi, ele, I, ratio; + float diffuseGainX, diffuseGainY, diffuseGainZ, diffuseGainSum; +#ifdef JBM_TSM_ON_TCS + int16_t slot_idx, slot_idx_start, sf; + SPAR_DEC_HANDLE hSpar; + float slot_fac; +#endif + + + /* Set values */ + hDirAC = st_ivas->hDirAC; + hDirAC->numSimultaneousDirections = 1; + hDiffuseDist = st_ivas->hDirAC->hDiffuseDist; + nchan_transport = st_ivas->nchan_transport; + band_grouping = hDirAC->band_grouping; +#ifdef JBM_TSM_ON_TCS + hSpar = st_ivas->hSpar; + dirac_write_idx = hDirAC->render_to_md_map[subframe]; +#else + dirac_write_idx = hDirAC->dirac_read_idx; /* Mixing matrices, from which MASA meta is determined, already have the delay compensation */ +#endif + + /* Init arrays */ + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + set_zero( inCovarianceMtx[i], FOA_CHANNELS ); + } + + /* Delay the SPAR mixing matrices to have them synced with the audio */ +#ifdef JBM_TSM_ON_TCS + slot_idx_start = hSpar->slots_rendered; + slot_fac = 1.0f / (float) hSpar->subframe_nbslots[subframe]; + + for ( slot_idx = 0; slot_idx < hSpar->subframe_nbslots[subframe]; slot_idx++ ) + { + sf = hSpar->render_to_md_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME; +#endif + if ( subframe < SPAR_META_DELAY_SUBFRAMES ) + { +#ifdef JBM_TSM_ON_TCS + mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; +#else + mixer_mat_index = subframe + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; +#endif + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) + { + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { +#ifdef JBM_TSM_ON_TCS + mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat_prev[mixer_mat_index][i][j][band]; +#else + mixer_mat_sf_bands_real[band][i][j] = st_ivas->hSpar->hMdDec->mixer_mat_prev[mixer_mat_index][i][j][band]; +#endif + } + } + } + } + else + { +#ifdef JBM_TSM_ON_TCS + mixer_mat_index = sf - SPAR_META_DELAY_SUBFRAMES; +#else + mixer_mat_index = subframe - SPAR_META_DELAY_SUBFRAMES; +#endif + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) + { + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { +#ifdef JBM_TSM_ON_TCS + mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS]; +#else + mixer_mat_sf_bands_real[band][i][j] = st_ivas->hSpar->hMdDec->mixer_mat[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS]; +#endif + } + } + } + } +#ifdef JBM_TSM_ON_TCS + } +#endif + + /* Map the mixing matrices from the frequency bands to frequency bins */ + bin = 0; + for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) + { + band_start = band_grouping[band]; + band_end = band_grouping[band + 1]; + for ( bin = band_start; bin < band_end; bin++ ) + { + for ( i = 0; i < FOA_CHANNELS; i++ ) + { + for ( j = 0; j < FOA_CHANNELS; j++ ) + { + mixer_mat_sf_bins_real[bin][i][j] = mixer_mat_sf_bands_real[band][i][j]; + } + } + } + } + nBins = bin; + + /* Determine MASA metadata */ + /* Determine transport signal energies and cross correlations when more than 1 TC */ + if ( nchan_transport == 2 ) + { + set_zero( transportSignalEnergies[0], nBins ); + set_zero( transportSignalEnergies[1], nBins ); + set_zero( transportSignalCrossCorrelation, nBins ); + +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) +#else + for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) +#endif + { + for ( bin = 0; bin < nBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); + instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + transportSignalEnergies[ch][bin] += instEne; + } + transportSignalCrossCorrelation[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; + transportSignalCrossCorrelation[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; + } + } + } + + if ( hDiffuseDist != NULL ) + { +#ifdef JBM_TSM_ON_TCS + set_zero( hDiffuseDist->diffuseRatioX, CLDFB_NO_CHANNELS_MAX ); + set_zero( hDiffuseDist->diffuseRatioY, CLDFB_NO_CHANNELS_MAX ); + set_zero( hDiffuseDist->diffuseRatioZ, CLDFB_NO_CHANNELS_MAX ); +#else + set_zero( hDiffuseDist->diffuseRatioX[subframe], CLDFB_NO_CHANNELS_MAX ); + set_zero( hDiffuseDist->diffuseRatioY[subframe], CLDFB_NO_CHANNELS_MAX ); + set_zero( hDiffuseDist->diffuseRatioZ[subframe], CLDFB_NO_CHANNELS_MAX ); +#endif + } + + for ( bin = 0; bin < nBins; bin++ ) + { + /* Set the energy of the first transport signal */ + if ( nchan_transport == 1 ) + { + inCovarianceMtx[0][0] = 1.0f; /* In case of 1TC, fixed value can be used */ + } + else + { + inCovarianceMtx[0][0] = transportSignalEnergies[0][bin]; /* In case of 2TC, use actual energies */ + } + /* Decorrelated channels assumed to have the same energy as the source channel */ + inCovarianceMtx[1][1] = inCovarianceMtx[0][0]; + inCovarianceMtx[2][2] = inCovarianceMtx[0][0]; + inCovarianceMtx[3][3] = inCovarianceMtx[0][0]; + + /* In case residuals were transmitted, use their actual energies and cross correlations */ + if ( nchan_transport == 2 ) + { + inCovarianceMtx[1][1] = transportSignalEnergies[1][bin]; + inCovarianceMtx[0][1] = transportSignalCrossCorrelation[bin]; + inCovarianceMtx[1][0] = inCovarianceMtx[0][1]; + } + + compute_foa_cov_matrix( foaCovarianceMtx, inCovarianceMtx, mixer_mat_sf_bins_real[bin] ); + + /* Estimate MASA metadata */ + Iy = foaCovarianceMtx[0][1]; /* Intensity in Y direction */ + Iz = foaCovarianceMtx[0][2]; /* Intensity in Z direction */ + Ix = foaCovarianceMtx[0][3]; /* Intensity in X direction */ + I = sqrtf( Ix * Ix + Iy * Iy + Iz * Iz ); /* Intensity vector length */ + E = ( foaCovarianceMtx[0][0] + foaCovarianceMtx[1][1] + foaCovarianceMtx[2][2] + foaCovarianceMtx[3][3] ) / 2.0f; /* Overall energy */ + azi = atan2f( Iy, Ix ); /* Azimuth */ + ele = atan2f( Iz, sqrtf( Ix * Ix + Iy * Iy ) ); /* Elevation */ + ratio = I / fmaxf( 1e-12f, E ); /* Energy ratio */ + ratio = fmaxf( 0.0f, fminf( 1.0f, ratio ) ); + + hDirAC->azimuth[dirac_write_idx][bin] = (int16_t) roundf( azi / PI_OVER_180 ); + hDirAC->elevation[dirac_write_idx][bin] = (int16_t) roundf( ele / PI_OVER_180 ); + hDirAC->energy_ratio1[dirac_write_idx][bin] = ratio; + hDirAC->diffuseness_vector[dirac_write_idx][bin] = 1.0f - ratio; + + hDirAC->spreadCoherence[dirac_write_idx][bin] = 0.0f; + hDirAC->surroundingCoherence[dirac_write_idx][bin] = 0.0f; + + /* Determine directional distribution of the indirect audio based on the SPAR mixing matrices (and the transport audio signals when 2 TC) */ + if ( hDiffuseDist != NULL ) + { + if ( nchan_transport == 1 ) + { + diffuseGainY = fabsf( mixer_mat_sf_bins_real[bin][1][1] ); + diffuseGainX = fabsf( mixer_mat_sf_bins_real[bin][3][2] ); + diffuseGainZ = fabsf( mixer_mat_sf_bins_real[bin][2][3] ); + } + else if ( nchan_transport == 2 ) + { + diffuseGainY = fabsf( mixer_mat_sf_bins_real[bin][1][1] * transportSignalEnergies[1][bin] ); + diffuseGainX = fabsf( mixer_mat_sf_bins_real[bin][3][2] * transportSignalEnergies[0][bin] ) + fabsf( mixer_mat_sf_bins_real[bin][3][1] * transportSignalEnergies[1][bin] ); + diffuseGainZ = fabsf( mixer_mat_sf_bins_real[bin][2][3] * transportSignalEnergies[0][bin] ) + fabsf( mixer_mat_sf_bins_real[bin][2][1] * transportSignalEnergies[1][bin] ); + } + else + { + diffuseGainY = 1.0f; + diffuseGainX = 1.0f; + diffuseGainZ = 1.0f; + } + + diffuseGainSum = diffuseGainY + diffuseGainX + diffuseGainZ; + +#ifdef JBM_TSM_ON_TCS + if ( diffuseGainSum == 0.0f ) + { + hDiffuseDist->diffuseRatioX[bin] = 1.0f / 3.0f; + hDiffuseDist->diffuseRatioY[bin] = 1.0f / 3.0f; + hDiffuseDist->diffuseRatioZ[bin] = 1.0f / 3.0f; + } + else + { + hDiffuseDist->diffuseRatioX[bin] = diffuseGainX / ( diffuseGainSum + EPSILON ); + hDiffuseDist->diffuseRatioY[bin] = diffuseGainY / ( diffuseGainSum + EPSILON ); + hDiffuseDist->diffuseRatioZ[bin] = diffuseGainZ / ( diffuseGainSum + EPSILON ); + } +#else + if ( diffuseGainSum == 0.0f ) + { + hDiffuseDist->diffuseRatioX[subframe][bin] = 1.0f / 3.0f; + hDiffuseDist->diffuseRatioY[subframe][bin] = 1.0f / 3.0f; + hDiffuseDist->diffuseRatioZ[subframe][bin] = 1.0f / 3.0f; + } + else + { + hDiffuseDist->diffuseRatioX[subframe][bin] = diffuseGainX / ( diffuseGainSum + EPSILON ); + hDiffuseDist->diffuseRatioY[subframe][bin] = diffuseGainY / ( diffuseGainSum + EPSILON ); + hDiffuseDist->diffuseRatioZ[subframe][bin] = diffuseGainZ / ( diffuseGainSum + EPSILON ); + } +#endif + } + } + + return; +} +#else void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -1123,6 +1829,9 @@ void ivas_spar_param_to_masa_param_mapping( float foaCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; float Iy, Iz, Ix, E, azi, ele, I, ratio; float diffuseGainX, diffuseGainY, diffuseGainZ, diffuseGainSum; +#ifdef JBM_TSM_ON_TCS + int16_t slot_idx_start; +#endif /* Set values */ hDirAC = st_ivas->hDirAC; @@ -1193,6 +1902,10 @@ void ivas_spar_param_to_masa_param_mapping( } nBins = bin; +#ifdef JBM_TSM_ON_TCS + slot_idx_start = st_ivas->hSpar->slots_rendered; +#endif + /* Determine MASA metadata */ for ( sf = firstSubframe; sf < ( firstSubframe + nSubframes ); sf++ ) { @@ -1202,10 +1915,17 @@ void ivas_spar_param_to_masa_param_mapping( set_zero( transportSignalEnergies[0], nBins ); set_zero( transportSignalEnergies[1], nBins ); set_zero( transportSignalCrossCorrelation, nBins ); - - for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots[sf]; slot++ ) +#else + for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots; slot++ ) +#endif { +#ifdef JBM_TSM_ON_TCS + int16_t slotThis = slot + slot_idx_start; +#else int16_t slotThis = slot + ( hDirAC->subframe_nbslots * sf ); +#endif for ( bin = 0; bin < nBins; bin++ ) { @@ -1313,10 +2033,14 @@ void ivas_spar_param_to_masa_param_mapping( } dirac_write_idx = ( dirac_write_idx + 1 ) % hDirAC->dirac_md_buffer_length; +#ifdef JBM_TSM_ON_TCS + slot_idx_start += st_ivas->hSpar->subframe_nbslots[sf]; +#endif } return; } +#endif /* Estimate FOA properties: foaCov = mixMtx * inCov * mixMtx' */ @@ -1357,3 +2081,135 @@ static void compute_foa_cov_matrix( return; } + +static void create_masa_ext_out_meta( + MASA_DECODER *hMasa, + IVAS_QMETADATA_HANDLE hQMetaData, + const int16_t nchan_transport ) +{ + const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ + int16_t i, sf, b_old, b_new, dir; + MASA_DECRIPTIVE_META *descMeta; + int16_t *bandMap; + uint8_t numCodingBands; + uint8_t numDirections; + MASA_DECODER_EXT_OUT_META *extOutMeta; + + numDirections = hMasa->config.numberOfDirections; + numCodingBands = hMasa->config.numCodingBands; + bandMap = hMasa->data.band_mapping; + extOutMeta = hMasa->data.extOutMeta; + descMeta = &hMasa->data.extOutMeta->descriptiveMeta; + + /* Construct descriptive meta */ + for ( i = 0; i < 8; i++ ) + { + descMeta->formatDescriptor[i] = ivasmasaFormatDescriptor[i]; + } + descMeta->numberOfDirections = numDirections - 1; + descMeta->numberOfChannels = (uint8_t) ( nchan_transport - 1 ); + /* Following correspond to "unknown" values until transmission is implemented */ + descMeta->sourceFormat = 0x0u; + descMeta->transportDefinition = 0x0u; + descMeta->channelAngle = 0x0u; + descMeta->channelDistance = 0x0u; + descMeta->channelLayout = 0x0u; + + /* Construct spatial metadata from qmetadata */ + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + for ( dir = 0; dir < numDirections; dir++ ) + { + /* Spherical index */ + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->directionIndex[dir][sf][b_new] = hQMetaData->q_direction[dir].band_data[b_old].spherical_index[sf]; + } + } + + /* Direct-to-total ratio */ + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->directToTotalRatio[dir][sf][b_new] = (uint8_t) floorf( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio[sf] * UINT8_MAX ); + } + } + + /* Spread coherence */ + if ( hQMetaData->q_direction[dir].coherence_band_data != NULL ) + { + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->spreadCoherence[dir][sf][b_new] = hQMetaData->q_direction[dir].coherence_band_data[b_old].spread_coherence[sf]; + } + } + } + else + { + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->spreadCoherence[dir][sf][i] = 0; + } + } + } + + /* Fill second direction with zero energy data for EXT output */ + if ( numDirections == 1 ) + { + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->directionIndex[1][sf][i] = SPH_IDX_FRONT; + } + + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->directToTotalRatio[1][sf][i] = 0; + } + + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->spreadCoherence[1][sf][i] = 0; + } + } + + /* Common spatial meta */ + /* Diffuse-to-total ratio = 1 - sum(direct-to-total ratios) */ + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->diffuseToTotalRatio[sf][b_new] = UINT8_MAX; + for ( dir = 0; dir < numDirections; dir++ ) + { + extOutMeta->diffuseToTotalRatio[sf][b_new] -= (uint8_t) floorf( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio[sf] * UINT8_MAX ); + } + } + } + + /* Surround coherence */ + if ( hQMetaData->surcoh_band_data != NULL ) + { + for ( b_old = 0; b_old < numCodingBands; b_old++ ) + { + for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) + { + extOutMeta->surroundCoherence[sf][b_new] = hQMetaData->surcoh_band_data[b_old].surround_coherence[sf]; + } + } + } + else + { + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) + { + extOutMeta->surroundCoherence[sf][i] = 0; + } + } + } + + return; +} diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 89e5e4362360165922f229e789907933622e1367..0b4f9a3c741bee507d2c9baec4ddd2cbc2001fbb 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -38,6 +38,7 @@ #include "rom_com.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_dec.h" @@ -75,7 +76,11 @@ typedef struct parameter_band_mapping_struct static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, const int16_t nchan_in, const int16_t nchan_out ); +#ifdef JBM_TSM_ON_TCS +static void param_mc_protoSignalComputation( float *RealBuffer, float *ImagBuffer, float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands ); +#else static void param_mc_protoSignalComputation( float RealBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t slot_index, const int16_t num_freq_bands ); +#endif static void ivas_param_mc_dec_copy_diffuse_proto( PARAM_MC_DEC_HANDLE hParamMC, float Cldfb_buffer_real[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Cldfb_buffer_imag[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nY, const int16_t slot_idx ); @@ -85,17 +90,27 @@ static int16_t ivas_param_mc_uniform_decoder( float *seq, const int16_t sz_seq, static void ivas_param_mc_dequantize_cov( PARAM_MC_DEC_HANDLE hDirAC, float *ild_q, float *icc_q, const int16_t param_band_index, const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nY, const int16_t nX, float *Cx_state, float *Cproto, float *Cy_state ); +#ifdef JBM_TSM_ON_TCS +static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); + +static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); +#else static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); +#endif +#ifdef JBM_TSM_ON_TCS +static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float *mixing_matrix[], float *mixing_matrix_res[], const uint16_t nX, const uint16_t nY ); +#else static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], const uint16_t nX, const uint16_t nY ); +#endif -static void param_mc_compute_interpolator( const uint16_t bAttackPresent, const uint16_t attackPos, const uint16_t interp_length, float *interpolator ); +static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresent, const uint16_t attackPos, const uint16_t interp_length, float *interpolator ); static void param_mc_set_num_synth_bands( const int32_t output_Fs, PARAM_MC_DEC_HANDLE hParamMC ); -static void param_mc_get_diff_proto_info( const float *proto_mtx, const uint16_t nchan_transport, const uint16_t nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info ); +static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, const uint16_t nchan_transport, const uint16_t nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info ); static void ivas_param_mc_mc2sba_cldfb( IVAS_OUTPUT_SETUP hTransSetup, float *hoa_encoder, const int16_t slot_idx, float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const int16_t nBands, const float gain_lfe ); @@ -223,15 +238,27 @@ ivas_error ivas_param_mc_dec_open( *-----------------------------------------------------------------*/ hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX; +#ifdef JBM_TSM_ON_TCS + set_s( hParamMC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hParamMC->subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hParamMC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; +#else hParamMC->subframe_nbslots = CLDFB_NO_COL_MAX / PARAM_MC_NSUBFRAMES_DEC; +#endif hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); /* init arrays for quantized parameters */ - hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ); - hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ); + if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_f( hParamMC->icld_q, PARAM_MC_DEFAULT_MIN_ILD, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); set_f( hParamMC->icc_q, 0.0f, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); @@ -263,7 +290,6 @@ ivas_error ivas_param_mc_dec_open( hParamMC->max_param_band_abs_cov = ( k++ ); } - /*-----------------------------------------------------------------* * open sub-modules *-----------------------------------------------------------------*/ @@ -280,11 +306,16 @@ ivas_error ivas_param_mc_dec_open( /* convert the ls conv dmx matrix into column order matrix format (nchan_out_cldfb x nchan_out) */ if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { - hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ); + if ( ( hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + for ( k = 0; k < nchan_out_transport; k++ ) { mvr2r( st_ivas->hLsSetUpConversion->dmxMtx[k], &hParamMC->ls_conv_dmx_matrix[k * nchan_out_cov], nchan_out_cov ); } + /* convert ParamMC parameter bands to SFB */ if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { @@ -302,7 +333,10 @@ ivas_error ivas_param_mc_dec_open( } } - hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ); + if ( ( hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } mvr2r( ivas_param_mc_conf[config_index].dmx_fac, hParamMC->proto_matrix_int, nchan_transport * nchan_out_transport ); if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) @@ -347,9 +381,15 @@ ivas_error ivas_param_mc_dec_open( else { hParamMC->num_outputs_diff = nchan_out_cov; - hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ); + if ( ( hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } - param_mc_get_diff_proto_info( proto_matrix, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ); + if ( ( error = param_mc_get_diff_proto_info( proto_matrix, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ) ) != IVAS_ERR_OK ) + { + return error; + } /* decorrelation */ hParamMC->h_freq_domain_decorr_ap_params = NULL; @@ -357,15 +397,18 @@ ivas_error ivas_param_mc_dec_open( ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, hParamMC->num_freq_bands ); - ivas_dirac_dec_decorr_open( &( hParamMC->h_freq_domain_decorr_ap_params ), - &( hParamMC->h_freq_domain_decorr_ap_state ), - hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - frequency_axis, - nchan_transport, - output_Fs ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hParamMC->h_freq_domain_decorr_ap_params ), + &( hParamMC->h_freq_domain_decorr_ap_state ), + hParamMC->num_freq_bands, + hParamMC->num_outputs_diff, + hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, + frequency_axis, + nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } hParamMC->h_output_synthesis_params.use_onset_filters = 0; hParamMC->max_band_decorr = hParamMC->h_freq_domain_decorr_ap_params->max_band_decorr; @@ -384,21 +427,30 @@ ivas_error ivas_param_mc_dec_open( } /* output synthesis */ - ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), - &( hParamMC->h_output_synthesis_cov_state ), - hParamMC->max_band_decorr, - PARAM_MC_MAX_NSLOTS, - hParamMC->hMetadataPMC->num_parameter_bands, - max_param_band_residual, - nchan_transport, - nchan_out_cov, - proto_matrix ); + if ( ( error = ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), + &( hParamMC->h_output_synthesis_cov_state ), + hParamMC->max_band_decorr, + PARAM_MC_MAX_NSLOTS, + hParamMC->hMetadataPMC->num_parameter_bands, + max_param_band_residual, + nchan_transport, + nchan_out_cov, + proto_matrix ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef JBM_TSM_ON_TCS + ivas_param_mc_dec_compute_interpolator( 0, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hParamMC->h_output_synthesis_params.interpolator ); +#endif /* Head rotation */ if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && st_ivas->hDecoderConfig->Opt_Headrotation ) { - hParamMC->hoa_encoder = (float *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( float ) ); + if ( ( hParamMC->hoa_encoder = (float *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } compute_hoa_encoder_mtx( st_ivas->hTransSetup.ls_azimuth, st_ivas->hTransSetup.ls_elevation, hParamMC->hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER ); } @@ -408,8 +460,15 @@ ivas_error ivas_param_mc_dec_open( if ( hParamMC->max_band_decorr > 0 ) { - hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ); - hParamMC->proto_frame_dec_f = (float *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( float ) ); + if ( ( hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + + if ( ( hParamMC->proto_frame_dec_f = (float *) malloc( 2 * nchan_out_cov * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } } else { @@ -419,6 +478,30 @@ ivas_error ivas_param_mc_dec_open( ivas_param_mc_dec_init( hParamMC, nchan_transport, nchan_out_cov ); +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active && hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) + { + hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ); + set_zero( hParamMC->Cldfb_RealBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands ); + hParamMC->Cldfb_ImagBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ); + set_zero( hParamMC->Cldfb_ImagBuffer_tc, MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands ); + if ( st_ivas->hTcBuffer == NULL ) + { + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else + { + hParamMC->Cldfb_RealBuffer_tc = NULL; + hParamMC->Cldfb_ImagBuffer_tc = NULL; + } + hParamMC->subframes_rendered = 0; + hParamMC->slots_rendered = 0; +#endif + st_ivas->hParamMC = hParamMC; return error; @@ -561,12 +644,14 @@ ivas_error ivas_param_mc_dec_reconfig( #endif } - /*-----------------------------------------------------------------* + /*-----------------------------------------------------------------* * set input parameters *-----------------------------------------------------------------*/ +#ifndef JBM_TSM_ON_TCS hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX; hParamMC->subframe_nbslots = CLDFB_NO_COL_MAX / PARAM_MC_NSUBFRAMES_DEC; +#endif hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; @@ -616,8 +701,14 @@ ivas_error ivas_param_mc_dec_reconfig( /* init arrays for the quantized parameters */ - hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ); - hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ); + if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( hParamMC->icld_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_f( hParamMC->icld_q, PARAM_MC_DEFAULT_MIN_ILD, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ); set_f( hParamMC->icc_q, 0.0f, hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ); @@ -674,7 +765,6 @@ ivas_error ivas_param_mc_dec_reconfig( hParamMC->max_param_band_abs_cov = ( k++ ); } - /*-----------------------------------------------------------------* * open sub-modules *-----------------------------------------------------------------*/ @@ -697,7 +787,10 @@ ivas_error ivas_param_mc_dec_reconfig( /* convert the ls conv dmx matrix into column order matrix format (nchan_out_cldfb x nchan_out) */ free( hParamMC->ls_conv_dmx_matrix ); - hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ); + if ( ( hParamMC->ls_conv_dmx_matrix = (float *) malloc( nchan_out_transport * nchan_out_cov * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } for ( k = 0; k < nchan_out_transport; k++ ) { mvr2r( st_ivas->hLsSetUpConversion->dmxMtx[k], &hParamMC->ls_conv_dmx_matrix[k * nchan_out_cov], nchan_out_cov ); @@ -719,9 +812,13 @@ ivas_error ivas_param_mc_dec_reconfig( if ( nchan_transport_old != nchan_transport ) { free( hParamMC->proto_matrix_int ); - hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ); + if ( ( hParamMC->proto_matrix_int = (float *) malloc( nchan_out_transport * nchan_transport * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } mvr2r( ivas_param_mc_conf[config_index].dmx_fac, hParamMC->proto_matrix_int, nchan_transport * nchan_out_transport ); } + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { matrix_product( hParamMC->ls_conv_dmx_matrix, nchan_out_cov, nchan_out_transport, 0, @@ -789,9 +886,15 @@ ivas_error ivas_param_mc_dec_reconfig( } hParamMC->num_outputs_diff = nchan_out_cov; - hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ); + if ( ( hParamMC->diff_proto_info = (PARAM_MC_DIFF_PROTO_INFO *) malloc( sizeof( PARAM_MC_DIFF_PROTO_INFO ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } - param_mc_get_diff_proto_info( proto_matrix, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ); + if ( ( param_mc_get_diff_proto_info( proto_matrix, nchan_transport, nchan_out_cov, hParamMC->diff_proto_info ) ) != IVAS_ERR_OK ) + { + return error; + } /* decorrelation */ hParamMC->h_freq_domain_decorr_ap_params = NULL; @@ -799,15 +902,18 @@ ivas_error ivas_param_mc_dec_reconfig( ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, hParamMC->num_freq_bands ); - ivas_dirac_dec_decorr_open( &( hParamMC->h_freq_domain_decorr_ap_params ), - &( hParamMC->h_freq_domain_decorr_ap_state ), - hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - frequency_axis, - nchan_transport, - output_Fs ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hParamMC->h_freq_domain_decorr_ap_params ), + &( hParamMC->h_freq_domain_decorr_ap_state ), + hParamMC->num_freq_bands, + hParamMC->num_outputs_diff, + hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, + frequency_axis, + nchan_transport, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } hParamMC->h_output_synthesis_params.use_onset_filters = 0; hParamMC->max_band_decorr = hParamMC->h_freq_domain_decorr_ap_params->max_band_decorr; @@ -842,16 +948,24 @@ ivas_error ivas_param_mc_dec_reconfig( float tmp_buf[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; set_zero( tmp_buf, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); + /* output synthesis */ - ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), - &( hParamMC->h_output_synthesis_cov_state ), - hParamMC->max_band_decorr, - PARAM_MC_MAX_NSLOTS, - hParamMC->hMetadataPMC->num_parameter_bands, - max_param_band_residual, - nchan_transport, - nchan_out_cov, - proto_matrix ); + if ( ( error = ivas_dirac_dec_output_synthesis_cov_open( &( hParamMC->h_output_synthesis_params ), + &( hParamMC->h_output_synthesis_cov_state ), + hParamMC->max_band_decorr, + PARAM_MC_MAX_NSLOTS, + hParamMC->hMetadataPMC->num_parameter_bands, + max_param_band_residual, + nchan_transport, + nchan_out_cov, + proto_matrix ) ) != IVAS_ERR_OK ) + { + return error; + } + +#ifdef JBM_TSM_ON_TCS + ivas_param_mc_dec_compute_interpolator( 0, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hParamMC->h_output_synthesis_params.interpolator ); +#endif ivas_dirac_dec_output_synthesis_cov_init( &( hParamMC->h_output_synthesis_cov_state ), nchan_transport, nchan_out_cov, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual ); @@ -891,7 +1005,6 @@ ivas_error ivas_param_mc_dec_reconfig( ivas_dirac_dec_output_synthesis_cov_close( ¶ms_old, &cov_state_old ); } - /*-----------------------------------------------------------------* * memory allocation *-----------------------------------------------------------------*/ @@ -899,13 +1012,17 @@ ivas_error ivas_param_mc_dec_reconfig( if ( hParamMC->max_band_decorr > 0 && nchan_transport_old != nchan_transport ) { free( hParamMC->proto_frame_f ); - hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ); + if ( ( hParamMC->proto_frame_f = (float *) malloc( 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_zero( hParamMC->proto_frame_f, 2 * hParamMC->diff_proto_info->num_protos_diff * hParamMC->num_freq_bands ); } return error; } + /*------------------------------------------------------------------------- * param_mc_get_num_cldfb_syntheses() * @@ -1060,13 +1177,21 @@ void ivas_param_mc_dec_close( hParamMC->hoa_encoder = NULL; } -#ifdef SWITCHING_FORMAT_DEC +#ifdef JBM_TSM_ON_TCS + if ( hParamMC->Cldfb_RealBuffer_tc != NULL ) + { + free( hParamMC->Cldfb_RealBuffer_tc ); + hParamMC->Cldfb_RealBuffer_tc = NULL; + } + if ( hParamMC->Cldfb_ImagBuffer_tc != NULL ) + { + free( hParamMC->Cldfb_ImagBuffer_tc ); + hParamMC->Cldfb_ImagBuffer_tc = NULL; + } +#endif + free( *hParamMC_out ); *hParamMC_out = NULL; -#else - free( hParamMC ); - hParamMC = NULL; -#endif return; } @@ -1182,7 +1307,9 @@ void ivas_param_mc_dec_read_BS( num_lfe_bands = 0; } - param_mc_compute_interpolator( hMetadataPMC->bAttackPresent, hMetadataPMC->attackIndex, PARAM_MC_MAX_NSLOTS, hParamMC->h_output_synthesis_params.interpolator ); +#ifndef JBM_TSM_ON_TCS + ivas_param_mc_dec_compute_interpolator( hMetadataPMC->bAttackPresent, hMetadataPMC->attackIndex, PARAM_MC_MAX_NSLOTS, hParamMC->h_output_synthesis_params.interpolator ); +#endif if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) { @@ -1262,7 +1389,6 @@ void ivas_param_mc_dec_read_BS( *nb_bits = bit_pos; - } /* if ( !st->bfi ) */ if ( st->bfi ) @@ -1270,6 +1396,11 @@ void ivas_param_mc_dec_read_BS( /* for PLC, use the saved ILDs and ICCs from the past and set the transient flag and transient position to zero */ hMetadataPMC->bAttackPresent = 0; hMetadataPMC->attackIndex = 0; +#ifndef JBM_TSM_ON_TCS +#ifdef FIX_431_PARAMMC_PLC_INTERPOLATOR + ivas_param_mc_dec_compute_interpolator( hMetadataPMC->bAttackPresent, hMetadataPMC->attackIndex, PARAM_MC_MAX_NSLOTS, hParamMC->h_output_synthesis_params.interpolator ); +#endif +#endif } pop_wmops(); @@ -1277,62 +1408,39 @@ void ivas_param_mc_dec_read_BS( return; } - -/*------------------------------------------------------------------------- - * ivas_param_mc_dec() - * - * Parametric MC decoding process - *------------------------------------------------------------------------*/ - -void ivas_param_mc_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +#ifdef JBM_TSM_ON_TCS +void ivas_param_mc_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ ) { PARAM_MC_DEC_HANDLE hParamMC; int16_t i, ch; - int16_t subframe_idx, num_subframes; - int16_t slot_idx, param_band_idx, slot_idx_start; + int16_t slot_idx, param_band_idx; int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; int16_t nchan_out_cov; /*CLDFB*/ - float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; float real_part, imag_part; - /*Decorrelator*/ - float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* format converter */ int16_t channel_active[MAX_OUTPUT_CHANNELS]; - uint16_t nband_synth, nbands_to_zero; - uint16_t nchan_out_init; IVAS_OUTPUT_SETUP *hSynthesisOutputSetup; hParamMC = st_ivas->hParamMC; assert( hParamMC ); - push_wmops( "param_mc_dec" ); + push_wmops( "param_mc_dec_digest_tc" ); set_s( channel_active, 0, MAX_CICP_CHANNELS ); nchan_transport = st_ivas->nchan_transport; nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - nchan_out_init = nchan_out_transport; if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { nchan_out_cldfb = BINAURAL_CHANNELS; set_s( channel_active, 1, nchan_out_cldfb ); - if ( st_ivas->hHeadTrackData ) - { - nchan_out_init = MAX_INTERN_CHANNELS; - } nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; hSynthesisOutputSetup = &st_ivas->hTransSetup; } @@ -1357,17 +1465,18 @@ void ivas_param_mc_dec( hSynthesisOutputSetup = &st_ivas->hTransSetup; } - /* set everything to zero that will not be decoded */ - nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; - nbands_to_zero = hParamMC->num_freq_bands - nband_synth; - for ( ch = 0; ch < nchan_out_init; ch++ ) + /* adapt transient position */ + if ( hParamMC->hMetadataPMC->bAttackPresent ) { - for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots; slot_idx++ ) - { - set_zero( &( Cldfb_RealBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); - set_zero( &( Cldfb_ImagBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); - } + hParamMC->hMetadataPMC->attackIndex = (int16_t) max( 0, hParamMC->hMetadataPMC->attackIndex + ( ( nCldfbSlots - DEFAULT_JBM_CLDFB_TIMESLOTS ) / 2 ) ); } + /* adapt subframes */ + hParamMC->num_slots = nCldfbSlots; + hParamMC->slots_rendered = 0; + hParamMC->subframes_rendered = 0; + ivas_jbm_dec_get_adapted_subframes( nCldfbSlots, hParamMC->subframe_nbslots, &hParamMC->nb_subframes ); + + ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator ); for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ ) { @@ -1376,7 +1485,7 @@ void ivas_param_mc_dec( } /* slot loop for gathering the input data */ - for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) { float RealBuffer[CLDFB_NO_CHANNELS_MAX]; float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; @@ -1384,15 +1493,15 @@ void ivas_param_mc_dec( /* CLDFB Analysis*/ for ( ch = 0; ch < nchan_transport; ch++ ) { - cldfbAnalysis_ts( &( output_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + cldfbAnalysis_ts( &( transport_channels_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - mvr2r( RealBuffer, Cldfb_RealBuffer_in[ch][slot_idx], hParamMC->num_freq_bands ); - mvr2r( ImagBuffer, Cldfb_ImagBuffer_in[ch][slot_idx], hParamMC->num_freq_bands ); + mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); + mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); } if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex ) { - ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, cx, cx_imag, hParamMC, nchan_transport, slot_idx ); + ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], cx, cx_imag, hParamMC, nchan_transport ); } } @@ -1430,21 +1539,128 @@ void ivas_param_mc_dec( if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { - ivas_param_mc_get_mono_stereo_mixing_matrices( hParamMC, cx, mixing_matrix, mixing_matrix_res, nchan_out_transport, nchan_transport, nchan_out_cov ); + ivas_param_mc_get_mono_stereo_mixing_matrices( hParamMC, cx, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_out_transport, nchan_transport, nchan_out_cov ); } else { /* generate mixing matrices */ - ivas_param_mc_get_mixing_matrices( hParamMC, hSynthesisOutputSetup, cx, mixing_matrix, mixing_matrix_res, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); + ivas_param_mc_get_mixing_matrices( hParamMC, hSynthesisOutputSetup, cx, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); } - /* subframe loop for synthesis*/ - num_subframes = CLDFB_NO_COL_MAX / hParamMC->subframe_nbslots; - for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ ) + pop_wmops(); + + return; +} + +/*------------------------------------------------------------------------- + * ivas_param_mc_dec() + * + * Parametric MC decoding process + *------------------------------------------------------------------------*/ + +void ivas_param_mc_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ +) +{ + PARAM_MC_DEC_HANDLE hParamMC; + int16_t i, ch; + int16_t subframe_idx; + int16_t slot_idx, slot_idx_start, slot_idx_start_cldfb_synth, first_sf, last_sf, slots_to_render; + int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; + int16_t nchan_out_cov; + /*CLDFB*/ + float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + /*Decorrelator*/ + float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; + /* format converter */ + int16_t channel_active[MAX_OUTPUT_CHANNELS]; + uint16_t nband_synth, nbands_to_zero; + uint16_t nchan_out_init; + uint32_t output_Fs; + + hParamMC = st_ivas->hParamMC; + assert( hParamMC ); + + push_wmops( "param_mc_dec_render" ); + + set_s( channel_active, 0, MAX_CICP_CHANNELS ); + nchan_transport = st_ivas->nchan_transport; + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + nchan_out_init = nchan_out_transport; + output_Fs = st_ivas->hDecoderConfig->output_Fs; + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - slot_idx_start = subframe_idx * hParamMC->subframe_nbslots; + nchan_out_cldfb = BINAURAL_CHANNELS; + set_s( channel_active, 1, nchan_out_cldfb ); + if ( st_ivas->hHeadTrackData ) + { + nchan_out_init = MAX_INTERN_CHANNELS; + } + nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + } + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) + { + nchan_out_cov = nchan_out_transport; + nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + } + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + nchan_out_cldfb = nchan_out_cov; + set_s( channel_active, 1, nchan_out_cov ); + } + else + { + nchan_out_cov = nchan_out_transport; + nchan_out_cldfb = nchan_out_transport; + set_s( channel_active, 1, nchan_out_cov ); + } - for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots; slot_idx++ ) + /* set everything to zero that will not be decoded */ + nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; + nbands_to_zero = hParamMC->num_freq_bands - nband_synth; + for ( ch = 0; ch < nchan_out_init; ch++ ) + { + for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ ) + { + set_zero( &( Cldfb_RealBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); + set_zero( &( Cldfb_ImagBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); + } + } + + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( hParamMC->num_slots - hParamMC->slots_rendered, nSamplesAsked / NS2SA( output_Fs, CLDFB_SLOT_NS ) ); + *nSamplesRendered = slots_to_render * NS2SA( output_Fs, CLDFB_SLOT_NS ); + first_sf = hParamMC->subframes_rendered; + last_sf = first_sf; + while ( slots_to_render > 0 ) + { + slots_to_render -= hParamMC->subframe_nbslots[last_sf]; + last_sf++; + } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + slots_to_render += hParamMC->subframe_nbslots[subframe_idx]; + } + } + slot_idx_start = hParamMC->slots_rendered; + slot_idx_start_cldfb_synth = 0; + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; slot_idx++, hParamMC->slots_rendered++ ) { if ( hParamMC->max_band_decorr > 0 ) @@ -1453,9 +1669,10 @@ void ivas_param_mc_dec( * protoype signal computation *-----------------------------------------------------------------*/ - param_mc_protoSignalComputation( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + param_mc_protoSignalComputation( &hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], hParamMC->proto_frame_f, hParamMC->diff_proto_info, - slot_idx + slot_idx_start, hParamMC->num_freq_bands ); + hParamMC->num_freq_bands ); /*-----------------------------------------------------------------* * frequency domain decorrelation @@ -1484,8 +1701,10 @@ void ivas_param_mc_dec( * output synthesis *-----------------------------------------------------------------*/ - ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, - mixing_matrix, mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, + ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( &hParamMC->Cldfb_RealBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + &hParamMC->Cldfb_ImagBuffer_tc[hParamMC->slots_rendered * nchan_transport * hParamMC->num_freq_bands], + Cldfb_RealBuffer, Cldfb_ImagBuffer, + hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, nchan_transport, nchan_out_cov, hParamMC ); if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) @@ -1552,13 +1771,13 @@ void ivas_param_mc_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, + ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); } else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) { /* format conversion*/ - ivas_lssetupconversion_process_param_mc( st_ivas, Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active ); + ivas_lssetupconversion_process_param_mc( st_ivas, hParamMC->subframe_nbslots[subframe_idx], Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active ); } /* CLDFB synthesis */ @@ -1570,7 +1789,7 @@ void ivas_param_mc_dec( if ( channel_active[ch] ) { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hParamMC->subframe_nbslots; i++ ) + for ( i = 0; i < hParamMC->subframe_nbslots[subframe_idx]; i++ ) { if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { @@ -1583,38 +1802,409 @@ void ivas_param_mc_dec( ImagBuffer[i] = Cldfb_ImagBuffer[ch][i]; } } - - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hParamMC->num_freq_bands] ), - hParamMC->num_freq_bands * hParamMC->subframe_nbslots, st_ivas->cldfbSynDec[ch] ); + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), + hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); } else { - set_f( &( output_f[ch][slot_idx_start * hParamMC->num_freq_bands] ), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots ); + set_f( &( output_f[ch][slot_idx_start_cldfb_synth * hParamMC->num_freq_bands] ), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots[subframe_idx] ); } } + slot_idx_start += hParamMC->subframe_nbslots[subframe_idx]; + slot_idx_start_cldfb_synth += hParamMC->subframe_nbslots[subframe_idx]; } if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { - ivas_mc2sba( st_ivas->hIntSetup, output_f, hParamMC->num_freq_bands * PARAM_MC_MAX_NSLOTS, st_ivas->hOutSetup.ambisonics_order, 0.f ); + ivas_mc2sba( st_ivas->hIntSetup, output_f, output_f, hParamMC->num_freq_bands * slots_to_render, st_ivas->hOutSetup.ambisonics_order, 0.f ); } /* update */ - hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; - param_mc_update_mixing_matrices( hParamMC, mixing_matrix, mixing_matrix_res, nchan_transport, nchan_out_cov ); + if ( hParamMC->slots_rendered == hParamMC->num_slots ) + { + hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; + param_mc_update_mixing_matrices( hParamMC, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_transport, nchan_out_cov ); + } + hParamMC->subframes_rendered = last_sf; + *nSamplesAvailable = ( hParamMC->num_slots - hParamMC->slots_rendered ) * NS2SA( output_Fs, CLDFB_SLOT_NS ); pop_wmops(); return; } - +#endif /*------------------------------------------------------------------------- - * param_mc_dec_init() + * ivas_param_mc_dec() * - * Parametric MC decoding initialization + * Parametric MC decoding process *------------------------------------------------------------------------*/ +#ifdef JBM_TSM_ON_TCS +void ivas_param_mc_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ +) +{ + PARAM_MC_DEC_HANDLE hParamMC; + float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_NSLOTS * CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_NSLOTS * CLDFB_NO_CHANNELS_MAX]; + uint16_t nSamplesAsked, nSamplesAvailable, nSamplesRendered; -static void ivas_param_mc_dec_init( + hParamMC = st_ivas->hParamMC; + assert( hParamMC ); + push_wmops( "param_mc_dec" ); + + /* set some handle pointers to the stack buffers */ + hParamMC->Cldfb_RealBuffer_tc = Cldfb_RealBuffer_in; + hParamMC->Cldfb_ImagBuffer_tc = Cldfb_ImagBuffer_in; + + nSamplesAsked = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + ivas_param_mc_dec_digest_tc( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS, output_f ); + ivas_param_mc_dec_render( st_ivas, nSamplesAsked, &nSamplesRendered, &nSamplesAvailable, output_f ); +#ifdef DEBUGGING + assert( nSamplesRendered == nSamplesAsked ); + assert( nSamplesAvailable == 0 ); +#endif + + /* set handle pointers back to NULL */ + hParamMC->Cldfb_RealBuffer_tc = NULL; + hParamMC->Cldfb_ImagBuffer_tc = NULL; + + pop_wmops(); + return; +} +#else +void ivas_param_mc_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ +) +{ + PARAM_MC_DEC_HANDLE hParamMC; + int16_t i, ch; + int16_t subframe_idx; + int16_t nb_subframes; + int16_t slot_idx, param_band_idx, slot_idx_start; + int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; + int16_t nchan_out_cov; + /*CLDFB*/ + float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; + float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; + float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; + float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; + float real_part, imag_part; + /*Decorrelator*/ + float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; + /* format converter */ + int16_t channel_active[MAX_OUTPUT_CHANNELS]; + uint16_t nband_synth, nbands_to_zero; + uint16_t nchan_out_init; + IVAS_OUTPUT_SETUP *hSynthesisOutputSetup; + + hParamMC = st_ivas->hParamMC; + assert( hParamMC ); + + push_wmops( "param_mc_dec" ); + + set_s( channel_active, 0, MAX_CICP_CHANNELS ); + nchan_transport = st_ivas->nchan_transport; + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + nchan_out_init = nchan_out_transport; + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + nchan_out_cldfb = BINAURAL_CHANNELS; + set_s( channel_active, 1, nchan_out_cldfb ); + if ( st_ivas->hHeadTrackData ) + { + nchan_out_init = MAX_INTERN_CHANNELS; + } + nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + hSynthesisOutputSetup = &st_ivas->hTransSetup; + } + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) + { + nchan_out_cov = nchan_out_transport; + nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + hSynthesisOutputSetup = &st_ivas->hTransSetup; + } + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + nchan_out_cldfb = nchan_out_cov; + set_s( channel_active, 1, nchan_out_cov ); + hSynthesisOutputSetup = &st_ivas->hOutSetup; + } + else + { + nchan_out_cov = nchan_out_transport; + nchan_out_cldfb = nchan_out_transport; + set_s( channel_active, 1, nchan_out_cov ); + hSynthesisOutputSetup = &st_ivas->hTransSetup; + } + + /* set everything to zero that will not be decoded */ + nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; + nbands_to_zero = hParamMC->num_freq_bands - nband_synth; + for ( ch = 0; ch < nchan_out_init; ch++ ) + { + for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots; slot_idx++ ) + { + set_zero( &( Cldfb_RealBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); + set_zero( &( Cldfb_ImagBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); + } + } + + for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ ) + { + set_zero( cx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); + set_zero( cx_imag[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); + } + + /* slot loop for gathering the input data */ + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { + float RealBuffer[CLDFB_NO_CHANNELS_MAX]; + float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; + + /* CLDFB Analysis*/ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + cldfbAnalysis_ts( &( output_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + + mvr2r( RealBuffer, Cldfb_RealBuffer_in[ch][slot_idx], hParamMC->num_freq_bands ); + mvr2r( ImagBuffer, Cldfb_ImagBuffer_in[ch][slot_idx], hParamMC->num_freq_bands ); + } + + if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex ) + { + ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, cx, cx_imag, hParamMC, nchan_transport, slot_idx ); + } + } + + /* map from complex input covariance to real values */ + for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) + { + /* Cx for transport channels */ + for ( i = 0; i < nchan_transport * nchan_transport; i++ ) + { + real_part = cx[param_band_idx][i]; + imag_part = cx_imag[param_band_idx][i]; + + /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ + if ( param_band_idx < hParamMC->max_param_band_abs_cov ) + { + cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part ); + } + else + { + cx[param_band_idx][i] = real_part; + } + } + } + + /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/ + if ( hParamMC->hMetadataPMC->bAttackPresent && ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) ) + { + for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 ) + { + v_add( cx[param_band_idx], cx[param_band_idx + 1], cx[param_band_idx], nchan_transport * nchan_transport ); + mvr2r( cx[param_band_idx], cx[param_band_idx + 1], nchan_transport * nchan_transport ); + } + } + + + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + ivas_param_mc_get_mono_stereo_mixing_matrices( hParamMC, cx, mixing_matrix, mixing_matrix_res, nchan_out_transport, nchan_transport, nchan_out_cov ); + } + else + { + /* generate mixing matrices */ + ivas_param_mc_get_mixing_matrices( hParamMC, hSynthesisOutputSetup, cx, mixing_matrix, mixing_matrix_res, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); + } + + /*** split here... ***/ + + /* subframe loop for synthesis*/ + nb_subframes = CLDFB_NO_COL_MAX / hParamMC->subframe_nbslots; + for ( subframe_idx = 0; subframe_idx < nb_subframes; subframe_idx++ ) + { + slot_idx_start = subframe_idx * hParamMC->subframe_nbslots; + for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots; slot_idx++ ) + { + + if ( hParamMC->max_band_decorr > 0 ) + { + /*-----------------------------------------------------------------* + * protoype signal computation + *-----------------------------------------------------------------*/ + + param_mc_protoSignalComputation( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, + hParamMC->proto_frame_f, hParamMC->diff_proto_info, + slot_idx + slot_idx_start, hParamMC->num_freq_bands ); + + /*-----------------------------------------------------------------* + * frequency domain decorrelation + *-----------------------------------------------------------------*/ + + /* decorrelate prototype frame */ + ivas_dirac_dec_decorr_process( hParamMC->num_freq_bands, + hParamMC->num_outputs_diff, + hParamMC->diff_proto_info->num_protos_diff, + DIRAC_SYNTHESIS_COV_MC_LS, + nchan_transport, + hParamMC->proto_frame_f, + hParamMC->diff_proto_info->num_protos_diff, + hParamMC->diff_proto_info->proto_index_diff, + hParamMC->proto_frame_dec_f, + onset_filter, + hParamMC->h_freq_domain_decorr_ap_params, + hParamMC->h_freq_domain_decorr_ap_state ); + + /* copy decorrelated frame directly to output CLDFB buffer, acts also as intermediate */ + /* memory for the decorrelated signal */ + ivas_param_mc_dec_copy_diffuse_proto( hParamMC, Cldfb_RealBuffer, Cldfb_ImagBuffer, nchan_out_cov, slot_idx ); + } + + /*-----------------------------------------------------------------* + * output synthesis + *-----------------------------------------------------------------*/ + + ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, + mixing_matrix, mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, + nchan_transport, nchan_out_cov, hParamMC ); + + if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) + { + if ( st_ivas->hHeadTrackData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE ); + } + else + { + /* remove LFE */ + uint16_t idx_out; + uint16_t idx_lfe; + IVAS_OUTPUT_SETUP hLsSetup; + + hLsSetup = st_ivas->hTransSetup; + + /* If LFE should be rendered, add it to other channels before removing */ + if ( st_ivas->hBinRenderer->render_lfe ) + { + for ( idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++ ) + { + /* Copy just the first band of LFE*/ + v_multc( Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); + v_multc( Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); + + for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) + { + if ( hLsSetup.index_lfe[idx_lfe] != ch ) + { + v_add( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer[ch][slot_idx], 1 ); + v_add( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], 1 ); + } + } + } + } + + idx_out = 0; + idx_lfe = 0; + + for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) + { + if ( ( hLsSetup.num_lfe > 0 ) && ( hLsSetup.index_lfe[idx_lfe] == ch ) ) + { + if ( idx_lfe < ( hLsSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else if ( ch != idx_out ) + { + mvr2r( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[idx_out][slot_idx], nband_synth ); + mvr2r( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[idx_out][slot_idx], nband_synth ); + idx_out++; + } + else + { + idx_out++; + } + } + } + } + } + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); + } + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) + { + /* format conversion*/ + ivas_lssetupconversion_process_param_mc( st_ivas, Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active ); + } + + /* CLDFB synthesis */ + for ( ch = 0; ch < nchan_out_cldfb; ch++ ) + { + float *RealBuffer[16]; + float *ImagBuffer[16]; + + if ( channel_active[ch] ) + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + for ( i = 0; i < hParamMC->subframe_nbslots; i++ ) + { + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; + } + else + { + RealBuffer[i] = Cldfb_RealBuffer[ch][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[ch][i]; + } + } + cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hParamMC->num_freq_bands] ), + hParamMC->num_freq_bands * hParamMC->subframe_nbslots, st_ivas->cldfbSynDec[ch] ); + } + else + { + set_f( &( output_f[ch][slot_idx_start * hParamMC->num_freq_bands] ), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots ); + } + } + } + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_mc2sba( st_ivas->hIntSetup, output_f, hParamMC->num_freq_bands * PARAM_MC_MAX_NSLOTS, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + + /* update */ + hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; + param_mc_update_mixing_matrices( hParamMC, mixing_matrix, mixing_matrix_res, nchan_transport, nchan_out_cov ); + pop_wmops(); + + return; +} +#endif + + +/*------------------------------------------------------------------------- + * param_mc_dec_init() + * + * Parametric MC decoding initialization + *------------------------------------------------------------------------*/ + +static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder DirAC handle */ const int16_t nchan_transport, /* i : number of input (transport) channels */ const int16_t nchan_cov ) /* i : number of cov synthesis channels */ @@ -1680,12 +2270,19 @@ static void ivas_param_mc_dec_init( *------------------------------------------------------------------------*/ static void param_mc_protoSignalComputation( +#ifdef JBM_TSM_ON_TCS + float *RealBuffer, /* i : CLDFB samples of the transport channels (real part) */ + float *ImagBuffer, /* i : CLDFB samples of the transport channels (imaginary part) */ +#else float RealBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (real part) */ float ImagBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (imaginary part) */ - float *proto_frame_f, /* o : interleaved complex prototype CLDFB samples */ - const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, /* i : prototype generation information */ - const int16_t slot_index, /* i : current slot index */ - const int16_t num_freq_bands /* i : number of frequency bands for the prototypes */ +#endif + float *proto_frame_f, /* o : interleaved complex prototype CLDFB samples */ + const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, /* i : prototype generation information */ +#ifndef JBM_TSM_ON_TCS + const int16_t slot_index, /* i : current slot index */ +#endif + const int16_t num_freq_bands /* i : number of frequency bands for the prototypes */ ) { int16_t band; @@ -1706,8 +2303,13 @@ static void param_mc_protoSignalComputation( int16_t source_ch_idx = diff_proto_info->source_chan_idx[proto_ch_idx][source_ch_cnt]; p_proto_frame = &proto_frame_f[proto_ch_idx * num_freq_bands * 2]; +#ifdef JBM_TSM_ON_TCS + p_real_buffer = &RealBuffer[source_ch_idx * num_freq_bands]; + p_imag_buffer = &ImagBuffer[source_ch_idx * num_freq_bands]; +#else p_real_buffer = &RealBuffer[source_ch_idx][slot_index][0]; p_imag_buffer = &ImagBuffer[source_ch_idx][slot_index][0]; +#endif for ( band = 0; band < num_freq_bands; band++ ) { @@ -1814,6 +2416,7 @@ static int16_t ivas_param_mc_uniform_decoder( return n_bits; } + /*------------------------------------------------------------------------- * ivas_param_mc_range_decoder_LC() * @@ -1872,20 +2475,24 @@ static int16_t ivas_param_mc_range_decoder_LC( return cur_bit_pos; } + /*------------------------------------------------------------------------- * param_mc_compute_interpolator() * * compute the interpolator used in the final synthesis *------------------------------------------------------------------------*/ - -static void param_mc_compute_interpolator( +static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresent, /* i : flag indicating if we have a transient in the current frame */ const uint16_t attackPos, /* i : position of the transient */ const uint16_t interp_length, /* i : number of interpolation values to be calculated */ float *interpolator /* o : interpolator */ ) { +#ifdef JBM_TSM_ON_TCS + int16_t idx; +#else uint16_t idx; +#endif if ( bAttackPresent ) { @@ -1900,10 +2507,14 @@ static void param_mc_compute_interpolator( } else { +#ifdef JBM_TSM_ON_TCS + ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, interp_length, interpolator ); +#else for ( idx = 1; idx <= interp_length; ++idx ) { interpolator[idx - 1] = (float) idx / (float) interp_length; } +#endif } return; @@ -1947,9 +2558,11 @@ static void remove_lfe_from_cy( } ptrCy += nY; } + return; } + /*------------------------------------------------------------------------- * ivas_param_mc_get_mixing_matrices() * @@ -1961,12 +2574,17 @@ static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */ - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : direct mixing matrices for all parameter bands */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* o : residual mixing matrices for all parameter bands */ - const int16_t nY_intern, /* i : number of channels in the transported format */ - const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ - const int16_t nX, /* i : number of transport channels */ - const int16_t nY_cov /* i : number of covariance synthesis output channels */ +#ifdef JBM_TSM_ON_TCS + float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ + float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ +#else + float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : direct mixing matrices for all parameter bands */ + float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* o : residual mixing matrices for all parameter bands */ +#endif + const int16_t nY_intern, /* i : number of channels in the transported format */ + const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ + const int16_t nX, /* i : number of transport channels */ + const int16_t nY_cov /* i : number of covariance synthesis output channels */ ) { int16_t param_band_idx; @@ -2215,11 +2833,16 @@ static void ivas_param_mc_get_mixing_matrices( static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : transport channel covariance for all parameter bands */ - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : direct mixing matrix */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* o : residual mixing matrix (set to zero) */ - const int16_t nY_intern, /* i : number of channels of the transport format */ - const int16_t nX, /* i : number of transport channels */ - const int16_t nY_cov ) /* i : number of output channels */ +#ifdef JBM_TSM_ON_TCS + float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ + float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ +#else + float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : direct mixing matrix */ + float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* o : residual mixing matrix (set to zero) */ +#endif + const int16_t nY_intern, /* i : number of channels of the transport format */ + const int16_t nX, /* i : number of transport channels */ + const int16_t nY_cov ) /* i : number of output channels */ { int16_t param_band_idx; float Cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -2326,6 +2949,7 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( return; } + /*------------------------------------------------------------------------- * param_mc_update_mixing_matrices() * @@ -2333,17 +2957,21 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( *------------------------------------------------------------------------*/ static void param_mc_update_mixing_matrices( - PARAM_MC_DEC_HANDLE hParamMC, /* i/o: Parametric MC handle */ + PARAM_MC_DEC_HANDLE hParamMC, /* i/o: Parametric MC handle */ +#ifdef JBM_TSM_ON_TCS + float *mixing_matrix[], /* i : direct mixing matrices for the frame just processed */ + float *mixing_matrix_res[], /* i : residual mixing matrices for the frame just processed */ +#else float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : direct mixing matrices for the frame just processed */ float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : residual mixing matrices for the frame just processed */ - const uint16_t nX, /* i : number of transport channels */ - const uint16_t nY ) /* i : number of synthesis channels */ +#endif + const uint16_t nX, /* i : number of transport channels */ + const uint16_t nY ) /* i : number of synthesis channels */ { uint16_t param_band_idx; for ( param_band_idx = 0; param_band_idx < hParamMC->hMetadataPMC->nbands_coded; param_band_idx++ ) { - /* final mixing */ int16_t brange[2]; brange[0] = hParamMC->band_grouping[param_band_idx]; @@ -2360,6 +2988,7 @@ static void param_mc_update_mixing_matrices( return; } + /*------------------------------------------------------------------------- * ivas_param_mc_dequantize_cov() * @@ -2569,13 +3198,14 @@ static void param_mc_set_num_synth_bands( return; } + /*-------------------------------------------------------------------------* * param_mc_get_diff_proto_info() * * calculated the diffuse prototype information *-------------------------------------------------------------------------*/ -static void param_mc_get_diff_proto_info( +static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, /* i : protoype matrix for the synthesis */ const uint16_t nchan_transport, /* i : number of transport channels */ const uint16_t nchan_out_cov, /* i : number if output channels of the covariance synthesis */ @@ -2591,9 +3221,16 @@ static void param_mc_get_diff_proto_info( /* Initializations */ max_num_src_chan = 0; set_zero( proto_fac, MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS ); - p_diff_proto_info->proto_index_diff = (int16_t *) malloc( nchan_out_cov * sizeof( int16_t ) ); + if ( ( p_diff_proto_info->proto_index_diff = (int16_t *) malloc( nchan_out_cov * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_s( p_diff_proto_info->proto_index_diff, 0, nchan_out_cov ); - p_diff_proto_info->num_source_chan_diff = (int16_t *) malloc( nchan_out_cov * sizeof( int16_t ) ); + + if ( ( p_diff_proto_info->num_source_chan_diff = (int16_t *) malloc( nchan_out_cov * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } set_s( p_diff_proto_info->num_source_chan_diff, 0, nchan_out_cov ); /* we have at least one prototype, copy the first one */ @@ -2652,17 +3289,28 @@ static void param_mc_get_diff_proto_info( } } - /* set up the prototype info struct */ - p_diff_proto_info->source_chan_idx = (int16_t **) malloc( p_diff_proto_info->num_protos_diff * sizeof( int16_t * ) ); - p_diff_proto_info->proto_fac = (float **) malloc( p_diff_proto_info->num_protos_diff * sizeof( float * ) ); + if ( ( p_diff_proto_info->source_chan_idx = (int16_t **) malloc( p_diff_proto_info->num_protos_diff * sizeof( int16_t * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( p_diff_proto_info->proto_fac = (float **) malloc( p_diff_proto_info->num_protos_diff * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } for ( cur_diff_proto = 0; cur_diff_proto < p_diff_proto_info->num_protos_diff; cur_diff_proto++ ) { float *proto_fac_ptr; - p_diff_proto_info->source_chan_idx[cur_diff_proto] = (int16_t *) malloc( max_num_src_chan * sizeof( int16_t ) ); - p_diff_proto_info->proto_fac[cur_diff_proto] = (float *) malloc( max_num_src_chan * sizeof( float ) ); + if ( ( p_diff_proto_info->source_chan_idx[cur_diff_proto] = (int16_t *) malloc( max_num_src_chan * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } + if ( ( p_diff_proto_info->proto_fac[cur_diff_proto] = (float *) malloc( max_num_src_chan * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); + } proto_fac_ptr = proto_fac + cur_diff_proto; for ( cur_transport_ch = 0; cur_transport_ch < nchan_transport; cur_transport_ch++ ) @@ -2677,8 +3325,7 @@ static void param_mc_get_diff_proto_info( } } - - return; + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c new file mode 100644 index 0000000000000000000000000000000000000000..5b04578c847968d22a119522445036163d286d96 --- /dev/null +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -0,0 +1,696 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include +#include "cnst.h" +#include "prot.h" +#include "ivas_prot.h" +#include "ivas_cnst.h" +#include "ivas_rom_com.h" +#include "ivas_rom_dec.h" +#include "math.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif +#include "wmc_auto.h" +#include "rom_dec.h" + +#ifdef MC_PARAMUPMIX_MODE +/*-----------------------------------------------------------------------* + * Local function prototypes + *-----------------------------------------------------------------------*/ +static void ps_pred_process( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, float qmf_mod_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], int16_t ch ); + +static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], float pcm_in[][L_FRAME48k], float **pp_out_pcm, const int16_t output_frame ); + +static int huff_read( Decoder_State *st, const int16_t ( *ht )[2] ); + +static void huffman_decode( Decoder_State *st, int16_t nv, int16_t ivStart, PAR_TYPE parType, QUANT_TYPE quant_type, int16_t bNoDt, int32_t *vq ); + +static void dequant_alpha( int16_t nv, int16_t ivStart, QUANT_TYPE quant_type, int32_t *vq, float *v ); + +static void dequant_beta( int16_t nv, int16_t ivStart, QUANT_TYPE quant_type, int32_t *aq, int32_t *bq, float *beta ); + +static void get_ec_data( Decoder_State *st, PAR_TYPE parType, QUANT_TYPE quant_type, int16_t nParBand, int16_t parBandStart, int32_t *parQ, int32_t *alphaQEnv, float ab[IVAS_MAX_NUM_BANDS] ); + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_read_BS() + * + * Read the ParamUpmix MC metadata + *------------------------------------------------------------------------*/ + +void ivas_mc_paramupmix_dec_read_BS( + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + Decoder_State *st, /* i/o: decoder state structure */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + int16_t *nb_bits /* o : number of bits written */ +) +{ + int16_t i, k; + int32_t alpha_quant[IVAS_MAX_NUM_BANDS]; + int16_t nb_bits_read_orig; + int16_t next_bit_pos_orig, last_bit_pos; + uint16_t bstr_meta[MAX_BITS_METADATA], *bit_stream_orig; + + push_wmops( "mc_paramupmix_read_bs" ); + *nb_bits = 0; + + if ( st->bfi ) + { + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) + { + hMCParamUpmix->alphas[i][k] = hMCParamUpmix->alpha_prev[i][k]; + hMCParamUpmix->betas[i][k] = hMCParamUpmix->beta_prev[i][k]; + } + } + hMCParamUpmix->first_frame = 1; + } + else /* if (!st->bfi) */ + { + bit_stream_orig = st->bit_stream; + next_bit_pos_orig = st->next_bit_pos; + last_bit_pos = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); + nb_bits_read_orig = 0; + last_bit_pos -= nb_bits_read_orig; /* reverse the bitstream for easier reading of indices */ + for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) + { + bstr_meta[i] = st_ivas->bit_stream[last_bit_pos - i]; + } + st->bit_stream = bstr_meta; + st->next_bit_pos = 0; + st->bits_frame = min( MAX_BITS_METADATA, last_bit_pos + 1 ); + st->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; /* to avoid BER detect */ + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + get_ec_data( st, ALPHA, FINE /*quant_type*/, IVAS_MAX_NUM_BANDS /*nParBand*/, + 0 /*parBandStart*/, hMCParamUpmix->alpha_quant[i], alpha_quant, hMCParamUpmix->alphas[i] ); + + get_ec_data( st, BETA, FINE /*quant_type*/, IVAS_MAX_NUM_BANDS /*nParBand*/, + 0 /*parBandStart*/, hMCParamUpmix->beta_quant[i], alpha_quant, hMCParamUpmix->betas[i] ); + } + *nb_bits += st->next_bit_pos; + st->bit_stream = bit_stream_orig; + st->next_bit_pos = next_bit_pos_orig; + + if ( hMCParamUpmix->first_frame ) + { + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + mvr2r( hMCParamUpmix->alphas[i], hMCParamUpmix->alpha_prev[i], IVAS_MAX_NUM_BANDS ); + mvr2r( hMCParamUpmix->betas[i], hMCParamUpmix->beta_prev[i], IVAS_MAX_NUM_BANDS ); + } + hMCParamUpmix->first_frame = 0; + } + } + + pop_wmops(); + + return; +} + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec() + * + * MC ParamUpmix decoding process + *------------------------------------------------------------------------*/ +void ivas_mc_paramupmix_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels */ +) +{ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + int16_t i, k, ch; + int16_t slot_idx; + int16_t first_empty_channel; + int16_t nchan_out_transport; + /*CLDFB*/ + float Cldfb_RealBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + int16_t channel_active[MAX_OUTPUT_CHANNELS]; + int32_t output_Fs; + int16_t output_frame; + float Pcm_decorr[MC_PARAMUPMIX_COMBINATIONS][L_FRAME48k]; /* decorrelated channels */ + float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ + int16_t noparamupmix_delay; + AUDIO_CONFIG output_config; + + hMCParamUpmix = st_ivas->hMCParamUpmix; + assert( hMCParamUpmix ); + + push_wmops( "mc_paramupmix_dec" ); + + set_s( channel_active, 0, MAX_CICP_CHANNELS ); + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + set_s( channel_active, 1, nchan_out_transport ); /* change to nchan_out_transport */ + output_Fs = st_ivas->hDecoderConfig->output_Fs; + output_config = st_ivas->hDecoderConfig->output_config; + output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); + + if ( ( output_config == AUDIO_CONFIG_STEREO ) || ( output_config == AUDIO_CONFIG_MONO ) ) + { + first_empty_channel = 8; /* Don't upmix */ + } + else + { + first_empty_channel = 12; + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + pPcm_temp[i] = Pcm_decorr[i]; /* decorrelated */ + } + + paramupmix_td_decorr_process( hMCParamUpmix->hTdDecorr, &( output_f[4] ), pPcm_temp, output_frame ); + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + pPcm_temp[2 * i] = output_f[i + 4]; /* un-decorrelated */ + pPcm_temp[2 * i + 1] = Pcm_decorr[i]; /* decorrelated */ + } + + /* CLDFB Analysis*/ + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ ) + { + /* slot loop for gathering the input data */ + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { + cldfbAnalysis_ts( &( pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), Cldfb_RealBuffer[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], hMCParamUpmix->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + } + } + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) + { + ps_pred_process( hMCParamUpmix, + Cldfb_RealBuffer[2 * ch], /* in/out */ + Cldfb_ImagBuffer[2 * ch], + Cldfb_RealBuffer[2 * ch + 1], /* in/out decorr */ + Cldfb_ImagBuffer[2 * ch + 1], + ch ); + + /*-- m, s -> l, r ----------------------------*/ + for ( i = 0; i < CLDFB_NO_COL_MAX; i++ ) + { + for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) + { + float qlre = Cldfb_RealBuffer[2 * ch][i][k]; + float qlim = Cldfb_ImagBuffer[2 * ch][i][k]; + float qrre = Cldfb_RealBuffer[2 * ch + 1][i][k]; + float qrim = Cldfb_ImagBuffer[2 * ch + 1][i][k]; + + Cldfb_RealBuffer[2 * ch][i][k] = qlre + qrre; + Cldfb_ImagBuffer[2 * ch][i][k] = qlim + qrim; + Cldfb_RealBuffer[2 * ch + 1][i][k] = qlre - qrre; + Cldfb_ImagBuffer[2 * ch + 1][i][k] = qlim - qrim; + } + } + + mvr2r( hMCParamUpmix->alphas[ch], hMCParamUpmix->alpha_prev[ch], IVAS_MAX_NUM_BANDS ); + mvr2r( hMCParamUpmix->betas[ch], hMCParamUpmix->beta_prev[ch], IVAS_MAX_NUM_BANDS ); + } + + /* boxes = { 0 1 2 3 [4 6] [5 7] [8 10] [9 11] }; */ + pPcm_temp[0] = output_f[4]; + pPcm_temp[1] = output_f[6]; + pPcm_temp[2] = output_f[5]; + pPcm_temp[3] = output_f[7]; + pPcm_temp[4] = output_f[8]; + pPcm_temp[5] = output_f[10]; + pPcm_temp[6] = output_f[9]; + pPcm_temp[7] = output_f[11]; + + /* CLDFB synthesis */ + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ ) + { + for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) + { + float *ptr_im[1], *ptr_re[1]; + ptr_re[0] = Cldfb_RealBuffer[ch][slot_idx]; + ptr_im[0] = Cldfb_ImagBuffer[ch][slot_idx]; + + cldfbSynthesis( ptr_re, ptr_im, &( pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), + hMCParamUpmix->num_freq_bands, st_ivas->cldfbSynDec[ch] ); + } + } + + /* adjust delay of other channels */ + noparamupmix_delay = NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ); + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) + { + float tmp_buf[L_SUBFRAME5MS_48k]; + mvr2r( &output_f[ch][output_frame - noparamupmix_delay], tmp_buf, noparamupmix_delay ); + mvr2r( output_f[ch], &output_f[ch][noparamupmix_delay], output_frame - noparamupmix_delay ); + mvr2r( hMCParamUpmix->pcm_delay[ch], output_f[ch], noparamupmix_delay ); + mvr2r( tmp_buf, hMCParamUpmix->pcm_delay[ch], noparamupmix_delay ); + } + } + + for ( ch = first_empty_channel; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + set_f( output_f[ch], 0.0, L_FRAME48k ); + } + pop_wmops(); + + return; +} + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_getNumTransportChannels() + * + * + *------------------------------------------------------------------------*/ +int16_t ivas_mc_paramupmix_getNumTransportChannels() +{ + int16_t nchan_transport; + nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; /* 5.1.2 */ + return nchan_transport; +} + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_open() + * + * Open Parametric MC decoder handle + *-------------------------------------------------------------------------*/ + +ivas_error ivas_mc_paramupmix_dec_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + int32_t output_Fs; + int16_t nchan_transport; + uint16_t i; + ivas_error error; + + error = IVAS_ERR_OK; + + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ( ( hMCParamUpmix = (MC_PARAMUPMIX_DEC_HANDLE) malloc( sizeof( MC_PARAMUPMIX_DEC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param-Upmix MC\n" ) ); + } + output_Fs = st_ivas->hDecoderConfig->output_Fs; + hMCParamUpmix->first_frame = 1; + + st_ivas->nchan_transport = ivas_mc_paramupmix_getNumTransportChannels(); + nchan_transport = st_ivas->nchan_transport; + + switch ( nchan_transport ) + { + case 8: + st_ivas->nCPE = 4; + st_ivas->nSCE = 0; + st_ivas->element_mode_init = IVAS_CPE_MDCT; + break; +#ifdef DEBUGGING + default: + assert( 0 && "Number of TC not supported for MC ParamUpmix!" ); +#endif + } + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ + + hMCParamUpmix->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + ivas_td_decorr_dec_open( &( hMCParamUpmix->hTdDecorr[i] ), output_Fs, 2, 1 ); + } + + for ( i = 0; i < MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; i++ ) + { + if ( ( hMCParamUpmix->pcm_delay[i] = (float *) malloc( 240 * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for delay buffer\n" ) ); + } + set_zero( hMCParamUpmix->pcm_delay[i], 240 ); + } + + st_ivas->hMCParamUpmix = hMCParamUpmix; + + return error; +} + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_close() + * + * Close ParamUpmix MC memories + *------------------------------------------------------------------------*/ + +void ivas_mc_paramupmix_dec_close( + MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix /* i/o: Parametric MC decoder handle */ +) +{ + int16_t i; + + if ( hMCParamUpmix == NULL || *hMCParamUpmix == NULL ) + { + return; + } + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + ivas_td_decorr_dec_close( &( ( *hMCParamUpmix )->hTdDecorr[i] ) ); + } + for ( i = 0; i < MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; i++ ) + { + if ( ( *hMCParamUpmix )->pcm_delay[i] != NULL ) + { + free( ( *hMCParamUpmix )->pcm_delay[i] ); + } + } + free( *hMCParamUpmix ); + + *hMCParamUpmix = NULL; + + return; +} + +/*****************************************************************************************/ +/* local functions */ +/*****************************************************************************************/ + +static void ps_pred_process( + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, + float qmf_mod_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* in/out */ + float qmf_mod_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float qmf_side_re[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* in/out */ + float qmf_side_im[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + int16_t ch ) +{ + float vmre, vmim, vsre, vsim; + int16_t iqmf, ipar, ismp, iismp; + float alpha_smp, dalpha, beta_smp, dbeta; + float *alpha1, *alpha2; + float *beta1, *beta2; + float *alpha_prev = hMCParamUpmix->alpha_prev[ch]; + float *beta_prev = hMCParamUpmix->beta_prev[ch]; + + int16_t qmf_to_par_band[] = { + 0, 1, 2, 3, 4, 5, 5, 6, 6, 7, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 + }; + + for ( iqmf = 0; iqmf < CLDFB_NO_CHANNELS_MAX; iqmf++ ) + { + /* For changing no of parameter bands (ipar1 != ipar2), TIGGER_FRAMING assumed */ + ipar = qmf_to_par_band[iqmf]; + alpha1 = alpha_prev; + beta1 = beta_prev; + + ismp = 0; + alpha2 = hMCParamUpmix->alphas[ch]; + beta2 = hMCParamUpmix->betas[ch]; + alpha_smp = alpha1[ipar]; + beta_smp = beta1[ipar]; + dalpha = ( alpha2[ipar] - alpha1[ipar] ) / CLDFB_NO_COL_MAX; + dbeta = ( beta2[ipar] - beta1[ipar] ) / CLDFB_NO_COL_MAX; + + for ( iismp = 0; iismp < CLDFB_NO_COL_MAX; iismp++ ) + { + alpha_smp += dalpha; + beta_smp += dbeta; + + vmre = qmf_mod_re[ismp][iqmf]; + vmim = qmf_mod_im[ismp][iqmf]; + vsre = qmf_side_re[ismp][iqmf]; + vsim = qmf_side_im[ismp][iqmf]; + + qmf_side_re[ismp][iqmf] = alpha_smp * vmre + beta_smp * vsre; + qmf_side_im[ismp][iqmf] = alpha_smp * vmim + beta_smp * vsim; + + ismp++; + } + + alpha1 = alpha2; + beta1 = beta2; + } +} + +static void paramupmix_td_decorr_process( + ivas_td_decorr_state_t *hTdDecorr[], /* i/o: SPAR Covar. decoder handle */ + float pcm_in[][L_FRAME48k], /* i : input audio channels */ + float **pp_out_pcm, /* o : output audio channels */ + const int16_t output_frame /* i : output frame length */ +) +{ + int16_t j, k; + int16_t offset; + float in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k]; + + offset = (int16_t) ( output_frame * FRAMES_PER_SEC * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); + + /* Look-ahead delay */ + for ( k = 0; k < MC_PARAMUPMIX_COMBINATIONS; k++ ) + { + mvr2r( pcm_in[k], pp_out_pcm[k], output_frame ); + delay_signal( pp_out_pcm[k], output_frame, hTdDecorr[k]->look_ahead_buf, offset ); + + /* In ducking gains */ + if ( hTdDecorr[k]->ducking_flag ) + { + ivas_td_decorr_get_ducking_gains( hTdDecorr[k]->pTrans_det, pcm_in[k], in_duck_gain, out_duck_gain, output_frame, 0 ); + + for ( j = 0; j < output_frame; j++ ) + { + pp_out_pcm[k][j] = pp_out_pcm[k][j] * in_duck_gain[j]; + } + } + + /* All pass delay section */ + ivas_td_decorr_APD_iir_filter( &hTdDecorr[k]->APD_filt_state[0], pp_out_pcm[k], hTdDecorr[k]->num_apd_sections, output_frame ); + + /* Out ducking gains */ + if ( hTdDecorr[k]->ducking_flag ) + { + for ( j = 0; j < output_frame; j++ ) + { + pp_out_pcm[k][j] = pp_out_pcm[k][j] * out_duck_gain[j]; + } + } + } + + return; +} + +static int huff_read( + Decoder_State *st, + const int16_t ( *ht )[2] ) +{ + int16_t node = 0; + uint16_t next_bit = 0; + + do + { + next_bit = st->bit_stream[st->next_bit_pos]; + st->next_bit_pos++; + node = ht[node][next_bit]; + } while ( node > 0 ); + + return -( node + 1 ); +} + +static void huffman_decode( + Decoder_State *st, + int16_t nv, + int16_t ivStart, + PAR_TYPE parType, + QUANT_TYPE quant_type, + int16_t bNoDt, + int32_t *vq ) +{ + const int16_t( *huff_node_table )[2]; + int16_t iv, bdt, nquant, offset; + + + nquant = 0; + switch ( parType ) + { + case ALPHA: + nquant = alpha_quant_table[quant_type].nquant; + break; + case BETA: + nquant = beta_quant_table[quant_type][0].nquant; + break; + default: + assert( 0 ); + } + + offset = nquant - 1; /* range of df/dt [-(nquant - 1), nquant - 1] */ + + if ( bNoDt ) + { + bdt = 0; + } + else + { + bdt = st->bit_stream[st->next_bit_pos]; + st->next_bit_pos++; + } + if ( bdt ) + { /* Get dt */ + switch ( parType ) + { + case ALPHA: + huff_node_table = huff_nodes_dt.alpha[quant_type]; + break; + case BETA: + huff_node_table = huff_nodes_dt.beta[quant_type]; + break; + default: + huff_node_table = NULL; + assert( 0 ); + } + for ( iv = ivStart; iv < nv; iv++ ) + { + vq[iv] = huff_read( st, huff_node_table ) + vq[iv] - offset; + } + } + else /* Get f0, df */ + { + switch ( parType ) + { + case ALPHA: + huff_node_table = huff_nodes_df0.alpha[quant_type]; + break; + case BETA: + huff_node_table = huff_nodes_df0.beta[quant_type]; + break; + default: + huff_node_table = NULL; + assert( 0 ); + } + vq[ivStart] = huff_read( st, huff_node_table ); + + switch ( parType ) + { + case ALPHA: + huff_node_table = huff_nodes_df.alpha[quant_type]; + break; + case BETA: + huff_node_table = huff_nodes_df.beta[quant_type]; + break; + default: + assert( 0 ); + } + + for ( iv = ivStart + 1; iv < nv; iv++ ) + { + vq[iv] = huff_read( st, huff_node_table ) + vq[iv - 1] - offset; + } + } +} + +static void dequant_alpha( + int16_t nv, + int16_t ivStart, + QUANT_TYPE quant_type, + int32_t *vq, + float *v ) +{ + int16_t iv; + ACPL_QUANT_TABLE *quant_table = &alpha_quant_table[quant_type]; + + for ( iv = 0; iv < ivStart; iv++ ) + { + v[iv] = 0; + } + + for ( iv = ivStart; iv < nv; iv++ ) + { + v[iv] = quant_table->data[vq[iv]]; + } +} + +static void dequant_beta( + int16_t nv, + int16_t ivStart, + QUANT_TYPE quant_type, + int32_t *aq, + int32_t *bq, + float *beta ) +{ + int16_t iv; + ACPL_QUANT_TABLE *quant_table; + const int16_t qmap[2][33] = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0 } + }; + + for ( iv = 0; iv < ivStart; iv++ ) + { + beta[iv] = 0; + } + + for ( iv = ivStart; iv < nv; iv++ ) + { + quant_table = &beta_quant_table[quant_type][qmap[quant_type][aq[iv]]]; + beta[iv] = quant_table->data[bq[iv]]; + } +} + +static void get_ec_data( + Decoder_State *st, + PAR_TYPE parType, + QUANT_TYPE quant_type, + int16_t nParBand, + int16_t parBandStart, + int32_t *parQ, + int32_t *alphaQEnv, + float ab[IVAS_MAX_NUM_BANDS] ) +{ + huffman_decode( st, nParBand, parBandStart, parType, quant_type, 0, parQ ); + if ( parType == ALPHA ) + { + dequant_alpha( nParBand, parBandStart, quant_type, parQ, ab ); + mvl2l( parQ, alphaQEnv, (int16_t) nParBand ); + } + else + { + dequant_beta( nParBand, parBandStart, quant_type, alphaQEnv, parQ, ab ); + } +} + +#endif diff --git a/lib_dec/ivas_mcmasa_dec.c b/lib_dec/ivas_mcmasa_dec.c old mode 100644 new mode 100755 index 3af2ea2c3b3558ccd3e7b2f32b6dc4a41c5b300a..59d215e22ca4abfb1e784903fc1bc055efe51da6 --- a/lib_dec/ivas_mcmasa_dec.c +++ b/lib_dec/ivas_mcmasa_dec.c @@ -34,6 +34,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. #include #include "ivas_cnst.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "prot.h" #ifdef DEBUGGING #include "debug.h" @@ -57,16 +58,15 @@ ivas_error ivas_mcmasa_dec_reconfig( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; /* close the old MASA instance */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_dec_close( st_ivas->hMasa ); - } + ivas_masa_dec_close( &( st_ivas->hMasa ) ); /* get new McMASA settings */ ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hOutSetup.separateChannelEnabled ), &( st_ivas->hOutSetup.separateChannelIndex ), ivas_total_brate ); + /* transport channel settings may affect renderer */ ivas_renderer_select( st_ivas ); + /* renderer change may affect internal config */ ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hIntSetup.separateChannelEnabled ), &( st_ivas->hIntSetup.separateChannelIndex ), ivas_total_brate ); @@ -76,7 +76,7 @@ ivas_error ivas_mcmasa_dec_reconfig( return error; } - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && st_ivas->hOutSetup.output_config == AUDIO_CONFIG_STEREO ); + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) { @@ -109,7 +109,6 @@ ivas_error ivas_mcmasa_dec_reconfig( if ( st_ivas->hDiracDecBin == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { /* open parametric binaural renderer */ -#ifdef HRTF_BINARY_FILE if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -119,9 +118,6 @@ ivas_error ivas_mcmasa_dec_reconfig( } if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -135,20 +131,27 @@ ivas_error ivas_mcmasa_dec_reconfig( } else { +#ifdef FIX_417_TD_DECORR_BRATE_SW + /* if necessary, close/open td-decorrs */ + 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, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* regularization factor is bitrate-dependent */ + st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); +#else /* the decision for useTdDecorr is done in ivas_dirac_dec_init_binaural_data(). here, comparing against the same condition. */ - if ( st_ivas->hDiracDecBin->useTdDecorr != ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_48k && st_ivas->nchan_transport == 1 ) ) + if ( st_ivas->hDiracDecBin->useTdDecorr != ( ivas_total_brate < IVAS_48k && st_ivas->nchan_transport == 1 ) ) { /* st_ivas->hDiracDecBin->useTdDecorr will change => close and re-open. */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } } +#endif } } diff --git a/lib_dec/ivas_mct_core_dec.c b/lib_dec/ivas_mct_core_dec.c index 7e11b23c9a91da28664cd07c259ea63e26b6e429..6c5e6575a68a95f7771c605fdddc785335a3e4fc 100644 --- a/lib_dec/ivas_mct_core_dec.c +++ b/lib_dec/ivas_mct_core_dec.c @@ -70,7 +70,7 @@ void ivas_mct_side_bits( Decoder_State *st, *sts[MCT_MAX_CHANNELS]; nf_side_bits = 0; - nChannels = hMCT->nchan_out_woLFE + hMCT->num_lfe; + nChannels = hMCT->nchan_out_woLFE; /*initializations */ for ( cpe_id = 0, i = 0; cpe_id < nCPE; cpe_id++ ) @@ -88,7 +88,8 @@ void ivas_mct_side_bits( for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -108,15 +109,14 @@ void ivas_mct_side_bits( availableBits = 0; ivas_mct_dec_mct( hMCT, sts, nChannels ); - /* availableBits = ((hMCT->mc_bitrate/50) - sts[0]->next_bit_pos); - availableBits -= NBBITS_MCT_RATIO * nChannels;*/ /*read channel bitrate ratios from bitstream*/ for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && hMCT->LFE_off ) || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { chBitRatios[ch] = 0; st->bits_frame_channel = 0; @@ -189,7 +189,7 @@ void ivas_mct_core_dec( * Initializations *--------------------------------------------------------------------------------*/ - nChannels = hMCT->nchan_out_woLFE + hMCT->num_lfe; + nChannels = hMCT->nchan_out_woLFE; /*initializations */ for ( cpe_id = 0, i = 0; cpe_id < nCPE; cpe_id++ ) @@ -203,7 +203,8 @@ void ivas_mct_core_dec( for ( ch = 0, i = 0; ch < nChannels; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -232,7 +233,8 @@ void ivas_mct_core_dec( { st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) /*indicates LFE */ + if ( + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) /*indicates LFE */ { continue; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c old mode 100644 new mode 100755 index 7b2fa2982c17d4273880e98c431ee1ed843df4d0..0dd2552c0f161ac455ac746f48d179993dea6eac --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -39,6 +39,7 @@ #include "rom_com.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" @@ -53,8 +54,11 @@ * Local function prototypes *-----------------------------------------------------------------------*/ +#ifdef JBM_TSM_ON_TCS +static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, int16_t *data ); +#else static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas ); - +#endif /*--------------------------------------------------------------------------* * ivas_mct_dec() @@ -85,10 +89,9 @@ ivas_error ivas_mct_dec( int32_t ivas_total_brate; ivas_error error; - error = IVAS_ERR_OK; - push_wmops( "ivas_mct_dec" ); + error = IVAS_ERR_OK; nCPE = st_ivas->nCPE; hMCT = st_ivas->hMCT; @@ -106,10 +109,6 @@ ivas_error ivas_mct_dec( } } - if ( !st_ivas->bfi ) - { - hMCT->LFE_off = 0; /* in case of PLC, stick to LFE_off of previous frame; otherwise, the update happens in ivas_mdct_dec_side_bits_frame_channel() */ - } for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { @@ -131,9 +130,9 @@ ivas_error ivas_mct_dec( if ( !st_ivas->bfi ) { - ivas_mdct_dec_side_bits_frame_channel( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], - &hMCT->LFE_off, nTnsBitsTCX10[cpe_id], param[cpe_id], 1, - ( ( cpe_id + 1 ) * CPE_CHANNELS > st_ivas->nchan_transport ) ); + ivas_mdct_dec_side_bits_frame_channel( st_ivas->hCPE[cpe_id], param_lpc[cpe_id], p_param[cpe_id], st_ivas->hCPE[0]->hCoreCoder[0], nTnsBitsTCX10[cpe_id], param[cpe_id], 1, + ( ( cpe_id + 1 ) * CPE_CHANNELS > hMCT->nchan_out_woLFE ) ); + st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect; @@ -156,7 +155,8 @@ ivas_error ivas_mct_dec( set_zero( x[n][1], L_FRAME48k / 2 ); } - ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], hMCT->LFE_off, nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], + ivas_mdct_core_invQ( st_ivas->hCPE[cpe_id], + nTnsBitsTCX10[cpe_id], p_param[cpe_id], param_lpc[cpe_id], param[cpe_id], fUseTns[cpe_id], tnsData[cpe_id], x, x, Aq[cpe_id], NULL, 1 ); st_ivas->BER_detect |= st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect; @@ -166,6 +166,18 @@ ivas_error ivas_mct_dec( /* MCT core decoder */ ivas_mct_core_dec( hMCT, st_ivas->hCPE, nCPE, output ); + /* for sba to stereo output disable any further processing for TCs > 2 as it is not needed*/ + if ( st_ivas->sba_dirac_stereo_flag ) + { + for ( cpe_id = 1; cpe_id < nCPE; cpe_id++ ) + { + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + } + } + } + /* MCT reconstruction and CoreCoder updates */ for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { @@ -177,7 +189,8 @@ ivas_error ivas_mct_dec( x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; } - ivas_mdct_core_tns_ns( hCPE, hMCT->LFE_off, fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 ); + ivas_mdct_core_tns_ns( hCPE, + fUseTns[cpe_id], tnsData[cpe_id], x, Aq[cpe_id], 1 ); } if ( st_ivas->renderer_type == RENDERER_MC ) @@ -185,6 +198,7 @@ ivas_error ivas_mct_dec( /* Equalization in MDCT Domain */ ivas_ls_setup_conversion_process_mdct( st_ivas, output ); } + else if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) { float *x_all[MAX_CICP_CHANNELS][NB_DIV]; @@ -212,7 +226,8 @@ ivas_error ivas_mct_dec( x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2]; } - ivas_mdct_core_reconstruct( hCPE, x, synth, hMCT->LFE_off, fUseTns[cpe_id], 1 ); + ivas_mdct_core_reconstruct( hCPE, x, synth, + fUseTns[cpe_id], 1 ); /*----------------------------------------------------------------* * CoreCoder Post-processing and updates @@ -220,13 +235,14 @@ ivas_error ivas_mct_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { - if ( sts[n]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + + if ( st_ivas->sba_dirac_stereo_flag ) { - break; + ivas_post_proc( NULL, hCPE, n, synth[n], NULL, output_frame, 1 ); } /* Postprocessing for ACELP/MDCT core switching and synchronization */ - if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], 0, output_frame, 0 /*core_switching_flag*/, 0, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) + if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], st_ivas->ivas_format, 0, output_frame, 0 /*core_switching_flag*/, st_ivas->sba_dirac_stereo_flag, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) { return error; } @@ -247,7 +263,10 @@ ivas_error ivas_mct_dec( /* synthesis synchronization between stereo modes */ - synchro_synthesis( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); + if ( !st_ivas->sba_dirac_stereo_flag ) + { + synchro_synthesis( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); + } #ifdef DEBUG_PLOT for ( n = 0; n < CPE_CHANNELS; n++ ) @@ -257,6 +276,25 @@ ivas_error ivas_mct_dec( } #endif } + /* move channels after LFE to correct output for multi-channel MCT */ +#ifdef MC_PARAMUPMIX_MODE + if ( st_ivas->ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) +#else + if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) +#endif + { + float tmp[L_FRAME48k]; + + /*save center channel output*/ + mvr2r( output[hMCT->nchan_out_woLFE - 1], tmp, output_frame ); + + for ( n = hMCT->nchan_out_woLFE - 1; n >= LFE_CHANNEL; n-- ) + { + mvr2r( output[n - 1], output[n + 1], output_frame ); + } + mvr2r( tmp, output[LFE_CHANNEL - 1], output_frame ); + set_zero( output[LFE_CHANNEL], output_frame ); + } #ifdef DEBUG_MODE_INFO for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) @@ -292,7 +330,7 @@ ivas_error create_mct_dec( int16_t max_blocks; int16_t cpe_id; - /*-----------------------------------------------------------------* + /*--------------------------------------------------------- --------* * Allocate MCT handle *-----------------------------------------------------------------*/ @@ -306,21 +344,20 @@ ivas_error create_mct_dec( *-----------------------------------------------------------------*/ /* Determine active channels */ - if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT ) { - hMCT->num_lfe = st_ivas->hTransSetup.num_lfe; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport - hMCT->num_lfe; /* LFE channel is coded separately */ + hMCT->nchan_out_woLFE = st_ivas->nchan_transport; } - else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) + else if ( st_ivas->mc_mode == MC_MODE_MCT ) { - hMCT->num_lfe = 0; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; } - else if ( st_ivas->ivas_format == SBA_FORMAT ) +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - hMCT->num_lfe = 0; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; } +#endif else { assert( !"IVAS format currently not supported for MCT" ); @@ -334,14 +371,11 @@ ivas_error create_mct_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) % 2 ) + if ( ( hMCT->nchan_out_woLFE ) % + 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -421,21 +455,20 @@ ivas_error mct_dec_reconfigure( if ( b_nchan_change ) { /* Determine active channels */ - if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) || st_ivas->ivas_format == SBA_FORMAT ) { - hMCT->num_lfe = st_ivas->hTransSetup.num_lfe; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport - hMCT->num_lfe; /* LFE channel is coded separately */ + hMCT->nchan_out_woLFE = st_ivas->nchan_transport; } - else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) + else if ( st_ivas->mc_mode == MC_MODE_MCT ) { - hMCT->num_lfe = 0; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; } - else if ( st_ivas->ivas_format == SBA_FORMAT ) +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - hMCT->num_lfe = 0; - hMCT->nchan_out_woLFE = st_ivas->nchan_transport; + hMCT->nchan_out_woLFE = st_ivas->nchan_transport - st_ivas->hTransSetup.num_lfe; } +#endif else { assert( !"IVAS format currently not supported for MCT" ); @@ -448,15 +481,12 @@ ivas_error mct_dec_reconfigure( for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) % 2 ) + if ( ( hMCT->nchan_out_woLFE ) % + 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -473,10 +503,11 @@ ivas_error mct_dec_reconfigure( st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; - if ( !( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) + if ( !( + ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) { st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag ); if ( st->igf ) { IGFDecSetMode( st->hIGFDec, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, -1, -1, st->rf_flag ); @@ -602,6 +633,11 @@ void ivas_mct_dec_close( ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx /* i : LS config. index */ +#ifdef JBM_TSM_ON_TCS + , + uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ + int16_t *data /* o : flushed samples (JBM) */ +#endif ) { AUDIO_CONFIG signaled_config; @@ -631,7 +667,11 @@ ivas_error ivas_mc_dec_config( { if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) { +#ifdef JBM_TSM_ON_TCS + ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ); +#else ivas_mc_dec_reconfig( st_ivas ); +#endif } } @@ -649,15 +689,29 @@ ivas_error ivas_mc_dec_config( *-------------------------------------------------------------------------*/ static ivas_error ivas_mc_dec_reconfig( - Decoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +#ifdef JBM_TSM_ON_TCS + , + uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ + int16_t *data /* o : flushed samples (JBM) */ +#endif ) { int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; int16_t numCldfbAnalyses_old, numCldfbSyntheses_old; int32_t new_brate_SCE, new_brate_CPE, ivas_total_brate; RENDERER_TYPE renderer_type_old; + Decoder_State *st; ivas_error error; MC_MODE mc_mode, last_mc_mode; +#ifdef JBM_TSM_ON_TCS + TC_BUFFER_MODE tc_buffer_mode_new; + int16_t tc_nchan_tc_new; + int16_t tc_nchan_allocate_new; + int16_t tc_granularity_new; + AUDIO_CONFIG intern_config_old; + IVAS_OUTPUT_SETUP hIntSetupOld; +#endif error = IVAS_ERR_OK; @@ -686,15 +740,65 @@ static ivas_error ivas_mc_dec_reconfig( { nchan_hp20_old = nchan_transport_old; } - st_ivas->sba_dirac_stereo_flag = 0; /* needs to be after getNumChanSynthesis() */ + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); + +#ifdef JBM_TSM_ON_TCS + /* save old IntSetup, might be needed for JBM flushing...*/ + intern_config_old = st_ivas->intern_config; + hIntSetupOld = st_ivas->hIntSetup; + tc_granularity_new = 1; +#endif /* renderer might have changed, reselect */ renderer_type_old = st_ivas->renderer_type; ivas_renderer_select( st_ivas ); + /* side effect of the renderer selection can be a changed internal config */ ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDecoderConfig->voip_active ) + { + /* 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->hDirAC != NULL ) + { + st_ivas->hTcBuffer->nb_subframes = st_ivas->hDirAC->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hDirAC->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; + mvs2s( st_ivas->hDirAC->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->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; + } + } + /* 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 ) + { + return error; + } + } + } +#endif + + if ( st_ivas->mc_mode == MC_MODE_MCT ) { st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); @@ -707,34 +811,77 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hParamMC != NULL ) { ivas_param_mc_dec_close( &st_ivas->hParamMC ); - st_ivas->hParamMC = NULL; + /* remove ls conversion if it was allocated by ParamMC */ ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); } - +#ifdef MC_PARAMUPMIX_MODE + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); +#endif /* De-allocate McMasa-related handles */ - if ( st_ivas->hMasa != NULL ) + ivas_masa_dec_close( &( st_ivas->hMasa ) ); + ivas_qmetadata_close( &st_ivas->hQMetaData ); + +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDirAC != NULL ) + { + ivas_dirac_dec_close( &st_ivas->hDirAC ); + vbap_free_data( &( st_ivas->hVBAPdata ) ); + } +#endif + + /* init LS conversion if the renderer type asks for it */ + if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL ) { - ivas_masa_dec_close( st_ivas->hMasa ); - st_ivas->hMasa = NULL; + if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } + } + } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + st_ivas->nSCE = 0; + st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / 2; + st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; - if ( st_ivas->hQMetaData != NULL ) + if ( last_mc_mode != MC_MODE_PARAMUPMIX ) + /* This should always be the case, only supporting one bitrate currently */ + { + /*De-allocate handles for other MC modes*/ + if ( st_ivas->hParamMC != NULL ) { - ivas_qmetadata_close( &st_ivas->hQMetaData ); - st_ivas->hQMetaData = NULL; + ivas_param_mc_dec_close( &st_ivas->hParamMC ); + + /* remove ls conversion if it was allocated by ParamMC */ + ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); } + ivas_masa_dec_close( &( st_ivas->hMasa ) ); + ivas_qmetadata_close( &st_ivas->hQMetaData ); + /* init LS conversion if the renderer type asks for it */ - if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL ) + if ( ( st_ivas->renderer_type == RENDERER_MC ) && st_ivas->hLsSetUpConversion == NULL ) { if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } } + + if ( ( error = ivas_mc_paramupmix_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + assert( 0 ); } } +#endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { if ( last_mc_mode != MC_MODE_PARAMMC ) @@ -752,36 +899,35 @@ static ivas_error ivas_mc_dec_reconfig( } else { - ivas_param_mc_dec_reconfig( st_ivas ); + if ( ( error = ivas_param_mc_dec_reconfig( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } /* De-allocate McMasa-related handles */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_dec_close( st_ivas->hMasa ); - st_ivas->hMasa = NULL; - } + ivas_masa_dec_close( &( st_ivas->hMasa ) ); + ivas_qmetadata_close( &st_ivas->hQMetaData ); - if ( st_ivas->hQMetaData != NULL ) +#ifdef JBM_TSM_ON_TCS + if ( st_ivas->hDirAC != NULL ) { - ivas_qmetadata_close( &st_ivas->hQMetaData ); - st_ivas->hQMetaData = NULL; + ivas_dirac_dec_close( &st_ivas->hDirAC ); + + vbap_free_data( &( st_ivas->hVBAPdata ) ); } +#endif + if ( last_mc_mode == MC_MODE_MCT ) { if ( st_ivas->hMCT != NULL && st_ivas->nchan_transport <= CPE_CHANNELS ) { ivas_mct_dec_close( &st_ivas->hMCT ); - st_ivas->hMCT = NULL; } /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_dec_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); } } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -807,6 +953,10 @@ static ivas_error ivas_mc_dec_reconfig( ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); } +#ifdef MC_PARAMUPMIX_MODE + ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); +#endif + if ( st_ivas->hParamMC != NULL ) { ivas_param_mc_dec_close( &st_ivas->hParamMC ); @@ -815,18 +965,10 @@ static ivas_error ivas_mc_dec_reconfig( if ( last_mc_mode == MC_MODE_MCT ) { - if ( st_ivas->hMCT != NULL ) - { - ivas_mct_dec_close( &st_ivas->hMCT ); - st_ivas->hMCT = NULL; - } + ivas_mct_dec_close( &st_ivas->hMCT ); /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_dec_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } + ivas_lfe_dec_close( &( st_ivas->hLFE ) ); } } @@ -851,7 +993,7 @@ static ivas_error ivas_mc_dec_reconfig( set correct mct_chan_mode and init missing static mem (IGF, HQ) and some config (TNS) do it here since it is _very_ MC specific */ if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS ) { - Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; + st = st_ivas->hCPE[1]->hCoreCoder[1]; if ( st_ivas->nchan_transport == 3 ) { @@ -894,18 +1036,8 @@ static ivas_error ivas_mc_dec_reconfig( } } - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode, st->mct_chan_mode ); - } - else if ( last_mc_mode == MC_MODE_PARAMMC && st_ivas->mc_mode == MC_MODE_MCT && nchan_transport_old > 2 ) - { -#ifdef DEBUGGING - assert( st_ivas->hCPE[1] != NULL ); -#endif - Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; - st->mct_chan_mode = MCT_CHAN_MODE_LFE; - st->hTcxCfg->fIsTNSAllowed = 0; + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( ivas_total_brate, st->igf, st->element_mode ); } - if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { uint8_t separateChannelEnabled; @@ -918,6 +1050,13 @@ static ivas_error ivas_mc_dec_reconfig( new_brate_SCE = 0; new_brate_CPE = ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + new_brate_SCE = 0; + new_brate_CPE = ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; + } +#endif else { new_brate_SCE = 0; /* ivas_total_brate / st_ivas->nchan_transport;*/ @@ -931,7 +1070,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( last_mc_mode == MC_MODE_MCT && st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->nchan_transport > CPE_CHANNELS ) { - Decoder_State *st = st_ivas->hCPE[1]->hCoreCoder[1]; + st = st_ivas->hCPE[1]->hCoreCoder[1]; /* TCX-LTP */ if ( st->hTcxLtpDec == NULL ) @@ -944,21 +1083,35 @@ static ivas_error ivas_mc_dec_reconfig( } } - /* re-configure hp20 memories */ - ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ); /*-----------------------------------------------------------------* - * CLDFB instances + * re-configure HP20 memories *-----------------------------------------------------------------*/ - ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ); + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifndef FIX_417_TD_DECORR_BRATE_SW /*-----------------------------------------------------------------* - * Allocate the LFE handle that is coded seperately after the allocation of the core coders + * CLDFB instances *-----------------------------------------------------------------*/ + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + /*-----------------------------------------------------------------* + * Allocate the LFE handle that is coded seperately after the allocation of the core coders + *-----------------------------------------------------------------*/ +#ifdef MC_PARAMUPMIX_MODE + if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hLFE == NULL ) +#else if ( st_ivas->mc_mode == MC_MODE_MCT && st_ivas->hLFE == NULL ) +#endif { int32_t binauralization_delay_ns = st_ivas->binaural_latency_ns; if ( st_ivas->hBinRenderer != NULL ) @@ -979,9 +1132,6 @@ static ivas_error ivas_mc_dec_reconfig( return error; } - /* reuse core-coder buffers for LFE decoder */ - st_ivas->hLFE->prevsynth_buf = &st_ivas->hCPE[1]->hCoreCoder[1]->old_synth_sw[0]; - st_ivas->hLFE->prior_out_buffer = &st_ivas->hCPE[1]->hCoreCoder[1]->previoussynth[0]; set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); @@ -1012,10 +1162,13 @@ static ivas_error ivas_mc_dec_reconfig( } } } - else if ( ( st_ivas->renderer_type == RENDERER_DISABLE ) && ( st_ivas->hDirAC != NULL ) ) + else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) { - ivas_dirac_dec_close( st_ivas->hDirAC ); - st_ivas->hDirAC = NULL; + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); + +#ifdef JBM_TSM_ON_TCS + vbap_free_data( &( st_ivas->hVBAPdata ) ); +#endif } } @@ -1034,17 +1187,9 @@ static ivas_error ivas_mc_dec_reconfig( ivas_binRenderer_close( &st_ivas->hBinRenderer ); } -#ifdef FIX_197_CREND_INTERFACE if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hRenderConfig->roomAcoustics.late_reverb_on == 0 ) ) ) -#else - if ( st_ivas->hCrend != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hRenderConfig->roomAcoustics.late_reverb_on == 0 ) ) ) -#endif { -#ifdef FIX_197_CREND_INTERFACE ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#else - ivas_crend_close( st_ivas ); -#endif } if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) @@ -1063,11 +1208,7 @@ static ivas_error ivas_mc_dec_reconfig( /* useTdDecorr may change => close and re-open */ ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1084,7 +1225,6 @@ static ivas_error ivas_mc_dec_reconfig( } else if ( st_ivas->hDiracDecBin == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) { -#ifdef HRTF_BINARY_FILE if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -1094,9 +1234,6 @@ static ivas_error ivas_mc_dec_reconfig( } if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1108,53 +1245,33 @@ static ivas_error ivas_mc_dec_reconfig( return error; } -#ifdef FIX_197_CREND_INTERFACE if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) { - if ( ( st_ivas->hCrendWrapper = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) + if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); } + st_ivas->hCrendWrapper->hCrend = NULL; + st_ivas->hCrendWrapper->hHrtfCrend = NULL; if ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); } } -#else - if ( st_ivas->hCrend == NULL && st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) - { - if ( ( st_ivas->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); - } - } -#endif } -#ifdef FIX_197_CREND_INTERFACE else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), - getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), - getRendAudioConfigFromIvasAudioConfig( st_ivas->hDecoderConfig->output_config ), - st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, -#ifdef HRTF_BINARY_FILE + st_ivas->intern_config, + st_ivas->hDecoderConfig->output_config, + st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, -#endif st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; } -#else - else if ( st_ivas->hCrend == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) - { - if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "ivas_crend_open failed" ); - } - } -#endif } /* mono/stereo */ else if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) @@ -1178,5 +1295,80 @@ static ivas_error ivas_mc_dec_reconfig( #endif } +#ifdef FIX_417_TD_DECORR_BRATE_SW + /*-----------------------------------------------------------------* + * TD Decorrelator + *-----------------------------------------------------------------*/ + + if ( st_ivas->hDiracDecBin != NULL ) + { + 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, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + +#ifdef JBM_TSM_ON_TCS + /*-----------------------------------------------------------------* + * Reconfigure TC buffer + *-----------------------------------------------------------------*/ + if ( st_ivas->hDecoderConfig->voip_active == 1 ) + { + int16_t tc_nchan_full_new; + DECODER_TC_BUFFER_HANDLE hTcBuffer; + + hTcBuffer = st_ivas->hTcBuffer; + tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); + tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + tc_nchan_allocate_new = tc_nchan_tc_new; + tc_nchan_full_new = tc_nchan_tc_new; + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; + tc_nchan_full_new = tc_nchan_allocate_new; + } + if ( st_ivas->mc_mode == MC_MODE_PARAMMC && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) + { + tc_nchan_full_new = 0; + } + /* reconfigure buffer */ + if ( hTcBuffer->tc_buffer_mode != tc_buffer_mode_new || hTcBuffer->nchan_transport_jbm != tc_nchan_tc_new || + hTcBuffer->nchan_buffer_full != tc_nchan_full_new || hTcBuffer->nchan_transport_internal != tc_nchan_allocate_new || + tc_granularity_new != hTcBuffer->n_samples_granularity ) + { + if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ) != IVAS_ERR_OK ) + { + return error; + } + } + /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ + if ( st_ivas->hDirAC != NULL ) + { + st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + else if ( st_ivas->hParamMC != NULL ) + { + st_ivas->hParamMC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hParamMC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hParamMC->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hParamMC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + } +#endif return error; } diff --git a/lib_dec/ivas_mct_dec_mct.c b/lib_dec/ivas_mct_dec_mct.c index 7177785984335e307778d3166401851188d13e81..987a9cc72f25a60b4e820972aeb8ae6c4fcb4b8e 100644 --- a/lib_dec/ivas_mct_dec_mct.c +++ b/lib_dec/ivas_mct_dec_mct.c @@ -49,9 +49,7 @@ static void indexToChannelPair( MCT_DEC_BLOCK_DATA_HANDLE hBlock, const int16_t nChannels, - const int16_t pairIdx, - Decoder_State **sts /* i/o: decoder state structure */ -) + const int16_t pairIdx ) { int16_t ch1, ch2; int16_t tmpIdx = 0; @@ -60,10 +58,6 @@ static void indexToChannelPair( { for ( ch1 = 0; ch1 < ch2; ch1++ ) { - if ( sts[ch1]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch2]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - continue; - } if ( tmpIdx == pairIdx ) { @@ -105,7 +99,8 @@ void ivas_mct_dec_mct( /*first get core and overlap info for all channels*/ for ( ch = 0; ch < nchan; ch++ ) { - if ( ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) && hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( + hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { hMCT->mc_global_ild[ch] = get_next_indice( sts[0], SMDCT_GLOBAL_ILD_BITS ); } @@ -119,7 +114,8 @@ void ivas_mct_dec_mct( { for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { hMCT->lowE_ch[ch] = get_next_indice( sts[0], 1 ); } @@ -128,7 +124,8 @@ void ivas_mct_dec_mct( for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { nchan_active++; } @@ -141,7 +138,7 @@ void ivas_mct_dec_mct( /*get channel pair index from BS*/ channelPairIndex = get_next_indice( sts[0], hMCT->bitsChannelPairIndex ); - indexToChannelPair( hBlock, nchan, channelPairIndex, sts ); + indexToChannelPair( hBlock, nchan, channelPairIndex ); /*point to decoder states of actual channels to read block pair bits*/ p_st[0] = sts[hBlock->ch1]; @@ -170,7 +167,8 @@ static void applyGlobalILD( int16_t nSubframes, L_subframeTCX; float qratio; - for ( ch = 0; ch < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch++ ) + for ( ch = 0; ch < ( hMCT->nchan_out_woLFE ); + ch++ ) { nSubframes = ( sts[ch]->core == TCX_20_CORE ) ? 1 : NB_DIV; L_subframeTCX = sts[ch]->hTcxDec->L_frameTCX / nSubframes; @@ -252,7 +250,7 @@ void mctStereoIGF_dec( float *p_x[CPE_CHANNELS][NB_DIV]; int16_t singleChEle[MCT_MAX_CHANNELS]; - set_s( singleChEle, 1, ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) ); + set_s( singleChEle, 1, ( hMCT->nchan_out_woLFE ) ); for ( b = 0; b < hMCT->currBlockDataCnt; b++ ) { @@ -305,9 +303,10 @@ void mctStereoIGF_dec( } - if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) ) != 0 ) + if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE ) ) != 0 ) { - for ( ch = 0; ch < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch++ ) + for ( ch = 0; ch < ( hMCT->nchan_out_woLFE ); + ch++ ) { if ( singleChEle[ch] ) { @@ -316,7 +315,7 @@ void mctStereoIGF_dec( { continue; } - if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE || st->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 8f62a186420d5748e423eff5e7f7d5fa1040b5ea..81a8dda3549bc069ea6bdde12056d5338b63b9c0 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -35,6 +35,9 @@ #include "options.h" #include "prot.h" #include "rom_com.h" +#ifdef SNS_MSVQ +#include "ivas_rom_com.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -49,9 +52,9 @@ /*-----------------------------------------------------------------* - * Function mdct_read_IGF_bits() * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * read IGF side bits * + * Function mdct_read_IGF_bits() + * + * read IGF side bits *-----------------------------------------------------------------*/ void mdct_read_IGF_bits( @@ -90,9 +93,9 @@ void mdct_read_IGF_bits( /*-----------------------------------------------------------------* - * Function dec_prm_tcx_sidebits() * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * decode TCX side parameters * + * Function dec_prm_tcx_sidebits() + * + * decode TCX side parameters *-----------------------------------------------------------------*/ static void dec_prm_tcx_sidebits( @@ -162,22 +165,11 @@ static void dec_prm_tcx_sidebits( getTCXWindowing( st->core, st->last_core, st->element_mode, st->hTcxCfg, st0 ); st->hTcxDec->kernel_type[0] = st->hTcxDec->kernel_type[1] = MDCT_IV; - if ( st->element_mode == IVAS_CPE_MDCT && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { - st->hTcxDec->kernel_type[0] = get_next_indice( st0, st->last_core_from_bs != ACELP_CORE ? 2 : 1 ); - if ( st->core == TCX_10_CORE ) - { - st->hTcxDec->kernel_type[1] = 2 * ( st->hTcxDec->kernel_type[0] & 1 ) + get_next_indice( st0, 1 ); - } - } - - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) + st->hTcxDec->kernel_type[0] = get_next_indice( st0, st->last_core_from_bs != ACELP_CORE ? 2 : 1 ); + if ( st->core == TCX_10_CORE ) { - st->hTcxCfg->tcx_curr_overlap_mode = FULL_OVERLAP; - st->hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; - st->hTcxCfg->last_aldo = 0; + st->hTcxDec->kernel_type[1] = 2 * ( st->hTcxDec->kernel_type[0] & 1 ) + get_next_indice( st0, 1 ); } - if ( st->core == TCX_20_CORE ) { st->transform_type[0] = st->transform_type[1] = TCX_20; @@ -212,18 +204,18 @@ static void dec_prm_tcx_sidebits( /*-----------------------------------------------------------------* - * Function dec_prm_tcx_spec() * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * decode TCX core parameters * + * Function dec_prm_tcx_spec() + * + * decode TCX core parameters *-----------------------------------------------------------------*/ static void dec_prm_tcx_spec( - Decoder_State *st, /* i/o: decoder memory state */ - int16_t param[], /* o : decoded parameters */ - int16_t *total_nbbits, /* i/o: number of bits / decoded bits */ - int16_t *bitsRead, /* o : number of read bits */ + Decoder_State *st, /* i/o: decoder memory state */ + int16_t param[], /* o : decoded parameters */ + int16_t *total_nbbits, /* i/o: number of bits / decoded bits */ + int16_t *bitsRead, /* o : number of read bits */ int16_t p_param[NB_DIV], /* o : pointer to parameters for next round of bs reading*/ - int16_t nTnsBitsTCX10[NB_DIV] /* i : number of TNS bits per TCX10 subframe*/ + int16_t nTnsBitsTCX10[NB_DIV] /* i : number of TNS bits per TCX10 subframe */ ) { int16_t nSubframes; @@ -288,9 +280,9 @@ static void dec_prm_tcx_spec( /*-----------------------------------------------------------------* - * Function ivas_mdct_dec_side_bits_frame_channel() * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * Initialize TCX and read TCX side parameters * + * Function ivas_mdct_dec_side_bits_frame_channel() + * + * Initialize TCX and read TCX side parameters *-----------------------------------------------------------------*/ void ivas_mdct_dec_side_bits_frame_channel( @@ -298,7 +290,6 @@ void ivas_mdct_dec_side_bits_frame_channel( int16_t param_lpc[MCT_MAX_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 *LFE_off, /* o : flag if LFE has content */ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */ int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ @@ -340,11 +331,7 @@ void ivas_mdct_dec_side_bits_frame_channel( continue; } st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - *LFE_off = get_next_indice( st0, 1 ); - } - else if ( MCT_flag ) + if ( MCT_flag ) { tmp = get_next_indice( st0, 1 ); if ( tmp ) @@ -362,7 +349,7 @@ void ivas_mdct_dec_side_bits_frame_channel( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && *LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { sts[ch]->coder_type = INACTIVE; sts[ch]->side_bits_frame_channel = 0; @@ -384,13 +371,113 @@ void ivas_mdct_dec_side_bits_frame_channel( * SNS parameters *--------------------------------------------------------------------------------*/ +#ifdef SNS_MSVQ + sns_low_br_mode = 0; + skipped_first_channel = 0; + if ( !MCT_flag && sts[0]->sr_core == 25600 && ( ( hCPE->element_brate == IVAS_48k || hCPE->element_brate == IVAS_64k ) ) ) + { + param_lpc[0][0] = SNS_STEREO_MODE_LR; + param_lpc[0][1] = SNS_STEREO_MODE_LR; + param_lpc[0][2] = 0; + param_lpc[0][3] = 0; + if ( sts[0]->core == sts[1]->core ) + { + int16_t nSubframes; + nSubframes = ( sts[0]->core == TCX_20_CORE ) ? 1 : NB_DIV; + + for ( int16_t n = 0; n < nSubframes; ++n ) + { + param_lpc[0][n] = get_next_indice( st0, 1 ); + } + + /* zero side flags only get transmitted if needed */ + for ( int16_t n = 0; n < nSubframes; ++n ) + { + if ( param_lpc[0][n] == SNS_STEREO_MODE_MS ) + { + param_lpc[0][n + SNS_STEREO_MODE_OFFSET_INDICES / 2] = get_next_indice( st0, 1 ); + } + } + } + for ( ch = 0; ch < CPE_CHANNELS; ++ch ) + { + int16_t nSubframes; + int16_t idxIndices; + + st = sts[ch]; + nSubframes = ( st->core == TCX_20_CORE ) ? 1 : NB_DIV; + idxIndices = 0; + + for ( int16_t n = 0; n < nSubframes; ++n ) + { + const int16_t is_side = ch == 1 && param_lpc[0][n] == SNS_STEREO_MODE_MS; + const int16_t *bits = ( nSubframes == 1 ) ? ivas_sns_cdbks_tcx20_bits : ivas_sns_cdbks_tcx10_bits; + int16_t nStages = ( ( nSubframes == 1 ) ? SNS_MSVQ_NSTAGES_TCX20 : SNS_MSVQ_NSTAGES_TCX10 ); + + if ( is_side ) + { + /* check for zero-side flag */ + if ( param_lpc[0][n + SNS_STEREO_MODE_OFFSET_INDICES / 2] ) + { + continue; + } + nStages = SNS_MSVQ_NSTAGES_SIDE; + bits = ( nSubframes == 1 ) ? ivas_sns_cdbks_side_tcx20_bits : ivas_sns_cdbks_side_tcx10_bits; + } + for ( int16_t j = 0; j < nStages; ++j ) + { + /* plus one in index for stereo mode storage! */ + param_lpc[ch][j + idxIndices + SNS_STEREO_MODE_OFFSET_INDICES] = get_next_indice( st0, bits[j] ); + } + idxIndices += nStages; + } + } + } + else + { + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + st = sts[ch]; + + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + { + skipped_first_channel = 1; + continue; + } + + start_bit_pos_sns = st0->next_bit_pos; + + if ( ch == 0 || skipped_first_channel ) + { + /* read SNS stereo mode */ + param_lpc[0][0] = get_next_indice( st0, 1 ) << 1; + + /* read low br mode flag (if it is possible to be non-zero) */ + if ( sts[0]->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ) ) + { + sns_low_br_mode = get_next_indice( st0, 1 ); + } + } + + tmp = ch; + if ( ch == 1 && param_lpc[0][0] == 2 ) + { + tmp = 3; + } + + getLPCparam( st, ¶m_lpc[ch][0], st0, tmp, sns_low_br_mode && !( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ); + + st->side_bits_frame_channel += st0->next_bit_pos - start_bit_pos_sns; + } + } +#else skipped_first_channel = 0; sns_low_br_mode = 0; for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && *LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { skipped_first_channel = 1; continue; @@ -404,7 +491,7 @@ void ivas_mdct_dec_side_bits_frame_channel( param_lpc[0][0] = get_next_indice( st0, 1 ) << 1; /* read low br mode flag (if it is possible to be non-zero) */ - if ( sts[0]->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE ) ) + if ( sts[0]->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ) ) { sns_low_br_mode = get_next_indice( st0, 1 ); } @@ -420,6 +507,7 @@ void ivas_mdct_dec_side_bits_frame_channel( st->side_bits_frame_channel += st0->next_bit_pos - start_bit_pos_sns; } +#endif // SNS_MSVQ } return; @@ -427,14 +515,13 @@ void ivas_mdct_dec_side_bits_frame_channel( /*-----------------------------------------------------------------* - * ivas_mdct_core_invQ() * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * Inverse processing steps up to inverse quantization * + * ivas_mdct_core_invQ() + * + * Inverse processing steps up to inverse quantization *-----------------------------------------------------------------*/ void ivas_mdct_core_invQ( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ - const int16_t LFE_off, /* i : flag if LFE content */ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */ int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */ @@ -456,7 +543,11 @@ void ivas_mdct_core_invQ( int16_t *prm[CPE_CHANNELS]; /* LPC */ Word16 Aind[CPE_CHANNELS][M + 1]; +#ifdef SNS_MSVQ + float sns[CPE_CHANNELS][NB_DIV][M]; +#else float lsf[CPE_CHANNELS][( NB_DIV + 1 ) * M]; +#endif /* TCX */ float xn_buf[L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX]; int16_t tcx_offset[CPE_CHANNELS]; @@ -521,7 +612,7 @@ void ivas_mdct_core_invQ( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) /* indicates LFE with no content, or odd number of channels */ + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { st->total_brate = st->bits_frame_channel; continue; @@ -575,12 +666,6 @@ void ivas_mdct_core_invQ( /* PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed */ st->core = GetPLCModeDecision( st ); - - /*disable ACELP_PLC for LFE channel */ - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - st->core = st->last_core; - } } if ( ( !st->bfi || st->hTcxCfg->psychParamsCurrent == NULL ) && st->core > ACELP_CORE ) @@ -629,11 +714,50 @@ void ivas_mdct_core_invQ( * LPC PARAMETERS *--------------------------------------------------------------------------------*/ +#ifdef SNS_MSVQ + if ( bfi == 0 ) + { + if ( !MCT_flag && sts[0]->sr_core == 25600 && ( ( hCPE->element_brate == IVAS_48k || hCPE->element_brate == IVAS_64k ) ) ) + { + dequantize_sns( param_lpc, sns, sts ); + } + else + { + if ( sts[0]->core == TCX_20_CORE && sts[1]->core == TCX_20_CORE && sts[0]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + { +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_dec_stereo( param_lpc[0], param_lpc[1], sts[0]->L_frame, &sns[0][0][0], &sns[1][0][0] ); +#else + sns_avq_dec_stereo( param_lpc[0], param_lpc[1], &sns[0][0][0], &sns[1][0][0] ); +#endif + } + else + { + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + st = sts[ch]; + if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + { +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_dec( param_lpc[ch], sns[ch], st->L_frame, st->numlpc ); +#else + sns_avq_dec( param_lpc[ch], sns[ch], st->numlpc ); +#endif + } + } + } + } + } +#else if ( bfi == 0 ) { if ( sts[0]->core == TCX_20_CORE && sts[1]->core == TCX_20_CORE && sts[0]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_dec_stereo( param_lpc[0], param_lpc[1], sts[0]->L_frame, &lsf[0][M], &lsf[1][M] ); +#else sns_avq_dec_stereo( param_lpc[0], param_lpc[1], &lsf[0][M], &lsf[1][M] ); +#endif } else { @@ -642,11 +766,17 @@ void ivas_mdct_core_invQ( st = sts[ch]; if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_dec( param_lpc[ch], &lsf[ch][M], st->L_frame, st->numlpc ); +#else sns_avq_dec( param_lpc[ch], &lsf[ch][M], st->numlpc ); +#endif } } } } +#endif + /*--------------------------------------------------------------* * Rate switching @@ -670,7 +800,7 @@ void ivas_mdct_core_invQ( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) /* indicates LFE with no content, or odd number of channels */ + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { set_f( x[ch][0], 0.f, st->hTcxCfg->tcx_coded_lines ); /* usually set in decoder_tcx_invQ(), needed for concealment */ @@ -690,7 +820,11 @@ void ivas_mdct_core_invQ( /* Stability Factor */ if ( !bfi ) { +#ifdef SNS_MSVQ + mvr2r( sns[ch][k], &Aq[ch][k * M], M ); +#else mvr2r( &lsf[ch][( k + 1 ) * M], &Aq[ch][k * M], M ); +#endif } else { @@ -720,18 +854,12 @@ void ivas_mdct_core_invQ( { TonalMdctConceal_create_concealment_noise( concealment_noise[ch], hCPE, L_frameTCX[ch], L_frame[ch], ch, k, st->core, st->hTcxDec->cummulative_damping_tcx, noise_gen_mode_bfi ); } + decoder_tcx_noisefilling( st, concealment_noise[ch], Aq[ch], L_frameTCX_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x[ch][k], NULL, &tmp_concealment_method, gain_tcx, prm_sqQ, nf_seed, bfi, MCT_flag, k ); - decoder_tcx_noiseshaping_igf( st, L_spec[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], x[ch][k], - NULL, &tmp_concealment_method, bfi ); + decoder_tcx_noiseshaping_igf( st, L_spec[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], x[ch][k], NULL, &tmp_concealment_method, bfi ); } } - - - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) /*indicates LFE with no content*/ - { - set_f( &x[ch][0][MCT_LFE_MAX_LINE], 0.f, st->hTcxCfg->tcx_coded_lines - MCT_LFE_MAX_LINE ); - } } pop_wmops(); @@ -740,16 +868,15 @@ void ivas_mdct_core_invQ( /*-----------------------------------------------------------------* - * ivas_mdct_core_reconstruct() * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * reconstruct time signal * + * ivas_mdct_core_reconstruct() + * + * reconstruct time signal *-----------------------------------------------------------------*/ void ivas_mdct_core_reconstruct( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *x[][NB_DIV], /* i/o: synthesis @internal_FS */ float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */ - const int16_t LFE_off, /* i : flag if LFE content */ int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ) @@ -773,7 +900,6 @@ void ivas_mdct_core_reconstruct( int16_t pitch[CPE_CHANNELS][NB_SUBFR16k]; float pit_gain[CPE_CHANNELS][NB_SUBFR16k]; - int16_t isLFE; int16_t skip_decoding; set_f( xn_buf, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); @@ -788,17 +914,11 @@ void ivas_mdct_core_reconstruct( st = sts[ch]; skip_decoding = 0; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) /* indicates LFE with no content, or odd number of channels */ + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { skip_decoding = 1; } - isLFE = 0; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - isLFE = 1; - } - nSubframes[ch] = ( st->core == TCX_20_CORE ) ? 1 : NB_DIV; synth = synth_buf + st->hTcxDec->old_synth_len; synthFB = synth_bufFB + st->hTcxDec->old_synth_lenFB; @@ -823,7 +943,8 @@ void ivas_mdct_core_reconstruct( decoder_tcx_imdct( st, L_frame_global[ch], L_frame_globalTCX[ch], L_spec[ch], tcx_offset[ch], tcx_offsetFB[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], &x[ch][k][0], xn_buf, ( ( hCPE->nchan_out == 1 && st->hTcxDec->kernel_type[k] == MDST_IV ) || st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) ? MDCT_IV : st->hTcxDec->kernel_type[k], - fUseTns[ch][k], &synth[k * L_frame[ch]], &synthFB[k * L_frameTCX[ch]], bfi, k, isLFE, 0 ); + fUseTns[ch][k], &synth[k * L_frame[ch]], &synthFB[k * L_frameTCX[ch]], bfi, k, + 0 ); } else { @@ -943,7 +1064,6 @@ void ivas_mdct_core_reconstruct( if ( !bfi && !MCT_flag && hCPE->element_mode == IVAS_CPE_MDCT ) { int16_t i; - float nrgL, nrgR, xcorr; nrgL = nrgR = xcorr = EPSILON; @@ -964,14 +1084,13 @@ void ivas_mdct_core_reconstruct( /*-----------------------------------------------------------------* - * ivas_mdct_core_tns_ns() * - * ~~~~~~~~~~~~~~~~~~~~~~~ * - * reconstruct time signal * + * ivas_mdct_core_tns_ns() + * + * reconstruct time signal *-----------------------------------------------------------------*/ void ivas_mdct_core_tns_ns( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const int16_t LFE_off, /* i : flag if LFE has content */ int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */ float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */ @@ -999,6 +1118,7 @@ void ivas_mdct_core_tns_ns( set_f( xn_buf, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX ); + /* TNS, ITF, IMDCT and updates */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -1008,7 +1128,8 @@ void ivas_mdct_core_tns_ns( L_frameTCX_glob[ch] = st->hTcxDec->L_frameTCX / nSubframes[ch]; L_spec[ch] = st->hTcxCfg->tcx_coded_lines / nSubframes[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) || ( st->bfi && st->core == ACELP_CORE ) ) /* indicates LFE with no content, or odd number of channels */ + if ( + ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) || ( st->bfi && st->core == ACELP_CORE ) ) /* indicates LFE with no content, or odd number of channels */ { if ( st->hTonalMDCTConc != NULL ) { @@ -1063,14 +1184,12 @@ void ivas_mdct_core_tns_ns( } } - decoder_tcx_tns( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], &x[ch][k][0], - fUseTns[ch][k], &tnsData[ch][k], bfi, k, 1 ); + decoder_tcx_tns( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], &x[ch][k][0], fUseTns[ch][k], &tnsData[ch][k], bfi, k, 1 ); sns_shape_spectrum( x[ch][k], st->hTcxCfg->psychParamsCurrent, &sns_int_scf[0], st->hTcxCfg->psychParamsCurrent->nBins ); v_multc( x[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sns_int_scf[FDNS_NPTS - 1], x[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, L_spec[ch] - st->hTcxCfg->psychParamsCurrent->nBins ); - decoder_tcx_tns( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], &x[ch][k][0], - fUseTns[ch][k], &tnsData[ch][k], bfi, k, 0 ); + decoder_tcx_tns( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], &x[ch][k][0], fUseTns[ch][k], &tnsData[ch][k], bfi, k, 0 ); } if ( bfi && st->tonal_mdct_plc_active ) diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index 4932e71d51c32adca641a7d6c79c0f194d330f4f..d4dcb7ac7339e69e50347c4061c68b9547d8a3b9 100644 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -29,7 +29,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -// VE2AT: move to lib_rend ? + #include #include "options.h" #include @@ -124,10 +124,11 @@ void ivas_mono_downmix_render_passive( return; } + /*------------------------------------------------------------------------- * ivas_mono_stereo_downmix_mcmasa() * - * Downmix process + * Downmix process in McMASA *------------------------------------------------------------------------*/ void ivas_mono_stereo_downmix_mcmasa( @@ -165,4 +166,6 @@ void ivas_mono_stereo_downmix_mcmasa( /* Move to output */ mvr2r( dmx_tmp, output_f[0], output_frame ); } + + return; } diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c new file mode 100644 index 0000000000000000000000000000000000000000..873c75938a8866752dc2bb2a01ba7998a9f6e475 --- /dev/null +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -0,0 +1,170 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include "prot.h" +#include "ivas_prot.h" +#include "ivas_prot_rend.h" +#include +#include "ivas_rom_com.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" + + +/*---------------------------------------------------------------------* + * ivas_td_binaural_open() + * + * Open and initialize TD Object binaural renderer + *---------------------------------------------------------------------*/ + +ivas_error ivas_td_binaural_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, st_ivas->ivas_format, + st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); +} + + +/*---------------------------------------------------------------------* + * ivas_td_binaural_renderer() + * + * Receives the current frames for the object streams, updates metadata + * and renders the current frame. + *---------------------------------------------------------------------*/ + +ivas_error ivas_td_binaural_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: SCE channels / Binaural synthesis */ +#else + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ +#endif + const int16_t output_frame /* i : output frame length */ +) +{ + return ivas_td_binaural_renderer_unwrap( + st_ivas->hReverb, + st_ivas->transport_config, + st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, + st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); +} + +#ifdef JBM_TSM_ON_TCS +/*---------------------------------------------------------------------* + * ObjRenderIVASFrame() + * + * Receives the current frames for the object streams, updates metadata + * and renders the current frame. + *---------------------------------------------------------------------*/ + +void ObjRenderIVASSubframe( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ + const int16_t n_samples_asked ) +{ + int16_t first_sf, last_sf, subframe_idx; + float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; + float *p_reverb_signal[BINAURAL_CHANNELS]; + float *output_f_local[BINAURAL_CHANNELS]; + float *tc_local[MAX_TRANSPORT_CHANNELS]; + int16_t ch, slot_size, slots_to_render, output_frame; + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + p_reverb_signal[ch] = reverb_signal[ch]; + } + for ( ch = 0; ch < st_ivas->hTcBuffer->nchan_transport_internal; ch++ ) + { + tc_local[ch] = st_ivas->hTcBuffer->tc[ch] + st_ivas->hTcBuffer->n_samples_rendered; + } + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + output_f_local[ch] = output[ch]; + } + slot_size = st_ivas->hTcBuffer->n_samples_granularity; + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_asked / slot_size ); + first_sf = st_ivas->hTcBuffer->subframes_rendered; + last_sf = first_sf; + st_ivas->hTcBuffer->slots_rendered += slots_to_render; + while ( slots_to_render > 0 ) + { + slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf]; + last_sf++; + } + + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + output_frame = st_ivas->hTcBuffer->subframe_nbslots[subframe_idx] * st_ivas->hTcBuffer->n_samples_granularity; + /* Update object position(s) */ + TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, tc_local ); + + /* Update the listener's location/orientation */ + TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, + st_ivas->hDecoderConfig->Opt_Headrotation, + ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[0] : NULL, + ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL ); + + if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) + { + ivas_reverb_process( st_ivas->hReverb, st_ivas->transport_config, 0, tc_local, p_reverb_signal, 0 ); + } + + /* Render subframe */ + TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0 ); + + if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ + { + if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) + { + /* add reverb to rendered signals */ + v_add( reverb_signal[0], output_f_local[0], output_f_local[0], output_frame ); + v_add( reverb_signal[1], output_f_local[1], output_f_local[1], output_frame ); + } + } + for ( ch = 0; ch < st_ivas->hTcBuffer->nchan_transport_internal; ch++ ) + { + tc_local[ch] += output_frame; + } + for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ ) + { + output_f_local[ch] += output_frame; + } + } + st_ivas->hTcBuffer->subframes_rendered = last_sf; + return; +} +#endif diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index 0e553b4759945bb243e8f96029a497d11c286221..3f95113f604f8249e1034492dfe1c92fb926645c 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -29,19 +29,20 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -// VE2AT: move to lib_rend ? -#include + #include #include "options.h" #include -#include "ivas_prot.h" +#include #include "prot.h" +#include "ivas_prot.h" +#include "ivas_prot_rend.h" +#include "ivas_rom_com.h" +#include "ivas_rom_rend.h" #ifdef DEBUGGING #include "debug.h" #endif #include "wmc_auto.h" -#include "ivas_rom_com.h" -#include "ivas_rom_dec.h" /*----------------------------------------------------------------------------------* @@ -311,7 +312,18 @@ ivas_error ivas_ls_setup_conversion_open( int16_t output_frame; int32_t output_Fs; int16_t nchan_out; +#ifdef MC_PARAMUPMIX_MODE + int16_t paramUpmixMonoStereo; + if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) + { + paramUpmixMonoStereo = TRUE; + } + else + { + paramUpmixMonoStereo = FALSE; + } +#endif output_Fs = st_ivas->hDecoderConfig->output_Fs; nchan_out = st_ivas->hDecoderConfig->nchan_out; output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); @@ -331,8 +343,14 @@ ivas_error ivas_ls_setup_conversion_open( hLsSetUpConversion->sfbCnt = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); for ( chIdx = 0; chIdx < outChannels; chIdx++ ) { - hLsSetUpConversion->targetEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ); - hLsSetUpConversion->dmxEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ); + if ( ( hLsSetUpConversion->targetEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + } + if ( ( hLsSetUpConversion->dmxEnergyPrev[chIdx] = (float *) malloc( ( hLsSetUpConversion->sfbCnt ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + } set_f( hLsSetUpConversion->targetEnergyPrev[chIdx], 0.0f, hLsSetUpConversion->sfbCnt ); set_f( hLsSetUpConversion->dmxEnergyPrev[chIdx], 0.0f, hLsSetUpConversion->sfbCnt ); } @@ -344,11 +362,37 @@ ivas_error ivas_ls_setup_conversion_open( } else { +#ifdef MC_PARAMUPMIX_MODE + if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + if ( paramUpmixMonoStereo == TRUE ) + { + inChannels = audioCfg2channels( AUDIO_CONFIG_5_1_2 ); + } + else + { + inChannels = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; + } + } + else + { + inChannels = st_ivas->nchan_transport; + } +#else inChannels = st_ivas->nchan_transport; +#endif + /*Initialization of MDCT bands with TCX20 resolution */ ivas_lssetupconversion_mdct_init_bands( output_frame, TCX_20_CORE, &hLsSetUpConversion->sfbOffset[0], &hLsSetUpConversion->sfbCnt ); - hLsSetUpConversion->targetEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ); - hLsSetUpConversion->dmxEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ); + if ( ( hLsSetUpConversion->targetEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + } + if ( ( hLsSetUpConversion->dmxEnergyPrev[0] = (float *) malloc( ( MAX_SFB + 2 ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) ); + } + for ( chIdx = 1; chIdx < MAX_CICP_CHANNELS; chIdx++ ) { hLsSetUpConversion->targetEnergyPrev[chIdx] = NULL; @@ -383,7 +427,18 @@ ivas_error ivas_ls_setup_conversion_open( { if ( st_ivas->transport_config != AUDIO_CONFIG_INVALID ) { +#ifdef MC_PARAMUPMIX_MODE + if ( paramUpmixMonoStereo == TRUE ) + { + get_ls_conversion_matrix( hLsSetUpConversion, AUDIO_CONFIG_5_1_2, st_ivas->hDecoderConfig->output_config ); + } + else + { + get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config ); + } +#else get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config ); +#endif } else { @@ -450,9 +505,17 @@ void ivas_ls_setup_conversion_close( *-------------------------------------------------------------------------*/ void ivas_ls_setup_conversion( - Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ + Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ +#ifdef MC_PARAMUPMIX_MODE + const int16_t input_chans, /* i : number of input channels to the renderer */ +#endif const int16_t output_frame, /* i : frame length */ - float output[][L_FRAME48k] /* i/o: LS input/output synthesis signal */ +#ifdef JBM_TSM_ON_TCS + float *input[], /* i : LS input/output synthesis signal */ + float *output[] /* i/o: LS input/output synthesis signal */ +#else + float output[][L_FRAME48k] /* i/o: LS input/output synthesis signal */ +#endif ) { int16_t chInIdx, chOutIdx, idx; @@ -467,7 +530,11 @@ void ivas_ls_setup_conversion( for ( chOutIdx = 0; chOutIdx < st_ivas->hDecoderConfig->nchan_out; chOutIdx++ ) { set_zero( output_tmp[chOutIdx], output_frame ); +#ifdef MC_PARAMUPMIX_MODE + for ( chInIdx = 0; chInIdx < input_chans; chInIdx++ ) +#else for ( chInIdx = 0; chInIdx < st_ivas->nchan_transport; chInIdx++ ) +#endif { dmxCoeff = hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx]; @@ -479,14 +546,22 @@ void ivas_ls_setup_conversion( { for ( idx = 0; idx < output_frame; idx++ ) { +#ifdef JBM_TSM_ON_TCS + output_tmp[chOutIdx][idx] += input[chInIdx][idx]; +#else output_tmp[chOutIdx][idx] += output[chInIdx][idx]; +#endif } } else { for ( idx = 0; idx < output_frame; idx++ ) { +#ifdef JBM_TSM_ON_TCS + tmpVal = dmxCoeff * input[chInIdx][idx]; +#else tmpVal = dmxCoeff * output[chInIdx][idx]; +#endif output_tmp[chOutIdx][idx] += tmpVal; } } @@ -586,7 +661,9 @@ void ivas_ls_setup_conversion_process_mdct( { dmxCoeff = hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx]; - if ( !( chInIdx == LFE_CHANNEL && st_ivas->hMCT->LFE_off ) && mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) + if ( + chInIdx != LFE_CHANNEL && + mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) { /* Step 1: Compute the target energy and DMX signal (possible since we have all signals in TCX20 resolution) */ if ( dmxCoeff ) @@ -679,7 +756,9 @@ void ivas_ls_setup_conversion_process_mdct( /* Step 4: Perform equalization */ for ( chInIdx = 0; chInIdx < inChannels; chInIdx++ ) { - if ( !( chInIdx == LFE_CHANNEL && st_ivas->hMCT->LFE_off ) && mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) + if ( + chInIdx != LFE_CHANNEL && + mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE ) { if ( transform_type[chInIdx][0] == TCX_20 ) { @@ -1080,7 +1159,10 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( *-------------------------------------------------------------------------*/ void ivas_lssetupconversion_process_param_mc( - Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ + Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ +#ifdef JBM_TSM_ON_TCS + int16_t num_timeslots, +#endif float Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ float Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ int16_t channel_active[MAX_CICP_CHANNELS] /* i : bitmap indicating which output channels are active */ @@ -1107,8 +1189,12 @@ void ivas_lssetupconversion_process_param_mc( set_s( channel_active, 0, outChannels ); - /* Loop over each time slots and compute dmx for each time slot */ +/* Loop over each time slots and compute dmx for each time slot */ +#ifdef JBM_TSM_ON_TCS + for ( slotIdx = 0; slotIdx < num_timeslots; slotIdx++ ) +#else for ( slotIdx = 0; slotIdx < st_ivas->hParamMC->subframe_nbslots; slotIdx++ ) +#endif { /* copy buffers */ for ( chInIdx = 0; chInIdx < inChannels; chInIdx++ ) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c new file mode 100644 index 0000000000000000000000000000000000000000..02cab10026fdc8f41722b058b4429401e0287f8c --- /dev/null +++ b/lib_dec/ivas_output_config.c @@ -0,0 +1,463 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include "ivas_cnst.h" +#include "ivas_prot.h" +#include "ivas_stat_dec.h" +#ifdef DEBUGGING +#include "debug.h" +#include +#endif +#include "wmc_auto.h" + + +/*-------------------------------------------------------------------------* + * ivas_renderer_select() + * + * Select and configure IVAS renderer parameters + *-------------------------------------------------------------------------*/ + +void ivas_renderer_select( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + RENDERER_TYPE *renderer_type; + AUDIO_CONFIG *internal_config; + AUDIO_CONFIG output_config; + AUDIO_CONFIG transport_config; + + int16_t nchan_internal; + + renderer_type = &( st_ivas->renderer_type ); + internal_config = &( st_ivas->intern_config ); + output_config = st_ivas->hDecoderConfig->output_config; + transport_config = st_ivas->transport_config; + + /* disabled rendering by default */ + *renderer_type = RENDERER_DISABLE; + + /*-----------------------------------------------------------------* + * Binaural rendering configurations + *-----------------------------------------------------------------*/ + + if ( st_ivas->hDecoderConfig->Opt_Headrotation ) + { + st_ivas->hHeadTrackData->shd_rot_max_order = -1; + } + + if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) + { + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + if ( output_config == AUDIO_CONFIG_BINAURAL ) + { + *renderer_type = RENDERER_BINAURAL_PARAMETRIC; + } + else + { + *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; + } + } + else /* ISM_MODE_DISC */ + { + if ( output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hRenderConfig->roomAcoustics.use_brir == 0 ) + { +#ifdef DEBUGGING + if ( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) + { + *renderer_type = RENDERER_BINAURAL_FASTCONV; + *internal_config = AUDIO_CONFIG_HOA3; /* Render ISM to HOA3 before binauralization*/ + } + else + { + *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; + *internal_config = AUDIO_CONFIG_BINAURAL; + } +#else + *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; + *internal_config = AUDIO_CONFIG_BINAURAL; +#endif + } + else + { + *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; +#ifdef DEBUGGING + if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + { + *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; + } +#endif + *internal_config = AUDIO_CONFIG_7_1_4; + } + } + } + else if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport <= 2 ) ) + { + *internal_config = output_config; + if ( output_config == AUDIO_CONFIG_BINAURAL ) + { + *renderer_type = RENDERER_BINAURAL_PARAMETRIC; + } + else + { + *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT ) + { + *internal_config = AUDIO_CONFIG_HOA3; + + if ( output_config == AUDIO_CONFIG_BINAURAL ) + { + *renderer_type = RENDERER_BINAURAL_FASTCONV; + } + else + { + *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; + } + + if ( st_ivas->hDecoderConfig->Opt_Headrotation ) + { + + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order +#ifdef SPAR_TUNING + , + st_ivas->hDecoderConfig->ivas_total_brate +#endif + ); + if ( nchan_internal == 2 ) + { + st_ivas->hHeadTrackData->shd_rot_max_order = 1; + } + else if ( nchan_internal == 4 || nchan_internal == 3 ) + { + st_ivas->hHeadTrackData->shd_rot_max_order = 0; + } + else if ( nchan_internal == 6 || nchan_internal == 5 ) + { + st_ivas->hHeadTrackData->shd_rot_max_order = 2; + } + else if ( nchan_internal == 8 || nchan_internal == 7 ) + { + st_ivas->hHeadTrackData->shd_rot_max_order = 3; + } + } + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { + *internal_config = output_config; + if ( output_config == AUDIO_CONFIG_BINAURAL ) + { + *renderer_type = RENDERER_BINAURAL_PARAMETRIC; + } + else + { + *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; + } + } + else + { + *internal_config = transport_config; + if ( output_config == AUDIO_CONFIG_BINAURAL ) + { +#ifdef MC_PARAMUPMIX_MODE +#ifdef DEBUGGING + if ( ( ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && st_ivas->hDecoderConfig->Opt_Headrotation ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && !( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) +#else + if ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && st_ivas->hDecoderConfig->Opt_Headrotation && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) +#endif +#else +#ifdef DEBUGGING + if ( ( ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && st_ivas->hDecoderConfig->Opt_Headrotation ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && ( st_ivas->mc_mode == MC_MODE_MCT ) && !( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) +#else + if ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && st_ivas->hDecoderConfig->Opt_Headrotation && ( st_ivas->mc_mode == MC_MODE_MCT ) ) +#endif +#endif + { + *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; + } + else + { +#ifdef MC_PARAMUPMIX_MODE + if ( ( st_ivas->mc_mode == MC_MODE_MCT ) || ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) +#else + if ( st_ivas->mc_mode == MC_MODE_MCT ) +#endif + { + *renderer_type = RENDERER_BINAURAL_MIXER_CONV; + } + else + { + *renderer_type = RENDERER_BINAURAL_FASTCONV; + } + +#ifdef DEBUGGING + if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_CREND ) + { + *renderer_type = RENDERER_BINAURAL_MIXER_CONV; + } + else if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + { + *renderer_type = RENDERER_BINAURAL_FASTCONV; + } +#endif + if ( st_ivas->hDecoderConfig->Opt_Headrotation ) + { + /* force HOA3 domain for rotation*/ + *internal_config = AUDIO_CONFIG_HOA3; + } + } + } + else /* AUDIO_CONFIG_BINAURAL_ROOM */ + { +#ifdef MC_PARAMUPMIX_MODE + if ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) +#else + if ( st_ivas->mc_mode == MC_MODE_MCT ) +#endif + { + *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; + } + else + { + *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; + } +#ifdef DEBUGGING + if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_CREND ) + { + *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; + } + else if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + { + *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; + } +#endif + } + } + } + } + + /*-----------------------------------------------------------------* + * Non-binaural rendering configurations + *-----------------------------------------------------------------*/ + +#ifdef NON_DIEGETIC_PAN + else if ( st_ivas->ivas_format == MONO_FORMAT ) + { + if ( output_config == AUDIO_CONFIG_STEREO ) + { + *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; + } + } +#endif + else if ( st_ivas->ivas_format == STEREO_FORMAT ) + { + if ( output_config != AUDIO_CONFIG_STEREO && output_config != AUDIO_CONFIG_MONO ) + { + *renderer_type = RENDERER_MC; + } + } + else if ( st_ivas->ivas_format == ISM_FORMAT ) + { +#ifdef NON_DIEGETIC_PAN + if ( ( output_config == AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) ) + { + *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; + } + else + { +#endif + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + *renderer_type = RENDERER_PARAM_ISM; + if ( output_config == AUDIO_CONFIG_MONO ) + { + *renderer_type = RENDERER_MONO_DOWNMIX; + } + else if ( output_config == AUDIO_CONFIG_STEREO ) + { + *renderer_type = RENDERER_DISABLE; + } + else if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) + { + *renderer_type = RENDERER_SBA_LINEAR_ENC; + *internal_config = AUDIO_CONFIG_7_1_4; + } + } + else /* ISM_MODE_DISC */ + { + *renderer_type = RENDERER_TD_PANNING; + if ( output_config == AUDIO_CONFIG_MONO ) + { + *renderer_type = RENDERER_MONO_DOWNMIX; + } + else if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) + { + *renderer_type = RENDERER_SBA_LINEAR_ENC; + } + else if ( output_config == AUDIO_CONFIG_EXTERNAL ) + { + *renderer_type = RENDERER_DISABLE; + } + } +#ifdef NON_DIEGETIC_PAN + } +#endif + } + else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) + { + *renderer_type = RENDERER_DIRAC; + + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && + ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM && output_config != AUDIO_CONFIG_MONO && output_config != AUDIO_CONFIG_STEREO ) ) + { + if ( output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_FOA ) + { + *internal_config = output_config; + } + else if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) + { + *internal_config = AUDIO_CONFIG_FOA; + } + else + { + *internal_config = AUDIO_CONFIG_HOA3; + } + st_ivas->renderer_type = RENDERER_SBA_LINEAR_DEC; + } + else if ( ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) || + ( st_ivas->ivas_format == SBA_FORMAT && ( output_config == AUDIO_CONFIG_STEREO || output_config == AUDIO_CONFIG_MONO ) ) ) + { + *renderer_type = RENDERER_DISABLE; + } + else if ( ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) ) + { + *renderer_type = RENDERER_DISABLE; + } + else if ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_STEREO ) + { + *renderer_type = RENDERER_STEREO_PARAMETRIC; + } + else if ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_EXTERNAL ) + { + *renderer_type = RENDERER_DISABLE; + } + else if ( st_ivas->ivas_format == SBA_FORMAT && output_config == AUDIO_CONFIG_MONO ) + { + *renderer_type = RENDERER_SBA_LINEAR_DEC; + } + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + *internal_config = transport_config; + if ( st_ivas->mc_mode == MC_MODE_MCT && *internal_config != output_config ) + { + if ( output_config != AUDIO_CONFIG_FOA && output_config != AUDIO_CONFIG_HOA2 && output_config != AUDIO_CONFIG_HOA3 ) + { + *renderer_type = RENDERER_MC; + } + else + { + *renderer_type = RENDERER_SBA_LINEAR_ENC; + } + } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + *internal_config = transport_config; + if ( *internal_config != output_config ) + { + if ( output_config != AUDIO_CONFIG_FOA && output_config != AUDIO_CONFIG_HOA2 && output_config != AUDIO_CONFIG_HOA3 ) + { + *renderer_type = RENDERER_MC; + } + else + { + *renderer_type = RENDERER_SBA_LINEAR_ENC; + } + } + } +#endif + else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) + { + *renderer_type = RENDERER_SBA_LINEAR_ENC; + } + else + { + *renderer_type = RENDERER_MC_PARAMMC; + } + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { + *internal_config = output_config; + /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */ + if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) + { + if ( st_ivas->nchan_transport == 1 ) + { + *renderer_type = RENDERER_DISABLE; + } + else if ( output_config == AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 2 && !st_ivas->hOutSetup.separateChannelEnabled ) + { + *renderer_type = RENDERER_DISABLE; + } + else + { + *renderer_type = RENDERER_MCMASA_MONO_STEREO; + } + } + else + { + *renderer_type = RENDERER_DIRAC; + if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) + { + *renderer_type = RENDERER_SBA_LINEAR_ENC; + *internal_config = transport_config; + } + else if ( transport_config == AUDIO_CONFIG_5_1 && ( output_config == AUDIO_CONFIG_7_1 || output_config == AUDIO_CONFIG_5_1_4 ) ) + { + *internal_config = transport_config; + } + } + } + } + + return; +} diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index 1104c9a378ce2ed25c9b0364bc3cfe40b201dc9d..da00426116a6db051a81bcc68a4994b85b15ebe6 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -81,7 +81,7 @@ void ivas_post_proc( output_Fs = sts[0]->output_Fs; - if ( ( sts[n]->element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag ) || ( sts[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) + if ( ( sts[n]->element_mode != IVAS_CPE_DFT && !( sba_dirac_stereo_flag && sts[n]->element_mode != IVAS_CPE_MDCT ) ) || ( sts[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) { if ( sts[n]->hTcxLtpDec != NULL ) { @@ -102,6 +102,11 @@ void ivas_post_proc( mvr2r( sts[n]->prev_synth_buffer, sts[n]->hTcxDec->FBTCXdelayBuf, 0 ); mvr2r( sts[n]->delay_buf_out, sts[n]->hTcxDec->FBTCXdelayBuf + 0, delay_comp ); } + else if ( sba_dirac_stereo_flag && sts[n]->element_mode == IVAS_CPE_MDCT ) + { + int16_t numZeros = (int16_t) ( NS2SA( output_Fs, N_ZERO_MDCT_NS ) ); + mvr2r( sts[n]->hHQ_core->old_out + numZeros, sts[n]->hTcxDec->FBTCXdelayBuf, delay_comp ); + } tcx_ltp_post( sts[n], hTcxLtpDec, sts[n]->core, output_frame, NS2SA( output_Fs, ACELP_LOOK_NS ) + delay_comp, synth, sts[n]->hTcxDec->FBTCXdelayBuf ); } diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 9c6597fdcb881530b248d221ae0934ea93b22882..3774c06799e017a6eec0b32e61abefbe6717bdbd 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -49,9 +49,19 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness( uint16_t *bitstream, i static int16_t ivas_qmetadata_entropy_decode_df_ratio( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction, int16_t *dfRatio_bits ); -static int16_t ivas_qmetadata_entropy_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band ); +static int16_t ivas_qmetadata_entropy_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band +#ifdef HR_METADATA + , + int16_t is_hr +#endif +); -static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const int16_t nbands, const int16_t start_band ); +static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const int16_t nbands, const int16_t start_band +#ifdef HR_METADATA + , + int16_t is_hr +#endif +); static uint16_t ivas_qmetadata_DecodeQuasiUniform( const uint16_t *bitstream, int16_t *index, const uint16_t alphabet_size ); @@ -77,11 +87,21 @@ static int16_t read_truncGR_azimuth( uint16_t *bitstream, IVAS_QDIRECTION *q_dir static ivas_error read_huf( int16_t *num_bits_read, const uint16_t *bitstream, uint16_t *out, const int16_t start_pos, const int16_t len, const int16_t *huff_code, const int16_t max_len ); -static int16_t read_coherence_data( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir ); +static int16_t read_coherence_data( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir +#ifdef HR_METADATA + , + int16_t is_hr +#endif +); static int16_t read_surround_coherence( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData ); -static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, int16_t idx_d, const int16_t no_frames ); +static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, int16_t idx_d, const int16_t no_frames +#ifdef HR_METADATA + , + int16_t is_hr +#endif +); static void decode_combined_index( uint64_t comb_index, const int16_t *no_cv_vec, uint16_t *index, const int16_t len ); @@ -91,6 +111,44 @@ static int16_t read_GR_min_removed_data( uint16_t *bitstream, int16_t *p_bit_pos static int16_t decode_fixed_rate_composed_index_coherence( uint16_t *bitstream, int16_t *p_bit_pos, const int16_t no_bands, int16_t *no_cv_vec, uint16_t *decoded_index, const int16_t no_symb ); +#ifdef HR_METADATA + +static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr( + uint16_t *bitstream, /* i : bitstream */ + int16_t *index, + IVAS_QDIRECTION *q_direction, + uint16_t *diffuseness_index_max_ec_frame ); + + +static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr_512( + uint16_t *bitstream, /* i : bitstream */ + int16_t *index, + IVAS_QDIRECTION *q_direction ); + +static int16_t ivas_qmetadata_raw_decode_dir_512( + IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ + uint16_t *bitstream, /* i : bitstream */ + int16_t *index, + const int16_t nbands, + const int16_t start_band, + SPHERICAL_GRID_DATA *sph_grid16 /* i: spherical grid for deindexing */ +); +static int16_t read_surround_coherence_hr( + uint16_t *bitstream, /* i : bitstream */ + int16_t *p_bit_pos, /* i : position in the bitstream */ + IVAS_QMETADATA *hQMetaData /* i/o: quantized metadata structure */ +); + +/* !r: number of bits read */ +static int16_t read_coherence_data_hr_512( + uint16_t *bitstream, /* i : bitstream */ + int16_t *p_bit_pos, /* i : position in the bitstream */ + IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata structure */ + const int16_t idx_dir, /* i : direction index */ + int16_t nbits_coh ); + +#endif + /*-----------------------------------------------------------------------* * Global function definitions *-----------------------------------------------------------------------*/ @@ -101,11 +159,16 @@ static int16_t decode_fixed_rate_composed_index_coherence( uint16_t *bitstream, * Main function for decoding Spatial Metadata *-----------------------------------------------------------------------*/ + /*! r: number of bits read */ int16_t ivas_qmetadata_dec_decode( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ uint16_t *bitstream, /* i : bitstream */ int16_t *index /* i/o: bitstream position */ +#ifdef HODIRAC + , + int16_t hodirac /* i: flag to indicate sector processing */ +#endif ) { int16_t d, b, m; @@ -195,20 +258,43 @@ int16_t ivas_qmetadata_dec_decode( bits_diff_sum += ivas_qmetadata_entropy_decode_diffuseness( bitstream, index, &( hQMetaData->q_direction[0] ), &diffuseness_index_max_ec_frame_pre[0] ); - if ( hQMetaData->no_directions == 2 ) +#ifdef HODIRAC + if ( hodirac ) { - /* Calculate bits for dfRatio */ - dir2band = 0; - for ( b = hQMetaData->q_direction[0].cfg.start_band; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + if ( hQMetaData->no_directions == 2 ) { - if ( hQMetaData->twoDirBands[b] == 1 ) + /* Calculate bits for dfRatio */ + dir2band = 0; + for ( b = hQMetaData->q_direction[0].cfg.start_band; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { - dfRatio_bits[dir2band] = ivas_get_df_ratio_bits( hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0] ); - dir2band++; + if ( hQMetaData->twoDirBands[b] == 1 ) + { + dfRatio_bits[dir2band] = ivas_get_df_ratio_bits_hodirac( hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0] ); + dir2band++; + } } + + bits_diff_sum += ivas_qmetadata_entropy_decode_df_ratio( bitstream, index, &( hQMetaData->q_direction[1] ), dfRatio_bits ); } + } + else +#endif + { + if ( hQMetaData->no_directions == 2 ) + { + /* Calculate bits for dfRatio */ + dir2band = 0; + for ( b = hQMetaData->q_direction[0].cfg.start_band; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + if ( hQMetaData->twoDirBands[b] == 1 ) + { + dfRatio_bits[dir2band] = ivas_get_df_ratio_bits( hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0] ); + dir2band++; + } + } - bits_diff_sum += ivas_qmetadata_entropy_decode_df_ratio( bitstream, index, &( hQMetaData->q_direction[1] ), dfRatio_bits ); + bits_diff_sum += ivas_qmetadata_entropy_decode_df_ratio( bitstream, index, &( hQMetaData->q_direction[1] ), dfRatio_bits ); + } } /* Calculate direct-to-total energy ratios for both directions from diffuse-to-total ratio and distribution factor of direct-to-total ratios */ @@ -224,14 +310,37 @@ int16_t ivas_qmetadata_dec_decode( diffRatio = diffuseness_reconstructions[hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0]]; dfRatio_qsteps = 1 << dfRatio_bits[dir2band]; - dfRatio = usdequant( hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0], 0.5f, 0.5f / ( dfRatio_qsteps - 1 ) ); +#ifdef HODIRAC + /* already encoded as total and ratios in HODIRAC*/ + if ( hodirac ) + { + dfRatio = usdequant( hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0], 0.0f, 1.f / ( dfRatio_qsteps - 1 ) ); + dir1ratio = 1.f - diffRatio; + dir2ratio = dfRatio; + } + else +#endif + { + dfRatio = usdequant( hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0], 0.5f, 0.5f / ( dfRatio_qsteps - 1 ) ); + + dir1ratio = dfRatio * ( 1.0f - diffRatio ); + dir2ratio = ( 1.0f - diffRatio ) - dir1ratio; + } - dir1ratio = dfRatio * ( 1.0f - diffRatio ); - dir2ratio = ( 1.0f - diffRatio ) - dir1ratio; /* Requantize the 1 - dirRatio separately for each direction to obtain inverted dirRatio index. These are used in further decoding. */ hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0] = masa_sq( 1.0f - dir1ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); - hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0] = masa_sq( 1.0f - dir2ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); +#ifdef HODIRAC + if ( hodirac ) + { + float tmp; + hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0] = usquant( dir2ratio, &tmp, 0.0f, 1.f / ( DIRAC_DIFFUSE_LEVELS - 1 ), DIRAC_DIFFUSE_LEVELS ); + } + else +#endif + { + hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0] = masa_sq( 1.0f - dir2ratio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + } for ( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) { @@ -287,7 +396,12 @@ int16_t ivas_qmetadata_dec_decode( index_dirRatio1Inv = hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0]; index_dirRatio2Inv = hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[0]; - masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod ); + masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod +#ifdef HODIRAC + , + hodirac +#endif + ); for ( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) { @@ -385,9 +499,15 @@ int16_t ivas_qmetadata_dec_decode( /* Read coherence, if any */ bits_coherence = 0; + if ( all_coherence_zero == 0 ) { - bits_coherence = read_coherence_data( bitstream, index, hQMetaData, d ); + bits_coherence = read_coherence_data( bitstream, index, hQMetaData, d +#ifdef HR_METADATA + , + 0 +#endif + ); } else { @@ -435,11 +555,21 @@ int16_t ivas_qmetadata_dec_decode( if ( raw_flag[0] == 0 ) { - bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, nbands, start_band ); + bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, nbands, start_band +#ifdef HR_METADATA + , + 0 +#endif + ); } else { - bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, nbands, start_band ); + bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, nbands, start_band +#ifdef HR_METADATA + , + 0 +#endif + ); } } /* Decode quantized directions band-wise */ @@ -459,7 +589,12 @@ int16_t ivas_qmetadata_dec_decode( { if ( raw_flag[b] == 0 ) { - bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, b + 1, b ); + bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, b + 1, b +#ifdef HR_METADATA + , + 0 +#endif + ); } else { @@ -503,7 +638,12 @@ int16_t ivas_qmetadata_dec_decode( { if ( raw_flag[b] ) { - bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, b + 1, b ); + bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, b + 1, b +#ifdef HR_METADATA + , + 0 +#endif + ); } } } @@ -537,7 +677,12 @@ int16_t ivas_qmetadata_dec_decode( { if ( nblocks > 1 ) { - decode_spread_coherence( hQMetaData, d, nblocks ); + decode_spread_coherence( hQMetaData, d, nblocks +#ifdef HR_METADATA + , + 0 +#endif + ); } } else @@ -646,16 +791,21 @@ int16_t ivas_qmetadata_dec_decode( } /* Scale energy ratios that sum to over one */ - for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) +#ifdef HODIRAC + if ( !hodirac ) +#endif { - float ratioSum; + for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + float ratioSum; - ratioSum = hQMetaData->q_direction[0].band_data[b].energy_ratio[0] + hQMetaData->q_direction[1].band_data[b].energy_ratio[0]; + ratioSum = hQMetaData->q_direction[0].band_data[b].energy_ratio[0] + hQMetaData->q_direction[1].band_data[b].energy_ratio[0]; - if ( ratioSum > 1.0f ) - { - set_f( hQMetaData->q_direction[0].band_data[b].energy_ratio, hQMetaData->q_direction[0].band_data[b].energy_ratio[0] / ratioSum, nblocks ); - set_f( hQMetaData->q_direction[1].band_data[b].energy_ratio, hQMetaData->q_direction[1].band_data[b].energy_ratio[0] / ratioSum, nblocks ); + if ( ratioSum > 1.0f ) + { + set_f( hQMetaData->q_direction[0].band_data[b].energy_ratio, hQMetaData->q_direction[0].band_data[b].energy_ratio[0] / ratioSum, nblocks ); + set_f( hQMetaData->q_direction[1].band_data[b].energy_ratio, hQMetaData->q_direction[1].band_data[b].energy_ratio[0] / ratioSum, nblocks ); + } } } } @@ -670,9 +820,331 @@ int16_t ivas_qmetadata_dec_decode( hQMetaData->dir_comp_ratio = 1.0f; } + + return ( start_index_0 - *index ); +} + + +#ifdef HR_METADATA + +/*! r: number of bits read */ +int16_t ivas_qmetadata_dec_decode_hr_384_512( + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ + uint16_t *bitstream, /* i : bitstream */ + int16_t *index, /* i/o: bitstream position */ + SPHERICAL_GRID_DATA *sph_grid16, /* i: spherical grid for deindexing */ + int16_t bits_sph_idx, + int16_t bits_sp_coh ) +{ + int16_t d, b, m; + + int16_t bits_diff_sum; + int16_t nbands, start_band; + IVAS_QDIRECTION *q_direction; + int16_t start_index_0; + int16_t bits_no_dirs_coh, bits_sur_coherence; + uint16_t all_coherence_zero; + int16_t p[MASA_MAXIMUM_CODING_SUBBANDS], dif_p[MASA_MAXIMUM_CODING_SUBBANDS]; + +#ifdef DEBUG_MODE_QMETADATA + static FILE *pF = NULL; + static FILE *pF_azi = NULL; + static FILE *pF_ele = NULL; + static FILE *pF_ratio = NULL; + static FILE *pF_spcoh = NULL; + static FILE *pF_surcoh = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/qmetadata_dec.txt", "w" ); + if ( pF_azi == NULL ) + pF_azi = fopen( "./res/qmetadata_azi_dec.txt", "w" ); + if ( pF_ele == NULL ) + pF_ele = fopen( "./res/qmetadata_ele_dec.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_ratio_dec.txt", "w" ); + if ( pF_spcoh == NULL ) + pF_spcoh = fopen( "./res/qmetadata_spcoh_dec.txt", "w" ); + if ( pF_surcoh == NULL ) + pF_surcoh = fopen( "./res/qmetadata_surcoh_dec.txt", "w" ); +#endif + + start_index_0 = *index; + + /*Coherence flag decoding*/ + bits_no_dirs_coh = 0; + all_coherence_zero = 1; + if ( hQMetaData->coherence_flag ) + { + /* read if coherence is zero */ + all_coherence_zero = bitstream[( *index )--]; + bits_no_dirs_coh += 1; + } + + hQMetaData->all_coherence_zero = (uint8_t) all_coherence_zero; + + if ( hQMetaData->no_directions == 2 ) + { + set_c( (int8_t *) hQMetaData->twoDirBands, 1, hQMetaData->q_direction[0].cfg.nbands ); + } + + if ( bits_sph_idx == 11 && hQMetaData->no_directions == 2 ) + { + /* Read which bands have 2 directions */ + hQMetaData->q_direction[1].cfg.nbands = hQMetaData->numTwoDirBands; + set_c( (int8_t *) hQMetaData->twoDirBands, 0, hQMetaData->q_direction[0].cfg.nbands ); + d = *index; + dif_p[0] = ivas_qmetadata_DecodeExtendedGR( bitstream, index, MASA_MAXIMUM_CODING_SUBBANDS, 0 ); + p[0] = dif_p[0]; + hQMetaData->twoDirBands[p[0]] = 1; + for ( b = 1; b < hQMetaData->numTwoDirBands; b++ ) + { + dif_p[b] = ivas_qmetadata_DecodeExtendedGR( bitstream, index, MASA_MAXIMUM_CODING_SUBBANDS, 0 ); + p[b] = p[b - 1] + dif_p[b] + 1; + hQMetaData->twoDirBands[p[b]] = 1; + } + bits_no_dirs_coh += ( d - *index ); + } + + bits_diff_sum = ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[0] ) ); + + if ( hQMetaData->no_directions == 2 ) + { + bits_diff_sum += ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[1] ) ); + } + + + for ( b = hQMetaData->q_direction[0].cfg.start_band; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + for ( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) + { + hQMetaData->q_direction[0].band_data[b].energy_ratio[m] = 1.0f - diffuseness_reconstructions_hr[hQMetaData->q_direction[0].band_data[b].energy_ratio_index[m]]; + } + } + if ( hQMetaData->no_directions == 2 ) + { + for ( b = hQMetaData->q_direction[1].cfg.start_band; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) + { + for ( m = 0; m < hQMetaData->q_direction[1].cfg.nblocks; m++ ) + { + hQMetaData->q_direction[1].band_data[b].energy_ratio[m] = 1.0f - diffuseness_reconstructions_hr[hQMetaData->q_direction[1].band_data[b].energy_ratio_index[m]]; + if ( hQMetaData->q_direction[1].band_data[b].energy_ratio[m] > 1.0f - hQMetaData->q_direction[0].band_data[b].energy_ratio[m] ) + { + hQMetaData->q_direction[1].band_data[b].energy_ratio[m] = 1.0f - hQMetaData->q_direction[0].band_data[b].energy_ratio[m]; + } + } + } + } + + if ( hQMetaData->no_directions == 2 ) + { + for ( b = hQMetaData->q_direction[1].cfg.start_band; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) + { + for ( m = 0; m < hQMetaData->q_direction[1].cfg.nblocks; m++ ) + { + hQMetaData->q_direction[1].band_data[b].energy_ratio_index_mod[m] = hQMetaData->q_direction[1].band_data[b].energy_ratio_index[m]; + hQMetaData->q_direction[1].band_data[b].bits_sph_idx[m] = bits_sph_idx; + } + } + } + + for ( b = hQMetaData->q_direction[0].cfg.start_band; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + for ( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) + { + hQMetaData->q_direction[0].band_data[b].energy_ratio_index_mod[m] = hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0]; + hQMetaData->q_direction[0].band_data[b].bits_sph_idx[m] = bits_sph_idx; + } + } + + + if ( all_coherence_zero == 0 ) + { + bits_sur_coherence = read_surround_coherence_hr( bitstream, index, hQMetaData ); + } + else + { + bits_sur_coherence = 0; + /*Surround coherence*/ + for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + if ( hQMetaData->surcoh_band_data != NULL ) + { + set_c( (int8_t *) hQMetaData->surcoh_band_data[b].surround_coherence, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); + } + } + } + bits_no_dirs_coh += bits_sur_coherence; + + + for ( d = 0; d < hQMetaData->no_directions; d++ ) + { + q_direction = &hQMetaData->q_direction[d]; + nbands = q_direction->cfg.nbands; + start_band = q_direction->cfg.start_band; + + + /* Read coherence, if any */ + if ( all_coherence_zero == 0 ) + { + read_coherence_data_hr_512( bitstream, index, hQMetaData, d, bits_sp_coh ); + } + else + { + /*Surround coherence*/ + for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + if ( hQMetaData->surcoh_band_data != NULL ) + { + set_c( (int8_t *) hQMetaData->surcoh_band_data[b].surround_coherence, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); + } + + if ( hQMetaData->q_direction[d].coherence_band_data != NULL ) + { + set_c( (int8_t *) hQMetaData->q_direction[d].coherence_band_data[b].spread_coherence, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); + } + } + } + + + /* Decode quantized directions frame-wise */ + ivas_qmetadata_raw_decode_dir_512( q_direction, bitstream, index, nbands, start_band, sph_grid16 ); + + +#ifdef DEBUG_MODE_QMETADATA + + fprintf( pF, "frame %d: diff %d surcoh %d ", frame, bits_diff_sum, bits_sur_coherence ); + fprintf( pF, "dir %d\n", start_index_0 - *index ); + fprintf( pF_azi, "frame %d/dir/ec %d: ", frame, d ); + fprintf( pF_ele, "frame %d/dir/ec %d: ", frame, d ); + fprintf( pF_spcoh, "frame %d/dir %d: ", frame, d ); + fprintf( pF_ratio, "frame %d/dir %d: ", frame, d ); + + + for ( b = start_band; b < nbands; b++ ) + { + for ( m = 0; m < q_direction->cfg.nblocks; m++ ) + { + + fprintf( pF_ratio, " %1.3f ", q_direction->band_data[b].energy_ratio[m] ); + fprintf( pF_azi, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[b].azimuth[m] ) / 100.f ); + fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[b].elevation[m] ) / 100.f ); + if ( q_direction->coherence_band_data != NULL ) + { + fprintf( pF_spcoh, " %d ", q_direction->coherence_band_data[b].spread_coherence[m] ); + } + } + } + fprintf( pF_ratio, "\n" ); + fprintf( pF_azi, "\n" ); + fprintf( pF_ele, "\n" ); + fprintf( pF_spcoh, "\n" ); +#endif + } + + if ( hQMetaData->no_directions == 2 ) + { + /* move 2 dir data to its correct subband */ + if ( bits_sph_idx == 11 ) + { + + int16_t nblocks; + d = hQMetaData->q_direction[1].cfg.nbands - 1; + nblocks = hQMetaData->q_direction[0].cfg.nblocks; + + for ( b = hQMetaData->q_direction[0].cfg.nbands - 1; b >= 0; b-- ) + { + if ( hQMetaData->twoDirBands[b] == 1 ) + { + mvr2r( hQMetaData->q_direction[1].band_data[d].azimuth, hQMetaData->q_direction[1].band_data[b].azimuth, nblocks ); + mvr2r( hQMetaData->q_direction[1].band_data[d].elevation, hQMetaData->q_direction[1].band_data[b].elevation, nblocks ); + mvr2r( hQMetaData->q_direction[1].band_data[d].energy_ratio, hQMetaData->q_direction[1].band_data[b].energy_ratio, nblocks ); + + + if ( hQMetaData->q_direction[1].coherence_band_data != NULL ) + { + mvc2c( hQMetaData->q_direction[1].coherence_band_data[d].spread_coherence, hQMetaData->q_direction[1].coherence_band_data[b].spread_coherence, nblocks ); + } + d--; + } + else + { + set_f( hQMetaData->q_direction[1].band_data[b].azimuth, 0.0f, nblocks ); + set_f( hQMetaData->q_direction[1].band_data[b].elevation, 0.0f, nblocks ); + set_f( hQMetaData->q_direction[1].band_data[b].energy_ratio, 0.0f, nblocks ); + + if ( hQMetaData->q_direction[1].coherence_band_data != NULL ) + { + set_c( (int8_t *) hQMetaData->q_direction[1].coherence_band_data[b].spread_coherence, 0, nblocks ); + } + } + } + } + /* Scale energy ratios that sum to over one */ + for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) + { + float ratioSum; + for ( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) + { + ratioSum = hQMetaData->q_direction[0].band_data[b].energy_ratio[m] + hQMetaData->q_direction[1].band_data[b].energy_ratio[m]; + + if ( ratioSum > 1.0f ) + { + hQMetaData->q_direction[0].band_data[b].energy_ratio[m] = hQMetaData->q_direction[0].band_data[b].energy_ratio[m] / ratioSum; + hQMetaData->q_direction[1].band_data[b].energy_ratio[m] = hQMetaData->q_direction[1].band_data[b].energy_ratio[m] / ratioSum; + } + } + } + } + + +#ifdef DEBUG_MODE_QMETADATA + for ( d = 0; d < hQMetaData->no_directions; d++ ) + { + q_direction = &hQMetaData->q_direction[d]; + nbands = q_direction->cfg.nbands; + start_band = q_direction->cfg.start_band; + + + if ( d == 0 ) + { + fprintf( pF_surcoh, "frame %d/dir %d: ", frame, d ); + } + for ( b = start_band; b < nbands; b++ ) + { + for ( m = 0; m < q_direction->cfg.nblocks; m++ ) + { + + + if ( d == 0 && hQMetaData->surcoh_band_data != NULL ) + { + fprintf( pF_surcoh, " %d ", hQMetaData->surcoh_band_data[b].surround_coherence[m] ); + } + } + } + + + if ( d == 0 ) + { + fprintf( pF_surcoh, "\n" ); + } + } +#endif + /* Store status information for renderer use */ + hQMetaData->ec_flag = 0; + + hQMetaData->dir_comp_ratio = 1.0f; + + if ( hQMetaData->dir_comp_ratio > 1.0f ) + { + hQMetaData->dir_comp_ratio = 1.0f; + } + + return ( start_index_0 - *index ); } +#endif + /*-----------------------------------------------------------------------* * ivas_qmetadata_dec_sid_decode() @@ -1036,6 +1508,123 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness( } +#ifdef HR_METADATA +static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr( + uint16_t *bitstream, /* i : bitstream */ + int16_t *index, + IVAS_QDIRECTION *q_direction, + uint16_t *diffuseness_index_max_ec_frame ) +{ + int16_t b; + uint16_t dif_min; + int16_t index_start; + int16_t nbands; + int16_t start_band; + + index_start = *index; + nbands = q_direction->cfg.nbands; + start_band = q_direction->cfg.start_band; + + /* diffuseness decoding */ + /* Handle one band as special case*/ + if ( nbands == 1 ) + { + q_direction->band_data[0].energy_ratio_index[0] = 0; + for ( b = 0; b < MASA_BITS_ER_HR; b++ ) + { + q_direction->band_data[0].energy_ratio_index[0] = ( q_direction->band_data[0].energy_ratio_index[0] << 1 ) + bitstream[( *index )--]; + } + *diffuseness_index_max_ec_frame = 5; + + return MASA_BITS_ER_HR; + } + + if ( bitstream[( *index )--] == 0 ) /* dif_use_raw_coding */ + { + /* Decode with similarity strategy with low band count. On higher band counts, decode with Huffman-coding strategy. */ + + if ( bitstream[( *index )--] != 0 ) /* dif_have_unique_value */ + { + dif_min = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, HR_MASA_ER_LEVELS ); /* dif_unique_value */ + + for ( b = start_band; b < nbands; b++ ) + { + q_direction->band_data[b].energy_ratio_index[0] = dif_min; + } + } + else /* all diffuseness values are dif_min_value or dif_min_value + 1 */ + { + dif_min = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, HR_MASA_ER_LEVELS - 1 ); /* dif_min_value */ + + for ( b = start_band; b < nbands; b++ ) + { + q_direction->band_data[b].energy_ratio_index[0] = dif_min + bitstream[( *index )--]; /* dif_bit_offset_values */ + } + } + } + else /* different values for diffuseness */ + { + dif_min = HR_MASA_ER_LEVELS; + + for ( b = start_band; b < nbands; b++ ) + { + q_direction->band_data[b].energy_ratio_index[0] = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, HR_MASA_ER_LEVELS ); + dif_min = min( dif_min, q_direction->band_data[b].energy_ratio_index[0] ); + } + } + + *diffuseness_index_max_ec_frame = 10; + /* adaptively select the diffuseness_index_max_ec threshold */ + if ( dif_min > 10 ) + { + *diffuseness_index_max_ec_frame = HR_MASA_ER_LEVELS - 1; + } + + return ( index_start - *index ); +} + +static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr_512( + uint16_t *bitstream, /* i : bitstream */ + int16_t *index, + IVAS_QDIRECTION *q_direction ) +{ + int16_t b, k; + + int16_t index_start; + int16_t nbands, nblocks; + int16_t start_band; + + index_start = *index; + nbands = q_direction->cfg.nbands; + nblocks = q_direction->cfg.nblocks; + start_band = q_direction->cfg.start_band; + + /* diffuseness decoding */ + /* Handle one band as special case*/ + if ( nbands == 1 ) + { + q_direction->band_data[0].energy_ratio_index[0] = 0; + for ( b = 0; b < MASA_BITS_ER_HR; b++ ) + { + q_direction->band_data[0].energy_ratio_index[0] = ( q_direction->band_data[0].energy_ratio_index[0] << 1 ) + bitstream[( *index )--]; + } + + return MASA_BITS_ER_HR; + } + + + for ( b = start_band; b < nbands; b++ ) + { + for ( k = 0; k < nblocks; k++ ) + { + q_direction->band_data[b].energy_ratio_index[k] = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, HR_MASA_ER_LEVELS ); + } + } + + return ( index_start - *index ); +} +#endif + static int16_t ivas_qmetadata_entropy_decode_df_ratio( uint16_t *bitstream, int16_t *index, @@ -1161,7 +1750,12 @@ static int16_t ivas_qmetadata_entropy_decode_dir( int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, - const int16_t start_band ) + const int16_t start_band +#ifdef HR_METADATA + , + int16_t is_hr +#endif +) { int16_t b, m; int16_t diff_idx; @@ -1188,7 +1782,18 @@ static int16_t ivas_qmetadata_entropy_decode_dir( /*Raw coding for high diffuseness*/ for ( b = start_band; b < nbands; b++ ) { - diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + if ( is_hr ) + { + diff_idx = 0; + } + else + { +#endif + diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + } +#endif diff_idx_min = min( diff_idx_min, diff_idx ); if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { @@ -1198,8 +1803,11 @@ static int16_t ivas_qmetadata_entropy_decode_dir( { elev_alph[b] = no_theta_masa[bits_direction_masa[diff_idx] - 3] * 2 - 1; } - +#ifdef HR_METADATA + if ( q_direction->band_data[b].energy_ratio_index_mod[0] > diffuseness_index_max_ec_frame ) +#else if ( diff_idx > diffuseness_index_max_ec_frame ) +#endif { bands_entropic[b] = 0; @@ -1252,7 +1860,18 @@ static int16_t ivas_qmetadata_entropy_decode_dir( if ( bands_entropic[b] ) { int16_t tmp_index; - diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + if ( is_hr ) + { + diff_idx = 0; + } + else + { +#endif + diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + } +#endif if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { @@ -1300,7 +1919,19 @@ static int16_t ivas_qmetadata_entropy_decode_dir( { if ( bands_entropic[b] ) { - diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + if ( is_hr ) + { + diff_idx = 0; + } + else + { + +#endif + diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + } +#endif for ( m = 0; m < nblocks; m++ ) { int16_t tmp_index; @@ -1359,7 +1990,19 @@ static int16_t ivas_qmetadata_entropy_decode_dir( { if ( bands_entropic[b] ) { - diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + if ( is_hr ) + { + diff_idx = 0; + } + else + { + +#endif + diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + } +#endif for ( m = 0; m < nblocks; m++ ) { q_direction->band_data[b].elevation_index[m] = 0; @@ -1477,7 +2120,58 @@ static int16_t ivas_qmetadata_entropy_decode_dir( return ( index_start - *index ); } +#ifdef HR_METADATA +/*------------------------------------------------------------------------- + * ivas_qmetadata_raw_decode_dir() + * + * Main function for raw decoding of the directions + *------------------------------------------------------------------------*/ + +static int16_t ivas_qmetadata_raw_decode_dir_512( + IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ + uint16_t *bitstream, /* i : bitstream */ + int16_t *index, + const int16_t nbands, + const int16_t start_band, + SPHERICAL_GRID_DATA *sph_grid16 /* i: spherical grid for deindexing */ +) +{ + int16_t b, m, i; + int16_t nblocks; + int16_t index_start; + uint16_t value; + + index_start = *index; + nblocks = q_direction->cfg.nblocks; + + for ( b = start_band; b < nbands; b++ ) + { + for ( m = 0; m < nblocks; m++ ) + { + value = 0; + for ( i = 0; i < q_direction->band_data[b].bits_sph_idx[m]; i++ ) + { + value = ( value << 1 ) + bitstream[( *index )--]; + } + q_direction->band_data[b].spherical_index[m] = value; + if ( q_direction->band_data[b].bits_sph_idx[m] == 16 ) + { + deindex_sph_idx( value, sph_grid16, &( q_direction->band_data[b].elevation[m] ), &( q_direction->band_data[b].azimuth[m] ) ); + } + else + { + deindex_spherical_component( q_direction->band_data[b].spherical_index[m], &q_direction->band_data[b].azimuth[m], &q_direction->band_data[b].elevation[m], + &q_direction->band_data[b].azimuth_index[m], &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m], + q_direction->cfg.mc_ls_setup ); + } + } + } + + return ( index_start - *index ); +} + +#endif /*------------------------------------------------------------------------- * ivas_qmetadata_raw_decode_dir() * @@ -1489,7 +2183,12 @@ static int16_t ivas_qmetadata_raw_decode_dir( uint16_t *bitstream, /* i : bitstream */ int16_t *index, const int16_t nbands, - const int16_t start_band ) + const int16_t start_band +#ifdef HR_METADATA + , + int16_t is_hr +#endif +) { int16_t b, m, azith_alph; int16_t diff_idx; @@ -1507,7 +2206,18 @@ static int16_t ivas_qmetadata_raw_decode_dir( } else { - diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + if ( is_hr ) + { + diff_idx = 0; + } + else + { +#endif + diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; +#ifdef HR_METADATA + } +#endif for ( m = 0; m < nblocks; m++ ) { @@ -2548,6 +3258,10 @@ static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: quantized metadata structure */ int16_t idx_d, /* i : direction index */ const int16_t no_frames /* i : number of time subframes */ +#ifdef HR_METADATA + , + int16_t is_hr +#endif ) { int16_t i, j; @@ -2557,7 +3271,9 @@ static void decode_spread_coherence( int16_t MASA_grouping[MASA_MAXIMUM_CODING_SUBBANDS]; IVAS_QDIRECTION *q_direction; int16_t coding_subbands, coding_subbands_0, d, two_dir_band[MASA_MAXIMUM_CODING_SUBBANDS]; - +#ifdef HR_METADATA + int16_t min_index; +#endif coding_subbands_0 = hQMetaData->q_direction[0].cfg.nbands; coding_subbands = hQMetaData->q_direction[idx_d].cfg.nbands; if ( coding_subbands_0 <= 5 ) @@ -2612,7 +3328,26 @@ static void decode_spread_coherence( for ( i = 0; i < coding_subbands; i++ ) { var_azi = var( q_direction->band_data[i].azimuth, no_frames ); +#ifdef HR_METADATA + if ( is_hr ) + { + minimum_s( (int16_t *) ( q_direction->band_data[i].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); + min_index = min_index >> 1; + } + else + { + min_index = q_direction->band_data[i].energy_ratio_index[0]; + } + if ( var_azi < MASA_DELTA_AZI_DCT0 ) + { + idx_sub_cb = MASA_NO_CV_COH * min_index; + } + else + { + idx_sub_cb = MASA_NO_CV_COH * ( min_index + DIRAC_DIFFUSE_LEVELS ); /* NO_CV_COH = 8 */ + } +#else if ( var_azi < MASA_DELTA_AZI_DCT0 ) { idx_sub_cb = MASA_NO_CV_COH * q_direction->band_data[i].energy_ratio_index[0]; @@ -2621,7 +3356,7 @@ static void decode_spread_coherence( { idx_sub_cb = MASA_NO_CV_COH * ( q_direction->band_data[i].energy_ratio_index[0] + DIRAC_DIFFUSE_LEVELS ); /* NO_CV_COH = 8 */ } - +#endif dct_coh[i][0] = coherence_cb0_masa[idx_sub_cb + q_direction->coherence_band_data[i].spread_coherence_dct0_index]; if ( coding_subbands < coding_subbands_0 ) { @@ -2879,7 +3614,79 @@ static int16_t decode_fixed_rate_composed_index_coherence( return nbits; } +#ifdef HR_METADATA +/* !r: number of bits read */ +static int16_t read_coherence_data_hr_512( + uint16_t *bitstream, /* i : bitstream */ + int16_t *p_bit_pos, /* i : position in the bitstream */ + IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata structure */ + const int16_t idx_dir, /* i : direction index */ + int16_t nbits_coh ) +{ + int16_t j, k, i; + int16_t nbands, nblocks; + int16_t min_index, GR_param; + int16_t cb_size, nbits; + int16_t decoded_idx; + float delta; + + nbands = hQMetaData->q_direction[idx_dir].cfg.nbands; + nblocks = hQMetaData->q_direction[idx_dir].cfg.nblocks; + + + cb_size = 1 << nbits_coh; + delta = 256.0f / cb_size; + nbits = *p_bit_pos; + for ( k = 0; k < nblocks; k++ ) + { + /* read method */ + if ( bitstream[( *p_bit_pos )--] == 1 ) + { + /* average removed */ + /* read average index */ + min_index = 0; + for ( i = 0; i < nbits_coh; i++ ) + { + min_index = ( min_index << 1 ) + bitstream[( *p_bit_pos )--]; + } + /* read GR param */ + GR_param = bitstream[( *p_bit_pos )--]; + for ( j = 0; j < nbands; j++ ) + { + decoded_idx = ivas_qmetadata_DecodeExtendedGR( bitstream, p_bit_pos, 2 * cb_size, GR_param ); + if ( decoded_idx % 2 ) + { + decoded_idx = ( ( decoded_idx + 1 ) >> 1 ) + min_index; + } + else + { + decoded_idx = -( decoded_idx >> 1 ) + min_index; + } + hQMetaData->q_direction[idx_dir].coherence_band_data[j].spread_coherence[k] = (uint8_t) ( decoded_idx * delta + delta / 2.0f ); + } + } + else + { + /* read min_index */ + min_index = 0; + for ( i = 0; i < nbits_coh; i++ ) + { + min_index = ( min_index << 1 ) + bitstream[( *p_bit_pos )--]; + } + /* read GR param */ + GR_param = bitstream[( *p_bit_pos )--]; + for ( j = 0; j < nbands; j++ ) + { + decoded_idx = ivas_qmetadata_DecodeExtendedGR( bitstream, p_bit_pos, cb_size - min_index, GR_param ) + min_index; + hQMetaData->q_direction[idx_dir].coherence_band_data[j].spread_coherence[k] = (uint8_t) ( decoded_idx * delta + delta / 2.0f ); + } + } + } + nbits = nbits - *p_bit_pos; + return nbits; +} +#endif /*------------------------------------------------------------------ - * * read_coherence_data() * @@ -2892,6 +3699,10 @@ static int16_t read_coherence_data( int16_t *p_bit_pos, /* i : position in the bitstream */ IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata structure */ const int16_t idx_dir /* i : direction index */ +#ifdef HR_METADATA + , + int16_t is_hr +#endif ) { int16_t j; @@ -2909,6 +3720,9 @@ static int16_t read_coherence_data( int16_t decoded_idx[MASA_MAXIMUM_CODING_SUBBANDS]; uint16_t byteBuffer; int16_t idx_ER; +#ifdef HR_METADATA + int16_t min_index; +#endif coding_subbands = hQMetaData->q_direction[idx_dir].cfg.nbands; q_direction = &( hQMetaData->q_direction[idx_dir] ); @@ -2919,7 +3733,19 @@ static int16_t read_coherence_data( { for ( j = 0; j < coding_subbands; j++ ) { - idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH; +#ifdef HR_METADATA + if ( is_hr ) + { + idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + coding_subbands / MASA_FACTOR_CV_COH; + } + else + { + +#endif + idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH; +#ifdef HR_METADATA + } +#endif no_cv_vec[j] = idx_ER + 1; } @@ -2943,7 +3769,11 @@ static int16_t read_coherence_data( { if ( no_cv_vec[j] > 1 ) { +#ifdef HR_METADATA + q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_idx[j] * ( 255.0f / (float) ( 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> ( is_hr ) ) + coding_subbands / MASA_FACTOR_CV_COH ) ) ); +#else q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_idx[j] * ( 255.0f / (float) ( 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH ) ) ); +#endif } else { @@ -2960,7 +3790,11 @@ static int16_t read_coherence_data( { if ( no_cv_vec[j] > 1 ) { +#ifdef HR_METADATA + q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_index[j] * ( 255.0f / (float) ( 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> ( is_hr ) ) + coding_subbands / MASA_FACTOR_CV_COH ) ) ); +#else q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_index[j] * ( 255.0f / (float) ( 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH ) ) ); +#endif } else { @@ -2973,7 +3807,19 @@ static int16_t read_coherence_data( { for ( j = 0; j < coding_subbands; j++ ) { - no_cv_vec[j] = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; /* spread coherence DCT0*/ +#ifdef HR_METADATA + if ( is_hr ) + { + minimum_s( (int16_t *) ( q_direction->band_data[j].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); + no_cv_vec[j] = len_cb_dct0_masa[min_index >> 1]; /* spread coherence DCT0*/ + } + else + { +#endif + no_cv_vec[j] = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; /* spread coherence DCT0*/ +#ifdef HR_METADATA + } +#endif } if ( sum_s( no_cv_vec, coding_subbands ) > MASA_COH_LIMIT_2IDX ) @@ -3096,13 +3942,14 @@ static int16_t read_coherence_data( return nbits; } + /*-------------------------------------------------------------------* * read_surround_coherence() * * *-------------------------------------------------------------------*/ -int16_t read_surround_coherence( +static int16_t read_surround_coherence( uint16_t *bitstream, /* i : bitstream */ int16_t *p_bit_pos, /* i : position in the bitstream */ IVAS_QMETADATA *hQMetaData /* i/o: quantized metadata structure */ @@ -3256,7 +4103,162 @@ int16_t read_surround_coherence( return bits_sur_coherence; } +#ifdef HR_METADATA +static int16_t read_surround_coherence_hr( + uint16_t *bitstream, /* i : bitstream */ + int16_t *p_bit_pos, /* i : position in the bitstream */ + IVAS_QMETADATA *hQMetaData /* i/o: quantized metadata structure */ +) +{ + int16_t coding_subbands; + int16_t no_cv_vec[MASA_MAXIMUM_CODING_SUBBANDS]; + int16_t bit_pos; + float error_ratio_surr; + int16_t idx_ER[MASA_MAXIMUM_CODING_SUBBANDS]; + int16_t bits_sur_coherence, bits_GR; + int16_t j, k, sf; + uint16_t byteBuffer; + uint16_t idx_sur_coh[MASA_MAXIMUM_CODING_SUBBANDS]; + IVAS_QDIRECTION *q_direction; + int16_t min_index; + int16_t d, idx; + coding_subbands = hQMetaData->q_direction[0].cfg.nbands; + q_direction = hQMetaData->q_direction; + + bits_sur_coherence = 0; + bit_pos = *p_bit_pos; + + for ( sf = 0; sf < hQMetaData->q_direction[0].cfg.nblocks; sf++ ) + { + d = 0; + for ( j = 0; j < coding_subbands; j++ ) + { + error_ratio_surr = 1.0f; + if ( hQMetaData->no_directions == 2 ) + { + d += hQMetaData->twoDirBands[j]; + idx = max( d - 1, 0 ); + error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf] - q_direction[1].band_data[idx].energy_ratio[sf] * hQMetaData->twoDirBands[j]; + } + else + { + error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf]; + } + + + if ( error_ratio_surr <= 0 ) + { + error_ratio_surr = 0; + no_cv_vec[j] = 1; + idx_ER[j] = 0; + } + else + { + idx_ER[j] = 7; // masa_sq( error_ratio_surr, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + no_cv_vec[j] = idx_cb_sur_coh_masa[idx_ER[j]] + 2; + } + } + + if ( sum_s( no_cv_vec, coding_subbands ) == coding_subbands ) + { + /* surround coherence is zero */ + for ( j = 0; j < coding_subbands; j++ ) + { + for ( k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) + { + if ( hQMetaData->surcoh_band_data != NULL ) + { + hQMetaData->surcoh_band_data[j].surround_coherence[k] = 0; + } + } + } + } + else + { + + /* read how the surround coherence is encoded */ + byteBuffer = bitstream[bit_pos--]; + bits_sur_coherence += 1; + + if ( byteBuffer & 1 ) + { + /* GR decoding */ + /* read GR order */ + byteBuffer = bitstream[bit_pos--]; + bits_sur_coherence += 1; + + /* read min index */ + bits_GR = bit_pos; + min_index = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, MASA_MAX_NO_CV_SUR_COH, 0 ); + bits_sur_coherence += bits_GR - bit_pos; + + /* read GR data */ + for ( j = 0; j < coding_subbands; j++ ) + { + bits_GR = bit_pos; + /* decoding for min removed */ + if ( no_cv_vec[j] > 1 ) + { + idx_sur_coh[j] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, no_cv_vec[j] - min_index, ( byteBuffer & 1 ) ); + bits_sur_coherence += bits_GR - bit_pos; + } + else + { + idx_sur_coh[j] = 0; + } + } + + for ( j = 0; j < coding_subbands; j++ ) + { + if ( no_cv_vec[j] > 1 ) + { + hQMetaData->surcoh_band_data[j].sur_coherence_index = idx_sur_coh[j] + min_index; + hQMetaData->surcoh_band_data[j].surround_coherence[sf] = sur_coherence_cb_masa[idx_cb_sur_coh_masa[idx_ER[j]] * MASA_MAX_NO_CV_SUR_COH + hQMetaData->surcoh_band_data[j].sur_coherence_index]; + } + else + { + hQMetaData->surcoh_band_data[j].sur_coherence_index = idx_sur_coh[j]; + hQMetaData->surcoh_band_data[j].surround_coherence[sf] = 0; + } + } + } + else + { + /* fixed rate */ + uint16_t sur_coh_temp_index[MASA_MAXIMUM_CODING_SUBBANDS]; + set_s( (int16_t *) sur_coh_temp_index, 0, MASA_MAXIMUM_CODING_SUBBANDS ); + + decode_fixed_rate_composed_index_coherence( bitstream, &bit_pos, coding_subbands, no_cv_vec, sur_coh_temp_index, MASA_MAX_NO_CV_SUR_COH ); + + for ( j = 0; j < coding_subbands; j++ ) + { + hQMetaData->surcoh_band_data[j].sur_coherence_index = sur_coh_temp_index[j]; + } + + /* deindex surround coherence */ + for ( j = 0; j < coding_subbands; j++ ) + { + if ( no_cv_vec[j] > 1 ) + { + hQMetaData->surcoh_band_data[j].surround_coherence[sf] = sur_coherence_cb_masa[idx_cb_sur_coh_masa[idx_ER[j]] * MASA_MAX_NO_CV_SUR_COH + hQMetaData->surcoh_band_data[j].sur_coherence_index]; + } + else + { + hQMetaData->surcoh_band_data[j].surround_coherence[sf] = 0; + } + } + } + } + } + + /* Replace return value with the actual read bits. bits_sur_coherence might show wrong count at this point. */ + bits_sur_coherence = *p_bit_pos - bit_pos; + *p_bit_pos = bit_pos; + + return bits_sur_coherence; +} +#endif /*-------------------------------------------------------------------* * decode_combined_index() diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 04e3461e99a452098489dda3ac4ca6f0cdf76b26..2b034655f3427156e9b7a77c65379ff41099ed3c 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -226,16 +226,33 @@ const float dft_win_8k[70] = * stereo CNA tables *------------------------------------------------------------------------*/ +#ifdef FIX_I414_OOA_CNA +const int16_t cna_init_bands[CNA_INIT_NBANDS + 1] = +#else const int16_t cna_init_bands[MAX_CNA_NBANDS + 1] = +#endif { 1, 4, 14, 33, 67, 171, 320 }; -const float max_smooth_gains[SBA_DIRAC_STEREO_NUM_BANDS] = +const float max_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS] = +{ + 0.98f, 0.97f, 0.95f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f +}; + +const float min_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS] = { - 0.98f, 0.97f, 0.95f, 0.9f, 0.9f + 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f }; +const float max_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS] = +{ + 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.9f, 0.9f, 0.9f}; + +const float min_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS] = +{ + 0.5f, 0.5f, 0.5, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.3f, 0.3f, 0.3f +}; /*------------------------------------------------------------------------- * ECLVQ Stereo ROM tables @@ -507,49 +524,322 @@ const float ap_split_frequencies[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] = 0.0f, 0.125f, 0.375f, 1.0f }; +#ifdef SPAR_TUNING +const int16_t sba_map_tc[11] = +{ + 0, 1, 2, 3, 4, 8, 9, 15, 5, 6, 7 +}; +const int16_t sba_map_tc_512[11] = +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15 +}; +#else const int16_t sba_map_tc[8] = { 0, 1, 2, 3, 4, 8, 9, 15 }; +#endif /*----------------------------------------------------------------------------------* * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ -// VE2AT: move to in ivas_rom_dec ? -const float surCohEne[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = -{ - 3.0903f, 2.0053f, 1.0860f, 0.8072f, 0.7079f -}; -const float spreadCohEne05[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = -{ - 2.3988f, 1.7783f, 1.1220f, 1.1220f, 1.1220f -}; - -const float spreadCohEne1[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = -{ - 1.5975f, 1.1220f, 1.1220f, 1.1220f, 1.1220f -}; - -const float lowBitRateBinauralEQ[LOW_BIT_RATE_BINAURAL_EQ_BINS] = -{ - 0.979f, 0.893f, 0.762f, 0.615f, 0.52f, 0.48f, 0.477f, 0.477f, 0.48f, 0.501f, 0.546f, 0.602f, 0.652f, 0.664f, 0.652f, 0.639f, 0.635f -}; - -const float diffuseFieldCoherenceDifferenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS] = +const float dmxmtx_table[BINAURAL_CHANNELS][11] = { - 0.047421f, 0.19773f, 0.22582f, 0.10637f, 0.0087111f, 0.012028f, 0.031972f, 0.019668f, 0.0079928f + { 1.0f, 0.0f, 0.70709997f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }, + { 0.0f, 1.0f, 0.70709997f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f }, }; -const float diffuseFieldCoherenceDifferenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS] = -{ - -0.095628f, -0.30569f, -0.34427f, -0.15425f, -0.044628f, -0.057224f, -0.050835f, -0.035214f, -0.02215f -}; -const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS] = -{ - 0.048207f, 0.10796f, 0.11845f, 0.047886f, 0.035917f, 0.045196f, 0.018863f, 0.015547f, 0.014157f +/* clang-format on */ + +#ifdef MC_PARAMUPMIX_MODE + +const int16_t huff_nodes_first_band_alpha[32][2] = { /* Alpha Fine Huffman table df0 */ + { -17, 1 }, + { 3, 2 }, + { -16, -18 }, + { 5, 4 }, + { -15, 6 }, + { -19, 7 }, + { 9, 8 }, + { 11, 10 }, + { -14, -20 }, + { 13, 12 }, + { -21, 14 }, + { -13, 15 }, + { 17, 16 }, + { -22, 18 }, + { -12, 19 }, + { -9, -10 }, + { -11, 20 }, + { -23, 21 }, + { -8, 22 }, + { -24, 23 }, + { -25, 24 }, + { -7, 25 }, + { -26, 26 }, + { 28, 27 }, + { -6, -27 }, + { -33, 29 }, + { -1, -28 }, + { -5, 30 }, + { -29, -30 }, + { -4, 31 }, + { -3, -31 }, + { -2, -32 } +}; +const int16_t huff_nodes_first_band_alpha_coarse[16][2] = { /* Alpha Coarse Huffman table df0 */ + { -9, 1 }, + { -8, 2 }, + { -10, 3 }, + { 5, 4 }, + { -7, 6 }, + { -11, 7 }, + { -5, 8 }, + { -6, 9 }, + { -12, 10 }, + { -13, 11 }, + { -4, 12 }, + { -14, 13 }, + { -3, 14 }, + { -15, 15 }, + { -2, -16 }, + { -1, -17 } +}; + + +const int16_t huff_nodes_alpha_1D_DF[64][2] = { /* Alpha Fine Huffman table df */ + { -33, 1 }, + { 3, 2 }, + { -32, -34 }, + { 5, 4 }, + { -31, -35 }, + { 7, 6 }, + { -30, 8 }, + { -36, 9 }, + { 11, 10 }, + { -37, 12 }, + { -29, 13 }, + { -28, 14 }, + { -38, 15 }, + { 17, 16 }, + { -27, -39 }, + { 19, 18 }, + { -26, 20 }, + { -40, 21 }, + { 23, 22 }, + { -41, 24 }, + { -25, 25 }, + { -24, 26 }, + { -42, 27 }, + { -43, 28 }, + { -23, 29 }, + { -44, 30 }, + { -22, 31 }, + { -45, 32 }, + { -21, 33 }, + { -20, 34 }, + { -46, 35 }, + { -19, 36 }, + { -47, 37 }, + { -18, -48 }, + { 39, 38 }, + { -17, -49 }, + { 41, 40 }, + { -16, 42 }, + { -1, -50 }, + { -65, 43 }, + { 45, 44 }, + { -51, 46 }, + { -15, 47 }, + { 49, 48 }, + { -52, 50 }, + { -14, 51 }, + { 53, 52 }, + { -13, 54 }, + { -53, 55 }, + { 57, 56 }, + { -12, 58 }, + { -54, 59 }, + { 61, 60 }, + { -55, 62 }, + { -11, 63 }, + { -10, -61 }, + { -5, -57 }, + { -58, -60 }, + { -56, -59 }, + { -4, -6 }, + { -7, -64 }, + { -9, -63 }, + { -3, -8 }, + { -2, -62 } +}; +const int16_t huff_nodes_alpha_1D_DF_coarse[32][2] = { /* Alpha Coarse Huffman table df */ + { -17, 1 }, + { -18, 2 }, + { -16, 3 }, + { -15, 4 }, + { -19, 5 }, + { 7, 6 }, + { -14, -20 }, + { 9, 8 }, + { -13, -21 }, + { 11, 10 }, + { -22, 12 }, + { -12, 13 }, + { -23, 14 }, + { -11, 15 }, + { -10, 16 }, + { -24, 17 }, + { -9, -25 }, + { 19, 18 }, + { -26, 20 }, + { -8, 21 }, + { 23, 22 }, + { 25, 24 }, + { -27, 26 }, + { -7, 27 }, + { -1, -33 }, + { -6, 28 }, + { -28, 29 }, + { -29, 30 }, + { -5, -31 }, + { -30, 31 }, + { -3, -4 }, + { -2, -32 } +}; + +const int16_t huff_nodes_alpha_1D_DT[64][2] = { /* Alpha Fine Huffman table dt */ + { -33, 1 }, + { -34, 2 }, + { -32, 3 }, + { 5, 4 }, + { -31, -35 }, + { 7, 6 }, + { -36, 8 }, + { -30, 9 }, + { 11, 10 }, + { -29, -37 }, + { 13, 12 }, + { 15, 14 }, + { -28, -38 }, + { 17, 16 }, + { -27, -39 }, + { 19, 18 }, + { -40, 20 }, + { -26, 21 }, + { 23, 22 }, + { -25, -41 }, + { 25, 24 }, + { -24, -42 }, + { 27, 26 }, + { -23, -43 }, + { 29, 28 }, + { -22, -44 }, + { 31, 30 }, + { -45, 32 }, + { -21, 33 }, + { -20, 34 }, + { -46, 35 }, + { -47, 36 }, + { -19, 37 }, + { -48, 38 }, + { -18, 39 }, + { 41, 40 }, + { -17, -49 }, + { 43, 42 }, + { -50, 44 }, + { -16, 45 }, + { 47, 46 }, + { -51, 48 }, + { -15, 49 }, + { 51, 50 }, + { -52, -65 }, + { -1, -14 }, + { 53, 52 }, + { -53, 54 }, + { -13, 55 }, + { 57, 56 }, + { -12, 58 }, + { -54, 59 }, + { 61, 60 }, + { -11, -55 }, + { -56, 62 }, + { -10, 63 }, + { -9, -57 }, + { -5, -6 }, + { -58, -61 }, + { -7, -59 }, + { -8, -62 }, + { -4, -60 }, + { -3, -64 }, + { -2, -63 } +}; +const int16_t huff_nodes_alpha_1D_DT_coarse[32][2] = { /* Alpha Coarse Huffman table dt */ + { -17, 1 }, + { -18, 2 }, + { -16, 3 }, + { -19, 4 }, + { -15, 5 }, + { 7, 6 }, + { -14, -20 }, + { 9, 8 }, + { -21, 10 }, + { -13, 11 }, + { 13, 12 }, + { -12, -22 }, + { 15, 14 }, + { -11, -23 }, + { 17, 16 }, + { -24, 18 }, + { -10, 19 }, + { -25, 20 }, + { -9, 21 }, + { 23, 22 }, + { -26, 24 }, + { -8, 25 }, + { 27, 26 }, + { -1, -33 }, + { -7, -27 }, + { 29, 28 }, + { -28, 30 }, + { -6, 31 }, + { -5, -29 }, + { -3, -31 }, + { -4, -30 }, + { -2, -32 } +}; + +const int16_t huff_nodes_first_band_beta[8][2] = /* Beta Fine Huffman table df0 */ + { { -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, 4 }, { -5, 5 }, { -6, 6 }, { -7, 7 }, { -8, -9 } }; +const int16_t huff_nodes_first_band_beta_coarse[4][2] = /* Beta Coarse Huffman table df0 */ + { { -1, 1 }, { -2, 2 }, { -3, 3 }, { -4, -5 } }; + +const int16_t huff_nodes_beta_1D_DF[16][2] = /* Beta Fine Huffman table df */ + { { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { 9, 8 }, { -5, -13 }, { 11, 10 }, { -4, -14 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 } }; +const int16_t huff_nodes_beta_1D_DF_coarse[8][2] = /* Beta Coarse Huffman table df */ + { { -5, 1 }, { -6, 2 }, { -4, 3 }, { -3, 4 }, { -7, 5 }, { -2, 6 }, { -8, 7 }, { -1, -9 } }; + +const int16_t huff_nodes_beta_1D_DT[16][2] = /* Beta Fine Huffman table dt */ + { { -9, 1 }, { -10, 2 }, { -8, 3 }, { -11, 4 }, { -7, 5 }, { 7, 6 }, { -6, -12 }, { -13, 8 }, { -5, 9 }, { -14, 10 }, { -4, 11 }, { -15, 12 }, { -3, 13 }, { -16, 14 }, { -2, 15 }, { -1, -17 } }; +const int16_t huff_nodes_beta_1D_DT_coarse[8][2] = /* Beta Coarse Huffman table dt */ + { { -5, 1 }, { -6, 2 }, { -4, 3 }, { -7, 4 }, { -3, 5 }, { -8, 6 }, { -2, 7 }, { -1, -9 } }; + +HUFF_NODE_TABLE huff_nodes_df0 = { + { huff_nodes_first_band_alpha, huff_nodes_first_band_alpha_coarse }, + { huff_nodes_first_band_beta, huff_nodes_first_band_beta_coarse } +}; + +HUFF_NODE_TABLE huff_nodes_df = { + { huff_nodes_alpha_1D_DF, huff_nodes_alpha_1D_DF_coarse }, + { huff_nodes_beta_1D_DF, huff_nodes_beta_1D_DF_coarse } +}; + +HUFF_NODE_TABLE huff_nodes_dt = { + { huff_nodes_alpha_1D_DT, huff_nodes_alpha_1D_DT_coarse }, + { huff_nodes_beta_1D_DT, huff_nodes_beta_1D_DT_coarse } }; -/* clang-format on */ +#endif diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index 00995b1ebce442e646b983b4e7fb745954c9de9d..81aec535a2b901fcb5df063b8967694b713e1284 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -60,7 +60,6 @@ extern const float dft_ap_gains[5][3]; extern const int16_t dft_ap_delays[3][3]; extern const float dft_res_pred_weights[][STEREO_DFT_BAND_MAX]; - extern const float dft_win232ms_8k[75]; extern const float dft_win232ms_12k8[120]; extern const float dft_win232ms_16k[150]; @@ -69,8 +68,16 @@ extern const float dft_win232ms_48k[450]; extern const float dft_win_8k[70]; +#ifdef FIX_I414_OOA_CNA +extern const int16_t cna_init_bands[CNA_INIT_NBANDS + 1]; +#else extern const int16_t cna_init_bands[MAX_CNA_NBANDS + 1]; -extern const float max_smooth_gains[SBA_DIRAC_STEREO_NUM_BANDS]; +#endif + +extern const float min_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS]; +extern const float max_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS]; +extern const float min_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS]; +extern const float max_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS]; /*----------------------------------------------------------------------------------* @@ -108,52 +115,42 @@ extern const float ap_lattice_coeffs_3[DIRAC_DECORR_FILTER_LEN_3 * DIRAC_MAX_NUM extern const float *const ap_lattice_coeffs[DIRAC_DECORR_NUM_SPLIT_BANDS]; extern const float ap_split_frequencies[DIRAC_DECORR_NUM_SPLIT_BANDS + 1]; +#ifdef SPAR_TUNING +extern const int16_t sba_map_tc[11]; +extern const int16_t sba_map_tc_512[11]; +#else extern const int16_t sba_map_tc[8]; +#endif /*----------------------------------------------------------------------------------* - * LS Configuration Converter ROM tables + * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ -/* Downmix matrices */ -extern const float ls_conversion_cicpX_mono[12][1]; -extern const float ls_conversion_cicpX_stereo[12][2]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp6[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp6[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp12[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp6[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp14[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp6[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp12[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp14[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp16[]; - -/* Upmix matrices */ -extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp14[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp16[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp19[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp19[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp19[]; - -/* Mapping table of input config : output config with corresponding matrix */ -extern const LS_CONVERSION_MAPPING ls_conversion_mapping[]; +extern const float dmxmtx_table[BINAURAL_CHANNELS][11]; -/*----------------------------------------------------------------------------------* - * FASTCONV and PARAMETRIC binaural renderer ROM tables - *----------------------------------------------------------------------------------*/ +#ifdef MC_PARAMUPMIX_MODE +extern const int16_t huff_nodes_first_band_alpha[32][2]; +extern const int16_t huff_nodes_first_band_alpha_coarse[16][2]; + -/* These are equalization values for spread and surround coherent sounds, approximating the spectrum - * for such sounds at anechoic multichannel listening. */ -extern const float surCohEne[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; -extern const float spreadCohEne05[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; -extern const float spreadCohEne1[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; +extern const int16_t huff_nodes_alpha_1D_DF[64][2]; +extern const int16_t huff_nodes_alpha_1D_DF_coarse[32][2]; -/* Values for low-bit-rate equalization */ -extern const float lowBitRateBinauralEQ[LOW_BIT_RATE_BINAURAL_EQ_BINS]; +extern const int16_t huff_nodes_alpha_1D_DT[64][2]; +extern const int16_t huff_nodes_alpha_1D_DT_coarse[32][2]; -/* Diffuse field binaural coherence directional adjustment values */ -extern const float diffuseFieldCoherenceDifferenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS]; -extern const float diffuseFieldCoherenceDifferenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS]; -extern const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS]; +extern const int16_t huff_nodes_first_band_beta[8][2]; +extern const int16_t huff_nodes_first_band_beta_coarse[4][2]; + +extern const int16_t huff_nodes_beta_1D_DF[16][2]; +extern const int16_t huff_nodes_beta_1D_DF_coarse[8][2]; + +extern const int16_t huff_nodes_beta_1D_DT[16][2]; +extern const int16_t huff_nodes_beta_1D_DT_coarse[8][2]; +extern const HUFF_NODE_TABLE huff_nodes_df0; +extern const HUFF_NODE_TABLE huff_nodes_df; +extern const HUFF_NODE_TABLE huff_nodes_dt; +#endif #endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c old mode 100644 new mode 100755 index fbdc4f5857aa8476838224c607da1be53f5c43ae..471916d12c556f38d07f274bdea2deaa7f6a02f5 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -37,9 +37,8 @@ #include "ivas_cnst.h" #include "prot.h" #include "ivas_prot.h" -#ifdef SBA_BR_SWITCHING +#include "ivas_prot_rend.h" #include "ivas_rom_com.h" -#endif #include "ivas_rom_dec.h" #include #ifdef DEBUGGING @@ -47,337 +46,24 @@ #endif #include "wmc_auto.h" -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING + /*-------------------------------------------------------------------* - * ivas_sba_dec_reinit() + * ivas_sba_set_cna_cng_flag() * - * Reinitialisation of IVAS SBA decoder + * Set CNA/CNG flags in IVAS SBA decoder *-------------------------------------------------------------------*/ -ivas_error ivas_sba_dec_reinit( +void ivas_sba_set_cna_cng_flag( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { - int16_t i, k, n; - int16_t sce_id, cpe_id; - int16_t numCldfbAnalyses; - int16_t numCldfbSyntheses; - int32_t output_Fs, ivas_total_brate; - AUDIO_CONFIG output_config; - DECODER_CONFIG_HANDLE hDecoderConfig; - ivas_error error; - - error = IVAS_ERR_OK; - - hDecoderConfig = st_ivas->hDecoderConfig; - output_Fs = hDecoderConfig->output_Fs; - output_config = hDecoderConfig->output_config; - ivas_total_brate = hDecoderConfig->ivas_total_brate; - - hDecoderConfig->last_ivas_total_brate = ivas_total_brate; - st_ivas->last_active_ivas_total_brate = ivas_total_brate; - - /*------------------------------------------------------------------------------------------* - * Closing Decoder handles before Reinitialisation - *------------------------------------------------------------------------------------------*/ - /* Qmetadata handle */ - ivas_qmetadata_close( &st_ivas->hQMetaData ); - - /* DirAC handle */ - if ( st_ivas->hDirAC != NULL ) - { - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - ivas_param_ism_dec_close( st_ivas->hDirAC, hDecoderConfig->output_config ); - } - else - { - ivas_dirac_dec_close( st_ivas->hDirAC ); - } - st_ivas->hDirAC = NULL; - } - - /* Spar handle */ - if ( st_ivas->hSpar != NULL ) - { - ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs ); - st_ivas->hSpar = NULL; - } - - /* SCE handles */ - for ( i = 0; i < MAX_SCE; i++ ) - { - if ( st_ivas->hSCE[i] != NULL ) - { - destroy_sce_dec( st_ivas->hSCE[i] ); - st_ivas->hSCE[i] = NULL; - } - } + int16_t n, cpe_id; - /* CPE handles */ - for ( i = 0; i < MAX_CPE; i++ ) - { - if ( st_ivas->hCPE[i] != NULL ) - { - /* set pointer to NULL as core coder already deallocated in destroy_sce_dec() */ - if ( st_ivas->sba_dirac_stereo_flag ) - { - st_ivas->hCPE[i]->hCoreCoder[0] = NULL; - st_ivas->hCPE[i]->hCoreCoder[1] = NULL; - } - destroy_cpe_dec( st_ivas->hCPE[i] ); - st_ivas->hCPE[i] = NULL; - } - } - - /* MCT handle */ - ivas_mct_dec_close( &st_ivas->hMCT ); - - /* HP20 filter handles */ - if ( st_ivas->mem_hp20_out != NULL ) - { - for ( i = 0; i < getNumChanSynthesis( st_ivas ); i++ ) - { - free( st_ivas->mem_hp20_out[i] ); - st_ivas->mem_hp20_out[i] = NULL; - } - free( st_ivas->mem_hp20_out ); - st_ivas->mem_hp20_out = NULL; - } - - /* HOA decoder matrix */ - if ( st_ivas->hoa_dec_mtx != NULL ) - { - free( st_ivas->hoa_dec_mtx ); - st_ivas->hoa_dec_mtx = NULL; - } - - /* Parametric MC handle */ - ivas_param_mc_dec_close( &st_ivas->hParamMC ); - - /* EFAP handle */ - efap_free_data( &st_ivas->hEFAPdata ); - - /* VBAP handle */ - vbap_free_data( &( st_ivas->hVBAPdata ) ); - - /* Fastconv binaural renderer handle */ - ivas_binRenderer_close( &st_ivas->hBinRenderer ); - - /* Parametric binaural renderer handle */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - - /* Crend handle */ -#ifdef FIX_197_CREND_INTERFACE - ivas_rend_closeCrend( &st_ivas->hCrendWrapper ); -#else - ivas_crend_close( st_ivas ); -#endif - - /* LS config converter handle */ - ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); - - /* Custom LS configuration handle */ - if ( st_ivas->hLsSetupCustom != NULL ) - { - free( st_ivas->hLsSetupCustom ); - st_ivas->hLsSetupCustom = NULL; - } - - /* MASA decoder structure */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_dec_close( st_ivas->hMasa ); - st_ivas->hMasa = NULL; - } - - /* Downmix structure */ - if ( st_ivas->hMonoDmxRenderer != NULL ) - { - free( st_ivas->hMonoDmxRenderer ); - st_ivas->hMonoDmxRenderer = NULL; - } - - /* Head track data handle */ - if ( st_ivas->hHeadTrackData != NULL ) - { - free( st_ivas->hHeadTrackData ); - st_ivas->hHeadTrackData = NULL; - } - - /* Time Domain binaural renderer handle */ - if ( st_ivas->hBinRendererTd != NULL ) - { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - } - else if ( st_ivas->hHrtfTD != NULL ) - { - BSplineModelEvalDealloc( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); - - ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); - } - - /* Config. Renderer */ - ivas_render_config_close( &( st_ivas->hRenderConfig ) ); - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - if ( st_ivas->cldfbAnaDec[i] != NULL ) - { - deleteCldfb( &( st_ivas->cldfbAnaDec[i] ) ); - st_ivas->cldfbAnaDec[i] = NULL; - } - } - - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - if ( st_ivas->cldfbSynDec[i] != NULL ) - { - deleteCldfb( &( st_ivas->cldfbSynDec[i] ) ); - st_ivas->cldfbSynDec[i] = NULL; - } - } - - /*------------------------------------------------------------------------------------------* - * Reopening Decoder handles for Reinitialisation - *------------------------------------------------------------------------------------------*/ - - /* Allocate and initialize Custom loudspeaker layout handle */ - if ( hDecoderConfig->Opt_LsCustom ) - { - if ( ( error = ivas_ls_custom_open( &( st_ivas->hLsSetupCustom ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* Allocate and initialize Head-Tracking handle */ - if ( hDecoderConfig->Opt_Headrotation ) - { - if ( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* Allocate HRTF binary handle */ - if ( hDecoderConfig->Opt_HRTF_binary ) - { - if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - st_ivas->sba_dirac_stereo_flag = 0; - /*Reconfigure output paramaters*/ - ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init ); - ivas_renderer_select( st_ivas ); - ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); - if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) - { - if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - for ( k = 0; k < DIRAC_MAX_NBANDS; k++ ) - { - st_ivas->hSpar->dirac_to_spar_md_bands[k] = st_ivas->hDirAC->dirac_to_spar_md_bands[k]; - } - st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; - } - else - { - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - - st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), - st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); - } - } - else - { - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ); - } - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && - st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - if ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) - { - return error; - } - - reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); - } - - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - if ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } - - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); - } - } - - /* create CPE element for DFT Stereo like upmix */ - if ( st_ivas->sba_dirac_stereo_flag ) - { - if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ - } - - /* set CNA/CNG flags */ if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; + /* skip as done in init function */ + /* st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; */ /* Todo: Check if these can be enabled */ + /* st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; */ } else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) { @@ -392,175 +78,24 @@ ivas_error ivas_sba_dec_reinit( st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; } } - - if ( st_ivas->nCPE > 1 ) - { - if ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - /* set number of output channels used for synthesis/decoding */ - n = getNumChanSynthesis( st_ivas ); - - if ( n > 0 ) - { - if ( ( st_ivas->mem_hp20_out = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - } else { - st_ivas->mem_hp20_out = NULL; - } - - for ( i = 0; i < n; i++ ) - { - if ( ( st_ivas->mem_hp20_out[i] = (float *) malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM ); - } - if ( hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) - { - if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ivas_render_config_init_from_rom( &st_ivas->hRenderConfig, hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) != IVAS_ERR_OK ) - { - return IVAS_ERR_INTERNAL_FATAL; - } - } - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { -#ifdef HRTF_BINARY_FILE - if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) - { - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) - { - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { -#ifdef FIX_197_CREND_INTERFACE - if ( ( st_ivas->hCrendWrapper = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CrendWrapper\n" ); - } - if ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) -#else - if ( ( st_ivas->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) -#endif + for ( n = 0; n < CPE_CHANNELS; n++ ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cna_dirac_flag = 0; + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 0; } } } - else if ( st_ivas->renderer_type == RENDERER_MC ) - { - if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) - { - if ( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { -#ifdef FIX_197_CREND_INTERFACE - if ( ( error = ivas_rend_openCrend( &st_ivas->hCrendWrapper, - getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), - getRendAudioConfigFromIvasAudioConfig( st_ivas->hDecoderConfig->output_config ), - st_ivas->hRenderConfig, - t_ivas->hDecoderConfig->Opt_Headrotation, -#ifdef HRTF_BINARY_FILE - st_ivas->hSetOfHRTF, -#endif - st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#else - if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "ivas_crend_open failed" ); - } -#endif - } - ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); - for ( i = 0; i < numCldfbAnalyses; i++ ) - { - if ( ( error = openCldfb( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) - { - return error; - } - } - for ( ; i < MAX_INTERN_CHANNELS; i++ ) - { - st_ivas->cldfbAnaDec[i] = NULL; - } + return; +} - for ( i = 0; i < numCldfbSyntheses; i++ ) - { - if ( ( error = openCldfb( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) - { - return error; - } - } - for ( ; i < MAX_OUTPUT_CHANNELS; i++ ) - { - st_ivas->cldfbSynDec[i] = NULL; - } - /* CLDFB Interpolation weights */ - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) - { - ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); - } - return error; -} -#endif -#endif /*-------------------------------------------------------------------* - * ivas_sba_dec_decoder() + * ivas_sba_dec_reconfigure() * * Reconfigure IVAS SBA decoder *-------------------------------------------------------------------*/ @@ -573,202 +108,108 @@ ivas_error ivas_sba_dec_reconfigure( AUDIO_CONFIG intern_config_old; int16_t numCldfbAnalyses_old, numCldfbSyntheses_old; int16_t sba_dirac_stereo_flag_old; -#ifdef SBA_BR_SWITCHING_RECONFIG - SBA_MODE sba_mode_old; - int32_t ivas_total_brate, last_ivas_total_brate; -#else -#ifndef SBA_BR_SWITCHING - int32_t ivas_total_brate, last_ivas_total_brate; -#else int32_t ivas_total_brate; +#ifdef HODIRAC + int32_t last_ivas_total_brate; #endif -#endif + + RENDERER_TYPE old_renderer_type; + DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; - error = IVAS_ERR_OK; hDecoderConfig = st_ivas->hDecoderConfig; ivas_total_brate = hDecoderConfig->ivas_total_brate; -#ifdef SBA_BR_SWITCHING_RECONFIG +#ifdef HODIRAC last_ivas_total_brate = st_ivas->last_active_ivas_total_brate; - sba_mode_old = ivas_sba_mode_select( last_ivas_total_brate ); - - st_ivas->sba_mode = sba_mode_old; -#else -#ifndef SBA_BR_SWITCHING - last_ivas_total_brate = hDecoderConfig->last_ivas_total_brate; -#endif #endif + + /*-----------------------------------------------------------------* * Set SBA high-level parameters * Save old SBA high-level parameters *-----------------------------------------------------------------*/ - ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); - nchan_hp20_old = getNumChanSynthesis( st_ivas ); - nSCE_old = st_ivas->nSCE; nCPE_old = st_ivas->nCPE; nchan_transport_old = st_ivas->nchan_transport; sba_dirac_stereo_flag_old = st_ivas->sba_dirac_stereo_flag; st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); -#ifdef SBA_BR_SWITCHING_RECONFIG - st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); +#ifdef JBM_TSM_ON_TCS + /* save old */ + if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) + { + st_ivas->hTcBuffer->num_slots = st_ivas->hSpar->num_slots; + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpar->nb_subframes; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpar->slots_rendered; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpar->subframes_rendered; + mvs2s( st_ivas->hSpar->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + else if ( st_ivas->hDirAC != NULL ) + { + st_ivas->hTcBuffer->num_slots = st_ivas->hDirAC->num_slots; + st_ivas->hTcBuffer->nb_subframes = st_ivas->hDirAC->nb_subframes; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hDirAC->slots_rendered; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; + mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } #endif -#ifdef SBA_BR_SWITCHING + /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SBA handles + * Allocate, initialize, and configure SBA handles *-----------------------------------------------------------------*/ + int16_t sba_order_internal; + SPAR_DEC_HANDLE hSpar; + hSpar = st_ivas->hSpar; - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) - { - ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs ); - st_ivas->hSpar = NULL; + sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) + if ( hSpar != NULL ) + { + if ( ( hSpar->hPCA != NULL ) && ( ( hDecoderConfig->ivas_total_brate != PCA_BRATE ) || ( sba_order_internal != 1 ) ) ) { - return error; + free( st_ivas->hSpar->hPCA ); + hSpar->hPCA = NULL; } - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ); - } - else - { -#ifdef SBA_BR_SWITCHING_RECONFIG - int16_t i, sba_order_internal, nchan_internal; -#else - int16_t sba_order_internal; + if ( nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) +#ifdef HODIRAC + || ( last_ivas_total_brate >= IVAS_512k && ivas_total_brate < IVAS_512k ) || ( last_ivas_total_brate < IVAS_512k && ivas_total_brate >= IVAS_512k ) #endif - DIRAC_DEC_HANDLE hDirAC = st_ivas->hDirAC; - SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); -#ifdef SBA_BR_SWITCHING_RECONFIG - nchan_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); - if ( hSpar != NULL && nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) + ) { - // VE: dirty patch -> reconfiguration of SPAR modules should be used instead !! - IVAS_FB_CFG *fb_cfg; - int16_t active_w_mixing; - - /* MD handle */ - ivas_spar_md_dec_close( &hSpar->hMdDec ); + ivas_spar_dec_close( &( st_ivas->hSpar ), hDecoderConfig->output_Fs, 1 ); - if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, nchan_internal, sba_order_internal ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_dec_open( st_ivas, 1 ) ) != IVAS_ERR_OK ) { return error; } - hSpar->hMdDec->td_decorr_flag = 1; - hSpar->hMdDec->table_idx = -1; - - /* TD decorr. */ - ivas_spar_td_decorr_dec_close( &hSpar->hTdDecorr ); - - if ( ( error = ivas_spar_td_decorr_dec_open( &hSpar->hTdDecorr, hDecoderConfig->output_Fs, nchan_internal, 1 ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* FB mixer handle */ - ivas_FB_mixer_close( &hSpar->hFbMixer, hDecoderConfig->output_Fs ); - - /* set FB config. */ - active_w_mixing = -1; - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_internal, nchan_internal, active_w_mixing, hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - fb_cfg->pcm_offset = NS2SA( hDecoderConfig->output_Fs, DELAY_FB_1_NS + IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ); - fb_cfg->remix_order = remix_order_set[hSpar->hMdDec->spar_md_cfg.remix_unmix_order]; - - /* FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &hSpar->hFbMixer, hDecoderConfig->output_Fs, fb_cfg ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* mixer_mat intitialization */ - for ( i = 0; i < nchan_internal; i++ ) - { - for ( int16_t j = 0; j < nchan_internal; j++ ) - { - for ( int16_t b = 0; b < IVAS_MAX_NUM_BANDS; b++ ) - { - hSpar->hMdDec->mixer_mat[i][j][b] = 0.0f; - for ( int16_t i_ts = 0; i_ts < ( MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); i_ts++ ) - { - hSpar->hMdDec->mixer_mat_prev[i_ts][i][j][b] = 0.0f; - } - } - } - } - hSpar->i_subframe = 0; } -#endif - /* PCA handle */ - if ( hSpar != NULL ) - { - if ( hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 ) - { - if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" ); - } - ivas_pca_dec_init( hSpar->hPCA ); - } - else if ( hSpar->hPCA != NULL ) - { - free( st_ivas->hSpar->hPCA ); - hSpar->hPCA = NULL; - } - } -#ifdef SBA_BR_SWITCHING_RECONFIG - if ( hSpar == NULL && st_ivas->sba_mode == SBA_MODE_SPAR ) - { - if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - hSpar = st_ivas->hSpar; - } -#endif - st_ivas->sba_dirac_stereo_flag = 0; - - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format ); - - if ( hDirAC == NULL && st_ivas->sba_mode == SBA_MODE_DIRAC ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - hDirAC = st_ivas->hDirAC; - } -#ifndef SBA_BR_SWITCHING_RECONFIG - if ( hDirAC != NULL ) -#else - if ( ( hDirAC != NULL ) && ( sba_mode_old == st_ivas->sba_mode ) ) -#endif - { - ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE_MODE ); -#ifndef SBA_BR_SWITCHING_RECONFIG - mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); - hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; -#endif - } - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) + } + else + { + if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; } } + + hSpar = st_ivas->hSpar; + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); +#ifdef JBM_TSM_ON_TCS + /* synchronize subframe info */ + st_ivas->hSpar->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpar->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpar->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + st_ivas->hSpar->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpar->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); +#endif if ( st_ivas->nchan_transport == 1 ) { st_ivas->element_mode_init = IVAS_SCE; @@ -777,19 +218,14 @@ ivas_error ivas_sba_dec_reconfigure( { st_ivas->element_mode_init = IVAS_CPE_MDCT; } -#else - ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &st_ivas->nchan_transport, st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init ); -#endif /*-----------------------------------------------------------------* * Renderer selection *-----------------------------------------------------------------*/ + /* renderer might have changed */ intern_config_old = st_ivas->intern_config; -#ifdef SBA_BR_SWITCHING - RENDERER_TYPE old_renderer_type; old_renderer_type = st_ivas->renderer_type; -#endif ivas_renderer_select( st_ivas ); /* side effect of the renderer selection can be a changed internal config */ @@ -814,13 +250,11 @@ ivas_error ivas_sba_dec_reconfigure( { ivas_binRenderer_close( &st_ivas->hBinRenderer ); } -#ifdef SBA_BR_SWITCHING + if ( st_ivas->renderer_type != old_renderer_type ) { -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { -#ifdef HRTF_BINARY_FILE if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) @@ -833,157 +267,289 @@ ivas_error ivas_sba_dec_reconfigure( { return error; } -#else - /* open parametric binaural renderer */ - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } -#ifdef SBA_BR_SWITCHING } -#endif else if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) ) { ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } -#ifdef SBA_BR_SWITCHING_RECONFIG - if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) ) + + if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) +#ifdef HODIRAC + || ( last_ivas_total_brate > IVAS_256k && ivas_total_brate <= IVAS_256k ) || ( last_ivas_total_brate <= IVAS_256k && ivas_total_brate > IVAS_256k ) +#endif + ) { DIRAC_CONFIG_FLAG flag_config; flag_config = DIRAC_OPEN; if ( st_ivas->hDirAC != NULL ) { - flag_config = DIRAC_RECONFIGURE; - if ( sba_mode_old != st_ivas->sba_mode && st_ivas->sba_mode != SBA_MODE_SPAR ) - { - flag_config = DIRAC_RECONFIGURE_MODE; - } + flag_config = DIRAC_RECONFIGURE_MODE; } if ( ( error = ivas_dirac_dec_config( st_ivas, flag_config ) ) != IVAS_ERR_OK ) { return error; } +#ifdef JBM_TSM_ON_TCS + /* synchronize subframe info */ + st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); +#endif } + if ( ( error = ivas_dirac_sba_config( + st_ivas->hQMetaData, + &st_ivas->nchan_transport, + &st_ivas->nSCE, + &st_ivas->nCPE, + &st_ivas->element_mode_init, + ivas_total_brate, + st_ivas->sba_analysis_order, + st_ivas->sba_mode, +#ifdef HODIRAC + ( st_ivas->sba_analysis_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) #else -#ifdef SBA_BR_SWITCHING - if ( ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) + IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND +#endif + + ) ) != IVAS_ERR_OK ) { - if ( st_ivas->hDirAC != NULL ) - { - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) - { - return error; - } - } + return error; } -#endif -#endif -#ifdef SBA_BR_SWITCHING - else if ( st_ivas->renderer_type == RENDERER_DISABLE || ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) ) + if ( st_ivas->renderer_type == RENDERER_DISABLE ) { - if ( st_ivas->hDirAC != NULL ) - { - ivas_dirac_dec_close( st_ivas->hDirAC ); - st_ivas->hDirAC = NULL; - } + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); - if ( st_ivas->hVBAPdata != NULL ) - { - vbap_free_data( &( st_ivas->hVBAPdata ) ); - } + vbap_free_data( &( st_ivas->hVBAPdata ) ); } - - if ( st_ivas->hDirAC != NULL && st_ivas->sba_mode == SBA_MODE_SPAR ) + if ( st_ivas->hDirAC != NULL ) { mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; } -#else + /*-----------------------------------------------------------------* - * hDirAC decoder handle configuration + * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) - { - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ); - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; } - else + + /*-----------------------------------------------------------------* + * HP20 memories + *-----------------------------------------------------------------*/ + + if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ) ) != IVAS_ERR_OK ) { - int16_t sba_order_internal; + return error; + } - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - ivas_spar_config( hDecoderConfig->ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, st_ivas->sid_format ); +#ifdef FIX_417_TD_DECORR_BRATE_SW + /*-----------------------------------------------------------------* + * TD Decorrelator + *-----------------------------------------------------------------*/ - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) + if ( st_ivas->hDiracDecBin != NULL ) + { + 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, &( st_ivas->hDiracDecBin->hTdDecorr ), &( st_ivas->hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) { return error; } } +#endif + + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ - if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && ( last_ivas_total_brate > IVAS_SID_5k2 || st_ivas->nchan_transport != nchan_transport_old ) && ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) + if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) { - if ( st_ivas->hDirAC != NULL ) + return error; + } + +#ifdef JBM_TSM_ON_TCS + /*-----------------------------------------------------------------* + * TC buffer + *-----------------------------------------------------------------*/ + if ( st_ivas->hDecoderConfig->voip_active == 1 ) + { + int16_t tc_nchan_to_allocate; + int16_t tc_nchan_tc; + TC_BUFFER_MODE tc_buffer_mode; + + tc_buffer_mode = TC_BUFFER_MODE_RENDERER; + tc_nchan_tc = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + tc_nchan_to_allocate = tc_nchan_tc; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) { - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) - { - return error; - } + tc_buffer_mode = TC_BUFFER_MODE_BUFFER; + tc_nchan_tc = st_ivas->hDecoderConfig->nchan_out; + tc_nchan_to_allocate = tc_nchan_tc; + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; + } + else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + tc_nchan_to_allocate = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order +#ifdef SPAR_TUNING + , + st_ivas->hDecoderConfig->ivas_total_brate +#endif + ); } else { - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { - return error; + tc_nchan_to_allocate++; /* we need a channel for the CNG in this case*/ } } - } - else if ( st_ivas->renderer_type == RENDERER_DISABLE || ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) ) - { - if ( st_ivas->hDirAC != NULL ) - { - ivas_dirac_dec_close( st_ivas->hDirAC ); - st_ivas->hDirAC = NULL; - } - if ( st_ivas->hVBAPdata != NULL ) + if ( tc_nchan_tc != st_ivas->hTcBuffer->nchan_transport_jbm || tc_nchan_to_allocate != st_ivas->hTcBuffer->nchan_transport_internal || tc_buffer_mode != st_ivas->hTcBuffer->tc_buffer_mode ) { - vbap_free_data( &( st_ivas->hVBAPdata ) ); + if ( ( error = ivas_jbm_dec_tc_buffer_reconfigure( st_ivas, tc_buffer_mode, tc_nchan_tc, tc_nchan_to_allocate, tc_nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } } } #endif - /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SCE/CPE/MCT handles - *-----------------------------------------------------------------*/ + return error; +} - ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, sba_dirac_stereo_flag_old, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ); +#ifdef JBM_TSM_ON_TCS +ivas_error ivas_sba_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nCldfbSlots, /* i : number of CLDFB slots */ + const int16_t nSamplesForRendering /* i : number of samples provided */ +) +{ - /*-----------------------------------------------------------------* - * HP20 memories - *-----------------------------------------------------------------*/ + int16_t ch_idx; + ivas_error error; - ivas_hp20_dec_reconfig( st_ivas, nchan_hp20_old ); + error = IVAS_ERR_OK; - /*-----------------------------------------------------------------* - * CLDFB instances - *-----------------------------------------------------------------*/ + /* set the md map */ + if ( st_ivas->hDirAC && !( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode == SBA_MODE_DIRAC ) ) + { + ivas_dirac_dec_set_md_map( st_ivas, nCldfbSlots ); + } + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + ivas_spar_dec_digest_tc( st_ivas, st_ivas->nchan_transport, nCldfbSlots, nSamplesForRendering ); + } + if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) + { + int16_t nSamplesLeftForTD, default_frame; + float *decorr_signal[BINAURAL_CHANNELS]; + float *p_tc[2 * BINAURAL_CHANNELS]; + default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + nSamplesLeftForTD = nSamplesForRendering; + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + { + decorr_signal[ch_idx] = st_ivas->hTcBuffer->tc[ch_idx + BINAURAL_CHANNELS]; + p_tc[ch_idx] = st_ivas->hTcBuffer->tc[ch_idx]; + } + while ( nSamplesLeftForTD ) + { + int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); + ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr ); + for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) + { + decorr_signal[ch_idx] += nSamplesToDecorr; + p_tc[ch_idx] += nSamplesToDecorr; + } + nSamplesLeftForTD -= nSamplesToDecorr; + } + } + /* if we have a late CNG generation, do it here */ + if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) + { + Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; + generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], nCldfbSlots, st->cna_dirac_flag && st->flag_cna ); + } + return error; +} - ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ); +void ivas_sba_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *output_f[] /* o : rendered time signal */ +) +{ + int16_t slots_to_render, first_sf, last_sf, subframe_idx; + uint16_t slot_size, ch; + uint16_t nchan_internal, nchan_out; + SPAR_DEC_HANDLE hSpar; + float *output_f_local[MAX_OUTPUT_CHANNELS]; + + hSpar = st_ivas->hSpar; + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order +#ifdef SPAR_TUNING + , + st_ivas->hDecoderConfig->ivas_total_brate +#endif + ); + nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; +#ifdef DEBUGGING + assert( hSpar ); +#endif + for ( ch = 0; ch < nchan_out; ch++ ) + { + output_f_local[ch] = output_f[ch]; + } + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( hSpar->num_slots - hSpar->slots_rendered, nSamplesAsked / slot_size ); + *nSamplesRendered = slots_to_render * slot_size; + first_sf = hSpar->subframes_rendered; + last_sf = first_sf; + while ( slots_to_render > 0 ) + { + slots_to_render -= hSpar->subframe_nbslots[last_sf]; + last_sf++; + } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + int16_t n_samples_sf = slot_size * hSpar->subframe_nbslots[subframe_idx]; + ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); + for ( ch = 0; ch < nchan_out; ch++ ) + { + output_f_local[ch] += n_samples_sf; + } + } + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) + { + ivas_sba_linear_renderer( output_f, *nSamplesRendered, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); + } + if ( st_ivas->hDirAC != NULL && hSpar->slots_rendered == hSpar->num_slots ) + { + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) + { + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + } + else + { + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + } + } + *nSamplesAvailable = ( hSpar->num_slots - hSpar->slots_rendered ) * slot_size; - return error; + return; } +#endif diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index fc1c445d1e4f47545c6675e3761510f8fcd6008a..089492048021527ec3d025ab1d6d3b96e25383df 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -45,6 +45,44 @@ #include "wmc_auto.h" +/*-------------------------------------------------------------------* + * ivas_get_sba_dirac_stereo_flag() + * + * Set sba_dirac_stereo_flag + *-------------------------------------------------------------------*/ + +int16_t ivas_get_sba_dirac_stereo_flag( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + int16_t sba_dirac_stereo_flag; + AUDIO_CONFIG output_config; + + sba_dirac_stereo_flag = 0; + output_config = st_ivas->hDecoderConfig->output_config; + + if ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + { + if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + { + if ( output_config == AUDIO_CONFIG_STEREO || ( output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ) + { + sba_dirac_stereo_flag = 1; + } + } + else + { + if ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ) + { + sba_dirac_stereo_flag = 1; + } + } + } + + return sba_dirac_stereo_flag; +} + + /*-------------------------------------------------------------------* * ivas_sba_dirac_stereo_config() * @@ -90,7 +128,8 @@ void ivas_sba_dirac_stereo_config( static int16_t ivas_sba_dirac_stereo_band_config( int16_t *band_limits, /* o : DFT band limits */ const int32_t output_Fs, /* i : output sampling rate */ - const int16_t NFFT /* i : analysis/synthesis window length */ + const int16_t NFFT, /* i : analysis/synthesis window length */ + const int16_t spar_flag /* i : SPAR or DirAC band grouping */ ) { int16_t i; @@ -98,6 +137,16 @@ static int16_t ivas_sba_dirac_stereo_band_config( int16_t nbands, num_cldfb_bands; nbands = SBA_DIRAC_STEREO_NUM_BANDS; + + if ( spar_flag ) + { + nbands = IVAS_MAX_NUM_BANDS; + } + else + { + nbands = 5; + } + num_cldfb_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); bins_per_cldfb_band = NFFT / ( 2 * num_cldfb_bands ); @@ -105,7 +154,19 @@ static int16_t ivas_sba_dirac_stereo_band_config( band_limits[0] = 1; for ( i = 1; i < nbands; i++ ) { - band_limits[i] = DirAC_band_grouping_5[i] * bins_per_cldfb_band; + if ( spar_flag ) + { + band_limits[i] = DirAC_band_grouping_12[i] * bins_per_cldfb_band; + } + else + { + band_limits[i] = DirAC_band_grouping_5[i] * bins_per_cldfb_band; + } + if ( band_limits[i] >= NFFT / 2 ) + { + nbands = i; + break; + } } band_limits[nbands] = NFFT / 2; @@ -158,33 +219,35 @@ static void map_params_dirac_to_stereo( float synth[], /* i : decoded downmix signal */ float DFT[STEREO_DFT_BUF_MAX], /* i/o: DFT buffer */ const uint8_t b_wide_panning, /* i : flag indicating wider panning */ - const int16_t L_frame /* i : core signal length */ - + const int16_t L_frame, /* i : core signal length */ + const int16_t mcmasa /* i : McMASA flag */ ) { - int16_t i, b, k, block; + int16_t i, b, k; int16_t k_offset; - int16_t nbands, nBlocks, block_len; + int16_t nbands, nBlocks; + int16_t block; + int16_t block_len; int16_t azimuth[MAX_PARAM_SPATIAL_SUBFRAMES][SBA_DIRAC_STEREO_NUM_BANDS]; int16_t elevation[MAX_PARAM_SPATIAL_SUBFRAMES][SBA_DIRAC_STEREO_NUM_BANDS]; float diffuseness[SBA_DIRAC_STEREO_NUM_BANDS]; + float block_nrg[MAX_PARAM_SPATIAL_SUBFRAMES]; + float nrg_norm1, nrg_norm2; + float *pSynth; float surrCoh[SBA_DIRAC_STEREO_NUM_BANDS]; + float *pDFT; float subframe_band_nrg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; float smooth_long_avg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; float smooth_short_avg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; - float block_nrg[MAX_PARAM_SPATIAL_SUBFRAMES]; - float nrg_norm1, nrg_norm2; + float *side_gain, *res_pred_gain; - float *pSynth, *pDFT; IVAS_QDIRECTION *q_direction; - nBlocks = MAX_PARAM_SPATIAL_SUBFRAMES; - nbands = SBA_DIRAC_STEREO_NUM_BANDS; + nbands = hStereoDft->nbands; k_offset = STEREO_DFT_OFFSET; side_gain = hStereoDft->side_gain + k_offset * STEREO_DFT_BAND_MAX; res_pred_gain = hStereoDft->res_pred_gain + k_offset * STEREO_DFT_BAND_MAX; - q_direction = &( hQMetaData->q_direction[0] ); /* gain smoothing factor */ @@ -233,99 +296,102 @@ static void map_params_dirac_to_stereo( } /* apply upper bounds depending on band */ - hStereoDft->smooth_fac[0][b] = min( max_smooth_gains[b], hStereoDft->smooth_fac[0][b] ); - hStereoDft->smooth_fac[1][b] = min( max_smooth_gains[b], hStereoDft->smooth_fac[1][b] ); + hStereoDft->smooth_fac[0][b] = max( hStereoDft->min_smooth_gains[b], min( hStereoDft->max_smooth_gains[b], hStereoDft->smooth_fac[0][b] ) ); + hStereoDft->smooth_fac[1][b] = max( hStereoDft->min_smooth_gains[b], min( hStereoDft->max_smooth_gains[b], hStereoDft->smooth_fac[1][b] ) ); } pDFT += STEREO_DFT32MS_N_MAX; } - /* calculate block energies for side gain weighting (combine angles of 2 DirAC blocks to side gain for 1 DFT Stereo subframe; 4 blocks and 2 subframes overall) */ - pSynth = synth; - block_len = L_frame / nBlocks; - for ( block = 0; block < nBlocks; block++ ) - { - block_nrg[block] = 0.f; - for ( i = 0; i < block_len; i++ ) - { - block_nrg[block] += pSynth[i] * pSynth[i]; - } - block_nrg[block] = sqrtf( block_nrg[block] ); - pSynth += block_len; - } - nrg_norm1 = 1 / ( block_nrg[0] + block_nrg[1] + EPSILON ); - nrg_norm2 = 1 / ( block_nrg[2] + block_nrg[3] + EPSILON ); - - /* extract DirAC parameters from metadata */ - for ( b = 0; b < nbands; b++ ) + if ( mcmasa ) { - diffuseness[b] = 1.0f - q_direction->band_data[b].energy_ratio[0]; - if ( hQMetaData->surcoh_band_data != NULL ) - { - surrCoh[b] = hQMetaData->surcoh_band_data[b].surround_coherence[0] / 255.0f; - } - else - { - surrCoh[b] = 0.0f; - } - + /* calculate block energies for side gain weighting (combine angles of 2 DirAC blocks to side gain for 1 DFT Stereo subframe; 4 blocks and 2 subframes overall) */ + pSynth = synth; + block_len = L_frame / nBlocks; for ( block = 0; block < nBlocks; block++ ) { - int16_t block_metadata; - - if ( hQMetaData->useLowerRes ) - { - block_metadata = 0; - } - else - { - block_metadata = block; - } - if ( q_direction->band_data[b].azimuth[block_metadata] < 0.f ) + block_nrg[block] = 0.f; + for ( i = 0; i < block_len; i++ ) { - q_direction->band_data[b].azimuth[block_metadata] += 360.f; + block_nrg[block] += pSynth[i] * pSynth[i]; } - azimuth[block][b] = (int16_t) q_direction->band_data[b].azimuth[block_metadata]; - elevation[block][b] = (int16_t) q_direction->band_data[b].elevation[block_metadata]; + block_nrg[block] = sqrtf( block_nrg[block] ); + pSynth += block_len; } - } + nrg_norm1 = 1 / ( block_nrg[0] + block_nrg[1] + EPSILON ); + nrg_norm2 = 1 / ( block_nrg[2] + block_nrg[3] + EPSILON ); - /* map angles (azi, ele), surround coherence, and diffuseness to DFT Stereo side and prediction gains */ - for ( b = 0; b < hStereoDft->nbands; b++ ) - { - /* combine angles of first 2 blocks to side gain of first subframe */ - side_gain[b] = 0.f; - for ( block = 0; block < nBlocks / 2; block++ ) + /* extract DirAC parameters from metadata */ + for ( b = 0; b < nbands; b++ ) { - if ( b_wide_panning == 1 ) + diffuseness[b] = 1.0f - q_direction->band_data[b].energy_ratio[0]; + if ( hQMetaData->surcoh_band_data != NULL ) { - /* panning between left and ride, saturate at the stereo ls positions (+/- 30deg azi) */ - side_gain[b] += nrg_norm1 * block_nrg[block] * get_panning( azimuth[block][b], elevation[block][b] ); + surrCoh[b] = hQMetaData->surcoh_band_data[b].surround_coherence[0] / 255.0f; } else { - side_gain[b] += nrg_norm1 * block_nrg[block] * sinf( azimuth[block][b] * EVS_PI / 180 ) * cosf( elevation[block][b] * EVS_PI / 180 ); + surrCoh[b] = 0.0f; + } + + for ( block = 0; block < nBlocks; block++ ) + { + int16_t block_metadata; + + if ( hQMetaData->useLowerRes ) + { + block_metadata = 0; + } + else + { + block_metadata = block; + } + if ( q_direction->band_data[b].azimuth[block_metadata] < 0.f ) + { + q_direction->band_data[b].azimuth[block_metadata] += 360.f; + } + azimuth[block][b] = (int16_t) q_direction->band_data[b].azimuth[block_metadata]; + elevation[block][b] = (int16_t) q_direction->band_data[b].elevation[block_metadata]; } } - /* combine angles of last 2 blocks to side gain of second subframe */ - side_gain[b + STEREO_DFT_BAND_MAX] = 0.f; - for ( block = nBlocks / 2; block < nBlocks; block++ ) + /* map angles (azi, ele), surround coherence, and diffuseness to DFT Stereo side and prediction gains */ + for ( b = 0; b < hStereoDft->nbands; b++ ) { - if ( b_wide_panning == 1 ) + /* combine angles of first 2 blocks to side gain of first subframe */ + side_gain[b] = 0.f; + for ( block = 0; block < nBlocks / 2; block++ ) { - /* panning between left and ride, saturate at the stereo ls positions (+/- 30deg azi) */ - side_gain[b + STEREO_DFT_BAND_MAX] += nrg_norm2 * block_nrg[block] * get_panning( azimuth[block][b], elevation[block][b] ); + if ( b_wide_panning == 1 ) + { + /* panning between left and ride, saturate at the stereo ls positions (+/- 30deg azi) */ + side_gain[b] += nrg_norm1 * block_nrg[block] * get_panning( azimuth[block][b], elevation[block][b] ); + } + else + { + side_gain[b] += nrg_norm1 * block_nrg[block] * sinf( azimuth[block][b] * EVS_PI / 180 ) * cosf( elevation[block][b] * EVS_PI / 180 ); + } } - else + + /* combine angles of last 2 blocks to side gain of second subframe */ + side_gain[b + STEREO_DFT_BAND_MAX] = 0.f; + for ( block = nBlocks / 2; block < nBlocks; block++ ) { - side_gain[b + STEREO_DFT_BAND_MAX] += nrg_norm2 * block_nrg[block] * sinf( azimuth[block][b] * EVS_PI / 180 ) * cosf( elevation[block][b] * EVS_PI / 180 ); + if ( b_wide_panning == 1 ) + { + /* panning between left and ride, saturate at the stereo ls positions (+/- 30deg azi) */ + side_gain[b + STEREO_DFT_BAND_MAX] += nrg_norm2 * block_nrg[block] * get_panning( azimuth[block][b], elevation[block][b] ); + } + else + { + side_gain[b + STEREO_DFT_BAND_MAX] += nrg_norm2 * block_nrg[block] * sinf( azimuth[block][b] * EVS_PI / 180 ) * cosf( elevation[block][b] * EVS_PI / 180 ); + } } - } - side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); - side_gain[b + STEREO_DFT_BAND_MAX] *= sqrtf( 1.f - diffuseness[b] ); - res_pred_gain[b] = diffuseness[b] * ( 1.0f - surrCoh[b] ); - res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); + side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); + side_gain[b + STEREO_DFT_BAND_MAX] *= sqrtf( 1.f - diffuseness[b] ); + res_pred_gain[b] = diffuseness[b] * ( 1.0f - surrCoh[b] ); + res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); + } } hStereoDft->frame_nodata = 0; @@ -420,26 +486,109 @@ static void ivas_sba_dirac_stereo_compute_hb_gain( *-------------------------------------------------------------------*/ static void ivas_sba_dirac_stereo_upmix_hb( - float hb_stereo_synth[CPE_CHANNELS][L_FRAME48k], /* i/o: stereo HB synthesis signal */ - float hb_synth[L_FRAME48k], /* i : HB signal */ - float hb_gain[NB_DIV], /* i : side gains for HB signal */ - const int16_t output_frame /* i : output frame length per channel */ + float hb_stereo_synth[CPE_CHANNELS][L_FRAME48k], /* i/o: stereo HB synthesis signal */ + float hb_synth[L_FRAME48k], /* i : HB signal */ + float hb_gain[NB_DIV], /* i : side gains for HB signal */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t mcmasa, /* i : McMASA flag */ + const int16_t sba_mono_flag, /* i : flag for mono output */ + const int16_t bwidth, /* i : bandwidth of signal */ + const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ ) { int16_t i; + float gp, gm; + float gain_fac; - for ( i = 0; i < output_frame / 2; i++ ) + if ( !mcmasa ) { - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] + 0.5f * hb_gain[0] * hb_synth[i]; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] - 0.5f * hb_gain[0] * hb_synth[i]; - } + gain_fac = ( bwidth == FB ) ? 0.25f : 0.33f; /* last matrix element not used for SWB, divide by 3 instead of 4*/ + if ( sba_mono_flag ) + { + gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[0][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10]; + if ( bwidth == FB ) + { + gp += hStereoDft->mixer_mat_smooth[0][0][11]; + } + for ( i = 0; i < output_frame / 2; i++ ) + { + hb_stereo_synth[0][i] = hb_synth[i] * gain_fac * gp; + } + gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS]; + if ( bwidth == FB ) + { + gp += hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS]; + } + for ( i = output_frame / 2; i < output_frame; i++ ) + { + hb_stereo_synth[0][i] = hb_synth[i] * gain_fac * gp; + } + } + else + { + gp = hStereoDft->mixer_mat_smooth[0][0][8] + hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] + hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] + hStereoDft->mixer_mat_smooth[1][0][10]; + if ( bwidth == FB ) + { + gp += hStereoDft->mixer_mat_smooth[0][0][11] + hStereoDft->mixer_mat_smooth[1][0][11]; + } + + gm = hStereoDft->mixer_mat_smooth[0][0][8] - hStereoDft->mixer_mat_smooth[1][0][8] + + hStereoDft->mixer_mat_smooth[0][0][9] - hStereoDft->mixer_mat_smooth[1][0][9] + + hStereoDft->mixer_mat_smooth[0][0][10] - hStereoDft->mixer_mat_smooth[1][0][10]; + if ( bwidth == FB ) + { + gm += hStereoDft->mixer_mat_smooth[0][0][11] - hStereoDft->mixer_mat_smooth[1][0][11]; + } + + for ( i = 0; i < output_frame / 2; i++ ) + { + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * gain_fac * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * gain_fac * gm; + } + + gp = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS]; + if ( bwidth == FB ) + { + gp += hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + } + + gm = hStereoDft->mixer_mat_smooth[0][0][8 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][8 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][9 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][9 + IVAS_MAX_NUM_BANDS] + + hStereoDft->mixer_mat_smooth[0][0][10 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][10 + IVAS_MAX_NUM_BANDS]; + if ( bwidth == FB ) + { + gm += hStereoDft->mixer_mat_smooth[0][0][11 + IVAS_MAX_NUM_BANDS] - hStereoDft->mixer_mat_smooth[1][0][11 + IVAS_MAX_NUM_BANDS]; + } - for ( i = output_frame / 2; i < output_frame; i++ ) + for ( i = output_frame / 2; i < output_frame; i++ ) + { + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] * gain_fac * gp; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] * gain_fac * gm; + } + } + } + else { - hb_stereo_synth[0][i] = 0.5f * hb_synth[i] + 0.5f * hb_gain[1] * hb_synth[i]; - hb_stereo_synth[1][i] = 0.5f * hb_synth[i] - 0.5f * hb_gain[1] * hb_synth[i]; + for ( i = 0; i < output_frame / 2; i++ ) + { + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] + 0.5f * hb_gain[0] * hb_synth[i]; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] - 0.5f * hb_gain[0] * hb_synth[i]; + } + + for ( i = output_frame / 2; i < output_frame; i++ ) + { + hb_stereo_synth[0][i] = 0.5f * hb_synth[i] + 0.5f * hb_gain[1] * hb_synth[i]; + hb_stereo_synth[1][i] = 0.5f * hb_synth[i] - 0.5f * hb_gain[1] * hb_synth[i]; + } } + return; } @@ -451,9 +600,10 @@ static void ivas_sba_dirac_stereo_upmix_hb( *-------------------------------------------------------------------*/ static void ivas_sba_dirac_stereo_apply_td_stefi( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ - const int16_t output_frame /* i : output frame length per channel */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t spar_flag /* i : SPAR flag */ ) { int16_t i; @@ -462,7 +612,51 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( float tmp; const float *win_dft; - if ( max( hStereoDft->td_gain[0], hStereoDft->td_gain[1] ) > 0 ) + if ( spar_flag ) + { + win_dft = hStereoDft->win32ms; + dftOvlLen = hStereoDft->dft32ms_ovl; + + float g_W_1, g_Y_1; + float g_W_2, g_Y_2; + float g_L, g_R; + float stefi_L, stefi_R; + + g_W_1 = ( hStereoDft->mixer_mat_smooth[0][1][8] + hStereoDft->mixer_mat_smooth[0][2][8] + hStereoDft->mixer_mat_smooth[0][3][8] ) + ( hStereoDft->mixer_mat_smooth[0][1][9] + hStereoDft->mixer_mat_smooth[0][2][9] + hStereoDft->mixer_mat_smooth[0][3][9] ) + ( hStereoDft->mixer_mat_smooth[0][1][10] + hStereoDft->mixer_mat_smooth[0][2][10] + hStereoDft->mixer_mat_smooth[0][3][10] ); + + g_Y_1 = ( hStereoDft->mixer_mat_smooth[1][1][8] + hStereoDft->mixer_mat_smooth[1][2][8] + hStereoDft->mixer_mat_smooth[1][3][8] ) + ( hStereoDft->mixer_mat_smooth[1][1][9] + hStereoDft->mixer_mat_smooth[1][2][9] + hStereoDft->mixer_mat_smooth[1][3][9] ) + ( hStereoDft->mixer_mat_smooth[1][1][10] + hStereoDft->mixer_mat_smooth[1][2][10] + hStereoDft->mixer_mat_smooth[1][3][10] ); + + g_W_2 = ( hStereoDft->mixer_mat_smooth[0][1][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][8 + IVAS_MAX_NUM_BANDS] ) + ( hStereoDft->mixer_mat_smooth[0][1][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][9 + IVAS_MAX_NUM_BANDS] ) + ( hStereoDft->mixer_mat_smooth[0][1][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][10 + IVAS_MAX_NUM_BANDS] ); + + g_Y_2 = ( hStereoDft->mixer_mat_smooth[1][1][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][8 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][8 + IVAS_MAX_NUM_BANDS] ) + ( hStereoDft->mixer_mat_smooth[1][1][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][9 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][9 + IVAS_MAX_NUM_BANDS] ) + ( hStereoDft->mixer_mat_smooth[1][1][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][10 + IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][10 + IVAS_MAX_NUM_BANDS] ); + + g_L = 0.16f * ( g_W_1 + g_W_2 - g_Y_1 - g_Y_2 ); + g_R = 0.16f * ( g_W_1 + g_W_2 + g_Y_1 + g_Y_2 ); + + for ( i = 0; i < dftOvlLen; i++ ) + { + win_in = win_dft[STEREO_DFT32MS_STEP * i] * win_dft[STEREO_DFT32MS_STEP * i]; + win_out = 1 - win_in; + + stefi_L = ( win_out * hStereoDft->g_L_prev + win_in * g_L ) * 0.5f * hStereoDft->hb_stefi_sig[i]; + stefi_R = ( win_out * hStereoDft->g_R_prev + win_in * g_R ) * 0.5f * hStereoDft->hb_stefi_sig[i]; + + output[0][i] += stefi_L; + output[1][i] += stefi_R; + } + for ( i = dftOvlLen; i < output_frame; i++ ) + { + + stefi_L = g_L * 0.5f * hStereoDft->hb_stefi_sig[i]; + stefi_R = g_R * 0.5f * hStereoDft->hb_stefi_sig[i]; + + output[0][i] += stefi_L; + output[1][i] += stefi_R; + } + hStereoDft->g_L_prev = g_L; + hStereoDft->g_R_prev = g_R; + } + else if ( max( hStereoDft->td_gain[0], hStereoDft->td_gain[1] ) > 0 ) { win_dft = hStereoDft->win32ms; dftOvlLen = hStereoDft->dft32ms_ovl; @@ -495,35 +689,111 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( *-------------------------------------------------------------------*/ void ivas_sba_dirac_stereo_smooth_parameters( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ + const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ + const int32_t output_Fs /* i : Fs for delay calculation */ ) { - int16_t k_offset, b; + int16_t i, j, k, i_sf; + int16_t b; + int16_t k_offset; float *side_gain, *prev_side_gain; float *res_pred_gain, *prev_res_pred_gain; k_offset = STEREO_DFT_OFFSET; - prev_side_gain = hStereoDft->side_gain; side_gain = hStereoDft->side_gain + k_offset * STEREO_DFT_BAND_MAX; prev_res_pred_gain = hStereoDft->res_pred_gain; res_pred_gain = hStereoDft->res_pred_gain + k_offset * STEREO_DFT_BAND_MAX; - /* Smoothing of side and prediction gains between ftrames */ - for ( b = hStereoDft->res_pred_band_min; b < hStereoDft->nbands; b++ ) + if ( !hMdDec ) { - if ( hStereoDft->attackPresent ) + /* Smoothing of side and prediction gains between ftrames */ + for ( b = hStereoDft->res_pred_band_min; b < hStereoDft->nbands; b++ ) { - res_pred_gain[b] *= 0.8f; - res_pred_gain[b + STEREO_DFT_BAND_MAX] *= 0.8f; + if ( hStereoDft->attackPresent ) + { + res_pred_gain[b] *= 0.8f; + res_pred_gain[b + STEREO_DFT_BAND_MAX] *= 0.8f; + } + else + { + side_gain[b] = hStereoDft->smooth_fac[0][b] * prev_side_gain[b] + ( 1.f - hStereoDft->smooth_fac[0][b] ) * side_gain[b]; + side_gain[b + STEREO_DFT_BAND_MAX] = hStereoDft->smooth_fac[1][b] * side_gain[b] + ( 1.f - hStereoDft->smooth_fac[1][b] ) * side_gain[b + STEREO_DFT_BAND_MAX]; + res_pred_gain[b] = hStereoDft->smooth_fac[0][b] * prev_res_pred_gain[b] + ( 1.f - hStereoDft->smooth_fac[0][b] ) * res_pred_gain[b]; + res_pred_gain[b + STEREO_DFT_BAND_MAX] = hStereoDft->smooth_fac[1][b] * res_pred_gain[b] + ( 1.f - hStereoDft->smooth_fac[1][b] ) * res_pred_gain[b + STEREO_DFT_BAND_MAX]; + } } - else + } + + if ( hMdDec != 0 ) + { + float xfade_start_ns; + int16_t xfade_delay_subframes; + int16_t i_hist; + + xfade_start_ns = cross_fade_start_offset / (float) output_Fs * 1000000000.f - IVAS_FB_ENC_DELAY_NS; + xfade_delay_subframes = (int16_t) ( xfade_start_ns / ( FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + + i_hist = 4 - xfade_delay_subframes; + + for ( k = 0; k < 2; k++ ) { - side_gain[b] = hStereoDft->smooth_fac[0][b] * prev_side_gain[b] + ( 1.f - hStereoDft->smooth_fac[0][b] ) * side_gain[b]; - side_gain[b + STEREO_DFT_BAND_MAX] = hStereoDft->smooth_fac[1][b] * side_gain[b] + ( 1.f - hStereoDft->smooth_fac[1][b] ) * side_gain[b + STEREO_DFT_BAND_MAX]; - res_pred_gain[b] = hStereoDft->smooth_fac[0][b] * prev_res_pred_gain[b] + ( 1.f - hStereoDft->smooth_fac[0][b] ) * res_pred_gain[b]; - res_pred_gain[b + STEREO_DFT_BAND_MAX] = hStereoDft->smooth_fac[1][b] * res_pred_gain[b] + ( 1.f - hStereoDft->smooth_fac[1][b] ) * res_pred_gain[b + STEREO_DFT_BAND_MAX]; + for ( i_sf = k * 2; i_sf < ( k + 1 ) * 2; i_sf++ ) + { + if ( hStereoDft->first_frame ) + { + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] = hMdDec->mixer_mat[i][j][b]; + } + for ( ; b < IVAS_MAX_NUM_BANDS; b++ ) + { + hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] = 0.f; + } + } + } + } + else + { + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + float beta = hStereoDft->smooth_fac[k][b]; + hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] = + beta * hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] + ( 1 - beta ) * hMdDec->mixer_mat_prev[i_hist][i][j][b]; + } + } + } + } + + mvr2r( hMdDec->mixer_mat_prev[1][0][0], hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hMdDec->mixer_mat_prev[2][0][0], hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hMdDec->mixer_mat_prev[3][0][0], hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hMdDec->mixer_mat_prev[4][0][0], hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + hMdDec->mixer_mat_prev[4][i][j][b] = hMdDec->mixer_mat[i][j][b + i_sf * IVAS_MAX_NUM_BANDS]; + } + } + } + } } + + hStereoDft->first_frame = 0; } return; @@ -539,10 +809,12 @@ void ivas_sba_dirac_stereo_smooth_parameters( void ivas_sba_dirac_stereo_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ - const int16_t output_frame /* i : output frame length per channel */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t mcmasa /* i : McMASA flag */ ) { int16_t dtx_flag, fd_cng_flag; + int16_t sba_mono_flag; int16_t memOffset; float tmp_buf[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; float tmp_synth[L_FRAME16k]; @@ -556,59 +828,104 @@ void ivas_sba_dirac_stereo_dec( hSCE = st_ivas->hSCE[0]; hCPE = st_ivas->hCPE[0]; hStereoDft = hCPE->hStereoDft; - dtx_flag = ( hSCE->hCoreCoder[0]->core_brate <= SID_2k40 ); - fd_cng_flag = ( dtx_flag && hSCE->hCoreCoder[0]->cng_type == FD_CNG ); + + if ( st_ivas->nchan_transport > 1 && !mcmasa ) + { + dtx_flag = 0; + fd_cng_flag = 0; + } + else + { + dtx_flag = ( hSCE->hCoreCoder[0]->core_brate <= SID_2k40 ); + fd_cng_flag = ( dtx_flag && hSCE->hCoreCoder[0]->cng_type == FD_CNG ); + } + sba_mono_flag = ( st_ivas->hDecoderConfig->nchan_out == 1 ) ? 1 : 0; + memOffset = NS2SA( output_frame * FRAMES_PER_SEC, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); ivas_sba_dirac_stereo_config( hStereoDft->hConfig ); - hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, hStereoDft->NFFT ); + hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, hStereoDft->NFFT, ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); stereo_dft_dec_update( hStereoDft, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); + if ( st_ivas->nchan_transport > 1 ) + { + stereo_dft_dec_analyze( hCPE, output[0], DFT, 0, output_frame, output_frame, DFT_STEREO_DEC_ANA_FB, 0, 0 ); + stereo_dft_dec_analyze( hCPE, output[1], DFT, 1, output_frame, output_frame, DFT_STEREO_DEC_ANA_FB, 0, 0 ); + hStereoDft->core_hist[0] = hCPE->hCoreCoder[0]->core; + } + else + { + /* nrg calculation for TD Stereo Filling, as done in ICBWE which is not used in this case */ + ivas_sba_dirac_stereo_compute_td_stefi_nrgs( hStereoDft, hSCE->save_hb_synth, hSCE->hCoreCoder[0]->core, output_frame, fd_cng_flag ); - /* nrg calculation for TD Stereo Filling, as done in ICBWE which is not used in this case */ - ivas_sba_dirac_stereo_compute_td_stefi_nrgs( hStereoDft, hSCE->save_hb_synth, hSCE->hCoreCoder[0]->core, output_frame, fd_cng_flag ); - - /* do DFT Stereo core switching (including DFT analysis) here as CPE element was not available in SCE decoder */ - mvr2r( hSCE->save_synth, tmp_synth, hSCE->hCoreCoder[0]->L_frame ); - stereo_dft_dec_core_switching( hCPE, output[0] /*hSCE->save_output*/, hSCE->save_synth, hSCE->save_hb_synth, DFT, output_frame, 0, dtx_flag ); + /* do DFT Stereo core switching (including DFT analysis) here as CPE element was not available in SCE decoder */ + mvr2r( hSCE->save_synth, tmp_synth, hSCE->hCoreCoder[0]->L_frame ); + stereo_dft_dec_core_switching( hCPE, output[0] /*hSCE->save_output*/, hSCE->save_synth, hSCE->save_hb_synth, DFT, output_frame, 0, dtx_flag ); - /* do updates here after skipping this in SCE decoder (needs to be done after core switching) */ - updt_dec_common( hSCE->hCoreCoder[0], NORMAL_HQ_CORE, -1, hSCE->save_synth ); + /* do updates here after skipping this in SCE decoder (needs to be done after core switching) */ + updt_dec_common( hSCE->hCoreCoder[0], NORMAL_HQ_CORE, -1, hSCE->save_synth ); + } /* mapping of DirAC parameters (azimuth, elevation, diffuseness) to DFT Stereo parameters (side gain, prediction gain) */ - map_params_dirac_to_stereo( hStereoDft, st_ivas->hQMetaData, tmp_synth, DFT[0], st_ivas->ivas_format == MC_FORMAT, hSCE->hCoreCoder[0]->L_frame ); + map_params_dirac_to_stereo( hStereoDft, st_ivas->hQMetaData, tmp_synth, DFT[0], + st_ivas->ivas_format == MC_FORMAT, + ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) ? hSCE->hCoreCoder[0]->L_frame : output_frame, + ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) ); + + if ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) + { + set_f( hStereoDft->res_pred_gain, 1.f, 3 * STEREO_DFT_BAND_MAX ); + } /* DFT Stereo upmix */ - stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); + stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, + ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, + ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, + st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); - stereo_dft_dec_synthesize( hCPE, DFT, 1, output[1], output_frame ); + if ( !sba_mono_flag ) + { + stereo_dft_dec_synthesize( hCPE, DFT, 1, output[1], output_frame ); + } synchro_synthesis( st_ivas->hDecoderConfig->ivas_total_brate, hCPE, output, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); /* output scaling */ - v_multc( output[0], 0.5f, output[0], output_frame ); - v_multc( output[1], 0.5f, output[1], output_frame ); + if ( !sba_mono_flag ) + { + v_multc( output[0], 0.5f, output[0], output_frame ); + v_multc( output[1], 0.5f, output[1], output_frame ); + } /* delay HB synth */ - mvr2r( hSCE->save_hb_synth + output_frame - memOffset, tmp_buf, memOffset ); - mvr2r( hSCE->save_hb_synth, hSCE->save_hb_synth + memOffset, output_frame - memOffset ); - mvr2r( hSCE->prev_hb_synth, hSCE->save_hb_synth, memOffset ); - mvr2r( tmp_buf, hSCE->prev_hb_synth, memOffset ); + if ( st_ivas->nchan_transport == 1 ) + { + mvr2r( hSCE->save_hb_synth + output_frame - memOffset, tmp_buf, memOffset ); + mvr2r( hSCE->save_hb_synth, hSCE->save_hb_synth + memOffset, output_frame - memOffset ); + mvr2r( hSCE->prev_hb_synth, hSCE->save_hb_synth, memOffset ); + mvr2r( tmp_buf, hSCE->prev_hb_synth, memOffset ); + } - if ( ( hCPE->hCoreCoder[0]->core == ACELP_CORE || hCPE->hCoreCoder[0]->last_core == ACELP_CORE ) && !fd_cng_flag ) + if ( ( hCPE->hCoreCoder[0]->core == ACELP_CORE || hCPE->hCoreCoder[0]->last_core == ACELP_CORE ) && !fd_cng_flag && st_ivas->nchan_transport == 1 ) { /* upmix ACELP BWE */ ivas_sba_dirac_stereo_compute_hb_gain( hStereoDft, hb_gain ); - ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame ); + + ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, + ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), sba_mono_flag, hSCE->hCoreCoder[0]->bwidth, hStereoDft ); + /* add HB to ACELP core */ v_add( output[0], hb_synth_stereo[0], output[0], output_frame ); - v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); + if ( !sba_mono_flag ) + { + v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); - /* apply TD Stereo Filling as is done in ICBWE */ - ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame ); + /* apply TD Stereo Filling as is done in ICBWE */ + ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); + } } return; diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c new file mode 100644 index 0000000000000000000000000000000000000000..426348c7fece6d4f02430ac5a330ca6b41b925b5 --- /dev/null +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -0,0 +1,743 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include "prot.h" +#include "ivas_prot.h" +#include "ivas_prot_rend.h" +#include "ivas_stat_dec.h" +#include "ivas_cnst.h" +#include +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" + + +#ifdef DEBUG_MODE_DIRAC +/*-----------------------------------------------------------------------* + * Local function prototypes + *-----------------------------------------------------------------------*/ + +static void debug_mode_dirac( float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], const int16_t nchan_transport, const int16_t output_frame ); +#endif + + +/*-------------------------------------------------------------------------* + * ivas_sba2MC_cldfb() + * + * SBA signals transformed into MC in CLDFB domain + *-------------------------------------------------------------------------*/ + +void ivas_sba2mc_cldfb( + IVAS_OUTPUT_SETUP hInSetup, /* i : Format of input layout */ + float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb real part */ + float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part */ + const int16_t nb_channels_out, /* i : nb of output channels */ + const int16_t nb_bands, /* i : nb of CLDFB bands to process */ +#ifdef JBM_TSM_ON_TCS + const int16_t nb_timeslots, /* i : number of time slots to process */ +#endif + const float *hoa_dec_mtx /* i : HOA decoding mtx */ +) +{ + int16_t iBlock, iBand, n, m; + float realOut[16][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX], imagOut[16][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; + float g; + float *p_real, *p_imag, *p_realOut, *p_imagOut; + int16_t nb_channels_in; + + push_wmops( "ivas_sba2mc_cldfb" ); + + nb_channels_in = hInSetup.nchan_out_woLFE; + assert( ( nb_channels_in == 16 ) && ( nb_channels_out == 11 ) && "ivas_sba2mc_cldfb; only HOA3 to CICP19 is for now supported!" ); + + for ( n = 0; n < nb_channels_out; n++ ) + { + set_zero( realOut[n], MAX_PARAM_SPATIAL_SUBFRAMES * nb_bands ); + set_zero( imagOut[n], MAX_PARAM_SPATIAL_SUBFRAMES * nb_bands ); + + for ( m = 0; m < nb_channels_in; m++ ) + { + g = hoa_dec_mtx[SBA_NHARM_HOA3 * n + m]; + p_realOut = realOut[n]; + p_imagOut = imagOut[n]; +#ifdef JBM_TSM_ON_TCS + for ( iBlock = 0; iBlock < nb_timeslots; iBlock++ ) +#else + for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) +#endif + { + p_real = RealBuffer[m][iBlock]; + p_imag = ImagBuffer[m][iBlock]; + for ( iBand = 0; iBand < nb_bands; iBand++ ) + { + *p_realOut = *p_realOut + g * *( p_real++ ); + *p_imagOut = *p_imagOut + g * *( p_imag++ ); + p_realOut++; + p_imagOut++; + } + } + } + } + + for ( n = 0; n < nb_channels_out; n++ ) + { + p_realOut = realOut[n]; + p_imagOut = imagOut[n]; +#ifdef JBM_TSM_ON_TCS + for ( iBlock = 0; iBlock < nb_timeslots; iBlock++ ) +#else + for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) +#endif + { + p_real = RealBuffer[n][iBlock]; + p_imag = ImagBuffer[n][iBlock]; + for ( iBand = 0; iBand < nb_bands; iBand++ ) + { + *( p_real++ ) = *p_realOut++; + *( p_imag++ ) = *p_imagOut++; + } + } + } + + pop_wmops(); + + return; +} + + +/*-------------------------------------------------------------------------* + * ivas_mc2sba() + * + * MC signals transformed into SBA in TD domain + *-------------------------------------------------------------------------*/ + +void ivas_mc2sba( + IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ +#ifdef JBM_TSM_ON_TCS + float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ + float *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ +#else + float buffer_td[][L_FRAME48k], /* i/o: MC signals (on input) and the HOA3 (on output) */ +#endif + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const float gain_lfe /* i : gain for LFE, 0 = ignore LFE */ +) +{ + int16_t i, j, k; + int16_t idx_lfe, idx_in; + float buffer_tmp[16][L_FRAME48k]; + float gains[16]; + int16_t azimuth, elevation; + int16_t sba_num_chans; + + assert( ( sba_order <= 3 ) && "Only order up to 3 is supported!" ); + + /* Init*/ + sba_num_chans = ( sba_order + 1 ) * ( sba_order + 1 ); + for ( j = 0; j < sba_num_chans; j++ ) + { + set_zero( buffer_tmp[j], output_frame ); + } + + /* HOA encoding*/ + idx_lfe = 0; + idx_in = 0; + for ( i = 0; i < hIntSetup.nchan_out_woLFE + hIntSetup.num_lfe; i++ ) + { + if ( ( hIntSetup.num_lfe > 0 ) && ( i == hIntSetup.index_lfe[idx_lfe] ) ) + { + if ( gain_lfe > 0.f ) + { + /* Add LFE to omni W with gain*/ + for ( k = 0; k < output_frame; k++ ) + { +#ifdef JBM_TSM_ON_TCS + buffer_tmp[0][k] += gain_lfe * in_buffer_td[i][k]; +#else + buffer_tmp[0][k] += gain_lfe * buffer_td[i][k]; +#endif + } + } + + if ( idx_lfe < ( hIntSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else + { + azimuth = (int16_t) ( hIntSetup.ls_azimuth[idx_in] ); + elevation = (int16_t) ( hIntSetup.ls_elevation[idx_in] ); + idx_in++; + + /* get HOA response for direction (ACN/SN3D)*/ + ivas_dirac_dec_get_response( + azimuth, + elevation, + gains, + sba_order ); + + for ( j = 0; j < sba_num_chans; j++ ) + { + for ( k = 0; k < output_frame; k++ ) + { +#ifdef JBM_TSM_ON_TCS + buffer_tmp[j][k] += gains[j] * in_buffer_td[i][k]; +#else + buffer_tmp[j][k] += gains[j] * buffer_td[i][k]; +#endif + } + } + } + } + + for ( j = 0; j < sba_num_chans; j++ ) + { + mvr2r( buffer_tmp[j], buffer_td[j], output_frame ); + } + + return; +} + + +/*-------------------------------------------------------------------* + * ivas_sba_remapTCs() + * + * Get TCs from Ambisonics signal in ACN + *-------------------------------------------------------------------*/ + +int16_t ivas_sba_remapTCs( + float sba_data[][L_FRAME48k], /* i/o: SBA signals */ + Decoder_Struct *st_ivas, /* i/o: decoder struct */ + const int16_t output_frame /* i : frame length */ +) +{ + int16_t nchan_remapped; + +#ifdef DEBUG_MODE_DIRAC + debug_mode_dirac( sba_data, st_ivas->nchan_transport, output_frame ); +#endif + + nchan_remapped = st_ivas->nchan_transport; + if ( ( st_ivas->sba_mode != SBA_MODE_SPAR && st_ivas->sba_planar && nchan_remapped >= 3 ) || + ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && nchan_remapped == 3 ) ) + { + + nchan_remapped++; + if ( st_ivas->sba_mode != SBA_MODE_SPAR ) + { + assert( ( ( st_ivas->nchan_transport == 3 ) || ( st_ivas->nchan_transport == 5 ) || ( st_ivas->nchan_transport == 7 ) ) && "Number of channels must be odd for SBA planar!" ); + } + + if ( nchan_remapped == 4 ) + { + /*For planar A-format channel 2 and 3 are identical -> Z=0*/ + mvr2r( sba_data[2], sba_data[3], output_frame ); + } + } + + if ( st_ivas->nchan_transport >= 3 ) + { + int16_t i = 0; + float temp; + + /*convert WYXZ downmix to WYZX*/ + for ( i = 0; i < output_frame; i++ ) + { + temp = sba_data[2][i]; + sba_data[2][i] = sba_data[3][i]; + sba_data[3][i] = temp; + if ( st_ivas->nchan_transport == 3 ) + { + sba_data[2][i] = 0; + } + } + } + + if ( st_ivas->sba_mode != SBA_MODE_SPAR ) + { + ivas_sba_zero_vert_comp( sba_data, st_ivas->sba_analysis_order, st_ivas->sba_planar, output_frame ); + } + + return ( nchan_remapped ); +} + + +/*-------------------------------------------------------------------------* + * ivas_ism2sba() + * + * ISM transformed into SBA in TD domain. + *-------------------------------------------------------------------------*/ + +void ivas_ism2sba( +#ifdef JBM_TSM_ON_TCS + float *buffer_td[], /* i/o: TD signal buffers */ +#else + float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ +#endif + ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ + const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ + const int16_t nchan_ism, /* i : number of objects */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ +) +{ + int16_t i, j, k; + float buffer_tmp[16][L_FRAME48k]; + float gains[16]; + float g1, g2; + int16_t azimuth, elevation; + int16_t sba_num_chans; + + assert( ( sba_order <= 3 ) && "Only order up to 3 is supported!" ); + assert( hIsmRendererData != NULL && "hIsmRendererData not allocated!" ); + + /* Init*/ + sba_num_chans = ( sba_order + 1 ) * ( sba_order + 1 ); + for ( j = 0; j < sba_num_chans; j++ ) + { + set_zero( buffer_tmp[j], output_frame ); + } + + for ( i = 0; i < nchan_ism; i++ ) + { + // TODO tmu review when #215 is resolved + azimuth = (int16_t) floorf( hIsmMetaData[i]->azimuth + 0.5f ); + elevation = (int16_t) floorf( hIsmMetaData[i]->elevation + 0.5f ); + + /*get HOA gets for direction (ACN/SN3D)*/ + ivas_dirac_dec_get_response( azimuth, elevation, gains, sba_order ); + + for ( j = 0; j < sba_num_chans; j++ ) + { + g1 = 1.f; + g2 = 0.f; + for ( k = 0; k < output_frame; k++ ) + { + buffer_tmp[j][k] += ( g2 * gains[j] + g1 * hIsmRendererData->prev_gains[i][j] ) * buffer_td[i][k]; + g2 += 1.f / ( output_frame - 1 ); + g1 = 1.0f - g2; + } + hIsmRendererData->prev_gains[i][j] = gains[j]; + } + } + + for ( j = 0; j < sba_num_chans; j++ ) + { + mvr2r( buffer_tmp[j], buffer_td[j], output_frame ); + } + + return; +} + +#ifdef JBM_TSM_ON_TCS +/*-------------------------------------------------------------------------* + * ivas_ism2sba() + * + * ISM transformed into SBA in TD domain. + *-------------------------------------------------------------------------*/ + +void ivas_ism2sba_sf( + float *buffer_in[], /* i : TC buffer */ + float *buffer_out[], /* o : TD signal buffers */ + ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ + const int16_t num_objects, /* i : number of objects */ + const int16_t n_samples_to_render, /* i : output frame length per channel */ + const int16_t offset, /* i : offset for the interpolatr */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ +) +{ + int16_t i, j, k; + float g1, *g2, *tc, *out, gain, prev_gain; + int16_t sba_num_chans; + + assert( ( sba_order <= 3 ) && "Only order up to 3 is supported!" ); + assert( hIsmRendererData != NULL && "hIsmRendererData not allocated!" ); + + + /* Init*/ + sba_num_chans = ( sba_order + 1 ) * ( sba_order + 1 ); + for ( j = 0; j < sba_num_chans; j++ ) + { + set_zero( buffer_out[j], n_samples_to_render ); + } + + for ( i = 0; i < num_objects; i++ ) + { + for ( j = 0; j < sba_num_chans; j++ ) + { + g2 = hIsmRendererData->interpolator + offset; + g1 = 1 - *g2; + tc = buffer_in[i] + offset; + out = buffer_out[j]; + gain = hIsmRendererData->gains[i][j]; + prev_gain = hIsmRendererData->prev_gains[i][j]; + for ( k = 0; k < n_samples_to_render; k++ ) + { + *( out++ ) += ( ( *( g2++ ) ) * gain + g1 * prev_gain ) * ( *( tc++ ) ); + g1 = 1.0f - *g2; + } + } + } + + return; +} +#endif + +/*-------------------------------------------------------------------* + * ivas_sba_upmixer_renderer() + * + * SBA upmix & rendering + *-------------------------------------------------------------------*/ + +void ivas_sba_upmixer_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + float output[][L_FRAME48k], /* i/o: transport/output audio channels */ + const int16_t output_frame /* i : output frame length */ +) +{ + + int16_t nchan_internal; +#ifndef JBM_TSM_ON_TCS + int16_t i; + float temp; +#endif + + push_wmops( "ivas_sba_upmixer_renderer" ); + + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order +#ifdef SPAR_TUNING + , + st_ivas->hDecoderConfig->ivas_total_brate +#endif + ); + +#ifndef JBM_TSM_ON_TCS + if ( st_ivas->nchan_transport >= 3 ) + { + /*convert WYZX downmix to WYXZ*/ + for ( i = 0; i < output_frame; i++ ) + { + temp = output[2][i]; + output[2][i] = output[3][i]; + output[3][i] = temp; + } + } +#endif + + /* Upmixer + Renderer */ + ivas_spar_dec_upmixer( st_ivas, output, nchan_internal, output_frame ); + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) + { +#ifdef JBM_TSM_ON_TCS + float *output_f[MAX_OUTPUT_CHANNELS]; + int16_t ch; + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + output_f[ch] = output[ch]; + } + ivas_sba_linear_renderer( output_f, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); +#else + ivas_sba_linear_renderer( output, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); +#endif + } + pop_wmops(); + + return; +} + + +/*-------------------------------------------------------------------* + * ivas_sba_mtx_mult() + * + * HOA decoding with LFE insertion + *-------------------------------------------------------------------*/ + +static void ivas_sba_mtx_mult( +#ifdef JBM_TSM_ON_TCS + float *output_f[], /* i/o: synthesized core-corder transport channels/DirAC output */ +#else + float output_f[][L_FRAME48k], /* i/o: synthesized core-corder transport channels/DirAC output */ +#endif + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t nchan_in, /* i : Number of ambisonic channels */ + const IVAS_OUTPUT_SETUP output_setup, /* i : Output configuration */ + const float *mtx_hoa_decoder /* i : HOA decoding mtx */ +) +{ + int16_t i, k, ch_idx; + int16_t idx_lfe; + float input_f[16]; + const float *hoa_decoder; + + assert( ( nchan_in >= FOA_CHANNELS ) && "Number of input channels must be at least 4 (FOA)!\n" ); + + for ( i = 0; i < output_frame; i++ ) + { + /* init*/ + idx_lfe = 0; + hoa_decoder = &mtx_hoa_decoder[0]; + for ( k = 0; k < nchan_in; k++ ) + { + input_f[k] = output_f[k][i]; + } + + /* mtx mult with LFE insertion*/ + for ( ch_idx = 0; ch_idx < ( output_setup.nchan_out_woLFE + output_setup.num_lfe ); ch_idx++ ) + { + if ( ( output_setup.num_lfe > 0 ) && ( output_setup.index_lfe[idx_lfe] == ch_idx ) ) + { + /*LFE insertion*/ + output_f[ch_idx][i] = 0.f; + if ( idx_lfe < ( output_setup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else + { + /*HOA decoding*/ + output_f[ch_idx][i] = input_f[0] * hoa_decoder[0]; + for ( k = 1; k < nchan_in; k++ ) + { + output_f[ch_idx][i] += input_f[k] * hoa_decoder[k]; + } + hoa_decoder += 16; + } + } + } + + return; +} + + +/*-------------------------------------------------------------------* + * ivas_sba_linear_renderer() + * + * Linear rendering for SBA format + *-------------------------------------------------------------------*/ + +ivas_error ivas_sba_linear_renderer( +#ifdef JBM_TSM_ON_TCS + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ +#else + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ +#endif + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t nchan_in, /* i : number of input ambisonics channels */ + const AUDIO_CONFIG output_config, /* i : output audio configuration */ + const IVAS_OUTPUT_SETUP output_setup, /* i : output format setup */ + const float hoa_dec_mtx[] /* i : HOA decoding mtx */ +) +{ + int16_t i; + float dmx_l; + int16_t nchan_hoa; + ivas_error error; + + error = IVAS_ERR_OK; + + /* Number of channels of HOA depends of transport format which is mixed order xH1V*/ + nchan_hoa = nchan_in; + + if ( nchan_in == 6 ) /*2H1V*/ + { + nchan_hoa = 9; + } + else if ( nchan_in == 8 ) /*3H1V*/ + { + nchan_hoa = 16; + } + + switch ( output_config ) + { + case AUDIO_CONFIG_MONO: + /* If stereo DMX, MONO = W = Cardioids L + R*/ + if ( nchan_in == 2 ) + { + for ( i = 0; i < output_frame; i++ ) + { + output_f[0][i] += output_f[1][i]; + } + } + /* else: do nothing, MONO = W*/ + break; + case AUDIO_CONFIG_STEREO: + assert( ( nchan_in >= 2 ) && "Number of input channels must be at least 2 (for W and Y)!\n" ); + + /* Compute L and R cardioids from SB format except if stereo DMX is transmitted already in this format*/ + if ( nchan_in > 2 ) + { + /*Build L/R cardioids*/ + for ( i = 0; i < output_frame; i++ ) + { + dmx_l = 0.5f * ( output_f[0][i] + output_f[1][i] ); /* cardioid_left = 0.5(W + Y) */ + output_f[1][i] = 0.5f * ( output_f[0][i] - output_f[1][i] ); /* cardioid_right = 0.5(W - Y) */ + output_f[0][i] = dmx_l; + } + } + break; + case AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_LS_CUSTOM: + ivas_sba_mtx_mult( output_f, output_frame, nchan_hoa, output_setup, hoa_dec_mtx ); + break; + case AUDIO_CONFIG_FOA: /* Ambisonics output, order: 1 */ + case AUDIO_CONFIG_HOA2: /* Ambisonics output, order: 2 */ + case AUDIO_CONFIG_HOA3: /* Ambisonics output, order: 3 */ + for ( i = nchan_hoa; i < output_setup.nchan_out_woLFE; i++ ) + { + set_zero( output_f[i], output_frame ); + } + break; + default: + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: illegal output configuration, Exiting.\n" ); + } + + return error; +} + + +/*-------------------------------------------------------------------* + * ivas_sba_mix_matrix_determiner() + * + * Determine SBA mixing matrices + *-------------------------------------------------------------------*/ + +void ivas_sba_mix_matrix_determiner( + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ + float output[][L_FRAME48k], /* i/o: transport/output audio channels */ + const int16_t bfi, /* i : BFI flag */ + const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ + const int16_t output_frame /* i : output frame length */ +) +{ + int16_t i, ch; + float temp; + int16_t num_bands_out, nchan_transport, nchan_out; + + /* Convert numeric range */ + for ( ch = 0; ch < nchan_remapped; ch++ ) + { + for ( i = 0; i < output_frame; i++ ) + { + temp = output[ch][i]; + temp = floorf( temp + 0.5f ); + + if ( temp > MAX16B_FLT ) + { + temp = MAX16B_FLT; + } + else if ( temp < ( -1.0f * PCM16_TO_FLT_FAC ) ) + { + temp = ( -1.0f * PCM16_TO_FLT_FAC ); + } + temp *= ( 1.0f / PCM16_TO_FLT_FAC ); + output[ch][i] = temp; + } + } + + /* AGC */ + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; + nchan_out = nchan_transport; + ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); + + /* Convert numeric range back */ + for ( ch = 0; ch < nchan_out; ch++ ) + { + for ( i = 0; i < output_frame; i++ ) + { + output[ch][i] = output[ch][i] * PCM16_TO_FLT_FAC; + } + } + + /* Mixing matrix determiner */ + num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, bfi +#ifdef SPAR_TUNING + , + MAX_PARAM_SPATIAL_SUBFRAMES +#endif + ); + + return; +} + + +#ifdef DEBUG_MODE_DIRAC +/*-----------------------------------------------------------------------* + * Debugging function + *-----------------------------------------------------------------------*/ + +static void debug_mode_dirac( + float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], + const int16_t nchan_transport, + const int16_t output_frame ) +{ + int16_t i, n; + int16_t tmp[L_FRAME48k]; + char file_name[50] = { 0 }; + +#ifdef DEBUG_MODE_DIRAC_NOCORE + for ( n = 0; n < nchan_transport; n++ ) + { + sprintf( file_name, "./res/ivas_dirac_enc_%d.%d.pcm", n, (int16_t) ( output_frame * 0.05 ) ); + dbgread( tmp, sizeof( int16_t ), output_frame, file_name ); + for ( i = 0; i < output_frame; i++ ) + { + output[n][i] = (float) ( tmp[i] ); + } + } +#else + for ( n = 0; n < nchan_transport; n++ ) + { + for ( i = 0; i < output_frame; i++ ) + { + tmp[i] = (int16_t) ( output[n][i] + 0.5f ); + } + + sprintf( file_name, "./res/ivas_dirac_dec_%d.%d.pcm", n, (int16_t) ( output_frame * 0.05 ) ); + dbgwrite( tmp, sizeof( int16_t ), output_frame, 1, file_name ); + } +#endif + + return; +} +#endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c old mode 100644 new mode 100755 index 67e32389509914097b56a40f28758c6c1aa0ca1f..9a940b9b6da17e326145e2d9ba39c49e63931ff1 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -77,21 +77,37 @@ ivas_error ivas_sce_dec( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + st->cng_type = FD_CNG; + } + /*------------------------------------------------------------------* * Read audio bandwidth info *-----------------------------------------------------------------*/ /* set total_brate - needed in DTX */ - if ( !st_ivas->bfi && ( ivas_total_brate == IVAS_SID_5k2 ) ) + if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { st->total_brate = ivas_total_brate - nb_bits_metadata * FRAMES_PER_SEC; assert( st->total_brate == SID_2k40 && "SCE SID must be 2.4kbps!" ); + +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->hISMDTX.sce_id_dtx != sce_id ) + { + st->total_brate = FRAME_NO_DATA; + } +#endif } +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + else if ( !st_ivas->bfi && ivas_total_brate == FRAME_NO_DATA ) +#else else if ( !st_ivas->bfi && ivas_total_brate <= SID_2k40 ) +#endif { - st->total_brate = ivas_total_brate; + st->total_brate = FRAME_NO_DATA; } - else if ( !st_ivas->bfi && ( last_ivas_total_brate <= SID_2k40 || last_ivas_total_brate == IVAS_SID_5k2 ) ) + else if ( !st_ivas->bfi && st_ivas->ivas_format != ISM_FORMAT && last_ivas_total_brate <= IVAS_SID_5k2 ) { st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; } @@ -105,7 +121,7 @@ ivas_error ivas_sce_dec( { if ( st->low_rate_mode ) { - /* ISm Low-rate mode -> always WB */ + /* ISM Low-rate mode -> always WB */ st->bwidth = WB; } else if ( hSCE->element_brate < MIN_BRATE_SWB_SCE ) @@ -161,11 +177,22 @@ ivas_error ivas_sce_dec( } /* set "total_brate" */ - if ( !st_ivas->bfi && ( ivas_total_brate == IVAS_SID_5k2 ) ) + if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { st->total_brate = ivas_total_brate - nb_bits_metadata * FRAMES_PER_SEC; + +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->hISMDTX.sce_id_dtx != sce_id ) + { + st->total_brate = FRAME_NO_DATA; + } +#endif } +#ifdef FIX_ISM_DTX_CNG_BWIDTH_ALT + else if ( !st_ivas->bfi && ivas_total_brate == FRAME_NO_DATA ) +#else else if ( !st_ivas->bfi && ivas_total_brate <= SID_2k40 ) +#endif { st->total_brate = ivas_total_brate; } @@ -188,7 +215,6 @@ ivas_error ivas_sce_dec( st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); } - /*TODO : check if is_SIDrate() can be used here*/ if ( is_DTXrate( ivas_total_brate ) ) { st->VAD = 0; @@ -215,12 +241,11 @@ ivas_error ivas_sce_dec( * Decoder *----------------------------------------------------------------*/ - if ( ( error = ivas_core_dec( NULL, hSCE, NULL, NULL, 1, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_core_dec( st_ivas, hSCE, NULL, NULL, 1, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) { return error; } - if ( st_ivas->sba_dirac_stereo_flag && ( st->core_brate > SID_2k40 || st->cng_type == LP_CNG ) ) { /* skip addition of ACELP BWE for now, will be done after upmix */ @@ -347,7 +372,7 @@ ivas_error create_sce_dec( return error; } - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) + if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ) ) { if ( ( error = openCldfb( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_sns_dec.c b/lib_dec/ivas_sns_dec.c index 7aecb898d139a033876c4916c8ec4aebadeaab30..4812091ecc5aff53331660c12bb35f2d2f38b112 100644 --- a/lib_dec/ivas_sns_dec.c +++ b/lib_dec/ivas_sns_dec.c @@ -35,6 +35,13 @@ #include "prot.h" #include "ivas_prot.h" #include "rom_com.h" +#ifdef SNS_MSVQ +#include "ivas_rom_com.h" +#include "ivas_cnst.h" +#endif +#ifdef FIX_445_SNS_BUGFIXES +#include +#endif #include "wmc_auto.h" /*------------------------------------------------------------------- @@ -45,24 +52,67 @@ static void sns_1st_dec( const int16_t index, /* i : codebook index */ - float *snsq /* i/o: i:prediction o:quantized sns */ +#ifdef FIX_445_SNS_BUGFIXES + const int16_t core, + const int16_t L_frame, +#endif + float *snsq /* i/o: i:prediction o:quantized sns */ ) { int16_t i; +#ifdef FIX_445_SNS_BUGFIXES + const int16_t *p_dico, *means; + const float cdbk_fix2float = 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ); + const float means_fix2float = 1.f / powf( 2, SNS_MEANS_BITS_4_FRAC ); + + means = NULL; + switch ( L_frame ) + { + case L_FRAME16k: + means = &sns_1st_means_16k[core - 1][0]; + break; + case L_FRAME25_6k: + means = &sns_1st_means_25k6[core - 1][0]; + break; + case L_FRAME32k: + means = &sns_1st_means_32k[core - 1][0]; + break; + default: + assert( !"illegal frame length in sns_1st_cod" ); + } + +#else const float *p_dico; +#endif +#ifdef FIX_445_SNS_BUGFIXES + p_dico = &sns_1st_cdbk[0][core - 1][0] + ( index % 32 ) * ( M / 2 ); +#else p_dico = &sns_vq_cdk1[( index % 32 ) * ( M / 2 )]; +#endif for ( i = 0; i < M / 2; i++ ) { +#ifdef FIX_445_SNS_BUGFIXES + snsq[i] = ( *p_dico++ ) * cdbk_fix2float + means[i] * means_fix2float; +#else snsq[i] = *p_dico++; +#endif } +#ifdef FIX_445_SNS_BUGFIXES + p_dico = &sns_1st_cdbk[1][core - 1][0] + ( index >> 5 ) * ( M / 2 ); +#else p_dico = &sns_vq_cdk2[( index >> 5 ) * ( M / 2 )]; +#endif for ( i = M / 2; i < M; i++ ) { +#ifdef FIX_445_SNS_BUGFIXES + snsq[i] = ( *p_dico++ ) * cdbk_fix2float + means[i] * means_fix2float; +#else snsq[i] = *p_dico++; +#endif } return; @@ -103,14 +153,25 @@ static void sns_2st_dec( *-------------------------------------------------------------------*/ void sns_avq_dec( - int16_t *index, /* i : Quantization indices */ - float *SNS_Q, /* o : Quantized SNS vectors */ + int16_t *index, /* i : Quantization indices */ +#ifdef SNS_MSVQ + float SNS_Q[NB_DIV][M], /* o : Quantized SNS vectors */ +#else + float *SNS_Q, /* o : Quantized SNS vectors */ +#endif +#ifdef FIX_445_SNS_BUGFIXES + const int16_t L_frame, +#endif const int16_t numlpc /* i : Number of sets of lpc */ ) { int16_t i, nbi, last; int16_t q_type; +#ifdef SNS_MSVQ + /* go from one-based indexing to zero-based indexing */ + last = numlpc - 1; +#else /* Last LPC index */ if ( numlpc == 1 ) { @@ -120,12 +181,26 @@ void sns_avq_dec( { last = M; } +#endif index++; /* Decode last LPC */ +#ifdef SNS_MSVQ +#ifdef FIX_445_SNS_BUGFIXES + sns_1st_dec( *index++, numlpc, L_frame, SNS_Q[last] ); +#else + sns_1st_dec( *index++, SNS_Q[last] ); +#endif + sns_2st_dec( SNS_Q[last], index ); +#else +#ifdef FIX_445_SNS_BUGFIXES + sns_1st_dec( *index++, numplc, L_Frame & SNS_Q[last] ); +#else sns_1st_dec( *index++, &SNS_Q[last] ); +#endif sns_2st_dec( &SNS_Q[last], index ); +#endif nbi = 2 + index[0] + index[1]; index += nbi; @@ -136,16 +211,37 @@ void sns_avq_dec( if ( q_type == 0 ) { +#ifdef SNS_MSVQ +#ifdef FIX_445_SNS_BUGFIXES + sns_1st_dec( *index++, numlpc, L_frame, SNS_Q[0] ); +#else + sns_1st_dec( *index++, SNS_Q[0] ); +#endif + sns_2st_dec( SNS_Q[0], index ); +#else +#ifdef FIX_445_SNS_BUGFIXES + sns_1st_dec( *index++, numlpc, L_frame, &SNS_Q[0] ); +#else sns_1st_dec( *index++, &SNS_Q[0] ); +#endif sns_2st_dec( &SNS_Q[0], index ); +#endif } else if ( q_type == 1 ) { for ( i = 0; i < M; i++ ) { +#ifdef SNS_MSVQ + SNS_Q[0][i] = SNS_Q[0][M + i]; +#else SNS_Q[i] = SNS_Q[M + i]; +#endif } +#ifdef SNS_MSVQ + sns_2st_dec( SNS_Q[0], index ); +#else sns_2st_dec( &SNS_Q[0], index ); +#endif } } @@ -160,10 +256,13 @@ void sns_avq_dec( *-------------------------------------------------------------------*/ void sns_avq_dec_stereo( - int16_t *indexl, /* i : Quantization indices (left channel) */ - int16_t *indexr, /* i : Quantization indices (right channe) */ - float *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ - float *SNS_Qr /* o : Quantized SNS vectors (right channe) */ + int16_t *indexl, /* i : Quantization indices (left channel) */ + int16_t *indexr, /* i : Quantization indices (right channe) */ +#ifdef FIX_445_SNS_BUGFIXES + const int16_t L_frame, +#endif + float *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ + float *SNS_Qr /* o : Quantized SNS vectors (right channe) */ ) { int16_t i, stereo_mode; @@ -176,7 +275,11 @@ void sns_avq_dec_stereo( { /* MS coding */ +#ifdef FIX_445_SNS_BUGFIXES + sns_1st_dec( *indexl++, TCX_20_CORE, L_frame, mid_q ); +#else sns_1st_dec( *indexl++, mid_q ); +#endif sns_2st_dec( mid_q, indexl ); for ( i = 0; i < M; i++ ) @@ -199,12 +302,109 @@ void sns_avq_dec_stereo( { /* LR decoding */ +#ifdef FIX_445_SNS_BUGFIXES + sns_1st_dec( *indexl++, TCX_20_CORE, L_frame, SNS_Ql ); +#else sns_1st_dec( *indexl++, SNS_Ql ); +#endif sns_2st_dec( SNS_Ql, indexl ); +#ifdef FIX_445_SNS_BUGFIXES + sns_1st_dec( *indexr++, TCX_20_CORE, L_frame, SNS_Qr ); +#else sns_1st_dec( *indexr++, SNS_Qr ); +#endif sns_2st_dec( SNS_Qr, indexr ); } return; } + +#ifdef SNS_MSVQ +void dequantize_sns( + int16_t indices[CPE_CHANNELS][NPRM_LPC_NEW], + float snsQ_out[CPE_CHANNELS][NB_DIV][M], + Decoder_State **sts ) +{ + int16_t nSubframes, k, ch; +#ifndef FIX_445_SNS_BUGFIXES + const float *means; +#endif + int16_t sns_stereo_mode[NB_DIV]; + int16_t zero_side_flag[NB_DIV]; + Decoder_State *st; + + sns_stereo_mode[0] = indices[0][0]; + sns_stereo_mode[1] = indices[0][1]; + zero_side_flag[0] = indices[0][2]; + zero_side_flag[1] = indices[0][3]; + + for ( ch = 0; ch < CPE_CHANNELS; ++ch ) + { + int16_t idxIndices; + + st = sts[ch]; + nSubframes = ( st->core == TCX_20_CORE ) ? 1 : NB_DIV; + idxIndices = 0; + + for ( k = 0; k < nSubframes; ++k ) + { + const int16_t is_side = ch == 1 && sns_stereo_mode[k] == SNS_STEREO_MODE_MS; + const float *const *cdbks = ( nSubframes == 1 ) ? ivas_sns_cdbks_tcx20 : ivas_sns_cdbks_tcx10; + int16_t nStages = ( ( nSubframes == 1 ) ? SNS_MSVQ_NSTAGES_TCX20 : SNS_MSVQ_NSTAGES_TCX10 ); + float *snsQ = snsQ_out[ch][k]; + + if ( is_side ) + { + const float *const *side_cdbks = ( st->core == TCX_20_CORE ) ? ivas_sns_cdbks_side_tcx20 : ivas_sns_cdbks_side_tcx10; + if ( zero_side_flag[k] ) + { + set_zero( snsQ, M ); + continue; + } + + nStages = SNS_MSVQ_NSTAGES_SIDE; +#ifndef FIX_445_SNS_BUGFIXES + means = ( st->core == TCX_20_CORE ) ? ivas_sns_means_side_tcx20 : ivas_sns_means_side_tcx10; +#endif + msvq_dec( side_cdbks, NULL, NULL, nStages, M, M, &indices[ch][idxIndices + SNS_STEREO_MODE_OFFSET_INDICES], 0, NULL, snsQ, NULL ); + +#ifndef FIX_445_SNS_BUGFIXES + v_add( snsQ, means, snsQ, M ); +#endif + } + else + { + msvq_dec( cdbks, NULL, NULL, nStages, M, M, &indices[ch][idxIndices + SNS_STEREO_MODE_OFFSET_INDICES], 0, NULL, snsQ, NULL ); + } + idxIndices += nStages; + } + } + + if ( sns_stereo_mode[0] == SNS_STEREO_MODE_MS || sns_stereo_mode[1] == SNS_STEREO_MODE_MS ) + { + nSubframes = ( sts[0]->core == TCX_20_CORE ) ? 1 : NB_DIV; + for ( k = 0; k < nSubframes; ++k ) + { + if ( sns_stereo_mode[k] == SNS_STEREO_MODE_MS ) + { + inverseMS( M, snsQ_out[0][k], snsQ_out[1][k], 1.f ); + } + } + } +#ifndef FIX_445_SNS_BUGFIXES + + /* add means back */ + for ( ch = 0; ch < CPE_CHANNELS; ++ch ) + { + st = sts[ch]; + nSubframes = ( st->core == TCX_20_CORE ) ? 1 : NB_DIV; + means = ( st->core == TCX_20_CORE ) ? ivas_sns_means_tcx20 : ivas_sns_means_tcx10; + for ( k = 0; k < nSubframes; ++k ) + { + v_add( snsQ_out[ch][k], means, snsQ_out[ch][k], M ); + } + } +#endif +} +#endif // SNS_MSVQ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c old mode 100644 new mode 100755 index 2eff5d2cba546e108ba612ba10ee95802fd6c4b0..22d38997ddeb09b82337e2ec4dbee906448efa46 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -39,7 +39,9 @@ #include "prot.h" #include "string.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_rom_com.h" +#include "ivas_rom_dec.h" #include "ivas_stat_com.h" #include #include @@ -60,7 +62,8 @@ static void ivas_spar_dec_MD( Decoder_Struct *st_ivas, Decoder_State *st0 ); *------------------------------------------------------------------------*/ ivas_error ivas_spar_dec_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { SPAR_DEC_HANDLE hSpar; @@ -69,27 +72,58 @@ ivas_error ivas_spar_dec_open( IVAS_FB_CFG *fb_cfg; int16_t i, j, b, active_w_mixing; int32_t output_Fs; +#ifdef SPAR_TUNING + int16_t num_decor_chs; +#endif error = IVAS_ERR_OK; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - num_channels_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); + num_channels_internal = ivas_sba_get_nchan_metadata( sba_order_internal +#ifdef SPAR_TUNING + , + st_ivas->hDecoderConfig->ivas_total_brate +#endif + ); + + hSpar = st_ivas->hSpar; - /* SPAR decoder handle */ - if ( ( hSpar = (SPAR_DEC_HANDLE) malloc( sizeof( SPAR_DEC_DATA ) ) ) == NULL ) + if ( !spar_reconfig_flag ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder" ); + /* SPAR decoder handle */ + if ( ( hSpar = (SPAR_DEC_HANDLE) malloc( sizeof( SPAR_DEC_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder" ); + } } output_Fs = st_ivas->hDecoderConfig->output_Fs; +#ifdef SPAR_TUNING + if ( num_channels_internal > ( SBA_HOA2_ORDER + 1 ) * ( SBA_HOA2_ORDER + 1 ) ) + { + num_decor_chs = IVAS_HBR_MAX_DECOR_CHS; + } + else + { + num_decor_chs = num_channels_internal - 1; + } +#endif +#ifdef SPAR_TUNING /* TD decorr. */ - if ( ( error = ivas_spar_td_decorr_dec_open( &hSpar->hTdDecorr, output_Fs, num_channels_internal, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_decorr_dec_open( &hSpar->hTdDecorr, output_Fs, num_decor_chs + 1, 1 ) ) != IVAS_ERR_OK ) { return error; } +#else + /* TD decorr. */ + if ( ( error = ivas_td_decorr_dec_open( &hSpar->hTdDecorr, output_Fs, num_channels_internal, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif /* MD handle */ - if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal, st_ivas->sid_format ) ) != IVAS_ERR_OK ) { return error; } @@ -98,7 +132,12 @@ ivas_error ivas_spar_dec_open( /* set FB config. */ active_w_mixing = -1; - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, num_channels_internal, num_channels_internal, active_w_mixing, output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, num_channels_internal, num_channels_internal, active_w_mixing, output_Fs +#ifdef HODIRAC + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -106,7 +145,7 @@ ivas_error ivas_spar_dec_open( fb_cfg->remix_order = remix_order_set[hSpar->hMdDec->spar_md_cfg.remix_unmix_order]; /* FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &hSpar->hFbMixer, output_Fs, fb_cfg ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_FB_mixer_open( &hSpar->hFbMixer, output_Fs, fb_cfg, spar_reconfig_flag ) ) != IVAS_ERR_OK ) { return error; } @@ -167,6 +206,49 @@ ivas_error ivas_spar_dec_open( ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); +#ifdef JBM_TSM_ON_TCS + set_s( hSpar->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); + set_s( hSpar->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); + hSpar->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; + hSpar->subframes_rendered = 0; + hSpar->slots_rendered = 0; + hSpar->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; + /* init render timeslot mapping */ + { + int16_t map_idx; + set_s( hSpar->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + for ( map_idx = 0; map_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; map_idx++ ) + { + hSpar->render_to_md_map[map_idx] = map_idx; + } + } + /* allocate transport channels*/ + if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) + { + int16_t nchan_to_allocate; + int16_t nchan_tc; + TC_BUFFER_MODE buffer_mode; + + buffer_mode = TC_BUFFER_MODE_RENDERER; + nchan_tc = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + nchan_to_allocate = num_channels_internal; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) + { + buffer_mode = TC_BUFFER_MODE_BUFFER; + nchan_tc = st_ivas->hDecoderConfig->nchan_out; + nchan_to_allocate = nchan_tc; + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + nchan_to_allocate = 2 * BINAURAL_CHANNELS; + } + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif + st_ivas->hSpar = hSpar; return error; @@ -180,33 +262,39 @@ ivas_error ivas_spar_dec_open( *------------------------------------------------------------------------*/ void ivas_spar_dec_close( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - const int32_t output_Fs /* i : output sampling rate */ + SPAR_DEC_HANDLE *hSpar, /* i/o: SPAR decoder handle */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { - if ( hSpar != NULL ) + if ( *hSpar == NULL || hSpar == NULL ) { - /* MD handle */ - ivas_spar_md_dec_close( &hSpar->hMdDec ); + return; + } - /* Covar. State handle */ - ivas_spar_td_decorr_dec_close( &hSpar->hTdDecorr ); + /* MD handle */ + ivas_spar_md_dec_close( &( *hSpar )->hMdDec ); - /* FB mixer handle */ - ivas_FB_mixer_close( &hSpar->hFbMixer, output_Fs ); + /* TD decorrelator handle */ + ivas_td_decorr_dec_close( &( *hSpar )->hTdDecorr ); - /* AGC */ - ivas_spar_agc_dec_close( &hSpar->hAgcDec ); + /* FB mixer handle */ + ivas_FB_mixer_close( &( *hSpar )->hFbMixer, output_Fs, spar_reconfig_flag ); - /* PCA */ - if ( hSpar->hPCA != NULL ) - { - free( hSpar->hPCA ); - hSpar->hPCA = NULL; - } + /* AGC */ + ivas_spar_agc_dec_close( &( *hSpar )->hAgcDec ); + + /* PCA */ + if ( ( *hSpar )->hPCA != NULL ) + { + free( ( *hSpar )->hPCA ); + ( *hSpar )->hPCA = NULL; + } - free( hSpar ); - hSpar = NULL; + if ( !spar_reconfig_flag ) + { + free( ( *hSpar ) ); + ( *hSpar ) = NULL; } return; @@ -623,6 +711,9 @@ static void ivas_spar_dec_MD( { int16_t num_channels, table_idx, num_bands_out, bfi, sba_order; int32_t ivas_total_brate; +#ifdef SPAR_TUNING + int16_t num_md_sub_frames; +#endif DECODER_CONFIG_HANDLE hDecoderConfig = st_ivas->hDecoderConfig; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; @@ -635,7 +726,17 @@ static void ivas_spar_dec_MD( sba_order = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); bfi = st_ivas->bfi; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - num_channels = ivas_sba_get_nchan_metadata( sba_order ); + num_channels = ivas_sba_get_nchan_metadata( sba_order +#ifdef SPAR_TUNING + , + ivas_total_brate +#endif + ); + +#ifdef SPAR_TUNING + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); +#endif + num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; if ( ivas_total_brate > FRAME_NO_DATA && !bfi ) @@ -694,7 +795,13 @@ static void ivas_spar_dec_MD( if ( st0->m_old_frame_type == ZERO_FRAME && ivas_total_brate == IVAS_SID_5k2 && st0->prev_bfi == 0 && hSpar->hMdDec->spar_md_cfg.nchan_transport == 1 ) { - ivas_spar_setup_md_smoothing( hSpar->hMdDec, num_bands_out ); + ivas_spar_setup_md_smoothing( hSpar->hMdDec, num_bands_out + +#ifdef SPAR_TUNING + , + num_md_sub_frames +#endif + ); } else { @@ -705,7 +812,12 @@ static void ivas_spar_dec_MD( { if ( !bfi ) { - ivas_spar_smooth_md_dtx( hSpar->hMdDec, num_bands_out ); + ivas_spar_smooth_md_dtx( hSpar->hMdDec, num_bands_out +#ifdef SPAR_TUNING + , + num_md_sub_frames +#endif + ); } set_s( hSpar->hMdDec->valid_bands, 0, IVAS_MAX_NUM_BANDS ); @@ -794,18 +906,17 @@ void ivas_spar_get_parameters( weight = ivas_spar_get_cldfb_slot_gain( hSpar, hDecoderConfig, ts, &ts0, &ts1, &weight_20ms ); - split_band = hSpar->hMdDec->spar_md.num_bands; - + split_band = SPAR_DIRAC_SPLIT_START_BAND; for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { for ( out_ch = 0; out_ch < num_ch_out; out_ch++ ) { - for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) + if ( split_band < IVAS_MAX_NUM_BANDS + /* 20ms cross-fade for Transport channels in all frequency bands */ + && ( 0 == ivas_is_res_channel( out_ch, hSpar->hMdDec->spar_md_cfg.nchan_transport ) ) /* sub-frame processing for missing channels in all frequency bands*/ + ) { - if ( split_band < IVAS_MAX_NUM_BANDS - /* 20ms cross-fade for Transport channels in all frequency bands */ - && ( 0 == ivas_is_res_channel( out_ch, hSpar->hMdDec->spar_md_cfg.nchan_transport ) ) /* sub-frame processing for missing channels in all frequency bands*/ - ) + for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) { if ( hSpar->i_subframe > 3 ) { @@ -817,7 +928,10 @@ void ivas_spar_get_parameters( par_mat[out_ch][in_ch][spar_band] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band]; } } - else + } + else + { + for ( in_ch = 0; in_ch < num_ch_in; in_ch++ ) { /* 20ms Transport channel reconstruction with matching encoder/decoder processing */ int16_t prev_idx = SPAR_DIRAC_SPLIT_START_BAND < IVAS_MAX_NUM_BANDS ? 1 : 0; /* if SPAR_DIRAC_SPLIT_START_BAND == IVAS_MAX_NUM_BANDS, then the sub-frame mixer_mat delay line is not active */ @@ -842,7 +956,12 @@ static void ivas_spar_get_skip_mat( const int16_t num_ch_out, const int16_t num_ch_in, const int16_t num_spar_bands, - int16_t skip_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ) + int16_t skip_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames +#endif +) { int16_t spar_band, out_ch, in_ch; int16_t i_ts, skip_flag; @@ -853,6 +972,45 @@ static void ivas_spar_get_skip_mat( { skip_mat[out_ch][in_ch] = 1; skip_flag = 1; +#ifdef SPAR_TUNING + for ( i_ts = 0; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) + { + for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) + { + if ( hSpar->hMdDec->mixer_mat_prev[1 + i_ts][out_ch][in_ch][spar_band] != 0.0f ) + { + skip_flag = 0; + break; + } + } + + if ( skip_flag == 0 ) + { + skip_mat[out_ch][in_ch] = 0; + break; + } + } + if ( skip_mat[out_ch][in_ch] == 1 ) + { + for ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) + { + for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) + { + if ( hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band + i_ts * MAX_PARAM_SPATIAL_SUBFRAMES] != 0.0f ) + { + skip_flag = 0; + break; + } + } + + if ( skip_flag == 0 ) + { + skip_mat[out_ch][in_ch] = 0; + break; + } + } + } +#else for ( i_ts = 0; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) { @@ -871,51 +1029,468 @@ static void ivas_spar_get_skip_mat( break; } } +#endif + } + } + + return; +} + + +static void ivas_spar_calc_smooth_facs( + float *cldfb_in_ts_re[CLDFB_NO_COL_MAX], + float *cldfb_in_ts_im[CLDFB_NO_COL_MAX], + int16_t nbands_spar, + ivas_fb_bin_to_band_data_t *bin2band, + float *smooth_fac, + float smooth_buf[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1] ) +{ + int16_t b, bin, i, ts; + float subframe_band_nrg[IVAS_MAX_NUM_BANDS]; + float smooth_long_avg[IVAS_MAX_NUM_BANDS]; + float smooth_short_avg[IVAS_MAX_NUM_BANDS]; + + bin = 0; + for ( b = 0; b < nbands_spar; b++ ) + { + if ( b > 0 && bin2band->p_cldfb_map_to_spar_band[bin] < bin2band->p_cldfb_map_to_spar_band[bin - 1] ) + { + break; + } + /* calculate band-wise subframe energies */ + subframe_band_nrg[b] = 0.f; + while ( b == bin2band->p_cldfb_map_to_spar_band[bin] ) + { + for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) + { + subframe_band_nrg[b] += cldfb_in_ts_re[ts][bin] * cldfb_in_ts_re[ts][bin] + cldfb_in_ts_im[ts][bin] * cldfb_in_ts_im[ts][bin]; + } + bin++; + } + subframe_band_nrg[b] = sqrtf( subframe_band_nrg[b] ); + smooth_buf[b][0] = subframe_band_nrg[b]; + + /* calculate short and long energy averages */ + smooth_short_avg[b] = EPSILON; + for ( i = 0; i < 2 * SBA_DIRAC_NRG_SMOOTH_SHORT; i++ ) + { + smooth_short_avg[b] += smooth_buf[b][i]; + } + + smooth_long_avg[b] = smooth_short_avg[b]; + for ( i = 2 * SBA_DIRAC_NRG_SMOOTH_SHORT; i < 2 * SBA_DIRAC_NRG_SMOOTH_LONG; i++ ) + { + smooth_long_avg[b] += smooth_buf[b][i]; + } + smooth_short_avg[b] /= ( 2 * SBA_DIRAC_NRG_SMOOTH_SHORT ); + smooth_long_avg[b] /= ( 2 * SBA_DIRAC_NRG_SMOOTH_LONG ); + + /* calculate smoothing factor based on energy averages */ + /* reduce factor for higher short-term energy */ + smooth_fac[b] = min( 1.f, smooth_long_avg[b] / smooth_short_avg[b] ); + /* map factor to range [0;1] */ + smooth_fac[b] = max( 0.f, smooth_fac[b] - (float) SBA_DIRAC_NRG_SMOOTH_SHORT / SBA_DIRAC_NRG_SMOOTH_LONG ) * ( (float) SBA_DIRAC_NRG_SMOOTH_LONG / ( SBA_DIRAC_NRG_SMOOTH_LONG - SBA_DIRAC_NRG_SMOOTH_SHORT ) ); + /* compress factor (higher compression in lowest bands) */ + if ( b < 2 ) + { + smooth_fac[b] = powf( smooth_fac[b], 0.25f ); + } + else + { + smooth_fac[b] = powf( smooth_fac[b], 0.5f ); + } + + /* apply upper bounds depending on band */ + smooth_fac[b] = max( min_smooth_gains1[b], min( max_smooth_gains2[b], smooth_fac[b] ) ); + } + + for ( b = 0; b < nbands_spar; b++ ) + { + for ( i = 2 * SBA_DIRAC_NRG_SMOOTH_LONG; i > 0; i-- ) + { + smooth_buf[b][i] = smooth_buf[b][i - 1]; } } return; } +#ifdef JBM_TSM_ON_TCS +void ivas_spar_dec_agc_pca( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output[][L_FRAME48k], /* i/o: input/output audio channels */ + const int16_t output_frame /* i : output frame length */ +) +{ + + int16_t nchan_transport; + int16_t num_in_ingest; + DECODER_CONFIG_HANDLE hDecoderConfig; + SPAR_DEC_HANDLE hSpar; + + push_wmops( "ivas_spar_dec_agc_pca" ); + + hSpar = st_ivas->hSpar; + hDecoderConfig = st_ivas->hDecoderConfig; + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; + if ( st_ivas->nchan_transport >= 3 ) + { + float temp; + int16_t i; + /*convert WYZX downmix to WYXZ*/ + for ( i = 0; i < output_frame; i++ ) + { + temp = output[2][i]; + output[2][i] = output[3][i]; + output[3][i] = temp; + } + } + + if ( hSpar->hMdDec->td_decorr_flag ) + { + num_in_ingest = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order +#ifdef SPAR_TUNING + , + st_ivas->hDecoderConfig->ivas_total_brate +#endif + ); + } + else + { + num_in_ingest = nchan_transport; + } + /*---------------------------------------------------------------------* + * AGC + *---------------------------------------------------------------------*/ + + ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after ivas_agc_dec_process */ + ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[1], "ivas_agc_dec_process()" ); +#endif + + if ( hSpar->hPCA != NULL ) + { + ivas_pca_dec( hSpar->hPCA, output_frame, num_in_ingest, hDecoderConfig->ivas_total_brate, hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after ivas_pca_dec */ + ivas_spar_dump_signal_wav( output_frame, NULL, output, num_in_ingest, spar_foa_dec_wav[2], "ivas_pca_dec()" ); +#endif + } + pop_wmops(); + return; +} + +void ivas_spar_dec_set_render_map( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t nCldfbTs ) +{ + SPAR_DEC_HANDLE hSpar; + + hSpar = st_ivas->hSpar; +#ifdef DEBUGGING + assert( hSpar ); +#endif + + /* adapt subframes */ + hSpar->num_slots = nCldfbTs; + hSpar->slots_rendered = 0; + hSpar->subframes_rendered = 0; + set_s( hSpar->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); + ivas_jbm_dec_get_adapted_subframes( nCldfbTs, hSpar->subframe_nbslots, &hSpar->nb_subframes ); + ivas_jbm_dec_get_md_map( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbTs, 1, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hSpar->render_to_md_map ); + + return; +} /*-------------------------------------------------------------------* * ivas_spar_dec_upmixer() * * IVAS SPAR upmixer *-------------------------------------------------------------------*/ +void ivas_spar_dec_set_render_params( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t n_cldfb_slots /* i : number of cldfb slots in this frame */ +) +{ + SPAR_DEC_HANDLE hSpar; + int16_t nchan_transport; + int16_t num_bands_out; + + hSpar = st_ivas->hSpar; + /*---------------------------------------------------------------------* + * Gen umx mat + *---------------------------------------------------------------------*/ + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; + num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi +#ifdef SPAR_TUNING + , + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) +#endif + ); + + ivas_spar_dec_set_render_map( st_ivas, n_cldfb_slots ); + + return; +} + +void ivas_spar_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nCldfbSlots, /* i : number of CLDFB slots */ + const int16_t nSamplesForRendering /* i : number of samples provided */ +) +{ + SPAR_DEC_HANDLE hSpar; + + hSpar = st_ivas->hSpar; + if ( hSpar->hMdDec->td_decorr_flag && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) + { + float Pcm_tmp[MAX_SPAR_INTERNAL_CHANNELS][L_FRAME48k]; + float *pPcm_tmp[MAX_SPAR_INTERNAL_CHANNELS]; + float *p_tc[MAX_SPAR_INTERNAL_CHANNELS]; + int16_t nchan_internal, ch; + int16_t nSamplesLeftForTD, default_frame; + /* TD decorrelator */ + default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + nSamplesLeftForTD = nSamplesForRendering; + nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order +#ifdef SPAR_TUNING + , + st_ivas->hDecoderConfig->ivas_total_brate +#endif + ); + for ( ch = 0; ch < nchan_internal; ch++ ) + { + pPcm_tmp[ch] = Pcm_tmp[ch]; + p_tc[ch] = st_ivas->hTcBuffer->tc[ch]; + } + + while ( nSamplesLeftForTD ) + { + int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); + ivas_td_decorr_process( hSpar->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr ); +#ifdef SPAR_TUNING + if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) + { + for ( ch = 0; ch < nchan_internal - nchan_transport; ch++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - ch], p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); + } + } + else + { + for ( ch = 0; ch < nchan_internal - nchan_transport; ch++ ) + { + set_zero( p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); + } + for ( ch = 0; ch < hSpar->hTdDecorr->num_apd_outputs; ch++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - ch], p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); + } + } +#else + for ( ch = 0; ch < nchan_internal - nchan_transport; ch++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - ch], p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); + } +#endif + for ( ch = 0; ch < nchan_internal; ch++ ) + { + p_tc[ch] += nSamplesToDecorr; + } + nSamplesLeftForTD -= nSamplesToDecorr; + } + } + + ivas_spar_dec_set_render_params( st_ivas, nCldfbSlots ); + + + return; +} + void ivas_spar_dec_upmixer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float output[][L_FRAME48k], /* i/o: input/output audio channels */ const int16_t nchan_internal, /* i : number of internal channels */ const int16_t output_frame /* i : output frame length */ ) +{ + SPAR_DEC_HANDLE hSpar; + int16_t nchan_transport, nchan_out; + int16_t subframe_idx, n, i; + int16_t n_samples_sf; + float *output_f_local[MAX_OUTPUT_CHANNELS]; + float Pcm_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + float *pPcm_tmp[MAX_OUTPUT_CHANNELS]; + + hSpar = st_ivas->hSpar; + nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; + nchan_out = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; + n_samples_sf = JBM_CLDFB_SLOTS_IN_SUBFRAME * NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) + { + output_f_local[n] = &output[n][0]; + } + for ( n = 0; n < nchan_internal; n++ ) + { + st_ivas->hTcBuffer->tc[n] = output[n]; + } + + /*---------------------------------------------------------------------* + * TD decorrelation + *---------------------------------------------------------------------*/ + for ( i = 0; i < nchan_internal; i++ ) + { + pPcm_tmp[i] = Pcm_tmp[i]; + } + if ( hSpar->hMdDec->td_decorr_flag ) + { + ivas_td_decorr_process( hSpar->hTdDecorr, st_ivas->hTcBuffer->tc, pPcm_tmp, output_frame ); +#ifdef SPAR_TUNING + if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) + { + for ( i = 0; i < nchan_internal - nchan_transport; i++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); + } + } + else + { + for ( i = 0; i < nchan_internal - nchan_transport; i++ ) + { + set_zero( st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); + } + for ( i = 0; i < hSpar->hTdDecorr->num_apd_outputs; i++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); + } + } +#else + for ( i = 0; i < nchan_internal - nchan_transport; i++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); + } +#endif + } + + + ivas_spar_dec_set_render_params( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); + + if ( st_ivas->hDirAC != 0 ) + { + ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); + } + + for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) + { + ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); + for ( n = 0; n < nchan_out; n++ ) + { + output_f_local[n] += n_samples_sf; + } + } + for ( n = 0; n < nchan_internal; n++ ) + { + st_ivas->hTcBuffer->tc[n] = NULL; + } + if ( st_ivas->hDirAC != 0 ) + { + if ( st_ivas->hDirAC->hConfig->dec_param_estim == 1 ) + { + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_CLDFB_TIMESLOTS ) % st_ivas->hDirAC->dirac_md_buffer_length; + } + else + { + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + } + } + return; +} +#endif + + +#ifdef JBM_TSM_ON_TCS +/*-------------------------------------------------------------------* + * ivas_spar_dec_upmixer_sf() + * + * IVAS SPAR upmixer + *-------------------------------------------------------------------*/ +void ivas_spar_dec_upmixer_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float *output[], /* o : output audio channels */ + const int16_t nchan_internal /* i : number of internal channels */ +) +#else +void ivas_spar_dec_upmixer( + + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float output[][L_FRAME48k], /* i/o: input/output audio channels */ + const int16_t nchan_internal, /* i : number of internal channels */ + const int16_t output_frame /* i : output frame length */ +) +#endif { int16_t cldfb_band, num_cldfb_bands, numch_in, numch_out; float *cldfb_in_ts_re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX]; float *cldfb_in_ts_im[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX]; int16_t i, b, ts, out_ch, in_ch; int16_t num_spar_bands, spar_band, nchan_transport; - int16_t num_in_ingest, num_bands_out, split_band; + int16_t num_in_ingest, split_band; +#ifdef JBM_TSM_ON_TCS + int16_t slot_size, slot_idx_start; + float *p_tc[MAX_OUTPUT_CHANNELS]; + int16_t md_idx; +#endif float Pcm_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; int16_t numch_out_dirac; +#ifndef JBM_TSM_ON_TCS float *pPcm_tmp[MAX_OUTPUT_CHANNELS]; + int16_t num_bands_out; +#endif float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; int16_t b_skip_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; DECODER_CONFIG_HANDLE hDecoderConfig; SPAR_DEC_HANDLE hSpar; +#ifdef SPAR_TUNING + int16_t num_md_sub_frames; +#ifndef JBM_TSM_ON_TCS + int16_t md_sf_idx; +#endif +#endif +#ifdef JBM_TSM_ON_TCS + push_wmops( "ivas_spar_dec_upmixer_sf" ); +#else push_wmops( "ivas_spar_dec_upmixer" ); +#endif hSpar = st_ivas->hSpar; hDecoderConfig = st_ivas->hDecoderConfig; +#ifndef JBM_TSM_ON_TCS num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; +#endif nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; +#ifdef SPAR_TUNING + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate ); +#endif + +#ifdef JBM_TSM_ON_TCS + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + slot_idx_start = hSpar->slots_rendered; + for ( i = 0; i < nchan_internal; i++ ) + { + p_tc[i] = st_ivas->hTcBuffer->tc[i] + slot_idx_start * slot_size; + } +#endif + #ifdef DEBUG_SPAR_BYPASS_EVS_CODEC /* by-pass core-coder */ /*write the core coder output to a file for debugging*/ @@ -953,17 +1528,19 @@ void ivas_spar_dec_upmixer( } #endif +#ifndef JBM_TSM_ON_TCS /*---------------------------------------------------------------------* * AGC *---------------------------------------------------------------------*/ ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); + #ifdef DEBUG_SBA_AUDIO_DUMP /* Dump audio signal after ivas_agc_dec_process */ ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[1], "ivas_agc_dec_process()" ); #endif - +#endif /*---------------------------------------------------------------------* * TD Decorr and pcm ingest *---------------------------------------------------------------------*/ @@ -977,11 +1554,12 @@ void ivas_spar_dec_upmixer( num_in_ingest = nchan_transport; } +#ifndef JBM_TSM_ON_TCS for ( i = 0; i < nchan_internal; i++ ) { pPcm_tmp[i] = Pcm_tmp[i]; } - +#endif /*---------------------------------------------------------------------* * PCA decoder *---------------------------------------------------------------------*/ @@ -989,6 +1567,7 @@ void ivas_spar_dec_upmixer( hSpar->pca_ingest_channels = num_in_ingest; #endif +#ifndef JBM_TSM_ON_TCS /* will already happen in the TC decoding */ if ( hSpar->hPCA != NULL ) { ivas_pca_dec( hSpar->hPCA, output_frame, num_in_ingest, hDecoderConfig->ivas_total_brate, hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); @@ -997,22 +1576,44 @@ void ivas_spar_dec_upmixer( ivas_spar_dump_signal_wav( output_frame, NULL, output, num_in_ingest, spar_foa_dec_wav[2], "ivas_pca_dec()" ); #endif } +#endif - +#ifndef JBM_TSM_ON_TCS /*---------------------------------------------------------------------* * TD decorrelation *---------------------------------------------------------------------*/ if ( hSpar->hMdDec->td_decorr_flag ) { - ivas_td_decorr_process( hSpar->hTdDecorr, output, pPcm_tmp, output_frame ); + ivas_td_decorr_process( hSpar->hTdDecorr, output, pPcm_tmp, output_frame ); +#ifdef SPAR_TUNING + if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) + { + for ( i = 0; i < nchan_internal - nchan_transport; i++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], output[nchan_internal - 1 - i], output_frame ); + } + } + else + { + for ( i = 0; i < nchan_internal - nchan_transport; i++ ) + { + set_zero( output[nchan_internal - 1 - i], output_frame ); + } + for ( i = 0; i < hSpar->hTdDecorr->num_apd_outputs; i++ ) + { + mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], output[nchan_internal - 1 - i], output_frame ); + } + } +#else for ( i = 0; i < nchan_internal - nchan_transport; i++ ) { mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], output[nchan_internal - 1 - i], output_frame ); } +#endif } - +#endif hSpar->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; @@ -1045,12 +1646,18 @@ void ivas_spar_dec_upmixer( } } +#ifndef JBM_TSM_ON_TCS /*---------------------------------------------------------------------* * Gen umx mat *---------------------------------------------------------------------*/ - ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi ); - + ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi +#ifdef SPAR_TUNING + , + num_md_sub_frames +#endif + ); +#endif /*---------------------------------------------------------------------* * CLDFB Processing and Synthesis @@ -1060,19 +1667,43 @@ void ivas_spar_dec_upmixer( /* apply parameters */ /* determine if we can skip certain data */ - ivas_spar_get_skip_mat( hSpar, numch_out, numch_in, num_spar_bands, b_skip_mat ); /* this can be precomputed based on bitrate and format*/ + ivas_spar_get_skip_mat( hSpar, numch_out, numch_in, num_spar_bands, b_skip_mat +#ifdef SPAR_TUNING + , + num_md_sub_frames +#endif + ); /* this can be precomputed based on bitrate and format*/ numch_out_dirac = hDecoderConfig->nchan_out; +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after ivas_agc_dec_process */ +#ifdef JBM_TSM_ON_TCS + ivas_spar_dump_signal_wav( output_frame, p_tc, NULL, numch_in, spar_foa_dec_wav[4], "ivas_spar_upmixer()" ); +#else + ivas_spar_dump_signal_wav( output_frame, NULL, output, numch_in, spar_foa_dec_wav[4], "ivas_spar_upmixer()" ); +#endif +#endif + +#ifndef JBM_TSM_ON_TCS for ( int16_t i_sf = 0; i_sf < MAX_PARAM_SPATIAL_SUBFRAMES; i_sf++ ) { +#endif /* CLDFB analysis of incoming frame */ for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) +#ifdef JBM_TSM_ON_TCS + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) +#else + for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) +#endif { cldfbAnalysis_ts( - &output[in_ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], +#ifdef JBM_TSM_ON_TCS + &p_tc[in_ch][ts * num_cldfb_bands], +#else + &output[in_ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], +#endif cldfb_in_ts_re[in_ch][ts], cldfb_in_ts_im[in_ch][ts], num_cldfb_bands, @@ -1080,10 +1711,49 @@ void ivas_spar_dec_upmixer( } } - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) + if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) + { +#ifdef LBR_ADAP_SMOOTHING_OPT + ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf ); +#else + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + { + ivas_spar_calc_smooth_facs( cldfb_in_ts_re[in_ch], cldfb_in_ts_im[in_ch], num_spar_bands, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac[in_ch], hSpar->hMdDec->smooth_buf[in_ch] ); + } +#endif + } + +#ifdef JBM_TSM_ON_TCS + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) +#else + for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) +#endif { - /* determine SPAR parameters for this time slots */ - ivas_spar_get_parameters( hSpar, hDecoderConfig, ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES, numch_out, numch_in, num_spar_bands, mixer_mat ); +#ifdef JBM_TSM_ON_TCS + md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; + ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); +#else + /* determine SPAR parameters for this time slots */ + ivas_spar_get_parameters( hSpar, hDecoderConfig, ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES, numch_out, numch_in, num_spar_bands, mixer_mat ); +#endif + if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) + { + for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) + { + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + { + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + { +#ifdef LBR_ADAP_SMOOTHING_OPT + mixer_mat[out_ch][in_ch][spar_band] = ( 1 - hSpar->hMdDec->smooth_fac[spar_band] ) * mixer_mat[out_ch][in_ch][spar_band] + hSpar->hMdDec->smooth_fac[spar_band] * hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band]; +#else + mixer_mat[out_ch][in_ch][spar_band] = ( 1 - hSpar->hMdDec->smooth_fac[in_ch][spar_band] ) * mixer_mat[out_ch][in_ch][spar_band] + hSpar->hMdDec->smooth_fac[in_ch][spar_band] * hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band]; +#endif + hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band] = mixer_mat[out_ch][in_ch][spar_band]; + } + } + } + } for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) { @@ -1099,28 +1769,53 @@ void ivas_spar_dec_upmixer( for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - if ( b_skip_mat[out_ch][in_ch] ) - { - continue; - } - else if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ +#ifdef SPAR_TUNING + if ( b_skip_mat[out_ch][in_ch] == 0 ) { - spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; - cldfb_par = mixer_mat[out_ch][in_ch][spar_band]; - } - else - { - cldfb_par = 0.0f; - for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) + if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ + { + spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; + cldfb_par = mixer_mat[out_ch][in_ch][spar_band]; + } + else { - /* accumulate contributions from all SPAR bands */ - cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band]; + cldfb_par = 0.0f; + for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) + { + /* accumulate contributions from all SPAR bands */ + cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band]; + } } + + out_re[out_ch] += cldfb_in_ts_re[in_ch][ts][cldfb_band] * cldfb_par; + out_im[out_ch] += cldfb_in_ts_im[in_ch][ts][cldfb_band] * cldfb_par; } + } +#else - out_re[out_ch] += cldfb_in_ts_re[in_ch][ts][cldfb_band] * cldfb_par; - out_im[out_ch] += cldfb_in_ts_im[in_ch][ts][cldfb_band] * cldfb_par; + if ( b_skip_mat[out_ch][in_ch] ) + { + continue; + } + else if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ + { + spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; + cldfb_par = mixer_mat[out_ch][in_ch][spar_band]; } + else + { + cldfb_par = 0.0f; + for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) + { + /* accumulate contributions from all SPAR bands */ + cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band]; + } + } + + out_re[out_ch] += cldfb_in_ts_re[in_ch][ts][cldfb_band] * cldfb_par; + out_im[out_ch] += cldfb_in_ts_im[in_ch][ts][cldfb_band] * cldfb_par; + } +#endif } /*update CLDFB data with the parameter-modified data*/ @@ -1130,11 +1825,46 @@ void ivas_spar_dec_upmixer( cldfb_in_ts_im[out_ch][ts][cldfb_band] = out_im[out_ch]; } } +#ifdef JBM_TSM_ON_TCS + if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) + { + /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ + int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME; + split_band = SPAR_DIRAC_SPLIT_START_BAND; +#ifdef SPAR_TUNING + md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? md_sf : 0; +#endif + if ( split_band < IVAS_MAX_NUM_BANDS ) + { + mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + { + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + { + for ( b = 0; b < num_spar_bands; b++ ) + { + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; + } + } + } + hSpar->i_subframe++; + hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); + } + } +#endif } if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) { - ivas_dirac_dec( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im, i_sf ); +#ifdef JBM_TSM_ON_TCS + ivas_dirac_dec_render_sf( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); +#else + ivas_dirac_dec( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im, i_sf ); +#endif } if ( st_ivas->hDirAC != NULL ) @@ -1148,8 +1878,11 @@ void ivas_spar_dec_upmixer( { if ( ( st_ivas->hOutSetup.num_lfe > 0 ) && ( st_ivas->hOutSetup.index_lfe[idx_lfe] == ch ) ) { - set_zero( &( output[ch][i_sf * MAX_PARAM_SPATIAL_SUBFRAMES * num_cldfb_bands] ), MAX_PARAM_SPATIAL_SUBFRAMES * num_cldfb_bands ); - +#ifdef JBM_TSM_ON_TCS + set_zero( output[ch], hSpar->subframe_nbslots[hSpar->subframes_rendered] * num_cldfb_bands ); +#else + set_zero( &( output[ch][i_sf * MAX_PARAM_SPATIAL_SUBFRAMES * num_cldfb_bands] ), MAX_PARAM_SPATIAL_SUBFRAMES * num_cldfb_bands ); +#endif if ( idx_lfe < ( st_ivas->hDirAC->hOutSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -1159,12 +1892,20 @@ void ivas_spar_dec_upmixer( { if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) { - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) +#ifdef JBM_TSM_ON_TCS + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) +#else + for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) +#endif { cldfbSynthesis( &cldfb_in_ts_re[idx_in][ts], &cldfb_in_ts_im[idx_in][ts], - &output[ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], +#ifdef JBM_TSM_ON_TCS + &output[ch][ts * num_cldfb_bands], +#else + &output[ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], +#endif num_cldfb_bands, st_ivas->cldfbSynDec[idx_in] ); } @@ -1181,12 +1922,20 @@ void ivas_spar_dec_upmixer( /* CLDFB to time synthesis (overwrite mixer output) */ for ( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) +#ifdef JBM_TSM_ON_TCS + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) +#else + for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) +#endif { cldfbSynthesis( &cldfb_in_ts_re[out_ch][ts], &cldfb_in_ts_im[out_ch][ts], - &output[out_ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], +#ifdef JBM_TSM_ON_TCS + &output[out_ch][ts * num_cldfb_bands], +#else + &output[out_ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], +#endif num_cldfb_bands, st_ivas->cldfbSynDec[out_ch] ); } @@ -1200,6 +1949,11 @@ void ivas_spar_dec_upmixer( ivas_spar_dump_signal_wav( output_frame, NULL, output, hSpar->numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); #endif + +#ifndef JBM_TSM_ON_TCS +#ifdef SPAR_TUNING + md_sf_idx = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? i_sf : 0; +#endif split_band = SPAR_DIRAC_SPLIT_START_BAND; if ( split_band < IVAS_MAX_NUM_BANDS ) { @@ -1216,13 +1970,23 @@ void ivas_spar_dec_upmixer( { for ( b = 0; b < num_spar_bands; b++ ) { +#ifdef SPAR_TUNING + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf_idx * IVAS_MAX_NUM_BANDS]; +#else hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + i_sf * IVAS_MAX_NUM_BANDS]; +#endif } } } } +#endif +#ifndef JBM_TSM_ON_TCS } - +#endif +#ifdef JBM_TSM_ON_TCS + hSpar->slots_rendered += hSpar->subframe_nbslots[hSpar->subframes_rendered]; + hSpar->subframes_rendered++; +#endif pop_wmops(); return; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c old mode 100644 new mode 100755 index 6c978384e868914b9bae36893497f0498ba08d03..6b9f1457d4a3cb3aeba1c9fd9ae99a8bfcd17472 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -63,9 +63,15 @@ static const int16_t ivas_spar_dec_plc_spatial_target[IVAS_SPAR_MAX_CH] = { 1, 0 * Static functions declaration *------------------------------------------------------------------------------------------*/ -static void ivas_get_spar_matrices( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, const int16_t n_ts, const int16_t bw, const int16_t dtx_vad, const int16_t nB, const int16_t sba_order ); +static void ivas_get_spar_matrices( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, const int16_t n_ts, const int16_t bw, const int16_t dtx_vad, const int16_t nB, +#ifdef SPAR_TUNING + const int16_t numch_out, +#else + const int16_t sba_order, +#endif + const int16_t active_w_vlbr ); -static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t planarCP ); +static void ivas_decode_arith_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); static void ivas_decode_huffman_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder_State *st, const uint16_t qsi, const int16_t nB, const int16_t bands_bw, const int16_t planarCP ); @@ -75,9 +81,24 @@ static void ivas_get_band_idx_from_differential( ivas_spar_md_t *pSpar_md, const static void ivas_mat_col_rearrange( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, float ***mixer_mat, const int16_t bands, const int16_t num_ch ); -static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands, const int16_t bfi ); +static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands, const int16_t bfi +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames +#endif +); -static void ivas_spar_md_fill_invalid_bands( ivas_spar_dec_matrices_t *pSpar_coeffs, ivas_spar_dec_matrices_t *pSpar_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, const int16_t num_bands, const int16_t sba_order ); +static void ivas_spar_md_fill_invalid_bands( ivas_spar_dec_matrices_t *pSpar_coeffs, ivas_spar_dec_matrices_t *pSpar_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, const int16_t num_bands, +#ifdef SPAR_TUNING + const int16_t numch_out +#else + const int16_t sba_order +#endif +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames +#endif +); static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, const int16_t nchan_transport, float *pFC ); @@ -97,11 +118,23 @@ static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder static ivas_error ivas_spar_md_dec_matrix_open( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_channels /* i : number of internal channels */ +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames +#endif ) { int16_t i, j; +#ifndef SPAR_TUNING + int16_t num_md_sub_frames; + num_md_sub_frames = MAX_PARAM_SPATIAL_SUBFRAMES; +#endif +#ifdef SPAR_TUNING + if ( ( hMdDec->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * num_md_sub_frames * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) +#else if ( ( hMdDec->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) +#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" ); } @@ -117,7 +150,11 @@ static ivas_error ivas_spar_md_dec_matrix_open( } for ( j = 0; j < num_channels; j++ ) { +#ifdef SPAR_TUNING + if ( ( hMdDec->mixer_mat[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) +#else if ( ( hMdDec->mixer_mat[i][j] = (float *) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) +#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } @@ -136,7 +173,11 @@ static ivas_error ivas_spar_md_dec_matrix_open( } for ( j = 0; j < num_channels; j++ ) { +#ifdef SPAR_TUNING + if ( ( hMdDec->spar_coeffs.C_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) +#else if ( ( hMdDec->spar_coeffs.C_re[i][j] = (float *) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) +#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } @@ -155,7 +196,11 @@ static ivas_error ivas_spar_md_dec_matrix_open( } for ( j = 0; j < num_channels; j++ ) { +#ifdef SPAR_TUNING + if ( ( hMdDec->spar_coeffs.P_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) +#else if ( ( hMdDec->spar_coeffs.P_re[i][j] = (float *) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) +#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" ); } @@ -241,6 +286,23 @@ static ivas_error ivas_spar_md_dec_matrix_open( return IVAS_ERR_OK; } +#ifdef SPAR_TUNING +int16_t ivas_get_spar_dec_md_num_subframes( + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int32_t ivas_total_brate ) +{ + int16_t num_subframes; + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + if ( sba_order > SBA_FOA_ORDER ) + { + if ( ivas_total_brate >= IVAS_512k ) + { + num_subframes = 1; + } + } + return ( num_subframes ); +} +#endif /*------------------------------------------------------------------------- * ivas_spar_md_dec_open() @@ -249,14 +311,18 @@ static ivas_error ivas_spar_md_dec_matrix_open( *------------------------------------------------------------------------*/ ivas_error ivas_spar_md_dec_open( - ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ - const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ - const int16_t num_channels, /* i : number of internal channels */ - const int16_t sba_order /* i : SBA order */ + ivas_spar_md_dec_state_t **hMdDec_out, /* i/o: SPAR MD decoder handle */ + const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ + const int16_t num_channels, /* i : number of internal channels */ + const int16_t sba_order, /* i : SBA order */ + const int16_t sid_format /* i : SID format */ ) { ivas_spar_md_dec_state_t *hMdDec; ivas_error error; +#ifdef SPAR_TUNING + int16_t num_md_sub_frames; +#endif error = IVAS_ERR_OK; @@ -265,13 +331,24 @@ ivas_error ivas_spar_md_dec_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD decoder" ); } - if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels ) ) != IVAS_ERR_OK ) +#ifdef SPAR_TUNING + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate ); +#endif + if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels +#ifdef SPAR_TUNING + , + num_md_sub_frames +#endif + ) ) != IVAS_ERR_OK ) { return error; } hMdDec->table_idx = 0; /* just to initialize state variables*/ - + if ( ( hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) && ( sid_format == SID_SBA_2TC ) ) + { + hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_48k, sba_order, SPAR_CONFIG_BW, NULL, NULL ); + } if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK ) { return error; @@ -301,6 +378,7 @@ static void ivas_spar_md_dec_matrix_close( free( hMdDecoder->spar_md.band_coeffs ); hMdDecoder->spar_md.band_coeffs = NULL; } + if ( hMdDecoder->mixer_mat != NULL ) { for ( i = 0; i < num_channels; i++ ) @@ -414,11 +492,8 @@ void ivas_spar_md_dec_close( ivas_spar_md_dec_matrix_close( hMdDecoder, num_channels ); - if ( *hMdDec != NULL ) - { - free( *hMdDec ); - *hMdDec = NULL; - } + free( *hMdDec ); + *hMdDec = NULL; return; } @@ -441,7 +516,16 @@ ivas_error ivas_spar_md_dec_init( int16_t nchan_transport; float pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2]; +#ifdef SPAR_TUNING + ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate, &hMdDec->spar_hoa_md_flag, &hMdDec->spar_hoa_dirac2spar_md_flag ); +#else hMdDec->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate ); +#endif + +#ifdef SPAR_TUNING + ivas_sba_get_spar_hoa_ch_ind( num_channels, hDecoderConfig->ivas_total_brate, hMdDec->HOA_md_ind ); +#endif + hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, hMdDec->spar_md.num_bands ); @@ -534,6 +618,33 @@ ivas_error ivas_spar_md_dec_init( set_f( hMdDec->spar_md.en_ratio_slow, 0.0f, IVAS_MAX_NUM_BANDS ); set_f( hMdDec->spar_md.ref_pow_slow, 0.0f, IVAS_MAX_NUM_BANDS ); +#ifdef LBR_ADAP_SMOOTHING_OPT + set_zero( hMdDec->smooth_fac, IVAS_MAX_NUM_BANDS ); + for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) + { + set_zero( hMdDec->smooth_buf[i], 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } +#else + for ( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) + { + set_zero( hMdDec->smooth_fac[i], IVAS_MAX_NUM_BANDS ); + } + for ( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) + { + for ( j = 0; j < IVAS_MAX_NUM_BANDS; j++ ) + { + set_zero( hMdDec->smooth_buf[i][j], 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); + } + } +#endif + for ( i = 0; i < IVAS_SPAR_MAX_CH; i++ ) + { + for ( j = 0; j < IVAS_SPAR_MAX_CH; j++ ) + { + set_zero( hMdDec->mixer_mat_prev2[i][j], IVAS_MAX_NUM_BANDS ); + } + } + return IVAS_ERR_OK; } @@ -556,7 +667,12 @@ static ivas_error ivas_spar_set_dec_config( hMdDec->spar_md_cfg.max_freq_per_chan[i] = ivas_spar_br_table_consts[hMdDec->table_idx].fpcs; } - nchan = ivas_sba_get_nchan_metadata( ivas_spar_br_table_consts[hMdDec->table_idx].sba_order ); + nchan = ivas_sba_get_nchan_metadata( ivas_spar_br_table_consts[hMdDec->table_idx].sba_order +#ifdef SPAR_TUNING + , + ivas_spar_br_table_consts[hMdDec->table_idx].ivas_total_brate +#endif + ); switch ( nchan ) { @@ -616,18 +732,40 @@ void ivas_spar_md_dec_process( { int16_t j, k, b, bw, dtx_vad, nB, i_ts; ivas_spar_md_dec_state_t *hMdDec; +#ifdef SPAR_TUNING + int16_t num_md_chs; +#endif + int16_t num_md_sub_frames; hMdDec = st_ivas->hSpar->hMdDec; + int16_t active_w_vlbr; + active_w_vlbr = ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 ) ? 1 : 0; + +#ifdef SPAR_TUNING + num_md_chs = ivas_sba_get_nchan_metadata( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); +#endif +#ifdef SPAR_TUNING + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, st_ivas->hDecoderConfig->ivas_total_brate ); +#else + num_md_sub_frames = MAX_PARAM_SPATIAL_SUBFRAMES; +#endif + + ivas_spar_dec_parse_md_bs( hMdDec, st0, &nB, &bw, &dtx_vad, st_ivas->hDecoderConfig->ivas_total_brate, ivas_spar_br_table_consts[hMdDec->table_idx].usePlanarCoeff, st_ivas->hQMetaData->sba_inactive_mode ); -#ifdef DEBUG_SBA_MD_DUMP +#if 0 { char f_name[100]; int16_t num_bands = nB; int16_t num_subframes = 1, num_block_groups = 1, num_elements = 1, byte_size = sizeof( float ); - int16_t num_ch = ivas_sba_get_nchan_metadata( sba_order ); + int16_t num_ch = ivas_sba_get_nchan_metadata( sba_order +#ifdef SPAR_TUNING + , + st_ivas->hDecoderConfig->ivas_total_brate +#endif + ); for ( b = 0; b < num_bands; b++ ) { sprintf( f_name, "spar_band_pred_coeffs_dec.bin" ); @@ -669,9 +807,103 @@ void ivas_spar_md_dec_process( } } #endif +#ifdef DEBUG_LBR_SBA + /* Dumping SPAR HOA Coefficients */ + /*char f_name[100]; + int16_t nbands = 12; + int16_t num_subframes = 1; + int16_t num_elements = 7; + int16_t num_block_group = 1; + int16_t byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values_dec_PR.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[3], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[4], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[5], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[6], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } + nbands = 12; // 6 total, just looking at SPAR + num_subframes = 1; + num_elements = 12; + num_block_group = 1; + byte_size = sizeof( float ); + sprintf( f_name, "SBA_MD_values_dec_C.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + for ( int16_t p = 0; p < 4; p++ ) + { + for ( int16_t r = 0; r < 3; r++ ) + { + dbgwrite( &hMdDec->spar_md.band_coeffs[b].C_re[p][r], byte_size, 1, 1, f_name ); + } + } + } + } + } + nbands = 12; // 6 total, just looking at SPAR + num_subframes = 1; + num_elements = 4; + num_block_group = 1; + byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values_dec_P.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[3], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + }*/ +#endif /* SPAR to DirAC conversion */ - ivas_spar_to_dirac( st_ivas, hMdDec, dtx_vad, num_bands_out ); +#ifdef SPAR_TUNING + if ( hMdDec->spar_hoa_dirac2spar_md_flag == 1 ) +#endif + { + ivas_spar_to_dirac( st_ivas, hMdDec, dtx_vad, num_bands_out, bw ); + } /* set correct number of bands*/ nB = IVAS_MAX_NUM_BANDS; @@ -679,9 +911,135 @@ void ivas_spar_md_dec_process( { nB = nB >> 1; } +#ifdef DEBUG_LBR_SBA + /* Dumping SPAR Coefficients */ + char f_name[100]; + int16_t nbands = 4; // 6 total, just looking at SPAR + int16_t num_subframes = 1; + int16_t num_elements = 6; + int16_t num_block_group = 1; + int16_t byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values_dec.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[2], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } +#endif +#ifdef DEBUG_LBR_SBA + /* Dumping SPAR HOA Coefficients */ + /*char f_name[100]; + int16_t nbands = 12; + int16_t num_subframes = 1; + int16_t num_elements = 7; + int16_t num_block_group = 1; + int16_t byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values_dec_PR.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[3], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[4], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[5], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].pred_re[6], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } + nbands = 12; // 6 total, just looking at SPAR + num_subframes = 1; + num_elements = 12; + num_block_group = 1; + byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values_dec_C.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + for ( int16_t p = 0; p < 4; p++ ) + { + for ( int16_t r = 0; r < 3; r++ ) + { + dbgwrite( &hMdDec->spar_md.band_coeffs[b].C_re[p][r], byte_size, 1, 1, f_name ); + } + } + } + } + } + nbands = 12; // 6 total, just looking at SPAR + num_subframes = 1; + num_elements = 4; + num_block_group = 1; + byte_size = sizeof( float ); + sprintf( f_name, "SBA_MD_values_dec_P.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hMdDec->spar_md.band_coeffs[b].P_re[3], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + }*/ +#endif /* expand DirAC MD to all time slots */ +#ifdef SPAR_TUNING + for ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) +#else for ( i_ts = 1; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) +#endif { for ( b = 0; b < hMdDec->spar_md.num_bands; b++ ) { @@ -705,7 +1063,19 @@ void ivas_spar_md_dec_process( } } - ivas_get_spar_matrices( hMdDec, num_bands_out, MAX_PARAM_SPATIAL_SUBFRAMES, bw, dtx_vad, nB, sba_order ); +#ifdef SPAR_TUNING + ivas_get_spar_matrices( hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB, +#else + ivas_get_spar_matrices( hMdDec, num_bands_out, MAX_PARAM_SPATIAL_SUBFRAMES, bw, dtx_vad, nB, +#endif +#ifdef SPAR_TUNING + num_md_chs, +#else + sba_order, +#endif + active_w_vlbr + + ); #ifdef DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS { @@ -718,13 +1088,26 @@ void ivas_spar_md_dec_process( fprintf( fid, "%.6f\n", hMdDec->mixer_mat[1][0][band] ); } #endif - + if ( bw == IVAS_RED_BAND_FACT ) + { + nB = nB << 1; + } for ( b = nB; b < num_bands_out; b++ ) { hMdDec->valid_bands[b] = 1; } - ivas_spar_md_fill_invalid_bands( &hMdDec->spar_coeffs, &hMdDec->spar_coeffs_prev, &hMdDec->valid_bands[0], &hMdDec->base_band_age[0], num_bands_out, sba_order ); + ivas_spar_md_fill_invalid_bands( &hMdDec->spar_coeffs, &hMdDec->spar_coeffs_prev, &hMdDec->valid_bands[0], &hMdDec->base_band_age[0], num_bands_out, +#ifdef SPAR_TUNING + num_md_chs +#else + sba_order +#endif +#ifdef SPAR_TUNING + , + num_md_sub_frames +#endif + ); hMdDec->dtx_md_smoothing_cntr = 1; @@ -744,6 +1127,10 @@ void ivas_spar_md_dec_process( void ivas_spar_smooth_md_dtx( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out /* i : number of output bands */ +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames /* i : number of metadata subframes */ +#endif ) { int16_t j, k, b, dmx_ch; @@ -779,7 +1166,11 @@ void ivas_spar_smooth_md_dtx( } /* expand MD to all time slots */ +#ifdef SPAR_TUNING + for ( int16_t i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) +#else for ( int16_t i_ts = 1; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) +#endif { for ( b = 0; b < num_bands_out; b++ ) { @@ -819,6 +1210,10 @@ void ivas_spar_smooth_md_dtx( void ivas_spar_setup_md_smoothing( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out /* i : number of output bands */ +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames /* i : number of metadata subframes */ +#endif ) { /* copy the coeffs */ @@ -870,7 +1265,12 @@ void ivas_spar_setup_md_smoothing( } } - ivas_spar_smooth_md_dtx( hMdDec, num_bands_out ); + ivas_spar_smooth_md_dtx( hMdDec, num_bands_out +#ifdef SPAR_TUNING + , + num_md_sub_frames +#endif + ); return; } @@ -950,14 +1350,25 @@ static void ivas_get_spar_matrices( const int16_t bw, const int16_t dtx_vad, const int16_t nB, - const int16_t sba_order ) +#ifdef SPAR_TUNING + const int16_t numch_out, +#else + const int16_t sba_order, +#endif + const int16_t active_w_vlbr ) { +#ifndef SPAR_TUNING int16_t numch_out, num_bands, dmx_ch, split_band; +#else + int16_t num_bands, dmx_ch, split_band; +#endif int16_t i, j, k, m, b, i_ts, active_w; const int16_t *order; float active_w_dm_fac, re; +#ifndef SPAR_TUNING numch_out = ivas_sba_get_nchan_metadata( sba_order ); +#endif num_bands = num_bands_out; order = remix_order_set[hMdDec->spar_md_cfg.remix_unmix_order]; @@ -992,10 +1403,12 @@ static void ivas_get_spar_matrices( } }*/ #endif - + if ( bw == IVAS_RED_BAND_FACT ) + { + num_bands = num_bands >> 1; + } active_w = hMdDec->spar_md_cfg.active_w; - active_w_dm_fac = ( dtx_vad == 0 ) ? IVAS_ACTIVEW_DM_F_SCALE_DTX : IVAS_ACTIVEW_DM_F_SCALE; - + active_w_dm_fac = ( dtx_vad == 0 ) ? IVAS_ACTIVEW_DM_F_SCALE_DTX : ( ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR : IVAS_ACTIVEW_DM_F_SCALE ); for ( i_ts = 0; i_ts < n_ts; i_ts++ ) { for ( i = 0; i < numch_out; i++ ) @@ -1006,12 +1419,6 @@ static void ivas_get_spar_matrices( set_zero( &hMdDec->spar_coeffs.P_re[i][j][i_ts * IVAS_MAX_NUM_BANDS], IVAS_MAX_NUM_BANDS ); } } - - if ( bw == IVAS_RED_BAND_FACT ) - { - num_bands = num_bands >> 1; - } - num_bands = min( num_bands, nB ); for ( b = 0; b < num_bands; b++ ) @@ -1340,13 +1747,21 @@ void ivas_spar_dec_gen_umx_mat( const int16_t nchan_transport, /* i : number of transport channels */ const int16_t num_bands_out, /* i : number of output bands */ const int16_t bfi /* i : bad frame indicator */ +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames +#endif ) { int16_t i, j, b, i_ts, num_out_ch; num_out_ch = hMdDec->spar_md_cfg.num_umx_chs; +#ifdef SPAR_TUNING + for ( i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) +#else for ( i_ts = 0; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) +#endif { if ( hMdDec->td_decorr_flag == 1 ) { @@ -1407,7 +1822,12 @@ void ivas_spar_dec_gen_umx_mat( #endif } - ivas_spar_dec_compute_ramp_down_post_matrix( hMdDec, num_bands_out, bfi ); + ivas_spar_dec_compute_ramp_down_post_matrix( hMdDec, num_bands_out, bfi +#ifdef SPAR_TUNING + , + num_md_sub_frames +#endif + ); return; } @@ -1437,6 +1857,7 @@ static void ivas_spar_dec_parse_md_bs( int16_t do_diff[IVAS_MAX_NUM_BANDS]; int16_t planarCP; float quant[IVAS_SPAR_MAX_C_COEFF]; + int16_t do_repeat[IVAS_MAX_NUM_BANDS]; *dtx_vad = 1; *bands_bw = 1; @@ -1559,6 +1980,7 @@ static void ivas_spar_dec_parse_md_bs( for ( i = 0; i < *nB; i++ ) { do_diff[i] = 0; + do_repeat[i] = 0; } } else if ( strat < 4 ) @@ -1568,9 +1990,21 @@ static void ivas_spar_dec_parse_md_bs( for ( i = 0; i < *nB; i++ ) { do_diff[i] = 0; + do_repeat[i] = 0; } no_ec = 1; } + else if ( ivas_total_brate < IVAS_24k4 ) + { + *bands_bw = 2; + *nB = num_bands / *bands_bw; + + for ( i = 0; i < *nB; i++ ) + { + do_diff[i] = 0; + do_repeat[i] = ( ( strat % 2 ) == ( ( i + 1 ) % 2 ) ); + } + } else { *bands_bw = 1; @@ -1579,6 +2013,7 @@ static void ivas_spar_dec_parse_md_bs( for ( i = 0; i < *nB; i++ ) { do_diff[i] = ( ( ( i + 1 ) & 3 ) != strat - 4 ); + do_repeat[i] = 0; } ivas_map_prior_coeffs_quant( &hMdDec->spar_md_prev, &hMdDec->spar_md_cfg, qsi, *nB ); @@ -1590,7 +2025,8 @@ static void ivas_spar_dec_parse_md_bs( if ( no_ec == 0 ) { - ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, planarCP ); + ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, freq_diff, planarCP, + strat, ivas_total_brate ); } else { @@ -1641,9 +2077,12 @@ static void ivas_spar_dec_parse_md_bs( { hMdDec->spar_md_prev.band_coeffs_idx[i].decd_index_re[j] = hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j]; } - hMdDec->valid_bands[i] |= ( do_diff[i] == 0 ) ? 1 : 0; + hMdDec->valid_bands[*bands_bw * i] |= ( do_diff[i] == 0 && do_repeat[i] == 0 ) ? 1 : 0; + for ( j = 1; j < *bands_bw; j++ ) + { + hMdDec->valid_bands[*bands_bw * i + j] = hMdDec->valid_bands[*bands_bw * i]; + } } - #ifdef SPAR_HOA_DBG int16_t b; b = 0; @@ -1734,9 +2173,12 @@ static void ivas_decode_arith_bs( const int16_t bands_bw, int16_t *pDo_diff, const int16_t freq_diff, - const int16_t planarCP ) + const int16_t planarCP, + const int16_t strat, + const int32_t ivas_total_brate ) { - int16_t i, j, ndm, ndec; + int16_t i, ndm, ndec; + int16_t j; ivas_cell_dim_t pred_cell_dims[IVAS_MAX_NUM_BANDS]; ivas_cell_dim_t drct_cell_dims[IVAS_MAX_NUM_BANDS]; ivas_cell_dim_t decd_cell_dims[IVAS_MAX_NUM_BANDS]; @@ -1749,22 +2191,39 @@ static void ivas_decode_arith_bs( { ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[bands_bw * i]; ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bands_bw * i]; - - pred_cell_dims[i].dim1 = ndm + ndec - 1; - if ( hMdDec->spar_hoa_md_flag ) + if ( ( ivas_total_brate < IVAS_24k4 ) && ( strat > 3 ) && ( ( ( i % 2 == 1 ) && ( strat % 2 == 0 ) ) || ( ( i % 2 == 0 ) && ( strat % 2 == 1 ) ) ) ) { - if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) + pred_cell_dims[i].dim1 = 0; + pred_cell_dims[i].dim2 = 0; + drct_cell_dims[i].dim1 = 0; + drct_cell_dims[i].dim2 = 0; + decd_cell_dims[i].dim1 = 0; + decd_cell_dims[i].dim2 = 0; + decx_cell_dims[i].dim1 = 0; + decx_cell_dims[i].dim2 = 0; + } + else + { + pred_cell_dims[i].dim1 = ndm + ndec - 1; + if ( hMdDec->spar_hoa_md_flag +#ifdef SPAR_TUNING + && hMdDec->spar_hoa_dirac2spar_md_flag +#endif + ) { - pred_cell_dims[i].dim1 -= ( FOA_CHANNELS - 1 ); + if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) + { + pred_cell_dims[i].dim1 -= ( FOA_CHANNELS - 1 ); + } } + pred_cell_dims[i].dim2 = 1; + drct_cell_dims[i].dim1 = ndec; + drct_cell_dims[i].dim2 = ndm - 1; + decd_cell_dims[i].dim1 = ndec; + decd_cell_dims[i].dim2 = 1; + decx_cell_dims[i].dim1 = ( ndec * ( ndec - 1 ) ) >> 1; + decx_cell_dims[i].dim2 = 1; } - pred_cell_dims[i].dim2 = 1; - drct_cell_dims[i].dim1 = ndec; - drct_cell_dims[i].dim2 = ndm - 1; - decd_cell_dims[i].dim1 = ndec; - decd_cell_dims[i].dim2 = 1; - decx_cell_dims[i].dim1 = ( ndec * ( ndec - 1 ) ) >> 1; - decx_cell_dims[i].dim2 = 1; } any_diff = 0; @@ -1779,7 +2238,11 @@ static void ivas_decode_arith_bs( if ( any_diff == 1 ) { +#ifdef SPAR_TUNING + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) +#else if ( hMdDec->spar_hoa_md_flag ) +#endif { for ( i = 0; i < nB; i++ ) { @@ -1801,7 +2264,11 @@ static void ivas_decode_arith_bs( ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, pred_cell_dims, PRED_COEFF, planarCP ); +#ifdef SPAR_TUNING + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) +#else if ( hMdDec->spar_hoa_md_flag ) +#endif { for ( i = 0; i < nB; i++ ) { @@ -1873,7 +2340,6 @@ static void ivas_decode_arith_bs( ivas_get_band_idx_from_differential( &hMdDec->spar_md, hMdDec->spar_md_cfg.quant_strat->P_r.q_levels, 1, nB, DECD_COEFF ); ivas_get_band_idx_from_differential( &hMdDec->spar_md, hMdDec->spar_md_cfg.quant_strat->P_c.q_levels, 0, nB, DECX_COEFF ); } - return; } @@ -2067,7 +2533,11 @@ static void ivas_decode_huffman_bs( drct_dim = ndec * ( ndm - 1 ); decd_dim = ndec; pred_offset = 0; +#ifdef SPAR_TUNING + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) +#else if ( hMdDec->spar_hoa_md_flag ) +#endif { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { @@ -2077,10 +2547,15 @@ static void ivas_decode_huffman_bs( for ( j = pred_offset; j < pred_dim; j++ ) { - ivas_huffman_decode( &hMdDec->huff_coeffs.pred_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] ); + ivas_huffman_decode( &hMdDec->huff_coeffs.pred_huff_re[qsi], st0, + &hMdDec->spar_md.band_coeffs_idx[i].pred_index_re[j] ); } +#ifdef SPAR_TUNING + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) +#else if ( hMdDec->spar_hoa_md_flag ) +#endif { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { @@ -2133,16 +2608,26 @@ static void ivas_spar_md_fill_invalid_bands( const int16_t *valid_bands, int16_t *base_band_age, const int16_t num_bands, - const int16_t sba_order /* i : SBA order */ +#ifdef SPAR_TUNING + const int16_t num_channels +#else + const int16_t sba_order +#endif +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames +#endif ) { int16_t i, j, b, all_valid; int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], idx = -1; int16_t last_valid_band_idx[IVAS_MAX_NUM_BANDS]; float w = 0; +#ifndef SPAR_TUNING int16_t num_channels; num_channels = ivas_sba_get_nchan_metadata( sba_order ); +#endif set_s( valid_band_idx, 0, IVAS_MAX_NUM_BANDS ); set_s( last_valid_band_idx, 0, IVAS_MAX_NUM_BANDS ); @@ -2229,7 +2714,11 @@ static void ivas_spar_md_fill_invalid_bands( { for ( j = 0; j < num_channels; j++ ) { +#ifdef SPAR_TUNING + for ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ ) +#else for ( i_ts = 1; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) +#endif { pSpar_coeffs->C_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = pSpar_coeffs->C_re[i][j][b]; pSpar_coeffs->P_re[i][j][b + i_ts * IVAS_MAX_NUM_BANDS] = pSpar_coeffs->P_re[i][j][b]; @@ -2253,7 +2742,12 @@ static void ivas_spar_md_fill_invalid_bands( static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands_out, - const int16_t bfi ) + const int16_t bfi +#ifdef SPAR_TUNING + , + const int16_t num_md_sub_frames +#endif +) { int16_t num_in_ch, num_out_ch, i, j, b; @@ -2292,7 +2786,11 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix( } /* apply the post matrix */ +#ifdef SPAR_TUNING + for ( int16_t i_ts = 0; i_ts < num_md_sub_frames; i_ts++ ) +#else for ( int16_t i_ts = 0; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ ) +#endif { for ( i = 0; i < num_out_ch; i++ ) { @@ -2529,6 +3027,8 @@ void ivas_spar_to_dirac( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t dtx_vad, /* i : DTX frame flag */ const int16_t num_bands_out /* i : number of output bands */ + , + const int16_t bw /* i : band joining factor */ ) { DIRAC_DEC_HANDLE hDirAC; @@ -2554,16 +3054,22 @@ void ivas_spar_to_dirac( int16_t pred_idx; int16_t *dirac_to_spar_md_bands; int16_t enc_param_start_band; + int16_t active_w_vlbr; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); start_band = 0; - end_band = min( num_bands_out, SPAR_DIRAC_SPLIT_START_BAND ); + end_band = min( num_bands_out, SPAR_DIRAC_SPLIT_START_BAND ) / bw; hDirAC = st_ivas->hDirAC; dirac_to_spar_md_bands = st_ivas->hSpar->dirac_to_spar_md_bands; - enc_param_start_band = st_ivas->hSpar->enc_param_start_band; + enc_param_start_band = st_ivas->hSpar->enc_param_start_band / bw; + active_w_vlbr = ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 ) ? 1 : 0; - if ( hDirAC != NULL ) + if ( hDirAC != NULL +#ifdef HODIRAC + && ( st_ivas->sba_analysis_order <= 1 || st_ivas->hDecoderConfig->ivas_total_brate <= IVAS_256k ) +#endif + ) { band_grouping = hDirAC->band_grouping; #ifdef ENABLE_DITHER @@ -2610,7 +3116,7 @@ void ivas_spar_to_dirac( } else { - f_scale = IVAS_ACTIVEW_DM_F_SCALE; + f_scale = ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR : IVAS_ACTIVEW_DM_F_SCALE; } } else @@ -2659,7 +3165,11 @@ void ivas_spar_to_dirac( qmf_band_start = band_grouping[band]; qmf_band_end = band_grouping[band + 1]; +#ifdef JBM_TSM_ON_TCS + for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) +#else for ( block = 0; block < hDirAC->nb_subframes; block++ ) +#endif { int16_t ts_start, ts_end, ts; @@ -2681,6 +3191,7 @@ void ivas_spar_to_dirac( hDirAC->energy_ratio1[block][b] = en_ratio; tmp_write_idx_band = tmp_write_idx_param_band; + if ( hDirAC->hConfig->dec_param_estim == FALSE ) { hDirAC->elevation[tmp_write_idx_band][b] = ele_dith; @@ -2718,13 +3229,20 @@ void ivas_spar_to_dirac( } /*read DirAC metadata, convert DirAC to SPAR*/ - for ( ; band < num_bands_out; band++ ) + for ( ; band < num_bands_out / bw; band++ ) { int16_t dirac_band_idx; dirac_band_idx = dirac_to_spar_md_bands[band] - enc_param_start_band; - for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + int16_t num_subframes; + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + if ( st_ivas->hQMetaData->useLowerRes ) + { + num_subframes = 1; + } + + for ( block = 0; block < num_subframes; block++ ) { if ( st_ivas->hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[block] < 0.f ) { @@ -2740,7 +3258,8 @@ void ivas_spar_to_dirac( /* DirAC MD averaged over 4 subframes and converted to SPAR format similar to encoder processing */ if ( hMdDec->spar_md_cfg.nchan_transport > 1 ) { - ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL ); + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, + st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); /* temporarily copy frame-wise prediction coefficients in DirAC bands*/ for ( pred_idx = 0; pred_idx < FOA_CHANNELS - 1; pred_idx++ ) @@ -2751,9 +3270,32 @@ void ivas_spar_to_dirac( } } } + int16_t num_subframes; + num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; + if ( st_ivas->hQMetaData->useLowerRes ) + { + num_subframes = 1; + } + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, num_subframes, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, + end_band, num_bands_out / bw, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL, st_ivas->hQMetaData->useLowerRes, active_w_vlbr ); - ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, MAX_PARAM_SPATIAL_SUBFRAMES, NULL, &hMdDec->spar_md, &hMdDec->spar_md_cfg, end_band, num_bands_out, ( hMdDec->spar_hoa_md_flag ) ? 1 : sba_order_internal, dtx_vad, NULL ); - + if ( st_ivas->hQMetaData->useLowerRes && dtx_vad ) + { + for ( band = SPAR_DIRAC_SPLIT_START_BAND; band < IVAS_MAX_NUM_BANDS; band++ ) + { + for ( block = 1; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) + { + for ( int16_t i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ + { + hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].pred_re[i] = hMdDec->spar_md.band_coeffs[band].pred_re[i]; + } + for ( int16_t i = 0; i < FOA_CHANNELS - 1; i++ ) /* pred coefficient index (index 0, 1, 2 predicts Y, Z, X respectively) */ + { + hMdDec->spar_md.band_coeffs[band + block * IVAS_MAX_NUM_BANDS].P_re[i] = hMdDec->spar_md.band_coeffs[band].P_re[i]; + } + } + } + } /* expand DirAC TC 20ms MD for residual channels to all subframes*/ for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) { @@ -2770,7 +3312,7 @@ void ivas_spar_to_dirac( } } - for ( b = end_band; b < num_bands_out; b++ ) + for ( b = end_band * bw; b < num_bands_out; b++ ) { hMdDec->valid_bands[b] = 1; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h old mode 100644 new mode 100755 index dab905865d922a5663f0a4637d63f538069020ae..cc7e31f9a6f0b989faa4024bcae16733674d0f6a --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -36,40 +36,10 @@ #include #include "options.h" #include "cnst.h" -#include "stat_dec.h" #include "ivas_cnst.h" +#include "stat_dec.h" #include "ivas_stat_com.h" #include "ivas_stat_rend.h" -#ifndef FIX_197_CREND_INTERFACE -#include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think -#endif - -#ifndef FIX_197_CREND_INTERFACE - -/*----------------------------------------------------------------------------------* - * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) - *----------------------------------------------------------------------------------*/ - -typedef struct ivas_output_setup_structure -{ - AUDIO_CONFIG output_config; - int16_t nchan_out_woLFE; /* number of output audio channels without LFE */ - int16_t ambisonics_order; - int8_t is_loudspeaker_setup; - int8_t is_planar_setup; - int8_t is_binaural_setup; - - int16_t num_lfe; - int16_t index_lfe[1]; - const float *ls_azimuth; - const float *ls_elevation; - - uint8_t separateChannelEnabled; - int16_t separateChannelIndex; - -} IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; - -#endif /*----------------------------------------------------------------------------------* * DFT Stereo decoder structure *----------------------------------------------------------------------------------*/ @@ -230,6 +200,12 @@ typedef struct stereo_dft_dec_data_struct float smooth_buf[SBA_DIRAC_STEREO_NUM_BANDS][SBA_DIRAC_NRG_SMOOTH_LONG + 1]; float smooth_fac[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; + int16_t first_frame; + float mixer_mat_smooth[2][4][2 * IVAS_MAX_NUM_BANDS]; + float g_L_prev; + float g_R_prev; + const float *max_smooth_gains, *min_smooth_gains; + } STEREO_DFT_DEC_DATA, *STEREO_DFT_DEC_DATA_HANDLE; @@ -406,6 +382,19 @@ typedef struct stereo_icbwe_dec_data_structure } STEREO_ICBWE_DEC_DATA, *STEREO_ICBWE_DEC_HANDLE; +/*----------------------------------------------------------------------------------* + * ISM DTX structure + *----------------------------------------------------------------------------------*/ + +typedef struct +{ + int16_t dtx_flag; + int16_t sce_id_dtx; + + int16_t ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ + +} ISM_DTX_DATA_DEC; + /*----------------------------------------------------------------------------------* * DirAC decoder structure *----------------------------------------------------------------------------------*/ @@ -446,7 +435,11 @@ typedef struct param_ism_rendering float *proto_matrix; float *interpolator; float mixing_matrix_lin_old[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX]; - +#ifdef JBM_TSM_ON_TCS + float mixing_matrix_lin[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX]; + float *Cldfb_RealBuffer_tc; + float *Cldfb_ImagBuffer_tc; +#endif } PARAM_ISM_RENDERING_DATA, *PARAM_ISM_RENDERING_HANDLE; @@ -582,10 +575,13 @@ typedef struct dirac_output_synthesis_cov_state_structure float *cy_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res_old[CLDFB_NO_CHANNELS_MAX]; +#ifdef JBM_TSM_ON_TCS + float *mixing_matrix[CLDFB_NO_CHANNELS_MAX]; + float *mixing_matrix_res[CLDFB_NO_CHANNELS_MAX]; +#endif } DIRAC_OUTPUT_SYNTHESIS_COV_STATE; - /* MASA stereo transport signal type detection structure */ typedef struct { @@ -623,9 +619,15 @@ typedef struct /* Diffuse sound directional distribution data structure */ typedef struct ivas_diffuse_distribution_data_structure { +#ifdef JBM_TSM_ON_TCS + float diffuseRatioX[CLDFB_NO_CHANNELS_MAX]; + float diffuseRatioY[CLDFB_NO_CHANNELS_MAX]; + float diffuseRatioZ[CLDFB_NO_CHANNELS_MAX]; +#else float diffuseRatioX[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float diffuseRatioY[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float diffuseRatioZ[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; +#endif } DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; @@ -637,7 +639,15 @@ typedef struct ivas_dirac_dec_data_structure IVAS_OUTPUT_SETUP hOutSetup; int16_t slot_size; +#ifdef JBM_TSM_ON_TCS + int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; + int16_t subframes_rendered; + int16_t slots_rendered; + int16_t num_slots; + int16_t render_to_md_map[MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME]; +#else int16_t subframe_nbslots; +#endif int16_t nb_subframes; int16_t num_freq_bands; @@ -722,6 +732,9 @@ typedef struct ivas_dirac_dec_data_structure PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; IVAS_FB_MIXER_HANDLE hFbMdft; int16_t dirac_to_spar_md_bands[DIRAC_MAX_NBANDS]; +#ifdef SPAR_TUNING + const int16_t *sba_map_tc; +#endif } DIRAC_DEC_DATA, *DIRAC_DEC_HANDLE; @@ -745,7 +758,17 @@ typedef struct ivas_param_mc_dec_data_structure { int16_t slot_size; +#ifdef JBM_TSM_ON_TCS + float *Cldfb_RealBuffer_tc; + float *Cldfb_ImagBuffer_tc; + int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; + int16_t nb_subframes; + int16_t subframes_rendered; + int16_t slots_rendered; + int16_t num_slots; +#else int16_t subframe_nbslots; +#endif int16_t num_freq_bands; int16_t num_param_bands_synth; @@ -782,7 +805,27 @@ typedef struct ivas_param_mc_dec_data_structure } PARAM_MC_DEC_DATA, *PARAM_MC_DEC_HANDLE; +#ifdef MC_PARAMUPMIX_MODE +/*----------------------------------------------------------------------------------* + * MC Param-Upmix Mode structures + *----------------------------------------------------------------------------------*/ +/* ===== MC Param-Upmix Mode main structure ===== */ +typedef struct ivas_mc_paramupmix_dec_data_structure +{ + int16_t num_freq_bands; + ivas_td_decorr_state_t *hTdDecorr[MC_PARAMUPMIX_COMBINATIONS]; + float alphas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + float betas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + float alpha_prev[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + float beta_prev[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + int32_t alpha_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + int32_t beta_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + bool first_frame; + float *pcm_delay[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS]; + +} MC_PARAMUPMIX_DEC_DATA, *MC_PARAMUPMIX_DEC_HANDLE; +#endif /*------------------------------------------------------------------------------------------* * SPAR decoder structures *------------------------------------------------------------------------------------------*/ @@ -818,9 +861,21 @@ typedef struct ivas_spar_md_dec_state_t int16_t table_idx; int16_t dtx_vad; int16_t spar_hoa_md_flag; +#ifdef SPAR_TUNING + int16_t spar_hoa_dirac2spar_md_flag; + int16_t HOA_md_ind[IVAS_SPAR_MAX_CH]; +#endif +#ifdef LBR_ADAP_SMOOTHING_OPT + float smooth_buf[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; + float smooth_fac[IVAS_MAX_NUM_BANDS]; +#else + float smooth_buf[IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1]; + float smooth_fac[IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; +#endif + float mixer_mat_prev2[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; + } ivas_spar_md_dec_state_t; -#ifndef FIX_197_CREND_INTERFACE /* AGC structure */ typedef struct ivas_agc_dec_chan_state_t @@ -838,30 +893,6 @@ typedef struct ivas_agc_dec_state_t } ivas_agc_dec_state_t; -/* TD decorr */ -typedef struct ivas_td_decorr_APD_filt_state_t -{ - int16_t order[IVAS_MAX_DECORR_APD_SECTIONS]; - int16_t idx[IVAS_MAX_DECORR_APD_SECTIONS]; - float coeffs[IVAS_MAX_DECORR_APD_SECTIONS]; - float *state[IVAS_MAX_DECORR_APD_SECTIONS]; - -} ivas_td_decorr_APD_filt_state_t; - -typedef struct ivas_td_decorr_state_t -{ - ivas_trans_det_state_t *pTrans_det; - float *look_ahead_buf; - ivas_td_decorr_APD_filt_state_t APD_filt_state[IVAS_MAX_DECORR_CHS]; - - int16_t num_apd_outputs; - int16_t num_apd_sections; - int16_t ducking_flag; - -} ivas_td_decorr_state_t; - -#endif - /* PCA structure */ typedef struct { @@ -893,6 +924,14 @@ typedef struct ivas_spar_dec_lib_t int16_t numOutChannels; int16_t pca_ingest_channels; #endif +#ifdef JBM_TSM_ON_TCS + int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; + int16_t render_to_md_map[MAX_JBM_CLDFB_TIMESLOTS]; + int16_t nb_subframes; + int16_t subframes_rendered; + int16_t slots_rendered; + int16_t num_slots; +#endif } SPAR_DEC_DATA, *SPAR_DEC_HANDLE; @@ -986,90 +1025,37 @@ typedef struct mct_dec_data_structure MCT_DEC_BLOCK_DATA_HANDLE hBlockData[MCT_MAX_BLOCKS]; int16_t chBitRatios[MCT_MAX_CHANNELS]; - int16_t lowE_ch[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ - int16_t LFE_off; + int16_t lowE_ch[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ uint16_t mc_global_ild[MCT_MAX_CHANNELS]; /* note: pointer to local parameter */ - int16_t num_lfe; - } MCT_DEC_DATA, *MCT_DEC_HANDLE; -#ifndef FIX_197_CREND_INTERFACE /*----------------------------------------------------------------------------------* - * EFAP structures + * LFE decoder structure *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -typedef struct EFAP_VERTEX -{ - float azi; /* azimuth of the loudspeaker */ - float ele; /* elevation of the loudspeaker */ - float pos[3]; /* [x y z] cartesian coordinate vector */ - int16_t idx; /* integer, that corresponds to the first index for the LS in the 1D output */ - int16_t isNaN; /* used to indicate if the vertex is a virtual speaker */ - EFAP_VTX_DMX_TYPE dmxType; /* virtual speaker downmix type */ - -} EFAP_VERTEX; - -typedef struct EFAP_VERTEX_DATA -{ - EFAP_VERTEX *vertexArray; /* Array of vertices */ - int16_t numVtx; /* Number of vertices */ - int16_t *vtxOrder; /* Array that indicates the order of the vertex ranked by increasing azimuth */ - -} EFAP_VERTEX_DATA; - -typedef struct EFAP_POLYSET -{ - int16_t chan[EFAP_MAX_CHAN_NUM]; /* An array indicating the loudspeaker index of the polygon vertices */ - int16_t isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN */ - int16_t numChan; /* An integer between 0 and EFAP_MAX_CHAN_NUM corresponding to the number of vertices of the polygon */ - float polyAzi[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the azimuth of the channels */ - float polyEle[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the elevation of the channels */ -} EFAP_POLYSET; - -typedef struct EFAP_LS_TRIANGLE -{ - int16_t LS[3]; /* Array indicating the loudspeaker index of the triangle vertices */ - -} EFAP_LS_TRIANGLE; - -typedef struct EFAP_POLYSET_DATA +typedef struct ivas_lfe_dec_data_structure { - EFAP_POLYSET polysetArray[EFAP_MAX_POLY_SET]; /* Array of polygons */ - int16_t numPoly; /* Number of polygons */ - EFAP_LS_TRIANGLE triArray[EFAP_MAX_POLY_SET]; /* Array of triangles */ - int16_t numTri; /* Number of triangles */ - -} EFAP_POLYSET_DATA; + ivas_filters_process_state_t filter_state; + LFE_WINDOW_HANDLE pWindow_state; + const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; + int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; + float lfe_block_delay_s; + int16_t lfe_prior_buf_len; + float prior_out_buffer[L_FRAME48k]; -typedef struct EFAP -{ - int16_t numSpk; /* Number of loudspeakers */ - float *aziSpk; /* Loudspeaker azimuths */ - float *eleSpk; /* Loudspeaker elevations */ - EFAP_VERTEX_DATA vtxData; /* Vertex Data, contains all the data concerning the vertex */ - EFAP_POLYSET_DATA polyData; /* Polygon data */ - float **dmTranspose; /* Downmix Matrix used for redistributing the energy of ghosts LS and its transpose */ - float *bufferLong; /* tmp buffer that will be given as a parameter for computing the gain; this is a 1D array of length numVtx */ - float *bufferShort; /* tmp buffer that will be given as a parameter for computing the gain; this is the result of downMixMatrix*bufferLong, length is numSpk */ - int16_t numTot; /* Total number of real + ghost loudspeakers, used later for freeing memory */ + float prevsynth_buf[LFE_PLC_BUFLEN]; + float *lfe_delay_buf; + int16_t lfe_addl_delay; + int16_t bfi_count; -} EFAP, *EFAP_HANDLE; +} LFE_DEC_DATA, *LFE_DEC_HANDLE; +// Note: the following structures are used only in lib_dec but this would likely change in the future /*----------------------------------------------------------------------------------* * VBAP structures *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -enum SpeakerNodeGroup -{ - SPEAKER_NODE_BOTTOM_HALF, - SPEAKER_NODE_HORIZONTAL, - SPEAKER_NODE_TOP_HALF, - SPEAKER_NODE_BACK, - SPEAKER_NODE_ALL -}; /* Defines a single virtual surface triplet of loudspeakers * with a precalculated inverse matrix */ @@ -1080,15 +1066,6 @@ typedef struct vbap_vs_triplet_structure } VBAP_VS_TRIPLET; -/* Defines a single speaker node */ -typedef struct vbap_speaker_node_structure -{ - float azi_deg; - float ele_deg; - float unit_vec[3]; - enum SpeakerNodeGroup group; - -} VBAP_SPEAKER_NODE; /* Storage structure for fast runtime triplet search */ typedef struct triplet_search_structure @@ -1099,6 +1076,7 @@ typedef struct triplet_search_structure } VBAP_SEARCH_STRUCT; + /* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */ typedef struct vbap_data_structure { @@ -1119,15 +1097,45 @@ typedef struct vbap_data_structure /*----------------------------------------------------------------------------------* * renderer structures *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? + typedef struct renderer_struct { float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS]; +#ifdef JBM_TSM_ON_TCS + float *interpolator; + float gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS]; +#else float interpolator[L_FRAME48k]; +#endif } ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; -#endif + +/* Fastconv binaural data structure */ +typedef struct ivas_binaural_rendering_struct +{ + /* Common variables for all modules */ + IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/ + EFAP_HANDLE hEFAPdata; /* EFAP structure*/ + float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ + int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ + int16_t max_band; /* band upto which rendering is performed */ + int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ + int16_t timeSlots; /* number of time slots of binaural renderer */ + int16_t nInChannels; /* number input channels */ + int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ + IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ + + /* Convolution module structure */ + BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; + + /* Variables related to reverberator module */ + float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; + REVERB_STRUCT_HANDLE hReverb; + +} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; + + /*----------------------------------------------------------------------------------* * MASA decoder structures *----------------------------------------------------------------------------------*/ @@ -1165,11 +1173,25 @@ typedef struct ivas_mcmasa_lfe_synth_struct } MCMASA_LFE_SYNTH_DATA, *MCMASA_LFE_SYNTH_DATA_HANDLE; +typedef struct ivas_masa_decoder_ext_out_meta_struct +{ + MASA_DECRIPTIVE_META descriptiveMeta; + + uint16_t directionIndex[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + uint8_t directToTotalRatio[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + uint8_t spreadCoherence[MASA_MAXIMUM_DIRECTIONS][MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + + uint8_t surroundCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + uint8_t diffuseToTotalRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; + +} MASA_DECODER_EXT_OUT_META; + typedef struct ivas_masa_decoder_data_struct { int16_t band_mapping[MASA_FREQUENCY_BANDS + 1]; SPHERICAL_GRID_DATA *sph_grid16; + MASA_DECODER_EXT_OUT_META *extOutMeta; float dir_decode_quality; } MASA_DECODER_DATA; @@ -1182,687 +1204,6 @@ typedef struct ivas_masa_decoder_struct } MASA_DECODER, *MASA_DECODER_HANDLE; -#ifndef FIX_197_CREND_INTERFACE - -/*----------------------------------------------------------------------------------* - * Binaural Rendering structure - *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -/* Binaural reverberator structure */ -typedef struct ivas_binaural_reverb_struct -{ - float *loopBufReal[CLDFB_NO_CHANNELS_MAX]; - float *loopBufImag[CLDFB_NO_CHANNELS_MAX]; - float preDelayBufferReal[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; - float preDelayBufferImag[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; - float **tapPointersReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - float **tapPointersImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - - float binauralCoherenceCrossmixGains[CLDFB_NO_CHANNELS_MAX]; - float binauralCoherenceDirectGains[CLDFB_NO_CHANNELS_MAX]; - float reverbEqGains[CLDFB_NO_CHANNELS_MAX]; - float loopAttenuationFactor[CLDFB_NO_CHANNELS_MAX]; - - float *outputBufferReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - float *outputBufferImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - - int16_t numBins; - - int16_t useBinauralCoherence; - int16_t loopBufLength[CLDFB_NO_CHANNELS_MAX]; - int16_t loopBufLengthMax[CLDFB_NO_CHANNELS_MAX]; - int16_t preDelayBufferIndex; - int16_t preDelayBufferLength; - - int16_t taps[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - int16_t *tapPhaseShiftType[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - - int16_t blockSize; - uint32_t binRend_RandNext; - int16_t highestBinauralCoherenceBin; - - float dmxmtx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; - float foa_enc[MAX_OUTPUT_CHANNELS][FOA_CHANNELS]; - -} REVERB_STRUCT, *REVERB_STRUCT_HANDLE; - -/* Parametric binaural data structure */ -typedef struct ivas_dirac_dec_binaural_data_structure -{ - float ChEnePrev[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float ChCrossRePrev[CLDFB_NO_CHANNELS_MAX]; - float ChCrossImPrev[CLDFB_NO_CHANNELS_MAX]; - float ChEne[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float ChCrossRe[CLDFB_NO_CHANNELS_MAX]; - float ChCrossIm[CLDFB_NO_CHANNELS_MAX]; - float ChEneOutPrev[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float ChCrossReOutPrev[CLDFB_NO_CHANNELS_MAX]; - float ChCrossImOutPrev[CLDFB_NO_CHANNELS_MAX]; - float ChEneOut[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float ChCrossReOut[CLDFB_NO_CHANNELS_MAX]; - float ChCrossImOut[CLDFB_NO_CHANNELS_MAX]; - float processMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; /* +1 refers to SeparateChannel */ - float processMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; - float processMtxDecRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float processMtxDecIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float diffuseFieldCoherence[CLDFB_NO_CHANNELS_MAX]; - float diffuseFieldCoherenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS]; - float diffuseFieldCoherenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS]; - float diffuseFieldCoherenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS]; - float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; - REVERB_STRUCT_HANDLE hReverb; - uint8_t renderStereoOutputInsteadOfBinaural; - float frameMeanDiffuseness[CLDFB_NO_CHANNELS_MAX]; - float processMtxRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; - float processMtxImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; - float processMtxDecRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float processMtxDecImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ - uint16_t useTdDecorr; - ivas_td_decorr_state_t *hTdDecorr; - -} DIRAC_DEC_BIN_DATA, *DIRAC_DEC_BIN_HANDLE; - -typedef struct ivas_binaural_rendering_conv_module_struct -{ - float ***filterTapsLeftReal; - float ***filterTapsLeftImag; - float ***filterTapsRightReal; - float ***filterTapsRightImag; - - float ***filterStatesLeftReal; - float ***filterStatesLeftImag; - - int16_t numTapsArray[BINAURAL_CONVBANDS]; - int16_t numTaps; - -} BINRENDERER_CONV_MODULE, *BINRENDERER_CONV_MODULE_HANDLE; - -/* Fastconv binaural data structure */ - -#ifdef HRTF_BINARY_FILE -typedef struct ivas_hrtfs_fastconv_struct -{ - float FASTCONV_HRIR_latency_s; - float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; - float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; - float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; - float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; - - float FASTCONV_HOA3_latency_s; - float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; - float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; - float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; - float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; - - float FASTCONV_BRIR_latency_s; - float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; - float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; - float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; - float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; - - float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; - float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; -} HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; - -#endif - -#ifdef HRTF_BINARY_FILE -typedef struct ivas_hrtfs_parambin_struct -{ - float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; - float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; - - float parametricReverberationTimes[CLDFB_NO_CHANNELS_MAX]; - float parametricReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; - float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; -} HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; - -#endif - -typedef struct ivas_binaural_rendering_struct -{ - /* Common variables for all modules */ - IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/ - EFAP_HANDLE hEFAPdata; /* EFAP structure*/ - float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ - int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ - int16_t max_band; /* band upto which rendering is performed */ - int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ - int16_t timeSlots; /* number of time slots of binaural renderer */ - int16_t nInChannels; /* number input channels */ - int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ - IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ - - /* Convolution module structure */ - BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; - - /* Variables related to reverb module */ - float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; - REVERB_STRUCT_HANDLE hReverb; - -} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; - - -/*----------------------------------------------------------------------------------* - * Head tracking data structure - *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? - -typedef struct ivas_binaural_head_track_struct -{ - int16_t num_quaternions; - IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; - float Rmat[3][3]; - float Rmat_prev[3][3]; - - uint8_t lrSwitchedNext; - uint8_t lrSwitchedCurrent; - float lrSwitchInterpVal; - - int16_t shd_rot_max_order; - -} HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; - - -/*----------------------------------------------------------------------------------* - * TD ISm Object Renderer structure - *----------------------------------------------------------------------------------*/ - - -typedef struct -{ - int16_t modelROM; /* Flag that indicates that the model resides in ROM (controls init/dealloc). */ - int16_t UseItdModel; /* Controls whether ITD model is used. */ - int16_t SplineDegree; /* Degree of the spline functions */ - int16_t K; /* Length of filter */ - int16_t elevDim2; - int16_t elevDim3; - int16_t AlphaN; /* Number of rows in Alpha matrices */ - int16_t num_unique_azim_splines; - int16_t elevSegSamples; - - int16_t elevBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - int16_t elevBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - const int16_t *azimDim2; - const int16_t *azimDim3; - const int16_t *azim_start_idx; - const int16_t *azimSegSamples; - const int16_t *azimShapeIdx; - const int16_t *azimShapeSampFactor; - - const float *elevKSeq; /* Array, N x elevDim2 x elevDim3 */ - const float *AlphaL; /* Array, size AlphaN x K */ - const float *AlphaR; /* Array, size AlphaN x K */ - const float *elevBsShape; - float **azimKSeq; /* Array, length azimDim3+1 */ - const float **azimBsShape; - - int16_t azimDim3Max; - int16_t iSecFirst[HRTF_MODEL_N_SECTIONS]; /* Indices for start of sections */ - int16_t iSecLast[HRTF_MODEL_N_SECTIONS]; /* Indices for end of sections */ - const float *EL; /* Array, size (AlphaN*HRTF_MODEL_N_SECTIONS) */ - const float *ER; /* Array, size (AlphaN*HRTF_MODEL_N_SECTIONS) */ - - /* Pointers for allocation of dynamic memory */ - float *AlphaL_dyn; - float *AlphaR_dyn; - float *EL_dyn; - float *ER_dyn; - float *elevBsShape_dyn; - float *elevKSeq_dyn; - int16_t *azimDim2_dyn; - int16_t *azimDim3_dyn; - int16_t *azim_start_idx_dyn; - int16_t *azimSegSamples_dyn; - int16_t *azimShapeIdx_dyn; - int16_t *azimShapeSampFactor_dyn; - float **azimBsShape_dyn; - -} ModelParams_t; - -typedef struct -{ - int16_t N; /* Polynomial degree */ - - int16_t elevDim2; - int16_t elevDim3; - const float *elevKSeq; /* Array, length elevDim3-2 */ - int16_t azimDim2; - int16_t azimDim3; - const float *azimKSeq; /* Array, length azimDim3-2 */ - const float *W; /* Array, size (elevDim3*azimDim3) x K */ - - int16_t azimBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - int16_t azimBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - const float *azimBsShape; - int16_t azimSegSamples; - - int16_t elevBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - int16_t elevBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - const float *elevBsShape; - int16_t elevSegSamples; - float resamp_factor; - - /* Pointers for allocation of dynamic memory */ - float *elevKSeq_dyn; - float *azimKSeq_dyn; - float *W_dyn; - float *azimBsShape_dyn; - float *elevBsShape_dyn; - -} ModelParamsITD_t; - -typedef struct -{ - float val; - int16_t i; - -} ValueIndex_t; - -/* Shared memory for use when evaluating BSpline HR filter model*/ -typedef struct -{ - float BM[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - ValueIndex_t BMEnergiesL[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - ValueIndex_t BMEnergiesR[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - int16_t UseIndsL[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - int16_t UseIndsR[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - float *hrfModL; - float *hrfModR; - float elevBfVec[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - float azimBfVec[HRTF_MODEL_BSPLINE_NUM_COEFFS][HRTF_MODEL_BSPLINE_NUM_COEFFS]; - float BM_ITD[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - float elevBfVecITD[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - float azimBfVecITD[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - float itdMod; - -} ModelEval_t; - -/* Mixer listener */ -typedef struct -{ - int16_t PoseUpdated; - float Pos[3]; - float Front[3]; - float Up[3]; - float Right[3]; - - int16_t VelUpdated; - float Vel[3]; - -} TDREND_MIX_Listener_t; - -/* HR filter */ -typedef struct TDREND_HRFILT_FiltSet_struct -{ - int32_t SampleRate; /* Sample rate of the HR filter */ - int16_t NumPos; - int16_t NumElev; - float Dist; - float *ItdSet_p; - int16_t FiltLength; - float *Azim_p; - float *Elev_p; - float *ItdSetNominal_p; - float *LeftFiltSet_p; - float *RightFiltSet_p; - ModelParams_t ModelParams; - ModelEval_t ModelEval; - ModelParamsITD_t ModelParamsITD; - TDREND_HRFILT_Method_t FilterMethod; /* HR filtering method */ - -} TDREND_HRFILT_FiltSet_t; - - -/* Distance attenuation */ -typedef struct -{ - TDREND_DistAttenModel_t DistAttenModel; - float RefDist; - float MaxDist; - float RollOffFactor; - -} TDREND_DistAtten_t; - -/* Directional attenuation */ -typedef struct -{ - float ConeInnerAngle; - float ConeOuterAngle; - float ConeOuterGain; - -} TDREND_DirAtten_t; - -/* Mixer spatial specification */ -typedef struct -{ - int16_t UseCommonDistAttenModel; /* Common distance attenuation model flag */ - TDREND_DistAttenModel_t DistAttenModel; /* Distance attenuation model */ - -} TDREND_MixSpatSpec_t; - - -typedef struct TDREND_SRC_REND_s -{ - int16_t InputAvailable; - TDREND_PlayStatus_t PlayStatus; - - /* Gains */ - int16_t SrcGainUpdated; - float SrcGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; - float SrcGainMin_p[SPAT_BIN_MAX_INPUT_CHANNELS]; - float SrcGainMax_p[SPAT_BIN_MAX_INPUT_CHANNELS]; - float DirGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; - float DistGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; -} TDREND_SRC_REND_t; - - -/* Source spatial parameters */ -typedef struct -{ - int16_t Updated; - TDREND_PosType_t PosType; - float Pos_p[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; - float Front_p[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; - int16_t DirAttenEnabled; - TDREND_DirAtten_t DirAtten; - int16_t DistAttenEnabled; - TDREND_DistAtten_t DistAtten; - -} TDREND_SRC_SPATIAL_t; - -typedef struct -{ - float *InputFrame_p; /* Input frame pointer */ - TDREND_SRC_SPATIAL_t *SrcSpatial_p; - TDREND_SRC_REND_t *SrcRend_p; - int16_t itd; - int16_t previtd; - int16_t filterlength; - float mem_itd[ITD_MEM_LEN]; - float hrf_left_prev[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; /* Todo: Should we allocate these buffers with malloc() instead of the maximum length? */ - float hrf_right_prev[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; - float azim_prev; - float elev_prev; - float mem_hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; - float mem_hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; - float Gain; -} TDREND_SRC_t; - -/* Top level TD binaural renderer handle */ -typedef struct ivas_binaural_td_rendering_struct -{ - TDREND_MixSpatSpec_t *TdRend_MixSpatSpec_p; - TDREND_DirAtten_t *DirAtten_p; - int16_t NumOfSrcs; - int16_t MaxSrcInd; - - TDREND_SRC_t *Sources[MAX_NUM_TDREND_CHANNELS]; - - float Gain; /* Mixer gain */ - TDREND_MIX_Listener_t *Listener_p; /* The virtual listener */ - TDREND_HRFILT_FiltSet_t *HrFiltSet_p; /* HR filter set */ - - int16_t UseCommonDistAttenModel; /* Use common dist atten model (TRUE/FALSE) */ - int16_t DistAttenEnabled; /* (TRUE/FALSE) */ - TDREND_DistAttenModel_t DistAttenModel; /* Common distance attenuation model */ - -} BINAURAL_TD_OBJECT_RENDERER, *BINAURAL_TD_OBJECT_RENDERER_HANDLE; - - -/*------------------------------------------------------------------------------------------* - * Crend structures - *------------------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -typedef struct ivas_hrtfs_structure -{ - float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - float *pOut_to_bin_im[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS]; - float *pOut_to_bin_diffuse_im[BINAURAL_CHANNELS]; - float latency_s; - uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - uint16_t num_iterations_diffuse[BINAURAL_CHANNELS]; - uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS]; - uint16_t index_frequency_max_diffuse; - int16_t max_num_ir; - int16_t max_num_iterations; - float inv_diffuse_weight[MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */ - float gain_lfe; - -} HRTFS_DATA, *HRTFS_HANDLE; - -/* Reverberator structures */ - - -typedef struct ivas_roomAcoustics_t -{ - int16_t override; - int16_t use_brir; - int16_t late_reverb_on; - int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ - float pFc_input[CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */ - float pAcoustic_rt60[CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */ - float pAcoustic_dsr[CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */ - float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */ - float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */ - -} ivas_roomAcoustics_t; - -typedef struct ivas_render_config_t -{ -#ifdef DEBUGGING - ivas_renderTypeOverride renderer_type_override; -#endif - ivas_roomAcoustics_t roomAcoustics; - -} RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; - - -typedef struct ivas_rev_delay_line_t -{ - float *pBuffer; - uint16_t MaxDelay; - int16_t Delay; - uint16_t BufferPos; - float Gain; - -} ivas_rev_delay_line_t; - -typedef struct ivas_rev_iir_filter_t -{ - uint16_t MaxTaps; - uint16_t nr_taps; - uint16_t isFIR; - float Output; - float CoefA[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - float CoefB[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - float pBuffer[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - -} ivas_rev_iir_filter_t; - - -typedef float rv_fftwf_type_complex[2]; /* complex type of fftwf library */ - -/* Convertion block for FFT filter: from time domain to frequency domain (with OLS) and back */ -typedef struct ivas_reverb_t2f_f2t_t -{ - int16_t fft_size; - int16_t log2_fft_size; - int16_t block_size; - int16_t hist_size; /* rv_fft_size - rv_block_size */ - float fft_history_L[RV_FILTER_MAX_HISTORY]; - float fft_history_R[RV_FILTER_MAX_HISTORY]; - -} ivas_reverb_t2f_f2t_t; - -/* FFT filter with its frequency response coefficients */ -typedef struct ivas_reverb_fft_filter_t -{ - int16_t fft_size; - float fft_spectrum[RV_FILTER_MAX_FFT_SIZE]; - -} ivas_reverb_fft_filter_t; - - -typedef struct ivas_reverb_state_t -{ - RENDER_CONFIG_DATA pConfig; - - /* input downmixer: */ - float dmx_gain; /* downmix gain */ - - /* predelay: */ - ivas_rev_delay_line_t predelay_line; - float *pPredelay_buffer; - - /* jot reverberator: */ - uint16_t nr_of_branches; /* number of feedback loops */ - ivas_rev_delay_line_t delay_line[IVAS_REV_MAX_NR_BRANCHES]; /* feedback loop delays */ - float *loop_delay_buffer[IVAS_REV_MAX_NR_BRANCHES]; /* feedback loop delay sample buffers */ - ivas_rev_iir_filter_t t60[IVAS_REV_MAX_NR_BRANCHES]; /* feedback loop filters */ - float gain_matrix[IVAS_REV_MAX_NR_BRANCHES][IVAS_REV_MAX_NR_BRANCHES]; /* feedback matrix */ - float mixer[BINAURAL_CHANNELS][IVAS_REV_MAX_NR_BRANCHES]; /* output mixer matrix */ - - /* binauralization filters: */ - int16_t do_corr_filter; - ivas_reverb_t2f_f2t_t fft_filter_ols; - ivas_reverb_fft_filter_t fft_filter_correl_0; - ivas_reverb_fft_filter_t fft_filter_correl_1; - ivas_reverb_fft_filter_t fft_filter_color_0; - ivas_reverb_fft_filter_t fft_filter_color_1; - uint16_t fft_size; /* fft processing size */ - uint16_t fft_subblock_size; /* fft block processing size */ - uint16_t num_fft_subblocks; /* number of fft subblocks */ - uint16_t full_block_size; /* full block processing size */ - -} REVERB_DATA, *REVERB_HANDLE; - - -typedef struct ivas_orient_trk_state_t -{ - OTR_TRACKING_T trackingType; - float centerAdaptationRate; - float offCenterAdaptationRate; - float adaptationAngle; - - float alpha; - - float absYaw; /* absolute orientation */ - float absPitch; - float absRoll; - - float absAvgYaw; /* average absolute orientation */ - float absAvgPitch; - float absAvgRoll; - - float refYaw; /* reference orientation */ - float refPitch; - float refRoll; - - float trkYaw; /* tracked orientation */ - float trkPitch; - float trkRoll; - -} ivas_orient_trk_state_t; - - -/* Main Crend structure */ -typedef struct ivas_crend_state_t -{ - float *freq_buffer_re[MAX_INTERN_CHANNELS]; - float *freq_buffer_im[MAX_INTERN_CHANNELS]; - float *freq_buffer_re_diffuse; - float *freq_buffer_im_diffuse; - float *prev_out_buffer[BINAURAL_CHANNELS]; - float *lfe_delay_line; - float m_fYaw; - float m_fPitch; - float m_fRoll; - ivas_orient_trk_state_t *hTrack; - REVERB_HANDLE hReverb; - int16_t delay_line_rw_index; - int16_t diffuse_delay_line_rw_index; - -} CREND_DATA, *CREND_HANDLE; - -#ifdef HRTF_BINARY_FILE - -/* htrfs from binary files. */ - -typedef struct ivas_hrtfs_crend_structure -{ - HRTFS_DATA *hHRTF_hrir_combined; - HRTFS_DATA *hHRTF_hrir_hoa3; - HRTFS_DATA *hHRTF_brir_combined; - -} HRTFS_CREND, *HRTFS_CREND_HANDLE; - -typedef struct ivas_hrtfs_header_t -{ - int32_t rend_type; - int32_t input_cfg; - int32_t frequency; - uint32_t data_size; - -} ivas_hrtfs_header_t; - -typedef struct ivas_hrtfs_file_header_t -{ - char identifier[8]; - int32_t file_size; - int16_t nb_hrtf; - int32_t max_data_size; - -} ivas_hrtfs_file_header_t; - -#endif - -/*----------------------------------------------------------------------------------* - * LFE decoder structure - *----------------------------------------------------------------------------------*/ - -typedef struct ivas_lfe_dec_data_structure -{ - ivas_filters_process_state_t filter_state; - LFE_WINDOW_HANDLE pWindow_state; - const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; - int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; - float lfe_block_delay_s; - int16_t lfe_prior_buf_len; - float *prior_out_buffer; - - float *prevsynth_buf; - float *lfe_delay_buf; - int16_t lfe_addl_delay; - int16_t bfi_count; - -} LFE_DEC_DATA, *LFE_DEC_HANDLE; - - -/*----------------------------------------------------------------------------------* - * Limiter structure - *----------------------------------------------------------------------------------*/ - -typedef struct -{ - int16_t max_num_channels; - int16_t num_channels; - float **channel_ptrs; - int32_t sampling_rate; - float gain; - float release_heuristic; - float attack_constant; - int16_t strong_saturation_count; -#ifdef DEBUGGING - int32_t cnt_frames_limited; /* counter of frames in which the limiter is applied */ -#endif - -} IVAS_LIMITER, *IVAS_LIMITER_HANDLE; - - /*----------------------------------------------------------------------------------* * Decoder configuration structure *----------------------------------------------------------------------------------*/ @@ -1877,18 +1218,48 @@ typedef struct decoder_config_structure int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ + int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ int16_t orientation_tracking; /* indicates orientation tracking type */ +#ifdef NON_DIEGETIC_PAN + int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ + float non_diegetic_pan_gain; /* non diegetic panning gain*/ +#else float no_diegetic_pan; +#endif int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ /* temp. development parameters */ #ifdef DEBUGGING - int16_t forceSubframeBinauralization; /* Flag for forcing Parametric binauralizer to subframe mode */ - int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ + int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ +#endif +#ifdef JBM_TSM_ON_TCS + int16_t voip_active; #endif } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; + +#ifdef JBM_TSM_ON_TCS +typedef struct decoder_tc_buffer_structure +{ + float *tc_buffer; /* the buffer itself */ + float *tc[MAX_TRANSPORT_CHANNELS]; /* pointers into the buffer to the beginning of each tc */ + 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; + int16_t subframes_rendered; + int16_t slots_rendered; + int16_t num_slots; + int16_t n_samples_discard; /* number of samples to discard from the beginning of the output */ +} DECODER_TC_BUFFER, *DECODER_TC_BUFFER_HANDLE; #endif /*----------------------------------------------------------------------------------* * @@ -1934,16 +1305,21 @@ typedef struct Decoder_Struct /* multichannel modules */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS]; /* ISM metadata handles (storage for one frame of read ISM metadata) */ + ISM_DTX_DATA_DEC hISMDTX; /* ISM DTX structure */ ISM_RENDERER_HANDLE hIsmRendererData; /* ISM renderer handle */ DIRAC_DEC_HANDLE hDirAC; /* DirAC handle */ SPAR_DEC_HANDLE hSpar; /* SPAR handle */ IVAS_QMETADATA_HANDLE hQMetaData; /* q_metadata handle */ MCT_DEC_HANDLE hMCT; /* MCT handle */ PARAM_MC_DEC_HANDLE hParamMC; /* Parametric MC handle */ +#ifdef MC_PARAMUPMIX_MODE + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; /* MC Param-Upmix handle */ +#endif MASA_DECODER_HANDLE hMasa; /* MASA handle */ LFE_DEC_HANDLE hLFE; /* LFE handle */ ISM_MODE ism_mode; /* ISM format mode */ + int16_t nchan_ism; /* number of ISM channels */ SBA_MODE sba_mode; /* SBA format mode */ MC_MODE mc_mode; /* MC format mode */ int16_t sba_order; /* Ambisonic (SBA) order */ @@ -1963,17 +1339,11 @@ typedef struct Decoder_Struct EFAP_HANDLE hEFAPdata; /* EFAP structure */ VBAP_HANDLE hVBAPdata; /* VBAP structure */ MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer; /* Mono downmix structure */ -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE hCrendWrapper; -#else - CREND_HANDLE hCrend; /* Convolution mixer renderer structure */ - HRTFS_HANDLE hHrtf; /* HRTFs handle */ -#endif -#ifdef HRTF_BINARY_FILE + REVERB_HANDLE hReverb; /* Reverb handle */ HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */ HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */ HRTFS_PARAMBIN_HANDLE hHrtfParambin; /* HRTF tables for parametric binauralizer */ -#endif LSSETUP_CUSTOM_HANDLE hLsSetupCustom; /* Custom LS configuration handle */ float *hoa_dec_mtx; /* Pointer to decoder matrix for SBA */ HEAD_TRACK_DATA_HANDLE hHeadTrackData; /* Head tracking data structure */ @@ -1983,8 +1353,13 @@ typedef struct Decoder_Struct #ifdef DEBUGGING int32_t noClipping; /* number of clipped samples */ #endif -#ifdef SBA_BR_SWITCHING int32_t last_active_ivas_total_brate; + int16_t ism_extmeta_active; /* Extended metadata active in decoder */ + int16_t ism_extmeta_cnt; /* Change frame counter for extended metadata */ + + +#ifdef JBM_TSM_ON_TCS + DECODER_TC_BUFFER_HANDLE hTcBuffer; #endif } Decoder_Struct; diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index b55cf4cfbdbda5037c08726630424a19321bfd20..2e31375996857b5ea68e38c8d90cb5b41793cfd8 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -90,8 +90,12 @@ void stereo_dft_dec_sid_coh( int16_t bits_tmp; int16_t b; +#ifdef FIX_418_SID_BITRATE + nr_of_sid_stereo_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; +#else /* TODO: still use old number of bits to keep bitexactness in output */ nr_of_sid_stereo_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; +#endif /* If the coherence is not encoded due to lack of bits set alpha to zero which leads to that the coherence */ /* from the previous frame is used. */ @@ -174,7 +178,9 @@ void stereo_dft_dec_sid_coh( ( *nb_bits )++; } +#ifndef FIX_418_SID_BITRATE dtx_read_padding_bits( st, ( IVAS_SID_5k2 - 4400 ) / FRAMES_PER_SEC ); +#endif return; } diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index e2eab3f3b294c753957672e4034fa8bc3c66217c..08ca989f3d4a4f4a82ae02805682b96132513da3 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -76,7 +76,7 @@ * Local function prototypes *-------------------------------------------------------------------------*/ -static void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const int32_t output_Fs ); +static void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const int32_t output_Fs, const int16_t nchan_transport ); static void stereo_dft_compute_td_stefi_params( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const float samp_ratio ); @@ -251,7 +251,8 @@ ivas_error stereo_dft_dec_create( STEREO_DFT_DEC_DATA_HANDLE *hStereoDft, /* i/o: decoder DFT stereo handle */ const int32_t element_brate, /* i : element bitrate */ const int32_t output_Fs, /* i : output sampling rate */ - const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ + const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + const int16_t nchan_transport /* i : number of transport channels */ ) { STEREO_DFT_DEC_DATA_HANDLE hStereoDft_loc; @@ -293,7 +294,8 @@ ivas_error stereo_dft_dec_create( stereo_dft_config( hStereoDft_loc->hConfig, element_brate, &tmpS, &tmpS ); } - stereo_dft_dec_open( hStereoDft_loc, output_Fs ); + stereo_dft_dec_open( hStereoDft_loc, output_Fs, + nchan_transport ); *hStereoDft = hStereoDft_loc; @@ -309,10 +311,10 @@ ivas_error stereo_dft_dec_create( static void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ - const int32_t output_Fs /* i : output sampling rate */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t nchan_transport /* i : number of transport channels */ ) { - /*Sizes*/ hStereoDft->N = (int16_t) ( STEREO_DFT_HOP_MAX * output_Fs / 48000 ); @@ -365,6 +367,17 @@ static void stereo_dft_dec_open( hStereoDft->hb_stefi_delay = NS2SA( output_Fs, STEREO_DFT_TD_STEFI_DELAY_NS ); + if ( nchan_transport > 2 ) + { + hStereoDft->min_smooth_gains = min_smooth_gains2; + hStereoDft->max_smooth_gains = max_smooth_gains2; + } + else + { + hStereoDft->min_smooth_gains = min_smooth_gains1; + hStereoDft->max_smooth_gains = max_smooth_gains1; + } + /* reset DFT stereo memories */ stereo_dft_dec_reset( hStereoDft ); @@ -383,6 +396,7 @@ void stereo_dft_dec_reset( ) { int16_t i; + int16_t j, b; /*Configuration*/ set_s( hStereoDft->prm_res, hStereoDft->hConfig->prm_res, STEREO_DFT_DEC_DFT_NB ); @@ -490,6 +504,21 @@ void stereo_dft_dec_reset( hStereoDft->ipd_xfade_counter = 0; hStereoDft->ipd_xfade_prev = 0.0f; + for ( b = 0; b < hStereoDft->nbands; b++ ) + { + for ( i = 0; i < 2; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + hStereoDft->mixer_mat_smooth[i][j][b] = 0.0f; + } + } + } + hStereoDft->first_frame = 1; + hStereoDft->g_L_prev = 0.f; + hStereoDft->g_R_prev = 0.f; + + return; } @@ -1096,7 +1125,12 @@ void stereo_dft_dec( float DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */ float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ - const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ + const int16_t sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ + const int16_t sba_mono_flag, /* i : signal mono output for SBA DirAC */ + ivas_spar_md_dec_state_t *hMdDec, /* i : SPAR MD handle for upmixing */ + const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ + const int32_t output_Fs, /* i : Fs for delay calculation */ + const int16_t nchan_transport /* i : number of transpor channels */ ) { int16_t i, k, b, N_div, stop; @@ -1104,6 +1138,7 @@ void stereo_dft_dec( float DFT_R[STEREO_DFT32MS_N_MAX]; float DFT_PRED_RES[STEREO_DFT32MS_N_32k]; float *pDFT_DMX; + float *pDFT_DMX1; float *pDFT_RES; float g, tmp; float *pPredGain; @@ -1127,6 +1162,8 @@ void stereo_dft_dec( HANDLE_FD_CNG_COM hFdCngCom = hFdCngDec->hFdCngCom; int16_t *cna_seed = &( hFdCngCom->seed ); + float DFT_W, DFT_Y; + output_frame = (int16_t) ( st0->output_Fs / FRAMES_PER_SEC ); /*------------------------------------------------------------------* @@ -1168,7 +1205,10 @@ void stereo_dft_dec( /* Smoothing for the current frame */ if ( sba_dirac_stereo_flag ) { - ivas_sba_dirac_stereo_smooth_parameters( hStereoDft ); + ivas_sba_dirac_stereo_smooth_parameters( hStereoDft, + hMdDec, + cross_fade_start_offset, + output_Fs ); } else { @@ -1193,6 +1233,11 @@ void stereo_dft_dec( { pDFT_DMX = DFT[0] + k * STEREO_DFT32MS_N_MAX; pDFT_RES = DFT[1] + k * STEREO_DFT32MS_N_MAX; + pDFT_DMX1 = 0; + if ( nchan_transport > 1 ) + { + pDFT_DMX1 = DFT[1] + k * STEREO_DFT32MS_N_MAX; + } /*Apply Stereo*/ if ( hStereoDft->hConfig->dmx_active ) @@ -1236,7 +1281,10 @@ void stereo_dft_dec( hStereoDft->past_DMX_pos = ( hStereoDft->past_DMX_pos + STEREO_DFT_PAST_MAX - 1 ) % STEREO_DFT_PAST_MAX; } - stereo_dft_generate_res_pred( hStereoDft, samp_ratio, pDFT_DMX, DFT_PRED_RES, pPredGain, k, DFT[1] + k * STEREO_DFT32MS_N_MAX, &stop, st0->bfi ); + if ( !( sba_dirac_stereo_flag && nchan_transport >= 2 ) ) + { + stereo_dft_generate_res_pred( hStereoDft, samp_ratio, pDFT_DMX, DFT_PRED_RES, pPredGain, k, DFT[1] + k * STEREO_DFT32MS_N_MAX, &stop, st0->bfi ); + } if ( hStereoDft->res_cod_band_max > 0 ) { @@ -1292,6 +1340,7 @@ void stereo_dft_dec( { g = hStereoDft->g_state[b]; } + /* store side gains from inactive frames for later use by the stereo CNA */ if ( hStereoDft->band_limits[b] < L_FRAME16k && ( hStereoDft->frame_sid_nodata || st0->VAD == 0 ) ) { @@ -1308,7 +1357,7 @@ void stereo_dft_dec( #endif /* No residual coding in inactive frames, instead pDFT_RES is used for the second channel */ - if ( b >= hStereoDft->res_cod_band_max && !hStereoDft->frame_sid_nodata ) + if ( b >= hStereoDft->res_cod_band_max && !hStereoDft->frame_sid_nodata && !( sba_dirac_stereo_flag && hMdDec ) ) { /*filter non-coded frequencies. It removes some MDCT frequency aliasing*/ for ( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) @@ -1358,10 +1407,139 @@ void stereo_dft_dec( } } } + else if ( sba_dirac_stereo_flag && hMdDec ) + { + + if ( nchan_transport == 1 ) + { + if ( sba_mono_flag ) + { + if ( b == 0 ) + { + i = 0; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_L[2 * i] = DFT_W; + DFT_R[2 * i] = 0.f; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_L[2 * i + 1] = DFT_W; + DFT_R[2 * i + 1] = 0.f; + } + for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; + DFT_L[2 * i] = DFT_W; + DFT_R[2 * i] = 0.f; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; + DFT_L[2 * i + 1] = DFT_W; + DFT_R[2 * i + 1] = 0.f; + } + for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_L[2 * i] = DFT_W; + DFT_R[2 * i] = 0.f; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_L[2 * i + 1] = DFT_W; + DFT_R[2 * i + 1] = 0.f; + } + } + else + { + if ( b == 0 ) + { + i = 0; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + ( hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[0][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[0][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + ( hStereoDft->mixer_mat_smooth[1][1][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][2][b + k * IVAS_MAX_NUM_BANDS] + hStereoDft->mixer_mat_smooth[1][3][b + k * IVAS_MAX_NUM_BANDS] ) * DFT_PRED_RES[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) + { + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = hStereoDft->mixer_mat_smooth[0][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + } + } + else if ( nchan_transport >= 2 ) + { + if ( b == 0 ) + { + i = 0; + + DFT_W = pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + pDFT_DMX1[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + pDFT_DMX1[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + for ( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) + { + DFT_W = pDFT_DMX[2 * i]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i] + pDFT_DMX1[2 * i]; + + DFT_L[2 * i] = DFT_W + DFT_Y; + DFT_R[2 * i] = DFT_W - DFT_Y; + + DFT_W = pDFT_DMX[2 * i + 1]; + DFT_Y = hStereoDft->mixer_mat_smooth[1][0][b + k * IVAS_MAX_NUM_BANDS] * pDFT_DMX[2 * i + 1] + pDFT_DMX1[2 * i + 1]; + + DFT_L[2 * i + 1] = DFT_W + DFT_Y; + DFT_R[2 * i + 1] = DFT_W - DFT_Y; + } + } + else + { + assert( "nhcan_transport must be 1 or 1!" ); + } + } else { + + for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) { + tmp = g * pDFT_DMX[2 * i] + pDFT_RES[2 * i] + DFT_PRED_RES[2 * i]; DFT_L[2 * i] = pDFT_DMX[2 * i] + tmp; @@ -1418,7 +1596,11 @@ void stereo_dft_dec( if ( hStereoDft->frame_sid_nodata || st0->VAD == 0 ) { +#ifdef FIX_I414_OOA_CNA + hFdCngDec->cna_band_limits[hFdCngDec->cna_nbands] = hStereoDft->band_limits[hFdCngDec->cna_nbands]; +#else hFdCngDec->cna_band_limits[b] = hStereoDft->band_limits[hFdCngDec->cna_nbands]; +#endif } if ( hStereoDft->frame_sid_nodata && !sba_dirac_stereo_flag ) diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index a5955aa0983717a727934c8360b4d165f5a70ca1..cbeaf2a1e516f0b4d2473fd8f8ca1ff406dd2c2c 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -50,8 +50,10 @@ *-------------------------------------------------------------------------*/ static void apply_dmx_weights( CPE_DEC_HANDLE hCPE, float *x[CPE_CHANNELS][NB_DIV], int16_t transform_type_left[NB_DIV], int16_t transform_type_right[NB_DIV] ); + static void run_min_stats( Decoder_State **sts, float *x[CPE_CHANNELS][NB_DIV] ); + /*-------------------------------------------------------------------* * convert_coeffs_to_higher_res() * @@ -219,7 +221,8 @@ void stereo_mdct_core_dec( if ( !bfi ) { - ivas_mdct_dec_side_bits_frame_channel( hCPE, param_lpc, p_param, hCPE->hCoreCoder[0], NULL, nTnsBitsTCX10, param, 0, 0 ); + ivas_mdct_dec_side_bits_frame_channel( hCPE, param_lpc, p_param, hCPE->hCoreCoder[0], + nTnsBitsTCX10, param, 0, 0 ); if ( sts[0]->igf ) { @@ -250,7 +253,8 @@ void stereo_mdct_core_dec( } } - ivas_mdct_core_invQ( hCPE, 0, nTnsBitsTCX10, p_param, param_lpc, param, fUseTns, tnsData, x_0, x, Aq, ms_mask, 0 ); + ivas_mdct_core_invQ( hCPE, + nTnsBitsTCX10, p_param, param_lpc, param, fUseTns, tnsData, x_0, x, Aq, ms_mask, 0 ); for ( ch = 0; ch < nChannels; ch++ ) { @@ -343,7 +347,8 @@ void stereo_mdct_core_dec( stereo_decoder_tcx( hCPE->hStereoMdct, ms_mask, x_0[1], x[0], x[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 0 ); } - ivas_mdct_core_tns_ns( hCPE, 0, fUseTns, tnsData, x, Aq, 0 ); + ivas_mdct_core_tns_ns( hCPE, + fUseTns, tnsData, x, Aq, 0 ); if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) { @@ -357,7 +362,8 @@ void stereo_mdct_core_dec( apply_dmx_weights( hCPE, x, sts[0]->transform_type, sts[1]->transform_type ); } - ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, 0, fUseTns, 0 ); + ivas_mdct_core_reconstruct( hCPE, x, signal_outFB_tmp, + fUseTns, 0 ); mvr2r( signal_out_tmp[0], signal_out[0], L_FRAME48k ); mvr2r( signal_out_tmp[1], signal_out[1], L_FRAME48k ); @@ -647,4 +653,6 @@ static void run_min_stats( /* restore VAD (see above) */ st->VAD = save_VAD[ch]; } + + return; } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index 963acdc16bfc0cdd65adb3f871b01ffcfe9af041..0e788a0821103ce0b6b3e1c8a3891fb9579e3f29 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -67,6 +67,7 @@ void parse_stereo_from_bitstream( #ifdef DEBUGGING int16_t nbits_start = st0->next_bit_pos; #endif + if ( !isSBAStereoMode ) { nSubframes = ( sts[0]->core == TCX_10_CORE || ( sts[0]->core != sts[1]->core ) ) ? NB_DIV : 1; @@ -176,6 +177,7 @@ void parse_stereo_from_bitstream( } } } + if ( !mct_on ) { hStereoMdct->split_ratio = SMDCT_EQUAL_RATIO_RANGE; /* Equal bits to both channels */ @@ -327,19 +329,11 @@ void stereo_decoder_tcx( hStereoMdct->reverse_dmx = 0; } -#ifdef FIX_317 if ( ( nrgRatio > 1.0f ) && ( k < ( ( core_r == TCX_10_CORE ) ? NB_DIV : 1 ) ) ) -#else - if ( ( nrgRatio > 1.0f ) && ( k < ( ( core_r == TCX_20_CORE ) ? 1 : NB_DIV ) ) ) -#endif { v_multc( spec_r[k], nrgRatio, spec_r[k], L_frameTCX_r ); } -#ifdef FIX_317 else if ( ( nrgRatio < 1.0f ) && ( k < ( ( core_l == TCX_10_CORE ) ? NB_DIV : 1 ) ) ) -#else - else if ( ( nrgRatio < 1.0f ) && ( k < ( ( core_l == TCX_20_CORE ) ? 1 : NB_DIV ) ) ) -#endif { v_multc( spec_l[k], 1.0f / nrgRatio, spec_l[k], L_frameTCX_l ); } @@ -474,11 +468,22 @@ ivas_error initMdctStereoDtxData( /* Init FD-CNG */ initFdCngDec( st ); +#ifndef FIX_413_SBA_DTX + if ( ch == 1 && st->cng_sba_flag ) + { + st->hFdCngDec->hFdCngCom->seed += 3; + } +#endif + } +#ifdef FIX_413_SBA_DTX + if ( st->first_CNG == 0 ) + { if ( ch == 1 && st->cng_sba_flag ) { st->hFdCngDec->hFdCngCom->seed += 3; } } +#endif if ( st->cldfbAna == NULL ) { diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 44b47bc5cbb99c5406ec688c9678886c1dcd2841..898908c96e4dda4e55538efeb2c4bb0bdd51b51b 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -421,7 +421,8 @@ ivas_error stereo_memory_dec( deallocate_CoreCoder( hCPE->hCoreCoder[1] ); /* allocate DFT stereo data structure */ - if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, 0, + nchan_transport ) ) != IVAS_ERR_OK ) { return error; } @@ -962,18 +963,16 @@ ivas_error stereo_memory_dec( if ( ivas_format == MC_FORMAT && hCPE->element_mode == IVAS_CPE_MDCT ) { +#ifdef MC_PARAMUPMIX_MODE + if ( mc_mode == MC_MODE_MCT || mc_mode == MC_MODE_PARAMUPMIX ) +#else if ( mc_mode == MC_MODE_MCT ) +#endif { /* deallocate the FdCNG handle */ for ( i = 0; i < CPE_CHANNELS; ++i ) { deleteFdCngDec( &hCPE->hCoreCoder[i]->hFdCngDec ); - - /* deallocate CLDFB synthesis for LFE channel */ - if ( hCPE->hCoreCoder[i]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - deleteCldfb( &hCPE->hCoreCoder[i]->cldfbSyn ); - } } } else @@ -1115,7 +1114,10 @@ void synchro_synthesis( delay_signal( output[0], output_frame, hCPE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf, delay_diff ); } - ivas_post_proc( NULL, hCPE, 0, output[0], output, output_frame, sba_dirac_stereo_flag ); + if ( hCPE->element_mode != IVAS_CPE_MDCT ) + { + ivas_post_proc( NULL, hCPE, 0, output[0], output, output_frame, sba_dirac_stereo_flag ); + } /* zero padding in order to synchronize the upmixed DFT stereo synthesis with the TD/MDCT stereo synthesis */ for ( n = 0; n < hCPE->nchan_out; n++ ) @@ -1182,7 +1184,8 @@ void synchro_synthesis( /*----------------------------------------------------------------* * TD/MDCT stereo synchro *----------------------------------------------------------------*/ - + if ( sba_dirac_stereo_flag ) + return; if ( hCPE->element_mode == IVAS_CPE_TD || hCPE->element_mode == IVAS_CPE_MDCT ) { /* handling of DFT->TD switching */ diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 2a6dcdf82e4cbc3a94dc69e15271aa47149f7c07..ab82fb4e07653b0d0900c75137aecd588738b608 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -95,14 +95,13 @@ void stereo_tcx_init_dec( st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_flag ); st->hTcxCfg->resq = getResq( st->bits_frame_nominal * FRAMES_PER_SEC ); hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_flag, st->element_mode ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag, st->mct_chan_mode ); -#ifdef SET_TNS_FLAG_IN_EVERY_FRAME - /* TODO: also apply for MCT modes, once issue #24 is solved */ - if ( !MCT_flag && st->element_mode != EVS_MONO ) + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag ); + + if ( + st->element_mode != EVS_MONO ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode ); } -#endif if ( hTcxLtpDec != NULL ) { hTcxLtpDec->tcxltp = getTcxLtp( st->sr_core ); @@ -162,7 +161,8 @@ void stereo_tcx_core_dec( const int16_t last_element_mode, /* i : last element mode */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ + const int16_t nchan_out, /* i : number of output channels */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ ) { int16_t i, k; @@ -726,7 +726,16 @@ void stereo_tcx_core_dec( if ( st->element_mode != IVAS_CPE_TD ) { - ApplyFdCng( signal_out, NULL, NULL, NULL, st, st->bfi, 0 ); + if ( ivas_format == ISM_FORMAT ) + { + float buffer[L_FRAME16k]; + lerp( signal_outFB, buffer, st->L_frame, hTcxDec->L_frameTCX ); + ApplyFdCng( buffer, NULL, NULL, NULL, st, st->bfi, 0 ); + } + else + { + ApplyFdCng( signal_out, NULL, NULL, NULL, st, st->bfi, 0 ); + } } /* Generate additional comfort noise to mask potential coding artefacts */ diff --git a/lib_dec/ivas_vbap.c b/lib_dec/ivas_vbap.c index e0deb652dc6a0625fcb4367423cac58fce789b9b..cda52c1aec8e7c74c9b05d1016cc429e99fb6151 100644 --- a/lib_dec/ivas_vbap.c +++ b/lib_dec/ivas_vbap.c @@ -29,7 +29,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -// VE2AT: move to lib_rend ? + #include #include "options.h" #include @@ -95,6 +95,26 @@ typedef struct connection_option float arc_weighted; } ConnectionOption; +enum SpeakerNodeGroup +{ + SPEAKER_NODE_BOTTOM_HALF, + SPEAKER_NODE_HORIZONTAL, + SPEAKER_NODE_TOP_HALF, + SPEAKER_NODE_BACK, + SPEAKER_NODE_ALL +}; + +/* Defines a single speaker node */ +typedef struct vbap_speaker_node_structure +{ + float azi_deg; + float ele_deg; + float unit_vec[3]; + enum SpeakerNodeGroup group; + +} VBAP_SPEAKER_NODE; + + /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ @@ -107,13 +127,13 @@ static int16_t determine_virtual_surface_triplets( const int16_t num_speaker_nod static void determine_initial_search_indices( const int16_t num_triplets, const float triplet_azidegs[VBAP_MAX_NUM_TRIPLETS], int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS] ); -static void determine_connections( const int16_t num_speaker_nodes, const VBAP_SPEAKER_NODE *speaker_node_data, int16_t connections[][2], const int16_t max_num_connections, int16_t *group1_count, int16_t *group2_start, int16_t *group2_count ); +static ivas_error determine_connections( const int16_t num_speaker_nodes, const VBAP_SPEAKER_NODE *speaker_node_data, int16_t connections[][2], const int16_t max_num_connections, int16_t *group1_count, int16_t *group2_start, int16_t *group2_count ); static void formulate_horizontal_connections( const VBAP_SPEAKER_NODE *speaker_node_data, const int16_t num_speaker_nodes, int16_t connections[][2], int16_t *connection_write_index ); -static void get_half_sphere_connection_options( const VBAP_SPEAKER_NODE *speaker_node_data, const enum SpeakerNodeGroup group, const int16_t num_speaker_nodes, const int16_t num_non_crossing_planes, const float *non_crossing_plane_elevation_deg, ConnectionOption **connection_options_pr, int16_t *num_connection_options ); +static ivas_error get_half_sphere_connection_options( const VBAP_SPEAKER_NODE *speaker_node_data, const enum SpeakerNodeGroup group, const int16_t num_speaker_nodes, const int16_t num_non_crossing_planes, const float *non_crossing_plane_elevation_deg, ConnectionOption **connection_options_pr, int16_t *num_connection_options ); -static void formulate_half_sphere_connections( const VBAP_SPEAKER_NODE *speaker_node_data, const int16_t num_speaker_nodes, const enum SpeakerNodeGroup group, int16_t connections[][2], int16_t *connection_write_index, const int16_t max_num_connections, const int16_t num_non_crossing_planes, const float *non_crossing_plane_elevation_deg ); +static ivas_error formulate_half_sphere_connections( const VBAP_SPEAKER_NODE *speaker_node_data, const int16_t num_speaker_nodes, const enum SpeakerNodeGroup group, int16_t connections[][2], int16_t *connection_write_index, const int16_t max_num_connections, const int16_t num_non_crossing_planes, const float *non_crossing_plane_elevation_deg ); static int16_t determine_non_crossing_planes( const int16_t num_speaker_nodes, const VBAP_SPEAKER_NODE *node_data, float *non_crossing_plane_elevation_deg ); @@ -153,6 +173,7 @@ ivas_error vbap_init_data( float speaker_node_ele_deg_internal[VBAP_MAX_NUM_SPEAKER_NODES]; VBAP_SPEAKER_NODE speaker_node_data[VBAP_MAX_NUM_SPEAKER_NODES]; VBAP_DATA *vbap; + ivas_error error; push_wmops( "vbap_init" ); @@ -164,6 +185,7 @@ ivas_error vbap_init_data( /* TODO: are these two paths correct behaviour or should and error be returned ? */ return IVAS_ERR_OK; } + if ( !speaker_node_azi_deg || !speaker_node_ele_deg ) { hVBAPdata = NULL; @@ -186,7 +208,6 @@ ivas_error vbap_init_data( vbap->num_speaker_nodes = num_speaker_nodes; vbap->num_speaker_nodes_internal = num_speaker_nodes; - /* Check if the speaker node setup needs a virtual top or bottom node (function also increments vbap->num_speaker_nodes_internal when necessary) */ virtual_bottom_type = check_need_of_virtual_speaker_node( vbap, speaker_node_azi_deg, speaker_node_ele_deg, SPEAKER_NODE_BOTTOM_HALF ); @@ -200,7 +221,10 @@ ivas_error vbap_init_data( if ( is_success && virtual_bottom_type != NO_VIRTUAL_SPEAKER_NODE ) { - vbap->bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + if ( ( vbap->bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } set_zero( vbap->bottom_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->bottom_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->bottom_virtual_speaker_node_index] = 0.0f; @@ -209,7 +233,10 @@ ivas_error vbap_init_data( if ( is_success && virtual_top_type != NO_VIRTUAL_SPEAKER_NODE ) { - vbap->top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + if ( ( vbap->top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } set_zero( vbap->top_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->top_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->top_virtual_speaker_node_index] = 0.0f; @@ -218,7 +245,10 @@ ivas_error vbap_init_data( if ( is_success && virtual_back_type != NO_VIRTUAL_SPEAKER_NODE ) { - vbap->back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + if ( ( vbap->back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } set_zero( vbap->back_virtual_speaker_node_division_gains, num_speaker_nodes ); is_success &= vbap->back_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->back_virtual_speaker_node_index] = 180.0f; @@ -230,7 +260,10 @@ ivas_error vbap_init_data( /* Allocate and determine node-node connections */ max_num_connections = ( vbap->num_speaker_nodes_internal - 2 ) * 3; /* Theoretical maximum */ - determine_connections( vbap->num_speaker_nodes_internal, speaker_node_data, connections, max_num_connections, &connection_group1_count, &connection_group2_start, &connection_group2_count ); + if ( ( error = determine_connections( vbap->num_speaker_nodes_internal, speaker_node_data, connections, max_num_connections, &connection_group1_count, &connection_group2_start, &connection_group2_count ) ) != IVAS_ERR_OK ) + { + return error; + } /* Allocate and determine virtual surface speaker node triplets */ if ( is_success ) @@ -266,12 +299,20 @@ ivas_error vbap_init_data( break; } } - vbap->search_struct[0].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group1_internal - 2 ) * 2 - ( max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ); + + if ( ( vbap->search_struct[0].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group1_internal - 2 ) * 2 - ( max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } is_success &= vbap->search_struct[0].triplets != NULL; + if ( speaker_nodes_group2_internal > 0 ) { vbap->num_search_structs = 2; - vbap->search_struct[1].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group2_internal - 2 ) * 2 - ( max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ); + if ( ( vbap->search_struct[1].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group2_internal - 2 ) * 2 - ( max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } is_success &= vbap->search_struct[1].triplets != NULL; } else @@ -1181,7 +1222,7 @@ static void determine_initial_search_indices( * Determine all valid connections between all speaker nodes *-------------------------------------------------------------------------*/ -static void determine_connections( +static ivas_error determine_connections( const int16_t num_speaker_nodes, /* i : number of speaker nodes */ const VBAP_SPEAKER_NODE *speaker_node_data, /* i : speaker node data */ int16_t connections[][2], /* o : vector of connections */ @@ -1195,6 +1236,7 @@ static void determine_connections( int16_t c; int16_t connection_write_index = 0; float non_crossing_plane_elevation_deg[VBAP_MAX_PLANES]; + ivas_error error; set_f( non_crossing_plane_elevation_deg, 0.0f, VBAP_MAX_PLANES ); @@ -1210,20 +1252,31 @@ static void determine_connections( /* Process in different mode based on the grouping. It is enough to check for first node. */ if ( speaker_node_data[0].group == SPEAKER_NODE_ALL ) { - formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_ALL, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ); + if ( ( error = formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_ALL, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ) ) != IVAS_ERR_OK ) + { + return error; + } } else { /* The node-node connections are determined in three stages: bottom, horizontal, and top. */ - formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_BOTTOM_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ); + if ( ( error = formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_BOTTOM_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ) ) != IVAS_ERR_OK ) + { + return error; + } *group2_start = connection_write_index; + formulate_horizontal_connections( speaker_node_data, num_speaker_nodes, connections, &connection_write_index ); *group1_count = connection_write_index; - formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_TOP_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ); + + if ( ( error = formulate_half_sphere_connections( speaker_node_data, num_speaker_nodes, SPEAKER_NODE_TOP_HALF, connections, &connection_write_index, max_num_connections, num_non_crossing_planes, non_crossing_plane_elevation_deg ) ) != IVAS_ERR_OK ) + { + return error; + } *group2_count = connection_write_index - *group2_start; } - return; + return IVAS_ERR_OK; } @@ -1426,7 +1479,7 @@ static int16_t check_plane_crossing( * Get list of all potential connections at the half-sphere *-------------------------------------------------------------------------*/ -static void get_half_sphere_connection_options( +static ivas_error get_half_sphere_connection_options( const VBAP_SPEAKER_NODE *speaker_node_data, /* i : speaker node data */ const enum SpeakerNodeGroup group, /* i : speaker node group */ const int16_t num_speaker_nodes, /* i : number of speaker nodes */ @@ -1452,7 +1505,11 @@ static void get_half_sphere_connection_options( } /* Init memory for connection options */ - c_options = (ConnectionOption *) malloc( sizeof( ConnectionOption ) * max_num_connection_options ); + if ( ( c_options = (ConnectionOption *) malloc( sizeof( ConnectionOption ) * max_num_connection_options ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } + for ( c = 0; c < max_num_connection_options; c++ ) { c_options[c].chA = -1; @@ -1507,7 +1564,11 @@ static void get_half_sphere_connection_options( /* Init memory for reordered connection options and order by arc_weighted, * which informs of the preference order of the connections in case they cross */ - c_options_reorder = (ConnectionOption *) malloc( sizeof( ConnectionOption ) * ( *num_connection_options ) ); + if ( ( c_options_reorder = (ConnectionOption *) malloc( sizeof( ConnectionOption ) * ( *num_connection_options ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VBAP data\n" ) ); + } + for ( c = 0; c < *num_connection_options; c++ ) { float min_arc_weighted; @@ -1534,16 +1595,17 @@ static void get_half_sphere_connection_options( *connection_options_pr = c_options_reorder; free( c_options ); - return; + return IVAS_ERR_OK; } + /*-------------------------------------------------------------------------* * formulate_half_sphere_connections() * * Formulate half-sphere connections *-------------------------------------------------------------------------*/ -static void formulate_half_sphere_connections( +static ivas_error formulate_half_sphere_connections( const VBAP_SPEAKER_NODE *speaker_node_data, /* i : speaker node data */ const int16_t num_speaker_nodes, /* i : number of speaker nodes */ const enum SpeakerNodeGroup group, /* i : speaker node group */ @@ -1570,19 +1632,23 @@ static void formulate_half_sphere_connections( ConnectionOption *connection_options; int16_t num_connection_options; int16_t half_sphere_first_connection; + ivas_error error; half_sphere_first_connection = *connection_write_index; /* Obtain all connection options (i.e., channel pairs) at the half sphere. The function orders them * in terms of which connection to keep if two connections would cross each other. */ - get_half_sphere_connection_options( - speaker_node_data, - group, - num_speaker_nodes, - num_non_crossing_planes, - non_crossing_plane_elevation_deg, - &connection_options, - &num_connection_options ); + if ( ( error = get_half_sphere_connection_options( + speaker_node_data, + group, + num_speaker_nodes, + num_non_crossing_planes, + non_crossing_plane_elevation_deg, + &connection_options, + &num_connection_options ) ) != IVAS_ERR_OK ) + { + return error; + } set_f( connection_arc, 0.0f, max_num_connections ); for ( c = 0; c < max_num_connections; c++ ) @@ -1678,8 +1744,10 @@ static void formulate_half_sphere_connections( } c_opt++; } + free( connection_options ); - return; + + return IVAS_ERR_OK; } diff --git a/lib_dec/jbm_jb4_circularbuffer.c b/lib_dec/jbm_jb4_circularbuffer.c index e272e21aa1cf0f265afea91511a2d324a8421d83..e68b3e170e2e71260d37eb05aeebec5e37984789 100644 --- a/lib_dec/jbm_jb4_circularbuffer.c +++ b/lib_dec/jbm_jb4_circularbuffer.c @@ -70,9 +70,14 @@ struct JB4_CIRCULARBUFFER /* Creates a circular buffer (FIFO) */ -int16_t JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) +ivas_error JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) { - JB4_CIRCULARBUFFER_HANDLE h = malloc( sizeof( struct JB4_CIRCULARBUFFER ) ); + JB4_CIRCULARBUFFER_HANDLE h; + + if ( ( h = malloc( sizeof( struct JB4_CIRCULARBUFFER ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } h->data = NULL; h->capacity = 0; @@ -81,7 +86,7 @@ int16_t JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ) *ph = h; - return 0; + return IVAS_ERR_OK; } @@ -119,13 +124,17 @@ int16_t JB4_CIRCULARBUFFER_Init( { /* keep one element free to be able to decide between full/empty buffer */ ++capacity; - h->data = malloc( capacity * sizeof( JB4_CIRCULARBUFFER_ELEMENT ) ); + + if ( ( h->data = malloc( capacity * sizeof( JB4_CIRCULARBUFFER_ELEMENT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } h->capacity = capacity; h->writePos = 0; h->readPos = 0; - return 0; + return IVAS_ERR_OK; } diff --git a/lib_dec/jbm_jb4_circularbuffer.h b/lib_dec/jbm_jb4_circularbuffer.h index 0891cdfd116126e4d5a54ec2dce378806e2964f3..e14144b329e0984730809384e565db6c9b42b6ae 100644 --- a/lib_dec/jbm_jb4_circularbuffer.h +++ b/lib_dec/jbm_jb4_circularbuffer.h @@ -47,7 +47,7 @@ typedef struct JB4_CIRCULARBUFFER *JB4_CIRCULARBUFFER_HANDLE; typedef int32_t JB4_CIRCULARBUFFER_ELEMENT; -int16_t JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ); +ivas_error JB4_CIRCULARBUFFER_Create( JB4_CIRCULARBUFFER_HANDLE *ph ); void JB4_CIRCULARBUFFER_Destroy( JB4_CIRCULARBUFFER_HANDLE *ph ); diff --git a/lib_dec/jbm_jb4_inputbuffer.c b/lib_dec/jbm_jb4_inputbuffer.c index 8cec3bdf6120bcc58d027da44f89c4a1c8e84be2..925e35dfff2c23e7b28ad59f400d836f6cda0939 100644 --- a/lib_dec/jbm_jb4_inputbuffer.c +++ b/lib_dec/jbm_jb4_inputbuffer.c @@ -67,10 +67,15 @@ struct JB4_INPUTBUFFER /* Creates a input buffer */ -int16_t JB4_INPUTBUFFER_Create( +ivas_error JB4_INPUTBUFFER_Create( JB4_INPUTBUFFER_HANDLE *ph ) { - JB4_INPUTBUFFER_HANDLE h = malloc( sizeof( struct JB4_INPUTBUFFER ) ); + JB4_INPUTBUFFER_HANDLE h; + + if ( ( h = malloc( sizeof( struct JB4_INPUTBUFFER ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } h->data = NULL; h->capacity = 0; @@ -80,7 +85,7 @@ int16_t JB4_INPUTBUFFER_Create( *ph = h; - return 0; + return IVAS_ERR_OK; } @@ -99,8 +104,12 @@ void JB4_INPUTBUFFER_Destroy( { return; } + if ( h->data ) + { free( h->data ); + } + free( h ); *ph = NULL; @@ -109,7 +118,7 @@ void JB4_INPUTBUFFER_Destroy( /* Initializes a input buffer with a fixed maximum allowed number of elements */ -int16_t JB4_INPUTBUFFER_Init( +ivas_error JB4_INPUTBUFFER_Init( JB4_INPUTBUFFER_HANDLE h, uint16_t capacity, int16_t ( *compareFunction )( const JB4_INPUTBUFFER_ELEMENT first, const JB4_INPUTBUFFER_ELEMENT second, bool *replaceWithNewElementIfEqual ) ) @@ -117,13 +126,17 @@ int16_t JB4_INPUTBUFFER_Init( /* keep one element free to be able to decide between full/empty buffer */ ++capacity; - h->data = malloc( capacity * sizeof( JB4_INPUTBUFFER_ELEMENT ) ); + if ( ( h->data = malloc( capacity * sizeof( JB4_INPUTBUFFER_ELEMENT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } + h->capacity = capacity; h->writePos = 0; h->readPos = 0; h->compareFunction = compareFunction; - return 0; + return IVAS_ERR_OK; } diff --git a/lib_dec/jbm_jb4_inputbuffer.h b/lib_dec/jbm_jb4_inputbuffer.h index 7af58a31d309f6dc09644bb3021861730386f17d..6087ecb20717b76c316e2349ca79a0e95131629e 100644 --- a/lib_dec/jbm_jb4_inputbuffer.h +++ b/lib_dec/jbm_jb4_inputbuffer.h @@ -48,14 +48,11 @@ typedef struct JB4_INPUTBUFFER *JB4_INPUTBUFFER_HANDLE; typedef void *JB4_INPUTBUFFER_ELEMENT; -int16_t JB4_INPUTBUFFER_Create( JB4_INPUTBUFFER_HANDLE *ph ); +ivas_error JB4_INPUTBUFFER_Create( JB4_INPUTBUFFER_HANDLE *ph ); void JB4_INPUTBUFFER_Destroy( JB4_INPUTBUFFER_HANDLE *ph ); -int16_t JB4_INPUTBUFFER_Init( - JB4_INPUTBUFFER_HANDLE h, - uint16_t capacity, - int16_t ( *compareFunction )( const JB4_INPUTBUFFER_ELEMENT newElement, const JB4_INPUTBUFFER_ELEMENT arrayElement, bool *replaceWithNewElementIfEqual ) ); +ivas_error JB4_INPUTBUFFER_Init( JB4_INPUTBUFFER_HANDLE h, uint16_t capacity, int16_t ( *compareFunction )( const JB4_INPUTBUFFER_ELEMENT newElement, const JB4_INPUTBUFFER_ELEMENT arrayElement, bool *replaceWithNewElementIfEqual ) ); int16_t JB4_INPUTBUFFER_Enque( JB4_INPUTBUFFER_HANDLE h, JB4_INPUTBUFFER_ELEMENT element, JB4_INPUTBUFFER_ELEMENT *replacedElement ); diff --git a/lib_dec/jbm_jb4_jmf.c b/lib_dec/jbm_jb4_jmf.c index 8ec24046f03c8b3e9d3254f23d9e13014bc22a74..85e9980e6ef8b11a2306f70f228227185034cfd0 100644 --- a/lib_dec/jbm_jb4_jmf.c +++ b/lib_dec/jbm_jb4_jmf.c @@ -84,19 +84,35 @@ struct JB4_JMF /** helper function to add an entry at back of the buffer */ -static void JB4_JMF_pushBack( JB4_JMF_HANDLE h, int32_t delay, int32_t offset, uint32_t time ); +static void JB4_JMF_pushBack( JB4_JMF_HANDLE h, const int32_t delay, const int32_t offset, const uint32_t time ); + /** helper function to remove an entry from the front of the buffer */ static void JB4_JMF_popFront( JB4_JMF_HANDLE h ); -int16_t JB4_JMF_Create( +ivas_error JB4_JMF_Create( JB4_JMF_HANDLE *ph ) { - JB4_JMF_HANDLE h = malloc( sizeof( struct JB4_JMF ) ); + JB4_JMF_HANDLE h; + ivas_error error; + + if ( ( h = malloc( sizeof( struct JB4_JMF ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } - JB4_CIRCULARBUFFER_Create( &h->fifo ); - JB4_CIRCULARBUFFER_Create( &h->offsetFifo ); - JB4_CIRCULARBUFFER_Create( &h->timeStampFifo ); + if ( ( error = JB4_CIRCULARBUFFER_Create( &h->fifo ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( JB4_CIRCULARBUFFER_Create( &h->offsetFifo ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( JB4_CIRCULARBUFFER_Create( &h->timeStampFifo ) ) != IVAS_ERR_OK ) + { + return error; + } h->timeScale = 1000; h->consideredFraction = 1000; @@ -108,7 +124,7 @@ int16_t JB4_JMF_Create( *ph = h; - return 0; + return IVAS_ERR_OK; } @@ -141,10 +157,10 @@ void JB4_JMF_Destroy( /* function to set the window size of the fifo and the fraction which will be considered */ int16_t JB4_JMF_Init( JB4_JMF_HANDLE h, - int16_t timeScale, - uint16_t windowSize, - uint16_t windowDuration, - uint16_t consideredFraction ) + const int16_t timeScale, + const uint16_t windowSize, + const uint16_t windowDuration, + const uint16_t consideredFraction ) { /* check parameters */ @@ -175,8 +191,8 @@ int16_t JB4_JMF_Init( /* function to calculate delay for the current packet */ int16_t JB4_JMF_PushPacket( JB4_JMF_HANDLE h, - uint32_t sysTime, - uint32_t rtpTimeStamp ) + const uint32_t sysTime, + const uint32_t rtpTimeStamp ) { int32_t rtpTimeDiff, sysTimeDiff; int32_t offset, delay; @@ -267,9 +283,9 @@ int16_t JB4_JMF_MinOffset( /* helper function to add entry at back of the buffer */ static void JB4_JMF_pushBack( JB4_JMF_HANDLE h, - int32_t delay, - int32_t offset, - uint32_t time ) + const int32_t delay, + const int32_t offset, + const uint32_t time ) { int32_t minTime, maxTime; uint32_t duration; diff --git a/lib_dec/jbm_jb4_jmf.h b/lib_dec/jbm_jb4_jmf.h index 745d61ce92f3d2916ec7d6022a7c162efc5a0e8b..5efff7cd5ee36c4a91bf2f4cf0dc3b400161f590 100644 --- a/lib_dec/jbm_jb4_jmf.h +++ b/lib_dec/jbm_jb4_jmf.h @@ -45,13 +45,13 @@ /** handle for jitter measure fifo - a fifo used for windowed measure of network status */ typedef struct JB4_JMF *JB4_JMF_HANDLE; -int16_t JB4_JMF_Create( JB4_JMF_HANDLE *ph ); +ivas_error JB4_JMF_Create( JB4_JMF_HANDLE *ph ); void JB4_JMF_Destroy( JB4_JMF_HANDLE *ph ); -int16_t JB4_JMF_Init( JB4_JMF_HANDLE h, int16_t timeScale, uint16_t windowSize, uint16_t windowDuration, uint16_t consideredFraction ); +int16_t JB4_JMF_Init( JB4_JMF_HANDLE h, const int16_t timeScale, const uint16_t windowSize, const uint16_t windowDuration, const uint16_t consideredFraction ); -int16_t JB4_JMF_PushPacket( JB4_JMF_HANDLE h, uint32_t sysTime, uint32_t rtpTimeStamp ); +int16_t JB4_JMF_PushPacket( JB4_JMF_HANDLE h, const uint32_t sysTime, const uint32_t rtpTimeStamp ); int16_t JB4_JMF_Jitter( const JB4_JMF_HANDLE h, uint32_t *jitter ); diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 07d6acce9371459da0ef00ec09423bbfe72f4f5a..755187b640347bd9d61a94b0fdb75342e636c13b 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -61,7 +61,7 @@ #define MAXOFFSET 10 /*! Calculates the difference between two RTP timestamps - the diff is positive, if B 'later', negative otherwise */ -static int32_t JB4_rtpTimeStampDiff( uint32_t tsA, uint32_t tsB ); +static int32_t JB4_rtpTimeStampDiff( const uint32_t tsA, const uint32_t tsB ); /* function to calculate different options for the target playout delay */ static void JB4_targetPlayoutDelay( const JB4_HANDLE h, uint32_t *targetMin, uint32_t *targetMax, uint32_t *targetDtx, uint32_t *targetStartUp ); /*! function to do playout adaptation before playing the next data unit */ @@ -88,18 +88,18 @@ static int16_t JB4_inspectBufferForDropping( const JB4_HANDLE h, bool *dropEarly /* function to look into the buffer and check if it makes sense to drop a data unit during DTX */ static int16_t JB4_checkDtxDropping( const JB4_HANDLE h ); /*! function to estimate the short term jitter */ -static void JB4_estimateShortTermJitter( JB4_HANDLE h, uint32_t rcvTime, uint32_t rtpTimeStamp ); +static void JB4_estimateShortTermJitter( JB4_HANDLE h, const uint32_t rcvTime, const uint32_t rtpTimeStamp ); /*! function to pop a data unit from the buffer */ -static void JB4_popFromBuffer( JB4_HANDLE h, uint32_t sysTime, JB4_DATAUNIT_HANDLE *pDataUnit ); +static void JB4_popFromBuffer( JB4_HANDLE h, const uint32_t sysTime, JB4_DATAUNIT_HANDLE *pDataUnit ); /*! function to drop a data unit from the buffer - updates nShrinked */ static void JB4_dropFromBuffer( JB4_HANDLE h ); /*! function to calculate the playout delay based on the current jitter */ /*! @param[in] playTime the system time when the data unit will be played * @param[in] timeStamp the time stamp of the data unit to played * @param[out] delay the calculated playout delay */ -static int16_t JB4_playoutDelay( const JB4_HANDLE h, uint32_t playTime, uint32_t rtpTimeStamp, uint32_t *delay ); +static int16_t JB4_playoutDelay( const JB4_HANDLE h, const uint32_t playTime, const uint32_t rtpTimeStamp, uint32_t *delay ); /*! function to update lastPlayoutDelay and lastTargetTime after popFromBuffer() */ -static void JB4_updateLastTimingMembers( JB4_HANDLE h, uint32_t playTime, uint32_t rtpTimeStamp ); +static void JB4_updateLastTimingMembers( JB4_HANDLE h, const uint32_t playTime, const uint32_t rtpTimeStamp ); /*! function to compare the RTP time stamps of two data units: newElement==arrayElement ? 0 : (newElement>arrayElement ? +1 : -1) */ static int16_t JB4_inputBufferCompareFunction( const JB4_INPUTBUFFER_ELEMENT newElement, const JB4_INPUTBUFFER_ELEMENT arrayElement, bool *replaceWithNewElementIfEqual ); @@ -207,6 +207,7 @@ ivas_error JB4_Create( { int16_t iter; JB4_HANDLE h; + ivas_error error; if ( ( h = malloc( sizeof( struct JB4 ) ) ) == NULL ) { @@ -228,12 +229,23 @@ ivas_error JB4_Create( /* internal configuration values - do not change!!! */ h->timeScale = 0; h->frameDuration = 0; + /* jitter buffer configuration values: done in JB4_Init() */ /* short term jitter evaluation */ - JB4_JMF_Create( &h->stJmf ); - JB4_CIRCULARBUFFER_Create( &h->stJitterFifo ); - JB4_CIRCULARBUFFER_Create( &h->stTimeStampFifo ); + if ( ( error = JB4_JMF_Create( &h->stJmf ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = JB4_CIRCULARBUFFER_Create( &h->stJitterFifo ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = JB4_CIRCULARBUFFER_Create( &h->stTimeStampFifo ) ) != IVAS_ERR_OK ) + { + return error; + } h->stJitter = 0; + /* jitter buffer data */ h->firstDataUnitPopped = false; h->prevPopSysTime = 0; @@ -266,11 +278,18 @@ ivas_error JB4_Create( move32(); /* members to store the data units */ - JB4_INPUTBUFFER_Create( &h->inputBuffer ); + if ( ( error = JB4_INPUTBUFFER_Create( &h->inputBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } + /* allocate memory for data units */ for ( iter = 0; iter < MAX_JBM_SLOTS; ++iter ) { - h->memorySlots[iter].data = malloc( MAX_AU_SIZE ); + if ( ( h->memorySlots[iter].data = malloc( MAX_AU_SIZE ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JB4 structure\n" ) ); + } h->freeMemorySlots[iter] = &h->memorySlots[iter]; } h->nFreeMemorySlots = MAX_JBM_SLOTS; @@ -314,12 +333,13 @@ void JB4_Destroy( } -int16_t JB4_Init( +ivas_error JB4_Init( JB4_HANDLE h, - int16_t safetyMargin ) + const int16_t safetyMargin ) { uint16_t ltJmfSize, stFifoSize, stJmfSize, stJmfAllowedLateLoss; uint16_t inputBufferCapacity; + ivas_error error; /* internal timescale is 1000, frame duration is 20ms */ h->timeScale = 1000; /* ms */ @@ -340,9 +360,13 @@ int16_t JB4_Init( JB4_JMF_Init( h->stJmf, h->timeScale, stJmfSize, h->timeScale /* 1s */, (uint16_t) ( 1000 - stJmfAllowedLateLoss ) ); inputBufferCapacity = MAX_JBM_SLOTS - 2; - JB4_INPUTBUFFER_Init( h->inputBuffer, inputBufferCapacity, JB4_inputBufferCompareFunction ); - return 0; + if ( ( error = JB4_INPUTBUFFER_Init( h->inputBuffer, inputBufferCapacity, JB4_inputBufferCompareFunction ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; } @@ -383,7 +407,7 @@ void JB4_FreeDataUnit( int16_t JB4_PushDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit, - uint32_t rcvTime ) + const uint32_t rcvTime ) { JB4_DATAUNIT_HANDLE droppedDataUnit = NULL; @@ -551,8 +575,8 @@ int16_t JB4_FECoffset( int16_t JB4_PopDataUnit( JB4_HANDLE h, - uint32_t sysTime, - uint32_t extBufferedTime, + const uint32_t sysTime, + const uint32_t extBufferedTime, JB4_DATAUNIT_HANDLE *pDataUnit, uint32_t *scale, uint32_t *maxScaling ) @@ -574,8 +598,8 @@ int16_t JB4_PopDataUnit( /* Calculates the difference between two RTP timestamps - the diff is positive, if B 'later', negative otherwise */ static int32_t JB4_rtpTimeStampDiff( - uint32_t tsA, - uint32_t tsB ) + const uint32_t tsA, + const uint32_t tsB ) { int32_t ret; /* do not dare to inline this function, casting to int32_t is important here! */ @@ -1058,8 +1082,8 @@ static int16_t JB4_checkDtxDropping( /* function to estimate the short term jitter */ static void JB4_estimateShortTermJitter( JB4_HANDLE h, - uint32_t rcvTime, - uint32_t rtpTimeStamp ) + const uint32_t rcvTime, + const uint32_t rtpTimeStamp ) { uint32_t jitter, duration, maxDuration; int32_t minTime, maxTime; @@ -1121,7 +1145,7 @@ static void JB4_estimateShortTermJitter( /* function to pop a data unit from the buffer */ static void JB4_popFromBuffer( JB4_HANDLE h, - uint32_t sysTime, + const uint32_t sysTime, JB4_DATAUNIT_HANDLE *pDataUnit ) { JB4_DATAUNIT_HANDLE nextDataUnit; @@ -1430,8 +1454,8 @@ static void JB4_dropFromBuffer( /* function to calculate the playout delay based on the current jitter */ static int16_t JB4_playoutDelay( const JB4_HANDLE h, - uint32_t playTime, - uint32_t rtpTimeStamp, + const uint32_t playTime, + const uint32_t rtpTimeStamp, uint32_t *delay ) { int32_t minOffTicks; @@ -1450,8 +1474,8 @@ static int16_t JB4_playoutDelay( /* function to update lastPlayoutDelay and lastTargetTime after popFromBuffer() */ static void JB4_updateLastTimingMembers( JB4_HANDLE h, - uint32_t playTime, - uint32_t rtpTimeStamp ) + const uint32_t playTime, + const uint32_t rtpTimeStamp ) { int32_t minOffTicks; diff --git a/lib_dec/jbm_jb4sb.h b/lib_dec/jbm_jb4sb.h index 6b31111670cc7c7a185d8284a710263e54131d98..7954358595a32c3dceff516f4a04a87c73b09648 100644 --- a/lib_dec/jbm_jb4sb.h +++ b/lib_dec/jbm_jb4sb.h @@ -78,6 +78,14 @@ struct JB4_DATAUNIT int16_t nextCoderType; }; +#ifdef JBM_TSM_ON_TCS +typedef enum +{ + JBM_RENDERER_NONE, + JBM_RENDERER_IVAS, +} JBM_RENDERER_TYPE; +#endif + typedef struct JB4_DATAUNIT *JB4_DATAUNIT_HANDLE; @@ -85,15 +93,15 @@ ivas_error JB4_Create( JB4_HANDLE *ph ); void JB4_Destroy( JB4_HANDLE *ph ); -int16_t JB4_Init( JB4_HANDLE h, int16_t safetyMargin ); +ivas_error JB4_Init( JB4_HANDLE h, const int16_t safetyMargin ); JB4_DATAUNIT_HANDLE JB4_AllocDataUnit( JB4_HANDLE h ); void JB4_FreeDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit ); -int16_t JB4_PushDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit, uint32_t rcvTime ); +int16_t JB4_PushDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit, const uint32_t rcvTime ); -int16_t JB4_PopDataUnit( JB4_HANDLE h, uint32_t sysTime, uint32_t extBufferedTime, JB4_DATAUNIT_HANDLE *pDataUnit, uint32_t *scale, uint32_t *maxScaling ); +int16_t JB4_PopDataUnit( JB4_HANDLE h, const uint32_t sysTime, const uint32_t extBufferedTime, JB4_DATAUNIT_HANDLE *pDataUnit, uint32_t *scale, uint32_t *maxScaling ); int16_t JB4_getFECoffset( JB4_HANDLE h ); diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index c09a21e790ea624e198d1fb0d1a756e13f92b728..713c2327a0e0ed0d1a9026408a4b8e25989262d7 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -66,7 +66,12 @@ struct apa_state_t { /* output buffer */ +#ifdef JBM_TSM_ON_TCS + bool evs_compat_mode; + float *buf_out; +#else int16_t *buf_out; +#endif uint16_t buf_out_capacity; uint16_t l_buf_out; @@ -86,6 +91,14 @@ struct apa_state_t /* total number of processed input samples since apa_reset() */ uint32_t l_in_total; +#ifdef JBM_TSM_ON_TCS + /* time resolution in samples of the IVAS renderer*/ + uint16_t l_ts; + + /* samples already available in the renderer buffer */ + uint16_t l_r_buf; +#endif + /* sum of inserted/removed samples since last apa_set_scale() */ int32_t diffSinceSetScale; /* number of input frames since last apa_set_scale() */ @@ -123,6 +136,17 @@ static float apa_corrEnergy2dB( float energy, uint16_t corr_len ); static float apa_getQualityIncreaseForLowEnergy( float energydB ); +#ifdef JBM_TSM_ON_TCS +static bool logarithmic_search( const apa_state_t *ps, const float *signal, int16_t s_start, uint16_t inlen, uint16_t offset, uint16_t fixed_pos, uint16_t corr_len, uint16_t wss, uint16_t css, int16_t *synchpos ); + +static bool find_synch( apa_state_t *ps, const float *in, uint16_t l_in, int16_t s_start, uint16_t s_len, int16_t fixed_pos, uint16_t corr_len, uint16_t offset, float *energy, float *quality, int16_t *synch_pos ); + +static bool copy_frm( apa_state_t *ps, const float frm_in[], float frm_out[], uint16_t *l_frm_out ); + +static bool shrink_frm( apa_state_t *ps, const float frm_in[], uint16_t maxScaling, float frm_out[], uint16_t *l_frm_out ); + +static bool extend_frm( apa_state_t *ps, const float frm_in[], float frm_out[], uint16_t *l_frm_out ); +#else static bool logarithmic_search( const apa_state_t *ps, const int16_t *signal, int16_t s_start, uint16_t inlen, uint16_t offset, uint16_t fixed_pos, uint16_t corr_len, uint16_t wss, uint16_t css, int16_t *synchpos ); static bool find_synch( apa_state_t *ps, const int16_t *in, uint16_t l_in, int16_t s_start, uint16_t s_len, int16_t fixed_pos, uint16_t corr_len, uint16_t offset, float *energy, float *quality, int16_t *synch_pos ); @@ -132,16 +156,16 @@ static bool copy_frm( apa_state_t *ps, const int16_t frm_in[], int16_t frm_out[] static bool shrink_frm( apa_state_t *ps, const int16_t frm_in[], uint16_t maxScaling, int16_t frm_out[], uint16_t *l_frm_out ); static bool extend_frm( apa_state_t *ps, const int16_t frm_in[], int16_t frm_out[], uint16_t *l_frm_out ); - +#endif /*---------------------------------------------------------------------* * Public functions *---------------------------------------------------------------------*/ /* Allocates memory for state struct and initializes elements. */ -uint8_t apa_init( +ivas_error apa_init( apa_state_t **pps, - int32_t num_channels ) + const int32_t num_channels ) { apa_state_t *ps = NULL; @@ -152,22 +176,26 @@ uint8_t apa_init( } /* allocate state struct */ - ps = (apa_state_t *) malloc( sizeof( apa_state_t ) ); - if ( !ps ) + if ( ( ps = (apa_state_t *) malloc( sizeof( apa_state_t ) ) ) == NULL ) { - return 2; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); } + ps->num_channels = (uint16_t) num_channels; ps->buf_out_capacity = (uint16_t) ( APA_BUF_PER_CHANNEL * num_channels ); - ps->buf_out = malloc( sizeof( float ) * ps->buf_out_capacity ); - if ( !ps->buf_out ) + if ( ( ps->buf_out = malloc( sizeof( float ) * ps->buf_out_capacity ) ) == NULL ) { - return 2; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); } + +#ifdef JBM_TSM_ON_TCS + ps->evs_compat_mode = false; +#endif + apa_reset( ps ); *pps = ps; - return 0; + return IVAS_ERR_OK; } @@ -196,9 +224,58 @@ void apa_reset( ps->bad_frame_count = 0; ps->good_frame_count = 0; +#ifdef JBM_TSM_ON_TCS + ps->l_ts = 1; + ps->l_r_buf = 0; +#endif return; } +#ifdef JBM_TSM_ON_TCS +uint8_t apa_reconfigure( + apa_state_t *ps, + uint16_t num_channels, + uint16_t l_ts ) +{ + + /* realloc buffer */ + free( ps->buf_out ); + ps->num_channels = (uint16_t) num_channels; + ps->buf_out_capacity = (uint16_t) ( APA_BUF_PER_CHANNEL * num_channels ); + ps->buf_out = (float *) malloc( sizeof( float ) * ps->buf_out_capacity ); + if ( !ps->buf_out ) + { + return 2; + } + ps->l_buf_out = 0; + ps->l_in_total = 0; + ps->l_ts = ps->num_channels * l_ts; + + /* set everything else dependent on the number of channels */ + /* set segment size */ + /* in the order of a pitch, set to 160 samples at 16 kHz */ + /* used for windowing and as the correlation length, i.e., */ + /* the size of the template segment. */ + ps->l_seg = ( ps->rate / 100 ) * ps->num_channels; + + /* set frame size */ + /* set to 320 samples at 16 kHz */ + ps->l_frm = ( ps->rate / FRAMES_PER_SEC ) * ps->num_channels; + + /* set minimum pitch */ + /* set to 40 samples at 16 kHz */ + /* (defines min change in number of samples, i.e., abs(l_in-l_out) >= p_min) */ + ps->p_min = ( ps->rate / 400 ) * ps->num_channels; + + /* set search length */ + /* must cover one pitch, set to 200 samples at 16 kHz */ + /* (the resulting maximum pitch is then p_min+l_search = 240 samples at 16 kHz) */ + ps->l_search = ( ps->rate / 80 ) * ps->num_channels; + + return 0; +} + +#endif /* Sets the audio configuration. */ bool apa_set_rate( @@ -302,6 +379,52 @@ bool apa_set_scale( return 0; } +#ifdef JBM_TSM_ON_TCS +bool apa_set_renderer_granularity( + apa_state_t *ps, + uint16_t l_ts ) +{ + /* make sure pointer is valid */ + if ( ps == NULL ) + { + return 1; + } + + + /* copy to state struct */ + ps->l_ts = l_ts * ps->num_channels; + return 0; +} + +bool apa_set_renderer_residual_samples( + apa_state_t *ps, + uint16_t l_r_buf ) +{ + /* make sure pointer is valid */ + if ( ps == NULL ) + { + return 1; + } + + + /* copy to state struct */ + ps->l_r_buf = l_r_buf * ps->num_channels; + return 0; +} + +bool apa_set_evs_compat_mode( apa_state_t *ps, bool mode ) +{ + /* make sure pointer is valid */ + if ( ps == NULL ) + { + return 1; + } + + ps->evs_compat_mode = mode; + + return 0; +} +#endif /* ******************************************************************************** @@ -454,16 +577,28 @@ bool apa_exit( ******************************************************************************** */ uint8_t apa_exec( - apa_state_t *ps, /* i/o: state struct */ - const int16_t a_in[], /* i : input samples */ - uint16_t l_in, /* i : number of input samples */ - uint16_t maxScaling, /* i : allowed number of inserted/removed samples */ - int16_t a_out[], /* o : output samples */ - uint16_t *l_out /* o : number of output samples */ + apa_state_t *ps, /* i/o: state struct */ +#ifdef JBM_TSM_ON_TCS + const float a_in[], /* i : input samples */ +#else + const int16_t a_in[], /* i : input samples */ +#endif + uint16_t l_in, /* i : number of input samples */ + uint16_t maxScaling, /* i : allowed number of inserted/removed samples */ +#ifdef JBM_TSM_ON_TCS + float a_out[], /* o : output samples */ +#else + int16_t a_out[], /* o : output samples */ +#endif + uint16_t *l_out /* o : number of output samples */ ) { uint16_t i; +#ifdef JBM_TSM_ON_TCS + float frm_in[APA_BUF]; /* TODO(mcjbm): this buffer could be smaller - always allocates space for 16 channels */ +#else int16_t frm_in[APA_BUF]; /* TODO(mcjbm): this buffer could be smaller - always allocates space for 16 channels */ +#endif uint16_t l_frm_out; int16_t l_rem; int32_t dl_scaled, dl_copied, l_frm_out_target; @@ -525,8 +660,13 @@ uint8_t apa_exec( } else { +#ifdef JBM_TSM_ON_TCS + float *buf_out_ptr = &( ps->buf_out[ps->l_buf_out - ps->l_frm] ); + float *frm_in_ptr = &( frm_in[ps->l_frm] ); +#else int16_t *buf_out_ptr = &( ps->buf_out[ps->l_buf_out - ps->l_frm] ); int16_t *frm_in_ptr = &( frm_in[ps->l_frm] ); +#endif /* fill input frame */ /* 1st input frame: previous output samples */ @@ -581,8 +721,13 @@ uint8_t apa_exec( /* discard old samples; always keep at least most recent l_frm samples */ if ( ( ps->l_buf_out + l_frm_out ) > ps->buf_out_capacity ) { +#ifdef JBM_TSM_ON_TCS + float *buf_out_ptr1 = ps->buf_out; + float *buf_out_ptr2; +#else int16_t *buf_out_ptr1 = ps->buf_out; int16_t *buf_out_ptr2; +#endif l_rem = ( ps->l_frm - l_frm_out ); if ( l_rem < 0 ) @@ -602,7 +747,11 @@ uint8_t apa_exec( return 5; } { +#ifdef JBM_TSM_ON_TCS + float *buf_out_ptr = &( ps->buf_out[ps->l_buf_out] ); +#else int16_t *buf_out_ptr = &( ps->buf_out[ps->l_buf_out] ); +#endif for ( i = 0; i < l_frm_out; i++ ) { buf_out_ptr[i] = a_out[i]; @@ -660,7 +809,11 @@ uint8_t apa_exec( */ static void get_scaling_quality( const apa_state_t *ps, +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else const int16_t *signal, +#endif uint16_t s_len, uint16_t offset, uint16_t corr_len, @@ -813,7 +966,11 @@ static float apa_getQualityIncreaseForLowEnergy( */ static bool logarithmic_search( const apa_state_t *ps, +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else const int16_t *signal, +#endif int16_t s_start, uint16_t inlen, uint16_t offset, @@ -926,7 +1083,11 @@ static bool logarithmic_search( */ static bool find_synch( apa_state_t *ps, +#ifdef JBM_TSM_ON_TCS + const float *in, +#else const int16_t *in, +#endif uint16_t l_in, int16_t s_start, uint16_t s_len, @@ -981,8 +1142,13 @@ static bool find_synch( */ static bool copy_frm( apa_state_t *ps, +#ifdef JBM_TSM_ON_TCS + const float frm_in[], + float frm_out[], +#else const int16_t frm_in[], int16_t frm_out[], +#endif uint16_t *l_frm_out ) { uint16_t i; @@ -1029,9 +1195,17 @@ static bool copy_frm( */ static bool shrink_frm( apa_state_t *ps, +#ifdef JBM_TSM_ON_TCS + const float frm_in[], +#else const int16_t frm_in[], +#endif uint16_t maxScaling, +#ifdef JBM_TSM_ON_TCS + float frm_out[], +#else int16_t frm_out[], +#endif uint16_t *l_frm_out ) { bool findSynchResult = 0; @@ -1062,6 +1236,22 @@ static bool shrink_frm( /* maximum scaling */ energy = -65; quality = 5; +#ifdef JBM_TSM_ON_TCS + xtract = maxScaling; + /* take samples already in the renderer buf into account */ + xtract += ps->l_r_buf; + /* snap to renderer time slot borders */ + xtract -= ( ps->l_ts - ( l_frm - xtract + ps->l_r_buf ) % ps->l_ts ); + while ( xtract < 0 ) + { + xtract += ps->l_ts; + } + while ( xtract > ( s_end - ps->num_channels ) ) + { + /* exceeded the possible shrinking, go back one renderer ts*/ + xtract -= ps->l_ts; + } +#else if ( maxScaling != 0U && s_end > maxScaling + 1 ) { xtract = maxScaling; @@ -1071,6 +1261,7 @@ static bool shrink_frm( /* set to last valid element (i.e. element[len - 1] but note for stereo last element is last pair of samples) */ xtract = s_end - ps->num_channels; } +#endif } else { @@ -1118,7 +1309,18 @@ static bool shrink_frm( { return 1; } - overlapAdd( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); +#ifdef JBM_TSM_ON_TCS + if ( ps->evs_compat_mode == true ) + { + overlapAddEvs( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); + } + else + { +#endif + overlapAdd( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); +#ifdef JBM_TSM_ON_TCS + } +#endif } else { @@ -1165,8 +1367,13 @@ static bool shrink_frm( */ static bool extend_frm( apa_state_t *ps, +#ifdef JBM_TSM_ON_TCS + const float frm_in[], + float frm_out[], +#else const int16_t frm_in[], int16_t frm_out[], +#endif uint16_t *l_frm_out ) { bool findSynchResult = 0; @@ -1180,8 +1387,14 @@ static bool extend_frm( int16_t s_start = 0; float energy, quality = 0.0f; uint16_t l_frm, l_seg; +#ifdef JBM_TSM_ON_TCS + const float *fadeOut, *fadeIn; + float *out; +#else const int16_t *fadeOut, *fadeIn; int16_t *out; +#endif + l_frm = ps->l_frm; l_seg = ps->l_seg; @@ -1271,6 +1484,12 @@ static bool extend_frm( energy = -65; quality = 5; xtract[n] = s_start + ps->num_channels; +#ifdef JBM_TSM_ON_TCS + /* take renderer buffer samples into accout */ + xtract[n] += ps->l_r_buf; + /* snap to next renderer time slot border to resynchronize */ + xtract[n] -= ( ( N - 1 ) * l_seg - xtract[n] + ps->l_r_buf ) % ps->l_ts; +#endif } else { @@ -1327,13 +1546,29 @@ static bool extend_frm( fadeOut = frm_in + l_frm + xtract[n - 1] + l_seg; fadeIn = frm_in + l_frm + xtract[n]; out = frm_out + ( n - 2 ) * l_seg; - overlapAdd( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); +#ifdef JBM_TSM_ON_TCS + if ( ps->evs_compat_mode == true ) + { + overlapAddEvs( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); + } + else + { +#endif + overlapAdd( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); +#ifdef JBM_TSM_ON_TCS + } +#endif } else { /* just copy down 1st half of current segment (= 2nd half of previous segment) */ +#ifdef JBM_TSM_ON_TCS + float *frm_out_ptr; + const float *frm_in_ptr; +#else int16_t *frm_out_ptr; const int16_t *frm_in_ptr; +#endif frm_out_ptr = &( frm_out[( n - 2 ) * l_seg] ); frm_in_ptr = &( frm_in[l_frm + xtract[n]] ); for ( i = 0; i < l_seg; i++ ) diff --git a/lib_dec/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h index 2f0da13e9941abd012b4ac35db520d8e9d3c5eb4..a5e7cb7d61ab0810bf36913fd761bc39946a8a00 100644 --- a/lib_dec/jbm_pcmdsp_apa.h +++ b/lib_dec/jbm_pcmdsp_apa.h @@ -91,8 +91,8 @@ typedef struct apa_state_t *PCMDSP_APA_HANDLE; /*! Allocates memory for state struct and initializes elements. * @return 0 on success, 1 on failure */ -uint8_t apa_init( apa_state_t **s, - int32_t num_channels ); +ivas_error apa_init( apa_state_t **s, + const int32_t num_channels ); /*! Sets state variables to initial value. */ void apa_reset( apa_state_t *s ); @@ -114,12 +114,26 @@ bool apa_set_rate( apa_state_t *ps, const int32_t output_Fs ); * @return 0 on success, 1 on failure */ bool apa_set_scale( apa_state_t *s, uint16_t scale ); +#ifdef JBM_TSM_ON_TCS +bool apa_set_renderer_granularity( apa_state_t *ps, uint16_t l_ts ); + +bool apa_set_renderer_residual_samples( apa_state_t *ps, uint16_t l_r_buf ); + +bool apa_set_evs_compat_mode( apa_state_t *ps, bool mode ); + +uint8_t apa_reconfigure( apa_state_t *ps, uint16_t num_channels, uint16_t l_ts ); +#endif + bool apa_set_complexity_options( apa_state_t *s, uint16_t wss, uint16_t css ); bool apa_set_quality( apa_state_t *s, float quality, uint16_t qualityred, uint16_t qualityrise ); bool apa_exit( apa_state_t **s ); +#ifdef JBM_TSM_ON_TCS +uint8_t apa_exec( apa_state_t *s, const float a_in[], uint16_t l_in, uint16_t maxScaling, float a_out[], uint16_t *l_out ); +#else uint8_t apa_exec( apa_state_t *s, const int16_t a_in[], uint16_t l_in, uint16_t maxScaling, int16_t a_out[], uint16_t *l_out ); +#endif #endif /* JBM_PCMDSP_APA_H */ diff --git a/lib_dec/jbm_pcmdsp_fifo.c b/lib_dec/jbm_pcmdsp_fifo.c index 522da30dde0ef79caeb137be4003b1a831bb6711..fd0df04ca8efac158aade1d4d66085cd601da55c 100644 --- a/lib_dec/jbm_pcmdsp_fifo.c +++ b/lib_dec/jbm_pcmdsp_fifo.c @@ -48,10 +48,15 @@ /* Creates a FIFO. */ -int16_t pcmdsp_fifo_create( +ivas_error pcmdsp_fifo_create( PCMDSP_FIFO_HANDLE *ph ) { - PCMDSP_FIFO_HANDLE h = malloc( sizeof( struct PCMDSP_FIFO ) ); + PCMDSP_FIFO_HANDLE h; + + if ( ( h = malloc( sizeof( struct PCMDSP_FIFO ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } h->size = 0; h->capacity = 0; @@ -63,7 +68,7 @@ int16_t pcmdsp_fifo_create( *ph = h; - return 0; + return IVAS_ERR_OK; } @@ -95,7 +100,7 @@ void pcmdsp_fifo_destroy( } /* Initializes the FIFO with a fixed maximum allowed number audio samples. */ -int16_t pcmdsp_fifo_init( +ivas_error pcmdsp_fifo_init( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint16_t nChannels, @@ -106,12 +111,25 @@ int16_t pcmdsp_fifo_init( h->capacity = nSamplesPerChannel; h->nBytesPerSampleSet = nChannels * nBytesPerSample; nDataBytes = nSamplesPerChannel * h->nBytesPerSampleSet; - h->dataBegin = malloc( nDataBytes ); + if ( ( h->dataBegin = malloc( nDataBytes ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); + } + +#ifdef DEBUGGING + { + uint32_t i; + for ( i = 0; i < nDataBytes; i++ ) + { + h->dataBegin[i] = 0; + } + } +#endif h->dataEnd = h->dataBegin + nDataBytes; h->dataWriteIterator = h->dataBegin; h->dataReadIterator = h->dataBegin; - return 0; + return IVAS_ERR_OK; } @@ -157,6 +175,49 @@ int16_t pcmdsp_fifo_write( return 0; } +#ifdef JBM_TSM_ON_TCS +/* Writes the given audio data to the FIFO. */ +int16_t pcmdsp_fifo_write_zero( + PCMDSP_FIFO_HANDLE h, + uint16_t nSamplesPerChannel ) +{ + uint16_t nBytesToWrite; + + /* check for empty input buffer */ + if ( nSamplesPerChannel == 0U ) + { + return 0; + } + + /* check, if enough space left */ + if ( nSamplesPerChannel > h->capacity - h->size ) + { + return -1; + } + + nBytesToWrite = nSamplesPerChannel * h->nBytesPerSampleSet; + if ( h->dataWriteIterator + nBytesToWrite > h->dataEnd ) + { + /* wrap around: writing two parts */ + uint16_t bytesOfFirstPart, secondSize; + bytesOfFirstPart = (uint16_t) ( h->dataEnd - h->dataWriteIterator ); + secondSize = nBytesToWrite - bytesOfFirstPart; + set_c( (int8_t *) h->dataWriteIterator, 0, bytesOfFirstPart ); + set_c( (int8_t *) h->dataBegin, 0, secondSize ); + h->dataWriteIterator = h->dataBegin + secondSize; + } + else + { + /* no wrap around: simple write */ + set_c( (int8_t *) h->dataWriteIterator, 0, nBytesToWrite ); + h->dataWriteIterator += nBytesToWrite; + } + h->size += nSamplesPerChannel; + + return 0; +} +#endif + /* Reads the given number of audio samples from the FIFO. */ int16_t pcmdsp_fifo_read( PCMDSP_FIFO_HANDLE h, diff --git a/lib_dec/jbm_pcmdsp_fifo.h b/lib_dec/jbm_pcmdsp_fifo.h index faa482e69538ca0b7ccfb0406b5e36b85bbedc05..e6c64dc9e8e7b5cbeaa1c51f3f1ecda1cdc1f434 100644 --- a/lib_dec/jbm_pcmdsp_fifo.h +++ b/lib_dec/jbm_pcmdsp_fifo.h @@ -66,13 +66,16 @@ struct PCMDSP_FIFO typedef struct PCMDSP_FIFO *PCMDSP_FIFO_HANDLE; -int16_t pcmdsp_fifo_create( PCMDSP_FIFO_HANDLE *ph ); +ivas_error pcmdsp_fifo_create( PCMDSP_FIFO_HANDLE *ph ); void pcmdsp_fifo_destroy( PCMDSP_FIFO_HANDLE *ph ); -int16_t pcmdsp_fifo_init( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint16_t nChannels, uint16_t nBytesPerSample ); +ivas_error pcmdsp_fifo_init( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint16_t nChannels, uint16_t nBytesPerSample ); int16_t pcmdsp_fifo_write( PCMDSP_FIFO_HANDLE h, const uint8_t *samples, uint16_t nSamplesPerChannel ); +#ifdef JBM_TSM_ON_TCS +int16_t pcmdsp_fifo_write_zero( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel ); +#endif int16_t pcmdsp_fifo_read( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint8_t *samples ); diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.c b/lib_dec/jbm_pcmdsp_similarityestimation.c index f575acc7ad337f77ac81495ec36340ce1ce2ef49..e83d1f7c3769ff944fd751760a0b61bc1b301f70 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation.c @@ -52,7 +52,11 @@ /* Calculates cross correlation coefficient for template segment. */ float cross_correlation_self( +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else const int16_t *signal, +#endif uint16_t x, uint16_t y, uint16_t corr_len ) @@ -63,7 +67,11 @@ float cross_correlation_self( c_c = 0.0f; for ( j = 0; j < corr_len; j++ ) { +#ifdef JBM_TSM_ON_TCS + c_c += ( signal[j + x] * signal[j + y] ); +#else c_c += ( (float) signal[j + x] * (float) signal[j + y] ); +#endif } return c_c; @@ -71,7 +79,11 @@ float cross_correlation_self( /* Calculates cross correlation coefficient for template segment. */ float cross_correlation_subsampled_self( +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else const int16_t *signal, +#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -83,7 +95,11 @@ float cross_correlation_subsampled_self( c_c = 0.0f; for ( j = 0; j < corr_len; j += subsampling ) { +#ifdef JBM_TSM_ON_TCS + c_c += ( signal[j + x] * signal[j + y] ); +#else c_c += ( (float) signal[j + x] * (float) signal[j + y] ); +#endif } return c_c; @@ -92,7 +108,11 @@ float cross_correlation_subsampled_self( /* Calculates normalized cross correlation coefficient for template segment. */ float normalized_cross_correlation_self( +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else const int16_t *signal, +#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -102,7 +122,11 @@ float normalized_cross_correlation_self( float c_c; float energy_xy, energy_x, energy_y; uint16_t j; +#ifdef JBM_TSM_ON_TCS + const float *signal_a, *signal_b; +#else const int16_t *signal_a, *signal_b; +#endif c_c = 0.0f; energy_x = 0.0f; @@ -111,11 +135,21 @@ float normalized_cross_correlation_self( signal_b = &signal[y]; for ( j = 0; j < corr_len; j += subsampling ) { +#ifdef JBM_TSM_ON_TCS + c_c += ( signal_a[j] * signal_b[j] ); + energy_x += ( signal_a[j] ) * ( signal_a[j] ); + energy_y += ( signal_b[j] ) * ( signal_b[j] ); +#else c_c += ( (float) signal_a[j] * (float) signal_b[j] ); energy_x += ( (float) signal_a[j] ) * ( (float) signal_a[j] ); energy_y += ( (float) signal_b[j] ) * ( (float) signal_b[j] ); +#endif } +#ifdef JBM_TSM_ON_TCS + energy_xy = sqrtf( energy_x * energy_y ); +#else energy_xy = (float) sqrt( (float) energy_x * (float) energy_y ); +#endif if ( energy_xy < 1.0f ) { energy_xy = 1.0f; /* conceal silent frames */ @@ -130,7 +164,11 @@ float normalized_cross_correlation_self( /* Splits the signal into segments and checks if all of them have very low energy. */ bool isSilence( +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else const int16_t *signal, +#endif uint32_t len, uint32_t segments ) { @@ -145,7 +183,11 @@ bool isSilence( if ( ( i != 0U && i % samplesPerSegment == 0U ) || i + 1 == len ) { /* check energy of current segment */ +#ifdef JBM_TSM_ON_TCS + energy = 10 * log10f( energy / (float) samplesPerSegment ); +#else energy = 10 * (float) log10( energy / samplesPerSegment ); +#endif if ( energy > -65 ) { return false; diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.h b/lib_dec/jbm_pcmdsp_similarityestimation.h index 4dc92f27b7cff9320280124d17733c6d6f7feabc..44b4fd246a4d9881550107196c374923284a15c7 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.h +++ b/lib_dec/jbm_pcmdsp_similarityestimation.h @@ -67,7 +67,15 @@ * ******************************************************************************** */ -float cross_correlation_self( const int16_t *signal, uint16_t x, uint16_t y, uint16_t corr_len ); +float cross_correlation_self( +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else + const int16_t *signal, +#endif + uint16_t x, + uint16_t y, + uint16_t corr_len ); /* ******************************************************************************** @@ -94,7 +102,16 @@ float cross_correlation_self( const int16_t *signal, uint16_t x, uint16_t y, uin * ******************************************************************************** */ -float cross_correlation_subsampled_self( const int16_t *signal, uint16_t x, uint16_t y, uint16_t corr_len, uint16_t subsampling ); +float cross_correlation_subsampled_self( +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else + const int16_t *signal, +#endif + uint16_t x, + uint16_t y, + uint16_t corr_len, + uint16_t subsampling ); /* ******************************************************************************** @@ -132,9 +149,26 @@ float cross_correlation_subsampled_self( const int16_t *signal, uint16_t x, uint * ******************************************************************************** */ -float normalized_cross_correlation_self( const int16_t *signal, uint16_t x, uint16_t y, uint16_t corr_len, uint16_t subsampling, float *energy ); +float normalized_cross_correlation_self( +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else + const int16_t *signal, +#endif + uint16_t x, + uint16_t y, + uint16_t corr_len, + uint16_t subsampling, + float *energy ); /* Splits the signal into segments and checks if all of them have very low energy. */ -bool isSilence( const int16_t *signal, uint32_t len, uint32_t segments ); +bool isSilence( +#ifdef JBM_TSM_ON_TCS + const float *signal, +#else + const int16_t *signal, +#endif + uint32_t len, + uint32_t segments ); #endif /* JBM_PCMDSP_SIMILARITYESTIMATION_H */ diff --git a/lib_dec/jbm_pcmdsp_window.c b/lib_dec/jbm_pcmdsp_window.c index f9f71ac802093d4a0b8dbfcab05d43895dae989d..a31d368c9119d1d35361c9657998fba14d24dff5 100644 --- a/lib_dec/jbm_pcmdsp_window.c +++ b/lib_dec/jbm_pcmdsp_window.c @@ -80,9 +80,15 @@ void hannWindow( *-----------------------------------------------------------------------*/ void overlapAdd( +#ifdef JBM_TSM_ON_TCS + const float *fadeOut, + const float *fadeIn, + float *out, +#else const int16_t *fadeOut, const int16_t *fadeIn, int16_t *out, +#endif uint16_t n, uint16_t nChannels, const float *fadeOutWin, @@ -90,7 +96,11 @@ void overlapAdd( { float fdOutVal, fdInVal; int16_t i, j, hannIter; +#ifdef JBM_TSM_ON_TCS + float combinedVal; +#else int32_t combinedVal; +#endif for ( j = 0; j < nChannels; j++ ) { @@ -101,8 +111,11 @@ void overlapAdd( fdOutVal = fadeOut[i] * fadeOutWin[hannIter]; fdInVal = fadeIn[i] * fadeInWin[hannIter]; /* round combinedVal value (taking care of sign) */ +#ifdef JBM_TSM_ON_TCS + combinedVal = fdInVal + fdOutVal; + out[i] = combinedVal; +#else combinedVal = (int32_t) ( ( fdInVal + fdOutVal ) + 0.5 ); - if ( fdInVal + fdOutVal < 0.0 ) { combinedVal = (int32_t) ( ( fdInVal + fdOutVal ) - 0.5 ); @@ -117,7 +130,57 @@ void overlapAdd( { combinedVal = MIN16B; } + out[i] = (int16_t) combinedVal; +#endif + hannIter++; + } + } + + return; +} + +void overlapAddEvs( + const float *fadeOut, + const float *fadeIn, + float *out, + uint16_t n, + uint16_t nChannels, + const float *fadeOutWin, + const float *fadeInWin ) +{ + float fdOutVal, fdInVal; + int16_t i, j, hannIter; + float combinedVal; + + for ( j = 0; j < nChannels; j++ ) + { + /* reset Hann window iterator to beginning (both channels use same window) */ + hannIter = 0; + for ( i = j; i < n; i += nChannels ) + { + fdOutVal = fadeOut[i] * fadeOutWin[hannIter]; + fdInVal = fadeIn[i] * fadeInWin[hannIter]; + /* round combinedVal value (taking care of sign) */ + + combinedVal = floorf( ( fdInVal + fdOutVal ) + 0.5f ); + if ( fdInVal + fdOutVal < 0.0 ) + { + combinedVal = ceilf( ( fdInVal + fdOutVal ) - 0.5f ); + } + + /* saturate value */ + if ( combinedVal > MAX16B_FLT ) + { + combinedVal = MAX16B_FLT; + } + else if ( combinedVal < MIN16B_FLT ) + { + combinedVal = MIN16B_FLT; + } + + out[i] = combinedVal; + hannIter++; } } diff --git a/lib_dec/jbm_pcmdsp_window.h b/lib_dec/jbm_pcmdsp_window.h index 67759e97384d759c2666f260eb2fd0754afe1326..8c1823867a8fa5d614b1d73c64a0ff6cb4c06cca 100644 --- a/lib_dec/jbm_pcmdsp_window.h +++ b/lib_dec/jbm_pcmdsp_window.h @@ -61,6 +61,10 @@ void hannWindow( uint16_t n, float *w ); * @param[in] nChannels number of channels * @param[in] fadeOutWin window for fade out * @param[in] fadeInWin window for fade in */ +#ifdef JBM_TSM_ON_TCS +void overlapAdd( const float *fadeOut, const float *fadeIn, float *out, uint16_t n, uint16_t nChannels, const float *fadeOutWin, const float *fadeInWin ); +void overlapAddEvs( const float *fadeOut, const float *fadeIn, float *out, uint16_t n, uint16_t nChannels, const float *fadeOutWin, const float *fadeInWin ); +#else void overlapAdd( const int16_t *fadeOut, const int16_t *fadeIn, int16_t *out, uint16_t n, uint16_t nChannels, const float *fadeOutWin, const float *fadeInWin ); - +#endif #endif /* JBM_PCMDSP_WINDOW_H */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 1c63e3c6de32616f863718c93883e54ce9dffac4..973c8898d0619b3e46a46311b3b394e6a0fd342a 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -32,6 +32,7 @@ #include "lib_dec.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "prot.h" #include "jbm_jb4sb.h" #include "jbm_pcmdsp_apa.h" @@ -53,11 +54,27 @@ struct IVAS_DEC_VOIP uint16_t nSamplesFrame; /* Total number of samples in a frame (includes number of channels) */ JB4_HANDLE hJBM; PCMDSP_APA_HANDLE hTimeScaler; - PCMDSP_FIFO_HANDLE hFifoAfterTimeScaler; uint16_t lastDecodedWasActive; - int16_t *apaExecBuffer; /* Buffer for APA scaling */ +#ifdef JBM_TSM_ON_TCS + float *apaExecBuffer; /* Buffer for APA scaling */ +#else + int16_t *apaExecBuffer; /* Buffer for APA scaling */ +#endif JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */ uint16_t *bs_conversion_buf; /* Buffer for bitstream conversion from packed to serial */ +#ifdef VARIABLE_SPEED_DECODING + uint8_t mode; + uint16_t speedFac; + bool needNewFrame; +#endif +#ifdef JBM_TSM_ON_TCS + JBM_RENDERER_TYPE rendererType; + PCMDSP_FIFO_HANDLE hFifoOut; + uint8_t nTransportChannelsOld; + uint16_t nSamplesAvailableNext; +#else + PCMDSP_FIFO_HANDLE hFifoAfterTimeScaler; +#endif #ifdef SUPPORT_JBM_TRACEFILE IVAS_JBM_TRACE_DATA JbmTraceData; #endif @@ -92,10 +109,26 @@ static void IVAS_DEC_Close_VoIP( IVAS_DEC_VOIP *hVoIP ); #ifdef SUPPORT_JBM_TRACEFILE static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, const uint32_t systemTimestamp_ms, const uint16_t extBufferedSamples, const int32_t output_Fs ); #endif +#ifdef JBM_TSM_ON_TCS +static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, float *floatBuf, int16_t *pcmBuf ); +#else static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, int16_t *pcmBuf ); +#endif static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); -static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig, const int16_t orientation_tracking, const float no_diegetic_pan ); - +#ifdef NON_DIEGETIC_PAN +static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig, const int16_t orientation_tracking ); +#else +static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig, const int16_t orientation_tracking, const float non_diegetic_pan ); +#endif +#ifdef JBM_TSM_ON_TCS +static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas ); +static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasDec ); +static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); +static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels, uint8_t *nOutChannels, uint16_t *nSamplesRendered, int16_t *data ); +static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf, int16_t *nOutSamples ); +static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *pcmBuf ); +static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const uint16_t nSamplesForRendering, uint16_t *nSamplesRendered, uint16_t *nSamplesAvailableNext, int16_t *pcmBuf ); +#endif /*---------------------------------------------------------------------* * IVAS_DEC_Open() @@ -105,10 +138,14 @@ static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig, const int /* may return an error but may still have allocated memory - thus run Close also in case of error to release memory */ ivas_error IVAS_DEC_Open( - IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ - const IVAS_DEC_MODE mode, /* i : compatibility mode (EVS or IVAS) */ - const int16_t orientation_tracking, /* i : orientation tracking type */ - float no_diegetic_pan ) + IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ + const IVAS_DEC_MODE mode, /* i : compatibility mode (EVS or IVAS) */ + const int16_t orientation_tracking /* i : orientation tracking type */ +#ifndef NON_DIEGETIC_PAN + , + float no_diegetic_pan /* i : non diegetic panning gain */ +#endif +) { IVAS_DEC_HANDLE hIvasDec; Decoder_Struct *st_ivas; @@ -161,7 +198,11 @@ ivas_error IVAS_DEC_Open( st_ivas = hIvasDec->st_ivas; /* initialize Decoder Config. handle */ +#ifdef NON_DIEGETIC_PAN + init_decoder_config( hIvasDec->st_ivas->hDecoderConfig, orientation_tracking ); +#else init_decoder_config( hIvasDec->st_ivas->hDecoderConfig, orientation_tracking, no_diegetic_pan ); +#endif /* initialize pointers to handles to NULL */ ivas_initialize_handles_dec( st_ivas ); @@ -232,8 +273,12 @@ ivas_error IVAS_DEC_Open( static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig, /* i/o: configuration structure */ - const int16_t orientation_tracking, - const float no_diegetic_pan ) + const int16_t orientation_tracking +#ifndef NON_DIEGETIC_PAN + , + const float no_diegetic_pan +#endif +) { hDecoderConfig->Opt_AMR_WB = 0; hDecoderConfig->nchan_out = 1; @@ -241,12 +286,18 @@ static void init_decoder_config( hDecoderConfig->Opt_LsCustom = 0; hDecoderConfig->Opt_HRTF_binary = 0; hDecoderConfig->Opt_Headrotation = 0; -#ifdef DEBUGGING - hDecoderConfig->forceSubframeBinauralization = 0; -#endif + hDecoderConfig->Opt_RendConfigCustom = 0; hDecoderConfig->orientation_tracking = orientation_tracking; +#ifdef NON_DIEGETIC_PAN + hDecoderConfig->Opt_non_diegetic_pan = 0; + hDecoderConfig->non_diegetic_pan_gain = 0; +#else hDecoderConfig->no_diegetic_pan = no_diegetic_pan; +#endif +#ifdef JBM_TSM_ON_TCS + hDecoderConfig->voip_active = 0; +#endif return; } @@ -284,6 +335,10 @@ void IVAS_DEC_Close( ( *phIvasDec )->st_ivas->hDecoderConfig = NULL; } +#ifdef JBM_TSM_ON_TCS + ivas_jbm_dec_tc_buffer_close( &( ( *phIvasDec )->st_ivas->hTcBuffer ) ); +#endif + /* main IVAS handle */ free( ( *phIvasDec )->st_ivas ); #else @@ -420,10 +475,13 @@ ivas_error IVAS_DEC_Configure( const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ 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 */ -#ifdef DEBUGGING - , - const int16_t forceSubframeBinauralization /* i : enable subframe binauralization */ + const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ +#ifdef NON_DIEGETIC_PAN + const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ + const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ + const float non_diegetic_pan_gain /* i : non diegetic panning gain */ +#else + const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ #endif ) { @@ -442,10 +500,18 @@ ivas_error IVAS_DEC_Configure( return IVAS_ERR_WRONG_PARAMS; } +#ifdef NON_DIEGETIC_PAN + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && !( ( outputFormat == IVAS_DEC_OUTPUT_MONO && Opt_non_diegetic_pan == 0 ) || + ( outputFormat == IVAS_DEC_OUTPUT_STEREO && Opt_non_diegetic_pan == 1 ) ) ) + { + return IVAS_ERR_WRONG_MODE; + } +#else if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && outputFormat != IVAS_DEC_OUTPUT_MONO ) { return IVAS_ERR_WRONG_MODE; } +#endif st_ivas = hIvasDec->st_ivas; @@ -470,12 +536,14 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); } -#ifdef DEBUGGING - hDecoderConfig->forceSubframeBinauralization = forceSubframeBinauralization; -#endif hDecoderConfig->Opt_LsCustom = customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = enableHeadRotation; hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; + hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled; +#ifdef NON_DIEGETIC_PAN + hDecoderConfig->Opt_non_diegetic_pan = Opt_non_diegetic_pan; + hDecoderConfig->non_diegetic_pan_gain = non_diegetic_pan_gain; +#endif /* Set decoder parameters to initial values */ if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) @@ -501,7 +569,11 @@ ivas_error IVAS_DEC_Configure( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_EnableVoIP( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef VARIABLE_SPEED_DECODING + const IVAS_DEC_VOIP_MODE voipMode, /* i : VoIP or varable speed */ + const uint16_t speedFac, /* i : speed factor for varable speed */ +#endif const int16_t jbmSafetyMargin, /* i : allowed delay reserve for JBM, in milliseconds */ const IVAS_DEC_INPUT_FORMAT inputFormat /* i : format of the input bitstream */ ) @@ -511,8 +583,10 @@ ivas_error IVAS_DEC_EnableVoIP( error = IVAS_ERR_OK; +#ifndef JBM_TSM_ON_TCS /* initialize time scaler and FIFO after time scaler */ uint16_t wss, css; +#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -524,8 +598,30 @@ ivas_error IVAS_DEC_EnableVoIP( hIvasDec->Opt_VOIP = 1; - hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); +#ifdef JBM_TSM_ON_TCS + hDecoderConfig->voip_active = 1; +#endif + +#ifdef JBM_TSM_ON_TCS + if ( hDecoderConfig->output_config != AUDIO_CONFIG_EXTERNAL ) + { +#endif + hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); + +#ifdef JBM_TSM_ON_TCS + } +#ifdef VARIABLE_SPEED_DECODING + else + { + hDecoderConfig->nchan_out = 1; + } +#endif +#endif + + +#ifndef JBM_TSM_ON_TCS assert( hDecoderConfig->nchan_out > 0 && "EXT output not yet supported in VoIP mode" ); +#endif if ( ( error = input_format_API_to_internal( inputFormat, &hIvasDec->bitstreamformat, &hIvasDec->sdp_hf_only, true ) ) != IVAS_ERR_OK ) { @@ -539,13 +635,31 @@ ivas_error IVAS_DEC_EnableVoIP( hIvasDec->hVoIP->lastDecodedWasActive = 0; hIvasDec->hVoIP->hCurrentDataUnit = NULL; +#ifdef VARIABLE_SPEED_DECODING + hIvasDec->hVoIP->mode = voipMode; + hIvasDec->hVoIP->speedFac = speedFac; + hIvasDec->hVoIP->needNewFrame = false; +#endif +#ifdef JBM_TSM_ON_TCS + hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + hIvasDec->hVoIP->nSamplesAvailableNext = 0; + hIvasDec->hVoIP->rendererType = JBM_RENDERER_NONE; + hIvasDec->hVoIP->hFifoOut = NULL; +#else hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs * hDecoderConfig->nchan_out / FRAMES_PER_SEC ); +#endif +#ifdef JBM_TSM_ON_TCS + /* postpone init of the buffers until we know the real number of TCs*/ + hIvasDec->hVoIP->apaExecBuffer = NULL; + hIvasDec->hVoIP->nTransportChannelsOld = 0; +#else hIvasDec->hVoIP->apaExecBuffer = malloc( sizeof( int16_t ) * APA_BUF_PER_CHANNEL * hDecoderConfig->nchan_out ); if ( hIvasDec->hVoIP->apaExecBuffer == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } +#endif #define WMC_TOOL_SKIP /* Bitstream conversion is not counted towards complexity and memory usage */ @@ -558,15 +672,23 @@ ivas_error IVAS_DEC_EnableVoIP( } /* initialize JBM */ - if ( ( error = JB4_Create( &hIvasDec->hVoIP->hJBM ) != IVAS_ERR_OK ) != IVAS_ERR_OK ) - { - return error; - } - if ( JB4_Init( hIvasDec->hVoIP->hJBM, jbmSafetyMargin ) != 0 ) +#ifdef VARIABLE_SPEED_DECODING + hIvasDec->hVoIP->hJBM = NULL; + if ( hIvasDec->hVoIP->mode == IVAS_DEC_VOIP_MODE_VOIP ) { - return IVAS_ERR_FAILED_ALLOC; +#endif + if ( ( error = JB4_Create( &hIvasDec->hVoIP->hJBM ) != IVAS_ERR_OK ) != IVAS_ERR_OK ) + { + return error; + } + if ( JB4_Init( hIvasDec->hVoIP->hJBM, jbmSafetyMargin ) != 0 ) + { + return IVAS_ERR_FAILED_ALLOC; + } +#ifdef VARIABLE_SPEED_DECODING } - +#endif +#ifndef JBM_TSM_ON_TCS if ( hDecoderConfig->output_Fs == 8000 ) { wss = 1; @@ -591,17 +713,50 @@ ivas_error IVAS_DEC_EnableVoIP( { return IVAS_ERR_INIT_ERROR; } +#endif +#ifdef JBM_TSM_ON_TCS + + /* postpone init of time scaler until we know the real number of TCs */ + hIvasDec->hVoIP->hTimeScaler = NULL; + /* create output pcm fifo*/ + /* :TODO: also provide CLDFB output FIFO if things work out */ +#ifdef VARIABLE_SPEED_DECODING + if ( hIvasDec->hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) + { + hIvasDec->hVoIP->needNewFrame = true; + } +#endif +#else +#ifdef VARIABLE_SPEED_DECODING + { + float startQuality = hIvasDec->hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ? -2.0f : 1.0f; + if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, + hDecoderConfig->nchan_out ) != IVAS_ERR_OK || + apa_set_rate( hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || + apa_set_complexity_options( hIvasDec->hVoIP->hTimeScaler, wss, css ) != 0 || + apa_set_quality( hIvasDec->hVoIP->hTimeScaler, startQuality, 4, 4 ) != 0 || + pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoAfterTimeScaler ) != 0 || + pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoAfterTimeScaler, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } + /* we instantly need a new frame */ + hIvasDec->hVoIP->needNewFrame = true; + } +#else if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, - hDecoderConfig->nchan_out ) != 0 || + hDecoderConfig->nchan_out ) != IVAS_ERR_OK || apa_set_rate( hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || apa_set_complexity_options( hIvasDec->hVoIP->hTimeScaler, wss, css ) != 0 || apa_set_quality( hIvasDec->hVoIP->hTimeScaler, 1, 4, 4 ) != 0 || - pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoAfterTimeScaler ) != 0 || - pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoAfterTimeScaler, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != 0 ) + pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoAfterTimeScaler ) != IVAS_ERR_OK || + pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoAfterTimeScaler, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != IVAS_ERR_OK ) { return IVAS_ERR_INIT_ERROR; } +#endif +#endif return error; } @@ -690,6 +845,13 @@ ivas_error IVAS_DEC_FeedFrame_Serial( st->use_partial_copy = 1; } +#ifdef VARIABLE_SPEED_DECODING + if ( hIvasDec->hVoIP != NULL && hIvasDec->hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) + { + hIvasDec->hVoIP->needNewFrame = false; + } +#endif + return error; } @@ -722,7 +884,11 @@ ivas_error IVAS_DEC_GetSamples( if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { +#ifdef JBM_TSM_ON_TCS + if ( ( error = evs_dec_main( st_ivas, *nOutSamples, NULL, pcmBuf ) ) != IVAS_ERR_OK ) +#else if ( ( error = evs_dec_main( st_ivas, *nOutSamples, pcmBuf ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -747,6 +913,187 @@ ivas_error IVAS_DEC_GetSamples( } +#ifdef JBM_TSM_ON_TCS +/*---------------------------------------------------------------------* + * IVAS_DEC_Setup( ) + * + * Main function to decode to PCM data of the transport channels + *---------------------------------------------------------------------*/ + +static ivas_error IVAS_DEC_Setup( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + uint16_t *nTcBufferGranularity, /* o : granularity of the TC Buffer */ + 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 : flushed samples */ +) +{ + ivas_error error; + + error = IVAS_ERR_OK; + + *nSamplesRendered = 0; + + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) + { + *nTransportChannels = 1; + *nOutChannels = 1; + } + else + { + Decoder_Struct *st_ivas; + + st_ivas = hIvasDec->st_ivas; + /*----------------------------------------------------------------* + * IVAS decoder setup + * - read IVAS format signaling + * - read IVAS format specific signaling + * - initialize decoder in the first frame based on IVAS format and number of transport channels + * - reconfigure the decoder when the number of TC or IVAS total bitrate change + *----------------------------------------------------------------*/ + + if ( st_ivas->bfi == 0 ) + { + if ( ( error = ivas_dec_setup( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + *nTransportChannels = (uint8_t) st_ivas->hTcBuffer->nchan_transport_jbm; + *nTcBufferGranularity = (uint16_t) st_ivas->hTcBuffer->n_samples_granularity; + *nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; + } + + return error; +} + +/*---------------------------------------------------------------------* + * IVAS_DEC_GetTcSamples( ) + * + * Main function to decode to PCM data of the transport channels + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_GetTcSamples( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + float *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 */ +) +{ + Decoder_Struct *st_ivas; + ivas_error error; + + error = IVAS_ERR_OK; + + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + st_ivas = hIvasDec->st_ivas; + + *nOutSamples = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); + + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) + { + if ( ( error = evs_dec_main( st_ivas, *nOutSamples, pcmBuf, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( hIvasDec->mode == IVAS_DEC_MODE_IVAS ) + { + /* run the main IVAS decoding routine */ + if ( ( error = ivas_jbm_dec_tc( st_ivas, pcmBuf ) ) != IVAS_ERR_OK ) + { + return error; + } + + hIvasDec->isInitialized = true; /* Initialization done in ivas_dec() */ + } + + if ( hIvasDec->hasBeenFedFirstGoodFrame ) + { + hIvasDec->hasDecodedFirstGoodFrame = true; + } + + return error; +} + +/*---------------------------------------------------------------------* + * IVAS_DEC_Rendered_FeedTcSamples( ) + * + * Main function to decode to PCM data of the transport channels + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_RendererFeedTcSamples( + IVAS_DEC_HANDLE hIvasDec, /* i/o : IVAS decoder handle */ + const int16_t nSamplesForRendering, /* i: : number of TC samples wanted from the renderer */ + int16_t *nSamplesResidual, /* o: : number of samples not fitting into the renderer grid and buffer for the next call*/ + float *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 */ +) +{ + Decoder_Struct *st_ivas; + + ivas_error error; + + error = IVAS_ERR_OK; + + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + st_ivas = hIvasDec->st_ivas; + + /* feed the TCs to the IVAS renderer */ + if ( ( error = ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesForRendering, nSamplesResidual, pcmBuf ) ) != IVAS_ERR_OK ) + { + return error; + } + + return error; +} + +/*---------------------------------------------------------------------* + * IVAS_DEC_GetRenderedSamples( ) + * + * Main function to decode to PCM data of the transport channels + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_GetRenderedSamples( + IVAS_DEC_HANDLE hIvasDec, /* i/o : IVAS decoder handle */ + 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 /* 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 */ +) +{ + Decoder_Struct *st_ivas; + ivas_error error; + + error = IVAS_ERR_OK; + + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + st_ivas = hIvasDec->st_ivas; + + /* run the main IVAS decoding routine */ + if ( ( error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering, nSamplesRendered, nSamplesAvailableNext, pcmBuf ) ) != IVAS_ERR_OK ) + { + return error; + } + + + return error; +} +#endif + + /*---------------------------------------------------------------------* * IVAS_DEC_GetNumObjects( ) * @@ -864,17 +1211,27 @@ ivas_error IVAS_DEC_GetObjectMetadata( { metadata->azimuth = 0.f; metadata->elevation = 0.f; - metadata->radius = 0.f; + metadata->radius = 1.f; metadata->spread = 0.f; metadata->gainFactor = 1.f; + metadata->yaw = 0.f; + metadata->pitch = 0.f; +#ifdef ISM_NON_DIEGETIC_PAN + metadata->non_diegetic_flag = 0; +#endif } else { metadata->azimuth = hIsmMeta->azimuth; metadata->elevation = hIsmMeta->elevation; - metadata->radius = 0.f; + metadata->radius = hIsmMeta->radius; + metadata->yaw = hIsmMeta->yaw; + metadata->pitch = hIsmMeta->pitch; metadata->spread = 0.f; metadata->gainFactor = 1.f; +#ifdef ISM_NON_DIEGETIC_PAN + metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag; +#endif } return IVAS_ERR_OK; @@ -888,8 +1245,8 @@ ivas_error IVAS_DEC_GetObjectMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetMasaMetadata( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_MASA_QMETADATA_HANDLE *hMasaMetadata /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ ) { if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) @@ -902,7 +1259,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( return IVAS_ERR_WRONG_MODE; } - *hMasaMetadata = hIvasDec->st_ivas->hQMetaData; + *hMasaExtOutMeta = hIvasDec->st_ivas->hMasa->data.extOutMeta; return IVAS_ERR_OK; } @@ -914,14 +1271,15 @@ ivas_error IVAS_DEC_GetMasaMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedHeadTrackData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_QUATERNION *orientation /* i : head-tracking data */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_QUATERNION *orientation, /* i : head-tracking data, listener orientation */ + IVAS_VECTOR3 *Pos /* i : listener position */ ) { HEAD_TRACK_DATA_HANDLE hHeadTrackData; int16_t i; - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || orientation == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -936,10 +1294,16 @@ ivas_error IVAS_DEC_FeedHeadTrackData( /* Move head-tracking data to the decoder handle */ for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - hHeadTrackData->Quaternions[i].w = orientation[i].w; - hHeadTrackData->Quaternions[i].x = orientation[i].x; - hHeadTrackData->Quaternions[i].y = orientation[i].y; - hHeadTrackData->Quaternions[i].z = orientation[i].z; + /* check for Euler angle signaling */ + if ( orientation[i].w == -3.0f ) + { + Euler2Quat( deg2rad( orientation[i].x ), deg2rad( orientation[i].y ), deg2rad( orientation[i].z ), &orientation[i] ); + } + + ivas_orient_trk_Process( hHeadTrackData->OrientationTracker, orientation[i], FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hHeadTrackData->Quaternions[i] ); + hHeadTrackData->Pos[i].x = Pos[i].x; + hHeadTrackData->Pos[i].y = Pos[i].y; + hHeadTrackData->Pos[i].z = Pos[i].z; } hIvasDec->st_ivas->hHeadTrackData->num_quaternions = 0; @@ -947,6 +1311,58 @@ ivas_error IVAS_DEC_FeedHeadTrackData( return IVAS_ERR_OK; } +/*---------------------------------------------------------------------* + * IVAS_DEC_FeedRefRotData( ) + * + * Feed the decoder with the reference rotation + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_FeedRefRotData( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_QUATERNION rotation /* i : reference rotation data */ +) +{ + ivas_orient_trk_state_t *pOtr; + + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHeadTrackData == NULL || hIvasDec->st_ivas->hHeadTrackData->OrientationTracker == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + pOtr = hIvasDec->st_ivas->hHeadTrackData->OrientationTracker; + + pOtr->refRot.w = rotation.w; + pOtr->refRot.x = rotation.x; + pOtr->refRot.z = rotation.z; + pOtr->refRot.y = rotation.y; + + return IVAS_ERR_OK; +} + +/*---------------------------------------------------------------------* + * IVAS_DEC_FeedRefVectorData( ) + * + * Feed the decoder with a reference vector spanning from listenerPos + * to refPos. Only available in OTR_TRACKING_REF_POS and + * OTR_TRACKING_REF_POS_LEV modes. + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_FeedRefVectorData( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +) +{ + ivas_orient_trk_state_t *pOtr; + + if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHeadTrackData == NULL || hIvasDec->st_ivas->hHeadTrackData->OrientationTracker == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + pOtr = hIvasDec->st_ivas->hHeadTrackData->OrientationTracker; + return ivas_orient_trk_SetReferenceVector( pOtr, listenerPos, refPos ); +} /*---------------------------------------------------------------------* * IVAS_DEC_FeedCustomLsData( ) @@ -1024,7 +1440,6 @@ ivas_error IVAS_DEC_GetHrtfHandle( } -#ifdef HRTF_BINARY_FILE /*---------------------------------------------------------------------* * IVAS_DEC_GetHrtfCRendHandle( ) * @@ -1045,9 +1460,7 @@ ivas_error IVAS_DEC_GetHrtfCRendHandle( return IVAS_ERR_OK; } -#endif -#ifdef HRTF_BINARY_FILE /*---------------------------------------------------------------------* * IVAS_DEC_GetHrtfFastConvHandle( ) * @@ -1089,7 +1502,6 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_GetRenderConfig( ) @@ -1134,6 +1546,7 @@ ivas_error IVAS_DEC_GetRenderConfig( mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->room_acoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->room_acoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); + mvr2r( hRCin->directivity, hRCout->directivity, 3 ); return IVAS_ERR_OK; } @@ -1178,6 +1591,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( mvr2r( renderConfig.room_acoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); + mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 ); return IVAS_ERR_OK; } @@ -1212,11 +1626,9 @@ ivas_error IVAS_DEC_GetDelay( st_ivas = hIvasDec->st_ivas; hDecoderConfig = st_ivas->hDecoderConfig; -#ifdef FIX_I59_DELAY_ROUNDING - *nSamples = (int16_t) roundf( (float) get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->binaural_latency_ns ) * hDecoderConfig->output_Fs / 1000000000.f ); -#else - *nSamples = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->binaural_latency_ns ) ); -#endif + nSamples[1] = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0] ) ); + nSamples[2] = (int16_t) roundf( (float) st_ivas->binaural_latency_ns * hDecoderConfig->output_Fs / 1000000000.f ); + nSamples[0] = nSamples[1] + nSamples[2]; *timeScale = hDecoderConfig->output_Fs; @@ -1409,6 +1821,27 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( return IVAS_ERR_OK; } +#ifdef VARIABLE_SPEED_DECODING +/*---------------------------------------------------------------------* + * IVAS_DEC_VoIP_SetScale( ) + * + * Set the TSM scale + *---------------------------------------------------------------------*/ + +ivas_error IVAS_DEC_VoIP_SetScale( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const int16_t scale /* i : TSM scale to set */ +) +{ + ivas_error error; + + error = IVAS_ERR_OK; + + hIvasDec->hVoIP->speedFac = scale; + + return error; +} +#endif /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_GetSamples( ) @@ -1421,11 +1854,16 @@ ivas_error IVAS_DEC_VoIP_GetSamples( 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 */ +#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) + , + uint16_t *sampleAvailableNext /* o : samples available for the next call */ +#endif #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, void *jbmWriter #endif + ) { Decoder_Struct *st_ivas; @@ -1439,6 +1877,12 @@ ivas_error IVAS_DEC_VoIP_GetSamples( int16_t timeScalingDone; int16_t result; ivas_error error; +#ifdef JBM_TSM_ON_TCS + int16_t nSamplesRendered; + uint16_t nSamplesTcsScaled; + uint8_t nTransportChannels; + uint8_t nOutChannels; +#endif error = IVAS_ERR_OK; @@ -1447,133 +1891,472 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hVoIP = hIvasDec->hVoIP; timeScalingDone = 0; +#ifdef JBM_TSM_ON_TCS + nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; + nTransportChannels = 0; + nSamplesTcsScaled = hVoIP->nSamplesFrame; + nSamplesRendered = 0; +#endif +#ifdef VARIABLE_SPEED_DECODING + scale = hVoIP->speedFac; + maxScaling = hVoIP->speedFac; +#endif + /* TODO(mcjbm): ringbuffer capacity should be configurable by user */ +#ifdef JBM_TSM_ON_TCS + if ( ( hVoIP->hFifoOut != NULL && nSamplesPerChannel > hVoIP->hFifoOut->capacity ) || nSamplesPerChannel == 0 ) +#else if ( nSamplesPerChannel > hVoIP->hFifoAfterTimeScaler->capacity || nSamplesPerChannel == 0 ) +#endif { return IVAS_ERR_WRONG_PARAMS; } /* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */ +#ifdef JBM_TSM_ON_TCS + while ( ( hVoIP->hFifoOut != NULL && pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ) < nSamplesPerChannel ) || ( hVoIP->hFifoOut == NULL && nSamplesRendered < nSamplesPerChannel ) ) +#else while ( pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ) < nSamplesPerChannel ) +#endif { - extBufferedSamples = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); - extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs; - dataUnit = NULL; - /* pop one access unit from the jitter buffer */ - result = JB4_PopDataUnit( hVoIP->hJBM, systemTimestamp_ms, extBufferedTime_ms, &dataUnit, &scale, &maxScaling ); - if ( result != 0 ) +#ifdef VARIABLE_SPEED_DECODING + if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED && hVoIP->needNewFrame ) { - return IVAS_ERR_UNKNOWN; + /* we need another bs frame fed into the decoder...*/ + *sampleAvailableNext = 0; + return IVAS_ERR_VS_FRAME_NEEDED; } - - maxScaling = maxScaling * hDecoderConfig->output_Fs / 1000; - /* avoid time scaling multiple times in one sound card slot */ - if ( scale != 100U ) +#endif +#ifdef JBM_TSM_ON_TCS + if ( hVoIP->nSamplesAvailableNext == 0 ) { - if ( timeScalingDone ) + if ( hVoIP->hFifoOut ) { - scale = 100; + extBufferedSamples = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ); + nSamplesRendered = extBufferedSamples; } else { - timeScalingDone = 1; + extBufferedSamples = nSamplesRendered; /* TODO: JBM use renderer residual samples here */ } - } +#else + extBufferedSamples = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); +#endif + extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs; - /* copy bitstream into decoder state */ - if ( dataUnit ) - { - hIvasDec->hVoIP->hCurrentDataUnit = dataUnit; + dataUnit = NULL; +#ifdef VARIABLE_SPEED_DECODING + if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VOIP ) + { +#endif + /* pop one access unit from the jitter buffer */ + result = JB4_PopDataUnit( hVoIP->hJBM, systemTimestamp_ms, extBufferedTime_ms, &dataUnit, &scale, &maxScaling ); + if ( result != 0 ) + { + return IVAS_ERR_UNKNOWN; + } +#ifdef VARIABLE_SPEED_DECODING + } + else if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) + { + scale = hVoIP->speedFac; + maxScaling = hVoIP->speedFac; + } +#ifdef DEBUGGING + else + { + assert( "Wrong VoIP mode!\n" && 0 ); + } +#endif +#endif - bsCompactToSerial( dataUnit->data, hIvasDec->hVoIP->bs_conversion_buf, dataUnit->dataSize ); - IVAS_DEC_FeedFrame_Serial( hIvasDec, hIvasDec->hVoIP->bs_conversion_buf, dataUnit->dataSize, 0 ); - } - else if ( hIvasDec->hasDecodedFirstGoodFrame ) - { - /* Decoder has been initialized with first good frame - do PLC */ - IVAS_DEC_FeedFrame_Serial( hIvasDec, hIvasDec->hVoIP->bs_conversion_buf, 0, 1 ); - } + maxScaling = maxScaling * hDecoderConfig->output_Fs / 1000; + /* avoid time scaling multiple times in one sound card slot */ + if ( scale != 100U ) + { + if ( timeScalingDone ) + { + scale = 100; + } + else + { + timeScalingDone = 1; + } + } - /* decode */ - if ( !hIvasDec->hasBeenFedFirstGoodFrame ) - { - /* codec mode to use not known yet - simply output silence */ +#ifdef VARIABLE_SPEED_DECODING + if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VOIP ) + { +#endif + /* copy bitstream into decoder state */ + if ( dataUnit ) + { + hIvasDec->hVoIP->hCurrentDataUnit = dataUnit; + + bsCompactToSerial( dataUnit->data, hIvasDec->hVoIP->bs_conversion_buf, dataUnit->dataSize ); + IVAS_DEC_FeedFrame_Serial( hIvasDec, hIvasDec->hVoIP->bs_conversion_buf, dataUnit->dataSize, 0 ); + } + else if ( hIvasDec->hasDecodedFirstGoodFrame ) + { + /* Decoder has been initialized with first good frame - do PLC */ + IVAS_DEC_FeedFrame_Serial( hIvasDec, hIvasDec->hVoIP->bs_conversion_buf, 0, 1 ); + } +#ifdef VARIABLE_SPEED_DECODING + } +#endif + /* decode */ + if ( !hIvasDec->hasBeenFedFirstGoodFrame ) + { + /* codec mode to use not known yet - simply output silence */ +#ifdef JBM_TSM_ON_TCS + nSamplesTcsScaled = hVoIP->nSamplesFrame; + if ( hVoIP->hFifoOut != NULL ) + { + /* feed zeros to FIFO */ + if ( pcmdsp_fifo_write_zero( hVoIP->hFifoOut, nSamplesTcsScaled ) != 0 ) + { + return IVAS_ERR_UNKNOWN; + } + } + else + { + /* directly set output zero */ + set_s( pcmBuf, 0, nSamplesPerChannel * nOutChannels ); + } + nSamplesRendered = nSamplesTcsScaled; +#else set_s( hVoIP->apaExecBuffer, 0, hVoIP->nSamplesFrame ); /* TODO(mcjbm): Could be optimized: just write directly to output buffer */ - } - else - { +#endif + } + else + { + +#ifdef JBM_TSM_ON_TCS + uint16_t l_ts = 1; + uint16_t nSamplesRendered_loop; + /* setup ivas decoder and get the number of TCs */ + /* might render some remaining samples from the previous frame too if the renderer granularity changed */ + if ( hVoIP->hFifoOut ) + { + int16_t rendererPcmBuf[( MAX_OUTPUT_CHANNELS * L_FRAME_MAX * APA_MAX_SCALE ) / 100]; + if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, rendererPcmBuf ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( pcmdsp_fifo_write( hVoIP->hFifoOut, (uint8_t *) rendererPcmBuf, nSamplesRendered_loop ) != 0 ) + { + return IVAS_ERR_UNKNOWN; + } + } + else + { + if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + } + nSamplesRendered += nSamplesRendered_loop; + if ( nTransportChannels != hVoIP->nTransportChannelsOld ) + { + IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ); + } + /* decode TCs only */ + if ( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hVoIP->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = IVAS_DEC_GetSamples( hIvasDec, hVoIP->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) { return error; } - } +#endif + } - if ( dataUnit ) - { - if ( dataUnit->partial_frame != 0 ) +#ifdef VARIABLE_SPEED_DECODING + if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VOIP ) { - hVoIP->lastDecodedWasActive = 1; +#endif + if ( dataUnit ) + { + if ( dataUnit->partial_frame != 0 ) + { + hVoIP->lastDecodedWasActive = 1; + } + else + { + hVoIP->lastDecodedWasActive = !dataUnit->silenceIndicator; + } + /* data unit memory is no longer used */ + JB4_FreeDataUnit( hVoIP->hJBM, dataUnit ); + } +#ifdef VARIABLE_SPEED_DECODING } else { - hVoIP->lastDecodedWasActive = !dataUnit->silenceIndicator; + hVoIP->lastDecodedWasActive = 1; + } +#endif + /* limit scale to range supported by time scaler */ + if ( scale < APA_MIN_SCALE ) + { + scale = APA_MIN_SCALE; + } + else if ( scale > APA_MAX_SCALE ) + { + scale = APA_MAX_SCALE; } - /* data unit memory is no longer used */ - JB4_FreeDataUnit( hVoIP->hJBM, dataUnit ); - } - /* limit scale to range supported by time scaler */ - if ( scale < APA_MIN_SCALE ) + /* apply time scaling on decoded/concealed samples */ +#ifdef JBM_TSM_ON_TCS + if ( hIvasDec->hasBeenFedFirstGoodFrame ) + { +#endif + if ( apa_set_scale( hVoIP->hTimeScaler, (uint16_t) scale ) != 0 ) + { + return IVAS_ERR_UNKNOWN; + } +#ifdef JBM_TSM_ON_TCS + result = apa_exec( hVoIP->hTimeScaler, hVoIP->apaExecBuffer, hVoIP->nSamplesFrame * nTransportChannels, (uint16_t) maxScaling, hVoIP->apaExecBuffer, &nTimeScalerOutSamples ); +#else + result = apa_exec( hVoIP->hTimeScaler, hVoIP->apaExecBuffer, hVoIP->nSamplesFrame, (uint16_t) maxScaling, hVoIP->apaExecBuffer, &nTimeScalerOutSamples ); +#endif + if ( result != 0 ) + { + return IVAS_ERR_UNKNOWN; + } + assert( nTimeScalerOutSamples <= APA_BUF ); + +#ifdef JBM_TSM_ON_TCS + nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels; +#else + /* append scaled samples to FIFO */ + if ( pcmdsp_fifo_write( hVoIP->hFifoAfterTimeScaler, (uint8_t *) hVoIP->apaExecBuffer, (uint16_t) ( nTimeScalerOutSamples / hDecoderConfig->nchan_out ) ) != 0 ) { - scale = APA_MIN_SCALE; + return IVAS_ERR_UNKNOWN; } - else if ( scale > APA_MAX_SCALE ) +#ifdef VARIABLE_SPEED_DECODING + if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) { - scale = APA_MAX_SCALE; + int16_t nSamplesAvailable = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); + if ( nSamplesAvailable < nSamplesPerChannel ) + { + hVoIP->needNewFrame = true; + } } +#endif +#endif - /* apply time scaling on decoded/concealed samples */ - if ( apa_set_scale( hVoIP->hTimeScaler, (uint16_t) scale ) != 0 ) - { - return IVAS_ERR_UNKNOWN; +#ifdef JBM_TSM_ON_TCS + if ( hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->rendererType != JBM_RENDERER_NONE ) + { + /* render IVAS frames */ + int16_t nResidualSamples; + if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hVoIP->apaExecBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } + /* feed residual samples to TSM for the next call */ + if ( apa_set_renderer_residual_samples( hVoIP->hTimeScaler, (uint16_t) nResidualSamples ) != 0 ) + { + return IVAS_ERR_UNKNOWN; + } + } + else + { + /* inplace float->int16_t conversion*/ +#ifdef DEBUGGING + st_ivas->noClipping += +#endif + syn_output( hVoIP->apaExecBuffer, nTimeScalerOutSamples, (int16_t *) hVoIP->apaExecBuffer ); + + if ( pcmdsp_fifo_write( hVoIP->hFifoOut, (uint8_t *) hVoIP->apaExecBuffer, nSamplesTcsScaled ) != 0 ) + { + return IVAS_ERR_UNKNOWN; + } + nSamplesRendered = nSamplesTcsScaled; + } + } +#endif +#ifdef SUPPORT_JBM_TRACEFILE + /* jbmWriterFn and jbmWriter may be NULL if tracefile writing was not requested on CLI */ + if ( jbmWriterFn != NULL && jbmWriter != NULL ) + { + /* write JBM trace data entry */ + store_JbmData( hVoIP, dataUnit, systemTimestamp_ms, extBufferedSamples, hDecoderConfig->output_Fs ); + if ( ( jbmWriterFn( &hVoIP->JbmTraceData, jbmWriter ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing JBM Trace data to file\n" ); + return IVAS_ERR_UNKNOWN; + } + } +#endif +#ifdef JBM_TSM_ON_TCS } - result = apa_exec( hVoIP->hTimeScaler, hVoIP->apaExecBuffer, hVoIP->nSamplesFrame, (uint16_t) maxScaling, hVoIP->apaExecBuffer, &nTimeScalerOutSamples ); - if ( result != 0 ) + if ( hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->rendererType != JBM_RENDERER_NONE ) { - return IVAS_ERR_UNKNOWN; + uint16_t nSamplesRendered_loop; + int16_t nSamplesToRender; + if ( hVoIP->hFifoOut ) + { + int16_t rendererPcmBuf[( MAX_OUTPUT_CHANNELS * L_FRAME_MAX * APA_MAX_SCALE ) / 100]; + nSamplesToRender = nSamplesPerChannel - pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ); + /* render IVAS frames */ + if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hVoIP->nSamplesAvailableNext, rendererPcmBuf ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( pcmdsp_fifo_write( hVoIP->hFifoOut, (uint8_t *) rendererPcmBuf, nSamplesRendered_loop ) != 0 ) + { + return IVAS_ERR_UNKNOWN; + } + } + else + { + nSamplesToRender = nSamplesPerChannel - nSamplesRendered; + /* render IVAS frames directly to the output buffer */ + if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hVoIP->nSamplesAvailableNext, pcmBuf + nSamplesRendered * nOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } + } + nSamplesRendered += nSamplesRendered_loop; +#ifdef VARIABLE_SPEED_DECODING + if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED && hVoIP->nSamplesAvailableNext == 0 ) + { + hVoIP->needNewFrame = true; + } +#endif } - assert( nTimeScalerOutSamples <= APA_BUF ); - - /* append scaled samples to FIFO */ - if ( pcmdsp_fifo_write( hVoIP->hFifoAfterTimeScaler, (uint8_t *) hVoIP->apaExecBuffer, (uint16_t) ( nTimeScalerOutSamples / hDecoderConfig->nchan_out ) ) != 0 ) + else if ( !hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->hFifoOut == NULL ) { - return IVAS_ERR_UNKNOWN; + hVoIP->nSamplesAvailableNext = 0; } - -#ifdef SUPPORT_JBM_TRACEFILE - /* jbmWriterFn and jbmWriter may be NULL if tracefile writing was not requested on CLI */ - if ( jbmWriterFn != NULL && jbmWriter != NULL ) + else { - /* write JBM trace data entry */ - store_JbmData( hVoIP, dataUnit, systemTimestamp_ms, extBufferedSamples, hDecoderConfig->output_Fs ); - if ( ( jbmWriterFn( &hVoIP->JbmTraceData, jbmWriter ) ) != IVAS_ERR_OK ) + hVoIP->nSamplesAvailableNext = max( 0, pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ) - nSamplesPerChannel ); +#ifdef VARIABLE_SPEED_DECODING + if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED && hVoIP->nSamplesAvailableNext < nSamplesPerChannel ) { - fprintf( stderr, "\nError writing JBM Trace data to file\n" ); - return IVAS_ERR_UNKNOWN; + hVoIP->needNewFrame = true; } +#endif + hVoIP->nSamplesAvailableNext = 0; } #endif } /* fetch a user-specified number of samples from FIFO */ +#if defined( JBM_TSM_ON_TCS ) + if ( hVoIP->hFifoOut ) + { + if ( pcmdsp_fifo_read( hVoIP->hFifoOut, nSamplesPerChannel, (uint8_t *) pcmBuf ) != 0 ) +#else if ( pcmdsp_fifo_read( hVoIP->hFifoAfterTimeScaler, nSamplesPerChannel, (uint8_t *) pcmBuf ) != 0 ) +#endif + { + return IVAS_ERR_UNKNOWN; + } +#ifdef JBM_TSM_ON_TCS + } +#endif + +#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) +#ifdef JBM_TSM_ON_TCS + *sampleAvailableNext = hVoIP->nSamplesAvailableNext; +#else + *sampleAvailableNext = max( 0, pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ) ); +#ifdef VARIABLE_SPEED_DECODING + if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) { - return IVAS_ERR_UNKNOWN; + if ( *sampleAvailableNext < nSamplesPerChannel ) + { + hVoIP->needNewFrame = true; + } + } +#endif +#endif +#endif + + return error; +} + +/*---------------------------------------------------------------------* + * IVAS_DEC_VoIP_Flush( ) + * + * Function to flush remaining audio in VoIP + *---------------------------------------------------------------------*/ + +#if defined( VARIABLE_SPEED_DECODING ) || defined( JBM_TSM_ON_TCS ) +ivas_error IVAS_DEC_VoIP_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 */ + uint16_t *nSamplesAvailableNext, /* o : number of samples still available */ + int16_t *nSamplesFlushed /* o : number of samples flushed */ +) +{ + ivas_error error; + IVAS_DEC_VOIP *hVoIP; +#ifdef JBM_TSM_ON_TCS + int16_t rendererPcmBuf[( MAX_OUTPUT_CHANNELS * L_FRAME_MAX * APA_MAX_SCALE ) / 100]; + uint16_t nSamplesToRender; + uint16_t nSamplesFlushedLocal; +#endif + error = IVAS_ERR_OK; + + hVoIP = hIvasDec->hVoIP; +#if defined( JBM_TSM_ON_TCS ) + *nSamplesFlushed = min( nSamplesPerChannel, hVoIP->nSamplesAvailableNext ); +#else + *nSamplesFlushed = min( nSamplesPerChannel, pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ) ); +#endif +#ifdef JBM_TSM_ON_TCS + if ( hVoIP->rendererType == JBM_RENDERER_NONE ) + { +#endif + /* fetch a user-specified number of samples from FIFO */ +#if defined( JBM_TSM_ON_TCS ) + if ( pcmdsp_fifo_read( hVoIP->hFifoOut, *nSamplesFlushed, (uint8_t *) pcmBuf ) != 0 ) +#else + if ( pcmdsp_fifo_read( hVoIP->hFifoAfterTimeScaler, *nSamplesFlushed, (uint8_t *) pcmBuf ) != 0 ) +#endif + { + return IVAS_ERR_UNKNOWN; + } +#if defined( JBM_TSM_ON_TCS ) + hVoIP->nSamplesAvailableNext -= *nSamplesFlushed; + *nSamplesAvailableNext = hVoIP->nSamplesAvailableNext; +#else + *nSamplesAvailableNext = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); +#endif +#ifdef JBM_TSM_ON_TCS } + else + { + nSamplesToRender = (uint16_t) *nSamplesFlushed; + /* render IVAS frames */ + if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hVoIP->nSamplesAvailableNext, rendererPcmBuf ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( pcmdsp_fifo_write( hVoIP->hFifoOut, (uint8_t *) rendererPcmBuf, nSamplesFlushedLocal ) != 0 ) + { + return IVAS_ERR_UNKNOWN; + } + if ( pcmdsp_fifo_read( hVoIP->hFifoOut, nSamplesFlushedLocal, (uint8_t *) pcmBuf ) != 0 ) + { + return IVAS_ERR_UNKNOWN; + } + *nSamplesAvailableNext = hVoIP->nSamplesAvailableNext; + *nSamplesFlushed = (int16_t) nSamplesFlushedLocal; + } +#endif return error; } +#endif /*---------------------------------------------------------------------* @@ -1584,9 +2367,17 @@ ivas_error IVAS_DEC_VoIP_GetSamples( bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ +#ifdef JBM_TSM_ON_TCS + , + int16_t nSamplesAsked +#endif ) { +#ifdef JBM_TSM_ON_TCS + return ( ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 ) && ( hIvasDec->hVoIP->nSamplesAvailableNext < nSamplesAsked ) ); +#else return JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0; +#endif } @@ -1627,8 +2418,11 @@ static void IVAS_DEC_Close_VoIP( apa_exit( &hVoIP->hTimeScaler ); +#ifdef JBM_TSM_ON_TCS + pcmdsp_fifo_destroy( &hVoIP->hFifoOut ); +#else pcmdsp_fifo_destroy( &hVoIP->hFifoAfterTimeScaler ); - +#endif if ( hVoIP->apaExecBuffer != NULL ) { free( hVoIP->apaExecBuffer ); @@ -1908,7 +2702,17 @@ static ivas_error printConfigInfo_dec( if ( st_ivas->ivas_format == MONO_FORMAT ) { - fprintf( stdout, "Output configuration: mono EVS bit-exact decoding\n" ); +#ifdef NON_DIEGETIC_PAN + if ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) + { + fprintf( stdout, "Output configuration: mono EVS bit-exact decoding to stereo\n" ); + fprintf( stdout, "Non-diegetic panning: %.2f\n", st_ivas->hDecoderConfig->non_diegetic_pan_gain * 90.f ); + } + else +#endif + { + fprintf( stdout, "Output configuration: mono EVS bit-exact decoding\n" ); + } } else { @@ -1947,13 +2751,50 @@ static ivas_error printConfigInfo_dec( fprintf( stdout, "Input configuration: %s\n", config_str ); } } + get_channel_config( st_ivas->hDecoderConfig->output_config, &config_str[0] ); fprintf( stdout, "Output configuration: %s\n", config_str ); + if ( st_ivas->hDecoderConfig->Opt_HRTF_binary ) + { + fprintf( stdout, "HRIR/BRIR file: ON\n" ); + } + + if ( st_ivas->hDecoderConfig->Opt_RendConfigCustom ) + { + fprintf( stdout, "Renderer config. file: ON\n" ); + } + if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { fprintf( stdout, "Head rotation: ON\n" ); } + + if ( st_ivas->hDecoderConfig->orientation_tracking != IVAS_ORIENT_TRK_NONE ) + { + switch ( st_ivas->hDecoderConfig->orientation_tracking ) + { + case IVAS_ORIENT_TRK_AVG: + fprintf( stdout, "Orientation tracking: AVG\n" ); + break; + case IVAS_ORIENT_TRK_REF: + fprintf( stdout, "Orientation tracking: REF\n" ); + break; + case IVAS_ORIENT_TRK_REF_VEC: + fprintf( stdout, "Orientation tracking: REF_VEC\n" ); + break; + case IVAS_ORIENT_TRK_REF_VEC_LEV: + fprintf( stdout, "Orientation tracking: REF_VEC_LEV\n" ); + break; + } + } + +#ifdef NON_DIEGETIC_PAN + if ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) + { + fprintf( stdout, "Non-diegetic panning: %.2f\n", st_ivas->hDecoderConfig->non_diegetic_pan_gain * 90.f ); + } +#endif } return IVAS_ERR_OK; @@ -2054,10 +2895,22 @@ void IVAS_DEC_PrintDisclaimer( void ) static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, +#ifdef JBM_TSM_ON_TCS + float *floatBuf, +#endif int16_t *pcmBuf ) { DEC_CORE_HANDLE *hCoreCoder; +#ifdef NON_DIEGETIC_PAN + float output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN][L_FRAME48k]; + float mixer_left, mixer_rigth; +#ifdef JBM_TSM_ON_TCS + float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; + int16_t ch; +#endif +#else float output[L_FRAME48k]; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -2067,19 +2920,34 @@ static ivas_error evs_dec_main( mdct_switching_dec( hCoreCoder[0] ); +#ifdef JBM_TSM_ON_TCS + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; ch++ ) + { + p_output[ch] = output[ch]; + } +#endif + /* run the main EVS decoding routine */ if ( hCoreCoder[0]->codec_mode == MODE1 ) { if ( hCoreCoder[0]->Opt_AMR_WB ) { +#ifdef NON_DIEGETIC_PAN + if ( ( error = amr_wb_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0] ) ) != IVAS_ERR_OK ) +#else if ( ( error = amr_wb_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output ) ) != IVAS_ERR_OK ) +#endif { return error; } } else { +#ifdef NON_DIEGETIC_PAN + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) +#else if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output, FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -2089,21 +2957,33 @@ static ivas_error evs_dec_main( { if ( hCoreCoder[0]->bfi == 0 ) { +#ifdef NON_DIEGETIC_PAN + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) +#else if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output, FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) +#endif { return error; } } else if ( hCoreCoder[0]->bfi == 2 ) { +#ifdef NON_DIEGETIC_PAN + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) +#else if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output, FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) +#endif { return error; } } else { +#ifdef NON_DIEGETIC_PAN + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output[0], FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) +#else if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], output, FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -2112,12 +2992,56 @@ static ivas_error evs_dec_main( st_ivas->BER_detect = hCoreCoder[0]->BER_detect; - /* convert 'float' output data to 'short' */ -#ifdef DEBUGGING - st_ivas->noClipping += +#ifdef NON_DIEGETIC_PAN + if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) + { + mixer_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; + mixer_rigth = 1.f - mixer_left; + v_multc( output[0], mixer_rigth, output[1], nOutSamples ); + v_multc( output[0], mixer_left, output[0], nOutSamples ); + } #endif - syn_output( output, nOutSamples, pcmBuf ); +#ifdef JBM_TSM_ON_TCS + if ( floatBuf != NULL ) + { + /* BE workaround */ + int16_t pcm_buf_local[L_FRAME48k]; + + + /* convert 'float' output data to 'short' */ +#ifdef DEBUGGING + st_ivas->noClipping += +#endif +#ifdef NON_DIEGETIC_PAN + ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcm_buf_local ); +#else + syn_output( output, nOutSamples, pcm_buf_local ); +#endif +#ifdef NON_DIEGETIC_PAN + mvs2r( pcm_buf_local, floatBuf, nOutSamples * st_ivas->hDecoderConfig->nchan_out ); +#else + mvs2r( pcm_buf_local, floatBuf, nOutSamples ); +#endif + } + else + { +#endif +#ifdef DEBUGGING + st_ivas->noClipping += +#endif +#ifdef NON_DIEGETIC_PAN +#ifdef JBM_TSM_ON_TCS + ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); +#else + ivas_syn_output( output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); +#endif +#else + syn_output( output, nOutSamples, pcmBuf ); +#endif +#ifdef JBM_TSM_ON_TCS + } +#endif return error; } @@ -2308,3 +3232,141 @@ static ivas_error input_format_API_to_internal( return IVAS_ERR_OK; } + +#ifdef JBM_TSM_ON_TCS +static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas ) +{ + + return st_ivas->hTcBuffer->n_samples_granularity; +} + +static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasDec ) +{ + JBM_RENDERER_TYPE rendererType; + rendererType = JBM_RENDERER_NONE; + + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) + { + rendererType = JBM_RENDERER_NONE; + } + else + { + rendererType = JBM_RENDERER_IVAS; + } + + return rendererType; +} + +ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ) +{ + + IVAS_DEC_VOIP *hVoIP; + ivas_error error; + + + hVoIP = hIvasDec->hVoIP; + + if ( hIvasDec->hVoIP->hTimeScaler == NULL ) + { + + uint16_t wss, css; + float startQuality; + DECODER_CONFIG_HANDLE hDecoderConfig; + +#ifdef VARIABLE_SPEED_DECODING + startQuality = hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ? -2.0f : 1.0f; +#else + startQuality = 1.0f; +#endif + /* get current renderer type*/ + hVoIP->rendererType = IVAS_DEC_VoIP_GetRendererConfig( hIvasDec ); + hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; + if ( hDecoderConfig->output_Fs == 8000 ) + { + wss = 1; + css = 1; + } + else if ( hDecoderConfig->output_Fs == 16000 ) + { + wss = 2; + css = 1; + } + else if ( hDecoderConfig->output_Fs == 32000 ) + { + wss = 4; + css = 2; + } + else if ( hDecoderConfig->output_Fs == 48000 ) + { + wss = 6; + css = 3; + } + else + { + return IVAS_ERR_INIT_ERROR; + } + hIvasDec->hVoIP->apaExecBuffer = malloc( sizeof( float ) * APA_BUF_PER_CHANNEL * nTransportChannels ); + set_zero( hIvasDec->hVoIP->apaExecBuffer, APA_BUF_PER_CHANNEL * nTransportChannels ); + if ( hIvasDec->hVoIP->apaExecBuffer == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } + if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, + nTransportChannels ) != IVAS_ERR_OK || + apa_set_rate( hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || + apa_set_complexity_options( hIvasDec->hVoIP->hTimeScaler, wss, css ) != 0 || + apa_set_quality( hIvasDec->hVoIP->hTimeScaler, startQuality, 4, 4 ) != 0 || + apa_set_renderer_granularity( hIvasDec->hVoIP->hTimeScaler, l_ts ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } + if ( hVoIP->hFifoOut == NULL && hVoIP->rendererType == JBM_RENDERER_NONE ) + { + /* we still need the FIFO out buffer */ + if ( pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoOut ) != 0 || + pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoOut, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } + } +#ifdef VARIABLE_SPEED_DECODING + else if ( hIvasDec->hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) + { + if ( pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoOut ) != 0 || + pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoOut, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } + } +#endif + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) + { + if ( apa_set_evs_compat_mode( hIvasDec->hVoIP->hTimeScaler, true ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } + } + } + else + { + if ( apa_reconfigure( hVoIP->hTimeScaler, nTransportChannels, l_ts ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } + + /* realloc apa_exe_buffer */ + free( hIvasDec->hVoIP->apaExecBuffer ); + hIvasDec->hVoIP->apaExecBuffer = malloc( sizeof( float ) * APA_BUF_PER_CHANNEL * nTransportChannels ); + set_zero( hIvasDec->hVoIP->apaExecBuffer, APA_BUF_PER_CHANNEL * nTransportChannels ); + if ( hIvasDec->hVoIP->apaExecBuffer == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } + } + hIvasDec->hVoIP->nTransportChannelsOld = (uint8_t) nTransportChannels; + + error = IVAS_ERR_OK; + + return error; +} +#endif diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 6761ebe6285e4cf2185f0820e536908e3d0d2559..fd8735dda63eff206e85de26e0ab2721dbaa0e41 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -34,9 +34,7 @@ #define LIB_DEC_H #include "common_api_types.h" -#include "ivas_error.h" #include -#include /*---------------------------------------------------------------------* @@ -79,6 +77,24 @@ typedef enum IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF = 4, /* RTP payload: only Header-Full format without zero padding for size collision avoidance */ } IVAS_DEC_INPUT_FORMAT; +#ifdef COMPLEXITY_LEVEL_INDICATION +typedef enum _IVAS_DEC_COMPLEXITY_LEVEL +{ + IVAS_DEC_COMPLEXITY_LEVEL_ONE = 1, + IVAS_DEC_COMPLEXITY_LEVEL_TWO = 2, + IVAS_DEC_COMPLEXITY_LEVEL_THREE = 3 +} IVAS_DEC_COMPLEXITY_LEVEL; +#endif + + +#ifdef VARIABLE_SPEED_DECODING +typedef enum +{ + IVAS_DEC_VOIP_MODE_VOIP = 0, + IVAS_DEC_VOIP_MODE_VARIABLE_SPEED = 1 +} IVAS_DEC_VOIP_MODE; +#endif + #ifdef DEBUGGING typedef enum _IVAS_DEC_FORCED_REND_MODE { @@ -120,8 +136,11 @@ typedef ivas_error ( *JbmTraceFileWriterFn )( const void *data, void *writer ); ivas_error IVAS_DEC_Open( IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ IVAS_DEC_MODE mode, /* i : compatibility mode (EVS or IVAS) */ - const int16_t orientation_tracking, /* i : orientation tracking type */ - float no_diegetic_pan + const int16_t orientation_tracking /* i : orientation tracking type */ +#ifndef NON_DIEGETIC_PAN + , + float no_diegetic_pan_gain /* i : non diegetic panning gain */ +#endif ); /*! r: error code */ @@ -131,10 +150,13 @@ ivas_error IVAS_DEC_Configure( const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ 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 */ -#ifdef DEBUGGING - , - const int16_t forceSubframeBinauralization /* i : enable subframe binauralization */ + const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ +#ifdef NON_DIEGETIC_PAN + const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ + const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ + const float non_diegetic_pan_gain /* i : non diegetic panning gain */ +#else + const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ #endif ); @@ -170,14 +192,27 @@ ivas_error IVAS_DEC_GetObjectMetadata( /*! r: error code */ ivas_error IVAS_DEC_GetMasaMetadata( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_MASA_QMETADATA_HANDLE *hMasaMetadata /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */ ); /*! r: error code */ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - IVAS_QUATERNION *orientation /* i : head-tracking data */ + IVAS_QUATERNION *orientation, /* i : head-tracking data */ + IVAS_VECTOR3 *Pos /* i : listener position */ +); + +/*! r: error code */ +ivas_error IVAS_DEC_FeedRefRotData( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_QUATERNION rotation /* i : reference rotation data */ +); +/*! r: error code */ +ivas_error IVAS_DEC_FeedRefVectorData( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ ); /*! r: error code */ @@ -191,38 +226,53 @@ ivas_error IVAS_DEC_VoIP_FeedFrame( const bool qBit /* i : Q bit for AMR-WB IO */ ); +#ifdef VARIABLE_SPEED_DECODING +/*! r: error code */ +ivas_error IVAS_DEC_VoIP_SetScale( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const int16_t scale /* i : TSM scale to set */ +); +#endif + /*! r: error code */ 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 */ + 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 */ +#if defined( JBM_TSM_ON_TCS ) || defined(VARIABLE_SPEED_DECODING ) + , + uint16_t *sampleAvailableNext /* o : samples available for the next call */ +#endif #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, void* jbmWriter #endif ); +#if defined( JBM_TSM_ON_TCS ) || defined(VARIABLE_SPEED_DECODING ) +ivas_error IVAS_DEC_VoIP_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 */ + uint16_t *nSamplesAvailableNext, /* o : number of samples still available */ + int16_t *nSamplesFlushed /* o : number of samples flushed */ +); +#endif + /* Setter functions - apply changes to decoder configuration */ /*! r: error code */ ivas_error IVAS_DEC_EnableVoIP( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ +#ifdef VARIABLE_SPEED_DECODING + const IVAS_DEC_VOIP_MODE voipMode, /* i : VoIP or varable speed */ + const uint16_t speedFac, /* i : speed factor for varable speed */ +#endif const int16_t jbmSafetyMargin, /* i : allowed delay reserve for JBM, in milliseconds */ const IVAS_DEC_INPUT_FORMAT inputFormat /* i : format of the input bitstream */ ); -/*! r: error code */ -ivas_error IVAS_DEC_SetHeadrotation( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const float w, /* i : w-coordinate of head rotation quaternion */ - const float x, /* i : x-coordinate of head rotation quaternion */ - const float y, /* i : y-coordinate of head rotation quaternion */ - const float z, /* i : z-coordinate of head rotation quaternion */ - const uint16_t i /* i : subframe index within current frame */ -); - - #ifdef DEBUGGING bool IVAS_DEC_GetBerDetectFlag( IVAS_DEC_HANDLE hIvasDec /* i : IVAS decoder handle */ @@ -284,7 +334,6 @@ ivas_error IVAS_DEC_GetHrtfHandle( IVAS_DEC_HRTF_HANDLE *hHrtfTD /* o : HRTF handle */ ); -#ifdef HRTF_BINARY_FILE /*! r: error code */ ivas_error IVAS_DEC_GetHrtfCRendHandle( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ @@ -300,7 +349,6 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* o : Parametric binauralizer HRTF handle */ ); -#endif /*! r: error code*/ ivas_error IVAS_DEC_GetRenderConfig( @@ -336,6 +384,10 @@ ivas_error IVAS_DEC_GetPcmFrameSize( /*! r: true if decoder has no data in VoIP jitter buffer */ bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ +#ifdef JBM_TSM_ON_TCS + , + int16_t nSamplesAsked +#endif ); ivas_error IVAS_DEC_VoIP_Get_CA_offset( diff --git a/lib_dec/lsf_dec.c b/lib_dec/lsf_dec.c index e29cc480a22433b3e5b480d5eeb4e661f2728734..73f8933daff76c16e4c0117877280bd95a8be8d7 100644 --- a/lib_dec/lsf_dec.c +++ b/lib_dec/lsf_dec.c @@ -43,10 +43,8 @@ #include "rom_com.h" #include "prot.h" #include "basop_proto_func.h" -#ifdef LSF_RE_USE_SECONDARY_CHANNEL #include "ivas_prot.h" #include "ivas_rom_com.h" -#endif #include "wmc_auto.h" @@ -74,10 +72,8 @@ void lsf_dec( float *lsp_new, /* o : de-quantized LSP vector */ float *lsp_mid, /* o : de-quantized mid-frame LSP vector */ const int16_t tdm_low_rate_mode /* i : secondary channel low rate mode flag */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL , const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -#endif ) { int16_t i, nBits, coder_type, no_param_lpc; @@ -132,12 +128,8 @@ void lsf_dec( } /* LSF de-quantization */ - lsf_end_dec( st, coder_type, st->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , - tdm_lsfQ_PCh -#endif - ); + lsf_end_dec( st, coder_type, st->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc, + tdm_lsfQ_PCh ); /* convert quantized LSFs to LSPs */ lsf2lsp( lsf_new, lsp_new, M, st->sr_core ); @@ -264,13 +256,11 @@ void lsf_end_dec( const int16_t bwidth, /* i : input signal bandwidth */ const int16_t nBits_in, /* i : number of bits used for ISF quantization*/ float *qlsf, /* o : quantized LSFs in the cosine domain */ - int16_t *lpc_param, - int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ - int16_t *nb_indices -#ifdef LSF_RE_USE_SECONDARY_CHANNEL + int16_t *lpc_param, /* i : LPC parameters */ + int16_t *LSF_Q_prediction, /* o : LSF prediction mode */ + int16_t *nb_indices /* o : number of indices */ , - const float tdm_lsfQ_PCh[M] -#endif + const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ) { float pred0[M]; /* Prediction for the safety-net quantizer (usually mean)*/ @@ -292,17 +282,13 @@ void lsf_end_dec( int16_t nBits; int16_t coder_type; int16_t flag_1bit_gran; -#ifdef LSF_RE_USE_SECONDARY_CHANNEL float pred3[M]; -#endif + flag_1bit_gran = ( st->element_mode > EVS_MONO ); nBits = nBits_in; *nb_indices = 0; - if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - && ( st->idchan == 0 ) /* this bit is used only for primary channel or mono */ -#endif + if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 && ( st->idchan == 0 ) /* this bit is used only for primary channel or mono */ ) { coder_type = get_next_indice( st, 1 ); @@ -343,14 +329,13 @@ void lsf_end_dec( * Select safety_net or predictive mode *--------------------------------------------------------------------------*/ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL + p_lpc_param = lpc_param; + if ( st->tdm_LRTD_flag == 0 && st->idchan == 1 && tdm_lsfQ_PCh != NULL ) { /* if secondary channel predmode is set to be > 2 */ predmode += 3; } -#endif - p_lpc_param = lpc_param; if ( predmode == 0 ) { @@ -378,7 +363,6 @@ void lsf_end_dec( st->safety_net = safety_net; -#ifdef LSF_RE_USE_SECONDARY_CHANNEL /* Make sure there are the correct bit allocations */ if ( st->idchan == 1 && predmode > 2 ) { @@ -388,7 +372,6 @@ void lsf_end_dec( mvs2s( levels1, levels0, stages0 ); mvs2s( bits1, bits0, stages0 ); } -#endif /*--------------------------------------------------------------------------* * Read indices from array @@ -533,18 +516,15 @@ void lsf_end_dec( pred1[i] = pred0[i] + MU_MA * st->mem_MA[i]; } -#ifdef LSF_RE_USE_SECONDARY_CHANNEL /* TD stereo SCh: perform intra-frame prediction with pulling-to-mean */ if ( st->tdm_LRTD_flag == 0 && st->idchan == 1 && tdm_lsfQ_PCh != NULL ) { tdm_SCh_LSF_intra_pred( st->element_brate, tdm_lsfQ_PCh, pred3 ); } -#endif if ( safety_net ) { /* LVQ */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL if ( st->tdm_LRTD_flag == 0 && st->idchan == 1 && tdm_lsfQ_PCh != NULL ) { @@ -557,33 +537,24 @@ void lsf_end_dec( } else { -#endif st->BER_detect = st->BER_detect | vq_dec_lvq( 1, qlsf, &lindice[1], stages0, M, mode_lvq, levels0[stages0 - 1] ); v_add( qlsf, pred0, qlsf, M ); v_sub( qlsf, pred1, st->mem_MA, M ); -#ifdef LSF_RE_USE_SECONDARY_CHANNEL } -#endif } else { -#ifdef LSF_RE_USE_SECONDARY_CHANNEL if ( predmode == 4 ) { mode_lvq_p = 9; predmode = 2; } -#endif st->BER_detect = st->BER_detect | vq_dec_lvq( 0, qlsf, &lindice[1], stages1, M, mode_lvq_p, levels1[stages1 - 1] ); - if ( predmode == 1 -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - || ( predmode == 4 ) -#endif - ) /* MA only */ + if ( predmode == 1 || ( predmode == 4 ) ) /* MA only */ { mvr2r( qlsf, st->mem_MA, M ); v_add( qlsf, pred1, qlsf, M ); diff --git a/lib_dec/lsf_msvq_ma_dec.c b/lib_dec/lsf_msvq_ma_dec.c index 2fa1f3573b0a432fe062ffce9c45b8358e721b77..9c911ab5f6f82be803ce483aced3d5e9948bbfe0 100644 --- a/lib_dec/lsf_msvq_ma_dec.c +++ b/lib_dec/lsf_msvq_ma_dec.c @@ -187,7 +187,7 @@ int16_t D_lsf_tcxlpc( NumIndices = 1; - msvq_dec( lsf_codebook[narrowband][cdk], lsf_dims, lsf_offs, TCXLPC_NUMSTAGES, M, M, indices + NumIndices, lsf_q, lsf_q_ind ); + msvq_dec( lsf_codebook[narrowband][cdk], lsf_dims, lsf_offs, TCXLPC_NUMSTAGES, M, M, indices + NumIndices, 0, NULL, lsf_q, lsf_q_ind ); NumIndices += TCXLPC_NUMSTAGES; @@ -195,7 +195,8 @@ int16_t D_lsf_tcxlpc( { /* Only add contribution if flag is enabled */ - msvq_dec( lsf_ind_codebook[narrowband][cdk], lsf_ind_dims, lsf_ind_offs, TCXLPC_IND_NUMSTAGES, M, M, indices + NumIndices, lsf_rem_q, lsf_rem_q_ind ); + + msvq_dec( lsf_ind_codebook[narrowband][cdk], lsf_ind_dims, lsf_ind_offs, TCXLPC_IND_NUMSTAGES, M, M, indices + NumIndices, 0, NULL, lsf_rem_q, lsf_rem_q_ind ); NumIndices += TCXLPC_IND_NUMSTAGES; /* Add to MA-removed vector */ @@ -264,7 +265,7 @@ int16_t dec_lsf_tcxlpc( } /* Decode independent lsf */ - msvq_dec( lsf_codebook[narrowband][cdk], lsf_dims, lsf_offs, TCXLPC_NUMSTAGES, M, M, flag + 1, lsf_q_ignored, lsf_q_ind ); + msvq_dec( lsf_codebook[narrowband][cdk], lsf_dims, lsf_offs, TCXLPC_NUMSTAGES, M, M, flag + 1, 0, NULL, lsf_q_ignored, lsf_q_ind ); /* Update flag */ *flag = lsf_ind_is_active( lsf_q_ind, lsf_means[narrowband], narrowband, cdk ); diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 8bd367814fd111d6366cc60b296599745adef528..9d3adbb18193ce2fd2e544a82d52661eb4734214 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -98,21 +98,30 @@ typedef struct float bandNoiseShape[FFTLEN2]; /* CNG spectral shape computed at the decoder */ float partNoiseShape[NPART]; /* CNG spectral shape computed at the decoder */ - float smoothed_psd[L_FRAME16k]; /* stereo CNA - periodogram smoothed with IIR filter */ - float msPeriodog_ST[NPART_SHAPING]; /* stereo CNA - short-term periodogram */ - int16_t ms_last_inactive_bwidth; /* stereo CNA - bandwidth from the last inactive frame */ - int16_t ms_cnt_bw_up; /* stereo CNA - downward counter of frames since the last NB->WB switch */ - float cna_LR_LT; /* stereo CNA - long-term L/R correlation factor calculated on stereo upmix */ - float cna_ILD_LT; /* stereo CNA - long-term ILD factor calculated on stereo upmix */ - float cna_g_state[STEREO_DFT_BAND_MAX]; /* stereo CNA - side gains from the last inactive frame */ + float smoothed_psd[L_FRAME16k]; /* stereo CNA - periodogram smoothed with IIR filter */ + float msPeriodog_ST[NPART_SHAPING]; /* stereo CNA - short-term periodogram */ + int16_t ms_last_inactive_bwidth; /* stereo CNA - bandwidth from the last inactive frame */ + int16_t ms_cnt_bw_up; /* stereo CNA - downward counter of frames since the last NB->WB switch */ + float cna_LR_LT; /* stereo CNA - long-term L/R correlation factor calculated on stereo upmix */ + float cna_ILD_LT; /* stereo CNA - long-term ILD factor calculated on stereo upmix */ + float cna_g_state[STEREO_DFT_BAND_MAX]; /* stereo CNA - side gains from the last inactive frame */ +#ifdef FIX_I414_OOA_CNA + float cna_cm[STEREO_DFT_BAND_MAX]; /* stereo CNA - coherence from the last inactive frame */ +#else float cna_cm[STEREO_DFT_BAND_MAX + 1]; /* stereo CNA - coherence from the last inactive frame */ - int16_t first_cna_noise_updated; /* stereo CNA - flag indicating that comfort noise has been properly initialized during warmup */ - int16_t first_cna_noise_update_cnt; /* stereo CNA - counter of CN initialization frames */ - int16_t cna_nbands; /* stereo CNA - number of frequency bands used by the CNA in DFT stereo mode */ +#endif + int16_t first_cna_noise_updated; /* stereo CNA - flag indicating that comfort noise has been properly initialized during warmup */ + int16_t first_cna_noise_update_cnt; /* stereo CNA - counter of CN initialization frames */ + int16_t cna_nbands; /* stereo CNA - number of frequency bands used by the CNA in DFT stereo mode */ + +#ifdef FIX_I414_OOA_CNA + int16_t cna_band_limits[STEREO_DFT_BAND_MAX + 1]; /* stereo CNA - band limits used by the CNA in DFT stereo mode */ +#else int16_t cna_band_limits[MAX_CNA_NBANDS + 1]; /* stereo CNA - band limits used by the CNA in DFT stereo mode */ - float cna_act_fact; /* stereo CNA - long-term signal activity factor (0-1) */ - float cna_rescale_fact; /* stereo CNA - CN energy re-scaling factor to maintain decoded energy */ - int16_t cna_seed; /* stereo CNA - seed for random CN generator */ +#endif + float cna_act_fact; /* stereo CNA - long-term signal activity factor (0-1) */ + float cna_rescale_fact; /* stereo CNA - CN energy re-scaling factor to maintain decoded energy */ + int16_t cna_seed; /* stereo CNA - seed for random CN generator */ int16_t flag_dtx_mode; float lp_speech; @@ -934,9 +943,7 @@ typedef struct Decoder_State int16_t ini_frame; /* initialization frames counter */ int16_t prev_coder_type; /* coding type of last frame */ int16_t low_rate_mode; /* low-rate mode flag */ -#ifdef FIX_299_ISM_BWS - int16_t last_low_rate_mode; /* previous frame low-rate mode flag */ -#endif + int16_t last_low_rate_mode; /* previous frame low-rate mode flag */ /*----------------------------------------------------------------------------------* * ACELP core parameters @@ -1347,6 +1354,11 @@ typedef struct Decoder_State /* MCT Channel mode indication: LFE, ignore channel? */ MCT_CHAN_MODE mct_chan_mode; + int16_t cng_ism_flag; /* CNG in ISM format flag */ +#ifndef FIX_ISM_DTX_CNG_BWIDTH_ALT + int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ +#endif + int16_t is_ism_format; /* Indication whether the codec operates in ISM format */ } Decoder_State, *DEC_CORE_HANDLE; diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index 5a75a8774f350736ccf4dc3921f6f724e34638fe..79fe3b0e68df74513fc47ddd79198162d95365bc 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -535,6 +535,7 @@ void swb_tbe_dec( { tilt_swb_fec = hBWE_TD->tilt_swb_fec; } + /* WB/SWB bandwidth switching */ if ( ( st->tilt_wb > 5 && st->clas_dec == UNVOICED_CLAS ) || st->tilt_wb > 10 ) { @@ -965,6 +966,7 @@ void swb_tbe_dec( /* convert from lsp to lsf */ lsp2lsf( lsp_temp, lsf_shb, LPC_SHB_ORDER, 1 ); } + mvr2r( lsf_diff + 1, hBWE_TD->prev_lsf_diff, LPC_SHB_ORDER - 2 ); hBWE_TD->prev_tilt_para = tilt_para; } @@ -1036,8 +1038,7 @@ void swb_tbe_dec( /* From low band excitation, generate highband excitation */ mvr2r( hBWE_TD->state_syn_shbexc, shaped_shb_excitation, L_SHB_LAHEAD ); GenShapedSHBExcitation( shaped_shb_excitation + L_SHB_LAHEAD, lpc_shb, White_exc16k, hBWE_TD->mem_csfilt, hBWE_TD->mem_genSHBexc_filt_down_shb, hBWE_TD->state_lpc_syn, st->coder_type, bwe_exc_extended, hBWE_TD->bwe_seed, vf_modified, st->extl, &( hBWE_TD->tbe_demph ), &( hBWE_TD->tbe_premph ), lpc_shb_sf, &shb_ener_sf, shb_res_gshape, shb_res_dummy, &vind, formant_fac, hBWE_TD->fb_state_lpc_syn, &( hBWE_TD->fb_tbe_demph ), st->total_brate, st->prev_bfi, st->element_mode, st->flag_ACELP16k, nlExc16k, mixExc16k, st->extl_brate, MSFlag, - NULL, &( hBWE_TD->prev_pow_exc16kWhtnd ), &( hBWE_TD->prev_mix_factor ), NULL, - NULL ); + NULL, &( hBWE_TD->prev_pow_exc16kWhtnd ), &( hBWE_TD->prev_mix_factor ), NULL, NULL ); /* fill-in missing SHB excitation */ if ( ( st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT ) && st->last_core_brate <= SID_2k40 ) diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index cb27b57ebf852b74e91c4da7657f08a1be5c9cb4..041e3a3d2fa493f5b9d66325cfc9baad7e59ef1a 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -386,15 +386,14 @@ static void CalcMDXT( const TonalMDCTConcealPtr hTonalMDCTConc, const char type, const float *timeSignal, - float *mdxtOutput, - const int16_t isLfe ) + float *mdxtOutput ) { float windowedTimeSignal[L_FRAME_PLUS + 2 * L_MDCT_OVLP_MAX]; int16_t left_overlap, right_overlap; int16_t L_frame; L_frame = hTonalMDCTConc->nSamples; - WindowSignal( hTonalMDCTConc->tcx_cfg, hTonalMDCTConc->tcx_cfg->tcx_offsetFB, FULL_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, timeSignal, &L_frame, windowedTimeSignal, 1, 1, isLfe ); + WindowSignal( hTonalMDCTConc->tcx_cfg, hTonalMDCTConc->tcx_cfg->tcx_offsetFB, FULL_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, timeSignal, &L_frame, windowedTimeSignal, 1, 1 ); if ( type == 'S' ) { @@ -413,8 +412,7 @@ void TonalMDCTConceal_Detect( const TonalMDCTConcealPtr hTonalMDCTConc, const float pitchLag, int16_t *numIndices, - const PsychoacousticParameters *psychParamsCurrent, - const int16_t isLfe ) + const PsychoacousticParameters *psychParamsCurrent ) { float secondLastMDST[L_FRAME_MAX]; /* 32 bits are required */ float secondLastMDCT[L_FRAME_MAX]; /* 32 bits are required */ @@ -431,10 +429,8 @@ void TonalMDCTConceal_Detect( { if ( !hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) { - CalcMDXT( hTonalMDCTConc, 'S', hTonalMDCTConc->secondLastPcmOut, secondLastMDST, - isLfe ); - CalcMDXT( hTonalMDCTConc, 'C', hTonalMDCTConc->secondLastPcmOut, secondLastMDCT, - isLfe ); + CalcMDXT( hTonalMDCTConc, 'S', hTonalMDCTConc->secondLastPcmOut, secondLastMDST ); + CalcMDXT( hTonalMDCTConc, 'C', hTonalMDCTConc->secondLastPcmOut, secondLastMDCT ); hTonalMDCTConc->nNonZeroSamples = 0; for ( i = 0; i < hTonalMDCTConc->nSamples; i++ ) { diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index 29682d5e73269a943cc91046042785c6d9b1c38d..d78f9bf25888ea73be399e04a4d086a681708366 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -47,9 +47,7 @@ #include "prot.h" #include "ivas_cnst.h" #include "ivas_prot.h" -#ifdef LSF_RE_USE_SECONDARY_CHANNEL #include "ivas_rom_com.h" -#endif #include "wmc_auto.h" /*-------------------------------------------------------------------* @@ -75,7 +73,6 @@ ivas_error acelp_core_enc( float pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe */ int16_t *unbits, /* o : number of unused bits */ STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ - const float tdm_lspQ_PCh[M], /* i : Q LSPs for primary channel */ const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ ) { @@ -314,10 +311,13 @@ ivas_error acelp_core_enc( if ( st->core_brate == SID_2k40 ) { - tmpF = cng_energy( st->element_mode, st->bwidth, st->hDtxEnc->CNG_mode, st->hTdCngEnc->CNG_att, exc, st->L_frame ); - i = (int16_t) ( ( tmpF + 2.0f ) * STEP_SID ); - i = min( max( i, 0 ), 127 ); - st->hTdCngEnc->old_enr_index = i; + if ( st->hTdCngEnc != NULL ) + { + tmpF = cng_energy( st->element_mode, st->bwidth, st->hDtxEnc->CNG_mode, st->hTdCngEnc->CNG_att, exc, st->L_frame ); + i = (int16_t) ( ( tmpF + 2.0f ) * STEP_SID ); + i = min( max( i, 0 ), 127 ); + st->hTdCngEnc->old_enr_index = i; + } } } @@ -369,9 +369,10 @@ ivas_error acelp_core_enc( nb_bits = 0; st->acelp_cfg.FEC_mode = 0; uc_two_stage_flag = 0; + if ( !nelp_mode && !ppp_mode ) { - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); } /*-----------------------------------------------------------------* @@ -407,19 +408,15 @@ ivas_error acelp_core_enc( if ( !tdm_lp_reuse_flag ) { -#ifdef LSF_RE_USE_SECONDARY_CHANNEL lsf_enc( st, lsf_new, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, st->GSC_IVAS_mode, tdm_lsfQ_PCh ); -#else - lsf_enc( st, lsf_new, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, st->GSC_IVAS_mode ); -#endif } else { const float *pt_interp_2; -#ifdef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE + if ( st->active_cnt != 1 ) { - int16_t beta_index[1]; + int16_t beta_index; float lsf_wgts[M]; /* intra_frame prediction for the LSFs */ @@ -427,36 +424,24 @@ ivas_error acelp_core_enc( Unified_weighting( &st->Bin_E[L_FFT / 2], lsf_new, lsf_wgts, st->bwidth == NB, st->coder_type == UNVOICED, st->sr_core, M ); - tdm_SCh_lsf_reuse( ENC, st->element_brate, lsf_new, lsp_new, tdm_lsfQ_PCh, lsf_wgts, beta_index ); + tdm_SCh_lsf_reuse( ENC, st->element_brate, lsf_new, lsp_new, tdm_lsfQ_PCh, lsf_wgts, &beta_index ); - push_indice( hBstr, IND_IC_LSF_PRED, beta_index[0], TDM_IC_LSF_PRED_BITS ); - } - if ( st->active_cnt == 1 ) - { - mvr2r( lsp_new, st->lsp_old, M ); - lsp2lsf( lsp_new, st->lsf_old, M, st->sr_core ); - lsp2lsf( lsp_new, lsf_new, M, st->sr_core ); + push_indice( hBstr, IND_IC_LSF_PRED, beta_index, TDM_IC_LSF_PRED_BITS ); } -#else - if ( st->active_cnt != 1 ) - { - mvr2r( tdm_lspQ_PCh, lsp_new, M ); - mvr2r( tdm_lsfQ_PCh, lsf_new, M ); - } -#endif + pt_interp_2 = interpol_frac_12k8; if ( tdm_low_rate_mode == 1 && st->coder_type > UNVOICED ) { pt_interp_2 = interpol_frac2; } -#ifndef LSF_RE_USE_SECONDARY_CHANNEL_REUSEMODE + if ( st->active_cnt == 1 ) { mvr2r( lsp_new, st->lsp_old, M ); lsp2lsf( lsp_new, st->lsf_old, M, st->sr_core ); lsp2lsf( lsp_new, lsf_new, M, st->sr_core ); } -#endif + /* LSP interpolation and conversion of LSPs to A(z) */ int_lsp( st->L_frame, st->lsp_old, lsp_new, Aq, M, pt_interp_2, 0 ); @@ -500,7 +485,7 @@ ivas_error acelp_core_enc( { tc_classif_enc( st->L_frame, &tc_subfr, &position, attack_flag, st->pitch[0], res ); - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); } /*---------------------------------------------------------------* @@ -558,14 +543,10 @@ ivas_error acelp_core_enc( lsf_syn_mem_restore( st, tilt_code_bck, gc_threshold_bck, clip_var_bck, next_force_sf_bck, lsp_new, lsp_mid, clip_var, mem_AR, mem_MA, lsp_new_bck, lsp_mid_bck, Bin_E, Bin_E_old, mem_syn_bck, mem_w0_bck, streaklimit, pstreaklen ); /* Configure ACELP bit allocation */ - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); /* redo LSF quantization */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL lsf_enc( st, lsf_new, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL ); -#else - lsf_enc( st, lsf_new, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0 ); -#endif /* recalculation of LP residual (filtering through A[z] filter) */ calc_residu( inp, res, Aq, st->L_frame ); diff --git a/lib_enc/acelp_core_switch_enc.c b/lib_enc/acelp_core_switch_enc.c index 291c2128a19a6423946c78e27b1dc0bff58e44f2..f573649d3ce1ef95580e7f1a0e438f49e093cd1e 100644 --- a/lib_enc/acelp_core_switch_enc.c +++ b/lib_enc/acelp_core_switch_enc.c @@ -151,7 +151,7 @@ void acelp_core_switch_enc( * Excitation encoding *----------------------------------------------------------------*/ - config_acelp1( ENC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, -1, -1, &j, &i, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); + config_acelp1( ENC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, -1, -1, &j, &i, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); encod_gen_voic_core_switch( st, st->last_L_frame, inp, Aq, A, T_op, st->voicing, exc, cbrate ); diff --git a/lib_enc/acelp_enc_util.c b/lib_enc/acelp_enc_util.c index 24673928a4b96e9acee9cc8e1da00d1e887aac67..fdbc3a8b09a852ee66ee615018bb8c223f6ef96c 100644 --- a/lib_enc/acelp_enc_util.c +++ b/lib_enc/acelp_enc_util.c @@ -39,7 +39,6 @@ #ifdef DEBUGGING #include "debug.h" #endif -#include "typedef.h" #include "prot.h" #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/amr_wb_enc.c b/lib_enc/amr_wb_enc.c index ffe6645688e56e1b34965d47db4ca5b28097396b..c0c0b4f18e51df211b71704c96ec4d4c6772a236 100644 --- a/lib_enc/amr_wb_enc.c +++ b/lib_enc/amr_wb_enc.c @@ -310,9 +310,7 @@ void amr_wb_enc( { st->fd_cng_reset_flag = 0; } - dtx( st, -1, vad_flag_dtx, inp ); - /*----------------------------------------------------------------* * Noise energy down-ward update and total noise energy estimation * Long-term energies and relative frame energy updates @@ -344,7 +342,8 @@ void amr_wb_enc( * WB, SWB and FB bandwidth detector *----------------------------------------------------------------*/ - bw_detect( st, st->input, NULL, NULL ); + bw_detect( st, st->input, NULL, NULL, + 0 ); /* in AMR_WB IO, limit the maximum band-width to WB */ if ( st->bwidth > WB ) diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index 5f46910c57076190a267f7e8f8785b2460431e5b..6de35a211a50ba5e2461bb2f42041346828d5e30 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -55,8 +55,9 @@ #define ALPHA_BWD 0.75f #define BWD_LT_THRESH 0.6f -#define BWD_COUNT_MAX 100 -#define BWD_COUNT_WIDER_BW 10 +#define BWD_COUNT_MAX 100 +#define BWD_COUNT_WIDER_BW 10 +#define BWD_COUNT_WIDER_BW_MDCT 0 #define CLDFB_ENER_OFFSET 1.6f @@ -71,6 +72,8 @@ void bw_detect( const float signal_in[], /* i : input signal */ float *spectrum, /* i : MDCT spectrum */ const float *enerBuffer /* i : energy buffer */ + , + const int16_t mct_on /* i : flag MCT mode */ ) { int16_t i, j, k, bw_max, bin_width, n_bins; @@ -80,6 +83,13 @@ void bw_detect( const float *pt, *pt1; float max_NB, max_WB, max_SWB, max_FB, mean_NB, mean_WB, mean_SWB, mean_FB; int16_t cldfb_bin_width = 4; + int16_t bwd_count_wider_bw, l_frame; + + bwd_count_wider_bw = BWD_COUNT_WIDER_BW; + if ( st->element_mode == IVAS_CPE_MDCT && ( st->element_brate > IVAS_64k || mct_on ) ) + { + bwd_count_wider_bw = BWD_COUNT_WIDER_BW_MDCT; + } if ( st->input_Fs > 8000 ) { @@ -173,8 +183,14 @@ void bw_detect( } else { - bin_width *= (int16_t) ( ( st->input_Fs / FRAMES_PER_SEC ) / BWD_TOTAL_WIDTH ); - mvr2r( spectrum, spect, (int16_t) ( st->input_Fs / FRAMES_PER_SEC ) ); + l_frame = (int16_t) ( st->input_Fs / FRAMES_PER_SEC ); + if ( st->core == TCX_10_CORE ) + { + l_frame /= 2; + } + + bin_width *= ( l_frame / BWD_TOTAL_WIDTH ); + mvr2r( spectrum, spect, l_frame ); } /*---------------------------------------------------------------------* * compute energy per spectral bins @@ -392,17 +408,17 @@ void bw_detect( /* switching to a higher BW */ if ( st->last_input_bwidth == NB ) { - if ( st->count_WB > BWD_COUNT_WIDER_BW ) + if ( st->count_WB > bwd_count_wider_bw ) { st->input_bwidth = WB; st->count_WB = BWD_COUNT_MAX; - if ( st->count_SWB > BWD_COUNT_WIDER_BW ) + if ( st->count_SWB > bwd_count_wider_bw ) { st->input_bwidth = SWB; st->count_SWB = BWD_COUNT_MAX; - if ( st->count_FB > BWD_COUNT_WIDER_BW ) + if ( st->count_FB > bwd_count_wider_bw ) { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; @@ -413,12 +429,12 @@ void bw_detect( if ( st->last_input_bwidth == WB && st->input_Fs > 16000 ) { - if ( st->count_SWB > BWD_COUNT_WIDER_BW ) + if ( st->count_SWB > bwd_count_wider_bw ) { st->input_bwidth = SWB; st->count_SWB = BWD_COUNT_MAX; - if ( st->count_FB > BWD_COUNT_WIDER_BW ) + if ( st->count_FB > bwd_count_wider_bw ) { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; @@ -428,7 +444,7 @@ void bw_detect( if ( st->last_input_bwidth == SWB && st->input_Fs > 32000 ) { - if ( st->count_FB > BWD_COUNT_WIDER_BW ) + if ( st->count_FB > bwd_count_wider_bw ) { st->input_bwidth = FB; st->count_FB = BWD_COUNT_MAX; @@ -620,22 +636,13 @@ void set_bw_stereo( if ( hCPE->element_mode == IVAS_CPE_MDCT ) { - /* do not check bandwidth in LFE channel */ - if ( sts[0]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - sts[0]->bwidth = sts[0]->input_bwidth; - } - else if ( sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - sts[1]->bwidth = sts[1]->input_bwidth; - } /* ensure that both CPE channels have the same audio band-width */ - else if ( sts[0]->input_bwidth == sts[1]->input_bwidth ) + if ( sts[0]->input_bwidth == sts[1]->input_bwidth ) { sts[0]->bwidth = sts[0]->input_bwidth; sts[1]->bwidth = sts[0]->input_bwidth; } - else if ( sts[0]->input_bwidth != sts[1]->input_bwidth ) + else { sts[0]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); sts[1]->bwidth = max( sts[0]->input_bwidth, sts[1]->input_bwidth ); @@ -672,7 +679,8 @@ int16_t set_bw_mct( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = hCPE[cpe_id]->hCoreCoder[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } diff --git a/lib_enc/cng_enc.c b/lib_enc/cng_enc.c index 04d9e4116621c977f0ae6a60f4c4adc90d259576..14eef260b465b5b7354e7bb06820257f4c2cd160 100644 --- a/lib_enc/cng_enc.c +++ b/lib_enc/cng_enc.c @@ -263,11 +263,7 @@ void CNG_enc( } else { -#ifdef LSF_RE_USE_SECONDARY_CHANNEL lsf_enc( st, lsf_new, lsp_new, 0, 0, 0, 0, NULL ); -#else - lsf_enc( st, lsf_new, lsp_new, 0, 0, 0, 0 ); -#endif } /* Reset CNG history if CNG frame length is changed */ diff --git a/lib_enc/cod_tcx.c b/lib_enc/cod_tcx.c index 8c647be38a0c3b96ea33b77f2c66f6e2c743ba9a..ac24d74bf2bf792fe34af0619f0c5fbd5186a946 100644 --- a/lib_enc/cod_tcx.c +++ b/lib_enc/cod_tcx.c @@ -73,7 +73,7 @@ void HBAutocorrelation( * Windowing * *-----------------------------------------------------------*/ - WindowSignal( hTcxCfg, hTcxCfg->tcx_offset, left_overlap_mode, right_overlap_mode, &left_overlap, &right_overlap, speech, &L_frame, xn_buf, 1, 0, 0 ); + WindowSignal( hTcxCfg, hTcxCfg->tcx_offset, left_overlap_mode, right_overlap_mode, &left_overlap, &right_overlap, speech, &L_frame, xn_buf, 1, 0 ); /*-----------------------------------------------------------* * Autocorrelation * @@ -134,11 +134,11 @@ void TNSAnalysisStereo( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } + hTcxEnc = st->hTcxEnc; nSubframes = ( hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; @@ -382,8 +382,7 @@ void TNSAnalysisStereo( /* individual decision for each channel */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -465,10 +464,11 @@ void TNSAnalysisStereo( /* we have the decision, set filter data accordingly */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } + nSubframes = ( sts[ch]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; for ( k = 0; k < nSubframes; k++ ) @@ -501,10 +501,11 @@ void TNSAnalysisStereo( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } + nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; for ( k = 0; k < nSubframes; k++ ) @@ -970,11 +971,6 @@ void EstimateStereoTCXNoiseLevel( { fac_ns_q = param_core[ch] + n * NPRM_DIV + 1; maxNfCalcBw = min( noiseFillingBorder[ch][n], (int16_t) ( hTcxEnc->measuredBwRatio * (float) L_frame[ch][n] + 0.5f ) ); - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - maxNfCalcBw = min( maxNfCalcBw, MCT_LFE_MAX_LINE ); - } - if ( ( total_brate >= HQ_96k && ( st->element_mode <= IVAS_SCE || st->bwidth < SWB ) ) || total_brate > IVAS_192k ) { fac_ns[ch][n] = 0.0f; @@ -2107,7 +2103,7 @@ void coder_tcx( if ( st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) { - WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, win, 1, 1, 0 ); + WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, win, 1, 1 ); /* Compute MDCT for xn_buf[] */ TCX_MDCT( win, spectrum, left_overlap, L_frame - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); @@ -2116,7 +2112,7 @@ void coder_tcx( { wtda( st->hTcxEnc->new_speech_TCX, win, NULL, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, L_frame ); - WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, winMDST, 1, 1, 0 ); + WindowSignal( hTcxCfg, hTcxCfg->tcx_offsetFB, hTcxCfg->tcx_last_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ? FULL_OVERLAP : hTcxCfg->tcx_curr_overlap_mode, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_frame, winMDST, 1, 1 ); edct( win, spectrum, L_frame, st->element_mode ); diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index a87bfefb874d890f08f4f4258c3a964755a08753..774b1398c52a32bba57e2117744381bb9df33648 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -261,7 +261,7 @@ static void init_tcx( hTcxEnc->spectrum[0] = hTcxEnc->spectrum_long; hTcxEnc->spectrum[1] = hTcxEnc->spectrum_long + N_TCX10_MAX; - init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->encoderLookahead_enc, st->encoderLookahead_FB, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, st->mct_chan_mode ); + init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->encoderLookahead_enc, st->encoderLookahead_FB, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag ); /* Init TCX target bits correction factor */ hTcxEnc->tcx_target_bits_fac = 1.0f; diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index 14fcac389443b9e5fd358353b5101959384e4292..d6c866d4c56e56a671a6b8b857f98bd106d2333d 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -95,7 +95,7 @@ void core_coder_mode_switch( st->bits_frame_nominal = (int16_t) ( (float) st->L_frame / (float) st->fscale * (float) FSCALE_DENOM / 128.0f * (float) st->total_brate / 100.0f + 0.49f ); - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); /* switch IGF configuration */ if ( st->igf ) @@ -112,7 +112,7 @@ void core_coder_mode_switch( hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->total_brate, st->rf_mode, st->element_mode ); st->hTcxCfg->tcxRateLoopOpt = ( st->hTcxCfg->resq && !st->tcxonly ) ? 1 : st->hTcxCfg->tcxRateLoopOpt; - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->total_brate, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->total_brate, st->igf, st->element_mode ); if ( st->hTcxCfg->fIsTNSAllowed ) { @@ -151,7 +151,7 @@ void core_coder_mode_switch( } else { - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); init_coder_ace_plus( st, last_total_brate, MCT_flag ); } diff --git a/lib_enc/dtx.c b/lib_enc/dtx.c index 3aa78adb65f2898027e9b789b40e2d4075caa0cc..08d4316750868e4b72df31b8bf6ec6a11e393a84 100644 --- a/lib_enc/dtx.c +++ b/lib_enc/dtx.c @@ -63,9 +63,12 @@ #define LTE_VAR -4.0f -#define MAX_BRATE_DTX_EVS ACELP_24k40 /* maximum bitrate to which the default DTX is applied in EVS; otherwise DTX is applied only in silence */ -#define MAX_BRATE_DTX_IVAS IVAS_64k /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */ - +#define MAX_BRATE_DTX_EVS ACELP_24k40 /* maximum bitrate to which the default DTX is applied in EVS; otherwise DTX is applied only in silence */ +#ifndef FIX_368_SBA_MODE +#define MAX_BRATE_DTX_IVAS IVAS_64k /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */ +#else +#define MAX_BRATE_DTX_IVAS IVAS_80k /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */ +#endif /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ @@ -86,11 +89,8 @@ void dtx( ) { float alpha; - DTX_ENC_HANDLE hDtxEnc = st->hDtxEnc; - int16_t last_br_cng_flag, last_br_flag, br_dtx_flag; - if ( st->dtx_sce_sba != 0 ) { last_br_cng_flag = 1; @@ -100,7 +100,6 @@ void dtx( else { last_br_cng_flag = st->last_total_brate_cng <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate_cng <= MAX_BRATE_DTX_IVAS ); - last_br_flag = st->last_total_brate <= MAX_BRATE_DTX_EVS || st->lp_noise < 15 || ( st->element_mode == IVAS_SCE && st->last_total_brate <= MAX_BRATE_DTX_IVAS ); br_dtx_flag = 0; } @@ -239,7 +238,11 @@ void dtx( } else { +#ifdef FIX_357_DTX_32K + if ( ( st->cng_type == FD_CNG && ( st->total_brate <= MAX_BRATE_DTX_EVS || ( st->element_mode != EVS_MONO && ivas_total_brate <= MAX_BRATE_DTX_IVAS ) ) ) || ( st->element_mode == IVAS_CPE_MDCT ) ) /* at highest bitrates, use exclusively LP_CNG */ +#else if ( ( st->cng_type == FD_CNG && ( st->total_brate <= MAX_BRATE_DTX_EVS || ( st->element_mode == IVAS_SCE && ivas_total_brate <= MAX_BRATE_DTX_IVAS ) ) ) || ( st->element_mode == IVAS_CPE_MDCT ) ) /* at highest bitrates, use exclusively LP_CNG */ +#endif { if ( st->element_mode == EVS_MONO && ( st->total_brate == ACELP_9k60 || st->total_brate == ACELP_16k40 || st->total_brate == ACELP_24k40 ) ) { diff --git a/lib_enc/enc_acelp.c b/lib_enc/enc_acelp.c index 321656850ccefdabe7b11dd4fe6b173a0a22f412..5e1401828ee47f4b0e12dd039618c975df37c6f2 100644 --- a/lib_enc/enc_acelp.c +++ b/lib_enc/enc_acelp.c @@ -35,7 +35,6 @@ ====================================================================================*/ #include -#include "typedef.h" #include #include "options.h" #ifdef DEBUGGING diff --git a/lib_enc/enc_acelpx.c b/lib_enc/enc_acelpx.c index 72bea4748dcfa86a6431a78e5df324471163453c..c72f2fa1c340fa90d49b0d1cc2195bc3a2048f3f 100644 --- a/lib_enc/enc_acelpx.c +++ b/lib_enc/enc_acelpx.c @@ -35,7 +35,6 @@ ====================================================================================*/ #include -#include "typedef.h" #include #include "options.h" #ifdef DEBUGGING diff --git a/lib_enc/enc_gain.c b/lib_enc/enc_gain.c index e3621d654c022e0e95787bb8fa01fca2d5556165..607c36f6e9a75843068355dfd4f8a88cecaa5abb 100644 --- a/lib_enc/enc_gain.c +++ b/lib_enc/enc_gain.c @@ -37,7 +37,6 @@ #include #include #include "options.h" -#include "typedef.h" #include "prot.h" #include "rom_enc.h" #include "rom_com.h" diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index b90f10359b2eddf3bb4250e421fc41b8fc1bc7f2..da0556dd7215497b3c2151a963a9b0569d306435 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -242,7 +242,7 @@ ivas_error evs_enc( if ( st->core == ACELP_CORE ) { - if ( ( error = acelp_core_enc( st, inp, ener, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL, NULL ) ) != IVAS_ERR_OK ) + if ( ( error = acelp_core_enc( st, inp, ener, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL ) ) != IVAS_ERR_OK ) { return error; } @@ -686,7 +686,7 @@ static void configure_core_coder( } } - st->igf = getIgfPresent( 0, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( 0, st->total_brate, st->bwidth, st->rf_mode ); if ( st->core_brate != SID_2k40 && st->core_brate != FRAME_NO_DATA ) { diff --git a/lib_enc/ext_sig_ana.c b/lib_enc/ext_sig_ana.c old mode 100644 new mode 100755 index 9e1ad869ab239d34105dbbc93b7573f34a75c87c..f79fbb5f95f2def7067e134ead944591d9d6882a --- a/lib_enc/ext_sig_ana.c +++ b/lib_enc/ext_sig_ana.c @@ -215,35 +215,24 @@ void core_signal_analysis_high_bitrate( if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { - wtda( hTcxEnc->new_speech_TCX, tcx20Win, NULL, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX ); + wtda( hTcxEnc->new_speech_TCX, tcx20Win, NULL, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX ); - if ( windowed_samples != NULL ) /* store overlap data for later */ - { - assert( frameno == 0 ); - windowed_samples[0] = (float) overlap_mode[frameno]; - windowed_samples[1] = (float) overlap_mode[frameno + 1]; - } - } - else + if ( windowed_samples != NULL ) /* store overlap data for later */ { - /* Windowing of the LFE Signal*/ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, tcx20Win, - st->element_mode != IVAS_CPE_MDCT /* truncate_aldo */, - 1, 1 ); + assert( frameno == 0 ); + windowed_samples[0] = (float) overlap_mode[frameno]; + windowed_samples[1] = (float) overlap_mode[frameno + 1]; } - if ( st->element_mode != IVAS_CPE_MDCT ) { /* Windowing of the 2xTCX5 subframes or 1xTCX10 or 1xTCX20 */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 1, 1, 0 ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 1, 1 ); } } else { /* Windowing of the 2xTCX5 subframes or 1xTCX10 or 1xTCX20 */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno], overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, tcx20Win, st->element_mode != IVAS_CPE_MDCT, 1, 0 ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno], overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, tcx20Win, st->element_mode != IVAS_CPE_MDCT, 1 ); if ( windowed_samples != NULL ) /* save windowed speech_TCX samples */ { @@ -282,8 +271,7 @@ void core_signal_analysis_high_bitrate( for ( i = 0; i < 2; i++ ) { - assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); - WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, tcx20Win + i * tcx5SizeFB, &L_subframe, tcx5Win, st->element_mode != IVAS_CPE_MDCT, 1, 0 ); + WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, tcx20Win + i * tcx5SizeFB, &L_subframe, tcx5Win, st->element_mode != IVAS_CPE_MDCT, 1 ); TCX_MDCT( tcx5Win, hTcxEnc->spectrum[frameno] + i * tcx5SizeFB, left_overlap, L_subframe - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); @@ -298,7 +286,7 @@ void core_signal_analysis_high_bitrate( { assert( transform_type[frameno] == TCX_10 || transform_type[frameno] == TCX_20 ); - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { edct( tcx20Win, hTcxEnc->spectrum[frameno], L_subframe, st->element_mode ); @@ -324,12 +312,6 @@ void core_signal_analysis_high_bitrate( v_multc( hTcxEnc->spectrum[frameno] + L_FRAME16k / nSubframes, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, hTcxEnc->spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); } - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - set_f( &hTcxEnc->spectrum[frameno][MCT_LFE_MAX_LINE], 0.f, L_subframe - MCT_LFE_MAX_LINE ); - st->hTcxCfg->tcx_coded_lines = MCT_LFE_MAX_LINE; - } - if ( st->element_mode != IVAS_CPE_MDCT ) { /* For TCX20 at bitrates up to 64 kbps we need the power spectrum */ @@ -345,14 +327,14 @@ void core_signal_analysis_high_bitrate( { L_subframe = L_frameTCX / nSubframes; - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { wtda_ext( hTcxEnc->new_speech_TCX, mdstWin, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX, 3 ); } else { /* Windowing for the MDST */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 0, 1, st->mct_chan_mode == MCT_CHAN_MODE_LFE ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 0, 1 ); } if ( transform_type[frameno] == TCX_5 ) @@ -383,8 +365,7 @@ void core_signal_analysis_high_bitrate( for ( i = 0; i < 2; i++ ) { - assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); - WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, mdstWin + i * tcx5SizeFB, &L_subframe, tcx5Win, 0, 1, 0 ); + WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, mdstWin + i * tcx5SizeFB, &L_subframe, tcx5Win, 0, 1 ); TCX_MDST( tcx5Win, mdst_spectrum[frameno] + i * tcx5SizeFB, left_overlap, L_subframe - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); /* high-band gain control in case of BWS */ @@ -396,7 +377,7 @@ void core_signal_analysis_high_bitrate( } else /* transform_type[frameno] != TCX_5 */ { - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { edst( mdstWin, mdst_spectrum[frameno], L_subframe, st->element_mode ); @@ -421,11 +402,6 @@ void core_signal_analysis_high_bitrate( v_multc( mdst_spectrum[frameno] + L_FRAME16k / nSubframes, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, mdst_spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); } } - - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - set_f( &mdst_spectrum[frameno][MCT_LFE_MAX_LINE], 0.f, L_subframe - MCT_LFE_MAX_LINE ); - } } if ( st->element_mode != IVAS_CPE_MDCT ) @@ -468,10 +444,19 @@ void core_signal_analysis_high_bitrate( ProcessIGF( st, hTcxEnc->spectrum[frameno], hTcxEnc->spectrum[frameno], powerSpec, transform_type[frameno] == TCX_20, frameno, 0, vad_hover_flag ); } +#ifndef FIX_446_STEREO_DMX_CRASH /* Copy memory */ mvr2r( lsp_new, st->lspold_enc, M ); +#endif } } +#ifdef FIX_446_STEREO_DMX_CRASH + if ( st->element_mode != IVAS_CPE_MDCT ) + { + /* Copy memory */ + mvr2r( lsp_new, st->lspold_enc, M ); + } +#endif return; } diff --git a/lib_enc/fd_cng_enc.c b/lib_enc/fd_cng_enc.c index 20aa31f3cac2f148ef7de09ebdb16a188716b174..d71c24d45c0c8a1d04170f0f884658ab2cccbbcf 100644 --- a/lib_enc/fd_cng_enc.c +++ b/lib_enc/fd_cng_enc.c @@ -66,8 +66,7 @@ ivas_error createFdCngEnc( *hFdCngEnc = NULL; /* Allocate memory */ - hs = (HANDLE_FD_CNG_ENC) malloc( sizeof( FD_CNG_ENC ) ); - if ( hs == NULL ) + if ( ( hs = (HANDLE_FD_CNG_ENC) malloc( sizeof( FD_CNG_ENC ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FD CNG ENC structure" ); } @@ -514,12 +513,18 @@ void FdCng_encodeSID( float w[32]; float preemph_fac = st->preemph_fac; - const float *const *codebooks = ( st->element_mode == EVS_MONO ) ? cdk_37bits : cdk_37bits_ivas; + float *invTrfMatrix; + float tmpRAM[FDCNG_VQ_MAX_LEN][FDCNG_VQ_DCT_MAXTRUNC]; + float dct_target[FDCNG_VQ_DCT_MAXTRUNC]; + float tot_sig_ext[FDCNG_VQ_MAX_LEN]; const float gain_q_offset = ( st->element_mode == EVS_MONO ) ? GAIN_Q_OFFSET_EVS : GAIN_Q_OFFSET_IVAS; /* Init */ N = hFdCngEnc->npartDec; + invTrfMatrix = (float *) tmpRAM; /* dynamically filled */ + set_zero( v, FDCNG_VQ_MAX_LEN ); + /* Convert to LOG */ e = 0.f; for ( i = 0; i < N; i++ ) @@ -545,10 +550,32 @@ void FdCng_encodeSID( /* MSVQ encoder */ set_f( w, 1.0f, N ); - msvq_enc( codebooks, NULL, NULL, v, levels_37bits, FD_CNG_maxC_37bits, FD_CNG_stages_37bits, w, N, FD_CNG_maxN_37bits, indices ); + if ( st->element_mode != EVS_MONO ) + { + /* DCT domain compressed/truncated indices used for first stage */ + /* quantization with stage1 stored in DCT24 domain, stages 2 through 6 directly dearched + in FDCNG band domain + */ + if ( N == FDCNG_VQ_MAX_LEN_WB ) + { + create_IDCT_N_Matrix( invTrfMatrix, N, FDCNG_VQ_DCT_MAXTRUNC, sizeof( tmpRAM ) / ( sizeof( float ) ) ); + /* truncated DCT21 analysis */ + dctT2_N_apply_matrix( (const float *) v, dct_target, FDCNG_VQ_DCT_MAXTRUNC, N, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, DCT_T2_21_XX ); + /* truncated IDCT21 extension to 24 bands */ + extend_dctN_input( v, dct_target, N, tot_sig_ext, FDCNG_VQ_MAX_LEN, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, IDCT_T2_XX_21 ); + + mvr2r( tot_sig_ext, v, FDCNG_VQ_MAX_LEN ); /* write extended result as input to VQ stage #1 */ + } + create_IDCT_N_Matrix( invTrfMatrix, FDCNG_VQ_MAX_LEN, FDCNG_VQ_DCT_MAXTRUNC, sizeof( tmpRAM ) / ( sizeof( float ) ) ); + msvq_enc( cdk_37bits_ivas, NULL, NULL, v, levels_37bits, FD_CNG_maxC_37bits, FD_CNG_stages_37bits, w, N, FD_CNG_maxN_37bits, 1, invTrfMatrix, indices ); + msvq_dec( cdk_37bits_ivas, NULL, NULL, FD_CNG_stages_37bits, N, FD_CNG_maxN_37bits, indices, 1, invTrfMatrix, v, NULL ); + } + else + { /* EVS_MONO tables */ + msvq_enc( cdk_37bits, NULL, NULL, v, levels_37bits, FD_CNG_maxC_37bits, FD_CNG_stages_37bits, w, N, FD_CNG_maxN_37bits, 0, NULL, indices ); + msvq_dec( cdk_37bits, NULL, NULL, FD_CNG_stages_37bits, N, FD_CNG_maxN_37bits, indices, 0, NULL, v, NULL ); + } - /* MSVQ decoder */ - msvq_dec( codebooks, NULL, NULL, FD_CNG_stages_37bits, N, FD_CNG_maxN_37bits, indices, v, NULL ); /* Compute gain */ gain = 0.f; @@ -709,11 +736,14 @@ void generate_comfort_noise_enc( /* Perform STFT synthesis */ SynthesisSTFT( fftBuffer, timeDomainOutput, hFdCngCom->olapBufferSynth, hFdCngCom->olapWinSyn, tcx_transition, hFdCngCom, -1, -1 ); - /* update CNG excitation energy for LP_CNG */ - /* calculate the residual signal energy */ - enr = cng_energy( st->element_mode, st->bwidth, st->hDtxEnc->CNG_mode, st->hTdCngEnc->CNG_att, hFdCngCom->exc_cng, hFdCngCom->frameSize ); + if ( st->hTdCngEnc != NULL ) + { + /* update CNG excitation energy for LP_CNG */ + /* calculate the residual signal energy */ + enr = cng_energy( st->element_mode, st->bwidth, st->hDtxEnc->CNG_mode, st->hTdCngEnc->CNG_att, hFdCngCom->exc_cng, hFdCngCom->frameSize ); - st->hTdCngEnc->lp_ener = (float) ( 0.8f * st->hTdCngEnc->lp_ener + 0.2f * pow( 2.0f, enr ) ); + st->hTdCngEnc->lp_ener = (float) ( 0.8f * st->hTdCngEnc->lp_ener + 0.2f * pow( 2.0f, enr ) ); + } /* Overlap-add when previous frame is active */ if ( st->last_core_brate > SID_2k40 && st->codec_mode == MODE2 ) @@ -971,6 +1001,12 @@ void FdCngEncodeMDCTStereoSID( int16_t no_side_flag; int16_t is_inp_ms; + float tot_sig_ext[FDCNG_VQ_MAX_LEN], dct_target[CPE_CHANNELS][FDCNG_VQ_DCT_MAXTRUNC]; /* 24 +2*18*/ + float *invTrfMatrix; + float tmpRAM[FDCNG_VQ_MAX_LEN][FDCNG_VQ_DCT_MAXTRUNC]; /*24*18*/ + invTrfMatrix = (float *) tmpRAM; /* dynamically filled */ + + is_inp_ms = 0; if ( hCPE->hCoreCoder[0]->cng_sba_flag == 1 ) { @@ -1021,7 +1057,7 @@ void FdCngEncodeMDCTStereoSID( /* Quantize noise shapes */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - /* Normalize MSVW input */ + /* Normalize MSVQ input */ gain[ch] = 0.f; for ( p = N_GAIN_MIN; p < N_GAIN_MAX; p++ ) { @@ -1033,7 +1069,37 @@ void FdCngEncodeMDCTStereoSID( { ms_ptr[ch][p] -= gain[ch]; } + } + /* always split channel targetloop */ + + /* extend fdcng envelope from length 21 to a 24 length fdncg domain envelope signal */ + /* High quality cosine smooth basis extension used to not introduce noise in stage#1 DCT24 analysis and subsequent VQ-steps */ + if ( N == FDCNG_VQ_MAX_LEN_WB ) + { + create_IDCT_N_Matrix( invTrfMatrix, N, FDCNG_VQ_DCT_MAXTRUNC, sizeof( tmpRAM ) / ( sizeof( float ) ) ); /*WB: create truncated IDCT21 matrix */ + + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + /* run DCT_N N==21 , truncated at 18/21 ~= 86% , i.e use a bit better better quality in extrapolation , than subsequent DCT24 analysis which is truncated at 75%*/ + + /* truncated DCT 21 analysis */ + dctT2_N_apply_matrix( (const float *) ms_ptr[ch], dct_target[ch], FDCNG_VQ_DCT_MAXTRUNC, N, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, DCT_T2_21_XX ); + + /* extrapolate extend fdcng envelope signal in the fdncg ienvelope/"time" domain using DCT21 basis vectors, + estimated DCT21 coeffs scaling extended basis vectors are used to create extrapolated length 24 input target envelope signal */ + /* this DCT21 extension does not introduce DCT24 coefficient noise for the subsequent dct24 target analysis, and later in IDCT24 synthesis */ + + /* truncated IDCT 21 extension synthesis */ + extend_dctN_input( ms_ptr[ch], dct_target[ch], N, tot_sig_ext, FDCNG_VQ_MAX_LEN, invTrfMatrix /* DCT_N basis vectors */, FDCNG_VQ_DCT_MAXTRUNC, IDCT_T2_XX_21 ); /* use 18 basis vectors*/ + + mvr2r( tot_sig_ext, ms_ptr[ch], FDCNG_VQ_MAX_LEN ); /* write extended result as input to VQ */ + } + } + create_IDCT_N_Matrix( invTrfMatrix, FDCNG_VQ_MAX_LEN, FDCNG_VQ_DCT_MAXTRUNC, sizeof( tmpRAM ) / ( sizeof( float ) ) ); /*always create/set up IDCT24 matrix in RAM */ + /* end split */ + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { /* MSVQ */ if ( ch ) { @@ -1044,8 +1110,14 @@ void FdCngEncodeMDCTStereoSID( stages = FD_CNG_stages_37bits; } - msvq_enc( cdk_37bits_ivas, NULL, NULL, ms_ptr[ch], levels_37bits, FD_CNG_maxC_37bits, stages, weights, N, FD_CNG_maxN_37bits, indices[ch] ); - msvq_dec( cdk_37bits_ivas, NULL, NULL, stages, N, FD_CNG_maxN_37bits, indices[ch], ms_ptr[ch], NULL ); + /* DCT24 domain compressed/truncated indices used for first stage */ + /* mid channel quantization using stages 1 through 6 */ + /* & side channel quantization using stages 1 through 4 */ + + { + msvq_enc( cdk_37bits_ivas, NULL, NULL, ms_ptr[ch], levels_37bits, FD_CNG_maxC_37bits, stages, weights, N, FD_CNG_maxN_37bits, 1, invTrfMatrix, indices[ch] ); + msvq_dec( cdk_37bits_ivas, NULL, NULL, stages, N, FD_CNG_maxN_37bits, indices[ch], 1, invTrfMatrix, ms_ptr[ch], NULL ); + } } if ( no_side_flag ) @@ -1131,6 +1203,7 @@ void FdCngEncodeMDCTStereoSID( /* pad with zeros to reach common SID frame size */ push_indice( sts[1]->hBstr, IND_ENERGY, 0, ( IVAS_SID_5k2 - 4400 ) / FRAMES_PER_SEC ); + return; } @@ -1158,6 +1231,11 @@ void FdCngEncodeDiracMDCTStereoSID( int16_t indices[CPE_CHANNELS][FD_CNG_stages_37bits]; int16_t gain_idx[CPE_CHANNELS]; int16_t ch, p; + float *invTrfMatrix; + float tmpRAM[FDCNG_VQ_MAX_LEN][FDCNG_VQ_DCT_MAXTRUNC]; + float dct_target[FDCNG_VQ_DCT_MAXTRUNC]; + float tot_sig_ext[FDCNG_VQ_MAX_LEN]; + invTrfMatrix = (float *) tmpRAM; /* dynamically filled */ /* set pointers and initialize */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) @@ -1174,7 +1252,7 @@ void FdCngEncodeDiracMDCTStereoSID( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { E[ch] = 0.0f; - for ( p = 0; p < NPART; p++ ) + for ( p = 0; p < NPART; p++ ) /* TBD Note: NPART should likely be N[ch] if N[ch] may change */ { ms_ptr[ch][p] = 10.f * log10f( lr_in_ptr[ch][p] + EPSILON ); E[ch] += ms_ptr[ch][p]; @@ -1182,12 +1260,13 @@ void FdCngEncodeDiracMDCTStereoSID( } /* M/S transform on log envelopes */ - convertToMS( NPART, ms_ptr[0], ms_ptr[1], 0.5f ); + convertToMS( NPART, ms_ptr[0], ms_ptr[1], 0.5f ); /* TBD Note: NPART should likely be N[0] if N[0] may change */ + + E[0] = sum_f( ms_ptr[0], NPART ); /* TBD Note: NPART should likely be N[0] if N[0] may change */ - E[0] = sum_f( ms_ptr[0], NPART ); /* Quantize M noise shape */ - /* Normalize MSVW input */ + /* Normalize MSVQ input */ gain[0] = sum_f( ms_ptr[0] + N_GAIN_MIN, N_GAIN_MAX - N_GAIN_MIN ); gain[0] /= (float) ( N_GAIN_MAX - N_GAIN_MIN ); @@ -1197,14 +1276,29 @@ void FdCngEncodeDiracMDCTStereoSID( } /* MSVQ */ - msvq_enc( cdk_37bits_ivas, NULL, NULL, ms_ptr[0], levels_37bits, FD_CNG_maxC_37bits, FD_CNG_stages_37bits, weights, N[0], FD_CNG_maxN_37bits, indices[0] ); - msvq_dec( cdk_37bits_ivas, NULL, NULL, FD_CNG_stages_37bits, N[0], FD_CNG_maxN_37bits, indices[0], ms_ptr[0], NULL ); + /* DCT domain compressed/truncated indices used for first stage */ + /* mid quantization using stages #1 through 6 */ + if ( N[0] == FDCNG_VQ_MAX_LEN_WB ) + { + create_IDCT_N_Matrix( invTrfMatrix, N[0], FDCNG_VQ_DCT_MAXTRUNC, sizeof( tmpRAM ) / ( sizeof( float ) ) ); + /* truncated DCT 21 analysis */ + dctT2_N_apply_matrix( (const float *) ms_ptr[0], dct_target, FDCNG_VQ_DCT_MAXTRUNC, N[0], invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, DCT_T2_21_XX ); + /* truncated IDCT21 extension to 24 synthesis */ + extend_dctN_input( ms_ptr[0], dct_target, N[0], tot_sig_ext, FDCNG_VQ_MAX_LEN, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, IDCT_T2_XX_21 ); /* use 18 basis vectors*/ + + mvr2r( tot_sig_ext, ms_ptr[0], FDCNG_VQ_MAX_LEN ); /* write extended result as input to VQ stage #1 */ + } + create_IDCT_N_Matrix( invTrfMatrix, FDCNG_VQ_MAX_LEN, FDCNG_VQ_DCT_MAXTRUNC, sizeof( tmpRAM ) / ( sizeof( float ) ) ); + + msvq_enc( cdk_37bits_ivas, NULL, NULL, ms_ptr[0], levels_37bits, FD_CNG_maxC_37bits, FD_CNG_stages_37bits, weights, N[0], FD_CNG_maxN_37bits, 1, invTrfMatrix, indices[0] ); + msvq_dec( cdk_37bits_ivas, NULL, NULL, FD_CNG_stages_37bits, N[0], FD_CNG_maxN_37bits, indices[0], 1, invTrfMatrix, ms_ptr[0], NULL ); + /* set S to zero */ set_zero( ms_ptr[1], NPART ); /* compute M gain */ - gain[0] = sum_f( ms_ptr[0], NPART ); + gain[0] = sum_f( ms_ptr[0], NPART ); /* TBD Note: NPART should likely be N[0] if N[0] may change */ gain[0] = ( E[0] - gain[0] ) / (float) N[0]; apply_scale( &gain[0], sts[0]->hFdCngEnc->hFdCngCom->CngBandwidth, sts[0]->hDtxEnc->last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO ); @@ -1216,7 +1310,7 @@ void FdCngEncodeDiracMDCTStereoSID( gain[1] = gain[0]; /* undo M/S */ - convertToMS( NPART, ms_ptr[0], ms_ptr[1], 1.0f ); + convertToMS( NPART, ms_ptr[0], ms_ptr[1], 1.0f ); /* TBD Note: NPART should likely be N[0] if N[0] may change */ /* restore channel noise envelopes */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) @@ -1224,7 +1318,7 @@ void FdCngEncodeDiracMDCTStereoSID( HANDLE_FD_CNG_ENC hFdCngEnc = sts[ch]->hFdCngEnc; HANDLE_FD_CNG_COM hFdCngCom = hFdCngEnc->hFdCngCom; - for ( p = 0; p < NPART; p++ ) + for ( p = 0; p < NPART; p++ ) /* TBD Note: NPART should likely be N[0] if N[0] may change */ { lr_out_ptr[ch][p] = powf( 10.f, ( ms_ptr[ch][p] + gain[ch] ) / 10.f ); } @@ -1263,6 +1357,5 @@ void FdCngEncodeDiracMDCTStereoSID( } push_indice( sts[0]->hBstr, IND_ENERGY, gain_idx[0], 7 ); - return; } diff --git a/lib_enc/hq_core_enc.c b/lib_enc/hq_core_enc.c index 4bc332fd5e39cbb7acdd1db5e1a9c74c40074127..3fb39b535a79f8da69a5188083fd2c870b3787a4 100644 --- a/lib_enc/hq_core_enc.c +++ b/lib_enc/hq_core_enc.c @@ -116,7 +116,7 @@ void hq_core_enc( left_overlap = -1; right_overlap = -1; - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, TRANSITION_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_spec, wtda_audio, 1, 1, 0 ); + WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, TRANSITION_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, st->hTcxEnc->speech_TCX, &L_spec, wtda_audio, 1, 1 ); TCX_MDCT( wtda_audio, t_audio, left_overlap, L_spec - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); diff --git a/lib_enc/hq_lr_enc.c b/lib_enc/hq_lr_enc.c index 9401a1bb573aebafa625d0b749975eca8f959385..e43baef59d23cc060f93c77123aca1117e194a97 100644 --- a/lib_enc/hq_lr_enc.c +++ b/lib_enc/hq_lr_enc.c @@ -320,7 +320,7 @@ void hq_lr_enc( if ( flag_spt == 1 ) { - /* initalize the desired parameters for SPT */ + /* initialize the desired parameters for SPT */ spt_shorten_domain_band_save( bands, band_start, band_end, band_width, org_band_start, org_band_end, org_band_width ); spt_shorten_domain_pre( band_start, band_end, hHQ_core->prev_SWB_peak_pos, bands, bwe_br, new_band_start, new_band_end, new_band_width ); spt_shorten_domain_set( hBstr, hHQ_core, t_audio, p2a_flags, new_band_start, new_band_end, new_band_width, bands, band_start, band_end, band_width, &bit_budget ); diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index e456a52a614f6ba95bf0eb6dbfa0e65564ba4fb5..9efd3c7f166be25a773de9962c4ace5d943ae60e 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -58,7 +58,8 @@ ivas_error init_encoder( const int16_t idchan, /* i : channel ID */ const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ - const int16_t vad_only_flag /* i : flag to indicate front-VAD structure */ + const int16_t vad_only_flag, /* i : flag to indicate front-VAD structure */ + const ISM_MODE ism_mode /* i : ISM mode */ ) { int16_t i; @@ -462,7 +463,7 @@ ivas_error init_encoder( * LP-CNG *-----------------------------------------------------------------*/ - if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) ) + if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) && !( ism_mode == ISM_MODE_PARAM || ism_mode == ISM_MODE_DISC ) ) { if ( ( st->hTdCngEnc = (TD_CNG_ENC_HANDLE) malloc( sizeof( TD_CNG_ENC_DATA ) ) ) == NULL ) { @@ -726,7 +727,7 @@ ivas_error init_encoder( * IGF *-----------------------------------------------------------------*/ - if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) { if ( ( st->hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL ) { @@ -746,7 +747,7 @@ ivas_error init_encoder( if ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) { - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); } else { @@ -800,26 +801,18 @@ ivas_error init_encoder( /*-----------------------------------------------------------------* * Transient detector *-----------------------------------------------------------------*/ - - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( ( st->hTranDet = (TRAN_DET_HANDLE) malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL ) { - if ( ( st->hTranDet = (TRAN_DET_HANDLE) malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) ); - } + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) ); + } - if ( st->element_mode > EVS_MONO ) - { - InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), 0, st->hTranDet, 1 ); - } - else - { - InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); - } + if ( st->element_mode > EVS_MONO ) + { + InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), 0, st->hTranDet, 1 ); } else { - st->hTranDet = NULL; + InitTransientDetection( (int16_t) ( st->input_Fs / FRAMES_PER_SEC ), NS2SA( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); } /*-----------------------------------------------------------------* @@ -861,32 +854,22 @@ void LPDmem_enc_init( return; } + + /*-----------------------------------------------------------------------* - * destroy_encoder() + * destroy_cldfb_encoder() * * Free memory which was allocated in init_encoder() *-----------------------------------------------------------------------*/ -void destroy_encoder( +void destroy_cldfb_encoder( Encoder_State *st /* i/o: Encoder static variables structure */ ) { - if ( st->cldfbSynTd != NULL ) - { - deleteCldfb( &st->cldfbSynTd ); - } - - if ( st->cldfbAnaEnc != NULL ) - { - deleteCldfb( &st->cldfbAnaEnc ); - } - - if ( st->hFdCngEnc != NULL ) - { - deleteFdCngEnc( &st->hFdCngEnc ); - } + deleteCldfb( &st->cldfbSynTd ); + deleteCldfb( &st->cldfbAnaEnc ); - /* Close Core */ + deleteFdCngEnc( &st->hFdCngEnc ); return; } diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c index f98c22b97e46d286c4a5be8e8df49c9c299d4c48..83dbdad1e183efb3bb5990657633b3c68323b389 100644 --- a/lib_enc/ivas_agc_enc.c +++ b/lib_enc/ivas_agc_enc.c @@ -195,22 +195,24 @@ void ivas_spar_agc_enc_close( { ivas_agc_enc_state_t *hAgc; + if ( hAgcEnc == NULL || *hAgcEnc == NULL ) + { + return; + } + hAgc = *hAgcEnc; - if ( hAgc != NULL ) - { - free( hAgc->agc_com.winFunc ); - hAgc->agc_com.winFunc = NULL; + free( hAgc->agc_com.winFunc ); + hAgc->agc_com.winFunc = NULL; - free( hAgc->gain_state ); - hAgc->gain_state = NULL; + free( hAgc->gain_state ); + hAgc->gain_state = NULL; - free( hAgc->gain_data ); - hAgc->gain_data = NULL; + free( hAgc->gain_data ); + hAgc->gain_data = NULL; - free( hAgc ); - hAgc = NULL; - } + free( *hAgcEnc ); + *hAgcEnc = NULL; return; } diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index e53033ab98546480c4d75cce2b2a898d208dbf81..c2627b923bed0d309efd02e639da02d21a894147 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -219,7 +219,7 @@ ivas_error ivas_core_enc( if ( st->core == ACELP_CORE ) { /* ACELP core encoder */ - if ( ( error = acelp_core_enc( st, inp[n], ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], pitch_buf[n], &unbits[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh ) ) != IVAS_ERR_OK ) + if ( ( error = acelp_core_enc( st, inp[n], ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], pitch_buf[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh ) ) != IVAS_ERR_OK ) { return error; } @@ -259,7 +259,8 @@ ivas_error ivas_core_enc( if ( MCT_flag ) { ivas_mdct_core_whitening_enc( hCPE, old_inp_16k, old_wsp, pitch_buf, hMCT->p_mdst_spectrum_long[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long[cpe_id], - hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, &hMCT->LFE_off, 1, hMCT->nchan_out_woLFE + hMCT->num_lfe ); + hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, + 1, hMCT->nchan_out_woLFE ); } else { @@ -448,6 +449,8 @@ ivas_error ivas_core_enc( dbgwrite( &st->sp_aud_decision1, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "sp_aud_decision1", n, id, ENC ) ); dbgwrite( &st->sp_aud_decision2, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "sp_aud_decision2", n, id, ENC ) ); + dbgwrite( &st->lp_noise, sizeof( float ), 1, input_frame, fname( debug_dir, "lp_noise", n, id, ENC ) ); + #if ( defined DEBUG_MODE_ACELP ) || ( defined DEBUG_MODE_TCX ) if ( st->coder_type == INACTIVE || st->coder_type == UNVOICED ) { diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index 77b31fac1298c2ea36da31ae0bfb0aad03825e22..7a0d25ddfa4e2883fd7db7eb507d72b24123e064 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -660,9 +660,7 @@ ivas_error ivas_compute_core_buffers( *-----------------------------------------------------------------*/ if ( -#ifdef FIX_309_PREMPH_MEM_SCE st->tcxonly == 0 && -#endif !( ( element_mode == IVAS_CPE_TD && st->idchan == 1 ) || element_mode == IVAS_CPE_MDCT ) ) { st->mem_preemph_enc = new_inp_16k[L_frame_tmp - 1]; diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index be28d0ee7fe1bb726260b5815b312c8e773139a7..cf23ddef539f2e2f7ceeba7997129b0f07829b9c 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -107,8 +107,9 @@ ivas_error pre_proc_front_ivas( const int16_t front_vad_flag, /* i : front-VAD flag to overwrite VAD decision */ const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ - const int32_t ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX */ - const int16_t ivas_format ) + const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ + +) { float *inp_12k8, *new_inp_12k8; /* pointers to current frame and new data */ float *wsp; /* weighted input signal buffer */ @@ -442,13 +443,6 @@ ivas_error pre_proc_front_ivas( st->vad_flag = wb_vad( st, fr_bands, &i, &i, &i, &snr_sum_he, &localVAD_HE_SAD, &( st->flag_noisy_speech_snr ), NULL, NULL, -1000.0f, -1000.0f ); -#ifdef ITD_WINNER_GAIN_MODIFY - /*Save the local_vad flag for the noise coherence calculation*/ - if ( element_mode == IVAS_CPE_DFT ) - { - hCPE->hStereoDft->local_vad = (short) ( st->vad_flag ); - } -#endif if ( force_front_vad == 1 || front_vad_flag == 1 ) { @@ -485,7 +479,8 @@ ivas_error pre_proc_front_ivas( if ( st->idchan == 0 && element_mode != IVAS_CPE_MDCT ) { - bw_detect( st, st->input, NULL, enerBuffer ); + bw_detect( st, st->input, NULL, enerBuffer, + 0 ); } if ( element_mode != IVAS_CPE_MDCT ) /* in MDCT stereo, set_bw_stereo() is used instead */ @@ -805,7 +800,7 @@ ivas_error pre_proc_front_ivas( } } /* Switch to ACELP for non-harmonic transient signals */ - else if ( ( ( ivas_format == STEREO_FORMAT && element_brate <= IVAS_16k4 ) || ( ivas_format == ISM_FORMAT && element_brate < SCE_SMC_THR ) ) && ( loc_harm[0] != 1 ) && smc_dec == MUSIC ) + else if ( ( ( element_mode >= IVAS_CPE_DFT && element_brate <= IVAS_16k4 ) || ( element_mode == IVAS_SCE && element_brate < SCE_SMC_THR ) ) && ( loc_harm[0] != 1 ) && smc_dec == MUSIC ) { if ( element_mode == IVAS_SCE ) { @@ -820,7 +815,7 @@ ivas_error pre_proc_front_ivas( { if ( smc_dec != SPEECH && transient_analysis( hCPE->hCoreCoder[i]->hTranDet, st->hNoiseEst->cor_map, st->hNoiseEst->multi_harm_limit ) ) { - smc_dec = SPEECH; /* overwrite initial music decision, intial SPEECH_MUSIC never changed */ + smc_dec = SPEECH; /* overwrite initial music decision, initial SPEECH_MUSIC never changed */ } } } @@ -828,34 +823,6 @@ ivas_error pre_proc_front_ivas( /* 2nd stage speech/music classification (ACELP/GSC/TCX core selection) */ ivas_smc_mode_selection( st, element_brate, smc_dec, *relE, Etot, attack_flag, inp_12k8, S_map, flag_spitch ); - -#ifdef ITD_WINNER_GAIN_MODIFY - if ( element_mode == IVAS_CPE_DFT ) - { - if ( hCPE->hStereoDft->mus_flag != smc_dec || hCPE->element_mode != hCPE->last_element_mode ) - { - hCPE->hStereoDft->noise_coherence = 0.0f; - set_zero( hCPE->hStereoDft->spd_L_noise, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_R_noise, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_L_noise_min, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_R_noise_min, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_L_noise_max, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->spd_R_noise_max, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->winner_gain_L, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hCPE->hStereoDft->winner_gain_R, STEREO_DFT_N_32k_ENC / 2 ); - set_f( hCPE->hStereoDft->spd_L_smooth_new, 1.0f, STEREO_DFT_N_32k_ENC / 2 ); - set_f( hCPE->hStereoDft->spd_R_smooth_new, 1.0f, STEREO_DFT_N_32k_ENC / 2 ); - } - if ( smc_dec == MUSIC && st->vad_flag == 1 ) - { - hCPE->hStereoDft->mus_flag = 2; - } - else - { - hCPE->hStereoDft->mus_flag = 0; - } - } -#endif } /*----------------------------------------------------------------* diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index e8486d77382b95866009ae265498450d0b562af9..fcafb7110cc0cade4a863816450425245c612022 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -30,15 +30,14 @@ *******************************************************************************************************/ -#include #include #include "options.h" #include "ivas_cnst.h" #include "prot.h" #include "ivas_prot.h" -#include "ivas_stat_enc.h" #ifdef DEBUGGING #include "debug.h" +#include #endif #include "wmc_auto.h" @@ -46,7 +45,7 @@ /*-------------------------------------------------------------------* * ivas_corecoder_enc_reconfig() * - * Allocate, initalize, and configure SCE/CPE/MCT handles in case of bitrate switching + * Allocate, initialize, and configure SCE/CPE/MCT handles in case of bitrate switching *-------------------------------------------------------------------*/ ivas_error ivas_corecoder_enc_reconfig( @@ -97,6 +96,7 @@ ivas_error ivas_corecoder_enc_reconfig( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = brate_CPE; + /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -120,11 +120,13 @@ ivas_error ivas_corecoder_enc_reconfig( nchan_transport_old_real = nchan_transport_old; nchan_transport_real = st_ivas->nchan_transport; + /* in SCE+CPE McMASA nchan_transport is still 2, fix the numbers */ if ( hEncoderConfig->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA ) { nchan_transport_old_real = nSCE_old + CPE_CHANNELS * nCPE_old; } + if ( hEncoderConfig->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) { nchan_transport_real = st_ivas->nSCE + CPE_CHANNELS * st_ivas->nCPE; @@ -209,7 +211,7 @@ ivas_error ivas_corecoder_enc_reconfig( { if ( n_CoreCoder_existing > cpe_id * CPE_CHANNELS + n ) { - mvr2r( st_ivas->hCPE[cpe_id]->hCoreCoder[0]->input_buff, input_buff[( cpe_id - st_ivas->nCPE ) * CPE_CHANNELS + n], len_inp_memory ); /* TODO VoiceAge: Please check if this should be hCoreCoder[n] */ + mvr2r( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff, input_buff[( cpe_id - st_ivas->nCPE ) * CPE_CHANNELS + n], len_inp_memory ); } } @@ -219,8 +221,7 @@ ivas_error ivas_corecoder_enc_reconfig( if ( st_ivas->nCPE <= 1 && st_ivas->hMCT != NULL ) { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; + ivas_mct_enc_close( &( st_ivas->hMCT ) ); } /* special case, if we have MCT now and had a single CPE before, remove the MDCT Stereo handles */ @@ -282,6 +283,7 @@ ivas_error ivas_corecoder_enc_reconfig( for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = brate_CPE; + /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -319,7 +321,11 @@ ivas_error ivas_corecoder_enc_reconfig( { if ( n_CoreCoder_existing > cpe_id * CPE_CHANNELS + n ) { +#ifdef FIX_386_CORECODER_RECONFIG_2 + mvr2r( input_buff[n], st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff, len_inp_memory ); +#else mvr2r( input_buff[n], st_ivas->hCPE[cpe_id]->hCoreCoder[0]->input_buff, len_inp_memory ); /* TODO VoiceAge: Please check if this should be hCoreCoder[n] */ +#endif } } @@ -375,8 +381,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->igf = getIgfPresent( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal * FRAMES_PER_SEC, st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode ); + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { @@ -443,8 +448,7 @@ ivas_error ivas_corecoder_enc_reconfig( st_ivas->hCPE[0]->hCoreCoder[n]->igf = getIgfPresent( st_ivas->hCPE[0]->hCoreCoder[n]->element_mode, st_ivas->hCPE[0]->hCoreCoder[n]->bits_frame_nominal * FRAMES_PER_SEC, st_ivas->hCPE[0]->hCoreCoder[n]->bwidth, - st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode, - st_ivas->hCPE[0]->hCoreCoder[n]->mct_chan_mode ); + st_ivas->hCPE[0]->hCoreCoder[n]->rf_mode ); if ( st_ivas->hCPE[0]->hCoreCoder[n]->igf ) { diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 9aec652f05ef45fc9faf8af15cd505ebce4bace0..b60f8be45b3807ced769a80dbe65b106df875963 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -109,7 +109,6 @@ ivas_error ivas_cpe_enc( hCPE = st_ivas->hCPE[cpe_id]; sts = hCPE->hCoreCoder; hEncoderConfig = st_ivas->hEncoderConfig; - max_bwidth = hEncoderConfig->max_bwidth; ivas_format = hEncoderConfig->ivas_format; input_Fs = hEncoderConfig->input_Fs; @@ -154,7 +153,10 @@ ivas_error ivas_cpe_enc( } mvr2r( data_f_ch0, sts[0]->input, input_frame ); - mvr2r( data_f_ch1, sts[1]->input, input_frame ); + if ( data_f_ch1 != NULL ) /*this may happen for cases with odd number of channels*/ + { + mvr2r( data_f_ch1, sts[1]->input, input_frame ); + } /*----------------------------------------------------------------* * Stereo technology selection @@ -296,12 +298,14 @@ ivas_error ivas_cpe_enc( { if ( st_ivas->hMCT ) { + int16_t lfe_bits; + lfe_bits = ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ? st_ivas->hLFE->lfe_bits : 0 ); sts[n]->total_brate = hCPE->element_brate; - if ( sts[n]->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { - sts[n]->bits_frame_nominal = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); - sts[n]->bits_frame_channel = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC - ( st_ivas->hMCT->num_lfe == FALSE ? 0 : LFE_BITS ) - nb_bits_metadata ) / st_ivas->hMCT->nchan_out_woLFE ); - } + sts[n]->bits_frame_nominal = (int16_t) ( hCPE->element_brate / FRAMES_PER_SEC ); + sts[n]->bits_frame_channel = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC - + lfe_bits - + nb_bits_metadata ) / + st_ivas->hMCT->nchan_out_woLFE ); } else { @@ -315,7 +319,7 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_brate != hCPE->last_element_brate && st_ivas->hMCT == NULL ) { #ifdef DEBUGGING - hCPE->hStereoMdct->mdct_stereo_mode_cmdl = hEncoderConfig->stereo_mode_cmdl; + hCPE->hStereoMdct->mdct_stereo_mode_cmdl = hEncoderConfig->mdct_stereo_mode_cmdl; #endif initMdctStereoEncData( hCPE->hStereoMdct, ivas_format, hCPE->element_mode, hCPE->element_brate, max_bwidth, 0, NULL, 0 ); hCPE->hStereoMdct->isSBAStereoMode = ( ( ivas_format == SBA_FORMAT ) && ( st_ivas->nchan_transport == 2 ) ); @@ -433,7 +437,7 @@ ivas_error ivas_cpe_enc( &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, - ivas_total_brate, st_ivas->hEncoderConfig->ivas_format ); + ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; @@ -446,6 +450,7 @@ ivas_error ivas_cpe_enc( if ( sts[0]->core_brate == SID_2k40 || sts[0]->core_brate == FRAME_NO_DATA ) { sts[0]->core_brate = -1; + sts[0]->total_brate = hCPE->element_brate; } } @@ -659,10 +664,7 @@ ivas_error ivas_cpe_enc( /* Store previous attack detection flag */ for ( n = 0; n < CPE_CHANNELS; n++ ) { - if ( sts[n]->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { - sts[n]->hTranDet->transientDetector.prev_bIsAttackPresent = sts[n]->hTranDet->transientDetector.bIsAttackPresent; - } + sts[n]->hTranDet->transientDetector.prev_bIsAttackPresent = sts[n]->hTranDet->transientDetector.bIsAttackPresent; } #ifdef DEBUG_MODE_INFO @@ -826,12 +828,7 @@ ivas_error create_cpe_enc( copy_encoder_config( st_ivas, st, 1 ); st->total_brate = hCPE->element_brate / ( st_ivas->nCPE > 1 ? 1 : CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT && ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) - { - st->mct_chan_mode = MCT_CHAN_MODE_LFE; - } - - if ( ( error = init_encoder( st, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( st, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 7b4685251f2466d24529b595dacdb60cb409bada..b8949329582e8684a9f1f185d86c71647ab7e807 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -114,7 +114,7 @@ void ivas_decision_matrix_enc( if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) { - /* ISm low-rate mode */ + /* ISM low-rate mode */ st->core = ACELP_CORE; st->coder_type = INACTIVE; } @@ -391,7 +391,7 @@ void ivas_signaling_enc( } else if ( st->element_mode == IVAS_SCE && st->low_rate_mode ) { - /* ISm Low-rate mode -> do nothing -> always WB, ACELP core, IC coder_type */ + /* ISM Low-rate mode -> do nothing -> always WB, ACELP core, IC coder_type */ } else if ( ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) || st->core_brate <= SID_2k40 ) { diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 92c2f80fadf734d36af84bb460cdf56d9afae991..72d55bc1710fcaa8a74777d2184f9b0e11329a72 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -99,12 +99,24 @@ ivas_error ivas_dirac_enc_open( } else { - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_DIRAC, DIRAC_MAX_ANA_CHANS, 0, 0, input_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_DIRAC, +#ifdef HODIRAC + FOA_CHANNELS +#else + DIRAC_MAX_ANA_CHANS +#endif + , + 0, 0, input_Fs +#ifdef HODIRAC + , + FOA_CHANNELS +#endif + ) ) != IVAS_ERR_OK ) { return error; } /* Allocate and initialize FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -118,14 +130,17 @@ ivas_error ivas_dirac_enc_open( } dirac_slot_ns = DIRAC_SLOT_ENC_NS; - /* initalize delay for SPAR/DirAC delay synchronization */ + /* initialize delay for SPAR/DirAC delay synchronization */ if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) { hDirAC->num_samples_synchro_delay = NS2SA( input_Fs, IVAS_FB_ENC_DELAY_NS ); for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) { - hDirAC->sba_synchro_buffer[i] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ); + if ( ( hDirAC->sba_synchro_buffer[i] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_zero( hDirAC->sba_synchro_buffer[i], hDirAC->num_samples_synchro_delay ); } } @@ -142,11 +157,17 @@ ivas_error ivas_dirac_enc_open( /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hDirAC->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ); + if ( ( hDirAC->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - hDirAC->direction_vector_m[i][j] = (float *) malloc( DIRAC_MAX_NBANDS * sizeof( float ) ); + if ( ( hDirAC->direction_vector_m[i][j] = (float *) malloc( DIRAC_MAX_NBANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->direction_vector_m[i][j], 0.0f, DIRAC_MAX_NBANDS ); } } @@ -154,14 +175,24 @@ ivas_error ivas_dirac_enc_open( hDirAC->no_col_avg_diff = (int16_t) ( DIRAC_NO_COL_AVG_DIFF_NS / dirac_slot_ns ); for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hDirAC->buffer_intensity_real[i] = (float **) malloc( hDirAC->no_col_avg_diff * sizeof( float * ) ); + if ( ( hDirAC->buffer_intensity_real[i] = (float **) malloc( hDirAC->no_col_avg_diff * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } for ( j = 0; j < hDirAC->no_col_avg_diff; j++ ) { - hDirAC->buffer_intensity_real[i][j] = (float *) malloc( DIRAC_MAX_NBANDS * sizeof( float ) ); + if ( ( hDirAC->buffer_intensity_real[i][j] = (float *) malloc( DIRAC_MAX_NBANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->buffer_intensity_real[i][j], 0.0f, DIRAC_MAX_NBANDS ); } } - hDirAC->buffer_energy = (float *) malloc( DIRAC_MAX_NBANDS * hDirAC->no_col_avg_diff * sizeof( float ) ); + + if ( ( hDirAC->buffer_energy = (float *) malloc( DIRAC_MAX_NBANDS * hDirAC->no_col_avg_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); + } set_f( hDirAC->buffer_energy, 0.0f, DIRAC_MAX_NBANDS * hDirAC->no_col_avg_diff ); if ( st_ivas->hQMetaData->useLowerRes ) @@ -216,8 +247,21 @@ ivas_error ivas_dirac_enc_reconfigure( /* :TODO: if the number of parameter bands change, do a meaningful mapping of parameter buffers from old to new band setting */ +#ifdef LBR_SBA_DIRAC_FIX + + if ( st_ivas->hQMetaData->useLowerRes ) + { + hDirAC->block_grouping[0] = 0; + hDirAC->block_grouping[1] = MAX_PARAM_SPATIAL_SUBFRAMES; + } + else + { + mvs2s( DirAC_block_grouping_5ms_MDFT, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); + } +#else mvs2s( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); +#endif return error; } @@ -226,19 +270,27 @@ ivas_error ivas_dirac_enc_reconfigure( /*------------------------------------------------------------------------- * ivas_dirac_enc_close() * - * Close DirAC + * Close DirAC encoder handle *------------------------------------------------------------------------*/ void ivas_dirac_enc_close( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - const int32_t input_Fs /* i : input sampling rate */ + DIRAC_ENC_HANDLE *hDirAC_out, /* i/o: encoder DirAC handle */ + const int32_t input_Fs /* i : input sampling rate */ ) { int16_t i, j; + DIRAC_ENC_HANDLE hDirAC; + + if ( hDirAC_out == NULL || *hDirAC_out == NULL ) + { + return; + } + + hDirAC = *hDirAC_out; if ( hDirAC->hFbMixer != NULL ) { - ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs ); + ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs, 0 ); } for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) @@ -284,7 +336,8 @@ void ivas_dirac_enc_close( hDirAC->hConfig = NULL; } - free( hDirAC ); + free( *hDirAC_out ); + *hDirAC_out = NULL; return; } @@ -336,7 +389,13 @@ void ivas_dirac_enc( set_zero( data_f[2], input_frame ); } - ivas_dirac_param_est_enc( hDirAC, &( hQMetaData->q_direction[0] ), hQMetaData->useLowerRes, data_f, NULL, NULL, input_frame, SBA_MODE_DIRAC ); + ivas_dirac_param_est_enc( hDirAC, &( hQMetaData->q_direction[0] ), hQMetaData->useLowerRes, data_f, NULL, NULL, input_frame, SBA_MODE_DIRAC +#ifdef HODIRAC + , + 0, + FOA_CHANNELS +#endif + ); /* encode parameters */ if ( sba_planar || hQMetaData->useLowerRes ) @@ -348,7 +407,12 @@ void ivas_dirac_enc( } } - ivas_qmetadata_enc_encode( hMetaData, hQMetaData ); + ivas_qmetadata_enc_encode( hMetaData, hQMetaData +#ifdef HODIRAC + , + 0 +#endif + ); *nb_bits_metadata = hMetaData->nb_bits_tot; @@ -460,7 +524,7 @@ void ivas_dirac_enc_spar_delay_synchro( int16_t sce_id, cpe_id, i_chan; /* check last sba_mode */ - if ( ivas_sba_mode_select( st_ivas->hEncoderConfig->last_ivas_total_brate ) == SBA_MODE_SPAR ) + if ( ivas_sba_mode_select() == SBA_MODE_SPAR ) { /* initializations */ i_chan = 0; @@ -512,6 +576,10 @@ void computeReferencePower_enc( const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands, /* i : Number of frequency bands */ const SBA_MODE sba_mode /* i : SBA mode */ +#ifdef HODIRAC + , + int16_t nchan_ana /* i : no of analysis channels */ +#endif ) { int16_t brange[2]; @@ -531,7 +599,11 @@ void computeReferencePower_enc( reference_power_W[i] += ( Cldfb_RealBuffer[0][j] * Cldfb_RealBuffer[0][j] ) + ( Cldfb_ImagBuffer[0][j] * Cldfb_ImagBuffer[0][j] ); } reference_power[i] += reference_power_W[i]; +#ifdef HODIRAC + for ( ch_idx = 1; ch_idx < nchan_ana; ch_idx++ ) +#else for ( ch_idx = 1; ch_idx < DIRAC_MAX_ANA_CHANS; ch_idx++ ) +#endif { /* abs()^2 */ for ( j = brange[0]; j < brange[1]; j++ ) @@ -568,7 +640,13 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame, - const SBA_MODE sba_mode ) + const SBA_MODE sba_mode +#ifdef HODIRAC + , + const int16_t hodirac, + const int16_t nchan_fb_in +#endif +) { int16_t i, d, ts, index, l_ts, num_freq_bands; int16_t band_m_idx, block_m_idx; @@ -589,8 +667,30 @@ void ivas_dirac_param_est_enc( float reference_power[CLDFB_NO_COL_MAX][DIRAC_NO_FB_BANDS_MAX]; +#ifdef HODIRAC + float azi_secs[2 * DIRAC_MAX_ANA_CHANS * DIRAC_MAX_NBANDS] = { 0 }; + float ele_secs[2 * DIRAC_MAX_ANA_CHANS * DIRAC_MAX_NBANDS] = { 0 }; + float diff_secs[2 * DIRAC_MAX_ANA_CHANS * DIRAC_MAX_NBANDS] = { 0 }; + float ene_secs[2 * DIRAC_MAX_ANA_CHANS * DIRAC_MAX_NBANDS] = { 0 }; +#endif + +#ifdef HODIRAC_WRITE_PARAMS + static FILE *f_secparams = 0; +#endif + push_wmops( "dirac_enc_param_est" ); +#ifdef HODIRAC + num_freq_bands = hDirAC->hConfig->nbands; +#endif + +#ifdef HODIRAC_WRITE_PARAMS + if ( f_secparams == 0 ) + { + f_secparams = fopen( "sector_params.txt", "w" ); + } +#endif + /* Initialization */ l_ts = input_frame / MAX_PARAM_SPATIAL_SUBFRAMES; if ( useLowerRes ) @@ -612,7 +712,11 @@ void ivas_dirac_param_est_enc( } /* Copy current frame to memory for delay compensation */ +#ifdef HODIRAC + for ( i = 0; i < nchan_fb_in; i++ ) +#else for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) +#endif { pcm_in[i] = &data_f[i][0]; p_Cldfb_RealBuffer[i] = &Cldfb_RealBuffer[i][0]; @@ -637,10 +741,24 @@ void ivas_dirac_param_est_enc( { if ( hDirAC->hFbMixer ) { - ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_Cldfb_RealBuffer, p_Cldfb_ImagBuffer, l_ts, l_ts ); - ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts ); + ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_Cldfb_RealBuffer, p_Cldfb_ImagBuffer, l_ts, l_ts +#ifdef HODIRAC + , + hDirAC->hFbMixer->fb_cfg->num_in_chans +#endif + ); + ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts +#ifdef HODIRAC + , + hDirAC->hFbMixer->fb_cfg->num_in_chans +#endif + ); +#ifdef HODIRAC + for ( i = 0; i < nchan_fb_in; i++ ) +#else for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) +#endif { pcm_in[i] += l_ts; } @@ -651,14 +769,25 @@ void ivas_dirac_param_est_enc( assert( pp_fr_real ); assert( pp_fr_imag ); #endif + +#ifdef HODIRAC + for ( i = 0; i < nchan_fb_in; i++ ) +#else for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) +#endif { +#ifdef LBR_SBA_DIRAC_FIX + mvr2r( &pp_fr_real[i][ts * l_ts], Cldfb_RealBuffer[i], l_ts ); + mvr2r( &pp_fr_imag[i][ts * l_ts], Cldfb_ImagBuffer[i], l_ts ); +#else mvr2r( &pp_fr_real[i][block_m_idx * l_ts], Cldfb_RealBuffer[i], l_ts ); mvr2r( &pp_fr_imag[i][block_m_idx * l_ts], Cldfb_ImagBuffer[i], l_ts ); +#endif } } - +#ifndef HODIRAC num_freq_bands = hDirAC->hConfig->nbands; +#endif computeReferencePower_enc( hDirAC->band_grouping, @@ -667,7 +796,16 @@ void ivas_dirac_param_est_enc( reference_power[ts], hDirAC->hConfig->enc_param_start_band, num_freq_bands, - sba_mode ); +#ifdef HODIRAC + hodirac ? SBA_MODE_DIRAC : sba_mode +#else + sba_mode +#endif +#ifdef HODIRAC + , + FOA_CHANNELS +#endif + ); computeIntensityVector_enc( hDirAC, @@ -677,15 +815,20 @@ void ivas_dirac_param_est_enc( num_freq_bands, intensity_real ); - computeDirectionVectors( - intensity_real[0], - intensity_real[1], - intensity_real[2], - hDirAC->hConfig->enc_param_start_band, - num_freq_bands, - direction_vector[0], - direction_vector[1], - direction_vector[2] ); +#ifdef HODIRAC + if ( !hodirac ) +#endif + { + computeDirectionVectors( + intensity_real[0], + intensity_real[1], + intensity_real[2], + hDirAC->hConfig->enc_param_start_band, + num_freq_bands, + direction_vector[0], + direction_vector[1], + direction_vector[2] ); + } /* fill buffers of length "averaging_length" time slots for intensity and energy */ hDirAC->index_buffer_intensity = ( hDirAC->index_buffer_intensity % hDirAC->no_col_avg_diff ) + 1; /* averaging_length = 32 */ @@ -698,51 +841,135 @@ void ivas_dirac_param_est_enc( mvr2r( reference_power[ts], &( hDirAC->buffer_energy[( index - 1 ) * num_freq_bands] ), num_freq_bands ); computeDiffuseness_mdft( hDirAC->buffer_intensity_real, hDirAC->buffer_energy, num_freq_bands, hDirAC->no_col_avg_diff, diffuseness_vector ); - - for ( band_m_idx = 0; band_m_idx < hDirAC->hConfig->nbands; band_m_idx++ ) +#ifdef HODIRAC + if ( hodirac ) { - norm_tmp = reference_power[ts][band_m_idx] * ( 1 - diffuseness_vector[band_m_idx] ); - hDirAC->direction_vector_m[0][block_m_idx][band_m_idx] += norm_tmp * direction_vector[0][band_m_idx]; - hDirAC->direction_vector_m[1][block_m_idx][band_m_idx] += norm_tmp * direction_vector[1][band_m_idx]; - hDirAC->direction_vector_m[2][block_m_idx][band_m_idx] += norm_tmp * direction_vector[2][band_m_idx]; - renormalization_factor[band_m_idx] += norm_tmp; - - hDirAC->diffuseness_m[band_m_idx] += reference_power[ts][band_m_idx] * diffuseness_vector[band_m_idx]; - renormalization_factor_diff[band_m_idx] += reference_power[ts][band_m_idx]; - } - } + calculate_hodirac_sector_parameters( + Cldfb_RealBuffer, + Cldfb_ImagBuffer, + l_ts, + 0.20f, + hDirAC->band_grouping, + hDirAC->hConfig->nbands, + hDirAC->hConfig->enc_param_start_band, + azi_secs, ele_secs, diff_secs, ene_secs ); + +#ifdef HODIRAC_WRITE_PARAMS + for ( i = 0; i < num_freq_bands; i++ ) + { + for ( uint16_t j = 0; j < 4; j++ ) + { + fprintf( f_secparams, "%d %d %f %f %f %f %f\n", i, j, + azi_secs[j * num_freq_bands + i], + ele_secs[j * num_freq_bands + i], + ene_secs[j * num_freq_bands + i], + diff_secs[j * num_freq_bands + i], + diffuseness_vector[i] ); + } + } - for ( band_m_idx = 0; band_m_idx < hDirAC->hConfig->nbands; band_m_idx++ ) - { - renormalization_factor[band_m_idx] = EPSILON; - for ( d = 0; d < DIRAC_NUM_DIMS; d++ ) - { - renormalization_factor[band_m_idx] += ( hDirAC->direction_vector_m[d][block_m_idx][band_m_idx] * hDirAC->direction_vector_m[d][block_m_idx][band_m_idx] ); +#endif // HODIRAC_WRITE_PARAMS } - renormalization_factor[band_m_idx] = sqrtf( renormalization_factor[band_m_idx] ); +#endif // HODIRAC - if ( renormalization_factor[band_m_idx] > EPSILON ) +#ifdef HODIRAC + if ( hodirac ) { - hDirAC->direction_vector_m[0][block_m_idx][band_m_idx] /= renormalization_factor[band_m_idx]; - hDirAC->direction_vector_m[1][block_m_idx][band_m_idx] /= renormalization_factor[band_m_idx]; - hDirAC->direction_vector_m[2][block_m_idx][band_m_idx] /= renormalization_factor[band_m_idx]; + for ( band_m_idx = 0; band_m_idx < hDirAC->hConfig->nbands; band_m_idx++ ) + { + hDirAC->diffuseness_m[band_m_idx] += reference_power[ts][band_m_idx] * diffuseness_vector[band_m_idx]; + renormalization_factor_diff[band_m_idx] += reference_power[ts][band_m_idx]; + } } else +#endif { - hDirAC->direction_vector_m[0][block_m_idx][band_m_idx] = 1; - hDirAC->direction_vector_m[1][block_m_idx][band_m_idx] = 0; - hDirAC->direction_vector_m[2][block_m_idx][band_m_idx] = 0; + for ( band_m_idx = 0; band_m_idx < hDirAC->hConfig->nbands; band_m_idx++ ) + { + norm_tmp = reference_power[ts][band_m_idx] * ( 1 - diffuseness_vector[band_m_idx] ); + + hDirAC->direction_vector_m[0][block_m_idx][band_m_idx] += norm_tmp * direction_vector[0][band_m_idx]; + hDirAC->direction_vector_m[1][block_m_idx][band_m_idx] += norm_tmp * direction_vector[1][band_m_idx]; + hDirAC->direction_vector_m[2][block_m_idx][band_m_idx] += norm_tmp * direction_vector[2][band_m_idx]; + renormalization_factor[band_m_idx] += norm_tmp; + + hDirAC->diffuseness_m[band_m_idx] += reference_power[ts][band_m_idx] * diffuseness_vector[band_m_idx]; + renormalization_factor_diff[band_m_idx] += reference_power[ts][band_m_idx]; + } } + } + +#ifdef HODIRAC + if ( !hodirac ) +#endif - /* save the elevation and azimuth values to be used later by the ivas_dirac_QuantizeParameters function */ - for ( d = 0; d < DIRAC_NUM_DIMS; d++ ) + { + + for ( band_m_idx = 0; band_m_idx < hDirAC->hConfig->nbands; band_m_idx++ ) { - dir_v[d] = hDirAC->direction_vector_m[d][block_m_idx][band_m_idx]; - } + renormalization_factor[band_m_idx] = EPSILON; + for ( d = 0; d < DIRAC_NUM_DIMS; d++ ) + { + renormalization_factor[band_m_idx] += ( hDirAC->direction_vector_m[d][block_m_idx][band_m_idx] * hDirAC->direction_vector_m[d][block_m_idx][band_m_idx] ); + } + renormalization_factor[band_m_idx] = sqrtf( renormalization_factor[band_m_idx] ); + + if ( renormalization_factor[band_m_idx] > EPSILON ) + { + hDirAC->direction_vector_m[0][block_m_idx][band_m_idx] /= renormalization_factor[band_m_idx]; + hDirAC->direction_vector_m[1][block_m_idx][band_m_idx] /= renormalization_factor[band_m_idx]; + hDirAC->direction_vector_m[2][block_m_idx][band_m_idx] /= renormalization_factor[band_m_idx]; + } + else + { + hDirAC->direction_vector_m[0][block_m_idx][band_m_idx] = 1; + hDirAC->direction_vector_m[1][block_m_idx][band_m_idx] = 0; + hDirAC->direction_vector_m[2][block_m_idx][band_m_idx] = 0; + } + + /* save the elevation and azimuth values to be used later by the ivas_dirac_QuantizeParameters function */ + for ( d = 0; d < DIRAC_NUM_DIMS; d++ ) + { + dir_v[d] = hDirAC->direction_vector_m[d][block_m_idx][band_m_idx]; + } - ivas_qmetadata_direction_vector_to_azimuth_elevation( dir_v, &q_direction->band_data[band_m_idx].azimuth[block_m_idx], &q_direction->band_data[band_m_idx].elevation[block_m_idx] ); + ivas_qmetadata_direction_vector_to_azimuth_elevation( + dir_v, + &q_direction->band_data[band_m_idx].azimuth[block_m_idx], + &q_direction->band_data[band_m_idx].elevation[block_m_idx] ); + } + } + /* Sectors */ +#ifdef HODIRAC + if ( hodirac ) + { + for ( band_m_idx = 0; band_m_idx < hDirAC->hConfig->nbands; band_m_idx++ ) + { + q_direction->band_data[band_m_idx].azimuth[block_m_idx] = azi_secs[band_m_idx]; + q_direction->band_data[band_m_idx].elevation[block_m_idx] = ele_secs[band_m_idx]; + // q_direction->band_data[band_m_idx].energy_ratio[block_m_idx] = 1.f - diffuseness_vector[band_m_idx]; // set later + + q_direction[1].band_data[band_m_idx].azimuth[block_m_idx] = azi_secs[num_freq_bands + band_m_idx]; + q_direction[1].band_data[band_m_idx].elevation[block_m_idx] = ele_secs[num_freq_bands + band_m_idx]; + q_direction[1].band_data[band_m_idx].energy_ratio[block_m_idx] = ( 1.f - diff_secs[band_m_idx] ) / ( ( 1.f - diff_secs[band_m_idx] ) + ( 1.f - diff_secs[num_freq_bands + band_m_idx] ) + EPSILON ); +#ifdef HODIRAC_WRITE_PARAMS + { + static FILE *f_a = 0; + if ( f_a == 0 ) + f_a = fopen( "param_enc", "w" ); + fprintf( f_a, "%f %f %f %f %f %f\n", + q_direction->band_data[band_m_idx].azimuth[block_m_idx], + q_direction->band_data[band_m_idx].elevation[block_m_idx], + diffuseness_vector[band_m_idx], + q_direction[1].band_data[band_m_idx].azimuth[block_m_idx], + q_direction[1].band_data[band_m_idx].elevation[block_m_idx], + q_direction[1].band_data[band_m_idx].energy_ratio[block_m_idx] ); + } +#endif + } } +#endif } /* Diffuseness */ diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 44efbe8260153e4223a0efa9dffbe962d21d18ba..a1436ecc7df2201ccb71a76007febb4376e3dce2 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -65,9 +65,6 @@ ivas_error ivas_enc( float data_f[MAX_INPUT_CHANNELS][L_FRAME48k]; /* IVAS_fmToDo: buffer can be allocated dynamically based on the number of analysed channels */ int32_t ivas_total_brate; ivas_error error; -#ifndef SBA_BR_SWITCHING - int16_t sba_reinit_flag; -#endif error = IVAS_ERR_OK; push_wmops( "ivas_enc" ); @@ -87,24 +84,7 @@ ivas_error ivas_enc( n_samples_chan = n_samples / nchan_inp; set_s( nb_bits_metadata, 0, MAX_SCE ); -#ifndef SBA_BR_SWITCHING - sba_reinit_flag = 0; -#endif -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING - if ( ivas_format == SBA_FORMAT ) - { - st_ivas->sba_reinit_flag = get_sba_reinit_flag( ivas_total_brate, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); - if ( st_ivas->sba_reinit_flag ) - { - if ( ( error = ivas_sba_enc_reinit( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } -#endif -#endif + /*----------------------------------------------------------------* * convert 'short' input data to 'float' *----------------------------------------------------------------*/ @@ -147,11 +127,24 @@ ivas_error ivas_enc( *----------------------------------------------------------------*/ n = getNumChanAnalysis( st_ivas ); + #ifndef DEBUG_SPAR_BYPASS_EVS_CODEC /* bypass EVS coding in float precision, emulating EVS encoder/decoder delay */ for ( i = 0; i < n; i++ ) { - if ( !( ivas_format == MC_FORMAT && i == LFE_CHANNEL ) ) /*TODO: is the HPF needed for LFE channel? */ + if ( ( ivas_format == SBA_FORMAT ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) +#ifdef HODIRAC + && !( st_ivas->sba_analysis_order > 1 ) +#endif + ) + { +#ifdef SPAR_TUNING + hp20( data_f[HOA_keep_ind[st_ivas->hSpar->hMdEnc->HOA_md_ind[i]]], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); +#else + hp20( data_f[HOA_keep_ind[i]], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); +#endif + } + else if ( !( ivas_format == MC_FORMAT && i == LFE_CHANNEL ) ) /*TODO: is the HPF needed for LFE channel? */ { hp20( data_f[i], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } @@ -179,7 +172,10 @@ ivas_error ivas_enc( else if ( ivas_format == ISM_FORMAT ) { /* select ISM format mode; reconfigure the ISM format encoder */ - ivas_ism_enc_config( st_ivas ); + if ( ( ivas_ism_enc_config( st_ivas ) ) ) + { + return error; + } if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { @@ -208,19 +204,11 @@ ivas_error ivas_enc( /* SBA/MASA configuration */ if ( ivas_format == SBA_FORMAT ) { -#ifndef SBA_BR_SWITCHING - if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( !sba_reinit_flag ) ) -#else -#ifndef SBA_BR_SWITCHING_RECONFIG - if ( !st_ivas->sba_reinit_flag ) -#endif -#endif + if ( ( error = ivas_sba_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { - if ( ( error = ivas_sba_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } + st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; /* Write SBA planar flag */ @@ -247,15 +235,16 @@ ivas_error ivas_enc( } else { + ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { return error; } - - ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); - - ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, - ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 ); + if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, + ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 ) ) != IVAS_ERR_OK ) + { + return error; + } } } else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) @@ -297,7 +286,10 @@ ivas_error ivas_enc( else if ( ivas_format == MC_FORMAT ) { /* select MC format mode; write MC LS setup; reconfigure the MC format encoder */ - ivas_mc_enc_config( st_ivas ); + if ( ( ivas_mc_enc_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } hMetaData = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData : st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; @@ -315,6 +307,22 @@ ivas_error ivas_enc( return error; } } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + + /* encode MC ParamUpmix parameters and write bitstream */ + ivas_mc_paramupmix_enc( st_ivas, hMetaData, data_f, input_frame ); + + st_ivas->hLFE->hBstr = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0]->hBstr : st_ivas->hCPE[0]->hCoreCoder[0]->hBstr; + ivas_lfe_enc( st_ivas->hLFE, data_f[LFE_CHANNEL], input_frame, st_ivas->hLFE->hBstr ); + + if ( ( error = ivas_mct_enc( st_ivas, data_f, input_frame, hMetaData->nb_bits_tot ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { /* encode Parametric MC parameters and write bitstream */ @@ -344,7 +352,10 @@ ivas_error ivas_enc( ivas_mcmasa_enc( st_ivas->hMcMasa, st_ivas->hQMetaData, st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport, nchan_inp ); - ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 ); + if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, ivas_total_brate, 0, -1 ) ) != IVAS_ERR_OK ) + { + return error; + } if ( st_ivas->hMcMasa->separateChannelEnabled ) { diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 97cb1c40de87854a6dc73e27305b87ec6c16dd9d..7390ba8b38dd11f1b23a3901016d9ab816faf8ba 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -34,6 +34,9 @@ #include "options.h" #include "prot.h" #include "ivas_prot.h" +#ifdef HODIRAC +#include "ivas_rom_com.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -53,7 +56,12 @@ * Local functions declarations *------------------------------------------------------------------------------------------*/ -static void ivas_band_cov( float **ppIn_FR_real, float **ppIn_FR_imag, const int16_t num_chans, const int16_t num_bins, int16_t stride, float **pFb_bin_to_band, const int16_t *pFb_start_bin_per_band, const int16_t *pFb_active_bins_per_band, const int16_t start_band, const int16_t end_band, float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ); +static void ivas_band_cov( float **ppIn_FR_real, float **ppIn_FR_imag, const int16_t num_chans, const int16_t num_bins, int16_t stride, float **pFb_bin_to_band, const int16_t *pFb_start_bin_per_band, const int16_t *pFb_active_bins_per_band, const int16_t start_band, const int16_t end_band, float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] +#ifdef SPAR_TUNING + , + const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] +#endif +); /*------------------------------------------------------------------------- * ivas_spar_covar_enc_open() @@ -66,6 +74,8 @@ ivas_error ivas_spar_covar_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ + , + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_enc_cov_handler_state_t *hCovState; @@ -82,8 +92,15 @@ ivas_error ivas_spar_covar_enc_open( cov_smooth_cfg.max_bands = IVAS_MAX_NUM_BANDS; cov_smooth_cfg.max_update_rate = MAX_UPDATE_RATE; cov_smooth_cfg.min_pool_size = MIN_POOL_SIZE; +#ifdef MC_PARAMUPMIX_MODE + if ( nchan_inp == 3 ) /* to discriminate between SPAR and mc there could be a better solution */ + { + cov_smooth_cfg.max_update_rate = 1.0f; + cov_smooth_cfg.min_pool_size = 20; + } +#endif - if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_state, &cov_smooth_cfg, pFb, nchan_inp ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_state, &cov_smooth_cfg, pFb, nchan_inp, ivas_total_brate ) ) != IVAS_ERR_OK ) { return error; } @@ -91,7 +108,7 @@ ivas_error ivas_spar_covar_enc_open( cov_smooth_cfg.max_update_rate = MAX_UPDATE_RATE_DTX; cov_smooth_cfg.min_pool_size = MIN_POOL_SIZE_DTX; - if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_dtx_state, &cov_smooth_cfg, pFb, nchan_inp ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_dtx_state, &cov_smooth_cfg, pFb, nchan_inp, ivas_total_brate ) ) != IVAS_ERR_OK ) { return error; } @@ -117,17 +134,19 @@ void ivas_spar_covar_enc_close( { ivas_enc_cov_handler_state_t *hCovState; + if ( hCovEnc == NULL || *hCovEnc == NULL ) + { + return; + } + hCovState = *hCovEnc; - if ( hCovState != NULL ) - { - ivas_spar_covar_smooth_enc_close( &hCovState->pCov_state, nchan_inp ); + ivas_spar_covar_smooth_enc_close( &hCovState->pCov_state, nchan_inp ); - ivas_spar_covar_smooth_enc_close( &hCovState->pCov_dtx_state, nchan_inp ); + ivas_spar_covar_smooth_enc_close( &hCovState->pCov_dtx_state, nchan_inp ); - free( hCovState ); - hCovState = NULL; - } + free( *hCovEnc ); + *hCovEnc = NULL; return; } @@ -150,7 +169,12 @@ void ivas_enc_cov_handler_process( const int16_t end_band, const int16_t num_ch, const int16_t dtx_vad, - const int16_t transient_det ) + const int16_t transient_det[2] +#ifdef SPAR_TUNING + , + const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] +#endif +) { int16_t i, j; int16_t dtx_cov_flag; @@ -163,7 +187,12 @@ void ivas_enc_cov_handler_process( pFb->fb_bin_to_band.p_short_stride_start_bin_per_band, pFb->fb_bin_to_band.p_short_stride_num_bins_per_band, start_band, end_band, - cov_real ); + cov_real +#ifdef SPAR_TUNING + , + HOA_md_ind +#endif + ); #ifdef DEBUG_SPAR_WRITE_OUT_COV { @@ -213,7 +242,7 @@ void ivas_enc_cov_handler_process( } else { - if ( transient_det == 0 ) + if ( ( transient_det[0] == 0 ) && ( transient_det[1] == 0 ) ) { ivas_cov_smooth_process( hCovEnc->pCov_dtx_state, cov_dtx_real, pFb, start_band, end_band, num_ch, transient_det ); hCovEnc->prior_dtx_present = 1; @@ -255,7 +284,12 @@ static void ivas_band_cov( const int16_t *pFb_active_bins_per_band, const int16_t start_band, const int16_t end_band, - float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ) + float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] +#ifdef SPAR_TUNING + , + const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] +#endif +) { int16_t i, j, k; float pV_re[L_FRAME48k]; @@ -265,9 +299,24 @@ static void ivas_band_cov( { for ( j = i; j < num_chans; j++ ) { + +#ifdef HODIRAC +#ifdef SPAR_TUNING + int16_t i1 = HOA_md_ind[i]; + int16_t j1 = HOA_md_ind[j]; +#else + int16_t i1 = HOA_keep_ind_spar[i]; + int16_t j1 = HOA_keep_ind_spar[j]; +#endif +#endif + for ( k = 0; k < num_bins; k++ ) { +#ifdef HODIRAC + pV_re[k] = ppIn_FR_real[i1][k] * ppIn_FR_real[j1][k] + ppIn_FR_imag[i1][k] * ppIn_FR_imag[j1][k]; +#else pV_re[k] = ppIn_FR_real[i][k] * ppIn_FR_real[j][k] + ppIn_FR_imag[i][k] * ppIn_FR_imag[j][k]; +#endif } for ( k = start_band; k < end_band; k++ ) diff --git a/lib_enc/ivas_front_vad.c b/lib_enc/ivas_front_vad.c index be476b1244c1bd897f14d76ac2ac4879e106e3ff..3810df1de9b28e7e949841fec3c6baac389da498 100644 --- a/lib_enc/ivas_front_vad.c +++ b/lib_enc/ivas_front_vad.c @@ -430,9 +430,7 @@ ivas_error front_vad_spar( noise_est_down( fr_bands[0], hFrontVad->hNoiseEst->bckr, tmpN, tmpE, st->min_band, st->max_band, &hFrontVad->hNoiseEst->totalNoise, Etot[0], &hFrontVad->hNoiseEst->Etot_last, &hFrontVad->hNoiseEst->Etot_v_h2 ); corr_shift = correlation_shift( hFrontVad->hNoiseEst->totalNoise ); - dtx( st, hEncoderConfig->ivas_total_brate, vad_flag_dtx[0], inp_12k8 ); - /* linear prediction analysis */ alw_pitch_lag_12k8[0] = st->old_pitch_la; alw_pitch_lag_12k8[1] = st->old_pitch_la; diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 9c01ee3fade4b52e586cfad0009fb28a71233a76..269e6126ef3a0fc0b3aba0aa701a7b2c8654b056 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -57,7 +57,11 @@ void ivas_write_format( ind = 0; nBits = IVAS_FORMAT_SIGNALING_NBITS; +#ifdef COMBINED_FORMAT_SIGNALING + extra_bits = ( IVAS_FORMAT_SIGNALING_NBITS_EXTENDED - IVAS_FORMAT_SIGNALING_NBITS ); +#else extra_bits = ( IVAS_FORMAT_SIGNALING_NBITS_SBA - IVAS_FORMAT_SIGNALING_NBITS ); +#endif switch ( st_ivas->hEncoderConfig->ivas_format ) { @@ -66,6 +70,13 @@ void ivas_write_format( break; case ISM_FORMAT: ind = 2; +#ifdef COMBINED_FORMAT_SIGNALING + if ( st_ivas->hEncoderConfig->ivas_total_brate >= IVAS_24k4 ) + { + ind = 4; + nBits += extra_bits; + } +#endif break; case MC_FORMAT: ind = 1; @@ -184,12 +195,26 @@ int16_t getNumChanAnalysis( n = st_ivas->nSCE + CPE_CHANNELS * st_ivas->nCPE; if ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT ) { - n = DIRAC_MAX_ANA_CHANS; +#ifdef HODIRAC + n = ( st_ivas->sba_analysis_order + 1 ) * ( st_ivas->sba_analysis_order + 1 ); +#else +#ifdef SPAR_TUNING + n = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hEncoderConfig->ivas_total_brate ); +#else + n = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order ); +#endif +#endif } else if ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_PARAMMC || st_ivas->mc_mode == MC_MODE_MCMASA ) ) { n = st_ivas->hEncoderConfig->nchan_inp; } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + n = st_ivas->hEncoderConfig->nchan_inp; + } +#endif else if ( st_ivas->hEncoderConfig->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM ) { n = st_ivas->hEncoderConfig->nchan_inp; @@ -266,12 +291,15 @@ void ivas_initialize_handles_enc( st_ivas->mem_hp20_in = NULL; - /* ISm metadata handles */ + /* ISM metadata handles */ for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { st_ivas->hIsmMetaData[i] = NULL; } + /* ISM DTX handle */ + st_ivas->hISMDTX = NULL; + /* Q Metadata handle */ st_ivas->hQMetaData = NULL; @@ -287,6 +315,11 @@ void ivas_initialize_handles_enc( /* MCT handle */ st_ivas->hMCT = NULL; +#ifdef MC_PARAMUPMIX_MODE + /* MC Param-Upmix handle */ + st_ivas->hMCParamUpmix = NULL; +#endif + /* Parametric MC handle */ st_ivas->hParamMC = NULL; @@ -336,17 +369,12 @@ ivas_error ivas_init_encoder( /* In IVAS, ensure that minimum coded bandwidth is WB */ hEncoderConfig->max_bwidth = max( hEncoderConfig->max_bwidth, WB ); } - + hEncoderConfig->spar_reconfig_flag = 0; st_ivas->ism_mode = ISM_MODE_NONE; st_ivas->mc_mode = MC_MODE_NONE; st_ivas->sba_mode = SBA_MODE_NONE; st_ivas->nchan_transport = -1; -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING - st_ivas->sba_reinit_flag = 0; -#endif -#endif /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles *-----------------------------------------------------------------*/ @@ -405,7 +433,7 @@ ivas_error ivas_init_encoder( st_ivas->ism_mode = ivas_ism_mode_select( hEncoderConfig->nchan_inp, ivas_total_brate ); - if ( ( error = create_ism_metadata_enc( st_ivas, hEncoderConfig->nchan_inp, element_brate_tmp ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_metadata_enc_create( st_ivas, hEncoderConfig->nchan_inp, element_brate_tmp ) ) != IVAS_ERR_OK ) { return error; } @@ -432,6 +460,14 @@ ivas_error ivas_init_encoder( return error; } } + + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) + { + if ( ( error = ivas_ism_dtx_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } } else if ( ivas_format == SBA_FORMAT || ivas_format == MASA_FORMAT ) { @@ -442,13 +478,12 @@ ivas_error ivas_init_encoder( if ( ivas_format == SBA_FORMAT ) { - st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); - + st_ivas->sba_mode = ivas_sba_mode_select(); st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { - if ( ( error = ivas_spar_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -526,8 +561,8 @@ ivas_error ivas_init_encoder( else if ( ivas_format == MC_FORMAT ) { st_ivas->mc_mode = ivas_mc_mode_select( hEncoderConfig->mc_input_setup, ivas_total_brate ); - hEncoderConfig->nchan_inp = ivas_mc_ls_setup_get_num_channels( hEncoderConfig->mc_input_setup ); + hEncoderConfig->nchan_inp = ivas_mc_ls_setup_get_num_channels( hEncoderConfig->mc_input_setup ); if ( st_ivas->mc_mode == MC_MODE_MCT ) { @@ -548,6 +583,7 @@ ivas_error ivas_init_encoder( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n]; reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); } + /* Metadata only initialized for the last CPE index*/ if ( cpe_id == st_ivas->nCPE - 1 ) { @@ -568,6 +604,51 @@ ivas_error ivas_init_encoder( st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( st_ivas->hEncoderConfig->mc_input_setup ); } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + st_ivas->nSCE = 0; + st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / 2; + st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; + + if ( ( error = ivas_mc_paramupmix_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < CPE_CHANNELS; n++ ) + { + /* we need the correct bitstream also for the LFE channel since it might become a proper coded channel when + switching to ParamMC and ind_list is only visible here, can't be done later */ + st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list[cpe_id * CPE_CHANNELS + n]; + reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); + } + /* Metadata only initialized for the last CPE index*/ + if ( cpe_id == st_ivas->nCPE - 1 ) + { + st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata[st_ivas->nSCE]; + reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); + } + } + + if ( ( error = create_mct_enc( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_create_lfe_enc( &st_ivas->hLFE, input_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { if ( ( error = ivas_param_mc_enc_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -582,7 +663,6 @@ ivas_error ivas_init_encoder( return error; } - /* prepare bitstream buffers */ for ( n = 0; n < CPE_CHANNELS; n++ ) { @@ -719,7 +799,7 @@ void destroy_core_enc( ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure */ ) { - destroy_encoder( hCoreCoder ); + destroy_cldfb_encoder( hCoreCoder ); if ( hCoreCoder->hSignalBuf != NULL ) { @@ -910,80 +990,53 @@ void ivas_destroy_enc( } /* ISM metadata handles */ - for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) + ivas_ism_metadata_close( st_ivas->hIsmMetaData ); + + /* ISM DTX Handle */ + if ( st_ivas->hISMDTX != NULL ) { - if ( st_ivas->hIsmMetaData[n] != NULL ) - { - free( st_ivas->hIsmMetaData[n] ); - st_ivas->hIsmMetaData[n] = NULL; - } + free( st_ivas->hISMDTX ); + st_ivas->hISMDTX = NULL; } /* Q Metadata handle */ ivas_qmetadata_close( &( st_ivas->hQMetaData ) ); /* DirAC handle */ - if ( st_ivas->hDirAC != NULL ) + if ( ivas_format == ISM_FORMAT ) { - if ( ivas_format == ISM_FORMAT ) - { - ivas_param_ism_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); - } - else - { - ivas_dirac_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); - } - st_ivas->hDirAC = NULL; + ivas_param_ism_enc_close( &( st_ivas->hDirAC ), st_ivas->hEncoderConfig->input_Fs ); } - - /* SPAR handle */ - if ( st_ivas->hSpar != NULL ) + else { - ivas_spar_enc_close( st_ivas->hSpar, st_ivas->hEncoderConfig->input_Fs, nchan_inp ); - st_ivas->hSpar = NULL; + ivas_dirac_enc_close( &( st_ivas->hDirAC ), st_ivas->hEncoderConfig->input_Fs ); } + /* SPAR handle */ + ivas_spar_enc_close( &( st_ivas->hSpar ), st_ivas->hEncoderConfig->input_Fs, nchan_inp, 0 ); + /* MASA handle */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_enc_close( st_ivas->hMasa, st_ivas->nchan_transport, ivas_format ); - st_ivas->hMasa = NULL; - } + ivas_masa_enc_close( &( st_ivas->hMasa ) ); /* MCT handle */ - if ( st_ivas->hMCT != NULL ) - { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; - } + ivas_mct_enc_close( &( st_ivas->hMCT ) ); + + /* LFE handle */ + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); + +#ifdef MC_PARAMUPMIX_MODE + /* Param-Upmix MC handle */ + ivas_mc_paramupmix_enc_close( &( st_ivas->hMCParamUpmix ), st_ivas->hEncoderConfig->input_Fs ); +#endif /* Parametric MC handle */ - if ( st_ivas->hParamMC != NULL ) - { - ivas_param_mc_enc_close( st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hParamMC = NULL; - } + ivas_param_mc_enc_close( &( st_ivas->hParamMC ), st_ivas->hEncoderConfig->input_Fs ); /* Multi-channel MASA handle */ - if ( st_ivas->hMcMasa != NULL ) - { - ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hMcMasa = NULL; - } + ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); /* Stereo downmix for EVS encoder handle */ - if ( st_ivas->hStereoDmxEVS != NULL ) - { - stereo_dmx_evs_close_encoder( st_ivas->hStereoDmxEVS ); - st_ivas->hStereoDmxEVS = NULL; - } - - /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_enc_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } + stereo_dmx_evs_close_encoder( &( st_ivas->hStereoDmxEVS ) ); #ifndef SWITCHING_FORMAT_ENC /* Encoder configuration handle */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c new file mode 100644 index 0000000000000000000000000000000000000000..3a216b6164f2f335f41d921e73a4c80d9638584b --- /dev/null +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -0,0 +1,419 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include +#include "options.h" +#include "ivas_cnst.h" +#include "prot.h" +#include "ivas_prot.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" + + +/*-----------------------------------------------------------------------* + * Local constants + *-----------------------------------------------------------------------*/ + +#define MD_MAX_DIFF_AZIMUTH 10 +#define MD_MAX_DIFF_ELEVATION 10 + + +/*-------------------------------------------------------------------* + * ivas_ism_dtx_open() + * + * Open ISM DTX handle + *-------------------------------------------------------------------*/ + +ivas_error ivas_ism_dtx_open( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +) +{ + ivas_error error; + ISM_DTX_HANDLE hISMDTX; + int16_t i; + + error = IVAS_ERR_OK; + + /* Assign memory to DirAC handle */ + if ( ( hISMDTX = (ISM_DTX_HANDLE) malloc( sizeof( ISM_DTX_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM DTX Handle \n" ) ); + } + + hISMDTX->dtx_flag = 0; + hISMDTX->sce_id_dtx = 0; + hISMDTX->cnt_SID_ISM = -1; + + for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) + { + set_f( hISMDTX->long_term_energy_stereo_dmx_enc[i], 0.0f, PARAM_ISM_HYS_BUF_SIZE ); + } + + set_f( hISMDTX->coh, 0.0f, MAX_NUM_OBJECTS ); + + st_ivas->hISMDTX = hISMDTX; + + return error; +} + + +/*-------------------------------------------------------------------* + * ivas_ism_get_dtx_enc() + * + * Analysis and decision about DTX in ISM format + *-------------------------------------------------------------------*/ + +/*! r: indication of DTX frame */ +int16_t ivas_ism_dtx_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ + const int16_t nchan_ism, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t md_diff_flag[], /* o : metadata differential flag */ + int16_t *sid_flag /* o : indication of SID frame */ +) +{ + int16_t ch, dtx_flag; + int16_t nBits, nBits_MD_max; + int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; + float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; + float lp_noise_max; + float tmp1, tmp2; + + /* initialization */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; + } + + /*------------------------------------------------------------------* + * compute global ISM DTX flag + *-----------------------------------------------------------------*/ + + /* compute global ISM based on localVAD */ + dtx_flag = 1; + for ( ch = 0; ch < nchan_transport; ch++ ) + { + dtx_flag &= !vad_flag[ch]; + } + + /* compute global ISM based on long-term background noise */ + /* one of the channels is active -> no DTX */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + lp_noise[ch] = hSCE[ch]->hCoreCoder[0]->lp_noise; + } + + lp_noise_variation = var( lp_noise, nchan_transport ); + lp_noise_mean = mean( lp_noise, nchan_transport ); + + if ( lp_noise_mean > 50 || ( lp_noise_mean > 25 && lp_noise_variation > 32 ) ) + { + dtx_flag = 0; + } + + + /* default DTX is applied at lower bitrates; otherwise DTX is applied only in silence */ + maximum( lp_noise, nchan_transport, &lp_noise_max ); + + if ( !( ( nchan_ism == 1 && ivas_total_brate <= IVAS_24k4 ) || + ( nchan_ism == 2 && ivas_total_brate <= IVAS_48k ) || + ( nchan_ism == 3 && ivas_total_brate <= IVAS_80k ) || + ( nchan_ism == 4 && ivas_total_brate <= IVAS_96k ) || + lp_noise_max < 15 ) ) + { + dtx_flag = 0; + } + + /*------------------------------------------------------------------* + * Reset the bitstream + *-----------------------------------------------------------------*/ + + if ( dtx_flag ) + { + /* reset the bitstream (IVAS format signaling was already written) */ + reset_indices_enc( hSCE[0]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); + } + + /*------------------------------------------------------------------* + * decide about SID metadata to be sent or not (per object) + * estimate the MD bit-budget consumption + *-----------------------------------------------------------------*/ + + if ( dtx_flag ) + { + ivas_get_ism_sid_quan_bitbudget( nchan_ism, &nBits_azimuth, &nBits_elevation, &tmp1, &tmp2, &nBits_coh, &nBits_sce_id ); + + nBits = 0; + for ( ch = 0; ch < nchan_ism; ch++ ) + { + /* check difference between current and last metadata */ + md_diff_flag[ch] = 0; + if ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_azimuth ) > MD_MAX_DIFF_AZIMUTH ) + { + md_diff_flag[ch] = 1; + } + + if ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_elevation ) > MD_MAX_DIFF_ELEVATION ) + { + md_diff_flag[ch] = 1; + } + + /* estimate SID metadata bit-budget */ + nBits++; /* number of objects */ + nBits++; /* SID metadata flag */ + if ( md_diff_flag[ch] == 1 ) + { + nBits += nBits_azimuth; + nBits += nBits_elevation; + } + } + + /* calculate maximum available MD bit-budget */ + nBits_MD_max = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + nBits_MD_max -= SID_FORMAT_NBITS; + if ( nchan_transport > 1 ) + { + nBits_MD_max -= nBits_sce_id; + } + + for ( ch = 0; ch < nchan_transport - 1; ch++ ) + { + nBits_MD_max -= nBits_coh; /* coherence */ + } + + if ( nchan_ism > 3 ) + { + nBits_MD_max--; /* ism_mode flag */ + } + + /* too many metadata bits -> switch to active coding */ + if ( nBits > nBits_MD_max ) + { + dtx_flag = 0; + } + } + + /*------------------------------------------------------------------* + * set core_brate for all channels + * get 'sid_flag' value + *-----------------------------------------------------------------*/ + + *sid_flag = 0; + + if ( !dtx_flag ) + { + /* at least one of the channels is active -> no DTX */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->core_brate = -1; + set_bw( IVAS_SCE, hSCE[ch]->element_brate, hSCE[ch]->hCoreCoder[0], MODE1 ); + } + + hISMDTX->cnt_SID_ISM = -1; + + /* IVAS format signaling was erased in dtx() */ + if ( hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot == 0 ) + { +#ifdef COMBINED_FORMAT_SIGNALING + /* replicate ivas_write_format() */ + int16_t ind = 2; + nBits = IVAS_FORMAT_SIGNALING_NBITS; + if ( ivas_total_brate >= IVAS_24k4 ) + { + ind = 4; + nBits = IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; + } + + push_indice( hSCE[0]->hCoreCoder[0]->hBstr, IND_IVAS_FORMAT, ind, nBits ); +#else + push_indice( hSCE[0]->hCoreCoder[0]->hBstr, IND_IVAS_FORMAT, 2 /* == ISM format */, IVAS_FORMAT_SIGNALING_NBITS ); +#endif + } + } + else /* ism_dtx_flag == 1 */ + { + for ( ch = 0; ch < nchan_transport; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->cng_type = FD_CNG; + } + + /* * update the global SID counter */ + hISMDTX->cnt_SID_ISM++; + if ( hISMDTX->cnt_SID_ISM >= hSCE[0]->hCoreCoder[0]->hDtxEnc->max_SID ) + { + /* adaptive SID update interval */ + hSCE[0]->hCoreCoder[0]->hDtxEnc->max_SID = hSCE[0]->hCoreCoder[0]->hDtxEnc->interval_SID; + hISMDTX->cnt_SID_ISM = 0; + } + + /* encode SID in one channel only */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->core_brate = FRAME_NO_DATA; + } + + if ( hISMDTX->cnt_SID_ISM == 0 ) + { + hSCE[hISMDTX->sce_id_dtx]->hCoreCoder[0]->core_brate = SID_2k40; + *sid_flag = 1; + } + } + + if ( dtx_flag == 1 && *sid_flag == 0 ) + { + set_s( md_diff_flag, 0, nchan_transport ); + } + + return dtx_flag; +} + +/*-------------------------------------------------------------------* + * ivas_ism_get_sce_id_dtx() + * + * + *-------------------------------------------------------------------*/ + +void ivas_ism_get_sce_id_dtx( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t input_frame /* i : input frame length per channel */ + +) +{ + float tmp_energy[MAX_NUM_OBJECTS]; + int16_t i, j; + + if ( nchan_transport == 1 ) + { + hISMDTX->sce_id_dtx = 0; + + return; + } + + /* Initialize*/ + set_f( tmp_energy, 0.0f, MAX_NUM_OBJECTS ); + + /* compute long term energy parameter */ + for ( j = 0; j < nchan_transport; j++ ) + { + for ( i = 0; i < ( PARAM_ISM_HYS_BUF_SIZE - 1 ); i++ ) + { + hISMDTX->long_term_energy_stereo_dmx_enc[j][i] = hISMDTX->long_term_energy_stereo_dmx_enc[j][i + 1]; + } + + hISMDTX->long_term_energy_stereo_dmx_enc[j][PARAM_ISM_HYS_BUF_SIZE - 1] = sum2_f( hSCE[j]->hCoreCoder[0]->input, input_frame ); + + tmp_energy[j] = sum_f( hISMDTX->long_term_energy_stereo_dmx_enc[j], PARAM_ISM_HYS_BUF_SIZE ); + } + + /* determine the sce_id */ + hISMDTX->sce_id_dtx = 0; + for ( j = 1; j < nchan_transport; j++ ) + { + if ( tmp_energy[j] > tmp_energy[hISMDTX->sce_id_dtx] ) + { + hISMDTX->sce_id_dtx = j; + } + } + + return; +} + + +/*-------------------------------------------------------------------* + * ivas_ism_coh_estim_dtx_enc() + * + * + *-------------------------------------------------------------------*/ + +void ivas_ism_coh_estim_dtx_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t input_frame /* i : input frame length */ + +) +{ + Encoder_State *st, *st_id0; + int16_t sce_id, i; + float acorr_ene[MAX_NUM_OBJECTS], xcorr_ene; + + if ( nchan_transport == 1 ) + { + hISMDTX->coh[0] = 0.f; + return; + } + + /* Compute Coherence */ + acorr_ene[hISMDTX->sce_id_dtx] = 0.0f; + st_id0 = hSCE[hISMDTX->sce_id_dtx]->hCoreCoder[0]; + + for ( i = 0; i < input_frame; i++ ) + { + acorr_ene[hISMDTX->sce_id_dtx] += st_id0->input[i] * st_id0->input[i]; + } + + for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) + { + if ( sce_id == hISMDTX->sce_id_dtx ) + { + hISMDTX->coh[sce_id] = 1.0f; + continue; + } + + st = hSCE[sce_id]->hCoreCoder[0]; + + acorr_ene[sce_id] = 0.0f; + xcorr_ene = 0.0f; + + for ( i = 0; i < input_frame; i++ ) + { + acorr_ene[sce_id] += st->input[i] * st->input[i]; + xcorr_ene += st_id0->input[i] * st->input[i]; + } + + hISMDTX->coh[sce_id] = fabsf( xcorr_ene ) / ( sqrtf( ( acorr_ene[hISMDTX->sce_id_dtx] * acorr_ene[sce_id] ) + EPSILON ) ); + + /* ensure value of coherence is between [0,1] */ + hISMDTX->coh[sce_id] = check_bounds( hISMDTX->coh[sce_id], 0.0f, 1.0f ); + } + + return; +} diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 92435ac7b219799deea1bfb08715479ef3b1aea3..5c310ac30fcb3a66be6e666712db0a70fd870d67 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -85,12 +85,24 @@ ivas_error ivas_ism_enc( float Etot_LR[1]; /* total energy; correlation shift */ float lf_E[1][2 * VOIC_BINS]; /* per bin spectrum energy in lf */ int16_t localVAD_HE_SAD[1]; /* local HE VAD */ - int16_t i, nBits; + int16_t nchan_ism, dtx_flag, sid_flag, flag_noisy_speech; + int16_t md_diff_flag[MAX_NUM_OBJECTS]; ivas_error error; + push_wmops( "ivas_ism_enc" ); + + /*------------------------------------------------------------------* + * Initialization + *-----------------------------------------------------------------*/ + error = IVAS_ERR_OK; - push_wmops( "ivas_ism_enc" ); + dtx_flag = 0; + sid_flag = 0; + flag_noisy_speech = 0; + + nchan_ism = st_ivas->hEncoderConfig->nchan_ism; + set_s( md_diff_flag, 1, nchan_ism ); /*------------------------------------------------------------------* * Preprocesing @@ -150,77 +162,89 @@ ivas_error ivas_ism_enc( &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, - st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->hEncoderConfig->ivas_format ); + st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; } - vad_flag[sce_id] = st->vad_flag; + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) + { + vad_flag[sce_id] = vad_flag_dtx[sce_id][0]; + } + else + { + vad_flag[sce_id] = st->vad_flag; + } } /*------------------------------------------------------------------* - * Analysis of objects, configuration and decision about bitrates per channel + * DTX analysis *-----------------------------------------------------------------*/ - /* Metadata encoding */ - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) { - /* Move the Noisy speech buffer */ - for ( i = 0; i < ( PARAM_ISM_HYS_BUF_SIZE - 1 ); i++ ) - { - st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i + 1]; - } + /* compute the dominant sce_id using long term energy */ + ivas_ism_get_sce_id_dtx( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); - /* For the current frame, make a decision based on some core-coder flags */ - if ( st_ivas->hSCE[0]->hCoreCoder[0]->flag_noisy_speech_snr && st_ivas->hSCE[1]->hCoreCoder[0]->flag_noisy_speech_snr ) - { - if ( st_ivas->hSCE[0]->hCoreCoder[0]->vad_flag || st_ivas->hSCE[1]->hCoreCoder[0]->vad_flag ) - { - st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 0; - } - else - { - st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 1; - } - } - else - { - st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 0; - } + /* analysis and decision about DTX */ + dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); - /* Do a decision based on hysterisis */ - st_ivas->hDirAC->hParamIsm->flag_noisy_speech = 1; - for ( i = 0; i < PARAM_ISM_HYS_BUF_SIZE; i++ ) + if ( sid_flag ) { - st_ivas->hDirAC->hParamIsm->flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech && st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i]; + /* estimate coherence between objects */ + ivas_ism_coh_estim_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); } - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); +#ifdef DEBUG_MODE_PARAM_ISM + if ( st_ivas->hDirAC != NULL ) + dbgwrite( &( st_ivas->hDirAC->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); + dbgwrite( &( st_ivas->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); + dbgwrite( &( st_ivas->hISMDTX->sce_id_dtx ), sizeof( int16_t ), 1, input_frame, "./res/sce_id_dtx" ); + dbgwrite( &( dtx_flag ), sizeof( int16_t ), 1, input_frame, "./res/dtx_flag" ); +#endif + } + + /*------------------------------------------------------------------* + * Analysis of objects, configuration and decision about bitrates per channel + * Metadata quantization and encoding + *-----------------------------------------------------------------*/ + + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + ivas_param_ism_compute_noisy_speech_flag( st_ivas ); + flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech; + } + + if ( dtx_flag ) + { + ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, nchan_ism, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); + } + else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + // VE: call ivas_ism_metadata_enc() with 'st_ivas' - TBD + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, + nchan_ism, + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); } else /* ISM_MODE_DISC */ { - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, + nchan_ism, + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); } + update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); + /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ st = st_ivas->hSCE[0]->hCoreCoder[0]; - if ( st->core_brate == SID_2k40 ) + if ( sid_flag ) { ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); - - /* write unused bits */ - nBits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; - while ( nBits > 0 ) - { - i = min( nBits, 16 ); - push_indice( st->hBstr, IND_UNUSED, 0, i ); - nBits -= i; - } } /*------------------------------------------------------------------* @@ -262,9 +286,12 @@ ivas_error ivas_ism_enc( * Encoder *----------------------------------------------------------------*/ - if ( ( error = ivas_core_enc( hSCE, NULL, NULL, 1, old_inp_12k8[sce_id], old_inp_16k[sce_id], ener[sce_id], A[sce_id], Aw[sce_id], epsP[sce_id], lsp_new[sce_id], lsp_mid[sce_id], vad_hover_flag[sce_id], attack_flag[sce_id], realBuffer[sce_id], imagBuffer[sce_id], old_wsp[sce_id], loc_harm[sce_id], cor_map_sum[sce_id], vad_flag_dtx[sce_id], enerBuffer[sce_id], fft_buff[sce_id], 0, ISM_FORMAT, 0 ) ) != IVAS_ERR_OK ) + if ( !dtx_flag || ( dtx_flag && sce_id == st_ivas->hISMDTX->sce_id_dtx ) ) { - return error; + if ( ( error = ivas_core_enc( hSCE, NULL, NULL, 1, old_inp_12k8[sce_id], old_inp_16k[sce_id], ener[sce_id], A[sce_id], Aw[sce_id], epsP[sce_id], lsp_new[sce_id], lsp_mid[sce_id], vad_hover_flag[sce_id], attack_flag[sce_id], realBuffer[sce_id], imagBuffer[sce_id], old_wsp[sce_id], loc_harm[sce_id], cor_map_sum[sce_id], vad_flag_dtx[sce_id], enerBuffer[sce_id], fft_buff[sce_id], 0, ISM_FORMAT, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } } /*----------------------------------------------------------------* @@ -278,7 +305,132 @@ ivas_error ivas_ism_enc( st->hTranDet->transientDetector.prev_bIsAttackPresent = st->hTranDet->transientDetector.bIsAttackPresent; } + if ( dtx_flag ) + { + for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) + { + if ( sce_id != st_ivas->hISMDTX->sce_id_dtx ) + { + st_ivas->hSCE[sce_id]->hCoreCoder[0]->last_core = st_ivas->hSCE[st_ivas->hISMDTX->sce_id_dtx]->hCoreCoder[0]->last_core; + st_ivas->hSCE[sce_id]->hCoreCoder[0]->last_core_brate = st_ivas->hSCE[st_ivas->hISMDTX->sce_id_dtx]->hCoreCoder[0]->core_brate; + st_ivas->hSCE[sce_id]->hCoreCoder[0]->last_L_frame = st_ivas->hSCE[st_ivas->hISMDTX->sce_id_dtx]->hCoreCoder[0]->last_L_frame; + } + } + } + +#ifdef DEBUG_MODE_INFO + if ( dtx_flag ) + { + float tmpF; + int16_t id, n; + + n = 0; + for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) + { + if ( sce_id != st_ivas->hISMDTX->sce_id_dtx ) + { + st = st_ivas->hSCE[sce_id]->hCoreCoder[0]; + id = st->id_element; + + dbgwrite( &st->core, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "core", n, id, ENC ) ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "extl", n, id, ENC ) ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "bwidth", n, id, ENC ) ); + tmpF = st->total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "total_brate", n, id, ENC ) ); + tmpF = st->core_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "core_brate", n, id, ENC ) ); + tmpF = st->extl_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "extl_brate", n, id, ENC ) ); + + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type", n, id, ENC ) ); + dbgwrite( &st->coder_type_raw, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type_raw", n, id, ENC ) ); + dbgwrite( &st->vad_flag, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "vad_flag", n, id, ENC ) ); + dbgwrite( &st->localVAD, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "localVAD", n, id, ENC ) ); + + dbgwrite( &st->lp_noise, sizeof( float ), 1, input_frame, fname( debug_dir, "lp_noise", n, id, ENC ) ); + } + } + } +#endif pop_wmops(); return error; } + + +/*------------------------------------------------------------------------- + * ivas_ism_enc_config() + * + * - select ISM format mode + * - reconfigure the ISM format encoder + *-------------------------------------------------------------------------*/ + +ivas_error ivas_ism_enc_config( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +) +{ + ivas_error error; + ISM_MODE last_ism_mode; + int16_t nchan_transport_old; + int16_t nSCE_old, nCPE_old; + + error = IVAS_ERR_OK; + last_ism_mode = st_ivas->ism_mode; + + /* select ISM format mode */ + st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->hEncoderConfig->nchan_inp, st_ivas->hEncoderConfig->ivas_total_brate ); + + /* ISM bit-rate switching */ + if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hEncoderConfig->ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) ) + { + int32_t element_brate_tmp[MAX_NUM_OBJECTS]; + + nchan_transport_old = st_ivas->nchan_transport; + + /* Reset and Initialize */ + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; + } + else + { + st_ivas->nchan_transport = st_ivas->hEncoderConfig->nchan_inp; + } + + nCPE_old = st_ivas->nCPE; + nSCE_old = st_ivas->nSCE; + st_ivas->nSCE = st_ivas->nchan_transport; + st_ivas->nCPE = 0; + +#ifdef ISM_NON_DIEGETIC_PAN + if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC ) + { + /* Allocate and Initialize the memory used by ParamISM when switch from Discrete ISM */ + if ( ( error = ivas_param_ism_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) + { + /* Deallocate the memory used by ParamISM when switch to Discrete ISM */ + ivas_param_ism_enc_close( &( st_ivas->hDirAC ), st_ivas->hEncoderConfig->input_Fs ); + } + } + + return error; +} diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 970a54b665f106d03312ce0325c479df4026454f..732ffec21b7a2cf68d889caec204e9a9da3b0811 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -49,27 +49,52 @@ * Local constants *-----------------------------------------------------------------------*/ -#define ISM_NUM_PARAM 2 /* number of coded metadata parameters */ +#define ISM_NUM_PARAM 5 /* number of coded metadata parameters */ #define ISM_MAX_AZIMUTH_DIFF_IDX ( ISM_AZIMUTH_NBITS - 1 /*zero*/ - 1 /*sign*/ ) #define ISM_MAX_ELEVATION_DIFF_IDX ( ISM_ELEVATION_NBITS - 1 /*zero*/ - 1 /*sign*/ ) +#define ISM_MAX_RADIUS_DIFF_IDX ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ ) #define ISM_FEC_MAX 10 - +#ifdef FIX_387_ISM_MD_FEC +#define ISM_MD_FEC_DIFF 10 +#define ISM_MD_INC_DIFF_CNT_MAX 6 +#define ISM_MD_FEC_CNT_MAX 25 +#endif +#ifdef FIX_435_ISM_MERGE_BUG +#define ISM_MD_RAD_FEC_DIFF 1 +#endif #define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters) */ +/*-----------------------------------------------------------------------* + * Local function declarations + *-----------------------------------------------------------------------*/ + +static void encode_angle_indices( BSTR_ENC_HANDLE hBstr, ISM_METADATA_ANGLE_HANDLE angle, const int16_t last_ism_metadata_flag, const int16_t ini_frame, const int16_t idx_angle1_abs, const int16_t idx_angle2_abs, int16_t *flag_abs_angle1, int16_t *flag_abs_angle2 ); + +static void encode_radius( BSTR_ENC_HANDLE hBstr, int16_t *last_radius_idx, int16_t *radius_diff_cnt, const int16_t last_ism_metadata_flag, const int16_t idx_radius_abs, int16_t *flag_abs_radius ); + + /*-------------------------------------------------------------------------* - * set_ism_metadata() + * ivas_set_ism_metadata() * - * Set metadata of for one ISM + * Set metadata of one ISM MD handle *-------------------------------------------------------------------------*/ -/*! r: 0 if success */ -ivas_error set_ism_metadata( - ISM_METADATA_HANDLE hIsmMeta, - float azimuth, - float elevation ) +ivas_error ivas_set_ism_metadata( + ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ + const float azimuth, /* i : azimuth value */ + const float elevation, /* i : elevation */ + const float radius_meta, /* i : radius */ + const float yaw, /* i : yaw */ +#ifdef ISM_NON_DIEGETIC_PAN + const float pitch, /* i : pitch */ + const int16_t non_diegetic_flag /* i : non-diegetic object flag*/ +#else + const float pitch /* i : pitch */ +#endif +) { if ( hIsmMeta == NULL ) { @@ -81,6 +106,12 @@ ivas_error set_ism_metadata( /* save read metadata parameters to the internal codec structure */ hIsmMeta->azimuth = azimuth; hIsmMeta->elevation = elevation; + hIsmMeta->radius = radius_meta; + hIsmMeta->yaw = yaw; + hIsmMeta->pitch = pitch; +#ifdef ISM_NON_DIEGETIC_PAN + hIsmMeta->non_diegetic_flag = non_diegetic_flag; +#endif return IVAS_ERR_OK; } @@ -89,7 +120,7 @@ ivas_error set_ism_metadata( /*-------------------------------------------------------------------------* * rate_ism_importance() * - * Rate importance of particular ISm streams + * Rate importance of particular ISM streams *-------------------------------------------------------------------------*/ static void rate_ism_importance( @@ -138,6 +169,7 @@ static void rate_ism_importance( return; } + /*-------------------------------------------------------------------------* * ivas_ism_metadata_enc() * @@ -145,64 +177,59 @@ static void rate_ism_importance( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t nchan_transport, /* i : number of transport channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - int16_t nb_bits_metadata[], /* o : number of metadata bits */ - const int16_t localVAD[], /* i : VAD flag */ - const int16_t ism_mode, /* i : ISM mode */ - const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_ism, /* i : number of ISM channels */ + const int16_t nchan_transport, /* i : number of transport channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + int16_t nb_bits_metadata[], /* o : number of metadata bits */ + const int16_t localVAD[], /* i : VAD flag */ + const int16_t ism_mode, /* i : ISM mode */ + const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Enc Handle */ + const int16_t ism_extended_metadata_flag /* i : Extended metadata flag */ ) { - int16_t i, ch, nb_bits_start = 0, diff; - int16_t idx_azimuth, idx_azimuth_abs = 0, flag_abs_azimuth[MAX_NUM_OBJECTS], nbits_diff_azimuth; - int16_t idx_elevation, idx_elevation_abs = 0, flag_abs_elevation[MAX_NUM_OBJECTS], nbits_diff_elevation; + int16_t i, ch, nb_bits_start = 0; + int16_t flag_abs_azimuth[MAX_NUM_OBJECTS]; + int16_t flag_abs_elevation[MAX_NUM_OBJECTS]; + int16_t idx_angle1_abs = 0; + int16_t idx_angle2_abs = 0; + int16_t flag_abs_yaw[MAX_NUM_OBJECTS]; + int16_t flag_abs_pitch[MAX_NUM_OBJECTS]; + int16_t idx_radius_abs = 0, flag_abs_radius[MAX_NUM_OBJECTS]; float valQ; ISM_METADATA_HANDLE hIsmMetaData; int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; int16_t ism_metadata_flag_global; +#ifdef ISM_NON_DIEGETIC_PAN + int16_t non_diegetic_flag_global; +#endif int16_t ism_imp[MAX_NUM_OBJECTS]; - int16_t num_obj, nbands, nblocks; + int16_t nbands, nblocks; ivas_error error; error = IVAS_ERR_OK; push_wmops( "ism_meta_enc" ); - if ( ism_mode == ISM_MODE_PARAM ) - { - num_obj = hParamIsm->num_obj; - } - else if ( ism_mode == ISM_MODE_DISC ) - { - num_obj = nchan_transport; - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); - } - - if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ( ism_mode == ISM_MODE_DISC ) ) - { - /* no metadata encoding in CNG */ - pop_wmops(); - - return error; - } - /* initialization */ ism_metadata_flag_global = 0; +#ifdef ISM_NON_DIEGETIC_PAN + non_diegetic_flag_global = 0; +#endif set_s( nb_bits_metadata, 0, nchan_transport ); - set_s( flag_abs_azimuth, 0, num_obj ); - set_s( flag_abs_elevation, 0, num_obj ); + set_s( flag_abs_azimuth, 0, nchan_ism ); + set_s( flag_abs_elevation, 0, nchan_ism ); + set_s( flag_abs_yaw, 0, nchan_ism ); + set_s( flag_abs_pitch, 0, nchan_ism ); + set_s( flag_abs_radius, 0, nchan_ism ); /*----------------------------------------------------------------* * Set Metadata presence / importance flag *----------------------------------------------------------------*/ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { if ( ism_mode == ISM_MODE_PARAM ) { @@ -210,76 +237,106 @@ ivas_error ivas_ism_metadata_enc( } else if ( ism_mode == ISM_MODE_DISC ) { - hIsmMeta[ch]->ism_metadata_flag = localVAD[ch]; - - if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) +#ifdef FIX_435_ISM_MERGE_BUG + if ( hIsmMeta[ch]->ism_metadata_flag == 1 ) { - /* send metadata even in inactive segments when noise is audible and metadata are changing */ - diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ); - diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); - - if ( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) + /* In case of low level noise for low bitrate inactive frames, do not sent metadata */ + hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10 || hSCE[ch]->hCoreCoder[0]->tcxonly; +#else + hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; +#endif +#ifdef FIX_387_ISM_MD_FEC + /* in inactive frames, send MD 1) in ISM_MD_INC_DIFF_CNT_MAX consecutive frames when MD significantly change, 2) at least every ISM_MD_FEC_DIFF frames */ + if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { - hIsmMeta[ch]->ism_metadata_flag = 1; - } - } + if ( ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_true_azimuth ) > ISM_MD_FEC_DIFF ) || + ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) +#ifdef FIX_435_ISM_MERGE_BUG + || ( fabsf( hIsmMeta[ch]->radius - hIsmMeta[ch]->last_true_radius ) > ISM_MD_RAD_FEC_DIFF ) +#endif + ) + { + hIsmMeta[ch]->ism_metadata_flag = 1; + hIsmMeta[ch]->ism_md_inc_diff_cnt = 0; + } + else if ( hIsmMeta[ch]->ism_md_inc_diff_cnt < ISM_MD_INC_DIFF_CNT_MAX ) + { + hIsmMeta[ch]->ism_metadata_flag = 1; - if ( hSCE[ch]->hCoreCoder[0]->tcxonly ) - { - /* at highest bitrates (with TCX core only) metadata are sent in every frame */ - hIsmMeta[ch]->ism_metadata_flag = 1; + if ( hIsmMeta[ch]->ism_md_inc_diff_cnt % 2 == 0 ) + { + hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; + } + else + { + hIsmMeta[ch]->position_angle.angle2_diff_cnt = ISM_FEC_MAX; + } + } + else if ( hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX ) + { + hIsmMeta[ch]->ism_metadata_flag = 1; + hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; + } + } +#endif +#ifdef FIX_435_ISM_MERGE_BUG } +#endif } } /*----------------------------------------------------------------* - * Rate importance of particular ISm streams + * Rate importance of particular ISM streams *----------------------------------------------------------------*/ rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); - /* relax the importance decision in "stereo" coding for noisy audio */ - if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) - { - float diff_F; - - if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) - { - for ( ch = 0; ch < num_obj; ch++ ) - { - diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; - - if ( hIsmMeta[ch]->ism_metadata_flag == 0 && diff_F < 25.0f ) - { - hIsmMeta[ch]->ism_metadata_flag = 1; - ism_imp[ch] = ISM_LOW_IMP; - } - } - } - } /*----------------------------------------------------------------* - * Write ISm common signaling + * Write ISM common signaling *----------------------------------------------------------------*/ /* write number of objects - unary coding */ - for ( ch = 1; ch < num_obj; ch++ ) + for ( ch = 1; ch < nchan_ism; ch++ ) { push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); } push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); - /* write ISm metadata flag (one per object) */ +#ifdef ISM_NON_DIEGETIC_PAN + for ( ch = 0; ch < nchan_ism; ch++ ) + { + ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; + non_diegetic_flag_global |= hIsmMeta[ch]->non_diegetic_flag; + } +#endif + + /* write extended metadata presence flag */ + if ( ism_total_brate >= ISM_EXTENDED_METADATA_BRATE ) + { + push_indice( hBstr, IND_ISM_EXTENDED_FLAG, ism_extended_metadata_flag, ISM_EXTENDED_METADATA_BITS ); + +#ifdef ISM_NON_DIEGETIC_PAN + /* Write global non-diegetic object flag */ + if ( ism_extended_metadata_flag ) + { + push_indice( hBstr, IND_ISM_EXTENDED_NDP_FLAG, non_diegetic_flag_global, ISM_EXTENDED_METADATA_BITS ); + } +#endif + } + + /* write ISM metadata flag (one per object) */ for ( ch = 0; ch < nchan_transport; ch++ ) { push_indice( hBstr, IND_ISM_METADATA_FLAG, ism_imp[ch], ISM_METADATA_FLAG_BITS ); } - for ( ch = 0; ch < num_obj; ch++ ) +#ifndef ISM_NON_DIEGETIC_PAN + for ( ch = 0; ch < nchan_ism; ch++ ) { ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; } - +#endif if ( ism_mode == ISM_MODE_DISC ) { /* write VAD flag */ @@ -307,7 +364,7 @@ ivas_error ivas_ism_metadata_enc( nb_bits_start = hBstr->nb_bits_tot; } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; if ( ism_mode == ISM_MODE_DISC ) @@ -318,249 +375,79 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag ) { /*----------------------------------------------------------------* - * Azimuth quantization and encoding + * Quantize and encode azimuth and elevation *----------------------------------------------------------------*/ - /* Azimuth quantization (quantize azimuth to the AZIMUTH_NBITS-bit index */ - if ( ism_mode == ISM_MODE_DISC ) - { - idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); - } - else if ( ism_mode == ISM_MODE_PARAM ) - { - idx_azimuth_abs = hParamIsm->azi_index[ch]; - } - idx_azimuth = idx_azimuth_abs; - - nbits_diff_azimuth = 0; - - flag_abs_azimuth[ch] = 0; /* differential coding by default */ - if ( hIsmMetaData->azimuth_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ - || hIsmMetaData->last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ - ) +#ifdef ISM_NON_DIEGETIC_PAN + if ( ism_extended_metadata_flag && non_diegetic_flag_global ) { - flag_abs_azimuth[ch] = 1; + /* Write non-diegetic flag for each object */ + push_indice( hBstr, IND_ISM_NDP_FLAG, hIsmMeta[ch]->non_diegetic_flag, ISM_METADATA_IS_NDP_BITS ); } - /* try differential coding */ - if ( flag_abs_azimuth[ch] == 0 ) + if ( hIsmMeta[ch]->non_diegetic_flag ) { - diff = idx_azimuth_abs - hIsmMetaData->last_azimuth_idx; - - /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - if ( abs( diff ) > ( ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - ISM_MAX_AZIMUTH_DIFF_IDX ) - { - if ( diff > 0 ) - { - diff -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; - } - else - { - diff += ( 1 << ISM_AZIMUTH_NBITS ) - 1; - } - } - - if ( diff == 0 ) + /* Map azimuth to panning range [-90:90] */ + if ( hIsmMetaData->azimuth > 90.0f ) { - idx_azimuth = 0; - nbits_diff_azimuth = 1; + hIsmMetaData->azimuth = 180.0f - hIsmMetaData->azimuth; } - else if ( ABSVAL( diff ) < ISM_MAX_AZIMUTH_DIFF_IDX ) /* when diff bits >= abs bits, prefer abs */ - { - idx_azimuth = 1 << 1; - nbits_diff_azimuth = 1; - - if ( diff < 0 ) - { - idx_azimuth += 1; /* negative sign */ - diff *= -1; - } - else - { - idx_azimuth += 0; /* positive sign */ - } - - idx_azimuth = idx_azimuth << diff; - nbits_diff_azimuth++; - /* unary coding of "diff */ - idx_azimuth += ( ( 1 << diff ) - 1 ); - nbits_diff_azimuth += diff; - - if ( nbits_diff_azimuth < ISM_AZIMUTH_NBITS - 1 ) - { - /* add stop bit - only for codewords shorter than ISM_AZIMUTH_NBITS */ - idx_azimuth = idx_azimuth << 1; - nbits_diff_azimuth++; - } - } - else + if ( hIsmMetaData->azimuth < -90.0f ) { - flag_abs_azimuth[ch] = 1; + hIsmMetaData->azimuth = -180.0f - hIsmMetaData->azimuth; } - } - - /* update counter */ - if ( flag_abs_azimuth[ch] == 0 ) - { - hIsmMetaData->azimuth_diff_cnt++; - hIsmMetaData->elevation_diff_cnt = min( hIsmMetaData->elevation_diff_cnt, ISM_FEC_MAX ); - } - else - { - hIsmMetaData->azimuth_diff_cnt = 0; - } - /* Write azimuth */ - push_indice( hBstr, IND_ISM_AZIMUTH_DIFF_FLAG, flag_abs_azimuth[ch], 1 ); - - if ( flag_abs_azimuth[ch] ) - { - push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, ISM_AZIMUTH_NBITS ); + idx_angle1_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, 0, &flag_abs_azimuth[ch], NULL ); } else { - push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nbits_diff_azimuth ); - } - - /*----------------------------------------------------------------* - * Elevation quantization and encoding - *----------------------------------------------------------------*/ - - /* Elevation quantization (quantize azimuth to the ELEVATION_NBITS-bit index */ - if ( ism_mode == ISM_MODE_DISC ) - { - idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); - } - else /* ISM_MODE_PARAM */ - { - idx_elevation_abs = hParamIsm->ele_index[ch]; - } - idx_elevation = idx_elevation_abs; - - nbits_diff_elevation = 0; - - flag_abs_elevation[ch] = 0; /* differential coding by default */ - if ( hIsmMetaData->elevation_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ - || hIsmMetaData->last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ - ) - { - flag_abs_elevation[ch] = 1; - } - - /* note: elevation is coded starting from the second frame only (it is meaningless in the init_frame) */ - if ( hSCE[0]->hCoreCoder[0]->ini_frame == 0 ) - { - flag_abs_elevation[ch] = 1; - hIsmMetaData->last_elevation_idx = idx_elevation_abs; - } - - diff = idx_elevation_abs - hIsmMetaData->last_elevation_idx; - - /* avoid absolute coding of elevation if absolute coding was already used for azimuth */ - if ( flag_abs_azimuth[ch] == 1 ) - { - int16_t diff_orig = diff; - - flag_abs_elevation[ch] = 0; - - - if ( diff >= 0 ) - { - diff = min( diff, ISM_MAX_ELEVATION_DIFF_IDX ); - } - else - { - diff = -1 * min( -diff, ISM_MAX_ELEVATION_DIFF_IDX ); - } - - if ( hIsmMetaData->last_ism_metadata_flag == 0 || abs( diff_orig - diff ) > ISM_MAX_ELEVATION_DIFF_IDX ) +#endif + if ( ism_mode == ISM_MODE_DISC ) { - hIsmMetaData->elevation_diff_cnt = ISM_FEC_MAX - 1; + idx_angle1_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + idx_angle2_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); } - } - - /* try differential coding */ - if ( flag_abs_elevation[ch] == 0 ) - { - if ( diff == 0 ) + else /* ISM_MODE_PARAM */ { - idx_elevation = 0; - nbits_diff_elevation = 1; + idx_angle1_abs = hParamIsm->azi_index[ch]; + idx_angle2_abs = hParamIsm->ele_index[ch]; } - else if ( ABSVAL( diff ) <= ISM_MAX_ELEVATION_DIFF_IDX ) - { - idx_elevation = 1 << 1; - nbits_diff_elevation = 1; - - if ( diff < 0 ) - { - idx_elevation += 1; /* negative sign */ - diff *= -1; - } - else - { - idx_elevation += 0; /* positive sign */ - } - idx_elevation = idx_elevation << diff; - nbits_diff_elevation++; + encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); - /* unary coding of "diff */ - idx_elevation += ( ( 1 << diff ) - 1 ); - nbits_diff_elevation += diff; + /*----------------------------------------------------------------* + * Quantize and encode radius, yaw, and pitch + *----------------------------------------------------------------*/ - if ( nbits_diff_elevation < ISM_ELEVATION_NBITS ) - { - /* add stop bit */ - idx_elevation = idx_elevation << 1; - nbits_diff_elevation++; - } - } - else + if ( ism_mode == ISM_MODE_DISC && ism_extended_metadata_flag ) { - flag_abs_elevation[ch] = 1; - } - } - - /* update counter */ - if ( flag_abs_elevation[ch] == 0 ) - { - hIsmMetaData->elevation_diff_cnt++; - hIsmMetaData->elevation_diff_cnt = min( hIsmMetaData->elevation_diff_cnt, ISM_FEC_MAX ); - } - else - { - hIsmMetaData->elevation_diff_cnt = 0; - } - - /* Write elevation */ - if ( flag_abs_azimuth[ch] == 0 ) /* do not write "flag_abs_elevation" if "flag_abs_azimuth == 1" */ - { - push_indice( hBstr, IND_ISM_ELEVATION_DIFF_FLAG, flag_abs_elevation[ch], 1 ); - } + idx_angle1_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + idx_angle2_abs = ism_quant_meta( hIsmMetaData->pitch, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); + idx_radius_abs = usquant( hIsmMetaData->radius, &valQ, ISM_RADIUS_MIN, ISM_RADIUS_DELTA, 1 << ISM_RADIUS_NBITS ); - if ( flag_abs_elevation[ch] ) - { - push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, ISM_ELEVATION_NBITS ); - } - else - { - push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nbits_diff_elevation ); + encode_angle_indices( hBstr, &( hIsmMetaData->orientation_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_yaw[ch], &flag_abs_pitch[ch] ); + encode_radius( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] ); + } +#ifdef ISM_NON_DIEGETIC_PAN } - - /*----------------------------------------------------------------* - * Updates - *----------------------------------------------------------------*/ - - hIsmMetaData->last_azimuth_idx = idx_azimuth_abs; - hIsmMetaData->last_elevation_idx = idx_elevation_abs; +#endif /* save number of metadata bits written */ if ( ism_mode == ISM_MODE_DISC ) { nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start; } + +#ifdef FIX_387_ISM_MD_FEC + /* Updates */ + hIsmMeta[ch]->last_true_azimuth = hIsmMeta[ch]->azimuth; + hIsmMeta[ch]->last_true_elevation = hIsmMeta[ch]->elevation; +#endif +#ifdef FIX_435_ISM_MERGE_BUG + hIsmMeta[ch]->last_true_radius = hIsmMeta[ch]->radius; +#endif } } @@ -570,12 +457,12 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ i = 0; - while ( i == 0 || i < num_obj / INTER_OBJECT_PARAM_CHECK ) + while ( i == 0 || i < nchan_ism / INTER_OBJECT_PARAM_CHECK ) { int16_t num, abs_num, abs_first, abs_next, pos_zero; - int16_t abs_matrice[INTER_OBJECT_PARAM_CHECK * 2]; + int16_t abs_matrice[INTER_OBJECT_PARAM_CHECK * ISM_NUM_PARAM]; - num = min( INTER_OBJECT_PARAM_CHECK, num_obj - i * INTER_OBJECT_PARAM_CHECK ); + num = min( INTER_OBJECT_PARAM_CHECK, nchan_ism - i * INTER_OBJECT_PARAM_CHECK ); i++; set_s( abs_matrice, 0, INTER_OBJECT_PARAM_CHECK * ISM_NUM_PARAM ); @@ -621,12 +508,12 @@ ivas_error ivas_ism_metadata_enc( if ( abs_next % ISM_NUM_PARAM == 0 ) { - hIsmMeta[ch]->azimuth_diff_cnt = abs_num - 1; + hIsmMeta[ch]->position_angle.angle1_diff_cnt = abs_num - 1; } if ( abs_next % ISM_NUM_PARAM == 1 ) { - hIsmMeta[ch]->elevation_diff_cnt = abs_num - 1; + hIsmMeta[ch]->position_angle.angle2_diff_cnt = abs_num - 1; /*hIsmMeta[ch]->elevation_diff_cnt = min( hIsmMeta[ch]->elevation_diff_cnt, ISM_FEC_MAX );*/ } @@ -689,18 +576,43 @@ ivas_error ivas_ism_metadata_enc( * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ - ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ); +#ifdef ISM_NON_DIEGETIC_PAN + if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_extended_metadata_flag, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; + +#ifdef FIX_387_ISM_MD_FEC + if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) + { + hIsmMeta[ch]->ism_md_fec_cnt_enc++; + } + else + { + hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; + } + hIsmMeta[ch]->ism_md_inc_diff_cnt++; + hIsmMeta[ch]->ism_md_inc_diff_cnt = min( hIsmMeta[ch]->ism_md_inc_diff_cnt, ISM_MD_INC_DIFF_CNT_MAX ); +#endif } for ( ch = 0; ch < nchan_transport; ch++ ) { +#ifdef FIX_419_ISM_BRATE_SW_DTX + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; +#endif if ( ism_mode == ISM_MODE_DISC ) { +#ifndef FIX_419_ISM_BRATE_SW_DTX hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; +#endif if ( hIsmMeta[ch]->ism_metadata_flag == 0 && localVAD[ch] == 0 && ism_metadata_flag_global ) { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; @@ -722,23 +634,25 @@ ivas_error ivas_ism_metadata_enc( return error; } + /*------------------------------------------------------------------------- - * create_ism_metadata_enc() + * ivas_ism_metadata_enc_create() * - * Create, allocate, initialize and configure IVAS encoder ISM handles + * Create, allocate, initialize and configure IVAS encoder ISM metadata handles *-------------------------------------------------------------------------*/ -ivas_error create_ism_metadata_enc( +ivas_error ivas_ism_metadata_enc_create( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t n_ISms, /* i : number of objects */ int32_t element_brate_tmp[] /* o : element bitrate per object */ ) { int16_t ch, nchan_transport; + ivas_error error; if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - nchan_transport = 2; + nchan_transport = MAX_PARAM_ISM_WAVE; } else { @@ -749,24 +663,554 @@ ivas_error create_ism_metadata_enc( st_ivas->nSCE = nchan_transport; st_ivas->nCPE = 0; - /* allocate ISm metadata handles */ + /* allocate ISM metadata handles */ for ( ch = 0; ch < n_ISms; ch++ ) { if ( ( st_ivas->hIsmMetaData[ch] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISm MetaData\n" ) ); + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM MetaData\n" ) ); } - - st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; - st_ivas->hIsmMetaData[ch]->azimuth_diff_cnt = ISM_FEC_MAX; - st_ivas->hIsmMetaData[ch]->last_elevation_idx = 0; - st_ivas->hIsmMetaData[ch]->elevation_diff_cnt = ISM_FEC_MAX - 1; + st_ivas->hIsmMetaData[ch]->position_angle.last_angle1_idx = 0; + st_ivas->hIsmMetaData[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; + st_ivas->hIsmMetaData[ch]->position_angle.last_angle2_idx = 0; + st_ivas->hIsmMetaData[ch]->position_angle.angle2_diff_cnt = ISM_FEC_MAX - 1; + st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle1_idx = 0; + st_ivas->hIsmMetaData[ch]->orientation_angle.angle1_diff_cnt = ISM_FEC_MAX - 2; + st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle2_idx = 0; + st_ivas->hIsmMetaData[ch]->orientation_angle.angle2_diff_cnt = ISM_FEC_MAX - 2; + st_ivas->hIsmMetaData[ch]->last_radius_idx = 0; + st_ivas->hIsmMetaData[ch]->radius_diff_cnt = ISM_FEC_MAX - 2; st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); + + st_ivas->hIsmMetaData[ch]->last_azimuth = 0.0f; + st_ivas->hIsmMetaData[ch]->last_elevation = 0.0f; + +#ifdef FIX_387_ISM_MD_FEC + st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0.0f; + st_ivas->hIsmMetaData[ch]->last_true_elevation = 0.0f; + st_ivas->hIsmMetaData[ch]->ism_md_fec_cnt_enc = 0; + st_ivas->hIsmMetaData[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX; +#endif +#ifdef FIX_435_ISM_MERGE_BUG + st_ivas->hIsmMetaData[ch]->last_true_radius = 1.0f; +#endif } - ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); +#ifdef ISM_NON_DIEGETIC_PAN + if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } return IVAS_ERR_OK; } + + +/*------------------------------------------------------------------------- + * encode_radius() + * + * Radius index encoding + *-------------------------------------------------------------------------*/ + +static void encode_radius( + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + int16_t *last_radius_idx, /* i/o: last radius index */ + int16_t *radius_diff_cnt, /* i/o: radius diff coding counter */ + const int16_t last_ism_metadata_flag, /* last frame ism_metadata_flag */ + const int16_t idx_radius_abs, /* i : Azimuth index */ + int16_t *flag_abs_radius /* o : Radius encoding mode */ +) +{ + int16_t idx_radius, nbits_diff_radius, diff; + + idx_radius = idx_radius_abs; + nbits_diff_radius = 0; + *flag_abs_radius = 0; /* differential coding by default */ + + if ( *radius_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + ) + { + *flag_abs_radius = 1; + } + + diff = idx_radius_abs - *last_radius_idx; + + /* try differential coding */ + if ( *flag_abs_radius == 0 ) + { + if ( diff == 0 ) + { + idx_radius = 0; + nbits_diff_radius = 1; + } + else if ( ABSVAL( diff ) <= ISM_MAX_RADIUS_DIFF_IDX ) + { + idx_radius = 1 << 1; + nbits_diff_radius = 1; + + if ( diff < 0 ) + { + idx_radius += 1; /* negative sign */ + diff *= -1; + } + else + { + idx_radius += 0; /* positive sign */ + } + + idx_radius = idx_radius << diff; + nbits_diff_radius++; + + /* unary coding of "diff */ + idx_radius += ( ( 1 << diff ) - 1 ); + nbits_diff_radius += diff; + + if ( nbits_diff_radius < ISM_RADIUS_NBITS ) + { + /* add stop bit */ + idx_radius = idx_radius << 1; + nbits_diff_radius++; + } + } + else + { + *flag_abs_radius = 1; + } + } + + /* update counter */ + if ( *flag_abs_radius == 0 ) + { + ( *radius_diff_cnt )++; + *radius_diff_cnt = min( *radius_diff_cnt, ISM_FEC_MAX ); + } + else + { + *radius_diff_cnt = 0; + } + + /* Write radius */ + push_indice( hBstr, IND_ISM_RADIUS_DIFF_FLAG, *flag_abs_radius, 1 ); + + if ( *flag_abs_radius ) + { + push_indice( hBstr, IND_ISM_RADIUS, idx_radius, ISM_RADIUS_NBITS ); + } + else + { + push_indice( hBstr, IND_ISM_RADIUS, idx_radius, nbits_diff_radius ); + } + + /* Updates */ + *last_radius_idx = idx_radius_abs; + + return; +} + + +/*----------------------------------------------------------------* + * encode_angle_indices() + * + * Encoding of an angle + *----------------------------------------------------------------*/ +static void encode_angle_indices( + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + ISM_METADATA_ANGLE_HANDLE angle, /* i/o: angle handle */ + const int16_t last_ism_metadata_flag, /* i : last frame ism_metadata_flag */ + const int16_t ini_frame, /* i : initialization frames counter */ + const int16_t idx_angle1_abs, /* i : Azimuth index */ + const int16_t idx_angle2_abs, /* i : Elevation index */ + int16_t *flag_abs_angle1, /* o : Azimuth/yaw encoding mode */ + int16_t *flag_abs_angle2 /* o : Elevation/pitch encoding mode */ +) +{ + int16_t idx_angle1, nbits_diff_angle1, diff; + int16_t idx_angle2, nbits_diff_angle2; + + /*----------------------------------------------------------------* + * Azimuth/yaw index encoding + *----------------------------------------------------------------*/ + + idx_angle1 = idx_angle1_abs; + + nbits_diff_angle1 = 0; + + *flag_abs_angle1 = 0; /* differential coding by default */ + if ( angle->angle1_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + ) + { + *flag_abs_angle1 = 1; + } + + /* try differential coding */ + if ( *flag_abs_angle1 == 0 ) + { + diff = idx_angle1_abs - angle->last_angle1_idx; + + /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ + if ( abs( diff ) > ( ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - ISM_MAX_AZIMUTH_DIFF_IDX ) + { + if ( diff > 0 ) + { + diff -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; + } + else + { + diff += ( 1 << ISM_AZIMUTH_NBITS ) - 1; + } + } + + if ( diff == 0 ) + { + idx_angle1 = 0; + nbits_diff_angle1 = 1; + } + else if ( ABSVAL( diff ) < ISM_MAX_AZIMUTH_DIFF_IDX ) /* when diff bits >= abs bits, prefer abs */ + { + idx_angle1 = 1 << 1; + nbits_diff_angle1 = 1; + + if ( diff < 0 ) + { + idx_angle1 += 1; /* negative sign */ + diff *= -1; + } + else + { + idx_angle1 += 0; /* positive sign */ + } + + idx_angle1 = idx_angle1 << diff; + nbits_diff_angle1++; + + /* unary coding of "diff */ + idx_angle1 += ( ( 1 << diff ) - 1 ); + nbits_diff_angle1 += diff; + + if ( nbits_diff_angle1 < ISM_AZIMUTH_NBITS - 1 ) + { + /* add stop bit - only for codewords shorter than ISM_AZIMUTH_NBITS */ + idx_angle1 = idx_angle1 << 1; + nbits_diff_angle1++; + } + } + else + { + *flag_abs_angle1 = 1; + } + } + + /* update counter */ + if ( *flag_abs_angle1 == 0 ) + { + angle->angle1_diff_cnt++; +#ifdef FIX_419_ISM_MD_FIX + angle->angle1_diff_cnt = min( angle->angle1_diff_cnt, ISM_FEC_MAX ); +#else + angle->angle2_diff_cnt = min( angle->angle2_diff_cnt, ISM_FEC_MAX ); +#endif + } + else + { + angle->angle1_diff_cnt = 0; + } + + /* Write azimuth/yaw */ + push_indice( hBstr, IND_ISM_AZIMUTH_DIFF_FLAG, *flag_abs_angle1, 1 ); + + if ( *flag_abs_angle1 ) + { + push_indice( hBstr, IND_ISM_AZIMUTH, idx_angle1, ISM_AZIMUTH_NBITS ); + } + else + { + push_indice( hBstr, IND_ISM_AZIMUTH, idx_angle1, nbits_diff_angle1 ); + } + + /*----------------------------------------------------------------* + * Elevation/pitch index encoding + *----------------------------------------------------------------*/ + +#ifdef ISM_NON_DIEGETIC_PAN + if ( flag_abs_angle2 ) + { +#endif + idx_angle2 = idx_angle2_abs; + nbits_diff_angle2 = 0; + *flag_abs_angle2 = 0; /* differential coding by default */ + if ( angle->angle2_diff_cnt == ISM_FEC_MAX /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + ) + { + *flag_abs_angle2 = 1; + } + + /* note: elevation/pitch is coded starting from the second frame only (it is meaningless in the init_frame) */ + if ( ini_frame == 0 ) + { + *flag_abs_angle2 = 1; + angle->last_angle2_idx = idx_angle2_abs; + } + + diff = idx_angle2_abs - angle->last_angle2_idx; + + /* avoid absolute coding of elevation/pitch if absolute coding was already used for azimuth/yaw */ + if ( *flag_abs_angle1 == 1 ) + { + int16_t diff_orig = diff; + + *flag_abs_angle2 = 0; + + + if ( diff >= 0 ) + { + diff = min( diff, ISM_MAX_ELEVATION_DIFF_IDX ); + } + else + { + diff = -1 * min( -diff, ISM_MAX_ELEVATION_DIFF_IDX ); + } + + if ( last_ism_metadata_flag == 0 || abs( diff_orig - diff ) > ISM_MAX_ELEVATION_DIFF_IDX ) + { + angle->angle2_diff_cnt = ISM_FEC_MAX - 1; + } + } + + /* try differential coding */ + if ( *flag_abs_angle2 == 0 ) + { + if ( diff == 0 ) + { + idx_angle2 = 0; + nbits_diff_angle2 = 1; + } + else if ( ABSVAL( diff ) <= ISM_MAX_ELEVATION_DIFF_IDX ) + { + idx_angle2 = 1 << 1; + nbits_diff_angle2 = 1; + + if ( diff < 0 ) + { + idx_angle2 += 1; /* negative sign */ + diff *= -1; + } + else + { + idx_angle2 += 0; /* positive sign */ + } + + idx_angle2 = idx_angle2 << diff; + nbits_diff_angle2++; + + /* unary coding of "diff */ + idx_angle2 += ( ( 1 << diff ) - 1 ); + nbits_diff_angle2 += diff; + + if ( nbits_diff_angle2 < ISM_ELEVATION_NBITS ) + { + /* add stop bit */ + idx_angle2 = idx_angle2 << 1; + nbits_diff_angle2++; + } + } + else + { + *flag_abs_angle2 = 1; + } + } + + /* update counter */ + if ( *flag_abs_angle2 == 0 ) + { + angle->angle2_diff_cnt++; + angle->angle2_diff_cnt = min( angle->angle2_diff_cnt, ISM_FEC_MAX ); + } + else + { + angle->angle2_diff_cnt = 0; + } + + /* Write elevation */ + if ( *flag_abs_angle1 == 0 ) /* do not write "flag_abs_elevation/pitch" if "flag_abs_azimuth/yaw == 1" */ + { + push_indice( hBstr, IND_ISM_ELEVATION_DIFF_FLAG, *flag_abs_angle2, 1 ); + } + + if ( *flag_abs_angle2 ) + { + push_indice( hBstr, IND_ISM_ELEVATION, idx_angle2, ISM_ELEVATION_NBITS ); + } + else + { + push_indice( hBstr, IND_ISM_ELEVATION, idx_angle2, nbits_diff_angle2 ); + } +#ifdef ISM_NON_DIEGETIC_PAN + } +#endif + + /*----------------------------------------------------------------* + * Updates + *----------------------------------------------------------------*/ + + angle->last_angle1_idx = idx_angle1_abs; + angle->last_angle2_idx = idx_angle2_abs; + + return; +} + + +/*-------------------------------------------------------------------* + * ivas_ism_metadata_sid_enc() + * + * Quantize and encode ISM metadata in SID frame + *-------------------------------------------------------------------*/ + +void ivas_ism_metadata_sid_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + const int16_t flag_noisy_speech, /* i : noisy speech flag */ + const int16_t nchan_ism, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t sid_flag, /* i : indication of SID frame */ + const int16_t md_diff_flag[], /* i : metadata differental flag */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +) +{ + int16_t i, ch, nBits, nBits_start, nBits_unused; + float q_step, q_step_border; + int16_t idx, idx_azimuth, idx_elevation; + int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; + float valQ; + ISM_METADATA_HANDLE hIsmMetaData; + + if ( sid_flag ) + { + nBits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + nBits -= SID_FORMAT_NBITS; + nBits_start = hBstr->nb_bits_tot; + + /*----------------------------------------------------------------* + * Write ISm common signaling + *----------------------------------------------------------------*/ + + /* write number of objects - unary coding */ + for ( ch = 1; ch < nchan_ism; ch++ ) + { + push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); + } + push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); + + /* write SID metadata flag (one per object) */ + for ( ch = 0; ch < nchan_ism; ch++ ) + { + push_indice( hBstr, IND_ISM_METADATA_FLAG, md_diff_flag[ch], 1 ); + } + + /*----------------------------------------------------------------* + * Set quantization bits based on the number of coded objects + *----------------------------------------------------------------*/ + + ivas_get_ism_sid_quan_bitbudget( nchan_ism, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); + + /*----------------------------------------------------------------* + * Spatial parameters, loop over TCs - 1 + *----------------------------------------------------------------*/ + + /* write ISM mode flag to explicitly signal number of spatial parameters */ + if ( nchan_ism > 2 ) + { + if ( ism_mode == ISM_MODE_DISC ) + { + push_indice( hBstr, IND_ISM_VAD_FLAG, 0, 1 ); + } + else + { + push_indice( hBstr, IND_ISM_VAD_FLAG, 1, 1 ); + } + + if ( ism_mode == ISM_MODE_PARAM ) + { + /* write noisy speech flag */ + push_indice( hBstr, IND_ISM_NOISY_SPEECH_FLAG, flag_noisy_speech, 1 ); + nBits_sce_id = 1; + } + } + + if ( nchan_transport > 1 ) + { + /* write sce id */ + push_indice( hBstr, IND_ISM_SCE_ID_DTX, hISMDTX->sce_id_dtx, nBits_sce_id ); + + /* quantize and write coherence */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + if ( ch == hISMDTX->sce_id_dtx ) + { + continue; + } + + idx = (int16_t) ( hISMDTX->coh[ch] * ( ( 1 << nBits_coh ) - 1 ) + 0.5f ); + assert( ( idx >= 0 ) && ( idx <= ( ( 1 << nBits_coh ) - 1 ) ) ); + push_indice( hBstr, IND_ISM_DTX_COH_SCA, idx, nBits_coh ); + } + } + + /*----------------------------------------------------------------* + * Metadata quantization and coding, loop over all objects + *----------------------------------------------------------------*/ + + for ( ch = 0; ch < nchan_ism; ch++ ) + { + if ( md_diff_flag[ch] == 1 ) + { + hIsmMetaData = hIsmMeta[ch]; + + idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); + idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); + + push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); + push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); + + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) + { + hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->position_angle.last_angle2_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + } + else + { + hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); + } + +#ifdef FIX_387_ISM_MD_FEC + hIsmMetaData->ism_md_fec_cnt_enc = 0; + hIsmMeta[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX; +#endif + } + } + + /* Write unused (padding) bits */ + nBits_unused = nBits - hBstr->nb_bits_tot; + while ( nBits_unused > 0 ) + { + i = min( nBits_unused, 16 ); + push_indice( hBstr, IND_UNUSED, 0, i ); + nBits_unused -= i; + } + + nb_bits_metadata[0] = hBstr->nb_bits_tot - nBits_start; + } + + return; +} diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 98054cf51ef6c8d0c0de66abfdd0662e9ca161e9..db7ab98b10ea552895204aece8dff4bc424e739d 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -47,16 +47,22 @@ static void ivas_param_ism_compute_obj_parameters( + const int16_t nchan_ism, /* i : number of ISM channels */ float reference_power_obj[MAX_NUM_OBJECTS][PARAM_ISM_MDFT_NO_SLOTS][DIRAC_NO_FB_BANDS_MAX], /* i : Reference power */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: Param ISM Enc Handle */ ) { - int16_t i, b, m, br, mr, num_obj; + int16_t i, b, m, br, mr; int16_t brange_start, brange_end, mrange_start, mrange_end, time_merge_fac; float power_ratios_m[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS]; +#ifdef FIX_440_PARAM_ISM_DIR_NOISE + float ref_power_local_frame[MAX_NUM_OBJECTS]; + float tmp_ratio; - num_obj = hParamIsm->num_obj; - assert( num_obj == 3 || num_obj == 4 ); + set_f( ref_power_local_frame, 0, MAX_NUM_OBJECTS ); +#endif + + assert( nchan_ism == 3 || nchan_ism == 4 ); for ( b = 0; b < hParamIsm->nbands; b++ ) { @@ -81,7 +87,7 @@ static void ivas_param_ism_compute_obj_parameters( /* for each object, sum up reference power within current T/F tile */ - for ( i = 0; i < num_obj; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { for ( mr = mrange_start; mr < mrange_end; mr++ ) { @@ -90,6 +96,10 @@ static void ivas_param_ism_compute_obj_parameters( ref_power_local[i] += reference_power_obj[i][mr][br]; } } +#ifdef FIX_440_PARAM_ISM_DIR_NOISE + /* Sum up T/F tiles per object */ + ref_power_local_frame[i] += ref_power_local[i]; +#endif } /* find two dominant objects and derive object indices for current T/F tile */ @@ -103,7 +113,8 @@ static void ivas_param_ism_compute_obj_parameters( index_1 = 1; index_2 = 0; } - for ( i = 2; i < num_obj; i++ ) + + for ( i = MAX_PARAM_ISM_WAVE; i < nchan_ism; i++ ) { if ( ref_power_local[i] > ref_power_local[index_1] ) { @@ -144,28 +155,50 @@ static void ivas_param_ism_compute_obj_parameters( } } +#ifdef FIX_440_PARAM_ISM_DIR_NOISE + /* Check if objects have roughly equal power by comparing reference power of first object against all others*/ + hParamIsm->flag_equal_energy = 1; + for ( i = 1; i < nchan_ism; i++ ) + { + if ( ref_power_local_frame[i] != 0.0f ) + { + tmp_ratio = ref_power_local_frame[0] / ref_power_local_frame[i]; + + if ( ( tmp_ratio > 0.975f ) && ( tmp_ratio < 1.025f ) ) + { + hParamIsm->flag_equal_energy &= 1; + } + else + { + hParamIsm->flag_equal_energy &= 0; + break; + } + } + } +#endif + return; } static void ivas_param_ism_enc_quantize_DOA( + const int16_t nchan_ism, /* i : number of ISM channels */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: Param ISM encoder handle */ ) { - int16_t i, azi_idx, ele_idx, num_obj; + int16_t i, azi_idx, ele_idx; float valQ; - num_obj = hParamIsm->num_obj; /* Loop over objects */ - for ( i = 0; i < num_obj; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { /* Quantize the elevation and obtain quantized elevation value and index */ - ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); /* Obtain the index of quantized azimuth values */ - azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); + azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); /*Replace azimuth with quantized values */ hIsmMetaData[i]->azimuth = valQ; @@ -191,7 +224,7 @@ void ivas_param_ism_stereo_dmx( const int16_t input_frame /* i : Length of input frame */ ) { - int16_t i, j, num_obj; + int16_t i, j; float alpha, azi_shift, tmp, tmp_1; float cardioid_left[MAX_NUM_OBJECTS], cardioid_right[MAX_NUM_OBJECTS]; float stereo_dmx[2][L_FRAME48k]; @@ -202,14 +235,13 @@ void ivas_param_ism_stereo_dmx( /*Initialization*/ alpha = 0.5; azi_shift = 0; - num_obj = st_ivas->hDirAC->hParamIsm->num_obj; /* Set the stereo dmx to zero */ set_zero( stereo_dmx[0], L_FRAME48k ); set_zero( stereo_dmx[1], L_FRAME48k ); /* Loop over all objects */ - for ( i = 0; i < num_obj; i++ ) + for ( i = 0; i < st_ivas->hEncoderConfig->nchan_ism; i++ ) { hIsmMetaData = st_ivas->hIsmMetaData[i]; @@ -271,24 +303,25 @@ ivas_error ivas_param_ism_enc_open( input_Fs = st_ivas->hEncoderConfig->input_Fs; - /* Assign the number of objects */ - hDirAC->hParamIsm->num_obj = st_ivas->hEncoderConfig->nchan_inp; /* set FB config. */ - if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, SBA_MODE_NONE, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, SBA_MODE_NONE, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs +#ifdef HODIRAC + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } /* Allocate and initialize FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) { return error; } - - ivas_param_ism_config( hDirAC->hParamIsm ); - + ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->hEncoderConfig->nchan_inp ); /* Assign memories for Band and Block grouping */ hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -314,23 +347,29 @@ ivas_error ivas_param_ism_enc_open( /*-------------------------------------------------------------------------* * ivas_param_ism_enc_close() * - * Close Param ISM handle + * Close Param ISM encoder handle *-------------------------------------------------------------------------*/ void ivas_param_ism_enc_close( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - const int32_t input_Fs /* i : input sampling_rate */ + DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ + const int32_t input_Fs /* i : input sampling_rate */ ) { - ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs ); + if ( hDirAC == NULL || *hDirAC == NULL ) + { + return; + } - if ( hDirAC->hParamIsm != NULL ) + ivas_FB_mixer_close( &( *hDirAC )->hFbMixer, input_Fs, 0 ); + + if ( ( *hDirAC )->hParamIsm != NULL ) { - free( hDirAC->hParamIsm ); - hDirAC->hParamIsm = NULL; + free( ( *hDirAC )->hParamIsm ); + ( *hDirAC )->hParamIsm = NULL; } - free( hDirAC ); + free( ( *hDirAC ) ); + ( *hDirAC ) = NULL; return; } @@ -349,6 +388,7 @@ void ivas_param_ism_enc( ) { int16_t i, j, ts, l_ts; + int16_t nchan_ism; int16_t num_time_slots; float *pcm_in[MAX_NUM_OBJECTS]; float fb_RealBuffer[MAX_NUM_OBJECTS][DIRAC_NO_FB_BANDS_MAX]; @@ -359,6 +399,7 @@ void ivas_param_ism_enc( DIRAC_ENC_HANDLE hDirAC; PARAM_ISM_CONFIG_HANDLE hParamIsm; + nchan_ism = st_ivas->hEncoderConfig->nchan_ism; hDirAC = st_ivas->hDirAC; hParamIsm = hDirAC->hParamIsm; @@ -367,7 +408,7 @@ void ivas_param_ism_enc( l_ts = input_frame / PARAM_ISM_MDFT_NO_SLOTS; num_time_slots = PARAM_ISM_MDFT_NO_SLOTS; - for ( i = 0; i < hParamIsm->num_obj; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { pcm_in[i] = &data[i][0]; @@ -376,12 +417,24 @@ void ivas_param_ism_enc( p_fb_RealBuffer[i] = &fb_RealBuffer[i][0]; p_fb_ImagBuffer[i] = &fb_ImagBuffer[i][0]; } + for ( ts = 0; ts < num_time_slots; ts++ ) { - ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_fb_RealBuffer, p_fb_ImagBuffer, l_ts, l_ts ); - ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts ); + ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_fb_RealBuffer, p_fb_ImagBuffer, l_ts, l_ts +#ifdef HODIRAC + , + hDirAC->hFbMixer->fb_cfg->num_in_chans +#endif + ); + + ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts +#ifdef HODIRAC + , + hDirAC->hFbMixer->fb_cfg->num_in_chans +#endif + ); - for ( i = 0; i < hParamIsm->num_obj; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { pcm_in[i] += l_ts; for ( j = 0; j < DIRAC_NO_FB_BANDS_MAX; j++ ) @@ -390,80 +443,103 @@ void ivas_param_ism_enc( } } } + /* Quantize DOAs */ - ivas_param_ism_enc_quantize_DOA( st_ivas->hIsmMetaData, hParamIsm ); + ivas_param_ism_enc_quantize_DOA( nchan_ism, st_ivas->hIsmMetaData, hParamIsm ); /* Compute object indices and power ratios */ - ivas_param_ism_compute_obj_parameters( reference_power_obj, hParamIsm ); + ivas_param_ism_compute_obj_parameters( nchan_ism, reference_power_obj, hParamIsm ); pop_wmops(); return; } -/*------------------------------------------------------------------------- - * ivas_ism_enc_config() + +/*-------------------------------------------------------------------* + * ivas_param_ism_compute_noisy_speech_flag() * - * - select ISM format mode - * - reconfigure the ISM format encoder - *-------------------------------------------------------------------------*/ + * + *-------------------------------------------------------------------*/ -/*! r : ISM format mode */ -ivas_error ivas_ism_enc_config( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +void ivas_param_ism_compute_noisy_speech_flag( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) { - ivas_error error; - ISM_MODE last_ism_mode; - int16_t nchan_transport_old; - int16_t nSCE_old, nCPE_old; - - error = IVAS_ERR_OK; - last_ism_mode = st_ivas->ism_mode; - - /* select ISM format mode */ - st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->hEncoderConfig->nchan_inp, st_ivas->hEncoderConfig->ivas_total_brate ); + int16_t i; - /* ISM bit-rate switching */ - if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hEncoderConfig->ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) ) + /* Move the Noisy speech buffer */ + for ( i = 0; i < ( PARAM_ISM_HYS_BUF_SIZE - 1 ); i++ ) { - int32_t element_brate_tmp[MAX_NUM_OBJECTS]; - - nchan_transport_old = st_ivas->nchan_transport; + st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i + 1]; + } - /* Reset and Initialize */ - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) +#ifndef FIX_440_PARAM_ISM_DIR_NOISE + /* For the current frame, make a decision based on some core-coder flags */ + if ( st_ivas->hSCE[0]->hCoreCoder[0]->flag_noisy_speech_snr && st_ivas->hSCE[1]->hCoreCoder[0]->flag_noisy_speech_snr ) + { +#ifdef FIX_422 + if ( st_ivas->hSCE[0]->hCoreCoder[0]->vad_flag || st_ivas->hSCE[1]->hCoreCoder[0]->vad_flag ) +#else + if ( st_ivas->hSCE[0]->hCoreCoder[0]->vad_flag && st_ivas->hSCE[1]->hCoreCoder[0]->vad_flag ) +#endif { - st_ivas->nchan_transport = 2; + st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 0; } else { - st_ivas->nchan_transport = st_ivas->hEncoderConfig->nchan_inp; + st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 1; } + } + else + { - nCPE_old = st_ivas->nCPE; - nSCE_old = st_ivas->nSCE; - st_ivas->nSCE = st_ivas->nchan_transport; - st_ivas->nCPE = 0; - - ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); - ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); + st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 0; + } - if ( st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC ) + /* Do a decision based on hysterisis */ + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = 1; + for ( i = 0; i < PARAM_ISM_HYS_BUF_SIZE; i++ ) + { + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech && st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i]; + } +#else + /* Set flag_noisy_speech to 0 for cases where object energies are not roughly equal */ + if ( !st_ivas->hDirAC->hParamIsm->flag_equal_energy ) + { + st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 0; + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = 0; + } + else + { + /* For the current frame, make a decision based on some core-coder flags */ + if ( st_ivas->hSCE[0]->hCoreCoder[0]->flag_noisy_speech_snr && st_ivas->hSCE[1]->hCoreCoder[0]->flag_noisy_speech_snr ) { - /* Allocate and Initialize the memory used by ParamISM when switch from Discrete ISM */ - if ( ( error = ivas_param_ism_enc_open( st_ivas ) ) != IVAS_ERR_OK ) +#ifdef FIX_422 + if ( st_ivas->hSCE[0]->hCoreCoder[0]->vad_flag || st_ivas->hSCE[1]->hCoreCoder[0]->vad_flag ) +#else + if ( st_ivas->hSCE[0]->hCoreCoder[0]->vad_flag && st_ivas->hSCE[1]->hCoreCoder[0]->vad_flag ) +#endif + { + st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 0; + } + else { - return error; + st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 1; } } + else + { + st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i] = 0; + } - if ( st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM ) + /* Do a decision based on hysteresis */ + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = 1; + for ( i = 0; i < PARAM_ISM_HYS_BUF_SIZE; i++ ) { - /* Deallocate the memory used by ParamISM when switch to Discrete ISM */ - ivas_param_ism_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hDirAC = NULL; + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech && st_ivas->hDirAC->hParamIsm->noisy_speech_buffer[i]; } } +#endif - return error; + return; } diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index fc16c279ee62d40309caec961f91836c0ef5a5de..a14424774ffec7ed5270d26f8d46926c9568e53e 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -460,21 +460,27 @@ ivas_error ivas_create_lfe_enc( *-------------------------------------------------------------------------*/ void ivas_lfe_enc_close( - LFE_ENC_HANDLE hLFE /* i/o: LFE encoder handle */ + LFE_ENC_HANDLE *hLFE /* i/o: LFE encoder handle */ ) { - if ( hLFE->old_wtda_audio != NULL ) + if ( hLFE == NULL || *hLFE == NULL ) { - free( hLFE->old_wtda_audio ); - hLFE->old_wtda_audio = NULL; + return; } - if ( hLFE->pWindow_state ) + + if ( ( *hLFE )->old_wtda_audio != NULL ) + { + free( ( *hLFE )->old_wtda_audio ); + ( *hLFE )->old_wtda_audio = NULL; + } + if ( ( *hLFE )->pWindow_state ) { - free( hLFE->pWindow_state ); - hLFE->pWindow_state = NULL; + free( ( *hLFE )->pWindow_state ); + ( *hLFE )->pWindow_state = NULL; } - free( hLFE ); + free( ( *hLFE ) ); + ( *hLFE ) = NULL; return; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index f358a8ba2e7d53c02e759d592b2e324e03c48a63..8938a415ffc78f67051b53df1343d1373540b4a5 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -31,8 +31,8 @@ *******************************************************************************************************/ #include -#include "options.h" #include +#include "options.h" #include "ivas_cnst.h" #include "ivas_prot.h" #include "ivas_rom_com.h" @@ -40,6 +40,7 @@ #include "wmc_auto.h" #include "prot.h" + /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ @@ -50,9 +51,9 @@ static void combine_directions( MASA_ENCODER_HANDLE hMasa ); static void find_n_largest( const float *input, int16_t *largestIndices, const int16_t numElements, const int16_t numLargest ); -static void move_metadata_to_qmetadata( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ); +static void move_metadata_to_qmetadata( const MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ); -static void detect_metadata_composition( MASA_ENCODER_HANDLE hMasa, uint8_t *joinedSubframes, uint8_t *coherencePresent, uint8_t *isTwoDir ); +static void detect_metadata_composition( const MASA_ENCODER_HANDLE hMasa, uint8_t *joinedSubframes, uint8_t *coherencePresent, uint8_t *isTwoDir ); static void compensate_energy_ratios( MASA_ENCODER_HANDLE hMasa ); @@ -60,6 +61,24 @@ static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); +static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] +#ifdef HR_METADATA + , + SPHERICAL_GRID_DATA *sphGrid +#endif +); + +static void copy_masa_metadata_subframe( const MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); + +static void copy_masa_metadata( const MASA_METADATA_HANDLE hMetaFrom, MASA_METADATA_HANDLE hMetaTo ); + +static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, const uint8_t sf1_idx, const MASA_METADATA_HANDLE frame2, const uint8_t sf2_idx ); + +static void detect_framing_async( MASA_ENCODER_HANDLE hMasa ); + +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT +static void masa_metadata_direction_alignment( MASA_ENCODER_HANDLE hMasa ); +#endif /*-----------------------------------------------------------------------* * Local constants @@ -119,14 +138,6 @@ ivas_error ivas_masa_enc_open( mvs2s( DirAC_block_grouping, hMasa->config.block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); mvs2s( MASA_band_grouping_24, hMasa->config.band_grouping, MASA_FREQUENCY_BANDS + 1 ); - if ( hEncoderConfig->ivas_format == MASA_FORMAT ) - { - for ( i = 0; i < st_ivas->nchan_transport; i++ ) - { - hMasa->data.delay_buffer[i] = (float *) malloc( MASA_ENC_DELAY_SLOTS * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); - set_f( hMasa->data.delay_buffer[i], 0.0f, MASA_ENC_DELAY_SLOTS * CLDFB_NO_CHANNELS_MAX ); - } - } hMasa->data.onset_detector_1 = 0.0f; hMasa->data.onset_detector_2 = 0.0f; @@ -134,6 +145,18 @@ ivas_error ivas_masa_enc_open( set_zero( hMasa->data.lfeToTotalEnergyRatio, MAX_PARAM_SPATIAL_SUBFRAMES ); hMasa->data.prevq_lfeToTotalEnergyRatio = 0.0f; hMasa->data.prevq_lfeIndex = 0; + + hMasa->data.sync_state.prev_sim_stop = 0; + hMasa->data.sync_state.prev_offset = 0; + hMasa->data.sync_state.frame_mode = MASA_FRAME_4SF; + +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT + set_zero( hMasa->data.dir_align_state.previous_azi_dir1, MASA_FREQUENCY_BANDS ); + set_zero( hMasa->data.dir_align_state.previous_ele_dir1, MASA_FREQUENCY_BANDS ); + set_zero( hMasa->data.dir_align_state.previous_azi_dir2, MASA_FREQUENCY_BANDS ); + set_zero( hMasa->data.dir_align_state.previous_ele_dir2, MASA_FREQUENCY_BANDS ); +#endif + st_ivas->hMasa = hMasa; return error; @@ -147,28 +170,24 @@ ivas_error ivas_masa_enc_open( *-----------------------------------------------------------------------*/ void ivas_masa_enc_close( - MASA_ENCODER_HANDLE hMasa, /* i/o: MASA metadata structure */ - const int16_t nchan_transport, /* i : Number of transport channels */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ + MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */ ) { int16_t i; - for ( i = 0; i < hMasa->data.num_Cldfb_instances; i++ ) + if ( hMasa == NULL || *hMasa == NULL ) { - deleteCldfb( &( hMasa->data.cldfbAnaEnc[i] ) ); + return; } - if ( ivas_format == MASA_FORMAT ) + for ( i = 0; i < ( *hMasa )->data.num_Cldfb_instances; i++ ) { - for ( i = 0; i < nchan_transport; i++ ) - { - free( hMasa->data.delay_buffer[i] ); - hMasa->data.delay_buffer[i] = NULL; - } + deleteCldfb( &( ( *hMasa )->data.cldfbAnaEnc[i] ) ); } - free( hMasa ); + + free( ( *hMasa ) ); + ( *hMasa ) = NULL; return; } @@ -180,7 +199,7 @@ void ivas_masa_enc_close( * main MASA encoder function *-----------------------------------------------------------------------*/ -void ivas_masa_encode( +ivas_error ivas_masa_encode( MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder structure */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ @@ -219,7 +238,11 @@ void ivas_masa_encode( if ( Opt_DTX_ON ) { - h_orig_metadata = (MASA_DIRECTIONAL_SPATIAL_META *) malloc( MASA_MAXIMUM_DIRECTIONS * sizeof( MASA_DIRECTIONAL_SPATIAL_META ) ); + if ( ( h_orig_metadata = (MASA_DIRECTIONAL_SPATIAL_META *) malloc( MASA_MAXIMUM_DIRECTIONS * sizeof( MASA_DIRECTIONAL_SPATIAL_META ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA encoder\n" ) ); + } + for ( i = 0; i < MASA_MAXIMUM_DIRECTIONS; i++ ) { for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) @@ -227,10 +250,18 @@ void ivas_masa_encode( mvr2r( hMasa->masaMetadata.directional_meta[i].azimuth[j], h_orig_metadata[i].azimuth[j], MASA_FREQUENCY_BANDS ); mvr2r( hMasa->masaMetadata.directional_meta[i].elevation[j], h_orig_metadata[i].elevation[j], MASA_FREQUENCY_BANDS ); mvr2r( hMasa->masaMetadata.directional_meta[i].energy_ratio[j], h_orig_metadata[i].energy_ratio[j], MASA_FREQUENCY_BANDS ); +#ifdef HR_METADATA + mvs2s( (int16_t *) ( hMasa->masaMetadata.directional_meta[i].spherical_index[j] ), (int16_t *) ( h_orig_metadata[i].spherical_index[j] ), MASA_FREQUENCY_BANDS ); +#endif } } } - +#ifdef HR_METADATA + if ( ivas_format == MASA_FORMAT && ivas_total_brate >= IVAS_384k ) + { + hMasa->config.mergeRatiosOverSubframes = 0; + } +#endif /* Combine frequency bands and sub-frames */ combine_freqbands_and_subframes( hMasa ); } @@ -294,7 +325,31 @@ void ivas_masa_encode( } /* Encode metadata */ - ivas_qmetadata_enc_encode( hMetaData, hQMetaData ); +#ifdef HR_METADATA + if ( ivas_total_brate >= IVAS_384k ) + { + if ( ivas_total_brate >= IVAS_512k ) + { + ivas_qmetadata_enc_encode_hr_384_512( hMetaData, hQMetaData, 16, 4 ); + } + else + { + ivas_qmetadata_enc_encode_hr_384_512( hMetaData, hQMetaData, 11, 3 ); + } + } + else + { +#endif + ivas_qmetadata_enc_encode( hMetaData, hQMetaData +#ifdef HODIRAC + , + 0 +#endif + ); +#ifdef HR_METADATA + } +#endif + *nb_bits_metadata = hMetaData->nb_bits_tot; @@ -361,7 +416,7 @@ void ivas_masa_encode( hQMetaData->no_directions = numberOfDirectionsQMetaData; } - return; + return IVAS_ERR_OK; } @@ -397,19 +452,9 @@ void ivas_masa_estimate_energy( for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { - if ( ts < MASA_ENC_DELAY_SLOTS ) - { - for ( i = 0; i < nchan_transport; i++ ) - { - cldfbAnalysis_ts( &( hMasa->data.delay_buffer[i][l_ts * ts] ), Input_RealBuffer[i], Input_ImagBuffer[i], l_ts, hMasa->data.cldfbAnaEnc[i] ); - } - } - else + for ( i = 0; i < nchan_transport; i++ ) { - for ( i = 0; i < nchan_transport; i++ ) - { - cldfbAnalysis_ts( &( data_f[i][l_ts * ( ts - MASA_ENC_DELAY_SLOTS )] ), Input_RealBuffer[i], Input_ImagBuffer[i], l_ts, hMasa->data.cldfbAnaEnc[i] ); - } + cldfbAnalysis_ts( &( data_f[i][l_ts * ts] ), Input_RealBuffer[i], Input_ImagBuffer[i], l_ts, hMasa->data.cldfbAnaEnc[i] ); } for ( band_m_idx = 0; band_m_idx < MASA_FREQUENCY_BANDS; band_m_idx++ ) @@ -438,10 +483,6 @@ void ivas_masa_estimate_energy( } } - for ( i = 0; i < nchan_transport; i++ ) - { - mvr2r( &data_f[i][input_frame - MASA_ENC_DELAY_SLOTS * maxBin], &( hMasa->data.delay_buffer[i][0] ), MASA_ENC_DELAY_SLOTS * maxBin ); - } return; } @@ -466,6 +507,9 @@ ivas_error ivas_masa_enc_config( uint8_t isActualTwoDir; /* Flag to tell that when there are two directions present in metadata, they both contain meaningful information. */ int32_t ivas_total_brate; ivas_error error; +#ifdef HR_METADATA + SPHERICAL_GRID_DATA *sphGrid; +#endif error = IVAS_ERR_OK; @@ -480,6 +524,37 @@ ivas_error ivas_masa_enc_config( if ( ivas_format == MASA_FORMAT ) { +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT + masa_metadata_direction_alignment( hMasa ); +#endif + + detect_framing_async( hMasa ); /* detect the offset, set 1sf/4sf mode based on this. potentially also shift the metadata using a history buffer */ + + if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) + { +#ifdef HR_METADATA + if ( ( sphGrid = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA spherical grid\n" ) ); + } + if ( ivas_total_brate == IVAS_512k ) + { + generate_gridEq( sphGrid ); + } + else + { + sphGrid->no_theta = 0; + } +#endif + /* average over sub-frames */ + average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy +#ifdef HR_METADATA + , + sphGrid +#endif + ); + } + /* Inspect metadata for parameter changes that affect coding. */ detect_metadata_composition( hMasa, &joinedSubframes, &coherencePresent, &isActualTwoDir ); hMasa->config.joinedSubframes = joinedSubframes; @@ -488,7 +563,7 @@ ivas_error ivas_masa_enc_config( } else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) { - /* For mcMASA, these are set only once as this function is called only once. */ + /* For McMASA, these are set only once as this function is called only once. */ hMasa->config.joinedSubframes = 0; hMasa->config.numberOfDirections = 1; } @@ -569,7 +644,7 @@ ivas_error ivas_masa_enc_config( ivas_set_qmetadata_maxbit_req( hQMetaData, ivas_format ); - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs ); + masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs, NULL ); /* Transmit stereo signals using a mono downmix at lowest bitrates */ if ( ivas_format == MASA_FORMAT && st_ivas->nCPE == 1 && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) @@ -679,9 +754,10 @@ static void combine_freqbands_and_subframes( if ( numCodingBands < MASA_FREQUENCY_BANDS ) { + /* reduce metadata *frequency* resolution. time resolution is not touched */ for ( i = 0; i < numDirections; i++ ) { - for ( j = 0; j < numSf; j++ ) + for ( j = 0; j < numSf; j++ ) /* NB: for numSf==1, operates only on first sub-frame */ { for ( k = 0; k < MASA_FREQUENCY_BANDS; k++ ) { @@ -755,7 +831,7 @@ static void combine_freqbands_and_subframes( } } } - else if ( mergeRatiosOverSubframes ) + else if ( mergeRatiosOverSubframes ) /* keep frequency resolution */ { for ( j = 0; j < numSf; j++ ) { @@ -983,7 +1059,7 @@ static void find_n_largest( static void move_metadata_to_qmetadata( - MASA_ENCODER_HANDLE hMasa, + const MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hQMeta ) { int16_t dir, sf, band; @@ -1006,6 +1082,9 @@ static void move_metadata_to_qmetadata( hQMeta->q_direction[dir].band_data[band].azimuth[sf] = hMeta->directional_meta[dir].azimuth[sf][band]; hQMeta->q_direction[dir].band_data[band].elevation[sf] = hMeta->directional_meta[dir].elevation[sf][band]; hQMeta->q_direction[dir].band_data[band].energy_ratio[sf] = hMeta->directional_meta[dir].energy_ratio[sf][band]; +#ifdef HR_METADATA + hQMeta->q_direction[dir].band_data[band].spherical_index[sf] = hMeta->directional_meta[dir].spherical_index[sf][band]; +#endif if ( hQMeta->q_direction[dir].coherence_band_data != NULL ) { hQMeta->q_direction[dir].coherence_band_data[band].spread_coherence[sf] = (uint8_t) roundf( hMeta->directional_meta[dir].spread_coherence[sf][band] * UINT8_MAX ); @@ -1055,18 +1134,19 @@ static void move_metadata_to_qmetadata( /* This function studies parametric MASA metadata to provide information for codec configuration */ static void detect_metadata_composition( - MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder data */ - uint8_t *joinedSubframes, /* o : Result of subframe composition */ - uint8_t *coherencePresent, /* o : Result of coherence presence */ - uint8_t *isTwoDir /* o : Result of two direction check */ + const MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder data */ + uint8_t *joinedSubframes, /* o : Result of subframe composition */ + uint8_t *coherencePresent, /* o : Result of coherence presence */ + uint8_t *isTwoDir /* o : Result of two direction check */ ) { MASA_METADATA_FRAME *hMeta; - int16_t sf, band, dir, numDir; + int8_t sf, band, dir, numDir; int16_t nSubFrames; uint8_t dirValid[2] = { FALSE }; uint8_t cohPresent = FALSE; uint8_t sfDiffer = FALSE; + uint8_t sfSimilar; hMeta = &( hMasa->masaMetadata ); numDir = hMeta->descriptive_meta.numberOfDirections + 1; @@ -1131,52 +1211,14 @@ static void detect_metadata_composition( } /* Check if data over subframes is identical. Check is done by comparing to first subframe. */ - dir = 0; - while ( sfDiffer == FALSE && dir < numDir ) + sfSimilar = TRUE; + sf = 1; + while ( ( sfSimilar == TRUE ) && ( sf < MAX_PARAM_SPATIAL_SUBFRAMES ) ) { - sf = 1; - while ( sfDiffer == FALSE && sf < MAX_PARAM_SPATIAL_SUBFRAMES ) - { - band = 0; - while ( sfDiffer == FALSE && band < MASA_FREQUENCY_BANDS ) - { - float aziDif; - aziDif = fabsf( hMeta->directional_meta[dir].azimuth[sf][band] - hMeta->directional_meta[dir].azimuth[0][band] ); - aziDif = aziDif > 180.0f ? aziDif - 360.0f : aziDif; - if ( aziDif > MASA_ANGLE_TOLERANCE ) - { - sfDiffer = TRUE; - break; - } - - if ( fabsf( hMeta->directional_meta[dir].elevation[sf][band] - hMeta->directional_meta[dir].elevation[0][band] ) > MASA_ANGLE_TOLERANCE ) - { - sfDiffer = TRUE; - break; - } - - if ( fabsf( hMeta->directional_meta[dir].energy_ratio[sf][band] - hMeta->directional_meta[dir].energy_ratio[0][band] ) > MASA_RATIO_TOLERANCE ) - { - sfDiffer = TRUE; - break; - } - - if ( fabsf( hMeta->directional_meta[dir].spread_coherence[sf][band] - hMeta->directional_meta[dir].spread_coherence[0][band] ) > MASA_COHERENCE_TOLERANCE ) - { - sfDiffer = TRUE; - break; - } - - if ( dir == 0 && fabsf( hMeta->common_meta.surround_coherence[sf][band] - hMeta->common_meta.surround_coherence[0][band] ) > MASA_COHERENCE_TOLERANCE ) - { - sfDiffer = TRUE; - } - band++; - } - sf++; - } - dir++; + sfSimilar = are_masa_subframes_similar( hMeta, 0, hMeta, sf ); + sf++; } + sfDiffer = sfSimilar == TRUE ? FALSE : TRUE; /* Further checks can be done with just one subframe if they are identical */ nSubFrames = sfDiffer == TRUE ? MAX_PARAM_SPATIAL_SUBFRAMES : 1; @@ -1678,6 +1720,7 @@ void ivas_masa_enc_reconfigure( int16_t n, tmp; int16_t sce_id, cpe_id; int32_t ivas_total_brate; + ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; if ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) @@ -1719,3 +1762,578 @@ void ivas_masa_enc_reconfigure( return; } + + +/*-------------------------------------------------------------------* + * average_masa_metadata() + * + * Average MASA metadata frame subframe contents: applies aggregation over time + *-------------------------------------------------------------------*/ + +static void average_masa_metadata( + MASA_METADATA_FRAME *hMeta, + float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] +#ifdef HR_METADATA + , + SPHERICAL_GRID_DATA *Sph_Grid16 +#endif +) +{ + int16_t i, j, k; + float azi_rad, ele_rad; + uint8_t numDirections; + + /* use the nominal values without data-adaptivity */ + numDirections = hMeta->descriptive_meta.numberOfDirections + 1; + + /* azi/ele/nrg into vectors for each sub-frame and band */ + for ( i = 0; i < numDirections; i++ ) + { + for ( k = 0; k < MASA_FREQUENCY_BANDS; k++ ) + { + float x_sum, y_sum, z_sum, energy_sum, vec_len, spread_coh_sum, surr_coh_sum; + + x_sum = 0.0f; + y_sum = 0.0f; + z_sum = 0.0f; + energy_sum = 0.0f; + spread_coh_sum = 0.0f; + surr_coh_sum = 0.0f; + for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + azi_rad = hMeta->directional_meta[i].azimuth[j][k] / 180.0f * EVS_PI; + ele_rad = hMeta->directional_meta[i].elevation[j][k] / 180.0f * EVS_PI; + vec_len = hMeta->directional_meta[i].energy_ratio[j][k] * energy[j][k]; + + /* energy-weighted sum over subframes */ + x_sum += cosf( azi_rad ) * cosf( ele_rad ) * vec_len; + y_sum += sinf( azi_rad ) * cosf( ele_rad ) * vec_len; + z_sum += sinf( ele_rad ) * vec_len; + + energy_sum += energy[j][k]; + + spread_coh_sum += hMeta->directional_meta[i].spread_coherence[j][k] * energy[j][k]; + if ( i == 0 ) + { + /* this is in common metadata and not in each direction */ + surr_coh_sum += hMeta->common_meta.surround_coherence[j][k] * energy[j][k]; + } + } + + /* the data from the combined sub-frames is written into the first sub-frame band */ + j = 0; + hMeta->directional_meta[i].azimuth[j][k] = atan2f( y_sum, x_sum ) / EVS_PI * 180.0f; + hMeta->directional_meta[i].elevation[j][k] = atan2f( z_sum, sqrtf( x_sum * x_sum + y_sum * y_sum ) ) / EVS_PI * 180.0f; +#ifdef HR_METADATA + if ( Sph_Grid16->no_theta > 0 ) + { + hMeta->directional_meta[i].spherical_index[j][k] = index_theta_phi_16( &( hMeta->directional_meta[i].elevation[j][k] ), + &( hMeta->directional_meta[i].azimuth[j][k] ), Sph_Grid16 ); + } +#endif + vec_len = sqrtf( x_sum * x_sum + y_sum * y_sum + z_sum * z_sum ); + hMeta->directional_meta[i].energy_ratio[j][k] = vec_len / ( energy_sum + EPSILON ); + + hMeta->directional_meta[i].spread_coherence[j][k] = spread_coh_sum / ( energy_sum + EPSILON ); + if ( i == 0 ) + { + hMeta->common_meta.surround_coherence[j][k] = surr_coh_sum / ( energy_sum + EPSILON ); + } + + /* copy the same value to all subframes */ + for ( j = 1; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + hMeta->directional_meta[i].azimuth[j][k] = hMeta->directional_meta[i].azimuth[0][k]; + hMeta->directional_meta[i].elevation[j][k] = hMeta->directional_meta[i].elevation[0][k]; + hMeta->directional_meta[i].energy_ratio[j][k] = hMeta->directional_meta[i].energy_ratio[0][k]; + hMeta->directional_meta[i].spread_coherence[j][k] = hMeta->directional_meta[i].spread_coherence[0][k]; + if ( i == 0 ) + { + hMeta->common_meta.surround_coherence[j][k] = hMeta->common_meta.surround_coherence[0][k]; + } + } + } + } + + for ( k = 0; k < MASA_FREQUENCY_BANDS; k++ ) + { + for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) + { + if ( numDirections == 2 ) + { + hMeta->common_meta.diffuse_to_total_ratio[j][k] = max( 0.0f, 1.0f - hMeta->directional_meta[1].energy_ratio[j][k] - hMeta->directional_meta[0].energy_ratio[j][k] ); + } + else + { + hMeta->common_meta.diffuse_to_total_ratio[j][k] = max( 0.0f, 1.0f - hMeta->directional_meta[0].energy_ratio[j][k] ); + } + hMeta->common_meta.remainder_to_total_ratio[j][k] = 0.0f; + } + } + + return; +} + + +/*-------------------------------------------------------------------* + * copy_masa_metadata_subframe() + * + * Copy MASA metadata frame subframe contents + *-------------------------------------------------------------------*/ + +static void copy_masa_metadata_subframe( + const MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metdata to be copied */ + const uint8_t sfFrom, /* i : subframe index of the copy source */ + MASA_METADATA_HANDLE hMetaTo, /* o : MASA frame metadata copy destination */ + const uint8_t sfTo /* i : subframe index of the copy target */ +) +{ + uint8_t dir; + + /* directional metadata */ + for ( dir = 0; dir < MASA_MAXIMUM_DIRECTIONS; dir++ ) + { + mvr2r( hMetaFrom->directional_meta[dir].azimuth[sfFrom], hMetaTo->directional_meta[dir].azimuth[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->directional_meta[dir].elevation[sfFrom], hMetaTo->directional_meta[dir].elevation[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->directional_meta[dir].energy_ratio[sfFrom], hMetaTo->directional_meta[dir].energy_ratio[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->directional_meta[dir].spread_coherence[sfFrom], hMetaTo->directional_meta[dir].spread_coherence[sfTo], MASA_FREQUENCY_BANDS ); + } + + /* common metadata */ + mvr2r( hMetaFrom->common_meta.diffuse_to_total_ratio[sfFrom], hMetaTo->common_meta.diffuse_to_total_ratio[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->common_meta.surround_coherence[sfFrom], hMetaTo->common_meta.surround_coherence[sfTo], MASA_FREQUENCY_BANDS ); + mvr2r( hMetaFrom->common_meta.remainder_to_total_ratio[sfFrom], hMetaTo->common_meta.remainder_to_total_ratio[sfTo], MASA_FREQUENCY_BANDS ); + + return; +} + + +/*-------------------------------------------------------------------* + * copy_masa_metadata() + * + * Copy MASA metada frame contents + *-------------------------------------------------------------------*/ + +static void copy_masa_metadata( + const MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metadata to be copied */ + MASA_METADATA_HANDLE hMetaTo /* o : MASA frame metadata copy destination */ +) +{ + uint8_t sf, byte_idx; + + /* descriptive metadata */ + for ( byte_idx = 0; byte_idx < 8; byte_idx++ ) + { + hMetaTo->descriptive_meta.formatDescriptor[byte_idx] = hMetaFrom->descriptive_meta.formatDescriptor[byte_idx]; + } + + hMetaTo->descriptive_meta.numberOfDirections = hMetaFrom->descriptive_meta.numberOfDirections; + hMetaTo->descriptive_meta.numberOfChannels = hMetaFrom->descriptive_meta.numberOfChannels; + hMetaTo->descriptive_meta.sourceFormat = hMetaFrom->descriptive_meta.sourceFormat; + hMetaTo->descriptive_meta.transportDefinition = hMetaFrom->descriptive_meta.transportDefinition; + hMetaTo->descriptive_meta.channelAngle = hMetaFrom->descriptive_meta.channelAngle; + hMetaTo->descriptive_meta.channelDistance = hMetaFrom->descriptive_meta.channelDistance; + hMetaTo->descriptive_meta.channelLayout = hMetaFrom->descriptive_meta.channelLayout; + + /* directional and common metadata */ + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + copy_masa_metadata_subframe( hMetaFrom, sf, hMetaTo, sf ); + } + + return; +} + + +/*-------------------------------------------------------------------* + * are_masa_subframes_similar() + * + * Compare the similarity of MASA metadata in two sub-frames + *-------------------------------------------------------------------*/ + +static uint8_t are_masa_subframes_similar( + const MASA_METADATA_HANDLE frame1, /* i : MASA metadata frame 1 */ + const uint8_t sf1_idx, /* i : index of the subframe of frame1 to inspect */ + const MASA_METADATA_HANDLE frame2, /* i : MASA metadata frame 2 */ + const uint8_t sf2_idx /* o : index of the subframe of frame2 to inspect */ +) +{ + uint8_t num_dir; + uint8_t dir; + uint8_t band_idx; + uint8_t sf_differ; + + num_dir = frame1->descriptive_meta.numberOfDirections; + dir = 0; + band_idx = 0; + sf_differ = FALSE; + + if ( num_dir != frame2->descriptive_meta.numberOfDirections ) + { + sf_differ = TRUE; + } + else + { + /* check per-direction metadata */ + dir = 0; + band_idx = 0; + + while ( ( sf_differ == FALSE ) && ( dir <= num_dir ) ) + { + band_idx = 0; + while ( ( sf_differ == FALSE ) && ( band_idx < MASA_FREQUENCY_BANDS ) ) + { + float azi_dif; + azi_dif = fabsf( frame1->directional_meta[dir].azimuth[sf1_idx][band_idx] - frame2->directional_meta[dir].azimuth[sf2_idx][band_idx] ); + azi_dif = azi_dif > 180.0f ? 360.0f - azi_dif : azi_dif; + + if ( azi_dif > MASA_ANGLE_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + if ( fabsf( frame1->directional_meta[dir].elevation[sf1_idx][band_idx] - frame2->directional_meta[dir].elevation[sf2_idx][band_idx] ) > MASA_ANGLE_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + if ( fabsf( frame1->directional_meta[dir].energy_ratio[sf1_idx][band_idx] - frame2->directional_meta[dir].energy_ratio[sf2_idx][band_idx] ) > MASA_RATIO_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + if ( fabsf( frame1->directional_meta[dir].spread_coherence[sf1_idx][band_idx] - frame2->directional_meta[dir].spread_coherence[sf2_idx][band_idx] ) > MASA_COHERENCE_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + band_idx++; + } + dir++; + } + + /* check the common metadata */ + while ( ( sf_differ == FALSE ) && ( band_idx < MASA_FREQUENCY_BANDS ) ) + { + if ( fabsf( frame1->common_meta.surround_coherence[sf1_idx][band_idx] - frame2->common_meta.surround_coherence[sf2_idx][band_idx] ) > MASA_COHERENCE_TOLERANCE ) + { + sf_differ = TRUE; + break; + } + + band_idx++; + } + } + + /* TODO: a nicer negation */ // VE: ?? + if ( sf_differ ) + { + return FALSE; + } + else + { + return TRUE; + } +} + + +/*-------------------------------------------------------------------* + * detect_framing_async() + * + * Compare the similarity of MASA metadata in two sub-frames + * Analysis result is stored in hMasa->data.sync_state, and + * potentially hMasa->masaMetadata is modified + *-------------------------------------------------------------------*/ + +static void detect_framing_async( + MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder structure */ +) +{ + MASA_METADATA_HANDLE current_meta; + MASA_METADATA_HANDLE previous_meta; + MASA_SYNC_HANDLE sync_state; + MASA_FRAME_MODE frame_mode; + uint8_t n_sim_start, n_sim_stop, sf_idx; + uint8_t found_offset; + + current_meta = &( hMasa->masaMetadata ); /* metadata from current frame */ + sync_state = &( hMasa->data.sync_state ); /* synchronization structure */ + previous_meta = &( sync_state->previous_metadata ); + + /* check current frame, how many are similar from the start and from the end */ + n_sim_start = 1; + for ( sf_idx = n_sim_start; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + if ( are_masa_subframes_similar( current_meta, 0, current_meta, sf_idx ) == TRUE ) + { + n_sim_start = sf_idx + 1; + } + else + { + break; + } + } + + /* number of similar sub-frames starting from the end of the frame */ + if ( n_sim_start == MAX_PARAM_SPATIAL_SUBFRAMES ) /* shortcut */ + { + n_sim_stop = n_sim_start; + } + else + { + n_sim_stop = 1; + for ( sf_idx = 2; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ ) + { + /* we need to check only the two middle sub-frames, as all being the same would have taken the shortcut above */ + if ( are_masa_subframes_similar( current_meta, MAX_PARAM_SPATIAL_SUBFRAMES - 1, current_meta, MAX_PARAM_SPATIAL_SUBFRAMES - sf_idx ) == TRUE ) + { + n_sim_stop = sf_idx; + } + else + { + break; + } + } + } + + frame_mode = MASA_FRAME_4SF; /* default mode: 4sf */ + if ( sync_state->prev_offset > MAX_PARAM_SPATIAL_SUBFRAMES - 2 ) + { + /* earlier offset was large => reset the offset */ + found_offset = 0; + } + else + { + /* keep previous offset unless something else is found. alternatively, we could reset always */ + found_offset = sync_state->prev_offset; + } + + if ( ( n_sim_start == MAX_PARAM_SPATIAL_SUBFRAMES ) && ( n_sim_stop == MAX_PARAM_SPATIAL_SUBFRAMES ) ) + { + /* full frame consists of similar sub-frames */ + frame_mode = MASA_FRAME_1SF; + if ( ( sync_state->prev_sim_stop != 0 ) && ( are_masa_subframes_similar( current_meta, 0, previous_meta, MAX_PARAM_SPATIAL_SUBFRAMES - 1 ) == TRUE ) ) + { + /* > 4 sub-frames of similar data */ + if ( sync_state->prev_sim_stop < 3 ) + { + /* can nicely align the framing with the earlier data and a small offset */ + found_offset = sync_state->prev_sim_stop; + } + else + { + /* too many similar sub-frames to determine the offset accurately => keep earlier value */ + found_offset = sync_state->prev_offset; + } + } + else + { + /* earlier window was different => reset the offset */ + found_offset = 0; + } + } + else if ( n_sim_stop == 3 ) + { + /* first sub-frame different that the rest 3 + => make a risky guess that the future sf would be the same too and we're in an offset case */ + frame_mode = MASA_FRAME_1SF; + found_offset = 3; + } + else if ( ( sync_state->prev_sim_stop > 0 ) && ( are_masa_subframes_similar( current_meta, 0, previous_meta, MAX_PARAM_SPATIAL_SUBFRAMES - 1 ) == TRUE ) ) + { + /* seeing data similar to past */ + if ( ( n_sim_start > 1 ) && ( n_sim_start + sync_state->prev_sim_stop >= MAX_PARAM_SPATIAL_SUBFRAMES ) ) + { + /* with the past, would have at least one long frame similar subframes */ + frame_mode = MASA_FRAME_1SF; + + if ( sync_state->prev_offset == 0 ) + { + found_offset = min( 2, sync_state->prev_sim_stop ); + } + else + { + found_offset = sync_state->prev_offset; + } + } + } + + /* keep the original contents of the frame, but then perform interpolation later */ + /* just copy current frame to storage */ + copy_masa_metadata( current_meta, previous_meta ); + + sync_state->prev_sim_stop = n_sim_stop; + sync_state->prev_offset = found_offset; + sync_state->frame_mode = frame_mode; + + return; +} + + +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT +/*-------------------------------------------------------------------* + * masa_metadata_direction_alignment() + * + * In 2dir MASA metadata, determine the ordering of the directional + * fields such that the azi/ele change across time is minimized. + *-------------------------------------------------------------------*/ + +static void masa_metadata_direction_alignment( + MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ +) +{ + uint8_t band, n_dirs; + + MASA_DIR_ALIGN_HANDLE hAlignState; + MASA_METADATA_HANDLE hMeta; + + hAlignState = &( hMasa->data.dir_align_state ); + hMeta = &( hMasa->masaMetadata ); + + n_dirs = hMeta->descriptive_meta.numberOfDirections + 1; /* 1-based */ + for ( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) + { + uint8_t sf; + float diff_swap, diff_no_swap; + + /* trade 2*(cos+sin) against storing the values between frames */ + float prev_ele_dir1_sin, prev_ele_dir2_sin; + float prev_ele_dir1_cos, prev_ele_dir2_cos; + + prev_ele_dir1_sin = sinf( hAlignState->previous_ele_dir1[band] ); + prev_ele_dir2_sin = sinf( hAlignState->previous_ele_dir2[band] ); + + prev_ele_dir1_cos = cosf( hAlignState->previous_ele_dir1[band] ); + prev_ele_dir2_cos = cosf( hAlignState->previous_ele_dir2[band] ); + + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) + { + float azi_rad1, ele_rad1; + float azi_rad2, ele_rad2; + float cos_ele1, cos_ele2; + float sin_ele1, sin_ele2; + + azi_rad1 = hMeta->directional_meta[0].azimuth[sf][band] * PI_OVER_180; + ele_rad1 = hMeta->directional_meta[0].elevation[sf][band] * PI_OVER_180; + + if ( n_dirs > 1 ) + { + azi_rad2 = hMeta->directional_meta[1].azimuth[sf][band] * PI_OVER_180; + ele_rad2 = hMeta->directional_meta[1].elevation[sf][band] * PI_OVER_180; + + /* quick checks to detect constant data and earlier flip */ + if ( fabsf( azi_rad1 - hAlignState->previous_azi_dir1[band] ) < EPSILON && + fabsf( azi_rad2 - hAlignState->previous_azi_dir2[band] ) < EPSILON && + fabsf( ele_rad1 - hAlignState->previous_ele_dir1[band] ) < EPSILON && + fabsf( ele_rad2 - hAlignState->previous_ele_dir2[band] ) < EPSILON ) + { + diff_swap = 1.0f; + diff_no_swap = 0.0f; + /* cached values that will be used for the short-cuts and over-written by the real computations, if done */ + sin_ele1 = prev_ele_dir1_sin; + sin_ele2 = prev_ele_dir2_sin; + cos_ele1 = prev_ele_dir1_cos; + cos_ele2 = prev_ele_dir2_cos; + } + else if ( fabsf( azi_rad1 - hAlignState->previous_azi_dir2[band] ) < EPSILON && + fabsf( azi_rad2 - hAlignState->previous_azi_dir1[band] ) < EPSILON && + fabsf( ele_rad1 - hAlignState->previous_ele_dir2[band] ) < EPSILON && + fabsf( ele_rad2 - hAlignState->previous_ele_dir1[band] ) < EPSILON ) + { + diff_swap = 0.0f; + diff_no_swap = 1.0f; + /* cached values that will be used for the short-cuts and over-written by the real computations, if done */ + sin_ele1 = prev_ele_dir2_sin; + sin_ele2 = prev_ele_dir1_sin; + cos_ele1 = prev_ele_dir2_cos; + cos_ele2 = prev_ele_dir1_cos; + } + else + { + /* angular distance of the two vectors */ + /* pre-compute values for re-use */ + sin_ele1 = sinf( ele_rad1 ); + sin_ele2 = sinf( ele_rad2 ); + + cos_ele1 = cosf( ele_rad1 ); + cos_ele2 = cosf( ele_rad2 ); + + diff_no_swap = acosf( cos_ele1 * prev_ele_dir1_cos * cosf( azi_rad1 - hAlignState->previous_azi_dir1[band] ) + sin_ele1 * prev_ele_dir1_sin ) + + acosf( cos_ele2 * prev_ele_dir2_cos * cosf( azi_rad2 - hAlignState->previous_azi_dir2[band] ) + sin_ele2 * prev_ele_dir2_sin ); + + diff_swap = acosf( cos_ele1 * prev_ele_dir2_cos * cosf( azi_rad1 - hAlignState->previous_azi_dir2[band] ) + sin_ele1 * prev_ele_dir2_sin ) + + acosf( cos_ele2 * prev_ele_dir1_cos * cosf( azi_rad2 - hAlignState->previous_azi_dir1[band] ) + sin_ele2 * prev_ele_dir1_sin ); + } + } + else + { + /* 1dir */ + sin_ele1 = sinf( ele_rad1 ); + cos_ele1 = cosf( ele_rad1 ); + + azi_rad2 = 0.0f; + ele_rad2 = 0.0f; + + sin_ele2 = 0.0f; /* sin(0) */ + cos_ele2 = 1.0f; /* cos(0) */ + + diff_swap = 1.0f; + diff_no_swap = 0.0f; + } + + if ( n_dirs > 1 && diff_no_swap > diff_swap ) + { + /* swap the metadata of the two directions in this TF-tile */ + float tmp_val; + tmp_val = hMeta->directional_meta[0].azimuth[sf][band]; + hMeta->directional_meta[0].azimuth[sf][band] = hMeta->directional_meta[1].azimuth[sf][band]; + hMeta->directional_meta[1].azimuth[sf][band] = tmp_val; + + tmp_val = hMeta->directional_meta[0].elevation[sf][band]; + hMeta->directional_meta[0].elevation[sf][band] = hMeta->directional_meta[1].elevation[sf][band]; + hMeta->directional_meta[1].elevation[sf][band] = tmp_val; + + tmp_val = hMeta->directional_meta[0].energy_ratio[sf][band]; + hMeta->directional_meta[0].energy_ratio[sf][band] = hMeta->directional_meta[1].energy_ratio[sf][band]; + hMeta->directional_meta[1].energy_ratio[sf][band] = tmp_val; + + tmp_val = hMeta->directional_meta[0].spread_coherence[sf][band]; + hMeta->directional_meta[0].spread_coherence[sf][band] = hMeta->directional_meta[1].spread_coherence[sf][band]; + hMeta->directional_meta[1].spread_coherence[sf][band] = tmp_val; + + hAlignState->previous_azi_dir1[band] = azi_rad2; + hAlignState->previous_ele_dir1[band] = ele_rad2; + + hAlignState->previous_azi_dir2[band] = azi_rad1; + hAlignState->previous_ele_dir2[band] = ele_rad1; + + prev_ele_dir1_cos = cos_ele2; + prev_ele_dir1_sin = sin_ele2; + + prev_ele_dir2_cos = cos_ele1; + prev_ele_dir2_sin = sin_ele1; + } + else + { + hAlignState->previous_azi_dir1[band] = azi_rad1; + hAlignState->previous_ele_dir1[band] = ele_rad1; + + hAlignState->previous_azi_dir2[band] = azi_rad2; + hAlignState->previous_ele_dir2[band] = ele_rad2; + + prev_ele_dir1_cos = cos_ele1; + prev_ele_dir1_sin = sin_ele1; + + prev_ele_dir2_cos = cos_ele2; + prev_ele_dir2_sin = sin_ele2; + } + } /* sf */ + } /* band */ + + return; +} +#endif diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 5de51576e9de47e51e707e816b927ee074772dd3..f32a5b60d3deaf136a848945b794141c46601116 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -140,18 +140,22 @@ ivas_error ivas_param_mc_enc_open( hParamMC->dmx_factors = ivas_param_mc_conf[config_index].dmx_fac; /* set FB config. */ - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, SBA_MODE_DIRAC, nchan_inp, 0, 0, input_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, SBA_MODE_DIRAC, nchan_inp, 0, 0, input_Fs +#ifdef HODIRAC + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } /* Allocate and initialize FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &( hParamMC->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_FB_mixer_open( &( hParamMC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) { return error; } - /* open/init parameter coding */ ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); @@ -200,7 +204,11 @@ ivas_error ivas_param_mc_enc_open( /* parameter band grouping: 60 band CLDFB to 240 band MDFT resolution */ for ( i = 0; i < hParamMC->hMetadataPMC.num_parameter_bands + 1; i++ ) { +#ifdef PARAMMC_SHORT_ENC_MDFT + hParamMC->band_grouping[i] *= PARAM_MC_CLDFB_TO_MDFT_FAC; +#else hParamMC->band_grouping[i] *= CLDFB_TO_MDFT_FAC; +#endif } /* set correct coded band width */ @@ -275,7 +283,6 @@ ivas_error ivas_param_mc_enc_reconfig( /* get dmx factors */ hParamMC->dmx_factors = ivas_param_mc_conf[config_index].dmx_fac; - /* deallocate the full icc map, gets newly allocated in the metadata open function */ for ( i = 0; i < 2; i++ ) { @@ -337,7 +344,11 @@ ivas_error ivas_param_mc_enc_reconfig( /* parameter band grouping: 60 band CLDFB to 240 band MDFT resolution */ for ( i = 0; i < hParamMC->hMetadataPMC.num_parameter_bands + 1; i++ ) { +#ifdef PARAMMC_SHORT_ENC_MDFT + hParamMC->band_grouping[i] *= PARAM_MC_CLDFB_TO_MDFT_FAC; +#else hParamMC->band_grouping[i] *= CLDFB_TO_MDFT_FAC; +#endif } /* set correct coded band width */ @@ -362,14 +373,20 @@ ivas_error ivas_param_mc_enc_reconfig( *------------------------------------------------------------------------*/ void ivas_param_mc_enc_close( - PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ + PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle */ const int32_t sampling_rate ) { - ivas_param_mc_metadata_close( &hParamMC->hMetadataPMC ); + if ( hParamMC == NULL || *hParamMC == NULL ) + { + return; + } + + ivas_param_mc_metadata_close( &( *hParamMC )->hMetadataPMC ); - ivas_FB_mixer_close( &hParamMC->hFbMixer, sampling_rate ); + ivas_FB_mixer_close( &( *hParamMC )->hFbMixer, sampling_rate, 0 ); - free( hParamMC ); + free( ( *hParamMC ) ); + ( *hParamMC ) = NULL; return; } @@ -382,10 +399,10 @@ void ivas_param_mc_enc_close( *------------------------------------------------------------------------*/ void ivas_param_mc_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ - const int16_t input_frame /* i : input frame length */ + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ + const int16_t input_frame /* i : input frame length */ ) { int16_t k; @@ -639,8 +656,6 @@ static void ivas_param_mc_param_est_enc( push_wmops( "param_mc_prm_est" ); /* initializations */ - - l_ts = input_frame / PARAM_MC_MDFT_NO_SLOTS; num_time_slots = PARAM_MC_MDFT_NO_SLOTS; start_ts = hParamMC->hMetadataPMC.bAttackPresent ? hParamMC->hMetadataPMC.attackIndex : 0; @@ -671,7 +686,12 @@ static void ivas_param_mc_param_est_enc( for ( ts = 0; ts < start_ts; ts++ ) { - ivas_fb_mixer_update_prior_input( hParamMC->hFbMixer, pcm_in, l_ts ); + ivas_fb_mixer_update_prior_input( hParamMC->hFbMixer, pcm_in, l_ts +#ifdef HODIRAC + , + hParamMC->hFbMixer->fb_cfg->num_in_chans +#endif + ); for ( i = 0; i < nchan_input; i++ ) { pcm_in[i] += l_ts; @@ -680,8 +700,23 @@ static void ivas_param_mc_param_est_enc( for ( ts = start_ts; ts < num_time_slots; ts++ ) { +#ifdef PARAMMC_SHORT_ENC_MDFT + ivas_fb_mixer_get_windowed_fr( hParamMC->hFbMixer, pcm_in, p_slot_frame_f_real, p_slot_frame_f_imag, l_ts, l_ts +#ifdef HODIRAC + , + hParamMC->hFbMixer->fb_cfg->num_in_chans +#endif + ); +#else ivas_fb_mixer_get_windowed_fr( hParamMC->hFbMixer, pcm_in, p_slot_frame_f_real, p_slot_frame_f_imag, l_ts, 2 * l_ts ); - ivas_fb_mixer_update_prior_input( hParamMC->hFbMixer, pcm_in, l_ts ); +#endif + ivas_fb_mixer_update_prior_input( hParamMC->hFbMixer, pcm_in, l_ts +#ifdef HODIRAC + , + hParamMC->hFbMixer->fb_cfg->num_in_chans +#endif + ); + for ( i = 0; i < nchan_input; i++ ) { pcm_in[i] += l_ts; @@ -912,7 +947,6 @@ static void ivas_param_mc_param_est_enc( hParamMC->hMetadataPMC.lfe_on = 1; } - pop_wmops(); return; @@ -1723,6 +1757,7 @@ static void ivas_param_mc_dec2bin( { bits[idx] = ( val >> ( N - 1 - idx ) ) & 1; } + return; } diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c new file mode 100644 index 0000000000000000000000000000000000000000..a44121f9a77b6b35978b3873417a07224b2e3dfb --- /dev/null +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -0,0 +1,848 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include +#include "options.h" +#include "cnst.h" +#include "rom_enc.h" +#include "rom_com.h" +#include "prot.h" +#include "ivas_prot.h" +#include "ivas_cnst.h" +#include "ivas_rom_com.h" +#include "ivas_rom_enc.h" +#ifdef DEBUGGING +#include "debug.h" +#endif +#ifdef DEBUG_PLOT +#include "deb_out.h" +#endif +#include "wmc_auto.h" + +#ifdef MC_PARAMUPMIX_MODE +/*------------------------------------------------------------------------- + * Local function prototypes + *------------------------------------------------------------------------*/ + +static void ivas_mc_paramupmix_dmx( MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, float data_f[][L_FRAME48k], const int16_t input_frame ); + +static void ivas_mc_paramupmix_param_est_enc( MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, float input_frame_t[][L_FRAME48k], const int16_t input_frame, float alphas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS], float betas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS] ); + +static void get_huff_table( PAR_TYPE par_type, QUANT_TYPE quant_type, HUFF_TAB *df0, HUFF_TAB *df, HUFF_TAB *dt ); + +static void write_huff_bits( int32_t value, uint16_t length, uint16_t bit_buffer[MC_PARAMUPMIX_MAX_BITS], int16_t *bit_pos ); + +static void huffman_encode( int16_t bdfOnly, int16_t bdtAllowed, int16_t nv, int16_t ivStart, int32_t *vqPrev, int32_t *vq, PAR_TYPE parType, QUANT_TYPE quant_type, int16_t nq, uint16_t bit_buffer[MC_PARAMUPMIX_MAX_BITS], int16_t *bit_pos ); + +static void put_ec_data( MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, int16_t ch, float pars[IVAS_MAX_NUM_BANDS], float alphas[IVAS_MAX_NUM_BANDS], PAR_TYPE parType, uint16_t bit_buffer[MC_PARAMUPMIX_MAX_BITS], int16_t *bit_pos ); + +static void quantize_alpha( int16_t nv, const float *alpha, QUANT_TYPE quant_type, int16_t *pnq, int32_t aq[IVAS_MAX_NUM_BANDS], float *adeq ); + +static void quantize_pars( int16_t nv, const float *v, int16_t nq, const float *data, int32_t vq[IVAS_MAX_NUM_BANDS], float *vdeq ); + +static void quantize_pars( int16_t nv, const float *v, int16_t nq, const float *data, int32_t vq[IVAS_MAX_NUM_BANDS], float *vdeq ); + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_enc() + * + * MC ParamUpmix Encoder main encoding function + *------------------------------------------------------------------------*/ + +void ivas_mc_paramupmix_enc( + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hBStr, /* i/o: IVAS Metadata bitstream handle */ + float data_f[][L_FRAME48k], /* i/o: input: CICP6, CICP12, CICP14, CICP16 or CICP19 MC data */ + const int16_t input_frame /* i : input frame length */ +) +{ + MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix; + int16_t i; + float alphas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + float betas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + uint16_t bit_buffer[MC_PARAMUPMIX_MAX_BITS]; + int16_t bit_pos; + + push_wmops( "mc_paramupmix_enc" ); + + hMCParamUpmix = st_ivas->hMCParamUpmix; + bit_pos = 0; + + /* Parameter estimation */ + ivas_mc_paramupmix_param_est_enc( hMCParamUpmix, data_f, input_frame, alphas, betas ); + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + put_ec_data( hMCParamUpmix, i, alphas[i], NULL, ALPHA, bit_buffer, &bit_pos ); + put_ec_data( hMCParamUpmix, i, betas[i], alphas[i], BETA, bit_buffer, &bit_pos ); + } + + /* push the PARAM UPMIX MC side info from the temporary buffer into the medatdata bitstream*/ + push_next_bits( hBStr, bit_buffer, bit_pos ); + + /* DMX generation*/ + ivas_mc_paramupmix_dmx( hMCParamUpmix, data_f, input_frame ); + + pop_wmops(); + + return; +} + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_enc_open() + * + * Initialize MC ParamUpmix encoder handle + *------------------------------------------------------------------------*/ + +ivas_error ivas_mc_paramupmix_enc_open( + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +) +{ + IVAS_FB_CFG *fb_cfg; + MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix; + int32_t input_Fs; + int32_t input_frame; + int16_t i, k, b, j; + ivas_error error; + + error = IVAS_ERR_OK; + input_Fs = st_ivas->hEncoderConfig->input_Fs; + input_frame = (int32_t) st_ivas->hEncoderConfig->input_Fs / FRAMES_PER_SEC; + + /* Sanity Checks */ + if ( ( hMCParamUpmix = (MC_PARAMUPMIX_ENC_HANDLE) malloc( sizeof( MC_PARAMUPMIX_ENC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MC_MODE_PARAMUPMIX\n" ) ); + } + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + for ( k = 0; k < MC_PARAMUPMIX_NCH; k++ ) + { + if ( ( hMCParamUpmix->midside[i][k] = (float *) malloc( sizeof( float ) * input_frame ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MC_MODE_PARAMUPMIX\n" ) ); + } + set_zero( hMCParamUpmix->midside[i][k], (int16_t) input_frame ); + } + } + hMCParamUpmix->first_frame = 1; + + /* MC_LS_SETUP_5_1_2 is the only current configuration */ + st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; + + /* set core coder dependent on the number of transport channels */ + switch ( st_ivas->nchan_transport ) + { + case 8: + st_ivas->nCPE = 4; + st_ivas->nSCE = 0; + st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; + break; +#ifdef DEBUGGING + default: + assert( 0 && "Number of transport channels not supported by MC PARAM UPMIX MODE!\n" ); +#endif + } + + + /* Transient Detector handle */ + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH; i++ ) + { + if ( ( error = ivas_transient_det_open( &( hMCParamUpmix->hTranDet[i] ), input_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* set FB config. */ + /* need to set num output channels to a value > 0 to get pFb != NULL */ + if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, SBA_MODE_SPAR, MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH, MC_PARAMUPMIX_COMBINATIONS, 0, input_Fs +#ifdef HODIRAC + , + 0 +#endif + ) ) != IVAS_ERR_OK ) + { + return error; + } + fb_cfg->remix_order = mc_paramupmix_fb_remix_order; + /* override latency, could be moved to ivas_fb_set_cfg */ + /* assuming parameters are calculated at end of frame, compensate for MCT delay and half of decoder fb */ + /* still 1.5ms off, since MCT delay is not large enough */ + /* param at end of frame */ + fb_cfg->prior_input_length = (int16_t) ( NS2SA( input_Fs, 12000000L ) + NS2SA( input_Fs, DELAY_FB_4_NS / 2 ) - input_frame / 2 - NS2SA( input_Fs, DELAY_FB_1_NS / 2 ) ); + fb_cfg->prior_input_length = (int16_t) max( fb_cfg->prior_input_length, input_frame / MAX_PARAM_SPATIAL_SUBFRAMES ); + + /* Allocate and initialize FB mixer handle */ + if ( ( error = ivas_FB_mixer_open( &( hMCParamUpmix->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + /* Covariance handle */ + if ( ( error = ivas_spar_covar_enc_open( &( hMCParamUpmix->hCovEnc[i] ), hMCParamUpmix->hFbMixer->pFb, input_Fs, MC_PARAMUPMIX_NCH + 1, st_ivas->hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + + for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) + { + if ( ( hMCParamUpmix->cov_real[b] = (float ***) malloc( MC_PARAMUPMIX_NCH * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR cov real matrix" ); + } + for ( i = 0; i < MC_PARAMUPMIX_NCH; i++ ) + { + if ( ( hMCParamUpmix->cov_real[b][i] = (float **) malloc( MC_PARAMUPMIX_NCH * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR cov real matrix" ); + } + for ( j = 0; j < MC_PARAMUPMIX_NCH; j++ ) + { + if ( ( hMCParamUpmix->cov_real[b][i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR cov real matrix" ); + } + } + } + + if ( ( hMCParamUpmix->cov_dtx_real[b] = (float ***) malloc( MC_PARAMUPMIX_NCH * sizeof( float ** ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR cov dtx real matrix" ); + } + for ( i = 0; i < MC_PARAMUPMIX_NCH; i++ ) + { + if ( ( hMCParamUpmix->cov_dtx_real[b][i] = (float **) malloc( MC_PARAMUPMIX_NCH * sizeof( float * ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR cov dtx real matrix" ); + } + for ( j = 0; j < MC_PARAMUPMIX_NCH; j++ ) + { + if ( ( hMCParamUpmix->cov_dtx_real[b][i][j] = (float *) malloc( IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR cov dtx real matrix" ); + } + } + } + } + + st_ivas->hMCParamUpmix = hMCParamUpmix; + + return error; +} + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_enc_close() + * + * Close MC Param-Upmix encoder handle + *------------------------------------------------------------------------*/ + +void ivas_mc_paramupmix_enc_close( + MC_PARAMUPMIX_ENC_HANDLE *hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ + const int32_t sampling_rate ) +{ + int16_t i, k; + int16_t b, j; + + if ( hMCParamUpmix == NULL || *hMCParamUpmix == NULL ) + { + return; + } + for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) + { + if ( ( *hMCParamUpmix )->cov_real[b] != NULL ) + { + for ( i = 0; i < MC_PARAMUPMIX_NCH; i++ ) + { + if ( ( *hMCParamUpmix )->cov_real[b][i] != NULL ) + { + for ( j = 0; j < MC_PARAMUPMIX_NCH; j++ ) + { + if ( ( *hMCParamUpmix )->cov_real[b][i][j] != NULL ) + { + free( ( *hMCParamUpmix )->cov_real[b][i][j] ); + } + } + free( ( *hMCParamUpmix )->cov_real[b][i] ); + } + } + free( ( *hMCParamUpmix )->cov_real[b] ); + } + if ( ( *hMCParamUpmix )->cov_dtx_real[b] != NULL ) + { + for ( i = 0; i < MC_PARAMUPMIX_NCH; i++ ) + { + if ( ( *hMCParamUpmix )->cov_dtx_real[b][i] != NULL ) + { + for ( j = 0; j < MC_PARAMUPMIX_NCH; j++ ) + { + if ( ( *hMCParamUpmix )->cov_dtx_real[b][i][j] != NULL ) + { + free( ( *hMCParamUpmix )->cov_dtx_real[b][i][j] ); + } + } + free( ( *hMCParamUpmix )->cov_dtx_real[b][i] ); + } + } + free( ( *hMCParamUpmix )->cov_dtx_real[b] ); + } + } + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + for ( k = 0; k < MC_PARAMUPMIX_NCH; k++ ) + { + free( ( *hMCParamUpmix )->midside[i][k] ); + } + } + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH; i++ ) + { + ivas_transient_det_close( &( *hMCParamUpmix )->hTranDet[i] ); + } + + if ( ( *hMCParamUpmix )->hFbMixer != NULL ) + { + ivas_FB_mixer_close( &( *hMCParamUpmix )->hFbMixer, sampling_rate, 0 ); + } + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + /* Covariance handle */ + if ( ( *hMCParamUpmix )->hCovEnc[i] != NULL ) + { + ivas_spar_covar_enc_close( &( *hMCParamUpmix )->hCovEnc[i], ( MC_PARAMUPMIX_NCH + 1 ) ); + } + } + + free( *hMCParamUpmix ); + *hMCParamUpmix = NULL; + return; +} + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_getNumTransportChannels() + * + * + *------------------------------------------------------------------------*/ + +/* r : number of IVAS transport channels */ +int16_t ivas_mc_paramupmix_getNumTransportChannels() +{ + int16_t nchan_transport; + + /* LFE not included */ + nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS - 1; /*5_1_2*/ + + return nchan_transport; +} + + +/*****************************************************************************************/ +/* local functions */ +/*****************************************************************************************/ +static void get_huff_table( + PAR_TYPE par_type, + QUANT_TYPE quant_type, + HUFF_TAB *df0, + HUFF_TAB *df, + HUFF_TAB *dt ) +{ + switch ( par_type ) + { + case ALPHA: + df0->value = huff_alpha_table[quant_type].df0.value; + df0->length = huff_alpha_table[quant_type].df0.length; + df->value = huff_alpha_table[quant_type].df.value; + df->length = huff_alpha_table[quant_type].df.length; + dt->value = huff_alpha_table[quant_type].dt.value; + dt->length = huff_alpha_table[quant_type].dt.length; + break; + case BETA: + df0->value = huff_beta_table[quant_type].df0.value; + df0->length = huff_beta_table[quant_type].df0.length; + df->value = huff_beta_table[quant_type].df.value; + df->length = huff_beta_table[quant_type].df.length; + dt->value = huff_beta_table[quant_type].dt.value; + dt->length = huff_beta_table[quant_type].dt.length; + break; + } +} + +static void write_huff_bits( + int32_t value, + uint16_t length, + uint16_t bit_buffer[MC_PARAMUPMIX_MAX_BITS], + int16_t *bit_pos ) +{ + int16_t k; + for ( k = length - 1; k >= 0; k-- ) + { + bit_buffer[( *bit_pos )++] = (uint16_t) ( ( value >> k ) & 1 ); + } +} + +static void huffman_encode( + int16_t bdfOnly, + int16_t bdtAllowed, + int16_t nv, + int16_t ivStart, + int32_t *vqPrev, + int32_t *vq, + PAR_TYPE parType, + QUANT_TYPE quant_type, + int16_t nq, + uint16_t bit_buffer[MC_PARAMUPMIX_MAX_BITS], + int16_t *bit_pos ) +{ + int16_t iv, ndf, ndt; + int32_t icode; + int16_t offset; + HUFF_TAB df0, df, dt; + + get_huff_table( parType, quant_type, &df0, &df, &dt ); + + offset = nq - 1; /* range [-(nquant - 1), nquant - 1] */ + + /* Get code length for time and freq diff coding */ + ndf = 0; + ndt = 0; + for ( iv = ivStart; iv < nv; iv++ ) + { + if ( iv == ivStart ) + { + icode = vq[iv]; + ndf += df0.length[icode]; + } + else + { + icode = vq[iv] - vq[iv - 1] + offset; + ndf += df.length[icode]; + } + + icode = vq[iv] - vqPrev[iv] + offset; + ndt += dt.length[icode]; + } + + if ( !bdtAllowed ) /* Time diff not allowed due to conformance or other reason even if bdfOnly = 0 */ + { + ndt = ndf + 1; + } + + /* Write the bitstream */ + if ( bdfOnly || ndf < ndt ) + { + bit_buffer[( *bit_pos )++] = (uint16_t) 0 & 1; + for ( iv = ivStart; iv < nv; iv++ ) + { + if ( iv == ivStart ) + { + icode = vq[iv]; + write_huff_bits( df0.value[icode], df0.length[icode], bit_buffer, bit_pos ); + } + else + { + icode = vq[iv] - vq[iv - 1] + offset; + write_huff_bits( df.value[icode], df.length[icode], bit_buffer, bit_pos ); + } + } + } + else + { + bit_buffer[( *bit_pos )++] = (uint16_t) 1 & 1; + for ( iv = ivStart; iv < nv; iv++ ) + { + icode = vq[iv] - vqPrev[iv] + offset; + if ( icode < 0 || icode >= 2 * nq - 1 ) + { + assert( 0 ); + } + write_huff_bits( dt.value[icode], dt.length[icode], bit_buffer, bit_pos ); + } + } +} + +static void quantize_pars( + int16_t nv, + const float *v, + int16_t nq, + const float *data, + int32_t vq[IVAS_MAX_NUM_BANDS], + float *vdeq ) +{ + int16_t iv, iq, iq0, iq1; + + for ( iv = 0; iv < nv; iv++ ) + { + iq0 = 0; + iq1 = nq - 1; + + while ( iq1 - iq0 > 1 ) + { + iq = ( iq0 + iq1 ) / 2; + if ( v[iv] < data[iq] ) + { + iq1 = iq; + } + else + { + iq0 = iq; + } + } + + if ( fabs( v[iv] - data[iq0] ) < fabs( v[iv] - data[iq1] ) ) + { + vq[iv] = iq0; + vdeq[iv] = data[iq0]; + } + else + { + vq[iv] = iq1; + vdeq[iv] = data[iq1]; + } + } +} + +static void quantize_alpha( + int16_t nv, + const float *alpha, + QUANT_TYPE quant_type, + int16_t *pnq, + int32_t aq[IVAS_MAX_NUM_BANDS], + float *adeq ) +{ + int16_t nq; + const float *data; + + nq = alpha_quant_table[quant_type].nquant; + data = alpha_quant_table[quant_type].data; + + quantize_pars( nv, alpha, nq, data, aq, adeq ); + + *pnq = nq; +} + +static void quantize_beta( + int16_t nv, + const float *beta, + const int32_t aq[IVAS_MAX_NUM_BANDS], + QUANT_TYPE quant_type, + int16_t *pnq, + int32_t bq[IVAS_MAX_NUM_BANDS], + float *bdeq ) +{ + int16_t iv, iq, iq0, iq1; + ACPL_QUANT_TABLE *tables = beta_quant_table[quant_type]; + ACPL_QUANT_TABLE quant_table; + const int16_t qmap[2][33] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0 } }; + for ( iv = 0; iv < nv; iv++ ) + { + quant_table = tables[qmap[quant_type][aq[iv]]]; + + iq0 = 0; + iq1 = quant_table.nquant - 1; + + while ( iq1 - iq0 > 1 ) + { + iq = ( iq0 + iq1 ) / 2; + if ( beta[iv] < quant_table.data[iq] ) + { + iq1 = iq; + } + else + { + iq0 = iq; + } + } + + if ( fabs( beta[iv] - quant_table.data[iq0] ) < fabs( beta[iv] - quant_table.data[iq1] ) ) + { + bq[iv] = iq0; + bdeq[iv] = quant_table.data[iq0]; + } + else + { + bq[iv] = iq1; + bdeq[iv] = quant_table.data[iq1]; + } + } + + *pnq = beta_quant_table[quant_type][0].nquant; +} + +static void put_ec_data( + MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, + int16_t ch, + float pars[IVAS_MAX_NUM_BANDS], + float alphas[IVAS_MAX_NUM_BANDS], + PAR_TYPE parType, + uint16_t bit_buffer[MC_PARAMUPMIX_MAX_BITS], + int16_t *bit_pos ) +{ + int16_t npar = IVAS_MAX_NUM_BANDS; + int16_t onlyFreq = 1; + int16_t nq; + QUANT_TYPE quant_type = FINE; + int32_t alphaQuant[IVAS_MAX_NUM_BANDS]; + int32_t betaQuant[IVAS_MAX_NUM_BANDS]; + float alphaDequant[IVAS_MAX_NUM_BANDS]; + float betaDequant[IVAS_MAX_NUM_BANDS]; + + if ( parType == ALPHA ) + { + quantize_alpha( npar, pars, quant_type, &nq, alphaQuant, alphaDequant ); + } + else + { + quantize_alpha( npar, alphas, quant_type, &nq, alphaQuant, alphaDequant ); + quantize_beta( npar, pars, alphaQuant, quant_type, &nq, betaQuant, betaDequant ); + } + if ( hMCParamUpmix->first_frame ) + { + mvl2l( &( alphaQuant[0] ), &( hMCParamUpmix->alpha_quant_prev[ch][0] ), IVAS_MAX_NUM_BANDS ); + if ( parType == BETA ) + { + mvl2l( &( betaQuant[0] ), &( hMCParamUpmix->beta_quant_prev[ch][0] ), IVAS_MAX_NUM_BANDS ); + if ( ch == ( MC_PARAMUPMIX_COMBINATIONS - 1 ) ) + { + hMCParamUpmix->first_frame = 0; + } + } + } + + /* Always one parameter set per frame for transient frames. Original PS framing is used internally. */ + if ( parType == ALPHA ) + { + huffman_encode( onlyFreq, 1, npar, 0, hMCParamUpmix->alpha_quant_prev[ch], alphaQuant, ALPHA, quant_type, nq, bit_buffer, bit_pos ); + } + else + { + huffman_encode( onlyFreq, 1, npar, 0, hMCParamUpmix->beta_quant_prev[ch], betaQuant, BETA, quant_type, nq, bit_buffer, bit_pos ); + } + + if ( parType == ALPHA ) + { + mvl2l( alphaQuant, hMCParamUpmix->alpha_quant_prev[ch], IVAS_MAX_NUM_BANDS ); + } + else + { + mvl2l( betaQuant, hMCParamUpmix->beta_quant_prev[ch], IVAS_MAX_NUM_BANDS ); + } +} + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dmx() + * + * Computes the time domain down mix signal + *------------------------------------------------------------------------*/ + +static void ivas_mc_paramupmix_dmx( + MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, /* i/o: MC ParamUpmix encoder handle */ + float data_f[][L_FRAME48k], /* i/o : Input, downmix out */ + const int16_t input_frame /* i : Input frame length */ +) +{ + int16_t i, l; + int16_t chan1s[4] = { 4, 5, 8, 9 }; + int16_t chan2s[4] = { 6, 7, 10, 11 }; + int16_t chanOut[4] = { 4, 5, 6, 7 }; + int16_t chanZero[4] = { 8, 9, 10, 11 }; + + /* boxes = { 0 1 2 3 [4 6] [5 7] [8 10] [9 11] }; */ + /* 9+11 -> 7 */ + /* 8+10 -> 6 */ + /* 5+7 -> 5 */ + /* 4+6 -> 4 */ + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + for ( l = 0; l < input_frame; l++ ) + { + /* mid */ + hMCParamUpmix->midside[i][0][l] = ( data_f[chan1s[i]][l] + data_f[chan2s[i]][l] ) * (float) 0.5; + /* side */ + hMCParamUpmix->midside[i][1][l] = ( data_f[chan1s[i]][l] - data_f[chan2s[i]][l] ) * (float) 0.5; + data_f[chanOut[i]][l] = hMCParamUpmix->midside[i][0][l]; + } + } + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + set_zero( data_f[chanZero[i]], input_frame ); + } + return; +} + + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_param_est_enc() + * + * run the CLDFB analysis on the input signal + * estimate the input and down mix covariances + *------------------------------------------------------------------------*/ + +static void ivas_mc_paramupmix_param_est_enc( + MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix, /* i/o: MC Param-Upmix encoder handle */ + float input_frame_t[][L_FRAME48k], /* i : Input frame in the time domain */ + const int16_t input_frame, /* i : Input frame length */ + float alphas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS], + float betas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS] ) +{ + float *pcm_in[MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH]; + float fr_realbuffer[MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH][L_FRAME48k]; + float fr_imagbuffer[MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH][L_FRAME48k]; + float FR_Real_Mid[L_FRAME48k], FR_Imag_Mid[L_FRAME48k]; + float *p_fr_realbuffer[MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH]; + float *p_fr_imagbuffer[MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH]; + float *pp_in_fr_real[MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH]; + float *pp_in_fr_imag[MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH]; + float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; + float rxx, rxy, ryy, cmat, rxxest, drxx, wetaux; + + int16_t l_ts; + int16_t b, i, j, ts, bnd; + + int16_t transient_det[MC_PARAMUPMIX_COMBINATIONS][2]; + int16_t transient_det_l[2], transient_det_r[2]; + int16_t chan1s[4] = { 4, 5, 8, 9 }; + int16_t chan2s[4] = { 6, 7, 10, 11 }; + +#ifdef SPAR_TUNING + const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; +#endif + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + pcm_in[2 * i] = input_frame_t[chan1s[i]]; + pcm_in[2 * i + 1] = input_frame_t[chan2s[i]]; + } + + /*-----------------------------------------------------------------------------------------* + * Transient detector + *-----------------------------------------------------------------------------------------*/ + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) + { + ivas_transient_det_process( hMCParamUpmix->hTranDet[2 * i], pcm_in[2 * i], input_frame, transient_det_l ); + ivas_transient_det_process( hMCParamUpmix->hTranDet[2 * i + 1], pcm_in[2 * i + 1], input_frame, transient_det_r ); + transient_det[i][0] = transient_det_l[0] || transient_det_r[0]; + transient_det[i][1] = transient_det_l[0] || transient_det_r[0]; + /* should probably be transient_det_l[1] || transient_det_r[1] , but choosing 0 reproduces the before merge state */ + } + + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH; i++ ) + { + p_fr_realbuffer[i] = fr_realbuffer[i]; + p_fr_imagbuffer[i] = fr_imagbuffer[i]; + } + + /* prepare Parameter MDFT analysis */ + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH; i++ ) + { + pp_in_fr_real[i] = p_fr_realbuffer[i]; + pp_in_fr_imag[i] = p_fr_imagbuffer[i]; + } + + l_ts = input_frame / MAX_PARAM_SPATIAL_SUBFRAMES; + for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) + { + ivas_fb_mixer_get_windowed_fr( hMCParamUpmix->hFbMixer, pcm_in, pp_in_fr_real, pp_in_fr_imag, l_ts, l_ts +#ifdef HODIRAC + , + hMCParamUpmix->hFbMixer->fb_cfg->num_in_chans +#endif + ); + ivas_fb_mixer_update_prior_input( hMCParamUpmix->hFbMixer, pcm_in, l_ts +#ifdef HODIRAC + , + hMCParamUpmix->hFbMixer->fb_cfg->num_in_chans +#endif + ); + for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH; i++ ) + { + pcm_in[i] += l_ts; + pp_in_fr_real[i] += l_ts; + pp_in_fr_imag[i] += l_ts; + } + } + + /*-----------------------------------------------------------------------------------------* + * Covariance process + *-----------------------------------------------------------------------------------------*/ + for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) + { + pp_in_fr_real[0] = p_fr_realbuffer[2 * b]; + pp_in_fr_imag[0] = p_fr_imagbuffer[2 * b]; + pp_in_fr_real[1] = FR_Real_Mid; + pp_in_fr_imag[1] = FR_Imag_Mid; + v_add( pp_in_fr_real[0], p_fr_realbuffer[2 * b + 1], pp_in_fr_real[1], L_FRAME48k ); + v_add( pp_in_fr_imag[0], p_fr_imagbuffer[2 * b + 1], pp_in_fr_imag[1], L_FRAME48k ); + for ( i = 0; i < MC_PARAMUPMIX_NCH; i++ ) + { + for ( j = 0; j < MC_PARAMUPMIX_NCH; j++ ) + { + cov_real[i][j] = hMCParamUpmix->cov_real[b][i][j]; + cov_dtx_real[i][j] = hMCParamUpmix->cov_dtx_real[b][i][j]; + } + } +#ifdef SPAR_TUNING + ivas_enc_cov_handler_process( hMCParamUpmix->hCovEnc[b], pp_in_fr_real, pp_in_fr_imag, cov_real, cov_dtx_real, hMCParamUpmix->hFbMixer->pFb, 0, hMCParamUpmix->hFbMixer->pFb->filterbank_num_bands, MC_PARAMUPMIX_NCH, 0 /*dtx_vad*/, transient_det[b], HOA_md_ind ); +#else + ivas_enc_cov_handler_process( hMCParamUpmix->hCovEnc[b], pp_in_fr_real, pp_in_fr_imag, cov_real, cov_dtx_real, hMCParamUpmix->hFbMixer->pFb, 0, hMCParamUpmix->hFbMixer->pFb->filterbank_num_bands, MC_PARAMUPMIX_NCH, 0 /*dtx_vad*/, transient_det[b] ); +#endif + } + + for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) + { + for ( bnd = 0; bnd < IVAS_MAX_NUM_BANDS; bnd++ ) + { + rxy = hMCParamUpmix->cov_real[b][1][0][bnd]; + ryy = hMCParamUpmix->cov_real[b][1][1][bnd]; + cmat = rxy / ( ryy + EPSILON ); + alphas[b][bnd] = (float) 2.0 * cmat - (float) 1.0; + + rxx = hMCParamUpmix->cov_real[b][0][0][bnd]; + rxxest = cmat * cmat * ryy; + drxx = rxx - rxxest; + drxx = (float) max( drxx, 0.0 ); + wetaux = (float) sqrt( drxx / ( ryy + EPSILON ) ); + betas[b][bnd] = (float) 2.0 * wetaux; + } + } + + return; +} + +#endif diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index e456cb3b70bf5b31d15f3062947fc33bce6f09a9..ba378ab1d68b673a3ffde43e29e168c2444ce7d8 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -34,7 +34,6 @@ #include #include #include - #include "ivas_cnst.h" #include "ivas_prot.h" #include "options.h" @@ -111,7 +110,7 @@ ivas_error ivas_mcmasa_enc_open( assert( st_ivas->hMasa != NULL && "MASA encoder handle is not present" ); hMasa = st_ivas->hMasa; - if ( NULL == ( hMcMasa = (MCMASA_ENC_HANDLE) malloc( sizeof( MCMASA_ENC_DATA ) ) ) ) + if ( ( hMcMasa = (MCMASA_ENC_HANDLE) malloc( sizeof( MCMASA_ENC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); } @@ -189,13 +188,18 @@ ivas_error ivas_mcmasa_enc_open( } /* set FB config. */ - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MASA_FORMAT, SBA_MODE_NONE, numAnalysisChannels, 0, 0, input_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfg, MASA_FORMAT, SBA_MODE_NONE, numAnalysisChannels, 0, 0, input_Fs +#ifdef HODIRAC + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } /* Allocate and initialize FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -204,21 +208,33 @@ ivas_error ivas_mcmasa_enc_open( if ( hMcMasa->separateChannelEnabled ) { /* TD Energy calculation with LP */ - hMcMasa->delay_buffer_lfe[0] = (float *) malloc( NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) * sizeof( float ) ); + if ( ( hMcMasa->delay_buffer_lfe[0] = (float *) malloc( NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->delay_buffer_lfe[0], NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) ); - hMcMasa->delay_buffer_lfe[1] = (float *) malloc( NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) * sizeof( float ) ); + + if ( ( hMcMasa->delay_buffer_lfe[1] = (float *) malloc( NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->delay_buffer_lfe[1], NS2SA( input_Fs, DELAY_DIRAC_ENC_CMP_NS + DIRAC_SLOT_ENC_NS ) ); hMcMasa->hFbMixerLfe = NULL; } else { /* Allocate and initialize FB mixer handle for LFE channel */ - if ( ( error = ivas_fb_set_cfg( &fb_cfgLfe, MASA_FORMAT, SBA_MODE_NONE, 1, 0, 0, input_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_fb_set_cfg( &fb_cfgLfe, MASA_FORMAT, SBA_MODE_NONE, 1, 0, 0, input_Fs +#ifdef HODIRAC + , + 0 +#endif + ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixerLfe ), input_Fs, fb_cfgLfe ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_FB_mixer_open( &( hMcMasa->hFbMixerLfe ), input_Fs, fb_cfgLfe, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -236,7 +252,10 @@ ivas_error ivas_mcmasa_enc_open( bufferSize = (int16_t) ( ( input_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES ); for ( i = 0; i < 2; i++ ) { - hMcMasa->lfeAnaRingBuffer[i] = (float *) malloc( bufferSize * sizeof( float ) ); + if ( ( hMcMasa->lfeAnaRingBuffer[i] = (float *) malloc( bufferSize * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->lfeAnaRingBuffer[i], bufferSize ); hMcMasa->lowpassSum[i] = 0.0f; } @@ -250,33 +269,56 @@ ivas_error ivas_mcmasa_enc_open( /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hMcMasa->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ); + if ( ( hMcMasa->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - hMcMasa->direction_vector_m[i][j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ); + if ( ( hMcMasa->direction_vector_m[i][j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } } } hMcMasa->no_col_avg_diff = (int8_t) ( DIRAC_NO_COL_AVG_DIFF_NS / dirac_slot_ns ); for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hMcMasa->buffer_intensity_real[i] = (float **) malloc( hMcMasa->no_col_avg_diff * sizeof( float * ) ); + if ( ( hMcMasa->buffer_intensity_real[i] = (float **) malloc( hMcMasa->no_col_avg_diff * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + for ( j = 0; j < hMcMasa->no_col_avg_diff; j++ ) { - hMcMasa->buffer_intensity_real[i][j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ); + if ( ( hMcMasa->buffer_intensity_real[i][j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->buffer_intensity_real[i][j], hMcMasa->nbands ); } } - hMcMasa->buffer_intensity_real_vert = (float **) malloc( hMcMasa->no_col_avg_diff * sizeof( float * ) ); + if ( ( hMcMasa->buffer_intensity_real_vert = (float **) malloc( hMcMasa->no_col_avg_diff * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } + for ( j = 0; j < hMcMasa->no_col_avg_diff; j++ ) { - hMcMasa->buffer_intensity_real_vert[j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ); + if ( ( hMcMasa->buffer_intensity_real_vert[j] = (float *) malloc( hMcMasa->nbands * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->buffer_intensity_real_vert[j], hMcMasa->nbands ); } - hMcMasa->buffer_energy = (float *) malloc( hMcMasa->nbands * hMcMasa->no_col_avg_diff * sizeof( float ) ); + if ( ( hMcMasa->buffer_energy = (float *) malloc( hMcMasa->nbands * hMcMasa->no_col_avg_diff * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); + } set_zero( hMcMasa->buffer_energy, hMcMasa->nbands * hMcMasa->no_col_avg_diff ); if ( st_ivas->hEncoderConfig->mc_input_setup == MC_LS_SETUP_5_1 ) @@ -418,8 +460,8 @@ ivas_error ivas_mcmasa_enc_reconfig( /* bitrate changed, may need to do something */ /* brute-force solution: close McMASA and re-instantiate with new settings */ - ivas_masa_enc_close( st_ivas->hMasa, st_ivas->nchan_transport, st_ivas->hEncoderConfig->ivas_format ); - ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); + ivas_masa_enc_close( &( st_ivas->hMasa ) ); + ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); /* Determine if to separate some channels from the analysis */ ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->hEncoderConfig->element_mode_init ), ivas_total_brate ); @@ -447,30 +489,33 @@ ivas_error ivas_mcmasa_enc_reconfig( *--------------------------------------------------------------------------*/ void ivas_mcmasa_enc_close( - MCMASA_ENC_HANDLE hMcMasa, /* i/o: encoder McMASA handle */ - const int32_t input_Fs /* i : input sampling rate */ + MCMASA_ENC_HANDLE *hMcMasa, /* i/o: encoder McMASA handle */ + const int32_t input_Fs /* i : input sampling rate */ ) { int16_t i, j; - if ( hMcMasa->separateChannelEnabled ) + if ( hMcMasa == NULL || *hMcMasa == NULL ) { - free( hMcMasa->delay_buffer_lfe[0] ); - free( hMcMasa->delay_buffer_lfe[1] ); + return; } - if ( hMcMasa->separateChannelEnabled ) + + if ( ( *hMcMasa )->separateChannelEnabled ) { + free( ( *hMcMasa )->delay_buffer_lfe[0] ); + free( ( *hMcMasa )->delay_buffer_lfe[1] ); + for ( i = 0; i < 2; i++ ) { - free( hMcMasa->lfeAnaRingBuffer[i] ); + free( ( *hMcMasa )->lfeAnaRingBuffer[i] ); } } - ivas_FB_mixer_close( &hMcMasa->hFbMixer, input_Fs ); + ivas_FB_mixer_close( &( *hMcMasa )->hFbMixer, input_Fs, 0 ); - if ( !hMcMasa->separateChannelEnabled ) + if ( !( *hMcMasa )->separateChannelEnabled ) { - ivas_FB_mixer_close( &hMcMasa->hFbMixerLfe, input_Fs ); + ivas_FB_mixer_close( &( *hMcMasa )->hFbMixerLfe, input_Fs, 0 ); } /* intensity 3-dim */ @@ -478,35 +523,36 @@ void ivas_mcmasa_enc_close( { for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - free( hMcMasa->direction_vector_m[i][j] ); - hMcMasa->direction_vector_m[i][j] = NULL; + free( ( *hMcMasa )->direction_vector_m[i][j] ); + ( *hMcMasa )->direction_vector_m[i][j] = NULL; } - for ( j = 0; j < hMcMasa->no_col_avg_diff; j++ ) + for ( j = 0; j < ( *hMcMasa )->no_col_avg_diff; j++ ) { - free( hMcMasa->buffer_intensity_real[i][j] ); - hMcMasa->buffer_intensity_real[i][j] = NULL; + free( ( *hMcMasa )->buffer_intensity_real[i][j] ); + ( *hMcMasa )->buffer_intensity_real[i][j] = NULL; } - free( hMcMasa->buffer_intensity_real[i] ); - hMcMasa->buffer_intensity_real[i] = NULL; + free( ( *hMcMasa )->buffer_intensity_real[i] ); + ( *hMcMasa )->buffer_intensity_real[i] = NULL; - free( hMcMasa->direction_vector_m[i] ); - hMcMasa->direction_vector_m[i] = NULL; + free( ( *hMcMasa )->direction_vector_m[i] ); + ( *hMcMasa )->direction_vector_m[i] = NULL; } - for ( j = 0; j < hMcMasa->no_col_avg_diff; j++ ) + for ( j = 0; j < ( *hMcMasa )->no_col_avg_diff; j++ ) { - free( hMcMasa->buffer_intensity_real_vert[j] ); - hMcMasa->buffer_intensity_real_vert[j] = NULL; + free( ( *hMcMasa )->buffer_intensity_real_vert[j] ); + ( *hMcMasa )->buffer_intensity_real_vert[j] = NULL; } - free( hMcMasa->buffer_intensity_real_vert ); - hMcMasa->buffer_intensity_real_vert = NULL; + free( ( *hMcMasa )->buffer_intensity_real_vert ); + ( *hMcMasa )->buffer_intensity_real_vert = NULL; - free( hMcMasa->buffer_energy ); - hMcMasa->buffer_energy = NULL; + free( ( *hMcMasa )->buffer_energy ); + ( *hMcMasa )->buffer_energy = NULL; - free( hMcMasa ); + free( ( *hMcMasa ) ); + ( *hMcMasa ) = NULL; return; } @@ -530,15 +576,12 @@ void ivas_mcmasa_enc( int16_t i, j, k; int16_t nBands = hMcMasa->nbands; int16_t nBlocks = MAX_PARAM_SPATIAL_SUBFRAMES; - uint8_t fixedDistance = 0; - float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; - float separatedChannelSignal[L_FRAME48k]; /* Compute low frequency energy */ @@ -712,10 +755,17 @@ void ivas_mcmasa_param_est_enc( float Chnl_ImagBuffer[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX]; float *p_Chnl_RealBuffer[MCMASA_MAX_ANA_CHANS]; float *p_Chnl_ImagBuffer[MCMASA_MAX_ANA_CHANS]; +#ifdef HODIRAC + float Foa_RealBuffer[FOA_CHANNELS][DIRAC_NO_FB_BANDS_MAX]; + float Foa_ImagBuffer[FOA_CHANNELS][DIRAC_NO_FB_BANDS_MAX]; + float FoaEven_RealBuffer[FOA_CHANNELS][DIRAC_NO_FB_BANDS_MAX]; + float FoaEven_ImagBuffer[FOA_CHANNELS][DIRAC_NO_FB_BANDS_MAX]; +#else float Foa_RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX]; float Foa_ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX]; float FoaEven_RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX]; float FoaEven_ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX]; +#endif float intensity_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float intensity_even_real[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; float direction_vector[DIRAC_NUM_DIMS][MASA_FREQUENCY_BANDS]; @@ -765,7 +815,6 @@ void ivas_mcmasa_param_est_enc( set_zero( coherentEnergyRatio[0], hMcMasa->nbands ); } - /* Copy current frame to memory for delay compensation */ for ( i = 0; i < numAnalysisChannels; i++ ) { @@ -799,8 +848,18 @@ void ivas_mcmasa_param_est_enc( for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { - ivas_fb_mixer_get_windowed_fr( hMcMasa->hFbMixer, pcm_in, p_Chnl_RealBuffer, p_Chnl_ImagBuffer, l_ts, l_ts ); - ivas_fb_mixer_update_prior_input( hMcMasa->hFbMixer, pcm_in, l_ts ); + ivas_fb_mixer_get_windowed_fr( hMcMasa->hFbMixer, pcm_in, p_Chnl_RealBuffer, p_Chnl_ImagBuffer, l_ts, l_ts +#ifdef HODIRAC + , + hMcMasa->hFbMixer->fb_cfg->num_in_chans +#endif + ); + ivas_fb_mixer_update_prior_input( hMcMasa->hFbMixer, pcm_in, l_ts +#ifdef HODIRAC + , + hMcMasa->hFbMixer->fb_cfg->num_in_chans +#endif + ); for ( i = 0; i < numAnalysisChannels; i++ ) { pcm_in[i] += l_ts; @@ -941,7 +1000,12 @@ void ivas_mcmasa_param_est_enc( reference_power[ts], 0, num_freq_bands, - SBA_MODE_NONE ); + SBA_MODE_NONE +#ifdef HODIRAC + , + FOA_CHANNELS +#endif + ); /* Fill buffers of length "averaging_length" time slots for intensity and energy */ hMcMasa->index_buffer_intensity = ( hMcMasa->index_buffer_intensity % hMcMasa->no_col_avg_diff ) + 1; /* averaging_length = 32 */ @@ -1182,6 +1246,7 @@ void ivas_mcmasa_param_est_enc( { numSubFramesForRatio = MAX_PARAM_SPATIAL_SUBFRAMES; } + for ( i = 0; i < numSubFramesForRatio; i++ ) { for ( j = 0; j < hMcMasa->nbands; j++ ) @@ -1387,7 +1452,6 @@ static void ivas_mcmasa_dmx( /* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */ - static void compute_cov_mtx( float sr[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : Input matrix, real, s[ch][freq] */ float si[MCMASA_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : Input matrix, imag, s[ch][freq] */ @@ -1670,8 +1734,18 @@ static void computeLfeEnergy( for ( ts = mrange[0]; ts < mrange[1]; ts++ ) { - ivas_fb_mixer_get_windowed_fr( hMcMasa->hFbMixerLfe, pcm_in, p_Chnl_RealBuffer, p_Chnl_ImagBuffer, l_ts, l_ts ); - ivas_fb_mixer_update_prior_input( hMcMasa->hFbMixerLfe, pcm_in, l_ts ); + ivas_fb_mixer_get_windowed_fr( hMcMasa->hFbMixerLfe, pcm_in, p_Chnl_RealBuffer, p_Chnl_ImagBuffer, l_ts, l_ts +#ifdef HODIRAC + , + hMcMasa->hFbMixerLfe->fb_cfg->num_in_chans +#endif + ); + ivas_fb_mixer_update_prior_input( hMcMasa->hFbMixerLfe, pcm_in, l_ts +#ifdef HODIRAC + , + hMcMasa->hFbMixerLfe->fb_cfg->num_in_chans +#endif + ); pcm_in[0] += l_ts; /* Compute low frequency energy for LFE, for other channels it is computed in ivas_chnl_param_est_enc() */ diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 08e54c9bf9ad6606f11fc121440e8479c5641441..d1f47bcee301d0879caedf5377967cae0d38e021 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -51,7 +51,6 @@ *----------------------------------------------------------*/ static void FindChannelRatio( - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ Encoder_State **sts, /* i/o: encoder state structure */ int16_t chBitRatios[MCT_MAX_CHANNELS], /* o : bit-disctribution channel ratios */ const int16_t nChannels /* i : number of channels to be coded */ @@ -69,7 +68,7 @@ static void FindChannelRatio( sum_nrg = 0; for ( i = 0; i < nChannels; i++ ) { - if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { sum_nrg += nrg[i]; } @@ -78,7 +77,7 @@ static void FindChannelRatio( for ( i = 0; i < nChannels; i++ ) { - if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[i]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[i]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { chRatio = nrg[i] * sum_nrg; chBitRatios[i] = min( BITRATE_MCT_RATIO_RANGE - 1, max( 1, (uint16_t) ( BITRATE_MCT_RATIO_RANGE * chRatio + 0.5f ) ) ); @@ -87,15 +86,10 @@ static void FindChannelRatio( { chBitRatios[i] = 0; } - else if ( hMCT->num_lfe ) - { - assert( sts[i]->mct_chan_mode == MCT_CHAN_MODE_LFE ); - chBitRatios[i] = !hMCT->LFE_off; - } } #ifdef DEBUG_MODE_MDCT - for ( i = 0; i < nchan; i++ ) + for ( i = 0; i < nChannels; i++ ) { dbgwrite( &chBitRatios[i], sizeof( int16_t ), 1, 1, "./res/chBitRatio" ); /* dbgwrite(&chRatio[i], sizeof(float),1,1,"./res/chRatio");*/ @@ -237,6 +231,8 @@ void ivas_mct_core_enc( total_side_bits = 0; nCPE = nChannels / CPE_CHANNELS; + + /*in case of odd number of channels*/ if ( ( nCPE * CPE_CHANNELS ) != nChannels ) { nCPE++; @@ -255,7 +251,7 @@ void ivas_mct_core_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { sts[i] = hCPE[cpe_id]->hCoreCoder[ch]; - if ( hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { i++; continue; @@ -304,7 +300,8 @@ void ivas_mct_core_enc( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && hMCT->LFE_off ) || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -332,7 +329,8 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -379,7 +377,8 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -411,7 +410,8 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -432,7 +432,8 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { st = sts[ch]; - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -445,7 +446,8 @@ void ivas_mct_core_enc( { st = sts[ch]; - if ( ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -460,8 +462,8 @@ void ivas_mct_core_enc( write_mct_bitstream( sts, hMCT, nChannels ); - FindChannelRatio( hMCT, sts, chBitRatios, nChannels ); - + FindChannelRatio( + sts, chBitRatios, nChannels ); nAvailBits = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - NBITS_BWIDTH - hMCT->nBitsMCT - lfe_bits ); @@ -474,7 +476,11 @@ void ivas_mct_core_enc( } else if ( ivas_format == SBA_FORMAT ) { +#ifdef COMBINED_FORMAT_SIGNALING + nAvailBits -= IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; +#else nAvailBits -= IVAS_FORMAT_SIGNALING_NBITS_SBA; +#endif nAvailBits -= SBA_ORDER_BITS + SBA_PLANAR_BITS; } @@ -489,13 +495,14 @@ void ivas_mct_core_enc( /*substract bits needed for the bitrate ratios */ for ( ch = 0; ch < nChannels; ch++ ) { - if ( ( ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } nAvailBits -= NBBITS_MCT_RATIO; } - nAvailBits -= total_side_bits + ( hMCT->num_lfe ? 1 : 0 ) + hMCT->nchan_out_woLFE; /* if MC 1 extra bit that was initially send to signal LFE_off */ + nAvailBits -= total_side_bits + hMCT->nchan_out_woLFE; /* if MC 1 extra bit that was initially send to signal LFE_off */ #ifdef DEBUG_MODE_MDCT dbgwrite( &nAvailBits, sizeof( int16_t ), 1, 1, "./res/availBits" ); @@ -509,7 +516,8 @@ void ivas_mct_core_enc( for ( ch = 0; ch < nChannels; ch++ ) { - if ( ( ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -532,15 +540,11 @@ void ivas_mct_core_enc( { continue; } - - if ( !( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && hMCT->LFE_off ) ) /* indicates LFE with no content */ - { - st->total_brate = ( st->bits_frame_channel + st->side_bits_frame_channel ) * FRAMES_PER_SEC; + st->total_brate = ( st->bits_frame_channel + st->side_bits_frame_channel ) * FRAMES_PER_SEC; #ifdef DEBUGGING - total_brate += st->total_brate; + total_brate += st->total_brate; #endif - } } #ifdef DEBUGGING if ( hCPE[cpe_id]->hMetaData != NULL ) @@ -551,8 +555,12 @@ void ivas_mct_core_enc( } #ifdef DEBUGGING +#ifdef COMBINED_FORMAT_SIGNALING + format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + SBA_ORDER_BITS + SBA_PLANAR_BITS ); +#else format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_SBA + SBA_ORDER_BITS + SBA_PLANAR_BITS ); - mct_bits += hMCT->nBitsMCT + ( hMCT->num_lfe ? 1 : 0 ) + hMCT->nchan_out_woLFE; +#endif + mct_bits += hMCT->nBitsMCT + hMCT->nchan_out_woLFE; assert( ( total_brate + ( NBITS_BWIDTH + format_bits + mct_bits + sba_meta + lfe_bits ) * FRAMES_PER_SEC ) == ivas_total_brate ); #endif diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 5da41e279e1fbd8fa4264cb1f96e7e4975fea974..393c60f49eada48a8d03d7d4c1baa127fb8df467 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -90,7 +90,66 @@ static void set_mct_enc_params( return; } +/*-------------------------------------------------------------------* + * map_input_to_cpe_channels() + * + * for MC_MODE map input channels to cpe channels + * mid channel (ch==2) is mapped to last odd-channel CPE + * all channels after LFE are mapped to cpe_id=1 and onwards + * E.g. for 5_1 and for 3 CPEs: + * cpe_id 0: L=data[0] R=data[1] + * cpe_id 1: L=data[4] R=data[5] + * cpe_id 2: L=data[2] (mid) R=NULL + *-------------------------------------------------------------------*/ +static void map_input_to_cpe_channels( + const Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + float *pdata[MAX_INPUT_CHANNELS], /* o: mapped input pointers */ + float data[MCT_MAX_CHANNELS][L_FRAME48k] /* i: input channel data */ +) +{ + int16_t i, n; + + i = 0; + for ( n = 0; n < LFE_CHANNEL - 1; n++ ) + { + pdata[i] = data[n]; + i++; + } +#ifdef MC_PARAMUPMIX_MODE + if ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) +#else + if ( st_ivas->hEncoderConfig->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) +#endif + { + for ( n = LFE_CHANNEL + 1; n < st_ivas->nchan_transport; n++ ) + { + pdata[i] = data[n]; + i++; + } + pdata[i] = data[LFE_CHANNEL - 1]; + } + else + { + for ( ; n < st_ivas->nchan_transport; n++ ) + { + pdata[i] = data[n]; + i++; + } + } + + /* odd channel CPE*/ +#ifdef MC_PARAMUPMIX_MODE + if ( ( st_ivas->nchan_transport < st_ivas->nCPE * CPE_CHANNELS ) || ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hMCT->nchan_out_woLFE < st_ivas->nCPE * CPE_CHANNELS ) ) +#else + if ( ( st_ivas->nchan_transport < st_ivas->nCPE * CPE_CHANNELS ) || ( st_ivas->mc_mode == MC_MODE_MCT && st_ivas->hMCT->nchan_out_woLFE < st_ivas->nCPE * CPE_CHANNELS ) ) +#endif + { + pdata[st_ivas->nCPE * CPE_CHANNELS - 1] = NULL; + } + + return; +} /*-------------------------------------------------------------------* * ivas_mct_enc() * @@ -114,6 +173,7 @@ ivas_error ivas_mct_enc( int16_t max_bwidth; int32_t ivas_total_brate; ivas_error error; + float *pdata[MAX_INPUT_CHANNELS]; error = IVAS_ERR_OK; @@ -130,7 +190,7 @@ ivas_error ivas_mct_enc( #ifdef DEBUG_FORCE_MCT_CP if ( ivas_format == MC_FORMAT ) { - assert( "Debugging switch works only with SBA modes" ); + assert( !"Debugging switch works only with SBA modes" ); } #endif @@ -143,11 +203,17 @@ ivas_error ivas_mct_enc( hMCT->p_orig_spectrum_long[cpe_id][n] = orig_spectrum_long[cpe_id][n]; hCPE->hCoreCoder[n]->input_bwidth = hCPE->hCoreCoder[n]->last_input_bwidth; /* updated in BWD */ hCPE->hCoreCoder[n]->bwidth = hCPE->hCoreCoder[n]->last_bwidth; /* updated in BWD */ + /* reset channel mode from previous state*/ + if ( ( hCPE->cpe_id * CPE_CHANNELS + n ) >= hMCT->nchan_out_woLFE ) + { + hCPE->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + } + else + { + hCPE->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; + } } } - - hMCT->LFE_off = 1; /* disable LFE coding by default for the moment */ - /* reconfiguration in case of bitrate switching */ if ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate ) { @@ -163,26 +229,39 @@ ivas_error ivas_mct_enc( /* set coded audio band-width */ switch_bw = set_bw_mct( st_ivas->hCPE, st_ivas->nCPE ); + /*for MC and MCT remove pointer to LFE input that has been processed seperately */ + map_input_to_cpe_channels( st_ivas, pdata, data ); /* pre-processing */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - if ( ( error = ivas_cpe_enc( st_ivas, cpe_id, data[cpe_id * CPE_CHANNELS], data[cpe_id * CPE_CHANNELS + 1], input_frame, nb_bits_metadata ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_cpe_enc( st_ivas, cpe_id, pdata[cpe_id * CPE_CHANNELS], pdata[cpe_id * CPE_CHANNELS + 1], input_frame, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; } } /* joint MCT encoding */ - ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, hMCT->nchan_out_woLFE + hMCT->num_lfe, ivas_total_brate, switch_bw, +#ifdef MC_PARAMUPMIX_MODE + ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, + hMCT->nchan_out_woLFE, + ivas_total_brate, switch_bw, + ( ivas_format == MC_FORMAT && ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, + st_ivas->hEncoderConfig->sba_order ); +#else + ivas_mct_core_enc( ivas_format, hMCT, st_ivas->hCPE, + hMCT->nchan_out_woLFE, + ivas_total_brate, switch_bw, ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ? (int16_t) st_ivas->hLFE->lfe_bits : 0, st_ivas->hEncoderConfig->sba_order ); +#endif /* Spectrum quantization and coding */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { hCPE = st_ivas->hCPE[cpe_id]; - ivas_mdct_quant_coder( hCPE, hMCT->LFE_off, hMCT->tnsBits[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], 1 ); + ivas_mdct_quant_coder( hCPE, + hMCT->tnsBits[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], 1 ); /* update input samples buffer (as done in ivas_cpe_enc() for other than MCT coding) */ for ( n = 0; n < CPE_CHANNELS; n++ ) @@ -237,23 +316,24 @@ ivas_error create_mct_enc( if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) { hMCT->nchan_out_woLFE = st_ivas->hEncoderConfig->nchan_inp - 1; /* LFE channel is coded separately */ - hMCT->num_lfe = TRUE; } else if ( ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = ivas_get_sba_num_TCs( ivas_total_brate, st_ivas->sba_analysis_order ); - - hMCT->num_lfe = FALSE; } else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) { hMCT->nchan_out_woLFE = ivas_param_mc_getNumTransportChannels( ivas_total_brate, st_ivas->hEncoderConfig->mc_input_setup ); - hMCT->num_lfe = FALSE; } +#ifdef MC_PARAMUPMIX_MODE + else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + hMCT->nchan_out_woLFE = ivas_mc_paramupmix_getNumTransportChannels(); + } +#endif else if ( ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = ivas_sba_get_nchan( st_ivas->sba_analysis_order, st_ivas->hEncoderConfig->sba_planar ); - hMCT->num_lfe = FALSE; } else { @@ -262,21 +342,17 @@ ivas_error create_mct_enc( cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; - /* indicate LFE for appropriate core-coder channel */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) % 2 ) + if ( ( hMCT->nchan_out_woLFE ) % + 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -362,17 +438,20 @@ ivas_error mct_enc_reconfigure( if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) { hMCT->nchan_out_woLFE = st_ivas->hEncoderConfig->nchan_inp - 1; /* LFE channel is coded separately */ - hMCT->num_lfe = TRUE; } +#ifdef MC_PARAMUPMIX_MODE + else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + hMCT->nchan_out_woLFE = ivas_mc_paramupmix_getNumTransportChannels(); + } +#endif else if ( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMMC ) { hMCT->nchan_out_woLFE = ivas_param_mc_getNumTransportChannels( ivas_total_brate, st_ivas->hEncoderConfig->mc_input_setup ); - hMCT->num_lfe = FALSE; } else if ( ivas_format == SBA_FORMAT ) { hMCT->nchan_out_woLFE = st_ivas->nchan_transport; - hMCT->num_lfe = FALSE; } else { @@ -382,22 +461,18 @@ ivas_error mct_enc_reconfigure( cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS; - /* indicate LFE for appropriate core-coder channel */ for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { st_ivas->hCPE[cpe_id]->element_brate = cp_bitrate; for ( n = 0; n < CPE_CHANNELS; n++ ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ( hMCT->num_lfe > 0 ) && ( ( n + cpe_id * CPE_CHANNELS ) == LFE_CHANNEL ) ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } } } /* in case we have an uneven number of transport channels, indicate last channel ID as inactive */ - if ( ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) % 2 ) + if ( ( hMCT->nchan_out_woLFE ) % + 2 ) { st_ivas->hCPE[st_ivas->nCPE - 1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_IGNORE; } @@ -414,10 +489,11 @@ ivas_error mct_enc_reconfigure( st->total_brate = st_ivas->hCPE[cpe_id]->element_brate; - if ( !( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) + if ( !( + ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) ) { st->bits_frame_nominal = (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode ); if ( st->igf ) { IGFEncSetMode( st->hIGFEnc, st_ivas->hCPE[cpe_id]->element_brate, st->bwidth, st->element_mode, st->rf_mode ); @@ -500,29 +576,35 @@ ivas_error mct_enc_reconfigure( *-------------------------------------------------------------------------*/ void ivas_mct_enc_close( - MCT_ENC_HANDLE hMCT /* i/o: MCT encoder structure */ + MCT_ENC_HANDLE *hMCT /* i/o: MCT encoder structure */ ) { int16_t n, maxBlocks; - maxBlocks = hMCT->nchan_out_woLFE / 2; + if ( hMCT == NULL || *hMCT == NULL ) + { + return; + } + + maxBlocks = ( *hMCT )->nchan_out_woLFE / 2; for ( n = 0; n < maxBlocks; n++ ) { - if ( hMCT->hBlockData[n] != NULL ) + if ( ( *hMCT )->hBlockData[n] != NULL ) { - if ( hMCT->hBlockData[n]->hStereoMdct != NULL ) + if ( ( *hMCT )->hBlockData[n]->hStereoMdct != NULL ) { - free( hMCT->hBlockData[n]->hStereoMdct ); - hMCT->hBlockData[n]->hStereoMdct = NULL; + free( ( *hMCT )->hBlockData[n]->hStereoMdct ); + ( *hMCT )->hBlockData[n]->hStereoMdct = NULL; } - free( hMCT->hBlockData[n] ); - hMCT->hBlockData[n] = NULL; + free( ( *hMCT )->hBlockData[n] ); + ( *hMCT )->hBlockData[n] = NULL; } } - free( hMCT ); + free( ( *hMCT ) ); + ( *hMCT ) = NULL; return; } @@ -558,7 +640,10 @@ ivas_error ivas_mc_enc_config( /* MC format switching */ if ( st_ivas->hEncoderConfig->last_ivas_total_brate != st_ivas->hEncoderConfig->ivas_total_brate || st_ivas->mc_mode != last_mc_mode ) { - ivas_mc_enc_reconfig( st_ivas, last_mc_mode ); + if ( ( error = ivas_mc_enc_reconfig( st_ivas, last_mc_mode ) ) != IVAS_ERR_OK ) + { + return error; + } } return error; @@ -599,6 +684,13 @@ static ivas_error ivas_mc_enc_reconfig( if ( last_mc_mode != MC_MODE_MCT ) { +#ifdef MC_PARAMUPMIX_MODE + if ( st_ivas->hLFE != NULL ) + { + /* LFE handle */ + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); + } +#endif /* create LFE handle */ if ( ( error = ivas_create_lfe_enc( &st_ivas->hLFE, st_ivas->hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) { @@ -606,32 +698,65 @@ static ivas_error ivas_mc_enc_reconfig( } /*De-allocate handles for other MC modes*/ - if ( st_ivas->hParamMC != NULL ) - { - ivas_param_mc_enc_close( st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hParamMC = NULL; - } + ivas_param_mc_enc_close( &( st_ivas->hParamMC ), st_ivas->hEncoderConfig->input_Fs ); +#ifdef MC_PARAMUPMIX_MODE + ivas_mc_paramupmix_enc_close( &( st_ivas->hMCParamUpmix ), st_ivas->hEncoderConfig->input_Fs ); +#endif /* De-allocate McMasa-related handles */ - if ( st_ivas->hMcMasa != NULL ) + ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); + + ivas_masa_enc_close( &( st_ivas->hMasa ) ); + + ivas_qmetadata_close( &st_ivas->hQMetaData ); + } + } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + st_ivas->nSCE = 0; + st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / 2; + st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; + + if ( last_mc_mode != MC_MODE_PARAMUPMIX ) + { + if ( st_ivas->hLFE != NULL ) { - ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hMcMasa = NULL; + /* LFE handle */ + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); } - if ( st_ivas->hMasa != NULL ) + /* create LFE handle */ + if ( ( error = ivas_create_lfe_enc( &st_ivas->hLFE, st_ivas->hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) { - ivas_masa_enc_close( st_ivas->hMasa, nchan_transport_old, MC_FORMAT ); - st_ivas->hMasa = NULL; + return error; } + } - if ( st_ivas->hQMetaData != NULL ) + if ( last_mc_mode != MC_MODE_PARAMUPMIX ) + /* This should always be the case, only supporting one bitrate currently */ + { + if ( ( error = ivas_mc_paramupmix_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { - ivas_qmetadata_close( &st_ivas->hQMetaData ); - st_ivas->hQMetaData = NULL; + return error; } } + else + { + assert( 0 ); + } + + /*De-allocate handles for other MC modes*/ + ivas_param_mc_enc_close( &st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); + + /* De-allocate McMasa-related handles */ + ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); + + ivas_masa_enc_close( &( st_ivas->hMasa ) ); + + ivas_qmetadata_close( &st_ivas->hQMetaData ); } +#endif else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { if ( last_mc_mode != MC_MODE_PARAMMC ) @@ -643,39 +768,41 @@ static ivas_error ivas_mc_enc_reconfig( } else { - ivas_param_mc_enc_reconfig( st_ivas ); + if ( ( error = ivas_param_mc_enc_reconfig( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } /* De-allocate McMasa-related handles */ - if ( st_ivas->hMcMasa != NULL ) - { - ivas_mcmasa_enc_close( st_ivas->hMcMasa, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hMcMasa = NULL; - } + ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); + if ( st_ivas->hMasa != NULL ) { - ivas_masa_enc_close( st_ivas->hMasa, nchan_transport_old, MC_FORMAT ); + ivas_masa_enc_close( &( st_ivas->hMasa ) ); st_ivas->hMasa = NULL; } - - if ( st_ivas->hQMetaData != NULL ) +#ifdef MC_PARAMUPMIX_MODE + ivas_mc_paramupmix_enc_close( &( st_ivas->hMCParamUpmix ), st_ivas->hEncoderConfig->input_Fs ); + if ( last_mc_mode == MC_MODE_PARAMUPMIX && st_ivas->hLFE != NULL ) { - ivas_qmetadata_close( &st_ivas->hQMetaData ); - st_ivas->hQMetaData = NULL; + /* LFE handle */ + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); } +#endif + + ivas_qmetadata_close( &st_ivas->hQMetaData ); /* De-allocate MCT handle if last mode was MCT */ - if ( last_mc_mode == MC_MODE_MCT && st_ivas->hMCT != NULL && st_ivas->nchan_transport <= CPE_CHANNELS ) + if ( last_mc_mode == MC_MODE_MCT && st_ivas->nchan_transport <= CPE_CHANNELS ) { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; + ivas_mct_enc_close( &( st_ivas->hMCT ) ); } if ( last_mc_mode == MC_MODE_MCT && st_ivas->hLFE != NULL ) { /* LFE handle */ - ivas_lfe_enc_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); } } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -708,26 +835,22 @@ static ivas_error ivas_mc_enc_reconfig( } } - if ( st_ivas->hParamMC != NULL ) + ivas_param_mc_enc_close( &( st_ivas->hParamMC ), st_ivas->hEncoderConfig->input_Fs ); +#ifdef MC_PARAMUPMIX_MODE + ivas_mc_paramupmix_enc_close( &( st_ivas->hMCParamUpmix ), st_ivas->hEncoderConfig->input_Fs ); + if ( last_mc_mode == MC_MODE_PARAMUPMIX && st_ivas->hLFE != NULL ) { - ivas_param_mc_enc_close( st_ivas->hParamMC, st_ivas->hEncoderConfig->input_Fs ); - st_ivas->hParamMC = NULL; + /* LFE handle */ + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); } +#endif if ( last_mc_mode == MC_MODE_MCT ) { /* LFE handle */ - if ( st_ivas->hLFE != NULL ) - { - ivas_lfe_enc_close( st_ivas->hLFE ); - st_ivas->hLFE = NULL; - } + ivas_lfe_enc_close( &( st_ivas->hLFE ) ); - if ( st_ivas->hMCT != NULL ) - { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; - } + ivas_mct_enc_close( &( st_ivas->hMCT ) ); } } @@ -782,18 +905,10 @@ static ivas_error ivas_mc_enc_reconfig( } } - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); /* set last core to TCX20 */ st->last_core = TCX_20_CORE; } - else if ( last_mc_mode == MC_MODE_PARAMMC && st_ivas->mc_mode == MC_MODE_MCT && nchan_transport_old > 2 ) - { -#ifdef DEBUGGING - assert( st_ivas->hCPE[1] != NULL ); -#endif - st_ivas->hCPE[1]->hCoreCoder[1]->mct_chan_mode = MCT_CHAN_MODE_LFE; - } - if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { ivas_mcmasa_split_brate( st_ivas->hMcMasa->separateChannelEnabled, st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); @@ -803,6 +918,13 @@ static ivas_error ivas_mc_enc_reconfig( new_brate_SCE = 0; new_brate_CPE = ( st_ivas->hEncoderConfig->ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; } +#ifdef MC_PARAMUPMIX_MODE + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + new_brate_SCE = 0; + new_brate_CPE = ( st_ivas->hEncoderConfig->ivas_total_brate / ( st_ivas->nchan_transport - 1 ) ) * CPE_CHANNELS; + } +#endif else { new_brate_SCE = 0; /*st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport;*/ diff --git a/lib_enc/ivas_mct_enc_mct.c b/lib_enc/ivas_mct_enc_mct.c index ee0c529b8bab2758c7f97463529bc6ee1db12e90..7ab6206a29169407d4f8a3b2a6c57d7175684b36 100644 --- a/lib_enc/ivas_mct_enc_mct.c +++ b/lib_enc/ivas_mct_enc_mct.c @@ -62,7 +62,7 @@ void getChannelEnergies( for ( ch = 0; ch < nchan; ch++ ) { st = sts[ch]; - if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; L_subframe = st->hTcxEnc->L_frameTCX / nSubframes; @@ -156,7 +156,7 @@ static void getCorrelationMatrix( int16_t ch1, ch2, n, nchan; float tmp; - nchan = hMCT->nchan_out_woLFE + hMCT->num_lfe; + nchan = hMCT->nchan_out_woLFE; /* correlation */ for ( ch1 = 0; ch1 < nchan; ch1++ ) @@ -166,8 +166,7 @@ static void getCorrelationMatrix( xCorrMatrix[ch1][ch2] = 0; if ( sts[ch1]->core == sts[ch2]->core && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { int16_t nSubframes = ( sts[ch1]->core == TCX_20_CORE ? 1 : NB_DIV ); int16_t L_subframe = sts[ch1]->hTcxEnc->L_frameTCX / nSubframes; @@ -225,9 +224,11 @@ static void getBestCorrelation( *_ch2 = -1; *max_corr = 0.f; - for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch1++ ) + for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE ); + ch1++ ) { - for ( ch2 = ch1 + 1; ch2 < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch2++ ) + for ( ch2 = ch1 + 1; ch2 < ( hMCT->nchan_out_woLFE ); + ch2++ ) { if ( fabsf( *max_corr ) < fabsf( xCorrMatrix[ch1][ch2] ) ) { @@ -308,13 +309,14 @@ static void updateCorrelationMatrix( int16_t ch1, ch2, n; /* correlation: */ - for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch1++ ) + for ( ch1 = 0; ch1 < ( hMCT->nchan_out_woLFE ); + ch1++ ) { - for ( ch2 = ch1; ch2 < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch2++ ) + for ( ch2 = ch1; ch2 < ( hMCT->nchan_out_woLFE ); + ch2++ ) { if ( sts[ch1]->core == sts[ch2]->core && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { int16_t nSubframes = ( sts[ch1]->core == TCX_20_CORE ? 1 : NB_DIV ); @@ -341,9 +343,7 @@ static void updateCorrelationMatrix( static int16_t channelPairToIndex( const int16_t chIdx1, const int16_t chIdx2, - const int16_t nChannels, - Encoder_State **sts /* i/o: encoder state structure */ -) + const int16_t nChannels ) { int16_t ch1, ch2; int16_t pairIdx; @@ -354,11 +354,6 @@ static int16_t channelPairToIndex( { for ( ch1 = 0; ch1 < ch2; ch1++ ) { - if ( sts[ch1]->mct_chan_mode == MCT_CHAN_MODE_LFE || sts[ch2]->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - continue; - } - if ( ch1 == chIdx1 && ch2 == chIdx2 ) { return pairIdx; @@ -398,7 +393,7 @@ static void getGlobalILD( /*calculate total energy without LFE*/ for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { meanE += nrg[ch]; cnt++; @@ -410,7 +405,7 @@ static void getGlobalILD( meanE = max( meanE / cnt, EPSILON ); for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { nSubframes = ( sts[ch]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; L_subframe = sts[ch]->hTcxEnc->L_frameTCX / nSubframes; @@ -483,11 +478,11 @@ void apply_MCT_enc( /*Determine active channels*/ for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { count_active_ch++; } - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + else { hMCT->mc_global_ild[ch] = 0; } @@ -508,8 +503,8 @@ void apply_MCT_enc( { for ( ch1 = 0; ch1 < ch2; ch1++ ) { - if ( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && + sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { sumCorrDiff += fabsf( hMCT->lastxCorrMatrix[ch1][ch2] - xCorrMatrix[ch1][ch2] ); } @@ -600,8 +595,7 @@ void apply_MCT_enc( } /* calculate all related values: */ - assert( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_LFE && - sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_LFE ); + assert( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ); getBlockValues( sts, ch1, ch2, hMCT->hBlockData[currBlockDataCnt], mdst_spectrum, inv_spectrum, inv_mdst_spectrum ); @@ -686,7 +680,7 @@ void apply_MCT_enc( for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { if ( ( !cpEle[ch] ) || hMCT->currBlockDataCnt == 0 ) { @@ -771,7 +765,8 @@ void write_mct_bitstream( /* first write core info and overlap mode for all channels */ for ( ch = 0; ch < nchan; ch++ ) { - if ( ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) && hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( + hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { push_next_indice( hBstr, hMCT->mc_global_ild[ch], SMDCT_GLOBAL_ILD_BITS ); } @@ -781,7 +776,8 @@ void write_mct_bitstream( { for ( ch = 0; ch < nchan; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) + if ( + sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE ) { push_next_indice( hBstr, hMCT->lowE_ch[ch], 1 ); } @@ -794,7 +790,7 @@ void write_mct_bitstream( hBlock = hMCT->hBlockData[pair]; /*calculate channel pair index and write it to BS*/ - channelPairIndex = channelPairToIndex( hBlock->ch1, hBlock->ch2, nchan, sts ); + channelPairIndex = channelPairToIndex( hBlock->ch1, hBlock->ch2, nchan ); push_next_indice( hBstr, channelPairIndex, hMCT->bitsChannelPairIndex ); /*point to encoder states of actual channels to write block pair bits*/ @@ -838,7 +834,7 @@ void mctStereoIGF_enc( int16_t singleChEle[MCT_MAX_CHANNELS]; L_subframeTCX = 0; /* to avoid compilation warning */ - set_s( singleChEle, 1, hMCT->nchan_out_woLFE + hMCT->num_lfe ); + set_s( singleChEle, 1, hMCT->nchan_out_woLFE ); for ( b = 0; b < hMCT->currBlockDataCnt; b++ ) { @@ -889,15 +885,17 @@ void mctStereoIGF_enc( } /* channel elements that are coded separately detected */ - if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE + hMCT->num_lfe ) ) != 0 ) + if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE ) ) != 0 ) { - for ( ch = 0; ch < ( hMCT->nchan_out_woLFE + hMCT->num_lfe ); ch++ ) + for ( ch = 0; ch < ( hMCT->nchan_out_woLFE ); + ch++ ) { if ( singleChEle[ch] ) { st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE || st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( + st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 626dcf2631cee1f65518558caaa04e9a58a22919..8135390f5a9006e9d9fe02039d0837689ac58e99 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -30,6 +30,7 @@ *******************************************************************************************************/ +#include "ivas_cnst.h" #include #include #include "options.h" @@ -38,6 +39,9 @@ #include "prot.h" #include "ivas_prot.h" #include "rom_com.h" +#ifdef SNS_MSVQ +#include "ivas_rom_com.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -88,15 +92,11 @@ static void enc_prm_pre_mdct( { writeTCXWindowing( hBstr, st->hTcxCfg->tcx_last_overlap_mode ); } - - if ( st->element_mode == IVAS_CPE_MDCT && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + push_next_indice( hBstr, st->hTcxEnc->kernel_type[0], st->last_core != ACELP_CORE ? 2 : 1 ); + if ( st->core == TCX_10_CORE ) { - push_next_indice( hBstr, st->hTcxEnc->kernel_type[0], st->last_core != ACELP_CORE ? 2 : 1 ); - if ( st->core == TCX_10_CORE ) - { - assert( ( st->hTcxEnc->kernel_type[0] & 1 ) == ( st->hTcxEnc->kernel_type[1] >> 1 ) ); - push_next_indice( hBstr, st->hTcxEnc->kernel_type[1] & 1, 1 ); - } + assert( ( st->hTcxEnc->kernel_type[0] & 1 ) == ( st->hTcxEnc->kernel_type[1] >> 1 ) ); + push_next_indice( hBstr, st->hTcxEnc->kernel_type[1] & 1, 1 ); } st->glr_reset = 0; @@ -288,7 +288,7 @@ static void kernel_switch_update_transforms( int16_t i, leftOverlap = 0, rightOverlap = 0; const float *left_win, *right_win; - tcx_get_windows( hTcxCfg, (int16_t) windowedTimeSignal[0], (int16_t) windowedTimeSignal[1], &leftOverlap, &left_win, &rightOverlap, &right_win, 1, 0 ); + tcx_get_windows( hTcxCfg, (int16_t) windowedTimeSignal[0], (int16_t) windowedTimeSignal[1], &leftOverlap, &left_win, &rightOverlap, &right_win, 1 ); if ( speech_TCX != NULL && tcxTransType != TCX_20 && (int16_t) windowedTimeSignal[0] == FULL_OVERLAP && s - leftOverlap > minWindowLen ) { for ( i = minWindowLen; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ @@ -311,7 +311,7 @@ static void kernel_switch_update_transforms( s = hTcxCfg->tcx5SizeFB; /* obtain 1st TCX5 again */ nSubframes *= 2; - WindowSignal( hTcxCfg, leftOverlap / 2, RECTANGULAR_OVERLAP, MIN_OVERLAP, &leftOverlap, &rightOverlap, windowedTimeSignal + 2, &s, tcx5Win, 0, 1, 0 ); + WindowSignal( hTcxCfg, leftOverlap / 2, RECTANGULAR_OVERLAP, MIN_OVERLAP, &leftOverlap, &rightOverlap, windowedTimeSignal + 2, &s, tcx5Win, 0, 1 ); kernel_switch_trafo( tcx5Win, sigR, leftOverlap, s /* L_subfr. */ - ( leftOverlap + rightOverlap ) / 2, rightOverlap, kernelType ); if ( kernelType & 1 ) /* 2nd TCX5 is kernelType 3 */ @@ -576,13 +576,18 @@ void ivas_mdct_core_whitening_enc( int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : number of tns parameters put into prm */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to the parameter table */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - int16_t *LFE_off, /* o : flag if LFE has zero content */ const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */ const int16_t nChannels /* i : total number of coded channels */ ) { int16_t n, ch, nSubframes, L_subframe, L_subframeTCX, tcx_subframe_coded_lines; float A_q[CPE_CHANNELS][NB_DIV][M + 1]; +#ifdef SNS_MSVQ + int16_t sns_vq_indices[CPE_CHANNELS * NB_DIV * SNS_MSVQ_NSTAGES_TCX10]; + int16_t nbits_sns; + int16_t sns_stereo_mode[NB_DIV]; + int16_t idx; +#endif int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW]; int16_t param_core[CPE_CHANNELS][2 * NPRM_DIV]; int16_t ltpBits[CPE_CHANNELS]; @@ -598,9 +603,12 @@ void ivas_mdct_core_whitening_enc( float scf_q[CPE_CHANNELS][NB_DIV][M]; float chE[2], chE_tot; int8_t sns_low_br_mode; - int8_t skipped_first_channel; int16_t nbits_start_sns; int16_t num_sns; + int8_t skipped_first_channel; +#ifdef SNS_MSVQ + int16_t zero_side_flag[NB_DIV]; +#endif push_wmops( "mdct_core_whitening" ); @@ -612,10 +620,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { - stereo_tcx_init_enc( sts[ch] ); - } + stereo_tcx_init_enc( sts[ch] ); set_s( tnsSize[ch], 0, 2 ); set_s( tnsBits[ch], 0, 2 ); @@ -655,10 +660,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { - SetTCXModeInfo( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); - } + SetTCXModeInfo( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode ); } } @@ -672,12 +674,10 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels ) { continue; } - SetCurrentPsychParams( st->core, 0, st->hTcxCfg ); /* tcx ltp analysis on the 12.8kHz weighted speech, saves preproc resampling to sr_core */ @@ -686,11 +686,18 @@ void ivas_mdct_core_whitening_enc( core_signal_analysis_high_bitrate( new_samples[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, mdst_spectrum[ch], tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0 ); /* BWD in MDCT domain */ - if ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) + if ( st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) { - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; + + for ( n = 0; n < nSubframes; n++ ) { - bw_detect( st, NULL, st->hTcxEnc->spectrum[0], NULL ); + bw_detect( st, NULL, st->hTcxEnc->spectrum[n], NULL, mct_on ); + + if ( nSubframes == NB_DIV && n == 0 ) + { + st->last_input_bwidth = st->input_bwidth; + } } } @@ -803,7 +810,7 @@ void ivas_mdct_core_whitening_enc( { TCX_ENC_HANDLE hTcxEncCh = sts[ch]->hTcxEnc; - if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels ) { hTcxEncCh->kernel_symmetry_past = hTcxEncCh->kernel_type[0] = 0; @@ -830,9 +837,10 @@ void ivas_mdct_core_whitening_enc( * Envelope Quantization and FDNS *---------------------------------------------------------------*/ + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( ( hCPE->cpe_id * CPE_CHANNELS + ch ) >= nChannels ) { continue; } @@ -873,11 +881,16 @@ void ivas_mdct_core_whitening_enc( chE[n] = sum_f( powerSpec, L_subframeTCX ); } +#ifdef FIX_445_SNS_BUGFIXES + sns_compute_scf( powerSpec, st->hTcxCfg->psychParamsCurrent, st->L_frame, scf[ch][n] ); +#else sns_compute_scf( powerSpec, st->hTcxCfg->psychParamsCurrent, st->last_core == ACELP_CORE ? L_subframe : st->L_frame, scf[ch][n] ); +#endif } /* MCT: detect whether there are silent channels and set mct_chan_mode accordingly */ - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE && mct_on ) + if ( + mct_on ) { chE_tot = sum_f( chE, NB_DIV ); @@ -894,7 +907,7 @@ void ivas_mdct_core_whitening_enc( } /* set low br mode, if possible. Can later be discarded, depending on the stereo mode used for SNS parameter decoding */ - if ( hCPE->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE ) ) + if ( hCPE->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ) ) { sns_low_br_mode = !sts[0]->sp_aud_decision0; } @@ -903,10 +916,69 @@ void ivas_mdct_core_whitening_enc( sns_low_br_mode = 0; } +#ifdef SNS_MSVQ + if ( !mct_on && sts[0]->sr_core == 25600 && ( ( hCPE->element_brate == IVAS_48k || hCPE->element_brate == IVAS_64k ) ) ) + { + nbits_sns = quantize_sns( scf, scf_q, sts, sns_vq_indices, zero_side_flag, sns_stereo_mode ); + } + else + { + if ( sts[0]->hTcxEnc->tcxMode == TCX_20 && sts[1]->hTcxEnc->tcxMode == TCX_20 && + sts[0]->mct_chan_mode == MCT_CHAN_MODE_REGULAR && sts[1]->mct_chan_mode == MCT_CHAN_MODE_REGULAR ) + { +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_cod_stereo( scf[0][0], scf[1][0], sts[0]->L_frame, scf_q[0][0], scf_q[1][0], param_lpc[0], param_lpc[1] ); +#else + sns_avq_cod_stereo( scf[0][0], scf[1][0], scf_q[0][0], scf_q[1][0], param_lpc[0], param_lpc[1] ); +#endif + } + else + { +#ifdef DEBUG_MODE_MDCT + { + float ener_side = 0; + float ener_mid = 0; + dbgwrite( &ener_side, sizeof( float ), 1, 1, "./res/ener_side" ); + dbgwrite( &ener_mid, sizeof( float ), 1, 1, "./res/ener_mid" ); + } +#endif + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + param_lpc[ch][0] = ch; + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + { + continue; + } + st = sts[ch]; + + if ( st->hTcxEnc->tcxMode == TCX_20 ) + { +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_cod( scf[ch][0], NULL, scf_q[ch][0], NULL, ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, st->L_frame, sns_low_br_mode ); +#else + sns_avq_cod( scf[ch][0], NULL, scf_q[ch][0], NULL, ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, sns_low_br_mode ); +#endif + } + else + { +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_cod( scf[ch][1], scf[ch][0], scf_q[ch][1], scf_q[ch][0], ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, st->L_frame, sns_low_br_mode ); +#else + sns_avq_cod( scf[ch][1], scf[ch][0], scf_q[ch][1], scf_q[ch][0], ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, sns_low_br_mode ); +#endif + } + } + } + } +#else // else of SNS_MSVQ if ( sts[0]->hTcxEnc->tcxMode == TCX_20 && sts[1]->hTcxEnc->tcxMode == TCX_20 && sts[0]->mct_chan_mode == MCT_CHAN_MODE_REGULAR && sts[1]->mct_chan_mode == MCT_CHAN_MODE_REGULAR ) { +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_cod_stereo( scf[0][0], scf[1][0], sts[0]->L_frame, scf_q[0][0], scf_q[1][0], param_lpc[0], param_lpc[1] ); +#else sns_avq_cod_stereo( scf[0][0], scf[1][0], scf_q[0][0], scf_q[1][0], param_lpc[0], param_lpc[1] ); +#endif } else { @@ -921,7 +993,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { param_lpc[ch][0] = ch; - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -929,22 +1001,27 @@ void ivas_mdct_core_whitening_enc( if ( st->hTcxEnc->tcxMode == TCX_20 ) { +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_cod( scf[ch][0], NULL, scf_q[ch][0], NULL, ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, st->L_frame, sns_low_br_mode ); +#else sns_avq_cod( scf[ch][0], NULL, scf_q[ch][0], NULL, ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, sns_low_br_mode ); +#endif } else { -#ifdef SNS_LOW_BR_MODE - sns_avq_cod( scf[ch][1], scf[ch][0], scf_q[ch][1], scf_q[ch][0], ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, sns_low_br_mode ); +#ifdef FIX_445_SNS_BUGFIXES + sns_avq_cod( scf[ch][1], scf[ch][0], scf_q[ch][1], scf_q[ch][0], ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, st->L_frame, sns_low_br_mode ); #else - sns_avq_cod( scf[ch][1], scf[ch][0], scf_q[ch][1], scf_q[ch][0], ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, ( hCPE->element_brate == IVAS_48k && !hCPE->hCoreCoder[0]->sp_aud_decision0 ) ); + sns_avq_cod( scf[ch][1], scf[ch][0], scf_q[ch][1], scf_q[ch][0], ¶m_lpc[ch][1], st->hTcxEnc->tcxMode, sns_low_br_mode ); #endif } } } +#endif // SNS_AVQ4TCX20_MSVQ4TCX10 for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -965,6 +1042,7 @@ void ivas_mdct_core_whitening_enc( } } + /*--------------------------------------------------------------* * TNS *---------------------------------------------------------------*/ @@ -972,7 +1050,7 @@ void ivas_mdct_core_whitening_enc( /* first deinterleave once more */ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -993,7 +1071,7 @@ void ivas_mdct_core_whitening_enc( for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE || sts[ch]->mct_chan_mode == MCT_CHAN_MODE_LFE ) + if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -1015,8 +1093,6 @@ void ivas_mdct_core_whitening_enc( } } } - - /*check whether LFE channel is active*/ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { /*no need to write last channel bit in case of odd channels*/ @@ -1029,12 +1105,7 @@ void ivas_mdct_core_whitening_enc( if ( mct_on ) /* signal bits should be written only for MCT*/ { - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - assert( *LFE_off == 1 ); - push_next_indice( hBstr, *LFE_off, 1 ); - } - else if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { push_next_indice( hBstr, 1, 1 ); } @@ -1051,7 +1122,7 @@ void ivas_mdct_core_whitening_enc( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( *LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { st->side_bits_frame_channel = 0; /*dummy initialization to prevent range coder crashing in case all channels are silent and bits are distributed to channel 0 */ @@ -1089,14 +1160,105 @@ void ivas_mdct_core_whitening_enc( /*--------------------------------------------------------------------------------* * SNS parameters *--------------------------------------------------------------------------------*/ +#ifdef SNS_MSVQ + if ( !mct_on && sts[0]->sr_core == 25600 && ( ( hCPE->element_brate == IVAS_48k || hCPE->element_brate == IVAS_64k ) ) ) + { + nbits_sns = 0; + idx = 0; + + if ( sts[0]->core == sts[1]->core ) + { + nSubframes = ( sts[0]->core == TCX_20_CORE ) ? 1 : NB_DIV; + + /* push all stereo mode bits first */ + for ( n = 0; n < nSubframes; ++n ) + { + push_next_indice( hBstr, sns_stereo_mode[n], 1 ); + nbits_sns++; + sts[0]->side_bits_frame_channel++; + } + + /* zero side flags only get transmitted if needed */ + for ( n = 0; n < nSubframes; ++n ) + { + if ( sns_stereo_mode[n] == SNS_STEREO_MODE_MS ) + { + push_next_indice( hBstr, zero_side_flag[n], 1 ); + nbits_sns++; + sts[0]->side_bits_frame_channel++; + } + } + } + for ( ch = 0; ch < CPE_CHANNELS; ++ch ) + { + st = sts[ch]; + nbits_start_sns = hBstr->nb_bits_tot; + nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; + for ( n = 0; n < nSubframes; ++n ) + { + const int16_t is_side = ch == 1 && sns_stereo_mode[n] == SNS_STEREO_MODE_MS; + const int16_t *bits = ( nSubframes == 1 ) ? ivas_sns_cdbks_tcx20_bits : ivas_sns_cdbks_tcx10_bits; + int16_t nStages = ( ( nSubframes == 1 ) ? SNS_MSVQ_NSTAGES_TCX20 : SNS_MSVQ_NSTAGES_TCX10 ); + + if ( is_side ) + { + if ( zero_side_flag[n] ) + { + continue; + } + nStages = SNS_MSVQ_NSTAGES_SIDE; + bits = ( sts[ch]->core == TCX_20_CORE ) ? ivas_sns_cdbks_side_tcx20_bits : ivas_sns_cdbks_side_tcx10_bits; + } + for ( int16_t j = 0; j < nStages; ++j, ++idx ) + { + push_next_indice( hBstr, sns_vq_indices[idx], bits[j] ); + } + } + st->side_bits_frame_channel += hBstr->nb_bits_tot - nbits_start_sns; + } + } + else + { + /* write SNS parameter separately since at the decoder, both channels' cores need to be decoded before, so the joint SNS decoding can be done */ + skipped_first_channel = 0; + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + { + st = sts[ch]; + + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) + { + skipped_first_channel = 1; + continue; + } + + nbits_start_sns = hBstr->nb_bits_tot; + + num_sns = ( st->core == TCX_20_CORE ) ? 1 : 2; + + if ( ch == 0 || skipped_first_channel ) + { + push_next_indice( hBstr, param_lpc[0][0] >> 1, 1 ); + + if ( st->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ) ) + { + /* write classifier decision to signal low br mode for SNS encoding, for all other configs, low_br mode is not possible */ + push_next_indice( hBstr, sns_low_br_mode, 1 ); + } + } + encode_lpc_avq( hBstr, num_sns, param_lpc[ch], st->core, st->element_mode ); + + st->side_bits_frame_channel += hBstr->nb_bits_tot - nbits_start_sns; + } + } +#else // else of SNS_MSVQ /* write SNS parameter separately since at the decoder, both channels' cores need to be decoded before, so the joint SNS decoding can be done */ skipped_first_channel = 0; for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( *LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { skipped_first_channel = 1; continue; @@ -1110,7 +1272,7 @@ void ivas_mdct_core_whitening_enc( { push_next_indice( hBstr, param_lpc[0][0] >> 1, 1 ); - if ( st->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) || sts[1]->mct_chan_mode == MCT_CHAN_MODE_LFE ) ) + if ( st->element_brate == IVAS_48k && !( ( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ) ) { /* write classifier decision to signal low br mode for SNS encoding, for all other configs, low_br mode is not possible */ push_next_indice( hBstr, sns_low_br_mode, 1 ); @@ -1121,11 +1283,14 @@ void ivas_mdct_core_whitening_enc( st->side_bits_frame_channel += hBstr->nb_bits_tot - nbits_start_sns; } +#endif // MSVQ_SNS + + /*update pitch buffer*/ for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && ( *LFE_off ) ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } @@ -1152,7 +1317,6 @@ void ivas_mdct_core_whitening_enc( void ivas_mdct_quant_coder( CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */ - const int16_t LFE_off, /* i : flag if LFE is inactive */ int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */ int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */ @@ -1198,7 +1362,7 @@ void ivas_mdct_quant_coder( st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { ignore_chan[ch] = 1; continue; @@ -1258,7 +1422,7 @@ void ivas_mdct_quant_coder( { st = sts[ch]; - if ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { /*Enable appropriate upadte of tcx_curr_overlap_mode even for uncoded channel index 1*/ L_frameTCX[ch][0] = ( st->core == TCX_10_CORE ) ? st->hTcxEnc->L_frameTCX >> 1 : st->hTcxEnc->L_frameTCX; @@ -1285,7 +1449,7 @@ void ivas_mdct_quant_coder( * Generate Bitstream *---------------------------------------------------------------*/ - if ( ( ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) && LFE_off ) || ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) ) + if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) { continue; } diff --git a/lib_enc/ivas_pca_enc.c b/lib_enc/ivas_pca_enc.c index 9c780f65e5d4d9f4f2c0aa2577cd28cb319ac382..8ecac8d208381ae0f6c36ea2c6f480596135a7cc 100644 --- a/lib_enc/ivas_pca_enc.c +++ b/lib_enc/ivas_pca_enc.c @@ -40,7 +40,6 @@ #include "ivas_cnst.h" #include #include -#include "typedef.h" #include "wmc_auto.h" diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index ac4f83a65794d7bbcdc2104e7b858d5bc8319ff7..273703b3176a498af9b0eb7f6b51213f314f1cfd 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -52,7 +52,12 @@ static float direction_distance( float elevation[DIRAC_MAX_NBANDS][MAX_PARAM_SPA #endif -static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, int16_t *nbits_diff, int16_t *dfRatioBits ); +static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, int16_t *nbits_diff, int16_t *dfRatioBits +#ifdef HODIRAC + , + int16_t hodirac /* i: flag to indicate sector processing */ +#endif +); static int16_t ivas_qmetadata_entropy_encode_diffuseness( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); @@ -60,7 +65,12 @@ static void ivas_qmetadata_reorder_2dir_bands( IVAS_QMETADATA_HANDLE hQMetaData static int16_t ivas_qmetadata_entropy_encode_df_ratio( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, int16_t *df_ratio_bits ); -static int16_t ivas_qmetadata_entropy_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, int16_t max_bits ); +static int16_t ivas_qmetadata_entropy_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, int16_t max_bits +#ifdef HR_METADATA + , + int16_t is_hr +#endif +); static int16_t ivas_qmetadata_raw_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const int16_t nbands, const int16_t start_band ); @@ -88,11 +98,21 @@ static ivas_error write_ec_direction( int16_t *num_bits_written, BSTR_ENC_HANDLE static int16_t write_fixed_rate_direction( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const int16_t j_idx, const int16_t len ); -static int16_t ivas_qmetadata_quantize_coherence( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t write_flag, int16_t *indice_coherence ); +static int16_t ivas_qmetadata_quantize_coherence( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t write_flag, int16_t *indice_coherence +#ifdef HR_METADATA + , + int16_t is_hr +#endif +); static void dct4_transform( uint8_t *v, float *dct_v ); -static float quantize_DCT_0_coh( const float x, const int16_t j, const float *coherence_cb, const float delta_var, const int16_t no_cb, IVAS_QDIRECTION *q_direction, uint16_t *idx_x, int16_t *p_no_cb ); +static float quantize_DCT_0_coh( const float x, const int16_t j, const float *coherence_cb, const float delta_var, const int16_t no_cb, IVAS_QDIRECTION *q_direction, uint16_t *idx_x, int16_t *p_no_cb +#ifdef HR_METADATA + , + int16_t is_hr +#endif +); static int16_t encode_coherence_indexesDCT0( uint16_t *idx_dct, const int16_t len, int16_t *no_cb_vec, BSTR_ENC_HANDLE hMetaData, int16_t indice_coherence, const int16_t nbits, const int16_t nbits1 ); @@ -117,6 +137,40 @@ static int16_t write_2dir_info( BSTR_ENC_HANDLE hMetaData, uint8_t *twoDirBands, static void transform_azimuth_dir2( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *dir2_bands ); static int16_t calc_var_azi( const IVAS_QDIRECTION *q_direction, const int16_t diffuseness_index_max_ec_frame, const float avg_azimuth, float *avg_azimuth_out ); +#ifdef HR_METADATA +static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr( + IVAS_QMETADATA_HANDLE hQMetaData, + int16_t *needed_bits, + int16_t *nbits_diff, + int16_t *dfRatioBits, + int16_t bits_dir_hr ); +static int16_t ivas_qmetadata_entropy_encode_diffuseness_hr( + BSTR_ENC_HANDLE hMetaData, + IVAS_QDIRECTION *q_direction, + uint16_t *diffuseness_index_max_ec_frame ); + +static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( + IVAS_QMETADATA_HANDLE hQMetaData, + int16_t *needed_bits, + int16_t bits_dir_hr, + BSTR_ENC_HANDLE hMetaData ); + +static int16_t encode_surround_coherence_hr( + IVAS_QMETADATA *hQMetaData, /* i : quantized metadata */ + BSTR_ENC_HANDLE hMetaData /* i/o: metadata bitstream handle */ +); + +static void ivas_qmetadata_reorder_2dir_bands_hr( + IVAS_QMETADATA_HANDLE hQMetaData ); + +static int16_t ivas_qmetadata_quantize_coherence_hr_512( + IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata */ + const int16_t idx_d, /* i : current direction index */ + const int16_t all_coherence_zero, /* i : all coherence is zero - flag */ + BSTR_ENC_HANDLE hMetaData, /* i : metadata handle */ + int16_t bits_coh ); + +#endif /*-----------------------------------------------------------------------* * ivas_qmetadata_enc_encode() @@ -127,6 +181,10 @@ static int16_t calc_var_azi( const IVAS_QDIRECTION *q_direction, const int16_t d ivas_error ivas_qmetadata_enc_encode( BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ IVAS_QMETADATA *hQMetaData /* i/o: metadata handle */ +#ifdef HODIRAC + , + int16_t hodirac /* i: flag to indicate sector processing */ +#endif ) { int16_t i, bit_pos_start, bit_pos_start_coh; @@ -185,6 +243,7 @@ ivas_error ivas_qmetadata_enc_encode( pF_surcoh = fopen( "./res/qmetadata_surcoh_enc.txt", "w" ); #endif + /* Save initial position in bitstream */ bit_pos_0 = hMetaData->nb_bits_tot; bit_pos_start = bit_pos_0; @@ -210,7 +269,12 @@ ivas_error ivas_qmetadata_enc_encode( assert( ndirections == 2 ); #endif /* Reorder 2dir bands for more efficient encoding. */ - ivas_qmetadata_reorder_2dir_bands( hQMetaData ); +#ifdef HODIRAC + if ( !hodirac ) +#endif + { + ivas_qmetadata_reorder_2dir_bands( hQMetaData ); + } d = 0; for ( i = hQMetaData->q_direction[1].cfg.start_band; i < hQMetaData->q_direction[1].cfg.nbands; i++ ) { @@ -244,7 +308,12 @@ ivas_error ivas_qmetadata_enc_encode( } /*Quantization of the Diffuseness */ - ivas_qmetadata_quantize_diffuseness_nrg_ratios( hQMetaData, bits_dir_raw_pre, bits_diff, dfRatio_bits ); + ivas_qmetadata_quantize_diffuseness_nrg_ratios( hQMetaData, bits_dir_raw_pre, bits_diff, dfRatio_bits +#ifdef HODIRAC + , + hodirac +#endif + ); bits_diff_sum = 0; bits_diff[0] = ivas_qmetadata_entropy_encode_diffuseness( hMetaData, &( hQMetaData->q_direction[0] ), &diffuseness_index_max_ec_frame_pre[0] ); @@ -380,9 +449,15 @@ ivas_error ivas_qmetadata_enc_encode( /*Coherence */ bits_coherence[d] = 0; bit_pos_start_coh = hMetaData->nb_bits_tot; + if ( all_coherence_zero == 0 ) { - bits_coherence[d] = ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 0, &indice_coherence ); + bits_coherence[d] = ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 0, &indice_coherence +#ifdef HR_METADATA + , + 0 +#endif + ); } if ( q_direction->cfg.mc_ls_setup == MC_LS_SETUP_5_1 || q_direction->cfg.mc_ls_setup == MC_LS_SETUP_7_1 ) @@ -394,7 +469,12 @@ ivas_error ivas_qmetadata_enc_encode( else { /* Quantize directions*/ - quantize_direction_frame( q_direction, azimuth_orig, elevation_orig ); + quantize_direction_frame( q_direction, azimuth_orig, elevation_orig +#ifdef HR_METADATA + , + 0 +#endif + ); } /* Signalling 2D*/ @@ -420,7 +500,12 @@ ivas_error ivas_qmetadata_enc_encode( reduce_bits = hQMetaData->is_masa_ivas_format ? ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) - 1 ) : MASA_MAX_BITS; bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, - q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits ); + q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits +#ifdef HR_METADATA + , + 0 +#endif + ); if ( bits_ec < 0 ) { @@ -466,7 +551,12 @@ ivas_error ivas_qmetadata_enc_encode( bits_dir_bands[i] = ivas_qmetadata_raw_encode_dir( NULL, q_direction, i + 1, i ); /* Write ec bits */ - bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, i + 1, i, bits_dir_bands[i], MASA_MAX_BITS ); + bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, i + 1, i, bits_dir_bands[i], MASA_MAX_BITS +#ifdef HR_METADATA + , + 0 +#endif + ); if ( bits_ec >= 0 ) { @@ -565,7 +655,12 @@ ivas_error ivas_qmetadata_enc_encode( { bit_pos_start = hMetaData->nb_bits_tot; hMetaData->nb_bits_tot = bit_pos_start_coh; - ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 1, &indice_coherence ); + ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 1, &indice_coherence +#ifdef HR_METADATA + , + 0 +#endif + ); hMetaData->nb_bits_tot = bit_pos_start; } @@ -653,6 +748,238 @@ ivas_error ivas_qmetadata_enc_encode( return error; } +#ifdef HR_METADATA + +ivas_error ivas_qmetadata_enc_encode_hr_384_512( + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ + IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ + int16_t bits_sph_idx, + int16_t bits_sp_coh ) +{ + int16_t i, j; + + int16_t bits_diff[QMETADATA_MAX_NO_DIRECTIONS]; + IVAS_QDIRECTION *q_direction; + int16_t nbands, nblocks, start_band; + int16_t ndirections, d; + int16_t all_coherence_zero; + int16_t bits_no_dirs_coh; + int16_t bits_ec; + float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; + + ivas_error error; + + error = IVAS_ERR_OK; + +#ifdef DEBUG_MODE_QMETADATA + + static FILE *pF = NULL; + static FILE *pF_azi = NULL; + static FILE *pF_ele = NULL; + static FILE *pF_ratio = NULL; + static FILE *pF_spcoh = NULL; + static FILE *pF_spcoh_orig = NULL; + static FILE *pF_surcoh = NULL; + + if ( pF == NULL ) + pF = fopen( "./res/qmetadata_enc.txt", "w" ); + if ( pF_azi == NULL ) + pF_azi = fopen( "./res/qmetadata_azi_enc.txt", "w" ); + if ( pF_ele == NULL ) + pF_ele = fopen( "./res/qmetadata_ele_enc.txt", "w" ); + if ( pF_ratio == NULL ) + pF_ratio = fopen( "./res/qmetadata_ratio_enc.txt", "w" ); + if ( pF_spcoh == NULL ) + pF_spcoh = fopen( "./res/qmetadata_spcoh_enc.txt", "w" ); + if ( pF_spcoh_orig == NULL ) + pF_spcoh_orig = fopen( "./res/qmetadata_spcoh_orig.txt", "w" ); + if ( pF_surcoh == NULL ) + pF_surcoh = fopen( "./res/qmetadata_surcoh_enc.txt", "w" ); +#endif + + ndirections = hQMetaData->no_directions; + + + /* Check if coherence should be encoded */ + all_coherence_zero = 1; + bits_no_dirs_coh = 0; + + if ( hQMetaData->coherence_flag ) + { + all_coherence_zero = hQMetaData->all_coherence_zero; + push_next_indice( hMetaData, all_coherence_zero, 1 ); /* signal coherence */ + bits_no_dirs_coh += 1; + } + /* encode 2 direction subbands position */ + if ( ndirections == 2 && bits_sph_idx == 11 ) + { + bits_no_dirs_coh += write_2dir_info( hMetaData, hQMetaData->twoDirBands, hQMetaData->q_direction[0].cfg.nbands, hQMetaData->numTwoDirBands ); + + for ( i = hQMetaData->numTwoDirBands; i < hQMetaData->q_direction[0].cfg.nbands; i++ ) + { + set_f( hQMetaData->q_direction[1].band_data[i].energy_ratio, 0.0f, hQMetaData->q_direction[1].cfg.nblocks ); + } + + hQMetaData->q_direction[1].cfg.nbands = hQMetaData->numTwoDirBands; + } + /*Quantization and encoding of the Diffuseness */ + + ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( hQMetaData, bits_diff, bits_sph_idx, hMetaData ); + + /* Encode surround coherence */ + if ( all_coherence_zero == 0 ) + { + encode_surround_coherence_hr( hQMetaData, hMetaData ); + } + else + { + + for ( i = 0; i < hQMetaData->q_direction[0].cfg.nbands; i++ ) + { + if ( hQMetaData->surcoh_band_data != NULL ) + { + set_c( (int8_t *) hQMetaData->surcoh_band_data[i].surround_coherence, 0, hQMetaData->q_direction[0].cfg.nblocks ); + } + } + } + + + /* Loop over number of directions*/ + for ( d = 0; d < ndirections; d++ ) + { + q_direction = &( hQMetaData->q_direction[d] ); + + nbands = q_direction->cfg.nbands; + nblocks = q_direction->cfg.nblocks; + start_band = q_direction->cfg.start_band; + + +#ifdef DEBUG_MODE_QMETADATA + { + int16_t k; + k = 0; + fprintf( pF_spcoh_orig, "%d %d ", frame, k ); + + for ( i = start_band; i < nbands; i++ ) + { + for ( j = 0; j < nblocks; j++ ) + { + if ( q_direction->coherence_band_data != NULL ) + { + fprintf( pF_spcoh_orig, " %d ", q_direction->coherence_band_data[i].spread_coherence[j] ); + } + } + } + fprintf( pF_spcoh_orig, "\n" ); + } +#endif + + /*Coherence */ + + if ( all_coherence_zero == 0 ) + { + ivas_qmetadata_quantize_coherence_hr_512( hQMetaData, d, all_coherence_zero, hMetaData, bits_sp_coh ); + } + + /* write the spherical indexes */ + bits_ec = hMetaData->nb_bits_tot; + if ( bits_sph_idx == 11 ) + { + /* do the quantization */ + quantize_direction_frame( q_direction, azimuth_orig, elevation_orig, 1 ); + } + for ( i = start_band; i < nbands; i++ ) + { + for ( j = 0; j < nblocks; j++ ) + { + push_next_indice( hMetaData, q_direction->band_data[i].spherical_index[j], bits_sph_idx ); + } + } + bits_ec = hMetaData->nb_bits_tot - bits_ec; + +#ifdef DEBUG_MODE_QMETADATA + { + float tmp_f; + fprintf( pF, "frame %d: diff %d ", frame, bits_diff[d] ); + fprintf( pF_azi, "frame %d/dir/ec %d: ", frame, d ); + fprintf( pF_ele, "frame %d/dir/ec %d: ", frame, d ); + fprintf( pF_ratio, "frame %d/dir %d: ", frame, d ); + /*fprintf( pF_spcoh, "frame %d/dir %d: ", frame, d ); */ + fprintf( pF_spcoh, " %d %d ", frame, d ); + + if ( d == 0 ) + { + fprintf( pF_surcoh, "frame %d/dir %d: ", frame, d ); + } + + /* direction_distance( elevation_orig, azimuth_orig, q_direction, nbands, nblocks, mat_dist );*/ + for ( i = start_band; i < nbands; i++ ) + { + for ( j = 0; j < nblocks; j++ ) + { + fprintf( pF_azi, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[i].azimuth[j] ) / 100.f ); + fprintf( pF_ele, " %+5.2f ", (int16_t) ( 100.f * q_direction->band_data[i].elevation[j] ) / 100.f ); + fprintf( pF_ratio, " %1.3f ", q_direction->band_data[i].energy_ratio[j] ); + if ( q_direction->coherence_band_data != NULL ) + { + fprintf( pF_spcoh, " %d ", q_direction->coherence_band_data[i].spread_coherence[j] ); + } + if ( d == 0 && hQMetaData->surcoh_band_data != NULL ) + { + fprintf( pF_surcoh, " %d ", hQMetaData->surcoh_band_data[i].surround_coherence[j] ); + } + } + } + fprintf( pF, "\n" ); + fprintf( pF_azi, "\n" ); + fprintf( pF_ele, "\n" ); + fprintf( pF_ratio, "\n" ); + fprintf( pF_spcoh, "\n" ); + if ( d == 0 ) + { + fprintf( pF_surcoh, "\n" ); + } + + for ( i = 0; i < nblocks; i++ ) + { + for ( j = 0; j < nbands; j++ ) + { + dbgwrite( &( q_direction->band_data[j].azimuth[i] ), sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_azi.bin" ); + dbgwrite( &( q_direction->band_data[j].elevation[i] ), sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_ele.bin" ); + dbgwrite( &( q_direction->band_data[j].energy_ratio_index[i] ), sizeof( uint16_t ), 1, 1, "./res/IVAS_QMETADATA_diffuseness_index.bin" ); + tmp_f = 1.f - q_direction->band_data[j].energy_ratio[i]; + dbgwrite( &tmp_f, sizeof( float ), 1, 1, "./res/IVAS_QMETADATA_diffuseness.bin" ); + } + } + + j = (int16_t) ( hMetaData->nb_bits_tot ); + dbgwrite( &j, sizeof( int16_t ), 1, 1, "./res/IVAS_QMETADATA_bits.bin" ); + } +#endif + + /* Save quantized DOAs */ + if ( bits_sph_idx == 11 ) + { + for ( i = start_band; i < nbands; i++ ) + { + mvr2r( azimuth_orig[i], q_direction->band_data[i].azimuth, nblocks ); + mvr2r( elevation_orig[i], q_direction->band_data[i].elevation, nblocks ); + } + } + else + { + for ( i = start_band; i < nbands; i++ ) + { + mvr2r( q_direction->band_data[i].azimuth, q_direction->band_data[i].q_azimuth, nblocks ); + mvr2r( q_direction->band_data[i].elevation, q_direction->band_data[i].q_elevation, nblocks ); + } + } + } + + return error; +} +#endif + /*-----------------------------------------------------------------------* * ivas_qmetadata_enc_sid_encode() @@ -1036,18 +1363,19 @@ int16_t quantize_direction2D( return idx_sph; } - +#ifdef HR_METADATA /*------------------------------------------------------------------------- * ivas_qmetadata_quantize_diffuseness_nrg_ratios() * * Quantize diffuseness *------------------------------------------------------------------------*/ -static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( +static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, int16_t *nbits_diff, - int16_t *dfRatioBits ) + int16_t *dfRatioBits, + int16_t bits_dir_hr ) { int16_t j, k, dir2band; int16_t index_dirRatio1Inv, index_dirRatio2Inv, index_dirRatio1Inv_mod, index_dirRatio2Inv_mod; @@ -1076,10 +1404,10 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( diffRatio = 1.0f - sumRatio; dfRatio = sumRatio < EPSILON ? 0.5f : dirRatio1 / sumRatio; - index_diff = masa_sq( diffRatio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); - diffRatioQ = diffuseness_reconstructions[index_diff]; + index_diff = masa_sq( diffRatio, diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); + diffRatioQ = diffuseness_reconstructions_hr[index_diff]; - dfRatio_bits = ivas_get_df_ratio_bits( index_diff ); + dfRatio_bits = ivas_get_df_ratio_bits( index_diff >> 1 ); dfRatioBits[dir2band] = dfRatio_bits; @@ -1090,7 +1418,7 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( dirRatio1Q = dfRatioQ * ( 1.0f - diffRatioQ ); dirRatio2Q = ( 1.0f - diffRatioQ ) - dirRatio1Q; - index_dirRatio1Inv = masa_sq( 1.0f - dirRatio1Q, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + index_dirRatio1Inv = masa_sq( 1.0f - dirRatio1Q, diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); /* Note: To save memory, we store temporarily index_diff and dfRatio_index into first and second direction * energy ratio index variables until they have been encoded. index_dirRatio1Inv and index_dirRatio2Inv are @@ -1100,9 +1428,9 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( hQMetaData->q_direction[0].band_data[j].energy_ratio_index[k] = index_diff; hQMetaData->q_direction[0].band_data[j].energy_ratio[k] = dirRatio1Q; } - nbits_diff[0] += MASA_BITS_ER; + nbits_diff[0] += MASA_BITS_ER_HR; - index_dirRatio2Inv = masa_sq( 1.0f - dirRatio2Q, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + index_dirRatio2Inv = masa_sq( 1.0f - dirRatio2Q, diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) { hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[k] = dfRatio_index; @@ -1114,19 +1442,42 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( * fact that with 2dir data, it is harder to achieve separate high direct-to-total ratio values * which are assumed by the direction quantization system. In practice, this improves direction * accuracy when it is perceptual meaningful. */ - masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod ); + masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod +#ifdef HODIRAC + , + 0 +#endif + ); for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) { hQMetaData->q_direction[0].band_data[j].energy_ratio_index_mod[k] = index_dirRatio1Inv_mod; - hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_direction_masa[index_dirRatio1Inv_mod]; + + if ( bits_dir_hr > 0 ) + { + hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_dir_hr; + } + else + { + + hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_direction_masa[index_dirRatio1Inv_mod]; + } } needed_bits[0] += hQMetaData->q_direction[0].cfg.nblocks * bits_direction_masa[index_dirRatio1Inv_mod]; for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) { hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index_mod[k] = index_dirRatio2Inv_mod; - hQMetaData->q_direction[1].band_data[dir2band].bits_sph_idx[k] = bits_direction_masa[index_dirRatio2Inv_mod]; + + if ( bits_dir_hr > 0 ) + { + hQMetaData->q_direction[1].band_data[dir2band].bits_sph_idx[k] = bits_dir_hr; + } + else + { + + hQMetaData->q_direction[1].band_data[dir2band].bits_sph_idx[k] = bits_direction_masa[index_dirRatio2Inv_mod]; + } } needed_bits[1] += hQMetaData->q_direction[1].cfg.nblocks * bits_direction_masa[index_dirRatio2Inv_mod]; @@ -1134,17 +1485,350 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( } else { - index_dirRatio1Inv = masa_sq( 1.0f - hQMetaData->q_direction[0].band_data[j].energy_ratio[0], diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + index_dirRatio1Inv = masa_sq( 1.0f - hQMetaData->q_direction[0].band_data[j].energy_ratio[0], diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) { hQMetaData->q_direction[0].band_data[j].energy_ratio_index[k] = index_dirRatio1Inv; hQMetaData->q_direction[0].band_data[j].energy_ratio_index_mod[k] = index_dirRatio1Inv; - hQMetaData->q_direction[0].band_data[j].energy_ratio[k] = 1.0f - diffuseness_reconstructions[index_dirRatio1Inv]; - hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_direction_masa[index_dirRatio1Inv]; - } + hQMetaData->q_direction[0].band_data[j].energy_ratio[k] = 1.0f - diffuseness_reconstructions_hr[index_dirRatio1Inv]; + + if ( bits_dir_hr > 0 ) + { + hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_dir_hr; + } + else + { + + hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_direction_masa[index_dirRatio1Inv]; + } + } + + nbits_diff[0] += MASA_BITS_ER_HR; + + needed_bits[0] += hQMetaData->q_direction[0].cfg.nblocks * bits_dir_hr; + } + } + + return; +} + + +static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512( + IVAS_QMETADATA_HANDLE hQMetaData, + int16_t *needed_bits, + int16_t bits_dir_hr, + BSTR_ENC_HANDLE hMetaData ) +{ + int16_t j, k; + int16_t index; + + + needed_bits[0] = 0; + needed_bits[1] = 0; + + + for ( j = hQMetaData->q_direction[0].cfg.start_band; j < hQMetaData->q_direction[0].cfg.nbands; ++j ) + { + for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) + { + index = masa_sq( 1.0f - hQMetaData->q_direction[0].band_data[j].energy_ratio[k], diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); + push_next_indice( hMetaData, index, MASA_BITS_ER_HR ); + hQMetaData->q_direction[0].band_data[j].energy_ratio_index[k] = index; + hQMetaData->q_direction[0].band_data[j].energy_ratio_index_mod[k] = index; + hQMetaData->q_direction[0].band_data[j].energy_ratio[k] = 1.0f - diffuseness_reconstructions_hr[index]; + needed_bits[0] += MASA_BITS_ER_HR; + hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_dir_hr; + } + } + if ( hQMetaData->no_directions == 2 ) + { + for ( j = hQMetaData->q_direction[1].cfg.start_band; j < hQMetaData->q_direction[1].cfg.nbands; ++j ) + { + for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) + { + index = masa_sq( 1.0f - hQMetaData->q_direction[1].band_data[j].energy_ratio[k], diffuseness_thresholds_hr, HR_MASA_ER_LEVELS ); + push_next_indice( hMetaData, index, MASA_BITS_ER_HR ); + hQMetaData->q_direction[1].band_data[j].energy_ratio_index[k] = index; + hQMetaData->q_direction[1].band_data[j].energy_ratio[k] = 1.0f - diffuseness_reconstructions_hr[index]; + if ( hQMetaData->q_direction[1].band_data[j].energy_ratio[k] > 1.0f - hQMetaData->q_direction[0].band_data[j].energy_ratio[k] ) + { + hQMetaData->q_direction[1].band_data[j].energy_ratio[k] = 1.0f - hQMetaData->q_direction[0].band_data[j].energy_ratio[k]; + } + needed_bits[1] += MASA_BITS_ER_HR; + hQMetaData->q_direction[1].band_data[j].bits_sph_idx[k] = bits_dir_hr; + } + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_qmetadata_entropy_encode_diffuseness() + * + * encode diffuseness + *------------------------------------------------------------------------*/ + +static int16_t ivas_qmetadata_entropy_encode_diffuseness_hr( + BSTR_ENC_HANDLE hMetaData, + IVAS_QDIRECTION *q_direction, + uint16_t *diffuseness_index_max_ec_frame ) +{ + int16_t start_bit_pos; + int16_t diffuseness_bits_raw; + int16_t b; + int16_t min_diffuseness_m_index, max_diffuseness_m_index; + int16_t nbands; + int16_t start_band; + + nbands = q_direction->cfg.nbands; + start_band = q_direction->cfg.start_band; + + start_bit_pos = hMetaData->nb_bits_tot; + + if ( nbands == 1 ) + { + /* If there is only one band, diffuseness should be coded directly as raw with no signaling. */ + push_next_indice( hMetaData, q_direction->band_data[0].energy_ratio_index[0], MASA_BITS_ER_HR ); + *diffuseness_index_max_ec_frame = 10; + return ( hMetaData->nb_bits_tot - start_bit_pos ); + } + + /* compute the number of raw coding bits */ + diffuseness_bits_raw = 0; + for ( b = start_band; b < nbands; b++ ) + { + diffuseness_bits_raw += ivas_qmetadata_encode_quasi_uniform_length( q_direction->band_data[b].energy_ratio_index[0], HR_MASA_ER_LEVELS ); + } + + min_diffuseness_m_index = q_direction->band_data[start_band].energy_ratio_index[0]; + max_diffuseness_m_index = q_direction->band_data[start_band].energy_ratio_index[0]; + + for ( b = start_band; b < nbands; b++ ) + { + if ( q_direction->band_data[b].energy_ratio_index[0] < min_diffuseness_m_index ) + { + min_diffuseness_m_index = q_direction->band_data[b].energy_ratio_index[0]; + } + + if ( q_direction->band_data[b].energy_ratio_index[0] > max_diffuseness_m_index ) + { + max_diffuseness_m_index = q_direction->band_data[b].energy_ratio_index[0]; + } + } + + + /* Use similarity coding approach or raw coding when there is a low number of bands. */ + /* one bit is used to indicate whether diffuseness values are entropy coded or coded raw */ + if ( min_diffuseness_m_index == max_diffuseness_m_index ) /* all values are equal */ + { + push_next_indice( hMetaData, 0, 1 ); /* dif_use_raw_coding */ + push_next_indice( hMetaData, 1, 1 ); /* dif_have_unique_value */ + ivas_qmetadata_encode_quasi_uniform( hMetaData, min_diffuseness_m_index, HR_MASA_ER_LEVELS ); /* dif_unique_value */ + } + else if ( min_diffuseness_m_index + 1 == max_diffuseness_m_index ) /* only two consecutive values are present */ + { + push_next_indice( hMetaData, 0, 1 ); /* dif_use_raw_coding */ + push_next_indice( hMetaData, 0, 1 ); /* dif_have_unique_value */ + ivas_qmetadata_encode_quasi_uniform( hMetaData, min_diffuseness_m_index, HR_MASA_ER_LEVELS - 1 ); /* dif_min_value */ + + for ( b = start_band; b < nbands; b++ ) + { + push_next_indice( hMetaData, q_direction->band_data[b].energy_ratio_index[0] - min_diffuseness_m_index, 1 ); /* dif_bit_offset_values */ + } + } + else /* raw coding */ + { + push_next_indice( hMetaData, 1, 1 ); /* dif_use_raw_coding */ + + for ( b = start_band; b < nbands; b++ ) + { + ivas_qmetadata_encode_quasi_uniform( hMetaData, q_direction->band_data[b].energy_ratio_index[0], HR_MASA_ER_LEVELS ); /* dif_values */ + } + } + + + *diffuseness_index_max_ec_frame = 10; + /* adaptively select the diffuseness_index_max_ec threshold */ + if ( min_diffuseness_m_index > 10 ) + { + *diffuseness_index_max_ec_frame = HR_MASA_ER_LEVELS - 1; + } + +#ifdef DEBUGGING + assert( ( hMetaData->nb_bits_tot - start_bit_pos ) <= 1 + diffuseness_bits_raw ); +#endif + + return ( hMetaData->nb_bits_tot - start_bit_pos ); +} + +#endif + +/*------------------------------------------------------------------------- + * ivas_qmetadata_quantize_diffuseness_nrg_ratios() + * + * Quantize diffuseness + *------------------------------------------------------------------------*/ + +static void ivas_qmetadata_quantize_diffuseness_nrg_ratios( + IVAS_QMETADATA_HANDLE hQMetaData, + int16_t *needed_bits, + int16_t *nbits_diff, + int16_t *dfRatioBits +#ifdef HODIRAC + , + int16_t hodirac /* i: flag to indicate sector processing */ +#endif +) +{ + int16_t j, k, dir2band; + int16_t index_dirRatio1Inv, index_dirRatio2Inv, index_dirRatio1Inv_mod, index_dirRatio2Inv_mod; + int16_t index_diff; + + nbits_diff[0] = 0; + nbits_diff[1] = 0; + needed_bits[0] = 0; + needed_bits[1] = 0; + dir2band = 0; + + for ( j = hQMetaData->q_direction[0].cfg.start_band; j < hQMetaData->q_direction[0].cfg.nbands; ++j ) + { + if ( hQMetaData->no_directions == 2 && hQMetaData->twoDirBands[j] == 1 ) + { + float diffRatio, dfRatio, dfRatioQ, diffRatioQ, dirRatio1Q, dirRatio2Q; + float dirRatio1, dirRatio2, sumRatio; + int16_t dfRatio_index, dfRatio_qsteps, dfRatio_bits; + + /* With 2dir metadata, we quantize and transmit diffuse-to-total ratio (diffRatio) and + * distribution factor of direct-to-total ratios (dFRatio). This is more efficient and + * accurate than simple separate quantization of each direct-to-total ratio or their + * separate inverses. */ +#ifdef HODIRAC + if ( hodirac ) + { + /* already encoded as total and ratios in HODIRAC*/ + diffRatio = 1.f - hQMetaData->q_direction[0].band_data[j].energy_ratio[0]; + dfRatio = hQMetaData->q_direction[1].band_data[dir2band].energy_ratio[0]; + } + else +#endif + { + dirRatio1 = hQMetaData->q_direction[0].band_data[j].energy_ratio[0]; + dirRatio2 = hQMetaData->q_direction[1].band_data[dir2band].energy_ratio[0]; + sumRatio = dirRatio1 + dirRatio2; + diffRatio = 1.0f - sumRatio; + dfRatio = sumRatio < EPSILON ? 0.5f : dirRatio1 / sumRatio; + } + + + index_diff = masa_sq( diffRatio, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + diffRatioQ = diffuseness_reconstructions[index_diff]; + +#ifdef HODIRAC + if ( hodirac ) + { + dfRatio_bits = ivas_get_df_ratio_bits_hodirac( index_diff ); + } + else +#endif + { + dfRatio_bits = ivas_get_df_ratio_bits( index_diff ); + } + + dfRatioBits[dir2band] = dfRatio_bits; + + dfRatio_qsteps = ( 1 << dfRatio_bits ); +#ifdef HODIRAC + if ( hodirac ) + { + dfRatio_index = usquant( dfRatio, &dfRatioQ, 0.0f, 1.f / ( dfRatio_qsteps - 1 ), dfRatio_qsteps ); + dirRatio1Q = 1.f - diffRatioQ; + dirRatio2Q = dfRatioQ; + } + else +#endif + { + dfRatio_index = usquant( dfRatio, &dfRatioQ, 0.5f, 0.5f / ( dfRatio_qsteps - 1 ), dfRatio_qsteps ); + + /* Direction quantization requires also separately quantized direct-to-total ratios. Thus, we calculate them. */ + dirRatio1Q = dfRatioQ * ( 1.0f - diffRatioQ ); + dirRatio2Q = ( 1.0f - diffRatioQ ) - dirRatio1Q; + } + + + index_dirRatio1Inv = masa_sq( 1.0f - dirRatio1Q, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + + /* Note: To save memory, we store temporarily index_diff and dfRatio_index into first and second direction + * energy ratio index variables until they have been encoded. index_dirRatio1Inv and index_dirRatio2Inv are + * then later retrieved for further use in encoding. */ + for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) + { + hQMetaData->q_direction[0].band_data[j].energy_ratio_index[k] = index_diff; + hQMetaData->q_direction[0].band_data[j].energy_ratio[k] = dirRatio1Q; + } + nbits_diff[0] += MASA_BITS_ER; +#ifdef HODIRAC + if ( hodirac ) + { + float tmp; + index_dirRatio2Inv = usquant( dirRatio2Q, &tmp, 0.0f, 1.f / ( DIRAC_DIFFUSE_LEVELS - 1 ), DIRAC_DIFFUSE_LEVELS ); + } + else +#endif + { + index_dirRatio2Inv = masa_sq( 1.0f - dirRatio2Q, diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + } + + for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) + { + hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index[k] = dfRatio_index; + hQMetaData->q_direction[1].band_data[dir2band].energy_ratio[k] = dirRatio2Q; + } + nbits_diff[1] += dfRatio_bits; + + /* Obtain compensated direct-to-total ratios for direction quantization. This compensates for the + * fact that with 2dir data, it is harder to achieve separate high direct-to-total ratio values + * which are assumed by the direction quantization system. In practice, this improves direction + * accuracy when it is perceptual meaningful. */ + masa_compensate_two_dir_energy_ratio_index( index_dirRatio1Inv, index_dirRatio2Inv, &index_dirRatio1Inv_mod, &index_dirRatio2Inv_mod +#ifdef HODIRAC + , + hodirac +#endif + ); + + for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) + { + hQMetaData->q_direction[0].band_data[j].energy_ratio_index_mod[k] = index_dirRatio1Inv_mod; + hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_direction_masa[index_dirRatio1Inv_mod]; + } + needed_bits[0] += hQMetaData->q_direction[0].cfg.nblocks * bits_direction_masa[index_dirRatio1Inv_mod]; + + for ( k = 0; k < hQMetaData->q_direction[1].cfg.nblocks; k++ ) + { + hQMetaData->q_direction[1].band_data[dir2band].energy_ratio_index_mod[k] = index_dirRatio2Inv_mod; + hQMetaData->q_direction[1].band_data[dir2band].bits_sph_idx[k] = bits_direction_masa[index_dirRatio2Inv_mod]; + } + needed_bits[1] += hQMetaData->q_direction[1].cfg.nblocks * bits_direction_masa[index_dirRatio2Inv_mod]; + + dir2band++; + } + else + { + index_dirRatio1Inv = masa_sq( 1.0f - hQMetaData->q_direction[0].band_data[j].energy_ratio[0], diffuseness_thresholds, DIRAC_DIFFUSE_LEVELS ); + + for ( k = 0; k < hQMetaData->q_direction[0].cfg.nblocks; k++ ) + { + hQMetaData->q_direction[0].band_data[j].energy_ratio_index[k] = index_dirRatio1Inv; + hQMetaData->q_direction[0].band_data[j].energy_ratio_index_mod[k] = index_dirRatio1Inv; + hQMetaData->q_direction[0].band_data[j].energy_ratio[k] = 1.0f - diffuseness_reconstructions[index_dirRatio1Inv]; + hQMetaData->q_direction[0].band_data[j].bits_sph_idx[k] = bits_direction_masa[index_dirRatio1Inv]; + } + + nbits_diff[0] += MASA_BITS_ER; - nbits_diff[0] += MASA_BITS_ER; needed_bits[0] += hQMetaData->q_direction[0].cfg.nblocks * bits_direction_masa[index_dirRatio1Inv]; } } @@ -1799,7 +2483,12 @@ static int16_t ivas_qmetadata_entropy_encode_dir( const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, - int16_t max_bits ) + int16_t max_bits +#ifdef HR_METADATA + , + int16_t is_hr +#endif +) { uint16_t diff_idx_min; int16_t i, j; @@ -1845,11 +2534,22 @@ static int16_t ivas_qmetadata_entropy_encode_dir( set_zero( avg_direction_vector, 3 ); for ( i = start_band; i < nbands; i++ ) { - diff_idx_min = min( q_direction->band_data[i].energy_ratio_index_mod[0], diff_idx_min ); - - if ( q_direction->band_data[i].energy_ratio_index_mod[0] > diffuseness_index_max_ec_frame ) +#ifdef HR_METADATA + if ( is_hr ) { - /* estimate the raw part */ + diff_idx_min = 0; // min( q_direction->band_data[i].energy_ratio_index_mod[0]>>1, diff_idx_min ); + } + else + { +#endif + diff_idx_min = min( q_direction->band_data[i].energy_ratio_index_mod[0], diff_idx_min ); +#ifdef HR_METADATA + } +#endif + + if ( q_direction->band_data[i].energy_ratio_index_mod[0] > diffuseness_index_max_ec_frame ) + { + /* estimate the raw part */ if ( q_direction->not_in_2D > 0 ) { for ( j = 0; j < nblocks; j++ ) @@ -1895,6 +2595,7 @@ static int16_t ivas_qmetadata_entropy_encode_dir( no_th = no_theta_masa[bits_direction_masa[diff_idx_min] - 3]; + for ( i = 0; i < no_th; i++ ) { theta_cb[i] = i * delta_theta_masa[bits_direction_masa[diff_idx_min] - 3]; @@ -4054,6 +4755,10 @@ static int16_t encode_spread_coherence_1sf( IVAS_QMETADATA *q_metadata, /* i : quantized metadata */ const int16_t idx_d, /* i : current direction index */ BSTR_ENC_HANDLE hMasaMetaData /* i/o: metadata bitstream handle */ +#ifdef HR_METADATA + , + int16_t is_hr +#endif ) { int16_t i, j, k; @@ -4079,11 +4784,23 @@ static int16_t encode_spread_coherence_1sf( GR_ord = 1; idx_shift = 0; + /* number of codevectors added dependent on number of subbands */ extra_cv = coding_subbands / MASA_FACTOR_CV_COH; for ( j = 0; j < coding_subbands; j++ ) { - idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + extra_cv; +#ifdef HR_METADATA + if ( is_hr ) + { + idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + extra_cv; + } + else + { +#endif + idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + extra_cv; +#ifdef HR_METADATA + } +#endif if ( idx_ER > 0 ) { idx_sp_coh[j] = (uint16_t) roundf( q_direction->coherence_band_data[j].spread_coherence[0] / ( 255.0f / (float) idx_ER ) ); @@ -4433,6 +5150,210 @@ static int16_t encode_surround_coherence( } +#ifdef HR_METADATA +static int16_t encode_surround_coherence_hr( + IVAS_QMETADATA *hQMetaData, /* i : quantized metadata */ + BSTR_ENC_HANDLE hMetaData /* i/o: metadata bitstream handle */ +) +{ + int16_t i, j, k, sf; + int16_t nbits, nbits_fr, nbits_sf; + uint16_t idx_sur_coh[MASA_MAXIMUM_CODING_SUBBANDS]; + uint16_t mr_idx_sur_coh[MASA_MAXIMUM_CODING_SUBBANDS]; + int16_t GR_ord, bits_GR; + uint64_t idx, idx1; + int16_t no_idx16; + int16_t no_cv[MASA_MAXIMUM_CODING_SUBBANDS]; + float error_ratio_surr; + IVAS_QDIRECTION *q_direction; + int16_t half_coding_subbands, nbits_fr1, coding_subbands; + int16_t all_coherence_zero; + uint16_t idx_sur_coh_shift[MASA_MAXIMUM_CODING_SUBBANDS]; + uint8_t idx_shift; + int16_t max_val = 0, nbits_max; + int16_t no_cv_shift[MASA_MAXIMUM_CODING_SUBBANDS], min_idx; + int16_t idx16; + + coding_subbands = hQMetaData->q_direction[0].cfg.nbands; + all_coherence_zero = hQMetaData->all_coherence_zero; + q_direction = &( hQMetaData->q_direction[0] ); + nbits = 0; + + if ( all_coherence_zero == 1 ) + { + nbits = 0; + } + else + { + for ( sf = 0; sf < hQMetaData->q_direction[0].cfg.nblocks; sf++ ) + { + GR_ord = 1; + k = 0; + idx_shift = 0; + for ( j = 0; j < coding_subbands; j++ ) + { + if ( hQMetaData->no_directions == 2 ) + { + k += hQMetaData->twoDirBands[j]; + idx16 = max( k - 1, 0 ); + error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf] - q_direction[1].band_data[idx16].energy_ratio[sf] * hQMetaData->twoDirBands[j]; + } + else + { + error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf]; + } + + + if ( error_ratio_surr <= 0 ) + { + error_ratio_surr = 0; + idx_sur_coh[j] = 0; + no_cv[j] = 1; + hQMetaData->surcoh_band_data[j].surround_coherence[sf] = 0; /* sur_coherence_cb_masa[idx_cb_sur_coh_masa[DIRAC_DIFFUSE_LEVELS - 1] * MASA_MAX_NO_CV_SUR_COH]; */ + } + else + { + idx_sur_coh[j] = squant_int( hQMetaData->surcoh_band_data[j].surround_coherence[sf], &hQMetaData->surcoh_band_data[j].surround_coherence[sf], + &sur_coherence_cb_masa[idx_cb_sur_coh_masa[7] * MASA_MAX_NO_CV_SUR_COH], idx_cb_sur_coh_masa[7] + 2 ); + no_cv[j] = idx_cb_sur_coh_masa[7] + 2; + no_cv_shift[idx_shift] = no_cv[j]; + idx_sur_coh_shift[idx_shift++] = idx_sur_coh[j]; + } + } + + if ( sum_s( no_cv, coding_subbands ) != coding_subbands ) + { + nbits_max = 0; + if ( coding_subbands > MASA_LIMIT_NO_BANDS_SUR_COH ) + { + j = maximum_s( (int16_t *) idx_sur_coh, coding_subbands, &max_val ); + for ( j = 0; j < coding_subbands; j++ ) + { + if ( no_cv[j] > max_val + 1 ) + { + no_cv[j] = max_val + 1; + } + } + nbits_max = MASA_MAX_NO_CV_SUR_COH - max_val; /* encoded with GR0 as max_no_vals - no_vals*/ + } + if ( max_val == 0 ) + { + for ( j = 0; j < coding_subbands; j++ ) + { + hQMetaData->surcoh_band_data[j].surround_coherence[sf] = 0; + } + } + nbits_sf = coherence_coding_length( idx_sur_coh_shift, idx_shift, coding_subbands, no_cv, + mr_idx_sur_coh, no_cv_shift, &min_idx, &GR_ord, &nbits_fr, &nbits_fr1 ); + half_coding_subbands = coding_subbands / 2; + idx1 = 0; + + /* should check how to encode the average - check distribution */ + if ( nbits_fr + nbits_fr1 + nbits_max < nbits_sf ) + { + /* write flag*/ + push_next_indice( hMetaData, 0, 1 ); + + /* create combined index */ + nbits += nbits_fr + nbits_fr1 + 1; + if ( coding_subbands > MASA_LIMIT_NO_BANDS_SUR_COH ) + { + /* write max value*/ + bits_GR = hMetaData->nb_bits_tot; + ivas_qmetadata_encode_extended_gr( hMetaData, MASA_MAX_NO_CV_SUR_COH - max_val - 1, MASA_MAX_NO_CV_SUR_COH, 0 ); + nbits += hMetaData->nb_bits_tot - bits_GR; + } + + if ( nbits_fr1 > 0 ) + { + idx = create_combined_index( idx_sur_coh, half_coding_subbands, no_cv ); + idx1 = create_combined_index( &idx_sur_coh[half_coding_subbands], half_coding_subbands, &no_cv[half_coding_subbands] ); + } + else + { + idx = create_combined_index( idx_sur_coh, coding_subbands, no_cv ); + } + + if ( nbits_fr % 16 == 0 ) + { + no_idx16 = nbits_fr / 16; + } + else + { + no_idx16 = (int16_t) round_f( ( nbits_fr / 16.0f + 0.5f ) ); + } + + /* write combined index */ + k = nbits_fr; + for ( i = 0; i < no_idx16 - 1; i++ ) + { + k -= 16; + push_next_indice( hMetaData, ( ( idx >> k ) & 65535 ), 16 ); /* 16 bits */ + } + + push_next_indice( hMetaData, ( idx & ( ( 1 << k ) - 1 ) ), k ); + + if ( nbits_fr1 > 0 ) + { + if ( nbits_fr1 % 16 == 0 ) + { + no_idx16 = nbits_fr1 / 16; + } + else + { + no_idx16 = (int16_t) round_f( ( nbits_fr1 / 16.0f + 0.5f ) ); + } + + assert( no_idx16 <= 4 ); + + k = nbits_fr1; + for ( i = 0; i < no_idx16 - 1; i++ ) + { + k -= 16; + push_next_indice( hMetaData, ( ( idx1 >> k ) & 65535 ), 16 ); /* 16 bits */ + } + + push_next_indice( hMetaData, ( idx1 & ( ( 1 << k ) - 1 ) ), k ); + } + } + else + { + /* write flag */ + nbits += 1; + + /* write flag*/ + push_next_indice( hMetaData, 1, 1 ); + + /* write GR_ord */ + push_next_indice( hMetaData, GR_ord, 1 ); + nbits += 1; + + /* write the min */ + bits_GR = hMetaData->nb_bits_tot; + ivas_qmetadata_encode_extended_gr( hMetaData, min_idx, MASA_MAX_NO_CV_SUR_COH, 0 ); + nbits += hMetaData->nb_bits_tot - bits_GR; + + /* write GR data */ + for ( j = 0; j < idx_shift; j++ ) + { + bits_GR = hMetaData->nb_bits_tot; + + ivas_qmetadata_encode_extended_gr( hMetaData, mr_idx_sur_coh[j], no_cv_shift[j], GR_ord ); + + nbits += hMetaData->nb_bits_tot - bits_GR; + } + } + } + } + } + + + return nbits; +} + +#endif + + /*-------------------------------------------------------------------* * quantize_DCT_0_coh() * @@ -4449,14 +5370,42 @@ static float quantize_DCT_0_coh( IVAS_QDIRECTION *q_direction, /* i : quantized metadata */ uint16_t *idx_x, /* o : codewords index */ int16_t *p_no_cb /* o : actual number of codewords dependent on energy ratio value */ +#ifdef HR_METADATA + , + int16_t is_hr +#endif ) { float var_azi, xhat; int16_t idx_sub_cb, idx; - +#ifdef HR_METADATA + int16_t min_index; +#endif /* quantize first DCT component */ var_azi = var( q_direction->band_data[j].azimuth, q_direction->cfg.nblocks ); +#ifdef HR_METADATA + if ( is_hr ) + { + minimum_s( (int16_t *) ( q_direction->band_data[j].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); + min_index = min_index >> 1; + } + else + { + min_index = q_direction->band_data[j].energy_ratio_index[0]; + } + if ( var_azi < delta_var ) + { + idx_sub_cb = no_cb * min_index; + } + else + { + idx_sub_cb = no_cb * ( min_index + DIRAC_DIFFUSE_LEVELS ); + } + + idx = squant( x, &xhat, &coherence_cb[idx_sub_cb], len_cb_dct0_masa[min_index] ); + *p_no_cb = len_cb_dct0_masa[min_index]; +#else if ( var_azi < delta_var ) { idx_sub_cb = no_cb * q_direction->band_data[j].energy_ratio_index[0]; @@ -4469,7 +5418,7 @@ static float quantize_DCT_0_coh( idx = squant( x, &xhat, &coherence_cb[idx_sub_cb], len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]] ); *p_no_cb = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; - +#endif *idx_x = idx; return xhat; @@ -4537,6 +5486,107 @@ static void dct4_transform( return; } +#ifdef HR_METADATA +static int16_t ivas_qmetadata_quantize_coherence_hr_512( + IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata */ + const int16_t idx_d, /* i : current direction index */ + const int16_t all_coherence_zero, /* i : all coherence is zero - flag */ + BSTR_ENC_HANDLE hMetaData, /* i : metadata handle */ + int16_t bits_coh ) +{ + int16_t j, k; + int16_t nbands, nblocks; + int16_t nbits; + int16_t nbits1, nbits0, nbits_av; + uint16_t idx_coh[MASA_MAXIMUM_CODING_SUBBANDS]; + IVAS_QDIRECTION *q_direction; + int16_t cbsize; + float delta, tmp; + int16_t min_idx, GR_param, GR_param_av; + uint16_t av, mr_idx[MASA_MAXIMUM_CODING_SUBBANDS]; + + q_direction = &( hQMetaData->q_direction[idx_d] ); + nbands = q_direction->cfg.nbands; + nblocks = q_direction->cfg.nblocks; + nbits = 0; + + if ( all_coherence_zero == 1 ) + { + return nbits; + } + nbits = hMetaData->nb_bits_tot; + + cbsize = 1 << bits_coh; + delta = 256.0f / cbsize; + + for ( k = 0; k < nblocks; k++ ) + { + min_idx = 0; + for ( j = 0; j < nbands; j++ ) + { + idx_coh[j] = usquant( (float) ( q_direction->coherence_band_data[j].spread_coherence[k] ), &tmp, delta / 2.0f, delta, cbsize ); + q_direction->coherence_band_data[j].spread_coherence[k] = (uint8_t) ( idx_coh[j] * delta + delta / 2.0f ); + if ( idx_coh[j] < min_idx ) + { + min_idx = idx_coh[j]; + } + } + + + nbits0 = 0; + nbits1 = 0; + for ( j = 0; j < nbands; j++ ) + { + idx_coh[j] = idx_coh[j] - min_idx; + nbits0 += ivas_qmetadata_encode_extended_gr_length( idx_coh[j], cbsize - min_idx, 0 ); + nbits1 += ivas_qmetadata_encode_extended_gr_length( idx_coh[j], cbsize - min_idx, 1 ); + } + if ( nbits0 < nbits1 ) + { + GR_param = 0; + nbits1 = nbits0; + } + else + { + GR_param = 1; + } + GR_param_av = 1; + nbits_av = mean_removed_GR_new( idx_coh, cbsize, nbands, 1, &GR_param_av, &av, mr_idx ); + + if ( nbits_av < nbits1 ) + { + nbits1 = nbits_av; + GR_param = GR_param_av; + /* use average removed */ + push_next_indice( hMetaData, 1, 1 ); + /* write average */ + push_next_indice( hMetaData, av, bits_coh ); + /* write GR param */ + push_next_indice( hMetaData, GR_param, 1 ); + for ( j = 0; j < nbands; j++ ) + { + ivas_qmetadata_encode_extended_gr( hMetaData, mr_idx[j], 2 * cbsize, GR_param ); + } + } + else + { + /* use min removed */ + push_next_indice( hMetaData, 0, 1 ); + /* write min index */ + push_next_indice( hMetaData, min_idx, bits_coh ); + /* write GR param */ + push_next_indice( hMetaData, GR_param, 1 ); + for ( j = 0; j < nbands; j++ ) + { + ivas_qmetadata_encode_extended_gr( hMetaData, idx_coh[j], cbsize - min_idx, GR_param ); + } + } + } + + nbits = hMetaData->nb_bits_tot - nbits; + return nbits; +} +#endif /*-------------------------------------------------------------------* * ivas_qmetadata_quantize_coherence() @@ -4551,7 +5601,12 @@ static int16_t ivas_qmetadata_quantize_coherence( const int16_t all_coherence_zero, /* i : all coherence is zero - flag */ BSTR_ENC_HANDLE hMetaData, /* i : metadata handle */ const int16_t write_flag, /* i : flag to actually write the data or not */ - int16_t *indice_coherence ) + int16_t *indice_coherence +#ifdef HR_METADATA + , + int16_t is_hr +#endif +) { int16_t j, k; float dct_coh[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -4565,7 +5620,10 @@ static int16_t ivas_qmetadata_quantize_coherence( int16_t two_dir_band[MASA_MAXIMUM_CODING_SUBBANDS]; int16_t no_cb_vec[MASA_MAXIMUM_CODING_SUBBANDS]; IVAS_QDIRECTION *q_direction; - +#ifdef HR_METADATA + int16_t min_index; + min_index = 0; +#endif q_direction = &( hQMetaData->q_direction[idx_d] ); coding_subbands = q_direction->cfg.nbands; nbits = 0; @@ -4577,7 +5635,12 @@ static int16_t ivas_qmetadata_quantize_coherence( if ( hQMetaData->q_direction[idx_d].cfg.nblocks == 1 ) { - nbits = encode_spread_coherence_1sf( hQMetaData, idx_d, hMetaData ); + nbits = encode_spread_coherence_1sf( hQMetaData, idx_d, hMetaData +#ifdef HR_METADATA + , + is_hr +#endif + ); return nbits; } @@ -4632,13 +5695,31 @@ static int16_t ivas_qmetadata_quantize_coherence( { /* DCT transform */ dct4_transform( hQMetaData->q_direction[idx_d].coherence_band_data[j].spread_coherence, dct_coh[j] ); - no_cb_vec[j] = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; +#ifdef HR_METADATA + if ( is_hr ) + { + minimum_s( (int16_t *) ( q_direction->band_data[j].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); + no_cb_vec[j] = len_cb_dct0_masa[min_index >> 1]; + } + else + { +#endif + no_cb_vec[j] = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; +#ifdef HR_METADATA + } +#endif if ( write_flag ) { /* quantize first DCT parameter */ - dct_coh[j][0] = quantize_DCT_0_coh( dct_coh[j][0], j, coherence_cb0_masa, MASA_DELTA_AZI_DCT0, MASA_NO_CV_COH, q_direction, &idx_dct[k], &no_cb_vec[j] ); + dct_coh[j][0] = quantize_DCT_0_coh( dct_coh[j][0], j, coherence_cb0_masa, MASA_DELTA_AZI_DCT0, MASA_NO_CV_COH, q_direction, &idx_dct[k], &no_cb_vec[j] +#ifdef HR_METADATA + , + is_hr +#endif + ); } + if ( coding_subbands < coding_subbands_0 ) { idx_dct[k + coding_subbands] = squant( dct_coh[j][1], &dct_coh[j][1], &coherence_cb1_masa[MASA_grouping[two_dir_band[j]] * MASA_NO_CV_COH1], MASA_NO_CV_COH1 ); @@ -4775,21 +5856,85 @@ static void ivas_qmetadata_reorder_2dir_bands( hQMetaData->q_direction[0].band_data[band].distance[sf] = hQMetaData->q_direction[1].band_data[band].distance[sf]; hQMetaData->q_direction[1].band_data[band].distance[sf] = uint8_tmp; +#ifdef HODIRAC + if ( hQMetaData->coherence_flag ) +#endif + { + uint8_tmp = hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf]; + hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = hQMetaData->q_direction[1].coherence_band_data[band].spread_coherence[sf]; + hQMetaData->q_direction[1].coherence_band_data[band].spread_coherence[sf] = uint8_tmp; + } + } +#ifdef HODIRAC + if ( hQMetaData->coherence_flag ) +#endif + { + flt_tmp = hQMetaData->q_direction[0].band_data[band].energy_ratio[0]; + hQMetaData->q_direction[0].band_data[band].energy_ratio[0] = hQMetaData->q_direction[1].band_data[band].energy_ratio[0]; + hQMetaData->q_direction[1].band_data[band].energy_ratio[0] = flt_tmp; + } + } + } + } + + return; +} + +#ifdef HR_METADATA +static void ivas_qmetadata_reorder_2dir_bands_hr( + IVAS_QMETADATA_HANDLE hQMetaData ) +{ + int16_t nbands; + int16_t nsubframes; + int16_t band, sf; + + nbands = hQMetaData->q_direction[0].cfg.nbands; + nsubframes = hQMetaData->q_direction[0].cfg.nblocks; + + for ( band = 0; band < nbands; band++ ) + { + if ( hQMetaData->twoDirBands[band] == 1 ) + { + + for ( sf = 0; sf < nsubframes; sf++ ) + { + if ( hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] < hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] ) + { + uint16_t uint16_tmp = 0; + float flt_tmp = 0; + uint8_t uint8_tmp = 0; + uint16_tmp = hQMetaData->q_direction[0].band_data[band].spherical_index[sf]; + hQMetaData->q_direction[0].band_data[band].spherical_index[sf] = hQMetaData->q_direction[1].band_data[band].spherical_index[sf]; + hQMetaData->q_direction[1].band_data[band].spherical_index[sf] = uint16_tmp; + + flt_tmp = hQMetaData->q_direction[0].band_data[band].azimuth[sf]; + hQMetaData->q_direction[0].band_data[band].azimuth[sf] = hQMetaData->q_direction[1].band_data[band].azimuth[sf]; + hQMetaData->q_direction[1].band_data[band].azimuth[sf] = flt_tmp; + + flt_tmp = hQMetaData->q_direction[0].band_data[band].elevation[sf]; + hQMetaData->q_direction[0].band_data[band].elevation[sf] = hQMetaData->q_direction[1].band_data[band].elevation[sf]; + hQMetaData->q_direction[1].band_data[band].elevation[sf] = flt_tmp; + + uint8_tmp = hQMetaData->q_direction[0].band_data[band].distance[sf]; + hQMetaData->q_direction[0].band_data[band].distance[sf] = hQMetaData->q_direction[1].band_data[band].distance[sf]; + hQMetaData->q_direction[1].band_data[band].distance[sf] = uint8_tmp; + uint8_tmp = hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf]; hQMetaData->q_direction[0].coherence_band_data[band].spread_coherence[sf] = hQMetaData->q_direction[1].coherence_band_data[band].spread_coherence[sf]; hQMetaData->q_direction[1].coherence_band_data[band].spread_coherence[sf] = uint8_tmp; - } - flt_tmp = hQMetaData->q_direction[0].band_data[band].energy_ratio[0]; - hQMetaData->q_direction[0].band_data[band].energy_ratio[0] = hQMetaData->q_direction[1].band_data[band].energy_ratio[0]; - hQMetaData->q_direction[1].band_data[band].energy_ratio[0] = flt_tmp; + + flt_tmp = hQMetaData->q_direction[0].band_data[band].energy_ratio[sf]; + hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = hQMetaData->q_direction[1].band_data[band].energy_ratio[sf]; + hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] = flt_tmp; + } } } } return; } - +#endif /*-------------------------------------------------------------------* * write_2dir_info() @@ -4808,6 +5953,7 @@ static int16_t write_2dir_info( uint16_t dif_p[MASA_MAXIMUM_CODING_SUBBANDS]; int16_t i, j; j = 0; + p[0] = 0; for ( i = 0; i < n; i++ ) { if ( twoDirBands[i] == 1 ) @@ -4858,6 +6004,16 @@ static void transform_azimuth_dir2( { hQMetaData->q_direction[1].band_data[i].azimuth[b] += 360; } +#ifdef HODIRAC + if ( hQMetaData->q_direction[1].band_data[i].azimuth[b] >= 180 ) + { + hQMetaData->q_direction[1].band_data[i].azimuth[b] -= 360; + } + if ( hQMetaData->q_direction[1].band_data[i].azimuth[b] < -180 ) + { + hQMetaData->q_direction[1].band_data[i].azimuth[b] += 360; + } +#endif #ifdef DEBUGGING assert( hQMetaData->q_direction[1].band_data[i].azimuth[b] < 180 && hQMetaData->q_direction[1].band_data[i].azimuth[b] >= -180 ); #endif diff --git a/lib_enc/ivas_qspherical_enc.c b/lib_enc/ivas_qspherical_enc.c index 80a9d0064f2dcfb23dbeb91ed3719dd74e0a526c..3d2df98217deca34987173f49e7226e4ebe21427 100644 --- a/lib_enc/ivas_qspherical_enc.c +++ b/lib_enc/ivas_qspherical_enc.c @@ -59,7 +59,12 @@ static float direction_distance_cp( float theta, float theta_hat, float theta_ha void quantize_direction_frame( IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], - float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] ) + float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] +#ifdef HR_METADATA + , + int16_t is_hr +#endif +) { int16_t i, j; int16_t idx; @@ -92,17 +97,36 @@ void quantize_direction_frame( q_direction->not_in_2D += q_direction->band_data[i].elevation_index[j]; - if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) +#ifdef HR_METADATA + if ( is_hr ) { - q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[idx] - 3]; - q_direction->band_data[i].azimuth_m_alphabet[j] = no_phi_masa[bits_direction_masa[idx] - 1][q_direction->band_data[i].elevation_index[j]]; + if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) + { + q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[0] - 3]; + q_direction->band_data[i].azimuth_m_alphabet[j] = no_phi_masa[bits_direction_masa[0] - 1][q_direction->band_data[i].elevation_index[j]]; + } + else + { + q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[0] - 3] * 2 - 1; + q_direction->band_data[i].azimuth_m_alphabet[j] = no_phi_masa[bits_direction_masa[0] - 1][( q_direction->band_data[i].elevation_index[j] + 1 ) >> 1]; + } } else { - q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[idx] - 3] * 2 - 1; - q_direction->band_data[i].azimuth_m_alphabet[j] = no_phi_masa[bits_direction_masa[idx] - 1][( q_direction->band_data[i].elevation_index[j] + 1 ) >> 1]; +#endif + if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) + { + q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[idx] - 3]; + q_direction->band_data[i].azimuth_m_alphabet[j] = no_phi_masa[bits_direction_masa[idx] - 1][q_direction->band_data[i].elevation_index[j]]; + } + else + { + q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[idx] - 3] * 2 - 1; + q_direction->band_data[i].azimuth_m_alphabet[j] = no_phi_masa[bits_direction_masa[idx] - 1][( q_direction->band_data[i].elevation_index[j] + 1 ) >> 1]; + } +#ifdef HR_METADATA } - +#endif if ( q_direction->band_data[i].azimuth_index[j] == MASA_NO_INDEX ) { q_direction->band_data[i].azimuth_index[j] = 0; diff --git a/lib_enc/ivas_rom_enc.c b/lib_enc/ivas_rom_enc.c index ae7cd2ee1a6c29c3f1fdcb2ae51b93bf31803ce1..3a26ce03e52c9d9c2d85b805f01b6549176d5dfa 100644 --- a/lib_enc/ivas_rom_enc.c +++ b/lib_enc/ivas_rom_enc.c @@ -723,4 +723,121 @@ const float Stereo_dmx_wnd_coef_48k[L_FRAME48k] = { }; +#ifdef MC_PARAMUPMIX_MODE +const HUFF_TABLE huff_alpha_table[2] = +{ + { /* Alfa Fine */ + { /* df0 */ + { 0x0002ce, 0x000b5e, 0x0004fe, 0x0005ae, 0x00027e, 0x0002de, 0x00016a, 0x0000b2, 0x00004a, 0x00004b, + 0x0000b6, 0x00004e, 0x000024, 0x00002e, 0x00000a, 0x000006, 0x000000, 0x000007, 0x000008, 0x00002f, + 0x000026, 0x000058, 0x0000b4, 0x00009e, 0x00016e, 0x000166, 0x0002df, 0x0002cf, 0x00027c, 0x00027d, + 0x0004ff, 0x000b5f, 0x0002d6 }, + { 10, 12, 11, 11, 10, 10, 9, 8, 7, 7, + 8, 7, 6, 6, 4, 3, 1, 3, 4, 6, + 6, 7, 8, 8, 9, 9, 10, 10, 10, 10, + 11, 12, 10 } + }, + { /* df */ + { 0x0011de, 0x011ffe, 0x013dea, 0x013df6, 0x008eea, 0x013df7, 0x013dee, 0x013deb, 0x013dec, 0x008eee, + 0x008ffe, 0x009efe, 0x0047fe, 0x004f7c, 0x0023fe, 0x0011fe, 0x0013fe, 0x0008f6, 0x0009ee, 0x000476, + 0x00047a, 0x0004f6, 0x00023a, 0x00027a, 0x00027e, 0x00013e, 0x00009a, 0x00004c, 0x00004e, 0x000012, + 0x00000a, 0x000006, 0x000000, 0x000007, 0x00000b, 0x000010, 0x000022, 0x000046, 0x00009b, 0x00013c, + 0x00011c, 0x00023e, 0x00023c, 0x0004fe, 0x00047e, 0x0009fe, 0x0008fe, 0x0008f7, 0x0013ff, 0x0011df, + 0x0027bc, 0x004f7e, 0x004776, 0x009efa, 0x009ef4, 0x013dfe, 0x008eeb, 0x008ee8, 0x013dff, 0x008ee9, + 0x008eef, 0x011fff, 0x013ded, 0x013def, 0x0011dc }, + { 13, 17, 17, 17, 16, 17, 17, 17, 17, 16, + 16, 16, 15, 15, 14, 13, 13, 12, 12, 11, + 11, 11, 10, 10, 10, 9, 8, 7, 7, 5, + 4, 3, 1, 3, 4, 5, 6, 7, 8, 9, + 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, + 14, 15, 15, 16, 16, 17, 16, 16, 17, 16, + 16, 17, 17, 17, 13 } + }, + { /* dt */ + { 0x00eeee, 0x03b3ee, 0x03b3f6, 0x03b3fc, 0x01d9bc, 0x01d9bd, 0x01d9b2, 0x03b3fe, 0x01d9be, 0x01d9f6, + 0x01d9fc, 0x00ecda, 0x00ecfa, 0x00eeef, 0x00766e, 0x007776, 0x003b3a, 0x003bba, 0x001d9a, 0x001ddc, + 0x001dde, 0x000eec, 0x000764, 0x000772, 0x0003b0, 0x0003b8, 0x0001da, 0x0001de, 0x000072, 0x000038, + 0x00001e, 0x000006, 0x000000, 0x000002, 0x00001f, 0x00003a, 0x000073, 0x0001df, 0x0001db, 0x0003ba, + 0x0003b1, 0x000773, 0x000765, 0x000eed, 0x000ecc, 0x001d9e, 0x001d9c, 0x003bbe, 0x003b3b, 0x00777e, + 0x00767c, 0x00eefe, 0x00ecfc, 0x00ecd8, 0x01d9fd, 0x01d9fa, 0x01d9bf, 0x01d9b6, 0x01d9b3, 0x03b3fd, + 0x01d9b7, 0x03b3ff, 0x03b3ef, 0x03b3f7, 0x00eeff }, + { 16, 18, 18, 18, 17, 17, 17, 18, 17, 17, + 17, 16, 16, 16, 15, 15, 14, 14, 13, 13, + 13, 12, 11, 11, 10, 10, 9, 9, 7, 6, + 5, 3, 1, 2, 5, 6, 7, 9, 9, 10, + 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, + 15, 16, 16, 16, 17, 17, 17, 17, 17, 18, + 17, 18, 18, 18, 16 } + } + }, /* End Alfa Fine */ + { /* Alfa Coarse */ + { /* df0 */ + { 0x0003be, 0x0003fe, 0x0001fe, 0x0000fe, 0x00003e, 0x00003a, 0x00001e, 0x000002, 0x000000, 0x000006, + 0x00001c, 0x00007e, 0x000076, 0x0000ee, 0x0001de, 0x0003ff, 0x0003bf }, + { 10, 10, 9, 8, 6, 6, 5, 2, 1, 3, + 5, 7, 7, 8, 9, 10, 10 } + }, + { /* df */ + { 0x007c76, 0x03e3fe, 0x01f1f6, 0x01f1f7, 0x00f8ea, 0x007c74, 0x007c7c, 0x001f1c, 0x000f9e, 0x0007ce, + 0x0003e2, 0x0001f0, 0x0000fa, 0x00007e, 0x00000e, 0x000006, 0x000000, 0x000002, 0x00001e, 0x00007f, + 0x0000fb, 0x0001f2, 0x0003e6, 0x0007c6, 0x000f9f, 0x001f1e, 0x007c7e, 0x00f8fe, 0x00f8fa, 0x01f1fe, + 0x00f8eb, 0x03e3ff, 0x007c77 }, + { 15, 18, 17, 17, 16, 15, 15, 13, 12, 11, + 10, 9, 8, 7, 4, 3, 1, 2, 5, 7, + 8, 9, 10, 11, 12, 13, 15, 16, 16, 17, + 16, 18, 15 } + }, + { /* dt */ + { 0x003efc, 0x00fbfa, 0x007ddc, 0x00fbfe, 0x007dde, 0x007dfc, 0x003ef6, 0x001f76, 0x000fba, 0x000fbe, + 0x0003ec, 0x0001f2, 0x0000f8, 0x00007e, 0x00001e, 0x000006, 0x000000, 0x000002, 0x00000e, 0x00007f, + 0x0000fa, 0x0001f3, 0x0003ed, 0x0007dc, 0x000fbc, 0x001f7a, 0x003ef7, 0x007dfe, 0x007ddf, 0x00fbff, + 0x007ddd, 0x00fbfb, 0x003efd }, + { 14, 16, 15, 16, 15, 15, 14, 13, 12, 12, + 10, 9, 8, 7, 5, 3, 1, 2, 4, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 15, 16, + 15, 16, 14 } + } + } /* End Alfa Coarse */ +}; + +const HUFF_TABLE huff_beta_table[2] = +{ + { /* Beta Fine */ + { /* df0 */ + { 0x000000, 0x000002, 0x000006, 0x00000e, 0x00001e, 0x00003e, 0x00007e, 0x0000fe, 0x0000ff }, + { 1, 2, 3, 4, 5, 6, 7, 8, 8 } + }, + { /* df */ + { 0x001f1e, 0x000f8e, 0x0003e2, 0x0001f2, 0x0000fa, 0x00007e, 0x00001e, 0x000006, 0x000000, 0x000002, + 0x00000e, 0x00007f, 0x0000fb, 0x0001f3, 0x0001f0, 0x0007c6, 0x001f1f }, + { 13, 12, 10, 9, 8, 7, 5, 3, 1, 2, + 4, 7, 8, 9, 9, 11, 13 } + }, + { /* dt */ + { 0x007dfe, 0x003efe, 0x000fbe, 0x0003ee, 0x0000fa, 0x00007e, 0x00001e, 0x000006, 0x000000, 0x000002, + 0x00000e, 0x00007f, 0x00007c, 0x0001f6, 0x0007de, 0x001f7e, 0x007dff }, + { 15, 14, 12, 10, 8, 7, 5, 3, 1, 2, + 4, 7, 7, 9, 11, 13, 15 } + } + }, /* End Beta Fine */ + { /* Beta Coarse */ + { /* df0 */ + { 0x000000, 0x000002, 0x000006, 0x00000e, 0x00000f }, + { 1, 2, 3, 4, 4 } + }, + { /* df */ + { 0x0000fe, 0x00003e, 0x00000e, 0x000006, 0x000000, 0x000002, 0x00001e, 0x00007e, 0x0000ff }, + { 8, 6, 4, 3, 1, 2, 5, 7, 8 } + }, + { /* dt */ + { 0x0000fe, 0x00007e, 0x00001e, 0x000006, 0x000000, 0x000002, 0x00000e, 0x00003e, 0x0000ff }, + { 8, 7, 5, 3, 1, 2, 4, 6, 8 } + } + } /* End Beta Coarse */ +}; + +const int16_t mc_paramupmix_fb_remix_order[4] = {0, 1, 2, 3}; + +#endif + /* clang-format on */ diff --git a/lib_enc/ivas_rom_enc.h b/lib_enc/ivas_rom_enc.h index d240fb69187fded50b89d4c3ae5056002b238f30..9fe2015eee5d579314cbc1c5a6f3223031aed5ed 100644 --- a/lib_enc/ivas_rom_enc.h +++ b/lib_enc/ivas_rom_enc.h @@ -126,5 +126,10 @@ extern const float Stereo_dmx_s_wnd_coef_48k[L_FRAME48k >> 4]; extern const float Stereo_dmx_wnd_coef_32k[L_FRAME32k]; extern const float Stereo_dmx_wnd_coef_48k[L_FRAME48k]; +#ifdef MC_PARAMUPMIX_MODE +extern const HUFF_TABLE huff_alpha_table[2]; +extern const HUFF_TABLE huff_beta_table[2]; +extern const int16_t mc_paramupmix_fb_remix_order[4]; +#endif #endif diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 7fd96ae46e544189213b62382466037473094778..d013df5f4e5d064524c42e057eda823c9ad51b4b 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -58,7 +58,10 @@ void ivas_sba_getTCs( const int16_t input_frame /* i : frame length */ ) { - ivas_sba_zero_vert_comp( sba_data, st_ivas->sba_analysis_order, st_ivas->hEncoderConfig->sba_planar, input_frame ); + if ( st_ivas->hEncoderConfig->sba_planar ) + { + ivas_sba_zero_vert_comp( sba_data, st_ivas->sba_analysis_order, st_ivas->hEncoderConfig->sba_planar, input_frame ); + } st_ivas->nchan_transport = ivas_get_sba_num_TCs( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); @@ -92,228 +95,6 @@ void ivas_sba_getTCs( return; } -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -/*-------------------------------------------------------------------* - * ivas_sba_enc_reinit() - * - * Reinitialise IVAS SBA encoder - *-------------------------------------------------------------------*/ - -ivas_error ivas_sba_enc_reinit( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -) -{ - int16_t nSCE_old; - int16_t nCPE_old; - int16_t sce_id; - int16_t cpe_id; - int16_t n; - Indice *ind_list_metadata; - int32_t ivas_total_brate; - int16_t i, nchan_inp; - ivas_error error; - ENCODER_CONFIG_HANDLE hEncoderConfig; - - Indice *ind_list; - BSTR_ENC_HANDLE hBstr; - BSTR_ENC_HANDLE hMetaData; - hEncoderConfig = st_ivas->hEncoderConfig; - ivas_total_brate = hEncoderConfig->ivas_total_brate; - error = IVAS_ERR_OK; - nchan_inp = st_ivas->hEncoderConfig->nchan_inp; - ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; - - nCPE_old = st_ivas->nCPE; - nSCE_old = st_ivas->nSCE; - ind_list_metadata = NULL; - - - ind_list = NULL; - hBstr = NULL; - hMetaData = NULL; - - /* get the index list pointers */ - if ( nSCE_old ) - { - hBstr = st_ivas->hSCE[0]->hCoreCoder[0]->hBstr; - hMetaData = st_ivas->hSCE[0]->hMetaData; - } - else if ( nCPE_old ) - { - hBstr = st_ivas->hCPE[0]->hCoreCoder[0]->hBstr; - hMetaData = st_ivas->hCPE[nCPE_old - 1]->hMetaData; - } - - /* save bitstream information */ - ind_list = hBstr->ind_list; - ind_list_metadata = hMetaData->ind_list; - - /*------------------------------------------------------------------------------------------* - * Closing Encoder handles before Reinitialisation - *------------------------------------------------------------------------------------------*/ - - /* Q Metadata handle */ - ivas_qmetadata_close( &( st_ivas->hQMetaData ) ); - /* DirAC handle */ - if ( st_ivas->hDirAC != NULL ) - { - ivas_dirac_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); - - st_ivas->hDirAC = NULL; - } - - /* SPAR handle */ - if ( st_ivas->hSpar != NULL ) - { - ivas_spar_enc_close( st_ivas->hSpar, st_ivas->hEncoderConfig->input_Fs, nchan_inp ); - st_ivas->hSpar = NULL; - } - /* SCE handles */ - for ( i = 0; i < MAX_SCE; i++ ) - { - if ( st_ivas->hSCE[i] != NULL ) - { - destroy_sce_enc( st_ivas->hSCE[i] ); - st_ivas->hSCE[i] = NULL; - } - } - - /* CPE handles */ - for ( i = 0; i < MAX_CPE; i++ ) - { - if ( st_ivas->hCPE[i] != NULL ) - { - destroy_cpe_enc( st_ivas->hCPE[i] ); - st_ivas->hCPE[i] = NULL; - } - } - /* MCT handle */ - if ( st_ivas->hMCT != NULL ) - { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; - } - if ( st_ivas->mem_hp20_in != NULL ) - { - n = getNumChanAnalysis( st_ivas ); - - for ( i = 0; i < n; i++ ) - { - free( st_ivas->mem_hp20_in[i] ); - st_ivas->mem_hp20_in[i] = NULL; - } - free( st_ivas->mem_hp20_in ); - st_ivas->mem_hp20_in = NULL; - } - - /*------------------------------------------------------------------------------------------* - * Reopening Encoder handles for Reinitialisation - *------------------------------------------------------------------------------------------*/ - - if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); - st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); - - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - if ( ( error = ivas_spar_enc_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_enc_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - if ( ( error = create_sce_enc( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* prepare bitstream buffers */ - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list + sce_id * MAX_NUM_INDICES; - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - - st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata + sce_id * MAX_BITS_METADATA; - reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); - - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->hEncoderConfig->Opt_DTX_ON ) - { - st_ivas->hSCE[sce_id]->hCoreCoder[0]->dtx_sce_sba = 1; - } - } - - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* prepare bitstream buffers */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n ) * MAX_NUM_INDICES; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); - - if ( hEncoderConfig->Opt_DTX_ON ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 1; - } - } - - /* Metadata only initialized for the last CPE index */ - if ( cpe_id == st_ivas->nCPE - 1 ) - { - st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata + sce_id * MAX_BITS_METADATA; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); - } - } - - if ( st_ivas->nCPE > 1 ) - { - if ( ( error = create_mct_enc( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - n = getNumChanAnalysis( st_ivas ); - - if ( n > 0 ) - { - if ( ( st_ivas->mem_hp20_in = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - } - else - { - st_ivas->mem_hp20_in = NULL; - } - - for ( i = 0; i < n; i++ ) - { - if ( ( st_ivas->mem_hp20_in[i] = (float *) malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - set_f( st_ivas->mem_hp20_in[i], 0.0f, L_HP20_MEM ); - } - return error; -} -#endif -#endif /*-------------------------------------------------------------------* * ivas_sba_enc_reconfigure() @@ -325,55 +106,119 @@ ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) { - int16_t nSCE_old, nCPE_old, nchan_transport_old; + int16_t n, nSCE_old, nCPE_old, nchan_transport_old; int32_t ivas_total_brate; ivas_error error; ENCODER_CONFIG_HANDLE hEncoderConfig; error = IVAS_ERR_OK; - hEncoderConfig = st_ivas->hEncoderConfig; ivas_total_brate = hEncoderConfig->ivas_total_brate; if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) { -#ifdef SBA_BR_SWITCHING DIRAC_ENC_HANDLE hDirAC = st_ivas->hDirAC; SPAR_ENC_HANDLE hSpar; - SBA_MODE sba_mode_old; + int16_t analysis_order_old; + int16_t spar_reconfig_flag; +#ifdef FIX_DTX_428 + int16_t nbands_old; + int16_t ndir_old; #endif + + spar_reconfig_flag = 0; nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; -#ifdef SBA_BR_SWITCHING_RECONFIG - sba_mode_old = st_ivas->sba_mode; -#endif - st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); -#ifdef SBA_BR_SWITCHING - st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); + analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); +#ifdef FIX_DTX_428 + nbands_old = st_ivas->hQMetaData->q_direction->cfg.nbands; + ndir_old = st_ivas->hQMetaData->no_directions; +#endif - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + if ( analysis_order_old != st_ivas->sba_analysis_order ) { - if ( st_ivas->hSpar == NULL ) + int16_t i, n_old; + float **old_mem_hp20_in; + +#ifdef HODIRAC + n_old = ( analysis_order_old + 1 ) * ( analysis_order_old + 1 ); + n = ( st_ivas->sba_analysis_order + 1 ) * ( st_ivas->sba_analysis_order + 1 ); +#else + n_old = ivas_sba_get_nchan_metadata( analysis_order_old ); + n = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order ); +#endif + + if ( n > n_old ) { - if ( ( error = ivas_spar_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + /* save old mem_hp_20 pointer */ + old_mem_hp20_in = st_ivas->mem_hp20_in; + st_ivas->mem_hp20_in = NULL; + + if ( ( st_ivas->mem_hp20_in = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) { - return error; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + + for ( i = 0; i < n_old; i++ ) + { + st_ivas->mem_hp20_in[i] = old_mem_hp20_in[i]; + old_mem_hp20_in[i] = NULL; + } + /* create additional hp20 memories */ + for ( ; i < n; i++ ) + { + if ( ( st_ivas->mem_hp20_in[i] = (float *) malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + + set_f( st_ivas->mem_hp20_in[i], 0.0f, L_HP20_MEM ); } - // VE: TBV - populate 'hSpar->hFrontVad' with 'hCoreCoder[0]' instead of resetting it to init-state? + free( old_mem_hp20_in ); + old_mem_hp20_in = NULL; } + else if ( n < n_old ) + { + /* save old mem_hp_20 pointer */ + old_mem_hp20_in = st_ivas->mem_hp20_in; + st_ivas->mem_hp20_in = NULL; + + if ( ( st_ivas->mem_hp20_in = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } - ivas_spar_config( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), - &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); + for ( i = 0; i < n; i++ ) + { + st_ivas->mem_hp20_in[i] = old_mem_hp20_in[i]; + old_mem_hp20_in[i] = NULL; + } + /* remove superfluous hp20 memories */ + for ( ; i < n_old; i++ ) + { + free( old_mem_hp20_in[i] ); + old_mem_hp20_in[i] = NULL; + } + + free( old_mem_hp20_in ); + old_mem_hp20_in = NULL; + } } - else + ivas_spar_config( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), + &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); + + for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) { - ivas_spar_enc_close( st_ivas->hSpar, hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp ); - st_ivas->hSpar = NULL; + if ( hDirAC->sba_synchro_buffer[n] != NULL ) + { + free( hDirAC->sba_synchro_buffer[n] ); + hDirAC->sba_synchro_buffer[n] = NULL; + } } - + hDirAC->num_samples_synchro_delay = 0; hSpar = st_ivas->hSpar; if ( st_ivas->nchan_transport == 1 ) @@ -384,160 +229,59 @@ ivas_error ivas_sba_enc_reconfigure( { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } - + if ( nchan_transport_old != st_ivas->nchan_transport +#ifdef HODIRAC + || ( ivas_total_brate < IVAS_512k && hEncoderConfig->last_ivas_total_brate >= IVAS_512k ) || ( ivas_total_brate >= IVAS_512k && hEncoderConfig->last_ivas_total_brate < IVAS_512k ) #endif -#ifdef SBA_BR_SWITCHING_RECONFIG - /*TODO : Verify if full SPAR close and open can be used instead of submodules close and open */ - if ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) + ) { /* FB mixer handle */ - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - // VE: TBV whether 'hFbMixer' can be reused - if ( hDirAC->hFbMixer != NULL ) - { - ivas_FB_mixer_close( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs ); - hDirAC->hFbMixer = NULL; - } - - if ( sba_mode_old == SBA_MODE_SPAR ) - { - // VE: dirty patch -> reconfiguration of SPAR MD, TD_decorr, FbMixer modules should be used instead !! - - IVAS_FB_CFG *fb_cfg; - int16_t nchan_internal, sba_order_internal; - int16_t table_idx, active_w_mixing; - - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - nchan_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); - - /* Covar. State handle */ - ivas_spar_covar_enc_close( &hSpar->hCovEnc, hSpar->hFbMixer->fb_cfg->num_in_chans ); - - /* MD handle */ - ivas_spar_md_enc_close( &hSpar->hMdEnc ); - - if ( ( error = ivas_spar_md_enc_open( &( hSpar->hMdEnc ), hEncoderConfig, sba_order_internal ) ) != IVAS_ERR_OK ) - { - return error; - } - /*Initialization*/ - hSpar->hMdEnc->table_idx = -1; - /* FB mixer handle */ - ivas_FB_mixer_close( &hSpar->hFbMixer, hEncoderConfig->input_Fs ); - - table_idx = ivas_get_spar_table_idx( ivas_total_brate, sba_order_internal, SPAR_CONFIG_BW, NULL, NULL ); - active_w_mixing = ivas_spar_br_table_consts[table_idx].active_w; - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_internal, st_ivas->nchan_transport, active_w_mixing, hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - fb_cfg->remix_order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; - - if ( ( error = ivas_FB_mixer_open( &( hSpar->hFbMixer ), hEncoderConfig->input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* Covar. State handle */ - if ( ( error = ivas_spar_covar_enc_open( &( hSpar->hCovEnc ), hSpar->hFbMixer->pFb, hEncoderConfig->input_Fs, nchan_internal ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else + if ( hDirAC->hFbMixer != NULL ) { - if ( hDirAC->hFbMixer == NULL ) - { - IVAS_FB_CFG *fb_cfg; - - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_DIRAC, DIRAC_MAX_ANA_CHANS, 0, 0, hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* Allocate and initialize FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) - { - return error; - } - } + ivas_FB_mixer_close( &( hDirAC->hFbMixer ), hEncoderConfig->input_Fs, 0 ); + hDirAC->hFbMixer = NULL; } + spar_reconfig_flag = 1; + ivas_spar_enc_close( &( st_ivas->hSpar ), hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); - /* initalize delay for SPAR/DirAC delay synchronization */ - if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) ) + if ( ( error = ivas_spar_enc_open( st_ivas, spar_reconfig_flag ) ) != IVAS_ERR_OK ) { - int16_t n; - - if ( hDirAC->num_samples_synchro_delay == 0 ) - { - hDirAC->num_samples_synchro_delay = NS2SA( hEncoderConfig->input_Fs, IVAS_FB_ENC_DELAY_NS ); - - for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) - { - if ( ( hDirAC->sba_synchro_buffer[n] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hDirAC synchro buffer\n" ) ); - } - set_zero( hDirAC->sba_synchro_buffer[n], hDirAC->num_samples_synchro_delay ); - } - for ( ; n < DIRAC_MAX_ANA_CHANS; n++ ) - { - hDirAC->sba_synchro_buffer[n] = NULL; - } - } + return error; } - else + } + hEncoderConfig->spar_reconfig_flag = spar_reconfig_flag; + if ( ( error = ivas_dirac_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_DTX_428 + if ( st_ivas->hQMetaData->q_direction->cfg.nbands != nbands_old || st_ivas->hQMetaData->no_directions != ndir_old ) + { + int16_t dir, j, i; + IVAS_QDIRECTION *q_direction = st_ivas->hQMetaData->q_direction; + for ( dir = 0; dir < st_ivas->hQMetaData->no_directions; dir++ ) { - for ( int16_t n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) + for ( j = 0; j < q_direction[dir].cfg.nbands; j++ ) { - if ( hDirAC->sba_synchro_buffer[n] != NULL ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - free( hDirAC->sba_synchro_buffer[n] ); - hDirAC->sba_synchro_buffer[n] = NULL; + q_direction[dir].band_data[j].energy_ratio_index[i] = 0; + q_direction[dir].band_data[j].energy_ratio_index_mod[i] = 0; } } - hDirAC->num_samples_synchro_delay = 0; } } - -#endif - ivas_dirac_enc_reconfigure( st_ivas ); - -#ifdef SBA_BR_SWITCHING - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); - hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; - } #endif + mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); + hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; /*-----------------------------------------------------------------* - * Allocate, initalize, and configure SCE/CPE/MCT handles + * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ - ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ); - -#ifdef SBA_BR_SWITCHING_RECONFIG - if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) + if ( ( error = ivas_corecoder_enc_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, ivas_total_brate / st_ivas->nchan_transport, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS, MC_MODE_NONE ) ) != IVAS_ERR_OK ) { - if ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) - { - for ( int16_t sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - st_ivas->hSCE[sce_id]->hCoreCoder[0]->ini_frame = 1; - } - - for ( int16_t cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( int16_t n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->ini_frame = 1; - } - } - } + return error; } -#endif } return error; diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 0134efc0f096a851b04d818afa0c72544872f40e..c8577a85bae41f124907bdd60809cca4d529b7d6 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -185,7 +185,7 @@ ivas_error ivas_sce_enc( &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, - st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->hEncoderConfig->ivas_format ); + st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; @@ -251,6 +251,9 @@ ivas_error ivas_sce_enc( hSCE->last_element_brate = hSCE->element_brate; + /* Store previous attack detection flag */ + st->hTranDet->transientDetector.prev_bIsAttackPresent = st->hTranDet->transientDetector.bIsAttackPresent; + #ifdef DEBUG_MODE_INFO { float tmpF = hSCE->element_brate / 1000.0f; @@ -329,7 +332,7 @@ ivas_error create_sce_enc( st->total_brate = hSCE->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - if ( ( error = init_encoder( st, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( st, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_sns_enc.c b/lib_enc/ivas_sns_enc.c index 9eeb4d87605cc97362ea2ffbb5bcc34f96512fd1..7a93e335f21b775e1dda2463edc3391db354585f 100644 --- a/lib_enc/ivas_sns_enc.c +++ b/lib_enc/ivas_sns_enc.c @@ -38,6 +38,10 @@ #include "prot.h" #include "ivas_prot.h" #include "rom_com.h" +#ifdef SNS_MSVQ +#include "ivas_rom_com.h" +#include "ivas_cnst.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -51,6 +55,95 @@ *-------------------------------------------------------------------*/ /* r : codebook index */ +#ifdef FIX_445_SNS_BUGFIXES +static int16_t sns_1st_cod( + const float *sns, /* i : vector to quantize */ + const int16_t L_frame, + const int16_t core, + float *snsq /* o : quantized sns */ +) +{ + int16_t index; + const int16_t split_len = M / 2; + const int16_t *means; + const float means_fix2float = 1.f / powf( 2, SNS_MEANS_BITS_4_FRAC ); + + /* remove means */ + means = NULL; + switch ( L_frame ) + { + case L_FRAME16k: + means = &sns_1st_means_16k[core - 1][0]; + break; + case L_FRAME25_6k: + means = &sns_1st_means_25k6[core - 1][0]; + break; + case L_FRAME32k: + means = &sns_1st_means_32k[core - 1][0]; + break; + default: + assert( !"illegal frame length in sns_1st_cod" ); + } + + for ( int16_t i = 0; i < M; ++i ) + { + snsq[i] = sns[i] - means[i] * means_fix2float; + } + + index = 0; + for ( int16_t split = 0; split < 2; ++split ) + { + const int16_t *cdbk_ptr; + int16_t j0, j1, index_split; + float dist_min; + const float cdbk_fix2float = 1.f / powf( 2, SNS_CDBKS_BITS_4_FRAC ); + const int16_t *const cdbk = &sns_1st_cdbk[split][core - 1][0]; + + j0 = split * split_len; + j1 = j0 + split_len; + + cdbk_ptr = cdbk; + dist_min = 1.0e30f; + index_split = 0; + for ( int16_t i = 0; i < 32; ++i ) + { + float dist; + + dist = 0.f; + for ( int16_t j = j0; j < j1; ++j ) + { + float tmp; + + tmp = snsq[j] - ( *cdbk_ptr++ ) * cdbk_fix2float; + dist += tmp * tmp; + } + + if ( dist < dist_min ) + { + dist_min = dist; + index_split = i; + } + } + + /* set quantized vector */ + cdbk_ptr = &cdbk[index_split * split_len]; + for ( int16_t j = j0; j < j1; ++j ) + { + snsq[j] = ( *cdbk_ptr++ ) * cdbk_fix2float + means[j] * means_fix2float; + } + + /* for second split shift by five bits to store both indices as one 10 bit value */ + if ( split == 1 ) + { + index_split <<= 5; + } + + index += index_split; + } + + return index; +} +#else static int16_t sns_1st_cod( const float *sns, /* i : vector to quantize */ float *snsq /* i/o: i:prediction o:quantized sns */ @@ -127,10 +220,11 @@ static int16_t sns_1st_cod( return index; } +#endif /*------------------------------------------------------------------- - * sns_1st_cod() + * sns_2st_cod() * * *-------------------------------------------------------------------*/ @@ -193,12 +287,15 @@ static int16_t sns_2st_cod( *-------------------------------------------------------------------*/ void sns_avq_cod( - const float *sns, /* i : Input sns vectors */ - const float *snsmid, /* i : Input mid-sns vectors */ - float *sns_q, /* o : Quantized LFS vectors */ - float *snsmid_q, /* o : Quantized mid-LFS vectors */ - int16_t *index, /* o : Quantization indices */ - const int16_t core, /* i : core */ + const float *sns, /* i : Input sns vectors */ + const float *snsmid, /* i : Input mid-sns vectors */ + float *sns_q, /* o : Quantized LFS vectors */ + float *snsmid_q, /* o : Quantized mid-LFS vectors */ + int16_t *index, /* o : Quantization indices */ + const int16_t core, /* i : core */ +#ifdef FIX_445_SNS_BUGFIXES + const int16_t L_frame, +#endif const int16_t low_brate_mode /* i : flag low bit operating mode */ ) { @@ -206,7 +303,11 @@ void sns_avq_cod( float snsmid_q0[M]; int16_t indxt[256], nbits, nbt, nit; +#ifdef FIX_445_SNS_BUGFIXES + index[0] = sns_1st_cod( sns, L_frame, core, sns_q ); +#else index[0] = sns_1st_cod( sns, sns_q ); +#endif nit = 1 + 2; if ( !low_brate_mode ) { @@ -227,7 +328,11 @@ void sns_avq_cod( { index++; +#ifdef FIX_445_SNS_BUGFIXES + index[0] = sns_1st_cod( snsmid, L_frame, core, snsmid_q ); +#else index[0] = sns_1st_cod( snsmid, snsmid_q ); +#endif nit = 1 + 2; if ( !low_brate_mode ) { @@ -282,12 +387,15 @@ void sns_avq_cod( *-------------------------------------------------------------------*/ void sns_avq_cod_stereo( - const float *snsl, /* i : Input sns vector (left channel) */ - const float *snsr, /* i : Input sns vector (right channel) */ - float *snsl_q, /* o : Quantized sns vector (left channel) */ - float *snsr_q, /* o : Quantized sns vector (right channel) */ - int16_t *indexl, /* o : Quantization indices (left channel) */ - int16_t *indexr /* o : Quantization indices (right channel) */ + const float *snsl, /* i : Input sns vector (left channel) */ + const float *snsr, /* i : Input sns vector (right channel) */ +#ifdef FIX_445_SNS_BUGFIXES + const int16_t L_frame, +#endif + float *snsl_q, /* o : Quantized sns vector (left channel) */ + float *snsr_q, /* o : Quantized sns vector (right channel) */ + int16_t *indexl, /* o : Quantization indices (left channel) */ + int16_t *indexr /* o : Quantization indices (right channel) */ ) { int16_t i, flag_zero; @@ -327,7 +435,11 @@ void sns_avq_cod_stereo( } /* Quantize mid */ +#ifdef FIX_445_SNS_BUGFIXES + indexl[0] = sns_1st_cod( mid, L_frame, TCX_20_CORE, mid_q ); +#else indexl[0] = sns_1st_cod( mid, mid_q ); +#endif sns_2st_cod( mid, mid_q, &indexl[1] ); /* Quantize side */ @@ -367,13 +479,217 @@ void sns_avq_cod_stereo( *indexr++ = 1; /* Quantize left */ +#ifdef FIX_445_SNS_BUGFIXES + indexl[0] = sns_1st_cod( snsl, L_frame, TCX_20_CORE, snsl_q ); +#else indexl[0] = sns_1st_cod( snsl, snsl_q ); +#endif sns_2st_cod( snsl, snsl_q, &indexl[1] ); /* Quantize right */ +#ifdef FIX_445_SNS_BUGFIXES + indexr[0] = sns_1st_cod( snsr, L_frame, TCX_20_CORE, snsr_q ); +#else indexr[0] = sns_1st_cod( snsr, snsr_q ); +#endif sns_2st_cod( snsr, snsr_q, &indexr[1] ); } return; } + +#ifdef SNS_MSVQ +int16_t quantize_sns( + float sns_in[CPE_CHANNELS][NB_DIV][M], + float snsQ_out[CPE_CHANNELS][NB_DIV][M], + Encoder_State **sts, + int16_t *indices, + int16_t *zero_side_flag, + int16_t *sns_stereo_mode ) +{ + int16_t nSubframes, k, ch, i; + int16_t nbits, idxIndices; + Encoder_State *st; + float weights[M]; +#ifndef FIX_445_SNS_BUGFIXES + const float *means; +#endif + + nbits = 0; + idxIndices = 0; + set_f( weights, 1.0f, M ); + + /* stereo mode decision */ + sns_stereo_mode[0] = SNS_STEREO_MODE_LR; + sns_stereo_mode[1] = SNS_STEREO_MODE_LR; + zero_side_flag[0] = 0; + zero_side_flag[1] = 0; + +#ifdef FIX_445_SNS_BUGFIXES + /* use snsQ_out as buffer, move input vectors */ + for ( ch = 0; ch < CPE_CHANNELS; ++ch ) + { + nSubframes = ( sts[ch]->core == TCX_20_CORE ) ? 1 : NB_DIV; + for ( k = 0; k < nSubframes; ++k ) + { + mvr2r( sns_in[ch][k], snsQ_out[ch][k], M ); + } + } +#endif + + if ( sts[0]->core == sts[1]->core ) + { + nSubframes = ( sts[0]->core == TCX_20_CORE ) ? 1 : NB_DIV; + + for ( k = 0; k < nSubframes; ++k ) + { +#ifdef FIX_445_SNS_BUGFIXES + float side[M]; +#else + float *side; +#endif + float ener_side; + +#ifdef FIX_445_SNS_BUGFIXES + v_sub( snsQ_out[0][k], snsQ_out[1][k], side, M ); +#else + side = &snsQ_out[1][k][0]; + v_sub( sns_in[0][k], sns_in[1][k], side, M ); +#endif + ener_side = dotp( side, side, M ); + + sns_stereo_mode[k] = ener_side < 12.f; + zero_side_flag[k] = ener_side < 1.f; + +#ifdef FIX_445_SNS_BUGFIXES + if ( sns_stereo_mode[k] == SNS_STEREO_MODE_MS ) + { + convertToMS( M, snsQ_out[0][k], snsQ_out[1][k], 0.5f ); + } +#endif + } + } + + /* prepare buffers depending on the chosen stereo mode */ + +#ifndef FIX_445_SNS_BUGFIXES + /* remove means of L/R SNS parameters */ + for ( ch = 0; ch < CPE_CHANNELS; ++ch ) + { + st = sts[ch]; + nSubframes = ( st->core == TCX_20_CORE ) ? 1 : NB_DIV; + means = ( st->core == TCX_20_CORE ) ? ivas_sns_means_tcx20 : ivas_sns_means_tcx10; + for ( k = 0; k < nSubframes; ++k ) + { + v_sub( sns_in[ch][k], means, snsQ_out[ch][k], M ); + } + } +#endif + +#ifdef FIX_445_SNS_BUGFIXES + nSubframes = ( sts[0]->core == TCX_20_CORE ) ? 1 : NB_DIV; + for ( k = 0; k < nSubframes; ++k ) + { + mvr2r( sns_in[0][k], snsQ_out[0][k], M ); + mvr2r( sns_in[1][k], snsQ_out[1][k], M ); + if ( sns_stereo_mode[k] == SNS_STEREO_MODE_MS ) + { + convertToMS( M, snsQ_out[0][k], snsQ_out[1][k], 0.5f ); + } + } +#else + if ( sns_stereo_mode[0] == SNS_STEREO_MODE_MS || sns_stereo_mode[1] == SNS_STEREO_MODE_MS ) + { + nSubframes = ( sts[0]->core == TCX_20_CORE ) ? 1 : NB_DIV; + for ( k = 0; k < nSubframes; ++k ) + { + if ( sns_stereo_mode[k] == SNS_STEREO_MODE_MS ) + { + convertToMS( M, snsQ_out[0][k], snsQ_out[1][k], 0.5f ); + } + } + } +#endif + + for ( ch = 0; ch < CPE_CHANNELS; ++ch ) + { + st = sts[ch]; + nSubframes = ( st->core == TCX_20_CORE ) ? 1 : NB_DIV; + + for ( k = 0; k < nSubframes; ++k ) + { + const int16_t is_side = ch == 1 && sns_stereo_mode[k] == SNS_STEREO_MODE_MS; + const float *const *cdbks = ( nSubframes == 1 ) ? ivas_sns_cdbks_tcx20 : ivas_sns_cdbks_tcx10; + const int16_t *levels = ( nSubframes == 1 ) ? ivas_sns_cdbks_tcx20_levels : ivas_sns_cdbks_tcx10_levels; + const int16_t *bits = ( nSubframes == 1 ) ? ivas_sns_cdbks_tcx20_bits : ivas_sns_cdbks_tcx10_bits; + int16_t nStages = ( ( nSubframes == 1 ) ? SNS_MSVQ_NSTAGES_TCX20 : SNS_MSVQ_NSTAGES_TCX10 ); + float *snsQ = snsQ_out[ch][k]; + const float *sns_ptr = snsQ_out[ch][k]; + + if ( is_side ) + { + const float *const *side_cdbks = ( st->core == TCX_20_CORE ) ? ivas_sns_cdbks_side_tcx20 : ivas_sns_cdbks_side_tcx10; + const int16_t *side_levels = ( st->core == TCX_20_CORE ) ? ivas_sns_cdbks_side_tcx20_levels : ivas_sns_cdbks_side_tcx10_levels; + + if ( zero_side_flag[k] ) + { + set_zero( snsQ, M ); + continue; + } + + nStages = SNS_MSVQ_NSTAGES_SIDE; + bits = ( st->core == TCX_20_CORE ) ? ivas_sns_cdbks_side_tcx20_bits : ivas_sns_cdbks_side_tcx10_bits; +#ifndef FIX_445_SNS_BUGFIXES + means = ( st->core == TCX_20_CORE ) ? ivas_sns_means_side_tcx20 : ivas_sns_means_side_tcx10; + + v_sub( sns_ptr, means, snsQ, M ); +#endif + msvq_enc( side_cdbks, NULL, NULL, snsQ, side_levels, 3, nStages, weights, M, M, 0, NULL, &indices[idxIndices] ); + msvq_dec( side_cdbks, NULL, NULL, nStages, M, M, &indices[idxIndices], 0, NULL, snsQ, NULL ); +#ifndef FIX_445_SNS_BUGFIXES + v_add( snsQ, means, snsQ, M ); +#endif + } + else + { + msvq_enc( cdbks, NULL, NULL, sns_ptr, levels, 3, nStages, weights, M, M, 0, NULL, &indices[idxIndices] ); + msvq_dec( cdbks, NULL, NULL, nStages, M, M, &indices[idxIndices], 0, NULL, snsQ, NULL ); + } + idxIndices += nStages; + + for ( i = 0; i < nStages; ++i ) + { + nbits += bits[i]; + } + } + } + + if ( sns_stereo_mode[0] == SNS_STEREO_MODE_MS || sns_stereo_mode[1] == SNS_STEREO_MODE_MS ) + { + nSubframes = ( sts[0]->core == TCX_20_CORE ) ? 1 : NB_DIV; + for ( k = 0; k < nSubframes; ++k ) + { + if ( sns_stereo_mode[k] == SNS_STEREO_MODE_MS ) + { + convertToMS( M, snsQ_out[0][k], snsQ_out[1][k], 1.f ); + } + } + } + +#ifndef FIX_445_SNS_BUGFIXES + /* add means back */ + for ( ch = 0; ch < CPE_CHANNELS; ++ch ) + { + st = sts[ch]; + nSubframes = ( st->core == TCX_20_CORE ) ? 1 : NB_DIV; + means = ( st->core == TCX_20_CORE ) ? ivas_sns_means_tcx20 : ivas_sns_means_tcx10; + for ( k = 0; k < nSubframes; ++k ) + { + v_add( snsQ_out[ch][k], means, snsQ_out[ch][k], M ); + } + } +#endif + + return nbits; +} +#endif // SNS_MSVQ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 5e9dd6400c868e97217188bd088b9819c0058607..098654416a362fa11befcd4771505c3b4e2a175e 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -58,32 +58,64 @@ static ivas_error ivas_spar_enc_process( Encoder_Struct *st_ivas, const ENCODER_ *------------------------------------------------------------------------*/ ivas_error ivas_spar_enc_open( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ + Encoder_Struct *st_ivas, /* i/o: IVAS encoder handle */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { SPAR_ENC_HANDLE hSpar; ENCODER_CONFIG_HANDLE hEncoderConfig; IVAS_FB_CFG *fb_cfg; int16_t nchan_inp, nchan_transport, sba_order_internal; +#ifdef HODIRAC + int16_t nchan_fb_in; +#endif int16_t table_idx, active_w_mixing; int32_t input_Fs, ivas_total_brate; ivas_error error; hEncoderConfig = st_ivas->hEncoderConfig; error = IVAS_ERR_OK; + hSpar = st_ivas->hSpar; - /* SPAR encoder handle */ - if ( ( hSpar = (SPAR_ENC_HANDLE) malloc( sizeof( SPAR_ENC_DATA ) ) ) == NULL ) + if ( !spar_reconfig_flag ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR encoder" ); + /* SPAR encoder handle */ + if ( ( hSpar = (SPAR_ENC_HANDLE) malloc( sizeof( SPAR_ENC_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR encoder" ); + } } input_Fs = hEncoderConfig->input_Fs; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - nchan_inp = ivas_sba_get_nchan_metadata( sba_order_internal ); + nchan_inp = ivas_sba_get_nchan_metadata( sba_order_internal +#ifdef SPAR_TUNING + , + hEncoderConfig->ivas_total_brate +#endif + ); assert( nchan_inp <= hEncoderConfig->nchan_inp ); ivas_total_brate = hEncoderConfig->ivas_total_brate; +#ifdef HODIRAC + nchan_fb_in = 0; + if ( st_ivas->sba_analysis_order == 1 ) + { + nchan_fb_in = FOA_CHANNELS; + } + else if ( st_ivas->sba_analysis_order == 2 ) + { + nchan_fb_in = 9; + } + else if ( st_ivas->sba_analysis_order == 3 ) + { + nchan_fb_in = 11; + } + else + { + assert( 0 && "sba_order must be 1,2, or 3!" ); + } +#endif nchan_transport = ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, sba_order_internal ); // bw = ivas_get_bw_idx_from_sample_rate(pCfg->input_Fs); @@ -98,27 +130,38 @@ ivas_error ivas_spar_enc_open( /* set FB config. */ active_w_mixing = ivas_spar_br_table_consts[table_idx].active_w; - ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_inp, nchan_transport, active_w_mixing, input_Fs ); + ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_inp, nchan_transport, active_w_mixing, input_Fs +#ifdef HODIRAC + , + nchan_fb_in +#endif + ); fb_cfg->remix_order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; /* FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &( hSpar->hFbMixer ), input_Fs, fb_cfg ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_FB_mixer_open( &( hSpar->hFbMixer ), input_Fs, fb_cfg, spar_reconfig_flag ) ) != IVAS_ERR_OK ) { return error; } /* Covariance handle */ - if ( ( error = ivas_spar_covar_enc_open( &( hSpar->hCovEnc ), hSpar->hFbMixer->pFb, input_Fs, nchan_inp ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_covar_enc_open( &( hSpar->hCovEnc ), hSpar->hFbMixer->pFb, input_Fs, nchan_inp, hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) { return error; } - /* Transient Detector handle */ - if ( ( error = ivas_spar_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK ) + if ( !spar_reconfig_flag ) { - return error; + /* Transient Detector handle */ + if ( ( error = ivas_transient_det_open( &( hSpar->hTranDet ), input_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } } + /* initialization */ + hSpar->hMdEnc->table_idx = -1; + /* AGC handle */ #ifdef DEBUG_AGC_ENCODER_CMD_OPTION hSpar->AGC_Enable = ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, nchan_transport ); @@ -168,37 +211,40 @@ ivas_error ivas_spar_enc_open( * Allocate and initialize Front-VAD handle *-----------------------------------------------------------------*/ - hSpar->front_vad_flag = 0; - hSpar->front_vad_dtx_flag = 0; - hSpar->force_front_vad = 0; - - if ( hEncoderConfig->Opt_DTX_ON ) + if ( !spar_reconfig_flag ) { - if ( ( error = front_vad_create( &( hSpar->hFrontVad ), hEncoderConfig ) ) != IVAS_ERR_OK ) - { - return error; - } + hSpar->front_vad_flag = 0; + hSpar->front_vad_dtx_flag = 0; + hSpar->force_front_vad = 0; - if ( ( hSpar->hCoreCoderVAD = (ENC_CORE_HANDLE) malloc( sizeof( Encoder_State ) ) ) == NULL ) + if ( hEncoderConfig->Opt_DTX_ON ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CoreCoder structure\n" ) ); - } + if ( ( error = front_vad_create( &( hSpar->hFrontVad ), hEncoderConfig ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( hSpar->hCoreCoderVAD = (ENC_CORE_HANDLE) malloc( sizeof( Encoder_State ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CoreCoder structure\n" ) ); + } - copy_encoder_config( st_ivas, hSpar->hCoreCoderVAD, 1 ); + copy_encoder_config( st_ivas, hSpar->hCoreCoderVAD, 1 ); - hSpar->hCoreCoderVAD->total_brate = hEncoderConfig->ivas_total_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ - hSpar->hCoreCoderVAD->mct_chan_mode = MCT_CHAN_MODE_IGNORE; + hSpar->hCoreCoderVAD->total_brate = hEncoderConfig->ivas_total_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ + hSpar->hCoreCoderVAD->mct_chan_mode = MCT_CHAN_MODE_IGNORE; - if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1 ) ) != IVAS_ERR_OK ) + if ( ( error = init_encoder( hSpar->hCoreCoderVAD, 0, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 1, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else { - return error; + hSpar->hCoreCoderVAD = NULL; + hSpar->hFrontVad = NULL; } } - else - { - hSpar->hCoreCoderVAD = NULL; - hSpar->hFrontVad = NULL; - } /*-----------------------------------------------------------------* * Final assignment @@ -217,57 +263,67 @@ ivas_error ivas_spar_enc_open( *------------------------------------------------------------------------*/ void ivas_spar_enc_close( - SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder handle */ - const int32_t input_Fs, /* i : input sampling rate */ - const int16_t nchan_inp /* i : number of input channels */ + SPAR_ENC_HANDLE *hSpar, /* i/o: SPAR encoder handle */ + const int32_t input_Fs, /* i : input sampling rate */ + const int16_t nchan_inp, /* i : number of input channels */ + const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ) { int16_t num_chans; - if ( hSpar != NULL ) + + if ( hSpar == NULL || *hSpar == NULL ) + { + return; + } + + if ( !spar_reconfig_flag ) { /* core-coder-VAD handle */ - if ( hSpar->hCoreCoderVAD != NULL ) + if ( ( *hSpar )->hCoreCoderVAD != NULL ) { - destroy_core_enc( hSpar->hCoreCoderVAD ); - hSpar->hCoreCoderVAD = NULL; + destroy_core_enc( ( *hSpar )->hCoreCoderVAD ); + ( *hSpar )->hCoreCoderVAD = NULL; } /* front-VAD handle */ - if ( hSpar->hFrontVad != NULL ) + if ( ( *hSpar )->hFrontVad != NULL ) { - front_vad_destroy( &hSpar->hFrontVad ); - hSpar->hFrontVad = NULL; + front_vad_destroy( &( *hSpar )->hFrontVad ); + ( *hSpar )->hFrontVad = NULL; } + } - num_chans = hSpar->hFbMixer->fb_cfg->num_in_chans; - assert( num_chans <= nchan_inp ); - - /* MD handle */ - ivas_spar_md_enc_close( &hSpar->hMdEnc ); + num_chans = ( *hSpar )->hFbMixer->fb_cfg->num_in_chans; + assert( num_chans <= nchan_inp ); - /* Covar. State handle */ - ivas_spar_covar_enc_close( &hSpar->hCovEnc, num_chans ); + /* MD handle */ + ivas_spar_md_enc_close( &( *hSpar )->hMdEnc ); - /* FB mixer handle */ - ivas_FB_mixer_close( &hSpar->hFbMixer, input_Fs ); + /* Covar. State handle */ + ivas_spar_covar_enc_close( &( *hSpar )->hCovEnc, num_chans ); - /* Trans Det handle */ - ivas_spar_transient_det_close( &hSpar->hTranDet ); + /* FB mixer handle */ + ivas_FB_mixer_close( &( *hSpar )->hFbMixer, input_Fs, spar_reconfig_flag ); - /* AGC */ - ivas_spar_agc_enc_close( &hSpar->hAgcEnc ); + /* AGC */ + ivas_spar_agc_enc_close( &( *hSpar )->hAgcEnc ); - /* PCA */ - if ( hSpar->hPCA != NULL ) - { - free( hSpar->hPCA ); - hSpar->hPCA = NULL; - } + /* PCA */ + if ( ( *hSpar )->hPCA != NULL ) + { + free( ( *hSpar )->hPCA ); + ( *hSpar )->hPCA = NULL; + } - free( hSpar ); - hSpar = NULL; + if ( !spar_reconfig_flag ) + { + /* Trans Det handle */ + ivas_transient_det_close( &( *hSpar )->hTranDet ); + free( ( *hSpar ) ); + ( *hSpar ) = NULL; } + return; } @@ -292,11 +348,10 @@ ivas_error ivas_spar_enc( error = IVAS_ERR_OK; hEncoderConfig = st_ivas->hEncoderConfig; -#ifdef SBA_BR_SWITCHING_RECONFIG // VE2DB: can hFbMixer->ppFilterbank_prior_input be replaced by st->input ? /* check last sba_mode */ - if ( ivas_sba_mode_select( st_ivas->hEncoderConfig->last_ivas_total_brate ) == SBA_MODE_DIRAC ) + if ( ivas_sba_mode_select() == SBA_MODE_DIRAC ) { Encoder_State *sts[MCT_MAX_BLOCKS]; @@ -323,7 +378,6 @@ ivas_error ivas_spar_enc( ( st_ivas->hSpar->hFbMixer->ppFilterbank_prior_input[i] + st_ivas->hSpar->hFbMixer->fb_cfg->prior_input_length - input_frame ), input_frame ); } } -#endif /* front VAD */ if ( ( error = front_vad_spar( st_ivas->hSpar, data_f[0], hEncoderConfig, input_frame ) ) != IVAS_ERR_OK ) @@ -341,11 +395,6 @@ ivas_error ivas_spar_enc( return error; } - if ( hEncoderConfig->sba_planar ) - { - ivas_sba_zero_vert_comp( data_f, st_ivas->sba_analysis_order, hEncoderConfig->sba_planar, input_frame ); // TODO tmu: do we need a second call to this function ? - } - *nb_bits_metadata = hMetaData->nb_bits_tot; /* Force IVAS front pre-proc decision for higher bitrates */ @@ -372,9 +421,17 @@ static ivas_error ivas_spar_enc_process( float data_f[][L_FRAME48k] /* i/o: input/transport audio channels */ ) { +#ifdef HODIRAC + float pcm_tmp[DIRAC_MAX_ANA_CHANS][L_FRAME48k * 2]; + float *p_pcm_tmp[DIRAC_MAX_ANA_CHANS]; +#else float pcm_tmp[IVAS_SPAR_MAX_CH][L_FRAME48k * 2]; float *p_pcm_tmp[IVAS_SPAR_MAX_CH]; - int16_t i, j, b, i_ts, input_frame, transient_det, dtx_vad; +#endif + + int16_t i, j, b, i_ts, input_frame, dtx_vad; + int16_t transient_det[2]; + int32_t ivas_total_brate, input_Fs; float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; @@ -386,10 +443,18 @@ static ivas_error ivas_spar_enc_process( SPAR_ENC_HANDLE hSpar = st_ivas->hSpar; IVAS_QMETADATA_HANDLE hQMetaData = st_ivas->hQMetaData; int16_t ts, l_ts, orig_dirac_bands, num_del_samples; + float *ppIn_FR_real[IVAS_SPAR_MAX_CH], *ppIn_FR_imag[IVAS_SPAR_MAX_CH]; +#ifdef SBA_TD_RESIDUAL + float wyzx_del_buf[FOA_CHANNELS][IVAS_FB_1MS_48K_SAMP]; +#else float w_del_buf[IVAS_FB_1MS_48K_SAMP]; +#endif float dir[3], avg_dir[3]; float energySum, vecLen; +#ifdef HODIRAC + int16_t nchan_fb_in; +#endif push_wmops( "ivas_spar_enc_process" ); @@ -405,38 +470,90 @@ static ivas_error ivas_spar_enc_process( input_frame = (int16_t) ( input_Fs / FRAMES_PER_SEC ); sba_order = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - nchan_inp = ivas_sba_get_nchan_metadata( sba_order ); + nchan_inp = ivas_sba_get_nchan_metadata( sba_order +#ifdef SPAR_TUNING + , + hEncoderConfig->ivas_total_brate +#endif + ); assert( nchan_inp <= hEncoderConfig->nchan_inp ); + int16_t active_w_vlbr; + active_w_vlbr = ( hEncoderConfig->ivas_total_brate < IVAS_24k4 ) ? 1 : 0; + +#ifdef HODIRAC + nchan_fb_in = hSpar->hFbMixer->fb_cfg->nchan_fb_in; + nchan_transport = st_ivas->nchan_transport; +#endif + +#ifdef HODIRAC + for ( i = FOA_CHANNELS + 1; i < nchan_fb_in; i++ ) +#else for ( i = FOA_CHANNELS + 1; i < nchan_inp; i++ ) +#endif { mvr2r( data_f[HOA_keep_ind[i]], data_f[i], input_frame ); } + /*-----------------------------------------------------------------------------------------* * Transient detector *-----------------------------------------------------------------------------------------*/ - transient_det = ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame ); - + ivas_transient_det_process( hSpar->hTranDet, data_f[0], input_frame, transient_det ); +#ifndef FIX_331_ALL_BRS + if ( sba_order == 1 ) + { + transient_det[1] = transient_det[0]; + } +#endif + if ( ivas_total_brate < IVAS_24k4 ) + { + transient_det[1] = 0; + } /* store previous input samples for W in local buffer */ assert( num_del_samples <= IVAS_FB_1MS_48K_SAMP ); +#ifdef SBA_TD_RESIDUAL + if ( hSpar->hFbMixer->fb_cfg->active_w_mixing == 0 ) + { + /* fill delay (1 ms) buffer for all Transport channels */ + for ( i = 0; i < hSpar->hFbMixer->fb_cfg->num_out_chans; i++ ) + { + int idx = hSpar->hFbMixer->fb_cfg->remix_order[i]; + mvr2r( &hSpar->hFbMixer->ppFilterbank_prior_input[idx][hSpar->hFbMixer->fb_cfg->prior_input_length - num_del_samples], wyzx_del_buf[idx], num_del_samples ); + } + } +#else mvr2r( &hSpar->hFbMixer->ppFilterbank_prior_input[0][hSpar->hFbMixer->fb_cfg->prior_input_length - num_del_samples], w_del_buf, num_del_samples ); +#endif /*-----------------------------------------------------------------------------------------* * FB mixer ingest *-----------------------------------------------------------------------------------------*/ +#ifdef HODIRAC + for ( i = 0; i < nchan_fb_in; i++ ) +#else for ( i = 0; i < nchan_inp; i++ ) +#endif { p_pcm_tmp[i] = pcm_tmp[i]; } /* run Filter Bank overlapping MDFT analysis first, then we can use the temporary buffer for Parameter MDFT analysis*/ - ivas_fb_mixer_pcm_ingest( hSpar->hFbMixer, data_f, p_pcm_tmp, input_frame ); + ivas_fb_mixer_pcm_ingest( hSpar->hFbMixer, data_f, p_pcm_tmp, input_frame +#ifdef SPAR_TUNING + , + hSpar->hMdEnc->HOA_md_ind +#endif + ); /* prepare Parameter MDFT analysis */ +#ifdef HODIRAC + for ( i = 0; i < nchan_fb_in; i++ ) +#else for ( i = 0; i < nchan_inp; i++ ) +#endif { ppIn_FR_real[i] = p_pcm_tmp[i]; ppIn_FR_imag[i] = p_pcm_tmp[i] + input_frame; @@ -447,10 +564,24 @@ static ivas_error ivas_spar_enc_process( for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) { - ivas_fb_mixer_get_windowed_fr( hSpar->hFbMixer, p_pcm_tmp, ppIn_FR_real, ppIn_FR_imag, l_ts, l_ts ); - ivas_fb_mixer_update_prior_input( hSpar->hFbMixer, p_pcm_tmp, l_ts ); + ivas_fb_mixer_get_windowed_fr( hSpar->hFbMixer, p_pcm_tmp, ppIn_FR_real, ppIn_FR_imag, l_ts, l_ts +#ifdef HODIRAC + , + nchan_fb_in +#endif + ); + ivas_fb_mixer_update_prior_input( hSpar->hFbMixer, p_pcm_tmp, l_ts +#ifdef HODIRAC + , + nchan_fb_in +#endif + ); +#ifdef HODIRAC + for ( i = 0; i < nchan_fb_in; i++ ) +#else for ( i = 0; i < nchan_inp; i++ ) +#endif { p_pcm_tmp[i] += l_ts; ppIn_FR_real[i] += l_ts; @@ -459,7 +590,11 @@ static ivas_error ivas_spar_enc_process( } /* turn pointers back to the local buffer, needed for the following processing */ +#ifdef HODIRAC + for ( i = 0; i < nchan_fb_in; i++ ) +#else for ( i = 0; i < nchan_inp; i++ ) +#endif { ppIn_FR_real[i] = pcm_tmp[i]; ppIn_FR_imag[i] = pcm_tmp[i] + input_frame; @@ -471,8 +606,14 @@ static ivas_error ivas_spar_enc_process( /*-----------------------------------------------------------------------------------------* * DirAC encoding *-----------------------------------------------------------------------------------------*/ - - ivas_dirac_param_est_enc( st_ivas->hDirAC, hQMetaData->q_direction, hQMetaData->useLowerRes, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, st_ivas->sba_mode ); + /*tyagiri: TODO: HODIRAC should be disabled for 256 kbps and outputs should be BE w.r.t baseline*/ + ivas_dirac_param_est_enc( st_ivas->hDirAC, hQMetaData->q_direction, hQMetaData->useLowerRes, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, st_ivas->sba_mode +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k, + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k ? HOA2_CHANNELS : FOA_CHANNELS +#endif + ); if ( hQMetaData->q_direction->cfg.nbands > 0 ) { @@ -482,14 +623,26 @@ static ivas_error ivas_spar_enc_process( { /* WB 4TC mode bit : disable for now*/ push_next_indice( hMetaData, 0, 1 ); - ivas_qmetadata_enc_encode( hMetaData, hQMetaData ); + + ivas_qmetadata_enc_encode( hMetaData, hQMetaData +#ifdef HODIRAC + , + st_ivas->sba_analysis_order > 1 && ivas_total_brate > IVAS_256k +#endif + ); } else { + hQMetaData->q_direction[0].cfg.nbands = DIRAC_DTX_BANDS; /* compute directions */ + +#ifdef HODIRAC + for ( i = 0; i < hQMetaData->q_direction[0].cfg.nblocks; i++ ) +#else for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) +#endif { set_zero( dir, 3 ); set_zero( avg_dir, 3 ); @@ -555,22 +708,6 @@ static ivas_error ivas_spar_enc_process( hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; } } -#ifndef SBA_BR_SWITCHING - /*-----------------------------------------------------------------------------------------* - * Covariance process - *-----------------------------------------------------------------------------------------*/ - - for ( i = 0; i < nchan_inp; i++ ) - { - for ( j = 0; j < nchan_inp; j++ ) - { - cov_real[i][j] = hSpar->hMdEnc->cov_real[i][j]; - cov_dtx_real[i][j] = hSpar->hMdEnc->cov_dtx_real[i][j]; - } - } - - ivas_enc_cov_handler_process( hSpar->hCovEnc, ppIn_FR_real, ppIn_FR_imag, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands, nchan_inp, dtx_vad, transient_det ); -#endif /*-----------------------------------------------------------------------------------------* * Set SPAR bitrates *-----------------------------------------------------------------------------------------*/ @@ -580,12 +717,7 @@ static ivas_error ivas_spar_enc_process( if ( hSpar->hMdEnc->table_idx != table_idx ) { hSpar->hMdEnc->table_idx = table_idx; -#ifdef SBA_BR_SWITCHING -#ifndef SBA_BR_SWITCHING_RECONFIG - if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate && !st_ivas->sba_reinit_flag ) -#else - if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) -#endif + if ( ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) && ( !hEncoderConfig->spar_reconfig_flag ) ) { if ( ( error = ivas_spar_md_enc_init( hSpar->hMdEnc, hEncoderConfig, sba_order ) ) != IVAS_ERR_OK ) { @@ -594,13 +726,9 @@ static ivas_error ivas_spar_enc_process( } else { -#endif ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND ); -#ifdef SBA_BR_SWITCHING } -#endif } -#ifdef SBA_BR_SWITCHING /*-----------------------------------------------------------------------------------------* * Covariance process *-----------------------------------------------------------------------------------------*/ @@ -614,8 +742,23 @@ static ivas_error ivas_spar_enc_process( } } - ivas_enc_cov_handler_process( hSpar->hCovEnc, ppIn_FR_real, ppIn_FR_imag, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands, nchan_inp, dtx_vad, transient_det ); + ivas_enc_cov_handler_process( + hSpar->hCovEnc, + ppIn_FR_real, + ppIn_FR_imag, + cov_real, + cov_dtx_real, + hSpar->hFbMixer->pFb, + 0, + hSpar->hFbMixer->pFb->filterbank_num_bands, + nchan_inp, + dtx_vad, + transient_det +#ifdef SPAR_TUNING + , + hSpar->hMdEnc->HOA_md_ind #endif + ); nchan_transport = st_ivas->nchan_transport; /*-----------------------------------------------------------------------------------------* @@ -624,9 +767,12 @@ static ivas_error ivas_spar_enc_process( if ( hSpar->hMdEnc->spar_hoa_md_flag == 0 ) { - ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order ); + ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, + hSpar->hFbMixer->prior_mixer ); } - +#ifdef SPAR_TUNING + if ( hSpar->hMdEnc->spar_hoa_dirac2spar_md_flag ) +#endif { float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -643,8 +789,8 @@ static ivas_error ivas_spar_enc_process( dirac_band_idx = hSpar->dirac_to_spar_md_bands[b] - d_start_band; for ( i_ts = 0; i_ts < hQMetaData->q_direction->cfg.nblocks; i_ts++ ) { - azi_dirac[b][i_ts] = hQMetaData->q_direction->band_data[dirac_band_idx].azimuth[i_ts]; - ele_dirac[b][i_ts] = hQMetaData->q_direction->band_data[dirac_band_idx].elevation[i_ts]; + azi_dirac[b][i_ts] = hQMetaData->q_direction[0].band_data[dirac_band_idx].azimuth[i_ts]; + ele_dirac[b][i_ts] = hQMetaData->q_direction[0].band_data[dirac_band_idx].elevation[i_ts]; } diffuseness[b] = 1.0f - hQMetaData->q_direction->band_data[dirac_band_idx].energy_ratio[0]; } @@ -666,14 +812,80 @@ static ivas_error ivas_spar_enc_process( Wscale_d[b] = min( 2.0f, max( Wscale_d[b], 1.0f ) ); } - ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, hSpar->hMdEnc->mixer_mat, &hSpar->hMdEnc->spar_md, &hSpar->hMdEnc->spar_md_cfg, d_start_band, d_end_band, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? 1 : sba_order, dtx_vad, Wscale_d ); + ivas_get_spar_md_from_dirac( azi_dirac, ele_dirac, diffuseness, 1, hSpar->hMdEnc->mixer_mat, &hSpar->hMdEnc->spar_md, &hSpar->hMdEnc->spar_md_cfg, d_start_band, d_end_band, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? 1 : sba_order, dtx_vad, Wscale_d, + hQMetaData->useLowerRes, active_w_vlbr ); } if ( hSpar->hMdEnc->spar_hoa_md_flag ) { - ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order ); + ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, + hSpar->hFbMixer->prior_mixer ); } - +#ifdef DEBUG_LBR_SBA + /* Dumping SPAR Coefficients */ + char f_name[100]; + int16_t nbands = 6; + int16_t num_subframes = 1; + int16_t num_elements = 6; + int16_t num_block_group = 1; + int16_t byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_re[2], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } +#endif +#ifdef DEBUG_LBR_SBA + /* Dumping SPAR Coefficients */ + nbands = 6; + num_subframes = 1; + num_elements = 6; + num_block_group = 1; + byte_size = sizeof( float ); + + sprintf( f_name, "SBA_MD_values_quant.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_quant_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_quant_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].pred_quant_re[2], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_quant_re[0], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_quant_re[1], byte_size, 1, 1, f_name ); + dbgwrite( &hSpar->hMdEnc->spar_md.band_coeffs[b].P_quant_re[2], byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } +#endif /*-----------------------------------------------------------------------------------------* * FB mixer *-----------------------------------------------------------------------------------------*/ @@ -722,14 +934,53 @@ static ivas_error ivas_spar_enc_process( #ifdef DEBUG_SBA_AUDIO_DUMP ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_transport, spar_foa_enc_wav[1], "ivas_fb_mixer_process()" ); #endif +#ifdef SBA_TD_RESIDUAL + if ( hSpar->hFbMixer->fb_cfg->active_w_mixing == 0 ) + { + /* delayed W */ + mvr2r( wyzx_del_buf[0], p_pcm_tmp[0], num_del_samples ); + mvr2r( data_f[0], p_pcm_tmp[0] + num_del_samples, input_frame - num_del_samples ); + for ( i = 1; i < hSpar->hFbMixer->fb_cfg->num_out_chans; i++ ) + { + int idx = hSpar->hFbMixer->fb_cfg->remix_order[i]; + + /* delayed, reorderd and accumulated with (negative) prediction from W */ + v_add( wyzx_del_buf[idx], p_pcm_tmp[i], p_pcm_tmp[i], num_del_samples ); + v_add( data_f[idx], p_pcm_tmp[i] + num_del_samples, p_pcm_tmp[i] + num_del_samples, input_frame - num_del_samples ); + } + } +#else /* move delayed W into output buffer unless activeW operation*/ if ( hSpar->hFbMixer->fb_cfg->active_w_mixing == 0 ) { mvr2r( w_del_buf, p_pcm_tmp[0], num_del_samples ); mvr2r( data_f[0], p_pcm_tmp[0] + num_del_samples, input_frame - num_del_samples ); } - +#endif +#if 0 /* SBA_TD_RESIDUAL */ + { + static FILE *fid = 0; + static int samplesWritten = 0; + int s; + if (!fid) + { + fid = fopen("enc_pcm.txt", "wt"); + } + if (samplesWritten < 8 * 48000) + { + for (s = 0; s < input_frame; s++) + { + for (i = 0; i < hSpar->hFbMixer->fb_cfg->num_out_chans; i++) + { + fprintf(fid, "%.8f ", p_pcm_tmp[i][s]); + } + fprintf(fid, "\n"); + } + samplesWritten += input_frame; + } + } +#endif /*-----------------------------------------------------------------------------------------* * PCA encoder *-----------------------------------------------------------------------------------------*/ @@ -746,7 +997,16 @@ static ivas_error ivas_spar_enc_process( push_next_indice( hMetaData, PCA_MODE_INACTIVE, 1 ); } } - +#ifdef DEBUG_LBR_SBA + for ( int t = 0; t < 960; t++ ) + { + for ( int c = 0; c < hSpar->hFbMixer->fb_cfg->num_out_chans; c++ ) + { + float val = p_pcm_tmp[c][t]; // / MAX16B_FLT; + dbgwrite( &val, sizeof( float ), 1, 1, "int_enc_dmx.raw" ); + } + } +#endif #ifdef DEBUG_SBA_AUDIO_DUMP ivas_spar_dump_signal_wav( input_frame, p_pcm_tmp, NULL, nchan_transport, spar_foa_enc_wav[0], "ivas_pca_enc()" ); #endif diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 20a3e4322b29f44fb394fbbe4076c311dbe0f9af..d27f149b6de2d35bb33e1ce65990ea845b16553e 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -72,20 +72,17 @@ static void ivas_band_mixer( float *cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], static void ivas_get_band_differential_index( ivas_band_coeffs_ind_t *pBand_idx, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const int16_t complex_cov, const int16_t dim, const ivas_coeffs_type_t coeff_type ); -static void ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, const int16_t planarCP ); +static void ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t bands_bw ); -static void ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t planarCP ); +static void ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); static ivas_error ivas_spar_set_enc_config( ivas_spar_md_enc_state_t *hMdEnc, int16_t *max_freq_per_chan, const int16_t nchan_transport, float *pFC, const int16_t nchan_inp ); static void ivas_select_next_strat( ivas_strats_t prior_strat, ivas_strats_t cs[MAX_QUANT_STRATS], const int16_t dmx_switch, const int16_t dtx_vad ); -static void ivas_store_prior_coeffs( ivas_spar_md_enc_state_t *hMdEnc, const int16_t num_bands, const int16_t bands_bw, const int16_t strat, const int16_t dtx_vad, const int16_t qsi ); +static void ivas_store_prior_coeffs( ivas_spar_md_enc_state_t *hMdEnc, const int16_t num_bands, const int16_t strat, const int16_t dtx_vad, const int16_t qsi ); static void ivas_write_spar_md_bitstream( ivas_spar_md_enc_state_t *hMdEnc, const int16_t nB, const int16_t bands_bw, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate, const int16_t strat, const int16_t qsi, const int16_t planarCP ); -#ifndef SBA_BR_SWITCHING -static ivas_error ivas_spar_md_enc_init( ivas_spar_md_enc_state_t *hMdEnc, const ENCODER_CONFIG_HANDLE hEncoderConfig, const int16_t sba_order ); -#endif static void ivas_spar_quant_pred_coeffs_dtx( ivas_spar_md_t *pSpar_md, const float *pValues, const int16_t ndm, int16_t *pIndex, const int16_t dim1, float *pQuant ); static void ivas_quant_p_per_band_dtx( float *pP_mat, const int16_t num_dec, const int16_t num_dmx, int16_t *ppIdx_pd, float *pP_out, const int16_t num_ch ); @@ -122,7 +119,12 @@ ivas_error ivas_spar_md_enc_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD encoder" ); } - num_channels = ivas_sba_get_nchan_metadata( sba_order ); + num_channels = ivas_sba_get_nchan_metadata( sba_order +#ifdef SPAR_TUNING + , + hEncoderConfig->ivas_total_brate +#endif + ); if ( ( hMdEnc->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * sizeof( ivas_band_coeffs_t ) ) ) == NULL ) { @@ -228,6 +230,11 @@ void ivas_spar_md_enc_close( int16_t num_channels, i, j; ivas_spar_md_enc_state_t *hMdEnc; + if ( hMdEnc_in == NULL || *hMdEnc_in == NULL ) + { + return; + } + hMdEnc = *hMdEnc_in; num_channels = hMdEnc->num_umx_ch; @@ -253,7 +260,6 @@ void ivas_spar_md_enc_close( { for ( i = 0; i < num_channels; i++ ) { - for ( j = 0; j < num_channels; j++ ) { free( hMdEnc->cov_real[i][j] ); @@ -267,7 +273,6 @@ void ivas_spar_md_enc_close( { for ( i = 0; i < num_channels; i++ ) { - for ( j = 0; j < num_channels; j++ ) { free( hMdEnc->cov_dtx_real[i][j] ); @@ -291,11 +296,8 @@ void ivas_spar_md_enc_close( free( hMdEnc->mixer_mat_local ); } - if ( hMdEnc != NULL ) - { - free( hMdEnc ); - hMdEnc = NULL; - } + free( *hMdEnc_in ); + *hMdEnc_in = NULL; return; } @@ -306,25 +308,31 @@ void ivas_spar_md_enc_close( * * SPAR MD encoder initialization *-----------------------------------------------------------------------------------------*/ -#ifndef SBA_BR_SWITCHING -static ivas_error ivas_spar_md_enc_init -#else -ivas_error ivas_spar_md_enc_init -#endif - ( - ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ - ) +ivas_error ivas_spar_md_enc_init( + ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ +) { float pFC[IVAS_MAX_NUM_BANDS]; int16_t table_idx; float PR_minmax[2]; int16_t num_channels, i, j, k; +#ifdef SPAR_TUNING + ivas_sba_get_spar_hoa_md_flag( sba_order, hEncoderConfig->ivas_total_brate, &hMdEnc->spar_hoa_md_flag, &hMdEnc->spar_hoa_dirac2spar_md_flag ); +#else hMdEnc->spar_hoa_md_flag = ivas_sba_get_spar_hoa_md_flag( sba_order, hEncoderConfig->ivas_total_brate ); - num_channels = ivas_sba_get_nchan_metadata( sba_order ); - +#endif + num_channels = ivas_sba_get_nchan_metadata( sba_order +#ifdef SPAR_TUNING + , + hEncoderConfig->ivas_total_brate +#endif + ); +#ifdef SPAR_TUNING + ivas_sba_get_spar_hoa_ch_ind( num_channels, hEncoderConfig->ivas_total_brate, hMdEnc->HOA_md_ind ); +#endif table_idx = ivas_get_spar_table_idx( hEncoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND ); @@ -552,13 +560,15 @@ ivas_error ivas_spar_md_enc_process( const int16_t dtx_vad, const int16_t nchan_inp, const int16_t sba_order /* i : Ambisonic (SBA) order */ + , + float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i : prior mixer_matrix */ ) { float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; float dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; + int16_t i, j, b, qsi, ndm, ndec, num_ch, num_quant_strats; + int16_t planarCP; float pred_coeffs_re_local[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS]; - int16_t i, b, qsi, ndm, ndec, num_ch, num_quant_strats; - int16_t j, planarCP; int16_t k, bwidth, num_bands, num_bands_full, num_bands_bw; int16_t active_w, nchan_transport, dmx_switch, strat; int16_t nB, bands_bw, packed_ok = 0; @@ -570,13 +580,19 @@ ivas_error ivas_spar_md_enc_process( float Wscale[IVAS_MAX_NUM_BANDS]; num_quant_strats = hMdEnc->spar_md_cfg.num_quant_strats; - num_ch = ivas_sba_get_nchan_metadata( sba_order ); + num_ch = ivas_sba_get_nchan_metadata( sba_order +#ifdef SPAR_TUNING + , + hEncoderConfig->ivas_total_brate +#endif + ); active_w = hMdEnc->spar_md_cfg.active_w; nchan_transport = hMdEnc->spar_md_cfg.nchan_transport; bwidth = ivas_get_bw_idx_from_sample_rate( hEncoderConfig->input_Fs ); bwidth = min( bwidth, hEncoderConfig->max_bwidth ); - + int16_t active_w_vlbr; + active_w_vlbr = ( hEncoderConfig->ivas_total_brate < IVAS_24k4 ) ? 1 : 0; num_bands = ivas_get_num_bands_from_bw_idx( SPAR_CONFIG_BW ); if ( hMdEnc->spar_hoa_md_flag == 0 ) { @@ -629,13 +645,23 @@ ivas_error ivas_spar_md_enc_process( ivas_band_mixer( cov_real, num_ch, &num_bands, bands_bw ); } + else if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 ) + { + bands_bw = 2; + nB = num_bands / bands_bw; + + ivas_band_mixer( cov_real, num_ch, &num_bands, bands_bw ); + } else { nB = num_bands; bands_bw = 1; } - +#ifdef SPAR_TUNING + if ( hMdEnc->spar_hoa_md_flag && hMdEnc->spar_hoa_dirac2spar_md_flag ) +#else if ( hMdEnc->spar_hoa_md_flag ) +#endif { for ( b = SPAR_DIRAC_SPLIT_START_BAND; b < num_bands; b++ ) { @@ -647,7 +673,9 @@ ivas_error ivas_spar_md_enc_process( } ivas_compute_spar_params( cov_real, dm_fv_re, 0, hMdEnc->mixer_mat, 0, nB, dtx_vad, num_ch, - bands_bw, active_w, &hMdEnc->spar_md_cfg, &hMdEnc->spar_md, Wscale, 0 ); + bands_bw, active_w, + active_w_vlbr, + &hMdEnc->spar_md_cfg, &hMdEnc->spar_md, Wscale, 0 ); for ( i = 0; i < num_ch; i++ ) { @@ -659,7 +687,9 @@ ivas_error ivas_spar_md_enc_process( } } } - +#ifdef DEBUG_LBR_SBA + float dirac_md_kbps = (float) ( hMetaData->nb_bits_tot ) * 50 / 1000; +#endif planarCP = 0; code_strat = 0; #ifdef DEBUG_SBA_MD_DUMP @@ -744,11 +774,46 @@ ivas_error ivas_spar_md_enc_process( fprintf(stderr, "\n\n"); */ #endif } - ivas_quant_p_per_band( &hMdEnc->spar_md.band_coeffs[b], &hMdEnc->spar_md.band_coeffs_idx[b], &hMdEnc->spar_md_cfg.quant_strat[qsi], num_ch ); } - ivas_quant_pred_coeffs_per_band( &hMdEnc->spar_md.band_coeffs[b], &hMdEnc->spar_md.band_coeffs_idx[b], &hMdEnc->spar_md_cfg.quant_strat[qsi], num_ch ); + if ( active_w_vlbr ) + { + for ( i = 0; i < 3; i++ ) + { + int16_t i2; + i2 = 0; + switch ( i ) /* PRED (Y,Z,X) and DECD (Y,X,Z) coeffs are in different orders */ + { + case 0: + i2 = 0; + break; + case 1: + i2 = 2; + break; + case 2: + i2 = 1; + break; + } + if ( ( hMdEnc->spar_md.band_coeffs_idx[b].pred_index_re[i] == 0 ) && ( hMdEnc->spar_md.band_coeffs_idx[b].decd_index_re[i2] == 0 ) && ( hMdEnc->spar_md.band_coeffs[b].pred_re[i] != 0.0f ) && ( cov_real[i + 1][i + 1][b] != 0.0f ) ) + { + /* bump up the Pred coeff */ + float PR_uq, PR_step; + ivas_quant_strat_t qs; + qs = hMdEnc->spar_md_cfg.quant_strat[qsi]; + PR_uq = hMdEnc->spar_md.band_coeffs[b].pred_re[i]; + PR_step = ( qs.PR.max - qs.PR.min ) / ( qs.PR.q_levels[0] - 1 ); + + int16_t PR_sign; + PR_sign = ( PR_uq > 0 ) - ( PR_uq < 0 ); + + hMdEnc->spar_md.band_coeffs_idx[b].pred_index_re[i] = PR_sign; + + /* deindex the modified coefficient */ + hMdEnc->spar_md.band_coeffs[b].pred_quant_re[i] = PR_sign * PR_step; + } + } + } } else { @@ -761,7 +826,6 @@ ivas_error ivas_spar_md_enc_process( { hMdEnc->spar_md.band_coeffs[b].pred_quant_re[i] = 0; } - ivas_spar_quant_pred_coeffs_dtx( &hMdEnc->spar_md, hMdEnc->spar_md.band_coeffs[b].pred_re, ndm, hMdEnc->spar_md.band_coeffs_idx[b].pred_index_re, num_ch - 1, hMdEnc->spar_md.band_coeffs[b].pred_quant_re ); } } @@ -774,7 +838,11 @@ ivas_error ivas_spar_md_enc_process( } } +#ifdef SPAR_TUNING + if ( hMdEnc->spar_hoa_md_flag && hMdEnc->spar_hoa_dirac2spar_md_flag ) +#else if ( hMdEnc->spar_hoa_md_flag ) +#endif { for ( b = SPAR_DIRAC_SPLIT_START_BAND; b < num_bands; b++ ) { @@ -911,6 +979,64 @@ ivas_error ivas_spar_md_enc_process( { assert( qsi == 0 ); } + /* Reuse mixer matrix values for unsent bands */ + if ( ( hEncoderConfig->ivas_total_brate < IVAS_24k4 ) && ( code_strat > 3 ) ) + { + for ( b = 0; b < num_bands * bands_bw; b += 2 * bands_bw ) + { + if ( ( b == 0 ) && ( code_strat % 2 == 0 ) ) + { + b += 2; + } + for ( i = 0; i < 1; i++ ) + { + for ( j = 0; j < 4; j++ ) + { + hMdEnc->mixer_mat[i][j][b] = prior_mixer[i][j][b]; + hMdEnc->mixer_mat[i][j][b + 1] = prior_mixer[i][j][b + 1]; + } + } + } + } +#ifdef DEBUG_LBR_SBA + char f_name[100]; + int16_t nbands = 1; + int16_t num_subframes = 1; + int16_t num_elements = 6; + int16_t num_block_group = 1; + int16_t byte_size = sizeof( float ); + + float sba_md_kbps = (float) hMetaData->nb_bits_tot * 50 / 1000; + float spar_md_kbps = sba_md_kbps - dirac_md_kbps; + float corebr_kbps = (float) hEncoderConfig->ivas_total_brate / 1000 - sba_md_kbps; + + sprintf( f_name, "SBA_MD_bitrate.bin" ); + ( frame == 0 ) ? dbgwrite( &nbands, sizeof( nbands ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_elements, sizeof( num_elements ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_subframes, sizeof( num_subframes ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &num_block_group, sizeof( num_block_group ), 1, 1, f_name ) : false; + ( frame == 0 ) ? dbgwrite( &byte_size, sizeof( byte_size ), 1, 1, f_name ) : false; + + for ( b = 0; b < nbands; b++ ) + { + for ( int16_t sf = 0; sf < num_subframes; sf++ ) + { + for ( int16_t bl = 0; bl < num_block_group; bl++ ) + { + float fqsi = (float) qsi; + float fcode = (float) code_strat; + + dbgwrite( &dirac_md_kbps, byte_size, 1, 1, f_name ); + dbgwrite( &spar_md_kbps, byte_size, 1, 1, f_name ); + dbgwrite( &sba_md_kbps, byte_size, 1, 1, f_name ); + dbgwrite( &fqsi, byte_size, 1, 1, f_name ); + dbgwrite( &fcode, byte_size, 1, 1, f_name ); + dbgwrite( &corebr_kbps, byte_size, 1, 1, f_name ); + // fprintf(stdout, "%f\t%f\t%f\t%d\t%d\n", dirac_md_kbps, spar_md_kbps, sba_md_kbps, qsi, code_strat ); + } + } + } +#endif #ifdef SPAR_HOA_DBG /*if ( strat >= 4 ) { @@ -1086,7 +1212,8 @@ ivas_error ivas_spar_md_enc_process( fclose( fp ); #endif - ivas_store_prior_coeffs( hMdEnc, num_bands, bands_bw, code_strat, dtx_vad, qsi ); + ivas_store_prior_coeffs( hMdEnc, num_bands, + code_strat, dtx_vad, qsi ); hMdEnc->spar_md.dtx_vad = dtx_vad; hMdEnc->spar_md.num_bands = num_bands; @@ -1178,55 +1305,82 @@ static void ivas_write_spar_md_bitstream( no_ec = 0; - switch ( strat ) + if ( ivas_total_brate < IVAS_24k4 ) { - case BASE: - push_next_indice( hMetaData, bands_bw - 1, SPAR_NUM_CODING_STRAT_BITS ); - for ( i = 0; i < nB; i++ ) - { - do_diff[i] = 0; - } - break; - case BASE_NOEC: - push_next_indice( hMetaData, bands_bw + 1, SPAR_NUM_CODING_STRAT_BITS ); - for ( i = 0; i < nB; i++ ) - { - do_diff[i] = 0; - } - no_ec = 1; - break; - case FOUR_A: - push_next_indice( hMetaData, 4, SPAR_NUM_CODING_STRAT_BITS ); - for ( i = 0; i < nB; i++ ) - { - do_diff[i] = ( ( ( i + 1 ) & 3 ) != 0 ); - } - ivas_map_prior_coeffs_quant( &hMdEnc->spar_md_prior, &hMdEnc->spar_md_cfg, qsi, nB ); - break; - case FOUR_B: - push_next_indice( hMetaData, 5, SPAR_NUM_CODING_STRAT_BITS ); - for ( i = 0; i < nB; i++ ) - { - do_diff[i] = ( ( ( i + 1 ) & 3 ) != 1 ); - } - ivas_map_prior_coeffs_quant( &hMdEnc->spar_md_prior, &hMdEnc->spar_md_cfg, qsi, nB ); - break; - case FOUR_C: - push_next_indice( hMetaData, 6, SPAR_NUM_CODING_STRAT_BITS ); - for ( i = 0; i < nB; i++ ) - { - do_diff[i] = ( ( ( i + 1 ) & 3 ) != 2 ); - } - ivas_map_prior_coeffs_quant( &hMdEnc->spar_md_prior, &hMdEnc->spar_md_cfg, qsi, nB ); - break; - case FOUR_D: - push_next_indice( hMetaData, 7, SPAR_NUM_CODING_STRAT_BITS ); - for ( i = 0; i < nB; i++ ) - { - do_diff[i] = ( ( ( i + 1 ) & 3 ) != 3 ); - } - ivas_map_prior_coeffs_quant( &hMdEnc->spar_md_prior, &hMdEnc->spar_md_cfg, qsi, nB ); - break; + switch ( strat ) + { + case BASE: + push_next_indice( hMetaData, bands_bw - 1, SPAR_NUM_CODING_STRAT_BITS ); + break; + case BASE_NOEC: + push_next_indice( hMetaData, bands_bw + 1, SPAR_NUM_CODING_STRAT_BITS ); + no_ec = 1; + break; + case FOUR_A: + case FOUR_C: + case FOUR_B: + case FOUR_D: + push_next_indice( hMetaData, strat, SPAR_NUM_CODING_STRAT_BITS ); + break; + } + /* for LBR SBA 40MS MD never do time diff */ + for ( i = 0; i < nB; i++ ) + { + do_diff[i] = 0; + } + } + else + { + switch ( strat ) + { + case BASE: + push_next_indice( hMetaData, bands_bw - 1, SPAR_NUM_CODING_STRAT_BITS ); + for ( i = 0; i < nB; i++ ) + { + do_diff[i] = 0; + } + break; + case BASE_NOEC: + push_next_indice( hMetaData, bands_bw + 1, SPAR_NUM_CODING_STRAT_BITS ); + for ( i = 0; i < nB; i++ ) + { + do_diff[i] = 0; + } + no_ec = 1; + break; + case FOUR_A: + push_next_indice( hMetaData, 4, SPAR_NUM_CODING_STRAT_BITS ); + for ( i = 0; i < nB; i++ ) + { + do_diff[i] = ( ( ( i + 1 ) & 3 ) != 0 ); + } + ivas_map_prior_coeffs_quant( &hMdEnc->spar_md_prior, &hMdEnc->spar_md_cfg, qsi, nB ); + break; + case FOUR_B: + push_next_indice( hMetaData, 5, SPAR_NUM_CODING_STRAT_BITS ); + for ( i = 0; i < nB; i++ ) + { + do_diff[i] = ( ( ( i + 1 ) & 3 ) != 1 ); + } + ivas_map_prior_coeffs_quant( &hMdEnc->spar_md_prior, &hMdEnc->spar_md_cfg, qsi, nB ); + break; + case FOUR_C: + push_next_indice( hMetaData, 6, SPAR_NUM_CODING_STRAT_BITS ); + for ( i = 0; i < nB; i++ ) + { + do_diff[i] = ( ( ( i + 1 ) & 3 ) != 2 ); + } + ivas_map_prior_coeffs_quant( &hMdEnc->spar_md_prior, &hMdEnc->spar_md_cfg, qsi, nB ); + break; + case FOUR_D: + push_next_indice( hMetaData, 7, SPAR_NUM_CODING_STRAT_BITS ); + for ( i = 0; i < nB; i++ ) + { + do_diff[i] = ( ( ( i + 1 ) & 3 ) != 3 ); + } + ivas_map_prior_coeffs_quant( &hMdEnc->spar_md_prior, &hMdEnc->spar_md_cfg, qsi, nB ); + break; + } } #ifdef SPAR_HOA_DBG @@ -1237,11 +1391,14 @@ static void ivas_write_spar_md_bitstream( #endif if ( no_ec == 1 ) { - ivas_get_huffman_coded_bs( hMdEnc, hMetaData, nB, qsi, planarCP ); + ivas_get_huffman_coded_bs( hMdEnc, hMetaData, nB, qsi, planarCP, + bands_bw ); } else { - ivas_get_arith_coded_bs( hMdEnc, hMetaData, do_diff, bands_bw, nB, qsi, planarCP ); + ivas_get_arith_coded_bs( hMdEnc, hMetaData, do_diff, bands_bw, nB, qsi, planarCP, + strat, + ivas_total_brate ); } return; @@ -1259,7 +1416,8 @@ static void ivas_get_huffman_coded_bs( BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, - const int16_t planarCP ) + const int16_t planarCP, + const int16_t bands_bw ) { int16_t i, j; int16_t pred_coeff_dim, pred_offset; @@ -1267,12 +1425,17 @@ static void ivas_get_huffman_coded_bs( for ( i = 0; i < nB; i++ ) { int16_t code, len; - int16_t ndm = hMdEnc->spar_md_cfg.num_dmx_chans_per_band[i]; - int16_t ndec = hMdEnc->spar_md_cfg.num_decorr_per_band[i]; + int16_t ndm, ndec; + ndm = hMdEnc->spar_md_cfg.num_dmx_chans_per_band[i * bands_bw]; + ndec = hMdEnc->spar_md_cfg.num_decorr_per_band[i * bands_bw]; pred_coeff_dim = ndm + ndec - 1; pred_offset = 0; +#ifdef SPAR_TUNING + if ( hMdEnc->spar_hoa_md_flag && hMdEnc->spar_hoa_dirac2spar_md_flag ) +#else if ( hMdEnc->spar_hoa_md_flag ) +#endif { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) { @@ -1345,9 +1508,12 @@ static void ivas_get_arith_coded_bs( const int16_t bands_bw, const int16_t nB, const int16_t qsi, - const int16_t planarCP ) + const int16_t planarCP, + const int16_t strat, + const int32_t ivas_total_brate ) { - int16_t i, j, any_diff; + int16_t i, any_diff; + int16_t j; ivas_cell_dim_t pred_cell_dims[IVAS_MAX_NUM_BANDS]; ivas_cell_dim_t drct_cell_dims[IVAS_MAX_NUM_BANDS]; ivas_cell_dim_t decd_cell_dims[IVAS_MAX_NUM_BANDS]; @@ -1360,21 +1526,40 @@ static void ivas_get_arith_coded_bs( int16_t ndm, ndec; ndm = hMdEnc->spar_md_cfg.num_dmx_chans_per_band[bands_bw * i]; ndec = hMdEnc->spar_md_cfg.num_decorr_per_band[bands_bw * i]; - pred_cell_dims[i].dim1 = ndm + ndec - 1; - if ( hMdEnc->spar_hoa_md_flag ) + + if ( ( ivas_total_brate < IVAS_24k4 ) && ( strat > 3 ) && ( ( ( i % 2 == 1 ) && ( strat % 2 == 0 ) ) || ( ( i % 2 == 0 ) && ( strat % 2 == 1 ) ) ) ) { - if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) + pred_cell_dims[i].dim1 = 0; + pred_cell_dims[i].dim2 = 0; + drct_cell_dims[i].dim1 = 0; + drct_cell_dims[i].dim2 = 0; + decd_cell_dims[i].dim1 = 0; + decd_cell_dims[i].dim2 = 0; + decx_cell_dims[i].dim1 = 0; + decx_cell_dims[i].dim2 = 0; + } + else + { + pred_cell_dims[i].dim1 = ndm + ndec - 1; + if ( hMdEnc->spar_hoa_md_flag +#ifdef SPAR_TUNING + && hMdEnc->spar_hoa_dirac2spar_md_flag +#endif + ) { - pred_cell_dims[i].dim1 -= ( FOA_CHANNELS - 1 ); + if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) + { + pred_cell_dims[i].dim1 -= ( FOA_CHANNELS - 1 ); + } } + pred_cell_dims[i].dim2 = 1; + drct_cell_dims[i].dim1 = ndec; + drct_cell_dims[i].dim2 = ndm - 1; + decd_cell_dims[i].dim1 = ndec; + decd_cell_dims[i].dim2 = 1; + decx_cell_dims[i].dim1 = ( ndec * ( ndec - 1 ) ) >> 1; + decx_cell_dims[i].dim2 = 1; } - pred_cell_dims[i].dim2 = 1; - drct_cell_dims[i].dim1 = ndec; - drct_cell_dims[i].dim2 = ndm - 1; - decd_cell_dims[i].dim1 = ndec; - decd_cell_dims[i].dim2 = 1; - decx_cell_dims[i].dim1 = ( ndec * ( ndec - 1 ) ) >> 1; - decx_cell_dims[i].dim2 = 1; } any_diff = 0; @@ -1386,7 +1571,11 @@ static void ivas_get_arith_coded_bs( break; } } +#ifdef SPAR_TUNING + if ( hMdEnc->spar_hoa_md_flag && hMdEnc->spar_hoa_dirac2spar_md_flag ) +#else if ( hMdEnc->spar_hoa_md_flag ) +#endif { for ( i = 0; i < nB; i++ ) { @@ -1416,7 +1605,11 @@ static void ivas_get_arith_coded_bs( ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.pred_arith_re[qsi], &hMdEnc->arith_coeffs.pred_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, pred_cell_dims, hMetaData, any_diff ); +#ifdef SPAR_TUNING + if ( hMdEnc->spar_hoa_md_flag && hMdEnc->spar_hoa_dirac2spar_md_flag ) +#else if ( hMdEnc->spar_hoa_md_flag ) +#endif { for ( i = 0; i < nB; i++ ) { @@ -1548,15 +1741,11 @@ static void ivas_select_next_strat( static void ivas_store_prior_coeffs( ivas_spar_md_enc_state_t *hMdEnc, const int16_t num_bands, - const int16_t bands_bw, const int16_t strat, const int16_t dtx_vad, const int16_t qsi ) { int16_t i, j, b; - - float one_by_bands_bw = ( 1.0f / bands_bw ); - if ( dtx_vad == 0 ) { hMdEnc->spar_md_cfg.prior_strat = START; @@ -1570,8 +1759,9 @@ static void ivas_store_prior_coeffs( for ( i = 0; i < num_bands; i++ ) { - b = (int16_t) floor( i * one_by_bands_bw ); - + b = i; + /* TODO: Bitrate switching will require dependence on bands_bw, and changes to time differential coding/prior index + storage for 6-12 band switching. e.g. b = (int16_t) floor( i * one_by_bands_bw ); */ for ( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ ) { hMdEnc->spar_md_prior.band_coeffs_idx[i].pred_index_re[j] = hMdEnc->spar_md.band_coeffs_idx[b].pred_index_re[j]; diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index ecf730cffa5fd4e854c9d85e75b179ad40308242..8ba9484661b41547eeebb376f94f08a4ce2dd46e 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -35,10 +35,9 @@ #include #include "options.h" -#include "ivas_cnst.h" #include "cnst.h" -#include "stat_enc.h" #include "ivas_cnst.h" +#include "stat_enc.h" #include "ivas_stat_com.h" /*----------------------------------------------------------------------------------* @@ -220,22 +219,6 @@ typedef struct stereo_dft_enc_data_struct float voicing_lt; -#ifdef ITD_WINNER_GAIN_MODIFY - float noise_coherence; - int16_t local_vad; - int16_t mus_flag; - float spd_L_noise[STEREO_DFT_N_32k_ENC / 2]; /*The estimation of spectral power density of noise in the left channel*/ - float spd_R_noise[STEREO_DFT_N_32k_ENC / 2]; /*The estimation of spectral power density of noise in the right channel*/ - float spd_L_noise_min[STEREO_DFT_N_32k_ENC / 2]; - float spd_R_noise_min[STEREO_DFT_N_32k_ENC / 2]; - float spd_L_noise_max[STEREO_DFT_N_32k_ENC / 2]; - float spd_R_noise_max[STEREO_DFT_N_32k_ENC / 2]; - float winner_gain_L[STEREO_DFT_N_32k_ENC / 2]; /*The estimation of the Winner gain of the left channel*/ - float winner_gain_R[STEREO_DFT_N_32k_ENC / 2]; /*The estimation of the Winner gain of the right channel*/ - float spd_L_smooth_new[STEREO_DFT_N_32k_ENC / 2]; - float spd_R_smooth_new[STEREO_DFT_N_32k_ENC / 2]; - -#endif int16_t currentNumUpdates; int16_t expectedNumUpdates; /* Expected number of frames before use of ITD estimate */ @@ -551,6 +534,22 @@ typedef struct ivas_stereo_classifier_data_structure } STEREO_CLASSIF_DATA, *STEREO_CLASSIF_HANDLE; +/*----------------------------------------------------------------------------------* + * ISM DTX structure + *----------------------------------------------------------------------------------*/ + +typedef struct +{ + int16_t dtx_flag; + int16_t sce_id_dtx; + + int16_t cnt_SID_ISM; + + float long_term_energy_stereo_dmx_enc[MAX_NUM_OBJECTS][PARAM_ISM_HYS_BUF_SIZE]; + float coh[MAX_NUM_OBJECTS]; + +} ISM_DTX_DATA, *ISM_DTX_HANDLE; + /*----------------------------------------------------------------------------------* * Front-VAD structure *----------------------------------------------------------------------------------*/ @@ -657,6 +656,10 @@ typedef struct ivas_spar_md_enc_state_t ivas_huff_coeffs_t huff_coeffs; int16_t table_idx; int16_t spar_hoa_md_flag; +#ifdef SPAR_TUNING + int16_t spar_hoa_dirac2spar_md_flag; + int16_t HOA_md_ind[IVAS_SPAR_MAX_CH]; +#endif } ivas_spar_md_enc_state_t; /* PCA structure */ @@ -716,17 +719,55 @@ typedef struct ivas_param_mc_enc_data_structure } PARAM_MC_ENC_DATA, *PARAM_MC_ENC_HANDLE; +#ifdef MC_PARAMUPMIX_MODE +/*----------------------------------------------------------------------------------* + * MC ParamUpmix Mode encoder structures + *----------------------------------------------------------------------------------*/ +typedef struct ivas_mc_paramupmix_enc_data_structure +{ + ivas_trans_det_state_t *hTranDet[MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH]; + IVAS_FB_MIXER_HANDLE hFbMixer; + ivas_enc_cov_handler_state_t *hCovEnc[MC_PARAMUPMIX_COMBINATIONS]; + float ***cov_real[MC_PARAMUPMIX_COMBINATIONS]; + float ***cov_dtx_real[MC_PARAMUPMIX_COMBINATIONS]; + float *midside[MC_PARAMUPMIX_COMBINATIONS][MC_PARAMUPMIX_NCH]; /* hold PCM of mid-side data */ + int32_t alpha_quant_prev[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + int32_t beta_quant_prev[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + bool first_frame; +} MC_PARAMUPMIX_ENC_DATA, *MC_PARAMUPMIX_ENC_HANDLE; +#endif /*----------------------------------------------------------------------------------* * MASA encoder structures *----------------------------------------------------------------------------------*/ +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT +typedef struct ivas_masa_dir_align_struct +{ + float previous_azi_dir1[MASA_FREQUENCY_BANDS]; + float previous_ele_dir1[MASA_FREQUENCY_BANDS]; + + float previous_azi_dir2[MASA_FREQUENCY_BANDS]; + float previous_ele_dir2[MASA_FREQUENCY_BANDS]; + +} MASA_DIR_ALIGN_STATE, *MASA_DIR_ALIGN_HANDLE; +#endif + +/* structure storing MASA framing sync detection and compensation data */ +typedef struct ivas_masa_sync_struct +{ + MASA_METADATA_FRAME previous_metadata; + uint8_t prev_sim_stop; + uint8_t prev_offset; + MASA_FRAME_MODE frame_mode; + +} MASA_SYNC_STATE, *MASA_SYNC_HANDLE; + typedef struct ivas_masa_encoder_data_struct { float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; int16_t num_Cldfb_instances; HANDLE_CLDFB_FILTER_BANK cldfbAnaEnc[MAX_NUM_ENC_CLDFB_INSTANCES]; - float *delay_buffer[MASA_MAX_TRANSPORT_CHANNELS]; int16_t band_mapping[MASA_FREQUENCY_BANDS + 1]; uint8_t twoDirBands[MASA_FREQUENCY_BANDS]; float importanceWeight[MASA_FREQUENCY_BANDS]; @@ -738,6 +779,12 @@ typedef struct ivas_masa_encoder_data_struct float onset_detector_1; float onset_detector_2; + MASA_SYNC_STATE sync_state; + +#ifdef FIX_398_MASA_DIRECTION_ALIGNMENT + MASA_DIR_ALIGN_STATE dir_align_state; +#endif + } MASA_ENCODER_DATA; typedef struct ivas_masa_encoder_struct @@ -780,8 +827,13 @@ typedef struct ivas_mcmasa_enc_data_structure float **buffer_intensity_real_vert; float *buffer_energy; +#ifdef HODIRAC + float chnlToFoaMtx[FOA_CHANNELS][MCMASA_MAX_ANA_CHANS]; + float chnlToFoaEvenMtx[FOA_CHANNELS][MCMASA_MAX_ANA_CHANS]; +#else float chnlToFoaMtx[DIRAC_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; float chnlToFoaEvenMtx[DIRAC_MAX_ANA_CHANS][MCMASA_MAX_ANA_CHANS]; +#endif float ls_azimuth[MCMASA_MAX_ANA_CHANS]; int16_t leftNearest[MCMASA_MAX_ANA_CHANS]; int16_t rightNearest[MCMASA_MAX_ANA_CHANS]; @@ -906,11 +958,8 @@ typedef struct mct_enc_data_structure float lastxCorrMatrix[MCT_MAX_CHANNELS][MCT_MAX_CHANNELS]; int16_t lowE_ch[MCT_MAX_CHANNELS]; - int16_t LFE_off; uint16_t mc_global_ild[MCT_MAX_CHANNELS]; int16_t nBitsMCT; /* number of bits spent on mct side info */ - int16_t num_lfe; - /* pointers to local buffers */ float *p_mdst_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS]; float *p_orig_spectrum_long[MCT_MAX_BLOCKS][CPE_CHANNELS]; @@ -993,9 +1042,11 @@ typedef struct encoder_config_structure int16_t element_mode_init; /* element mode used at initialization */ int16_t stereo_dmx_evs; /* flag to indicate that stereo downmix for EVS encoder */ + int16_t nchan_ism; /* number of ISM channels */ int16_t sba_order; /* Ambisonic (SBA) order */ int16_t sba_planar; /* Ambisonic (SBA) planar flag */ MC_LS_SETUP mc_input_setup; /* multichannel input ls setup */ + int16_t ism_extended_metadata_flag; /* flag indicating extended metadata encoding, including radius and orientation (yaw, pitch) in ISM format */ int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ @@ -1012,7 +1063,7 @@ typedef struct encoder_config_structure /* temp. development parameters */ int16_t Opt_PCA_ON; /* flag indicating PCA operation in SBA */ - + int16_t spar_reconfig_flag; #ifdef DEBUGGING /* debugging options */ int16_t stereo_mode_cmdl; /* stereo mode forced from the command-line */ @@ -1042,11 +1093,6 @@ typedef struct int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t codec_mode; /* Mode1 or Mode2 of core codec */ int16_t last_codec_mode; /* previous frame Mode 1 or 2 */ -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING - int16_t sba_reinit_flag; /*flag indicating whether reinitialisation or reconfiguration function should be used*/ -#endif -#endif float **mem_hp20_in; /* input signals HP filter memories */ /* core-encoder modules */ @@ -1057,12 +1103,16 @@ typedef struct /* multichannel modules */ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS]; /* ISM metadata handles (storage for one frame of read ISM metadata) */ + ISM_DTX_HANDLE hISMDTX; /* ISM DTX handle */ DIRAC_ENC_HANDLE hDirAC; /* DirAC data handle */ SPAR_ENC_HANDLE hSpar; /* SPAR encoder handle */ MASA_ENCODER_HANDLE hMasa; /* MASA encoder data and configuration */ IVAS_QMETADATA_HANDLE hQMetaData; /* Metadata handle for q_metadata parametric spatial coding DirAC/MASA*/ MCT_ENC_HANDLE hMCT; /* MCT handle */ PARAM_MC_ENC_HANDLE hParamMC; /* Parametric MC handle */ +#ifdef MC_PARAMUPMIX_MODE + MC_PARAMUPMIX_ENC_HANDLE hMCParamUpmix; /* MC Param-Upmix handle */ +#endif MCMASA_ENC_HANDLE hMcMasa; /* Multi-channel MASA data handle */ LFE_ENC_HANDLE hLFE; /* LFE data handle */ diff --git a/lib_enc/ivas_stereo_cng_enc.c b/lib_enc/ivas_stereo_cng_enc.c index 784ec10807aa6a92c0eb8a6d64c0afde1f342805..2eb838bf5c5bbac673ae0308c93df86e4c972cf9 100644 --- a/lib_enc/ivas_stereo_cng_enc.c +++ b/lib_enc/ivas_stereo_cng_enc.c @@ -173,8 +173,12 @@ void stereo_dft_enc_sid_coh( int16_t alpha_level; int16_t n; +#ifdef FIX_418_SID_BITRATE + nr_of_sid_stereo_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; +#else /* TODO: still use old number of bits to keep bitexactness in output */ nr_of_sid_stereo_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; +#endif zeropad = 0; /* Encode coherence vector. Find best fixed predictor by minimizing prediction error on input vector. @@ -329,7 +333,9 @@ void stereo_dft_enc_sid_coh( ( *nb_bits )++; } +#ifndef FIX_418_SID_BITRATE push_next_indice( hBstr, zeropad, ( IVAS_SID_5k2 - 4400 ) / FRAMES_PER_SEC ); +#endif return; } diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index ab4844ab944067f4a519135e05b06574f6d460f5..43546261a41b954622c9bdaa07ef0bee191c2072 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -416,21 +416,6 @@ void stereo_dft_enc_reset( ) { int16_t i; -#ifdef ITD_WINNER_GAIN_MODIFY - hStereoDft->noise_coherence = 0.0f; - hStereoDft->local_vad = 0; - hStereoDft->mus_flag = 2; - set_zero( hStereoDft->spd_L_noise, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_R_noise, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_L_noise_min, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_R_noise_min, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_L_noise_max, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->spd_R_noise_max, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->winner_gain_L, STEREO_DFT_N_32k_ENC / 2 ); - set_zero( hStereoDft->winner_gain_R, STEREO_DFT_N_32k_ENC / 2 ); - set_f( hStereoDft->spd_L_smooth_new, 1.0f, STEREO_DFT_N_32k_ENC / 2 ); - set_f( hStereoDft->spd_R_smooth_new, 1.0f, STEREO_DFT_N_32k_ENC / 2 ); -#endif /*reset parameters*/ set_zero( hStereoDft->side_gain, STEREO_DFT_ENC_DFT_NB * STEREO_DFT_BAND_MAX ); set_s( hStereoDft->side_gain_index_EC, 15, STEREO_DFT_BAND_MAX ); diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index f52d67a47a328fe47fcdc6ccf4d2c167dc7564f4..d2c0bc7fe1ec78ae00051af7f280b97fe93c1d2a 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -82,135 +82,6 @@ #define ITD_MAX_MDCT 80 -#ifdef ITD_WINNER_GAIN_MODIFY -/*------------------------------------------------------------------------- - * stereo_dft_frame_coherence() - * Calculate the frame coherence of the stereo signal - * - *-------------------------------------------------------------------------*/ - -static void stereo_dft_frame_coherence( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, - float *xcorr, - float *Spd_L, - float *Spd_R, - float *frame_coherence ) -{ - float spd_xcorr_real, spd_xcorr_imag, spd_LR; - int16_t i, NFFT; - - NFFT = min( STEREO_DFT_N_32k_ENC, hStereoDft->NFFT ); - spd_xcorr_real = 0.0f; - spd_xcorr_imag = 0.0f; - spd_LR = 0.0f; - *frame_coherence = 0.0f; - - for ( i = 1; i < NFFT / 2; i++ ) - { - spd_xcorr_real += (float) xcorr[i * 2]; - spd_xcorr_imag += (float) xcorr[i * 2 + 1]; - spd_LR += (float) sqrt( Spd_L[i] ) * sqrt( Spd_R[i] ); - } - - *frame_coherence = (float) ( sqrt( spd_xcorr_real * spd_xcorr_real + spd_xcorr_imag * spd_xcorr_imag ) / spd_LR ); - - return; -} - - -/*------------------------------------------------------------------------- - * stereo_dft_itd_winner_gain() - * Estimate the spectral power density of noise in the stereo signal and - * calculate the winner gain for the ITD estimation - *-------------------------------------------------------------------------*/ - -static void stereo_dft_itd_winner_gain( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, - float *Spd_L, - float *Spd_R ) -{ - int16_t i; - float alpha1 = 0.05f; - float alpha2 = 0.95f; - float trackingfactor = 0.5f; - float ratio = 2.75f; - - for ( i = 0; i < STEREO_DFT_N_16k_ENC / 2; i++ ) - { - if ( hStereoDft->spd_L_noise_min[i] > Spd_L[i] ) - { - hStereoDft->spd_L_noise_min[i] = ( 1 - 0.15 ) * hStereoDft->spd_L_noise_min[i] + 0.15 * Spd_L[i]; - } - else - { - hStereoDft->spd_L_noise_min[i] = hStereoDft->spd_L_noise_min[i] + alpha1 * ( Spd_L[i] - hStereoDft->spd_L_noise_min[i] ); - } - if ( hStereoDft->spd_R_noise[i] > Spd_R[i] ) - { - hStereoDft->spd_R_noise_min[i] = ( 1 - 0.15 ) * hStereoDft->spd_R_noise_min[i] + 0.15 * Spd_R[i]; - } - else - { - hStereoDft->spd_R_noise_min[i] = hStereoDft->spd_R_noise_min[i] + alpha1 * ( Spd_R[i] - hStereoDft->spd_R_noise_min[i] ); - } - if ( hStereoDft->spd_L_noise_max[i] < Spd_L[i] ) - { - hStereoDft->spd_L_noise_max[i] = Spd_L[i]; - } - else - { - hStereoDft->spd_L_noise_max[i] = hStereoDft->spd_L_noise_max[i] + alpha2 * ( Spd_L[i] - hStereoDft->spd_L_noise_max[i] ); - } - if ( hStereoDft->spd_R_noise_max[i] < Spd_R[i] ) - { - hStereoDft->spd_R_noise_max[i] = Spd_R[i]; - } - else - { - hStereoDft->spd_R_noise_max[i] = hStereoDft->spd_R_noise_max[i] + alpha2 * ( Spd_R[i] - hStereoDft->spd_R_noise_max[i] ); - } - if ( hStereoDft->spd_L_noise_max[i] > ratio * hStereoDft->spd_L_noise_min[i] ) - { - hStereoDft->spd_L_noise[i] = hStereoDft->spd_L_noise[i]; - hStereoDft->winner_gain_L[i] = ( Spd_L[i] - hStereoDft->spd_L_noise[i] ) / Spd_L[i]; - } - else - { - hStereoDft->spd_L_noise[i] = hStereoDft->spd_L_noise[i] + trackingfactor * ( Spd_L[i] - hStereoDft->spd_L_noise[i] ); - hStereoDft->winner_gain_L[i] = ( Spd_L[i] - hStereoDft->spd_L_noise[i] ) / Spd_L[i]; - } - if ( hStereoDft->spd_R_noise_max[i] > ratio * hStereoDft->spd_R_noise_min[i] ) - { - hStereoDft->spd_R_noise[i] = hStereoDft->spd_R_noise[i]; - hStereoDft->winner_gain_R[i] = ( Spd_R[i] - hStereoDft->spd_R_noise[i] ) / Spd_R[i]; - } - else - { - hStereoDft->spd_R_noise[i] = hStereoDft->spd_R_noise[i] + trackingfactor * ( Spd_R[i] - hStereoDft->spd_R_noise[i] ); - hStereoDft->winner_gain_R[i] = ( Spd_R[i] - hStereoDft->spd_R_noise[i] ) / Spd_R[i]; - } - } - - for ( i = 0; i < STEREO_DFT_N_16k_ENC / 2; i++ ) - { - hStereoDft->winner_gain_L[i] = max( hStereoDft->winner_gain_L[i], 0.01f ); - hStereoDft->winner_gain_R[i] = max( hStereoDft->winner_gain_R[i], 0.01f ); - hStereoDft->winner_gain_L[i] = min( hStereoDft->winner_gain_L[i], 1.0f ); - hStereoDft->winner_gain_R[i] = min( hStereoDft->winner_gain_R[i], 1.0f ); - if ( hStereoDft->winner_gain_L[i] >= 0.80f ) - hStereoDft->winner_gain_L[i] = 1.0f; - else - hStereoDft->winner_gain_L[i] = 0.01f; - if ( hStereoDft->winner_gain_R[i] >= 0.80f ) - hStereoDft->winner_gain_R[i] = 1.0f; - else - hStereoDft->winner_gain_R[i] = 0.01f; - } - - return; -} -#endif - /*------------------------------------------------------------------------- * set_band_limits() * @@ -741,9 +612,6 @@ void stereo_dft_enc_compute_itd( int16_t itd, itd_td; float xcorr_itd[STEREO_DFT_N_32k_ENC]; float tmpf1, tmpf2, tmpf3; -#ifdef ITD_WINNER_GAIN_MODIFY - float frame_coherence, tmpf4; -#endif float thres, alpha; int16_t index; float xcorr_max, sum_nrg_L_lb, par_L[XCORR_LB_NUM_BANDS], par_L_avrg, sum_nrg_L_tmp; @@ -984,32 +852,6 @@ void stereo_dft_enc_compute_itd( xcorr[0] = sign( hItd->xcorr_smooth[0] ); xcorr[1] = sign( hItd->xcorr_smooth[1] ); -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - stereo_dft_frame_coherence( hStereoDft, xcorr, Spd_L, Spd_R, &frame_coherence ); - if ( hStereoDft->local_vad == 0 ) - { - hStereoDft->noise_coherence = 0.9f * hStereoDft->noise_coherence + ( 1.0 - 0.9f ) * frame_coherence; - } - else - { - hStereoDft->noise_coherence = hStereoDft->noise_coherence; - } - stereo_dft_itd_winner_gain( hStereoDft, Spd_L, Spd_R ); - - if ( hStereoDft->noise_coherence > 0.25f ) - { - for ( i = 1; i < NFFT / 2; i++ ) - { - xcorr[2 * i] = ( hStereoDft->winner_gain_L[i] * hStereoDft->winner_gain_R[i] ) * xcorr[2 * i]; - xcorr[2 * i + 1] = ( hStereoDft->winner_gain_L[i] * hStereoDft->winner_gain_R[i] ) * xcorr[2 * i + 1]; - Spd_L[i] = hStereoDft->winner_gain_L[i] * Spd_L[i]; - Spd_R[i] = hStereoDft->winner_gain_R[i] * Spd_R[i]; - } - } - } -#endif if ( hCPE->element_mode == IVAS_CPE_DFT && ( hItd->td_itd[k_offset] - hItd->td_itd[k_offset - 1] ) ) { @@ -1032,23 +874,6 @@ void stereo_dft_enc_compute_itd( } tmpf3 = 2.f; -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - alpha = -0.8f; - } - else - { - if ( flag_noisy_speech_snr ) - { - alpha = -0.8f; - } - else - { - alpha = -1.0f; - } - } -#else if ( flag_noisy_speech_snr ) { alpha = -0.8f; @@ -1057,7 +882,6 @@ void stereo_dft_enc_compute_itd( { alpha = -1.0f; } -#endif if ( hCPE->hCoreCoder[0]->Opt_DTX_ON && hCPE->element_mode == IVAS_CPE_DFT ) { @@ -1140,42 +964,9 @@ void stereo_dft_enc_compute_itd( tmpf1 += EPSILON; tmpf2 = tmpf1; tmpf1 = powf( tmpf1, alpha ); -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - tmpf4 = 1.0f; - /* Calculate smoothed spectral power density for the L/R channel */ - hStereoDft->spd_L_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_L_smooth_new[i] + sfm_L * Spd_L[i]; - hStereoDft->spd_R_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_R_smooth_new[i] + sfm_L * Spd_R[i]; - /* Calculate cross spectral power density using the smoothed spectral power density*/ - tmpf4 = (float) sqrt( hStereoDft->spd_L_smooth_new[i] ) * sqrt( hStereoDft->spd_R_smooth_new[i] ); - /* Calculate the value of weighted function for each frequency bin */ - tmpf4 += EPSILON; - if ( hStereoDft->noise_coherence > 0.25f ) - { - tmpf4 = tmpf1 * pow( tmpf2, 2.0f ) * pow( tmpf4, -2.0f ); - tmpf3 += tmpf2 * tmpf1; - tmpf3 -= tmpf2 * tmpf4; - } - else - { - tmpf4 = tmpf2 * pow( tmpf4, -2.0f ); - } - /* Calculate the value of weighted generlized cross-correlation function for each frequency bin */ - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf4; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf4; - } - else - { - tmpf3 += tmpf2 * tmpf1; - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; - } -#else tmpf3 += tmpf2 * tmpf1; xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; -#endif /* Low pass filter L/R power spectrum */ /* Calculate coherence as cross spectral density divided by L*R power spectrum */ @@ -1193,42 +984,9 @@ void stereo_dft_enc_compute_itd( tmpf1 += EPSILON; tmpf2 = tmpf1; tmpf1 = powf( tmpf1, alpha ); -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - tmpf4 = 1.0f; - /* Calculate smoothed spectral power density for the L/R channel */ - hStereoDft->spd_L_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_L_smooth_new[i] + sfm_L * Spd_L[i]; - hStereoDft->spd_R_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_R_smooth_new[i] + sfm_L * Spd_R[i]; - /* Calculate cross spectral power density using the smoothed spectral power density*/ - tmpf4 = (float) sqrt( hStereoDft->spd_L_smooth_new[i] ) * sqrt( hStereoDft->spd_R_smooth_new[i] ); - /* Calculate the value of weighted function for each frequency bin */ - tmpf4 += EPSILON; - if ( hStereoDft->noise_coherence > 0.25f ) - { - tmpf4 = tmpf1 * pow( tmpf2, 2.0f ) * pow( tmpf4, -2.0f ); - tmpf3 += tmpf2 * tmpf1; - tmpf3 -= tmpf2 * tmpf4; - } - else - { - tmpf4 = tmpf2 * pow( tmpf4, -2.0f ); - } - /* Calculate the value of weighted generlized cross-correlation function for each frequency bin */ - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf4; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf4; - } - else - { - tmpf3 += tmpf2 * tmpf1; - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; - } -#else tmpf3 += tmpf2 * tmpf1; xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; -#endif } } } @@ -1242,70 +1000,16 @@ void stereo_dft_enc_compute_itd( tmpf1 += EPSILON; tmpf2 = tmpf1; tmpf1 = powf( tmpf1, alpha ); -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - tmpf4 = 1.0f; - /* Calculate smoothed spectral power density for the L/R channel */ - hStereoDft->spd_L_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_L_smooth_new[i] + sfm_L * Spd_L[i]; - hStereoDft->spd_R_smooth_new[i] = ( 1.f - sfm_L ) * hStereoDft->spd_R_smooth_new[i] + sfm_L * Spd_R[i]; - /* Calculate cross spectral power density using the smoothed spectral power density*/ - tmpf4 = (float) sqrt( hStereoDft->spd_L_smooth_new[i] ) * sqrt( hStereoDft->spd_R_smooth_new[i] ); - /* Calculate the value of weighted function for each frequency bin */ - tmpf4 += EPSILON; - if ( hStereoDft->noise_coherence > 0.25f ) - { - tmpf4 = tmpf1 * pow( tmpf2, 2.0f ) * pow( tmpf4, -2.0f ); - tmpf3 += tmpf2 * tmpf1; - tmpf3 -= tmpf2 * tmpf4; - } - else - { - tmpf4 = tmpf2 * pow( tmpf4, -2.0f ); - } - /* Calculate the value of weighted generlized cross-correlation function for each frequency bin */ - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf4; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf4; - } - else - { - tmpf3 += tmpf2 * tmpf1; - xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; - xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; - } -#else tmpf3 += tmpf2 * tmpf1; xcorr[2 * i] = hItd->xcorr_smooth[2 * i] * tmpf1; xcorr[2 * i + 1] = hItd->xcorr_smooth[2 * i + 1] * tmpf1; -#endif - } - } -#ifdef ITD_WINNER_GAIN_MODIFY - if ( hStereoDft->mus_flag == 0 ) - { - if ( hStereoDft->noise_coherence > 0.25f ) - { - tmpf1 = (float) ( NFFT / 2 + 1 ) / tmpf3; - for ( i = 0; i < NFFT; i++ ) - { - xcorr[i] *= tmpf1; - } - } - else - { - for ( i = NFFT / 2; i < NFFT; i++ ) - { - xcorr[i] = 0.0f; - } } } -#else tmpf1 = (float) ( NFFT / 2 + 1 ) / tmpf3; for ( i = 0; i < NFFT; i++ ) { xcorr[i] *= tmpf1; } -#endif /*calculate mean E ratio of main to background signal for cohSNR*/ if ( hCPE->element_mode == IVAS_CPE_DFT ) { diff --git a/lib_enc/ivas_stereo_dmx_evs.c b/lib_enc/ivas_stereo_dmx_evs.c index 052970fa70c14831fb4768897e0e59ac17383095..a5c0fe147f0055724024771e5133507e08ccab36 100644 --- a/lib_enc/ivas_stereo_dmx_evs.c +++ b/lib_enc/ivas_stereo_dmx_evs.c @@ -946,16 +946,22 @@ ivas_error stereo_dmx_evs_init_encoder( *-------------------------------------------------------------------*/ void stereo_dmx_evs_close_encoder( - STEREO_DMX_EVS_ENC_HANDLE hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ + STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS /* i/o: Stereo downmix for EVS encoder handle */ ) { - if ( hStereoDmxEVS->hPOC != NULL ) + if ( hStereoDmxEVS == NULL || *hStereoDmxEVS == NULL ) { - free( hStereoDmxEVS->hPOC ); - hStereoDmxEVS->hPOC = NULL; + return; } - free( hStereoDmxEVS ); + if ( ( *hStereoDmxEVS )->hPOC != NULL ) + { + free( ( *hStereoDmxEVS )->hPOC ); + ( *hStereoDmxEVS )->hPOC = NULL; + } + + free( ( *hStereoDmxEVS ) ); + ( *hStereoDmxEVS ) = NULL; return; } diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index 9500da4fb9d21b5e7181d2349306a66fc5e46774..2e739cc90651f43dc4f4d7d9adb4e733425e15fd 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -235,7 +235,8 @@ void stereo_mdct_core_enc( *---------------------------------------------------------------*/ ivas_mdct_core_whitening_enc( hCPE, new_samples, old_wsp, pitch_buf, p_mdst_spectrum_long, - tnsBits, p_orig_spectrum_long, tnsSize, p_param, hBstr, NULL, 0, CPE_CHANNELS ); + tnsBits, p_orig_spectrum_long, tnsSize, p_param, hBstr, + 0, CPE_CHANNELS ); for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -449,7 +450,8 @@ void stereo_mdct_core_enc( } #endif - ivas_mdct_quant_coder( hCPE, 0, tnsBits, tnsSize, p_param, 0 ); + ivas_mdct_quant_coder( hCPE, + tnsBits, tnsSize, p_param, 0 ); pop_wmops(); diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c index 1be9af224e8341d63fbfbfd1763d3d8820fd2519..fca3c7785eab9e833c538536f7f61fc9fb99ebf3 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -526,7 +526,7 @@ ivas_error stereo_memory_enc( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hIGFEnc\n" ) ); } - st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode, st->mct_chan_mode ); + st->igf = getIgfPresent( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); /* allocate and initialize MDCT stereo structure */ if ( ( hCPE->hStereoMdct = (STEREO_MDCT_ENC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index cc05a70044b214ca4dcafa01cab92fd9102f9964..e334f4d0298b6fc9d00f108b3531f59028e0bacf 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -99,13 +99,11 @@ void stereo_tcx_init_enc( st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_mode ); st->hTcxCfg->resq = getResq( st->bits_frame_nominal * FRAMES_PER_SEC ); st->hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_mode, st->element_mode ); - st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode, st->mct_chan_mode ); -#ifdef SET_TNS_FLAG_IN_EVERY_FRAME + st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode ); if ( st->element_mode != EVS_MONO ) { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode ); } -#endif st->core_brate = st->total_brate; @@ -126,8 +124,8 @@ void stereo_tcx_core_enc( float lsp_new[], /* i : LSPs at the end of the frame */ float lsp_mid[], /* i : LSPs in the middle of the frame */ float pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe */ - const int16_t last_element_mode, /* i : last element mode */ - const int16_t vad_hover_flag /* i : VAD hangover flag */ + const int16_t last_element_mode, /* i : last element mode */ + const int16_t vad_hover_flag /* i : VAD hangover flag */ ) { TCX_ENC_HANDLE hTcxEnc; @@ -459,7 +457,7 @@ void stereo_tcx_core_enc( mvr2r( lsp_q, st->lsp_old, M ); } - if ( st->Opt_DTX_ON && !st->tcxonly ) + if ( st->Opt_DTX_ON && !st->tcxonly && st->hTdCngEnc != NULL ) { /* update CNG parameters in active frames */ if ( st->bwidth == NB && st->enableTcxLpc && st->core != ACELP_CORE ) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c old mode 100644 new mode 100755 index 75b0b789c4cfb32ce8f88df4eac1403de39b26d7..a9b07b85cf9051ef2847ced66dfc53686499f57c --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -61,6 +61,7 @@ struct IVAS_ENC bool ismMetadataProvided[MAX_NUM_OBJECTS]; bool maxBandwidthUser; /* Was a specific max bandwith selected by the user? */ IVAS_ENC_BANDWIDTH newBandwidthApi; /* maximum encoded bandwidth, as set on API level */ + bool extMetadataApi; /* External metadata requested, to be checked against current bit rate */ }; /*---------------------------------------------------------------------* @@ -75,7 +76,7 @@ static int16_t getInputBufferSize( const Encoder_Struct *st_ivas ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBandwidth( const IVAS_ENC_HANDLE hIvasEnc ); -static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig ); +static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, const IVAS_ENC_HANDLE hIvasEnc ); static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); @@ -408,7 +409,8 @@ ivas_error IVAS_ENC_ConfigureForObjects( const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const uint16_t numObjects /* i : number of objects to be encoded */ + const uint16_t numObjects, /* i : number of objects to be encoded */ + const bool ism_extended_metadata /* i : Extended metadata used (true/false), where extended metadata includes radius and orientation */ ) { Encoder_Struct *st_ivas; @@ -428,7 +430,9 @@ ivas_error IVAS_ENC_ConfigureForObjects( st_ivas->hEncoderConfig->ivas_format = ISM_FORMAT; st_ivas->hEncoderConfig->element_mode_init = IVAS_SCE; st_ivas->hEncoderConfig->nchan_inp = numObjects; - + st_ivas->hEncoderConfig->nchan_ism = numObjects; + st_ivas->hEncoderConfig->ism_extended_metadata_flag = ism_extended_metadata; + hIvasEnc->extMetadataApi = ( ism_extended_metadata == 1 ); hIvasEnc->maxBandwidthUser = max_bwidth_user; error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); @@ -468,7 +472,12 @@ ivas_error IVAS_ENC_FeedObjectMetadata( return IVAS_ERR_INDEX_OUT_OF_BOUNDS; } - error = set_ism_metadata( hIvasEnc->st_ivas->hIsmMetaData[ismIndex], metadata.azimuth, metadata.elevation ); +#ifdef ISM_NON_DIEGETIC_PAN + error = ivas_set_ism_metadata( hIvasEnc->st_ivas->hIsmMetaData[ismIndex], metadata.azimuth, metadata.elevation, metadata.radius, metadata.yaw, metadata.pitch, metadata.non_diegetic_flag ); +#else + error = ivas_set_ism_metadata( hIvasEnc->st_ivas->hIsmMetaData[ismIndex], metadata.azimuth, metadata.elevation, metadata.radius, metadata.yaw, metadata.pitch ); +#endif + if ( error != IVAS_ERR_OK ) { return error; @@ -818,7 +827,7 @@ static ivas_error configureEncoder( } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { - if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) + if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) { return error; } @@ -916,8 +925,7 @@ static ivas_error configureEncoder( } if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && - ( ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 1 ) || // ToDo: see Issue 113 - ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation + ( ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD ) ) @@ -926,7 +934,7 @@ static ivas_error configureEncoder( } #ifdef DEBUG_AGC_ENCODER_CMD_OPTION - if ( hEncoderConfig->Opt_AGC_ON == SBA_AGC_FORCE_ENABLE && !( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_sba_mode_select( hEncoderConfig->ivas_total_brate ) == SBA_MODE_SPAR ) ) + if ( hEncoderConfig->Opt_AGC_ON == SBA_AGC_FORCE_ENABLE && !( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_sba_mode_select() == SBA_MODE_SPAR ) ) { return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "AGC supported in SBA format at bitrates >= 24.4 kbps only." ); } @@ -951,6 +959,7 @@ static ivas_error configureEncoder( return error; } + if ( hEncoderConfig->ivas_format == MONO_FORMAT ) { hIvasEnc->hCoreCoder = st_ivas->hSCE[0]->hCoreCoder[0]; /* Note: this is needed for switching in EVS mono */ @@ -994,7 +1003,7 @@ ivas_error IVAS_ENC_GetDelay( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, 0 ) ); + *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL ) ); *delay *= hEncoderConfig->nchan_inp; @@ -1015,6 +1024,31 @@ static int16_t getInputBufferSize( return (int16_t) ( st_ivas->hEncoderConfig->input_Fs * st_ivas->hEncoderConfig->nchan_inp / FRAMES_PER_SEC ); } +/*---------------------------------------------------------------------* + * IVAS_ENC_GetNumInChannels() + * + * + *---------------------------------------------------------------------*/ +ivas_error IVAS_ENC_GetNumInChannels( + const IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ + int16_t *numInChannels /* o : total number of samples expected in the input buffer for current encoder configuration */ +) +{ + if ( hIvasEnc == NULL || numInChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + if ( !hIvasEnc->isConfigured ) + { + return IVAS_ERR_NOT_CONFIGURED; + } + + *numInChannels = hIvasEnc->st_ivas->hEncoderConfig->nchan_inp; + + return IVAS_ERR_OK; +} + /*---------------------------------------------------------------------* * IVAS_ENC_GetInputBufferSize() @@ -1532,11 +1566,11 @@ static ivas_error printConfigInfo_enc( { if ( hEncoderConfig->ivas_total_brate <= ACELP_32k && hEncoderConfig->nchan_inp > 2 ) { - fprintf( stdout, "IVAS format: Param-ISm (%i streams)\n", hEncoderConfig->nchan_inp ); + fprintf( stdout, "IVAS format: Param-ISM (%i streams)\n", hEncoderConfig->nchan_inp ); } else { - fprintf( stdout, "IVAS format: ISm (%i streams)\n", hEncoderConfig->nchan_inp ); + fprintf( stdout, "IVAS format: ISM (%i streams)\n", hEncoderConfig->nchan_inp ); } } else if ( hEncoderConfig->ivas_format == SBA_FORMAT ) @@ -1738,7 +1772,7 @@ static ivas_error setBitrate( if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { - if ( ( error = sanitizeBitrateISM( hEncoderConfig ) ) != IVAS_ERR_OK ) + if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) { return error; } @@ -1979,26 +2013,46 @@ static ivas_error sanitizeBandwidth( *---------------------------------------------------------------------*/ static ivas_error sanitizeBitrateISM( - const ENCODER_CONFIG_HANDLE hEncoderConfig ) + const ENCODER_CONFIG_HANDLE hEncoderConfig, + const IVAS_ENC_HANDLE hIvasEnc ) { - if ( hEncoderConfig->ivas_total_brate > IVAS_256k ) + if ( hEncoderConfig->ivas_total_brate > IVAS_128k && hEncoderConfig->nchan_inp == 1 ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for 1 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); + } + + if ( hEncoderConfig->ivas_total_brate > IVAS_256k && hEncoderConfig->nchan_inp == 2 ) { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); + return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for 2 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); + } + + if ( hEncoderConfig->ivas_total_brate > IVAS_384k && hEncoderConfig->nchan_inp == 3 ) + { + return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too high bitrate for 3 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } if ( hEncoderConfig->ivas_total_brate < IVAS_16k4 && hEncoderConfig->nchan_inp == 2 ) { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 2 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); + return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 2 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 && hEncoderConfig->nchan_inp == 3 ) { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 3 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); + return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 3 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 && hEncoderConfig->nchan_inp == 4 ) { - return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISm specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); + return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); + } + + if ( hIvasEnc->extMetadataApi ) + { + hEncoderConfig->ism_extended_metadata_flag = ( hEncoderConfig->ivas_total_brate >= ISM_EXTENDED_METADATA_BRATE ); + } + else + { + hEncoderConfig->ism_extended_metadata_flag = 0; } return IVAS_ERR_OK; @@ -2256,8 +2310,10 @@ static void init_encoder_config( hEncoderConfig->var_SID_rate_flag = 1; hEncoderConfig->mc_input_setup = MC_LS_SETUP_INVALID; hEncoderConfig->stereo_dmx_evs = 0; + hEncoderConfig->nchan_ism = 0; hEncoderConfig->sba_order = 0; hEncoderConfig->sba_planar = 0; + hEncoderConfig->ism_extended_metadata_flag = 0; #ifdef DEBUGGING hEncoderConfig->stereo_mode_cmdl = 0; hEncoderConfig->force = -1; diff --git a/lib_enc/lib_enc.h b/lib_enc/lib_enc.h index 98447a042eaf6e264bcb0bd76e60e60df678d329..d6837e501f0d8c867f008385557232ac7b0f6f94 100644 --- a/lib_enc/lib_enc.h +++ b/lib_enc/lib_enc.h @@ -34,9 +34,7 @@ #define LIB_ENC_H #include "common_api_types.h" -#include "ivas_error.h" #include -#include /*---------------------------------------------------------------------* @@ -96,6 +94,15 @@ typedef enum _IVAS_ENC_MASA_VARIANT IVAS_ENC_MASA_UNDEFINED = 0xffff } IVAS_ENC_MASA_VARIANT; +#ifdef COMPLEXITY_LEVEL_INDICATION +typedef enum _IVAS_ENC_COMPLEXITY_LEVEL +{ + IVAS_ENC_COMPLEXITY_LEVEL_ONE = 1, + IVAS_ENC_COMPLEXITY_LEVEL_TWO = 2, + IVAS_ENC_COMPLEXITY_LEVEL_THREE = 3 +} IVAS_ENC_COMPLEXITY_LEVEL; +#endif + #ifdef DEBUGGING typedef enum _IVAS_ENC_STEREO_MODE { @@ -182,7 +189,8 @@ ivas_error IVAS_ENC_ConfigureForObjects( const bool max_bwidth_user, /* i : shows if bandwidth limitation was set by the user (true) or if default bandwidth was used (false) */ const IVAS_ENC_BANDWIDTH maxBandwidth, /* i : bandwidth limitation */ const IVAS_ENC_DTX_CONFIG dtxConfig, /* i : configuration of DTX, can by set to default by using IVAS_ENC_GetDefaultDtxConfig() */ - const uint16_t numObjects /* i : number of objects to be encoded */ + const uint16_t numObjects, /* i : number of objects to be encoded */ + const bool ism_extended_metadata /* i : Extended metadata used (true/false), where extended metadata includes radius and orientation */ ); /*! r: error code */ @@ -306,6 +314,12 @@ ivas_error IVAS_ENC_GetDelay( int16_t *delay /* o : encoder delay */ ); +/*! r: encoder error code */ +ivas_error IVAS_ENC_GetNumInChannels( + const IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ + int16_t *numInChannels /* o : total number of samples expected in the input buffer for current encoder configuration */ +); + /*! r: encoder error code */ ivas_error IVAS_ENC_GetInputBufferSize( const IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ diff --git a/lib_enc/lsf_enc.c b/lib_enc/lsf_enc.c index 052bfbe96e5756518e94fe0c634fa9fb3fb9aa2e..66f8847608b989e47ec7068d02972d36203383db 100644 --- a/lib_enc/lsf_enc.c +++ b/lib_enc/lsf_enc.c @@ -45,10 +45,8 @@ #include "rom_com.h" #include "prot.h" #include "basop_proto_func.h" -#ifdef LSF_RE_USE_SECONDARY_CHANNEL #include "ivas_prot.h" #include "ivas_rom_com.h" -#endif #include "wmc_auto.h" /*-----------------------------------------------------------------* @@ -85,10 +83,8 @@ void lsf_enc( float *Aq, /* o : quantized A(z) for 4 subframes */ const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL , const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -#endif ) { int16_t i, nBits, force_sf, no_param_lpc; @@ -184,12 +180,7 @@ void lsf_enc( * LSF quantization *-------------------------------------------------------------------------------------*/ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - lsf_end_enc( st, lsf_new, lsf_new, nBits, coder_type, force_sf, param_lpc, &no_param_lpc, NULL, st->coder_type_raw, - tdm_lsfQ_PCh ); -#else - lsf_end_enc( st, lsf_new, lsf_new, nBits, coder_type, force_sf, param_lpc, &no_param_lpc, NULL, st->coder_type_raw ); -#endif + lsf_end_enc( st, lsf_new, lsf_new, nBits, coder_type, force_sf, param_lpc, &no_param_lpc, NULL, st->coder_type_raw, tdm_lsfQ_PCh ); /* convert quantized LSFs back to LSPs */ lsf2lsp( lsf_new, lsp_new, M, st->sr_core ); @@ -450,11 +441,8 @@ void lsf_end_enc( int16_t *lpc_param, int16_t *no_indices, int16_t *bits_param_lpc, - const int16_t coder_type_raw -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , + const int16_t coder_type_raw, const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ -#endif ) { int16_t i; @@ -486,18 +474,13 @@ void lsf_end_enc( int16_t *TCQIdx; int16_t flag_1bit_gran; BSTR_ENC_HANDLE hBstr = st->hBstr; -#ifdef LSF_RE_USE_SECONDARY_CHANNEL float pred3[M]; int16_t dummy, dummy_v[5]; -#endif flag_1bit_gran = ( st->element_mode > EVS_MONO ); nBits = nBits_in; - if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - && ( st->idchan == 0 ) /* this bit is used only for primary channel or mono */ -#endif + if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->codec_mode == MODE1 && ( st->idchan == 0 ) /* this bit is used only for primary channel or mono */ ) { if ( coder_type_raw == VOICED ) @@ -571,7 +554,6 @@ void lsf_end_enc( pred1[i] = ModeMeans[mode_lvq][i] + MU_MA * st->mem_MA[i]; } -#ifdef LSF_RE_USE_SECONDARY_CHANNEL /* TD stereo SCh: perform intra-frame prediction with pulling-to-mean */ if ( st->tdm_LRTD_flag == 0 && st->idchan == 1 && tdm_lsfQ_PCh != NULL ) { @@ -580,7 +562,6 @@ void lsf_end_enc( tdm_SCh_LSF_intra_pred( st->element_brate, tdm_lsfQ_PCh, pred3 ); } -#endif if ( predmode == 0 ) /* Safety-net only */ { @@ -601,10 +582,8 @@ void lsf_end_enc( safety_net = 0; } else /* Switched Safety-Net/AR prediction */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL { if ( predmode == 2 ) -#endif { /* Subtract mean and AR prediction */ mvr2r( ModeMeans[mode_lvq], pred0, M ); @@ -684,7 +663,6 @@ void lsf_end_enc( } } } -#ifdef LSF_RE_USE_SECONDARY_CHANNEL else /* of "if (predmode==2)" */ { mvr2r( ModeMeans[mode_lvq], pred0, M ); @@ -734,7 +712,6 @@ void lsf_end_enc( /* AR inter-frame prediction */ lsf_allocate( nBits - 1, mode_lvq, mode_lvq_p, &dummy, &stages1, dummy_v, levels1, dummy_v, bits1 ); - Err[1] = vq_lvq_lsf_enc( 2, mode_lvq_p, Tmp, levels1, stages1, wghts, Idx1, lsf, pred2, resq, lsfq ); if ( Err[0] * ( st->streaklimit ) < PREFERSFNET * Err[1] ) @@ -750,7 +727,7 @@ void lsf_end_enc( } } } -#endif + /*--------------------------------------------------------------------------* * Write indices to array *--------------------------------------------------------------------------*/ @@ -758,10 +735,8 @@ void lsf_end_enc( if ( st->codec_mode == MODE1 && st->core == ACELP_CORE ) { /* write coder_type bit for VOICED@16kHz or GENERIC@16kHz */ - if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - && ( st->idchan == 0 ) -#endif + if ( coder_type_org == GENERIC && st->sr_core == INT_FS_16k && st->idchan == 0 + ) { /* VOICED =2 and GENERIC=3, so "coder_type-2" means VOICED =0 and GENERIC=1*/ @@ -769,11 +744,7 @@ void lsf_end_enc( } /* write predictor selection bit */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL if ( predmode >= 2 ) -#else - if ( predmode == 2 ) -#endif { push_indice( hBstr, IND_LSF_PREDICTOR_SELECT_BIT, safety_net, 1 ); } @@ -791,11 +762,7 @@ void lsf_end_enc( else { cumleft = nBits; -#ifdef LSF_RE_USE_SECONDARY_CHANNEL if ( predmode >= 2 ) -#else - if ( predmode == 2 ) -#endif { /* subtract predictor selection bit */ cumleft = nBits - 1; @@ -924,7 +891,6 @@ void lsf_end_enc( } else { -#ifdef LSF_RE_USE_SECONDARY_CHANNEL if ( st->tdm_LRTD_flag == 0 && st->idchan == 1 && tdm_lsfQ_PCh != NULL ) { /* intra mode*/ @@ -934,14 +900,11 @@ void lsf_end_enc( } else { -#endif vq_dec_lvq( 1, qlsf, &indice[0], stages0, M, mode_lvq, levels0[stages0 - 1] ); v_add( qlsf, pred0, qlsf, M ); v_sub( qlsf, pred1, st->mem_MA, M ); -#ifdef LSF_RE_USE_SECONDARY_CHANNEL } -#endif } } else diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index a620dfac384f499c5d779d0048fc1ac5d0b89ece..0f7a798a75a8971530b55965a1ae43a7cb1b5a64 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -48,25 +48,285 @@ #define kMaxC 8 + +#include "ivas_prot.h" + +// void dctT2_N_apply_matrix( const float *input, float *output, const int16_t dct_dim, int16_t fdcngvq_dim, const float *idctT2_24_X_matrixQ16, const int16_t matrix_1st_dim, DCTTYPE dcttype ); + + +#ifdef ERI_MSVQ_CLEANUP + +int16_t msvq_stage1_dct_search( + /* o : (p_max , best candidate sofar ) */ + const float *u, /* i : target */ + const int16_t N, /* i : target length and IDCT synthesis length */ + + /* parameterization of segmented DCT domain storage */ + const int16_t maxC_st1, /* i : number of final stage 1 candidates to provide */ + + const DCTTYPE dcttype, /* e.g. DCT_T2_16_XX, DCT_T2_24_XX; */ + const int16_t max_dct_trunc, /* i: maximum of truncation lenghts */ + float *invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ + + const float *midQ_truncQ, /* i: midQ vector */ + const float *dct_invScaleF, /* i: global inv scale factors*/ + const float *dct_scaleF, /* i: global scale factors*/ + const Word16 n_segm, /* i: number of segments */ + const Word16 *cols_per_segment, /* i: remaining length per segment */ + const Word16 *trunc_dct_cols_per_segment, /* i: trunc length per segment */ + const Word16 *entries_per_segment, /* i: number of rows per segment */ + const Word16 *cum_entries_per_segment, /* i: number of cumulative entries */ + + const Word8 *const W8Qx_dct_sections[], /*i: Word8(byte) segment table ptrs */ + const Word16 *col_syn_shift[], /*i: columnwise syn shift tables */ + const Word8 *segm_neighbour_fwd, /*i: circular neighbour list fwd */ + const Word8 *segm_neighbour_rev, /*i: circular neighbour list reverse */ + const Word16 npost_check, /*i: number of neigbours to check , should be even */ + + float *st1_mse_ptr, /*i: dynRAM buffer for MSEs */ + int16_t *indices_st1_local, /*o: selected cand indices */ + float *st1_syn_vec_ptr, /*i/o: buffer for IDCT24 synthesis */ + float *dist1_ptr /*o: resulting stage 1 MSEs in DCT-N domain */ +) +{ /* stage1 search in a segmentwise truncated dct N domain without weights */ + + float dct_target[FDCNG_VQ_DCT_MAXTRUNC]; + float u_mr[FDCNG_VQ_MAX_LEN]; + float u_mr_scaled[FDCNG_VQ_MAX_LEN]; + float mse_trunc_segm[FDCNG_VQ_DCT_NSEGM]; + float tmp, check_mse; + float mse; /* Word32 in BASOP */ + + int16_t p_max, c, c2, segm, j_full, j, i; + int16_t n_ana, p_mins[2], idx_min[2]; + + const Word8 *cbpW8; + const Word16 *dct_col_shift_tab; + + float *st1_mse_pair; + int16_t *st1_idx_pair; + + float tmp2; + int16_t check_ind[FDCNG_VQ_DCT_NPOST]; + assert( ( npost_check % 2 == 0 ) && ( npost_check <= FDCNG_VQ_DCT_NPOST ) ); + + assert( n_segm <= FDCNG_VQ_DCT_NSEGM ); + + n_ana = N; /* VQ stage#1 core is currently always using stored DCT N coeffs */ + assert( n_ana >= max_dct_trunc ); /* check for FDCNGVQ WB , SWB, FB operation */ + + /* remove mid stage#1 vector, in original input domain */ + v_sub( u, midQ_truncQ, u_mr, n_ana ); + + v_multc( u_mr, dct_invScaleF[1], u_mr_scaled, n_ana ); /* scale up target to upscaled W8x storage domain */ + /* 16.0-->scale up from Q0 to search domain in Q4, not really needed in BASOP , impl. by shifts */ + + dctT2_N_apply_matrix( (const float *) u_mr_scaled, dct_target, min( max_dct_trunc, n_ana ), n_ana, invTrfMatrix, max_dct_trunc, dcttype ); + + /* init search state ptr's at the top */ + set_f( dist1_ptr, FLT_MAX, maxC_st1 ); + st1_mse_pair = &( dist1_ptr[0] ); /* req. ptr post upd +=2 */ + st1_idx_pair = &( indices_st1_local[0] ); /* req. ptr post upd +=2 */ + set_f( mse_trunc_segm, 0.0f, n_segm ); + + for ( segm = 0; segm < n_segm; segm++ ) + { /* point to a new paired location for each segment */ + p_max = 0; /* req. to point to one of 1 or 0, this init can potentially be omitted here,as p_max is always 1 or 0 */ + + /* compute segment common trunction error in dctN domain */ + mse_trunc_segm[segm] += sum2_f( (const float *) ( &( dct_target[cols_per_segment[segm]] ) ), trunc_dct_cols_per_segment[segm] ); + + cbpW8 = W8Qx_dct_sections[segm]; /* Word8 column variable Qx storage , table ptr init */ + + for ( j = 0; j < entries_per_segment[segm]; j++ ) + { + /* unweighted segmented search DCT domain loop */ + j_full = j + cum_entries_per_segment[segm]; /* or simply use j_full++ */ + + mse = mse_trunc_segm[segm]; /* init mse with with common mse truncation part, in BASOP a move32() */ + + dct_col_shift_tab = col_syn_shift[segm]; /* ptr init */ + + for ( c2 = 0; c2 < cols_per_segment[segm]; c2++ ) + { +#define WMC_TOOL_SKIP + tmp = dct_target[c2] - (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* Word8 storage MSE inner loop */ + LOGIC( 1 ); + SHIFT( 1 ); + ADD( 1 ); /* in BASOP: s_and(for W8->W16), shl(), sub()*/ +#undef WMC_TOOL_SKIP + mse += tmp * tmp; /* L_mac or L_mac0() square Word16 -> Word32*/ + } + st1_mse_ptr[j_full] = mse; /* save MSE in shared dynamic RAM, move32() in BASOP */ + +#define WMC_TOOL_SKIP + cbpW8 += cols_per_segment[segm]; /* fixed pointer increment for each segment */ +#undef WMC_TOOL_SKIP + + /* overwrite with a new worst index at p_max */ + + /* Note: The three inner loop if's below are not 100% properly instrumented by WMC tool */ + if ( mse < st1_mse_pair[p_max] ) /* L_sub */ + { + st1_idx_pair[p_max] = j_full; /* move16, single BASOP */ + } /* BASOP 2 ops */ + + if ( st1_idx_pair[p_max] == j_full ) + { /* idx updated --> also update mse */ + st1_mse_pair[p_max] = mse; /* move32(), single BASOP */ + } /* BASOP 3 ops */ + + /* avoid WC costly candidate list management by always updating p_max, + as we have only a pair in each segment to maintain */ + p_max = 0; /* move16() */ + if ( ( st1_mse_pair[0] - st1_mse_pair[1] ) < 0 ) /* L_sub()*/ + { + p_max = 1; /* move16() */ + } /* BASOP 3 ops ,Note 2 ops possible in BASOP with L_sub and L_lshr */ + + /* Note: logical shift right not available in ANSI-C */ + /* p_max = (st1_mse_pair[0] - st1_mse_pair[1]) ">>>" 31; */ + /* in java logical shift right is available as >>> , in BASOP it is available as L_lshr */ + + /* Cost: weighted sum with cond moves ('if') => 8 in float , 7 in BASOP with L_lshr */ + } /* j in section */ + + st1_mse_pair += 2; /* req. ptr init */ + st1_idx_pair += 2; /* req. ptr init */ + + } /* next segment */ + + for ( j = 0; j < maxC_st1; j++ ) + { + /* compute_full mse using stored DCT24 domain MSE's */ + /* calculate MSE from stage1 inner using existing inner DCT domain variables */ + dist1_ptr[j] *= dct_scaleF[2]; /* multiplication to get the DCT inner MSE scale to the correct input domain */ + } + + assert( ( maxC_st1 >= 3 ) ); + assert( ( maxC_st1 <= 8 ) ); + + p_max = maximum( dist1_ptr, maxC_st1, NULL ); /* establish current worst candidate for MSVQ stage#2 among all maxC_st1 candidates so far */ + + p_mins[0] = minimum( dist1_ptr, maxC_st1, NULL ); /* find best entry among all maxC_pre */ + tmp = dist1_ptr[p_mins[0]]; + dist1_ptr[p_mins[0]] = FLT_MAX; /* exclude 1st */ + + p_mins[1] = minimum( dist1_ptr, maxC_st1, NULL ); /* find 2nd best entry */ + tmp2 = dist1_ptr[p_mins[1]]; + dist1_ptr[p_mins[1]] = FLT_MAX; /* exclude 2nd */ + + dist1_ptr[p_mins[0]] = tmp; /* restore 1st */ + dist1_ptr[p_mins[1]] = tmp2; /* restore 2nd */ + + idx_min[0] = indices_st1_local[p_mins[0]]; + idx_min[1] = indices_st1_local[p_mins[1]]; + + + /* use global exclusion list to never reselect the two (best) global MSE values sofar */ + st1_mse_ptr[idx_min[0]] = FLT_MAX; /* move32() */ + st1_mse_ptr[idx_min[1]] = FLT_MAX; /* move32() */ + + /* circular MSE-neigbour list in use to potentially replace some segment search candidates */ + /* using both 1st and 2nd best neighbours in fwd and rev directions */ + check_ind[0] = segm_neighbour_fwd[idx_min[0]]; + check_ind[1] = segm_neighbour_rev[idx_min[0]]; + + check_ind[2] = segm_neighbour_fwd[idx_min[1]]; + check_ind[3] = segm_neighbour_rev[idx_min[1]]; + + check_ind[4] = segm_neighbour_fwd[check_ind[0]]; + check_ind[5] = segm_neighbour_rev[check_ind[1]]; + + check_ind[6] = segm_neighbour_fwd[check_ind[2]]; + check_ind[FDCNG_VQ_DCT_NPOST - 1] = segm_neighbour_rev[check_ind[3]]; + + for ( i = 0; i < npost_check; i++ ) + { + /* move MSE from DCT-inner loop search to input synthesis domain */ + /* multiplication by fdcng_dct_scaleF[2] to get the float outer loop scale correct in IDCT synthesis domain */ + check_mse = st1_mse_ptr[check_ind[i]] * dct_scaleF[2]; + + if ( check_mse < dist1_ptr[p_max] ) + { /* new winner , replace worst */ + dist1_ptr[p_max] = check_mse; + indices_st1_local[p_max] = check_ind[i]; + st1_mse_ptr[check_ind[i]] = FLT_MAX; /* exclude, BASOP: move32() */ + p_max = maximum( dist1_ptr, maxC_st1, NULL ); /* establish a new current worst candidate among all maxC */ + } + } + + /* extract the selected stage one vectors in DCT_N domain , apply IDCT_N and scale up */ + /* always extract full length signal(e.g. 24) to be able to update WB(e.g. N_in==21) candidate MSE values */ + /* in the case that only a part of the IDCT N vector is in final use */ + + /* note: synthesis not yet fully parameterized/generalized for other IDCT lengths */ + assert( N == 24 ); + { + for ( c = 0; c < maxC_st1; c++ ) + { + dec_FDCNG_MSVQ_stage1( indices_st1_local[c], N, invTrfMatrix, dcttype + 1, &( st1_syn_vec_ptr[c * N] ), NULL ); + } + } + + return p_max; /*ptr to worst performing candidate */ +} + + +/* recalc MSE for fdcng WB(0..20) coeffs , + essentially subtract res21^2 ,res22^2, res23^2 that was included in stage1 MSE in the DCT24 domain truncated search, + excludes the waveform contributions at pos 21,22,23 to the MSE, important to keep the WB MSEs update for the subsequent stages +*/ +int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( /* o : (updated p_max) */ + const float *st1_syn_vec_ptr, /* i : IDCT24 synthesis vectors */ + const float *u, /* i : target signal */ + const int16_t maxC_st1, /* i : number of candidates in stage1 */ + float *dist_ptr /* i/o: updated MSE vector for stage1 */ +) +{ + int16_t p_max_local, c; + const float *p2; + float res24, high_diff[FDCNG_VQ_MAX_LEN - FDCNG_VQ_MAX_LEN_WB]; + + for ( c = 0; c < maxC_st1; c++ ) + { /* point to extended synthesis part */ + p2 = (const float *) &( st1_syn_vec_ptr[c * FDCNG_VQ_MAX_LEN + FDCNG_VQ_MAX_LEN_WB] ); /* ptr init to synthesis candidate c */ + /* for stage#1 use "u" instead of the shortened resid[0], to access the extended/extrapolated input target */ + v_sub( p2, &( u[FDCNG_VQ_MAX_LEN_WB] ), high_diff, FDCNG_VQ_MAX_LEN - FDCNG_VQ_MAX_LEN_WB ); + res24 = dotp( high_diff, high_diff, FDCNG_VQ_MAX_LEN - FDCNG_VQ_MAX_LEN_WB ); /* sum squared over top env. values above WB coeffs */ + + dist_ptr[c] -= res24; /* remove DCT24 high band error contribution */ + } + + /* finally update p_max, as it may potentially change, + due to the core DCT24 search originally optimizing over the longer basis vectors than DCT21 */ + p_max_local = maximum( dist_ptr, maxC_st1, NULL ); + + return p_max_local; +} +#endif + + /*--------------------------------------------------------------------------* * msvq_enc() * * MSVQ encoder *--------------------------------------------------------------------------*/ - void msvq_enc( - const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ - const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ - const int16_t offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */ - const float u[], /* i : Vector to be encoded (prediction and mean removed) */ - const int16_t *levels, /* i : Number of levels in each stage */ - const int16_t maxC, /* i : Tree search size (number of candidates kept from */ - /* one stage to the next == M-best) */ - const int16_t stages, /* i : Number of stages */ - const float w[], /* i : Weights */ - const int16_t N, /* i : Vector dimension */ - const int16_t maxN, /* i : Codebook dimension */ - int16_t Idx[] /* o : Indices */ + const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ + const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ + const int16_t offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */ + const float u[], /* i : Vector to be encoded (prediction and mean removed) */ + const int16_t *levels, /* i : Number of levels in each stage */ + const int16_t maxC, /* i : Tree search size (number of candidates kept from */ + /* one stage to the next == M-best) */ + const int16_t stages, /* i : Number of stages */ + const float w[], /* i : Weights */ + const int16_t N, /* i : Vector dimension */ + const int16_t maxN, /* i : Codebook dimension */ + const int16_t applyDCT_flag, /* i : applyDCT flag */ + float *invTrfMatrix, /*i/o : synthesis matrix */ + int16_t Idx[] /* o : Indices */ ) { float *resid[2], *dist[2]; @@ -77,9 +337,51 @@ void msvq_enc( float resid_buf[2 * LSFMBEST_MAX * M_MAX], dist_buf[2 * LSFMBEST_MAX], Tmp[M_MAX]; int16_t idx_buf[2 * LSFMBEST_MAX * MAX_VQ_STAGES_USED], parents[LSFMBEST_MAX]; int16_t n, maxn, start; +#ifndef ERI_MSVQ_CLEANUP + /* buffers */ + float dct_target[FDCNG_VQ_DCT_MAXTRUNC]; + float u_mr[FDCNG_VQ_MAX_LEN]; + float u_mr_scaled[FDCNG_VQ_MAX_LEN]; + float mse_trunc_all_segms; + float mse_trunc_segm[FDCNG_VQ_DCT_NSEGM]; + float mse; + + const Word8 *cbpW8; + const Word16 *dct_col_shift_tab; + + float *st1_mse_pair; + int16_t *st1_idx_pair; + int16_t indices_st1_local[FDCNG_VQ_DCT_NSEGM * 2]; /* after stage#1 DCT search this is copied to the global indices[1][s*stages] structure */ + int16_t n_ana, p_mins[2], idx_min[2]; + DCTTYPE dcttype = DCT_T2_24_XX; + float tmp2; + + int16_t check_ind[FDCNG_VQ_DCT_NPOST]; + int16_t segm, j_full, maxC_pre; +#endif + float *st1_syn_vec_ptr; /* ptr to buffer in dynRAM */ + float *st1_mse_ptr; /* ptr to buffer in existing dRAM used for stage 1 candidate analysis */ +#ifdef ERI_MSVQ_CLEANUP + int16_t indices_st1_local[FDCNG_VQ_DCT_NSEGM * 2]; /* after stage#1 DCT search this is copied to the global indices[1][s*stages] structure */ +#else + float res24, high_diff[FDCNG_VQ_MAX_LEN - FDCNG_VQ_MAX_LEN_WB]; + maxC_pre = ( FDCNG_VQ_DCT_NSEGM * 2 ); +#endif + assert( maxC <= LSFMBEST_MAX ); + assert( ( LSFMBEST_MAX * M_MAX ) > ( N * maxC ) ); + /* top of resid_buf is resid[1] and used for stage#1 residuals (input target u), + we here reuse resid[0] part of the buffer for stage#1 DCT dynamic RAM needs */ + st1_mse_ptr = &( resid_buf[1 * LSFMBEST_MAX * M_MAX] ) - ( levels[0] ); /* reuse top of residual resid[0] scratch RAM for stage1 MSEs */ + + st1_syn_vec_ptr = &( resid_buf[1 * LSFMBEST_MAX * M_MAX] ) - FDCNG_VQ_MAX_LEN * maxC; /* reuse top of resid[0] scratch RAM for residual */ + +#ifndef ERI_MSVQ_CLEANUP + dcttype = DCT_T2_24_XX; +#endif + /*----------------------------------------------------------------* - * Allocate memory for previous (parent) and current nodes. + * Allocate memory for previous (parent) and current nodes. * Parent node is indexed [0], current node is indexed [1]. *----------------------------------------------------------------*/ @@ -159,84 +461,235 @@ void msvq_enc( { dist[1][j] = FLT_MAX; } - if ( !s ) /* means: m==1 */ + +#ifdef ERI_MSVQ_CLEANUP + if ( !s && applyDCT_flag != 0 ) /* means: m==1 */ { - /* This loop is identical to the one below, except, that the inner - loop over c=0..m is hardcoded to c=0, since m=1. */ - /* dist[0][0] */ - for ( j = 0; j < levels[s]; j++ ) + /* stage 1 candidates search in truncated dct24 domain without any weights */ + assert( N == FDCNG_VQ_MAX_LEN || N == FDCNG_VQ_MAX_LEN_WB ); /* 21 and 24 allowed */ + assert( maxC == 2 * FDCNG_VQ_DCT_NSEGM ); + + p_max = msvq_stage1_dct_search( u, FDCNG_VQ_MAX_LEN, maxC, + DCT_T2_24_XX, + FDCNG_VQ_DCT_MAXTRUNC, + invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ + cdk1r_tr_midQ_truncQ, /* i: midQ vector */ + fdcng_dct_invScaleF, /* i: global inv scale factors*/ + fdcng_dct_scaleF, /* i: global scale factors*/ + FDCNG_VQ_DCT_NSEGM, /* i: number of segments */ + cdk1_ivas_cols_per_segment, /* i: remaining length per segment */ + cdk1_ivas_trunc_dct_cols_per_segment, /* i: trunc length per segment */ + cdk1_ivas_entries_per_segment, /* i: number of rows per segment */ + cdk1_ivas_cum_entries_per_segment, /* i: number of cumulative entries */ + cdk_37bits_ivas_stage1_W8Qx_dct_sections, /*i: Word8(byte) segment table ptrs */ + stage1_dct_col_syn_shift, /*i: columnwise syn shift tables */ + cdk1_ivas_segm_neighbour_fwd, /*i: circular neighbour list fwd */ + cdk1_ivas_segm_neighbour_rev, /*i: circular neighbour list reverse */ + FDCNG_VQ_DCT_NPOST, /*i: number of circ. neigbours to post check */ + st1_mse_ptr, indices_st1_local, st1_syn_vec_ptr, dist[1] ); + + + /* move established stage#1 indices to the global MSVQ list structure */ + for ( c = 0; c < maxC; c++ ) { - en = 0.0f; - /* w,Tmp */ - /* Compute weighted codebook element and its energy */ - for ( c2 = 0; c2 < n; c2++ ) - { - Tmp[start + c2] = w[start + c2] * cbp[c2]; - en += cbp[c2] * Tmp[start + c2]; - } - cbp += maxn; /* pointer is incremented */ + indices[1][c * stages] = indices_st1_local[c]; + } + } +#else + if ( !s && applyDCT_flag != 0 ) /* means: m==1 */ + { /* stage 1 search in truncated dct domain without any weights */ - pTmp = &resid[0][0]; - /* Tmp */ - tmp = ( *pTmp++ ) * Tmp[0]; - for ( c2 = 1; c2 < N; c2++ ) - { - tmp += ( *pTmp++ ) * Tmp[c2]; - } - tmp = en - 2.0f * tmp; - tmp += dist[0][0]; - if ( tmp < dist[1][p_max] ) + n_ana = FDCNG_VQ_MAX_LEN; /* VQ stage#1 core is always using stored DCT24 coeffs */ + /*remove mean/mid fdcng stage#1 vector, in original subband domain */ + v_sub( u, cdk1r_tr_midQ_truncQ, u_mr, n_ana ); + + v_multc( u_mr, fdcng_dct_invScaleF[1], u_mr_scaled, n_ana ); /*scale up target to upscaled W8x storage domain */ + /* 16.0-->scale up from Q0 to search domain in Q4, not really needed in BASOP , impl. by shifts */ + + assert( n_ana >= FDCNG_VQ_DCT_MAXTRUNC ); /* check for WB , SWB, FB operation */ + + dctT2_N_apply_matrix( (const float *) u_mr_scaled, dct_target, min( FDCNG_VQ_DCT_MAXTRUNC, n_ana ), n_ana, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, dcttype ); + + mse_trunc_all_segms = 0; + mse = 0; + + /* init search state ptr's at the top */ + for ( segm = 0; segm < FDCNG_VQ_DCT_NSEGM; segm++ ) + { + /* point to a new paired location */ + st1_mse_pair = &( dist[1][2 * segm] ); /* req. ptr init +=2 */ + st1_mse_pair[0] = FLT_MAX; /* req */ + st1_mse_pair[1] = FLT_MAX; /* req */ + st1_idx_pair = &( indices_st1_local[2 * segm] ); /* +=2 */ + p_max = 0; /* req. to point to 1 or 0 */ + + /* compute segment common trunction error in dct domain */ + mse_trunc_segm[segm] = mse_trunc_all_segms; + mse_trunc_segm[segm] += sum2_f( (const float *) ( &( dct_target[cdk1_ivas_cols_per_segment[segm]] ) ), cdk1_ivas_trunc_dct_cols_per_segment[segm] ); + + cbpW8 = cdk_37bits_ivas_stage1_W8Qx_dct_sections[segm]; /* Word8 column variable Qx storage*/ + + for ( j = 0; j < cdk1_ivas_entries_per_segment[segm]; j++ ) { - /* Replace worst */ - dist[1][p_max] = tmp; - indices[1][p_max * stages] = j; - parents[p_max] = 0; + /* unweighted segmented search DCT domain loop */ + j_full = j + cdk1_ivas_cum_entries_per_segment[segm]; /* or simply use j_full++ */ - p_max = 0; - for ( c2 = 1; c2 < maxC; c2++ ) + mse = mse_trunc_segm[segm]; /* move32() init mse with with common mse truncation part */ + + dct_col_shift_tab = stage1_dct_col_syn_shift[segm]; /* ptr init */ + + for ( c2 = 0; c2 < cdk1_ivas_cols_per_segment[segm]; c2++ ) { - if ( dist[1][c2] > dist[1][p_max] ) - { - p_max = c2; - } + +#define WMC_TOOL_SKIP + tmp = dct_target[c2] - (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* Word8 storage MSE inner loop */ + LOGIC( 1 ); + SHIFT( 1 ); + ADD( 1 ); /* in BASOP: s_and(for W8->W16), shl(), sub()*/ +#undef WMC_TOOL_SKIP + + mse += tmp * tmp; /* L_mac or L_mac0() square Word16 -> Word32*/ } - } /* if (tmp <= dist[1][p_max]) */ - } /* for (j=0; j also update mse */ + st1_mse_pair[p_max] = mse; /* move32(), single BASOP */ + } /* BASOP 3 ops */ + /* avoid WC costly list management by always updating p_max, as we have only a pair to maintain */ + p_max = 0; /* move16() */ + if ( ( st1_mse_pair[0] - st1_mse_pair[1] ) < 0 ) /* L_sub()*/ + { + p_max = 1; /* move16() */ + } /* BASOP 3 ops ,Note 2 ops possible in BASOP with L_sub and L_lshr */ + + /* Note: logical shift right not available in ANSI-C */ + /* p_max = (st1_mse_pair[0] - st1_mse_pair[1]) ">>>" 31; */ + /* in java logical shift right is available as >>> , in BASOP it is L_lshr */ + + /* Cost: weighted sum with cond moves ('if') => 8 in float , 7 in BASOP with L_lshr */ + } /* j in section */ + + } /* next segment */ + + for ( j = 0; j < maxC_pre; j++ ) + { + /* compute_full mse using stored DCT24 domain MSE's */ + /* calculate MSE from stage1 inner using existing inner DCT domain variables */ + dist[1][j] *= fdcng_dct_scaleF[2]; /* single multiplication to get the MSE scale to the correct input domain */ + } + + p_max = maximum( dist[1], maxC_pre, NULL ); /* establish current worst candidate for stage#2 among all maxC_pre candidates */ + + p_mins[0] = minimum( dist[1], maxC_pre, NULL ); /* find best entry among all maxC_pre */ + tmp = dist[1][p_mins[0]]; + dist[1][p_mins[0]] = FLT_MAX; /* exclude 1st */ + + p_mins[1] = minimum( dist[1], maxC_pre, NULL ); /* find 2nd best entry */ + tmp2 = dist[1][p_mins[1]]; + dist[1][p_mins[1]] = FLT_MAX; /* exclude 2nd*/ + + dist[1][p_mins[0]] = tmp; /* restore 1st */ + dist[1][p_mins[1]] = tmp2; /* restore 2nd */ + + idx_min[0] = indices_st1_local[p_mins[0]]; + idx_min[1] = indices_st1_local[p_mins[1]]; + + + /* use global exclusion list to never reselect the two (best) mse values sofar */ + st1_mse_ptr[idx_min[0]] = FLT_MAX; /* move32() */ + st1_mse_ptr[idx_min[1]] = FLT_MAX; /* move32() */ + + /* circular MSE-neigbour list in use to potentially replace some segment search candidates */ + /* using both 1st and 2nd best neighbours in fwd and rev directions */ + check_ind[0] = cdk1_ivas_segm_neighbour_fwd[idx_min[0]]; + check_ind[1] = cdk1_ivas_segm_neighbour_rev[idx_min[0]]; + + check_ind[2] = cdk1_ivas_segm_neighbour_fwd[idx_min[1]]; + check_ind[3] = cdk1_ivas_segm_neighbour_rev[idx_min[1]]; + + check_ind[4] = cdk1_ivas_segm_neighbour_fwd[check_ind[0]]; + check_ind[5] = cdk1_ivas_segm_neighbour_rev[check_ind[1]]; + + check_ind[6] = cdk1_ivas_segm_neighbour_fwd[check_ind[2]]; + check_ind[7] = cdk1_ivas_segm_neighbour_rev[check_ind[3]]; + + for ( i = 0; i < FDCNG_VQ_DCT_NPOST; i++ ) { - en = 0.0f; - /* w,Tmp */ - /* Compute weighted codebook element and its energy */ - for ( c2 = 0; c2 < n; c2++ ) + float check_mse = st1_mse_ptr[check_ind[i]] * fdcng_dct_scaleF[2]; + /* *= fdcng_dct_scaleF[2]; */ /* multiplication in use to get the float outer loop scale correct */ + + if ( check_mse < dist[1][p_max] ) { - Tmp[start + c2] = w[start + c2] * cbp[c2]; - en += cbp[c2] * Tmp[start + c2]; + /* new winner , replace */ + dist[1][p_max] = check_mse; + indices_st1_local[p_max] = check_ind[i]; + st1_mse_ptr[check_ind[i]] = FLT_MAX; /* BASOP: move32() */ + p_max = maximum( dist[1], maxC_pre, NULL ); /* establish a new current worst candidate among all maxC */ } - cbp += maxn; /* pointer is incremented */ + } + + for ( c = 0; c < maxC_pre; c++ ) + { + indices[1][c * stages] = indices_st1_local[c]; /* move established stage#1 indices to global MSVQ list structure */ + } + /* extract the selected stage one vectors in DCT domain , apply IDCT_N and scale up */ + /*always extract full length signal(24) to be able to update WB( N==21) candidate MSE values */ + for ( c = 0; c < maxC_pre; c++ ) + { + dec_FDCNG_MSVQ_stage1( indices_st1_local[c], FDCNG_VQ_MAX_LEN, invTrfMatrix, dcttype + 1, &( st1_syn_vec_ptr[c * FDCNG_VQ_MAX_LEN] ), NULL ); + } + + assert( maxC == maxC_pre ); + } +#endif + else + /* non-DCT Stage #1 code below */ + if ( !s ) /* means: m==1 */ + { + /* This loop is identical to the one below, except, that the inner + loop over c=0..m is hardcoded to c=0, since m=1. */ /* dist[0][0] */ - pTmp = &resid[0][0]; - /* Iterate over all parent nodes */ - for ( c = 0; c < m; c++ ) + for ( j = 0; j < levels[s]; j++ ) { - /* Tmp[0] */ + en = 0.0f; + /* w,Tmp */ + /* Compute weighted codebook element and its energy */ + for ( c2 = 0; c2 < n; c2++ ) + { + Tmp[start + c2] = w[start + c2] * cbp[c2]; + en += cbp[c2] * Tmp[start + c2]; + } + cbp += maxn; /* pointer is incremented */ + + pTmp = &resid[0][0]; + /* Tmp */ tmp = ( *pTmp++ ) * Tmp[0]; for ( c2 = 1; c2 < N; c2++ ) { tmp += ( *pTmp++ ) * Tmp[c2]; } tmp = en - 2.0f * tmp; - tmp += dist[0][c]; + tmp += dist[0][0]; if ( tmp < dist[1][p_max] ) { /* Replace worst */ dist[1][p_max] = tmp; - indices[1][p_max * stages + s] = j; - parents[p_max] = c; + indices[1][p_max * stages] = j; + parents[p_max] = 0; p_max = 0; for ( c2 = 1; c2 < maxC; c2++ ) @@ -247,9 +700,58 @@ void msvq_enc( } } } /* if (tmp <= dist[1][p_max]) */ - } /* for(c=0; c dist[1][p_max] ) + { + p_max = c2; + } + } + } /* if (tmp <= dist[1][p_max]) */ + } /* for(c=0; c #include "options.h" #include "prot.h" -#include "typedef.h" #include "stat_enc.h" #include "cnst.h" #include "rom_com.h" diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 1723855916a75479e15cd0f3c13b2b9e193aec7c..82436a7dfccfe66ee5927de25526545248d559bd 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -219,7 +219,8 @@ void pre_proc( * NB/WB/SWB/FB bandwidth detector *----------------------------------------------------------------*/ - bw_detect( st, st->input, NULL, enerBuffer ); + bw_detect( st, st->input, NULL, enerBuffer, + 0 ); /*----------------------------------------------------------------* * Noise energy down-ward update and total noise energy estimation @@ -252,9 +253,7 @@ void pre_proc( /*-----------------------------------------------------------------* * Select SID or FRAME_NO_DATA frame if DTX enabled *-----------------------------------------------------------------*/ - dtx( st, -1, vad_flag_dtx, inp_12k8 ); - /*----------------------------------------------------------------* * Adjust FD-CNG Noise Estimator *----------------------------------------------------------------*/ @@ -617,7 +616,7 @@ void pre_proc( st->gamma = GAMMA16k; } - st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode, MCT_CHAN_MODE_REGULAR ); /* TBV: needs checking */ + st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode ); } st->coder_type = st->coder_type_raw; diff --git a/lib_enc/qlpc_stoch.c b/lib_enc/qlpc_stoch.c index 8defb07034305ca3298c61478317cd05da8952fa..31021aee7fc20761b2438e3c2aa68e853979ddaf 100644 --- a/lib_enc/qlpc_stoch.c +++ b/lib_enc/qlpc_stoch.c @@ -103,7 +103,6 @@ void lpc_quantization( /****** Low-rate LPC quantizer *******/ else if ( st->lpcQuantization == 1 ) { - lsp2lsf( lsp, lsf, M, st->sr_core ); force_sf = 0; @@ -122,23 +121,13 @@ void lpc_quantization( if ( st->sr_core == INT_FS_16k && coder_type == UNVOICED ) { - lsf_end_enc( st, lsf, lsf_q, ENDLSF_NBITS, GENERIC, force_sf, param_lpc, no_param_lpc, bits_param_lpc, GENERIC -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , - NULL -#endif - ); + lsf_end_enc( st, lsf, lsf_q, ENDLSF_NBITS, GENERIC, force_sf, param_lpc, no_param_lpc, bits_param_lpc, GENERIC, NULL ); nb_indices = *no_param_lpc; } else { - lsf_end_enc( st, lsf, lsf_q, ENDLSF_NBITS, coder_type, force_sf, param_lpc, no_param_lpc, bits_param_lpc, coder_type -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - , - NULL -#endif - ); + lsf_end_enc( st, lsf, lsf_q, ENDLSF_NBITS, coder_type, force_sf, param_lpc, no_param_lpc, bits_param_lpc, coder_type, NULL ); nb_indices = *no_param_lpc; } diff --git a/lib_enc/rst_enc.c b/lib_enc/rst_enc.c index e069d6d94ee42b919c2bff1fc92068db5d63db34..3a2041875941a62f4e4b09796f49084332c77ad4 100644 --- a/lib_enc/rst_enc.c +++ b/lib_enc/rst_enc.c @@ -84,8 +84,11 @@ void CNG_reset_enc( set_f( voice_factors, 1.0, NB_SUBFR16k ); - /* Reset active frame counter */ - st->hTdCngEnc->act_cnt2 = 0; + if ( st->hTdCngEnc != NULL ) + { + /* Reset active frame counter */ + st->hTdCngEnc->act_cnt2 = 0; + } /* deactivate bass post-filter */ st->bpf_off = 1; diff --git a/lib_enc/speech_music_classif.c b/lib_enc/speech_music_classif.c index cf8568e649db982127b0cd978a935d7f28b97b2f..80bd2d6d2a8cc8aeb9c7d334e13959d824c0736e 100644 --- a/lib_enc/speech_music_classif.c +++ b/lib_enc/speech_music_classif.c @@ -1828,6 +1828,9 @@ void ivas_smc_mode_selection( float ton; int16_t i; float S_p2a, S_max, S_ave; +#ifdef FIX_SP2A + float thr_sp2a; +#endif SP_MUS_CLAS_HANDLE hSpMusClas = st->hSpMusClas; @@ -1858,8 +1861,23 @@ void ivas_smc_mode_selection( S_ave = sum_f( st->hSpMusClas->tod_lt_Bin_E, TOD_NSPEC ) / TOD_NSPEC; S_p2a = S_max - S_ave; +#ifdef FIX_SP2A + if ( element_brate <= IVAS_16k4 ) + { + thr_sp2a = THR_P2A_HIGH; + } + else + { + thr_sp2a = THR_P2A; + } +#endif + /* initial 3-way selection of coding modes (ACELP/GSC/TCX) */ +#ifdef FIX_SP2A + if ( relE > -10.0f && ( S_p2a > thr_sp2a || ton > hSpMusClas->tod_thr_lt ) ) +#else if ( relE > -10.0f && ( S_p2a > THR_P2A || ton > hSpMusClas->tod_thr_lt ) ) +#endif { /* select TCX to encode extremely peaky signals or strongly tonal signals */ st->sp_aud_decision1 = 1; diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c index bdd2483251c6e1b85d64a7abe9704feefa614977..38a0fb73ff28753dcc9b97b21e722cc1cfe3f00f 100644 --- a/lib_enc/swb_tbe_enc.c +++ b/lib_enc/swb_tbe_enc.c @@ -63,7 +63,7 @@ static void return_M_Least( const float *inp, const int16_t n_cols, const float static void singlevectortest_gain( const float *inp, const int16_t dimen, const int16_t cb_size, int16_t *index, const float *weight, float *recon, const float *codebook ); static void determine_gain_weights( const float *gain, float *weights, const int16_t dims ); static void QuantizeSHBsubgains( Encoder_State *st, float *subgains, const int16_t extl ); -static void QuantizeSHBframegain( Encoder_State *st, float *GainFrame, const int16_t extl, const int32_t extl_brate, int16_t *rf_gainFrame_ind, int16_t flag_conservative ); +static void QuantizeSHBframegain( Encoder_State *st, float *GainFrame, const int16_t extl, const int32_t extl_brate, int16_t *rf_gainFrame_ind, const int16_t flag_conservative ); static int16_t closest_centroid( const float *data, const float *weights, const float *quantizer, const int16_t centroids, const int16_t length ); static void EstimateSHBFrameGain( const int16_t length, const float *oriSHB, const float *synSHB, float *subgain, float *GainFrame, const float *win_shb, const float *subwin ); static void EstimateSHBGainShape( const int16_t length, const float *oriSHB, const float *synSHB, float *subgain, const float *subwin ); @@ -429,7 +429,9 @@ void wb_tbe_enc( p2m_in = pow_off_pk_corrected( GainShape, NUM_SHB_SUBFR / 4, 1 ); } else + { p2m_in = pow_off_pk( GainShape, NUM_SHB_SUBFR / 4, 1 ); + } if ( st->extl_brate == WB_TBE_0k35 ) { @@ -452,7 +454,9 @@ void wb_tbe_enc( p2m_out = pow_off_pk_corrected( GainShape, NUM_SHB_SUBFR / 2, 2 ); } else + { p2m_out = pow_off_pk( GainShape, NUM_SHB_SUBFR / 2, 2 ); + } /* Estimate the gain parameter */ EstimateSHBFrameGain( SHB_OVERLAP_LEN / 2, hb_frame, shaped_wb_excitation, GainShape, &GainFrame, window_wb, subwin_wb ); @@ -499,13 +503,11 @@ void wb_tbe_enc( if ( st->rf_mode ) { - QuantizeSHBframegain( st, &GainFrame, st->extl, st->extl_brate, &st->hRF->RF_bwe_gainFr_ind, - 0 ); + QuantizeSHBframegain( st, &GainFrame, st->extl, st->extl_brate, &st->hRF->RF_bwe_gainFr_ind, 0 ); } else { - QuantizeSHBframegain( st, &GainFrame, st->extl, st->extl_brate, NULL, - 0 ); + QuantizeSHBframegain( st, &GainFrame, st->extl, st->extl_brate, NULL, 0 ); } /* Adjust the subframe and frame gain of the synthesized SHB signal */ @@ -581,7 +583,6 @@ void swb_tbe_enc( float sum_gain, normFact; float Env_error_part[NUM_SHB_SUBGAINS]; - Env_error = 0.0f; pitBufAvg = 0.0f; voicingBufAvg = 0.0f; @@ -1196,7 +1197,9 @@ void swb_tbe_enc( p2m_in = pow_off_pk_corrected( GainShape, NUM_SHB_SUBGAINS, 1 ); } else + { p2m_in = pow_off_pk( GainShape, NUM_SHB_SUBGAINS, 1 ); + } /* Quantization of the gain shape parameter */ QuantizeSHBsubgains( st, GainShape, st->extl ); @@ -1207,7 +1210,9 @@ void swb_tbe_enc( p2m_out = pow_off_pk_corrected( GainShape, NUM_SHB_SUBFR, 4 ); } else + { p2m_out = pow_off_pk( GainShape, NUM_SHB_SUBFR, 4 ); + } /* Gain shape smoothing after quantization */ if ( st->extl_brate == SWB_TBE_1k10 || st->extl_brate == SWB_TBE_1k75 ) @@ -1386,13 +1391,11 @@ void swb_tbe_enc( /* Quantization of the frame gain parameter */ if ( st->rf_mode ) { - QuantizeSHBframegain( st, &GainFrame, st->extl, 0, &st->hRF->RF_bwe_gainFr_ind, - 0 ); + QuantizeSHBframegain( st, &GainFrame, st->extl, 0, &st->hRF->RF_bwe_gainFr_ind, 0 ); } else { - QuantizeSHBframegain( st, &GainFrame, st->extl, 0, NULL, - ( st->extl_brate == SWB_TBE_1k10 || st->extl_brate == SWB_TBE_1k75 ) ? 1 : 0 ); + QuantizeSHBframegain( st, &GainFrame, st->extl, 0, NULL, ( st->extl_brate == SWB_TBE_1k10 || st->extl_brate == SWB_TBE_1k75 ) ? 1 : 0 ); } if ( hStereoICBWE != NULL ) @@ -1592,7 +1595,6 @@ static float pow_off_pk( * pow_off_pk_corrected() * * Sums squares of SWB shape gain parameters away from peak values - * VM: !! includes correction of indexing !! *-------------------------------------------------------------------*/ static float pow_off_pk_corrected( @@ -1998,7 +2000,6 @@ static void LVQQuant_BWE_LSF( int16_t i, c2, dim1 = 6; int16_t levels[1], numbits_VQ; - float w[8] = { 5.0f, 5.0f, 2.0f, 2.0f, 2.0f, 1.0f, 1.0f, 1.0f }; float cand[LPC_SHB_ORDER], quant[LPC_SHB_ORDER], e[2], ftmp; const float *cb_stage; @@ -2330,7 +2331,6 @@ static void Quant_shb_ener_sf( ) { int16_t idxSubEner; - float temp_shb_ener_sf, sum; sum = *shb_ener_sf; @@ -2368,6 +2368,7 @@ static void Quant_shb_res_gshape( for ( i = 0; i < NB_SUBFR16k; i++ ) { idxSubGain[i] = usquant( shb_res_gshape[i], &shb_res_gshape[i], 0.125, 0.125f, 1 << NUM_BITS_SHB_RES_GS ); + if ( st->codec_mode == MODE2 ) { st->hBWE_TD->idx_res_gs[i] = idxSubGain[i]; @@ -2393,7 +2394,7 @@ static void QuantizeSHBframegain( const int16_t extl, /* i : extension layer */ const int32_t extl_brate, /* i : extension layer bitrate */ int16_t *rf_gainFrame_ind, - int16_t flag_conservative /* i : flag to indicate more conservative gain quantization */ + const int16_t flag_conservative /* i : flag to indicate more conservative gain quantization */ ) { int16_t idxFrameGain; @@ -2658,7 +2659,6 @@ static void return_M_Least( return; } - /*-------------------------------------------------------------------* * fb_tbe_reset_enc() * @@ -2755,7 +2755,6 @@ void fb_tbe_enc( return; } - /*---------------------------------------------------------------------* * tbe_write_bitstream() * @@ -2835,7 +2834,6 @@ void tbe_write_bitstream( return; } - /*---------------------------------------------------------------------* * TBEreset_enc() * diff --git a/lib_enc/transient_detection.c b/lib_enc/transient_detection.c index 91106686c091fe908b9fd9955a479335c6a42963..1f8b36819f22bfa028814c617b723c4f0760a872 100644 --- a/lib_enc/transient_detection.c +++ b/lib_enc/transient_detection.c @@ -324,86 +324,74 @@ void SetTCXModeInfo( hTcxEnc->tcxMode = NO_TCX; } } - - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) + /* set the left window overlap */ + if ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) + { + st->hTcxCfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; + } + else if ( ( hTcxEnc->tcxMode == TCX_10 ) && ( st->hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ) ) + { + st->hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; + } + else { - hTcxEnc->tcxMode = TCX_20; - *tcxModeOverlap = FULL_OVERLAP; st->hTcxCfg->tcx_last_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; } - - if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE ) + /* determine the right window overlap */ + if ( hTcxEnc->tcxMode == TCX_10 ) { - /* set the left window overlap */ - if ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) + if ( hTranDet->transientDetector.attackIndex < 0 ) { - st->hTcxCfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; - } - else if ( ( hTcxEnc->tcxMode == TCX_10 ) && ( st->hTcxCfg->tcx_curr_overlap_mode == ALDO_WINDOW ) ) - { - st->hTcxCfg->tcx_last_overlap_mode = FULL_OVERLAP; + *tcxModeOverlap = HALF_OVERLAP; } else { - st->hTcxCfg->tcx_last_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; - } - - /* determine the right window overlap */ - if ( hTcxEnc->tcxMode == TCX_10 ) - { - if ( hTranDet->transientDetector.attackIndex < 0 ) - { - *tcxModeOverlap = HALF_OVERLAP; - } - else + *tcxModeOverlap = hTranDet->transientDetector.attackIndex % 4; + if ( *tcxModeOverlap == 1 ) { - *tcxModeOverlap = hTranDet->transientDetector.attackIndex % 4; - if ( *tcxModeOverlap == 1 ) - { - *tcxModeOverlap = FULL_OVERLAP; - } - } - if ( isLongTermTransient( 1.0f / GetTCXAvgTemporalFlatnessMeasure( hTranDet, NSUBBLOCKS, 0 ), &hTcxEnc->tfm_mem ) && st->element_mode == IVAS_CPE_MDCT ) - { - if ( ( *tcxModeOverlap != MIN_OVERLAP ) && ( hTcxEnc->tcxltp_norm_corr_past < 0.5625f ) ) - { - *tcxModeOverlap = HALF_OVERLAP; - } + *tcxModeOverlap = FULL_OVERLAP; } } - else if ( hTcxEnc->tcxMode == TCX_20 ) + if ( isLongTermTransient( 1.0f / GetTCXAvgTemporalFlatnessMeasure( hTranDet, NSUBBLOCKS, 0 ), &hTcxEnc->tfm_mem ) && st->element_mode == IVAS_CPE_MDCT ) { - if ( hTranDet->transientDetector.attackIndex == 7 ) + if ( ( *tcxModeOverlap != MIN_OVERLAP ) && ( hTcxEnc->tcxltp_norm_corr_past < 0.5625f ) ) { *tcxModeOverlap = HALF_OVERLAP; } - else if ( hTranDet->transientDetector.attackIndex == 6 ) - { - *tcxModeOverlap = MIN_OVERLAP; - } - else - { - *tcxModeOverlap = ALDO_WINDOW; - } - if ( isLongTermTransient( 1.0f / GetTCXAvgTemporalFlatnessMeasure( hTranDet, NSUBBLOCKS, 0 ), &hTcxEnc->tfm_mem ) && st->element_mode == IVAS_CPE_MDCT ) - { - if ( ( *tcxModeOverlap != MIN_OVERLAP ) && ( hTcxEnc->tcxltp_norm_corr_past < 0.5625f ) ) - { - *tcxModeOverlap = HALF_OVERLAP; - } - } + } + } + else if ( hTcxEnc->tcxMode == TCX_20 ) + { + if ( hTranDet->transientDetector.attackIndex == 7 ) + { + *tcxModeOverlap = HALF_OVERLAP; + } + else if ( hTranDet->transientDetector.attackIndex == 6 ) + { + *tcxModeOverlap = MIN_OVERLAP; } else { - /* NO_TCX */ - *tcxModeOverlap = TRANSITION_OVERLAP; - if ( st->element_mode == IVAS_CPE_MDCT ) + *tcxModeOverlap = ALDO_WINDOW; + } + if ( isLongTermTransient( 1.0f / GetTCXAvgTemporalFlatnessMeasure( hTranDet, NSUBBLOCKS, 0 ), &hTcxEnc->tfm_mem ) && st->element_mode == IVAS_CPE_MDCT ) + { + if ( ( *tcxModeOverlap != MIN_OVERLAP ) && ( hTcxEnc->tcxltp_norm_corr_past < 0.5625f ) ) { - hTcxEnc->tfm_mem = 0.75f; + *tcxModeOverlap = HALF_OVERLAP; } } } + else + { + /* NO_TCX */ + *tcxModeOverlap = TRANSITION_OVERLAP; + if ( st->element_mode == IVAS_CPE_MDCT ) + { + hTcxEnc->tfm_mem = 0.75f; + } + } /* for the ACELP -> TCX transition frames use full right window overlap */ if ( ( st->hTcxCfg->tcx_last_overlap_mode == TRANSITION_OVERLAP ) && ( *tcxModeOverlap == ALDO_WINDOW ) ) diff --git a/lib_enc/transition_enc.c b/lib_enc/transition_enc.c index ce13d7fa36ecf6e44293c41ba52b8c9f49efd7bf..925a6f1c322e2582ab7e214c0eade34cfbbdf055 100644 --- a/lib_enc/transition_enc.c +++ b/lib_enc/transition_enc.c @@ -178,7 +178,7 @@ void transition_enc( if ( *tc_subfr == TC_0_0 ) { /* this is called only to compute unused bits */ - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } *clip_gain = gp_clip( st->element_mode, st->core_brate, st->voicing, i_subfr, TRANSITION, xn, gp_cl ); @@ -274,7 +274,7 @@ void transition_enc( if ( i_subfr - *tc_subfr <= L_SUBFR ) { - config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); } /*-----------------------------------------------------------------* diff --git a/lib_enc/updt_enc.c b/lib_enc/updt_enc.c index cc2d5fce36637a9b754806d76706c54bb838f73f..6b8c595f5e1ca9b36c3c728a48a6c8711b78772b 100644 --- a/lib_enc/updt_enc.c +++ b/lib_enc/updt_enc.c @@ -408,7 +408,7 @@ void updt_enc_common( st->gamma = GAMMA16k; } - st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode, MCT_CHAN_MODE_REGULAR ); + st->igf = getIgfPresent( EVS_MONO, st->total_brate, st->bwidth, st->rf_mode ); } /* update FER clas */ diff --git a/lib_rend/ivas_allrad_dec.c b/lib_rend/ivas_allrad_dec.c index ada7c2c6d106d00933248de425db7b2afb02b20b..fc840755aac643e05fd0fc9f514ab29373433b7e 100644 --- a/lib_rend/ivas_allrad_dec.c +++ b/lib_rend/ivas_allrad_dec.c @@ -31,14 +31,12 @@ *******************************************************************************************************/ #include +#include "options.h" #include #include -#include -#include -#include "options.h" #include "prot.h" #include "ivas_prot.h" -#include "ivas_stat_dec.h" +#include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_rend/ivas_binaural_reverb.c b/lib_rend/ivas_binaural_reverb.c deleted file mode 100644 index 3d4c9d6fe2626565c0a9e131c3fedac9496389ae..0000000000000000000000000000000000000000 --- a/lib_rend/ivas_binaural_reverb.c +++ /dev/null @@ -1,569 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2023 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. - -*******************************************************************************************************/ - -#include -#include "options.h" -#include -#include "ivas_prot.h" -#include "prot.h" -#include "ivas_rom_com.h" -#include "ivas_rom_binauralRenderer.h" -#ifdef DEBUGGING -#include "debug.h" -#endif -#include "wmc_auto.h" - - -/* The reverberator structure implemented here is described in detail in: - * Vilkamo, J., Neugebauer, B., & Plogsties, J. (2012). Sparse frequency-domain reverberator. - * Journal of the Audio Engineering Society, 59(12), 936-943. */ - -/*------------------------------------------------------------------------- - * Local constants - *------------------------------------------------------------------------*/ - -#define BIN_REND_RANDOM_SEED 1 /* random seed for generating reverb decorrelators */ - -#define CLDFB_SLOTS_PER_SECOND 800 /* Used for initializing reverb */ - -/*------------------------------------------------------------------------- - * ivas_binaural_reverb_processFrame() - * - * Compute the reverberation - room effect - *------------------------------------------------------------------------*/ - -void ivas_binaural_reverb_processFrame( - REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ - const int16_t numInChannels, /* i : num inputs to be processed */ - float inReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ - float inImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ - float outReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ - float outImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data imag */ - const uint8_t offsetSamplesIO /* i : number of offset samples */ -) -{ - /* Declare the required variables */ - int16_t idx, bin, ch, sample, invertSampleIndex, tapIdx, *phaseShiftTypePr; - float **tapRealPr, **tapImagPr; - - /* 1) Rotate the data in the loop buffer of the reverberator. - * Notice that the audio at the loop buffers is at time-inverted order - * for convolution purposes later on. */ - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ - mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); - mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); - - /* Add the data from the end of the loop to the beginning, with an attenuation factor - * according to RT60. This procedure generates an IIR decaying response. The response - * is decorrelated later on. */ - v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], hReverb->blockSize ); - v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], hReverb->blockSize ); - } - - /* 2) Apply the determined pre-delay to the input audio, and add the delayed audio to the loop. */ - idx = hReverb->preDelayBufferIndex; - for ( sample = 0; sample < hReverb->blockSize; sample++ ) - { - uint16_t sampleWithOffset; - sampleWithOffset = sample + offsetSamplesIO; - invertSampleIndex = hReverb->blockSize - sample - 1; - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - /* Add from pre-delay buffer a sample to the loop buffer, in a time-inverted order. - * Also apply the spectral gains determined for the reverberation */ - hReverb->loopBufReal[bin][invertSampleIndex] += hReverb->preDelayBufferReal[idx][bin] * hReverb->reverbEqGains[bin]; - hReverb->loopBufImag[bin][invertSampleIndex] += hReverb->preDelayBufferImag[idx][bin] * hReverb->reverbEqGains[bin]; - hReverb->preDelayBufferReal[idx][bin] = 0.0f; - hReverb->preDelayBufferImag[idx][bin] = 0.0f; - } - - /* Add every second input channel as is to the pre-delay buffer, and every second input channel with - * 90 degrees phase shift to reduce energy imbalances between coherent and incoherent sounds */ - for ( ch = 0; ch < numInChannels; ch++ ) - { - if ( ch % 2 ) - { - v_add( hReverb->preDelayBufferReal[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); - v_add( hReverb->preDelayBufferImag[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); - } - else - { - v_sub( hReverb->preDelayBufferReal[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); - v_add( hReverb->preDelayBufferImag[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); - } - } - idx = ( idx + 1 ) % hReverb->preDelayBufferLength; - } - hReverb->preDelayBufferIndex = idx; - - /* 3) Perform the filtering/decorrelating, using complex and sparse FIR filtering */ - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - /* These tap pointers have been determined to point to the loop buffer at sparse locations */ - tapRealPr = hReverb->tapPointersReal[bin][ch]; - tapImagPr = hReverb->tapPointersImag[bin][ch]; - phaseShiftTypePr = hReverb->tapPhaseShiftType[bin][ch]; - - /* Flush output */ - set_f( hReverb->outputBufferReal[bin][ch], 0.0f, hReverb->blockSize ); - set_f( hReverb->outputBufferImag[bin][ch], 0.0f, hReverb->blockSize ); - - /* Add from temporally decaying sparse tap locations the audio to the output. */ - for ( tapIdx = 0; tapIdx < hReverb->taps[bin][ch]; tapIdx++ ) - { - switch ( phaseShiftTypePr[tapIdx] ) - { - case 0: /* 0 degrees phase */ - v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - case 1: /* 90 degrees phase */ - v_sub( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_add( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - case 2: /* 180 degrees phase */ - v_sub( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_sub( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - default: /* 270 degrees phase */ - v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - } - } - } - - /* Generate diffuse field binaural coherence by mixing the incoherent reverberated channels with pre-defined gains */ - if ( bin <= hReverb->highestBinauralCoherenceBin ) - { - if ( hReverb->useBinauralCoherence ) - { - for ( sample = 0; sample < hReverb->blockSize; sample++ ) - { - float leftRe, rightRe, leftIm, rightIm; - - leftRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][1][sample]; - rightRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][0][sample]; - leftIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][1][sample]; - rightIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][0][sample]; - - hReverb->outputBufferReal[bin][0][sample] = leftRe; - hReverb->outputBufferReal[bin][1][sample] = rightRe; - hReverb->outputBufferImag[bin][0][sample] = leftIm; - hReverb->outputBufferImag[bin][1][sample] = rightIm; - } - } - } - } - - /* 4) Write data to output */ - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - for ( sample = 0; sample < hReverb->blockSize; sample++ ) - { - uint16_t sampleWithOffset; - - sampleWithOffset = sample + offsetSamplesIO; - /* Audio was in the temporally inverted order for convolution, re-invert audio to output */ - invertSampleIndex = hReverb->blockSize - sample - 1; - - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - outReal[ch][sampleWithOffset][bin] = hReverb->outputBufferReal[bin][ch][invertSampleIndex]; - outImag[ch][sampleWithOffset][bin] = hReverb->outputBufferImag[bin][ch][invertSampleIndex]; - } - for ( ; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) - { - outReal[ch][sampleWithOffset][bin] = 0.0f; - outImag[ch][sampleWithOffset][bin] = 0.0f; - } - } - } - - return; -} - - -/*------------------------------------------------------------------------- - * binRend_rand() - * - * - *------------------------------------------------------------------------*/ - -static uint16_t binRend_rand( - REVERB_STRUCT_HANDLE hReverb /* i/o: binaural reverb handle */ -) -{ - hReverb->binRend_RandNext = hReverb->binRend_RandNext * 1103515245 + 12345; - - return (uint16_t) ( hReverb->binRend_RandNext / 65536 ) % 32768; -} - - -/*------------------------------------------------------------------------- - * ivas_binaural_reverb_setPreDelay() - * - * - *------------------------------------------------------------------------*/ - -void ivas_binaural_reverb_setPreDelay( - REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ - const int16_t delaySamples /* i : reverb pre-delay in CLDFB slots */ -) -{ - if ( delaySamples < 1 ) - { - hReverb->preDelayBufferLength = 1; - - return; - } - - if ( delaySamples > REVERB_PREDELAY_MAX ) - { - hReverb->preDelayBufferLength = REVERB_PREDELAY_MAX; - - return; - } - - hReverb->preDelayBufferLength = delaySamples; - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_binaural_reverb_setReverbTimes() - * - * - *------------------------------------------------------------------------*/ - -void ivas_binaural_reverb_setReverbTimes( - REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ - const int32_t output_Fs, /* i : sampling_rate */ - const float *revTimes, /* i : reverberation times T60 for each CLDFB bin in seconds */ - const float *revEnes /* i : spectrum for reverberated sound at each CLDFB bin */ -) -{ - int16_t bin, ch, tap, sample; - float binCenterFreq, diffuseFieldICC, tmpVal, attenuationFactorPerSample; - float intendedEnergy, actualizedEnergy, energyBuildup, currentEnergy, attenuationFactorPerSampleSq; - - hReverb->binRend_RandNext = (uint16_t) BIN_REND_RANDOM_SEED; - hReverb->highestBinauralCoherenceBin = 0; - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - /* Determine the diffuse field binaural coherence */ - binCenterFreq = ( (float) bin + 0.5f ) / ( (float) hReverb->numBins ) * ( (float) output_Fs ) / 2.0f; - if ( bin == 0 ) - { - diffuseFieldICC = 1.0f; - } - else if ( binCenterFreq < 2700.0f ) - { - diffuseFieldICC = sinf( EVS_PI * binCenterFreq / 550.0f + 1e-20f ) / ( EVS_PI * binCenterFreq / 550.0f + 1e-20f ) * ( 1.0f - binCenterFreq / 2700.0f ); - hReverb->highestBinauralCoherenceBin = bin; - } - else - { - diffuseFieldICC = 0.0f; - } - - /* Mixing gains to generate a diffuse-binaural sound based on incoherent sound */ - tmpVal = ( 1.0f - sqrtf( 1.0f - powf( diffuseFieldICC, 2.0 ) ) ) / 2.0f; - if ( diffuseFieldICC > 0 ) - { - hReverb->binauralCoherenceCrossmixGains[bin] = sqrtf( fabsf( tmpVal ) ); - } - else - { - hReverb->binauralCoherenceCrossmixGains[bin] = -sqrtf( fabsf( tmpVal ) ); - } - hReverb->binauralCoherenceDirectGains[bin] = sqrtf( 1.0f - fabsf( tmpVal ) ); - - /* Determine attenuation factor that generates the appropriate energy decay according to reverberation time */ - attenuationFactorPerSample = powf( 10.0f, -3.0f * ( 1.0f / ( (float) CLDFB_SLOTS_PER_SECOND * revTimes[bin] ) ) ); - hReverb->loopAttenuationFactor[bin] = powf( attenuationFactorPerSample, hReverb->loopBufLength[bin] ); - attenuationFactorPerSampleSq = attenuationFactorPerSample * attenuationFactorPerSample; - - /* Design sparse decorrelation filters. The decorrelation filters, due to random procedures involved, - * may affect the spectrum of the output. The spectral effect is therefore monitored and compensated for. */ - intendedEnergy = 0.0f; - actualizedEnergy = 0.0f; - - for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) - { - energyBuildup = 0.0f; - currentEnergy = 1.0f; - tap = 0; - - for ( sample = 0; sample < hReverb->loopBufLength[bin]; sample++ ) - { - intendedEnergy += currentEnergy; - - /* The randomization at the energy build up affects where the sparse taps are located */ - energyBuildup += currentEnergy + 0.1f * ( (float) binRend_rand( hReverb ) / PCM16_TO_FLT_FAC - 0.5f ); - - if ( energyBuildup >= 1.0f ) /* A new filter tap is added at this condition */ - { - /* Four efficient phase operations: n*pi/2, n=0,1,2,3 */ - hReverb->tapPhaseShiftType[bin][ch][tap] = (int16_t) ( binRend_rand( hReverb ) % 4 ); - /* Set the tapPointer to point to the determined sample at the loop buffer */ - hReverb->tapPointersReal[bin][ch][tap] = &( hReverb->loopBufReal[bin][sample] ); - hReverb->tapPointersImag[bin][ch][tap] = &( hReverb->loopBufImag[bin][sample] ); - energyBuildup -= 1.0f; /* A tap is added, thus remove its energy from the buildup */ - tap++; - actualizedEnergy += 1.0f; - } - currentEnergy *= attenuationFactorPerSampleSq; - } - hReverb->taps[bin][ch] = tap; /* Number of taps determined at the above random procedure */ - } - - /* The decorrelator design and IIR attenuation rate affects the energy of reverb, which is compensated here */ - hReverb->reverbEqGains[bin] = sqrtf( revEnes[bin] ); /* Determined reverb spectrum */ - hReverb->reverbEqGains[bin] *= sqrtf( intendedEnergy / actualizedEnergy ); /* Correction of random effects at the decorrelator design */ - hReverb->reverbEqGains[bin] *= sqrtf( 0.5f * ( 1.0f - attenuationFactorPerSampleSq ) ); /* Correction of IIR decay rate */ - } - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_binaural_reverb_open() - * - * Allocate and initialize binaural room reverberator handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_binaural_reverb_open( - REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ - const int16_t numBins, /* i : number of CLDFB bins */ - const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ - ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ - const AUDIO_CONFIG output_config, /* i : output audio configuration */ - const int32_t sampling_rate, /* i : sampling rate */ - const RENDERER_TYPE renderer_type /* i : renderer type */ -#ifdef HRTF_BINARY_FILE - , - const HRTFS_FASTCONV_HANDLE hHrtfFastConv, /* i : FastConv HRTF handle */ - const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ -#endif -) -{ - int16_t bin, chIdx, k, len; - REVERB_STRUCT_HANDLE hReverb; - const float *revTimes; - float t60[CLDFB_NO_CHANNELS_MAX]; - float ene[CLDFB_NO_CHANNELS_MAX]; - - if ( ( *hReverbPr = (REVERB_STRUCT_HANDLE) malloc( sizeof( REVERB_STRUCT ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); - } - - hReverb = *hReverbPr; - - hReverb->useBinauralCoherence = 1; - hReverb->preDelayBufferLength = 1; - hReverb->preDelayBufferIndex = 0; - - hReverb->numBins = numBins; - hReverb->blockSize = numCldfbSlotsPerFrame; - - for ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) - { - set_f( hReverb->preDelayBufferReal[k], 0.0f, hReverb->numBins ); - set_f( hReverb->preDelayBufferImag[k], 0.0f, hReverb->numBins ); - } - - if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - if ( !roomAcoustics->override ) - { -#ifdef HRTF_BINARY_FILE - revTimes = hHrtfFastConv->fastconvReverberationTimes; -#else - revTimes = fastconvReverberationTimes; -#endif - } - else - { - revTimes = t60; - } - } - else - { -#ifdef HRTF_BINARY_FILE - revTimes = hHrtfParambin->parametricReverberationTimes; -#else - revTimes = parametricReverberationTimes; -#endif - } - - for ( bin = 0; bin < hReverb->numBins; bin++ ) - { - /* Loop Buffer */ - hReverb->loopBufLengthMax[bin] = (int16_t) ( 500 / ( 1 + bin ) + ( CLDFB_NO_CHANNELS_MAX - bin ) ); - - len = hReverb->loopBufLengthMax[bin] + hReverb->blockSize; - if ( ( hReverb->loopBufReal[bin] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); - } - - if ( ( hReverb->loopBufImag[bin] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); - } - - set_f( hReverb->loopBufReal[bin], 0.0f, len ); - set_f( hReverb->loopBufImag[bin], 0.0f, len ); - - /* Determine loop buffer length. The following formula is manually tuned to generate sufficiently long - * but not excessively long loops to generate reverberation. */ - /* Note: the resulted length is very sensitive to the precision of the constants below (e.g. 1.45 vs. 1.45f) */ - hReverb->loopBufLength[bin] = (int16_t) ( 1.45 * (int16_t) ( revTimes[bin] * 150.0 ) + 1 ); - hReverb->loopBufLength[bin] = min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); - - /* Sparse Filter Tap Locations */ - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - len = hReverb->loopBufLength[bin]; - - if ( ( hReverb->tapPhaseShiftType[bin][chIdx] = (int16_t *) malloc( len * sizeof( int16_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); - } - set_s( hReverb->tapPhaseShiftType[bin][chIdx], 0, len ); - - if ( ( hReverb->tapPointersReal[bin][chIdx] = (float **) malloc( len * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); - } - - if ( ( hReverb->tapPointersImag[bin][chIdx] = (float **) malloc( len * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); - } - - len = hReverb->blockSize; - if ( ( hReverb->outputBufferReal[bin][chIdx] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); - } - - if ( ( hReverb->outputBufferImag[bin][chIdx] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); - } - - set_f( hReverb->outputBufferReal[bin][chIdx], 0.0f, len ); - set_f( hReverb->outputBufferImag[bin][chIdx], 0.0f, len ); - } - } - - if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - if ( !roomAcoustics->override ) - { -#ifdef HRTF_BINARY_FILE - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfFastConv->fastconvReverberationTimes, hHrtfFastConv->fastconvReverberationEneCorrections ); -#else - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, fastconvReverberationTimes, fastconvReverberationEneCorrections ); -#endif - ivas_binaural_reverb_setPreDelay( hReverb, 10 ); - } - else - { -#ifdef HRTF_BINARY_FILE - ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); -#else - ivas_reverb_prepare_cldfb_params( roomAcoustics, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); -#endif - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, t60, ene ); - ivas_binaural_reverb_setPreDelay( hReverb, (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ) ); - } - } - else - { -#ifdef HRTF_BINARY_FILE - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfParambin->parametricReverberationTimes, hHrtfParambin->parametricReverberationEneCorrections ); -#else - ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, parametricReverberationTimes, parametricReverberationEneCorrections ); -#endif - ivas_binaural_reverb_setPreDelay( hReverb, 10 ); - } - - return IVAS_ERR_OK; -} - - -/*------------------------------------------------------------------------- - * ivas_binaural_reverb_close() - * - * Close binaural room reverberator handle - *------------------------------------------------------------------------*/ - -void ivas_binaural_reverb_close( - REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ -) -{ - int16_t bin, chIdx; - - if ( hReverb == NULL || *hReverb == NULL ) - { - return; - } - - for ( bin = 0; bin < ( *hReverb )->numBins; bin++ ) - { - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - free( ( *hReverb )->tapPhaseShiftType[bin][chIdx] ); - free( ( *hReverb )->tapPointersReal[bin][chIdx] ); - free( ( *hReverb )->tapPointersImag[bin][chIdx] ); - free( ( *hReverb )->outputBufferReal[bin][chIdx] ); - free( ( *hReverb )->outputBufferImag[bin][chIdx] ); - } - free( ( *hReverb )->loopBufReal[bin] ); - free( ( *hReverb )->loopBufImag[bin] ); - } - - free( ( *hReverb ) ); - ( *hReverb ) = NULL; - - return; -} diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index cf29f0c98852865f657bc0f51e2cfcab4eda0976..a7572aea3fe8d0e2bd0663d981ce9e67d6e9f01b 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -34,1431 +34,118 @@ #include "options.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" -#include "ivas_stat_dec.h" #include #include "ivas_rom_binaural_crend_head.h" -#ifdef FIX_197_CREND_INTERFACE #include "ivas_stat_rend.h" #include "lib_rend.h" -#else -#include "lib_rend.h" -#include "ivas_lib_rend_internal.h" -#endif #ifdef DEBUGGING #include "debug.h" #endif -#include "wmc_auto.h" - - -/*------------------------------------------------------------------------- - * ivas_hrtf_init() - * - * Initialize hHrtf handle - *------------------------------------------------------------------------*/ - -static ivas_error ivas_hrtf_init( - HRTFS_DATA *hHrtf /* i/o: HRTF handle */ -) -{ - int16_t i, j; - - if ( hHrtf == NULL ) - { - return IVAS_ERR_WRONG_PARAMS; - } - - hHrtf->latency_s = 0; - hHrtf->max_num_ir = 0; - hHrtf->max_num_iterations = 0; - hHrtf->gain_lfe = 0; - hHrtf->index_frequency_max_diffuse = 0; - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - hHrtf->inv_diffuse_weight[i] = 0; - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = 0; - hHrtf->pIndex_frequency_max[i][j] = NULL; - hHrtf->pOut_to_bin_re[i][j] = NULL; - hHrtf->pOut_to_bin_im[i][j] = NULL; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = 0; - hHrtf->pIndex_frequency_max_diffuse[j] = NULL; - hHrtf->pOut_to_bin_diffuse_re[j] = NULL; - hHrtf->pOut_to_bin_diffuse_im[j] = NULL; - } - - return IVAS_ERR_OK; -} - - -/*------------------------------------------------------------------------- - * ivas_hrtf_open() - * - * Open hHrtf handle - *------------------------------------------------------------------------*/ - -static ivas_error ivas_hrtf_open( - HRTFS_HANDLE *hHrtf_out /* o : HRTF handle */ -) -{ - HRTFS_HANDLE hHrtf; - - if ( *hHrtf_out == NULL ) - { - if ( ( hHrtf = (HRTFS_HANDLE) malloc( sizeof( HRTFS_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder\n" ); - } - - ivas_hrtf_init( hHrtf ); - - *hHrtf_out = hHrtf; - } - else - { - return IVAS_ERR_INTERNAL; - } - - return ( IVAS_ERR_OK ); -} - - -/*------------------------------------------------------------------------- - * ivas_hrtf_close() - * - * Close hHrtf handle - *------------------------------------------------------------------------*/ - -static ivas_error ivas_hrtf_close( - HRTFS_HANDLE *hHrtf /* i/o: HRTF handle */ -) -{ - if ( *hHrtf == NULL || hHrtf == NULL ) - { - return IVAS_ERR_WRONG_PARAMS; - } - - free( *hHrtf ); - *hHrtf = NULL; - - return IVAS_ERR_OK; -} - - -#ifndef FIX_197_CREND_INTERFACE -/*------------------------------------------------------------------------- - * ivas_crend_init_from_rom() - * - * Allocate and initialize crend renderer handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_init_from_rom( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - int16_t i, j, tmp; - int32_t output_Fs; - AUDIO_CONFIG intern_config; - HRTFS_HANDLE hHrtf; - -#ifdef FIX_197_CREND_INTERFACE - hHrtf = st_ivas->hCrendWrapper->hHrtfCrend; -#else - hHrtf = st_ivas->hHrtf; -#endif - - output_Fs = st_ivas->hDecoderConfig->output_Fs; - - intern_config = st_ivas->intern_config; - - if ( intern_config == AUDIO_CONFIG_BINAURAL || intern_config == AUDIO_CONFIG_BINAURAL_ROOM ) - { - return IVAS_ERR_INTERNAL_FATAL; - } - - if ( hHrtf == NULL ) - { - if ( ivas_hrtf_open( &hHrtf ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for HRTF handle" ); - } - } - - hHrtf->max_num_ir = audioCfg2channels( intern_config ); - - if ( hHrtf->max_num_ir <= 0 ) - { - return IVAS_ERR_INTERNAL_FATAL; - } - - /* Do all error checks up front so that the nested if later is easier */ - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported renderer type" ); - } - - if ( intern_config != AUDIO_CONFIG_5_1 && intern_config != AUDIO_CONFIG_5_1_2 && intern_config != AUDIO_CONFIG_5_1_4 && - intern_config != AUDIO_CONFIG_7_1 && intern_config != AUDIO_CONFIG_7_1_4 && - intern_config != AUDIO_CONFIG_FOA && intern_config != AUDIO_CONFIG_HOA2 && intern_config != AUDIO_CONFIG_HOA3 ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported transport config in Crend" ); - } - - if ( ( ( st_ivas->hRenderConfig != NULL ) && !st_ivas->hRenderConfig->roomAcoustics.use_brir ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV ) ) - { - if ( intern_config == AUDIO_CONFIG_5_1 || intern_config == AUDIO_CONFIG_5_1_2 || intern_config == AUDIO_CONFIG_5_1_4 || - intern_config == AUDIO_CONFIG_7_1 || intern_config == AUDIO_CONFIG_7_1_4 ) - { - hHrtf->max_num_ir -= 1; /* subtract LFE */ - hHrtf->gain_lfe = GAIN_LFE; - - if ( output_Fs == 48000 ) - { - hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_48kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz[j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_32kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz[j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_16kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz[j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - if ( intern_config == AUDIO_CONFIG_5_1 ) - { - tmp = channelIndex_CICP6[i]; - } - else if ( intern_config == AUDIO_CONFIG_7_1 ) - { - tmp = channelIndex_CICP12[i]; - } - else if ( intern_config == AUDIO_CONFIG_5_1_2 ) - { - tmp = channelIndex_CICP14[i]; - } - else if ( intern_config == AUDIO_CONFIG_5_1_4 ) - { - tmp = channelIndex_CICP16[i]; - } - else if ( intern_config == AUDIO_CONFIG_7_1_4 ) - { - tmp = channelIndex_CICP19[i]; - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" ); - } - - if ( output_Fs == 48000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_48kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_48kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_48kHz[tmp][j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_32kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_32kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_32kHz[tmp][j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_16kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_16kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_16kHz[tmp][j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - } - } - else if ( intern_config == AUDIO_CONFIG_FOA || intern_config == AUDIO_CONFIG_HOA2 || intern_config == AUDIO_CONFIG_HOA3 ) - { - if ( output_Fs == 48000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_48kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_48kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_48kHz[i][j]; - } - } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_32kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_32kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_32kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz[j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_16kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_16kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_16kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - } - } - else if ( ( ( st_ivas->hRenderConfig != NULL ) && st_ivas->hRenderConfig->roomAcoustics.use_brir ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) - { - if ( intern_config == AUDIO_CONFIG_5_1 || intern_config == AUDIO_CONFIG_5_1_2 || intern_config == AUDIO_CONFIG_5_1_4 || - intern_config == AUDIO_CONFIG_7_1 || intern_config == AUDIO_CONFIG_7_1_4 ) - { - hHrtf->max_num_ir -= 1; /* subtract LFE */ - hHrtf->gain_lfe = GAIN_LFE; - - if ( output_Fs == 48000 ) - { - hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_48kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz[j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_32kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz[j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_16kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz[j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - if ( intern_config == AUDIO_CONFIG_5_1 ) - { - tmp = channelIndex_CICP6[i]; - } - else if ( intern_config == AUDIO_CONFIG_7_1 ) - { - tmp = channelIndex_CICP12[i]; - } - else if ( intern_config == AUDIO_CONFIG_5_1_2 ) - { - tmp = channelIndex_CICP14[i]; - } - else if ( intern_config == AUDIO_CONFIG_5_1_4 ) - { - tmp = channelIndex_CICP16[i]; - } - else if ( intern_config == AUDIO_CONFIG_7_1_4 ) - { - tmp = channelIndex_CICP19[i]; - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" ); - } - - if ( output_Fs == 48000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_48kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_48kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_48kHz[tmp][j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_32kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_32kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_32kHz[tmp][j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[tmp]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_16kHz[tmp][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[tmp][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_16kHz[tmp][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_16kHz[tmp][j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - } - } - else if ( intern_config == AUDIO_CONFIG_FOA || intern_config == AUDIO_CONFIG_HOA2 || intern_config == AUDIO_CONFIG_HOA3 ) - { - if ( output_Fs == 48000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_48kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_48kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_48kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[j]; - } - } - else if ( output_Fs == 32000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_32kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_32kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_32kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz[j]; - } - } - else if ( output_Fs == 16000 ) - { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; - - hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_16kHz; - hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[i]; - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_16kHz[i][j]; - hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[i][j]; - hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_16kHz[i][j]; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[j]; - hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[j]; - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported intern_config type in Crend" ); - } - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported renderer type in Crend" ); - } - -#ifdef FIX_197_CREND_INTERFACE - st_ivas->hCrendWrapper->hHrtfCrend = hHrtf; -#else - st_ivas->hHrtf = hHrtf; -#endif - - return IVAS_ERR_OK; -} -#endif - -#ifndef FIX_197_CREND_INTERFACE -#ifdef HRTF_BINARY_FILE -/*------------------------------------------------------------------------- - * ivas_crend_init_from_hrtf_handle() - * - * Allocate and initialize Crend HRTF handle from external file - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_init_from_hrtf_handle( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - HRTFS_HANDLE hrtf ) -{ - int16_t i, j, as_lfe_filter; - const int16_t *hchannelIndex = NULL; - AUDIO_CONFIG transport_config; - - if ( st_ivas == NULL ) - { - return IVAS_ERR_INTERNAL; - } - - if ( hrtf == NULL ) - { - return IVAS_ERR_INVALID_HRTF; - } - - if ( st_ivas->hHrtf != NULL ) - { - ivas_hrtf_close( &st_ivas->hHrtf ); - } - - if ( ivas_hrtf_open( &( st_ivas->hHrtf ) ) != IVAS_ERR_OK ) - { - return IVAS_ERR_INTERNAL; - } - - if ( st_ivas->hHrtf != NULL ) - { - st_ivas->hHrtf->latency_s = hrtf->latency_s; - // st_ivas->hHrtf->max_num_ir->max_ir_len = hrtf->max_ir_len; - st_ivas->hHrtf->max_num_iterations = hrtf->max_num_iterations; - st_ivas->hHrtf->gain_lfe = hrtf->gain_lfe; - // st_ivas->hHrtf->crend_hr_gain_foa_to_bin = hrtf->crend_hr_gain_foa_to_bin; - st_ivas->hHrtf->max_num_ir = 0; - st_ivas->hIntSetup.nchan_out_woLFE = 0; - st_ivas->hIntSetup.num_lfe = 0; - st_ivas->hIntSetup.nchan_out_woLFE = 0; - - transport_config = st_ivas->intern_config == AUDIO_CONFIG_INVALID ? st_ivas->transport_config : st_ivas->intern_config; - - switch ( transport_config ) - { - case AUDIO_CONFIG_5_1: - st_ivas->hHrtf->max_num_ir = 5; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP6; - break; - case AUDIO_CONFIG_7_1: - st_ivas->hHrtf->max_num_ir = 7; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP12; - break; - case AUDIO_CONFIG_5_1_2: - st_ivas->hHrtf->max_num_ir = 7; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP14; - break; - case AUDIO_CONFIG_5_1_4: - st_ivas->hHrtf->max_num_ir = 9; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP16; - break; - case AUDIO_CONFIG_7_1_4: - st_ivas->hHrtf->max_num_ir = 11; - st_ivas->hHrtf->gain_lfe = GAIN_LFE; - st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->hHrtf->max_num_ir; - st_ivas->hIntSetup.num_lfe = 1; - hchannelIndex = (const int16_t *) &channelIndex_CICP19; - break; - case AUDIO_CONFIG_FOA: - st_ivas->hIntSetup.ambisonics_order = 1; - st_ivas->hHrtf->max_num_ir = 4; - break; - case AUDIO_CONFIG_HOA2: - st_ivas->hIntSetup.ambisonics_order = 2; - st_ivas->hHrtf->max_num_ir = 9; - break; - case AUDIO_CONFIG_HOA3: - st_ivas->hIntSetup.ambisonics_order = 3; - st_ivas->hHrtf->max_num_ir = 16; - break; - default: - break; - } - - as_lfe_filter = 0; - if ( ( st_ivas->hHrtf->max_num_ir != hrtf->max_num_ir ) && ( st_ivas->hHrtf->max_num_ir + 1 == hrtf->max_num_ir ) ) - { - as_lfe_filter = 1; - hchannelIndex = NULL; - } - - if ( st_ivas->hHrtf->max_num_ir == 0 ) - { - return IVAS_ERR_INTERNAL; - } - - for ( i = 0; i < st_ivas->hHrtf->max_num_ir; i++ ) - { - int16_t tmp = i; - if ( hchannelIndex != NULL ) - { - tmp = hchannelIndex[i]; - } - if ( as_lfe_filter ) - { - if ( tmp > 2 ) - { - tmp++; - } - } - - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - st_ivas->hHrtf->pOut_to_bin_re[i][j] = hrtf->pOut_to_bin_re[tmp][j]; - st_ivas->hHrtf->pOut_to_bin_im[i][j] = hrtf->pOut_to_bin_im[tmp][j]; - st_ivas->hHrtf->num_iterations[i][j] = hrtf->num_iterations[tmp][j]; - st_ivas->hHrtf->pIndex_frequency_max[i][j] = hrtf->pIndex_frequency_max[tmp][j]; - } - st_ivas->hHrtf->inv_diffuse_weight[i] = hrtf->inv_diffuse_weight[tmp]; - } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - st_ivas->hHrtf->pOut_to_bin_diffuse_re[j] = hrtf->pOut_to_bin_diffuse_re[j]; - st_ivas->hHrtf->pOut_to_bin_diffuse_im[j] = hrtf->pOut_to_bin_diffuse_im[j]; - st_ivas->hHrtf->num_iterations_diffuse[j] = hrtf->num_iterations_diffuse[j]; - st_ivas->hHrtf->pIndex_frequency_max_diffuse[j] = hrtf->pIndex_frequency_max_diffuse[j]; - } - st_ivas->hHrtf->index_frequency_max_diffuse = hrtf->index_frequency_max_diffuse; - } - return IVAS_ERR_OK; -} -#endif - -#ifdef HRTF_BINARY_FILE -/*------------------------------------------------------------------------- - * ivas_crend_init_from_setofhrtf() - * - * Allocate and initialize crend renderer handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_init_from_setofhrtf( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - ivas_error error; - AUDIO_CONFIG transport_config; - - transport_config = st_ivas->intern_config == AUDIO_CONFIG_INVALID ? st_ivas->transport_config : st_ivas->intern_config; - switch ( transport_config ) - { - case AUDIO_CONFIG_5_1: - case AUDIO_CONFIG_5_1_2: - case AUDIO_CONFIG_5_1_4: - case AUDIO_CONFIG_7_1: - case AUDIO_CONFIG_7_1_4: - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - if ( ( error = ivas_crend_init_from_hrtf_handle( st_ivas, st_ivas->hSetOfHRTF->hHRTF_brir_combined ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = ivas_crend_init_from_hrtf_handle( st_ivas, st_ivas->hSetOfHRTF->hHRTF_hrir_combined ) ) != IVAS_ERR_OK ) - { - return error; - } - } - break; - case AUDIO_CONFIG_FOA: - case AUDIO_CONFIG_HOA2: - case AUDIO_CONFIG_HOA3: - if ( ( error = ivas_crend_init_from_hrtf_handle( st_ivas, st_ivas->hSetOfHRTF->hHRTF_hrir_hoa3 ) ) != IVAS_ERR_OK ) - { - return error; - } - break; - default: - return IVAS_ERR_INTERNAL; - } - - return IVAS_ERR_OK; -} - -#endif -#endif - -/*---------------------------------------------------------------------* - * destroy_HRTF() - * - * Destroy the HRTF CRend handle - *---------------------------------------------------------------------*/ - -static ivas_error destroy_HRTF( - HRTFS_HANDLE *hHRTF /* i/o: HRTF CRend handle */ -) -{ - uint16_t i, j; - - if ( *hHRTF != NULL && hHRTF != NULL ) - { - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - if ( ( *hHRTF )->pIndex_frequency_max[i][j] != NULL ) - { - free( ( *hHRTF )->pIndex_frequency_max[i][j] ); - } - if ( ( *hHRTF )->pOut_to_bin_re[i][j] != NULL ) - { - free( ( *hHRTF )->pOut_to_bin_re[i][j] ); - } - if ( ( *hHRTF )->pOut_to_bin_im[i][j] != NULL ) - { - free( ( *hHRTF )->pOut_to_bin_im[i][j] ); - } - } - } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] != NULL ) - { - free( ( *hHRTF )->pIndex_frequency_max_diffuse[j] ); - } - if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] != NULL ) - { - free( ( *hHRTF )->pOut_to_bin_diffuse_re[j] ); - } - if ( ( *hHRTF )->pOut_to_bin_diffuse_im[j] != NULL ) - { - free( ( *hHRTF )->pOut_to_bin_diffuse_im[j] ); - } - } - - free( *hHRTF ); - *hHRTF = NULL; - } - - return IVAS_ERR_OK; -} - -#ifdef HRTF_BINARY_FILE -/*---------------------------------------------------------------------* - * destroy_SetOfHRTF() - * - * Destroy the HRTF data set. - *---------------------------------------------------------------------*/ - -ivas_error destroy_SetOfHRTF( - HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ -) -{ - if ( hSetOfHRTF != NULL ) - { - destroy_HRTF( &( hSetOfHRTF->hHRTF_hrir_combined ) ); - destroy_HRTF( &( hSetOfHRTF->hHRTF_hrir_hoa3 ) ); - destroy_HRTF( &( hSetOfHRTF->hHRTF_brir_combined ) ); - } - - return IVAS_ERR_OK; -} - -#endif - -#ifndef FIX_197_CREND_INTERFACE -/*------------------------------------------------------------------------- - * ivas_crend_open() - * - * Allocate and initialize Crend renderer handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - int16_t i, subframe_length; - int16_t max_total_ir_len; - HRTFS_HANDLE hHrtf; - CREND_HANDLE hCrend; - ivas_error error; - - error = IVAS_ERR_OK; - subframe_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; - - if ( ( st_ivas->hHrtf == NULL ) && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) - { -#ifdef HRTF_BINARY_FILE - if ( st_ivas->hSetOfHRTF != NULL ) - { - if ( ( error = ivas_crend_init_from_setofhrtf( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = ivas_crend_init_from_rom( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#else - if ( ( error = ivas_crend_init_from_rom( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - } - - if ( ( hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); - } - - hCrend->lfe_delay_line = NULL; - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - hCrend->freq_buffer_re[i] = NULL; - hCrend->freq_buffer_im[i] = NULL; - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - hCrend->prev_out_buffer[i] = NULL; - } - - hCrend->freq_buffer_re_diffuse = NULL; - hCrend->freq_buffer_im_diffuse = NULL; - hCrend->hReverb = NULL; - hCrend->delay_line_rw_index = 0; - hCrend->diffuse_delay_line_rw_index = 0; - hCrend->hTrack = NULL; - hCrend->m_fYaw = 0; - hCrend->m_fPitch = 0; - hCrend->m_fRoll = 0; - - hHrtf = st_ivas->hHrtf; - - if ( ( hHrtf != NULL ) && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) - { - max_total_ir_len = hHrtf->max_num_iterations * subframe_length; - - for ( i = 0; i < hHrtf->max_num_ir; i++ ) - { - if ( ( hCrend->freq_buffer_re[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->freq_buffer_re[i], 0, max_total_ir_len ); - - if ( ( hCrend->freq_buffer_im[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->freq_buffer_im[i], 0, max_total_ir_len ); - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - if ( ( hCrend->prev_out_buffer[i] = (float *) malloc( sizeof( float ) * subframe_length ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->prev_out_buffer[i], 0, subframe_length ); - } - - max_total_ir_len = hHrtf->num_iterations_diffuse[0] * subframe_length; - - if ( max_total_ir_len > 0 ) - { - if ( ( hCrend->freq_buffer_re_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->freq_buffer_re_diffuse, 0, max_total_ir_len ); - - if ( ( hCrend->freq_buffer_im_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->freq_buffer_im_diffuse, 0, max_total_ir_len ); - } - else - { - hCrend->freq_buffer_re_diffuse = NULL; - hCrend->freq_buffer_im_diffuse = NULL; - } - - max_total_ir_len = (int16_t) ( hHrtf->latency_s * st_ivas->hDecoderConfig->output_Fs + 0.5f ) + subframe_length; - if ( max_total_ir_len > 0 ) - { - if ( ( hCrend->lfe_delay_line = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); - } - set_f( hCrend->lfe_delay_line, 0, max_total_ir_len ); - } - else - { - hCrend->lfe_delay_line = NULL; - } - - if ( st_ivas->hDecoderConfig->Opt_Headrotation ) - { - if ( ( hCrend->hTrack = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); - } - - ivas_orient_trk_Init( hCrend->hTrack ); - } - else - { - hCrend->hTrack = NULL; - } - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && st_ivas->hDecoderConfig->Opt_Headrotation ) - { - if ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( ( st_ivas->hRenderConfig != NULL ) && st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) - { - if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), st_ivas->intern_config, hHrtf, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - hCrend->hReverb = NULL; - } - - st_ivas->binaural_latency_ns = (int32_t) ( st_ivas->hHrtf->latency_s * 1000000000.f ); - } - - st_ivas->hCrend = hCrend; - - return error; -} -#endif - -#ifndef FIX_197_CREND_INTERFACE - -/*------------------------------------------------------------------------- - * ivas_crend_close() - * - * Deallocate Crend renderer handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_crend_close( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - int16_t i; - - if ( st_ivas->hHrtf != NULL ) - { - ivas_hrtf_close( &st_ivas->hHrtf ); - } - - if ( st_ivas->hCrend != NULL ) - { - if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) - { - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - if ( st_ivas->hCrend->freq_buffer_re[i] != NULL ) - { - free( st_ivas->hCrend->freq_buffer_re[i] ); - st_ivas->hCrend->freq_buffer_re[i] = NULL; - } - if ( st_ivas->hCrend->freq_buffer_im[i] != NULL ) - { - free( st_ivas->hCrend->freq_buffer_im[i] ); - st_ivas->hCrend->freq_buffer_im[i] = NULL; - } - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - if ( st_ivas->hCrend->prev_out_buffer[i] != NULL ) - { - free( st_ivas->hCrend->prev_out_buffer[i] ); - st_ivas->hCrend->prev_out_buffer[i] = NULL; - } - } - - if ( st_ivas->hCrend->lfe_delay_line != NULL ) - { - free( st_ivas->hCrend->lfe_delay_line ); - st_ivas->hCrend->lfe_delay_line = NULL; - } - - if ( st_ivas->hCrend->freq_buffer_re_diffuse != NULL ) - { - free( st_ivas->hCrend->freq_buffer_re_diffuse ); - st_ivas->hCrend->freq_buffer_re_diffuse = NULL; - } - - if ( st_ivas->hCrend->freq_buffer_im_diffuse != NULL ) - { - free( st_ivas->hCrend->freq_buffer_im_diffuse ); - st_ivas->hCrend->freq_buffer_im_diffuse = NULL; - } - - if ( st_ivas->hCrend->hTrack != NULL ) - { - free( st_ivas->hCrend->hTrack ); - st_ivas->hCrend->hTrack = NULL; - } - } - - ivas_reverb_close( &st_ivas->hCrend->hReverb ); - - free( st_ivas->hCrend ); - st_ivas->hCrend = NULL; - } - - return IVAS_ERR_OK; -} -#endif - -#ifndef FIX_197_CREND_INTERFACE - -/*-----------------------------------------------------------------------------------------* - * Function ivas_crend_convolver() - * - * Convolver block - *-----------------------------------------------------------------------------------------*/ - -static ivas_error ivas_crend_convolver( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float pcm_in[][L_FRAME48k], - float pcm_out[][L_FRAME48k], - const int16_t i_ts ) -{ - float *pIn; - float *pFreq_buf_re; - float *pFreq_buf_im; - float *pFreq_filt_re; - float *pFreq_filt_im; - int16_t i, j, k, m, nchan_out, subframe_length, nchan_intern, idx_in; - float pOut[L_FRAME48k * 2]; - float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k]; - int16_t offset, offset_in, offset_diffuse; - int32_t output_Fs; - - nchan_intern = audioCfg2channels( st_ivas->intern_config ); - nchan_out = st_ivas->hDecoderConfig->nchan_out; - output_Fs = st_ivas->hDecoderConfig->output_Fs; - subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; - - offset = st_ivas->hCrend->delay_line_rw_index * subframe_length; /* subframe_length * ( st_ivas->hHrtf->max_num_iterations - 1 ); */ - offset_diffuse = st_ivas->hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( st_ivas->hHrtf->num_iterations_diffuse[0] - 1 ); */ - - if ( st_ivas->hHrtf->num_iterations_diffuse[0] > 0 ) - { - set_zero( &st_ivas->hCrend->freq_buffer_re_diffuse[offset_diffuse], subframe_length ); - set_zero( &st_ivas->hCrend->freq_buffer_im_diffuse[offset_diffuse], subframe_length ); - } - - i = 0; - for ( idx_in = 0; idx_in < nchan_intern; idx_in++ ) - { - pIn = &pcm_in[idx_in][i_ts * subframe_length]; - if ( st_ivas->hIntSetup.index_lfe[0] != idx_in ) - { - if ( st_ivas->hHrtf->num_iterations_diffuse[0] > 0 ) - { - pFreq_buf_re = &st_ivas->hCrend->freq_buffer_re_diffuse[offset_diffuse]; - pFreq_buf_im = &st_ivas->hCrend->freq_buffer_im_diffuse[offset_diffuse]; - pFreq_filt_re = &st_ivas->hCrend->freq_buffer_re[i][offset]; - pFreq_filt_im = &st_ivas->hCrend->freq_buffer_im[i][offset]; +#include "wmc_auto.h" - for ( k = 0; k < st_ivas->hHrtf->index_frequency_max_diffuse; k++ ) - { - pFreq_buf_re[k] += pFreq_filt_re[k] * st_ivas->hHrtf->inv_diffuse_weight[i]; - pFreq_buf_im[k] += pFreq_filt_im[k] * st_ivas->hHrtf->inv_diffuse_weight[i]; - } - } - pFreq_buf_re = &st_ivas->hCrend->freq_buffer_re[i][offset]; - pFreq_buf_im = &st_ivas->hCrend->freq_buffer_im[i][offset]; +/*------------------------------------------------------------------------- + * ivas_hrtf_init() + * + * Initialize hHrtf handle + *------------------------------------------------------------------------*/ - ivas_mdft( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length ); - i++; - } - } +static ivas_error ivas_hrtf_init( + HRTFS_DATA *hHrtf /* i/o: HRTF handle */ +) +{ + int16_t i, j; - for ( j = 0; j < nchan_out; j++ ) + if ( hHrtf == NULL ) { - set_zero( tmp_out_re, subframe_length ); - set_zero( tmp_out_im, subframe_length ); - - i = 0; - for ( idx_in = 0; idx_in < nchan_intern; idx_in++ ) - { - if ( idx_in != st_ivas->hIntSetup.index_lfe[0] ) - { - offset = 0; - for ( m = 0; m < st_ivas->hHrtf->num_iterations[i][j]; m++ ) - { - offset_in = ( st_ivas->hCrend->delay_line_rw_index + st_ivas->hHrtf->max_num_iterations - st_ivas->hHrtf->num_iterations[i][j] + m + 1 ); - offset_in = offset_in % ( st_ivas->hHrtf->max_num_iterations ); - offset_in = offset_in * subframe_length; - pFreq_buf_re = &st_ivas->hCrend->freq_buffer_re[i][offset_in]; - pFreq_buf_im = &st_ivas->hCrend->freq_buffer_im[i][offset_in]; - pFreq_filt_re = &st_ivas->hHrtf->pOut_to_bin_re[i][j][offset]; - pFreq_filt_im = &st_ivas->hHrtf->pOut_to_bin_im[i][j][offset]; - - for ( k = 0; k < st_ivas->hHrtf->pIndex_frequency_max[i][j][m]; k++ ) - { - tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; - tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; - } - offset = offset + k; - } - i++; - } - } - - offset = 0; - for ( m = 0; m < st_ivas->hHrtf->num_iterations_diffuse[j]; m++ ) - { - offset_diffuse = ( st_ivas->hCrend->diffuse_delay_line_rw_index + m + 1 ); - offset_diffuse = offset_diffuse % st_ivas->hHrtf->num_iterations_diffuse[0]; - offset_diffuse = offset_diffuse * subframe_length; - pFreq_buf_re = &st_ivas->hCrend->freq_buffer_re_diffuse[offset_diffuse]; - pFreq_buf_im = &st_ivas->hCrend->freq_buffer_im_diffuse[offset_diffuse]; - pFreq_filt_re = &st_ivas->hHrtf->pOut_to_bin_diffuse_re[j][offset]; - pFreq_filt_im = &st_ivas->hHrtf->pOut_to_bin_diffuse_im[j][offset]; - - for ( k = 0; k < st_ivas->hHrtf->pIndex_frequency_max_diffuse[j][m]; k++ ) - { - tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; - tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; - } - offset = offset + k; - } + return IVAS_ERR_WRONG_PARAMS; + } - ivas_imdft( tmp_out_re, tmp_out_im, pOut, subframe_length ); + hHrtf->latency_s = 0; + hHrtf->max_num_ir = 0; + hHrtf->max_num_iterations = 0; + hHrtf->gain_lfe = 0; + hHrtf->index_frequency_max_diffuse = 0; - pFreq_buf_re = &pcm_out[j][i_ts * subframe_length]; - for ( k = 0; k < subframe_length; k++ ) + for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + { + hHrtf->inv_diffuse_weight[i] = 0; + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - pFreq_buf_re[k] = pOut[k] + st_ivas->hCrend->prev_out_buffer[j][k]; - st_ivas->hCrend->prev_out_buffer[j][k] = pOut[k + subframe_length]; + hHrtf->num_iterations[i][j] = 0; + hHrtf->pIndex_frequency_max[i][j] = NULL; + hHrtf->pOut_to_bin_re[i][j] = NULL; + hHrtf->pOut_to_bin_im[i][j] = NULL; } } - st_ivas->hCrend->delay_line_rw_index++; - st_ivas->hCrend->delay_line_rw_index = st_ivas->hCrend->delay_line_rw_index % ( st_ivas->hHrtf->max_num_iterations ); - if ( st_ivas->hHrtf->num_iterations_diffuse[0] > 0 ) + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - st_ivas->hCrend->diffuse_delay_line_rw_index++; - st_ivas->hCrend->diffuse_delay_line_rw_index = st_ivas->hCrend->diffuse_delay_line_rw_index % ( st_ivas->hHrtf->num_iterations_diffuse[0] ); + hHrtf->num_iterations_diffuse[j] = 0; + hHrtf->pIndex_frequency_max_diffuse[j] = NULL; + hHrtf->pOut_to_bin_diffuse_re[j] = NULL; + hHrtf->pOut_to_bin_diffuse_im[j] = NULL; } return IVAS_ERR_OK; } -#endif -#ifndef FIX_197_CREND_INTERFACE -/*-----------------------------------------------------------------------------------------* - * Function ivas_crend_process() +/*------------------------------------------------------------------------- + * ivas_hrtf_open() * - * Process call for IVAS Crend renderer - *-----------------------------------------------------------------------------------------*/ + * Open hHrtf handle + *------------------------------------------------------------------------*/ -ivas_error ivas_crend_process( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output[][L_FRAME48k] /* i/o: input/output audio channels */ +static ivas_error ivas_hrtf_open( + HRTFS_HANDLE *hHrtf_out /* o : HRTF handle */ ) { - int16_t i, nchan_out, output_frame; - int16_t subframe_len, subframe_idx; - float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; - AUDIO_CONFIG intern_config; - ivas_error error; - - push_wmops( "ivas_crend_process" ); - - intern_config = st_ivas->intern_config; - nchan_out = st_ivas->hDecoderConfig->nchan_out; - output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; + HRTFS_HANDLE hHrtf; - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) + if ( *hHrtf_out == NULL ) { - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) + if ( ( hHrtf = (HRTFS_HANDLE) malloc( sizeof( HRTFS_DATA ) ) ) == NULL ) { - /* Orientation tracking */ - if ( st_ivas->hCrend->hTrack != NULL ) - { - if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) - { - ivas_orient_trk_SetTrackingType( st_ivas->hCrend->hTrack, OTR_TRACKING_AVG_ORIENT ); - } - else - { - ivas_orient_trk_SetTrackingType( st_ivas->hCrend->hTrack, OTR_TRACKING_REF_ORIENT ); - } - - /* get current subframe quaternion and convert to euler angles */ - Quat2Euler( st_ivas->hHeadTrackData->Quaternions[subframe_idx], &( st_ivas->hCrend->m_fYaw ), &( st_ivas->hCrend->m_fPitch ), &( st_ivas->hCrend->m_fRoll ) ); - ivas_orient_trk_SetAbsoluteOrientation( st_ivas->hCrend->hTrack, st_ivas->hCrend->m_fYaw, st_ivas->hCrend->m_fPitch, st_ivas->hCrend->m_fRoll ); - ivas_orient_trk_Process( st_ivas->hCrend->hTrack ); - ivas_orient_trk_GetTrackedOrientation( st_ivas->hCrend->hTrack, &( st_ivas->hCrend->m_fYaw ), &( st_ivas->hCrend->m_fPitch ), &( st_ivas->hCrend->m_fRoll ) ); - } - - /* Rotation in SHD for: - MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL - SBA SPAR -> BINAURAL or BINAURAL_ROOM - */ - if ( intern_config == AUDIO_CONFIG_FOA || intern_config == AUDIO_CONFIG_HOA2 || intern_config == AUDIO_CONFIG_HOA3 ) - { - rotateFrame_shd( st_ivas->hHeadTrackData, output, subframe_len, st_ivas->hIntSetup, subframe_idx ); - } - /* Rotation in SD for MC -> BINAURAL_ROOM */ - else if ( st_ivas->ivas_format != ISM_FORMAT && st_ivas->hIntSetup.is_loudspeaker_setup ) - { - rotateFrame_sd( st_ivas->hHeadTrackData, output, subframe_len, st_ivas->hIntSetup, st_ivas->hEFAPdata, subframe_idx ); - } + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder\n" ); } - if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - if ( ( intern_config == AUDIO_CONFIG_FOA ) || ( intern_config == AUDIO_CONFIG_HOA2 ) || ( intern_config == AUDIO_CONFIG_HOA3 ) || - ( intern_config == AUDIO_CONFIG_5_1 ) || ( intern_config == AUDIO_CONFIG_7_1 ) || - ( intern_config == AUDIO_CONFIG_5_1_2 ) || ( intern_config == AUDIO_CONFIG_5_1_4 ) || ( intern_config == AUDIO_CONFIG_7_1_4 ) ) - { - ivas_crend_convolver( st_ivas, output, pcm_tmp, subframe_idx ); + ivas_hrtf_init( hHrtf ); - if ( st_ivas->hCrend->hReverb != NULL ) - { - if ( ( error = ivas_reverb_process( st_ivas->hCrend->hReverb, intern_config, 1, output, pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else - { - return IVAS_ERR_INVALID_INPUT_FORMAT; - } - } - else - { - return IVAS_ERR_INTERNAL_FATAL; - } + *hHrtf_out = hHrtf; + } + else + { + return IVAS_ERR_INTERNAL; } - /* move to output */ - for ( i = 0; i < nchan_out; i++ ) + return ( IVAS_ERR_OK ); +} + + +/*------------------------------------------------------------------------- + * ivas_hrtf_close() + * + * Close hHrtf handle + *------------------------------------------------------------------------*/ + +static ivas_error ivas_hrtf_close( + HRTFS_HANDLE *hHrtf /* i/o: HRTF handle */ +) +{ + if ( *hHrtf == NULL || hHrtf == NULL ) { - mvr2r( pcm_tmp[i], output[i], output_frame ); + return IVAS_ERR_WRONG_PARAMS; } - pop_wmops(); + free( *hHrtf ); + *hHrtf = NULL; return IVAS_ERR_OK; } -#endif - /*------------------------------------------------------------------------- * initCrend_from_rom() @@ -1466,14 +153,12 @@ ivas_error ivas_crend_process( * Allocate and initialize crend renderer handle *------------------------------------------------------------------------*/ -ivas_error ivas_rend_initCrend( +static ivas_error ivas_rend_initCrend( CREND_WRAPPER *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, + const AUDIO_CONFIG inIvasConfig, + const AUDIO_CONFIG outIvasConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -#endif const int32_t output_Fs ) { int16_t i, j, tmp; @@ -1482,6 +167,11 @@ ivas_error ivas_rend_initCrend( IVAS_REND_AudioConfigType inConfigType; HRTFS_HANDLE hHrtf; ivas_error error; + IVAS_REND_AudioConfig inConfig; + IVAS_REND_AudioConfig outConfig; + + inConfig = getRendAudioConfigFromIvasAudioConfig( inIvasConfig ); + outConfig = getRendAudioConfigFromIvasAudioConfig( outIvasConfig ); inConfigType = getAudioConfigType( inConfig ); hHrtf = pCrend->hHrtfCrend; @@ -1491,10 +181,12 @@ ivas_error ivas_rend_initCrend( { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" ); } + if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported output type in Crend" ); } + if ( hHrtf == NULL ) { if ( ivas_hrtf_open( &hHrtf ) != IVAS_ERR_OK ) @@ -1505,17 +197,10 @@ ivas_error ivas_rend_initCrend( /* set BRIR flag */ use_brir = false; -#ifdef FIX_197_CREND_INTERFACE if ( ( ( hRendCfg != NULL ) && hRendCfg->roomAcoustics.use_brir ) || ( ( hRendCfg == NULL ) && ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) ) ) { use_brir = true; } -#else - if ( ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir ) || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) - { - use_brir = true; - } -#endif if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) @@ -1529,10 +214,8 @@ ivas_error ivas_rend_initCrend( return IVAS_ERR_INTERNAL_FATAL; } -#ifdef HRTF_BINARY_FILE if ( hSetOfHRTF == NULL ) { -#endif if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { hHrtf->max_num_ir -= 1; /* subtract LFE */ @@ -1853,7 +536,6 @@ ivas_error ivas_rend_initCrend( { return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported renderer type in Crend" ); } -#ifdef HRTF_BINARY_FILE } else { @@ -1979,13 +661,67 @@ ivas_error ivas_rend_initCrend( return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported renderer type in Crend" ); } } -#endif pCrend->hHrtfCrend = hHrtf; return IVAS_ERR_OK; } +/*------------------------------------------------------------------------- + * ivas_rend_initCrendWrapper() + * + * Allocate and initialize crend renderer handle + *------------------------------------------------------------------------*/ + +ivas_error ivas_rend_initCrendWrapper( + CREND_WRAPPER_HANDLE *pCrend ) +{ + int16_t i; + + if ( pCrend == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); + } + + if ( ( *pCrend = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); + } + + ( *pCrend )->binaural_latency_ns = 0; + ( *pCrend )->hCrend = NULL; + ( *pCrend )->hHrtfCrend = NULL; + + if ( ( ( *pCrend )->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); + } + + ( *pCrend )->hCrend->lfe_delay_line = NULL; + + for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + { + ( *pCrend )->hCrend->freq_buffer_re[i] = NULL; + ( *pCrend )->hCrend->freq_buffer_im[i] = NULL; + } + + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + ( *pCrend )->hCrend->prev_out_buffer[i] = NULL; + } + + ( *pCrend )->hCrend->freq_buffer_re_diffuse = NULL; + ( *pCrend )->hCrend->freq_buffer_im_diffuse = NULL; + ( *pCrend )->hCrend->hReverb = NULL; + ( *pCrend )->hCrend->delay_line_rw_index = 0; + ( *pCrend )->hCrend->diffuse_delay_line_rw_index = 0; + ( *pCrend )->hCrend->hTrack = NULL; + ( *pCrend )->hCrend->m_fYaw = 0; + ( *pCrend )->hCrend->m_fPitch = 0; + ( *pCrend )->hCrend->m_fRoll = 0; + + return IVAS_ERR_OK; +} /*------------------------------------------------------------------------- * ivas_rend_openCrend() * @@ -1993,20 +729,11 @@ ivas_error ivas_rend_initCrend( *------------------------------------------------------------------------*/ ivas_error ivas_rend_openCrend( -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE *pCrend, -#else - CREND_WRAPPER *pCrend, -#endif - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg, -#ifdef FIX_197_CREND_INTERFACE - int16_t Opt_Headrotation, -#endif -#ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, -#endif const int32_t output_Fs ) { /* TODO tmu : Based on ivas_crend_open() - could be harmonized / refactored */ @@ -2017,86 +744,23 @@ ivas_error ivas_rend_openCrend( ivas_error error; error = IVAS_ERR_OK; - -#ifdef FIX_197_CREND_INTERFACE - if ( pCrend == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); - } - - if ( *pCrend == NULL ) + if ( ( error = ivas_rend_initCrendWrapper( pCrend ) ) != IVAS_ERR_OK ) { - if ( ( *pCrend = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); - } - ( *pCrend )->binaural_latency_ns = 0; - ( *pCrend )->hCrend = NULL; - ( *pCrend )->hHrtfCrend = NULL; + return error; } -#endif + hCrend = ( *pCrend )->hCrend; subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef FIX_197_CREND_INTERFACE if ( ( *pCrend )->hHrtfCrend == NULL ) { -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_rend_initCrend( *pCrend, inConfig, outConfig, hRendCfg, hSetOfHRTF, output_Fs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_initCrend( *pCrend, inConfig, outConfig, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) -#endif - { - return error; - } - } -#else - if ( pCrend->hHrtfCrend == NULL ) - { - if ( ( error = ivas_rend_initCrend( pCrend, inConfig, outConfig, hRendCfg, -#ifdef HRTF_BINARY_FILE - hSetOfHRTF, -#endif - output_Fs ) ) != IVAS_ERR_OK ) { return error; } } -#endif - - if ( ( hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); - } - - hCrend->lfe_delay_line = NULL; - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - hCrend->freq_buffer_re[i] = NULL; - hCrend->freq_buffer_im[i] = NULL; - } - - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - hCrend->prev_out_buffer[i] = NULL; - } - hCrend->freq_buffer_re_diffuse = NULL; - hCrend->freq_buffer_im_diffuse = NULL; - hCrend->hReverb = NULL; - hCrend->delay_line_rw_index = 0; - hCrend->diffuse_delay_line_rw_index = 0; - hCrend->hTrack = NULL; - hCrend->m_fYaw = 0; - hCrend->m_fPitch = 0; - hCrend->m_fRoll = 0; - -#ifdef FIX_197_CREND_INTERFACE hHrtf = ( *pCrend )->hHrtfCrend; -#else - hHrtf = pCrend->hHrtfCrend; -#endif if ( hHrtf != NULL ) { @@ -2155,41 +819,16 @@ ivas_error ivas_rend_openCrend( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" ); } - set_zero( hCrend->lfe_delay_line, max_total_ir_len ); - } - else - { - hCrend->lfe_delay_line = NULL; - } -#ifdef FIX_197_CREND_INTERFACE - if ( Opt_Headrotation ) -#else - if ( false ) /* TODO tmu : check renderer headrotation flag */ -#endif - { - if ( ( hCrend->hTrack = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); - } - - ivas_orient_trk_Init( hCrend->hTrack ); + set_zero( hCrend->lfe_delay_line, max_total_ir_len ); } else { - hCrend->hTrack = NULL; + hCrend->lfe_delay_line = NULL; } if ( ( hRendCfg != NULL ) && ( hRendCfg->roomAcoustics.late_reverb_on ) ) { - if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), - getIvasAudioConfigFromRendAudioConfig( inConfig ), -#ifdef FIX_197_CREND_INTERFACE - ( *pCrend )->hHrtfCrend, -#else - pCrend->hHrtfCrend, -#endif - hRendCfg, - output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), inConfig, ( *pCrend )->hHrtfCrend, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) { return error; } @@ -2199,44 +838,27 @@ ivas_error ivas_rend_openCrend( hCrend->hReverb = NULL; } -#ifdef FIX_197_CREND_INTERFACE ( *pCrend )->binaural_latency_ns = (int32_t) ( ( *pCrend )->hHrtfCrend->latency_s * 1000000000.f ); -#else - pCrend->binaural_latency_ns = (int32_t) ( pCrend->hHrtfCrend->latency_s * 1000000000.f ); -#endif } -#ifdef FIX_197_CREND_INTERFACE ( *pCrend )->hCrend = hCrend; -#else - pCrend->hCrend = hCrend; -#endif + return IVAS_ERR_OK; } + /*------------------------------------------------------------------------- * ivas_crend_close() * * Deallocate Crend renderer handle *------------------------------------------------------------------------*/ -#ifdef FIX_197_CREND_INTERFACE void ivas_rend_closeCrend( CREND_WRAPPER_HANDLE *pCrend ) -#else -ivas_error ivas_rend_closeCrend( - CREND_WRAPPER *pCrend ) -#endif { int16_t i; -#ifdef FIX_197_CREND_INTERFACE - if ( pCrend == NULL ) - { - return; - } - - if ( *pCrend == NULL ) + if ( pCrend == NULL || *pCrend == NULL ) { return; } @@ -2248,7 +870,6 @@ ivas_error ivas_rend_closeCrend( if ( ( *pCrend )->hCrend != NULL ) { - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { if ( ( *pCrend )->hCrend->freq_buffer_re[i] != NULL ) @@ -2303,73 +924,10 @@ ivas_error ivas_rend_closeCrend( free( *pCrend ); *pCrend = NULL; } - return; -#else - if ( pCrend->hHrtfCrend != NULL ) - { - ivas_hrtf_close( &pCrend->hHrtfCrend ); - } - - if ( pCrend->hCrend != NULL ) - { - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - if ( pCrend->hCrend->freq_buffer_re[i] != NULL ) - { - free( pCrend->hCrend->freq_buffer_re[i] ); - pCrend->hCrend->freq_buffer_re[i] = NULL; - } - if ( pCrend->hCrend->freq_buffer_im[i] != NULL ) - { - free( pCrend->hCrend->freq_buffer_im[i] ); - pCrend->hCrend->freq_buffer_im[i] = NULL; - } - } - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - if ( pCrend->hCrend->prev_out_buffer[i] != NULL ) - { - free( pCrend->hCrend->prev_out_buffer[i] ); - pCrend->hCrend->prev_out_buffer[i] = NULL; - } - } - - if ( pCrend->hCrend->lfe_delay_line != NULL ) - { - free( pCrend->hCrend->lfe_delay_line ); - pCrend->hCrend->lfe_delay_line = NULL; - } - - if ( pCrend->hCrend->freq_buffer_re_diffuse != NULL ) - { - free( pCrend->hCrend->freq_buffer_re_diffuse ); - pCrend->hCrend->freq_buffer_re_diffuse = NULL; - } - - if ( pCrend->hCrend->freq_buffer_im_diffuse != NULL ) - { - free( pCrend->hCrend->freq_buffer_im_diffuse ); - pCrend->hCrend->freq_buffer_im_diffuse = NULL; - } - - if ( pCrend->hCrend->hTrack != NULL ) - { - free( pCrend->hCrend->hTrack ); - pCrend->hCrend->hTrack = NULL; - } - - ivas_reverb_close( &pCrend->hCrend->hReverb ); - - free( pCrend->hCrend ); - pCrend->hCrend = NULL; - } - return IVAS_ERR_OK; -#endif + return; } -#ifdef FIX_197_CREND_INTERFACE /*-----------------------------------------------------------------------------------------* * Function ivas_crend_convolver() @@ -2381,8 +939,13 @@ static ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, IVAS_REND_AudioConfig inConfig, IVAS_REND_AudioConfig outConfig, +#ifdef JBM_TSM_ON_TCS + float *pcm_in[], + float *pcm_out[], +#else float pcm_in[][L_FRAME48k], float pcm_out[][L_FRAME48k], +#endif const int32_t output_Fs, const int16_t i_ts ) { @@ -2396,9 +959,17 @@ static ivas_error ivas_rend_crendConvolver( float *pFreq_filt_re, *pFreq_filt_im; float pOut[L_FRAME48k * 2]; float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k]; + ivas_error error; + + if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) + { + return error; + } - getAudioConfigNumChannels( inConfig, &nchan_in ); - getAudioConfigNumChannels( outConfig, &nchan_out ); + if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) + { + return error; + } subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; @@ -2524,7 +1095,6 @@ static ivas_error ivas_rend_crendConvolver( return IVAS_ERR_OK; } -#endif /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crend_Process() @@ -2534,60 +1104,58 @@ static ivas_error ivas_rend_crendConvolver( ivas_error ivas_rend_crendProcess( const CREND_WRAPPER *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, -#ifdef FIX_197_CREND_INTERFACE + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, DECODER_CONFIG_HANDLE hDecoderConfig, HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, -#endif +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: input/output audio channels */ +#else float output[][L_FRAME48k], /* i/o: input/output audio channels */ +#endif const int32_t output_Fs ) { -#ifdef FIX_197_CREND_INTERFACE int16_t i, subframe_idx, output_frame, subframe_len; -#else - int16_t i, subframe_idx, output_frame; -#endif int16_t nchan_out; float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; +#ifdef JBM_TSM_ON_TCS + float *p_pcm_tmp[BINAURAL_CHANNELS]; +#endif AUDIO_CONFIG in_config; IVAS_REND_AudioConfigType inConfigType; ivas_error error; + IVAS_REND_AudioConfig inRendConfig; + IVAS_REND_AudioConfig outRendConfig; push_wmops( "ivas_rend_crendProcess" ); - in_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); - inConfigType = getAudioConfigType( inConfig ); - getAudioConfigNumChannels( outConfig, &nchan_out ); + inRendConfig = getRendAudioConfigFromIvasAudioConfig( inConfig ); + outRendConfig = getRendAudioConfigFromIvasAudioConfig( outConfig ); + + in_config = getIvasAudioConfigFromRendAudioConfig( inRendConfig ); + + inConfigType = getAudioConfigType( inRendConfig ); + + if ( ( error = getAudioConfigNumChannels( outRendConfig, &nchan_out ) ) != IVAS_ERR_OK ) + { + return error; + } + output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); -#ifdef FIX_197_CREND_INTERFACE subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + p_pcm_tmp[i] = pcm_tmp[i]; + } #endif for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { -#ifdef FIX_197_CREND_INTERFACE if ( hDecoderConfig && hDecoderConfig->Opt_Headrotation && hHeadTrackData && hHeadTrackData->num_quaternions >= 0 ) { /* Orientation tracking */ - if ( pCrend->hCrend->hTrack != NULL ) - { - if ( hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) - { - ivas_orient_trk_SetTrackingType( pCrend->hCrend->hTrack, OTR_TRACKING_AVG_ORIENT ); - } - else - { - ivas_orient_trk_SetTrackingType( pCrend->hCrend->hTrack, OTR_TRACKING_REF_ORIENT ); - } - - /* get current subframe quaternion and convert to euler angles */ - Quat2Euler( hHeadTrackData->Quaternions[subframe_idx], &( pCrend->hCrend->m_fYaw ), &( pCrend->hCrend->m_fPitch ), &( pCrend->hCrend->m_fRoll ) ); - ivas_orient_trk_SetAbsoluteOrientation( pCrend->hCrend->hTrack, pCrend->hCrend->m_fYaw, pCrend->hCrend->m_fPitch, pCrend->hCrend->m_fRoll ); - ivas_orient_trk_Process( pCrend->hCrend->hTrack ); - ivas_orient_trk_GetTrackedOrientation( pCrend->hCrend->hTrack, &( pCrend->hCrend->m_fYaw ), &( pCrend->hCrend->m_fPitch ), &( pCrend->hCrend->m_fRoll ) ); - } /* Rotation in SHD for: MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL @@ -2603,18 +1171,25 @@ ivas_error ivas_rend_crendProcess( rotateFrame_sd( hHeadTrackData, output, subframe_len, *hIntSetup, hEFAPdata, subframe_idx ); } } -#endif if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { - if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output, pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, p_pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) +#endif { return error; } if ( pCrend->hCrend->hReverb != NULL ) { +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, output, pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -2637,159 +1212,129 @@ ivas_error ivas_rend_crendProcess( return IVAS_ERR_OK; } -#ifndef FIX_197_CREND_INTERFACE - -/*-----------------------------------------------------------------------------------------* - * Function ivas_crend_convolver() - * - * Convolver block - *-----------------------------------------------------------------------------------------*/ - -ivas_error ivas_rend_crendConvolver( +#ifdef JBM_TSM_ON_TCS +ivas_error ivas_rend_crendProcessSubframe( const CREND_WRAPPER *pCrend, - IVAS_REND_AudioConfig inConfig, - IVAS_REND_AudioConfig outConfig, - float pcm_in[][L_FRAME48k], - float pcm_out[][L_FRAME48k], - const int32_t output_Fs, - const int16_t i_ts ) + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, + DECODER_CONFIG_HANDLE hDecoderConfig, + HEAD_TRACK_DATA_HANDLE hHeadTrackData, + IVAS_OUTPUT_SETUP_HANDLE hIntSetup, + EFAP_HANDLE hEFAPdata, + DECODER_TC_BUFFER_HANDLE hTcBuffer, + float *input_f[], + float *output[], /* i/o: input/output audio channels */ + const int16_t n_samples_to_render, + const int32_t output_Fs ) { - int16_t i, j, k, m; - int16_t subframe_length, idx_in; - int16_t lfe_idx_in; - int16_t offset, offset_in, offset_diffuse; - int16_t nchan_in, nchan_out; - float *pIn; - float *pFreq_buf_re, *pFreq_buf_im; - float *pFreq_filt_re, *pFreq_filt_im; - float pOut[L_FRAME48k * 2]; - float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k]; + int16_t subframe_idx, subframe_len; + int16_t nchan_out, nchan_in, ch, first_sf, last_sf, slot_size, slots_to_render; + float *tc_local[MAX_TRANSPORT_CHANNELS]; + float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; + float *p_pcm_tmp[BINAURAL_CHANNELS]; + AUDIO_CONFIG in_config; + IVAS_REND_AudioConfigType inConfigType; + ivas_error error; + IVAS_REND_AudioConfig inRendConfig; + IVAS_REND_AudioConfig outRendConfig; - getAudioConfigNumChannels( inConfig, &nchan_in ); - getAudioConfigNumChannels( outConfig, &nchan_out ); + push_wmops( "ivas_rend_crendProcessSubframe" ); - subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES; + inRendConfig = getRendAudioConfigFromIvasAudioConfig( inConfig ); + outRendConfig = getRendAudioConfigFromIvasAudioConfig( outConfig ); - lfe_idx_in = -1; - if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + in_config = getIvasAudioConfigFromRendAudioConfig( inRendConfig ); + inConfigType = getAudioConfigType( inRendConfig ); + if ( ( error = getAudioConfigNumChannels( outRendConfig, &nchan_out ) ) != IVAS_ERR_OK ) { - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) - { - lfe_idx_in = LFE_CHANNEL; - } - else - { - assert( 0 && "Custom LS not supported in CRend" ); - } + return error; + } + if ( ( error = getAudioConfigNumChannels( inRendConfig, &nchan_in ) ) != IVAS_ERR_OK ) + { + return error; } - offset = pCrend->hCrend->delay_line_rw_index * subframe_length; /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */ - offset_diffuse = pCrend->hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( pCrend->hHrtfCrend->num_iterations_diffuse[0] - 1 ); */ + for ( ch = 0; ch < nchan_in; ch++ ) + { + tc_local[ch] = input_f[ch]; + } + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + p_pcm_tmp[ch] = pcm_tmp[ch]; + } - if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) + slot_size = hTcBuffer->n_samples_granularity; + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( hTcBuffer->num_slots - hTcBuffer->slots_rendered, n_samples_to_render / slot_size ); + first_sf = hTcBuffer->subframes_rendered; + last_sf = first_sf; + hTcBuffer->slots_rendered += slots_to_render; + while ( slots_to_render > 0 ) { - set_zero( &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse], subframe_length ); - set_zero( &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse], subframe_length ); + slots_to_render -= hTcBuffer->subframe_nbslots[last_sf]; + last_sf++; } - i = 0; - for ( idx_in = 0; idx_in < nchan_in; idx_in++ ) + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { - pIn = &pcm_in[idx_in][i_ts * subframe_length]; - if ( idx_in != lfe_idx_in ) + subframe_len = hTcBuffer->subframe_nbslots[subframe_idx] * hTcBuffer->n_samples_granularity; + if ( hDecoderConfig && hDecoderConfig->Opt_Headrotation && hHeadTrackData && hHeadTrackData->num_quaternions >= 0 ) { - if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) - { - pFreq_buf_re = &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse]; - pFreq_buf_im = &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse]; - pFreq_filt_re = &pCrend->hCrend->freq_buffer_re[i][offset]; - pFreq_filt_im = &pCrend->hCrend->freq_buffer_im[i][offset]; - for ( k = 0; k < pCrend->hHrtfCrend->index_frequency_max_diffuse; k++ ) - { - pFreq_buf_re[k] += pFreq_filt_re[k] * pCrend->hHrtfCrend->inv_diffuse_weight[i]; - pFreq_buf_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[i]; - } + /* Rotation in SHD for: + MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL + SBA SPAR -> BINAURAL or BINAURAL_ROOM + */ + if ( in_config == AUDIO_CONFIG_FOA || in_config == AUDIO_CONFIG_HOA2 || in_config == AUDIO_CONFIG_HOA3 ) + { + rotateFrame_shd( hHeadTrackData, tc_local, subframe_len, *hIntSetup, 0 ); + } + /* Rotation in SD for MC -> BINAURAL_ROOM */ + else if ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup ) + { + rotateFrame_sd( hHeadTrackData, tc_local, subframe_len, *hIntSetup, hEFAPdata, 0 ); } - - pFreq_buf_re = &pCrend->hCrend->freq_buffer_re[i][offset]; - pFreq_buf_im = &pCrend->hCrend->freq_buffer_im[i][offset]; - - ivas_mdft( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length ); - i++; } - } - - for ( j = 0; j < nchan_out; j++ ) - { - set_zero( tmp_out_re, subframe_length ); - set_zero( tmp_out_im, subframe_length ); - i = 0; - for ( idx_in = 0; idx_in < nchan_in; idx_in++ ) + if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { - if ( idx_in != lfe_idx_in ) + if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, tc_local, p_pcm_tmp, output_Fs, 0 ) ) != IVAS_ERR_OK ) { - offset = 0; - for ( m = 0; m < pCrend->hHrtfCrend->num_iterations[i][j]; m++ ) - { - offset_in = ( pCrend->hCrend->delay_line_rw_index + pCrend->hHrtfCrend->max_num_iterations - pCrend->hHrtfCrend->num_iterations[i][j] + m + 1 ); - offset_in = offset_in % ( pCrend->hHrtfCrend->max_num_iterations ); - offset_in = offset_in * subframe_length; - pFreq_buf_re = &pCrend->hCrend->freq_buffer_re[i][offset_in]; - pFreq_buf_im = &pCrend->hCrend->freq_buffer_im[i][offset_in]; - pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_re[i][j][offset]; - pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_im[i][j][offset]; + return error; + } - for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max[i][j][m]; k++ ) - { - tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; - tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; - } - offset = offset + k; + if ( pCrend->hCrend->hReverb != NULL ) + { + if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, tc_local, p_pcm_tmp, 0 ) ) != IVAS_ERR_OK ) + { + return error; } - i++; } - } - - offset = 0; - for ( m = 0; m < pCrend->hHrtfCrend->num_iterations_diffuse[j]; m++ ) - { - offset_diffuse = ( pCrend->hCrend->diffuse_delay_line_rw_index + m + 1 ); - offset_diffuse = offset_diffuse % pCrend->hHrtfCrend->num_iterations_diffuse[0]; - offset_diffuse = offset_diffuse * subframe_length; - pFreq_buf_re = &pCrend->hCrend->freq_buffer_re_diffuse[offset_diffuse]; - pFreq_buf_im = &pCrend->hCrend->freq_buffer_im_diffuse[offset_diffuse]; - pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_re[j][offset]; - pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_im[j][offset]; - - for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max_diffuse[j][m]; k++ ) + for ( ch = 0; ch < nchan_in; ch++ ) { - tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k]; - tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k]; + tc_local[ch] += subframe_len; + } + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + p_pcm_tmp[ch] += subframe_len; } - offset = offset + k; } - - ivas_imdft( tmp_out_re, tmp_out_im, pOut, subframe_length ); - - pFreq_buf_re = &pcm_out[j][i_ts * subframe_length]; - for ( k = 0; k < subframe_length; k++ ) + else { - pFreq_buf_re[k] = pOut[k] + pCrend->hCrend->prev_out_buffer[j][k]; - pCrend->hCrend->prev_out_buffer[j][k] = pOut[k + subframe_length]; + return IVAS_ERR_INVALID_INPUT_FORMAT; } } - pCrend->hCrend->delay_line_rw_index++; - pCrend->hCrend->delay_line_rw_index = pCrend->hCrend->delay_line_rw_index % ( pCrend->hHrtfCrend->max_num_iterations ); - if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 ) + /* move to output */ + for ( ch = 0; ch < nchan_out; ch++ ) { - pCrend->hCrend->diffuse_delay_line_rw_index++; - pCrend->hCrend->diffuse_delay_line_rw_index = pCrend->hCrend->diffuse_delay_line_rw_index % ( pCrend->hHrtfCrend->num_iterations_diffuse[0] ); + mvr2r( pcm_tmp[ch], output[ch], n_samples_to_render ); } + + hTcBuffer->subframes_rendered = last_sf; + pop_wmops(); + return IVAS_ERR_OK; } - #endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c new file mode 100644 index 0000000000000000000000000000000000000000..06fd160bb2819cdb9c10a65cfa6b668ff536592b --- /dev/null +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -0,0 +1,4227 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include +#include "options.h" +#include +#include +#include "prot.h" +#include "ivas_prot.h" +#include "ivas_prot_rend.h" +#include "ivas_cnst.h" +#include "ivas_rom_binauralRenderer.h" +#include "ivas_rom_rend.h" +#include "ivas_rom_com.h" + +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" + + +/*------------------------------------------------------------------------- + * Local constants + *------------------------------------------------------------------------*/ + +#define CLDFB_HALF_BIN_FREQUENCY_OFFSET 0.5f +#ifdef FIX_417_TD_DECORR_BRATE_SW +#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN ( 2.0f ) +#define IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR ( 3.0f ) +#endif + +/* powf(0.95f, 4.0f) for sub-frame smoothing instead of CLDFB slot */ +#define ADAPT_HTPROTO_IIR_FAC 0.81450625f + +#define ADAPT_HTPROTO_ILD_LIM_DB0 1.0f +#define ADAPT_HTPROTO_ILD_LIM_DB1 4.0f +#define ADAPT_HTPROTO_ROT_LIM_0 0.4f +#define ADAPT_HTPROTO_ROT_LIM_1 0.8f + +/*------------------------------------------------------------------------- + * Local function prototypes + *------------------------------------------------------------------------*/ + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +#ifdef JBM_TSM_ON_TCS +static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, float *output_f[], const int16_t nchan_transport, const int16_t subframe ); +#else +static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], const int16_t nchan_transport, const int16_t subframe ); +#endif +static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_HANDLE hDirAC, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); + +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const int16_t subframe ); +#else +static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], const int16_t nchan_transport, const uint8_t firstSubframe, const uint8_t nSubframes ); + +static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_HANDLE hDirAC, const int8_t slot, float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); + +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Rmat[3][3], const uint8_t firstSubframe, const uint8_t nSubFrames ); +#endif + +static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struct *st_ivas, const int16_t max_band_decorr, float Rmat[3][3] ); + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +#ifdef JBM_TSM_ON_TCS +static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); + +static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); + +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); +#else +static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); + +static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, float Rmat[3][3] ); + +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, float Rmat[3][3] ); +#endif + +#else +static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const uint8_t numInputChannels, const uint8_t firstSlot, const uint8_t slotEnd ); + +static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); + +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const uint8_t firstSlot, const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); + +#endif + +static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); + +static void hrtfShGetHrtf( const int16_t bin, const int16_t aziDeg, const int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp ); + +static void getDirectPartGains( const int16_t bin, int16_t aziDeg, int16_t eleDeg, float *lRealp, float *lImagp, float *rRealp, float *rImagp, const uint8_t stereoMode, float Rmat[3][3] ); + +static void matrixMul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); + +static void matrixTransp2Mul( float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ); + +#ifndef FIX_417_TD_DECORR_BRATE_SW +static float configure_reqularization_factor( const IVAS_FORMAT ivas_format, const int32_t ivas_brate ); +#endif + +#ifdef JBM_TSM_ON_TCS +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_dirac_dec_binaural_process_output_sf( Decoder_Struct *st_ivas, float *output_f[], float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const uint8_t numInChannels ); + +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_sf( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const uint8_t slotEnd, const uint8_t nBins, float Rmat[3][3] ); + +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_sf( Decoder_Struct *st_ivas, float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], int16_t azimuth[CLDFB_NO_CHANNELS_MAX], int16_t elevation[CLDFB_NO_CHANNELS_MAX], float energy_ratio1[CLDFB_NO_CHANNELS_MAX], float spreadCoherence[CLDFB_NO_CHANNELS_MAX], float surroundingCoherence[CLDFB_NO_CHANNELS_MAX], float Rmat[3][3] ); + +static void ivas_dirac_dec_binaural_internal_sf( Decoder_Struct *st_ivas, float *output_f[], const int16_t nchan_transport ); + +static void ivas_dirac_dec_decorrelate_slot_sf( DIRAC_DEC_HANDLE hDirAC, const int8_t slot, float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); +#endif +#endif +/*------------------------------------------------------------------------- + * ivas_dirac_dec_init_binaural_data() + * + * Initialize parametric binaural renderer + *------------------------------------------------------------------------*/ + +ivas_error ivas_dirac_dec_init_binaural_data( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ +) +{ + DIRAC_DEC_BIN_HANDLE hBinaural; + int16_t nBins; + int32_t output_Fs; + RENDERER_TYPE renderer_type; + int16_t j, k, bin; + float binCenterFreq, tmpFloat; + ivas_error error; + + hBinaural = st_ivas->hDiracDecBin; + + if ( hBinaural == NULL ) + { + if ( ( hBinaural = (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 " ); + } + + hBinaural->hTdDecorr = NULL; + hBinaural->hReverb = NULL; + } + + nBins = st_ivas->hDirAC->num_freq_bands; + output_Fs = st_ivas->hDecoderConfig->output_Fs; + renderer_type = st_ivas->renderer_type; + + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + for ( k = 0; k < BINAURAL_CHANNELS + 1; k++ ) + { + set_zero( hBinaural->processMtxRe[j][k], nBins ); + set_zero( hBinaural->processMtxIm[j][k], nBins ); + } + + for ( k = 0; k < BINAURAL_CHANNELS; k++ ) + { + set_zero( hBinaural->processMtxDecRe[j][k], nBins ); + set_zero( hBinaural->processMtxDecIm[j][k], nBins ); + } + set_zero( hBinaural->ChEnePrev[j], nBins ); + set_zero( hBinaural->ChEneOutPrev[j], nBins ); + } + set_zero( hBinaural->ChCrossRePrev, nBins ); + set_zero( hBinaural->ChCrossImPrev, nBins ); + set_zero( hBinaural->ChCrossReOutPrev, nBins ); + set_zero( hBinaural->ChCrossImOutPrev, nBins ); + hBinaural->renderStereoOutputInsteadOfBinaural = 0; + +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS + hBinaural->useSubframeMode = 1; +#endif + +#ifndef FIX_417_TD_DECORR_BRATE_SW + hBinaural->useTdDecorr = 0; + if ( st_ivas->ivas_format == SBA_FORMAT ) + { + if ( st_ivas->nchan_transport == 1 ) + { + hBinaural->useTdDecorr = 1; + } + } + else if ( st_ivas->ivas_format == MASA_FORMAT ) + { + if ( ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_48k && st_ivas->nchan_transport == 1 ) || st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + hBinaural->useTdDecorr = 1; + } + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + if ( ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_48k && st_ivas->nchan_transport == 1 ) ) + { + hBinaural->useTdDecorr = 1; + } + } +#endif + + 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 ); + hBinaural->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + } + + for ( bin = 0; bin < BINAURAL_COHERENCE_DIFFERENCE_BINS; bin++ ) + { + hBinaural->diffuseFieldCoherenceX[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceX[bin]; + hBinaural->diffuseFieldCoherenceY[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceY[bin]; + hBinaural->diffuseFieldCoherenceZ[bin] = hBinaural->diffuseFieldCoherence[bin] + diffuseFieldCoherenceDifferenceZ[bin]; + } + + if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ + { + set_f( hBinaural->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hBinaural->hReverb = NULL; + } + else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ + { + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hBinaural->earlyPartEneCorrection, nBins ); + + /* reconfiguration needed when Reverb. parameters are changed -> close and open the handle again */ +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + if ( hBinaural->hReverb != NULL && ( ( hBinaural->hReverb->numBins != nBins ) || + ( hBinaural->hReverb->blockSize != CLDFB_SLOTS_PER_SUBFRAME ) ) ) + { + ivas_binaural_reverb_close( &( hBinaural->hReverb ) ); + } + + if ( hBinaural->hReverb == NULL ) + { +#if defined( JBM_TSM_ON_TCS ) && !defined( FIX_355_REFACTOR_PARAMBIN_TO_5MS ) + int16_t reverbBlockSize = st_ivas->hDecoderConfig->voip_active ? 1 : CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; + if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, + nBins, + reverbBlockSize, NULL, + st_ivas->hIntSetup.output_config, + output_Fs, + RENDERER_BINAURAL_PARAMETRIC_ROOM, + st_ivas->hHrtfFastConv, + st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + +#else + if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, + nBins, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, + st_ivas->hIntSetup.output_config, + output_Fs, + RENDERER_BINAURAL_PARAMETRIC_ROOM, + st_ivas->hHrtfFastConv, + st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + } +#else + if ( hBinaural->hReverb != NULL && ( ( hBinaural->hReverb->numBins != nBins ) || + ( hBinaural->useSubframeMode && hBinaural->hReverb->blockSize != CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ) || + ( !hBinaural->useSubframeMode && hBinaural->hReverb->blockSize != CLDFB_NO_COL_MAX ) ) ) + { + ivas_binaural_reverb_close( &( hBinaural->hReverb ) ); + } + + if ( hBinaural->hReverb == NULL ) + { + if ( hBinaural->useSubframeMode ) + { +#ifdef JBM_TSM_ON_TCS + reverbBlockSize = st_ivas->hDecoderConfig->voip_active ? 1 : CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; + if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, + nBins, + reverbBlockSize, NULL, + st_ivas->hIntSetup.output_config, + output_Fs, + RENDERER_BINAURAL_PARAMETRIC_ROOM, + st_ivas->hHrtfFastConv, + st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + +#else + if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, + nBins, + CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, + st_ivas->hIntSetup.output_config, + output_Fs, + RENDERER_BINAURAL_PARAMETRIC_ROOM, + st_ivas->hHrtfFastConv, + st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) +#endif + { + return error; + } + } + else + { + if ( ( error = ivas_binaural_reverb_open( &hBinaural->hReverb, + nBins, + CLDFB_NO_COL_MAX, + NULL, + st_ivas->hIntSetup.output_config, + output_Fs, + RENDERER_BINAURAL_PARAMETRIC_ROOM, + st_ivas->hHrtfFastConv, + st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } +#endif + } + else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + set_f( hBinaural->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hBinaural->hReverb = NULL; + hBinaural->renderStereoOutputInsteadOfBinaural = 1; + } + else /* Not valid renderer type for this renderer */ + { + assert( false ); + } + +#ifdef FIX_417_TD_DECORR_BRATE_SW + if ( hBinaural->hTdDecorr == NULL ) + { + hBinaural->useTdDecorr = 0; + } + + 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, &( hBinaural->hTdDecorr ), &( hBinaural->useTdDecorr ) ) ) != IVAS_ERR_OK ) + { + return error; + } +#else + if ( hBinaural->useTdDecorr ) + { + if ( st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_13k2 && st_ivas->ivas_format == SBA_FORMAT ) + { + if ( hBinaural->hTdDecorr == NULL ) + { + ivas_td_decorr_dec_open( &( hBinaural->hTdDecorr ), output_Fs, 3, 1 ); + } + + if ( st_ivas->hDecoderConfig->ivas_total_brate < IVAS_24k4 ) + { + hBinaural->hTdDecorr->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN_LOW_BR; + } + else + { + hBinaural->hTdDecorr->pTrans_det->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC_PARA_BIN; + } + } + else + { + ivas_td_decorr_dec_open( &( hBinaural->hTdDecorr ), output_Fs, 3, 0 ); + } + } + else + { + ivas_td_decorr_dec_close( &( hBinaural->hTdDecorr ) ); + } +#endif + + hBinaural->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); + + st_ivas->hDiracDecBin = hBinaural; + +#ifdef JBM_TSM_ON_TCS + /* allocate transport channels*/ + if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) + { + int16_t nchan_to_allocate; + + nchan_to_allocate = 2 * BINAURAL_CHANNELS; + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + +#endif /* JBM_TMS_ON_TCS*/ + + return IVAS_ERR_OK; +} + + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_close_binaural_data() + * + * Close parametric binaural renderer + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec_close_binaural_data( + DIRAC_DEC_BIN_HANDLE *hBinaural /* i/o: decoder DirAC binaural data handle */ +) +{ + if ( hBinaural == NULL || *hBinaural == NULL ) + { + return; + } + + if ( ( *hBinaural )->hReverb != NULL ) + { + ivas_binaural_reverb_close( &( ( *hBinaural )->hReverb ) ); + } + + ivas_td_decorr_dec_close( &( ( *hBinaural )->hTdDecorr ) ); + + free( *hBinaural ); + *hBinaural = NULL; + + return; +} + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_binaural_copy_hrtfs() + * + * Temporary function for copying HRTF data from rom tables if no binary + * file was given. + *------------------------------------------------------------------------*/ + +ivas_error ivas_dirac_dec_binaural_copy_hrtfs( + HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ +) +{ + int16_t i, j; + if ( hHrtfParambin != NULL && *hHrtfParambin != NULL ) + { + /* Tables already loaded from file */ + return IVAS_ERR_OK; + } + else + { + /* Initialise tables from ROM */ + HRTFS_PARAMBIN *hrtfParambin; + + if ( ( hrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for parametric binauralizer HRTF tables" ); + } + + for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + { + for ( j = 0; j < HRTF_SH_CHANNELS; j++ ) + { + mvr2r( hrtfShCoeffsRe[i][j], hrtfParambin->hrtfShCoeffsRe[i][j], HRTF_NUM_BINS ); + mvr2r( hrtfShCoeffsIm[i][j], hrtfParambin->hrtfShCoeffsIm[i][j], HRTF_NUM_BINS ); + } + } + + mvr2r( parametricReverberationTimes, hrtfParambin->parametricReverberationTimes, CLDFB_NO_CHANNELS_MAX ); + mvr2r( parametricReverberationEneCorrections, hrtfParambin->parametricReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); + mvr2r( parametricEarlyPartEneCorrection, hrtfParambin->parametricEarlyPartEneCorrection, CLDFB_NO_CHANNELS_MAX ); + + *hHrtfParambin = hrtfParambin; + } + + return IVAS_ERR_OK; +} + +#ifdef JBM_TSM_ON_TCS +void ivas_dirac_dec_binaural_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + const int16_t nchan_transport, + float *output_f[] /* o : rendered time signal */ +) +{ + int16_t slots_to_render, first_sf, last_sf, subframe_idx; + uint16_t slot_size, ch; + uint16_t nchan_out; + DIRAC_DEC_HANDLE hDirAC; + float *output_f_local[MAX_OUTPUT_CHANNELS]; + + hDirAC = st_ivas->hDirAC; + nchan_out = BINAURAL_CHANNELS; +#ifdef DEBUGGING + assert( hDirAC ); +#endif + for ( ch = 0; ch < nchan_out; ch++ ) + { + output_f_local[ch] = output_f[ch]; + } + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min( hDirAC->num_slots - hDirAC->slots_rendered, nSamplesAsked / slot_size ); + *nSamplesRendered = slots_to_render * slot_size; + first_sf = hDirAC->subframes_rendered; + last_sf = first_sf; + while ( slots_to_render > 0 ) + { + slots_to_render -= hDirAC->subframe_nbslots[last_sf]; + last_sf++; + } +#ifdef DEBUGGING + assert( slots_to_render == 0 ); +#endif + for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) + { + int16_t n_samples_sf = slot_size * hDirAC->subframe_nbslots[subframe_idx]; +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + ivas_dirac_dec_binaural_internal( st_ivas, output_f_local, nchan_transport, subframe_idx ); +#else + ivas_dirac_dec_binaural_internal_sf( st_ivas, output_f_local, nchan_transport ); +#endif + for ( ch = 0; ch < nchan_out; ch++ ) + { + output_f_local[ch] += n_samples_sf; + } + } + if ( hDirAC->slots_rendered == hDirAC->num_slots ) + { + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + DEFAULT_JBM_SUBFRAMES_5MS ) % st_ivas->hDirAC->dirac_md_buffer_length; + } + *nSamplesAvailable = ( hDirAC->num_slots - hDirAC->slots_rendered ) * slot_size; + + return; +} +#endif + +/*------------------------------------------------------------------------- + * ivas_dirac_dec_binaural() + * + * Parametric binaural renderer main function + *------------------------------------------------------------------------*/ + +void ivas_dirac_dec_binaural( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_transport /* i : number of transport channels */ +) +{ +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + int16_t subframe; +#endif +#ifdef JBM_TSM_ON_TCS + float cng_td_buffer[L_FRAME16k]; + float *p_output[MAX_OUTPUT_CHANNELS]; + int16_t ch; + int16_t slot_size; + int16_t numInChannels; + + slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); + for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) + { + p_output[ch] = &output_f[ch][0]; + } + numInChannels = nchan_transport; + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + numInChannels++; + } + for ( ch = 0; ch < numInChannels; ch++ ) + { + st_ivas->hTcBuffer->tc[ch] = &output_f[ch][0]; + } + + ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) + { + ivas_spar_dec_set_render_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); + } + +#endif + + if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + float *decorr_signal[BINAURAL_CHANNELS]; +#ifndef JBM_TSM_ON_TCS + int16_t ch; +#endif + int16_t output_frame; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + decorr_signal[ch] = (float *) &( output_f[ch + BINAURAL_CHANNELS][0] ); +#ifdef JBM_TSM_ON_TCS + st_ivas->hTcBuffer->tc[ch + BINAURAL_CHANNELS] = decorr_signal[ch]; +#endif + } + output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); +#ifdef JBM_TSM_ON_TCS + { + ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_output, decorr_signal, output_frame ); + } +#else + ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, output_f, decorr_signal, output_frame ); +#endif + } +#ifdef JBM_TSM_ON_TCS + if ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) + { + Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; + st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; + generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[nchan_transport], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna ); + } +#endif + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) + { +#ifdef JBM_TSM_ON_TCS + int16_t n_samples_sf = slot_size * st_ivas->hDirAC->subframe_nbslots[subframe]; + ivas_dirac_dec_binaural_internal( st_ivas, p_output, nchan_transport, subframe ); + for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) + { + p_output[ch] += n_samples_sf; + } + st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + 1 ) % st_ivas->hDirAC->dirac_md_buffer_length; +#else + ivas_dirac_dec_binaural_internal( st_ivas, output_f, nchan_transport, subframe ); +#endif + } +#else + if ( st_ivas->hDiracDecBin->useSubframeMode ) + { + uint8_t subframe; + for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) + { + ivas_dirac_dec_binaural_internal( st_ivas, output_f, nchan_transport, subframe, 1u ); + } + } + else + { + ivas_dirac_dec_binaural_internal( st_ivas, output_f, nchan_transport, 0u, (uint8_t) MAX_PARAM_SPATIAL_SUBFRAMES ); + } +#endif +#ifdef JBM_TSM_ON_TCS + for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) + { + st_ivas->hTcBuffer->tc[ch] = NULL; + } +#endif + return; +} + + +/*------------------------------------------------------------------------- + * Local functions + *------------------------------------------------------------------------*/ +#ifdef JBM_TSM_ON_TCS +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_dirac_dec_binaural_internal_sf( + Decoder_Struct *st_ivas, + float *output_f[], + const int16_t nchan_transport ) +{ + DIRAC_DEC_HANDLE hDirAC; + uint8_t slot, ch, nBins, numInChannels; + float Cldfb_RealBuffer_in[2 * BINAURAL_CHANNELS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_in[2 * BINAURAL_CHANNELS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + /* local copies of azi, ele, diffuseness */ + int16_t azimuth[CLDFB_NO_CHANNELS_MAX]; + int16_t elevation[CLDFB_NO_CHANNELS_MAX]; + float spreadCoherence[CLDFB_NO_CHANNELS_MAX]; + float surroundingCoherence[CLDFB_NO_CHANNELS_MAX]; + float energy_ratio1[CLDFB_NO_CHANNELS_MAX]; + float Rmat[3][3]; + uint16_t subframe_idx, slot_idx_start; + int16_t max_band_decorr; + DIFFUSE_DISTRIBUTION_DATA diffuseDistData; + + + hDirAC = st_ivas->hDirAC; + nBins = (uint8_t) hDirAC->num_freq_bands; + + /* The input channel number at this processing function (not nchan_transport) */ + numInChannels = BINAURAL_CHANNELS; + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + numInChannels++; + } + + Rmat[0][0] = 1.0f; + Rmat[0][1] = 0.0f; + Rmat[0][2] = 0.0f; + + Rmat[1][0] = 0.0f; + Rmat[1][1] = 1.0f; + Rmat[1][2] = 0.0f; + + Rmat[2][0] = 0.0f; + Rmat[2][1] = 0.0f; + Rmat[2][2] = 1.0f; + + slot_idx_start = hDirAC->slots_rendered; + subframe_idx = hDirAC->subframes_rendered; + + /* copy parameters into local buffers*/ + mvs2s( hDirAC->azimuth[hDirAC->render_to_md_map[subframe_idx]], azimuth, hDirAC->num_freq_bands ); + mvs2s( hDirAC->elevation[hDirAC->render_to_md_map[subframe_idx]], elevation, hDirAC->num_freq_bands ); + mvr2r( hDirAC->spreadCoherence[hDirAC->render_to_md_map[subframe_idx]], spreadCoherence, hDirAC->num_freq_bands ); + mvr2r( hDirAC->surroundingCoherence[hDirAC->render_to_md_map[subframe_idx]], surroundingCoherence, hDirAC->num_freq_bands ); + mvr2r( hDirAC->energy_ratio1[hDirAC->render_to_md_map[subframe_idx]], energy_ratio1, hDirAC->num_freq_bands ); + + /* CLDFB Analysis of input */ + for ( slot = 0; slot < hDirAC->subframe_nbslots[hDirAC->subframes_rendered]; slot++ ) + { + for ( ch = 0; ch < numInChannels; ch++ ) + { + if ( ch == 0 || nchan_transport == 2 ) + { + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[ch][nBins * ( slot + slot_idx_start )] ), + Cldfb_RealBuffer_in[ch][slot], + Cldfb_ImagBuffer_in[ch][slot], + nBins, st_ivas->cldfbAnaDec[ch] ); + } + else if ( st_ivas->nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ + { + /* At mono input duplicate the channel to dual-mono */ + mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); + mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); + } + else /* when nchan_transport == 1 and ch == 1 */ + { + /* CNA and HB FD-CNG*/ + if ( st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) + { + int16_t numCoreBands, b; + + numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; + + + generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], + st_ivas->hTcBuffer->tc[nchan_transport], + Cldfb_RealBuffer_in[2][slot], Cldfb_ImagBuffer_in[2][slot], + slot + slot_idx_start, + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, + ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); + + generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ + NULL, + Cldfb_RealBuffer_in[1][slot], Cldfb_ImagBuffer_in[1][slot], + slot + slot_idx_start, + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, + ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); + + /* LB: Copy first channel + LB-CNG to first and second channels with same scaling (dual-mono)*/ + for ( b = 0; b < numCoreBands; b++ ) + { + Cldfb_RealBuffer_in[0][slot][b] = INV_SQRT2 * ( Cldfb_RealBuffer_in[0][slot][b] + Cldfb_RealBuffer_in[2][slot][b] ); + Cldfb_RealBuffer_in[1][slot][b] = Cldfb_RealBuffer_in[0][slot][b]; + Cldfb_ImagBuffer_in[0][slot][b] = INV_SQRT2 * ( Cldfb_ImagBuffer_in[0][slot][b] + Cldfb_ImagBuffer_in[2][slot][b] ); + Cldfb_ImagBuffer_in[1][slot][b] = Cldfb_ImagBuffer_in[0][slot][b]; + } + + /* HB: Copy first channel to second channel and add HB-CNGs with different scalings*/ + for ( ; b < nBins; b++ ) + { + Cldfb_RealBuffer_in[0][slot][b] *= INV_SQRT2; + Cldfb_RealBuffer_in[1][slot][b] = Cldfb_RealBuffer_in[0][slot][b] + 0.5f * Cldfb_RealBuffer_in[1][slot][b] + Cldfb_RealBuffer_in[0][slot][b]; + Cldfb_RealBuffer_in[0][slot][b] += 0.5f * Cldfb_RealBuffer_in[2][slot][b]; + + Cldfb_ImagBuffer_in[0][slot][b] *= INV_SQRT2; + Cldfb_ImagBuffer_in[1][slot][b] = Cldfb_ImagBuffer_in[0][slot][b] + 0.5f * Cldfb_ImagBuffer_in[1][slot][b]; + Cldfb_ImagBuffer_in[0][slot][b] += 0.5f * Cldfb_ImagBuffer_in[2][slot][b]; + } + } + else + { + /* At mono input duplicate the channel to dual-mono, and apply gain + correction to ensure same overall level as in stereo mode */ + v_multc( Cldfb_RealBuffer_in[0][slot], INV_SQRT_2, Cldfb_RealBuffer_in[0][slot], nBins ); + v_multc( Cldfb_ImagBuffer_in[0][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[0][slot], nBins ); + + mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); + mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); + } + } + } + + if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + for ( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) + { + cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[ch][nBins * ( slot + slot_idx_start )] ), + Cldfb_RealBuffer_in[ch][slot], + Cldfb_ImagBuffer_in[ch][slot], + nBins, st_ivas->cldfbAnaDec[ch] ); + + if ( st_ivas->nchan_transport == 1 && st_ivas->ivas_format == SBA_FORMAT ) + { + v_multc( Cldfb_RealBuffer_in[ch][slot], INV_SQRT_2, Cldfb_RealBuffer_in[ch][slot], nBins ); + v_multc( Cldfb_ImagBuffer_in[ch][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[ch][slot], nBins ); + } + } + } + } + + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) + { + st_ivas->hDirAC->hDiffuseDist = &diffuseDistData; + ivas_spar_param_to_masa_param_mapping_sf( st_ivas, azimuth, elevation, energy_ratio1, spreadCoherence, surroundingCoherence, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in ); + + ivas_sba_prototype_renderer_sf( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in ); + + /* we are done with SPAR, update SPAR info*/ + st_ivas->hSpar->slots_rendered += st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered]; + st_ivas->hSpar->subframes_rendered++; + } + + if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) + { + QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[subframe_idx], Rmat ); + + if ( nchan_transport == 2 ) + { + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_sf( st_ivas->hHeadTrackData, Cldfb_ImagBuffer_in, Cldfb_RealBuffer_in, (uint8_t) hDirAC->subframe_nbslots[subframe_idx], nBins, Rmat ); + } + } + + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_sf( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, azimuth, elevation, energy_ratio1, spreadCoherence, surroundingCoherence, Rmat ); + + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + max_band_decorr = 0; + } + else if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + max_band_decorr = CLDFB_NO_CHANNELS_MAX; + } + else + { + max_band_decorr = st_ivas->hDirAC->h_freq_domain_decorr_ap_params->max_band_decorr; + } + + ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat ); + + ivas_dirac_dec_binaural_process_output_sf( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels ); + + /* we are done with DirAC, update DirAC info*/ + st_ivas->hDirAC->slots_rendered += st_ivas->hDirAC->subframe_nbslots[st_ivas->hDirAC->subframes_rendered]; + st_ivas->hDirAC->subframes_rendered++; + + st_ivas->hDirAC->hDiffuseDist = NULL; + + return; +} +#endif +#endif + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_dirac_dec_binaural_internal( + Decoder_Struct *st_ivas, +#ifdef JBM_TSM_ON_TCS + float *output_f[], +#else + float output_f[][L_FRAME48k], +#endif + const int16_t nchan_transport, + const int16_t subframe ) +{ + DIRAC_DEC_HANDLE hDirAC; + int16_t slot, ch, numInChannels; + float Cldfb_RealBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_in[4][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Rmat[3][3]; + int16_t max_band_decorr; + DIFFUSE_DISTRIBUTION_DATA diffuseDistData; + int16_t nBins, offsetSamples; + + hDirAC = st_ivas->hDirAC; + nBins = hDirAC->num_freq_bands; +#ifdef JBM_TSM_ON_TCS + offsetSamples = hDirAC->slots_rendered * nBins; +#else + offsetSamples = subframe * CLDFB_SLOTS_PER_SUBFRAME * nBins; +#endif + + /* The input channel number at this processing function (not nchan_transport) */ + numInChannels = BINAURAL_CHANNELS; + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + numInChannels++; + } + + Rmat[0][0] = 1.0f; + Rmat[0][1] = 0.0f; + Rmat[0][2] = 0.0f; + + Rmat[1][0] = 0.0f; + Rmat[1][1] = 1.0f; + Rmat[1][2] = 0.0f; + + Rmat[2][0] = 0.0f; + Rmat[2][1] = 0.0f; + Rmat[2][2] = 1.0f; + + /* CLDFB Analysis of input */ +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) +#else + for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) +#endif + { + for ( ch = 0; ch < numInChannels; ch++ ) + { + if ( ch == 0 || nchan_transport == 2 ) + { + cldfbAnalysis_ts( +#ifdef JBM_TSM_ON_TCS + &( st_ivas->hTcBuffer->tc[ch][nBins * slot + offsetSamples] ), +#else + &( output_f[ch][nBins * slot + offsetSamples] ), +#endif + Cldfb_RealBuffer_in[ch][slot], + Cldfb_ImagBuffer_in[ch][slot], + nBins, st_ivas->cldfbAnaDec[ch] ); + } + else if ( st_ivas->nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ + { + /* At mono input duplicate the channel to dual-mono */ + mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); + mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); + } + else /* when nchan_transport == 1 and ch == 1 */ + { + /* CNA and HB FD-CNG*/ + if ( st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) + { + int16_t numCoreBands, b; + int16_t slotInFrame; + + numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; +#ifdef JBM_TSM_ON_TCS + slotInFrame = hDirAC->slots_rendered + slot; +#else + slotInFrame = subframe * CLDFB_SLOTS_PER_SUBFRAME + slot; +#endif + + generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], +#ifdef JBM_TSM_ON_TCS + st_ivas->hTcBuffer->tc[nchan_transport], +#else + &( output_f[1][L_FRAME48k - L_FRAME16k] ), /*used as temporary static buffer for the whole frame*/ +#endif + Cldfb_RealBuffer_in[2][slot], Cldfb_ImagBuffer_in[2][slot], + slotInFrame, + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, + ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); + + generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ + NULL, + Cldfb_RealBuffer_in[1][slot], Cldfb_ImagBuffer_in[1][slot], + slotInFrame, + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, + ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); + + /* LB: Copy first channel + LB-CNG to first and second channels with same scaling (dual-mono)*/ + for ( b = 0; b < numCoreBands; b++ ) + { + Cldfb_RealBuffer_in[0][slot][b] = INV_SQRT2 * ( Cldfb_RealBuffer_in[0][slot][b] + Cldfb_RealBuffer_in[2][slot][b] ); + Cldfb_RealBuffer_in[1][slot][b] = Cldfb_RealBuffer_in[0][slot][b]; + Cldfb_ImagBuffer_in[0][slot][b] = INV_SQRT2 * ( Cldfb_ImagBuffer_in[0][slot][b] + Cldfb_ImagBuffer_in[2][slot][b] ); + Cldfb_ImagBuffer_in[1][slot][b] = Cldfb_ImagBuffer_in[0][slot][b]; + } + + /* HB: Copy first channel to second channel and add HB-CNGs with different scalings*/ + for ( ; b < nBins; b++ ) + { + Cldfb_RealBuffer_in[0][slot][b] *= INV_SQRT2; + Cldfb_RealBuffer_in[1][slot][b] = Cldfb_RealBuffer_in[0][slot][b] + 0.5f * Cldfb_RealBuffer_in[1][slot][b] + Cldfb_RealBuffer_in[0][slot][b]; + Cldfb_RealBuffer_in[0][slot][b] += 0.5f * Cldfb_RealBuffer_in[2][slot][b]; + + Cldfb_ImagBuffer_in[0][slot][b] *= INV_SQRT2; + Cldfb_ImagBuffer_in[1][slot][b] = Cldfb_ImagBuffer_in[0][slot][b] + 0.5f * Cldfb_ImagBuffer_in[1][slot][b]; + Cldfb_ImagBuffer_in[0][slot][b] += 0.5f * Cldfb_ImagBuffer_in[2][slot][b]; + } + } + else + { + /* At mono input duplicate the channel to dual-mono, and apply gain + correction to ensure same overall level as in stereo mode */ + v_multc( Cldfb_RealBuffer_in[0][slot], INV_SQRT_2, Cldfb_RealBuffer_in[0][slot], nBins ); + v_multc( Cldfb_ImagBuffer_in[0][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[0][slot], nBins ); + + mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); + mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); + } + } + } + + if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + for ( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) + { + cldfbAnalysis_ts( +#ifdef JBM_TSM_ON_TCS + &( st_ivas->hTcBuffer->tc[ch][nBins * slot + offsetSamples] ), +#else + &( output_f[ch][nBins * slot + offsetSamples] ), +#endif + Cldfb_RealBuffer_in[ch][slot], + Cldfb_ImagBuffer_in[ch][slot], + nBins, st_ivas->cldfbAnaDec[ch] ); + + if ( st_ivas->nchan_transport == 1 && st_ivas->ivas_format == SBA_FORMAT ) + { + v_multc( Cldfb_RealBuffer_in[ch][slot], INV_SQRT_2, Cldfb_RealBuffer_in[ch][slot], nBins ); + v_multc( Cldfb_ImagBuffer_in[ch][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[ch][slot], nBins ); + } + } + } + } + + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) + { + st_ivas->hDirAC->hDiffuseDist = &diffuseDistData; + + ivas_spar_param_to_masa_param_mapping( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe ); + + ivas_sba_prototype_renderer( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe ); + } + + if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) + { + QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[subframe], Rmat ); + + if ( nchan_transport == 2 ) + { +#ifdef JBM_TSM_ON_TCS + adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); + + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); +#else + adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, Rmat ); + + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, Rmat ); +#endif + } + } + + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, subframe ); + + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + max_band_decorr = 0; + } + else if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + max_band_decorr = CLDFB_NO_CHANNELS_MAX; + } + else + { + max_band_decorr = st_ivas->hDirAC->h_freq_domain_decorr_ap_params->max_band_decorr; + } + + ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat ); + + ivas_dirac_dec_binaural_process_output( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, subframe ); + + st_ivas->hDirAC->hDiffuseDist = NULL; + + +#ifdef JBM_TSM_ON_TCS + hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe]; + hDirAC->subframes_rendered++; +#else + hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; +#endif + + return; +} +#else +static void ivas_dirac_dec_binaural_internal( + Decoder_Struct *st_ivas, + float output_f[][L_FRAME48k], + const int16_t nchan_transport, + const uint8_t firstSubframe, + const uint8_t nSubframes ) +{ + DIRAC_DEC_HANDLE hDirAC; + uint8_t slot, ch, nBins, numInChannels; + float Cldfb_RealBuffer_in[4][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_in[4][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float Rmat[3][3]; + uint8_t firstSlot, slotEnd; + int16_t max_band_decorr; + DIFFUSE_DISTRIBUTION_DATA diffuseDistData; + + firstSlot = firstSubframe * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); + slotEnd = ( firstSubframe + nSubframes ) * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); + + hDirAC = st_ivas->hDirAC; + nBins = (uint8_t) hDirAC->num_freq_bands; + + /* The input channel number at this processing function (not nchan_transport) */ + numInChannels = BINAURAL_CHANNELS; + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + numInChannels++; + } + + Rmat[0][0] = 1.0f; + Rmat[0][1] = 0.0f; + Rmat[0][2] = 0.0f; + + Rmat[1][0] = 0.0f; + Rmat[1][1] = 1.0f; + Rmat[1][2] = 0.0f; + + Rmat[2][0] = 0.0f; + Rmat[2][1] = 0.0f; + Rmat[2][2] = 1.0f; + + /* CLDFB Analysis of input */ + for ( slot = firstSlot; slot < slotEnd; slot++ ) + { + for ( ch = 0; ch < numInChannels; ch++ ) + { + if ( ch == 0 || nchan_transport == 2 ) + { + cldfbAnalysis_ts( &( output_f[ch][nBins * slot] ), + Cldfb_RealBuffer_in[ch][slot], + Cldfb_ImagBuffer_in[ch][slot], + nBins, st_ivas->cldfbAnaDec[ch] ); + } + else if ( st_ivas->nchan_transport == 2 ) /* Stereo signal transmitted as mono with DFT stereo */ + { + /* At mono input duplicate the channel to dual-mono */ + mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); + mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); + } + else /* when nchan_transport == 1 and ch == 1 */ + { + /* CNA and HB FD-CNG*/ + if ( st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) + { + int16_t numCoreBands, b; + + numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; + + generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], +#ifdef JBM_TSM_ON_TCS + st_ivas->hTcBuffer->tc[1], +#else + &( output_f[1][L_FRAME48k - L_FRAME16k] ), /*used as temporary static buffer for the whole frame*/ +#endif + Cldfb_RealBuffer_in[2][slot], Cldfb_ImagBuffer_in[2][slot], + slot, + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, + ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); + + generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, + st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ + NULL, + Cldfb_RealBuffer_in[1][slot], Cldfb_ImagBuffer_in[1][slot], + slot, + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, + ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ); + + /* LB: Copy first channel + LB-CNG to first and second channels with same scaling (dual-mono)*/ + for ( b = 0; b < numCoreBands; b++ ) + { + Cldfb_RealBuffer_in[0][slot][b] = INV_SQRT2 * ( Cldfb_RealBuffer_in[0][slot][b] + Cldfb_RealBuffer_in[2][slot][b] ); + Cldfb_RealBuffer_in[1][slot][b] = Cldfb_RealBuffer_in[0][slot][b]; + Cldfb_ImagBuffer_in[0][slot][b] = INV_SQRT2 * ( Cldfb_ImagBuffer_in[0][slot][b] + Cldfb_ImagBuffer_in[2][slot][b] ); + Cldfb_ImagBuffer_in[1][slot][b] = Cldfb_ImagBuffer_in[0][slot][b]; + } + + /* HB: Copy first channel to second channel and add HB-CNGs with different scalings*/ + for ( ; b < nBins; b++ ) + { + Cldfb_RealBuffer_in[0][slot][b] *= INV_SQRT2; + Cldfb_RealBuffer_in[1][slot][b] = Cldfb_RealBuffer_in[0][slot][b] + 0.5f * Cldfb_RealBuffer_in[1][slot][b] + Cldfb_RealBuffer_in[0][slot][b]; + Cldfb_RealBuffer_in[0][slot][b] += 0.5f * Cldfb_RealBuffer_in[2][slot][b]; + + Cldfb_ImagBuffer_in[0][slot][b] *= INV_SQRT2; + Cldfb_ImagBuffer_in[1][slot][b] = Cldfb_ImagBuffer_in[0][slot][b] + 0.5f * Cldfb_ImagBuffer_in[1][slot][b]; + Cldfb_ImagBuffer_in[0][slot][b] += 0.5f * Cldfb_ImagBuffer_in[2][slot][b]; + } + } + else + { + /* At mono input duplicate the channel to dual-mono, and apply gain + correction to ensure same overall level as in stereo mode */ + v_multc( Cldfb_RealBuffer_in[0][slot], INV_SQRT_2, Cldfb_RealBuffer_in[0][slot], nBins ); + v_multc( Cldfb_ImagBuffer_in[0][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[0][slot], nBins ); + + mvr2r( Cldfb_RealBuffer_in[0][slot], Cldfb_RealBuffer_in[1][slot], nBins ); + mvr2r( Cldfb_ImagBuffer_in[0][slot], Cldfb_ImagBuffer_in[1][slot], nBins ); + } + } + } + + if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + for ( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) + { + cldfbAnalysis_ts( +#ifdef JBM_TSM_ON_TCS + &( st_ivas->hTcBuffer->tc[ch][nBins * slot] ), +#else + &( output_f[ch][nBins * slot] ), +#endif + Cldfb_RealBuffer_in[ch][slot], + Cldfb_ImagBuffer_in[ch][slot], + nBins, st_ivas->cldfbAnaDec[ch] ); + + if ( st_ivas->nchan_transport == 1 && st_ivas->ivas_format == SBA_FORMAT ) + { + v_multc( Cldfb_RealBuffer_in[ch][slot], INV_SQRT_2, Cldfb_RealBuffer_in[ch][slot], nBins ); + v_multc( Cldfb_ImagBuffer_in[ch][slot], INV_SQRT_2, Cldfb_ImagBuffer_in[ch][slot], nBins ); + } + } + } + } + + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) + { + st_ivas->hDirAC->hDiffuseDist = &diffuseDistData; + + ivas_spar_param_to_masa_param_mapping( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSubframe, nSubframes ); + + ivas_sba_prototype_renderer( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSubframe, nSubframes ); + } + + if ( st_ivas->hHeadTrackData && st_ivas->hHeadTrackData->num_quaternions >= 0 ) + { + QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[firstSubframe], Rmat ); + + if ( nchan_transport == 2 ) + { + adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, firstSlot, slotEnd, nBins, Rmat ); + + ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_ImagBuffer_in, Cldfb_RealBuffer_in, firstSlot, slotEnd, nBins, Rmat ); + } + } + + ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( st_ivas, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Rmat, firstSubframe, nSubframes ); + + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + max_band_decorr = 0; + } + else if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + max_band_decorr = CLDFB_NO_CHANNELS_MAX; + } + else + { + max_band_decorr = st_ivas->hDirAC->h_freq_domain_decorr_ap_params->max_band_decorr; + } + + ivas_dirac_dec_binaural_determine_processing_matrices( st_ivas, max_band_decorr, Rmat ); + + ivas_dirac_dec_binaural_process_output( st_ivas, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, max_band_decorr, numInChannels, firstSlot, slotEnd ); + + st_ivas->hDirAC->hDiffuseDist = NULL; + +#ifdef JBM_TSM_ON_TCS + st_ivas->hDirAC->slots_rendered += ( slotEnd - firstSlot ); + st_ivas->hDirAC->subframes_rendered += nSubframes; +#endif + + return; +} +#endif + + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_dirac_dec_decorrelate_slot( + DIRAC_DEC_HANDLE hDirAC, + const int16_t slot, + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float decRe[][CLDFB_NO_CHANNELS_MAX], + float decIm[][CLDFB_NO_CHANNELS_MAX] ) +#else +static void ivas_dirac_dec_decorrelate_slot( + DIRAC_DEC_HANDLE hDirAC, + const int8_t slot, + float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float decRe[][CLDFB_NO_CHANNELS_MAX], + float decIm[][CLDFB_NO_CHANNELS_MAX] ) +#endif +{ + int16_t offset, ch, bin; + float onset_filter[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, 60 bins */ + float decorrelatedFrameInterleaved[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ + + /* Decorrelation needs interleaved data. Copy left and right signals to proto_frame_f */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) + { + hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; + hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; + } + } + + /* Decorrelate proto signal to decorrelatedFrameInterleaved */ + ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + BINAURAL_CHANNELS, + hDirAC->proto_frame_f, + hDirAC->num_protos_diff, + hDirAC->proto_index_diff, + decorrelatedFrameInterleaved, + onset_filter, + hDirAC->h_freq_domain_decorr_ap_params, + hDirAC->h_freq_domain_decorr_ap_state ); + + /* De-interleave decorrelated signals*/ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) + { + decRe[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset]; + decIm[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset + 1]; + } + } + + return; +} + +#ifdef JBM_TSM_ON_TCS +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_dirac_dec_decorrelate_slot_sf( + DIRAC_DEC_HANDLE hDirAC, + const int8_t slot, + float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float decRe[][CLDFB_NO_CHANNELS_MAX], + float decIm[][CLDFB_NO_CHANNELS_MAX] ) +{ + int16_t offset, ch, bin; + float onset_filter[BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, 60 bins */ + float decorrelatedFrameInterleaved[2 * BINAURAL_CHANNELS * CLDFB_NO_CHANNELS_MAX]; /* 2 ch, real + imag, 60 bins */ + + /* Decorrelation needs interleaved data. Copy left and right signals to proto_frame_f */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) + { + hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset] = inRe[ch][slot][bin]; + hDirAC->proto_frame_f[( bin * BINAURAL_CHANNELS ) + offset + 1] = inIm[ch][slot][bin]; + } + } + + /* Decorrelate proto signal to decorrelatedFrameInterleaved */ + ivas_dirac_dec_decorr_process( hDirAC->num_freq_bands, + hDirAC->num_outputs_diff, + hDirAC->num_protos_diff, + hDirAC->synthesisConf, + BINAURAL_CHANNELS, + hDirAC->proto_frame_f, + hDirAC->num_protos_diff, + hDirAC->proto_index_diff, + decorrelatedFrameInterleaved, + onset_filter, + hDirAC->h_freq_domain_decorr_ap_params, + hDirAC->h_freq_domain_decorr_ap_state ); + + /* De-interleave decorrelated signals*/ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + offset = hDirAC->num_freq_bands * BINAURAL_CHANNELS * ch; + for ( bin = 0; bin < hDirAC->num_freq_bands; bin++ ) + { + decRe[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset]; + decIm[ch][bin] = decorrelatedFrameInterleaved[( bin * BINAURAL_CHANNELS ) + offset + 1]; + } + } + + return; +} + +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_sf( + Decoder_Struct *st_ivas, + float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + int16_t azimuth[CLDFB_NO_CHANNELS_MAX], + int16_t elevation[CLDFB_NO_CHANNELS_MAX], + float energy_ratio1[CLDFB_NO_CHANNELS_MAX], + float spreadCoherence[CLDFB_NO_CHANNELS_MAX], + float surroundingCoherence[CLDFB_NO_CHANNELS_MAX], + float Rmat[3][3] ) +{ + uint8_t ch, slot, bin; + uint8_t separateCenterChannelRendering; + int16_t nBins, idx, subframe; + float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; + DIRAC_DEC_HANDLE hDirAC; + DIRAC_DEC_BIN_HANDLE h; + float IIReneLimiterFactor; + float qualityBasedSmFactor; + float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; + uint8_t applyLowBitRateEQ; + float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; + int16_t md_idx; + + hDirAC = st_ivas->hDirAC; + h = st_ivas->hDiracDecBin; + separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; + nBins = hDirAC->num_freq_bands; /* Actually bins */ + subframe = hDirAC->subframes_rendered; + md_idx = hDirAC->render_to_md_map[hDirAC->subframes_rendered]; + + set_zero( h->ChCrossRe, nBins ); + set_zero( h->ChCrossIm, nBins ); + set_zero( h->ChCrossReOut, nBins ); + set_zero( h->ChCrossImOut, nBins ); + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + set_zero( h->ChEne[ch], nBins ); + set_zero( h->ChEneOut[ch], nBins ); + } + set_zero( h->frameMeanDiffuseness, nBins ); + + set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); + + /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ + applyLowBitRateEQ = 0; + if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MC_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + applyLowBitRateEQ = 1; + if ( st_ivas->hDecoderConfig->ivas_total_brate == IVAS_16k4 ) + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin] * 0.5f + 0.5f; + } + } + else + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin]; + } + } + } + + /* Formulate input and target covariance matrices combining all subframes */ + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); + + /* Calculate input covariance matrix */ + for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots[subframe]; slot++ ) + { + for ( bin = 0; bin < nBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float instEne; + + instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); + instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + h->ChEne[ch][bin] += instEne; + subFrameTotalEne[bin] += instEne; + } + h->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; + h->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; + h->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; + h->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; + } + } + + /* Apply EQ at low bit rates */ + if ( applyLowBitRateEQ ) + { + int16_t lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; + + for ( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[bin]; + } + for ( ; bin < nBins; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[lastEqBin]; + } + } + + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 2 ) + { + float tempRe, tempIm; + + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); + + for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots[subframe]; slot++ ) + { + for ( bin = 0; bin < nBins; bin++ ) + { + tempRe = inRe[0][slot][bin] + inRe[1][slot][bin]; + tempIm = inIm[0][slot][bin] + inIm[1][slot][bin]; + subFrameTotalEne[bin] += tempRe * tempRe + tempIm * tempIm; + } + } + } + + /* Determine target covariance matrix containing target binaural properties */ + for ( bin = 0; bin < nBins; bin++ ) + { + float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ + float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ + float diffEne, dirEne, meanEnePerCh; + uint16_t dirIndex; + + /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. + * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the + * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match + * the early spectrum of the BRIR data, using the spectral correction data in + * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ + meanEnePerCh = h->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; + + /* Determine direct part target covariance matrix (for 1 or 2 directions) */ + for ( dirIndex = 0; dirIndex < hDirAC->numSimultaneousDirections; dirIndex++ ) + { + int16_t aziDeg, eleDeg; + float lRealp, lImagp, rRealp, rImagp; + float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; + float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; + + if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ + { + aziDeg = azimuth[bin]; + eleDeg = elevation[bin]; + ratio = energy_ratio1[bin]; + spreadCoh = spreadCoherence[bin]; + } + else /* For second of the two simultaneous directions */ + { + aziDeg = hDirAC->azimuth2[md_idx][bin]; + eleDeg = hDirAC->elevation2[md_idx][bin]; + ratio = hDirAC->energy_ratio2[md_idx][bin]; + spreadCoh = hDirAC->spreadCoherence2[md_idx][bin]; + } + diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ + + if ( separateCenterChannelRendering ) + { + /* In masa + mono rendering mode, the center directions originate from phantom sources, so the + * spread coherence is increased */ + float aziRad, eleRad, doaVectorX, spatialAngleDeg, altSpreadCoh; + + aziRad = (float) aziDeg * PI_OVER_180; + eleRad = (float) eleDeg * PI_OVER_180; + doaVectorX = cosf( aziRad ) * cosf( eleRad ); + spatialAngleDeg = acosf( doaVectorX ) * _180_OVER_PI; + altSpreadCoh = 1.0f - ( spatialAngleDeg / 30.0f ); + spreadCoh = max( spreadCoh, altSpreadCoh ); + } + + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + if ( h->renderStereoOutputInsteadOfBinaural ) + { + /* Synthesizing spread coherence is not needed for stereo loudspeaker output, + * as directional sound is reproduced with two loudspeakers in any case */ + spreadCoh = 0.0f; + } + + if ( spreadCoh > 0.0f ) + { + float centerMul, sidesMul; + float hrtfEneCenter, hrtfEneSides, hrtfEneRealized, eneCorrectionFactor; + float w1, w2, w3, eq; + + hrtfEneCenter = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + + /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. + * The following formulas determine the gains for these sources. + * spreadCoh = 0: Only panning + * spreadCoh = 0.5: Three sources coherent panning (e.g. 30 0 -30 deg azi) + * spreadCoh = 1.0: Two sources coherent panning with gap (as above, but center is silent) */ + if ( spreadCoh < 0.5f ) + { + /* 0.0f < spreadCoh < 0.5f */ + sidesMul = 0.5774f * spreadCoh * 2.0f; /* sqrt(1/3) = 0.5774f */ + centerMul = 1.0f - ( spreadCoh * 2.0f ) + sidesMul; + } + else + { + /* 0.5f <= spreadCoh < 1.0f */ + centerMul = 2.0f - ( 2.0f * spreadCoh ); + sidesMul = inv_sqrt( centerMul + 2.0f ); + centerMul *= sidesMul; + } + + /* Apply the gain for the center source of the three coherent sources */ + lRealp *= centerMul; + lImagp *= centerMul; + rRealp *= centerMul; + rImagp *= centerMul; + + /* Apply the gain for the left source of the three coherent sources */ + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Apply the gain for the right source of the three coherent sources. + * -30 degrees to 330 wrapping due to internal functions. */ + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Formulate an eneCorrectionFactor that compensates for the coherent summation of the HRTFs */ + hrtfEneRealized = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + eneCorrectionFactor = ( ( hrtfEneSides * sidesMul * sidesMul ) + + ( hrtfEneCenter * centerMul * centerMul ) ) / + max( 1e-12f, hrtfEneRealized ); + + /* Weighting factors to determine appropriate target spectrum for spread coherent sound */ + if ( spreadCoh < 0.5 ) + { + w1 = 1.0f - 2.0f * spreadCoh; + w2 = 2.0f * spreadCoh; + w3 = 0.0f; + } + else + { + w1 = 0.0f; + w2 = 2.0f - 2.0f * spreadCoh; + w3 = 2.0f * spreadCoh - 1.0f; + } + + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + + /* Apply the target spectrum to the eneCorrectionFactor */ + if ( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */ + { + eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[idx]; + } + else + { + eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[idx] + w3 * spreadCohEne1[idx]; + } + } + + /* Equalize the spread coherent combined HRTFs */ + eq = min( 4.0f, sqrtf( eneCorrectionFactor ) ); + lRealp *= eq; + lImagp *= eq; + rRealp *= eq; + rImagp *= eq; + } + + hrtfEne[0] = ( lRealp * lRealp ) + ( lImagp * lImagp ); + hrtfEne[1] = ( rRealp * rRealp ) + ( rImagp * rImagp ); + hrtfCrossRe = ( lRealp * rRealp ) + ( lImagp * rImagp ); + hrtfCrossIm = ( -lImagp * rRealp ) + ( lRealp * rImagp ); + + /* Add direct part (1 or 2) covariance matrix */ + dirEne = ratio * meanEnePerCh; + h->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ + h->ChEneOut[1][bin] += dirEne * hrtfEne[1]; + h->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ + h->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ + } + + /* Add diffuse / ambient part covariance matrix */ + diffuseness = max( 0.0f, diffuseness ); + diffEne = diffuseness * meanEnePerCh; + surCoh = surroundingCoherence[bin]; + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + { + if ( !h->renderStereoOutputInsteadOfBinaural ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ + diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; + } + } + h->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ + h->ChEneOut[1][bin] += diffEne; + + if ( h->renderStereoOutputInsteadOfBinaural ) + { + /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ + h->ChCrossReOut[bin] += surCoh * diffEne; + } + else /* When rendering binaural, ambience has frequency dependent ICC. */ + { + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) + { + float diffuseFieldCoherence; + diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[bin] * h->diffuseFieldCoherenceZ[bin]; + h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; + } + else + { + h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * h->diffuseFieldCoherence[bin] + surCoh ) * diffEne; + } + } + + /* Store parameters for formulating average diffuseness over frame */ + h->frameMeanDiffuseness[bin] += diffEne; + frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; + } + + + /* Formulate average diffuseness over frame */ + for ( bin = 0; bin < nBins; bin++ ) + { + h->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); + } + + /* Determine encoding quality based additional smoothing factor */ + qualityBasedSmFactor = 1.0f; + if ( st_ivas->hMasa != NULL ) + { + qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; + qualityBasedSmFactor *= qualityBasedSmFactor; + } + + /* Temporal IIR-type smoothing of covariance matrices */ + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); + } + else + { + IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); + } + for ( bin = 0; bin < nBins; bin++ ) + { + float eneRatio, IIReneLimiter; + + /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that + * the energy history (IIR) must not be more than double of the current frame energy. This provides more + * robust performance at energy offsets when compared to typical IIR averaging. */ + eneRatio = ( h->ChEne[0][bin] + h->ChEne[1][bin] ) / fmaxf( 1e-12f, ( h->ChEnePrev[0][bin] + h->ChEnePrev[1][bin] ) ); + IIReneLimiter = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); + + h->ChCrossRe[bin] *= qualityBasedSmFactor; + h->ChCrossIm[bin] *= qualityBasedSmFactor; + h->ChCrossReOut[bin] *= qualityBasedSmFactor; + h->ChCrossImOut[bin] *= qualityBasedSmFactor; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + h->ChEne[ch][bin] *= qualityBasedSmFactor; + h->ChEneOut[ch][bin] *= qualityBasedSmFactor; + } + + h->ChCrossRe[bin] += IIReneLimiter * h->ChCrossRePrev[bin]; + h->ChCrossIm[bin] += IIReneLimiter * h->ChCrossImPrev[bin]; + h->ChCrossReOut[bin] += IIReneLimiter * h->ChCrossReOutPrev[bin]; + h->ChCrossImOut[bin] += IIReneLimiter * h->ChCrossImOutPrev[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + h->ChEne[ch][bin] += IIReneLimiter * h->ChEnePrev[ch][bin]; + h->ChEneOut[ch][bin] += IIReneLimiter * h->ChEneOutPrev[ch][bin]; + } + + /* Store energy values and coefficients for next round */ + h->ChCrossRePrev[bin] = h->ChCrossRe[bin]; + h->ChCrossImPrev[bin] = h->ChCrossIm[bin]; + h->ChCrossReOutPrev[bin] = h->ChCrossReOut[bin]; + h->ChCrossImOutPrev[bin] = h->ChCrossImOut[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + h->ChEnePrev[ch][bin] = h->ChEne[ch][bin]; + h->ChEneOutPrev[ch][bin] = h->ChEneOut[ch][bin]; + } + } + + return; +} +#endif +#endif + + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( + Decoder_Struct *st_ivas, + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float Rmat[3][3], + const int16_t subframe ) +{ + int16_t ch, slot, bin; + uint8_t separateCenterChannelRendering; + int16_t nBins, idx; + float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; + DIRAC_DEC_HANDLE hDirAC; + DIRAC_DEC_BIN_HANDLE h; + float IIReneLimiterFactor; + float qualityBasedSmFactor; + float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; + uint8_t applyLowBitRateEQ; + int16_t dirac_read_idx; + float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; + + hDirAC = st_ivas->hDirAC; + h = st_ivas->hDiracDecBin; + separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; + nBins = hDirAC->num_freq_bands; /* Actually bins */ + + set_zero( h->ChCrossRe, nBins ); + set_zero( h->ChCrossIm, nBins ); + set_zero( h->ChCrossReOut, nBins ); + set_zero( h->ChCrossImOut, nBins ); + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + set_zero( h->ChEne[ch], nBins ); + set_zero( h->ChEneOut[ch], nBins ); + } + set_zero( h->frameMeanDiffuseness, nBins ); + + set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); + + /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ + applyLowBitRateEQ = 0; + if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MC_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + applyLowBitRateEQ = 1; + if ( st_ivas->hDecoderConfig->ivas_total_brate == IVAS_16k4 ) + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin] * 0.5f + 0.5f; + } + } + else + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin]; + } + } + } + + /* Formulate input and target covariance matrices for this subframe */ + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); +#ifdef JBM_TSM_ON_TCS + dirac_read_idx = hDirAC->render_to_md_map[subframe]; +#else + dirac_read_idx = hDirAC->dirac_read_idx; +#endif + + /* Calculate input covariance matrix */ +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) +#else + for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) +#endif + { + for ( bin = 0; bin < nBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float instEne; + + instEne = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ); + instEne += ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + h->ChEne[ch][bin] += instEne; + subFrameTotalEne[bin] += instEne; + } + h->ChCrossRe[bin] += inRe[0][slot][bin] * inRe[1][slot][bin]; + h->ChCrossRe[bin] += inIm[0][slot][bin] * inIm[1][slot][bin]; + h->ChCrossIm[bin] += inRe[0][slot][bin] * inIm[1][slot][bin]; + h->ChCrossIm[bin] -= inIm[0][slot][bin] * inRe[1][slot][bin]; + } + } + + /* Apply EQ at low bit rates */ + if ( applyLowBitRateEQ ) + { + int16_t lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; + + for ( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[bin]; + } + for ( ; bin < nBins; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[lastEqBin]; + } + } + + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 2 ) + { + float tempRe, tempIm; + + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); + +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) +#else + for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) +#endif + { + for ( bin = 0; bin < nBins; bin++ ) + { + tempRe = inRe[0][slot][bin] + inRe[1][slot][bin]; + tempIm = inIm[0][slot][bin] + inIm[1][slot][bin]; + subFrameTotalEne[bin] += tempRe * tempRe + tempIm * tempIm; + } + } + } + + /* Determine target covariance matrix containing target binaural properties */ + for ( bin = 0; bin < nBins; bin++ ) + { + float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ + float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ + float diffEne, dirEne, meanEnePerCh; + int16_t dirIndex; + + /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. + * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the + * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match + * the early spectrum of the BRIR data, using the spectral correction data in + * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ + meanEnePerCh = h->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; + + /* Determine direct part target covariance matrix (for 1 or 2 directions) */ + for ( dirIndex = 0; dirIndex < hDirAC->numSimultaneousDirections; dirIndex++ ) + { + int16_t aziDeg, eleDeg; + float lRealp, lImagp, rRealp, rImagp; + float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; + float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; + + if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ + { + aziDeg = hDirAC->azimuth[dirac_read_idx][bin]; + eleDeg = hDirAC->elevation[dirac_read_idx][bin]; + ratio = hDirAC->energy_ratio1[dirac_read_idx][bin]; + spreadCoh = hDirAC->spreadCoherence[dirac_read_idx][bin]; + } + else /* For second of the two simultaneous directions */ + { + aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; + eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; + ratio = hDirAC->energy_ratio2[dirac_read_idx][bin]; + spreadCoh = hDirAC->spreadCoherence2[dirac_read_idx][bin]; + } + diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ + + if ( separateCenterChannelRendering ) + { + /* In masa + mono rendering mode, the center directions originate from phantom sources, so the + * spread coherence is increased */ + float aziRad, eleRad, doaVectorX, spatialAngleDeg, altSpreadCoh; + + aziRad = (float) aziDeg * PI_OVER_180; + eleRad = (float) eleDeg * PI_OVER_180; + doaVectorX = cosf( aziRad ) * cosf( eleRad ); + spatialAngleDeg = acosf( doaVectorX ) * _180_OVER_PI; + altSpreadCoh = 1.0f - ( spatialAngleDeg / 30.0f ); + spreadCoh = max( spreadCoh, altSpreadCoh ); + } + + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + if ( h->renderStereoOutputInsteadOfBinaural ) + { + /* Synthesizing spread coherence is not needed for stereo loudspeaker output, + * as directional sound is reproduced with two loudspeakers in any case */ + spreadCoh = 0.0f; + } + + if ( spreadCoh > 0.0f ) + { + float centerMul, sidesMul; + float hrtfEneCenter, hrtfEneSides, hrtfEneRealized, eneCorrectionFactor; + float w1, w2, w3, eq; + + hrtfEneCenter = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + + /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. + * The following formulas determine the gains for these sources. + * spreadCoh = 0: Only panning + * spreadCoh = 0.5: Three sources coherent panning (e.g. 30 0 -30 deg azi) + * spreadCoh = 1.0: Two sources coherent panning with gap (as above, but center is silent) */ + if ( spreadCoh < 0.5f ) + { + /* 0.0f < spreadCoh < 0.5f */ + sidesMul = 0.5774f * spreadCoh * 2.0f; /* sqrt(1/3) = 0.5774f */ + centerMul = 1.0f - ( spreadCoh * 2.0f ) + sidesMul; + } + else + { + /* 0.5f <= spreadCoh < 1.0f */ + centerMul = 2.0f - ( 2.0f * spreadCoh ); + sidesMul = inv_sqrt( centerMul + 2.0f ); + centerMul *= sidesMul; + } + + /* Apply the gain for the center source of the three coherent sources */ + lRealp *= centerMul; + lImagp *= centerMul; + rRealp *= centerMul; + rImagp *= centerMul; + + /* Apply the gain for the left source of the three coherent sources */ + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Apply the gain for the right source of the three coherent sources. + * -30 degrees to 330 wrapping due to internal functions. */ + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Formulate an eneCorrectionFactor that compensates for the coherent summation of the HRTFs */ + hrtfEneRealized = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + eneCorrectionFactor = ( ( hrtfEneSides * sidesMul * sidesMul ) + + ( hrtfEneCenter * centerMul * centerMul ) ) / + max( 1e-12f, hrtfEneRealized ); + + /* Weighting factors to determine appropriate target spectrum for spread coherent sound */ + if ( spreadCoh < 0.5 ) + { + w1 = 1.0f - 2.0f * spreadCoh; + w2 = 2.0f * spreadCoh; + w3 = 0.0f; + } + else + { + w1 = 0.0f; + w2 = 2.0f - 2.0f * spreadCoh; + w3 = 2.0f * spreadCoh - 1.0f; + } + + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + + /* Apply the target spectrum to the eneCorrectionFactor */ + if ( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */ + { + eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[idx]; + } + else + { + eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[idx] + w3 * spreadCohEne1[idx]; + } + } + + /* Equalize the spread coherent combined HRTFs */ + eq = min( 4.0f, sqrtf( eneCorrectionFactor ) ); + lRealp *= eq; + lImagp *= eq; + rRealp *= eq; + rImagp *= eq; + } + + hrtfEne[0] = ( lRealp * lRealp ) + ( lImagp * lImagp ); + hrtfEne[1] = ( rRealp * rRealp ) + ( rImagp * rImagp ); + hrtfCrossRe = ( lRealp * rRealp ) + ( lImagp * rImagp ); + hrtfCrossIm = ( -lImagp * rRealp ) + ( lRealp * rImagp ); + + /* Add direct part (1 or 2) covariance matrix */ + dirEne = ratio * meanEnePerCh; + h->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ + h->ChEneOut[1][bin] += dirEne * hrtfEne[1]; + h->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ + h->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ + } + + /* Add diffuse / ambient part covariance matrix */ + diffuseness = max( 0.0f, diffuseness ); + diffEne = diffuseness * meanEnePerCh; + surCoh = hDirAC->surroundingCoherence[dirac_read_idx][bin]; + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + { + if ( !h->renderStereoOutputInsteadOfBinaural ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ + diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; + } + } + h->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ + h->ChEneOut[1][bin] += diffEne; + + if ( h->renderStereoOutputInsteadOfBinaural ) + { + /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ + h->ChCrossReOut[bin] += surCoh * diffEne; + } + else /* When rendering binaural, ambience has frequency dependent ICC. */ + { + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) + { + float diffuseFieldCoherence; +#ifdef JBM_TSM_ON_TCS + diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[bin] * h->diffuseFieldCoherenceZ[bin]; +#else + diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[subframe][bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[subframe][bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[subframe][bin] * h->diffuseFieldCoherenceZ[bin]; +#endif + h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; + } + else + { + h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * h->diffuseFieldCoherence[bin] + surCoh ) * diffEne; + } + } + + /* Store parameters for formulating average diffuseness over frame */ + h->frameMeanDiffuseness[bin] += diffEne; + frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; + } + + /* Formulate average diffuseness over frame */ + for ( bin = 0; bin < nBins; bin++ ) + { + h->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); + } + + /* Determine encoding quality based additional smoothing factor */ + qualityBasedSmFactor = 1.0f; + if ( st_ivas->hMasa != NULL ) + { + qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; + qualityBasedSmFactor *= qualityBasedSmFactor; + } + + /* Temporal IIR-type smoothing of covariance matrices */ + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + IIReneLimiterFactor = 16.0f + ( 1.0f - qualityBasedSmFactor ); + } + else + { + IIReneLimiterFactor = 8.0f + ( 1.0f - qualityBasedSmFactor ); + } + for ( bin = 0; bin < nBins; bin++ ) + { + float eneRatio, IIReneLimiter; + + /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that + * the energy history (IIR) must not be more than double of the current frame energy. This provides more + * robust performance at energy offsets when compared to typical IIR averaging. */ + eneRatio = ( h->ChEne[0][bin] + h->ChEne[1][bin] ) / fmaxf( 1e-12f, ( h->ChEnePrev[0][bin] + h->ChEnePrev[1][bin] ) ); + IIReneLimiter = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); + + h->ChCrossRe[bin] *= qualityBasedSmFactor; + h->ChCrossIm[bin] *= qualityBasedSmFactor; + h->ChCrossReOut[bin] *= qualityBasedSmFactor; + h->ChCrossImOut[bin] *= qualityBasedSmFactor; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + h->ChEne[ch][bin] *= qualityBasedSmFactor; + h->ChEneOut[ch][bin] *= qualityBasedSmFactor; + } + + h->ChCrossRe[bin] += IIReneLimiter * h->ChCrossRePrev[bin]; + h->ChCrossIm[bin] += IIReneLimiter * h->ChCrossImPrev[bin]; + h->ChCrossReOut[bin] += IIReneLimiter * h->ChCrossReOutPrev[bin]; + h->ChCrossImOut[bin] += IIReneLimiter * h->ChCrossImOutPrev[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + h->ChEne[ch][bin] += IIReneLimiter * h->ChEnePrev[ch][bin]; + h->ChEneOut[ch][bin] += IIReneLimiter * h->ChEneOutPrev[ch][bin]; + } + + /* Store energy values and coefficients for next round */ + h->ChCrossRePrev[bin] = h->ChCrossRe[bin]; + h->ChCrossImPrev[bin] = h->ChCrossIm[bin]; + h->ChCrossReOutPrev[bin] = h->ChCrossReOut[bin]; + h->ChCrossImOutPrev[bin] = h->ChCrossImOut[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + h->ChEnePrev[ch][bin] = h->ChEne[ch][bin]; + h->ChEneOutPrev[ch][bin] = h->ChEneOut[ch][bin]; + } + } + + return; +} +#else +static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( + Decoder_Struct *st_ivas, + float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Rmat[3][3], + const uint8_t firstSubframe, + const uint8_t nSubframes ) +{ + uint8_t ch, slot, bin, subframe; + uint8_t separateCenterChannelRendering; + int16_t nBins, idx; + float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX]; + DIRAC_DEC_HANDLE hDirAC; + DIRAC_DEC_BIN_HANDLE h; + float IIReneLimiterFactor; + float qualityBasedSmFactor; + float lowBitRateEQ[CLDFB_NO_CHANNELS_MAX]; + uint8_t applyLowBitRateEQ; + int16_t dirac_read_idx; +#ifdef JBM_TSM_ON_TCS + int16_t slot_idx_start; +#endif + + hDirAC = st_ivas->hDirAC; + h = st_ivas->hDiracDecBin; + separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; + nBins = hDirAC->num_freq_bands; /* Actually bins */ + + set_zero( h->ChCrossRe, nBins ); + set_zero( h->ChCrossIm, nBins ); + set_zero( h->ChCrossReOut, nBins ); + set_zero( h->ChCrossImOut, nBins ); + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + set_zero( h->ChEne[ch], nBins ); + set_zero( h->ChEneOut[ch], nBins ); + } + set_zero( h->frameMeanDiffuseness, nBins ); + + set_zero( frameMeanDiffusenessEneWeight, CLDFB_NO_CHANNELS_MAX ); + + /* Determine EQ for low bit rates (13.2 and 16.4 kbps) */ + applyLowBitRateEQ = 0; + if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MC_FORMAT ) && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + applyLowBitRateEQ = 1; + if ( st_ivas->hDecoderConfig->ivas_total_brate == IVAS_16k4 ) + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin] * 0.5f + 0.5f; + } + } + else + { + for ( bin = 0; bin < LOW_BIT_RATE_BINAURAL_EQ_BINS; bin++ ) + { + lowBitRateEQ[bin + LOW_BIT_RATE_BINAURAL_EQ_OFFSET] = lowBitRateBinauralEQ[bin]; + } + } + } + +#ifdef JBM_TSM_ON_TCS + slot_idx_start = hDirAC->slots_rendered; +#endif + + /* Formulate input and target covariance matrices combining all subframes */ + for ( subframe = firstSubframe; subframe < ( firstSubframe + nSubframes ); subframe++ ) + { + float subFrameTotalEne[CLDFB_NO_CHANNELS_MAX]; + + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); + + dirac_read_idx = hDirAC->dirac_read_idx; + + /* Calculate input covariance matrix */ +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots[subframe]; slot++ ) +#else + for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots; slot++ ) +#endif + { +#ifdef JBM_TSM_ON_TCS + int16_t slotThis = slot + slot_idx_start; +#else + int16_t slotThis = slot + ( hDirAC->subframe_nbslots * subframe ); +#endif + + for ( bin = 0; bin < nBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float instEne; + + instEne = ( inRe[ch][slotThis][bin] * inRe[ch][slotThis][bin] ); + instEne += ( inIm[ch][slotThis][bin] * inIm[ch][slotThis][bin] ); + h->ChEne[ch][bin] += instEne; + subFrameTotalEne[bin] += instEne; + } + h->ChCrossRe[bin] += inRe[0][slotThis][bin] * inRe[1][slotThis][bin]; + h->ChCrossRe[bin] += inIm[0][slotThis][bin] * inIm[1][slotThis][bin]; + h->ChCrossIm[bin] += inRe[0][slotThis][bin] * inIm[1][slotThis][bin]; + h->ChCrossIm[bin] -= inIm[0][slotThis][bin] * inRe[1][slotThis][bin]; + } + } + + /* Apply EQ at low bit rates */ + if ( applyLowBitRateEQ ) + { + int16_t lastEqBin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET + LOW_BIT_RATE_BINAURAL_EQ_BINS - 1; + + for ( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[bin]; + } + for ( ; bin < nBins; bin++ ) + { + subFrameTotalEne[bin] *= lowBitRateEQ[lastEqBin]; + } + } + + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 2 ) + { + float tempRe, tempIm; + + set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); + +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots[subframe]; slot++ ) +#else + for ( slot = 0; slot < (uint8_t) hDirAC->subframe_nbslots; slot++ ) +#endif + { +#ifdef JBM_TSM_ON_TCS + int16_t slotThis = slot + slot_idx_start; +#else + int16_t slotThis = slot + ( hDirAC->subframe_nbslots * subframe ); +#endif + + for ( bin = 0; bin < nBins; bin++ ) + { + tempRe = inRe[0][slotThis][bin] + inRe[1][slotThis][bin]; + tempIm = inIm[0][slotThis][bin] + inIm[1][slotThis][bin]; + subFrameTotalEne[bin] += tempRe * tempRe + tempIm * tempIm; + } + } + } + + /* Determine target covariance matrix containing target binaural properties */ + for ( bin = 0; bin < nBins; bin++ ) + { + float diffuseness = 1.0f; /* ratio1 and ratio2 are subtracted from diffuseness further below */ + float surCoh = 0.0f, spreadCoh = 0.0f; /* Default values if spreadSurroundCoherenceApplied == false */ + float diffEne, dirEne, meanEnePerCh; + uint16_t dirIndex; + + /* When BINAURAL_ROOM is not indicated, hBinaural->earlyPartEneCorrection[bin] values are all 1.0f. + * When BINAURAL_ROOM is indicated, the binaural audio output is based on combined use of the + * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match + * the early spectrum of the BRIR data, using the spectral correction data in + * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ + meanEnePerCh = h->earlyPartEneCorrection[bin] * subFrameTotalEne[bin] / 2.0f; + + /* Determine direct part target covariance matrix (for 1 or 2 directions) */ + for ( dirIndex = 0; dirIndex < hDirAC->numSimultaneousDirections; dirIndex++ ) + { + int16_t aziDeg, eleDeg; + float lRealp, lImagp, rRealp, rImagp; + float lRealpTmp, lImagpTmp, rRealpTmp, rImagpTmp; + float hrtfEne[BINAURAL_CHANNELS], hrtfCrossRe, hrtfCrossIm, ratio; + + if ( dirIndex == 0 ) /* For first of the two simultaneous directions */ + { + aziDeg = hDirAC->azimuth[dirac_read_idx][bin]; + eleDeg = hDirAC->elevation[dirac_read_idx][bin]; + ratio = hDirAC->energy_ratio1[dirac_read_idx][bin]; + spreadCoh = hDirAC->spreadCoherence[dirac_read_idx][bin]; + } + else /* For second of the two simultaneous directions */ + { + aziDeg = hDirAC->azimuth2[dirac_read_idx][bin]; + eleDeg = hDirAC->elevation2[dirac_read_idx][bin]; + ratio = hDirAC->energy_ratio2[dirac_read_idx][bin]; + spreadCoh = hDirAC->spreadCoherence2[dirac_read_idx][bin]; + } + diffuseness -= ratio; /* diffuseness = 1 - ratio1 - ratio2 */ + + if ( separateCenterChannelRendering ) + { + /* In masa + mono rendering mode, the center directions originate from phantom sources, so the + * spread coherence is increased */ + float aziRad, eleRad, doaVectorX, spatialAngleDeg, altSpreadCoh; + + aziRad = (float) aziDeg * PI_OVER_180; + eleRad = (float) eleDeg * PI_OVER_180; + doaVectorX = cosf( aziRad ) * cosf( eleRad ); + spatialAngleDeg = acosf( doaVectorX ) * _180_OVER_PI; + altSpreadCoh = 1.0f - ( spatialAngleDeg / 30.0f ); + spreadCoh = max( spreadCoh, altSpreadCoh ); + } + + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + if ( h->renderStereoOutputInsteadOfBinaural ) + { + /* Synthesizing spread coherence is not needed for stereo loudspeaker output, + * as directional sound is reproduced with two loudspeakers in any case */ + spreadCoh = 0.0f; + } + + if ( spreadCoh > 0.0f ) + { + float centerMul, sidesMul; + float hrtfEneCenter, hrtfEneSides, hrtfEneRealized, eneCorrectionFactor; + float w1, w2, w3, eq; + + hrtfEneCenter = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + + /* Spread coherence is synthesized as coherent sources at 30 degree horizontal spacing. + * The following formulas determine the gains for these sources. + * spreadCoh = 0: Only panning + * spreadCoh = 0.5: Three sources coherent panning (e.g. 30 0 -30 deg azi) + * spreadCoh = 1.0: Two sources coherent panning with gap (as above, but center is silent) */ + if ( spreadCoh < 0.5f ) + { + /* 0.0f < spreadCoh < 0.5f */ + sidesMul = 0.5774f * spreadCoh * 2.0f; /* sqrt(1/3) = 0.5774f */ + centerMul = 1.0f - ( spreadCoh * 2.0f ) + sidesMul; + } + else + { + /* 0.5f <= spreadCoh < 1.0f */ + centerMul = 2.0f - ( 2.0f * spreadCoh ); + sidesMul = inv_sqrt( centerMul + 2.0f ); + centerMul *= sidesMul; + } + + /* Apply the gain for the center source of the three coherent sources */ + lRealp *= centerMul; + lImagp *= centerMul; + rRealp *= centerMul; + rImagp *= centerMul; + + /* Apply the gain for the left source of the three coherent sources */ + getDirectPartGains( bin, aziDeg + 30, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + hrtfEneSides = ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Apply the gain for the right source of the three coherent sources. + * -30 degrees to 330 wrapping due to internal functions. */ + getDirectPartGains( bin, aziDeg + 330, eleDeg, &lRealpTmp, &lImagpTmp, &rRealpTmp, &rImagpTmp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + hrtfEneSides += ( lRealpTmp * lRealpTmp ) + ( lImagpTmp * lImagpTmp ) + ( rRealpTmp * rRealpTmp ) + ( rImagpTmp * rImagpTmp ); + lRealp += sidesMul * lRealpTmp; + lImagp += sidesMul * lImagpTmp; + rRealp += sidesMul * rRealpTmp; + rImagp += sidesMul * rImagpTmp; + + /* Formulate an eneCorrectionFactor that compensates for the coherent summation of the HRTFs */ + hrtfEneRealized = ( lRealp * lRealp ) + ( lImagp * lImagp ) + ( rRealp * rRealp ) + ( rImagp * rImagp ); + eneCorrectionFactor = ( ( hrtfEneSides * sidesMul * sidesMul ) + + ( hrtfEneCenter * centerMul * centerMul ) ) / + max( 1e-12f, hrtfEneRealized ); + + /* Weighting factors to determine appropriate target spectrum for spread coherent sound */ + if ( spreadCoh < 0.5 ) + { + w1 = 1.0f - 2.0f * spreadCoh; + w2 = 2.0f * spreadCoh; + w3 = 0.0f; + } + else + { + w1 = 0.0f; + w2 = 2.0f - 2.0f * spreadCoh; + w3 = 2.0f * spreadCoh - 1.0f; + } + + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + + /* Apply the target spectrum to the eneCorrectionFactor */ + if ( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */ + { + eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[idx]; + } + else + { + eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[idx] + w3 * spreadCohEne1[idx]; + } + } + + /* Equalize the spread coherent combined HRTFs */ + eq = min( 4.0f, sqrtf( eneCorrectionFactor ) ); + lRealp *= eq; + lImagp *= eq; + rRealp *= eq; + rImagp *= eq; + } + + hrtfEne[0] = ( lRealp * lRealp ) + ( lImagp * lImagp ); + hrtfEne[1] = ( rRealp * rRealp ) + ( rImagp * rImagp ); + hrtfCrossRe = ( lRealp * rRealp ) + ( lImagp * rImagp ); + hrtfCrossIm = ( -lImagp * rRealp ) + ( lRealp * rImagp ); + + /* Add direct part (1 or 2) covariance matrix */ + dirEne = ratio * meanEnePerCh; + h->ChEneOut[0][bin] += dirEne * hrtfEne[0]; /* Dir ene part*/ + h->ChEneOut[1][bin] += dirEne * hrtfEne[1]; + h->ChCrossReOut[bin] += dirEne * hrtfCrossRe; /* Dir cross re */ + h->ChCrossImOut[bin] += dirEne * hrtfCrossIm; /* Dir cross im */ + } + + /* Add diffuse / ambient part covariance matrix */ + diffuseness = max( 0.0f, diffuseness ); + diffEne = diffuseness * meanEnePerCh; + surCoh = hDirAC->surroundingCoherence[dirac_read_idx][bin]; + if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) + { + if ( !h->renderStereoOutputInsteadOfBinaural ) + { + idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 ); + /* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */ + diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx]; + } + } + h->ChEneOut[0][bin] += diffEne; /* Diff ene part*/ + h->ChEneOut[1][bin] += diffEne; + + if ( h->renderStereoOutputInsteadOfBinaural ) + { + /* When rendering stereo, ambience (except for surround coherent sound) has zero ICC. */ + h->ChCrossReOut[bin] += surCoh * diffEne; + } + else /* When rendering binaural, ambience has frequency dependent ICC. */ + { + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) + { + float diffuseFieldCoherence; + diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[subframe][bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[subframe][bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[subframe][bin] * h->diffuseFieldCoherenceZ[bin]; + h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; + } + else + { + h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * h->diffuseFieldCoherence[bin] + surCoh ) * diffEne; + } + } + + /* Store parameters for formulating average diffuseness over frame */ + h->frameMeanDiffuseness[bin] += diffEne; + frameMeanDiffusenessEneWeight[bin] += meanEnePerCh; + } + hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; +#ifdef JBM_TSM_ON_TCS + slot_idx_start += hDirAC->subframe_nbslots[subframe]; +#endif + } + + /* Formulate average diffuseness over frame */ + for ( bin = 0; bin < nBins; bin++ ) + { + h->frameMeanDiffuseness[bin] /= fmaxf( 1e-12f, frameMeanDiffusenessEneWeight[bin] ); + } + + /* Determine encoding quality based additional smoothing factor */ + qualityBasedSmFactor = 1.0f; + if ( st_ivas->hMasa != NULL ) + { + qualityBasedSmFactor = st_ivas->hMasa->data.dir_decode_quality; + qualityBasedSmFactor *= qualityBasedSmFactor; + } + + /* Temporal IIR-type smoothing of covariance matrices */ + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + IIReneLimiterFactor = 16.0f / (float) nSubframes + ( 1.0f - qualityBasedSmFactor ); + } + else + { + IIReneLimiterFactor = 8.0f / (float) nSubframes + ( 1.0f - qualityBasedSmFactor ); + } + for ( bin = 0; bin < nBins; bin++ ) + { + float eneRatio, IIReneLimiter; + + /* Temporally smooth cov mtx estimates for resulting mixing matrix stability. The design principle is that + * the energy history (IIR) must not be more than double of the current frame energy. This provides more + * robust performance at energy offsets when compared to typical IIR averaging. */ + eneRatio = ( h->ChEne[0][bin] + h->ChEne[1][bin] ) / fmaxf( 1e-12f, ( h->ChEnePrev[0][bin] + h->ChEnePrev[1][bin] ) ); + IIReneLimiter = fminf( 1.0f, eneRatio * IIReneLimiterFactor ); + + h->ChCrossRe[bin] *= qualityBasedSmFactor; + h->ChCrossIm[bin] *= qualityBasedSmFactor; + h->ChCrossReOut[bin] *= qualityBasedSmFactor; + h->ChCrossImOut[bin] *= qualityBasedSmFactor; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + h->ChEne[ch][bin] *= qualityBasedSmFactor; + h->ChEneOut[ch][bin] *= qualityBasedSmFactor; + } + + h->ChCrossRe[bin] += IIReneLimiter * h->ChCrossRePrev[bin]; + h->ChCrossIm[bin] += IIReneLimiter * h->ChCrossImPrev[bin]; + h->ChCrossReOut[bin] += IIReneLimiter * h->ChCrossReOutPrev[bin]; + h->ChCrossImOut[bin] += IIReneLimiter * h->ChCrossImOutPrev[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + h->ChEne[ch][bin] += IIReneLimiter * h->ChEnePrev[ch][bin]; + h->ChEneOut[ch][bin] += IIReneLimiter * h->ChEneOutPrev[ch][bin]; + } + + /* Store energy values and coefficients for next round */ + h->ChCrossRePrev[bin] = h->ChCrossRe[bin]; + h->ChCrossImPrev[bin] = h->ChCrossIm[bin]; + h->ChCrossReOutPrev[bin] = h->ChCrossReOut[bin]; + h->ChCrossImOutPrev[bin] = h->ChCrossImOut[bin]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + h->ChEnePrev[ch][bin] = h->ChEne[ch][bin]; + h->ChEneOutPrev[ch][bin] = h->ChEneOut[ch][bin]; + } + } + + return; +} +#endif + + +static void ivas_dirac_dec_binaural_determine_processing_matrices( + Decoder_Struct *st_ivas, + const int16_t max_band_decorr, + float Rmat[3][3] ) +{ +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + int16_t chA, chB, bin; +#else + uint8_t chA, chB, bin; +#endif + uint8_t separateCenterChannelRendering; + int16_t nBins; + DIRAC_DEC_BIN_HANDLE h; + h = st_ivas->hDiracDecBin; + separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled; + nBins = st_ivas->hDirAC->num_freq_bands; /* Actually bins */ + + for ( bin = 0; bin < nBins; bin++ ) + { + float tmpMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], resultMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS], gain; + float CxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], CxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; /* Input covariance matrix */ + float realizedOutputEne, targetOutputEne, missingOutputEne; + float CrEneL, CrEneR; /* Cr = residual decorrelated sound covariance matrix */ + float CrCrossRe, CrCrossIm; + float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], MdecIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; /* M = mixing matrix; Mdec = residual decorrelated signal mixing matrix */ + float prototypeMtx[BINAURAL_CHANNELS][BINAURAL_CHANNELS] = { { 1.0f, 0.05f }, { 0.05f, 1.0f } }; /* Prototype matrix determines a reference signal in mixing matrix determination */ + + CrEneL = 0.0f; + CrEneR = 0.0f; + + /* Formulate main processing matrix M */ + formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], + h->ChCrossRe[bin], h->ChCrossIm[bin], + h->ChEneOut[0][bin], h->ChEneOut[1][bin], + h->ChCrossReOut[bin], h->ChCrossImOut[bin], + prototypeMtx, Mre, Mim, h->reqularizationFactor ); + + /* Load estimated covariance matrix to the [2][2] matrix form */ + CxRe[0][0] = h->ChEne[0][bin]; + CxRe[1][1] = h->ChEne[1][bin]; + CxRe[1][0] = h->ChCrossRe[bin]; + CxRe[0][1] = h->ChCrossRe[bin]; + CxIm[0][0] = 0.0f; + CxIm[1][1] = 0.0f; + CxIm[1][0] = h->ChCrossIm[bin]; + CxIm[0][1] = -h->ChCrossIm[bin]; + + /* Make matrix multiplication M*Cx*M' to determine resulting covariance matrix of processing input with M */ + matrixMul( Mre, Mim, CxRe, CxIm, tmpMtxRe, tmpMtxIm ); + matrixTransp2Mul( tmpMtxRe, tmpMtxIm, Mre, Mim, resultMtxRe, resultMtxIm ); + + /* When below the frequency limit where decorrelation is applied, we inject the decorrelated + * residual (or missing) signal component. The procedure is active when there are not enough independent + * signal energy to synthesize a signal with the target covariance matrix from the non-decorrelated signals */ + if ( bin < max_band_decorr ) + { + float decorrelationReductionFactor; + + /* Subtract the resulting covariance matrix from the target covariance matrix to determine + * what signal component is missing. The result is the target covariance matrix for the residual signal, i.e., + * a residual covariance matrix. */ + CrEneL = max( 0.0f, h->ChEneOut[0][bin] - resultMtxRe[0][0] ); + CrEneR = max( 0.0f, h->ChEneOut[1][bin] - resultMtxRe[1][1] ); + CrCrossRe = h->ChCrossReOut[bin] - resultMtxRe[1][0]; + CrCrossIm = h->ChCrossImOut[bin] - resultMtxIm[1][0]; + + /* The amount of the decorrelated sound is further controlled based on the spatial metadata, + * by determining an energy-suppressed residual covariance matrix that is a control parameter + * that guides the processing of the decorrelated sound to a residual signal. + * The procedure improves quality in e.g. double-talk 2-direction rendering situations.*/ + if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) + { + decorrelationReductionFactor = 1.0f; + } + else if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 1 ) ) + { + decorrelationReductionFactor = sqrtf( fmaxf( 0.0f, h->frameMeanDiffuseness[bin] ) ); + } + else if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 1 ) + { + decorrelationReductionFactor = 1.0f; + } + else + { + decorrelationReductionFactor = fmaxf( 0.0f, h->frameMeanDiffuseness[bin] ); + } + CrEneL *= decorrelationReductionFactor; + CrEneR *= decorrelationReductionFactor; + CrCrossRe *= decorrelationReductionFactor; + CrCrossIm *= decorrelationReductionFactor; + + /* Determine a residual mixing matrix Mdec for processing the decorrelated signal to obtain + * the residual signal (that has the residual covariance matrix) */ + formulate2x2MixingMatrix( h->ChEne[0][bin], h->ChEne[1][bin], + 0.0f, 0.0f, /* Decorrelated signal has ideally no cross-terms */ + CrEneL, CrEneR, + CrCrossRe, CrCrossIm, + prototypeMtx, MdecRe, MdecIm, 0.2f ); + } + else + { + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + set_zero( MdecRe[chA], BINAURAL_CHANNELS ); + set_zero( MdecIm[chA], BINAURAL_CHANNELS ); + } + } + + /* The regularizations at determining mixing matrices cause signal energy to be lost to some degree, which is compensated for here */ + realizedOutputEne = CrEneL + CrEneR + resultMtxRe[0][0] + resultMtxRe[1][1]; + targetOutputEne = h->ChEneOut[0][bin] + h->ChEneOut[1][bin]; + missingOutputEne = fmaxf( 0.0f, targetOutputEne - realizedOutputEne ); + + gain = sqrtf( ( resultMtxRe[0][0] + resultMtxRe[1][1] + missingOutputEne ) / + fmaxf( 1e-12f, resultMtxRe[0][0] + resultMtxRe[1][1] ) ); + gain = fminf( 4.0f, gain ); + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + Mre[chA][chB] *= gain; + Mim[chA][chB] *= gain; + } + } + + /* Store processing matrices */ + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + h->processMtxRePrev[chA][chB][bin] = h->processMtxRe[chA][chB][bin]; + h->processMtxImPrev[chA][chB][bin] = h->processMtxIm[chA][chB][bin]; + h->processMtxDecRePrev[chA][chB][bin] = h->processMtxDecRe[chA][chB][bin]; + h->processMtxDecImPrev[chA][chB][bin] = h->processMtxDecIm[chA][chB][bin]; + + h->processMtxRe[chA][chB][bin] = Mre[chA][chB]; + h->processMtxIm[chA][chB][bin] = Mim[chA][chB]; + h->processMtxDecRe[chA][chB][bin] = MdecRe[chA][chB]; + h->processMtxDecIm[chA][chB][bin] = MdecIm[chA][chB]; + } + } + + if ( separateCenterChannelRendering ) + { + /* The rendering of the separate center channel in masa + mono mode. + * The center channel is processed with a gain factor 0.8414f to match the loudness of different processing paths */ + float lRealp, lImagp, rRealp, rImagp; + float gainFactor; + int16_t aziDeg = 0; + int16_t eleDeg = 0; + + gainFactor = 0.8414f * sqrtf( h->earlyPartEneCorrection[bin] ); + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + h->processMtxRePrev[chA][2][bin] = h->processMtxRe[chA][2][bin]; + h->processMtxImPrev[chA][2][bin] = h->processMtxIm[chA][2][bin]; + } + + getDirectPartGains( bin, aziDeg, eleDeg, &lRealp, &lImagp, &rRealp, &rImagp, h->renderStereoOutputInsteadOfBinaural, Rmat ); + + h->processMtxRe[0][2][bin] = lRealp * gainFactor; + h->processMtxIm[0][2][bin] = lImagp * gainFactor; + h->processMtxRe[1][2][bin] = rRealp * gainFactor; + h->processMtxIm[1][2][bin] = rImagp * gainFactor; + } + } + + return; +} + +#ifdef JBM_TSM_ON_TCS +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_dirac_dec_binaural_process_output_sf( + Decoder_Struct *st_ivas, + float *output_f[], + float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const int16_t max_band_decorr, + const uint8_t numInChannels ) +{ + uint8_t slot, bin, chA, chB; + int16_t nBins; + float outSlotRe[CLDFB_NO_CHANNELS_MAX], outSlotIm[CLDFB_NO_CHANNELS_MAX]; + float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float reverbRe[BINAURAL_CHANNELS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float reverbIm[BINAURAL_CHANNELS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + uint16_t numSlots; + DIRAC_DEC_BIN_HANDLE h; + float interpVal; + float *decSlotRePointer; + float *decSlotImPointer; + + numSlots = st_ivas->hDirAC->subframe_nbslots[st_ivas->hDirAC->subframes_rendered]; + h = st_ivas->hDiracDecBin; + nBins = st_ivas->hDirAC->num_freq_bands; + + + interpVal = 0.0f; + for ( slot = 0; slot < numSlots; slot++ ) + { + interpVal += 1.0f / (float) numSlots; + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + /* Process second / room effect part of binaural output when needed */ + ivas_binaural_reverb_processSlot( st_ivas->hDiracDecBin->hReverb, numInChannels, inRe, inIm, reverbRe, reverbIm, slot ); + } + if ( !st_ivas->hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) + { +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + ivas_dirac_dec_decorrelate_slot( st_ivas->hDirAC, slot, inRe, inIm, decSlotRe, decSlotIm ); +#else + ivas_dirac_dec_decorrelate_slot_sf( st_ivas->hDirAC, slot, inRe, inIm, decSlotRe, decSlotIm ); +#endif + } + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + float *outSlotRePr, *outSlotImPr; /* Pointers needed for function call compatibility */ + + set_zero( outSlotRe, CLDFB_NO_CHANNELS_MAX ); + set_zero( outSlotIm, CLDFB_NO_CHANNELS_MAX ); + + /* Processing of the first / HRTF part of the binaural output. */ + for ( chB = 0; chB < numInChannels; chB++ ) + { + if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + decSlotRePointer = inRe[chB + 2][slot]; + decSlotImPointer = inIm[chB + 2][slot]; + } + else + { + decSlotRePointer = decSlotRe[chB]; + decSlotImPointer = decSlotIm[chB]; + } + + for ( bin = 0; bin < nBins; bin++ ) + { + float gain; + + /* Mixing using the formulated processing matrix M */ + gain = ( 1.0f - interpVal ) * h->processMtxRePrev[chA][chB][bin] + + interpVal * h->processMtxRe[chA][chB][bin]; + outSlotRe[bin] += gain * inRe[chB][slot][bin]; + outSlotIm[bin] += gain * inIm[chB][slot][bin]; + + gain = ( 1.0f - interpVal ) * h->processMtxImPrev[chA][chB][bin] + + interpVal * h->processMtxIm[chA][chB][bin]; + outSlotRe[bin] -= gain * inIm[chB][slot][bin]; + outSlotIm[bin] += gain * inRe[chB][slot][bin]; + + /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ + if ( bin < max_band_decorr && chB < 2 ) + { + gain = ( 1.0f - interpVal ) * h->processMtxDecRePrev[chA][chB][bin] + + interpVal * h->processMtxDecRe[chA][chB][bin]; + outSlotRe[bin] += gain * decSlotRePointer[bin]; + outSlotIm[bin] += gain * decSlotImPointer[bin]; + + gain = ( 1.0f - interpVal ) * h->processMtxDecImPrev[chA][chB][bin] + + interpVal * h->processMtxDecIm[chA][chB][bin]; + outSlotRe[bin] -= gain * decSlotImPointer[bin]; + outSlotIm[bin] += gain * decSlotRePointer[bin]; + } + } + } + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ + v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); + v_add( outSlotIm, reverbIm[chA][slot], outSlotIm, CLDFB_NO_CHANNELS_MAX ); + } + + outSlotRePr = &( outSlotRe[0] ); + outSlotImPr = &( outSlotIm[0] ); + + /* Inverse filter bank */ + cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot] ), nBins, st_ivas->cldfbSynDec[chA] ); + } + } + + return; +} +#endif +#endif + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_dirac_dec_binaural_process_output( + Decoder_Struct *st_ivas, +#ifdef JBM_TSM_ON_TCS + float *output_f[], +#else + float output_f[][L_FRAME48k], +#endif + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const int16_t max_band_decorr, + const int16_t numInChannels, + const int16_t subframe ) +{ + int16_t slot, bin, chA, chB; + int16_t nBins; + float outSlotRe[CLDFB_NO_CHANNELS_MAX], outSlotIm[CLDFB_NO_CHANNELS_MAX]; + float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float reverbRe[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float reverbIm[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + DIRAC_DEC_BIN_HANDLE h; + float interpVal; + float *decSlotRePointer; + float *decSlotImPointer; + int16_t offsetSamples; +#ifdef JBM_TSM_ON_TCS + int16_t nSlots; +#endif + + h = st_ivas->hDiracDecBin; + nBins = st_ivas->hDirAC->num_freq_bands; +#ifdef JBM_TSM_ON_TCS + offsetSamples = 0; + nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; +#else + offsetSamples = subframe * CLDFB_SLOTS_PER_SUBFRAME * nBins; +#endif + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + /* Process second / room effect part of binaural output when needed */ +#ifdef JBM_TSM_ON_TCS + ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); +#else + ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, inRe, inIm, reverbRe, reverbIm ); +#endif + } + + interpVal = 0.0f; +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < nSlots; slot++ ) +#else + for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) +#endif + { +#ifdef JBM_TSM_ON_TCS + interpVal += 1.0f / (float) nSlots; +#else + interpVal += 1.0f / ( (float) CLDFB_SLOTS_PER_SUBFRAME ); +#endif + if ( !st_ivas->hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) + { + ivas_dirac_dec_decorrelate_slot( st_ivas->hDirAC, slot, inRe, inIm, decSlotRe, decSlotIm ); + } + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + float *outSlotRePr, *outSlotImPr; /* Pointers needed for function call compatibility */ + + set_zero( outSlotRe, CLDFB_NO_CHANNELS_MAX ); + set_zero( outSlotIm, CLDFB_NO_CHANNELS_MAX ); + + /* Processing of the first / HRTF part of the binaural output. */ + for ( chB = 0; chB < numInChannels; chB++ ) + { + if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + decSlotRePointer = inRe[chB + 2][slot]; + decSlotImPointer = inIm[chB + 2][slot]; + } + else + { + decSlotRePointer = decSlotRe[chB]; + decSlotImPointer = decSlotIm[chB]; + } + + for ( bin = 0; bin < nBins; bin++ ) + { + float gain; + + /* Mixing using the formulated processing matrix M */ + gain = ( 1.0f - interpVal ) * h->processMtxRePrev[chA][chB][bin] + + interpVal * h->processMtxRe[chA][chB][bin]; + outSlotRe[bin] += gain * inRe[chB][slot][bin]; + outSlotIm[bin] += gain * inIm[chB][slot][bin]; + + gain = ( 1.0f - interpVal ) * h->processMtxImPrev[chA][chB][bin] + + interpVal * h->processMtxIm[chA][chB][bin]; + outSlotRe[bin] -= gain * inIm[chB][slot][bin]; + outSlotIm[bin] += gain * inRe[chB][slot][bin]; + + /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ + if ( bin < max_band_decorr && chB < 2 ) + { + gain = ( 1.0f - interpVal ) * h->processMtxDecRePrev[chA][chB][bin] + + interpVal * h->processMtxDecRe[chA][chB][bin]; + outSlotRe[bin] += gain * decSlotRePointer[bin]; + outSlotIm[bin] += gain * decSlotImPointer[bin]; + + gain = ( 1.0f - interpVal ) * h->processMtxDecImPrev[chA][chB][bin] + + interpVal * h->processMtxDecIm[chA][chB][bin]; + outSlotRe[bin] -= gain * decSlotImPointer[bin]; + outSlotIm[bin] += gain * decSlotRePointer[bin]; + } + } + } + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ + v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); + v_add( outSlotIm, reverbIm[chA][slot], outSlotIm, CLDFB_NO_CHANNELS_MAX ); + } + + outSlotRePr = &( outSlotRe[0] ); + outSlotImPr = &( outSlotIm[0] ); + + /* Inverse filter bank */ + cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot + offsetSamples] ), nBins, st_ivas->cldfbSynDec[chA] ); + } + } + + return; +} +#else +static void ivas_dirac_dec_binaural_process_output( + Decoder_Struct *st_ivas, + float output_f[][L_FRAME48k], + float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t max_band_decorr, + const uint8_t numInChannels, + const uint8_t firstSlot, + const uint8_t slotEnd ) +{ + uint8_t slot, bin, chA, chB; + int16_t nBins; + float outSlotRe[CLDFB_NO_CHANNELS_MAX], outSlotIm[CLDFB_NO_CHANNELS_MAX]; + float decSlotRe[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], decSlotIm[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float reverbRe[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float reverbIm[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + uint8_t numSlots; + DIRAC_DEC_BIN_HANDLE h; + float interpVal; + float *decSlotRePointer; + float *decSlotImPointer; + + numSlots = slotEnd - firstSlot; + h = st_ivas->hDiracDecBin; + nBins = st_ivas->hDirAC->num_freq_bands; + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + /* Process second / room effect part of binaural output when needed */ + ivas_binaural_reverb_processFrame( st_ivas->hDiracDecBin->hReverb, numInChannels, inRe, inIm, reverbRe, reverbIm, firstSlot ); + } + + interpVal = 0.0f; + for ( slot = firstSlot; slot < ( firstSlot + numSlots ); slot++ ) + { + interpVal += 1.0f / (float) numSlots; + if ( !st_ivas->hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) + { + ivas_dirac_dec_decorrelate_slot( st_ivas->hDirAC, slot, inRe, inIm, decSlotRe, decSlotIm ); + } + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + float *outSlotRePr, *outSlotImPr; /* Pointers needed for function call compatibility */ + + set_zero( outSlotRe, CLDFB_NO_CHANNELS_MAX ); + set_zero( outSlotIm, CLDFB_NO_CHANNELS_MAX ); + + /* Processing of the first / HRTF part of the binaural output. */ + for ( chB = 0; chB < numInChannels; chB++ ) + { + if ( st_ivas->hDiracDecBin->useTdDecorr ) + { + decSlotRePointer = inRe[chB + 2][slot]; + decSlotImPointer = inIm[chB + 2][slot]; + } + else + { + decSlotRePointer = decSlotRe[chB]; + decSlotImPointer = decSlotIm[chB]; + } + + for ( bin = 0; bin < nBins; bin++ ) + { + float gain; + + /* Mixing using the formulated processing matrix M */ + gain = ( 1.0f - interpVal ) * h->processMtxRePrev[chA][chB][bin] + + interpVal * h->processMtxRe[chA][chB][bin]; + outSlotRe[bin] += gain * inRe[chB][slot][bin]; + outSlotIm[bin] += gain * inIm[chB][slot][bin]; + + gain = ( 1.0f - interpVal ) * h->processMtxImPrev[chA][chB][bin] + + interpVal * h->processMtxIm[chA][chB][bin]; + outSlotRe[bin] -= gain * inIm[chB][slot][bin]; + outSlotIm[bin] += gain * inRe[chB][slot][bin]; + + /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ + if ( bin < max_band_decorr && chB < 2 ) + { + gain = ( 1.0f - interpVal ) * h->processMtxDecRePrev[chA][chB][bin] + + interpVal * h->processMtxDecRe[chA][chB][bin]; + outSlotRe[bin] += gain * decSlotRePointer[bin]; + outSlotIm[bin] += gain * decSlotImPointer[bin]; + + gain = ( 1.0f - interpVal ) * h->processMtxDecImPrev[chA][chB][bin] + + interpVal * h->processMtxDecIm[chA][chB][bin]; + outSlotRe[bin] -= gain * decSlotImPointer[bin]; + outSlotIm[bin] += gain * decSlotRePointer[bin]; + } + } + } + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + /* Combine second (reverb) part with the first (HRTF) part to obtain binaural output signal with room effect */ + v_add( outSlotRe, reverbRe[chA][slot], outSlotRe, CLDFB_NO_CHANNELS_MAX ); + v_add( outSlotIm, reverbIm[chA][slot], outSlotIm, CLDFB_NO_CHANNELS_MAX ); + } + + outSlotRePr = &( outSlotRe[0] ); + outSlotImPr = &( outSlotIm[0] ); + + /* Inverse filter bank */ + cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( output_f[chA][nBins * slot] ), nBins, st_ivas->cldfbSynDec[chA] ); + } + } + + return; +} +#endif + +#ifdef JBM_TSM_ON_TCS +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_sf( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, + float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const uint8_t slotEnd, + const uint8_t nBins, + float Rmat[3][3] ) +{ + uint8_t slot, bin, ch; + float tmpVal; + + /* When not currently in prototype signal left-right switching procedure, check if such switching is needed */ + if ( hHeadTrackData->lrSwitchedNext == hHeadTrackData->lrSwitchedCurrent ) + { + float thresholdDotProduct = 0.17f; /* Corresponds to 10-degree switching threshold */ + if ( ( hHeadTrackData->lrSwitchedCurrent == 0 ) && ( Rmat[1][1] < -thresholdDotProduct ) ) + { + hHeadTrackData->lrSwitchedNext = 1; + } + if ( ( hHeadTrackData->lrSwitchedCurrent == 1 ) && ( Rmat[1][1] > thresholdDotProduct ) ) + { + hHeadTrackData->lrSwitchedNext = 0; + } + } + + /* When currently in interpolation */ + if ( hHeadTrackData->lrSwitchedNext != hHeadTrackData->lrSwitchedCurrent ) + { + for ( slot = 0; slot < slotEnd; slot++ ) + { + float switchOrderFactor, origOrderFactor; + + hHeadTrackData->lrSwitchInterpVal += 0.0025f; /* Corresponds to 0.5 seconds interpolation time */ + + if ( hHeadTrackData->lrSwitchInterpVal > 0.999f ) + { + /* Stop interpolation, reset values */ + hHeadTrackData->lrSwitchInterpVal = 0.0f; + hHeadTrackData->lrSwitchedCurrent = hHeadTrackData->lrSwitchedNext; + } + + /* Gains for determining portion of switched channel order and original channel order */ + tmpVal = (float) hHeadTrackData->lrSwitchedNext * hHeadTrackData->lrSwitchInterpVal; + tmpVal += (float) hHeadTrackData->lrSwitchedCurrent * ( 1.0f - hHeadTrackData->lrSwitchInterpVal ); + switchOrderFactor = sqrtf( tmpVal ); + origOrderFactor = sqrtf( 1.0f - tmpVal ); + + for ( bin = 0; bin < nBins; bin++ ) + { + /* determine original order (1) signals and switched order (2) signals */ + float re1[BINAURAL_CHANNELS], re2[BINAURAL_CHANNELS], im1[BINAURAL_CHANNELS], im2[BINAURAL_CHANNELS]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + re1[ch] = inRe[ch][slot][bin] * origOrderFactor; + re2[ch] = inRe[1 - ch][slot][bin] * switchOrderFactor; + im1[ch] = inIm[ch][slot][bin] * origOrderFactor; + im2[ch] = inIm[1 - ch][slot][bin] * switchOrderFactor; + } + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float eneRef, ene, eq; + + /* Interpolate / mix original and switched order signals */ + inRe[ch][slot][bin] = re1[ch] + re2[ch]; + inIm[ch][slot][bin] = im1[ch] + im2[ch]; + + /* Equalize interpolated signals to preserve energy per bin */ + eneRef = ( re1[ch] * re1[ch] ) + ( re2[ch] * re2[ch] ) + ( im1[ch] * im1[ch] ) + ( im2[ch] * im2[ch] ); + ene = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + eq = sqrtf( eneRef / fmaxf( 1e-12f, ene ) ); + eq = fminf( 4.0f, eq ); + inRe[ch][slot][bin] *= eq; + inIm[ch][slot][bin] *= eq; + } + } + } + } + else + { + /* If not in interpolation, but in switched prototype situation, then switch left and right channels */ + if ( hHeadTrackData->lrSwitchedCurrent == 1 ) + { + for ( slot = 0; slot < slotEnd; slot++ ) + { + for ( bin = 0; bin < nBins; bin++ ) + { + tmpVal = inRe[0][slot][bin]; + inRe[0][slot][bin] = inRe[1][slot][bin]; + inRe[1][slot][bin] = tmpVal; + tmpVal = inIm[0][slot][bin]; + inIm[0][slot][bin] = inIm[1][slot][bin]; + inIm[1][slot][bin] = tmpVal; + } + } + } + } + + return; +} +#endif +#endif + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +static void adaptTransportSignalsHeadtracked( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const int16_t nBins, +#ifdef JBM_TSM_ON_TCS + const int16_t nSlots, +#endif + float Rmat[3][3] ) +{ + int16_t slot, ch, bin, louderCh; + float ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val, ene_proc, ene_target; + int16_t max_band; + float eqVal; + int16_t band_idx, bin_lo, bin_hi; + + /* Determine head-orientation-based mono factor. + Rmat[1][1] entry informs how close the ears are aligned according to transport signals. */ + y_val = 1.0f - fabsf( Rmat[1][1] ); + mono_factor_rotation = ( y_val - ADAPT_HTPROTO_ROT_LIM_0 ) / ( ADAPT_HTPROTO_ROT_LIM_1 - ADAPT_HTPROTO_ROT_LIM_0 ); + mono_factor_rotation = fmaxf( 0.0f, fminf( 1.0f, mono_factor_rotation ) ); + + /* Adapt transport signals in frequency bands */ + /* optimization grouping CLDFB bins into MASA bands (they are readily available in ROM and suitable for the task) AND group CLDFB slots into sub-frames */ + + max_band = 0; + while ( max_band < MASA_FREQUENCY_BANDS && MASA_band_grouping_24[max_band] < nBins ) + { + max_band++; + } + + for ( band_idx = 0; band_idx < max_band; band_idx++ ) + { + float ch_nrg[2]; /* storage for input signal channel energies */ + bin_lo = MASA_band_grouping_24[band_idx]; + bin_hi = min( MASA_band_grouping_24[band_idx + 1], (int16_t) nBins ); + for ( ch = 0; ch < 2; ch++ ) + { + ch_nrg[ch] = 0.0f; +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < nSlots; slot++ ) +#else + for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) +#endif + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + ch_nrg[ch] += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + } + } + hHeadTrackData->chEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->chEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + } + + /* Determine ILD */ + ILD = fabsf( 10.0f * log10f( fmaxf( 1e-12f, hHeadTrackData->chEneIIR[0][band_idx] ) / fmaxf( 1e-12f, hHeadTrackData->chEneIIR[1][band_idx] ) ) ); + if ( hHeadTrackData->chEneIIR[1][band_idx] > hHeadTrackData->chEneIIR[0][band_idx] ) + { + louderCh = 1; + } + else + { + louderCh = 0; + } + + /* Determine ILD-based mono factor */ + mono_factor_ILD = ( ILD - ADAPT_HTPROTO_ILD_LIM_DB0 ) / ( ADAPT_HTPROTO_ILD_LIM_DB1 - ADAPT_HTPROTO_ILD_LIM_DB0 ); + mono_factor_ILD = fmaxf( 0.0f, fminf( 1.0f, mono_factor_ILD ) ); + + /* Combine mono factors */ + mono_factor = mono_factor_ILD * mono_factor_rotation; + + /* Mix original audio and sum signal according to determined mono factor */ + for ( ch = 0; ch < 2; ch++ ) + { + if ( ch != louderCh ) + { + float band_nrg = 0.0f; + +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < nSlots; slot++ ) +#else + for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) +#endif + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + /* mono sum signal with the computed weight + rest from the original channel */ + inRe[ch][slot][bin] = mono_factor * ( inRe[0][slot][bin] + inRe[1][slot][bin] ) + ( 1.0f - mono_factor ) * inRe[ch][slot][bin]; + inIm[ch][slot][bin] = mono_factor * ( inIm[0][slot][bin] + inIm[1][slot][bin] ) + ( 1.0f - mono_factor ) * inIm[ch][slot][bin]; + band_nrg += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + } + } + hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * band_nrg; + } + else + { + /* processed signal is input. use the original channel, so no need to compute new signals or signal energy */ + hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + } + } + + /* Equalize */ + ene_target = hHeadTrackData->chEneIIR[0][band_idx] + hHeadTrackData->chEneIIR[1][band_idx]; + ene_proc = hHeadTrackData->procChEneIIR[0][band_idx] + hHeadTrackData->procChEneIIR[1][band_idx]; + eqVal = fminf( 4.0f, sqrtf( ene_target / fmaxf( 1e-12f, ene_proc ) ) ); + +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < nSlots; slot++ ) +#else + for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) +#endif + { + for ( ch = 0; ch < 2; ch++ ) + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + inRe[ch][slot][bin] *= eqVal; + inIm[ch][slot][bin] *= eqVal; + } + } + } + } + + return; +} +#else +static void adaptTransportSignalsHeadtracked( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, + float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const uint8_t firstSlot, + const uint8_t slotEnd, + const uint8_t nBins, + float Rmat[3][3] ) +{ + int16_t slot, ch, bin, louderCh; + float ILD, mono_factor_ILD, mono_factor_rotation, mono_factor, y_val, ene_proc, ene_target; + uint8_t n_slots_per_sf, sf_idx, n_sf; + int16_t max_band; + + /* Determine head-orientation-based mono factor. + Rmat[1][1] entry informs how close the ears are aligned according to transport signals. */ + y_val = 1.0f - fabsf( Rmat[1][1] ); + mono_factor_rotation = ( y_val - ADAPT_HTPROTO_ROT_LIM_0 ) / ( ADAPT_HTPROTO_ROT_LIM_1 - ADAPT_HTPROTO_ROT_LIM_0 ); + mono_factor_rotation = fmaxf( 0.0f, fminf( 1.0f, mono_factor_rotation ) ); + + /* Adapt transport signals in frequency bands */ + /* optimization grouping CLDFB bins into MASA bands (they are readily available in ROM and suitable for the task) AND group CLDFB slots into sub-frames */ + n_slots_per_sf = CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES; + n_sf = ( slotEnd - firstSlot ) / n_slots_per_sf; + + max_band = 0; + while ( max_band < MASA_FREQUENCY_BANDS && MASA_band_grouping_24[max_band] < nBins ) + { + max_band++; + } + + for ( sf_idx = 0; sf_idx < n_sf; sf_idx++ ) + { + float eqVal; + uint8_t start_slot, stop_slot; + int16_t band_idx, bin_lo, bin_hi; + + start_slot = firstSlot + sf_idx * n_slots_per_sf; + stop_slot = start_slot + n_slots_per_sf; + + for ( band_idx = 0; band_idx < max_band; band_idx++ ) + { + float ch_nrg[2]; /* storage for input signal channel energies */ + bin_lo = MASA_band_grouping_24[band_idx]; + bin_hi = min( MASA_band_grouping_24[band_idx + 1], (int16_t) nBins ); + for ( ch = 0; ch < 2; ch++ ) + { + ch_nrg[ch] = 0.0f; + for ( slot = start_slot; slot < stop_slot; slot++ ) + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + ch_nrg[ch] += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + } + } + hHeadTrackData->chEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->chEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + } + + /* Determine ILD */ + ILD = fabsf( 10.0f * log10f( fmaxf( 1e-12f, hHeadTrackData->chEneIIR[0][band_idx] ) / fmaxf( 1e-12f, hHeadTrackData->chEneIIR[1][band_idx] ) ) ); + if ( hHeadTrackData->chEneIIR[1][band_idx] > hHeadTrackData->chEneIIR[0][band_idx] ) + { + louderCh = 1; + } + else + { + louderCh = 0; + } + + /* Determine ILD-based mono factor */ + mono_factor_ILD = ( ILD - ADAPT_HTPROTO_ILD_LIM_DB0 ) / ( ADAPT_HTPROTO_ILD_LIM_DB1 - ADAPT_HTPROTO_ILD_LIM_DB0 ); + mono_factor_ILD = fmaxf( 0.0f, fminf( 1.0f, mono_factor_ILD ) ); + + /* Combine mono factors */ + mono_factor = mono_factor_ILD * mono_factor_rotation; + + /* Mix original audio and sum signal according to determined mono factor */ + for ( ch = 0; ch < 2; ch++ ) + { + if ( ch != louderCh ) + { + float band_nrg = 0.0f; + + for ( slot = start_slot; slot < stop_slot; slot++ ) + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + /* mono sum signal with the computed weight + rest from the original channel */ + inRe[ch][slot][bin] = mono_factor * ( inRe[0][slot][bin] + inRe[1][slot][bin] ) + ( 1.0f - mono_factor ) * inRe[ch][slot][bin]; + inIm[ch][slot][bin] = mono_factor * ( inIm[0][slot][bin] + inIm[1][slot][bin] ) + ( 1.0f - mono_factor ) * inIm[ch][slot][bin]; + band_nrg += ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + } + } + hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * band_nrg; + } + else + { + /* processed signal is input. use the original channel, so no need to compute new signals or signal energy */ + hHeadTrackData->procChEneIIR[ch][band_idx] *= ADAPT_HTPROTO_IIR_FAC; + hHeadTrackData->procChEneIIR[ch][band_idx] += ( 1.0f - ADAPT_HTPROTO_IIR_FAC ) * ch_nrg[ch]; + } + } + + /* Equalize */ + ene_target = hHeadTrackData->chEneIIR[0][band_idx] + hHeadTrackData->chEneIIR[1][band_idx]; + ene_proc = hHeadTrackData->procChEneIIR[0][band_idx] + hHeadTrackData->procChEneIIR[1][band_idx]; + eqVal = fminf( 4.0f, sqrtf( ene_target / fmaxf( 1e-12f, ene_proc ) ) ); + + for ( slot = start_slot; slot < stop_slot; slot++ ) + { + for ( ch = 0; ch < 2; ch++ ) + { + for ( bin = bin_lo; bin < bin_hi; bin++ ) + { + inRe[ch][slot][bin] *= eqVal; + inIm[ch][slot][bin] *= eqVal; + } + } + } + } + } + + return; +} +#endif + +static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + const int16_t nBins, +#else + float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const uint8_t firstSlot, + const uint8_t slotEnd, + const uint8_t nBins, +#endif +#ifdef JBM_TSM_ON_TCS + const int16_t nSlots, +#endif + float Rmat[3][3] ) +{ +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + int16_t slot, bin, ch; +#else + uint8_t slot, bin, ch; +#endif + float tmpVal; + + /* When not currently in prototype signal left-right switching procedure, check if such switching is needed */ + if ( hHeadTrackData->lrSwitchedNext == hHeadTrackData->lrSwitchedCurrent ) + { + float thresholdDotProduct = 0.17f; /* Corresponds to 10-degree switching threshold */ + if ( ( hHeadTrackData->lrSwitchedCurrent == 0 ) && ( Rmat[1][1] < -thresholdDotProduct ) ) + { + hHeadTrackData->lrSwitchedNext = 1; + } + if ( ( hHeadTrackData->lrSwitchedCurrent == 1 ) && ( Rmat[1][1] > thresholdDotProduct ) ) + { + hHeadTrackData->lrSwitchedNext = 0; + } + } + + /* When currently in interpolation */ + if ( hHeadTrackData->lrSwitchedNext != hHeadTrackData->lrSwitchedCurrent ) + { +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < nSlots; slot++ ) +#else + for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) +#endif +#else + for ( slot = firstSlot; slot < slotEnd; slot++ ) +#endif + { + float switchOrderFactor, origOrderFactor; + + hHeadTrackData->lrSwitchInterpVal += 0.0025f; /* Corresponds to 0.5 seconds interpolation time */ + + if ( hHeadTrackData->lrSwitchInterpVal > 0.999f ) + { + /* Stop interpolation, reset values */ + hHeadTrackData->lrSwitchInterpVal = 0.0f; + hHeadTrackData->lrSwitchedCurrent = hHeadTrackData->lrSwitchedNext; + } + + /* Gains for determining portion of switched channel order and original channel order */ + tmpVal = (float) hHeadTrackData->lrSwitchedNext * hHeadTrackData->lrSwitchInterpVal; + tmpVal += (float) hHeadTrackData->lrSwitchedCurrent * ( 1.0f - hHeadTrackData->lrSwitchInterpVal ); + switchOrderFactor = sqrtf( tmpVal ); + origOrderFactor = sqrtf( 1.0f - tmpVal ); + + for ( bin = 0; bin < nBins; bin++ ) + { + /* determine original order (1) signals and switched order (2) signals */ + float re1[BINAURAL_CHANNELS], re2[BINAURAL_CHANNELS], im1[BINAURAL_CHANNELS], im2[BINAURAL_CHANNELS]; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + re1[ch] = inRe[ch][slot][bin] * origOrderFactor; + re2[ch] = inRe[1 - ch][slot][bin] * switchOrderFactor; + im1[ch] = inIm[ch][slot][bin] * origOrderFactor; + im2[ch] = inIm[1 - ch][slot][bin] * switchOrderFactor; + } + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + float eneRef, ene, eq; + + /* Interpolate / mix original and switched order signals */ + inRe[ch][slot][bin] = re1[ch] + re2[ch]; + inIm[ch][slot][bin] = im1[ch] + im2[ch]; + + /* Equalize interpolated signals to preserve energy per bin */ + eneRef = ( re1[ch] * re1[ch] ) + ( re2[ch] * re2[ch] ) + ( im1[ch] * im1[ch] ) + ( im2[ch] * im2[ch] ); + ene = ( inRe[ch][slot][bin] * inRe[ch][slot][bin] ) + ( inIm[ch][slot][bin] * inIm[ch][slot][bin] ); + eq = sqrtf( eneRef / fmaxf( 1e-12f, ene ) ); + eq = fminf( 4.0f, eq ); + inRe[ch][slot][bin] *= eq; + inIm[ch][slot][bin] *= eq; + } + } + } + } + else + { + /* If not in interpolation, but in switched prototype situation, then switch left and right channels */ + if ( hHeadTrackData->lrSwitchedCurrent == 1 ) + { +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +#ifdef JBM_TSM_ON_TCS + for ( slot = 0; slot < nSlots; slot++ ) +#else + for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) +#endif +#else + for ( slot = firstSlot; slot < slotEnd; slot++ ) +#endif + { + for ( bin = 0; bin < nBins; bin++ ) + { + tmpVal = inRe[0][slot][bin]; + inRe[0][slot][bin] = inRe[1][slot][bin]; + inRe[1][slot][bin] = tmpVal; + tmpVal = inIm[0][slot][bin]; + inIm[0][slot][bin] = inIm[1][slot][bin]; + inIm[1][slot][bin] = tmpVal; + } + } + } + } + + return; +} + + +static void eig2x2( + const float E1, + const float E2, + const float Cre, + const float Cim, + float Ure[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Uim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float D[BINAURAL_CHANNELS] ) +{ + int16_t chA, chB, ch; + float s, normVal, crossSquare, a, pm, add; + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + Ure[chA][chB] = 0.0f; + Uim[chA][chB] = 0.0f; + } + } + + crossSquare = ( Cre * Cre ) + ( Cim * Cim ); + a = ( E1 + E2 ) * ( E1 + E2 ) - 4.0f * ( ( E1 * E2 ) - crossSquare ); + pm = 0.5f * sqrtf( max( 0.0f, a ) ); + add = 0.5f * ( E1 + E2 ); + + D[0] = add + pm; + D[1] = max( 0.0f, add - pm ); + + /* Numeric case, when input is practically zeros */ + if ( D[0] < 1e-12f ) + { + Ure[0][0] = 1.0f; + Ure[1][1] = 1.0f; + + return; + } + + /* Numeric case, when input is near an identity matrix with a gain */ + if ( pm < ( 1e-3f * add ) ) + { + Ure[0][0] = 1.0f; + Ure[1][1] = 1.0f; + + return; + } + + /* Eigenvectors */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + if ( fabsf( E2 - D[ch] ) > fabsf( E1 - D[ch] ) ) + { + s = D[ch] - E2; + normVal = sqrtf( 1.0f / ( 1e-12f + crossSquare + s * s ) ); + + Ure[0][ch] = s * normVal; + Ure[1][ch] = Cre * normVal; + Uim[1][ch] = Cim * normVal; + } + else + { + s = D[ch] - E1; + normVal = sqrtf( 1.0f / ( 1e-12f + crossSquare + s * s ) ); + + Ure[1][ch] = s * normVal; + Ure[0][ch] = Cre * normVal; + Uim[0][ch] = -Cim * normVal; + } + } + + return; +} + + +static void matrixDiagMul( + float reIn[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float imIn[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + const float D[BINAURAL_CHANNELS], + float reOut[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float imOut[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +{ + int16_t chA, chB; + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + reOut[chA][chB] = reIn[chA][chB] * D[chB]; + imOut[chA][chB] = imIn[chA][chB] * D[chB]; + } + } + + return; +} + + +static void matrixMul( + float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +{ + int16_t chA, chB; + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + outRe[chA][chB] = Are[chA][0] * Bre[0][chB] + Are[chA][1] * Bre[1][chB]; + outRe[chA][chB] -= Aim[chA][0] * Bim[0][chB] + Aim[chA][1] * Bim[1][chB]; + outIm[chA][chB] = Aim[chA][0] * Bre[0][chB] + Aim[chA][1] * Bre[1][chB]; + outIm[chA][chB] += Are[chA][0] * Bim[0][chB] + Are[chA][1] * Bim[1][chB]; + } + } + + return; +} + + +static void matrixTransp1Mul( + float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +{ + int16_t chA, chB; + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + outRe[chA][chB] = Are[0][chA] * Bre[0][chB] + Are[1][chA] * Bre[1][chB]; + outRe[chA][chB] -= -Aim[0][chA] * Bim[0][chB] - Aim[1][chA] * Bim[1][chB]; + outIm[chA][chB] = -Aim[0][chA] * Bre[0][chB] - Aim[1][chA] * Bre[1][chB]; + outIm[chA][chB] += Are[0][chA] * Bim[0][chB] + Are[1][chA] * Bim[1][chB]; + } + } + + return; +} + + +static void matrixTransp2Mul( + float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Bre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Bim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +{ + int16_t chA, chB; + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + outRe[chA][chB] = Are[chA][0] * Bre[chB][0] + Are[chA][1] * Bre[chB][1]; + outRe[chA][chB] -= Aim[chA][0] * ( -Bim[chB][0] ) + Aim[chA][1] * ( -Bim[chB][1] ); + outIm[chA][chB] = Aim[chA][0] * Bre[chB][0] + Aim[chA][1] * Bre[chB][1]; + outIm[chA][chB] += Are[chA][0] * ( -Bim[chB][0] ) + Are[chA][1] * ( -Bim[chB][1] ); + } + } + + return; +} + + +static void chol2x2( + const float E1, + const float E2, + const float Cre, + const float Cim, + float outRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float outIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS] ) +{ + int16_t chA, chB; + float sqrtVal; + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + outRe[chA][chB] = 0.0f; + outIm[chA][chB] = 0.0f; + } + } + + if ( E1 > E2 ) /* Perform Cholesky decomposition according to louder channel first */ + { + outRe[0][0] = sqrtf( E1 ); + outRe[1][0] = Cre / ( 1e-12f + outRe[0][0] ); + outIm[1][0] = Cim / ( 1e-12f + outRe[0][0] ); + sqrtVal = E2 - ( Cre * Cre + Cim * Cim ) / ( 1e-12f + E1 ); + outRe[1][1] = sqrtf( max( 0.0f, sqrtVal ) ); + } + else + { + outRe[1][1] = sqrtf( E2 ); + outRe[0][1] = Cre / ( 1e-12f + outRe[1][1] ); + outIm[0][1] = -Cim / ( 1e-12f + outRe[1][1] ); + sqrtVal = E1 - ( Cre * Cre + Cim * Cim ) / ( 1e-12f + E2 ); + outRe[0][0] = sqrtf( max( 0.0f, sqrtVal ) ); + } + + return; +} + + +static void formulate2x2MixingMatrix( + float Ein1, + float Ein2, + float CinRe, + float CinIm, + float Eout1, + float Eout2, + float CoutRe, + float CoutIm, + float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], + const float regularizationFactor ) +{ + /* + This function implements a 2x2 solution for an optimized spatial audio rendering algorithm + Vilkamo, J., Bäckström, T. and Kuntz, A., 2013. + "Optimized covariance domain framework for time–frequency processing of spatial audio." + Journal of the Audio Engineering Society, 61(6), pp.403-411. + + The result of the formulas below are the same as those in the publication, however, some + derivation details differ for as simple as possible 2x2 formulattion + */ + int16_t chA, chB; + float maxEne, maxEneDiv; + float KyRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], KyIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float Uxre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Uxim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float Sx[BINAURAL_CHANNELS], Kxre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Kxim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float tmpRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS], tmpIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float Are[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Aim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float Ure[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Uim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float D[BINAURAL_CHANNELS]; + float div[BINAURAL_CHANNELS]; + float Ghat[BINAURAL_CHANNELS]; + float GhatQ[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + float Pre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Pim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; + + /* Normalize energy values */ + maxEne = Ein1; + maxEne = max( maxEne, Ein2 ); + maxEne = max( maxEne, Eout1 ); + maxEne = max( maxEne, Eout2 ); + maxEneDiv = 1.0f / ( maxEne + 1e-12f ); + Ein1 *= maxEneDiv; + Ein2 *= maxEneDiv; + CinRe *= maxEneDiv; + CinIm *= maxEneDiv; + Eout1 *= maxEneDiv; + Eout2 *= maxEneDiv; + CoutRe *= maxEneDiv; + CoutIm *= maxEneDiv; + + /* Cholesky decomposition of target / output covariance matrix */ + chol2x2( Eout1, Eout2, CoutRe, CoutIm, KyRe, KyIm ); + + /* Eigendecomposition of input covariance matrix */ + eig2x2( Ein1, Ein2, CinRe, CinIm, Uxre, Uxim, Sx ); + + /* Eigendecomposition to Kx -- Ux Sx Ux' -> Kx Kx'*/ + Sx[0] = sqrtf( Sx[0] ); + Sx[1] = sqrtf( Sx[1] ); + matrixDiagMul( Uxre, Uxim, Sx, Kxre, Kxim ); + + /* Regularize the diagonal Sx for matrix inversion */ + Sx[0] = max( Sx[0], regularizationFactor * Sx[1] ); + Sx[1] = max( Sx[1], regularizationFactor * Sx[0] ); + + /* This is equivalent to the prototype signal energy normalization in the publication */ + Ghat[0] = sqrtf( Eout1 / ( 1e-12f + max( Ein1, 0.001f * Ein2 ) ) ); + Ghat[1] = sqrtf( Eout2 / ( 1e-12f + max( Ein2, 0.001f * Ein1 ) ) ); + + /* Matrix multiplication, tmp = Ky' * G_hat * Q */ + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + GhatQ[chA][0] = Q[chA][0] * Ghat[chA]; + GhatQ[chA][1] = Q[chA][1] * Ghat[chA]; + } + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + tmpRe[chA][chB] = KyRe[0][chA] * GhatQ[0][chB] + KyRe[1][chA] * GhatQ[1][chB]; + tmpIm[chA][chB] = -KyIm[0][chA] * GhatQ[0][chB] - KyIm[1][chA] * GhatQ[1][chB]; + } + } + + /* A = Ky' * G_hat * Q * Kx (see publication) */ + matrixMul( tmpRe, tmpIm, Kxre, Kxim, Are, Aim ); + + /* Find nearest orthonormal matrix P to A = Ky' * G_hat * Q * Kx + For matrix A that is P = A(A'A)^0.5 + */ + matrixTransp1Mul( Are, Aim, Are, Aim, tmpRe, tmpIm ); + + eig2x2( tmpRe[0][0], tmpRe[1][1], tmpRe[1][0], tmpIm[1][0], Ure, Uim, D ); + + div[0] = min( 10000.0f, sqrtf( 1.0f / ( 1e-12f + D[0] ) ) ); + div[1] = min( 10000.0f, sqrtf( 1.0f / ( 1e-12f + D[1] ) ) ); + + matrixMul( Are, Aim, Ure, Uim, tmpRe, tmpIm ); + + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + tmpRe[chA][chB] *= div[chB]; + tmpIm[chA][chB] *= div[chB]; + } + } + + matrixTransp2Mul( tmpRe, tmpIm, Ure, Uim, Pre, Pim ); /* Nearest orthonormal matrix P to matrix A formulated */ + + /* These are the final formulas of the JAES publication M = Ky P Kx^(-1) */ + for ( chA = 0; chA < BINAURAL_CHANNELS; chA++ ) + { + for ( chB = 0; chB < BINAURAL_CHANNELS; chB++ ) + { + Pre[chA][chB] /= Sx[chB] + 1e-12f; + Pim[chA][chB] /= Sx[chB] + 1e-12f; + } + } + + matrixMul( KyRe, KyIm, Pre, Pim, tmpRe, tmpIm ); + + matrixTransp2Mul( tmpRe, tmpIm, Uxre, Uxim, Mre, Mim ); + + return; +} + + +static void getDirectPartGains( + const int16_t bin, + int16_t aziDeg, + int16_t eleDeg, + float *lRealp, + float *lImagp, + float *rRealp, + float *rImagp, + const uint8_t renderStereoOutputInsteadOfBinaural, + float Rmat[3][3] ) +{ + float aziRad, eleRad; + float y, mappedX, aziRadMapped, A, A2, A3; + const float LsAngleRad = 30.0f * PI_OVER_180; + + if ( renderStereoOutputInsteadOfBinaural ) /* In stereo (i.e. non-binaural) rendering mode */ + { + /* Convert azi and ele to an azi value of the cone of confusion */ + aziRad = (float) aziDeg * PI_OVER_180; + eleRad = (float) eleDeg * PI_OVER_180; + y = ( sinf( aziRad ) * cosf( eleRad ) ); + mappedX = sqrtf( max( 0.0f, 1.0f - ( y * y ) ) ); + aziRadMapped = atan2f( y, mappedX ); + + /* Determine the real valued amplitude panning gains */ + *lImagp = 0.0f; + *rImagp = 0.0f; + if ( aziRadMapped >= LsAngleRad ) + { /* Left side */ + *lRealp = 1.0f; + *rRealp = 0.0f; + } + else if ( aziRadMapped <= -LsAngleRad ) + { /* Right side */ + *lRealp = 0.0f; + *rRealp = 1.0f; + } + else /* Tangent panning law */ + { + A = tanf( aziRadMapped ) / tanf( LsAngleRad ); + A2 = ( A - 1.0f ) / max( 0.001f, A + 1.0f ); + A3 = 1.0f / ( A2 * A2 + 1.0f ); + *lRealp = sqrtf( A3 ); + *rRealp = sqrtf( 1.0f - A3 ); + } + + /* Scaling to have the same expected gain as for the HRTF rendering */ + *lRealp *= SQRT2; + *rRealp *= SQRT2; + } + else /* In regular binaural rendering mode */ + { + rotateAziEle( (float) aziDeg, (float) eleDeg, &aziDeg, &eleDeg, Rmat, 0 ); + hrtfShGetHrtf( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp ); + } + + return; +} + + +static void hrtfShGetHrtf( + const int16_t bin, + const int16_t aziDeg, + const int16_t eleDeg, + float *lRealp, + float *lImagp, + float *rRealp, + float *rImagp ) +{ + int16_t k; + float shVec[HRTF_SH_CHANNELS]; + + ivas_dirac_dec_get_response( aziDeg, + eleDeg, + shVec, + HRTF_SH_ORDER ); + + *lRealp = 0.0f; + *lImagp = 0.0f; + *rRealp = 0.0f; + *rImagp = 0.0f; + for ( k = 0; k < HRTF_SH_CHANNELS; k++ ) + { + *lRealp += hrtfShCoeffsRe[0][k][bin] * shVec[k]; + *lImagp += hrtfShCoeffsIm[0][k][bin] * shVec[k]; + *rRealp += hrtfShCoeffsRe[1][k][bin] * shVec[k]; + *rImagp += hrtfShCoeffsIm[1][k][bin] * shVec[k]; + } + + return; +} + + +/*------------------------------------------------------------------------- + * configure_reqularization_factor() + * + * Configure regularization factor for the mixing matrix generation of the + * parametric binauralizer using IVAS codec format and current bitrate. + *------------------------------------------------------------------------*/ + +/*! r: Configured reqularization factor value */ +#ifndef FIX_417_TD_DECORR_BRATE_SW +static +#endif + float + configure_reqularization_factor( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ + ) +{ + float reqularizationFactor; + reqularizationFactor = 1.0f; /* Default value */ + + if ( ivas_format == MASA_FORMAT ) + { +#ifdef FIX_447_PARAMBIN_MASA_REGU_FAC + if ( ivas_total_brate >= IVAS_160k ) + { + reqularizationFactor = 0.4f; + } +#else + if ( ivas_total_brate >= IVAS_256k ) + { + reqularizationFactor = 0.2f; + } + else if ( ivas_total_brate == IVAS_192k ) + { + reqularizationFactor = 0.3f; + } + else if ( ivas_total_brate == IVAS_160k ) + { + reqularizationFactor = 0.4f; + } +#endif + else if ( ivas_total_brate == IVAS_128k ) + { + reqularizationFactor = 0.5f; + } + else if ( ivas_total_brate == IVAS_96k ) + { + reqularizationFactor = 0.6f; + } + else if ( ivas_total_brate >= IVAS_64k ) + { + reqularizationFactor = 0.8f; + } + else + { + reqularizationFactor = 1.0f; + } + } + + if ( ivas_format == MC_FORMAT ) /* This is always McMASA for parametric binauralizer. */ + { + if ( ivas_total_brate >= IVAS_96k ) + { +#ifdef FIX_447_PARAMBIN_MASA_REGU_FAC + reqularizationFactor = 0.4f; +#else + reqularizationFactor = 0.3f; +#endif + } + else if ( ivas_total_brate >= IVAS_80k ) + { + reqularizationFactor = 0.5f; + } + else if ( ivas_total_brate >= IVAS_64k ) + { + reqularizationFactor = 0.7f; + } + else if ( ivas_total_brate >= IVAS_48k ) + { + reqularizationFactor = 0.8f; + } + else + { + reqularizationFactor = 1.0f; + } + } + + /* For SBA and parametric ISM, currently in default value of 1.0f. */ + + return reqularizationFactor; +} diff --git a/lib_rend/ivas_efap.c b/lib_rend/ivas_efap.c index 587046082db95dbfaaf3bb3ed5b6e43e847d4c79..4301d75dec749b89b32404dbcad9c59de9dd329e 100644 --- a/lib_rend/ivas_efap.c +++ b/lib_rend/ivas_efap.c @@ -37,8 +37,8 @@ #include "options.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_stat_dec.h" -#include "ivas_rom_dec.h" #ifdef DEBUGGING #include "debug.h" #endif @@ -101,6 +101,7 @@ static float vertex_distance( const EFAP_VERTEX *vtxArray, const EFAP_LS_TRIANGL static float point_plane_distance( const float P1[3], const float P2[3], const float P3[3], const float X[3] ); static float point_poly_distance( const EFAP_POLYSET poly, const float X[3] ); + static void efap_crossp( const float *v1, const float *v2, float *v ); static int16_t find_int_in_tri( const EFAP_LS_TRIANGLE *tri, const int16_t n, const int16_t r, int16_t *pos ); diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index ba5f02da636d5bdd583db631b781f0e3eb1211de..2b1f16d025cfb0c9166a5c5c80c6c5489e0ca305 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -33,192 +33,10 @@ #include #include "options.h" #include "prot.h" -#include "ivas_prot.h" -#include "lib_dec.h" -#include "string.h" -#include "assert.h" -#include "ivas_rom_TdBinauralRenderer.h" +#include "ivas_prot_rend.h" #include "ivas_error.h" #include "wmc_auto.h" - -/*-------------------------------------------------------------------* - * Local constants - *-------------------------------------------------------------------*/ - -#define RESAMPLE_FACTOR_16_48 ( 16.0f / 48.0f ) -#define RESAMPLE_FACTOR_32_48 ( 32.0f / 48.0f ) - - -/*-------------------------------------------------------------------* - * BSplineModelEvalAlloc() - * - * Allocate the B Spline HR Filter model. - --------------------------------------------------------------------*/ - -void BSplineModelEvalAlloc( - ModelParams_t *model, /* i : Model parameters */ - ModelEval_t *modelEval /* i/o: Model evaluation structure */ -) -{ - modelEval->hrfModL = (float *) malloc( model->K * sizeof( float ) ); - modelEval->hrfModR = (float *) malloc( model->K * sizeof( float ) ); - - return; -} - - -/*-------------------------------------------------------------------* - * DefaultBSplineModel() - * - * Init default HRTF model - --------------------------------------------------------------------*/ - -void DefaultBSplineModel( - TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* o : Loaded HR filter set */ - const int32_t output_Fs /* i : Output sampling rate */ -) -{ - ModelParams_t *model; - ModelParamsITD_t *modelITD; - int16_t i, j; - - HrFiltSet_p->FilterMethod = TDREND_HRFILT_Method_BSplineModel; - model = &( HrFiltSet_p->ModelParams ); - modelITD = &( HrFiltSet_p->ModelParamsITD ); - - /* Set ROM flag for correct deallocation */ - model->modelROM = TRUE; - - /* int16_t parameters */ - model->UseItdModel = 1; - model->SplineDegree = 4; - model->elevDim2 = 20; - model->elevDim3 = 18; - model->AlphaN = 578; - model->num_unique_azim_splines = 1; - model->elevSegSamples = 3; - model->elevBsLen[0] = 4; - model->elevBsLen[1] = 7; - model->elevBsLen[2] = 10; - model->elevBsLen[3] = 7; - model->elevBsStart[0] = 0; - model->elevBsStart[1] = 4; - model->elevBsStart[2] = 11; - model->elevBsStart[3] = 21; - - model->azimDim2 = orange53_rom_azimDim2; - model->azimDim3 = orange53_rom_azimDim3; - model->azim_start_idx = orange53_rom_azim_start_idx; - model->azimSegSamples = orange53_rom_azimSegSamples; - model->azimShapeIdx = orange53_rom_azimShapeIdx; - model->azimShapeSampFactor = orange53_rom_azimShapeSampFactor; - - /* float parameters */ - model->elevKSeq = (const float *) orange53_rom_elevKSeq; - model->elevBsShape = (const float *) orange53_rom_elevBsShape; - - model->azimBsShape = (const float **) malloc( model->num_unique_azim_splines * sizeof( float * ) ); - model->azimBsShape[0] = (const float *) orange53_rom_azimBsShape; - model->azimKSeq = (float **) malloc( 18 * sizeof( float * ) ); - model->azimKSeq[0] = (float *) malloc( 2 * sizeof( float * ) ); - model->azimKSeq[17] = (float *) malloc( 2 * sizeof( float * ) ); - model->azimKSeq[0][0] = 0.0f; - model->azimKSeq[17][0] = 0.0f; - model->azimKSeq[0][1] = 360.0f; - model->azimKSeq[17][1] = 360.0f; - - for ( i = 1; i < 17; i++ ) - { - model->azimKSeq[i] = (float *) malloc( model->azimDim2[i] * sizeof( float * ) ); /* azimDim2[i] = 91, i=2..15 */ - for ( j = 0; j < model->azimDim2[i]; j++ ) - { - model->azimKSeq[i][j] = (float) orange53_rom_azimSegSamples[0] * j; - } - } - - switch ( output_Fs ) - { - case 48000: - model->AlphaL = (const float *) orange53_rom_AlphaL48; - model->AlphaR = (const float *) orange53_rom_AlphaR48; - model->EL = (const float *) orange53_rom_EL48; - model->ER = (const float *) orange53_rom_ER48; - model->K = 128; - if ( HrFiltSet_p->ModelParams.UseItdModel ) - { - modelITD->resamp_factor = 1.0f; - } - break; - case 32000: - model->AlphaL = (const float *) orange53_rom_AlphaL32; - model->AlphaR = (const float *) orange53_rom_AlphaR32; - model->EL = (const float *) orange53_rom_EL32; - model->ER = (const float *) orange53_rom_ER32; - model->K = 86; - if ( HrFiltSet_p->ModelParams.UseItdModel ) - { - modelITD->resamp_factor = RESAMPLE_FACTOR_32_48; - } - break; - case 16000: - model->AlphaL = (const float *) orange53_rom_AlphaL16; - model->AlphaR = (const float *) orange53_rom_AlphaR16; - model->EL = (const float *) orange53_rom_EL16; - model->ER = (const float *) orange53_rom_ER16; - model->K = 43; - if ( HrFiltSet_p->ModelParams.UseItdModel ) - { - modelITD->resamp_factor = RESAMPLE_FACTOR_16_48; - } - break; - default: - break; - } - - modelITD->N = 4; - modelITD->elevDim2 = 20; - modelITD->elevDim3 = 18; - modelITD->azimDim2 = 41; - modelITD->azimDim3 = 41; - modelITD->elevSegSamples = 3; - modelITD->elevBsLen[0] = 4; - modelITD->elevBsLen[1] = 7; - modelITD->elevBsLen[2] = 10; - modelITD->elevBsLen[3] = 7; - modelITD->elevBsStart[0] = 0; - modelITD->elevBsStart[1] = 4; - modelITD->elevBsStart[2] = 11; - modelITD->elevBsStart[3] = 21; - - modelITD->elevKSeq = model->elevKSeq; - - modelITD->azimBsLen[0] = 11; - modelITD->azimBsLen[1] = 21; - modelITD->azimBsLen[2] = 31; - modelITD->azimBsLen[3] = 21; - modelITD->azimBsStart[0] = 0; - modelITD->azimBsStart[1] = 11; - modelITD->azimBsStart[2] = 32; - modelITD->azimBsStart[3] = 63; - - modelITD->azimSegSamples = 10; - - modelITD->azimKSeq = orange53_rom_ITD_azimKSeq; - modelITD->W = (const float *) orange53_rom_ITD_W; - modelITD->azimBsShape = (const float *) orange53_rom_ITD_azimBsShape; - modelITD->elevBsShape = (const float *) orange53_rom_ITD_elevBsShape; - - HRTF_model_precalc( model ); - - HrFiltSet_p->SampleRate = output_Fs; - HrFiltSet_p->FiltLength = HrFiltSet_p->ModelParams.K; - BSplineModelEvalAlloc( &HrFiltSet_p->ModelParams, &HrFiltSet_p->ModelEval ); - - return; -} - - /*-----------------------------------------------------------------------* * ivas_HRTF_binary_open() * @@ -260,7 +78,6 @@ void ivas_HRTF_binary_close( } -#ifdef HRTF_BINARY_FILE /*-----------------------------------------------------------------------* * ivas_HRTF_CRend_binary_open() * @@ -284,6 +101,7 @@ ivas_error ivas_HRTF_CRend_binary_open( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * ivas_HRTF_CRend_binary_close() * @@ -298,16 +116,13 @@ void ivas_HRTF_CRend_binary_close( return; } - destroy_SetOfHRTF( *hSetOfHRTF ); - free( *hSetOfHRTF ); *hSetOfHRTF = NULL; return; } -#endif -#ifdef HRTF_BINARY_FILE + /*-----------------------------------------------------------------------* * ivas_HRTF_fastconv_binary_open() * @@ -326,6 +141,7 @@ ivas_error ivas_HRTF_fastconv_binary_open( return IVAS_ERR_OK; } + /*-----------------------------------------------------------------------* * ivas_HRTF_fastconv_binary_close() * @@ -345,9 +161,8 @@ void ivas_HRTF_fastconv_binary_close( return; } -#endif -#ifdef HRTF_BINARY_FILE + /*-----------------------------------------------------------------------* * ivas_HRTF_parambin_binary_open() * @@ -366,6 +181,7 @@ ivas_error ivas_HRTF_parambin_binary_open( return IVAS_ERR_OK; } + /*-----------------------------------------------------------------------* * ivas_HRTF_parambin_binary_close() * @@ -385,4 +201,3 @@ void ivas_HRTF_parambin_binary_close( return; } -#endif diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h deleted file mode 100644 index 4d36ecf7f021f085004d6770938ddeed16f1f793..0000000000000000000000000000000000000000 --- a/lib_rend/ivas_lib_rend_internal.h +++ /dev/null @@ -1,132 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2023 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. - -*******************************************************************************************************/ - -#include "ivas_error.h" -#ifdef FIX_197_CREND_INTERFACE -#include "ivas_stat_rend.h" -#else -#include "lib_rend.h" -#endif -#include "ivas_stat_dec.h" - -#ifndef IVAS_LIB_REND_INTERNALS_H -#define IVAS_LIB_REND_INTERNALS_H - -#ifndef FIX_197_CREND_INTERFACE -typedef struct -{ - int8_t headRotEnabled; - IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; - float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; -} IVAS_REND_HeadRotData; - -typedef struct -{ - int32_t binaural_latency_ns; - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; - TDREND_HRFILT_FiltSet_t *hHrtfTD; -} TDREND_WRAPPER; - -typedef struct -{ - int32_t binaural_latency_ns; - CREND_HANDLE hCrend; - HRTFS_HANDLE hHrtfCrend; -} CREND_WRAPPER; - -IVAS_REND_AudioConfigType getAudioConfigType( - const IVAS_REND_AudioConfig config ); - -ivas_error getAudioConfigNumChannels( - const IVAS_REND_AudioConfig config, - int16_t *numChannels ); - -AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( - IVAS_REND_AudioConfig config ); - -ivas_error ivas_rend_openCrend( - CREND_WRAPPER *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, - RENDER_CONFIG_DATA *hRendCfg, -#ifdef HRTF_BINARY_FILE - HRTFS_CREND_HANDLE hSetOfHRTF, -#endif - const int32_t output_Fs ); - -ivas_error ivas_rend_initCrend( - CREND_WRAPPER *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, - RENDER_CONFIG_DATA *hRendCfg, -#ifdef HRTF_BINARY_FILE - HRTFS_CREND_HANDLE hSetOfHRTF, -#endif - const int32_t output_Fs ); - -ivas_error ivas_rend_closeCrend( - CREND_WRAPPER *pCrend ); - -ivas_error ivas_rend_crendProcess( - const CREND_WRAPPER *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, - float output[][L_FRAME48k], /* i/o: input/output audio channels */ - const int32_t output_Fs ); - -ivas_error ivas_rend_crendConvolver( - const CREND_WRAPPER *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, - float pcm_in[][L_FRAME48k], - float pcm_out[][L_FRAME48k], - const int32_t output_Fs, - const int16_t i_ts ); -#endif - -ivas_error ivas_rend_TDObjRenderFrame( - const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ - const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ - const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ - const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ - const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ - const int16_t output_frame, /* i : output frame length */ - float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ -); - -ivas_error ivas_rend_TDObjRendOpen( - TDREND_WRAPPER *pTDRend, - const IVAS_REND_AudioConfig inConfig, - LSSETUP_CUSTOM_STRUCT *customLsInput, - const int32_t output_Fs ); - -#endif diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index 19b1a828b7c7e2b9af57a1c5375cd366a6de1fb5..7875165e51d0ce47be819eba3bd6124fe92061be 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -29,13 +29,12 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -// VE2AT: keep in lib_rend or move to lib_dec ? -#include -#include -#include -#include "ivas_prot.h" +#include +#include "options.h" +#include #include "prot.h" +#include "ivas_prot_rend.h" #include "wmc_auto.h" #include @@ -115,7 +114,10 @@ IVAS_LIMITER_HANDLE ivas_limiter_open( return NULL; } - hLimiter = malloc( sizeof( IVAS_LIMITER ) ); + if ( ( hLimiter = malloc( sizeof( IVAS_LIMITER ) ) ) == NULL ) + { + return NULL; + } hLimiter->max_num_channels = max_num_channels; hLimiter->num_channels = max_num_channels; @@ -169,11 +171,15 @@ void ivas_limiter_close( *-------------------------------------------------------------------*/ void ivas_limiter_dec( - IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ + IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ +#ifdef JBM_TSM_ON_TCS + float *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ +#else float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], /* i/o: input/output buffer */ - const int16_t num_channels, /* i : number of channels to be processed */ - const int16_t output_frame, /* i : number of samples per channel in the buffer */ - const int16_t BER_detect /* i : BER detect flag */ +#endif + const int16_t num_channels, /* i : number of channels to be processed */ + const int16_t output_frame, /* i : number of samples per channel in the buffer */ + const int16_t BER_detect /* i : BER detect flag */ ) { int16_t c; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 7c8173e22226eae005002658baf2bd559321f822..83db83293750b00ae85ae5b3a5f721d9c2a0da84 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -30,48 +30,51 @@ *******************************************************************************************************/ +#include "ivas_stat_rend.h" #include #include "options.h" #include "prot.h" +#ifdef ISM_NON_DIEGETIC_PAN #include "ivas_prot.h" +#endif +#include "ivas_prot_rend.h" #include -#include "wmc_auto.h" #include "ivas_rom_com.h" -#include "lib_rend.h" -#include "ivas_lib_rend_internal.h" #ifdef DEBUGGING #include "debug.h" #endif +#include "wmc_auto.h" /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ -static ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, float output[][L_FRAME48k], const int16_t subframe_length, const int16_t subframe_idx ); + static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd ); -static void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, - const int16_t headRotEnabled, - const IVAS_QUATERNION *headPosition ); -static void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, - const int16_t numSources, - const int16_t lfe_idx, - const IVAS_FORMAT in_format, - const ISM_METADATA_HANDLE *hIsmMetaData, - float output[][L_FRAME48k] ); +static void angles_to_vec( const float radius, const float azimuth, const float elevation, float *vec ); + /*---------------------------------------------------------------------* - * ivas_td_binaural_open() + * ivas_td_binaural_open_unwrap() * - * Open and initialize TD Object binaural renderer + * Call TD open/init function without st_ivas *---------------------------------------------------------------------*/ -ivas_error ivas_td_binaural_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +ivas_error ivas_td_binaural_open_unwrap( + TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HR filter model (from file or NULL) */ + const int32_t output_Fs, /* i : Output sampling rate */ + const int16_t nchan_transport, /* i : Number of channels */ + const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ + const float *directivity, /* i : Directivity pattern (used for ISM) */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ + int32_t *binaural_latency_ns /* i : Binauralization delay */ ) { - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; + BINAURAL_TD_OBJECT_RENDERER_HANDLE pBinRendTd; TDREND_PosType_t PosType; int16_t nS; int16_t SrcInd[MAX_NUM_TDREND_CHANNELS]; @@ -84,55 +87,61 @@ ivas_error ivas_td_binaural_open( error = IVAS_ERR_OK; - if ( ( hBinRendererTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) + if ( ( pBinRendTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } - if ( ( hBinRendererTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) + if ( ( pBinRendTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } - if ( ( hBinRendererTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) + if ( ( pBinRendTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } - if ( ( hBinRendererTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) + if ( ( pBinRendTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } - hBinRendererTd->NumOfSrcs = 0; - hBinRendererTd->MaxSrcInd = -1; + pBinRendTd->NumOfSrcs = 0; + pBinRendTd->MaxSrcInd = -1; /* Mixer spatial setup */ - hBinRendererTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; - hBinRendererTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ + pBinRendTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; + pBinRendTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ - TDREND_MIX_Init( hBinRendererTd, &st_ivas->hHrtfTD, hBinRendererTd->TdRend_MixSpatSpec_p, st_ivas->hDecoderConfig->output_Fs ); + if ( ( error = TDREND_MIX_Init( pBinRendTd, hHrtfTD, pBinRendTd->TdRend_MixSpatSpec_p, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } /* Set the attenuation (or can set MixSpatSpec.DistAttenModel above) */ - TDREND_MIX_SetDistAttenModel( hBinRendererTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); + if ( ( error = TDREND_MIX_SetDistAttenModel( pBinRendTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ) ) != IVAS_ERR_OK ) + { + return error; + } /* Add sources to module and mixer, headphones */ PosType = TDREND_POSTYPE_ABSOLUTE; /* or TDREND_POSTYPE_RELATIVE_TO_LISTENER */ - nchan_rend = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == MC_FORMAT ) + nchan_rend = nchan_transport; + if ( ( ivas_format == MC_FORMAT ) && ( transport_config != AUDIO_CONFIG_LS_CUSTOM ) ) { nchan_rend--; /* Skip LFE channel -- added to the others */ } for ( nS = 0; nS < nchan_rend; nS++ ) { - if ( ( error = TDREND_MIX_AddSrc( hBinRendererTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) + if ( ( error = TDREND_MIX_AddSrc( pBinRendTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) { return error; } } - if ( st_ivas->ivas_format == MC_FORMAT ) + if ( ivas_format == MC_FORMAT ) { - switch ( st_ivas->transport_config ) + switch ( transport_config ) { case AUDIO_CONFIG_5_1: ls_azimuth = ls_azimuth_CICP6; @@ -155,22 +164,20 @@ ivas_error ivas_td_binaural_open( ls_elevation = ls_elevation_CICP19; break; case AUDIO_CONFIG_LS_CUSTOM: - ls_azimuth = st_ivas->hTransSetup.ls_azimuth; - ls_elevation = st_ivas->hTransSetup.ls_elevation; + ls_azimuth = hTransSetup.ls_azimuth; + ls_elevation = hTransSetup.ls_elevation; break; default: ls_azimuth = NULL; ls_elevation = NULL; } - DirAtten_p = hBinRendererTd->DirAtten_p; + DirAtten_p = pBinRendTd->DirAtten_p; for ( nS = 0; nS < nchan_rend; nS++ ) { /* Set source positions according to loudspeaker layout */ - Pos[0] = cosf( ls_elevation[nS] * PI_OVER_180 ) * cosf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[1] = cosf( ls_elevation[nS] * PI_OVER_180 ) * sinf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[2] = sinf( ls_elevation[nS] * PI_OVER_180 ); + angles_to_vec( 1.0f, ls_azimuth[nS], ls_elevation[nS], Pos ); Dir[0] = 1.0f; Dir[1] = 0.0f; Dir[2] = 0.0f; @@ -180,16 +187,36 @@ ivas_error ivas_td_binaural_open( DirAtten_p->ConeOuterAngle = 360.0f; DirAtten_p->ConeOuterGain = 1.0f; - TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); - TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); - TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); + TDREND_MIX_SRC_SetPos( pBinRendTd, nS, Pos ); + TDREND_MIX_SRC_SetDir( pBinRendTd, nS, Dir ); + TDREND_MIX_SRC_SetPlayState( pBinRendTd, nS, TDREND_PLAYSTATUS_PLAYING ); + TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ); } } + if ( ivas_format == ISM_FORMAT ) + { + DirAtten_p = pBinRendTd->DirAtten_p; + if ( NULL == directivity ) + { + DirAtten_p->ConeInnerAngle = 360.0f; /* Front cone */ + DirAtten_p->ConeOuterAngle = 360.0f; /* Back cone */ + DirAtten_p->ConeOuterGain = 1.0f; /* Back attenuation */ + } + else + { + DirAtten_p->ConeInnerAngle = directivity[0]; + DirAtten_p->ConeOuterAngle = directivity[1]; + DirAtten_p->ConeOuterGain = directivity[2]; + } - st_ivas->hBinRendererTd = hBinRendererTd; + for ( nS = 0; nS < nchan_rend; nS++ ) + { + TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ); + } + } - st_ivas->binaural_latency_ns = (int32_t) ( BINAURAL_TD_LATENCY_S * 1000000000.f ); + *hBinRendererTd = pBinRendTd; + *binaural_latency_ns = (int32_t) ( ( *hBinRendererTd )->HrFiltSet_p->latency_s * 1000000000.f ); return error; } @@ -221,72 +248,83 @@ void ivas_td_binaural_close( return; } - /*---------------------------------------------------------------------* - * ObjRenderIVASFrame() + * ivas_td_binaural_renderer_unwrap() * - * Receives the current frames for the object streams, updates metadata - * and renders the current frame. + * Call ivas_td_binaural_renderer() without st_ivas. *---------------------------------------------------------------------*/ -void ObjRenderIVASFrame( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +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 int16_t Opt_Headrotation, /* i : Head rotation flag */ + const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ + const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: SCE channels / Binaural synthesis */ +#else float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame /* i : output frame length */ +#endif + const int16_t output_frame /* i : output frame length */ ) { int16_t subframe_length; int16_t subframe_idx; float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; + ivas_error error; +#ifdef JBM_TSM_ON_TCS + float *p_reverb_signal[BINAURAL_CHANNELS]; + int16_t ch; - subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; - if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) - { -#ifdef FIX_197_CREND_INTERFACE - ivas_reverb_open( &st_ivas->hCrendWrapper->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); -#else - ivas_reverb_open( &st_ivas->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); -#endif - } + p_reverb_signal[ch] = reverb_signal[ch]; } +#endif + + subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; /* Update object position(s) */ - TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, output ); + TDREND_Update_object_positions( hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, output ); for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ - TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, - st_ivas->hDecoderConfig->Opt_Headrotation, - ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[subframe_idx] : NULL ); + TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL, ( Pos != NULL ) ? &Pos[subframe_idx] : NULL ); - if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) + if ( hReverb != NULL && hReverb->pConfig.roomAcoustics.late_reverb_on ) { -#ifdef FIX_197_CREND_INTERFACE - ivas_reverb_process( st_ivas->hCrendWrapper->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_reverb_process( hReverb, transport_config, 0, output, p_reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) #else - ivas_reverb_process( st_ivas->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); + if ( ( error = ivas_reverb_process( hReverb, transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) #endif + { + return error; + } } /* Render subframe */ - TDREND_GetMix( st_ivas->hBinRendererTd, output, subframe_length, subframe_idx ); + if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ) ) != IVAS_ERR_OK ) + { + return error; + } } - if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ + + if ( hReverb != NULL && hReverb->pConfig.roomAcoustics.late_reverb_on ) { - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) - { - /* add reverb to rendered signals */ - v_add( reverb_signal[0], output[0], output[0], output_frame ); - v_add( reverb_signal[1], output[1], output[1], output_frame ); - } + /* add reverb to rendered signals */ + v_add( reverb_signal[0], output[0], output[0], output_frame ); + v_add( reverb_signal[1], output[1], output[1], output_frame ); } - return; + return IVAS_ERR_OK; } @@ -295,11 +333,16 @@ void ObjRenderIVASFrame( * * Render one 5 ms subframe from the mixer *---------------------------------------------------------------------*/ -static ivas_error TDREND_GetMix( + +ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - float output[][L_FRAME48k], /* i/o: ISm object synth / rendered output in 0,1 */ - const int16_t subframe_length, /* i/o: subframe length */ - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ +#else + float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ +#endif + const int16_t subframe_length, /* i/o: subframe length */ + const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ ) { int16_t i; @@ -311,6 +354,10 @@ static ivas_error TDREND_GetMix( float hrf_left_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; int16_t intp_count; +#ifdef ISM_NON_DIEGETIC_PAN + float pan_left, pan_right; +#endif + error = IVAS_ERR_OK; /* Clear the output buffer to accumulate rendered sources */ @@ -331,7 +378,11 @@ static ivas_error TDREND_GetMix( SrcRend_p = Src_p->SrcRend_p; /* Update rendering params if needed */ +#ifdef ISM_NON_DIEGETIC_PAN + if ( ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) ) +#else if ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) +#endif { TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev, Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_idx ); @@ -342,6 +393,16 @@ static ivas_error TDREND_GetMix( { error = TDREND_REND_RenderSourceHRFilt( Src_p, hrf_left_delta, hrf_right_delta, intp_count, output_buf, subframe_length ); } + +#ifdef ISM_NON_DIEGETIC_PAN + if ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ) ) + { + pan_left = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f; + pan_right = 1.f - pan_left; + v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], pan_left, output_buf[0], subframe_length ); + v_multc_acc( &Src_p->InputFrame_p[subframe_idx * subframe_length], pan_right, output_buf[1], subframe_length ); + } +#endif } /* Populate output variable */ @@ -377,19 +438,24 @@ static void TDREND_Clear_Update_flags( return; } + /*---------------------------------------------------------------------* * TDREND_Update_object_positions() * * Update object position(s) *---------------------------------------------------------------------*/ -static void TDREND_Update_object_positions( +void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ - const int16_t numSources, /* i : Number of sources to render */ + const int16_t num_src, /* i : number of sources to render */ const int16_t lfe_idx, /* i : Input LFE index */ const IVAS_FORMAT in_format, /* i : Format of input sources */ const ISM_METADATA_HANDLE *hIsmMetaData, /* i : Input metadata for ISM objects */ - float output[][L_FRAME48k] /* i/o: SCE/MC channels */ +#ifdef JBM_TSM_ON_TCS + float *output[] +#else + float output[][L_FRAME48k] /* i/o: SCE/MC channels */ +#endif ) { TDREND_DirAtten_t *DirAtten_p; @@ -402,7 +468,7 @@ static void TDREND_Update_object_positions( /* For each source, write the frame data to the source object*/ c_indx = 0; - for ( nS = 0; nS < numSources; nS++ ) + for ( nS = 0; nS < num_src; nS++ ) { if ( !( in_format == MC_FORMAT && nS == lfe_idx ) ) /* Skip LFE for MC */ { @@ -416,13 +482,8 @@ static void TDREND_Update_object_positions( /* Update the source positions */ /* Source position and direction */ - Pos[0] = cosf( hIsmMetaData[nS]->elevation * PI_OVER_180 ) * cosf( hIsmMetaData[nS]->azimuth * PI_OVER_180 ); - Pos[1] = cosf( hIsmMetaData[nS]->elevation * PI_OVER_180 ) * sinf( hIsmMetaData[nS]->azimuth * PI_OVER_180 ); - Pos[2] = sinf( hIsmMetaData[nS]->elevation * PI_OVER_180 ); - Dir[0] = 1.0f; - Dir[1] = 0.0f; - Dir[2] = 0.0f; - + angles_to_vec( hIsmMetaData[nS]->radius, hIsmMetaData[nS]->azimuth, hIsmMetaData[nS]->elevation, Pos ); + angles_to_vec( 1.0f, hIsmMetaData[nS]->yaw, hIsmMetaData[nS]->pitch, Dir ); /* Source directivity info */ DirAtten_p->ConeInnerAngle = 360.0f; DirAtten_p->ConeOuterAngle = 360.0f; @@ -430,8 +491,23 @@ static void TDREND_Update_object_positions( TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); +#ifdef ISM_NON_DIEGETIC_PAN + if ( hIsmMetaData[nS]->non_diegetic_flag ) + { + Pos[0] = 0; + Pos[1] = hIsmMetaData[nS]->azimuth / 90.f; + Pos[2] = 0; + TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); + TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING_NON_DIEGETIC ); + } + else + { + TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); + } +#else + TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); +#endif TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); } } @@ -439,28 +515,24 @@ static void TDREND_Update_object_positions( return; } + /*---------------------------------------------------------------------* * TDREND_Update_listener_orientation() * * Update listener orientation (s) *---------------------------------------------------------------------*/ -static void TDREND_Update_listener_orientation( +void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t headRotEnabled, /* i : Headrotation flag */ - const IVAS_QUATERNION *headPosition /* i : Head Position */ + const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ + const IVAS_VECTOR3 *Pos /* i : Listener Position */ ) { - float Pos[3]; float FrontVec[3]; float UpVec[3]; float Rmat[3][3]; - - /* Update the listener's location/orientation */ - /* Listener at the origin */ - Pos[0] = 0.0f; - Pos[1] = 0.0f; - Pos[2] = 0.0f; + float Pos_p[3]; if ( headRotEnabled ) { @@ -474,6 +546,10 @@ static void TDREND_Update_listener_orientation( UpVec[0] = Rmat[2][0]; UpVec[1] = Rmat[2][1]; UpVec[2] = Rmat[2][2]; + /* Input position */ + Pos_p[0] = ( *Pos ).x; + Pos_p[1] = ( *Pos ).y; + Pos_p[2] = ( *Pos ).z; } else { @@ -485,194 +561,118 @@ static void TDREND_Update_listener_orientation( UpVec[0] = 0.0f; UpVec[1] = 0.0f; UpVec[2] = 1.0f; + /* Listener at the origin */ + Pos_p[0] = 0.0f; + Pos_p[1] = 0.0f; + Pos_p[2] = 0.0f; } /* Set the listener position and orientation:*/ - TDREND_MIX_LIST_SetPos( hBinRendererTd, Pos ); + TDREND_MIX_LIST_SetPos( hBinRendererTd, Pos_p ); TDREND_MIX_LIST_SetOrient( hBinRendererTd, FrontVec, UpVec ); return; } -ivas_error ivas_rend_TDObjRendOpen( +/*---------------------------------------------------------------------* + * ivas_td_binaural_open_ext() + * + * + *---------------------------------------------------------------------*/ + +ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, IVAS_REND_AudioConfig inConfig, + RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t outFs ) { - /* TODO tmu : Based on ivas_td_binaural_open() - could be harmonized / refactored - - review error handling - - review hHrtfTD init - */ - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; - TDREND_PosType_t PosType; - int16_t nS; - int16_t SrcInd[MAX_NUM_TDREND_CHANNELS]; - const float *ls_azimuth, *ls_elevation; - float Pos[3]; - float Dir[3]; - TDREND_DirAtten_t *DirAtten_p; - int16_t nchan_rend; + int16_t nchan_transport; + AUDIO_CONFIG transport_config; + IVAS_FORMAT ivas_format; + IVAS_OUTPUT_SETUP hTransSetup; ivas_error error; - - error = IVAS_ERR_OK; - - if ( ( hBinRendererTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } + float *directivity = NULL; if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { - getAudioConfigNumChannels( inConfig, &nchan_rend ); - if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_transport ) ) != IVAS_ERR_OK ) { - nchan_rend--; /* Skip LFE channel -- added to the others */ + return error; } } else { - nchan_rend = customLsInput->num_spk; + nchan_transport = customLsInput->num_spk; } - hBinRendererTd->NumOfSrcs = 0; - hBinRendererTd->MaxSrcInd = -1; - - /* Mixer spatial setup */ - hBinRendererTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; - hBinRendererTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ - - TDREND_MIX_Init( hBinRendererTd, &pTDRend->hHrtfTD, hBinRendererTd->TdRend_MixSpatSpec_p, outFs ); - - /* Set the attenuation (or can set MixSpatSpec.DistAttenModel above) */ - TDREND_MIX_SetDistAttenModel( hBinRendererTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); - - /* Add sources to module and mixer, headphones */ - PosType = TDREND_POSTYPE_ABSOLUTE; /* or TDREND_POSTYPE_RELATIVE_TO_LISTENER */ + transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); + ivas_format = ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? MC_FORMAT : ISM_FORMAT; + hTransSetup.ls_azimuth = customLsInput->ls_azimuth; + hTransSetup.ls_elevation = customLsInput->ls_elevation; - for ( nS = 0; nS < nchan_rend; nS++ ) + if ( NULL != hRendCfg ) { - if ( ( error = TDREND_MIX_AddSrc( hBinRendererTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) - { - return error; - } + directivity = hRendCfg->directivity; } - if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - switch ( inConfig ) - { - case IVAS_REND_AUDIO_CONFIG_5_1: - ls_azimuth = ls_azimuth_CICP6; - ls_elevation = ls_elevation_CICP6; - break; - case IVAS_REND_AUDIO_CONFIG_7_1: - ls_azimuth = ls_azimuth_CICP12; - ls_elevation = ls_elevation_CICP12; - break; - case IVAS_REND_AUDIO_CONFIG_5_1_2: - ls_azimuth = ls_azimuth_CICP14; - ls_elevation = ls_elevation_CICP14; - break; - case IVAS_REND_AUDIO_CONFIG_5_1_4: - ls_azimuth = ls_azimuth_CICP16; - ls_elevation = ls_elevation_CICP16; - break; - case IVAS_REND_AUDIO_CONFIG_7_1_4: - ls_azimuth = ls_azimuth_CICP19; - ls_elevation = ls_elevation_CICP19; - break; - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: - ls_azimuth = customLsInput->ls_azimuth; - ls_elevation = customLsInput->ls_elevation; - break; - default: - ls_azimuth = NULL; - ls_elevation = NULL; - } - - DirAtten_p = hBinRendererTd->DirAtten_p; - - for ( nS = 0; nS < nchan_rend; nS++ ) - { - /* Set source positions according to loudspeaker layout */ - Pos[0] = cosf( ls_elevation[nS] * PI_OVER_180 ) * cosf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[1] = cosf( ls_elevation[nS] * PI_OVER_180 ) * sinf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[2] = sinf( ls_elevation[nS] * PI_OVER_180 ); - Dir[0] = 1.0f; - Dir[1] = 0.0f; - Dir[2] = 0.0f; - - /* Source directivity info */ - DirAtten_p->ConeInnerAngle = 360.0f; - DirAtten_p->ConeOuterAngle = 360.0f; - DirAtten_p->ConeOuterGain = 1.0f; - - TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); - TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); - TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); - } - } - - pTDRend->hBinRendererTd = hBinRendererTd; - - pTDRend->binaural_latency_ns = (int32_t) ( BINAURAL_TD_LATENCY_S * 1000000000.f ); - - return IVAS_ERR_OK; + return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); } + /*---------------------------------------------------------------------* - * ObjRenderIVASFrame() + * ivas_td_binaural_renderer_ext() * * Receives the current frames for the object streams, updates metadata * and renders the current frame. *---------------------------------------------------------------------*/ -/*! r: TD Renderer result code. */ -ivas_error ivas_rend_TDObjRenderFrame( +ivas_error ivas_td_binaural_renderer_ext( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { - int16_t subframe_length; - int16_t subframe_idx; + ISM_METADATA_FRAME hIsmMetaDataFrame; ISM_METADATA_HANDLE hIsmMetaData[1]; int16_t lfe_idx; int16_t num_src; - /* TODO tmu : pass down renderer config struct */ - // float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; IVAS_FORMAT ivas_format; IVAS_REND_AudioConfigType inConfigType; + AUDIO_CONFIG transport_config; + ivas_error error; +#ifdef JBM_TSM_ON_TCS + float *p_output[MAX_OUTPUT_CHANNELS]; + int16_t ch; - push_wmops( "ivas_rend_TDObjRenderFrame" ); + for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) + { + p_output[ch] = output[ch]; + } +#endif + + push_wmops( "ivas_td_binaural_renderer_ext" ); inConfigType = getAudioConfigType( inConfig ); lfe_idx = LFE_CHANNEL; + hIsmMetaData[0] = NULL; + if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { ivas_format = MC_FORMAT; + transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { - getAudioConfigNumChannels( inConfig, &num_src ); + if ( ( error = getAudioConfigNumChannels( inConfig, &num_src ) ) != IVAS_ERR_OK ) + { + return error; + } } else { @@ -684,58 +684,53 @@ ivas_error ivas_rend_TDObjRenderFrame( { ivas_format = ISM_FORMAT; num_src = 1; - hIsmMetaData[0] = malloc( sizeof( ISM_METADATA_FRAME ) ); + transport_config = AUDIO_CONFIG_ISM1; + hIsmMetaData[0] = &hIsmMetaDataFrame; hIsmMetaData[0]->azimuth = currentPos->azimuth; hIsmMetaData[0]->elevation = currentPos->elevation; + hIsmMetaData[0]->yaw = currentPos->yaw; + hIsmMetaData[0]->pitch = currentPos->pitch; + hIsmMetaData[0]->radius = currentPos->radius; +#ifdef ISM_NON_DIEGETIC_PAN + hIsmMetaData[0]->non_diegetic_flag = currentPos->non_diegetic_flag; +#endif } - subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; - - /* TODO tmu : pass down renderer config struct and decide what to do about ini_frame ? */ - // if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ - // { - // if ( hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) - // { - // ivas_reverb_open( &pTDRend->hCrend->hReverb, pTDRend->transport_config, NULL, pTDRend->hRenderConfig, pTDRend->hDecoderConfig->output_Fs ); - // } - // } - - /* Update object position(s) */ - TDREND_Update_object_positions( pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, output ); +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, + ( headRotData != NULL ) ? headRotData->headPositions : NULL, + ( headRotData != NULL ) ? headRotData->Pos : NULL, p_output, output_frame ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, + ( headRotData != NULL ) ? headRotData->headPositions : NULL, + ( headRotData != NULL ) ? headRotData->Pos : NULL, output, output_frame ) ) != IVAS_ERR_OK ) - /* TODO tmu : needs a refactor / better approach */ - if ( ivas_format == ISM_FORMAT ) +#endif { - free( hIsmMetaData[0] ); + return error; } - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) - { - /* Update the listener's location/orientation */ - TDREND_Update_listener_orientation( pTDRend->hBinRendererTd, headRotData->headRotEnabled, ( headRotData != NULL ) ? &headRotData->headPositions[subframe_idx] : NULL ); - - /* TODO tmu : pass down renderer config struct */ - // if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) - // { - // ivas_reverb_process( hCrend->hReverb, transport_config, 0, output, reverb_signal, subframe_idx ); - // } + pop_wmops(); - /* Render subframe */ - TDREND_GetMix( pTDRend->hBinRendererTd, output, subframe_length, subframe_idx ); - } + return IVAS_ERR_OK; +} - /* TODO tmu : pass down renderer config struct */ - // if ( pTDRend->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ - // { - // if ( pTDRend->hRenderConfig->roomAcoustics.late_reverb_on ) - // { - // /* add reverb to rendered signals */ - // v_add( reverb_signal[0], output[0], output[0], output_frame ); - // v_add( reverb_signal[1], output[1], output[1], output_frame ); - // } - // } +/*---------------------------------------------------------------------* + * angles_to_vec() + * + * Convert azimuth and elevation angles to position/orientation vector + *---------------------------------------------------------------------*/ - pop_wmops(); +static void angles_to_vec( + const float radius, /* i : radius */ + const float azimuth, /* i : Azimuth angle */ + const float elevation, /* i : Elevation angle */ + float *vec /* o : Pos/Dir vector */ +) +{ + vec[0] = radius * cosf( elevation * PI_OVER_180 ) * cosf( azimuth * PI_OVER_180 ); + vec[1] = radius * cosf( elevation * PI_OVER_180 ) * sinf( azimuth * PI_OVER_180 ); + vec[2] = radius * sinf( elevation * PI_OVER_180 ); - return IVAS_ERR_OK; + return; } diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index 206cd40e1e96b048f4ac55d4dd02b21b973d4b13..97d0b68fb8e83c6fb28f6e35b001800be2f9f5ac 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -35,10 +35,9 @@ #include "options.h" #include "prot.h" #include -#include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "ivas_cnst.h" -#include "ivas_rom_TdBinauralRenderer.h" #include "wmc_auto.h" @@ -60,20 +59,32 @@ static void SkipSmallest_ValueIndex( int16_t *use_inds, const ValueIndex_t *VI, --------------------------------------------------------------------*/ ivas_error TDREND_REND_RenderSourceHRFilt( - TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ - const float *hrf_left_delta, /* i: Left filter interpolation delta */ - const float *hrf_right_delta, /* i: Right filter interpolation delta */ - const int16_t intp_count, /* i: Interpolation count */ - float output_buf[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ - const int16_t subframe_length /* i : Subframe length in use */ + TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ + const float *hrf_left_delta, /* i : Left filter interpolation delta */ + const float *hrf_right_delta, /* i : Right filter interpolation delta */ + const int16_t intp_count, /* i : Interpolation count */ + float output_buf[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ + const int16_t subframe_length /* i : Subframe length in use */ ) { float LeftOutputFrame[L_SPATIAL_SUBFR_48k]; float RightOutputFrame[L_SPATIAL_SUBFR_48k]; +#ifndef FIX_379_GAININTP + float Gain; + + Gain = ( *Src_p->SrcRend_p->DirGain_p ) * ( *Src_p->SrcRend_p->DistGain_p ); +#endif TDREND_Apply_ITD( Src_p->InputFrame_p, LeftOutputFrame, RightOutputFrame, &Src_p->previtd, Src_p->itd, Src_p->mem_itd, subframe_length ); - TDREND_firfilt( LeftOutputFrame, Src_p->hrf_left_prev, hrf_left_delta, intp_count, Src_p->mem_hrf_left, subframe_length, Src_p->filterlength ); - TDREND_firfilt( RightOutputFrame, Src_p->hrf_right_prev, hrf_right_delta, intp_count, Src_p->mem_hrf_right, subframe_length, Src_p->filterlength ); +#ifdef FIX_379_GAININTP + TDREND_firfilt( LeftOutputFrame, Src_p->hrf_left_prev, hrf_left_delta, intp_count, Src_p->mem_hrf_left, subframe_length, Src_p->filterlength, Src_p->Gain, Src_p->prevGain ); + TDREND_firfilt( RightOutputFrame, Src_p->hrf_right_prev, hrf_right_delta, intp_count, Src_p->mem_hrf_right, subframe_length, Src_p->filterlength, Src_p->Gain, Src_p->prevGain ); + Src_p->prevGain = Src_p->Gain; +#else + TDREND_firfilt( LeftOutputFrame, Src_p->hrf_left_prev, hrf_left_delta, intp_count, Src_p->mem_hrf_left, subframe_length, Src_p->filterlength, Gain ); + TDREND_firfilt( RightOutputFrame, Src_p->hrf_right_prev, hrf_right_delta, intp_count, Src_p->mem_hrf_right, subframe_length, Src_p->filterlength, Gain ); +#endif + /* Copy to accumulative output frame */ v_add( LeftOutputFrame, output_buf[0], output_buf[0], subframe_length ); v_add( RightOutputFrame, output_buf[1], output_buf[1], subframe_length ); @@ -495,10 +506,10 @@ void HRTF_model_precalc( maximum_s( model->azimDim3, model->elevDim3, &model->azimDim3Max ); - return; } + /*-------------------------------------------------------------------* * BSplineModelEvalDealloc() * @@ -512,6 +523,7 @@ void BSplineModelEvalDealloc( { /* Allocated in LoadBSplineBinary() */ int16_t i; + if ( model->modelROM ) { free( (void *) model->azimBsShape ); /* void* cast needed to please both gcc and Visual studio compilers. Deallocating const float** should be fine and gcc agrees, but Visual studio complains. */ diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 456bd4cd33370ea1a637420548c2af6a8ee7a8ec..509d22d320f98ef6d1fcc17dc55b3ec8cc5ae14b 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -33,13 +33,30 @@ #include #include "options.h" #include "prot.h" -#include "ivas_prot.h" +#include "ivas_prot_rend.h" +#include "ivas_rom_TdBinauralRenderer.h" +#include "ivas_error.h" #include "wmc_auto.h" #ifdef DEBUGGING #include "debug.h" #endif +/*-------------------------------------------------------------------* + * Local constants + *-------------------------------------------------------------------*/ + +#define RESAMPLE_FACTOR_16_48 ( 16.0f / 48.0f ) +#define RESAMPLE_FACTOR_32_48 ( 32.0f / 48.0f ) + + +/*------------------------------------------------------------------------- + * Local functions + *-------------------------------------------------------------------------*/ + +static ivas_error DefaultBSplineModel( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, const int32_t output_Fs ); + + /*-------------------------------------------------------------------* * TDREND_MIX_LIST_SetPos() * @@ -177,6 +194,7 @@ ivas_error TDREND_MIX_Init( const int32_t output_Fs /* i : Output sampling rate */ ) { + ivas_error error; hBinRendererTd->Gain = 1.0f; @@ -209,7 +227,10 @@ ivas_error TDREND_MIX_Init( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } - DefaultBSplineModel( hBinRendererTd->HrFiltSet_p, output_Fs ); + if ( ( error = DefaultBSplineModel( hBinRendererTd->HrFiltSet_p, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } *hHrtfTD = hBinRendererTd->HrFiltSet_p; } else @@ -316,3 +337,201 @@ ivas_error TDREND_MIX_AddSrc( return error; } + + +/*-------------------------------------------------------------------* + * BSplineModelEvalAlloc() + * + * Allocate the B Spline HR Filter model. + --------------------------------------------------------------------*/ + +static ivas_error BSplineModelEvalAlloc( + ModelParams_t *model, /* i : Model parameters */ + ModelEval_t *modelEval /* i/o: Model evaluation structure */ +) +{ + if ( ( modelEval->hrfModL = (float *) malloc( model->K * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + + if ( ( modelEval->hrfModR = (float *) malloc( model->K * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + + return IVAS_ERR_OK; +} + + +/*-------------------------------------------------------------------* + * DefaultBSplineModel() + * + * Init default HRTF model + --------------------------------------------------------------------*/ + +static ivas_error DefaultBSplineModel( + TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* o : Loaded HR filter set */ + const int32_t output_Fs /* i : Output sampling rate */ +) +{ + ModelParams_t *model; + ModelParamsITD_t *modelITD; + int16_t i, j; + ivas_error error; + + HrFiltSet_p->FilterMethod = TDREND_HRFILT_Method_BSplineModel; + model = &( HrFiltSet_p->ModelParams ); + modelITD = &( HrFiltSet_p->ModelParamsITD ); + + /* Set ROM flag for correct deallocation */ + model->modelROM = TRUE; + + /* int16_t parameters */ + model->UseItdModel = 1; + model->SplineDegree = 4; + model->elevDim2 = 20; + model->elevDim3 = 18; + model->AlphaN = 578; + model->num_unique_azim_splines = 1; + model->elevSegSamples = 3; + model->elevBsLen[0] = 4; + model->elevBsLen[1] = 7; + model->elevBsLen[2] = 10; + model->elevBsLen[3] = 7; + model->elevBsStart[0] = 0; + model->elevBsStart[1] = 4; + model->elevBsStart[2] = 11; + model->elevBsStart[3] = 21; + + model->azimDim2 = orange53_rom_azimDim2; + model->azimDim3 = orange53_rom_azimDim3; + model->azim_start_idx = orange53_rom_azim_start_idx; + model->azimSegSamples = orange53_rom_azimSegSamples; + model->azimShapeIdx = orange53_rom_azimShapeIdx; + model->azimShapeSampFactor = orange53_rom_azimShapeSampFactor; + + /* float parameters */ + model->elevKSeq = (const float *) orange53_rom_elevKSeq; + model->elevBsShape = (const float *) orange53_rom_elevBsShape; + + if ( ( model->azimBsShape = (const float **) malloc( model->num_unique_azim_splines * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + + model->azimBsShape[0] = (const float *) orange53_rom_azimBsShape; + if ( ( model->azimKSeq = (float **) malloc( 18 * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + if ( ( model->azimKSeq[0] = (float *) malloc( 2 * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + if ( ( model->azimKSeq[17] = (float *) malloc( 2 * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + model->azimKSeq[0][0] = 0.0f; + model->azimKSeq[17][0] = 0.0f; + model->azimKSeq[0][1] = 360.0f; + model->azimKSeq[17][1] = 360.0f; + + for ( i = 1; i < 17; i++ ) + { + if ( ( model->azimKSeq[i] = (float *) malloc( model->azimDim2[i] * sizeof( float * ) ) ) == NULL ) /* azimDim2[i] = 91, i=2..15 */ + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); + } + for ( j = 0; j < model->azimDim2[i]; j++ ) + { + model->azimKSeq[i][j] = (float) orange53_rom_azimSegSamples[0] * j; + } + } + + switch ( output_Fs ) + { + case 48000: + model->AlphaL = (const float *) orange53_rom_AlphaL48; + model->AlphaR = (const float *) orange53_rom_AlphaR48; + model->EL = (const float *) orange53_rom_EL48; + model->ER = (const float *) orange53_rom_ER48; + model->K = 128; + if ( HrFiltSet_p->ModelParams.UseItdModel ) + { + modelITD->resamp_factor = 1.0f; + } + break; + case 32000: + model->AlphaL = (const float *) orange53_rom_AlphaL32; + model->AlphaR = (const float *) orange53_rom_AlphaR32; + model->EL = (const float *) orange53_rom_EL32; + model->ER = (const float *) orange53_rom_ER32; + model->K = 86; + if ( HrFiltSet_p->ModelParams.UseItdModel ) + { + modelITD->resamp_factor = RESAMPLE_FACTOR_32_48; + } + break; + case 16000: + model->AlphaL = (const float *) orange53_rom_AlphaL16; + model->AlphaR = (const float *) orange53_rom_AlphaR16; + model->EL = (const float *) orange53_rom_EL16; + model->ER = (const float *) orange53_rom_ER16; + model->K = 43; + if ( HrFiltSet_p->ModelParams.UseItdModel ) + { + modelITD->resamp_factor = RESAMPLE_FACTOR_16_48; + } + break; + default: + break; + } + + modelITD->N = 4; + modelITD->elevDim2 = 20; + modelITD->elevDim3 = 18; + modelITD->azimDim2 = 41; + modelITD->azimDim3 = 41; + modelITD->elevSegSamples = 3; + modelITD->elevBsLen[0] = 4; + modelITD->elevBsLen[1] = 7; + modelITD->elevBsLen[2] = 10; + modelITD->elevBsLen[3] = 7; + modelITD->elevBsStart[0] = 0; + modelITD->elevBsStart[1] = 4; + modelITD->elevBsStart[2] = 11; + modelITD->elevBsStart[3] = 21; + + modelITD->elevKSeq = model->elevKSeq; + + modelITD->azimBsLen[0] = 11; + modelITD->azimBsLen[1] = 21; + modelITD->azimBsLen[2] = 31; + modelITD->azimBsLen[3] = 21; + modelITD->azimBsStart[0] = 0; + modelITD->azimBsStart[1] = 11; + modelITD->azimBsStart[2] = 32; + modelITD->azimBsStart[3] = 63; + + modelITD->azimSegSamples = 10; + + modelITD->azimKSeq = orange53_rom_ITD_azimKSeq; + modelITD->W = (const float *) orange53_rom_ITD_W; + modelITD->azimBsShape = (const float *) orange53_rom_ITD_azimBsShape; + modelITD->elevBsShape = (const float *) orange53_rom_ITD_elevBsShape; + + HRTF_model_precalc( model ); + + HrFiltSet_p->latency_s = orange53_rom_latency_s; + HrFiltSet_p->SampleRate = output_Fs; + HrFiltSet_p->FiltLength = HrFiltSet_p->ModelParams.K; + + if ( ( error = BSplineModelEvalAlloc( &HrFiltSet_p->ModelParams, &HrFiltSet_p->ModelEval ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; +} diff --git a/lib_rend/ivas_objectRenderer_sfx.c b/lib_rend/ivas_objectRenderer_sfx.c index 7a9ddd6b85bb7a101b1917b179085159190901c7..af3231df613a8717b5e8ada8603bc5fa92f94848 100644 --- a/lib_rend/ivas_objectRenderer_sfx.c +++ b/lib_rend/ivas_objectRenderer_sfx.c @@ -33,7 +33,7 @@ #include #include "options.h" #include -#include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "prot.h" #include "wmc_auto.h" @@ -47,6 +47,7 @@ /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ + static void sincResample( const float *input, float *output, const int16_t length_in, const int16_t length_out ); @@ -181,6 +182,7 @@ static void sincResample( const float *p_sinc_forward; const float *p_sinc_backward; + /* Compute fractional time step */ t_step = (float) ( length_in ) / (float) ( length_out ); t_frac = 0; @@ -233,7 +235,13 @@ void TDREND_firfilt( const int16_t intp_count, /* i : interpolation count */ float *mem, /* i/o: filter memory */ const int16_t subframe_length, /* i : Length of signal */ - const int16_t filterlength /* i : Filter length */ + const int16_t filterlength, /* i : Filter length */ +#ifdef FIX_379_GAININTP + const float Gain, /* i : Gain */ + const float prevGain /* i : Previous gain */ +#else + const float Gain /* i : Gain */ +#endif ) { float buffer[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1 + L_SUBFRAME5MS_48k]; @@ -242,6 +250,13 @@ void TDREND_firfilt( float *p_filter; float tmp; int16_t i, j; +#ifdef FIX_379_GAININTP + float step, gain_tmp, gain_delta; + + gain_delta = ( Gain - prevGain ); + step = gain_delta / ( subframe_length ); + gain_tmp = prevGain; +#endif /* Handle memory */ p_signal = buffer + filterlength - 1; @@ -259,7 +274,13 @@ void TDREND_firfilt( { tmp += ( *p_filter++ ) * ( *p_tmp-- ); } - signal[i] = tmp; +#ifdef FIX_379_GAININTP + /* Apply linear gain interpolation in case of abrupt gain changes */ + gain_tmp = gain_tmp + step; + signal[i] = tmp * gain_tmp; +#else + signal[i] = tmp * Gain; +#endif if ( i < intp_count ) { diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index e56516d45473a6a46fa2b1c409eef7783009a0c8..91253748b2eb4ee2554f80c6d8f2782b72c31fe8 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -33,25 +33,33 @@ #include #include "options.h" #include -#include "ivas_prot.h" #include "prot.h" +#include "ivas_prot_rend.h" #include "wmc_auto.h" #ifdef DEBUGGING #include "debug.h" #endif + /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ static void TDREND_SRC_SPATIAL_Dealloc( TDREND_SRC_SPATIAL_t *SrcSpatial_p ); + static void TDREND_SRC_SPATIAL_Init( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_PosType_t PosType ); + static void TDREND_SRC_SPATIAL_SetDirAtten( TDREND_SRC_SPATIAL_t *SrcSpatial_p, const TDREND_DirAtten_t *DirAtten_p ); + static float TDREND_SRC_SPATIAL_GetDirGain( const TDREND_DirAtten_t *DirAtten_p, const float *Front_p, const float *RelPos_p ); + static float TDREND_SRC_SPATIAL_GetDistGain( const TDREND_DistAtten_t *DistAtten_p, const float Dist ); + static ivas_error TDREND_SRC_REND_Alloc( TDREND_SRC_REND_t **SrcRend_pp ); + static void TDREND_SRC_REND_Init( TDREND_SRC_REND_t *SrcRend_p ); + /*-------------------------------------------------------------------* * TDREND_MIX_SRC_SetPos() * @@ -88,7 +96,7 @@ ivas_error TDREND_MIX_SRC_SetPos( /*-------------------------------------------------------------------* * TDREND_MIX_SRC_SetDir() * - * Set source direciton + * Set source direction --------------------------------------------------------------------*/ ivas_error TDREND_MIX_SRC_SetDir( @@ -185,11 +193,11 @@ static ivas_error TDREND_SRC_REND_Alloc( *SrcRend_pp = NULL; /* Allocate the TDREND_SRC_REND_t variable */ - SrcRend_p = (TDREND_SRC_REND_t *) malloc( sizeof( TDREND_SRC_REND_t ) ); - if ( SrcRend_p == NULL ) + if ( ( SrcRend_p = (TDREND_SRC_REND_t *) malloc( sizeof( TDREND_SRC_REND_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "SrcRend_p allocation error\n" ) ); } + *SrcRend_pp = SrcRend_p; return IVAS_ERR_OK; @@ -258,6 +266,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( TDREND_MIX_Listener_t *Listener_p; TDREND_HRFILT_FiltSet_t *HrFiltSet_p; float ListRelPos[3], ListRelDist; + float ListRelPosAbs[3]; /* Relative position, ignoring orientation of listener */ float Azim, Elev; float hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; float hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; @@ -279,14 +288,14 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( break; case TDREND_POSTYPE_ABSOLUTE: /* Absolute position */ - TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos ); + TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); break; default: /* Illegal position type */ #ifdef DEBUGGING printf( "Warning! TDREND_SRC_REND_UpdateFiltersFromSpatialParams: Invalid position type. Assuming absolute position!\n" ); #endif /* Assume absolute position */ - TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos ); + TDREND_SPATIAL_VecMapToNewCoordSystem( SrcSpatial_p->Pos_p, Listener_p->Pos, Listener_p->Front, Listener_p->Up, Listener_p->Right, ListRelPos, ListRelPosAbs ); break; } @@ -312,7 +321,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( *SrcRend_p->DirGain_p = 1.0f; if ( SrcSpatial_p->DirAttenEnabled ) { - *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPos ); + *SrcRend_p->DirGain_p = TDREND_SRC_SPATIAL_GetDirGain( &SrcSpatial_p->DirAtten, SrcSpatial_p->Front_p, ListRelPosAbs ); } /* Distance gain */ @@ -381,8 +390,7 @@ static ivas_error TDREND_SRC_SPATIAL_Alloc( *SrcSpatial_pp = NULL; /* Allocate the TDREND_SRC_t variable */ - SrcSpatial_p = (TDREND_SRC_SPATIAL_t *) malloc( sizeof( TDREND_SRC_SPATIAL_t ) ); - if ( SrcSpatial_p == NULL ) + if ( ( SrcSpatial_p = (TDREND_SRC_SPATIAL_t *) malloc( sizeof( TDREND_SRC_SPATIAL_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "TDREND_SRC_SPATIAL_t allocation error\n" ) ); } @@ -452,7 +460,7 @@ static void TDREND_SRC_SPATIAL_Init( SrcSpatial_p->DistAttenEnabled = FALSE; SrcSpatial_p->DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; SrcSpatial_p->DistAtten.RefDist = 1.0f; - SrcSpatial_p->DistAtten.MaxDist = 10.0f; + SrcSpatial_p->DistAtten.MaxDist = 15.75f; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ SrcSpatial_p->DistAtten.RollOffFactor = 1.0f; return; @@ -593,8 +601,7 @@ ivas_error TDREND_SRC_Alloc( *Src_pp = NULL; /* Allocate the TDREND_SRC_t variable */ - Src_p = (TDREND_SRC_t *) malloc( sizeof( TDREND_SRC_t ) ); - if ( Src_p == NULL ) + if ( ( Src_p = (TDREND_SRC_t *) malloc( sizeof( TDREND_SRC_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, " TDREND_SRC_Alloc: Allocation error\n" ) ); } @@ -680,7 +687,9 @@ void TDREND_SRC_Init( Src_p->hrf_right_prev[0] = 1; Src_p->azim_prev = 0.0f; Src_p->elev_prev = 0.0f; - +#ifdef FIX_379_GAININTP + Src_p->prevGain = 1.0f; +#endif return; } diff --git a/lib_rend/ivas_objectRenderer_vec.c b/lib_rend/ivas_objectRenderer_vec.c index 68d50bc55931785f66cc963b14114571ccee01bf..061b790e1b46e9010d14a0b0162b528bbd3768fb 100644 --- a/lib_rend/ivas_objectRenderer_vec.c +++ b/lib_rend/ivas_objectRenderer_vec.c @@ -33,13 +33,14 @@ #include #include "options.h" #include -#include "ivas_prot.h" #include "prot.h" +#include "ivas_prot_rend.h" #include "wmc_auto.h" #ifdef DEBUGGING #include "debug.h" #endif + /*-------------------------------------------------------------------* * TDREND_SPATIAL_VecInit() * @@ -110,20 +111,16 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem( const float *DirVec_p, /* i : Direction vector */ const float *UpVec_p, /* i : Up vector */ const float *RightVec_p, /* i : Right vector */ - float *MappedVec_p /* o : Transformed vector */ + float *MappedVec_p, /* o : Transformed vector */ + float *LisRelPosAbs /* o : Transformed vector ignoring orientation */ ) { - float RelVec[3]; - - /* Evaluate Vec relative to the new origin given by TranslVec */ - v_sub( Vec_p, TranslVec_p, RelVec, 3 ); - + v_sub( Vec_p, TranslVec_p, LisRelPosAbs, 3 ); /* Evalute the relative Vec in the coordinates of the Orientation vectors, */ /* which form an orthonormal basis */ - MappedVec_p[0] = dotp( RelVec, DirVec_p, 3 ); - MappedVec_p[1] = dotp( RelVec, RightVec_p, 3 ); - MappedVec_p[2] = dotp( RelVec, UpVec_p, 3 ); - + MappedVec_p[0] = dotp( LisRelPosAbs, DirVec_p, 3 ); + MappedVec_p[1] = dotp( LisRelPosAbs, RightVec_p, 3 ); + MappedVec_p[2] = dotp( LisRelPosAbs, UpVec_p, 3 ); return; } diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index df7d80bf60cfbff9109ddcc5be16b1b6cd107903..63d863c4b635dcdfc832f9c0027d165a7c902238 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -30,10 +30,11 @@ *******************************************************************************************************/ +#include "common_api_types.h" #include #include "options.h" -#include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_cnst.h" #ifdef DEBUGGING #include "debug.h" @@ -49,52 +50,328 @@ #define MAX_TRACKED_ANGLE_AVG_ORIENT PI_OVER_2 #define MAX_TRACKED_ANGLE_REF_ORIENT EVS_PI - -/* TODO relate to frame rate - assumed here 50Hz, i.e. 20ms frame length */ -#define OTR_UPDATE_RATE ( 50.0f ) /* rate of the Process() calls [Hz]; 1x per IVAS frame */ +#define OTR_UPDATE_RATE (float) FRAMES_PER_SEC /* rate of the Process() calls [Hz]; 1x per IVAS frame */ /*------------------------------------------------------------------------------------------* * Local functions *------------------------------------------------------------------------------------------*/ -static float ClipAngle( - const float angle, - const float min_angle, - const float max_angle ) +/*------------------------------------------------------------------------------------------* + * IdentityQuaternion() + * + * + *------------------------------------------------------------------------------------------*/ + +static IVAS_QUATERNION IdentityQuaternion( + void ) { - float result = angle; + IVAS_QUATERNION q; - /* wrap angle modulo 2*pi into range of [-pi, pi> radians */ - /* 'while' assumed to use comparison to 0 */ - while ( result > EVS_PI ) - { - result -= PI2; - } - /* 'while' assumed to use comparison to 0 */ - while ( result <= -EVS_PI ) + q.w = 1.0f; + q.x = q.y = q.z = 0.0f; + + return q; +} + + +/*------------------------------------------------------------------------------------------* + * QuaternionProduct() + * + * Quaternion product + *------------------------------------------------------------------------------------------*/ + +static void QuaternionProduct( + const IVAS_QUATERNION q1, + const IVAS_QUATERNION q2, + IVAS_QUATERNION *const r ) +{ + IVAS_QUATERNION tmp; + tmp.w = q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z; + tmp.x = q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y; + tmp.y = q1.w * q2.y - q1.x * q2.z + q1.y * q2.w + q1.z * q2.x; + tmp.z = q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w; + + *r = tmp; + + return; +} + +/*------------------------------------------------------------------------------------------* + * QuaternionDotProduct() + * + * Quaternion dot product + *------------------------------------------------------------------------------------------*/ + +static float QuaternionDotProduct( + const IVAS_QUATERNION q1, + const IVAS_QUATERNION q2 ) +{ + return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; +} + + +/*------------------------------------------------------------------------------------------* + * QuaternionDivision() + * + * Divides a quaternion by a scalar + *------------------------------------------------------------------------------------------*/ + +static void QuaternionDivision( + const IVAS_QUATERNION q, + const float d, + IVAS_QUATERNION *const r ) +{ + r->w = q.w / d; + r->x = q.x / d; + r->y = q.y / d; + r->z = q.z / d; + + return; +} + + +/*------------------------------------------------------------------------------------------* + * QuaternionNormalize() + * + * Normalizes a quaternion + *------------------------------------------------------------------------------------------*/ + +static void QuaternionNormalize( + const IVAS_QUATERNION q, + IVAS_QUATERNION *const r ) +{ + QuaternionDivision( q, sqrtf( QuaternionDotProduct( q, q ) ), r ); + + return; +} + + +/*------------------------------------------------------------------------------------------* + * QuaternionSlerp() + * + * Computes a spherical linear interpolation between two quaternions + *------------------------------------------------------------------------------------------*/ + +static void QuaternionSlerp( + const IVAS_QUATERNION q1, + const IVAS_QUATERNION q2, + const float t, + IVAS_QUATERNION *const r ) +{ + float angle, denom, s, s2; + + s = QuaternionDotProduct( q1, q2 ); + + if ( fabsf( s ) >= 1.0f ) { - result += PI2; + *r = q2; + return; } - /* Next, clip angle into range */ - /* 'if' assumed to use comparison to 0 */ - if ( result < min_angle ) + angle = acosf( s ); + denom = sinf( angle ); + + s = sinf( ( 1 - t ) * angle ); + s2 = sinf( t * angle ); + r->x = ( q1.x * s + q2.x * s2 ) / denom; + r->y = ( q1.y * s + q2.y * s2 ) / denom; + r->z = ( q1.z * s + q2.z * s2 ) / denom; + r->w = ( q1.w * s + q2.w * s2 ) / denom; + + QuaternionNormalize( *r, r ); + + return; +} + + +/*------------------------------------------------------------------------------------------* + * QuaternionConjugate() + * + * Computes a quaternion conjugate + *------------------------------------------------------------------------------------------*/ + +static void QuaternionConjugate( + const IVAS_QUATERNION q, + IVAS_QUATERNION *const r ) +{ + r->w = q.w; + r->x = -q.x; + r->y = -q.y; + r->z = -q.z; + + return; +} + + +/*------------------------------------------------------------------------------------------* + * QuaternionAngle() + * + * Computes an angle between two quaternions + *------------------------------------------------------------------------------------------*/ + +static float QuaternionAngle( + const IVAS_QUATERNION q1, + const IVAS_QUATERNION q2 ) +{ + IVAS_QUATERNION q12; + float angle; + + QuaternionConjugate( q1, &q12 ); + QuaternionProduct( q12, q2, &q12 ); + angle = 2.0f * atan2f( sqrtf( q12.x * q12.x + q12.y * q12.y + q12.z * q12.z ), q12.w ); + + return angle; +} + + +/*------------------------------------------------------------------------------------------* + * QuaternionInverse() + * + * Computes an inverse quaternion + *------------------------------------------------------------------------------------------*/ + +static void QuaternionInverse( + const IVAS_QUATERNION q, + IVAS_QUATERNION *const r ) +{ + float dot_product; + + dot_product = QuaternionDotProduct( q, q ); + QuaternionConjugate( q, r ); + QuaternionDivision( *r, dot_product, r ); + + return; +} + + +/*------------------------------------------------------------------------------------------* + * VectorSubtract() + * + * Computes the difference of two vectors + *------------------------------------------------------------------------------------------*/ + +static IVAS_VECTOR3 VectorSubtract( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2 ) +{ + IVAS_VECTOR3 result; + + result.x = p1.x - p2.x; + result.y = p1.y - p2.y; + result.z = p1.z - p2.z; + + return result; +} + + +/*------------------------------------------------------------------------------------------* + * VectorCrossProduct() + * + * Computes the cross product of two vectors + *------------------------------------------------------------------------------------------*/ + +static IVAS_VECTOR3 VectorCrossProduct( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2 ) +{ + IVAS_VECTOR3 result; + result.x = p1.y * p2.z - p1.z * p2.y; + result.y = p1.z * p2.x - p1.x * p2.z; + result.z = p1.x * p2.y - p1.y * p2.x; + + return result; +} + + +/*------------------------------------------------------------------------------------------* + * VectorDotProduct( + * + * Computes the dot product of two vectors + *------------------------------------------------------------------------------------------*/ + +static float VectorDotProduct( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2 ) +{ + return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z; +} + + +/*------------------------------------------------------------------------------------------* + * VectorLength() + * + * Computes the length of a vector + *------------------------------------------------------------------------------------------*/ + +static float VectorLength( + const IVAS_VECTOR3 p ) +{ + return sqrtf( p.x * p.x + p.y * p.y + p.z * p.z ); +} + + +/*------------------------------------------------------------------------------------------* + * VectorNormalize() + * + * Normalizes a vector + *------------------------------------------------------------------------------------------*/ + +static IVAS_VECTOR3 VectorNormalize( + const IVAS_VECTOR3 p ) +{ + IVAS_VECTOR3 result; + + const float length = VectorLength( p ); + + result.x = p.x / length; + result.y = p.y / length; + result.z = p.z / length; + + return result; +} + + +/*------------------------------------------------------------------------------------------* + * VectorRotationToQuaternion() + * + * Computes a quaternion representing the rotation from vector p1 to vector p2 + *------------------------------------------------------------------------------------------*/ + +static void VectorRotationToQuaternion( + const IVAS_VECTOR3 p1, + const IVAS_VECTOR3 p2, + IVAS_QUATERNION *const r ) +{ + float dot_product; + IVAS_VECTOR3 cross_product, p1_normalized, p2_normalized; + + p1_normalized = VectorNormalize( p1 ); + p2_normalized = VectorNormalize( p2 ); + cross_product = VectorCrossProduct( p1_normalized, p2_normalized ); + dot_product = VectorDotProduct( p1_normalized, p2_normalized ); + + if ( dot_product < -0.999999 ) { - result = min_angle; + /* happens when the p1 vector is parallel to p2, but direction is flipped */ + r->w = 0.0f; + r->x = 0.0f; + r->y = 0.0f; + r->z = 1.0f; } else { - /* 'if' assumed to use comparison to 0 */ - if ( result > max_angle ) - { - result = max_angle; - } + /* all regular cases */ + r->x = cross_product.x; + r->y = cross_product.y; + r->z = cross_product.z; + r->w = 1.0f + dot_product; } - return result; -} + QuaternionNormalize( *r, r ); + return; +} /*-------------------------------------------------------------------* * ivas_orient_trk_Init() @@ -102,11 +379,18 @@ static float ClipAngle( * *-------------------------------------------------------------------*/ -void ivas_orient_trk_Init( - ivas_orient_trk_state_t *pOTR ) +ivas_error ivas_orient_trk_Init( + ivas_orient_trk_state_t *pOTR ) /* i/o : orientation tracker handle */ { - /* Track relative to a reference orientation */ - pOTR->trackingType = OTR_TRACKING_REF_ORIENT; + IVAS_QUATERNION identity; + + if ( pOTR == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + identity.w = 1.0f; + identity.x = identity.y = identity.z = 0.0f; /* configuration parameters */ pOTR->centerAdaptationRate = 1.0f / 30.0f; @@ -116,23 +400,15 @@ void ivas_orient_trk_Init( /* initial adaptivity filter coefficient, will be auto-adapted */ pOTR->alpha = sinf( PI2 * pOTR->offCenterAdaptationRate / OTR_UPDATE_RATE ); /* start adaptation at off-center rate = fastest rate */ - pOTR->absYaw = 0.0f; - pOTR->absPitch = 0.0f; - pOTR->absRoll = 0.0f; - - pOTR->absAvgYaw = 0.0f; - pOTR->absAvgPitch = 0.0f; - pOTR->absAvgRoll = 0.0f; + pOTR->trkRot = identity; + pOTR->absAvgRot = identity; + /* Use frontal and horiontal orientation as reference orientation, unless/until overridden */ + pOTR->refRot = identity; - /* Use frontal and horiontal orientation as reference orientation, - unless/until overridden by ivas_orient_trk_SetAbsoluteOrientation() */ - pOTR->refYaw = 0.0f; - pOTR->refPitch = 0.0f; - pOTR->refRoll = 0.0f; + /* set safe default tracking mode */ + pOTR->trackingType = OTR_TRACKING_NONE; - pOTR->trkYaw = 0.0f; - pOTR->trkPitch = 0.0f; - pOTR->trkRoll = 0.0f; + return IVAS_ERR_OK; } @@ -143,171 +419,256 @@ void ivas_orient_trk_Init( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, - OTR_TRACKING_T trackingType ) + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const OTR_TRACKING_T trackingType /* i/o: orientation tracking type */ +) { + if ( pOTR == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } pOTR->trackingType = trackingType; + return IVAS_ERR_OK; } - /*-------------------------------------------------------------------* - * ivas_orient_trk_SetAbsoluteOrientation() + * ivas_orient_trk_SetReferenceRotation() * * *-------------------------------------------------------------------*/ -ivas_error ivas_orient_trk_SetAbsoluteOrientation( - ivas_orient_trk_state_t *pOTR, - float yaw, - float pitch, - float roll ) +ivas_error ivas_orient_trk_SetReferenceRotation( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const IVAS_QUATERNION refRot /* i : reference rotation */ +) { - /* TODO implement condition checks */ - pOTR->absYaw = yaw; - pOTR->absPitch = pitch; - pOTR->absRoll = roll; + if ( pOTR == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + /* check for Euler angle signaling */ + if ( refRot.w == -3.0f ) + { + Euler2Quat( deg2rad( refRot.x ), deg2rad( refRot.y ), deg2rad( refRot.z ), &pOTR->refRot ); + } + else + { + pOTR->refRot = refRot; + } return IVAS_ERR_OK; } /*-------------------------------------------------------------------* - * ivas_orient_trk_Process() + * ivas_orient_trk_GetMainOrientation() * * *-------------------------------------------------------------------*/ -ivas_error ivas_orient_trk_Process( - ivas_orient_trk_state_t *pOTR ) +ivas_error ivas_orient_trk_GetMainOrientation( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION *pOrientation /* i/o: average/reference orientation */ +) { - float yaw; - float pitch; - float roll; - - if ( pOTR->trackingType == OTR_TRACKING_AVG_ORIENT ) + if ( pOTR == NULL || pOrientation == NULL ) { - float normalizedOrientation; - float relativeOrientationRate; - float rateRange; - float cutoffFrequency; - float alpha = pOTR->alpha; - - /* Copy absolute orientation as input to compute further on */ - yaw = pOTR->absYaw; - pitch = pOTR->absPitch; - roll = pOTR->absRoll; - - /* Compute average (low-pass filtered) absolute orientation */ - pOTR->absAvgYaw = ( 1.0f - alpha ) * pOTR->absAvgYaw + alpha * yaw; - pOTR->absAvgPitch = ( 1.0f - alpha ) * pOTR->absAvgPitch + alpha * pitch; - pOTR->absAvgRoll = ( 1.0f - alpha ) * pOTR->absAvgRoll + alpha * roll; - - /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ - yaw -= pOTR->absAvgYaw; - pitch -= pOTR->absAvgPitch; - roll -= pOTR->absAvgRoll; - - /* Clip tracked relative orientation to avoid wrap around */ - yaw = ClipAngle( yaw, -MAX_TRACKED_ANGLE_AVG_ORIENT, MAX_TRACKED_ANGLE_AVG_ORIENT ); - pitch = ClipAngle( pitch, -MAX_TRACKED_ANGLE_AVG_ORIENT, MAX_TRACKED_ANGLE_AVG_ORIENT ); - roll = ClipAngle( roll, -MAX_TRACKED_ANGLE_AVG_ORIENT, MAX_TRACKED_ANGLE_AVG_ORIENT ); - - /* Store relative orientation result as output */ - pOTR->trkYaw = yaw; - pOTR->trkPitch = pitch; - pOTR->trkRoll = roll; - - /* Reconstruct the mean absolute orientation, compensating for non-linear computation of relative orientation: - take absolute orientation and subtract the *clipped* mean relative orientation */ - pOTR->absAvgYaw = pOTR->absYaw - yaw; - pOTR->absAvgPitch = pOTR->absPitch - pitch; - pOTR->absAvgRoll = pOTR->absRoll - roll; - - /* Adapt LPF constant based on orientation excursion relative to current mean: - - low cutoff (slow adaptation) for small excursions (around center) - - high cutoff (fast adaptation) for large excursions (off-center) - */ - - normalizedOrientation = yaw * yaw; - normalizedOrientation += pitch * pitch; - normalizedOrientation += roll * roll; - - relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; - /* 'if' assumed to perform comparison to 0 */ - if ( relativeOrientationRate > 1.0f ) - { - relativeOrientationRate = 1.0f; - } - - /* Compute range of the adaptation rate between center = lower rate and off-center = higher rate */ - rateRange = pOTR->offCenterAdaptationRate - pOTR->centerAdaptationRate; - /* 'if' assumed to perform comparison to 0 */ - if ( rateRange < 0.0f ) - { - rateRange = 0.0f; - } - - /* Compute adaptivity cutoff frequency: interpolate between minimum (center) and maximum (off-center) values */ - cutoffFrequency = pOTR->centerAdaptationRate + ( relativeOrientationRate * rateRange ); - - /* Compute filter coefficient corresponding to desired cutoff frequency */ - pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / OTR_UPDATE_RATE ); + return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - else + switch ( pOTR->trackingType ) { - /* 'if' assumed to perform comparison to 0 */ - if ( pOTR->trackingType == OTR_TRACKING_REF_ORIENT ) - { - /* Reset average orientation */ - pOTR->absAvgYaw = pOTR->absYaw; - pOTR->absAvgPitch = pOTR->absPitch; - pOTR->absAvgRoll = pOTR->absRoll; + case OTR_TRACKING_NONE: + *pOrientation = IdentityQuaternion(); + break; + case OTR_TRACKING_REF_VEC: + case OTR_TRACKING_REF_VEC_LEV: + case OTR_TRACKING_REF_ORIENT: + *pOrientation = pOTR->refRot; + break; + case OTR_TRACKING_AVG_ORIENT: + *pOrientation = pOTR->absAvgRot; + break; + } - /* Reset adaptation filter - start adaptation at center rate */ - pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / OTR_UPDATE_RATE ); + return IVAS_ERR_OK; +} - /* Copy absolute orientation as input to compute further on */ - yaw = pOTR->absYaw; - pitch = pOTR->absPitch; - roll = pOTR->absRoll; - /* Compute relative orientation = (absolute orientation) - (reference orientation) */ - yaw -= pOTR->refYaw; - pitch -= pOTR->refPitch; - roll -= pOTR->refRoll; - - /* Clip computed relative orientation to avoid wrap around and store as output */ - pOTR->trkYaw = ClipAngle( yaw, -MAX_TRACKED_ANGLE_REF_ORIENT, MAX_TRACKED_ANGLE_REF_ORIENT ); - pOTR->trkPitch = ClipAngle( pitch, -MAX_TRACKED_ANGLE_REF_ORIENT, MAX_TRACKED_ANGLE_REF_ORIENT ); - pOTR->trkRoll = ClipAngle( roll, -MAX_TRACKED_ANGLE_REF_ORIENT, MAX_TRACKED_ANGLE_REF_ORIENT ); - } - - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); - } +/*-------------------------------------------------------------------* + * ivas_orient_trk_GetTrackedRotation() + * + * + *-------------------------------------------------------------------*/ + +ivas_error ivas_orient_trk_GetTrackedRotation( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION *pRotation /* i/o: processed rotation */ +) +{ + if ( pOTR == NULL || pRotation == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + *pRotation = pOTR->trkRot; + return IVAS_ERR_OK; } /*-------------------------------------------------------------------* - * ivas_orient_trk_GetTrackedOrientation() + * ivas_orient_trk_SetReferenceVector() * * *-------------------------------------------------------------------*/ -ivas_error ivas_orient_trk_GetTrackedOrientation( - ivas_orient_trk_state_t *pOTR, - float *yaw, - float *pitch, - float *roll ) +ivas_error ivas_orient_trk_SetReferenceVector( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +) { - *yaw = pOTR->trkYaw; - *pitch = pOTR->trkPitch; - *roll = pOTR->trkRoll; + IVAS_VECTOR3 acousticFrontVector, ivasForwardVector; + IVAS_VECTOR3 listenerPosLevel, refPosLevel; + float acousticFrontVectorLength; + + if ( pOTR == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + switch ( pOTR->trackingType ) + { + case OTR_TRACKING_NONE: + case OTR_TRACKING_REF_ORIENT: + case OTR_TRACKING_AVG_ORIENT: + case OTR_TRACKING_REF_VEC: + acousticFrontVector = VectorSubtract( listenerPos, refPos ); + break; + case OTR_TRACKING_REF_VEC_LEV: + /* ignore the height difference between listener position and reference position */ + listenerPosLevel.z = refPosLevel.z = listenerPos.z; + listenerPosLevel.x = listenerPos.x; + listenerPosLevel.y = listenerPos.y; + refPosLevel.x = refPos.x; + refPosLevel.y = refPos.y; + acousticFrontVector = VectorSubtract( listenerPosLevel, refPosLevel ); + break; + default: + return IVAS_ERR_WRONG_PARAMS; + } + + acousticFrontVectorLength = VectorLength( acousticFrontVector ); + + /* if the length is zero, the user has entered insensible listener and reference positions */ + if ( acousticFrontVectorLength < 0.0001f ) + { + return IVAS_ERR_WRONG_PARAMS; + } + + ivasForwardVector.x = -1.0f; + ivasForwardVector.y = 0.0f; + ivasForwardVector.z = 0.0f; + VectorRotationToQuaternion( ivasForwardVector, acousticFrontVector, &pOTR->refRot ); return IVAS_ERR_OK; } + + +/*-------------------------------------------------------------------* + * ivas_orient_trk_Process() + * + * + *-------------------------------------------------------------------*/ + +ivas_error ivas_orient_trk_Process( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION absRot, /* i : absolute head rotation */ + float updateRate, /* i : rotation update rate [Hz] */ + IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ +) +{ + float normalizedOrientation; + float relativeOrientationRate; + float rateRange; + float cutoffFrequency; + float alpha = pOTR->alpha; + float ang; + ivas_error result; + + if ( pOTR == NULL || pTrkRot == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + result = IVAS_ERR_OK; + + switch ( pOTR->trackingType ) + { + case OTR_TRACKING_NONE: + pOTR->trkRot = absRot; + break; + case OTR_TRACKING_REF_VEC: + case OTR_TRACKING_REF_VEC_LEV: + case OTR_TRACKING_REF_ORIENT: + /* Reset average orientation */ + pOTR->absAvgRot = absRot; + + /* Reset adaptation filter - start adaptation at center rate */ + pOTR->alpha = sinf( 2.0f * EVS_PI * pOTR->centerAdaptationRate / updateRate ); + + /* Compute relative orientation = (absolute orientation) - (reference orientation) */ + QuaternionInverse( pOTR->refRot, &pOTR->trkRot ); + QuaternionProduct( pOTR->trkRot, absRot, &pOTR->trkRot ); + break; + + case OTR_TRACKING_AVG_ORIENT: + /* Compute average (low-pass filtered) absolute orientation */ + QuaternionSlerp( pOTR->absAvgRot, absRot, alpha, &pOTR->absAvgRot ); + + /* Compute relative orientation = (absolute orientation) - (average absolute orientation) */ + QuaternionInverse( pOTR->absAvgRot, &pOTR->trkRot ); + QuaternionProduct( pOTR->trkRot, absRot, &pOTR->trkRot ); + + /* Adapt LPF constant based on orientation excursion relative to current mean: + - low cutoff (slow adaptation) for small excursions (around center) + - high cutoff (fast adaptation) for large excursions (off-center) + */ + ang = QuaternionAngle( absRot, pOTR->trkRot ); + normalizedOrientation = ang * ang; + + relativeOrientationRate = sqrtf( normalizedOrientation ) / pOTR->adaptationAngle; + /* 'if' assumed to perform comparison to 0 */ + if ( relativeOrientationRate > 1.0f ) + { + relativeOrientationRate = 1.0f; + } + + /* Compute range of the adaptation rate between center = lower rate and off-center = higher rate */ + rateRange = pOTR->offCenterAdaptationRate - pOTR->centerAdaptationRate; + /* 'if' assumed to perform comparison to 0 */ + if ( rateRange < 0.0f ) + { + rateRange = 0.0f; + } + + /* Compute adaptivity cutoff frequency: interpolate between minimum (center) and maximum (off-center) values */ + cutoffFrequency = pOTR->centerAdaptationRate + ( relativeOrientationRate * rateRange ); + + /* Compute filter coefficient corresponding to desired cutoff frequency */ + pOTR->alpha = sinf( 2.0f * EVS_PI * cutoffFrequency / updateRate ); + break; + default: + result = IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Non-supported orientation tracking adaptation type" ); + break; + } + + if ( result == IVAS_ERR_OK ) + { + *pTrkRot = pOTR->trkRot; + } + + return result; +} diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 2dfaa6da6857cfddd5f28c1d82f77f8ebe1ee173..193e775f22f2c44dddf64e6e4ca73520c76f3220 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -29,15 +29,12 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -// VE2AT: keep in lib_rend or move to lib_dec ? -#include + #include #include "options.h" #include "ivas_cnst.h" -#include "ivas_prot.h" #include "prot.h" -#include "ivas_stat_dec.h" -#include "ivas_rom_dec.h" +#include "ivas_prot_rend.h" #include "ivas_rom_com.h" #ifdef DEBUGGING #include "debug.h" @@ -246,366 +243,3 @@ void ivas_output_init( return; } - - -/*-------------------------------------------------------------------------* - * ivas_renderer_select() - * - * Select and configure IVAS renderer parameters - *-------------------------------------------------------------------------*/ - -void ivas_renderer_select( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - RENDERER_TYPE *renderer_type; - AUDIO_CONFIG *internal_config; - AUDIO_CONFIG output_config; - AUDIO_CONFIG transport_config; - - int16_t nchan_internal; - - renderer_type = &( st_ivas->renderer_type ); - internal_config = &( st_ivas->intern_config ); - output_config = st_ivas->hDecoderConfig->output_config; - transport_config = st_ivas->transport_config; - - /* disabled rendering by default */ - *renderer_type = RENDERER_DISABLE; - - /*-----------------------------------------------------------------* - * Binaural rendering configurations - *-----------------------------------------------------------------*/ - - if ( st_ivas->hDecoderConfig->Opt_Headrotation ) - { - st_ivas->hHeadTrackData->shd_rot_max_order = -1; - } - - if ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) - { - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - if ( output_config == AUDIO_CONFIG_BINAURAL ) - { - *renderer_type = RENDERER_BINAURAL_PARAMETRIC; - } - else - { - *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; - } - } - else /* ISM_MODE_DISC */ - { - if ( output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hRenderConfig->roomAcoustics.use_brir == 0 ) - { -#ifdef DEBUGGING - if ( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) - { - *renderer_type = RENDERER_BINAURAL_FASTCONV; - *internal_config = AUDIO_CONFIG_HOA3; /* Render ISM to HOA3 before binauralization*/ - } - else - { - *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; - *internal_config = AUDIO_CONFIG_BINAURAL; - } -#else - *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; - *internal_config = AUDIO_CONFIG_BINAURAL; -#endif - } - else - { - *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; -#if defined( DEBUGGING ) - if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) - { - *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; - } -#endif - *internal_config = AUDIO_CONFIG_7_1_4; - } - } - } - else if ( st_ivas->ivas_format == MASA_FORMAT || ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport <= 2 ) ) - { - *internal_config = output_config; - if ( output_config == AUDIO_CONFIG_BINAURAL ) - { - *renderer_type = RENDERER_BINAURAL_PARAMETRIC; - } - else - { - *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; - } - } - else if ( st_ivas->ivas_format == SBA_FORMAT ) - { - *internal_config = AUDIO_CONFIG_HOA3; - - if ( output_config == AUDIO_CONFIG_BINAURAL ) - { - *renderer_type = RENDERER_BINAURAL_FASTCONV; - } - else - { - *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; - } - - if ( st_ivas->hDecoderConfig->Opt_Headrotation ) - { - - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order ); - if ( nchan_internal == 2 ) - { - st_ivas->hHeadTrackData->shd_rot_max_order = 1; - } - else if ( nchan_internal == 4 || nchan_internal == 3 ) - { - st_ivas->hHeadTrackData->shd_rot_max_order = 0; - } - else if ( nchan_internal == 6 || nchan_internal == 5 ) - { - st_ivas->hHeadTrackData->shd_rot_max_order = 2; - } - else if ( nchan_internal == 8 || nchan_internal == 7 ) - { - st_ivas->hHeadTrackData->shd_rot_max_order = 3; - } - } - } - else if ( st_ivas->ivas_format == MC_FORMAT ) - { - if ( st_ivas->mc_mode == MC_MODE_MCMASA ) - { - *internal_config = output_config; - if ( output_config == AUDIO_CONFIG_BINAURAL ) - { - *renderer_type = RENDERER_BINAURAL_PARAMETRIC; - } - else - { - *renderer_type = RENDERER_BINAURAL_PARAMETRIC_ROOM; - } - } - else - { - *internal_config = transport_config; - if ( output_config == AUDIO_CONFIG_BINAURAL ) - { -#ifdef DEBUGGING - if ( ( ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && st_ivas->hDecoderConfig->Opt_Headrotation ) || ( st_ivas->hDecoderConfig->force_rend == FORCE_TD_RENDERER ) ) && ( st_ivas->mc_mode == MC_MODE_MCT ) && !( st_ivas->hDecoderConfig->force_rend == FORCE_CLDFB_RENDERER ) ) -#else - if ( ( st_ivas->transport_config == AUDIO_CONFIG_5_1 || st_ivas->transport_config == AUDIO_CONFIG_7_1 ) && st_ivas->hDecoderConfig->Opt_Headrotation && ( st_ivas->mc_mode == MC_MODE_MCT ) ) -#endif - { - *renderer_type = RENDERER_BINAURAL_OBJECTS_TD; - } - else - { - if ( st_ivas->mc_mode == MC_MODE_MCT ) - { - *renderer_type = RENDERER_BINAURAL_MIXER_CONV; - } - else - { - *renderer_type = RENDERER_BINAURAL_FASTCONV; - } - -#ifdef DEBUGGING - if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_CREND ) - { - *renderer_type = RENDERER_BINAURAL_MIXER_CONV; - } - else if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) - { - *renderer_type = RENDERER_BINAURAL_FASTCONV; - } -#endif - if ( st_ivas->hDecoderConfig->Opt_Headrotation ) - { - /* force HOA3 domain for rotation*/ - *internal_config = AUDIO_CONFIG_HOA3; - } - } - } - else /* AUDIO_CONFIG_BINAURAL_ROOM */ - { - if ( st_ivas->mc_mode == MC_MODE_MCT ) - { - *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; - } - else - { - *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; - } -#ifdef DEBUGGING - if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_CREND ) - { - *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; - } - else if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) - { - *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; - } -#endif - } - } - } - } - - /*-----------------------------------------------------------------* - * Non-binaural rendering configurations - *-----------------------------------------------------------------*/ - - else if ( st_ivas->ivas_format == STEREO_FORMAT ) - { - if ( output_config != AUDIO_CONFIG_STEREO && output_config != AUDIO_CONFIG_MONO ) - { - *renderer_type = RENDERER_MC; - } - } - else if ( st_ivas->ivas_format == ISM_FORMAT ) - { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - *renderer_type = RENDERER_PARAM_ISM; - if ( output_config == AUDIO_CONFIG_MONO ) - { - *renderer_type = RENDERER_MONO_DOWNMIX; - } - else if ( output_config == AUDIO_CONFIG_STEREO ) - { - *renderer_type = RENDERER_DISABLE; - } - else if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) - { - *renderer_type = RENDERER_SBA_LINEAR_ENC; - *internal_config = AUDIO_CONFIG_7_1_4; - } - } - else /* ISM_MODE_DISC */ - { - *renderer_type = RENDERER_TD_PANNING; - if ( output_config == AUDIO_CONFIG_MONO ) - { - *renderer_type = RENDERER_MONO_DOWNMIX; - } - else if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) - { - *renderer_type = RENDERER_SBA_LINEAR_ENC; - } - else if ( output_config == AUDIO_CONFIG_EXTERNAL ) - { - *renderer_type = RENDERER_DISABLE; - } - } - } - else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) - { - *renderer_type = RENDERER_DIRAC; - - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && - ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM ) ) - { - if ( output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_FOA ) - { - *internal_config = output_config; - } - else if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) - { - *internal_config = AUDIO_CONFIG_FOA; - } - else - { - *internal_config = AUDIO_CONFIG_HOA3; - } - st_ivas->renderer_type = RENDERER_SBA_LINEAR_DEC; - } - else if ( ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) || - ( st_ivas->ivas_format == SBA_FORMAT && output_config == AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 1 ) ) - { - *renderer_type = RENDERER_DISABLE; - } - else if ( ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) ) - { - *renderer_type = RENDERER_DISABLE; - } - else if ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_STEREO ) - { - *renderer_type = RENDERER_STEREO_PARAMETRIC; - } - else if ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_EXTERNAL ) - { - *renderer_type = RENDERER_DISABLE; - } - else if ( st_ivas->ivas_format == SBA_FORMAT && output_config == AUDIO_CONFIG_MONO ) - { - *renderer_type = RENDERER_SBA_LINEAR_DEC; - } - } - else if ( st_ivas->ivas_format == MC_FORMAT ) - { - *internal_config = transport_config; - if ( st_ivas->mc_mode == MC_MODE_MCT && *internal_config != output_config ) - { - if ( output_config != AUDIO_CONFIG_FOA && output_config != AUDIO_CONFIG_HOA2 && output_config != AUDIO_CONFIG_HOA3 ) - { - *renderer_type = RENDERER_MC; - } - else - { - *renderer_type = RENDERER_SBA_LINEAR_ENC; - } - } - else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) - { - if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) - { - *renderer_type = RENDERER_SBA_LINEAR_ENC; - } - else - { - *renderer_type = RENDERER_MC_PARAMMC; - } - } - else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) - { - *internal_config = output_config; - /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */ - if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) - { - if ( st_ivas->nchan_transport == 1 ) - { - *renderer_type = RENDERER_DISABLE; - } - else if ( output_config == AUDIO_CONFIG_STEREO && st_ivas->nchan_transport == 2 && !st_ivas->hOutSetup.separateChannelEnabled ) - { - *renderer_type = RENDERER_DISABLE; - } - else - { - *renderer_type = RENDERER_MCMASA_MONO_STEREO; - } - } - else - { - *renderer_type = RENDERER_DIRAC; - if ( output_config == AUDIO_CONFIG_FOA || output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_HOA3 ) - { - *renderer_type = RENDERER_SBA_LINEAR_ENC; - *internal_config = transport_config; - } - else if ( transport_config == AUDIO_CONFIG_5_1 && ( output_config == AUDIO_CONFIG_7_1 || output_config == AUDIO_CONFIG_5_1_4 ) ) - { - *internal_config = transport_config; - } - } - } - } - - return; -} diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h new file mode 100644 index 0000000000000000000000000000000000000000..b43a048f38f901638e8e2885fa4da2d0feaaf0fc --- /dev/null +++ b/lib_rend/ivas_prot_rend.h @@ -0,0 +1,990 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#ifndef IVAS_PROT_REND_H +#define IVAS_PROT_REND_H + +#include +#include "options.h" +#include "ivas_error.h" +#include "lib_rend.h" +#include "ivas_stat_dec.h" // Note: needed until #156 is resolved + +/* clang-format off */ + +/*----------------------------------------------------------------------------------* + * General renderer declarations + *----------------------------------------------------------------------------------*/ + +IVAS_REND_AudioConfigType getAudioConfigType( + const IVAS_REND_AudioConfig config +); + +ivas_error getAudioConfigNumChannels( + const IVAS_REND_AudioConfig config, + int16_t *numChannels +); + +AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( + IVAS_REND_AudioConfig rendConfig ); + +IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( + AUDIO_CONFIG config ); + + +/*----------------------------------------------------------------------------------* + * output setup prototypes + *----------------------------------------------------------------------------------*/ + +/*! r: number of output channels */ +int16_t audioCfg2channels( + const AUDIO_CONFIG output_config /* i : output audio configuration */ +); + +void ivas_output_init( + IVAS_OUTPUT_SETUP *hOutSetup, /* o : output setup structure */ + const AUDIO_CONFIG output_config /* i : output audio configuration */ +); + +/*----------------------------------------------------------------------------------* + * Limiter prototypes + *----------------------------------------------------------------------------------*/ + +/*! r: limiter struct handle */ +IVAS_LIMITER_HANDLE ivas_limiter_open( + const int16_t num_channels, /* i : number of I/O channels */ + const int32_t sampling_rate /* i : sampling rate for processing */ +); + +void ivas_limiter_close( + IVAS_LIMITER_HANDLE* phLimiter /* i/o: pointer to limiter handle, can be NULL */ +); + +void ivas_limiter_dec +( + IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ +#ifdef JBM_TSM_ON_TCS + float *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ +#else + float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], /* i/o: input/output buffer */ +#endif + const int16_t num_channels, /* i : number of channels to be processed */ + const int16_t output_frame, /* i : number of samples per channel in the buffer */ + const int16_t BER_detect /* i : BER detect flag */ +); + +void limiter_process( + IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ + const int16_t output_frame, /* i : number of samples to be processed per channel in the I/O buffer */ + const float threshold, /* i : signal amplitude above which limiting starts to be applied */ + const int16_t BER_detect, /* i : BER detect flag */ + int16_t *strong_saturation_cnt /* i/o: counter of strong saturations (can be NULL) */ +); + + +/*----------------------------------------------------------------------------------* + * Amplitude Panning EFAP prototypes + *----------------------------------------------------------------------------------*/ + +ivas_error efap_init_data( + EFAP_HANDLE *hEFAPdata, /* i/o: handle for EFAP data structure that will be initialized */ + const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths (positive left) */ + const float *speaker_node_ele_deg, /* i : vector of speaker node elevations (positive up) */ + const int16_t num_speaker_nodes, /* i : number of speaker nodes in the set */ + const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ +); + +void efap_free_data( + EFAP_HANDLE *hEFAPdata /* i/o: EFAP handle to be freed */ +); + +void efap_determine_gains( + EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + float *gains, /* o : gain vector for speaker nodes for given direction */ + const float azi_deg, /* i : azimuth in degrees for panning direction (positive left) */ + const float ele_deg, /* i : elevation in degrees for panning direction (positive up) */ + const int16_t efap_mode /* i : indicates whether EFAP or EFIP is used */ +); + + +/*----------------------------------------------------------------------------------* + * SBA rendering + *----------------------------------------------------------------------------------*/ + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +void ivas_sba_prototype_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ + const int16_t subframe /* i : Subframe to render */ +); +#else +void ivas_sba_prototype_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ + const int16_t firstSubframe, /* i : First subframe to map */ + const int16_t nSubframes /* i : Number of subframes to map */ +); +#endif + +ivas_error ivas_sba_get_hoa_dec_matrix( + const IVAS_OUTPUT_SETUP hOutSetup, /* i : target output setup */ + float **hoa_dec_mtx, /* o : ALLRAD decoder matrix */ + const int16_t ambisonics_order /* i : Ambisonics order */ +); + +void ivas_dirac_dec_binaural( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t nchan_transport /* i : number of transport channels */ +); + +#ifdef JBM_TSM_ON_TCS +void ivas_dirac_dec_binaural_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + const int16_t nchan_transport, + float *output_f[] /* o : rendered time signal */ +); +#endif + +ivas_error ivas_dirac_dec_init_binaural_data( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : HRTF structure for rendering */ +); + +void ivas_dirac_dec_close_binaural_data( + DIRAC_DEC_BIN_HANDLE *hBinaural /* i/o: decoder DirAC binaural data handle */ +); + +ivas_error ivas_dirac_dec_binaural_copy_hrtfs( + HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ +); + + +/*----------------------------------------------------------------------------------* + * HRTF + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_HRTF_binary_open( + TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ +); + +void ivas_HRTF_binary_close( + TDREND_HRFILT_FiltSet_t **hHrtfTD /* i/o: TD renderer HRTF handle */ +); + +ivas_error ivas_HRTF_fastconv_binary_open( + HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ +); + +void ivas_HRTF_fastconv_binary_close( + HRTFS_FASTCONV **hHrtfFastConv /* i/o: FASTCONV HRTF structure */ +); + +ivas_error ivas_HRTF_parambin_binary_open( + HRTFS_PARAMBIN **hHrtfParambin /* i/o: Parametric binauralizer HRTF structure */ +); + +void ivas_HRTF_parambin_binary_close( + HRTFS_PARAMBIN **hHrtfParambin /* i/o: Parametric binauralizer HRTF structure */ +); + +ivas_error ivas_HRTF_CRend_binary_open( + HRTFS_CREND **hSetOfHRTF /* i/o: Set of HRTF handle */ +); + +void ivas_HRTF_CRend_binary_close( + HRTFS_CREND **hSetOfHRTF /* i/o: Set of HRTF handle */ +); + + +/*----------------------------------------------------------------------------------* + * TD object renderer + *----------------------------------------------------------------------------------*/ + +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 int16_t Opt_Headrotation, /* i : Head rotation flag */ + const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ + const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: SCE channels / Binaural synthesis */ +#else + float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ +#endif + const int16_t output_frame /* i : output frame length */ +); + +ivas_error ivas_td_binaural_renderer_ext( + const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ + const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ + const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ + const IVAS_REND_HeadRotData *headRotData, /* i : Input head positions */ + const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ + const int16_t output_frame, /* i : output frame length */ + float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ +); + +ivas_error ivas_td_binaural_open_unwrap( + TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HR filter model (from file or NULL) */ + const int32_t output_Fs, /* i : Output sampling rate */ + const int16_t nchan_transport, /* i : Number of channels */ + const IVAS_FORMAT ivas_format, /* i : IVAS format (ISM/MC) */ + const AUDIO_CONFIG transport_config, /* i : Transport configuration */ + const float *directivity, /* i : Directivity pattern (used for ISM) */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : Loudspeaker layout */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ + int32_t *binaural_latency_ns /* i : Binauralization delay */ +); + +ivas_error ivas_td_binaural_open_ext( + TDREND_WRAPPER *pTDRend, + const IVAS_REND_AudioConfig inConfig, + RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ + LSSETUP_CUSTOM_STRUCT *customLsInput, + const int32_t output_Fs +); + +void ivas_td_binaural_close( + BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd /* i/o: TD binaural object renderer handle */ +); + + +ivas_error TDREND_GetMix( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ +#else + float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ +#endif + const int16_t subframe_length, /* i/o: subframe length */ + const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ +); + +void TDREND_Update_listener_orientation( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ + const int16_t headRotEnabled, /* i : Headrotation flag */ + const IVAS_QUATERNION *headPosition, /* i : Listener orientation */ + const IVAS_VECTOR3 *Pos /* i : Listener Position */ +); + +void TDREND_Update_object_positions( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ + const int16_t num_src, /* i : number of sources to render */ + const int16_t lfe_idx, /* i : Input LFE index */ + const IVAS_FORMAT in_format, /* i : Format of input sources */ + const ISM_METADATA_HANDLE *hIsmMetaData, /* i : Input metadata for ISM objects */ +#ifdef JBM_TSM_ON_TCS + float *output[] /* i/o: SCE/MC channels */ +#else + float output[][L_FRAME48k] /* i/o: SCE/MC channels */ +#endif +); + +void BSplineModelEvalDealloc( + ModelParams_t *model, /* i : Model parameters */ + ModelEval_t *modelEval /* i : Model evaluation structure */ +); + +/* ----- Object renderer - hrfilt ----- */ + +void GetFilterFromAngle( + TDREND_HRFILT_FiltSet_t *HrFiltSet_p, /* i/o: HR filter set structure */ + const float Elev, /* i : Elevation, degrees */ + float Azim, /* i : Azimuth, degrees */ + float *LeftFilter, /* o : Left HR filter */ + float *RightFilter, /* o : Right HR filter */ + int16_t *itd /* o : ITD value */ +); + +void HRTF_model_precalc( + ModelParams_t *model /* i/o: HRTF Model parameters */ +); + +ivas_error TDREND_REND_RenderSourceHRFilt( + TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ + const float *hrf_left_delta, /* i: Left filter interpolation delta */ + const float *hrf_right_delta, /* i: Right filter interpolation delta */ + const int16_t intp_count, /* i: Interpolation count */ + float output_buf[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ + const int16_t subframe_length /* i : Subframe length in use */ +); + +/* ----- Object renderer - sources ----- */ + +ivas_error TDREND_MIX_SRC_SetPos( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const int16_t SrcInd, /* i : Source index */ + const float *Vec_p /* i : Position vector */ +); + +ivas_error TDREND_MIX_SRC_SetDir( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const int16_t SrcInd, /* i : Source index */ + const float *Vec_p /* i : Direction vector */ +); + +ivas_error TDREND_MIX_SRC_SetDirAtten( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const int16_t SrcInd, /* i : Source index */ + const TDREND_DirAtten_t *DirAtten_p /* i : Directional attenuation specifier */ +); + +ivas_error TDREND_MIX_SRC_SetPlayState( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const int16_t SrcInd, /* i : Source index */ + const TDREND_PlayStatus_t PlayStatus /* i : Play state */ +); + +void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + TDREND_SRC_REND_t *SrcRend_p, /* i/o: Source object */ + TDREND_SRC_SPATIAL_t *SrcSpatial_p, /* i : Spatial aspects of source */ + float *hrf_left_prev, /* o: Left filter */ + float *hrf_right_prev, /* o: Right filter */ + float *hrf_left_delta, /* o: Left filter interpolation delta */ + float *hrf_right_delta, /* o: Right filter interpolation delta */ + int16_t *intp_count, /* o: Interpolation count */ + int16_t *filterlength, /* o: Length of filters */ + int16_t *itd, /* o: ITD value */ + float *Gain, /* o: Gain value */ + TDREND_SRC_t *Src_p, + const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ +); + +ivas_error TDREND_SRC_Alloc( + TDREND_SRC_t **Src_pp /* i/o: Source */ +); + +void TDREND_SRC_Dealloc( + TDREND_SRC_t *Src_p /* i/o: Source to deallocate */ +); + +void TDREND_SRC_Init( + TDREND_SRC_t *Src_p, /* i/o: Source to initialize */ + const TDREND_PosType_t PosType /* i : Position type specifier */ +); + +/* ----- Object renderer - vec ----- */ + +void TDREND_SPATIAL_VecInit( + float *Pos_p, /* o : Output vector */ + const float PosX, /* i : X value */ + const float PosY, /* i : Y value */ + const float PosZ /* i : Z value */ +); + +/*! r: Euclidian norm value */ +float TDREND_SPATIAL_VecNorm( + const float *Vec_p /* i : Vector for norm calculation */ +); + +void TDREND_SPATIAL_VecNormalize( + const float *Vec_p, /* i : Input vector */ + float *VecNorm_p /* o : Output vector */ +); + +void TDREND_SPATIAL_VecMapToNewCoordSystem( + const float *Vec_p, /* i : Input vector */ + const float *TranslVec_p, /* i : Translation vector */ + const float *DirVec_p, /* i : Direction vector */ + const float *UpVec_p, /* i : Up vector */ + const float *RightVec_p, /* i : Right vector */ + float *MappedVec_p, /* o : Transformed vector */ + float *LisRelPosAbs /* o : Transformed vector ignoring orientation */ +); + +/*! r: Flag if the orientation has been updated */ +int16_t TDREND_SPATIAL_EvalOrthonormOrient( + float *FrontVecON_p, /* o : Normalized front vector */ + float *UpVecON_p, /* o : Normalized up vector */ + float *RightVecON_p, /* o : Normalized right vector */ + const float *FrontVec_p, /* i : Input front vector */ + const float *UpVec_p /* i : Input up vector */ +); + +/* ----- Object renderer - mix ----- */ + +ivas_error TDREND_MIX_AddSrc( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + int16_t *SrcInd, /* o : Source index */ + const TDREND_PosType_t PosType /* i : Position type (absolute/relative) */ +); + +ivas_error TDREND_MIX_SetDistAttenModel( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const TDREND_DistAttenModel_t DistAttenModel /* i : Distance attenuation model */ +); + +void TDREND_MIX_LIST_SetPos( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const float *Pos_p /* i : Listener's position */ +); + +ivas_error TDREND_MIX_LIST_SetOrient( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const float *FrontVec_p, /* i : Listener's orientation front vector */ + const float *UpVec_p /* i : Listener's orientation up vector */ +); + +void TDREND_MIX_Dealloc( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd /* i/o: TD renderer handle */ +); + +ivas_error TDREND_MIX_Init( + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HRTF data (initialized in case of NULL) */ + const TDREND_MixSpatSpec_t *MixSpatSpec_p, /* i : Mixer spatial specification */ + const int32_t output_Fs /* i : Output sampling rate */ +); + + /* ----- Object renderer - sfx ----- */ + +void TDREND_Apply_ITD( + float *input, /* i: Input SCE subframe to be time adjusted */ + float *out_left, /* o: Output left channels with ITD applied */ + float *out_right, /* o: Output right channels with ITD applied */ + int16_t *previtd, /*i/o: Previous ITD value */ + const int16_t itd, /* i: Current subframe ITD value */ + float *mem_itd, /*i/o: ITD buffer memory */ + const int16_t length /* i: Subframe length */ +); + +void TDREND_firfilt( + float *signal, /* i/o: Input signal / Filtered signal */ + float *filter, /* i/o: FIR filter */ + const float *filter_delta, /* i : FIR filter delta */ + const int16_t intp_count, /* i : interpolation count */ + float *mem, /* i/o: filter memory */ + const int16_t subframe_length, /* i : Length of signal */ + const int16_t filterlength, /* i : Filter length */ +#ifdef FIX_379_GAININTP + const float Gain, /* i : Gain */ + const float prevGain /* i : Previous gain */ +#else + const float Gain /* i : Gain */ +#endif +); + + +/*----------------------------------------------------------------------------------* + * Crend renderer + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_rend_openCrend( + CREND_WRAPPER_HANDLE *pCrend, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, + RENDER_CONFIG_DATA *hRendCfg, + HRTFS_CREND_HANDLE hSetOfHRTF, + const int32_t output_Fs +); + +void ivas_rend_closeCrend( + CREND_WRAPPER_HANDLE *pCrend ); + +ivas_error ivas_rend_initCrendWrapper( + CREND_WRAPPER_HANDLE *pCrend ); + +ivas_error ivas_rend_crendProcess( + const CREND_WRAPPER *pCrend, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, + DECODER_CONFIG_HANDLE hDecoderConfig, + HEAD_TRACK_DATA_HANDLE hHeadTrackData, + IVAS_OUTPUT_SETUP_HANDLE hIntSetup, + EFAP_HANDLE hEFAPdata, +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: input/output audio channels */ +#else + float output[][L_FRAME48k], /* i/o: input/output audio channels */ +#endif + const int32_t output_Fs +); + +#ifdef JBM_TSM_ON_TCS +ivas_error ivas_rend_crendProcessSubframe( + const CREND_WRAPPER *pCrend, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, + DECODER_CONFIG_HANDLE hDecoderConfig, + HEAD_TRACK_DATA_HANDLE hHeadTrackData, + IVAS_OUTPUT_SETUP_HANDLE hIntSetup, + EFAP_HANDLE hEFAPdata, + DECODER_TC_BUFFER_HANDLE hTcBuffer, + float *input_f[], + float *output[], /* i/o: input/output audio channels */ + const int16_t n_samples_to_render, + const int32_t output_Fs ); +#endif + + +ivas_error ivas_crend_init_from_rom( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +ivas_error ivas_crend_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +ivas_error ivas_crend_close( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +ivas_error ivas_crend_process( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float output[][L_FRAME48k] /* i/o: input/output audio channels */ +); + +/*----------------------------------------------------------------------------------* + * Reverberator + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_binaural_reverb_open( + REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ + const int16_t numBins, /* i : number of CLDFB bins */ + const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ + ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ + const AUDIO_CONFIG output_config, /* i : output audio configuration */ + const int32_t sampling_rate, /* i : sampling rate */ + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const HRTFS_FASTCONV_HANDLE hHrtfFastConv, /* i : FastConv HRTF handle */ + const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ +); + +void ivas_binaural_reverb_close( + REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ +); + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +void ivas_binaural_reverb_processSubframe( + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t numInChannels, /* i : num input channels to be processed */ +#ifdef JBM_TSM_ON_TCS + const int16_t numSlots, /* i : number of slots to be processed */ +#endif + float inReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real */ + float inImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ + float outReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ + float outImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* o : output CLDFB data imag */ +); +#else +void ivas_binaural_reverb_processFrame( + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t numInChannels, /* i : num input channels to be processed */ + float inReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real */ + float inImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ + float outReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ + float outImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data imag */ + const uint8_t offsetSamplesIO /* i : number of offset samples */ +); +#endif + +#ifdef JBM_TSM_ON_TCS +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS +void ivas_binaural_reverb_processSlot( + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t numInChannels, /* i : num inputs to be processed */ + float inReal[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ + float inImag[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ + float outReal[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ + float outImag[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data imag */ + const uint8_t offsetSamplesIO /* i : number of offset samples */ +); +#endif +#endif + +ivas_error ivas_reverb_open( + REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ + const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ + const HRTFS_HANDLE hHrtf, /* i : HRTF handle */ + RENDER_CONFIG_DATA *pConfig, /* i : Reverb configuration */ + const int32_t output_Fs /* i : output sampling rate */ +); + +void ivas_reverb_close( + REVERB_HANDLE *hReverb /* i/o: Reverberator handle */ +); + +ivas_error ivas_reverb_process( + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ + const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ + const int16_t mix_signals, /* i : add reverb to output signal */ +#ifdef JBM_TSM_ON_TCS + float *pcm_in[], /* i : the PCM audio to apply reverb on */ + float *pcm_out[], /* o : the PCM audio with reverb applied */ +#else + float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ + float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ +#endif + const int16_t i_ts /* i : subframe index */ +); + +void ivas_rev_delay_line_init( + ivas_rev_delay_line_t *pDelay, /* o : the delay line to initialize */ + float *memory_buffer, /* i : the memory buffer to use for the delay line */ + const uint16_t delay, /* i : the delay */ + const uint16_t maxdelay /* i : maximum delay to be supported */ +); + +/* !r: sample gotten out of delay line, and amplified by set gain */ +float ivas_rev_delay_line_get_sample( + ivas_rev_delay_line_t *pDelay /* i/o: the delay line */ +); + +void ivas_rev_delay_line_feed_sample( + ivas_rev_delay_line_t *pDelay, /* i : the delay line */ + float input /* i : the sample to feed */ +); + +void ivas_rev_delay_line_get_sample_blk( + ivas_rev_delay_line_t *pDelay, /* i : the delay line */ + const uint16_t blk_size, /* i : number of samples in the data block */ + float *output /* i/o: amples gotten out of delay line, and amplified by set gainin */ +); + +void ivas_rev_delay_line_feed_sample_blk( + ivas_rev_delay_line_t *pDelay, /* i/o: the delay line */ + const uint16_t blk_size, /* i : number of samples in the input data block */ + float *input /* i : the samples to feed */ +); + +void ivas_reverb_iir_filt_init( + ivas_rev_iir_filter_t *iirFilter, /* o : IIR filter */ + const uint16_t maxTaps /* i : maximum number of filter taps */ +); + +void ivas_reverb_iir_filt_set( + ivas_rev_iir_filter_t *iirFilter, /* i/o: IIR filter */ + uint16_t nr_taps, /* i : number of IIR filter taps */ + const float *coefA, /* i : A filter coefficients to set */ + const float *coefB /* i : the B filter coefficients to set */ +); + +void ivas_reverb_iir_filt_2taps_feed_blk( + ivas_rev_iir_filter_t *iirFilter, /* i/o: IIR filter */ + const uint16_t blk_size, /* i : size */ + const float *input, /* i : input buffer */ + float *output /* i : output buffer */ +); + +uint16_t int_log2( + uint32_t powerOf2 +); + +int16_t ivas_reverb_t2f_f2t_init( + ivas_reverb_t2f_f2t_t *t2f_f2t, + const int16_t fft_size, + const int16_t block_size +); + +void ivas_reverb_t2f_f2t_ClearHistory( + ivas_reverb_t2f_f2t_t *t2f_f2t +); + +void ivas_reverb_t2f_f2t_in( + ivas_reverb_t2f_f2t_t *t2f_f2t, + float *input_L, + float *input_R, float *buffer_L, + float *buffer_R +); + +void ivas_reverb_t2f_f2t_out( + ivas_reverb_t2f_f2t_t *t2f_f2t, + float *buffer_L, + float *buffer_R, + float *output_L, + float *output_R +); + +int16_t ivas_reverb_fft_filter_init( + ivas_reverb_fft_filter_t *fft_filter, + const int16_t fft_size +); + +void ivas_reverb_fft_filter_ComplexMul( + ivas_reverb_fft_filter_t *fft_filter, + float *buffer +); + +void ivas_reverb_fft_filter_CrossMix( + float *buffer0, + float *buffer1, + const int16_t fft_size +); + +void ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( + rv_fftwf_type_complex *spectrum, + float *fft_real, + const int16_t fft_size +); + +void ivas_reverb_define_window_fft( + float *pWindow, + const int16_t transitionStart, + const int16_t transitionLength, + const int16_t spectrumLength +); + +int16_t ivas_reverb_calc_color_filters( + const float *pTargetL, + const float *pTargetR, + const float *pWindow, + const int16_t fft_size, + const float delay, + rv_fftwf_type_complex *pBeqL, + rv_fftwf_type_complex *pBeqR +); + +int16_t ivas_reverb_calc_correl_filters( + const float *pTargetICC, + const float *pWindow, + const int16_t fft_size, + const float delay, + rv_fftwf_type_complex *pU, + rv_fftwf_type_complex *pV +); + +void ivas_reverb_calc_color_levels( + const int32_t output_Fs, + const int16_t freq_count, + const int16_t loop_count, + const float *pFc, + const float *pAcoustic_dsr, + const float *pHrtf_avg_pwr_L, + const float *pHrtf_avg_pwr_R, + const int16_t *pLoop_delays, + const float *pT60_filter_coeff, + float *pTarget_color_L, + float *pTarget_color_R +); + +void ivas_reverb_prepare_cldfb_params( + ivas_roomAcoustics_t *pInput_params, + const HRTFS_FASTCONV_HANDLE hHrtfFastConv, + const AUDIO_CONFIG input_audio_config, + const int16_t use_brir, + const int32_t output_Fs, + float *pOutput_t60, + float *pOutput_ene ); + +void ivas_reverb_interpolate_acoustic_data( + const int16_t input_table_size, + const float *pInput_fc, + const float *pInput_t60, + const float *pInput_dsrR, + const int16_t output_table_size, + const float *pOutput_fc, + float *pOutput_t60, + float *pOutput_dsr +); + +void ivas_reverb_get_hrtf_set_properties( + float **ppHrtf_set_L_re, + float **ppHrtf_set_L_im, + float **ppHrtf_set_R_re, + float **ppHrtf_set_R_im, + const AUDIO_CONFIG input_audio_config, + const int16_t hrtf_count, + const int16_t in_freq_count, + const int16_t out_freq_count, + float *pOut_avg_pwr_L, + float *pOut_avg_pwr_R, + float *pOut_i_a_coherence +); + + +/*---------------------------------------------------------------------------------* + * Rotation Prototypes + *-----------------------------------------------------------------------------------*/ + +ivas_error ivas_headTrack_open( + HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* o : head track handle */ +); + +void ivas_headTrack_close( + HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ +); + +void Euler2Quat( + const float yaw, /* i : yaw (x) */ + const float pitch, /* i : pitch (y) */ + const float roll, /* i : roll (z) */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ +); + +float deg2rad( float degrees ); + + + +void QuatToRotMat( + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ + float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ +); + +void rotateAziEle( + float azi_in, /* i : output elevation */ + float ele_in, /* i : input elevation */ + int16_t *azi, /* o : rotated azimuth */ + int16_t *ele, /* o : rotated elevation */ + float Rmat[3][3], /* i : real-space rotation matrix */ + const int16_t isPlanar /* i : is roation planar and elevation meaningless? */ +); + +void SHrotmatgen( + float SHrotmat[SBA_NHARM_HOA3][SBA_NHARM_HOA3], /* o : SHD rotation matrix */ + float Rmat[3][3], /* i : real-space rotation matrix */ + const int16_t order /* i : ambisonics order */ +); + +void rotateFrame_shd( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ +#else + float output[][L_FRAME48k], /* i/o: unrotated HOA3 signal buffer in TD */ +#endif + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const int16_t subframe_idx /* i : subframe index */ +); + +void rotateFrame_sd( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: unrotated SD signal buffer in TD */ +#else + float output[][L_FRAME48k], /* i/o: unrotated SD signal buffer in TD */ +#endif + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + const int16_t subframe_idx /* i : subframe index */ +); + +void rotateFrame_shd_cldfb( + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ + float Rmat[3][3], /* i : real-space rotation matrix */ + const int16_t nInChannels, /* i : number of channels */ +#ifdef JBM_TSM_ON_TCS + const int16_t numTimeSlots, /* i : number of time slots to process */ +#endif + const int16_t shd_rot_max_order /* i : split-order rotation method */ +); + +void rotateFrame_sd_cldfb( + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ + float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain real part */ + float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ + const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ + const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ +#ifdef JBM_TSM_ON_TCS + const int16_t numTimeSlots, /* i : number of time slots to process */ +#endif + const int16_t nb_band /* i : number of CLDFB bands to process */ +); + + +/*----------------------------------------------------------------------------------* + * Renderer configuration + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_render_config_open( + RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */ +); + +void ivas_render_config_close( + RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */ +); + +ivas_error ivas_render_config_init_from_rom( + RENDER_CONFIG_HANDLE *hRenderConfig, /* i/o: Renderer config handle */ + const int16_t room_flag_on /* i : room effect on/off flag */ +); + + +/*----------------------------------------------------------------------------------* + * Orientation tracking + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_orient_trk_Init( + ivas_orient_trk_state_t *pOTR /* i/o: orientation tracker handle */ +); + +ivas_error ivas_orient_trk_SetTrackingType( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const OTR_TRACKING_T trackingType /* i : orientation tracking type */ +); + +ivas_error ivas_orient_trk_SetReferenceRotation( + ivas_orient_trk_state_t *pOTR, /* i/o: orientatoin trakcer handle */ + const IVAS_QUATERNION refRot /* i : reference rotation */ +); + +ivas_error ivas_orient_trk_SetReferenceVector( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +); + +ivas_error ivas_orient_trk_GetMainOrientation( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION *pOrientation /* i/o: average/reference orientation */ +); + +ivas_error ivas_orient_trk_GetTrackedRotation( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION *pRotation /* i/o: processed rotation */ +); + +ivas_error ivas_orient_trk_Process( + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + IVAS_QUATERNION absRot, /* i : absolute head rotation */ + float updateRate, /* i : rotation update rate [Hz] */ + IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ +); + +/* clang-format on */ + +#endif /* IVAS_PROT_REND_H */ diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index a27fc58f2dfefef6a77c44074ee4c813c19ee262..efd866ccec4139bb01801f6141e6b4451776bc51 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -33,7 +33,7 @@ #include #include "options.h" #include "prot.h" -#include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include "ivas_rom_TdBinauralRenderer.h" #ifdef DEBUGGING @@ -61,8 +61,7 @@ ivas_error ivas_render_config_open( ) { /* Allocate HR filter set for headphones configuration */ - *hRenderConfig = (RENDER_CONFIG_HANDLE) malloc( sizeof( RENDER_CONFIG_DATA ) ); - if ( *hRenderConfig == NULL ) + if ( ( *hRenderConfig = (RENDER_CONFIG_HANDLE) malloc( sizeof( RENDER_CONFIG_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer configuration!" ); } @@ -104,6 +103,7 @@ ivas_error ivas_render_config_init_from_rom( const int16_t room_flag_on /* i : room effect on/off flag */ ) { + if ( hRenderConfig == NULL || *hRenderConfig == NULL ) { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); @@ -126,5 +126,9 @@ ivas_error ivas_render_config_init_from_rom( mvr2r( ivas_reverb_default_RT60, ( *hRenderConfig )->roomAcoustics.pAcoustic_rt60, IVAS_REVERB_DEFAULT_N_BANDS ); mvr2r( ivas_reverb_default_DSR, ( *hRenderConfig )->roomAcoustics.pAcoustic_dsr, IVAS_REVERB_DEFAULT_N_BANDS ); + ( *hRenderConfig )->directivity[0] = 360.0f; /* Front cone */ + ( *hRenderConfig )->directivity[1] = 360.0f; /* Back cone */ + ( *hRenderConfig )->directivity[2] = 1.0f; /* Back attenuation */ + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 09e482234135a1e02c34b9aee1a6374563ac293d..12a8b55ddbcbdd2e053170d24711c20ab5d7bddd 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -33,7 +33,7 @@ #include #include "options.h" #include "prot.h" -#include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_cnst.h" #ifdef DEBUGGING #include "debug.h" @@ -44,6 +44,19 @@ #include "wmc_auto.h" +/* The reverberator structure implemented here is described in detail in: + * Vilkamo, J., Neugebauer, B., & Plogsties, J. (2012). Sparse frequency-domain reverberator. + * Journal of the Audio Engineering Society, 59(12), 936-943. */ + +/*------------------------------------------------------------------------- + * Local constants + *------------------------------------------------------------------------*/ + +#define BIN_REND_RANDOM_SEED 1 /* random seed for generating reverb decorrelators */ + +#define CLDFB_SLOTS_PER_SECOND 800 /* Used for initializing reverb */ + + /*------------------------------------------------------------------------------------------* * Local constants *------------------------------------------------------------------------------------------*/ @@ -117,6 +130,151 @@ typedef struct ivas_reverb_params_t static ivas_error calc_jot_t60_coeffs( float *pH_dB, const uint16_t nrFrequencies, float *pFrequencies, float *pCoeffA, float *pCoeffB, const float fNyquist ); +/*------------------------------------------------------------------------- + * binRend_rand() + * + * + *------------------------------------------------------------------------*/ + +static uint16_t binRend_rand( + REVERB_STRUCT_HANDLE hReverb /* i/o: binaural reverb handle */ +) +{ + hReverb->binRend_RandNext = hReverb->binRend_RandNext * 1103515245 + 12345; + + return (uint16_t) ( hReverb->binRend_RandNext / 65536 ) % 32768; +} + + +/*------------------------------------------------------------------------- + * ivas_binaural_reverb_setPreDelay() + * + * + *------------------------------------------------------------------------*/ + +static void ivas_binaural_reverb_setPreDelay( + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t delaySamples /* i : reverb pre-delay in CLDFB slots */ +) +{ + if ( delaySamples < 1 ) + { + hReverb->preDelayBufferLength = 1; + + return; + } + + if ( delaySamples > REVERB_PREDELAY_MAX ) + { + hReverb->preDelayBufferLength = REVERB_PREDELAY_MAX; + + return; + } + + hReverb->preDelayBufferLength = delaySamples; + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_binaural_reverb_setReverbTimes() + * + * + *------------------------------------------------------------------------*/ + +static void ivas_binaural_reverb_setReverbTimes( + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int32_t output_Fs, /* i : sampling_rate */ + const float *revTimes, /* i : reverberation times T60 for each CLDFB bin in seconds */ + const float *revEnes /* i : spectrum for reverberated sound at each CLDFB bin */ +) +{ + int16_t bin, ch, tap, sample; + float binCenterFreq, diffuseFieldICC, tmpVal, attenuationFactorPerSample; + float intendedEnergy, actualizedEnergy, energyBuildup, currentEnergy, attenuationFactorPerSampleSq; + + hReverb->binRend_RandNext = (uint16_t) BIN_REND_RANDOM_SEED; + hReverb->highestBinauralCoherenceBin = 0; + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + /* Determine the diffuse field binaural coherence */ + binCenterFreq = ( (float) bin + 0.5f ) / ( (float) hReverb->numBins ) * ( (float) output_Fs ) / 2.0f; + if ( bin == 0 ) + { + diffuseFieldICC = 1.0f; + } + else if ( binCenterFreq < 2700.0f ) + { + diffuseFieldICC = sinf( EVS_PI * binCenterFreq / 550.0f + 1e-20f ) / ( EVS_PI * binCenterFreq / 550.0f + 1e-20f ) * ( 1.0f - binCenterFreq / 2700.0f ); + hReverb->highestBinauralCoherenceBin = bin; + } + else + { + diffuseFieldICC = 0.0f; + } + + /* Mixing gains to generate a diffuse-binaural sound based on incoherent sound */ + tmpVal = ( 1.0f - sqrtf( 1.0f - powf( diffuseFieldICC, 2.0 ) ) ) / 2.0f; + if ( diffuseFieldICC > 0 ) + { + hReverb->binauralCoherenceCrossmixGains[bin] = sqrtf( fabsf( tmpVal ) ); + } + else + { + hReverb->binauralCoherenceCrossmixGains[bin] = -sqrtf( fabsf( tmpVal ) ); + } + hReverb->binauralCoherenceDirectGains[bin] = sqrtf( 1.0f - fabsf( tmpVal ) ); + + /* Determine attenuation factor that generates the appropriate energy decay according to reverberation time */ + attenuationFactorPerSample = powf( 10.0f, -3.0f * ( 1.0f / ( (float) CLDFB_SLOTS_PER_SECOND * revTimes[bin] ) ) ); + hReverb->loopAttenuationFactor[bin] = powf( attenuationFactorPerSample, hReverb->loopBufLength[bin] ); + attenuationFactorPerSampleSq = attenuationFactorPerSample * attenuationFactorPerSample; + + /* Design sparse decorrelation filters. The decorrelation filters, due to random procedures involved, + * may affect the spectrum of the output. The spectral effect is therefore monitored and compensated for. */ + intendedEnergy = 0.0f; + actualizedEnergy = 0.0f; + + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + energyBuildup = 0.0f; + currentEnergy = 1.0f; + tap = 0; + + for ( sample = 0; sample < hReverb->loopBufLength[bin]; sample++ ) + { + intendedEnergy += currentEnergy; + + /* The randomization at the energy build up affects where the sparse taps are located */ + energyBuildup += currentEnergy + 0.1f * ( (float) binRend_rand( hReverb ) / PCM16_TO_FLT_FAC - 0.5f ); + + if ( energyBuildup >= 1.0f ) /* A new filter tap is added at this condition */ + { + /* Four efficient phase operations: n*pi/2, n=0,1,2,3 */ + hReverb->tapPhaseShiftType[bin][ch][tap] = (int16_t) ( binRend_rand( hReverb ) % 4 ); + /* Set the tapPointer to point to the determined sample at the loop buffer */ + hReverb->tapPointersReal[bin][ch][tap] = &( hReverb->loopBufReal[bin][sample] ); + hReverb->tapPointersImag[bin][ch][tap] = &( hReverb->loopBufImag[bin][sample] ); + energyBuildup -= 1.0f; /* A tap is added, thus remove its energy from the buildup */ + tap++; + actualizedEnergy += 1.0f; + } + currentEnergy *= attenuationFactorPerSampleSq; + } + hReverb->taps[bin][ch] = tap; /* Number of taps determined at the above random procedure */ + } + + /* The decorrelator design and IIR attenuation rate affects the energy of reverb, which is compensated here */ + hReverb->reverbEqGains[bin] = sqrtf( revEnes[bin] ); /* Determined reverb spectrum */ + hReverb->reverbEqGains[bin] *= sqrtf( intendedEnergy / actualizedEnergy ); /* Correction of random effects at the decorrelator design */ + hReverb->reverbEqGains[bin] *= sqrtf( 0.5f * ( 1.0f - attenuationFactorPerSampleSq ) ); /* Correction of IIR decay rate */ + } + + return; +} + + /*-----------------------------------------------------------------------------------------* * Function compute_feedback_matrix() * @@ -517,34 +675,34 @@ static ivas_error calc_jot_t60_coeffs( *-----------------------------------------------------------------------------------------*/ static ivas_error initialize_reverb_filters( - REVERB_HANDLE pState ) + REVERB_HANDLE hReverb ) { ivas_error error; error = IVAS_ERR_OK; /* init correlation and coloration filters */ - if ( ( error = ivas_reverb_t2f_f2t_init( &pState->fft_filter_ols, pState->fft_size, pState->fft_subblock_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_t2f_f2t_init( &hReverb->fft_filter_ols, hReverb->fft_size, hReverb->fft_subblock_size ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_reverb_fft_filter_init( &pState->fft_filter_correl_0, pState->fft_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_correl_0, hReverb->fft_size ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_reverb_fft_filter_init( &pState->fft_filter_correl_1, pState->fft_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_correl_1, hReverb->fft_size ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_reverb_fft_filter_init( &pState->fft_filter_color_0, pState->fft_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_color_0, hReverb->fft_size ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = ivas_reverb_fft_filter_init( &pState->fft_filter_color_1, pState->fft_size ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_fft_filter_init( &hReverb->fft_filter_color_1, hReverb->fft_size ) ) != IVAS_ERR_OK ) { return error; } @@ -560,13 +718,13 @@ static ivas_error initialize_reverb_filters( *-----------------------------------------------------------------------------------------*/ static ivas_error set_t60_filter( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t branch, const uint16_t nr_taps, const float coefA[], const float coefB[] ) { - if ( branch >= pState->nr_of_branches ) + if ( branch >= hReverb->nr_of_branches ) { return IVAS_ERR_INTERNAL; } @@ -576,7 +734,7 @@ static ivas_error set_t60_filter( return IVAS_ERR_INTERNAL; } - ivas_reverb_iir_filt_set( &( pState->t60[branch] ), nr_taps, coefA, coefB ); + ivas_reverb_iir_filt_set( &( hReverb->t60[branch] ), nr_taps, coefA, coefB ); return IVAS_ERR_OK; } @@ -589,16 +747,16 @@ static ivas_error set_t60_filter( *-----------------------------------------------------------------------------------------*/ static ivas_error set_feedback_delay( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t branch, const int16_t fb_delay ) { - if ( branch >= pState->nr_of_branches ) + if ( branch >= hReverb->nr_of_branches ) { return IVAS_ERR_INTERNAL; } - pState->delay_line[branch].Delay = fb_delay; + hReverb->delay_line[branch].Delay = fb_delay; return IVAS_ERR_OK; } @@ -611,19 +769,19 @@ static ivas_error set_feedback_delay( *-----------------------------------------------------------------------------------------*/ static ivas_error set_feedback_gain( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t branch, const float *pGain ) { uint16_t gain_idx; - if ( branch >= pState->nr_of_branches ) + if ( branch >= hReverb->nr_of_branches ) { return IVAS_ERR_INTERNAL; } - for ( gain_idx = 0; gain_idx < pState->nr_of_branches; gain_idx++ ) + for ( gain_idx = 0; gain_idx < hReverb->nr_of_branches; gain_idx++ ) { - pState->gain_matrix[branch][gain_idx] = pGain[gain_idx]; + hReverb->gain_matrix[branch][gain_idx] = pGain[gain_idx]; } return IVAS_ERR_OK; @@ -637,7 +795,7 @@ static ivas_error set_feedback_gain( *-----------------------------------------------------------------------------------------*/ static ivas_error set_correl_fft_filter( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t channel, rv_fftwf_type_complex *pSpectrum ) { @@ -648,11 +806,11 @@ static ivas_error set_correl_fft_filter( if ( channel == 0 ) { - ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, pState->fft_filter_correl_0.fft_spectrum, pState->fft_filter_correl_0.fft_size ); + ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, hReverb->fft_filter_correl_0.fft_spectrum, hReverb->fft_filter_correl_0.fft_size ); } else { - ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, pState->fft_filter_correl_1.fft_spectrum, pState->fft_filter_correl_1.fft_size ); + ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, hReverb->fft_filter_correl_1.fft_spectrum, hReverb->fft_filter_correl_1.fft_size ); } return IVAS_ERR_OK; @@ -666,7 +824,7 @@ static ivas_error set_correl_fft_filter( *-----------------------------------------------------------------------------------------*/ static ivas_error set_color_fft_filter( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t channel, rv_fftwf_type_complex *pSpectrum ) { @@ -677,11 +835,11 @@ static ivas_error set_color_fft_filter( if ( channel == 0 ) { - ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, pState->fft_filter_color_0.fft_spectrum, pState->fft_filter_color_0.fft_size ); + ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, hReverb->fft_filter_color_0.fft_spectrum, hReverb->fft_filter_color_0.fft_size ); } else { - ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, pState->fft_filter_color_1.fft_spectrum, pState->fft_filter_color_1.fft_size ); + ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( pSpectrum, hReverb->fft_filter_color_1.fft_spectrum, hReverb->fft_filter_color_1.fft_size ); } return IVAS_ERR_OK; @@ -695,7 +853,7 @@ static ivas_error set_color_fft_filter( *-----------------------------------------------------------------------------------------*/ static ivas_error set_mixer_level( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const uint16_t channel, const float level[] ) { @@ -705,9 +863,9 @@ static ivas_error set_mixer_level( return IVAS_ERR_INTERNAL; } - for ( branch_idx = 0; branch_idx < pState->nr_of_branches; branch_idx++ ) + for ( branch_idx = 0; branch_idx < hReverb->nr_of_branches; branch_idx++ ) { - pState->mixer[channel][branch_idx] = level[branch_idx]; + hReverb->mixer[channel][branch_idx] = level[branch_idx]; } return IVAS_ERR_OK; @@ -721,7 +879,7 @@ static ivas_error set_mixer_level( *-----------------------------------------------------------------------------------------*/ static void clear_buffers( - REVERB_HANDLE pState ) + REVERB_HANDLE hReverb ) { int16_t branch_idx; ivas_rev_iir_filter_t *iirFilter; @@ -729,15 +887,15 @@ static void clear_buffers( for ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) { - delay_line = &( pState->delay_line[branch_idx] ); + delay_line = &( hReverb->delay_line[branch_idx] ); set_f( delay_line->pBuffer, 0, delay_line->MaxDelay ); delay_line->BufferPos = 0; - iirFilter = &( pState->t60[branch_idx] ); + iirFilter = &( hReverb->t60[branch_idx] ); set_f( iirFilter->pBuffer, 0, iirFilter->MaxTaps ); } - ivas_reverb_t2f_f2t_ClearHistory( &pState->fft_filter_ols ); + ivas_reverb_t2f_f2t_ClearHistory( &hReverb->fft_filter_ols ); return; } @@ -750,31 +908,31 @@ static void clear_buffers( *-----------------------------------------------------------------------------------------*/ static void set_fft_and_datablock_sizes( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, const int16_t subframe_len ) { - pState->full_block_size = subframe_len; + hReverb->full_block_size = subframe_len; if ( subframe_len == L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES ) { - pState->fft_size = IVAS_REVERB_FFT_SIZE_48K; - pState->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_48K; + hReverb->fft_size = IVAS_REVERB_FFT_SIZE_48K; + hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_48K; } else if ( subframe_len == L_FRAME32k / MAX_PARAM_SPATIAL_SUBFRAMES ) { - pState->fft_size = IVAS_REVERB_FFT_SIZE_32K; - pState->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_32K; + hReverb->fft_size = IVAS_REVERB_FFT_SIZE_32K; + hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_32K; } else if ( subframe_len == L_FRAME16k / MAX_PARAM_SPATIAL_SUBFRAMES ) { - pState->fft_size = IVAS_REVERB_FFT_SIZE_16K; - pState->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_16K; + hReverb->fft_size = IVAS_REVERB_FFT_SIZE_16K; + hReverb->num_fft_subblocks = IVAS_REVERB_FFT_N_SUBBLOCKS_16K; } else { assert( 0 ); /* unsupported block size */ } - pState->fft_subblock_size = subframe_len / pState->num_fft_subblocks; + hReverb->fft_subblock_size = subframe_len / hReverb->num_fft_subblocks; return; } @@ -872,7 +1030,7 @@ static void set_reverb_acoustic_data( *-----------------------------------------------------------------------------------------*/ static ivas_error setup_FDN_branches( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, ivas_reverb_params_t *pParams ) { int16_t nr_coefs, branch_idx, channel_idx; @@ -883,12 +1041,12 @@ static ivas_error setup_FDN_branches( /* initialize feedback branches */ for ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) { - ivas_rev_delay_line_init( &( pState->delay_line[branch_idx] ), pState->loop_delay_buffer[branch_idx], init_loop_delay[branch_idx], pParams->pLoop_delays[branch_idx] ); - ivas_reverb_iir_filt_init( &( pState->t60[branch_idx] ), IVAS_REV_MAX_IIR_FILTER_LENGTH ); - pState->mixer[0][branch_idx] = 0.0f; - pState->mixer[1][branch_idx] = 0.0f; + ivas_rev_delay_line_init( &( hReverb->delay_line[branch_idx] ), hReverb->loop_delay_buffer[branch_idx], init_loop_delay[branch_idx], pParams->pLoop_delays[branch_idx] ); + ivas_reverb_iir_filt_init( &( hReverb->t60[branch_idx] ), IVAS_REV_MAX_IIR_FILTER_LENGTH ); + hReverb->mixer[0][branch_idx] = 0.0f; + hReverb->mixer[1][branch_idx] = 0.0f; } - clear_buffers( pState ); + clear_buffers( hReverb ); nr_coefs = pParams->t60_filter_order + 1; if ( IVAS_REV_MAX_IIR_FILTER_LENGTH < nr_coefs ) @@ -902,17 +1060,17 @@ static ivas_error setup_FDN_branches( pCoef_a = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx + nr_coefs]; pCoef_b = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx]; - if ( ( error = set_t60_filter( pState, branch_idx, nr_coefs, pCoef_a, pCoef_b ) ) != IVAS_ERR_OK ) + if ( ( error = set_t60_filter( hReverb, branch_idx, nr_coefs, pCoef_a, pCoef_b ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = set_feedback_delay( pState, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) + if ( ( error = set_feedback_delay( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = set_feedback_gain( pState, branch_idx, &( pParams->pLoop_feedback_matrix[branch_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) + if ( ( error = set_feedback_gain( hReverb, branch_idx, &( pParams->pLoop_feedback_matrix[branch_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) { return error; } @@ -921,7 +1079,7 @@ static ivas_error setup_FDN_branches( for ( channel_idx = 0; channel_idx < pParams->nr_outputs; channel_idx++ ) { - if ( ( error = set_mixer_level( pState, channel_idx, &( pParams->pLoop_extract_matrix[channel_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) + if ( ( error = set_mixer_level( hReverb, channel_idx, &( pParams->pLoop_extract_matrix[channel_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) { return error; } @@ -1017,6 +1175,15 @@ ivas_error ivas_reverb_open( /* set up reverb acoustic data on the basis of HRTF data and renderer config */ set_reverb_acoustic_data( ¶ms, input_audio_config, hHrtf, &hRenderConfig->roomAcoustics, subframe_len, nr_fc_input, nr_fc_fft_filter ); + /* set reverb acoustic configuration based on renderer config */ +#ifdef DEBUGGING + pState->pConfig.renderer_type_override = hRenderConfig->renderer_type_override; +#endif + pState->pConfig.roomAcoustics.override = hRenderConfig->roomAcoustics.override; + pState->pConfig.roomAcoustics.use_brir = hRenderConfig->roomAcoustics.use_brir; + pState->pConfig.roomAcoustics.late_reverb_on = hRenderConfig->roomAcoustics.late_reverb_on; + pState->pConfig.roomAcoustics.nBands = hRenderConfig->roomAcoustics.nBands; + /* set up input downmix */ pState->dmx_gain = calc_dmx_gain(); @@ -1143,27 +1310,27 @@ void ivas_reverb_close( *-----------------------------------------------------------------------------------------*/ static void post_fft_filter( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, float *p0, float *p1, float *pBuffer_0, float *pBuffer_1 ) { - if ( pState->do_corr_filter ) + if ( hReverb->do_corr_filter ) { - ivas_reverb_t2f_f2t_in( &pState->fft_filter_ols, p0, p1, pBuffer_0, pBuffer_1 ); - ivas_reverb_fft_filter_ComplexMul( &pState->fft_filter_correl_0, pBuffer_0 ); - ivas_reverb_fft_filter_ComplexMul( &pState->fft_filter_correl_1, pBuffer_1 ); - ivas_reverb_fft_filter_CrossMix( pBuffer_0, pBuffer_1, pState->fft_filter_correl_0.fft_size ); + ivas_reverb_t2f_f2t_in( &hReverb->fft_filter_ols, p0, p1, pBuffer_0, pBuffer_1 ); + ivas_reverb_fft_filter_ComplexMul( &hReverb->fft_filter_correl_0, pBuffer_0 ); + ivas_reverb_fft_filter_ComplexMul( &hReverb->fft_filter_correl_1, pBuffer_1 ); + ivas_reverb_fft_filter_CrossMix( pBuffer_0, pBuffer_1, hReverb->fft_filter_correl_0.fft_size ); } else { - ivas_reverb_t2f_f2t_in( &pState->fft_filter_ols, p0, p1, pBuffer_0, pBuffer_1 ); + ivas_reverb_t2f_f2t_in( &hReverb->fft_filter_ols, p0, p1, pBuffer_0, pBuffer_1 ); } - ivas_reverb_fft_filter_ComplexMul( &pState->fft_filter_color_0, pBuffer_0 ); - ivas_reverb_fft_filter_ComplexMul( &pState->fft_filter_color_1, pBuffer_1 ); - ivas_reverb_t2f_f2t_out( &pState->fft_filter_ols, pBuffer_0, pBuffer_1, p0, p1 ); + ivas_reverb_fft_filter_ComplexMul( &hReverb->fft_filter_color_0, pBuffer_0 ); + ivas_reverb_fft_filter_ComplexMul( &hReverb->fft_filter_color_1, pBuffer_1 ); + ivas_reverb_t2f_f2t_out( &hReverb->fft_filter_ols, pBuffer_0, pBuffer_1, p0, p1 ); return; } @@ -1176,14 +1343,14 @@ static void post_fft_filter( *-----------------------------------------------------------------------------------------*/ static void reverb_block( - REVERB_HANDLE pState, + REVERB_HANDLE hReverb, float *pInput, float *pOut0, float *pOut1 ) { - uint16_t nr_branches = pState->nr_of_branches; - uint16_t bsize = pState->full_block_size; + uint16_t nr_branches = hReverb->nr_of_branches; + uint16_t bsize = hReverb->full_block_size; uint16_t inner_bsize = INNER_BLK_SIZE; uint16_t i, j, k, ns, branch_idx, blk_idx, start_sample_idx; @@ -1215,12 +1382,12 @@ static void reverb_block( for ( i = 0; i < nr_branches; i++ ) { float *pOutput_i = &ppOutput[i][0]; - float mixer_0_i = pState->mixer[0][i]; - float mixer_1_i = pState->mixer[1][i]; + float mixer_0_i = hReverb->mixer[0][i]; + float mixer_1_i = hReverb->mixer[1][i]; /* output and feedback are same, get sample from delay line ... */ - ivas_rev_delay_line_get_sample_blk( &( pState->delay_line[i] ), inner_bsize, pTemp ); - ivas_reverb_iir_filt_2taps_feed_blk( &( pState->t60[i] ), inner_bsize, pTemp, ppOutput[i] ); + ivas_rev_delay_line_get_sample_blk( &( hReverb->delay_line[i] ), inner_bsize, pTemp ); + ivas_reverb_iir_filt_2taps_feed_blk( &( hReverb->t60[i] ), inner_bsize, pTemp, ppOutput[i] ); for ( ns = 0; ns < inner_bsize; ns++ ) { pO0[ns] += pOutput_i[ns] * mixer_0_i; /* mixer ch 0 */ @@ -1239,7 +1406,7 @@ static void reverb_block( for ( j = 0; j < nr_branches; j++ ) { - float gain_matrix_j_i = pState->gain_matrix[j][i]; + float gain_matrix_j_i = hReverb->gain_matrix[j][i]; float *pOutput = &ppOutput[j][0]; for ( ns = 0; ns < inner_bsize; ns++ ) { @@ -1247,15 +1414,15 @@ static void reverb_block( } } - ivas_rev_delay_line_feed_sample_blk( &( pState->delay_line[i] ), inner_bsize, pFeedback_input ); + ivas_rev_delay_line_feed_sample_blk( &( hReverb->delay_line[i] ), inner_bsize, pFeedback_input ); } } /* Applying FFT filter to each sub-frame */ - for ( blk_idx = 0; blk_idx < pState->num_fft_subblocks; blk_idx++ ) + for ( blk_idx = 0; blk_idx < hReverb->num_fft_subblocks; blk_idx++ ) { - start_sample_idx = blk_idx * pState->fft_subblock_size; - post_fft_filter( pState, pOut0 + start_sample_idx, pOut1 + start_sample_idx, pFFT_buf[0], pFFT_buf[1] ); + start_sample_idx = blk_idx * hReverb->fft_subblock_size; + post_fft_filter( hReverb, pOut0 + start_sample_idx, pOut1 + start_sample_idx, pFFT_buf[0], pFFT_buf[1] ); } return; @@ -1269,14 +1436,18 @@ static void reverb_block( *-----------------------------------------------------------------------------------------*/ static ivas_error downmix_input_block( - REVERB_HANDLE pState, + const REVERB_HANDLE hReverb, +#ifdef JBM_TSM_ON_TCS + float *pcm_in[], +#else float pcm_in[][L_FRAME48k], +#endif const AUDIO_CONFIG input_audio_config, float *pPcm_out, const int16_t input_offset ) { int16_t i, s, nchan_transport; - float dmx_gain = pState->dmx_gain; + float dmx_gain = hReverb->dmx_gain; switch ( input_audio_config ) { @@ -1292,7 +1463,7 @@ static ivas_error downmix_input_block( case AUDIO_CONFIG_ISM4: { nchan_transport = audioCfg2channels( input_audio_config ); - for ( s = 0; s < pState->full_block_size; s++ ) + for ( s = 0; s < hReverb->full_block_size; s++ ) { float temp = pcm_in[0][input_offset + s]; for ( i = 1; i < nchan_transport; i++ ) @@ -1308,7 +1479,7 @@ static ivas_error downmix_input_block( case AUDIO_CONFIG_HOA2: case AUDIO_CONFIG_HOA3: { - for ( s = 0; s < pState->full_block_size; s++ ) + for ( s = 0; s < hReverb->full_block_size; s++ ) { pPcm_out[s] = dmx_gain * pcm_in[0][input_offset + s]; } @@ -1330,35 +1501,35 @@ static ivas_error downmix_input_block( *-----------------------------------------------------------------------------------------*/ static void predelay_block( - REVERB_HANDLE pState, + const REVERB_HANDLE hReverb, float *pInput, float *pOutput ) { uint16_t i, idx, n_samples, blk_size; - uint16_t max_blk_size = (uint16_t) pState->predelay_line.Delay; + uint16_t max_blk_size = (uint16_t) hReverb->predelay_line.Delay; if ( max_blk_size < 2 ) { if ( max_blk_size == 0 ) /* zero-length delay line: just copy the data from input to output */ { - for ( i = 0; i < pState->full_block_size; i++ ) + for ( i = 0; i < hReverb->full_block_size; i++ ) { pOutput[i] = pInput[i]; } } else /* 1-sample length delay line: feed the data sample-by-sample */ { - for ( i = 0; i < pState->full_block_size; i++ ) + for ( i = 0; i < hReverb->full_block_size; i++ ) { - pOutput[i] = ivas_rev_delay_line_get_sample( &( pState->predelay_line ) ); - ivas_rev_delay_line_feed_sample( &( pState->predelay_line ), pInput[i] ); + pOutput[i] = ivas_rev_delay_line_get_sample( &( hReverb->predelay_line ) ); + ivas_rev_delay_line_feed_sample( &( hReverb->predelay_line ), pInput[i] ); } } } else /* multiple-sample length delay line: use block processing */ { idx = 0; - n_samples = pState->full_block_size; + n_samples = hReverb->full_block_size; while ( n_samples > 0 ) { blk_size = n_samples; @@ -1366,8 +1537,8 @@ static void predelay_block( { blk_size = max_blk_size; } - ivas_rev_delay_line_get_sample_blk( &( pState->predelay_line ), blk_size, &pOutput[idx] ); - ivas_rev_delay_line_feed_sample_blk( &( pState->predelay_line ), blk_size, &pInput[idx] ); + ivas_rev_delay_line_get_sample_blk( &( hReverb->predelay_line ), blk_size, &pOutput[idx] ); + ivas_rev_delay_line_feed_sample_blk( &( hReverb->predelay_line ), blk_size, &pInput[idx] ); idx += blk_size; n_samples -= blk_size; } @@ -1384,7 +1555,7 @@ static void predelay_block( *-----------------------------------------------------------------------------------------*/ static void mix_output_block( - REVERB_HANDLE pState, + const REVERB_HANDLE hReverb, const float *pInL, const float *pInR, float *pOutL, @@ -1392,7 +1563,7 @@ static void mix_output_block( { uint16_t i; - for ( i = 0; i < pState->full_block_size; i++ ) + for ( i = 0; i < hReverb->full_block_size; i++ ) { pOutL[i] += pInL[i]; pOutR[i] += pInR[i]; @@ -1409,12 +1580,18 @@ static void mix_output_block( *-----------------------------------------------------------------------------------------*/ ivas_error ivas_reverb_process( - REVERB_HANDLE hReverb, /* i/o: reverb state */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const int16_t mix_signals, /* i : add reverb to output signal */ - float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ - float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ - const int16_t i_ts ) +#ifdef JBM_TSM_ON_TCS + float *pcm_in[], /* i : the PCM audio to apply reverb on */ + float *pcm_out[], /* o : the PCM audio with reverb applied */ +#else + float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ + float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ +#endif + const int16_t i_ts /* i : subframe index */ +) { float tmp0[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp1[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp2[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; ivas_error error; @@ -1440,3 +1617,628 @@ ivas_error ivas_reverb_process( return IVAS_ERR_OK; } + + +/*------------------------------------------------------------------------- + * ivas_binaural_reverb_processFrame() + * + * Compute the reverberation - room effect + *------------------------------------------------------------------------*/ + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +void ivas_binaural_reverb_processSubframe( + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t numInChannels, /* i : num inputs to be processed */ +#ifdef JBM_TSM_ON_TCS + const int16_t numSlots, /* i : number of slots to be processed */ +#endif + float inReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ + float inImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ + float outReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ + float outImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* o : output CLDFB data imag */ +) +#else +void ivas_binaural_reverb_processFrame( + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t numInChannels, /* i : num inputs to be processed */ + float inReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ + float inImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ + float outReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ + float outImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data imag */ + const uint8_t offsetSamplesIO /* i : number of offset samples */ +) +#endif +{ + /* Declare the required variables */ + int16_t idx, bin, ch, sample, invertSampleIndex, tapIdx, *phaseShiftTypePr; + float **tapRealPr, **tapImagPr; + push_wmops( "binaural_reverb" ); + + /* 1) Rotate the data in the loop buffer of the reverberator. + * Notice that the audio at the loop buffers is at time-inverted order + * for convolution purposes later on. */ + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { +#ifdef JBM_TSM_ON_TCS + /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ + mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + numSlots, hReverb->loopBufLength[bin] ); + mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + numSlots, hReverb->loopBufLength[bin] ); + + /* Add the data from the end of the loop to the beginning, with an attenuation factor + * according to RT60. This procedure generates an IIR decaying response. The response + * is decorrelated later on. */ + v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], numSlots ); + v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], numSlots ); +#else + /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ + mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); + mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); + + /* Add the data from the end of the loop to the beginning, with an attenuation factor + * according to RT60. This procedure generates an IIR decaying response. The response + * is decorrelated later on. */ + v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], hReverb->blockSize ); + v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], hReverb->blockSize ); +#endif + } + + /* 2) Apply the determined pre-delay to the input audio, and add the delayed audio to the loop. */ + idx = hReverb->preDelayBufferIndex; +#ifdef JBM_TSM_ON_TCS + for ( sample = 0; sample < numSlots; sample++ ) +#else + for ( sample = 0; sample < hReverb->blockSize; sample++ ) +#endif + { +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS + uint16_t sampleWithOffset; + sampleWithOffset = sample + offsetSamplesIO; +#endif +#ifdef JBM_TSM_ON_TCS + invertSampleIndex = numSlots - sample - 1; +#else + invertSampleIndex = hReverb->blockSize - sample - 1; +#endif + + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + /* Add from pre-delay buffer a sample to the loop buffer, in a time-inverted order. + * Also apply the spectral gains determined for the reverberation */ + hReverb->loopBufReal[bin][invertSampleIndex] += hReverb->preDelayBufferReal[idx][bin] * hReverb->reverbEqGains[bin]; + hReverb->loopBufImag[bin][invertSampleIndex] += hReverb->preDelayBufferImag[idx][bin] * hReverb->reverbEqGains[bin]; + hReverb->preDelayBufferReal[idx][bin] = 0.0f; + hReverb->preDelayBufferImag[idx][bin] = 0.0f; + } + + /* Add every second input channel as is to the pre-delay buffer, and every second input channel with + * 90 degrees phase shift to reduce energy imbalances between coherent and incoherent sounds */ +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + for ( ch = 0; ch < numInChannels; ch++ ) + { + if ( ch % 2 ) + { + v_add( hReverb->preDelayBufferReal[idx], inReal[ch][sample], hReverb->preDelayBufferReal[idx], hReverb->numBins ); + v_add( hReverb->preDelayBufferImag[idx], inImag[ch][sample], hReverb->preDelayBufferImag[idx], hReverb->numBins ); + } + else + { + v_sub( hReverb->preDelayBufferReal[idx], inImag[ch][sample], hReverb->preDelayBufferReal[idx], hReverb->numBins ); + v_add( hReverb->preDelayBufferImag[idx], inReal[ch][sample], hReverb->preDelayBufferImag[idx], hReverb->numBins ); + } + } + idx = ( idx + 1 ) % hReverb->preDelayBufferLength; + } +#else + for ( ch = 0; ch < numInChannels; ch++ ) + { + if ( ch % 2 ) + { + v_add( hReverb->preDelayBufferReal[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); + v_add( hReverb->preDelayBufferImag[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); + } + else + { + v_sub( hReverb->preDelayBufferReal[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); + v_add( hReverb->preDelayBufferImag[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); + } + } + idx = ( idx + 1 ) % hReverb->preDelayBufferLength; + } +#endif + hReverb->preDelayBufferIndex = idx; + + /* 3) Perform the filtering/decorrelating, using complex and sparse FIR filtering */ + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + /* These tap pointers have been determined to point to the loop buffer at sparse locations */ + tapRealPr = hReverb->tapPointersReal[bin][ch]; + tapImagPr = hReverb->tapPointersImag[bin][ch]; + + phaseShiftTypePr = hReverb->tapPhaseShiftType[bin][ch]; + + /* Flush output */ +#ifdef JBM_TSM_ON_TCS + set_f( hReverb->outputBufferReal[bin][ch], 0.0f, numSlots ); + set_f( hReverb->outputBufferImag[bin][ch], 0.0f, numSlots ); +#else + set_f( hReverb->outputBufferReal[bin][ch], 0.0f, hReverb->blockSize ); + set_f( hReverb->outputBufferImag[bin][ch], 0.0f, hReverb->blockSize ); +#endif + + /* Add from temporally decaying sparse tap locations the audio to the output. */ + for ( tapIdx = 0; tapIdx < hReverb->taps[bin][ch]; tapIdx++ ) + { + switch ( phaseShiftTypePr[tapIdx] ) + { +#ifdef JBM_TSM_ON_TCS + case 0: /* 0 degrees phase */ + v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], numSlots ); + v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], numSlots ); + break; + case 1: /* 90 degrees phase */ + v_sub( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], numSlots ); + v_add( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], numSlots ); + break; + case 2: /* 180 degrees phase */ + v_sub( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], numSlots ); + v_sub( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], numSlots ); + break; + default: /* 270 degrees phase */ + v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], numSlots ); + v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], numSlots ); + break; +#else + case 0: /* 0 degrees phase */ + v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + case 1: /* 90 degrees phase */ + v_sub( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_add( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + case 2: /* 180 degrees phase */ + v_sub( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_sub( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + default: /* 270 degrees phase */ + v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; +#endif + } + } + } + + /* Generate diffuse field binaural coherence by mixing the incoherent reverberated channels with pre-defined gains */ + if ( bin <= hReverb->highestBinauralCoherenceBin ) + { + if ( hReverb->useBinauralCoherence ) + { +#ifdef JBM_TSM_ON_TCS + for ( sample = 0; sample < numSlots; sample++ ) +#else + for ( sample = 0; sample < hReverb->blockSize; sample++ ) +#endif + { + float leftRe, rightRe, leftIm, rightIm; + + leftRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][1][sample]; + rightRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][0][sample]; + leftIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][1][sample]; + rightIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][0][sample]; + + hReverb->outputBufferReal[bin][0][sample] = leftRe; + hReverb->outputBufferReal[bin][1][sample] = rightRe; + hReverb->outputBufferImag[bin][0][sample] = leftIm; + hReverb->outputBufferImag[bin][1][sample] = rightIm; + } + } + } + } + + /* 4) Write data to output */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { +#ifdef JBM_TSM_ON_TCS + for ( sample = 0; sample < numSlots; sample++ ) +#else + for ( sample = 0; sample < hReverb->blockSize; sample++ ) +#endif + { +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS + uint16_t sampleWithOffset; + + sampleWithOffset = sample + offsetSamplesIO; +#endif +/* Audio was in the temporally inverted order for convolution, re-invert audio to output */ +#ifdef JBM_TSM_ON_TCS + invertSampleIndex = numSlots - sample - 1; +#else + invertSampleIndex = hReverb->blockSize - sample - 1; +#endif + +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + outReal[ch][sample][bin] = hReverb->outputBufferReal[bin][ch][invertSampleIndex]; + outImag[ch][sample][bin] = hReverb->outputBufferImag[bin][ch][invertSampleIndex]; + } + for ( ; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + { + outReal[ch][sample][bin] = 0.0f; + outImag[ch][sample][bin] = 0.0f; + } +#else + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + outReal[ch][sampleWithOffset][bin] = hReverb->outputBufferReal[bin][ch][invertSampleIndex]; + outImag[ch][sampleWithOffset][bin] = hReverb->outputBufferImag[bin][ch][invertSampleIndex]; + } + for ( ; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + { + outReal[ch][sampleWithOffset][bin] = 0.0f; + outImag[ch][sampleWithOffset][bin] = 0.0f; + } +#endif + } + } + + pop_wmops(); + return; +} + +#ifdef JBM_TSM_ON_TCS +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS +/*------------------------------------------------------------------------- + * ivas_binaural_reverb_processSlot() + * + * Compute the reverberation - room effect + *------------------------------------------------------------------------*/ + +void ivas_binaural_reverb_processSlot( + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t numInChannels, /* i : num inputs to be processed */ + float inReal[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ + float inImag[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ + float outReal[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ + float outImag[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data imag */ + const uint8_t offsetSamplesIO /* i : number of offset samples */ +) +{ + /* Declare the required variables */ + int16_t idx, bin, ch, sample, invertSampleIndex, tapIdx, *phaseShiftTypePr; + float **tapRealPr, **tapImagPr; + +#ifdef DEBUGGING + assert( hReverb->blockSize == 1 ); +#endif + + push_wmops( "binaural_reverb" ); + /* 1) Rotate the data in the loop buffer of the reverberator. + * Notice that the audio at the loop buffers is at time-inverted order + * for convolution purposes later on. */ + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ + mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); + mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); + + /* Add the data from the end of the loop to the beginning, with an attenuation factor + * according to RT60. This procedure generates an IIR decaying response. The response + * is decorrelated later on. */ + v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], hReverb->blockSize ); + v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], hReverb->blockSize ); + } + + /* 2) Apply the determined pre-delay to the input audio, and add the delayed audio to the loop. */ + idx = hReverb->preDelayBufferIndex; + for ( sample = 0; sample < hReverb->blockSize; sample++ ) + { + uint16_t sampleWithOffset; + sampleWithOffset = sample + offsetSamplesIO; + invertSampleIndex = hReverb->blockSize - sample - 1; + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + /* Add from pre-delay buffer a sample to the loop buffer, in a time-inverted order. + * Also apply the spectral gains determined for the reverberation */ + hReverb->loopBufReal[bin][invertSampleIndex] += hReverb->preDelayBufferReal[idx][bin] * hReverb->reverbEqGains[bin]; + hReverb->loopBufImag[bin][invertSampleIndex] += hReverb->preDelayBufferImag[idx][bin] * hReverb->reverbEqGains[bin]; + hReverb->preDelayBufferReal[idx][bin] = 0.0f; + hReverb->preDelayBufferImag[idx][bin] = 0.0f; + } + + /* Add every second input channel as is to the pre-delay buffer, and every second input channel with + * 90 degrees phase shift to reduce energy imbalances between coherent and incoherent sounds */ + for ( ch = 0; ch < numInChannels; ch++ ) + { + if ( ch % 2 ) + { + v_add( hReverb->preDelayBufferReal[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); + v_add( hReverb->preDelayBufferImag[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); + } + else + { + v_sub( hReverb->preDelayBufferReal[idx], inImag[ch][sampleWithOffset], hReverb->preDelayBufferReal[idx], hReverb->numBins ); + v_add( hReverb->preDelayBufferImag[idx], inReal[ch][sampleWithOffset], hReverb->preDelayBufferImag[idx], hReverb->numBins ); + } + } + idx = ( idx + 1 ) % hReverb->preDelayBufferLength; + } + hReverb->preDelayBufferIndex = idx; + + /* 3) Perform the filtering/decorrelating, using complex and sparse FIR filtering */ + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + /* These tap pointers have been determined to point to the loop buffer at sparse locations */ + tapRealPr = hReverb->tapPointersReal[bin][ch]; + tapImagPr = hReverb->tapPointersImag[bin][ch]; + phaseShiftTypePr = hReverb->tapPhaseShiftType[bin][ch]; + + /* Flush output */ + set_f( hReverb->outputBufferReal[bin][ch], 0.0f, hReverb->blockSize ); + set_f( hReverb->outputBufferImag[bin][ch], 0.0f, hReverb->blockSize ); + + /* Add from temporally decaying sparse tap locations the audio to the output. */ + for ( tapIdx = 0; tapIdx < hReverb->taps[bin][ch]; tapIdx++ ) + { + switch ( phaseShiftTypePr[tapIdx] ) + { + case 0: /* 0 degrees phase */ + v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + case 1: /* 90 degrees phase */ + v_sub( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_add( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + case 2: /* 180 degrees phase */ + v_sub( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_sub( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + default: /* 270 degrees phase */ + v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); + v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); + break; + } + } + } + + /* Generate diffuse field binaural coherence by mixing the incoherent reverberated channels with pre-defined gains */ + if ( bin <= hReverb->highestBinauralCoherenceBin ) + { + if ( hReverb->useBinauralCoherence ) + { + for ( sample = 0; sample < hReverb->blockSize; sample++ ) + { + float leftRe, rightRe, leftIm, rightIm; + + leftRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][1][sample]; + rightRe = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferReal[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferReal[bin][0][sample]; + leftIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][0][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][1][sample]; + rightIm = hReverb->binauralCoherenceDirectGains[bin] * hReverb->outputBufferImag[bin][1][sample] + hReverb->binauralCoherenceCrossmixGains[bin] * hReverb->outputBufferImag[bin][0][sample]; + + hReverb->outputBufferReal[bin][0][sample] = leftRe; + hReverb->outputBufferReal[bin][1][sample] = rightRe; + hReverb->outputBufferImag[bin][0][sample] = leftIm; + hReverb->outputBufferImag[bin][1][sample] = rightIm; + } + } + } + } + + /* 4) Write data to output */ + for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) + { + for ( sample = 0; sample < hReverb->blockSize; sample++ ) + { + uint16_t sampleWithOffset; + + sampleWithOffset = sample + offsetSamplesIO; + /* Audio was in the temporally inverted order for convolution, re-invert audio to output */ + invertSampleIndex = hReverb->blockSize - sample - 1; + + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + outReal[ch][sampleWithOffset][bin] = hReverb->outputBufferReal[bin][ch][invertSampleIndex]; + outImag[ch][sampleWithOffset][bin] = hReverb->outputBufferImag[bin][ch][invertSampleIndex]; + } + for ( ; bin < CLDFB_NO_CHANNELS_MAX; bin++ ) + { + outReal[ch][sampleWithOffset][bin] = 0.0f; + outImag[ch][sampleWithOffset][bin] = 0.0f; + } + } + } + + pop_wmops(); + return; +} +#endif +#endif + +/*------------------------------------------------------------------------- + * ivas_binaural_reverb_open() + * + * Allocate and initialize binaural room reverberator handle + *------------------------------------------------------------------------*/ + +ivas_error ivas_binaural_reverb_open( + REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ + const int16_t numBins, /* i : number of CLDFB bins */ + const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ + ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ + const AUDIO_CONFIG output_config, /* i : output audio configuration */ + const int32_t sampling_rate, /* i : sampling rate */ + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const HRTFS_FASTCONV_HANDLE hHrtfFastConv, /* i : FastConv HRTF handle */ + const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ +) +{ + int16_t bin, chIdx, k, len; + REVERB_STRUCT_HANDLE hReverb; + const float *revTimes; + float t60[CLDFB_NO_CHANNELS_MAX]; + float ene[CLDFB_NO_CHANNELS_MAX]; + + if ( ( *hReverbPr = (REVERB_STRUCT_HANDLE) malloc( sizeof( REVERB_STRUCT ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + hReverb = *hReverbPr; + + hReverb->useBinauralCoherence = 1; + hReverb->preDelayBufferLength = 1; + hReverb->preDelayBufferIndex = 0; + + hReverb->numBins = numBins; + hReverb->blockSize = numCldfbSlotsPerFrame; + + for ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) + { + set_f( hReverb->preDelayBufferReal[k], 0.0f, hReverb->numBins ); + set_f( hReverb->preDelayBufferImag[k], 0.0f, hReverb->numBins ); + } + + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + if ( !roomAcoustics->override ) + { + revTimes = hHrtfFastConv->fastconvReverberationTimes; + } + else + { + revTimes = t60; + } + } + else + { + revTimes = hHrtfParambin->parametricReverberationTimes; + } + + for ( bin = 0; bin < hReverb->numBins; bin++ ) + { + /* Loop Buffer */ + hReverb->loopBufLengthMax[bin] = (int16_t) ( 500 / ( 1 + bin ) + ( CLDFB_NO_CHANNELS_MAX - bin ) ); + + len = hReverb->loopBufLengthMax[bin] + hReverb->blockSize; + if ( ( hReverb->loopBufReal[bin] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + if ( ( hReverb->loopBufImag[bin] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + set_f( hReverb->loopBufReal[bin], 0.0f, len ); + set_f( hReverb->loopBufImag[bin], 0.0f, len ); + + /* Determine loop buffer length. The following formula is manually tuned to generate sufficiently long + * but not excessively long loops to generate reverberation. */ + /* Note: the resulted length is very sensitive to the precision of the constants below (e.g. 1.45 vs. 1.45f) */ + hReverb->loopBufLength[bin] = (int16_t) ( 1.45 * (int16_t) ( revTimes[bin] * 150.0 ) + 1 ); + hReverb->loopBufLength[bin] = min( hReverb->loopBufLength[bin], hReverb->loopBufLengthMax[bin] ); + + /* Sparse Filter Tap Locations */ + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + len = hReverb->loopBufLength[bin]; + + if ( ( hReverb->tapPhaseShiftType[bin][chIdx] = (int16_t *) malloc( len * sizeof( int16_t ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + set_s( hReverb->tapPhaseShiftType[bin][chIdx], 0, len ); + + if ( ( hReverb->tapPointersReal[bin][chIdx] = (float **) malloc( len * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + if ( ( hReverb->tapPointersImag[bin][chIdx] = (float **) malloc( len * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + len = hReverb->blockSize; + if ( ( hReverb->outputBufferReal[bin][chIdx] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + if ( ( hReverb->outputBufferImag[bin][chIdx] = (float *) malloc( len * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural Reverberator\n" ) ); + } + + set_f( hReverb->outputBufferReal[bin][chIdx], 0.0f, len ); + set_f( hReverb->outputBufferImag[bin][chIdx], 0.0f, len ); + } + } + + + if ( ( roomAcoustics ) && ( roomAcoustics->override ) ) + { + ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, output_config, roomAcoustics->use_brir, sampling_rate, t60, ene ); + ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, t60, ene ); + ivas_binaural_reverb_setPreDelay( hReverb, (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ) ); + } + else + { + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfFastConv->fastconvReverberationTimes, hHrtfFastConv->fastconvReverberationEneCorrections ); + ivas_binaural_reverb_setPreDelay( hReverb, 10 ); + } + else + { + ivas_binaural_reverb_setReverbTimes( hReverb, sampling_rate, hHrtfParambin->parametricReverberationTimes, hHrtfParambin->parametricReverberationEneCorrections ); + ivas_binaural_reverb_setPreDelay( hReverb, 10 ); + } + } + return IVAS_ERR_OK; +} + + +/*------------------------------------------------------------------------- + * ivas_binaural_reverb_close() + * + * Close binaural room reverberator handle + *------------------------------------------------------------------------*/ + +void ivas_binaural_reverb_close( + REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ +) +{ + int16_t bin, chIdx; + + if ( hReverb == NULL || *hReverb == NULL ) + { + return; + } + + for ( bin = 0; bin < ( *hReverb )->numBins; bin++ ) + { + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + free( ( *hReverb )->tapPhaseShiftType[bin][chIdx] ); + free( ( *hReverb )->tapPointersReal[bin][chIdx] ); + free( ( *hReverb )->tapPointersImag[bin][chIdx] ); + free( ( *hReverb )->outputBufferReal[bin][chIdx] ); + free( ( *hReverb )->outputBufferImag[bin][chIdx] ); + } + free( ( *hReverb )->loopBufReal[bin] ); + free( ( *hReverb )->loopBufImag[bin] ); + } + + free( ( *hReverb ) ); + ( *hReverb ) = NULL; + + return; +} diff --git a/lib_rend/ivas_reverb_delay_line.c b/lib_rend/ivas_reverb_delay_line.c index ef0ca8b6c19792d6b705b9fa97db91c9bc51f39b..892a0d21c9854000fce1f913f16ff88ac3f3a7d8 100644 --- a/lib_rend/ivas_reverb_delay_line.c +++ b/lib_rend/ivas_reverb_delay_line.c @@ -33,6 +33,7 @@ #include #include "options.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "prot.h" #ifdef DEBUGGING #include "debug.h" diff --git a/lib_rend/ivas_reverb_fft_filter.c b/lib_rend/ivas_reverb_fft_filter.c index 2c6a77ec2bd80dcd12bd1e3fb9897ff72bebaa96..725f5e6bc14dc5a43eecb292e2e23745d85c2be5 100644 --- a/lib_rend/ivas_reverb_fft_filter.c +++ b/lib_rend/ivas_reverb_fft_filter.c @@ -32,12 +32,12 @@ #include #include "options.h" -#include "ivas_prot.h" +#include "prot.h" +#include "ivas_prot_rend.h" #ifdef DEBUGGING #include "debug.h" #endif #include -#include "prot.h" #include "wmc_auto.h" @@ -46,6 +46,7 @@ *------------------------------------------------------------------------------------------*/ static void fft_wrapper_2ch( float *buffer_L, float *buffer_R, const int16_t fft_size ); + static void ifft_wrapper_2ch( float *buffer_L, float *buffer_R, const int16_t fft_size ); diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c index 80044e3e653d960f239321c833c6248fb7fba4f2..3069d1248af05a5429d318a1b7ea331de1dd0131 100644 --- a/lib_rend/ivas_reverb_filter_design.c +++ b/lib_rend/ivas_reverb_filter_design.c @@ -32,14 +32,14 @@ #include #include "options.h" -#include "ivas_prot.h" +#include "prot.h" +#include "ivas_prot_rend.h" #ifdef DEBUGGING #include "debug.h" #endif #include #include #include -#include "prot.h" #include "wmc_auto.h" diff --git a/lib_rend/ivas_reverb_iir_filter.c b/lib_rend/ivas_reverb_iir_filter.c index db3534ee8aea722b87e4af35cfed7b22e52b0eb6..ce73c9d864ed12705a82e739e891aef31c558b30 100644 --- a/lib_rend/ivas_reverb_iir_filter.c +++ b/lib_rend/ivas_reverb_iir_filter.c @@ -32,12 +32,11 @@ #include #include "options.h" -#include "ivas_prot.h" #include "prot.h" +#include "ivas_prot_rend.h" #ifdef DEBUGGING #include "debug.h" #endif -#include #include "wmc_auto.h" diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 20a3e2ac47b215545141867d6563bdc1a9fe6d13..6ff101bec56d53d8b040a4504c027ec5b2e64250 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -33,8 +33,7 @@ #include #include "options.h" #include "prot.h" -#include "ivas_prot.h" -#include "ivas_rom_binauralRenderer.h" +#include "ivas_prot_rend.h" #include "ivas_rom_rend.h" #include #ifdef DEBUGGING @@ -69,11 +68,7 @@ typedef struct cldfb_convolver_state float filter_states_im[BINAURAL_CONVBANDS][CLDFB_CONVOLVER_NTAPS_MAX]; } cldfb_convolver_state; -#ifdef HRTF_BINARY_FILE static void ivas_reverb_get_fastconv_hrtf_set_energies( const HRTFS_FASTCONV_HANDLE hHrtfFastConv, const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t sampling_rate, float *avg_pwr_left, float *avg_pwr_right ); -#else -static void ivas_reverb_get_fastconv_hrtf_set_energies( const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t sampling_rate, float *avg_pwr_left, float *avg_pwr_right ); -#endif /*-----------------------------------------------------------------------------------------* @@ -84,9 +79,7 @@ static void ivas_reverb_get_fastconv_hrtf_set_energies( const AUDIO_CONFIG input void ivas_reverb_prepare_cldfb_params( ivas_roomAcoustics_t *pInput_params, -#ifdef HRTF_BINARY_FILE const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t output_Fs, @@ -121,11 +114,7 @@ void ivas_reverb_prepare_cldfb_params( pOutput_ene[idx] *= expf( exp_argument ); } -#ifdef HRTF_BINARY_FILE ivas_reverb_get_fastconv_hrtf_set_energies( hHrtfFastConv, input_audio_config, use_brir, output_Fs, avg_pwr_left, avg_pwr_right ); -#else - ivas_reverb_get_fastconv_hrtf_set_energies( input_audio_config, use_brir, output_Fs, avg_pwr_left, avg_pwr_right ); -#endif for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { @@ -209,9 +198,7 @@ static void ivas_cldfb_convolver( *-----------------------------------------------------------------------------------------*/ static void get_IR_from_filter_taps( -#ifdef HRTF_BINARY_FILE const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif const int16_t hrtf_idx, const AUDIO_CONFIG input_audio_config, const int16_t use_brir, @@ -242,17 +229,10 @@ static void get_IR_from_filter_taps( { for ( band_idx = 0; band_idx < BINAURAL_CONVBANDS; band_idx++ ) { -#ifdef HRTF_BINARY_FILE convolver_state.filter_taps_left_re[band_idx] = hHrtfFastConv->leftHRIRReal_HOA3[band_idx][hrtf_idx]; convolver_state.filter_taps_left_im[band_idx] = hHrtfFastConv->leftHRIRImag_HOA3[band_idx][hrtf_idx]; convolver_state.filter_taps_right_re[band_idx] = hHrtfFastConv->rightHRIRReal_HOA3[band_idx][hrtf_idx]; convolver_state.filter_taps_right_im[band_idx] = hHrtfFastConv->rightHRIRImag_HOA3[band_idx][hrtf_idx]; -#else - convolver_state.filter_taps_left_re[band_idx] = leftHRIRReal_HOA3[band_idx][hrtf_idx]; - convolver_state.filter_taps_left_im[band_idx] = leftHRIRImag_HOA3[band_idx][hrtf_idx]; - convolver_state.filter_taps_right_re[band_idx] = rightHRIRReal_HOA3[band_idx][hrtf_idx]; - convolver_state.filter_taps_right_im[band_idx] = rightHRIRImag_HOA3[band_idx][hrtf_idx]; -#endif } } else @@ -283,34 +263,20 @@ static void get_IR_from_filter_taps( { for ( band_idx = 0; band_idx < BINAURAL_CONVBANDS; band_idx++ ) { -#ifdef HRTF_BINARY_FILE convolver_state.filter_taps_left_re[band_idx] = hHrtfFastConv->leftBRIRReal[band_idx][array_idx]; convolver_state.filter_taps_left_im[band_idx] = hHrtfFastConv->leftBRIRImag[band_idx][array_idx]; convolver_state.filter_taps_right_re[band_idx] = hHrtfFastConv->rightBRIRReal[band_idx][array_idx]; convolver_state.filter_taps_right_im[band_idx] = hHrtfFastConv->rightBRIRImag[band_idx][array_idx]; -#else - convolver_state.filter_taps_left_re[band_idx] = leftBRIRReal[band_idx][array_idx]; - convolver_state.filter_taps_left_im[band_idx] = leftBRIRImag[band_idx][array_idx]; - convolver_state.filter_taps_right_re[band_idx] = rightBRIRReal[band_idx][array_idx]; - convolver_state.filter_taps_right_im[band_idx] = rightBRIRImag[band_idx][array_idx]; -#endif } } else { for ( band_idx = 0; band_idx < BINAURAL_CONVBANDS; band_idx++ ) { -#ifdef HRTF_BINARY_FILE convolver_state.filter_taps_left_re[band_idx] = hHrtfFastConv->leftHRIRReal[band_idx][array_idx]; convolver_state.filter_taps_left_im[band_idx] = hHrtfFastConv->leftHRIRImag[band_idx][array_idx]; convolver_state.filter_taps_right_re[band_idx] = hHrtfFastConv->rightHRIRReal[band_idx][array_idx]; convolver_state.filter_taps_right_im[band_idx] = hHrtfFastConv->rightHRIRImag[band_idx][array_idx]; -#else - convolver_state.filter_taps_left_re[band_idx] = leftHRIRReal[band_idx][array_idx]; - convolver_state.filter_taps_left_im[band_idx] = leftHRIRImag[band_idx][array_idx]; - convolver_state.filter_taps_right_re[band_idx] = rightHRIRReal[band_idx][array_idx]; - convolver_state.filter_taps_right_im[band_idx] = rightHRIRImag[band_idx][array_idx]; -#endif } } } @@ -386,9 +352,7 @@ static void get_IR_from_filter_taps( static void ivas_reverb_get_cldfb_hrtf_set_properties( AUDIO_CONFIG input_audio_config, -#ifdef HRTF_BINARY_FILE const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif const int16_t use_brir, const int32_t sampling_rate, float *avg_pwr_left, @@ -432,11 +396,7 @@ static void ivas_reverb_get_cldfb_hrtf_set_properties( Loop over all the HRTFs available */ for ( hrtf_idx = 0; hrtf_idx < hrtf_count; hrtf_idx++ ) { -#ifdef HRTF_BINARY_FILE get_IR_from_filter_taps( hHrtfFastConv, hrtf_idx, input_audio_config, use_brir, sampling_rate, IR_length, current_HRTF_data_L, current_HRTF_data_R ); -#else - get_IR_from_filter_taps( hrtf_idx, input_audio_config, use_brir, sampling_rate, IR_length, current_HRTF_data_L, current_HRTF_data_R ); -#endif /* Perform forward FFT on both L/R channels */ fft_rel( current_HRTF_data_L, (int16_t) fft_size, (int16_t) log2_fft_size ); @@ -485,9 +445,7 @@ static void ivas_reverb_get_cldfb_hrtf_set_properties( *-----------------------------------------------------------------------------------------*/ static void ivas_reverb_get_fastconv_hrtf_set_energies( -#ifdef HRTF_BINARY_FILE const HRTFS_FASTCONV_HANDLE hHrtfFastConv, -#endif const AUDIO_CONFIG input_audio_config, const int16_t use_brir, const int32_t sampling_rate, @@ -511,11 +469,7 @@ static void ivas_reverb_get_fastconv_hrtf_set_energies( output_fc[freq_idx] = (float) ( ( 2 * freq_idx + 1 ) * cldfb_freq_halfstep ); } -#ifdef HRTF_BINARY_FILE ivas_reverb_get_cldfb_hrtf_set_properties( input_audio_config, hHrtfFastConv, use_brir, sampling_rate, avg_pwr_left_fft, avg_pwr_right_fft ); -#else - ivas_reverb_get_cldfb_hrtf_set_properties( input_audio_config, use_brir, sampling_rate, avg_pwr_left_fft, avg_pwr_right_fft ); -#endif ivas_reverb_interpolate_acoustic_data( FFT_SPECTRUM_SIZE, input_fc, avg_pwr_left_fft, avg_pwr_right_fft, CLDFB_NO_CHANNELS_MAX, output_fc, avg_pwr_left, avg_pwr_right ); diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.c b/lib_rend/ivas_rom_TdBinauralRenderer.c index 4ceec1e43f8478f51402c461c9cad8f99d5bf8e1..4b56fb4883d7fb0b26d230409dd250cb75406f85 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.c +++ b/lib_rend/ivas_rom_TdBinauralRenderer.c @@ -41,11 +41,13 @@ #include "ivas_cnst.h" #include "wmc_auto.h" +#define WMC_TOOL_SKIP /*------------------------------------------------------------------------- * TD Binaural rendering related ROM tables *------------------------------------------------------------------------*/ /* TD renderer HRTF default model Orange53 */ +const float orange53_rom_latency_s = 0.000020834f; const int16_t orange53_rom_azimDim2[18] = { 1, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 1, }; @@ -12455,4 +12457,6 @@ const uint32_t orange53_rom_ITD_elevBsShape[28] = { 0x3ebda12f,0x3f12f685,0x3f2aaaab, }; +#undef WMC_TOOL_SKIP + /* clang-format on */ diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.h b/lib_rend/ivas_rom_TdBinauralRenderer.h index ce0ffc7408e9bfd9821e8e6bc2ec29147167f066..ccb5362c9a4a7d691e8fe738bcd83b4a23bf2187 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.h +++ b/lib_rend/ivas_rom_TdBinauralRenderer.h @@ -42,6 +42,7 @@ * TD Binaural rendering related ROM tables *------------------------------------------------------------------------*/ /* TD renderer HRTF default model Orange53 */ +extern const float orange53_rom_latency_s; extern const int16_t orange53_rom_azimDim2[18]; extern const int16_t orange53_rom_azimDim3[18]; extern const int16_t orange53_rom_azim_start_idx[18]; diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index 9d6bbd543eb7dbca0534ce84263bd49a9649298a..9708bac83aec16af96f97ae080fba9933f23d4bb 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -41,6 +41,8 @@ /* clang-format off */ +#define WMC_TOOL_SKIP + /*------------------------------------------------------------------------- * Binaural rendering related ROM tables *------------------------------------------------------------------------*/ @@ -52,11 +54,7 @@ * Generated with Matlab version 9.3.0.713579 (R2017b) by MUXE6256 */ const float FASTCONV_HOA3_latency_s = 0.001979167f; -#ifdef HRTF_BINARY_FILE const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]= -#else -const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]= -#endif { { {-0.004181f, +0.093228f, +0.655506f, +0.048565f, -0.005834f, -0.005472f, -0.000066f}, @@ -960,11 +958,7 @@ const float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]= } }; -#ifdef HRTF_BINARY_FILE const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]= -#else -const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]= -#endif { { {-0.007849f, -0.189662f, +0.310868f, +0.002657f, -0.000617f, -0.002064f, +0.000079f}, @@ -1868,11 +1862,7 @@ const float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]= } }; -#ifdef HRTF_BINARY_FILE const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]= -#else -const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]= -#endif { { {-0.004181f, +0.093228f, +0.655506f, +0.048565f, -0.005834f, -0.005472f, -0.000066f}, @@ -2776,11 +2766,7 @@ const float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]= } }; -#ifdef HRTF_BINARY_FILE const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]= -#else -const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]= -#endif { { {-0.007849f, -0.189662f, +0.310868f, +0.002657f, -0.000617f, -0.002064f, +0.000079f}, @@ -3685,11 +3671,7 @@ const float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]= }; const float FASTCONV_HRIR_latency_s = 0.000666667f; -#ifdef HRTF_BINARY_FILE const float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= -#else -const float leftHRIRReal[BINAURAL_CONVBANDS][15][7]= -#endif { { {+0.331798f, +0.500334f, +0.042057f, -0.000623f, -0.000260f}, @@ -4543,11 +4525,7 @@ const float leftHRIRReal[BINAURAL_CONVBANDS][15][7]= } }; -#ifdef HRTF_BINARY_FILE const float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= -#else -const float leftHRIRImag[BINAURAL_CONVBANDS][15][7]= -#endif { { {-0.346479f, +0.553523f, -0.074098f, +0.001288f, +0.000309f}, @@ -5401,11 +5379,7 @@ const float leftHRIRImag[BINAURAL_CONVBANDS][15][7]= } }; -#ifdef HRTF_BINARY_FILE const float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= -#else -const float rightHRIRReal[BINAURAL_CONVBANDS][15][7]= -#endif { { {+0.065097f, +0.755993f, -0.042308f, -0.016140f, -0.000353f}, @@ -6259,11 +6233,7 @@ const float rightHRIRReal[BINAURAL_CONVBANDS][15][7]= } }; -#ifdef HRTF_BINARY_FILE const float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= -#else -const float rightHRIRImag[BINAURAL_CONVBANDS][15][7]= -#endif { { {-0.179291f, +0.196331f, +0.055128f, -0.017382f, +0.000411f}, @@ -7649,11 +7619,7 @@ const float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]= /* Binaural rendering data set based on BRIRs */ /* Tables derived from Mozart IIS BRIRs.*/ const float FASTCONV_BRIR_latency_s = 0.000937500f; -#ifdef HRTF_BINARY_FILE const float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= -#else -const float leftBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= -#endif { { { @@ -16757,11 +16723,7 @@ const float leftBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= } }; -#ifdef HRTF_BINARY_FILE const float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= -#else -const float leftBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= -#endif { { { @@ -25865,11 +25827,7 @@ const float leftBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= } }; -#ifdef HRTF_BINARY_FILE const float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= -#else -const float rightBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= -#endif { { { @@ -34973,11 +34931,7 @@ const float rightBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= } }; -#ifdef HRTF_BINARY_FILE const float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]= -#else -const float rightBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]= -#endif { { { @@ -44125,4 +44079,6 @@ const float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX] = 0.016350f, 0.042709f, 0.077337f, 0.066238f, 0.042046f, 0.020017f, 0.007896f, 0.002947f, 0.000932f, 0.000152f }; +#undef WMC_TOOL_SKIP + /* clang-format on */ diff --git a/lib_rend/ivas_rom_binauralRenderer.h b/lib_rend/ivas_rom_binauralRenderer.h index f97883f9c37f1163fc03c79c13a9d170013709e9..939f6ef78fa76c7b82a6755f985294490a26d1c8 100644 --- a/lib_rend/ivas_rom_binauralRenderer.h +++ b/lib_rend/ivas_rom_binauralRenderer.h @@ -44,29 +44,15 @@ /* Binaural rendering data set based on HRIRs */ extern const float FASTCONV_HRIR_latency_s; -#ifdef HRTF_BINARY_FILE extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][BINAURAL_NTAPS]; -#else -extern float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]; -extern float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]; -extern float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][16][7]; -extern float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][16][7]; -#endif -#ifdef HRTF_BINARY_FILE extern float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; extern float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]; -#else -extern float leftHRIRReal[BINAURAL_CONVBANDS][15][7]; -extern float leftHRIRImag[BINAURAL_CONVBANDS][15][7]; -extern float rightHRIRReal[BINAURAL_CONVBANDS][15][7]; -extern float rightHRIRImag[BINAURAL_CONVBANDS][15][7]; -#endif extern float FASTCONV_HOA3_latency_s; extern float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; @@ -75,17 +61,10 @@ extern float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; /* Binaural rendering data set based on BRIRs */ extern const float FASTCONV_BRIR_latency_s; -#ifdef HRTF_BINARY_FILE extern float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; extern float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; extern float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; extern float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; -#else -extern float leftBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]; -extern float leftBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]; -extern float rightBRIRReal[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]; -extern float rightBRIRImag[BINAURAL_CONVBANDS][15][BINAURAL_NTAPS_MAX]; -#endif /* Reverberation parameters based on BRIRs for fastconv */ extern float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_rend/ivas_rom_binaural_crend_head.c b/lib_rend/ivas_rom_binaural_crend_head.c index 082a29c3910c73da00178b5e9bb0d2ff3ba7abfc..56a9a9ef5352414618cbc049009c64d61d3d1af9 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.c +++ b/lib_rend/ivas_rom_binaural_crend_head.c @@ -37,18 +37,24 @@ *------------------------------------------------------------------------*/ /* Binaural rendering data set based on HRIRs */ -/* Tables generated by the exe at "scripts/binauralRenderer_interface/generate_cren_ivas_tables*.* */ -/* Can be replaced by your own generated HRIR or BRIRI tables */ +/* Tables generated by scripts/binauralRenderer_interface/generate_cren_ivas_tables.c, see mixer_conv_sofa_to_rom_table_converter_readme.txt */ +/* Can be replaced by your own generated HRIR or BRIR tables */ + + #include #include #include "cnst.h" #include "ivas_cnst.h" +#define WMC_TOOL_SKIP /********************** CRendBin_Combined_HRIR **********************/ - +#ifdef FIX_BINAURAL_DELAY_PRECISION +const float CRendBin_Combined_HRIR_latency_s = 0.000020834f; +#else const float CRendBin_Combined_HRIR_latency_s = 0.000020833333110f; +#endif /* Sample Rate = 48000 */ @@ -640,7 +646,11 @@ const float *CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]={N /********************** CRendBin_HOA3_HRIR **********************/ +#ifdef FIX_BINAURAL_DELAY_PRECISION +const float CRendBin_HOA3_HRIR_latency_s = 0.001333334f; +#else const float CRendBin_HOA3_HRIR_latency_s = 0.001333333319053f; +#endif /* Sample Rate = 48000 */ @@ -1588,7 +1598,11 @@ const float *CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]={NULL, /********************** CRendBin_Combined_BRIR **********************/ +#ifdef FIX_BINAURAL_DELAY_PRECISION +const float CRendBin_Combined_BRIR_latency_s = 0.000145834f; +#else const float CRendBin_Combined_BRIR_latency_s = 0.000145833328133f; +#endif /* Sample Rate = 48000 */ @@ -6910,3 +6924,4 @@ const float CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS][252 0.050578f, 0.012222f, 0.020049f, -0.020057f, -0.032135f, -0.002553f, -0.037541f, -0.023567f, -0.008392f, -0.012215f, 0.001644f, -0.001142f, 0.000540f, 0.001404f, -0.027979f, -0.022362f, -0.012091f, -0.022963f, 0.009075f, 0.010977f, -0.007069f, -0.000183f, -0.022228f, -0.001348f, 0.006548f, -0.003034f} }; +#undef WMC_TOOL_SKIP diff --git a/lib_rend/ivas_rom_binaural_crend_head.h b/lib_rend/ivas_rom_binaural_crend_head.h index 4a9570f23f47c9d7cfa96579bb21c9f530194b9e..64582a16723b9f0dd5956d6c213fa4f5ab0d44f7 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.h +++ b/lib_rend/ivas_rom_binaural_crend_head.h @@ -37,8 +37,8 @@ *------------------------------------------------------------------------*/ /* Binaural rendering data set based on HRIRs */ -/* Tables generated by the exe at "scripts/binauralRenderer_interface/generate_cren_ivas_tables*.* */ -/* Can be replaced by your own generated HRIR or BRIRI tables */ +/* Tables generated by scripts/binauralRenderer_interface/generate_cren_ivas_tables.c, see mixer_conv_sofa_to_rom_table_converter_readme.txt */ +/* Can be replaced by your own generated HRIR or BRIR tables */ diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index 2a68d832e02d0e9fa30d3a51a22aca3c5894a02e..dd8ca99d80ee6cb990fa7f65db3db9539cd837f5 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -43,12 +43,6 @@ * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ -const float dmxmtx[BINAURAL_CHANNELS][11] = -{ - { 1.0f, 0.0f, 0.70709997f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }, - { 0.0f, 1.0f, 0.70709997f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f }, -}; - /* * 0 = 30,0 * 1 = -30,0 @@ -72,33 +66,47 @@ const int16_t channelIndex_CICP14[7] = { 0, 1, 2, 5, 6, 9, 10 }; const int16_t channelIndex_CICP16[9] = { 0, 1, 2, 5, 6, 9, 10, 11, 12 }; const int16_t channelIndex_CICP19[11] = { 0, 1, 2, 3, 4, 7, 8, 9, 10, 13, 14 }; -/*----------------------------------------------------------------------------------* - * TD ISm binaural renderer ROM tables - *----------------------------------------------------------------------------------*/ - /* The maximum target times set to 100 msec. */ -const int16_t TDREND_SRC_REND_MaxTargetTimes[IVAS_NUM_SUPPORTED_FS] = -{ - 1600, 3200, 4800 /* Corresponds to 16kHz, 32kHz, 48kHz */ +const float surCohEne[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = +{ + 3.0903f, 2.0053f, 1.0860f, 0.8072f, 0.7079f +}; + +const float spreadCohEne05[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = +{ + 2.3988f, 1.7783f, 1.1220f, 1.1220f, 1.1220f +}; + +const float spreadCohEne1[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS] = +{ + 1.5975f, 1.1220f, 1.1220f, 1.1220f, 1.1220f }; -/* The maximum lengths of the blocks internally in the effect. Corresponds to 6 msec. This means also that */ -/* if the length of the input block is just above 6 msec, the block will be divided into two 3 msec blocks. */ -const int16_t TDREND_SRC_REND_MaxBlockLengths[IVAS_NUM_SUPPORTED_FS] = +const float lowBitRateBinauralEQ[LOW_BIT_RATE_BINAURAL_EQ_BINS] = +{ + 0.979f, 0.893f, 0.762f, 0.615f, 0.52f, 0.48f, 0.477f, 0.477f, 0.48f, 0.501f, 0.546f, 0.602f, 0.652f, 0.664f, 0.652f, 0.639f, 0.635f +}; + +const float diffuseFieldCoherenceDifferenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS] = { - 96, 192, 288 /* Corresponds to 16kHz, 32kHz, 48kHz */ + 0.047421f, 0.19773f, 0.22582f, 0.10637f, 0.0087111f, 0.012028f, 0.031972f, 0.019668f, 0.0079928f }; -const int16_t TDREND_MaxITD[IVAS_NUM_SUPPORTED_FS] = +const float diffuseFieldCoherenceDifferenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS] = { - 111, 222, 333 /* Corresponds to 16kHz, 32kHz, 48kHz */ + -0.095628f, -0.30569f, -0.34427f, -0.15425f, -0.044628f, -0.057224f, -0.050835f, -0.035214f, -0.02215f }; -const float TDREND_MaxITD_Incr[IVAS_NUM_SUPPORTED_FS] = +const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS] = { - 0.0925f, 0.1850f, 0.2775f /* Corresponds to 16kHz, 32kHz, 48kHz, e.g. ( ( 2 * MaxITD ) / ( 0.05 * 48000 ) ) */ + 0.048207f, 0.10796f, 0.11845f, 0.047886f, 0.035917f, 0.045196f, 0.018863f, 0.015547f, 0.014157f }; + +/*----------------------------------------------------------------------------------* + * TD ISM binaural renderer ROM tables + *----------------------------------------------------------------------------------*/ + const int16_t HRTF_MODEL_N_CPTS_VAR[HRTF_MODEL_N_SECTIONS] = { 13, 12, 11 @@ -333,25 +341,8 @@ const float ivas_reverb_default_DSR[IVAS_REVERB_DEFAULT_N_BANDS] = /* CICP1 - Mono */ const float ls_azimuth_CICP1[1] = { 0.0f }; const float ls_elevation_CICP1[1] = { 0.0f }; -const uint32_t ls_LFE_last_idx_CICP1[1] = { 0 }; - -/* CICP2 - Stereo */ -const uint32_t ls_LFE_last_idx_CICP2[2] = { 0, 1 }; - -/* CICP6 - 5.1 */ -const uint32_t ls_LFE_last_idx_CICP6[6] = { 0, 1, 2, 4, 5, 3 }; - -/* CICP12 - 7.1 */ -const uint32_t ls_LFE_last_idx_CICP12[8] = { 0, 1, 2, 4, 5, 6, 7, 3 }; - -/* CICP14 - 5.1.2 */ -const uint32_t ls_LFE_last_idx_CICP14[8] = { 0, 1, 2, 4, 5, 6, 7, 3 }; -/* CICP16 - 5.1.4 */ -const uint32_t ls_LFE_last_idx_CICP16[10] = { 0, 1, 2, 4, 5, 6, 7, 8, 9, 3 }; -/* CICP19 - 7.1.4 */ -const uint32_t ls_LFE_last_idx_CICP19[12] = { 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 3 }; /*----------------------------------------------------------------------------------* * LS Renderer ROM tables diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index cba0fffb1bfcb2e1f8e2a17a4a3f815f95e24d08..c4e1ca153378923382ba84c162635b4b10d3bd17 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -45,23 +45,31 @@ * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ -extern const float dmxmtx[BINAURAL_CHANNELS][11]; - extern const int16_t channelIndex_CICP6[5]; extern const int16_t channelIndex_CICP12[7]; extern const int16_t channelIndex_CICP14[7]; extern const int16_t channelIndex_CICP16[9]; extern const int16_t channelIndex_CICP19[11]; +/* These are equalization values for spread and surround coherent sounds, approximating the spectrum + * for such sounds at anechoic multichannel listening. */ +extern const float surCohEne[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; +extern const float spreadCohEne05[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; +extern const float spreadCohEne1[MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS]; + +/* Values for low-bit-rate equalization */ +extern const float lowBitRateBinauralEQ[LOW_BIT_RATE_BINAURAL_EQ_BINS]; + +/* Diffuse field binaural coherence directional adjustment values */ +extern const float diffuseFieldCoherenceDifferenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS]; +extern const float diffuseFieldCoherenceDifferenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS]; +extern const float diffuseFieldCoherenceDifferenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS]; + + /*----------------------------------------------------------------------------------* * TD ISM Object renderer *----------------------------------------------------------------------------------*/ -extern const int16_t TDREND_SRC_REND_MaxTargetTimes[IVAS_NUM_SUPPORTED_FS]; -extern const int16_t TDREND_SRC_REND_MaxBlockLengths[IVAS_NUM_SUPPORTED_FS]; -extern const int16_t TDREND_MaxITD[IVAS_NUM_SUPPORTED_FS]; -extern const float TDREND_MaxITD_Incr[IVAS_NUM_SUPPORTED_FS]; - extern const int16_t HRTF_MODEL_N_CPTS_VAR[HRTF_MODEL_N_SECTIONS]; extern const float SincTable[321]; @@ -96,16 +104,9 @@ extern const float ivas_reverb_default_DSR[]; * Renderer SBA & MC enc/dec matrices *----------------------------------------------------------------------------------*/ -extern const float hoa_dec_mtx_CICP1[16]; extern const float ls_azimuth_CICP1[1]; extern const float ls_elevation_CICP1[1]; -extern const uint32_t ls_LFE_last_idx_CICP1[1]; -extern const uint32_t ls_LFE_last_idx_CICP2[2]; -extern const uint32_t ls_LFE_last_idx_CICP6[6]; -extern const uint32_t ls_LFE_last_idx_CICP12[8]; -extern const uint32_t ls_LFE_last_idx_CICP14[8]; -extern const uint32_t ls_LFE_last_idx_CICP16[10]; -extern const uint32_t ls_LFE_last_idx_CICP19[12]; + /*----------------------------------------------------------------------------------* * LS Configuration Converter ROM tables @@ -114,26 +115,6 @@ extern const uint32_t ls_LFE_last_idx_CICP19[12]; /* Downmix matrices */ extern const float ls_conversion_cicpX_mono[12][1]; extern const float ls_conversion_cicpX_stereo[12][2]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp6[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp6[]; -#ifdef FIX_I54_LS_CONVERSION -extern const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp12[]; -#endif -extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp6[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp14[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp6[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp12[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp14[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp16[]; - -/* Upmix matrices */ -extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp14[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp16[]; -#ifdef FIX_I54_LS_CONVERSION -extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp19[]; -#endif -extern const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp19[]; -extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp19[]; /* Mapping table of input config : output config with corresponding matrix */ extern const LS_CONVERSION_MAPPING ls_conversion_mapping[]; diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index ff9eeebf2f97e66338e2ccd3bdeccdf7569accc9..5719e2ffddf4f5079d8d6dde0922434cd679115b 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -30,16 +30,14 @@ *******************************************************************************************************/ +#include "ivas_cnst.h" #include #include #include "options.h" #include #include "cnst.h" #include "prot.h" -#include "ivas_prot.h" -#include "ivas_cnst.h" -#include "ivas_rom_com.h" -#include "ivas_rom_dec.h" +#include "ivas_prot_rend.h" #ifdef DEBUGGING #include "debug.h" #endif @@ -57,6 +55,7 @@ ivas_error ivas_headTrack_open( ) { int16_t i; + ivas_error error; /* Allocate Head-Tracking handle */ if ( ( *hHeadTrackData = (HEAD_TRACK_DATA_HANDLE) malloc( sizeof( HEAD_TRACK_DATA ) ) ) == NULL ) @@ -69,6 +68,15 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->lrSwitchInterpVal = 0.0f; ( *hHeadTrackData )->lrSwitchedCurrent = 0; ( *hHeadTrackData )->lrSwitchedNext = 0; + if ( ( ( *hHeadTrackData )->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); + } + + if ( ( error = ivas_orient_trk_Init( ( *hHeadTrackData )->OrientationTracker ) ) != IVAS_ERR_OK ) + { + return error; + } /* Initialise Rmat_prev to I, Rmat will be computed later */ for ( i = 0; i < 3; i++ ) @@ -77,10 +85,43 @@ ivas_error ivas_headTrack_open( ( *hHeadTrackData )->Rmat_prev[i][i] = 1.0f; } + set_zero( ( *hHeadTrackData )->chEneIIR[0], MASA_FREQUENCY_BANDS ); + set_zero( ( *hHeadTrackData )->chEneIIR[1], MASA_FREQUENCY_BANDS ); + set_zero( ( *hHeadTrackData )->procChEneIIR[0], MASA_FREQUENCY_BANDS ); + set_zero( ( *hHeadTrackData )->procChEneIIR[1], MASA_FREQUENCY_BANDS ); + return IVAS_ERR_OK; } +/*-----------------------------------------------------------------------* + * ivas_headTrack_close() + * + * Deallocate Head-Tracking handle + *-----------------------------------------------------------------------*/ + +void ivas_headTrack_close( + HEAD_TRACK_DATA_HANDLE *hHeadTrackData /* i/o: head track handle */ +) +{ + if ( hHeadTrackData == NULL || *hHeadTrackData == NULL ) + { + return; + } + + if ( ( *hHeadTrackData )->OrientationTracker != NULL ) + { + free( ( *hHeadTrackData )->OrientationTracker ); + ( *hHeadTrackData )->OrientationTracker = NULL; + } + + free( ( *hHeadTrackData ) ); + *hHeadTrackData = NULL; + + return; +} + + /*---------------------------------------------------------------------------------- * QuatToRotMat() * @@ -92,100 +133,80 @@ void QuatToRotMat( float Rmat[3][3] /* o : real-space rotation matrix for this rotation */ ) { - float s1, s2, s3, c1, c2, c3; -#ifdef DEBUGGING - /* PrintQuat( quat ); */ -#endif + 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 ); - /* For debugging purposes we can also calculate the rotation matrix from - * Euler angles instead of quaternions. In this case, all the w values must - * be set to -3.0 in the trajectory file to signal switching to Euler angles. - * The x,y, and z components of the quaternion are then interpreted as - * yaw-pitch-roll. - */ - if ( quat.w != -3.0 ) - { - 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; - } - else - { - /* Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention - * - * yaw: rotate scene counter-clockwise in the horizontal plane - * pitch: rotate scene in the median plane, increase elevation with positive values - * roll: rotate scene from the right ear to the top - */ - - c1 = cosf( quat.z / _180_OVER_PI ); - c2 = cosf( quat.y / _180_OVER_PI ); - c3 = cosf( quat.x / _180_OVER_PI ); - - s1 = sinf( quat.z / _180_OVER_PI ); - s2 = sinf( -quat.y / _180_OVER_PI ); - s3 = sinf( quat.x / _180_OVER_PI ); + return; +} - Rmat[0][0] = c2 * c3; - Rmat[0][1] = -c2 * s3; - Rmat[0][2] = s2; - Rmat[1][0] = c1 * s3 + c3 * s1 * s2; - Rmat[1][1] = c1 * c3 - s1 * s2 * s3; - Rmat[1][2] = -c2 * s1; +/*------------------------------------------------------------------------- + * Euler2Quat() + * + * Calculate corresponding Quaternion from Euler angles in radians + *------------------------------------------------------------------------*/ - Rmat[2][0] = s1 * s3 - c1 * c3 * s2; - Rmat[2][1] = c3 * s1 + c1 * s2 * s3; - Rmat[2][2] = c1 * c2; - } +void Euler2Quat( + const float yaw, /* i : yaw (x) */ + const float pitch, /* i : pitch (y) */ + const float roll, /* i : roll (z) */ + IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ +) +{ + float cr = cosf( roll * 0.5f ); + float sr = sinf( roll * 0.5f ); + float cp = cosf( pitch * 0.5f ); +#ifdef EUALER2QUAT_FIX + float sp = sinf( pitch * 0.5f ); +#else + float sp = sinf( -pitch * 0.5f ); +#endif + float cy = cosf( yaw * 0.5f ); + float sy = sinf( yaw * 0.5f ); +#ifdef EUALER2QUAT_FIX + quat->w = cr * cp * cy + sr * sp * sy; + quat->x = sr * cp * cy - cr * sp * sy; + quat->y = sr * cp * sy + cr * sp * cy; + quat->z = cr * cp * sy - sr * sp * cy; +#else + quat->w = cr * cp * cy - sr * sp * sy; + quat->x = sr * cp * cy + cr * sp * sy; + quat->y = cr * sp * cy - sr * cp * sy; + quat->z = cr * cp * sy + sr * sp * cy; +#endif return; } /*------------------------------------------------------------------------- - * Quat2Euler() + * deg2rad() * - * Quaternion handling: calculate corresponding Euler angles + * Converts degrees to normalized radians *------------------------------------------------------------------------*/ - -void Quat2Euler( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - float *yaw, /* o : yaw */ - float *pitch, /* o : pitch */ - float *roll /* o : roll */ -) +float deg2rad( + float degrees ) { - if ( quat.w != -3.0 ) + while ( degrees >= 180.0f ) { - *yaw = atan2f( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) ); - *pitch = asinf( 2 * ( quat.w * quat.y - quat.z * quat.x ) ); - *roll = atan2f( 2 * ( quat.w * quat.z + quat.x * quat.y ), 1 - 2 * ( quat.y * quat.y + quat.z * quat.z ) ); + degrees = degrees - 360.0f; } - else + while ( degrees <= -180.0f ) { - /* Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention - * - * yaw: rotate scene counter-clockwise in the horizontal plane - * pitch: rotate scene in the median plane, increase elevation with positive values - * roll: rotate scene from the right ear to the top - */ - *yaw = quat.z; - *pitch = quat.y; - *roll = quat.x; + degrees = degrees + 360.0f; } - return; + return PI_OVER_180 * degrees; } - /*------------------------------------------------------------------------- * rotateAziEle() * @@ -232,51 +253,6 @@ void rotateAziEle( } -/*------------------------------------------------------------------------- - * rotateAziEle_DirAC() - * - * Apply rotation to DirAC DOAs - *------------------------------------------------------------------------*/ - -void rotateAziEle_DirAC( - int16_t *azi, /* i/o: array of azimuth values */ - int16_t *ele, /* i/o: array of elevation values */ - const int16_t band1, /* i : bands to work on (lower limit) */ - const int16_t band2, /* i : bands to work on (upper bound) */ - const float *p_Rmat /* i : pointer to real-space rotation matrix */ -) -{ - int16_t b; - float dv_0, dv_1, dv_2; - float dv_r_0, dv_r_1, dv_r_2; - float w; - - push_wmops( "rotateAziEle_DirAC" ); - - for ( b = band1; b < band2; b++ ) - { - - /*Conversion spherical to cartesian coordinates*/ - w = cosf( ele[b] * PI_OVER_180 ); - dv_0 = w * cosf( azi[b] * PI_OVER_180 ); - dv_1 = w * sinf( azi[b] * PI_OVER_180 ); - dv_2 = sinf( ele[b] * PI_OVER_180 ); - - dv_r_0 = p_Rmat[0] * dv_0 + p_Rmat[1] * dv_1 + p_Rmat[2] * dv_2; - dv_r_1 = p_Rmat[3] * dv_0 + p_Rmat[4] * dv_1 + p_Rmat[5] * dv_2; - dv_r_2 = p_Rmat[6] * dv_0 + p_Rmat[7] * dv_1 + p_Rmat[8] * dv_2; - - /*Conversion spherical to cartesian coordinates*/ - azi[b] = (int16_t) ( atan2f( dv_r_1, dv_r_0 ) * _180_OVER_PI ); - ele[b] = (int16_t) ( atan2f( dv_r_2, sqrtf( dv_r_0 * dv_r_0 + dv_r_1 * dv_r_1 ) ) * _180_OVER_PI ); - } - - pop_wmops(); - - return; -} - - /*------------------------------------------------------------------------- * rotateFrame_shd() * @@ -285,10 +261,14 @@ void rotateAziEle_DirAC( void rotateFrame_shd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - float output[][L_FRAME48k], /* i/o: unrotated HOA3 signal buffer in TD */ - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const int16_t subframe_idx /* i : subframe index */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ +#else + float output[][L_FRAME48k], /* i/o: unrotated HOA3 signal buffer in TD */ +#endif + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const int16_t subframe_idx /* i : subframe index */ ) { int16_t i, l, n, m; @@ -388,11 +368,15 @@ void rotateFrame_shd( void rotateFrame_sd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - float output[][L_FRAME48k], /* i/o: unrotated SD signal buffer in TD */ - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t subframe_idx /* i : subframe index */ +#ifdef JBM_TSM_ON_TCS + float *output[], /* i/o: unrotated SD signal buffer in TD */ +#else + float output[][L_FRAME48k], /* i/o: unrotated SD signal buffer in TD */ +#endif + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + const int16_t subframe_idx /* i : subframe index */ ) { int16_t i, j; @@ -526,7 +510,10 @@ void rotateFrame_shd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ float Rmat[3][3], /* i : real-space rotation matrix */ const int16_t nInChannels, /* i : number of channels */ - const int16_t shd_rot_max_order /* i : split-order rotation method */ +#ifdef JBM_TSM_ON_TCS + const int16_t numTimeSlots, +#endif + const int16_t shd_rot_max_order /* i : split-order rotation method */ ) { int16_t n = 0; @@ -549,7 +536,11 @@ void rotateFrame_shd_cldfb( SHrotmatgen( SHrotmat, Rmat, shd_rot_max_order ); /* rotation by mtx multiplication */ +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < numTimeSlots; i++ ) +#else for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) +#endif { for ( iBand = 0; iBand < CLDFB_NO_CHANNELS_MAX; iBand++ ) { @@ -620,7 +611,10 @@ void rotateFrame_sd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t nb_band /* i : number of CLDFB bands to process */ +#ifdef JBM_TSM_ON_TCS + const int16_t numTimeSlots, /* i : number of time slots to process */ +#endif + const int16_t nb_band /* i : number of CLDFB bands to process */ ) { int16_t iBlock, iBand, m, n; @@ -678,7 +672,11 @@ void rotateFrame_sd_cldfb( p_imagRot = imagRot[n]; if ( g1 > 0.f ) { +#ifdef JBM_TSM_ON_TCS + for ( iBlock = 0; iBlock < numTimeSlots; iBlock++ ) +#else for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) +#endif { p_real = Cldfb_RealBuffer[m][iBlock]; p_imag = Cldfb_ImagBuffer[m][iBlock]; @@ -698,7 +696,11 @@ void rotateFrame_sd_cldfb( { p_realRot = realRot[n]; p_imagRot = imagRot[n]; +#ifdef JBM_TSM_ON_TCS + for ( iBlock = 0; iBlock < numTimeSlots; iBlock++ ) +#else for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) +#endif { p_real = Cldfb_RealBuffer[n][iBlock]; p_imag = Cldfb_ImagBuffer[n][iBlock]; diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 316792951704e054099b2cea3edeb4fa70dd87c2..c549461c37f2f4275be8899bc39fd913782250ba 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -34,6 +34,7 @@ #include "options.h" #include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" #include "ivas_stat_dec.h" #include "ivas_cnst.h" #include @@ -43,555 +44,172 @@ #include "wmc_auto.h" -/*-----------------------------------------------------------------------* - * Local function prototypes - *-----------------------------------------------------------------------*/ - - -#ifdef DEBUG_MODE_DIRAC -static void debug_mode_dirac( float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], const int16_t nchan_transport, const int16_t output_frame ); -#endif - - -/*-------------------------------------------------------------------------* - * ivas_mc2sba() - * - * MC signals transformed into SBA in TD domain - *-------------------------------------------------------------------------*/ - -void ivas_mc2sba( - IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ - float buffer_td[][L_FRAME48k], /* i/o: MC signals (on input) and the HOA3 (on output) */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const float gain_lfe /* i : gain for LFE, 0 = ignore LFE */ -) -{ - int16_t i, j, k; - int16_t idx_lfe, idx_in; - float buffer_tmp[16][L_FRAME48k]; - float gains[16]; - int16_t azimuth, elevation; - int16_t sba_num_chans; - - assert( ( sba_order <= 3 ) && "Only order up to 3 is supported!" ); - - /* Init*/ - sba_num_chans = ( sba_order + 1 ) * ( sba_order + 1 ); - for ( j = 0; j < sba_num_chans; j++ ) - { - set_zero( buffer_tmp[j], output_frame ); - } - - /* HOA encoding*/ - idx_lfe = 0; - idx_in = 0; - for ( i = 0; i < hIntSetup.nchan_out_woLFE + hIntSetup.num_lfe; i++ ) - { - if ( ( hIntSetup.num_lfe > 0 ) && ( i == hIntSetup.index_lfe[idx_lfe] ) ) - { - if ( gain_lfe > 0.f ) - { - /* Add LFE to omni W with gain*/ - for ( k = 0; k < output_frame; k++ ) - { - buffer_tmp[0][k] += gain_lfe * buffer_td[i][k]; - } - } - - if ( idx_lfe < ( hIntSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else - { - azimuth = (int16_t) ( hIntSetup.ls_azimuth[idx_in] ); - elevation = (int16_t) ( hIntSetup.ls_elevation[idx_in] ); - idx_in++; - - /* get HOA response for direction (ACN/SN3D)*/ - ivas_dirac_dec_get_response( - azimuth, - elevation, - gains, - sba_order ); - - for ( j = 0; j < sba_num_chans; j++ ) - { - for ( k = 0; k < output_frame; k++ ) - { - buffer_tmp[j][k] += gains[j] * buffer_td[i][k]; - } - } - } - } - - for ( j = 0; j < sba_num_chans; j++ ) - { - mvr2r( buffer_tmp[j], buffer_td[j], output_frame ); - } - - return; -} - - -/*-------------------------------------------------------------------------* - * ivas_sba2MC_cldfb() - * - * SBA signals transformed into MC in CLDFB domain - *-------------------------------------------------------------------------*/ - -void ivas_sba2mc_cldfb( - IVAS_OUTPUT_SETUP hInSetup, /* i : Format of input layout */ - float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb real part */ - float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part */ - const int16_t nb_channels_out, /* i : nb of output channels */ - const int16_t nb_bands, /* i : nb of CLDFB bands to process */ - const float *hoa_dec_mtx /* i : HOA decoding mtx */ -) -{ - int16_t iBlock, iBand, n, m; - float realOut[16][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX], imagOut[16][MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX]; - float g; - float *p_real, *p_imag, *p_realOut, *p_imagOut; - int16_t nb_channels_in; - - push_wmops( "ivas_sba2mc_cldfb" ); - - nb_channels_in = hInSetup.nchan_out_woLFE; - assert( ( nb_channels_in == 16 ) && ( nb_channels_out == 11 ) && "ivas_sba2mc_cldfb; only HOA3 to CICP19 is for now supported!" ); - - for ( n = 0; n < nb_channels_out; n++ ) - { - set_zero( realOut[n], MAX_PARAM_SPATIAL_SUBFRAMES * nb_bands ); - set_zero( imagOut[n], MAX_PARAM_SPATIAL_SUBFRAMES * nb_bands ); - - for ( m = 0; m < nb_channels_in; m++ ) - { - g = hoa_dec_mtx[SBA_NHARM_HOA3 * n + m]; - p_realOut = realOut[n]; - p_imagOut = imagOut[n]; - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) - { - p_real = RealBuffer[m][iBlock]; - p_imag = ImagBuffer[m][iBlock]; - for ( iBand = 0; iBand < nb_bands; iBand++ ) - { - *p_realOut = *p_realOut + g * *( p_real++ ); - *p_imagOut = *p_imagOut + g * *( p_imag++ ); - p_realOut++; - p_imagOut++; - } - } - } - } - - for ( n = 0; n < nb_channels_out; n++ ) - { - p_realOut = realOut[n]; - p_imagOut = imagOut[n]; - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) - { - p_real = RealBuffer[n][iBlock]; - p_imag = ImagBuffer[n][iBlock]; - for ( iBand = 0; iBand < nb_bands; iBand++ ) - { - *( p_real++ ) = *p_realOut++; - *( p_imag++ ) = *p_imagOut++; - } - } - } - - pop_wmops(); - - return; -} - /*-------------------------------------------------------------------* - * ivas_sba_remapTCs() + * ivas_sba_prototype_renderer() * - * Get TCs from Ambisonics signal in ACN + * Render prototype audio signals using SBA mixing matrices *-------------------------------------------------------------------*/ -int16_t ivas_sba_remapTCs( - float sba_data[][L_FRAME48k], /* i/o: SBA signals */ - Decoder_Struct *st_ivas, /* i/o: decoder struct */ - const int16_t output_frame /* i : frame length */ +#ifdef JBM_TSM_ON_TCS +void ivas_sba_prototype_renderer_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + float inRe[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* i : Input audio in CLDFB domain, imag */ ) { - int16_t nchan_remapped; - -#ifdef DEBUG_MODE_DIRAC - debug_mode_dirac( sba_data, st_ivas->nchan_transport, output_frame ); -#endif - - nchan_remapped = st_ivas->nchan_transport; - if ( ( st_ivas->sba_mode != SBA_MODE_SPAR && st_ivas->sba_planar && nchan_remapped >= 3 ) || - ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && nchan_remapped == 3 ) ) - { - - nchan_remapped++; - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) - { - assert( ( ( st_ivas->nchan_transport == 3 ) || ( st_ivas->nchan_transport == 5 ) || ( st_ivas->nchan_transport == 7 ) ) && "Number of channels must be odd for SBA planar!" ); - } + float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; + SPAR_DEC_HANDLE hSpar; + DECODER_CONFIG_HANDLE hDecoderConfig; + int16_t num_spar_bands, spar_band; + int16_t b, ts; + int16_t num_cldfb_bands, numch_in, numch_out; + int16_t cldfb_band; + int16_t out_ch, in_ch; + int16_t firstInCh, inChEnd, firstOutCh, outChEnd; + int16_t slot_idx_start; - if ( nchan_remapped == 4 ) - { - /*For planar A-format channel 2 and 3 are identical -> Z=0*/ - mvr2r( sba_data[2], sba_data[3], output_frame ); - } - } + push_wmops( "ivas_sba_prototype_renderer" ); - if ( st_ivas->nchan_transport >= 3 ) - { - int16_t i = 0; - float temp; + hSpar = st_ivas->hSpar; + hDecoderConfig = st_ivas->hDecoderConfig; + num_spar_bands = hSpar->hFbMixer->pFb->filterbank_num_bands; - /*convert WYXZ downmix to WYZX*/ - for ( i = 0; i < output_frame; i++ ) - { - temp = sba_data[2][i]; - sba_data[2][i] = sba_data[3][i]; - sba_data[3][i] = temp; - if ( st_ivas->nchan_transport == 3 ) - { - sba_data[2][i] = 0; - } - } - } + num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands; + numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; + numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) + if ( st_ivas->nchan_transport == 1 ) { - ivas_sba_zero_vert_comp( sba_data, st_ivas->sba_analysis_order, st_ivas->sba_planar, output_frame ); + firstInCh = 0; + inChEnd = 1; + firstOutCh = 0; + outChEnd = 1; } - - return ( nchan_remapped ); -} - - -/*-------------------------------------------------------------------------* - * ivas_ism2sba() - * - * ISM transformed into SBA in TD domain. - *-------------------------------------------------------------------------*/ - -void ivas_ism2sba( - float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ - ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ - const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ - const int16_t num_objects, /* i : number of objects */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ -) -{ - int16_t i, j, k; - float buffer_tmp[16][L_FRAME48k]; - float gains[16]; - float g1, g2; - int16_t azimuth, elevation; - int16_t sba_num_chans; - - assert( ( sba_order <= 3 ) && "Only order up to 3 is supported!" ); - assert( hIsmRendererData != NULL && "hIsmRendererData not allocated!" ); - - /* Init*/ - sba_num_chans = ( sba_order + 1 ) * ( sba_order + 1 ); - for ( j = 0; j < sba_num_chans; j++ ) + else /* 2 TC */ { - set_zero( buffer_tmp[j], output_frame ); + firstInCh = 0; + inChEnd = 2; + firstOutCh = 1; + outChEnd = 2; } - - for ( i = 0; i < num_objects; i++ ) + slot_idx_start = hSpar->slots_rendered; + /* Apply mixing matrix */ + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - // TODO tmu review when #215 is resolved - azimuth = (int16_t) floorf( hIsmMetaData[i]->azimuth + 0.5f ); - elevation = (int16_t) floorf( hIsmMetaData[i]->elevation + 0.5f ); - - /*get HOA gets for direction (ACN/SN3D)*/ - ivas_dirac_dec_get_response( azimuth, elevation, gains, sba_order ); + int16_t md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; + /* determine SPAR parameters for this time slot */ + ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); - for ( j = 0; j < sba_num_chans; j++ ) + for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) { - g1 = 1.f; - g2 = 0.f; - for ( k = 0; k < output_frame; k++ ) - { - buffer_tmp[j][k] += ( g2 * gains[j] + g1 * hIsmRendererData->prev_gains[i][j] ) * buffer_td[i][k]; - g2 += 1.f / ( output_frame - 1 ); - g1 = 1.0f - g2; - } - hIsmRendererData->prev_gains[i][j] = gains[j]; - } - } - - for ( j = 0; j < sba_num_chans; j++ ) - { - mvr2r( buffer_tmp[j], buffer_td[j], output_frame ); - } - - return; -} - - -/*-------------------------------------------------------------------* - * ivas_sba_linear_renderer() - * - * Linear rendering for SBA format - *-------------------------------------------------------------------*/ - -ivas_error ivas_sba_linear_renderer( - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t nchan_in, /* i : number of input ambisonics channels */ - const AUDIO_CONFIG output_config, /* i : output audio configuration */ - const IVAS_OUTPUT_SETUP output_setup, /* i : output format setup */ - const float hoa_dec_mtx[] /* i : HOA decoding mtx */ -) -{ - int16_t i; - float dmx_l; - int16_t nchan_hoa; - ivas_error error; - - error = IVAS_ERR_OK; - - /* Number of channels of HOA depends of transport format which is mixed order xH1V*/ - nchan_hoa = nchan_in; - - if ( nchan_in == 6 ) /*2H1V*/ - { - nchan_hoa = 9; - } - else if ( nchan_in == 8 ) /*3H1V*/ - { - nchan_hoa = 16; - } + float out_re[IVAS_SPAR_MAX_CH]; + float out_im[IVAS_SPAR_MAX_CH]; + float cldfb_par; + ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; - switch ( output_config ) - { - case AUDIO_CONFIG_MONO: - /* If stereo DMX, MONO = W = Cardioids L + R*/ - if ( nchan_in == 2 ) + for ( out_ch = firstOutCh; out_ch < outChEnd; out_ch++ ) { - for ( i = 0; i < output_frame; i++ ) - { - output_f[0][i] += output_f[1][i]; - } - } - /* else: do nothing, MONO = W*/ - break; - case AUDIO_CONFIG_STEREO: - assert( ( nchan_in >= 2 ) && "Number of input channels must be at least 2 (for W and Y)!\n" ); + out_re[out_ch] = 0.0f; + out_im[out_ch] = 0.0f; - /* Compute L and R cardioids from SB format except if stereo DMX is transmitted already in this format*/ - if ( nchan_in > 2 ) - { - /*Build L/R cardioids*/ - for ( i = 0; i < output_frame; i++ ) + for ( in_ch = firstInCh; in_ch < inChEnd; in_ch++ ) { - dmx_l = 0.5f * ( output_f[0][i] + output_f[1][i] ); /* cardioid_left = 0.5(W + Y) */ - output_f[1][i] = 0.5f * ( output_f[0][i] - output_f[1][i] ); /* cardioid_right = 0.5(W - Y) */ - output_f[0][i] = dmx_l; + if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ + { + spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; + cldfb_par = mixer_mat[out_ch][in_ch][spar_band]; + } + else + { + cldfb_par = 0.0f; + for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) + { + /* accumulate contributions from all SPAR bands */ + cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band]; + } + } + + out_re[out_ch] += inRe[in_ch][ts][cldfb_band] * cldfb_par; + out_im[out_ch] += inIm[in_ch][ts][cldfb_band] * cldfb_par; } } - break; - case AUDIO_CONFIG_5_1: - case AUDIO_CONFIG_7_1: - case AUDIO_CONFIG_5_1_2: - case AUDIO_CONFIG_5_1_4: - case AUDIO_CONFIG_7_1_4: - case AUDIO_CONFIG_LS_CUSTOM: - ivas_sba_mtx_mult( output_f, output_frame, nchan_hoa, output_setup, hoa_dec_mtx ); - break; - case AUDIO_CONFIG_FOA: /* Ambisonics output, order: 1 */ - case AUDIO_CONFIG_HOA2: /* Ambisonics output, order: 2 */ - case AUDIO_CONFIG_HOA3: /* Ambisonics output, order: 3 */ - for ( i = nchan_hoa; i < output_setup.nchan_out_woLFE; i++ ) + + /*update CLDFB data with the parameter-modified data*/ + for ( out_ch = firstOutCh; out_ch < outChEnd; out_ch++ ) { - set_zero( output_f[i], output_frame ); + inRe[out_ch][ts][cldfb_band] = out_re[out_ch]; + inIm[out_ch][ts][cldfb_band] = out_im[out_ch]; } - break; - default: - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: illegal output configuration, Exiting.\n" ); - } - - return error; -} - - -/*-------------------------------------------------------------------* - * ivas_sba_mtx_mult() - * - * HOA decoding with LFE insertion - *-------------------------------------------------------------------*/ - -void ivas_sba_mtx_mult( - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t nchan_in, /* i : Number of ambisonic channels */ - const IVAS_OUTPUT_SETUP output_setup, /* i : Output configuration */ - const float *mtx_hoa_decoder /* i : HOA decoding mtx */ -) -{ - int16_t i, k, ch_idx; - int16_t idx_lfe; - float input_f[16]; - const float *hoa_decoder; - - assert( ( nchan_in >= FOA_CHANNELS ) && "Number of input channels must be at least 4 (FOA)!\n" ); - - for ( i = 0; i < output_frame; i++ ) - { - /* init*/ - idx_lfe = 0; - hoa_decoder = &mtx_hoa_decoder[0]; - for ( k = 0; k < nchan_in; k++ ) - { - input_f[k] = output_f[k][i]; } - /* mtx mult with LFE insertion*/ - for ( ch_idx = 0; ch_idx < ( output_setup.nchan_out_woLFE + output_setup.num_lfe ); ch_idx++ ) + /* Update mixing matrices */ + if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) { - if ( ( output_setup.num_lfe > 0 ) && ( output_setup.index_lfe[idx_lfe] == ch_idx ) ) - { - /*LFE insertion*/ - output_f[ch_idx][i] = 0.f; - if ( idx_lfe < ( output_setup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else + /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ + int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME; + hSpar->i_subframe++; + hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) { - /*HOA decoding*/ - output_f[ch_idx][i] = input_f[0] * hoa_decoder[0]; - for ( k = 1; k < nchan_in; k++ ) + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - output_f[ch_idx][i] += input_f[k] * hoa_decoder[k]; + for ( b = 0; b < num_spar_bands; b++ ) + { + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; + } } - hoa_decoder += 16; } } } - return; -} - - -/*-------------------------------------------------------------------* - * ivas_sba_upmixer_renderer() - * - * SBA upmix & rendering - *-------------------------------------------------------------------*/ - -void ivas_sba_upmixer_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ - float output[][L_FRAME48k], /* i/o: transport/output audio channels */ - const int16_t output_frame /* i : output frame length */ -) -{ - int16_t i, nchan_internal; - float temp; - - push_wmops( "ivas_sba_upmixer_renderer" ); - - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order ); - - if ( st_ivas->nchan_transport >= 3 ) - { - /*convert WYZX downmix to WYXZ*/ - for ( i = 0; i < output_frame; i++ ) - { - temp = output[2][i]; - output[2][i] = output[3][i]; - output[3][i] = temp; - } - } - - /* Upmixer + Renderer */ - ivas_spar_dec_upmixer( st_ivas, output, nchan_internal, output_frame ); - - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) - { - ivas_sba_linear_renderer( output, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); - } - - pop_wmops(); - - return; -} - - -/*-------------------------------------------------------------------* - * ivas_sba_mix_matrix_determiner() - * - * Determine SBA mixing matrices - *-------------------------------------------------------------------*/ - -void ivas_sba_mix_matrix_determiner( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - float output[][L_FRAME48k], /* i/o: transport/output audio channels */ - const int16_t bfi, /* i : BFI flag */ - const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ - const int16_t output_frame /* i : output frame length */ -) -{ - int16_t i, ch; - float temp; - int16_t num_bands_out, nchan_transport, nchan_out; - - /* Convert numeric range */ - for ( ch = 0; ch < nchan_remapped; ch++ ) + /* Create prototypes */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { - for ( i = 0; i < output_frame; i++ ) + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - temp = output[ch][i]; - temp = floorf( temp + 0.5f ); - - if ( temp > MAX16B_FLT ) + if ( st_ivas->nchan_transport == 1 ) /* Dual mono */ { - temp = MAX16B_FLT; + mvr2r( inRe[0][ts], inRe[1][ts], CLDFB_NO_CHANNELS_MAX ); + mvr2r( inIm[0][ts], inIm[1][ts], CLDFB_NO_CHANNELS_MAX ); } - else if ( temp < ( -1.0f * PCM16_TO_FLT_FAC ) ) + else if ( st_ivas->nchan_transport == 2 ) /* Opposing cardioids */ { - temp = ( -1.0f * PCM16_TO_FLT_FAC ); - } - temp *= ( 1.0f / PCM16_TO_FLT_FAC ); - output[ch][i] = temp; - } - } + float temp_signal[CLDFB_NO_CHANNELS_MAX]; - /* AGC */ - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - nchan_out = nchan_transport; - ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); + v_add( inRe[0][ts], inRe[1][ts], temp_signal, CLDFB_NO_CHANNELS_MAX ); + v_sub( inRe[0][ts], inRe[1][ts], inRe[1][ts], CLDFB_NO_CHANNELS_MAX ); + mvr2r( temp_signal, inRe[0][ts], CLDFB_NO_CHANNELS_MAX ); + v_multc( inRe[0][ts], 0.5f, inRe[0][ts], CLDFB_NO_CHANNELS_MAX ); + v_multc( inRe[1][ts], 0.5f, inRe[1][ts], CLDFB_NO_CHANNELS_MAX ); - /* Convert numeric range back */ - for ( ch = 0; ch < nchan_out; ch++ ) - { - for ( i = 0; i < output_frame; i++ ) - { - output[ch][i] = output[ch][i] * PCM16_TO_FLT_FAC; + v_add( inIm[0][ts], inIm[1][ts], temp_signal, CLDFB_NO_CHANNELS_MAX ); + v_sub( inIm[0][ts], inIm[1][ts], inIm[1][ts], CLDFB_NO_CHANNELS_MAX ); + mvr2r( temp_signal, inIm[0][ts], CLDFB_NO_CHANNELS_MAX ); + v_multc( inIm[0][ts], 0.5f, inIm[0][ts], CLDFB_NO_CHANNELS_MAX ); + v_multc( inIm[1][ts], 0.5f, inIm[1][ts], CLDFB_NO_CHANNELS_MAX ); + } } } - /* Mixing matrix determiner */ - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; - ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, bfi ); + pop_wmops(); return; } +#endif - -/*-------------------------------------------------------------------* - * ivas_sba_prototype_renderer() - * - * Render prototype audio signals using SBA mixing matrices - *-------------------------------------------------------------------*/ - +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +void ivas_sba_prototype_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ + const int16_t subframe /* i : Subframe to render */ +) +#else void ivas_sba_prototype_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float inRe[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -599,6 +217,7 @@ void ivas_sba_prototype_renderer( const int16_t firstSubframe, /* i : First subframe to map */ const int16_t nSubframes /* i : Number of subframes to map */ ) +#endif { float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; SPAR_DEC_HANDLE hSpar; @@ -608,8 +227,15 @@ void ivas_sba_prototype_renderer( int16_t num_cldfb_bands, numch_in, numch_out; int16_t cldfb_band; int16_t out_ch, in_ch; +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS + int16_t firstInCh, inChEnd, firstOutCh, outChEnd; +#else int16_t firstSlot, slotEnd, firstInCh, inChEnd, firstOutCh, outChEnd; int16_t sf_idx; +#endif +#ifdef JBM_TSM_ON_TCS + int16_t slot_idx_start, md_idx; +#endif push_wmops( "ivas_sba_prototype_renderer" ); @@ -617,12 +243,16 @@ void ivas_sba_prototype_renderer( hDecoderConfig = st_ivas->hDecoderConfig; num_spar_bands = hSpar->hFbMixer->pFb->filterbank_num_bands; +#ifndef FIX_355_REFACTOR_PARAMBIN_TO_5MS firstSlot = firstSubframe * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); slotEnd = ( firstSubframe + nSubframes ) * ( CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES ); - +#endif num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; +#ifdef JBM_TSM_ON_TCS + slot_idx_start = hSpar->slots_rendered; +#endif if ( st_ivas->nchan_transport == 1 ) { @@ -640,6 +270,110 @@ void ivas_sba_prototype_renderer( } /* Apply mixing matrix */ +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +#ifdef JBM_TSM_ON_TCS + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) +#else + for ( ts = 0; ts < CLDFB_SLOTS_PER_SUBFRAME; ts++ ) +#endif + { + /* determine SPAR parameters for this time slot */ +#ifdef JBM_TSM_ON_TCS + md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; + ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); +#else + ivas_spar_get_parameters( hSpar, hDecoderConfig, ts + subframe * CLDFB_SLOTS_PER_SUBFRAME, numch_out, numch_in, num_spar_bands, mixer_mat ); +#endif + + for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) + { + float out_re[IVAS_SPAR_MAX_CH]; + float out_im[IVAS_SPAR_MAX_CH]; + float cldfb_par; + ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; + + for ( out_ch = firstOutCh; out_ch < outChEnd; out_ch++ ) + { + out_re[out_ch] = 0.0f; + out_im[out_ch] = 0.0f; + + for ( in_ch = firstInCh; in_ch < inChEnd; in_ch++ ) + { + if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ + { + spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; + cldfb_par = mixer_mat[out_ch][in_ch][spar_band]; + } + else + { + cldfb_par = 0.0f; + for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) + { + /* accumulate contributions from all SPAR bands */ + cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band]; + } + } + + out_re[out_ch] += inRe[in_ch][ts][cldfb_band] * cldfb_par; + out_im[out_ch] += inIm[in_ch][ts][cldfb_band] * cldfb_par; + } + } + + /*update CLDFB data with the parameter-modified data*/ + for ( out_ch = firstOutCh; out_ch < outChEnd; out_ch++ ) + { + inRe[out_ch][ts][cldfb_band] = out_re[out_ch]; + inIm[out_ch][ts][cldfb_band] = out_im[out_ch]; + } + } +#ifdef JBM_TSM_ON_TCS + /* Update mixing matrices */ + if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) + { + /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ + int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME; + hSpar->i_subframe++; + hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + { + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + { + for ( b = 0; b < num_spar_bands; b++ ) + { + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; + } + } + } + } +#endif + } + +#ifndef JBM_TSM_ON_TCS + /* Update mixing matrices */ + hSpar->i_subframe++; + hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + { + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + { + for ( b = 0; b < num_spar_bands; b++ ) + { + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + subframe * IVAS_MAX_NUM_BANDS]; + } + } + } +#endif +#else for ( ts = firstSlot; ts < slotEnd; ts++ ) { /* determine SPAR parameters for this time slot */ @@ -710,11 +444,20 @@ void ivas_sba_prototype_renderer( } } } +#endif /* Create prototypes */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { +#ifdef FIX_355_REFACTOR_PARAMBIN_TO_5MS +#ifdef JBM_TSM_ON_TCS + for ( ts = 0; ts < hSpar->subframe_nbslots[subframe]; ts++ ) +#else + for ( ts = 0; ts < CLDFB_SLOTS_PER_SUBFRAME; ts++ ) +#endif +#else for ( ts = firstSlot; ts < slotEnd; ts++ ) +#endif { if ( st_ivas->nchan_transport == 1 ) /* Dual mono */ { @@ -740,48 +483,11 @@ void ivas_sba_prototype_renderer( } } - pop_wmops(); - - return; -} - -#ifdef DEBUG_MODE_DIRAC -/*-----------------------------------------------------------------------* - * Debugging function - *-----------------------------------------------------------------------*/ - -static void debug_mode_dirac( - float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], - const int16_t nchan_transport, - const int16_t output_frame ) -{ - int16_t i, n; - int16_t tmp[L_FRAME48k]; - char file_name[50] = { 0 }; - -#ifdef DEBUG_MODE_DIRAC_NOCORE - for ( n = 0; n < nchan_transport; n++ ) - { - sprintf( file_name, "./res/ivas_dirac_enc_%d.%d.pcm", n, (int16_t) ( output_frame * 0.05 ) ); - dbgread( tmp, sizeof( int16_t ), output_frame, file_name ); - for ( i = 0; i < output_frame; i++ ) - { - output[n][i] = (float) ( tmp[i] ); - } - } -#else - for ( n = 0; n < nchan_transport; n++ ) - { - for ( i = 0; i < output_frame; i++ ) - { - tmp[i] = (int16_t) ( output[n][i] + 0.5f ); - } - - sprintf( file_name, "./res/ivas_dirac_dec_%d.%d.pcm", n, (int16_t) ( output_frame * 0.05 ) ); - dbgwrite( tmp, sizeof( int16_t ), output_frame, 1, file_name ); - } +#ifdef JBM_TSM_ON_TCS + hSpar->subframes_rendered++; + hSpar->slots_rendered += hSpar->subframe_nbslots[subframe]; #endif + pop_wmops(); return; } -#endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 975656dffb1eaf1eb2cb91c98fc89dec0b10aa7b..a3308e23c21e39a73a6ef9554257a9fdf52f7af2 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -34,122 +34,40 @@ #define IVAS_STAT_REND_H #include -#ifdef FIX_197_CREND_INTERFACE -#include "cnst.h" +#include "options.h" #include "ivas_cnst.h" -#include "ivas_stat_com.h" -#include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think -#endif - -#define MAX_SPEAKERS 12 /* Max number of speakers (including LFE) in a channel-based config */ - - -#ifdef FIX_197_CREND_INTERFACE - -#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // todo (Marc) -> renanr IVAS_RENDERER_HEAD_POSITIONS_PER_FRAME ? - -typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -typedef struct -{ - int16_t numSamplesPerChannel; - int16_t numChannels; -} IVAS_REND_AudioBufferConfig; - -typedef struct -{ - IVAS_REND_AudioBufferConfig config; - float *data; -} IVAS_REND_AudioBuffer; - -typedef struct -{ - IVAS_REND_AudioBufferConfig config; - const float *data; -} IVAS_REND_ReadOnlyAudioBuffer; +#include "ivas_stat_com.h" // note: needed for DIRAC_DEC_BIN_HANDLE until #156 is solved +#include "common_api_types.h" -typedef struct -{ - float azimuth; - float elevation; -} IVAS_REND_AudioObjectPosition; -typedef struct IVAS_REND *IVAS_REND_HANDLE; -typedef struct IVAS_REND const *IVAS_REND_CONST_HANDLE; +/*----------------------------------------------------------------------------------* + * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) + *----------------------------------------------------------------------------------*/ -typedef enum -{ - IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED = 0, - IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS, - IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED, - IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL, - IVAS_REND_AUDIO_CONFIG_TYPE_MASA, - IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN, -} IVAS_REND_AudioConfigType; - -/* TODO(sgi): Harmonize with AUDIO_CONFIG */ -/* - Note: numerical values carry specific information here. - - MSB LSB - -------------------------------------------------------------------------------- - ... unused (assumed all 0) ... | config type (1 byte) | config variant (1 byte) | - -------------------------------------------------------------------------------- - - Where "config type" is the general type from the following list: - - unknown - - channel-based - - ambisonics - - object-based - - binaural - - MASA - - Config variants are concrete configs of each type. - */ -typedef enum +typedef struct ivas_output_setup_structure { - IVAS_REND_AUDIO_CONFIG_MONO = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 0, - IVAS_REND_AUDIO_CONFIG_STEREO = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 1, - IVAS_REND_AUDIO_CONFIG_5_1 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 2, - IVAS_REND_AUDIO_CONFIG_7_1 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 3, - IVAS_REND_AUDIO_CONFIG_5_1_2 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 4, - IVAS_REND_AUDIO_CONFIG_5_1_4 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 5, - IVAS_REND_AUDIO_CONFIG_7_1_4 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 6, - IVAS_REND_AUDIO_CONFIG_LS_CUSTOM = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 255, - - IVAS_REND_AUDIO_CONFIG_FOA = IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS << 8 | 0, - IVAS_REND_AUDIO_CONFIG_HOA2 = IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS << 8 | 1, - IVAS_REND_AUDIO_CONFIG_HOA3 = IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS << 8 | 2, - - IVAS_REND_AUDIO_CONFIG_OBJECT = IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED << 8 | 0, - - IVAS_REND_AUDIO_CONFIG_BINAURAL = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 0, - IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, - - IVAS_REND_AUDIO_CONFIG_MASA1 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA << 8 | 0, - IVAS_REND_AUDIO_CONFIG_MASA2 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA << 8 | 1, + AUDIO_CONFIG output_config; + int16_t nchan_out_woLFE; /* number of output audio channels without LFE */ + int16_t ambisonics_order; + int8_t is_loudspeaker_setup; + int8_t is_planar_setup; + int8_t is_binaural_setup; - IVAS_REND_AUDIO_CONFIG_UNKNOWN = IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN << 8 | 0, -} IVAS_REND_AudioConfig; + int16_t num_lfe; + int16_t index_lfe[1]; + const float *ls_azimuth; + const float *ls_elevation; -typedef uint16_t IVAS_REND_InputId; + uint8_t separateChannelEnabled; + int16_t separateChannelIndex; -typedef struct -{ - int16_t numLfeChannels; - float lfeOutputGains[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -} IVAS_REND_LfeRouting; +} IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; -typedef struct -{ - int8_t headRotEnabled; - IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; - float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; -} IVAS_REND_HeadRotData; /*----------------------------------------------------------------------------------* - * Binaural Rendering structure + * Binaural FastConv Rendering structure *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? + /* Binaural reverberator structure */ typedef struct ivas_binaural_reverb_struct { @@ -188,44 +106,6 @@ typedef struct ivas_binaural_reverb_struct } REVERB_STRUCT, *REVERB_STRUCT_HANDLE; -/* AGC structure */ -typedef struct ivas_agc_dec_chan_state_t -{ - float lastGain; - int16_t gainExpVal; - -} ivas_agc_dec_chan_state_t; - -typedef struct ivas_agc_dec_state_t -{ - ivas_agc_com_state_t agc_com; - ivas_agc_dec_chan_state_t *gain_state; - ivas_agc_chan_data_t *gain_data; - -} ivas_agc_dec_state_t; - -/* TD decorr */ -typedef struct ivas_td_decorr_APD_filt_state_t -{ - int16_t order[IVAS_MAX_DECORR_APD_SECTIONS]; - int16_t idx[IVAS_MAX_DECORR_APD_SECTIONS]; - float coeffs[IVAS_MAX_DECORR_APD_SECTIONS]; - float *state[IVAS_MAX_DECORR_APD_SECTIONS]; - -} ivas_td_decorr_APD_filt_state_t; - -typedef struct ivas_td_decorr_state_t -{ - ivas_trans_det_state_t *pTrans_det; - float *look_ahead_buf; - ivas_td_decorr_APD_filt_state_t APD_filt_state[IVAS_MAX_DECORR_CHS]; - - int16_t num_apd_outputs; - int16_t num_apd_sections; - int16_t ducking_flag; - -} ivas_td_decorr_state_t; - /* Parametric binaural data structure */ typedef struct ivas_dirac_dec_binaural_data_structure { @@ -260,6 +140,7 @@ typedef struct ivas_dirac_dec_binaural_data_structure uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ uint16_t useTdDecorr; ivas_td_decorr_state_t *hTdDecorr; + float reqularizationFactor; } DIRAC_DEC_BIN_DATA, *DIRAC_DEC_BIN_HANDLE; @@ -278,32 +159,11 @@ typedef struct ivas_binaural_rendering_conv_module_struct } BINRENDERER_CONV_MODULE, *BINRENDERER_CONV_MODULE_HANDLE; -/*----------------------------------------------------------------------------------* - * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) - *----------------------------------------------------------------------------------*/ -typedef struct ivas_output_setup_structure -{ - AUDIO_CONFIG output_config; - int16_t nchan_out_woLFE; /* number of output audio channels without LFE */ - int16_t ambisonics_order; - int8_t is_loudspeaker_setup; - int8_t is_planar_setup; - int8_t is_binaural_setup; - - int16_t num_lfe; - int16_t index_lfe[1]; - const float *ls_azimuth; - const float *ls_elevation; - - uint8_t separateChannelEnabled; - int16_t separateChannelIndex; - -} IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; /*----------------------------------------------------------------------------------* * EFAP structures *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? + typedef struct EFAP_VERTEX { float azi; /* azimuth of the loudspeaker */ @@ -362,110 +222,43 @@ typedef struct EFAP } EFAP, *EFAP_HANDLE; - /*----------------------------------------------------------------------------------* - * VBAP structures + * Orientation tracking structure *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -enum SpeakerNodeGroup -{ - SPEAKER_NODE_BOTTOM_HALF, - SPEAKER_NODE_HORIZONTAL, - SPEAKER_NODE_TOP_HALF, - SPEAKER_NODE_BACK, - SPEAKER_NODE_ALL -}; - -/* Defines a single virtual surface triplet of loudspeakers - * with a precalculated inverse matrix */ -typedef struct vbap_vs_triplet_structure -{ - uint8_t speaker_node[3]; - float inverse_matrix[3][3]; - -} VBAP_VS_TRIPLET; - -/* Defines a single speaker node */ -typedef struct vbap_speaker_node_structure -{ - float azi_deg; - float ele_deg; - float unit_vec[3]; - enum SpeakerNodeGroup group; -} VBAP_SPEAKER_NODE; - -/* Storage structure for fast runtime triplet search */ -typedef struct triplet_search_structure -{ - VBAP_VS_TRIPLET *triplets; - int16_t num_triplets; - int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS]; - -} VBAP_SEARCH_STRUCT; - -/* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */ -typedef struct vbap_data_structure +typedef struct ivas_orient_trk_state_t { - VBAP_SEARCH_STRUCT search_struct[2]; /* Default to max two groups in this implementation */ - int16_t num_search_structs; - int16_t num_speaker_nodes; - int16_t num_speaker_nodes_internal; - int16_t top_virtual_speaker_node_index; /* These indices can be negative */ - int16_t bottom_virtual_speaker_node_index; - int16_t back_virtual_speaker_node_index; - float *bottom_virtual_speaker_node_division_gains; - float *top_virtual_speaker_node_division_gains; - float *back_virtual_speaker_node_division_gains; + OTR_TRACKING_T trackingType; + float centerAdaptationRate; + float offCenterAdaptationRate; + float adaptationAngle; -} VBAP_DATA, *VBAP_HANDLE; + float alpha; + IVAS_QUATERNION absAvgRot; /* average absolute orientation */ + IVAS_QUATERNION refRot; /* reference orientation */ + IVAS_QUATERNION trkRot; /* tracked rotation */ +} ivas_orient_trk_state_t; /*----------------------------------------------------------------------------------* - * renderer structures + * Head rotation data structure *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -typedef struct renderer_struct -{ - float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS]; - float interpolator[L_FRAME48k]; - -} ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; -/* Fastconv binaural data structure */ -typedef struct ivas_binaural_rendering_struct +typedef struct { - /* Common variables for all modules */ - IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/ - EFAP_HANDLE hEFAPdata; /* EFAP structure*/ - float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ - int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ - int16_t max_band; /* band upto which rendering is performed */ - int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ - int16_t timeSlots; /* number of time slots of binaural renderer */ - int16_t nInChannels; /* number input channels */ - int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ - IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ - - /* Convolution module structure */ - BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; - - /* Variables related to reverb module */ - float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; - REVERB_STRUCT_HANDLE hReverb; - -} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; - + int8_t headRotEnabled; + IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; + IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME]; + float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; + ivas_orient_trk_state_t *hOrientationTracker; -/*----------------------------------------------------------------------------------* - * Head tracking data structure - *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? +} IVAS_REND_HeadRotData; typedef struct ivas_binaural_head_track_struct { int16_t num_quaternions; IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; + IVAS_VECTOR3 Pos[MAX_PARAM_SPATIAL_SUBFRAMES]; float Rmat[3][3]; float Rmat_prev[3][3]; @@ -473,10 +266,17 @@ typedef struct ivas_binaural_head_track_struct uint8_t lrSwitchedCurrent; float lrSwitchInterpVal; + float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ + float procChEneIIR[2][MASA_FREQUENCY_BANDS]; + int16_t shd_rot_max_order; + ivas_orient_trk_state_t *OrientationTracker; } HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; +/*----------------------------------------------------------------------------------* + * Reverberator structure + *----------------------------------------------------------------------------------*/ /* Reverberator structures */ @@ -500,10 +300,10 @@ typedef struct ivas_render_config_t ivas_renderTypeOverride renderer_type_override; #endif ivas_roomAcoustics_t roomAcoustics; + float directivity[3]; } RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; - typedef struct ivas_rev_delay_line_t { float *pBuffer; @@ -549,7 +349,6 @@ typedef struct ivas_reverb_fft_filter_t } ivas_reverb_fft_filter_t; - typedef struct ivas_reverb_state_t { RENDER_CONFIG_DATA pConfig; @@ -584,39 +383,10 @@ typedef struct ivas_reverb_state_t } REVERB_DATA, *REVERB_HANDLE; -typedef struct ivas_orient_trk_state_t -{ - OTR_TRACKING_T trackingType; - float centerAdaptationRate; - float offCenterAdaptationRate; - float adaptationAngle; - - float alpha; - - float absYaw; /* absolute orientation */ - float absPitch; - float absRoll; - - float absAvgYaw; /* average absolute orientation */ - float absAvgPitch; - float absAvgRoll; - - float refYaw; /* reference orientation */ - float refPitch; - float refRoll; - - float trkYaw; /* tracked orientation */ - float trkPitch; - float trkRoll; - -} ivas_orient_trk_state_t; - - /*----------------------------------------------------------------------------------* - * TD ISm Object Renderer structure + * TD ISM Object Renderer structure *----------------------------------------------------------------------------------*/ - typedef struct { int16_t modelROM; /* Flag that indicates that the model resides in ROM (controls init/dealloc). */ @@ -758,10 +528,10 @@ typedef struct TDREND_HRFILT_FiltSet_struct ModelEval_t ModelEval; ModelParamsITD_t ModelParamsITD; TDREND_HRFILT_Method_t FilterMethod; /* HR filtering method */ + float latency_s; } TDREND_HRFILT_FiltSet_t; - /* Distance attenuation */ typedef struct { @@ -789,7 +559,6 @@ typedef struct } TDREND_MixSpatSpec_t; - typedef struct TDREND_SRC_REND_s { int16_t InputAvailable; @@ -835,6 +604,9 @@ typedef struct float mem_hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; float mem_hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; float Gain; +#ifdef FIX_379_GAININTP + float prevGain; +#endif } TDREND_SRC_t; /* Top level TD binaural renderer handle */ @@ -857,10 +629,19 @@ typedef struct ivas_binaural_td_rendering_struct } BINAURAL_TD_OBJECT_RENDERER, *BINAURAL_TD_OBJECT_RENDERER_HANDLE; +typedef struct +{ + int32_t binaural_latency_ns; + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; + TDREND_HRFILT_FiltSet_t *hHrtfTD; + +} TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE; + + /*------------------------------------------------------------------------------------------* * Crend structures *------------------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? + typedef struct ivas_hrtfs_structure { float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; @@ -906,12 +687,13 @@ typedef struct ivas_binaural_crend_wrapper_struct int32_t binaural_latency_ns; CREND_HANDLE hCrend; HRTFS_HANDLE hHrtfCrend; -} CREND_WRAPPER, *CREND_WRAPPER_HANDLE; +} CREND_WRAPPER, *CREND_WRAPPER_HANDLE; -#ifdef HRTF_BINARY_FILE -/* htrfs from binary files. */ +/*------------------------------------------------------------------------------------------* + * HRTF structures - htrfs from binary files + *------------------------------------------------------------------------------------------*/ typedef struct ivas_hrtfs_crend_structure { @@ -921,27 +703,9 @@ typedef struct ivas_hrtfs_crend_structure } HRTFS_CREND, *HRTFS_CREND_HANDLE; -typedef struct ivas_hrtfs_header_t -{ - int32_t rend_type; - int32_t input_cfg; - int32_t frequency; - uint32_t data_size; - -} ivas_hrtfs_header_t; - -typedef struct ivas_hrtfs_file_header_t -{ - char identifier[8]; - int32_t file_size; - int16_t nb_hrtf; - int32_t max_data_size; - -} ivas_hrtfs_file_header_t; -#endif +/* Fastconv binaural data structure */ -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_fastconv_struct { float FASTCONV_HRIR_latency_s; @@ -964,11 +728,10 @@ typedef struct ivas_hrtfs_fastconv_struct float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; + } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; -#endif -#ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_parambin_struct { float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; @@ -977,30 +740,8 @@ typedef struct ivas_hrtfs_parambin_struct float parametricReverberationTimes[CLDFB_NO_CHANNELS_MAX]; float parametricReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; -} HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; - -#endif -/*----------------------------------------------------------------------------------* - * LFE decoder structure - *----------------------------------------------------------------------------------*/ - -typedef struct ivas_lfe_dec_data_structure -{ - ivas_filters_process_state_t filter_state; - LFE_WINDOW_HANDLE pWindow_state; - const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; - int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; - float lfe_block_delay_s; - int16_t lfe_prior_buf_len; - float *prior_out_buffer; - - float *prevsynth_buf; - float *lfe_delay_buf; - int16_t lfe_addl_delay; - int16_t bfi_count; - -} LFE_DEC_DATA, *LFE_DEC_HANDLE; +} HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; /*----------------------------------------------------------------------------------* @@ -1024,40 +765,6 @@ typedef struct } IVAS_LIMITER, *IVAS_LIMITER_HANDLE; -/*----------------------------------------------------------------------------------* - * Decoder configuration structure - *----------------------------------------------------------------------------------*/ - -typedef struct decoder_config_structure -{ - int32_t ivas_total_brate; /* IVAS total bitrate in bps */ - int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ - int32_t output_Fs; /* output signal sampling frequency in Hz */ - int16_t nchan_out; /* number of output audio channels */ - AUDIO_CONFIG output_config; /* output audio configuration */ - int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ - int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ - int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ - int16_t orientation_tracking; /* indicates orientation tracking type */ - float no_diegetic_pan; - int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ - - /* temp. development parameters */ -#ifdef DEBUGGING - int16_t forceSubframeBinauralization; /* Flag for forcing Parametric binauralizer to subframe mode */ - int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ -#endif - -} DECODER_CONFIG, *DECODER_CONFIG_HANDLE; - -typedef struct -{ - int32_t binaural_latency_ns; - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; - TDREND_HRFILT_FiltSet_t *hHrtfTD; -} TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE; -#endif - /*----------------------------------------------------------------------------------* * Loudspeaker Configuration Conversion structure *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c3b3ef07c285b1d58ffcbc838be71ff5c94172ab..d82e00c067b188c43a54804ba1e5acc5b870c75d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -31,25 +31,22 @@ *******************************************************************************************************/ #include "options.h" -#include "ivas_cnst.h" #include "lib_rend.h" +#include "prot.h" #include "ivas_prot.h" +#include "ivas_prot_rend.h" +#include "ivas_cnst.h" #include "ivas_rom_com.h" -#include "ivas_rom_dec.h" #include "ivas_rom_rend.h" -#include "ivas_lib_rend_internal.h" -#ifdef FIX_197_CREND_INTERFACE -#include "lib_rend.h" -#endif -#include "prot.h" -#include "wmc_auto.h" - #include #include #include -#include -#include -#include +#include "wmc_auto.h" + + +/*-------------------------------------------------------------------* + * Local constants + *-------------------------------------------------------------------*/ /* Maximum buffer length (per channel) in samples. * Keep this separate from L_FRAME48k in case we want to support different size later */ @@ -62,6 +59,10 @@ #define BINAURAL_RENDERING_FRAME_SIZE_MS 20 +/*-------------------------------------------------------------------* + * Local types + *-------------------------------------------------------------------*/ + typedef float pan_vector[MAX_OUTPUT_CHANNELS]; typedef float pan_matrix[MAX_INPUT_CHANNELS][MAX_OUTPUT_CHANNELS]; typedef float rotation_gains[MAX_INPUT_CHANNELS][MAX_INPUT_CHANNELS]; @@ -114,12 +115,13 @@ typedef struct IVAS_REND_AudioObjectPosition currentPos; IVAS_REND_AudioObjectPosition previousPos; TDREND_WRAPPER tdRendWrapper; -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE crendWrapper; -#else - CREND_WRAPPER crendWrapper; -#endif + REVERB_HANDLE hReverb; rotation_matrix rot_mat_prev; +#ifdef NON_DIEGETIC_PAN + int16_t nonDiegeticPan; + float nonDiegeticPanGain; +#endif } input_ism; typedef struct @@ -143,12 +145,13 @@ typedef struct LSSETUP_CUSTOM_STRUCT customLsInput; EFAP_WRAPPER efapInWrapper; TDREND_WRAPPER tdRendWrapper; -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE crendWrapper; -#else - CREND_WRAPPER crendWrapper; -#endif + REVERB_HANDLE hReverb; rotation_gains rot_gains_prev; +#ifdef NON_DIEGETIC_PAN + int16_t nonDiegeticPan; + float nonDiegeticPanGain; +#endif lfe_routing lfeRouting; } input_mc; @@ -156,11 +159,7 @@ typedef struct { input_base base; pan_matrix hoaDecMtx; -#ifdef FIX_197_CREND_INTERFACE CREND_WRAPPER_HANDLE crendWrapper; -#else - CREND_WRAPPER crendWrapper; -#endif rotation_gains rot_gains_prev; } input_sba; @@ -202,6 +201,11 @@ struct IVAS_REND RENDER_CONFIG_DATA *hRendererConfig; /* Renderer config pointer */ }; + +/*-------------------------------------------------------------------* + * Local functions + *-------------------------------------------------------------------*/ + static IVAS_QUATERNION quaternionInit( void ) { @@ -213,8 +217,8 @@ static IVAS_QUATERNION quaternionInit( static float *getSmplPtr( IVAS_REND_AudioBuffer buffer, - uint32_t chnlIdx, - uint32_t smplIdx ) + const uint32_t chnlIdx, + const uint32_t smplIdx ) { return buffer.data + chnlIdx * buffer.config.numSamplesPerChannel + smplIdx; } @@ -263,8 +267,6 @@ static void accumulate2dArrayToBuffer( * limitRendererOutput() * * In-place saturation control for multichannel buffers with adaptive release time - * - * *-------------------------------------------------------------------*/ /*! r: number of clipped output samples */ @@ -312,11 +314,14 @@ static int32_t limitRendererOutput( return numClipping; } -#ifdef FIX_197_CREND_INTERFACE + +/*-------------------------------------------------------------------* + * getIvasAudioConfigFromRendAudioConfig() + * + * + *-------------------------------------------------------------------*/ + AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( -#else -static AUDIO_CONFIG rendAudioConfigToIvasAudioConfig( // VE2AT: similar is defined again at line 397, why? -#endif IVAS_REND_AudioConfig rendConfig ) { switch ( rendConfig ) @@ -360,6 +365,53 @@ static AUDIO_CONFIG rendAudioConfigToIvasAudioConfig( // VE2AT: similar is defin return AUDIO_CONFIG_INVALID; } +/*-------------------------------------------------------------------* + * getRendAudioConfigFromIvasAudioConfig() + * + * + *-------------------------------------------------------------------*/ + +IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( + AUDIO_CONFIG config ) +{ + switch ( config ) + { + case AUDIO_CONFIG_MONO: + return IVAS_REND_AUDIO_CONFIG_MONO; + case AUDIO_CONFIG_STEREO: + return IVAS_REND_AUDIO_CONFIG_STEREO; + case AUDIO_CONFIG_BINAURAL: + return IVAS_REND_AUDIO_CONFIG_BINAURAL; + case AUDIO_CONFIG_BINAURAL_ROOM: + return IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM; + case AUDIO_CONFIG_5_1: + return IVAS_REND_AUDIO_CONFIG_5_1; + case AUDIO_CONFIG_7_1: + return IVAS_REND_AUDIO_CONFIG_7_1; + case AUDIO_CONFIG_5_1_2: + return IVAS_REND_AUDIO_CONFIG_5_1_2; + case AUDIO_CONFIG_5_1_4: + return IVAS_REND_AUDIO_CONFIG_5_1_4; + case AUDIO_CONFIG_7_1_4: + return IVAS_REND_AUDIO_CONFIG_7_1_4; + case AUDIO_CONFIG_FOA: + return IVAS_REND_AUDIO_CONFIG_FOA; + case AUDIO_CONFIG_HOA2: + return IVAS_REND_AUDIO_CONFIG_HOA2; + case AUDIO_CONFIG_HOA3: + return IVAS_REND_AUDIO_CONFIG_HOA3; + default: + break; + } + return IVAS_REND_AUDIO_CONFIG_UNKNOWN; +} + +/*-------------------------------------------------------------------* + * validateOutputAudioConfig() + * + * + *-------------------------------------------------------------------*/ + static ivas_error validateOutputAudioConfig( IVAS_REND_AudioConfig outConfig ) { @@ -386,13 +438,27 @@ static ivas_error validateOutputAudioConfig( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } + +/*-------------------------------------------------------------------* + * getAudioConfigType() + * + * + *-------------------------------------------------------------------*/ + IVAS_REND_AudioConfigType getAudioConfigType( IVAS_REND_AudioConfig config ) { /* By definition, config type is the second byte (from LSB) of IVAS_REND_AudioConfig enum. */ - return ( config & 0xFF00 ) >> 8; // VE2AT: MSVC returns warning C4244: 'return': conversion from 'int' to 'IVAS_REND_InputId', possible loss of data + return ( config & 0xFF00 ) >> 8; } + +/*-------------------------------------------------------------------* + * validateOutputSampleRate() + * + * + *-------------------------------------------------------------------*/ + static ivas_error validateOutputSampleRate( const int32_t sampleRate, const IVAS_REND_AudioConfig outConfig ) @@ -416,6 +482,13 @@ static ivas_error validateOutputSampleRate( return IVAS_ERR_INVALID_SAMPLING_RATE; } + +/*-------------------------------------------------------------------* + * getAudioConfigNumChannels() + * + * + *-------------------------------------------------------------------*/ + ivas_error getAudioConfigNumChannels( const IVAS_REND_AudioConfig config, int16_t *numChannels ) @@ -462,76 +535,10 @@ ivas_error getAudioConfigNumChannels( return IVAS_ERR_OK; } -#ifdef FIX_197_CREND_INTERFACE -IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( - AUDIO_CONFIG config ) -#else -AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( - IVAS_REND_AudioConfig config ) -#endif -{ - switch ( config ) - { -#ifdef FIX_197_CREND_INTERFACE - case AUDIO_CONFIG_MONO: - return IVAS_REND_AUDIO_CONFIG_MONO; - case AUDIO_CONFIG_STEREO: - return IVAS_REND_AUDIO_CONFIG_STEREO; - case AUDIO_CONFIG_BINAURAL: - return IVAS_REND_AUDIO_CONFIG_BINAURAL; - case AUDIO_CONFIG_BINAURAL_ROOM: - return IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM; - case AUDIO_CONFIG_5_1: - return IVAS_REND_AUDIO_CONFIG_5_1; - case AUDIO_CONFIG_7_1: - return IVAS_REND_AUDIO_CONFIG_7_1; - case AUDIO_CONFIG_5_1_2: - return IVAS_REND_AUDIO_CONFIG_5_1_2; - case AUDIO_CONFIG_5_1_4: - return IVAS_REND_AUDIO_CONFIG_5_1_4; - case AUDIO_CONFIG_7_1_4: - return IVAS_REND_AUDIO_CONFIG_7_1_4; - case AUDIO_CONFIG_FOA: - return IVAS_REND_AUDIO_CONFIG_FOA; - case AUDIO_CONFIG_HOA2: - return IVAS_REND_AUDIO_CONFIG_HOA2; - case AUDIO_CONFIG_HOA3: - return IVAS_REND_AUDIO_CONFIG_HOA3; - default: - break; - } - return IVAS_REND_AUDIO_CONFIG_UNKNOWN; -#else - case IVAS_REND_AUDIO_CONFIG_MONO: - return AUDIO_CONFIG_MONO; - case IVAS_REND_AUDIO_CONFIG_STEREO: - return AUDIO_CONFIG_STEREO; - case IVAS_REND_AUDIO_CONFIG_BINAURAL: - return AUDIO_CONFIG_BINAURAL; - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: - return AUDIO_CONFIG_BINAURAL_ROOM; - case IVAS_REND_AUDIO_CONFIG_5_1: - return AUDIO_CONFIG_5_1; - case IVAS_REND_AUDIO_CONFIG_7_1: - return AUDIO_CONFIG_7_1; - case IVAS_REND_AUDIO_CONFIG_5_1_2: - return AUDIO_CONFIG_5_1_2; - case IVAS_REND_AUDIO_CONFIG_5_1_4: - return AUDIO_CONFIG_5_1_4; - case IVAS_REND_AUDIO_CONFIG_7_1_4: - return AUDIO_CONFIG_7_1_4; - case IVAS_REND_AUDIO_CONFIG_FOA: - return AUDIO_CONFIG_FOA; - case IVAS_REND_AUDIO_CONFIG_HOA2: - return AUDIO_CONFIG_HOA2; - case IVAS_REND_AUDIO_CONFIG_HOA3: - return AUDIO_CONFIG_HOA3; - default: - break; - } - return AUDIO_CONFIG_INVALID; -#endif -} + +/*-------------------------------------------------------------------* + * Local functions + *-------------------------------------------------------------------*/ static ivas_error initLimiter( IVAS_LIMITER_HANDLE *phLimiter, @@ -552,10 +559,9 @@ static ivas_error initLimiter( ivas_limiter_close( phLimiter ); } - *phLimiter = ivas_limiter_open( (int16_t) numChannels, sampleRate ); - if ( *phLimiter == NULL ) + if ( ( *phLimiter = ivas_limiter_open( numChannels, sampleRate ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter" ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); } return IVAS_ERR_OK; @@ -821,14 +827,17 @@ static ivas_error initEfap( { return error; } + if ( ( error = getSpeakerElevations( pEfapWrapper->speakerConfig, &elevations ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = getNumNonLfeChannelsInSpeakerLayout( pEfapWrapper->speakerConfig, &numNonLfeChannels ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = efap_init_data( &pEfapWrapper->hEfap, azimuths, elevations, numNonLfeChannels, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { return error; @@ -900,11 +909,12 @@ static ivas_error getEfapGains( return IVAS_ERR_OK; } -static void initHeadRotation( +static ivas_error initHeadRotation( IVAS_REND_HANDLE hIvasRend ) { int16_t i, crossfade_len; float tmp; + ivas_error error; /* Head rotation is enabled by default */ hIvasRend->headRotData.headRotEnabled = 1; @@ -923,6 +933,27 @@ static void initHeadRotation( hIvasRend->headRotData.headPositions[i] = quaternionInit(); } + if ( ( hIvasRend->headRotData.hOrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Orientation tracking" ); + } + + if ( ( error = ivas_orient_trk_Init( hIvasRend->headRotData.hOrientationTracker ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; +} + +static void closeHeadRotation( + IVAS_REND_HANDLE hIvasRend ) +{ + if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) + { + free( hIvasRend->headRotData.hOrientationTracker ); + } + return; } @@ -984,6 +1015,12 @@ static IVAS_REND_AudioObjectPosition defaultObjectPosition( pos.azimuth = 0.0f; pos.elevation = 0.0f; + pos.radius = 1.0f; + pos.yaw = 0.0f; + pos.pitch = 0.0f; +#ifdef ISM_NON_DIEGETIC_PAN + pos.non_diegetic_flag = 0; +#endif return pos; } @@ -1029,6 +1066,21 @@ static CREND_WRAPPER defaultCrendWrapper( return w; } +static bool isIoConfigPairSupported( + IVAS_REND_AudioConfig inConfig, + IVAS_REND_AudioConfig outConfig ) +{ + /* Rendering mono or stereo to binaural is not supported */ + if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_MONO || inConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) && + getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) + { + return false; + } + + /* If not returned so far, config pair is supported */ + return true; +} + static ivas_error setRendInputActiveIsm( void *input, const IVAS_REND_AudioConfig inConfig, @@ -1044,40 +1096,50 @@ static ivas_error setRendInputActiveIsm( rendCtx = inputIsm->base.ctx; outConfig = *rendCtx.pOutConfig; + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } + initRendInputBase( &inputIsm->base, inConfig, id, rendCtx ); inputIsm->currentPos = defaultObjectPosition(); inputIsm->previousPos = defaultObjectPosition(); -#ifdef FIX_197_CREND_INTERFACE inputIsm->crendWrapper = NULL; -#else - inputIsm->crendWrapper = defaultCrendWrapper(); -#endif + inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); initRotMatrix( inputIsm->rot_mat_prev ); error = IVAS_ERR_OK; if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ) { - error = ivas_rend_TDObjRendOpen( &inputIsm->tdRendWrapper, inConfig, NULL, *rendCtx.pOutSampleRate ); + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { - error = ivas_rend_openCrend( &inputIsm->crendWrapper, - IVAS_REND_AUDIO_CONFIG_7_1_4, - outConfig, - hRendCfg, -#ifdef FIX_197_CREND_INTERFACE - 0, -#endif -#ifdef HRTF_BINARY_FILE - NULL, -#endif - *rendCtx.pOutSampleRate ); - } - if ( error != IVAS_ERR_OK ) - { - return error; + if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) + { + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, + NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } } return IVAS_ERR_OK; @@ -1093,19 +1155,18 @@ static void clearInputIsm( initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); /* Free input's internal handles */ -#ifdef FIX_197_CREND_INTERFACE - if ( inputIsm->crendWrapper != NULL ) -#else - if ( inputIsm->crendWrapper.hCrend != NULL ) -#endif - { - ivas_rend_closeCrend( &inputIsm->crendWrapper ); - } + + ivas_rend_closeCrend( &inputIsm->crendWrapper ); + + ivas_reverb_close( &inputIsm->hReverb ); + if ( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); inputIsm->tdRendWrapper.hHrtfTD = NULL; } + + return; } static void copyLsConversionMatrixToPanMatrix( @@ -1155,6 +1216,8 @@ static void fillIdentityPanMatrix( { panMatrix[i][i] = 1.0f; } + + return; } static ivas_error initMcPanGainsWithIdentMatrix( @@ -1172,20 +1235,14 @@ static ivas_error initMcPanGainsWithConversionMapping( AUDIO_CONFIG ivasConfigIn, ivasConfigOut; int16_t i; -#ifdef FIX_197_CREND_INTERFACE ivasConfigIn = getIvasAudioConfigFromRendAudioConfig( inputMc->base.inConfig ); ivasConfigOut = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - ivasConfigIn = rendAudioConfigToIvasAudioConfig( inputMc->base.inConfig ); - ivasConfigOut = rendAudioConfigToIvasAudioConfig( outConfig ); -#endif /* Find conversion mapping for current I/O config pair. * Stay with default panning matrix if conversion_matrix is NULL */ for ( i = 0; i < LS_SETUP_CONVERSION_NUM_MAPPINGS; ++i ) { - if ( ls_conversion_mapping[i].input_config == ivasConfigIn && - ls_conversion_mapping[i].output_config == ivasConfigOut ) + if ( ls_conversion_mapping[i].input_config == ivasConfigIn && ls_conversion_mapping[i].output_config == ivasConfigOut ) { /* Mapping found with valid matrix - copy */ if ( ls_conversion_mapping[i].conversion_matrix != NULL ) @@ -1205,7 +1262,9 @@ static ivas_error initMcPanGainsWithConversionMapping( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Missing multichannel conversion mapping" ); } -static ivas_error initMcPanGainsWithEfap( input_mc *inputMc, IVAS_REND_AudioConfig outConfig ) +static ivas_error initMcPanGainsWithEfap( + input_mc *inputMc, + const IVAS_REND_AudioConfig outConfig ) { int16_t i; int16_t numNonLfeInChannels; @@ -1219,10 +1278,12 @@ static ivas_error initMcPanGainsWithEfap( input_mc *inputMc, IVAS_REND_AudioConf { return error; } + if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) { return error; @@ -1382,6 +1443,7 @@ static ivas_error initMcPanGainsWithStereoLookup( { return error; } + for ( readIdx = 0, writeIdx = 0; writeIdx < numInChannels; ++readIdx, ++writeIdx ) { if ( skipSideSpeakers && readIdx == 4 ) @@ -1400,10 +1462,10 @@ static ivas_error initMcPanGainsWithStereoLookup( /* Returns 1 (true) if configs A and B are equal, otherwise returns 0 (false). * If both configs are custom LS layouts, layout details are compared to determine equality. */ static bool configsAreEqual( - IVAS_REND_AudioConfig configA, - LSSETUP_CUSTOM_STRUCT customLsA, - IVAS_REND_AudioConfig configB, - LSSETUP_CUSTOM_STRUCT customLsB ) + const IVAS_REND_AudioConfig configA, + const LSSETUP_CUSTOM_STRUCT customLsA, + const IVAS_REND_AudioConfig configB, + const LSSETUP_CUSTOM_STRUCT customLsB ) { int16_t i; @@ -1414,14 +1476,17 @@ static bool configsAreEqual( { return false; } + if ( customLsA.num_lfe != customLsB.num_lfe ) { return false; } + if ( customLsA.is_planar_setup != customLsB.is_planar_setup ) { return false; } + for ( i = 0; i < customLsA.num_spk; ++i ) { /* Compare to nearest degree (hence the int cast) */ @@ -1561,7 +1626,18 @@ static ivas_error updateMcPanGainsForMcOut( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_MONO || inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { - error = initMcPanGainsWithEfap( inputMc, outConfig ); +#ifdef NON_DIEGETIC_PAN + if ( ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) + { + inputMc->panGains[0][0] = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f; + inputMc->panGains[0][1] = 1.f - inputMc->panGains[0][0]; + error = IVAS_ERR_OK; + } + else +#endif + { + error = initMcPanGainsWithEfap( inputMc, outConfig ); + } } else if ( outConfig == IVAS_REND_AUDIO_CONFIG_MONO ) { @@ -1608,10 +1684,12 @@ static ivas_error updateMcPanGainsForAmbiOut( { return error; } + if ( ( error = getSpeakerAzimuths( inputMc->base.inConfig, &spkAzi ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = getSpeakerElevations( inputMc->base.inConfig, &spkEle ) ) != IVAS_ERR_OK ) { return error; @@ -1730,14 +1808,11 @@ static ivas_error initMcBinauralRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; } -#ifdef FIX_197_CREND_INTERFACE - if ( inputMc->crendWrapper != NULL ) -#else - if ( inputMc->crendWrapper.hCrend != NULL ) -#endif - { - ivas_rend_closeCrend( &inputMc->crendWrapper ); - } + + ivas_rend_closeCrend( &inputMc->crendWrapper ); + + ivas_reverb_close( &inputMc->hReverb ); + if ( inputMc->efapInWrapper.hEfap != NULL ) { efap_free_data( &inputMc->efapInWrapper.hEfap ); @@ -1763,24 +1838,23 @@ static ivas_error initMcBinauralRendering( // if ( initTDRend ) { - if ( ( error = ivas_rend_TDObjRendOpen( &inputMc->tdRendWrapper, inConfig, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } + + if ( hRendCfg != NULL && hRendCfg->roomAcoustics.use_brir == 0 && hRendCfg->roomAcoustics.late_reverb_on ) + { + if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + } } { - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, - ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_REND_AUDIO_CONFIG_7_1_4 : inConfig, - outConfig, - hRendCfg, -#ifdef FIX_197_CREND_INTERFACE - 0, -#endif -#ifdef HRTF_BINARY_FILE - NULL, -#endif - outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, + NULL, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -1789,19 +1863,22 @@ static ivas_error initMcBinauralRendering( /* Initialise the EFAP handle for rotation on input layout */ if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled ) { - initEfap( &inputMc->efapInWrapper, inConfig, NULL ); + if ( ( error = initEfap( &inputMc->efapInWrapper, inConfig, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } } - return error; + return IVAS_ERR_OK; } static lfe_routing defaultLfeRouting( - IVAS_REND_AudioConfig inConfig, - LSSETUP_CUSTOM_STRUCT customLsIn, - IVAS_REND_AudioConfig outConfig, - LSSETUP_CUSTOM_STRUCT customLsOut ) + const IVAS_REND_AudioConfig inConfig, + const LSSETUP_CUSTOM_STRUCT customLsIn, + const IVAS_REND_AudioConfig outConfig, + const LSSETUP_CUSTOM_STRUCT customLsOut ) { - int32_t i; + int16_t i; lfe_routing routing; /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */ @@ -1868,15 +1945,17 @@ static ivas_error setRendInputActiveMc( rendCtx = inputMc->base.ctx; outConfig = *rendCtx.pOutConfig; + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } + initRendInputBase( &inputMc->base, inConfig, id, rendCtx ); setZeroPanMatrix( inputMc->panGains ); inputMc->customLsInput = defaultCustomLs(); inputMc->tdRendWrapper = defaultTdRendWrapper(); -#ifdef FIX_197_CREND_INTERFACE inputMc->crendWrapper = NULL; -#else - inputMc->crendWrapper = defaultCrendWrapper(); -#endif + inputMc->hReverb = NULL; initRotGains( inputMc->rot_gains_prev ); inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); @@ -1910,14 +1989,11 @@ static void clearInputMc( { efap_free_data( &inputMc->efapInWrapper.hEfap ); } -#ifdef FIX_197_CREND_INTERFACE - if ( inputMc->crendWrapper != NULL ) -#else - if ( inputMc->crendWrapper.hCrend != NULL ) -#endif - { - ivas_rend_closeCrend( &inputMc->crendWrapper ); - } + + ivas_rend_closeCrend( &inputMc->crendWrapper ); + + ivas_reverb_close( &inputMc->hReverb ); + if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); @@ -1954,11 +2030,7 @@ static ivas_error initSbaPanGainsForMcOut( case IVAS_REND_AUDIO_CONFIG_MONO: hOutSetup.ls_azimuth = ls_azimuth_CICP1; hOutSetup.ls_elevation = ls_elevation_CICP1; -#ifdef FIX_197_CREND_INTERFACE ivas_output_init( &hOutSetup, getIvasAudioConfigFromRendAudioConfig( outConfig ) ); -#else - ivas_output_init( &hOutSetup, rendAudioConfigToIvasAudioConfig( outConfig ) ); -#endif break; case IVAS_REND_AUDIO_CONFIG_STEREO: case IVAS_REND_AUDIO_CONFIG_5_1: @@ -1966,11 +2038,7 @@ static ivas_error initSbaPanGainsForMcOut( case IVAS_REND_AUDIO_CONFIG_5_1_2: case IVAS_REND_AUDIO_CONFIG_5_1_4: case IVAS_REND_AUDIO_CONFIG_7_1_4: -#ifdef FIX_197_CREND_INTERFACE ivas_output_init( &hOutSetup, getIvasAudioConfigFromRendAudioConfig( outConfig ) ); -#else - ivas_output_init( &hOutSetup, rendAudioConfigToIvasAudioConfig( outConfig ) ); -#endif break; case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); @@ -2050,38 +2118,25 @@ static ivas_error updateSbaPanGains( switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: -#ifdef FIX_197_CREND_INTERFACE - error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, 0, -#ifdef HRTF_BINARY_FILE - NULL, -#endif - *rendCtx.pOutSampleRate ); -#else - error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, -#ifdef HRTF_BINARY_FILE + error = ivas_rend_openCrend( &inputSba->crendWrapper, + getIvasAudioConfigFromRendAudioConfig( inConfig ), + getIvasAudioConfigFromRendAudioConfig( outConfig ), + hRendCfg, NULL, -#endif *rendCtx.pOutSampleRate ); -#endif break; case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_REND_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) { return error; } -#ifdef FIX_197_CREND_INTERFACE - error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, 0, -#ifdef HRTF_BINARY_FILE - NULL, -#endif - *rendCtx.pOutSampleRate ); -#else - error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, -#ifdef HRTF_BINARY_FILE + + error = ivas_rend_openCrend( &inputSba->crendWrapper, + AUDIO_CONFIG_7_1_4, + getIvasAudioConfigFromRendAudioConfig( outConfig ), + hRendCfg, NULL, -#endif *rendCtx.pOutSampleRate ); -#endif break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -2114,13 +2169,14 @@ static ivas_error setRendInputActiveSba( rendCtx = inputSba->base.ctx; outConfig = *rendCtx.pOutConfig; + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } + initRendInputBase( &inputSba->base, inConfig, id, rendCtx ); setZeroPanMatrix( inputSba->hoaDecMtx ); -#ifdef FIX_197_CREND_INTERFACE inputSba->crendWrapper = NULL; -#else - inputSba->crendWrapper = defaultCrendWrapper(); -#endif initRotGains( inputSba->rot_gains_prev ); if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) @@ -2141,19 +2197,14 @@ static void clearInputSba( initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); /* Free input's internal handles */ -#ifdef FIX_197_CREND_INTERFACE - if ( inputSba->crendWrapper != NULL ) -#else - if ( inputSba->crendWrapper.hCrend != NULL ) -#endif - { - ivas_rend_closeCrend( &inputSba->crendWrapper ); - } + ivas_rend_closeCrend( &inputSba->crendWrapper ); return; } -static ivas_error initMasaDummyDecForMcOut( input_masa *inputMasa, IVAS_REND_AudioConfig outConfig ) +static ivas_error initMasaDummyDecForMcOut( + input_masa *inputMasa, + const IVAS_REND_AudioConfig outConfig ) { ivas_error error; int16_t numCldfbAnalyses; @@ -2163,13 +2214,13 @@ static ivas_error initMasaDummyDecForMcOut( input_masa *inputMasa, IVAS_REND_Aud DecoderDummy *decDummy; decDummy = inputMasa->decDummy; -#ifdef FIX_197_CREND_INTERFACE output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - output_config = rendAudioConfigToIvasAudioConfig( outConfig ); -#endif decDummy->hDecoderConfig->output_config = output_config; +#ifdef HODIRAC + decDummy->sba_analysis_order = 1; +#endif + decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ decDummy->sba_mode = SBA_MODE_NONE; /* Todo Nokia: This is done to prevent ivas_dirac_dec_config() to not use uninitialized value. It could be considered if this should not be even accessed when not in SBA. */ decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ @@ -2197,21 +2248,14 @@ static ivas_error initMasaDummyDecForMcOut( input_masa *inputMasa, IVAS_REND_Aud { return error; } + decDummy->hDirAC->dirac_bs_md_write_idx = 0; if ( decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC ) { -#ifdef HRTF_BINARY_FILE if ( ( error = ivas_dirac_dec_init_binaural_data( decDummy, NULL ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( decDummy ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - decDummy->hDiracDecBin->useSubframeMode = 0; /* Todo Nokia: This will disappear in later work but needs to be this now. */ } numCldfbAnalyses = decDummy->nchan_transport; @@ -2244,7 +2288,9 @@ static ivas_error initMasaDummyDecForMcOut( input_masa *inputMasa, IVAS_REND_Aud return IVAS_ERR_OK; } -static ivas_error initMasaDummyDecForSbaOut( input_masa *inputMasa, IVAS_REND_AudioConfig outConfig ) +static ivas_error initMasaDummyDecForSbaOut( + input_masa *inputMasa, + const IVAS_REND_AudioConfig outConfig ) { ivas_error error; int16_t numCldfbAnalyses; @@ -2255,17 +2301,17 @@ static ivas_error initMasaDummyDecForSbaOut( input_masa *inputMasa, IVAS_REND_Au decDummy = inputMasa->decDummy; -#ifdef FIX_197_CREND_INTERFACE output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - output_config = rendAudioConfigToIvasAudioConfig( outConfig ); -#endif decDummy->hDecoderConfig->output_config = output_config; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ decDummy->sba_mode = SBA_MODE_NONE; /* Todo Nokia: This is done to prevent ivas_dirac_dec_config() to not use uninitialized value. It could be considered if this should not be even accessed when not in SBA. */ decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ +#ifdef HODIRAC + decDummy->sba_analysis_order = 1; +#endif + ivas_output_init( &( decDummy->hOutSetup ), output_config ); ivas_output_init( &( decDummy->hIntSetup ), output_config ); decDummy->renderer_type = RENDERER_DIRAC; @@ -2283,6 +2329,7 @@ static ivas_error initMasaDummyDecForSbaOut( input_masa *inputMasa, IVAS_REND_Au { return error; } + decDummy->hDirAC->dirac_bs_md_write_idx = 0; numCldfbAnalyses = decDummy->nchan_transport; numCldfbSyntheses = decDummy->hDecoderConfig->nchan_out; @@ -2314,7 +2361,9 @@ static ivas_error initMasaDummyDecForSbaOut( input_masa *inputMasa, IVAS_REND_Au return IVAS_ERR_OK; } -static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, IVAS_REND_AudioConfig outConfig ) +static ivas_error initMasaDummyDecForBinauralOut( + input_masa *inputMasa, + const IVAS_REND_AudioConfig outConfig ) { ivas_error error; @@ -2324,15 +2373,15 @@ static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, IVAS_RE decDummy = inputMasa->decDummy; -#ifdef FIX_197_CREND_INTERFACE output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - output_config = rendAudioConfigToIvasAudioConfig( outConfig ); -#endif decDummy->hDecoderConfig->output_config = output_config; output_config = decDummy->hDecoderConfig->output_config; +#ifdef HODIRAC + decDummy->sba_analysis_order = 1; +#endif + decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ decDummy->sba_mode = SBA_MODE_NONE; /* Todo Nokia: This is done to prevent ivas_dirac_dec_config() to not use uninitialized value. It could be considered if this should not be even accessed when not in SBA. */ decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ @@ -2348,15 +2397,13 @@ static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, IVAS_RE } decDummy->ivas_format = MASA_FORMAT; decDummy->transport_config = AUDIO_CONFIG_INVALID; -#ifdef DEBUGGING - decDummy->hDecoderConfig->forceSubframeBinauralization = 0; -#endif if ( ( error = ivas_dirac_dec_open( decDummy ) ) != IVAS_ERR_OK ) { return error; } -#ifdef HRTF_BINARY_FILE + decDummy->hDirAC->dirac_bs_md_write_idx = 0; + if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &decDummy->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; @@ -2366,14 +2413,7 @@ static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, IVAS_RE { return error; } -#else - if ( ( error = ivas_dirac_dec_init_binaural_data( decDummy ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif - decDummy->hDiracDecBin->useSubframeMode = 0; /* Todo Nokia: This will disappear in later work but needs to be this now. */ for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { @@ -2395,7 +2435,9 @@ static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, IVAS_RE return IVAS_ERR_OK; } -static ivas_error updateMasaDummyDec( input_masa *inputMasa, IVAS_REND_AudioConfig outConfig ) +static ivas_error updateMasaDummyDec( + input_masa *inputMasa, + const IVAS_REND_AudioConfig outConfig ) { ivas_error error; @@ -2413,16 +2455,15 @@ static ivas_error updateMasaDummyDec( input_masa *inputMasa, IVAS_REND_AudioConf default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } - return IVAS_ERR_OK; + return error; } -static DecoderDummy *initDecoderDummy( int32_t sampleRate, int16_t numTransChannels, IVAS_REND_AudioConfig outConfig, const uint8_t enableRenderConfig ) +static DecoderDummy *initDecoderDummy( + const int32_t sampleRate, + const int16_t numTransChannels, + const IVAS_REND_AudioConfig outConfig, + const uint8_t enableRenderConfig ) { ivas_error error; int16_t i; @@ -2438,32 +2479,29 @@ static DecoderDummy *initDecoderDummy( int32_t sampleRate, int16_t numTransChann decDummy = malloc( sizeof( DecoderDummy ) ); decDummy->hDecoderConfig = malloc( sizeof( DECODER_CONFIG ) ); decDummy->hDecoderConfig->output_Fs = sampleRate; - decDummy->hDecoderConfig->nchan_out = (int16_t) numOutChannels; + decDummy->hDecoderConfig->nchan_out = numOutChannels; decDummy->hDecoderConfig->Opt_Headrotation = 0; +#ifdef JBM_TSM_ON_TCS + decDummy->hDecoderConfig->voip_active = 0; +#endif decDummy->hBinRenderer = NULL; decDummy->hEFAPdata = NULL; -#ifdef FIX_197_CREND_INTERFACE decDummy->hCrendWrapper = NULL; -#else - decDummy->hHrtf = NULL; - decDummy->hCrend = NULL; -#endif decDummy->hHrtfTD = NULL; decDummy->hSpar = NULL; decDummy->hoa_dec_mtx = NULL; - decDummy->hVBAPdata = NULL; + decDummy->hVBAPdata = NULL; // note: not used at the moment decDummy->hMasa = NULL; decDummy->hDiracDecBin = NULL; decDummy->hQMetaData = NULL; -#ifdef FIX_197_CREND_INTERFACE - decDummy->hDecoderConfig->output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); -#else - decDummy->hDecoderConfig->output_config = rendAudioConfigToIvasAudioConfig( outConfig ); +#ifdef JBM_TSM_ON_TCS + decDummy->hTcBuffer = NULL; #endif + decDummy->hDecoderConfig->output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); decDummy->nchan_transport = numTransChannels; - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) + if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) { decDummy->hHeadTrackData = malloc( sizeof( HEAD_TRACK_DATA ) ); /* Initialise Rmat_prev to I, Rmat will be computed later */ @@ -2477,6 +2515,8 @@ static DecoderDummy *initDecoderDummy( int32_t sampleRate, int16_t numTransChann decDummy->hHeadTrackData->lrSwitchInterpVal = 0.0f; decDummy->hHeadTrackData->lrSwitchedCurrent = 0; decDummy->hHeadTrackData->lrSwitchedNext = 0; + decDummy->hHeadTrackData->OrientationTracker = (ivas_orient_trk_state_t *) malloc( sizeof( ivas_orient_trk_state_t ) ); + ivas_orient_trk_Init( decDummy->hHeadTrackData->OrientationTracker ); } else { @@ -2494,6 +2534,11 @@ static DecoderDummy *initDecoderDummy( int32_t sampleRate, int16_t numTransChann decDummy->hRenderConfig = NULL; } +#ifdef JBM_TSM_ON_TCS + /* get a default TC buffer, needed for some renderers */ + ivas_jbm_dec_tc_buffer_open( decDummy, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ); +#endif + decDummy->renderer_type = RENDERER_DISABLE; return decDummy; @@ -2516,13 +2561,18 @@ static ivas_error setRendInputActiveMasa( outConfig = *rendCtx.pOutConfig; (void) hRendCfg; /* Suppress warning */ + if ( !isIoConfigPairSupported( inConfig, outConfig ) ) + { + return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; + } + initRendInputBase( &inputMasa->base, inConfig, id, rendCtx ); if ( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) { return error; } - inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, (int16_t) numInChannels, outConfig, 0 ); + inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); inputMasa->metadataHasBeenFed = false; if ( ( error = updateMasaDummyDec( inputMasa, outConfig ) ) != IVAS_ERR_OK ) @@ -2533,7 +2583,8 @@ static ivas_error setRendInputActiveMasa( return IVAS_ERR_OK; } -static void freeDecoderDummy( DecoderDummy **ppDecDummy ) +static void freeDecoderDummy( + DecoderDummy **ppDecDummy ) { int16_t i; DecoderDummy *pDecDummy; @@ -2548,8 +2599,13 @@ static void freeDecoderDummy( DecoderDummy **ppDecDummy ) { free( pDecDummy->hDecoderConfig ); } + if ( pDecDummy->hHeadTrackData != NULL ) { + if ( pDecDummy->hHeadTrackData->OrientationTracker != NULL ) + { + free( pDecDummy->hHeadTrackData->OrientationTracker ); + } free( pDecDummy->hHeadTrackData ); } ivas_render_config_close( &pDecDummy->hRenderConfig ); @@ -2560,7 +2616,6 @@ static void freeDecoderDummy( DecoderDummy **ppDecDummy ) if ( pDecDummy->cldfbAnaDec[i] != NULL ) { deleteCldfb( &( pDecDummy->cldfbAnaDec[i] ) ); - pDecDummy->cldfbAnaDec[i] = NULL; } } @@ -2569,16 +2624,11 @@ static void freeDecoderDummy( DecoderDummy **ppDecDummy ) if ( pDecDummy->cldfbSynDec[i] != NULL ) { deleteCldfb( &( pDecDummy->cldfbSynDec[i] ) ); - pDecDummy->cldfbSynDec[i] = NULL; } } /* DirAC handle */ - if ( pDecDummy->hDirAC != NULL ) - { - ivas_dirac_dec_close( pDecDummy->hDirAC ); - pDecDummy->hDirAC = NULL; - } + ivas_dirac_dec_close( &( pDecDummy->hDirAC ) ); /* Qmetadata handle */ ivas_qmetadata_close( &pDecDummy->hQMetaData ); @@ -2596,11 +2646,19 @@ static void freeDecoderDummy( DecoderDummy **ppDecDummy ) /* Parametric binaural renderer handle */ ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); +#ifdef JBM_TSM_ON_TCS + /* TC buffer */ + ivas_jbm_dec_tc_buffer_close( &pDecDummy->hTcBuffer ); +#endif + free( pDecDummy ); pDecDummy = NULL; + + return; } -static void clearInputMasa( input_masa *inputMasa ) +static void clearInputMasa( + input_masa *inputMasa ) { rendering_context rendCtx; @@ -2608,30 +2666,38 @@ static void clearInputMasa( input_masa *inputMasa ) initRendInputBase( &inputMasa->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx ); freeDecoderDummy( &inputMasa->decDummy ); + + return; } ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, const int32_t outputSampleRate, - const IVAS_REND_AudioConfig outConfig ) +#ifdef NON_DIEGETIC_PAN + const IVAS_REND_AudioConfig outConfig, + const int16_t nonDiegeticPan, + const float nonDiegeticPanGain +#else + const IVAS_REND_AudioConfig outConfig +#endif +) { int16_t i; IVAS_REND_HANDLE hIvasRend; ivas_error error; int16_t numOutChannels; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( phIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( ( error = validateOutputAudioConfig( outConfig ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = validateOutputSampleRate( outputSampleRate, outConfig ) ) != IVAS_ERR_OK ) { return error; @@ -2659,51 +2725,59 @@ ivas_error IVAS_REND_Open( { return error; } - initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ); + + if ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, outputSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } /* Initialize headrotation data */ - initHeadRotation( hIvasRend ); + if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) + { + return error; + } /* Initialize EFAP */ - initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ); + if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) + { + return error; + } /* Initialize inputs */ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); -#ifdef FIX_197_CREND_INTERFACE hIvasRend->inputsIsm[i].crendWrapper = NULL; -#else - hIvasRend->inputsIsm[i].crendWrapper.hCrend = NULL; -#endif + hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; +#ifdef NON_DIEGETIC_PAN + hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; + hIvasRend->inputsIsm[i].nonDiegeticPanGain = nonDiegeticPanGain; +#endif } + for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; -#ifdef FIX_197_CREND_INTERFACE hIvasRend->inputsMc[i].crendWrapper = NULL; -#else - hIvasRend->inputsMc[i].crendWrapper.hCrend = NULL; -#endif + hIvasRend->inputsMc[i].hReverb = NULL; hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; +#ifdef NON_DIEGETIC_PAN + hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; + hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain; +#endif } + for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); -#ifdef FIX_197_CREND_INTERFACE hIvasRend->inputsSba[i].crendWrapper = NULL; -#else - hIvasRend->inputsSba[i].crendWrapper.hCrend = NULL; -#endif } + for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsMasa[i].base, - IVAS_REND_AUDIO_CONFIG_UNKNOWN, - 0, - getRendCtx( hIvasRend ) ); + initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) ); hIvasRend->inputsMasa[i].decDummy = NULL; hIvasRend->inputsMasa[i].metadataHasBeenFed = false; } @@ -2748,11 +2822,13 @@ static ivas_error validateCustomLsLayout( { return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; } + /* There must be at least one speaker or LFE in the layout */ if ( layout.num_spk + layout.num_lfe <= 0 ) { return IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT; } + /* LFE indices must be positive */ for ( i = 0; i < layout.num_lfe; ++i ) { @@ -2774,19 +2850,18 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( input_mc *inputMc; input_sba *inputSba; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( hIvasRend->outputConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { /* Specifying details of custom speaker layout only makes sense if output config is set to custom speaker layout */ return IVAS_ERR_INVALID_OUTPUT_FORMAT; } + if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) { return error; @@ -2799,10 +2874,17 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( { return error; } - initLimiter( &hIvasRend->hLimiter, numOutChannels, hIvasRend->sampleRateOut ); + + if ( ( error = initLimiter( &hIvasRend->hLimiter, numOutChannels, hIvasRend->sampleRateOut ) ) != IVAS_ERR_OK ) + { + return error; + } /* Re-initialize EFAP - output layout has changed or has been fully defined for the first time */ - initEfap( &hIvasRend->efapOutWrapper, hIvasRend->outputConfig, &hIvasRend->customLsOut ); + if ( ( error = initEfap( &hIvasRend->efapOutWrapper, hIvasRend->outputConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK ) + { + return error; + } /* Re-initialize panning gains for each active MC input, This includes re-initializing * LFE handling for the new output layout, which means custom LFE handling is overwritten, @@ -2828,11 +2910,13 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { inputSba = &hIvasRend->inputsSba[i]; + if ( inputSba->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { /* Input inactive, skip. */ continue; } + if ( ( error = updateSbaPanGains( inputSba, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) { return error; @@ -2848,10 +2932,7 @@ ivas_error IVAS_REND_NumOutChannels( { ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || numOutChannels == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -2862,16 +2943,14 @@ ivas_error IVAS_REND_NumOutChannels( { case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: *numOutChannels = hIvasRend->customLsOut.num_spk + hIvasRend->customLsOut.num_lfe; - error = IVAS_ERR_OK; break; default: - error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ); + if ( ( error = getAudioConfigNumChannels( hIvasRend->outputConfig, numOutChannels ) ) != IVAS_ERR_OK ) + { + return error; + } break; } - if ( error != IVAS_ERR_OK ) - { - return error; - } return IVAS_ERR_OK; } @@ -3017,8 +3096,8 @@ static ivas_error getConstInputById( static ivas_error findFreeInputSlot( const void *inputs, - int32_t inputStructSize, - int32_t maxInputs, + const int32_t inputStructSize, + const int32_t maxInputs, int32_t *inputIndex ) { /* Using a void pointer and a separately provided size is a hack for this function @@ -3056,10 +3135,18 @@ static ivas_error findFreeInputSlot( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_AddInput() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_AddInput( - IVAS_REND_HANDLE hIvasRend, - IVAS_REND_AudioConfig inConfig, - IVAS_REND_InputId *inputId ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_AudioConfig inConfig, /* i : audio config for a new input */ + IVAS_REND_InputId *inputId /* o : ID of the new input */ +) { ivas_error error; int32_t maxNumInputsOfType; @@ -3068,10 +3155,7 @@ ivas_error IVAS_REND_AddInput( ivas_error ( *activateInput )( void *, IVAS_REND_AudioConfig, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); int32_t inputIndex; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || inputId == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3123,30 +3207,39 @@ ivas_error IVAS_REND_AddInput( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_ConfigureCustomInputLoudspeakerLayout() + * + * + * Note: this will reset any custom LFE routing set for the input + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( - IVAS_REND_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - const IVAS_CUSTOM_LS_DATA layout ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_CUSTOM_LS_DATA layout /* i : custom loudspeaker layout for input */ +) { input_mc *inputMc; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( ( error = validateCustomLsLayout( layout ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputMc ) ) != IVAS_ERR_OK ) { return error; } + if ( inputMc->base.inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { /* Specifying details of custom speaker layout only makes sense if input config is set to custom speaker layout */ @@ -3160,7 +3253,10 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( inputMc->lfeRouting = defaultLfeRouting( inputMc->base.inConfig, inputMc->customLsInput, hIvasRend->outputConfig, *inputMc->base.ctx.pCustomLsOut ); - initEfap( &inputMc->efapInWrapper, inputMc->base.inConfig, &inputMc->customLsInput ); + if ( ( error = initEfap( &inputMc->efapInWrapper, inputMc->base.inConfig, &inputMc->customLsInput ) ) != IVAS_ERR_OK ) + { + return error; + } if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { @@ -3169,6 +3265,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return error; } } + if ( ( error = updateMcPanGains( inputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) { return error; @@ -3177,23 +3274,28 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_SetInputGain() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_SetInputGain( - IVAS_REND_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - const float gain /* linear gain, not in dB */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const float gain /* i : linear gain (not in dB) */ ) { input_base *inputBase; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) { return error; @@ -3204,28 +3306,35 @@ ivas_error IVAS_REND_SetInputGain( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_SetInputLfeMtx() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_SetInputLfeMtx( - IVAS_REND_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - const IVAS_REND_LfePanMtx *lfePanMtx ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_REND_LfePanMtx *lfePanMtx /* i : LFE panning matrix */ +) { int16_t i; input_base *pInputBase; input_mc *pInputMc; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) { return error; } + if ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { /* Custom LFE panning matrix only makes sense with channel-based input */ @@ -3247,29 +3356,36 @@ ivas_error IVAS_REND_SetInputLfeMtx( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_SetInputLfePos() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_SetInputLfePos( - IVAS_REND_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - const float inputGain, - const float outputAzimuth, - const float outputElevation ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const float inputGain, /* i : Input gain to be applied to the LFE channel(s) */ + const float outputAzimuth, /* i : Output azimuth position */ + const float outputElevation /* i : Output elevation position */ +) { input_base *pInputBase; input_mc *pInputMc; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( ( error = getInputById( hIvasRend, inputId, (void **) &pInputBase ) ) != IVAS_ERR_OK ) { return error; } + if ( getAudioConfigType( pInputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { /* Custom LFE routing only makes sense with channel-based input */ @@ -3281,6 +3397,7 @@ ivas_error IVAS_REND_SetInputLfePos( pInputMc->lfeRouting.lfeInputGain = inputGain; pInputMc->lfeRouting.lfeOutputAzimuth = outputAzimuth; pInputMc->lfeRouting.lfeOutputElevation = outputElevation; + if ( ( error = updateMcPanGains( pInputMc, hIvasRend->outputConfig ) ) != IVAS_ERR_OK ) { return error; @@ -3289,21 +3406,27 @@ ivas_error IVAS_REND_SetInputLfePos( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_RemoveInput() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_RemoveInput( - IVAS_REND_HANDLE hIvasRend, - const IVAS_REND_InputId inputId ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId /* i : ID of the input */ +) { ivas_error error; input_base *inputBase; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) { return error; @@ -3330,19 +3453,24 @@ ivas_error IVAS_REND_RemoveInput( return IVAS_ERR_OK; } -ivas_error IVAS_REND_GetInputNumChannels( - IVAS_REND_CONST_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - int16_t *numChannels ) -{ - ivas_error error; - const input_base *pInput; - - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - if ( hIvasRend == NULL || numChannels == NULL ) +/*-------------------------------------------------------------------* + * IVAS_REND_GetInputNumChannels() + * + * + *-------------------------------------------------------------------*/ + +ivas_error IVAS_REND_GetInputNumChannels( + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + int16_t *numChannels /* o : number of channels of the input */ +) +{ + ivas_error error; + const input_base *pInput; + + /* Validate function arguments */ + if ( hIvasRend == NULL || numChannels == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } @@ -3351,6 +3479,7 @@ ivas_error IVAS_REND_GetInputNumChannels( { return error; } + if ( ( error = getRendInputNumChannels( pInput, numChannels ) ) != IVAS_ERR_OK ) { return error; @@ -3359,6 +3488,13 @@ ivas_error IVAS_REND_GetInputNumChannels( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_GetDelay() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_GetDelay( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ int16_t *nSamples, /* o : Renderer delay in samples */ @@ -3370,11 +3506,9 @@ ivas_error IVAS_REND_GetDelay( */ int16_t i; int32_t latency_ns; + int32_t max_latency_ns; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || nSamples == NULL || timeScale == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -3382,20 +3516,16 @@ ivas_error IVAS_REND_GetDelay( *timeScale = hIvasRend->sampleRateOut; *nSamples = 0; + max_latency_ns = 0; /* Compute the maximum delay across all inputs */ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) { if ( hIvasRend->inputsIsm[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { -#ifdef FIX_197_CREND_INTERFACE latency_ns = max( ( hIvasRend->inputsIsm[i].crendWrapper != NULL ) ? hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns : 0, hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); -#else - latency_ns = max( hIvasRend->inputsIsm[i].crendWrapper.binaural_latency_ns, - hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); -#endif - *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); + max_latency_ns = max( max_latency_ns, latency_ns ); } } @@ -3403,14 +3533,9 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMc[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { -#ifdef FIX_197_CREND_INTERFACE latency_ns = max( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ? hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns : 0, hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); -#else - latency_ns = max( hIvasRend->inputsMc[i].crendWrapper.binaural_latency_ns, - hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); -#endif - *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); + max_latency_ns = max( max_latency_ns, latency_ns ); } } @@ -3418,12 +3543,8 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { -#ifdef FIX_197_CREND_INTERFACE latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; -#else - latency_ns = hIvasRend->inputsSba[i].crendWrapper.binaural_latency_ns; -#endif - *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); + max_latency_ns = max( max_latency_ns, latency_ns ); } } @@ -3431,39 +3552,49 @@ ivas_error IVAS_REND_GetDelay( { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) { - latency_ns = NS2SA( hIvasRend->sampleRateOut, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); - *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) ); + latency_ns = (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ); + max_latency_ns = max( max_latency_ns, latency_ns ); } } + *nSamples = (int16_t) roundf( (float) max_latency_ns * *timeScale / 1000000000.f ); + return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_FeedInputAudio() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_FeedInputAudio( - IVAS_REND_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - const IVAS_REND_ReadOnlyAudioBuffer inputAudio ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_REND_ReadOnlyAudioBuffer inputAudio /* i : buffer with input audio */ +) { ivas_error error; input_base *inputBase; int16_t numInputChannels; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || inputAudio.data == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) { return IVAS_ERR_INVALID_BUFFER_SIZE; } + if ( inputAudio.config.numChannels <= 0 || MAX_INPUT_CHANNELS < inputAudio.config.numChannels ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && inputAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) { @@ -3475,10 +3606,12 @@ ivas_error IVAS_REND_FeedInputAudio( { return error; } + if ( ( error = getRendInputNumChannels( inputBase, &numInputChannels ) ) != IVAS_ERR_OK ) { return error; } + if ( numInputChannels != inputAudio.config.numChannels ) { return IVAS_ERR_WRONG_NUM_CHANNELS; @@ -3493,27 +3626,34 @@ ivas_error IVAS_REND_FeedInputAudio( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_FeedInputObjectMetadata() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_FeedInputObjectMetadata( - IVAS_REND_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - const IVAS_REND_AudioObjectPosition objectPosition ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ +) { input_base *inputBase; input_ism *inputIsm; ivas_error error; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) { return error; } + if ( inputBase->inConfig != IVAS_REND_AUDIO_CONFIG_OBJECT ) { /* Object metadata should only be fed for object inputs */ @@ -3527,27 +3667,34 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_FeedInputMasaMetadata() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_FeedInputMasaMetadata( - IVAS_REND_HANDLE hIvasRend, - const IVAS_REND_InputId inputId, - IVAS_MASA_METADATA_HANDLE masaMetadata ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + IVAS_MASA_METADATA_HANDLE masaMetadata /* i : MASA metadata frame */ +) { ivas_error error; input_base *inputBase; input_masa *inputMasa; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK ) { return error; } + if ( getAudioConfigType( inputBase->inConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { /* MASA metadata should only be fed for MASA inputs */ @@ -3561,52 +3708,58 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( return IVAS_ERR_OK; } -ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE st, - bool rendererConfigEnabled ) + +/*-------------------------------------------------------------------* + * IVAS_REND_InitConfig() + * + * + *-------------------------------------------------------------------*/ + +ivas_error IVAS_REND_InitConfig( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ +) { ivas_error error; + bool rendererConfigEnabled; + + rendererConfigEnabled = ( getAudioConfigType( outAudioConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ); if ( rendererConfigEnabled ) { - st->rendererConfigEnabled = 1; + hIvasRend->rendererConfigEnabled = 1; } else { - st->rendererConfigEnabled = 0; + hIvasRend->rendererConfigEnabled = 0; } -#ifdef FIX_197_CREND_INTERFACE if ( rendererConfigEnabled ) { - if ( ( error = ivas_render_config_open( &( st->hRendererConfig ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_render_config_open( &( hIvasRend->hRendererConfig ) ) ) != IVAS_ERR_OK ) { return error; } - - if ( ivas_render_config_init_from_rom( &st->hRendererConfig, st->rendererConfigEnabled ) != IVAS_ERR_OK ) + if ( ( error = ivas_render_config_init_from_rom( &hIvasRend->hRendererConfig, outAudioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) ) != IVAS_ERR_OK ) { - return IVAS_ERR_INTERNAL_FATAL; + return error; } } else { - st->hRendererConfig = NULL; - } -#else - if ( ( error = ivas_render_config_open( &( st->hRendererConfig ) ) ) != IVAS_ERR_OK ) - { - return error; + hIvasRend->hRendererConfig = NULL; } - if ( ivas_render_config_init_from_rom( &st->hRendererConfig, st->rendererConfigEnabled ) != IVAS_ERR_OK ) - { - return IVAS_ERR_INTERNAL_FATAL; - } -#endif - return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_GetRenderConfig() + * + * + *-------------------------------------------------------------------*/ + int16_t IVAS_REND_GetRenderConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ @@ -3649,6 +3802,12 @@ int16_t IVAS_REND_GetRenderConfig( } +/*-------------------------------------------------------------------* + * IVAS_REND_FeedRenderConfig() + * + * + *-------------------------------------------------------------------*/ + int16_t IVAS_REND_FeedRenderConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ @@ -3662,6 +3821,7 @@ int16_t IVAS_REND_FeedRenderConfig( } hRenderConfig = hIvasRend->hRendererConfig; + mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 ); #ifdef DEBUGGING hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) @@ -3682,29 +3842,39 @@ int16_t IVAS_REND_FeedRenderConfig( mvr2r( renderConfig.room_acoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); +#ifdef ISM_NON_DIEGETIC_PAN + mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 ); +#endif return IVAS_ERR_OK; } +/*-------------------------------------------------------------------* + * IVAS_REND_SetHeadRotation() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_SetHeadRotation( - IVAS_REND_HANDLE hIvasRend, - const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ + const IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ +) { int16_t i; + IVAS_QUATERNION rotQuat; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( getAudioConfigType( hIvasRend->outputConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) { /* Head rotation can be set only with binaural output */ - return IVAS_ERR_METADATA_NOT_EXPECTED; + return IVAS_ERR_INVALID_OUTPUT_FORMAT; } if ( headRot == NULL ) @@ -3716,13 +3886,181 @@ ivas_error IVAS_REND_SetHeadRotation( hIvasRend->headRotData.headRotEnabled = 1; for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) { - hIvasRend->headRotData.headPositions[i] = headRot[i]; + /* check for Euler angle signaling */ + if ( headRot[i].w == -3.0f ) + { + Euler2Quat( deg2rad( headRot[i].x ), deg2rad( headRot[i].y ), deg2rad( headRot[i].z ), &rotQuat ); + } + else + { + rotQuat = headRot[i]; + } + + ivas_orient_trk_Process( hIvasRend->headRotData.hOrientationTracker, rotQuat, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &hIvasRend->headRotData.headPositions[i] ); + hIvasRend->headRotData.Pos[i] = Pos[i]; } } return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_SetOrientationTrackingMode() + * + * + *-------------------------------------------------------------------*/ + +ivas_error IVAS_REND_SetOrientationTrackingMode( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const uint8_t otrMode /* i : Orientation tracking mode */ +) +{ + OTR_TRACKING_T mode; + ivas_error error; + + if ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + switch ( otrMode ) + { + case IVAS_ORIENT_TRK_AVG: + mode = OTR_TRACKING_AVG_ORIENT; + break; + case IVAS_ORIENT_TRK_REF: + mode = OTR_TRACKING_REF_ORIENT; + break; + case IVAS_ORIENT_TRK_REF_VEC: + mode = OTR_TRACKING_REF_VEC; + break; + case IVAS_ORIENT_TRK_REF_VEC_LEV: + mode = OTR_TRACKING_REF_VEC_LEV; + break; + case IVAS_ORIENT_TRK_NONE: + default: + mode = OTR_TRACKING_NONE; + break; + } + + if ( ( error = ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, mode ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; +} + + +/*-------------------------------------------------------------------* + * IVAS_REND_SetReferenceRotation() + * + * + *-------------------------------------------------------------------*/ + +ivas_error IVAS_REND_SetReferenceRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION refRot /* i : Reference rotation */ +) +{ + ivas_error error; + + /* Validate function arguments */ + if ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + if ( ( error = ivas_orient_trk_SetReferenceRotation( hIvasRend->headRotData.hOrientationTracker, refRot ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; +} + + +/*-------------------------------------------------------------------* + * IVAS_REND_GetMainOrientation() + * + * + *-------------------------------------------------------------------*/ + +ivas_error IVAS_REND_GetMainOrientation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for main orientation */ +) +{ + ivas_error error; + + if ( hIvasRend == NULL || pOrientation == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + if ( ( error = ivas_orient_trk_GetMainOrientation( hIvasRend->headRotData.hOrientationTracker, pOrientation ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; +} + + +/*-------------------------------------------------------------------* + * IVAS_REND_GetTrackedRotation() + * + * + *-------------------------------------------------------------------*/ + +ivas_error IVAS_REND_GetTrackedRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *pRotation /* i/o: Quaternion pointer processed rotation */ +) +{ + ivas_error error; + + if ( hIvasRend == NULL || pRotation == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + if ( ( error = ivas_orient_trk_GetTrackedRotation( hIvasRend->headRotData.hOrientationTracker, pRotation ) ) != IVAS_ERR_OK ) + { + return error; + } + + return IVAS_ERR_OK; +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_SetReferenceVector( ) + * + * Sets a reference vector spanning from listenerPos to refPos. Only + * available in OTR_TRACKING_REF_VEC and OTR_TRACKING_REF_VEC_LEV modes. + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_SetReferenceVector( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ +) +{ + if ( hIvasRend == NULL || hIvasRend->headRotData.hOrientationTracker == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + return ivas_orient_trk_SetReferenceVector( hIvasRend->headRotData.hOrientationTracker, listenerPos, refPos ); +} + + +/*-------------------------------------------------------------------* + * Local functions + *-------------------------------------------------------------------*/ + /* Take one channel from input buffer and copy it to each channel in output buffer, with different gain applied per output channel. This function takes 2 gain vectors - one for the beginning and one @@ -3792,6 +4130,8 @@ static void renderBufferChannelLerp( } } } + + return; } /* Take one channel from input buffer and copy it to each channel @@ -3829,24 +4169,31 @@ static ivas_error rotateFrameMc( rotation_matrix Rmat; rotation_gains gains; float tmp_gains[MAX_INPUT_CHANNELS]; + ivas_error error; push_wmops( "rotateFrameMc" ); if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { - getAudioConfigNumChannels( inConfig, &nchan ); + if ( ( error = getAudioConfigNumChannels( inConfig, &nchan ) ) != IVAS_ERR_OK ) + { + return error; + } } else { nchan = inCustomLs.num_spk + inCustomLs.num_lfe; } - getMcConfigValues( inConfig, inCustomLs, &ls_azimuth, &ls_elevation, &lfe_idx, &is_planar_setup ); + if ( ( error = getMcConfigValues( inConfig, inCustomLs, &ls_azimuth, &ls_elevation, &lfe_idx, &is_planar_setup ) ) != IVAS_ERR_OK ) + { + return error; + } /* initialize gains to passthrough */ for ( ch_in = 0; ch_in < nchan; ch_in++ ) { - set_zero( gains[ch_in], (int16_t) nchan ); + set_zero( gains[ch_in], nchan ); gains[ch_in][ch_in] = 1.f; } @@ -3912,7 +4259,7 @@ static ivas_error rotateFrameMc( /* move gains to gains_prev */ for ( i = 0; i < nchan; i++ ) { - mvr2r( gains[i], gains_prev[i], (int16_t) nchan ); + mvr2r( gains[i], gains_prev[i], nchan ); } } @@ -3937,10 +4284,14 @@ static ivas_error rotateFrameSba( rotation_matrix Rmat; float tmpRot[2 * HEADROT_ORDER + 1]; rotation_gains gains; + ivas_error error; push_wmops( "rotateFrameSba" ); - getAmbisonicsOrder( inConfig, &shd_rot_max_order ); + if ( ( error = getAmbisonicsOrder( inConfig, &shd_rot_max_order ) ) != IVAS_ERR_OK ) + { + return error; + } /* subframe loop */ subframe_len = inAudio.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; @@ -3981,15 +4332,15 @@ static ivas_error rotateFrameSba( ( 1 - headRotData->crossfade[i] ) * gains_prev[n][m] * ( *readPtr ); } } + /* write back the result */ + for ( n = m1; n < m2; n++ ) + { + writePtr = getSmplPtr( outAudio, n, subframe_idx * subframe_len + i ); + ( *writePtr ) = tmpRot[n - m1]; + } + m1 = m2; + m2 += 2 * ( l + 1 ) + 1; } - /* write back the result */ - for ( n = m1; n < m2; n++ ) - { - writePtr = getSmplPtr( outAudio, n, subframe_idx * subframe_len + i ); - ( *writePtr ) = tmpRot[n - m1]; - } - m1 = m2; - m2 += 2 * ( l + 1 ) + 1; } /*unoptimized code for reference (full matrix multiplication)*/ @@ -4031,13 +4382,14 @@ static ivas_error renderIsmToBinaural( copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer ); /* TODO tmu : missing: interpolation between positions, 5ms rendering */ - if ( ( error = ivas_rend_TDObjRenderFrame( &ismInput->tdRendWrapper, - ismInput->base.inConfig, - NULL, - ismInput->base.ctx.pHeadRotData, - &ismInput->currentPos, - outAudio.config.numSamplesPerChannel, - tmpTDRendBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, + ismInput->base.inConfig, + NULL, + ismInput->base.ctx.pHeadRotData, + &ismInput->currentPos, + ismInput->hReverb, + outAudio.config.numSamplesPerChannel, + tmpTDRendBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -4058,7 +4410,7 @@ static ivas_error renderIsmToBinauralRoom( int16_t subframe_idx, subframe_len; int16_t tmp; rotation_matrix Rmat; - float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; IVAS_QUATERNION quat; ivas_error error; pan_vector currentPanGains; @@ -4066,87 +4418,127 @@ static ivas_error renderIsmToBinauralRoom( IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioObjectPosition rotatedPos; const IVAS_REND_HeadRotData *headRotData; +#ifdef JBM_TSM_ON_TCS + float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_tmpRendBuffer[i] = tmpRendBuffer[i]; + } +#endif push_wmops( "renderIsmToBinauralRoom" ); headRotData = ismInput->base.ctx.pHeadRotData; rotatedPos = defaultObjectPosition(); - if ( headRotData->headRotEnabled ) + if ( ismInput->hReverb != NULL && ismInput->hReverb->pConfig.roomAcoustics.use_brir == 0 && ismInput->hReverb->pConfig.roomAcoustics.late_reverb_on == 1 && headRotData->headRotEnabled ) { - subframe_len = ismInput->base.inputBuffer.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; - // for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) - for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) - { - quat.w = headRotData->headPositions[subframe_idx].w; - quat.x = headRotData->headPositions[subframe_idx].x; - quat.y = headRotData->headPositions[subframe_idx].y; - quat.z = headRotData->headPositions[subframe_idx].z; + copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); - QuatToRotMat( quat, Rmat ); + /* TODO tmu : missing: interpolation between positions, 5ms rendering */ + if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, + ismInput->base.inConfig, + NULL, + ismInput->base.ctx.pHeadRotData, + &ismInput->currentPos, + ismInput->hReverb, + outAudio.config.numSamplesPerChannel, + tmpRendBuffer ) ) != IVAS_ERR_OK ) + { + return error; } - (void) subframe_len; // avoid warning + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); } - - /* TODO tmu : missing: interpolation between positions, 5ms rendering */ - /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ - /* TODO tmu2sgi: needs a lot of cleanup, we could also add rot_gains_prev to ismInput and use that */ - /* previous position gains */ - if ( headRotData->headRotEnabled ) - { - rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); - rotatedPos.azimuth = (float) azi_rot; - rotatedPos.elevation = (float) ele_rot; - } - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, - ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->previousPos.azimuth, - ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->previousPos.elevation, - previousPanGains ) ) != IVAS_ERR_OK ) + else { - return error; - } - /* current position gains */ - if ( headRotData->headRotEnabled ) - { - rotateAziEle( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, &azi_rot, &ele_rot, Rmat, 0 ); - rotatedPos.azimuth = (float) azi_rot; - rotatedPos.elevation = (float) ele_rot; - } - if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, - ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, - ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, - currentPanGains ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( headRotData->headRotEnabled ) + { + subframe_len = ismInput->base.inputBuffer.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; + // for ( subframe_idx = 0; subframe_idx < RENDERER_HEAD_POSITIONS_PER_FRAME; subframe_idx++ ) + for ( subframe_idx = 0; subframe_idx < 1; subframe_idx++ ) + { + quat.w = headRotData->headPositions[subframe_idx].w; + quat.x = headRotData->headPositions[subframe_idx].x; + quat.y = headRotData->headPositions[subframe_idx].y; + quat.z = headRotData->headPositions[subframe_idx].z; + + QuatToRotMat( quat, Rmat ); + } + (void) subframe_len; // avoid warning + } + + /* TODO tmu : missing: interpolation between positions, 5ms rendering */ + /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ + /* TODO tmu2sgi: needs a lot of cleanup, we could also add rot_gains_prev to ismInput and use that */ + /* previous position gains */ + if ( headRotData->headRotEnabled ) + { + rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); + rotatedPos.azimuth = (float) azi_rot; + rotatedPos.elevation = (float) ele_rot; + } + + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->previousPos.azimuth, + ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->previousPos.elevation, + previousPanGains ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* current position gains */ + if ( headRotData->headRotEnabled ) + { + rotateAziEle( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, &azi_rot, &ele_rot, Rmat, 0 ); + rotatedPos.azimuth = (float) azi_rot; + rotatedPos.elevation = (float) ele_rot; + } + + if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, + ( headRotData->headRotEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, + ( headRotData->headRotEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, + currentPanGains ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( i = 0; i < 3; i++ ) + { + mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); + } - for ( i = 0; i < 3; i++ ) - { - mvr2r( Rmat[i], ismInput->rot_mat_prev[i], 3 ); - } + /* intermediate rendering to 7_1_4 */ + tmpMcBuffer = ismInput->base.inputBuffer; - /* intermediate rendering to 7_1_4 */ - tmpMcBuffer = ismInput->base.inputBuffer; - getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ); - tmpMcBuffer.config.numChannels = tmp; - tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); - set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); + if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + { + return error; + } - renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, tmpMcBuffer ); + tmpMcBuffer.config.numChannels = tmp; + tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); + set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); - copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); + renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, tmpMcBuffer ); + + copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); -#ifdef FIX_197_CREND_INTERFACE - ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, tmpCrendBuffer, *ismInput->base.ctx.pOutSampleRate ); +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else - ivas_rend_crendProcess( &ismInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM, tmpCrendBuffer, *ismInput->base.ctx.pOutSampleRate ); + if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, + NULL, NULL, NULL, NULL, tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif + { + return error; + } - accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); - - free( tmpMcBuffer.data ); + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); + free( tmpMcBuffer.data ); + } pop_wmops(); return IVAS_ERR_OK; @@ -4165,17 +4557,30 @@ static ivas_error renderIsmToMc( /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ if ( *ismInput->base.ctx.pOutConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) { - set_zero( currentPanGains, 16 ); - ivas_ism_get_stereo_gains( ismInput->currentPos.azimuth, - ismInput->currentPos.elevation, - ¤tPanGains[0], - ¤tPanGains[1] ); - - set_zero( previousPanGains, 16 ); - ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, - ismInput->previousPos.elevation, - &previousPanGains[0], - &previousPanGains[1] ); +#ifdef NON_DIEGETIC_PAN + if ( ismInput->nonDiegeticPan ) + { + previousPanGains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; + previousPanGains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; + error = IVAS_ERR_OK; + } + else + { +#endif + set_zero( currentPanGains, 16 ); + ivas_ism_get_stereo_gains( ismInput->currentPos.azimuth, + ismInput->currentPos.elevation, + ¤tPanGains[0], + ¤tPanGains[1] ); + + set_zero( previousPanGains, 16 ); + ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, + ismInput->previousPos.elevation, + &previousPanGains[0], + &previousPanGains[1] ); +#ifdef NON_DIEGETIC_PAN + } +#endif } else { @@ -4187,6 +4592,7 @@ static ivas_error renderIsmToMc( { return error; } + // TODO tmu review when #215 is resolved if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper, (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ), @@ -4196,6 +4602,7 @@ static ivas_error renderIsmToMc( return error; } } + /* Assume num channels in audio buffer to be 1. * This should have been validated in IVAS_REND_FeedInputAudio() */ renderBufferChannelLerp( ismInput->base.inputBuffer, 0, currentPanGains, previousPanGains, outAudio ); @@ -4223,6 +4630,7 @@ static ivas_error renderIsmToSba( { return error; } + if ( ( error = getAmbisonicsOrder( outConfig, &ambiOrderOut ) ) != IVAS_ERR_OK ) { return error; @@ -4277,7 +4685,6 @@ static ivas_error renderInputIsm( /* Apply input gain to new audio */ v_multc( inAudio.data, ismInput->base.gain, inAudio.data, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); - switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: @@ -4326,6 +4733,7 @@ static ivas_error renderActiveInputsIsm( /* Skip inactive inputs */ continue; } + if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; @@ -4392,27 +4800,29 @@ static ivas_error renderMcToBinaural( int8_t headRotEnabled; float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; IVAS_REND_AudioConfig inConfig; - ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; +#ifdef JBM_TSM_ON_TCS + float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; + int16_t i; + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_tmpRendBuffer[i] = tmpRendBuffer[i]; + } +#endif + push_wmops( "renderMcToBinaural" ); headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled; inConfig = mcInput->base.inConfig; - if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || - ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) + if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) { copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - if ( ( error = ivas_rend_TDObjRenderFrame( &mcInput->tdRendWrapper, - mcInput->base.inConfig, - &mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - NULL, - mcInput->base.inputBuffer.config.numSamplesPerChannel, - tmpRendBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, NULL, + mcInput->hReverb, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -4426,13 +4836,11 @@ static ivas_error renderMcToBinaural( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ); + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, + mcInput->rot_gains_prev, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); free( tmpRotBuffer.data ); @@ -4443,10 +4851,12 @@ static ivas_error renderMcToBinaural( } /* call CREND */ -#ifdef FIX_197_CREND_INTERFACE - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, mcInput->base.inConfig, outConfig, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -4456,7 +4866,10 @@ static ivas_error renderMcToBinaural( accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); /* TODO tmu : needs delay compensation */ - renderLfeToBinaural( mcInput, outAudio ); + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + { + return error; + } pop_wmops(); @@ -4468,51 +4881,79 @@ static ivas_error renderMcToBinauralRoom( const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio ) { - float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - + int8_t headRotEnabled; + float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + IVAS_REND_AudioConfig inConfig; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; +#ifdef JBM_TSM_ON_TCS + float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; + int16_t i; + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_tmpRendBuffer[i] = tmpRendBuffer[i]; + } +#endif + push_wmops( "renderMcToBinauralRoom" ); - /* apply rotation */ - if ( mcInput->base.ctx.pHeadRotData->headRotEnabled ) - { - tmpRotBuffer = mcInput->base.inputBuffer; - tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); - set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); + headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled; + inConfig = mcInput->base.inConfig; - rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ); + if ( ( mcInput->hReverb != NULL && mcInput->hReverb->pConfig.roomAcoustics.use_brir == 0 && mcInput->hReverb->pConfig.roomAcoustics.late_reverb_on == 1 ) && ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( headRotEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) ) + { + copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); - free( tmpRotBuffer.data ); + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, + NULL, mcInput->hReverb, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } } else { - copyBufferTo2dArray( mcInput->base.inputBuffer, tmpCrendBuffer ); - } + /* apply rotation */ + if ( headRotEnabled ) + { + tmpRotBuffer = mcInput->base.inputBuffer; + tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - /* call CREND */ -#ifdef FIX_197_CREND_INTERFACE - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, + mcInput->rot_gains_prev, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } + + copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); + free( tmpRotBuffer.data ); + } + else + { + copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); + } + + /* call CREND */ +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, mcInput->base.inConfig, outConfig, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif - { - return error; + { + return error; + } } - accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); - + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); /* TODO tmu : needs delay compensation */ - renderLfeToBinaural( mcInput, outAudio ); + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + { + return error; + } pop_wmops(); @@ -4533,12 +4974,23 @@ static ivas_error renderMcCustomLsToBinauralRoom( IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioBuffer *tmpBufPtr; +#ifdef JBM_TSM_ON_TCS + float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; +#endif + push_wmops( "renderMcCustomLsToBinauralRoom" ); tmpRotBuffer = outAudio; /* avoid compilation warning */ headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled; +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; + } +#endif + /* apply rotation */ if ( headRotEnabled ) { @@ -4546,19 +4998,21 @@ static ivas_error renderMcCustomLsToBinauralRoom( tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpRotBuffer.data, tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels ); - rotateFrameMc( mcInput->base.inputBuffer, - mcInput->base.inConfig, - mcInput->customLsInput, - mcInput->base.ctx.pHeadRotData, - mcInput->rot_gains_prev, - mcInput->efapInWrapper.hEfap, - tmpRotBuffer ); + if ( ( error = rotateFrameMc( mcInput->base.inputBuffer, mcInput->base.inConfig, mcInput->customLsInput, mcInput->base.ctx.pHeadRotData, mcInput->rot_gains_prev, mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } } /* intermediate conversion to 7_1_4 */ tmpMcBuffer = mcInput->base.inputBuffer; - getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ); - tmpMcBuffer.config.numChannels = (int16_t) tmp; + + if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + { + return error; + } + + tmpMcBuffer.config.numChannels = tmp; tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels ); @@ -4570,10 +5024,12 @@ static ivas_error renderMcCustomLsToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ -#ifdef FIX_197_CREND_INTERFACE - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, + p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, + tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -4582,7 +5038,10 @@ static ivas_error renderMcCustomLsToBinauralRoom( accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio ); /* TODO tmu : needs delay compensation */ - renderLfeToBinaural( mcInput, outAudio ); + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + { + return error; + } if ( headRotEnabled ) { @@ -4595,7 +5054,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( return IVAS_ERR_OK; } -static ivas_error renderMcToMc( +static void renderMcToMc( const input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) { @@ -4613,10 +5072,10 @@ static ivas_error renderMcToMc( pop_wmops(); - return IVAS_ERR_OK; + return; } -static ivas_error renderMcToSba( +static void renderMcToSba( const input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) { @@ -4634,7 +5093,7 @@ static ivas_error renderMcToSba( pop_wmops(); - return IVAS_ERR_OK; + return; } static ivas_error renderInputMc( @@ -4645,6 +5104,8 @@ static ivas_error renderInputMc( ivas_error error; IVAS_REND_AudioBuffer inAudio; + error = IVAS_ERR_OK; + inAudio = mcInput->base.inputBuffer; if ( mcInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) @@ -4663,10 +5124,10 @@ static ivas_error renderInputMc( switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = renderMcToMc( mcInput, outAudio ); + renderMcToMc( mcInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = renderMcToSba( mcInput, outAudio ); + renderMcToSba( mcInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) @@ -4691,13 +5152,8 @@ static ivas_error renderInputMc( default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } - return IVAS_ERR_OK; + return error; } static ivas_error renderActiveInputsMc( @@ -4715,6 +5171,7 @@ static ivas_error renderActiveInputsMc( /* Skip inactive inputs */ continue; } + if ( ( error = renderInputMc( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; @@ -4724,7 +5181,7 @@ static ivas_error renderActiveInputsMc( return IVAS_ERR_OK; } -static ivas_error renderSbaToMc( +static void renderSbaToMc( const input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) { @@ -4742,10 +5199,10 @@ static ivas_error renderSbaToMc( pop_wmops(); - return IVAS_ERR_OK; + return; } -static ivas_error renderSbaToSba( +static void renderSbaToSba( const input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) { @@ -4763,7 +5220,7 @@ static ivas_error renderSbaToSba( pop_wmops(); - return IVAS_ERR_OK; + return; } static ivas_error renderSbaToBinaural( @@ -4776,22 +5233,33 @@ static ivas_error renderSbaToBinaural( ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; +#ifdef JBM_TSM_ON_TCS + float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; + int16_t i; +#endif + push_wmops( "renderSbaToBinaural" ); +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; + } +#endif + /* apply rotation */ if ( sbaInput->base.ctx.pHeadRotData->headRotEnabled ) { tmpRotBuffer = sbaInput->base.inputBuffer; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + /* copy input for in-place rotation */ - mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, - tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); + mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); - rotateFrameSba( sbaInput->base.inputBuffer, - sbaInput->base.inConfig, - sbaInput->base.ctx.pHeadRotData, - sbaInput->rot_gains_prev, - tmpRotBuffer ); + if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } copyBufferTo2dArray( tmpRotBuffer, tmpCrendBuffer ); free( tmpRotBuffer.data ); @@ -4802,10 +5270,12 @@ static ivas_error renderSbaToBinaural( } /* call CREND */ -#ifdef FIX_197_CREND_INTERFACE - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( &sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -4827,16 +5297,26 @@ static ivas_error renderSbaToBinauralRoom( int16_t i; int16_t tmp; float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioBuffer *tmpBufPtr; +#ifdef JBM_TSM_ON_TCS + float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; +#endif + tmpRotBuffer = outAudio; /* avoid compilation warning */ push_wmops( "renderSbaToBinauralRoom" ); +#ifdef JBM_TSM_ON_TCS + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) + { + p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; + } +#endif + headRotEnabled = sbaInput->base.ctx.pHeadRotData->headRotEnabled; /* apply rotation */ @@ -4844,16 +5324,25 @@ static ivas_error renderSbaToBinauralRoom( { tmpRotBuffer = sbaInput->base.inputBuffer; tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); + /* copy input for in-place rotation */ mvr2r( sbaInput->base.inputBuffer.data, tmpRotBuffer.data, tmpRotBuffer.config.numChannels * tmpRotBuffer.config.numSamplesPerChannel ); - rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->rot_gains_prev, tmpRotBuffer ); + if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) + { + return error; + } } /* intermediate rendering to 7_1_4 */ tmpMcBuffer = sbaInput->base.inputBuffer; - getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ); - tmpMcBuffer.config.numChannels = (int16_t) tmp; + + if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + { + return error; + } + + tmpMcBuffer.config.numChannels = tmp; tmpMcBuffer.data = malloc( tmpMcBuffer.config.numSamplesPerChannel * tmpMcBuffer.config.numChannels * sizeof( float ) ); set_zero( tmpMcBuffer.data, tmpMcBuffer.config.numChannels * tmpMcBuffer.config.numSamplesPerChannel ); @@ -4866,10 +5355,12 @@ static ivas_error renderSbaToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ -#ifdef FIX_197_CREND_INTERFACE - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#ifdef JBM_TSM_ON_TCS + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( &sbaInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), + NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -4896,6 +5387,8 @@ static ivas_error renderInputSba( ivas_error error; IVAS_REND_AudioBuffer inAudio; + error = IVAS_ERR_OK; + inAudio = sbaInput->base.inputBuffer; if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) @@ -4914,10 +5407,10 @@ static ivas_error renderInputSba( switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = renderSbaToMc( sbaInput, outAudio ); + renderSbaToMc( sbaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = renderSbaToSba( sbaInput, outAudio ); + renderSbaToSba( sbaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) @@ -4935,13 +5428,8 @@ static ivas_error renderInputSba( default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } - return IVAS_ERR_OK; + return error; } static ivas_error renderActiveInputsSba( @@ -4969,39 +5457,50 @@ static ivas_error renderActiveInputsSba( return IVAS_ERR_OK; } -static void copyMasaMetadataToDiracRenderer( MASA_METADATA_FRAME *meta, DIRAC_DEC_HANDLE hDirAC ) +static void copyMasaMetadataToDiracRenderer( + MASA_METADATA_FRAME *meta, + DIRAC_DEC_HANDLE hDirAC ) { int16_t band, sf, bin; + int16_t meta_write_index; hDirAC->numSimultaneousDirections = meta->descriptive_meta.numberOfDirections + 1; for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { + meta_write_index = ( hDirAC->dirac_bs_md_write_idx + sf ) % hDirAC->dirac_md_buffer_length; + for ( band = 0; band < MASA_MAXIMUM_CODING_SUBBANDS; band++ ) { for ( bin = MASA_band_grouping_24[band]; bin < MASA_band_grouping_24[band + 1]; bin++ ) { - hDirAC->azimuth[sf][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; - hDirAC->elevation[sf][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; - hDirAC->energy_ratio1[sf][bin] = meta->directional_meta[0].energy_ratio[sf][band]; - hDirAC->diffuseness_vector[sf][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; - hDirAC->spreadCoherence[sf][bin] = meta->directional_meta[0].spread_coherence[sf][band]; - hDirAC->surroundingCoherence[sf][bin] = meta->common_meta.surround_coherence[sf][band]; + hDirAC->azimuth[meta_write_index][bin] = (int16_t) meta->directional_meta[0].azimuth[sf][band]; + hDirAC->elevation[meta_write_index][bin] = (int16_t) meta->directional_meta[0].elevation[sf][band]; + hDirAC->energy_ratio1[meta_write_index][bin] = meta->directional_meta[0].energy_ratio[sf][band]; + hDirAC->diffuseness_vector[meta_write_index][bin] = 1.0f - meta->directional_meta[0].energy_ratio[sf][band]; + hDirAC->spreadCoherence[meta_write_index][bin] = meta->directional_meta[0].spread_coherence[sf][band]; + hDirAC->surroundingCoherence[meta_write_index][bin] = meta->common_meta.surround_coherence[sf][band]; if ( hDirAC->numSimultaneousDirections == 2 ) { - hDirAC->azimuth2[sf][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; - hDirAC->elevation2[sf][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; - hDirAC->energy_ratio2[sf][bin] = meta->directional_meta[1].energy_ratio[sf][band]; - hDirAC->diffuseness_vector[sf][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; - hDirAC->spreadCoherence2[sf][bin] = meta->directional_meta[1].spread_coherence[sf][band]; + hDirAC->azimuth2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].azimuth[sf][band]; + hDirAC->elevation2[meta_write_index][bin] = (int16_t) meta->directional_meta[1].elevation[sf][band]; + hDirAC->energy_ratio2[meta_write_index][bin] = meta->directional_meta[1].energy_ratio[sf][band]; + hDirAC->diffuseness_vector[meta_write_index][bin] -= meta->directional_meta[1].energy_ratio[sf][band]; + hDirAC->spreadCoherence2[meta_write_index][bin] = meta->directional_meta[1].spread_coherence[sf][band]; } } } } + + hDirAC->dirac_bs_md_write_idx = ( hDirAC->dirac_bs_md_write_idx + MAX_PARAM_SPATIAL_SUBFRAMES ) % hDirAC->dirac_md_buffer_length; + + return; } -static ivas_error renderMasaToMc( input_masa *masaInput, IVAS_REND_AudioBuffer outAudio ) +static void renderMasaToMc( + input_masa *masaInput, + IVAS_REND_AudioBuffer outAudio ) { float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -5015,29 +5514,41 @@ static ivas_error renderMasaToMc( input_masa *masaInput, IVAS_REND_AudioBuffer o } else { +#ifdef JBM_TSM_ON_TCS + ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); +#else ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, NULL, NULL, -1 ); +#endif } accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); - return IVAS_ERR_OK; + return; } -static ivas_error renderMasaToSba( input_masa *masaInput, IVAS_REND_AudioBuffer outAudio ) +static void renderMasaToSba( + input_masa *masaInput, + IVAS_REND_AudioBuffer outAudio ) { float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC ); +#ifdef JBM_TSM_ON_TCS + ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); +#else ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, NULL, NULL, -1 ); +#endif accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); - return IVAS_ERR_OK; + return; } -static ivas_error renderMasaToBinaural( input_masa *masaInput, IVAS_REND_AudioBuffer outAudio ) +static void renderMasaToBinaural( + input_masa *masaInput, + IVAS_REND_AudioBuffer outAudio ) { float tmpBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -5048,15 +5559,14 @@ static ivas_error renderMasaToBinaural( input_masa *masaInput, IVAS_REND_AudioBu accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); - return IVAS_ERR_OK; + return; } static ivas_error renderInputMasa( input_masa *masaInput, - IVAS_REND_AudioConfig outConfig, + const IVAS_REND_AudioConfig outConfig, IVAS_REND_AudioBuffer outAudio ) { - ivas_error error; IVAS_REND_AudioBuffer inAudio; if ( !masaInput->metadataHasBeenFed ) @@ -5082,20 +5592,20 @@ static ivas_error renderInputMasa( switch ( getAudioConfigType( outConfig ) ) { case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - error = renderMasaToMc( masaInput, outAudio ); + renderMasaToMc( masaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - error = renderMasaToSba( masaInput, outAudio ); + renderMasaToSba( masaInput, outAudio ); break; case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { case IVAS_REND_AUDIO_CONFIG_BINAURAL: - error = renderMasaToBinaural( masaInput, outAudio ); + renderMasaToBinaural( masaInput, outAudio ); break; /* ToDo */ // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: - // error = renderMasaToBinauralRoom( masaInput, outConfig, outAudio ); + // renderMasaToBinauralRoom( masaInput, outConfig, outAudio ); // break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -5104,11 +5614,6 @@ static ivas_error renderInputMasa( default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } - /* Check error here to keep switch statement more compact */ - if ( error != IVAS_ERR_OK ) - { - return error; - } return IVAS_ERR_OK; } @@ -5117,7 +5622,7 @@ static ivas_error renderActiveInputsMasa( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) { - int32_t i; + int16_t i; input_masa *pCurrentInput; ivas_error error; @@ -5128,9 +5633,8 @@ static ivas_error renderActiveInputsMasa( /* Skip inactive inputs */ continue; } - if ( ( error = renderInputMasa( pCurrentInput, - hIvasRend->outputConfig, - outAudio ) ) != IVAS_ERR_OK ) + + if ( ( error = renderInputMasa( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) { return error; } @@ -5139,39 +5643,49 @@ static ivas_error renderActiveInputsMasa( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_GetSamples() + * + * + *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_GetSamples( - IVAS_REND_HANDLE hIvasRend, - IVAS_REND_AudioBuffer outAudio ) + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ +) { ivas_error error; int16_t numOutChannels; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( hIvasRend == NULL || outAudio.data == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) { return IVAS_ERR_INVALID_BUFFER_SIZE; } + if ( outAudio.config.numChannels <= 0 || MAX_OUTPUT_CHANNELS < outAudio.config.numChannels ) { return IVAS_ERR_WRONG_NUM_CHANNELS; } + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && outAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut ) { /* Binaural rendering requires specific frame size */ return IVAS_ERR_INVALID_BUFFER_SIZE; } + if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) { return error; } + if ( numOutChannels != outAudio.config.numChannels ) { return IVAS_ERR_WRONG_NUM_CHANNELS; @@ -5184,14 +5698,17 @@ ivas_error IVAS_REND_GetSamples( { return error; } + if ( ( error = renderActiveInputsMc( hIvasRend, outAudio ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = renderActiveInputsSba( hIvasRend, outAudio ) ) != IVAS_ERR_OK ) { return error; } + if ( ( error = renderActiveInputsMasa( hIvasRend, outAudio ) ) != IVAS_ERR_OK ) { return error; @@ -5205,16 +5722,21 @@ ivas_error IVAS_REND_GetSamples( return IVAS_ERR_OK; } + +/*-------------------------------------------------------------------* + * IVAS_REND_Close() + * + * + *-------------------------------------------------------------------*/ + void IVAS_REND_Close( - IVAS_REND_HANDLE *phIvasRend ) + IVAS_REND_HANDLE *phIvasRend /* i/o: Pointer to renderer handle */ +) { uint16_t i; IVAS_REND_HANDLE hIvasRend; - /*-----------------------------------------------------------------* - * Validate function arguments - *-----------------------------------------------------------------*/ - + /* Validate function arguments */ if ( phIvasRend == NULL || *phIvasRend == NULL ) { return; @@ -5249,6 +5771,8 @@ void IVAS_REND_Close( ivas_limiter_close( &hIvasRend->hLimiter ); + closeHeadRotation( hIvasRend ); + free( hIvasRend ); *phIvasRend = NULL; @@ -5256,6 +5780,12 @@ void IVAS_REND_Close( } #ifdef DEBUGGING +/*-------------------------------------------------------------------* + * IVAS_REND_GetNoCLipping() + * + * + *-------------------------------------------------------------------*/ + int32_t IVAS_REND_GetNoCLipping( IVAS_REND_CONST_HANDLE hIvasRend ) { @@ -5273,23 +5803,3 @@ int32_t IVAS_REND_GetCntFramesLimited( return hIvasRend->hLimiter->cnt_frames_limited; } #endif - -#ifdef FIX_197_CREND_INTERFACE -ivas_error ivas_rend_initEfap( - AUDIO_CONFIG outConfig, - EFAP_HANDLE *hEfap ) -{ - ivas_error err; - IVAS_REND_AudioConfig audioCfg; - EFAP_WRAPPER wrap; - LSSETUP_CUSTOM_STRUCT customLsOut; - wrap.hEfap = NULL; - wrap.pCustomLsSetup = NULL; - audioCfg = getRendAudioConfigFromIvasAudioConfig( outConfig ); - memset( &customLsOut, 0, sizeof( LSSETUP_CUSTOM_STRUCT ) ); - err = initEfap( &wrap, audioCfg, &customLsOut ); - *hEfap = wrap.hEfap; - - return err; -} -#endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index b2ca45c70c5e877cc5d123d74b8baaf0af112b20..f9b2781110875e8d03da2a8e4d7f4c206e0b1d8a 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -33,25 +33,15 @@ #ifndef LIB_REND_H #define LIB_REND_H +#include "common_api_types.h" #include -#include -#include -#include "options.h" -#include "common_api_types.h" -#include "ivas_error.h" -#ifdef FIX_197_CREND_INTERFACE -#include "ivas_stat_rend.h" -#endif #define RENDERER_MAX_ISM_INPUTS 4 #define RENDERER_MAX_MC_INPUTS 1 #define RENDERER_MAX_SBA_INPUTS 1 #define RENDERER_MAX_MASA_INPUTS 1 -#ifndef FIX_197_CREND_INTERFACE - -#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; @@ -73,12 +63,6 @@ typedef struct const float *data; } IVAS_REND_ReadOnlyAudioBuffer; -typedef struct -{ - float azimuth; - float elevation; -} IVAS_REND_AudioObjectPosition; - typedef struct IVAS_REND *IVAS_REND_HANDLE; typedef struct IVAS_REND const *IVAS_REND_CONST_HANDLE; @@ -140,13 +124,6 @@ typedef enum typedef uint16_t IVAS_REND_InputId; -#else - -AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( - IVAS_REND_AudioConfig config ); - -#endif - /* clang-format off */ /*----------------------------------------------------------------------------------* * Function prototypes @@ -157,7 +134,13 @@ AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ const int32_t outputSampleRate, /* i : output sampling rate */ +#ifdef NON_DIEGETIC_PAN + const IVAS_REND_AudioConfig outConfig, /* i : output audio config */ + const int16_t nonDiegeticPan, /* i : non-diegetic object flag */ + const float nonDiegeticPanGain /* i : non-diegetic panning gain */ +#else const IVAS_REND_AudioConfig outConfig /* i : output audio config */ +#endif ); /* Note: this will reset custom LFE routings set for any MC input */ @@ -176,7 +159,7 @@ ivas_error IVAS_REND_SetCustomHrtf( /* Functions to be called before/during rendering */ ivas_error IVAS_REND_NumOutChannels( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ int16_t *numOutChannels /* o : number of output channels */ ); @@ -251,23 +234,50 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( ); ivas_error IVAS_REND_InitConfig( - IVAS_REND_HANDLE st, /* i/o: Renderer handle */ - bool rendererConfigEnabled /* i : flag indicating if a renderer configuration file was supplied */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ ); int16_t IVAS_REND_GetRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ); int16_t IVAS_REND_FeedRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ - const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : head positions for next rendering call */ + const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ + const IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ +); + +ivas_error IVAS_REND_SetOrientationTrackingMode( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const uint8_t otrMode /* i : Orientation tracking mode */ +); + +ivas_error IVAS_REND_SetReferenceRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_QUATERNION refRot /* i : Reference rotation */ +); + +ivas_error IVAS_REND_GetMainOrientation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *pOrientation /* i/o: Quaternion pointer for main orientation */ +); + +ivas_error IVAS_REND_GetTrackedRotation( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_QUATERNION *pRotation /* i/o: Quaternion pointer for processed rotation */ +); + +ivas_error IVAS_REND_SetReferenceVector( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ ); ivas_error IVAS_REND_GetSamples( @@ -291,12 +301,6 @@ int32_t IVAS_REND_GetCntFramesLimited( ); #endif -#ifdef FIX_197_CREND_INTERFACE -ivas_error ivas_rend_initEfap( - AUDIO_CONFIG outConfig, - EFAP_HANDLE *hEfap - ); -#endif /* clang-format on */ #endif diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index 9599cff16930e503340e7f3ef894229291234195..4f6bd0c34d13fd62439775d31933f9d67a4197f4 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -40,6 +40,7 @@ struct AudioFileReader { FILE *rawFile; WAVEFILEIN *wavFile; + uint32_t samplingRate; int16_t numChannels; }; @@ -54,14 +55,12 @@ static int8_t AudioFileReader_open_raw( static int8_t AudioFileReader_open_wav( AudioFileReader *self, - const char *fileName, - int32_t *sampleRate ) + const char *fileName ) { - uint32_t sampleRate_, samplesInFile; + uint32_t samplesInFile; int16_t bps; - self->wavFile = OpenWav( fileName, &sampleRate_, &self->numChannels, &samplesInFile, &bps ); - *sampleRate = sampleRate_; + self->wavFile = OpenWav( fileName, &self->samplingRate, &self->numChannels, &samplesInFile, &bps ); if ( !self->wavFile ) { @@ -76,8 +75,7 @@ static int8_t AudioFileReader_open_wav( /*! r: AudioFileReader handle */ ivas_error AudioFileReader_open( AudioFileReader **audioReader, /* o : AudioFileReader handle */ - const char *fileName, /* i : path to wav/raw pcm file */ - int32_t *sampleRate /* o : sample rate of wav file, unused with pcm */ + const char *fileName /* i : path to wav/raw pcm file */ ) { AudioFileReader *self; @@ -100,11 +98,12 @@ ivas_error AudioFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } self = calloc( sizeof( AudioFileReader ), 1 ); + self->samplingRate = 0; self->numChannels = 0; if ( fileNameLen > wavSuffixLen && strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) { - retCode = AudioFileReader_open_wav( self, fileName, sampleRate ); + retCode = AudioFileReader_open_wav( self, fileName ); } else { @@ -180,15 +179,53 @@ ivas_error AudioFileReader_read( return error; } -/*! r: number of channels of the opened file */ -int16_t AudioFileReader_getNumChannels( - AudioFileReader *self /* i/o: AudioFileReader handle */ -) +ivas_error AudioFileReader_getSamplingRate( + AudioFileReader *self, + int32_t *samplingRate ) { - if ( self != NULL ) + if ( self == NULL || samplingRate == NULL ) { - return self->numChannels; + return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - return 0; + if ( self->rawFile ) + { + return IVAS_ERR_SAMPLING_RATE_UNKNOWN; + } + else if ( self->wavFile ) + { + *samplingRate = self->samplingRate; + } + else + { + return IVAS_ERR_NO_FILE_OPEN; + } + + return IVAS_ERR_OK; +} + + +ivas_error AudioFileReader_getNumChannels( + AudioFileReader *self, + int16_t *numChannels ) +{ + if ( self == NULL || numChannels == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + if ( self->rawFile ) + { + return IVAS_ERR_NUM_CHANNELS_UNKNOWN; + } + else if ( self->wavFile ) + { + *numChannels = self->numChannels; + } + else + { + return IVAS_ERR_NO_FILE_OPEN; + } + + return IVAS_ERR_OK; } diff --git a/lib_util/audio_file_reader.h b/lib_util/audio_file_reader.h index 46c458e646a79653c316d4805fe5ba723caab8c1..0fd4da5ac76c25285d3b49d67166ce651a96eeb8 100644 --- a/lib_util/audio_file_reader.h +++ b/lib_util/audio_file_reader.h @@ -33,8 +33,7 @@ #ifndef IVAS_AUDIO_FILE_READER_H #define IVAS_AUDIO_FILE_READER_H -#include -#include "ivas_error.h" +#include "common_api_types.h" struct AudioFileReader; typedef struct AudioFileReader AudioFileReader; @@ -43,11 +42,9 @@ typedef struct AudioFileReader AudioFileReader; ivas_error AudioFileReader_open( AudioFileReader **audioReader, /* o : AudioFileReader handle */ - const char *fileName, /* i : path to wav/raw pcm file */ - int32_t *sampleRate /* o : sample rate of wav file, unused with pcm */ + const char *fileName /* i : path to wav/raw pcm file */ ); -/*! r: number of read samples */ ivas_error AudioFileReader_read( AudioFileReader *self, /* i/o: AudioFileReader handle */ int16_t *samples, /* o : samples read from the opened file */ @@ -55,9 +52,16 @@ ivas_error AudioFileReader_read( int16_t *numSamplesRead /* i : number of samples actualy read */ ); -/*! r: number of channels of the opened file */ -int16_t AudioFileReader_getNumChannels( - AudioFileReader *self /* i/o: AudioFileReader handle */ +/*! r: ivas error - in particular, IVAS_ERR_SAMPLING_RATE_UNKNOWN if the opened file has no sampling rate metadata */ +ivas_error AudioFileReader_getSamplingRate( + AudioFileReader *self, /* i/o: AudioFileReader handle */ + int32_t* samplingRate /* o : sampling rate of opened audio file */ +); + +/*! r: ivas error - in particular, IVAS_ERR_NUM_CHANNELS_UNKNOWN if the opened file has no metadata specifying number of channels */ +ivas_error AudioFileReader_getNumChannels( + AudioFileReader *self, /* i/o: AudioFileReader handle */ + int16_t * numChannels /* o : number fo channels in opened audio file */ ); void AudioFileReader_close( diff --git a/lib_util/audio_file_writer.c b/lib_util/audio_file_writer.c index d6cbb1810ed4729e1f749e4ec505435f50cc0e3c..81084dbd95b686d52477327b948ada136225f42f 100644 --- a/lib_util/audio_file_writer.c +++ b/lib_util/audio_file_writer.c @@ -98,7 +98,7 @@ ivas_error AudioFileWriter_open( int8_t retCode; - if ( fileNameLen > wavSuffixLen && strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) + if ( ( fileNameLen > wavSuffixLen ) && ( strncmp( fileName + fileNameLen - wavSuffixLen, wavSuffix, wavSuffixLen ) == 0 ) ) { retCode = AudioFileWriter_open_wav( self, fileName, sampleRate, numChannels ); } diff --git a/lib_util/audio_file_writer.h b/lib_util/audio_file_writer.h index e2bf1b850d4e48f510be797eacb8b07be627a2a5..b5157ffde43f74a15803ec132814992a4fb8ce8f 100644 --- a/lib_util/audio_file_writer.h +++ b/lib_util/audio_file_writer.h @@ -33,8 +33,7 @@ #ifndef IVAS_AUDIO_FILE_WRITER_H #define IVAS_AUDIO_FILE_WRITER_H -#include -#include "ivas_error.h" +#include "common_api_types.h" struct AudioFileWriter; typedef struct AudioFileWriter AudioFileWriter; diff --git a/lib_util/bitstream_reader.h b/lib_util/bitstream_reader.h index 3d6ac06f20eaf74fc57cf0c9af26f6d6f9f2dba8..2accbbd242670d69f612780ce4b46018a5b05e72 100644 --- a/lib_util/bitstream_reader.h +++ b/lib_util/bitstream_reader.h @@ -33,9 +33,7 @@ #ifndef BITSTREAM_READER_H #define BITSTREAM_READER_H -#include "options.h" -#include "ivas_error.h" -#include +#include "common_api_types.h" /*-----------------------------------------------------------------------* diff --git a/lib_util/bitstream_writer.c b/lib_util/bitstream_writer.c index 0e0f9af6ae1066e06280bf2437b9d13ec6b313ec..7862ff1977c840601d39065c173eecf32674d290 100644 --- a/lib_util/bitstream_writer.c +++ b/lib_util/bitstream_writer.c @@ -33,7 +33,6 @@ #include "bitstream_writer.h" #include "g192.h" #include "mime_io.h" -#include "ivas_error.h" #include "ivas_error_utils.h" #include #include diff --git a/lib_util/bitstream_writer.h b/lib_util/bitstream_writer.h index 19b09907bf0ecc738f2ad4640a33da020418573a..a855f347d272e09d8996e4540154c580ba29cefb 100644 --- a/lib_util/bitstream_writer.h +++ b/lib_util/bitstream_writer.h @@ -33,8 +33,7 @@ #ifndef BITSTREAM_WRITER_H #define BITSTREAM_WRITER_H -#include -#include "ivas_error.h" +#include "common_api_types.h" /*-----------------------------------------------------------------------* diff --git a/lib_util/cmdl_tools.c b/lib_util/cmdl_tools.c index d9e4d5386ed2fac264b66552698cfb562bb03680..b0b7e906cca95b1bb64e66a62677ec1ef1eb21e9 100644 --- a/lib_util/cmdl_tools.c +++ b/lib_util/cmdl_tools.c @@ -31,6 +31,7 @@ *******************************************************************************************************/ #include "cmdl_tools.h" +#include /*---------------------------------------------------------------------* * to_upper() @@ -141,3 +142,86 @@ bool is_number( const char *str ) return true; } + + +/*---------------------------------------------------------------------* + * convert_backslash() + * + * + *---------------------------------------------------------------------*/ + +void convert_backslash( + char *str ) +{ + int16_t i, len; + + /* check that all backslashes are correct on the given platform */ + len = (int16_t) strlen( str ); + + for ( i = 0; i < len; i++ ) + { +#ifdef _WIN32 + if ( str[i] == '/' ) + { + str[i] = '\\'; + } +#else + if ( str[i] == '\\' ) + { + str[i] = '/'; + } +#endif + } + + return; +} + +/*---------------------------------------------------------------------* + * remove_cr() + * + * + *---------------------------------------------------------------------*/ + +void remove_cr( + char *str ) +{ + char *pos; + + /* remove all \r characters from the string */ + pos = strchr( str, '\r' ); + while ( pos != NULL ) + { + strcpy( pos, pos + 1 ); + pos = strchr( pos, '\r' ); + } + + return; +} + + +/*---------------------------------------------------------------------* + * clearString() + * + * + *---------------------------------------------------------------------*/ + +void clearString( + char *str ) +{ + str[0] = '\0'; + + return; +} + + +/*---------------------------------------------------------------------* + * isEmptyString() + * + * + *---------------------------------------------------------------------*/ + +bool isEmptyString( + const char *str ) +{ + return str[0] == '\0'; +} diff --git a/lib_util/cmdl_tools.h b/lib_util/cmdl_tools.h index 92dba6c1e1e8085c0777f47f9b553c5524a8c052..b160473002930dd2c980d9bfbdcfb8e1bad3722a 100644 --- a/lib_util/cmdl_tools.h +++ b/lib_util/cmdl_tools.h @@ -42,5 +42,12 @@ bool is_number( const char *str ); char *to_upper( char *str ); +void convert_backslash( char *str ); + +void remove_cr( char *str ); + +void clearString( char *str ); + +bool isEmptyString( const char *str ); #endif /* CMDL_TOOLS_H */ diff --git a/lib_util/cmdln_parser.c b/lib_util/cmdln_parser.c index 2a29505a393e6dd603928add74b0863f8d252d12..a239412f25f914b497ae1e053b1c94853f8fc1d5 100644 --- a/lib_util/cmdln_parser.c +++ b/lib_util/cmdln_parser.c @@ -31,7 +31,7 @@ *******************************************************************************************************/ #include "cmdln_parser.h" - +#include "cmdl_tools.h" #include #include #include @@ -48,7 +48,9 @@ typedef struct int8_t hasBeenParsed; } Option; -static int16_t validateNoDuplicateIds( const OptionProps *props, int32_t numOpts ) +static int16_t validateNoDuplicateIds( + const OptionProps *props, + int32_t numOpts ) { for ( int32_t i = 0; i < numOpts; ++i ) { @@ -65,7 +67,8 @@ static int16_t validateNoDuplicateIds( const OptionProps *props, int32_t numOpts return 0; } -static int16_t validateOptionProps( OptionProps props ) +static int16_t validateOptionProps( + OptionProps props ) { /* Check required properties */ if ( props.match == NULL ) @@ -85,7 +88,10 @@ static int16_t validateOptionProps( OptionProps props ) } /* Validate given OptionProps and use them to initialize array of Options */ -static int16_t initOpts( const OptionProps *options, int32_t numOpts, Option *opts ) +static int16_t initOpts( + const OptionProps *options, + const int32_t numOpts, + Option *opts ) { for ( int32_t i = 0; i < numOpts; ++i ) { @@ -111,9 +117,14 @@ static int16_t initOpts( const OptionProps *options, int32_t numOpts, Option *op return 0; } -static int8_t stringLooksLikeOption( const char *str ) +static int8_t stringLooksLikeOption( + const char *str ) { +#ifdef NON_DIEGETIC_PAN + if ( ( str[0] == '-' ) && is_number( str ) == false ) +#else if ( str[0] == '-' ) +#endif { return 1; } @@ -121,9 +132,14 @@ static int8_t stringLooksLikeOption( const char *str ) return 0; } -static const char *stringToOptionName( const char *str ) +static const char *stringToOptionName( + const char *str ) { +#ifdef NON_DIEGETIC_PAN + while ( ( *str == '-' ) && ( ( str[1] != '0' ) || ( str[1] != '1' ) ) ) +#else while ( *str == '-' ) +#endif { ++str; } @@ -131,7 +147,9 @@ static const char *stringToOptionName( const char *str ) return str; } -static int8_t optionMatchesString( Option opt, const char *str ) +static int8_t optionMatchesString( + Option opt, + const char *str ) { if ( !stringLooksLikeOption( str ) ) { @@ -148,12 +166,13 @@ static int8_t optionMatchesString( Option opt, const char *str ) return 0; } -static int16_t parseOpts( int32_t argc, - char **argv, - Option *opts, - int32_t numOpts, - void *pOutputStruct, - CmdLnParser_FnPtr_ParseOption parseOption ) +static int16_t parseOpts( + int32_t argc, + char **argv, + Option *opts, + const int32_t numOpts, + void *pOutputStruct, + CmdLnParser_FnPtr_ParseOption parseOption ) { Option *currOpt = NULL; int32_t currOptIdx = 1; @@ -234,7 +253,8 @@ static int16_t parseOpts( int32_t argc, return 0; } -static const char *getBasename( const char *path ) +static const char *getBasename( + const char *path ) { /* Find last forward slash in path */ const char *namePtr = strrchr( path, '/' ); @@ -254,12 +274,14 @@ static const char *getBasename( const char *path ) return path; } -static int32_t totalOptionNameLength( const OptionProps opt ) +static int32_t totalOptionNameLength( + const OptionProps opt ) { - return strlen( opt.match ) + strlen( opt.matchShort ); + return (int32_t) ( strlen( opt.match ) + strlen( opt.matchShort ) ); } -static void printWhitespace( int32_t n ) +static void printWhitespace( + const int32_t n ) { for ( int32_t i = 0; i < n; ++i ) { @@ -267,7 +289,9 @@ static void printWhitespace( int32_t n ) } } -static void printOptDescriptionAligned( const char *descPtr, int32_t descriptionColumnIdx ) +static void printOptDescriptionAligned( + const char *descPtr, + int32_t descriptionColumnIdx ) { if ( descPtr == NULL ) { @@ -290,12 +314,14 @@ static void printOptDescriptionAligned( const char *descPtr, int32_t description } ++descPtr; } + + return; } static void printUsage( const char *argv0, const OptionProps *optionProps, - int32_t numOptions ) + const int32_t numOptions ) { fprintf( stderr, "\n" ); fprintf( stderr, "Usage: %s [options]\n", getBasename( argv0 ) ); @@ -326,14 +352,17 @@ static void printUsage( printWhitespace( maxOptNameLength - optNameLength + preDescriptionWhitespace ); printOptDescriptionAligned( opt.description, maxOptNameLength + preDescriptionWhitespace + leftColumnAdditionalChars ); } + + return; } -int16_t CmdLnParser_parseArgs( int32_t argc, - char **argv, - const OptionProps *optionProps, - int32_t numOptions, - void *pOutputStruct, - CmdLnParser_FnPtr_ParseOption parseOption ) +int16_t CmdLnParser_parseArgs( + int32_t argc, + char **argv, + const OptionProps *optionProps, + const int32_t numOptions, + void *pOutputStruct, + CmdLnParser_FnPtr_ParseOption parseOption ) { assert( numOptions <= MAX_SUPPORTED_OPTS ); @@ -357,9 +386,12 @@ fail: return -1; } -void CmdLnParser_printUsage( char *executableName, - const CmdLnParser_Option *options, - int32_t numOptions ) +void CmdLnParser_printUsage( + char *executableName, + const CmdLnParser_Option *options, + const int32_t numOptions ) { printUsage( executableName, options, numOptions ); + + return; } diff --git a/lib_util/cmdln_parser.h b/lib_util/cmdln_parser.h index b5db25c19325be5f8a6b881ae8c9b0edfb00e49a..b8c8370eb4e7efbfa3c6da5a1c2c661510bb1a89 100644 --- a/lib_util/cmdln_parser.h +++ b/lib_util/cmdln_parser.h @@ -33,11 +33,9 @@ #ifndef CMDLN_PARSER_H #define CMDLN_PARSER_H -#include +#include "common_api_types.h" #include -#include "options.h" - typedef struct { int32_t id; @@ -47,21 +45,10 @@ typedef struct } CmdLnParser_Option; /* Function for parsing option values into an output struct, to be implemented by the user */ -typedef void ( *CmdLnParser_FnPtr_ParseOption )( int32_t optionId, /* i : option ID of matched option */ - char **optionValues, /* i : array of string values following the matched option in argv */ - int16_t numOptionValues, /* i : number of string values following the matched option in argv */ - void *pOutputStruct /* o : struct to store parsed values */ -); +typedef void ( *CmdLnParser_FnPtr_ParseOption )( int32_t optionId, char **optionValues, int16_t numOptionValues, void *pOutputStruct ); -int16_t CmdLnParser_parseArgs( int32_t argc, - char **argv, - const CmdLnParser_Option *options, - int32_t numOptions, - void *pOutputStruct, - CmdLnParser_FnPtr_ParseOption parseOption ); +int16_t CmdLnParser_parseArgs( int32_t argc, char **argv, const CmdLnParser_Option *options, const int32_t numOptions, void *pOutputStruct, CmdLnParser_FnPtr_ParseOption parseOption ); -void CmdLnParser_printUsage( char *executableName, - const CmdLnParser_Option *options, - int32_t numOptions ); +void CmdLnParser_printUsage( char *executableName, const CmdLnParser_Option *options, const int32_t numOptions ); #endif /* CMDLN_PARSER_H */ diff --git a/lib_util/g192.c b/lib_util/g192.c index 2105c1d5a87611fc14dce1f2b26e4fdbf748073d..04ba16c369a2d556562544186b70cc23ddab3b27 100644 --- a/lib_util/g192.c +++ b/lib_util/g192.c @@ -35,10 +35,7 @@ ====================================================================================*/ #include "g192.h" -#include "common_api_types.h" #include -#include -#include #include #include #ifndef _WIN32 diff --git a/lib_util/g192.h b/lib_util/g192.h index f07cc77b227279a28fb984d23133c35d0d60db4f..2dfd34b9e547a3acf40a40617ebb4d84b5997457 100644 --- a/lib_util/g192.h +++ b/lib_util/g192.h @@ -37,8 +37,9 @@ #ifndef G192_H #define G192_H G192_H +#include "common_api_types.h" #include -#include + /*-----------------------------------------------------------------------* * Enums diff --git a/lib_util/head_rotation_file_reader.c b/lib_util/head_rotation_file_reader.c index 4267be7c524c8035d1ae840d6b2bdd0c343213fc..0283c292334daec7e88a2ffa6f54eb790f455257 100644 --- a/lib_util/head_rotation_file_reader.c +++ b/lib_util/head_rotation_file_reader.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include "head_rotation_file_reader.h" -#include #include #include #include @@ -94,33 +93,41 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ - IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ - const int32_t frame_dec /* i : decoded frame number */ + IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ + IVAS_VECTOR3 *pPos /* o : listener position */ ) { - uint16_t i; float w, x, y, z; + float posx, posy, posz; + int32_t read_values; - for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + posx = 0.0f; + posy = 0.0f; + posz = 0.0f; + + read_values = fscanf( headRotReader->trajFile, "%f,%f,%f,%f,%f,%f,%f", &w, &x, &y, &z, &posx, &posy, &posz ); + if ( ( read_values != 4 ) && ( read_values != 7 ) ) /* Allow either orientation (4) or orientation+position (4+3) */ { - if ( 4 != fscanf( headRotReader->trajFile, "%f,%f,%f,%f", &w, &x, &y, &z ) ) + if ( feof( headRotReader->trajFile ) ) { - if ( feof( headRotReader->trajFile ) ) - { - rewind( headRotReader->trajFile ); - headRotReader->fileRewind = true; - return HeadRotationFileReading( headRotReader, Quaternions, frame_dec ); - } - return IVAS_ERR_FAILED_FILE_PARSE; + rewind( headRotReader->trajFile ); + headRotReader->fileRewind = true; + return HeadRotationFileReading( headRotReader, pQuaternion, pPos ); } + return IVAS_ERR_FAILED_FILE_PARSE; + } + ( headRotReader->frameCounter )++; - ( headRotReader->frameCounter )++; - - Quaternions[i].w = w; - Quaternions[i].x = x; - Quaternions[i].y = y; - Quaternions[i].z = z; + pQuaternion->w = w; + pQuaternion->x = x; + pQuaternion->y = y; + pQuaternion->z = z; + if ( pPos != NULL ) + { + pPos->x = posx; + pPos->y = posy; + pPos->z = posz; } return IVAS_ERR_OK; diff --git a/lib_util/head_rotation_file_reader.h b/lib_util/head_rotation_file_reader.h index ad993185631f853ac7248a9616e55055b560f973..52b97ae1c3db0417fb308b47b484bb0b11feea61 100644 --- a/lib_util/head_rotation_file_reader.h +++ b/lib_util/head_rotation_file_reader.h @@ -34,7 +34,6 @@ #define IVAS_HR_FILE_READER_H #include "common_api_types.h" -#include "ivas_error.h" #define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 @@ -60,8 +59,8 @@ ivas_error HeadRotationFileReader_open( ivas_error HeadRotationFileReading( HeadRotFileReader *headRotReader, /* i/o: HeadRotFileReader handle */ - IVAS_QUATERNION *Quaternions, /* o : head-tracking data */ - const int32_t frame_dec /* i : decoded frame number */ + IVAS_QUATERNION *pQuaternion, /* o : head-tracking data */ + IVAS_VECTOR3 *pPos /* o : listener position */ ); /*-----------------------------------------------------------------------* diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 33337258ea25073a3f43866b736921a01e7b70df..b7ffe8168201577d495040cf84e2e20ac6b51add 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -31,14 +31,14 @@ *******************************************************************************************************/ #include "hrtf_file_reader.h" -#include #include #include "prot.h" -#include "ivas_prot.h" +#include "ivas_prot_rend.h" -#ifdef HRTF_BINARY_FILE -#include "lib_dec.h" -#endif + +/*---------------------------------------------------------------------* + * Local structures + *---------------------------------------------------------------------*/ struct hrtfFileReader { @@ -46,6 +46,16 @@ struct hrtfFileReader char *file_path; }; +typedef struct ivas_hrtfs_file_header_t +{ + char identifier[8]; + int32_t file_size; + int16_t nb_hrtf; + int32_t max_data_size; + +} ivas_hrtfs_file_header_t; + + /*---------------------------------------------------------------------* * Local constants *---------------------------------------------------------------------*/ @@ -120,23 +130,23 @@ void hrtfFileReader_close( } -#ifdef HRTF_BINARY_FILE - /*-------------------------------------------------------------------* * read_and_check_hrtf_binary_file_header() * * Check the HRTF file header read from binary file --------------------------------------------------------------------*/ -static ivas_error read_and_check_hrtf_binary_file_header( ivas_hrtfs_file_header_t *hrtf_file_header, FILE *f_hrtf ) +static ivas_error read_and_check_hrtf_binary_file_header( + ivas_hrtfs_file_header_t *hrtf_file_header, + FILE *f_hrtf ) { int32_t file_size; - // [Declaration of the binary file] - // File Identifier (8 bytes) - // Size of file in bytes (4 bytes) - // Number of HRTF (2 bytes) - // Max length of HRTF data (4 bytes) + /* [Declaration of the binary file] */ + /* File Identifier (8 bytes) */ + /* Size of file in bytes (4 bytes) */ + /* Number of HRTF (2 bytes) */ + /* Max length of HRTF data (4 bytes) */ fseek( f_hrtf, 0, SEEK_END ); file_size = ftell( f_hrtf ); @@ -172,47 +182,49 @@ static ivas_error read_and_check_hrtf_binary_file_header( ivas_hrtfs_file_header * Check the HRTF section header - read from binary file --------------------------------------------------------------------*/ -static ivas_error check_hrtf_binary_header( ivas_hrtfs_header_t *hrtf_header ) +static ivas_error check_hrtf_binary_header( + ivas_hrtfs_header_t *hrtf_header ) { - // Check the renderer type + /* Check the renderer type */ if ( ( hrtf_header->rend_type != RENDERER_BINAURAL_MIXER_CONV ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_MIXER_CONV_ROOM ) && -#ifdef HRTF_BINARY_FILE ( hrtf_header->rend_type != RENDERER_BINAURAL_FASTCONV ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_FASTCONV_ROOM ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_PARAMETRIC ) && ( hrtf_header->rend_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) && -#endif ( hrtf_header->rend_type != RENDERER_BINAURAL_OBJECTS_TD ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Header of HRTF binary file not compliant (renderer type)" ); } - // Check the output format of the decoder + /* Check the output format of the decoder */ if ( ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_HOA ) && ( hrtf_header->input_cfg != BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Header of HRTF binary file not compliant (input audio configuration)" ); } - // Check the sampling frequency + /* Check the sampling frequency */ if ( ( hrtf_header->frequency != 48000 ) && ( hrtf_header->frequency != 32000 ) && ( hrtf_header->frequency != 16000 ) ) { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Header of HRTF binary file not compliant (sampling frequency)" ); + return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Header of HRTF binary file not compliant (sampling frequency)" ); } return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * read_hrtf_binary_header() * * Read the HRTF header from binary file --------------------------------------------------------------------*/ -static ivas_error read_hrtf_binary_header( ivas_hrtfs_header_t *hrtf_header, FILE *f_hrtf ) +static ivas_error read_hrtf_binary_header( + ivas_hrtfs_header_t *hrtf_header, + FILE *f_hrtf ) { - // HRTF Header - // Renderer type (4 bytes) : See "RENDERER_TYPE" - // Input configuration (4 bytes) : See "BINAURAL_INPUT_AUDIO_CONFIG" - // Sampling Frequency (4 bytes) - // Raw data size (4 bytes) + /* HRTF Header */ + /* Renderer type (4 bytes) : See "RENDERER_TYPE" */ + /* Input configuration (4 bytes) : See "BINAURAL_INPUT_AUDIO_CONFIG" */ + /* Sampling Frequency (4 bytes) */ + /* Raw data size (4 bytes) */ if ( ( fread( &( hrtf_header->rend_type ), sizeof( int32_t ), 1, f_hrtf ) == 1 ) && ( fread( &( hrtf_header->input_cfg ), sizeof( int32_t ), 1, f_hrtf ) == 1 ) && ( fread( &( hrtf_header->frequency ), sizeof( int32_t ), 1, f_hrtf ) == 1 ) && ( fread( &( hrtf_header->data_size ), sizeof( int32_t ), 1, f_hrtf ) == 1 ) ) { @@ -222,8 +234,6 @@ static ivas_error read_hrtf_binary_header( ivas_hrtfs_header_t *hrtf_header, FIL return IVAS_ERR_END_OF_FILE; } -#endif - /*-------------------------------------------------------------------* * LoadBSplineBinaryITD() @@ -298,6 +308,8 @@ static ivas_error LoadBSplineBinary( ModelParams_t *model; int16_t i, tmp; + fread( &HrFiltSet_p->latency_s, sizeof( float ), 1, f_hrtf ); + model = &( HrFiltSet_p->ModelParams ); /* Set ROM flag for correct deallocation */ @@ -421,6 +433,7 @@ static ivas_error LoadBSplineBinary( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * TDREND_MIX_LoadHRTF() * @@ -434,9 +447,6 @@ static ivas_error TDREND_MIX_LoadHRTF( { int16_t tmp; ivas_error error; - -#ifdef HRTF_BINARY_FILE - bool is_tdrend; ivas_error header_check_result; ivas_hrtfs_file_header_t hrtfs_file_header; @@ -445,42 +455,12 @@ static ivas_error TDREND_MIX_LoadHRTF( int32_t hrtf_data_size_max; char *hrtf_data; -#endif - error = IVAS_ERR_OK; -#ifdef HRTF_BINARY_FILE if ( ( header_check_result = read_and_check_hrtf_binary_file_header( &hrtfs_file_header, f_hrtf ) ) != IVAS_ERR_OK ) { -#ifdef FIX_FOR_TEST - fseek( f_hrtf, 0, SEEK_SET ); - if ( fread( &tmp, 1, sizeof( int16_t ), f_hrtf ) == 0 ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); - } - - HrFiltSet_p->FilterMethod = (TDREND_HRFILT_Method_t) tmp; - - if ( HrFiltSet_p->FilterMethod != TDREND_HRFILT_Method_BSplineModel ) - { - error = IVAS_ERROR( IVAS_ERR_INVALID_HRTF, "The HR filter set file is not a supported type." ); - } - else - { - error = LoadBSplineBinary( HrFiltSet_p, f_hrtf ); - } - if ( error != IVAS_ERR_OK ) - { - return header_check_result; - } - else - { - return error; - } -#else return header_check_result; -#endif } is_tdrend = FALSE; @@ -524,7 +504,6 @@ static ivas_error TDREND_MIX_LoadHRTF( free( hrtf_data ); if ( is_tdrend ) -#endif { if ( fread( &tmp, 1, sizeof( int16_t ), f_hrtf ) == 0 ) { @@ -542,12 +521,10 @@ static ivas_error TDREND_MIX_LoadHRTF( error = LoadBSplineBinary( HrFiltSet_p, f_hrtf ); } } -#ifdef HRTF_BINARY_FILE else { return IVAS_ERROR( IVAS_ERR_INVALID_HRTF, "HR filter not found in binary file." ); } -#endif return error; } @@ -566,9 +543,7 @@ ivas_error load_HRTF_binary( { ivas_error error; -#ifdef HRTF_BINARY_FILE fseek( hrtfReader->file, 0, SEEK_SET ); -#endif error = TDREND_MIX_LoadHRTF( hrtfReader->file, hHrtf ); @@ -648,12 +623,10 @@ ivas_error dealloc_HRTF_binary( ivas_error error; error = IVAS_ERR_OK; -#ifdef HRTF_BINARY_FILE if ( hHrtf == NULL ) { return error; } -#endif if ( !hHrtf->ModelParams.modelROM ) { @@ -700,7 +673,6 @@ ivas_error dealloc_HRTF_binary( return error; } -#ifdef HRTF_BINARY_FILE /*------------------------------------------------------------------------- * ivas_hrtf_init() @@ -746,6 +718,7 @@ static ivas_error ivas_hrtf_init( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * create_HRTF_from_rawdata() * @@ -757,7 +730,7 @@ static ivas_error create_HRTF_from_rawdata( char *hrtf_data /* i: pointer to binary file */ ) { - int i, j, k; + int16_t i, j, k; int16_t max_num_iterations_diffuse; uint16_t max_total_num_fsamp_per_iteration, max_total_num_fsamp_per_iteration_diff; uint32_t mem_size; @@ -780,26 +753,26 @@ static ivas_error create_HRTF_from_rawdata( hrtf_data_rptr = hrtf_data; - // latency_s + /* latency_s */ ( *hHRTF )->latency_s = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); - // max_num_ir + /* max_num_ir */ ( *hHRTF )->max_num_ir = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); - // BINAURAL_CHANNELS + /* BINAURAL_CHANNELS */ if ( BINAURAL_CHANNELS != *( (int16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file format not compliant (BINAURAL_CHANNELS)" ); } hrtf_data_rptr += sizeof( uint16_t ); - // max_num_iterations + /* max_num_iterations */ ( *hHRTF )->max_num_iterations = *( (int16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( int16_t ); - // num_iterations + /* num_iterations */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) @@ -809,7 +782,7 @@ static ivas_error create_HRTF_from_rawdata( } } - // pIndex_frequency_max + /* pIndex_frequency_max */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) @@ -825,20 +798,20 @@ static ivas_error create_HRTF_from_rawdata( } } - // max_num_iterations_diffuse + /* max_num_iterations_diffuse */ max_num_iterations_diffuse = *( (int16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( int16_t ); if ( max_num_iterations_diffuse != 0 ) { - // num_iterations_diffuse + /* num_iterations_diffuse */ for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { ( *hHRTF )->num_iterations_diffuse[j] = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); } - // pIndex_frequency_max_diffuse (the size depends on num_iterations_diffuse) + /* pIndex_frequency_max_diffuse (the size depends on num_iterations_diffuse) */ for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { mem_size = ( *hHRTF )->num_iterations_diffuse[j] * sizeof( uint16_t ); @@ -852,22 +825,22 @@ static ivas_error create_HRTF_from_rawdata( } } - // index_frequency_max_diffuse + /* index_frequency_max_diffuse */ ( *hHRTF )->index_frequency_max_diffuse = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); - // inv_diffuse_weight + /* inv_diffuse_weight */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { ( *hHRTF )->inv_diffuse_weight[i] = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); } - // max_total_num_fsamp_per_iteration + /* max_total_num_fsamp_per_iteration */ max_total_num_fsamp_per_iteration = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); - // coeff_re (the size depends on pIndex_frequency_max) + /* coeff_re (the size depends on pIndex_frequency_max) */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) @@ -891,7 +864,7 @@ static ivas_error create_HRTF_from_rawdata( } } - // coeff_im (the size depends on pIndex_frequency_max) + /* coeff_im (the size depends on pIndex_frequency_max) */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { for ( j = 0; j < BINAURAL_CHANNELS; j++ ) @@ -915,13 +888,13 @@ static ivas_error create_HRTF_from_rawdata( } } - // max_total_num_fsamp_per_iteration_diff + /* max_total_num_fsamp_per_iteration_diff */ max_total_num_fsamp_per_iteration_diff = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); if ( max_total_num_fsamp_per_iteration_diff != 0 ) { - // coeff_diffuse_re : The size depends on pIndex_frequency_max_diffuse + /* coeff_diffuse_re : The size depends on pIndex_frequency_max_diffuse */ for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float ); @@ -942,7 +915,7 @@ static ivas_error create_HRTF_from_rawdata( } } - // coeff_diffuse_im : The size depends on pIndex_frequency_max_diffuse + /* coeff_diffuse_im : The size depends on pIndex_frequency_max_diffuse */ for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float ); @@ -967,7 +940,6 @@ static ivas_error create_HRTF_from_rawdata( return IVAS_ERR_OK; } -#ifdef HRTF_BINARY_FILE static ivas_error init_fastconv_HRTF_handle( HRTFS_FASTCONV *hHrtf /* i/o: HRTF FastConv handle */ ) @@ -1021,6 +993,7 @@ static ivas_error init_fastconv_HRTF_handle( return IVAS_ERR_OK; } + static ivas_error create_fastconv_HRTF_from_rawdata( HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */ char *hrtf_data, /* i : pointer to binary file */ @@ -1028,7 +1001,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( BINAURAL_INPUT_AUDIO_CONFIG input_cfg /* i : Input binaural config */ ) { - int i, j; + int16_t i, j; char *hrtf_data_rptr; // if ( hHRTF == NULL ) @@ -1047,14 +1020,14 @@ static ivas_error create_fastconv_HRTF_from_rawdata( hrtf_data_rptr = hrtf_data; - // BINAURAL_CONVBANDS + /* BINAURAL_CONVBANDS */ if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" ); } hrtf_data_rptr += sizeof( uint16_t ); - // HRIR + /* HRIR */ if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { ( *hHRTF )->FASTCONV_HRIR_latency_s = *( (float *) ( hrtf_data_rptr ) ); @@ -1107,7 +1080,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA ) { - // HRIR_HOA3 + /* HRIR_HOA3 */ ( *hHRTF )->FASTCONV_HOA3_latency_s = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); @@ -1156,7 +1129,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } - // BRIR + /* BRIR */ if ( rend_type == RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { ( *hHRTF )->FASTCONV_BRIR_latency_s = *( (float *) ( hrtf_data_rptr ) ); @@ -1207,7 +1180,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } - // Reverb Parameters + /* Reverb Parameters */ if ( CLDFB_NO_CHANNELS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (CLDFB_NO_CHANNELS_MAX)" ); @@ -1220,9 +1193,17 @@ static ivas_error create_fastconv_HRTF_from_rawdata( memcpy( ( *hHRTF )->fastconvReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); } + return IVAS_ERR_OK; } + +/*---------------------------------------------------------------------* + * load_fastconv_HRTF_from_binary() + * + * Load FastConv HRTF binary data into the handle + *---------------------------------------------------------------------*/ + ivas_error load_fastconv_HRTF_from_binary( IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv, /* i/o: FastConv HRTF handle */ const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ @@ -1279,7 +1260,7 @@ ivas_error load_fastconv_HRTF_from_binary( return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); } - // Create the HRTF reading the raw data from the binary file + /* Create the HRTF reading the raw data from the binary file */ if ( ( create_fastconv_HRTF_from_rawdata( &hHrtfFastConv, hrtf_data, hrtf_header.rend_type, hrtf_header.input_cfg ) ) != IVAS_ERR_OK ) { free( hrtf_data ); @@ -1295,36 +1276,40 @@ ivas_error load_fastconv_HRTF_from_binary( return IVAS_ERR_OK; } -#endif -#ifdef HRTF_BINARY_FILE +/*---------------------------------------------------------------------* + * create_parambin_HRTF_from_rawdata() + * + * + *---------------------------------------------------------------------*/ + static ivas_error create_parambin_HRTF_from_rawdata( HRTFS_PARAMBIN_HANDLE *hHRTF, /* i/o: Parametric binauralizer HRTF handle */ char *hrtf_data /* i : pointer to binary file */ ) { - int i, j; + int16_t i, j; char *hrtf_data_rptr; uint32_t data_size_tmp; hrtf_data_rptr = hrtf_data; - // HRTF_SH_CHANNELS + /* HRTF_SH_CHANNELS */ if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" ); } hrtf_data_rptr += sizeof( uint16_t ); - // HRTF_NUM_BINS + /* HRTF_NUM_BINS */ if ( HRTF_NUM_BINS != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_NUM_BINS)" ); } hrtf_data_rptr += sizeof( uint16_t ); - // HRTF + /* HRTF */ data_size_tmp = HRTF_NUM_BINS * sizeof( float ); for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { @@ -1343,7 +1328,7 @@ static ivas_error create_parambin_HRTF_from_rawdata( } } - // Reverb Parameters + /* Reverb Parameters */ if ( CLDFB_NO_CHANNELS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (CLDFB_NO_CHANNELS_MAX)" ); @@ -1362,6 +1347,13 @@ static ivas_error create_parambin_HRTF_from_rawdata( return IVAS_ERR_OK; } + +/*---------------------------------------------------------------------* + * load_parambin_HRTF_from_binary() + * + * Load parametric binauralizer HRTF binary data into the handle + *---------------------------------------------------------------------*/ + ivas_error load_parambin_HRTF_from_binary( IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParamBin, /* i/o: Parametric binauralizer HRTF handle */ const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ @@ -1416,7 +1408,7 @@ ivas_error load_parambin_HRTF_from_binary( return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); } - // Create the HRTF reading the raw data from the binary file + /* Create the HRTF reading the raw data from the binary file */ if ( ( create_parambin_HRTF_from_rawdata( &hHrtfParamBin, hrtf_data ) ) != IVAS_ERR_OK ) { free( hrtf_data ); @@ -1432,7 +1424,6 @@ ivas_error load_parambin_HRTF_from_binary( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* @@ -1442,9 +1433,9 @@ ivas_error load_parambin_HRTF_from_binary( *---------------------------------------------------------------------*/ ivas_error create_SetOfHRTF_from_binary( - IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF, /* i/o: HRTF CRend handle */ - const hrtfFileReader *hrtfReader, /* i: pointer to hrtfFileReader handle */ - int32_t output_Fs ) /* i: Output sampling frequency */ + IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF, /* i/o: HRTF CRend handle */ + const hrtfFileReader *hrtfReader, /* i : pointer to hrtfFileReader handle */ + int32_t output_Fs ) /* i : Output sampling frequency */ { FILE *f_hrtf; int32_t hrtf_data_size_max; @@ -1518,7 +1509,7 @@ ivas_error create_SetOfHRTF_from_binary( if ( hHRTF != NULL ) { - // Create the HRTF reading the raw data from the binary file + /* Create the HRTF reading the raw data from the binary file */ if ( ( create_HRTF_from_rawdata( hHRTF, hrtf_data ) ) != IVAS_ERR_OK ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create HRTF from binary file" ); @@ -1537,4 +1528,78 @@ ivas_error create_SetOfHRTF_from_binary( return IVAS_ERR_OK; } -#endif + +/*---------------------------------------------------------------------* + * destroy_HRTF() + * + * Destroy the HRTF CRend handle + *---------------------------------------------------------------------*/ + +static ivas_error destroy_HRTF( + HRTFS_HANDLE *hHRTF /* i/o: HRTF CRend handle */ +) +{ + uint16_t i, j; + + if ( *hHRTF != NULL && hHRTF != NULL ) + { + for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + { + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + if ( ( *hHRTF )->pIndex_frequency_max[i][j] != NULL ) + { + free( ( *hHRTF )->pIndex_frequency_max[i][j] ); + } + if ( ( *hHRTF )->pOut_to_bin_re[i][j] != NULL ) + { + free( ( *hHRTF )->pOut_to_bin_re[i][j] ); + } + if ( ( *hHRTF )->pOut_to_bin_im[i][j] != NULL ) + { + free( ( *hHRTF )->pOut_to_bin_im[i][j] ); + } + } + } + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] != NULL ) + { + free( ( *hHRTF )->pIndex_frequency_max_diffuse[j] ); + } + if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] != NULL ) + { + free( ( *hHRTF )->pOut_to_bin_diffuse_re[j] ); + } + if ( ( *hHRTF )->pOut_to_bin_diffuse_im[j] != NULL ) + { + free( ( *hHRTF )->pOut_to_bin_diffuse_im[j] ); + } + } + + free( *hHRTF ); + *hHRTF = NULL; + } + + return IVAS_ERR_OK; +} + +/*---------------------------------------------------------------------* + * destroy_SetOfHRTF() + * + * Destroy the HRTF data set. + *---------------------------------------------------------------------*/ + +ivas_error destroy_SetOfHRTF( + HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ +) +{ + if ( hSetOfHRTF != NULL ) + { + destroy_HRTF( &( hSetOfHRTF->hHRTF_hrir_combined ) ); + destroy_HRTF( &( hSetOfHRTF->hHRTF_hrir_hoa3 ) ); + destroy_HRTF( &( hSetOfHRTF->hHRTF_brir_combined ) ); + } + + return IVAS_ERR_OK; +} diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h index b4465511507b5c7afd32809479da35ec7a73b2a3..2b59c3150b25c054aaaece41fc1829a8fc781f84 100644 --- a/lib_util/hrtf_file_reader.h +++ b/lib_util/hrtf_file_reader.h @@ -33,14 +33,20 @@ #ifndef IVAS_HRTF_FILE_READER_H #define IVAS_HRTF_FILE_READER_H -#include #include "common_api_types.h" -#include "ivas_error.h" -#include "options.h" typedef struct hrtfFileReader hrtfFileReader; +typedef struct ivas_hrtfs_header_t +{ + int32_t rend_type; + int32_t input_cfg; + int32_t frequency; + uint32_t data_size; + +} ivas_hrtfs_header_t; + /*---------------------------------------------------------------------* * hrtfFileReader_open() * @@ -73,7 +79,6 @@ ivas_error load_HRTF_binary( const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ ); -#ifdef HRTF_BINARY_FILE /*---------------------------------------------------------------------* * create_SetOfHRTF_from_binary() * @@ -86,6 +91,7 @@ ivas_error create_SetOfHRTF_from_binary( int32_t output_Fs /* i: Output sampling frequency */ ); + /*---------------------------------------------------------------------* * destroy_SetOfHRTF() * @@ -96,9 +102,7 @@ ivas_error destroy_SetOfHRTF( IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ ); -#endif -#ifdef HRTF_BINARY_FILE /*---------------------------------------------------------------------* * load_fastconv_HRTF_from_binary() * @@ -122,7 +126,6 @@ ivas_error load_parambin_HRTF_from_binary( const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ ); -#endif /*---------------------------------------------------------------------* * dealloc_HRTF_binary() diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index 33fae320b58427730f054205efd420aca3de6e39..add6a85a7a5534fcd03af8b90fea19ae3cbd6a89 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -32,13 +32,17 @@ #include "ism_file_reader.h" #include "cmdl_tools.h" -#include #include #include - -#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ -#define NUM_ISM_METADATA_PER_LINE 5 /* Number of ISM metadata per line in a metadata file */ +#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ +#ifdef ISM_NON_DIEGETIC_PAN +#define NUM_ISM_METADATA_PER_LINE 8 /* Number of ISM metadata per line in a metadata file */ +#define NUM_MIN_ISM_METADATA 1 /* Minimum number of metadata parameters (azimuth) */ +#else +#define NUM_ISM_METADATA_PER_LINE 7 /* Number of ISM metadata per line in a metadata file */ +#define NUM_MIN_ISM_METADATA 2 /* Minimum number of metadata parameters (azimuth and elevation) */ +#endif struct IsmFileReader @@ -55,7 +59,7 @@ struct IsmFileReader *---------------------------------------------------------------------*/ IsmFileReader *IsmFileReader_open( - const char *filePath /* i : path to ism metadata file */ + const char *filePath /* i : path to ISM metadata file */ ) { IsmFileReader *self; @@ -91,15 +95,26 @@ IsmFileReader *IsmFileReader_open( /*! r: error code */ ivas_error IsmFileReader_readNextFrame( IsmFileReader *self, /* i/o: IsmFileReader handle */ - IVAS_ISM_METADATA *ismMetadata /* o ISM : metadata read from the opened file */ + IVAS_ISM_METADATA *ismMetadata /* o : ISM metadata read from the opened file */ ) { char char_buff[META_LINE_LENGTH]; float meta_prm[NUM_ISM_METADATA_PER_LINE]; +#ifdef ISM_NON_DIEGETIC_PAN + const float meta_prm_default[NUM_ISM_METADATA_PER_LINE] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f }; +#else + const float meta_prm_default[NUM_ISM_METADATA_PER_LINE] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }; +#endif char *char_ptr; int16_t i; FILE *file; + /* Set default metadata parameters */ + for ( i = 0; i < NUM_ISM_METADATA_PER_LINE; i++ ) + { + meta_prm[i] = meta_prm_default[i]; + } + if ( ismMetadata == NULL || self->file == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; @@ -128,16 +143,10 @@ ivas_error IsmFileReader_readNextFrame( meta_prm[i++] = (float) atof( char_ptr ); } - - if ( i != NUM_ISM_METADATA_PER_LINE ) - { - /* Not enough values provided in one line */ - return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; - } - - if ( char_ptr != NULL ) + /* Verify the number of metadata values. */ + if ( i < NUM_MIN_ISM_METADATA || char_ptr != NULL ) { - /* Too many values provided in one line */ + /* Invalid number of metadata parameters (2-7 supported) */ return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; } @@ -146,8 +155,20 @@ ivas_error IsmFileReader_readNextFrame( ismMetadata->radius = meta_prm[2]; ismMetadata->spread = meta_prm[3]; ismMetadata->gainFactor = meta_prm[4]; + ismMetadata->yaw = meta_prm[5]; + ismMetadata->pitch = meta_prm[6]; +#ifdef ISM_NON_DIEGETIC_PAN + ismMetadata->non_diegetic_flag = (int16_t) meta_prm[7]; +#endif /* verify whether the read metadata values are in an expected range */ +#ifdef ISM_NON_DIEGETIC_PAN + if ( ( ismMetadata->non_diegetic_flag ) != 0 && ( ismMetadata->non_diegetic_flag != 1 ) ) + { + return IVAS_ERR_ISM_INVALID_METADATA_VALUE; + } +#endif + if ( ismMetadata->azimuth > 180 || ismMetadata->azimuth < -180 ) { return IVAS_ERR_ISM_INVALID_METADATA_VALUE; @@ -158,7 +179,7 @@ ivas_error IsmFileReader_readNextFrame( return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } - if ( ismMetadata->radius < 0 ) // Ivas_fmToDo: to be reviewed + if ( ismMetadata->radius < 0 ) /* Negative radius not supported. Max quantized radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */ { return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } @@ -172,6 +193,15 @@ ivas_error IsmFileReader_readNextFrame( { return IVAS_ERR_ISM_INVALID_METADATA_VALUE; } + if ( ismMetadata->yaw > 180 || ismMetadata->yaw < -180 ) + { + return IVAS_ERR_ISM_INVALID_METADATA_VALUE; + } + + if ( ismMetadata->pitch > 90 || ismMetadata->pitch < -90 ) + { + return IVAS_ERR_ISM_INVALID_METADATA_VALUE; + } return IVAS_ERR_OK; } diff --git a/lib_util/ism_file_reader.h b/lib_util/ism_file_reader.h index 4e87b2f6bc3d529d19bfa4d80338880ca5c9b734..8ddb67704e4db1c30bddb2e3dd207a226b6de90e 100644 --- a/lib_util/ism_file_reader.h +++ b/lib_util/ism_file_reader.h @@ -33,9 +33,7 @@ #ifndef IVAS_ISM_FILE_READER_H #define IVAS_ISM_FILE_READER_H -#include #include "common_api_types.h" -#include "ivas_error.h" /* clang-format off */ diff --git a/lib_util/ism_file_writer.c b/lib_util/ism_file_writer.c index 46705316c8c0f5f5e4662b4c96d2bccc64dff919..18571aa1504e536ad6a3722196d51287ead87720 100644 --- a/lib_util/ism_file_writer.c +++ b/lib_util/ism_file_writer.c @@ -31,13 +31,11 @@ *******************************************************************************************************/ #include "ism_file_writer.h" -#include #include #include -#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ -#define NUM_ISM_METADATA_PER_LINE 5 /* Number of ISM metadata per line in a metadata file */ +#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */ struct IsmFileWriter @@ -55,7 +53,7 @@ struct IsmFileWriter /*! r: error code */ ivas_error IsmFileWriter_open( const char *filePathWav, /* i : path to output file */ - const int16_t obj_num, /* i : ISm number */ + const int16_t obj_num, /* i : number of ISM channels */ IsmFileWriter **ismWriter /* o : IsmFileWriter handle */ ) { @@ -65,7 +63,7 @@ ivas_error IsmFileWriter_open( strncpy( metadata_filename_loc, filePathWav, sizeof( metadata_filename_loc ) - 1 ); snprintf( ext_meta, sizeof( ext_meta ), ".%d.csv", obj_num ); - const int32_t maxNumCharactersToAppend = (int32_t) sizeof( metadata_filename_loc ) - strlen( metadata_filename_loc ) - 1; + const int32_t maxNumCharactersToAppend = (int32_t) ( sizeof( metadata_filename_loc ) - strlen( metadata_filename_loc ) - 1 ); strncat( metadata_filename_loc, ext_meta, maxNumCharactersToAppend ); strcpy( filePath, metadata_filename_loc ); @@ -116,8 +114,11 @@ ivas_error IsmFileWriter_writeFrame( file = ismWriter->file; /* IVAS_fmToDo: work in progress; currently position_azimuth, position_elevation, position_radius, spread, gain_factor */ - snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor ); - +#ifdef ISM_NON_DIEGETIC_PAN + snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f,%+07.2f,%+06.2f,%d\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor, ismMetadata.yaw, ismMetadata.pitch, ismMetadata.non_diegetic_flag ); +#else + snprintf( char_buff, sizeof( char_buff ), "%+07.2f,%+06.2f,%05.2f,%06.2f,%04.2f,%+07.2f,%+06.2f\n", ismMetadata.azimuth, ismMetadata.elevation, ismMetadata.radius, ismMetadata.spread, ismMetadata.gainFactor, ismMetadata.yaw, ismMetadata.pitch ); +#endif if ( file ) { fputs( char_buff, file ); diff --git a/lib_util/ism_file_writer.h b/lib_util/ism_file_writer.h index 4e1211cd8256798a0c21f7d58f32a0fa212933f9..d9f731e87e56b8f0b333d725d813047320d82a39 100644 --- a/lib_util/ism_file_writer.h +++ b/lib_util/ism_file_writer.h @@ -33,9 +33,7 @@ #ifndef IVAS_ISM_FILE_WRITER_H #define IVAS_ISM_FILE_WRITER_H -#include #include "common_api_types.h" -#include "ivas_error.h" typedef struct IsmFileWriter IsmFileWriter; @@ -45,7 +43,7 @@ typedef struct IsmFileWriter IsmFileWriter; /*! r: error code */ ivas_error IsmFileWriter_open( const char *filePathWav, /* i : path to output file */ - const int16_t obj_num, /* i : ISm number */ + const int16_t obj_num, /* i : number of ISM channels */ IsmFileWriter **ismWriter /* o : IsmFileReader handle */ ); diff --git a/lib_util/jbm_file_reader.c b/lib_util/jbm_file_reader.c index fe08d5cea61aaf12153dd244fc40a9d62136111c..1be5c223658691c85b01d403c1ea79f330e82658 100644 --- a/lib_util/jbm_file_reader.c +++ b/lib_util/jbm_file_reader.c @@ -32,7 +32,6 @@ #include "jbm_file_reader.h" #include "cmdl_tools.h" -#include #include #include diff --git a/lib_util/jbm_file_reader.h b/lib_util/jbm_file_reader.h index 1a453627468c04baf9417af44b4a13c40b5a0eac..64d2d17e45efdf246ab05ec56de690c5fd252b70 100644 --- a/lib_util/jbm_file_reader.h +++ b/lib_util/jbm_file_reader.h @@ -33,9 +33,7 @@ #ifndef IVAS_JBM_FILE_READER_H #define IVAS_JBM_FILE_READER_H -#include #include "common_api_types.h" -#include "ivas_error.h" /* clang-format off */ diff --git a/lib_util/jbm_file_writer.c b/lib_util/jbm_file_writer.c index 0fce217e4efc2b0ec7a11a51da5573a1de0edfb1..584a22bc7f97df3c3084e1a4045356f6547e80bf 100644 --- a/lib_util/jbm_file_writer.c +++ b/lib_util/jbm_file_writer.c @@ -31,7 +31,6 @@ *******************************************************************************************************/ #include "jbm_file_writer.h" -#include #include #include diff --git a/lib_util/jbm_file_writer.h b/lib_util/jbm_file_writer.h index 1dd308499e81ba5aecbda397416609fa198899dd..c82c38e0f9bcbfd9b039a5c31a4b863900e21139 100644 --- a/lib_util/jbm_file_writer.h +++ b/lib_util/jbm_file_writer.h @@ -33,9 +33,7 @@ #ifndef IVAS_JBM_FILE_WRITER_H #define IVAS_JBM_FILE_WRITER_H -#include #include "common_api_types.h" -#include "ivas_error.h" /* clang-format off */ diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 526fc74c129db9518c2f7ab8044f5058e80dccc0..9b39fab486bd99ab3259fc5dd6770351792e1e6e 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -32,7 +32,6 @@ #include "ls_custom_file_reader.h" #include -#include #include #include "ivas_prot.h" #include "prot.h" @@ -53,7 +52,7 @@ struct LsCustomFileReader ivas_error CustomLsReader_open( const char *LsFilePath, /* i : LS custom layout file name */ - LsCustomFileReader **hLsCustomReader /* o : HeadRotFileReader handle */ + LsCustomFileReader **hLsCustomReader /* o : LsCustomFileReader handle */ ) { LsCustomFileReader *self; @@ -90,7 +89,7 @@ ivas_error CustomLsReader_open( *-----------------------------------------------------------------------*/ void CustomLsReader_close( - LsCustomFileReader **hLsCustomReader /* i/o: HeadRotFileReader handle */ + LsCustomFileReader **hLsCustomReader /* i/o: LsCustomFileReader handle */ ) { if ( hLsCustomReader == NULL || *hLsCustomReader == NULL ) @@ -229,7 +228,7 @@ static void CustomLoudspeakerLayout_print_info( *-------------------------------------------------------------------------*/ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( - LsCustomFileReader *hLsCustomReader, /* i/o: HeadRotFileReader handle */ + LsCustomFileReader *hLsCustomReader, /* i/o: LsCustomFileReader handle */ IVAS_CUSTOM_LS_DATA *hLsCustomData /* o : Custom loudspeaker setup data */ ) { @@ -269,7 +268,7 @@ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( tok++; } - if ( *tok == '\0' ) + if ( *tok == '\0' ) // replace by isEmptyString() { continue; } diff --git a/lib_util/ls_custom_file_reader.h b/lib_util/ls_custom_file_reader.h index 390659cb7b7f5580141d409d07a1a060add4fb10..df7fe6bde7a929cb7dff5ae4a4e17d34ab0b58eb 100644 --- a/lib_util/ls_custom_file_reader.h +++ b/lib_util/ls_custom_file_reader.h @@ -33,9 +33,7 @@ #ifndef IVAS_LS_CUSTOM_FILE_READER_H #define IVAS_LS_CUSTOM_FILE_READER_H -#include #include "common_api_types.h" -#include "ivas_error.h" typedef struct LsCustomFileReader LsCustomFileReader; @@ -66,7 +64,7 @@ typedef enum _LS_CUSTOM_FILEREADER_ERROR ivas_error CustomLsReader_open( const char *LsFilePath, /* i : LS custom layout file name */ - LsCustomFileReader **hLsCustomReader /* o : HeadRotFileReader handle */ + LsCustomFileReader **hLsCustomReader /* o : LsCustomFileReader handle */ ); /*-----------------------------------------------------------------------* @@ -76,7 +74,7 @@ ivas_error CustomLsReader_open( *-----------------------------------------------------------------------*/ void CustomLsReader_close( - LsCustomFileReader **hLsCustomReader /* i/o: HeadRotFileReader handle */ + LsCustomFileReader **hLsCustomReader /* i/o: LsCustomFileReader handle */ ); /*-------------------------------------------------------------------------* @@ -86,7 +84,7 @@ void CustomLsReader_close( *-------------------------------------------------------------------------*/ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( - LsCustomFileReader *hLsCustomReader, /* i/o: HeadRotFileReader handle */ + LsCustomFileReader *hLsCustomReader, /* i/o: LsCustomFileReader handle */ IVAS_CUSTOM_LS_DATA *hLsCustomData /* o : Custom loudspeaker setup data */ ); diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index da90f7808814433b9f69a278038a03791529a3f4..95da7818e703a19eb0c03ff85aba45d69c8d4b06 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -32,7 +32,7 @@ #include "masa_file_reader.h" #include "ivas_prot.h" -#include +#include "ivas_stat_com.h" #include #include @@ -100,13 +100,16 @@ IVAS_MASA_METADATA_HANDLE MasaFileReader_getMetadataHandle( * * deindex the MASA metadata from the input metadata file *------------------------------------------------------------------------*/ - -static void deindex_sph_idx( - const uint16_t sphIndex, /* i : Spherical index */ - const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ - float *theta, /* o : Elevation */ - float *phi /* o : Azimuth */ -) +#ifndef HR_METADATA +static +#endif + void + deindex_sph_idx( + const uint16_t sphIndex, /* i : Spherical index */ + const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ + float *theta, /* o : Elevation */ + float *phi /* o : Azimuth */ + ) { float ba_crt, del_crt, div_crt, a4_crt; float estim; @@ -342,6 +345,9 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { deindex_sph_idx( readIndex[b], &self->sph_grid16, &( hMeta->directional_meta[i].elevation[j][b] ), &( hMeta->directional_meta[i].azimuth[j][b] ) ); +#ifdef HR_METADATA + hMeta->directional_meta[i].spherical_index[j][b] = readIndex[b]; +#endif } /* Direct-to-total ratio */ diff --git a/lib_util/masa_file_reader.h b/lib_util/masa_file_reader.h index 8e9cd2fd728cbf3cf1b58b8a9cb5aee2f0a971f2..5f3f2fec2a9ce19d539ddad48bc29ba53e3c7b0d 100644 --- a/lib_util/masa_file_reader.h +++ b/lib_util/masa_file_reader.h @@ -33,9 +33,7 @@ #ifndef IVAS_MASA_FILE_READER_H #define IVAS_MASA_FILE_READER_H -#include #include "common_api_types.h" -#include "ivas_error.h" struct MasaFileReader; diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 3b4df4f1c95ed74335a7994575bd4522d6e551a2..e7f3aca0b69b6089973f63ca433d33df36aa73c6 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -32,25 +32,34 @@ #include "masa_file_writer.h" #include "ivas_stat_com.h" +#include "ivas_stat_dec.h" #include "ivas_cnst.h" #include -#include #include #include +typedef struct masaMetaDelayStorage +{ + MASA_DECRIPTIVE_META descriptiveMeta; + uint16_t directionIndex[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + uint8_t directToTotalRatio[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + uint8_t spreadCoherence[MASA_MAXIMUM_DIRECTIONS][DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + uint8_t surroundCoherence[DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + uint8_t diffuseToTotalRatio[DELAY_MASA_PARAM_DEC_SFR][MASA_FREQUENCY_BANDS]; + +} MASA_META_DELAY_STORAGE; struct MasaFileWriter { FILE *file; char *file_path; + MASA_META_DELAY_STORAGE *delayStorage; }; /*-----------------------------------------------------------------------* * Local constants *-----------------------------------------------------------------------*/ -#define SPH_IDX_FRONT ( MASA_NO_POINTS_EQUATOR / 2 ) /* Spherical index corresponding to front direction for setting as default value */ - /*-----------------------------------------------------------------------* * Local functions @@ -75,16 +84,73 @@ static void getExtMasaMetadataFileName( return; } +static void delayMasaMetadata( + MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o : New input metadata which is inplace replaced with delayed metadata frame */ + MASA_META_DELAY_STORAGE *delayStorage /* i/o : Storage for 10 ms of metadata and related descriptive metadata */ +) +{ + int16_t dir, sf, band; + uint8_t currentNumberOfDirections; + + /* Move meta to delay and output. Always use two directions as the metadata is prepared to contain zero energy second direction + * if there is 1dir meta. */ + for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES - DELAY_MASA_PARAM_DEC_SFR; sf++ ) + { + for ( band = 0; band < MASA_FREQUENCY_BANDS; band++ ) + { + uint16_t temp_u16; + uint8_t temp_u8; + for ( dir = 0; dir < MASA_MAXIMUM_DIRECTIONS; dir++ ) + { + temp_u16 = delayStorage->directionIndex[dir][sf][band]; + delayStorage->directionIndex[dir][sf][band] = extOutMeta->directionIndex[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->directionIndex[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->directionIndex[dir][sf][band]; + extOutMeta->directionIndex[dir][sf][band] = temp_u16; + + temp_u8 = delayStorage->directToTotalRatio[dir][sf][band]; + delayStorage->directToTotalRatio[dir][sf][band] = extOutMeta->directToTotalRatio[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->directToTotalRatio[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->directToTotalRatio[dir][sf][band]; + extOutMeta->directToTotalRatio[dir][sf][band] = temp_u8; + + temp_u8 = delayStorage->spreadCoherence[dir][sf][band]; + delayStorage->spreadCoherence[dir][sf][band] = extOutMeta->spreadCoherence[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->spreadCoherence[dir][sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->spreadCoherence[dir][sf][band]; + extOutMeta->spreadCoherence[dir][sf][band] = temp_u8; + } + + temp_u8 = delayStorage->surroundCoherence[sf][band]; + delayStorage->surroundCoherence[sf][band] = extOutMeta->surroundCoherence[sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->surroundCoherence[sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->surroundCoherence[sf][band]; + extOutMeta->surroundCoherence[sf][band] = temp_u8; + + temp_u8 = delayStorage->diffuseToTotalRatio[sf][band]; + delayStorage->diffuseToTotalRatio[sf][band] = extOutMeta->diffuseToTotalRatio[sf + DELAY_MASA_PARAM_DEC_SFR][band]; + extOutMeta->diffuseToTotalRatio[sf + DELAY_MASA_PARAM_DEC_SFR][band] = extOutMeta->diffuseToTotalRatio[sf][band]; + extOutMeta->diffuseToTotalRatio[sf][band] = temp_u8; + } + } + + /* Finalize descriptive meta by using new frame except for number of directions which is the larger of the two */ + currentNumberOfDirections = extOutMeta->descriptiveMeta.numberOfDirections; + if ( delayStorage->descriptiveMeta.numberOfDirections > extOutMeta->descriptiveMeta.numberOfDirections ) + { + extOutMeta->descriptiveMeta.numberOfDirections = delayStorage->descriptiveMeta.numberOfDirections; + } + delayStorage->descriptiveMeta.numberOfDirections = currentNumberOfDirections; + + return; +} /*---------------------------------------------------------------------* - * MasaFileWriter_writeFrame() + * MasaFileWriter_open() * * *---------------------------------------------------------------------*/ ivas_error MasaFileWriter_open( - const char *outputWavFilename, /* i : name of the output audio file */ - MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ + const char *outputWavFilename, /* i : name of the output audio file */ + const bool delayCompensationEnabled, /* i : is delay compensation enabled */ + MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ ) { MasaFileWriter *self; @@ -110,6 +176,11 @@ ivas_error MasaFileWriter_open( self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); strcpy( self->file_path, filePath ); + if ( !delayCompensationEnabled ) + { + self->delayStorage = calloc( sizeof( MASA_META_DELAY_STORAGE ), 1 ); + } + *masaWriter = self; return IVAS_ERR_OK; @@ -123,8 +194,8 @@ ivas_error MasaFileWriter_open( *---------------------------------------------------------------------*/ ivas_error MasaFileWriter_writeFrame( - MasaFileWriter *self, /* i/o: MasaFileWriter handle */ - IVAS_MASA_QMETADATA_HANDLE hMasaQMetadata /* i/o: MASA qMetadata handle to be written */ + MasaFileWriter *self, /* i/o: MasaFileWriter handle */ + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta /* i/o: MASA ext out meta handle to be written */ ) { if ( self == NULL ) @@ -132,59 +203,43 @@ ivas_error MasaFileWriter_writeFrame( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - const uint8_t ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */ uint16_t descMetaTemp = 0; - int16_t i, sf, b_old, b_new, dir; - uint16_t writeTempIndex[MASA_FREQUENCY_BANDS]; + int16_t i, sf, dir, numDirections; uint8_t writeTempOther[MASA_FREQUENCY_BANDS]; - MASA_DECRIPTIVE_META descMeta; - int16_t *bandMap; - uint8_t numCodingBands; - uint8_t numDirections; - int16_t nchan_transport; - - numDirections = (uint8_t) hMasaQMetadata->no_directions; - numCodingBands = hMasaQMetadata->numCodingBands; - bandMap = hMasaQMetadata->bandMap; - nchan_transport = hMasaQMetadata->nchan_transport; - - /* Construct descriptive meta */ - for ( i = 0; i < 8; i++ ) + + /* If delay storage has been reserved, then we are in the normal mode for the decoder + * (i.e., no delay compensation for PCM) which means that metadata should be delayed + * by two subframes (10 ms). Descriptive metadata is a combined result. */ + if ( self->delayStorage ) { - descMeta.formatDescriptor[i] = ivasmasaFormatDescriptor[i]; - descMeta.numberOfDirections = numDirections - 1; - descMeta.numberOfChannels = (uint8_t) ( nchan_transport - 1 ); - /* Following correspond to "unknown" values until transmission is implemented */ - descMeta.sourceFormat = 0x0u; - descMeta.transportDefinition = 0x0u; - descMeta.channelAngle = 0x0u; - descMeta.channelDistance = 0x0u; - descMeta.channelLayout = 0x0u; + delayMasaMetadata( hMasaExtOutMeta, self->delayStorage ); } - if ( fwrite( &( descMeta.formatDescriptor ), sizeof( uint8_t ), 8, self->file ) != 8 ) + numDirections = hMasaExtOutMeta->descriptiveMeta.numberOfDirections + 1; + + if ( fwrite( &( hMasaExtOutMeta->descriptiveMeta.formatDescriptor ), sizeof( uint8_t ), 8, self->file ) != 8 ) { return IVAS_ERR_FAILED_FILE_WRITE; } - descMetaTemp += descMeta.numberOfDirections << 15u; - descMetaTemp += descMeta.numberOfChannels << 14u; - descMetaTemp += descMeta.sourceFormat << 12u; - if ( descMeta.sourceFormat == 0x0 || descMeta.sourceFormat == 0x1 ) + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.numberOfDirections << 15u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.numberOfChannels << 14u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.sourceFormat << 12u; + if ( hMasaExtOutMeta->descriptiveMeta.sourceFormat == 0x0 || hMasaExtOutMeta->descriptiveMeta.sourceFormat == 0x1 ) { - descMetaTemp += descMeta.transportDefinition << 9u; - descMetaTemp += descMeta.channelAngle << 6u; - descMetaTemp += descMeta.channelDistance; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.transportDefinition << 9u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.channelAngle << 6u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.channelDistance; } - else if ( descMeta.sourceFormat == 0x2 ) + else if ( hMasaExtOutMeta->descriptiveMeta.sourceFormat == 0x2 ) { - descMetaTemp += descMeta.channelLayout << 9u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.channelLayout << 9u; /* 9 LSB remain at zero */ } - else if ( descMeta.sourceFormat == 0x3 ) + else if ( hMasaExtOutMeta->descriptiveMeta.sourceFormat == 0x3 ) { - descMetaTemp += descMeta.transportDefinition << 9u; - descMetaTemp += descMeta.channelAngle << 6u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.transportDefinition << 9u; + descMetaTemp += hMasaExtOutMeta->descriptiveMeta.channelAngle << 6u; /* 6 LSB remain at zero */ } @@ -198,61 +253,19 @@ ivas_error MasaFileWriter_writeFrame( for ( dir = 0; dir < numDirections; dir++ ) { /* Spherical index */ - for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) - { - writeTempIndex[i] = SPH_IDX_FRONT; - } - - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempIndex[b_new] = hMasaQMetadata->q_direction[dir].band_data[b_old].spherical_index[sf]; - } - } - - if ( fwrite( writeTempIndex, sizeof( uint16_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) + if ( fwrite( hMasaExtOutMeta->directionIndex[dir][sf], sizeof( uint16_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) { return IVAS_ERR_FAILED_FILE_WRITE; } /* Direct-to-total ratio */ - for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) - { - writeTempOther[i] = 0; - } - - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempOther[b_new] = (uint8_t) floorf( hMasaQMetadata->q_direction[dir].band_data[b_old].energy_ratio[sf] * UINT8_MAX ); - } - } - - if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) + if ( fwrite( hMasaExtOutMeta->directToTotalRatio[dir][sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) { return IVAS_ERR_FAILED_FILE_WRITE; } /* Spread coherence */ - for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) - { - writeTempOther[i] = 0; - } - - if ( hMasaQMetadata->q_direction[dir].coherence_band_data != NULL ) - { - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempOther[b_new] = hMasaQMetadata->q_direction[dir].coherence_band_data[b_old].spread_coherence[sf]; - } - } - } - - if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) + if ( fwrite( hMasaExtOutMeta->spreadCoherence[dir][sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) { return IVAS_ERR_FAILED_FILE_WRITE; } @@ -260,55 +273,22 @@ ivas_error MasaFileWriter_writeFrame( /* Common spatial meta */ /* Diffuse-to-total ratio = 1 - sum(direct-to-total ratios) */ - for ( b_new = 0; b_new < MASA_FREQUENCY_BANDS; b_new++ ) - { - writeTempOther[b_new] = UINT8_MAX; - } - - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempOther[b_new] = UINT8_MAX; - for ( dir = 0; dir < numDirections; dir++ ) - { - writeTempOther[b_new] -= (uint8_t) floorf( hMasaQMetadata->q_direction[dir].band_data[b_old].energy_ratio[sf] * UINT8_MAX ); - } - } - } - - if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) + if ( fwrite( hMasaExtOutMeta->diffuseToTotalRatio[sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) { return IVAS_ERR_FAILED_FILE_WRITE; } /* Surround coherence */ - for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) - { - writeTempOther[i] = 0; - } - - if ( hMasaQMetadata->surcoh_band_data != NULL ) - { - for ( b_old = 0; b_old < numCodingBands; b_old++ ) - { - for ( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) - { - writeTempOther[b_new] = hMasaQMetadata->surcoh_band_data[b_old].surround_coherence[sf]; - } - } - } - - if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) + if ( fwrite( hMasaExtOutMeta->surroundCoherence[sf], sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) { return IVAS_ERR_FAILED_FILE_WRITE; } /* Remainder-to-total ratio */ /* This is zero after codec */ - for ( b_new = 0; b_new < MASA_FREQUENCY_BANDS; b_new++ ) + for ( i = 0; i < MASA_FREQUENCY_BANDS; i++ ) { - writeTempOther[b_new] = 0u; + writeTempOther[i] = 0u; } if ( fwrite( writeTempOther, sizeof( uint8_t ), MASA_FREQUENCY_BANDS, self->file ) != MASA_FREQUENCY_BANDS ) @@ -338,6 +318,7 @@ void MasaFileWriter_close( fclose( ( *selfPtr )->file ); free( ( *selfPtr )->file_path ); + free( ( *selfPtr )->delayStorage ); free( *selfPtr ); *selfPtr = NULL; diff --git a/lib_util/masa_file_writer.h b/lib_util/masa_file_writer.h index 29b4dd1b3f9aa4b72b108ab91118abd3a00996fc..62aa8c6b48c0c990138621689f05fc665cabe914 100644 --- a/lib_util/masa_file_writer.h +++ b/lib_util/masa_file_writer.h @@ -34,21 +34,23 @@ #define IVAS_MASA_FILE_WRITER_H #include +#include "options.h" +#include #include "common_api_types.h" -#include "ivas_error.h" struct MasaFileWriter; typedef struct MasaFileWriter MasaFileWriter; ivas_error MasaFileWriter_open( - const char *outputWavFilename, /* i : name of the output audio file */ - MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ + const char *outputWavFilename, /* i : name of the output audio file */ + const bool delayCompensationEnabled, /* i : is delay compensation enabled */ + MasaFileWriter **masaWriter /* o : MasaFileWriter handle */ ); ivas_error MasaFileWriter_writeFrame( - MasaFileWriter *self, /* i/o: MasaFileWriter handle */ - IVAS_MASA_QMETADATA_HANDLE hMasaQMetadata /* i/o: MASA qMetadata handle to be written */ + MasaFileWriter *self, /* i/o: MasaFileWriter handle */ + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta /* i/o: MASA ext out meta handle to be written */ ); void MasaFileWriter_close( diff --git a/lib_util/mime_io.c b/lib_util/mime_io.c index 4615a9219decfe99acc45456dca757cb37bcad09..b5c257bb49558d5c59d02977a566974ff30b5fb2 100644 --- a/lib_util/mime_io.c +++ b/lib_util/mime_io.c @@ -30,7 +30,6 @@ *******************************************************************************************************/ -#include "options.h" #include "mime_io.h" #include "mime.h" #include "prot.h" diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 1a0b4f39b3a7ca229ff753fbce9a1d8fe4c26fe8..54f2d012ce7f06c567ba87d1e216e98680306845 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -33,12 +33,11 @@ #include "render_config_reader.h" #include #include -#include #include #include #include "cmdl_tools.h" #include "prot.h" -#include "ivas_cnst.h" + /*------------------------------------------------------------------------------------------* * PreProc Macros @@ -523,6 +522,13 @@ ivas_error RenderConfigReader_read( errorHandler( pValue, ERROR_VALUE_INVALID ); } } + else if ( strcmp( item, "DIRECTIVITY" ) == 0 ) + { + if ( read_vector( pValue, 3, hRenderConfig->directivity ) ) + { + errorHandler( item, ERROR_VALUE_INVALID ); + } + } #ifdef DEBUGGING else { diff --git a/lib_util/render_config_reader.h b/lib_util/render_config_reader.h index 01509148cf87419aee09e3653a6503cb6fabd813..c2afb92e8bb11cd1b8706fbb573961dd69a1b36c 100644 --- a/lib_util/render_config_reader.h +++ b/lib_util/render_config_reader.h @@ -34,7 +34,6 @@ #define RENDER_CONFIG_READER_H #include "common_api_types.h" -#include "ivas_error.h" typedef struct RenderConfigReader RenderConfigReader; diff --git a/lib_util/tinywaveout_c.h b/lib_util/tinywaveout_c.h index d0531eb6653c47288f7db1b6f1c84d454f55227d..b82c0cd131a20a9fea782b08e523ebdb56ac6e3d 100644 --- a/lib_util/tinywaveout_c.h +++ b/lib_util/tinywaveout_c.h @@ -490,6 +490,49 @@ static int32_t WriteWavShort( return __TWO_SUCCESS; } +#ifdef DEBUG_JBM +/* this function expects values in the 16 bit range +-32767/8 */ +static int32_t WriteWavFloat( + WAVEFILEOUT *self, + float sampleBuffer[], + uint32_t nSamples ) +{ + uint32_t i; + int32_t err = __TWO_SUCCESS; + + if ( !self ) + { + return __TWO_ERROR; + } + if ( !sampleBuffer ) + { + return __TWO_ERROR; + } + if ( __dataSizeChk( self, nSamples * sizeof( float ) ) ) + { + return __TWO_ERROR; + } + + for ( i = 0; i < nSamples; i++ ) + { + if ( self->bps == 32 ) + { + err = __WriteSample32( self, sampleBuffer[i] / 32768.0f ); + } + else + { + err = __TWO_ERROR; + } + if ( err != __TWO_SUCCESS ) + { + return err; + } + } + + return __TWO_SUCCESS; +} +#endif + static int32_t CloseWav( WAVEFILEOUT *self ) { diff --git a/lib_util/tsm_scale_file_reader.c b/lib_util/tsm_scale_file_reader.c new file mode 100644 index 0000000000000000000000000000000000000000..fbd1824d9dfd4d7219ad72c18549bc19a9d016a9 --- /dev/null +++ b/lib_util/tsm_scale_file_reader.c @@ -0,0 +1,148 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include "tsm_scale_file_reader.h" +#include "cmdl_tools.h" +#include +#include +#include + +struct TsmScaleFileReader +{ + FILE *file; + char *file_path; + bool fileRewind; +}; + + +/*---------------------------------------------------------------------* + * TsmScaleFileReader_open() + * + * Allocates memory for an TsmScaleFileReader and opens the file at given path for reading. + *---------------------------------------------------------------------*/ + +/*! r: JbmFileReader handle */ +TsmScaleFileReader *TsmScaleFileReader_open( + const char *filePath /* i : path to CA config file */ +) +{ + TsmScaleFileReader *self; + FILE *file; + + if ( !filePath ) + { + return NULL; + } + + file = fopen( filePath, "rb" ); + + if ( !file ) + { + return NULL; + } + + self = calloc( sizeof( TsmScaleFileReader ), 1 ); + self->file = file; + self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + strcpy( self->file_path, filePath ); + + return self; +} + + +/*---------------------------------------------------------------------* + * TsmScaleFileReader_readScale() + * + * Read TSM scale entry + *---------------------------------------------------------------------*/ + +ivas_error TsmScaleFileReader_readScale( + TsmScaleFileReader *self, /* i/o: TsmScaleFileReader handle */ + int16_t *scale /* o : scale */ +) +{ + int tmp; + if ( 1 != fscanf( self->file, "%d", &tmp ) ) + { + if ( feof( self->file ) ) + { + rewind( self->file ); + self->fileRewind = true; + return TsmScaleFileReader_readScale( self, scale ); + } + return IVAS_ERR_FAILED_FILE_PARSE; + } + *scale = (int16_t) tmp; + return IVAS_ERR_OK; +} + + +/*---------------------------------------------------------------------* + * JbmFileReader_close() + * + * De-allocates all underlying memory of an JbmFileReader. + *---------------------------------------------------------------------*/ + +void TsmScaleFileReader_close( + TsmScaleFileReader **selfPtr /* i/o: pointer to JbmFileReader handle */ +) +{ + if ( selfPtr == NULL || *selfPtr == NULL ) + { + return; + } + + fclose( ( *selfPtr )->file ); + free( ( *selfPtr )->file_path ); + free( *selfPtr ); + *selfPtr = NULL; + + return; +} + + +/*---------------------------------------------------------------------* + * JbmFileReader_getFilePath() + * + *---------------------------------------------------------------------*/ + +const char *TsmScaleFileReader_getFilePath( + TsmScaleFileReader *self /* i/o: JbmFileReader handle */ +) +{ + if ( self == NULL ) + { + return NULL; + } + + return self->file_path; +} diff --git a/scripts/pyaudio3dtools/quaternions/__init__.py b/lib_util/tsm_scale_file_reader.h similarity index 62% rename from scripts/pyaudio3dtools/quaternions/__init__.py rename to lib_util/tsm_scale_file_reader.h index 8f1f04c36906bb9a43d1c3226aca6eced4f63498..7a795a25cb27316f36acef8bb07dfe67c6dcbf4c 100644 --- a/scripts/pyaudio3dtools/quaternions/__init__.py +++ b/lib_util/tsm_scale_file_reader.h @@ -1,6 +1,5 @@ -#!/usr/bin/env python3 +/****************************************************************************************************** -""" (C) 2022-2023 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, @@ -28,17 +27,41 @@ 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. -""" -""" -Quaternions -==== +*******************************************************************************************************/ -Provides - Handling of quaternions in the same conventions as in IVAS and the Matlab scripts +#ifndef IVAS_TSM_SCALE_FILE_READER_H +#define IVAS_TSM_SCALE_FILE_READER_H -Imports -------- -functions -""" -from . import functions +#include +#include "common_api_types.h" +#include "ivas_error.h" + +/* clang-format off */ + +typedef struct TsmScaleFileReader TsmScaleFileReader; + + +/*! r: TsmScaleFileReader handle */ +TsmScaleFileReader *TsmScaleFileReader_open( + const char *filePath /* i : path to TSM scale file */ +); + +ivas_error TsmScaleFileReader_readScale( + TsmScaleFileReader* self, /* i/o: TsmScaleFileReader handle */ + int16_t *scale /* o : next scale */ +); + +void TsmScaleFileReader_close( + TsmScaleFileReader **selfPtr /* i/o: pointer to TsmScaleFileReader handle */ +); + +/*! r: path to the currently opened file or NULL if `self` is NULL */ +const char *TsmScaleFileReader_getFilePath( + TsmScaleFileReader* self /* i/o: TsmScaleFileReader handle */ +); + + +/* clang-format on */ + +#endif /* IVAS_TSM_SCALE_FILE_READER_H */ diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c new file mode 100644 index 0000000000000000000000000000000000000000..9e03358b91c901e9c6f2875bb8f714cce00a86db --- /dev/null +++ b/lib_util/vector3_pair_file_reader.c @@ -0,0 +1,163 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#include "vector3_pair_file_reader.h" +#include +#include +#include +#include +#include "prot.h" +#include "options.h" /* only included to get access to the feature-defines */ + + +struct Vector3PairFileReader +{ + FILE *trajFile; + char *file_path; +}; + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_open() + * + * Allocate and initialize reader + *-----------------------------------------------------------------------*/ + +ivas_error Vector3PairFileReader_open( + const char *trajFilePath, /* i : trajectory file name */ + Vector3PairFileReader **vector3PairReader /* o : Vector3PairFileReader handle */ +) +{ + Vector3PairFileReader *self; + FILE *trajFile; + + /* Open trajectory file */ + if ( strlen( trajFilePath ) < 1 ) + { + return IVAS_ERR_FAILED_FILE_OPEN; + } + + trajFile = fopen( trajFilePath, "r" ); + + if ( !trajFile ) + { + return IVAS_ERR_FAILED_FILE_OPEN; + } + + self = calloc( sizeof( Vector3PairFileReader ), 1 ); + self->trajFile = trajFile; + self->file_path = calloc( sizeof( char ), strlen( trajFilePath ) + 1 ); + strcpy( self->file_path, trajFilePath ); + + *vector3PairReader = self; + + return IVAS_ERR_OK; +} + + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_read() + * + * Read one line of values from the trajectory file + *-----------------------------------------------------------------------*/ + +ivas_error Vector3PairFileReader_read( + Vector3PairFileReader *vector3PairReader, /* i/o: Vector3PairFileReader handle */ + IVAS_VECTOR3 *pFirst, /* o : first x,y,z position in the line */ + IVAS_VECTOR3 *pSecond /* o : second x,y,z position in the line */ +) +{ + float x1, y1, z1, x2, y2, z2; + + if ( vector3PairReader == NULL || pFirst == NULL || pSecond == NULL ) + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + + if ( 6 != fscanf( vector3PairReader->trajFile, "%f,%f,%f,%f,%f,%f", &x1, &y1, &z1, &x2, &y2, &z2 ) ) + { + if ( feof( vector3PairReader->trajFile ) ) + { + rewind( vector3PairReader->trajFile ); + return Vector3PairFileReader_read( vector3PairReader, pFirst, pSecond ); + } + return IVAS_ERR_FAILED_FILE_PARSE; + } + + pFirst->x = x1; + pFirst->y = y1; + pFirst->z = z1; + pSecond->x = x2; + pSecond->y = y2; + pSecond->z = z2; + + return IVAS_ERR_OK; +} + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_close() + * + * Deallocates memory for the Head-Tracking reader + *-----------------------------------------------------------------------*/ + +void Vector3PairFileReader_close( + Vector3PairFileReader **reader /* i/o: Vector3PairFileReader handle */ +) +{ + if ( reader == NULL || *reader == NULL ) + { + return; + } + + fclose( ( *reader )->trajFile ); + free( ( *reader )->file_path ); + free( *reader ); + *reader = NULL; + + return; +} + + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_getFilePath() + * + * + *-----------------------------------------------------------------------*/ + +const char *Vector3PairFileReader_getFilePath( + Vector3PairFileReader *reader /* i/o: Vector3PairFileReader handle */ +) +{ + if ( reader == NULL ) + { + return NULL; + } + + return reader->file_path; +} diff --git a/lib_util/vector3_pair_file_reader.h b/lib_util/vector3_pair_file_reader.h new file mode 100644 index 0000000000000000000000000000000000000000..4ab687848c25265bc08fc33a7f2d5e474516e25b --- /dev/null +++ b/lib_util/vector3_pair_file_reader.h @@ -0,0 +1,87 @@ +/****************************************************************************************************** + + (C) 2022-2023 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. + +*******************************************************************************************************/ + +#ifndef IVAS_V3PAIR_FILE_READER_H +#define IVAS_V3PAIR_FILE_READER_H + +#include "common_api_types.h" +#include "ivas_error.h" +#include "options.h" /* only included to get access to the feature-defines */ + + +typedef struct Vector3PairFileReader Vector3PairFileReader; + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_open() + * + * Allocate and initialize Head-Tracking handle + *-----------------------------------------------------------------------*/ + +ivas_error Vector3PairFileReader_open( + const char *trajFilePath, /* i : trajectory file name */ + Vector3PairFileReader **vector3PairReader /* o : Vector3PairFileReader handle */ +); + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_read() + * + * Read one line of values from the trajectory file + *-----------------------------------------------------------------------*/ + +ivas_error Vector3PairFileReader_read( + Vector3PairFileReader *vector3PairReader, /* i/o: Vector3PairFileReader handle */ + IVAS_VECTOR3 *pFirst, /* o : first x,y,z position in the line */ + IVAS_VECTOR3 *pSecond /* o : second x,y,z position in the line */ +); + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_close() + * + * Deallocates memory for the handle + *-----------------------------------------------------------------------*/ + +void Vector3PairFileReader_close( + Vector3PairFileReader **vector3PairReader /* i/o: Vector3PairFileReader handle */ +); + +/*-----------------------------------------------------------------------* + * Vector3PairFileReader_getFilePath() + * + * + *-----------------------------------------------------------------------*/ + +const char *Vector3PairFileReader_getFilePath( + Vector3PairFileReader *vector3PairReader /* i/o: Vector3PairFileReader handle */ +); + + +#endif /* IVAS_V3PAIR_FILE_READER_H */ diff --git a/readme.txt b/readme.txt index 95b9a814eca1d4bb44a4623a087a33f236d9289e..21a5a19e7940665f7cf537520a0cf248466d22e7 100644 --- a/readme.txt +++ b/readme.txt @@ -123,32 +123,33 @@ should have the following structure: |-- Workspace_msvc |-- apps |-- lib_com -....|-- lib_debug + |-- lib_debug |-- lib_dec |-- lib_enc + |-- lib_rend |-- lib_util |-- scripts -....|-- work_in_progress - |-- readme_OSS.txt - `-- readme.txt + |-- tests + |-- readme.txt The package includes a Makefile for gcc, which has been verified on 32-bit Linux systems. The code can be compiled by entering the directory -"c-code" and typing the command: make. The resulting encoder/decoder -executables are named "IVAS_cod" and "IVAS_dec". Both reside in the c-code -directory. +"c-code" and typing the command: make. The resulting encoder/decoder/renderer +executables are named "IVAS_cod", "IVAS_dec", and "IVAS_rend". All reside +in the c-code directory. The package also includes a solution-file for Microsoft Visual Studio 2017 (x86). To compile the code, please open "Workspace_msvc\Workspace_msvc.sln" and build "encoder" for the encoder and "decoder" for the decoder executable. The resulting -encoder/decoder executables are named "IVAS_cod.exe" and "IVAS_dec.exe". Both reside -in the c-code directory. +encoder/decoder/renderer executables are named "IVAS_cod.exe", "IVAS_dec.exe", +and "IVAS_rend.exe". All reside in the c-code directory. RUNNING THE SOFTWARE ==================== The usage of the "IVAS_cod" program is as follows: +-------------------------------------------------- Usage: IVAS_cod.exe [Options] R Fs input_file bitstream_file @@ -160,8 +161,13 @@ R : Bitrate in bps, *VBR mode (average bitrate), for AMR-WB IO modes R = (6600, 8850, 12650, 14250, 15850, 18250, 19850, 23050, 23850) - for IVAS stereo & ISm R =(13200, 16400, 24400, 32000, 48000, 64000, 80000, + for IVAS stereo R = (13200, 16400, 24400, 32000, 48000, 64000, 80000, 96000, 128000, 160000, 192000, 256000) + for IVAS ISM R = 13200 for 1 ISM, 16400 for 1 ISM and 2 ISM, + (24400, 32000, 48000, 64000, 80000, 96000,128000) + for 2 ISM, 3 ISM and 4 ISM also 160000, 192000, 256000 + for 3 ISM and 4 ISM also 384000 + for 4 ISM also 512000 for IVAS SBA, MASA, MC R=(13200, 16400, 24400, 32000, 48000, 64000, 80000, 96000, 128000, 160000, 192000, 256000, 384000, 512000) Alternatively, R can be a bitrate switching file which consists of R values @@ -174,10 +180,10 @@ bitstream_file : Output bitstream filename Options: -------- EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc --stereo [Mode] : Stereo format, default is unified stereo - optional for Mode: 1: DFT Stereo, 2: TD Stereo, 3: MDCT Stereo --ism Channels Files : ISm format - where Channels specifies the number of ISms (1-4) +-stereo : Stereo format +-ism [+]Ch Files : ISM format + where Ch specifies the number of ISMs (1-4) + where positive (+) indicates extended metadata (only 64 kbps and up) and Files specify input files containing metadata, one file per object (use NULL for no input metadata) -sba +/-Order : Scene Based Audio input format (Ambisonics ACN/SN3D), @@ -185,7 +191,7 @@ EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, where positive (+) means full 3D and negative (-) only 2D/planar components to be coded -masa Ch File : MASA format where Ch specifies the number of input/transport channels (1 or 2): - and File specifies input file containing parametric metadata + and File specifies input file containing parametric MASA metadata -mc InputConf : Multi-channel format where InputConf specifies the channel configuration: 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4 Loudspeaker positions are assumed to have azimuth and elevation as per @@ -195,8 +201,7 @@ EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, where 0 = adaptive, 3-100 = fixed in number of frames, default is deactivated -dtx : Activate DTX mode with a SID update rate of 8 frames - Note: DTX is currently supported in EVS, stereo, 1 ISm, - SBA (up to 128kbps) and MASA (up to 128kbps) + Note: DTX is supported in EVS, stereo, ISM, SBA up to 80kbps and MASA up to 128kbps -rf p o : Activate channel-aware mode for WB and SWB signal at 13.2kbps, where FEC indicator, p: LO or HI, and FEC offset, o: 2, 3, 5, or 7 in number of frames. Alternatively p and o can be replaced by a rf configuration file with each line @@ -209,13 +214,13 @@ EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -mime : Mime output bitstream file format The encoder produces TS26.445 Annex.2.6 Mime Storage Format, (not RFC4867 Mime Format). default output bitstream file format is G.192 --agc op : SBA Adaptive gain control, op = (0, 1), by default op is 0 or deactivated -bypass mode : SBA PCA by-pass, mode = (1, 2), 1 = PCA off, 2 = signal adaptive, default is 1 -q : Quiet mode, no frame counters default is deactivated The usage of the "IVAS_dec" program is as follows: +-------------------------------------------------- Usage for EVS: IVAS_dec.exe [Options] Fs bitstream_file output_file Usage for IVAS: IVAS_dec.exe [Options] OutputConf Fs bitstream_file output_file @@ -251,24 +256,27 @@ Options: Format files, the magic word in the mime file is used to determine which of the two supported formats is in use. default bitstream file format is G.192 --T File : Head rotation specified by external trajectory File -hrtf File : HRTF filter File used in ISm format and BINAURAL output configuration --force_subframe_bin : Forces parametric binauralizer code to use 5 ms time resolution even when - output time resolution is larger. --FEC X : Insert frame erasures, X = 0-10 is the percentage - of erased frames, or X may be the name of binary file or - file with G192 headers indicating GOOD FRAME or BAD FRAME - containing FEC pattern (short values of 0 (good) or 1 (bad)) - default is OFF, if this option is not used --force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND), --otr tracking_type : head orientation tracking type: 'ref' or 'avg' (only for binaural rendering) +-T File : Head rotation specified by external trajectory File +-otr tracking_type : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' + or 'ref_vec_lev' (only for binaural rendering) +-rf File : Reference rotation specified by external trajectory file + works only in combination with '-otr ref' mode +-rvf File : Reference vector specified by external trajectory file + works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes -render_config File : Renderer configuration option File --no_diegetic_pan : panning mono no dietic sound to stereo -1<= pan <=1, - left or l or 1->left, right or r or -1->right, center or c or 0->middle +-non_diegetic_pan P : panning mono non-diegetic sound to stereo -90<= P <=90, + left or l or 90->left, right or r or -90->right, center or c or 0->middle -q : Quiet mode, no frame counter default is deactivated +The usage of the "IVAS_rend" program is as follows: +--------------------------------------------------- + +TBD + + MULTICHANNEL LOUDSPEAKER INPUT / OUTPUT CONFIGURATIONS ====================================================== The loudspeaker positions for each MC layouts are assumed to have the following azimuth and elevation @@ -294,6 +302,7 @@ The output channel ordering is 0, 1, ... N-1. The third row contains an index "L specifying the output channel to which the LFE input will be routed if present. If the third row is omitted, the LFE input is downmixed to all channels with a factor of 1/N. Position is not considered for the LFE channel. +An example custom loudspeaker layout file is available: ls_setup_16ch_8+4+4.txt @@ -308,55 +317,56 @@ points or complete coverage. Documentation on the self_test.py can be found as a part of scripts/README.md. -Note: Running the self_test.py requires the input vectors in the folder scripts/testv. The -audio files could unfortunately not be shared, and they need to be replaced in order to -run the self_test.py. To complement the test vector set, please replace the empty *.pcm-files -in the self_test folder with 16 bit PCM files following the specification below. - -stv1ISM48s.pcm - 1 channel (1 audio object), 48000 Hz, 1440000 samples -stv2ISM48s.pcm - 2 channels (discrete audio objects), 48000 Hz, 1440000 samples per channel -stv2OA32c.pcm - 9 channels (2nd order Ambisonics ACN/SN3D), 32000 Hz -stv2OA48c.pcm - 9 channels (2nd order Ambisonics ACN/SN3D), 48000 Hz -stv3ISM48s.pcm - 3 channels (discrete audio objects), 48000 Hz, 1440000 samples per channel -stv3OA32c.pcm - 16 channels (3rd order Ambisonics ACN/SN3D), 32000 Hz, 288939 samples per channel -stv3OA48c.pcm - 16 channels (3rd order Ambisonics ACN/SN3D), 48000 Hz, 433408 samples per channel -stv4ISM48s.pcm - 4 channel (discrete audio objects), 48000 Hz, 1440000 samples per channel -stv8c.pcm - 1 channel, 8000 Hz, clean speech/audio -stv8n.pcm - 1 channel, 8000 Hz, noisy speech -stv16c.pcm - 1 channel, 16000 Hz, 610307 samples, clean speech -stv16n.pcm - 1 channel, 16000 Hz, 257024 samples, noisy speech -stv32c.pcm - 1 channel, 32000 Hz, 1220613 samples, clean speech/audio -stv32n.pcm - 1 channel, 32000 Hz, 514048 samples, noisy speech -stv48c.pcm - 1 channel, 48000 Hz, 1830919 samples, clean speech/audio -stv51MC48c.pcm - 6 channels (5.1 1..6 where 4th channel is LFE), 3231233 samples per channel, 48000 Hz, movie excerpt -stv512MC48c.pcm - 8 channels (5.1+2 1..8 where 4th channel is LFE), 144000 samples per channel, 48000 Hz, movie excerpt -stv714MC48c.pcm - 12 channels (7.1+4 1..12 where 4th channel is LFE), 144000 samples per channel, 48000 Hz, movie excerpt -stvFOA16c.pcm - 4 channels (1st order Ambisonics ACN/SN3D), 16000 Hz, -stvFOA32c.pcm - 4 channels (1st order Ambisonics ACN/SN3D), 32000 Hz, 288939 samples per channel -stvFOA48c.pcm - 4 channels (1st order Ambisonics ACN/SN3D), 48000 Hz, 433408 samples per channel -stvST16c.pcm - 2 channels, 16000 Hz, 329601 samples per channel, clean speech/audio -stvST16n.pcm - 2 channels, 16000 Hz, 310401 samples per channel, noisy speech -stvST32c.pcm - 2 channels, 32000 Hz, 659200 samples per channel, clean speech/audio -stvST32n.pcm - 2 channels, 32000 Hz, 620800 samples per channel, noisy speech -stvST48c.pcm - 2 channels, 48000 Hz, 988800 samples per channel, clean speech/audio -stvST48n.pcm - 2 channels, 48000 Hz, 931200 samples per channel, noisy speech -stv_IVASMASA_1dir1TC.pcm - 1 channel (1 MASA transport channel), 48000 Hz, 48000 Hz, 144000 samples -stv_IVASMASA_1dir1TC_DTX.pcm - 1 channel (1 MASA transport channel), 48000 Hz, 48000 Hz, 963840 samples -stv_IVASMASA_1dir2TC.pcm - 2 channels (2 MASA transport channel), 48000 Hz, 48000 Hz, 288000 samples per channel -stv_IVASMASA_1dir2TC_DTX.pcm - 2 channels (2 MASA transport channel), 48000 Hz, 48000 Hz, 963840 samples per channel -stv_IVASMASA_2dir1TC.pcm - 1 channel (1 MASA transport channel), 48000 Hz, 48000 Hz, 288000 -stv_IVASMASA_2dir2TC.pcm - 2 channels (2 MASA transport channel), 48000 Hz, 48000 Hz, 144000 samples per channel +Note: Running the self_test.py requires the input vectors in the folder scripts/testv. + +stv1ISM48s.wav - 1 channel (1 audio object), 48000 Hz, 1440000 samples +stv2ISM48s.wav - 2 channels (discrete audio objects), 48000 Hz, 1440000 samples per channel +stv2OA32c.wav - 9 channels (2nd order Ambisonics ACN/SN3D), 32000 Hz +stv2OA48c.wav - 9 channels (2nd order Ambisonics ACN/SN3D), 48000 Hz +stv3ISM48s.wav - 3 channels (discrete audio objects), 48000 Hz, 1440000 samples per channel +stv3OA32c.wav - 16 channels (3rd order Ambisonics ACN/SN3D), 32000 Hz, 288939 samples per channel +stv3OA48c.wav - 16 channels (3rd order Ambisonics ACN/SN3D), 48000 Hz, 433408 samples per channel +stv4ISM48s.wav - 4 channel (discrete audio objects), 48000 Hz, 1440000 samples per channel +stv4ISM48n.wav - 4 channel (discrete audio objects), 48000 Hz, noisy speech +stv8c.wav - 1 channel, 8000 Hz, clean speech/audio +stv8n.wav - 1 channel, 8000 Hz, noisy speech +stv16c.wav - 1 channel, 16000 Hz, 610307 samples, clean speech +stv16n.wav - 1 channel, 16000 Hz, 257024 samples, noisy speech +stv32c.wav - 1 channel, 32000 Hz, 1220613 samples, clean speech/audio +stv32n.wav - 1 channel, 32000 Hz, 514048 samples, noisy speech +stv48c.wav - 1 channel, 48000 Hz, 960000 samples, clean speech/audio +stv48n.wav - 1 channel, 48000 Hz, 931200 samples, noisy clean speech +stv51MC48c.wav - 6 channels (5.1 1..6 where 4th channel is LFE), 960000 samples per channel, 48000 Hz +stv512MC48c.wav - 8 channels (5.1+2 1..8 where 4th channel is LFE), 144000 samples per channel, 48000 Hz +stv514MC48c.wav - 10 channels (7.1+2 1..10 where 4th channel is LFE), 144000 samples per channel, 48000 Hz +stv71MC48c.wav - 8 channels (7.1 1..8 where 4th channel is LFE), 144000 samples per channel, 48000 Hz +stv714MC48c.wav - 12 channels (7.1+4 1..12 where 4th channel is LFE), 144000 samples per channel, 48000 Hz +stvFOA16c.wav - 4 channels (1st order Ambisonics ACN/SN3D), 16000 Hz, +stvFOA32c.wav - 4 channels (1st order Ambisonics ACN/SN3D), 32000 Hz, 288939 samples per channel +stvFOA48c.wav - 4 channels (1st order Ambisonics ACN/SN3D), 48000 Hz, 433408 samples per channel +stvST16c.wav - 2 channels, 16000 Hz, 329601 samples per channel, clean speech/audio +stvST16n.wav - 2 channels, 16000 Hz, 310401 samples per channel, noisy speech +stvST32c.wav - 2 channels, 32000 Hz, 659200 samples per channel, clean speech/audio +stvST32n.wav - 2 channels, 32000 Hz, 620800 samples per channel, noisy speech +stvST48c.wav - 2 channels, 48000 Hz, 988800 samples per channel, clean speech/audio +stvST48n.wav - 2 channels, 48000 Hz, 931200 samples per channel, noisy speech +stv1MASA1TC48c.wav - 1 channel (1 MASA transport channel), 48000 Hz, 48000 Hz, 144000 samples +stv1MASA1TC48n.wav - 1 channel (1 MASA transport channel), 48000 Hz, 48000 Hz, 963840 samples +stv1MASA2TC48c.wav - 2 channels (2 MASA transport channel), 48000 Hz, 48000 Hz, 288000 samples per channel +stv1MASA2TC48n.wav - 2 channels (2 MASA transport channel), 48000 Hz, 48000 Hz, 963840 samples per channel +stv2MASA1TC48c.wav - 1 channel (1 MASA transport channel), 48000 Hz, 48000 Hz, 288000 +stv2MASA2TC48c.wav - 2 channels (2 MASA transport channel), 48000 Hz, 48000 Hz, 144000 samples per channel For the MASA operation modes, in addition the following metadata files -are required: +located in /scripts/testv/ folder are required: -stv_IVASMASA_1dir1TC.met -stv_IVASMASA_1dir1TC_DTX.met -stv_IVASMASA_1dir2TC.met -stv_IVASMASA_1dir2TC_DTX.met -stv_IVASMASA_2dir1TC.met -stv_IVASMASA_2dir2TC.met +stv1MASA1TC48c.met +stv1MASA1TC48n.met +stv1MASA2TC48c.met +stv1MASA2TC48n.met +stv2MASA1TC48c.met +stv2MASA2TC48c.met It is strongly recommended to align these files to the corresponding PCM audio files. The MASA metadata files can be generated with the @@ -365,7 +375,7 @@ available at https://www.3gpp.org/ftp/TSG_SA/WG4_CODEC/TSGS4_118-e/Docs/S4-220443.zip For the ISM operation modes, in addition the following metadata files -are required: +located at /scripts/testv/ folder are required: stvISM1.csv stvISM2.csv @@ -374,28 +384,65 @@ stvISM4.csv These are comma separated files (csv) which indicate the per object position in the format: -frame index, azimuth, elevation, distance (unit circle), spread, gain +frame azimuth, elevation, radius, spread, gain, yaw, pitch, non-diegetic with the following meaning: -| Parameter | format, value range | meaning ----------------------------------------------------------------------- -| frame index | int, [0, INT_MAX] | associated IVAS frame ----------------------------------------------------------------------- -| azimuth | float, [-180,180[ | azimuth; positive indicates left ----------------------------------------------------------------------- -| elevation | float, [-90,90] | elevation; positive indicates up ----------------------------------------------------------------------- -| distance | float, tbd | default: 0 ----------------------------------------------------------------------- -| spread | float, [0,360] | spread in angles from 0 ... 360ø ----------------------------------------------------------------------- -| gain | float, [0,1] | gain ----------------------------------------------------------------------- +| Parameter | format, value range | meaning +--------------------------------------------------------------------------------------------------- +| azimuth | float, [-180,180] | azimuth; positive indicates left; default: 0 +--------------------------------------------------------------------------------------------------- +| elevation | float, [-90,90] | elevation; positive indicates up; default: 0 +--------------------------------------------------------------------------------------------------- +| radius | float, [0, 15.75] | radius (extended metadata); default: 1 +--------------------------------------------------------------------------------------------------- +| spread | float, [0,360] | spread in angles from 0...360 deg; default: 0 +--------------------------------------------------------------------------------------------------- +| gain | float, [0,1] | gain; default: 1 +--------------------------------------------------------------------------------------------------- +| yaw | float, [-180,180] | yaw (extended metadata); positive indicates left; default: 0 +--------------------------------------------------------------------------------------------------- +| pitch | float, [-90,90] | pitch (extended metadata); positive indicates up; default: 0 +--------------------------------------------------------------------------------------------------- +| non-diegetic | float*, [0 1] | Flag for activation of non-diegetic rendering; default: 0 +| | if Flag is set to 1, panning gain is specified by azimuth. +| | Value between [-90,90], 90 left, -90 right, 0 center +--------------------------------------------------------------------------------------------------- +*Read as float value for convenience, but used as an integer flag internally. + +The metadata reader accepts 1-8 values specified per line. If a value is not specified, the default +value is assumed. + +For the HRTF filter File option, external HRTF filter Files are available in folder +/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data : + +ivas_binaural_16kHz.bin +ivas_binaural_32kHz.bin +ivas_binaural_48kHz.bin + + +For the Head rotation operation modes, external trajectory files are available: + +headrot.csv +headrot_case00_3000_q.csv +headrot_case01_3000_q.csv +headrot_case02_3000_q.csv +headrot_case03_3000_q.csv + +For Reference vector specified by external trajectory file, example files are available at +/scripts/trajectories folder. + + +For the Renderer configuration option operation modes, external configuration files are available: + +rend_config_hospital_patientroom.cfg +config_recreation.cfg +config_renderer.cfg ADDITIONAL SCRIPTS ================== Additional scripts for item generation and codec testing are available -in the directory scripts. Please refer to scripts/README.md for -additional documentation. +in the directories scripts and tests. Please refer to scripts/README.md, resp. +tests/README.md for additional documentation. + diff --git a/scripts/README.md b/scripts/README.md index fec54ffeac8a7929b329d55ecb72641eb79b0e22..4e8a9b366451700c6acd9a23cb7198235297b290 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -38,7 +38,6 @@ title: Python scripts for Testing the IVAS code and Generating test items - [Python scripts for Testing the IVAS code and Generating test items](#python-scripts-for-testing-the-ivas-code-and-generating-test-items) - [Contents](#contents) - [0. Requirements](#0-requirements) - - [- numpy and scipy for `generate_test_items.py`, `testBitexact.py` and `self_test.py`](#--numpy-and-scipy-for-generate_test_itemspy-testbitexactpy-and-self_testpy) - [1. Scripts and classes for testing IVAS code](#1--scripts-and-classes-for-testing-ivas-code) - [1.1 Classes](#11-classes) - [1.2 Output directory structure](#12-output-directory-structure) @@ -49,16 +48,6 @@ title: Python scripts for Testing the IVAS code and Generating test items - [`IvasBuildAndRunChecks.py`](#ivasbuildandruncheckspy) - [`testBitexact.py`](#testbitexactpy) - [`self_test.py`](#self_testpy) - - [2. Script for generating listening test items](#2-script-for-generating-listening-test-items) - - [2.1. `generate_test_items.py`](#21-generate_test_itemspy) - - [2.2. Test configuration file](#22-test-configuration-file) - - [2.3. Supported test conditions](#23-supported-test-conditions) - - [2.4. Supported input/output/rendered audio formats](#24-supported-inputoutputrendered-audio-formats) - - [2.5. Processing](#25-processing) - - [2.6. Renderer Metadata definition](#26-renderer-metadata-definition) - - [3. Script for converting formats and binauralizing](#3-script-for-converting-formats-and-binauralizing) - - [3.1. Binauralizing with head rotation](#31-binauralizing-with-head-rotation) - - [3.2. Generating binaural reference signals](#32-generating-binaural-reference-signals) --- @@ -441,216 +430,3 @@ Missing reference conditions and the test conditions are then generated and the reference and test conditions are compared. ----- - - -## 2. Script for generating listening test items - -The `generate_test_items.py` python script helps to quickly setup listening tests with multiple (pre-)processing and post-processing options. - -### 2.1. `generate_test_items.py` - -Script for generating (listening) test items. - -``` -usage: generate_test_items.py [-h] -i INFILE [INFILE ...] - -Generate test items - -optional arguments: - -h, --help show this help message and exit - -i INFILE [INFILE ...], --infile INFILE [INFILE ...] - Configuration file(s): FILE1.json FILE2.json ... -``` - -Example how to call it: - -``` - python3 .\generate_test_items.py -i .\examples\my_test_config.json -``` - -Where `my_test_config.json` is a test configuration file in json format with fields explained in next section. - -### 2.2. Test configuration file - -This is the main file to edit in order to change global configuration options, detailed below. - -*NOTE: Paths specified in the JSON file are relative to the working directory where the script is executed from, NOT the location of the JSON file itself. It is possible (and recommended!) to use absolute paths instead to avoid confusion.* - -| key | values (example) | default | description | -|---------------------------|:------------------:|:-------------:|-----------------------------------------------| -| name | "my_test" | Required | name of the test session | -| author | "myself" | | Author of the configuration file (optional) | -| date | 20210205 | | Date of creation (optional) | -| | | | | -| enable_multiprocessing | True/False | True | Enables multiprocessing, recommended to set to True to make things fast. | -| delete_tmp | True/False | False | Enables deletion of temporary directories (containing intermediate processing files, bitstreams and per-item logfiles etc.). | -| | | | | -| input_path | ./my_items/ | Required | Input directory with *.WAV, *.PCM or *.TXT files to process | -| preproc_input | True/False | False | Whether to execute preprocessing on the input files | -| in_format | HOA3 | Required | Input format for the conditions to generate, see spatial_audio_format | -| in_fs | 32000 | 48000 | Input sampling rate for conditions to generate (assumed to be sampling-rate of input PCM files to process) | -| input_select | ["in", "file2"] | Required | Filenames to filter in the input directory, can be a single value, an array or null. Only compares filenames (therefore "in" in this array would match both "in.wav" and "in.pcm") | -| | | | | -| concatenate_input | True/False | False | Whether to (horizontally) concatenate files in the input directory | -| concat_silence_ms | [1000, 1000] | [0, 0] | Specifies the pre- and post-silence duration to pad concatenation with in ms. If a single value is specified it will be used for BOTH pre- and post-padding | -| preproc_loudness | -26 | | Loudness to preprocess input to (dBov / LKFS depending on tool). Only processed if preproc_input is True. | -| | | | | -| output_path | ./out/ | | Output root directory hosting generated items & log | -| out_fs | 48000 | 48000 | Output sampling rate for conditions to generate | -| output_loudness | -26 | | Loudness level for output file (dBov / LKFS depending on tool). | -| | | | | -| renderer_format | 7_1_4 or CICP19 | Required | Format to be rendered (using offline rendering, will be bypassed if = out_format) | -| binaural_rendered | True/False | False | Extra binauralization of the rendered outputs (using offline rendering) | -| include_LFE | True/False | False | Whether to include LFE in binural rendering | -| gain_factor | float value | 1.0 | Gain factor to be applied to LFE channel | -| loudness_tool | "sv56demo" | "bs1770demo" | Tool to use for loudness adjustment. Currently only sv56demo and bs1770demo are supported for appropriate format configurations. Optionally can be a path to the binary. | -| | | | | -| lt_mode | "MUSHRA" | | Automatically generates a NAME.ltg file with generate_lt_file.py in output_path according to the specified mode | -| conditions_to_generate | ["ref", "ivas"] | Required | list of conditions to be generated, for ivas and evs, multiple conditions can be specified with an \_ separator (i.e. "ivas_branch", "ivas_trunk" etc.) | -| | | | | -| ref | | | | -| - out_fc | 32000 | 48000 | cut-off frequency to be applied to the reference condition in post | -| ivas | | | | -| - bitrates | [16400, 128000] | Required | Bitrate(s) used for IVAS encoder | -| - enc_fs | 48000 | 48000 | Sampling rate for input to the encoder (pre-processing) | -| - max_band | wb, swb, fb etc. | FB | Maximum encoded bandwidth | -| - out_format | 7_1_4 or CICP19 | Required | Output format for IVAS, see spatial_audio_format | -| - dec_fs | 48000 | 48000 | Sampling rate for decoder output | -| - dtx | True/False | False | Enable DTX mode | -| - head_tracking | True/False | False | Enable head tracking | -| - ht_file | | "./trajectories/full_circle_in_15s" | Head rotation file | -| - plc | True/False | False | Enables forward error correction `IVAS_dec -FEC X` | -| - plc_rate | 0-10 | 10 | Percentage of erased frames | -| - cod_bin | "../../../IVAS_cod"| "../IVAS_cod" | path to encoder binary | -| - dec_bin | "../../../IVAS_dec"| "../IVAS_dec" | path to decoder binary | -| - cod_opt | ["-ucct", "1"] | | list of additional encoder options | -| - dec_opt | ["-q"] | | list of additional decoder options | -| evs | | | | -| - bitrates | [13200, 164000] | Required | Bitrate used for multi-stream EVS condition per stream/channel | -| - enc_fs | 48000 | 48000 | Sampling rate for input to the encoder (pre-processing) | -| - max_band | wb, swb, fb etc. | FB | Maximum encoded bandwidth | -| - dec_fs | 48000 | 480000 | Sampling rate for decoder output | -| - dtx | True/False | False | Enable DTX mode | -| - cod_bin | ../../../IVAS_cod | "../IVAS_cod" | path to binary | -| - dec_bin | ../../../IVAS_dec | "../IVAS_dec" | path to binary | -| | | | | - ---- -### 2.3. Supported test conditions - -The following conditions are the conditions which can be generated currently by `generate_test_items.py`. - -| Supported conditions | Description | -|:--------------------:|-----------------------------------------------------------| -| ref | Uncoded (reference) | -| lp3k5 | Uncoded low-passed at 3.5 kHz (anchor) | -| lp7k | Uncoded low-passed at 7 kHz (anchor) | -| evs_mono | Coded with multi-stream EVS codec, !!metadata not coded!! | -| ivas | Coded with IVAS codec | - - -Multiple conditions for evs_mono and ivas can be specified by using underscore separators e.g. `"ivas_1" : {...}, "ivas_2" : {...}` -(also see `test_SBA.json` for an example) - ---- - -### 2.4. Supported input/output/rendered audio formats - -| spatial_audio_format | Input/Ouput/Rendered | Description | -|--------------------------------------------------|----------------------|------------------------------------------------| -| MONO | yes/yes/yes | mono signals | -| STEREO | yes/yes/yes | stereo signals | -| ISM or ISMx | yes/no/no | Objects with metadata, description using renderer metadata | -| MASA or MASAx | yes/no/no | mono or stereo signals with spatial metadata !!!metadata must share same basename as waveform file but with .met extension!!! | -| FOA/HOA2/HOA3 or PLANAR(FOA/HOAx) | yes/yes/yes | Ambisonic signals or planar ambisonic signals | -| BINAURAL/BINAURAL_ROOM | no/yes/yes | Binaural signals | -| 5_1/5_1_2/5_1_4/7_1/7_1_4 or CICP[6/12/14/16/19] | yes/yes/yes | Multi-channel signals for predefined loudspeaker layout | -| META | yes/yes/no | Audio scene described by a renderer config | - ---- - -### 2.5. Processing - -The processing chain is as follows: - -1. Preprocessing - - **Condition**: `preproc_input == true` - - Input files converted to `in_format` -2. Processing - - **Condition**: Performed depending on key in `conditions_to_generate` - - Coding/decoding from `in_format` to `out_format` -3. Postprocessing - 1. Rendering to `renderer_format` - - **Condition**: `out_format != renderer_format` - - output files converted from `out_format` to `renderer_format` - 1. Binaural Rendering - - **Condition**: `binaural_rendered == true` and `out_format` is not a BINAURAL type - - output files converted from `out_format` to `BINAURAL` - ---- - -### 2.6. Renderer Metadata definition - -To run, the renderer requires a config file describing the input scene.The expected format of the config file is as follows: - ---- - -- Line 1: Path to a "multitrack" audio file. This should be a single multichannel wav/pcm file that contains all input audio. For example channels 1-4 can be an FOA scene,channel 5 - an object and channels 6-11 - a 5.1 channel bed. If the path is not absolute, it is considered relative to the renderer executable, not the config file. This path has lower priority than the one given on the command line: *The path in the config file is ignored if the --inputAudio argument to the renderer executable is specified.* - ---- - -- Line 2: Contains number of inputs. An input can either be an Ambisonics scene, anobject or a channel bed.This is NOT the total number of channels in the input audio file.The renderer currently supports simultaneously: *Up to 2 SBA inputs, Up to 2 MC inputs* Up to 16 ISM inputsThese limits can be freely changed with pre-processor macros, if needed. - ---- -- Following lines: -Define each of the inputs. Inputs can be listed in any order - they are NOT required to be listed in the same order as in the audio file. -Input definitions: - - First line of an input definition contains the input type: SBA, MC or ISM.Following lines depend on the input type:SBAIndex of the first channel of this input in the multitrack file (1-indexed)Ambisonics orderMCIndex of the first channel of this input in the multitrack file (1-indexed)CICP index of the speaker layoutISMIndex of this input's audio in the multitrack file (1-indexed)Path to ISM metadata file (if not absolute, relative to executable location)ORISMIndex of this input's audio in the multitrack file (1-indexed)Number N of positions defined, followed by N lines in form: -stay in position for x frames, azimuth, elevation(ISM position metadata defined this way is looped if there are more framesof audio than given positions) - ---- -Example config -The following example defines a scene with 4 inputs: *ISM with trajectory defined in a separate file. Channel 12 in the input file.* Ambisonics, order 1. Channels 1-4 in the input audio file. *CICP6 channel bed. Channels 5-10 in the input audio file.* ISM with 2 defined positions (-90,0) and (90,0). Channel 11 in the input file. The object will start at position (-90,0) and stay there for 5 frames, then move to (90,0) and stay there for 5 frames. This trajectory is looped over the duration of the input audio file. - -``` -./input_audio.wav4ISM12path/to/IVAS_ISM_metadata.csv -3 -SBA -1 -1 -MC -5 -6 -ISM -1 -1 -25,-90,05,90, -``` - -## 3. Script for converting formats and binauralizing - -The script audio3dtools.py can convert between different input and output formats and binauralize signals. - -Execute `python -m pyaudio3dtools.audio3dtools --help` for usage. - -### 3.1. Binauralizing with head rotation - -This example binauralizes a HOA3 signal with a head-rotation trajectory. Head rotation is peformed in SHD. It is supported for HOA3 and META input formats. For META input format, the audioscene is first prerendered to HOA3 and then rotated and binauralized. - -``` -python -m pyaudio3dtools.audio3dtools -i hoa3_input.wav -o . -F BINAURAL -T .\trajectories\full_circle_in_15s -``` - -### 3.2. Generating binaural reference signals - -Currently MC input signals are supported. The reference processing can be activated by selecting BINAURAL[_ROOM]_REF as output format. The signals are generated by convolving the channels with the filters from the database that are closes to the current position of the virtual LS. All interpolation methods supported by numpy can be chosen between the measured points along the trajectory. - -``` -python -m pyaudio3dtools.audio3dtools -i cicp6_input.wav -o . -F BINAURAL_REF -T .\trajectories\full_circle_in_15s -``` - -### 3.3. Rendering ISM to Custom loudspeakers with auxiliary binaural output -ISM metadata can either be specified via an input text file in the Renderer Metadata definition format, or via the commandline using the same style as IVAS: -``` -python -m pyaudio3dtools.audio3dtools -i ism2.wav -f ISM2 -m ism1.csv NULL -F 7_1_4 -o . -b -T .\trajectories\full_circle_in_15s -``` diff --git a/scripts/batch_comp_audio.py b/scripts/batch_comp_audio.py index 72ae3fcc7d6a506aea3d94386f0a02e5b77e1af1..97e9f8f54840f22f71fddb44ebd0bddd8fa486ce 100755 --- a/scripts/batch_comp_audio.py +++ b/scripts/batch_comp_audio.py @@ -96,10 +96,9 @@ def main(args): if not args.diffs_only or diff > 0: if diff == 0.0: - label = "\033[00;32m[OKAY]\033[00;00m" + label = "[OKAY]" else: - label = "\033[00;31m[FAIL]\033[00;00m" - + label = "[FAIL]" result = f"{label} Max. diff (PCM) for file {f}: {diff}" if args.verbose and diff != 0.0: @@ -108,10 +107,10 @@ def main(args): print(result, file=out_file) - if num_files_diff > 0: - print(f"{num_files_diff} files differ/don't exist", file=out_file) - else: - print(f"All files are bitexact", file=out_file) + if num_files_diff > 0: + print(f"{num_files_diff} files differ/don't exist", file=out_file) + else: + print(f"All files are bitexact", file=out_file) def compare_files(f, fol1, fol2, outputs_dict): diff --git a/scripts/binauralRenderer_interface/CMakeLists.txt b/scripts/binauralRenderer_interface/CMakeLists.txt deleted file mode 100644 index 99d62c94172a328e0621e872bd097ef63e5929f4..0000000000000000000000000000000000000000 --- a/scripts/binauralRenderer_interface/CMakeLists.txt +++ /dev/null @@ -1,103 +0,0 @@ -cmake_minimum_required(VERSION 3.0) - -project(generate_crend_ivas_tables) - -set(EXTERNALS_PATH ${PROJECT_SOURCE_DIR}/Externals) -set(IVAS_TRUNK_PATH "${PROJECT_SOURCE_DIR}/../..") -set(IVAS_TRUNK_UTIL_PATH ${IVAS_TRUNK_PATH}/lib_util) -set(IVAS_TRUNK_DEC_PATH ${IVAS_TRUNK_PATH}/lib_dec) -set(IVAS_TRUNK_REND_PATH ${IVAS_TRUNK_PATH}/lib_rend) -set(IVAS_TRUNK_ENC_PATH ${IVAS_TRUNK_PATH}/lib_enc) -set(IVAS_TRUNK_COM_PATH ${IVAS_TRUNK_PATH}/lib_com) -set(IVAS_TRUNK_DEBUG_PATH ${IVAS_TRUNK_PATH}/lib_debug) - -if(WIN32) - find_path(ZLIB_DIR "zlib.h" ${EXTERNALS_PATH}/zlib/zlib-1.2.12) - - if(ZLIB_DIR) - else() - set(ZLIB_DIR ${EXTERNALS_PATH}/zlib) - find_package(Python3 REQUIRED) - - if(Python3_Interpreter_FOUND) - execute_process(COMMAND ${Python3_EXECUTABLE} resolve_build_dep.py - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - RESULT_VARIABLE py_result OUTPUT_VARIABLE ZLIB_DIR) - set(ZLIB_DIR ${PROJECT_SOURCE_DIR} ${ZLIB_DIR}) - endif() - - message(STATUS " ZLIB_DIR: ${ZLIB_DIR}") - endif() -endif() - -if(WIN32) - add_subdirectory(${ZLIB_DIR}) - set(ZLIB_INCLUDE_DIRS ${ZLIB_DIR} ${PROJECT_BINARY_DIR}/Externals/zlib/zlib-1.2.12) - set(zlib zlibstatic) - target_include_directories(example PUBLIC ${ZLIB_INCLUDE_DIRS}) - target_include_directories(minigzip PUBLIC ${ZLIB_INCLUDE_DIRS}) -endif() - -if(UNIX) - find_package(ZLIB) - - if(ZLIB_FOUND) - message(${ZLIB_INCLUDE_DIRS}) - message(${ZLIB_LIBRARIES}) - set(zlib ${ZLIB_LIBRARIES}) - else() - message(FATAL_ERROR "Zlib not found") - endif() -endif() - -find_path(SOFA_READER_DIR "libmysofa.pc.cmake" ${EXTERNALS_PATH}/libmysofa) - -if(SOFA_READER_DIR) -else() - set(SOFA_READER_DIR ${EXTERNALS_PATH}/libmysofa) - set(GIT_URL https://github.com/hoene/libmysofa.git) - execute_process(COMMAND git clone ${GIT_URL} ${EXTERNALS_PATH}/libmysofa) -endif() - -include_directories(${SOFA_READER_DIR}/src ${ZLIB_INCLUDE_DIRS} ${IVAS_TRUNK_UTIL_PATH} ${IVAS_TRUNK_ENC_PATH} ${IVAS_TRUNK_DEC_PATH} ${IVAS_TRUNK_REND_PATH} ${IVAS_TRUNK_COM_PATH} ${IVAS_TRUNK_DEBUG_PATH}) - -option(BUILD_TESTS "Build test programs" OFF) -option(BUILD_SHARED_LIBS "Build shared library" OFF) -add_subdirectory(${SOFA_READER_DIR}) -set(SOURCE_FILES_C - ${PROJECT_SOURCE_DIR}/ivas_crend_binaural_filter_design.c - ${IVAS_TRUNK_COM_PATH}/basop32.c - ${IVAS_TRUNK_COM_PATH}/basop_mpy.c - ${IVAS_TRUNK_COM_PATH}/enh40.c - ${IVAS_TRUNK_COM_PATH}/fft.c - ${IVAS_TRUNK_COM_PATH}/fft_rel.c - ${IVAS_TRUNK_COM_PATH}/ifft_rel.c - ${IVAS_TRUNK_COM_PATH}/ivas_mdft_imdft.c - ${IVAS_TRUNK_COM_PATH}/rom_com.c - ${IVAS_TRUNK_COM_PATH}/ivas_rom_com.c - ${IVAS_TRUNK_COM_PATH}/tools.c - ${IVAS_TRUNK_COM_PATH}/tns_base.c -) - -set(SOURCE_FILES_H - ${PROJECT_SOURCE_DIR}/ivas_crend_binaural_filter_design.c - ${SOFA_READER_DIR}/src/hrtf/mysofa.h - ${IVAS_TRUNK_REND_PATH}/ivas_stat_rend.h - ${IVAS_TRUNK_DEC_PATH}/ivas_stat_dec.h - ${IVAS_TRUNK_DEC_PATH}/stat_dec.h - ${IVAS_TRUNK_COM_PATH}/options.h - ${IVAS_TRUNK_COM_PATH}/ivas_cnst.h - ${IVAS_TRUNK_COM_PATH}/cnst.h - ${IVAS_TRUNK_COM_PATH}/prot.h - ${IVAS_TRUNK_COM_PATH}/ivas_prot.h - ${IVAS_TRUNK_COM_PATH}/common_api_types.h -) - -add_library(${PROJECT_NAME}_lib STATIC ${SOURCE_FILES_C} ${SOURCE_FILES_H}) - -add_executable(${PROJECT_NAME} generate_crend_ivas_tables_from_sofa.c) -target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_lib mysofa-static ${zlib}) - -if(WIN32) - add_compile_definitions(_CRT_SECURE_NO_WARNINGS) -endif() diff --git a/scripts/binauralRenderer_interface/Table_Format_Converter/CMakeLists.txt b/scripts/binauralRenderer_interface/Table_Format_Converter/CMakeLists.txt deleted file mode 100644 index 259e3b97b6abc67129aca82147929a3841848e2a..0000000000000000000000000000000000000000 --- a/scripts/binauralRenderer_interface/Table_Format_Converter/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -cmake_minimum_required(VERSION 3.6) - -project(tables_format_converter) - -if(WIN32) - # MSVC compiler flags - add_definitions( - -D_CRT_SECURE_NO_WARNINGS - ) - - # CMake sets /W3 by default, until CMake version 3.15. Instead of setting /W4 separately, replace in existing settings - string(REGEX REPLACE "/W3" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -endif() - -set(IVAS_PATH "${PROJECT_SOURCE_DIR}/../../..") -set(IVAS_UTIL_PATH ${IVAS_PATH}/lib_util) -set(IVAS_DEC_PATH ${IVAS_PATH}/lib_dec) -set(IVAS_ENC_PATH ${IVAS_PATH}/lib_enc) -set(IVAS_COM_PATH ${IVAS_PATH}/lib_com) -set(IVAS_REND_PATH ${IVAS_PATH}/lib_rend) -set(IVAS_DEBUG_PATH ${IVAS_PATH}/lib_debug) - -include_directories(${IVAS_UTIL_PATH} ${IVAS_ENC_PATH} ${IVAS_DEC_PATH} ${IVAS_COM_PATH} ${IVAS_REND_PATH} ${IVAS_DEBUG_PATH}) - -set(SOURCE_FILES_C - ${IVAS_REND_PATH}/ivas_rom_binauralRenderer.c - ${IVAS_REND_PATH}/ivas_rom_binaural_crend_head.c) - -set(SOURCE_FILES_H - ${IVAS_REND_PATH}/ivas_rom_binauralRenderer.h - ${IVAS_REND_PATH}/ivas_rom_binaural_crend_head.h) - -add_library(${PROJECT_NAME}_lib STATIC ${SOURCE_FILES_C} ${SOURCE_FILES_H}) - -add_executable(${PROJECT_NAME} generate_tables_from_rom_to_bin.c) -target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_lib) diff --git a/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c b/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c index 89a33e1d45cfa5cce857908b87b017e43f23f73c..a7d4391c7520be27e06d0127aecac706bc1d8b6d 100644 --- a/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c +++ b/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 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 @@ -38,6 +38,8 @@ #include "ivas_rom_binaural_crend_head.h" #include "lib_rend.h" #include "ivas_stat_dec.h" +#include "hrtf_file_reader.h" + #define FILE_HEADER diff --git a/scripts/binauralRenderer_interface/Table_Format_Converter/table_format_converter_readme.txt b/scripts/binauralRenderer_interface/Table_Format_Converter/table_format_converter_readme.txt index 391ad644e942c007d498b7ac5fa1eb234d9c752b..dda6738a9ae8ea0be8f875ef85b36fa0489b916b 100644 --- a/scripts/binauralRenderer_interface/Table_Format_Converter/table_format_converter_readme.txt +++ b/scripts/binauralRenderer_interface/Table_Format_Converter/table_format_converter_readme.txt @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 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 diff --git a/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin b/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin index e099563d59c8d1ca05b0131e06ba2c61482b6c6d..b9a35aa26bc7f15ba44e953fa83c2d8187b657bb 100644 --- a/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin +++ b/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:44a59257b01a2f8dde378958c4539e80ccd50157e2766dd08c2f9858275d2f2c -size 2074172 +oid sha256:81d8c14bf10697a0353c15986fde3432df1b6909ea2d122ce3599b3655237d71 +size 2074176 diff --git a/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin b/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin index 2137f267a11d8da905480aa3e32e4a3d81cad678..992a1c61fa8ed95135a85384bed269b083e76259 100644 --- a/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin +++ b/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be4a11053ec5f265f33fdc36c6a68762b7e9974b9ff23af85dcca8ffaf62aef0 -size 2578384 +oid sha256:16b993a0af01bf8b8289e554452e6d2c98e7b977bf2a40f0afd3ca7498d39f8b +size 2578388 diff --git a/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin b/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin index 1532a923a1c1e3861d1a79c78fe0e5a2346fb21f..eaf5d445febfbea1a8684f56179927b5aaad710b 100644 --- a/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin +++ b/scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bcaeb7604af344e2ab4d4bafb9fa05cd06fb0989320ea4343e6a9328233e199d -size 2860960 +oid sha256:1a29e9692bd5be5e93358db63159f55851d12f66c0382ff14afb642090427685 +size 2860964 diff --git a/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c b/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c index 73d99d76a7f6e7ebb1d1bb14242d5484117e0c3c..3f847f83cf30ff3f786f47463d308efc833afdbe 100644 --- a/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +++ b/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. @@ -62,6 +62,7 @@ #define FORMAT_FLOAT "%8.6f" #define NUM_SAMPLES_PER_LINES 96 #define DECLARATION_NAME "CRendBin" +#define TAB_WITH_SPACE_OR_NOT " " /* "\t" */ int32_t sample_rates[3] = { DEFAULT_SAMPLERATE, 32000, 16000 }; /* Hz */ /* 8000 Hz not supported by mdft */ @@ -129,12 +130,12 @@ void usage_gen_crend_tables( void ) fprintf( stdout, "Mandatory parameters:\n" ); fprintf( stdout, "---------------------\n" ); + fprintf( stdout, "frame_length_ms : frame size in ms (5 or 20)" ); fprintf( stdout, "sofa_file_path1 sofa_file_path2 ... : paths of the sofa files to process %ld Hz sample rate mandatory\n", (long) DEFAULT_SAMPLERATE ); - fprintf( stdout, "frame_length_ms : path where header and c files will be created (lib_dec forlder for example, default = './')\n" ); fprintf( stdout, "Options:\n" ); fprintf( stdout, "--------\n" ); - fprintf( stdout, "-lib_dec_path path : path where header and c files will be created (lib_dec forlder for example, default = './')\n" ); + fprintf( stdout, "-lib_rend_path path : path where header and c files will be created (lib_dec forlder for example, default = './')\n" ); fprintf( stdout, "-no_optim : if present no BRIR optimisation is perfromed \n" ); fprintf( stdout, "\n" ); } @@ -166,7 +167,7 @@ int main( int argc, char *argv[] ) FILE *fp = NULL; - char *lib_dec_path = NULL; + char *lib_rend_path = NULL; bool no_optim = false; int notEndingWithSeparator = 0; @@ -174,7 +175,7 @@ int main( int argc, char *argv[] ) /* Optional arguments */ while ( argv[i][0] == '-' ) { - if ( strcmp( to_upper( argv[i] ), "-LIB_DEC_PATH" ) == 0 ) + if ( strcmp( to_upper( argv[i] ), "-LIB_REND_PATH" ) == 0 ) { i++; if ( strlen( argv[i] ) == 0 ) @@ -183,8 +184,8 @@ int main( int argc, char *argv[] ) usage_gen_crend_tables(); return -1; } - lib_dec_path = malloc( strlen( argv[i] ) + 1 ); - strcpy( lib_dec_path, argv[i] ); + lib_rend_path = malloc( strlen( argv[i] ) + 1 ); + strcpy( lib_rend_path, argv[i] ); notEndingWithSeparator = ( ( argv[i][strlen( argv[i] ) - 1] == '\\' ) || ( ( argv[i][strlen( argv[i] ) - 1] == '/' ) ) ) ? 0 : 1; i++; } @@ -205,8 +206,8 @@ int main( int argc, char *argv[] ) { fprintf( stderr, "Unknown option: %s need to specify frame length in ms\n\n", argv[i] ); usage_gen_crend_tables(); - if ( lib_dec_path ) - free( lib_dec_path ); + if ( lib_rend_path ) + free( lib_rend_path ); return -1; } frame_len_ms = atoi( argv[i] ); @@ -216,8 +217,8 @@ int main( int argc, char *argv[] ) { fprintf( stderr, "Unknown option: %s need to specify frame length in ms 5 or 20\n\n", argv[i] ); usage_gen_crend_tables(); - if ( lib_dec_path ) - free( lib_dec_path ); + if ( lib_rend_path ) + free( lib_rend_path ); return -1; } @@ -231,30 +232,30 @@ int main( int argc, char *argv[] ) { fprintf( stderr, "Memory issue for rom file temporary name\n\n" ); usage_gen_crend_tables(); - if ( lib_dec_path ) - free( lib_dec_path ); + if ( lib_rend_path ) + free( lib_rend_path ); return -1; } - if ( lib_dec_path ) + if ( lib_rend_path ) { - c_file_path = (char *) malloc( sizeof( char ) * ( strlen( lib_dec_path ) + strlen( ROM_FILE_NAME ) + 2 + 1 + notEndingWithSeparator ) ); + c_file_path = (char *) malloc( sizeof( char ) * ( strlen( lib_rend_path ) + strlen( ROM_FILE_NAME ) + 2 + 1 + notEndingWithSeparator ) ); if ( c_file_path ) { if ( notEndingWithSeparator ) { #ifdef WIN32 - sprintf( c_file_path, "%s\\%s.c", lib_dec_path, ROM_FILE_NAME ); + sprintf( c_file_path, "%s\\%s.c", lib_rend_path, ROM_FILE_NAME ); #else - sprintf( c_file_path, "%s/%s.c", lib_dec_path, ROM_FILE_NAME ); + sprintf( c_file_path, "%s/%s.c", lib_rend_path, ROM_FILE_NAME ); #endif } else { #ifdef WIN32 - sprintf( c_file_path, "%s%s.c", lib_dec_path, ROM_FILE_NAME ); + sprintf( c_file_path, "%s%s.c", lib_rend_path, ROM_FILE_NAME ); #else - sprintf( c_file_path, "%s%s.c", lib_dec_path, ROM_FILE_NAME ); + sprintf( c_file_path, "%s%s.c", lib_rend_path, ROM_FILE_NAME ); #endif } } @@ -262,40 +263,40 @@ int main( int argc, char *argv[] ) { fprintf( stderr, "Memory issue for c file path\n\n" ); usage_gen_crend_tables(); - if ( lib_dec_path ) - free( lib_dec_path ); + if ( lib_rend_path ) + free( lib_rend_path ); return -1; } fp = fopen( c_file_path, "w" ); if ( fp == NULL ) { - fprintf( stderr, "Wrong lib_dec path: %s\n\n", lib_dec_path ); + fprintf( stderr, "Wrong lib_dec path: %s\n\n", lib_rend_path ); usage_gen_crend_tables(); if ( c_file_path ) free( c_file_path ); - if ( lib_dec_path ) - free( lib_dec_path ); + if ( lib_rend_path ) + free( lib_rend_path ); return -1; } fclose( fp ); - h_file_path = (char *) malloc( sizeof( char ) * ( strlen( lib_dec_path ) + strlen( ROM_FILE_NAME ) + 2 + 1 + notEndingWithSeparator ) ); + h_file_path = (char *) malloc( sizeof( char ) * ( strlen( lib_rend_path ) + strlen( ROM_FILE_NAME ) + 2 + 1 + notEndingWithSeparator ) ); if ( h_file_path ) { if ( notEndingWithSeparator ) { #ifdef WIN32 - sprintf( h_file_path, "%s\\%s.h", lib_dec_path, ROM_FILE_NAME ); + sprintf( h_file_path, "%s\\%s.h", lib_rend_path, ROM_FILE_NAME ); #else - sprintf( h_file_path, "%s/%s.h", lib_dec_path, ROM_FILE_NAME ); + sprintf( h_file_path, "%s/%s.h", lib_rend_path, ROM_FILE_NAME ); #endif } else { #ifdef WIN32 - sprintf( h_file_path, "%s\\%s.h", lib_dec_path, ROM_FILE_NAME ); + sprintf( h_file_path, "%s\\%s.h", lib_rend_path, ROM_FILE_NAME ); #else - sprintf( h_file_path, "%s/%s.h", lib_dec_path, ROM_FILE_NAME ); + sprintf( h_file_path, "%s/%s.h", lib_rend_path, ROM_FILE_NAME ); #endif } } @@ -305,21 +306,21 @@ int main( int argc, char *argv[] ) usage_gen_crend_tables(); if ( c_file_path ) free( c_file_path ); - if ( lib_dec_path ) - free( lib_dec_path ); + if ( lib_rend_path ) + free( lib_rend_path ); return -1; } fp = fopen( h_file_path, "w" ); if ( fp == NULL ) { - fprintf( stderr, "Wrong lib_dec path: %s\n\n", lib_dec_path ); + fprintf( stderr, "Wrong lib_dec path: %s\n\n", lib_rend_path ); usage_gen_crend_tables(); if ( h_file_path ) free( h_file_path ); if ( c_file_path ) free( c_file_path ); - if ( lib_dec_path ) - free( lib_dec_path ); + if ( lib_rend_path ) + free( lib_rend_path ); return -1; } fclose( fp ); @@ -327,17 +328,17 @@ int main( int argc, char *argv[] ) if ( c_file_path == NULL ) { - size_t len = ( strlen( ROM_FILE_NAME ) + 5 + ( no_optim ? strlen( "_no_optim" ) : 0 ) + 2 + 1); + size_t len = ( strlen( ROM_FILE_NAME ) + 5 + ( no_optim ? strlen( "_no_optim" ) : 0 ) + 2 + 1 ); c_file_path = (char *) malloc( sizeof( char ) * len ); sprintf( c_file_path, "%s_%02dms%s.c", ROM_FILE_NAME, frame_len_ms, ( no_optim ? "_no_optim" : "" ) ); - c_file_path[len-1] = '\0'; + c_file_path[len - 1] = '\0'; } if ( h_file_path == NULL ) { - size_t len = ( strlen( ROM_FILE_NAME ) + 5 + ( no_optim ? strlen( "_no_optim" ) : 0 ) + 2 + 1); + size_t len = ( strlen( ROM_FILE_NAME ) + 5 + ( no_optim ? strlen( "_no_optim" ) : 0 ) + 2 + 1 ); h_file_path = (char *) malloc( sizeof( char ) * len ); sprintf( h_file_path, "%s_%02dms%s.h", ROM_FILE_NAME, frame_len_ms, ( no_optim ? "_no_optim" : "" ) ); - h_file_path[len-1] = '\0'; + h_file_path[len - 1] = '\0'; } FILE *fpt = fopen( TEMPLTATE_C_ROM_FILE_NAME, "rb" ); @@ -811,6 +812,10 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, bool no_optim ) ivas_set_hrtf_fr( &hrtf_data, ivas_hrtf, frame_len ); } +#ifdef FIX_BINAURAL_DELAY_PRECISION + hrtf_data.latency_s += 0.000000001f; +#endif + if ( ( hrtf_data.num_iterations[0][0] > 2 ) ) { strcpy( &lscfg.name[len_ls_cfg_name], "_BRIR" ); @@ -862,7 +867,7 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, bool no_optim ) /*---------------------------------------------------------------------* *write_array_float_to_file(); *---------------------------------------------------------------------*/ -void write_array_float_to_file( FILE *fp, float *vec, int32_t size_vec, int32_t sample_per_ligne, const char *format, const int num_tab ) +void write_array_float_to_file( FILE *fp, float *vec, int32_t size_vec, int32_t sample_per_ligne, const char *format, const int num_tab, const char *tab ) { int32_t k, l, num_iter, remaining_samples; int16_t i; @@ -876,7 +881,7 @@ void write_array_float_to_file( FILE *fp, float *vec, int32_t size_vec, int32_t } for ( i = 0; i < num_tab; i++ ) { - fprintf( fp, "\t" ); + fprintf( fp, "%s", tab ); } fprintf( fp, "{" ); @@ -886,7 +891,7 @@ void write_array_float_to_file( FILE *fp, float *vec, int32_t size_vec, int32_t { for ( i = 0; i < num_tab; i++ ) { - fprintf( fp, "\t" ); + fprintf( fp, "%s", tab ); } } for ( l = 0; l < sample_per_ligne; l++ ) @@ -898,7 +903,7 @@ void write_array_float_to_file( FILE *fp, float *vec, int32_t size_vec, int32_t } for ( i = 0; i < num_tab; i++ ) { - fprintf( fp, "\t" ); + fprintf( fp, "%s", tab ); } for ( l = 0; l < remaining_samples - 1; l++ ) { @@ -912,7 +917,7 @@ void write_array_float_to_file( FILE *fp, float *vec, int32_t size_vec, int32_t /*---------------------------------------------------------------------* *write_array_float_to_file(); *---------------------------------------------------------------------*/ -void write_array_uint16_to_file( FILE *fp, uint16_t *vec, int32_t size_vec, int32_t sample_per_ligne, const int num_tab ) +void write_array_uint16_to_file( FILE *fp, uint16_t *vec, int32_t size_vec, int32_t sample_per_ligne, const int num_tab, const char *tab ) { int32_t k, l, num_iter, remaining_samples; int16_t i; @@ -926,7 +931,7 @@ void write_array_uint16_to_file( FILE *fp, uint16_t *vec, int32_t size_vec, int3 } for ( i = 0; i < num_tab; i++ ) { - fprintf( fp, "\t" ); + fprintf( fp, "%s", tab ); } fprintf( fp, "{" ); @@ -936,7 +941,7 @@ void write_array_uint16_to_file( FILE *fp, uint16_t *vec, int32_t size_vec, int3 { for ( i = 0; i < num_tab; i++ ) { - fprintf( fp, "\t" ); + fprintf( fp, "%s", tab ); } } for ( l = 0; l < sample_per_ligne; l++ ) @@ -948,7 +953,7 @@ void write_array_uint16_to_file( FILE *fp, uint16_t *vec, int32_t size_vec, int3 } for ( i = 0; i < num_tab; i++ ) { - fprintf( fp, "\t" ); + fprintf( fp, "%s", tab ); } for ( l = 0; l < remaining_samples - 1; l++ ) { @@ -958,7 +963,7 @@ void write_array_uint16_to_file( FILE *fp, uint16_t *vec, int32_t size_vec, int3 fprintf( fp, "%u", vec[k * sample_per_ligne + l] ); for ( i = 0; i < num_tab; i++ ) { - fprintf( fp, "\t" ); + fprintf( fp, "%s", tab ); } fprintf( fp, "}" ); } @@ -987,7 +992,11 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int { /* float latency_s; */ fprintf( fp, "\n\n/********************** %s_%s **********************/\n", DECLARATION_NAME, lscfg.name ); +#ifdef FIX_BINAURAL_DELAY_PRECISION + fprintf( fp, "\nconst float %s_%s_latency_s = %10.9ff;", DECLARATION_NAME, lscfg.name, hrtf->latency_s ); +#else fprintf( fp, "\nconst float %s_%s_latency_s = %16.15ff;", DECLARATION_NAME, lscfg.name, hrtf->latency_s ); +#endif } fprintf( fp, "\n\n/* Sample Rate = %ld */\n", (long) samplerate ); @@ -1054,15 +1063,15 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int for ( i = 0; i < hrtf->max_num_ir - 1; i++ ) { fprintf( fp, "{" ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][0], hrtf->max_num_iterations, hrtf->max_num_iterations, 0 ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][0], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "," ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][1], hrtf->max_num_iterations, hrtf->max_num_iterations, 0 ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][1], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "}," ); } fprintf( fp, "{" ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][0], hrtf->max_num_iterations, hrtf->max_num_iterations, 0 ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][0], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "," ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][1], hrtf->max_num_iterations, hrtf->max_num_iterations, 0 ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max[i][1], hrtf->max_num_iterations, hrtf->max_num_iterations, 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "}" ); fprintf( fp, "};" ); @@ -1071,7 +1080,7 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int /* float inv_diffuse_weight[MAX_INTERN_CHANNELS]; */ fprintf( fp, "\nconst float %s_%s_inv_diffuse_weight_%2dkHz[%u]=", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir ); - write_array_float_to_file( fp, hrtf->inv_diffuse_weight, hrtf->max_num_ir, hrtf->max_num_ir, FORMAT_FLOAT, 0 ); + write_array_float_to_file( fp, hrtf->inv_diffuse_weight, hrtf->max_num_ir, hrtf->max_num_ir, FORMAT_FLOAT, 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ";" ); /* uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS];*/ @@ -1082,9 +1091,9 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int else { fprintf( fp, "\nconst uint16_t %s_%s_pIndex_frequency_max_diffuse_%2dkHz[BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, ( hrtf->num_iterations_diffuse[0] > hrtf->num_iterations_diffuse[1] ) ? hrtf->num_iterations_diffuse[0] : hrtf->num_iterations_diffuse[1] ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_diffuse[0], hrtf->num_iterations_diffuse[0], hrtf->num_iterations_diffuse[0], 0 ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_diffuse[0], hrtf->num_iterations_diffuse[0], hrtf->num_iterations_diffuse[0], 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "," ); - write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_diffuse[1], hrtf->num_iterations_diffuse[1], hrtf->num_iterations_diffuse[1], 0 ); + write_array_uint16_to_file( fp, hrtf->pIndex_frequency_max_diffuse[1], hrtf->num_iterations_diffuse[1], hrtf->num_iterations_diffuse[1], 0, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "};" ); } @@ -1092,33 +1101,33 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int fprintf( fp, "\nconst float %s_%s_coeff_re_%2dkHz[%d][BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir, maxTotalNumFreqSampPerIterations ); for ( i = 0; i < hrtf->max_num_ir - 1; i++ ) { - fprintf( fp, "\n\t{\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); + fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); - fprintf( fp, "\n\t}," ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); + fprintf( fp, "\n%s},", TAB_WITH_SPACE_OR_NOT ); } - fprintf( fp, "\n\t{\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); + fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); - fprintf( fp, "\n\t}" ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_re[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); + fprintf( fp, "\n%s}", TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n};" ); fprintf( fp, "\nconst float %s_%s_coeff_im_%2dkHz[%d][BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, hrtf->max_num_ir, maxTotalNumFreqSampPerIterations ); for ( i = 0; i < hrtf->max_num_ir - 1; i++ ) { - fprintf( fp, "\n\t{\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); + fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); - fprintf( fp, "\n\t}," ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); + fprintf( fp, "\n%s},", TAB_WITH_SPACE_OR_NOT ); } - fprintf( fp, "\n\t{\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); + fprintf( fp, "\n%s{\n", TAB_WITH_SPACE_OR_NOT ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][0], pTotalNumFreqSampPerIterations[0][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); - fprintf( fp, "\n\t}" ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_im[i][1], pTotalNumFreqSampPerIterations[1][i], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); + fprintf( fp, "\n%s}", TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n};" ); /* float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS];*/ @@ -1129,9 +1138,9 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int else { fprintf( fp, "\nconst float %s_%s_coeff_diffuse_re_%2dkHz[BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, maxTotalNumFreqSampPerIterationsDiffuse ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_re[0], pTotalNumFreqSampPerIterationsDiffuse[0], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_re[0], pTotalNumFreqSampPerIterationsDiffuse[0], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_re[1], pTotalNumFreqSampPerIterationsDiffuse[1], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_re[1], pTotalNumFreqSampPerIterationsDiffuse[1], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n};" ); } @@ -1143,9 +1152,9 @@ void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int else { fprintf( fp, "\nconst float %s_%s_coeff_diffuse_im_%2dkHz[BINAURAL_CHANNELS][%u]={", DECLARATION_NAME, lscfg.name, samplerate / 1000, maxTotalNumFreqSampPerIterationsDiffuse ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_im[0], pTotalNumFreqSampPerIterationsDiffuse[0], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_im[0], pTotalNumFreqSampPerIterationsDiffuse[0], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, ",\n" ); - write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_im[1], pTotalNumFreqSampPerIterationsDiffuse[1], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2 ); + write_array_float_to_file( fp, hrtf->pOut_to_bin_diffuse_im[1], pTotalNumFreqSampPerIterationsDiffuse[1], NUM_SAMPLES_PER_LINES, FORMAT_FLOAT, 2, TAB_WITH_SPACE_OR_NOT ); fprintf( fp, "\n};" ); } diff --git a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c index 456997b5a1202344911e0313c17343458439f17f..7e9658bd8030b2d5a93a4defb7731263423217fe 100644 --- a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c +++ b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.c @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. diff --git a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.h b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.h index 9b8fdbcde916440319990b039e1a141d21c79cee..28d3c1225023d0343c66d19bf5d5e7c6706619d8 100644 --- a/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.h +++ b/scripts/binauralRenderer_interface/ivas_crend_binaural_filter_design.h @@ -1,6 +1,6 @@ /****************************************************************************************************** - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. diff --git a/scripts/pyprocessing/__init__.py b/scripts/binauralRenderer_interface/ivas_rom_binaural_crend_head.template similarity index 75% rename from scripts/pyprocessing/__init__.py rename to scripts/binauralRenderer_interface/ivas_rom_binaural_crend_head.template index 5e7b5aa892d9f45d2eed18386bf8aa8889cb4900..9aacf9688a0380efd749f7373d2dc26d84657865 100644 --- a/scripts/pyprocessing/__init__.py +++ b/scripts/binauralRenderer_interface/ivas_rom_binaural_crend_head.template @@ -1,6 +1,5 @@ -#!/usr/bin/env python3 +/****************************************************************************************************** -""" (C) 2022-2023 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, @@ -28,18 +27,17 @@ 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. -""" -""" -pyprocessing -==== +*******************************************************************************************************/ + +/* clang-format off */ + +/*------------------------------------------------------------------------- + * Binaural rendering related ROM tables + *------------------------------------------------------------------------*/ + +/* Binaural rendering data set based on HRIRs */ +/* Tables generated by scripts/binauralRenderer_interface/generate_cren_ivas_tables.c, see mixer_conv_sofa_to_rom_table_converter_readme.txt */ +/* Can be replaced by your own generated HRIR or BRIR tables */ -Provides - Methods for processing/coding 3D audio -Imports -------- -functions -class -""" -from . import evs, ivas, prepost_processing, processing, processing_configs, utils diff --git a/lib_debug/segsnr.c b/scripts/binauralRenderer_interface/mixer_conv_sofa_to_rom_table_converter_readme.txt similarity index 55% rename from lib_debug/segsnr.c rename to scripts/binauralRenderer_interface/mixer_conv_sofa_to_rom_table_converter_readme.txt index 5e5cee48b0d6f629890140af827eea0571350c3e..73314c5cd5188ed690ecc00d4d4b5fd30737db40 100644 --- a/lib_debug/segsnr.c +++ b/scripts/binauralRenderer_interface/mixer_conv_sofa_to_rom_table_converter_readme.txt @@ -30,76 +30,27 @@ *******************************************************************************************************/ -#include -#ifdef DEBUGGING -#include "debug.h" -#endif -#include "wmc_auto.h" -#include -#include "options.h" -#include "prot.h" +Mixer conv sofa to rom table converter program +------------------------------ -#define WMC_TOOL_SKIP +The sofa to rom format converter is used to generate the c files (*.h,*.c) containing the binary representation of the binaural +filters for renderer MIXER_CONV and MIXER_CONV_ROOM -#ifdef OUTPUT_SNR -/*_____________________________________________________________________ - | | - | FUNCTION NAME segsnr | - | Computes the segmential signal-to-noise ratio between the | - | signal x and its estimate xe of length n samples. The segment | - | length is nseg samples. | - | - | INPUT - | x[0:n-1] Signal of n samples. - | xe[0:n-1] Estimated signal of n samples. - | n Signal length. - | nseg Segment length, must be a submultiple of n. - | - | RETURN VALUE - | snr Segmential signal to noise ratio in dB. - |_____________________________________________________________________| -*/ +First, build the converter under scripts/binauralRenderer_interface in VSCode (using CMakeList). -float segsnr( float x[], float xe[], int16_t n, int16_t nseg ) -{ - float snr = 0.0f; - float signal, noise, error, fac; - int16_t i, j; - LOOP( 1 ); - for ( i = 0; i < n; i += nseg ) - { - signal = 1e-6f; - MOVE( 2 ); - noise = 1e-6f; - LOOP( 1 ); - for ( j = 0; j < nseg; j++ ) - { - signal += ( *x ) * ( *x ); - MAC( 1 ); - error = *x++ - *xe++; - ADD( 1 ); - noise += error * error; - MAC( 1 ); - } - snr += (float) log10( signal / noise ); - TRANS( 1 ); - DIV( 1 ); - ADD( 1 ); - } - fac = ( (float) ( 10 * nseg ) ) / (float) n; - DIV( 1 ); - MULT( 1 ); - snr = fac * snr; - MULT( 1 ); - ADD( 1 ); - BRANCH( 1 ); - if ( snr < -99.0f ) - { - snr = -99.0f; - MOVE( 1 ); - } - return ( snr ); -} -#endif +Usage: +------ +generate_crend_ivas_tables [Options] -#undef WMC_TOOL_SKIP +Mandatory parameters : + - Frame size in ms (5 or 20) + - list of sofa files (one with HRIR that directions of IVAS combined speakers configuration or more, one with HOA to binaura filters at least order 3, one with BRIR filters that directions of IVAS combined speakers configuration or more) + +Options : + -lib_rend_path : Path where output file will be created (with separator, default = './'). + -no_optim : if present the BRIR filters are not optimised the renderer will perform perfect convolution with the complete size of the BRIR (high files size and high complexity). It is useful for debug purpose + +For example : + +./build/generate_crend_ivas_tables.exe -lib_rend_path ../../lib_rend 5 ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000.sofa ./HRIRs_sofa/ORANGE_HRIR_53_HOA3S_48000.sofa ./BRIRs_sofa/IIS_BRIR_officialMPEG_Combined.sofa +./build/generate_crend_ivas_tables -lib_rend_path ../../lib_rend 5 ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000.sofa ./HRIRs_sofa/ORANGE_HRIR_53_HOA3S_48000.sofa ./BRIRs_sofa/IIS_BRIR_officialMPEG_Combined.sofa \ No newline at end of file diff --git a/scripts/binauralRenderer_interface/resolve_build_dep.py b/scripts/binauralRenderer_interface/resolve_build_dep.py index 5a1a823033b5bbc9480bbc4d0da0c8e55b2f86a2..a251e7fe327b7b8366562ae31a627411d1b0be3c 100644 --- a/scripts/binauralRenderer_interface/resolve_build_dep.py +++ b/scripts/binauralRenderer_interface/resolve_build_dep.py @@ -1,5 +1,5 @@ """ - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. diff --git a/scripts/config/ci_linux.json b/scripts/config/ci_linux.json index 6279d3f89d2493ff586bc4064d50e26bfadd623f..1cb11417522c52ac297ddd41afe57f113efc8beb 100644 --- a/scripts/config/ci_linux.json +++ b/scripts/config/ci_linux.json @@ -2,24 +2,24 @@ "afspPath": "not_needed", "utilPath": "/tools", "inpaths": { - "MONO": "/usr/local/testv/test_mono.wav", - "STEREO": "/usr/local/testv/test_stereo.wav", - "FOA": "/usr/local/testv/test_FOA.wav", - "HOA2": "/usr/local/testv/test_HOA2.wav", - "HOA3": "/usr/local/testv/test_HOA3.wav", - "SBA": "/usr/local/testv/test_HOA3.wav", - "MASA1TC1DIR": "/usr/local/testv/test_MASA_1dir1TC.wav", - "MASA1TC2DIR": "/usr/local/testv/test_MASA_2dir1TC.wav", - "MASA2TC1DIR": "/usr/local/testv/test_MASA_1dir2TC.wav", - "MASA2TC2DIR": "/usr/local/testv/test_MASA_2dir2TC.wav", - "5_1": "/usr/local/testv/test_MC51.wav", - "5_1_2": "/usr/local/testv/test_MC51p2.wav", - "5_1_4": "/usr/local/testv/test_MC51p4.wav", - "7_1": "/usr/local/testv/test_MC71.wav", - "7_1_4": "/usr/local/testv/test_MC71p4.wav", - "ISM1": "/usr/local/testv/test_ISM_1obj.wav", - "ISM2": "/usr/local/testv/test_ISM_2obj.wav", - "ISM3": "/usr/local/testv/test_ISM_3obj.wav", - "ISM4": "/usr/local/testv/test_ISM_4obj.wav" + "MONO": "/usr/local/testv/stv48c.wav", + "STEREO": "/usr/local/testv/stvST48c.wav", + "FOA": "/usr/local/testv/stvFOA48c.wav", + "HOA2": "/usr/local/testv/stv2OA48c.wav", + "HOA3": "/usr/local/testv/stv3OA48c.wav", + "SBA": "/usr/local/testv/stv3OA48c.wav", + "MASA1TC1DIR": "/usr/local/testv/stv1MASA1TC48c.wav", + "MASA1TC2DIR": "/usr/local/testv/stv2MASA1TC48c.wav", + "MASA2TC1DIR": "/usr/local/testv/stv1MASA2TC48c.wav", + "MASA2TC2DIR": "/usr/local/testv/stv2MASA2TC48c.wav", + "5_1": "/usr/local/testv/stv51MC48c.wav", + "5_1_2": "/usr/local/testv/stv512MC48c.wav", + "5_1_4": "/usr/local/testv/stv514MC48c.wav", + "7_1": "/usr/local/testv/stv71MC48c.wav", + "7_1_4": "/usr/local/testv/stv714MC48c.wav", + "ISM1": "/usr/local/testv/stv1ISM48s.wav", + "ISM2": "/usr/local/testv/stv2ISM48s.wav", + "ISM3": "/usr/local/testv/stv3ISM48s.wav", + "ISM4": "/usr/local/testv/stv4ISM48s.wav" } } diff --git a/scripts/config/ci_linux_ltv.json b/scripts/config/ci_linux_ltv.json index e20af4edfdd7272e0fa6e8dfcb592975334fc91b..804d87b9c0ca28883cd46feaf7a59ee569e950a4 100644 --- a/scripts/config/ci_linux_ltv.json +++ b/scripts/config/ci_linux_ltv.json @@ -8,10 +8,10 @@ "HOA2": "/usr/local/ltv/ltv48_HOA2.wav", "HOA3": "/usr/local/ltv/ltv48_HOA3.wav", "SBA": "/usr/local/ltv/ltv48_HOA3.wav", - "MASA1TC1DIR": "/usr/local/testv/test_MASA_1dir1TC.wav", - "MASA1TC2DIR": "/usr/local/testv/test_MASA_2dir1TC.wav", - "MASA2TC1DIR": "/usr/local/testv/test_MASA_1dir2TC.wav", - "MASA2TC2DIR": "/usr/local/testv/test_MASA_2dir2TC.wav", + "MASA1TC1DIR": "/usr/local/testv/stv1MASA1TC48c.wav", + "MASA1TC2DIR": "/usr/local/testv/stv2MASA1TC48c.wav", + "MASA2TC1DIR": "/usr/local/testv/stv1MASA2TC48c.wav", + "MASA2TC2DIR": "/usr/local/testv/stv2MASA2TC48c.wav", "5_1": "/usr/local/ltv/ltv48_MC51.wav", "5_1_2": "/usr/local/ltv/ltv48_MC512.wav", "5_1_4": "/usr/local/ltv/ltv48_MC514.wav", diff --git a/scripts/config/ivas_modes.json b/scripts/config/ivas_modes.json index 5eabeae024dadadb69f1efce29905234f711e7b5..d4f1e107cc6c2a798920a8874115ed24f5902f9d 100644 --- a/scripts/config/ivas_modes.json +++ b/scripts/config/ivas_modes.json @@ -964,6 +964,44 @@ ] } }, + "MASA_1TC_1DIR_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-masa", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [], + "EXT": [] + }, + "in_config": "MASA1TC1DIR", + "table_name": "MASA 1TC 1DIR@{table_bitrate} kbps RS {bandwidth}", + "nummetadata": 1, + "metadatafilenames": [ + "{item}.met" + ], + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + } + } + + }, "MASA_2TC_1DIR_b{bitrate}_{bandwidth}_cbr": { "encmodeoption": [ "-masa", @@ -1034,6 +1072,46 @@ ] } }, + "MASA_2TC_1DIR_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-masa", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "7_1_4": [], + "HOA3": [], + "mono": [], + "stereo": [], + "EXT": [] + }, + "in_config": "MASA2TC1DIR", + "table_name": "MASA 2TC 1DIR@{table_bitrate} kbps {bandwidth}", + "nummetadata": 1, + "metadatafilenames": [ + "{item}.met" + ], + "rs": true, + "amr": false, + "mono": false, + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_13k2_512k.bin" + } + } + }, "MASA_1TC_2DIR_b{bitrate}_{bandwidth}_cbr": { "encmodeoption": [ "-masa", @@ -1813,7 +1891,7 @@ "table_name": "ISM1@{table_bitrate} kbps {bandwidth}", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -1828,10 +1906,7 @@ 64000, 80000, 96000, - 128000, - 160000, - 192000, - 256000 + 128000 ], "swb": [ 13200, @@ -1842,10 +1917,7 @@ 64000, 80000, 96000, - 128000, - 160000, - 192000, - 256000 + 128000 ], "fb": [ 32000, @@ -1853,13 +1925,43 @@ 64000, 80000, 96000, - 128000, - 160000, - 192000, - 256000 + 128000 ] } }, + "ISM1_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-ism", + "1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM1", + "table_name": "ISM1@{table_bitrate} RS kbps {bandwidth}", + "nummetadata": 1, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_13k2_128k.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_13k2_128k.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_32k_128k.bin" + } + } + }, "ISM1_b{bitrate}_dtx_{bandwidth}_cbr": { "encmodeoption": [ "-ism", @@ -1877,7 +1979,7 @@ "table_name": "ISM1@{table_bitrate} kbps DTX {bandwidth}", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -1885,6 +1987,61 @@ "bitrates": { "wb": [ 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000 + ], + "swb": [ + 13200, + 16400, + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000 + ], + "fb": [ + 32000, + 48000, + 64000, + 80000, + 96000, + 128000 + ] + } + } + }, + "ISM2": { + "ISM2_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM2", + "table_name": "ISM2@{table_bitrate} kbps {bandwidth}", + "nummetadata": 2, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ 16400, 24400, 32000, @@ -1898,7 +2055,6 @@ 256000 ], "swb": [ - 13200, 16400, 24400, 32000, @@ -1923,11 +2079,10 @@ 256000 ] } - } - }, - "ISM2": { - "ISM2_b{bitrate}_{bandwidth}_cbr": { + }, + "ISM2_b{bitrate}_dtx_{bandwidth}_cbr": { "encmodeoption": [ + "-dtx", "-ism", "2" ], @@ -1939,10 +2094,10 @@ "EXT": [] }, "in_config": "ISM2", - "table_name": "ISM2@{table_bitrate} kbps {bandwidth}", + "table_name": "ISM2@{table_bitrate} kbps DTX {bandwidth}", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -1986,6 +2141,39 @@ 256000 ] } + }, + "ISM2_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-ism", + "2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM2", + "table_name": "ISM2@{table_bitrate} kbps RS {bandwidth}", + "nummetadata": 2, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_16k4_256k.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_16k4_256k.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_32k_256k.bin" + } + } } }, "ISM3": { @@ -2005,7 +2193,7 @@ "table_name": "ISM3@{table_bitrate} kbps {bandwidth}", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -2021,7 +2209,8 @@ 128000, 160000, 192000, - 256000 + 256000, + 384000 ], "swb": [ 24400, @@ -2033,7 +2222,8 @@ 128000, 160000, 192000, - 256000 + 256000, + 384000 ], "fb": [ 32000, @@ -2044,16 +2234,16 @@ 128000, 160000, 192000, - 256000 + 256000, + 384000 ] } - } - }, - "ISM4": { - "ISM4_b{bitrate}_{bandwidth}_cbr": { + }, + "ISM3_b{bitrate}_dtx_{bandwidth}_cbr": { "encmodeoption": [ + "-dtx", "-ism", - "4" + "3" ], "encoptions": [ "-max_band", @@ -2062,11 +2252,11 @@ "dec": { "EXT": [] }, - "in_config": "ISM4", - "table_name": "ISM4@{table_bitrate} kbps {bandwidth}", - "nummetadata": 4, + "in_config": "ISM3", + "table_name": "ISM3@{table_bitrate} kbps DTX {bandwidth}", + "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -2082,7 +2272,8 @@ 128000, 160000, 192000, - 256000 + 256000, + 384000 ], "swb": [ 24400, @@ -2094,7 +2285,8 @@ 128000, 160000, 192000, - 256000 + 256000, + 384000 ], "fb": [ 32000, @@ -2105,11 +2297,631 @@ 128000, 160000, 192000, - 256000 + 256000, + 384000 ] } + }, + "ISM3_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-ism", + "3" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM3", + "table_name": "ISM3@{table_bitrate} kbps {bandwidth}", + "nummetadata": 3, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_24k4_384k.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_24k4_384k.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_32k_384k.bin" + } + } } }, + "ISM4": { + "ISM4_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism", + "4" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM4", + "table_name": "ISM4@{table_bitrate} kbps {bandwidth}", + "nummetadata": 4, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ], + "swb": [ + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ], + "fb": [ + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ] + } + }, + "ISM4_b{bitrate}_dtx_{bandwidth}_cbr": { + "encmodeoption": [ + "-dtx", + "-ism", + "4" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM4", + "table_name": "ISM4@{table_bitrate} kbps DTX {bandwidth}", + "nummetadata": 4, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ], + "swb": [ + 24400, + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ], + "fb": [ + 32000, + 48000, + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ] + } + }, + "ISM4_b{bitrate}_{bandwidth}_rs": { + "encmodeoption": [ + "-ism", + "4" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM4", + "table_name": "ISM4@{table_bitrate} kbps RS {bandwidth}", + "nummetadata": 4, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": true, + "amr": false, + "mono": false, + "bitrates": { + "wb": { + "all": "{sw_files_path}/sw_24k4_384k.bin" + }, + "swb": { + "all": "{sw_files_path}/sw_24k4_384k.bin" + }, + "fb": { + "all": "{sw_files_path}/sw_32k_384k.bin" + } + } + } + }, + "ISM+1": { + "ISM+1_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism", + "+1" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM1", + "table_name": "ISM+1@{table_bitrate} kbps {bandwidth}", + "nummetadata": 1, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 64000, + 80000, + 96000, + 128000 + ], + "swb": [ + 64000, + 80000, + 96000, + 128000 + ], + "fb": [ + 64000, + 80000, + 96000, + 128000 + ] + } + }, + "ISM+1_b{bitrate}_dtx_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism", + "+1" + ], + "encoptions": [ + "-dtx", + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM1", + "table_name": "ISM+1@{table_bitrate} kbps DTX {bandwidth}", + "nummetadata": 1, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 64000, + 80000, + 96000, + 128000 + ], + "swb": [ + 64000, + 80000, + 96000, + 128000 + ], + "fb": [ + 64000, + 80000, + 96000, + 128000 + ] + } + } + }, + "ISM+2": { + "ISM+2_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism", + "+2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM2", + "table_name": "ISM+2@{table_bitrate} kbps {bandwidth}", + "nummetadata": 2, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000 + ], + "swb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000 + ], + "fb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000 + ] + } + }, + "ISM+2_b{bitrate}_dtx_{bandwidth}_cbr": { + "encmodeoption": [ + "-dtx", + "-ism", + "+2" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM2", + "table_name": "ISM+2@{table_bitrate} kbps DTX {bandwidth}", + "nummetadata": 2, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000 + ], + "swb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000 + ], + "fb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000 + ] + } + } + }, + "ISM+3": { + "ISM+3_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism", + "+3" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM3", + "table_name": "ISM+3@{table_bitrate} kbps {bandwidth}", + "nummetadata": 3, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000 + ], + "swb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000 + ], + "fb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000 + ] + } + }, + "ISM+3_b{bitrate}_dtx_{bandwidth}_cbr": { + "encmodeoption": [ + "-dtx", + "-ism", + "+3" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM3", + "table_name": "ISM+3@{table_bitrate} kbps DTX {bandwidth}", + "nummetadata": 3, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000 + ], + "swb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000 + ], + "fb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000 + ] + } + } + }, + "ISM+4": { + "ISM+4_b{bitrate}_{bandwidth}_cbr": { + "encmodeoption": [ + "-ism", + "+4" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM4", + "table_name": "ISM+4@{table_bitrate} kbps {bandwidth}", + "nummetadata": 4, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ], + "swb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ], + "fb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ] + } + }, + "ISM+4_b{bitrate}_dtx_{bandwidth}_cbr": { + "encmodeoption": [ + "-dtx", + "-ism", + "+4" + ], + "encoptions": [ + "-max_band", + "{bandwidth}" + ], + "dec": { + "EXT": [] + }, + "in_config": "ISM4", + "table_name": "ISM+4@{table_bitrate} kbps DTX {bandwidth}", + "nummetadata": 4, + "metadatafilenames": [ + "stvISM{mdi}.csv" + ], + "rs": false, + "amr": false, + "mono": false, + "bitrates": { + "wb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ], + "swb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ], + "fb": [ + 64000, + 80000, + 96000, + 128000, + 160000, + 192000, + 256000, + 384000, + 512000 + ] + } + } + }, "stereo": { "stereo_b{bitrate}_{bandwidth}_cbr": { "encmodeoption": [ @@ -2915,4 +3727,4 @@ } } } -} \ No newline at end of file +} diff --git a/scripts/config/ivas_modes_debug.json b/scripts/config/ivas_modes_debug.json index 769ed791ea64008ea2c8b28b3ffdbc398ba84765..bbd63d224ce3f0ca5d75dd6b040b91dcdbbda6fd 100644 --- a/scripts/config/ivas_modes_debug.json +++ b/scripts/config/ivas_modes_debug.json @@ -12117,7 +12117,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12141,7 +12141,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12165,7 +12165,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12189,7 +12189,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12213,7 +12213,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12237,7 +12237,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12261,7 +12261,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12285,7 +12285,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12309,7 +12309,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12333,7 +12333,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12357,7 +12357,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12381,7 +12381,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12405,7 +12405,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12429,7 +12429,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12453,7 +12453,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12477,7 +12477,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12501,7 +12501,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12525,7 +12525,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12549,7 +12549,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12573,7 +12573,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12597,7 +12597,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12621,7 +12621,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12645,7 +12645,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12669,7 +12669,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12693,7 +12693,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12717,7 +12717,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12741,7 +12741,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12765,7 +12765,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12789,7 +12789,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12813,7 +12813,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12837,7 +12837,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12861,7 +12861,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12885,7 +12885,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12909,7 +12909,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12933,7 +12933,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12958,7 +12958,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -12983,7 +12983,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13008,7 +13008,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13033,7 +13033,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13058,7 +13058,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13083,7 +13083,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13108,7 +13108,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13133,7 +13133,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13158,7 +13158,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13183,7 +13183,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13208,7 +13208,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13233,7 +13233,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13258,7 +13258,7 @@ "bw": "wb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13283,7 +13283,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13308,7 +13308,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13333,7 +13333,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13358,7 +13358,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13383,7 +13383,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13408,7 +13408,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13433,7 +13433,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13458,7 +13458,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13483,7 +13483,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13508,7 +13508,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13533,7 +13533,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13558,7 +13558,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13583,7 +13583,7 @@ "bw": "swb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13608,7 +13608,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13633,7 +13633,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13658,7 +13658,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13683,7 +13683,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13708,7 +13708,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13733,7 +13733,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13758,7 +13758,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13783,7 +13783,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13808,7 +13808,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13833,7 +13833,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13858,7 +13858,7 @@ "bw": "fb", "nummetadata": 1, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13884,7 +13884,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13908,7 +13908,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13932,7 +13932,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13956,7 +13956,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -13980,7 +13980,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14004,7 +14004,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14028,7 +14028,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14052,7 +14052,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14076,7 +14076,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14100,7 +14100,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14124,7 +14124,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14148,7 +14148,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14172,7 +14172,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14196,7 +14196,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14220,7 +14220,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14244,7 +14244,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14268,7 +14268,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14292,7 +14292,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14316,7 +14316,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14340,7 +14340,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14364,7 +14364,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14388,7 +14388,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14412,7 +14412,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14436,7 +14436,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14460,7 +14460,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14484,7 +14484,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14508,7 +14508,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14532,7 +14532,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14556,7 +14556,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14580,7 +14580,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14604,7 +14604,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14628,7 +14628,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14653,7 +14653,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14678,7 +14678,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14703,7 +14703,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14728,7 +14728,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14753,7 +14753,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14778,7 +14778,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14803,7 +14803,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14828,7 +14828,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14853,7 +14853,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14878,7 +14878,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14903,7 +14903,7 @@ "bw": "wb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14928,7 +14928,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14953,7 +14953,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -14978,7 +14978,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15003,7 +15003,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15028,7 +15028,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15053,7 +15053,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15078,7 +15078,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15103,7 +15103,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15128,7 +15128,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15153,7 +15153,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15178,7 +15178,7 @@ "bw": "swb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15203,7 +15203,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15228,7 +15228,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15253,7 +15253,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15278,7 +15278,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15303,7 +15303,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15328,7 +15328,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15353,7 +15353,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15378,7 +15378,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15403,7 +15403,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15428,7 +15428,7 @@ "bw": "fb", "nummetadata": 2, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15454,7 +15454,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15478,7 +15478,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15502,7 +15502,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15526,7 +15526,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15550,7 +15550,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15574,7 +15574,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15598,7 +15598,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15622,7 +15622,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15646,7 +15646,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15670,7 +15670,7 @@ "bw": "wb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15694,7 +15694,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15718,7 +15718,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15742,7 +15742,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15766,7 +15766,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15790,7 +15790,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15814,7 +15814,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15838,7 +15838,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15862,7 +15862,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15886,7 +15886,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15910,7 +15910,7 @@ "bw": "swb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15934,7 +15934,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15958,7 +15958,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -15982,7 +15982,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16006,7 +16006,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16030,7 +16030,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16054,7 +16054,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16078,7 +16078,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16102,7 +16102,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16126,7 +16126,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16150,7 +16150,7 @@ "bw": "fb", "nummetadata": 3, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16176,7 +16176,7 @@ "bw": "wb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16200,7 +16200,7 @@ "bw": "wb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16224,7 +16224,7 @@ "bw": "wb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16248,7 +16248,7 @@ "bw": "wb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16272,7 +16272,7 @@ "bw": "wb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16296,7 +16296,7 @@ "bw": "wb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16320,7 +16320,7 @@ "bw": "wb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16344,7 +16344,7 @@ "bw": "wb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16368,7 +16368,7 @@ "bw": "wb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16392,7 +16392,7 @@ "bw": "swb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16416,7 +16416,7 @@ "bw": "swb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16440,7 +16440,7 @@ "bw": "swb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16464,7 +16464,7 @@ "bw": "swb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16488,7 +16488,7 @@ "bw": "swb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16512,7 +16512,7 @@ "bw": "swb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16536,7 +16536,7 @@ "bw": "swb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16560,7 +16560,7 @@ "bw": "swb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16584,7 +16584,7 @@ "bw": "swb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16608,7 +16608,7 @@ "bw": "fb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16632,7 +16632,7 @@ "bw": "fb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16656,7 +16656,7 @@ "bw": "fb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16680,7 +16680,7 @@ "bw": "fb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16704,7 +16704,7 @@ "bw": "fb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16728,7 +16728,7 @@ "bw": "fb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16752,7 +16752,7 @@ "bw": "fb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16776,7 +16776,7 @@ "bw": "fb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, @@ -16800,7 +16800,7 @@ "bw": "fb", "nummetadata": 4, "metadatafilenames": [ - "test_ISM_trajectory{mdi}.csv" + "stvISM{mdi}.csv" ], "rs": false, "amr": false, diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index b1d55a949c553bd9a2c913c4e271513b4b0a0fa3..429abcf2e637e1b6dc17d7e83e75b0b3386ff653 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -8,936 +8,1019 @@ // (the easiest way how to achieve this is to use the name of the test vector itself, as shown below) -// DFT stereo at 13.2 kbps, 16kHz in, 16kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo 1 -dtx 13200 16 testv/stvST16n.pcm bit -../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.pcm_DFT_13200_16-16_DTX_FEC5.tst +// stereo at 13.2 kbps, 16kHz in, 16kHz out, DTX on, random FEC at 5% +../IVAS_cod -stereo -dtx 13200 16 testv/stvST16n.wav bit +../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.wav_stereo_13200_16-16_DTX_FEC5.tst -// DFT stereo at 16.4 kbps, 32kHz in, 16kHz out, DTX on -../IVAS_cod -stereo 1 -dtx 16400 32 testv/stvST32n.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST32n.pcm_DFT_16400_32-16_DTX.tst +// stereo at 16.4 kbps, 32kHz in, 16kHz out, DTX on +../IVAS_cod -stereo -dtx 16400 32 testv/stvST32n.wav bit +../IVAS_dec STEREO 16 bit testv/stvST32n.wav_stereo_16400_32-16_DTX.tst -// DFT stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on, MONO out -../IVAS_cod -stereo 1 -dtx 24400 32 testv/stvST32n.pcm bit -../IVAS_dec MONO 32 bit testv/stvST32n.pcm_DFT_24400_32-32_DTX_MONO.tst +// stereo at 32 kbps, 32kHz in, 48kHz out, MONO out, 6% FEC pattern +../IVAS_cod -stereo 32000 32 testv/stvST32c.wav bit +../IVAS_dec -fec testv/FEC_6pct.bin MONO 48 bit testv/stvST32c.wav_stereo_32000_32-48_MONO_FEC6.tst -// DFT stereo at 32 kbps, 32kHz in, 48kHz out, MONO out, 6% FEC pattern -../IVAS_cod -stereo 1 32000 32 testv/stvST32c.pcm bit -../IVAS_dec -fec testv/FEC_6pct.bin MONO 48 bit testv/stvST32c.pcm_DFT_32000_32-48_MONO_FEC6.tst +// stereo at 13.2 kbps, 16kHz in, 16kHz out +../IVAS_cod -stereo 13200 16 testv/stvST16c.wav bit +../IVAS_dec STEREO 16 bit testv/stvST16c.wav_stereo_13200_16-16.tst +// stereo at 16.4 kbps, 16kHz in, 16kHz out +../IVAS_cod -stereo 16400 16 testv/stvST16c.wav bit +../IVAS_dec STEREO 16 bit testv/stvST16c.wav_stereo_16400_16-16.tst -// TD stereo at 13.2 kbps, 16kHz in, 16kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo 2 -dtx 13200 16 testv/stvST16n.pcm bit -../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.pcm_TD_13200_16-16_DTX_FEC5.tst +// stereo at 24.4 kbps, 16kHz in, 16kHz out +../IVAS_cod -stereo 24400 16 testv/stvST16c.wav bit +../IVAS_dec STEREO 16 bit testv/stvST16c.wav_stereo_24400_16-16.tst -// TD stereo at 16.4 kbps, 32kHz in, 16kHz out, DTX on -../IVAS_cod -stereo 2 -dtx 16400 32 testv/stvST32n.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST32n.pcm_TD_16400_32-16_DTX.tst +// stereo at 32 kbps, 16kHz in, 16kHz out +../IVAS_cod -stereo 32000 16 testv/stvST16c.wav bit +../IVAS_dec STEREO 16 bit testv/stvST16c.wav_stereo_32000_16-16.tst -// TD stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on, MONO out -../IVAS_cod -stereo 2 -dtx 24400 32 testv/stvST32n.pcm bit -../IVAS_dec MONO 32 bit testv/stvST32n.pcm_TD_24400_32-32_DTX_MONO.tst +// stereo at 13.2 kbps, 16kHz in, 16kHz out, DTX on, MONO out +../IVAS_cod -stereo -dtx 13200 16 testv/stvST16n.wav bit +../IVAS_dec MONO 16 bit testv/stvST16n.wav_stereo_13200_16-16_DTX_MONO.tst -// TD stereo at 32 kbps, 48kHz in, 32kHz out, random FEC at 5% -../IVAS_cod -stereo 2 32000 48 testv/stvST48c.pcm bit -../IVAS_dec -fec 5 STEREO 32 bit testv/stvST48c.pcm_TD_32000_48-32_FEC5.tst +// stereo at 16.4 kbps, 16kHz in, 16kHz out, DTX on, random FEC at 5% +../IVAS_cod -stereo -dtx 16400 16 testv/stvST16n.wav bit +../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.wav_stereo_16400_16-16_DTX_FEC5.tst +// stereo at 24.4 kbps, 16kHz in, 16kHz out, DTX on, MONO out +../IVAS_cod -stereo -dtx 24400 16 testv/stvST16n.wav bit +../IVAS_dec MONO 16 bit testv/stvST16n.wav_stereo_24400_16-16_DTX_MONO.tst -// unified stereo at 13.2 kbps, 16kHz in, 16kHz out -../IVAS_cod -stereo 13200 16 testv/stvST16c.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST16c.pcm_Unified_13200_16-16.tst +// stereo at 24.4 kbps, 16kHz in, 32kHz out, DTX on +../IVAS_cod -stereo -dtx 24400 16 testv/stvST16n.wav bit +../IVAS_dec STEREO 32 bit testv/stvST16n.wav_stereo_24400_16-32_DTX.tst -// unified stereo at 16.4 kbps, 16kHz in, 16kHz out -../IVAS_cod -stereo 16400 16 testv/stvST16c.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST16c.pcm_Unified_16400_16-16.tst +// stereo at 32 kbps, 16kHz in, 16kHz out, random FEC at 5%, DTX on +../IVAS_cod -stereo -dtx 32000 16 testv/stvST16n.wav bit +../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.wav_stereo_32000_16-16_FEC5_DTX.tst -// unified stereo at 24.4 kbps, 16kHz in, 16kHz out -../IVAS_cod -stereo 24400 16 testv/stvST16c.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST16c.pcm_Unified_24400_16-16.tst +// stereo at 32 kbps, 16kHz in, 48kHz out, MONO out, random FEC at 5% +../IVAS_cod -stereo 32000 16 testv/stvST16c.wav bit +../IVAS_dec -fec 5 MONO 48 bit testv/stvST16c.wav_stereo_32000_16-48_MONO_FEC5.tst -// unified stereo at 32 kbps, 16kHz in, 16kHz out -../IVAS_cod -stereo 32000 16 testv/stvST16c.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST16c.pcm_Unified_32000_16-16.tst +// stereo at 13.2 kbps, 32kHz in, 32kHz out +../IVAS_cod -stereo 13200 32 testv/stvST32c.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32c.wav_stereo_13200_32-32.tst -// unified stereo at 13.2 kbps, 16kHz in, 16kHz out, DTX on, MONO out -../IVAS_cod -stereo -dtx 13200 16 testv/stvST16n.pcm bit -../IVAS_dec MONO 16 bit testv/stvST16n.pcm_Unified_13200_16-16_DTX_MONO.tst +// stereo at 13.2 kbps, 32kHz in, 32kHz out, DTX on +../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32n.wav_stereo_13200_32-32_DTX.tst -// unified stereo at 16.4 kbps, 16kHz in, 16kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo -dtx 16400 16 testv/stvST16n.pcm bit -../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.pcm_Unified_16400_16-16_DTX_FEC5.tst +// stereo at 13.2 kbps, 32kHz in, 32kHz out, DTX on, random FEC at 5% +../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32n.wav_stereo_13200_32-32_DTX_FEC5.tst -// unified stereo at 24.4 kbps, 16kHz in, 16kHz out, DTX on, MONO out -../IVAS_cod -stereo -dtx 24400 16 testv/stvST16n.pcm bit -../IVAS_dec MONO 16 bit testv/stvST16n.pcm_Unified_24400_16-16_DTX_MONO.tst +// stereo at 13.2 kbps, 32kHz in, 32kHz out, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 MONO 32 bit testv/stvST32n.wav_stereo_13200_32-32_DTX_MONO_FEC5.tst -// unified stereo at 24.4 kbps, 16kHz in, 32kHz out, DTX on -../IVAS_cod -stereo -dtx 24400 16 testv/stvST16n.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST16n.pcm_Unified_24400_16-32_DTX.tst +// stereo at 13.2 kbps, 32kHz in, 16kHz out, DTX on, random FEC at 5% +../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 STEREO 16 bit testv/stvST32n.wav_stereo_13200_32-16_DTX_FEC5.tst -// unified stereo at 32 kbps, 16kHz in, 16kHz out, random FEC at 5%, DTX on -../IVAS_cod -stereo -dtx 32000 16 testv/stvST16n.pcm bit -../IVAS_dec -fec 5 STEREO 16 bit testv/stvST16n.pcm_Unified_32000_16-16_FEC5_DTX.tst +// stereo at 13.2 kbps, 32kHz in, 48kHz out, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 MONO 48 bit testv/stvST32n.wav_stereo_13200_32-48_DTX_MONO_FEC5.tst -// unified stereo at 32 kbps, 16kHz in, 48kHz out, MONO out, random FEC at 5% -../IVAS_cod -stereo 32000 16 testv/stvST16c.pcm bit -../IVAS_dec -fec 5 MONO 48 bit testv/stvST16c.pcm_Unified_32000_16-48_MONO_FEC5.tst +// stereo at 16.4 kbps, 32kHz in, 32kHz out +../IVAS_cod -stereo 16400 32 testv/stvST32c.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32c.wav_stereo_16400_32-32.tst -// unified stereo at 13.2 kbps, 32kHz in, 32kHz out -../IVAS_cod -stereo 13200 32 testv/stvST32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST32c.pcm_Unified_13200_32-32.tst +// stereo at 16.4 kbps, 32kHz in, 32kHz out, random FEC at 5% +../IVAS_cod -stereo 16400 32 testv/stvST32c.wav bit +../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32c.wav_stereo_16400_32-32_FEC5.tst -// unified stereo at 13.2 kbps, 32kHz in, 32kHz out, DTX on -../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST32n.pcm_Unified_13200_32-32_DTX.tst +// stereo at 16.4 kbps, 32kHz in, 16kHz out, random FEC at 5% +../IVAS_cod -stereo 16400 32 testv/stvST32c.wav bit +../IVAS_dec -fec 5 STEREO 16 bit testv/stvST32c.wav_stereo_16400_32-16_FEC5.tst -// unified stereo at 13.2 kbps, 32kHz in, 32kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32n.pcm_Unified_13200_32-32_DTX_FEC5.tst +// stereo at 16.4 kbps, 32kHz in, 16kHz out, MONO out, random FEC at 5% +../IVAS_cod -stereo 16400 32 testv/stvST32c.wav bit +../IVAS_dec -fec 5 MONO 16 bit testv/stvST32c.wav_stereo_16400_32-16_MONO_FEC5.tst -// unified stereo at 13.2 kbps, 32kHz in, 32kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 MONO 32 bit testv/stvST32n.pcm_Unified_13200_32-32_DTX_MONO_FEC5.tst +// stereo at 16.4 kbps, 32kHz in, 16kHz out, random FEC at 5%, DTX on +../IVAS_cod -stereo -dtx 16400 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 STEREO 16 bit testv/stvST32n.wav_stereo_16400_32-16_DTX_FEC5.tst -// unified stereo at 13.2 kbps, 32kHz in, 16kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 STEREO 16 bit testv/stvST32n.pcm_Unified_13200_32-16_DTX_FEC5.tst +// stereo at 16.4 kbps, 32kHz in, 48kHz out, random FEC at 5%, MONO out, DTX on +../IVAS_cod -stereo -dtx 16400 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 MONO 48 bit testv/stvST32n.wav_stereo_16400_32-48_DTX_MONO_FEC5.tst -// unified stereo at 13.2 kbps, 32kHz in, 48kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx 13200 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 MONO 48 bit testv/stvST32n.pcm_Unified_13200_32-48_DTX_MONO_FEC5.tst +// stereo at 24.4 kbps, 32kHz in, 32kHz out +../IVAS_cod -stereo 24400 32 testv/stvST32c.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32c.wav_stereo_24400_32-32.tst -// unified stereo at 16.4 kbps, 32kHz in, 32kHz out -../IVAS_cod -stereo 16400 32 testv/stvST32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST32c.pcm_Unified_16400_32-32.tst +// stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on +../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32n.wav_stereo_24400_32-32_DTX.tst -// unified stereo at 16.4 kbps, 32kHz in, 32kHz out, random FEC at 5% -../IVAS_cod -stereo 16400 32 testv/stvST32c.pcm bit -../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32c.pcm_Unified_16400_32-32_FEC5.tst +// stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on, MONO out +../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.wav bit +../IVAS_dec MONO 32 bit testv/stvST32n.wav_stereo_24400_32-32_DTX_MONO.tst -// unified stereo at 16.4 kbps, 32kHz in, 16kHz out, random FEC at 5% -../IVAS_cod -stereo 16400 32 testv/stvST32c.pcm bit -../IVAS_dec -fec 5 STEREO 16 bit testv/stvST32c.pcm_Unified_16400_32-16_FEC5.tst +// stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 MONO 32 bit testv/stvST32n.wav_stereo_24400_32-32_DTX_MONO_FEC5.tst -// unified stereo at 16.4 kbps, 32kHz in, 16kHz out, MONO out, random FEC at 5% -../IVAS_cod -stereo 16400 32 testv/stvST32c.pcm bit -../IVAS_dec -fec 5 MONO 16 bit testv/stvST32c.pcm_Unified_16400_32-16_MONO_FEC5.tst +// stereo at 24.4 kbps, 32kHz in, 16kHz out, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 MONO 16 bit testv/stvST32n.wav_stereo_24400_32-16_DTX_MONO_FEC5.tst -// unified stereo at 16.4 kbps, 32kHz in, 16kHz out, random FEC at 5%, DTX on -../IVAS_cod -stereo -dtx 16400 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 STEREO 16 bit testv/stvST32n.pcm_Unified_16400_32-16_DTX_FEC5.tst +// stereo at 24.4 kbps, 32kHz in, 48kHz out, DTX on, random FEC at 5% +../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 STEREO 48 bit testv/stvST32n.wav_stereo_24400_32-48_DTX_FEC5.tst -// unified stereo at 16.4 kbps, 32kHz in, 48kHz out, random FEC at 5%, MONO out, DTX on -../IVAS_cod -stereo -dtx 16400 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 MONO 48 bit testv/stvST32n.pcm_Unified_16400_32-48_DTX_MONO_FEC5.tst +// stereo at 32 kbps, 32kHz in, 32kHz out +../IVAS_cod -stereo 32000 32 testv/stvST32c.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32c.wav_stereo_32000_32-32.tst -// unified stereo at 24.4 kbps, 32kHz in, 32kHz out -../IVAS_cod -stereo 24400 32 testv/stvST32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST32c.pcm_Unified_24400_32-32.tst +// stereo at 32 kbps, 32kHz in, 32kHz out, random FEC at 5% +../IVAS_cod -stereo 32000 32 testv/stvST32c.wav bit +../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32c.wav_stereo_32000_32-32_FEC5.tst -// unified stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on -../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST32n.pcm_Unified_24400_32-32_DTX.tst +// stereo at 32 kbps, 32kHz in, 48kHz out, random FEC at 5% +../IVAS_cod -stereo 32000 32 testv/stvST32c.wav bit +../IVAS_dec -fec 5 STEREO 48 bit testv/stvST32c.wav_stereo_32000_32-48_FEC5.tst -// unified stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on, MONO out -../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.pcm bit -../IVAS_dec MONO 32 bit testv/stvST32n.pcm_Unified_24400_32-32_DTX_MONO.tst +// stereo at 32 kbps, 32kHz in, 32kHz out, MONO out, random FEC at 5% +../IVAS_cod -stereo 32000 32 testv/stvST32c.wav bit +../IVAS_dec -fec 5 MONO 32 bit testv/stvST32c.wav_stereo_32000_32-32_MONO_FEC5.tst -// unified stereo at 24.4 kbps, 32kHz in, 32kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 MONO 32 bit testv/stvST32n.pcm_Unified_24400_32-32_DTX_MONO_FEC5.tst +// stereo at 32 kbps, 32kHz in, 32kHz out, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 32000 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 MONO 32 bit testv/stvST32n.wav_stereo_32000_32-32_DTX_MONO_FEC5.tst -// unified stereo at 24.4 kbps, 32kHz in, 16kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 MONO 16 bit testv/stvST32n.pcm_Unified_24400_32-16_DTX_MONO_FEC5.tst +// stereo at 32 kbps, 32kHz in, 16kHz out, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 32000 32 testv/stvST32n.wav bit +../IVAS_dec -fec 5 MONO 16 bit testv/stvST32n.wav_stereo_32000_32-16_DTX_MONO_FEC5.tst -// unified stereo at 24.4 kbps, 32kHz in, 48kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo -dtx 24400 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 STEREO 48 bit testv/stvST32n.pcm_Unified_24400_32-48_DTX_FEC5.tst +// stereo at 32 kbps, 48kHz in, 48kHz out, bandwidth switching +../IVAS_cod -stereo -max_band testv/bwidth_cntl.txt 32000 48 testv/stvST48c.wav bit +../IVAS_dec STEREO 48 bit testv/stvST48c.wav_stereo_32000_48-48_bandwidth_sw.tst -// unified stereo at 32 kbps, 32kHz in, 32kHz out -../IVAS_cod -stereo 32000 32 testv/stvST32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST32c.pcm_Unified_32000_32-32.tst +// stereo at 32 kbps, 48kHz in, 32kHz out, random FEC at 6% +../IVAS_cod -stereo 32000 48 testv/stvST48c.wav bit +../IVAS_dec -fec testv/FEC_6pct.bin STEREO 32 bit testv/stvST48c.wav_stereo_32000_48-32_FEC5.tst -// unified stereo at 32 kbps, 32kHz in, 32kHz out, random FEC at 5% -../IVAS_cod -stereo 32000 32 testv/stvST32c.pcm bit -../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32c.pcm_Unified_32000_32-32_FEC5.tst +// stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, random FEC at 5% +../IVAS_cod -stereo -dtx 32000 48 testv/stvST48n.wav bit +../IVAS_dec -fec 5 STEREO 48 bit testv/stvST48n.wav_stereo_32000_48-48_DTX_FEC5.tst -// unified stereo at 32 kbps, 32kHz in, 48kHz out, random FEC at 5% -../IVAS_cod -stereo 32000 32 testv/stvST32c.pcm bit -../IVAS_dec -fec 5 STEREO 48 bit testv/stvST32c.pcm_Unified_32000_32-48_FEC5.tst +// stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 32000 48 testv/stvST48n.wav bit +../IVAS_dec -fec 5 MONO 48 bit testv/stvST48n.wav_stereo_32000_48-48_DTX_MONO_FEC5.tst -// unified stereo at 32 kbps, 32kHz in, 32kHz out, MONO out, random FEC at 5% -../IVAS_cod -stereo 32000 32 testv/stvST32c.pcm bit -../IVAS_dec -fec 5 MONO 32 bit testv/stvST32c.pcm_Unified_32000_32-32_MONO_FEC5.tst +// stereo at 32 kbps, 48kHz in, 16kHz out, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 32000 48 testv/stvST48n.wav bit +../IVAS_dec -fec 5 MONO 16 bit testv/stvST48n.wav_stereo_32000_48-16_DTX_MONO_FEC5.tst -// unified stereo at 32 kbps, 32kHz in, 32kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx 32000 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 MONO 32 bit testv/stvST32n.pcm_Unified_32000_32-32_DTX_MONO_FEC5.tst +// stereo at 48 kbps, 16kHz in, 16kHz out +../IVAS_cod -stereo 48000 16 testv/stvST16c.wav bit +../IVAS_dec STEREO 16 bit testv/stvST16c.wav_stereo_48000_16-16.tst -// unified stereo at 32 kbps, 32kHz in, 16kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx 32000 32 testv/stvST32n.pcm bit -../IVAS_dec -fec 5 MONO 16 bit testv/stvST32n.pcm_Unified_32000_32-16_DTX_MONO_FEC5.tst +// stereo at 64 kbps, 16kHz in, 16kHz out, random FEC at 10% +../IVAS_cod -stereo 64000 16 testv/stvST16c.wav bit +../IVAS_dec -fec 10 STEREO 16 bit testv/stvST16c.wav_stereo_64000_16-16_FEC10.tst -// unified stereo at 32 kbps, 48kHz in, 48kHz out, bandwidth switching -../IVAS_cod -stereo -max_band testv/bwidth_cntl.txt 32000 48 testv/stvST48c.pcm bit -../IVAS_dec STEREO 48 bit testv/stvST48c.pcm_Unified_32000_48-48_bandwidth_sw.tst +// stereo at 96 kbps, 16kHz in, 16kHz out +../IVAS_cod -stereo 96000 16 testv/stvST16c.wav bit +../IVAS_dec STEREO 16 bit testv/stvST16c.wav_stereo_96000_16-16.tst -// unified stereo at 32 kbps, 48kHz in, 32kHz out, random FEC at 6% -../IVAS_cod -stereo -max_band FB 32000 48 testv/stvST48c.pcm bit -../IVAS_dec -fec testv/FEC_6pct.bin STEREO 32 bit testv/stvST48c.pcm_Unified_32000_48-32_FEC5.tst +// stereo at 128 kbps, 16kHz in, 16kHz out, random FEC at 10% +../IVAS_cod -stereo 128000 16 testv/stvST16c.wav bit +../IVAS_dec -fec 10 STEREO 16 bit testv/stvST16c.wav_stereo_128000_16-16_FEC10.tst -// unified stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, random FEC at 5% -../IVAS_cod -stereo -dtx -max_band FB 32000 48 testv/stvST48n.pcm bit -../IVAS_dec -fec 5 STEREO 48 bit testv/stvST48n.pcm_Unified_32000_48-48_DTX_FEC5.tst +// stereo at 48 kbps, 32kHz in, 32kHz out, random FEC at 5% +../IVAS_cod -stereo 48000 32 testv/stvST32c.wav bit +../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32c.wav_stereo_48000_32-32_FEC5.tst -// unified stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx -max_band FB 32000 48 testv/stvST48n.pcm bit -../IVAS_dec -fec 5 MONO 48 bit testv/stvST48n.pcm_Unified_32000_48-48_DTX_MONO_FEC5.tst +// stereo at 64 kbps, 32kHz in, 32kHz out +../IVAS_cod -stereo 64000 32 testv/stvST32c.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32c.wav_stereo_64000_32-32.tst -// unified stereo at 32 kbps, 48kHz in, 16kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx -max_band FB 32000 48 testv/stvST48n.pcm bit -../IVAS_dec -fec 5 MONO 16 bit testv/stvST48n.pcm_Unified_32000_48-16_DTX_MONO_FEC5.tst +// stereo at 96 kbps, 32kHz in, 32kHz out, random FEC at 5% +../IVAS_cod -stereo 96000 32 testv/stvST32c.wav bit +../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32c.wav_stereo_96000_32-32_FEC5.tst +// stereo at 128 kbps, 32kHz in, 32kHz out +../IVAS_cod -stereo 128000 32 testv/stvST32c.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32c.wav_stereo_128000_32-32.tst -// MDCT stereo at 48 kbps, 16kHz in, 16kHz out -../IVAS_cod -stereo 48000 16 testv/stvST16c.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST16c.pcm_MDCT_48000_16-16.tst +// stereo at 48 kbps, 32kHz in, 32kHz out, MONO out +../IVAS_cod -stereo 48000 32 testv/stvST32c.wav bit +../IVAS_dec MONO 32 bit testv/stvST32c.wav_stereo_48000_32-32_MONO.tst -// MDCT stereo at 64 kbps, 16kHz in, 16kHz out, random FEC at 10% -../IVAS_cod -stereo 64000 16 testv/stvST16c.pcm bit -../IVAS_dec -fec 10 STEREO 16 bit testv/stvST16c.pcm_MDCT_64000_16-16_FEC10.tst +// stereo at 128 kbps, 48kHz in, 48kHz out, MONO out +../IVAS_cod -stereo 128000 48 testv/stvST48c.wav bit +../IVAS_dec MONO 48 bit testv/stvST48c.wav_stereo_128000_48-48_MONO.tst -// MDCT stereo at 96 kbps, 16kHz in, 16kHz out -../IVAS_cod -stereo 96000 16 testv/stvST16c.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST16c.pcm_MDCT_96000_16-16.tst +// stereo at 48 kbps, 48 kHz in, 48 kHz out, DTX on +../IVAS_cod -stereo -dtx 48000 48 testv/stvST48n.wav bit +../IVAS_dec STEREO 48 bit testv/stvST48n.wav_stereo_48000_48-48_DTX.tst -// MDCT stereo at 128 kbps, 16kHz in, 16kHz out, random FEC at 10% -../IVAS_cod -stereo 128000 16 testv/stvST16c.pcm bit -../IVAS_dec -fec 10 STEREO 16 bit testv/stvST16c.pcm_MDCT_128000_16-16_FEC10.tst +// stereo at 48 kbps, 32 kHz in, 32 kHz out, DTX on +../IVAS_cod -stereo -dtx 48000 32 testv/stvST32n.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32n.wav_stereo_48000_32-32_DTX.tst -// MDCT stereo at 48 kbps, 32kHz in, 32kHz out, random FEC at 5% -../IVAS_cod -stereo 48000 32 testv/stvST32c.pcm bit -../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32c.pcm_MDCT_48000_32-32_FEC5.tst +// stereo at 48 kbps, 16 kHz in, 16 kHz out, DTX on +../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.wav bit +../IVAS_dec STEREO 16 bit testv/stvST16n.wav_stereo_48000_16-16_DTX.tst -// MDCT stereo at 64 kbps, 32kHz in, 32kHz out -../IVAS_cod -stereo 64000 32 testv/stvST32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST32c.pcm_MDCT_64000_32-32.tst +// stereo at 48 kbps, 48 kHz in, 48 kHz out, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 48000 48 testv/stvST48n.wav bit +../IVAS_dec -fec 5 MONO 48 bit testv/stvST48n.wav_stereo_48000_48-48_DTX_MONO_FEC5.tst -// MDCT stereo at 96 kbps, 32kHz in, 32kHz out, random FEC at 5% -../IVAS_cod -stereo 96000 32 testv/stvST32c.pcm bit -../IVAS_dec -fec 5 STEREO 32 bit testv/stvST32c.pcm_MDCT_96000_32-32_FEC5.tst +// stereo at 48 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out +../IVAS_cod -stereo -dtx 48000 32 testv/stvST32n.wav bit +../IVAS_dec MONO 32 bit testv/stvST32n.wav_stereo_48000_32-32_DTX_MONO.tst -// MDCT stereo at 128 kbps, 32kHz in, 32kHz out -../IVAS_cod -stereo 128000 32 testv/stvST32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST32c.pcm_MDCT_128000_32-32.tst +// stereo at 48 kbps, 16 kHz in, 16 kHz, DTX on, MONO out, random FEC at 5% +../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.wav bit +../IVAS_dec -fec 5 MONO 16 bit testv/stvST16n.wav_stereo_48000_16-16_DTX_MONO_FEC5.tst -// MDCT stereo at 48 kbps, 32kHz in, 32kHz out, MONO out -../IVAS_cod -stereo 48000 32 testv/stvST32c.pcm bit -../IVAS_dec MONO 32 bit testv/stvST32c.pcm_MDCT_48000_32-32_MONO.tst +// stereo bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out +../IVAS_cod -stereo ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stvST32c.wav bit +../IVAS_dec STEREO 32 bit testv/stvST32c.wav_stereo_sw_32-32.tst -// MDCT stereo at 128 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -stereo 128000 48 testv/stvST48c.pcm bit -../IVAS_dec MONO 48 bit testv/stvST32c.pcm_MDCT_128000_48-48_MONO.tst +// stereo bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, DTX on, MONO out +//../IVAS_cod -dtx -stereo ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stvST48n.wav bit +//../IVAS_dec MONO 48 bit testv/stvST48n.wav_stereo_sw_48-48_DTX_MONO.tst -// MDCT stereo at 48 kbps, 48 kHz in, 48 kHz out, DTX on -../IVAS_cod -stereo -dtx 48000 48 testv/stvST48n.pcm bit -../IVAS_dec STEREO 48 bit testv/stvST48n.pcm_MDCT_48000_48-48_DTX.tst -// MDCT stereo at 48 kbps, 32 kHz in, 32 kHz out, DTX on -../IVAS_cod -stereo -dtx 48000 32 testv/stvST32n.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST32n.pcm_MDCT_48000_32-32_DTX.tst -// MDCT stereo at 48 kbps, 16 kHz in, 16 kHz out, DTX on -../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.pcm bit -../IVAS_dec STEREO 16 bit testv/stvST16n.pcm_MDCT_48000_16-16_DTX.tst +// 1 ISM with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, MONO out +../IVAS_cod -ism 1 testv/stvISM1.csv 13200 48 testv/stv1ISM48s.wav bit +../IVAS_dec MONO 48 bit testv/stv1ISM48s.wav_13200_48-48_MONO.tst -// MDCT stereo at 48 kbps, 48 kHz in, 48 kHz out, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx 48000 48 testv/stvST48n.pcm bit -../IVAS_dec -fec 5 MONO 48 bit testv/stvST48n.pcm_MDCT_48000_48-48_DTX_MONO_FEC5.tst +// 1 ISM with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out, random FEC at 5% +../IVAS_cod -dtx -ism 1 testv/stvISM1.csv 13200 48 testv/stv48n.wav bit +../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv48n.wav_13200_48-48_DTX_FEC5_BINAURAL.tst -// MDCT stereo at 48 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out -../IVAS_cod -stereo -dtx 48000 32 testv/stvST32n.pcm bit -../IVAS_dec MONO 32 bit testv/stvST32n.pcm_MDCT_48000_32-32_DTX_MONO.tst +// 2 ISM with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, STEREO out +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.wav bit +../IVAS_dec STEREO 48 bit testv/stv2ISM48s.wav_16400_48-48_STEREO.tst -// MDCT stereo at 48 kbps, 16 kHz in, 16 kHz, DTX on, MONO out, random FEC at 5% -../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.pcm bit -../IVAS_dec -fec 5 MONO 16 bit testv/stvST16n.pcm_MDCT_48000_16-16_DTX_MONO_FEC5.tst +// 2 ISM with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv2ISM48s.wav_16400_48-48_binaural.tst -// stereo bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out -../IVAS_cod -stereo ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stvST32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stvST48c.pcm_stereo_sw_32-32.tst +// 1 ISM with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out +../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1ISM48s.wav_16400_48-48_binaural_room.tst -// stereo bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, DTX on, MONO out -//../IVAS_cod -dtx -stereo ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stvST48n.pcm bit -//../IVAS_dec MONO 48 bit testv/stvST48n.pcm_stereo_sw_48-48_DTX_MONO.tst +// 3 ISM with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, 7_1 out +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit +../IVAS_dec 7_1 48 bit testv/stv3ISM48s.wav_24400_48-48_7_1.tst + +// 3 ISM with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, MONO out, random FEC at 5% +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit +../IVAS_dec -fec 5 MONO 48 bit testv/stv3ISM48s.wav_24400_48-48_MONO_FEC5.tst -// 1 ISm with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, MONO out -../IVAS_cod -ism 1 testv/stvISM1.csv 13200 48 testv/stv1ISM48s.pcm bit -../IVAS_dec MONO 48 bit testv/stv1ISM48s.pcm_13200_48-48_MONO.tst +// 3 ISM with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv3ISM48s.wav_24400_48-48_binaural.tst -// 1 ISm with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out, random FEC at 5% -../IVAS_cod -dtx -ism 1 testv/stvISM1.csv 13200 48 testv/stv48n.pcm bit -../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv48n.pcm_13200_48-48_DTX_FEC5_BINAURAL.tst +// 1 ISM with metadata at 32 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out +../IVAS_cod -dtx -ism 1 testv/stvISM1.csv 32000 32 testv/stv32n.wav bit +../IVAS_dec MONO 32 bit testv/stv32n.wav_32000_32-32_DTX_MONO.tst -// 2 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.pcm bit -../IVAS_dec STEREO 48 bit testv/stv2ISM48s.pcm_16400_48-48_STEREO.tst +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, FOA out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit +../IVAS_dec FOA 48 bit testv/stv4ISM48s.wav_32000_48-48_FOA.tst -// 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, 7_1 out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.pcm bit -../IVAS_dec 7_1 48 bit testv/stv3ISM48s.pcm_24400_48-48_7_1.tst +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, STEREO out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit +../IVAS_dec STEREO 48 bit testv/stv4ISM48s.wav_32000_48-48_STEREO.tst -// 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, MONO out, random FEC at 5% -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.pcm bit -../IVAS_dec -fec 5 MONO 48 bit testv/stv3ISM48s.pcm_24400_48-48_MONO_FEC5.tst +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_32000_48-48_binaural.tst -// 1 ISm with metadata at 32 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out -../IVAS_cod -dtx -ism 1 testv/stvISM1.csv 32000 32 testv/stv32n.pcm bit -../IVAS_dec MONO 32 bit testv/stv32n.pcm_32000_32-32_DTX_MONO.tst +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out +../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48n.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv4ISM48n.wav_32000_48-48_DTX_BINAURAL.tst -// 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, FOA out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec FOA 48 bit testv/stv4ISM48s.pcm_32000_48-48_FOA.tst +// 2 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, DTX on, HOA2 out +../IVAS_cod -dtx -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stvST48c.wav bit +../IVAS_dec HOA2 48 bit testv/stv2ST48c.wav_32000_48-48_DTX_HOA2.tst -// 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec STEREO 48 bit testv/stv4ISM48s.pcm_32000_48-48_STEREO.tst +// 2 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, EXTERNAL out +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stv2ISM48s.wav bit +../IVAS_dec EXT 48 bit testv/stv2ISM48s.wav_32000_48-48_external.tst -// 3 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, MONO out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.pcm bit +// 4 ISM with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, random FEC at 5% +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stv4ISM48s.wav_32000_48-48_binaural_room_FEC5.tst + +// 3 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, MONO out +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.wav bit ../IVAS_dec MONO 48 bit testv/stv43ISM48s_48000_48-48_MONO.tst -// 2 ISm with metadata at 64 kbps, 48 kHz in, 32 kHz out, 5_1 out -../IVAS_cod -max_band FB -ism 2 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stv2ISM48s.pcm bit -../IVAS_dec 5_1 32 bit testv/stv2ISM48s.pcm_64000_48-32_5_1.tst +// 4 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL ROOM out, random FEC at 5% +../IVAS_cod -dtx -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv4ISM48n.wav bit +../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stv4ISM48n.wav_48000_48-48_DTX_TD_binaural_room_FEC5.tst + +// 2 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL out, random FEC at 5% +../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv2ISM48s.wav bit +../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv2ISM48s.wav_48000_48-48_binaural_FEC5.tst + +// 1 ISM with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, head rotation, random FEC at 5% +../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.wav bit +../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv1ISM48s.wav_64000_48-48_binaural_room_HR.tst + +// 2 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out +../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2ISM48s.wav_64000_48-48_binaural_room.tst -// 4 ISm with metadata at 80 kbps, 48 kHz in, 48 kHz out, HOA2 out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec HOA2 48 bit testv/stv4ISM48s.pcm_80000_48-48_HOA2.tst +// 2 ISM with metadata at 64 kbps, 48 kHz in, 32 kHz out, 5_1 out +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stv2ISM48s.wav bit +../IVAS_dec 5_1 32 bit testv/stv2ISM48s.wav_64000_48-32_5_1.tst -// 4 ISm with metadata at 96 kbps, 48 kHz in, 48 kHz out, Custom LS setup out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv4ISM48s.pcm_96000_48-48_MC_custom_setup.tst +// 4 ISM with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv4ISM48s.wav_64000_48-48_binaural_room.tst -// 3 ISm with metadata at 128 kbps, 48 kHz in, 32 kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -max_band FB -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stv3ISM48s.pcm bit -../IVAS_dec -fec 5 HOA3 32 bit testv/stv3ISM48s.pcm_128000_48-32_HOA3_FEC5.tst +// 2 ISM with metadata at 80 kbps, 48 kHz in, 48 kHz out, DTX on, stereo out +../IVAS_cod -dtx -ism 2 testv/stvISM1.csv testv/stvISM2.csv 80000 48 testv/stvST48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv2ST48c.wav_80000_48-48_DTX_STEREO.tst -// 4 ISm with metadata at 160 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec STEREO 48 bit testv/stv4ISM48s.pcm_160000_48-48_STEREO.tst +// 4 ISM with metadata at 80 kbps, 48 kHz in, 48 kHz out, HOA2 out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.wav bit +../IVAS_dec HOA2 48 bit testv/stv4ISM48s.wav_80000_48-48_HOA2.tst -// 2 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv2ISM48s.pcm_16400_48-48_binaural.tst +// 1 ISM with metadata at 80 kbps, 48 kHz in, 16 kHz out, BINAURAL out (Model from file), head rotation, random FEC at 5% +../IVAS_cod -ism 1 testv/stvISM1.csv 80000 48 testv/stv1ISM48s.wav bit +../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.wav_80000_48-16_binaural_file_TDHR_FEC5.tst -// 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv3ISM48s.pcm_24400_48-48_binaural.tst +// 4 ISM with metadata at 96 kbps, 48 kHz in, 48 kHz out, Custom LS setup out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.wav bit +../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv4ISM48s.wav_96000_48-48_MC_custom_setup.tst -// 2 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv2ISM48s.pcm bit -../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv2ISM48s.pcm_48000_48-48_binaural_FEC5.tst +// 1 ISM with metadata at 96 kbps, 48 kHz in, 16 kHz out, BINAURAL out (Model from file) +../IVAS_cod -ism 1 testv/stvISM1.csv 96000 48 testv/stv1ISM48s.wav bit +../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.wav_96000_48-16_binaural.tst -// 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.pcm_32000_48-48_binaural.tst +// 3 ISM with metadata at 128 kbps, 48 kHz in, 32 kHz out, HOA3 out, random FEC at 5% +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stv3ISM48s.wav bit +../IVAS_dec -fec 5 HOA3 32 bit testv/stv3ISM48s.wav_128000_48-32_HOA3_FEC5.tst -// 1 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1ISM48s.pcm_16400_48-48_binaural_room.tst +// 2 ISM with metadata at 128 kbps, 48 kHz in, 32 kHz out, BINAURAL out (Model from file), head rotation +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 128000 48 testv/stv2ISM48s.wav bit +../IVAS_dec -t testv/headrot_case01_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL 32 bit testv/stv2ISM48s.wav_128000_48-32_binaural_file_TDHR.tst -// 2 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, EXTERNAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stv2ISM48s.pcm bit -../IVAS_dec EXT 48 bit testv/stv2ISM48s.pcm_32000_48-48_external.tst +// 4 ISM with metadata at 160 kbps, 48 kHz in, 48 kHz out, STEREO out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.wav bit +../IVAS_dec STEREO 48 bit testv/stv4ISM48s.wav_160000_48-48_STEREO.tst -// 2 ISm with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2ISM48s.pcm_64000_48-48_binaural_room.tst +// 2 ISM with metadata at 160 kbps, 48 kHz in, 32 kHz out, BINAURAL out +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 160000 48 testv/stv2ISM48s.wav bit +../IVAS_dec BINAURAL 32 bit testv/stv2ISM48s.wav_160000_48-32_binaural.tst -// 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, random FEC at 5% -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stv4ISM48s.pcm_32000_48-48_binaural_room_FEC5.tst +// 3 ISM with metadata at 192 kbps, 48 kHz in, 48 kHz out, BINAURAL out (Model from file) +../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.wav bit +../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 bit testv/stv3ISM48s.wav_192000_48-48_binaural)file.tst -// 4 ISm with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv4ISM48s.pcm_64000_48-48_binaural_room.tst +// 3 ISM with metadata at 192 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation, random FEC at 5% +../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.wav bit +../IVAS_dec -fec 5 -t testv/headrot_case02_3000_q.csv BINAURAL 48 bit testv/stv3ISM48s.wav_192000_48-48_binaural_file_TDHR_FEC5.tst -// 1 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, head rotation, random FEC at 5% -../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.pcm bit -../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv1ISM48s.pcm_64000_48-48_binaural_room_HR.tst +// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural.tst -// 1 ISm with metadata at 96 kbps, 48 kHz in, 16 kHz out, TD BINAURAL out (Model from file) -../IVAS_cod -ism 1 testv/stvISM1.csv 96000 48 testv/stv1ISM48s.pcm bit -../IVAS_dec -hrtf ../scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.pcm_96000_48-16_TD_binaural.tst +// 4 ISM with metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.wav_256000_48-48_binaural_file_TDHR.tst -// 2 ISm with metadata at 160 kbps, 48 kHz in, 32 kHz out, TD BINAURAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 160000 48 testv/stv2ISM48s.pcm bit -../IVAS_dec BINAURAL 32 bit testv/stv2ISM48s.pcm_160000_48-32_TD_binaural.tst +// 3 ISM with metadata at 384 kbps, 48 kHz in, 32 kHz out, 7_1_4 out +../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 384000 48 testv/stv3ISM48s.wav bit +../IVAS_dec 7_1_4 32 bit testv/stv3ISM48s.wav_384000_48-32_7_1_4.tst -// 3 ISm with metadata at 192 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out (Model from file) -../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.pcm bit -../IVAS_dec -hrtf ../scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_48kHz.bin BINAURAL 48 bit testv/stv3ISM48s.pcm_192000_48-48_TD_binaural.tst +// 4 ISM with metadata at 512 kbps, 48 kHz in, 48 kHz out, 5_1 +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 512000 48 testv/stv4ISM48s.wav bit +../IVAS_dec 5_1 48 bit testv/stv4ISM48s.wav_512000_48-48_5_1.tst -// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TD_binaural.tst +// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, Orientation tracking +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR_OtrAvg.tst -// 1 ISm with metadata at 80 kbps, 48 kHz in, 16 kHz out, TD BINAURAL out (Model from file), head rotation, random FEC at 5% -../IVAS_cod -ism 1 testv/stvISM1.csv 80000 48 testv/stv1ISM48s.pcm bit -../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv -hrtf ../scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.pcm_80000_48-16_TDHR_FEC5.tst +// 1 ISM with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on +../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.wav bit +../IVAS_dec MONO 32 bit testv/stv32c.wav_brate_sw_32-32_mono_dtx.tst -// 2 ISm with metadata at 128 kbps, 48 kHz in, 32 kHz out, TD BINAURAL out (Model from file), head rotation -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 128000 48 testv/stv2ISM48s.pcm bit -../IVAS_dec -t testv/headrot_case01_3000_q.csv -hrtf ../scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_32kHz.bin BINAURAL 32 bit testv/stv2ISM48s.pcm_128000_48-32_TDHR.tst +// 4 ISM with metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_binaural.tst -// 3 ISm with metadata at 192 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, random FEC at 5% -../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.pcm bit -../IVAS_dec -fec 5 -t testv/headrot_case02_3000_q.csv BINAURAL 48 bit testv/stv3ISM48s.pcm_192000_48-48_TDHR_FEC5.tst +// 4 ISm with and without metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, DTX on, HOA3 out +../IVAS_cod -dtx -ism 4 testv/stvISM1.csv NULL NULL testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit +../IVAS_dec HOA3 48 bit testv/stv4ISM48s.wav_brate_sw_48-48_DTX_hoa3.tst -// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit -../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR.tst -// 1 ISm with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on -../IVAS_cod -dtx -ism 1 testv/stvISM1.csv ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv32c.pcm bit -../IVAS_dec MONO 32 bit testv/stv32c.pcm_brate_sw_32-32_mono_dtx.tst +// 4 ISM with extended metadata at 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out, head rotation, directivity configuration, random FEC at 5% +../IVAS_cod -ism +4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit +../IVAS_dec -fec 5 -render_config testv/config_directivity.cfg -t testv/headrot_case04_3000_q.csv BINAURAL 48 bit testv/stv+4ISM48s.wav_256000_48-48_binaural_file_TDHR_DirConfig_FEC5.tst + +// 4 ISM with and without extended metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out +../IVAS_cod -dtx -ism +4 testv/stvISM1.csv NULL testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv+4ISM48s.wav_brate_sw_48-48_DTX_binaural.tst -// 4 ISm with metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.pcm_brate_sw_48-48_BINAURAL.tst // SBA at 13.2 kbps, 32kHz in, 32kHz out, HOA3 out -../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.pcm bit -../IVAS_dec HOA3 32 bit testv/stv3OA32c.pcm_SBA_13200_32-32_HOA3.tst +../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.wav bit +../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_13200_32-32_HOA3.tst // SBA at 13.2 kbps, 32kHz in, 32kHz out, STEREO out -../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stv3OA32c.pcm_SBA_13200_32-32_stereo.tst +../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.wav bit +../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_13200_32-32_stereo.tst // SBA at 16.4 kbps, 32kHz in, 32kHz out, 7_1_4 out -../IVAS_cod -sba 3 16400 32 testv/stv3OA32c.pcm bit -../IVAS_dec 7_1_4 32 bit testv/stv3OA32c.pcm_SBA_16400_32-32_7_1_4.tst +../IVAS_cod -sba 3 16400 32 testv/stv3OA32c.wav bit +../IVAS_dec 7_1_4 32 bit testv/stv3OA32c.wav_SBA_16400_32-32_7_1_4.tst // SBA at 16.4 kbps, 32kHz in, 32kHz out, BINAURAL out -../IVAS_cod -sba 3 16400 32 testv/stv3OA32c.pcm bit -../IVAS_dec BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_16400_32-32_Binaural.tst +../IVAS_cod -sba 3 16400 32 testv/stv3OA32c.wav bit +../IVAS_dec BINAURAL 32 bit testv/stv3OA32c.wav_SBA_16400_32-32_Binaural.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, STEREO out -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_stereo.tst +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_stereo.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit -../IVAS_dec BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural.tst +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural.tst -// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Subframe, random FEC at 5% -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit -../IVAS_dec -fec 5 -force_subframe_bin BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Subframe_FEC5.tst +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, random FEC at 5% +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Subframe_FEC5.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation -../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot.tst +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_Binaural_Headrot.tst + +// SBA at 24.4 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_Binaural_Headrot_OtrAvg.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% -../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.pcm bit -../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_DTX_Binaural_FEC5.tst +../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_FEC5.tst // SBA at 24.4 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation -../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_24400_32-32_DTX_Binaural_Headrot.tst +../IVAS_cod -sba 3 -dtx 24400 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_24400_32-32_DTX_Binaural_Headrot.tst // SBA at 32 kbps, 32kHz in, 32kHz out, FOA out -../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.pcm bit -../IVAS_dec FOA 32 bit testv/stvFOA32c.pcm_SBA_32000_32-32_FOA.tst +../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit +../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_FOA.tst // SBA at 32 kbps, 32kHz in, 32kHz out, BINAURAL out, 6% FEC pattern -../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.pcm bit -../IVAS_dec -fec testv/FEC_6pct.bin BINAURAL 32 bit testv/stvFOA32c.pcm_SBA_32000_32-32_BINAURAL_FEC6.tst +../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit +../IVAS_dec -fec testv/FEC_6pct.bin BINAURAL 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_BINAURAL_FEC6.tst // SBA at 32 kbps, 32kHz in, 32kHz out, BINAURAL_ROOM out -../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.pcm bit -../IVAS_dec BINAURAL_ROOM 32 bit testv/stvFOA32c.pcm_SBA_32000_32-32_BINAURAL_ROOM.tst +../IVAS_cod -sba 1 32000 32 testv/stvFOA32c.wav bit +../IVAS_dec BINAURAL_ROOM 32 bit testv/stvFOA32c.wav_SBA_32000_32-32_BINAURAL_ROOM.tst // SBA at 32 kbps, 48kHz in, 48kHz out, MONO out, DTX -../IVAS_cod -dtx -sba 1 32000 48 testv/stvFOA48c.pcm bit -../IVAS_dec MONO 48 bit testv/stvFOA48c.pcm_SBA_32000_48-48_DTX_MONO.tst +../IVAS_cod -dtx -sba 1 32000 48 testv/stvFOA48c.wav bit +../IVAS_dec MONO 48 bit testv/stvFOA48c.wav_SBA_32000_48-48_DTX_MONO.tst // SBA at 48 kbps, 32kHz in, 32kHz out, MONO out, random FEC at 5% -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -fec 5 MONO 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_MONO_FEC5.tst +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 MONO 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_MONO_FEC5.tst // SBA at 48 kbps, 32kHz in, 32kHz out, STEREO out -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_stereo.tst +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec STEREO 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_stereo.tst // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom.tst +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom.tst -// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Subframe -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Subframe.tst +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Subframe.tst // SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot.tst +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_BinauralRoom_Headrot.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrAvg.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t ../scripts/trajectories/full-circle-4s.csv -rvf ../scripts/trajectories/full-circle-4s-Vector3.csv -otr ref_vec BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPos.tst + +// SBA at 48 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, reference vector tracking in level mode +../IVAS_cod -sba 3 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t ../scripts/trajectories/full-circle-with-up-and-down-4s.csv -rvf ../scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv -otr ref_vec_lev BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_BinauralRoom_Headrot_OtrRefPosLev.tst // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, random FEC at 5% -../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_DTX_Binaural_FEC5.tst +../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_FEC5.tst // SBA at 48 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out, DTX on, Headrotation -../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_48000_32-32_DTX_Binaural_Headrot.tst +../IVAS_cod -sba 3 -dtx 48000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_48000_32-32_DTX_Binaural_Headrot.tst // SBA at 48 kbps, 48kHz in, 48kHz out, 5_1_2 out -../IVAS_cod -sba 3 48000 48 testv/stv3OA32c.pcm bit -../IVAS_dec 5_1_2 48 bit testv/stv3OA32c.pcm_SBA_48000_48-48_5_1_2.tst +../IVAS_cod -sba 3 48000 48 testv/stv3OA48c.wav bit +../IVAS_dec 5_1_2 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_5_1_2.tst // SBA at 64 kbps, 32kHz in, 32kHz out, FOA out, DTX, random FEC at 5% -../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c.pcm bit -../IVAS_dec -fec 5 FOA 32 bit testv/stvFOA32c.pcm_SBA_64000_32-32_DTX_FOA.tst +../IVAS_cod -dtx -sba 1 64000 32 testv/stvFOA32c.wav bit +../IVAS_dec -fec 5 FOA 32 bit testv/stvFOA32c.wav_SBA_64000_32-32_DTX_FOA.tst // SBA at 64 kbps, 48kHz in, 48kHz out, 5_1_4 out -../IVAS_cod -max_band FB -sba 1 64000 48 testv/stvFOA48c.pcm bit -../IVAS_dec 5_1_4 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_5_1_4.tst +../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit +../IVAS_dec 5_1_4 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_5_1_4.tst // SBA at 64 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_7_1_4.tst +../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit +../IVAS_dec 7_1_4 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_7_1_4.tst // SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_DTX_BINAURAL.tst +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_DTX_BINAURAL.tst // SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL_ROOM out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_DTX_BINAURAL_ROOM.tst +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stvFOA48c.wav_SBA_64000_48-48_DTX_BINAURAL_ROOM.tst // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out -../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.pcm bit -../IVAS_dec HOA3 32 bit testv/stv3OA32c.pcm_SBA_80000_32-32_HOA3.tst +../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit +../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_HOA3.tst // SBA at 80 kbps, 32kHz in, 32kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_80000_32-32_Binaural_FEC5.tst +../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit +../IVAS_dec -fec 5 BINAURAL 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_Binaural_FEC5.tst // SBA at 80 kbps, 32kHz in, 32kHz out, BINAURAL out, Headrotation -../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.pcm_SBA_80000_32-32_Binaural_Headrot.tst +../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 32 bit testv/stv3OA32c.wav_SBA_80000_32-32_Binaural_Headrot.tst // SBA at 96 kbps, 32kHz in, 32kHz out, STEREO out -../IVAS_cod -sba 1 96000 32 testv/stvFOA32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stvFOA32c.pcm_SBA_96000_32-32_STEREO.tst +../IVAS_cod -sba 1 96000 32 testv/stvFOA32c.wav bit +../IVAS_dec STEREO 32 bit testv/stvFOA32c.wav_SBA_96000_32-32_STEREO.tst // SBA at 96 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.pcm bit -../IVAS_dec FOA 48 bit testv/stvFOA48c.pcm_SBA_96000_48-48_FOA.tst +../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.wav bit +../IVAS_dec FOA 48 bit testv/stvFOA48c.wav_SBA_96000_48-48_FOA.tst // SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.pcm bit -../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot.tst +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.wav_SBA_128000_32-32_Binaural_room_Headrot.tst + +// SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -sba 3 128000 32 testv/stv3OA32c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot_OtrAvg.tst // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% -../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.pcm bit -../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.pcm_SBA_192000_48-48_HOA2_FEC5.tst +../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.wav bit +../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.wav_SBA_192000_48-48_HOA2_FEC5.tst // SBA at 48 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.pcm bit -../IVAS_dec 5_1 48 bit testv/stv3OA48c.pcm_SBA_48000_48-48_DTX_5_1.tst +../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv3OA48c.wav_SBA_48000_48-48_DTX_5_1.tst // SBA at 160 kbps, 32kHz in, 32kHz out, FOA out -../IVAS_cod -sba 1 160000 32 testv/stvFOA32c.pcm bit -../IVAS_dec FOA 32 bit testv/stvFOA32c.pcm_SBA_160000_32-32_FOA.tst +../IVAS_cod -sba 1 160000 32 testv/stvFOA32c.wav bit +../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_SBA_160000_32-32_FOA.tst // SBA at 160 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out, random FEC at 5% -../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.pcm bit -../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stvFOA48c.pcm_SBA_160000_48-48_BINAURAL_ROOM_FEC5.tst +../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.wav bit +../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stvFOA48c.wav_SBA_160000_48-48_BINAURAL_ROOM_FEC5.tst // SBA at 160 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.pcm bit -../IVAS_dec 5_1 48 bit testv/stvFOA48c.pcm_SBA_160000_48-48_5_1.tst +../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.wav bit +../IVAS_dec 5_1 48 bit testv/stvFOA48c.wav_SBA_160000_48-48_5_1.tst // SBA at 192 kbps, 48kHz in, 48kHz out, Custom LS setup out -../IVAS_cod -sba 1 192000 48 testv/stvFOA48c.pcm bit -../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stvFOA48c.pcm_SBA_192000_48-48_MC_custom_setup.tst +../IVAS_cod -sba 1 192000 48 testv/stvFOA48c.wav bit +../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stvFOA48c.wav_SBA_192000_48-48_MC_custom_setup.tst // SBA at 256 kbps, 32kHz in, 32kHz out, FOA out -../IVAS_cod -sba 1 256000 32 testv/stvFOA32c.pcm bit -../IVAS_dec FOA 32 bit testv/stvFOA32c.pcm_SBA_256000_32-32_FOA.tst +../IVAS_cod -sba 1 256000 32 testv/stvFOA32c.wav bit +../IVAS_dec FOA 32 bit testv/stvFOA32c.wav_SBA_256000_32-32_FOA.tst // SBA at 256 kbps, 32kHz in, 32kHz out, BINAURAL_ROOM out -../IVAS_cod -sba 1 256000 32 testv/stvFOA32c.pcm bit -../IVAS_dec BINAURAL_ROOM 32 bit testv/stvFOA32c.pcm_SBA_256000_32-32_BINAURAL_ROOM.tst +../IVAS_cod -sba 1 256000 32 testv/stvFOA32c.wav bit +../IVAS_dec BINAURAL_ROOM 32 bit testv/stvFOA32c.wav_SBA_256000_32-32_BINAURAL_ROOM.tst // SBA at 256 kbps, 48kHz in, 48kHz out, 7_1 out, random FEC at 5% -../IVAS_cod -sba 1 256000 48 testv/stvFOA48c.pcm bit -../IVAS_dec -fec 5 7_1 48 bit testv/stvFOA48c.pcm_SBA_256000_48-48_7_1_FEC5.tst +../IVAS_cod -sba 1 256000 48 testv/stvFOA48c.wav bit +../IVAS_dec -fec 5 7_1 48 bit testv/stvFOA48c.wav_SBA_256000_48-48_7_1_FEC5.tst // SBA 2OA at 384 kbps, 32kHz in, 32kHz out, STEREO out -../IVAS_cod -sba 2 384000 32 testv/stv2OA32c.pcm bit -../IVAS_dec STEREO 32 bit testv/stv2OA32c.pcm_SBA_384000_32-32_stereo.tst +../IVAS_cod -sba 2 384000 32 testv/stv2OA32c.wav bit +../IVAS_dec STEREO 32 bit testv/stv2OA32c.wav_SBA_384000_32-32_stereo.tst // SBA 3OA at 512 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.pcm bit -../IVAS_dec binaural 48 bit testv/stv3OA48c.pcm_SBA_512000_48-48_binaural.tst +../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.wav bit +../IVAS_dec binaural 48 bit testv/stv3OA48c.wav_SBA_512000_48-48_binaural.tst // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 48 testv/stvFOA48c.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.pcm_sw_48-48_BINAURAL.tst +../IVAS_cod -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 48 testv/stvFOA48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.wav_sw_48-48_BINAURAL.tst // SBA 2OA bitrate switching from 16.4 kbps to 512 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -sba 2 ../scripts/switchPaths/sw_16k4_512k_50fr.bin 48 testv/stv2OA48c.pcm bit -../IVAS_dec FOA 48 bit testv/stv2OA48c.pcm_sw_48-48_FOA.tst +../IVAS_cod -sba 2 ../scripts/switchPaths/sw_16k4_512k_50fr.bin 48 testv/stv2OA48c.wav bit +../IVAS_dec FOA 48 bit testv/stv2OA48c.wav_sw_48-48_FOA.tst // SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out -../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.pcm bit -../IVAS_dec HOA3 48 bit testv/stv3OA48c.pcm_sw_48-48_HOA3.tst +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec HOA3 48 bit testv/stv3OA48c.wav_sw_48-48_HOA3.tst // SBA planar 3OA bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stv3OA48c.pcm_sw_48-48_7_1_4.tst +../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv3OA48c.wav_sw_48-48_7_1_4.tst + +// SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out, DTX on, BINAURAL out +../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c.wav bit +../IVAS_dec BINAURAL 32 bit testv/stvFOA32c.wav_sw_32-32_DTX_BINAURAL.tst + +// SBA 3OA bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out, DTX on, HOA3 out +../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv3OA32c.wav bit +../IVAS_dec HOA3 32 bit testv/stv3OA32c.wav_sw_32-32_DTX_HOA3.tst + -// SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out,DTX on, BINAURAL out -../IVAS_cod -dtx -sba 1 ../scripts/switchPaths/sw_13k2_192k_50fr.bin 32 testv/stvFOA32c.pcm bit -../IVAS_dec BINAURAL 32 bit testv/stvFOA32c.pcm_sw_32-32_DTX_BINAURAL.tst // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 13200 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv_IVASMASA_1dir1TC.pcm_13200_48-48_BINAURAL.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 13200 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv1MASA1TC48c.wav_13200_48-48_BINAURAL.tst // MASA 1dir 1TC at 16.4 kbps, 48kHz in, 48kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 16400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -fec 5 HOA3 48 bit testv/stv_IVASMASA_1dir1TC.pcm_16400_48-48_HOA3_FEC5.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 16400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec -fec 5 HOA3 48 bit testv/stv1MASA1TC48c.wav_16400_48-48_HOA3_FEC5.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom.tst -// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Subframe -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom_Subframe.tst +// MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom_Subframe.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom_Headrot.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv1MASA1TC48c.wav_24400_48-48_BinauralRoom_Headrot.tst // MASA 1dir 1TC at 32 kbps, 48kHz in, 48kHz out, 7_1_4, random FEC at 5% -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 32000 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir1TC.pcm_32000_48-48_7_1_4_FEC5.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 32000 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec -fec 5 7_1_4 48 bit testv/stv1MASA1TC48c.wav_32000_48-48_7_1_4_FEC5.tst // MASA 1dir 1TC at 48 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 48000 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec MONO 48 bit testv/stv_IVASMASA_1dir1TC.pcm_48000_48-48_MONO.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 48000 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv1MASA1TC48c.wav_48000_48-48_MONO.tst // MASA 1dir 1TC at 64 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 64000 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec STEREO 48 bit testv/stv_IVASMASA_1dir1TC.pcm_64000_48-48_STEREO.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 64000 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv1MASA1TC48c.wav_64000_48-48_STEREO.tst // MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_FEC5.tst +../IVAS_cod -masa 1 testv/stv2MASA1TC48c.met 128000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv2MASA1TC48c.wav_128000_48-48_BINAURAL_FEC5.tst -// MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, Subframe -../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_Subframe.tst +// MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -masa 1 testv/stv2MASA1TC48c.met 128000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv2MASA1TC48c.wav_128000_48-48_BINAURAL_Subframe.tst // MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_Headrot.tst +../IVAS_cod -masa 1 testv/stv2MASA1TC48c.met 128000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv2MASA1TC48c.wav_128000_48-48_BINAURAL_Headrot.tst // MASA 1dir 2TC at 13.2 kbps, 48kHz in, 48kHz out, 5_1 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 13200 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -fec 5 5_1 48 bit testv/stv_IVASMASA_1dir2TC.pcm_13200_48-48_5_1_FEC5.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 13200 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -fec 5 5_1 48 bit testv/stv1MASA2TC48c.wav_13200_48-48_5_1_FEC5.tst // MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 16400 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir2TC.pcm_16400_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 16400 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48c.wav_16400_48-48_5_1.tst // MASA 1dir 2TC at 24.4 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 24400 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec STEREO 48 bit testv/stv_IVASMASA_1dir2TC.pcm_24400_48-48_STEREO.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 24400 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv1MASA2TC48c.wav_24400_48-48_STEREO.tst // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom.tst // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv1MASA2TC48c.wav_32000_48-48_BinauralRoom_Headrot.tst + +// MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation, Orientation tracking +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 32000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot_OtrAvg.tst // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 48000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC.pcm_48000_48-48_7_1_4_FEC5.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 48000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -fec 5 7_1_4 48 bit testv/stv1MASA2TC48c.wav_48000_48-48_7_1_4_FEC5.tst // MASA 1dir 2TC at 80 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 80000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec STEREO 48 bit testv/stv_IVASMASA_1dir2TC.pcm_80000_48-48_STEREO.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 80000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv1MASA2TC48c.wav_80000_48-48_STEREO.tst // MASA 1dir 2TC at 96 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 96000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec MONO 48 bit testv/stv_IVASMASA_1dir2TC.pcm_96000_48-48_MONO.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 96000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv1MASA2TC48c.wav_96000_48-48_MONO.tst // MASA 1dir 2TC at 160 kbps, 48kHz in, 48kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 160000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -fec 5 HOA3 48 bit testv/stv_IVASMASA_1dir2TC.pcm_160000_48-48_HOA3_FEC5.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 160000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec -fec 5 HOA3 48 bit testv/stv1MASA2TC48c.wav_160000_48-48_HOA3_FEC5.tst // MASA 1dir 2TC at 256 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 256000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir2TC.pcm_256000_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48c.met 256000 48 testv/stv1MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48c.wav_256000_48-48_5_1.tst // MASA 2dir 2TC at 48 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 48000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_2dir2TC.pcm_48000_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 48000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.wav_48000_48-48_5_1.tst // MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, EXTERNAL out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 64000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -fec 5 EXT 48 bit testv/stv_IVASMASA_2dir2TC.pcm_64000_48-48_external_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -fec 5 EXT 48 bit testv/stv2MASA2TC48c.wav_64000_48-48_external_FEC5.tst // MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 64000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv_IVASMASA_2dir2TC.pcm_64000_48-48_BINAURAL_Headrot.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv2MASA2TC48c.wav_64000_48-48_BINAURAL_Headrot.tst // MASA 2dir 2TC at 128 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 128000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec FOA 48 bit testv/stv_IVASMASA_2dir2TC.pcm_128000_48-48_FOA.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 128000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec FOA 48 bit testv/stv2MASA2TC48c.wav_128000_48-48_FOA.tst // MASA 2dir 2TC at 192 kbps, 48kHz in, 48kHz out, 5_1_4 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 192000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -fec 5 5_1_4 48 bit testv/stv_IVASMASA_2dir2TC.pcm_192000_48-48_5_1_4_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 192000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -fec 5 5_1_4 48 bit testv/stv2MASA2TC48c.wav_192000_48-48_5_1_4_FEC5.tst // MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 384000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_2dir2TC.pcm_384000_48-48_BinauralRoom.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2MASA2TC48c.wav_384000_48-48_BinauralRoom.tst -// MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out, Subframe -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 384000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL_ROOM 48 bit testv/stv_IVASMASA_2dir2TC.pcm_384000_48-48_BinauralRoom_Subframe.tst +// MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2MASA2TC48c.wav_384000_48-48_BinauralRoom_Subframe.tst // MASA 2dir 2TC at 512 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 512000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_2dir2TC.pcm_512000_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 512000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.wav_512000_48-48_5_1.tst // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out -../IVAS_cod -dtx -masa 1 testv/stv_IVASMASA_1dir1TC_DTX.met 13200 48 testv/stv_IVASMASA_1dir1TC_DTX.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stv_IVASMASA_1dir1TC_DTX.pcm_13200_48-48_DTX_7_1_4.tst +../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 13200 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv1MASA1TC48n.wav_13200_48-48_DTX_7_1_4.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -dtx -masa 1 testv/stv_IVASMASA_1dir1TC_DTX.met 24400 48 testv/stv_IVASMASA_1dir1TC_DTX.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir1TC_DTX.pcm_24400_48-48_DTX_5_1.tst +../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 24400 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.wav_24400_48-48_DTX_5_1.tst // MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out -../IVAS_cod -dtx -masa 2 testv/stv_IVASMASA_1dir2TC_DTX.met 16400 48 testv/stv_IVASMASA_1dir2TC_DTX.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC_DTX.pcm_16400_48-48_DTX_7_1_4.tst +../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 16400 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv1MASA2TC48n.wav_16400_48-48_DTX_7_1_4.tst // MASA 1dir 2TC at 32.0 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -dtx -masa 2 testv/stv_IVASMASA_1dir2TC_DTX.met 32000 48 testv/stv_IVASMASA_1dir2TC_DTX.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir2TC_DTX.pcm_32000_48-48_DTX_5_1.tst +../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 32000 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48n.wav_32000_48-48_DTX_5_1.tst // MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC_DTX.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv_IVASMASA_1dir1TC_DTX.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir1TC_DTX.pcm_sw_48-48_5_1.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.wav bit +../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.wav_sw_48-48_5_1.tst // MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC_DTX.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv_IVASMASA_1dir2TC_DTX.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv_IVASMASA_1dir2TC_DTX.pcm_sw_48-48_BINAURAL.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv1MASA2TC48n.wav_sw_48-48_BINAURAL.tst + // Multi-channel 5_1 at 13.2 kbps, 48kHz in, 48kHz out -../IVAS_cod -mc 5_1 13200 48 testv/stv51MC48c.pcm bit -../IVAS_dec 5_1 48 bit testv/stv51MC48c.pcm_MC51_13200_48-48_5_1.tst +../IVAS_cod -mc 5_1 13200 48 testv/stv51MC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv51MC48c.wav_MC51_13200_48-48_5_1.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit -../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_FEC5.tst +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit +../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv51MC48c.wav_MC51_24400_48-48_Binaural_FEC5.tst -// Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out, Subframe -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit -../IVAS_dec -force_subframe_bin BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_Subframe.tst +// Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.wav_MC51_24400_48-48_Binaural_Subframe.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_Headrot.tst +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.wav_MC51_24400_48-48_Binaural_Headrot.tst // Multi-channel 5_1 at 48 kbps, 48kHz in, 48kHz out, random FEC at 5% -../IVAS_cod -mc 5_1 48000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -fec 5 5_1 48 bit testv/stv51MC48c.pcm_MC51_48000_48-48_5_1_FEC5.tst +../IVAS_cod -mc 5_1 48000 48 testv/stv51MC48c.wav bit +../IVAS_dec -fec 5 5_1 48 bit testv/stv51MC48c.wav_MC51_48000_48-48_5_1_FEC5.tst // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_64000_48-48_Binaural.tst +../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_Binaural.tst // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_64000_48-48_Binaural_Headrot.tst +../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_Binaural_Headrot.tst // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_64000_48-48_Binaural_room_Headrot.tst +../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit +../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_Binaural_room_Headrot.tst // Multi-channel 5_1 at 96 kbps, 48kHz in, 48kHz out, random FEC at 5% -../IVAS_cod -mc 5_1 96000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -fec 5 5_1 48 bit testv/stv51MC48c.pcm_MC51_96000_48-48_5_1_FEC5.tst +../IVAS_cod -mc 5_1 96000 48 testv/stv51MC48c.wav bit +../IVAS_dec -fec 5 5_1 48 bit testv/stv51MC48c.wav_MC51_96000_48-48_5_1_FEC5.tst // Multi-channel 5_1 at 128 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_128000_48-48_Binaural.tst +../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.wav_MC51_128000_48-48_Binaural.tst // Multi-channel 5_1 at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_128000_48-48_Binaural_Headrot.tst +../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.wav_MC51_128000_48-48_Binaural_Headrot.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, STEREO out, random FEC at 5% -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -fec 5 STEREO 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_stereo_FEC5.tst +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit +../IVAS_dec -fec 5 STEREO 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_stereo_FEC5.tst // Multi-channel 5_1 at 192 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_192000_48-48_BinauralRoom.tst +../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv51MC48c.wav_MC51_192000_48-48_BinauralRoom.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit -../IVAS_dec MONO 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_mono.tst +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_mono.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot.tst +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit +../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_BinauralRoom_Headrot.tst + +// Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation, Orientation tracking +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit +../IVAS_dec -t testv/headrot.csv -otr avg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot_OtrAvg.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit -../IVAS_dec 5_1 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_5_1.tst +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv51MC48c.wav_MC51_384000_48-48_5_1.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_Binaural.tst +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.wav_MC51_384000_48-48_Binaural.tst // Multi-channel 5_1 at 192 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.pcm bit -../IVAS_dec STEREO 48 bit testv/stv51MC48c.pcm_MC51_192000_48-48_stereo.tst +../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv51MC48c.wav_MC51_192000_48-48_stereo.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_7_1_4.tst +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv51MC48c.wav_MC51_384000_48-48_7_1_4.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit -../IVAS_dec MONO 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_MONO.tst +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv51MC48c.wav_MC51_24400_48-48_MONO.tst // Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.pcm bit -../IVAS_dec MONO 48 bit testv/stv714MC48c.pcm_MC714_48000_48-48_Mono.tst +../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv714MC48c.wav_MC714_48000_48-48_Mono.tst // Multi-channel 7_1_4 at 64 kbps, 48kHz in, 48kHz out, MONO out, random FEC at 5% -../IVAS_cod -mc 7_1_4 64000 48 testv/stv714MC48c.pcm bit -../IVAS_dec -fec 5 MONO 48 bit testv/stv714MC48c.pcm_MC714_64000_48-48_MONO_FEC5.tst +../IVAS_cod -mc 7_1_4 64000 48 testv/stv714MC48c.wav bit +../IVAS_dec -fec 5 MONO 48 bit testv/stv714MC48c.wav_MC714_64000_48-48_MONO_FEC5.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit -../IVAS_dec STEREO 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Stereo.tst +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv51MC48c.wav_MC51_24400_48-48_Stereo.tst // Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.pcm bit -../IVAS_dec STEREO 48 bit testv/stv714MC48c.pcm_MC714_96000_48-48_Stereo.tst +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_Stereo.tst // Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, 5_1 out, random FEC at 5% -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.pcm bit -../IVAS_dec -fec 5 5_1 48 bit testv/stv714MC48c.pcm_MC714_96000_48-48_5_1_FEC5.tst +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit +../IVAS_dec -fec 5 5_1 48 bit testv/stv714MC48c.wav_MC714_96000_48-48_5_1_FEC5.tst + +// Multi-channel 7_1_4 at 160 kbps, 48kHz in, 48kHz out, BINAURAL out +../IVAS_cod -mc 7_1_4 160000 48 testv/stv714MC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv714MC48c.wav_MC714_160000_48-48_MC_binaural.tst + +// Multi-channel 7_1_4 at 160 kbps, 48kHz in, 48kHz out, 7_1_4 out +../IVAS_cod -mc 7_1_4 160000 48 testv/stv714MC48c.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv714MC48c.wav_MC714_160000_48-48_MC714.tst // Multi-channel 5_1_2 at 32 kbps, 48kHz in, 48kHz out, STEREO out, random FEC at 5% -../IVAS_cod -mc 5_1_2 32000 48 testv/stv512MC48c.pcm bit -../IVAS_dec -fec 5 STEREO 48 bit testv/stv512MC48c.pcm_MC714_32000_48-48_Stereo.tst +../IVAS_cod -mc 5_1_2 32000 48 testv/stv512MC48c.wav bit +../IVAS_dec -fec 5 STEREO 48 bit testv/stv512MC48c.wav_MC714_32000_48-48_Stereo.tst // Multi-channel 5_1_2 at 80 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -mc 5_1_2 80000 48 testv/stv51MC48c.pcm bit -../IVAS_dec 5_1 48 bit testv/stv512MC48c.pcm_MC512_80000_48-48_5_1.tst +../IVAS_cod -mc 5_1_2 80000 48 testv/stv512MC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv512MC48c.wav_MC512_80000_48-48_5_1.tst // Multi-channel 5_1_2 at 160 kbps, 48kHz in, 48kHz out, 5_1_2 out -../IVAS_cod -mc 5_1_2 160000 48 testv/stv512MC48c.pcm bit -../IVAS_dec 5_1_2 48 bit testv/stv512MC48c.pcm_MC512_160000_48-48_5_1_2.tst +../IVAS_cod -mc 5_1_2 160000 48 testv/stv512MC48c.wav bit +../IVAS_dec 5_1_2 48 bit testv/stv512MC48c.wav_MC512_160000_48-48_5_1_2.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, Custom LS setup out -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit -../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_MC_custom_setup.tst +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit +../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv51MC48c.wav_MC51_256000_48-48_MC_custom_setup.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_Config_renderer.tst +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit +../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_Config_renderer.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 32kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 32 bit testv/stv51MC48c.pcm_MC51_512000_48-32_MC_Config_renderer.tst +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit +../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM 32 bit testv/stv51MC48c.wav_MC51_512000_48-32_MC_Config_renderer.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 16 bit testv/stv51MC48c.pcm_MC51_512000_48-16_MC_Config_renderer.tst +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit +../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM 16 bit testv/stv51MC48c.wav_MC51_512000_48-16_MC_Config_renderer.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config hospital_patientroom -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -render_config testv/config_hospital_patientroom.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_Config_hospital_patientroom.tst +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit +../IVAS_dec -render_config testv/rend_config_hospital_patientroom.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_Config_hospital_patientroom.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config recreation -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit -../IVAS_dec -render_config testv/config_recreation.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_Config_recreation.tst +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit +../IVAS_dec -render_config testv/rend_config_recreation.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_Config_recreation.tst // Multi-channel 5_1_2 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1_2 512000 48 testv/stv512MC48c.pcm bit -../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv512MC48c.pcm_MC512_512000_48-48_MC_Config_renderer.tst +../IVAS_cod -mc 5_1_2 512000 48 testv/stv512MC48c.wav bit +../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv512MC48c.wav_MC512_512000_48-48_MC_Config_renderer.tst // Multi-channel 5_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.pcm bit -../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv514MC48c.pcm_MC514_512000_48-48_MC_Config_renderer.tst +../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit +../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv514MC48c.wav_MC514_512000_48-48_MC_Config_renderer.tst // Multi-channel 7_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.pcm bit -../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv714MC48c.pcm_MC714_512000_48-48_MC_Config_renderer.tst +../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit +../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv714MC48c.wav_MC714_512000_48-48_MC_Config_renderer.tst // Multi-channel 5_1 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv51MC48c.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stv51MC48c.pcm_sw_48-48_7_1_4.tst +../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv51MC48c.wav bit +../IVAS_dec 7_1_4 48 bit testv/stv51MC48c.wav_sw_48-48_7_1_4.tst // Multi-channel 5_1 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, BINAURAL out, FEC at 10% -../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv51MC48c.pcm bit -../IVAS_dec -fec 10 BINAURAL 48 bit testv/stv51MC48c.pcm_sw_48-48_binaural_fec10.tst +../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv51MC48c.wav bit +../IVAS_dec -fec 10 BINAURAL 48 bit testv/stv51MC48c.wav_sw_48-48_binaural_fec10.tst // Multi-channel 5_1_2 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out -../IVAS_cod -mc 5_1_2 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv512MC48c.pcm bit -../IVAS_dec BINAURAL_ROOM 16 bit testv/stv512MC48c.pcm_sw_48-16_Binaural_room.tst +../IVAS_cod -mc 5_1_2 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv512MC48c.wav bit +../IVAS_dec BINAURAL_ROOM 16 bit testv/stv512MC48c.wav_sw_48-16_Binaural_room.tst // Multi-channel 7_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out -../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv714MC48c.pcm bit -../IVAS_dec HOA3 48 bit testv/stv51MC48c.pcm_sw_48-48_HOA3.tst +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv714MC48c.wav bit +../IVAS_dec HOA3 48 bit testv/stv51MC48c.wav_sw_48-48_HOA3.tst // Multi-channel 7_1_4 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 32kHz out, STEREO out, FEC at 5% -../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv714MC48c.pcm bit -../IVAS_dec -FEC 5 STEREO 32 bit testv/stv714MC48c.pcm_sw_48-32_stereo.tst +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv714MC48c.wav bit +../IVAS_dec -FEC 5 STEREO 32 bit testv/stv714MC48c.wav_sw_48-32_stereo.tst + + +// Multi-channel 5_1_4 at 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out (Model from file) +../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit +../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL_ROOM 16 bit testv/stv51MC48c.wav_MC51_512000_48-16_MC_binaural_room.tst + +// Multi-channel 7_1_4 at 512 kbps, 48kHz in, 32kHz out, BINAURAL out (Model from file) +../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit +../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL 32 bit testv/stv714MC48c.wav_MC714_512000_48-32_MC_binaural.tst + +// Multi-channel 5_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL out (Model from file) +../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit +../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_binaural.tst + +// Multi-channel 7_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out (Model from file) +../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit +../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL_ROOM 48 bit testv/stv714MC48c.wav_MC714_512000_48-48_MC_binaural_room.tst + // Stereo downmix to bit-exact EVS at 13200 kbps, 32kHz in, 32kHz out -../IVAS_cod -stereo_dmx_evs 13200 32 testv/stvST32c.pcm bit -../IVAS_dec 32 bit testv/stvST32c.pcm_StereoDmxEVS_13200_32-32.tst +../IVAS_cod -stereo_dmx_evs 13200 32 testv/stvST32c.wav bit +../IVAS_dec 32 bit testv/stvST32c.wav_StereoDmxEVS_13200_32-32.tst // Stereo downmix to bit-exact EVS at 24400 kbps, 48kHz in, 48kHz out -../IVAS_cod -stereo_dmx_evs 24400 48 testv/stvST48c.pcm bit -../IVAS_dec 48 bit testv/stvST48c.pcm_StereoDmxEVS_24400_48-48.tst +../IVAS_cod -stereo_dmx_evs 24400 48 testv/stvST48c.wav bit +../IVAS_dec 48 bit testv/stvST48c.wav_StereoDmxEVS_24400_48-48.tst + -// MDCT stereo at 48 kbps, 16 kHz in, 16 kHz out, DTX on, JBM Prof 5 -../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.pcm bit +// stereo at 48 kbps, 16 kHz in, 16 kHz out, DTX on, JBM Prof 5 +../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -Tracefile tracefile_dec -VOIP STEREO 16 netsimoutput testv/stvST16n.pcm_MDCT_48000_16-16_DTX_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP STEREO 16 netsimoutput testv/stvST16n.wav_stereo_48000_16-16_DTX_JBM5.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, FOA out, JBM Prof 5 -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -Tracefile tracefile_dec -VOIP FOA 48 netsimoutput testv/stv4ISM48s.pcm_32000_48-48_FOA_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP FOA 48 netsimoutput testv/stv4ISM48s.wav_32000_48-48_FOA_JBM5.tst // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out, JBM Prof 5 -../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.pcm bit +../IVAS_cod -sba 3 80000 32 testv/stv3OA32c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -Tracefile tracefile_dec -VOIP HOA3 32 netsimoutput testv/stv3OA32c.pcm_SBA_80000_32-32_HOA3_JBM5.tst +../IVAS_dec -Tracefile tracefile_dec -VOIP HOA3 32 netsimoutput testv/stv3OA32c.wav_SBA_80000_32-32_HOA3_JBM5.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, 7_1_4 out, JBM Prof 5 -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 -../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/stv51MC48c.pcm_MC51_384000_48-48_7_1_4_JBM5.tst \ No newline at end of file +../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/stv51MC48c.wav_MC51_384000_48-48_7_1_4_JBM5.tst diff --git a/scripts/config/self_test_evs.prm b/scripts/config/self_test_evs.prm index 6c4936a0d436b9b481d689e0e0e11cce8ea8d49b..16f859f802cc79a6834fcd88c58c55f3d010673f 100644 --- a/scripts/config/self_test_evs.prm +++ b/scripts/config/self_test_evs.prm @@ -13,231 +13,236 @@ // Codec A at 5.90 kbps, 8kHz in, 8kHz out, VBR -../IVAS_cod -dtx 5900 8 testv/stv8c.pcm bit +../IVAS_cod -dtx 5900 8 testv/stv8c.wav bit ../IVAS_dec 8 bit testv/stv8c_5k90_8-8_VBR.tst // Codec A at 7.20 kbps, 8kHz in, 8kHz out -../IVAS_cod 7200 8 testv/stv8c.pcm bit +../IVAS_cod 7200 8 testv/stv8c.wav bit ../IVAS_dec 8 bit testv/stv8c_7k20_8-8.tst // Codec A at 8.00 kbps, 8kHz in, 8kHz out, fixed DTX -../IVAS_cod -dtx 8000 8 testv/stv8n.pcm bit +../IVAS_cod -dtx 8000 8 testv/stv8n.wav bit ../IVAS_dec 8 bit testv/stv8n_8k00_8-8_DTX20.tst // Codec B at 9.60 kbps, 8kHz in, 8kHz out, adaptive DTX -../IVAS_cod -dtx 0 9600 8 testv/stv8n.pcm bit +../IVAS_cod -dtx 0 9600 8 testv/stv8n.wav bit ../IVAS_dec 8 bit testv/stv8n_9k60_8-8_DTX20.tst // Codec B at 9.60 kbps, 8kHz in, 8kHz out, fixed DTX, random FEC at 5% -../IVAS_cod -dtx 9600 8 testv/stv8n.pcm bit +../IVAS_cod -dtx 9600 8 testv/stv8n.wav bit ../IVAS_dec -fec 5 8 bit testv/stv8n_9k60_8-8_DTX20_FEC5.tst // Codec A at 13.20 kbps, 8kHz in, 8kHz out, random FEC at 5% -../IVAS_cod 13200 8 testv/stv8c.pcm bit +../IVAS_cod 13200 8 testv/stv8c.wav bit ../IVAS_dec -fec 5 8 bit testv/stv8c_13k20_8-8_FEC5.tst // Codec A at 13.20 kbps, 8kHz in, 8kHz out, fixed DTX, random FEC at 5% -../IVAS_cod -dtx 20 13200 8 testv/stv8c.pcm bit +../IVAS_cod -dtx 20 13200 8 testv/stv8c.wav bit ../IVAS_dec -fec 5 8 bit testv/stv8c_13k20_8-8_DTX20_FEC5.tst // Codec A at 32 kbps, 32kHz in, 8kHz out, random FEC at 6% -../IVAS_cod 32000 32 testv/stv32c.pcm bit +../IVAS_cod 32000 32 testv/stv32c.wav bit ../IVAS_dec -fec testv/FEC_6pct2.bin 8 bit stv32c_32k_32-8_FEC6.tst // Codec A at 5.90 kbps, 16kHz in, 16kHz out, VBR -../IVAS_cod -dtx 5900 16 testv/stv16c.pcm bit +../IVAS_cod -dtx 5900 16 testv/stv16c.wav bit ../IVAS_dec 16 bit testv/stv16c_5k90_8-8_VBR.tst // Codec A at 7.20 kbps, 16kHz in, 16kHz out -../IVAS_cod 7200 16 testv/stv16c.pcm bit +../IVAS_cod 7200 16 testv/stv16c.wav bit ../IVAS_dec 16 bit testv/stv16c_7k20_16-16.tst // Codec A at 8 kbps, 16kHz in, 16kHz out -../IVAS_cod 8000 16 testv/stv16c.pcm bit +../IVAS_cod 8000 16 testv/stv16c.wav bit ../IVAS_dec 16 bit testv/stv16c_8k00_16-16.tst // Codec B at 9.60 kbps, 16kHz in, 16kHz out -../IVAS_cod 9600 16 testv/stv16n.pcm bit +../IVAS_cod 9600 16 testv/stv16n.wav bit ../IVAS_dec 16 bit testv/stv16n_9k60_16-16.tst // Codec B at 9.60 kbps, 16kHz in, 16kHz out, random FEC at 5% -../IVAS_cod 9600 16 testv/stv16n.pcm bit +../IVAS_cod 9600 16 testv/stv16n.wav bit ../IVAS_dec -fec 5 16 bit testv/stv16n_9k60_16-16_FEC5.tst // Codec A at 13.20 kbps, 16kHz in, 16kHz out, adaptive DTX -../IVAS_cod -dtx 0 13200 16 testv/stv16n.pcm bit +../IVAS_cod -dtx 0 13200 16 testv/stv16n.wav bit ../IVAS_dec 16 bit testv/stv16n_13k20_16-16_DTX.tst // Codec A at 13.20 kbps, 16kHz in, 16kHz out, fixed DTX, random FEC at 5% -../IVAS_cod -dtx 13200 16 testv/stv16n.pcm bit +../IVAS_cod -dtx 13200 16 testv/stv16n.wav bit ../IVAS_dec -fec 5 16 bit testv/stv16n_13k20_16-16_DTX_FEC5.tst // Codec B at 16.40 kbps, 16kHz in, 16kHz out, random FEC at 5% -../IVAS_cod 16400 16 testv/stv16c.pcm bit +../IVAS_cod 16400 16 testv/stv16c.wav bit ../IVAS_dec -fec 5 16 bit testv/stv16c_16k40_16-16_FEC5.tst // Codec B at 24.40 kbps, 16kHz in, 16kHz out, fixed DTX -../IVAS_cod -dtx 24400 16 testv/stv16c.pcm bit +../IVAS_cod -dtx 24400 16 testv/stv16c.wav bit ../IVAS_dec 16 bit testv/stv16c_24k40_16-16_DTX.tst // Codec A at 32 kbps, 16kHz in, 16kHz out -../IVAS_cod 32000 16 testv/stv16c.pcm bit +../IVAS_cod 32000 16 testv/stv16c.wav bit ../IVAS_dec 16 bit testv/stv16c_32k_16-16.tst // Codec B at 48 kbps, 16kHz in, 16kHz out -../IVAS_cod 48000 16 testv/stv16c.pcm bit +../IVAS_cod 48000 16 testv/stv16c.wav bit ../IVAS_dec 16 bit testv/stv16c_48k_16-16.tst // Codec A at 64 kbps, 16kHz in, 16kHz out -../IVAS_cod 64000 16 testv/stv16c.pcm bit +../IVAS_cod 64000 16 testv/stv16c.wav bit ../IVAS_dec 16 bit testv/stv16c_64k_16-16.tst // Codec A at 64 kbps, 16kHz in, 16kHz out, random FEC at 5% -../IVAS_cod 64000 16 testv/stv16c.pcm bit +../IVAS_cod 64000 16 testv/stv16c.wav bit ../IVAS_dec -fec 5 16 bit testv/stv16c_64k_16-16_FEC5.tst // Codec B at 96 kbps, 16kHz in, 16kHz out -../IVAS_cod 96000 16 testv/stv16c.pcm bit +../IVAS_cod 96000 16 testv/stv16c.wav bit ../IVAS_dec 16 bit testv/stv16c_96k_16-16.tst // Codec B at 96 kbps, 16kHz in, 16kHz out, random FEC at 5% -../IVAS_cod 96000 16 testv/stv16c.pcm bit +../IVAS_cod 96000 16 testv/stv16c.wav bit ../IVAS_dec -fec 5 16 bit testv/stv16c_96k_16-16_FEC5.tst // Codec A at 7.20 kbps, 32kHz in, 32kHz out -../IVAS_cod 7200 32 testv/stv32c.pcm bit +../IVAS_cod 7200 32 testv/stv32c.wav bit ../IVAS_dec 32 bit testv/stv32c_7k20_32-32.tst // Codec A at 8 kbps, 32kHz in, 32kHz out, fixed DTX -../IVAS_cod -dtx 8000 32 testv/stv32n.pcm bit +../IVAS_cod -dtx 8000 32 testv/stv32n.wav bit ../IVAS_dec 32 bit testv/stv32n_8k00_32-32_DTX.tst // Codec B at 9.60 kbps, 32kHz in, 32kHz out -../IVAS_cod 9600 32 testv/stv32n.pcm bit +../IVAS_cod 9600 32 testv/stv32n.wav bit ../IVAS_dec 32 bit testv/stv32n_9k60_32-32.tst // Codec A at 13.20 kbps, 32kHz in, 32kHz out -../IVAS_cod 13200 32 testv/stv32c.pcm bit +../IVAS_cod 13200 32 testv/stv32c.wav bit ../IVAS_dec 32 bit testv/stv32c_13k20_32-32.tst // Codec A at 13.20 kbps, 32kHz in, 32kHz out, random FEC at 5% -../IVAS_cod 13200 32 testv/stv32c.pcm bit +../IVAS_cod 13200 32 testv/stv32c.wav bit ../IVAS_dec -fec 5 32 bit testv/stv32c_13k20_32-32_FEC5.tst // Codec B at 16.40 kbps, 32kHz in, 32kHz out, DTX -../IVAS_cod -dtx 16400 32 testv/stv32c.pcm bit +../IVAS_cod -dtx 16400 32 testv/stv32c.wav bit ../IVAS_dec 32 bit testv/stv32c_16k40_32-32_DTX.tst // Codec B at 16.40 kbps, 32kHz in, 32kHz out, fixed DTX, random FEC at 5% -../IVAS_cod -dtx 16400 32 testv/stv32c.pcm bit +../IVAS_cod -dtx 16400 32 testv/stv32c.wav bit ../IVAS_dec -fec 5 32 bit testv/stv32c_16k40_32-32_DTX_FEC5.tst // Codec B at 24.40 kbps, 32kHz in, 32kHz out -../IVAS_cod 24400 32 testv/stv32c.pcm bit +../IVAS_cod 24400 32 testv/stv32c.wav bit ../IVAS_dec 32 bit testv/stv32c_24k40_32-32.tst // Codec A at 32 kbps, 32kHz in, 32kHz out -../IVAS_cod 32000 32 testv/stv32c.pcm bit +../IVAS_cod 32000 32 testv/stv32c.wav bit ../IVAS_dec 32 bit testv/stv32c_32k_32-32.tst // Codec B at 48 kbps, 32kHz in, 32kHz out -../IVAS_cod 48000 32 testv/stv32c.pcm bit +../IVAS_cod 48000 32 testv/stv32c.wav bit ../IVAS_dec 32 bit testv/stv32c_48k_32-32.tst // Codec B at 48 kbps, 32kHz in, 32kHz out, random FEC at 5% -../IVAS_cod 48000 32 testv/stv32c.pcm bit +../IVAS_cod 48000 32 testv/stv32c.wav bit ../IVAS_dec -fec 5 32 bit testv/stv32c_48k_32-32_FEC5.tst // Codec A at 64 kbps, 32kHz in, 32kHz out, random FEC at 5% -../IVAS_cod 64000 32 testv/stv32c.pcm bit +../IVAS_cod 64000 32 testv/stv32c.wav bit ../IVAS_dec -fec 5 32 bit testv/stv32c_64k_32-32_FEC5.tst // Codec B at 96 kbps, 32kHz in, 32kHz out -../IVAS_cod 96000 32 testv/stv32c.pcm bit +../IVAS_cod 96000 32 testv/stv32c.wav bit ../IVAS_dec 32 bit testv/stv32c_96k_32-32.tst +// Codec A at 13.20 kbps, 32kHz in, 48kHz out +../IVAS_cod 13200 32 testv/stv32c.wav bit +../IVAS_dec 48 bit testv/stv32c_13k20_32-48.tst + + // Codec A at 13.2 kbps, 48kHz in, 48kHz out -../IVAS_cod 13200 48 testv/stv48c.pcm bit +../IVAS_cod 13200 48 testv/stv48c.wav bit ../IVAS_dec 48 bit testv/stv48c_13k20_48-48.tst // Codec B at 16.40 kbps, 48kHz in, 48kHz out -../IVAS_cod 16400 48 testv/stv48c.pcm bit +../IVAS_cod 16400 48 testv/stv48c.wav bit ../IVAS_dec 48 bit testv/stv48c_16k40_48-48.tst // Codec B at 24.40 kbps, 48kHz in, 48kHz out, random FEC at 5% -../IVAS_cod 24400 48 testv/stv48c.pcm bit +../IVAS_cod 24400 48 testv/stv48c.wav bit ../IVAS_dec -fec 5 48 bit testv/stv48c_24k40_48-48_FEC5.tst // Codec A at 32 kbps, 48kHz in, 48kHz out, FB -../IVAS_cod -max_band FB 32000 48 testv/stv48c.pcm bit +../IVAS_cod -max_band FB 32000 48 testv/stv48c.wav bit ../IVAS_dec 48 bit testv/stv48c_32k_48-48.tst // Codec B at 48 kbps, 48kHz in, 48kHz out, FB -../IVAS_cod -max_band FB 48000 48 testv/stv48c.pcm bit +../IVAS_cod -max_band FB 48000 48 testv/stv48c.wav bit ../IVAS_dec 48 bit testv/stv48c_48k_48-48.tst // Codec A at 64 kbps, 48kHz in, 48kHz out, FB -../IVAS_cod -max_band FB 64000 48 testv/stv48c.pcm bit +../IVAS_cod -max_band FB 64000 48 testv/stv48c.wav bit ../IVAS_dec 48 bit testv/stv48c_64k_48-48.tst // Codec B at 96 kbps, 48kHz in, 48kHz out, FB -../IVAS_cod -max_band FB 96000 48 testv/stv48c.pcm bit +../IVAS_cod -max_band FB 96000 48 testv/stv48c.wav bit ../IVAS_dec 48 bit testv/stv48c_96k_48-48.tst -// Codec switching A-B between (ACELP-only) 7.2 and 16.4 kbps, 16kHz in, 16kHz out -../IVAS_cod -force speech ../scripts/switchPaths/wb_low1.bin 16 testv/stv16n.pcm bit +// Codec switching A-B between 7.2 and 16.4 kbps, 16kHz in, 16kHz out +../IVAS_cod ../scripts/switchPaths/wb_low1.bin 16 testv/stv16n.wav bit ../IVAS_dec 16 bit testv/stv16n_07_16k_16-16.tst -// Codec switching A-B between (MUSIC-only) 13.2 and 64 kbps, 16kHz in, 16kHz out -../IVAS_cod -force music ../scripts/switchPaths/wb_high1.bin 16 testv/stv16n.pcm bit +// Codec switching A-B between 13.2 and 64 kbps, 16kHz in, 16kHz out +../IVAS_cod ../scripts/switchPaths/wb_high1.bin 16 testv/stv16n.wav bit ../IVAS_dec 16 bit testv/stv16n_13_64k_16-16.tst // Codec switching A-B between 5.9 and 64 kbps, 16kHz in, 16kHz out -../IVAS_cod ../scripts/switchPaths/sw_wb5.bin 16 testv/stv16n.pcm bit +../IVAS_cod ../scripts/switchPaths/sw_wb5.bin 16 testv/stv16n.wav bit ../IVAS_dec 16 bit testv/stv16n_05_64k_16-16.tst // Codec switching A-B between 13 and 128 kbps, 32kHz in, 32kHz out -../IVAS_cod ../scripts/switchPaths/sw_swb1.bin 32 testv/stv32c.pcm bit +../IVAS_cod ../scripts/switchPaths/sw_swb1.bin 32 testv/stv32c.wav bit ../IVAS_dec 32 bit testv/stv32c_13_128k_32-32.tst // Codec switching EVS - AMR-WB IO between 5.9 and 128 kbps, 48kHz in, 32kHz out -../IVAS_cod ../scripts/switchPaths/sw_amrwb_evs2.bin 48 testv/stv48c.pcm bit +../IVAS_cod ../scripts/switchPaths/sw_amrwb_evs2.bin 48 testv/stv48c.wav bit ../IVAS_dec 32 bit testv/stv48c_59_128k_48-32.tst // AMR-WB IO at 12.65 kbps, 16kHz in, 16kHz out, fixed DTX -../IVAS_cod -dtx 12650 16 testv/stv16n.pcm bit +../IVAS_cod -dtx 12650 16 testv/stv16n.wav bit ../IVAS_dec 16 bit testv/stv16n_AMR_WB_12k65_16-16_DTX.tst // AMR-WB IO at 23.85 kbps, 16kHz in, 16kHz out, adaptive DTX, random FEC at 5% -../IVAS_cod -dtx 0 23850 16 testv/stv16n.pcm bit +../IVAS_cod -dtx 0 23850 16 testv/stv16n.wav bit ../IVAS_dec -fec 5 16 bit testv/stv16n_AMR_WB_23k85_16-16_DTX_FEC5.tst // AMR-WB IO at 19.85 kbps, 32kHz in, 32kHz out -../IVAS_cod 19850 32 testv/stv32c.pcm bit +../IVAS_cod 19850 32 testv/stv32c.wav bit ../IVAS_dec 32 bit testv/stv32c_AMR_WB_19k85_32-32.tst // Codec A at 13.20 kbps, 32kHz in, 32kHz out, DTX, JBM Prof 5 -../IVAS_cod -dtx 13200 32 testv/stv32c.pcm bit +../IVAS_cod -dtx 13200 32 testv/stv32c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP 32 netsimoutput testv/stv32c_13k20_32-32_DTX_JBM5.tst // Codec B at 16.40 kbps, 32kHz in, 32kHz out, DTX, JBM Prof 5 -../IVAS_cod -dtx 16400 32 testv/stv32c.pcm bit +../IVAS_cod -dtx 16400 32 testv/stv32c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP 32 netsimoutput testv/stv32c_16k40_32-32_DTX_JBM5.tst // Codec B at 13.20 kbps, 32kHz in, 32kHz out, JBM Prof 9, Channel aware -../IVAS_cod -rf 13200 32 testv/stv32c.pcm bit +../IVAS_cod -rf 13200 32 testv/stv32c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP 32 netsimoutput testv/stv32c_13k20_CA_32-32_JBM9.tst diff --git a/scripts/mem_analysis.m b/scripts/mem_analysis.m deleted file mode 100644 index ad75efa1c759ee613a1a5784b13a12b6c4325c7d..0000000000000000000000000000000000000000 --- a/scripts/mem_analysis.m +++ /dev/null @@ -1,38 +0,0 @@ -%% - -lines = readlines('../mem_analysis.csv','EmptyLineRule','skip'); - -names = {}; -Nframes = length(lines); - -mem = zeros(1,Nframes); - -% Load mem_analysis.csv into matrix -for i = 1:Nframes - entries = split(lines(i),';'); - for j = 1:length(entries) - a = split(entries(j),','); - if(length(a)==2) - name = a{1}; - num = str2double(a{2}); - I = find(strcmp(names,name)); - if isempty(I) - names{end+1} = name; - I = length(names); - end - mem(I,i) = num; - end - end -end - -% Reorder the matrix such that the fixed allocations are at the bottom: -% --> Find all rows which are constant (sum of abs diff is zero). The >0 is -% to limit the reordering to constant values only. -[~,indx] = sort(sum(abs(diff(mem,[],2)),2)>0); -mem = mem(indx,:); -names = names(indx); - -bar(mem',1,'stacked') -legend(names,'location','eastoutside','interpreter','none') -xlabel('frame') -ylabel('memory size') \ No newline at end of file diff --git a/scripts/mem_analysis.py b/scripts/mem_analysis.py new file mode 100644 index 0000000000000000000000000000000000000000..fa2030c033fbb06ec86a08147572e14c6dfe59e8 --- /dev/null +++ b/scripts/mem_analysis.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 + +import os +import argparse +import csv +import sys +import struct +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt + +# set matplotlib in interactive mode (plots figure and return control) +# plt.ion() +# plt.close('all') + +parser = argparse.ArgumentParser(description='Analyze memory output file') +parser.add_argument('input',type=str,help='Memory analysis file (e.g. mem_analysis.csv)') +args = parser.parse_args() +fileIn = args.input + +# read input .csv file +df = pd.read_csv(fileIn, header=None, names=['action_type', 'frame', 'name', 'line_no', 'mem_size']) +Nframes = max(df['frame']) + +# merge identical memory blocks -> create new column 'count' +df = df.groupby(df.columns.tolist(),as_index=False).size() +df = df.rename(columns={'size': 'count'}) + +# remove column 'action_type' +df.drop(columns = ['action_type']) + +# merge records with the same signature but different frame number -> create list of frames (sort in ascending order) +df = df.groupby(['name', 'line_no', 'mem_size', 'count'],as_index=False).agg({'frame': list}) +df['frame'] = df['frame'].apply(np.sort) +df['list_len'] = df['frame'].apply(len) # auxiliary column -> length of the list + +# merge records with the same name and frame but different line number -> sum memory sizes and counts +df = df.groupby(['name', 'list_len'],as_index=False).agg({'line_no': list, 'mem_size': sum, 'count':sum, 'frame':'first'}) + +# sort by memory size (put inter-frame memory blocks to the bottom) +select_inter = (df['list_len'] == 2) & (df.apply(lambda row : row['frame'][-1] - row['frame'][0], axis = 1) >= Nframes) +df_inter = df[select_inter] +df_inter = df_inter.sort_values(by=['mem_size'], ascending=False) +df_intra = df[~select_inter] +df_intra = df_intra.sort_values(by=['list_len'], ascending=True) + +# plot inter-frame memory blocks in horizontal bar graph (use .broken_barh method) +fig, ax = plt.subplots() +colors = iter(plt.cm.rainbow(np.linspace(0, 1, len(df.index)))) +y_ticks = [] +y_tick_labels = [] +y_low = 1 +for index, row in df_inter.iterrows(): + l = f"{row['name']} on lines: {row['line_no']}, total memory size: {row['count']}x{row['mem_size']}" + fms = row['frame'].reshape((-1,2)) # convert frame numbers to two-column format + fms[:,1] -= fms[:,0] # second column should now represent the duration of the segment + fmsT = fms.T + fms_list = list(zip(fmsT[0], fmsT[1])) + c = next(colors) + ax.broken_barh(xranges=fms_list, yrange=(y_low, row['count']), label=l, color=c) + y_ticks.append(y_low + 0.5 * row['count']) + y_tick_labels.append(row['name']) + y_low += row['count'] + 0.5 + print(l + f", {row['count'] * fms.shape[0]/Nframes:.3f} mallocs per frame") + +# plot intra-frame memory blocks in horizontal bar graph (use .broken_barh method) +df_intra = df_intra.groupby(['name'],as_index=False).agg({'list_len': list, 'line_no': list, 'mem_size': list, 'count': list, 'frame': list}) +for index, row in df_intra.iterrows(): + # repeat for all grouped memory records in the row + for j in range(len(row['list_len'])): + l = f"{row['name']} on lines: {row['line_no'][j]}, total memory size: {row['count'][j]}x{row['mem_size'][j]}" + fms = row['frame'][j].astype(float).reshape((-1,2)) # convert frame numbers to two-column format + fms[:,1] -= fms[:,0] # second column should now represent the duration of the segment + idx_zero = fms[:,1] == 0 # find zero-length segments -> these are intra-frame memory blocks + fms[idx_zero, 0] += 0.1 + fms[idx_zero, 1] = 0.8 + fmsT = fms.T + fms_list = list(zip(fmsT[0], fmsT[1])) + c = next(colors) + ax.broken_barh(xranges=fms_list, yrange=(y_low, row['count'][j]), label=l, color=c, alpha=0.6) + print(l + f", {row['count'][j] * fms.shape[0]/Nframes:.3f} mallocs per frame") + y_ticks.append(y_low + 0.5 * max(row['count'])) + y_tick_labels.append(row['name']) + y_low += max(row['count']) + 0.5 + +ax.set_yticks(y_ticks) +ax.set_yticklabels(y_tick_labels) +ax.set_ylabel('Memory size') +ax.set_xlabel('Frame') +ax.set_title('Memory analysis') + +# shrink current axis's height by 20% on the bottom to fit the legend +box = ax.get_position() +ax.set_position([box.x0, box.y0 + box.height * 0.2, box.width, box.height * 0.8]) + +# insert the legend below the graph +ax.legend(loc="upper left", bbox_to_anchor=(0, -0.1), ncol=2, borderaxespad=0, fontsize='small') + +# magnify to "almost" fullscreen size (select the alternative for your backend) +fig = plt.gcf() +fig.set_size_inches(15, 9) # we need to set the size manually, otherwise savefig will save the figure in the default size +mng = plt.get_current_fig_manager() +mng.full_screen_toggle() +# mng.frame.Maximize(True) +# mng.window.showMaximized() +# mng.window.state('zoomed') + +# show and save the figure (use block=True to wait until Figure is closed manually) +plt.savefig(os.path.splitext(args.input)[0] + '.png', dpi=100, bbox_inches='tight') +plt.show(block=True) diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index cadf4bc47a2be1f9bf0b5f3707c7ddb3fe600d09..c748f19aca4745df84b90a3e7132235fdfa36555 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -87,8 +87,9 @@ fi # strip switches, to remove the macros (turn on extended globing to allow !(pattern*) matching) shopt -s extglob if coan_exists; then - # remove WMOPS from the list -> otherwise it will be removed with coan and wmc_auto.h will not see it + # 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/lib_{com,dec,enc,rend,util,debug}/!(wmc_auto*).[hc] coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/apps/*.[hc] @@ -105,8 +106,8 @@ find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(u "tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null # automatically enable #define WMOPS in options.h -sed -i.bak -e "s/\/\*\s*\(#define\s*WMOPS\)\s*\*\//\1/g" $targetdir/lib_com/options.h -sed -i.bak -e "s/\/\/\s*\(#define\s*WMOPS\)/\1/g" $targetdir/lib_com/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" diff --git a/scripts/prepare_mem_dryrun.py b/scripts/prepare_mem_dryrun.py old mode 100644 new mode 100755 index 21f5b8114592067bdb0b9d04d00fa9bb20c22227..20da546c198953c47a9848806a8d1b106d65c478 --- a/scripts/prepare_mem_dryrun.py +++ b/scripts/prepare_mem_dryrun.py @@ -1,4 +1,4 @@ -#!/bin/python3 +#!/usr/bin/env python3 import re, os, fnmatch @@ -16,6 +16,7 @@ for d in dirs: with open(fileIn, 'r') as f_in: lines = f_in.readlines() with open(fileIn, 'w') as f_out: + skip = 0 for line in lines: if re.search(r'#define\W+WMC_TOOL_SKIP', line): skip = 1 diff --git a/scripts/pyaudio3dtools/BRIRs_mat/IIS_BRIR_officialMPEG_222UC_SBA3.mat b/scripts/pyaudio3dtools/BRIRs_mat/IIS_BRIR_officialMPEG_222UC_SBA3.mat deleted file mode 100644 index 5bc7464f7f5e8e76cd848e52e2c389cfd722b6f3..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/BRIRs_mat/IIS_BRIR_officialMPEG_222UC_SBA3.mat +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b41a527b6ba22b4c100265655ca801ee4d2dba3c3e03dc58f7cc5d99e397d2c3 -size 11795531 diff --git a/scripts/pyaudio3dtools/BRIRs_mat/IIS_BRIR_officialMPEG_222UC_combined.mat b/scripts/pyaudio3dtools/BRIRs_mat/IIS_BRIR_officialMPEG_222UC_combined.mat deleted file mode 100644 index 61ba946617a5c35cb56e32814b40f4e728ecdafd..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/BRIRs_mat/IIS_BRIR_officialMPEG_222UC_combined.mat +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:081a9053c8b04831d97e6f18d641d4737b2c23b076778a9b41c7b3a41d954c32 -size 6348446 diff --git a/scripts/pyaudio3dtools/BRIRs_mat/IIS_BRIR_officialMPEG_222UC_full.mat b/scripts/pyaudio3dtools/BRIRs_mat/IIS_BRIR_officialMPEG_222UC_full.mat deleted file mode 100644 index 440c8aedd677937f558767742a7b5a66ea13bb61..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/BRIRs_mat/IIS_BRIR_officialMPEG_222UC_full.mat +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0544d1cf80a7cceb156760107d81b10fd787807bb0ea1e74e9aeb552474b3373 -size 13233924 diff --git a/scripts/pyaudio3dtools/EFAP.py b/scripts/pyaudio3dtools/EFAP.py deleted file mode 100644 index dcc615355ed32dcbc06990d090d08cffaf9a29c0..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/EFAP.py +++ /dev/null @@ -1,929 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. - - This software is protected by copyright law and by international treaties. - The Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership - rights in their respective contributions in the software. No license of any kind, including but not - limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or - otherwise. - - 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/or 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. -""" - -import argparse -import os -from enum import Enum -from itertools import combinations -from typing import Optional, Tuple, Union - -import numpy as np - - -def wrap_angles( - azi: float, ele: float, clip_ele: Optional[bool] = False -) -> Tuple[float, float]: - """ - Wrap angles to (-180, 180] azimuth and [-90, 90] elevation - Takes into account hemisphere flips from large elevation changes unless clip_ele is specified - """ - if clip_ele: - ele = min(max(ele, -90), 90) - - if ele != 0 and ele % 90 == 0: - # if elevation is a multiple of 90, azimuth is irrelevant since we are at a pole - azi = 0 - while np.abs(ele) > 90: - ele -= 360 - else: - # wrap elevation value - while np.abs(ele) > 90: - # flip azimuth to other hemisphere - azi += 180 - - # compensate elevation accordingly - if ele > 90: - ele -= 180 - elif ele < -90: - ele += 180 - - # wrap azimuth value - while np.abs(azi) > 180: - azi = (azi + 180) % 360 - if azi < 0: - azi += 360 - azi -= 180 - - # set -180 azimuth to 180 - if azi == -180: - azi = 180 - - return azi, ele - - -class EfapDmxType(Enum): - NONE = 0 - AMPLITUDE = 1 - INTENSITY = 2 - - -class EfapVertex: - """ - Vertex data structure for EFAP - Initialises a vertex from the given spherical coordinate pair, with a flag specifying if it is a ghost loudspeaker - - - Parameters - ---------- - azi : float - Azimuth of vertex - ele : float - Elevation of vertex - is_ghost : bool - Whether the vertex is a ghost, default is False - dmx_type : EfapDmxType - Downmix type for ghost vertices - """ - - def __init__( - self, - azi: float, - ele: float, - is_ghost: Optional[bool] = False, - dmx_type: Optional[EfapDmxType] = EfapDmxType.INTENSITY, - ): - self.azi, self.ele = wrap_angles(azi, ele) - self.pos = np.array( - [ - np.cos(np.deg2rad(azi)) * np.cos(np.deg2rad(ele)), - np.sin(np.deg2rad(azi)) * np.cos(np.deg2rad(ele)), - np.sin(np.deg2rad(ele)), - ] - ) - - idx_azi = np.round(np.abs(90 - np.abs(self.azi))) - idx_ele = 90 - np.round(np.abs(self.ele)) - self.index = ( - idx_azi + 181 * idx_ele - ) # vertices on the median plane have lowest index - - self.is_ghost = is_ghost - self.dmx_type = dmx_type - - def __str__(self): - str_ = f"a{self.azi}e{self.ele}" - if self.is_ghost: - str_ += "*" - return str_ - - def __lt__(self, other): - return self.index < other.index - - -class EFAP: - """ - EFAP data structure - - Initialise EFAP data for computing panning gains - - - Parameters - ---------- - azimuths : np.ndarray - Azimuth positions of the loudspeaker array - elevations : npndarray - Elevation postions of the loudspeaker array - intensity_panning : bool - Whether intensity panning is enabled or not - - Examples - -------- - - >>> from EFAP import EFAP - >>> panner = EFAP([30, -30, 0, 110, -110], [0, 0, 0, 0, 0], False) - >>> panner.pan(15, 45) - array([0.66742381, 0.19069252, 0.66742381, 0.19069252, 0.19069252]) - - """ - - _EFAP_HULL_TOL = 1e-4 # tolerance for a point to be added to the convex hull - _EFAP_MAX_AZI_GAP = 160 # maximum allowed angular gap in the middle layer - _EFAP_POLAR_ELE = 90 # elevation of north / south poles (zenith / nadir) - _EFAP_THRESH_COPLANAR = 1e-3 # tolerance for points to be considered coplanar - _EFAP_THRESH_MID_LAYER = 45 # elevation threshold for loudspeakers to be considered as in the middle layer - _EFAP_THRESH_POLES = 1e-6 # tolerance for a vertex to be considered polar - _EFAP_THRESH_TRI = 1e-10 # tolerance for a point to be inside a triangle - - def __init__( - self, - azimuths: Union[list, np.ndarray], - elevations: Union[list, np.ndarray], - intensity_panning: Optional[bool] = False, - ): - # validation - azimuths = np.array(azimuths) - elevations = np.array(elevations) - if np.squeeze(azimuths).ndim > 1: - raise ValueError("Too many dimensions for loudspeaker azimuth array") - if np.squeeze(elevations).ndim > 1: - raise ValueError("Too many dimensions for loudspeaker elevations array") - if azimuths.shape != elevations.shape: - raise ValueError("Mismatch between loudspeaker azimuths and elevations") - - # set EFIP flag - self.intensity_panning = intensity_panning - - # initialise vertices and add ghost loudspeakers if needed - self.verts = np.array( - [EfapVertex(azi, ele) for azi, ele in zip(azimuths, elevations)] - ) - self._add_ghost_speakers() - - # formulate initial tetrahedron for the convex hull - self._init_simplex() - - # add the remaining vertices to the convex hull in order of their index - for i in np.argsort(self.verts): - if self.verts[i] not in self.verts[self.tris]: - self._add_vertex_to_hull(i) - - # compute downmix matrix with remapped ghost speakers - self._remap_ghost_speakers() - - # set vertices near poles to have NaN azimuth - for v in self.verts: - if ( - v.ele > self._EFAP_POLAR_ELE - self._EFAP_THRESH_POLES - or v.ele < self._EFAP_THRESH_POLES - self._EFAP_POLAR_ELE - ): - v.azi = np.nan - - # combine triangles into polygons - self._tri2poly() - - def _add_ghost_speakers(self) -> None: - """ - Add ghost loudspeakers at the poles, or to fill large horizontal gaps - """ - ele = [v.ele for v in self.verts] - - dmx_type = EfapDmxType.INTENSITY - - # add ghost loudspeakers at the poles if necessary - if max(ele) < self._EFAP_POLAR_ELE: - - if self.intensity_panning: - if max(ele) > self._EFAP_THRESH_MID_LAYER: - dmx_type = EfapDmxType.NONE - else: - dmx_type = EfapDmxType.AMPLITUDE - - self.verts = np.append(self.verts, EfapVertex(0, 90, True, dmx_type)) - - if min(ele) > -self._EFAP_POLAR_ELE: - - if self.intensity_panning: - if min(ele) < -self._EFAP_THRESH_MID_LAYER: - dmx_type = EfapDmxType.NONE - else: - dmx_type = EfapDmxType.AMPLITUDE - - self.verts = np.append(self.verts, EfapVertex(0, -90, True, dmx_type)) - - # check for large gaps in the middle horizontal layer - mid_spkrs = [ - v.azi for v in self.verts if np.abs(v.ele) < self._EFAP_THRESH_MID_LAYER - ] - - # no speakers in middle layer; add a triangle of ghost speakers - if not mid_spkrs: - self.verts = np.append( - self.verts, - [ - EfapVertex(0, 0, True), - EfapVertex(180, 0, True), - EfapVertex(240, 0, True), - ], - ) - # only one speaker in the threshold; add two ghost speakers to form a triangle - elif len(mid_spkrs) == 1: - self.verts = np.append( - self.verts, - [ - EfapVertex(mid_spkrs[0] + 120, 0, True), - EfapVertex(mid_spkrs[0] + 240, 0, True), - ], - ) - # search for and fill gaps greater than MAX_AZI_GAP - else: - mid_spkrs = np.sort(mid_spkrs) - angle_diff = np.diff(np.concatenate([mid_spkrs, [mid_spkrs[0] + 360]])) - sectors = np.ceil(angle_diff / self._EFAP_MAX_AZI_GAP) - - for i, s in enumerate(sectors): - if s > 1: - new_diff = angle_diff[i] / s - num_new = s - 1 - for k in range(int(num_new)): - new_azi = mid_spkrs[i] + (k + 1) * new_diff - self.verts = np.append(self.verts, EfapVertex(new_azi, 0, True)) - - def _init_simplex(self) -> None: - """ - Create an initial tetrahedron / simplex for the convex hull from 4 vertices - """ - # take the first vertex as seed - t = [0] - - # attempt to form an edge with non-zero length - for i, v in enumerate(self.verts): - if ( - v.azi != self.verts[t[0]].azi or v.ele != self.verts[t[0]].ele - ) and i not in t: - t.append(i) - break - else: - raise ValueError("Vertices are conincident!") - - # attempt to form a triangle with non-zero area - for i, v in enumerate(self.verts): - if ( - np.linalg.norm( - np.cross( - self.verts[t[1]].pos - self.verts[t[0]].pos, - v.pos - self.verts[t[0]].pos, - ), - 2, - ) - > self._EFAP_HULL_TOL - and i not in t - ): - t.append(i) - break - else: - raise ValueError("Vertices are colinear!") - - # attempt to form a tetrahedron with non-zero volume - for i, v in enumerate(self.verts): - if ( - np.abs( - np.dot( - np.cross( - self.verts[t[1]].pos - self.verts[t[0]].pos, - self.verts[t[2]].pos - self.verts[t[0]].pos, - ), - v.pos - self.verts[t[0]].pos, - ) - ) - ) > self._EFAP_HULL_TOL and i not in t: - t.append(i) - break - else: - raise ValueError("Vertices are coplanar!") - - # create a list of the triangles of the initial simplex / tetrahedron - t = np.array(t) - self.tris = np.array([t[[0, 1, 2]], t[[0, 1, 3]], t[[0, 2, 3]], t[[1, 2, 3]]]) - - # orient the triangle surface planes outwards from the centroid - self.centroid = np.mean([self.verts[i].pos for i in t], axis=0) - for i, tri in enumerate(self.tris): - self.tris[i, :] = self._flip_plane(tri) - - def _add_vertex_to_hull(self, idx_new_vert: int) -> None: - """ - Add a vertex to the convex hull and update the list of triangles in the hull - """ - # compute the centroid of the current convex hull - self.centroid = np.mean( - [self.verts[i].pos for i in np.unique(self.tris)], axis=0 - ) - - tris_new = [] - visible = [] - - # find which hull surfaces are visible from the new vertex - for i, tri in enumerate(self.tris): - if self._vertex_dist(tri, idx_new_vert) > -1e-6: - visible.append(i) - else: - tris_new.append(tri) - - tris_new = np.array(tris_new) - visible = np.array(visible, dtype=int) - - # find edges of the visible hull surfaces - max_vert = np.amax(self.tris[visible]) + 1 - counter = np.zeros([max_vert, max_vert]) - for i, tri in enumerate(self.tris[visible]): - surface = np.append(tri, tri[0]) - for n in range(3): - a = surface[n] - b = surface[n + 1] - counter[a, b] = counter[a, b] + 1 - - counter += counter.T - - edges = [] - for a in range(max_vert - 1): - for b in range(a + 1, max_vert): - if counter[a, b] == 1: - edges.append([a, b]) - edges = np.vstack(edges) - - # break the edges visible from the new vertex and add the new triangle - for e in edges: - tris_new = np.vstack( - [tris_new, self._flip_plane(np.append(e, idx_new_vert))] - ) - - # update the list of triangles in the convex hull - self.tris = tris_new - - def _remap_ghost_speakers(self) -> None: - """ - Remove unused ghost speakers and compute a downmix matrix for the rest - """ - # find ghosts that are not part of the convex hull - ghosts = [i for i, v in enumerate(self.verts) if v.is_ghost] - unused_ghosts = np.compress( - np.isin(ghosts, np.unique(self.tris), invert=True), ghosts - ) - - if unused_ghosts.size > 0: - # remove the unused ghosts from the triangle array and also adjust indices - self.tris[self.tris > unused_ghosts.min()] -= unused_ghosts.size - # delete them from the vertex array - self.verts = np.delete(self.verts, unused_ghosts) - - # generate initial sound energy distribution matrix - n_vtx = len(self.verts) - n_ghost = len(ghosts) - len(unused_ghosts) - - M = np.eye(n_vtx) - for i, v in enumerate(self.verts): - if v.is_ghost: - neighbours = self._get_neighbours(i) - M[:, i] = np.zeros(n_vtx) - M[neighbours, i] = np.ones(len(neighbours)) / len(neighbours) - - # re-distribute sound energy from ghosts - M2 = M.copy() - for i, v in enumerate(self.verts): - if v.is_ghost: - vec = M[:, i] - while np.sum(vec[-n_ghost:]) > 1e-4: - vec = M @ vec - M2[:, i] = vec - - self.dmx_mat = M2[:-n_ghost, :] - - # amplitude downmix for real loudspeakers - self.dmx_mat[:, :-n_ghost] = np.sqrt(self.dmx_mat[:, :-n_ghost]) - - # distribute ghosts according to downmix type - for i, v in enumerate(self.verts): - if v.is_ghost: - if v.dmx_type == EfapDmxType.NONE: - self.dmx_mat[:, i] = 0 - elif v.dmx_type == EfapDmxType.AMPLITUDE: - pass - else: - self.dmx_mat[:, i] = np.sqrt(self.dmx_mat[:, i]) - - def _tri2poly(self) -> None: - """ - Merge hull triangles into polygons if they are coplanar - """ - polys = [] - - for tri in self.tris: - # find all vertices coplanar with this triangle (including those already in the triangle) - new_poly = np.array( - [ - i - for i, _ in enumerate(self.verts) - if np.abs(self._vertex_dist(tri, i)) < self._EFAP_THRESH_COPLANAR - ] - ) - - # check if we already found this polygon as a complete subset - is_subset = [ - i for i, poly in enumerate(polys) if np.all(np.isin(new_poly, poly)) - ] - is_superset = [ - i for i, poly in enumerate(polys) if np.all(np.isin(poly, new_poly)) - ] - - if is_subset: - continue - elif is_superset: - # remove the other polygon since it will be replaced by the superset polygon - polys_new = [p for i, p in enumerate(polys) if i not in is_superset] - polys = polys_new - - # orient the polygon plane in the same direction as the triangle - P1 = self.verts[tri[0]].pos - P2 = self.verts[tri[1]].pos - P3 = self.verts[tri[2]].pos - - # first base vector - U = P2 - P1 - U = U / np.linalg.norm(U) - - # second base vector - V = P3 - P2 - V = V - np.dot(U, V) * U - V = V / np.linalg.norm(V) - - # center of the first triangle - M = np.mean([P1, P2, P3], axis=0) - - # sort vertices - azi = np.zeros_like(new_poly, dtype=float) - for i, idx_v in enumerate(new_poly): - P = self.verts[idx_v].pos - M - X = np.dot(P, U) - Y = np.dot(P, V) - azi[i] = np.arctan2(Y, X) - - idx = np.argsort(azi) - new_poly = new_poly[idx] - - # add the polygon to the main list - polys.append(new_poly) - - self.polys = polys - - def _pan_EFAP_poly( - self, azimuth: float, elevation: float, poly: np.ndarray, mod: int - ) -> np.ndarray: - """ - Compute panning gains for each vertex in the given polygon - - - Parameters - ---------- - azimuth : float - Azimuth of requested panning position - elevation : float - Elevation of requested panning position - poly : np.ndarray - Array of vertices defining the polygon - - Returns - ------- - poly_gain: np.ndarray - Gains for each vertex in the polygon - """ - poly_gain = np.zeros_like(poly, dtype=float) - - P = np.array([azimuth, elevation]) - # search for the triangle of the polygon in which P belongs - for i in range(1, poly.size + 1): - A = np.array([self.verts[poly[i - 1]].azi, self.verts[poly[i - 1]].ele]) - for j in range(i, poly.size - 2 + i): - idx1 = 1 + (j % poly.size) - idx2 = 1 + (idx1 % poly.size) - B = np.array( - [self.verts[poly[idx1 - 1]].azi, self.verts[poly[idx1 - 1]].ele] - ) - C = np.array( - [self.verts[poly[idx2 - 1]].azi, self.verts[poly[idx2 - 1]].ele] - ) - - if mod: - if not np.isnan(A[0]): - A[0] %= mod - if not np.isnan(B[0]): - B[0] %= mod - if not np.isnan(C[0]): - C[0] %= mod - - if self._in_triangle(P, A, B, C): - N = np.transpose([B[1] - C[1], C[0] - B[0]]) - N = N / np.dot(N, B - A) - poly_gain[i - 1] = 1 - np.dot(P - A, N) - - """ DEBUGGING / TODO """ - # set gains <= -60dB to 0 - poly_gain[np.abs(poly_gain) < 1e-6] = 0 - - return poly_gain - - """ geometric / math helper functions """ - - def _get_neighbours(self, idx_vert: int) -> np.ndarray: - """ - Find triangles containing the given vertex index (neighbouring vertices) - """ - n = self.tris[np.any(np.isin(self.tris, idx_vert), axis=1)] - return np.unique(n[n != idx_vert]) - - def _get_azi_ele(self, idx_vert: int) -> Tuple[float, float]: - """ - Return a tuple of (azi, ele) for a vertex at the given index - """ - return self.verts[idx_vert].azi, self.verts[idx_vert].ele - - def _in_polygon( - self, azimuth: float, elevation: float, poly: np.ndarray - ) -> Tuple[bool, int]: - """ - Determine whether the panning position lies within the given polygon - by iteratively checking its triangles - - Parameters - ---------- - azimuth : float - Azimuth of requested panning position - elevation : float - Elevation of requested panning position - poly : np.ndarray - Array of vertices defining the polygon - - Returns - ------- - in_polygon, mod: Tuple[bool, int] - Flag indicating whether the point is inside the given polygon - Value of wrapping required if used - """ - azi = [self.verts[v].azi for v in poly] - - P = np.array([azimuth, elevation]) - - for tri in combinations(poly, 3): - A = np.array(self._get_azi_ele(tri[0])) - B = np.array(self._get_azi_ele(tri[1])) - C = np.array(self._get_azi_ele(tri[2])) - if self._in_triangle(P, A, B, C): - return True, None - - # if the azimuth difference is large, perform the 2D check again with azimuths wrapped to (-360, 0] and [0, 360) - if np.nanmax(azi) - np.nanmin(azi) > 180: - for tri in combinations(poly, 3): - A = np.array(self._get_azi_ele(tri[0])) - B = np.array(self._get_azi_ele(tri[1])) - C = np.array(self._get_azi_ele(tri[2])) - if not np.isnan(A[0]): - A[0] %= 360 - if not np.isnan(B[0]): - B[0] %= 360 - if not np.isnan(C[0]): - C[0] %= 360 - if self._in_triangle(P, A, B, C): - return True, 360 - - for tri in combinations(poly, 3): - A = np.array(self._get_azi_ele(tri[0])) - B = np.array(self._get_azi_ele(tri[1])) - C = np.array(self._get_azi_ele(tri[2])) - if not np.isnan(A[0]): - A[0] %= -360 - if not np.isnan(B[0]): - B[0] %= -360 - if not np.isnan(C[0]): - C[0] %= -360 - if self._in_triangle(P, A, B, C): - return True, -360 - - return False, None - - def _in_triangle( - self, P: np.ndarray, A: np.ndarray, B: np.ndarray, C: np.ndarray - ) -> bool: - """ - Determine whether the panning position lies within the given triangle - - Parameters - ---------- - P : float - Point under test - A : float - First vertex of the triangle - B : float - Second vertex of the triangle - C : float - Third vertex of the triangle - - - Returns - ------- - bool - Flag indicating whether the point is inside the given triangle - """ - if np.isnan(A[0]): - A[0] = P[0] - - if np.isnan(B[0]): - B[0] = P[0] - - if np.isnan(C[0]): - C[0] = P[0] - - tmpMat = np.transpose([B - A, C - A]) - if (1 / np.linalg.cond(tmpMat)) < self._EFAP_THRESH_TRI: - return False - - Minv = np.linalg.inv(tmpMat) - S = Minv @ (P - A) - - if ( - S[0] < -self._EFAP_THRESH_TRI - or S[1] < -self._EFAP_THRESH_TRI - or S[0] + S[1] > 1 + self._EFAP_THRESH_TRI - ): - return False - - return True - - def _vertex_dist(self, surface: np.ndarray, idx_vert: int) -> float: - """ - Compute the distance of a vertex from a given plane - - Parameters - ---------- - surface : np.ndarray - Array of 3 ordered vertices defining the plane and its orientation - idx_vert: int - Index of the vertex to compute the distance for - - Returns - ------- - float - Distance of the vertex from the given plane - """ - return self._point_plane_dist( - self.verts[surface[0]].pos, - self.verts[surface[1]].pos, - self.verts[surface[2]].pos, - self.verts[idx_vert].pos, - ) - - def _point_plane_dist( - self, P1: np.ndarray, P2: np.ndarray, P3: np.ndarray, X: np.ndarray - ) -> float: - """ - Compute the distance of a vertex from a plane defined by three points - - Parameters - ---------- - P1 : np.ndarray - Cartesian coordinates of the first point - P2 : np.ndarray - Cartesian coordinates of the second point - P3 : np.ndarray - Cartesian coordinates of the third point - X: np.ndarray - Cartesian coordinates of the vertex - - Returns - ------- - float - Distance of the vertex from the given plane - """ - - if np.all(X == P1) or np.all(X == P2) or np.all(X == P3): - return 0 - else: - N = np.cross(P1 - P2, P1 - P3) - return np.dot(X - P1, N / np.linalg.norm(N)) - - def _flip_plane(self, surface: np.ndarray) -> np.ndarray: - """ - Flip the orientation of a plane (invert normal vector) - - Parameters - ---------- - surface : np.ndarray - Array of 3 ordered vertices defining the plane and its orientation - - Returns - ------- - surface : np.ndarray - Reordered vertices with plane normal pointing outwards from the hull centroid - """ - if ( - self._point_plane_dist( - self.verts[surface[0]].pos, - self.verts[surface[1]].pos, - self.verts[surface[2]].pos, - self.centroid, - ) - > 0 - ): - surface = np.flip(surface.copy()) - - return surface - - def _compute_gains_point(self, azimuth: float, elevation: float) -> np.ndarray: - """ - Compute gains for the requested panning position - - - Parameters - ---------- - azimuth : float - Azimuth of requested panning position - elevation : float - Elevation of requested panning position - - Returns - ------- - gains: np.ndarray - Panning gains for the loudspeaker layout - """ - if np.isnan(azimuth) or np.isnan(elevation): - raise ValueError(f"Angles cannot be NaNs : ({azimuth}, {elevation})") - - azimuth, elevation = wrap_angles(azimuth, elevation) - point_pos = [ - np.cos(np.deg2rad(azimuth)) * np.cos(np.deg2rad(elevation)), - np.sin(np.deg2rad(azimuth)) * np.cos(np.deg2rad(elevation)), - np.sin(np.deg2rad(elevation)), - ] - - # filter the polygon list with a quick 2d check - found_polys = [] - for poly in self.polys: - in_poly, mod = self._in_polygon(azimuth, elevation, poly) - if in_poly: - found_polys.append((poly, mod)) - - if not found_polys: - raise AssertionError("Unexpected error during panning") - - # find a visible polygon with the smallest distance - dist = [] - - for poly, mod in found_polys: - surface = self.verts[poly] - d = self._point_plane_dist( - surface[0].pos, - surface[1].pos, - surface[2].pos, - point_pos, - ) - if d >= 0: - dist.append(d) - else: - dist.append(np.inf) - - found_poly, mod = found_polys[np.argmin(dist)] - - # compute gains for the polygon vertices - poly_gain = self._pan_EFAP_poly(azimuth, elevation, found_poly, mod) - - # downmix ghost loudspeakers - gains = np.zeros(self.verts.size) - gains[found_poly] = poly_gain / np.linalg.norm(poly_gain) - gains = gains @ self.dmx_mat.T - gains = gains / np.linalg.norm(gains) - - if self.intensity_panning: - gains = np.sqrt(gains / np.sum(gains)) - - return gains - - """ public functions """ - - def pan( - self, azimuths: float, elevations: float, intensity_panning: bool = False - ) -> np.ndarray: - """ - Compute gains for the requested panning position - - - Parameters - ---------- - azimuth : float - Azimuth of requested panning position - elevation : float - Elevation of requested panning position - intensity_panning : bool - Flag whether to use intensity panning (Default is False == amplitude panning) - - Returns - ------- - gains: np.ndarray - Panning gains for the loudspeaker layout - """ - azimuths = np.array(azimuths) - elevations = np.array(elevations) - if azimuths.size == 1 and elevations.size == 1: - return self._compute_gains_point(azimuths, elevations) - elif np.squeeze(azimuths).ndim == 1 and np.squeeze(elevations).ndim == 1: - gains = [] - for a, e in zip(azimuths, elevations): - gains.append(self._compute_gains_point(a, e)) - return np.vstack(gains) - else: - raise ValueError( - "Azimuth and Elevation arrays cannot have more than one dimension and must be of equal size" - ) - - -def main(args): - """ - Parses a speaker layout text file and prints the panning gains - for the requested position - - - Parameters - ---------- - args : tuple - Command line arguments - - """ - - speaker_positions = np.loadtxt( - os.path.abspath(args.input), delimiter=",", max_rows=2 - ) - panner = EFAP(speaker_positions[0, :], speaker_positions[1, :], args.efip) - print(panner.pan(args.azimuth, args.elevation)) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Edge-Fading Amplitude Panning") - parser.add_argument( - "-i", - "--input", - metavar="layout_file", - required=True, - type=str, - help="IVAS compatible loudspeaker layout file (Loudspeaker azimuths in first line, elevations in second, subsequent lines are ignored)", - ) - parser.add_argument( - "-efip", - "-intensity_panning", - default=False, - action="store_true", - help="Intensity panning mode (EFIP)", - ) - parser.add_argument( - "azimuth", - type=float, - help="Azimuth of direction to compute panning gains for (positive-left)", - ) - parser.add_argument( - "elevation", - type=float, - help="Elevation of direction to compute panning gains for (positive-up)", - ) - args = parser.parse_args() - main(args) diff --git a/scripts/pyaudio3dtools/HRIRs_mat/ORANGE_HRIR_53_48000_SBA3.mat b/scripts/pyaudio3dtools/HRIRs_mat/ORANGE_HRIR_53_48000_SBA3.mat deleted file mode 100644 index 0d113a34af498f3c981c6e2d4a59e8dc304851c6..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/HRIRs_mat/ORANGE_HRIR_53_48000_SBA3.mat +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:02c8a25178b36399054c1802f00bb5a8739f3ac950c21b0c760c046b1dba530d -size 36201 diff --git a/scripts/pyaudio3dtools/HRIRs_mat/ORANGE_HRIR_53_48000_combined.mat b/scripts/pyaudio3dtools/HRIRs_mat/ORANGE_HRIR_53_48000_combined.mat deleted file mode 100644 index e52e031e8c2858501b29b36344144fd9d03f9760..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/HRIRs_mat/ORANGE_HRIR_53_48000_combined.mat +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9660be83192f7babb4f67e19653a94bc02cee7b3071065880cf618547c19d842 -size 20138 diff --git a/scripts/pyaudio3dtools/HRIRs_mat/ORANGE_HRIR_53_48000_full.mat b/scripts/pyaudio3dtools/HRIRs_mat/ORANGE_HRIR_53_48000_full.mat deleted file mode 100644 index f2c22c39ec4f7f176f82f3a198b3ac91954d98fa..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/HRIRs_mat/ORANGE_HRIR_53_48000_full.mat +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:05ae461fc303c8498d5912ebe37cd1601c077c2505baf3da3dbe12b37e8f2cf0 -size 14097574 diff --git a/scripts/pyaudio3dtools/__init__.py b/scripts/pyaudio3dtools/__init__.py index 9870fb6620c859e7e7195c8dae52d16d67841713..33a5d39126901fd6a7f2b2d04168d09cf83ad151 100644 --- a/scripts/pyaudio3dtools/__init__.py +++ b/scripts/pyaudio3dtools/__init__.py @@ -43,10 +43,5 @@ class from . import ( audioarray, audiofile, - binauralrenderer, - hoadecoder, - spatialaudioconvert, spatialaudioformat, - spatialmetadata, ) -from .EFAP import EFAP diff --git a/scripts/pyaudio3dtools/audio3dtools.py b/scripts/pyaudio3dtools/audio3dtools.py index a325a433b5c323e04b4d7f9280edad46c58b698b..cfb7acb9f566d7c4a31b6607c120d2bc5571022e 100755 --- a/scripts/pyaudio3dtools/audio3dtools.py +++ b/scripts/pyaudio3dtools/audio3dtools.py @@ -36,8 +36,6 @@ import os from pyaudio3dtools import ( audiofile, - binauralrenderer, - spatialaudioconvert, spatialaudioformat, ) @@ -47,241 +45,10 @@ logger.setLevel(logging.DEBUG) def main(): - parser = argparse.ArgumentParser( - description="Audio3DTools: Convert/Manipulate spatial audio files." + print( + f"These scripts have been deprecated! Please check out and use the latest version from https://forge.3gpp.org/rep/ivas-codec-pc/ivas-processing-scripts.git" ) - """ Required arguments """ - parser.add_argument( - "-i", - "--infiles", - required=True, - type=str, - help="input file *.wav or *.pcm or directory", - default=None, - ) - parser.add_argument( - "-o", - "--outdir", - required=True, - type=str, - help="output file *.wav or directory", - default="out", - ) - parser.add_argument( - "-f", - "--informat", - required=True, - type=str, - metavar="INFORMAT", - help="Input format (use -l/-L for a list)", - default=None, - ) - - """ Additional arguments """ - parser.add_argument( - "-F", - "--outformat", - type=str, - metavar="OUTFORMAT", - help="Output format (default = %(default)s, same as input format). Can be a custom loudspeaker layout file.", - default=None, - ) - parser.add_argument( - "-s", - "--infs", - type=int, - help="Input sampling rate (Hz) (default = %(default)s, deduced for input file)", - default=None, - ) - parser.add_argument( - "-S", - "--outfs", - type=int, - help="Output sampling rate (Hz) (default = %(default)s, same as input)", - default=None, - ) - parser.add_argument( - "-c", - "--inchan", - type=int, - help="Input number of channels (default = %(default)s, deduced for input file)", - default=None, - ) - parser.add_argument( - "-m", - "--metadata", - type=str, - nargs="+", - help="list of input metadata files (only relevant for ISM and MASA input)", - default=None, - ) - parser.add_argument( - "-fc", - "--outfc", - type=int, - help="Cut-off freq for eventual low-pass filtering (default = %(default)s)", - default=None, - ) - parser.add_argument( - "-T", - "--trajectory", - type=str, - help="Head-tracking trajectory file (default = %(default)s)", - default=None, - ) - parser.add_argument( - "-n", - "--normalize", - default=None, - type=int, - help="Normalize to given loudness with --LOUDNESS_TOOL (default = %(default)s)", - ) - - """ Miscellaneous or meta arguments """ - parser.add_argument( - "-b", - "--binaural", - help="Binauralize output *in addition to converting to output format", - action="store_true", - ) - parser.add_argument( - "--binaural_dataset", - type=str, - help="Dataset to use for binaural rendering (default = %(default)s)", - choices=["orange51", "orange52", "orange53", "orange54", "sadie"], - default="orange53", - ) - parser.add_argument( - "-l", - "--list", - help="list all supported spatial audio formats", - action="store_true", - ) - parser.add_argument( - "-L", - "--long", - help="list all supported spatial audio formats with long description", - action="store_true", - ) - parser.add_argument( - "-lt", - "--loudness_tool", - default="bs1770demo", - type=str, - help="Loudness tool to use: bs1770demo [default] or sv56demo (tool must be in $PATH or a path to the binary)", - ) - parser.add_argument( - "-rn", - "--dont-rename", - help="Disable default behaviour of renaming output files _.", - action="store_true", - ) - args = parser.parse_args() - - # Set up logging handlers - console_handler = logging.StreamHandler() - console_handler.setLevel(logging.INFO) - console_handler.setFormatter(logging.Formatter("%(message)s")) - - # Configure loggers - LOGGER_FORMAT = "%(asctime)s | %(name)-12s | %(levelname)-8s | %(message)s" - LOGGER_DATEFMT = "%m-%d %H:%M" - logging.basicConfig( - format=LOGGER_FORMAT, - datefmt=LOGGER_DATEFMT, - level=logging.INFO, - handlers=[console_handler], - ) - logger.info("Audio3DTools") - - if args.list is True or args.long is True: - logger.info("===Supported spatial audio formats===") - spatialaudioformat.Format.list_all(args.long) - - elif args.infiles is not None: - logger.info("===Convert spatial audio file===") - # Input folder can be a path, a file or a list of files - if os.path.isdir(args.infiles): - path = args.infiles - audio_list = [ - os.path.join(path, f) for f in os.listdir(path) if f.endswith((".wav")) - ] - else: - audio_list = [args.infiles] - - outdir = args.outdir - _, output_ext = os.path.splitext(os.path.basename(outdir)) - if (len(audio_list) == 1) and ( - (output_ext.lower() == ".wav") or (output_ext.lower() == ".pcm") - ): - outfile = outdir - else: - outfile = None - if not os.path.exists(outdir): - os.makedirs(outdir) - - for infile in audio_list: - logger.info(f" process {infile}") - - _, input_ext = os.path.splitext(os.path.basename(infile)) - - if outfile is None: - outfile = os.path.basename(infile) - if not args.dont_rename: - if args.outformat is not None: - outfile = outfile.replace(input_ext, f"_{args.outformat}.wav") - else: - outfile = outfile.replace(input_ext, ".out.wav") - outfile = os.path.join(outdir, outfile) - - spatialaudioconvert.spatial_audio_convert( - infile, - outfile, - in_format=args.informat, - in_fs=args.infs, - in_nchans=args.inchan, - in_meta_files=args.metadata, - out_format=args.outformat, - out_fs=args.outfs, - out_fc=args.outfc, - output_loudness=args.normalize, - loudness_tool=args.loudness_tool, - trajectory=args.trajectory, - binaural_dataset=args.binaural_dataset, - ) - - logger.info(f" Output {outfile}") - - if args.binaural: - if args.outformat.startswith("BINAURAL"): - raise SystemExit( - "BINAURAL output format can not be binauralized again!" - ) - - _, output_ext = os.path.splitext(os.path.basename(outfile)) - outfile_bin = outfile.replace(output_ext, "_BINAURAL.wav") - logger.info(f" Output binaural {outfile_bin}") - - spatialaudioconvert.spatial_audio_convert( - in_file=outfile, - out_file=outfile_bin, - in_format=args.outformat, - in_fs=args.outfs, - in_meta_files=args.metadata, - out_format="BINAURAL", - output_loudness=args.normalize, - loudness_tool=args.loudness_tool, - trajectory=args.trajectory, - binaural_dataset=args.binaural_dataset, - ) - - outfile = None - else: - raise Exception( - "Input file must be provided for conversion and audio manipulation." - ) - if __name__ == "__main__": main() diff --git a/scripts/pyaudio3dtools/audioarray.py b/scripts/pyaudio3dtools/audioarray.py index 87fc50b4632de86fd9e88c4042980cf76fd64f38..740c40c3c6fda3cdc9f0112d3dfbfad9c6f5e1dc 100644 --- a/scripts/pyaudio3dtools/audioarray.py +++ b/scripts/pyaudio3dtools/audioarray.py @@ -221,7 +221,7 @@ def cut(x: np.ndarray, limits: Tuple[int, int]) -> np.ndarray: return y -def compare(ref: np.ndarray, test: np.ndarray, fs: int, per_frame: bool=True) -> dict: +def compare(ref: np.ndarray, test: np.ndarray, fs: int, per_frame: bool = True) -> dict: """Compare two audio arrays Parameters @@ -250,7 +250,7 @@ def compare(ref: np.ndarray, test: np.ndarray, fs: int, per_frame: bool=True) -> "nsamples_diff_percentage": 0.0, "first_diff_pos_sample": -1, "first_diff_pos_channel": -1, - "first_diff_pos_frame": -1 + "first_diff_pos_frame": -1, } if per_frame: result["max_abs_diff_pos_frame"] = 0 @@ -269,7 +269,7 @@ def compare(ref: np.ndarray, test: np.ndarray, fs: int, per_frame: bool=True) -> max_diff_pos[0][0] // framesize, max_diff_pos[1][0], ] - + first_diff_pos = np.nonzero(diff) first_diff_pos = [ first_diff_pos[0][0], @@ -454,7 +454,9 @@ def get_framewise(x: np.ndarray, chunk_size: int, zero_pad=False) -> np.ndarray: if x.shape[0] % chunk_size: last_chunk = x[n_frames * chunk_size :, :] if zero_pad: - yield np.pad(last_chunk, [[0, chunk_size - (x.shape[0] % chunk_size)], [0, 0]]) + yield np.pad( + last_chunk, [[0, chunk_size - (x.shape[0] % chunk_size)], [0, 0]] + ) else: yield last_chunk diff --git a/scripts/pyaudio3dtools/audiofile.py b/scripts/pyaudio3dtools/audiofile.py index daa562f94afb1bc2fb56c92e0f5599c58c2ec976..5b6ffcdced2c3dadee3224d98d960123df002ec3 100644 --- a/scripts/pyaudio3dtools/audiofile.py +++ b/scripts/pyaudio3dtools/audiofile.py @@ -109,7 +109,7 @@ def writefile(filename: str, x: np.ndarray, fs: int = 48000) -> None: filename: str Output file path (.pcm or .wav) x: np array - Numpy 2D array of dimension: number of channels x number of samples + Numpy 2D array of dimension: number of samples x number of channels fs: Optional[int] Output sampling rate, required for .pcm input file, otherwise default = 48000 (Hz) @@ -695,7 +695,6 @@ def print_plot_play(x: np.ndarray, fs: int, text: Optional[str] = "") -> None: def get_wav_file_info(filename: str) -> dict: - """ Get the format information from a WAV file. Return a dictionary with the format information @@ -713,7 +712,6 @@ def get_wav_file_info(filename: str) -> dict: fid = open(filename, "rb") try: - riff = fid.read(4) if riff == b"RIFF": @@ -769,7 +767,9 @@ def get_wav_file_info(filename: str) -> dict: if __name__ == "__main__": import argparse - parser = argparse.ArgumentParser(description="Tool for basic operations on audio files") + parser = argparse.ArgumentParser( + description="Tool for basic operations on audio files" + ) subparsers = parser.add_subparsers() def pre_trim_wrapper(pre_trim_args): @@ -779,14 +779,21 @@ if __name__ == "__main__": print("Delay currently only supported with WAV file input") exit(-1) - x, _ = readfile(pre_trim_args.input_file, fs=input_file_properties["fs"], nchannels=input_file_properties["channels"]) + x, _ = readfile( + pre_trim_args.input_file, + fs=input_file_properties["fs"], + nchannels=input_file_properties["channels"], + ) trim = int(pre_trim_args.amount_in_ms * input_file_properties["fs"] / 1000) x = x[trim:] writefile(pre_trim_args.output_file, x, fs=input_file_properties["fs"]) - - parser_delay = subparsers.add_parser("pre-trim", help="Trim a given amount of content from the beginning of the file") - parser_delay.add_argument("amount_in_ms", type=float, help="Trim amount milliseconds.") + parser_delay = subparsers.add_parser( + "pre-trim", help="Trim a given amount of content from the beginning of the file" + ) + parser_delay.add_argument( + "amount_in_ms", type=float, help="Trim amount milliseconds." + ) parser_delay.add_argument("input_file") parser_delay.add_argument("output_file") parser_delay.set_defaults(func=pre_trim_wrapper) @@ -799,7 +806,8 @@ if __name__ == "__main__": convertfile(convert_args.input_file, convert_args.output_file) parser_convert = subparsers.add_parser( - "convert", help="Convert file format (output file extension determines output format)" + "convert", + help="Convert file format (output file extension determines output format)", ) parser_convert.add_argument("input_file") parser_convert.add_argument("output_file") diff --git a/scripts/pyaudio3dtools/binauralrenderer.py b/scripts/pyaudio3dtools/binauralrenderer.py deleted file mode 100644 index 2567b433db993e0029b66cccc477a44d34ae110b..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/binauralrenderer.py +++ /dev/null @@ -1,782 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import logging -import os -import timeit -from typing import Tuple - -import numpy as np -import scipy.interpolate as interp -import scipy.io as sio -import scipy.signal as sig -from pyaudio3dtools.rotation import rotateHOA, rotateISM, rotateMC - -from pyaudio3dtools import audioarray, spatialaudioformat, spatialaudioconvert -from pyaudio3dtools.constants import * - -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - -"""" Helper functions """ - - -def NS2SA(fs, x): - return int(int(fs / 100) * ((x) / 100) / 100000) - - -def read_hrirs_from_mat( - hrirs_path: str = "/HRIRs_mat/ORANGE_HRIR_53_48000_combined.mat", -) -> np.ndarray: - """Read HRIRs from Matlab dictionary file mat - - Parameters - ---------- - hrirs_path: str - HRTFs file name (.mat) - - Returns - ------- - IR: np.ndarray - array of impulse responses - SourcePosition: np.ndarray - array of source positions corresponding to the impulse responses - - """ - script_path = os.path.dirname(os.path.abspath(__file__)) - hrirs_filename = script_path + hrirs_path - - mat_contents = sio.loadmat(hrirs_filename) - IR = mat_contents["IR"] - try: - SourcePosition = mat_contents["SourcePosition"] - except KeyError: - SourcePosition = None - - logger.debug(f"Loaded HRIRs: {hrirs_filename}, {IR.shape[0]} by {IR.shape[1]}") - - return IR, SourcePosition - - -def get_IR( - in_spfmt: spatialaudioformat.Format, - out_spfmt: spatialaudioformat.Format, - dataset: str, -) -> Tuple[np.ndarray, np.ndarray, float]: - """get_IR - - Parameters - ---------- - in_spfmt: spatialaudioformat - input spatial audio format - out_spfmt: spatialaudioformat - output spatial audio format - dataset: str - name of the HRIRs or BRIRs dataset - - Returns - ------- - IR: np.ndarray - desired impulse response array - SourcePosition: np.ndarray - source positions of corresponding IRs - - """ - # override for BRIRs, currently only one option - if out_spfmt.name == "BINAURAL_ROOM": - dataset = "mozart_iis" - - # dataset file prefix - if dataset.lower().startswith("sadie"): - prefix = "/HRIRs_mat/SADIE_II_D2_48K_24bit_256tap" - elif dataset.lower().startswith("orange"): - prefix = f"/HRIRs_mat/ORANGE_HRIR_{dataset.replace('_full', '')[-2:]}_48000" - elif dataset.lower().startswith("mozart"): - prefix = "/BRIRs_mat/IIS_BRIR_officialMPEG_222UC" - else: - raise ValueError(f"Unsupported dataset '{dataset}' for HRIRs") - - # dataset file suffix - if in_spfmt.name.startswith("ISM") or in_spfmt.altname.startswith("CUSTOM_LS"): - suffix = "full.mat" - elif in_spfmt.isloudspeaker and in_spfmt.nchannels > 1: - suffix = "combined.mat" - elif in_spfmt.ambi_order > 0 or in_spfmt.name.upper() == "MONO": - suffix = "SBA3.mat" - else: - raise ValueError( - f"Unsupported format '{in_spfmt.name}' for dataset '{dataset}' for HRIRs" - ) - - IR, SourcePosition = read_hrirs_from_mat("_".join([prefix, suffix])) - - latency_smp = float(np.min(np.argmax(np.sum(np.abs(IR), axis=(1)), axis=(0)))) - - if in_spfmt.name.startswith("MONO"): - IR = IR[:, :, :1] # use omni/W from SBA - elif in_spfmt.name.startswith("STEREO"): - IR = IR[:, :, :2] # use L and R channels - elif in_spfmt.isloudspeaker and not in_spfmt.altname.startswith("CUSTOM_LS"): - # extract positions from the combined file - tmp_spfmt = spatialaudioformat.Format("COMBINED") - IR_tmp = IR.copy() - IR = np.zeros([IR_tmp.shape[0], IR_tmp.shape[1], in_spfmt.nchannels]) - - ir_index = 0 - for i in range(tmp_spfmt.nchannels): - for j in range(in_spfmt.nchannels): - if ( - tmp_spfmt.ls_azi[i] == in_spfmt.ls_azi[j] - and tmp_spfmt.ls_ele[i] == in_spfmt.ls_ele[j] - ): - if j != in_spfmt.lfe_index[0]: - IR[:, :, ir_index] = IR_tmp[:, :, i] - ir_index += 1 - - return IR, SourcePosition, latency_smp - - -def FindFilter(SourcePosition: np.ndarray, azi: float, ele: float) -> int: - """Find measurement closest to the selected direction, - reimplemented roughly along the lines of ConvBinauralRenderer.m - - Parameters - ---------- - SourcePosition: np.ndarray - Source IR positions - azi: float - desired response azimuth - ele: float - desired response elevation - - Returns - ------- - i_dir: int - index of nearest SourcePosition - """ - if azi < 0: - azi = azi + 360.0 - - if ele < 0: - ele = ele + 360.0 - - delta_azi = np.deg2rad(np.abs(azi - SourcePosition[:, 0])) - dist = np.arccos( - np.sin(np.deg2rad(SourcePosition[:, 2])) * np.sin(np.deg2rad(ele)) - + np.cos(np.deg2rad(SourcePosition[:, 1])) - * np.cos(np.deg2rad(ele)) - * np.cos(delta_azi) - ) - - i_dir = np.argmin(dist) - - # print('Direction closest to {}, {} is {} with angles {}, {} and distance {}\n'.format( - # azi, ele, i_dir, SourcePosition[i_dir,0], SourcePosition[i_dir,1], dist[i_dir] - # ) - # ) - - return i_dir - - -""" Core binaural rendering functions """ - - -def binaural_fftconv( - x: np.ndarray, IR: np.ndarray, nchannels: int, lfe_index: list = [] -) -> np.ndarray: - """Binauralization using fft convolution - - Parameters - ---------- - x: np array - input multi-channel array - IR: np array - HRIRs array - nchannels: int - maximum number of channels to process - lfe_index: list - list of LFE channel indices - - Returns - ------- - y: np.ndarray - output convolved signal array - - """ - y = np.zeros([x.shape[0], 2]) - for chan_idx in range(min(x.shape[1], nchannels)): - if chan_idx not in lfe_index: - y[:, 0] = np.add( - y[:, 0], - sig.fftconvolve( - x[:, chan_idx].astype(float), IR[:, 0, chan_idx] - ).astype(float)[: x.shape[0]], - ) - y[:, 1] = np.add( - y[:, 1], - sig.fftconvolve( - x[:, chan_idx].astype(float), IR[:, 1, chan_idx] - ).astype(float)[: x.shape[0]], - ) - else: - logger.debug(f" Mute LFE channel of index: {str(chan_idx)}") - - return y - - -def binaural_fftconv_framewise( - x: np.ndarray, - IR: np.ndarray, - SourcePosition: np.ndarray, - azi: np.ndarray = None, - ele: np.ndarray = None, - frame_len: int = (IVAS_FRAME_LEN_MS // 4) * 48, - interp_method="linear", - verbose=False, -) -> np.ndarray: - """Binauralization using fft convolution with frame-wise processing - supports rotation on trajectories with interpolation between measured Source - positions, reimplemented roughly along the lines of ConvBinauralRenderer.m - - Parameters - ---------- - x: np.ndarray - input multi-channel array - IR: np.ndarray - HRIRs array - SourcePosition: np.ndarray - positions of the source in the measurements in IR - azi: np.ndarray - azimuth angles for all frames - ele: np.ndarray - elevation angles for all frames - frame_len: int - frame length, optional, default = (IVAS_FRAME_LEN_MS // 4) * 48000 - interp_method: - interpolation method, optional, default = linear - - - Returns - ------- - y: np.ndarray - output binaural signal array - - """ - - sig_len = x.shape[0] - frame_len = (IVAS_FRAME_LEN_MS // 4) * 48 - N_frames = int(sig_len / frame_len) - - N_HRIR_taps = IR.shape[2] - - if azi is None or ele is None: - azi = np.repeat([0.0], N_frames) - ele = np.repeat([0.0], N_frames) - elif len(azi) < N_frames or len(ele) < N_frames: - azi = np.concatenate( - [np.repeat(azi, N_frames // len(azi)), azi[: N_frames % len(azi)]] - ) - ele = np.concatenate( - [np.repeat(ele, N_frames // len(ele)), ele[: N_frames % len(ele)]] - ) - - iGs = np.zeros([N_frames + 1], dtype=int) - mGs = np.zeros([N_frames + 1], dtype=int) - - # store trajectory as a sequence of indices of source positions - # on the HRTF database in a compressed format such that, for - # each new measurement point the trajectory hits, the sample index - # is stored in mGs and the index of the measurement in iG - # the number of measurement points hit by the trajectory is nsp - isp = 0 - iGs[0] = FindFilter(SourcePosition, azi[0], ele[0]) - mGs[0] = 0 - for i_frame in range(1, N_frames): - iG = FindFilter(SourcePosition, azi[i_frame], ele[i_frame]) - if iG != iGs[isp]: - isp += 1 - iGs[isp] = iG - mGs[isp] = i_frame * frame_len + 1 - nsp = isp + 1 - - # set last fence post explicitly - if mGs[nsp] < sig_len: - iGs[nsp] = iG - mGs[nsp] = sig_len - nsp = nsp + 1 - - T_rev = frame_len + N_HRIR_taps - 1 - N_rev = int(np.ceil(T_rev / frame_len)) - - if verbose: - print(" N_rev = ", N_rev) - - fastcode = True - if N_rev > 5: - if verbose: - print( - " __ __ ___ ___ _ _ ___ _ _ ___ " - ) - print( - r" \ \ / / / \ | _ \ | \| | |_ _| | \| | / __|" - ) - print( - r" \ \/\/ / | - | | / | . | | | | . | | (_ |" - ) - print( - r" \_/\_/ |_|_| |_|_\ |_|\_| |___| |_|\_| \___|" - ) - print( - " " - ) - print( - " You are using very long filters! This will be slooooow and use a lot of memory!" - ) - else: - fastcode = False - - if fastcode and verbose: - print( - " __ __ ___ ___ _ _ ___ _ _ ___ " - ) - print( - r" \ \ / / / \ | _ \ | \| | |_ _| | \| | / __|" - ) - print( - r" \ \/\/ / | - | | / | . | | | | . | | (_ |" - ) - print( - r" \_/\_/ |_|_| |_|_\ |_|\_| |___| |_|\_| \___|" - ) - print( - " " - ) - print( - " To speed up the otherwise extremely slow calculation, we only calculate the " - ) - print( - " responses of the latest frame with the latest filters instead of the full " - ) - print( - " integrals. This is much faster but much more prone to clicks. Inspect your " - ) - print( - " output signals carefully! To change this behavior, go to binauralrenderer.py " - ) - print( - " and set fastcode to False. " - ) - - y = np.zeros([sig_len + T_rev, 2]) - y0 = np.zeros([N_rev, sig_len + T_rev, 2]) - - fade_in = np.arange(frame_len) / (frame_len - 1) - fade_in = fade_in[:, np.newaxis] - fade_out = 1.0 - fade_in - - for i_ear in [0, 1]: - - Gs = IR[ - iGs[0:nsp], i_ear, : - ] # Green's function along the trajectory sampled by the measurement points - interp_G = interp.interp1d( - mGs[0:nsp], Gs, kind=interp_method, axis=0 - ) # interpolator for Green's function between those points - - G = interp_G(np.arange(0, sig_len, frame_len)) - - t0 = timeit.default_timer() - - if fastcode: - for i_frame in range(N_frames): - - i1 = i_frame * frame_len - i2 = (i_frame + 1) * frame_len - i2p = i1 + T_rev - - fade_out = np.linspace(0.0, 1.0, T_rev, endpoint=False) - fade_in = 1.0 - fade_out - - for j_frame in [0, 1]: - G_n_m = G[min(j_frame + i_frame, N_frames - 1), :] - y0[j_frame, i1:i2p, i_ear] = sig.oaconvolve( - np.squeeze(x[i1:i2]), G_n_m - ) - - y[i1:i2p, i_ear] = ( - np.squeeze(fade_out) * y0[0, i1:i2p, i_ear] - + np.squeeze(fade_in) * y0[1, i1:i2p, i_ear] - ) - - t1 = timeit.default_timer() - fps = (i_frame + 1) / (t1 - t0) - eta = (2 * N_frames - (i_frame + 1) + i_ear * N_frames) / fps - - if verbose: - print( - " Frame {}/{} on ear {}/2 done at {: 3.1f} fps, ETA {: 6.0f} s ".format( - i_frame + 1, N_frames, i_ear + 1, fps, eta - ), - end="\r", - ) - - else: - for i_frame in range(N_frames): - - i1 = i_frame * frame_len - i2 = (i_frame + 1) * frame_len - i2p = i1 + T_rev - - y0[:] = 0.0 - for j_frame in range( - max(0, i_frame - N_rev), min(i_frame + 1, N_frames) - ): - - j1 = j_frame * frame_len - j2 = (j_frame + 1) * frame_len - j2p = j1 + T_rev - - G0 = G[i_frame] - G1 = G[min(i_frame + 1, N_frames - 1)] - - y0[0, j1:j2p, i_ear] += sig.oaconvolve(np.squeeze(x[j1:j2]), G0) - y0[1, j1:j2p, i_ear] += sig.oaconvolve(np.squeeze(x[j1:j2]), G1) - - y[i1:i2, i_ear] = ( - np.squeeze(fade_out) * y0[0, i1:i2, i_ear] - + np.squeeze(fade_in) * y0[1, i1:i2, i_ear] - ) - - t1 = timeit.default_timer() - fps = (i_frame + 1) / (t1 - t0) - eta = (2 * N_frames - (i_frame + 1) + i_ear * N_frames) / fps - - if verbose: - print( - " Frame {}/{} on ear {}/2 done at {: 3.1f} fps, ETA {: 6.0f} s ".format( - i_frame + 1, N_frames, i_ear + 1, fps, eta - ), - end="\r", - ) - - if verbose: - print("") - - return y[0:sig_len] - - -def binaural_render_LFE( - x: np.ndarray, - fs: int = 48000, - lfe_index: list = [3], - LFE_gain: float = 10 ** (5.5 / 20), - latency_smp: int = 0, -) -> np.ndarray: - """ - Extract LFE from the given input and render - it binaurally, accounting for delay of the - """ - - lfe = x[:, lfe_index].copy() - - # if there is more than one LFE sum them into one - if lfe.shape[1] > 1: - lfe = np.sum(lfe, axis=1) - - # TODO tmu - disabled temporarily here, disabled in C - lfe_delay_ns = 0 - """ - # 120 Hz low-pass filtering for LFE using IVAS filter coefficients - if fs == 48000: - lfe = sig.sosfilt(IVAS_LPF_4_BUTTER_48K_SOS, lfe, axis=0) - else: - raise NotImplementedError("Only 48 kHz supported at the moment!") - - # 3.5ms LP filter delay from IVAS ROM - lfe_delay_ns = 0.0035 * 1e9 - lfe_delay_smp = round(lfe_delay_ns * fs / 1e9) - - # Delay LFE by the same amount as the HRTF delay - lfe = np.roll(lfe, round(latency_smp), axis=0) - lfe[0 : round(latency_smp), :] = 0 - """ - - # apply gain - lfe *= LFE_gain - - # duplicate for each binaural channel - lfe = np.hstack([lfe, lfe]) - - return lfe, lfe_delay_ns - - -""" Format specific wrapper functions """ - - -def render_custom_ls_binaural( - x: np.ndarray, - fs: int, - in_spfmt: spatialaudioformat.Format, - out_spfmt: spatialaudioformat.Format, - IR: np.ndarray, - SourcePosition: np.ndarray, - trajectory: np.ndarray, -) -> np.ndarray: - - ls_azi_all = in_spfmt.ls_azi - ls_ele_all = in_spfmt.ls_ele - lfe_index_all = in_spfmt.lfe_index - - logger.info(" Processing channels on custom LS layout") - azis = ", ".join([f"{a:7.2f}" for a in ls_azi_all]) - eles = ", ".join([f"{e:7.2f}" for e in ls_ele_all]) - logger.info(f" azi: {azis}") - logger.info(f" ele: {eles}") - logger.info(f" lfe_index: {lfe_index_all}") - - if out_spfmt.name == "BINAURAL_ROOM": - tmp_spfmt = spatialaudioformat.Format("7_1_4") - x = spatialaudioconvert.convert_mc(x, in_spfmt, tmp_spfmt) - ls_azi_all = tmp_spfmt.ls_azi - ls_ele_all = tmp_spfmt.ls_ele - lfe_index_all = tmp_spfmt.lfe_index - logger.info(f" {in_spfmt.name} -> {tmp_spfmt.name} -> {out_spfmt.name}") - - frame_len = (IVAS_FRAME_LEN_MS // 4) * (fs // 1000) - sig_len = x.shape[0] - N_frames = int(sig_len / frame_len) - - i_ls = 0 - y = np.zeros([sig_len, 2]) - for i_chan in range(x.shape[1]): - - # skip LFE - if i_chan in lfe_index_all: - continue - - # skip silent (or very low volume) channels - if np.allclose(x[:, i_chan], 0.0, atol=32.0): - continue - - ls_azi = np.repeat(ls_azi_all[i_ls], N_frames) - ls_ele = np.repeat(ls_ele_all[i_ls], N_frames) - - azi, ele = rotateISM(ls_azi, ls_ele, trajectory=trajectory) - - y += binaural_fftconv_framewise( - x[:, i_chan], - IR, - SourcePosition, - frame_len=frame_len, - azi=azi, - ele=ele, - verbose=False, - ) - i_ls += 1 - - return y - - -def render_ism_binaural( - x: np.ndarray, - fs: int, - IR: np.ndarray, - SourcePosition: np.ndarray, - trajectory: np.ndarray, - in_pos: np.ndarray, -) -> np.ndarray: - - frame_len = (IVAS_FRAME_LEN_MS // 4) * (fs // 1000) - sig_len = x.shape[0] - N_frames = int(sig_len / frame_len) - - # get ISM metadata and repeat it nsubframe times - pos_data = [] - for pos in in_pos: - pos_data.extend( - [pos["azimuth"], pos["elevation"]] for _ in range(pos["use_for_frames"]) - ) - pos_data = np.array(pos_data) - pos_data = np.repeat(pos_data, 4, axis=0) - - # extract positions only according to the audio duration - pos_data = pos_data[:N_frames, :] - - azi, ele = rotateISM(pos_data[:, 0], pos_data[:, 1], trajectory=trajectory) - - y = np.zeros([sig_len, 2]) - y += binaural_fftconv_framewise( - x, - IR, - SourcePosition, - frame_len=frame_len, - azi=azi, - ele=ele, - verbose=False, - ) - - return y - - -def render_masa_binaural( - x: np.ndarray, - fs: int, - in_spfmt: spatialaudioformat.Format, - IR: np.ndarray, - SourcePosition: np.ndarray, - trajectory: np.ndarray, -): - y = x[:, :2] - # TODO - return y - - -def render_ambi_ls_binaural( - x: np.ndarray, - fs: int, - in_spfmt: spatialaudioformat.Format, - IR: np.ndarray, - trajectory: np.ndarray, -) -> np.ndarray: - - y = x[:] - if trajectory is not None: - if in_spfmt.ambi_order > 0: - y = rotateHOA(y, trajectory) - if in_spfmt.isloudspeaker: - y = rotateMC(y, trajectory, in_spfmt) - - y = binaural_fftconv(y, IR, in_spfmt.nchannels, in_spfmt.lfe_index) - - return y - - -""" Wrapper function for generic binaural rendering """ - - -def binaural_rendering( - x: np.ndarray, - in_spfmt: spatialaudioformat.Format, - out_spfmt: spatialaudioformat.Format, - dataset: str = "orange53", - fs: int = 48000, - trajectory: str = None, - include_LFE: bool = False, - LFE_gain: float = 10 ** (5.5 / 20), - in_pos: dict = None, -): - """Binaural rendering - - Parameters - ---------- - x: np array - input multi-channel array - in_spfmt_name: str - name of input spatial format - dataset: str - name of the HRIRs or BRIRs dataset - fs: int - input/output sampling-rate (default 48kHz) - trajectory: str - path to trajectory file - - Returns - ------- - y: np.ndarray - output binaural signal array - - """ - - if trajectory is not None: - logger.info( - " performing rotation along trajectory from file {}".format(trajectory) - ) - - # resample to 48 kHz - y = audioarray.resample(x, fs, 48000) - delay_total_ns = 0 - - # get IR corresponding to the input and output formats - IR, SourcePosition, latency_smp = get_IR(in_spfmt, out_spfmt, dataset) - delay_total_ns += latency_smp / float(fs) * 1e9 - - # prepare LFE signal to be added to output - if include_LFE and in_spfmt.isloudspeaker and in_spfmt.lfe_index: - lfe, lfe_delay_ns = binaural_render_LFE( - x, 48000, in_spfmt.lfe_index, LFE_gain, latency_smp - ) - delay_total_ns += lfe_delay_ns - - # get binauralized signal based on format - if in_spfmt.altname.startswith("CUSTOM_LS"): - y = render_custom_ls_binaural( - x, fs, in_spfmt, out_spfmt, IR, SourcePosition, trajectory - ) - elif in_spfmt.name.startswith("ISM"): - if not in_pos: - raise ValueError("ISM metadata empty!") - y = render_ism_binaural( - x, - fs, - IR, - SourcePosition, - trajectory, - in_pos, - ) - elif in_spfmt.name.startswith("MASA"): - y = render_masa_binaural(x, fs, in_spfmt, IR, SourcePosition, trajectory) - elif in_spfmt.ambi_order > 0 or in_spfmt.isloudspeaker: - y = render_ambi_ls_binaural(x, fs, in_spfmt, IR, trajectory) - else: - raise NotImplementedError( - f"{in_spfmt.name} -> {out_spfmt.name}: format conversion not implemented" - ) - - # add LFE signal to output - if include_LFE and in_spfmt.isloudspeaker and in_spfmt.lfe_index: - # delay the binauralized signal by the LFE delay - lfe_delay_smp = NS2SA(fs, int(lfe_delay_ns)) - y = np.roll(y, lfe_delay_smp, axis=0) - y[0:lfe_delay_smp, :] = 0 - y += lfe - - # delay compensation - delay_total_smp = NS2SA(fs, delay_total_ns) - y = np.roll(y, -delay_total_smp, axis=0) - if delay_total_smp > 0: - y[-delay_total_smp:, :] = 0 - - # resample back to original rate - y = audioarray.resample(y, 48000, fs) - - return y diff --git a/scripts/pyaudio3dtools/hoadecoder.py b/scripts/pyaudio3dtools/hoadecoder.py deleted file mode 100644 index c37ceb3bdcf6f04a91308583ac3d5c9df76c12a5..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/hoadecoder.py +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import logging -import os -from typing import Optional - -import numpy as np -from scipy.special import lpmv - -from pyaudio3dtools import spatialaudioformat -from pyaudio3dtools.constants import T_DESIGN_11_AZI, T_DESIGN_11_ELE -from pyaudio3dtools.EFAP import EFAP - -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - - -def get_hoa_mtx( - ambi_order: int, - spkrlayout: spatialaudioformat, - norm: Optional[str] = "sn3d", - rE_weight: Optional[bool] = False, - intensity_panning: Optional[bool] = True, -) -> np.ndarray: - nharm = spatialaudioformat.Format.nchannels_from_ambiorder(ambi_order) - if spkrlayout.name == "MONO": - mtx_hoa_dec = np.zeros([1, nharm]) - mtx_hoa_dec[0, 0] = 1 - elif spkrlayout.name == "STEREO": - mtx_hoa_dec = np.zeros([2, nharm]) - # Cardioids +/- 90 degrees - mtx_hoa_dec[0, 0] = 0.5 - mtx_hoa_dec[0, 1] = 0.5 - mtx_hoa_dec[1, 0] = 0.5 - mtx_hoa_dec[1, 1] = -0.5 - elif spkrlayout.isloudspeaker: - Y_td = getRSH( - T_DESIGN_11_AZI, - T_DESIGN_11_ELE, - ambi_order, - norm="ortho", - ) - Y_td *= np.sqrt(4 * np.pi) - - n_ls_woLFE = spkrlayout.nchannels - len(spkrlayout.lfe_index) - ls_azi_woLFE = np.delete(spkrlayout.ls_azi, spkrlayout.lfe_index).astype(float) - ls_ele_woLFE = np.delete(spkrlayout.ls_ele, spkrlayout.lfe_index).astype(float) - - panner = EFAP(ls_azi_woLFE, ls_ele_woLFE, intensity_panning) - G_td = panner.pan(T_DESIGN_11_AZI, T_DESIGN_11_ELE) - - mtx_hoa_dec = (G_td.T @ Y_td.T) / T_DESIGN_11_AZI.size - - if norm == "sn3d": - mtx_hoa_dec = mtx_hoa_dec @ np.diag(sn2n(ambi_order)) - elif norm == "ortho": - mtx_hoa_dec *= np.sqrt(4 * np.pi) - - if rE_weight: - a_n = rE_weight(ambi_order) - nrg_pre = np.sqrt(len(n_ls_woLFE) / np.sum(a_n**2)) - mtx_hoa_dec = mtx_hoa_dec @ np.diag(a_n) * nrg_pre - - mtx_hoa_dec = np.insert( - mtx_hoa_dec, spkrlayout.lfe_index, np.zeros(nharm), axis=0 - ) - else: - raise ValueError( - f"Unsupported spatial audio format for ALLRAD: {spkrlayout.name}" - ) - - return mtx_hoa_dec - - -def hoa_linear_decoding(signal_in: np.ndarray, mtx_hoa_dec: np.ndarray) -> np.ndarray: - if not signal_in.shape[1] == mtx_hoa_dec.shape[1]: - raise Exception( - "Input number of channels must be equal to renderer matrix second dimension" - ) - - signal_out = np.dot(signal_in, mtx_hoa_dec.transpose()) - - logger.debug(f"Signal out: {signal_out.shape[0]} by {signal_out.shape[1]}") - - return signal_out - - -def rE_weight(order: int) -> np.ndarray: - return np.array( - [ - lpmv(0, l, np.cos(np.deg2rad(137.9) / (order + 1.51))) - for l in range(order + 1) - for _ in range(-l, l + 1) - ] - ).T - - -def n2sn(order: int) -> np.ndarray: - return np.array( - [1.0 / np.sqrt(2 * l + 1) for l in range(order + 1) for _ in range(-l, l + 1)] - ) - - -def sn2n(order: int) -> np.ndarray: - return np.array( - [np.sqrt(2 * l + 1) for l in range(order + 1) for _ in range(-l, l + 1)] - ) - - -def getRSH( - azi: np.ndarray, - ele: np.ndarray, - ambi_order: int, - norm: Optional[str] = "sn3d", - degrees: Optional[bool] = True, -) -> np.ndarray: - """ - Returns real spherical harmonic response for the given position(s) - """ - if degrees: - azi = np.deg2rad(azi) - ele = np.deg2rad(ele) - - LM = np.array([(l, m) for l in range(ambi_order + 1) for m in range(-l, l + 1)]) - - response = np.zeros([LM.shape[0], azi.shape[0]]) - - # trig_term * legendre * uncondon - for i, (l, m) in enumerate(LM): - # N3D norm - response[i, :] = np.sqrt( - ((2 * l + 1) * np.math.factorial(l - np.abs(m))) - / (4 * np.pi * np.math.factorial(l + np.abs(m))) - ) - - # trig term - if m < 0: - response[i, :] *= np.sqrt(2) * np.sin(azi * np.abs(m)) - elif m == 0: - pass # response[i,:] *= 1 - else: - response[i, :] *= np.sqrt(2) * np.cos(azi * m) - - # legendre polynomial - response[i, :] *= lpmv(np.abs(m), l, np.sin(ele)) * ((-1) ** np.abs(m)) - - if norm == "sn3d": - response *= np.sqrt(4 * np.pi) - response[:] = np.diag(n2sn(ambi_order)) @ response - elif norm == "n3d": - response *= np.sqrt(4 * np.pi) - else: - pass # ortho - - return response diff --git a/scripts/pyaudio3dtools/masarenderer.py b/scripts/pyaudio3dtools/masarenderer.py deleted file mode 100644 index ff9a3612a4f86ba7211708be81f678aadf5141a2..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/masarenderer.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - - -import os -import shutil -import subprocess as sp -from tempfile import TemporaryDirectory - -import numpy as np - -from pyaudio3dtools.audiofile import readfile, writefile -from pyaudio3dtools.spatialaudioformat import Format - - -def render_masa( - in_sig: str, - in_meta: str, - in_spfmt: Format, - out_spfmt: Format, -) -> np.ndarray: - """Python wrapper for masaRenderer binaray - - Parameters - ---------- - in_sig: np.ndarray - Input signal with MASA transport channels - in_meta: str - Input MASA metadata file - in_spfmt: Format - Input spatial audio format - out_spfmt: Format - Output spatial audio format - - Returns - ------- - out_sig: np.ndarray - Rendered signal - fs : int - Sampling frequency (always 48 kHz for masaRenderer) - """ - - if shutil.which("masaRenderer") is None: - raise FileNotFoundError("The masaRenderer binary was not found in path!") - - with TemporaryDirectory() as tmp_dir: - MASA_RENDERER_CMD = [ - "masaRenderer", - "", # outputMode -LS51, -LS714 or BINAURAL - "", # input PCM - in_meta[0], - "", # output PCM - ] - - cmd = MASA_RENDERER_CMD[:] - if out_spfmt.name.startswith("BINAURAL"): - cmd[1] = "-BINAURAL" - out_nchan = 2 - elif out_spfmt.name == "5_1": - cmd[1] = "-LS51" - out_nchan = 6 - else: - cmd[1] = "-LS714" - out_nchan = 12 - - tmp_in = os.path.join(tmp_dir, "tmp_masa_in.pcm") - tmp_out = os.path.join(tmp_dir, "tmp_masa_out.pcm") - - cmd[2] = tmp_in - cmd[4] = tmp_out - - writefile(tmp_in, in_sig, 48000) - - try: - result = sp.run(cmd, check=True, capture_output=True, text=True) - except sp.CalledProcessError as e: - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) - - out_sig, _ = readfile(tmp_out, out_nchan, 48000) - - return out_sig diff --git a/scripts/pyaudio3dtools/quaternions/functions.py b/scripts/pyaudio3dtools/quaternions/functions.py deleted file mode 100644 index 6b30ccb5ee0e269cde63149b78ee15a5dbab332f..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/quaternions/functions.py +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -from typing import Tuple -import numpy as np - - -def Quat2Euler(quat: np.ndarray, degrees: bool = True): - "Convert Quaternion to Euler angles" - - sinr = +2.0 * (quat[..., 0] * quat[..., 1] + quat[..., 2] * quat[..., 3]) - cosr = +1.0 - 2.0 * (quat[..., 1] * quat[..., 1] + quat[..., 2] * quat[..., 2]) - roll = np.arctan2(sinr, cosr) - - sinp = +2.0 * (quat[..., 0] * quat[..., 2] - quat[..., 3] * quat[..., 1]) - pitch = np.where(np.fabs(sinp) >= 1, np.copysign(np.pi / 2, sinp), np.arcsin(sinp)) - - siny = +2.0 * (quat[..., 0] * quat[..., 3] + quat[..., 1] * quat[..., 2]) - cosy = +1.0 - 2.0 * (quat[..., 2] * quat[..., 2] + quat[..., 3] * quat[..., 3]) - yaw = np.arctan2(siny, cosy) - - ypr = np.array([yaw, pitch, roll]).T - - if degrees: - ypr = np.rad2deg(ypr) - - return ypr - - -def Euler2Quat(ypr: np.ndarray, degrees: bool = True): - "Convert Euler angles to Quaternion" - - if degrees: - ypr = np.deg2rad(ypr) - - if len(ypr.shape) == 2: - N_quat = ypr.shape[0] - quat = np.zeros([N_quat, 4]) - yaw = ypr[:, 0] - pitch = ypr[:, 1] - roll = ypr[:, 2] - else: - quat = np.zeros([4]) - yaw = ypr[0] - pitch = ypr[1] - roll = ypr[2] - - c1 = np.cos(0.5 * yaw) - c2 = np.cos(0.5 * pitch) - c3 = np.cos(0.5 * roll) - - s1 = np.sin(0.5 * yaw) - s2 = np.sin(0.5 * pitch) - s3 = np.sin(0.5 * roll) - - quat[..., 0] = c3 * c2 * c1 + s3 * s2 * s1 - quat[..., 1] = s3 * c2 * c1 - c3 * s2 * s1 - quat[..., 2] = s3 * c2 * s1 + c3 * s2 * c1 - quat[..., 3] = c3 * c2 * s1 - s3 * s2 * c1 - - return quat - - -def Quat2RotMat(quat: np.ndarray): - "Convert quaternion to rotation matrix" - - R = np.zeros([3, 3]) - - if quat[0] != -3: - - # Quaternions - # formula taken from ivas_rotation.c - - R[0, 0] = ( - quat[0] * quat[0] - + quat[1] * quat[1] - - quat[2] * quat[2] - - quat[3] * quat[3] - ) - R[0, 1] = 2.0 * (quat[1] * quat[2] - quat[0] * quat[3]) - R[0, 2] = 2.0 * (quat[1] * quat[3] + quat[0] * quat[2]) - - R[1, 0] = 2.0 * (quat[1] * quat[2] + quat[0] * quat[3]) - R[1, 1] = ( - quat[0] * quat[0] - - quat[1] * quat[1] - + quat[2] * quat[2] - - quat[3] * quat[3] - ) - R[1, 2] = 2.0 * (quat[2] * quat[3] - quat[0] * quat[1]) - - R[2, 0] = 2.0 * (quat[1] * quat[3] - quat[0] * quat[2]) - R[2, 1] = 2.0 * (quat[2] * quat[3] + quat[0] * quat[1]) - R[2, 2] = ( - quat[0] * quat[0] - - quat[1] * quat[1] - - quat[2] * quat[2] - + quat[3] * quat[3] - ) - - else: - - # Euler angles in R_X(roll)*R_Y(pitch)*R_Z(yaw) convention - # - # yaw: rotate scene counter-clockwise in the horizontal plane - # pitch: rotate scene in the median plane, increase elevation with positive values - # roll: rotate scene from the right ear to the top - # - # formula taken from ivas_rotation.c - - c1 = np.cos(quat[3] / 180.0 * np.pi) - c2 = np.cos(quat[2] / 180.0 * np.pi) - c3 = np.cos(quat[1] / 180.0 * np.pi) - - s1 = np.sin(quat[3] / 180.0 * np.pi) - s2 = np.sin(-quat[2] / 180.0 * np.pi) - s3 = np.sin(quat[1] / 180.0 * np.pi) - - R[0, 0] = c2 * c3 - R[0, 1] = -c2 * s3 - R[0, 2] = s2 - - R[1, 0] = c1 * s3 + c3 * s1 * s2 - R[1, 1] = c1 * c3 - s1 * s2 * s3 - R[1, 2] = -c2 * s1 - - R[2, 0] = s1 * s3 - c1 * c3 * s2 - R[2, 1] = c3 * s1 + c1 * s2 * s3 - R[2, 2] = c1 * c2 - - return R - - -def rotateAziEle( - azi: float, ele: float, R: np.ndarray, is_planar: bool = False -) -> Tuple[float, float]: - w = np.cos(np.deg2rad(ele)) - dv = np.array( - [ - w * np.cos(np.deg2rad(azi)), - w * np.sin(np.deg2rad(azi)), - np.sin(np.deg2rad(ele)), - ] - ) - - dv_rot = R @ dv - - azi = np.rad2deg(np.arctan2(dv_rot[1], dv_rot[0])) - if is_planar: - ele = 0 - else: - ele = np.rad2deg(np.arctan2(dv_rot[2], np.sqrt(np.sum(dv_rot[:2] ** 2)))) - - return azi, ele diff --git a/scripts/pyaudio3dtools/rotation.py b/scripts/pyaudio3dtools/rotation.py deleted file mode 100644 index cbd76aef3fe468378674cd13dc5de12f4ef60c02..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/rotation.py +++ /dev/null @@ -1,346 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import numpy as np - -from pyaudio3dtools import EFAP, spatialaudioformat -from pyaudio3dtools.constants import * -from pyaudio3dtools.quaternions.functions import Quat2RotMat, rotateAziEle - -######################################################################### -# Helper functions used by Ruedenberg, -# an implementation of the algorithm in -# Ivanic, J. & Ruedenberg, K., J. Phys. Chem. 100, 6342 (1996) -# translated from ivas_rotation.c -######################################################################### - - -def SHrot_p( - i: int, l: int, a: int, b: int, SHrotmat: np.ndarray, R_lm1: np.ndarray -) -> float: - """Helper function to calculate the ps""" - - ri1 = SHrotmat[i + 1 + 1][1 + 1 + 1] - rim1 = SHrotmat[i + 1 + 1][-1 + 1 + 1] - ri0 = SHrotmat[i + 1 + 1][0 + 1 + 1] - - if b == -l: - R_lm1_1 = R_lm1[a + l - 1][0] - R_lm1_2 = R_lm1[a + l - 1][2 * l - 2] - p = ri1 * R_lm1_1 + rim1 * R_lm1_2 - else: - if b == l: - R_lm1_1 = R_lm1[a + l - 1][2 * l - 2] - R_lm1_2 = R_lm1[a + l - 1][0] - p = ri1 * R_lm1_1 - rim1 * R_lm1_2 - else: - R_lm1_1 = R_lm1[a + l - 1][b + l - 1] - p = ri0 * R_lm1_1 - - return p - - -def SHrot_u(l: int, m: int, n: int, SHrotmat: np.ndarray, R_lm1: np.ndarray) -> float: - """Helper function to calculate the us""" - return SHrot_p(0, l, m, n, SHrotmat, R_lm1) - - -def SHrot_v(l: int, m: int, n: int, SHrotmat: np.ndarray, R_lm1: np.ndarray) -> float: - """Helper function to calculate the vs""" - - if m == 0: - p0 = SHrot_p(1, l, 1, n, SHrotmat, R_lm1) - p1 = SHrot_p(-1, l, -1, n, SHrotmat, R_lm1) - return p0 + p1 - else: - if m > 0: - d = 1.0 if (m == 1) else 0.0 - p0 = SHrot_p(1, l, m - 1, n, SHrotmat, R_lm1) - p1 = SHrot_p(-1, l, -m + 1, n, SHrotmat, R_lm1) - return p0 * np.sqrt(1.0 + d) - p1 * (1.0 - d) - else: - d = 1.0 if (m == -1) else 0.0 - p0 = SHrot_p(1, l, m + 1, n, SHrotmat, R_lm1) - p1 = SHrot_p(-1, l, -m - 1, n, SHrotmat, R_lm1) - return p0 * (1.0 - d) + p1 * np.sqrt(1.0 + d) - - -def SHrot_w(l: int, m: int, n: int, SHrotmat: np.ndarray, R_lm1: np.ndarray) -> float: - """Helper function to calculate the w""" - if m == 0: - raise ValueError("ERROR should not be called\n") - else: - if m > 0: - p0 = SHrot_p(1, l, m + 1, n, SHrotmat, R_lm1) - p1 = SHrot_p(-1, l, -m - 1, n, SHrotmat, R_lm1) - return p0 + p1 - else: - p0 = SHrot_p(1, l, m - 1, n, SHrotmat, R_lm1) - p1 = SHrot_p(-1, l, -m + 1, n, SHrotmat, R_lm1) - return p0 - p1 - - -######################################## -# SHD rotation matrix calculation -# translated from ivas_rotation.c -######################################## -def SHrotmatgen(R: np.ndarray, order: int = 3) -> np.ndarray: - """Calculate SHD roatation matrix from that in real space - - Parameters: - ---------- - R: np.ndarray - real-space rotation matrix - - order: Optional[int] - Ambisonics order, default = 3 - - Returns: - ---------- - SHrotmat: np.ndarray - SHD rotation matrix - - """ - dim = (order + 1) * (order + 1) - - SHrotmat = np.zeros([dim, dim]) - R_lm1 = np.zeros([dim, dim]) - R_l = np.zeros([dim, dim]) - - SHrotmat[0][0] = 1.0 - - SHrotmat[1][1] = R[1][1] - SHrotmat[1][2] = R[1][2] - SHrotmat[1][3] = R[1][0] - - SHrotmat[2][1] = R[2][1] - SHrotmat[2][2] = R[2][2] - SHrotmat[2][3] = R[2][0] - - SHrotmat[3][1] = R[0][1] - SHrotmat[3][2] = R[0][2] - SHrotmat[3][3] = R[0][0] - - for i in range(2 * 1 + 1): - for j in range(2 * 1 + 1): - R_lm1[i][j] = SHrotmat[i + 1][j + 1] - - band_idx = 4 - for l in range(2, order + 1): - - R_l[:, :] = 0.0 - - for m in range(-l, l + 1): - - d = 1 if (m == 0) else 0 - absm = abs(m) - sql2mm2 = np.sqrt((l * l - m * m)) - sqdabsm = np.sqrt(((1 + d) * (l + absm - 1) * (l + absm))) - sqlabsm = np.sqrt(((l - absm - 1) * (l - absm))) - - for n in range(-l, l + 1): - if abs(n) == l: - sqdenom = np.sqrt((2 * l) * (2 * l - 1)) - else: - sqdenom = np.sqrt(l * l - n * n) - - u = sql2mm2 / sqdenom - v = sqdabsm / sqdenom * (1 - 2 * d) * 0.5 - w = sqlabsm / sqdenom * (1 - d) * (-0.5) - - if u != 0: - u = u * SHrot_u(l, m, n, SHrotmat, R_lm1) - if v != 0: - v = v * SHrot_v(l, m, n, SHrotmat, R_lm1) - if w != 0: - w = w * SHrot_w(l, m, n, SHrotmat, R_lm1) - R_l[m + l][n + l] = u + v + w - - for i in range(2 * l + 1): - for j in range(2 * l + 1): - SHrotmat[band_idx + i][band_idx + j] = R_l[i][j] - - for i in range(2 * l + 1): - for j in range(2 * l + 1): - R_lm1[i][j] = R_l[i][j] - - band_idx += 2 * l + 1 - - return SHrotmat - - -def rotateHOA(x: np.ndarray, trajectory: str) -> np.ndarray: - """Rotate HOA signal by applying a rotation matrix calculated from the current quaternion - in each subframe - - Parameters: - ---------- - x: np.ndarray - input signal upto HOA3 - trajectory: str - path to trajectory file - - Returns: - ---------- - y: np.ndarray - rotated HOA signal - """ - - trj_data = np.genfromtxt(trajectory, delimiter=",") - trj_frames = trj_data.shape[0] - - sig_len = x.shape[0] - sig_dim = x.shape[1] - frame_len = (IVAS_FRAME_LEN_MS // 4) * 48 - N_frames = int(sig_len / frame_len) - - if sig_dim not in [4, 9, 16]: - raise ValueError("rotateHOA can only handle FOA, HOA2 or HOA3 signals!") - - y = np.zeros([sig_len, sig_dim]) - - fade_in = np.arange(frame_len) / (frame_len - 1) - fade_in = fade_in[:, np.newaxis] - fade_out = 1.0 - fade_in - - R = np.eye(sig_dim) - R_old = np.eye(sig_dim) - for i_frame in range(N_frames): - - i1 = i_frame * frame_len - i2 = (i_frame + 1) * frame_len - - q1 = trj_data[i_frame % trj_frames, :] - R_r = Quat2RotMat(q1) - R[:, :] = SHrotmatgen(R_r, order=int(np.sqrt(sig_dim)) - 1) - - frame_in = x[i1:i2, :] - frame_out = y[i1:i2, :] - - frame_out[:, :] = (fade_in * frame_in @ R.T) + (fade_out * frame_in @ R_old.T) - - R_old[:, :] = R.copy() - - return y - - -def rotateISM( - azi: np.ndarray, - ele: np.ndarray, - trajectory: str = None, -) -> tuple: - - if trajectory is None: - return azi, ele - - trj_data = np.genfromtxt(trajectory, delimiter=",") - trj_frames = trj_data.shape[0] - - N_frames = azi.shape[0] - if ele.shape[0] != azi.shape[0]: - raise ValueError("Inconsistent input in azi and ele") - - azi_rot = np.zeros([N_frames]) - ele_rot = np.zeros([N_frames]) - - for i_frame in range(N_frames): - q = trj_data[i_frame % trj_frames, :] - azi_rot[i_frame], ele_rot[i_frame] = rotateAziEle( - azi[i_frame], ele[i_frame], Quat2RotMat(q) - ) - - return azi_rot, ele_rot - - -def rotateMC(x: np.ndarray, trajectory: str, layout: spatialaudioformat) -> np.ndarray: - """Rotate MC signal by applying a rotation matrix calculated from the current quaternion - in each subframe - - Parameters: - ---------- - x: np.ndarray - input multichannel signal - trajectory: str - path to trajectory file - - Returns: - ---------- - y: np.ndarray - rotated multichannel signal - """ - - # TODO needs optimization, currently slow - trj_data = np.genfromtxt(trajectory, delimiter=",") - trj_frames = trj_data.shape[0] - - sig_len = x.shape[0] - sig_dim = x.shape[1] - frame_len = (IVAS_FRAME_LEN_MS // 4) * 48 - N_frames = int(sig_len / frame_len) - - y = np.zeros([sig_len, sig_dim]) - - # TODO LFE handling here - panner = EFAP.EFAP(layout.ls_azi, layout.ls_ele) - - fade_in = np.arange(frame_len) / (frame_len - 1) - fade_in = fade_in[:, np.newaxis] - fade_out = 1.0 - fade_in - - R = np.eye(layout.nchannels) - R_old = np.eye(layout.nchannels) - - for i_frame in range(N_frames): - - start = i_frame * frame_len - end = (i_frame + 1) * frame_len - - q = trj_data[i_frame % trj_frames, :] - - rotated_pos = np.array( - [ - rotateAziEle(a, e, Quat2RotMat(q)) - for a, e in zip(layout.ls_azi, layout.ls_ele) - ] - ) - R = panner.pan(rotated_pos[:, 0], rotated_pos[:, 1]) - R[:, layout.lfe_index] = np.zeros([layout.nchannels, 1]) - R[layout.lfe_index, layout.lfe_index] = 1 - - frame_in = x[start:end, :] - frame_out = y[start:end, :] - - frame_out[:, :] = (fade_in * frame_in @ R) + (fade_out * frame_in @ R_old) - - R_old = R.copy() - - return y diff --git a/scripts/pyaudio3dtools/spatialaudioconvert.py b/scripts/pyaudio3dtools/spatialaudioconvert.py deleted file mode 100644 index 0040f28acea8ca519189f920a1bc516ecf1991ca..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/spatialaudioconvert.py +++ /dev/null @@ -1,570 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import logging -import os -import warnings -from typing import Optional, Tuple - -import numpy as np - -from pyaudio3dtools import ( - EFAP, - audioarray, - audiofile, - binauralrenderer, - hoadecoder, - masarenderer, - spatialaudioformat, - spatialmetadata, -) -from pyaudio3dtools.constants import * - -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - - -def spatial_audio_convert( - in_file: str, - out_file: str, - in_format: Optional[str] = None, - in_fs: Optional[int] = None, - in_nchans: Optional[int] = None, - in_meta_files: Optional[list] = None, - out_format: Optional[str] = None, - out_fs: Optional[int] = None, - out_fc: Optional[int] = None, - output_loudness: Optional[int] = None, - loudness_tool: Optional[str] = None, - limit_output: Optional[bool] = False, - cut_preamble_s: Optional[int] = None, - trajectory: Optional[str] = None, - bin_rend_include_LFE: Optional[bool] = True, - bin_rend_LFE_gain: Optional[float] = 10 ** (5.5 / 20), - binaural_dataset: Optional[str] = "orange53", -) -> Tuple[np.ndarray, int]: - """ - Spatial audio conversion between various formats - - Parameters - ---------- - in_file: str - input filename - out_file: str - output filename - - in_format: Optional[str] - input spatial audio format - in_fs: Optional[int] - input sampling frequency - in_nchans: Optional[int] - input number of channels (deduced for .wav) - - out_format: Optional[str] - output spatial audio format - out_fs: Optional[int] - output sampling frequency - out_fc: Optional[int] - output cutoff frequency (low-pass filtering) - - output_loudness: Optional[int] - Loudness level in LKFS/dBov - loudness_tool: Optional[str] - Loudness tool to use. Must be in $PATH. - Supported tools: - ITU-R BS.1770-4 / "bs1770demo" (default) - ITU-T P.56 / "sv56demo" - - limit_output: Optional[bool] - flag whether to apply limiting to the output - cut_preamble_s: Optional[int] - preamble to cut in seconds - - trajectory: Optional[str] - head rotation trajectory file (for binaural rendering) - bin_rend_include_LFE: Optional[bool] - flag to include LFE in binaural rendering - bin_rend_LFE_gain: Optional[float] - gain to apply for LFE in binaural rendering - binaural_dataset: Optional[str] - dataset for binaural HRIR or BRIRs - - Returns - ------- - out_sig : np.ndarray - output signal - out_fs : int - output sampling frequency - """ - - """ get spatial input and audio format configurations """ - if in_format is None: - if in_nchans is not None: - in_format = spatialaudioformat.Format.detect_format(in_nchans) - in_spfmt = spatialaudioformat.Format(in_format) - logger.info(f" Input spatial audio format detected: {in_format}") - else: - logger.info(f" Input spatial audio format: {in_format}") - in_spfmt = spatialaudioformat.Format(in_format) - - if out_format is None: - out_format = in_format - logger.info( - f" Output spatial audio format not specified, defaulting to pass-through: {out_format}" - ) - out_spfmt = spatialaudioformat.Format(out_format) - - """ read input file """ - # Input is either waveform file (.pcm or .wav) or iis metadata (.txt) - _, input_ext = os.path.splitext(os.path.basename(in_file)) - - if input_ext == ".pcm": - if in_fs is None: - if out_fs: - in_fs = out_fs - else: - raise ValueError("Input and output fs not defined.") - if in_nchans is None: - if in_spfmt is not None: - in_nchans = in_spfmt.nchannels - else: - raise ValueError( - "Number of input channels not defined and can't be deduced." - ) - in_sig, in_fs = audiofile.readfile(in_file, fs=in_fs, nchannels=in_nchans) - elif input_ext == ".wav": - in_sig, in_fs = audiofile.readfile(in_file) - if in_format is None: - in_format = spatialaudioformat.Format.detect_format(in_sig.shape[1]) - in_spfmt = spatialaudioformat.Format(in_format) - - # Adjust number of channels if case of HOA, zeroed vert channels if planar - if in_spfmt.ambi_order > 0: - in_sig = audioarray.convert(in_sig, out_nchans=in_spfmt.nchannels) - elif input_ext == ".txt": - metadata_obj = spatialmetadata.Metadata(in_file, audio_fs=in_fs) - in_sig, in_fs = metadata_obj.get_audio_array() - if in_spfmt.name != "META": - logger.info( - f" {in_spfmt.name} specified with .txt input file: overriding to META format" - ) - in_format = "META" - in_spfmt = spatialaudioformat.Format(in_format) - else: - raise Exception(f"Not supported file {input_ext}") - _, in_nchans = in_sig.shape - - """ convert metadata based formats (ISM / META) directly to output format """ - if in_spfmt.name.startswith("META") or in_spfmt.name.startswith("ISM"): - if out_spfmt.name.startswith("META"): - raise Exception("out format must be specified for META (.txt) or ISM input") - - if in_spfmt.name.startswith("ISM"): - if in_meta_files is None: - raise ValueError( - f"Please specify a list of metadata files for {in_spfmt.name}" - ) - if len(in_meta_files) != int(in_spfmt.name[-1]): - raise ValueError( - f"Mismatch between number of streams and number of specified metadata files for {in_spfmt.name}" - ) - - # initialise metadata object for ISM - metadata_obj = spatialmetadata.Metadata() - metadata_obj.init_for_ism(in_file, in_fs, in_nchans, in_meta_files) - - # TODO decide on reference path for BINAURAL_ROOM - if out_spfmt.name.startswith("BINAURAL_ROOM"): - in_format = "7_1_4" - else: - in_format = out_format - in_spfmt = spatialaudioformat.Format(in_format) - - else: - # set input format to output format - # render_meta() handles all conversions - in_format = out_format - in_spfmt = out_spfmt - - in_sig = render_meta( - metadata_obj, - in_spfmt, - dataset=binaural_dataset, - fs=in_fs, - trajectory=trajectory, - include_LFE=bin_rend_include_LFE, - LFE_gain=bin_rend_LFE_gain, - ) - - """ cut preamble """ - if cut_preamble_s is not None: - samples_to_cut = int(cut_preamble_s * in_fs) - if samples_to_cut > 0: - logger.info(f" Cut preample by {samples_to_cut} samples") - in_sig = audioarray.cut(in_sig, (samples_to_cut, -1)) - - """ zero non-planar input ambisonics channels """ - if in_spfmt.ambi_order > 0 and in_spfmt.isplanar: - in_sig = spatialaudioformat.Format.zero_vert_hoa_channels(in_sig) - - """ Spatial audio format conversion """ - out_sig = in_sig - if (in_spfmt.name != out_spfmt.name) and not ( - in_spfmt.isheadphones and out_spfmt.isheadphones - ): - logger.info(f" {in_spfmt.name} -> {out_spfmt.name}") - - # binaural output (except MASA) - if out_spfmt.name.startswith("BINAURAL") and not in_spfmt.name.startswith( - "MASA" - ): - out_sig = binauralrenderer.binaural_rendering( - in_sig, - in_spfmt, - out_spfmt, - dataset=binaural_dataset, - fs=in_fs, - trajectory=trajectory, - include_LFE=bin_rend_include_LFE, - LFE_gain=bin_rend_LFE_gain, - ) - # non-binaural outputs - # HOA conversion - elif in_spfmt.ambi_order > 0: - out_sig = convert_sba(in_sig, in_spfmt, out_spfmt) - - # MC conversion - elif in_spfmt.isloudspeaker: - out_sig = convert_mc(in_sig, in_spfmt, out_spfmt) - - # MASA conversion - elif in_spfmt.name.startswith("MASA"): - out_sig = convert_masa(in_sig, in_fs, in_meta_files, in_spfmt, out_spfmt) - else: - raise NotImplementedError( - f"{in_spfmt.name} -> {out_spfmt.name}: format conversion not implemented" - ) - - """ zero non-planar output ambisonics channels """ - if out_spfmt.ambi_order > 0 and out_spfmt.isplanar: - out_sig = spatialaudioformat.Format.zero_vert_hoa_channels(out_sig) - - """ resampling """ - if (out_fs is not None) and (out_fs != in_fs): - out_sig = audioarray.resample(out_sig, in_fs, out_fs) - else: - out_fs = in_fs - - """ low-pass filtering """ - if out_fc is not None: - logger.info(f" Low-pass filter ({out_fc}Hz)") - out_sig = audioarray.lpfilter(out_sig, out_fc, out_fs) - - """ limiting """ - if limit_output: - logger.info(" apply limiter") - audioarray.limiter(out_sig, out_fs) - - """ loudness normalization """ - if output_loudness: - _, scale_factor = audiofile.loudnessinfo( - out_sig, - out_fs, - out_format, - output_loudness=output_loudness, - loudness_tool=loudness_tool, - ) - out_sig *= scale_factor - - audiofile.writefile(out_file, out_sig, out_fs) - - return out_sig, out_fs - - -def convert_sba( - in_sig: np.ndarray, - in_spfmt: spatialaudioformat.Format, - out_spfmt: spatialaudioformat.Format, -) -> np.ndarray: - """Convert an ambisonics signal to the requested output format""" - # HOA -> LS - if out_spfmt.isloudspeaker: - HOA2LS = hoadecoder.get_hoa_mtx(in_spfmt.ambi_order, out_spfmt) - return hoadecoder.hoa_linear_decoding(in_sig, HOA2LS) - # HOA -> HOA - elif out_spfmt.ambi_order > 0: - return audioarray.convert(in_sig, in_fs=None, out_nchans=out_spfmt.nchannels) - else: - raise NotImplementedError( - f"{in_spfmt.name} -> {out_spfmt.name}: format conversion not implemented" - ) - - -def convert_mc( - in_sig: np.ndarray, - in_spfmt: spatialaudioformat.Format, - out_spfmt: spatialaudioformat.Format, -) -> np.ndarray: - """Convert a multichannel signal to the requested output format""" - # MC -> LS - if in_spfmt.name == "STEREO" and out_spfmt.name == "MONO": - MC2LS = np.vstack([[0.5], [0.5]]) - return in_sig @ MC2LS - elif out_spfmt.isloudspeaker: - try: - MC2LS = IVAS_MC_CONVERSION[in_spfmt.name][out_spfmt.name] - except KeyError: - ls_azi_woLFE = np.delete(out_spfmt.ls_azi, out_spfmt.lfe_index).astype( - float - ) - ls_ele_woLFE = np.delete(out_spfmt.ls_ele, out_spfmt.lfe_index).astype( - float - ) - - panner = EFAP.EFAP(ls_azi_woLFE, ls_ele_woLFE) - - MC2LS = np.vstack( - [ - panner.pan(a, e).T - for i, (a, e) in enumerate(zip(in_spfmt.ls_azi, in_spfmt.ls_ele)) - if i not in in_spfmt.lfe_index - ] - ) - # TODO tmu : implement configurable LFE handling - # pass-through for LFE - MC2LS = np.insert(MC2LS, in_spfmt.lfe_index, 0, axis=0) - MC2LS = np.insert(MC2LS, out_spfmt.lfe_index, 0, axis=1) - MC2LS[in_spfmt.lfe_index, out_spfmt.lfe_index] = 1 - - # TODO tmu temporarily disable LFE rendering to MONO/STEREO - if out_spfmt.name == "MONO" or out_spfmt.name == "STEREO": - MC2LS[in_spfmt.lfe_index, :] = 0 - return in_sig @ MC2LS - # MC -> HOA - elif out_spfmt.ambi_order > 0: - # SH response for loudspeaker positions - MC2HOA = np.hstack( - [ - hoadecoder.getRSH([a], [e], out_spfmt.ambi_order) - for a, e in zip(in_spfmt.ls_azi, in_spfmt.ls_ele) - ] - ).T - - # do not add LFE to output - MC2HOA[in_spfmt.lfe_index] = 0 - - return in_sig @ MC2HOA - else: - raise NotImplementedError( - f"{in_spfmt.name} -> {out_spfmt.name}: format conversion not implemented" - ) - - -def convert_ism( - in_sig: np.ndarray, - in_fs: int, - in_pos: dict, - in_spfmt: spatialaudioformat.Format, - out_spfmt: spatialaudioformat.Format, -) -> np.ndarray: - """Convert an ISM signal to the requested output format""" - pos_data = [] - for pos in in_pos: - pos_data.extend( - [pos["azimuth"], pos["elevation"]] for _ in range(pos["use_for_frames"]) - ) - pos_data = np.array(pos_data) - pos_frames = pos_data.shape[0] - - sig_len = in_sig.shape[0] - frame_len = IVAS_FRAME_LEN_MS * (in_fs // 1000) - - out_sig = np.zeros([sig_len, out_spfmt.nchannels]) - - fade_in = np.arange(frame_len) / (frame_len - 1) - fade_in = fade_in[:, np.newaxis] - fade_out = 1.0 - fade_in - - if out_spfmt.isloudspeaker: - ls_azi_woLFE = np.delete(out_spfmt.ls_azi, out_spfmt.lfe_index) - ls_ele_woLFE = np.delete(out_spfmt.ls_ele, out_spfmt.lfe_index) - panner = EFAP.EFAP(ls_azi_woLFE, ls_ele_woLFE) - - gains_old = None - - for i_frame, (in_frame, out_frame) in enumerate( - zip( - audioarray.get_framewise(in_sig, frame_len), - audioarray.get_framewise(out_sig, frame_len), - ) - ): - # update the crossfade if we have a smaller last frame - if out_frame.shape[0] != frame_len: - frame_size = out_frame.shape[0] - fade_in = np.arange(frame_size) / (frame_size - 1) - fade_in = fade_in[:, np.newaxis] - fade_out = 1.0 - fade_in - - pos = EFAP.wrap_angles(*pos_data[i_frame % pos_frames, :], clip_ele=True) - - # ISM -> MC - if out_spfmt.isloudspeaker: - gains = panner.pan(pos[0], pos[1]) - gains = np.insert(gains, out_spfmt.lfe_index, 0) - gains = gains[:, np.newaxis] - # ISM -> HOA - elif out_spfmt.ambi_order > 0: - gains = hoadecoder.getRSH([pos[0]], [pos[1]], out_spfmt.ambi_order) - else: - raise NotImplementedError( - f"{in_spfmt.name} -> {out_spfmt.name}: format conversion not implemented" - ) - - if gains_old is None: - gains_old = gains.copy() - - out_frame[:] = (fade_in * in_frame @ gains.T) + ( - fade_out * in_frame @ gains_old.T - ) - - gains_old = gains.copy() - - return out_sig - - -def convert_masa( - in_sig: np.ndarray, - in_fs: int, - in_meta: str, - in_spfmt: spatialaudioformat.Format, - out_spfmt: spatialaudioformat.Format, -) -> np.ndarray: - """Convert a MASA signal to the requested output format""" - - if in_fs != 48000: - raise ValueError(f"{in_spfmt.name} rendering only support for 48kHz!") - - tmp_spfmt = out_spfmt - - # MASA -> LS - if out_spfmt.isloudspeaker: - if not (out_spfmt.name == "5_1" or out_spfmt.name == "7_1_4"): - tmp_spfmt = spatialaudioformat.Format("7_1_4") - warnings.warn( - f"{out_spfmt.name} not natively supported by masaRenderer, using {tmp_spfmt.name} as intermediate format" - ) - # MASA -> HOA - elif out_spfmt.ambi_order > 0: - tmp_spfmt = spatialaudioformat.Format("7_1_4") - warnings.warn( - f"{out_spfmt.name} not natively supported by masaRenderer, using {tmp_spfmt.name} as intermediate format" - ) - elif out_spfmt.name == "BINAURAL": - warnings.warn( - f"Using masaRenderer for rendering; any binaural_dataset setting will be ignored!" - ) - else: - raise NotImplementedError( - f"{in_spfmt.name} -> {out_spfmt.name}: format conversion not implemented" - ) - - out_sig = masarenderer.render_masa(in_sig, in_meta, in_spfmt, tmp_spfmt) - - # conversion done - if tmp_spfmt.name == out_spfmt.name: - return out_sig - # only rendered an intermediate format, more conversion needed - else: - return convert_mc(out_sig, tmp_spfmt, out_spfmt) - - -def render_meta( - metadata_obj: spatialmetadata.Metadata, - dest_fmt: spatialaudioformat.Format, - dataset: str, - fs: int, - trajectory: str, - include_LFE: bool = False, - LFE_gain: float = 10 ** (5.5 / 20), -) -> np.ndarray: - """Render mixed scene metadata to the desired format""" - - logger.info(f" META -> {dest_fmt.name}") - - out_sig = np.zeros([metadata_obj.audio_array.shape[0], dest_fmt.nchannels]) - - for object in metadata_obj.objects: - # extract object signal - start = object["track_index"] - stop = start + object["nb_tracks"] - obj_sig = metadata_obj.audio_array[:, start:stop] - # apply gain - if hasattr(object, "gain"): - obj_sig *= object["gain"] - - if dest_fmt.name.startswith("BINAURAL"): - if object["input_type"] == "ism": - src_format = spatialaudioformat.Format(f"ISM") - positions = object["positions"] - if object["input_type"] == "sba": - src_format = spatialaudioformat.Format(f"SBA{object['order']}") - positions = None - elif object["input_type"] == "mc": - src_format = spatialaudioformat.Format(f"CICP{object['cicp_index']}") - positions = None - - out_sig += binauralrenderer.binaural_rendering( - obj_sig, - src_format, - dest_fmt, - dataset=dataset, - fs=fs, - trajectory=trajectory, - include_LFE=include_LFE, - LFE_gain=LFE_gain, - in_pos=positions, - ) - else: - if object["input_type"] == "ism": - src_format = spatialaudioformat.Format("ISM") - out_sig += convert_ism( - obj_sig, fs, object["positions"], src_format, dest_fmt - ) - elif object["input_type"] == "sba": - src_format = object["format"] - out_sig += convert_sba(obj_sig, src_format, dest_fmt) - elif object["input_type"] == "mc": - src_format = object["format"] - out_sig += convert_mc(obj_sig, src_format, dest_fmt) - - return out_sig diff --git a/scripts/pyaudio3dtools/spatialmetadata.py b/scripts/pyaudio3dtools/spatialmetadata.py deleted file mode 100644 index 3cf1338d4fb45ce47f04b4fc905a418a576059c1..0000000000000000000000000000000000000000 --- a/scripts/pyaudio3dtools/spatialmetadata.py +++ /dev/null @@ -1,492 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import logging -import math -import os -from typing import Optional, TextIO - -import numpy as np - -from pyaudio3dtools import audioarray, audiofile, spatialaudioformat - -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - - -class Metadata: - def __init__( - self, - metadata_path: Optional[str] = None, - metadata_format: Optional[str] = "iis", - audio_wav_path: Optional[str] = None, - audio_fs: Optional[int] = 48000, - ): - """ - Spatial Metadata - - Parameters - ---------- - metadata_path: Optional[str] - path to metadata file - metadata_format: Optional[str] - format for metadata file, supported: ["iis", "ivas_ism"] - audio_wav_path: Optional[str] - path to corresponding audio files - audio_fs: Optional[int] - audio sampling frequency - - Returns - ------- - self - - """ - - self._delete_all() - if audio_fs is None: - audio_fs = 48000 - self.audio_fs = audio_fs - - # init from input file - if metadata_path is not None and os.path.isfile(metadata_path): - self.read_metadata(metadata_path, metadata_format, audio_wav_path) - - def _delete_all(self) -> None: - self.objects = [] # list of audio objects - self.nb_objects = 0 # Number of objects - self.nb_tracks = 0 # Number of tracks - self.audio_wav = [] # list of wav files - self.audio_array = np.zeros([1, 0]) - self.nb_frames = 0 # Number of frames - - def read_metadata( - self, - metadata_path: str, - metadata_format: str = "iis", - audio_wav_path: Optional[str] = None, - ) -> None: - if metadata_format == "iis": - with open(metadata_path, "r") as file_in: - dirname = os.path.dirname(metadata_path) - self.audio_wav.append(os.path.join(dirname, file_in.readline().strip())) - nb_new_objects = int(file_in.readline()) - - for _ in range(nb_new_objects): - in_type = file_in.readline().strip() - - if in_type.lower() == "ism": - self.objects.append(read_ism_input(file_in, dirname)) - elif in_type.lower() == "sba": - self.objects.append(read_sba_input(file_in)) - elif in_type.lower() == "mc": - self.objects.append(read_mc_input(file_in)) - else: - raise ValueError("Unknown input type in metadata file") - - self._append_audio_array(self.audio_wav[-1]) - self.nb_objects += 1 - - elif metadata_format == "ivas_ism": - if audio_wav_path is None: - raise FileNotFoundError("Wave file not specified!") - - self.audio_wav.append(audio_wav_path) - self.objects.append( - read_ism_ivas_data(metadata_path, object_index=self.nb_objects) - ) - self._append_audio_array(self.audio_wav[-1]) - self.nb_objects += 1 - else: - raise ValueError("Metadata: unknown metadata format") - - def write_metadata( - self, - metadata_path: str, - metadata_format: str = "iis", - audio_output_path: Optional[str] = None, - max_objects: Optional[int] = None, - ) -> list: - metadata_out_list = [] - - if metadata_format == "iis": - with open(metadata_path, "w") as file_out: - if audio_output_path is not None: - file_out.write(f"{audio_output_path}\n") - dirname = os.path.dirname(metadata_path) - self.write_audio_array(os.path.join(dirname, audio_output_path)) - - file_out.write(f"{str(self.nb_objects)}\n") - for object_index in range(self.nb_objects): - if self.objects[object_index]["input_type"] == "ism": - write_ism_input( - file_out, - self.objects[object_index], - metadata_path, - num_frames=self.nb_frames, - ) - elif self.objects[object_index]["input_type"] == "sba": - write_sba_input(file_out, self.objects[object_index]) - elif self.objects[object_index]["input_type"] == "mc": - write_mc_input(file_out, self.objects[object_index]) - else: - raise ValueError("Unknown input type in metadata file") - - metadata_out_list.append(file_out.name) - - elif metadata_format == "ivas_ism": - outfilename, output_ext = os.path.splitext(os.path.basename(metadata_path)) - x = np.zeros([1, 0]) - - for object_index in range(self.nb_objects): - if self.objects[object_index]["input_type"] == "ism": - # Prepare audio wavefrom - if audio_output_path is not None: - chan_start = self.objects[object_index]["track_index"] - chan_end = chan_start + self.objects[object_index]["nb_tracks"] - if x.shape[1] == 0: - x = self.audio_array[:, chan_start:chan_end] - else: - x = np.append( - x, self.audio_array[:, chan_start:chan_end], axis=1 - ) - - # Write positions - with open( - metadata_path.replace( - output_ext, - str(self.objects[object_index]["track_index"]) + output_ext, - ), - "w", - ) as file_out: - write_ism_ivas_data( - file_out, - self.objects[object_index], - num_frames=self.nb_frames, - ) - metadata_out_list.append(file_out.name) - - if (max_objects is not None) and ( - len(metadata_out_list) >= max_objects - ): - break - - # Write audio waveform - if audio_output_path is not None: - audiofile.writefile(audio_output_path, x, fs=self.audio_fs) - - return metadata_out_list - - def print_info(self) -> None: - print(f"Number of objects in the scene: {self.nb_objects}") - for object_index in range(self.nb_objects): - print(f" Object #{object_index} Type: {self.objects[object_index]}") - - def _append_audio_array(self, audio_wav=None, fs=48000, nchan=1, object_index=None): - if audio_wav is None: - audio_wav = self.audio_wav[-1] - if object_index is None: - object_index = -1 - - x, fs = audiofile.readfile(audio_wav, fs=fs, nchannels=nchan) - logger.debug(f"Append {audio_wav}: {x.shape[0]} by {x.shape[1]}") - - # Select appropriate channels & resample if necessary - chan_start = self.objects[object_index]["track_index"] - chan_end = chan_start + self.objects[object_index]["nb_tracks"] - logger.debug(f" channels from {chan_start} to {chan_end}") - x = x[:, chan_start:chan_end] - x = audioarray.resample(x, fs, self.audio_fs) - - # Append array and update track index - self.objects[object_index]["track_index"] = self.audio_array.shape[1] - if self.audio_array.shape[1] == 0: - self.audio_array = x - else: - len_min = min([self.audio_array.shape[0], x.shape[0]]) - self.audio_array = np.append( - self.audio_array[:len_min][:], x[:len_min][:], axis=1 - ) - - self.nb_tracks = self.nb_tracks + x.shape[1] - self.nb_frames = math.ceil(50.0 * self.audio_array.shape[0] / self.audio_fs) - - # init with list of ISM metadata files - def init_for_ism( - self, - in_file: str, - in_fs: int, - in_nchan: int, - metadata_files: list, - ) -> None: - self.audio_wav.append(in_file) - - for csv in metadata_files: - self.objects.append(read_ism_ivas_data(csv, object_index=self.nb_objects)) - self.objects[-1]["track_index"] = self.nb_objects - self._append_audio_array(self.audio_wav[-1], fs=in_fs, nchan=in_nchan) - self.nb_objects += 1 - - # Get audio array with sampling rate - def get_audio_array(self): - return self.audio_array, self.audio_fs - - # Set audio array from file - def set_audio_array(self, audio_path, fs=None): - if fs is None: - fs = self.audio_fs - audiofile.readfile(audio_path, self.audio_array, fs) - self.audio_fs = fs - - # Write in file audio array - def write_audio_array(self, audio_path): - audiofile.writefile(audio_path, self.audio_array, fs=self.audio_fs) - - -################################################## -# Helper functions for IIS metadata -################################################## -def read_ism_input(file_handle: TextIO, dirname: str) -> dict: - """ - Read ISM Input (IIS metadata format) - - Parameters - ---------- - file_handle: TextIO - file pointer - dirname: str - root directory used to read csv files - - Returns - ------- - dict - ISM dictionary with positions - """ - ism = {"input_type": "ism"} - ism["track_index"] = int(file_handle.readline()) - 1 - ism["nb_tracks"] = 1 - ism["positions"] = [] - ism["gain"] = 1 - line = file_handle.readline() - - try: - ism["num_positions"] = int(line) - for _ in range(ism["num_positions"]): - [use_for_frames, azimuth, elevation] = ( - file_handle.readline().strip().split(",") - ) - pos = {} - pos["use_for_frames"] = int(use_for_frames) - pos["azimuth"] = int(azimuth) - pos["elevation"] = int(elevation) - ism["positions"].append(pos) - ism["gain"] = read_gain_value(file_handle) - except: - meta_csv = os.path.join(dirname, line.strip()) - pos_idx = 0 - with open(meta_csv) as file_handle: - for line in file_handle: - current_values = line.strip().split(",") - pos = {} - pos["use_for_frames"] = 1 - pos["azimuth"] = float(current_values[0]) - pos["elevation"] = float(current_values[1]) - ism["positions"].append(pos) - pos_idx += 1 - - ism["num_positions"] = pos_idx - - return ism - - -def write_ism_input( - file_handle: TextIO, - ism_dict: dict, - metadata_path: Optional[str] = None, - num_frames: Optional[int] = None, -) -> None: - """ - Write ISM Input (IIS metadata format) - - Parameters - ---------- - file_handle: TextIO - file pointer - ism_dict: dict - ISM dictionnary with positions - metadata_path: Optional[str] - if given positions writen cvs format - num_frame: Optional[int] - number of frames to be written - - Returns - ------- - None - """ - file_handle.write("ISM\n") - track_index = ism_dict["track_index"] - file_handle.write(f"{str(track_index + 1)}\n") - - if metadata_path is None: - num_positions = ism_dict["num_positions"] - file_handle.write(f"{str(num_positions)}\n") - - positions = ism_dict["positions"] - for pos_idx in range(ism_dict["num_positions"]): - use_for_frames = positions[pos_idx]["use_for_frames"] - azimuth = round(positions[pos_idx]["azimuth"]) - elevation = round(positions[pos_idx]["elevation"]) - - file_handle.write(f"{use_for_frames:04d},{azimuth:+03d},{elevation:+03d}\n") - else: - # Write filename - _, extname = os.path.splitext(metadata_path) - dirname = os.path.dirname(metadata_path) - basename = os.path.basename(metadata_path).replace( - extname, "." + str(track_index) + ".csv" - ) - file_handle.write(f"{basename}\n") - # Write positions - with open(os.path.join(dirname, basename), "w") as file_out: - write_ism_ivas_data(file_out, ism_dict, num_frames=num_frames) - - -def read_sba_input(file_handle: TextIO) -> dict: - sba = {"input_type": "sba"} - sba["track_index"] = int(file_handle.readline()) - 1 - sba["format"] = spatialaudioformat.Format(f"SBA{int(file_handle.readline())}") - sba["order"] = sba["format"].ambi_order - sba["nb_tracks"] = (sba["order"] + 1) ** 2 - sba["gain"] = read_gain_value(file_handle) - return sba - - -def write_sba_input(file_handle: TextIO, sba_dict: dict) -> None: - file_handle.write("SBA\n") - track_index = sba_dict["track_index"] - file_handle.write(f"{str(track_index + 1)}\n") - order = sba_dict["order"] - file_handle.write(f"{str(order)}\n") - - -def read_mc_input(file_handle: TextIO) -> dict: - mc = {"input_type": "mc"} - mc["track_index"] = int(file_handle.readline()) - 1 - mc["format"] = spatialaudioformat.Format(file_handle.readline().strip()) - mc["nb_tracks"] = mc["format"].nchannels - mc["gain"] = read_gain_value(file_handle) - return mc - - -def write_mc_input(file_handle: TextIO, mc_dict: dict) -> None: - file_handle.write("MC\n") - track_index = mc_dict["track_index"] - file_handle.write(f"{str(track_index + 1)}\n") - name = mc_dict["format"].name - file_handle.write(f"{name}\n") - - -def read_gain_value(file_handle: TextIO) -> float: - original_pos = file_handle.tell() - gain = file_handle.readline().lower() - if gain.startswith("gain_db"): - gain = float(gain.replace("gain_db", "")) - return 10 ** (gain / 20) - else: - file_handle.seek(original_pos) - return 1 - - -################################################## -# Helper functions for ISM IVAS metadata -################################################## -def read_ism_ivas_data(metadata_path: str, object_index: int = 0) -> None: - ism = {"input_type": "ism"} - ism["track_index"] = 0 - ism["num_positions"] = 0 - ism["nb_tracks"] = 1 - ism["positions"] = [] - - pos_idx = 0 - - try: - with open(metadata_path) as file_handle: - for line in file_handle: - current_values = line.strip().split(",") - pos = {} - pos["use_for_frames"] = 1 - pos["azimuth"] = float(current_values[0]) - pos["elevation"] = float(current_values[1]) - ism["positions"].append(pos) - pos_idx += 1 - except FileNotFoundError: - # TODO in case of NULL metadata we can also spread the objects spatially - pos = {} - pos["use_for_frames"] = 1 - pos["azimuth"] = 0.0 - pos["elevation"] = 0.0 - ism["positions"].append(pos) - pos_idx += 1 - - ism["num_positions"] = pos_idx - return ism - - -def write_ism_ivas_data( - file_handle: TextIO, ism_dict: dict, num_frames: Optional[int] = None -) -> None: - positions = ism_dict["positions"] - - if num_frames is None: - num_frames = 0 - for pos_idx in range(len(positions)): - num_frames += positions[pos_idx]["use_for_frames"] - - # Constants for all positions - distance = 1.0 - spread = 0.0 - gain = 1.0 - pos_idx = 0 - pos_used_times = 0 - for _ in range(num_frames): - azimuth = float(positions[pos_idx]["azimuth"]) - elevation = float(positions[pos_idx]["elevation"]) - - file_handle.write( - f"{azimuth:+07.2f},{elevation:+06.2f},{distance:05.2f},{spread:06.2f},{gain:04.2f}\n" - ) - - pos_used_times += 1 - - if pos_used_times == positions[pos_idx]["use_for_frames"]: - pos_idx = (pos_idx + 1) % len(positions) - pos_used_times = 0 diff --git a/scripts/pyivastest/IvasModeAnalyzer.py b/scripts/pyivastest/IvasModeAnalyzer.py index fed4f29ecdcbf16219db68176a62e366d8944d5d..7e6d40b2e588a1cf33d0a2f0eb1ce71eeb78b3e4 100644 --- a/scripts/pyivastest/IvasModeAnalyzer.py +++ b/scripts/pyivastest/IvasModeAnalyzer.py @@ -187,8 +187,9 @@ class IvasModeAnalyzer(IvasModeCollector): all_log_files = os.listdir(log_dir) for mode in self.flat_mode_list: for f in all_log_files: + search_string = re.escape("_{}".format(mode)) if ( - re.search("_{}".format(mode), f) + re.search(search_string, f) and os.path.splitext(f)[1] == LOG_FILE_EXT ): # this is a log file belonging to the ivas_format @@ -958,6 +959,7 @@ class IvasModeAnalyzer(IvasModeCollector): IvasModeAnalyzer.write_csv_file(filename, table) def all_instrumented_to_csv(self, basefilename, encdec=-1): + basefilename = os.path.abspath(basefilename) for value in INSTRUMENTED_RESULTS: table = self.get_instrumented_value(value, encdec=encdec) IvasModeAnalyzer.write_csv_file("".join([basefilename, "_", value]), table) diff --git a/scripts/pyivastest/IvasScriptsCommon.py b/scripts/pyivastest/IvasScriptsCommon.py index 3df9994170a1cdfb3b4957b4bd6f7363f08a612d..681e6b1b7f4c1a0b35122be3467464223631db8b 100644 --- a/scripts/pyivastest/IvasScriptsCommon.py +++ b/scripts/pyivastest/IvasScriptsCommon.py @@ -631,7 +631,8 @@ def runner_setup(runner, args): if args["item_list"]: runner.set_global_item_list(args["item_list"]) if args["metadata_files"]: - runner.set_global_metadata_file_list(args["metadata_files"]) + metadata_files = [os.path.abspath(f) for f in args["metadata_files"]] + runner.set_global_metadata_file_list(metadata_files) if args["decoder_only"]: runner.run_encoder = False if args["info"]: diff --git a/scripts/pyprocessing/evs.py b/scripts/pyprocessing/evs.py deleted file mode 100644 index 6de86f2a27b2a69adf3d1567a165207b7618dfde..0000000000000000000000000000000000000000 --- a/scripts/pyprocessing/evs.py +++ /dev/null @@ -1,238 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import logging -import os - -from pyaudio3dtools import audiofile, spatialaudioformat, spatialmetadata -from pyaudio3dtools.spatialaudioconvert import render_meta - -from pyprocessing import utils -from pyprocessing.processing import Processing - -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - - -class EVS(Processing): - def __init__( - self, - in_format: str, - out_format: str, - bitrate: int, - in_fs: int = 48000, - **kwargs, - ): - super().__init__() - for k, v in kwargs.items(): - setattr(self, k, v) - self.in_format = spatialaudioformat.Format(in_format) - self.out_format = spatialaudioformat.Format(out_format) - if isinstance(bitrate, int): - self.bitrate = [bitrate] - if self.in_format.nchannels > 0: - self.bitrate = [bitrate] * self.in_format.nchannels - elif isinstance(bitrate, list): - self.bitrate = bitrate - if self.in_format.nchannels > 0: - self.bitrate.extend([0] * (self.in_format.nchannels - len(bitrate))) - self.in_fs = in_fs - self.exec_enc = utils.get_exec_path(kwargs["cod_bin"]) - self.exec_dec = utils.get_exec_path(kwargs["dec_bin"]) - - if in_format != out_format: - raise ValueError(f"EVS_: output format must be equal to input format.") - if not os.path.exists(self.exec_enc): - raise FileNotFoundError( - f"The EVS encoder binary was not found at the given path: {self.exec_enc}" - ) - if not os.path.exists(self.exec_dec): - raise FileNotFoundError( - f"The EVS decoder binary was not found at the given path: {self.exec_dec}" - ) - - def process(self, input_path: str, output_path: str, tmp_path: str) -> None: - logger.debug(f"EVS {input_path} -> {output_path}") - # Read input file - _, input_ext = os.path.splitext(os.path.basename(input_path)) - _, output_ext = os.path.splitext(os.path.basename(output_path)) - if input_ext == ".txt": - metadata_obj = spatialmetadata.Metadata(input_path, audio_fs=self.in_fs) - input_multi_channels = output_path.replace(output_ext, ".pcm") - if self.in_format.name[:3] == "ISM": - # extract IVAS ISM metadata and - input_csv = output_path.replace(output_ext, ".csv") - metadata_files = metadata_obj.write_metadata( - input_csv, "ivas_ism", input_multi_channels, max_objects=4 - ) - # change number of ISM - self.in_format.name = "ISM" + str(len(metadata_files)) - self.in_format = spatialaudioformat.Format(self.in_format.name[:4]) - if len(self.bitrate) < len(metadata_files): - self.bitrate.extend( - [self.bitrate[-1]] * (len(metadata_files) - len(self.bitrate)) - ) - else: - in_sig, fs = metadata_obj.get_audio_array() - in_sig = render_meta(metadata_obj, self.in_spfmt) - audiofile.writefile(input_multi_channels, in_sig, self.in_fs) - elif input_ext == ".wav" or input_ext == ".pcm": - input_multi_channels = input_path - else: - raise ValueError(f"EVS: invalid audio input extension: {input_ext}") - - # Split the corresponding channels at enc_fs - split_chans_in = [] - for idx in range(self.in_format.nchannels): - split_chans_in.append( - output_path.replace(output_ext, "." + str(idx) + ".pcm") - ) - - audiofile.splitfiles( - input_multi_channels, - split_chans_in, - in_nchans=self.in_format.nchannels, - in_fs=self.in_fs, - out_fs=self.enc_fs, - ) - - # Zero vertical Ambi channels if planar - mute_next_chan = -1 - if self.in_format.ambi_order > 0 and self.in_format.isplanar: - mute_chans_enum = enumerate(self.in_format.get_vert_hoa_channels()) - _, mute_next_chan = next(mute_chans_enum) - - # run processing - split_chans_out = [] - for idx, split_in in enumerate(split_chans_in): - split_bs = split_in.replace(".pcm", ".bs") - split_out = split_in.replace(".pcm", ".dec.pcm") - - # Zero vertical Ambi channels if planar - if idx == mute_next_chan: - audiofile.mutefile(split_in, split_in, in_fs=self.enc_fs, in_nchans=1) - try: - _, mute_next_chan = next(mute_chans_enum) - except: - pass - - if self.bitrate[idx] > 0: - self.enc(split_in, split_bs, self.bitrate[idx]) - self.dec(split_bs, split_out) - else: - # zero channel - audiofile.convertfile( - split_in, split_out, in_fs=self.enc_fs, out_fs=self.dec_fs - ) - audiofile.mutefile(split_out, split_out, in_fs=self.dec_fs, in_nchans=1) - - split_chans_out.append(split_out) - - # Output file: combine waveform files into one output, and optinaly write iis metadata - if output_ext == ".pcm" or output_ext == ".wav": - audiofile.combinefiles( - split_chans_out, output_path, in_fs=self.dec_fs, out_fs=self.dec_fs - ) - elif output_ext == ".txt": - output_wav = output_path.replace(output_ext, ".wav") - if self.in_format.name[:3] == "ISM": - # Write new metadata - metadata_out_obj = spatialmetadata.Metadata(audio_fs=self.dec_fs) - for idx in range(self.in_format.nchannels): - logger.debug( - "EVS_mono Read metadata " - + metadata_files[idx] - + " with audio file " - + split_chans_out[idx] - ) - metadata_out_obj.read_metadata( - metadata_files[idx], - metadata_format="ivas_ism", - audio_wav_path=split_chans_out[idx], - ) - metadata_out_obj.write_metadata( - output_path, - metadata_format="iis", - audio_output_path=os.path.basename(output_wav), - ) - else: - # pass-trhough mode, rewrite only audio waveform with decoded file - audiofile.combinefiles( - split_chans_out, output_wav, in_fs=self.dec_fs, out_fs=self.dec_fs - ) - metadata_obj.write_metadata(output_path, metadata_format="iis") - else: - raise ValueError(f"EVS: invalid audio input extension: {output_ext}") - - def enc(self, input_wav: str, output_bs: str, bitrate: int) -> None: - input_pcm = output_bs.replace(".bs", ".pcm") - audiofile.convertfile(input_wav, input_pcm, out_nchans=1, out_fs=self.in_fs) - - cmd = [self.exec_enc] - if self.dtx: - cmd.append("-dtx") - - if self.cod_opt: - cmd.extend(self.cod_opt) - - cmd.extend( - [ - "-max_band", - self.max_band, - str(bitrate), - str(self.enc_fs // 1000), - input_pcm, - output_bs, - ] - ) - Processing.run(cmd) - - def dec(self, input_bs: str, output_wav: str) -> None: - cmd = [self.exec_dec] - - if self.dec_opt: - cmd.extend(self.dec_opt) - - cmd.extend([str(self.dec_fs // 1000), input_bs, output_wav]) - Processing.run(cmd) - - def get_processing_file_paths(self, template_out_file: str, input_ext: str) -> list: - if input_ext == ".wav" or input_ext == ".pcm": - return [template_out_file.replace(".wav", "_evs_mono.wav")] - elif input_ext == ".txt": - return [template_out_file.replace(".wav", "_evs_mono.txt")] - else: - raise ValueError(f"EVS: invalid audio input extension: {input_ext}") - - def get_total_bit_rate(self): - return sum(self.bitrate) diff --git a/scripts/pyprocessing/ivas.py b/scripts/pyprocessing/ivas.py deleted file mode 100644 index 0f182fd1fbf98f5a8daa31f69426bd351c8d73fb..0000000000000000000000000000000000000000 --- a/scripts/pyprocessing/ivas.py +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import logging -import os -from typing import Optional - -from pyaudio3dtools import audiofile, spatialaudioformat, spatialmetadata -from pyaudio3dtools.spatialaudioconvert import render_meta - -from pyprocessing import utils -from pyprocessing.processing import Processing - -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - - -class IVAS(Processing): - def __init__(self, in_format: str, bitrate: int, in_fs: int = 48000, **kwargs): - super().__init__() - for k, v in kwargs.items(): - setattr(self, k, v) - self.in_format = spatialaudioformat.Format(in_format) - self.bitrate = bitrate - self.in_fs = in_fs - self.out_format = spatialaudioformat.Format(kwargs["out_format"]) - self.exec_enc = utils.get_exec_path(kwargs["cod_bin"]) - self.exec_dec = utils.get_exec_path(kwargs["dec_bin"]) - self.ht_file = os.path.abspath(self.ht_file) - - if self.out_format.name == "ISM": - self.out_format.name = "EXT" - - if not os.path.exists(self.exec_enc): - raise FileNotFoundError( - f"The IVAS encoder binary was not found at the given path: {self.exec_enc}" - ) - if not os.path.exists(self.exec_dec): - raise FileNotFoundError( - f"The IVAS decoder binary was not found at the given path: {self.exec_dec}" - ) - - def process(self, input_path: str, output_path: str, tmp_path: str) -> None: - logger.debug(f"IVAS {input_path} -> {output_path}") - - _, output_ext = os.path.splitext(os.path.basename(output_path)) - if output_ext == ".wav": - output_bs = output_path.replace(".wav", ".bs") - else: - raise ValueError(f"IVAS: invalid audio input extension: {output_ext}") - - self.enc(input_path, output_bs) - self.dec(output_bs, output_path) - - def enc(self, input_path: str, output_bs: str) -> None: - logger.debug(f"IVAS encoder {input_path} -> {output_bs}") - - # Only resample and convert if wav, otherwise supposed pcm to be sampled at self.in_fs - _, input_ext = os.path.splitext(os.path.basename(input_path)) - metadata_files = [] - - # for MASA suppose that metadata file as same basename and location as input file - if self.in_format.name.lower()[:4] == "masa": - metadata_files.append(input_path.replace(input_ext, ".met")) - - # Support input file wav, pcm and txt (metadata iis) - if (input_ext == ".wav") or (input_ext == ".pcm"): - input_pcm = output_bs.replace(".bs", ".pcm") - audiofile.convertfile( - input_path, - input_pcm, - in_fs=self.in_fs, - out_fs=self.enc_fs, - in_nchans=self.in_format.nchannels, - out_nchans=self.in_format.nchannels, - ) - elif input_ext == ".txt": - metadata_obj = spatialmetadata.Metadata(input_path, audio_fs=self.enc_fs) - input_pcm = output_bs.replace(".bs", ".pcm") - input_csv = output_bs.replace(".bs", ".csv") - if self.in_format.name[:3] == "ISM": - # extract IVAS ISM metadata and - metadata_files = metadata_obj.write_metadata( - input_csv, "ivas_ism", input_pcm, max_objects=4 - ) - - # change number of ISM - self.in_format.name = "ISM" + str(len(metadata_files)) - self.in_format = spatialaudioformat.Format(self.in_format.name[:4]) - else: - in_sig = render_meta(metadata_obj, self.in_spfmt) - audiofile.writefile(input_pcm, in_sig, self.enc_fs) - else: - raise ValueError(f"IVAS: invalid audio input extension: {input_ext}") - - cmd = [self.exec_enc] - if self.dtx: - cmd.append("-dtx") - - if self.cod_opt: - cmd.extend(self.cod_opt) - - cmd.extend( - [ - *IVAS.parse_config(self.in_format, metadata_files), - "-max_band", - self.max_band, - str(self.bitrate), - str(self.enc_fs // 1000), - input_pcm, - output_bs, - ] - ) - Processing.run(cmd) - - def dec(self, input_bs: str, output_wav: str) -> None: - logger.debug(f"IVAS decoder {input_bs} -> {output_wav}") - - cmd = [self.exec_dec] - if self.head_tracking: - cmd.extend(["-T", self.ht_file]) - - if self.plc: - cmd.extend(["-FEC", str(self.plc_rate)]) - - if self.dec_opt: - cmd.extend(self.dec_opt) - - cmd.extend( - [ - self.out_format.name, - str(self.dec_fs // 1000), - input_bs, - output_wav, - ] - ) - Processing.run(cmd) - - @staticmethod - def parse_config(spformat: spatialaudioformat, metadata_files: Optional[list] = []): - name = spformat.name.lower() - - if name == "mono": - return [""] - elif name == "stereo": - return ["-stereo"] - elif name.startswith("ism"): - # replace any missing files with NULL - while len(metadata_files) < int(name[-1]): - metadata_files.append("NULL") - return ["-ism", name[-1]] + metadata_files[: int(name[-1])] - elif name.startswith("masa"): - return ["-masa", name[-1], metadata_files[0]] - elif spformat.ambi_order > 0: - if spformat.isplanar: - return ["-sba", f"-{spformat.ambi_order}"] - else: - return ["-sba", f"+{spformat.ambi_order}"] - elif spformat.isloudspeaker: - return ["-mc", name] - - raise ValueError(f"IVAS: Invalid input config: {spformat}") - - def get_processing_file_paths( - self, template_out_file: str, input_ext: Optional[str] = None - ) -> list: - return [template_out_file.replace(".wav", "_ivas.wav")] - - def get_total_bit_rate(self): - return self.bitrate diff --git a/scripts/pyprocessing/prepost_processing.py b/scripts/pyprocessing/prepost_processing.py deleted file mode 100644 index 3ea7411cea8e4d282b98661a55eda7c7496ad8d1..0000000000000000000000000000000000000000 --- a/scripts/pyprocessing/prepost_processing.py +++ /dev/null @@ -1,220 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import json -import logging -import os -import shutil -from typing import Optional - -from pyaudio3dtools import ( - audioarray, - audiofile, - binauralrenderer, - spatialaudioconvert, - spatialaudioformat, -) - -from pyprocessing import utils -from pyprocessing.processing import Processing - -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - - -class PreProcessing(Processing): - def __init__( - self, - out_format: str, - out_fs: int = 48000, - out_fc: Optional[int] = None, - output_loudness: Optional[int] = None, - loudness_tool: Optional[str] = "bs1770demo", - ): - super().__init__() - self.out_format = out_format - self.out_fs = out_fs - self.fc = out_fc - self.output_loudness = output_loudness - self.loudness_tool = loudness_tool - - def process(self, input_path: str, output_path: str, tmp_path: str): - output_nickname = utils.get_nickname(output_path) - logger.info( - f" Pre Processing: convert to {self.out_format} : {output_nickname}" - ) - - try: - spatialaudioconvert.spatial_audio_convert( - input_path, - tmp_path, - out_format=self.out_format, - out_fs=self.out_fs, - output_loudness=self.output_loudness, - loudness_tool=self.loudness_tool, - ) - except Exception as e: - logger.info( - f" Pre Processing: by-pass : {output_nickname}. Encountered exception {e}" - ) - else: - shutil.move(tmp_path, output_path) - - def get_processing_file_paths( - self, template_out_file: str, input_ext: Optional[str] = None - ) -> list: - return [template_out_file.replace(".wav", "_pre.wav")] - - -class PostProcessing(Processing): - def __init__( - self, - in_format: str, - out_format: str, - in_fs: int = 48000, - out_fs: int = 48000, - out_fc: Optional[int] = None, - binaural_rendered: bool = False, - limit_output: bool = False, - cut_preamble: float = 0.0, - split_file_path: str = "", - bin_rend_include_LFE: bool = False, - bin_rend_LFE_gain: Optional[float] = 10 ** (5.5 / 20), - binaural_dataset: Optional[str] = "orange53", - output_loudness: Optional[int] = None, - loudness_tool: Optional[str] = "bs1770demo", - ): - super().__init__() - self.in_spfmt = spatialaudioformat.Format(in_format=in_format) - self.out_spfmt = spatialaudioformat.Format(in_format=out_format) - - self.in_fs = in_fs - self.out_fs = out_fs - self.fc = out_fc - self.binaural_rendered = binaural_rendered - self.cut_preamble = cut_preamble - self.split_file_path = split_file_path - self.bin_rend_include_LFE = bin_rend_include_LFE - self.bin_rend_LFE_gain = bin_rend_LFE_gain - self.binaural_dataset = binaural_dataset - self.limit_output = limit_output - self.output_loudness = output_loudness - self.loudness_tool = loudness_tool - - def process(self, input_path: str, output_path: str, tmp_path: str): - output_nickname = utils.get_nickname(output_path) - logger.info( - f" Post Processing: {self.in_spfmt.name} -> {self.out_spfmt.name} : {output_nickname}" - ) - - # Spatial audio format conversion - spatialaudioconvert.spatial_audio_convert( - input_path, - tmp_path, - in_format=self.in_spfmt.name, - out_format=self.out_spfmt.name, - in_fs=self.in_fs, - out_fs=self.out_fs, - out_fc=self.fc, - cut_preamble_s=self.cut_preamble, - limit_output=self.limit_output, - bin_rend_include_LFE=self.bin_rend_include_LFE, - bin_rend_LFE_gain=self.bin_rend_LFE_gain, - output_loudness=self.output_loudness, - loudness_tool=self.loudness_tool, - binaural_dataset=self.binaural_dataset, - ) - shutil.move(tmp_path, output_path) - - # Binaural rendering - if self.binaural_rendered and "BINAURAL" not in self.out_spfmt.name: - out_sig, fs = audiofile.readfile(output_path) - bin_sig = binauralrenderer.binaural_rendering( - out_sig, - self.out_spfmt, - spatialaudioformat.Format("BINAURAL"), - fs=fs, - include_LFE=self.bin_rend_include_LFE, - LFE_gain=self.bin_rend_LFE_gain, - ) - output_binaural_wav = output_path.replace(".wav", "_BINAURAL.wav") - logger.info( - f" Rendering {self.out_spfmt.name} -> BINAURAL : {output_nickname[:-4]}_BINAURAL.wav" - ) - if self.limit_output: - logger.info(f" limiting") - audioarray.limiter(bin_sig, self.out_fs) - audiofile.writefile(output_binaural_wav, bin_sig, self.out_fs) - - # split file - if self.split_file_path: - # check for the split info - split_file_name = os.path.join( - self.split_file_path, - "".join( - [ - os.path.basename(output_path) - .replace(".wav", "") - .replace("_post", ""), - ".split", - ] - ), - ) - if os.path.exists(split_file_name): - fp = open(split_file_name, "r") - splits = json.load(fp) - fp.close - n_splits = len(splits) - 1 - for split_idx in range(n_splits): - output_path_split = output_path.replace( - ".wav", f"_split{split_idx}.wav" - ) - start = int(splits[split_idx] * self.out_fs) - stop = int(splits[split_idx + 1] * self.out_fs) - split_sig = audioarray.cut(out_sig, (start, stop)) - audiofile.writefile(output_path_split, split_sig, self.out_fs) - if (self.binaural_rendered is True) and ( - self.out_spfmt.name != "BINAURAL" - ): - output_bin_wav_split = output_binaural_wav.replace( - ".wav", f"_split{split_idx}.wav" - ) - split_sig = audioarray.cut(bin_sig, (start, stop)) - audiofile.writefile( - output_bin_wav_split, split_sig, self.out_fs - ) - - def get_processing_file_paths( - self, template_out_file: str, input_ext: Optional[str] = None - ) -> list: - return [template_out_file.replace(".wav", "_post.wav")] diff --git a/scripts/pyprocessing/processing.py b/scripts/pyprocessing/processing.py deleted file mode 100644 index a0533b2b4edead2b7f699c39b14eebdf56e84227..0000000000000000000000000000000000000000 --- a/scripts/pyprocessing/processing.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import logging -import os -import subprocess -from abc import ABC, abstractmethod - -global_print_cmd_only = False -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - - -class Processing(ABC): - def __init__(self): - pass - - @abstractmethod - def process(self, input_path: str, output_path: str, tmp_path: str) -> None: - pass - - @abstractmethod - def get_processing_file_paths(self, template_out_file: str) -> list: - pass - - @staticmethod - def run(cmd: list) -> None: - Processing.print_cmd(cmd) - - if not global_print_cmd_only: - try: - result = subprocess.run(cmd, check=True, capture_output=True, text=True) - except subprocess.CalledProcessError as e: - logger.debug(f"Command returned non-zero exit status : {e.returncode}") - logger.debug(e.stderr) - logger.debug(e.stdout) - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) - - logger.debug(result.stderr) - logger.debug(result.stdout) - - @staticmethod - def run_python(cmd: list) -> None: - Processing.print_cmd(cmd) - - if not global_print_cmd_only: - result = subprocess.run( - ["python3"] + cmd, check=True, capture_output=True, text=True - ) - logger.debug(result.stderr) - logger.debug(str(result.stdout)) - - @staticmethod - def print_cmd(cmd: list) -> None: - cmd[:] = [i if i is not None else "MISSING" for i in cmd] - logger.debug(f"Running command: {' '.join(cmd)}") - if "MISSING" in cmd: - logger.error("Missing arg in command") - raise ValueError("Missing arg in command") - - -def process_chain( - proc_chain: list, - input_path: str, - output_wav: str, - tmp_folder_path: str = os.path.abspath("tmp"), -) -> None: - tmp_file_template_name = os.path.join(tmp_folder_path, os.path.basename(output_wav)) - - # Prepare a chain of of input/tmp/output files - processing_paths = [input_path] - for p in proc_chain: - _, input_ext = os.path.splitext(processing_paths[-1]) - processing_paths.extend( - p.get_processing_file_paths(tmp_file_template_name, input_ext=input_ext) - ) - - # Temporary files if needed - tmp_processing_paths = processing_paths[:] - tmp_path_iter = iter(tmp_processing_paths) - next(tmp_path_iter) - - # Replace last with real output - processing_paths[-1] = output_wav - in_path_iter = iter(processing_paths) - out_path_iter = iter(processing_paths) - next(out_path_iter) - - # go through processing chain - for p in proc_chain: - p.process(next(in_path_iter), next(out_path_iter), next(tmp_path_iter)) diff --git a/scripts/pyprocessing/processing_configs.py b/scripts/pyprocessing/processing_configs.py deleted file mode 100644 index 255f183c6decc1d8d84243aa61d7f4dfc32f581d..0000000000000000000000000000000000000000 --- a/scripts/pyprocessing/processing_configs.py +++ /dev/null @@ -1,375 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import json -import logging -import os - -from pyprocessing.evs import EVS -from pyprocessing.ivas import IVAS -from pyprocessing.prepost_processing import PostProcessing, PreProcessing -from pyprocessing.utils import list_audio - -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - -# Parse a JSON file into class and perform necessary validation -class test_config: - def __init__(self, filename: str): - # Open and read configuration test file - with open(filename, "r") as fp: - config_dict = json.load(fp) - - # Init lists of conditions and associated folders - self.list_of_conditions = list() - self.output_folders = list() - self.tmp_folders = list() - - # Set defaults - self._set_defaults() - - # Set/override class attributes based on JSON file and update internal dict - for key, value in config_dict.items(): - # update subdictionaries in case of ivas and evs - if key.startswith("ivas"): - setattr(self, key, self.DEFAULTS_ivas.copy()) - getattr(self, key).update(value) - self.dict[key] = self.DEFAULTS_ivas.copy() - self.dict[key].update(value) - elif key.startswith("evs"): - setattr(self, key, self.DEFAULTS_evs.copy()) - getattr(self, key).update(value) - self.dict[key] = self.DEFAULTS_evs.copy() - self.dict[key].update(value) - # avoid overwriting the whole subkey, merge instead - elif hasattr(self, key) and isinstance(getattr(self, key), dict): - for k, v in value.items(): - getattr(self, key)[k] = v - self.dict[key][k] = v - else: - setattr(self, key, value) - self.dict[key] = value - - # Check required keys - REQUIRED_KEYS = [ - "name", - "input_path", - "output_path", - "in_format", - "renderer_format", - "conditions_to_generate", - ] - REQUIRED_KEYS_IVAS = ["bitrates", "out_format"] - REQUIRED_KEYS_EVS = ["bitrates"] - MISSING_KEYS = list() - - for key in REQUIRED_KEYS: - if not hasattr(self, key): - MISSING_KEYS.append(key) - elif not getattr(self, key): - MISSING_KEYS.append(key) - - for condition in self.conditions_to_generate: - if condition.startswith("ivas"): - if not hasattr(self, condition): - raise SystemExit( - f"Definition not found for condition {condition}, but was specified in conditions to generate" - ) - else: - for key in REQUIRED_KEYS_IVAS: - if getattr(self, condition).get(key, None) is None: - MISSING_KEYS.append(f"{condition}:{key}") - elif condition.startswith("evs"): - if not hasattr(self, condition): - raise SystemExit( - f"Definition not found for condition {condition}, but was specified in conditions to generate" - ) - else: - for key in REQUIRED_KEYS_EVS: - if getattr(self, condition).get(key, None) is None: - MISSING_KEYS.append(f"{condition}:{key}") - - # Report missing keys to the user - if len(MISSING_KEYS) > 0: - raise KeyError( - f"The following key(s) must be specified in {filename} : {MISSING_KEYS}" - ) - - # Remove DEFAULTS_ keys from dict and self - for key in list(self.dict.keys()): - if key.startswith("DEFAULTS_"): - delattr(self, key) - self.dict.pop(key, None) - - # Store the updated JSON for later output - self.json_out = json.dumps(self.dict, indent=4) - - # Concatenation options - if self.concatenate_input: - if len(self.concat_silence_ms): - self.concat_silence_pre = self.concat_silence_ms[0] - self.concat_silence_post = self.concat_silence_ms[1] - else: - self.concat_silence_pre = self.concat_silence_ms - self.concat_silence_post = self.concat_silence_ms - - # Pre-processing - if self.preproc_input: - self.list_of_conditions.append(self._get_condition_definition("preproc", 0)) - - # Check input directory for items - self.items_list = list_audio( - self.input_path, absolute=True, select_list=self.input_select - ) - - if self.items_list is None or len(self.items_list) == 0: - raise SystemExit( - f"Directory {self.input_path} is either blank, does not exist or all files were filtered out." - ) - - # Check if concatenation is required - if self.concatenate_input and any( - [i.endswith(".txt") for i in self.items_list] - ): - raise SystemExit("Concatenation for text files is unsupported") - - # Go through conditions to generate - for cond in self.conditions_to_generate: - try: - bitrates = getattr(self, cond)["bitrates"] - # If single value, convert to list for convenience - if not hasattr(bitrates, "__len__") and not isinstance(bitrates, str): - bitrates = [bitrates] - for b in bitrates: - if isinstance(b, list): - self.list_of_conditions.append( - self._get_condition_definition(cond, [int(x) for x in b]) - ) - else: - self.list_of_conditions.append( - self._get_condition_definition(cond, int(b)) - ) - bitrate_label = str( - self.list_of_conditions[-1]["proc_chain"][ - 0 - ].get_total_bit_rate() - ) - self.list_of_conditions[-1]["id"] = f"{cond}_{bitrate_label}" - except: - self.list_of_conditions.append(self._get_condition_definition(cond, 0)) - - # create output and temporary folder names for the conditions - for list_cond in self.list_of_conditions: - self.output_folders.append(os.path.join(self.output_path, list_cond["id"])) - self.tmp_folders.append( - os.path.join(self.output_path, "tmp_" + list_cond["id"]) - ) - - def __repr__(self): - return str(vars(self)) - - # default values to enable a sparse JSON input file - update if adding new keys - def _set_defaults(self): - DEFAULT_CONFIG = { - # general options - "enable_multiprocessing": True, - "delete_tmp": False, - # input/preprocessing options - "preproc_input": False, - "input_select": None, - "concatenate_input": False, - "concat_silence_ms": [0, 0], - # sampling rates - "in_fs": 48000, - "out_fs": 48000, - # binaural rendering - "binaural_rendered": False, - "bin_rend_include_LFE": False, - "bin_rend_LFE_gain": 10 ** (5.5 / 20), - "binaural_dataset": "orange53", - # apply limiter in the postprocessing - "limit_output": False, - # loudness adjustments - "preproc_loudness": None, - "output_loudness": None, - "loudness_tool": "bs1770demo", - # condition-specific values - "ref": {"out_fc": 48000}, - "DEFAULTS_ivas": { - "cod_bin": "../IVAS_cod", - "dec_bin": "../IVAS_dec", - "cod_opt": None, - "dec_opt": None, - "enc_fs": 48000, - "dec_fs": 48000, - "max_band": "FB", - "dtx": False, - # head tracking - "head_tracking": False, - "ht_file": "./trajectories/full_circle_in_15s", - # BER/FER - "plc": False, - "plc_rate": 10, - }, - "DEFAULTS_evs": { - "cod_bin": "../IVAS_cod", - "dec_bin": "../IVAS_dec", - "cod_opt": None, - "dec_opt": None, - "enc_fs": 48000, - "dec_fs": 48000, - "max_band": "FB", - "dtx": False, - }, - } - - # needed to output JSON later - self.dict = DEFAULT_CONFIG - - # set defaults from above dict - for key, value in DEFAULT_CONFIG.items(): - setattr(self, key, value) - - # Definitions of processing chains (edit with care) - def _get_condition_definition(self, cond: str, bitrate: int) -> dict: - definition = dict(id=cond, proc_chain=[]) - - if cond.startswith("preproc"): - definition["proc_chain"].extend( - [ - PreProcessing( - out_format=self.in_format, - out_fs=self.in_fs, - output_loudness=self.preproc_loudness, - loudness_tool=self.loudness_tool, - ) - ] - ) - elif cond.startswith("ref"): - definition["proc_chain"].extend( - [ - PostProcessing( - in_format=self.in_format, - out_format=self.renderer_format, - in_fs=self.in_fs, - out_fs=self.out_fs, - out_fc=self.ref["out_fc"], - binaural_rendered=self.binaural_rendered, - bin_rend_include_LFE=self.bin_rend_include_LFE, - bin_rend_LFE_gain=self.bin_rend_LFE_gain, - binaural_dataset=self.binaural_dataset, - limit_output=self.limit_output, - output_loudness=self.output_loudness, - loudness_tool=self.loudness_tool, - ) - ] - ) - elif cond.startswith("lp3k5"): - definition["proc_chain"].extend( - [ - PostProcessing( - in_format=self.in_format, - out_format=self.renderer_format, - in_fs=self.in_fs, - out_fs=self.out_fs, - out_fc=3500, - binaural_rendered=self.binaural_rendered, - binaural_dataset=self.binaural_dataset, - limit_output=self.limit_output, - output_loudness=self.output_loudness, - loudness_tool=self.loudness_tool, - ) - ] - ) - elif cond.startswith("lp7k"): - definition["proc_chain"].extend( - [ - PostProcessing( - in_format=self.in_format, - out_format=self.renderer_format, - in_fs=self.in_fs, - out_fs=self.out_fs, - out_fc=7000, - binaural_rendered=self.binaural_rendered, - binaural_dataset=self.binaural_dataset, - limit_output=self.limit_output, - output_loudness=self.output_loudness, - loudness_tool=self.loudness_tool, - ) - ] - ) - elif cond.startswith("evs"): - definition["proc_chain"].extend( - [ - EVS( - in_format=self.in_format, - out_format=self.in_format, - bitrate=bitrate, - in_fs=self.in_fs, - **getattr(self, cond), - ), - PostProcessing( - in_format=self.in_format, - out_format=self.renderer_format, - in_fs=getattr(self, cond)["dec_fs"], - out_fs=self.out_fs, - binaural_rendered=self.binaural_rendered, - binaural_dataset=self.binaural_dataset, - limit_output=self.limit_output, - ), - ] - ) - elif cond.startswith("ivas"): - definition["proc_chain"].extend( - [ - IVAS( - in_format=self.in_format, - bitrate=bitrate, - in_fs=self.in_fs, - **getattr(self, cond), - ), - PostProcessing( - in_format=getattr(self, cond)["out_format"], - out_format=self.renderer_format, - in_fs=getattr(self, cond)["dec_fs"], - out_fs=self.out_fs, - binaural_rendered=self.binaural_rendered, - binaural_dataset=self.binaural_dataset, - limit_output=self.limit_output, - ), - ] - ) - else: - raise SystemExit(f"Invalid condition: {cond}") - - return definition diff --git a/scripts/pyprocessing/utils.py b/scripts/pyprocessing/utils.py deleted file mode 100644 index e62840fd1367ef536ee9213065c535598fcf35ca..0000000000000000000000000000000000000000 --- a/scripts/pyprocessing/utils.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python3 - -""" - (C) 2022-2023 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. -""" - -import logging -import os -import platform -import shutil -from typing import Union - -""" -Directory/path handling -""" - -ALLOWED_INPUT_EXT = (".wav", ".pcm", ".txt") -main_logger = logging.getLogger("__main__") -logger = main_logger.getChild(__name__) -logger.setLevel(logging.DEBUG) - -# Creates a directory at the given path if it does not exist already -def create_dir(path: str) -> None: - if not os.path.exists(path): - os.makedirs(path) - - -def delete_dir(path: str) -> None: - if os.path.exists(path) and os.path.isdir(path): - logger.debug(f"Deleting path {path}") - shutil.rmtree(path) - - -class DirManager: - """ - Context manager that creates directories if not already present and - automatically cleans up (i.e. deletes) all specified paths - """ - - def __init__( - self, create_paths: Union[str, list], delete_paths: Union[str, list] = list() - ): - self.create_paths = ( - create_paths if type(create_paths) == list else [create_paths] - ) - self.delete_paths = ( - delete_paths if type(delete_paths) == list else [delete_paths] - ) - - def __enter__(self): - for path in self.create_paths: - create_dir(path) - - def __exit__(self, exc_type, exc_value, exc_traceback): - for path in self.delete_paths: - if path in self.create_paths: - delete_dir(path) - else: - print( - "Attempting to delete a tmp dir that was not in create_paths. Do not delete." - ) - - -def list_audio(path: str, absolute: bool = False, select_list: list = None) -> list: - """ - Return list with all files with ALLOWED_INPUT_EXT found under the given path. - - If path is a directory, all files in it are included, if it is a file, just the file - will be in the list. If a select list is provided, files are filtered accordingly. - """ - audio_list = list() - - if os.path.exists(path): - if os.path.isdir(path): - if absolute: - audio_list = [ - os.path.join(path, f) - for f in os.listdir(path) - if f.endswith(ALLOWED_INPUT_EXT) - ] - else: - audio_list = [ - f for f in os.listdir(path) if f.endswith(ALLOWED_INPUT_EXT) - ] - else: - if not absolute: - path = os.path.basename(path) - ext = os.path.splitext(path)[-1].lower() - if ext in ALLOWED_INPUT_EXT: - audio_list.append(path) - - # Filter according to select list - if select_list is not None: - if hasattr(select_list, "__len__") and not isinstance(select_list, str): - select_set = set([os.path.splitext(i)[0] for i in select_list]) - else: - select_set = [os.path.splitext(select_list)[0]] - - audio_list_orig = audio_list - audio_list = [] - for f in audio_list_orig: - f_name = os.path.splitext(os.path.basename(f))[0] - if any(x in f_name for x in select_set): - audio_list.append(f) - - return audio_list - - -def get_exec_path(path: str) -> str: - if platform.system() == "Windows" and os.path.splitext(path)[1] != ".exe": - exe = ".exe" - else: - exe = "" - - return f"{os.path.abspath(path)}{exe}" - - -def get_nickname(path: str) -> str: - nickname = os.path.join( - os.path.basename(os.path.dirname(path)), os.path.basename(path) - ) - return nickname diff --git a/scripts/runIvasCodec.py b/scripts/runIvasCodec.py index 070fb8e4f04da261e273fc0a1576c6ab5533cb6b..f96758e5be8d99b7fece0049e027eef277b40e4f 100755 --- a/scripts/runIvasCodec.py +++ b/scripts/runIvasCodec.py @@ -34,6 +34,7 @@ import os.path import platform import sys import logging +import shutil from pyivastest import IvasScriptsCommon, IvasModeRunner import pyivastest.constants as constants @@ -81,6 +82,11 @@ class RunIvasCodec(IvasScriptsCommon.IvasScript): help="Decoder binary name (default {})".format(default_dec), default=default_dec, ) + self.parser.add_argument( + "--fail_log_dir", + help="Move logs of failed modes to dir (default none)", + default=None, + ) def run(self): self.parse_args() @@ -137,10 +143,19 @@ class RunIvasCodec(IvasScriptsCommon.IvasScript): self.logger.console(" Encoder: {}".format(bin_enc), logging.INFO) self.logger.console(" Decoder: {}".format(bin_dec), logging.INFO) + runner.run() self.logger.console(" ") + fail_log_dir=None + if self.args["fail_log_dir"] is not None: + fail_log_dir = os.path.realpath(self.args["fail_log_dir"]) + if not(os.path.exists(fail_log_dir)): + os.makedirs(fail_log_dir) for r in runner.results: self.logger.console(r[0]) + if fail_log_dir is not None: + shutil.copy(r[3],fail_log_dir) + self.logger.console(" ") diff --git a/scripts/self_test.py b/scripts/self_test.py index 2be585882b1dd4b322a9fd64aaae02d86159e5d6..d7118832db57d14fad8db5451230c3ab79ae5de2 100755 --- a/scripts/self_test.py +++ b/scripts/self_test.py @@ -63,7 +63,7 @@ MODES = { "5_1_4": "5_1_4", "7_1_4": "7_1_4", }, - "-ISM": {"1": "ISM1", "2": "ISM2", "3": "ISM3", "4": "ISM4"}, + "-ISM": {"1": "ISM1", "2": "ISM2", "3": "ISM3", "4": "ISM4", "+4": "ISM+4"}, "-SBA": { "-3": "HOA3", "3": "HOA3", diff --git a/scripts/switchPaths/sw_13k2_128k.bin b/scripts/switchPaths/sw_13k2_128k.bin new file mode 100644 index 0000000000000000000000000000000000000000..7309ee26ab59fbbfaf4889e1163b97628a0ef565 --- /dev/null +++ b/scripts/switchPaths/sw_13k2_128k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9ddf71b27bcd47d5f37abb6c62146ff4fb5a848cd85605d4df87a9cc4b1d1e0 +size 60000 diff --git a/scripts/switchPaths/sw_13k2_256k.bin b/scripts/switchPaths/sw_13k2_256k.bin new file mode 100644 index 0000000000000000000000000000000000000000..1d0c3fac28a5f752f12830674f1864f6ac1e971b --- /dev/null +++ b/scripts/switchPaths/sw_13k2_256k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05fd8870e43b0eb349d5e9b3bb939574b71d3e7630940a10d6767cae2c6c4a3c +size 60000 diff --git a/scripts/switchPaths/sw_16k4_128k.bin b/scripts/switchPaths/sw_16k4_128k.bin new file mode 100644 index 0000000000000000000000000000000000000000..1e85a18b77c031b534476e37465cdf5ca76a6472 --- /dev/null +++ b/scripts/switchPaths/sw_16k4_128k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e07f8c6be0e08ed96b15c9a3daa2811ef0b596dc08cc687bce1f0ca8e49969b +size 60000 diff --git a/scripts/switchPaths/sw_16k4_256k.bin b/scripts/switchPaths/sw_16k4_256k.bin new file mode 100644 index 0000000000000000000000000000000000000000..47bc9c9aa35a39376bffd6059fb41e54123f2dc0 --- /dev/null +++ b/scripts/switchPaths/sw_16k4_256k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7dedd5a20cbc5594ec869b13b3e9774efd6394ad5d5b64a4e98210447c3a75ba +size 60000 diff --git a/scripts/switchPaths/sw_24k4_256k_1.bin b/scripts/switchPaths/sw_24k4_256k_1.bin new file mode 100644 index 0000000000000000000000000000000000000000..e2852619262f36e617038034a42807364fae28ed --- /dev/null +++ b/scripts/switchPaths/sw_24k4_256k_1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf5b303299209bdd4f7e007d1190c7957b17ab3ee399570f1bb87d27f3fec092 +size 60000 diff --git a/scripts/switchPaths/sw_24k4_384k.bin b/scripts/switchPaths/sw_24k4_384k.bin new file mode 100644 index 0000000000000000000000000000000000000000..781e3023b26710b65400686883f8502e1c683253 --- /dev/null +++ b/scripts/switchPaths/sw_24k4_384k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e3e7599638d3792d851a5bdc13b85d6b401ebc9724795562b1a5d25fc2c3bc6 +size 60000 diff --git a/scripts/switchPaths/sw_24k4_512k.bin b/scripts/switchPaths/sw_24k4_512k.bin new file mode 100644 index 0000000000000000000000000000000000000000..dcc58dbdc6a2b4801563dcbab3b87d76cb180b5c --- /dev/null +++ b/scripts/switchPaths/sw_24k4_512k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2369edc21bdf3440ceaf21de16698e38cf50c246ddf04878a5961538dded11ad +size 60000 diff --git a/scripts/switchPaths/sw_32k_128k.bin b/scripts/switchPaths/sw_32k_128k.bin new file mode 100644 index 0000000000000000000000000000000000000000..fc4b81e0c3d2f57cc7241c75c37d64fbcec9f909 --- /dev/null +++ b/scripts/switchPaths/sw_32k_128k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdb0da661cb08cc546c3761afa1d778d2c7aa04df61b608ae4301e31867dcc2e +size 60000 diff --git a/scripts/switchPaths/sw_32k_256k.bin b/scripts/switchPaths/sw_32k_256k.bin new file mode 100644 index 0000000000000000000000000000000000000000..46b1e17cd4bb30aa1b3fd5ed82c7b1ac1702824a --- /dev/null +++ b/scripts/switchPaths/sw_32k_256k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61dacf79a7582edb83c151c300392efb719f08762a963da29f9b7665305a8c5f +size 60000 diff --git a/scripts/switchPaths/sw_32k_384k.bin b/scripts/switchPaths/sw_32k_384k.bin new file mode 100644 index 0000000000000000000000000000000000000000..088edfacbffdb508a96b89d434cf5298081a6b21 --- /dev/null +++ b/scripts/switchPaths/sw_32k_384k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77f6e7b141b16bd21005c5169cd9bc8b7b2c96df379ce9e74788717c66b9130f +size 60000 diff --git a/scripts/switchPaths/sw_32k_512k.bin b/scripts/switchPaths/sw_32k_512k.bin new file mode 100644 index 0000000000000000000000000000000000000000..d385f3a890804eedaafdc308233954e106e9f2c4 --- /dev/null +++ b/scripts/switchPaths/sw_32k_512k.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a6eb4080fce3bc1a7ba20cfc8ef3e8ff981ebce5de7c8e45bbc12edf7f21d0c +size 60000 diff --git a/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_16kHz.bin b/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_16kHz.bin index 17691616db240c96866cc4db3bc2ce48c5b160bc..dd4d32cdcbfcc7047166a06c07ddda14cc3dae6a 100644 --- a/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_16kHz.bin +++ b/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_16kHz.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0950686593146f4d7c7b622d2e52afdc10cc63481824d516ee88f7e2996f0de4 -size 204970 +oid sha256:1fdfc45a9bd54697b85cec44906c6cf2ac76b58440911472ec14ef743c6bcb52 +size 204974 diff --git a/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_32kHz.bin b/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_32kHz.bin index f6cf12bf4fb3a4bc93e70e839f95d769b8ee5aa3..63ed4ac7fa0647ab05b9ff115e92d91ff09c8249 100644 --- a/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_32kHz.bin +++ b/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_32kHz.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1467d78861387e370ba916a93730961dd2d4abf1eff133740f9b7fafb89b32c4 -size 403802 +oid sha256:8b81a9aa52f64f86fe3abdd50a3c65b6a1ce632db32a30606b7b8bb17f2c3d36 +size 403806 diff --git a/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_48kHz.bin b/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_48kHz.bin index 8eeacfc0de6520a63a64270227991575e8583f9a..dceb314b87d91ada9c341a3a425e92d89c8c2d61 100644 --- a/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_48kHz.bin +++ b/scripts/td_object_renderer/hrtf_data/Orange_53/hrfilter_model_v002_48kHz.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1740802509d5c3076a259b113ffc832e5585da9bc0fdbe851b89d524ccba374e -size 598010 +oid sha256:ac395980e37d1e38f602b7223c401b1c6711912d1a5db71ee668584c30c521b1 +size 598014 diff --git a/scripts/testv/config_directivity.cfg b/scripts/testv/config_directivity.cfg new file mode 100644 index 0000000000000000000000000000000000000000..94807d688ce642a6fd5aff7d7a958e4f4fa7127b --- /dev/null +++ b/scripts/testv/config_directivity.cfg @@ -0,0 +1,3 @@ +[general] +directivity = [0.0, 360.0, 0.2512]; + diff --git a/scripts/testv/dirac_12ch_16k.wav b/scripts/testv/dirac_12ch_16k.wav deleted file mode 100644 index 770a0962929995d549724b694b8ba9976685f061..0000000000000000000000000000000000000000 --- a/scripts/testv/dirac_12ch_16k.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1480c94da2e6c1337dd8a6cf2394283a28739be9fd02f4a598c7c2fef578882e -size 4992156 diff --git a/scripts/testv/dirac_12ch_32k.wav b/scripts/testv/dirac_12ch_32k.wav deleted file mode 100644 index e363158e34523c8aaae5eb96accb3bd102950a23..0000000000000000000000000000000000000000 --- a/scripts/testv/dirac_12ch_32k.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b9adc43c1031a4799ad66c46a68d26ab34b4b4052aa05755f7081f06fd3b3a42 -size 9984132 diff --git a/scripts/testv/dirac_12ch_48k.wav b/scripts/testv/dirac_12ch_48k.wav deleted file mode 100644 index e6c45bcab5d722f4d788d0ef4e9be12845ccf71c..0000000000000000000000000000000000000000 --- a/scripts/testv/dirac_12ch_48k.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3cfbf8de4b0792f6a9155b048fb45bf56f907c1cb6446a2f7428cc50d6ba19d7 -size 14976044 diff --git a/scripts/testv/headrot_case04_3000_q.csv b/scripts/testv/headrot_case04_3000_q.csv new file mode 100644 index 0000000000000000000000000000000000000000..9f90e9e38b368eabccd6d1f04be84c3d5c51c7fb --- /dev/null +++ b/scripts/testv/headrot_case04_3000_q.csv @@ -0,0 +1,3000 @@ +1.00,0.00,0.00,0.00,5.03,6.40,0.00 +1.00,-0.00,0.00,0.00,5.03,6.40,0.00 +1.00,-0.00,0.00,0.00,5.03,6.40,0.00 +1.00,-0.00,0.00,0.00,5.03,6.41,0.01 +1.00,-0.00,0.00,0.00,5.03,6.41,0.01 +1.00,-0.00,0.00,0.00,5.03,6.41,0.01 +1.00,-0.00,0.00,0.01,5.03,6.41,0.01 +1.00,-0.00,0.00,0.01,5.03,6.42,0.01 +1.00,-0.00,0.00,0.01,5.03,6.42,0.01 +1.00,-0.00,0.00,0.01,5.03,6.42,0.02 +1.00,-0.00,0.00,0.01,5.03,6.43,0.02 +1.00,-0.00,0.00,0.01,5.03,6.43,0.02 +1.00,-0.00,0.00,0.01,5.03,6.43,0.02 +1.00,-0.00,0.00,0.01,5.03,6.43,0.02 +1.00,-0.00,0.00,0.01,5.03,6.44,0.03 +1.00,-0.00,0.01,0.01,5.03,6.44,0.03 +1.00,-0.00,0.01,0.01,5.03,6.44,0.03 +1.00,-0.00,0.01,0.02,5.03,6.44,0.03 +1.00,-0.00,0.01,0.02,5.03,6.45,0.03 +1.00,-0.00,0.01,0.02,5.03,6.45,0.03 +1.00,-0.00,0.01,0.02,5.03,6.45,0.04 +1.00,-0.00,0.01,0.02,5.03,6.46,0.04 +1.00,-0.00,0.01,0.02,5.03,6.46,0.04 +1.00,-0.00,0.01,0.02,5.03,6.46,0.04 +1.00,-0.00,0.01,0.02,5.03,6.46,0.04 +1.00,-0.00,0.01,0.02,5.03,6.47,0.05 +1.00,-0.00,0.01,0.02,5.03,6.47,0.05 +1.00,-0.00,0.01,0.02,5.03,6.47,0.05 +1.00,-0.00,0.01,0.03,5.03,6.48,0.05 +1.00,-0.00,0.01,0.03,5.03,6.48,0.05 +1.00,-0.00,0.01,0.03,5.02,6.48,0.05 +1.00,-0.00,0.01,0.03,5.02,6.48,0.06 +1.00,-0.00,0.01,0.03,5.02,6.49,0.06 +1.00,-0.00,0.01,0.03,5.02,6.49,0.06 +1.00,-0.00,0.01,0.03,5.02,6.49,0.06 +1.00,-0.00,0.01,0.03,5.02,6.49,0.06 +1.00,-0.00,0.01,0.03,5.02,6.50,0.07 +1.00,-0.00,0.01,0.03,5.02,6.50,0.07 +1.00,-0.00,0.01,0.03,5.02,6.50,0.07 +1.00,-0.00,0.01,0.04,5.02,6.51,0.07 +1.00,-0.00,0.01,0.04,5.02,6.51,0.07 +1.00,-0.00,0.01,0.04,5.02,6.51,0.08 +1.00,-0.00,0.01,0.04,5.02,6.51,0.08 +1.00,-0.00,0.01,0.04,5.02,6.52,0.08 +1.00,-0.00,0.02,0.04,5.02,6.52,0.08 +1.00,-0.00,0.02,0.04,5.02,6.52,0.08 +1.00,-0.00,0.02,0.04,5.02,6.53,0.08 +1.00,-0.00,0.02,0.04,5.02,6.53,0.09 +1.00,-0.00,0.02,0.04,5.02,6.53,0.09 +1.00,-0.00,0.02,0.04,5.02,6.53,0.09 +1.00,-0.00,0.02,0.05,5.02,6.54,0.09 +1.00,-0.00,0.02,0.05,5.02,6.54,0.09 +1.00,-0.00,0.02,0.05,5.02,6.54,0.10 +1.00,-0.00,0.02,0.05,5.02,6.54,0.10 +1.00,-0.00,0.02,0.05,5.02,6.55,0.10 +1.00,-0.00,0.02,0.05,5.02,6.55,0.10 +1.00,-0.00,0.02,0.05,5.02,6.55,0.10 +1.00,-0.00,0.02,0.05,5.02,6.56,0.10 +1.00,-0.00,0.02,0.05,5.02,6.56,0.11 +1.00,-0.00,0.02,0.05,5.02,6.56,0.11 +1.00,-0.00,0.02,0.05,5.02,6.56,0.11 +1.00,-0.00,0.02,0.06,5.02,6.57,0.11 +1.00,-0.00,0.02,0.06,5.02,6.57,0.11 +1.00,-0.00,0.02,0.06,5.02,6.57,0.12 +1.00,-0.00,0.02,0.06,5.02,6.58,0.12 +1.00,-0.00,0.02,0.06,5.02,6.58,0.12 +1.00,-0.00,0.02,0.06,5.02,6.58,0.12 +1.00,-0.00,0.02,0.06,5.02,6.58,0.12 +1.00,-0.00,0.02,0.06,5.02,6.59,0.12 +1.00,-0.00,0.02,0.06,5.02,6.59,0.13 +1.00,-0.00,0.02,0.06,5.01,6.59,0.13 +1.00,-0.00,0.02,0.06,5.01,6.59,0.13 +1.00,-0.00,0.03,0.07,5.01,6.60,0.13 +1.00,-0.00,0.03,0.07,5.01,6.60,0.13 +1.00,-0.00,0.03,0.07,5.01,6.60,0.14 +1.00,-0.00,0.03,0.07,5.01,6.61,0.14 +1.00,-0.00,0.03,0.07,5.01,6.61,0.14 +1.00,-0.00,0.03,0.07,5.01,6.61,0.14 +1.00,-0.00,0.03,0.07,5.01,6.61,0.14 +1.00,-0.00,0.03,0.07,5.01,6.62,0.14 +1.00,-0.00,0.03,0.07,5.01,6.62,0.15 +1.00,-0.00,0.03,0.07,5.01,6.62,0.15 +1.00,-0.00,0.03,0.08,5.01,6.63,0.15 +1.00,-0.00,0.03,0.08,5.01,6.63,0.15 +1.00,-0.00,0.03,0.08,5.01,6.63,0.15 +1.00,-0.00,0.03,0.08,5.01,6.63,0.16 +1.00,-0.00,0.03,0.08,5.01,6.64,0.16 +1.00,-0.00,0.03,0.08,5.01,6.64,0.16 +1.00,-0.00,0.03,0.08,5.01,6.64,0.16 +1.00,-0.00,0.03,0.08,5.01,6.64,0.16 +1.00,-0.00,0.03,0.08,5.01,6.65,0.16 +1.00,-0.00,0.03,0.08,5.01,6.65,0.17 +1.00,-0.00,0.03,0.08,5.01,6.65,0.17 +1.00,-0.00,0.03,0.09,5.01,6.66,0.17 +1.00,-0.00,0.03,0.09,5.00,6.66,0.17 +1.00,-0.00,0.03,0.09,5.00,6.66,0.17 +1.00,-0.00,0.03,0.09,5.00,6.66,0.18 +1.00,-0.00,0.03,0.09,5.00,6.67,0.18 +1.00,-0.00,0.03,0.09,5.00,6.67,0.18 +1.00,-0.00,0.03,0.09,5.00,6.67,0.18 +1.00,-0.00,0.03,0.09,5.00,6.68,0.18 +1.00,-0.00,0.04,0.09,5.00,6.68,0.18 +1.00,-0.00,0.04,0.09,5.00,6.68,0.19 +0.99,-0.00,0.04,0.09,5.00,6.68,0.19 +0.99,-0.00,0.04,0.10,5.00,6.69,0.19 +0.99,-0.00,0.04,0.10,5.00,6.69,0.19 +0.99,-0.00,0.04,0.10,5.00,6.69,0.19 +0.99,-0.00,0.04,0.10,5.00,6.69,0.20 +0.99,-0.00,0.04,0.10,5.00,6.70,0.20 +0.99,-0.00,0.04,0.10,5.00,6.70,0.20 +0.99,-0.00,0.04,0.10,5.00,6.70,0.20 +0.99,-0.00,0.04,0.10,5.00,6.71,0.20 +0.99,-0.00,0.04,0.10,5.00,6.71,0.20 +0.99,-0.00,0.04,0.10,4.99,6.71,0.21 +0.99,-0.00,0.04,0.10,4.99,6.71,0.21 +0.99,-0.00,0.04,0.11,4.99,6.72,0.21 +0.99,-0.00,0.04,0.11,4.99,6.72,0.21 +0.99,-0.00,0.04,0.11,4.99,6.72,0.21 +0.99,-0.00,0.04,0.11,4.99,6.72,0.22 +0.99,-0.00,0.04,0.11,4.99,6.73,0.22 +0.99,-0.00,0.04,0.11,4.99,6.73,0.22 +0.99,-0.00,0.04,0.11,4.99,6.73,0.22 +0.99,-0.00,0.04,0.11,4.99,6.74,0.22 +0.99,-0.00,0.04,0.11,4.99,6.74,0.22 +0.99,-0.00,0.04,0.11,4.99,6.74,0.23 +0.99,-0.00,0.04,0.11,4.99,6.74,0.23 +0.99,-0.01,0.04,0.12,4.99,6.75,0.23 +0.99,-0.01,0.04,0.12,4.99,6.75,0.23 +0.99,-0.01,0.04,0.12,4.99,6.75,0.23 +0.99,-0.01,0.04,0.12,4.98,6.75,0.24 +0.99,-0.01,0.05,0.12,4.98,6.76,0.24 +0.99,-0.01,0.05,0.12,4.98,6.76,0.24 +0.99,-0.01,0.05,0.12,4.98,6.76,0.24 +0.99,-0.01,0.05,0.12,4.98,6.77,0.24 +0.99,-0.01,0.05,0.12,4.98,6.77,0.24 +0.99,-0.01,0.05,0.12,4.98,6.77,0.25 +0.99,-0.01,0.05,0.12,4.98,6.77,0.25 +0.99,-0.01,0.05,0.13,4.98,6.78,0.25 +0.99,-0.01,0.05,0.13,4.98,6.78,0.25 +0.99,-0.01,0.05,0.13,4.98,6.78,0.25 +0.99,-0.01,0.05,0.13,4.98,6.78,0.26 +0.99,-0.01,0.05,0.13,4.98,6.79,0.26 +0.99,-0.01,0.05,0.13,4.98,6.79,0.26 +0.99,-0.01,0.05,0.13,4.98,6.79,0.26 +0.99,-0.01,0.05,0.13,4.97,6.80,0.26 +0.99,-0.01,0.05,0.13,4.97,6.80,0.26 +0.99,-0.01,0.05,0.13,4.97,6.80,0.27 +0.99,-0.01,0.05,0.13,4.97,6.80,0.27 +0.99,-0.01,0.05,0.14,4.97,6.81,0.27 +0.99,-0.01,0.05,0.14,4.97,6.81,0.27 +0.99,-0.01,0.05,0.14,4.97,6.81,0.27 +0.99,-0.01,0.05,0.14,4.97,6.81,0.28 +0.99,-0.01,0.05,0.14,4.97,6.82,0.28 +0.99,-0.01,0.05,0.14,4.97,6.82,0.28 +0.99,-0.01,0.05,0.14,4.97,6.82,0.28 +0.99,-0.01,0.05,0.14,4.97,6.83,0.28 +0.99,-0.01,0.05,0.14,4.97,6.83,0.28 +0.99,-0.01,0.05,0.14,4.96,6.83,0.29 +0.99,-0.01,0.05,0.14,4.96,6.83,0.29 +0.99,-0.01,0.05,0.14,4.96,6.84,0.29 +0.99,-0.01,0.06,0.15,4.96,6.84,0.29 +0.99,-0.01,0.06,0.15,4.96,6.84,0.29 +0.99,-0.01,0.06,0.15,4.96,6.84,0.30 +0.99,-0.01,0.06,0.15,4.96,6.85,0.30 +0.99,-0.01,0.06,0.15,4.96,6.85,0.30 +0.99,-0.01,0.06,0.15,4.96,6.85,0.30 +0.99,-0.01,0.06,0.15,4.96,6.86,0.30 +0.99,-0.01,0.06,0.15,4.96,6.86,0.30 +0.99,-0.01,0.06,0.15,4.96,6.86,0.31 +0.99,-0.01,0.06,0.15,4.95,6.86,0.31 +0.99,-0.01,0.06,0.15,4.95,6.87,0.31 +0.99,-0.01,0.06,0.16,4.95,6.87,0.31 +0.99,-0.01,0.06,0.16,4.95,6.87,0.31 +0.99,-0.01,0.06,0.16,4.95,6.87,0.32 +0.99,-0.01,0.06,0.16,4.95,6.88,0.32 +0.99,-0.01,0.06,0.16,4.95,6.88,0.32 +0.99,-0.01,0.06,0.16,4.95,6.88,0.32 +0.98,-0.01,0.06,0.16,4.95,6.88,0.32 +0.98,-0.01,0.06,0.16,4.95,6.89,0.32 +0.98,-0.01,0.06,0.16,4.95,6.89,0.33 +0.98,-0.01,0.06,0.16,4.94,6.89,0.33 +0.98,-0.01,0.06,0.16,4.94,6.90,0.33 +0.98,-0.01,0.06,0.17,4.94,6.90,0.33 +0.98,-0.01,0.06,0.17,4.94,6.90,0.33 +0.98,-0.01,0.06,0.17,4.94,6.90,0.33 +0.98,-0.01,0.06,0.17,4.94,6.91,0.34 +0.98,-0.01,0.06,0.17,4.94,6.91,0.34 +0.98,-0.01,0.06,0.17,4.94,6.91,0.34 +0.98,-0.01,0.06,0.17,4.94,6.91,0.34 +0.98,-0.01,0.06,0.17,4.94,6.92,0.34 +0.98,-0.01,0.07,0.17,4.94,6.92,0.35 +0.98,-0.01,0.07,0.17,4.93,6.92,0.35 +0.98,-0.01,0.07,0.17,4.93,6.92,0.35 +0.98,-0.01,0.07,0.18,4.93,6.93,0.35 +0.98,-0.01,0.07,0.18,4.93,6.93,0.35 +0.98,-0.01,0.07,0.18,4.93,6.93,0.35 +0.98,-0.01,0.07,0.18,4.93,6.94,0.36 +0.98,-0.01,0.07,0.18,4.93,6.94,0.36 +0.98,-0.01,0.07,0.18,4.93,6.94,0.36 +0.98,-0.01,0.07,0.18,4.93,6.94,0.36 +0.98,-0.01,0.07,0.18,4.93,6.95,0.36 +0.98,-0.01,0.07,0.18,4.92,6.95,0.37 +0.98,-0.01,0.07,0.18,4.92,6.95,0.37 +0.98,-0.01,0.07,0.18,4.92,6.95,0.37 +0.98,-0.01,0.07,0.19,4.92,6.96,0.37 +0.98,-0.01,0.07,0.19,4.92,6.96,0.37 +0.98,-0.01,0.07,0.19,4.92,6.96,0.37 +0.98,-0.01,0.07,0.19,4.92,6.96,0.38 +0.98,-0.01,0.07,0.19,4.92,6.97,0.38 +0.98,-0.01,0.07,0.19,4.92,6.97,0.38 +0.98,-0.01,0.07,0.19,4.92,6.97,0.38 +0.98,-0.01,0.07,0.19,4.91,6.97,0.38 +0.98,-0.01,0.07,0.19,4.91,6.98,0.39 +0.98,-0.01,0.07,0.19,4.91,6.98,0.39 +0.98,-0.01,0.07,0.19,4.91,6.98,0.39 +0.98,-0.01,0.07,0.20,4.91,6.99,0.39 +0.98,-0.01,0.07,0.20,4.91,6.99,0.39 +0.98,-0.01,0.07,0.20,4.91,6.99,0.39 +0.98,-0.02,0.07,0.20,4.91,6.99,0.40 +0.98,-0.02,0.07,0.20,4.91,7.00,0.40 +0.98,-0.02,0.08,0.20,4.90,7.00,0.40 +0.98,-0.02,0.08,0.20,4.90,7.00,0.40 +0.98,-0.02,0.08,0.20,4.90,7.00,0.40 +0.98,-0.02,0.08,0.20,4.90,7.01,0.40 +0.98,-0.02,0.08,0.20,4.90,7.01,0.41 +0.98,-0.02,0.08,0.20,4.90,7.01,0.41 +0.98,-0.02,0.08,0.20,4.90,7.01,0.41 +0.98,-0.02,0.08,0.21,4.90,7.02,0.41 +0.98,-0.02,0.08,0.21,4.90,7.02,0.41 +0.97,-0.02,0.08,0.21,4.89,7.02,0.42 +0.97,-0.02,0.08,0.21,4.89,7.02,0.42 +0.97,-0.02,0.08,0.21,4.89,7.03,0.42 +0.97,-0.02,0.08,0.21,4.89,7.03,0.42 +0.97,-0.02,0.08,0.21,4.89,7.03,0.42 +0.97,-0.02,0.08,0.21,4.89,7.03,0.42 +0.97,-0.02,0.08,0.21,4.89,7.04,0.43 +0.97,-0.02,0.08,0.21,4.89,7.04,0.43 +0.97,-0.02,0.08,0.21,4.88,7.04,0.43 +0.97,-0.02,0.08,0.22,4.88,7.05,0.43 +0.97,-0.02,0.08,0.22,4.88,7.05,0.43 +0.97,-0.02,0.08,0.22,4.88,7.05,0.43 +0.97,-0.02,0.08,0.22,4.88,7.05,0.44 +0.97,-0.02,0.08,0.22,4.88,7.06,0.44 +0.97,-0.02,0.08,0.22,4.88,7.06,0.44 +0.97,-0.02,0.08,0.22,4.88,7.06,0.44 +0.97,-0.02,0.08,0.22,4.88,7.06,0.44 +0.97,-0.02,0.08,0.22,4.87,7.07,0.45 +0.97,-0.02,0.08,0.22,4.87,7.07,0.45 +0.97,-0.02,0.08,0.22,4.87,7.07,0.45 +0.97,-0.02,0.08,0.23,4.87,7.07,0.45 +0.97,-0.02,0.08,0.23,4.87,7.08,0.45 +0.97,-0.02,0.09,0.23,4.87,7.08,0.45 +0.97,-0.02,0.09,0.23,4.87,7.08,0.46 +0.97,-0.02,0.09,0.23,4.87,7.08,0.46 +0.97,-0.02,0.09,0.23,4.86,7.09,0.46 +0.97,-0.02,0.09,0.23,4.86,7.09,0.46 +0.97,-0.02,0.09,0.23,4.86,7.09,0.46 +0.97,-0.02,0.09,0.23,4.86,7.09,0.46 +0.97,-0.02,0.09,0.23,4.86,7.10,0.47 +0.97,-0.02,0.09,0.23,4.86,7.10,0.47 +0.97,-0.02,0.09,0.24,4.86,7.10,0.47 +0.97,-0.02,0.09,0.24,4.85,7.10,0.47 +0.97,-0.02,0.09,0.24,4.85,7.11,0.47 +0.97,-0.02,0.09,0.24,4.85,7.11,0.48 +0.97,-0.02,0.09,0.24,4.85,7.11,0.48 +0.97,-0.02,0.09,0.24,4.85,7.11,0.48 +0.97,-0.02,0.09,0.24,4.85,7.12,0.48 +0.97,-0.02,0.09,0.24,4.85,7.12,0.48 +0.97,-0.02,0.09,0.24,4.85,7.12,0.48 +0.97,-0.02,0.09,0.24,4.84,7.12,0.49 +0.97,-0.02,0.09,0.24,4.84,7.13,0.49 +0.96,-0.02,0.09,0.24,4.84,7.13,0.49 +0.96,-0.02,0.09,0.25,4.84,7.13,0.49 +0.96,-0.02,0.09,0.25,4.84,7.13,0.49 +0.96,-0.02,0.09,0.25,4.84,7.14,0.49 +0.96,-0.02,0.09,0.25,4.84,7.14,0.50 +0.96,-0.02,0.09,0.25,4.83,7.14,0.50 +0.96,-0.02,0.09,0.25,4.83,7.14,0.50 +0.96,-0.02,0.09,0.25,4.83,7.15,0.50 +0.96,-0.02,0.09,0.25,4.83,7.15,0.50 +0.96,-0.02,0.09,0.25,4.83,7.15,0.51 +0.96,-0.02,0.09,0.25,4.83,7.15,0.51 +0.96,-0.03,0.10,0.25,4.83,7.16,0.51 +0.96,-0.03,0.10,0.26,4.82,7.16,0.51 +0.96,-0.03,0.10,0.26,4.82,7.16,0.51 +0.96,-0.03,0.10,0.26,4.82,7.16,0.51 +0.96,-0.03,0.10,0.26,4.82,7.17,0.52 +0.96,-0.03,0.10,0.26,4.82,7.17,0.52 +0.96,-0.03,0.10,0.26,4.82,7.17,0.52 +0.96,-0.03,0.10,0.26,4.82,7.17,0.52 +0.96,-0.03,0.10,0.26,4.81,7.18,0.52 +0.96,-0.03,0.10,0.26,4.81,7.18,0.52 +0.96,-0.03,0.10,0.26,4.81,7.18,0.53 +0.96,-0.03,0.10,0.26,4.81,7.18,0.53 +0.96,-0.03,0.10,0.26,4.81,7.19,0.53 +0.96,-0.03,0.10,0.27,4.81,7.19,0.53 +0.96,-0.03,0.10,0.27,4.81,7.19,0.53 +0.96,-0.03,0.10,0.27,4.80,7.19,0.53 +0.96,-0.03,0.10,0.27,4.80,7.20,0.54 +0.96,-0.03,0.10,0.27,4.80,7.20,0.54 +0.96,-0.03,0.10,0.27,4.80,7.20,0.54 +0.96,-0.03,0.10,0.27,4.80,7.20,0.54 +0.96,-0.03,0.10,0.27,4.80,7.21,0.54 +0.96,-0.03,0.10,0.27,4.80,7.21,0.55 +0.96,-0.03,0.10,0.27,4.79,7.21,0.55 +0.96,-0.03,0.10,0.27,4.79,7.21,0.55 +0.96,-0.03,0.10,0.28,4.79,7.22,0.55 +0.96,-0.03,0.10,0.28,4.79,7.22,0.55 +0.95,-0.03,0.10,0.28,4.79,7.22,0.55 +0.95,-0.03,0.10,0.28,4.79,7.22,0.56 +0.95,-0.03,0.10,0.28,4.79,7.23,0.56 +0.95,-0.03,0.10,0.28,4.78,7.23,0.56 +0.95,-0.03,0.10,0.28,4.78,7.23,0.56 +0.95,-0.03,0.10,0.28,4.78,7.23,0.56 +0.95,-0.03,0.10,0.28,4.78,7.24,0.56 +0.95,-0.03,0.11,0.28,4.78,7.24,0.57 +0.95,-0.03,0.11,0.28,4.78,7.24,0.57 +0.95,-0.03,0.11,0.28,4.77,7.24,0.57 +0.95,-0.03,0.11,0.29,4.77,7.25,0.57 +0.95,-0.03,0.11,0.29,4.77,7.25,0.57 +0.95,-0.03,0.11,0.29,4.77,7.25,0.57 +0.95,-0.03,0.11,0.29,4.77,7.25,0.58 +0.95,-0.03,0.11,0.29,4.77,7.26,0.58 +0.95,-0.03,0.11,0.29,4.76,7.26,0.58 +0.95,-0.03,0.11,0.29,4.76,7.26,0.58 +0.95,-0.03,0.11,0.29,4.76,7.26,0.58 +0.95,-0.03,0.11,0.29,4.76,7.27,0.58 +0.95,-0.03,0.11,0.29,4.76,7.27,0.59 +0.95,-0.03,0.11,0.29,4.76,7.27,0.59 +0.95,-0.03,0.11,0.29,4.76,7.27,0.59 +0.95,-0.03,0.11,0.30,4.75,7.27,0.59 +0.95,-0.03,0.11,0.30,4.75,7.28,0.59 +0.95,-0.03,0.11,0.30,4.75,7.28,0.60 +0.95,-0.03,0.11,0.30,4.75,7.28,0.60 +0.95,-0.04,0.11,0.30,4.75,7.28,0.60 +0.95,-0.04,0.11,0.30,4.75,7.29,0.60 +0.95,-0.04,0.11,0.30,4.74,7.29,0.60 +0.95,-0.04,0.11,0.30,4.74,7.29,0.60 +0.95,-0.04,0.11,0.30,4.74,7.29,0.61 +0.95,-0.04,0.11,0.30,4.74,7.30,0.61 +0.95,-0.04,0.11,0.30,4.74,7.30,0.61 +0.94,-0.04,0.11,0.31,4.74,7.30,0.61 +0.94,-0.04,0.11,0.31,4.73,7.30,0.61 +0.94,-0.04,0.11,0.31,4.73,7.31,0.61 +0.94,-0.04,0.11,0.31,4.73,7.31,0.62 +0.94,-0.04,0.11,0.31,4.73,7.31,0.62 +0.94,-0.04,0.11,0.31,4.73,7.31,0.62 +0.94,-0.04,0.11,0.31,4.73,7.32,0.62 +0.94,-0.04,0.12,0.31,4.72,7.32,0.62 +0.94,-0.04,0.12,0.31,4.72,7.32,0.62 +0.94,-0.04,0.12,0.31,4.72,7.32,0.63 +0.94,-0.04,0.12,0.31,4.72,7.32,0.63 +0.94,-0.04,0.12,0.31,4.72,7.33,0.63 +0.94,-0.04,0.12,0.32,4.71,7.33,0.63 +0.94,-0.04,0.12,0.32,4.71,7.33,0.63 +0.94,-0.04,0.12,0.32,4.71,7.33,0.63 +0.94,-0.04,0.12,0.32,4.71,7.34,0.64 +0.94,-0.04,0.12,0.32,4.71,7.34,0.64 +0.94,-0.04,0.12,0.32,4.71,7.34,0.64 +0.94,-0.04,0.12,0.32,4.70,7.34,0.64 +0.94,-0.04,0.12,0.32,4.70,7.35,0.64 +0.94,-0.04,0.12,0.32,4.70,7.35,0.64 +0.94,-0.04,0.12,0.32,4.70,7.35,0.65 +0.94,-0.04,0.12,0.32,4.70,7.35,0.65 +0.94,-0.04,0.12,0.32,4.70,7.35,0.65 +0.94,-0.04,0.12,0.33,4.69,7.36,0.65 +0.94,-0.04,0.12,0.33,4.69,7.36,0.65 +0.94,-0.04,0.12,0.33,4.69,7.36,0.65 +0.94,-0.04,0.12,0.33,4.69,7.36,0.66 +0.94,-0.04,0.12,0.33,4.69,7.37,0.66 +0.94,-0.04,0.12,0.33,4.68,7.37,0.66 +0.93,-0.04,0.12,0.33,4.68,7.37,0.66 +0.93,-0.04,0.12,0.33,4.68,7.37,0.66 +0.93,-0.04,0.12,0.33,4.68,7.38,0.66 +0.93,-0.04,0.12,0.33,4.68,7.38,0.67 +0.93,-0.04,0.12,0.33,4.68,7.38,0.67 +0.93,-0.04,0.12,0.33,4.67,7.38,0.67 +0.93,-0.04,0.12,0.34,4.67,7.38,0.67 +0.93,-0.04,0.12,0.34,4.67,7.39,0.67 +0.93,-0.04,0.12,0.34,4.67,7.39,0.67 +0.93,-0.05,0.12,0.34,4.67,7.39,0.68 +0.93,-0.05,0.12,0.34,4.66,7.39,0.68 +0.93,-0.05,0.12,0.34,4.66,7.40,0.68 +0.93,-0.05,0.13,0.34,4.66,7.40,0.68 +0.93,-0.05,0.13,0.34,4.66,7.40,0.68 +0.93,-0.05,0.13,0.34,4.66,7.40,0.68 +0.93,-0.05,0.13,0.34,4.65,7.41,0.69 +0.93,-0.05,0.13,0.34,4.65,7.41,0.69 +0.93,-0.05,0.13,0.34,4.65,7.41,0.69 +0.93,-0.05,0.13,0.35,4.65,7.41,0.69 +0.93,-0.05,0.13,0.35,4.65,7.41,0.69 +0.93,-0.05,0.13,0.35,4.65,7.42,0.69 +0.93,-0.05,0.13,0.35,4.64,7.42,0.70 +0.93,-0.05,0.13,0.35,4.64,7.42,0.70 +0.93,-0.05,0.13,0.35,4.64,7.42,0.70 +0.93,-0.05,0.13,0.35,4.64,7.43,0.70 +0.93,-0.05,0.13,0.35,4.64,7.43,0.70 +0.93,-0.05,0.13,0.35,4.63,7.43,0.70 +0.93,-0.05,0.13,0.35,4.63,7.43,0.71 +0.92,-0.05,0.13,0.35,4.63,7.43,0.71 +0.92,-0.05,0.13,0.35,4.63,7.44,0.71 +0.92,-0.05,0.13,0.36,4.63,7.44,0.71 +0.92,-0.05,0.13,0.36,4.62,7.44,0.71 +0.92,-0.05,0.13,0.36,4.62,7.44,0.71 +0.92,-0.05,0.13,0.36,4.62,7.45,0.72 +0.92,-0.05,0.13,0.36,4.62,7.45,0.72 +0.92,-0.05,0.13,0.36,4.62,7.45,0.72 +0.92,-0.05,0.13,0.36,4.61,7.45,0.72 +0.92,-0.05,0.13,0.36,4.61,7.45,0.72 +0.92,-0.05,0.13,0.36,4.61,7.46,0.72 +0.92,-0.05,0.13,0.36,4.61,7.46,0.73 +0.92,-0.05,0.13,0.36,4.61,7.46,0.73 +0.92,-0.05,0.13,0.36,4.60,7.46,0.73 +0.92,-0.05,0.13,0.37,4.60,7.47,0.73 +0.92,-0.05,0.13,0.37,4.60,7.47,0.73 +0.92,-0.05,0.13,0.37,4.60,7.47,0.73 +0.92,-0.05,0.13,0.37,4.60,7.47,0.74 +0.92,-0.05,0.13,0.37,4.59,7.47,0.74 +0.92,-0.05,0.13,0.37,4.59,7.48,0.74 +0.92,-0.05,0.14,0.37,4.59,7.48,0.74 +0.92,-0.05,0.14,0.37,4.59,7.48,0.74 +0.92,-0.06,0.14,0.37,4.59,7.48,0.74 +0.92,-0.06,0.14,0.37,4.58,7.48,0.75 +0.92,-0.06,0.14,0.37,4.58,7.49,0.75 +0.92,-0.06,0.14,0.37,4.58,7.49,0.75 +0.91,-0.06,0.14,0.38,4.58,7.49,0.75 +0.91,-0.06,0.14,0.38,4.58,7.49,0.75 +0.91,-0.06,0.14,0.38,4.57,7.50,0.75 +0.91,-0.06,0.14,0.38,4.57,7.50,0.76 +0.91,-0.06,0.14,0.38,4.57,7.50,0.76 +0.91,-0.06,0.14,0.38,4.57,7.50,0.76 +0.91,-0.06,0.14,0.38,4.57,7.50,0.76 +0.91,-0.06,0.14,0.38,4.56,7.51,0.76 +0.91,-0.06,0.14,0.38,4.56,7.51,0.76 +0.91,-0.06,0.14,0.38,4.56,7.51,0.77 +0.91,-0.06,0.14,0.38,4.56,7.51,0.77 +0.91,-0.06,0.14,0.38,4.56,7.51,0.77 +0.91,-0.06,0.14,0.39,4.55,7.52,0.77 +0.91,-0.06,0.14,0.39,4.55,7.52,0.77 +0.91,-0.06,0.14,0.39,4.55,7.52,0.77 +0.91,-0.06,0.14,0.39,4.55,7.52,0.78 +0.91,-0.06,0.14,0.39,4.54,7.52,0.78 +0.91,-0.06,0.14,0.39,4.54,7.53,0.78 +0.91,-0.06,0.14,0.39,4.54,7.53,0.78 +0.91,-0.06,0.14,0.39,4.54,7.53,0.78 +0.91,-0.06,0.14,0.39,4.54,7.53,0.78 +0.91,-0.06,0.14,0.39,4.53,7.54,0.79 +0.91,-0.06,0.14,0.39,4.53,7.54,0.79 +0.91,-0.06,0.14,0.39,4.53,7.54,0.79 +0.91,-0.06,0.14,0.40,4.53,7.54,0.79 +0.90,-0.06,0.14,0.40,4.53,7.54,0.79 +0.90,-0.06,0.14,0.40,4.52,7.55,0.79 +0.90,-0.06,0.14,0.40,4.52,7.55,0.79 +0.90,-0.06,0.14,0.40,4.52,7.55,0.80 +0.90,-0.06,0.14,0.40,4.52,7.55,0.80 +0.90,-0.06,0.14,0.40,4.51,7.55,0.80 +0.90,-0.06,0.14,0.40,4.51,7.56,0.80 +0.90,-0.06,0.15,0.40,4.51,7.56,0.80 +0.90,-0.06,0.15,0.40,4.51,7.56,0.80 +0.90,-0.07,0.15,0.40,4.51,7.56,0.81 +0.90,-0.07,0.15,0.40,4.50,7.56,0.81 +0.90,-0.07,0.15,0.40,4.50,7.57,0.81 +0.90,-0.07,0.15,0.41,4.50,7.57,0.81 +0.90,-0.07,0.15,0.41,4.50,7.57,0.81 +0.90,-0.07,0.15,0.41,4.50,7.57,0.81 +0.90,-0.07,0.15,0.41,4.49,7.57,0.82 +0.90,-0.07,0.15,0.41,4.49,7.58,0.82 +0.90,-0.07,0.15,0.41,4.49,7.58,0.82 +0.90,-0.07,0.15,0.41,4.49,7.58,0.82 +0.90,-0.07,0.15,0.41,4.48,7.58,0.82 +0.90,-0.07,0.15,0.41,4.48,7.58,0.82 +0.90,-0.07,0.15,0.41,4.48,7.59,0.83 +0.90,-0.07,0.15,0.41,4.48,7.59,0.83 +0.90,-0.07,0.15,0.41,4.47,7.59,0.83 +0.89,-0.07,0.15,0.42,4.47,7.59,0.83 +0.89,-0.07,0.15,0.42,4.47,7.59,0.83 +0.89,-0.07,0.15,0.42,4.47,7.60,0.83 +0.89,-0.07,0.15,0.42,4.47,7.60,0.83 +0.89,-0.07,0.15,0.42,4.46,7.60,0.84 +0.89,-0.07,0.15,0.42,4.46,7.60,0.84 +0.89,-0.07,0.15,0.42,4.46,7.60,0.84 +0.89,-0.07,0.15,0.42,4.46,7.61,0.84 +0.89,-0.07,0.15,0.42,4.45,7.61,0.84 +0.89,-0.07,0.15,0.42,4.45,7.61,0.84 +0.89,-0.07,0.15,0.42,4.45,7.61,0.85 +0.89,-0.07,0.15,0.42,4.45,7.61,0.85 +0.89,-0.07,0.15,0.42,4.45,7.62,0.85 +0.89,-0.07,0.15,0.43,4.44,7.62,0.85 +0.89,-0.07,0.15,0.43,4.44,7.62,0.85 +0.89,-0.07,0.15,0.43,4.44,7.62,0.85 +0.89,-0.07,0.15,0.43,4.44,7.62,0.86 +0.89,-0.07,0.15,0.43,4.43,7.63,0.86 +0.89,-0.07,0.15,0.43,4.43,7.63,0.86 +0.89,-0.07,0.15,0.43,4.43,7.63,0.86 +0.89,-0.08,0.15,0.43,4.43,7.63,0.86 +0.89,-0.08,0.15,0.43,4.42,7.63,0.86 +0.89,-0.08,0.15,0.43,4.42,7.64,0.86 +0.88,-0.08,0.16,0.43,4.42,7.64,0.87 +0.88,-0.08,0.16,0.43,4.42,7.64,0.87 +0.88,-0.08,0.16,0.43,4.42,7.64,0.87 +0.88,-0.08,0.16,0.44,4.41,7.64,0.87 +0.88,-0.08,0.16,0.44,4.41,7.64,0.87 +0.88,-0.08,0.16,0.44,4.41,7.65,0.87 +0.88,-0.08,0.16,0.44,4.41,7.65,0.88 +0.88,-0.08,0.16,0.44,4.40,7.65,0.88 +0.88,-0.08,0.16,0.44,4.40,7.65,0.88 +0.88,-0.08,0.16,0.44,4.40,7.65,0.88 +0.88,-0.08,0.16,0.44,4.40,7.66,0.88 +0.88,-0.08,0.16,0.44,4.39,7.66,0.88 +0.88,-0.08,0.16,0.44,4.39,7.66,0.89 +0.88,-0.08,0.16,0.44,4.39,7.66,0.89 +0.88,-0.08,0.16,0.44,4.39,7.66,0.89 +0.88,-0.08,0.16,0.44,4.38,7.67,0.89 +0.88,-0.08,0.16,0.45,4.38,7.67,0.89 +0.88,-0.08,0.16,0.45,4.38,7.67,0.89 +0.88,-0.08,0.16,0.45,4.38,7.67,0.89 +0.88,-0.08,0.16,0.45,4.37,7.67,0.90 +0.88,-0.08,0.16,0.45,4.37,7.67,0.90 +0.87,-0.08,0.16,0.45,4.37,7.68,0.90 +0.87,-0.08,0.16,0.45,4.37,7.68,0.90 +0.87,-0.08,0.16,0.45,4.36,7.68,0.90 +0.87,-0.08,0.16,0.45,4.36,7.68,0.90 +0.87,-0.08,0.16,0.45,4.36,7.68,0.91 +0.87,-0.08,0.16,0.45,4.36,7.69,0.91 +0.87,-0.08,0.16,0.45,4.36,7.69,0.91 +0.87,-0.08,0.16,0.45,4.35,7.69,0.91 +0.87,-0.08,0.16,0.46,4.35,7.69,0.91 +0.87,-0.08,0.16,0.46,4.35,7.69,0.91 +0.87,-0.09,0.16,0.46,4.35,7.69,0.91 +0.87,-0.09,0.16,0.46,4.34,7.70,0.92 +0.87,-0.09,0.16,0.46,4.34,7.70,0.92 +0.87,-0.09,0.16,0.46,4.34,7.70,0.92 +0.87,-0.09,0.16,0.46,4.34,7.70,0.92 +0.87,-0.09,0.16,0.46,4.33,7.70,0.92 +0.87,-0.09,0.16,0.46,4.33,7.71,0.92 +0.87,-0.09,0.16,0.46,4.33,7.71,0.93 +0.87,-0.09,0.16,0.46,4.33,7.71,0.93 +0.87,-0.09,0.16,0.46,4.32,7.71,0.93 +0.87,-0.09,0.16,0.46,4.32,7.71,0.93 +0.86,-0.09,0.16,0.47,4.32,7.71,0.93 +0.86,-0.09,0.16,0.47,4.32,7.72,0.93 +0.86,-0.09,0.17,0.47,4.31,7.72,0.93 +0.86,-0.09,0.17,0.47,4.31,7.72,0.94 +0.86,-0.09,0.17,0.47,4.31,7.72,0.94 +0.86,-0.09,0.17,0.47,4.31,7.72,0.94 +0.86,-0.09,0.17,0.47,4.30,7.73,0.94 +0.86,-0.09,0.17,0.47,4.30,7.73,0.94 +0.86,-0.09,0.17,0.47,4.30,7.73,0.94 +0.86,-0.09,0.17,0.47,4.30,7.73,0.95 +0.86,-0.09,0.17,0.47,4.29,7.73,0.95 +0.86,-0.09,0.17,0.47,4.29,7.73,0.95 +0.86,-0.09,0.17,0.47,4.29,7.74,0.95 +0.86,-0.09,0.17,0.48,4.28,7.74,0.95 +0.86,-0.09,0.17,0.48,4.28,7.74,0.95 +0.86,-0.09,0.17,0.48,4.28,7.74,0.95 +0.86,-0.09,0.17,0.48,4.28,7.74,0.96 +0.86,-0.09,0.17,0.48,4.27,7.74,0.96 +0.86,-0.09,0.17,0.48,4.27,7.75,0.96 +0.86,-0.09,0.17,0.48,4.27,7.75,0.96 +0.86,-0.10,0.17,0.48,4.27,7.75,0.96 +0.85,-0.10,0.17,0.48,4.26,7.75,0.96 +0.85,-0.10,0.17,0.48,4.26,7.75,0.96 +0.85,-0.10,0.17,0.48,4.26,7.75,0.97 +0.85,-0.10,0.17,0.48,4.26,7.76,0.97 +0.85,-0.10,0.17,0.48,4.25,7.76,0.97 +0.85,-0.10,0.17,0.49,4.25,7.76,0.97 +0.85,-0.10,0.17,0.49,4.25,7.76,0.97 +0.85,-0.10,0.17,0.49,4.25,7.76,0.97 +0.85,-0.10,0.17,0.49,4.24,7.76,0.98 +0.85,-0.10,0.17,0.49,4.24,7.77,0.98 +0.85,-0.10,0.17,0.49,4.24,7.77,0.98 +0.85,-0.10,0.17,0.49,4.24,7.77,0.98 +0.85,-0.10,0.17,0.49,4.23,7.77,0.98 +0.85,-0.10,0.17,0.49,4.23,7.77,0.98 +0.85,-0.10,0.17,0.49,4.23,7.77,0.98 +0.85,-0.10,0.17,0.49,4.23,7.78,0.99 +0.85,-0.10,0.17,0.49,4.22,7.78,0.99 +0.85,-0.10,0.17,0.49,4.22,7.78,0.99 +0.85,-0.10,0.17,0.49,4.22,7.78,0.99 +0.84,-0.10,0.17,0.50,4.21,7.78,0.99 +0.84,-0.10,0.17,0.50,4.21,7.78,0.99 +0.84,-0.10,0.17,0.50,4.21,7.79,0.99 +0.84,-0.10,0.17,0.50,4.21,7.79,1.00 +0.84,-0.10,0.17,0.50,4.20,7.79,1.00 +0.84,-0.10,0.17,0.50,4.20,7.79,1.00 +0.84,-0.10,0.17,0.50,4.20,7.79,1.00 +0.84,-0.10,0.17,0.50,4.20,7.79,1.00 +0.84,-0.10,0.17,0.50,4.19,7.80,1.00 +0.84,-0.10,0.17,0.50,4.19,7.80,1.00 +0.84,-0.10,0.18,0.50,4.19,7.80,1.01 +0.84,-0.11,0.18,0.50,4.19,7.80,1.01 +0.84,-0.11,0.18,0.50,4.18,7.80,1.01 +0.84,-0.11,0.18,0.51,4.18,7.80,1.01 +0.84,-0.11,0.18,0.51,4.18,7.80,1.01 +0.84,-0.11,0.18,0.51,4.17,7.81,1.01 +0.84,-0.11,0.18,0.51,4.17,7.81,1.01 +0.84,-0.11,0.18,0.51,4.17,7.81,1.02 +0.84,-0.11,0.18,0.51,4.17,7.81,1.02 +0.84,-0.11,0.18,0.51,4.16,7.81,1.02 +0.83,-0.11,0.18,0.51,4.16,7.81,1.02 +0.83,-0.11,0.18,0.51,4.16,7.82,1.02 +0.83,-0.11,0.18,0.51,4.16,7.82,1.02 +0.83,-0.11,0.18,0.51,4.15,7.82,1.03 +0.83,-0.11,0.18,0.51,4.15,7.82,1.03 +0.83,-0.11,0.18,0.51,4.15,7.82,1.03 +0.83,-0.11,0.18,0.51,4.14,7.82,1.03 +0.83,-0.11,0.18,0.52,4.14,7.82,1.03 +0.83,-0.11,0.18,0.52,4.14,7.83,1.03 +0.83,-0.11,0.18,0.52,4.14,7.83,1.03 +0.83,-0.11,0.18,0.52,4.13,7.83,1.04 +0.83,-0.11,0.18,0.52,4.13,7.83,1.04 +0.83,-0.11,0.18,0.52,4.13,7.83,1.04 +0.83,-0.11,0.18,0.52,4.13,7.83,1.04 +0.83,-0.11,0.18,0.52,4.12,7.83,1.04 +0.83,-0.11,0.18,0.52,4.12,7.84,1.04 +0.83,-0.11,0.18,0.52,4.12,7.84,1.04 +0.83,-0.11,0.18,0.52,4.11,7.84,1.05 +0.82,-0.11,0.18,0.52,4.11,7.84,1.05 +0.82,-0.11,0.18,0.52,4.11,7.84,1.05 +0.82,-0.12,0.18,0.52,4.11,7.84,1.05 +0.82,-0.12,0.18,0.53,4.10,7.85,1.05 +0.82,-0.12,0.18,0.53,4.10,7.85,1.05 +0.82,-0.12,0.18,0.53,4.10,7.85,1.05 +0.82,-0.12,0.18,0.53,4.09,7.85,1.06 +0.82,-0.12,0.18,0.53,4.09,7.85,1.06 +0.82,-0.12,0.18,0.53,4.09,7.85,1.06 +0.82,-0.12,0.18,0.53,4.09,7.85,1.06 +0.82,-0.12,0.18,0.53,4.08,7.86,1.06 +0.82,-0.12,0.18,0.53,4.08,7.86,1.06 +0.82,-0.12,0.18,0.53,4.08,7.86,1.06 +0.82,-0.12,0.18,0.53,4.07,7.86,1.07 +0.82,-0.12,0.18,0.53,4.07,7.86,1.07 +0.82,-0.12,0.18,0.53,4.07,7.86,1.07 +0.82,-0.12,0.18,0.53,4.07,7.86,1.07 +0.82,-0.12,0.18,0.54,4.06,7.87,1.07 +0.82,-0.12,0.18,0.54,4.06,7.87,1.07 +0.81,-0.12,0.18,0.54,4.06,7.87,1.07 +0.81,-0.12,0.18,0.54,4.05,7.87,1.08 +0.81,-0.12,0.18,0.54,4.05,7.87,1.08 +0.81,-0.12,0.18,0.54,4.05,7.87,1.08 +0.81,-0.12,0.18,0.54,4.05,7.87,1.08 +0.81,-0.12,0.18,0.54,4.04,7.87,1.08 +0.81,-0.12,0.18,0.54,4.04,7.88,1.08 +0.81,-0.12,0.19,0.54,4.04,7.88,1.08 +0.81,-0.12,0.19,0.54,4.03,7.88,1.08 +0.81,-0.12,0.19,0.54,4.03,7.88,1.09 +0.81,-0.12,0.19,0.54,4.03,7.88,1.09 +0.81,-0.13,0.19,0.54,4.03,7.88,1.09 +0.81,-0.13,0.19,0.55,4.02,7.88,1.09 +0.81,-0.13,0.19,0.55,4.02,7.89,1.09 +0.81,-0.13,0.19,0.55,4.02,7.89,1.09 +0.81,-0.13,0.19,0.55,4.01,7.89,1.09 +0.81,-0.13,0.19,0.55,4.01,7.89,1.10 +0.80,-0.13,0.19,0.55,4.01,7.89,1.10 +0.80,-0.13,0.19,0.55,4.01,7.89,1.10 +0.80,-0.13,0.19,0.55,4.00,7.89,1.10 +0.80,-0.13,0.19,0.55,4.00,7.89,1.10 +0.80,-0.13,0.19,0.55,4.00,7.90,1.10 +0.80,-0.13,0.19,0.55,3.99,7.90,1.10 +0.80,-0.13,0.19,0.55,3.99,7.90,1.11 +0.80,-0.13,0.19,0.55,3.99,7.90,1.11 +0.80,-0.13,0.19,0.55,3.99,7.90,1.11 +0.80,-0.13,0.19,0.55,3.98,7.90,1.11 +0.80,-0.13,0.19,0.56,3.98,7.90,1.11 +0.80,-0.13,0.19,0.56,3.98,7.91,1.11 +0.80,-0.13,0.19,0.56,3.97,7.91,1.11 +0.80,-0.13,0.19,0.56,3.97,7.91,1.12 +0.80,-0.13,0.19,0.56,3.97,7.91,1.12 +0.80,-0.13,0.19,0.56,3.97,7.91,1.12 +0.80,-0.13,0.19,0.56,3.96,7.91,1.12 +0.80,-0.13,0.19,0.56,3.96,7.91,1.12 +0.79,-0.13,0.19,0.56,3.96,7.91,1.12 +0.79,-0.13,0.19,0.56,3.95,7.92,1.12 +0.79,-0.13,0.19,0.56,3.95,7.92,1.12 +0.79,-0.13,0.19,0.56,3.95,7.92,1.13 +0.79,-0.14,0.19,0.56,3.94,7.92,1.13 +0.79,-0.14,0.19,0.56,3.94,7.92,1.13 +0.79,-0.14,0.19,0.57,3.94,7.92,1.13 +0.79,-0.14,0.19,0.57,3.94,7.92,1.13 +0.79,-0.14,0.19,0.57,3.93,7.92,1.13 +0.79,-0.14,0.19,0.57,3.93,7.92,1.13 +0.79,-0.14,0.19,0.57,3.93,7.93,1.14 +0.79,-0.14,0.19,0.57,3.92,7.93,1.14 +0.79,-0.14,0.19,0.57,3.92,7.93,1.14 +0.79,-0.14,0.19,0.57,3.92,7.93,1.14 +0.79,-0.14,0.19,0.57,3.91,7.93,1.14 +0.79,-0.14,0.19,0.57,3.91,7.93,1.14 +0.79,-0.14,0.19,0.57,3.91,7.93,1.14 +0.78,-0.14,0.19,0.57,3.91,7.93,1.15 +0.78,-0.14,0.19,0.57,3.90,7.94,1.15 +0.78,-0.14,0.19,0.57,3.90,7.94,1.15 +0.78,-0.14,0.19,0.57,3.90,7.94,1.15 +0.78,-0.14,0.19,0.58,3.89,7.94,1.15 +0.78,-0.14,0.19,0.58,3.89,7.94,1.15 +0.78,-0.14,0.19,0.58,3.89,7.94,1.15 +0.78,-0.14,0.19,0.58,3.88,7.94,1.15 +0.78,-0.14,0.19,0.58,3.88,7.94,1.16 +0.78,-0.14,0.19,0.58,3.88,7.94,1.16 +0.78,-0.14,0.19,0.58,3.88,7.95,1.16 +0.78,-0.14,0.19,0.58,3.87,7.95,1.16 +0.78,-0.14,0.19,0.58,3.87,7.95,1.16 +0.78,-0.15,0.19,0.58,3.87,7.95,1.16 +0.78,-0.15,0.19,0.58,3.86,7.95,1.16 +0.78,-0.15,0.19,0.58,3.86,7.95,1.17 +0.78,-0.15,0.19,0.58,3.86,7.95,1.17 +0.77,-0.15,0.19,0.58,3.85,7.95,1.17 +0.77,-0.15,0.19,0.58,3.85,7.95,1.17 +0.77,-0.15,0.19,0.59,3.85,7.96,1.17 +0.77,-0.15,0.19,0.59,3.84,7.96,1.17 +0.77,-0.15,0.20,0.59,3.84,7.96,1.17 +0.77,-0.15,0.20,0.59,3.84,7.96,1.17 +0.77,-0.15,0.20,0.59,3.84,7.96,1.18 +0.77,-0.15,0.20,0.59,3.83,7.96,1.18 +0.77,-0.15,0.20,0.59,3.83,7.96,1.18 +0.77,-0.15,0.20,0.59,3.83,7.96,1.18 +0.77,-0.15,0.20,0.59,3.82,7.96,1.18 +0.77,-0.15,0.20,0.59,3.82,7.97,1.18 +0.77,-0.15,0.20,0.59,3.82,7.97,1.18 +0.77,-0.15,0.20,0.59,3.81,7.97,1.18 +0.77,-0.15,0.20,0.59,3.81,7.97,1.19 +0.77,-0.15,0.20,0.59,3.81,7.97,1.19 +0.76,-0.15,0.20,0.59,3.80,7.97,1.19 +0.76,-0.15,0.20,0.59,3.80,7.97,1.19 +0.76,-0.15,0.20,0.60,3.80,7.97,1.19 +0.76,-0.15,0.20,0.60,3.80,7.97,1.19 +0.76,-0.15,0.20,0.60,3.79,7.97,1.19 +0.76,-0.15,0.20,0.60,3.79,7.98,1.20 +0.76,-0.16,0.20,0.60,3.79,7.98,1.20 +0.76,-0.16,0.20,0.60,3.78,7.98,1.20 +0.76,-0.16,0.20,0.60,3.78,7.98,1.20 +0.76,-0.16,0.20,0.60,3.78,7.98,1.20 +0.76,-0.16,0.20,0.60,3.77,7.98,1.20 +0.76,-0.16,0.20,0.60,3.77,7.98,1.20 +0.76,-0.16,0.20,0.60,3.77,7.98,1.20 +0.76,-0.16,0.20,0.60,3.76,7.98,1.21 +0.76,-0.16,0.20,0.60,3.76,7.98,1.21 +0.76,-0.16,0.20,0.60,3.76,7.98,1.21 +0.75,-0.16,0.20,0.60,3.75,7.99,1.21 +0.75,-0.16,0.20,0.61,3.75,7.99,1.21 +0.75,-0.16,0.20,0.61,3.75,7.99,1.21 +0.75,-0.16,0.20,0.61,3.75,7.99,1.21 +0.75,-0.16,0.20,0.61,3.74,7.99,1.21 +0.75,-0.16,0.20,0.61,3.74,7.99,1.22 +0.75,-0.16,0.20,0.61,3.74,7.99,1.22 +0.75,-0.16,0.20,0.61,3.73,7.99,1.22 +0.75,-0.16,0.20,0.61,3.73,7.99,1.22 +0.75,-0.16,0.20,0.61,3.73,7.99,1.22 +0.75,-0.16,0.20,0.61,3.72,7.99,1.22 +0.75,-0.16,0.20,0.61,3.72,8.00,1.22 +0.75,-0.16,0.20,0.61,3.72,8.00,1.22 +0.75,-0.16,0.20,0.61,3.71,8.00,1.23 +0.75,-0.16,0.20,0.61,3.71,8.00,1.23 +0.75,-0.16,0.20,0.61,3.71,8.00,1.23 +0.74,-0.17,0.20,0.61,3.70,8.00,1.23 +0.74,-0.17,0.20,0.62,3.70,8.00,1.23 +0.74,-0.17,0.20,0.62,3.70,8.00,1.23 +0.74,-0.17,0.20,0.62,3.69,8.00,1.23 +0.74,-0.17,0.20,0.62,3.69,8.00,1.23 +0.74,-0.17,0.20,0.62,3.69,8.00,1.24 +0.74,-0.17,0.20,0.62,3.68,8.01,1.24 +0.74,-0.17,0.20,0.62,3.68,8.01,1.24 +0.74,-0.17,0.20,0.62,3.68,8.01,1.24 +0.74,-0.17,0.20,0.62,3.68,8.01,1.24 +0.74,-0.17,0.20,0.62,3.67,8.01,1.24 +0.74,-0.17,0.20,0.62,3.67,8.01,1.24 +0.74,-0.17,0.20,0.62,3.67,8.01,1.24 +0.74,-0.17,0.20,0.62,3.66,8.01,1.25 +0.74,-0.17,0.20,0.62,3.66,8.01,1.25 +0.74,-0.17,0.20,0.62,3.66,8.01,1.25 +0.73,-0.17,0.20,0.62,3.65,8.01,1.25 +0.73,-0.17,0.20,0.63,3.65,8.01,1.25 +0.73,-0.17,0.20,0.63,3.65,8.02,1.25 +0.73,-0.17,0.20,0.63,3.64,8.02,1.25 +0.73,-0.17,0.20,0.63,3.64,8.02,1.25 +0.73,-0.17,0.20,0.63,3.64,8.02,1.26 +0.73,-0.17,0.20,0.63,3.63,8.02,1.26 +0.73,-0.17,0.20,0.63,3.63,8.02,1.26 +0.73,-0.18,0.20,0.63,3.63,8.02,1.26 +0.73,-0.18,0.20,0.63,3.62,8.02,1.26 +0.73,-0.18,0.20,0.63,3.62,8.02,1.26 +0.73,-0.18,0.20,0.63,3.62,8.02,1.26 +0.73,-0.18,0.20,0.63,3.61,8.02,1.26 +0.73,-0.18,0.20,0.63,3.61,8.02,1.26 +0.73,-0.18,0.20,0.63,3.61,8.02,1.27 +0.72,-0.18,0.20,0.63,3.60,8.02,1.27 +0.72,-0.18,0.20,0.63,3.60,8.03,1.27 +0.72,-0.18,0.20,0.63,3.60,8.03,1.27 +0.72,-0.18,0.20,0.64,3.59,8.03,1.27 +0.72,-0.18,0.20,0.64,3.59,8.03,1.27 +0.72,-0.18,0.20,0.64,3.59,8.03,1.27 +0.72,-0.18,0.20,0.64,3.58,8.03,1.27 +0.72,-0.18,0.20,0.64,3.58,8.03,1.28 +0.72,-0.18,0.20,0.64,3.58,8.03,1.28 +0.72,-0.18,0.20,0.64,3.57,8.03,1.28 +0.72,-0.18,0.20,0.64,3.57,8.03,1.28 +0.72,-0.18,0.20,0.64,3.57,8.03,1.28 +0.72,-0.18,0.20,0.64,3.56,8.03,1.28 +0.72,-0.18,0.20,0.64,3.56,8.03,1.28 +0.72,-0.18,0.20,0.64,3.56,8.03,1.28 +0.72,-0.18,0.20,0.64,3.55,8.04,1.29 +0.71,-0.18,0.20,0.64,3.55,8.04,1.29 +0.71,-0.18,0.20,0.64,3.55,8.04,1.29 +0.71,-0.19,0.20,0.64,3.55,8.04,1.29 +0.71,-0.19,0.21,0.64,3.54,8.04,1.29 +0.71,-0.19,0.21,0.65,3.54,8.04,1.29 +0.71,-0.19,0.21,0.65,3.54,8.04,1.29 +0.71,-0.19,0.21,0.65,3.53,8.04,1.29 +0.71,-0.19,0.21,0.65,3.53,8.04,1.29 +0.71,-0.19,0.21,0.65,3.53,8.04,1.30 +0.71,-0.19,0.21,0.65,3.52,8.04,1.30 +0.71,-0.19,0.21,0.65,3.52,8.04,1.30 +0.71,-0.19,0.21,0.65,3.52,8.04,1.30 +0.71,-0.19,0.21,0.65,3.51,8.04,1.30 +0.71,-0.19,0.21,0.65,3.51,8.04,1.30 +0.71,-0.19,0.21,0.65,3.51,8.04,1.30 +0.70,-0.19,0.21,0.65,3.50,8.04,1.30 +0.70,-0.19,0.21,0.65,3.50,8.05,1.31 +0.70,-0.19,0.21,0.65,3.50,8.05,1.31 +0.70,-0.19,0.21,0.65,3.49,8.05,1.31 +0.70,-0.19,0.21,0.65,3.49,8.05,1.31 +0.70,-0.19,0.21,0.65,3.49,8.05,1.31 +0.70,-0.19,0.21,0.66,3.48,8.05,1.31 +0.70,-0.19,0.21,0.66,3.48,8.05,1.31 +0.70,-0.19,0.21,0.66,3.48,8.05,1.31 +0.70,-0.19,0.21,0.66,3.47,8.05,1.31 +0.70,-0.19,0.21,0.66,3.47,8.05,1.32 +0.70,-0.20,0.21,0.66,3.47,8.05,1.32 +0.70,-0.20,0.21,0.66,3.46,8.05,1.32 +0.70,-0.20,0.21,0.66,3.46,8.05,1.32 +0.69,-0.20,0.21,0.66,3.46,8.05,1.32 +0.69,-0.20,0.21,0.66,3.45,8.05,1.32 +0.69,-0.20,0.21,0.66,3.45,8.05,1.32 +0.69,-0.20,0.21,0.66,3.45,8.05,1.32 +0.69,-0.20,0.21,0.66,3.44,8.05,1.32 +0.69,-0.20,0.21,0.66,3.44,8.05,1.33 +0.69,-0.20,0.21,0.66,3.43,8.06,1.33 +0.69,-0.20,0.21,0.66,3.43,8.06,1.33 +0.69,-0.20,0.21,0.66,3.43,8.06,1.33 +0.69,-0.20,0.21,0.67,3.42,8.06,1.33 +0.69,-0.20,0.21,0.67,3.42,8.06,1.33 +0.69,-0.20,0.21,0.67,3.42,8.06,1.33 +0.69,-0.20,0.21,0.67,3.41,8.06,1.33 +0.69,-0.20,0.21,0.67,3.41,8.06,1.33 +0.69,-0.20,0.21,0.67,3.41,8.06,1.34 +0.68,-0.20,0.21,0.67,3.40,8.06,1.34 +0.68,-0.20,0.21,0.67,3.40,8.06,1.34 +0.68,-0.20,0.21,0.67,3.40,8.06,1.34 +0.68,-0.20,0.21,0.67,3.39,8.06,1.34 +0.68,-0.20,0.21,0.67,3.39,8.06,1.34 +0.68,-0.20,0.21,0.67,3.39,8.06,1.34 +0.68,-0.21,0.21,0.67,3.38,8.06,1.34 +0.68,-0.21,0.21,0.67,3.38,8.06,1.34 +0.68,-0.21,0.21,0.67,3.38,8.06,1.35 +0.68,-0.21,0.21,0.67,3.37,8.06,1.35 +0.68,-0.21,0.21,0.67,3.37,8.06,1.35 +0.68,-0.21,0.21,0.67,3.37,8.06,1.35 +0.68,-0.21,0.21,0.68,3.36,8.06,1.35 +0.68,-0.21,0.21,0.68,3.36,8.06,1.35 +0.68,-0.21,0.21,0.68,3.36,8.06,1.35 +0.67,-0.21,0.21,0.68,3.35,8.07,1.35 +0.67,-0.21,0.21,0.68,3.35,8.07,1.35 +0.67,-0.21,0.21,0.68,3.35,8.07,1.36 +0.67,-0.21,0.21,0.68,3.34,8.07,1.36 +0.67,-0.21,0.21,0.68,3.34,8.07,1.36 +0.67,-0.21,0.21,0.68,3.34,8.07,1.36 +0.67,-0.21,0.21,0.68,3.33,8.07,1.36 +0.67,-0.21,0.21,0.68,3.33,8.07,1.36 +0.67,-0.21,0.21,0.68,3.33,8.07,1.36 +0.67,-0.21,0.21,0.68,3.32,8.07,1.36 +0.67,-0.21,0.21,0.68,3.32,8.07,1.36 +0.67,-0.21,0.21,0.68,3.32,8.07,1.37 +0.67,-0.21,0.21,0.68,3.31,8.07,1.37 +0.67,-0.21,0.21,0.68,3.31,8.07,1.37 +0.66,-0.22,0.21,0.68,3.31,8.07,1.37 +0.66,-0.22,0.21,0.68,3.30,8.07,1.37 +0.66,-0.22,0.21,0.69,3.30,8.07,1.37 +0.66,-0.22,0.21,0.69,3.30,8.07,1.37 +0.66,-0.22,0.21,0.69,3.29,8.07,1.37 +0.66,-0.22,0.21,0.69,3.29,8.07,1.37 +0.66,-0.22,0.21,0.69,3.28,8.07,1.37 +0.66,-0.22,0.21,0.69,3.28,8.07,1.38 +0.66,-0.22,0.21,0.69,3.28,8.07,1.38 +0.66,-0.22,0.21,0.69,3.27,8.07,1.38 +0.66,-0.22,0.21,0.69,3.27,8.07,1.38 +0.66,-0.22,0.21,0.69,3.27,8.07,1.38 +0.66,-0.22,0.21,0.69,3.26,8.07,1.38 +0.66,-0.22,0.21,0.69,3.26,8.07,1.38 +0.65,-0.22,0.21,0.69,3.26,8.07,1.38 +0.65,-0.22,0.21,0.69,3.25,8.07,1.38 +0.65,-0.22,0.21,0.69,3.25,8.07,1.39 +0.65,-0.22,0.21,0.69,3.25,8.07,1.39 +0.65,-0.22,0.21,0.69,3.24,8.07,1.39 +0.65,-0.22,0.21,0.69,3.24,8.07,1.39 +0.65,-0.22,0.21,0.69,3.24,8.07,1.39 +0.65,-0.22,0.21,0.70,3.23,8.07,1.39 +0.65,-0.22,0.21,0.70,3.23,8.07,1.39 +0.65,-0.23,0.21,0.70,3.23,8.07,1.39 +0.65,-0.23,0.21,0.70,3.22,8.07,1.39 +0.65,-0.23,0.21,0.70,3.22,8.07,1.39 +0.65,-0.23,0.21,0.70,3.22,8.08,1.40 +0.65,-0.23,0.21,0.70,3.21,8.08,1.40 +0.64,-0.23,0.21,0.70,3.21,8.08,1.40 +0.64,-0.23,0.21,0.70,3.20,8.08,1.40 +0.64,-0.23,0.21,0.70,3.20,8.08,1.40 +0.64,-0.23,0.21,0.70,3.20,8.08,1.40 +0.64,-0.23,0.21,0.70,3.19,8.08,1.40 +0.64,-0.23,0.21,0.70,3.19,8.08,1.40 +0.64,-0.23,0.21,0.70,3.19,8.08,1.40 +0.64,-0.23,0.21,0.70,3.18,8.08,1.40 +0.64,-0.23,0.21,0.70,3.18,8.08,1.41 +0.64,-0.23,0.21,0.70,3.18,8.08,1.41 +0.64,-0.23,0.21,0.70,3.17,8.08,1.41 +0.64,-0.23,0.21,0.70,3.17,8.08,1.41 +0.64,-0.23,0.21,0.70,3.17,8.08,1.41 +0.64,-0.23,0.21,0.71,3.16,8.08,1.41 +0.63,-0.23,0.21,0.71,3.16,8.08,1.41 +0.63,-0.23,0.21,0.71,3.16,8.08,1.41 +0.63,-0.23,0.21,0.71,3.15,8.08,1.41 +0.63,-0.23,0.21,0.71,3.15,8.08,1.41 +0.63,-0.24,0.21,0.71,3.15,8.08,1.42 +0.63,-0.24,0.21,0.71,3.14,8.08,1.42 +0.63,-0.24,0.21,0.71,3.14,8.08,1.42 +0.63,-0.24,0.21,0.71,3.13,8.08,1.42 +0.63,-0.24,0.21,0.71,3.13,8.08,1.42 +0.63,-0.24,0.21,0.71,3.13,8.08,1.42 +0.63,-0.24,0.21,0.71,3.12,8.08,1.42 +0.63,-0.24,0.21,0.71,3.12,8.08,1.42 +0.63,-0.24,0.21,0.71,3.12,8.08,1.42 +0.63,-0.24,0.21,0.71,3.11,8.08,1.42 +0.62,-0.24,0.21,0.71,3.11,8.08,1.43 +0.62,-0.24,0.21,0.71,3.11,8.08,1.43 +0.62,-0.24,0.21,0.71,3.10,8.08,1.43 +0.62,-0.24,0.21,0.71,3.10,8.08,1.43 +0.62,-0.24,0.21,0.71,3.10,8.08,1.43 +0.62,-0.24,0.21,0.72,3.09,8.08,1.43 +0.62,-0.24,0.21,0.72,3.09,8.08,1.43 +0.62,-0.24,0.21,0.72,3.09,8.08,1.43 +0.62,-0.24,0.21,0.72,3.08,8.08,1.43 +0.62,-0.24,0.21,0.72,3.08,8.08,1.43 +0.62,-0.24,0.21,0.72,3.07,8.08,1.44 +0.62,-0.24,0.21,0.72,3.07,8.08,1.44 +0.62,-0.24,0.21,0.72,3.07,8.08,1.44 +0.62,-0.25,0.21,0.72,3.06,8.08,1.44 +0.61,-0.25,0.21,0.72,3.06,8.08,1.44 +0.61,-0.25,0.21,0.72,3.06,8.08,1.44 +0.61,-0.25,0.21,0.72,3.05,8.08,1.44 +0.61,-0.25,0.21,0.72,3.05,8.08,1.44 +0.61,-0.25,0.21,0.72,3.05,8.08,1.44 +0.61,-0.25,0.21,0.72,3.04,8.08,1.44 +0.61,-0.25,0.21,0.72,3.04,8.08,1.45 +0.61,-0.25,0.21,0.72,3.04,8.08,1.45 +0.61,-0.25,0.21,0.72,3.03,8.08,1.45 +0.61,-0.25,0.21,0.72,3.03,8.08,1.45 +0.61,-0.25,0.21,0.72,3.02,8.08,1.45 +0.61,-0.25,0.21,0.72,3.02,8.08,1.45 +0.61,-0.25,0.21,0.73,3.02,8.07,1.45 +0.60,-0.25,0.21,0.73,3.01,8.07,1.45 +0.60,-0.25,0.21,0.73,3.01,8.07,1.45 +0.60,-0.25,0.21,0.73,3.01,8.07,1.45 +0.60,-0.25,0.21,0.73,3.00,8.07,1.45 +0.60,-0.25,0.21,0.73,3.00,8.07,1.46 +0.60,-0.25,0.21,0.73,3.00,8.07,1.46 +0.60,-0.25,0.21,0.73,2.99,8.07,1.46 +0.60,-0.25,0.21,0.73,2.99,8.07,1.46 +0.60,-0.26,0.21,0.73,2.99,8.07,1.46 +0.60,-0.26,0.21,0.73,2.98,8.07,1.46 +0.60,-0.26,0.21,0.73,2.98,8.07,1.46 +0.60,-0.26,0.21,0.73,2.98,8.07,1.46 +0.60,-0.26,0.21,0.73,2.97,8.07,1.46 +0.60,-0.26,0.21,0.73,2.97,8.07,1.46 +0.59,-0.26,0.21,0.73,2.96,8.07,1.46 +0.59,-0.26,0.21,0.73,2.96,8.07,1.47 +0.59,-0.26,0.21,0.73,2.96,8.07,1.47 +0.59,-0.26,0.21,0.73,2.95,8.07,1.47 +0.59,-0.26,0.21,0.73,2.95,8.07,1.47 +0.59,-0.26,0.21,0.73,2.95,8.07,1.47 +0.59,-0.26,0.21,0.73,2.94,8.07,1.47 +0.59,-0.26,0.21,0.74,2.94,8.07,1.47 +0.59,-0.26,0.21,0.74,2.94,8.07,1.47 +0.59,-0.26,0.21,0.74,2.93,8.07,1.47 +0.59,-0.26,0.21,0.74,2.93,8.07,1.47 +0.59,-0.26,0.21,0.74,2.92,8.07,1.47 +0.59,-0.26,0.21,0.74,2.92,8.07,1.48 +0.58,-0.26,0.21,0.74,2.92,8.07,1.48 +0.58,-0.26,0.21,0.74,2.91,8.07,1.48 +0.58,-0.26,0.21,0.74,2.91,8.07,1.48 +0.58,-0.27,0.21,0.74,2.91,8.07,1.48 +0.58,-0.27,0.21,0.74,2.90,8.07,1.48 +0.58,-0.27,0.21,0.74,2.90,8.07,1.48 +0.58,-0.27,0.21,0.74,2.90,8.07,1.48 +0.58,-0.27,0.21,0.74,2.89,8.07,1.48 +0.58,-0.27,0.21,0.74,2.89,8.07,1.48 +0.58,-0.27,0.21,0.74,2.89,8.07,1.48 +0.58,-0.27,0.21,0.74,2.88,8.07,1.48 +0.58,-0.27,0.21,0.74,2.88,8.07,1.49 +0.58,-0.27,0.21,0.74,2.87,8.06,1.49 +0.58,-0.27,0.21,0.74,2.87,8.06,1.49 +0.57,-0.27,0.21,0.74,2.87,8.06,1.49 +0.57,-0.27,0.21,0.74,2.86,8.06,1.49 +0.57,-0.27,0.21,0.75,2.86,8.06,1.49 +0.57,-0.27,0.21,0.75,2.86,8.06,1.49 +0.57,-0.27,0.21,0.75,2.85,8.06,1.49 +0.57,-0.27,0.21,0.75,2.85,8.06,1.49 +0.57,-0.27,0.21,0.75,2.85,8.06,1.49 +0.57,-0.27,0.21,0.75,2.84,8.06,1.49 +0.57,-0.27,0.21,0.75,2.84,8.06,1.50 +0.57,-0.27,0.21,0.75,2.83,8.06,1.50 +0.57,-0.27,0.21,0.75,2.83,8.06,1.50 +0.57,-0.27,0.21,0.75,2.83,8.06,1.50 +0.57,-0.28,0.21,0.75,2.82,8.06,1.50 +0.56,-0.28,0.21,0.75,2.82,8.06,1.50 +0.56,-0.28,0.21,0.75,2.82,8.06,1.50 +0.56,-0.28,0.21,0.75,2.81,8.06,1.50 +0.56,-0.28,0.21,0.75,2.81,8.06,1.50 +0.56,-0.28,0.21,0.75,2.81,8.06,1.50 +0.56,-0.28,0.21,0.75,2.80,8.06,1.50 +0.56,-0.28,0.21,0.75,2.80,8.06,1.50 +0.56,-0.28,0.21,0.75,2.80,8.06,1.51 +0.56,-0.28,0.21,0.75,2.79,8.05,1.51 +0.56,-0.28,0.21,0.75,2.79,8.05,1.51 +0.56,-0.28,0.21,0.75,2.78,8.05,1.51 +0.56,-0.28,0.21,0.75,2.78,8.05,1.51 +0.56,-0.28,0.21,0.75,2.78,8.05,1.51 +0.55,-0.28,0.21,0.76,2.77,8.05,1.51 +0.55,-0.28,0.21,0.76,2.77,8.05,1.51 +0.55,-0.28,0.21,0.76,2.77,8.05,1.51 +0.55,-0.28,0.21,0.76,2.76,8.05,1.51 +0.55,-0.28,0.21,0.76,2.76,8.05,1.51 +0.55,-0.28,0.21,0.76,2.76,8.05,1.51 +0.55,-0.28,0.21,0.76,2.75,8.05,1.52 +0.55,-0.28,0.21,0.76,2.75,8.05,1.52 +0.55,-0.29,0.21,0.76,2.74,8.05,1.52 +0.55,-0.29,0.21,0.76,2.74,8.05,1.52 +0.55,-0.29,0.21,0.76,2.74,8.05,1.52 +0.55,-0.29,0.21,0.76,2.73,8.05,1.52 +0.55,-0.29,0.21,0.76,2.73,8.05,1.52 +0.54,-0.29,0.21,0.76,2.73,8.05,1.52 +0.54,-0.29,0.21,0.76,2.72,8.04,1.52 +0.54,-0.29,0.21,0.76,2.72,8.04,1.52 +0.54,-0.29,0.21,0.76,2.72,8.04,1.52 +0.54,-0.29,0.21,0.76,2.71,8.04,1.52 +0.54,-0.29,0.21,0.76,2.71,8.04,1.52 +0.54,-0.29,0.21,0.76,2.70,8.04,1.53 +0.54,-0.29,0.21,0.76,2.70,8.04,1.53 +0.54,-0.29,0.21,0.76,2.70,8.04,1.53 +0.54,-0.29,0.21,0.76,2.69,8.04,1.53 +0.54,-0.29,0.21,0.76,2.69,8.04,1.53 +0.54,-0.29,0.21,0.76,2.69,8.04,1.53 +0.54,-0.29,0.21,0.77,2.68,8.04,1.53 +0.53,-0.29,0.20,0.77,2.68,8.04,1.53 +0.53,-0.29,0.20,0.77,2.68,8.04,1.53 +0.53,-0.29,0.20,0.77,2.67,8.04,1.53 +0.53,-0.29,0.20,0.77,2.67,8.04,1.53 +0.53,-0.30,0.20,0.77,2.66,8.03,1.53 +0.53,-0.30,0.20,0.77,2.66,8.03,1.53 +0.53,-0.30,0.20,0.77,2.66,8.03,1.54 +0.53,-0.30,0.20,0.77,2.65,8.03,1.54 +0.53,-0.30,0.20,0.77,2.65,8.03,1.54 +0.53,-0.30,0.20,0.77,2.65,8.03,1.54 +0.53,-0.30,0.20,0.77,2.64,8.03,1.54 +0.53,-0.30,0.20,0.77,2.64,8.03,1.54 +0.53,-0.30,0.20,0.77,2.64,8.03,1.54 +0.52,-0.30,0.20,0.77,2.63,8.03,1.54 +0.52,-0.30,0.20,0.77,2.63,8.03,1.54 +0.52,-0.30,0.20,0.77,2.62,8.03,1.54 +0.52,-0.30,0.20,0.77,2.62,8.03,1.54 +0.52,-0.30,0.20,0.77,2.62,8.03,1.54 +0.52,-0.30,0.20,0.77,2.61,8.02,1.54 +0.52,-0.30,0.20,0.77,2.61,8.02,1.55 +0.52,-0.30,0.20,0.77,2.61,8.02,1.55 +0.52,-0.30,0.20,0.77,2.60,8.02,1.55 +0.52,-0.30,0.20,0.77,2.60,8.02,1.55 +0.52,-0.30,0.20,0.77,2.59,8.02,1.55 +0.52,-0.30,0.20,0.77,2.59,8.02,1.55 +0.52,-0.30,0.20,0.77,2.59,8.02,1.55 +0.51,-0.31,0.20,0.78,2.58,8.02,1.55 +0.51,-0.31,0.20,0.78,2.58,8.02,1.55 +0.51,-0.31,0.20,0.78,2.58,8.02,1.55 +0.51,-0.31,0.20,0.78,2.57,8.02,1.55 +0.51,-0.31,0.20,0.78,2.57,8.01,1.55 +0.51,-0.31,0.20,0.78,2.57,8.01,1.55 +0.51,-0.31,0.20,0.78,2.56,8.01,1.55 +0.51,-0.31,0.20,0.78,2.56,8.01,1.56 +0.51,-0.31,0.20,0.78,2.55,8.01,1.56 +0.51,-0.31,0.20,0.78,2.55,8.01,1.56 +0.51,-0.31,0.20,0.78,2.55,8.01,1.56 +0.51,-0.31,0.20,0.78,2.54,8.01,1.56 +0.50,-0.31,0.20,0.78,2.54,8.01,1.56 +0.50,-0.31,0.20,0.78,2.54,8.01,1.56 +0.50,-0.31,0.20,0.78,2.53,8.01,1.56 +0.50,-0.31,0.20,0.78,2.53,8.01,1.56 +0.50,-0.31,0.20,0.78,2.53,8.00,1.56 +0.50,-0.31,0.20,0.78,2.52,8.00,1.56 +0.50,-0.31,0.20,0.78,2.52,8.00,1.56 +0.50,-0.31,0.20,0.78,2.51,8.00,1.56 +0.50,-0.31,0.20,0.78,2.51,8.00,1.56 +0.50,-0.31,0.20,0.78,2.51,8.00,1.57 +0.50,-0.32,0.20,0.78,2.50,8.00,1.57 +0.50,-0.32,0.20,0.78,2.50,8.00,1.57 +0.50,-0.32,0.20,0.78,2.50,8.00,1.57 +0.49,-0.32,0.20,0.78,2.49,8.00,1.57 +0.49,-0.32,0.20,0.78,2.49,8.00,1.57 +0.49,-0.32,0.20,0.78,2.49,7.99,1.57 +0.49,-0.32,0.20,0.79,2.48,7.99,1.57 +0.49,-0.32,0.20,0.79,2.48,7.99,1.57 +0.49,-0.32,0.20,0.79,2.47,7.99,1.57 +0.49,-0.32,0.20,0.79,2.47,7.99,1.57 +0.49,-0.32,0.20,0.79,2.47,7.99,1.57 +0.49,-0.32,0.20,0.79,2.46,7.99,1.57 +0.49,-0.32,0.20,0.79,2.46,7.99,1.57 +0.49,-0.32,0.20,0.79,2.46,7.99,1.58 +0.49,-0.32,0.20,0.79,2.45,7.99,1.58 +0.49,-0.32,0.20,0.79,2.45,7.98,1.58 +0.48,-0.32,0.20,0.79,2.45,7.98,1.58 +0.48,-0.32,0.20,0.79,2.44,7.98,1.58 +0.48,-0.32,0.20,0.79,2.44,7.98,1.58 +0.48,-0.32,0.20,0.79,2.43,7.98,1.58 +0.48,-0.32,0.20,0.79,2.43,7.98,1.58 +0.48,-0.33,0.20,0.79,2.43,7.98,1.58 +0.48,-0.33,0.20,0.79,2.42,7.98,1.58 +0.48,-0.33,0.20,0.79,2.42,7.98,1.58 +0.48,-0.33,0.20,0.79,2.42,7.98,1.58 +0.48,-0.33,0.20,0.79,2.41,7.97,1.58 +0.48,-0.33,0.20,0.79,2.41,7.97,1.58 +0.48,-0.33,0.20,0.79,2.40,7.97,1.58 +0.47,-0.33,0.20,0.79,2.40,7.97,1.58 +0.47,-0.33,0.20,0.79,2.40,7.97,1.59 +0.47,-0.33,0.20,0.79,2.39,7.97,1.59 +0.47,-0.33,0.20,0.79,2.39,7.97,1.59 +0.47,-0.33,0.20,0.79,2.39,7.97,1.59 +0.47,-0.33,0.20,0.79,2.38,7.97,1.59 +0.47,-0.33,0.20,0.79,2.38,7.96,1.59 +0.47,-0.33,0.20,0.79,2.38,7.96,1.59 +0.47,-0.33,0.20,0.79,2.37,7.96,1.59 +0.47,-0.33,0.20,0.80,2.37,7.96,1.59 +0.47,-0.33,0.20,0.80,2.36,7.96,1.59 +0.47,-0.33,0.20,0.80,2.36,7.96,1.59 +0.47,-0.33,0.20,0.80,2.36,7.96,1.59 +0.46,-0.33,0.19,0.80,2.35,7.96,1.59 +0.46,-0.33,0.19,0.80,2.35,7.96,1.59 +0.46,-0.34,0.19,0.80,2.35,7.95,1.59 +0.46,-0.34,0.19,0.80,2.34,7.95,1.59 +0.46,-0.34,0.19,0.80,2.34,7.95,1.60 +0.46,-0.34,0.19,0.80,2.34,7.95,1.60 +0.46,-0.34,0.19,0.80,2.33,7.95,1.60 +0.46,-0.34,0.19,0.80,2.33,7.95,1.60 +0.46,-0.34,0.19,0.80,2.32,7.95,1.60 +0.46,-0.34,0.19,0.80,2.32,7.95,1.60 +0.46,-0.34,0.19,0.80,2.32,7.94,1.60 +0.46,-0.34,0.19,0.80,2.31,7.94,1.60 +0.46,-0.34,0.19,0.80,2.31,7.94,1.60 +0.45,-0.34,0.19,0.80,2.31,7.94,1.60 +0.45,-0.34,0.19,0.80,2.30,7.94,1.60 +0.45,-0.34,0.19,0.80,2.30,7.94,1.60 +0.45,-0.34,0.19,0.80,2.30,7.94,1.60 +0.45,-0.34,0.19,0.80,2.29,7.94,1.60 +0.45,-0.34,0.19,0.80,2.29,7.93,1.60 +0.45,-0.34,0.19,0.80,2.28,7.93,1.60 +0.45,-0.34,0.19,0.80,2.28,7.93,1.61 +0.45,-0.34,0.19,0.80,2.28,7.93,1.61 +0.45,-0.34,0.19,0.80,2.27,7.93,1.61 +0.45,-0.34,0.19,0.80,2.27,7.93,1.61 +0.45,-0.35,0.19,0.80,2.27,7.93,1.61 +0.44,-0.35,0.19,0.80,2.26,7.93,1.61 +0.44,-0.35,0.19,0.80,2.26,7.92,1.61 +0.44,-0.35,0.19,0.80,2.26,7.92,1.61 +0.44,-0.35,0.19,0.80,2.25,7.92,1.61 +0.44,-0.35,0.19,0.81,2.25,7.92,1.61 +0.44,-0.35,0.19,0.81,2.24,7.92,1.61 +0.44,-0.35,0.19,0.81,2.24,7.92,1.61 +0.44,-0.35,0.19,0.81,2.24,7.92,1.61 +0.44,-0.35,0.19,0.81,2.23,7.92,1.61 +0.44,-0.35,0.19,0.81,2.23,7.91,1.61 +0.44,-0.35,0.19,0.81,2.23,7.91,1.61 +0.44,-0.35,0.19,0.81,2.22,7.91,1.61 +0.43,-0.35,0.19,0.81,2.22,7.91,1.61 +0.43,-0.35,0.19,0.81,2.22,7.91,1.62 +0.43,-0.35,0.19,0.81,2.21,7.91,1.62 +0.43,-0.35,0.19,0.81,2.21,7.91,1.62 +0.43,-0.35,0.19,0.81,2.20,7.90,1.62 +0.43,-0.35,0.19,0.81,2.20,7.90,1.62 +0.43,-0.35,0.19,0.81,2.20,7.90,1.62 +0.43,-0.35,0.19,0.81,2.19,7.90,1.62 +0.43,-0.35,0.19,0.81,2.19,7.90,1.62 +0.43,-0.36,0.19,0.81,2.19,7.90,1.62 +0.43,-0.36,0.19,0.81,2.18,7.90,1.62 +0.43,-0.36,0.19,0.81,2.18,7.89,1.62 +0.43,-0.36,0.19,0.81,2.18,7.89,1.62 +0.42,-0.36,0.19,0.81,2.17,7.89,1.62 +0.42,-0.36,0.19,0.81,2.17,7.89,1.62 +0.42,-0.36,0.19,0.81,2.16,7.89,1.62 +0.42,-0.36,0.19,0.81,2.16,7.89,1.62 +0.42,-0.36,0.19,0.81,2.16,7.89,1.62 +0.42,-0.36,0.19,0.81,2.15,7.88,1.62 +0.42,-0.36,0.19,0.81,2.15,7.88,1.62 +0.42,-0.36,0.19,0.81,2.15,7.88,1.63 +0.42,-0.36,0.19,0.81,2.14,7.88,1.63 +0.42,-0.36,0.19,0.81,2.14,7.88,1.63 +0.42,-0.36,0.19,0.81,2.14,7.88,1.63 +0.42,-0.36,0.18,0.81,2.13,7.88,1.63 +0.41,-0.36,0.18,0.81,2.13,7.87,1.63 +0.41,-0.36,0.18,0.81,2.12,7.87,1.63 +0.41,-0.36,0.18,0.81,2.12,7.87,1.63 +0.41,-0.36,0.18,0.81,2.12,7.87,1.63 +0.41,-0.36,0.18,0.81,2.11,7.87,1.63 +0.41,-0.36,0.18,0.82,2.11,7.87,1.63 +0.41,-0.37,0.18,0.82,2.11,7.87,1.63 +0.41,-0.37,0.18,0.82,2.10,7.86,1.63 +0.41,-0.37,0.18,0.82,2.10,7.86,1.63 +0.41,-0.37,0.18,0.82,2.10,7.86,1.63 +0.41,-0.37,0.18,0.82,2.09,7.86,1.63 +0.41,-0.37,0.18,0.82,2.09,7.86,1.63 +0.41,-0.37,0.18,0.82,2.08,7.86,1.63 +0.40,-0.37,0.18,0.82,2.08,7.85,1.63 +0.40,-0.37,0.18,0.82,2.08,7.85,1.63 +0.40,-0.37,0.18,0.82,2.07,7.85,1.64 +0.40,-0.37,0.18,0.82,2.07,7.85,1.64 +0.40,-0.37,0.18,0.82,2.07,7.85,1.64 +0.40,-0.37,0.18,0.82,2.06,7.85,1.64 +0.40,-0.37,0.18,0.82,2.06,7.84,1.64 +0.40,-0.37,0.18,0.82,2.06,7.84,1.64 +0.40,-0.37,0.18,0.82,2.05,7.84,1.64 +0.40,-0.37,0.18,0.82,2.05,7.84,1.64 +0.40,-0.37,0.18,0.82,2.04,7.84,1.64 +0.40,-0.37,0.18,0.82,2.04,7.84,1.64 +0.39,-0.37,0.18,0.82,2.04,7.84,1.64 +0.39,-0.37,0.18,0.82,2.03,7.83,1.64 +0.39,-0.37,0.18,0.82,2.03,7.83,1.64 +0.39,-0.38,0.18,0.82,2.03,7.83,1.64 +0.39,-0.38,0.18,0.82,2.02,7.83,1.64 +0.39,-0.38,0.18,0.82,2.02,7.83,1.64 +0.39,-0.38,0.18,0.82,2.02,7.83,1.64 +0.39,-0.38,0.18,0.82,2.01,7.82,1.64 +0.39,-0.38,0.18,0.82,2.01,7.82,1.64 +0.39,-0.38,0.18,0.82,2.01,7.82,1.64 +0.39,-0.38,0.18,0.82,2.00,7.82,1.64 +0.39,-0.38,0.18,0.82,2.00,7.82,1.65 +0.38,-0.38,0.18,0.82,1.99,7.82,1.65 +0.38,-0.38,0.18,0.82,1.99,7.81,1.65 +0.38,-0.38,0.18,0.82,1.99,7.81,1.65 +0.38,-0.38,0.18,0.82,1.98,7.81,1.65 +0.38,-0.38,0.18,0.82,1.98,7.81,1.65 +0.38,-0.38,0.18,0.82,1.98,7.81,1.65 +0.38,-0.38,0.18,0.82,1.97,7.80,1.65 +0.38,-0.38,0.18,0.82,1.97,7.80,1.65 +0.38,-0.38,0.18,0.82,1.97,7.80,1.65 +0.38,-0.38,0.18,0.82,1.96,7.80,1.65 +0.38,-0.38,0.18,0.82,1.96,7.80,1.65 +0.38,-0.38,0.17,0.83,1.95,7.80,1.65 +0.37,-0.38,0.17,0.83,1.95,7.79,1.65 +0.37,-0.38,0.17,0.83,1.95,7.79,1.65 +0.37,-0.39,0.17,0.83,1.94,7.79,1.65 +0.37,-0.39,0.17,0.83,1.94,7.79,1.65 +0.37,-0.39,0.17,0.83,1.94,7.79,1.65 +0.37,-0.39,0.17,0.83,1.93,7.79,1.65 +0.37,-0.39,0.17,0.83,1.93,7.78,1.65 +0.37,-0.39,0.17,0.83,1.93,7.78,1.65 +0.37,-0.39,0.17,0.83,1.92,7.78,1.65 +0.37,-0.39,0.17,0.83,1.92,7.78,1.65 +0.37,-0.39,0.17,0.83,1.92,7.78,1.65 +0.37,-0.39,0.17,0.83,1.91,7.77,1.66 +0.37,-0.39,0.17,0.83,1.91,7.77,1.66 +0.36,-0.39,0.17,0.83,1.90,7.77,1.66 +0.36,-0.39,0.17,0.83,1.90,7.77,1.66 +0.36,-0.39,0.17,0.83,1.90,7.77,1.66 +0.36,-0.39,0.17,0.83,1.89,7.77,1.66 +0.36,-0.39,0.17,0.83,1.89,7.76,1.66 +0.36,-0.39,0.17,0.83,1.89,7.76,1.66 +0.36,-0.39,0.17,0.83,1.88,7.76,1.66 +0.36,-0.39,0.17,0.83,1.88,7.76,1.66 +0.36,-0.39,0.17,0.83,1.88,7.76,1.66 +0.36,-0.39,0.17,0.83,1.87,7.75,1.66 +0.36,-0.39,0.17,0.83,1.87,7.75,1.66 +0.36,-0.40,0.17,0.83,1.87,7.75,1.66 +0.35,-0.40,0.17,0.83,1.86,7.75,1.66 +0.35,-0.40,0.17,0.83,1.86,7.75,1.66 +0.35,-0.40,0.17,0.83,1.85,7.74,1.66 +0.35,-0.40,0.17,0.83,1.85,7.74,1.66 +0.35,-0.40,0.17,0.83,1.85,7.74,1.66 +0.35,-0.40,0.17,0.83,1.84,7.74,1.66 +0.35,-0.40,0.17,0.83,1.84,7.74,1.66 +0.35,-0.40,0.17,0.83,1.84,7.73,1.66 +0.35,-0.40,0.17,0.83,1.83,7.73,1.66 +0.35,-0.40,0.17,0.83,1.83,7.73,1.66 +0.35,-0.40,0.17,0.83,1.83,7.73,1.66 +0.35,-0.40,0.17,0.83,1.82,7.73,1.66 +0.34,-0.40,0.17,0.83,1.82,7.72,1.66 +0.34,-0.40,0.17,0.83,1.82,7.72,1.67 +0.34,-0.40,0.17,0.83,1.81,7.72,1.67 +0.34,-0.40,0.17,0.83,1.81,7.72,1.67 +0.34,-0.40,0.16,0.83,1.81,7.72,1.67 +0.34,-0.40,0.16,0.83,1.80,7.71,1.67 +0.34,-0.40,0.16,0.83,1.80,7.71,1.67 +0.34,-0.40,0.16,0.83,1.79,7.71,1.67 +0.34,-0.40,0.16,0.83,1.79,7.71,1.67 +0.34,-0.40,0.16,0.83,1.79,7.71,1.67 +0.34,-0.41,0.16,0.83,1.78,7.70,1.67 +0.34,-0.41,0.16,0.83,1.78,7.70,1.67 +0.33,-0.41,0.16,0.83,1.78,7.70,1.67 +0.33,-0.41,0.16,0.83,1.77,7.70,1.67 +0.33,-0.41,0.16,0.83,1.77,7.70,1.67 +0.33,-0.41,0.16,0.83,1.77,7.69,1.67 +0.33,-0.41,0.16,0.84,1.76,7.69,1.67 +0.33,-0.41,0.16,0.84,1.76,7.69,1.67 +0.33,-0.41,0.16,0.84,1.76,7.69,1.67 +0.33,-0.41,0.16,0.84,1.75,7.69,1.67 +0.33,-0.41,0.16,0.84,1.75,7.68,1.67 +0.33,-0.41,0.16,0.84,1.75,7.68,1.67 +0.33,-0.41,0.16,0.84,1.74,7.68,1.67 +0.33,-0.41,0.16,0.84,1.74,7.68,1.67 +0.32,-0.41,0.16,0.84,1.73,7.68,1.67 +0.32,-0.41,0.16,0.84,1.73,7.67,1.67 +0.32,-0.41,0.16,0.84,1.73,7.67,1.67 +0.32,-0.41,0.16,0.84,1.72,7.67,1.67 +0.32,-0.41,0.16,0.84,1.72,7.67,1.67 +0.32,-0.41,0.16,0.84,1.72,7.67,1.67 +0.32,-0.41,0.16,0.84,1.71,7.66,1.67 +0.32,-0.41,0.16,0.84,1.71,7.66,1.67 +0.32,-0.42,0.16,0.84,1.71,7.66,1.68 +0.32,-0.42,0.16,0.84,1.70,7.66,1.68 +0.32,-0.42,0.16,0.84,1.70,7.65,1.68 +0.32,-0.42,0.16,0.84,1.70,7.65,1.68 +0.31,-0.42,0.16,0.84,1.69,7.65,1.68 +0.31,-0.42,0.16,0.84,1.69,7.65,1.68 +0.31,-0.42,0.16,0.84,1.69,7.65,1.68 +0.31,-0.42,0.16,0.84,1.68,7.64,1.68 +0.31,-0.42,0.16,0.84,1.68,7.64,1.68 +0.31,-0.42,0.16,0.84,1.68,7.64,1.68 +0.31,-0.42,0.15,0.84,1.67,7.64,1.68 +0.31,-0.42,0.15,0.84,1.67,7.63,1.68 +0.31,-0.42,0.15,0.84,1.66,7.63,1.68 +0.31,-0.42,0.15,0.84,1.66,7.63,1.68 +0.31,-0.42,0.15,0.84,1.66,7.63,1.68 +0.31,-0.42,0.15,0.84,1.65,7.63,1.68 +0.31,-0.42,0.15,0.84,1.65,7.62,1.68 +0.30,-0.42,0.15,0.84,1.65,7.62,1.68 +0.30,-0.42,0.15,0.84,1.64,7.62,1.68 +0.30,-0.42,0.15,0.84,1.64,7.62,1.68 +0.30,-0.42,0.15,0.84,1.64,7.61,1.68 +0.30,-0.42,0.15,0.84,1.63,7.61,1.68 +0.30,-0.42,0.15,0.84,1.63,7.61,1.68 +0.30,-0.43,0.15,0.84,1.63,7.61,1.68 +0.30,-0.43,0.15,0.84,1.62,7.61,1.68 +0.30,-0.43,0.15,0.84,1.62,7.60,1.68 +0.30,-0.43,0.15,0.84,1.62,7.60,1.68 +0.30,-0.43,0.15,0.84,1.61,7.60,1.68 +0.30,-0.43,0.15,0.84,1.61,7.60,1.68 +0.29,-0.43,0.15,0.84,1.61,7.59,1.68 +0.29,-0.43,0.15,0.84,1.60,7.59,1.68 +0.29,-0.43,0.15,0.84,1.60,7.59,1.68 +0.29,-0.43,0.15,0.84,1.60,7.59,1.68 +0.29,-0.43,0.15,0.84,1.59,7.58,1.68 +0.29,-0.43,0.15,0.84,1.59,7.58,1.68 +0.29,-0.43,0.15,0.84,1.59,7.58,1.68 +0.29,-0.43,0.15,0.84,1.58,7.58,1.68 +0.29,-0.43,0.15,0.84,1.58,7.58,1.68 +0.29,-0.43,0.15,0.84,1.58,7.57,1.69 +0.29,-0.43,0.15,0.84,1.57,7.57,1.69 +0.29,-0.43,0.15,0.84,1.57,7.57,1.69 +0.28,-0.43,0.15,0.84,1.56,7.57,1.69 +0.28,-0.43,0.15,0.84,1.56,7.56,1.69 +0.28,-0.43,0.15,0.84,1.56,7.56,1.69 +0.28,-0.43,0.15,0.84,1.55,7.56,1.69 +0.28,-0.43,0.14,0.84,1.55,7.56,1.69 +0.28,-0.43,0.14,0.84,1.55,7.55,1.69 +0.28,-0.44,0.14,0.84,1.54,7.55,1.69 +0.28,-0.44,0.14,0.84,1.54,7.55,1.69 +0.28,-0.44,0.14,0.84,1.54,7.55,1.69 +0.28,-0.44,0.14,0.84,1.53,7.54,1.69 +0.28,-0.44,0.14,0.84,1.53,7.54,1.69 +0.28,-0.44,0.14,0.84,1.53,7.54,1.69 +0.27,-0.44,0.14,0.84,1.52,7.54,1.69 +0.27,-0.44,0.14,0.84,1.52,7.53,1.69 +0.27,-0.44,0.14,0.84,1.52,7.53,1.69 +0.27,-0.44,0.14,0.84,1.51,7.53,1.69 +0.27,-0.44,0.14,0.84,1.51,7.53,1.69 +0.27,-0.44,0.14,0.84,1.51,7.52,1.69 +0.27,-0.44,0.14,0.84,1.50,7.52,1.69 +0.27,-0.44,0.14,0.84,1.50,7.52,1.69 +0.27,-0.44,0.14,0.84,1.50,7.52,1.69 +0.27,-0.44,0.14,0.84,1.49,7.51,1.69 +0.27,-0.44,0.14,0.85,1.49,7.51,1.69 +0.27,-0.44,0.14,0.85,1.49,7.51,1.69 +0.26,-0.44,0.14,0.85,1.48,7.51,1.69 +0.26,-0.44,0.14,0.85,1.48,7.50,1.69 +0.26,-0.44,0.14,0.85,1.48,7.50,1.69 +0.26,-0.44,0.14,0.85,1.47,7.50,1.69 +0.26,-0.44,0.14,0.85,1.47,7.50,1.69 +0.26,-0.45,0.14,0.85,1.47,7.49,1.69 +0.26,-0.45,0.14,0.85,1.46,7.49,1.69 +0.26,-0.45,0.14,0.85,1.46,7.49,1.69 +0.26,-0.45,0.14,0.85,1.46,7.49,1.69 +0.26,-0.45,0.14,0.85,1.45,7.48,1.69 +0.26,-0.45,0.14,0.85,1.45,7.48,1.69 +0.26,-0.45,0.14,0.85,1.45,7.48,1.69 +0.25,-0.45,0.13,0.85,1.44,7.48,1.69 +0.25,-0.45,0.13,0.85,1.44,7.47,1.69 +0.25,-0.45,0.13,0.85,1.44,7.47,1.69 +0.25,-0.45,0.13,0.85,1.43,7.47,1.69 +0.25,-0.45,0.13,0.85,1.43,7.47,1.69 +0.25,-0.45,0.13,0.85,1.43,7.46,1.69 +0.25,-0.45,0.13,0.85,1.42,7.46,1.69 +0.25,-0.45,0.13,0.85,1.42,7.46,1.69 +0.25,-0.45,0.13,0.85,1.42,7.46,1.69 +0.25,-0.45,0.13,0.85,1.41,7.45,1.69 +0.25,-0.45,0.13,0.85,1.41,7.45,1.69 +0.25,-0.45,0.13,0.85,1.41,7.45,1.69 +0.25,-0.45,0.13,0.85,1.40,7.45,1.69 +0.24,-0.45,0.13,0.85,1.40,7.44,1.69 +0.24,-0.45,0.13,0.85,1.40,7.44,1.69 +0.24,-0.45,0.13,0.85,1.39,7.44,1.69 +0.24,-0.45,0.13,0.85,1.39,7.43,1.69 +0.24,-0.46,0.13,0.85,1.39,7.43,1.69 +0.24,-0.46,0.13,0.85,1.38,7.43,1.69 +0.24,-0.46,0.13,0.85,1.38,7.43,1.70 +0.24,-0.46,0.13,0.85,1.38,7.42,1.70 +0.24,-0.46,0.13,0.85,1.37,7.42,1.70 +0.24,-0.46,0.13,0.85,1.37,7.42,1.70 +0.24,-0.46,0.13,0.85,1.37,7.42,1.70 +0.24,-0.46,0.13,0.85,1.36,7.41,1.70 +0.23,-0.46,0.13,0.85,1.36,7.41,1.70 +0.23,-0.46,0.13,0.85,1.36,7.41,1.70 +0.23,-0.46,0.13,0.85,1.35,7.41,1.70 +0.23,-0.46,0.13,0.85,1.35,7.40,1.70 +0.23,-0.46,0.13,0.85,1.35,7.40,1.70 +0.23,-0.46,0.13,0.85,1.34,7.40,1.70 +0.23,-0.46,0.12,0.85,1.34,7.39,1.70 +0.23,-0.46,0.12,0.85,1.34,7.39,1.70 +0.23,-0.46,0.12,0.85,1.33,7.39,1.70 +0.23,-0.46,0.12,0.85,1.33,7.39,1.70 +0.23,-0.46,0.12,0.85,1.33,7.38,1.70 +0.23,-0.46,0.12,0.85,1.32,7.38,1.70 +0.22,-0.46,0.12,0.85,1.32,7.38,1.70 +0.22,-0.46,0.12,0.85,1.32,7.38,1.70 +0.22,-0.46,0.12,0.85,1.31,7.37,1.70 +0.22,-0.46,0.12,0.85,1.31,7.37,1.70 +0.22,-0.46,0.12,0.85,1.31,7.37,1.70 +0.22,-0.47,0.12,0.85,1.30,7.36,1.70 +0.22,-0.47,0.12,0.85,1.30,7.36,1.70 +0.22,-0.47,0.12,0.85,1.30,7.36,1.70 +0.22,-0.47,0.12,0.85,1.29,7.36,1.70 +0.22,-0.47,0.12,0.85,1.29,7.35,1.70 +0.22,-0.47,0.12,0.85,1.29,7.35,1.70 +0.22,-0.47,0.12,0.85,1.28,7.35,1.70 +0.21,-0.47,0.12,0.85,1.28,7.34,1.70 +0.21,-0.47,0.12,0.85,1.28,7.34,1.70 +0.21,-0.47,0.12,0.85,1.27,7.34,1.70 +0.21,-0.47,0.12,0.85,1.27,7.34,1.70 +0.21,-0.47,0.12,0.85,1.27,7.33,1.70 +0.21,-0.47,0.12,0.85,1.27,7.33,1.70 +0.21,-0.47,0.12,0.85,1.26,7.33,1.70 +0.21,-0.47,0.12,0.85,1.26,7.32,1.70 +0.21,-0.47,0.12,0.85,1.26,7.32,1.70 +0.21,-0.47,0.12,0.85,1.25,7.32,1.70 +0.21,-0.47,0.11,0.85,1.25,7.32,1.70 +0.21,-0.47,0.11,0.85,1.25,7.31,1.70 +0.20,-0.47,0.11,0.85,1.24,7.31,1.70 +0.20,-0.47,0.11,0.85,1.24,7.31,1.70 +0.20,-0.47,0.11,0.85,1.24,7.30,1.70 +0.20,-0.47,0.11,0.85,1.23,7.30,1.70 +0.20,-0.47,0.11,0.85,1.23,7.30,1.70 +0.20,-0.48,0.11,0.85,1.23,7.30,1.70 +0.20,-0.48,0.11,0.85,1.22,7.29,1.70 +0.20,-0.48,0.11,0.85,1.22,7.29,1.70 +0.20,-0.48,0.11,0.85,1.22,7.29,1.70 +0.20,-0.48,0.11,0.85,1.21,7.28,1.70 +0.20,-0.48,0.11,0.85,1.21,7.28,1.70 +0.20,-0.48,0.11,0.85,1.21,7.28,1.70 +0.20,-0.48,0.11,0.85,1.20,7.27,1.70 +0.19,-0.48,0.11,0.85,1.20,7.27,1.70 +0.19,-0.48,0.11,0.85,1.20,7.27,1.70 +0.19,-0.48,0.11,0.85,1.19,7.27,1.70 +0.19,-0.48,0.11,0.85,1.19,7.26,1.70 +0.19,-0.48,0.11,0.85,1.19,7.26,1.70 +0.19,-0.48,0.11,0.85,1.19,7.26,1.70 +0.19,-0.48,0.11,0.85,1.18,7.25,1.70 +0.19,-0.48,0.11,0.85,1.18,7.25,1.70 +0.19,-0.48,0.11,0.85,1.18,7.25,1.70 +0.19,-0.48,0.11,0.85,1.17,7.24,1.70 +0.19,-0.48,0.11,0.85,1.17,7.24,1.70 +0.19,-0.48,0.11,0.85,1.17,7.24,1.70 +0.18,-0.48,0.10,0.85,1.16,7.24,1.70 +0.18,-0.48,0.10,0.85,1.16,7.23,1.70 +0.18,-0.48,0.10,0.85,1.16,7.23,1.70 +0.18,-0.48,0.10,0.85,1.15,7.23,1.70 +0.18,-0.48,0.10,0.85,1.15,7.22,1.70 +0.18,-0.48,0.10,0.85,1.15,7.22,1.70 +0.18,-0.49,0.10,0.85,1.14,7.22,1.70 +0.18,-0.49,0.10,0.85,1.14,7.21,1.70 +0.18,-0.49,0.10,0.85,1.14,7.21,1.70 +0.18,-0.49,0.10,0.85,1.14,7.21,1.70 +0.18,-0.49,0.10,0.85,1.13,7.21,1.70 +0.18,-0.49,0.10,0.85,1.13,7.20,1.70 +0.17,-0.49,0.10,0.85,1.13,7.20,1.70 +0.17,-0.49,0.10,0.85,1.12,7.20,1.70 +0.17,-0.49,0.10,0.85,1.12,7.19,1.70 +0.17,-0.49,0.10,0.85,1.12,7.19,1.70 +0.17,-0.49,0.10,0.85,1.11,7.19,1.70 +0.17,-0.49,0.10,0.85,1.11,7.18,1.70 +0.17,-0.49,0.10,0.85,1.11,7.18,1.70 +0.17,-0.49,0.10,0.85,1.10,7.18,1.70 +0.17,-0.49,0.10,0.85,1.10,7.17,1.70 +0.17,-0.49,0.10,0.85,1.10,7.17,1.70 +0.17,-0.49,0.10,0.85,1.09,7.17,1.70 +0.17,-0.49,0.10,0.85,1.09,7.16,1.70 +0.16,-0.49,0.10,0.85,1.09,7.16,1.70 +0.16,-0.49,0.10,0.85,1.09,7.16,1.70 +0.16,-0.49,0.09,0.85,1.08,7.16,1.70 +0.16,-0.49,0.09,0.85,1.08,7.15,1.70 +0.16,-0.49,0.09,0.85,1.08,7.15,1.70 +0.16,-0.49,0.09,0.85,1.07,7.15,1.70 +0.16,-0.49,0.09,0.85,1.07,7.14,1.70 +0.16,-0.49,0.09,0.85,1.07,7.14,1.70 +0.16,-0.50,0.09,0.85,1.06,7.14,1.70 +0.16,-0.50,0.09,0.85,1.06,7.13,1.70 +0.16,-0.50,0.09,0.85,1.06,7.13,1.70 +0.16,-0.50,0.09,0.85,1.06,7.13,1.70 +0.16,-0.50,0.09,0.85,1.05,7.12,1.70 +0.15,-0.50,0.09,0.85,1.05,7.12,1.70 +0.15,-0.50,0.09,0.85,1.05,7.12,1.70 +0.15,-0.50,0.09,0.85,1.04,7.11,1.70 +0.15,-0.50,0.09,0.85,1.04,7.11,1.70 +0.15,-0.50,0.09,0.85,1.04,7.11,1.70 +0.15,-0.50,0.09,0.85,1.03,7.10,1.70 +0.15,-0.50,0.09,0.85,1.03,7.10,1.70 +0.15,-0.50,0.09,0.85,1.03,7.10,1.70 +0.15,-0.50,0.09,0.85,1.02,7.09,1.70 +0.15,-0.50,0.09,0.85,1.02,7.09,1.70 +0.15,-0.50,0.09,0.85,1.02,7.09,1.70 +0.15,-0.50,0.09,0.85,1.02,7.08,1.70 +0.14,-0.50,0.09,0.85,1.01,7.08,1.70 +0.14,-0.50,0.09,0.85,1.01,7.08,1.70 +0.14,-0.50,0.08,0.85,1.01,7.07,1.70 +0.14,-0.50,0.08,0.85,1.00,7.07,1.70 +0.14,-0.50,0.08,0.85,1.00,7.07,1.70 +0.14,-0.50,0.08,0.85,1.00,7.07,1.70 +0.14,-0.50,0.08,0.85,0.99,7.06,1.70 +0.14,-0.50,0.08,0.85,0.99,7.06,1.70 +0.14,-0.50,0.08,0.85,0.99,7.06,1.70 +0.14,-0.51,0.08,0.85,0.99,7.05,1.70 +0.14,-0.51,0.08,0.85,0.98,7.05,1.70 +0.14,-0.51,0.08,0.85,0.98,7.05,1.70 +0.13,-0.51,0.08,0.85,0.98,7.04,1.70 +0.13,-0.51,0.08,0.85,0.97,7.04,1.70 +0.13,-0.51,0.08,0.85,0.97,7.04,1.70 +0.13,-0.51,0.08,0.85,0.97,7.03,1.70 +0.13,-0.51,0.08,0.85,0.97,7.03,1.70 +0.13,-0.51,0.08,0.85,0.96,7.03,1.70 +0.13,-0.51,0.08,0.85,0.96,7.02,1.70 +0.13,-0.51,0.08,0.85,0.96,7.02,1.70 +0.13,-0.51,0.08,0.85,0.95,7.02,1.69 +0.13,-0.51,0.08,0.85,0.95,7.01,1.69 +0.13,-0.51,0.08,0.85,0.95,7.01,1.69 +0.13,-0.51,0.08,0.85,0.94,7.00,1.69 +0.13,-0.51,0.08,0.85,0.94,7.00,1.69 +0.12,-0.51,0.08,0.85,0.94,7.00,1.69 +0.12,-0.51,0.07,0.85,0.94,6.99,1.69 +0.12,-0.51,0.07,0.85,0.93,6.99,1.69 +0.12,-0.51,0.07,0.85,0.93,6.99,1.69 +0.12,-0.51,0.07,0.85,0.93,6.98,1.69 +0.12,-0.51,0.07,0.85,0.92,6.98,1.69 +0.12,-0.51,0.07,0.85,0.92,6.98,1.69 +0.12,-0.51,0.07,0.85,0.92,6.97,1.69 +0.12,-0.51,0.07,0.85,0.92,6.97,1.69 +0.12,-0.51,0.07,0.85,0.91,6.97,1.69 +0.12,-0.51,0.07,0.85,0.91,6.96,1.69 +0.12,-0.52,0.07,0.85,0.91,6.96,1.69 +0.11,-0.52,0.07,0.85,0.90,6.96,1.69 +0.11,-0.52,0.07,0.85,0.90,6.95,1.69 +0.11,-0.52,0.07,0.85,0.90,6.95,1.69 +0.11,-0.52,0.07,0.85,0.90,6.95,1.69 +0.11,-0.52,0.07,0.85,0.89,6.94,1.69 +0.11,-0.52,0.07,0.85,0.89,6.94,1.69 +0.11,-0.52,0.07,0.85,0.89,6.94,1.69 +0.11,-0.52,0.07,0.85,0.88,6.93,1.69 +0.11,-0.52,0.07,0.85,0.88,6.93,1.69 +0.11,-0.52,0.07,0.85,0.88,6.93,1.69 +0.11,-0.52,0.07,0.85,0.88,6.92,1.69 +0.11,-0.52,0.07,0.85,0.87,6.92,1.69 +0.11,-0.52,0.06,0.85,0.87,6.92,1.69 +0.10,-0.52,0.06,0.85,0.87,6.91,1.69 +0.10,-0.52,0.06,0.85,0.86,6.91,1.69 +0.10,-0.52,0.06,0.85,0.86,6.90,1.69 +0.10,-0.52,0.06,0.85,0.86,6.90,1.69 +0.10,-0.52,0.06,0.84,0.86,6.90,1.69 +0.10,-0.52,0.06,0.84,0.85,6.89,1.69 +0.10,-0.52,0.06,0.84,0.85,6.89,1.69 +0.10,-0.52,0.06,0.84,0.85,6.89,1.69 +0.10,-0.52,0.06,0.84,0.84,6.88,1.69 +0.10,-0.52,0.06,0.84,0.84,6.88,1.69 +0.10,-0.52,0.06,0.84,0.84,6.88,1.69 +0.10,-0.52,0.06,0.84,0.84,6.87,1.69 +0.09,-0.52,0.06,0.84,0.83,6.87,1.69 +0.09,-0.52,0.06,0.84,0.83,6.87,1.69 +0.09,-0.52,0.06,0.84,0.83,6.86,1.69 +0.09,-0.53,0.06,0.84,0.82,6.86,1.69 +0.09,-0.53,0.06,0.84,0.82,6.85,1.69 +0.09,-0.53,0.06,0.84,0.82,6.85,1.69 +0.09,-0.53,0.06,0.84,0.82,6.85,1.69 +0.09,-0.53,0.06,0.84,0.81,6.84,1.69 +0.09,-0.53,0.06,0.84,0.81,6.84,1.69 +0.09,-0.53,0.05,0.84,0.81,6.84,1.69 +0.09,-0.53,0.05,0.84,0.81,6.83,1.69 +0.09,-0.53,0.05,0.84,0.80,6.83,1.69 +0.09,-0.53,0.05,0.84,0.80,6.83,1.69 +0.08,-0.53,0.05,0.84,0.80,6.82,1.69 +0.08,-0.53,0.05,0.84,0.79,6.82,1.69 +0.08,-0.53,0.05,0.84,0.79,6.81,1.69 +0.08,-0.53,0.05,0.84,0.79,6.81,1.69 +0.08,-0.53,0.05,0.84,0.79,6.81,1.68 +0.08,-0.53,0.05,0.84,0.78,6.80,1.68 +0.08,-0.53,0.05,0.84,0.78,6.80,1.68 +0.08,-0.53,0.05,0.84,0.78,6.80,1.68 +0.08,-0.53,0.05,0.84,0.78,6.79,1.68 +0.08,-0.53,0.05,0.84,0.77,6.79,1.68 +0.08,-0.53,0.05,0.84,0.77,6.79,1.68 +0.08,-0.53,0.05,0.84,0.77,6.78,1.68 +0.08,-0.53,0.05,0.84,0.76,6.78,1.68 +0.07,-0.53,0.05,0.84,0.76,6.77,1.68 +0.07,-0.53,0.05,0.84,0.76,6.77,1.68 +0.07,-0.53,0.05,0.84,0.76,6.77,1.68 +0.07,-0.53,0.05,0.84,0.75,6.76,1.68 +0.07,-0.53,0.05,0.84,0.75,6.76,1.68 +0.07,-0.53,0.04,0.84,0.75,6.76,1.68 +0.07,-0.54,0.04,0.84,0.75,6.75,1.68 +0.07,-0.54,0.04,0.84,0.74,6.75,1.68 +0.07,-0.54,0.04,0.84,0.74,6.74,1.68 +0.07,-0.54,0.04,0.84,0.74,6.74,1.68 +0.07,-0.54,0.04,0.84,0.74,6.74,1.68 +0.07,-0.54,0.04,0.84,0.73,6.73,1.68 +0.06,-0.54,0.04,0.84,0.73,6.73,1.68 +0.06,-0.54,0.04,0.84,0.73,6.73,1.68 +0.06,-0.54,0.04,0.84,0.72,6.72,1.68 +0.06,-0.54,0.04,0.84,0.72,6.72,1.68 +0.06,-0.54,0.04,0.84,0.72,6.71,1.68 +0.06,-0.54,0.04,0.84,0.72,6.71,1.68 +0.06,-0.54,0.04,0.84,0.71,6.71,1.68 +0.06,-0.54,0.04,0.84,0.71,6.70,1.68 +0.06,-0.54,0.04,0.84,0.71,6.70,1.68 +0.06,-0.54,0.04,0.84,0.71,6.70,1.68 +0.06,-0.54,0.04,0.84,0.70,6.69,1.68 +0.06,-0.54,0.04,0.84,0.70,6.69,1.68 +0.06,-0.54,0.04,0.84,0.70,6.68,1.68 +0.05,-0.54,0.04,0.84,0.70,6.68,1.68 +0.05,-0.54,0.03,0.84,0.69,6.68,1.68 +0.05,-0.54,0.03,0.84,0.69,6.67,1.68 +0.05,-0.54,0.03,0.84,0.69,6.67,1.68 +0.05,-0.54,0.03,0.84,0.69,6.67,1.68 +0.05,-0.54,0.03,0.84,0.68,6.66,1.68 +0.05,-0.54,0.03,0.84,0.68,6.66,1.67 +0.05,-0.54,0.03,0.84,0.68,6.65,1.67 +0.05,-0.54,0.03,0.84,0.68,6.65,1.67 +0.05,-0.54,0.03,0.84,0.67,6.65,1.67 +0.05,-0.54,0.03,0.84,0.67,6.64,1.67 +0.05,-0.54,0.03,0.84,0.67,6.64,1.67 +0.05,-0.55,0.03,0.84,0.66,6.63,1.67 +0.04,-0.55,0.03,0.84,0.66,6.63,1.67 +0.04,-0.55,0.03,0.84,0.66,6.63,1.67 +0.04,-0.55,0.03,0.84,0.66,6.62,1.67 +0.04,-0.55,0.03,0.84,0.65,6.62,1.67 +0.04,-0.55,0.03,0.84,0.65,6.61,1.67 +0.04,-0.55,0.03,0.84,0.65,6.61,1.67 +0.04,-0.55,0.03,0.84,0.65,6.61,1.67 +0.04,-0.55,0.03,0.84,0.64,6.60,1.67 +0.04,-0.55,0.03,0.84,0.64,6.60,1.67 +0.04,-0.55,0.02,0.83,0.64,6.60,1.67 +0.04,-0.55,0.02,0.83,0.64,6.59,1.67 +0.04,-0.55,0.02,0.83,0.63,6.59,1.67 +0.04,-0.55,0.02,0.83,0.63,6.58,1.67 +0.03,-0.55,0.02,0.83,0.63,6.58,1.67 +0.03,-0.55,0.02,0.83,0.63,6.58,1.67 +0.03,-0.55,0.02,0.83,0.62,6.57,1.67 +0.03,-0.55,0.02,0.83,0.62,6.57,1.67 +0.03,-0.55,0.02,0.83,0.62,6.56,1.67 +0.03,-0.55,0.02,0.83,0.62,6.56,1.67 +0.03,-0.55,0.02,0.83,0.61,6.56,1.67 +0.03,-0.55,0.02,0.83,0.61,6.55,1.67 +0.03,-0.55,0.02,0.83,0.61,6.55,1.67 +0.03,-0.55,0.02,0.83,0.61,6.54,1.67 +0.03,-0.55,0.02,0.83,0.60,6.54,1.67 +0.03,-0.55,0.02,0.83,0.60,6.54,1.67 +0.03,-0.55,0.02,0.83,0.60,6.53,1.66 +0.02,-0.55,0.02,0.83,0.60,6.53,1.66 +0.02,-0.55,0.02,0.83,0.59,6.52,1.66 +0.02,-0.55,0.02,0.83,0.59,6.52,1.66 +0.02,-0.55,0.01,0.83,0.59,6.52,1.66 +0.02,-0.55,0.01,0.83,0.59,6.51,1.66 +0.02,-0.56,0.01,0.83,0.59,6.51,1.66 +0.02,-0.56,0.01,0.83,0.58,6.50,1.66 +0.02,-0.56,0.01,0.83,0.58,6.50,1.66 +0.02,-0.56,0.01,0.83,0.58,6.50,1.66 +0.02,-0.56,0.01,0.83,0.58,6.49,1.66 +0.02,-0.56,0.01,0.83,0.57,6.49,1.66 +0.02,-0.56,0.01,0.83,0.57,6.48,1.66 +0.02,-0.56,0.01,0.83,0.57,6.48,1.66 +0.01,-0.56,0.01,0.83,0.57,6.48,1.66 +0.01,-0.56,0.01,0.83,0.56,6.47,1.66 +0.01,-0.56,0.01,0.83,0.56,6.47,1.66 +0.01,-0.56,0.01,0.83,0.56,6.46,1.66 +0.01,-0.56,0.01,0.83,0.56,6.46,1.66 +0.01,-0.56,0.01,0.83,0.55,6.46,1.66 +0.01,-0.56,0.01,0.83,0.55,6.45,1.66 +0.01,-0.56,0.01,0.83,0.55,6.45,1.66 +0.01,-0.56,0.01,0.83,0.55,6.44,1.66 +0.01,-0.56,0.01,0.83,0.54,6.44,1.66 +0.01,-0.56,0.00,0.83,0.54,6.44,1.66 +0.01,-0.56,0.00,0.83,0.54,6.43,1.66 +0.01,-0.56,0.00,0.83,0.54,6.43,1.66 +0.00,-0.56,0.00,0.83,0.54,6.42,1.65 +0.00,-0.56,0.00,0.83,0.53,6.42,1.65 +0.00,-0.56,0.00,0.83,0.53,6.41,1.65 +0.00,-0.56,0.00,0.83,0.53,6.41,1.65 +0.00,-0.56,0.00,0.83,0.53,6.41,1.65 +0.00,-0.56,0.00,0.83,0.52,6.40,1.65 +0.00,-0.56,0.00,0.83,0.52,6.40,1.65 +-0.00,-0.56,-0.00,0.83,0.52,6.39,1.65 +-0.00,-0.56,-0.00,0.83,0.52,6.39,1.65 +-0.00,-0.56,-0.00,0.83,0.51,6.39,1.65 +-0.00,-0.56,-0.00,0.83,0.51,6.38,1.65 +-0.00,-0.56,-0.00,0.83,0.51,6.38,1.65 +-0.00,-0.56,-0.00,0.83,0.51,6.37,1.65 +-0.01,-0.57,-0.00,0.82,0.51,6.37,1.65 +-0.01,-0.57,-0.00,0.82,0.50,6.37,1.65 +-0.01,-0.57,-0.00,0.82,0.50,6.36,1.65 +-0.01,-0.57,-0.01,0.82,0.50,6.36,1.65 +-0.01,-0.57,-0.01,0.82,0.50,6.35,1.65 +-0.01,-0.57,-0.01,0.82,0.49,6.35,1.65 +-0.01,-0.57,-0.01,0.82,0.49,6.34,1.65 +-0.01,-0.57,-0.01,0.82,0.49,6.34,1.65 +-0.01,-0.57,-0.01,0.82,0.49,6.34,1.65 +-0.01,-0.57,-0.01,0.82,0.48,6.33,1.65 +-0.01,-0.57,-0.01,0.82,0.48,6.33,1.65 +-0.01,-0.57,-0.01,0.82,0.48,6.32,1.65 +-0.01,-0.57,-0.01,0.82,0.48,6.32,1.64 +-0.01,-0.57,-0.01,0.82,0.48,6.31,1.64 +-0.02,-0.57,-0.01,0.82,0.47,6.31,1.64 +-0.02,-0.57,-0.01,0.82,0.47,6.31,1.64 +-0.02,-0.57,-0.01,0.82,0.47,6.30,1.64 +-0.02,-0.57,-0.01,0.82,0.47,6.30,1.64 +-0.02,-0.57,-0.01,0.82,0.46,6.29,1.64 +-0.02,-0.57,-0.01,0.82,0.46,6.29,1.64 +-0.02,-0.57,-0.01,0.82,0.46,6.29,1.64 +-0.02,-0.57,-0.01,0.82,0.46,6.28,1.64 +-0.02,-0.57,-0.02,0.82,0.46,6.28,1.64 +-0.02,-0.57,-0.02,0.82,0.45,6.27,1.64 +-0.02,-0.57,-0.02,0.82,0.45,6.27,1.64 +-0.02,-0.57,-0.02,0.82,0.45,6.26,1.64 +-0.02,-0.57,-0.02,0.82,0.45,6.26,1.64 +-0.03,-0.57,-0.02,0.82,0.45,6.26,1.64 +-0.03,-0.57,-0.02,0.82,0.44,6.25,1.64 +-0.03,-0.57,-0.02,0.82,0.44,6.25,1.64 +-0.03,-0.57,-0.02,0.82,0.44,6.24,1.64 +-0.03,-0.57,-0.02,0.82,0.44,6.24,1.64 +-0.03,-0.57,-0.02,0.82,0.43,6.23,1.64 +-0.03,-0.57,-0.02,0.82,0.43,6.23,1.64 +-0.03,-0.57,-0.02,0.82,0.43,6.23,1.64 +-0.03,-0.57,-0.02,0.82,0.43,6.22,1.63 +-0.03,-0.58,-0.02,0.82,0.43,6.22,1.63 +-0.03,-0.58,-0.02,0.82,0.42,6.21,1.63 +-0.03,-0.58,-0.02,0.82,0.42,6.21,1.63 +-0.03,-0.58,-0.02,0.82,0.42,6.20,1.63 +-0.03,-0.58,-0.02,0.82,0.42,6.20,1.63 +-0.04,-0.58,-0.03,0.82,0.42,6.20,1.63 +-0.04,-0.58,-0.03,0.82,0.41,6.19,1.63 +-0.04,-0.58,-0.03,0.82,0.41,6.19,1.63 +-0.04,-0.58,-0.03,0.82,0.41,6.18,1.63 +-0.04,-0.58,-0.03,0.82,0.41,6.18,1.63 +-0.04,-0.58,-0.03,0.81,0.41,6.17,1.63 +-0.04,-0.58,-0.03,0.81,0.40,6.17,1.63 +-0.04,-0.58,-0.03,0.81,0.40,6.16,1.63 +-0.04,-0.58,-0.03,0.81,0.40,6.16,1.63 +-0.04,-0.58,-0.03,0.81,0.40,6.16,1.63 +-0.04,-0.58,-0.03,0.81,0.39,6.15,1.63 +-0.04,-0.58,-0.03,0.81,0.39,6.15,1.63 +-0.04,-0.58,-0.03,0.81,0.39,6.14,1.63 +-0.05,-0.58,-0.03,0.81,0.39,6.14,1.63 +-0.05,-0.58,-0.03,0.81,0.39,6.13,1.63 +-0.05,-0.58,-0.03,0.81,0.38,6.13,1.62 +-0.05,-0.58,-0.03,0.81,0.38,6.13,1.62 +-0.05,-0.58,-0.03,0.81,0.38,6.12,1.62 +-0.05,-0.58,-0.04,0.81,0.38,6.12,1.62 +-0.05,-0.58,-0.04,0.81,0.38,6.11,1.62 +-0.05,-0.58,-0.04,0.81,0.37,6.11,1.62 +-0.05,-0.58,-0.04,0.81,0.37,6.10,1.62 +-0.05,-0.58,-0.04,0.81,0.37,6.10,1.62 +-0.05,-0.58,-0.04,0.81,0.37,6.09,1.62 +-0.05,-0.58,-0.04,0.81,0.37,6.09,1.62 +-0.05,-0.58,-0.04,0.81,0.36,6.09,1.62 +-0.05,-0.58,-0.04,0.81,0.36,6.08,1.62 +-0.06,-0.58,-0.04,0.81,0.36,6.08,1.62 +-0.06,-0.58,-0.04,0.81,0.36,6.07,1.62 +-0.06,-0.58,-0.04,0.81,0.36,6.07,1.62 +-0.06,-0.58,-0.04,0.81,0.35,6.06,1.62 +-0.06,-0.58,-0.04,0.81,0.35,6.06,1.62 +-0.06,-0.58,-0.04,0.81,0.35,6.05,1.62 +-0.06,-0.58,-0.04,0.81,0.35,6.05,1.62 +-0.06,-0.59,-0.04,0.81,0.35,6.05,1.62 +-0.06,-0.59,-0.04,0.81,0.35,6.04,1.61 +-0.06,-0.59,-0.04,0.81,0.34,6.04,1.61 +-0.06,-0.59,-0.05,0.81,0.34,6.03,1.61 +-0.06,-0.59,-0.05,0.81,0.34,6.03,1.61 +-0.06,-0.59,-0.05,0.81,0.34,6.02,1.61 +-0.06,-0.59,-0.05,0.81,0.34,6.02,1.61 +-0.07,-0.59,-0.05,0.81,0.33,6.01,1.61 +-0.07,-0.59,-0.05,0.81,0.33,6.01,1.61 +-0.07,-0.59,-0.05,0.81,0.33,6.01,1.61 +-0.07,-0.59,-0.05,0.80,0.33,6.00,1.61 +-0.07,-0.59,-0.05,0.80,0.33,6.00,1.61 +-0.07,-0.59,-0.05,0.80,0.32,5.99,1.61 +-0.07,-0.59,-0.05,0.80,0.32,5.99,1.61 +-0.07,-0.59,-0.05,0.80,0.32,5.98,1.61 +-0.07,-0.59,-0.05,0.80,0.32,5.98,1.61 +-0.07,-0.59,-0.05,0.80,0.32,5.97,1.61 +-0.07,-0.59,-0.05,0.80,0.31,5.97,1.61 +-0.07,-0.59,-0.05,0.80,0.31,5.97,1.61 +-0.07,-0.59,-0.05,0.80,0.31,5.96,1.60 +-0.07,-0.59,-0.06,0.80,0.31,5.96,1.60 +-0.08,-0.59,-0.06,0.80,0.31,5.95,1.60 +-0.08,-0.59,-0.06,0.80,0.31,5.95,1.60 +-0.08,-0.59,-0.06,0.80,0.30,5.94,1.60 +-0.08,-0.59,-0.06,0.80,0.30,5.94,1.60 +-0.08,-0.59,-0.06,0.80,0.30,5.93,1.60 +-0.08,-0.59,-0.06,0.80,0.30,5.93,1.60 +-0.08,-0.59,-0.06,0.80,0.30,5.92,1.60 +-0.08,-0.59,-0.06,0.80,0.29,5.92,1.60 +-0.08,-0.59,-0.06,0.80,0.29,5.92,1.60 +-0.08,-0.59,-0.06,0.80,0.29,5.91,1.60 +-0.08,-0.59,-0.06,0.80,0.29,5.91,1.60 +-0.08,-0.59,-0.06,0.80,0.29,5.90,1.60 +-0.08,-0.59,-0.06,0.80,0.29,5.90,1.60 +-0.08,-0.59,-0.06,0.80,0.28,5.89,1.60 +-0.09,-0.59,-0.06,0.80,0.28,5.89,1.60 +-0.09,-0.59,-0.06,0.80,0.28,5.88,1.60 +-0.09,-0.59,-0.06,0.80,0.28,5.88,1.59 +-0.09,-0.59,-0.07,0.80,0.28,5.87,1.59 +-0.09,-0.59,-0.07,0.80,0.28,5.87,1.59 +-0.09,-0.59,-0.07,0.80,0.27,5.86,1.59 +-0.09,-0.59,-0.07,0.80,0.27,5.86,1.59 +-0.09,-0.59,-0.07,0.80,0.27,5.86,1.59 +-0.09,-0.59,-0.07,0.80,0.27,5.85,1.59 +-0.09,-0.60,-0.07,0.80,0.27,5.85,1.59 +-0.09,-0.60,-0.07,0.80,0.27,5.84,1.59 +-0.09,-0.60,-0.07,0.79,0.26,5.84,1.59 +-0.09,-0.60,-0.07,0.79,0.26,5.83,1.59 +-0.09,-0.60,-0.07,0.79,0.26,5.83,1.59 +-0.10,-0.60,-0.07,0.79,0.26,5.82,1.59 +-0.10,-0.60,-0.07,0.79,0.26,5.82,1.59 +-0.10,-0.60,-0.07,0.79,0.25,5.81,1.59 +-0.10,-0.60,-0.07,0.79,0.25,5.81,1.59 +-0.10,-0.60,-0.07,0.79,0.25,5.80,1.59 +-0.10,-0.60,-0.07,0.79,0.25,5.80,1.58 +-0.10,-0.60,-0.08,0.79,0.25,5.80,1.58 +-0.10,-0.60,-0.08,0.79,0.25,5.79,1.58 +-0.10,-0.60,-0.08,0.79,0.24,5.79,1.58 +-0.10,-0.60,-0.08,0.79,0.24,5.78,1.58 +-0.10,-0.60,-0.08,0.79,0.24,5.78,1.58 +-0.10,-0.60,-0.08,0.79,0.24,5.77,1.58 +-0.10,-0.60,-0.08,0.79,0.24,5.77,1.58 +-0.10,-0.60,-0.08,0.79,0.24,5.76,1.58 +-0.11,-0.60,-0.08,0.79,0.24,5.76,1.58 +-0.11,-0.60,-0.08,0.79,0.23,5.75,1.58 +-0.11,-0.60,-0.08,0.79,0.23,5.75,1.58 +-0.11,-0.60,-0.08,0.79,0.23,5.74,1.58 +-0.11,-0.60,-0.08,0.79,0.23,5.74,1.58 +-0.11,-0.60,-0.08,0.79,0.23,5.73,1.58 +-0.11,-0.60,-0.08,0.79,0.23,5.73,1.58 +-0.11,-0.60,-0.08,0.79,0.22,5.73,1.58 +-0.11,-0.60,-0.08,0.79,0.22,5.72,1.57 +-0.11,-0.60,-0.09,0.79,0.22,5.72,1.57 +-0.11,-0.60,-0.09,0.79,0.22,5.71,1.57 +-0.11,-0.60,-0.09,0.79,0.22,5.71,1.57 +-0.11,-0.60,-0.09,0.79,0.22,5.70,1.57 +-0.11,-0.60,-0.09,0.79,0.21,5.70,1.57 +-0.12,-0.60,-0.09,0.79,0.21,5.69,1.57 +-0.12,-0.60,-0.09,0.79,0.21,5.69,1.57 +-0.12,-0.60,-0.09,0.78,0.21,5.68,1.57 +-0.12,-0.60,-0.09,0.78,0.21,5.68,1.57 +-0.12,-0.60,-0.09,0.78,0.21,5.67,1.57 +-0.12,-0.60,-0.09,0.78,0.21,5.67,1.57 +-0.12,-0.60,-0.09,0.78,0.20,5.66,1.57 +-0.12,-0.60,-0.09,0.78,0.20,5.66,1.57 +-0.12,-0.60,-0.09,0.78,0.20,5.65,1.57 +-0.12,-0.60,-0.09,0.78,0.20,5.65,1.57 +-0.12,-0.60,-0.09,0.78,0.20,5.64,1.56 +-0.12,-0.60,-0.09,0.78,0.20,5.64,1.56 +-0.12,-0.60,-0.10,0.78,0.19,5.63,1.56 +-0.12,-0.60,-0.10,0.78,0.19,5.63,1.56 +-0.12,-0.60,-0.10,0.78,0.19,5.63,1.56 +-0.13,-0.60,-0.10,0.78,0.19,5.62,1.56 +-0.13,-0.60,-0.10,0.78,0.19,5.62,1.56 +-0.13,-0.60,-0.10,0.78,0.19,5.61,1.56 +-0.13,-0.61,-0.10,0.78,0.19,5.61,1.56 +-0.13,-0.61,-0.10,0.78,0.18,5.60,1.56 +-0.13,-0.61,-0.10,0.78,0.18,5.60,1.56 +-0.13,-0.61,-0.10,0.78,0.18,5.59,1.56 +-0.13,-0.61,-0.10,0.78,0.18,5.59,1.56 +-0.13,-0.61,-0.10,0.78,0.18,5.58,1.56 +-0.13,-0.61,-0.10,0.78,0.18,5.58,1.56 +-0.13,-0.61,-0.10,0.78,0.18,5.57,1.55 +-0.13,-0.61,-0.10,0.78,0.17,5.57,1.55 +-0.13,-0.61,-0.10,0.78,0.17,5.56,1.55 +-0.13,-0.61,-0.10,0.78,0.17,5.56,1.55 +-0.13,-0.61,-0.11,0.78,0.17,5.55,1.55 +-0.14,-0.61,-0.11,0.78,0.17,5.55,1.55 +-0.14,-0.61,-0.11,0.78,0.17,5.54,1.55 +-0.14,-0.61,-0.11,0.77,0.17,5.54,1.55 +-0.14,-0.61,-0.11,0.77,0.16,5.53,1.55 +-0.14,-0.61,-0.11,0.77,0.16,5.53,1.55 +-0.14,-0.61,-0.11,0.77,0.16,5.52,1.55 +-0.14,-0.61,-0.11,0.77,0.16,5.52,1.55 +-0.14,-0.61,-0.11,0.77,0.16,5.51,1.55 +-0.14,-0.61,-0.11,0.77,0.16,5.51,1.55 +-0.14,-0.61,-0.11,0.77,0.16,5.50,1.55 +-0.14,-0.61,-0.11,0.77,0.16,5.50,1.54 +-0.14,-0.61,-0.11,0.77,0.15,5.50,1.54 +-0.14,-0.61,-0.11,0.77,0.15,5.49,1.54 +-0.14,-0.61,-0.11,0.77,0.15,5.49,1.54 +-0.14,-0.61,-0.11,0.77,0.15,5.48,1.54 +-0.15,-0.61,-0.12,0.77,0.15,5.48,1.54 +-0.15,-0.61,-0.12,0.77,0.15,5.47,1.54 +-0.15,-0.61,-0.12,0.77,0.15,5.47,1.54 +-0.15,-0.61,-0.12,0.77,0.14,5.46,1.54 +-0.15,-0.61,-0.12,0.77,0.14,5.46,1.54 +-0.15,-0.61,-0.12,0.77,0.14,5.45,1.54 +-0.15,-0.61,-0.12,0.77,0.14,5.45,1.54 +-0.15,-0.61,-0.12,0.77,0.14,5.44,1.54 +-0.15,-0.61,-0.12,0.77,0.14,5.44,1.54 +-0.15,-0.61,-0.12,0.77,0.14,5.43,1.53 +-0.15,-0.61,-0.12,0.77,0.14,5.43,1.53 +-0.15,-0.61,-0.12,0.77,0.13,5.42,1.53 +-0.15,-0.61,-0.12,0.77,0.13,5.42,1.53 +-0.15,-0.61,-0.12,0.77,0.13,5.41,1.53 +-0.15,-0.61,-0.12,0.77,0.13,5.41,1.53 +-0.16,-0.61,-0.12,0.77,0.13,5.40,1.53 +-0.16,-0.61,-0.12,0.76,0.13,5.40,1.53 +-0.16,-0.61,-0.13,0.76,0.13,5.39,1.53 +-0.16,-0.61,-0.13,0.76,0.13,5.39,1.53 +-0.16,-0.61,-0.13,0.76,0.12,5.38,1.53 +-0.16,-0.61,-0.13,0.76,0.12,5.38,1.53 +-0.16,-0.61,-0.13,0.76,0.12,5.37,1.53 +-0.16,-0.61,-0.13,0.76,0.12,5.37,1.53 +-0.16,-0.61,-0.13,0.76,0.12,5.36,1.52 +-0.16,-0.61,-0.13,0.76,0.12,5.36,1.52 +-0.16,-0.61,-0.13,0.76,0.12,5.35,1.52 +-0.16,-0.61,-0.13,0.76,0.12,5.35,1.52 +-0.16,-0.61,-0.13,0.76,0.12,5.34,1.52 +-0.16,-0.61,-0.13,0.76,0.11,5.34,1.52 +-0.16,-0.61,-0.13,0.76,0.11,5.33,1.52 +-0.17,-0.61,-0.13,0.76,0.11,5.33,1.52 +-0.17,-0.61,-0.13,0.76,0.11,5.32,1.52 +-0.17,-0.61,-0.13,0.76,0.11,5.32,1.52 +-0.17,-0.61,-0.14,0.76,0.11,5.31,1.52 +-0.17,-0.61,-0.14,0.76,0.11,5.31,1.52 +-0.17,-0.62,-0.14,0.76,0.11,5.30,1.52 +-0.17,-0.62,-0.14,0.76,0.11,5.30,1.52 +-0.17,-0.62,-0.14,0.76,0.10,5.29,1.51 +-0.17,-0.62,-0.14,0.76,0.10,5.29,1.51 +-0.17,-0.62,-0.14,0.76,0.10,5.28,1.51 +-0.17,-0.62,-0.14,0.76,0.10,5.28,1.51 +-0.17,-0.62,-0.14,0.76,0.10,5.27,1.51 +-0.17,-0.62,-0.14,0.76,0.10,5.27,1.51 +-0.17,-0.62,-0.14,0.76,0.10,5.26,1.51 +-0.17,-0.62,-0.14,0.75,0.10,5.26,1.51 +-0.17,-0.62,-0.14,0.75,0.10,5.25,1.51 +-0.18,-0.62,-0.14,0.75,0.09,5.25,1.51 +-0.18,-0.62,-0.14,0.75,0.09,5.24,1.51 +-0.18,-0.62,-0.14,0.75,0.09,5.24,1.51 +-0.18,-0.62,-0.15,0.75,0.09,5.23,1.51 +-0.18,-0.62,-0.15,0.75,0.09,5.23,1.50 +-0.18,-0.62,-0.15,0.75,0.09,5.22,1.50 +-0.18,-0.62,-0.15,0.75,0.09,5.22,1.50 +-0.18,-0.62,-0.15,0.75,0.09,5.21,1.50 +-0.18,-0.62,-0.15,0.75,0.09,5.21,1.50 +-0.18,-0.62,-0.15,0.75,0.09,5.20,1.50 +-0.18,-0.62,-0.15,0.75,0.08,5.20,1.50 +-0.18,-0.62,-0.15,0.75,0.08,5.19,1.50 +-0.18,-0.62,-0.15,0.75,0.08,5.19,1.50 +-0.18,-0.62,-0.15,0.75,0.08,5.18,1.50 +-0.18,-0.62,-0.15,0.75,0.08,5.18,1.50 +-0.19,-0.62,-0.15,0.75,0.08,5.17,1.50 +-0.19,-0.62,-0.15,0.75,0.08,5.17,1.50 +-0.19,-0.62,-0.15,0.75,0.08,5.16,1.49 +-0.19,-0.62,-0.15,0.75,0.08,5.16,1.49 +-0.19,-0.62,-0.16,0.75,0.08,5.15,1.49 +-0.19,-0.62,-0.16,0.75,0.07,5.15,1.49 +-0.19,-0.62,-0.16,0.75,0.07,5.14,1.49 +-0.19,-0.62,-0.16,0.75,0.07,5.14,1.49 +-0.19,-0.62,-0.16,0.75,0.07,5.13,1.49 +-0.19,-0.62,-0.16,0.74,0.07,5.13,1.49 +-0.19,-0.62,-0.16,0.74,0.07,5.12,1.49 +-0.19,-0.62,-0.16,0.74,0.07,5.12,1.49 +-0.19,-0.62,-0.16,0.74,0.07,5.11,1.49 +-0.19,-0.62,-0.16,0.74,0.07,5.11,1.49 +-0.19,-0.62,-0.16,0.74,0.07,5.10,1.49 +-0.19,-0.62,-0.16,0.74,0.07,5.10,1.48 +-0.20,-0.62,-0.16,0.74,0.06,5.09,1.48 +-0.20,-0.62,-0.16,0.74,0.06,5.09,1.48 +-0.20,-0.62,-0.16,0.74,0.06,5.08,1.48 +-0.20,-0.62,-0.17,0.74,0.06,5.08,1.48 +-0.20,-0.62,-0.17,0.74,0.06,5.07,1.48 +-0.20,-0.62,-0.17,0.74,0.06,5.07,1.48 +-0.20,-0.62,-0.17,0.74,0.06,5.06,1.48 +-0.20,-0.62,-0.17,0.74,0.06,5.06,1.48 +-0.20,-0.62,-0.17,0.74,0.06,5.05,1.48 +-0.20,-0.62,-0.17,0.74,0.06,5.05,1.48 +-0.20,-0.62,-0.17,0.74,0.06,5.04,1.48 +-0.20,-0.62,-0.17,0.74,0.06,5.04,1.48 +-0.20,-0.62,-0.17,0.74,0.05,5.03,1.47 +-0.20,-0.62,-0.17,0.74,0.05,5.03,1.47 +-0.20,-0.62,-0.17,0.74,0.05,5.02,1.47 +-0.20,-0.62,-0.17,0.74,0.05,5.02,1.47 +-0.21,-0.62,-0.17,0.74,0.05,5.01,1.47 +-0.21,-0.62,-0.17,0.74,0.05,5.00,1.47 +-0.21,-0.62,-0.17,0.73,0.05,5.00,1.47 +-0.21,-0.62,-0.18,0.73,0.05,4.99,1.47 +-0.21,-0.62,-0.18,0.73,0.05,4.99,1.47 +-0.21,-0.62,-0.18,0.73,0.05,4.98,1.47 +-0.21,-0.62,-0.18,0.73,0.05,4.98,1.47 +-0.21,-0.62,-0.18,0.73,0.05,4.97,1.47 +-0.21,-0.62,-0.18,0.73,0.05,4.97,1.46 +-0.21,-0.62,-0.18,0.73,0.04,4.96,1.46 +-0.21,-0.62,-0.18,0.73,0.04,4.96,1.46 +-0.21,-0.62,-0.18,0.73,0.04,4.95,1.46 +-0.21,-0.62,-0.18,0.73,0.04,4.95,1.46 +-0.21,-0.62,-0.18,0.73,0.04,4.94,1.46 +-0.21,-0.62,-0.18,0.73,0.04,4.94,1.46 +-0.21,-0.62,-0.18,0.73,0.04,4.93,1.46 +-0.21,-0.62,-0.18,0.73,0.04,4.93,1.46 +-0.22,-0.62,-0.18,0.73,0.04,4.92,1.46 +-0.22,-0.62,-0.18,0.73,0.04,4.92,1.46 +-0.22,-0.62,-0.19,0.73,0.04,4.91,1.46 +-0.22,-0.62,-0.19,0.73,0.04,4.91,1.45 +-0.22,-0.62,-0.19,0.73,0.04,4.90,1.45 +-0.22,-0.62,-0.19,0.73,0.04,4.90,1.45 +-0.22,-0.62,-0.19,0.73,0.03,4.89,1.45 +-0.22,-0.62,-0.19,0.73,0.03,4.89,1.45 +-0.22,-0.62,-0.19,0.73,0.03,4.88,1.45 +-0.22,-0.62,-0.19,0.72,0.03,4.88,1.45 +-0.22,-0.62,-0.19,0.72,0.03,4.87,1.45 +-0.22,-0.62,-0.19,0.72,0.03,4.87,1.45 +-0.22,-0.62,-0.19,0.72,0.03,4.86,1.45 +-0.22,-0.62,-0.19,0.72,0.03,4.85,1.45 +-0.22,-0.62,-0.19,0.72,0.03,4.85,1.45 +-0.22,-0.62,-0.19,0.72,0.03,4.84,1.44 +-0.22,-0.62,-0.19,0.72,0.03,4.84,1.44 +-0.23,-0.62,-0.20,0.72,0.03,4.83,1.44 +-0.23,-0.62,-0.20,0.72,0.03,4.83,1.44 +-0.23,-0.63,-0.20,0.72,0.03,4.82,1.44 +-0.23,-0.63,-0.20,0.72,0.03,4.82,1.44 +-0.23,-0.63,-0.20,0.72,0.03,4.81,1.44 +-0.23,-0.63,-0.20,0.72,0.03,4.81,1.44 +-0.23,-0.63,-0.20,0.72,0.02,4.80,1.44 +-0.23,-0.63,-0.20,0.72,0.02,4.80,1.44 +-0.23,-0.63,-0.20,0.72,0.02,4.79,1.44 +-0.23,-0.63,-0.20,0.72,0.02,4.79,1.44 +-0.23,-0.63,-0.20,0.72,0.02,4.78,1.43 +-0.23,-0.63,-0.20,0.72,0.02,4.78,1.43 +-0.23,-0.63,-0.20,0.72,0.02,4.77,1.43 +-0.23,-0.63,-0.20,0.72,0.02,4.77,1.43 +-0.23,-0.63,-0.20,0.72,0.02,4.76,1.43 +-0.23,-0.63,-0.21,0.71,0.02,4.76,1.43 +-0.23,-0.63,-0.21,0.71,0.02,4.75,1.43 +-0.24,-0.63,-0.21,0.71,0.02,4.75,1.43 +-0.24,-0.63,-0.21,0.71,0.02,4.74,1.43 +-0.24,-0.63,-0.21,0.71,0.02,4.73,1.43 +-0.24,-0.63,-0.21,0.71,0.02,4.73,1.43 +-0.24,-0.63,-0.21,0.71,0.02,4.72,1.42 +-0.24,-0.63,-0.21,0.71,0.02,4.72,1.42 +-0.24,-0.63,-0.21,0.71,0.02,4.71,1.42 +-0.24,-0.63,-0.21,0.71,0.02,4.71,1.42 +-0.24,-0.63,-0.21,0.71,0.02,4.70,1.42 +-0.24,-0.63,-0.21,0.71,0.01,4.70,1.42 +-0.24,-0.63,-0.21,0.71,0.01,4.69,1.42 +-0.24,-0.63,-0.21,0.71,0.01,4.69,1.42 +-0.24,-0.63,-0.21,0.71,0.01,4.68,1.42 +-0.24,-0.63,-0.22,0.71,0.01,4.68,1.42 +-0.24,-0.63,-0.22,0.71,0.01,4.67,1.42 +-0.24,-0.63,-0.22,0.71,0.01,4.67,1.42 +-0.24,-0.63,-0.22,0.71,0.01,4.66,1.41 +-0.25,-0.63,-0.22,0.71,0.01,4.66,1.41 +-0.25,-0.63,-0.22,0.71,0.01,4.65,1.41 +-0.25,-0.63,-0.22,0.71,0.01,4.65,1.41 +-0.25,-0.63,-0.22,0.71,0.01,4.64,1.41 +-0.25,-0.63,-0.22,0.70,0.01,4.63,1.41 +-0.25,-0.63,-0.22,0.70,0.01,4.63,1.41 +-0.25,-0.63,-0.22,0.70,0.01,4.62,1.41 +-0.25,-0.63,-0.22,0.70,0.01,4.62,1.41 +-0.25,-0.63,-0.22,0.70,0.01,4.61,1.41 +-0.25,-0.63,-0.22,0.70,0.01,4.61,1.41 +-0.25,-0.63,-0.22,0.70,0.01,4.60,1.40 +-0.25,-0.63,-0.22,0.70,0.01,4.60,1.40 +-0.25,-0.63,-0.23,0.70,0.01,4.59,1.40 +-0.25,-0.63,-0.23,0.70,0.01,4.59,1.40 +-0.25,-0.63,-0.23,0.70,0.01,4.58,1.40 +-0.25,-0.63,-0.23,0.70,0.01,4.58,1.40 +-0.25,-0.63,-0.23,0.70,0.01,4.57,1.40 +-0.25,-0.63,-0.23,0.70,0.01,4.57,1.40 +-0.26,-0.63,-0.23,0.70,0.01,4.56,1.40 +-0.26,-0.63,-0.23,0.70,0.01,4.55,1.40 +-0.26,-0.63,-0.23,0.70,0.01,4.55,1.40 +-0.26,-0.63,-0.23,0.70,0.01,4.54,1.39 +-0.26,-0.63,-0.23,0.70,0.00,4.54,1.39 +-0.26,-0.63,-0.23,0.70,0.00,4.53,1.39 +-0.26,-0.63,-0.23,0.70,0.00,4.53,1.39 +-0.26,-0.63,-0.23,0.70,0.00,4.52,1.39 +-0.26,-0.63,-0.23,0.69,0.00,4.52,1.39 +-0.26,-0.63,-0.24,0.69,0.00,4.51,1.39 +-0.26,-0.63,-0.24,0.69,0.00,4.51,1.39 +-0.26,-0.63,-0.24,0.69,0.00,4.50,1.39 +-0.26,-0.63,-0.24,0.69,0.00,4.50,1.39 +-0.26,-0.63,-0.24,0.69,0.00,4.49,1.39 +-0.26,-0.63,-0.24,0.69,0.00,4.49,1.38 +-0.26,-0.63,-0.24,0.69,0.00,4.48,1.38 +-0.26,-0.63,-0.24,0.69,0.00,4.48,1.38 +-0.26,-0.63,-0.24,0.69,0.00,4.47,1.38 +-0.27,-0.63,-0.24,0.69,0.00,4.46,1.38 +-0.27,-0.63,-0.24,0.69,0.00,4.46,1.38 +-0.27,-0.63,-0.24,0.69,0.00,4.45,1.38 +-0.27,-0.63,-0.24,0.69,0.00,4.45,1.38 +-0.27,-0.63,-0.24,0.69,0.00,4.44,1.38 +-0.27,-0.63,-0.24,0.69,0.00,4.44,1.38 +-0.27,-0.63,-0.25,0.69,0.00,4.43,1.38 +-0.27,-0.63,-0.25,0.69,0.00,4.43,1.37 +-0.27,-0.63,-0.25,0.69,0.00,4.42,1.37 +-0.27,-0.63,-0.25,0.69,0.00,4.42,1.37 +-0.27,-0.63,-0.25,0.69,0.00,4.41,1.37 +-0.27,-0.63,-0.25,0.69,0.00,4.41,1.37 +-0.27,-0.63,-0.25,0.68,0.00,4.40,1.37 +-0.27,-0.63,-0.25,0.68,0.00,4.39,1.37 +-0.27,-0.63,-0.25,0.68,0.00,4.39,1.37 +-0.27,-0.63,-0.25,0.68,0.00,4.38,1.37 +-0.27,-0.63,-0.25,0.68,0.00,4.38,1.37 +-0.27,-0.63,-0.25,0.68,0.00,4.37,1.36 +-0.28,-0.63,-0.25,0.68,0.00,4.37,1.36 +-0.28,-0.63,-0.25,0.68,0.00,4.36,1.36 +-0.28,-0.63,-0.26,0.68,0.00,4.36,1.36 +-0.28,-0.63,-0.26,0.68,0.00,4.35,1.36 +-0.28,-0.63,-0.26,0.68,0.00,4.35,1.36 +-0.28,-0.63,-0.26,0.68,0.00,4.34,1.36 +-0.28,-0.63,-0.26,0.68,0.00,4.34,1.36 +-0.28,-0.63,-0.26,0.68,0.00,4.33,1.36 +-0.28,-0.63,-0.26,0.68,0.00,4.32,1.36 +-0.28,-0.63,-0.26,0.68,0.00,4.32,1.36 +-0.28,-0.63,-0.26,0.68,0.00,4.31,1.35 +-0.28,-0.63,-0.26,0.68,0.00,4.31,1.35 +-0.28,-0.63,-0.26,0.68,0.00,4.30,1.35 +-0.28,-0.63,-0.26,0.68,0.00,4.30,1.35 +-0.28,-0.63,-0.26,0.68,0.00,4.29,1.35 +-0.28,-0.63,-0.26,0.67,0.00,4.29,1.35 +-0.28,-0.63,-0.26,0.67,0.00,4.28,1.35 +-0.28,-0.63,-0.27,0.67,0.00,4.28,1.35 +-0.28,-0.63,-0.27,0.67,0.00,4.27,1.35 +-0.29,-0.63,-0.27,0.67,0.00,4.27,1.35 +-0.29,-0.63,-0.27,0.67,0.00,4.26,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.25,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.25,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.24,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.24,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.23,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.23,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.22,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.22,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.21,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.21,1.34 +-0.29,-0.63,-0.27,0.67,0.00,4.20,1.33 +-0.29,-0.63,-0.28,0.67,0.00,4.20,1.33 +-0.29,-0.63,-0.28,0.67,0.00,4.19,1.33 +-0.29,-0.63,-0.28,0.67,0.00,4.18,1.33 +-0.29,-0.63,-0.28,0.67,0.00,4.18,1.33 +-0.29,-0.63,-0.28,0.66,0.00,4.17,1.33 +-0.29,-0.63,-0.28,0.66,0.00,4.17,1.33 +-0.30,-0.63,-0.28,0.66,0.00,4.16,1.33 +-0.30,-0.63,-0.28,0.66,0.00,4.16,1.33 +-0.30,-0.63,-0.28,0.66,0.00,4.15,1.33 +-0.30,-0.63,-0.28,0.66,0.00,4.15,1.32 +-0.30,-0.63,-0.28,0.66,0.00,4.14,1.32 +-0.30,-0.63,-0.28,0.66,0.00,4.14,1.32 +-0.30,-0.63,-0.28,0.66,0.00,4.13,1.32 +-0.30,-0.63,-0.28,0.66,0.00,4.12,1.32 +-0.30,-0.63,-0.28,0.66,0.00,4.12,1.32 +-0.30,-0.63,-0.29,0.66,0.00,4.11,1.32 +-0.30,-0.63,-0.29,0.66,0.01,4.11,1.32 +-0.30,-0.63,-0.29,0.66,0.01,4.10,1.32 +-0.30,-0.63,-0.29,0.66,0.01,4.10,1.32 +-0.30,-0.63,-0.29,0.66,0.01,4.09,1.31 +-0.30,-0.63,-0.29,0.66,0.01,4.09,1.31 +-0.30,-0.63,-0.29,0.66,0.01,4.08,1.31 +-0.30,-0.63,-0.29,0.66,0.01,4.08,1.31 +-0.30,-0.63,-0.29,0.66,0.01,4.07,1.31 +-0.30,-0.63,-0.29,0.65,0.01,4.06,1.31 +-0.30,-0.63,-0.29,0.65,0.01,4.06,1.31 +-0.31,-0.63,-0.29,0.65,0.01,4.05,1.31 +-0.31,-0.63,-0.29,0.65,0.01,4.05,1.31 +-0.31,-0.63,-0.29,0.65,0.01,4.04,1.31 +-0.31,-0.63,-0.29,0.65,0.01,4.04,1.30 +-0.31,-0.63,-0.30,0.65,0.01,4.03,1.30 +-0.31,-0.63,-0.30,0.65,0.01,4.03,1.30 +-0.31,-0.63,-0.30,0.65,0.01,4.02,1.30 +-0.31,-0.63,-0.30,0.65,0.01,4.02,1.30 +-0.31,-0.63,-0.30,0.65,0.01,4.01,1.30 +-0.31,-0.63,-0.30,0.65,0.01,4.00,1.30 +-0.31,-0.63,-0.30,0.65,0.01,4.00,1.30 +-0.31,-0.63,-0.30,0.65,0.01,3.99,1.30 +-0.31,-0.63,-0.30,0.65,0.01,3.99,1.30 +-0.31,-0.63,-0.30,0.65,0.01,3.98,1.29 +-0.31,-0.63,-0.30,0.65,0.01,3.98,1.29 +-0.31,-0.63,-0.30,0.65,0.01,3.97,1.29 +-0.31,-0.63,-0.30,0.65,0.01,3.97,1.29 +-0.31,-0.63,-0.30,0.65,0.01,3.96,1.29 +-0.31,-0.63,-0.31,0.64,0.01,3.96,1.29 +-0.31,-0.63,-0.31,0.64,0.02,3.95,1.29 +-0.32,-0.63,-0.31,0.64,0.02,3.94,1.29 +-0.32,-0.63,-0.31,0.64,0.02,3.94,1.29 +-0.32,-0.63,-0.31,0.64,0.02,3.93,1.29 +-0.32,-0.63,-0.31,0.64,0.02,3.93,1.28 +-0.32,-0.63,-0.31,0.64,0.02,3.92,1.28 +-0.32,-0.63,-0.31,0.64,0.02,3.92,1.28 +-0.32,-0.63,-0.31,0.64,0.02,3.91,1.28 +-0.32,-0.63,-0.31,0.64,0.02,3.91,1.28 +-0.32,-0.63,-0.31,0.64,0.02,3.90,1.28 +-0.32,-0.63,-0.31,0.64,0.02,3.90,1.28 +-0.32,-0.63,-0.31,0.64,0.02,3.89,1.28 +-0.32,-0.63,-0.31,0.64,0.02,3.88,1.28 +-0.32,-0.63,-0.31,0.64,0.02,3.88,1.28 +-0.32,-0.63,-0.32,0.64,0.02,3.87,1.27 +-0.32,-0.63,-0.32,0.64,0.02,3.87,1.27 +-0.32,-0.63,-0.32,0.64,0.02,3.86,1.27 +-0.32,-0.63,-0.32,0.64,0.02,3.86,1.27 +-0.32,-0.63,-0.32,0.64,0.02,3.85,1.27 +-0.32,-0.63,-0.32,0.63,0.02,3.85,1.27 +-0.32,-0.63,-0.32,0.63,0.03,3.84,1.27 +-0.32,-0.63,-0.32,0.63,0.03,3.83,1.27 +-0.33,-0.63,-0.32,0.63,0.03,3.83,1.27 +-0.33,-0.62,-0.32,0.63,0.03,3.82,1.26 +-0.33,-0.62,-0.32,0.63,0.03,3.82,1.26 +-0.33,-0.62,-0.32,0.63,0.03,3.81,1.26 +-0.33,-0.62,-0.32,0.63,0.03,3.81,1.26 +-0.33,-0.62,-0.32,0.63,0.03,3.80,1.26 +-0.33,-0.62,-0.33,0.63,0.03,3.80,1.26 +-0.33,-0.62,-0.33,0.63,0.03,3.79,1.26 +-0.33,-0.62,-0.33,0.63,0.03,3.79,1.26 +-0.33,-0.62,-0.33,0.63,0.03,3.78,1.26 +-0.33,-0.62,-0.33,0.63,0.03,3.77,1.26 +-0.33,-0.62,-0.33,0.63,0.03,3.77,1.25 +-0.33,-0.62,-0.33,0.63,0.03,3.76,1.25 +-0.33,-0.62,-0.33,0.63,0.03,3.76,1.25 +-0.33,-0.62,-0.33,0.63,0.04,3.75,1.25 +-0.33,-0.62,-0.33,0.63,0.04,3.75,1.25 +-0.33,-0.62,-0.33,0.62,0.04,3.74,1.25 +-0.33,-0.62,-0.33,0.62,0.04,3.74,1.25 +-0.33,-0.62,-0.33,0.62,0.04,3.73,1.25 +-0.33,-0.62,-0.33,0.62,0.04,3.72,1.25 +-0.33,-0.62,-0.33,0.62,0.04,3.72,1.25 +-0.33,-0.62,-0.34,0.62,0.04,3.71,1.24 +-0.34,-0.62,-0.34,0.62,0.04,3.71,1.24 +-0.34,-0.62,-0.34,0.62,0.04,3.70,1.24 +-0.34,-0.62,-0.34,0.62,0.04,3.70,1.24 +-0.34,-0.62,-0.34,0.62,0.04,3.69,1.24 +-0.34,-0.62,-0.34,0.62,0.04,3.69,1.24 +-0.34,-0.62,-0.34,0.62,0.04,3.68,1.24 +-0.34,-0.62,-0.34,0.62,0.05,3.68,1.24 +-0.34,-0.62,-0.34,0.62,0.05,3.67,1.24 +-0.34,-0.62,-0.34,0.62,0.05,3.66,1.23 +-0.34,-0.62,-0.34,0.62,0.05,3.66,1.23 +-0.34,-0.62,-0.34,0.62,0.05,3.65,1.23 +-0.34,-0.62,-0.34,0.62,0.05,3.65,1.23 +-0.34,-0.62,-0.34,0.62,0.05,3.64,1.23 +-0.34,-0.62,-0.35,0.61,0.05,3.64,1.23 +-0.34,-0.62,-0.35,0.61,0.05,3.63,1.23 +-0.34,-0.62,-0.35,0.61,0.05,3.63,1.23 +-0.34,-0.62,-0.35,0.61,0.05,3.62,1.23 +-0.34,-0.62,-0.35,0.61,0.05,3.61,1.23 +-0.34,-0.62,-0.35,0.61,0.06,3.61,1.22 +-0.34,-0.62,-0.35,0.61,0.06,3.60,1.22 +-0.34,-0.62,-0.35,0.61,0.06,3.60,1.22 +-0.34,-0.62,-0.35,0.61,0.06,3.59,1.22 +-0.34,-0.62,-0.35,0.61,0.06,3.59,1.22 +-0.35,-0.62,-0.35,0.61,0.06,3.58,1.22 +-0.35,-0.62,-0.35,0.61,0.06,3.58,1.22 +-0.35,-0.62,-0.35,0.61,0.06,3.57,1.22 +-0.35,-0.62,-0.35,0.61,0.06,3.57,1.22 +-0.35,-0.62,-0.35,0.61,0.06,3.56,1.21 +-0.35,-0.62,-0.36,0.61,0.06,3.55,1.21 +-0.35,-0.62,-0.36,0.61,0.07,3.55,1.21 +-0.35,-0.62,-0.36,0.61,0.07,3.54,1.21 +-0.35,-0.62,-0.36,0.61,0.07,3.54,1.21 +-0.35,-0.62,-0.36,0.60,0.07,3.53,1.21 +-0.35,-0.62,-0.36,0.60,0.07,3.53,1.21 +-0.35,-0.62,-0.36,0.60,0.07,3.52,1.21 +-0.35,-0.62,-0.36,0.60,0.07,3.52,1.21 +-0.35,-0.62,-0.36,0.60,0.07,3.51,1.20 +-0.35,-0.62,-0.36,0.60,0.07,3.50,1.20 +-0.35,-0.62,-0.36,0.60,0.07,3.50,1.20 +-0.35,-0.62,-0.36,0.60,0.07,3.49,1.20 +-0.35,-0.62,-0.36,0.60,0.08,3.49,1.20 +-0.35,-0.62,-0.36,0.60,0.08,3.48,1.20 +-0.35,-0.62,-0.37,0.60,0.08,3.48,1.20 +-0.35,-0.62,-0.37,0.60,0.08,3.47,1.20 +-0.35,-0.62,-0.37,0.60,0.08,3.47,1.20 +-0.35,-0.62,-0.37,0.60,0.08,3.46,1.20 +-0.36,-0.62,-0.37,0.60,0.08,3.45,1.19 +-0.36,-0.62,-0.37,0.60,0.08,3.45,1.19 +-0.36,-0.62,-0.37,0.60,0.08,3.44,1.19 +-0.36,-0.62,-0.37,0.60,0.08,3.44,1.19 +-0.36,-0.62,-0.37,0.59,0.09,3.43,1.19 +-0.36,-0.62,-0.37,0.59,0.09,3.43,1.19 +-0.36,-0.62,-0.37,0.59,0.09,3.42,1.19 +-0.36,-0.62,-0.37,0.59,0.09,3.42,1.19 +-0.36,-0.62,-0.37,0.59,0.09,3.41,1.19 +-0.36,-0.62,-0.37,0.59,0.09,3.41,1.18 +-0.36,-0.62,-0.37,0.59,0.09,3.40,1.18 +-0.36,-0.62,-0.38,0.59,0.09,3.39,1.18 +-0.36,-0.62,-0.38,0.59,0.09,3.39,1.18 +-0.36,-0.62,-0.38,0.59,0.10,3.38,1.18 +-0.36,-0.62,-0.38,0.59,0.10,3.38,1.18 +-0.36,-0.62,-0.38,0.59,0.10,3.37,1.18 +-0.36,-0.62,-0.38,0.59,0.10,3.37,1.18 +-0.36,-0.62,-0.38,0.59,0.10,3.36,1.18 +-0.36,-0.62,-0.38,0.59,0.10,3.36,1.17 +-0.36,-0.62,-0.38,0.59,0.10,3.35,1.17 +-0.36,-0.62,-0.38,0.59,0.10,3.34,1.17 +-0.36,-0.62,-0.38,0.59,0.10,3.34,1.17 +-0.36,-0.62,-0.38,0.59,0.11,3.33,1.17 +-0.36,-0.62,-0.38,0.58,0.11,3.33,1.17 +-0.37,-0.61,-0.38,0.58,0.11,3.32,1.17 +-0.37,-0.61,-0.39,0.58,0.11,3.32,1.17 +-0.37,-0.61,-0.39,0.58,0.11,3.31,1.17 +-0.37,-0.61,-0.39,0.58,0.11,3.31,1.16 +-0.37,-0.61,-0.39,0.58,0.11,3.30,1.16 +-0.37,-0.61,-0.39,0.58,0.11,3.29,1.16 +-0.37,-0.61,-0.39,0.58,0.12,3.29,1.16 +-0.37,-0.61,-0.39,0.58,0.12,3.28,1.16 +-0.37,-0.61,-0.39,0.58,0.12,3.28,1.16 +-0.37,-0.61,-0.39,0.58,0.12,3.27,1.16 +-0.37,-0.61,-0.39,0.58,0.12,3.27,1.16 +-0.37,-0.61,-0.39,0.58,0.12,3.26,1.16 +-0.37,-0.61,-0.39,0.58,0.12,3.26,1.15 +-0.37,-0.61,-0.39,0.58,0.12,3.25,1.15 +-0.37,-0.61,-0.39,0.58,0.13,3.24,1.15 +-0.37,-0.61,-0.39,0.58,0.13,3.24,1.15 +-0.37,-0.61,-0.40,0.58,0.13,3.23,1.15 +-0.37,-0.61,-0.40,0.57,0.13,3.23,1.15 +-0.37,-0.61,-0.40,0.57,0.13,3.22,1.15 +-0.37,-0.61,-0.40,0.57,0.13,3.22,1.15 +-0.37,-0.61,-0.40,0.57,0.13,3.21,1.15 +-0.37,-0.61,-0.40,0.57,0.13,3.21,1.14 +-0.37,-0.61,-0.40,0.57,0.14,3.20,1.14 +-0.37,-0.61,-0.40,0.57,0.14,3.20,1.14 +-0.37,-0.61,-0.40,0.57,0.14,3.19,1.14 +-0.37,-0.61,-0.40,0.57,0.14,3.18,1.14 +-0.38,-0.61,-0.40,0.57,0.14,3.18,1.14 +-0.38,-0.61,-0.40,0.57,0.14,3.17,1.14 +-0.38,-0.61,-0.40,0.57,0.14,3.17,1.14 +-0.38,-0.61,-0.40,0.57,0.15,3.16,1.14 +-0.38,-0.61,-0.41,0.57,0.15,3.16,1.13 +-0.38,-0.61,-0.41,0.57,0.15,3.15,1.13 +-0.38,-0.61,-0.41,0.57,0.15,3.15,1.13 +-0.38,-0.61,-0.41,0.57,0.15,3.14,1.13 +-0.38,-0.61,-0.41,0.57,0.15,3.13,1.13 +-0.38,-0.61,-0.41,0.56,0.15,3.13,1.13 +-0.38,-0.61,-0.41,0.56,0.16,3.12,1.13 +-0.38,-0.61,-0.41,0.56,0.16,3.12,1.13 +-0.38,-0.61,-0.41,0.56,0.16,3.11,1.13 +-0.38,-0.61,-0.41,0.56,0.16,3.11,1.12 +-0.38,-0.61,-0.41,0.56,0.16,3.10,1.12 +-0.38,-0.61,-0.41,0.56,0.16,3.10,1.12 +-0.38,-0.61,-0.41,0.56,0.16,3.09,1.12 +-0.38,-0.61,-0.41,0.56,0.17,3.08,1.12 +-0.38,-0.61,-0.41,0.56,0.17,3.08,1.12 +-0.38,-0.61,-0.42,0.56,0.17,3.07,1.12 +-0.38,-0.61,-0.42,0.56,0.17,3.07,1.12 +-0.38,-0.61,-0.42,0.56,0.17,3.06,1.12 +-0.38,-0.61,-0.42,0.56,0.17,3.06,1.11 +-0.38,-0.61,-0.42,0.56,0.17,3.05,1.11 +-0.38,-0.61,-0.42,0.56,0.18,3.05,1.11 +-0.38,-0.61,-0.42,0.56,0.18,3.04,1.11 +-0.38,-0.61,-0.42,0.55,0.18,3.03,1.11 +-0.39,-0.61,-0.42,0.55,0.18,3.03,1.11 +-0.39,-0.61,-0.42,0.55,0.18,3.02,1.11 +-0.39,-0.61,-0.42,0.55,0.18,3.02,1.11 +-0.39,-0.61,-0.42,0.55,0.18,3.01,1.11 +-0.39,-0.61,-0.42,0.55,0.19,3.01,1.10 +-0.39,-0.60,-0.42,0.55,0.19,3.00,1.10 +-0.39,-0.60,-0.43,0.55,0.19,3.00,1.10 +-0.39,-0.60,-0.43,0.55,0.19,2.99,1.10 +-0.39,-0.60,-0.43,0.55,0.19,2.99,1.10 +-0.39,-0.60,-0.43,0.55,0.19,2.98,1.10 +-0.39,-0.60,-0.43,0.55,0.20,2.97,1.10 +-0.39,-0.60,-0.43,0.55,0.20,2.97,1.10 +-0.39,-0.60,-0.43,0.55,0.20,2.96,1.10 +-0.39,-0.60,-0.43,0.55,0.20,2.96,1.09 +-0.39,-0.60,-0.43,0.55,0.20,2.95,1.09 +-0.39,-0.60,-0.43,0.55,0.20,2.95,1.09 +-0.39,-0.60,-0.43,0.55,0.21,2.94,1.09 +-0.39,-0.60,-0.43,0.54,0.21,2.94,1.09 +-0.39,-0.60,-0.43,0.54,0.21,2.93,1.09 +-0.39,-0.60,-0.43,0.54,0.21,2.92,1.09 +-0.39,-0.60,-0.43,0.54,0.21,2.92,1.09 +-0.39,-0.60,-0.44,0.54,0.21,2.91,1.08 +-0.39,-0.60,-0.44,0.54,0.22,2.91,1.08 +-0.39,-0.60,-0.44,0.54,0.22,2.90,1.08 +-0.39,-0.60,-0.44,0.54,0.22,2.90,1.08 +-0.39,-0.60,-0.44,0.54,0.22,2.89,1.08 +-0.39,-0.60,-0.44,0.54,0.22,2.89,1.08 +-0.39,-0.60,-0.44,0.54,0.22,2.88,1.08 +-0.40,-0.60,-0.44,0.54,0.23,2.88,1.08 +-0.40,-0.60,-0.44,0.54,0.23,2.87,1.08 +-0.40,-0.60,-0.44,0.54,0.23,2.86,1.07 +-0.40,-0.60,-0.44,0.54,0.23,2.86,1.07 +-0.40,-0.60,-0.44,0.54,0.23,2.85,1.07 +-0.40,-0.60,-0.44,0.54,0.23,2.85,1.07 +-0.40,-0.60,-0.44,0.54,0.24,2.84,1.07 +-0.40,-0.60,-0.45,0.53,0.24,2.84,1.07 +-0.40,-0.60,-0.45,0.53,0.24,2.83,1.07 +-0.40,-0.60,-0.45,0.53,0.24,2.83,1.07 +-0.40,-0.60,-0.45,0.53,0.24,2.82,1.07 +-0.40,-0.60,-0.45,0.53,0.25,2.81,1.06 +-0.40,-0.60,-0.45,0.53,0.25,2.81,1.06 +-0.40,-0.60,-0.45,0.53,0.25,2.80,1.06 +-0.40,-0.60,-0.45,0.53,0.25,2.80,1.06 +-0.40,-0.60,-0.45,0.53,0.25,2.79,1.06 +-0.40,-0.60,-0.45,0.53,0.25,2.79,1.06 +-0.40,-0.60,-0.45,0.53,0.26,2.78,1.06 +-0.40,-0.60,-0.45,0.53,0.26,2.78,1.06 +-0.40,-0.60,-0.45,0.53,0.26,2.77,1.06 +-0.40,-0.60,-0.45,0.53,0.26,2.77,1.05 +-0.40,-0.60,-0.45,0.53,0.26,2.76,1.05 +-0.40,-0.60,-0.46,0.53,0.27,2.75,1.05 +-0.40,-0.59,-0.46,0.53,0.27,2.75,1.05 +-0.40,-0.59,-0.46,0.52,0.27,2.74,1.05 +-0.40,-0.59,-0.46,0.52,0.27,2.74,1.05 +-0.40,-0.59,-0.46,0.52,0.27,2.73,1.05 +-0.40,-0.59,-0.46,0.52,0.27,2.73,1.05 +-0.40,-0.59,-0.46,0.52,0.28,2.72,1.04 +-0.40,-0.59,-0.46,0.52,0.28,2.72,1.04 +-0.40,-0.59,-0.46,0.52,0.28,2.71,1.04 +-0.41,-0.59,-0.46,0.52,0.28,2.70,1.04 +-0.41,-0.59,-0.46,0.52,0.28,2.70,1.04 +-0.41,-0.59,-0.46,0.52,0.29,2.69,1.04 +-0.41,-0.59,-0.46,0.52,0.29,2.69,1.04 +-0.41,-0.59,-0.46,0.52,0.29,2.68,1.04 +-0.41,-0.59,-0.46,0.52,0.29,2.68,1.04 +-0.41,-0.59,-0.47,0.52,0.29,2.67,1.03 +-0.41,-0.59,-0.47,0.52,0.30,2.67,1.03 +-0.41,-0.59,-0.47,0.52,0.30,2.66,1.03 +-0.41,-0.59,-0.47,0.52,0.30,2.66,1.03 +-0.41,-0.59,-0.47,0.51,0.30,2.65,1.03 +-0.41,-0.59,-0.47,0.51,0.30,2.64,1.03 +-0.41,-0.59,-0.47,0.51,0.31,2.64,1.03 +-0.41,-0.59,-0.47,0.51,0.31,2.63,1.03 +-0.41,-0.59,-0.47,0.51,0.31,2.63,1.03 +-0.41,-0.59,-0.47,0.51,0.31,2.62,1.02 +-0.41,-0.59,-0.47,0.51,0.31,2.62,1.02 +-0.41,-0.59,-0.47,0.51,0.32,2.61,1.02 +-0.41,-0.59,-0.47,0.51,0.32,2.61,1.02 +-0.41,-0.59,-0.47,0.51,0.32,2.60,1.02 +-0.41,-0.59,-0.48,0.51,0.32,2.60,1.02 +-0.41,-0.59,-0.48,0.51,0.32,2.59,1.02 +-0.41,-0.59,-0.48,0.51,0.33,2.58,1.02 +-0.41,-0.59,-0.48,0.51,0.33,2.58,1.01 +-0.41,-0.59,-0.48,0.51,0.33,2.57,1.01 +-0.41,-0.59,-0.48,0.51,0.33,2.57,1.01 +-0.41,-0.59,-0.48,0.51,0.34,2.56,1.01 +-0.41,-0.59,-0.48,0.50,0.34,2.56,1.01 +-0.41,-0.59,-0.48,0.50,0.34,2.55,1.01 +-0.41,-0.59,-0.48,0.50,0.34,2.55,1.01 +-0.41,-0.59,-0.48,0.50,0.34,2.54,1.01 +-0.41,-0.59,-0.48,0.50,0.35,2.54,1.01 +-0.41,-0.58,-0.48,0.50,0.35,2.53,1.00 +-0.42,-0.58,-0.48,0.50,0.35,2.52,1.00 +-0.42,-0.58,-0.48,0.50,0.35,2.52,1.00 +-0.42,-0.58,-0.49,0.50,0.35,2.51,1.00 +-0.42,-0.58,-0.49,0.50,0.36,2.51,1.00 +-0.42,-0.58,-0.49,0.50,0.36,2.50,1.00 +-0.42,-0.58,-0.49,0.50,0.36,2.50,1.00 +-0.42,-0.58,-0.49,0.50,0.36,2.49,1.00 +-0.42,-0.58,-0.49,0.50,0.37,2.49,0.99 +-0.42,-0.58,-0.49,0.50,0.37,2.48,0.99 +-0.42,-0.58,-0.49,0.50,0.37,2.48,0.99 +-0.42,-0.58,-0.49,0.50,0.37,2.47,0.99 +-0.42,-0.58,-0.49,0.50,0.37,2.46,0.99 +-0.42,-0.58,-0.49,0.49,0.38,2.46,0.99 +-0.42,-0.58,-0.49,0.49,0.38,2.45,0.99 +-0.42,-0.58,-0.49,0.49,0.38,2.45,0.99 +-0.42,-0.58,-0.49,0.49,0.38,2.44,0.99 +-0.42,-0.58,-0.49,0.49,0.39,2.44,0.98 +-0.42,-0.58,-0.50,0.49,0.39,2.43,0.98 +-0.42,-0.58,-0.50,0.49,0.39,2.43,0.98 +-0.42,-0.58,-0.50,0.49,0.39,2.42,0.98 +-0.42,-0.58,-0.50,0.49,0.39,2.42,0.98 +-0.42,-0.58,-0.50,0.49,0.40,2.41,0.98 +-0.42,-0.58,-0.50,0.49,0.40,2.41,0.98 +-0.42,-0.58,-0.50,0.49,0.40,2.40,0.98 +-0.42,-0.58,-0.50,0.49,0.40,2.39,0.97 +-0.42,-0.58,-0.50,0.49,0.41,2.39,0.97 +-0.42,-0.58,-0.50,0.49,0.41,2.38,0.97 +-0.42,-0.58,-0.50,0.49,0.41,2.38,0.97 +-0.42,-0.58,-0.50,0.49,0.41,2.37,0.97 +-0.42,-0.58,-0.50,0.48,0.41,2.37,0.97 +-0.42,-0.58,-0.50,0.48,0.42,2.36,0.97 +-0.42,-0.58,-0.51,0.48,0.42,2.36,0.97 +-0.42,-0.58,-0.51,0.48,0.42,2.35,0.97 +-0.42,-0.58,-0.51,0.48,0.42,2.35,0.96 +-0.42,-0.58,-0.51,0.48,0.43,2.34,0.96 +-0.42,-0.57,-0.51,0.48,0.43,2.33,0.96 +-0.43,-0.57,-0.51,0.48,0.43,2.33,0.96 +-0.43,-0.57,-0.51,0.48,0.43,2.32,0.96 +-0.43,-0.57,-0.51,0.48,0.44,2.32,0.96 +-0.43,-0.57,-0.51,0.48,0.44,2.31,0.96 +-0.43,-0.57,-0.51,0.48,0.44,2.31,0.96 +-0.43,-0.57,-0.51,0.48,0.44,2.30,0.95 +-0.43,-0.57,-0.51,0.48,0.45,2.30,0.95 +-0.43,-0.57,-0.51,0.48,0.45,2.29,0.95 +-0.43,-0.57,-0.51,0.48,0.45,2.29,0.95 +-0.43,-0.57,-0.51,0.48,0.45,2.28,0.95 +-0.43,-0.57,-0.52,0.47,0.46,2.28,0.95 +-0.43,-0.57,-0.52,0.47,0.46,2.27,0.95 +-0.43,-0.57,-0.52,0.47,0.46,2.26,0.95 +-0.43,-0.57,-0.52,0.47,0.46,2.26,0.95 +-0.43,-0.57,-0.52,0.47,0.47,2.25,0.94 +-0.43,-0.57,-0.52,0.47,0.47,2.25,0.94 +-0.43,-0.57,-0.52,0.47,0.47,2.24,0.94 +-0.43,-0.57,-0.52,0.47,0.47,2.24,0.94 +-0.43,-0.57,-0.52,0.47,0.48,2.23,0.94 +-0.43,-0.57,-0.52,0.47,0.48,2.23,0.94 +-0.43,-0.57,-0.52,0.47,0.48,2.22,0.94 +-0.43,-0.57,-0.52,0.47,0.48,2.22,0.94 +-0.43,-0.57,-0.52,0.47,0.49,2.21,0.93 +-0.43,-0.57,-0.52,0.47,0.49,2.21,0.93 +-0.43,-0.57,-0.52,0.47,0.49,2.20,0.93 +-0.43,-0.57,-0.53,0.47,0.49,2.19,0.93 +-0.43,-0.57,-0.53,0.46,0.50,2.19,0.93 +-0.43,-0.57,-0.53,0.46,0.50,2.18,0.93 +-0.43,-0.57,-0.53,0.46,0.50,2.18,0.93 +-0.43,-0.57,-0.53,0.46,0.50,2.17,0.93 +-0.43,-0.57,-0.53,0.46,0.51,2.17,0.93 +-0.43,-0.56,-0.53,0.46,0.51,2.16,0.92 +-0.43,-0.56,-0.53,0.46,0.51,2.16,0.92 +-0.43,-0.56,-0.53,0.46,0.51,2.15,0.92 +-0.43,-0.56,-0.53,0.46,0.52,2.15,0.92 +-0.43,-0.56,-0.53,0.46,0.52,2.14,0.92 +-0.43,-0.56,-0.53,0.46,0.52,2.14,0.92 +-0.43,-0.56,-0.53,0.46,0.52,2.13,0.92 +-0.43,-0.56,-0.53,0.46,0.53,2.13,0.92 +-0.43,-0.56,-0.53,0.46,0.53,2.12,0.91 +-0.44,-0.56,-0.54,0.46,0.53,2.11,0.91 +-0.44,-0.56,-0.54,0.46,0.53,2.11,0.91 +-0.44,-0.56,-0.54,0.46,0.54,2.10,0.91 +-0.44,-0.56,-0.54,0.45,0.54,2.10,0.91 +-0.44,-0.56,-0.54,0.45,0.54,2.09,0.91 +-0.44,-0.56,-0.54,0.45,0.55,2.09,0.91 +-0.44,-0.56,-0.54,0.45,0.55,2.08,0.91 +-0.44,-0.56,-0.54,0.45,0.55,2.08,0.90 +-0.44,-0.56,-0.54,0.45,0.55,2.07,0.90 +-0.44,-0.56,-0.54,0.45,0.56,2.07,0.90 +-0.44,-0.56,-0.54,0.45,0.56,2.06,0.90 +-0.44,-0.56,-0.54,0.45,0.56,2.06,0.90 +-0.44,-0.56,-0.54,0.45,0.56,2.05,0.90 +-0.44,-0.56,-0.54,0.45,0.57,2.05,0.90 +-0.44,-0.56,-0.54,0.45,0.57,2.04,0.90 +-0.44,-0.56,-0.55,0.45,0.57,2.03,0.90 +-0.44,-0.56,-0.55,0.45,0.58,2.03,0.89 +-0.44,-0.56,-0.55,0.45,0.58,2.02,0.89 +-0.44,-0.56,-0.55,0.45,0.58,2.02,0.89 +-0.44,-0.56,-0.55,0.45,0.58,2.01,0.89 +-0.44,-0.56,-0.55,0.44,0.59,2.01,0.89 +-0.44,-0.55,-0.55,0.44,0.59,2.00,0.89 +-0.44,-0.55,-0.55,0.44,0.59,2.00,0.89 +-0.44,-0.55,-0.55,0.44,0.59,1.99,0.89 +-0.44,-0.55,-0.55,0.44,0.60,1.99,0.88 +-0.44,-0.55,-0.55,0.44,0.60,1.98,0.88 +-0.44,-0.55,-0.55,0.44,0.60,1.98,0.88 +-0.44,-0.55,-0.55,0.44,0.61,1.97,0.88 +-0.44,-0.55,-0.55,0.44,0.61,1.97,0.88 +-0.44,-0.55,-0.55,0.44,0.61,1.96,0.88 +-0.44,-0.55,-0.56,0.44,0.61,1.96,0.88 +-0.44,-0.55,-0.56,0.44,0.62,1.95,0.88 +-0.44,-0.55,-0.56,0.44,0.62,1.94,0.88 +-0.44,-0.55,-0.56,0.44,0.62,1.94,0.87 +-0.44,-0.55,-0.56,0.44,0.63,1.93,0.87 +-0.44,-0.55,-0.56,0.44,0.63,1.93,0.87 +-0.44,-0.55,-0.56,0.44,0.63,1.92,0.87 +-0.44,-0.55,-0.56,0.43,0.63,1.92,0.87 +-0.44,-0.55,-0.56,0.43,0.64,1.91,0.87 +-0.44,-0.55,-0.56,0.43,0.64,1.91,0.87 +-0.44,-0.55,-0.56,0.43,0.64,1.90,0.87 +-0.44,-0.55,-0.56,0.43,0.65,1.90,0.86 +-0.44,-0.55,-0.56,0.43,0.65,1.89,0.86 +-0.44,-0.55,-0.56,0.43,0.65,1.89,0.86 +-0.44,-0.55,-0.56,0.43,0.66,1.88,0.86 +-0.44,-0.55,-0.57,0.43,0.66,1.88,0.86 +-0.44,-0.55,-0.57,0.43,0.66,1.87,0.86 +-0.45,-0.55,-0.57,0.43,0.66,1.87,0.86 +-0.45,-0.55,-0.57,0.43,0.67,1.86,0.86 +-0.45,-0.54,-0.57,0.43,0.67,1.86,0.85 +-0.45,-0.54,-0.57,0.43,0.67,1.85,0.85 +-0.45,-0.54,-0.57,0.43,0.68,1.85,0.85 +-0.45,-0.54,-0.57,0.43,0.68,1.84,0.85 +-0.45,-0.54,-0.57,0.42,0.68,1.83,0.85 +-0.45,-0.54,-0.57,0.42,0.68,1.83,0.85 +-0.45,-0.54,-0.57,0.42,0.69,1.82,0.85 +-0.45,-0.54,-0.57,0.42,0.69,1.82,0.85 +-0.45,-0.54,-0.57,0.42,0.69,1.81,0.85 +-0.45,-0.54,-0.57,0.42,0.70,1.81,0.84 +-0.45,-0.54,-0.57,0.42,0.70,1.80,0.84 +-0.45,-0.54,-0.57,0.42,0.70,1.80,0.84 +-0.45,-0.54,-0.58,0.42,0.71,1.79,0.84 +-0.45,-0.54,-0.58,0.42,0.71,1.79,0.84 +-0.45,-0.54,-0.58,0.42,0.71,1.78,0.84 +-0.45,-0.54,-0.58,0.42,0.72,1.78,0.84 +-0.45,-0.54,-0.58,0.42,0.72,1.77,0.84 +-0.45,-0.54,-0.58,0.42,0.72,1.77,0.83 +-0.45,-0.54,-0.58,0.42,0.72,1.76,0.83 +-0.45,-0.54,-0.58,0.42,0.73,1.76,0.83 +-0.45,-0.54,-0.58,0.42,0.73,1.75,0.83 +-0.45,-0.54,-0.58,0.41,0.73,1.75,0.83 +-0.45,-0.54,-0.58,0.41,0.74,1.74,0.83 +-0.45,-0.54,-0.58,0.41,0.74,1.74,0.83 +-0.45,-0.54,-0.58,0.41,0.74,1.73,0.83 +-0.45,-0.54,-0.58,0.41,0.75,1.73,0.82 +-0.45,-0.53,-0.58,0.41,0.75,1.72,0.82 +-0.45,-0.53,-0.59,0.41,0.75,1.72,0.82 +-0.45,-0.53,-0.59,0.41,0.76,1.71,0.82 +-0.45,-0.53,-0.59,0.41,0.76,1.70,0.82 +-0.45,-0.53,-0.59,0.41,0.76,1.70,0.82 +-0.45,-0.53,-0.59,0.41,0.76,1.69,0.82 +-0.45,-0.53,-0.59,0.41,0.77,1.69,0.82 +-0.45,-0.53,-0.59,0.41,0.77,1.68,0.82 +-0.45,-0.53,-0.59,0.41,0.77,1.68,0.81 +-0.45,-0.53,-0.59,0.41,0.78,1.67,0.81 +-0.45,-0.53,-0.59,0.41,0.78,1.67,0.81 +-0.45,-0.53,-0.59,0.41,0.78,1.66,0.81 +-0.45,-0.53,-0.59,0.40,0.79,1.66,0.81 +-0.45,-0.53,-0.59,0.40,0.79,1.65,0.81 +-0.45,-0.53,-0.59,0.40,0.79,1.65,0.81 +-0.45,-0.53,-0.59,0.40,0.80,1.64,0.81 +-0.45,-0.53,-0.59,0.40,0.80,1.64,0.80 +-0.45,-0.53,-0.60,0.40,0.80,1.63,0.80 +-0.45,-0.53,-0.60,0.40,0.81,1.63,0.80 +-0.45,-0.53,-0.60,0.40,0.81,1.62,0.80 +-0.45,-0.53,-0.60,0.40,0.81,1.62,0.80 +-0.45,-0.53,-0.60,0.40,0.82,1.61,0.80 +-0.45,-0.53,-0.60,0.40,0.82,1.61,0.80 +-0.45,-0.53,-0.60,0.40,0.82,1.60,0.80 +-0.45,-0.53,-0.60,0.40,0.83,1.60,0.79 +-0.45,-0.52,-0.60,0.40,0.83,1.59,0.79 +-0.45,-0.52,-0.60,0.40,0.83,1.59,0.79 +-0.45,-0.52,-0.60,0.40,0.84,1.58,0.79 +-0.45,-0.52,-0.60,0.40,0.84,1.58,0.79 +-0.45,-0.52,-0.60,0.39,0.84,1.57,0.79 +-0.46,-0.52,-0.60,0.39,0.85,1.57,0.79 +-0.46,-0.52,-0.60,0.39,0.85,1.56,0.79 +-0.46,-0.52,-0.61,0.39,0.85,1.56,0.79 +-0.46,-0.52,-0.61,0.39,0.86,1.55,0.78 +-0.46,-0.52,-0.61,0.39,0.86,1.55,0.78 +-0.46,-0.52,-0.61,0.39,0.86,1.54,0.78 +-0.46,-0.52,-0.61,0.39,0.87,1.54,0.78 +-0.46,-0.52,-0.61,0.39,0.87,1.53,0.78 +-0.46,-0.52,-0.61,0.39,0.87,1.53,0.78 +-0.46,-0.52,-0.61,0.39,0.88,1.52,0.78 +-0.46,-0.52,-0.61,0.39,0.88,1.52,0.78 +-0.46,-0.52,-0.61,0.39,0.88,1.51,0.77 +-0.46,-0.52,-0.61,0.39,0.89,1.51,0.77 +-0.46,-0.52,-0.61,0.39,0.89,1.50,0.77 +-0.46,-0.52,-0.61,0.39,0.89,1.49,0.77 +-0.46,-0.52,-0.61,0.38,0.90,1.49,0.77 +-0.46,-0.52,-0.61,0.38,0.90,1.48,0.77 +-0.46,-0.52,-0.61,0.38,0.90,1.48,0.77 +-0.46,-0.52,-0.62,0.38,0.91,1.47,0.77 +-0.46,-0.51,-0.62,0.38,0.91,1.47,0.76 +-0.46,-0.51,-0.62,0.38,0.91,1.46,0.76 +-0.46,-0.51,-0.62,0.38,0.92,1.46,0.76 +-0.46,-0.51,-0.62,0.38,0.92,1.45,0.76 +-0.46,-0.51,-0.62,0.38,0.92,1.45,0.76 +-0.46,-0.51,-0.62,0.38,0.93,1.44,0.76 +-0.46,-0.51,-0.62,0.38,0.93,1.44,0.76 +-0.46,-0.51,-0.62,0.38,0.93,1.43,0.76 +-0.46,-0.51,-0.62,0.38,0.94,1.43,0.76 +-0.46,-0.51,-0.62,0.38,0.94,1.42,0.75 +-0.46,-0.51,-0.62,0.38,0.95,1.42,0.75 +-0.46,-0.51,-0.62,0.38,0.95,1.41,0.75 +-0.46,-0.51,-0.62,0.38,0.95,1.41,0.75 +-0.46,-0.51,-0.62,0.37,0.96,1.40,0.75 +-0.46,-0.51,-0.62,0.37,0.96,1.40,0.75 +-0.46,-0.51,-0.63,0.37,0.96,1.39,0.75 +-0.46,-0.51,-0.63,0.37,0.97,1.39,0.75 +-0.46,-0.51,-0.63,0.37,0.97,1.38,0.74 +-0.46,-0.51,-0.63,0.37,0.97,1.38,0.74 +-0.46,-0.51,-0.63,0.37,0.98,1.37,0.74 +-0.46,-0.51,-0.63,0.37,0.98,1.37,0.74 +-0.46,-0.51,-0.63,0.37,0.98,1.36,0.74 +-0.46,-0.50,-0.63,0.37,0.99,1.36,0.74 +-0.46,-0.50,-0.63,0.37,0.99,1.35,0.74 +-0.46,-0.50,-0.63,0.37,1.00,1.35,0.74 +-0.46,-0.50,-0.63,0.37,1.00,1.34,0.73 +-0.46,-0.50,-0.63,0.37,1.00,1.34,0.73 +-0.46,-0.50,-0.63,0.37,1.01,1.33,0.73 +-0.46,-0.50,-0.63,0.37,1.01,1.33,0.73 +-0.46,-0.50,-0.63,0.37,1.01,1.32,0.73 +-0.46,-0.50,-0.63,0.36,1.02,1.32,0.73 +-0.46,-0.50,-0.64,0.36,1.02,1.31,0.73 +-0.46,-0.50,-0.64,0.36,1.02,1.31,0.73 +-0.46,-0.50,-0.64,0.36,1.03,1.30,0.73 +-0.46,-0.50,-0.64,0.36,1.03,1.30,0.72 +-0.46,-0.50,-0.64,0.36,1.03,1.29,0.72 +-0.46,-0.50,-0.64,0.36,1.04,1.29,0.72 +-0.46,-0.50,-0.64,0.36,1.04,1.28,0.72 +-0.46,-0.50,-0.64,0.36,1.05,1.28,0.72 +-0.46,-0.50,-0.64,0.36,1.05,1.27,0.72 +-0.46,-0.50,-0.64,0.36,1.05,1.27,0.72 +-0.46,-0.50,-0.64,0.36,1.06,1.26,0.72 +-0.46,-0.50,-0.64,0.36,1.06,1.26,0.71 +-0.46,-0.50,-0.64,0.36,1.06,1.26,0.71 +-0.46,-0.49,-0.64,0.36,1.07,1.25,0.71 +-0.46,-0.49,-0.64,0.36,1.07,1.25,0.71 +-0.46,-0.49,-0.64,0.35,1.08,1.24,0.71 +-0.46,-0.49,-0.65,0.35,1.08,1.24,0.71 +-0.46,-0.49,-0.65,0.35,1.08,1.23,0.71 +-0.46,-0.49,-0.65,0.35,1.09,1.23,0.71 +-0.46,-0.49,-0.65,0.35,1.09,1.22,0.71 +-0.46,-0.49,-0.65,0.35,1.09,1.22,0.70 +-0.46,-0.49,-0.65,0.35,1.10,1.21,0.70 +-0.46,-0.49,-0.65,0.35,1.10,1.21,0.70 +-0.46,-0.49,-0.65,0.35,1.11,1.20,0.70 +-0.46,-0.49,-0.65,0.35,1.11,1.20,0.70 +-0.46,-0.49,-0.65,0.35,1.11,1.19,0.70 +-0.46,-0.49,-0.65,0.35,1.12,1.19,0.70 +-0.46,-0.49,-0.65,0.35,1.12,1.18,0.70 +-0.46,-0.49,-0.65,0.35,1.12,1.18,0.69 +-0.46,-0.49,-0.65,0.35,1.13,1.17,0.69 +-0.46,-0.49,-0.65,0.35,1.13,1.17,0.69 +-0.46,-0.49,-0.65,0.35,1.14,1.16,0.69 +-0.46,-0.49,-0.65,0.34,1.14,1.16,0.69 +-0.46,-0.49,-0.66,0.34,1.14,1.15,0.69 +-0.46,-0.48,-0.66,0.34,1.15,1.15,0.69 +-0.47,-0.48,-0.66,0.34,1.15,1.14,0.69 +-0.47,-0.48,-0.66,0.34,1.16,1.14,0.68 +-0.47,-0.48,-0.66,0.34,1.16,1.13,0.68 +-0.47,-0.48,-0.66,0.34,1.16,1.13,0.68 +-0.47,-0.48,-0.66,0.34,1.17,1.12,0.68 +-0.47,-0.48,-0.66,0.34,1.17,1.12,0.68 +-0.47,-0.48,-0.66,0.34,1.17,1.11,0.68 +-0.47,-0.48,-0.66,0.34,1.18,1.11,0.68 +-0.47,-0.48,-0.66,0.34,1.18,1.10,0.68 +-0.47,-0.48,-0.66,0.34,1.19,1.10,0.68 +-0.47,-0.48,-0.66,0.34,1.19,1.09,0.67 +-0.47,-0.48,-0.66,0.34,1.19,1.09,0.67 +-0.47,-0.48,-0.66,0.34,1.20,1.08,0.67 +-0.47,-0.48,-0.66,0.34,1.20,1.08,0.67 +-0.47,-0.48,-0.67,0.33,1.21,1.08,0.67 +-0.47,-0.48,-0.67,0.33,1.21,1.07,0.67 +-0.47,-0.48,-0.67,0.33,1.21,1.07,0.67 +-0.47,-0.48,-0.67,0.33,1.22,1.06,0.67 +-0.47,-0.48,-0.67,0.33,1.22,1.06,0.66 +-0.47,-0.48,-0.67,0.33,1.23,1.05,0.66 +-0.47,-0.47,-0.67,0.33,1.23,1.05,0.66 +-0.47,-0.47,-0.67,0.33,1.23,1.04,0.66 +-0.47,-0.47,-0.67,0.33,1.24,1.04,0.66 +-0.47,-0.47,-0.67,0.33,1.24,1.03,0.66 +-0.47,-0.47,-0.67,0.33,1.25,1.03,0.66 +-0.47,-0.47,-0.67,0.33,1.25,1.02,0.66 +-0.47,-0.47,-0.67,0.33,1.25,1.02,0.66 +-0.47,-0.47,-0.67,0.33,1.26,1.01,0.65 +-0.47,-0.47,-0.67,0.33,1.26,1.01,0.65 +-0.47,-0.47,-0.67,0.33,1.27,1.00,0.65 +-0.47,-0.47,-0.67,0.33,1.27,1.00,0.65 +-0.47,-0.47,-0.68,0.32,1.27,0.99,0.65 +-0.47,-0.47,-0.68,0.32,1.28,0.99,0.65 +-0.47,-0.47,-0.68,0.32,1.28,0.98,0.65 +-0.47,-0.47,-0.68,0.32,1.29,0.98,0.65 +-0.47,-0.47,-0.68,0.32,1.29,0.98,0.64 +-0.47,-0.47,-0.68,0.32,1.29,0.97,0.64 +-0.47,-0.47,-0.68,0.32,1.30,0.97,0.64 +-0.47,-0.47,-0.68,0.32,1.30,0.96,0.64 +-0.47,-0.47,-0.68,0.32,1.31,0.96,0.64 +-0.47,-0.46,-0.68,0.32,1.31,0.95,0.64 +-0.47,-0.46,-0.68,0.32,1.31,0.95,0.64 +-0.47,-0.46,-0.68,0.32,1.32,0.94,0.64 +-0.47,-0.46,-0.68,0.32,1.32,0.94,0.64 +-0.47,-0.46,-0.68,0.32,1.33,0.93,0.63 +-0.47,-0.46,-0.68,0.32,1.33,0.93,0.63 +-0.47,-0.46,-0.68,0.32,1.34,0.92,0.63 +-0.47,-0.46,-0.68,0.32,1.34,0.92,0.63 +-0.47,-0.46,-0.69,0.31,1.34,0.91,0.63 +-0.47,-0.46,-0.69,0.31,1.35,0.91,0.63 +-0.47,-0.46,-0.69,0.31,1.35,0.90,0.63 +-0.47,-0.46,-0.69,0.31,1.36,0.90,0.63 +-0.47,-0.46,-0.69,0.31,1.36,0.90,0.62 +-0.47,-0.46,-0.69,0.31,1.36,0.89,0.62 +-0.47,-0.46,-0.69,0.31,1.37,0.89,0.62 +-0.47,-0.46,-0.69,0.31,1.37,0.88,0.62 +-0.47,-0.46,-0.69,0.31,1.38,0.88,0.62 +-0.47,-0.46,-0.69,0.31,1.38,0.87,0.62 +-0.47,-0.46,-0.69,0.31,1.39,0.87,0.62 +-0.47,-0.45,-0.69,0.31,1.39,0.86,0.62 +-0.47,-0.45,-0.69,0.31,1.39,0.86,0.61 +-0.47,-0.45,-0.69,0.31,1.40,0.85,0.61 +-0.47,-0.45,-0.69,0.31,1.40,0.85,0.61 +-0.47,-0.45,-0.69,0.31,1.41,0.84,0.61 +-0.47,-0.45,-0.69,0.31,1.41,0.84,0.61 +-0.47,-0.45,-0.70,0.30,1.41,0.83,0.61 +-0.47,-0.45,-0.70,0.30,1.42,0.83,0.61 +-0.47,-0.45,-0.70,0.30,1.42,0.83,0.61 +-0.47,-0.45,-0.70,0.30,1.43,0.82,0.61 +-0.47,-0.45,-0.70,0.30,1.43,0.82,0.60 +-0.47,-0.45,-0.70,0.30,1.44,0.81,0.60 +-0.47,-0.45,-0.70,0.30,1.44,0.81,0.60 +-0.47,-0.45,-0.70,0.30,1.44,0.80,0.60 +-0.47,-0.45,-0.70,0.30,1.45,0.80,0.60 +-0.47,-0.45,-0.70,0.30,1.45,0.79,0.60 +-0.47,-0.45,-0.70,0.30,1.46,0.79,0.60 +-0.47,-0.45,-0.70,0.30,1.46,0.78,0.60 +-0.47,-0.45,-0.70,0.30,1.47,0.78,0.60 +-0.47,-0.44,-0.70,0.30,1.47,0.78,0.59 +-0.47,-0.44,-0.70,0.30,1.48,0.77,0.59 +-0.47,-0.44,-0.70,0.30,1.48,0.77,0.59 +-0.47,-0.44,-0.70,0.30,1.48,0.76,0.59 +-0.47,-0.44,-0.71,0.29,1.49,0.76,0.59 +-0.47,-0.44,-0.71,0.29,1.49,0.75,0.59 +-0.47,-0.44,-0.71,0.29,1.50,0.75,0.59 +-0.47,-0.44,-0.71,0.29,1.50,0.74,0.59 +-0.47,-0.44,-0.71,0.29,1.51,0.74,0.58 +-0.47,-0.44,-0.71,0.29,1.51,0.73,0.58 +-0.47,-0.44,-0.71,0.29,1.51,0.73,0.58 +-0.47,-0.44,-0.71,0.29,1.52,0.73,0.58 +-0.47,-0.44,-0.71,0.29,1.52,0.72,0.58 +-0.47,-0.44,-0.71,0.29,1.53,0.72,0.58 +-0.47,-0.44,-0.71,0.29,1.53,0.71,0.58 +-0.47,-0.44,-0.71,0.29,1.54,0.71,0.58 +-0.47,-0.44,-0.71,0.29,1.54,0.70,0.58 +-0.47,-0.44,-0.71,0.29,1.54,0.70,0.57 +-0.47,-0.43,-0.71,0.29,1.55,0.69,0.57 +-0.47,-0.43,-0.71,0.29,1.55,0.69,0.57 +-0.47,-0.43,-0.71,0.29,1.56,0.68,0.57 +-0.47,-0.43,-0.71,0.28,1.56,0.68,0.57 +-0.47,-0.43,-0.72,0.28,1.57,0.68,0.57 +-0.47,-0.43,-0.72,0.28,1.57,0.67,0.57 +-0.47,-0.43,-0.72,0.28,1.58,0.67,0.57 +-0.47,-0.43,-0.72,0.28,1.58,0.66,0.56 +-0.47,-0.43,-0.72,0.28,1.59,0.66,0.56 +-0.47,-0.43,-0.72,0.28,1.59,0.65,0.56 +-0.47,-0.43,-0.72,0.28,1.59,0.65,0.56 +-0.47,-0.43,-0.72,0.28,1.60,0.64,0.56 +-0.47,-0.43,-0.72,0.28,1.60,0.64,0.56 +-0.47,-0.43,-0.72,0.28,1.61,0.64,0.56 +-0.47,-0.43,-0.72,0.28,1.61,0.63,0.56 +-0.47,-0.43,-0.72,0.28,1.62,0.63,0.56 +-0.47,-0.43,-0.72,0.28,1.62,0.62,0.55 +-0.47,-0.43,-0.72,0.28,1.63,0.62,0.55 +-0.47,-0.42,-0.72,0.28,1.63,0.61,0.55 +-0.47,-0.42,-0.72,0.28,1.63,0.61,0.55 +-0.47,-0.42,-0.72,0.27,1.64,0.60,0.55 +-0.47,-0.42,-0.72,0.27,1.64,0.60,0.55 +-0.47,-0.42,-0.73,0.27,1.65,0.60,0.55 +-0.47,-0.42,-0.73,0.27,1.65,0.59,0.55 +-0.47,-0.42,-0.73,0.27,1.66,0.59,0.55 +-0.47,-0.42,-0.73,0.27,1.66,0.58,0.54 +-0.47,-0.42,-0.73,0.27,1.67,0.58,0.54 +-0.47,-0.42,-0.73,0.27,1.67,0.57,0.54 +-0.47,-0.42,-0.73,0.27,1.68,0.57,0.54 +-0.47,-0.42,-0.73,0.27,1.68,0.56,0.54 +-0.47,-0.42,-0.73,0.27,1.68,0.56,0.54 +-0.47,-0.42,-0.73,0.27,1.69,0.56,0.54 +-0.47,-0.42,-0.73,0.27,1.69,0.55,0.54 +-0.47,-0.42,-0.73,0.27,1.70,0.55,0.53 +-0.47,-0.42,-0.73,0.27,1.70,0.54,0.53 +-0.47,-0.41,-0.73,0.27,1.71,0.54,0.53 +-0.47,-0.41,-0.73,0.27,1.71,0.53,0.53 +-0.47,-0.41,-0.73,0.27,1.72,0.53,0.53 +-0.47,-0.41,-0.73,0.26,1.72,0.53,0.53 +-0.47,-0.41,-0.73,0.26,1.73,0.52,0.53 +-0.47,-0.41,-0.74,0.26,1.73,0.52,0.53 +-0.47,-0.41,-0.74,0.26,1.74,0.51,0.53 +-0.47,-0.41,-0.74,0.26,1.74,0.51,0.52 +-0.47,-0.41,-0.74,0.26,1.75,0.50,0.52 +-0.47,-0.41,-0.74,0.26,1.75,0.50,0.52 +-0.47,-0.41,-0.74,0.26,1.75,0.50,0.52 +-0.47,-0.41,-0.74,0.26,1.76,0.49,0.52 +-0.47,-0.41,-0.74,0.26,1.76,0.49,0.52 +-0.47,-0.41,-0.74,0.26,1.77,0.48,0.52 +-0.47,-0.41,-0.74,0.26,1.77,0.48,0.52 +-0.47,-0.41,-0.74,0.26,1.78,0.47,0.52 +-0.47,-0.41,-0.74,0.26,1.78,0.47,0.51 +-0.47,-0.40,-0.74,0.26,1.79,0.47,0.51 +-0.47,-0.40,-0.74,0.26,1.79,0.46,0.51 +-0.47,-0.40,-0.74,0.26,1.80,0.46,0.51 +-0.47,-0.40,-0.74,0.25,1.80,0.45,0.51 +-0.47,-0.40,-0.74,0.25,1.81,0.45,0.51 +-0.47,-0.40,-0.74,0.25,1.81,0.44,0.51 +-0.47,-0.40,-0.74,0.25,1.82,0.44,0.51 +-0.47,-0.40,-0.75,0.25,1.82,0.44,0.50 +-0.47,-0.40,-0.75,0.25,1.83,0.43,0.50 +-0.47,-0.40,-0.75,0.25,1.83,0.43,0.50 +-0.47,-0.40,-0.75,0.25,1.83,0.42,0.50 +-0.47,-0.40,-0.75,0.25,1.84,0.42,0.50 +-0.47,-0.40,-0.75,0.25,1.84,0.41,0.50 +-0.47,-0.40,-0.75,0.25,1.85,0.41,0.50 +-0.47,-0.40,-0.75,0.25,1.85,0.41,0.50 +-0.47,-0.40,-0.75,0.25,1.86,0.40,0.50 +-0.47,-0.40,-0.75,0.25,1.86,0.40,0.49 +-0.47,-0.39,-0.75,0.25,1.87,0.39,0.49 +-0.47,-0.39,-0.75,0.25,1.87,0.39,0.49 +-0.47,-0.39,-0.75,0.25,1.88,0.38,0.49 +-0.47,-0.39,-0.75,0.25,1.88,0.38,0.49 +-0.47,-0.39,-0.75,0.24,1.89,0.38,0.49 +-0.47,-0.39,-0.75,0.24,1.89,0.37,0.49 +-0.47,-0.39,-0.75,0.24,1.90,0.37,0.49 +-0.47,-0.39,-0.75,0.24,1.90,0.36,0.49 +-0.47,-0.39,-0.75,0.24,1.91,0.36,0.48 +-0.47,-0.39,-0.76,0.24,1.91,0.36,0.48 +-0.47,-0.39,-0.76,0.24,1.92,0.35,0.48 +-0.47,-0.39,-0.76,0.24,1.92,0.35,0.48 +-0.47,-0.39,-0.76,0.24,1.93,0.34,0.48 +-0.47,-0.39,-0.76,0.24,1.93,0.34,0.48 +-0.47,-0.39,-0.76,0.24,1.94,0.33,0.48 +-0.47,-0.39,-0.76,0.24,1.94,0.33,0.48 +-0.47,-0.39,-0.76,0.24,1.95,0.33,0.48 +-0.47,-0.38,-0.76,0.24,1.95,0.32,0.47 +-0.47,-0.38,-0.76,0.24,1.96,0.32,0.47 +-0.47,-0.38,-0.76,0.24,1.96,0.31,0.47 +-0.47,-0.38,-0.76,0.24,1.97,0.31,0.47 +-0.47,-0.38,-0.76,0.23,1.97,0.31,0.47 +-0.47,-0.38,-0.76,0.23,1.98,0.30,0.47 +-0.47,-0.38,-0.76,0.23,1.98,0.30,0.47 +-0.47,-0.38,-0.76,0.23,1.99,0.29,0.47 +-0.47,-0.38,-0.76,0.23,1.99,0.29,0.47 +-0.47,-0.38,-0.76,0.23,2.00,0.29,0.46 +-0.47,-0.38,-0.76,0.23,2.00,0.28,0.46 +-0.47,-0.38,-0.77,0.23,2.01,0.28,0.46 +-0.47,-0.38,-0.77,0.23,2.01,0.27,0.46 +-0.47,-0.38,-0.77,0.23,2.02,0.27,0.46 +-0.47,-0.38,-0.77,0.23,2.02,0.26,0.46 +-0.47,-0.38,-0.77,0.23,2.03,0.26,0.46 +-0.47,-0.37,-0.77,0.23,2.03,0.26,0.46 +-0.47,-0.37,-0.77,0.23,2.04,0.25,0.46 +-0.47,-0.37,-0.77,0.23,2.04,0.25,0.45 +-0.47,-0.37,-0.77,0.23,2.05,0.24,0.45 +-0.47,-0.37,-0.77,0.23,2.05,0.24,0.45 +-0.47,-0.37,-0.77,0.23,2.06,0.24,0.45 +-0.47,-0.37,-0.77,0.22,2.06,0.23,0.45 +-0.47,-0.37,-0.77,0.22,2.07,0.23,0.45 +-0.47,-0.37,-0.77,0.22,2.07,0.22,0.45 +-0.47,-0.37,-0.77,0.22,2.08,0.22,0.45 +-0.47,-0.37,-0.77,0.22,2.08,0.22,0.45 +-0.47,-0.37,-0.77,0.22,2.09,0.21,0.44 +-0.47,-0.37,-0.77,0.22,2.09,0.21,0.44 +-0.47,-0.37,-0.77,0.22,2.10,0.20,0.44 +-0.47,-0.37,-0.77,0.22,2.10,0.20,0.44 +-0.47,-0.37,-0.78,0.22,2.11,0.20,0.44 +-0.47,-0.36,-0.78,0.22,2.11,0.19,0.44 +-0.47,-0.36,-0.78,0.22,2.12,0.19,0.44 +-0.47,-0.36,-0.78,0.22,2.12,0.18,0.44 +-0.47,-0.36,-0.78,0.22,2.13,0.18,0.44 +-0.47,-0.36,-0.78,0.22,2.13,0.18,0.43 +-0.47,-0.36,-0.78,0.22,2.14,0.17,0.43 +-0.47,-0.36,-0.78,0.22,2.14,0.17,0.43 +-0.47,-0.36,-0.78,0.22,2.15,0.16,0.43 +-0.47,-0.36,-0.78,0.21,2.15,0.16,0.43 +-0.47,-0.36,-0.78,0.21,2.16,0.16,0.43 +-0.47,-0.36,-0.78,0.21,2.16,0.15,0.43 +-0.47,-0.36,-0.78,0.21,2.17,0.15,0.43 +-0.47,-0.36,-0.78,0.21,2.17,0.15,0.43 +-0.47,-0.36,-0.78,0.21,2.18,0.14,0.42 +-0.47,-0.36,-0.78,0.21,2.18,0.14,0.42 +-0.47,-0.35,-0.78,0.21,2.19,0.13,0.42 +-0.47,-0.35,-0.78,0.21,2.19,0.13,0.42 +-0.47,-0.35,-0.78,0.21,2.20,0.13,0.42 +-0.47,-0.35,-0.78,0.21,2.20,0.12,0.42 +-0.46,-0.35,-0.78,0.21,2.21,0.12,0.42 +-0.46,-0.35,-0.79,0.21,2.21,0.11,0.42 +-0.46,-0.35,-0.79,0.21,2.22,0.11,0.42 +-0.46,-0.35,-0.79,0.21,2.22,0.11,0.41 +-0.46,-0.35,-0.79,0.21,2.23,0.10,0.41 +-0.46,-0.35,-0.79,0.21,2.23,0.10,0.41 +-0.46,-0.35,-0.79,0.21,2.24,0.09,0.41 +-0.46,-0.35,-0.79,0.20,2.24,0.09,0.41 +-0.46,-0.35,-0.79,0.20,2.25,0.09,0.41 +-0.46,-0.35,-0.79,0.20,2.25,0.08,0.41 +-0.46,-0.35,-0.79,0.20,2.26,0.08,0.41 +-0.46,-0.35,-0.79,0.20,2.27,0.08,0.41 +-0.46,-0.34,-0.79,0.20,2.27,0.07,0.40 +-0.46,-0.34,-0.79,0.20,2.28,0.07,0.40 +-0.46,-0.34,-0.79,0.20,2.28,0.06,0.40 +-0.46,-0.34,-0.79,0.20,2.29,0.06,0.40 +-0.46,-0.34,-0.79,0.20,2.29,0.06,0.40 +-0.46,-0.34,-0.79,0.20,2.30,0.05,0.40 +-0.46,-0.34,-0.79,0.20,2.30,0.05,0.40 +-0.46,-0.34,-0.79,0.20,2.31,0.05,0.40 +-0.46,-0.34,-0.79,0.20,2.31,0.04,0.40 +-0.46,-0.34,-0.79,0.20,2.32,0.04,0.39 +-0.46,-0.34,-0.80,0.20,2.32,0.03,0.39 +-0.46,-0.34,-0.80,0.20,2.33,0.03,0.39 +-0.46,-0.34,-0.80,0.20,2.33,0.03,0.39 +-0.46,-0.34,-0.80,0.20,2.34,0.02,0.39 +-0.46,-0.34,-0.80,0.19,2.34,0.02,0.39 +-0.46,-0.33,-0.80,0.19,2.35,0.01,0.39 +-0.46,-0.33,-0.80,0.19,2.35,0.01,0.39 +-0.46,-0.33,-0.80,0.19,2.36,0.01,0.39 +-0.46,-0.33,-0.80,0.19,2.37,0.00,0.38 +-0.46,-0.33,-0.80,0.19,2.37,0.00,0.38 diff --git a/scripts/testv/config_hospital_patientroom.cfg b/scripts/testv/rend_config_hospital_patientroom.cfg similarity index 100% rename from scripts/testv/config_hospital_patientroom.cfg rename to scripts/testv/rend_config_hospital_patientroom.cfg diff --git a/scripts/testv/config_recreation.cfg b/scripts/testv/rend_config_recreation.cfg similarity index 100% rename from scripts/testv/config_recreation.cfg rename to scripts/testv/rend_config_recreation.cfg diff --git a/scripts/testv/config_renderer.cfg b/scripts/testv/rend_config_renderer.cfg similarity index 100% rename from scripts/testv/config_renderer.cfg rename to scripts/testv/rend_config_renderer.cfg diff --git a/scripts/testv/stv16c.pcm b/scripts/testv/stv16c.pcm deleted file mode 100644 index b4132c04f55e9f5b11c8db7056aaf3d01f3659df..0000000000000000000000000000000000000000 --- a/scripts/testv/stv16c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:87c121deab7586d5ad0a39c8d59027c36d2cf7639345abfab8685b89ea029170 -size 640002 diff --git a/scripts/testv/stv16c.wav b/scripts/testv/stv16c.wav new file mode 100644 index 0000000000000000000000000000000000000000..d107fe711ddec9aa01c1501903dfa969558aaffb --- /dev/null +++ b/scripts/testv/stv16c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61f9eca5dafeb46a6aa29c82a8252ebb4ffd4e7a7255f5a4653d8335e685872e +size 640046 diff --git a/scripts/testv/stv16n.pcm b/scripts/testv/stv16n.pcm deleted file mode 100644 index 7d7aaf880b8a03d34205862ccc99b03725e14b56..0000000000000000000000000000000000000000 --- a/scripts/testv/stv16n.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:03b93acbaeffbb1866f6135a45bcb4ff0038c5672e226cf97507c293bd155b5b -size 620802 diff --git a/scripts/testv/stv16n.wav b/scripts/testv/stv16n.wav new file mode 100644 index 0000000000000000000000000000000000000000..9a9c8798e5c7b9e470280f32b979f3edfe123ced --- /dev/null +++ b/scripts/testv/stv16n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d0ac0846c3046d91843b390fbef3a0180dac92b7d53e4079b3541d43b8af188 +size 620846 diff --git a/scripts/testv/stv1ISM48s.pcm b/scripts/testv/stv1ISM48s.pcm deleted file mode 100644 index dd0da48121c756682f884603b6b5e4bbf090d5c8..0000000000000000000000000000000000000000 --- a/scripts/testv/stv1ISM48s.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9c2173b806b73bbbd07db8f68f976237441663e7760abd0d01b012eba519b99b -size 2880000 diff --git a/scripts/testv/stv1ISM48s.wav b/scripts/testv/stv1ISM48s.wav new file mode 100644 index 0000000000000000000000000000000000000000..da050755658ef780ac8e884fcd23b58e37f671fa --- /dev/null +++ b/scripts/testv/stv1ISM48s.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfd1f55af3964c73b423efe64c7400c02ea3c5f289bf347b019350fe3165bcf3 +size 2880044 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC.met b/scripts/testv/stv1MASA1TC48c.met similarity index 100% rename from scripts/testv/stv_IVASMASA_1dir1TC.met rename to scripts/testv/stv1MASA1TC48c.met diff --git a/scripts/testv/stv1MASA1TC48c.wav b/scripts/testv/stv1MASA1TC48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..263f109000e4a141bdbabe41a7c5686421e05e0d --- /dev/null +++ b/scripts/testv/stv1MASA1TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2409df48bf501463db0e468aeeee11e5aa866f0adf91ef714a7c6fc506235aa1 +size 288044 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.met b/scripts/testv/stv1MASA1TC48n.met similarity index 100% rename from scripts/testv/stv_IVASMASA_1dir1TC_DTX.met rename to scripts/testv/stv1MASA1TC48n.met diff --git a/scripts/testv/stv1MASA1TC48n.wav b/scripts/testv/stv1MASA1TC48n.wav new file mode 100644 index 0000000000000000000000000000000000000000..1b0012d8862fcebcaa5023702456a3320e0b6847 --- /dev/null +++ b/scripts/testv/stv1MASA1TC48n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81065ed959b13b8c2a4bb1a05ef14095f523912bc3007fdd172cce87a8398046 +size 1927724 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC.met b/scripts/testv/stv1MASA2TC48c.met similarity index 100% rename from scripts/testv/stv_IVASMASA_1dir2TC.met rename to scripts/testv/stv1MASA2TC48c.met diff --git a/scripts/testv/stv1MASA2TC48c.wav b/scripts/testv/stv1MASA2TC48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..982e69fb2075ea81e9f9f9a93b1124f1d4e29598 --- /dev/null +++ b/scripts/testv/stv1MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bd8440cbf857f9376d053f780572213964c32a267f325948f3a3a02805dc998 +size 1152044 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.met b/scripts/testv/stv1MASA2TC48n.met similarity index 100% rename from scripts/testv/stv_IVASMASA_1dir2TC_DTX.met rename to scripts/testv/stv1MASA2TC48n.met diff --git a/scripts/testv/stv1MASA2TC48n.wav b/scripts/testv/stv1MASA2TC48n.wav new file mode 100644 index 0000000000000000000000000000000000000000..f25eb2435385831117586582ce019fcdd9850afe --- /dev/null +++ b/scripts/testv/stv1MASA2TC48n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97f1a7a43012ce166b929df59bd756f5d96433ea00ce0a1005380368c01619a0 +size 3855404 diff --git a/scripts/testv/stv2ISM48s.pcm b/scripts/testv/stv2ISM48s.pcm deleted file mode 100644 index abd56e3ed8819f24514259ac9e0e2d6a7abd3955..0000000000000000000000000000000000000000 --- a/scripts/testv/stv2ISM48s.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:211548331868fda700dd75809d88b8f350d0a2e1af41f1a2c930efb35b34b877 -size 5760000 diff --git a/scripts/testv/stv2ISM48s.wav b/scripts/testv/stv2ISM48s.wav new file mode 100644 index 0000000000000000000000000000000000000000..02de53114d52e3856a2513423726d595b81d592b --- /dev/null +++ b/scripts/testv/stv2ISM48s.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e042a1a219fcd4f8a82d1d200071139b76c749d97a7b627774431ba961486b2c +size 5760044 diff --git a/scripts/testv/stv_IVASMASA_2dir1TC.met b/scripts/testv/stv2MASA1TC48c.met similarity index 100% rename from scripts/testv/stv_IVASMASA_2dir1TC.met rename to scripts/testv/stv2MASA1TC48c.met diff --git a/scripts/testv/stv2MASA1TC48c.wav b/scripts/testv/stv2MASA1TC48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..afe705b0b1563c87e74387de1aac6e2b25f4c87f --- /dev/null +++ b/scripts/testv/stv2MASA1TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d500a55bcc63dda1fd93329bcef272a21eb49731ceb0a60e546ef02e07cdd9b +size 576044 diff --git a/scripts/testv/stv_IVASMASA_2dir2TC.met b/scripts/testv/stv2MASA2TC48c.met similarity index 100% rename from scripts/testv/stv_IVASMASA_2dir2TC.met rename to scripts/testv/stv2MASA2TC48c.met diff --git a/scripts/testv/stv2MASA2TC48c.wav b/scripts/testv/stv2MASA2TC48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..e159c4f9ae1d39c5ad6ed62c7241ac722f4a7ecd --- /dev/null +++ b/scripts/testv/stv2MASA2TC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60a713ed1b97cf94b16849806951ef83d8f41c8ee455b267ec0a292c695cbbc1 +size 576044 diff --git a/scripts/testv/stv2OA32c.pcm b/scripts/testv/stv2OA32c.pcm deleted file mode 100644 index a041d613a5444c14f8381c096152dd6f3ca2feb6..0000000000000000000000000000000000000000 --- a/scripts/testv/stv2OA32c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:da0638a1ce4079133a80d51d72ae872238d25761e88fec6326050ef4f153ef49 -size 11520306 diff --git a/scripts/testv/stv2OA32c.wav b/scripts/testv/stv2OA32c.wav new file mode 100644 index 0000000000000000000000000000000000000000..86d288de725bfab0444515c30be3fcc88df23481 --- /dev/null +++ b/scripts/testv/stv2OA32c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1824c3afe43861b2ed1e4ff94591932f34bb1885d96796e282d3839906e50aed +size 11520350 diff --git a/scripts/testv/stv2OA48c.pcm b/scripts/testv/stv2OA48c.pcm deleted file mode 100644 index bcf391ec1ace135fe9c51a760d417a52b21a95cf..0000000000000000000000000000000000000000 --- a/scripts/testv/stv2OA48c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2611c295c37f89c21d7a974bd7da8d41e5509337aee43392a2047eca63af09e1 -size 17280450 diff --git a/scripts/testv/stv2OA48c.wav b/scripts/testv/stv2OA48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..24bb1f0872f8b58fbbfdb7889f8c0bac85702c18 --- /dev/null +++ b/scripts/testv/stv2OA48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f573744bd97ad3dcb8e86c39d1770725a34f3c43c37c62c26d670a7f722a880e +size 17280494 diff --git a/scripts/testv/stv32c.pcm b/scripts/testv/stv32c.pcm deleted file mode 100644 index 30436d6417fa9c0ad958f0b4fc47e1c47bab86d7..0000000000000000000000000000000000000000 --- a/scripts/testv/stv32c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bd7efc93702578d54eebeedfa09cb8f027654fdcd9fa56b74576e43511d2c8a5 -size 1280000 diff --git a/scripts/testv/stv32c.wav b/scripts/testv/stv32c.wav new file mode 100644 index 0000000000000000000000000000000000000000..640532cc122da361f158e8dd49fb85d537396e16 --- /dev/null +++ b/scripts/testv/stv32c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00089d67aa513a9f6b2f73526e94d5c32437c6944ec6467072dc27ccaa1f5080 +size 1389542 diff --git a/scripts/testv/stv32n.pcm b/scripts/testv/stv32n.pcm deleted file mode 100644 index 1a6ab73020dbe7c3e9753d2e8ebf784eadc30732..0000000000000000000000000000000000000000 --- a/scripts/testv/stv32n.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:64b927b04a013157dc5b6cbdf74b6c15cbc5035d35607def39757244c8d2c343 -size 1241600 diff --git a/scripts/testv/stv32n.wav b/scripts/testv/stv32n.wav new file mode 100644 index 0000000000000000000000000000000000000000..6a23d99d6e6c5cefe68892fd52d9dfb4a6b95eee --- /dev/null +++ b/scripts/testv/stv32n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a92be333a359a77ec70324815d71282398dede88e59ac19a31f8d18913c0505 +size 1241644 diff --git a/scripts/testv/stv3ISM48s.pcm b/scripts/testv/stv3ISM48s.pcm deleted file mode 100644 index 490ec89821c34fee6bb8029edc002c5333ba4fa3..0000000000000000000000000000000000000000 --- a/scripts/testv/stv3ISM48s.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cc045085eccb2157581ab413d315ed9ad2278787690c7112499ba3919e039427 -size 8640000 diff --git a/scripts/testv/stv3ISM48s.wav b/scripts/testv/stv3ISM48s.wav new file mode 100644 index 0000000000000000000000000000000000000000..c52500f6100f39ac9482a3998baad2c881edf516 --- /dev/null +++ b/scripts/testv/stv3ISM48s.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a29dfd720edab2367f86c394d4abc9f641596d50697539be70cdfe178d2a28d +size 8640044 diff --git a/scripts/testv/stv3OA32c.pcm b/scripts/testv/stv3OA32c.pcm deleted file mode 100644 index 3a66fd65df8d76ff54d92c26768b7d93dde4cb63..0000000000000000000000000000000000000000 --- a/scripts/testv/stv3OA32c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d5d4c15eb0d60327e3fba67801d921537c0b1633c1f6e1626e0a9ec31a9ff01d -size 20480544 diff --git a/scripts/testv/stv3OA32c.wav b/scripts/testv/stv3OA32c.wav new file mode 100644 index 0000000000000000000000000000000000000000..07cda526741c5c58668bba78c492459a4d6540c6 --- /dev/null +++ b/scripts/testv/stv3OA32c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdd1fd31b318bef4439a35baf2252c8edabb826198c75d705095b68dfa288fb0 +size 20480588 diff --git a/scripts/testv/stv3OA48c.pcm b/scripts/testv/stv3OA48c.pcm deleted file mode 100644 index daaaafb65a70307e54ff413e3462ca0d7d587bec..0000000000000000000000000000000000000000 --- a/scripts/testv/stv3OA48c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a63b96d6e7baf35520b3841e80ba63babc6e66b0750a88039628665f05b4d797 -size 30720800 diff --git a/scripts/testv/stv3OA48c.wav b/scripts/testv/stv3OA48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..960d9e2019514a022ef216fa2e03241afe369635 --- /dev/null +++ b/scripts/testv/stv3OA48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ce54b1708a76f34eeedc40b01e806cb92d32b0813e8ac23bfceaaa8d25262e6 +size 30720844 diff --git a/scripts/testv/stv48c.pcm b/scripts/testv/stv48c.pcm deleted file mode 100644 index 0b115c28ec675727e6eccf5017038b50e6a2fe73..0000000000000000000000000000000000000000 --- a/scripts/testv/stv48c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4f9ce14457d7027466a26ed258e1080aaa84755d340ec024032460b6f9dd7088 -size 1920000 diff --git a/scripts/testv/stv48c.wav b/scripts/testv/stv48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..1be5a1dc3ccb7c70c6ec8e0eeedda2b0c52a69e0 --- /dev/null +++ b/scripts/testv/stv48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59f39e02d601b453170cde1e49d50e58b58ff5154ba54c75fc5d79f4964d1e48 +size 1920044 diff --git a/scripts/testv/stv48n.pcm b/scripts/testv/stv48n.pcm deleted file mode 100644 index 16a6205b728f372ab171abb4254c49063fb427d2..0000000000000000000000000000000000000000 --- a/scripts/testv/stv48n.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:799bd2f938ea02f608af8f1a125746c85789dc938d5ca23d7c2766c643761488 -size 1862400 diff --git a/scripts/testv/stv48n.wav b/scripts/testv/stv48n.wav new file mode 100644 index 0000000000000000000000000000000000000000..2d79cee520a69b5c897cd583f459c14d68af3639 --- /dev/null +++ b/scripts/testv/stv48n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c774e6fe4e22274ef72552901c4b4870d56d825fa67e8e3e59a30cc0a44dbfa +size 1862444 diff --git a/scripts/testv/stv4ISM48n.wav b/scripts/testv/stv4ISM48n.wav new file mode 100644 index 0000000000000000000000000000000000000000..0ca6e5f3f5547632e70e566fe1affa1b4e0cf635 --- /dev/null +++ b/scripts/testv/stv4ISM48n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74697fcb6241db1bed87121244c09a3499ea4024cdf15d279feafbedbca6123a +size 7680044 diff --git a/scripts/testv/stv4ISM48s.pcm b/scripts/testv/stv4ISM48s.pcm deleted file mode 100644 index 90034cabcbf0002917563be10de0e3137974957c..0000000000000000000000000000000000000000 --- a/scripts/testv/stv4ISM48s.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:338608f5416666088dd09533bc2f7d93c3545ef4d23a2b34c869df15f23ee550 -size 11520000 diff --git a/scripts/testv/stv4ISM48s.wav b/scripts/testv/stv4ISM48s.wav new file mode 100644 index 0000000000000000000000000000000000000000..de034819ea54c26ebecc607ab73eac7d96352d20 --- /dev/null +++ b/scripts/testv/stv4ISM48s.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70433aebd892f38df31f12f10e71caaa1e794c64abb7d3e75fe895676e63609e +size 11520044 diff --git a/scripts/testv/stv512MC48c.pcm b/scripts/testv/stv512MC48c.pcm deleted file mode 100644 index 278cd0701f520463d42bb05c347ca0ef421206b5..0000000000000000000000000000000000000000 --- a/scripts/testv/stv512MC48c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:860fd8f0fb4fc26c0ec525ee0b932551084029281a155315c8a441fad21563e1 -size 2304000 diff --git a/scripts/testv/stv512MC48c.wav b/scripts/testv/stv512MC48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..e21644a5d9c6945438f7d53a0417f6e1317a63a5 --- /dev/null +++ b/scripts/testv/stv512MC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3be0c6dccbf26f8755200683bba42553eb36feed297110e289afcec32e0c8459 +size 2304044 diff --git a/scripts/testv/stv514MC48c.pcm b/scripts/testv/stv514MC48c.pcm deleted file mode 100644 index 37c80b7eef6d0f88c955f4aadfd7a999a47f00c3..0000000000000000000000000000000000000000 --- a/scripts/testv/stv514MC48c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b82dfc9cc7ddfb53cf8233934d14f6b61b1bec10f2a3648ee603a92793a2ce32 -size 2880000 diff --git a/scripts/testv/stv514MC48c.wav b/scripts/testv/stv514MC48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..113cd6219a67255b191e0d0bf6f363efcb062294 --- /dev/null +++ b/scripts/testv/stv514MC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2097dd80fa69f239689b06a62a44eb592bf2fe699e549347ae4567c1b690170 +size 2880044 diff --git a/scripts/testv/stv51MC48c.pcm b/scripts/testv/stv51MC48c.pcm deleted file mode 100644 index ee5d30894bd416a22778d413e4319196bf4461f3..0000000000000000000000000000000000000000 --- a/scripts/testv/stv51MC48c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bf352e4c5b907dfa1c444086b1dd3c2c85b35cc8b6f2339126ca9caa5b2d60ca -size 11520000 diff --git a/scripts/testv/stv51MC48c.wav b/scripts/testv/stv51MC48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..e5f4bae7d485cf224add6c166da48e0fc400ca74 --- /dev/null +++ b/scripts/testv/stv51MC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:daccececb4336a7f2492185767d108dbc5594a7d6e2841d861f43ef44437a377 +size 11520044 diff --git a/scripts/testv/stv714MC48c.pcm b/scripts/testv/stv714MC48c.pcm deleted file mode 100644 index c96edbcc9a7326b1f03ae7a56bb6f1d142824d73..0000000000000000000000000000000000000000 --- a/scripts/testv/stv714MC48c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2b86e109d1fc6e1af00415ff8f40518dd29b6e29d579337a5fcfad38d8fcbd5f -size 3456000 diff --git a/scripts/testv/stv714MC48c.wav b/scripts/testv/stv714MC48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..cabcb790b06b55e5fb8a98c3ab190547cec7bbd6 --- /dev/null +++ b/scripts/testv/stv714MC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da62e19b166089efae2f22e68d76b82d3295d15785a4967465a04bc1c75b0462 +size 3456044 diff --git a/scripts/testv/stv71MC48c.wav b/scripts/testv/stv71MC48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..72b3337e598212176d0a9960660a967b881f93c5 --- /dev/null +++ b/scripts/testv/stv71MC48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fb15d0c109c41d5e629b2e15a47be72ca8d209919ac39f79a7947e9cd2e5e02 +size 2304044 diff --git a/scripts/testv/stv8c.pcm b/scripts/testv/stv8c.pcm deleted file mode 100644 index 33202e720aaa98ae7e390e5e8dd460f45cdeefbf..0000000000000000000000000000000000000000 --- a/scripts/testv/stv8c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2299d6dac56e54e4684d04ab280df3b5642ff858c69e6adcc179e92f5322fc20 -size 320002 diff --git a/scripts/testv/stv8c.wav b/scripts/testv/stv8c.wav new file mode 100644 index 0000000000000000000000000000000000000000..5f3b0ed4d90686d034ada4b69fc99362faa3716c --- /dev/null +++ b/scripts/testv/stv8c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:722081dcfaaee1c04254b0bde8436c73748a44f6760067907194a1ba24b199d7 +size 320046 diff --git a/scripts/testv/stv8n.pcm b/scripts/testv/stv8n.pcm deleted file mode 100644 index a92d8d473aedca88e2747857d50d0d17ca2f8add..0000000000000000000000000000000000000000 --- a/scripts/testv/stv8n.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b24bbc4f76a827857f9f6cbfbc03efc3e15cd72e88e8e4670deeda67674fcdb3 -size 310402 diff --git a/scripts/testv/stv8n.wav b/scripts/testv/stv8n.wav new file mode 100644 index 0000000000000000000000000000000000000000..2b35ec4dbacf84c3d7b42fa245578ce3c3ff90c5 --- /dev/null +++ b/scripts/testv/stv8n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:223e9f5353c49163803abedf97d557436d025f445fe9de4508c9559ca15b330b +size 310446 diff --git a/scripts/testv/stvFOA16c.pcm b/scripts/testv/stvFOA16c.pcm deleted file mode 100644 index ff0ac24666a7141dbf2bde0bd3898aae6aca6779..0000000000000000000000000000000000000000 --- a/scripts/testv/stvFOA16c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:15effd94a7de8af7979405119556131124d273c6d106f3e03ed1cf55d42c7388 -size 2560072 diff --git a/scripts/testv/stvFOA16c.wav b/scripts/testv/stvFOA16c.wav new file mode 100644 index 0000000000000000000000000000000000000000..cb67e8b371d4ba07a8cc5383de21e77720b626a8 --- /dev/null +++ b/scripts/testv/stvFOA16c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6725a5d2647516071033f83f385dc7dfe4ff6719d493b1b682ec0274c1347e93 +size 2560116 diff --git a/scripts/testv/stvFOA32c.pcm b/scripts/testv/stvFOA32c.pcm deleted file mode 100644 index cddf93873b3a27d31622f936c08ecd32d45566a2..0000000000000000000000000000000000000000 --- a/scripts/testv/stvFOA32c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:efb3b80d1b914eeea575505009bee3dd14afb21b7a2f7d68620b3fb0f2e389b0 -size 5120136 diff --git a/scripts/testv/stvFOA32c.wav b/scripts/testv/stvFOA32c.wav new file mode 100644 index 0000000000000000000000000000000000000000..661a97a3dc964ab6b32ee5167adee6383f6548ee --- /dev/null +++ b/scripts/testv/stvFOA32c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:273308e57de4c5f3ef2eeed164b0a9f34ba86ab05ca533ee5ee8a76528c01abe +size 5120180 diff --git a/scripts/testv/stvFOA48c.pcm b/scripts/testv/stvFOA48c.pcm deleted file mode 100644 index 34b0c5a6ab83e42f50825352972149491bbb7e70..0000000000000000000000000000000000000000 --- a/scripts/testv/stvFOA48c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a07fa723662c3017989130d49d5cfcf0d5d498be992212970e19cd1a60c61193 -size 7680200 diff --git a/scripts/testv/stvFOA48c.wav b/scripts/testv/stvFOA48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..7ece23b0843f684a176a82aa3fa918b4a6ba0373 --- /dev/null +++ b/scripts/testv/stvFOA48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45a1dd6c4fe6802e98821657337b453d5dab2fe32089c675637b9d23cfe74c8d +size 7680244 diff --git a/scripts/testv/stvISM1.csv b/scripts/testv/stvISM1.csv index 8d729654c4cbfbc2034d285f98f1f7824d3a868c..0082c1282340113845a884c78f6b8140646057da 100644 --- a/scripts/testv/stvISM1.csv +++ b/scripts/testv/stvISM1.csv @@ -1,1500 +1,1500 @@ -0.00,0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 -9.60,0.00,1.00,0.00,1.00 -14.40,0.00,1.00,0.00,1.00 -19.20,0.00,1.00,0.00,1.00 -24.00,0.00,1.00,0.00,1.00 -28.80,0.00,1.00,0.00,1.00 -33.60,0.00,1.00,0.00,1.00 -38.40,0.00,1.00,0.00,1.00 -43.20,0.00,1.00,0.00,1.00 -48.00,0.00,1.00,0.00,1.00 -52.80,0.00,1.00,0.00,1.00 -57.60,0.00,1.00,0.00,1.00 -62.40,0.00,1.00,0.00,1.00 -67.20,0.00,1.00,0.00,1.00 -72.00,0.00,1.00,0.00,1.00 -76.80,0.00,1.00,0.00,1.00 -81.60,0.00,1.00,0.00,1.00 -86.40,0.00,1.00,0.00,1.00 -91.20,0.00,1.00,0.00,1.00 -96.00,0.00,1.00,0.00,1.00 -100.80,0.00,1.00,0.00,1.00 -105.60,0.00,1.00,0.00,1.00 -110.40,0.00,1.00,0.00,1.00 -115.20,0.00,1.00,0.00,1.00 -120.00,0.00,1.00,0.00,1.00 -124.80,0.00,1.00,0.00,1.00 -129.60,0.00,1.00,0.00,1.00 -134.40,0.00,1.00,0.00,1.00 -139.20,0.00,1.00,0.00,1.00 -144.00,0.00,1.00,0.00,1.00 -148.80,0.00,1.00,0.00,1.00 -153.60,0.00,1.00,0.00,1.00 -158.40,0.00,1.00,0.00,1.00 -163.20,0.00,1.00,0.00,1.00 -168.00,0.00,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 --163.20,0.00,1.00,0.00,1.00 --158.40,0.00,1.00,0.00,1.00 --153.60,0.00,1.00,0.00,1.00 --148.80,0.00,1.00,0.00,1.00 --144.00,0.00,1.00,0.00,1.00 --139.20,0.00,1.00,0.00,1.00 --134.40,0.00,1.00,0.00,1.00 --129.60,0.00,1.00,0.00,1.00 --124.80,0.00,1.00,0.00,1.00 --120.00,0.00,1.00,0.00,1.00 --115.20,0.00,1.00,0.00,1.00 --110.40,0.00,1.00,0.00,1.00 --105.60,0.00,1.00,0.00,1.00 --100.80,0.00,1.00,0.00,1.00 --96.00,0.00,1.00,0.00,1.00 --91.20,0.00,1.00,0.00,1.00 --86.40,0.00,1.00,0.00,1.00 --81.60,0.00,1.00,0.00,1.00 --76.80,0.00,1.00,0.00,1.00 --72.00,0.00,1.00,0.00,1.00 --67.20,0.00,1.00,0.00,1.00 --62.40,0.00,1.00,0.00,1.00 --57.60,0.00,1.00,0.00,1.00 --52.80,0.00,1.00,0.00,1.00 --48.00,0.00,1.00,0.00,1.00 --43.20,0.00,1.00,0.00,1.00 --38.40,0.00,1.00,0.00,1.00 --33.60,0.00,1.00,0.00,1.00 --28.80,0.00,1.00,0.00,1.00 --24.00,0.00,1.00,0.00,1.00 --19.20,0.00,1.00,0.00,1.00 --14.40,0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 -14.40,-0.00,1.00,0.00,1.00 -19.20,-0.00,1.00,0.00,1.00 -24.00,-0.00,1.00,0.00,1.00 -28.80,-0.00,1.00,0.00,1.00 -33.60,-4.80,1.00,0.00,1.00 -38.40,-4.80,1.00,0.00,1.00 -43.20,-4.80,1.00,0.00,1.00 -48.00,-4.80,1.00,0.00,1.00 -52.80,-4.80,1.00,0.00,1.00 -57.60,-4.80,1.00,0.00,1.00 -62.40,-4.80,1.00,0.00,1.00 -67.20,-4.80,1.00,0.00,1.00 -72.00,-4.80,1.00,0.00,1.00 -76.80,-4.80,1.00,0.00,1.00 -81.60,-4.80,1.00,0.00,1.00 -86.40,-4.80,1.00,0.00,1.00 -91.20,-4.80,1.00,0.00,1.00 -96.00,-4.80,1.00,0.00,1.00 -100.80,-4.80,1.00,0.00,1.00 -105.60,-4.80,1.00,0.00,1.00 -110.40,-4.80,1.00,0.00,1.00 -115.20,-4.80,1.00,0.00,1.00 -120.00,-4.80,1.00,0.00,1.00 -124.80,-4.80,1.00,0.00,1.00 -129.60,-4.80,1.00,0.00,1.00 -134.40,-4.80,1.00,0.00,1.00 -139.20,-4.80,1.00,0.00,1.00 -144.00,-4.80,1.00,0.00,1.00 -148.80,-4.80,1.00,0.00,1.00 -153.60,-0.00,1.00,0.00,1.00 -158.40,-0.00,1.00,0.00,1.00 -163.20,-0.00,1.00,0.00,1.00 -168.00,-0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 --163.20,0.00,1.00,0.00,1.00 --158.40,0.00,1.00,0.00,1.00 --153.60,0.00,1.00,0.00,1.00 --148.80,4.80,1.00,0.00,1.00 --144.00,4.80,1.00,0.00,1.00 --139.20,4.80,1.00,0.00,1.00 --134.40,4.80,1.00,0.00,1.00 --129.60,4.80,1.00,0.00,1.00 --124.80,4.80,1.00,0.00,1.00 --120.00,4.80,1.00,0.00,1.00 --115.20,4.80,1.00,0.00,1.00 --110.40,4.80,1.00,0.00,1.00 --105.60,4.80,1.00,0.00,1.00 --100.80,4.80,1.00,0.00,1.00 --96.00,4.80,1.00,0.00,1.00 --91.20,4.80,1.00,0.00,1.00 --86.40,4.80,1.00,0.00,1.00 --81.60,4.80,1.00,0.00,1.00 --76.80,4.80,1.00,0.00,1.00 --72.00,4.80,1.00,0.00,1.00 --67.20,4.80,1.00,0.00,1.00 --62.40,4.80,1.00,0.00,1.00 --57.60,4.80,1.00,0.00,1.00 --52.80,4.80,1.00,0.00,1.00 --48.00,4.80,1.00,0.00,1.00 --43.20,4.80,1.00,0.00,1.00 --38.40,4.80,1.00,0.00,1.00 --33.60,4.80,1.00,0.00,1.00 --28.80,0.00,1.00,0.00,1.00 --24.00,0.00,1.00,0.00,1.00 --19.20,0.00,1.00,0.00,1.00 --14.40,0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 -14.40,-0.00,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 -24.00,-4.80,1.00,0.00,1.00 -28.80,-4.80,1.00,0.00,1.00 -33.60,-4.80,1.00,0.00,1.00 -38.40,-4.80,1.00,0.00,1.00 -43.20,-4.80,1.00,0.00,1.00 -48.00,-4.80,1.00,0.00,1.00 -52.80,-9.60,1.00,0.00,1.00 -57.60,-9.60,1.00,0.00,1.00 -62.40,-9.60,1.00,0.00,1.00 -67.20,-9.60,1.00,0.00,1.00 -72.00,-9.60,1.00,0.00,1.00 -76.80,-9.60,1.00,0.00,1.00 -81.60,-9.60,1.00,0.00,1.00 -86.40,-9.60,1.00,0.00,1.00 -91.20,-9.60,1.00,0.00,1.00 -96.00,-9.60,1.00,0.00,1.00 -100.80,-9.60,1.00,0.00,1.00 -105.60,-9.60,1.00,0.00,1.00 -110.40,-9.60,1.00,0.00,1.00 -115.20,-9.60,1.00,0.00,1.00 -120.00,-9.60,1.00,0.00,1.00 -124.80,-9.60,1.00,0.00,1.00 -129.60,-9.60,1.00,0.00,1.00 -134.40,-4.80,1.00,0.00,1.00 -139.20,-4.80,1.00,0.00,1.00 -144.00,-4.80,1.00,0.00,1.00 -148.80,-4.80,1.00,0.00,1.00 -153.60,-4.80,1.00,0.00,1.00 -158.40,-4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 -168.00,-0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 --163.20,4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 --153.60,4.80,1.00,0.00,1.00 --148.80,4.80,1.00,0.00,1.00 --144.00,4.80,1.00,0.00,1.00 --139.20,4.80,1.00,0.00,1.00 --134.40,4.80,1.00,0.00,1.00 --129.60,9.60,1.00,0.00,1.00 --124.80,9.60,1.00,0.00,1.00 --120.00,9.60,1.00,0.00,1.00 --115.20,9.60,1.00,0.00,1.00 --110.40,9.60,1.00,0.00,1.00 --105.60,9.60,1.00,0.00,1.00 --100.80,9.60,1.00,0.00,1.00 --96.00,9.60,1.00,0.00,1.00 --91.20,9.60,1.00,0.00,1.00 --86.40,9.60,1.00,0.00,1.00 --81.60,9.60,1.00,0.00,1.00 --76.80,9.60,1.00,0.00,1.00 --72.00,9.60,1.00,0.00,1.00 --67.20,9.60,1.00,0.00,1.00 --62.40,9.60,1.00,0.00,1.00 --57.60,9.60,1.00,0.00,1.00 --52.80,9.60,1.00,0.00,1.00 --48.00,4.80,1.00,0.00,1.00 --43.20,4.80,1.00,0.00,1.00 --38.40,4.80,1.00,0.00,1.00 --33.60,4.80,1.00,0.00,1.00 --28.80,4.80,1.00,0.00,1.00 --24.00,4.80,1.00,0.00,1.00 --19.20,4.80,1.00,0.00,1.00 --14.40,0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 -24.00,-4.80,1.00,0.00,1.00 -28.80,-4.80,1.00,0.00,1.00 -33.60,-9.60,1.00,0.00,1.00 -38.40,-9.60,1.00,0.00,1.00 -43.20,-9.60,1.00,0.00,1.00 -48.00,-9.60,1.00,0.00,1.00 -52.80,-9.60,1.00,0.00,1.00 -57.60,-14.40,1.00,0.00,1.00 -62.40,-14.40,1.00,0.00,1.00 -67.20,-14.40,1.00,0.00,1.00 -72.00,-14.40,1.00,0.00,1.00 -76.80,-14.40,1.00,0.00,1.00 -81.60,-14.40,1.00,0.00,1.00 -86.40,-14.40,1.00,0.00,1.00 -91.20,-14.40,1.00,0.00,1.00 -96.00,-14.40,1.00,0.00,1.00 -100.80,-14.40,1.00,0.00,1.00 -105.60,-14.40,1.00,0.00,1.00 -110.40,-14.40,1.00,0.00,1.00 -115.20,-14.40,1.00,0.00,1.00 -120.00,-14.40,1.00,0.00,1.00 -124.80,-9.60,1.00,0.00,1.00 -129.60,-9.60,1.00,0.00,1.00 -134.40,-9.60,1.00,0.00,1.00 -139.20,-9.60,1.00,0.00,1.00 -144.00,-9.60,1.00,0.00,1.00 -148.80,-9.60,1.00,0.00,1.00 -153.60,-4.80,1.00,0.00,1.00 -158.40,-4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --163.20,4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 --153.60,4.80,1.00,0.00,1.00 --148.80,9.60,1.00,0.00,1.00 --144.00,9.60,1.00,0.00,1.00 --139.20,9.60,1.00,0.00,1.00 --134.40,9.60,1.00,0.00,1.00 --129.60,9.60,1.00,0.00,1.00 --124.80,9.60,1.00,0.00,1.00 --120.00,14.40,1.00,0.00,1.00 --115.20,14.40,1.00,0.00,1.00 --110.40,14.40,1.00,0.00,1.00 --105.60,14.40,1.00,0.00,1.00 --100.80,14.40,1.00,0.00,1.00 --96.00,14.40,1.00,0.00,1.00 --91.20,14.40,1.00,0.00,1.00 --86.40,14.40,1.00,0.00,1.00 --81.60,14.40,1.00,0.00,1.00 --76.80,14.40,1.00,0.00,1.00 --72.00,14.40,1.00,0.00,1.00 --67.20,14.40,1.00,0.00,1.00 --62.40,14.40,1.00,0.00,1.00 --57.60,14.40,1.00,0.00,1.00 --52.80,9.60,1.00,0.00,1.00 --48.00,9.60,1.00,0.00,1.00 --43.20,9.60,1.00,0.00,1.00 --38.40,9.60,1.00,0.00,1.00 --33.60,9.60,1.00,0.00,1.00 --28.80,4.80,1.00,0.00,1.00 --24.00,4.80,1.00,0.00,1.00 --19.20,4.80,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 -24.00,-9.60,1.00,0.00,1.00 -28.80,-9.60,1.00,0.00,1.00 -33.60,-9.60,1.00,0.00,1.00 -38.40,-9.60,1.00,0.00,1.00 -43.20,-14.40,1.00,0.00,1.00 -48.00,-14.40,1.00,0.00,1.00 -52.80,-14.40,1.00,0.00,1.00 -57.60,-14.40,1.00,0.00,1.00 -62.40,-19.20,1.00,0.00,1.00 -67.20,-19.20,1.00,0.00,1.00 -72.00,-19.20,1.00,0.00,1.00 -76.80,-19.20,1.00,0.00,1.00 -81.60,-19.20,1.00,0.00,1.00 -86.40,-19.20,1.00,0.00,1.00 -91.20,-19.20,1.00,0.00,1.00 -96.00,-19.20,1.00,0.00,1.00 -100.80,-19.20,1.00,0.00,1.00 -105.60,-19.20,1.00,0.00,1.00 -110.40,-19.20,1.00,0.00,1.00 -115.20,-19.20,1.00,0.00,1.00 -120.00,-14.40,1.00,0.00,1.00 -124.80,-14.40,1.00,0.00,1.00 -129.60,-14.40,1.00,0.00,1.00 -134.40,-14.40,1.00,0.00,1.00 -139.20,-14.40,1.00,0.00,1.00 -144.00,-9.60,1.00,0.00,1.00 -148.80,-9.60,1.00,0.00,1.00 -153.60,-9.60,1.00,0.00,1.00 -158.40,-4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --163.20,4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 --153.60,9.60,1.00,0.00,1.00 --148.80,9.60,1.00,0.00,1.00 --144.00,9.60,1.00,0.00,1.00 --139.20,14.40,1.00,0.00,1.00 --134.40,14.40,1.00,0.00,1.00 --129.60,14.40,1.00,0.00,1.00 --124.80,14.40,1.00,0.00,1.00 --120.00,14.40,1.00,0.00,1.00 --115.20,19.20,1.00,0.00,1.00 --110.40,19.20,1.00,0.00,1.00 --105.60,19.20,1.00,0.00,1.00 --100.80,19.20,1.00,0.00,1.00 --96.00,19.20,1.00,0.00,1.00 --91.20,19.20,1.00,0.00,1.00 --86.40,19.20,1.00,0.00,1.00 --81.60,19.20,1.00,0.00,1.00 --76.80,19.20,1.00,0.00,1.00 --72.00,19.20,1.00,0.00,1.00 --67.20,19.20,1.00,0.00,1.00 --62.40,19.20,1.00,0.00,1.00 --57.60,14.40,1.00,0.00,1.00 --52.80,14.40,1.00,0.00,1.00 --48.00,14.40,1.00,0.00,1.00 --43.20,14.40,1.00,0.00,1.00 --38.40,9.60,1.00,0.00,1.00 --33.60,9.60,1.00,0.00,1.00 --28.80,9.60,1.00,0.00,1.00 --24.00,9.60,1.00,0.00,1.00 --19.20,4.80,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 -19.20,-9.60,1.00,0.00,1.00 -24.00,-9.60,1.00,0.00,1.00 -28.80,-9.60,1.00,0.00,1.00 -33.60,-14.40,1.00,0.00,1.00 -33.60,-14.40,1.00,0.00,1.00 -38.40,-14.40,1.00,0.00,1.00 -43.20,-19.20,1.00,0.00,1.00 -48.00,-19.20,1.00,0.00,1.00 -57.60,-19.20,1.00,0.00,1.00 -62.40,-19.20,1.00,0.00,1.00 -67.20,-24.00,1.00,0.00,1.00 -72.00,-24.00,1.00,0.00,1.00 -76.80,-24.00,1.00,0.00,1.00 -81.60,-24.00,1.00,0.00,1.00 -86.40,-24.00,1.00,0.00,1.00 -91.20,-24.00,1.00,0.00,1.00 -96.00,-24.00,1.00,0.00,1.00 -100.80,-24.00,1.00,0.00,1.00 -105.60,-24.00,1.00,0.00,1.00 -110.40,-24.00,1.00,0.00,1.00 -115.20,-19.20,1.00,0.00,1.00 -120.00,-19.20,1.00,0.00,1.00 -129.60,-19.20,1.00,0.00,1.00 -134.40,-19.20,1.00,0.00,1.00 -139.20,-19.20,1.00,0.00,1.00 -144.00,-14.40,1.00,0.00,1.00 -148.80,-14.40,1.00,0.00,1.00 -148.80,-14.40,1.00,0.00,1.00 -153.60,-9.60,1.00,0.00,1.00 -158.40,-9.60,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --163.20,4.80,1.00,0.00,1.00 --158.40,9.60,1.00,0.00,1.00 --153.60,9.60,1.00,0.00,1.00 --148.80,14.40,1.00,0.00,1.00 --148.80,14.40,1.00,0.00,1.00 --144.00,14.40,1.00,0.00,1.00 --139.20,19.20,1.00,0.00,1.00 --134.40,19.20,1.00,0.00,1.00 --129.60,19.20,1.00,0.00,1.00 --120.00,19.20,1.00,0.00,1.00 --115.20,19.20,1.00,0.00,1.00 --110.40,24.00,1.00,0.00,1.00 --105.60,24.00,1.00,0.00,1.00 --100.80,24.00,1.00,0.00,1.00 --96.00,24.00,1.00,0.00,1.00 --91.20,24.00,1.00,0.00,1.00 --86.40,24.00,1.00,0.00,1.00 --81.60,24.00,1.00,0.00,1.00 --76.80,24.00,1.00,0.00,1.00 --72.00,24.00,1.00,0.00,1.00 --67.20,24.00,1.00,0.00,1.00 --62.40,19.20,1.00,0.00,1.00 --57.60,19.20,1.00,0.00,1.00 --48.00,19.20,1.00,0.00,1.00 --43.20,19.20,1.00,0.00,1.00 --38.40,14.40,1.00,0.00,1.00 --33.60,14.40,1.00,0.00,1.00 --33.60,14.40,1.00,0.00,1.00 --28.80,9.60,1.00,0.00,1.00 --24.00,9.60,1.00,0.00,1.00 --19.20,9.60,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 -19.20,-9.60,1.00,0.00,1.00 -19.20,-9.60,1.00,0.00,1.00 -24.00,-14.40,1.00,0.00,1.00 -28.80,-14.40,1.00,0.00,1.00 -33.60,-19.20,1.00,0.00,1.00 -38.40,-19.20,1.00,0.00,1.00 -43.20,-19.20,1.00,0.00,1.00 -48.00,-24.00,1.00,0.00,1.00 -52.80,-24.00,1.00,0.00,1.00 -57.60,-24.00,1.00,0.00,1.00 -62.40,-24.00,1.00,0.00,1.00 -72.00,-28.80,1.00,0.00,1.00 -76.80,-28.80,1.00,0.00,1.00 -81.60,-28.80,1.00,0.00,1.00 -86.40,-28.80,1.00,0.00,1.00 -91.20,-28.80,1.00,0.00,1.00 -96.00,-28.80,1.00,0.00,1.00 -100.80,-28.80,1.00,0.00,1.00 -105.60,-28.80,1.00,0.00,1.00 -115.20,-28.80,1.00,0.00,1.00 -120.00,-24.00,1.00,0.00,1.00 -124.80,-24.00,1.00,0.00,1.00 -129.60,-24.00,1.00,0.00,1.00 -134.40,-24.00,1.00,0.00,1.00 -139.20,-19.20,1.00,0.00,1.00 -144.00,-19.20,1.00,0.00,1.00 -148.80,-14.40,1.00,0.00,1.00 -153.60,-14.40,1.00,0.00,1.00 -158.40,-14.40,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --163.20,9.60,1.00,0.00,1.00 --163.20,9.60,1.00,0.00,1.00 --158.40,14.40,1.00,0.00,1.00 --153.60,14.40,1.00,0.00,1.00 --148.80,14.40,1.00,0.00,1.00 --144.00,19.20,1.00,0.00,1.00 --139.20,19.20,1.00,0.00,1.00 --134.40,24.00,1.00,0.00,1.00 --129.60,24.00,1.00,0.00,1.00 --124.80,24.00,1.00,0.00,1.00 --120.00,24.00,1.00,0.00,1.00 --115.20,28.80,1.00,0.00,1.00 --105.60,28.80,1.00,0.00,1.00 --100.80,28.80,1.00,0.00,1.00 --96.00,28.80,1.00,0.00,1.00 --91.20,28.80,1.00,0.00,1.00 --86.40,28.80,1.00,0.00,1.00 --81.60,28.80,1.00,0.00,1.00 --76.80,28.80,1.00,0.00,1.00 --72.00,28.80,1.00,0.00,1.00 --62.40,24.00,1.00,0.00,1.00 --57.60,24.00,1.00,0.00,1.00 --52.80,24.00,1.00,0.00,1.00 --48.00,24.00,1.00,0.00,1.00 --43.20,19.20,1.00,0.00,1.00 --38.40,19.20,1.00,0.00,1.00 --33.60,19.20,1.00,0.00,1.00 --28.80,14.40,1.00,0.00,1.00 --24.00,14.40,1.00,0.00,1.00 --19.20,9.60,1.00,0.00,1.00 --19.20,9.60,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 -19.20,-14.40,1.00,0.00,1.00 -24.00,-14.40,1.00,0.00,1.00 -28.80,-19.20,1.00,0.00,1.00 -33.60,-19.20,1.00,0.00,1.00 -38.40,-24.00,1.00,0.00,1.00 -43.20,-24.00,1.00,0.00,1.00 -48.00,-24.00,1.00,0.00,1.00 -52.80,-28.80,1.00,0.00,1.00 -57.60,-28.80,1.00,0.00,1.00 -62.40,-28.80,1.00,0.00,1.00 -67.20,-33.60,1.00,0.00,1.00 -72.00,-33.60,1.00,0.00,1.00 -81.60,-33.60,1.00,0.00,1.00 -86.40,-33.60,1.00,0.00,1.00 -91.20,-33.60,1.00,0.00,1.00 -96.00,-33.60,1.00,0.00,1.00 -100.80,-33.60,1.00,0.00,1.00 -110.40,-33.60,1.00,0.00,1.00 -115.20,-33.60,1.00,0.00,1.00 -120.00,-28.80,1.00,0.00,1.00 -124.80,-28.80,1.00,0.00,1.00 -129.60,-28.80,1.00,0.00,1.00 -134.40,-24.00,1.00,0.00,1.00 -139.20,-24.00,1.00,0.00,1.00 -144.00,-19.20,1.00,0.00,1.00 -148.80,-19.20,1.00,0.00,1.00 -153.60,-14.40,1.00,0.00,1.00 -158.40,-14.40,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 -168.00,-9.60,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 --163.20,9.60,1.00,0.00,1.00 --158.40,14.40,1.00,0.00,1.00 --153.60,14.40,1.00,0.00,1.00 --148.80,19.20,1.00,0.00,1.00 --144.00,19.20,1.00,0.00,1.00 --139.20,24.00,1.00,0.00,1.00 --134.40,24.00,1.00,0.00,1.00 --129.60,28.80,1.00,0.00,1.00 --124.80,28.80,1.00,0.00,1.00 --120.00,28.80,1.00,0.00,1.00 --115.20,33.60,1.00,0.00,1.00 --110.40,33.60,1.00,0.00,1.00 --100.80,33.60,1.00,0.00,1.00 --96.00,33.60,1.00,0.00,1.00 --91.20,33.60,1.00,0.00,1.00 --86.40,33.60,1.00,0.00,1.00 --81.60,33.60,1.00,0.00,1.00 --72.00,33.60,1.00,0.00,1.00 --67.20,33.60,1.00,0.00,1.00 --62.40,28.80,1.00,0.00,1.00 --57.60,28.80,1.00,0.00,1.00 --52.80,28.80,1.00,0.00,1.00 --48.00,24.00,1.00,0.00,1.00 --43.20,24.00,1.00,0.00,1.00 --38.40,24.00,1.00,0.00,1.00 --33.60,19.20,1.00,0.00,1.00 --28.80,19.20,1.00,0.00,1.00 --24.00,14.40,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 --14.40,9.60,1.00,0.00,1.00 --14.40,9.60,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -9.60,-9.60,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 -19.20,-14.40,1.00,0.00,1.00 -24.00,-19.20,1.00,0.00,1.00 -28.80,-19.20,1.00,0.00,1.00 -33.60,-24.00,1.00,0.00,1.00 -38.40,-24.00,1.00,0.00,1.00 -43.20,-28.80,1.00,0.00,1.00 -48.00,-28.80,1.00,0.00,1.00 -52.80,-33.60,1.00,0.00,1.00 -57.60,-33.60,1.00,0.00,1.00 -62.40,-33.60,1.00,0.00,1.00 -67.20,-38.40,1.00,0.00,1.00 -72.00,-38.40,1.00,0.00,1.00 -81.60,-38.40,1.00,0.00,1.00 -86.40,-38.40,1.00,0.00,1.00 -91.20,-38.40,1.00,0.00,1.00 -96.00,-38.40,1.00,0.00,1.00 -105.60,-38.40,1.00,0.00,1.00 -110.40,-38.40,1.00,0.00,1.00 -115.20,-33.60,1.00,0.00,1.00 -120.00,-33.60,1.00,0.00,1.00 -124.80,-33.60,1.00,0.00,1.00 -129.60,-28.80,1.00,0.00,1.00 -134.40,-28.80,1.00,0.00,1.00 -139.20,-24.00,1.00,0.00,1.00 -144.00,-24.00,1.00,0.00,1.00 -148.80,-19.20,1.00,0.00,1.00 -153.60,-19.20,1.00,0.00,1.00 -158.40,-14.40,1.00,0.00,1.00 -163.20,-14.40,1.00,0.00,1.00 -168.00,-9.60,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 --158.40,14.40,1.00,0.00,1.00 --153.60,19.20,1.00,0.00,1.00 --148.80,19.20,1.00,0.00,1.00 --144.00,24.00,1.00,0.00,1.00 --139.20,24.00,1.00,0.00,1.00 --134.40,28.80,1.00,0.00,1.00 --129.60,28.80,1.00,0.00,1.00 --124.80,33.60,1.00,0.00,1.00 --120.00,33.60,1.00,0.00,1.00 --115.20,33.60,1.00,0.00,1.00 --110.40,38.40,1.00,0.00,1.00 --105.60,38.40,1.00,0.00,1.00 --96.00,38.40,1.00,0.00,1.00 --91.20,38.40,1.00,0.00,1.00 --86.40,38.40,1.00,0.00,1.00 --81.60,38.40,1.00,0.00,1.00 --72.00,38.40,1.00,0.00,1.00 --67.20,38.40,1.00,0.00,1.00 --62.40,33.60,1.00,0.00,1.00 --57.60,33.60,1.00,0.00,1.00 --52.80,33.60,1.00,0.00,1.00 --48.00,28.80,1.00,0.00,1.00 --43.20,28.80,1.00,0.00,1.00 --38.40,24.00,1.00,0.00,1.00 --33.60,24.00,1.00,0.00,1.00 --28.80,19.20,1.00,0.00,1.00 --24.00,19.20,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 --14.40,9.60,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -9.60,-9.60,1.00,0.00,1.00 -14.40,-14.40,1.00,0.00,1.00 -19.20,-14.40,1.00,0.00,1.00 -24.00,-19.20,1.00,0.00,1.00 -24.00,-24.00,1.00,0.00,1.00 -28.80,-24.00,1.00,0.00,1.00 -33.60,-28.80,1.00,0.00,1.00 -38.40,-28.80,1.00,0.00,1.00 -43.20,-33.60,1.00,0.00,1.00 -48.00,-33.60,1.00,0.00,1.00 -52.80,-38.40,1.00,0.00,1.00 -62.40,-38.40,1.00,0.00,1.00 -67.20,-38.40,1.00,0.00,1.00 -72.00,-43.20,1.00,0.00,1.00 -76.80,-43.20,1.00,0.00,1.00 -86.40,-43.20,1.00,0.00,1.00 -91.20,-43.20,1.00,0.00,1.00 -96.00,-43.20,1.00,0.00,1.00 -105.60,-43.20,1.00,0.00,1.00 -110.40,-43.20,1.00,0.00,1.00 -115.20,-38.40,1.00,0.00,1.00 -124.80,-38.40,1.00,0.00,1.00 -129.60,-38.40,1.00,0.00,1.00 -134.40,-33.60,1.00,0.00,1.00 -139.20,-33.60,1.00,0.00,1.00 -144.00,-28.80,1.00,0.00,1.00 -148.80,-28.80,1.00,0.00,1.00 -153.60,-24.00,1.00,0.00,1.00 -158.40,-19.20,1.00,0.00,1.00 -158.40,-19.20,1.00,0.00,1.00 -163.20,-14.40,1.00,0.00,1.00 -168.00,-9.60,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 --158.40,19.20,1.00,0.00,1.00 --158.40,19.20,1.00,0.00,1.00 --153.60,24.00,1.00,0.00,1.00 --148.80,28.80,1.00,0.00,1.00 --144.00,28.80,1.00,0.00,1.00 --139.20,33.60,1.00,0.00,1.00 --134.40,33.60,1.00,0.00,1.00 --129.60,38.40,1.00,0.00,1.00 --124.80,38.40,1.00,0.00,1.00 --115.20,38.40,1.00,0.00,1.00 --110.40,43.20,1.00,0.00,1.00 --105.60,43.20,1.00,0.00,1.00 --96.00,43.20,1.00,0.00,1.00 --91.20,43.20,1.00,0.00,1.00 --86.40,43.20,1.00,0.00,1.00 --76.80,43.20,1.00,0.00,1.00 --72.00,43.20,1.00,0.00,1.00 --67.20,38.40,1.00,0.00,1.00 --62.40,38.40,1.00,0.00,1.00 --52.80,38.40,1.00,0.00,1.00 --48.00,33.60,1.00,0.00,1.00 --43.20,33.60,1.00,0.00,1.00 --38.40,28.80,1.00,0.00,1.00 --33.60,28.80,1.00,0.00,1.00 --28.80,24.00,1.00,0.00,1.00 --24.00,24.00,1.00,0.00,1.00 --24.00,19.20,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 --14.40,14.40,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -9.60,-9.60,1.00,0.00,1.00 -14.40,-14.40,1.00,0.00,1.00 -14.40,-19.20,1.00,0.00,1.00 -19.20,-19.20,1.00,0.00,1.00 -24.00,-24.00,1.00,0.00,1.00 -28.80,-28.80,1.00,0.00,1.00 -33.60,-28.80,1.00,0.00,1.00 -38.40,-33.60,1.00,0.00,1.00 -43.20,-38.40,1.00,0.00,1.00 -48.00,-38.40,1.00,0.00,1.00 -52.80,-43.20,1.00,0.00,1.00 -57.60,-43.20,1.00,0.00,1.00 -62.40,-43.20,1.00,0.00,1.00 -72.00,-48.00,1.00,0.00,1.00 -76.80,-48.00,1.00,0.00,1.00 -86.40,-48.00,1.00,0.00,1.00 -91.20,-48.00,1.00,0.00,1.00 -100.80,-48.00,1.00,0.00,1.00 -105.60,-48.00,1.00,0.00,1.00 -110.40,-48.00,1.00,0.00,1.00 -120.00,-43.20,1.00,0.00,1.00 -124.80,-43.20,1.00,0.00,1.00 -129.60,-38.40,1.00,0.00,1.00 -134.40,-38.40,1.00,0.00,1.00 -139.20,-33.60,1.00,0.00,1.00 -144.00,-33.60,1.00,0.00,1.00 -148.80,-28.80,1.00,0.00,1.00 -153.60,-24.00,1.00,0.00,1.00 -158.40,-24.00,1.00,0.00,1.00 -163.20,-19.20,1.00,0.00,1.00 -163.20,-14.40,1.00,0.00,1.00 -168.00,-14.40,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --168.00,14.40,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 --163.20,19.20,1.00,0.00,1.00 --158.40,24.00,1.00,0.00,1.00 --153.60,24.00,1.00,0.00,1.00 --148.80,28.80,1.00,0.00,1.00 --144.00,33.60,1.00,0.00,1.00 --139.20,33.60,1.00,0.00,1.00 --134.40,38.40,1.00,0.00,1.00 --129.60,38.40,1.00,0.00,1.00 --124.80,43.20,1.00,0.00,1.00 --120.00,43.20,1.00,0.00,1.00 --110.40,48.00,1.00,0.00,1.00 --105.60,48.00,1.00,0.00,1.00 --100.80,48.00,1.00,0.00,1.00 --91.20,48.00,1.00,0.00,1.00 --86.40,48.00,1.00,0.00,1.00 --76.80,48.00,1.00,0.00,1.00 --72.00,48.00,1.00,0.00,1.00 --62.40,43.20,1.00,0.00,1.00 --57.60,43.20,1.00,0.00,1.00 --52.80,43.20,1.00,0.00,1.00 --48.00,38.40,1.00,0.00,1.00 --43.20,38.40,1.00,0.00,1.00 --38.40,33.60,1.00,0.00,1.00 --33.60,28.80,1.00,0.00,1.00 --28.80,28.80,1.00,0.00,1.00 --24.00,24.00,1.00,0.00,1.00 --19.20,19.20,1.00,0.00,1.00 --14.40,19.20,1.00,0.00,1.00 --14.40,14.40,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -9.60,-9.60,1.00,0.00,1.00 -9.60,-14.40,1.00,0.00,1.00 -14.40,-19.20,1.00,0.00,1.00 -19.20,-24.00,1.00,0.00,1.00 -24.00,-24.00,1.00,0.00,1.00 -24.00,-28.80,1.00,0.00,1.00 -28.80,-33.60,1.00,0.00,1.00 -33.60,-38.40,1.00,0.00,1.00 -38.40,-38.40,1.00,0.00,1.00 -43.20,-43.20,1.00,0.00,1.00 -48.00,-43.20,1.00,0.00,1.00 -52.80,-48.00,1.00,0.00,1.00 -62.40,-48.00,1.00,0.00,1.00 -67.20,-52.80,1.00,0.00,1.00 -76.80,-52.80,1.00,0.00,1.00 -86.40,-52.80,1.00,0.00,1.00 -91.20,-52.80,1.00,0.00,1.00 -100.80,-52.80,1.00,0.00,1.00 -105.60,-52.80,1.00,0.00,1.00 -115.20,-48.00,1.00,0.00,1.00 -120.00,-48.00,1.00,0.00,1.00 -129.60,-48.00,1.00,0.00,1.00 -134.40,-43.20,1.00,0.00,1.00 -139.20,-43.20,1.00,0.00,1.00 -144.00,-38.40,1.00,0.00,1.00 -148.80,-33.60,1.00,0.00,1.00 -153.60,-33.60,1.00,0.00,1.00 -158.40,-28.80,1.00,0.00,1.00 -158.40,-24.00,1.00,0.00,1.00 -163.20,-19.20,1.00,0.00,1.00 -168.00,-19.20,1.00,0.00,1.00 -168.00,-14.40,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --168.00,14.40,1.00,0.00,1.00 --168.00,19.20,1.00,0.00,1.00 --163.20,19.20,1.00,0.00,1.00 --158.40,24.00,1.00,0.00,1.00 --158.40,28.80,1.00,0.00,1.00 --153.60,33.60,1.00,0.00,1.00 --148.80,33.60,1.00,0.00,1.00 --144.00,38.40,1.00,0.00,1.00 --139.20,43.20,1.00,0.00,1.00 --134.40,43.20,1.00,0.00,1.00 --129.60,48.00,1.00,0.00,1.00 --120.00,48.00,1.00,0.00,1.00 --115.20,48.00,1.00,0.00,1.00 --105.60,52.80,1.00,0.00,1.00 --100.80,52.80,1.00,0.00,1.00 --91.20,52.80,1.00,0.00,1.00 --86.40,52.80,1.00,0.00,1.00 --76.80,52.80,1.00,0.00,1.00 --67.20,52.80,1.00,0.00,1.00 --62.40,48.00,1.00,0.00,1.00 --52.80,48.00,1.00,0.00,1.00 --48.00,43.20,1.00,0.00,1.00 --43.20,43.20,1.00,0.00,1.00 --38.40,38.40,1.00,0.00,1.00 --33.60,38.40,1.00,0.00,1.00 --28.80,33.60,1.00,0.00,1.00 --24.00,28.80,1.00,0.00,1.00 --24.00,24.00,1.00,0.00,1.00 --19.20,24.00,1.00,0.00,1.00 --14.40,19.20,1.00,0.00,1.00 --9.60,14.40,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -9.60,-14.40,1.00,0.00,1.00 -9.60,-14.40,1.00,0.00,1.00 -14.40,-19.20,1.00,0.00,1.00 -14.40,-24.00,1.00,0.00,1.00 -19.20,-28.80,1.00,0.00,1.00 -24.00,-33.60,1.00,0.00,1.00 -28.80,-33.60,1.00,0.00,1.00 -28.80,-38.40,1.00,0.00,1.00 -33.60,-43.20,1.00,0.00,1.00 -38.40,-43.20,1.00,0.00,1.00 -48.00,-48.00,1.00,0.00,1.00 -52.80,-52.80,1.00,0.00,1.00 -57.60,-52.80,1.00,0.00,1.00 -67.20,-57.60,1.00,0.00,1.00 -76.80,-57.60,1.00,0.00,1.00 -81.60,-57.60,1.00,0.00,1.00 -91.20,-57.60,1.00,0.00,1.00 -100.80,-57.60,1.00,0.00,1.00 -110.40,-57.60,1.00,0.00,1.00 -115.20,-52.80,1.00,0.00,1.00 -124.80,-52.80,1.00,0.00,1.00 -129.60,-48.00,1.00,0.00,1.00 -139.20,-48.00,1.00,0.00,1.00 -144.00,-43.20,1.00,0.00,1.00 -148.80,-38.40,1.00,0.00,1.00 -153.60,-38.40,1.00,0.00,1.00 -153.60,-33.60,1.00,0.00,1.00 -158.40,-28.80,1.00,0.00,1.00 -163.20,-24.00,1.00,0.00,1.00 -163.20,-24.00,1.00,0.00,1.00 -168.00,-19.20,1.00,0.00,1.00 -172.80,-14.40,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --172.80,14.40,1.00,0.00,1.00 --168.00,19.20,1.00,0.00,1.00 --163.20,24.00,1.00,0.00,1.00 --163.20,24.00,1.00,0.00,1.00 --158.40,28.80,1.00,0.00,1.00 --153.60,33.60,1.00,0.00,1.00 --153.60,38.40,1.00,0.00,1.00 --148.80,38.40,1.00,0.00,1.00 --144.00,43.20,1.00,0.00,1.00 --139.20,48.00,1.00,0.00,1.00 --129.60,48.00,1.00,0.00,1.00 --124.80,52.80,1.00,0.00,1.00 --115.20,52.80,1.00,0.00,1.00 --110.40,57.60,1.00,0.00,1.00 --100.80,57.60,1.00,0.00,1.00 --91.20,57.60,1.00,0.00,1.00 --81.60,57.60,1.00,0.00,1.00 --76.80,57.60,1.00,0.00,1.00 --67.20,57.60,1.00,0.00,1.00 --57.60,52.80,1.00,0.00,1.00 --52.80,52.80,1.00,0.00,1.00 --48.00,48.00,1.00,0.00,1.00 --38.40,43.20,1.00,0.00,1.00 --33.60,43.20,1.00,0.00,1.00 --28.80,38.40,1.00,0.00,1.00 --28.80,33.60,1.00,0.00,1.00 --24.00,33.60,1.00,0.00,1.00 --19.20,28.80,1.00,0.00,1.00 --14.40,24.00,1.00,0.00,1.00 --14.40,19.20,1.00,0.00,1.00 --9.60,14.40,1.00,0.00,1.00 --9.60,14.40,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -4.80,-14.40,1.00,0.00,1.00 -9.60,-19.20,1.00,0.00,1.00 -9.60,-19.20,1.00,0.00,1.00 -14.40,-24.00,1.00,0.00,1.00 -19.20,-28.80,1.00,0.00,1.00 -19.20,-33.60,1.00,0.00,1.00 -24.00,-38.40,1.00,0.00,1.00 -28.80,-43.20,1.00,0.00,1.00 -33.60,-43.20,1.00,0.00,1.00 -38.40,-48.00,1.00,0.00,1.00 -43.20,-52.80,1.00,0.00,1.00 -48.00,-52.80,1.00,0.00,1.00 -52.80,-57.60,1.00,0.00,1.00 -62.40,-57.60,1.00,0.00,1.00 -72.00,-62.40,1.00,0.00,1.00 -81.60,-62.40,1.00,0.00,1.00 -91.20,-62.40,1.00,0.00,1.00 -100.80,-62.40,1.00,0.00,1.00 -110.40,-62.40,1.00,0.00,1.00 -120.00,-57.60,1.00,0.00,1.00 -129.60,-57.60,1.00,0.00,1.00 -134.40,-52.80,1.00,0.00,1.00 -139.20,-48.00,1.00,0.00,1.00 -144.00,-48.00,1.00,0.00,1.00 -148.80,-43.20,1.00,0.00,1.00 -153.60,-38.40,1.00,0.00,1.00 -158.40,-33.60,1.00,0.00,1.00 -163.20,-33.60,1.00,0.00,1.00 -163.20,-28.80,1.00,0.00,1.00 -168.00,-24.00,1.00,0.00,1.00 -168.00,-19.20,1.00,0.00,1.00 -172.80,-14.40,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --172.80,14.40,1.00,0.00,1.00 --168.00,19.20,1.00,0.00,1.00 --168.00,24.00,1.00,0.00,1.00 --163.20,28.80,1.00,0.00,1.00 --163.20,33.60,1.00,0.00,1.00 --158.40,33.60,1.00,0.00,1.00 --153.60,38.40,1.00,0.00,1.00 --148.80,43.20,1.00,0.00,1.00 --144.00,48.00,1.00,0.00,1.00 --139.20,48.00,1.00,0.00,1.00 --134.40,52.80,1.00,0.00,1.00 --129.60,57.60,1.00,0.00,1.00 --120.00,57.60,1.00,0.00,1.00 --110.40,62.40,1.00,0.00,1.00 --100.80,62.40,1.00,0.00,1.00 --91.20,62.40,1.00,0.00,1.00 --81.60,62.40,1.00,0.00,1.00 --72.00,62.40,1.00,0.00,1.00 --62.40,57.60,1.00,0.00,1.00 --52.80,57.60,1.00,0.00,1.00 --48.00,52.80,1.00,0.00,1.00 --43.20,52.80,1.00,0.00,1.00 --38.40,48.00,1.00,0.00,1.00 --33.60,43.20,1.00,0.00,1.00 --28.80,43.20,1.00,0.00,1.00 --24.00,38.40,1.00,0.00,1.00 --19.20,33.60,1.00,0.00,1.00 --19.20,28.80,1.00,0.00,1.00 --14.40,24.00,1.00,0.00,1.00 --9.60,19.20,1.00,0.00,1.00 --9.60,19.20,1.00,0.00,1.00 --4.80,14.40,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -4.80,-14.40,1.00,0.00,1.00 -9.60,-19.20,1.00,0.00,1.00 -9.60,-24.00,1.00,0.00,1.00 -14.40,-24.00,1.00,0.00,1.00 -14.40,-28.80,1.00,0.00,1.00 -19.20,-33.60,1.00,0.00,1.00 -19.20,-38.40,1.00,0.00,1.00 -24.00,-43.20,1.00,0.00,1.00 -28.80,-48.00,1.00,0.00,1.00 -33.60,-52.80,1.00,0.00,1.00 -38.40,-52.80,1.00,0.00,1.00 -43.20,-57.60,1.00,0.00,1.00 -48.00,-62.40,1.00,0.00,1.00 -57.60,-62.40,1.00,0.00,1.00 -67.20,-67.20,1.00,0.00,1.00 -81.60,-67.20,1.00,0.00,1.00 -91.20,-67.20,1.00,0.00,1.00 -105.60,-67.20,1.00,0.00,1.00 -115.20,-67.20,1.00,0.00,1.00 -124.80,-62.40,1.00,0.00,1.00 -134.40,-57.60,1.00,0.00,1.00 -139.20,-57.60,1.00,0.00,1.00 -144.00,-52.80,1.00,0.00,1.00 -148.80,-48.00,1.00,0.00,1.00 -153.60,-43.20,1.00,0.00,1.00 -158.40,-43.20,1.00,0.00,1.00 -163.20,-38.40,1.00,0.00,1.00 -163.20,-33.60,1.00,0.00,1.00 -168.00,-28.80,1.00,0.00,1.00 -168.00,-24.00,1.00,0.00,1.00 -172.80,-19.20,1.00,0.00,1.00 -172.80,-14.40,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --172.80,14.40,1.00,0.00,1.00 --172.80,19.20,1.00,0.00,1.00 --168.00,24.00,1.00,0.00,1.00 --168.00,28.80,1.00,0.00,1.00 --163.20,33.60,1.00,0.00,1.00 --163.20,38.40,1.00,0.00,1.00 --158.40,43.20,1.00,0.00,1.00 --153.60,43.20,1.00,0.00,1.00 --148.80,48.00,1.00,0.00,1.00 --144.00,52.80,1.00,0.00,1.00 --139.20,57.60,1.00,0.00,1.00 --134.40,57.60,1.00,0.00,1.00 --124.80,62.40,1.00,0.00,1.00 --115.20,67.20,1.00,0.00,1.00 --105.60,67.20,1.00,0.00,1.00 --91.20,67.20,1.00,0.00,1.00 --81.60,67.20,1.00,0.00,1.00 --67.20,67.20,1.00,0.00,1.00 --57.60,62.40,1.00,0.00,1.00 --48.00,62.40,1.00,0.00,1.00 --43.20,57.60,1.00,0.00,1.00 --38.40,52.80,1.00,0.00,1.00 --33.60,52.80,1.00,0.00,1.00 --28.80,48.00,1.00,0.00,1.00 --24.00,43.20,1.00,0.00,1.00 --19.20,38.40,1.00,0.00,1.00 --19.20,33.60,1.00,0.00,1.00 --14.40,28.80,1.00,0.00,1.00 --14.40,24.00,1.00,0.00,1.00 --9.60,24.00,1.00,0.00,1.00 --9.60,19.20,1.00,0.00,1.00 --4.80,14.40,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -4.80,-14.40,1.00,0.00,1.00 -4.80,-19.20,1.00,0.00,1.00 -9.60,-24.00,1.00,0.00,1.00 -9.60,-28.80,1.00,0.00,1.00 -9.60,-33.60,1.00,0.00,1.00 -14.40,-38.40,1.00,0.00,1.00 -14.40,-38.40,1.00,0.00,1.00 -19.20,-43.20,1.00,0.00,1.00 -24.00,-48.00,1.00,0.00,1.00 -24.00,-52.80,1.00,0.00,1.00 -28.80,-57.60,1.00,0.00,1.00 -38.40,-62.40,1.00,0.00,1.00 -43.20,-62.40,1.00,0.00,1.00 -52.80,-67.20,1.00,0.00,1.00 -62.40,-72.00,1.00,0.00,1.00 -76.80,-72.00,1.00,0.00,1.00 -96.00,-72.00,1.00,0.00,1.00 -110.40,-72.00,1.00,0.00,1.00 -120.00,-67.20,1.00,0.00,1.00 -134.40,-67.20,1.00,0.00,1.00 -139.20,-62.40,1.00,0.00,1.00 -148.80,-57.60,1.00,0.00,1.00 -153.60,-57.60,1.00,0.00,1.00 -158.40,-52.80,1.00,0.00,1.00 -158.40,-48.00,1.00,0.00,1.00 -163.20,-43.20,1.00,0.00,1.00 -163.20,-38.40,1.00,0.00,1.00 -168.00,-33.60,1.00,0.00,1.00 -168.00,-28.80,1.00,0.00,1.00 -172.80,-24.00,1.00,0.00,1.00 -172.80,-19.20,1.00,0.00,1.00 -172.80,-14.40,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --172.80,14.40,1.00,0.00,1.00 --172.80,19.20,1.00,0.00,1.00 --172.80,24.00,1.00,0.00,1.00 --168.00,28.80,1.00,0.00,1.00 --168.00,33.60,1.00,0.00,1.00 --163.20,38.40,1.00,0.00,1.00 --163.20,43.20,1.00,0.00,1.00 --158.40,48.00,1.00,0.00,1.00 --158.40,52.80,1.00,0.00,1.00 --153.60,57.60,1.00,0.00,1.00 --148.80,57.60,1.00,0.00,1.00 --139.20,62.40,1.00,0.00,1.00 --134.40,67.20,1.00,0.00,1.00 --120.00,67.20,1.00,0.00,1.00 --110.40,72.00,1.00,0.00,1.00 --96.00,72.00,1.00,0.00,1.00 --76.80,72.00,1.00,0.00,1.00 --62.40,72.00,1.00,0.00,1.00 --52.80,67.20,1.00,0.00,1.00 --43.20,62.40,1.00,0.00,1.00 --38.40,62.40,1.00,0.00,1.00 --28.80,57.60,1.00,0.00,1.00 --24.00,52.80,1.00,0.00,1.00 --24.00,48.00,1.00,0.00,1.00 --19.20,43.20,1.00,0.00,1.00 --14.40,38.40,1.00,0.00,1.00 --14.40,38.40,1.00,0.00,1.00 --9.60,33.60,1.00,0.00,1.00 --9.60,28.80,1.00,0.00,1.00 --9.60,24.00,1.00,0.00,1.00 --4.80,19.20,1.00,0.00,1.00 --4.80,14.40,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,-9.60,1.00,0.00,1.00 -4.80,-14.40,1.00,0.00,1.00 -4.80,-19.20,1.00,0.00,1.00 -4.80,-24.00,1.00,0.00,1.00 -4.80,-28.80,1.00,0.00,1.00 -9.60,-33.60,1.00,0.00,1.00 -9.60,-38.40,1.00,0.00,1.00 -14.40,-43.20,1.00,0.00,1.00 -14.40,-48.00,1.00,0.00,1.00 -14.40,-52.80,1.00,0.00,1.00 -19.20,-57.60,1.00,0.00,1.00 -24.00,-57.60,1.00,0.00,1.00 -28.80,-62.40,1.00,0.00,1.00 -33.60,-67.20,1.00,0.00,1.00 -43.20,-72.00,1.00,0.00,1.00 -57.60,-72.00,1.00,0.00,1.00 -76.80,-76.80,1.00,0.00,1.00 -96.00,-76.80,1.00,0.00,1.00 -115.20,-76.80,1.00,0.00,1.00 -129.60,-72.00,1.00,0.00,1.00 -139.20,-72.00,1.00,0.00,1.00 -148.80,-67.20,1.00,0.00,1.00 -153.60,-62.40,1.00,0.00,1.00 -158.40,-57.60,1.00,0.00,1.00 -163.20,-52.80,1.00,0.00,1.00 -163.20,-48.00,1.00,0.00,1.00 -168.00,-43.20,1.00,0.00,1.00 -168.00,-38.40,1.00,0.00,1.00 -172.80,-33.60,1.00,0.00,1.00 -172.80,-28.80,1.00,0.00,1.00 -172.80,-24.00,1.00,0.00,1.00 -172.80,-19.20,1.00,0.00,1.00 -177.60,-14.40,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --177.60,14.40,1.00,0.00,1.00 --172.80,19.20,1.00,0.00,1.00 --172.80,24.00,1.00,0.00,1.00 --172.80,28.80,1.00,0.00,1.00 --172.80,33.60,1.00,0.00,1.00 --168.00,38.40,1.00,0.00,1.00 --168.00,43.20,1.00,0.00,1.00 --163.20,48.00,1.00,0.00,1.00 --163.20,52.80,1.00,0.00,1.00 --158.40,57.60,1.00,0.00,1.00 --153.60,62.40,1.00,0.00,1.00 --148.80,67.20,1.00,0.00,1.00 --139.20,72.00,1.00,0.00,1.00 --129.60,72.00,1.00,0.00,1.00 --115.20,76.80,1.00,0.00,1.00 --96.00,76.80,1.00,0.00,1.00 --76.80,76.80,1.00,0.00,1.00 --57.60,72.00,1.00,0.00,1.00 --43.20,72.00,1.00,0.00,1.00 --33.60,67.20,1.00,0.00,1.00 --28.80,62.40,1.00,0.00,1.00 --24.00,57.60,1.00,0.00,1.00 --19.20,57.60,1.00,0.00,1.00 --14.40,52.80,1.00,0.00,1.00 --14.40,48.00,1.00,0.00,1.00 --14.40,43.20,1.00,0.00,1.00 --9.60,38.40,1.00,0.00,1.00 --9.60,33.60,1.00,0.00,1.00 --4.80,28.80,1.00,0.00,1.00 --4.80,24.00,1.00,0.00,1.00 --4.80,19.20,1.00,0.00,1.00 --4.80,14.40,1.00,0.00,1.00 --0.00,9.60,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,-9.60,1.00,0.00,1.00 -0.00,-14.40,1.00,0.00,1.00 -4.80,-19.20,1.00,0.00,1.00 -4.80,-24.00,1.00,0.00,1.00 -4.80,-28.80,1.00,0.00,1.00 -4.80,-33.60,1.00,0.00,1.00 -4.80,-38.40,1.00,0.00,1.00 -9.60,-43.20,1.00,0.00,1.00 -9.60,-48.00,1.00,0.00,1.00 -9.60,-52.80,1.00,0.00,1.00 -14.40,-57.60,1.00,0.00,1.00 -14.40,-62.40,1.00,0.00,1.00 -19.20,-67.20,1.00,0.00,1.00 -24.00,-72.00,1.00,0.00,1.00 -33.60,-72.00,1.00,0.00,1.00 -43.20,-76.80,1.00,0.00,1.00 -67.20,-81.60,1.00,0.00,1.00 -96.00,-81.60,1.00,0.00,1.00 -124.80,-81.60,1.00,0.00,1.00 -144.00,-76.80,1.00,0.00,1.00 -153.60,-72.00,1.00,0.00,1.00 -158.40,-67.20,1.00,0.00,1.00 -163.20,-62.40,1.00,0.00,1.00 -168.00,-57.60,1.00,0.00,1.00 -168.00,-52.80,1.00,0.00,1.00 -168.00,-48.00,1.00,0.00,1.00 -172.80,-43.20,1.00,0.00,1.00 -172.80,-38.40,1.00,0.00,1.00 -172.80,-33.60,1.00,0.00,1.00 -172.80,-28.80,1.00,0.00,1.00 -177.60,-24.00,1.00,0.00,1.00 -177.60,-19.20,1.00,0.00,1.00 -177.60,-14.40,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --177.60,14.40,1.00,0.00,1.00 --177.60,19.20,1.00,0.00,1.00 --177.60,24.00,1.00,0.00,1.00 --172.80,28.80,1.00,0.00,1.00 --172.80,33.60,1.00,0.00,1.00 --172.80,38.40,1.00,0.00,1.00 --172.80,43.20,1.00,0.00,1.00 --168.00,48.00,1.00,0.00,1.00 --168.00,52.80,1.00,0.00,1.00 --168.00,57.60,1.00,0.00,1.00 --163.20,62.40,1.00,0.00,1.00 --158.40,67.20,1.00,0.00,1.00 --153.60,72.00,1.00,0.00,1.00 --144.00,76.80,1.00,0.00,1.00 --124.80,81.60,1.00,0.00,1.00 --96.00,81.60,1.00,0.00,1.00 --67.20,81.60,1.00,0.00,1.00 --43.20,76.80,1.00,0.00,1.00 --33.60,72.00,1.00,0.00,1.00 --24.00,72.00,1.00,0.00,1.00 --19.20,67.20,1.00,0.00,1.00 --14.40,62.40,1.00,0.00,1.00 --14.40,57.60,1.00,0.00,1.00 --9.60,52.80,1.00,0.00,1.00 --9.60,48.00,1.00,0.00,1.00 --9.60,43.20,1.00,0.00,1.00 --4.80,38.40,1.00,0.00,1.00 --4.80,33.60,1.00,0.00,1.00 --4.80,28.80,1.00,0.00,1.00 --4.80,24.00,1.00,0.00,1.00 --4.80,19.20,1.00,0.00,1.00 --0.00,14.40,1.00,0.00,1.00 --0.00,9.60,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,-9.60,1.00,0.00,1.00 -0.00,-14.40,1.00,0.00,1.00 -0.00,-19.20,1.00,0.00,1.00 -0.00,-24.00,1.00,0.00,1.00 -0.00,-28.80,1.00,0.00,1.00 -0.00,-33.60,1.00,0.00,1.00 -4.80,-38.40,1.00,0.00,1.00 -4.80,-43.20,1.00,0.00,1.00 -4.80,-48.00,1.00,0.00,1.00 -4.80,-52.80,1.00,0.00,1.00 -4.80,-57.60,1.00,0.00,1.00 -4.80,-62.40,1.00,0.00,1.00 -9.60,-67.20,1.00,0.00,1.00 -9.60,-72.00,1.00,0.00,1.00 -14.40,-76.80,1.00,0.00,1.00 -24.00,-81.60,1.00,0.00,1.00 -43.20,-86.40,1.00,0.00,1.00 -110.40,-86.40,1.00,0.00,1.00 -148.80,-81.60,1.00,0.00,1.00 -163.20,-76.80,1.00,0.00,1.00 -168.00,-72.00,1.00,0.00,1.00 -172.80,-67.20,1.00,0.00,1.00 -172.80,-62.40,1.00,0.00,1.00 -172.80,-57.60,1.00,0.00,1.00 -172.80,-52.80,1.00,0.00,1.00 -177.60,-48.00,1.00,0.00,1.00 -177.60,-43.20,1.00,0.00,1.00 -177.60,-38.40,1.00,0.00,1.00 -177.60,-33.60,1.00,0.00,1.00 -177.60,-28.80,1.00,0.00,1.00 -177.60,-24.00,1.00,0.00,1.00 -177.60,-19.20,1.00,0.00,1.00 -177.60,-14.40,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --177.60,14.40,1.00,0.00,1.00 --177.60,19.20,1.00,0.00,1.00 --177.60,24.00,1.00,0.00,1.00 --177.60,28.80,1.00,0.00,1.00 --177.60,33.60,1.00,0.00,1.00 --177.60,38.40,1.00,0.00,1.00 --177.60,43.20,1.00,0.00,1.00 --177.60,48.00,1.00,0.00,1.00 --172.80,52.80,1.00,0.00,1.00 --172.80,57.60,1.00,0.00,1.00 --172.80,62.40,1.00,0.00,1.00 --172.80,67.20,1.00,0.00,1.00 --168.00,72.00,1.00,0.00,1.00 --163.20,76.80,1.00,0.00,1.00 --148.80,81.60,1.00,0.00,1.00 --110.40,86.40,1.00,0.00,1.00 --43.20,86.40,1.00,0.00,1.00 --24.00,81.60,1.00,0.00,1.00 --14.40,76.80,1.00,0.00,1.00 --9.60,72.00,1.00,0.00,1.00 --9.60,67.20,1.00,0.00,1.00 --4.80,62.40,1.00,0.00,1.00 --4.80,57.60,1.00,0.00,1.00 --4.80,52.80,1.00,0.00,1.00 --4.80,48.00,1.00,0.00,1.00 --4.80,43.20,1.00,0.00,1.00 --4.80,38.40,1.00,0.00,1.00 --0.00,33.60,1.00,0.00,1.00 --0.00,28.80,1.00,0.00,1.00 --0.00,24.00,1.00,0.00,1.00 --0.00,19.20,1.00,0.00,1.00 --0.00,14.40,1.00,0.00,1.00 --0.00,9.60,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --0.00,-4.80,1.00,0.00,1.00 --0.00,-9.60,1.00,0.00,1.00 --0.00,-14.40,1.00,0.00,1.00 --0.00,-19.20,1.00,0.00,1.00 --0.00,-24.00,1.00,0.00,1.00 --0.00,-28.80,1.00,0.00,1.00 --0.00,-33.60,1.00,0.00,1.00 --0.00,-38.40,1.00,0.00,1.00 --0.00,-43.20,1.00,0.00,1.00 --0.00,-48.00,1.00,0.00,1.00 --0.00,-52.80,1.00,0.00,1.00 --0.00,-57.60,1.00,0.00,1.00 --0.00,-62.40,1.00,0.00,1.00 --4.80,-67.20,1.00,0.00,1.00 --4.80,-72.00,1.00,0.00,1.00 --4.80,-76.80,1.00,0.00,1.00 --9.60,-81.60,1.00,0.00,1.00 --19.20,-86.40,1.00,0.00,1.00 --134.40,-86.40,1.00,0.00,1.00 --168.00,-81.60,1.00,0.00,1.00 --172.80,-76.80,1.00,0.00,1.00 --177.60,-72.00,1.00,0.00,1.00 --177.60,-67.20,1.00,0.00,1.00 --177.60,-62.40,1.00,0.00,1.00 --177.60,-57.60,1.00,0.00,1.00 --177.60,-52.80,1.00,0.00,1.00 --177.60,-48.00,1.00,0.00,1.00 --177.60,-43.20,1.00,0.00,1.00 --177.60,-38.40,1.00,0.00,1.00 --177.60,-33.60,1.00,0.00,1.00 --177.60,-28.80,1.00,0.00,1.00 --177.60,-24.00,1.00,0.00,1.00 --177.60,-19.20,1.00,0.00,1.00 --177.60,-14.40,1.00,0.00,1.00 --177.60,-9.60,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,9.60,1.00,0.00,1.00 -177.60,14.40,1.00,0.00,1.00 -177.60,19.20,1.00,0.00,1.00 -177.60,24.00,1.00,0.00,1.00 -177.60,28.80,1.00,0.00,1.00 -177.60,33.60,1.00,0.00,1.00 -177.60,38.40,1.00,0.00,1.00 -177.60,43.20,1.00,0.00,1.00 -177.60,48.00,1.00,0.00,1.00 -177.60,52.80,1.00,0.00,1.00 -177.60,57.60,1.00,0.00,1.00 -177.60,62.40,1.00,0.00,1.00 -177.60,67.20,1.00,0.00,1.00 -177.60,72.00,1.00,0.00,1.00 -172.80,76.80,1.00,0.00,1.00 -168.00,81.60,1.00,0.00,1.00 -134.40,86.40,1.00,0.00,1.00 -19.20,86.40,1.00,0.00,1.00 -9.60,81.60,1.00,0.00,1.00 -4.80,76.80,1.00,0.00,1.00 -4.80,72.00,1.00,0.00,1.00 -4.80,67.20,1.00,0.00,1.00 -0.00,62.40,1.00,0.00,1.00 -0.00,57.60,1.00,0.00,1.00 -0.00,52.80,1.00,0.00,1.00 -0.00,48.00,1.00,0.00,1.00 -0.00,43.20,1.00,0.00,1.00 -0.00,38.40,1.00,0.00,1.00 -0.00,33.60,1.00,0.00,1.00 -0.00,28.80,1.00,0.00,1.00 -0.00,24.00,1.00,0.00,1.00 -0.00,19.20,1.00,0.00,1.00 -0.00,14.40,1.00,0.00,1.00 -0.00,9.60,1.00,0.00,1.00 -0.00,4.80,1.00,0.00,1.00 +0.00,0.00,0.00,0.00,1.00,0.00,0.00 +4.80,0.00,0.02,0.00,1.00,0.00,-4.80 +9.60,0.00,0.04,0.00,1.00,0.00,4.80 +14.40,0.00,0.06,0.00,1.00,0.00,-9.60 +19.20,0.00,0.09,0.00,1.00,0.00,14.40 +24.00,0.00,0.11,0.00,1.00,0.00,-14.40 +28.80,0.00,0.13,0.00,1.00,0.00,19.20 +33.60,0.00,0.15,0.00,1.00,0.00,-24.00 +38.40,0.00,0.17,0.00,1.00,0.00,24.00 +43.20,0.00,0.19,0.00,1.00,0.00,-28.80 +48.00,0.00,0.21,0.00,1.00,0.00,33.60 +52.80,0.00,0.23,0.00,1.00,0.00,-33.60 +57.60,0.00,0.26,0.00,1.00,0.00,38.40 +62.40,0.00,0.28,0.00,1.00,4.80,-38.40 +67.20,0.00,0.30,0.00,1.00,4.80,38.40 +72.00,0.00,0.32,0.00,1.00,4.80,-43.20 +76.80,0.00,0.34,0.00,1.00,9.60,43.20 +81.60,0.00,0.36,0.00,1.00,19.20,-43.20 +86.40,0.00,0.38,0.00,1.00,134.40,43.20 +91.20,0.00,0.41,0.00,1.00,168.00,-43.20 +96.00,0.00,0.43,0.00,1.00,172.80,43.20 +100.80,0.00,0.45,0.00,1.00,177.60,-43.20 +105.60,0.00,0.47,0.00,1.00,177.60,43.20 +110.40,0.00,0.49,0.00,1.00,177.60,-43.20 +115.20,0.00,0.51,0.00,1.00,177.60,38.40 +120.00,0.00,0.53,0.00,1.00,177.60,-38.40 +124.80,0.00,0.56,0.00,1.00,177.60,33.60 +129.60,0.00,0.58,0.00,1.00,177.60,-33.60 +134.40,0.00,0.60,0.00,1.00,177.60,28.80 +139.20,0.00,0.62,0.00,1.00,177.60,-28.80 +144.00,0.00,0.64,0.00,1.00,177.60,24.00 +148.80,0.00,0.66,0.00,1.00,177.60,-19.20 +153.60,0.00,0.68,0.00,1.00,177.60,19.20 +158.40,0.00,0.70,0.00,1.00,177.60,-14.40 +163.20,0.00,0.73,0.00,1.00,177.60,9.60 +168.00,0.00,0.75,0.00,1.00,177.60,-9.60 +172.80,0.00,0.77,0.00,1.00,177.60,4.80 +177.60,0.00,0.79,0.00,1.00,-177.60,-0.00 +-177.60,0.00,0.81,0.00,1.00,-177.60,-0.00 +-172.80,0.00,0.83,0.00,1.00,-177.60,4.80 +-168.00,0.00,0.85,0.00,1.00,-177.60,-9.60 +-163.20,0.00,0.88,0.00,1.00,-177.60,9.60 +-158.40,0.00,0.90,0.00,1.00,-177.60,-14.40 +-153.60,0.00,0.92,0.00,1.00,-177.60,19.20 +-148.80,0.00,0.94,0.00,1.00,-177.60,-19.20 +-144.00,0.00,0.96,0.00,1.00,-177.60,24.00 +-139.20,0.00,0.98,0.00,1.00,-177.60,-28.80 +-134.40,0.00,1.00,0.00,1.00,-177.60,28.80 +-129.60,0.00,1.03,0.00,1.00,-177.60,-33.60 +-124.80,0.00,1.05,0.00,1.00,-177.60,33.60 +-120.00,0.00,1.07,0.00,1.00,-177.60,-38.40 +-115.20,0.00,1.09,0.00,1.00,-177.60,38.40 +-110.40,0.00,1.11,0.00,1.00,-177.60,-43.20 +-105.60,0.00,1.13,0.00,1.00,-172.80,43.20 +-100.80,0.00,1.15,0.00,1.00,-168.00,-43.20 +-96.00,0.00,1.17,0.00,1.00,-134.40,43.20 +-91.20,0.00,1.20,0.00,1.00,-19.20,-43.20 +-86.40,0.00,1.22,0.00,1.00,-9.60,43.20 +-81.60,0.00,1.24,0.00,1.00,-4.80,-43.20 +-76.80,0.00,1.26,0.00,1.00,-4.80,43.20 +-72.00,0.00,1.28,0.00,1.00,-4.80,-43.20 +-67.20,0.00,1.30,0.00,1.00,-0.00,38.40 +-62.40,0.00,1.32,0.00,1.00,-0.00,-38.40 +-57.60,0.00,1.35,0.00,1.00,-0.00,38.40 +-52.80,0.00,1.37,0.00,1.00,-0.00,-33.60 +-48.00,0.00,1.39,0.00,1.00,-0.00,33.60 +-43.20,0.00,1.41,0.00,1.00,-0.00,-28.80 +-38.40,0.00,1.43,0.00,1.00,-0.00,24.00 +-33.60,0.00,1.45,0.00,1.00,-0.00,-24.00 +-28.80,0.00,1.47,0.00,1.00,-0.00,19.20 +-24.00,0.00,1.50,0.00,1.00,-0.00,-14.40 +-19.20,0.00,1.52,0.00,1.00,-0.00,14.40 +-14.40,0.00,1.54,0.00,1.00,-0.00,-9.60 +-9.60,0.00,1.56,0.00,1.00,-0.00,4.80 +-4.80,0.00,1.58,0.00,1.00,-0.00,-4.80 +0.00,0.00,1.60,0.00,1.00,-0.00,0.00 +4.80,-0.00,1.62,0.00,1.00,-0.00,-4.80 +9.60,-0.00,1.64,0.00,1.00,-0.00,4.80 +14.40,-0.00,1.67,0.00,1.00,-0.00,-9.60 +19.20,-0.00,1.69,0.00,1.00,-0.00,14.40 +24.00,-0.00,1.71,0.00,1.00,-0.00,-14.40 +28.80,-0.00,1.73,0.00,1.00,-0.00,19.20 +33.60,-4.80,1.75,0.00,1.00,-4.80,-19.20 +38.40,-4.80,1.77,0.00,1.00,-4.80,24.00 +43.20,-4.80,1.79,0.00,1.00,-4.80,-24.00 +48.00,-4.80,1.82,0.00,1.00,-4.80,28.80 +52.80,-4.80,1.84,0.00,1.00,-4.80,-28.80 +57.60,-4.80,1.86,0.00,1.00,-4.80,33.60 +62.40,-4.80,1.88,0.00,1.00,-9.60,-33.60 +67.20,-4.80,1.90,0.00,1.00,-9.60,38.40 +72.00,-4.80,1.92,0.00,1.00,-14.40,-38.40 +76.80,-4.80,1.94,0.00,1.00,-24.00,38.40 +81.60,-4.80,1.97,0.00,1.00,-43.20,-38.40 +86.40,-4.80,1.99,0.00,1.00,-110.40,38.40 +91.20,-4.80,2.01,0.00,1.00,-148.80,-38.40 +96.00,-4.80,2.03,0.00,1.00,-163.20,38.40 +100.80,-4.80,2.05,0.00,1.00,-168.00,-38.40 +105.60,-4.80,2.07,0.00,1.00,-172.80,38.40 +110.40,-4.80,2.09,0.00,1.00,-172.80,-38.40 +115.20,-4.80,2.11,0.00,1.00,-172.80,33.60 +120.00,-4.80,2.14,0.00,1.00,-172.80,-33.60 +124.80,-4.80,2.16,0.00,1.00,-177.60,33.60 +129.60,-4.80,2.18,0.00,1.00,-177.60,-28.80 +134.40,-4.80,2.20,0.00,1.00,-177.60,28.80 +139.20,-4.80,2.22,0.00,1.00,-177.60,-24.00 +144.00,-4.80,2.24,0.00,1.00,-177.60,24.00 +148.80,-4.80,2.26,0.00,1.00,-177.60,-19.20 +153.60,-0.00,2.29,0.00,1.00,-177.60,14.40 +158.40,-0.00,2.31,0.00,1.00,-177.60,-14.40 +163.20,-0.00,2.33,0.00,1.00,-177.60,9.60 +168.00,-0.00,2.35,0.00,1.00,-177.60,-9.60 +172.80,-0.00,2.37,0.00,1.00,-177.60,4.80 +177.60,-0.00,2.39,0.00,1.00,177.60,-0.00 +-177.60,0.00,2.41,0.00,1.00,177.60,-0.00 +-172.80,0.00,2.44,0.00,1.00,177.60,4.80 +-168.00,0.00,2.46,0.00,1.00,177.60,-9.60 +-163.20,0.00,2.48,0.00,1.00,177.60,9.60 +-158.40,0.00,2.50,0.00,1.00,177.60,-14.40 +-153.60,0.00,2.52,0.00,1.00,177.60,14.40 +-148.80,4.80,2.54,0.00,1.00,177.60,-19.20 +-144.00,4.80,2.56,0.00,1.00,177.60,24.00 +-139.20,4.80,2.58,0.00,1.00,177.60,-24.00 +-134.40,4.80,2.61,0.00,1.00,177.60,28.80 +-129.60,4.80,2.63,0.00,1.00,172.80,-28.80 +-124.80,4.80,2.65,0.00,1.00,172.80,33.60 +-120.00,4.80,2.67,0.00,1.00,172.80,-33.60 +-115.20,4.80,2.69,0.00,1.00,172.80,33.60 +-110.40,4.80,2.71,0.00,1.00,168.00,-38.40 +-105.60,4.80,2.73,0.00,1.00,163.20,38.40 +-100.80,4.80,2.76,0.00,1.00,148.80,-38.40 +-96.00,4.80,2.78,0.00,1.00,110.40,38.40 +-91.20,4.80,2.80,0.00,1.00,43.20,-38.40 +-86.40,4.80,2.82,0.00,1.00,24.00,38.40 +-81.60,4.80,2.84,0.00,1.00,14.40,-38.40 +-76.80,4.80,2.86,0.00,1.00,9.60,38.40 +-72.00,4.80,2.88,0.00,1.00,9.60,-38.40 +-67.20,4.80,2.91,0.00,1.00,4.80,38.40 +-62.40,4.80,2.93,0.00,1.00,4.80,-33.60 +-57.60,4.80,2.95,0.00,1.00,4.80,33.60 +-52.80,4.80,2.97,0.00,1.00,4.80,-28.80 +-48.00,4.80,2.99,0.00,1.00,4.80,28.80 +-43.20,4.80,3.01,0.00,1.00,4.80,-24.00 +-38.40,4.80,3.03,0.00,1.00,0.00,24.00 +-33.60,4.80,3.05,0.00,1.00,0.00,-19.20 +-28.80,0.00,3.08,0.00,1.00,0.00,19.20 +-24.00,0.00,3.10,0.00,1.00,0.00,-14.40 +-19.20,0.00,3.12,0.00,1.00,0.00,14.40 +-14.40,0.00,3.14,0.00,1.00,0.00,-9.60 +-9.60,0.00,3.16,0.00,1.00,0.00,4.80 +-4.80,0.00,3.18,0.00,1.00,0.00,-4.80 +0.00,0.00,3.20,0.00,1.00,-0.00,0.00 +4.80,-0.00,3.23,0.00,1.00,-0.00,-4.80 +9.60,-0.00,3.25,0.00,1.00,-0.00,4.80 +14.40,-0.00,3.27,0.00,1.00,-4.80,-9.60 +19.20,-4.80,3.29,0.00,1.00,-4.80,9.60 +24.00,-4.80,3.31,0.00,1.00,-4.80,-14.40 +28.80,-4.80,3.33,0.00,1.00,-4.80,14.40 +33.60,-4.80,3.35,0.00,1.00,-4.80,-19.20 +38.40,-4.80,3.38,0.00,1.00,-9.60,19.20 +43.20,-4.80,3.40,0.00,1.00,-9.60,-24.00 +48.00,-4.80,3.42,0.00,1.00,-9.60,24.00 +52.80,-9.60,3.44,0.00,1.00,-14.40,-28.80 +57.60,-9.60,3.46,0.00,1.00,-14.40,28.80 +62.40,-9.60,3.48,0.00,1.00,-19.20,-28.80 +67.20,-9.60,3.50,0.00,1.00,-24.00,33.60 +72.00,-9.60,3.52,0.00,1.00,-33.60,-33.60 +76.80,-9.60,3.55,0.00,1.00,-43.20,33.60 +81.60,-9.60,3.57,0.00,1.00,-67.20,-33.60 +86.40,-9.60,3.59,0.00,1.00,-96.00,33.60 +91.20,-9.60,3.61,0.00,1.00,-124.80,-33.60 +96.00,-9.60,3.63,0.00,1.00,-144.00,33.60 +100.80,-9.60,3.65,0.00,1.00,-153.60,-33.60 +105.60,-9.60,3.67,0.00,1.00,-158.40,33.60 +110.40,-9.60,3.70,0.00,1.00,-163.20,-33.60 +115.20,-9.60,3.72,0.00,1.00,-168.00,33.60 +120.00,-9.60,3.74,0.00,1.00,-168.00,-28.80 +124.80,-9.60,3.76,0.00,1.00,-168.00,28.80 +129.60,-9.60,3.78,0.00,1.00,-172.80,-28.80 +134.40,-4.80,3.80,0.00,1.00,-172.80,24.00 +139.20,-4.80,3.82,0.00,1.00,-172.80,-24.00 +144.00,-4.80,3.85,0.00,1.00,-172.80,19.20 +148.80,-4.80,3.87,0.00,1.00,-177.60,-19.20 +153.60,-4.80,3.89,0.00,1.00,-177.60,14.40 +158.40,-4.80,3.91,0.00,1.00,-177.60,-14.40 +163.20,-4.80,3.93,0.00,1.00,-177.60,9.60 +168.00,-0.00,3.95,0.00,1.00,-177.60,-4.80 +172.80,-0.00,3.97,0.00,1.00,-177.60,4.80 +177.60,-0.00,3.99,0.00,1.00,177.60,-0.00 +-177.60,0.00,4.02,0.00,1.00,177.60,-0.00 +-172.80,0.00,4.04,0.00,1.00,177.60,4.80 +-168.00,0.00,4.06,0.00,1.00,177.60,-4.80 +-163.20,4.80,4.08,0.00,1.00,177.60,9.60 +-158.40,4.80,4.10,0.00,1.00,177.60,-14.40 +-153.60,4.80,4.12,0.00,1.00,172.80,14.40 +-148.80,4.80,4.14,0.00,1.00,172.80,-19.20 +-144.00,4.80,4.17,0.00,1.00,172.80,19.20 +-139.20,4.80,4.19,0.00,1.00,172.80,-24.00 +-134.40,4.80,4.21,0.00,1.00,168.00,24.00 +-129.60,9.60,4.23,0.00,1.00,168.00,-28.80 +-124.80,9.60,4.25,0.00,1.00,168.00,28.80 +-120.00,9.60,4.27,0.00,1.00,163.20,-28.80 +-115.20,9.60,4.29,0.00,1.00,158.40,33.60 +-110.40,9.60,4.32,0.00,1.00,153.60,-33.60 +-105.60,9.60,4.34,0.00,1.00,144.00,33.60 +-100.80,9.60,4.36,0.00,1.00,124.80,-33.60 +-96.00,9.60,4.38,0.00,1.00,96.00,33.60 +-91.20,9.60,4.40,0.00,1.00,67.20,-33.60 +-86.40,9.60,4.42,0.00,1.00,43.20,33.60 +-81.60,9.60,4.44,0.00,1.00,33.60,-33.60 +-76.80,9.60,4.46,0.00,1.00,24.00,33.60 +-72.00,9.60,4.49,0.00,1.00,19.20,-33.60 +-67.20,9.60,4.51,0.00,1.00,14.40,33.60 +-62.40,9.60,4.53,0.00,1.00,14.40,-28.80 +-57.60,9.60,4.55,0.00,1.00,9.60,28.80 +-52.80,9.60,4.57,0.00,1.00,9.60,-28.80 +-48.00,4.80,4.59,0.00,1.00,9.60,24.00 +-43.20,4.80,4.61,0.00,1.00,4.80,-24.00 +-38.40,4.80,4.64,0.00,1.00,4.80,19.20 +-33.60,4.80,4.66,0.00,1.00,4.80,-19.20 +-28.80,4.80,4.68,0.00,1.00,4.80,14.40 +-24.00,4.80,4.70,0.00,1.00,4.80,-14.40 +-19.20,4.80,4.72,0.00,1.00,0.00,9.60 +-14.40,0.00,4.74,0.00,1.00,0.00,-9.60 +-9.60,0.00,4.76,0.00,1.00,0.00,4.80 +-4.80,0.00,4.79,0.00,1.00,0.00,-4.80 +0.00,0.00,4.81,0.00,1.00,-0.00,0.00 +4.80,-0.00,4.83,0.00,1.00,-0.00,-4.80 +9.60,-0.00,4.85,0.00,1.00,-4.80,4.80 +14.40,-4.80,4.87,0.00,1.00,-4.80,-9.60 +19.20,-4.80,4.89,0.00,1.00,-4.80,9.60 +24.00,-4.80,4.91,0.00,1.00,-4.80,-9.60 +28.80,-4.80,4.93,0.00,1.00,-9.60,14.40 +33.60,-9.60,4.96,0.00,1.00,-9.60,-14.40 +38.40,-9.60,4.98,0.00,1.00,-14.40,19.20 +43.20,-9.60,5.00,0.00,1.00,-14.40,-19.20 +48.00,-9.60,5.02,0.00,1.00,-14.40,24.00 +52.80,-9.60,5.04,0.00,1.00,-19.20,-24.00 +57.60,-14.40,5.06,0.00,1.00,-24.00,24.00 +62.40,-14.40,5.08,0.00,1.00,-28.80,-28.80 +67.20,-14.40,5.11,0.00,1.00,-33.60,28.80 +72.00,-14.40,5.13,0.00,1.00,-43.20,-28.80 +76.80,-14.40,5.15,0.00,1.00,-57.60,28.80 +81.60,-14.40,5.17,0.00,1.00,-76.80,-28.80 +86.40,-14.40,5.19,0.00,1.00,-96.00,28.80 +91.20,-14.40,5.21,0.00,1.00,-115.20,-28.80 +96.00,-14.40,5.23,0.00,1.00,-129.60,28.80 +100.80,-14.40,5.26,0.00,1.00,-139.20,-28.80 +105.60,-14.40,5.28,0.00,1.00,-148.80,28.80 +110.40,-14.40,5.30,0.00,1.00,-153.60,-28.80 +115.20,-14.40,5.32,0.00,1.00,-158.40,28.80 +120.00,-14.40,5.34,0.00,1.00,-163.20,-24.00 +124.80,-9.60,5.36,0.00,1.00,-163.20,24.00 +129.60,-9.60,5.38,0.00,1.00,-168.00,-24.00 +134.40,-9.60,5.40,0.00,1.00,-168.00,19.20 +139.20,-9.60,5.43,0.00,1.00,-172.80,-19.20 +144.00,-9.60,5.45,0.00,1.00,-172.80,19.20 +148.80,-9.60,5.47,0.00,1.00,-172.80,-14.40 +153.60,-4.80,5.49,0.00,1.00,-172.80,14.40 +158.40,-4.80,5.51,0.00,1.00,-177.60,-9.60 +163.20,-4.80,5.53,0.00,1.00,-177.60,9.60 +168.00,-4.80,5.55,0.00,1.00,-177.60,-4.80 +172.80,-0.00,5.58,0.00,1.00,-177.60,4.80 +177.60,-0.00,5.60,0.00,1.00,177.60,-0.00 +-177.60,0.00,5.62,0.00,1.00,177.60,-0.00 +-172.80,0.00,5.64,0.00,1.00,177.60,4.80 +-168.00,4.80,5.66,0.00,1.00,177.60,-4.80 +-163.20,4.80,5.68,0.00,1.00,172.80,9.60 +-158.40,4.80,5.70,0.00,1.00,172.80,-9.60 +-153.60,4.80,5.72,0.00,1.00,172.80,14.40 +-148.80,9.60,5.75,0.00,1.00,172.80,-14.40 +-144.00,9.60,5.77,0.00,1.00,168.00,19.20 +-139.20,9.60,5.79,0.00,1.00,168.00,-19.20 +-134.40,9.60,5.81,0.00,1.00,163.20,19.20 +-129.60,9.60,5.83,0.00,1.00,163.20,-24.00 +-124.80,9.60,5.85,0.00,1.00,158.40,24.00 +-120.00,14.40,5.87,0.00,1.00,153.60,-24.00 +-115.20,14.40,5.90,0.00,1.00,148.80,28.80 +-110.40,14.40,5.92,0.00,1.00,139.20,-28.80 +-105.60,14.40,5.94,0.00,1.00,129.60,28.80 +-100.80,14.40,5.96,0.00,1.00,115.20,-28.80 +-96.00,14.40,5.98,0.00,1.00,96.00,28.80 +-91.20,14.40,6.00,0.00,1.00,76.80,-28.80 +-86.40,14.40,6.02,0.00,1.00,57.60,28.80 +-81.60,14.40,6.05,0.00,1.00,43.20,-28.80 +-76.80,14.40,6.07,0.00,1.00,33.60,28.80 +-72.00,14.40,6.09,0.00,1.00,28.80,-28.80 +-67.20,14.40,6.11,0.00,1.00,24.00,28.80 +-62.40,14.40,6.13,0.00,1.00,19.20,-28.80 +-57.60,14.40,6.15,0.00,1.00,14.40,24.00 +-52.80,9.60,6.17,0.00,1.00,14.40,-24.00 +-48.00,9.60,6.19,0.00,1.00,14.40,24.00 +-43.20,9.60,6.22,0.00,1.00,9.60,-19.20 +-38.40,9.60,6.24,0.00,1.00,9.60,19.20 +-33.60,9.60,6.26,0.00,1.00,4.80,-14.40 +-28.80,4.80,6.28,0.00,1.00,4.80,14.40 +-24.00,4.80,6.30,0.00,1.00,4.80,-9.60 +-19.20,4.80,6.32,0.00,1.00,4.80,9.60 +-14.40,4.80,6.34,0.00,1.00,0.00,-9.60 +-9.60,0.00,6.37,0.00,1.00,0.00,4.80 +-4.80,0.00,6.39,0.00,1.00,0.00,-4.80 +0.00,0.00,6.41,0.00,1.00,-0.00,0.00 +4.80,-0.00,6.43,0.00,1.00,-4.80,-0.00 +9.60,-4.80,6.45,0.00,1.00,-4.80,4.80 +14.40,-4.80,6.47,0.00,1.00,-4.80,-4.80 +19.20,-4.80,6.49,0.00,1.00,-9.60,9.60 +24.00,-9.60,6.52,0.00,1.00,-9.60,-9.60 +28.80,-9.60,6.54,0.00,1.00,-9.60,14.40 +33.60,-9.60,6.56,0.00,1.00,-14.40,-14.40 +38.40,-9.60,6.58,0.00,1.00,-14.40,14.40 +43.20,-14.40,6.60,0.00,1.00,-19.20,-19.20 +48.00,-14.40,6.62,0.00,1.00,-24.00,19.20 +52.80,-14.40,6.64,0.00,1.00,-24.00,-19.20 +57.60,-14.40,6.66,0.00,1.00,-28.80,19.20 +62.40,-19.20,6.69,0.00,1.00,-38.40,-24.00 +67.20,-19.20,6.71,0.00,1.00,-43.20,24.00 +72.00,-19.20,6.73,0.00,1.00,-52.80,-24.00 +76.80,-19.20,6.75,0.00,1.00,-62.40,24.00 +81.60,-19.20,6.77,0.00,1.00,-76.80,-24.00 +86.40,-19.20,6.79,0.00,1.00,-96.00,24.00 +91.20,-19.20,6.81,0.00,1.00,-110.40,-24.00 +96.00,-19.20,6.84,0.00,1.00,-120.00,24.00 +100.80,-19.20,6.86,0.00,1.00,-134.40,-24.00 +105.60,-19.20,6.88,0.00,1.00,-139.20,24.00 +110.40,-19.20,6.90,0.00,1.00,-148.80,-24.00 +115.20,-19.20,6.92,0.00,1.00,-153.60,24.00 +120.00,-14.40,6.94,0.00,1.00,-158.40,-24.00 +124.80,-14.40,6.96,0.00,1.00,-158.40,19.20 +129.60,-14.40,6.99,0.00,1.00,-163.20,-19.20 +134.40,-14.40,7.01,0.00,1.00,-163.20,19.20 +139.20,-14.40,7.03,0.00,1.00,-168.00,-14.40 +144.00,-9.60,7.05,0.00,1.00,-168.00,14.40 +148.80,-9.60,7.07,0.00,1.00,-172.80,-14.40 +153.60,-9.60,7.09,0.00,1.00,-172.80,9.60 +158.40,-4.80,7.11,0.00,1.00,-172.80,-9.60 +163.20,-4.80,7.13,0.00,1.00,-177.60,9.60 +168.00,-4.80,7.16,0.00,1.00,-177.60,-4.80 +172.80,-0.00,7.18,0.00,1.00,-177.60,4.80 +177.60,-0.00,7.20,0.00,1.00,177.60,-0.00 +-177.60,0.00,7.22,0.00,1.00,177.60,-0.00 +-172.80,0.00,7.24,0.00,1.00,177.60,4.80 +-168.00,4.80,7.26,0.00,1.00,172.80,-4.80 +-163.20,4.80,7.28,0.00,1.00,172.80,9.60 +-158.40,4.80,7.31,0.00,1.00,172.80,-9.60 +-153.60,9.60,7.33,0.00,1.00,168.00,9.60 +-148.80,9.60,7.35,0.00,1.00,168.00,-14.40 +-144.00,9.60,7.37,0.00,1.00,163.20,14.40 +-139.20,14.40,7.39,0.00,1.00,163.20,-14.40 +-134.40,14.40,7.41,0.00,1.00,158.40,19.20 +-129.60,14.40,7.43,0.00,1.00,158.40,-19.20 +-124.80,14.40,7.46,0.00,1.00,153.60,19.20 +-120.00,14.40,7.48,0.00,1.00,148.80,-24.00 +-115.20,19.20,7.50,0.00,1.00,139.20,24.00 +-110.40,19.20,7.52,0.00,1.00,134.40,-24.00 +-105.60,19.20,7.54,0.00,1.00,120.00,24.00 +-100.80,19.20,7.56,0.00,1.00,110.40,-24.00 +-96.00,19.20,7.58,0.00,1.00,96.00,24.00 +-91.20,19.20,7.60,0.00,1.00,76.80,-24.00 +-86.40,19.20,7.63,0.00,1.00,62.40,24.00 +-81.60,19.20,7.65,0.00,1.00,52.80,-24.00 +-76.80,19.20,7.67,0.00,1.00,43.20,24.00 +-72.00,19.20,7.69,0.00,1.00,38.40,-24.00 +-67.20,19.20,7.71,0.00,1.00,28.80,24.00 +-62.40,19.20,7.73,0.00,1.00,24.00,-24.00 +-57.60,14.40,7.75,0.00,1.00,24.00,19.20 +-52.80,14.40,7.78,0.00,1.00,19.20,-19.20 +-48.00,14.40,7.80,0.00,1.00,14.40,19.20 +-43.20,14.40,7.82,0.00,1.00,14.40,-19.20 +-38.40,9.60,7.84,0.00,1.00,9.60,14.40 +-33.60,9.60,7.86,0.00,1.00,9.60,-14.40 +-28.80,9.60,7.88,0.00,1.00,9.60,14.40 +-24.00,9.60,7.90,0.00,1.00,4.80,-9.60 +-19.20,4.80,7.93,0.00,1.00,4.80,9.60 +-14.40,4.80,7.95,0.00,1.00,4.80,-4.80 +-9.60,4.80,7.97,0.00,1.00,0.00,4.80 +-4.80,0.00,7.99,0.00,1.00,0.00,-0.00 +0.00,0.00,8.01,0.00,1.00,-0.00,0.00 +4.80,-0.00,8.03,0.00,1.00,-4.80,-0.00 +9.60,-4.80,8.05,0.00,1.00,-4.80,4.80 +14.40,-4.80,8.07,0.00,1.00,-9.60,-4.80 +19.20,-9.60,8.10,0.00,1.00,-9.60,4.80 +24.00,-9.60,8.12,0.00,1.00,-14.40,-9.60 +28.80,-9.60,8.14,0.00,1.00,-14.40,9.60 +33.60,-14.40,8.16,0.00,1.00,-19.20,-9.60 +33.60,-14.40,8.18,0.00,1.00,-19.20,14.40 +38.40,-14.40,8.20,0.00,1.00,-24.00,-14.40 +43.20,-19.20,8.22,0.00,1.00,-28.80,14.40 +48.00,-19.20,8.25,0.00,1.00,-33.60,-14.40 +57.60,-19.20,8.27,0.00,1.00,-38.40,19.20 +62.40,-19.20,8.29,0.00,1.00,-43.20,-19.20 +67.20,-24.00,8.31,0.00,1.00,-48.00,19.20 +72.00,-24.00,8.33,0.00,1.00,-57.60,-19.20 +76.80,-24.00,8.35,0.00,1.00,-67.20,19.20 +81.60,-24.00,8.37,0.00,1.00,-81.60,-19.20 +86.40,-24.00,8.40,0.00,1.00,-91.20,19.20 +91.20,-24.00,8.42,0.00,1.00,-105.60,-19.20 +96.00,-24.00,8.44,0.00,1.00,-115.20,19.20 +100.80,-24.00,8.46,0.00,1.00,-124.80,-19.20 +105.60,-24.00,8.48,0.00,1.00,-134.40,19.20 +110.40,-24.00,8.50,0.00,1.00,-139.20,-19.20 +115.20,-19.20,8.52,0.00,1.00,-144.00,19.20 +120.00,-19.20,8.54,0.00,1.00,-148.80,-19.20 +129.60,-19.20,8.57,0.00,1.00,-153.60,19.20 +134.40,-19.20,8.59,0.00,1.00,-158.40,-14.40 +139.20,-19.20,8.61,0.00,1.00,-163.20,14.40 +144.00,-14.40,8.63,0.00,1.00,-163.20,-14.40 +148.80,-14.40,8.65,0.00,1.00,-168.00,14.40 +148.80,-14.40,8.67,0.00,1.00,-168.00,-9.60 +153.60,-9.60,8.69,0.00,1.00,-172.80,9.60 +158.40,-9.60,8.72,0.00,1.00,-172.80,-9.60 +163.20,-4.80,8.74,0.00,1.00,-177.60,4.80 +168.00,-4.80,8.76,0.00,1.00,-177.60,-4.80 +172.80,-4.80,8.78,0.00,1.00,-177.60,4.80 +177.60,-0.00,8.80,0.00,1.00,177.60,-0.00 +-177.60,0.00,8.82,0.00,1.00,177.60,-0.00 +-172.80,4.80,8.84,0.00,1.00,177.60,4.80 +-168.00,4.80,8.87,0.00,1.00,172.80,-4.80 +-163.20,4.80,8.89,0.00,1.00,172.80,4.80 +-158.40,9.60,8.91,0.00,1.00,168.00,-9.60 +-153.60,9.60,8.93,0.00,1.00,168.00,9.60 +-148.80,14.40,8.95,0.00,1.00,163.20,-9.60 +-148.80,14.40,8.97,0.00,1.00,163.20,14.40 +-144.00,14.40,8.99,0.00,1.00,158.40,-14.40 +-139.20,19.20,9.01,0.00,1.00,153.60,14.40 +-134.40,19.20,9.04,0.00,1.00,148.80,-14.40 +-129.60,19.20,9.06,0.00,1.00,144.00,19.20 +-120.00,19.20,9.08,0.00,1.00,139.20,-19.20 +-115.20,19.20,9.10,0.00,1.00,134.40,19.20 +-110.40,24.00,9.12,0.00,1.00,124.80,-19.20 +-105.60,24.00,9.14,0.00,1.00,115.20,19.20 +-100.80,24.00,9.16,0.00,1.00,105.60,-19.20 +-96.00,24.00,9.19,0.00,1.00,91.20,19.20 +-91.20,24.00,9.21,0.00,1.00,81.60,-19.20 +-86.40,24.00,9.23,0.00,1.00,67.20,19.20 +-81.60,24.00,9.25,0.00,1.00,57.60,-19.20 +-76.80,24.00,9.27,0.00,1.00,48.00,19.20 +-72.00,24.00,9.29,0.00,1.00,43.20,-19.20 +-67.20,24.00,9.31,0.00,1.00,38.40,19.20 +-62.40,19.20,9.34,0.00,1.00,33.60,-19.20 +-57.60,19.20,9.36,0.00,1.00,28.80,19.20 +-48.00,19.20,9.38,0.00,1.00,24.00,-14.40 +-43.20,19.20,9.40,0.00,1.00,19.20,14.40 +-38.40,14.40,9.42,0.00,1.00,19.20,-14.40 +-33.60,14.40,9.44,0.00,1.00,14.40,14.40 +-33.60,14.40,9.46,0.00,1.00,14.40,-9.60 +-28.80,9.60,9.48,0.00,1.00,9.60,9.60 +-24.00,9.60,9.51,0.00,1.00,9.60,-9.60 +-19.20,9.60,9.53,0.00,1.00,4.80,4.80 +-14.40,4.80,9.55,0.00,1.00,4.80,-4.80 +-9.60,4.80,9.57,0.00,1.00,0.00,4.80 +-4.80,0.00,9.59,0.00,1.00,0.00,-0.00 +0.00,0.00,9.61,0.00,1.00,-0.00,0.00 +4.80,-0.00,9.63,0.00,1.00,-4.80,-0.00 +9.60,-4.80,9.66,0.00,1.00,-4.80,4.80 +14.40,-4.80,9.68,0.00,1.00,-9.60,-4.80 +19.20,-9.60,9.70,0.00,1.00,-9.60,4.80 +19.20,-9.60,9.72,0.00,1.00,-14.40,-4.80 +24.00,-14.40,9.74,0.00,1.00,-19.20,9.60 +28.80,-14.40,9.76,0.00,1.00,-19.20,-9.60 +33.60,-19.20,9.78,0.00,1.00,-24.00,9.60 +38.40,-19.20,9.81,0.00,1.00,-28.80,-9.60 +43.20,-19.20,9.83,0.00,1.00,-33.60,9.60 +48.00,-24.00,9.85,0.00,1.00,-38.40,-14.40 +52.80,-24.00,9.87,0.00,1.00,-43.20,14.40 +57.60,-24.00,9.89,0.00,1.00,-48.00,-14.40 +62.40,-24.00,9.91,0.00,1.00,-52.80,14.40 +72.00,-28.80,9.93,0.00,1.00,-62.40,-14.40 +76.80,-28.80,9.95,0.00,1.00,-72.00,14.40 +81.60,-28.80,9.98,0.00,1.00,-81.60,-14.40 +86.40,-28.80,10.00,0.00,1.00,-91.20,14.40 +91.20,-28.80,10.02,0.00,1.00,-100.80,-14.40 +96.00,-28.80,10.04,0.00,1.00,-110.40,14.40 +100.80,-28.80,10.06,0.00,1.00,-120.00,-14.40 +105.60,-28.80,10.08,0.00,1.00,-129.60,14.40 +115.20,-28.80,10.10,0.00,1.00,-134.40,-14.40 +120.00,-24.00,10.13,0.00,1.00,-139.20,14.40 +124.80,-24.00,10.15,0.00,1.00,-144.00,-14.40 +129.60,-24.00,10.17,0.00,1.00,-148.80,14.40 +134.40,-24.00,10.19,0.00,1.00,-153.60,-14.40 +139.20,-19.20,10.21,0.00,1.00,-158.40,9.60 +144.00,-19.20,10.23,0.00,1.00,-163.20,-9.60 +148.80,-14.40,10.25,0.00,1.00,-163.20,9.60 +153.60,-14.40,10.28,0.00,1.00,-168.00,-9.60 +158.40,-14.40,10.30,0.00,1.00,-168.00,4.80 +163.20,-9.60,10.32,0.00,1.00,-172.80,-4.80 +163.20,-9.60,10.34,0.00,1.00,-172.80,4.80 +168.00,-4.80,10.36,0.00,1.00,-177.60,-4.80 +172.80,-4.80,10.38,0.00,1.00,-177.60,0.00 +177.60,-0.00,10.40,0.00,1.00,177.60,-0.00 +-177.60,0.00,10.42,0.00,1.00,177.60,-0.00 +-172.80,4.80,10.45,0.00,1.00,172.80,0.00 +-168.00,4.80,10.47,0.00,1.00,172.80,-4.80 +-163.20,9.60,10.49,0.00,1.00,168.00,4.80 +-163.20,9.60,10.51,0.00,1.00,168.00,-4.80 +-158.40,14.40,10.53,0.00,1.00,163.20,4.80 +-153.60,14.40,10.55,0.00,1.00,163.20,-9.60 +-148.80,14.40,10.57,0.00,1.00,158.40,9.60 +-144.00,19.20,10.60,0.00,1.00,153.60,-9.60 +-139.20,19.20,10.62,0.00,1.00,148.80,9.60 +-134.40,24.00,10.64,0.00,1.00,144.00,-14.40 +-129.60,24.00,10.66,0.00,1.00,139.20,14.40 +-124.80,24.00,10.68,0.00,1.00,134.40,-14.40 +-120.00,24.00,10.70,0.00,1.00,129.60,14.40 +-115.20,28.80,10.72,0.00,1.00,120.00,-14.40 +-105.60,28.80,10.74,0.00,1.00,110.40,14.40 +-100.80,28.80,10.77,0.00,1.00,100.80,-14.40 +-96.00,28.80,10.79,0.00,1.00,91.20,14.40 +-91.20,28.80,10.81,0.00,1.00,81.60,-14.40 +-86.40,28.80,10.83,0.00,1.00,72.00,14.40 +-81.60,28.80,10.85,0.00,1.00,62.40,-14.40 +-76.80,28.80,10.87,0.00,1.00,52.80,14.40 +-72.00,28.80,10.89,0.00,1.00,48.00,-14.40 +-62.40,24.00,10.92,0.00,1.00,43.20,14.40 +-57.60,24.00,10.94,0.00,1.00,38.40,-14.40 +-52.80,24.00,10.96,0.00,1.00,33.60,14.40 +-48.00,24.00,10.98,0.00,1.00,28.80,-14.40 +-43.20,19.20,11.00,0.00,1.00,24.00,9.60 +-38.40,19.20,11.02,0.00,1.00,19.20,-9.60 +-33.60,19.20,11.04,0.00,1.00,19.20,9.60 +-28.80,14.40,11.07,0.00,1.00,14.40,-9.60 +-24.00,14.40,11.09,0.00,1.00,9.60,9.60 +-19.20,9.60,11.11,0.00,1.00,9.60,-4.80 +-19.20,9.60,11.13,0.00,1.00,4.80,4.80 +-14.40,4.80,11.15,0.00,1.00,4.80,-4.80 +-9.60,4.80,11.17,0.00,1.00,0.00,4.80 +-4.80,0.00,11.19,0.00,1.00,0.00,-0.00 +0.00,0.00,11.21,0.00,1.00,-4.80,0.00 +4.80,-4.80,11.24,0.00,1.00,-4.80,-0.00 +9.60,-4.80,11.26,0.00,1.00,-9.60,0.00 +14.40,-9.60,11.28,0.00,1.00,-9.60,-4.80 +14.40,-9.60,11.30,0.00,1.00,-14.40,4.80 +19.20,-14.40,11.32,0.00,1.00,-14.40,-4.80 +24.00,-14.40,11.34,0.00,1.00,-19.20,4.80 +28.80,-19.20,11.36,0.00,1.00,-24.00,-4.80 +33.60,-19.20,11.39,0.00,1.00,-28.80,4.80 +38.40,-24.00,11.41,0.00,1.00,-28.80,-9.60 +43.20,-24.00,11.43,0.00,1.00,-33.60,9.60 +48.00,-24.00,11.45,0.00,1.00,-38.40,-9.60 +52.80,-28.80,11.47,0.00,1.00,-48.00,9.60 +57.60,-28.80,11.49,0.00,1.00,-52.80,-9.60 +62.40,-28.80,11.51,0.00,1.00,-57.60,9.60 +67.20,-33.60,11.54,0.00,1.00,-67.20,-9.60 +72.00,-33.60,11.56,0.00,1.00,-76.80,9.60 +81.60,-33.60,11.58,0.00,1.00,-81.60,-9.60 +86.40,-33.60,11.60,0.00,1.00,-91.20,9.60 +91.20,-33.60,11.62,0.00,1.00,-100.80,-9.60 +96.00,-33.60,11.64,0.00,1.00,-110.40,9.60 +100.80,-33.60,11.66,0.00,1.00,-115.20,-9.60 +110.40,-33.60,11.68,0.00,1.00,-124.80,9.60 +115.20,-33.60,11.71,0.00,1.00,-129.60,-9.60 +120.00,-28.80,11.73,0.00,1.00,-139.20,9.60 +124.80,-28.80,11.75,0.00,1.00,-144.00,-9.60 +129.60,-28.80,11.77,0.00,1.00,-148.80,9.60 +134.40,-24.00,11.79,0.00,1.00,-153.60,-9.60 +139.20,-24.00,11.81,0.00,1.00,-153.60,9.60 +144.00,-19.20,11.83,0.00,1.00,-158.40,-9.60 +148.80,-19.20,11.86,0.00,1.00,-163.20,4.80 +153.60,-14.40,11.88,0.00,1.00,-163.20,-4.80 +158.40,-14.40,11.90,0.00,1.00,-168.00,4.80 +163.20,-9.60,11.92,0.00,1.00,-172.80,-4.80 +168.00,-9.60,11.94,0.00,1.00,-172.80,4.80 +168.00,-4.80,11.96,0.00,1.00,-177.60,-0.00 +172.80,-4.80,11.98,0.00,1.00,-177.60,0.00 +177.60,-0.00,12.01,0.00,1.00,177.60,-0.00 +-177.60,0.00,12.03,0.00,1.00,177.60,-0.00 +-172.80,4.80,12.05,0.00,1.00,172.80,0.00 +-168.00,4.80,12.07,0.00,1.00,172.80,-0.00 +-168.00,9.60,12.09,0.00,1.00,168.00,4.80 +-163.20,9.60,12.11,0.00,1.00,163.20,-4.80 +-158.40,14.40,12.13,0.00,1.00,163.20,4.80 +-153.60,14.40,12.15,0.00,1.00,158.40,-4.80 +-148.80,19.20,12.18,0.00,1.00,153.60,4.80 +-144.00,19.20,12.20,0.00,1.00,153.60,-9.60 +-139.20,24.00,12.22,0.00,1.00,148.80,9.60 +-134.40,24.00,12.24,0.00,1.00,144.00,-9.60 +-129.60,28.80,12.26,0.00,1.00,139.20,9.60 +-124.80,28.80,12.28,0.00,1.00,129.60,-9.60 +-120.00,28.80,12.30,0.00,1.00,124.80,9.60 +-115.20,33.60,12.33,0.00,1.00,115.20,-9.60 +-110.40,33.60,12.35,0.00,1.00,110.40,9.60 +-100.80,33.60,12.37,0.00,1.00,100.80,-9.60 +-96.00,33.60,12.39,0.00,1.00,91.20,9.60 +-91.20,33.60,12.41,0.00,1.00,81.60,-9.60 +-86.40,33.60,12.43,0.00,1.00,76.80,9.60 +-81.60,33.60,12.45,0.00,1.00,67.20,-9.60 +-72.00,33.60,12.48,0.00,1.00,57.60,9.60 +-67.20,33.60,12.50,0.00,1.00,52.80,-9.60 +-62.40,28.80,12.52,0.00,1.00,48.00,9.60 +-57.60,28.80,12.54,0.00,1.00,38.40,-9.60 +-52.80,28.80,12.56,0.00,1.00,33.60,9.60 +-48.00,24.00,12.58,0.00,1.00,28.80,-9.60 +-43.20,24.00,12.60,0.00,1.00,28.80,9.60 +-38.40,24.00,12.62,0.00,1.00,24.00,-9.60 +-33.60,19.20,12.65,0.00,1.00,19.20,4.80 +-28.80,19.20,12.67,0.00,1.00,14.40,-4.80 +-24.00,14.40,12.69,0.00,1.00,14.40,4.80 +-19.20,14.40,12.71,0.00,1.00,9.60,-4.80 +-14.40,9.60,12.73,0.00,1.00,9.60,4.80 +-14.40,9.60,12.75,0.00,1.00,4.80,-4.80 +-9.60,4.80,12.77,0.00,1.00,4.80,0.00 +-4.80,4.80,12.80,0.00,1.00,0.00,-0.00 +0.00,0.00,12.82,0.00,1.00,-4.80,0.00 +4.80,-4.80,12.84,0.00,1.00,-4.80,-0.00 +9.60,-4.80,12.86,0.00,1.00,-9.60,0.00 +9.60,-9.60,12.88,0.00,1.00,-9.60,-0.00 +14.40,-9.60,12.90,0.00,1.00,-14.40,0.00 +19.20,-14.40,12.92,0.00,1.00,-19.20,-4.80 +24.00,-19.20,12.95,0.00,1.00,-24.00,4.80 +28.80,-19.20,12.97,0.00,1.00,-24.00,-4.80 +33.60,-24.00,12.99,0.00,1.00,-28.80,4.80 +38.40,-24.00,13.01,0.00,1.00,-33.60,-4.80 +43.20,-28.80,13.03,0.00,1.00,-38.40,4.80 +48.00,-28.80,13.05,0.00,1.00,-43.20,-4.80 +52.80,-33.60,13.07,0.00,1.00,-48.00,4.80 +57.60,-33.60,13.09,0.00,1.00,-52.80,-4.80 +62.40,-33.60,13.12,0.00,1.00,-62.40,4.80 +67.20,-38.40,13.14,0.00,1.00,-67.20,-4.80 +72.00,-38.40,13.16,0.00,1.00,-76.80,4.80 +81.60,-38.40,13.18,0.00,1.00,-86.40,-4.80 +86.40,-38.40,13.20,0.00,1.00,-91.20,4.80 +91.20,-38.40,13.22,0.00,1.00,-100.80,-4.80 +96.00,-38.40,13.24,0.00,1.00,-105.60,4.80 +105.60,-38.40,13.27,0.00,1.00,-115.20,-4.80 +110.40,-38.40,13.29,0.00,1.00,-120.00,4.80 +115.20,-33.60,13.31,0.00,1.00,-129.60,-4.80 +120.00,-33.60,13.33,0.00,1.00,-134.40,4.80 +124.80,-33.60,13.35,0.00,1.00,-139.20,-4.80 +129.60,-28.80,13.37,0.00,1.00,-144.00,4.80 +134.40,-28.80,13.39,0.00,1.00,-148.80,-4.80 +139.20,-24.00,13.42,0.00,1.00,-153.60,4.80 +144.00,-24.00,13.44,0.00,1.00,-158.40,-4.80 +148.80,-19.20,13.46,0.00,1.00,-158.40,4.80 +153.60,-19.20,13.48,0.00,1.00,-163.20,-4.80 +158.40,-14.40,13.50,0.00,1.00,-168.00,4.80 +163.20,-14.40,13.52,0.00,1.00,-168.00,-4.80 +168.00,-9.60,13.54,0.00,1.00,-172.80,0.00 +172.80,-9.60,13.56,0.00,1.00,-177.60,-0.00 +172.80,-4.80,13.59,0.00,1.00,-177.60,0.00 +177.60,-0.00,13.61,0.00,1.00,177.60,-0.00 +-177.60,0.00,13.63,0.00,1.00,177.60,-0.00 +-172.80,4.80,13.65,0.00,1.00,172.80,0.00 +-172.80,9.60,13.67,0.00,1.00,168.00,-0.00 +-168.00,9.60,13.69,0.00,1.00,168.00,0.00 +-163.20,14.40,13.71,0.00,1.00,163.20,-4.80 +-158.40,14.40,13.74,0.00,1.00,158.40,4.80 +-153.60,19.20,13.76,0.00,1.00,158.40,-4.80 +-148.80,19.20,13.78,0.00,1.00,153.60,4.80 +-144.00,24.00,13.80,0.00,1.00,148.80,-4.80 +-139.20,24.00,13.82,0.00,1.00,144.00,4.80 +-134.40,28.80,13.84,0.00,1.00,139.20,-4.80 +-129.60,28.80,13.86,0.00,1.00,134.40,4.80 +-124.80,33.60,13.89,0.00,1.00,129.60,-4.80 +-120.00,33.60,13.91,0.00,1.00,120.00,4.80 +-115.20,33.60,13.93,0.00,1.00,115.20,-4.80 +-110.40,38.40,13.95,0.00,1.00,105.60,4.80 +-105.60,38.40,13.97,0.00,1.00,100.80,-4.80 +-96.00,38.40,13.99,0.00,1.00,91.20,4.80 +-91.20,38.40,14.01,0.00,1.00,86.40,-4.80 +-86.40,38.40,14.03,0.00,1.00,76.80,4.80 +-81.60,38.40,14.06,0.00,1.00,67.20,-4.80 +-72.00,38.40,14.08,0.00,1.00,62.40,4.80 +-67.20,38.40,14.10,0.00,1.00,52.80,-4.80 +-62.40,33.60,14.12,0.00,1.00,48.00,4.80 +-57.60,33.60,14.14,0.00,1.00,43.20,-4.80 +-52.80,33.60,14.16,0.00,1.00,38.40,4.80 +-48.00,28.80,14.18,0.00,1.00,33.60,-4.80 +-43.20,28.80,14.21,0.00,1.00,28.80,4.80 +-38.40,24.00,14.23,0.00,1.00,24.00,-4.80 +-33.60,24.00,14.25,0.00,1.00,24.00,4.80 +-28.80,19.20,14.27,0.00,1.00,19.20,-4.80 +-24.00,19.20,14.29,0.00,1.00,14.40,4.80 +-19.20,14.40,14.31,0.00,1.00,9.60,-4.80 +-14.40,9.60,14.33,0.00,1.00,9.60,0.00 +-9.60,9.60,14.36,0.00,1.00,4.80,-0.00 +-9.60,4.80,14.38,0.00,1.00,4.80,0.00 +-4.80,4.80,14.40,0.00,1.00,0.00,-0.00 +0.00,0.00,14.42,0.00,1.00,-4.80,0.00 +4.80,-4.80,14.44,0.00,1.00,-4.80,-0.00 +4.80,-4.80,14.46,0.00,1.00,-9.60,0.00 +9.60,-9.60,14.48,0.00,1.00,-14.40,-0.00 +14.40,-14.40,14.50,0.00,1.00,-14.40,0.00 +19.20,-14.40,14.53,0.00,1.00,-19.20,-0.00 +24.00,-19.20,14.55,0.00,1.00,-24.00,0.00 +24.00,-24.00,14.57,0.00,1.00,-28.80,-0.00 +28.80,-24.00,14.59,0.00,1.00,-33.60,0.00 +33.60,-28.80,14.61,0.00,1.00,-38.40,-0.00 +38.40,-28.80,14.63,0.00,1.00,-43.20,0.00 +43.20,-33.60,14.65,0.00,1.00,-48.00,-0.00 +48.00,-33.60,14.68,0.00,1.00,-52.80,0.00 +52.80,-38.40,14.70,0.00,1.00,-57.60,-0.00 +62.40,-38.40,14.72,0.00,1.00,-62.40,0.00 +67.20,-38.40,14.74,0.00,1.00,-72.00,-0.00 +72.00,-43.20,14.76,0.00,1.00,-76.80,0.00 +76.80,-43.20,14.78,0.00,1.00,-86.40,-0.00 +86.40,-43.20,14.80,0.00,1.00,-91.20,0.00 +91.20,-43.20,14.83,0.00,1.00,-100.80,-0.00 +96.00,-43.20,14.85,0.00,1.00,-105.60,0.00 +105.60,-43.20,14.87,0.00,1.00,-110.40,-0.00 +110.40,-43.20,14.89,0.00,1.00,-120.00,0.00 +115.20,-38.40,14.91,0.00,1.00,-124.80,-0.00 +124.80,-38.40,14.93,0.00,1.00,-129.60,0.00 +129.60,-38.40,14.95,0.00,1.00,-134.40,-0.00 +134.40,-33.60,14.97,0.00,1.00,-139.20,0.00 +139.20,-33.60,15.00,0.00,1.00,-144.00,-0.00 +144.00,-28.80,15.02,0.00,1.00,-148.80,0.00 +148.80,-28.80,15.04,0.00,1.00,-153.60,-0.00 +153.60,-24.00,15.06,0.00,1.00,-158.40,0.00 +158.40,-19.20,15.08,0.00,1.00,-163.20,-0.00 +158.40,-19.20,15.10,0.00,1.00,-163.20,0.00 +163.20,-14.40,15.12,0.00,1.00,-168.00,-0.00 +168.00,-9.60,15.15,0.00,1.00,-172.80,0.00 +172.80,-9.60,15.17,0.00,1.00,-172.80,-0.00 +172.80,-4.80,15.19,0.00,1.00,-177.60,0.00 +177.60,-0.00,15.21,0.00,1.00,177.60,-0.00 +-177.60,0.00,15.23,0.00,1.00,172.80,-0.00 +-172.80,4.80,15.25,0.00,1.00,172.80,0.00 +-172.80,9.60,15.27,0.00,1.00,168.00,-0.00 +-168.00,9.60,15.30,0.00,1.00,163.20,0.00 +-163.20,14.40,15.32,0.00,1.00,163.20,-0.00 +-158.40,19.20,15.34,0.00,1.00,158.40,0.00 +-158.40,19.20,15.36,0.00,1.00,153.60,-0.00 +-153.60,24.00,15.38,0.00,1.00,148.80,0.00 +-148.80,28.80,15.40,0.00,1.00,144.00,-0.00 +-144.00,28.80,15.42,0.00,1.00,139.20,0.00 +-139.20,33.60,15.44,0.00,1.00,134.40,-0.00 +-134.40,33.60,15.47,0.00,1.00,129.60,0.00 +-129.60,38.40,15.49,0.00,1.00,124.80,-0.00 +-124.80,38.40,15.51,0.00,1.00,120.00,0.00 +-115.20,38.40,15.53,0.00,1.00,110.40,-0.00 +-110.40,43.20,15.55,0.00,1.00,105.60,0.00 +-105.60,43.20,15.57,0.00,1.00,100.80,-0.00 +-96.00,43.20,15.59,0.00,1.00,91.20,0.00 +-91.20,43.20,15.62,0.00,1.00,86.40,-0.00 +-86.40,43.20,15.64,0.00,1.00,76.80,0.00 +-76.80,43.20,15.66,0.00,1.00,72.00,-0.00 +-72.00,43.20,15.68,0.00,1.00,62.40,0.00 +-67.20,38.40,15.70,0.00,1.00,57.60,-0.00 +-62.40,38.40,15.72,0.00,1.00,52.80,0.00 +-52.80,38.40,15.74,0.00,1.00,48.00,-0.00 +-48.00,33.60,15.77,0.00,1.00,43.20,0.00 +-43.20,33.60,15.79,0.00,1.00,38.40,-0.00 +-38.40,28.80,15.81,0.00,1.00,33.60,0.00 +-33.60,28.80,15.83,0.00,1.00,28.80,-0.00 +-28.80,24.00,15.85,0.00,1.00,24.00,0.00 +-24.00,24.00,15.87,0.00,1.00,19.20,-0.00 +-24.00,19.20,15.89,0.00,1.00,14.40,0.00 +-19.20,14.40,15.91,0.00,1.00,14.40,-0.00 +-14.40,14.40,15.94,0.00,1.00,9.60,0.00 +-9.60,9.60,15.96,0.00,1.00,4.80,-0.00 +-4.80,4.80,15.98,0.00,1.00,4.80,0.00 +-4.80,4.80,16.00,0.00,1.00,0.00,-0.00 +0.00,0.00,16.00,0.00,1.00,-4.80,0.00 +4.80,-4.80,15.98,0.00,1.00,-4.80,0.00 +4.80,-4.80,15.96,0.00,1.00,-9.60,-0.00 +9.60,-9.60,15.94,0.00,1.00,-14.40,0.00 +14.40,-14.40,15.91,0.00,1.00,-19.20,-0.00 +14.40,-19.20,15.89,0.00,1.00,-24.00,0.00 +19.20,-19.20,15.87,0.00,1.00,-24.00,-0.00 +24.00,-24.00,15.85,0.00,1.00,-28.80,0.00 +28.80,-28.80,15.83,0.00,1.00,-33.60,-0.00 +33.60,-28.80,15.81,0.00,1.00,-38.40,0.00 +38.40,-33.60,15.79,0.00,1.00,-43.20,-0.00 +43.20,-38.40,15.77,0.00,1.00,-48.00,0.00 +48.00,-38.40,15.74,0.00,1.00,-52.80,-4.80 +52.80,-43.20,15.72,0.00,1.00,-62.40,4.80 +57.60,-43.20,15.70,0.00,1.00,-67.20,-4.80 +62.40,-43.20,15.68,0.00,1.00,-72.00,4.80 +72.00,-48.00,15.66,0.00,1.00,-76.80,-4.80 +76.80,-48.00,15.64,0.00,1.00,-86.40,4.80 +86.40,-48.00,15.62,0.00,1.00,-91.20,-4.80 +91.20,-48.00,15.59,0.00,1.00,-96.00,4.80 +100.80,-48.00,15.57,0.00,1.00,-105.60,-4.80 +105.60,-48.00,15.55,0.00,1.00,-110.40,4.80 +110.40,-48.00,15.53,0.00,1.00,-115.20,-4.80 +120.00,-43.20,15.51,0.00,1.00,-124.80,4.80 +124.80,-43.20,15.49,0.00,1.00,-129.60,-4.80 +129.60,-38.40,15.47,0.00,1.00,-134.40,4.80 +134.40,-38.40,15.44,0.00,1.00,-139.20,-4.80 +139.20,-33.60,15.42,0.00,1.00,-144.00,0.00 +144.00,-33.60,15.40,0.00,1.00,-148.80,-0.00 +148.80,-28.80,15.38,0.00,1.00,-153.60,0.00 +153.60,-24.00,15.36,0.00,1.00,-158.40,-0.00 +158.40,-24.00,15.34,0.00,1.00,-158.40,0.00 +163.20,-19.20,15.32,0.00,1.00,-163.20,-0.00 +163.20,-14.40,15.30,0.00,1.00,-168.00,0.00 +168.00,-14.40,15.27,0.00,1.00,-172.80,-0.00 +172.80,-9.60,15.25,0.00,1.00,-172.80,0.00 +172.80,-4.80,15.23,0.00,1.00,-177.60,-0.00 +177.60,-0.00,15.21,0.00,1.00,177.60,0.00 +-177.60,0.00,15.19,0.00,1.00,172.80,0.00 +-172.80,4.80,15.17,0.00,1.00,172.80,-0.00 +-172.80,9.60,15.15,0.00,1.00,168.00,0.00 +-168.00,14.40,15.12,0.00,1.00,163.20,-0.00 +-163.20,14.40,15.10,0.00,1.00,158.40,0.00 +-163.20,19.20,15.08,0.00,1.00,158.40,-0.00 +-158.40,24.00,15.06,0.00,1.00,153.60,0.00 +-153.60,24.00,15.04,0.00,1.00,148.80,-0.00 +-148.80,28.80,15.02,0.00,1.00,144.00,0.00 +-144.00,33.60,15.00,0.00,1.00,139.20,-0.00 +-139.20,33.60,14.97,0.00,1.00,134.40,0.00 +-134.40,38.40,14.95,0.00,1.00,129.60,-4.80 +-129.60,38.40,14.93,0.00,1.00,124.80,4.80 +-124.80,43.20,14.91,0.00,1.00,115.20,-4.80 +-120.00,43.20,14.89,0.00,1.00,110.40,4.80 +-110.40,48.00,14.87,0.00,1.00,105.60,-4.80 +-105.60,48.00,14.85,0.00,1.00,96.00,4.80 +-100.80,48.00,14.83,0.00,1.00,91.20,-4.80 +-91.20,48.00,14.80,0.00,1.00,86.40,4.80 +-86.40,48.00,14.78,0.00,1.00,76.80,-4.80 +-76.80,48.00,14.76,0.00,1.00,72.00,4.80 +-72.00,48.00,14.74,0.00,1.00,67.20,-4.80 +-62.40,43.20,14.72,0.00,1.00,62.40,4.80 +-57.60,43.20,14.70,0.00,1.00,52.80,-4.80 +-52.80,43.20,14.68,0.00,1.00,48.00,4.80 +-48.00,38.40,14.65,0.00,1.00,43.20,-4.80 +-43.20,38.40,14.63,0.00,1.00,38.40,0.00 +-38.40,33.60,14.61,0.00,1.00,33.60,-0.00 +-33.60,28.80,14.59,0.00,1.00,28.80,0.00 +-28.80,28.80,14.57,0.00,1.00,24.00,-0.00 +-24.00,24.00,14.55,0.00,1.00,24.00,0.00 +-19.20,19.20,14.53,0.00,1.00,19.20,-0.00 +-14.40,19.20,14.50,0.00,1.00,14.40,0.00 +-14.40,14.40,14.48,0.00,1.00,9.60,-0.00 +-9.60,9.60,14.46,0.00,1.00,4.80,0.00 +-4.80,4.80,14.44,0.00,1.00,4.80,-0.00 +-4.80,4.80,14.42,0.00,1.00,0.00,0.00 +0.00,0.00,14.40,0.00,1.00,-4.80,0.00 +4.80,-4.80,14.38,0.00,1.00,-9.60,0.00 +4.80,-9.60,14.36,0.00,1.00,-9.60,-0.00 +9.60,-9.60,14.33,0.00,1.00,-14.40,0.00 +9.60,-14.40,14.31,0.00,1.00,-19.20,-4.80 +14.40,-19.20,14.29,0.00,1.00,-24.00,4.80 +19.20,-24.00,14.27,0.00,1.00,-28.80,-4.80 +24.00,-24.00,14.25,0.00,1.00,-33.60,4.80 +24.00,-28.80,14.23,0.00,1.00,-38.40,-4.80 +28.80,-33.60,14.21,0.00,1.00,-43.20,4.80 +33.60,-38.40,14.18,0.00,1.00,-48.00,-4.80 +38.40,-38.40,14.16,0.00,1.00,-52.80,4.80 +43.20,-43.20,14.14,0.00,1.00,-57.60,-4.80 +48.00,-43.20,14.12,0.00,1.00,-62.40,4.80 +52.80,-48.00,14.10,0.00,1.00,-67.20,-4.80 +62.40,-48.00,14.08,0.00,1.00,-72.00,9.60 +67.20,-52.80,14.06,0.00,1.00,-81.60,-9.60 +76.80,-52.80,14.03,0.00,1.00,-86.40,9.60 +86.40,-52.80,14.01,0.00,1.00,-91.20,-9.60 +91.20,-52.80,13.99,0.00,1.00,-96.00,9.60 +100.80,-52.80,13.97,0.00,1.00,-105.60,-9.60 +105.60,-52.80,13.95,0.00,1.00,-110.40,9.60 +115.20,-48.00,13.93,0.00,1.00,-115.20,-9.60 +120.00,-48.00,13.91,0.00,1.00,-120.00,9.60 +129.60,-48.00,13.89,0.00,1.00,-124.80,-4.80 +134.40,-43.20,13.86,0.00,1.00,-129.60,4.80 +139.20,-43.20,13.84,0.00,1.00,-134.40,-4.80 +144.00,-38.40,13.82,0.00,1.00,-139.20,4.80 +148.80,-33.60,13.80,0.00,1.00,-144.00,-4.80 +153.60,-33.60,13.78,0.00,1.00,-148.80,4.80 +158.40,-28.80,13.76,0.00,1.00,-153.60,-4.80 +158.40,-24.00,13.74,0.00,1.00,-158.40,4.80 +163.20,-19.20,13.71,0.00,1.00,-163.20,-4.80 +168.00,-19.20,13.69,0.00,1.00,-168.00,4.80 +168.00,-14.40,13.67,0.00,1.00,-172.80,-0.00 +172.80,-9.60,13.65,0.00,1.00,-172.80,0.00 +177.60,-4.80,13.63,0.00,1.00,-177.60,-0.00 +177.60,-0.00,13.61,0.00,1.00,177.60,0.00 +-177.60,0.00,13.59,0.00,1.00,172.80,0.00 +-177.60,4.80,13.56,0.00,1.00,172.80,-0.00 +-172.80,9.60,13.54,0.00,1.00,168.00,0.00 +-168.00,14.40,13.52,0.00,1.00,163.20,-0.00 +-168.00,19.20,13.50,0.00,1.00,158.40,4.80 +-163.20,19.20,13.48,0.00,1.00,153.60,-4.80 +-158.40,24.00,13.46,0.00,1.00,148.80,4.80 +-158.40,28.80,13.44,0.00,1.00,144.00,-4.80 +-153.60,33.60,13.42,0.00,1.00,139.20,4.80 +-148.80,33.60,13.39,0.00,1.00,134.40,-4.80 +-144.00,38.40,13.37,0.00,1.00,129.60,4.80 +-139.20,43.20,13.35,0.00,1.00,124.80,-4.80 +-134.40,43.20,13.33,0.00,1.00,120.00,4.80 +-129.60,48.00,13.31,0.00,1.00,115.20,-4.80 +-120.00,48.00,13.29,0.00,1.00,110.40,9.60 +-115.20,48.00,13.27,0.00,1.00,105.60,-9.60 +-105.60,52.80,13.24,0.00,1.00,96.00,9.60 +-100.80,52.80,13.22,0.00,1.00,91.20,-9.60 +-91.20,52.80,13.20,0.00,1.00,86.40,9.60 +-86.40,52.80,13.18,0.00,1.00,81.60,-9.60 +-76.80,52.80,13.16,0.00,1.00,72.00,9.60 +-67.20,52.80,13.14,0.00,1.00,67.20,-9.60 +-62.40,48.00,13.12,0.00,1.00,62.40,9.60 +-52.80,48.00,13.09,0.00,1.00,57.60,-4.80 +-48.00,43.20,13.07,0.00,1.00,52.80,4.80 +-43.20,43.20,13.05,0.00,1.00,48.00,-4.80 +-38.40,38.40,13.03,0.00,1.00,43.20,4.80 +-33.60,38.40,13.01,0.00,1.00,38.40,-4.80 +-28.80,33.60,12.99,0.00,1.00,33.60,4.80 +-24.00,28.80,12.97,0.00,1.00,28.80,-4.80 +-24.00,24.00,12.95,0.00,1.00,24.00,4.80 +-19.20,24.00,12.92,0.00,1.00,19.20,-4.80 +-14.40,19.20,12.90,0.00,1.00,14.40,4.80 +-9.60,14.40,12.88,0.00,1.00,9.60,-4.80 +-9.60,9.60,12.86,0.00,1.00,9.60,0.00 +-4.80,9.60,12.84,0.00,1.00,4.80,-0.00 +-4.80,4.80,12.82,0.00,1.00,0.00,0.00 +0.00,0.00,12.80,0.00,1.00,-4.80,0.00 +4.80,-4.80,12.77,0.00,1.00,-9.60,0.00 +4.80,-9.60,12.75,0.00,1.00,-14.40,-0.00 +9.60,-14.40,12.73,0.00,1.00,-14.40,4.80 +9.60,-14.40,12.71,0.00,1.00,-19.20,-4.80 +14.40,-19.20,12.69,0.00,1.00,-24.00,4.80 +14.40,-24.00,12.67,0.00,1.00,-28.80,-4.80 +19.20,-28.80,12.65,0.00,1.00,-33.60,4.80 +24.00,-33.60,12.62,0.00,1.00,-38.40,-9.60 +28.80,-33.60,12.60,0.00,1.00,-43.20,9.60 +28.80,-38.40,12.58,0.00,1.00,-48.00,-9.60 +33.60,-43.20,12.56,0.00,1.00,-52.80,9.60 +38.40,-43.20,12.54,0.00,1.00,-57.60,-9.60 +48.00,-48.00,12.52,0.00,1.00,-62.40,9.60 +52.80,-52.80,12.50,0.00,1.00,-67.20,-9.60 +57.60,-52.80,12.48,0.00,1.00,-72.00,9.60 +67.20,-57.60,12.45,0.00,1.00,-81.60,-14.40 +76.80,-57.60,12.43,0.00,1.00,-86.40,14.40 +81.60,-57.60,12.41,0.00,1.00,-91.20,-14.40 +91.20,-57.60,12.39,0.00,1.00,-96.00,14.40 +100.80,-57.60,12.37,0.00,1.00,-100.80,-14.40 +110.40,-57.60,12.35,0.00,1.00,-110.40,14.40 +115.20,-52.80,12.33,0.00,1.00,-115.20,-14.40 +124.80,-52.80,12.30,0.00,1.00,-120.00,9.60 +129.60,-48.00,12.28,0.00,1.00,-124.80,-9.60 +139.20,-48.00,12.26,0.00,1.00,-129.60,9.60 +144.00,-43.20,12.24,0.00,1.00,-134.40,-9.60 +148.80,-38.40,12.22,0.00,1.00,-139.20,9.60 +153.60,-38.40,12.20,0.00,1.00,-144.00,-9.60 +153.60,-33.60,12.18,0.00,1.00,-148.80,9.60 +158.40,-28.80,12.15,0.00,1.00,-153.60,-9.60 +163.20,-24.00,12.13,0.00,1.00,-158.40,4.80 +163.20,-24.00,12.11,0.00,1.00,-163.20,-4.80 +168.00,-19.20,12.09,0.00,1.00,-168.00,4.80 +172.80,-14.40,12.07,0.00,1.00,-168.00,-4.80 +172.80,-9.60,12.05,0.00,1.00,-172.80,4.80 +177.60,-4.80,12.03,0.00,1.00,-177.60,-0.00 +177.60,-0.00,12.01,0.00,1.00,177.60,0.00 +-177.60,0.00,11.98,0.00,1.00,172.80,0.00 +-177.60,4.80,11.96,0.00,1.00,168.00,-0.00 +-172.80,9.60,11.94,0.00,1.00,168.00,4.80 +-172.80,14.40,11.92,0.00,1.00,163.20,-4.80 +-168.00,19.20,11.90,0.00,1.00,158.40,4.80 +-163.20,24.00,11.88,0.00,1.00,153.60,-4.80 +-163.20,24.00,11.86,0.00,1.00,148.80,4.80 +-158.40,28.80,11.83,0.00,1.00,144.00,-9.60 +-153.60,33.60,11.81,0.00,1.00,139.20,9.60 +-153.60,38.40,11.79,0.00,1.00,134.40,-9.60 +-148.80,38.40,11.77,0.00,1.00,129.60,9.60 +-144.00,43.20,11.75,0.00,1.00,124.80,-9.60 +-139.20,48.00,11.73,0.00,1.00,120.00,9.60 +-129.60,48.00,11.71,0.00,1.00,115.20,-9.60 +-124.80,52.80,11.68,0.00,1.00,110.40,9.60 +-115.20,52.80,11.66,0.00,1.00,100.80,-14.40 +-110.40,57.60,11.64,0.00,1.00,96.00,14.40 +-100.80,57.60,11.62,0.00,1.00,91.20,-14.40 +-91.20,57.60,11.60,0.00,1.00,86.40,14.40 +-81.60,57.60,11.58,0.00,1.00,81.60,-14.40 +-76.80,57.60,11.56,0.00,1.00,72.00,14.40 +-67.20,57.60,11.54,0.00,1.00,67.20,-14.40 +-57.60,52.80,11.51,0.00,1.00,62.40,9.60 +-52.80,52.80,11.49,0.00,1.00,57.60,-9.60 +-48.00,48.00,11.47,0.00,1.00,52.80,9.60 +-38.40,43.20,11.45,0.00,1.00,48.00,-9.60 +-33.60,43.20,11.43,0.00,1.00,43.20,9.60 +-28.80,38.40,11.41,0.00,1.00,38.40,-9.60 +-28.80,33.60,11.39,0.00,1.00,33.60,9.60 +-24.00,33.60,11.36,0.00,1.00,28.80,-9.60 +-19.20,28.80,11.34,0.00,1.00,24.00,4.80 +-14.40,24.00,11.32,0.00,1.00,19.20,-4.80 +-14.40,19.20,11.30,0.00,1.00,14.40,4.80 +-9.60,14.40,11.28,0.00,1.00,14.40,-4.80 +-9.60,14.40,11.26,0.00,1.00,9.60,4.80 +-4.80,9.60,11.24,0.00,1.00,4.80,-0.00 +-4.80,4.80,11.21,0.00,1.00,0.00,0.00 +0.00,0.00,11.19,0.00,1.00,-4.80,0.00 +0.00,-4.80,11.17,0.00,1.00,-9.60,0.00 +4.80,-9.60,11.15,0.00,1.00,-14.40,-4.80 +4.80,-14.40,11.13,0.00,1.00,-19.20,4.80 +9.60,-19.20,11.11,0.00,1.00,-19.20,-4.80 +9.60,-19.20,11.09,0.00,1.00,-24.00,4.80 +14.40,-24.00,11.07,0.00,1.00,-28.80,-9.60 +19.20,-28.80,11.04,0.00,1.00,-33.60,9.60 +19.20,-33.60,11.02,0.00,1.00,-38.40,-9.60 +24.00,-38.40,11.00,0.00,1.00,-43.20,9.60 +28.80,-43.20,10.98,0.00,1.00,-48.00,-14.40 +33.60,-43.20,10.96,0.00,1.00,-52.80,14.40 +38.40,-48.00,10.94,0.00,1.00,-57.60,-14.40 +43.20,-52.80,10.92,0.00,1.00,-62.40,14.40 +48.00,-52.80,10.89,0.00,1.00,-72.00,-14.40 +52.80,-57.60,10.87,0.00,1.00,-76.80,14.40 +62.40,-57.60,10.85,0.00,1.00,-81.60,-19.20 +72.00,-62.40,10.83,0.00,1.00,-86.40,19.20 +81.60,-62.40,10.81,0.00,1.00,-91.20,-19.20 +91.20,-62.40,10.79,0.00,1.00,-96.00,19.20 +100.80,-62.40,10.77,0.00,1.00,-100.80,-19.20 +110.40,-62.40,10.74,0.00,1.00,-105.60,19.20 +120.00,-57.60,10.72,0.00,1.00,-115.20,-14.40 +129.60,-57.60,10.70,0.00,1.00,-120.00,14.40 +134.40,-52.80,10.68,0.00,1.00,-124.80,-14.40 +139.20,-48.00,10.66,0.00,1.00,-129.60,14.40 +144.00,-48.00,10.64,0.00,1.00,-134.40,-14.40 +148.80,-43.20,10.62,0.00,1.00,-139.20,14.40 +153.60,-38.40,10.60,0.00,1.00,-144.00,-14.40 +158.40,-33.60,10.57,0.00,1.00,-148.80,9.60 +163.20,-33.60,10.55,0.00,1.00,-153.60,-9.60 +163.20,-28.80,10.53,0.00,1.00,-158.40,9.60 +168.00,-24.00,10.51,0.00,1.00,-163.20,-9.60 +168.00,-19.20,10.49,0.00,1.00,-163.20,4.80 +172.80,-14.40,10.47,0.00,1.00,-168.00,-4.80 +172.80,-9.60,10.45,0.00,1.00,-172.80,4.80 +177.60,-4.80,10.42,0.00,1.00,-177.60,-0.00 +177.60,-0.00,10.40,0.00,1.00,177.60,0.00 +-177.60,0.00,10.38,0.00,1.00,172.80,0.00 +-177.60,4.80,10.36,0.00,1.00,168.00,-0.00 +-172.80,9.60,10.34,0.00,1.00,163.20,4.80 +-172.80,14.40,10.32,0.00,1.00,163.20,-4.80 +-168.00,19.20,10.30,0.00,1.00,158.40,4.80 +-168.00,24.00,10.28,0.00,1.00,153.60,-9.60 +-163.20,28.80,10.25,0.00,1.00,148.80,9.60 +-163.20,33.60,10.23,0.00,1.00,144.00,-9.60 +-158.40,33.60,10.21,0.00,1.00,139.20,9.60 +-153.60,38.40,10.19,0.00,1.00,134.40,-14.40 +-148.80,43.20,10.17,0.00,1.00,129.60,14.40 +-144.00,48.00,10.15,0.00,1.00,124.80,-14.40 +-139.20,48.00,10.13,0.00,1.00,120.00,14.40 +-134.40,52.80,10.10,0.00,1.00,115.20,-14.40 +-129.60,57.60,10.08,0.00,1.00,105.60,14.40 +-120.00,57.60,10.06,0.00,1.00,100.80,-14.40 +-110.40,62.40,10.04,0.00,1.00,96.00,19.20 +-100.80,62.40,10.02,0.00,1.00,91.20,-19.20 +-91.20,62.40,10.00,0.00,1.00,86.40,19.20 +-81.60,62.40,9.98,0.00,1.00,81.60,-19.20 +-72.00,62.40,9.95,0.00,1.00,76.80,19.20 +-62.40,57.60,9.93,0.00,1.00,72.00,-19.20 +-52.80,57.60,9.91,0.00,1.00,62.40,14.40 +-48.00,52.80,9.89,0.00,1.00,57.60,-14.40 +-43.20,52.80,9.87,0.00,1.00,52.80,14.40 +-38.40,48.00,9.85,0.00,1.00,48.00,-14.40 +-33.60,43.20,9.83,0.00,1.00,43.20,14.40 +-28.80,43.20,9.81,0.00,1.00,38.40,-14.40 +-24.00,38.40,9.78,0.00,1.00,33.60,9.60 +-19.20,33.60,9.76,0.00,1.00,28.80,-9.60 +-19.20,28.80,9.74,0.00,1.00,24.00,9.60 +-14.40,24.00,9.72,0.00,1.00,19.20,-9.60 +-9.60,19.20,9.70,0.00,1.00,19.20,4.80 +-9.60,19.20,9.68,0.00,1.00,14.40,-4.80 +-4.80,14.40,9.66,0.00,1.00,9.60,4.80 +-4.80,9.60,9.63,0.00,1.00,4.80,-4.80 +-0.00,4.80,9.61,0.00,1.00,0.00,0.00 +0.00,0.00,9.59,0.00,1.00,-4.80,0.00 +0.00,-4.80,9.57,0.00,1.00,-9.60,0.00 +4.80,-9.60,9.55,0.00,1.00,-14.40,-4.80 +4.80,-14.40,9.53,0.00,1.00,-19.20,4.80 +9.60,-19.20,9.51,0.00,1.00,-24.00,-4.80 +9.60,-24.00,9.48,0.00,1.00,-28.80,9.60 +14.40,-24.00,9.46,0.00,1.00,-33.60,-9.60 +14.40,-28.80,9.44,0.00,1.00,-33.60,14.40 +19.20,-33.60,9.42,0.00,1.00,-38.40,-14.40 +19.20,-38.40,9.40,0.00,1.00,-43.20,14.40 +24.00,-43.20,9.38,0.00,1.00,-48.00,-14.40 +28.80,-48.00,9.36,0.00,1.00,-57.60,19.20 +33.60,-52.80,9.34,0.00,1.00,-62.40,-19.20 +38.40,-52.80,9.31,0.00,1.00,-67.20,19.20 +43.20,-57.60,9.29,0.00,1.00,-72.00,-19.20 +48.00,-62.40,9.27,0.00,1.00,-76.80,19.20 +57.60,-62.40,9.25,0.00,1.00,-81.60,-19.20 +67.20,-67.20,9.23,0.00,1.00,-86.40,24.00 +81.60,-67.20,9.21,0.00,1.00,-91.20,-24.00 +91.20,-67.20,9.19,0.00,1.00,-96.00,24.00 +105.60,-67.20,9.16,0.00,1.00,-100.80,-24.00 +115.20,-67.20,9.14,0.00,1.00,-105.60,24.00 +124.80,-62.40,9.12,0.00,1.00,-110.40,-19.20 +134.40,-57.60,9.10,0.00,1.00,-115.20,19.20 +139.20,-57.60,9.08,0.00,1.00,-120.00,-19.20 +144.00,-52.80,9.06,0.00,1.00,-129.60,19.20 +148.80,-48.00,9.04,0.00,1.00,-134.40,-19.20 +153.60,-43.20,9.01,0.00,1.00,-139.20,19.20 +158.40,-43.20,8.99,0.00,1.00,-144.00,-14.40 +163.20,-38.40,8.97,0.00,1.00,-148.80,14.40 +163.20,-33.60,8.95,0.00,1.00,-148.80,-14.40 +168.00,-28.80,8.93,0.00,1.00,-153.60,9.60 +168.00,-24.00,8.91,0.00,1.00,-158.40,-9.60 +172.80,-19.20,8.89,0.00,1.00,-163.20,9.60 +172.80,-14.40,8.87,0.00,1.00,-168.00,-4.80 +177.60,-9.60,8.84,0.00,1.00,-172.80,4.80 +177.60,-4.80,8.82,0.00,1.00,-177.60,-4.80 +177.60,-0.00,8.80,0.00,1.00,177.60,0.00 +-177.60,0.00,8.78,0.00,1.00,172.80,0.00 +-177.60,4.80,8.76,0.00,1.00,168.00,-4.80 +-177.60,9.60,8.74,0.00,1.00,163.20,4.80 +-172.80,14.40,8.72,0.00,1.00,158.40,-4.80 +-172.80,19.20,8.69,0.00,1.00,153.60,9.60 +-168.00,24.00,8.67,0.00,1.00,148.80,-9.60 +-168.00,28.80,8.65,0.00,1.00,148.80,9.60 +-163.20,33.60,8.63,0.00,1.00,144.00,-14.40 +-163.20,38.40,8.61,0.00,1.00,139.20,14.40 +-158.40,43.20,8.59,0.00,1.00,134.40,-14.40 +-153.60,43.20,8.57,0.00,1.00,129.60,19.20 +-148.80,48.00,8.54,0.00,1.00,120.00,-19.20 +-144.00,52.80,8.52,0.00,1.00,115.20,19.20 +-139.20,57.60,8.50,0.00,1.00,110.40,-19.20 +-134.40,57.60,8.48,0.00,1.00,105.60,19.20 +-124.80,62.40,8.46,0.00,1.00,100.80,-19.20 +-115.20,67.20,8.44,0.00,1.00,96.00,24.00 +-105.60,67.20,8.42,0.00,1.00,91.20,-24.00 +-91.20,67.20,8.40,0.00,1.00,86.40,24.00 +-81.60,67.20,8.37,0.00,1.00,81.60,-24.00 +-67.20,67.20,8.35,0.00,1.00,76.80,24.00 +-57.60,62.40,8.33,0.00,1.00,72.00,-19.20 +-48.00,62.40,8.31,0.00,1.00,67.20,19.20 +-43.20,57.60,8.29,0.00,1.00,62.40,-19.20 +-38.40,52.80,8.27,0.00,1.00,57.60,19.20 +-33.60,52.80,8.25,0.00,1.00,48.00,-19.20 +-28.80,48.00,8.22,0.00,1.00,43.20,19.20 +-24.00,43.20,8.20,0.00,1.00,38.40,-14.40 +-19.20,38.40,8.18,0.00,1.00,33.60,14.40 +-19.20,33.60,8.16,0.00,1.00,33.60,-14.40 +-14.40,28.80,8.14,0.00,1.00,28.80,14.40 +-14.40,24.00,8.12,0.00,1.00,24.00,-9.60 +-9.60,24.00,8.10,0.00,1.00,19.20,9.60 +-9.60,19.20,8.07,0.00,1.00,14.40,-4.80 +-4.80,14.40,8.05,0.00,1.00,9.60,4.80 +-4.80,9.60,8.03,0.00,1.00,4.80,-4.80 +-0.00,4.80,8.01,0.00,1.00,0.00,0.00 +0.00,0.00,7.99,0.00,1.00,-4.80,0.00 +0.00,-4.80,7.97,0.00,1.00,-9.60,0.00 +4.80,-9.60,7.95,0.00,1.00,-14.40,-4.80 +4.80,-14.40,7.93,0.00,1.00,-19.20,4.80 +4.80,-19.20,7.90,0.00,1.00,-24.00,-9.60 +9.60,-24.00,7.88,0.00,1.00,-28.80,9.60 +9.60,-28.80,7.86,0.00,1.00,-33.60,-14.40 +9.60,-33.60,7.84,0.00,1.00,-38.40,14.40 +14.40,-38.40,7.82,0.00,1.00,-43.20,-14.40 +14.40,-38.40,7.80,0.00,1.00,-48.00,19.20 +19.20,-43.20,7.78,0.00,1.00,-52.80,-19.20 +24.00,-48.00,7.75,0.00,1.00,-57.60,19.20 +24.00,-52.80,7.73,0.00,1.00,-62.40,-24.00 +28.80,-57.60,7.71,0.00,1.00,-67.20,24.00 +38.40,-62.40,7.69,0.00,1.00,-72.00,-24.00 +43.20,-62.40,7.67,0.00,1.00,-76.80,24.00 +52.80,-67.20,7.65,0.00,1.00,-81.60,-24.00 +62.40,-72.00,7.63,0.00,1.00,-86.40,28.80 +76.80,-72.00,7.60,0.00,1.00,-91.20,-28.80 +96.00,-72.00,7.58,0.00,1.00,-96.00,28.80 +110.40,-72.00,7.56,0.00,1.00,-100.80,-28.80 +120.00,-67.20,7.54,0.00,1.00,-105.60,28.80 +134.40,-67.20,7.52,0.00,1.00,-110.40,-24.00 +139.20,-62.40,7.50,0.00,1.00,-115.20,24.00 +148.80,-57.60,7.48,0.00,1.00,-120.00,-24.00 +153.60,-57.60,7.46,0.00,1.00,-124.80,24.00 +158.40,-52.80,7.43,0.00,1.00,-129.60,-24.00 +158.40,-48.00,7.41,0.00,1.00,-134.40,19.20 +163.20,-43.20,7.39,0.00,1.00,-139.20,-19.20 +163.20,-38.40,7.37,0.00,1.00,-144.00,19.20 +168.00,-33.60,7.35,0.00,1.00,-148.80,-14.40 +168.00,-28.80,7.33,0.00,1.00,-153.60,14.40 +172.80,-24.00,7.31,0.00,1.00,-158.40,-9.60 +172.80,-19.20,7.28,0.00,1.00,-163.20,9.60 +172.80,-14.40,7.26,0.00,1.00,-168.00,-9.60 +177.60,-9.60,7.24,0.00,1.00,-172.80,4.80 +177.60,-4.80,7.22,0.00,1.00,-177.60,-4.80 +177.60,-0.00,7.20,0.00,1.00,177.60,0.00 +-177.60,0.00,7.18,0.00,1.00,172.80,0.00 +-177.60,4.80,7.16,0.00,1.00,168.00,-4.80 +-177.60,9.60,7.13,0.00,1.00,163.20,4.80 +-172.80,14.40,7.11,0.00,1.00,158.40,-9.60 +-172.80,19.20,7.09,0.00,1.00,153.60,9.60 +-172.80,24.00,7.07,0.00,1.00,148.80,-9.60 +-168.00,28.80,7.05,0.00,1.00,144.00,14.40 +-168.00,33.60,7.03,0.00,1.00,139.20,-14.40 +-163.20,38.40,7.01,0.00,1.00,134.40,19.20 +-163.20,43.20,6.99,0.00,1.00,129.60,-19.20 +-158.40,48.00,6.96,0.00,1.00,124.80,19.20 +-158.40,52.80,6.94,0.00,1.00,120.00,-24.00 +-153.60,57.60,6.92,0.00,1.00,115.20,24.00 +-148.80,57.60,6.90,0.00,1.00,110.40,-24.00 +-139.20,62.40,6.88,0.00,1.00,105.60,24.00 +-134.40,67.20,6.86,0.00,1.00,100.80,-24.00 +-120.00,67.20,6.84,0.00,1.00,96.00,28.80 +-110.40,72.00,6.81,0.00,1.00,91.20,-28.80 +-96.00,72.00,6.79,0.00,1.00,86.40,28.80 +-76.80,72.00,6.77,0.00,1.00,81.60,-28.80 +-62.40,72.00,6.75,0.00,1.00,76.80,28.80 +-52.80,67.20,6.73,0.00,1.00,72.00,-24.00 +-43.20,62.40,6.71,0.00,1.00,67.20,24.00 +-38.40,62.40,6.69,0.00,1.00,62.40,-24.00 +-28.80,57.60,6.66,0.00,1.00,57.60,24.00 +-24.00,52.80,6.64,0.00,1.00,52.80,-24.00 +-24.00,48.00,6.62,0.00,1.00,48.00,19.20 +-19.20,43.20,6.60,0.00,1.00,43.20,-19.20 +-14.40,38.40,6.58,0.00,1.00,38.40,19.20 +-14.40,38.40,6.56,0.00,1.00,33.60,-14.40 +-9.60,33.60,6.54,0.00,1.00,28.80,14.40 +-9.60,28.80,6.52,0.00,1.00,24.00,-14.40 +-9.60,24.00,6.49,0.00,1.00,19.20,9.60 +-4.80,19.20,6.47,0.00,1.00,14.40,-9.60 +-4.80,14.40,6.45,0.00,1.00,9.60,4.80 +-4.80,9.60,6.43,0.00,1.00,4.80,-4.80 +-0.00,4.80,6.41,0.00,1.00,0.00,0.00 +0.00,0.00,6.39,0.00,1.00,-4.80,0.00 +0.00,-4.80,6.37,0.00,1.00,-9.60,4.80 +0.00,-9.60,6.34,0.00,1.00,-14.40,-4.80 +4.80,-14.40,6.32,0.00,1.00,-19.20,9.60 +4.80,-19.20,6.30,0.00,1.00,-24.00,-9.60 +4.80,-24.00,6.28,0.00,1.00,-28.80,14.40 +4.80,-28.80,6.26,0.00,1.00,-33.60,-14.40 +9.60,-33.60,6.24,0.00,1.00,-38.40,19.20 +9.60,-38.40,6.22,0.00,1.00,-43.20,-19.20 +14.40,-43.20,6.19,0.00,1.00,-48.00,19.20 +14.40,-48.00,6.17,0.00,1.00,-52.80,-24.00 +14.40,-52.80,6.15,0.00,1.00,-57.60,24.00 +19.20,-57.60,6.13,0.00,1.00,-62.40,-28.80 +24.00,-57.60,6.11,0.00,1.00,-67.20,28.80 +28.80,-62.40,6.09,0.00,1.00,-72.00,-28.80 +33.60,-67.20,6.07,0.00,1.00,-76.80,28.80 +43.20,-72.00,6.05,0.00,1.00,-81.60,-28.80 +57.60,-72.00,6.02,0.00,1.00,-86.40,33.60 +76.80,-76.80,6.00,0.00,1.00,-91.20,-33.60 +96.00,-76.80,5.98,0.00,1.00,-96.00,33.60 +115.20,-76.80,5.96,0.00,1.00,-100.80,-33.60 +129.60,-72.00,5.94,0.00,1.00,-105.60,28.80 +139.20,-72.00,5.92,0.00,1.00,-110.40,-28.80 +148.80,-67.20,5.90,0.00,1.00,-115.20,28.80 +153.60,-62.40,5.87,0.00,1.00,-120.00,-28.80 +158.40,-57.60,5.85,0.00,1.00,-124.80,28.80 +163.20,-52.80,5.83,0.00,1.00,-129.60,-24.00 +163.20,-48.00,5.81,0.00,1.00,-134.40,24.00 +168.00,-43.20,5.79,0.00,1.00,-139.20,-24.00 +168.00,-38.40,5.77,0.00,1.00,-144.00,19.20 +172.80,-33.60,5.75,0.00,1.00,-148.80,-19.20 +172.80,-28.80,5.72,0.00,1.00,-153.60,14.40 +172.80,-24.00,5.70,0.00,1.00,-158.40,-14.40 +172.80,-19.20,5.68,0.00,1.00,-163.20,9.60 +177.60,-14.40,5.66,0.00,1.00,-168.00,-9.60 +177.60,-9.60,5.64,0.00,1.00,-172.80,4.80 +177.60,-4.80,5.62,0.00,1.00,-177.60,-4.80 +177.60,-0.00,5.60,0.00,1.00,177.60,0.00 +-177.60,0.00,5.58,0.00,1.00,172.80,0.00 +-177.60,4.80,5.55,0.00,1.00,168.00,-4.80 +-177.60,9.60,5.53,0.00,1.00,163.20,4.80 +-177.60,14.40,5.51,0.00,1.00,158.40,-9.60 +-172.80,19.20,5.49,0.00,1.00,153.60,9.60 +-172.80,24.00,5.47,0.00,1.00,148.80,-14.40 +-172.80,28.80,5.45,0.00,1.00,144.00,14.40 +-172.80,33.60,5.43,0.00,1.00,139.20,-19.20 +-168.00,38.40,5.40,0.00,1.00,134.40,19.20 +-168.00,43.20,5.38,0.00,1.00,129.60,-24.00 +-163.20,48.00,5.36,0.00,1.00,124.80,24.00 +-163.20,52.80,5.34,0.00,1.00,120.00,-24.00 +-158.40,57.60,5.32,0.00,1.00,115.20,28.80 +-153.60,62.40,5.30,0.00,1.00,110.40,-28.80 +-148.80,67.20,5.28,0.00,1.00,105.60,28.80 +-139.20,72.00,5.26,0.00,1.00,100.80,-28.80 +-129.60,72.00,5.23,0.00,1.00,96.00,28.80 +-115.20,76.80,5.21,0.00,1.00,91.20,-33.60 +-96.00,76.80,5.19,0.00,1.00,86.40,33.60 +-76.80,76.80,5.17,0.00,1.00,81.60,-33.60 +-57.60,72.00,5.15,0.00,1.00,76.80,33.60 +-43.20,72.00,5.13,0.00,1.00,72.00,-28.80 +-33.60,67.20,5.11,0.00,1.00,67.20,28.80 +-28.80,62.40,5.08,0.00,1.00,62.40,-28.80 +-24.00,57.60,5.06,0.00,1.00,57.60,28.80 +-19.20,57.60,5.04,0.00,1.00,52.80,-28.80 +-14.40,52.80,5.02,0.00,1.00,48.00,24.00 +-14.40,48.00,5.00,0.00,1.00,43.20,-24.00 +-14.40,43.20,4.98,0.00,1.00,38.40,19.20 +-9.60,38.40,4.96,0.00,1.00,33.60,-19.20 +-9.60,33.60,4.93,0.00,1.00,28.80,19.20 +-4.80,28.80,4.91,0.00,1.00,24.00,-14.40 +-4.80,24.00,4.89,0.00,1.00,19.20,14.40 +-4.80,19.20,4.87,0.00,1.00,14.40,-9.60 +-4.80,14.40,4.85,0.00,1.00,9.60,9.60 +-0.00,9.60,4.83,0.00,1.00,4.80,-4.80 +-0.00,4.80,4.81,0.00,1.00,0.00,4.80 +0.00,0.00,4.79,0.00,1.00,-4.80,0.00 +0.00,-4.80,4.76,0.00,1.00,-9.60,4.80 +0.00,-9.60,4.74,0.00,1.00,-14.40,-4.80 +0.00,-14.40,4.72,0.00,1.00,-19.20,9.60 +4.80,-19.20,4.70,0.00,1.00,-24.00,-9.60 +4.80,-24.00,4.68,0.00,1.00,-28.80,14.40 +4.80,-28.80,4.66,0.00,1.00,-33.60,-14.40 +4.80,-33.60,4.64,0.00,1.00,-38.40,19.20 +4.80,-38.40,4.61,0.00,1.00,-43.20,-24.00 +9.60,-43.20,4.59,0.00,1.00,-48.00,24.00 +9.60,-48.00,4.57,0.00,1.00,-52.80,-24.00 +9.60,-52.80,4.55,0.00,1.00,-57.60,28.80 +14.40,-57.60,4.53,0.00,1.00,-62.40,-28.80 +14.40,-62.40,4.51,0.00,1.00,-67.20,33.60 +19.20,-67.20,4.49,0.00,1.00,-72.00,-33.60 +24.00,-72.00,4.46,0.00,1.00,-76.80,33.60 +33.60,-72.00,4.44,0.00,1.00,-81.60,-33.60 +43.20,-76.80,4.42,0.00,1.00,-86.40,38.40 +67.20,-81.60,4.40,0.00,1.00,-91.20,-38.40 +96.00,-81.60,4.38,0.00,1.00,-96.00,38.40 +124.80,-81.60,4.36,0.00,1.00,-100.80,-38.40 +144.00,-76.80,4.34,0.00,1.00,-105.60,33.60 +153.60,-72.00,4.32,0.00,1.00,-110.40,-33.60 +158.40,-67.20,4.29,0.00,1.00,-115.20,33.60 +163.20,-62.40,4.27,0.00,1.00,-120.00,-33.60 +168.00,-57.60,4.25,0.00,1.00,-124.80,28.80 +168.00,-52.80,4.23,0.00,1.00,-129.60,-28.80 +168.00,-48.00,4.21,0.00,1.00,-134.40,28.80 +172.80,-43.20,4.19,0.00,1.00,-139.20,-24.00 +172.80,-38.40,4.17,0.00,1.00,-144.00,24.00 +172.80,-33.60,4.14,0.00,1.00,-148.80,-19.20 +172.80,-28.80,4.12,0.00,1.00,-153.60,19.20 +177.60,-24.00,4.10,0.00,1.00,-158.40,-14.40 +177.60,-19.20,4.08,0.00,1.00,-163.20,14.40 +177.60,-14.40,4.06,0.00,1.00,-168.00,-9.60 +177.60,-9.60,4.04,0.00,1.00,-172.80,4.80 +177.60,-4.80,4.02,0.00,1.00,-177.60,-4.80 +177.60,-0.00,3.99,0.00,1.00,177.60,0.00 +-177.60,0.00,3.97,0.00,1.00,172.80,0.00 +-177.60,4.80,3.95,0.00,1.00,168.00,-4.80 +-177.60,9.60,3.93,0.00,1.00,163.20,4.80 +-177.60,14.40,3.91,0.00,1.00,158.40,-9.60 +-177.60,19.20,3.89,0.00,1.00,153.60,14.40 +-177.60,24.00,3.87,0.00,1.00,148.80,-14.40 +-172.80,28.80,3.85,0.00,1.00,144.00,19.20 +-172.80,33.60,3.82,0.00,1.00,139.20,-19.20 +-172.80,38.40,3.80,0.00,1.00,134.40,24.00 +-172.80,43.20,3.78,0.00,1.00,129.60,-24.00 +-168.00,48.00,3.76,0.00,1.00,124.80,28.80 +-168.00,52.80,3.74,0.00,1.00,120.00,-28.80 +-168.00,57.60,3.72,0.00,1.00,115.20,28.80 +-163.20,62.40,3.70,0.00,1.00,110.40,-33.60 +-158.40,67.20,3.67,0.00,1.00,105.60,33.60 +-153.60,72.00,3.65,0.00,1.00,100.80,-33.60 +-144.00,76.80,3.63,0.00,1.00,96.00,33.60 +-124.80,81.60,3.61,0.00,1.00,91.20,-38.40 +-96.00,81.60,3.59,0.00,1.00,86.40,38.40 +-67.20,81.60,3.57,0.00,1.00,81.60,-38.40 +-43.20,76.80,3.55,0.00,1.00,76.80,38.40 +-33.60,72.00,3.52,0.00,1.00,72.00,-33.60 +-24.00,72.00,3.50,0.00,1.00,67.20,33.60 +-19.20,67.20,3.48,0.00,1.00,62.40,-33.60 +-14.40,62.40,3.46,0.00,1.00,57.60,33.60 +-14.40,57.60,3.44,0.00,1.00,52.80,-28.80 +-9.60,52.80,3.42,0.00,1.00,48.00,28.80 +-9.60,48.00,3.40,0.00,1.00,43.20,-24.00 +-9.60,43.20,3.38,0.00,1.00,38.40,24.00 +-4.80,38.40,3.35,0.00,1.00,33.60,-24.00 +-4.80,33.60,3.33,0.00,1.00,28.80,19.20 +-4.80,28.80,3.31,0.00,1.00,24.00,-14.40 +-4.80,24.00,3.29,0.00,1.00,19.20,14.40 +-4.80,19.20,3.27,0.00,1.00,14.40,-9.60 +-0.00,14.40,3.25,0.00,1.00,9.60,9.60 +-0.00,9.60,3.23,0.00,1.00,4.80,-4.80 +-0.00,4.80,3.20,0.00,1.00,0.00,4.80 +0.00,0.00,3.18,0.00,1.00,-4.80,0.00 +0.00,-4.80,3.16,0.00,1.00,-9.60,4.80 +0.00,-9.60,3.14,0.00,1.00,-14.40,-4.80 +0.00,-14.40,3.12,0.00,1.00,-19.20,9.60 +0.00,-19.20,3.10,0.00,1.00,-24.00,-14.40 +0.00,-24.00,3.08,0.00,1.00,-28.80,14.40 +0.00,-28.80,3.05,0.00,1.00,-33.60,-19.20 +0.00,-33.60,3.03,0.00,1.00,-38.40,19.20 +4.80,-38.40,3.01,0.00,1.00,-43.20,-24.00 +4.80,-43.20,2.99,0.00,1.00,-48.00,28.80 +4.80,-48.00,2.97,0.00,1.00,-52.80,-28.80 +4.80,-52.80,2.95,0.00,1.00,-57.60,33.60 +4.80,-57.60,2.93,0.00,1.00,-62.40,-33.60 +4.80,-62.40,2.91,0.00,1.00,-67.20,33.60 +9.60,-67.20,2.88,0.00,1.00,-72.00,-38.40 +9.60,-72.00,2.86,0.00,1.00,-76.80,38.40 +14.40,-76.80,2.84,0.00,1.00,-81.60,-38.40 +24.00,-81.60,2.82,0.00,1.00,-86.40,43.20 +43.20,-86.40,2.80,0.00,1.00,-91.20,-43.20 +110.40,-86.40,2.78,0.00,1.00,-96.00,43.20 +148.80,-81.60,2.76,0.00,1.00,-100.80,-43.20 +163.20,-76.80,2.73,0.00,1.00,-105.60,38.40 +168.00,-72.00,2.71,0.00,1.00,-110.40,-38.40 +172.80,-67.20,2.69,0.00,1.00,-115.20,38.40 +172.80,-62.40,2.67,0.00,1.00,-120.00,-38.40 +172.80,-57.60,2.65,0.00,1.00,-124.80,33.60 +172.80,-52.80,2.63,0.00,1.00,-129.60,-33.60 +177.60,-48.00,2.61,0.00,1.00,-134.40,28.80 +177.60,-43.20,2.58,0.00,1.00,-139.20,-28.80 +177.60,-38.40,2.56,0.00,1.00,-144.00,24.00 +177.60,-33.60,2.54,0.00,1.00,-148.80,-24.00 +177.60,-28.80,2.52,0.00,1.00,-153.60,19.20 +177.60,-24.00,2.50,0.00,1.00,-158.40,-19.20 +177.60,-19.20,2.48,0.00,1.00,-163.20,14.40 +177.60,-14.40,2.46,0.00,1.00,-168.00,-9.60 +177.60,-9.60,2.44,0.00,1.00,-172.80,9.60 +177.60,-4.80,2.41,0.00,1.00,-177.60,-4.80 +177.60,-0.00,2.39,0.00,1.00,177.60,0.00 +-177.60,0.00,2.37,0.00,1.00,172.80,0.00 +-177.60,4.80,2.35,0.00,1.00,168.00,-4.80 +-177.60,9.60,2.33,0.00,1.00,163.20,9.60 +-177.60,14.40,2.31,0.00,1.00,158.40,-9.60 +-177.60,19.20,2.29,0.00,1.00,153.60,14.40 +-177.60,24.00,2.26,0.00,1.00,148.80,-19.20 +-177.60,28.80,2.24,0.00,1.00,144.00,19.20 +-177.60,33.60,2.22,0.00,1.00,139.20,-24.00 +-177.60,38.40,2.20,0.00,1.00,134.40,24.00 +-177.60,43.20,2.18,0.00,1.00,129.60,-28.80 +-177.60,48.00,2.16,0.00,1.00,124.80,28.80 +-172.80,52.80,2.14,0.00,1.00,120.00,-33.60 +-172.80,57.60,2.11,0.00,1.00,115.20,33.60 +-172.80,62.40,2.09,0.00,1.00,110.40,-38.40 +-172.80,67.20,2.07,0.00,1.00,105.60,38.40 +-168.00,72.00,2.05,0.00,1.00,100.80,-38.40 +-163.20,76.80,2.03,0.00,1.00,96.00,38.40 +-148.80,81.60,2.01,0.00,1.00,91.20,-43.20 +-110.40,86.40,1.99,0.00,1.00,86.40,43.20 +-43.20,86.40,1.97,0.00,1.00,81.60,-43.20 +-24.00,81.60,1.94,0.00,1.00,76.80,43.20 +-14.40,76.80,1.92,0.00,1.00,72.00,-38.40 +-9.60,72.00,1.90,0.00,1.00,67.20,38.40 +-9.60,67.20,1.88,0.00,1.00,62.40,-38.40 +-4.80,62.40,1.86,0.00,1.00,57.60,33.60 +-4.80,57.60,1.84,0.00,1.00,52.80,-33.60 +-4.80,52.80,1.82,0.00,1.00,48.00,33.60 +-4.80,48.00,1.79,0.00,1.00,43.20,-28.80 +-4.80,43.20,1.77,0.00,1.00,38.40,28.80 +-4.80,38.40,1.75,0.00,1.00,33.60,-24.00 +-0.00,33.60,1.73,0.00,1.00,28.80,19.20 +-0.00,28.80,1.71,0.00,1.00,24.00,-19.20 +-0.00,24.00,1.69,0.00,1.00,19.20,14.40 +-0.00,19.20,1.67,0.00,1.00,14.40,-14.40 +-0.00,14.40,1.64,0.00,1.00,9.60,9.60 +-0.00,9.60,1.62,0.00,1.00,4.80,-4.80 +-0.00,4.80,1.60,0.00,1.00,0.00,4.80 +-0.00,0.00,1.58,0.00,1.00,-4.80,0.00 +-0.00,-4.80,1.56,0.00,1.00,-9.60,4.80 +-0.00,-9.60,1.54,0.00,1.00,-14.40,-4.80 +-0.00,-14.40,1.52,0.00,1.00,-19.20,9.60 +-0.00,-19.20,1.50,0.00,1.00,-24.00,-14.40 +-0.00,-24.00,1.47,0.00,1.00,-28.80,19.20 +-0.00,-28.80,1.45,0.00,1.00,-33.60,-19.20 +-0.00,-33.60,1.43,0.00,1.00,-38.40,24.00 +-0.00,-38.40,1.41,0.00,1.00,-43.20,-28.80 +-0.00,-43.20,1.39,0.00,1.00,-48.00,28.80 +-0.00,-48.00,1.37,0.00,1.00,-52.80,-33.60 +-0.00,-52.80,1.35,0.00,1.00,-57.60,33.60 +-0.00,-57.60,1.32,0.00,1.00,-62.40,-38.40 +-0.00,-62.40,1.30,0.00,1.00,-67.20,38.40 +-4.80,-67.20,1.28,0.00,1.00,-72.00,-43.20 +-4.80,-72.00,1.26,0.00,1.00,-76.80,43.20 +-4.80,-76.80,1.24,0.00,1.00,-81.60,-43.20 +-9.60,-81.60,1.22,0.00,1.00,-86.40,43.20 +-19.20,-86.40,1.20,0.00,1.00,-91.20,-48.00 +-134.40,-86.40,1.17,0.00,1.00,-96.00,48.00 +-168.00,-81.60,1.15,0.00,1.00,-100.80,-48.00 +-172.80,-76.80,1.13,0.00,1.00,-105.60,43.20 +-177.60,-72.00,1.11,0.00,1.00,-110.40,-43.20 +-177.60,-67.20,1.09,0.00,1.00,-115.20,43.20 +-177.60,-62.40,1.07,0.00,1.00,-120.00,-38.40 +-177.60,-57.60,1.05,0.00,1.00,-124.80,38.40 +-177.60,-52.80,1.03,0.00,1.00,-129.60,-38.40 +-177.60,-48.00,1.00,0.00,1.00,-134.40,33.60 +-177.60,-43.20,0.98,0.00,1.00,-139.20,-28.80 +-177.60,-38.40,0.96,0.00,1.00,-144.00,28.80 +-177.60,-33.60,0.94,0.00,1.00,-148.80,-24.00 +-177.60,-28.80,0.92,0.00,1.00,-153.60,24.00 +-177.60,-24.00,0.90,0.00,1.00,-158.40,-19.20 +-177.60,-19.20,0.88,0.00,1.00,-163.20,14.40 +-177.60,-14.40,0.85,0.00,1.00,-168.00,-14.40 +-177.60,-9.60,0.83,0.00,1.00,-172.80,9.60 +-177.60,-4.80,0.81,0.00,1.00,-177.60,-4.80 +-177.60,-0.00,0.79,0.00,1.00,177.60,0.00 +177.60,0.00,0.77,0.00,1.00,172.80,0.00 +177.60,4.80,0.75,0.00,1.00,168.00,-4.80 +177.60,9.60,0.73,0.00,1.00,163.20,9.60 +177.60,14.40,0.70,0.00,1.00,158.40,-14.40 +177.60,19.20,0.68,0.00,1.00,153.60,14.40 +177.60,24.00,0.66,0.00,1.00,148.80,-19.20 +177.60,28.80,0.64,0.00,1.00,144.00,24.00 +177.60,33.60,0.62,0.00,1.00,139.20,-24.00 +177.60,38.40,0.60,0.00,1.00,134.40,28.80 +177.60,43.20,0.58,0.00,1.00,129.60,-28.80 +177.60,48.00,0.56,0.00,1.00,124.80,33.60 +177.60,52.80,0.53,0.00,1.00,120.00,-38.40 +177.60,57.60,0.51,0.00,1.00,115.20,38.40 +177.60,62.40,0.49,0.00,1.00,110.40,-38.40 +177.60,67.20,0.47,0.00,1.00,105.60,43.20 +177.60,72.00,0.45,0.00,1.00,100.80,-43.20 +172.80,76.80,0.43,0.00,1.00,96.00,43.20 +168.00,81.60,0.41,0.00,1.00,91.20,-48.00 +134.40,86.40,0.38,0.00,1.00,86.40,48.00 +19.20,86.40,0.36,0.00,1.00,81.60,-48.00 +9.60,81.60,0.34,0.00,1.00,76.80,43.20 +4.80,76.80,0.32,0.00,1.00,72.00,-43.20 +4.80,72.00,0.30,0.00,1.00,67.20,43.20 +4.80,67.20,0.28,0.00,1.00,62.40,-43.20 +0.00,62.40,0.26,0.00,1.00,57.60,38.40 +0.00,57.60,0.23,0.00,1.00,52.80,-38.40 +0.00,52.80,0.21,0.00,1.00,48.00,33.60 +0.00,48.00,0.19,0.00,1.00,43.20,-33.60 +0.00,43.20,0.17,0.00,1.00,38.40,28.80 +0.00,38.40,0.15,0.00,1.00,33.60,-28.80 +0.00,33.60,0.13,0.00,1.00,28.80,24.00 +0.00,28.80,0.11,0.00,1.00,24.00,-19.20 +0.00,24.00,0.09,0.00,1.00,19.20,19.20 +0.00,19.20,0.06,0.00,1.00,14.40,-14.40 +0.00,14.40,0.04,0.00,1.00,9.60,9.60 +0.00,9.60,0.02,0.00,1.00,4.80,-4.80 +0.00,4.80,0.00,0.00,1.00,0.00,4.80 diff --git a/scripts/testv/stvISM2.csv b/scripts/testv/stvISM2.csv index dcd3fee39c2a449df4d955626a7148aaecba3fab..35698d046f9653a7d051af70111c426ca461355d 100644 --- a/scripts/testv/stvISM2.csv +++ b/scripts/testv/stvISM2.csv @@ -1,1500 +1,1500 @@ -0.00,4.80,1.00,0.00,1.00 -0.00,9.60,1.00,0.00,1.00 -0.00,14.40,1.00,0.00,1.00 -0.00,19.20,1.00,0.00,1.00 -0.00,24.00,1.00,0.00,1.00 -0.00,28.80,1.00,0.00,1.00 -0.00,33.60,1.00,0.00,1.00 -0.00,38.40,1.00,0.00,1.00 -0.00,43.20,1.00,0.00,1.00 -0.00,48.00,1.00,0.00,1.00 -0.00,52.80,1.00,0.00,1.00 -0.00,57.60,1.00,0.00,1.00 -0.00,62.40,1.00,0.00,1.00 -4.80,67.20,1.00,0.00,1.00 -4.80,72.00,1.00,0.00,1.00 -4.80,76.80,1.00,0.00,1.00 -9.60,81.60,1.00,0.00,1.00 -19.20,86.40,1.00,0.00,1.00 -134.40,86.40,1.00,0.00,1.00 -168.00,81.60,1.00,0.00,1.00 -172.80,76.80,1.00,0.00,1.00 -177.60,72.00,1.00,0.00,1.00 -177.60,67.20,1.00,0.00,1.00 -177.60,62.40,1.00,0.00,1.00 -177.60,57.60,1.00,0.00,1.00 -177.60,52.80,1.00,0.00,1.00 -177.60,48.00,1.00,0.00,1.00 -177.60,43.20,1.00,0.00,1.00 -177.60,38.40,1.00,0.00,1.00 -177.60,33.60,1.00,0.00,1.00 -177.60,28.80,1.00,0.00,1.00 -177.60,24.00,1.00,0.00,1.00 -177.60,19.20,1.00,0.00,1.00 -177.60,14.40,1.00,0.00,1.00 -177.60,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --177.60,-9.60,1.00,0.00,1.00 --177.60,-14.40,1.00,0.00,1.00 --177.60,-19.20,1.00,0.00,1.00 --177.60,-24.00,1.00,0.00,1.00 --177.60,-28.80,1.00,0.00,1.00 --177.60,-33.60,1.00,0.00,1.00 --177.60,-38.40,1.00,0.00,1.00 --177.60,-43.20,1.00,0.00,1.00 --177.60,-48.00,1.00,0.00,1.00 --177.60,-52.80,1.00,0.00,1.00 --177.60,-57.60,1.00,0.00,1.00 --177.60,-62.40,1.00,0.00,1.00 --177.60,-67.20,1.00,0.00,1.00 --177.60,-72.00,1.00,0.00,1.00 --172.80,-76.80,1.00,0.00,1.00 --168.00,-81.60,1.00,0.00,1.00 --134.40,-86.40,1.00,0.00,1.00 --19.20,-86.40,1.00,0.00,1.00 --9.60,-81.60,1.00,0.00,1.00 --4.80,-76.80,1.00,0.00,1.00 --4.80,-72.00,1.00,0.00,1.00 --4.80,-67.20,1.00,0.00,1.00 --0.00,-62.40,1.00,0.00,1.00 --0.00,-57.60,1.00,0.00,1.00 --0.00,-52.80,1.00,0.00,1.00 --0.00,-48.00,1.00,0.00,1.00 --0.00,-43.20,1.00,0.00,1.00 --0.00,-38.40,1.00,0.00,1.00 --0.00,-33.60,1.00,0.00,1.00 --0.00,-28.80,1.00,0.00,1.00 --0.00,-24.00,1.00,0.00,1.00 --0.00,-19.20,1.00,0.00,1.00 --0.00,-14.40,1.00,0.00,1.00 --0.00,-9.60,1.00,0.00,1.00 --0.00,-4.80,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 --0.00,9.60,1.00,0.00,1.00 --0.00,14.40,1.00,0.00,1.00 --0.00,19.20,1.00,0.00,1.00 --0.00,24.00,1.00,0.00,1.00 --0.00,28.80,1.00,0.00,1.00 --0.00,33.60,1.00,0.00,1.00 --4.80,38.40,1.00,0.00,1.00 --4.80,43.20,1.00,0.00,1.00 --4.80,48.00,1.00,0.00,1.00 --4.80,52.80,1.00,0.00,1.00 --4.80,57.60,1.00,0.00,1.00 --4.80,62.40,1.00,0.00,1.00 --9.60,67.20,1.00,0.00,1.00 --9.60,72.00,1.00,0.00,1.00 --14.40,76.80,1.00,0.00,1.00 --24.00,81.60,1.00,0.00,1.00 --43.20,86.40,1.00,0.00,1.00 --110.40,86.40,1.00,0.00,1.00 --148.80,81.60,1.00,0.00,1.00 --163.20,76.80,1.00,0.00,1.00 --168.00,72.00,1.00,0.00,1.00 --172.80,67.20,1.00,0.00,1.00 --172.80,62.40,1.00,0.00,1.00 --172.80,57.60,1.00,0.00,1.00 --172.80,52.80,1.00,0.00,1.00 --177.60,48.00,1.00,0.00,1.00 --177.60,43.20,1.00,0.00,1.00 --177.60,38.40,1.00,0.00,1.00 --177.60,33.60,1.00,0.00,1.00 --177.60,28.80,1.00,0.00,1.00 --177.60,24.00,1.00,0.00,1.00 --177.60,19.20,1.00,0.00,1.00 --177.60,14.40,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -177.60,-14.40,1.00,0.00,1.00 -177.60,-19.20,1.00,0.00,1.00 -177.60,-24.00,1.00,0.00,1.00 -177.60,-28.80,1.00,0.00,1.00 -177.60,-33.60,1.00,0.00,1.00 -177.60,-38.40,1.00,0.00,1.00 -177.60,-43.20,1.00,0.00,1.00 -177.60,-48.00,1.00,0.00,1.00 -172.80,-52.80,1.00,0.00,1.00 -172.80,-57.60,1.00,0.00,1.00 -172.80,-62.40,1.00,0.00,1.00 -172.80,-67.20,1.00,0.00,1.00 -168.00,-72.00,1.00,0.00,1.00 -163.20,-76.80,1.00,0.00,1.00 -148.80,-81.60,1.00,0.00,1.00 -110.40,-86.40,1.00,0.00,1.00 -43.20,-86.40,1.00,0.00,1.00 -24.00,-81.60,1.00,0.00,1.00 -14.40,-76.80,1.00,0.00,1.00 -9.60,-72.00,1.00,0.00,1.00 -9.60,-67.20,1.00,0.00,1.00 -4.80,-62.40,1.00,0.00,1.00 -4.80,-57.60,1.00,0.00,1.00 -4.80,-52.80,1.00,0.00,1.00 -4.80,-48.00,1.00,0.00,1.00 -4.80,-43.20,1.00,0.00,1.00 -4.80,-38.40,1.00,0.00,1.00 -0.00,-33.60,1.00,0.00,1.00 -0.00,-28.80,1.00,0.00,1.00 -0.00,-24.00,1.00,0.00,1.00 -0.00,-19.20,1.00,0.00,1.00 -0.00,-14.40,1.00,0.00,1.00 -0.00,-9.60,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 --0.00,9.60,1.00,0.00,1.00 --0.00,14.40,1.00,0.00,1.00 --4.80,19.20,1.00,0.00,1.00 --4.80,24.00,1.00,0.00,1.00 --4.80,28.80,1.00,0.00,1.00 --4.80,33.60,1.00,0.00,1.00 --4.80,38.40,1.00,0.00,1.00 --9.60,43.20,1.00,0.00,1.00 --9.60,48.00,1.00,0.00,1.00 --9.60,52.80,1.00,0.00,1.00 --14.40,57.60,1.00,0.00,1.00 --14.40,62.40,1.00,0.00,1.00 --19.20,67.20,1.00,0.00,1.00 --24.00,72.00,1.00,0.00,1.00 --33.60,72.00,1.00,0.00,1.00 --43.20,76.80,1.00,0.00,1.00 --67.20,81.60,1.00,0.00,1.00 --96.00,81.60,1.00,0.00,1.00 --124.80,81.60,1.00,0.00,1.00 --144.00,76.80,1.00,0.00,1.00 --153.60,72.00,1.00,0.00,1.00 --158.40,67.20,1.00,0.00,1.00 --163.20,62.40,1.00,0.00,1.00 --168.00,57.60,1.00,0.00,1.00 --168.00,52.80,1.00,0.00,1.00 --168.00,48.00,1.00,0.00,1.00 --172.80,43.20,1.00,0.00,1.00 --172.80,38.40,1.00,0.00,1.00 --172.80,33.60,1.00,0.00,1.00 --172.80,28.80,1.00,0.00,1.00 --177.60,24.00,1.00,0.00,1.00 --177.60,19.20,1.00,0.00,1.00 --177.60,14.40,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -177.60,-14.40,1.00,0.00,1.00 -177.60,-19.20,1.00,0.00,1.00 -177.60,-24.00,1.00,0.00,1.00 -172.80,-28.80,1.00,0.00,1.00 -172.80,-33.60,1.00,0.00,1.00 -172.80,-38.40,1.00,0.00,1.00 -172.80,-43.20,1.00,0.00,1.00 -168.00,-48.00,1.00,0.00,1.00 -168.00,-52.80,1.00,0.00,1.00 -168.00,-57.60,1.00,0.00,1.00 -163.20,-62.40,1.00,0.00,1.00 -158.40,-67.20,1.00,0.00,1.00 -153.60,-72.00,1.00,0.00,1.00 -144.00,-76.80,1.00,0.00,1.00 -124.80,-81.60,1.00,0.00,1.00 -96.00,-81.60,1.00,0.00,1.00 -67.20,-81.60,1.00,0.00,1.00 -43.20,-76.80,1.00,0.00,1.00 -33.60,-72.00,1.00,0.00,1.00 -24.00,-72.00,1.00,0.00,1.00 -19.20,-67.20,1.00,0.00,1.00 -14.40,-62.40,1.00,0.00,1.00 -14.40,-57.60,1.00,0.00,1.00 -9.60,-52.80,1.00,0.00,1.00 -9.60,-48.00,1.00,0.00,1.00 -9.60,-43.20,1.00,0.00,1.00 -4.80,-38.40,1.00,0.00,1.00 -4.80,-33.60,1.00,0.00,1.00 -4.80,-28.80,1.00,0.00,1.00 -4.80,-24.00,1.00,0.00,1.00 -4.80,-19.20,1.00,0.00,1.00 -0.00,-14.40,1.00,0.00,1.00 -0.00,-9.60,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 --0.00,9.60,1.00,0.00,1.00 --4.80,14.40,1.00,0.00,1.00 --4.80,19.20,1.00,0.00,1.00 --4.80,24.00,1.00,0.00,1.00 --4.80,28.80,1.00,0.00,1.00 --9.60,33.60,1.00,0.00,1.00 --9.60,38.40,1.00,0.00,1.00 --14.40,43.20,1.00,0.00,1.00 --14.40,48.00,1.00,0.00,1.00 --14.40,52.80,1.00,0.00,1.00 --19.20,57.60,1.00,0.00,1.00 --24.00,57.60,1.00,0.00,1.00 --28.80,62.40,1.00,0.00,1.00 --33.60,67.20,1.00,0.00,1.00 --43.20,72.00,1.00,0.00,1.00 --57.60,72.00,1.00,0.00,1.00 --76.80,76.80,1.00,0.00,1.00 --96.00,76.80,1.00,0.00,1.00 --115.20,76.80,1.00,0.00,1.00 --129.60,72.00,1.00,0.00,1.00 --139.20,72.00,1.00,0.00,1.00 --148.80,67.20,1.00,0.00,1.00 --153.60,62.40,1.00,0.00,1.00 --158.40,57.60,1.00,0.00,1.00 --163.20,52.80,1.00,0.00,1.00 --163.20,48.00,1.00,0.00,1.00 --168.00,43.20,1.00,0.00,1.00 --168.00,38.40,1.00,0.00,1.00 --172.80,33.60,1.00,0.00,1.00 --172.80,28.80,1.00,0.00,1.00 --172.80,24.00,1.00,0.00,1.00 --172.80,19.20,1.00,0.00,1.00 --177.60,14.40,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -177.60,-14.40,1.00,0.00,1.00 -172.80,-19.20,1.00,0.00,1.00 -172.80,-24.00,1.00,0.00,1.00 -172.80,-28.80,1.00,0.00,1.00 -172.80,-33.60,1.00,0.00,1.00 -168.00,-38.40,1.00,0.00,1.00 -168.00,-43.20,1.00,0.00,1.00 -163.20,-48.00,1.00,0.00,1.00 -163.20,-52.80,1.00,0.00,1.00 -158.40,-57.60,1.00,0.00,1.00 -153.60,-62.40,1.00,0.00,1.00 -148.80,-67.20,1.00,0.00,1.00 -139.20,-72.00,1.00,0.00,1.00 -129.60,-72.00,1.00,0.00,1.00 -115.20,-76.80,1.00,0.00,1.00 -96.00,-76.80,1.00,0.00,1.00 -76.80,-76.80,1.00,0.00,1.00 -57.60,-72.00,1.00,0.00,1.00 -43.20,-72.00,1.00,0.00,1.00 -33.60,-67.20,1.00,0.00,1.00 -28.80,-62.40,1.00,0.00,1.00 -24.00,-57.60,1.00,0.00,1.00 -19.20,-57.60,1.00,0.00,1.00 -14.40,-52.80,1.00,0.00,1.00 -14.40,-48.00,1.00,0.00,1.00 -14.40,-43.20,1.00,0.00,1.00 -9.60,-38.40,1.00,0.00,1.00 -9.60,-33.60,1.00,0.00,1.00 -4.80,-28.80,1.00,0.00,1.00 -4.80,-24.00,1.00,0.00,1.00 -4.80,-19.20,1.00,0.00,1.00 -4.80,-14.40,1.00,0.00,1.00 -0.00,-9.60,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --4.80,14.40,1.00,0.00,1.00 --4.80,19.20,1.00,0.00,1.00 --9.60,24.00,1.00,0.00,1.00 --9.60,28.80,1.00,0.00,1.00 --9.60,33.60,1.00,0.00,1.00 --14.40,38.40,1.00,0.00,1.00 --14.40,38.40,1.00,0.00,1.00 --19.20,43.20,1.00,0.00,1.00 --24.00,48.00,1.00,0.00,1.00 --24.00,52.80,1.00,0.00,1.00 --28.80,57.60,1.00,0.00,1.00 --38.40,62.40,1.00,0.00,1.00 --43.20,62.40,1.00,0.00,1.00 --52.80,67.20,1.00,0.00,1.00 --62.40,72.00,1.00,0.00,1.00 --76.80,72.00,1.00,0.00,1.00 --96.00,72.00,1.00,0.00,1.00 --110.40,72.00,1.00,0.00,1.00 --120.00,67.20,1.00,0.00,1.00 --134.40,67.20,1.00,0.00,1.00 --139.20,62.40,1.00,0.00,1.00 --148.80,57.60,1.00,0.00,1.00 --153.60,57.60,1.00,0.00,1.00 --158.40,52.80,1.00,0.00,1.00 --158.40,48.00,1.00,0.00,1.00 --163.20,43.20,1.00,0.00,1.00 --163.20,38.40,1.00,0.00,1.00 --168.00,33.60,1.00,0.00,1.00 --168.00,28.80,1.00,0.00,1.00 --172.80,24.00,1.00,0.00,1.00 --172.80,19.20,1.00,0.00,1.00 --172.80,14.40,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -172.80,-14.40,1.00,0.00,1.00 -172.80,-19.20,1.00,0.00,1.00 -172.80,-24.00,1.00,0.00,1.00 -168.00,-28.80,1.00,0.00,1.00 -168.00,-33.60,1.00,0.00,1.00 -163.20,-38.40,1.00,0.00,1.00 -163.20,-43.20,1.00,0.00,1.00 -158.40,-48.00,1.00,0.00,1.00 -158.40,-52.80,1.00,0.00,1.00 -153.60,-57.60,1.00,0.00,1.00 -148.80,-57.60,1.00,0.00,1.00 -139.20,-62.40,1.00,0.00,1.00 -134.40,-67.20,1.00,0.00,1.00 -120.00,-67.20,1.00,0.00,1.00 -110.40,-72.00,1.00,0.00,1.00 -96.00,-72.00,1.00,0.00,1.00 -76.80,-72.00,1.00,0.00,1.00 -62.40,-72.00,1.00,0.00,1.00 -52.80,-67.20,1.00,0.00,1.00 -43.20,-62.40,1.00,0.00,1.00 -38.40,-62.40,1.00,0.00,1.00 -28.80,-57.60,1.00,0.00,1.00 -24.00,-52.80,1.00,0.00,1.00 -24.00,-48.00,1.00,0.00,1.00 -19.20,-43.20,1.00,0.00,1.00 -14.40,-38.40,1.00,0.00,1.00 -14.40,-38.40,1.00,0.00,1.00 -9.60,-33.60,1.00,0.00,1.00 -9.60,-28.80,1.00,0.00,1.00 -9.60,-24.00,1.00,0.00,1.00 -4.80,-19.20,1.00,0.00,1.00 -4.80,-14.40,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --4.80,14.40,1.00,0.00,1.00 --9.60,19.20,1.00,0.00,1.00 --9.60,24.00,1.00,0.00,1.00 --14.40,24.00,1.00,0.00,1.00 --14.40,28.80,1.00,0.00,1.00 --19.20,33.60,1.00,0.00,1.00 --19.20,38.40,1.00,0.00,1.00 --24.00,43.20,1.00,0.00,1.00 --28.80,48.00,1.00,0.00,1.00 --33.60,52.80,1.00,0.00,1.00 --38.40,52.80,1.00,0.00,1.00 --43.20,57.60,1.00,0.00,1.00 --48.00,62.40,1.00,0.00,1.00 --57.60,62.40,1.00,0.00,1.00 --67.20,67.20,1.00,0.00,1.00 --81.60,67.20,1.00,0.00,1.00 --91.20,67.20,1.00,0.00,1.00 --105.60,67.20,1.00,0.00,1.00 --115.20,67.20,1.00,0.00,1.00 --124.80,62.40,1.00,0.00,1.00 --134.40,57.60,1.00,0.00,1.00 --139.20,57.60,1.00,0.00,1.00 --144.00,52.80,1.00,0.00,1.00 --148.80,48.00,1.00,0.00,1.00 --153.60,43.20,1.00,0.00,1.00 --158.40,43.20,1.00,0.00,1.00 --163.20,38.40,1.00,0.00,1.00 --163.20,33.60,1.00,0.00,1.00 --168.00,28.80,1.00,0.00,1.00 --168.00,24.00,1.00,0.00,1.00 --172.80,19.20,1.00,0.00,1.00 --172.80,14.40,1.00,0.00,1.00 --177.60,9.60,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -177.60,-9.60,1.00,0.00,1.00 -172.80,-14.40,1.00,0.00,1.00 -172.80,-19.20,1.00,0.00,1.00 -168.00,-24.00,1.00,0.00,1.00 -168.00,-28.80,1.00,0.00,1.00 -163.20,-33.60,1.00,0.00,1.00 -163.20,-38.40,1.00,0.00,1.00 -158.40,-43.20,1.00,0.00,1.00 -153.60,-43.20,1.00,0.00,1.00 -148.80,-48.00,1.00,0.00,1.00 -144.00,-52.80,1.00,0.00,1.00 -139.20,-57.60,1.00,0.00,1.00 -134.40,-57.60,1.00,0.00,1.00 -124.80,-62.40,1.00,0.00,1.00 -115.20,-67.20,1.00,0.00,1.00 -105.60,-67.20,1.00,0.00,1.00 -91.20,-67.20,1.00,0.00,1.00 -81.60,-67.20,1.00,0.00,1.00 -67.20,-67.20,1.00,0.00,1.00 -57.60,-62.40,1.00,0.00,1.00 -48.00,-62.40,1.00,0.00,1.00 -43.20,-57.60,1.00,0.00,1.00 -38.40,-52.80,1.00,0.00,1.00 -33.60,-52.80,1.00,0.00,1.00 -28.80,-48.00,1.00,0.00,1.00 -24.00,-43.20,1.00,0.00,1.00 -19.20,-38.40,1.00,0.00,1.00 -19.20,-33.60,1.00,0.00,1.00 -14.40,-28.80,1.00,0.00,1.00 -14.40,-24.00,1.00,0.00,1.00 -9.60,-24.00,1.00,0.00,1.00 -9.60,-19.20,1.00,0.00,1.00 -4.80,-14.40,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --4.80,14.40,1.00,0.00,1.00 --9.60,19.20,1.00,0.00,1.00 --9.60,19.20,1.00,0.00,1.00 --14.40,24.00,1.00,0.00,1.00 --19.20,28.80,1.00,0.00,1.00 --19.20,33.60,1.00,0.00,1.00 --24.00,38.40,1.00,0.00,1.00 --28.80,43.20,1.00,0.00,1.00 --33.60,43.20,1.00,0.00,1.00 --38.40,48.00,1.00,0.00,1.00 --43.20,52.80,1.00,0.00,1.00 --48.00,52.80,1.00,0.00,1.00 --52.80,57.60,1.00,0.00,1.00 --62.40,57.60,1.00,0.00,1.00 --72.00,62.40,1.00,0.00,1.00 --81.60,62.40,1.00,0.00,1.00 --91.20,62.40,1.00,0.00,1.00 --100.80,62.40,1.00,0.00,1.00 --110.40,62.40,1.00,0.00,1.00 --120.00,57.60,1.00,0.00,1.00 --129.60,57.60,1.00,0.00,1.00 --134.40,52.80,1.00,0.00,1.00 --139.20,48.00,1.00,0.00,1.00 --144.00,48.00,1.00,0.00,1.00 --148.80,43.20,1.00,0.00,1.00 --153.60,38.40,1.00,0.00,1.00 --158.40,33.60,1.00,0.00,1.00 --163.20,33.60,1.00,0.00,1.00 --163.20,28.80,1.00,0.00,1.00 --168.00,24.00,1.00,0.00,1.00 --168.00,19.20,1.00,0.00,1.00 --172.80,14.40,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -172.80,-14.40,1.00,0.00,1.00 -168.00,-19.20,1.00,0.00,1.00 -168.00,-24.00,1.00,0.00,1.00 -163.20,-28.80,1.00,0.00,1.00 -163.20,-33.60,1.00,0.00,1.00 -158.40,-33.60,1.00,0.00,1.00 -153.60,-38.40,1.00,0.00,1.00 -148.80,-43.20,1.00,0.00,1.00 -144.00,-48.00,1.00,0.00,1.00 -139.20,-48.00,1.00,0.00,1.00 -134.40,-52.80,1.00,0.00,1.00 -129.60,-57.60,1.00,0.00,1.00 -120.00,-57.60,1.00,0.00,1.00 -110.40,-62.40,1.00,0.00,1.00 -100.80,-62.40,1.00,0.00,1.00 -91.20,-62.40,1.00,0.00,1.00 -81.60,-62.40,1.00,0.00,1.00 -72.00,-62.40,1.00,0.00,1.00 -62.40,-57.60,1.00,0.00,1.00 -52.80,-57.60,1.00,0.00,1.00 -48.00,-52.80,1.00,0.00,1.00 -43.20,-52.80,1.00,0.00,1.00 -38.40,-48.00,1.00,0.00,1.00 -33.60,-43.20,1.00,0.00,1.00 -28.80,-43.20,1.00,0.00,1.00 -24.00,-38.40,1.00,0.00,1.00 -19.20,-33.60,1.00,0.00,1.00 -19.20,-28.80,1.00,0.00,1.00 -14.40,-24.00,1.00,0.00,1.00 -9.60,-19.20,1.00,0.00,1.00 -9.60,-19.20,1.00,0.00,1.00 -4.80,-14.40,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --9.60,14.40,1.00,0.00,1.00 --9.60,14.40,1.00,0.00,1.00 --14.40,19.20,1.00,0.00,1.00 --14.40,24.00,1.00,0.00,1.00 --19.20,28.80,1.00,0.00,1.00 --24.00,33.60,1.00,0.00,1.00 --28.80,33.60,1.00,0.00,1.00 --28.80,38.40,1.00,0.00,1.00 --33.60,43.20,1.00,0.00,1.00 --38.40,43.20,1.00,0.00,1.00 --48.00,48.00,1.00,0.00,1.00 --52.80,52.80,1.00,0.00,1.00 --57.60,52.80,1.00,0.00,1.00 --67.20,57.60,1.00,0.00,1.00 --76.80,57.60,1.00,0.00,1.00 --81.60,57.60,1.00,0.00,1.00 --91.20,57.60,1.00,0.00,1.00 --100.80,57.60,1.00,0.00,1.00 --110.40,57.60,1.00,0.00,1.00 --115.20,52.80,1.00,0.00,1.00 --124.80,52.80,1.00,0.00,1.00 --129.60,48.00,1.00,0.00,1.00 --139.20,48.00,1.00,0.00,1.00 --144.00,43.20,1.00,0.00,1.00 --148.80,38.40,1.00,0.00,1.00 --153.60,38.40,1.00,0.00,1.00 --153.60,33.60,1.00,0.00,1.00 --158.40,28.80,1.00,0.00,1.00 --163.20,24.00,1.00,0.00,1.00 --163.20,24.00,1.00,0.00,1.00 --168.00,19.20,1.00,0.00,1.00 --172.80,14.40,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -172.80,-14.40,1.00,0.00,1.00 -168.00,-19.20,1.00,0.00,1.00 -163.20,-24.00,1.00,0.00,1.00 -163.20,-24.00,1.00,0.00,1.00 -158.40,-28.80,1.00,0.00,1.00 -153.60,-33.60,1.00,0.00,1.00 -153.60,-38.40,1.00,0.00,1.00 -148.80,-38.40,1.00,0.00,1.00 -144.00,-43.20,1.00,0.00,1.00 -139.20,-48.00,1.00,0.00,1.00 -129.60,-48.00,1.00,0.00,1.00 -124.80,-52.80,1.00,0.00,1.00 -115.20,-52.80,1.00,0.00,1.00 -110.40,-57.60,1.00,0.00,1.00 -100.80,-57.60,1.00,0.00,1.00 -91.20,-57.60,1.00,0.00,1.00 -81.60,-57.60,1.00,0.00,1.00 -76.80,-57.60,1.00,0.00,1.00 -67.20,-57.60,1.00,0.00,1.00 -57.60,-52.80,1.00,0.00,1.00 -52.80,-52.80,1.00,0.00,1.00 -48.00,-48.00,1.00,0.00,1.00 -38.40,-43.20,1.00,0.00,1.00 -33.60,-43.20,1.00,0.00,1.00 -28.80,-38.40,1.00,0.00,1.00 -28.80,-33.60,1.00,0.00,1.00 -24.00,-33.60,1.00,0.00,1.00 -19.20,-28.80,1.00,0.00,1.00 -14.40,-24.00,1.00,0.00,1.00 -14.40,-19.20,1.00,0.00,1.00 -9.60,-14.40,1.00,0.00,1.00 -9.60,-14.40,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --4.80,9.60,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 --9.60,14.40,1.00,0.00,1.00 --14.40,19.20,1.00,0.00,1.00 --19.20,24.00,1.00,0.00,1.00 --24.00,24.00,1.00,0.00,1.00 --24.00,28.80,1.00,0.00,1.00 --28.80,33.60,1.00,0.00,1.00 --33.60,38.40,1.00,0.00,1.00 --38.40,38.40,1.00,0.00,1.00 --43.20,43.20,1.00,0.00,1.00 --48.00,43.20,1.00,0.00,1.00 --52.80,48.00,1.00,0.00,1.00 --62.40,48.00,1.00,0.00,1.00 --67.20,52.80,1.00,0.00,1.00 --76.80,52.80,1.00,0.00,1.00 --86.40,52.80,1.00,0.00,1.00 --91.20,52.80,1.00,0.00,1.00 --100.80,52.80,1.00,0.00,1.00 --105.60,52.80,1.00,0.00,1.00 --115.20,48.00,1.00,0.00,1.00 --120.00,48.00,1.00,0.00,1.00 --129.60,48.00,1.00,0.00,1.00 --134.40,43.20,1.00,0.00,1.00 --139.20,43.20,1.00,0.00,1.00 --144.00,38.40,1.00,0.00,1.00 --148.80,33.60,1.00,0.00,1.00 --153.60,33.60,1.00,0.00,1.00 --158.40,28.80,1.00,0.00,1.00 --158.40,24.00,1.00,0.00,1.00 --163.20,19.20,1.00,0.00,1.00 --168.00,19.20,1.00,0.00,1.00 --168.00,14.40,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -177.60,-4.80,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -168.00,-14.40,1.00,0.00,1.00 -168.00,-19.20,1.00,0.00,1.00 -163.20,-19.20,1.00,0.00,1.00 -158.40,-24.00,1.00,0.00,1.00 -158.40,-28.80,1.00,0.00,1.00 -153.60,-33.60,1.00,0.00,1.00 -148.80,-33.60,1.00,0.00,1.00 -144.00,-38.40,1.00,0.00,1.00 -139.20,-43.20,1.00,0.00,1.00 -134.40,-43.20,1.00,0.00,1.00 -129.60,-48.00,1.00,0.00,1.00 -120.00,-48.00,1.00,0.00,1.00 -115.20,-48.00,1.00,0.00,1.00 -105.60,-52.80,1.00,0.00,1.00 -100.80,-52.80,1.00,0.00,1.00 -91.20,-52.80,1.00,0.00,1.00 -86.40,-52.80,1.00,0.00,1.00 -76.80,-52.80,1.00,0.00,1.00 -67.20,-52.80,1.00,0.00,1.00 -62.40,-48.00,1.00,0.00,1.00 -52.80,-48.00,1.00,0.00,1.00 -48.00,-43.20,1.00,0.00,1.00 -43.20,-43.20,1.00,0.00,1.00 -38.40,-38.40,1.00,0.00,1.00 -33.60,-38.40,1.00,0.00,1.00 -28.80,-33.60,1.00,0.00,1.00 -24.00,-28.80,1.00,0.00,1.00 -24.00,-24.00,1.00,0.00,1.00 -19.20,-24.00,1.00,0.00,1.00 -14.40,-19.20,1.00,0.00,1.00 -9.60,-14.40,1.00,0.00,1.00 -9.60,-9.60,1.00,0.00,1.00 -4.80,-9.60,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 --14.40,14.40,1.00,0.00,1.00 --14.40,19.20,1.00,0.00,1.00 --19.20,19.20,1.00,0.00,1.00 --24.00,24.00,1.00,0.00,1.00 --28.80,28.80,1.00,0.00,1.00 --33.60,28.80,1.00,0.00,1.00 --38.40,33.60,1.00,0.00,1.00 --43.20,38.40,1.00,0.00,1.00 --48.00,38.40,1.00,0.00,1.00 --52.80,43.20,1.00,0.00,1.00 --57.60,43.20,1.00,0.00,1.00 --62.40,43.20,1.00,0.00,1.00 --72.00,48.00,1.00,0.00,1.00 --76.80,48.00,1.00,0.00,1.00 --86.40,48.00,1.00,0.00,1.00 --91.20,48.00,1.00,0.00,1.00 --100.80,48.00,1.00,0.00,1.00 --105.60,48.00,1.00,0.00,1.00 --110.40,48.00,1.00,0.00,1.00 --120.00,43.20,1.00,0.00,1.00 --124.80,43.20,1.00,0.00,1.00 --129.60,38.40,1.00,0.00,1.00 --134.40,38.40,1.00,0.00,1.00 --139.20,33.60,1.00,0.00,1.00 --144.00,33.60,1.00,0.00,1.00 --148.80,28.80,1.00,0.00,1.00 --153.60,24.00,1.00,0.00,1.00 --158.40,24.00,1.00,0.00,1.00 --163.20,19.20,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 --168.00,14.40,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -168.00,-14.40,1.00,0.00,1.00 -163.20,-14.40,1.00,0.00,1.00 -163.20,-19.20,1.00,0.00,1.00 -158.40,-24.00,1.00,0.00,1.00 -153.60,-24.00,1.00,0.00,1.00 -148.80,-28.80,1.00,0.00,1.00 -144.00,-33.60,1.00,0.00,1.00 -139.20,-33.60,1.00,0.00,1.00 -134.40,-38.40,1.00,0.00,1.00 -129.60,-38.40,1.00,0.00,1.00 -124.80,-43.20,1.00,0.00,1.00 -120.00,-43.20,1.00,0.00,1.00 -110.40,-48.00,1.00,0.00,1.00 -105.60,-48.00,1.00,0.00,1.00 -100.80,-48.00,1.00,0.00,1.00 -91.20,-48.00,1.00,0.00,1.00 -86.40,-48.00,1.00,0.00,1.00 -76.80,-48.00,1.00,0.00,1.00 -72.00,-48.00,1.00,0.00,1.00 -62.40,-43.20,1.00,0.00,1.00 -57.60,-43.20,1.00,0.00,1.00 -52.80,-43.20,1.00,0.00,1.00 -48.00,-38.40,1.00,0.00,1.00 -43.20,-38.40,1.00,0.00,1.00 -38.40,-33.60,1.00,0.00,1.00 -33.60,-28.80,1.00,0.00,1.00 -28.80,-28.80,1.00,0.00,1.00 -24.00,-24.00,1.00,0.00,1.00 -19.20,-19.20,1.00,0.00,1.00 -14.40,-19.20,1.00,0.00,1.00 -14.40,-14.40,1.00,0.00,1.00 -9.60,-9.60,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 --14.40,14.40,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 --24.00,19.20,1.00,0.00,1.00 --24.00,24.00,1.00,0.00,1.00 --28.80,24.00,1.00,0.00,1.00 --33.60,28.80,1.00,0.00,1.00 --38.40,28.80,1.00,0.00,1.00 --43.20,33.60,1.00,0.00,1.00 --48.00,33.60,1.00,0.00,1.00 --52.80,38.40,1.00,0.00,1.00 --62.40,38.40,1.00,0.00,1.00 --67.20,38.40,1.00,0.00,1.00 --72.00,43.20,1.00,0.00,1.00 --76.80,43.20,1.00,0.00,1.00 --86.40,43.20,1.00,0.00,1.00 --91.20,43.20,1.00,0.00,1.00 --96.00,43.20,1.00,0.00,1.00 --105.60,43.20,1.00,0.00,1.00 --110.40,43.20,1.00,0.00,1.00 --115.20,38.40,1.00,0.00,1.00 --124.80,38.40,1.00,0.00,1.00 --129.60,38.40,1.00,0.00,1.00 --134.40,33.60,1.00,0.00,1.00 --139.20,33.60,1.00,0.00,1.00 --144.00,28.80,1.00,0.00,1.00 --148.80,28.80,1.00,0.00,1.00 --153.60,24.00,1.00,0.00,1.00 --158.40,19.20,1.00,0.00,1.00 --158.40,19.20,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -168.00,-9.60,1.00,0.00,1.00 -163.20,-14.40,1.00,0.00,1.00 -158.40,-19.20,1.00,0.00,1.00 -158.40,-19.20,1.00,0.00,1.00 -153.60,-24.00,1.00,0.00,1.00 -148.80,-28.80,1.00,0.00,1.00 -144.00,-28.80,1.00,0.00,1.00 -139.20,-33.60,1.00,0.00,1.00 -134.40,-33.60,1.00,0.00,1.00 -129.60,-38.40,1.00,0.00,1.00 -124.80,-38.40,1.00,0.00,1.00 -115.20,-38.40,1.00,0.00,1.00 -110.40,-43.20,1.00,0.00,1.00 -105.60,-43.20,1.00,0.00,1.00 -96.00,-43.20,1.00,0.00,1.00 -91.20,-43.20,1.00,0.00,1.00 -86.40,-43.20,1.00,0.00,1.00 -76.80,-43.20,1.00,0.00,1.00 -72.00,-43.20,1.00,0.00,1.00 -67.20,-38.40,1.00,0.00,1.00 -62.40,-38.40,1.00,0.00,1.00 -52.80,-38.40,1.00,0.00,1.00 -48.00,-33.60,1.00,0.00,1.00 -43.20,-33.60,1.00,0.00,1.00 -38.40,-28.80,1.00,0.00,1.00 -33.60,-28.80,1.00,0.00,1.00 -28.80,-24.00,1.00,0.00,1.00 -24.00,-24.00,1.00,0.00,1.00 -24.00,-19.20,1.00,0.00,1.00 -19.20,-14.40,1.00,0.00,1.00 -14.40,-14.40,1.00,0.00,1.00 -9.60,-9.60,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 --14.40,9.60,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 --24.00,19.20,1.00,0.00,1.00 --28.80,19.20,1.00,0.00,1.00 --33.60,24.00,1.00,0.00,1.00 --38.40,24.00,1.00,0.00,1.00 --43.20,28.80,1.00,0.00,1.00 --48.00,28.80,1.00,0.00,1.00 --52.80,33.60,1.00,0.00,1.00 --57.60,33.60,1.00,0.00,1.00 --62.40,33.60,1.00,0.00,1.00 --67.20,38.40,1.00,0.00,1.00 --72.00,38.40,1.00,0.00,1.00 --81.60,38.40,1.00,0.00,1.00 --86.40,38.40,1.00,0.00,1.00 --91.20,38.40,1.00,0.00,1.00 --96.00,38.40,1.00,0.00,1.00 --105.60,38.40,1.00,0.00,1.00 --110.40,38.40,1.00,0.00,1.00 --115.20,33.60,1.00,0.00,1.00 --120.00,33.60,1.00,0.00,1.00 --124.80,33.60,1.00,0.00,1.00 --129.60,28.80,1.00,0.00,1.00 --134.40,28.80,1.00,0.00,1.00 --139.20,24.00,1.00,0.00,1.00 --144.00,24.00,1.00,0.00,1.00 --148.80,19.20,1.00,0.00,1.00 --153.60,19.20,1.00,0.00,1.00 --158.40,14.40,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -172.80,-9.60,1.00,0.00,1.00 -168.00,-9.60,1.00,0.00,1.00 -163.20,-14.40,1.00,0.00,1.00 -158.40,-14.40,1.00,0.00,1.00 -153.60,-19.20,1.00,0.00,1.00 -148.80,-19.20,1.00,0.00,1.00 -144.00,-24.00,1.00,0.00,1.00 -139.20,-24.00,1.00,0.00,1.00 -134.40,-28.80,1.00,0.00,1.00 -129.60,-28.80,1.00,0.00,1.00 -124.80,-33.60,1.00,0.00,1.00 -120.00,-33.60,1.00,0.00,1.00 -115.20,-33.60,1.00,0.00,1.00 -110.40,-38.40,1.00,0.00,1.00 -105.60,-38.40,1.00,0.00,1.00 -96.00,-38.40,1.00,0.00,1.00 -91.20,-38.40,1.00,0.00,1.00 -86.40,-38.40,1.00,0.00,1.00 -81.60,-38.40,1.00,0.00,1.00 -72.00,-38.40,1.00,0.00,1.00 -67.20,-38.40,1.00,0.00,1.00 -62.40,-33.60,1.00,0.00,1.00 -57.60,-33.60,1.00,0.00,1.00 -52.80,-33.60,1.00,0.00,1.00 -48.00,-28.80,1.00,0.00,1.00 -43.20,-28.80,1.00,0.00,1.00 -38.40,-24.00,1.00,0.00,1.00 -33.60,-24.00,1.00,0.00,1.00 -28.80,-19.20,1.00,0.00,1.00 -24.00,-19.20,1.00,0.00,1.00 -19.20,-14.40,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 -9.60,-9.60,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --14.40,9.60,1.00,0.00,1.00 --14.40,9.60,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 --24.00,14.40,1.00,0.00,1.00 --28.80,19.20,1.00,0.00,1.00 --33.60,19.20,1.00,0.00,1.00 --38.40,24.00,1.00,0.00,1.00 --43.20,24.00,1.00,0.00,1.00 --48.00,24.00,1.00,0.00,1.00 --52.80,28.80,1.00,0.00,1.00 --57.60,28.80,1.00,0.00,1.00 --62.40,28.80,1.00,0.00,1.00 --67.20,33.60,1.00,0.00,1.00 --72.00,33.60,1.00,0.00,1.00 --81.60,33.60,1.00,0.00,1.00 --86.40,33.60,1.00,0.00,1.00 --91.20,33.60,1.00,0.00,1.00 --96.00,33.60,1.00,0.00,1.00 --100.80,33.60,1.00,0.00,1.00 --110.40,33.60,1.00,0.00,1.00 --115.20,33.60,1.00,0.00,1.00 --120.00,28.80,1.00,0.00,1.00 --124.80,28.80,1.00,0.00,1.00 --129.60,28.80,1.00,0.00,1.00 --134.40,24.00,1.00,0.00,1.00 --139.20,24.00,1.00,0.00,1.00 --144.00,19.20,1.00,0.00,1.00 --148.80,19.20,1.00,0.00,1.00 --153.60,14.40,1.00,0.00,1.00 --158.40,14.40,1.00,0.00,1.00 --163.20,9.60,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -168.00,-9.60,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 -158.40,-14.40,1.00,0.00,1.00 -153.60,-14.40,1.00,0.00,1.00 -148.80,-19.20,1.00,0.00,1.00 -144.00,-19.20,1.00,0.00,1.00 -139.20,-24.00,1.00,0.00,1.00 -134.40,-24.00,1.00,0.00,1.00 -129.60,-28.80,1.00,0.00,1.00 -124.80,-28.80,1.00,0.00,1.00 -120.00,-28.80,1.00,0.00,1.00 -115.20,-33.60,1.00,0.00,1.00 -110.40,-33.60,1.00,0.00,1.00 -100.80,-33.60,1.00,0.00,1.00 -96.00,-33.60,1.00,0.00,1.00 -91.20,-33.60,1.00,0.00,1.00 -86.40,-33.60,1.00,0.00,1.00 -81.60,-33.60,1.00,0.00,1.00 -72.00,-33.60,1.00,0.00,1.00 -67.20,-33.60,1.00,0.00,1.00 -62.40,-28.80,1.00,0.00,1.00 -57.60,-28.80,1.00,0.00,1.00 -52.80,-28.80,1.00,0.00,1.00 -48.00,-24.00,1.00,0.00,1.00 -43.20,-24.00,1.00,0.00,1.00 -38.40,-24.00,1.00,0.00,1.00 -33.60,-19.20,1.00,0.00,1.00 -28.80,-19.20,1.00,0.00,1.00 -24.00,-14.40,1.00,0.00,1.00 -19.20,-14.40,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 --19.20,9.60,1.00,0.00,1.00 --19.20,9.60,1.00,0.00,1.00 --24.00,14.40,1.00,0.00,1.00 --28.80,14.40,1.00,0.00,1.00 --33.60,19.20,1.00,0.00,1.00 --38.40,19.20,1.00,0.00,1.00 --43.20,19.20,1.00,0.00,1.00 --48.00,24.00,1.00,0.00,1.00 --52.80,24.00,1.00,0.00,1.00 --57.60,24.00,1.00,0.00,1.00 --62.40,24.00,1.00,0.00,1.00 --72.00,28.80,1.00,0.00,1.00 --76.80,28.80,1.00,0.00,1.00 --81.60,28.80,1.00,0.00,1.00 --86.40,28.80,1.00,0.00,1.00 --91.20,28.80,1.00,0.00,1.00 --96.00,28.80,1.00,0.00,1.00 --100.80,28.80,1.00,0.00,1.00 --105.60,28.80,1.00,0.00,1.00 --115.20,28.80,1.00,0.00,1.00 --120.00,24.00,1.00,0.00,1.00 --124.80,24.00,1.00,0.00,1.00 --129.60,24.00,1.00,0.00,1.00 --134.40,24.00,1.00,0.00,1.00 --139.20,19.20,1.00,0.00,1.00 --144.00,19.20,1.00,0.00,1.00 --148.80,14.40,1.00,0.00,1.00 --153.60,14.40,1.00,0.00,1.00 --158.40,14.40,1.00,0.00,1.00 --163.20,9.60,1.00,0.00,1.00 --163.20,9.60,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 -158.40,-14.40,1.00,0.00,1.00 -153.60,-14.40,1.00,0.00,1.00 -148.80,-14.40,1.00,0.00,1.00 -144.00,-19.20,1.00,0.00,1.00 -139.20,-19.20,1.00,0.00,1.00 -134.40,-24.00,1.00,0.00,1.00 -129.60,-24.00,1.00,0.00,1.00 -124.80,-24.00,1.00,0.00,1.00 -120.00,-24.00,1.00,0.00,1.00 -115.20,-28.80,1.00,0.00,1.00 -105.60,-28.80,1.00,0.00,1.00 -100.80,-28.80,1.00,0.00,1.00 -96.00,-28.80,1.00,0.00,1.00 -91.20,-28.80,1.00,0.00,1.00 -86.40,-28.80,1.00,0.00,1.00 -81.60,-28.80,1.00,0.00,1.00 -76.80,-28.80,1.00,0.00,1.00 -72.00,-28.80,1.00,0.00,1.00 -62.40,-24.00,1.00,0.00,1.00 -57.60,-24.00,1.00,0.00,1.00 -52.80,-24.00,1.00,0.00,1.00 -48.00,-24.00,1.00,0.00,1.00 -43.20,-19.20,1.00,0.00,1.00 -38.40,-19.20,1.00,0.00,1.00 -33.60,-19.20,1.00,0.00,1.00 -28.80,-14.40,1.00,0.00,1.00 -24.00,-14.40,1.00,0.00,1.00 -19.20,-9.60,1.00,0.00,1.00 -19.20,-9.60,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 --19.20,9.60,1.00,0.00,1.00 --24.00,9.60,1.00,0.00,1.00 --28.80,9.60,1.00,0.00,1.00 --33.60,14.40,1.00,0.00,1.00 --33.60,14.40,1.00,0.00,1.00 --38.40,14.40,1.00,0.00,1.00 --43.20,19.20,1.00,0.00,1.00 --48.00,19.20,1.00,0.00,1.00 --57.60,19.20,1.00,0.00,1.00 --62.40,19.20,1.00,0.00,1.00 --67.20,24.00,1.00,0.00,1.00 --72.00,24.00,1.00,0.00,1.00 --76.80,24.00,1.00,0.00,1.00 --81.60,24.00,1.00,0.00,1.00 --86.40,24.00,1.00,0.00,1.00 --91.20,24.00,1.00,0.00,1.00 --96.00,24.00,1.00,0.00,1.00 --100.80,24.00,1.00,0.00,1.00 --105.60,24.00,1.00,0.00,1.00 --110.40,24.00,1.00,0.00,1.00 --115.20,19.20,1.00,0.00,1.00 --120.00,19.20,1.00,0.00,1.00 --129.60,19.20,1.00,0.00,1.00 --134.40,19.20,1.00,0.00,1.00 --139.20,19.20,1.00,0.00,1.00 --144.00,14.40,1.00,0.00,1.00 --148.80,14.40,1.00,0.00,1.00 --148.80,14.40,1.00,0.00,1.00 --153.60,9.60,1.00,0.00,1.00 --158.40,9.60,1.00,0.00,1.00 --163.20,4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --172.80,4.80,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 -158.40,-9.60,1.00,0.00,1.00 -153.60,-9.60,1.00,0.00,1.00 -148.80,-14.40,1.00,0.00,1.00 -148.80,-14.40,1.00,0.00,1.00 -144.00,-14.40,1.00,0.00,1.00 -139.20,-19.20,1.00,0.00,1.00 -134.40,-19.20,1.00,0.00,1.00 -129.60,-19.20,1.00,0.00,1.00 -120.00,-19.20,1.00,0.00,1.00 -115.20,-19.20,1.00,0.00,1.00 -110.40,-24.00,1.00,0.00,1.00 -105.60,-24.00,1.00,0.00,1.00 -100.80,-24.00,1.00,0.00,1.00 -96.00,-24.00,1.00,0.00,1.00 -91.20,-24.00,1.00,0.00,1.00 -86.40,-24.00,1.00,0.00,1.00 -81.60,-24.00,1.00,0.00,1.00 -76.80,-24.00,1.00,0.00,1.00 -72.00,-24.00,1.00,0.00,1.00 -67.20,-24.00,1.00,0.00,1.00 -62.40,-19.20,1.00,0.00,1.00 -57.60,-19.20,1.00,0.00,1.00 -48.00,-19.20,1.00,0.00,1.00 -43.20,-19.20,1.00,0.00,1.00 -38.40,-14.40,1.00,0.00,1.00 -33.60,-14.40,1.00,0.00,1.00 -33.60,-14.40,1.00,0.00,1.00 -28.80,-9.60,1.00,0.00,1.00 -24.00,-9.60,1.00,0.00,1.00 -19.20,-9.60,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 --19.20,4.80,1.00,0.00,1.00 --24.00,9.60,1.00,0.00,1.00 --28.80,9.60,1.00,0.00,1.00 --33.60,9.60,1.00,0.00,1.00 --38.40,9.60,1.00,0.00,1.00 --43.20,14.40,1.00,0.00,1.00 --48.00,14.40,1.00,0.00,1.00 --52.80,14.40,1.00,0.00,1.00 --57.60,14.40,1.00,0.00,1.00 --62.40,19.20,1.00,0.00,1.00 --67.20,19.20,1.00,0.00,1.00 --72.00,19.20,1.00,0.00,1.00 --76.80,19.20,1.00,0.00,1.00 --81.60,19.20,1.00,0.00,1.00 --86.40,19.20,1.00,0.00,1.00 --91.20,19.20,1.00,0.00,1.00 --96.00,19.20,1.00,0.00,1.00 --100.80,19.20,1.00,0.00,1.00 --105.60,19.20,1.00,0.00,1.00 --110.40,19.20,1.00,0.00,1.00 --115.20,19.20,1.00,0.00,1.00 --120.00,14.40,1.00,0.00,1.00 --124.80,14.40,1.00,0.00,1.00 --129.60,14.40,1.00,0.00,1.00 --134.40,14.40,1.00,0.00,1.00 --139.20,14.40,1.00,0.00,1.00 --144.00,9.60,1.00,0.00,1.00 --148.80,9.60,1.00,0.00,1.00 --153.60,9.60,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 --163.20,4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 -158.40,-4.80,1.00,0.00,1.00 -153.60,-9.60,1.00,0.00,1.00 -148.80,-9.60,1.00,0.00,1.00 -144.00,-9.60,1.00,0.00,1.00 -139.20,-14.40,1.00,0.00,1.00 -134.40,-14.40,1.00,0.00,1.00 -129.60,-14.40,1.00,0.00,1.00 -124.80,-14.40,1.00,0.00,1.00 -120.00,-14.40,1.00,0.00,1.00 -115.20,-19.20,1.00,0.00,1.00 -110.40,-19.20,1.00,0.00,1.00 -105.60,-19.20,1.00,0.00,1.00 -100.80,-19.20,1.00,0.00,1.00 -96.00,-19.20,1.00,0.00,1.00 -91.20,-19.20,1.00,0.00,1.00 -86.40,-19.20,1.00,0.00,1.00 -81.60,-19.20,1.00,0.00,1.00 -76.80,-19.20,1.00,0.00,1.00 -72.00,-19.20,1.00,0.00,1.00 -67.20,-19.20,1.00,0.00,1.00 -62.40,-19.20,1.00,0.00,1.00 -57.60,-14.40,1.00,0.00,1.00 -52.80,-14.40,1.00,0.00,1.00 -48.00,-14.40,1.00,0.00,1.00 -43.20,-14.40,1.00,0.00,1.00 -38.40,-9.60,1.00,0.00,1.00 -33.60,-9.60,1.00,0.00,1.00 -28.80,-9.60,1.00,0.00,1.00 -24.00,-9.60,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 --19.20,4.80,1.00,0.00,1.00 --24.00,4.80,1.00,0.00,1.00 --28.80,4.80,1.00,0.00,1.00 --33.60,9.60,1.00,0.00,1.00 --38.40,9.60,1.00,0.00,1.00 --43.20,9.60,1.00,0.00,1.00 --48.00,9.60,1.00,0.00,1.00 --52.80,9.60,1.00,0.00,1.00 --57.60,14.40,1.00,0.00,1.00 --62.40,14.40,1.00,0.00,1.00 --67.20,14.40,1.00,0.00,1.00 --72.00,14.40,1.00,0.00,1.00 --76.80,14.40,1.00,0.00,1.00 --81.60,14.40,1.00,0.00,1.00 --86.40,14.40,1.00,0.00,1.00 --91.20,14.40,1.00,0.00,1.00 --96.00,14.40,1.00,0.00,1.00 --100.80,14.40,1.00,0.00,1.00 --105.60,14.40,1.00,0.00,1.00 --110.40,14.40,1.00,0.00,1.00 --115.20,14.40,1.00,0.00,1.00 --120.00,14.40,1.00,0.00,1.00 --124.80,9.60,1.00,0.00,1.00 --129.60,9.60,1.00,0.00,1.00 --134.40,9.60,1.00,0.00,1.00 --139.20,9.60,1.00,0.00,1.00 --144.00,9.60,1.00,0.00,1.00 --148.80,9.60,1.00,0.00,1.00 --153.60,4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 --163.20,4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 -168.00,-4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 -158.40,-4.80,1.00,0.00,1.00 -153.60,-4.80,1.00,0.00,1.00 -148.80,-9.60,1.00,0.00,1.00 -144.00,-9.60,1.00,0.00,1.00 -139.20,-9.60,1.00,0.00,1.00 -134.40,-9.60,1.00,0.00,1.00 -129.60,-9.60,1.00,0.00,1.00 -124.80,-9.60,1.00,0.00,1.00 -120.00,-14.40,1.00,0.00,1.00 -115.20,-14.40,1.00,0.00,1.00 -110.40,-14.40,1.00,0.00,1.00 -105.60,-14.40,1.00,0.00,1.00 -100.80,-14.40,1.00,0.00,1.00 -96.00,-14.40,1.00,0.00,1.00 -91.20,-14.40,1.00,0.00,1.00 -86.40,-14.40,1.00,0.00,1.00 -81.60,-14.40,1.00,0.00,1.00 -76.80,-14.40,1.00,0.00,1.00 -72.00,-14.40,1.00,0.00,1.00 -67.20,-14.40,1.00,0.00,1.00 -62.40,-14.40,1.00,0.00,1.00 -57.60,-14.40,1.00,0.00,1.00 -52.80,-9.60,1.00,0.00,1.00 -48.00,-9.60,1.00,0.00,1.00 -43.20,-9.60,1.00,0.00,1.00 -38.40,-9.60,1.00,0.00,1.00 -33.60,-9.60,1.00,0.00,1.00 -28.80,-4.80,1.00,0.00,1.00 -24.00,-4.80,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 --14.40,0.00,1.00,0.00,1.00 --19.20,4.80,1.00,0.00,1.00 --24.00,4.80,1.00,0.00,1.00 --28.80,4.80,1.00,0.00,1.00 --33.60,4.80,1.00,0.00,1.00 --38.40,4.80,1.00,0.00,1.00 --43.20,4.80,1.00,0.00,1.00 --48.00,4.80,1.00,0.00,1.00 --52.80,9.60,1.00,0.00,1.00 --57.60,9.60,1.00,0.00,1.00 --62.40,9.60,1.00,0.00,1.00 --67.20,9.60,1.00,0.00,1.00 --72.00,9.60,1.00,0.00,1.00 --76.80,9.60,1.00,0.00,1.00 --81.60,9.60,1.00,0.00,1.00 --86.40,9.60,1.00,0.00,1.00 --91.20,9.60,1.00,0.00,1.00 --96.00,9.60,1.00,0.00,1.00 --100.80,9.60,1.00,0.00,1.00 --105.60,9.60,1.00,0.00,1.00 --110.40,9.60,1.00,0.00,1.00 --115.20,9.60,1.00,0.00,1.00 --120.00,9.60,1.00,0.00,1.00 --124.80,9.60,1.00,0.00,1.00 --129.60,9.60,1.00,0.00,1.00 --134.40,4.80,1.00,0.00,1.00 --139.20,4.80,1.00,0.00,1.00 --144.00,4.80,1.00,0.00,1.00 --148.80,4.80,1.00,0.00,1.00 --153.60,4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 --163.20,4.80,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 -168.00,-0.00,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 -158.40,-4.80,1.00,0.00,1.00 -153.60,-4.80,1.00,0.00,1.00 -148.80,-4.80,1.00,0.00,1.00 -144.00,-4.80,1.00,0.00,1.00 -139.20,-4.80,1.00,0.00,1.00 -134.40,-4.80,1.00,0.00,1.00 -129.60,-9.60,1.00,0.00,1.00 -124.80,-9.60,1.00,0.00,1.00 -120.00,-9.60,1.00,0.00,1.00 -115.20,-9.60,1.00,0.00,1.00 -110.40,-9.60,1.00,0.00,1.00 -105.60,-9.60,1.00,0.00,1.00 -100.80,-9.60,1.00,0.00,1.00 -96.00,-9.60,1.00,0.00,1.00 -91.20,-9.60,1.00,0.00,1.00 -86.40,-9.60,1.00,0.00,1.00 -81.60,-9.60,1.00,0.00,1.00 -76.80,-9.60,1.00,0.00,1.00 -72.00,-9.60,1.00,0.00,1.00 -67.20,-9.60,1.00,0.00,1.00 -62.40,-9.60,1.00,0.00,1.00 -57.60,-9.60,1.00,0.00,1.00 -52.80,-9.60,1.00,0.00,1.00 -48.00,-4.80,1.00,0.00,1.00 -43.20,-4.80,1.00,0.00,1.00 -38.40,-4.80,1.00,0.00,1.00 -33.60,-4.80,1.00,0.00,1.00 -28.80,-4.80,1.00,0.00,1.00 -24.00,-4.80,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 -14.40,-0.00,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 --14.40,0.00,1.00,0.00,1.00 --19.20,0.00,1.00,0.00,1.00 --24.00,0.00,1.00,0.00,1.00 --28.80,0.00,1.00,0.00,1.00 --33.60,4.80,1.00,0.00,1.00 --38.40,4.80,1.00,0.00,1.00 --43.20,4.80,1.00,0.00,1.00 --48.00,4.80,1.00,0.00,1.00 --52.80,4.80,1.00,0.00,1.00 --57.60,4.80,1.00,0.00,1.00 --62.40,4.80,1.00,0.00,1.00 --67.20,4.80,1.00,0.00,1.00 --72.00,4.80,1.00,0.00,1.00 --76.80,4.80,1.00,0.00,1.00 --81.60,4.80,1.00,0.00,1.00 --86.40,4.80,1.00,0.00,1.00 --91.20,4.80,1.00,0.00,1.00 --96.00,4.80,1.00,0.00,1.00 --100.80,4.80,1.00,0.00,1.00 --105.60,4.80,1.00,0.00,1.00 --110.40,4.80,1.00,0.00,1.00 --115.20,4.80,1.00,0.00,1.00 --120.00,4.80,1.00,0.00,1.00 --124.80,4.80,1.00,0.00,1.00 --129.60,4.80,1.00,0.00,1.00 --134.40,4.80,1.00,0.00,1.00 --139.20,4.80,1.00,0.00,1.00 --144.00,4.80,1.00,0.00,1.00 --148.80,4.80,1.00,0.00,1.00 --153.60,0.00,1.00,0.00,1.00 --158.40,0.00,1.00,0.00,1.00 --163.20,0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 -168.00,-0.00,1.00,0.00,1.00 -163.20,-0.00,1.00,0.00,1.00 -158.40,-0.00,1.00,0.00,1.00 -153.60,-0.00,1.00,0.00,1.00 -148.80,-4.80,1.00,0.00,1.00 -144.00,-4.80,1.00,0.00,1.00 -139.20,-4.80,1.00,0.00,1.00 -134.40,-4.80,1.00,0.00,1.00 -129.60,-4.80,1.00,0.00,1.00 -124.80,-4.80,1.00,0.00,1.00 -120.00,-4.80,1.00,0.00,1.00 -115.20,-4.80,1.00,0.00,1.00 -110.40,-4.80,1.00,0.00,1.00 -105.60,-4.80,1.00,0.00,1.00 -100.80,-4.80,1.00,0.00,1.00 -96.00,-4.80,1.00,0.00,1.00 -91.20,-4.80,1.00,0.00,1.00 -86.40,-4.80,1.00,0.00,1.00 -81.60,-4.80,1.00,0.00,1.00 -76.80,-4.80,1.00,0.00,1.00 -72.00,-4.80,1.00,0.00,1.00 -67.20,-4.80,1.00,0.00,1.00 -62.40,-4.80,1.00,0.00,1.00 -57.60,-4.80,1.00,0.00,1.00 -52.80,-4.80,1.00,0.00,1.00 -48.00,-4.80,1.00,0.00,1.00 -43.20,-4.80,1.00,0.00,1.00 -38.40,-4.80,1.00,0.00,1.00 -33.60,-4.80,1.00,0.00,1.00 -28.80,-0.00,1.00,0.00,1.00 -24.00,-0.00,1.00,0.00,1.00 -19.20,-0.00,1.00,0.00,1.00 -14.40,-0.00,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 --14.40,0.00,1.00,0.00,1.00 --19.20,0.00,1.00,0.00,1.00 --24.00,0.00,1.00,0.00,1.00 --28.80,0.00,1.00,0.00,1.00 --33.60,0.00,1.00,0.00,1.00 --38.40,0.00,1.00,0.00,1.00 --43.20,0.00,1.00,0.00,1.00 --48.00,0.00,1.00,0.00,1.00 --52.80,0.00,1.00,0.00,1.00 --57.60,0.00,1.00,0.00,1.00 --62.40,0.00,1.00,0.00,1.00 --67.20,0.00,1.00,0.00,1.00 --72.00,0.00,1.00,0.00,1.00 --76.80,0.00,1.00,0.00,1.00 --81.60,0.00,1.00,0.00,1.00 --86.40,0.00,1.00,0.00,1.00 --91.20,0.00,1.00,0.00,1.00 --96.00,0.00,1.00,0.00,1.00 --100.80,0.00,1.00,0.00,1.00 --105.60,0.00,1.00,0.00,1.00 --110.40,0.00,1.00,0.00,1.00 --115.20,0.00,1.00,0.00,1.00 --120.00,0.00,1.00,0.00,1.00 --124.80,0.00,1.00,0.00,1.00 --129.60,0.00,1.00,0.00,1.00 --134.40,0.00,1.00,0.00,1.00 --139.20,0.00,1.00,0.00,1.00 --144.00,0.00,1.00,0.00,1.00 --148.80,0.00,1.00,0.00,1.00 --153.60,0.00,1.00,0.00,1.00 --158.40,0.00,1.00,0.00,1.00 --163.20,0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 -168.00,0.00,1.00,0.00,1.00 -163.20,0.00,1.00,0.00,1.00 -158.40,0.00,1.00,0.00,1.00 -153.60,0.00,1.00,0.00,1.00 -148.80,0.00,1.00,0.00,1.00 -144.00,0.00,1.00,0.00,1.00 -139.20,0.00,1.00,0.00,1.00 -134.40,0.00,1.00,0.00,1.00 -129.60,0.00,1.00,0.00,1.00 -124.80,0.00,1.00,0.00,1.00 -120.00,0.00,1.00,0.00,1.00 -115.20,0.00,1.00,0.00,1.00 -110.40,0.00,1.00,0.00,1.00 -105.60,0.00,1.00,0.00,1.00 -100.80,0.00,1.00,0.00,1.00 -96.00,0.00,1.00,0.00,1.00 -91.20,0.00,1.00,0.00,1.00 -86.40,0.00,1.00,0.00,1.00 -81.60,0.00,1.00,0.00,1.00 -76.80,0.00,1.00,0.00,1.00 -72.00,0.00,1.00,0.00,1.00 -67.20,0.00,1.00,0.00,1.00 -62.40,0.00,1.00,0.00,1.00 -57.60,0.00,1.00,0.00,1.00 -52.80,0.00,1.00,0.00,1.00 -48.00,0.00,1.00,0.00,1.00 -43.20,0.00,1.00,0.00,1.00 -38.40,0.00,1.00,0.00,1.00 -33.60,0.00,1.00,0.00,1.00 -28.80,0.00,1.00,0.00,1.00 -24.00,0.00,1.00,0.00,1.00 -19.20,0.00,1.00,0.00,1.00 -14.40,0.00,1.00,0.00,1.00 -9.60,0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 +0.00,4.80,16.00,0.00,1.00,0.00,0.00 +0.00,9.60,15.98,0.00,1.00,-177.60,4.80 +0.00,14.40,15.96,0.00,1.00,4.80,9.60 +0.00,19.20,15.94,0.00,1.00,-168.00,14.40 +0.00,24.00,15.91,0.00,1.00,14.40,19.20 +0.00,28.80,15.89,0.00,1.00,-163.20,24.00 +0.00,33.60,15.87,0.00,1.00,19.20,28.80 +0.00,38.40,15.85,0.00,1.00,-153.60,33.60 +0.00,43.20,15.83,0.00,1.00,28.80,38.40 +0.00,48.00,15.81,0.00,1.00,-148.80,43.20 +0.00,52.80,15.79,0.00,1.00,38.40,48.00 +0.00,57.60,15.77,0.00,1.00,-139.20,52.80 +0.00,62.40,15.74,0.00,1.00,48.00,57.60 +4.80,67.20,15.72,0.00,1.00,-124.80,62.40 +4.80,72.00,15.70,0.00,1.00,57.60,67.20 +4.80,76.80,15.68,0.00,1.00,-115.20,72.00 +9.60,81.60,15.66,0.00,1.00,72.00,76.80 +19.20,86.40,15.64,0.00,1.00,-100.80,81.60 +134.40,86.40,15.62,0.00,1.00,86.40,86.40 +168.00,81.60,15.59,0.00,1.00,-86.40,89.20 +172.80,76.80,15.57,0.00,1.00,100.80,86.40 +177.60,72.00,15.55,0.00,1.00,-76.80,81.60 +177.60,67.20,15.53,0.00,1.00,110.40,76.80 +177.60,62.40,15.51,0.00,1.00,-62.40,72.00 +177.60,57.60,15.49,0.00,1.00,124.80,67.20 +177.60,52.80,15.47,0.00,1.00,-52.80,62.40 +177.60,48.00,15.44,0.00,1.00,134.40,57.60 +177.60,43.20,15.42,0.00,1.00,-38.40,52.80 +177.60,38.40,15.40,0.00,1.00,144.00,48.00 +177.60,33.60,15.38,0.00,1.00,-33.60,43.20 +177.60,28.80,15.36,0.00,1.00,153.60,38.40 +177.60,24.00,15.34,0.00,1.00,-24.00,33.60 +177.60,19.20,15.32,0.00,1.00,158.40,28.80 +177.60,14.40,15.30,0.00,1.00,-14.40,24.00 +177.60,9.60,15.27,0.00,1.00,168.00,19.20 +177.60,4.80,15.25,0.00,1.00,-9.60,14.40 +177.60,0.00,15.23,0.00,1.00,172.80,9.60 +-177.60,-0.00,15.21,0.00,1.00,-0.00,4.80 +-177.60,-4.80,15.19,0.00,1.00,-177.60,-0.00 +-177.60,-9.60,15.17,0.00,1.00,4.80,-4.80 +-177.60,-14.40,15.15,0.00,1.00,-172.80,-9.60 +-177.60,-19.20,15.12,0.00,1.00,14.40,-14.40 +-177.60,-24.00,15.10,0.00,1.00,-163.20,-19.20 +-177.60,-28.80,15.08,0.00,1.00,19.20,-24.00 +-177.60,-33.60,15.06,0.00,1.00,-158.40,-28.80 +-177.60,-38.40,15.04,0.00,1.00,28.80,-33.60 +-177.60,-43.20,15.02,0.00,1.00,-148.80,-38.40 +-177.60,-48.00,15.00,0.00,1.00,33.60,-48.00 +-177.60,-52.80,14.97,0.00,1.00,-139.20,-48.00 +-177.60,-57.60,14.95,0.00,1.00,43.20,-52.80 +-177.60,-62.40,14.93,0.00,1.00,-129.60,-57.60 +-177.60,-67.20,14.91,0.00,1.00,57.60,-62.40 +-177.60,-72.00,14.89,0.00,1.00,-120.00,-67.20 +-172.80,-76.80,14.87,0.00,1.00,67.20,-76.80 +-168.00,-81.60,14.85,0.00,1.00,-105.60,-76.80 +-134.40,-86.40,14.83,0.00,1.00,81.60,-86.40 +-19.20,-86.40,14.80,0.00,1.00,-91.20,-89.20 +-9.60,-81.60,14.78,0.00,1.00,96.00,-86.40 +-4.80,-76.80,14.76,0.00,1.00,-76.80,-81.60 +-4.80,-72.00,14.74,0.00,1.00,110.40,-76.80 +-4.80,-67.20,14.72,0.00,1.00,-67.20,-72.00 +-0.00,-62.40,14.70,0.00,1.00,120.00,-67.20 +-0.00,-57.60,14.68,0.00,1.00,-52.80,-62.40 +-0.00,-52.80,14.65,0.00,1.00,129.60,-57.60 +-0.00,-48.00,14.63,0.00,1.00,-43.20,-52.80 +-0.00,-43.20,14.61,0.00,1.00,144.00,-48.00 +-0.00,-38.40,14.59,0.00,1.00,-33.60,-43.20 +-0.00,-33.60,14.57,0.00,1.00,148.80,-38.40 +-0.00,-28.80,14.55,0.00,1.00,-24.00,-33.60 +-0.00,-24.00,14.53,0.00,1.00,158.40,-28.80 +-0.00,-19.20,14.50,0.00,1.00,-19.20,-24.00 +-0.00,-14.40,14.48,0.00,1.00,168.00,-19.20 +-0.00,-9.60,14.46,0.00,1.00,-9.60,-14.40 +-0.00,-4.80,14.44,0.00,1.00,172.80,-9.60 +-0.00,0.00,14.42,0.00,1.00,-4.80,-4.80 +-0.00,4.80,14.40,0.00,1.00,0.00,0.00 +-0.00,9.60,14.38,0.00,1.00,-177.60,4.80 +-0.00,14.40,14.36,0.00,1.00,9.60,9.60 +-0.00,19.20,14.33,0.00,1.00,-168.00,14.40 +-0.00,24.00,14.31,0.00,1.00,14.40,19.20 +-0.00,28.80,14.29,0.00,1.00,-163.20,24.00 +-0.00,33.60,14.27,0.00,1.00,24.00,28.80 +-4.80,38.40,14.25,0.00,1.00,-153.60,33.60 +-4.80,43.20,14.23,0.00,1.00,28.80,38.40 +-4.80,48.00,14.21,0.00,1.00,-144.00,43.20 +-4.80,52.80,14.18,0.00,1.00,38.40,48.00 +-4.80,57.60,14.16,0.00,1.00,-134.40,52.80 +-4.80,62.40,14.14,0.00,1.00,48.00,57.60 +-9.60,67.20,14.12,0.00,1.00,-124.80,62.40 +-9.60,72.00,14.10,0.00,1.00,62.40,67.20 +-14.40,76.80,14.08,0.00,1.00,-115.20,72.00 +-24.00,81.60,14.06,0.00,1.00,72.00,76.80 +-43.20,86.40,14.03,0.00,1.00,-100.80,81.60 +-110.40,86.40,14.01,0.00,1.00,86.40,86.40 +-148.80,81.60,13.99,0.00,1.00,-86.40,86.40 +-163.20,76.80,13.97,0.00,1.00,96.00,81.60 +-168.00,72.00,13.95,0.00,1.00,-76.80,76.80 +-172.80,67.20,13.93,0.00,1.00,110.40,72.00 +-172.80,62.40,13.91,0.00,1.00,-62.40,67.20 +-172.80,57.60,13.89,0.00,1.00,120.00,62.40 +-172.80,52.80,13.86,0.00,1.00,-52.80,57.60 +-177.60,48.00,13.84,0.00,1.00,134.40,52.80 +-177.60,43.20,13.82,0.00,1.00,-43.20,48.00 +-177.60,38.40,13.80,0.00,1.00,144.00,43.20 +-177.60,33.60,13.78,0.00,1.00,-33.60,38.40 +-177.60,28.80,13.76,0.00,1.00,148.80,33.60 +-177.60,24.00,13.74,0.00,1.00,-24.00,28.80 +-177.60,19.20,13.71,0.00,1.00,158.40,24.00 +-177.60,14.40,13.69,0.00,1.00,-19.20,19.20 +-177.60,9.60,13.67,0.00,1.00,168.00,14.40 +-177.60,4.80,13.65,0.00,1.00,-9.60,9.60 +-177.60,0.00,13.63,0.00,1.00,172.80,4.80 +177.60,-0.00,13.61,0.00,1.00,-0.00,0.00 +177.60,-4.80,13.59,0.00,1.00,-177.60,-0.00 +177.60,-9.60,13.56,0.00,1.00,4.80,-4.80 +177.60,-14.40,13.54,0.00,1.00,-172.80,-9.60 +177.60,-19.20,13.52,0.00,1.00,14.40,-14.40 +177.60,-24.00,13.50,0.00,1.00,-163.20,-19.20 +177.60,-28.80,13.48,0.00,1.00,19.20,-24.00 +177.60,-33.60,13.46,0.00,1.00,-153.60,-28.80 +177.60,-38.40,13.44,0.00,1.00,28.80,-33.60 +177.60,-43.20,13.42,0.00,1.00,-148.80,-38.40 +177.60,-48.00,13.39,0.00,1.00,38.40,-43.20 +172.80,-52.80,13.37,0.00,1.00,-139.20,-48.00 +172.80,-57.60,13.35,0.00,1.00,48.00,-52.80 +172.80,-62.40,13.33,0.00,1.00,-124.80,-57.60 +172.80,-67.20,13.31,0.00,1.00,57.60,-62.40 +168.00,-72.00,13.29,0.00,1.00,-115.20,-67.20 +163.20,-76.80,13.27,0.00,1.00,72.00,-72.00 +148.80,-81.60,13.24,0.00,1.00,-105.60,-76.80 +110.40,-86.40,13.22,0.00,1.00,81.60,-81.60 +43.20,-86.40,13.20,0.00,1.00,-91.20,-86.40 +24.00,-81.60,13.18,0.00,1.00,96.00,-86.40 +14.40,-76.80,13.16,0.00,1.00,-76.80,-81.60 +9.60,-72.00,13.14,0.00,1.00,105.60,-76.80 +9.60,-67.20,13.12,0.00,1.00,-67.20,-72.00 +4.80,-62.40,13.09,0.00,1.00,120.00,-67.20 +4.80,-57.60,13.07,0.00,1.00,-57.60,-62.40 +4.80,-52.80,13.05,0.00,1.00,129.60,-57.60 +4.80,-48.00,13.03,0.00,1.00,-43.20,-52.80 +4.80,-43.20,13.01,0.00,1.00,139.20,-48.00 +4.80,-38.40,12.99,0.00,1.00,-33.60,-43.20 +0.00,-33.60,12.97,0.00,1.00,148.80,-38.40 +0.00,-28.80,12.95,0.00,1.00,-28.80,-33.60 +0.00,-24.00,12.92,0.00,1.00,158.40,-28.80 +0.00,-19.20,12.90,0.00,1.00,-19.20,-24.00 +0.00,-14.40,12.88,0.00,1.00,163.20,-19.20 +0.00,-9.60,12.86,0.00,1.00,-9.60,-14.40 +0.00,-4.80,12.84,0.00,1.00,172.80,-9.60 +0.00,0.00,12.82,0.00,1.00,-4.80,-4.80 +-0.00,4.80,12.80,0.00,1.00,0.00,0.00 +-0.00,9.60,12.77,0.00,1.00,-177.60,4.80 +-0.00,14.40,12.75,0.00,1.00,9.60,9.60 +-4.80,19.20,12.73,0.00,1.00,-168.00,14.40 +-4.80,24.00,12.71,0.00,1.00,14.40,19.20 +-4.80,28.80,12.69,0.00,1.00,-158.40,24.00 +-4.80,33.60,12.67,0.00,1.00,24.00,28.80 +-4.80,38.40,12.65,0.00,1.00,-153.60,33.60 +-9.60,43.20,12.62,0.00,1.00,33.60,38.40 +-9.60,48.00,12.60,0.00,1.00,-144.00,43.20 +-9.60,52.80,12.58,0.00,1.00,43.20,48.00 +-14.40,57.60,12.56,0.00,1.00,-134.40,52.80 +-14.40,62.40,12.54,0.00,1.00,52.80,57.60 +-19.20,67.20,12.52,0.00,1.00,-124.80,62.40 +-24.00,72.00,12.50,0.00,1.00,62.40,67.20 +-33.60,72.00,12.48,0.00,1.00,-110.40,72.00 +-43.20,76.80,12.45,0.00,1.00,72.00,72.00 +-67.20,81.60,12.43,0.00,1.00,-100.80,76.80 +-96.00,81.60,12.41,0.00,1.00,86.40,81.60 +-124.80,81.60,12.39,0.00,1.00,-86.40,81.60 +-144.00,76.80,12.37,0.00,1.00,96.00,76.80 +-153.60,72.00,12.35,0.00,1.00,-76.80,76.80 +-158.40,67.20,12.33,0.00,1.00,110.40,72.00 +-163.20,62.40,12.30,0.00,1.00,-67.20,67.20 +-168.00,57.60,12.28,0.00,1.00,120.00,62.40 +-168.00,52.80,12.26,0.00,1.00,-52.80,57.60 +-168.00,48.00,12.24,0.00,1.00,129.60,52.80 +-172.80,43.20,12.22,0.00,1.00,-43.20,48.00 +-172.80,38.40,12.20,0.00,1.00,139.20,43.20 +-172.80,33.60,12.18,0.00,1.00,-33.60,38.40 +-172.80,28.80,12.15,0.00,1.00,148.80,33.60 +-177.60,24.00,12.13,0.00,1.00,-24.00,28.80 +-177.60,19.20,12.11,0.00,1.00,158.40,24.00 +-177.60,14.40,12.09,0.00,1.00,-19.20,19.20 +-177.60,9.60,12.07,0.00,1.00,168.00,14.40 +-177.60,4.80,12.05,0.00,1.00,-9.60,9.60 +-177.60,0.00,12.03,0.00,1.00,172.80,4.80 +177.60,-0.00,12.01,0.00,1.00,-0.00,0.00 +177.60,-4.80,11.98,0.00,1.00,-177.60,-0.00 +177.60,-9.60,11.96,0.00,1.00,4.80,-4.80 +177.60,-14.40,11.94,0.00,1.00,-168.00,-9.60 +177.60,-19.20,11.92,0.00,1.00,14.40,-14.40 +177.60,-24.00,11.90,0.00,1.00,-163.20,-19.20 +172.80,-28.80,11.88,0.00,1.00,24.00,-24.00 +172.80,-33.60,11.86,0.00,1.00,-153.60,-28.80 +172.80,-38.40,11.83,0.00,1.00,28.80,-33.60 +172.80,-43.20,11.81,0.00,1.00,-144.00,-38.40 +168.00,-48.00,11.79,0.00,1.00,38.40,-43.20 +168.00,-52.80,11.77,0.00,1.00,-134.40,-48.00 +168.00,-57.60,11.75,0.00,1.00,48.00,-52.80 +163.20,-62.40,11.73,0.00,1.00,-124.80,-57.60 +158.40,-67.20,11.71,0.00,1.00,62.40,-62.40 +153.60,-72.00,11.68,0.00,1.00,-115.20,-67.20 +144.00,-76.80,11.66,0.00,1.00,72.00,-72.00 +124.80,-81.60,11.64,0.00,1.00,-100.80,-76.80 +96.00,-81.60,11.62,0.00,1.00,81.60,-76.80 +67.20,-81.60,11.60,0.00,1.00,-91.20,-81.60 +43.20,-76.80,11.58,0.00,1.00,96.00,-81.60 +33.60,-72.00,11.56,0.00,1.00,-81.60,-76.80 +24.00,-72.00,11.54,0.00,1.00,105.60,-72.00 +19.20,-67.20,11.51,0.00,1.00,-67.20,-72.00 +14.40,-62.40,11.49,0.00,1.00,115.20,-67.20 +14.40,-57.60,11.47,0.00,1.00,-57.60,-62.40 +9.60,-52.80,11.45,0.00,1.00,129.60,-57.60 +9.60,-48.00,11.43,0.00,1.00,-48.00,-52.80 +9.60,-43.20,11.41,0.00,1.00,139.20,-48.00 +4.80,-38.40,11.39,0.00,1.00,-38.40,-43.20 +4.80,-33.60,11.36,0.00,1.00,148.80,-38.40 +4.80,-28.80,11.34,0.00,1.00,-28.80,-33.60 +4.80,-24.00,11.32,0.00,1.00,153.60,-28.80 +4.80,-19.20,11.30,0.00,1.00,-19.20,-24.00 +0.00,-14.40,11.28,0.00,1.00,163.20,-19.20 +0.00,-9.60,11.26,0.00,1.00,-9.60,-14.40 +0.00,-4.80,11.24,0.00,1.00,172.80,-9.60 +0.00,0.00,11.21,0.00,1.00,-4.80,-4.80 +-0.00,4.80,11.19,0.00,1.00,0.00,0.00 +-0.00,9.60,11.17,0.00,1.00,-177.60,4.80 +-4.80,14.40,11.15,0.00,1.00,9.60,9.60 +-4.80,19.20,11.13,0.00,1.00,-168.00,14.40 +-4.80,24.00,11.11,0.00,1.00,14.40,19.20 +-4.80,28.80,11.09,0.00,1.00,-158.40,24.00 +-9.60,33.60,11.07,0.00,1.00,24.00,28.80 +-9.60,38.40,11.04,0.00,1.00,-148.80,33.60 +-14.40,43.20,11.02,0.00,1.00,33.60,38.40 +-14.40,48.00,11.00,0.00,1.00,-139.20,43.20 +-14.40,52.80,10.98,0.00,1.00,43.20,48.00 +-19.20,57.60,10.96,0.00,1.00,-129.60,52.80 +-24.00,57.60,10.94,0.00,1.00,52.80,52.80 +-28.80,62.40,10.92,0.00,1.00,-120.00,57.60 +-33.60,67.20,10.89,0.00,1.00,62.40,62.40 +-43.20,72.00,10.87,0.00,1.00,-110.40,67.20 +-57.60,72.00,10.85,0.00,1.00,76.80,72.00 +-76.80,76.80,10.83,0.00,1.00,-100.80,72.00 +-96.00,76.80,10.81,0.00,1.00,86.40,76.80 +-115.20,76.80,10.79,0.00,1.00,-86.40,76.80 +-129.60,72.00,10.77,0.00,1.00,96.00,76.80 +-139.20,72.00,10.74,0.00,1.00,-76.80,72.00 +-148.80,67.20,10.72,0.00,1.00,105.60,67.20 +-153.60,62.40,10.70,0.00,1.00,-67.20,67.20 +-158.40,57.60,10.68,0.00,1.00,120.00,62.40 +-163.20,52.80,10.66,0.00,1.00,-57.60,57.60 +-163.20,48.00,10.64,0.00,1.00,129.60,52.80 +-168.00,43.20,10.62,0.00,1.00,-48.00,48.00 +-168.00,38.40,10.60,0.00,1.00,139.20,43.20 +-172.80,33.60,10.57,0.00,1.00,-38.40,38.40 +-172.80,28.80,10.55,0.00,1.00,148.80,33.60 +-172.80,24.00,10.53,0.00,1.00,-28.80,28.80 +-172.80,19.20,10.51,0.00,1.00,158.40,24.00 +-177.60,14.40,10.49,0.00,1.00,-19.20,19.20 +-177.60,9.60,10.47,0.00,1.00,163.20,14.40 +-177.60,4.80,10.45,0.00,1.00,-9.60,9.60 +-177.60,0.00,10.42,0.00,1.00,172.80,4.80 +177.60,-0.00,10.40,0.00,1.00,-0.00,0.00 +177.60,-4.80,10.38,0.00,1.00,-177.60,-0.00 +177.60,-9.60,10.36,0.00,1.00,4.80,-4.80 +177.60,-14.40,10.34,0.00,1.00,-168.00,-9.60 +172.80,-19.20,10.32,0.00,1.00,14.40,-14.40 +172.80,-24.00,10.30,0.00,1.00,-163.20,-19.20 +172.80,-28.80,10.28,0.00,1.00,24.00,-24.00 +172.80,-33.60,10.25,0.00,1.00,-153.60,-28.80 +168.00,-38.40,10.23,0.00,1.00,33.60,-33.60 +168.00,-43.20,10.21,0.00,1.00,-144.00,-38.40 +163.20,-48.00,10.19,0.00,1.00,43.20,-43.20 +163.20,-52.80,10.17,0.00,1.00,-134.40,-48.00 +158.40,-57.60,10.15,0.00,1.00,52.80,-52.80 +153.60,-62.40,10.13,0.00,1.00,-124.80,-57.60 +148.80,-67.20,10.10,0.00,1.00,62.40,-62.40 +139.20,-72.00,10.08,0.00,1.00,-115.20,-67.20 +129.60,-72.00,10.06,0.00,1.00,72.00,-67.20 +115.20,-76.80,10.04,0.00,1.00,-100.80,-72.00 +96.00,-76.80,10.02,0.00,1.00,81.60,-76.80 +76.80,-76.80,10.00,0.00,1.00,-91.20,-76.80 +57.60,-72.00,9.98,0.00,1.00,96.00,-76.80 +43.20,-72.00,9.95,0.00,1.00,-81.60,-72.00 +33.60,-67.20,9.93,0.00,1.00,105.60,-72.00 +28.80,-62.40,9.91,0.00,1.00,-67.20,-67.20 +24.00,-57.60,9.89,0.00,1.00,115.20,-62.40 +19.20,-57.60,9.87,0.00,1.00,-57.60,-57.60 +14.40,-52.80,9.85,0.00,1.00,124.80,-52.80 +14.40,-48.00,9.83,0.00,1.00,-48.00,-52.80 +14.40,-43.20,9.81,0.00,1.00,134.40,-48.00 +9.60,-38.40,9.78,0.00,1.00,-38.40,-43.20 +9.60,-33.60,9.76,0.00,1.00,144.00,-38.40 +4.80,-28.80,9.74,0.00,1.00,-28.80,-33.60 +4.80,-24.00,9.72,0.00,1.00,153.60,-28.80 +4.80,-19.20,9.70,0.00,1.00,-19.20,-24.00 +4.80,-14.40,9.68,0.00,1.00,163.20,-19.20 +0.00,-9.60,9.66,0.00,1.00,-14.40,-14.40 +0.00,-4.80,9.63,0.00,1.00,172.80,-9.60 +0.00,0.00,9.61,0.00,1.00,-4.80,-4.80 +-0.00,4.80,9.59,0.00,1.00,0.00,0.00 +-4.80,9.60,9.57,0.00,1.00,-177.60,4.80 +-4.80,14.40,9.55,0.00,1.00,9.60,9.60 +-4.80,19.20,9.53,0.00,1.00,-168.00,14.40 +-9.60,24.00,9.51,0.00,1.00,19.20,19.20 +-9.60,28.80,9.48,0.00,1.00,-158.40,24.00 +-9.60,33.60,9.46,0.00,1.00,24.00,28.80 +-14.40,38.40,9.44,0.00,1.00,-148.80,33.60 +-14.40,38.40,9.42,0.00,1.00,33.60,33.60 +-19.20,43.20,9.40,0.00,1.00,-139.20,38.40 +-24.00,48.00,9.38,0.00,1.00,43.20,43.20 +-24.00,52.80,9.36,0.00,1.00,-129.60,48.00 +-28.80,57.60,9.34,0.00,1.00,52.80,52.80 +-38.40,62.40,9.31,0.00,1.00,-120.00,57.60 +-43.20,62.40,9.29,0.00,1.00,67.20,62.40 +-52.80,67.20,9.27,0.00,1.00,-110.40,62.40 +-62.40,72.00,9.25,0.00,1.00,76.80,67.20 +-76.80,72.00,9.23,0.00,1.00,-100.80,67.20 +-96.00,72.00,9.21,0.00,1.00,86.40,72.00 +-110.40,72.00,9.19,0.00,1.00,-86.40,72.00 +-120.00,67.20,9.16,0.00,1.00,96.00,72.00 +-134.40,67.20,9.14,0.00,1.00,-76.80,67.20 +-139.20,62.40,9.12,0.00,1.00,105.60,67.20 +-148.80,57.60,9.10,0.00,1.00,-67.20,62.40 +-153.60,57.60,9.08,0.00,1.00,115.20,57.60 +-158.40,52.80,9.06,0.00,1.00,-57.60,52.80 +-158.40,48.00,9.04,0.00,1.00,129.60,52.80 +-163.20,43.20,9.01,0.00,1.00,-48.00,48.00 +-163.20,38.40,8.99,0.00,1.00,139.20,43.20 +-168.00,33.60,8.97,0.00,1.00,-38.40,38.40 +-168.00,28.80,8.95,0.00,1.00,148.80,33.60 +-172.80,24.00,8.93,0.00,1.00,-28.80,28.80 +-172.80,19.20,8.91,0.00,1.00,153.60,24.00 +-172.80,14.40,8.89,0.00,1.00,-19.20,19.20 +-177.60,9.60,8.87,0.00,1.00,163.20,14.40 +-177.60,4.80,8.84,0.00,1.00,-9.60,9.60 +-177.60,0.00,8.82,0.00,1.00,172.80,4.80 +177.60,-0.00,8.80,0.00,1.00,-0.00,0.00 +177.60,-4.80,8.78,0.00,1.00,-177.60,-0.00 +177.60,-9.60,8.76,0.00,1.00,4.80,-4.80 +172.80,-14.40,8.74,0.00,1.00,-168.00,-9.60 +172.80,-19.20,8.72,0.00,1.00,14.40,-14.40 +172.80,-24.00,8.69,0.00,1.00,-158.40,-19.20 +168.00,-28.80,8.67,0.00,1.00,24.00,-24.00 +168.00,-33.60,8.65,0.00,1.00,-153.60,-28.80 +163.20,-38.40,8.63,0.00,1.00,33.60,-33.60 +163.20,-43.20,8.61,0.00,1.00,-144.00,-38.40 +158.40,-48.00,8.59,0.00,1.00,43.20,-43.20 +158.40,-52.80,8.57,0.00,1.00,-134.40,-48.00 +153.60,-57.60,8.54,0.00,1.00,52.80,-52.80 +148.80,-57.60,8.52,0.00,1.00,-124.80,-52.80 +139.20,-62.40,8.50,0.00,1.00,62.40,-57.60 +134.40,-67.20,8.48,0.00,1.00,-110.40,-62.40 +120.00,-67.20,8.46,0.00,1.00,72.00,-67.20 +110.40,-72.00,8.44,0.00,1.00,-100.80,-67.20 +96.00,-72.00,8.42,0.00,1.00,81.60,-72.00 +76.80,-72.00,8.40,0.00,1.00,-91.20,-72.00 +62.40,-72.00,8.37,0.00,1.00,96.00,-72.00 +52.80,-67.20,8.35,0.00,1.00,-81.60,-67.20 +43.20,-62.40,8.33,0.00,1.00,105.60,-67.20 +38.40,-62.40,8.31,0.00,1.00,-72.00,-62.40 +28.80,-57.60,8.29,0.00,1.00,115.20,-62.40 +24.00,-52.80,8.27,0.00,1.00,-57.60,-57.60 +24.00,-48.00,8.25,0.00,1.00,124.80,-52.80 +19.20,-43.20,8.22,0.00,1.00,-48.00,-48.00 +14.40,-38.40,8.20,0.00,1.00,134.40,-43.20 +14.40,-38.40,8.18,0.00,1.00,-38.40,-38.40 +9.60,-33.60,8.16,0.00,1.00,144.00,-33.60 +9.60,-28.80,8.14,0.00,1.00,-28.80,-33.60 +9.60,-24.00,8.12,0.00,1.00,153.60,-28.80 +4.80,-19.20,8.10,0.00,1.00,-24.00,-24.00 +4.80,-14.40,8.07,0.00,1.00,163.20,-19.20 +4.80,-9.60,8.05,0.00,1.00,-14.40,-14.40 +0.00,-4.80,8.03,0.00,1.00,172.80,-9.60 +0.00,0.00,8.01,0.00,1.00,-4.80,-4.80 +-0.00,4.80,7.99,0.00,1.00,0.00,0.00 +-4.80,9.60,7.97,0.00,1.00,-177.60,4.80 +-4.80,14.40,7.95,0.00,1.00,9.60,9.60 +-9.60,19.20,7.93,0.00,1.00,-168.00,14.40 +-9.60,24.00,7.90,0.00,1.00,19.20,19.20 +-14.40,24.00,7.88,0.00,1.00,-158.40,24.00 +-14.40,28.80,7.86,0.00,1.00,28.80,24.00 +-19.20,33.60,7.84,0.00,1.00,-148.80,28.80 +-19.20,38.40,7.82,0.00,1.00,38.40,33.60 +-24.00,43.20,7.80,0.00,1.00,-139.20,38.40 +-28.80,48.00,7.78,0.00,1.00,48.00,43.20 +-33.60,52.80,7.75,0.00,1.00,-129.60,48.00 +-38.40,52.80,7.73,0.00,1.00,57.60,52.80 +-43.20,57.60,7.71,0.00,1.00,-120.00,52.80 +-48.00,62.40,7.69,0.00,1.00,67.20,57.60 +-57.60,62.40,7.67,0.00,1.00,-110.40,62.40 +-67.20,67.20,7.65,0.00,1.00,76.80,62.40 +-81.60,67.20,7.63,0.00,1.00,-100.80,62.40 +-91.20,67.20,7.60,0.00,1.00,86.40,67.20 +-105.60,67.20,7.58,0.00,1.00,-86.40,67.20 +-115.20,67.20,7.56,0.00,1.00,96.00,67.20 +-124.80,62.40,7.54,0.00,1.00,-76.80,62.40 +-134.40,57.60,7.52,0.00,1.00,105.60,62.40 +-139.20,57.60,7.50,0.00,1.00,-67.20,57.60 +-144.00,52.80,7.48,0.00,1.00,115.20,57.60 +-148.80,48.00,7.46,0.00,1.00,-57.60,52.80 +-153.60,43.20,7.43,0.00,1.00,124.80,48.00 +-158.40,43.20,7.41,0.00,1.00,-48.00,43.20 +-163.20,38.40,7.39,0.00,1.00,134.40,38.40 +-163.20,33.60,7.37,0.00,1.00,-38.40,38.40 +-168.00,28.80,7.35,0.00,1.00,144.00,33.60 +-168.00,24.00,7.33,0.00,1.00,-28.80,28.80 +-172.80,19.20,7.31,0.00,1.00,153.60,24.00 +-172.80,14.40,7.28,0.00,1.00,-19.20,19.20 +-177.60,9.60,7.26,0.00,1.00,163.20,14.40 +-177.60,4.80,7.24,0.00,1.00,-9.60,9.60 +-177.60,0.00,7.22,0.00,1.00,172.80,4.80 +177.60,-0.00,7.20,0.00,1.00,-0.00,0.00 +177.60,-4.80,7.18,0.00,1.00,-177.60,-0.00 +177.60,-9.60,7.16,0.00,1.00,4.80,-4.80 +172.80,-14.40,7.13,0.00,1.00,-168.00,-9.60 +172.80,-19.20,7.11,0.00,1.00,14.40,-14.40 +168.00,-24.00,7.09,0.00,1.00,-158.40,-19.20 +168.00,-28.80,7.07,0.00,1.00,24.00,-24.00 +163.20,-33.60,7.05,0.00,1.00,-148.80,-28.80 +163.20,-38.40,7.03,0.00,1.00,33.60,-33.60 +158.40,-43.20,7.01,0.00,1.00,-139.20,-38.40 +153.60,-43.20,6.99,0.00,1.00,43.20,-38.40 +148.80,-48.00,6.96,0.00,1.00,-129.60,-43.20 +144.00,-52.80,6.94,0.00,1.00,52.80,-48.00 +139.20,-57.60,6.92,0.00,1.00,-120.00,-52.80 +134.40,-57.60,6.90,0.00,1.00,62.40,-57.60 +124.80,-62.40,6.88,0.00,1.00,-110.40,-57.60 +115.20,-67.20,6.86,0.00,1.00,72.00,-62.40 +105.60,-67.20,6.84,0.00,1.00,-100.80,-62.40 +91.20,-67.20,6.81,0.00,1.00,81.60,-67.20 +81.60,-67.20,6.79,0.00,1.00,-91.20,-67.20 +67.20,-67.20,6.77,0.00,1.00,96.00,-67.20 +57.60,-62.40,6.75,0.00,1.00,-81.60,-62.40 +48.00,-62.40,6.73,0.00,1.00,105.60,-62.40 +43.20,-57.60,6.71,0.00,1.00,-72.00,-62.40 +38.40,-52.80,6.69,0.00,1.00,115.20,-57.60 +33.60,-52.80,6.66,0.00,1.00,-62.40,-52.80 +28.80,-48.00,6.64,0.00,1.00,124.80,-52.80 +24.00,-43.20,6.62,0.00,1.00,-52.80,-48.00 +19.20,-38.40,6.60,0.00,1.00,134.40,-43.20 +19.20,-33.60,6.58,0.00,1.00,-43.20,-38.40 +14.40,-28.80,6.56,0.00,1.00,144.00,-33.60 +14.40,-24.00,6.54,0.00,1.00,-33.60,-28.80 +9.60,-24.00,6.52,0.00,1.00,153.60,-24.00 +9.60,-19.20,6.49,0.00,1.00,-24.00,-24.00 +4.80,-14.40,6.47,0.00,1.00,163.20,-19.20 +4.80,-9.60,6.45,0.00,1.00,-14.40,-14.40 +0.00,-4.80,6.43,0.00,1.00,172.80,-9.60 +0.00,0.00,6.41,0.00,1.00,-4.80,-4.80 +-0.00,4.80,6.39,0.00,1.00,0.00,0.00 +-4.80,9.60,6.37,0.00,1.00,-177.60,4.80 +-4.80,14.40,6.34,0.00,1.00,9.60,9.60 +-9.60,19.20,6.32,0.00,1.00,-168.00,14.40 +-9.60,19.20,6.30,0.00,1.00,19.20,14.40 +-14.40,24.00,6.28,0.00,1.00,-158.40,19.20 +-19.20,28.80,6.26,0.00,1.00,28.80,24.00 +-19.20,33.60,6.24,0.00,1.00,-148.80,28.80 +-24.00,38.40,6.22,0.00,1.00,38.40,33.60 +-28.80,43.20,6.19,0.00,1.00,-139.20,38.40 +-33.60,43.20,6.17,0.00,1.00,48.00,38.40 +-38.40,48.00,6.15,0.00,1.00,-129.60,43.20 +-43.20,52.80,6.13,0.00,1.00,57.60,48.00 +-48.00,52.80,6.11,0.00,1.00,-120.00,52.80 +-52.80,57.60,6.09,0.00,1.00,67.20,52.80 +-62.40,57.60,6.07,0.00,1.00,-110.40,57.60 +-72.00,62.40,6.05,0.00,1.00,76.80,57.60 +-81.60,62.40,6.02,0.00,1.00,-100.80,62.40 +-91.20,62.40,6.00,0.00,1.00,86.40,62.40 +-100.80,62.40,5.98,0.00,1.00,-86.40,62.40 +-110.40,62.40,5.96,0.00,1.00,96.00,62.40 +-120.00,57.60,5.94,0.00,1.00,-76.80,57.60 +-129.60,57.60,5.92,0.00,1.00,105.60,57.60 +-134.40,52.80,5.90,0.00,1.00,-67.20,57.60 +-139.20,48.00,5.87,0.00,1.00,115.20,52.80 +-144.00,48.00,5.85,0.00,1.00,-57.60,48.00 +-148.80,43.20,5.83,0.00,1.00,124.80,48.00 +-153.60,38.40,5.81,0.00,1.00,-48.00,43.20 +-158.40,33.60,5.79,0.00,1.00,134.40,38.40 +-163.20,33.60,5.77,0.00,1.00,-38.40,33.60 +-163.20,28.80,5.75,0.00,1.00,144.00,28.80 +-168.00,24.00,5.72,0.00,1.00,-28.80,28.80 +-168.00,19.20,5.70,0.00,1.00,153.60,24.00 +-172.80,14.40,5.68,0.00,1.00,-19.20,19.20 +-172.80,9.60,5.66,0.00,1.00,163.20,14.40 +-177.60,4.80,5.64,0.00,1.00,-9.60,9.60 +-177.60,0.00,5.62,0.00,1.00,172.80,4.80 +177.60,-0.00,5.60,0.00,1.00,-0.00,0.00 +177.60,-4.80,5.58,0.00,1.00,-177.60,-0.00 +172.80,-9.60,5.55,0.00,1.00,4.80,-4.80 +172.80,-14.40,5.53,0.00,1.00,-168.00,-9.60 +168.00,-19.20,5.51,0.00,1.00,14.40,-14.40 +168.00,-24.00,5.49,0.00,1.00,-158.40,-19.20 +163.20,-28.80,5.47,0.00,1.00,24.00,-24.00 +163.20,-33.60,5.45,0.00,1.00,-148.80,-28.80 +158.40,-33.60,5.43,0.00,1.00,33.60,-28.80 +153.60,-38.40,5.40,0.00,1.00,-139.20,-33.60 +148.80,-43.20,5.38,0.00,1.00,43.20,-38.40 +144.00,-48.00,5.36,0.00,1.00,-129.60,-43.20 +139.20,-48.00,5.34,0.00,1.00,52.80,-48.00 +134.40,-52.80,5.32,0.00,1.00,-120.00,-48.00 +129.60,-57.60,5.30,0.00,1.00,62.40,-52.80 +120.00,-57.60,5.28,0.00,1.00,-110.40,-57.60 +110.40,-62.40,5.26,0.00,1.00,72.00,-57.60 +100.80,-62.40,5.23,0.00,1.00,-100.80,-57.60 +91.20,-62.40,5.21,0.00,1.00,81.60,-62.40 +81.60,-62.40,5.19,0.00,1.00,-91.20,-62.40 +72.00,-62.40,5.17,0.00,1.00,96.00,-62.40 +62.40,-57.60,5.15,0.00,1.00,-81.60,-62.40 +52.80,-57.60,5.13,0.00,1.00,105.60,-57.60 +48.00,-52.80,5.11,0.00,1.00,-72.00,-57.60 +43.20,-52.80,5.08,0.00,1.00,115.20,-52.80 +38.40,-48.00,5.06,0.00,1.00,-62.40,-52.80 +33.60,-43.20,5.04,0.00,1.00,124.80,-48.00 +28.80,-43.20,5.02,0.00,1.00,-52.80,-43.20 +24.00,-38.40,5.00,0.00,1.00,134.40,-38.40 +19.20,-33.60,4.98,0.00,1.00,-43.20,-38.40 +19.20,-28.80,4.96,0.00,1.00,144.00,-33.60 +14.40,-24.00,4.93,0.00,1.00,-33.60,-28.80 +9.60,-19.20,4.91,0.00,1.00,153.60,-24.00 +9.60,-19.20,4.89,0.00,1.00,-24.00,-19.20 +4.80,-14.40,4.87,0.00,1.00,163.20,-14.40 +4.80,-9.60,4.85,0.00,1.00,-14.40,-14.40 +0.00,-4.80,4.83,0.00,1.00,172.80,-9.60 +0.00,0.00,4.81,0.00,1.00,-4.80,-4.80 +-4.80,4.80,4.79,0.00,1.00,0.00,0.00 +-4.80,9.60,4.76,0.00,1.00,-177.60,4.80 +-9.60,14.40,4.74,0.00,1.00,9.60,9.60 +-9.60,14.40,4.72,0.00,1.00,-168.00,9.60 +-14.40,19.20,4.70,0.00,1.00,19.20,14.40 +-14.40,24.00,4.68,0.00,1.00,-158.40,19.20 +-19.20,28.80,4.66,0.00,1.00,28.80,24.00 +-24.00,33.60,4.64,0.00,1.00,-148.80,28.80 +-28.80,33.60,4.61,0.00,1.00,38.40,28.80 +-28.80,38.40,4.59,0.00,1.00,-139.20,33.60 +-33.60,43.20,4.57,0.00,1.00,48.00,38.40 +-38.40,43.20,4.55,0.00,1.00,-129.60,43.20 +-48.00,48.00,4.53,0.00,1.00,57.60,43.20 +-52.80,52.80,4.51,0.00,1.00,-120.00,48.00 +-57.60,52.80,4.49,0.00,1.00,67.20,48.00 +-67.20,57.60,4.46,0.00,1.00,-110.40,52.80 +-76.80,57.60,4.44,0.00,1.00,76.80,52.80 +-81.60,57.60,4.42,0.00,1.00,-100.80,57.60 +-91.20,57.60,4.40,0.00,1.00,86.40,57.60 +-100.80,57.60,4.38,0.00,1.00,-86.40,57.60 +-110.40,57.60,4.36,0.00,1.00,96.00,57.60 +-115.20,52.80,4.34,0.00,1.00,-76.80,52.80 +-124.80,52.80,4.32,0.00,1.00,105.60,52.80 +-129.60,48.00,4.29,0.00,1.00,-67.20,52.80 +-139.20,48.00,4.27,0.00,1.00,115.20,48.00 +-144.00,43.20,4.25,0.00,1.00,-57.60,48.00 +-148.80,38.40,4.23,0.00,1.00,124.80,43.20 +-153.60,38.40,4.21,0.00,1.00,-48.00,38.40 +-153.60,33.60,4.19,0.00,1.00,134.40,38.40 +-158.40,28.80,4.17,0.00,1.00,-38.40,33.60 +-163.20,24.00,4.14,0.00,1.00,144.00,28.80 +-163.20,24.00,4.12,0.00,1.00,-28.80,24.00 +-168.00,19.20,4.10,0.00,1.00,153.60,24.00 +-172.80,14.40,4.08,0.00,1.00,-19.20,19.20 +-172.80,9.60,4.06,0.00,1.00,163.20,14.40 +-177.60,4.80,4.04,0.00,1.00,-9.60,9.60 +-177.60,0.00,4.02,0.00,1.00,172.80,4.80 +177.60,-0.00,3.99,0.00,1.00,-0.00,0.00 +177.60,-4.80,3.97,0.00,1.00,-177.60,-0.00 +172.80,-9.60,3.95,0.00,1.00,4.80,-4.80 +172.80,-14.40,3.93,0.00,1.00,-168.00,-9.60 +168.00,-19.20,3.91,0.00,1.00,14.40,-14.40 +163.20,-24.00,3.89,0.00,1.00,-158.40,-19.20 +163.20,-24.00,3.87,0.00,1.00,24.00,-24.00 +158.40,-28.80,3.85,0.00,1.00,-148.80,-24.00 +153.60,-33.60,3.82,0.00,1.00,33.60,-28.80 +153.60,-38.40,3.80,0.00,1.00,-139.20,-33.60 +148.80,-38.40,3.78,0.00,1.00,43.20,-38.40 +144.00,-43.20,3.76,0.00,1.00,-129.60,-38.40 +139.20,-48.00,3.74,0.00,1.00,52.80,-43.20 +129.60,-48.00,3.72,0.00,1.00,-120.00,-48.00 +124.80,-52.80,3.70,0.00,1.00,62.40,-48.00 +115.20,-52.80,3.67,0.00,1.00,-110.40,-52.80 +110.40,-57.60,3.65,0.00,1.00,72.00,-52.80 +100.80,-57.60,3.63,0.00,1.00,-100.80,-52.80 +91.20,-57.60,3.61,0.00,1.00,81.60,-57.60 +81.60,-57.60,3.59,0.00,1.00,-91.20,-57.60 +76.80,-57.60,3.57,0.00,1.00,96.00,-57.60 +67.20,-57.60,3.55,0.00,1.00,-81.60,-57.60 +57.60,-52.80,3.52,0.00,1.00,105.60,-52.80 +52.80,-52.80,3.50,0.00,1.00,-72.00,-52.80 +48.00,-48.00,3.48,0.00,1.00,115.20,-48.00 +38.40,-43.20,3.46,0.00,1.00,-62.40,-48.00 +33.60,-43.20,3.44,0.00,1.00,124.80,-43.20 +28.80,-38.40,3.42,0.00,1.00,-52.80,-43.20 +28.80,-33.60,3.40,0.00,1.00,134.40,-38.40 +24.00,-33.60,3.38,0.00,1.00,-43.20,-33.60 +19.20,-28.80,3.35,0.00,1.00,144.00,-28.80 +14.40,-24.00,3.33,0.00,1.00,-33.60,-28.80 +14.40,-19.20,3.31,0.00,1.00,153.60,-24.00 +9.60,-14.40,3.29,0.00,1.00,-24.00,-19.20 +9.60,-14.40,3.27,0.00,1.00,163.20,-14.40 +4.80,-9.60,3.25,0.00,1.00,-14.40,-9.60 +4.80,-4.80,3.23,0.00,1.00,172.80,-9.60 +0.00,0.00,3.20,0.00,1.00,-4.80,-4.80 +-4.80,4.80,3.18,0.00,1.00,0.00,0.00 +-4.80,9.60,3.16,0.00,1.00,-177.60,4.80 +-9.60,9.60,3.14,0.00,1.00,9.60,9.60 +-9.60,14.40,3.12,0.00,1.00,-168.00,9.60 +-14.40,19.20,3.10,0.00,1.00,19.20,14.40 +-19.20,24.00,3.08,0.00,1.00,-158.40,19.20 +-24.00,24.00,3.05,0.00,1.00,28.80,24.00 +-24.00,28.80,3.03,0.00,1.00,-148.80,24.00 +-28.80,33.60,3.01,0.00,1.00,38.40,28.80 +-33.60,38.40,2.99,0.00,1.00,-139.20,33.60 +-38.40,38.40,2.97,0.00,1.00,48.00,33.60 +-43.20,43.20,2.95,0.00,1.00,-129.60,38.40 +-48.00,43.20,2.93,0.00,1.00,57.60,43.20 +-52.80,48.00,2.91,0.00,1.00,-120.00,43.20 +-62.40,48.00,2.88,0.00,1.00,67.20,48.00 +-67.20,52.80,2.86,0.00,1.00,-110.40,48.00 +-76.80,52.80,2.84,0.00,1.00,76.80,48.00 +-86.40,52.80,2.82,0.00,1.00,-100.80,52.80 +-91.20,52.80,2.80,0.00,1.00,86.40,52.80 +-100.80,52.80,2.78,0.00,1.00,-86.40,52.80 +-105.60,52.80,2.76,0.00,1.00,96.00,52.80 +-115.20,48.00,2.73,0.00,1.00,-76.80,48.00 +-120.00,48.00,2.71,0.00,1.00,105.60,48.00 +-129.60,48.00,2.69,0.00,1.00,-67.20,48.00 +-134.40,43.20,2.67,0.00,1.00,115.20,43.20 +-139.20,43.20,2.65,0.00,1.00,-57.60,43.20 +-144.00,38.40,2.63,0.00,1.00,124.80,38.40 +-148.80,33.60,2.61,0.00,1.00,-48.00,38.40 +-153.60,33.60,2.58,0.00,1.00,134.40,33.60 +-158.40,28.80,2.56,0.00,1.00,-38.40,28.80 +-158.40,24.00,2.54,0.00,1.00,144.00,28.80 +-163.20,19.20,2.52,0.00,1.00,-28.80,24.00 +-168.00,19.20,2.50,0.00,1.00,153.60,19.20 +-168.00,14.40,2.48,0.00,1.00,-19.20,14.40 +-172.80,9.60,2.46,0.00,1.00,163.20,14.40 +-177.60,4.80,2.44,0.00,1.00,-9.60,9.60 +-177.60,0.00,2.41,0.00,1.00,172.80,4.80 +177.60,-0.00,2.39,0.00,1.00,-0.00,0.00 +177.60,-4.80,2.37,0.00,1.00,-177.60,-0.00 +172.80,-9.60,2.35,0.00,1.00,4.80,-4.80 +168.00,-14.40,2.33,0.00,1.00,-168.00,-9.60 +168.00,-19.20,2.31,0.00,1.00,14.40,-14.40 +163.20,-19.20,2.29,0.00,1.00,-158.40,-14.40 +158.40,-24.00,2.26,0.00,1.00,24.00,-19.20 +158.40,-28.80,2.24,0.00,1.00,-148.80,-24.00 +153.60,-33.60,2.22,0.00,1.00,33.60,-28.80 +148.80,-33.60,2.20,0.00,1.00,-139.20,-28.80 +144.00,-38.40,2.18,0.00,1.00,43.20,-33.60 +139.20,-43.20,2.16,0.00,1.00,-129.60,-38.40 +134.40,-43.20,2.14,0.00,1.00,52.80,-38.40 +129.60,-48.00,2.11,0.00,1.00,-120.00,-43.20 +120.00,-48.00,2.09,0.00,1.00,62.40,-43.20 +115.20,-48.00,2.07,0.00,1.00,-110.40,-48.00 +105.60,-52.80,2.05,0.00,1.00,72.00,-48.00 +100.80,-52.80,2.03,0.00,1.00,-100.80,-48.00 +91.20,-52.80,2.01,0.00,1.00,81.60,-52.80 +86.40,-52.80,1.99,0.00,1.00,-91.20,-52.80 +76.80,-52.80,1.97,0.00,1.00,96.00,-52.80 +67.20,-52.80,1.94,0.00,1.00,-81.60,-52.80 +62.40,-48.00,1.92,0.00,1.00,105.60,-48.00 +52.80,-48.00,1.90,0.00,1.00,-72.00,-48.00 +48.00,-43.20,1.88,0.00,1.00,115.20,-48.00 +43.20,-43.20,1.86,0.00,1.00,-62.40,-43.20 +38.40,-38.40,1.84,0.00,1.00,124.80,-43.20 +33.60,-38.40,1.82,0.00,1.00,-52.80,-38.40 +28.80,-33.60,1.79,0.00,1.00,134.40,-33.60 +24.00,-28.80,1.77,0.00,1.00,-43.20,-33.60 +24.00,-24.00,1.75,0.00,1.00,144.00,-28.80 +19.20,-24.00,1.73,0.00,1.00,-33.60,-24.00 +14.40,-19.20,1.71,0.00,1.00,153.60,-24.00 +9.60,-14.40,1.69,0.00,1.00,-24.00,-19.20 +9.60,-9.60,1.67,0.00,1.00,163.20,-14.40 +4.80,-9.60,1.64,0.00,1.00,-14.40,-9.60 +4.80,-4.80,1.62,0.00,1.00,172.80,-9.60 +0.00,0.00,1.60,0.00,1.00,-4.80,-4.80 +-4.80,4.80,1.58,0.00,1.00,0.00,0.00 +-4.80,4.80,1.56,0.00,1.00,-177.60,4.80 +-9.60,9.60,1.54,0.00,1.00,9.60,4.80 +-14.40,14.40,1.52,0.00,1.00,-168.00,9.60 +-14.40,19.20,1.50,0.00,1.00,19.20,14.40 +-19.20,19.20,1.47,0.00,1.00,-158.40,19.20 +-24.00,24.00,1.45,0.00,1.00,28.80,19.20 +-28.80,28.80,1.43,0.00,1.00,-148.80,24.00 +-33.60,28.80,1.41,0.00,1.00,38.40,28.80 +-38.40,33.60,1.39,0.00,1.00,-139.20,28.80 +-43.20,38.40,1.37,0.00,1.00,48.00,33.60 +-48.00,38.40,1.35,0.00,1.00,-129.60,33.60 +-52.80,43.20,1.32,0.00,1.00,57.60,38.40 +-57.60,43.20,1.30,0.00,1.00,-120.00,38.40 +-62.40,43.20,1.28,0.00,1.00,67.20,43.20 +-72.00,48.00,1.26,0.00,1.00,-110.40,43.20 +-76.80,48.00,1.24,0.00,1.00,76.80,43.20 +-86.40,48.00,1.22,0.00,1.00,-100.80,48.00 +-91.20,48.00,1.20,0.00,1.00,86.40,48.00 +-100.80,48.00,1.17,0.00,1.00,-86.40,48.00 +-105.60,48.00,1.15,0.00,1.00,96.00,48.00 +-110.40,48.00,1.13,0.00,1.00,-76.80,48.00 +-120.00,43.20,1.11,0.00,1.00,105.60,43.20 +-124.80,43.20,1.09,0.00,1.00,-67.20,43.20 +-129.60,38.40,1.07,0.00,1.00,115.20,43.20 +-134.40,38.40,1.05,0.00,1.00,-57.60,38.40 +-139.20,33.60,1.03,0.00,1.00,124.80,38.40 +-144.00,33.60,1.00,0.00,1.00,-48.00,33.60 +-148.80,28.80,0.98,0.00,1.00,134.40,33.60 +-153.60,24.00,0.96,0.00,1.00,-38.40,28.80 +-158.40,24.00,0.94,0.00,1.00,144.00,24.00 +-163.20,19.20,0.92,0.00,1.00,-28.80,24.00 +-163.20,14.40,0.90,0.00,1.00,153.60,19.20 +-168.00,14.40,0.88,0.00,1.00,-19.20,14.40 +-172.80,9.60,0.85,0.00,1.00,163.20,14.40 +-172.80,4.80,0.83,0.00,1.00,-9.60,9.60 +-177.60,0.00,0.81,0.00,1.00,172.80,4.80 +177.60,-0.00,0.79,0.00,1.00,-0.00,0.00 +172.80,-4.80,0.77,0.00,1.00,-177.60,-0.00 +172.80,-9.60,0.75,0.00,1.00,4.80,-4.80 +168.00,-14.40,0.73,0.00,1.00,-168.00,-9.60 +163.20,-14.40,0.70,0.00,1.00,14.40,-14.40 +163.20,-19.20,0.68,0.00,1.00,-158.40,-14.40 +158.40,-24.00,0.66,0.00,1.00,24.00,-19.20 +153.60,-24.00,0.64,0.00,1.00,-148.80,-24.00 +148.80,-28.80,0.62,0.00,1.00,33.60,-24.00 +144.00,-33.60,0.60,0.00,1.00,-139.20,-28.80 +139.20,-33.60,0.58,0.00,1.00,43.20,-33.60 +134.40,-38.40,0.56,0.00,1.00,-129.60,-33.60 +129.60,-38.40,0.53,0.00,1.00,52.80,-38.40 +124.80,-43.20,0.51,0.00,1.00,-120.00,-38.40 +120.00,-43.20,0.49,0.00,1.00,62.40,-43.20 +110.40,-48.00,0.47,0.00,1.00,-110.40,-43.20 +105.60,-48.00,0.45,0.00,1.00,72.00,-43.20 +100.80,-48.00,0.43,0.00,1.00,-100.80,-48.00 +91.20,-48.00,0.41,0.00,1.00,81.60,-48.00 +86.40,-48.00,0.38,0.00,1.00,-91.20,-48.00 +76.80,-48.00,0.36,0.00,1.00,96.00,-48.00 +72.00,-48.00,0.34,0.00,1.00,-81.60,-48.00 +62.40,-43.20,0.32,0.00,1.00,105.60,-43.20 +57.60,-43.20,0.30,0.00,1.00,-72.00,-43.20 +52.80,-43.20,0.28,0.00,1.00,115.20,-43.20 +48.00,-38.40,0.26,0.00,1.00,-62.40,-38.40 +43.20,-38.40,0.23,0.00,1.00,124.80,-38.40 +38.40,-33.60,0.21,0.00,1.00,-52.80,-33.60 +33.60,-28.80,0.19,0.00,1.00,134.40,-33.60 +28.80,-28.80,0.17,0.00,1.00,-43.20,-28.80 +24.00,-24.00,0.15,0.00,1.00,144.00,-28.80 +19.20,-19.20,0.13,0.00,1.00,-33.60,-24.00 +14.40,-19.20,0.11,0.00,1.00,153.60,-19.20 +14.40,-14.40,0.09,0.00,1.00,-24.00,-19.20 +9.60,-9.60,0.06,0.00,1.00,163.20,-14.40 +4.80,-4.80,0.04,0.00,1.00,-14.40,-9.60 +4.80,-4.80,0.02,0.00,1.00,172.80,-4.80 +0.00,0.00,0.00,0.00,1.00,-4.80,-4.80 +-4.80,4.80,0.00,0.00,1.00,0.00,0.00 +-4.80,4.80,0.02,0.00,1.00,-177.60,4.80 +-9.60,9.60,0.04,0.00,1.00,9.60,4.80 +-14.40,14.40,0.06,0.00,1.00,-168.00,9.60 +-19.20,14.40,0.09,0.00,1.00,19.20,14.40 +-24.00,19.20,0.11,0.00,1.00,-158.40,14.40 +-24.00,24.00,0.13,0.00,1.00,28.80,19.20 +-28.80,24.00,0.15,0.00,1.00,-148.80,24.00 +-33.60,28.80,0.17,0.00,1.00,38.40,24.00 +-38.40,28.80,0.19,0.00,1.00,-139.20,28.80 +-43.20,33.60,0.21,0.00,1.00,48.00,28.80 +-48.00,33.60,0.23,0.00,1.00,-129.60,33.60 +-52.80,38.40,0.26,0.00,1.00,57.60,33.60 +-62.40,38.40,0.28,0.00,1.00,-120.00,38.40 +-67.20,38.40,0.30,0.00,1.00,67.20,38.40 +-72.00,43.20,0.32,0.00,1.00,-110.40,38.40 +-76.80,43.20,0.34,0.00,1.00,76.80,38.40 +-86.40,43.20,0.36,0.00,1.00,-100.80,43.20 +-91.20,43.20,0.38,0.00,1.00,86.40,43.20 +-96.00,43.20,0.41,0.00,1.00,-86.40,43.20 +-105.60,43.20,0.43,0.00,1.00,96.00,43.20 +-110.40,43.20,0.45,0.00,1.00,-76.80,43.20 +-115.20,38.40,0.47,0.00,1.00,105.60,38.40 +-124.80,38.40,0.49,0.00,1.00,-67.20,38.40 +-129.60,38.40,0.51,0.00,1.00,115.20,38.40 +-134.40,33.60,0.53,0.00,1.00,-57.60,33.60 +-139.20,33.60,0.56,0.00,1.00,124.80,33.60 +-144.00,28.80,0.58,0.00,1.00,-48.00,28.80 +-148.80,28.80,0.60,0.00,1.00,134.40,28.80 +-153.60,24.00,0.62,0.00,1.00,-38.40,24.00 +-158.40,19.20,0.64,0.00,1.00,144.00,24.00 +-158.40,19.20,0.66,0.00,1.00,-28.80,19.20 +-163.20,14.40,0.68,0.00,1.00,153.60,19.20 +-168.00,9.60,0.70,0.00,1.00,-19.20,14.40 +-172.80,9.60,0.73,0.00,1.00,163.20,9.60 +-172.80,4.80,0.75,0.00,1.00,-9.60,9.60 +-177.60,0.00,0.77,0.00,1.00,172.80,4.80 +177.60,-0.00,0.79,0.00,1.00,-0.00,0.00 +172.80,-4.80,0.81,0.00,1.00,-177.60,-0.00 +172.80,-9.60,0.83,0.00,1.00,4.80,-4.80 +168.00,-9.60,0.85,0.00,1.00,-168.00,-9.60 +163.20,-14.40,0.88,0.00,1.00,14.40,-9.60 +158.40,-19.20,0.90,0.00,1.00,-158.40,-14.40 +158.40,-19.20,0.92,0.00,1.00,24.00,-19.20 +153.60,-24.00,0.94,0.00,1.00,-148.80,-19.20 +148.80,-28.80,0.96,0.00,1.00,33.60,-24.00 +144.00,-28.80,0.98,0.00,1.00,-139.20,-24.00 +139.20,-33.60,1.00,0.00,1.00,43.20,-28.80 +134.40,-33.60,1.03,0.00,1.00,-129.60,-28.80 +129.60,-38.40,1.05,0.00,1.00,52.80,-33.60 +124.80,-38.40,1.07,0.00,1.00,-120.00,-33.60 +115.20,-38.40,1.09,0.00,1.00,62.40,-38.40 +110.40,-43.20,1.11,0.00,1.00,-110.40,-38.40 +105.60,-43.20,1.13,0.00,1.00,72.00,-38.40 +96.00,-43.20,1.15,0.00,1.00,-100.80,-43.20 +91.20,-43.20,1.17,0.00,1.00,81.60,-43.20 +86.40,-43.20,1.20,0.00,1.00,-91.20,-43.20 +76.80,-43.20,1.22,0.00,1.00,96.00,-43.20 +72.00,-43.20,1.24,0.00,1.00,-81.60,-43.20 +67.20,-38.40,1.26,0.00,1.00,105.60,-38.40 +62.40,-38.40,1.28,0.00,1.00,-72.00,-38.40 +52.80,-38.40,1.30,0.00,1.00,115.20,-38.40 +48.00,-33.60,1.32,0.00,1.00,-62.40,-38.40 +43.20,-33.60,1.35,0.00,1.00,124.80,-33.60 +38.40,-28.80,1.37,0.00,1.00,-52.80,-33.60 +33.60,-28.80,1.39,0.00,1.00,134.40,-28.80 +28.80,-24.00,1.41,0.00,1.00,-43.20,-28.80 +24.00,-24.00,1.43,0.00,1.00,144.00,-24.00 +24.00,-19.20,1.45,0.00,1.00,-33.60,-24.00 +19.20,-14.40,1.47,0.00,1.00,153.60,-19.20 +14.40,-14.40,1.50,0.00,1.00,-24.00,-14.40 +9.60,-9.60,1.52,0.00,1.00,163.20,-14.40 +4.80,-4.80,1.54,0.00,1.00,-14.40,-9.60 +4.80,-4.80,1.56,0.00,1.00,172.80,-4.80 +0.00,0.00,1.58,0.00,1.00,-4.80,-4.80 +-4.80,4.80,1.60,0.00,1.00,0.00,0.00 +-9.60,4.80,1.62,0.00,1.00,-177.60,4.80 +-9.60,9.60,1.64,0.00,1.00,9.60,4.80 +-14.40,9.60,1.67,0.00,1.00,-168.00,9.60 +-19.20,14.40,1.69,0.00,1.00,19.20,9.60 +-24.00,19.20,1.71,0.00,1.00,-158.40,14.40 +-28.80,19.20,1.73,0.00,1.00,28.80,19.20 +-33.60,24.00,1.75,0.00,1.00,-148.80,19.20 +-38.40,24.00,1.77,0.00,1.00,38.40,24.00 +-43.20,28.80,1.79,0.00,1.00,-139.20,24.00 +-48.00,28.80,1.82,0.00,1.00,48.00,28.80 +-52.80,33.60,1.84,0.00,1.00,-129.60,28.80 +-57.60,33.60,1.86,0.00,1.00,57.60,28.80 +-62.40,33.60,1.88,0.00,1.00,-120.00,33.60 +-67.20,38.40,1.90,0.00,1.00,67.20,33.60 +-72.00,38.40,1.92,0.00,1.00,-110.40,33.60 +-81.60,38.40,1.94,0.00,1.00,76.80,38.40 +-86.40,38.40,1.97,0.00,1.00,-100.80,38.40 +-91.20,38.40,1.99,0.00,1.00,86.40,38.40 +-96.00,38.40,2.01,0.00,1.00,-86.40,38.40 +-105.60,38.40,2.03,0.00,1.00,96.00,38.40 +-110.40,38.40,2.05,0.00,1.00,-76.80,38.40 +-115.20,33.60,2.07,0.00,1.00,105.60,33.60 +-120.00,33.60,2.09,0.00,1.00,-67.20,33.60 +-124.80,33.60,2.11,0.00,1.00,115.20,33.60 +-129.60,28.80,2.14,0.00,1.00,-57.60,33.60 +-134.40,28.80,2.16,0.00,1.00,124.80,28.80 +-139.20,24.00,2.18,0.00,1.00,-48.00,28.80 +-144.00,24.00,2.20,0.00,1.00,134.40,24.00 +-148.80,19.20,2.22,0.00,1.00,-38.40,24.00 +-153.60,19.20,2.24,0.00,1.00,144.00,19.20 +-158.40,14.40,2.26,0.00,1.00,-28.80,19.20 +-163.20,14.40,2.29,0.00,1.00,153.60,14.40 +-168.00,9.60,2.31,0.00,1.00,-19.20,14.40 +-172.80,9.60,2.33,0.00,1.00,163.20,9.60 +-172.80,4.80,2.35,0.00,1.00,-9.60,9.60 +-177.60,0.00,2.37,0.00,1.00,172.80,4.80 +177.60,-0.00,2.39,0.00,1.00,-0.00,0.00 +172.80,-4.80,2.41,0.00,1.00,-177.60,-0.00 +172.80,-9.60,2.44,0.00,1.00,4.80,-4.80 +168.00,-9.60,2.46,0.00,1.00,-168.00,-9.60 +163.20,-14.40,2.48,0.00,1.00,14.40,-9.60 +158.40,-14.40,2.50,0.00,1.00,-158.40,-14.40 +153.60,-19.20,2.52,0.00,1.00,24.00,-14.40 +148.80,-19.20,2.54,0.00,1.00,-148.80,-19.20 +144.00,-24.00,2.56,0.00,1.00,33.60,-19.20 +139.20,-24.00,2.58,0.00,1.00,-139.20,-24.00 +134.40,-28.80,2.61,0.00,1.00,43.20,-24.00 +129.60,-28.80,2.63,0.00,1.00,-129.60,-28.80 +124.80,-33.60,2.65,0.00,1.00,52.80,-28.80 +120.00,-33.60,2.67,0.00,1.00,-120.00,-33.60 +115.20,-33.60,2.69,0.00,1.00,62.40,-33.60 +110.40,-38.40,2.71,0.00,1.00,-110.40,-33.60 +105.60,-38.40,2.73,0.00,1.00,72.00,-33.60 +96.00,-38.40,2.76,0.00,1.00,-100.80,-38.40 +91.20,-38.40,2.78,0.00,1.00,81.60,-38.40 +86.40,-38.40,2.80,0.00,1.00,-91.20,-38.40 +81.60,-38.40,2.82,0.00,1.00,96.00,-38.40 +72.00,-38.40,2.84,0.00,1.00,-81.60,-38.40 +67.20,-38.40,2.86,0.00,1.00,105.60,-38.40 +62.40,-33.60,2.88,0.00,1.00,-72.00,-33.60 +57.60,-33.60,2.91,0.00,1.00,115.20,-33.60 +52.80,-33.60,2.93,0.00,1.00,-62.40,-33.60 +48.00,-28.80,2.95,0.00,1.00,124.80,-28.80 +43.20,-28.80,2.97,0.00,1.00,-52.80,-28.80 +38.40,-24.00,2.99,0.00,1.00,134.40,-28.80 +33.60,-24.00,3.01,0.00,1.00,-43.20,-24.00 +28.80,-19.20,3.03,0.00,1.00,144.00,-24.00 +24.00,-19.20,3.05,0.00,1.00,-33.60,-19.20 +19.20,-14.40,3.08,0.00,1.00,153.60,-19.20 +14.40,-9.60,3.10,0.00,1.00,-24.00,-14.40 +9.60,-9.60,3.12,0.00,1.00,163.20,-9.60 +9.60,-4.80,3.14,0.00,1.00,-14.40,-9.60 +4.80,-4.80,3.16,0.00,1.00,172.80,-4.80 +0.00,0.00,3.18,0.00,1.00,-4.80,-4.80 +-4.80,4.80,3.20,0.00,1.00,0.00,0.00 +-9.60,4.80,3.23,0.00,1.00,-177.60,4.80 +-14.40,9.60,3.25,0.00,1.00,9.60,4.80 +-14.40,9.60,3.27,0.00,1.00,-168.00,9.60 +-19.20,14.40,3.29,0.00,1.00,19.20,9.60 +-24.00,14.40,3.31,0.00,1.00,-158.40,14.40 +-28.80,19.20,3.33,0.00,1.00,28.80,14.40 +-33.60,19.20,3.35,0.00,1.00,-148.80,19.20 +-38.40,24.00,3.38,0.00,1.00,38.40,19.20 +-43.20,24.00,3.40,0.00,1.00,-139.20,19.20 +-48.00,24.00,3.42,0.00,1.00,48.00,24.00 +-52.80,28.80,3.44,0.00,1.00,-129.60,24.00 +-57.60,28.80,3.46,0.00,1.00,57.60,28.80 +-62.40,28.80,3.48,0.00,1.00,-120.00,28.80 +-67.20,33.60,3.50,0.00,1.00,67.20,28.80 +-72.00,33.60,3.52,0.00,1.00,-110.40,28.80 +-81.60,33.60,3.55,0.00,1.00,76.80,33.60 +-86.40,33.60,3.57,0.00,1.00,-100.80,33.60 +-91.20,33.60,3.59,0.00,1.00,86.40,33.60 +-96.00,33.60,3.61,0.00,1.00,-86.40,33.60 +-100.80,33.60,3.63,0.00,1.00,96.00,33.60 +-110.40,33.60,3.65,0.00,1.00,-76.80,33.60 +-115.20,33.60,3.67,0.00,1.00,105.60,28.80 +-120.00,28.80,3.70,0.00,1.00,-67.20,28.80 +-124.80,28.80,3.72,0.00,1.00,115.20,28.80 +-129.60,28.80,3.74,0.00,1.00,-57.60,28.80 +-134.40,24.00,3.76,0.00,1.00,124.80,24.00 +-139.20,24.00,3.78,0.00,1.00,-48.00,24.00 +-144.00,19.20,3.80,0.00,1.00,134.40,24.00 +-148.80,19.20,3.82,0.00,1.00,-38.40,19.20 +-153.60,14.40,3.85,0.00,1.00,144.00,19.20 +-158.40,14.40,3.87,0.00,1.00,-28.80,14.40 +-163.20,9.60,3.89,0.00,1.00,153.60,14.40 +-168.00,9.60,3.91,0.00,1.00,-19.20,9.60 +-168.00,4.80,3.93,0.00,1.00,163.20,9.60 +-172.80,4.80,3.95,0.00,1.00,-9.60,4.80 +-177.60,0.00,3.97,0.00,1.00,172.80,4.80 +177.60,-0.00,3.99,0.00,1.00,-0.00,0.00 +172.80,-4.80,4.02,0.00,1.00,-177.60,-0.00 +168.00,-4.80,4.04,0.00,1.00,4.80,-4.80 +168.00,-9.60,4.06,0.00,1.00,-168.00,-4.80 +163.20,-9.60,4.08,0.00,1.00,14.40,-9.60 +158.40,-14.40,4.10,0.00,1.00,-158.40,-9.60 +153.60,-14.40,4.12,0.00,1.00,24.00,-14.40 +148.80,-19.20,4.14,0.00,1.00,-148.80,-14.40 +144.00,-19.20,4.17,0.00,1.00,33.60,-19.20 +139.20,-24.00,4.19,0.00,1.00,-139.20,-19.20 +134.40,-24.00,4.21,0.00,1.00,43.20,-24.00 +129.60,-28.80,4.23,0.00,1.00,-129.60,-24.00 +124.80,-28.80,4.25,0.00,1.00,52.80,-24.00 +120.00,-28.80,4.27,0.00,1.00,-120.00,-28.80 +115.20,-33.60,4.29,0.00,1.00,62.40,-28.80 +110.40,-33.60,4.32,0.00,1.00,-110.40,-28.80 +100.80,-33.60,4.34,0.00,1.00,72.00,-28.80 +96.00,-33.60,4.36,0.00,1.00,-100.80,-33.60 +91.20,-33.60,4.38,0.00,1.00,81.60,-33.60 +86.40,-33.60,4.40,0.00,1.00,-91.20,-33.60 +81.60,-33.60,4.42,0.00,1.00,96.00,-33.60 +72.00,-33.60,4.44,0.00,1.00,-81.60,-33.60 +67.20,-33.60,4.46,0.00,1.00,105.60,-33.60 +62.40,-28.80,4.49,0.00,1.00,-72.00,-28.80 +57.60,-28.80,4.51,0.00,1.00,115.20,-28.80 +52.80,-28.80,4.53,0.00,1.00,-62.40,-28.80 +48.00,-24.00,4.55,0.00,1.00,124.80,-28.80 +43.20,-24.00,4.57,0.00,1.00,-52.80,-24.00 +38.40,-24.00,4.59,0.00,1.00,134.40,-24.00 +33.60,-19.20,4.61,0.00,1.00,-43.20,-19.20 +28.80,-19.20,4.64,0.00,1.00,144.00,-19.20 +24.00,-14.40,4.66,0.00,1.00,-33.60,-19.20 +19.20,-14.40,4.68,0.00,1.00,153.60,-14.40 +14.40,-9.60,4.70,0.00,1.00,-24.00,-14.40 +14.40,-9.60,4.72,0.00,1.00,163.20,-9.60 +9.60,-4.80,4.74,0.00,1.00,-14.40,-9.60 +4.80,-4.80,4.76,0.00,1.00,172.80,-4.80 +0.00,0.00,4.79,0.00,1.00,-4.80,-4.80 +-4.80,0.00,4.81,0.00,1.00,0.00,0.00 +-9.60,4.80,4.83,0.00,1.00,-177.60,0.00 +-14.40,4.80,4.85,0.00,1.00,9.60,4.80 +-19.20,9.60,4.87,0.00,1.00,-168.00,4.80 +-19.20,9.60,4.89,0.00,1.00,19.20,9.60 +-24.00,14.40,4.91,0.00,1.00,-158.40,9.60 +-28.80,14.40,4.93,0.00,1.00,28.80,14.40 +-33.60,19.20,4.96,0.00,1.00,-148.80,14.40 +-38.40,19.20,4.98,0.00,1.00,38.40,14.40 +-43.20,19.20,5.00,0.00,1.00,-139.20,19.20 +-48.00,24.00,5.02,0.00,1.00,48.00,19.20 +-52.80,24.00,5.04,0.00,1.00,-129.60,24.00 +-57.60,24.00,5.06,0.00,1.00,57.60,24.00 +-62.40,24.00,5.08,0.00,1.00,-120.00,24.00 +-72.00,28.80,5.11,0.00,1.00,67.20,24.00 +-76.80,28.80,5.13,0.00,1.00,-110.40,24.00 +-81.60,28.80,5.15,0.00,1.00,76.80,28.80 +-86.40,28.80,5.17,0.00,1.00,-100.80,28.80 +-91.20,28.80,5.19,0.00,1.00,86.40,28.80 +-96.00,28.80,5.21,0.00,1.00,-86.40,28.80 +-100.80,28.80,5.23,0.00,1.00,96.00,28.80 +-105.60,28.80,5.26,0.00,1.00,-76.80,28.80 +-115.20,28.80,5.28,0.00,1.00,105.60,28.80 +-120.00,24.00,5.30,0.00,1.00,-67.20,24.00 +-124.80,24.00,5.32,0.00,1.00,115.20,24.00 +-129.60,24.00,5.34,0.00,1.00,-57.60,24.00 +-134.40,24.00,5.36,0.00,1.00,124.80,24.00 +-139.20,19.20,5.38,0.00,1.00,-48.00,19.20 +-144.00,19.20,5.40,0.00,1.00,134.40,19.20 +-148.80,14.40,5.43,0.00,1.00,-38.40,19.20 +-153.60,14.40,5.45,0.00,1.00,144.00,14.40 +-158.40,14.40,5.47,0.00,1.00,-28.80,14.40 +-163.20,9.60,5.49,0.00,1.00,153.60,9.60 +-163.20,9.60,5.51,0.00,1.00,-19.20,9.60 +-168.00,4.80,5.53,0.00,1.00,163.20,9.60 +-172.80,4.80,5.55,0.00,1.00,-9.60,4.80 +-177.60,0.00,5.58,0.00,1.00,172.80,4.80 +177.60,-0.00,5.60,0.00,1.00,-0.00,0.00 +172.80,-4.80,5.62,0.00,1.00,-177.60,-0.00 +168.00,-4.80,5.64,0.00,1.00,4.80,-4.80 +163.20,-9.60,5.66,0.00,1.00,-168.00,-4.80 +163.20,-9.60,5.68,0.00,1.00,14.40,-9.60 +158.40,-14.40,5.70,0.00,1.00,-158.40,-9.60 +153.60,-14.40,5.72,0.00,1.00,24.00,-9.60 +148.80,-14.40,5.75,0.00,1.00,-148.80,-14.40 +144.00,-19.20,5.77,0.00,1.00,33.60,-14.40 +139.20,-19.20,5.79,0.00,1.00,-139.20,-19.20 +134.40,-24.00,5.81,0.00,1.00,43.20,-19.20 +129.60,-24.00,5.83,0.00,1.00,-129.60,-19.20 +124.80,-24.00,5.85,0.00,1.00,52.80,-24.00 +120.00,-24.00,5.87,0.00,1.00,-120.00,-24.00 +115.20,-28.80,5.90,0.00,1.00,62.40,-24.00 +105.60,-28.80,5.92,0.00,1.00,-110.40,-24.00 +100.80,-28.80,5.94,0.00,1.00,72.00,-28.80 +96.00,-28.80,5.96,0.00,1.00,-100.80,-28.80 +91.20,-28.80,5.98,0.00,1.00,81.60,-28.80 +86.40,-28.80,6.00,0.00,1.00,-91.20,-28.80 +81.60,-28.80,6.02,0.00,1.00,96.00,-28.80 +76.80,-28.80,6.05,0.00,1.00,-81.60,-28.80 +72.00,-28.80,6.07,0.00,1.00,105.60,-28.80 +62.40,-24.00,6.09,0.00,1.00,-72.00,-24.00 +57.60,-24.00,6.11,0.00,1.00,115.20,-24.00 +52.80,-24.00,6.13,0.00,1.00,-62.40,-24.00 +48.00,-24.00,6.15,0.00,1.00,124.80,-24.00 +43.20,-19.20,6.17,0.00,1.00,-52.80,-24.00 +38.40,-19.20,6.19,0.00,1.00,134.40,-19.20 +33.60,-19.20,6.22,0.00,1.00,-43.20,-19.20 +28.80,-14.40,6.24,0.00,1.00,144.00,-14.40 +24.00,-14.40,6.26,0.00,1.00,-33.60,-14.40 +19.20,-9.60,6.28,0.00,1.00,153.60,-14.40 +19.20,-9.60,6.30,0.00,1.00,-24.00,-9.60 +14.40,-4.80,6.32,0.00,1.00,163.20,-9.60 +9.60,-4.80,6.34,0.00,1.00,-14.40,-4.80 +4.80,-0.00,6.37,0.00,1.00,172.80,-4.80 +0.00,0.00,6.39,0.00,1.00,-4.80,-0.00 +-4.80,0.00,6.41,0.00,1.00,0.00,0.00 +-9.60,4.80,6.43,0.00,1.00,-177.60,0.00 +-14.40,4.80,6.45,0.00,1.00,9.60,4.80 +-19.20,9.60,6.47,0.00,1.00,-168.00,4.80 +-24.00,9.60,6.49,0.00,1.00,19.20,9.60 +-28.80,9.60,6.52,0.00,1.00,-158.40,9.60 +-33.60,14.40,6.54,0.00,1.00,28.80,9.60 +-33.60,14.40,6.56,0.00,1.00,-148.80,14.40 +-38.40,14.40,6.58,0.00,1.00,38.40,14.40 +-43.20,19.20,6.60,0.00,1.00,-139.20,14.40 +-48.00,19.20,6.62,0.00,1.00,48.00,14.40 +-57.60,19.20,6.64,0.00,1.00,-129.60,19.20 +-62.40,19.20,6.66,0.00,1.00,57.60,19.20 +-67.20,24.00,6.69,0.00,1.00,-120.00,19.20 +-72.00,24.00,6.71,0.00,1.00,67.20,19.20 +-76.80,24.00,6.73,0.00,1.00,-110.40,24.00 +-81.60,24.00,6.75,0.00,1.00,76.80,24.00 +-86.40,24.00,6.77,0.00,1.00,-100.80,24.00 +-91.20,24.00,6.79,0.00,1.00,86.40,24.00 +-96.00,24.00,6.81,0.00,1.00,-86.40,24.00 +-100.80,24.00,6.84,0.00,1.00,96.00,24.00 +-105.60,24.00,6.86,0.00,1.00,-76.80,24.00 +-110.40,24.00,6.88,0.00,1.00,105.60,24.00 +-115.20,19.20,6.90,0.00,1.00,-67.20,19.20 +-120.00,19.20,6.92,0.00,1.00,115.20,19.20 +-129.60,19.20,6.94,0.00,1.00,-57.60,19.20 +-134.40,19.20,6.96,0.00,1.00,124.80,19.20 +-139.20,19.20,6.99,0.00,1.00,-48.00,19.20 +-144.00,14.40,7.01,0.00,1.00,134.40,14.40 +-148.80,14.40,7.03,0.00,1.00,-38.40,14.40 +-148.80,14.40,7.05,0.00,1.00,144.00,14.40 +-153.60,9.60,7.07,0.00,1.00,-28.80,9.60 +-158.40,9.60,7.09,0.00,1.00,153.60,9.60 +-163.20,4.80,7.11,0.00,1.00,-19.20,9.60 +-168.00,4.80,7.13,0.00,1.00,163.20,4.80 +-172.80,4.80,7.16,0.00,1.00,-9.60,4.80 +-177.60,0.00,7.18,0.00,1.00,172.80,4.80 +177.60,-0.00,7.20,0.00,1.00,-0.00,0.00 +172.80,-4.80,7.22,0.00,1.00,-177.60,-0.00 +168.00,-4.80,7.24,0.00,1.00,4.80,-4.80 +163.20,-4.80,7.26,0.00,1.00,-168.00,-4.80 +158.40,-9.60,7.28,0.00,1.00,14.40,-4.80 +153.60,-9.60,7.31,0.00,1.00,-158.40,-9.60 +148.80,-14.40,7.33,0.00,1.00,24.00,-9.60 +148.80,-14.40,7.35,0.00,1.00,-148.80,-9.60 +144.00,-14.40,7.37,0.00,1.00,33.60,-14.40 +139.20,-19.20,7.39,0.00,1.00,-139.20,-14.40 +134.40,-19.20,7.41,0.00,1.00,43.20,-14.40 +129.60,-19.20,7.43,0.00,1.00,-129.60,-19.20 +120.00,-19.20,7.46,0.00,1.00,52.80,-19.20 +115.20,-19.20,7.48,0.00,1.00,-120.00,-19.20 +110.40,-24.00,7.50,0.00,1.00,62.40,-19.20 +105.60,-24.00,7.52,0.00,1.00,-110.40,-19.20 +100.80,-24.00,7.54,0.00,1.00,72.00,-24.00 +96.00,-24.00,7.56,0.00,1.00,-100.80,-24.00 +91.20,-24.00,7.58,0.00,1.00,81.60,-24.00 +86.40,-24.00,7.60,0.00,1.00,-91.20,-24.00 +81.60,-24.00,7.63,0.00,1.00,96.00,-24.00 +76.80,-24.00,7.65,0.00,1.00,-81.60,-24.00 +72.00,-24.00,7.67,0.00,1.00,105.60,-24.00 +67.20,-24.00,7.69,0.00,1.00,-72.00,-24.00 +62.40,-19.20,7.71,0.00,1.00,115.20,-19.20 +57.60,-19.20,7.73,0.00,1.00,-62.40,-19.20 +48.00,-19.20,7.75,0.00,1.00,124.80,-19.20 +43.20,-19.20,7.78,0.00,1.00,-52.80,-19.20 +38.40,-14.40,7.80,0.00,1.00,134.40,-14.40 +33.60,-14.40,7.82,0.00,1.00,-43.20,-14.40 +33.60,-14.40,7.84,0.00,1.00,144.00,-14.40 +28.80,-9.60,7.86,0.00,1.00,-33.60,-14.40 +24.00,-9.60,7.88,0.00,1.00,153.60,-9.60 +19.20,-9.60,7.90,0.00,1.00,-24.00,-9.60 +14.40,-4.80,7.93,0.00,1.00,163.20,-9.60 +9.60,-4.80,7.95,0.00,1.00,-14.40,-4.80 +4.80,-0.00,7.97,0.00,1.00,172.80,-4.80 +0.00,0.00,7.99,0.00,1.00,-4.80,-0.00 +-4.80,0.00,8.01,0.00,1.00,0.00,0.00 +-9.60,4.80,8.03,0.00,1.00,-177.60,0.00 +-14.40,4.80,8.05,0.00,1.00,9.60,4.80 +-19.20,4.80,8.07,0.00,1.00,-168.00,4.80 +-24.00,9.60,8.10,0.00,1.00,19.20,4.80 +-28.80,9.60,8.12,0.00,1.00,-158.40,9.60 +-33.60,9.60,8.14,0.00,1.00,24.00,9.60 +-38.40,9.60,8.16,0.00,1.00,-148.80,9.60 +-43.20,14.40,8.18,0.00,1.00,33.60,9.60 +-48.00,14.40,8.20,0.00,1.00,-139.20,14.40 +-52.80,14.40,8.22,0.00,1.00,43.20,14.40 +-57.60,14.40,8.25,0.00,1.00,-129.60,14.40 +-62.40,19.20,8.27,0.00,1.00,52.80,14.40 +-67.20,19.20,8.29,0.00,1.00,-120.00,14.40 +-72.00,19.20,8.31,0.00,1.00,62.40,14.40 +-76.80,19.20,8.33,0.00,1.00,-110.40,19.20 +-81.60,19.20,8.35,0.00,1.00,76.80,19.20 +-86.40,19.20,8.37,0.00,1.00,-100.80,19.20 +-91.20,19.20,8.40,0.00,1.00,86.40,19.20 +-96.00,19.20,8.42,0.00,1.00,-86.40,19.20 +-100.80,19.20,8.44,0.00,1.00,96.00,19.20 +-105.60,19.20,8.46,0.00,1.00,-76.80,19.20 +-110.40,19.20,8.48,0.00,1.00,105.60,19.20 +-115.20,19.20,8.50,0.00,1.00,-67.20,19.20 +-120.00,14.40,8.52,0.00,1.00,120.00,14.40 +-124.80,14.40,8.54,0.00,1.00,-57.60,14.40 +-129.60,14.40,8.57,0.00,1.00,129.60,14.40 +-134.40,14.40,8.59,0.00,1.00,-48.00,14.40 +-139.20,14.40,8.61,0.00,1.00,139.20,14.40 +-144.00,9.60,8.63,0.00,1.00,-38.40,9.60 +-148.80,9.60,8.65,0.00,1.00,148.80,9.60 +-153.60,9.60,8.67,0.00,1.00,-28.80,9.60 +-158.40,4.80,8.69,0.00,1.00,158.40,9.60 +-163.20,4.80,8.72,0.00,1.00,-19.20,4.80 +-168.00,4.80,8.74,0.00,1.00,163.20,4.80 +-172.80,0.00,8.76,0.00,1.00,-9.60,4.80 +-177.60,0.00,8.78,0.00,1.00,172.80,0.00 +177.60,-0.00,8.80,0.00,1.00,-0.00,0.00 +172.80,-0.00,8.82,0.00,1.00,-177.60,-0.00 +168.00,-4.80,8.84,0.00,1.00,4.80,-0.00 +163.20,-4.80,8.87,0.00,1.00,-168.00,-4.80 +158.40,-4.80,8.89,0.00,1.00,14.40,-4.80 +153.60,-9.60,8.91,0.00,1.00,-158.40,-4.80 +148.80,-9.60,8.93,0.00,1.00,24.00,-9.60 +144.00,-9.60,8.95,0.00,1.00,-153.60,-9.60 +139.20,-14.40,8.97,0.00,1.00,33.60,-9.60 +134.40,-14.40,8.99,0.00,1.00,-144.00,-9.60 +129.60,-14.40,9.01,0.00,1.00,43.20,-14.40 +124.80,-14.40,9.04,0.00,1.00,-134.40,-14.40 +120.00,-14.40,9.06,0.00,1.00,52.80,-14.40 +115.20,-19.20,9.08,0.00,1.00,-124.80,-14.40 +110.40,-19.20,9.10,0.00,1.00,62.40,-14.40 +105.60,-19.20,9.12,0.00,1.00,-110.40,-19.20 +100.80,-19.20,9.14,0.00,1.00,72.00,-19.20 +96.00,-19.20,9.16,0.00,1.00,-100.80,-19.20 +91.20,-19.20,9.19,0.00,1.00,81.60,-19.20 +86.40,-19.20,9.21,0.00,1.00,-91.20,-19.20 +81.60,-19.20,9.23,0.00,1.00,96.00,-19.20 +76.80,-19.20,9.25,0.00,1.00,-81.60,-19.20 +72.00,-19.20,9.27,0.00,1.00,105.60,-19.20 +67.20,-19.20,9.29,0.00,1.00,-72.00,-19.20 +62.40,-19.20,9.31,0.00,1.00,115.20,-14.40 +57.60,-14.40,9.34,0.00,1.00,-57.60,-14.40 +52.80,-14.40,9.36,0.00,1.00,124.80,-14.40 +48.00,-14.40,9.38,0.00,1.00,-48.00,-14.40 +43.20,-14.40,9.40,0.00,1.00,134.40,-14.40 +38.40,-9.60,9.42,0.00,1.00,-38.40,-14.40 +33.60,-9.60,9.44,0.00,1.00,144.00,-9.60 +28.80,-9.60,9.46,0.00,1.00,-28.80,-9.60 +24.00,-9.60,9.48,0.00,1.00,153.60,-9.60 +19.20,-4.80,9.51,0.00,1.00,-24.00,-9.60 +14.40,-4.80,9.53,0.00,1.00,163.20,-4.80 +9.60,-4.80,9.55,0.00,1.00,-14.40,-4.80 +4.80,-0.00,9.57,0.00,1.00,172.80,-4.80 +0.00,0.00,9.59,0.00,1.00,-4.80,-0.00 +-4.80,0.00,9.61,0.00,1.00,0.00,0.00 +-9.60,0.00,9.63,0.00,1.00,-177.60,0.00 +-14.40,4.80,9.66,0.00,1.00,9.60,0.00 +-19.20,4.80,9.68,0.00,1.00,-168.00,4.80 +-24.00,4.80,9.70,0.00,1.00,14.40,4.80 +-28.80,4.80,9.72,0.00,1.00,-158.40,4.80 +-33.60,9.60,9.74,0.00,1.00,24.00,4.80 +-38.40,9.60,9.76,0.00,1.00,-148.80,9.60 +-43.20,9.60,9.78,0.00,1.00,33.60,9.60 +-48.00,9.60,9.81,0.00,1.00,-139.20,9.60 +-52.80,9.60,9.83,0.00,1.00,43.20,9.60 +-57.60,14.40,9.85,0.00,1.00,-129.60,9.60 +-62.40,14.40,9.87,0.00,1.00,52.80,9.60 +-67.20,14.40,9.89,0.00,1.00,-120.00,9.60 +-72.00,14.40,9.91,0.00,1.00,62.40,14.40 +-76.80,14.40,9.93,0.00,1.00,-110.40,14.40 +-81.60,14.40,9.95,0.00,1.00,76.80,14.40 +-86.40,14.40,9.98,0.00,1.00,-100.80,14.40 +-91.20,14.40,10.00,0.00,1.00,86.40,14.40 +-96.00,14.40,10.02,0.00,1.00,-86.40,14.40 +-100.80,14.40,10.04,0.00,1.00,96.00,14.40 +-105.60,14.40,10.06,0.00,1.00,-76.80,14.40 +-110.40,14.40,10.08,0.00,1.00,110.40,14.40 +-115.20,14.40,10.10,0.00,1.00,-67.20,14.40 +-120.00,14.40,10.13,0.00,1.00,120.00,9.60 +-124.80,9.60,10.15,0.00,1.00,-57.60,9.60 +-129.60,9.60,10.17,0.00,1.00,129.60,9.60 +-134.40,9.60,10.19,0.00,1.00,-48.00,9.60 +-139.20,9.60,10.21,0.00,1.00,139.20,9.60 +-144.00,9.60,10.23,0.00,1.00,-38.40,9.60 +-148.80,9.60,10.25,0.00,1.00,148.80,9.60 +-153.60,4.80,10.28,0.00,1.00,-28.80,4.80 +-158.40,4.80,10.30,0.00,1.00,158.40,4.80 +-163.20,4.80,10.32,0.00,1.00,-19.20,4.80 +-168.00,4.80,10.34,0.00,1.00,168.00,4.80 +-172.80,0.00,10.36,0.00,1.00,-9.60,4.80 +-177.60,0.00,10.38,0.00,1.00,172.80,0.00 +177.60,-0.00,10.40,0.00,1.00,-0.00,0.00 +172.80,-0.00,10.42,0.00,1.00,-177.60,-0.00 +168.00,-4.80,10.45,0.00,1.00,4.80,-0.00 +163.20,-4.80,10.47,0.00,1.00,-168.00,-4.80 +158.40,-4.80,10.49,0.00,1.00,14.40,-4.80 +153.60,-4.80,10.51,0.00,1.00,-163.20,-4.80 +148.80,-9.60,10.53,0.00,1.00,24.00,-4.80 +144.00,-9.60,10.55,0.00,1.00,-153.60,-4.80 +139.20,-9.60,10.57,0.00,1.00,33.60,-9.60 +134.40,-9.60,10.60,0.00,1.00,-144.00,-9.60 +129.60,-9.60,10.62,0.00,1.00,43.20,-9.60 +124.80,-9.60,10.64,0.00,1.00,-134.40,-9.60 +120.00,-14.40,10.66,0.00,1.00,52.80,-9.60 +115.20,-14.40,10.68,0.00,1.00,-124.80,-9.60 +110.40,-14.40,10.70,0.00,1.00,62.40,-9.60 +105.60,-14.40,10.72,0.00,1.00,-115.20,-14.40 +100.80,-14.40,10.74,0.00,1.00,72.00,-14.40 +96.00,-14.40,10.77,0.00,1.00,-100.80,-14.40 +91.20,-14.40,10.79,0.00,1.00,81.60,-14.40 +86.40,-14.40,10.81,0.00,1.00,-91.20,-14.40 +81.60,-14.40,10.83,0.00,1.00,96.00,-14.40 +76.80,-14.40,10.85,0.00,1.00,-81.60,-14.40 +72.00,-14.40,10.87,0.00,1.00,105.60,-14.40 +67.20,-14.40,10.89,0.00,1.00,-67.20,-14.40 +62.40,-14.40,10.92,0.00,1.00,115.20,-14.40 +57.60,-14.40,10.94,0.00,1.00,-57.60,-9.60 +52.80,-9.60,10.96,0.00,1.00,124.80,-9.60 +48.00,-9.60,10.98,0.00,1.00,-48.00,-9.60 +43.20,-9.60,11.00,0.00,1.00,134.40,-9.60 +38.40,-9.60,11.02,0.00,1.00,-38.40,-9.60 +33.60,-9.60,11.04,0.00,1.00,144.00,-9.60 +28.80,-4.80,11.07,0.00,1.00,-28.80,-9.60 +24.00,-4.80,11.09,0.00,1.00,153.60,-4.80 +19.20,-4.80,11.11,0.00,1.00,-19.20,-4.80 +14.40,-4.80,11.13,0.00,1.00,163.20,-4.80 +9.60,-0.00,11.15,0.00,1.00,-14.40,-4.80 +4.80,-0.00,11.17,0.00,1.00,172.80,-0.00 +0.00,0.00,11.19,0.00,1.00,-4.80,-0.00 +-4.80,0.00,11.21,0.00,1.00,0.00,0.00 +-9.60,0.00,11.24,0.00,1.00,-177.60,0.00 +-14.40,0.00,11.26,0.00,1.00,9.60,0.00 +-19.20,4.80,11.28,0.00,1.00,-168.00,0.00 +-24.00,4.80,11.30,0.00,1.00,14.40,4.80 +-28.80,4.80,11.32,0.00,1.00,-158.40,4.80 +-33.60,4.80,11.34,0.00,1.00,24.00,4.80 +-38.40,4.80,11.36,0.00,1.00,-153.60,4.80 +-43.20,4.80,11.39,0.00,1.00,33.60,4.80 +-48.00,4.80,11.41,0.00,1.00,-144.00,4.80 +-52.80,9.60,11.43,0.00,1.00,43.20,4.80 +-57.60,9.60,11.45,0.00,1.00,-134.40,4.80 +-62.40,9.60,11.47,0.00,1.00,52.80,4.80 +-67.20,9.60,11.49,0.00,1.00,-124.80,9.60 +-72.00,9.60,11.51,0.00,1.00,62.40,9.60 +-76.80,9.60,11.54,0.00,1.00,-110.40,9.60 +-81.60,9.60,11.56,0.00,1.00,72.00,9.60 +-86.40,9.60,11.58,0.00,1.00,-100.80,9.60 +-91.20,9.60,11.60,0.00,1.00,86.40,9.60 +-96.00,9.60,11.62,0.00,1.00,-86.40,9.60 +-100.80,9.60,11.64,0.00,1.00,96.00,9.60 +-105.60,9.60,11.66,0.00,1.00,-76.80,9.60 +-110.40,9.60,11.68,0.00,1.00,110.40,9.60 +-115.20,9.60,11.71,0.00,1.00,-67.20,9.60 +-120.00,9.60,11.73,0.00,1.00,120.00,9.60 +-124.80,9.60,11.75,0.00,1.00,-52.80,9.60 +-129.60,9.60,11.77,0.00,1.00,129.60,4.80 +-134.40,4.80,11.79,0.00,1.00,-43.20,4.80 +-139.20,4.80,11.81,0.00,1.00,139.20,4.80 +-144.00,4.80,11.83,0.00,1.00,-33.60,4.80 +-148.80,4.80,11.86,0.00,1.00,148.80,4.80 +-153.60,4.80,11.88,0.00,1.00,-24.00,4.80 +-158.40,4.80,11.90,0.00,1.00,158.40,4.80 +-163.20,4.80,11.92,0.00,1.00,-19.20,4.80 +-168.00,0.00,11.94,0.00,1.00,168.00,4.80 +-172.80,0.00,11.96,0.00,1.00,-9.60,0.00 +-177.60,0.00,11.98,0.00,1.00,172.80,0.00 +177.60,-0.00,12.01,0.00,1.00,-0.00,0.00 +172.80,-0.00,12.03,0.00,1.00,-177.60,-0.00 +168.00,-0.00,12.05,0.00,1.00,4.80,-0.00 +163.20,-4.80,12.07,0.00,1.00,-168.00,-0.00 +158.40,-4.80,12.09,0.00,1.00,14.40,-4.80 +153.60,-4.80,12.11,0.00,1.00,-163.20,-4.80 +148.80,-4.80,12.13,0.00,1.00,24.00,-4.80 +144.00,-4.80,12.15,0.00,1.00,-153.60,-4.80 +139.20,-4.80,12.18,0.00,1.00,28.80,-4.80 +134.40,-4.80,12.20,0.00,1.00,-144.00,-4.80 +129.60,-9.60,12.22,0.00,1.00,38.40,-4.80 +124.80,-9.60,12.24,0.00,1.00,-134.40,-4.80 +120.00,-9.60,12.26,0.00,1.00,48.00,-4.80 +115.20,-9.60,12.28,0.00,1.00,-124.80,-9.60 +110.40,-9.60,12.30,0.00,1.00,57.60,-9.60 +105.60,-9.60,12.33,0.00,1.00,-115.20,-9.60 +100.80,-9.60,12.35,0.00,1.00,72.00,-9.60 +96.00,-9.60,12.37,0.00,1.00,-105.60,-9.60 +91.20,-9.60,12.39,0.00,1.00,81.60,-9.60 +86.40,-9.60,12.41,0.00,1.00,-91.20,-9.60 +81.60,-9.60,12.43,0.00,1.00,96.00,-9.60 +76.80,-9.60,12.45,0.00,1.00,-81.60,-9.60 +72.00,-9.60,12.48,0.00,1.00,105.60,-9.60 +67.20,-9.60,12.50,0.00,1.00,-67.20,-9.60 +62.40,-9.60,12.52,0.00,1.00,120.00,-9.60 +57.60,-9.60,12.54,0.00,1.00,-57.60,-9.60 +52.80,-9.60,12.56,0.00,1.00,129.60,-4.80 +48.00,-4.80,12.58,0.00,1.00,-48.00,-4.80 +43.20,-4.80,12.60,0.00,1.00,139.20,-4.80 +38.40,-4.80,12.62,0.00,1.00,-38.40,-4.80 +33.60,-4.80,12.65,0.00,1.00,148.80,-4.80 +28.80,-4.80,12.67,0.00,1.00,-28.80,-4.80 +24.00,-4.80,12.69,0.00,1.00,158.40,-4.80 +19.20,-4.80,12.71,0.00,1.00,-19.20,-4.80 +14.40,-0.00,12.73,0.00,1.00,163.20,-4.80 +9.60,-0.00,12.75,0.00,1.00,-9.60,-0.00 +4.80,-0.00,12.77,0.00,1.00,172.80,-0.00 +0.00,0.00,12.80,0.00,1.00,-4.80,-0.00 +-4.80,0.00,12.82,0.00,1.00,0.00,0.00 +-9.60,0.00,12.84,0.00,1.00,-177.60,0.00 +-14.40,0.00,12.86,0.00,1.00,9.60,0.00 +-19.20,0.00,12.88,0.00,1.00,-168.00,0.00 +-24.00,0.00,12.90,0.00,1.00,14.40,0.00 +-28.80,0.00,12.92,0.00,1.00,-163.20,0.00 +-33.60,4.80,12.95,0.00,1.00,24.00,0.00 +-38.40,4.80,12.97,0.00,1.00,-153.60,0.00 +-43.20,4.80,12.99,0.00,1.00,28.80,0.00 +-48.00,4.80,13.01,0.00,1.00,-144.00,4.80 +-52.80,4.80,13.03,0.00,1.00,38.40,4.80 +-57.60,4.80,13.05,0.00,1.00,-134.40,4.80 +-62.40,4.80,13.07,0.00,1.00,48.00,4.80 +-67.20,4.80,13.09,0.00,1.00,-124.80,4.80 +-72.00,4.80,13.12,0.00,1.00,62.40,4.80 +-76.80,4.80,13.14,0.00,1.00,-115.20,4.80 +-81.60,4.80,13.16,0.00,1.00,72.00,4.80 +-86.40,4.80,13.18,0.00,1.00,-100.80,4.80 +-91.20,4.80,13.20,0.00,1.00,86.40,4.80 +-96.00,4.80,13.22,0.00,1.00,-86.40,4.80 +-100.80,4.80,13.24,0.00,1.00,96.00,4.80 +-105.60,4.80,13.27,0.00,1.00,-76.80,4.80 +-110.40,4.80,13.29,0.00,1.00,110.40,4.80 +-115.20,4.80,13.31,0.00,1.00,-62.40,4.80 +-120.00,4.80,13.33,0.00,1.00,120.00,4.80 +-124.80,4.80,13.35,0.00,1.00,-52.80,4.80 +-129.60,4.80,13.37,0.00,1.00,134.40,4.80 +-134.40,4.80,13.39,0.00,1.00,-43.20,4.80 +-139.20,4.80,13.42,0.00,1.00,144.00,4.80 +-144.00,4.80,13.44,0.00,1.00,-33.60,0.00 +-148.80,4.80,13.46,0.00,1.00,153.60,0.00 +-153.60,0.00,13.48,0.00,1.00,-24.00,0.00 +-158.40,0.00,13.50,0.00,1.00,158.40,0.00 +-163.20,0.00,13.52,0.00,1.00,-14.40,0.00 +-168.00,0.00,13.54,0.00,1.00,168.00,0.00 +-172.80,0.00,13.56,0.00,1.00,-9.60,0.00 +-177.60,0.00,13.59,0.00,1.00,172.80,0.00 +177.60,-0.00,13.61,0.00,1.00,-0.00,0.00 +172.80,-0.00,13.63,0.00,1.00,-177.60,-0.00 +168.00,-0.00,13.65,0.00,1.00,4.80,-0.00 +163.20,-0.00,13.67,0.00,1.00,-172.80,-0.00 +158.40,-0.00,13.69,0.00,1.00,14.40,-0.00 +153.60,-0.00,13.71,0.00,1.00,-163.20,-0.00 +148.80,-4.80,13.74,0.00,1.00,19.20,-0.00 +144.00,-4.80,13.76,0.00,1.00,-153.60,-0.00 +139.20,-4.80,13.78,0.00,1.00,28.80,-0.00 +134.40,-4.80,13.80,0.00,1.00,-148.80,-0.00 +129.60,-4.80,13.82,0.00,1.00,38.40,-4.80 +124.80,-4.80,13.84,0.00,1.00,-139.20,-4.80 +120.00,-4.80,13.86,0.00,1.00,48.00,-4.80 +115.20,-4.80,13.89,0.00,1.00,-129.60,-4.80 +110.40,-4.80,13.91,0.00,1.00,57.60,-4.80 +105.60,-4.80,13.93,0.00,1.00,-115.20,-4.80 +100.80,-4.80,13.95,0.00,1.00,67.20,-4.80 +96.00,-4.80,13.97,0.00,1.00,-105.60,-4.80 +91.20,-4.80,13.99,0.00,1.00,81.60,-4.80 +86.40,-4.80,14.01,0.00,1.00,-91.20,-4.80 +81.60,-4.80,14.03,0.00,1.00,96.00,-4.80 +76.80,-4.80,14.06,0.00,1.00,-76.80,-4.80 +72.00,-4.80,14.08,0.00,1.00,105.60,-4.80 +67.20,-4.80,14.10,0.00,1.00,-67.20,-4.80 +62.40,-4.80,14.12,0.00,1.00,120.00,-4.80 +57.60,-4.80,14.14,0.00,1.00,-52.80,-4.80 +52.80,-4.80,14.16,0.00,1.00,129.60,-4.80 +48.00,-4.80,14.18,0.00,1.00,-43.20,-4.80 +43.20,-4.80,14.21,0.00,1.00,139.20,-4.80 +38.40,-4.80,14.23,0.00,1.00,-33.60,-4.80 +33.60,-4.80,14.25,0.00,1.00,148.80,-0.00 +28.80,-0.00,14.27,0.00,1.00,-28.80,-0.00 +24.00,-0.00,14.29,0.00,1.00,158.40,-0.00 +19.20,-0.00,14.31,0.00,1.00,-19.20,-0.00 +14.40,-0.00,14.33,0.00,1.00,163.20,-0.00 +9.60,-0.00,14.36,0.00,1.00,-9.60,-0.00 +4.80,-0.00,14.38,0.00,1.00,172.80,-0.00 +0.00,0.00,14.40,0.00,1.00,-4.80,-0.00 +-4.80,0.00,14.42,0.00,1.00,0.00,0.00 +-9.60,0.00,14.44,0.00,1.00,-177.60,-0.00 +-14.40,0.00,14.46,0.00,1.00,4.80,-0.00 +-19.20,0.00,14.48,0.00,1.00,-168.00,-0.00 +-24.00,0.00,14.50,0.00,1.00,14.40,-0.00 +-28.80,0.00,14.53,0.00,1.00,-163.20,-0.00 +-33.60,0.00,14.55,0.00,1.00,19.20,-0.00 +-38.40,0.00,14.57,0.00,1.00,-153.60,-0.00 +-43.20,0.00,14.59,0.00,1.00,28.80,-0.00 +-48.00,0.00,14.61,0.00,1.00,-148.80,-0.00 +-52.80,0.00,14.63,0.00,1.00,38.40,-0.00 +-57.60,0.00,14.65,0.00,1.00,-139.20,-0.00 +-62.40,0.00,14.68,0.00,1.00,48.00,-0.00 +-67.20,0.00,14.70,0.00,1.00,-124.80,-0.00 +-72.00,0.00,14.72,0.00,1.00,57.60,-0.00 +-76.80,0.00,14.74,0.00,1.00,-115.20,-0.00 +-81.60,0.00,14.76,0.00,1.00,72.00,-0.00 +-86.40,0.00,14.78,0.00,1.00,-100.80,-0.00 +-91.20,0.00,14.80,0.00,1.00,86.40,-0.00 +-96.00,0.00,14.83,0.00,1.00,-86.40,-0.00 +-100.80,0.00,14.85,0.00,1.00,100.80,-0.00 +-105.60,0.00,14.87,0.00,1.00,-76.80,-0.00 +-110.40,0.00,14.89,0.00,1.00,110.40,-0.00 +-115.20,0.00,14.91,0.00,1.00,-62.40,-0.00 +-120.00,0.00,14.93,0.00,1.00,124.80,-0.00 +-124.80,0.00,14.95,0.00,1.00,-48.00,-0.00 +-129.60,0.00,14.97,0.00,1.00,134.40,-0.00 +-134.40,0.00,15.00,0.00,1.00,-38.40,-0.00 +-139.20,0.00,15.02,0.00,1.00,144.00,-0.00 +-144.00,0.00,15.04,0.00,1.00,-28.80,-0.00 +-148.80,0.00,15.06,0.00,1.00,153.60,-0.00 +-153.60,0.00,15.08,0.00,1.00,-24.00,-0.00 +-158.40,0.00,15.10,0.00,1.00,163.20,-0.00 +-163.20,0.00,15.12,0.00,1.00,-14.40,-0.00 +-168.00,0.00,15.15,0.00,1.00,168.00,-0.00 +-172.80,0.00,15.17,0.00,1.00,-9.60,-0.00 +-177.60,0.00,15.19,0.00,1.00,172.80,-0.00 +177.60,0.00,15.21,0.00,1.00,-0.00,-0.00 +172.80,0.00,15.23,0.00,1.00,-177.60,0.00 +168.00,0.00,15.25,0.00,1.00,4.80,0.00 +163.20,0.00,15.27,0.00,1.00,-172.80,0.00 +158.40,0.00,15.30,0.00,1.00,9.60,0.00 +153.60,0.00,15.32,0.00,1.00,-163.20,0.00 +148.80,0.00,15.34,0.00,1.00,19.20,0.00 +144.00,0.00,15.36,0.00,1.00,-158.40,0.00 +139.20,0.00,15.38,0.00,1.00,28.80,0.00 +134.40,0.00,15.40,0.00,1.00,-148.80,0.00 +129.60,0.00,15.42,0.00,1.00,33.60,0.00 +124.80,0.00,15.44,0.00,1.00,-139.20,0.00 +120.00,0.00,15.47,0.00,1.00,43.20,0.00 +115.20,0.00,15.49,0.00,1.00,-129.60,0.00 +110.40,0.00,15.51,0.00,1.00,57.60,0.00 +105.60,0.00,15.53,0.00,1.00,-120.00,0.00 +100.80,0.00,15.55,0.00,1.00,67.20,0.00 +96.00,0.00,15.57,0.00,1.00,-105.60,0.00 +91.20,0.00,15.59,0.00,1.00,81.60,0.00 +86.40,0.00,15.62,0.00,1.00,-91.20,0.00 +81.60,0.00,15.64,0.00,1.00,96.00,0.00 +76.80,0.00,15.66,0.00,1.00,-76.80,0.00 +72.00,0.00,15.68,0.00,1.00,110.40,0.00 +67.20,0.00,15.70,0.00,1.00,-67.20,0.00 +62.40,0.00,15.72,0.00,1.00,120.00,0.00 +57.60,0.00,15.74,0.00,1.00,-52.80,0.00 +52.80,0.00,15.77,0.00,1.00,134.40,0.00 +48.00,0.00,15.79,0.00,1.00,-43.20,0.00 +43.20,0.00,15.81,0.00,1.00,144.00,0.00 +38.40,0.00,15.83,0.00,1.00,-33.60,0.00 +33.60,0.00,15.85,0.00,1.00,153.60,0.00 +28.80,0.00,15.87,0.00,1.00,-24.00,0.00 +24.00,0.00,15.89,0.00,1.00,158.40,0.00 +19.20,0.00,15.91,0.00,1.00,-19.20,0.00 +14.40,0.00,15.94,0.00,1.00,168.00,0.00 +9.60,0.00,15.96,0.00,1.00,-9.60,0.00 +4.80,0.00,15.98,0.00,1.00,172.80,0.00 +0.00,0.00,16.00,0.00,1.00,-4.80,0.00 diff --git a/scripts/testv/stvISM3.csv b/scripts/testv/stvISM3.csv index d2474d78fd398460c53b0715771184a40bbbd60c..ac37e672e3758c851a5d236e56e612697bcd5f1f 100644 --- a/scripts/testv/stvISM3.csv +++ b/scripts/testv/stvISM3.csv @@ -1,1500 +1,1500 @@ -0.00,0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 --168.00,-9.60,1.00,0.00,1.00 -14.40,14.40,1.00,0.00,1.00 --163.20,-14.40,1.00,0.00,1.00 -19.20,19.20,1.00,0.00,1.00 --153.60,-24.00,1.00,0.00,1.00 -28.80,24.00,1.00,0.00,1.00 --148.80,-28.80,1.00,0.00,1.00 -38.40,33.60,1.00,0.00,1.00 --139.20,-33.60,1.00,0.00,1.00 -48.00,38.40,1.00,0.00,1.00 --124.80,-38.40,1.00,0.00,1.00 -57.60,38.40,1.00,0.00,1.00 --115.20,-43.20,1.00,0.00,1.00 -72.00,43.20,1.00,0.00,1.00 --100.80,-43.20,1.00,0.00,1.00 -86.40,43.20,1.00,0.00,1.00 --86.40,-43.20,1.00,0.00,1.00 -100.80,43.20,1.00,0.00,1.00 --76.80,-43.20,1.00,0.00,1.00 -110.40,43.20,1.00,0.00,1.00 --62.40,-43.20,1.00,0.00,1.00 -124.80,38.40,1.00,0.00,1.00 --52.80,-38.40,1.00,0.00,1.00 -134.40,33.60,1.00,0.00,1.00 --38.40,-33.60,1.00,0.00,1.00 -144.00,28.80,1.00,0.00,1.00 --33.60,-28.80,1.00,0.00,1.00 -153.60,24.00,1.00,0.00,1.00 --24.00,-19.20,1.00,0.00,1.00 -158.40,19.20,1.00,0.00,1.00 --14.40,-14.40,1.00,0.00,1.00 -168.00,9.60,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 --172.80,-9.60,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 --163.20,-14.40,1.00,0.00,1.00 -19.20,19.20,1.00,0.00,1.00 --158.40,-19.20,1.00,0.00,1.00 -28.80,24.00,1.00,0.00,1.00 --148.80,-28.80,1.00,0.00,1.00 -33.60,28.80,1.00,0.00,1.00 --139.20,-33.60,1.00,0.00,1.00 -43.20,33.60,1.00,0.00,1.00 --129.60,-38.40,1.00,0.00,1.00 -57.60,38.40,1.00,0.00,1.00 --120.00,-43.20,1.00,0.00,1.00 -67.20,43.20,1.00,0.00,1.00 --105.60,-43.20,1.00,0.00,1.00 -81.60,43.20,1.00,0.00,1.00 --91.20,-43.20,1.00,0.00,1.00 -96.00,43.20,1.00,0.00,1.00 --76.80,-43.20,1.00,0.00,1.00 -110.40,43.20,1.00,0.00,1.00 --67.20,-43.20,1.00,0.00,1.00 -120.00,38.40,1.00,0.00,1.00 --52.80,-38.40,1.00,0.00,1.00 -129.60,38.40,1.00,0.00,1.00 --43.20,-33.60,1.00,0.00,1.00 -144.00,33.60,1.00,0.00,1.00 --33.60,-28.80,1.00,0.00,1.00 -148.80,24.00,1.00,0.00,1.00 --24.00,-24.00,1.00,0.00,1.00 -158.40,19.20,1.00,0.00,1.00 --19.20,-14.40,1.00,0.00,1.00 -168.00,14.40,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 --168.00,-9.60,1.00,0.00,1.00 -14.40,14.40,1.00,0.00,1.00 --163.20,-14.40,1.00,0.00,1.00 -24.00,19.20,1.00,0.00,1.00 --153.60,-19.20,1.00,0.00,1.00 -28.80,24.00,1.00,0.00,1.00 --144.00,-24.00,1.00,0.00,1.00 -38.40,28.80,1.00,0.00,1.00 --134.40,-28.80,1.00,0.00,1.00 -48.00,33.60,1.00,0.00,1.00 --124.80,-33.60,1.00,0.00,1.00 -62.40,38.40,1.00,0.00,1.00 --115.20,-38.40,1.00,0.00,1.00 -72.00,38.40,1.00,0.00,1.00 --100.80,-38.40,1.00,0.00,1.00 -86.40,38.40,1.00,0.00,1.00 --86.40,-38.40,1.00,0.00,1.00 -96.00,38.40,1.00,0.00,1.00 --76.80,-38.40,1.00,0.00,1.00 -110.40,38.40,1.00,0.00,1.00 --62.40,-38.40,1.00,0.00,1.00 -120.00,33.60,1.00,0.00,1.00 --52.80,-33.60,1.00,0.00,1.00 -134.40,33.60,1.00,0.00,1.00 --43.20,-28.80,1.00,0.00,1.00 -144.00,28.80,1.00,0.00,1.00 --33.60,-24.00,1.00,0.00,1.00 -148.80,24.00,1.00,0.00,1.00 --24.00,-19.20,1.00,0.00,1.00 -158.40,14.40,1.00,0.00,1.00 --19.20,-14.40,1.00,0.00,1.00 -168.00,9.60,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 --172.80,-9.60,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 --163.20,-14.40,1.00,0.00,1.00 -19.20,14.40,1.00,0.00,1.00 --153.60,-19.20,1.00,0.00,1.00 -28.80,24.00,1.00,0.00,1.00 --148.80,-24.00,1.00,0.00,1.00 -38.40,28.80,1.00,0.00,1.00 --139.20,-28.80,1.00,0.00,1.00 -48.00,33.60,1.00,0.00,1.00 --124.80,-33.60,1.00,0.00,1.00 -57.60,33.60,1.00,0.00,1.00 --115.20,-38.40,1.00,0.00,1.00 -72.00,38.40,1.00,0.00,1.00 --105.60,-38.40,1.00,0.00,1.00 -81.60,38.40,1.00,0.00,1.00 --91.20,-38.40,1.00,0.00,1.00 -96.00,38.40,1.00,0.00,1.00 --76.80,-38.40,1.00,0.00,1.00 -105.60,38.40,1.00,0.00,1.00 --67.20,-38.40,1.00,0.00,1.00 -120.00,38.40,1.00,0.00,1.00 --57.60,-33.60,1.00,0.00,1.00 -129.60,33.60,1.00,0.00,1.00 --43.20,-28.80,1.00,0.00,1.00 -139.20,28.80,1.00,0.00,1.00 --33.60,-24.00,1.00,0.00,1.00 -148.80,24.00,1.00,0.00,1.00 --28.80,-19.20,1.00,0.00,1.00 -158.40,19.20,1.00,0.00,1.00 --19.20,-14.40,1.00,0.00,1.00 -163.20,14.40,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 --168.00,-9.60,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 --158.40,-14.40,1.00,0.00,1.00 -24.00,14.40,1.00,0.00,1.00 --153.60,-19.20,1.00,0.00,1.00 -33.60,19.20,1.00,0.00,1.00 --144.00,-24.00,1.00,0.00,1.00 -43.20,24.00,1.00,0.00,1.00 --134.40,-28.80,1.00,0.00,1.00 -52.80,28.80,1.00,0.00,1.00 --124.80,-28.80,1.00,0.00,1.00 -62.40,33.60,1.00,0.00,1.00 --110.40,-33.60,1.00,0.00,1.00 -72.00,33.60,1.00,0.00,1.00 --100.80,-33.60,1.00,0.00,1.00 -86.40,33.60,1.00,0.00,1.00 --86.40,-33.60,1.00,0.00,1.00 -96.00,33.60,1.00,0.00,1.00 --76.80,-33.60,1.00,0.00,1.00 -110.40,33.60,1.00,0.00,1.00 --67.20,-33.60,1.00,0.00,1.00 -120.00,33.60,1.00,0.00,1.00 --52.80,-28.80,1.00,0.00,1.00 -129.60,28.80,1.00,0.00,1.00 --43.20,-28.80,1.00,0.00,1.00 -139.20,24.00,1.00,0.00,1.00 --33.60,-24.00,1.00,0.00,1.00 -148.80,19.20,1.00,0.00,1.00 --24.00,-19.20,1.00,0.00,1.00 -158.40,14.40,1.00,0.00,1.00 --19.20,-14.40,1.00,0.00,1.00 -168.00,9.60,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 --163.20,-14.40,1.00,0.00,1.00 -24.00,14.40,1.00,0.00,1.00 --153.60,-19.20,1.00,0.00,1.00 -28.80,19.20,1.00,0.00,1.00 --144.00,-24.00,1.00,0.00,1.00 -38.40,24.00,1.00,0.00,1.00 --134.40,-28.80,1.00,0.00,1.00 -48.00,28.80,1.00,0.00,1.00 --124.80,-28.80,1.00,0.00,1.00 -62.40,33.60,1.00,0.00,1.00 --115.20,-33.60,1.00,0.00,1.00 -72.00,33.60,1.00,0.00,1.00 --100.80,-33.60,1.00,0.00,1.00 -81.60,33.60,1.00,0.00,1.00 --91.20,-33.60,1.00,0.00,1.00 -96.00,33.60,1.00,0.00,1.00 --81.60,-33.60,1.00,0.00,1.00 -105.60,33.60,1.00,0.00,1.00 --67.20,-33.60,1.00,0.00,1.00 -115.20,33.60,1.00,0.00,1.00 --57.60,-28.80,1.00,0.00,1.00 -129.60,28.80,1.00,0.00,1.00 --48.00,-28.80,1.00,0.00,1.00 -139.20,24.00,1.00,0.00,1.00 --38.40,-24.00,1.00,0.00,1.00 -148.80,19.20,1.00,0.00,1.00 --28.80,-19.20,1.00,0.00,1.00 -153.60,14.40,1.00,0.00,1.00 --19.20,-14.40,1.00,0.00,1.00 -163.20,9.60,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 --168.00,-9.60,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 --158.40,-9.60,1.00,0.00,1.00 -24.00,14.40,1.00,0.00,1.00 --148.80,-14.40,1.00,0.00,1.00 -33.60,19.20,1.00,0.00,1.00 --139.20,-19.20,1.00,0.00,1.00 -43.20,24.00,1.00,0.00,1.00 --129.60,-24.00,1.00,0.00,1.00 -52.80,24.00,1.00,0.00,1.00 --120.00,-28.80,1.00,0.00,1.00 -62.40,28.80,1.00,0.00,1.00 --110.40,-28.80,1.00,0.00,1.00 -76.80,28.80,1.00,0.00,1.00 --100.80,-28.80,1.00,0.00,1.00 -86.40,28.80,1.00,0.00,1.00 --86.40,-28.80,1.00,0.00,1.00 -96.00,28.80,1.00,0.00,1.00 --76.80,-28.80,1.00,0.00,1.00 -105.60,28.80,1.00,0.00,1.00 --67.20,-28.80,1.00,0.00,1.00 -120.00,28.80,1.00,0.00,1.00 --57.60,-24.00,1.00,0.00,1.00 -129.60,24.00,1.00,0.00,1.00 --48.00,-24.00,1.00,0.00,1.00 -139.20,19.20,1.00,0.00,1.00 --38.40,-19.20,1.00,0.00,1.00 -148.80,19.20,1.00,0.00,1.00 --28.80,-14.40,1.00,0.00,1.00 -158.40,14.40,1.00,0.00,1.00 --19.20,-9.60,1.00,0.00,1.00 -163.20,9.60,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 --163.20,-9.60,1.00,0.00,1.00 -24.00,14.40,1.00,0.00,1.00 --153.60,-14.40,1.00,0.00,1.00 -33.60,19.20,1.00,0.00,1.00 --144.00,-19.20,1.00,0.00,1.00 -43.20,19.20,1.00,0.00,1.00 --134.40,-24.00,1.00,0.00,1.00 -52.80,24.00,1.00,0.00,1.00 --124.80,-24.00,1.00,0.00,1.00 -62.40,28.80,1.00,0.00,1.00 --115.20,-28.80,1.00,0.00,1.00 -72.00,28.80,1.00,0.00,1.00 --100.80,-28.80,1.00,0.00,1.00 -81.60,28.80,1.00,0.00,1.00 --91.20,-28.80,1.00,0.00,1.00 -96.00,28.80,1.00,0.00,1.00 --81.60,-28.80,1.00,0.00,1.00 -105.60,28.80,1.00,0.00,1.00 --67.20,-28.80,1.00,0.00,1.00 -115.20,28.80,1.00,0.00,1.00 --57.60,-28.80,1.00,0.00,1.00 -124.80,24.00,1.00,0.00,1.00 --48.00,-24.00,1.00,0.00,1.00 -134.40,24.00,1.00,0.00,1.00 --38.40,-19.20,1.00,0.00,1.00 -144.00,19.20,1.00,0.00,1.00 --28.80,-14.40,1.00,0.00,1.00 -153.60,14.40,1.00,0.00,1.00 --19.20,-9.60,1.00,0.00,1.00 -163.20,9.60,1.00,0.00,1.00 --14.40,-9.60,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 -19.20,9.60,1.00,0.00,1.00 --158.40,-9.60,1.00,0.00,1.00 -24.00,14.40,1.00,0.00,1.00 --148.80,-14.40,1.00,0.00,1.00 -33.60,14.40,1.00,0.00,1.00 --139.20,-19.20,1.00,0.00,1.00 -43.20,19.20,1.00,0.00,1.00 --129.60,-19.20,1.00,0.00,1.00 -52.80,19.20,1.00,0.00,1.00 --120.00,-24.00,1.00,0.00,1.00 -67.20,24.00,1.00,0.00,1.00 --110.40,-24.00,1.00,0.00,1.00 -76.80,24.00,1.00,0.00,1.00 --100.80,-24.00,1.00,0.00,1.00 -86.40,24.00,1.00,0.00,1.00 --86.40,-24.00,1.00,0.00,1.00 -96.00,24.00,1.00,0.00,1.00 --76.80,-24.00,1.00,0.00,1.00 -105.60,24.00,1.00,0.00,1.00 --67.20,-24.00,1.00,0.00,1.00 -115.20,24.00,1.00,0.00,1.00 --57.60,-24.00,1.00,0.00,1.00 -129.60,19.20,1.00,0.00,1.00 --48.00,-19.20,1.00,0.00,1.00 -139.20,19.20,1.00,0.00,1.00 --38.40,-14.40,1.00,0.00,1.00 -148.80,14.40,1.00,0.00,1.00 --28.80,-14.40,1.00,0.00,1.00 -153.60,9.60,1.00,0.00,1.00 --19.20,-9.60,1.00,0.00,1.00 -163.20,9.60,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 --158.40,-9.60,1.00,0.00,1.00 -24.00,9.60,1.00,0.00,1.00 --153.60,-14.40,1.00,0.00,1.00 -33.60,14.40,1.00,0.00,1.00 --144.00,-14.40,1.00,0.00,1.00 -43.20,19.20,1.00,0.00,1.00 --134.40,-19.20,1.00,0.00,1.00 -52.80,19.20,1.00,0.00,1.00 --124.80,-24.00,1.00,0.00,1.00 -62.40,24.00,1.00,0.00,1.00 --110.40,-24.00,1.00,0.00,1.00 -72.00,24.00,1.00,0.00,1.00 --100.80,-24.00,1.00,0.00,1.00 -81.60,24.00,1.00,0.00,1.00 --91.20,-24.00,1.00,0.00,1.00 -96.00,24.00,1.00,0.00,1.00 --81.60,-24.00,1.00,0.00,1.00 -105.60,24.00,1.00,0.00,1.00 --72.00,-24.00,1.00,0.00,1.00 -115.20,24.00,1.00,0.00,1.00 --57.60,-24.00,1.00,0.00,1.00 -124.80,19.20,1.00,0.00,1.00 --48.00,-19.20,1.00,0.00,1.00 -134.40,19.20,1.00,0.00,1.00 --38.40,-19.20,1.00,0.00,1.00 -144.00,14.40,1.00,0.00,1.00 --28.80,-14.40,1.00,0.00,1.00 -153.60,14.40,1.00,0.00,1.00 --24.00,-9.60,1.00,0.00,1.00 -163.20,9.60,1.00,0.00,1.00 --14.40,-4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 -19.20,4.80,1.00,0.00,1.00 --158.40,-9.60,1.00,0.00,1.00 -28.80,9.60,1.00,0.00,1.00 --148.80,-9.60,1.00,0.00,1.00 -38.40,14.40,1.00,0.00,1.00 --139.20,-14.40,1.00,0.00,1.00 -48.00,14.40,1.00,0.00,1.00 --129.60,-14.40,1.00,0.00,1.00 -57.60,19.20,1.00,0.00,1.00 --120.00,-19.20,1.00,0.00,1.00 -67.20,19.20,1.00,0.00,1.00 --110.40,-19.20,1.00,0.00,1.00 -76.80,19.20,1.00,0.00,1.00 --100.80,-19.20,1.00,0.00,1.00 -86.40,19.20,1.00,0.00,1.00 --86.40,-19.20,1.00,0.00,1.00 -96.00,19.20,1.00,0.00,1.00 --76.80,-19.20,1.00,0.00,1.00 -105.60,19.20,1.00,0.00,1.00 --67.20,-19.20,1.00,0.00,1.00 -115.20,19.20,1.00,0.00,1.00 --57.60,-19.20,1.00,0.00,1.00 -124.80,19.20,1.00,0.00,1.00 --48.00,-14.40,1.00,0.00,1.00 -134.40,14.40,1.00,0.00,1.00 --38.40,-14.40,1.00,0.00,1.00 -144.00,14.40,1.00,0.00,1.00 --28.80,-9.60,1.00,0.00,1.00 -153.60,9.60,1.00,0.00,1.00 --19.20,-9.60,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 -14.40,4.80,1.00,0.00,1.00 --158.40,-9.60,1.00,0.00,1.00 -24.00,9.60,1.00,0.00,1.00 --148.80,-9.60,1.00,0.00,1.00 -33.60,14.40,1.00,0.00,1.00 --139.20,-14.40,1.00,0.00,1.00 -43.20,14.40,1.00,0.00,1.00 --129.60,-14.40,1.00,0.00,1.00 -52.80,19.20,1.00,0.00,1.00 --120.00,-19.20,1.00,0.00,1.00 -62.40,19.20,1.00,0.00,1.00 --110.40,-19.20,1.00,0.00,1.00 -72.00,19.20,1.00,0.00,1.00 --100.80,-19.20,1.00,0.00,1.00 -81.60,19.20,1.00,0.00,1.00 --91.20,-19.20,1.00,0.00,1.00 -96.00,19.20,1.00,0.00,1.00 --81.60,-19.20,1.00,0.00,1.00 -105.60,19.20,1.00,0.00,1.00 --72.00,-19.20,1.00,0.00,1.00 -115.20,19.20,1.00,0.00,1.00 --62.40,-19.20,1.00,0.00,1.00 -124.80,19.20,1.00,0.00,1.00 --52.80,-14.40,1.00,0.00,1.00 -134.40,14.40,1.00,0.00,1.00 --43.20,-14.40,1.00,0.00,1.00 -144.00,14.40,1.00,0.00,1.00 --33.60,-9.60,1.00,0.00,1.00 -153.60,9.60,1.00,0.00,1.00 --24.00,-9.60,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 --14.40,-4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 -19.20,4.80,1.00,0.00,1.00 --158.40,-4.80,1.00,0.00,1.00 -28.80,9.60,1.00,0.00,1.00 --148.80,-9.60,1.00,0.00,1.00 -38.40,9.60,1.00,0.00,1.00 --139.20,-9.60,1.00,0.00,1.00 -48.00,9.60,1.00,0.00,1.00 --129.60,-14.40,1.00,0.00,1.00 -57.60,14.40,1.00,0.00,1.00 --120.00,-14.40,1.00,0.00,1.00 -67.20,14.40,1.00,0.00,1.00 --110.40,-14.40,1.00,0.00,1.00 -76.80,14.40,1.00,0.00,1.00 --100.80,-14.40,1.00,0.00,1.00 -86.40,14.40,1.00,0.00,1.00 --86.40,-14.40,1.00,0.00,1.00 -96.00,14.40,1.00,0.00,1.00 --76.80,-14.40,1.00,0.00,1.00 -105.60,14.40,1.00,0.00,1.00 --67.20,-14.40,1.00,0.00,1.00 -115.20,14.40,1.00,0.00,1.00 --57.60,-14.40,1.00,0.00,1.00 -124.80,14.40,1.00,0.00,1.00 --48.00,-14.40,1.00,0.00,1.00 -134.40,9.60,1.00,0.00,1.00 --38.40,-9.60,1.00,0.00,1.00 -144.00,9.60,1.00,0.00,1.00 --28.80,-9.60,1.00,0.00,1.00 -153.60,4.80,1.00,0.00,1.00 --19.20,-4.80,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 -14.40,4.80,1.00,0.00,1.00 --158.40,-4.80,1.00,0.00,1.00 -24.00,4.80,1.00,0.00,1.00 --148.80,-9.60,1.00,0.00,1.00 -33.60,9.60,1.00,0.00,1.00 --139.20,-9.60,1.00,0.00,1.00 -43.20,9.60,1.00,0.00,1.00 --129.60,-14.40,1.00,0.00,1.00 -52.80,14.40,1.00,0.00,1.00 --120.00,-14.40,1.00,0.00,1.00 -62.40,14.40,1.00,0.00,1.00 --110.40,-14.40,1.00,0.00,1.00 -72.00,14.40,1.00,0.00,1.00 --100.80,-14.40,1.00,0.00,1.00 -81.60,14.40,1.00,0.00,1.00 --91.20,-14.40,1.00,0.00,1.00 -96.00,14.40,1.00,0.00,1.00 --81.60,-14.40,1.00,0.00,1.00 -105.60,14.40,1.00,0.00,1.00 --72.00,-14.40,1.00,0.00,1.00 -115.20,14.40,1.00,0.00,1.00 --62.40,-14.40,1.00,0.00,1.00 -124.80,14.40,1.00,0.00,1.00 --52.80,-14.40,1.00,0.00,1.00 -134.40,9.60,1.00,0.00,1.00 --43.20,-9.60,1.00,0.00,1.00 -144.00,9.60,1.00,0.00,1.00 --33.60,-9.60,1.00,0.00,1.00 -153.60,9.60,1.00,0.00,1.00 --24.00,-4.80,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 --14.40,-4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -9.60,0.00,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 -19.20,4.80,1.00,0.00,1.00 --158.40,-4.80,1.00,0.00,1.00 -28.80,4.80,1.00,0.00,1.00 --148.80,-4.80,1.00,0.00,1.00 -38.40,4.80,1.00,0.00,1.00 --139.20,-9.60,1.00,0.00,1.00 -48.00,9.60,1.00,0.00,1.00 --129.60,-9.60,1.00,0.00,1.00 -57.60,9.60,1.00,0.00,1.00 --120.00,-9.60,1.00,0.00,1.00 -67.20,9.60,1.00,0.00,1.00 --110.40,-9.60,1.00,0.00,1.00 -76.80,9.60,1.00,0.00,1.00 --100.80,-9.60,1.00,0.00,1.00 -86.40,9.60,1.00,0.00,1.00 --86.40,-9.60,1.00,0.00,1.00 -96.00,9.60,1.00,0.00,1.00 --76.80,-9.60,1.00,0.00,1.00 -105.60,9.60,1.00,0.00,1.00 --67.20,-9.60,1.00,0.00,1.00 -115.20,9.60,1.00,0.00,1.00 --57.60,-9.60,1.00,0.00,1.00 -124.80,9.60,1.00,0.00,1.00 --48.00,-9.60,1.00,0.00,1.00 -134.40,9.60,1.00,0.00,1.00 --38.40,-9.60,1.00,0.00,1.00 -144.00,4.80,1.00,0.00,1.00 --28.80,-4.80,1.00,0.00,1.00 -153.60,4.80,1.00,0.00,1.00 --19.20,-4.80,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 --9.60,-0.00,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 --168.00,-0.00,1.00,0.00,1.00 -14.40,4.80,1.00,0.00,1.00 --158.40,-4.80,1.00,0.00,1.00 -24.00,4.80,1.00,0.00,1.00 --148.80,-4.80,1.00,0.00,1.00 -33.60,4.80,1.00,0.00,1.00 --139.20,-9.60,1.00,0.00,1.00 -43.20,9.60,1.00,0.00,1.00 --129.60,-9.60,1.00,0.00,1.00 -52.80,9.60,1.00,0.00,1.00 --120.00,-9.60,1.00,0.00,1.00 -62.40,9.60,1.00,0.00,1.00 --110.40,-9.60,1.00,0.00,1.00 -72.00,9.60,1.00,0.00,1.00 --100.80,-9.60,1.00,0.00,1.00 -81.60,9.60,1.00,0.00,1.00 --91.20,-9.60,1.00,0.00,1.00 -96.00,9.60,1.00,0.00,1.00 --81.60,-9.60,1.00,0.00,1.00 -105.60,9.60,1.00,0.00,1.00 --72.00,-9.60,1.00,0.00,1.00 -115.20,9.60,1.00,0.00,1.00 --62.40,-9.60,1.00,0.00,1.00 -124.80,9.60,1.00,0.00,1.00 --52.80,-9.60,1.00,0.00,1.00 -134.40,9.60,1.00,0.00,1.00 --43.20,-9.60,1.00,0.00,1.00 -144.00,4.80,1.00,0.00,1.00 --33.60,-4.80,1.00,0.00,1.00 -153.60,4.80,1.00,0.00,1.00 --24.00,-4.80,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 --14.40,-4.80,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -9.60,0.00,1.00,0.00,1.00 --168.00,-0.00,1.00,0.00,1.00 -19.20,0.00,1.00,0.00,1.00 --158.40,-4.80,1.00,0.00,1.00 -28.80,4.80,1.00,0.00,1.00 --148.80,-4.80,1.00,0.00,1.00 -38.40,4.80,1.00,0.00,1.00 --139.20,-4.80,1.00,0.00,1.00 -48.00,4.80,1.00,0.00,1.00 --129.60,-4.80,1.00,0.00,1.00 -57.60,4.80,1.00,0.00,1.00 --120.00,-4.80,1.00,0.00,1.00 -67.20,4.80,1.00,0.00,1.00 --110.40,-4.80,1.00,0.00,1.00 -76.80,4.80,1.00,0.00,1.00 --100.80,-4.80,1.00,0.00,1.00 -86.40,4.80,1.00,0.00,1.00 --86.40,-4.80,1.00,0.00,1.00 -96.00,4.80,1.00,0.00,1.00 --76.80,-4.80,1.00,0.00,1.00 -105.60,4.80,1.00,0.00,1.00 --67.20,-4.80,1.00,0.00,1.00 -115.20,4.80,1.00,0.00,1.00 --57.60,-4.80,1.00,0.00,1.00 -124.80,4.80,1.00,0.00,1.00 --48.00,-4.80,1.00,0.00,1.00 -134.40,4.80,1.00,0.00,1.00 --38.40,-4.80,1.00,0.00,1.00 -144.00,4.80,1.00,0.00,1.00 --28.80,-4.80,1.00,0.00,1.00 -153.60,4.80,1.00,0.00,1.00 --19.20,-4.80,1.00,0.00,1.00 -163.20,0.00,1.00,0.00,1.00 --9.60,-0.00,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 --168.00,-0.00,1.00,0.00,1.00 -14.40,0.00,1.00,0.00,1.00 --158.40,-4.80,1.00,0.00,1.00 -24.00,4.80,1.00,0.00,1.00 --148.80,-4.80,1.00,0.00,1.00 -33.60,4.80,1.00,0.00,1.00 --139.20,-4.80,1.00,0.00,1.00 -43.20,4.80,1.00,0.00,1.00 --129.60,-4.80,1.00,0.00,1.00 -52.80,4.80,1.00,0.00,1.00 --120.00,-4.80,1.00,0.00,1.00 -62.40,4.80,1.00,0.00,1.00 --110.40,-4.80,1.00,0.00,1.00 -72.00,4.80,1.00,0.00,1.00 --100.80,-4.80,1.00,0.00,1.00 -81.60,4.80,1.00,0.00,1.00 --91.20,-4.80,1.00,0.00,1.00 -96.00,4.80,1.00,0.00,1.00 --81.60,-4.80,1.00,0.00,1.00 -105.60,4.80,1.00,0.00,1.00 --72.00,-4.80,1.00,0.00,1.00 -115.20,4.80,1.00,0.00,1.00 --62.40,-4.80,1.00,0.00,1.00 -124.80,4.80,1.00,0.00,1.00 --52.80,-4.80,1.00,0.00,1.00 -134.40,4.80,1.00,0.00,1.00 --43.20,-4.80,1.00,0.00,1.00 -144.00,4.80,1.00,0.00,1.00 --33.60,-4.80,1.00,0.00,1.00 -153.60,4.80,1.00,0.00,1.00 --24.00,-4.80,1.00,0.00,1.00 -163.20,0.00,1.00,0.00,1.00 --14.40,-0.00,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -9.60,0.00,1.00,0.00,1.00 --168.00,-0.00,1.00,0.00,1.00 -19.20,0.00,1.00,0.00,1.00 --158.40,-0.00,1.00,0.00,1.00 -28.80,0.00,1.00,0.00,1.00 --148.80,-0.00,1.00,0.00,1.00 -38.40,0.00,1.00,0.00,1.00 --139.20,-0.00,1.00,0.00,1.00 -48.00,0.00,1.00,0.00,1.00 --129.60,-0.00,1.00,0.00,1.00 -57.60,0.00,1.00,0.00,1.00 --120.00,-0.00,1.00,0.00,1.00 -67.20,0.00,1.00,0.00,1.00 --110.40,-0.00,1.00,0.00,1.00 -76.80,0.00,1.00,0.00,1.00 --100.80,-0.00,1.00,0.00,1.00 -86.40,0.00,1.00,0.00,1.00 --86.40,-0.00,1.00,0.00,1.00 -96.00,0.00,1.00,0.00,1.00 --76.80,-0.00,1.00,0.00,1.00 -105.60,0.00,1.00,0.00,1.00 --67.20,-0.00,1.00,0.00,1.00 -115.20,0.00,1.00,0.00,1.00 --57.60,-0.00,1.00,0.00,1.00 -124.80,0.00,1.00,0.00,1.00 --48.00,-0.00,1.00,0.00,1.00 -134.40,0.00,1.00,0.00,1.00 --38.40,-0.00,1.00,0.00,1.00 -144.00,0.00,1.00,0.00,1.00 --28.80,-0.00,1.00,0.00,1.00 -153.60,0.00,1.00,0.00,1.00 --19.20,-0.00,1.00,0.00,1.00 -163.20,0.00,1.00,0.00,1.00 --9.60,-0.00,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 --0.00,-0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 --168.00,-0.00,1.00,0.00,1.00 -14.40,0.00,1.00,0.00,1.00 --158.40,-0.00,1.00,0.00,1.00 -24.00,0.00,1.00,0.00,1.00 --148.80,-0.00,1.00,0.00,1.00 -33.60,0.00,1.00,0.00,1.00 --139.20,-0.00,1.00,0.00,1.00 -43.20,0.00,1.00,0.00,1.00 --129.60,-0.00,1.00,0.00,1.00 -52.80,0.00,1.00,0.00,1.00 --120.00,-0.00,1.00,0.00,1.00 -62.40,0.00,1.00,0.00,1.00 --110.40,-0.00,1.00,0.00,1.00 -72.00,0.00,1.00,0.00,1.00 --100.80,-0.00,1.00,0.00,1.00 -81.60,0.00,1.00,0.00,1.00 --91.20,-0.00,1.00,0.00,1.00 -96.00,0.00,1.00,0.00,1.00 --81.60,-0.00,1.00,0.00,1.00 -105.60,0.00,1.00,0.00,1.00 --72.00,-0.00,1.00,0.00,1.00 -115.20,0.00,1.00,0.00,1.00 --62.40,-0.00,1.00,0.00,1.00 -124.80,0.00,1.00,0.00,1.00 --52.80,-0.00,1.00,0.00,1.00 -134.40,0.00,1.00,0.00,1.00 --43.20,-0.00,1.00,0.00,1.00 -144.00,0.00,1.00,0.00,1.00 --33.60,-0.00,1.00,0.00,1.00 -153.60,0.00,1.00,0.00,1.00 --24.00,-0.00,1.00,0.00,1.00 -163.20,0.00,1.00,0.00,1.00 --14.40,-0.00,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 -19.20,-0.00,1.00,0.00,1.00 --158.40,0.00,1.00,0.00,1.00 -28.80,-0.00,1.00,0.00,1.00 --148.80,0.00,1.00,0.00,1.00 -38.40,-0.00,1.00,0.00,1.00 --139.20,0.00,1.00,0.00,1.00 -48.00,-0.00,1.00,0.00,1.00 --129.60,0.00,1.00,0.00,1.00 -57.60,-4.80,1.00,0.00,1.00 --120.00,4.80,1.00,0.00,1.00 -67.20,-4.80,1.00,0.00,1.00 --110.40,4.80,1.00,0.00,1.00 -76.80,-4.80,1.00,0.00,1.00 --100.80,4.80,1.00,0.00,1.00 -86.40,-4.80,1.00,0.00,1.00 --86.40,4.80,1.00,0.00,1.00 -96.00,-4.80,1.00,0.00,1.00 --76.80,4.80,1.00,0.00,1.00 -105.60,-4.80,1.00,0.00,1.00 --67.20,4.80,1.00,0.00,1.00 -115.20,-4.80,1.00,0.00,1.00 --57.60,4.80,1.00,0.00,1.00 -124.80,-4.80,1.00,0.00,1.00 --48.00,0.00,1.00,0.00,1.00 -134.40,-0.00,1.00,0.00,1.00 --38.40,0.00,1.00,0.00,1.00 -144.00,-0.00,1.00,0.00,1.00 --28.80,0.00,1.00,0.00,1.00 -153.60,-0.00,1.00,0.00,1.00 --19.20,0.00,1.00,0.00,1.00 -163.20,-0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 -14.40,-0.00,1.00,0.00,1.00 --158.40,0.00,1.00,0.00,1.00 -24.00,-0.00,1.00,0.00,1.00 --148.80,0.00,1.00,0.00,1.00 -33.60,-0.00,1.00,0.00,1.00 --139.20,0.00,1.00,0.00,1.00 -43.20,-0.00,1.00,0.00,1.00 --129.60,0.00,1.00,0.00,1.00 -52.80,-4.80,1.00,0.00,1.00 --120.00,4.80,1.00,0.00,1.00 -62.40,-4.80,1.00,0.00,1.00 --110.40,4.80,1.00,0.00,1.00 -72.00,-4.80,1.00,0.00,1.00 --100.80,4.80,1.00,0.00,1.00 -81.60,-4.80,1.00,0.00,1.00 --91.20,4.80,1.00,0.00,1.00 -96.00,-4.80,1.00,0.00,1.00 --81.60,4.80,1.00,0.00,1.00 -105.60,-4.80,1.00,0.00,1.00 --72.00,4.80,1.00,0.00,1.00 -115.20,-4.80,1.00,0.00,1.00 --62.40,4.80,1.00,0.00,1.00 -124.80,-4.80,1.00,0.00,1.00 --52.80,0.00,1.00,0.00,1.00 -134.40,-0.00,1.00,0.00,1.00 --43.20,0.00,1.00,0.00,1.00 -144.00,-0.00,1.00,0.00,1.00 --33.60,0.00,1.00,0.00,1.00 -153.60,-0.00,1.00,0.00,1.00 --24.00,0.00,1.00,0.00,1.00 -163.20,-0.00,1.00,0.00,1.00 --14.40,0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 -28.80,-4.80,1.00,0.00,1.00 --148.80,4.80,1.00,0.00,1.00 -38.40,-4.80,1.00,0.00,1.00 --139.20,4.80,1.00,0.00,1.00 -48.00,-4.80,1.00,0.00,1.00 --129.60,4.80,1.00,0.00,1.00 -57.60,-4.80,1.00,0.00,1.00 --120.00,4.80,1.00,0.00,1.00 -67.20,-4.80,1.00,0.00,1.00 --110.40,9.60,1.00,0.00,1.00 -76.80,-9.60,1.00,0.00,1.00 --100.80,9.60,1.00,0.00,1.00 -86.40,-9.60,1.00,0.00,1.00 --86.40,9.60,1.00,0.00,1.00 -96.00,-9.60,1.00,0.00,1.00 --76.80,9.60,1.00,0.00,1.00 -105.60,-9.60,1.00,0.00,1.00 --67.20,9.60,1.00,0.00,1.00 -115.20,-4.80,1.00,0.00,1.00 --57.60,4.80,1.00,0.00,1.00 -124.80,-4.80,1.00,0.00,1.00 --48.00,4.80,1.00,0.00,1.00 -134.40,-4.80,1.00,0.00,1.00 --38.40,4.80,1.00,0.00,1.00 -144.00,-4.80,1.00,0.00,1.00 --28.80,4.80,1.00,0.00,1.00 -153.60,-4.80,1.00,0.00,1.00 --19.20,4.80,1.00,0.00,1.00 -163.20,-0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 -14.40,-0.00,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 -24.00,-4.80,1.00,0.00,1.00 --148.80,4.80,1.00,0.00,1.00 -33.60,-4.80,1.00,0.00,1.00 --139.20,4.80,1.00,0.00,1.00 -43.20,-4.80,1.00,0.00,1.00 --129.60,4.80,1.00,0.00,1.00 -52.80,-4.80,1.00,0.00,1.00 --120.00,4.80,1.00,0.00,1.00 -62.40,-4.80,1.00,0.00,1.00 --110.40,9.60,1.00,0.00,1.00 -72.00,-9.60,1.00,0.00,1.00 --100.80,9.60,1.00,0.00,1.00 -81.60,-9.60,1.00,0.00,1.00 --91.20,9.60,1.00,0.00,1.00 -96.00,-9.60,1.00,0.00,1.00 --81.60,9.60,1.00,0.00,1.00 -105.60,-9.60,1.00,0.00,1.00 --72.00,9.60,1.00,0.00,1.00 -115.20,-4.80,1.00,0.00,1.00 --62.40,4.80,1.00,0.00,1.00 -124.80,-4.80,1.00,0.00,1.00 --52.80,4.80,1.00,0.00,1.00 -134.40,-4.80,1.00,0.00,1.00 --43.20,4.80,1.00,0.00,1.00 -144.00,-4.80,1.00,0.00,1.00 --33.60,4.80,1.00,0.00,1.00 -153.60,-4.80,1.00,0.00,1.00 --24.00,4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 --14.40,0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 -28.80,-4.80,1.00,0.00,1.00 --148.80,4.80,1.00,0.00,1.00 -38.40,-9.60,1.00,0.00,1.00 --139.20,9.60,1.00,0.00,1.00 -48.00,-9.60,1.00,0.00,1.00 --129.60,9.60,1.00,0.00,1.00 -57.60,-9.60,1.00,0.00,1.00 --120.00,9.60,1.00,0.00,1.00 -67.20,-9.60,1.00,0.00,1.00 --110.40,9.60,1.00,0.00,1.00 -76.80,-14.40,1.00,0.00,1.00 --100.80,14.40,1.00,0.00,1.00 -86.40,-14.40,1.00,0.00,1.00 --86.40,14.40,1.00,0.00,1.00 -96.00,-14.40,1.00,0.00,1.00 --76.80,14.40,1.00,0.00,1.00 -105.60,-14.40,1.00,0.00,1.00 --67.20,9.60,1.00,0.00,1.00 -115.20,-9.60,1.00,0.00,1.00 --57.60,9.60,1.00,0.00,1.00 -124.80,-9.60,1.00,0.00,1.00 --48.00,9.60,1.00,0.00,1.00 -134.40,-9.60,1.00,0.00,1.00 --38.40,9.60,1.00,0.00,1.00 -144.00,-9.60,1.00,0.00,1.00 --28.80,4.80,1.00,0.00,1.00 -153.60,-4.80,1.00,0.00,1.00 --19.20,4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 -24.00,-4.80,1.00,0.00,1.00 --148.80,4.80,1.00,0.00,1.00 -33.60,-9.60,1.00,0.00,1.00 --139.20,9.60,1.00,0.00,1.00 -43.20,-9.60,1.00,0.00,1.00 --129.60,9.60,1.00,0.00,1.00 -52.80,-9.60,1.00,0.00,1.00 --120.00,9.60,1.00,0.00,1.00 -62.40,-9.60,1.00,0.00,1.00 --110.40,9.60,1.00,0.00,1.00 -72.00,-14.40,1.00,0.00,1.00 --100.80,14.40,1.00,0.00,1.00 -81.60,-14.40,1.00,0.00,1.00 --91.20,14.40,1.00,0.00,1.00 -96.00,-14.40,1.00,0.00,1.00 --81.60,14.40,1.00,0.00,1.00 -105.60,-14.40,1.00,0.00,1.00 --72.00,9.60,1.00,0.00,1.00 -115.20,-9.60,1.00,0.00,1.00 --62.40,9.60,1.00,0.00,1.00 -124.80,-9.60,1.00,0.00,1.00 --52.80,9.60,1.00,0.00,1.00 -134.40,-9.60,1.00,0.00,1.00 --43.20,9.60,1.00,0.00,1.00 -144.00,-9.60,1.00,0.00,1.00 --33.60,4.80,1.00,0.00,1.00 -153.60,-4.80,1.00,0.00,1.00 --24.00,4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 -28.80,-9.60,1.00,0.00,1.00 --148.80,9.60,1.00,0.00,1.00 -38.40,-9.60,1.00,0.00,1.00 --139.20,9.60,1.00,0.00,1.00 -48.00,-14.40,1.00,0.00,1.00 --129.60,14.40,1.00,0.00,1.00 -57.60,-14.40,1.00,0.00,1.00 --120.00,14.40,1.00,0.00,1.00 -67.20,-14.40,1.00,0.00,1.00 --110.40,14.40,1.00,0.00,1.00 -76.80,-19.20,1.00,0.00,1.00 --100.80,19.20,1.00,0.00,1.00 -86.40,-19.20,1.00,0.00,1.00 --86.40,19.20,1.00,0.00,1.00 -96.00,-19.20,1.00,0.00,1.00 --76.80,19.20,1.00,0.00,1.00 -105.60,-14.40,1.00,0.00,1.00 --67.20,14.40,1.00,0.00,1.00 -115.20,-14.40,1.00,0.00,1.00 --57.60,14.40,1.00,0.00,1.00 -124.80,-14.40,1.00,0.00,1.00 --48.00,14.40,1.00,0.00,1.00 -134.40,-14.40,1.00,0.00,1.00 --38.40,9.60,1.00,0.00,1.00 -144.00,-9.60,1.00,0.00,1.00 --28.80,9.60,1.00,0.00,1.00 -153.60,-9.60,1.00,0.00,1.00 --19.20,4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 --158.40,4.80,1.00,0.00,1.00 -24.00,-9.60,1.00,0.00,1.00 --148.80,9.60,1.00,0.00,1.00 -33.60,-9.60,1.00,0.00,1.00 --139.20,9.60,1.00,0.00,1.00 -43.20,-14.40,1.00,0.00,1.00 --129.60,14.40,1.00,0.00,1.00 -52.80,-14.40,1.00,0.00,1.00 --120.00,14.40,1.00,0.00,1.00 -62.40,-14.40,1.00,0.00,1.00 --110.40,14.40,1.00,0.00,1.00 -72.00,-14.40,1.00,0.00,1.00 --100.80,19.20,1.00,0.00,1.00 -81.60,-19.20,1.00,0.00,1.00 --91.20,19.20,1.00,0.00,1.00 -96.00,-19.20,1.00,0.00,1.00 --81.60,19.20,1.00,0.00,1.00 -105.60,-19.20,1.00,0.00,1.00 --72.00,14.40,1.00,0.00,1.00 -115.20,-14.40,1.00,0.00,1.00 --62.40,14.40,1.00,0.00,1.00 -124.80,-14.40,1.00,0.00,1.00 --52.80,14.40,1.00,0.00,1.00 -134.40,-14.40,1.00,0.00,1.00 --43.20,9.60,1.00,0.00,1.00 -144.00,-9.60,1.00,0.00,1.00 --33.60,9.60,1.00,0.00,1.00 -153.60,-9.60,1.00,0.00,1.00 --24.00,4.80,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -19.20,-4.80,1.00,0.00,1.00 --158.40,9.60,1.00,0.00,1.00 -28.80,-9.60,1.00,0.00,1.00 --148.80,14.40,1.00,0.00,1.00 -38.40,-14.40,1.00,0.00,1.00 --139.20,14.40,1.00,0.00,1.00 -48.00,-14.40,1.00,0.00,1.00 --129.60,19.20,1.00,0.00,1.00 -57.60,-19.20,1.00,0.00,1.00 --120.00,19.20,1.00,0.00,1.00 -67.20,-19.20,1.00,0.00,1.00 --110.40,19.20,1.00,0.00,1.00 -76.80,-19.20,1.00,0.00,1.00 --100.80,24.00,1.00,0.00,1.00 -86.40,-24.00,1.00,0.00,1.00 --86.40,24.00,1.00,0.00,1.00 -96.00,-24.00,1.00,0.00,1.00 --76.80,24.00,1.00,0.00,1.00 -105.60,-19.20,1.00,0.00,1.00 --67.20,19.20,1.00,0.00,1.00 -115.20,-19.20,1.00,0.00,1.00 --57.60,19.20,1.00,0.00,1.00 -124.80,-19.20,1.00,0.00,1.00 --48.00,19.20,1.00,0.00,1.00 -134.40,-14.40,1.00,0.00,1.00 --38.40,14.40,1.00,0.00,1.00 -144.00,-14.40,1.00,0.00,1.00 --28.80,9.60,1.00,0.00,1.00 -153.60,-9.60,1.00,0.00,1.00 --19.20,9.60,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -14.40,-4.80,1.00,0.00,1.00 --158.40,9.60,1.00,0.00,1.00 -24.00,-9.60,1.00,0.00,1.00 --148.80,9.60,1.00,0.00,1.00 -33.60,-14.40,1.00,0.00,1.00 --139.20,14.40,1.00,0.00,1.00 -43.20,-14.40,1.00,0.00,1.00 --129.60,19.20,1.00,0.00,1.00 -52.80,-19.20,1.00,0.00,1.00 --120.00,19.20,1.00,0.00,1.00 -62.40,-19.20,1.00,0.00,1.00 --110.40,19.20,1.00,0.00,1.00 -72.00,-19.20,1.00,0.00,1.00 --100.80,24.00,1.00,0.00,1.00 -81.60,-24.00,1.00,0.00,1.00 --91.20,24.00,1.00,0.00,1.00 -96.00,-24.00,1.00,0.00,1.00 --81.60,24.00,1.00,0.00,1.00 -105.60,-19.20,1.00,0.00,1.00 --72.00,19.20,1.00,0.00,1.00 -115.20,-19.20,1.00,0.00,1.00 --62.40,19.20,1.00,0.00,1.00 -124.80,-19.20,1.00,0.00,1.00 --52.80,19.20,1.00,0.00,1.00 -134.40,-14.40,1.00,0.00,1.00 --43.20,14.40,1.00,0.00,1.00 -144.00,-14.40,1.00,0.00,1.00 --33.60,14.40,1.00,0.00,1.00 -153.60,-9.60,1.00,0.00,1.00 --24.00,9.60,1.00,0.00,1.00 -163.20,-4.80,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -19.20,-9.60,1.00,0.00,1.00 --158.40,9.60,1.00,0.00,1.00 -24.00,-14.40,1.00,0.00,1.00 --148.80,14.40,1.00,0.00,1.00 -33.60,-14.40,1.00,0.00,1.00 --139.20,19.20,1.00,0.00,1.00 -43.20,-19.20,1.00,0.00,1.00 --129.60,19.20,1.00,0.00,1.00 -52.80,-24.00,1.00,0.00,1.00 --120.00,24.00,1.00,0.00,1.00 -62.40,-24.00,1.00,0.00,1.00 --110.40,24.00,1.00,0.00,1.00 -76.80,-24.00,1.00,0.00,1.00 --100.80,28.80,1.00,0.00,1.00 -86.40,-28.80,1.00,0.00,1.00 --86.40,28.80,1.00,0.00,1.00 -96.00,-28.80,1.00,0.00,1.00 --76.80,28.80,1.00,0.00,1.00 -105.60,-24.00,1.00,0.00,1.00 --67.20,24.00,1.00,0.00,1.00 -120.00,-24.00,1.00,0.00,1.00 --57.60,24.00,1.00,0.00,1.00 -129.60,-24.00,1.00,0.00,1.00 --48.00,19.20,1.00,0.00,1.00 -139.20,-19.20,1.00,0.00,1.00 --38.40,19.20,1.00,0.00,1.00 -148.80,-14.40,1.00,0.00,1.00 --28.80,14.40,1.00,0.00,1.00 -158.40,-9.60,1.00,0.00,1.00 --19.20,9.60,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 --158.40,9.60,1.00,0.00,1.00 -24.00,-9.60,1.00,0.00,1.00 --153.60,14.40,1.00,0.00,1.00 -33.60,-14.40,1.00,0.00,1.00 --144.00,19.20,1.00,0.00,1.00 -43.20,-19.20,1.00,0.00,1.00 --134.40,19.20,1.00,0.00,1.00 -52.80,-24.00,1.00,0.00,1.00 --124.80,24.00,1.00,0.00,1.00 -62.40,-24.00,1.00,0.00,1.00 --110.40,24.00,1.00,0.00,1.00 -72.00,-24.00,1.00,0.00,1.00 --100.80,28.80,1.00,0.00,1.00 -81.60,-28.80,1.00,0.00,1.00 --91.20,28.80,1.00,0.00,1.00 -96.00,-28.80,1.00,0.00,1.00 --81.60,28.80,1.00,0.00,1.00 -105.60,-24.00,1.00,0.00,1.00 --72.00,24.00,1.00,0.00,1.00 -115.20,-24.00,1.00,0.00,1.00 --57.60,24.00,1.00,0.00,1.00 -124.80,-24.00,1.00,0.00,1.00 --48.00,19.20,1.00,0.00,1.00 -134.40,-19.20,1.00,0.00,1.00 --38.40,19.20,1.00,0.00,1.00 -144.00,-14.40,1.00,0.00,1.00 --28.80,14.40,1.00,0.00,1.00 -153.60,-14.40,1.00,0.00,1.00 --24.00,9.60,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 --14.40,4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 --158.40,14.40,1.00,0.00,1.00 -24.00,-14.40,1.00,0.00,1.00 --148.80,19.20,1.00,0.00,1.00 -33.60,-19.20,1.00,0.00,1.00 --139.20,19.20,1.00,0.00,1.00 -43.20,-24.00,1.00,0.00,1.00 --129.60,24.00,1.00,0.00,1.00 -52.80,-28.80,1.00,0.00,1.00 --120.00,28.80,1.00,0.00,1.00 -62.40,-28.80,1.00,0.00,1.00 --110.40,28.80,1.00,0.00,1.00 -76.80,-28.80,1.00,0.00,1.00 --100.80,33.60,1.00,0.00,1.00 -86.40,-33.60,1.00,0.00,1.00 --86.40,33.60,1.00,0.00,1.00 -96.00,-33.60,1.00,0.00,1.00 --76.80,28.80,1.00,0.00,1.00 -110.40,-28.80,1.00,0.00,1.00 --67.20,28.80,1.00,0.00,1.00 -120.00,-28.80,1.00,0.00,1.00 --57.60,28.80,1.00,0.00,1.00 -129.60,-24.00,1.00,0.00,1.00 --48.00,24.00,1.00,0.00,1.00 -139.20,-24.00,1.00,0.00,1.00 --38.40,19.20,1.00,0.00,1.00 -148.80,-19.20,1.00,0.00,1.00 --28.80,14.40,1.00,0.00,1.00 -158.40,-14.40,1.00,0.00,1.00 --19.20,9.60,1.00,0.00,1.00 -168.00,-9.60,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 --163.20,9.60,1.00,0.00,1.00 -24.00,-14.40,1.00,0.00,1.00 --153.60,14.40,1.00,0.00,1.00 -33.60,-19.20,1.00,0.00,1.00 --144.00,19.20,1.00,0.00,1.00 -43.20,-24.00,1.00,0.00,1.00 --134.40,24.00,1.00,0.00,1.00 -52.80,-24.00,1.00,0.00,1.00 --124.80,28.80,1.00,0.00,1.00 -62.40,-28.80,1.00,0.00,1.00 --115.20,28.80,1.00,0.00,1.00 -72.00,-28.80,1.00,0.00,1.00 --100.80,28.80,1.00,0.00,1.00 -81.60,-33.60,1.00,0.00,1.00 --91.20,33.60,1.00,0.00,1.00 -96.00,-33.60,1.00,0.00,1.00 --81.60,33.60,1.00,0.00,1.00 -105.60,-28.80,1.00,0.00,1.00 --67.20,28.80,1.00,0.00,1.00 -115.20,-28.80,1.00,0.00,1.00 --57.60,28.80,1.00,0.00,1.00 -124.80,-28.80,1.00,0.00,1.00 --48.00,24.00,1.00,0.00,1.00 -134.40,-24.00,1.00,0.00,1.00 --38.40,19.20,1.00,0.00,1.00 -144.00,-19.20,1.00,0.00,1.00 --28.80,19.20,1.00,0.00,1.00 -153.60,-14.40,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 --14.40,9.60,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 --158.40,14.40,1.00,0.00,1.00 -24.00,-14.40,1.00,0.00,1.00 --153.60,19.20,1.00,0.00,1.00 -33.60,-24.00,1.00,0.00,1.00 --144.00,24.00,1.00,0.00,1.00 -43.20,-24.00,1.00,0.00,1.00 --134.40,28.80,1.00,0.00,1.00 -52.80,-28.80,1.00,0.00,1.00 --124.80,33.60,1.00,0.00,1.00 -62.40,-33.60,1.00,0.00,1.00 --110.40,33.60,1.00,0.00,1.00 -72.00,-33.60,1.00,0.00,1.00 --100.80,38.40,1.00,0.00,1.00 -86.40,-38.40,1.00,0.00,1.00 --86.40,38.40,1.00,0.00,1.00 -96.00,-38.40,1.00,0.00,1.00 --76.80,33.60,1.00,0.00,1.00 -110.40,-33.60,1.00,0.00,1.00 --67.20,33.60,1.00,0.00,1.00 -120.00,-33.60,1.00,0.00,1.00 --52.80,28.80,1.00,0.00,1.00 -129.60,-28.80,1.00,0.00,1.00 --43.20,28.80,1.00,0.00,1.00 -139.20,-24.00,1.00,0.00,1.00 --33.60,24.00,1.00,0.00,1.00 -148.80,-19.20,1.00,0.00,1.00 --24.00,19.20,1.00,0.00,1.00 -158.40,-14.40,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 -168.00,-9.60,1.00,0.00,1.00 --9.60,4.80,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 --168.00,4.80,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 -24.00,-14.40,1.00,0.00,1.00 --153.60,19.20,1.00,0.00,1.00 -28.80,-19.20,1.00,0.00,1.00 --144.00,24.00,1.00,0.00,1.00 -38.40,-24.00,1.00,0.00,1.00 --134.40,28.80,1.00,0.00,1.00 -48.00,-28.80,1.00,0.00,1.00 --124.80,28.80,1.00,0.00,1.00 -57.60,-33.60,1.00,0.00,1.00 --115.20,33.60,1.00,0.00,1.00 -72.00,-33.60,1.00,0.00,1.00 --105.60,33.60,1.00,0.00,1.00 -81.60,-38.40,1.00,0.00,1.00 --91.20,38.40,1.00,0.00,1.00 -96.00,-38.40,1.00,0.00,1.00 --81.60,38.40,1.00,0.00,1.00 -105.60,-33.60,1.00,0.00,1.00 --67.20,33.60,1.00,0.00,1.00 -120.00,-33.60,1.00,0.00,1.00 --57.60,33.60,1.00,0.00,1.00 -129.60,-28.80,1.00,0.00,1.00 --48.00,28.80,1.00,0.00,1.00 -139.20,-24.00,1.00,0.00,1.00 --38.40,24.00,1.00,0.00,1.00 -148.80,-24.00,1.00,0.00,1.00 --28.80,19.20,1.00,0.00,1.00 -158.40,-14.40,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 -163.20,-9.60,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 -9.60,-4.80,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 -14.40,-14.40,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 -24.00,-19.20,1.00,0.00,1.00 --153.60,19.20,1.00,0.00,1.00 -28.80,-24.00,1.00,0.00,1.00 --144.00,28.80,1.00,0.00,1.00 -38.40,-28.80,1.00,0.00,1.00 --134.40,33.60,1.00,0.00,1.00 -48.00,-33.60,1.00,0.00,1.00 --124.80,33.60,1.00,0.00,1.00 -62.40,-38.40,1.00,0.00,1.00 --115.20,38.40,1.00,0.00,1.00 -72.00,-38.40,1.00,0.00,1.00 --100.80,43.20,1.00,0.00,1.00 -86.40,-43.20,1.00,0.00,1.00 --86.40,43.20,1.00,0.00,1.00 -96.00,-43.20,1.00,0.00,1.00 --76.80,38.40,1.00,0.00,1.00 -110.40,-38.40,1.00,0.00,1.00 --62.40,38.40,1.00,0.00,1.00 -120.00,-38.40,1.00,0.00,1.00 --52.80,33.60,1.00,0.00,1.00 -134.40,-33.60,1.00,0.00,1.00 --43.20,28.80,1.00,0.00,1.00 -144.00,-28.80,1.00,0.00,1.00 --33.60,24.00,1.00,0.00,1.00 -153.60,-24.00,1.00,0.00,1.00 --24.00,19.20,1.00,0.00,1.00 -158.40,-19.20,1.00,0.00,1.00 --14.40,14.40,1.00,0.00,1.00 -168.00,-9.60,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 -14.40,-9.60,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 -19.20,-19.20,1.00,0.00,1.00 --153.60,19.20,1.00,0.00,1.00 -28.80,-24.00,1.00,0.00,1.00 --148.80,24.00,1.00,0.00,1.00 -38.40,-28.80,1.00,0.00,1.00 --139.20,28.80,1.00,0.00,1.00 -48.00,-33.60,1.00,0.00,1.00 --129.60,33.60,1.00,0.00,1.00 -57.60,-38.40,1.00,0.00,1.00 --115.20,38.40,1.00,0.00,1.00 -67.20,-38.40,1.00,0.00,1.00 --105.60,38.40,1.00,0.00,1.00 -81.60,-43.20,1.00,0.00,1.00 --91.20,43.20,1.00,0.00,1.00 -96.00,-43.20,1.00,0.00,1.00 --76.80,43.20,1.00,0.00,1.00 -105.60,-38.40,1.00,0.00,1.00 --67.20,38.40,1.00,0.00,1.00 -120.00,-38.40,1.00,0.00,1.00 --52.80,33.60,1.00,0.00,1.00 -129.60,-33.60,1.00,0.00,1.00 --43.20,33.60,1.00,0.00,1.00 -139.20,-28.80,1.00,0.00,1.00 --33.60,28.80,1.00,0.00,1.00 -148.80,-24.00,1.00,0.00,1.00 --28.80,19.20,1.00,0.00,1.00 -158.40,-19.20,1.00,0.00,1.00 --19.20,14.40,1.00,0.00,1.00 -163.20,-14.40,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 --177.60,4.80,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 --168.00,9.60,1.00,0.00,1.00 -14.40,-14.40,1.00,0.00,1.00 --163.20,19.20,1.00,0.00,1.00 -19.20,-19.20,1.00,0.00,1.00 --153.60,24.00,1.00,0.00,1.00 -28.80,-28.80,1.00,0.00,1.00 --148.80,28.80,1.00,0.00,1.00 -38.40,-33.60,1.00,0.00,1.00 --139.20,33.60,1.00,0.00,1.00 -48.00,-38.40,1.00,0.00,1.00 --124.80,38.40,1.00,0.00,1.00 -57.60,-43.20,1.00,0.00,1.00 --115.20,43.20,1.00,0.00,1.00 -72.00,-43.20,1.00,0.00,1.00 --100.80,43.20,1.00,0.00,1.00 -86.40,-48.00,1.00,0.00,1.00 --86.40,48.00,1.00,0.00,1.00 -100.80,-48.00,1.00,0.00,1.00 --76.80,43.20,1.00,0.00,1.00 -110.40,-43.20,1.00,0.00,1.00 --62.40,43.20,1.00,0.00,1.00 -124.80,-38.40,1.00,0.00,1.00 --48.00,38.40,1.00,0.00,1.00 -134.40,-38.40,1.00,0.00,1.00 --38.40,33.60,1.00,0.00,1.00 -144.00,-28.80,1.00,0.00,1.00 --28.80,28.80,1.00,0.00,1.00 -153.60,-24.00,1.00,0.00,1.00 --24.00,24.00,1.00,0.00,1.00 -163.20,-19.20,1.00,0.00,1.00 --14.40,14.40,1.00,0.00,1.00 -168.00,-14.40,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --0.00,0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 -4.80,-4.80,1.00,0.00,1.00 --172.80,9.60,1.00,0.00,1.00 -9.60,-14.40,1.00,0.00,1.00 --163.20,14.40,1.00,0.00,1.00 -19.20,-19.20,1.00,0.00,1.00 --158.40,24.00,1.00,0.00,1.00 -28.80,-24.00,1.00,0.00,1.00 --148.80,28.80,1.00,0.00,1.00 -33.60,-28.80,1.00,0.00,1.00 --139.20,33.60,1.00,0.00,1.00 -43.20,-38.40,1.00,0.00,1.00 --129.60,38.40,1.00,0.00,1.00 -57.60,-38.40,1.00,0.00,1.00 --120.00,43.20,1.00,0.00,1.00 -67.20,-43.20,1.00,0.00,1.00 --105.60,43.20,1.00,0.00,1.00 -81.60,-48.00,1.00,0.00,1.00 --91.20,48.00,1.00,0.00,1.00 -96.00,-48.00,1.00,0.00,1.00 --76.80,43.20,1.00,0.00,1.00 -110.40,-43.20,1.00,0.00,1.00 --67.20,43.20,1.00,0.00,1.00 -120.00,-43.20,1.00,0.00,1.00 --52.80,38.40,1.00,0.00,1.00 -134.40,-38.40,1.00,0.00,1.00 --43.20,33.60,1.00,0.00,1.00 -144.00,-33.60,1.00,0.00,1.00 --33.60,28.80,1.00,0.00,1.00 -153.60,-28.80,1.00,0.00,1.00 --24.00,24.00,1.00,0.00,1.00 -158.40,-19.20,1.00,0.00,1.00 --19.20,19.20,1.00,0.00,1.00 -168.00,-14.40,1.00,0.00,1.00 --9.60,9.60,1.00,0.00,1.00 -172.80,-4.80,1.00,0.00,1.00 --4.80,4.80,1.00,0.00,1.00 +0.00,0.00,0.00,0.00,1.00,-0.00,0.00 +-177.60,-4.80,16.00,0.00,1.00,-0.00,0.00 +4.80,4.80,0.02,0.00,1.00,-0.00,0.00 +-168.00,-9.60,15.98,0.00,1.00,-0.00,0.00 +14.40,14.40,0.04,0.00,1.00,-0.00,0.00 +-163.20,-14.40,15.96,0.00,1.00,-0.00,0.00 +19.20,19.20,0.06,0.00,1.00,-0.00,0.00 +-153.60,-24.00,15.94,0.00,1.00,-0.00,0.00 +28.80,24.00,0.09,0.00,1.00,-0.00,0.00 +-148.80,-28.80,15.91,0.00,1.00,-0.00,0.00 +38.40,33.60,0.11,0.00,1.00,-0.00,0.00 +-139.20,-33.60,15.89,0.00,1.00,-0.00,0.00 +48.00,38.40,0.13,0.00,1.00,-0.00,0.00 +-124.80,-38.40,15.87,0.00,1.00,-0.00,0.00 +57.60,38.40,0.15,0.00,1.00,-0.00,0.00 +-115.20,-43.20,15.85,0.00,1.00,-0.00,0.00 +72.00,43.20,0.17,0.00,1.00,-0.00,0.00 +-100.80,-43.20,15.83,0.00,1.00,-0.00,0.00 +86.40,43.20,0.19,0.00,1.00,-0.00,0.00 +-86.40,-43.20,15.81,0.00,1.00,-177.60,0.00 +100.80,43.20,0.21,0.00,1.00,-177.60,0.00 +-76.80,-43.20,15.79,0.00,1.00,-177.60,0.00 +110.40,43.20,0.23,0.00,1.00,-177.60,0.00 +-62.40,-43.20,15.77,0.00,1.00,-177.60,0.00 +124.80,38.40,0.26,0.00,1.00,-177.60,0.00 +-52.80,-38.40,15.74,0.00,1.00,177.60,0.00 +134.40,33.60,0.28,0.00,1.00,177.60,0.00 +-38.40,-33.60,15.72,0.00,1.00,177.60,0.00 +144.00,28.80,0.30,0.00,1.00,177.60,0.00 +-33.60,-28.80,15.70,0.00,1.00,177.60,0.00 +153.60,24.00,0.32,0.00,1.00,177.60,0.00 +-24.00,-19.20,15.68,0.00,1.00,177.60,0.00 +158.40,19.20,0.34,0.00,1.00,177.60,0.00 +-14.40,-14.40,15.66,0.00,1.00,177.60,0.00 +168.00,9.60,0.36,0.00,1.00,177.60,0.00 +-9.60,-9.60,15.64,0.00,1.00,177.60,0.00 +172.80,4.80,0.38,0.00,1.00,177.60,0.00 +-0.00,-0.00,15.62,0.00,1.00,177.60,0.00 +-177.60,-0.00,0.41,0.00,1.00,-177.60,0.00 +4.80,4.80,15.59,0.00,1.00,-177.60,0.00 +-172.80,-9.60,0.43,0.00,1.00,-177.60,0.00 +14.40,9.60,15.57,0.00,1.00,-177.60,0.00 +-163.20,-14.40,0.45,0.00,1.00,-177.60,0.00 +19.20,19.20,15.55,0.00,1.00,-177.60,0.00 +-158.40,-19.20,0.47,0.00,1.00,-177.60,0.00 +28.80,24.00,15.53,0.00,1.00,-177.60,0.00 +-148.80,-28.80,0.49,0.00,1.00,-177.60,0.00 +33.60,28.80,15.51,0.00,1.00,-177.60,0.00 +-139.20,-33.60,0.51,0.00,1.00,-177.60,0.00 +43.20,33.60,15.49,0.00,1.00,-177.60,0.00 +-129.60,-38.40,0.53,0.00,1.00,-177.60,0.00 +57.60,38.40,15.47,0.00,1.00,177.60,0.00 +-120.00,-43.20,0.56,0.00,1.00,177.60,0.00 +67.20,43.20,15.44,0.00,1.00,177.60,0.00 +-105.60,-43.20,0.58,0.00,1.00,177.60,0.00 +81.60,43.20,15.42,0.00,1.00,177.60,0.00 +-91.20,-43.20,0.60,0.00,1.00,177.60,0.00 +96.00,43.20,15.40,0.00,1.00,0.00,0.00 +-76.80,-43.20,0.62,0.00,1.00,0.00,0.00 +110.40,43.20,15.38,0.00,1.00,0.00,0.00 +-67.20,-43.20,0.64,0.00,1.00,0.00,0.00 +120.00,38.40,15.36,0.00,1.00,0.00,0.00 +-52.80,-38.40,0.66,0.00,1.00,0.00,0.00 +129.60,38.40,15.34,0.00,1.00,0.00,0.00 +-43.20,-33.60,0.68,0.00,1.00,0.00,0.00 +144.00,33.60,15.32,0.00,1.00,0.00,0.00 +-33.60,-28.80,0.70,0.00,1.00,0.00,0.00 +148.80,24.00,15.30,0.00,1.00,0.00,0.00 +-24.00,-24.00,0.73,0.00,1.00,0.00,0.00 +158.40,19.20,15.27,0.00,1.00,0.00,0.00 +-19.20,-14.40,0.75,0.00,1.00,0.00,0.00 +168.00,14.40,15.25,0.00,1.00,0.00,0.00 +-9.60,-9.60,0.77,0.00,1.00,0.00,0.00 +172.80,4.80,15.23,0.00,1.00,0.00,0.00 +-4.80,-4.80,0.79,0.00,1.00,0.00,0.00 +0.00,0.00,15.21,0.00,1.00,0.00,0.00 +-177.60,-4.80,0.81,0.00,1.00,0.00,-0.00 +9.60,4.80,15.19,0.00,1.00,0.00,-0.00 +-168.00,-9.60,0.83,0.00,1.00,0.00,-0.00 +14.40,14.40,15.17,0.00,1.00,0.00,-0.00 +-163.20,-14.40,0.85,0.00,1.00,0.00,-0.00 +24.00,19.20,15.15,0.00,1.00,4.80,-0.00 +-153.60,-19.20,0.88,0.00,1.00,4.80,-4.80 +28.80,24.00,15.12,0.00,1.00,4.80,-4.80 +-144.00,-24.00,0.90,0.00,1.00,4.80,-4.80 +38.40,28.80,15.10,0.00,1.00,4.80,-4.80 +-134.40,-28.80,0.92,0.00,1.00,4.80,-4.80 +48.00,33.60,15.08,0.00,1.00,9.60,-4.80 +-124.80,-33.60,0.94,0.00,1.00,9.60,-4.80 +62.40,38.40,15.06,0.00,1.00,9.60,-4.80 +-115.20,-38.40,0.96,0.00,1.00,14.40,-4.80 +72.00,38.40,15.04,0.00,1.00,19.20,-4.80 +-100.80,-38.40,0.98,0.00,1.00,28.80,-4.80 +86.40,38.40,15.02,0.00,1.00,52.80,-4.80 +-86.40,-38.40,1.00,0.00,1.00,105.60,-4.80 +96.00,38.40,15.00,0.00,1.00,139.20,-4.80 +-76.80,-38.40,1.03,0.00,1.00,158.40,-4.80 +110.40,38.40,14.97,0.00,1.00,163.20,-4.80 +-62.40,-38.40,1.05,0.00,1.00,168.00,-4.80 +120.00,33.60,14.95,0.00,1.00,168.00,-4.80 +-52.80,-33.60,1.07,0.00,1.00,172.80,-4.80 +134.40,33.60,14.93,0.00,1.00,172.80,-4.80 +-43.20,-28.80,1.09,0.00,1.00,172.80,-4.80 +144.00,28.80,14.91,0.00,1.00,172.80,-4.80 +-33.60,-24.00,1.11,0.00,1.00,177.60,-4.80 +148.80,24.00,14.89,0.00,1.00,177.60,-4.80 +-24.00,-19.20,1.13,0.00,1.00,177.60,-4.80 +158.40,14.40,14.87,0.00,1.00,177.60,-0.00 +-19.20,-14.40,1.15,0.00,1.00,177.60,-0.00 +168.00,9.60,14.85,0.00,1.00,177.60,-0.00 +-9.60,-9.60,1.17,0.00,1.00,177.60,-0.00 +172.80,4.80,14.83,0.00,1.00,177.60,-0.00 +-0.00,-0.00,1.20,0.00,1.00,177.60,-0.00 +-177.60,-0.00,14.80,0.00,1.00,-177.60,0.00 +4.80,4.80,1.22,0.00,1.00,-177.60,0.00 +-172.80,-9.60,14.78,0.00,1.00,-177.60,0.00 +14.40,9.60,1.24,0.00,1.00,-177.60,0.00 +-163.20,-14.40,14.76,0.00,1.00,-177.60,0.00 +19.20,14.40,1.26,0.00,1.00,-177.60,0.00 +-153.60,-19.20,14.74,0.00,1.00,-177.60,4.80 +28.80,24.00,1.28,0.00,1.00,-177.60,4.80 +-148.80,-24.00,14.72,0.00,1.00,-177.60,4.80 +38.40,28.80,1.30,0.00,1.00,-172.80,4.80 +-139.20,-28.80,14.70,0.00,1.00,-172.80,4.80 +48.00,33.60,1.32,0.00,1.00,-172.80,4.80 +-124.80,-33.60,14.68,0.00,1.00,-172.80,4.80 +57.60,33.60,1.35,0.00,1.00,-168.00,4.80 +-115.20,-38.40,14.65,0.00,1.00,-168.00,4.80 +72.00,38.40,1.37,0.00,1.00,-163.20,4.80 +-105.60,-38.40,14.63,0.00,1.00,-158.40,4.80 +81.60,38.40,1.39,0.00,1.00,-139.20,4.80 +-91.20,-38.40,14.61,0.00,1.00,-105.60,4.80 +96.00,38.40,1.41,0.00,1.00,-52.80,4.80 +-76.80,-38.40,14.59,0.00,1.00,-28.80,4.80 +105.60,38.40,1.43,0.00,1.00,-19.20,4.80 +-67.20,-38.40,14.57,0.00,1.00,-14.40,4.80 +120.00,38.40,1.45,0.00,1.00,-9.60,4.80 +-57.60,-33.60,14.55,0.00,1.00,-9.60,4.80 +129.60,33.60,1.47,0.00,1.00,-9.60,4.80 +-43.20,-28.80,14.53,0.00,1.00,-4.80,4.80 +139.20,28.80,1.50,0.00,1.00,-4.80,4.80 +-33.60,-24.00,14.50,0.00,1.00,-4.80,4.80 +148.80,24.00,1.52,0.00,1.00,-4.80,4.80 +-28.80,-19.20,14.48,0.00,1.00,-4.80,4.80 +158.40,19.20,1.54,0.00,1.00,-4.80,0.00 +-19.20,-14.40,14.46,0.00,1.00,-0.00,0.00 +163.20,14.40,1.56,0.00,1.00,-0.00,0.00 +-9.60,-9.60,14.44,0.00,1.00,-0.00,0.00 +172.80,4.80,1.58,0.00,1.00,-0.00,0.00 +-4.80,-4.80,14.42,0.00,1.00,-0.00,0.00 +0.00,0.00,1.60,0.00,1.00,0.00,0.00 +-177.60,-4.80,14.40,0.00,1.00,0.00,-0.00 +9.60,4.80,1.62,0.00,1.00,0.00,-0.00 +-168.00,-9.60,14.38,0.00,1.00,4.80,-0.00 +14.40,9.60,1.64,0.00,1.00,4.80,-4.80 +-158.40,-14.40,14.36,0.00,1.00,4.80,-4.80 +24.00,14.40,1.67,0.00,1.00,4.80,-4.80 +-153.60,-19.20,14.33,0.00,1.00,4.80,-4.80 +33.60,19.20,1.69,0.00,1.00,9.60,-4.80 +-144.00,-24.00,14.31,0.00,1.00,9.60,-4.80 +43.20,24.00,1.71,0.00,1.00,9.60,-4.80 +-134.40,-28.80,14.29,0.00,1.00,14.40,-9.60 +52.80,28.80,1.73,0.00,1.00,14.40,-9.60 +-124.80,-28.80,14.27,0.00,1.00,19.20,-9.60 +62.40,33.60,1.75,0.00,1.00,24.00,-9.60 +-110.40,-33.60,14.25,0.00,1.00,28.80,-9.60 +72.00,33.60,1.77,0.00,1.00,33.60,-9.60 +-100.80,-33.60,14.23,0.00,1.00,48.00,-9.60 +86.40,33.60,1.79,0.00,1.00,67.20,-9.60 +-86.40,-33.60,14.21,0.00,1.00,96.00,-9.60 +96.00,33.60,1.82,0.00,1.00,120.00,-9.60 +-76.80,-33.60,14.18,0.00,1.00,139.20,-9.60 +110.40,33.60,1.84,0.00,1.00,148.80,-9.60 +-67.20,-33.60,14.16,0.00,1.00,153.60,-9.60 +120.00,33.60,1.86,0.00,1.00,158.40,-9.60 +-52.80,-28.80,14.14,0.00,1.00,163.20,-9.60 +129.60,28.80,1.88,0.00,1.00,168.00,-9.60 +-43.20,-28.80,14.12,0.00,1.00,168.00,-9.60 +139.20,24.00,1.90,0.00,1.00,168.00,-4.80 +-33.60,-24.00,14.10,0.00,1.00,172.80,-4.80 +148.80,19.20,1.92,0.00,1.00,172.80,-4.80 +-24.00,-19.20,14.08,0.00,1.00,172.80,-4.80 +158.40,14.40,1.94,0.00,1.00,177.60,-4.80 +-19.20,-14.40,14.06,0.00,1.00,177.60,-4.80 +168.00,9.60,1.97,0.00,1.00,177.60,-4.80 +-9.60,-4.80,14.03,0.00,1.00,177.60,-0.00 +172.80,4.80,1.99,0.00,1.00,177.60,-0.00 +-0.00,-0.00,14.01,0.00,1.00,177.60,-0.00 +-177.60,-0.00,2.01,0.00,1.00,-177.60,0.00 +4.80,4.80,13.99,0.00,1.00,-177.60,0.00 +-168.00,-4.80,2.03,0.00,1.00,-177.60,0.00 +14.40,9.60,13.97,0.00,1.00,-177.60,4.80 +-163.20,-14.40,2.05,0.00,1.00,-177.60,4.80 +24.00,14.40,13.95,0.00,1.00,-177.60,4.80 +-153.60,-19.20,2.07,0.00,1.00,-172.80,4.80 +28.80,19.20,13.93,0.00,1.00,-172.80,4.80 +-144.00,-24.00,2.09,0.00,1.00,-172.80,4.80 +38.40,24.00,13.91,0.00,1.00,-168.00,4.80 +-134.40,-28.80,2.11,0.00,1.00,-168.00,9.60 +48.00,28.80,13.89,0.00,1.00,-168.00,9.60 +-124.80,-28.80,2.14,0.00,1.00,-163.20,9.60 +62.40,33.60,13.86,0.00,1.00,-158.40,9.60 +-115.20,-33.60,2.16,0.00,1.00,-153.60,9.60 +72.00,33.60,13.84,0.00,1.00,-148.80,9.60 +-100.80,-33.60,2.18,0.00,1.00,-139.20,9.60 +81.60,33.60,13.82,0.00,1.00,-120.00,9.60 +-91.20,-33.60,2.20,0.00,1.00,-96.00,9.60 +96.00,33.60,13.80,0.00,1.00,-67.20,9.60 +-81.60,-33.60,2.22,0.00,1.00,-48.00,9.60 +105.60,33.60,13.78,0.00,1.00,-33.60,9.60 +-67.20,-33.60,2.24,0.00,1.00,-28.80,9.60 +115.20,33.60,13.76,0.00,1.00,-24.00,9.60 +-57.60,-28.80,2.26,0.00,1.00,-19.20,9.60 +129.60,28.80,13.74,0.00,1.00,-14.40,9.60 +-48.00,-28.80,2.29,0.00,1.00,-14.40,9.60 +139.20,24.00,13.71,0.00,1.00,-9.60,4.80 +-38.40,-24.00,2.31,0.00,1.00,-9.60,4.80 +148.80,19.20,13.69,0.00,1.00,-9.60,4.80 +-28.80,-19.20,2.33,0.00,1.00,-4.80,4.80 +153.60,14.40,13.67,0.00,1.00,-4.80,4.80 +-19.20,-14.40,2.35,0.00,1.00,-4.80,4.80 +163.20,9.60,13.65,0.00,1.00,-4.80,4.80 +-9.60,-9.60,2.37,0.00,1.00,-4.80,0.00 +172.80,4.80,13.63,0.00,1.00,-0.00,0.00 +-4.80,-4.80,2.39,0.00,1.00,-0.00,0.00 +0.00,0.00,13.61,0.00,1.00,0.00,0.00 +-177.60,-4.80,2.41,0.00,1.00,0.00,-0.00 +9.60,4.80,13.59,0.00,1.00,4.80,-0.00 +-168.00,-9.60,2.44,0.00,1.00,4.80,-4.80 +14.40,9.60,13.56,0.00,1.00,4.80,-4.80 +-158.40,-9.60,2.46,0.00,1.00,4.80,-4.80 +24.00,14.40,13.54,0.00,1.00,9.60,-4.80 +-148.80,-14.40,2.48,0.00,1.00,9.60,-9.60 +33.60,19.20,13.52,0.00,1.00,9.60,-9.60 +-139.20,-19.20,2.50,0.00,1.00,14.40,-9.60 +43.20,24.00,13.50,0.00,1.00,14.40,-9.60 +-129.60,-24.00,2.52,0.00,1.00,19.20,-9.60 +52.80,24.00,13.48,0.00,1.00,19.20,-14.40 +-120.00,-28.80,2.54,0.00,1.00,24.00,-14.40 +62.40,28.80,13.46,0.00,1.00,28.80,-14.40 +-110.40,-28.80,2.56,0.00,1.00,38.40,-14.40 +76.80,28.80,13.44,0.00,1.00,48.00,-14.40 +-100.80,-28.80,2.58,0.00,1.00,57.60,-14.40 +86.40,28.80,13.42,0.00,1.00,76.80,-14.40 +-86.40,-28.80,2.61,0.00,1.00,96.00,-14.40 +96.00,28.80,13.39,0.00,1.00,115.20,-14.40 +-76.80,-28.80,2.63,0.00,1.00,129.60,-14.40 +105.60,28.80,13.37,0.00,1.00,139.20,-14.40 +-67.20,-28.80,2.65,0.00,1.00,144.00,-14.40 +120.00,28.80,13.35,0.00,1.00,153.60,-14.40 +-57.60,-24.00,2.67,0.00,1.00,158.40,-14.40 +129.60,24.00,13.33,0.00,1.00,158.40,-9.60 +-48.00,-24.00,2.69,0.00,1.00,163.20,-9.60 +139.20,19.20,13.31,0.00,1.00,168.00,-9.60 +-38.40,-19.20,2.71,0.00,1.00,168.00,-9.60 +148.80,19.20,13.29,0.00,1.00,168.00,-9.60 +-28.80,-14.40,2.73,0.00,1.00,172.80,-9.60 +158.40,14.40,13.27,0.00,1.00,172.80,-4.80 +-19.20,-9.60,2.76,0.00,1.00,172.80,-4.80 +163.20,9.60,13.24,0.00,1.00,177.60,-4.80 +-9.60,-4.80,2.78,0.00,1.00,177.60,-4.80 +172.80,4.80,13.22,0.00,1.00,177.60,-0.00 +-0.00,-0.00,2.80,0.00,1.00,177.60,-0.00 +-177.60,-0.00,13.20,0.00,1.00,-177.60,0.00 +4.80,4.80,2.82,0.00,1.00,-177.60,0.00 +-168.00,-4.80,13.18,0.00,1.00,-177.60,4.80 +14.40,9.60,2.84,0.00,1.00,-177.60,4.80 +-163.20,-9.60,13.16,0.00,1.00,-172.80,4.80 +24.00,14.40,2.86,0.00,1.00,-172.80,4.80 +-153.60,-14.40,13.14,0.00,1.00,-172.80,9.60 +33.60,19.20,2.88,0.00,1.00,-168.00,9.60 +-144.00,-19.20,13.12,0.00,1.00,-168.00,9.60 +43.20,19.20,2.91,0.00,1.00,-168.00,9.60 +-134.40,-24.00,13.09,0.00,1.00,-163.20,9.60 +52.80,24.00,2.93,0.00,1.00,-158.40,9.60 +-124.80,-24.00,13.07,0.00,1.00,-158.40,14.40 +62.40,28.80,2.95,0.00,1.00,-153.60,14.40 +-115.20,-28.80,13.05,0.00,1.00,-144.00,14.40 +72.00,28.80,2.97,0.00,1.00,-139.20,14.40 +-100.80,-28.80,13.03,0.00,1.00,-129.60,14.40 +81.60,28.80,2.99,0.00,1.00,-115.20,14.40 +-91.20,-28.80,13.01,0.00,1.00,-96.00,14.40 +96.00,28.80,3.01,0.00,1.00,-76.80,14.40 +-81.60,-28.80,12.99,0.00,1.00,-57.60,14.40 +105.60,28.80,3.03,0.00,1.00,-48.00,14.40 +-67.20,-28.80,12.97,0.00,1.00,-38.40,14.40 +115.20,28.80,3.05,0.00,1.00,-28.80,14.40 +-57.60,-28.80,12.95,0.00,1.00,-24.00,14.40 +124.80,24.00,3.08,0.00,1.00,-19.20,14.40 +-48.00,-24.00,12.92,0.00,1.00,-19.20,9.60 +134.40,24.00,3.10,0.00,1.00,-14.40,9.60 +-38.40,-19.20,12.90,0.00,1.00,-14.40,9.60 +144.00,19.20,3.12,0.00,1.00,-9.60,9.60 +-28.80,-14.40,12.88,0.00,1.00,-9.60,9.60 +153.60,14.40,3.14,0.00,1.00,-9.60,4.80 +-19.20,-9.60,12.86,0.00,1.00,-4.80,4.80 +163.20,9.60,3.16,0.00,1.00,-4.80,4.80 +-14.40,-9.60,12.84,0.00,1.00,-4.80,4.80 +172.80,4.80,3.18,0.00,1.00,-4.80,0.00 +-4.80,-4.80,12.82,0.00,1.00,-0.00,0.00 +0.00,0.00,3.20,0.00,1.00,0.00,0.00 +-177.60,-0.00,12.80,0.00,1.00,0.00,-0.00 +9.60,4.80,3.23,0.00,1.00,4.80,-4.80 +-168.00,-4.80,12.77,0.00,1.00,4.80,-4.80 +19.20,9.60,3.25,0.00,1.00,4.80,-4.80 +-158.40,-9.60,12.75,0.00,1.00,9.60,-9.60 +24.00,14.40,3.27,0.00,1.00,9.60,-9.60 +-148.80,-14.40,12.73,0.00,1.00,14.40,-9.60 +33.60,14.40,3.29,0.00,1.00,14.40,-9.60 +-139.20,-19.20,12.71,0.00,1.00,19.20,-14.40 +43.20,19.20,3.31,0.00,1.00,19.20,-14.40 +-129.60,-19.20,12.69,0.00,1.00,24.00,-14.40 +52.80,19.20,3.33,0.00,1.00,28.80,-14.40 +-120.00,-24.00,12.67,0.00,1.00,33.60,-19.20 +67.20,24.00,3.35,0.00,1.00,38.40,-19.20 +-110.40,-24.00,12.65,0.00,1.00,43.20,-19.20 +76.80,24.00,3.38,0.00,1.00,52.80,-19.20 +-100.80,-24.00,12.62,0.00,1.00,67.20,-19.20 +86.40,24.00,3.40,0.00,1.00,76.80,-19.20 +-86.40,-24.00,12.60,0.00,1.00,96.00,-19.20 +96.00,24.00,3.42,0.00,1.00,105.60,-19.20 +-76.80,-24.00,12.58,0.00,1.00,120.00,-19.20 +105.60,24.00,3.44,0.00,1.00,129.60,-19.20 +-67.20,-24.00,12.56,0.00,1.00,139.20,-19.20 +115.20,24.00,3.46,0.00,1.00,144.00,-19.20 +-57.60,-24.00,12.54,0.00,1.00,148.80,-14.40 +129.60,19.20,3.48,0.00,1.00,153.60,-14.40 +-48.00,-19.20,12.52,0.00,1.00,158.40,-14.40 +139.20,19.20,3.50,0.00,1.00,163.20,-14.40 +-38.40,-14.40,12.50,0.00,1.00,163.20,-14.40 +148.80,14.40,3.52,0.00,1.00,168.00,-9.60 +-28.80,-14.40,12.48,0.00,1.00,168.00,-9.60 +153.60,9.60,3.55,0.00,1.00,172.80,-9.60 +-19.20,-9.60,12.45,0.00,1.00,172.80,-4.80 +163.20,9.60,3.57,0.00,1.00,172.80,-4.80 +-9.60,-4.80,12.43,0.00,1.00,177.60,-4.80 +172.80,4.80,3.59,0.00,1.00,177.60,-0.00 +-0.00,-0.00,12.41,0.00,1.00,177.60,-0.00 +-177.60,-0.00,3.61,0.00,1.00,-177.60,0.00 +4.80,4.80,12.39,0.00,1.00,-177.60,0.00 +-168.00,-4.80,3.63,0.00,1.00,-177.60,4.80 +14.40,9.60,12.37,0.00,1.00,-172.80,4.80 +-158.40,-9.60,3.65,0.00,1.00,-172.80,4.80 +24.00,9.60,12.35,0.00,1.00,-172.80,9.60 +-153.60,-14.40,3.67,0.00,1.00,-168.00,9.60 +33.60,14.40,12.33,0.00,1.00,-168.00,9.60 +-144.00,-14.40,3.70,0.00,1.00,-163.20,14.40 +43.20,19.20,12.30,0.00,1.00,-163.20,14.40 +-134.40,-19.20,3.72,0.00,1.00,-158.40,14.40 +52.80,19.20,12.28,0.00,1.00,-153.60,14.40 +-124.80,-24.00,3.74,0.00,1.00,-148.80,14.40 +62.40,24.00,12.26,0.00,1.00,-144.00,19.20 +-110.40,-24.00,3.76,0.00,1.00,-139.20,19.20 +72.00,24.00,12.24,0.00,1.00,-129.60,19.20 +-100.80,-24.00,3.78,0.00,1.00,-120.00,19.20 +81.60,24.00,12.22,0.00,1.00,-105.60,19.20 +-91.20,-24.00,3.80,0.00,1.00,-96.00,19.20 +96.00,24.00,12.20,0.00,1.00,-76.80,19.20 +-81.60,-24.00,3.82,0.00,1.00,-67.20,19.20 +105.60,24.00,12.18,0.00,1.00,-52.80,19.20 +-72.00,-24.00,3.85,0.00,1.00,-43.20,19.20 +115.20,24.00,12.15,0.00,1.00,-38.40,19.20 +-57.60,-24.00,3.87,0.00,1.00,-33.60,19.20 +124.80,19.20,12.13,0.00,1.00,-28.80,14.40 +-48.00,-19.20,3.89,0.00,1.00,-24.00,14.40 +134.40,19.20,12.11,0.00,1.00,-19.20,14.40 +-38.40,-19.20,3.91,0.00,1.00,-19.20,14.40 +144.00,14.40,12.09,0.00,1.00,-14.40,9.60 +-28.80,-14.40,3.93,0.00,1.00,-14.40,9.60 +153.60,14.40,12.07,0.00,1.00,-9.60,9.60 +-24.00,-9.60,3.95,0.00,1.00,-9.60,9.60 +163.20,9.60,12.05,0.00,1.00,-4.80,4.80 +-14.40,-4.80,3.97,0.00,1.00,-4.80,4.80 +172.80,4.80,12.03,0.00,1.00,-4.80,4.80 +-4.80,-0.00,3.99,0.00,1.00,-0.00,0.00 +0.00,0.00,12.01,0.00,1.00,0.00,0.00 +-177.60,-0.00,4.02,0.00,1.00,0.00,-0.00 +9.60,4.80,11.98,0.00,1.00,4.80,-4.80 +-168.00,-4.80,4.04,0.00,1.00,4.80,-4.80 +19.20,4.80,11.96,0.00,1.00,9.60,-9.60 +-158.40,-9.60,4.06,0.00,1.00,9.60,-9.60 +28.80,9.60,11.94,0.00,1.00,14.40,-9.60 +-148.80,-9.60,4.08,0.00,1.00,14.40,-14.40 +38.40,14.40,11.92,0.00,1.00,19.20,-14.40 +-139.20,-14.40,4.10,0.00,1.00,19.20,-14.40 +48.00,14.40,11.90,0.00,1.00,24.00,-19.20 +-129.60,-14.40,4.12,0.00,1.00,28.80,-19.20 +57.60,19.20,11.88,0.00,1.00,33.60,-19.20 +-120.00,-19.20,4.14,0.00,1.00,38.40,-19.20 +67.20,19.20,11.86,0.00,1.00,43.20,-24.00 +-110.40,-19.20,4.17,0.00,1.00,52.80,-24.00 +76.80,19.20,11.83,0.00,1.00,62.40,-24.00 +-100.80,-19.20,4.19,0.00,1.00,72.00,-24.00 +86.40,19.20,11.81,0.00,1.00,81.60,-24.00 +-86.40,-19.20,4.21,0.00,1.00,91.20,-24.00 +96.00,19.20,11.79,0.00,1.00,105.60,-24.00 +-76.80,-19.20,4.23,0.00,1.00,115.20,-24.00 +105.60,19.20,11.77,0.00,1.00,124.80,-24.00 +-67.20,-19.20,4.25,0.00,1.00,134.40,-24.00 +115.20,19.20,11.75,0.00,1.00,139.20,-19.20 +-57.60,-19.20,4.27,0.00,1.00,144.00,-19.20 +124.80,19.20,11.73,0.00,1.00,148.80,-19.20 +-48.00,-14.40,4.29,0.00,1.00,153.60,-19.20 +134.40,14.40,11.71,0.00,1.00,158.40,-19.20 +-38.40,-14.40,4.32,0.00,1.00,158.40,-14.40 +144.00,14.40,11.68,0.00,1.00,163.20,-14.40 +-28.80,-9.60,4.34,0.00,1.00,168.00,-14.40 +153.60,9.60,11.66,0.00,1.00,168.00,-9.60 +-19.20,-9.60,4.36,0.00,1.00,172.80,-9.60 +163.20,4.80,11.64,0.00,1.00,172.80,-4.80 +-9.60,-4.80,4.38,0.00,1.00,172.80,-4.80 +172.80,4.80,11.62,0.00,1.00,177.60,-4.80 +-0.00,-0.00,4.40,0.00,1.00,177.60,-0.00 +-177.60,-0.00,11.60,0.00,1.00,-177.60,0.00 +4.80,4.80,4.42,0.00,1.00,-177.60,4.80 +-168.00,-4.80,11.58,0.00,1.00,-172.80,4.80 +14.40,4.80,4.44,0.00,1.00,-172.80,4.80 +-158.40,-9.60,11.56,0.00,1.00,-172.80,9.60 +24.00,9.60,4.46,0.00,1.00,-168.00,9.60 +-148.80,-9.60,11.54,0.00,1.00,-168.00,14.40 +33.60,14.40,4.49,0.00,1.00,-163.20,14.40 +-139.20,-14.40,11.51,0.00,1.00,-158.40,14.40 +43.20,14.40,4.51,0.00,1.00,-158.40,19.20 +-129.60,-14.40,11.49,0.00,1.00,-153.60,19.20 +52.80,19.20,4.53,0.00,1.00,-148.80,19.20 +-120.00,-19.20,11.47,0.00,1.00,-144.00,19.20 +62.40,19.20,4.55,0.00,1.00,-139.20,19.20 +-110.40,-19.20,11.45,0.00,1.00,-134.40,24.00 +72.00,19.20,4.57,0.00,1.00,-124.80,24.00 +-100.80,-19.20,11.43,0.00,1.00,-115.20,24.00 +81.60,19.20,4.59,0.00,1.00,-105.60,24.00 +-91.20,-19.20,11.41,0.00,1.00,-91.20,24.00 +96.00,19.20,4.61,0.00,1.00,-81.60,24.00 +-81.60,-19.20,11.39,0.00,1.00,-72.00,24.00 +105.60,19.20,4.64,0.00,1.00,-62.40,24.00 +-72.00,-19.20,11.36,0.00,1.00,-52.80,24.00 +115.20,19.20,4.66,0.00,1.00,-43.20,24.00 +-62.40,-19.20,11.34,0.00,1.00,-38.40,19.20 +124.80,19.20,4.68,0.00,1.00,-33.60,19.20 +-52.80,-14.40,11.32,0.00,1.00,-28.80,19.20 +134.40,14.40,4.70,0.00,1.00,-24.00,19.20 +-43.20,-14.40,11.30,0.00,1.00,-19.20,14.40 +144.00,14.40,4.72,0.00,1.00,-19.20,14.40 +-33.60,-9.60,11.28,0.00,1.00,-14.40,14.40 +153.60,9.60,4.74,0.00,1.00,-14.40,9.60 +-24.00,-9.60,11.26,0.00,1.00,-9.60,9.60 +163.20,4.80,4.76,0.00,1.00,-9.60,9.60 +-14.40,-4.80,11.24,0.00,1.00,-4.80,4.80 +172.80,4.80,4.79,0.00,1.00,-4.80,4.80 +-4.80,-0.00,11.21,0.00,1.00,-0.00,0.00 +0.00,0.00,4.81,0.00,1.00,0.00,0.00 +-177.60,-0.00,11.19,0.00,1.00,0.00,-0.00 +9.60,4.80,4.83,0.00,1.00,4.80,-4.80 +-168.00,-4.80,11.17,0.00,1.00,4.80,-4.80 +19.20,4.80,4.85,0.00,1.00,9.60,-9.60 +-158.40,-4.80,11.15,0.00,1.00,14.40,-9.60 +28.80,9.60,4.87,0.00,1.00,14.40,-14.40 +-148.80,-9.60,11.13,0.00,1.00,19.20,-14.40 +38.40,9.60,4.89,0.00,1.00,19.20,-19.20 +-139.20,-9.60,11.11,0.00,1.00,24.00,-19.20 +48.00,9.60,4.91,0.00,1.00,28.80,-19.20 +-129.60,-14.40,11.09,0.00,1.00,33.60,-24.00 +57.60,14.40,4.93,0.00,1.00,38.40,-24.00 +-120.00,-14.40,11.07,0.00,1.00,43.20,-24.00 +67.20,14.40,4.96,0.00,1.00,48.00,-24.00 +-110.40,-14.40,11.04,0.00,1.00,57.60,-28.80 +76.80,14.40,4.98,0.00,1.00,62.40,-28.80 +-100.80,-14.40,11.02,0.00,1.00,72.00,-28.80 +86.40,14.40,5.00,0.00,1.00,81.60,-28.80 +-86.40,-14.40,11.00,0.00,1.00,91.20,-28.80 +96.00,14.40,5.02,0.00,1.00,100.80,-28.80 +-76.80,-14.40,10.98,0.00,1.00,110.40,-28.80 +105.60,14.40,5.04,0.00,1.00,120.00,-28.80 +-67.20,-14.40,10.96,0.00,1.00,129.60,-28.80 +115.20,14.40,5.06,0.00,1.00,134.40,-24.00 +-57.60,-14.40,10.94,0.00,1.00,139.20,-24.00 +124.80,14.40,5.08,0.00,1.00,144.00,-24.00 +-48.00,-14.40,10.92,0.00,1.00,148.80,-24.00 +134.40,9.60,5.11,0.00,1.00,153.60,-19.20 +-38.40,-9.60,10.89,0.00,1.00,158.40,-19.20 +144.00,9.60,5.13,0.00,1.00,158.40,-14.40 +-28.80,-9.60,10.87,0.00,1.00,163.20,-14.40 +153.60,4.80,5.15,0.00,1.00,168.00,-14.40 +-19.20,-4.80,10.85,0.00,1.00,168.00,-9.60 +163.20,4.80,5.17,0.00,1.00,172.80,-9.60 +-9.60,-4.80,10.83,0.00,1.00,172.80,-4.80 +172.80,0.00,5.19,0.00,1.00,177.60,-4.80 +-0.00,-0.00,10.81,0.00,1.00,177.60,-0.00 +-177.60,-0.00,5.21,0.00,1.00,-177.60,0.00 +4.80,0.00,10.79,0.00,1.00,-177.60,4.80 +-168.00,-4.80,5.23,0.00,1.00,-172.80,4.80 +14.40,4.80,10.77,0.00,1.00,-172.80,9.60 +-158.40,-4.80,5.26,0.00,1.00,-168.00,9.60 +24.00,4.80,10.74,0.00,1.00,-168.00,14.40 +-148.80,-9.60,5.28,0.00,1.00,-163.20,14.40 +33.60,9.60,10.72,0.00,1.00,-158.40,14.40 +-139.20,-9.60,5.30,0.00,1.00,-158.40,19.20 +43.20,9.60,10.70,0.00,1.00,-153.60,19.20 +-129.60,-14.40,5.32,0.00,1.00,-148.80,24.00 +52.80,14.40,10.68,0.00,1.00,-144.00,24.00 +-120.00,-14.40,5.34,0.00,1.00,-139.20,24.00 +62.40,14.40,10.66,0.00,1.00,-134.40,24.00 +-110.40,-14.40,5.36,0.00,1.00,-129.60,28.80 +72.00,14.40,10.64,0.00,1.00,-120.00,28.80 +-100.80,-14.40,5.38,0.00,1.00,-110.40,28.80 +81.60,14.40,10.62,0.00,1.00,-100.80,28.80 +-91.20,-14.40,5.40,0.00,1.00,-91.20,28.80 +96.00,14.40,10.60,0.00,1.00,-81.60,28.80 +-81.60,-14.40,5.43,0.00,1.00,-72.00,28.80 +105.60,14.40,10.57,0.00,1.00,-62.40,28.80 +-72.00,-14.40,5.45,0.00,1.00,-57.60,28.80 +115.20,14.40,10.55,0.00,1.00,-48.00,24.00 +-62.40,-14.40,5.47,0.00,1.00,-43.20,24.00 +124.80,14.40,10.53,0.00,1.00,-38.40,24.00 +-52.80,-14.40,5.49,0.00,1.00,-33.60,24.00 +134.40,9.60,10.51,0.00,1.00,-28.80,19.20 +-43.20,-9.60,5.51,0.00,1.00,-24.00,19.20 +144.00,9.60,10.49,0.00,1.00,-19.20,19.20 +-33.60,-9.60,5.53,0.00,1.00,-19.20,14.40 +153.60,9.60,10.47,0.00,1.00,-14.40,14.40 +-24.00,-4.80,5.55,0.00,1.00,-14.40,9.60 +163.20,4.80,10.45,0.00,1.00,-9.60,9.60 +-14.40,-4.80,5.58,0.00,1.00,-4.80,4.80 +172.80,4.80,10.42,0.00,1.00,-4.80,4.80 +-4.80,-0.00,5.60,0.00,1.00,-0.00,0.00 +0.00,0.00,10.40,0.00,1.00,0.00,0.00 +-177.60,-0.00,5.62,0.00,1.00,4.80,-4.80 +9.60,0.00,10.38,0.00,1.00,4.80,-4.80 +-168.00,-4.80,5.64,0.00,1.00,9.60,-9.60 +19.20,4.80,10.36,0.00,1.00,9.60,-9.60 +-158.40,-4.80,5.66,0.00,1.00,14.40,-14.40 +28.80,4.80,10.34,0.00,1.00,19.20,-14.40 +-148.80,-4.80,5.68,0.00,1.00,19.20,-19.20 +38.40,4.80,10.32,0.00,1.00,24.00,-19.20 +-139.20,-9.60,5.70,0.00,1.00,28.80,-24.00 +48.00,9.60,10.30,0.00,1.00,33.60,-24.00 +-129.60,-9.60,5.72,0.00,1.00,38.40,-24.00 +57.60,9.60,10.28,0.00,1.00,43.20,-28.80 +-120.00,-9.60,5.75,0.00,1.00,48.00,-28.80 +67.20,9.60,10.25,0.00,1.00,52.80,-28.80 +-110.40,-9.60,5.77,0.00,1.00,57.60,-33.60 +76.80,9.60,10.23,0.00,1.00,67.20,-33.60 +-100.80,-9.60,5.79,0.00,1.00,76.80,-33.60 +86.40,9.60,10.21,0.00,1.00,81.60,-33.60 +-86.40,-9.60,5.81,0.00,1.00,91.20,-33.60 +96.00,9.60,10.19,0.00,1.00,100.80,-33.60 +-76.80,-9.60,5.83,0.00,1.00,110.40,-33.60 +105.60,9.60,10.17,0.00,1.00,115.20,-33.60 +-67.20,-9.60,5.85,0.00,1.00,124.80,-33.60 +115.20,9.60,10.15,0.00,1.00,129.60,-28.80 +-57.60,-9.60,5.87,0.00,1.00,134.40,-28.80 +124.80,9.60,10.13,0.00,1.00,139.20,-28.80 +-48.00,-9.60,5.90,0.00,1.00,144.00,-24.00 +134.40,9.60,10.10,0.00,1.00,148.80,-24.00 +-38.40,-9.60,5.92,0.00,1.00,153.60,-19.20 +144.00,4.80,10.08,0.00,1.00,158.40,-19.20 +-28.80,-4.80,5.94,0.00,1.00,163.20,-14.40 +153.60,4.80,10.06,0.00,1.00,163.20,-14.40 +-19.20,-4.80,5.96,0.00,1.00,168.00,-9.60 +163.20,4.80,10.04,0.00,1.00,172.80,-9.60 +-9.60,-0.00,5.98,0.00,1.00,172.80,-4.80 +172.80,0.00,10.02,0.00,1.00,177.60,-4.80 +-0.00,-0.00,6.00,0.00,1.00,177.60,-0.00 +-177.60,-0.00,10.00,0.00,1.00,-177.60,0.00 +4.80,0.00,6.02,0.00,1.00,-177.60,4.80 +-168.00,-0.00,9.98,0.00,1.00,-172.80,4.80 +14.40,4.80,6.05,0.00,1.00,-172.80,9.60 +-158.40,-4.80,9.95,0.00,1.00,-168.00,9.60 +24.00,4.80,6.07,0.00,1.00,-163.20,14.40 +-148.80,-4.80,9.93,0.00,1.00,-163.20,14.40 +33.60,4.80,6.09,0.00,1.00,-158.40,19.20 +-139.20,-9.60,9.91,0.00,1.00,-153.60,19.20 +43.20,9.60,6.11,0.00,1.00,-148.80,24.00 +-129.60,-9.60,9.89,0.00,1.00,-144.00,24.00 +52.80,9.60,6.13,0.00,1.00,-139.20,28.80 +-120.00,-9.60,9.87,0.00,1.00,-134.40,28.80 +62.40,9.60,6.15,0.00,1.00,-129.60,28.80 +-110.40,-9.60,9.85,0.00,1.00,-124.80,33.60 +72.00,9.60,6.17,0.00,1.00,-115.20,33.60 +-100.80,-9.60,9.83,0.00,1.00,-110.40,33.60 +81.60,9.60,6.19,0.00,1.00,-100.80,33.60 +-91.20,-9.60,9.81,0.00,1.00,-91.20,33.60 +96.00,9.60,6.22,0.00,1.00,-81.60,33.60 +-81.60,-9.60,9.78,0.00,1.00,-76.80,33.60 +105.60,9.60,6.24,0.00,1.00,-67.20,33.60 +-72.00,-9.60,9.76,0.00,1.00,-57.60,33.60 +115.20,9.60,6.26,0.00,1.00,-52.80,28.80 +-62.40,-9.60,9.74,0.00,1.00,-48.00,28.80 +124.80,9.60,6.28,0.00,1.00,-43.20,28.80 +-52.80,-9.60,9.72,0.00,1.00,-38.40,24.00 +134.40,9.60,6.30,0.00,1.00,-33.60,24.00 +-43.20,-9.60,9.70,0.00,1.00,-28.80,24.00 +144.00,4.80,6.32,0.00,1.00,-24.00,19.20 +-33.60,-4.80,9.68,0.00,1.00,-19.20,19.20 +153.60,4.80,6.34,0.00,1.00,-19.20,14.40 +-24.00,-4.80,9.66,0.00,1.00,-14.40,14.40 +163.20,4.80,6.37,0.00,1.00,-9.60,9.60 +-14.40,-4.80,9.63,0.00,1.00,-9.60,9.60 +172.80,0.00,6.39,0.00,1.00,-4.80,4.80 +-4.80,-0.00,9.61,0.00,1.00,-4.80,4.80 +0.00,0.00,6.41,0.00,1.00,0.00,0.00 +-177.60,-0.00,9.59,0.00,1.00,4.80,-4.80 +9.60,0.00,6.43,0.00,1.00,4.80,-4.80 +-168.00,-0.00,9.57,0.00,1.00,9.60,-9.60 +19.20,0.00,6.45,0.00,1.00,14.40,-9.60 +-158.40,-4.80,9.55,0.00,1.00,14.40,-14.40 +28.80,4.80,6.47,0.00,1.00,19.20,-19.20 +-148.80,-4.80,9.53,0.00,1.00,24.00,-19.20 +38.40,4.80,6.49,0.00,1.00,24.00,-24.00 +-139.20,-4.80,9.51,0.00,1.00,28.80,-24.00 +48.00,4.80,6.52,0.00,1.00,33.60,-28.80 +-129.60,-4.80,9.48,0.00,1.00,38.40,-28.80 +57.60,4.80,6.54,0.00,1.00,43.20,-33.60 +-120.00,-4.80,9.46,0.00,1.00,48.00,-33.60 +67.20,4.80,6.56,0.00,1.00,57.60,-33.60 +-110.40,-4.80,9.44,0.00,1.00,62.40,-38.40 +76.80,4.80,6.58,0.00,1.00,67.20,-38.40 +-100.80,-4.80,9.42,0.00,1.00,76.80,-38.40 +86.40,4.80,6.60,0.00,1.00,86.40,-38.40 +-86.40,-4.80,9.40,0.00,1.00,91.20,-38.40 +96.00,4.80,6.62,0.00,1.00,100.80,-38.40 +-76.80,-4.80,9.38,0.00,1.00,105.60,-38.40 +105.60,4.80,6.64,0.00,1.00,115.20,-38.40 +-67.20,-4.80,9.36,0.00,1.00,120.00,-33.60 +115.20,4.80,6.66,0.00,1.00,124.80,-33.60 +-57.60,-4.80,9.34,0.00,1.00,134.40,-33.60 +124.80,4.80,6.69,0.00,1.00,139.20,-28.80 +-48.00,-4.80,9.31,0.00,1.00,144.00,-28.80 +134.40,4.80,6.71,0.00,1.00,148.80,-24.00 +-38.40,-4.80,9.29,0.00,1.00,153.60,-24.00 +144.00,4.80,6.73,0.00,1.00,153.60,-19.20 +-28.80,-4.80,9.27,0.00,1.00,158.40,-19.20 +153.60,4.80,6.75,0.00,1.00,163.20,-14.40 +-19.20,-4.80,9.25,0.00,1.00,168.00,-14.40 +163.20,0.00,6.77,0.00,1.00,168.00,-9.60 +-9.60,-0.00,9.23,0.00,1.00,172.80,-9.60 +172.80,0.00,6.79,0.00,1.00,177.60,-4.80 +-0.00,-0.00,9.21,0.00,1.00,177.60,-0.00 +-177.60,-0.00,6.81,0.00,1.00,-177.60,0.00 +4.80,0.00,9.19,0.00,1.00,-177.60,4.80 +-168.00,-0.00,6.84,0.00,1.00,-172.80,9.60 +14.40,0.00,9.16,0.00,1.00,-168.00,9.60 +-158.40,-4.80,6.86,0.00,1.00,-168.00,14.40 +24.00,4.80,9.14,0.00,1.00,-163.20,14.40 +-148.80,-4.80,6.88,0.00,1.00,-158.40,19.20 +33.60,4.80,9.12,0.00,1.00,-153.60,19.20 +-139.20,-4.80,6.90,0.00,1.00,-153.60,24.00 +43.20,4.80,9.10,0.00,1.00,-148.80,24.00 +-129.60,-4.80,6.92,0.00,1.00,-144.00,28.80 +52.80,4.80,9.08,0.00,1.00,-139.20,28.80 +-120.00,-4.80,6.94,0.00,1.00,-134.40,33.60 +62.40,4.80,9.06,0.00,1.00,-124.80,33.60 +-110.40,-4.80,6.96,0.00,1.00,-120.00,33.60 +72.00,4.80,9.04,0.00,1.00,-115.20,38.40 +-100.80,-4.80,6.99,0.00,1.00,-105.60,38.40 +81.60,4.80,9.01,0.00,1.00,-100.80,38.40 +-91.20,-4.80,7.01,0.00,1.00,-91.20,38.40 +96.00,4.80,8.99,0.00,1.00,-86.40,38.40 +-81.60,-4.80,7.03,0.00,1.00,-76.80,38.40 +105.60,4.80,8.97,0.00,1.00,-67.20,38.40 +-72.00,-4.80,7.05,0.00,1.00,-62.40,38.40 +115.20,4.80,8.95,0.00,1.00,-57.60,33.60 +-62.40,-4.80,7.07,0.00,1.00,-48.00,33.60 +124.80,4.80,8.93,0.00,1.00,-43.20,33.60 +-52.80,-4.80,7.09,0.00,1.00,-38.40,28.80 +134.40,4.80,8.91,0.00,1.00,-33.60,28.80 +-43.20,-4.80,7.11,0.00,1.00,-28.80,24.00 +144.00,4.80,8.89,0.00,1.00,-24.00,24.00 +-33.60,-4.80,7.13,0.00,1.00,-24.00,19.20 +153.60,4.80,8.87,0.00,1.00,-19.20,19.20 +-24.00,-4.80,7.16,0.00,1.00,-14.40,14.40 +163.20,0.00,8.84,0.00,1.00,-14.40,9.60 +-14.40,-0.00,7.18,0.00,1.00,-9.60,9.60 +172.80,0.00,8.82,0.00,1.00,-4.80,4.80 +-4.80,-0.00,7.20,0.00,1.00,-4.80,4.80 +0.00,0.00,8.80,0.00,1.00,0.00,0.00 +-177.60,-0.00,7.22,0.00,1.00,4.80,-4.80 +9.60,0.00,8.78,0.00,1.00,4.80,-4.80 +-168.00,-0.00,7.24,0.00,1.00,9.60,-9.60 +19.20,0.00,8.76,0.00,1.00,14.40,-14.40 +-158.40,-0.00,7.26,0.00,1.00,19.20,-14.40 +28.80,0.00,8.74,0.00,1.00,19.20,-19.20 +-148.80,-0.00,7.28,0.00,1.00,24.00,-24.00 +38.40,0.00,8.72,0.00,1.00,28.80,-24.00 +-139.20,-0.00,7.31,0.00,1.00,33.60,-28.80 +48.00,0.00,8.69,0.00,1.00,38.40,-28.80 +-129.60,-0.00,7.33,0.00,1.00,43.20,-33.60 +57.60,0.00,8.67,0.00,1.00,48.00,-33.60 +-120.00,-0.00,7.35,0.00,1.00,52.80,-38.40 +67.20,0.00,8.65,0.00,1.00,57.60,-38.40 +-110.40,-0.00,7.37,0.00,1.00,62.40,-38.40 +76.80,0.00,8.63,0.00,1.00,72.00,-43.20 +-100.80,-0.00,7.39,0.00,1.00,76.80,-43.20 +86.40,0.00,8.61,0.00,1.00,86.40,-43.20 +-86.40,-0.00,7.41,0.00,1.00,91.20,-43.20 +96.00,0.00,8.59,0.00,1.00,100.80,-43.20 +-76.80,-0.00,7.43,0.00,1.00,105.60,-43.20 +105.60,0.00,8.57,0.00,1.00,110.40,-43.20 +-67.20,-0.00,7.46,0.00,1.00,120.00,-38.40 +115.20,0.00,8.54,0.00,1.00,124.80,-38.40 +-57.60,-0.00,7.48,0.00,1.00,129.60,-38.40 +124.80,0.00,8.52,0.00,1.00,134.40,-33.60 +-48.00,-0.00,7.50,0.00,1.00,139.20,-33.60 +134.40,0.00,8.50,0.00,1.00,144.00,-28.80 +-38.40,-0.00,7.52,0.00,1.00,148.80,-28.80 +144.00,0.00,8.48,0.00,1.00,153.60,-24.00 +-28.80,-0.00,7.54,0.00,1.00,158.40,-19.20 +153.60,0.00,8.46,0.00,1.00,163.20,-19.20 +-19.20,-0.00,7.56,0.00,1.00,163.20,-14.40 +163.20,0.00,8.44,0.00,1.00,168.00,-9.60 +-9.60,-0.00,7.58,0.00,1.00,172.80,-9.60 +172.80,0.00,8.42,0.00,1.00,172.80,-4.80 +-0.00,-0.00,7.60,0.00,1.00,177.60,-0.00 +-177.60,-0.00,8.40,0.00,1.00,-177.60,0.00 +4.80,0.00,7.63,0.00,1.00,-172.80,4.80 +-168.00,-0.00,8.37,0.00,1.00,-172.80,9.60 +14.40,0.00,7.65,0.00,1.00,-168.00,9.60 +-158.40,-0.00,8.35,0.00,1.00,-163.20,14.40 +24.00,0.00,7.67,0.00,1.00,-163.20,19.20 +-148.80,-0.00,8.33,0.00,1.00,-158.40,19.20 +33.60,0.00,7.69,0.00,1.00,-153.60,24.00 +-139.20,-0.00,8.31,0.00,1.00,-148.80,28.80 +43.20,0.00,7.71,0.00,1.00,-144.00,28.80 +-129.60,-0.00,8.29,0.00,1.00,-139.20,33.60 +52.80,0.00,7.73,0.00,1.00,-134.40,33.60 +-120.00,-0.00,8.27,0.00,1.00,-129.60,38.40 +62.40,0.00,7.75,0.00,1.00,-124.80,38.40 +-110.40,-0.00,8.25,0.00,1.00,-120.00,38.40 +72.00,0.00,7.78,0.00,1.00,-110.40,43.20 +-100.80,-0.00,8.22,0.00,1.00,-105.60,43.20 +81.60,0.00,7.80,0.00,1.00,-100.80,43.20 +-91.20,-0.00,8.20,0.00,1.00,-91.20,43.20 +96.00,0.00,7.82,0.00,1.00,-86.40,43.20 +-81.60,-0.00,8.18,0.00,1.00,-76.80,43.20 +105.60,0.00,7.84,0.00,1.00,-72.00,43.20 +-72.00,-0.00,8.16,0.00,1.00,-62.40,38.40 +115.20,0.00,7.86,0.00,1.00,-57.60,38.40 +-62.40,-0.00,8.14,0.00,1.00,-52.80,38.40 +124.80,0.00,7.88,0.00,1.00,-48.00,33.60 +-52.80,-0.00,8.12,0.00,1.00,-43.20,33.60 +134.40,0.00,7.90,0.00,1.00,-38.40,28.80 +-43.20,-0.00,8.10,0.00,1.00,-33.60,28.80 +144.00,0.00,7.93,0.00,1.00,-28.80,24.00 +-33.60,-0.00,8.07,0.00,1.00,-24.00,24.00 +153.60,0.00,7.95,0.00,1.00,-19.20,19.20 +-24.00,-0.00,8.05,0.00,1.00,-19.20,14.40 +163.20,0.00,7.97,0.00,1.00,-14.40,14.40 +-14.40,-0.00,8.03,0.00,1.00,-9.60,9.60 +172.80,0.00,7.99,0.00,1.00,-4.80,4.80 +-4.80,-0.00,8.01,0.00,1.00,-4.80,4.80 +0.00,0.00,8.01,0.00,1.00,0.00,0.00 +-177.60,0.00,7.99,0.00,1.00,4.80,-4.80 +9.60,-0.00,8.03,0.00,1.00,4.80,-4.80 +-168.00,0.00,7.97,0.00,1.00,9.60,-9.60 +19.20,-0.00,8.05,0.00,1.00,14.40,-14.40 +-158.40,0.00,7.95,0.00,1.00,19.20,-19.20 +28.80,-0.00,8.07,0.00,1.00,24.00,-19.20 +-148.80,0.00,7.93,0.00,1.00,24.00,-24.00 +38.40,-0.00,8.10,0.00,1.00,28.80,-28.80 +-139.20,0.00,7.90,0.00,1.00,33.60,-28.80 +48.00,-0.00,8.12,0.00,1.00,38.40,-33.60 +-129.60,0.00,7.88,0.00,1.00,43.20,-38.40 +57.60,-4.80,8.14,0.00,1.00,48.00,-38.40 +-120.00,4.80,7.86,0.00,1.00,52.80,-43.20 +67.20,-4.80,8.16,0.00,1.00,62.40,-43.20 +-110.40,4.80,7.84,0.00,1.00,67.20,-43.20 +76.80,-4.80,8.18,0.00,1.00,72.00,-48.00 +-100.80,4.80,7.82,0.00,1.00,76.80,-48.00 +86.40,-4.80,8.20,0.00,1.00,86.40,-48.00 +-86.40,4.80,7.80,0.00,1.00,91.20,-48.00 +96.00,-4.80,8.22,0.00,1.00,96.00,-48.00 +-76.80,4.80,7.78,0.00,1.00,105.60,-48.00 +105.60,-4.80,8.25,0.00,1.00,110.40,-48.00 +-67.20,4.80,7.75,0.00,1.00,115.20,-43.20 +115.20,-4.80,8.27,0.00,1.00,120.00,-43.20 +-57.60,4.80,7.73,0.00,1.00,129.60,-38.40 +124.80,-4.80,8.29,0.00,1.00,134.40,-38.40 +-48.00,0.00,7.71,0.00,1.00,139.20,-33.60 +134.40,-0.00,8.31,0.00,1.00,144.00,-33.60 +-38.40,0.00,7.69,0.00,1.00,148.80,-28.80 +144.00,-0.00,8.33,0.00,1.00,153.60,-24.00 +-28.80,0.00,7.67,0.00,1.00,153.60,-24.00 +153.60,-0.00,8.35,0.00,1.00,158.40,-19.20 +-19.20,0.00,7.65,0.00,1.00,163.20,-14.40 +163.20,-0.00,8.37,0.00,1.00,168.00,-14.40 +-9.60,0.00,7.63,0.00,1.00,172.80,-9.60 +172.80,-0.00,8.40,0.00,1.00,172.80,-4.80 +-0.00,0.00,7.60,0.00,1.00,177.60,-0.00 +-177.60,0.00,8.42,0.00,1.00,-177.60,0.00 +4.80,-0.00,7.58,0.00,1.00,-172.80,4.80 +-168.00,0.00,8.44,0.00,1.00,-172.80,9.60 +14.40,-0.00,7.56,0.00,1.00,-168.00,14.40 +-158.40,0.00,8.46,0.00,1.00,-163.20,14.40 +24.00,-0.00,7.54,0.00,1.00,-158.40,19.20 +-148.80,0.00,8.48,0.00,1.00,-153.60,24.00 +33.60,-0.00,7.52,0.00,1.00,-153.60,24.00 +-139.20,0.00,8.50,0.00,1.00,-148.80,28.80 +43.20,-0.00,7.50,0.00,1.00,-144.00,33.60 +-129.60,0.00,8.52,0.00,1.00,-139.20,33.60 +52.80,-4.80,7.48,0.00,1.00,-134.40,38.40 +-120.00,4.80,8.54,0.00,1.00,-129.60,38.40 +62.40,-4.80,7.46,0.00,1.00,-120.00,43.20 +-110.40,4.80,8.57,0.00,1.00,-115.20,43.20 +72.00,-4.80,7.43,0.00,1.00,-110.40,48.00 +-100.80,4.80,8.59,0.00,1.00,-105.60,48.00 +81.60,-4.80,7.41,0.00,1.00,-96.00,48.00 +-91.20,4.80,8.61,0.00,1.00,-91.20,48.00 +96.00,-4.80,7.39,0.00,1.00,-86.40,48.00 +-81.60,4.80,8.63,0.00,1.00,-76.80,48.00 +105.60,-4.80,7.37,0.00,1.00,-72.00,48.00 +-72.00,4.80,8.65,0.00,1.00,-67.20,43.20 +115.20,-4.80,7.35,0.00,1.00,-62.40,43.20 +-62.40,4.80,8.67,0.00,1.00,-52.80,43.20 +124.80,-4.80,7.33,0.00,1.00,-48.00,38.40 +-52.80,0.00,8.69,0.00,1.00,-43.20,38.40 +134.40,-0.00,7.31,0.00,1.00,-38.40,33.60 +-43.20,0.00,8.72,0.00,1.00,-33.60,28.80 +144.00,-0.00,7.28,0.00,1.00,-28.80,28.80 +-33.60,0.00,8.74,0.00,1.00,-24.00,24.00 +153.60,-0.00,7.26,0.00,1.00,-24.00,19.20 +-24.00,0.00,8.76,0.00,1.00,-19.20,19.20 +163.20,-0.00,7.24,0.00,1.00,-14.40,14.40 +-14.40,0.00,8.78,0.00,1.00,-9.60,9.60 +172.80,-0.00,7.22,0.00,1.00,-4.80,4.80 +-4.80,0.00,8.80,0.00,1.00,-4.80,4.80 +0.00,0.00,7.20,0.00,1.00,0.00,0.00 +-177.60,0.00,8.82,0.00,1.00,4.80,-4.80 +9.60,-0.00,7.18,0.00,1.00,9.60,-9.60 +-168.00,0.00,8.84,0.00,1.00,9.60,-9.60 +19.20,-4.80,7.16,0.00,1.00,14.40,-14.40 +-158.40,4.80,8.87,0.00,1.00,19.20,-19.20 +28.80,-4.80,7.13,0.00,1.00,24.00,-24.00 +-148.80,4.80,8.89,0.00,1.00,28.80,-24.00 +38.40,-4.80,7.11,0.00,1.00,33.60,-28.80 +-139.20,4.80,8.91,0.00,1.00,38.40,-33.60 +48.00,-4.80,7.09,0.00,1.00,43.20,-38.40 +-129.60,4.80,8.93,0.00,1.00,48.00,-38.40 +57.60,-4.80,7.07,0.00,1.00,52.80,-43.20 +-120.00,4.80,8.95,0.00,1.00,57.60,-43.20 +67.20,-4.80,7.05,0.00,1.00,62.40,-48.00 +-110.40,9.60,8.97,0.00,1.00,67.20,-48.00 +76.80,-9.60,7.03,0.00,1.00,72.00,-52.80 +-100.80,9.60,8.99,0.00,1.00,81.60,-52.80 +86.40,-9.60,7.01,0.00,1.00,86.40,-52.80 +-86.40,9.60,9.01,0.00,1.00,91.20,-52.80 +96.00,-9.60,6.99,0.00,1.00,96.00,-52.80 +-76.80,9.60,9.04,0.00,1.00,105.60,-52.80 +105.60,-9.60,6.96,0.00,1.00,110.40,-48.00 +-67.20,9.60,9.06,0.00,1.00,115.20,-48.00 +115.20,-4.80,6.94,0.00,1.00,120.00,-48.00 +-57.60,4.80,9.08,0.00,1.00,124.80,-43.20 +124.80,-4.80,6.92,0.00,1.00,129.60,-43.20 +-48.00,4.80,9.10,0.00,1.00,134.40,-38.40 +134.40,-4.80,6.90,0.00,1.00,139.20,-33.60 +-38.40,4.80,9.12,0.00,1.00,144.00,-33.60 +144.00,-4.80,6.88,0.00,1.00,148.80,-28.80 +-28.80,4.80,9.14,0.00,1.00,153.60,-24.00 +153.60,-4.80,6.86,0.00,1.00,158.40,-19.20 +-19.20,4.80,9.16,0.00,1.00,163.20,-19.20 +163.20,-0.00,6.84,0.00,1.00,168.00,-14.40 +-9.60,0.00,9.19,0.00,1.00,168.00,-9.60 +172.80,-0.00,6.81,0.00,1.00,172.80,-4.80 +-0.00,0.00,9.21,0.00,1.00,177.60,-0.00 +-177.60,0.00,6.79,0.00,1.00,-177.60,0.00 +4.80,-0.00,9.23,0.00,1.00,-172.80,4.80 +-168.00,0.00,6.77,0.00,1.00,-168.00,9.60 +14.40,-0.00,9.25,0.00,1.00,-168.00,14.40 +-158.40,4.80,6.75,0.00,1.00,-163.20,19.20 +24.00,-4.80,9.27,0.00,1.00,-158.40,19.20 +-148.80,4.80,6.73,0.00,1.00,-153.60,24.00 +33.60,-4.80,9.29,0.00,1.00,-148.80,28.80 +-139.20,4.80,6.71,0.00,1.00,-144.00,33.60 +43.20,-4.80,9.31,0.00,1.00,-139.20,33.60 +-129.60,4.80,6.69,0.00,1.00,-134.40,38.40 +52.80,-4.80,9.34,0.00,1.00,-129.60,43.20 +-120.00,4.80,6.66,0.00,1.00,-124.80,43.20 +62.40,-4.80,9.36,0.00,1.00,-120.00,48.00 +-110.40,9.60,6.64,0.00,1.00,-115.20,48.00 +72.00,-9.60,9.38,0.00,1.00,-110.40,48.00 +-100.80,9.60,6.62,0.00,1.00,-105.60,52.80 +81.60,-9.60,9.40,0.00,1.00,-96.00,52.80 +-91.20,9.60,6.60,0.00,1.00,-91.20,52.80 +96.00,-9.60,9.42,0.00,1.00,-86.40,52.80 +-81.60,9.60,6.58,0.00,1.00,-81.60,52.80 +105.60,-9.60,9.44,0.00,1.00,-72.00,52.80 +-72.00,9.60,6.56,0.00,1.00,-67.20,48.00 +115.20,-4.80,9.46,0.00,1.00,-62.40,48.00 +-62.40,4.80,6.54,0.00,1.00,-57.60,43.20 +124.80,-4.80,9.48,0.00,1.00,-52.80,43.20 +-52.80,4.80,6.52,0.00,1.00,-48.00,38.40 +134.40,-4.80,9.51,0.00,1.00,-43.20,38.40 +-43.20,4.80,6.49,0.00,1.00,-38.40,33.60 +144.00,-4.80,9.53,0.00,1.00,-33.60,28.80 +-33.60,4.80,6.47,0.00,1.00,-28.80,24.00 +153.60,-4.80,9.55,0.00,1.00,-24.00,24.00 +-24.00,4.80,6.45,0.00,1.00,-19.20,19.20 +163.20,-4.80,9.57,0.00,1.00,-14.40,14.40 +-14.40,0.00,6.43,0.00,1.00,-9.60,9.60 +172.80,-0.00,9.59,0.00,1.00,-9.60,9.60 +-4.80,0.00,6.41,0.00,1.00,-4.80,4.80 +0.00,0.00,9.61,0.00,1.00,0.00,0.00 +-177.60,0.00,6.39,0.00,1.00,4.80,-4.80 +9.60,-0.00,9.63,0.00,1.00,9.60,-9.60 +-168.00,4.80,6.37,0.00,1.00,14.40,-14.40 +19.20,-4.80,9.66,0.00,1.00,14.40,-14.40 +-158.40,4.80,6.34,0.00,1.00,19.20,-19.20 +28.80,-4.80,9.68,0.00,1.00,24.00,-24.00 +-148.80,4.80,6.32,0.00,1.00,28.80,-28.80 +38.40,-9.60,9.70,0.00,1.00,33.60,-33.60 +-139.20,9.60,6.30,0.00,1.00,38.40,-33.60 +48.00,-9.60,9.72,0.00,1.00,43.20,-38.40 +-129.60,9.60,6.28,0.00,1.00,48.00,-43.20 +57.60,-9.60,9.74,0.00,1.00,52.80,-43.20 +-120.00,9.60,6.26,0.00,1.00,57.60,-48.00 +67.20,-9.60,9.76,0.00,1.00,62.40,-52.80 +-110.40,9.60,6.24,0.00,1.00,67.20,-52.80 +76.80,-14.40,9.78,0.00,1.00,76.80,-57.60 +-100.80,14.40,6.22,0.00,1.00,81.60,-57.60 +86.40,-14.40,9.81,0.00,1.00,86.40,-57.60 +-86.40,14.40,6.19,0.00,1.00,91.20,-57.60 +96.00,-14.40,9.83,0.00,1.00,96.00,-57.60 +-76.80,14.40,6.17,0.00,1.00,100.80,-57.60 +105.60,-14.40,9.85,0.00,1.00,110.40,-52.80 +-67.20,9.60,6.15,0.00,1.00,115.20,-52.80 +115.20,-9.60,9.87,0.00,1.00,120.00,-48.00 +-57.60,9.60,6.13,0.00,1.00,124.80,-48.00 +124.80,-9.60,9.89,0.00,1.00,129.60,-43.20 +-48.00,9.60,6.11,0.00,1.00,134.40,-38.40 +134.40,-9.60,9.91,0.00,1.00,139.20,-38.40 +-38.40,9.60,6.09,0.00,1.00,144.00,-33.60 +144.00,-9.60,9.93,0.00,1.00,148.80,-28.80 +-28.80,4.80,6.07,0.00,1.00,153.60,-24.00 +153.60,-4.80,9.95,0.00,1.00,158.40,-24.00 +-19.20,4.80,6.05,0.00,1.00,163.20,-19.20 +163.20,-4.80,9.98,0.00,1.00,168.00,-14.40 +-9.60,4.80,6.02,0.00,1.00,168.00,-9.60 +172.80,-0.00,10.00,0.00,1.00,172.80,-4.80 +-0.00,0.00,6.00,0.00,1.00,177.60,-0.00 +-177.60,0.00,10.02,0.00,1.00,-177.60,0.00 +4.80,-0.00,5.98,0.00,1.00,-172.80,4.80 +-168.00,4.80,10.04,0.00,1.00,-168.00,9.60 +14.40,-4.80,5.96,0.00,1.00,-168.00,14.40 +-158.40,4.80,10.06,0.00,1.00,-163.20,19.20 +24.00,-4.80,5.94,0.00,1.00,-158.40,24.00 +-148.80,4.80,10.08,0.00,1.00,-153.60,24.00 +33.60,-9.60,5.92,0.00,1.00,-148.80,28.80 +-139.20,9.60,10.10,0.00,1.00,-144.00,33.60 +43.20,-9.60,5.90,0.00,1.00,-139.20,38.40 +-129.60,9.60,10.13,0.00,1.00,-134.40,38.40 +52.80,-9.60,5.87,0.00,1.00,-129.60,43.20 +-120.00,9.60,10.15,0.00,1.00,-124.80,48.00 +62.40,-9.60,5.85,0.00,1.00,-120.00,48.00 +-110.40,9.60,10.17,0.00,1.00,-115.20,52.80 +72.00,-14.40,5.83,0.00,1.00,-110.40,52.80 +-100.80,14.40,10.19,0.00,1.00,-100.80,57.60 +81.60,-14.40,5.81,0.00,1.00,-96.00,57.60 +-91.20,14.40,10.21,0.00,1.00,-91.20,57.60 +96.00,-14.40,5.79,0.00,1.00,-86.40,57.60 +-81.60,14.40,10.23,0.00,1.00,-81.60,57.60 +105.60,-14.40,5.77,0.00,1.00,-76.80,57.60 +-72.00,9.60,10.25,0.00,1.00,-67.20,52.80 +115.20,-9.60,5.75,0.00,1.00,-62.40,52.80 +-62.40,9.60,10.28,0.00,1.00,-57.60,48.00 +124.80,-9.60,5.72,0.00,1.00,-52.80,43.20 +-52.80,9.60,10.30,0.00,1.00,-48.00,43.20 +134.40,-9.60,5.70,0.00,1.00,-43.20,38.40 +-43.20,9.60,10.32,0.00,1.00,-38.40,33.60 +144.00,-9.60,5.68,0.00,1.00,-33.60,33.60 +-33.60,4.80,10.34,0.00,1.00,-28.80,28.80 +153.60,-4.80,5.66,0.00,1.00,-24.00,24.00 +-24.00,4.80,10.36,0.00,1.00,-19.20,19.20 +163.20,-4.80,5.64,0.00,1.00,-14.40,14.40 +-14.40,4.80,10.38,0.00,1.00,-14.40,14.40 +172.80,-0.00,5.62,0.00,1.00,-9.60,9.60 +-4.80,0.00,10.40,0.00,1.00,-4.80,4.80 +0.00,0.00,5.60,0.00,1.00,0.00,0.00 +-177.60,0.00,10.42,0.00,1.00,4.80,-4.80 +9.60,-4.80,5.58,0.00,1.00,9.60,-9.60 +-168.00,4.80,10.45,0.00,1.00,14.40,-14.40 +19.20,-4.80,5.55,0.00,1.00,19.20,-19.20 +-158.40,4.80,10.47,0.00,1.00,19.20,-19.20 +28.80,-9.60,5.53,0.00,1.00,24.00,-24.00 +-148.80,9.60,10.49,0.00,1.00,28.80,-28.80 +38.40,-9.60,5.51,0.00,1.00,33.60,-33.60 +-139.20,9.60,10.51,0.00,1.00,38.40,-38.40 +48.00,-14.40,5.49,0.00,1.00,43.20,-43.20 +-129.60,14.40,10.53,0.00,1.00,48.00,-43.20 +57.60,-14.40,5.47,0.00,1.00,52.80,-48.00 +-120.00,14.40,10.55,0.00,1.00,57.60,-52.80 +67.20,-14.40,5.45,0.00,1.00,62.40,-52.80 +-110.40,14.40,10.57,0.00,1.00,72.00,-57.60 +76.80,-19.20,5.43,0.00,1.00,76.80,-57.60 +-100.80,19.20,10.60,0.00,1.00,81.60,-62.40 +86.40,-19.20,5.40,0.00,1.00,86.40,-62.40 +-86.40,19.20,10.62,0.00,1.00,91.20,-62.40 +96.00,-19.20,5.38,0.00,1.00,96.00,-62.40 +-76.80,19.20,10.64,0.00,1.00,100.80,-62.40 +105.60,-14.40,5.36,0.00,1.00,105.60,-57.60 +-67.20,14.40,10.66,0.00,1.00,110.40,-57.60 +115.20,-14.40,5.34,0.00,1.00,120.00,-52.80 +-57.60,14.40,10.68,0.00,1.00,124.80,-48.00 +124.80,-14.40,5.32,0.00,1.00,129.60,-48.00 +-48.00,14.40,10.70,0.00,1.00,134.40,-43.20 +134.40,-14.40,5.30,0.00,1.00,139.20,-38.40 +-38.40,9.60,10.72,0.00,1.00,144.00,-33.60 +144.00,-9.60,5.28,0.00,1.00,148.80,-33.60 +-28.80,9.60,10.74,0.00,1.00,153.60,-28.80 +153.60,-9.60,5.26,0.00,1.00,158.40,-24.00 +-19.20,4.80,10.77,0.00,1.00,158.40,-19.20 +163.20,-4.80,5.23,0.00,1.00,163.20,-14.40 +-9.60,4.80,10.79,0.00,1.00,168.00,-9.60 +172.80,-0.00,5.21,0.00,1.00,172.80,-4.80 +-0.00,0.00,10.81,0.00,1.00,177.60,-0.00 +-177.60,0.00,5.19,0.00,1.00,-177.60,0.00 +4.80,-0.00,10.83,0.00,1.00,-172.80,4.80 +-168.00,4.80,5.17,0.00,1.00,-168.00,9.60 +14.40,-4.80,10.85,0.00,1.00,-163.20,14.40 +-158.40,4.80,5.15,0.00,1.00,-158.40,19.20 +24.00,-9.60,10.87,0.00,1.00,-158.40,24.00 +-148.80,9.60,5.13,0.00,1.00,-153.60,28.80 +33.60,-9.60,10.89,0.00,1.00,-148.80,33.60 +-139.20,9.60,5.11,0.00,1.00,-144.00,33.60 +43.20,-14.40,10.92,0.00,1.00,-139.20,38.40 +-129.60,14.40,5.08,0.00,1.00,-134.40,43.20 +52.80,-14.40,10.94,0.00,1.00,-129.60,48.00 +-120.00,14.40,5.06,0.00,1.00,-124.80,48.00 +62.40,-14.40,10.96,0.00,1.00,-120.00,52.80 +-110.40,14.40,5.04,0.00,1.00,-110.40,57.60 +72.00,-14.40,10.98,0.00,1.00,-105.60,57.60 +-100.80,19.20,5.02,0.00,1.00,-100.80,62.40 +81.60,-19.20,11.00,0.00,1.00,-96.00,62.40 +-91.20,19.20,5.00,0.00,1.00,-91.20,62.40 +96.00,-19.20,11.02,0.00,1.00,-86.40,62.40 +-81.60,19.20,4.98,0.00,1.00,-81.60,62.40 +105.60,-19.20,11.04,0.00,1.00,-76.80,57.60 +-72.00,14.40,4.96,0.00,1.00,-72.00,57.60 +115.20,-14.40,11.07,0.00,1.00,-62.40,52.80 +-62.40,14.40,4.93,0.00,1.00,-57.60,52.80 +124.80,-14.40,11.09,0.00,1.00,-52.80,48.00 +-52.80,14.40,4.91,0.00,1.00,-48.00,43.20 +134.40,-14.40,11.11,0.00,1.00,-43.20,43.20 +-43.20,9.60,4.89,0.00,1.00,-38.40,38.40 +144.00,-9.60,11.13,0.00,1.00,-33.60,33.60 +-33.60,9.60,4.87,0.00,1.00,-28.80,28.80 +153.60,-9.60,11.15,0.00,1.00,-24.00,24.00 +-24.00,4.80,4.85,0.00,1.00,-19.20,19.20 +163.20,-4.80,11.17,0.00,1.00,-19.20,19.20 +-14.40,4.80,4.83,0.00,1.00,-14.40,14.40 +172.80,-4.80,11.19,0.00,1.00,-9.60,9.60 +-4.80,0.00,4.81,0.00,1.00,-4.80,4.80 +0.00,0.00,11.21,0.00,1.00,0.00,0.00 +-177.60,0.00,4.79,0.00,1.00,4.80,-4.80 +9.60,-4.80,11.24,0.00,1.00,9.60,-9.60 +-168.00,4.80,4.76,0.00,1.00,14.40,-14.40 +19.20,-4.80,11.26,0.00,1.00,19.20,-19.20 +-158.40,9.60,4.74,0.00,1.00,24.00,-24.00 +28.80,-9.60,11.28,0.00,1.00,28.80,-24.00 +-148.80,14.40,4.72,0.00,1.00,33.60,-28.80 +38.40,-14.40,11.30,0.00,1.00,38.40,-33.60 +-139.20,14.40,4.70,0.00,1.00,43.20,-38.40 +48.00,-14.40,11.32,0.00,1.00,48.00,-43.20 +-129.60,19.20,4.68,0.00,1.00,52.80,-48.00 +57.60,-19.20,11.34,0.00,1.00,57.60,-52.80 +-120.00,19.20,4.66,0.00,1.00,62.40,-52.80 +67.20,-19.20,11.36,0.00,1.00,67.20,-57.60 +-110.40,19.20,4.64,0.00,1.00,72.00,-62.40 +76.80,-19.20,11.39,0.00,1.00,76.80,-62.40 +-100.80,24.00,4.61,0.00,1.00,81.60,-67.20 +86.40,-24.00,11.41,0.00,1.00,86.40,-67.20 +-86.40,24.00,4.59,0.00,1.00,91.20,-67.20 +96.00,-24.00,11.43,0.00,1.00,96.00,-67.20 +-76.80,24.00,4.57,0.00,1.00,100.80,-67.20 +105.60,-19.20,11.45,0.00,1.00,105.60,-62.40 +-67.20,19.20,4.55,0.00,1.00,110.40,-57.60 +115.20,-19.20,11.47,0.00,1.00,115.20,-57.60 +-57.60,19.20,4.53,0.00,1.00,120.00,-52.80 +124.80,-19.20,11.49,0.00,1.00,124.80,-48.00 +-48.00,19.20,4.51,0.00,1.00,129.60,-43.20 +134.40,-14.40,11.51,0.00,1.00,134.40,-43.20 +-38.40,14.40,4.49,0.00,1.00,139.20,-38.40 +144.00,-14.40,11.54,0.00,1.00,144.00,-33.60 +-28.80,9.60,4.46,0.00,1.00,148.80,-28.80 +153.60,-9.60,11.56,0.00,1.00,153.60,-24.00 +-19.20,9.60,4.44,0.00,1.00,158.40,-19.20 +163.20,-4.80,11.58,0.00,1.00,163.20,-14.40 +-9.60,4.80,4.42,0.00,1.00,168.00,-9.60 +172.80,-4.80,11.60,0.00,1.00,172.80,-4.80 +-0.00,0.00,4.40,0.00,1.00,177.60,-0.00 +-177.60,0.00,11.62,0.00,1.00,-177.60,0.00 +4.80,-4.80,4.38,0.00,1.00,-172.80,4.80 +-168.00,4.80,11.64,0.00,1.00,-168.00,9.60 +14.40,-4.80,4.36,0.00,1.00,-163.20,14.40 +-158.40,9.60,11.66,0.00,1.00,-158.40,19.20 +24.00,-9.60,4.34,0.00,1.00,-153.60,24.00 +-148.80,9.60,11.68,0.00,1.00,-148.80,28.80 +33.60,-14.40,4.32,0.00,1.00,-144.00,33.60 +-139.20,14.40,11.71,0.00,1.00,-139.20,38.40 +43.20,-14.40,4.29,0.00,1.00,-134.40,43.20 +-129.60,19.20,11.73,0.00,1.00,-129.60,43.20 +52.80,-19.20,4.27,0.00,1.00,-124.80,48.00 +-120.00,19.20,11.75,0.00,1.00,-120.00,52.80 +62.40,-19.20,4.25,0.00,1.00,-115.20,57.60 +-110.40,19.20,11.77,0.00,1.00,-110.40,57.60 +72.00,-19.20,4.23,0.00,1.00,-105.60,62.40 +-100.80,24.00,11.79,0.00,1.00,-100.80,67.20 +81.60,-24.00,4.21,0.00,1.00,-96.00,67.20 +-91.20,24.00,11.81,0.00,1.00,-91.20,67.20 +96.00,-24.00,4.19,0.00,1.00,-86.40,67.20 +-81.60,24.00,11.83,0.00,1.00,-81.60,67.20 +105.60,-19.20,4.17,0.00,1.00,-76.80,62.40 +-72.00,19.20,11.86,0.00,1.00,-72.00,62.40 +115.20,-19.20,4.14,0.00,1.00,-67.20,57.60 +-62.40,19.20,11.88,0.00,1.00,-62.40,52.80 +124.80,-19.20,4.12,0.00,1.00,-57.60,52.80 +-52.80,19.20,11.90,0.00,1.00,-52.80,48.00 +134.40,-14.40,4.10,0.00,1.00,-48.00,43.20 +-43.20,14.40,11.92,0.00,1.00,-43.20,38.40 +144.00,-14.40,4.08,0.00,1.00,-38.40,33.60 +-33.60,14.40,11.94,0.00,1.00,-33.60,28.80 +153.60,-9.60,4.06,0.00,1.00,-28.80,24.00 +-24.00,9.60,11.96,0.00,1.00,-24.00,24.00 +163.20,-4.80,4.04,0.00,1.00,-19.20,19.20 +-14.40,4.80,11.98,0.00,1.00,-14.40,14.40 +172.80,-4.80,4.02,0.00,1.00,-9.60,9.60 +-4.80,0.00,12.01,0.00,1.00,-4.80,4.80 +0.00,0.00,3.99,0.00,1.00,0.00,0.00 +-177.60,0.00,12.03,0.00,1.00,4.80,-4.80 +9.60,-4.80,3.97,0.00,1.00,9.60,-9.60 +-168.00,4.80,12.05,0.00,1.00,14.40,-14.40 +19.20,-9.60,3.95,0.00,1.00,19.20,-19.20 +-158.40,9.60,12.07,0.00,1.00,24.00,-24.00 +24.00,-14.40,3.93,0.00,1.00,28.80,-28.80 +-148.80,14.40,12.09,0.00,1.00,33.60,-33.60 +33.60,-14.40,3.91,0.00,1.00,38.40,-38.40 +-139.20,19.20,12.11,0.00,1.00,43.20,-38.40 +43.20,-19.20,3.89,0.00,1.00,48.00,-43.20 +-129.60,19.20,12.13,0.00,1.00,52.80,-48.00 +52.80,-24.00,3.87,0.00,1.00,57.60,-52.80 +-120.00,24.00,12.15,0.00,1.00,62.40,-57.60 +62.40,-24.00,3.85,0.00,1.00,67.20,-62.40 +-110.40,24.00,12.18,0.00,1.00,72.00,-62.40 +76.80,-24.00,3.82,0.00,1.00,76.80,-67.20 +-100.80,28.80,12.20,0.00,1.00,81.60,-72.00 +86.40,-28.80,3.80,0.00,1.00,86.40,-72.00 +-86.40,28.80,12.22,0.00,1.00,91.20,-72.00 +96.00,-28.80,3.78,0.00,1.00,96.00,-72.00 +-76.80,28.80,12.24,0.00,1.00,100.80,-67.20 +105.60,-24.00,3.76,0.00,1.00,105.60,-67.20 +-67.20,24.00,12.26,0.00,1.00,110.40,-62.40 +120.00,-24.00,3.74,0.00,1.00,115.20,-57.60 +-57.60,24.00,12.28,0.00,1.00,120.00,-57.60 +129.60,-24.00,3.72,0.00,1.00,124.80,-52.80 +-48.00,19.20,12.30,0.00,1.00,129.60,-48.00 +139.20,-19.20,3.70,0.00,1.00,134.40,-43.20 +-38.40,19.20,12.33,0.00,1.00,139.20,-38.40 +148.80,-14.40,3.67,0.00,1.00,144.00,-33.60 +-28.80,14.40,12.35,0.00,1.00,148.80,-28.80 +158.40,-9.60,3.65,0.00,1.00,153.60,-24.00 +-19.20,9.60,12.37,0.00,1.00,158.40,-19.20 +163.20,-9.60,3.63,0.00,1.00,163.20,-14.40 +-9.60,4.80,12.39,0.00,1.00,168.00,-9.60 +172.80,-4.80,3.61,0.00,1.00,172.80,-4.80 +-0.00,0.00,12.41,0.00,1.00,177.60,-0.00 +-177.60,0.00,3.59,0.00,1.00,-177.60,0.00 +4.80,-4.80,12.43,0.00,1.00,-172.80,4.80 +-168.00,4.80,3.57,0.00,1.00,-168.00,9.60 +14.40,-9.60,12.45,0.00,1.00,-163.20,14.40 +-158.40,9.60,3.55,0.00,1.00,-158.40,19.20 +24.00,-9.60,12.48,0.00,1.00,-153.60,24.00 +-153.60,14.40,3.52,0.00,1.00,-148.80,28.80 +33.60,-14.40,12.50,0.00,1.00,-144.00,33.60 +-144.00,19.20,3.50,0.00,1.00,-139.20,38.40 +43.20,-19.20,12.52,0.00,1.00,-134.40,43.20 +-134.40,19.20,3.48,0.00,1.00,-129.60,48.00 +52.80,-24.00,12.54,0.00,1.00,-124.80,52.80 +-124.80,24.00,3.46,0.00,1.00,-120.00,57.60 +62.40,-24.00,12.56,0.00,1.00,-115.20,57.60 +-110.40,24.00,3.44,0.00,1.00,-110.40,62.40 +72.00,-24.00,12.58,0.00,1.00,-105.60,67.20 +-100.80,28.80,3.42,0.00,1.00,-100.80,67.20 +81.60,-28.80,12.60,0.00,1.00,-96.00,72.00 +-91.20,28.80,3.40,0.00,1.00,-91.20,72.00 +96.00,-28.80,12.62,0.00,1.00,-86.40,72.00 +-81.60,28.80,3.38,0.00,1.00,-81.60,72.00 +105.60,-24.00,12.65,0.00,1.00,-76.80,67.20 +-72.00,24.00,3.35,0.00,1.00,-72.00,62.40 +115.20,-24.00,12.67,0.00,1.00,-67.20,62.40 +-57.60,24.00,3.33,0.00,1.00,-62.40,57.60 +124.80,-24.00,12.69,0.00,1.00,-57.60,52.80 +-48.00,19.20,3.31,0.00,1.00,-52.80,48.00 +134.40,-19.20,12.71,0.00,1.00,-48.00,43.20 +-38.40,19.20,3.29,0.00,1.00,-43.20,38.40 +144.00,-14.40,12.73,0.00,1.00,-38.40,38.40 +-28.80,14.40,3.27,0.00,1.00,-33.60,33.60 +153.60,-14.40,12.75,0.00,1.00,-28.80,28.80 +-24.00,9.60,3.25,0.00,1.00,-24.00,24.00 +163.20,-9.60,12.77,0.00,1.00,-19.20,19.20 +-14.40,4.80,3.23,0.00,1.00,-14.40,14.40 +172.80,-4.80,12.80,0.00,1.00,-9.60,9.60 +-4.80,0.00,3.20,0.00,1.00,-4.80,4.80 +0.00,0.00,12.82,0.00,1.00,0.00,0.00 +-177.60,4.80,3.18,0.00,1.00,4.80,-4.80 +9.60,-4.80,12.84,0.00,1.00,9.60,-9.60 +-168.00,9.60,3.16,0.00,1.00,14.40,-14.40 +14.40,-9.60,12.86,0.00,1.00,19.20,-19.20 +-158.40,14.40,3.14,0.00,1.00,24.00,-24.00 +24.00,-14.40,12.88,0.00,1.00,28.80,-28.80 +-148.80,19.20,3.12,0.00,1.00,33.60,-33.60 +33.60,-19.20,12.90,0.00,1.00,38.40,-38.40 +-139.20,19.20,3.10,0.00,1.00,43.20,-43.20 +43.20,-24.00,12.92,0.00,1.00,48.00,-48.00 +-129.60,24.00,3.08,0.00,1.00,52.80,-52.80 +52.80,-28.80,12.95,0.00,1.00,57.60,-57.60 +-120.00,28.80,3.05,0.00,1.00,62.40,-57.60 +62.40,-28.80,12.97,0.00,1.00,67.20,-62.40 +-110.40,28.80,3.03,0.00,1.00,72.00,-67.20 +76.80,-28.80,12.99,0.00,1.00,76.80,-72.00 +-100.80,33.60,3.01,0.00,1.00,81.60,-72.00 +86.40,-33.60,13.01,0.00,1.00,86.40,-76.80 +-86.40,33.60,2.99,0.00,1.00,91.20,-76.80 +96.00,-33.60,13.03,0.00,1.00,96.00,-76.80 +-76.80,28.80,2.97,0.00,1.00,100.80,-72.00 +110.40,-28.80,13.05,0.00,1.00,105.60,-72.00 +-67.20,28.80,2.95,0.00,1.00,110.40,-67.20 +120.00,-28.80,13.07,0.00,1.00,115.20,-62.40 +-57.60,28.80,2.93,0.00,1.00,120.00,-57.60 +129.60,-24.00,13.09,0.00,1.00,124.80,-52.80 +-48.00,24.00,2.91,0.00,1.00,129.60,-48.00 +139.20,-24.00,13.12,0.00,1.00,134.40,-43.20 +-38.40,19.20,2.88,0.00,1.00,139.20,-38.40 +148.80,-19.20,13.14,0.00,1.00,144.00,-33.60 +-28.80,14.40,2.86,0.00,1.00,148.80,-28.80 +158.40,-14.40,13.16,0.00,1.00,153.60,-24.00 +-19.20,9.60,2.84,0.00,1.00,158.40,-19.20 +168.00,-9.60,13.18,0.00,1.00,163.20,-14.40 +-9.60,4.80,2.82,0.00,1.00,168.00,-9.60 +172.80,-4.80,13.20,0.00,1.00,172.80,-4.80 +-0.00,0.00,2.80,0.00,1.00,177.60,-0.00 +-177.60,0.00,13.22,0.00,1.00,-177.60,0.00 +4.80,-4.80,2.78,0.00,1.00,-172.80,4.80 +-168.00,4.80,13.24,0.00,1.00,-168.00,9.60 +14.40,-9.60,2.76,0.00,1.00,-163.20,14.40 +-163.20,9.60,13.27,0.00,1.00,-158.40,19.20 +24.00,-14.40,2.73,0.00,1.00,-153.60,24.00 +-153.60,14.40,13.29,0.00,1.00,-148.80,28.80 +33.60,-19.20,2.71,0.00,1.00,-144.00,33.60 +-144.00,19.20,13.31,0.00,1.00,-139.20,38.40 +43.20,-24.00,2.69,0.00,1.00,-134.40,43.20 +-134.40,24.00,13.33,0.00,1.00,-129.60,48.00 +52.80,-24.00,2.67,0.00,1.00,-124.80,52.80 +-124.80,28.80,13.35,0.00,1.00,-120.00,57.60 +62.40,-28.80,2.65,0.00,1.00,-115.20,62.40 +-115.20,28.80,13.37,0.00,1.00,-110.40,67.20 +72.00,-28.80,2.63,0.00,1.00,-105.60,72.00 +-100.80,28.80,13.39,0.00,1.00,-100.80,72.00 +81.60,-33.60,2.61,0.00,1.00,-96.00,76.80 +-91.20,33.60,13.42,0.00,1.00,-91.20,76.80 +96.00,-33.60,2.58,0.00,1.00,-86.40,76.80 +-81.60,33.60,13.44,0.00,1.00,-81.60,72.00 +105.60,-28.80,2.56,0.00,1.00,-76.80,72.00 +-67.20,28.80,13.46,0.00,1.00,-72.00,67.20 +115.20,-28.80,2.54,0.00,1.00,-67.20,62.40 +-57.60,28.80,13.48,0.00,1.00,-62.40,57.60 +124.80,-28.80,2.52,0.00,1.00,-57.60,57.60 +-48.00,24.00,13.50,0.00,1.00,-52.80,52.80 +134.40,-24.00,2.50,0.00,1.00,-48.00,48.00 +-38.40,19.20,13.52,0.00,1.00,-43.20,43.20 +144.00,-19.20,2.48,0.00,1.00,-38.40,38.40 +-28.80,19.20,13.54,0.00,1.00,-33.60,33.60 +153.60,-14.40,2.46,0.00,1.00,-28.80,28.80 +-19.20,14.40,13.56,0.00,1.00,-24.00,24.00 +163.20,-9.60,2.44,0.00,1.00,-19.20,19.20 +-14.40,9.60,13.59,0.00,1.00,-14.40,14.40 +172.80,-4.80,2.41,0.00,1.00,-9.60,9.60 +-4.80,4.80,13.61,0.00,1.00,-4.80,4.80 +0.00,0.00,2.39,0.00,1.00,0.00,0.00 +-177.60,4.80,13.63,0.00,1.00,4.80,-4.80 +9.60,-4.80,2.37,0.00,1.00,9.60,-9.60 +-168.00,9.60,13.65,0.00,1.00,14.40,-14.40 +14.40,-9.60,2.35,0.00,1.00,19.20,-19.20 +-158.40,14.40,13.67,0.00,1.00,24.00,-24.00 +24.00,-14.40,2.33,0.00,1.00,28.80,-28.80 +-153.60,19.20,13.69,0.00,1.00,33.60,-33.60 +33.60,-24.00,2.31,0.00,1.00,38.40,-38.40 +-144.00,24.00,13.71,0.00,1.00,43.20,-43.20 +43.20,-24.00,2.29,0.00,1.00,48.00,-48.00 +-134.40,28.80,13.74,0.00,1.00,52.80,-52.80 +52.80,-28.80,2.26,0.00,1.00,57.60,-57.60 +-124.80,33.60,13.76,0.00,1.00,62.40,-62.40 +62.40,-33.60,2.24,0.00,1.00,67.20,-67.20 +-110.40,33.60,13.78,0.00,1.00,72.00,-72.00 +72.00,-33.60,2.22,0.00,1.00,76.80,-72.00 +-100.80,38.40,13.80,0.00,1.00,81.60,-76.80 +86.40,-38.40,2.20,0.00,1.00,86.40,-81.60 +-86.40,38.40,13.82,0.00,1.00,91.20,-81.60 +96.00,-38.40,2.18,0.00,1.00,96.00,-81.60 +-76.80,33.60,13.84,0.00,1.00,100.80,-76.80 +110.40,-33.60,2.16,0.00,1.00,105.60,-72.00 +-67.20,33.60,13.86,0.00,1.00,110.40,-67.20 +120.00,-33.60,2.14,0.00,1.00,115.20,-62.40 +-52.80,28.80,13.89,0.00,1.00,120.00,-57.60 +129.60,-28.80,2.11,0.00,1.00,124.80,-52.80 +-43.20,28.80,13.91,0.00,1.00,129.60,-48.00 +139.20,-24.00,2.09,0.00,1.00,134.40,-43.20 +-33.60,24.00,13.93,0.00,1.00,139.20,-38.40 +148.80,-19.20,2.07,0.00,1.00,144.00,-33.60 +-24.00,19.20,13.95,0.00,1.00,148.80,-28.80 +158.40,-14.40,2.05,0.00,1.00,153.60,-24.00 +-19.20,14.40,13.97,0.00,1.00,158.40,-19.20 +168.00,-9.60,2.03,0.00,1.00,163.20,-14.40 +-9.60,4.80,13.99,0.00,1.00,168.00,-9.60 +172.80,-4.80,2.01,0.00,1.00,172.80,-4.80 +-0.00,0.00,14.01,0.00,1.00,177.60,-0.00 +-177.60,0.00,1.99,0.00,1.00,-177.60,0.00 +4.80,-4.80,14.03,0.00,1.00,-172.80,4.80 +-168.00,4.80,1.97,0.00,1.00,-168.00,9.60 +14.40,-9.60,14.06,0.00,1.00,-163.20,14.40 +-163.20,14.40,1.94,0.00,1.00,-158.40,19.20 +24.00,-14.40,14.08,0.00,1.00,-153.60,24.00 +-153.60,19.20,1.92,0.00,1.00,-148.80,28.80 +28.80,-19.20,14.10,0.00,1.00,-144.00,33.60 +-144.00,24.00,1.90,0.00,1.00,-139.20,38.40 +38.40,-24.00,14.12,0.00,1.00,-134.40,43.20 +-134.40,28.80,1.88,0.00,1.00,-129.60,48.00 +48.00,-28.80,14.14,0.00,1.00,-124.80,52.80 +-124.80,28.80,1.86,0.00,1.00,-120.00,57.60 +57.60,-33.60,14.16,0.00,1.00,-115.20,62.40 +-115.20,33.60,1.84,0.00,1.00,-110.40,67.20 +72.00,-33.60,14.18,0.00,1.00,-105.60,72.00 +-105.60,33.60,1.82,0.00,1.00,-100.80,76.80 +81.60,-38.40,14.21,0.00,1.00,-96.00,81.60 +-91.20,38.40,1.79,0.00,1.00,-91.20,81.60 +96.00,-38.40,14.23,0.00,1.00,-86.40,81.60 +-81.60,38.40,1.77,0.00,1.00,-81.60,76.80 +105.60,-33.60,14.25,0.00,1.00,-76.80,72.00 +-67.20,33.60,1.75,0.00,1.00,-72.00,72.00 +120.00,-33.60,14.27,0.00,1.00,-67.20,67.20 +-57.60,33.60,1.73,0.00,1.00,-62.40,62.40 +129.60,-28.80,14.29,0.00,1.00,-57.60,57.60 +-48.00,28.80,1.71,0.00,1.00,-52.80,52.80 +139.20,-24.00,14.31,0.00,1.00,-48.00,48.00 +-38.40,24.00,1.69,0.00,1.00,-43.20,43.20 +148.80,-24.00,14.33,0.00,1.00,-38.40,38.40 +-28.80,19.20,1.67,0.00,1.00,-33.60,33.60 +158.40,-14.40,14.36,0.00,1.00,-28.80,28.80 +-19.20,14.40,1.64,0.00,1.00,-24.00,24.00 +163.20,-9.60,14.38,0.00,1.00,-19.20,19.20 +-9.60,9.60,1.62,0.00,1.00,-14.40,14.40 +172.80,-4.80,14.40,0.00,1.00,-9.60,9.60 +-4.80,4.80,1.60,0.00,1.00,-4.80,4.80 +0.00,0.00,14.42,0.00,1.00,0.00,0.00 +-177.60,4.80,1.58,0.00,1.00,4.80,-4.80 +9.60,-4.80,14.44,0.00,1.00,9.60,-9.60 +-168.00,9.60,1.56,0.00,1.00,14.40,-14.40 +14.40,-14.40,14.46,0.00,1.00,19.20,-19.20 +-163.20,14.40,1.54,0.00,1.00,24.00,-24.00 +24.00,-19.20,14.48,0.00,1.00,28.80,-28.80 +-153.60,19.20,1.52,0.00,1.00,33.60,-33.60 +28.80,-24.00,14.50,0.00,1.00,38.40,-38.40 +-144.00,28.80,1.50,0.00,1.00,43.20,-43.20 +38.40,-28.80,14.53,0.00,1.00,48.00,-48.00 +-134.40,33.60,1.47,0.00,1.00,52.80,-52.80 +48.00,-33.60,14.55,0.00,1.00,57.60,-57.60 +-124.80,33.60,1.45,0.00,1.00,62.40,-62.40 +62.40,-38.40,14.57,0.00,1.00,67.20,-67.20 +-115.20,38.40,1.43,0.00,1.00,72.00,-72.00 +72.00,-38.40,14.59,0.00,1.00,76.80,-76.80 +-100.80,43.20,1.41,0.00,1.00,81.60,-81.60 +86.40,-43.20,14.61,0.00,1.00,86.40,-86.40 +-86.40,43.20,1.39,0.00,1.00,91.20,-86.40 +96.00,-43.20,14.63,0.00,1.00,96.00,-81.60 +-76.80,38.40,1.37,0.00,1.00,100.80,-76.80 +110.40,-38.40,14.65,0.00,1.00,105.60,-72.00 +-62.40,38.40,1.35,0.00,1.00,110.40,-67.20 +120.00,-38.40,14.68,0.00,1.00,115.20,-62.40 +-52.80,33.60,1.32,0.00,1.00,120.00,-57.60 +134.40,-33.60,14.70,0.00,1.00,124.80,-52.80 +-43.20,28.80,1.30,0.00,1.00,129.60,-48.00 +144.00,-28.80,14.72,0.00,1.00,134.40,-43.20 +-33.60,24.00,1.28,0.00,1.00,139.20,-38.40 +153.60,-24.00,14.74,0.00,1.00,144.00,-33.60 +-24.00,19.20,1.26,0.00,1.00,148.80,-28.80 +158.40,-19.20,14.76,0.00,1.00,153.60,-24.00 +-14.40,14.40,1.24,0.00,1.00,158.40,-19.20 +168.00,-9.60,14.78,0.00,1.00,163.20,-14.40 +-9.60,9.60,1.22,0.00,1.00,168.00,-9.60 +172.80,-4.80,14.80,0.00,1.00,172.80,-4.80 +-0.00,0.00,1.20,0.00,1.00,177.60,-0.00 +-177.60,0.00,14.83,0.00,1.00,-177.60,0.00 +4.80,-4.80,1.17,0.00,1.00,-172.80,4.80 +-172.80,9.60,14.85,0.00,1.00,-168.00,9.60 +14.40,-9.60,1.15,0.00,1.00,-163.20,14.40 +-163.20,14.40,14.87,0.00,1.00,-158.40,19.20 +19.20,-19.20,1.13,0.00,1.00,-153.60,24.00 +-153.60,19.20,14.89,0.00,1.00,-148.80,28.80 +28.80,-24.00,1.11,0.00,1.00,-144.00,33.60 +-148.80,24.00,14.91,0.00,1.00,-139.20,38.40 +38.40,-28.80,1.09,0.00,1.00,-134.40,43.20 +-139.20,28.80,14.93,0.00,1.00,-129.60,48.00 +48.00,-33.60,1.07,0.00,1.00,-124.80,52.80 +-129.60,33.60,14.95,0.00,1.00,-120.00,57.60 +57.60,-38.40,1.05,0.00,1.00,-115.20,62.40 +-115.20,38.40,14.97,0.00,1.00,-110.40,67.20 +67.20,-38.40,1.03,0.00,1.00,-105.60,72.00 +-105.60,38.40,15.00,0.00,1.00,-100.80,76.80 +81.60,-43.20,1.00,0.00,1.00,-96.00,81.60 +-91.20,43.20,15.02,0.00,1.00,-91.20,86.40 +96.00,-43.20,0.98,0.00,1.00,-86.40,86.40 +-76.80,43.20,15.04,0.00,1.00,-81.60,81.60 +105.60,-38.40,0.96,0.00,1.00,-76.80,76.80 +-67.20,38.40,15.06,0.00,1.00,-72.00,72.00 +120.00,-38.40,0.94,0.00,1.00,-67.20,67.20 +-52.80,33.60,15.08,0.00,1.00,-62.40,62.40 +129.60,-33.60,0.92,0.00,1.00,-57.60,57.60 +-43.20,33.60,15.10,0.00,1.00,-52.80,52.80 +139.20,-28.80,0.90,0.00,1.00,-48.00,48.00 +-33.60,28.80,15.12,0.00,1.00,-43.20,43.20 +148.80,-24.00,0.88,0.00,1.00,-38.40,38.40 +-28.80,19.20,15.15,0.00,1.00,-33.60,33.60 +158.40,-19.20,0.85,0.00,1.00,-28.80,28.80 +-19.20,14.40,15.17,0.00,1.00,-24.00,24.00 +163.20,-14.40,0.83,0.00,1.00,-19.20,19.20 +-9.60,9.60,15.19,0.00,1.00,-14.40,14.40 +172.80,-4.80,0.81,0.00,1.00,-9.60,9.60 +-4.80,4.80,15.21,0.00,1.00,-4.80,4.80 +0.00,0.00,0.79,0.00,1.00,0.00,0.00 +-177.60,4.80,15.23,0.00,1.00,4.80,-4.80 +4.80,-4.80,0.77,0.00,1.00,9.60,-9.60 +-168.00,9.60,15.25,0.00,1.00,14.40,-14.40 +14.40,-14.40,0.75,0.00,1.00,19.20,-19.20 +-163.20,19.20,15.27,0.00,1.00,24.00,-24.00 +19.20,-19.20,0.73,0.00,1.00,28.80,-28.80 +-153.60,24.00,15.30,0.00,1.00,33.60,-33.60 +28.80,-28.80,0.70,0.00,1.00,38.40,-38.40 +-148.80,28.80,15.32,0.00,1.00,43.20,-43.20 +38.40,-33.60,0.68,0.00,1.00,48.00,-48.00 +-139.20,33.60,15.34,0.00,1.00,52.80,-52.80 +48.00,-38.40,0.66,0.00,1.00,57.60,-57.60 +-124.80,38.40,15.36,0.00,1.00,62.40,-62.40 +57.60,-43.20,0.64,0.00,1.00,67.20,-67.20 +-115.20,43.20,15.38,0.00,1.00,72.00,-72.00 +72.00,-43.20,0.62,0.00,1.00,76.80,-76.80 +-100.80,43.20,15.40,0.00,1.00,81.60,-81.60 +86.40,-48.00,0.60,0.00,1.00,86.40,-86.40 +-86.40,48.00,15.42,0.00,1.00,91.20,-86.40 +100.80,-48.00,0.58,0.00,1.00,96.00,-81.60 +-76.80,43.20,15.44,0.00,1.00,100.80,-76.80 +110.40,-43.20,0.56,0.00,1.00,105.60,-72.00 +-62.40,43.20,15.47,0.00,1.00,110.40,-67.20 +124.80,-38.40,0.53,0.00,1.00,115.20,-62.40 +-48.00,38.40,15.49,0.00,1.00,120.00,-57.60 +134.40,-38.40,0.51,0.00,1.00,124.80,-52.80 +-38.40,33.60,15.51,0.00,1.00,129.60,-48.00 +144.00,-28.80,0.49,0.00,1.00,134.40,-43.20 +-28.80,28.80,15.53,0.00,1.00,139.20,-38.40 +153.60,-24.00,0.47,0.00,1.00,144.00,-33.60 +-24.00,24.00,15.55,0.00,1.00,148.80,-28.80 +163.20,-19.20,0.45,0.00,1.00,153.60,-24.00 +-14.40,14.40,15.57,0.00,1.00,158.40,-19.20 +168.00,-14.40,0.43,0.00,1.00,163.20,-14.40 +-9.60,9.60,15.59,0.00,1.00,168.00,-9.60 +172.80,-4.80,0.41,0.00,1.00,172.80,-4.80 +-0.00,0.00,15.62,0.00,1.00,177.60,-0.00 +-177.60,0.00,0.38,0.00,1.00,-177.60,0.00 +4.80,-4.80,15.64,0.00,1.00,-172.80,4.80 +-172.80,9.60,0.36,0.00,1.00,-168.00,9.60 +9.60,-14.40,15.66,0.00,1.00,-163.20,14.40 +-163.20,14.40,0.34,0.00,1.00,-158.40,19.20 +19.20,-19.20,15.68,0.00,1.00,-153.60,24.00 +-158.40,24.00,0.32,0.00,1.00,-148.80,28.80 +28.80,-24.00,15.70,0.00,1.00,-144.00,33.60 +-148.80,28.80,0.30,0.00,1.00,-139.20,38.40 +33.60,-28.80,15.72,0.00,1.00,-134.40,43.20 +-139.20,33.60,0.28,0.00,1.00,-129.60,48.00 +43.20,-38.40,15.74,0.00,1.00,-124.80,52.80 +-129.60,38.40,0.26,0.00,1.00,-120.00,57.60 +57.60,-38.40,15.77,0.00,1.00,-115.20,62.40 +-120.00,43.20,0.23,0.00,1.00,-110.40,67.20 +67.20,-43.20,15.79,0.00,1.00,-105.60,72.00 +-105.60,43.20,0.21,0.00,1.00,-100.80,76.80 +81.60,-48.00,15.81,0.00,1.00,-96.00,81.60 +-91.20,48.00,0.19,0.00,1.00,-91.20,86.40 +96.00,-48.00,15.83,0.00,1.00,-86.40,86.40 +-76.80,43.20,0.17,0.00,1.00,-81.60,81.60 +110.40,-43.20,15.85,0.00,1.00,-76.80,76.80 +-67.20,43.20,0.15,0.00,1.00,-72.00,72.00 +120.00,-43.20,15.87,0.00,1.00,-67.20,67.20 +-52.80,38.40,0.13,0.00,1.00,-62.40,62.40 +134.40,-38.40,15.89,0.00,1.00,-57.60,57.60 +-43.20,33.60,0.11,0.00,1.00,-52.80,52.80 +144.00,-33.60,15.91,0.00,1.00,-48.00,48.00 +-33.60,28.80,0.09,0.00,1.00,-43.20,43.20 +153.60,-28.80,15.94,0.00,1.00,-38.40,38.40 +-24.00,24.00,0.06,0.00,1.00,-33.60,33.60 +158.40,-19.20,15.96,0.00,1.00,-28.80,28.80 +-19.20,19.20,0.04,0.00,1.00,-24.00,24.00 +168.00,-14.40,15.98,0.00,1.00,-19.20,19.20 +-9.60,9.60,0.02,0.00,1.00,-14.40,14.40 +172.80,-4.80,16.00,0.00,1.00,-9.60,9.60 +-4.80,4.80,0.00,0.00,1.00,-4.80,4.80 diff --git a/scripts/testv/stvISM4.csv b/scripts/testv/stvISM4.csv index 6318155a25063eee0dbf035a8ad94ca5ddac9c21..326176319a11d780fbf4dab842869b792887c8a5 100644 --- a/scripts/testv/stvISM4.csv +++ b/scripts/testv/stvISM4.csv @@ -1,1500 +1,1500 @@ --0.00,0.00,1.00,0.00,1.00 --0.00,4.80,1.00,0.00,1.00 --0.00,9.60,1.00,0.00,1.00 --0.00,14.40,1.00,0.00,1.00 --0.00,19.20,1.00,0.00,1.00 --0.00,24.00,1.00,0.00,1.00 --0.00,28.80,1.00,0.00,1.00 --0.00,33.60,1.00,0.00,1.00 --0.00,38.40,1.00,0.00,1.00 --0.00,43.20,1.00,0.00,1.00 --0.00,48.00,1.00,0.00,1.00 --0.00,52.80,1.00,0.00,1.00 --0.00,57.60,1.00,0.00,1.00 --0.00,62.40,1.00,0.00,1.00 --0.00,67.20,1.00,0.00,1.00 --0.00,72.00,1.00,0.00,1.00 --0.00,76.80,1.00,0.00,1.00 --0.00,81.60,1.00,0.00,1.00 --0.00,86.40,1.00,0.00,1.00 --177.60,89.20,1.00,0.00,1.00 --177.60,86.40,1.00,0.00,1.00 --177.60,81.60,1.00,0.00,1.00 --177.60,76.80,1.00,0.00,1.00 --177.60,72.00,1.00,0.00,1.00 --177.60,67.20,1.00,0.00,1.00 -177.60,62.40,1.00,0.00,1.00 -177.60,57.60,1.00,0.00,1.00 -177.60,52.80,1.00,0.00,1.00 -177.60,48.00,1.00,0.00,1.00 -177.60,43.20,1.00,0.00,1.00 -177.60,38.40,1.00,0.00,1.00 -177.60,33.60,1.00,0.00,1.00 -177.60,28.80,1.00,0.00,1.00 -177.60,24.00,1.00,0.00,1.00 -177.60,19.20,1.00,0.00,1.00 -177.60,14.40,1.00,0.00,1.00 -177.60,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --177.60,-9.60,1.00,0.00,1.00 --177.60,-14.40,1.00,0.00,1.00 --177.60,-19.20,1.00,0.00,1.00 --177.60,-24.00,1.00,0.00,1.00 --177.60,-28.80,1.00,0.00,1.00 --177.60,-33.60,1.00,0.00,1.00 --177.60,-38.40,1.00,0.00,1.00 --177.60,-48.00,1.00,0.00,1.00 --177.60,-48.00,1.00,0.00,1.00 --177.60,-52.80,1.00,0.00,1.00 --177.60,-57.60,1.00,0.00,1.00 -177.60,-62.40,1.00,0.00,1.00 -177.60,-67.20,1.00,0.00,1.00 -177.60,-76.80,1.00,0.00,1.00 -177.60,-76.80,1.00,0.00,1.00 -177.60,-86.40,1.00,0.00,1.00 -177.60,-89.20,1.00,0.00,1.00 -0.00,-86.40,1.00,0.00,1.00 -0.00,-81.60,1.00,0.00,1.00 -0.00,-76.80,1.00,0.00,1.00 -0.00,-72.00,1.00,0.00,1.00 -0.00,-67.20,1.00,0.00,1.00 -0.00,-62.40,1.00,0.00,1.00 -0.00,-57.60,1.00,0.00,1.00 -0.00,-52.80,1.00,0.00,1.00 -0.00,-48.00,1.00,0.00,1.00 -0.00,-43.20,1.00,0.00,1.00 -0.00,-38.40,1.00,0.00,1.00 -0.00,-33.60,1.00,0.00,1.00 -0.00,-28.80,1.00,0.00,1.00 -0.00,-24.00,1.00,0.00,1.00 -0.00,-19.20,1.00,0.00,1.00 -0.00,-14.40,1.00,0.00,1.00 -0.00,-9.60,1.00,0.00,1.00 -0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,4.80,1.00,0.00,1.00 -0.00,9.60,1.00,0.00,1.00 -0.00,14.40,1.00,0.00,1.00 -0.00,19.20,1.00,0.00,1.00 -0.00,24.00,1.00,0.00,1.00 -4.80,28.80,1.00,0.00,1.00 -4.80,33.60,1.00,0.00,1.00 -4.80,38.40,1.00,0.00,1.00 -4.80,43.20,1.00,0.00,1.00 -4.80,48.00,1.00,0.00,1.00 -4.80,52.80,1.00,0.00,1.00 -9.60,57.60,1.00,0.00,1.00 -9.60,62.40,1.00,0.00,1.00 -9.60,67.20,1.00,0.00,1.00 -14.40,72.00,1.00,0.00,1.00 -19.20,76.80,1.00,0.00,1.00 -28.80,81.60,1.00,0.00,1.00 -52.80,86.40,1.00,0.00,1.00 -105.60,86.40,1.00,0.00,1.00 -139.20,81.60,1.00,0.00,1.00 -158.40,76.80,1.00,0.00,1.00 -163.20,72.00,1.00,0.00,1.00 -168.00,67.20,1.00,0.00,1.00 -168.00,62.40,1.00,0.00,1.00 -172.80,57.60,1.00,0.00,1.00 -172.80,52.80,1.00,0.00,1.00 -172.80,48.00,1.00,0.00,1.00 -172.80,43.20,1.00,0.00,1.00 -177.60,38.40,1.00,0.00,1.00 -177.60,33.60,1.00,0.00,1.00 -177.60,28.80,1.00,0.00,1.00 -177.60,24.00,1.00,0.00,1.00 -177.60,19.20,1.00,0.00,1.00 -177.60,14.40,1.00,0.00,1.00 -177.60,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --177.60,-9.60,1.00,0.00,1.00 --177.60,-14.40,1.00,0.00,1.00 --177.60,-19.20,1.00,0.00,1.00 --177.60,-24.00,1.00,0.00,1.00 --177.60,-28.80,1.00,0.00,1.00 --177.60,-33.60,1.00,0.00,1.00 --177.60,-38.40,1.00,0.00,1.00 --172.80,-43.20,1.00,0.00,1.00 --172.80,-48.00,1.00,0.00,1.00 --172.80,-52.80,1.00,0.00,1.00 --172.80,-57.60,1.00,0.00,1.00 --168.00,-62.40,1.00,0.00,1.00 --168.00,-67.20,1.00,0.00,1.00 --163.20,-72.00,1.00,0.00,1.00 --158.40,-76.80,1.00,0.00,1.00 --139.20,-81.60,1.00,0.00,1.00 --105.60,-86.40,1.00,0.00,1.00 --52.80,-86.40,1.00,0.00,1.00 --28.80,-81.60,1.00,0.00,1.00 --19.20,-76.80,1.00,0.00,1.00 --14.40,-72.00,1.00,0.00,1.00 --9.60,-67.20,1.00,0.00,1.00 --9.60,-62.40,1.00,0.00,1.00 --9.60,-57.60,1.00,0.00,1.00 --4.80,-52.80,1.00,0.00,1.00 --4.80,-48.00,1.00,0.00,1.00 --4.80,-43.20,1.00,0.00,1.00 --4.80,-38.40,1.00,0.00,1.00 --4.80,-33.60,1.00,0.00,1.00 --4.80,-28.80,1.00,0.00,1.00 --0.00,-24.00,1.00,0.00,1.00 --0.00,-19.20,1.00,0.00,1.00 --0.00,-14.40,1.00,0.00,1.00 --0.00,-9.60,1.00,0.00,1.00 --0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,4.80,1.00,0.00,1.00 -0.00,9.60,1.00,0.00,1.00 -4.80,14.40,1.00,0.00,1.00 -4.80,19.20,1.00,0.00,1.00 -4.80,24.00,1.00,0.00,1.00 -4.80,28.80,1.00,0.00,1.00 -4.80,33.60,1.00,0.00,1.00 -9.60,38.40,1.00,0.00,1.00 -9.60,43.20,1.00,0.00,1.00 -9.60,48.00,1.00,0.00,1.00 -14.40,52.80,1.00,0.00,1.00 -14.40,57.60,1.00,0.00,1.00 -19.20,62.40,1.00,0.00,1.00 -24.00,67.20,1.00,0.00,1.00 -28.80,72.00,1.00,0.00,1.00 -33.60,72.00,1.00,0.00,1.00 -48.00,76.80,1.00,0.00,1.00 -67.20,81.60,1.00,0.00,1.00 -96.00,81.60,1.00,0.00,1.00 -120.00,76.80,1.00,0.00,1.00 -139.20,76.80,1.00,0.00,1.00 -148.80,72.00,1.00,0.00,1.00 -153.60,67.20,1.00,0.00,1.00 -158.40,62.40,1.00,0.00,1.00 -163.20,57.60,1.00,0.00,1.00 -168.00,52.80,1.00,0.00,1.00 -168.00,48.00,1.00,0.00,1.00 -168.00,43.20,1.00,0.00,1.00 -172.80,38.40,1.00,0.00,1.00 -172.80,33.60,1.00,0.00,1.00 -172.80,28.80,1.00,0.00,1.00 -177.60,24.00,1.00,0.00,1.00 -177.60,19.20,1.00,0.00,1.00 -177.60,14.40,1.00,0.00,1.00 -177.60,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --177.60,-9.60,1.00,0.00,1.00 --177.60,-14.40,1.00,0.00,1.00 --177.60,-19.20,1.00,0.00,1.00 --177.60,-24.00,1.00,0.00,1.00 --172.80,-28.80,1.00,0.00,1.00 --172.80,-33.60,1.00,0.00,1.00 --172.80,-38.40,1.00,0.00,1.00 --168.00,-43.20,1.00,0.00,1.00 --168.00,-48.00,1.00,0.00,1.00 --168.00,-52.80,1.00,0.00,1.00 --163.20,-57.60,1.00,0.00,1.00 --158.40,-62.40,1.00,0.00,1.00 --153.60,-67.20,1.00,0.00,1.00 --148.80,-72.00,1.00,0.00,1.00 --139.20,-76.80,1.00,0.00,1.00 --120.00,-76.80,1.00,0.00,1.00 --96.00,-81.60,1.00,0.00,1.00 --67.20,-81.60,1.00,0.00,1.00 --48.00,-76.80,1.00,0.00,1.00 --33.60,-72.00,1.00,0.00,1.00 --28.80,-72.00,1.00,0.00,1.00 --24.00,-67.20,1.00,0.00,1.00 --19.20,-62.40,1.00,0.00,1.00 --14.40,-57.60,1.00,0.00,1.00 --14.40,-52.80,1.00,0.00,1.00 --9.60,-48.00,1.00,0.00,1.00 --9.60,-43.20,1.00,0.00,1.00 --9.60,-38.40,1.00,0.00,1.00 --4.80,-33.60,1.00,0.00,1.00 --4.80,-28.80,1.00,0.00,1.00 --4.80,-24.00,1.00,0.00,1.00 --4.80,-19.20,1.00,0.00,1.00 --4.80,-14.40,1.00,0.00,1.00 --0.00,-9.60,1.00,0.00,1.00 --0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,4.80,1.00,0.00,1.00 -4.80,9.60,1.00,0.00,1.00 -4.80,14.40,1.00,0.00,1.00 -4.80,19.20,1.00,0.00,1.00 -4.80,24.00,1.00,0.00,1.00 -9.60,28.80,1.00,0.00,1.00 -9.60,33.60,1.00,0.00,1.00 -9.60,38.40,1.00,0.00,1.00 -14.40,43.20,1.00,0.00,1.00 -14.40,48.00,1.00,0.00,1.00 -19.20,52.80,1.00,0.00,1.00 -19.20,52.80,1.00,0.00,1.00 -24.00,57.60,1.00,0.00,1.00 -28.80,62.40,1.00,0.00,1.00 -38.40,67.20,1.00,0.00,1.00 -48.00,72.00,1.00,0.00,1.00 -57.60,72.00,1.00,0.00,1.00 -76.80,76.80,1.00,0.00,1.00 -96.00,76.80,1.00,0.00,1.00 -115.20,76.80,1.00,0.00,1.00 -129.60,72.00,1.00,0.00,1.00 -139.20,67.20,1.00,0.00,1.00 -144.00,67.20,1.00,0.00,1.00 -153.60,62.40,1.00,0.00,1.00 -158.40,57.60,1.00,0.00,1.00 -158.40,52.80,1.00,0.00,1.00 -163.20,48.00,1.00,0.00,1.00 -168.00,43.20,1.00,0.00,1.00 -168.00,38.40,1.00,0.00,1.00 -168.00,33.60,1.00,0.00,1.00 -172.80,28.80,1.00,0.00,1.00 -172.80,24.00,1.00,0.00,1.00 -172.80,19.20,1.00,0.00,1.00 -177.60,14.40,1.00,0.00,1.00 -177.60,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --177.60,-9.60,1.00,0.00,1.00 --177.60,-14.40,1.00,0.00,1.00 --172.80,-19.20,1.00,0.00,1.00 --172.80,-24.00,1.00,0.00,1.00 --172.80,-28.80,1.00,0.00,1.00 --168.00,-33.60,1.00,0.00,1.00 --168.00,-38.40,1.00,0.00,1.00 --168.00,-43.20,1.00,0.00,1.00 --163.20,-48.00,1.00,0.00,1.00 --158.40,-52.80,1.00,0.00,1.00 --158.40,-57.60,1.00,0.00,1.00 --153.60,-62.40,1.00,0.00,1.00 --144.00,-67.20,1.00,0.00,1.00 --139.20,-67.20,1.00,0.00,1.00 --129.60,-72.00,1.00,0.00,1.00 --115.20,-76.80,1.00,0.00,1.00 --96.00,-76.80,1.00,0.00,1.00 --76.80,-76.80,1.00,0.00,1.00 --57.60,-72.00,1.00,0.00,1.00 --48.00,-72.00,1.00,0.00,1.00 --38.40,-67.20,1.00,0.00,1.00 --28.80,-62.40,1.00,0.00,1.00 --24.00,-57.60,1.00,0.00,1.00 --19.20,-52.80,1.00,0.00,1.00 --19.20,-52.80,1.00,0.00,1.00 --14.40,-48.00,1.00,0.00,1.00 --14.40,-43.20,1.00,0.00,1.00 --9.60,-38.40,1.00,0.00,1.00 --9.60,-33.60,1.00,0.00,1.00 --9.60,-28.80,1.00,0.00,1.00 --4.80,-24.00,1.00,0.00,1.00 --4.80,-19.20,1.00,0.00,1.00 --4.80,-14.40,1.00,0.00,1.00 --4.80,-9.60,1.00,0.00,1.00 --0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,4.80,1.00,0.00,1.00 -4.80,9.60,1.00,0.00,1.00 -4.80,14.40,1.00,0.00,1.00 -4.80,19.20,1.00,0.00,1.00 -9.60,24.00,1.00,0.00,1.00 -9.60,28.80,1.00,0.00,1.00 -14.40,33.60,1.00,0.00,1.00 -14.40,33.60,1.00,0.00,1.00 -19.20,38.40,1.00,0.00,1.00 -19.20,43.20,1.00,0.00,1.00 -24.00,48.00,1.00,0.00,1.00 -28.80,52.80,1.00,0.00,1.00 -33.60,57.60,1.00,0.00,1.00 -38.40,62.40,1.00,0.00,1.00 -43.20,62.40,1.00,0.00,1.00 -52.80,67.20,1.00,0.00,1.00 -67.20,67.20,1.00,0.00,1.00 -76.80,72.00,1.00,0.00,1.00 -96.00,72.00,1.00,0.00,1.00 -105.60,72.00,1.00,0.00,1.00 -120.00,67.20,1.00,0.00,1.00 -129.60,67.20,1.00,0.00,1.00 -139.20,62.40,1.00,0.00,1.00 -144.00,57.60,1.00,0.00,1.00 -148.80,52.80,1.00,0.00,1.00 -153.60,52.80,1.00,0.00,1.00 -158.40,48.00,1.00,0.00,1.00 -163.20,43.20,1.00,0.00,1.00 -163.20,38.40,1.00,0.00,1.00 -168.00,33.60,1.00,0.00,1.00 -168.00,28.80,1.00,0.00,1.00 -172.80,24.00,1.00,0.00,1.00 -172.80,19.20,1.00,0.00,1.00 -172.80,14.40,1.00,0.00,1.00 -177.60,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --177.60,-9.60,1.00,0.00,1.00 --172.80,-14.40,1.00,0.00,1.00 --172.80,-19.20,1.00,0.00,1.00 --172.80,-24.00,1.00,0.00,1.00 --168.00,-28.80,1.00,0.00,1.00 --168.00,-33.60,1.00,0.00,1.00 --163.20,-38.40,1.00,0.00,1.00 --163.20,-43.20,1.00,0.00,1.00 --158.40,-48.00,1.00,0.00,1.00 --153.60,-52.80,1.00,0.00,1.00 --148.80,-52.80,1.00,0.00,1.00 --144.00,-57.60,1.00,0.00,1.00 --139.20,-62.40,1.00,0.00,1.00 --129.60,-67.20,1.00,0.00,1.00 --120.00,-67.20,1.00,0.00,1.00 --105.60,-72.00,1.00,0.00,1.00 --96.00,-72.00,1.00,0.00,1.00 --76.80,-72.00,1.00,0.00,1.00 --67.20,-67.20,1.00,0.00,1.00 --52.80,-67.20,1.00,0.00,1.00 --43.20,-62.40,1.00,0.00,1.00 --38.40,-62.40,1.00,0.00,1.00 --33.60,-57.60,1.00,0.00,1.00 --28.80,-52.80,1.00,0.00,1.00 --24.00,-48.00,1.00,0.00,1.00 --19.20,-43.20,1.00,0.00,1.00 --19.20,-38.40,1.00,0.00,1.00 --14.40,-33.60,1.00,0.00,1.00 --14.40,-33.60,1.00,0.00,1.00 --9.60,-28.80,1.00,0.00,1.00 --9.60,-24.00,1.00,0.00,1.00 --4.80,-19.20,1.00,0.00,1.00 --4.80,-14.40,1.00,0.00,1.00 --4.80,-9.60,1.00,0.00,1.00 --0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,4.80,1.00,0.00,1.00 -4.80,9.60,1.00,0.00,1.00 -4.80,14.40,1.00,0.00,1.00 -9.60,19.20,1.00,0.00,1.00 -9.60,24.00,1.00,0.00,1.00 -14.40,24.00,1.00,0.00,1.00 -14.40,28.80,1.00,0.00,1.00 -19.20,33.60,1.00,0.00,1.00 -19.20,38.40,1.00,0.00,1.00 -24.00,43.20,1.00,0.00,1.00 -28.80,48.00,1.00,0.00,1.00 -33.60,52.80,1.00,0.00,1.00 -38.40,52.80,1.00,0.00,1.00 -43.20,57.60,1.00,0.00,1.00 -52.80,62.40,1.00,0.00,1.00 -62.40,62.40,1.00,0.00,1.00 -72.00,62.40,1.00,0.00,1.00 -81.60,67.20,1.00,0.00,1.00 -91.20,67.20,1.00,0.00,1.00 -105.60,67.20,1.00,0.00,1.00 -115.20,62.40,1.00,0.00,1.00 -124.80,62.40,1.00,0.00,1.00 -134.40,57.60,1.00,0.00,1.00 -139.20,57.60,1.00,0.00,1.00 -144.00,52.80,1.00,0.00,1.00 -148.80,48.00,1.00,0.00,1.00 -153.60,43.20,1.00,0.00,1.00 -158.40,38.40,1.00,0.00,1.00 -158.40,38.40,1.00,0.00,1.00 -163.20,33.60,1.00,0.00,1.00 -168.00,28.80,1.00,0.00,1.00 -168.00,24.00,1.00,0.00,1.00 -172.80,19.20,1.00,0.00,1.00 -172.80,14.40,1.00,0.00,1.00 -172.80,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --172.80,-9.60,1.00,0.00,1.00 --172.80,-14.40,1.00,0.00,1.00 --172.80,-19.20,1.00,0.00,1.00 --168.00,-24.00,1.00,0.00,1.00 --168.00,-28.80,1.00,0.00,1.00 --163.20,-33.60,1.00,0.00,1.00 --158.40,-38.40,1.00,0.00,1.00 --158.40,-38.40,1.00,0.00,1.00 --153.60,-43.20,1.00,0.00,1.00 --148.80,-48.00,1.00,0.00,1.00 --144.00,-52.80,1.00,0.00,1.00 --139.20,-57.60,1.00,0.00,1.00 --134.40,-57.60,1.00,0.00,1.00 --124.80,-62.40,1.00,0.00,1.00 --115.20,-62.40,1.00,0.00,1.00 --105.60,-67.20,1.00,0.00,1.00 --91.20,-67.20,1.00,0.00,1.00 --81.60,-67.20,1.00,0.00,1.00 --72.00,-62.40,1.00,0.00,1.00 --62.40,-62.40,1.00,0.00,1.00 --52.80,-62.40,1.00,0.00,1.00 --43.20,-57.60,1.00,0.00,1.00 --38.40,-52.80,1.00,0.00,1.00 --33.60,-52.80,1.00,0.00,1.00 --28.80,-48.00,1.00,0.00,1.00 --24.00,-43.20,1.00,0.00,1.00 --19.20,-38.40,1.00,0.00,1.00 --19.20,-33.60,1.00,0.00,1.00 --14.40,-28.80,1.00,0.00,1.00 --14.40,-24.00,1.00,0.00,1.00 --9.60,-24.00,1.00,0.00,1.00 --9.60,-19.20,1.00,0.00,1.00 --4.80,-14.40,1.00,0.00,1.00 --4.80,-9.60,1.00,0.00,1.00 --0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -0.00,4.80,1.00,0.00,1.00 -4.80,9.60,1.00,0.00,1.00 -4.80,14.40,1.00,0.00,1.00 -9.60,14.40,1.00,0.00,1.00 -14.40,19.20,1.00,0.00,1.00 -14.40,24.00,1.00,0.00,1.00 -19.20,28.80,1.00,0.00,1.00 -19.20,33.60,1.00,0.00,1.00 -24.00,38.40,1.00,0.00,1.00 -28.80,38.40,1.00,0.00,1.00 -33.60,43.20,1.00,0.00,1.00 -38.40,48.00,1.00,0.00,1.00 -43.20,52.80,1.00,0.00,1.00 -48.00,52.80,1.00,0.00,1.00 -57.60,57.60,1.00,0.00,1.00 -62.40,57.60,1.00,0.00,1.00 -72.00,62.40,1.00,0.00,1.00 -81.60,62.40,1.00,0.00,1.00 -91.20,62.40,1.00,0.00,1.00 -100.80,62.40,1.00,0.00,1.00 -110.40,57.60,1.00,0.00,1.00 -120.00,57.60,1.00,0.00,1.00 -129.60,57.60,1.00,0.00,1.00 -134.40,52.80,1.00,0.00,1.00 -139.20,48.00,1.00,0.00,1.00 -144.00,48.00,1.00,0.00,1.00 -148.80,43.20,1.00,0.00,1.00 -153.60,38.40,1.00,0.00,1.00 -158.40,33.60,1.00,0.00,1.00 -158.40,28.80,1.00,0.00,1.00 -163.20,28.80,1.00,0.00,1.00 -168.00,24.00,1.00,0.00,1.00 -168.00,19.20,1.00,0.00,1.00 -172.80,14.40,1.00,0.00,1.00 -172.80,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --172.80,-9.60,1.00,0.00,1.00 --172.80,-14.40,1.00,0.00,1.00 --168.00,-19.20,1.00,0.00,1.00 --168.00,-24.00,1.00,0.00,1.00 --163.20,-28.80,1.00,0.00,1.00 --158.40,-28.80,1.00,0.00,1.00 --158.40,-33.60,1.00,0.00,1.00 --153.60,-38.40,1.00,0.00,1.00 --148.80,-43.20,1.00,0.00,1.00 --144.00,-48.00,1.00,0.00,1.00 --139.20,-48.00,1.00,0.00,1.00 --134.40,-52.80,1.00,0.00,1.00 --129.60,-57.60,1.00,0.00,1.00 --120.00,-57.60,1.00,0.00,1.00 --110.40,-57.60,1.00,0.00,1.00 --100.80,-62.40,1.00,0.00,1.00 --91.20,-62.40,1.00,0.00,1.00 --81.60,-62.40,1.00,0.00,1.00 --72.00,-62.40,1.00,0.00,1.00 --62.40,-57.60,1.00,0.00,1.00 --57.60,-57.60,1.00,0.00,1.00 --48.00,-52.80,1.00,0.00,1.00 --43.20,-52.80,1.00,0.00,1.00 --38.40,-48.00,1.00,0.00,1.00 --33.60,-43.20,1.00,0.00,1.00 --28.80,-38.40,1.00,0.00,1.00 --24.00,-38.40,1.00,0.00,1.00 --19.20,-33.60,1.00,0.00,1.00 --19.20,-28.80,1.00,0.00,1.00 --14.40,-24.00,1.00,0.00,1.00 --14.40,-19.20,1.00,0.00,1.00 --9.60,-14.40,1.00,0.00,1.00 --4.80,-14.40,1.00,0.00,1.00 --4.80,-9.60,1.00,0.00,1.00 --0.00,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 -4.80,9.60,1.00,0.00,1.00 -9.60,9.60,1.00,0.00,1.00 -9.60,14.40,1.00,0.00,1.00 -14.40,19.20,1.00,0.00,1.00 -19.20,24.00,1.00,0.00,1.00 -19.20,28.80,1.00,0.00,1.00 -24.00,28.80,1.00,0.00,1.00 -28.80,33.60,1.00,0.00,1.00 -33.60,38.40,1.00,0.00,1.00 -38.40,43.20,1.00,0.00,1.00 -43.20,43.20,1.00,0.00,1.00 -48.00,48.00,1.00,0.00,1.00 -52.80,48.00,1.00,0.00,1.00 -57.60,52.80,1.00,0.00,1.00 -67.20,52.80,1.00,0.00,1.00 -76.80,57.60,1.00,0.00,1.00 -81.60,57.60,1.00,0.00,1.00 -91.20,57.60,1.00,0.00,1.00 -100.80,57.60,1.00,0.00,1.00 -110.40,52.80,1.00,0.00,1.00 -115.20,52.80,1.00,0.00,1.00 -124.80,52.80,1.00,0.00,1.00 -129.60,48.00,1.00,0.00,1.00 -134.40,48.00,1.00,0.00,1.00 -139.20,43.20,1.00,0.00,1.00 -144.00,38.40,1.00,0.00,1.00 -148.80,38.40,1.00,0.00,1.00 -153.60,33.60,1.00,0.00,1.00 -158.40,28.80,1.00,0.00,1.00 -163.20,24.00,1.00,0.00,1.00 -163.20,24.00,1.00,0.00,1.00 -168.00,19.20,1.00,0.00,1.00 -172.80,14.40,1.00,0.00,1.00 -172.80,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --172.80,-9.60,1.00,0.00,1.00 --172.80,-14.40,1.00,0.00,1.00 --168.00,-19.20,1.00,0.00,1.00 --163.20,-24.00,1.00,0.00,1.00 --163.20,-24.00,1.00,0.00,1.00 --158.40,-28.80,1.00,0.00,1.00 --153.60,-33.60,1.00,0.00,1.00 --148.80,-38.40,1.00,0.00,1.00 --144.00,-38.40,1.00,0.00,1.00 --139.20,-43.20,1.00,0.00,1.00 --134.40,-48.00,1.00,0.00,1.00 --129.60,-48.00,1.00,0.00,1.00 --124.80,-52.80,1.00,0.00,1.00 --115.20,-52.80,1.00,0.00,1.00 --110.40,-52.80,1.00,0.00,1.00 --100.80,-57.60,1.00,0.00,1.00 --91.20,-57.60,1.00,0.00,1.00 --81.60,-57.60,1.00,0.00,1.00 --76.80,-57.60,1.00,0.00,1.00 --67.20,-52.80,1.00,0.00,1.00 --57.60,-52.80,1.00,0.00,1.00 --52.80,-48.00,1.00,0.00,1.00 --48.00,-48.00,1.00,0.00,1.00 --43.20,-43.20,1.00,0.00,1.00 --38.40,-43.20,1.00,0.00,1.00 --33.60,-38.40,1.00,0.00,1.00 --28.80,-33.60,1.00,0.00,1.00 --24.00,-28.80,1.00,0.00,1.00 --19.20,-28.80,1.00,0.00,1.00 --19.20,-24.00,1.00,0.00,1.00 --14.40,-19.20,1.00,0.00,1.00 --9.60,-14.40,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 --4.80,-9.60,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 -4.80,9.60,1.00,0.00,1.00 -9.60,9.60,1.00,0.00,1.00 -14.40,14.40,1.00,0.00,1.00 -14.40,19.20,1.00,0.00,1.00 -19.20,24.00,1.00,0.00,1.00 -24.00,24.00,1.00,0.00,1.00 -24.00,28.80,1.00,0.00,1.00 -28.80,33.60,1.00,0.00,1.00 -33.60,33.60,1.00,0.00,1.00 -38.40,38.40,1.00,0.00,1.00 -43.20,43.20,1.00,0.00,1.00 -48.00,43.20,1.00,0.00,1.00 -57.60,48.00,1.00,0.00,1.00 -62.40,48.00,1.00,0.00,1.00 -67.20,48.00,1.00,0.00,1.00 -76.80,52.80,1.00,0.00,1.00 -86.40,52.80,1.00,0.00,1.00 -91.20,52.80,1.00,0.00,1.00 -100.80,52.80,1.00,0.00,1.00 -105.60,48.00,1.00,0.00,1.00 -115.20,48.00,1.00,0.00,1.00 -120.00,48.00,1.00,0.00,1.00 -124.80,43.20,1.00,0.00,1.00 -134.40,43.20,1.00,0.00,1.00 -139.20,38.40,1.00,0.00,1.00 -144.00,38.40,1.00,0.00,1.00 -148.80,33.60,1.00,0.00,1.00 -153.60,28.80,1.00,0.00,1.00 -153.60,28.80,1.00,0.00,1.00 -158.40,24.00,1.00,0.00,1.00 -163.20,19.20,1.00,0.00,1.00 -168.00,14.40,1.00,0.00,1.00 -168.00,14.40,1.00,0.00,1.00 -172.80,9.60,1.00,0.00,1.00 -177.60,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --177.60,-4.80,1.00,0.00,1.00 --172.80,-9.60,1.00,0.00,1.00 --168.00,-14.40,1.00,0.00,1.00 --168.00,-14.40,1.00,0.00,1.00 --163.20,-19.20,1.00,0.00,1.00 --158.40,-24.00,1.00,0.00,1.00 --153.60,-28.80,1.00,0.00,1.00 --153.60,-28.80,1.00,0.00,1.00 --148.80,-33.60,1.00,0.00,1.00 --144.00,-38.40,1.00,0.00,1.00 --139.20,-38.40,1.00,0.00,1.00 --134.40,-43.20,1.00,0.00,1.00 --124.80,-43.20,1.00,0.00,1.00 --120.00,-48.00,1.00,0.00,1.00 --115.20,-48.00,1.00,0.00,1.00 --105.60,-48.00,1.00,0.00,1.00 --100.80,-52.80,1.00,0.00,1.00 --91.20,-52.80,1.00,0.00,1.00 --86.40,-52.80,1.00,0.00,1.00 --76.80,-52.80,1.00,0.00,1.00 --67.20,-48.00,1.00,0.00,1.00 --62.40,-48.00,1.00,0.00,1.00 --57.60,-48.00,1.00,0.00,1.00 --48.00,-43.20,1.00,0.00,1.00 --43.20,-43.20,1.00,0.00,1.00 --38.40,-38.40,1.00,0.00,1.00 --33.60,-33.60,1.00,0.00,1.00 --28.80,-33.60,1.00,0.00,1.00 --24.00,-28.80,1.00,0.00,1.00 --24.00,-24.00,1.00,0.00,1.00 --19.20,-24.00,1.00,0.00,1.00 --14.40,-19.20,1.00,0.00,1.00 --14.40,-14.40,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 --4.80,-9.60,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 -9.60,9.60,1.00,0.00,1.00 -14.40,14.40,1.00,0.00,1.00 -19.20,19.20,1.00,0.00,1.00 -19.20,19.20,1.00,0.00,1.00 -24.00,24.00,1.00,0.00,1.00 -28.80,28.80,1.00,0.00,1.00 -33.60,28.80,1.00,0.00,1.00 -38.40,33.60,1.00,0.00,1.00 -43.20,33.60,1.00,0.00,1.00 -48.00,38.40,1.00,0.00,1.00 -52.80,38.40,1.00,0.00,1.00 -57.60,43.20,1.00,0.00,1.00 -62.40,43.20,1.00,0.00,1.00 -72.00,43.20,1.00,0.00,1.00 -76.80,48.00,1.00,0.00,1.00 -86.40,48.00,1.00,0.00,1.00 -91.20,48.00,1.00,0.00,1.00 -100.80,48.00,1.00,0.00,1.00 -105.60,48.00,1.00,0.00,1.00 -110.40,43.20,1.00,0.00,1.00 -120.00,43.20,1.00,0.00,1.00 -124.80,43.20,1.00,0.00,1.00 -129.60,38.40,1.00,0.00,1.00 -134.40,38.40,1.00,0.00,1.00 -139.20,33.60,1.00,0.00,1.00 -144.00,33.60,1.00,0.00,1.00 -148.80,28.80,1.00,0.00,1.00 -153.60,24.00,1.00,0.00,1.00 -158.40,24.00,1.00,0.00,1.00 -163.20,19.20,1.00,0.00,1.00 -163.20,14.40,1.00,0.00,1.00 -168.00,14.40,1.00,0.00,1.00 -172.80,9.60,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-4.80,1.00,0.00,1.00 --172.80,-9.60,1.00,0.00,1.00 --168.00,-14.40,1.00,0.00,1.00 --163.20,-14.40,1.00,0.00,1.00 --163.20,-19.20,1.00,0.00,1.00 --158.40,-24.00,1.00,0.00,1.00 --153.60,-24.00,1.00,0.00,1.00 --148.80,-28.80,1.00,0.00,1.00 --144.00,-33.60,1.00,0.00,1.00 --139.20,-33.60,1.00,0.00,1.00 --134.40,-38.40,1.00,0.00,1.00 --129.60,-38.40,1.00,0.00,1.00 --124.80,-43.20,1.00,0.00,1.00 --120.00,-43.20,1.00,0.00,1.00 --110.40,-43.20,1.00,0.00,1.00 --105.60,-48.00,1.00,0.00,1.00 --100.80,-48.00,1.00,0.00,1.00 --91.20,-48.00,1.00,0.00,1.00 --86.40,-48.00,1.00,0.00,1.00 --76.80,-48.00,1.00,0.00,1.00 --72.00,-43.20,1.00,0.00,1.00 --62.40,-43.20,1.00,0.00,1.00 --57.60,-43.20,1.00,0.00,1.00 --52.80,-38.40,1.00,0.00,1.00 --48.00,-38.40,1.00,0.00,1.00 --43.20,-33.60,1.00,0.00,1.00 --38.40,-33.60,1.00,0.00,1.00 --33.60,-28.80,1.00,0.00,1.00 --28.80,-28.80,1.00,0.00,1.00 --24.00,-24.00,1.00,0.00,1.00 --19.20,-19.20,1.00,0.00,1.00 --19.20,-19.20,1.00,0.00,1.00 --14.40,-14.40,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 -9.60,9.60,1.00,0.00,1.00 -14.40,14.40,1.00,0.00,1.00 -19.20,14.40,1.00,0.00,1.00 -24.00,19.20,1.00,0.00,1.00 -24.00,24.00,1.00,0.00,1.00 -28.80,24.00,1.00,0.00,1.00 -33.60,28.80,1.00,0.00,1.00 -38.40,28.80,1.00,0.00,1.00 -43.20,33.60,1.00,0.00,1.00 -48.00,33.60,1.00,0.00,1.00 -52.80,38.40,1.00,0.00,1.00 -62.40,38.40,1.00,0.00,1.00 -67.20,38.40,1.00,0.00,1.00 -72.00,38.40,1.00,0.00,1.00 -76.80,43.20,1.00,0.00,1.00 -86.40,43.20,1.00,0.00,1.00 -91.20,43.20,1.00,0.00,1.00 -96.00,43.20,1.00,0.00,1.00 -105.60,43.20,1.00,0.00,1.00 -110.40,38.40,1.00,0.00,1.00 -115.20,38.40,1.00,0.00,1.00 -120.00,38.40,1.00,0.00,1.00 -129.60,33.60,1.00,0.00,1.00 -134.40,33.60,1.00,0.00,1.00 -139.20,28.80,1.00,0.00,1.00 -144.00,28.80,1.00,0.00,1.00 -148.80,24.00,1.00,0.00,1.00 -153.60,24.00,1.00,0.00,1.00 -153.60,19.20,1.00,0.00,1.00 -158.40,19.20,1.00,0.00,1.00 -163.20,14.40,1.00,0.00,1.00 -168.00,9.60,1.00,0.00,1.00 -172.80,9.60,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-4.80,1.00,0.00,1.00 --172.80,-9.60,1.00,0.00,1.00 --168.00,-9.60,1.00,0.00,1.00 --163.20,-14.40,1.00,0.00,1.00 --158.40,-19.20,1.00,0.00,1.00 --153.60,-19.20,1.00,0.00,1.00 --153.60,-24.00,1.00,0.00,1.00 --148.80,-24.00,1.00,0.00,1.00 --144.00,-28.80,1.00,0.00,1.00 --139.20,-28.80,1.00,0.00,1.00 --134.40,-33.60,1.00,0.00,1.00 --129.60,-33.60,1.00,0.00,1.00 --120.00,-38.40,1.00,0.00,1.00 --115.20,-38.40,1.00,0.00,1.00 --110.40,-38.40,1.00,0.00,1.00 --105.60,-43.20,1.00,0.00,1.00 --96.00,-43.20,1.00,0.00,1.00 --91.20,-43.20,1.00,0.00,1.00 --86.40,-43.20,1.00,0.00,1.00 --76.80,-43.20,1.00,0.00,1.00 --72.00,-38.40,1.00,0.00,1.00 --67.20,-38.40,1.00,0.00,1.00 --62.40,-38.40,1.00,0.00,1.00 --52.80,-38.40,1.00,0.00,1.00 --48.00,-33.60,1.00,0.00,1.00 --43.20,-33.60,1.00,0.00,1.00 --38.40,-28.80,1.00,0.00,1.00 --33.60,-28.80,1.00,0.00,1.00 --28.80,-24.00,1.00,0.00,1.00 --24.00,-24.00,1.00,0.00,1.00 --24.00,-19.20,1.00,0.00,1.00 --19.20,-14.40,1.00,0.00,1.00 --14.40,-14.40,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 -9.60,9.60,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 -19.20,14.40,1.00,0.00,1.00 -24.00,19.20,1.00,0.00,1.00 -28.80,19.20,1.00,0.00,1.00 -33.60,24.00,1.00,0.00,1.00 -38.40,24.00,1.00,0.00,1.00 -43.20,28.80,1.00,0.00,1.00 -48.00,28.80,1.00,0.00,1.00 -52.80,28.80,1.00,0.00,1.00 -57.60,33.60,1.00,0.00,1.00 -62.40,33.60,1.00,0.00,1.00 -67.20,33.60,1.00,0.00,1.00 -72.00,38.40,1.00,0.00,1.00 -81.60,38.40,1.00,0.00,1.00 -86.40,38.40,1.00,0.00,1.00 -91.20,38.40,1.00,0.00,1.00 -96.00,38.40,1.00,0.00,1.00 -105.60,38.40,1.00,0.00,1.00 -110.40,33.60,1.00,0.00,1.00 -115.20,33.60,1.00,0.00,1.00 -120.00,33.60,1.00,0.00,1.00 -124.80,33.60,1.00,0.00,1.00 -129.60,28.80,1.00,0.00,1.00 -134.40,28.80,1.00,0.00,1.00 -139.20,24.00,1.00,0.00,1.00 -144.00,24.00,1.00,0.00,1.00 -148.80,19.20,1.00,0.00,1.00 -153.60,19.20,1.00,0.00,1.00 -158.40,14.40,1.00,0.00,1.00 -163.20,14.40,1.00,0.00,1.00 -168.00,9.60,1.00,0.00,1.00 -168.00,9.60,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-4.80,1.00,0.00,1.00 --168.00,-9.60,1.00,0.00,1.00 --168.00,-9.60,1.00,0.00,1.00 --163.20,-14.40,1.00,0.00,1.00 --158.40,-14.40,1.00,0.00,1.00 --153.60,-19.20,1.00,0.00,1.00 --148.80,-19.20,1.00,0.00,1.00 --144.00,-24.00,1.00,0.00,1.00 --139.20,-24.00,1.00,0.00,1.00 --134.40,-28.80,1.00,0.00,1.00 --129.60,-28.80,1.00,0.00,1.00 --124.80,-33.60,1.00,0.00,1.00 --120.00,-33.60,1.00,0.00,1.00 --115.20,-33.60,1.00,0.00,1.00 --110.40,-33.60,1.00,0.00,1.00 --105.60,-38.40,1.00,0.00,1.00 --96.00,-38.40,1.00,0.00,1.00 --91.20,-38.40,1.00,0.00,1.00 --86.40,-38.40,1.00,0.00,1.00 --81.60,-38.40,1.00,0.00,1.00 --72.00,-38.40,1.00,0.00,1.00 --67.20,-33.60,1.00,0.00,1.00 --62.40,-33.60,1.00,0.00,1.00 --57.60,-33.60,1.00,0.00,1.00 --52.80,-28.80,1.00,0.00,1.00 --48.00,-28.80,1.00,0.00,1.00 --43.20,-28.80,1.00,0.00,1.00 --38.40,-24.00,1.00,0.00,1.00 --33.60,-24.00,1.00,0.00,1.00 --28.80,-19.20,1.00,0.00,1.00 --24.00,-19.20,1.00,0.00,1.00 --19.20,-14.40,1.00,0.00,1.00 --14.40,-9.60,1.00,0.00,1.00 --9.60,-9.60,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,4.80,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 -14.40,9.60,1.00,0.00,1.00 -19.20,14.40,1.00,0.00,1.00 -24.00,14.40,1.00,0.00,1.00 -28.80,19.20,1.00,0.00,1.00 -33.60,19.20,1.00,0.00,1.00 -38.40,19.20,1.00,0.00,1.00 -43.20,24.00,1.00,0.00,1.00 -48.00,24.00,1.00,0.00,1.00 -52.80,28.80,1.00,0.00,1.00 -57.60,28.80,1.00,0.00,1.00 -62.40,28.80,1.00,0.00,1.00 -67.20,28.80,1.00,0.00,1.00 -76.80,33.60,1.00,0.00,1.00 -81.60,33.60,1.00,0.00,1.00 -86.40,33.60,1.00,0.00,1.00 -91.20,33.60,1.00,0.00,1.00 -96.00,33.60,1.00,0.00,1.00 -100.80,33.60,1.00,0.00,1.00 -110.40,28.80,1.00,0.00,1.00 -115.20,28.80,1.00,0.00,1.00 -120.00,28.80,1.00,0.00,1.00 -124.80,28.80,1.00,0.00,1.00 -129.60,24.00,1.00,0.00,1.00 -134.40,24.00,1.00,0.00,1.00 -139.20,24.00,1.00,0.00,1.00 -144.00,19.20,1.00,0.00,1.00 -148.80,19.20,1.00,0.00,1.00 -153.60,14.40,1.00,0.00,1.00 -158.40,14.40,1.00,0.00,1.00 -163.20,9.60,1.00,0.00,1.00 -168.00,9.60,1.00,0.00,1.00 -168.00,4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 --168.00,-9.60,1.00,0.00,1.00 --163.20,-9.60,1.00,0.00,1.00 --158.40,-14.40,1.00,0.00,1.00 --153.60,-14.40,1.00,0.00,1.00 --148.80,-19.20,1.00,0.00,1.00 --144.00,-19.20,1.00,0.00,1.00 --139.20,-24.00,1.00,0.00,1.00 --134.40,-24.00,1.00,0.00,1.00 --129.60,-24.00,1.00,0.00,1.00 --124.80,-28.80,1.00,0.00,1.00 --120.00,-28.80,1.00,0.00,1.00 --115.20,-28.80,1.00,0.00,1.00 --110.40,-28.80,1.00,0.00,1.00 --100.80,-33.60,1.00,0.00,1.00 --96.00,-33.60,1.00,0.00,1.00 --91.20,-33.60,1.00,0.00,1.00 --86.40,-33.60,1.00,0.00,1.00 --81.60,-33.60,1.00,0.00,1.00 --76.80,-33.60,1.00,0.00,1.00 --67.20,-28.80,1.00,0.00,1.00 --62.40,-28.80,1.00,0.00,1.00 --57.60,-28.80,1.00,0.00,1.00 --52.80,-28.80,1.00,0.00,1.00 --48.00,-24.00,1.00,0.00,1.00 --43.20,-24.00,1.00,0.00,1.00 --38.40,-19.20,1.00,0.00,1.00 --33.60,-19.20,1.00,0.00,1.00 --28.80,-19.20,1.00,0.00,1.00 --24.00,-14.40,1.00,0.00,1.00 --19.20,-14.40,1.00,0.00,1.00 --14.40,-9.60,1.00,0.00,1.00 --14.40,-9.60,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 --4.80,-4.80,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 -14.40,4.80,1.00,0.00,1.00 -19.20,9.60,1.00,0.00,1.00 -19.20,9.60,1.00,0.00,1.00 -24.00,14.40,1.00,0.00,1.00 -28.80,14.40,1.00,0.00,1.00 -33.60,14.40,1.00,0.00,1.00 -38.40,19.20,1.00,0.00,1.00 -43.20,19.20,1.00,0.00,1.00 -48.00,24.00,1.00,0.00,1.00 -52.80,24.00,1.00,0.00,1.00 -57.60,24.00,1.00,0.00,1.00 -62.40,24.00,1.00,0.00,1.00 -72.00,24.00,1.00,0.00,1.00 -76.80,28.80,1.00,0.00,1.00 -81.60,28.80,1.00,0.00,1.00 -86.40,28.80,1.00,0.00,1.00 -91.20,28.80,1.00,0.00,1.00 -96.00,28.80,1.00,0.00,1.00 -100.80,28.80,1.00,0.00,1.00 -105.60,28.80,1.00,0.00,1.00 -110.40,24.00,1.00,0.00,1.00 -120.00,24.00,1.00,0.00,1.00 -124.80,24.00,1.00,0.00,1.00 -129.60,24.00,1.00,0.00,1.00 -134.40,19.20,1.00,0.00,1.00 -139.20,19.20,1.00,0.00,1.00 -144.00,19.20,1.00,0.00,1.00 -148.80,14.40,1.00,0.00,1.00 -153.60,14.40,1.00,0.00,1.00 -158.40,9.60,1.00,0.00,1.00 -158.40,9.60,1.00,0.00,1.00 -163.20,9.60,1.00,0.00,1.00 -168.00,4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 --163.20,-9.60,1.00,0.00,1.00 --158.40,-9.60,1.00,0.00,1.00 --158.40,-9.60,1.00,0.00,1.00 --153.60,-14.40,1.00,0.00,1.00 --148.80,-14.40,1.00,0.00,1.00 --144.00,-19.20,1.00,0.00,1.00 --139.20,-19.20,1.00,0.00,1.00 --134.40,-19.20,1.00,0.00,1.00 --129.60,-24.00,1.00,0.00,1.00 --124.80,-24.00,1.00,0.00,1.00 --120.00,-24.00,1.00,0.00,1.00 --110.40,-24.00,1.00,0.00,1.00 --105.60,-28.80,1.00,0.00,1.00 --100.80,-28.80,1.00,0.00,1.00 --96.00,-28.80,1.00,0.00,1.00 --91.20,-28.80,1.00,0.00,1.00 --86.40,-28.80,1.00,0.00,1.00 --81.60,-28.80,1.00,0.00,1.00 --76.80,-28.80,1.00,0.00,1.00 --72.00,-24.00,1.00,0.00,1.00 --62.40,-24.00,1.00,0.00,1.00 --57.60,-24.00,1.00,0.00,1.00 --52.80,-24.00,1.00,0.00,1.00 --48.00,-24.00,1.00,0.00,1.00 --43.20,-19.20,1.00,0.00,1.00 --38.40,-19.20,1.00,0.00,1.00 --33.60,-14.40,1.00,0.00,1.00 --28.80,-14.40,1.00,0.00,1.00 --24.00,-14.40,1.00,0.00,1.00 --19.20,-9.60,1.00,0.00,1.00 --19.20,-9.60,1.00,0.00,1.00 --14.40,-4.80,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 -14.40,4.80,1.00,0.00,1.00 -19.20,9.60,1.00,0.00,1.00 -24.00,9.60,1.00,0.00,1.00 -28.80,9.60,1.00,0.00,1.00 -33.60,14.40,1.00,0.00,1.00 -38.40,14.40,1.00,0.00,1.00 -43.20,14.40,1.00,0.00,1.00 -48.00,14.40,1.00,0.00,1.00 -52.80,19.20,1.00,0.00,1.00 -57.60,19.20,1.00,0.00,1.00 -62.40,19.20,1.00,0.00,1.00 -67.20,19.20,1.00,0.00,1.00 -72.00,24.00,1.00,0.00,1.00 -76.80,24.00,1.00,0.00,1.00 -81.60,24.00,1.00,0.00,1.00 -86.40,24.00,1.00,0.00,1.00 -91.20,24.00,1.00,0.00,1.00 -96.00,24.00,1.00,0.00,1.00 -100.80,24.00,1.00,0.00,1.00 -105.60,24.00,1.00,0.00,1.00 -110.40,19.20,1.00,0.00,1.00 -115.20,19.20,1.00,0.00,1.00 -120.00,19.20,1.00,0.00,1.00 -124.80,19.20,1.00,0.00,1.00 -129.60,19.20,1.00,0.00,1.00 -134.40,14.40,1.00,0.00,1.00 -139.20,14.40,1.00,0.00,1.00 -144.00,14.40,1.00,0.00,1.00 -148.80,9.60,1.00,0.00,1.00 -153.60,9.60,1.00,0.00,1.00 -158.40,9.60,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 -168.00,4.80,1.00,0.00,1.00 -172.80,4.80,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-4.80,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 --163.20,-4.80,1.00,0.00,1.00 --158.40,-9.60,1.00,0.00,1.00 --153.60,-9.60,1.00,0.00,1.00 --148.80,-9.60,1.00,0.00,1.00 --144.00,-14.40,1.00,0.00,1.00 --139.20,-14.40,1.00,0.00,1.00 --134.40,-14.40,1.00,0.00,1.00 --129.60,-19.20,1.00,0.00,1.00 --124.80,-19.20,1.00,0.00,1.00 --120.00,-19.20,1.00,0.00,1.00 --115.20,-19.20,1.00,0.00,1.00 --110.40,-19.20,1.00,0.00,1.00 --105.60,-24.00,1.00,0.00,1.00 --100.80,-24.00,1.00,0.00,1.00 --96.00,-24.00,1.00,0.00,1.00 --91.20,-24.00,1.00,0.00,1.00 --86.40,-24.00,1.00,0.00,1.00 --81.60,-24.00,1.00,0.00,1.00 --76.80,-24.00,1.00,0.00,1.00 --72.00,-24.00,1.00,0.00,1.00 --67.20,-19.20,1.00,0.00,1.00 --62.40,-19.20,1.00,0.00,1.00 --57.60,-19.20,1.00,0.00,1.00 --52.80,-19.20,1.00,0.00,1.00 --48.00,-14.40,1.00,0.00,1.00 --43.20,-14.40,1.00,0.00,1.00 --38.40,-14.40,1.00,0.00,1.00 --33.60,-14.40,1.00,0.00,1.00 --28.80,-9.60,1.00,0.00,1.00 --24.00,-9.60,1.00,0.00,1.00 --19.20,-9.60,1.00,0.00,1.00 --14.40,-4.80,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 -9.60,4.80,1.00,0.00,1.00 -14.40,4.80,1.00,0.00,1.00 -19.20,4.80,1.00,0.00,1.00 -24.00,9.60,1.00,0.00,1.00 -28.80,9.60,1.00,0.00,1.00 -33.60,9.60,1.00,0.00,1.00 -38.40,9.60,1.00,0.00,1.00 -43.20,14.40,1.00,0.00,1.00 -48.00,14.40,1.00,0.00,1.00 -52.80,14.40,1.00,0.00,1.00 -57.60,14.40,1.00,0.00,1.00 -62.40,14.40,1.00,0.00,1.00 -67.20,14.40,1.00,0.00,1.00 -72.00,19.20,1.00,0.00,1.00 -76.80,19.20,1.00,0.00,1.00 -81.60,19.20,1.00,0.00,1.00 -86.40,19.20,1.00,0.00,1.00 -91.20,19.20,1.00,0.00,1.00 -96.00,19.20,1.00,0.00,1.00 -100.80,19.20,1.00,0.00,1.00 -105.60,19.20,1.00,0.00,1.00 -110.40,19.20,1.00,0.00,1.00 -115.20,14.40,1.00,0.00,1.00 -120.00,14.40,1.00,0.00,1.00 -124.80,14.40,1.00,0.00,1.00 -129.60,14.40,1.00,0.00,1.00 -134.40,14.40,1.00,0.00,1.00 -139.20,9.60,1.00,0.00,1.00 -144.00,9.60,1.00,0.00,1.00 -148.80,9.60,1.00,0.00,1.00 -153.60,9.60,1.00,0.00,1.00 -158.40,4.80,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 -168.00,4.80,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-0.00,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 --163.20,-4.80,1.00,0.00,1.00 --158.40,-4.80,1.00,0.00,1.00 --153.60,-9.60,1.00,0.00,1.00 --148.80,-9.60,1.00,0.00,1.00 --144.00,-9.60,1.00,0.00,1.00 --139.20,-9.60,1.00,0.00,1.00 --134.40,-14.40,1.00,0.00,1.00 --129.60,-14.40,1.00,0.00,1.00 --124.80,-14.40,1.00,0.00,1.00 --120.00,-14.40,1.00,0.00,1.00 --115.20,-14.40,1.00,0.00,1.00 --110.40,-19.20,1.00,0.00,1.00 --105.60,-19.20,1.00,0.00,1.00 --100.80,-19.20,1.00,0.00,1.00 --96.00,-19.20,1.00,0.00,1.00 --91.20,-19.20,1.00,0.00,1.00 --86.40,-19.20,1.00,0.00,1.00 --81.60,-19.20,1.00,0.00,1.00 --76.80,-19.20,1.00,0.00,1.00 --72.00,-19.20,1.00,0.00,1.00 --67.20,-14.40,1.00,0.00,1.00 --62.40,-14.40,1.00,0.00,1.00 --57.60,-14.40,1.00,0.00,1.00 --52.80,-14.40,1.00,0.00,1.00 --48.00,-14.40,1.00,0.00,1.00 --43.20,-14.40,1.00,0.00,1.00 --38.40,-9.60,1.00,0.00,1.00 --33.60,-9.60,1.00,0.00,1.00 --28.80,-9.60,1.00,0.00,1.00 --24.00,-9.60,1.00,0.00,1.00 --19.20,-4.80,1.00,0.00,1.00 --14.40,-4.80,1.00,0.00,1.00 --9.60,-4.80,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 -9.60,0.00,1.00,0.00,1.00 -14.40,4.80,1.00,0.00,1.00 -19.20,4.80,1.00,0.00,1.00 -24.00,4.80,1.00,0.00,1.00 -28.80,4.80,1.00,0.00,1.00 -33.60,9.60,1.00,0.00,1.00 -38.40,9.60,1.00,0.00,1.00 -43.20,9.60,1.00,0.00,1.00 -48.00,9.60,1.00,0.00,1.00 -52.80,9.60,1.00,0.00,1.00 -57.60,9.60,1.00,0.00,1.00 -62.40,9.60,1.00,0.00,1.00 -67.20,14.40,1.00,0.00,1.00 -72.00,14.40,1.00,0.00,1.00 -76.80,14.40,1.00,0.00,1.00 -81.60,14.40,1.00,0.00,1.00 -86.40,14.40,1.00,0.00,1.00 -91.20,14.40,1.00,0.00,1.00 -96.00,14.40,1.00,0.00,1.00 -100.80,14.40,1.00,0.00,1.00 -105.60,14.40,1.00,0.00,1.00 -110.40,14.40,1.00,0.00,1.00 -115.20,9.60,1.00,0.00,1.00 -120.00,9.60,1.00,0.00,1.00 -124.80,9.60,1.00,0.00,1.00 -129.60,9.60,1.00,0.00,1.00 -134.40,9.60,1.00,0.00,1.00 -139.20,9.60,1.00,0.00,1.00 -144.00,9.60,1.00,0.00,1.00 -148.80,4.80,1.00,0.00,1.00 -153.60,4.80,1.00,0.00,1.00 -158.40,4.80,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 -168.00,4.80,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-0.00,1.00,0.00,1.00 --168.00,-4.80,1.00,0.00,1.00 --163.20,-4.80,1.00,0.00,1.00 --158.40,-4.80,1.00,0.00,1.00 --153.60,-4.80,1.00,0.00,1.00 --148.80,-4.80,1.00,0.00,1.00 --144.00,-9.60,1.00,0.00,1.00 --139.20,-9.60,1.00,0.00,1.00 --134.40,-9.60,1.00,0.00,1.00 --129.60,-9.60,1.00,0.00,1.00 --124.80,-9.60,1.00,0.00,1.00 --120.00,-9.60,1.00,0.00,1.00 --115.20,-9.60,1.00,0.00,1.00 --110.40,-14.40,1.00,0.00,1.00 --105.60,-14.40,1.00,0.00,1.00 --100.80,-14.40,1.00,0.00,1.00 --96.00,-14.40,1.00,0.00,1.00 --91.20,-14.40,1.00,0.00,1.00 --86.40,-14.40,1.00,0.00,1.00 --81.60,-14.40,1.00,0.00,1.00 --76.80,-14.40,1.00,0.00,1.00 --72.00,-14.40,1.00,0.00,1.00 --67.20,-14.40,1.00,0.00,1.00 --62.40,-9.60,1.00,0.00,1.00 --57.60,-9.60,1.00,0.00,1.00 --52.80,-9.60,1.00,0.00,1.00 --48.00,-9.60,1.00,0.00,1.00 --43.20,-9.60,1.00,0.00,1.00 --38.40,-9.60,1.00,0.00,1.00 --33.60,-9.60,1.00,0.00,1.00 --28.80,-4.80,1.00,0.00,1.00 --24.00,-4.80,1.00,0.00,1.00 --19.20,-4.80,1.00,0.00,1.00 --14.40,-4.80,1.00,0.00,1.00 --9.60,-0.00,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 -9.60,0.00,1.00,0.00,1.00 -14.40,0.00,1.00,0.00,1.00 -19.20,4.80,1.00,0.00,1.00 -24.00,4.80,1.00,0.00,1.00 -28.80,4.80,1.00,0.00,1.00 -33.60,4.80,1.00,0.00,1.00 -38.40,4.80,1.00,0.00,1.00 -43.20,4.80,1.00,0.00,1.00 -48.00,4.80,1.00,0.00,1.00 -52.80,4.80,1.00,0.00,1.00 -57.60,4.80,1.00,0.00,1.00 -62.40,9.60,1.00,0.00,1.00 -67.20,9.60,1.00,0.00,1.00 -72.00,9.60,1.00,0.00,1.00 -76.80,9.60,1.00,0.00,1.00 -81.60,9.60,1.00,0.00,1.00 -86.40,9.60,1.00,0.00,1.00 -91.20,9.60,1.00,0.00,1.00 -96.00,9.60,1.00,0.00,1.00 -100.80,9.60,1.00,0.00,1.00 -105.60,9.60,1.00,0.00,1.00 -110.40,9.60,1.00,0.00,1.00 -115.20,9.60,1.00,0.00,1.00 -120.00,9.60,1.00,0.00,1.00 -124.80,4.80,1.00,0.00,1.00 -129.60,4.80,1.00,0.00,1.00 -134.40,4.80,1.00,0.00,1.00 -139.20,4.80,1.00,0.00,1.00 -144.00,4.80,1.00,0.00,1.00 -148.80,4.80,1.00,0.00,1.00 -153.60,4.80,1.00,0.00,1.00 -158.40,4.80,1.00,0.00,1.00 -163.20,4.80,1.00,0.00,1.00 -168.00,0.00,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-0.00,1.00,0.00,1.00 --168.00,-0.00,1.00,0.00,1.00 --163.20,-4.80,1.00,0.00,1.00 --158.40,-4.80,1.00,0.00,1.00 --153.60,-4.80,1.00,0.00,1.00 --148.80,-4.80,1.00,0.00,1.00 --144.00,-4.80,1.00,0.00,1.00 --139.20,-4.80,1.00,0.00,1.00 --134.40,-4.80,1.00,0.00,1.00 --129.60,-4.80,1.00,0.00,1.00 --124.80,-4.80,1.00,0.00,1.00 --120.00,-9.60,1.00,0.00,1.00 --115.20,-9.60,1.00,0.00,1.00 --110.40,-9.60,1.00,0.00,1.00 --105.60,-9.60,1.00,0.00,1.00 --100.80,-9.60,1.00,0.00,1.00 --96.00,-9.60,1.00,0.00,1.00 --91.20,-9.60,1.00,0.00,1.00 --86.40,-9.60,1.00,0.00,1.00 --81.60,-9.60,1.00,0.00,1.00 --76.80,-9.60,1.00,0.00,1.00 --72.00,-9.60,1.00,0.00,1.00 --67.20,-9.60,1.00,0.00,1.00 --62.40,-9.60,1.00,0.00,1.00 --57.60,-4.80,1.00,0.00,1.00 --52.80,-4.80,1.00,0.00,1.00 --48.00,-4.80,1.00,0.00,1.00 --43.20,-4.80,1.00,0.00,1.00 --38.40,-4.80,1.00,0.00,1.00 --33.60,-4.80,1.00,0.00,1.00 --28.80,-4.80,1.00,0.00,1.00 --24.00,-4.80,1.00,0.00,1.00 --19.20,-4.80,1.00,0.00,1.00 --14.40,-0.00,1.00,0.00,1.00 --9.60,-0.00,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,0.00,1.00,0.00,1.00 -9.60,0.00,1.00,0.00,1.00 -14.40,0.00,1.00,0.00,1.00 -19.20,0.00,1.00,0.00,1.00 -24.00,0.00,1.00,0.00,1.00 -28.80,0.00,1.00,0.00,1.00 -33.60,0.00,1.00,0.00,1.00 -38.40,0.00,1.00,0.00,1.00 -43.20,4.80,1.00,0.00,1.00 -48.00,4.80,1.00,0.00,1.00 -52.80,4.80,1.00,0.00,1.00 -57.60,4.80,1.00,0.00,1.00 -62.40,4.80,1.00,0.00,1.00 -67.20,4.80,1.00,0.00,1.00 -72.00,4.80,1.00,0.00,1.00 -76.80,4.80,1.00,0.00,1.00 -81.60,4.80,1.00,0.00,1.00 -86.40,4.80,1.00,0.00,1.00 -91.20,4.80,1.00,0.00,1.00 -96.00,4.80,1.00,0.00,1.00 -100.80,4.80,1.00,0.00,1.00 -105.60,4.80,1.00,0.00,1.00 -110.40,4.80,1.00,0.00,1.00 -115.20,4.80,1.00,0.00,1.00 -120.00,4.80,1.00,0.00,1.00 -124.80,4.80,1.00,0.00,1.00 -129.60,4.80,1.00,0.00,1.00 -134.40,4.80,1.00,0.00,1.00 -139.20,0.00,1.00,0.00,1.00 -144.00,0.00,1.00,0.00,1.00 -148.80,0.00,1.00,0.00,1.00 -153.60,0.00,1.00,0.00,1.00 -158.40,0.00,1.00,0.00,1.00 -163.20,0.00,1.00,0.00,1.00 -168.00,0.00,1.00,0.00,1.00 -172.80,0.00,1.00,0.00,1.00 -177.60,0.00,1.00,0.00,1.00 --177.60,-0.00,1.00,0.00,1.00 --172.80,-0.00,1.00,0.00,1.00 --168.00,-0.00,1.00,0.00,1.00 --163.20,-0.00,1.00,0.00,1.00 --158.40,-0.00,1.00,0.00,1.00 --153.60,-0.00,1.00,0.00,1.00 --148.80,-0.00,1.00,0.00,1.00 --144.00,-0.00,1.00,0.00,1.00 --139.20,-0.00,1.00,0.00,1.00 --134.40,-4.80,1.00,0.00,1.00 --129.60,-4.80,1.00,0.00,1.00 --124.80,-4.80,1.00,0.00,1.00 --120.00,-4.80,1.00,0.00,1.00 --115.20,-4.80,1.00,0.00,1.00 --110.40,-4.80,1.00,0.00,1.00 --105.60,-4.80,1.00,0.00,1.00 --100.80,-4.80,1.00,0.00,1.00 --96.00,-4.80,1.00,0.00,1.00 --91.20,-4.80,1.00,0.00,1.00 --86.40,-4.80,1.00,0.00,1.00 --81.60,-4.80,1.00,0.00,1.00 --76.80,-4.80,1.00,0.00,1.00 --72.00,-4.80,1.00,0.00,1.00 --67.20,-4.80,1.00,0.00,1.00 --62.40,-4.80,1.00,0.00,1.00 --57.60,-4.80,1.00,0.00,1.00 --52.80,-4.80,1.00,0.00,1.00 --48.00,-4.80,1.00,0.00,1.00 --43.20,-4.80,1.00,0.00,1.00 --38.40,-0.00,1.00,0.00,1.00 --33.60,-0.00,1.00,0.00,1.00 --28.80,-0.00,1.00,0.00,1.00 --24.00,-0.00,1.00,0.00,1.00 --19.20,-0.00,1.00,0.00,1.00 --14.40,-0.00,1.00,0.00,1.00 --9.60,-0.00,1.00,0.00,1.00 --4.80,-0.00,1.00,0.00,1.00 -0.00,0.00,1.00,0.00,1.00 -4.80,-0.00,1.00,0.00,1.00 -9.60,-0.00,1.00,0.00,1.00 -14.40,-0.00,1.00,0.00,1.00 -19.20,-0.00,1.00,0.00,1.00 -24.00,-0.00,1.00,0.00,1.00 -28.80,-0.00,1.00,0.00,1.00 -33.60,-0.00,1.00,0.00,1.00 -38.40,-0.00,1.00,0.00,1.00 -43.20,-0.00,1.00,0.00,1.00 -48.00,-0.00,1.00,0.00,1.00 -52.80,-0.00,1.00,0.00,1.00 -57.60,-0.00,1.00,0.00,1.00 -62.40,-0.00,1.00,0.00,1.00 -67.20,-0.00,1.00,0.00,1.00 -72.00,-0.00,1.00,0.00,1.00 -76.80,-0.00,1.00,0.00,1.00 -81.60,-0.00,1.00,0.00,1.00 -86.40,-0.00,1.00,0.00,1.00 -91.20,-0.00,1.00,0.00,1.00 -96.00,-0.00,1.00,0.00,1.00 -100.80,-0.00,1.00,0.00,1.00 -105.60,-0.00,1.00,0.00,1.00 -110.40,-0.00,1.00,0.00,1.00 -115.20,-0.00,1.00,0.00,1.00 -120.00,-0.00,1.00,0.00,1.00 -124.80,-0.00,1.00,0.00,1.00 -129.60,-0.00,1.00,0.00,1.00 -134.40,-0.00,1.00,0.00,1.00 -139.20,-0.00,1.00,0.00,1.00 -144.00,-0.00,1.00,0.00,1.00 -148.80,-0.00,1.00,0.00,1.00 -153.60,-0.00,1.00,0.00,1.00 -158.40,-0.00,1.00,0.00,1.00 -163.20,-0.00,1.00,0.00,1.00 -168.00,-0.00,1.00,0.00,1.00 -172.80,-0.00,1.00,0.00,1.00 -177.60,-0.00,1.00,0.00,1.00 --177.60,0.00,1.00,0.00,1.00 --172.80,0.00,1.00,0.00,1.00 --168.00,0.00,1.00,0.00,1.00 --163.20,0.00,1.00,0.00,1.00 --158.40,0.00,1.00,0.00,1.00 --153.60,0.00,1.00,0.00,1.00 --148.80,0.00,1.00,0.00,1.00 --144.00,0.00,1.00,0.00,1.00 --139.20,0.00,1.00,0.00,1.00 --134.40,0.00,1.00,0.00,1.00 --129.60,0.00,1.00,0.00,1.00 --124.80,0.00,1.00,0.00,1.00 --120.00,0.00,1.00,0.00,1.00 --115.20,0.00,1.00,0.00,1.00 --110.40,0.00,1.00,0.00,1.00 --105.60,0.00,1.00,0.00,1.00 --100.80,0.00,1.00,0.00,1.00 --96.00,0.00,1.00,0.00,1.00 --91.20,0.00,1.00,0.00,1.00 --86.40,0.00,1.00,0.00,1.00 --81.60,0.00,1.00,0.00,1.00 --76.80,0.00,1.00,0.00,1.00 --72.00,0.00,1.00,0.00,1.00 --67.20,0.00,1.00,0.00,1.00 --62.40,0.00,1.00,0.00,1.00 --57.60,0.00,1.00,0.00,1.00 --52.80,0.00,1.00,0.00,1.00 --48.00,0.00,1.00,0.00,1.00 --43.20,0.00,1.00,0.00,1.00 --38.40,0.00,1.00,0.00,1.00 --33.60,0.00,1.00,0.00,1.00 --28.80,0.00,1.00,0.00,1.00 --24.00,0.00,1.00,0.00,1.00 --19.20,0.00,1.00,0.00,1.00 --14.40,0.00,1.00,0.00,1.00 --9.60,0.00,1.00,0.00,1.00 --4.80,0.00,1.00,0.00,1.00 +-0.00,0.00,0.00,0.00,1.00,0.00,4.80 +-0.00,4.80,0.06,0.00,1.00,4.80,9.60 +-0.00,9.60,0.13,0.00,1.00,9.60,14.40 +-0.00,14.40,0.19,0.00,1.00,14.40,19.20 +-0.00,19.20,0.26,0.00,1.00,19.20,24.00 +-0.00,24.00,0.32,0.00,1.00,24.00,28.80 +-0.00,28.80,0.39,0.00,1.00,28.80,33.60 +-0.00,33.60,0.45,0.00,1.00,33.60,38.40 +-0.00,38.40,0.51,0.00,1.00,38.40,43.20 +-0.00,43.20,0.58,0.00,1.00,43.20,48.00 +-0.00,48.00,0.64,0.00,1.00,48.00,52.80 +-0.00,52.80,0.71,0.00,1.00,52.80,57.60 +-0.00,57.60,0.77,0.00,1.00,57.60,62.40 +-0.00,62.40,0.84,0.00,1.00,62.40,67.20 +-0.00,67.20,0.90,0.00,1.00,67.20,72.00 +-0.00,72.00,0.96,0.00,1.00,72.00,76.80 +-0.00,76.80,1.03,0.00,1.00,76.80,81.60 +-0.00,81.60,1.09,0.00,1.00,81.60,86.40 +-0.00,86.40,1.16,0.00,1.00,86.40,86.40 +-177.60,89.20,1.22,0.00,1.00,91.20,81.60 +-177.60,86.40,1.29,0.00,1.00,96.00,76.80 +-177.60,81.60,1.35,0.00,1.00,100.80,72.00 +-177.60,76.80,1.41,0.00,1.00,105.60,67.20 +-177.60,72.00,1.48,0.00,1.00,110.40,62.40 +-177.60,67.20,1.54,0.00,1.00,115.20,57.60 +177.60,62.40,1.61,0.00,1.00,120.00,52.80 +177.60,57.60,1.67,0.00,1.00,124.80,48.00 +177.60,52.80,1.73,0.00,1.00,129.60,43.20 +177.60,48.00,1.80,0.00,1.00,134.40,38.40 +177.60,43.20,1.86,0.00,1.00,139.20,33.60 +177.60,38.40,1.93,0.00,1.00,144.00,28.80 +177.60,33.60,1.99,0.00,1.00,148.80,24.00 +177.60,28.80,2.06,0.00,1.00,153.60,19.20 +177.60,24.00,2.12,0.00,1.00,158.40,14.40 +177.60,19.20,2.18,0.00,1.00,163.20,9.60 +177.60,14.40,2.25,0.00,1.00,168.00,4.80 +177.60,9.60,2.31,0.00,1.00,172.80,0.00 +177.60,4.80,2.38,0.00,1.00,177.60,-0.00 +-177.60,-0.00,2.44,0.00,1.00,-177.60,-4.80 +-177.60,-4.80,2.51,0.00,1.00,-172.80,-9.60 +-177.60,-9.60,2.57,0.00,1.00,-168.00,-14.40 +-177.60,-14.40,2.63,0.00,1.00,-163.20,-19.20 +-177.60,-19.20,2.70,0.00,1.00,-158.40,-24.00 +-177.60,-24.00,2.76,0.00,1.00,-153.60,-28.80 +-177.60,-28.80,2.83,0.00,1.00,-148.80,-33.60 +-177.60,-33.60,2.89,0.00,1.00,-144.00,-38.40 +-177.60,-38.40,2.96,0.00,1.00,-139.20,-43.20 +-177.60,-48.00,3.02,0.00,1.00,-134.40,-48.00 +-177.60,-48.00,3.08,0.00,1.00,-129.60,-52.80 +-177.60,-52.80,3.15,0.00,1.00,-124.80,-57.60 +-177.60,-57.60,3.21,0.00,1.00,-120.00,-62.40 +177.60,-62.40,3.28,0.00,1.00,-115.20,-67.20 +177.60,-67.20,3.34,0.00,1.00,-110.40,-72.00 +177.60,-76.80,3.41,0.00,1.00,-105.60,-76.80 +177.60,-76.80,3.47,0.00,1.00,-100.80,-81.60 +177.60,-86.40,3.53,0.00,1.00,-96.00,-86.40 +177.60,-89.20,3.60,0.00,1.00,-91.20,-86.40 +0.00,-86.40,3.66,0.00,1.00,-86.40,-81.60 +0.00,-81.60,3.73,0.00,1.00,-81.60,-76.80 +0.00,-76.80,3.79,0.00,1.00,-76.80,-72.00 +0.00,-72.00,3.86,0.00,1.00,-72.00,-67.20 +0.00,-67.20,3.92,0.00,1.00,-67.20,-62.40 +0.00,-62.40,3.98,0.00,1.00,-62.40,-57.60 +0.00,-57.60,4.05,0.00,1.00,-57.60,-52.80 +0.00,-52.80,4.11,0.00,1.00,-52.80,-48.00 +0.00,-48.00,4.18,0.00,1.00,-48.00,-43.20 +0.00,-43.20,4.24,0.00,1.00,-43.20,-38.40 +0.00,-38.40,4.31,0.00,1.00,-38.40,-33.60 +0.00,-33.60,4.37,0.00,1.00,-33.60,-28.80 +0.00,-28.80,4.43,0.00,1.00,-28.80,-24.00 +0.00,-24.00,4.50,0.00,1.00,-24.00,-19.20 +0.00,-19.20,4.56,0.00,1.00,-19.20,-14.40 +0.00,-14.40,4.63,0.00,1.00,-14.40,-9.60 +0.00,-9.60,4.69,0.00,1.00,-9.60,-4.80 +0.00,-4.80,4.76,0.00,1.00,-4.80,0.00 +0.00,0.00,4.82,0.00,1.00,0.00,4.80 +0.00,4.80,4.88,0.00,1.00,4.80,9.60 +0.00,9.60,4.95,0.00,1.00,9.60,14.40 +0.00,14.40,5.01,0.00,1.00,14.40,19.20 +0.00,19.20,5.08,0.00,1.00,19.20,24.00 +0.00,24.00,5.14,0.00,1.00,24.00,28.80 +4.80,28.80,5.20,0.00,1.00,28.80,33.60 +4.80,33.60,5.27,0.00,1.00,33.60,38.40 +4.80,38.40,5.33,0.00,1.00,38.40,43.20 +4.80,43.20,5.40,0.00,1.00,43.20,48.00 +4.80,48.00,5.46,0.00,1.00,48.00,52.80 +4.80,52.80,5.53,0.00,1.00,52.80,57.60 +9.60,57.60,5.59,0.00,1.00,57.60,62.40 +9.60,62.40,5.65,0.00,1.00,62.40,67.20 +9.60,67.20,5.72,0.00,1.00,67.20,72.00 +14.40,72.00,5.78,0.00,1.00,72.00,76.80 +19.20,76.80,5.85,0.00,1.00,76.80,81.60 +28.80,81.60,5.91,0.00,1.00,81.60,86.40 +52.80,86.40,5.98,0.00,1.00,86.40,86.40 +105.60,86.40,6.04,0.00,1.00,91.20,81.60 +139.20,81.60,6.10,0.00,1.00,96.00,76.80 +158.40,76.80,6.17,0.00,1.00,100.80,72.00 +163.20,72.00,6.23,0.00,1.00,105.60,67.20 +168.00,67.20,6.30,0.00,1.00,110.40,62.40 +168.00,62.40,6.36,0.00,1.00,115.20,57.60 +172.80,57.60,6.43,0.00,1.00,120.00,52.80 +172.80,52.80,6.49,0.00,1.00,124.80,48.00 +172.80,48.00,6.55,0.00,1.00,129.60,43.20 +172.80,43.20,6.62,0.00,1.00,134.40,38.40 +177.60,38.40,6.68,0.00,1.00,139.20,33.60 +177.60,33.60,6.75,0.00,1.00,144.00,28.80 +177.60,28.80,6.81,0.00,1.00,148.80,24.00 +177.60,24.00,6.88,0.00,1.00,153.60,19.20 +177.60,19.20,6.94,0.00,1.00,158.40,14.40 +177.60,14.40,7.00,0.00,1.00,163.20,9.60 +177.60,9.60,7.07,0.00,1.00,168.00,4.80 +177.60,4.80,7.13,0.00,1.00,172.80,0.00 +177.60,0.00,7.20,0.00,1.00,177.60,-0.00 +-177.60,-0.00,7.26,0.00,1.00,-177.60,-4.80 +-177.60,-4.80,7.33,0.00,1.00,-172.80,-9.60 +-177.60,-9.60,7.39,0.00,1.00,-168.00,-14.40 +-177.60,-14.40,7.45,0.00,1.00,-163.20,-19.20 +-177.60,-19.20,7.52,0.00,1.00,-158.40,-24.00 +-177.60,-24.00,7.58,0.00,1.00,-153.60,-28.80 +-177.60,-28.80,7.65,0.00,1.00,-148.80,-33.60 +-177.60,-33.60,7.71,0.00,1.00,-144.00,-38.40 +-177.60,-38.40,7.78,0.00,1.00,-139.20,-43.20 +-172.80,-43.20,7.84,0.00,1.00,-134.40,-48.00 +-172.80,-48.00,7.90,0.00,1.00,-129.60,-52.80 +-172.80,-52.80,7.97,0.00,1.00,-124.80,-57.60 +-172.80,-57.60,8.03,0.00,1.00,-120.00,-62.40 +-168.00,-62.40,8.10,0.00,1.00,-115.20,-67.20 +-168.00,-67.20,8.16,0.00,1.00,-110.40,-72.00 +-163.20,-72.00,8.22,0.00,1.00,-105.60,-76.80 +-158.40,-76.80,8.29,0.00,1.00,-100.80,-81.60 +-139.20,-81.60,8.35,0.00,1.00,-96.00,-86.40 +-105.60,-86.40,8.42,0.00,1.00,-91.20,-86.40 +-52.80,-86.40,8.48,0.00,1.00,-86.40,-81.60 +-28.80,-81.60,8.55,0.00,1.00,-81.60,-76.80 +-19.20,-76.80,8.61,0.00,1.00,-76.80,-72.00 +-14.40,-72.00,8.67,0.00,1.00,-72.00,-67.20 +-9.60,-67.20,8.74,0.00,1.00,-67.20,-62.40 +-9.60,-62.40,8.80,0.00,1.00,-62.40,-57.60 +-9.60,-57.60,8.87,0.00,1.00,-57.60,-52.80 +-4.80,-52.80,8.93,0.00,1.00,-52.80,-48.00 +-4.80,-48.00,9.00,0.00,1.00,-48.00,-43.20 +-4.80,-43.20,9.06,0.00,1.00,-43.20,-38.40 +-4.80,-38.40,9.12,0.00,1.00,-38.40,-33.60 +-4.80,-33.60,9.19,0.00,1.00,-33.60,-28.80 +-4.80,-28.80,9.25,0.00,1.00,-28.80,-24.00 +-0.00,-24.00,9.32,0.00,1.00,-24.00,-19.20 +-0.00,-19.20,9.38,0.00,1.00,-19.20,-14.40 +-0.00,-14.40,9.45,0.00,1.00,-14.40,-9.60 +-0.00,-9.60,9.51,0.00,1.00,-9.60,-4.80 +-0.00,-4.80,9.57,0.00,1.00,-4.80,0.00 +0.00,0.00,9.64,0.00,1.00,0.00,4.80 +0.00,4.80,9.70,0.00,1.00,4.80,9.60 +0.00,9.60,9.77,0.00,1.00,9.60,14.40 +4.80,14.40,9.83,0.00,1.00,14.40,19.20 +4.80,19.20,9.90,0.00,1.00,19.20,24.00 +4.80,24.00,9.96,0.00,1.00,24.00,28.80 +4.80,28.80,10.02,0.00,1.00,28.80,33.60 +4.80,33.60,10.09,0.00,1.00,33.60,38.40 +9.60,38.40,10.15,0.00,1.00,38.40,43.20 +9.60,43.20,10.22,0.00,1.00,43.20,48.00 +9.60,48.00,10.28,0.00,1.00,48.00,52.80 +14.40,52.80,10.35,0.00,1.00,52.80,57.60 +14.40,57.60,10.41,0.00,1.00,57.60,62.40 +19.20,62.40,10.47,0.00,1.00,62.40,67.20 +24.00,67.20,10.54,0.00,1.00,67.20,72.00 +28.80,72.00,10.60,0.00,1.00,72.00,72.00 +33.60,72.00,10.67,0.00,1.00,76.80,76.80 +48.00,76.80,10.73,0.00,1.00,81.60,81.60 +67.20,81.60,10.80,0.00,1.00,86.40,81.60 +96.00,81.60,10.86,0.00,1.00,91.20,81.60 +120.00,76.80,10.92,0.00,1.00,96.00,76.80 +139.20,76.80,10.99,0.00,1.00,100.80,72.00 +148.80,72.00,11.05,0.00,1.00,105.60,67.20 +153.60,67.20,11.12,0.00,1.00,110.40,62.40 +158.40,62.40,11.18,0.00,1.00,115.20,57.60 +163.20,57.60,11.24,0.00,1.00,120.00,52.80 +168.00,52.80,11.31,0.00,1.00,124.80,48.00 +168.00,48.00,11.37,0.00,1.00,129.60,43.20 +168.00,43.20,11.44,0.00,1.00,134.40,38.40 +172.80,38.40,11.50,0.00,1.00,139.20,33.60 +172.80,33.60,11.57,0.00,1.00,144.00,28.80 +172.80,28.80,11.63,0.00,1.00,148.80,24.00 +177.60,24.00,11.69,0.00,1.00,153.60,19.20 +177.60,19.20,11.76,0.00,1.00,158.40,14.40 +177.60,14.40,11.82,0.00,1.00,163.20,9.60 +177.60,9.60,11.89,0.00,1.00,168.00,4.80 +177.60,4.80,11.95,0.00,1.00,172.80,0.00 +177.60,0.00,12.02,0.00,1.00,177.60,-0.00 +-177.60,-0.00,12.08,0.00,1.00,-177.60,-4.80 +-177.60,-4.80,12.14,0.00,1.00,-172.80,-9.60 +-177.60,-9.60,12.21,0.00,1.00,-168.00,-14.40 +-177.60,-14.40,12.27,0.00,1.00,-163.20,-19.20 +-177.60,-19.20,12.34,0.00,1.00,-158.40,-24.00 +-177.60,-24.00,12.40,0.00,1.00,-153.60,-28.80 +-172.80,-28.80,12.47,0.00,1.00,-148.80,-33.60 +-172.80,-33.60,12.53,0.00,1.00,-144.00,-38.40 +-172.80,-38.40,12.59,0.00,1.00,-139.20,-43.20 +-168.00,-43.20,12.66,0.00,1.00,-134.40,-48.00 +-168.00,-48.00,12.72,0.00,1.00,-129.60,-52.80 +-168.00,-52.80,12.79,0.00,1.00,-124.80,-57.60 +-163.20,-57.60,12.85,0.00,1.00,-120.00,-62.40 +-158.40,-62.40,12.92,0.00,1.00,-115.20,-67.20 +-153.60,-67.20,12.98,0.00,1.00,-110.40,-72.00 +-148.80,-72.00,13.04,0.00,1.00,-105.60,-76.80 +-139.20,-76.80,13.11,0.00,1.00,-100.80,-81.60 +-120.00,-76.80,13.17,0.00,1.00,-96.00,-81.60 +-96.00,-81.60,13.24,0.00,1.00,-91.20,-81.60 +-67.20,-81.60,13.30,0.00,1.00,-86.40,-76.80 +-48.00,-76.80,13.37,0.00,1.00,-81.60,-72.00 +-33.60,-72.00,13.43,0.00,1.00,-76.80,-72.00 +-28.80,-72.00,13.49,0.00,1.00,-72.00,-67.20 +-24.00,-67.20,13.56,0.00,1.00,-67.20,-62.40 +-19.20,-62.40,13.62,0.00,1.00,-62.40,-57.60 +-14.40,-57.60,13.69,0.00,1.00,-57.60,-52.80 +-14.40,-52.80,13.75,0.00,1.00,-52.80,-48.00 +-9.60,-48.00,13.82,0.00,1.00,-48.00,-43.20 +-9.60,-43.20,13.88,0.00,1.00,-43.20,-38.40 +-9.60,-38.40,13.94,0.00,1.00,-38.40,-33.60 +-4.80,-33.60,14.01,0.00,1.00,-33.60,-28.80 +-4.80,-28.80,14.07,0.00,1.00,-28.80,-24.00 +-4.80,-24.00,14.14,0.00,1.00,-24.00,-19.20 +-4.80,-19.20,14.20,0.00,1.00,-19.20,-14.40 +-4.80,-14.40,14.27,0.00,1.00,-14.40,-9.60 +-0.00,-9.60,14.33,0.00,1.00,-9.60,-4.80 +-0.00,-4.80,14.39,0.00,1.00,-4.80,0.00 +0.00,0.00,14.46,0.00,1.00,0.00,4.80 +0.00,4.80,14.52,0.00,1.00,4.80,9.60 +4.80,9.60,14.59,0.00,1.00,9.60,14.40 +4.80,14.40,14.65,0.00,1.00,14.40,19.20 +4.80,19.20,14.71,0.00,1.00,19.20,24.00 +4.80,24.00,14.78,0.00,1.00,24.00,28.80 +9.60,28.80,14.84,0.00,1.00,28.80,33.60 +9.60,33.60,14.91,0.00,1.00,33.60,38.40 +9.60,38.40,14.97,0.00,1.00,38.40,43.20 +14.40,43.20,15.04,0.00,1.00,43.20,48.00 +14.40,48.00,15.10,0.00,1.00,48.00,52.80 +19.20,52.80,15.16,0.00,1.00,52.80,57.60 +19.20,52.80,15.23,0.00,1.00,57.60,57.60 +24.00,57.60,15.29,0.00,1.00,62.40,62.40 +28.80,62.40,15.36,0.00,1.00,67.20,67.20 +38.40,67.20,15.42,0.00,1.00,72.00,72.00 +48.00,72.00,15.49,0.00,1.00,76.80,72.00 +57.60,72.00,15.55,0.00,1.00,81.60,76.80 +76.80,76.80,15.61,0.00,1.00,86.40,76.80 +96.00,76.80,15.68,0.00,1.00,91.20,76.80 +115.20,76.80,15.74,0.00,1.00,96.00,72.00 +129.60,72.00,15.81,0.00,1.00,100.80,72.00 +139.20,67.20,15.87,0.00,1.00,105.60,67.20 +144.00,67.20,15.94,0.00,1.00,110.40,62.40 +153.60,62.40,16.00,0.00,1.00,115.20,57.60 +158.40,57.60,16.00,0.00,1.00,120.00,52.80 +158.40,52.80,15.94,0.00,1.00,124.80,48.00 +163.20,48.00,15.87,0.00,1.00,129.60,43.20 +168.00,43.20,15.81,0.00,1.00,134.40,38.40 +168.00,38.40,15.74,0.00,1.00,139.20,33.60 +168.00,33.60,15.68,0.00,1.00,144.00,28.80 +172.80,28.80,15.61,0.00,1.00,148.80,24.00 +172.80,24.00,15.55,0.00,1.00,153.60,19.20 +172.80,19.20,15.49,0.00,1.00,158.40,14.40 +177.60,14.40,15.42,0.00,1.00,163.20,9.60 +177.60,9.60,15.36,0.00,1.00,168.00,4.80 +177.60,4.80,15.29,0.00,1.00,172.80,0.00 +177.60,0.00,15.23,0.00,1.00,177.60,-0.00 +-177.60,-0.00,15.16,0.00,1.00,-177.60,-4.80 +-177.60,-4.80,15.10,0.00,1.00,-172.80,-9.60 +-177.60,-9.60,15.04,0.00,1.00,-168.00,-14.40 +-177.60,-14.40,14.97,0.00,1.00,-163.20,-19.20 +-172.80,-19.20,14.91,0.00,1.00,-158.40,-24.00 +-172.80,-24.00,14.84,0.00,1.00,-153.60,-28.80 +-172.80,-28.80,14.78,0.00,1.00,-148.80,-33.60 +-168.00,-33.60,14.71,0.00,1.00,-144.00,-38.40 +-168.00,-38.40,14.65,0.00,1.00,-139.20,-43.20 +-168.00,-43.20,14.59,0.00,1.00,-134.40,-48.00 +-163.20,-48.00,14.52,0.00,1.00,-129.60,-52.80 +-158.40,-52.80,14.46,0.00,1.00,-124.80,-57.60 +-158.40,-57.60,14.39,0.00,1.00,-120.00,-62.40 +-153.60,-62.40,14.33,0.00,1.00,-115.20,-67.20 +-144.00,-67.20,14.27,0.00,1.00,-110.40,-72.00 +-139.20,-67.20,14.20,0.00,1.00,-105.60,-72.00 +-129.60,-72.00,14.14,0.00,1.00,-100.80,-76.80 +-115.20,-76.80,14.07,0.00,1.00,-96.00,-76.80 +-96.00,-76.80,14.01,0.00,1.00,-91.20,-76.80 +-76.80,-76.80,13.94,0.00,1.00,-86.40,-72.00 +-57.60,-72.00,13.88,0.00,1.00,-81.60,-72.00 +-48.00,-72.00,13.82,0.00,1.00,-76.80,-67.20 +-38.40,-67.20,13.75,0.00,1.00,-72.00,-62.40 +-28.80,-62.40,13.69,0.00,1.00,-67.20,-57.60 +-24.00,-57.60,13.62,0.00,1.00,-62.40,-57.60 +-19.20,-52.80,13.56,0.00,1.00,-57.60,-52.80 +-19.20,-52.80,13.49,0.00,1.00,-52.80,-48.00 +-14.40,-48.00,13.43,0.00,1.00,-48.00,-43.20 +-14.40,-43.20,13.37,0.00,1.00,-43.20,-38.40 +-9.60,-38.40,13.30,0.00,1.00,-38.40,-33.60 +-9.60,-33.60,13.24,0.00,1.00,-33.60,-28.80 +-9.60,-28.80,13.17,0.00,1.00,-28.80,-24.00 +-4.80,-24.00,13.11,0.00,1.00,-24.00,-19.20 +-4.80,-19.20,13.04,0.00,1.00,-19.20,-14.40 +-4.80,-14.40,12.98,0.00,1.00,-14.40,-9.60 +-4.80,-9.60,12.92,0.00,1.00,-9.60,-4.80 +-0.00,-4.80,12.85,0.00,1.00,-4.80,0.00 +0.00,0.00,12.79,0.00,1.00,0.00,4.80 +0.00,4.80,12.72,0.00,1.00,4.80,9.60 +4.80,9.60,12.66,0.00,1.00,9.60,14.40 +4.80,14.40,12.59,0.00,1.00,14.40,19.20 +4.80,19.20,12.53,0.00,1.00,19.20,24.00 +9.60,24.00,12.47,0.00,1.00,24.00,28.80 +9.60,28.80,12.40,0.00,1.00,28.80,33.60 +14.40,33.60,12.34,0.00,1.00,33.60,38.40 +14.40,33.60,12.27,0.00,1.00,38.40,38.40 +19.20,38.40,12.21,0.00,1.00,43.20,43.20 +19.20,43.20,12.14,0.00,1.00,48.00,48.00 +24.00,48.00,12.08,0.00,1.00,52.80,52.80 +28.80,52.80,12.02,0.00,1.00,57.60,57.60 +33.60,57.60,11.95,0.00,1.00,62.40,62.40 +38.40,62.40,11.89,0.00,1.00,67.20,62.40 +43.20,62.40,11.82,0.00,1.00,72.00,67.20 +52.80,67.20,11.76,0.00,1.00,76.80,72.00 +67.20,67.20,11.69,0.00,1.00,81.60,72.00 +76.80,72.00,11.63,0.00,1.00,86.40,72.00 +96.00,72.00,11.57,0.00,1.00,91.20,72.00 +105.60,72.00,11.50,0.00,1.00,96.00,67.20 +120.00,67.20,11.44,0.00,1.00,100.80,67.20 +129.60,67.20,11.37,0.00,1.00,105.60,62.40 +139.20,62.40,11.31,0.00,1.00,110.40,57.60 +144.00,57.60,11.24,0.00,1.00,115.20,57.60 +148.80,52.80,11.18,0.00,1.00,120.00,52.80 +153.60,52.80,11.12,0.00,1.00,124.80,48.00 +158.40,48.00,11.05,0.00,1.00,129.60,43.20 +163.20,43.20,10.99,0.00,1.00,134.40,38.40 +163.20,38.40,10.92,0.00,1.00,139.20,33.60 +168.00,33.60,10.86,0.00,1.00,144.00,28.80 +168.00,28.80,10.80,0.00,1.00,148.80,24.00 +172.80,24.00,10.73,0.00,1.00,153.60,19.20 +172.80,19.20,10.67,0.00,1.00,158.40,14.40 +172.80,14.40,10.60,0.00,1.00,163.20,9.60 +177.60,9.60,10.54,0.00,1.00,168.00,4.80 +177.60,4.80,10.47,0.00,1.00,172.80,0.00 +177.60,0.00,10.41,0.00,1.00,177.60,-0.00 +-177.60,-0.00,10.35,0.00,1.00,-177.60,-4.80 +-177.60,-4.80,10.28,0.00,1.00,-172.80,-9.60 +-177.60,-9.60,10.22,0.00,1.00,-168.00,-14.40 +-172.80,-14.40,10.15,0.00,1.00,-163.20,-19.20 +-172.80,-19.20,10.09,0.00,1.00,-158.40,-24.00 +-172.80,-24.00,10.02,0.00,1.00,-153.60,-28.80 +-168.00,-28.80,9.96,0.00,1.00,-148.80,-33.60 +-168.00,-33.60,9.90,0.00,1.00,-144.00,-38.40 +-163.20,-38.40,9.83,0.00,1.00,-139.20,-43.20 +-163.20,-43.20,9.77,0.00,1.00,-134.40,-48.00 +-158.40,-48.00,9.70,0.00,1.00,-129.60,-52.80 +-153.60,-52.80,9.64,0.00,1.00,-124.80,-57.60 +-148.80,-52.80,9.57,0.00,1.00,-120.00,-57.60 +-144.00,-57.60,9.51,0.00,1.00,-115.20,-62.40 +-139.20,-62.40,9.45,0.00,1.00,-110.40,-67.20 +-129.60,-67.20,9.38,0.00,1.00,-105.60,-67.20 +-120.00,-67.20,9.32,0.00,1.00,-100.80,-72.00 +-105.60,-72.00,9.25,0.00,1.00,-96.00,-72.00 +-96.00,-72.00,9.19,0.00,1.00,-91.20,-72.00 +-76.80,-72.00,9.12,0.00,1.00,-86.40,-72.00 +-67.20,-67.20,9.06,0.00,1.00,-81.60,-67.20 +-52.80,-67.20,9.00,0.00,1.00,-76.80,-62.40 +-43.20,-62.40,8.93,0.00,1.00,-72.00,-62.40 +-38.40,-62.40,8.87,0.00,1.00,-67.20,-57.60 +-33.60,-57.60,8.80,0.00,1.00,-62.40,-52.80 +-28.80,-52.80,8.74,0.00,1.00,-57.60,-48.00 +-24.00,-48.00,8.67,0.00,1.00,-52.80,-43.20 +-19.20,-43.20,8.61,0.00,1.00,-48.00,-38.40 +-19.20,-38.40,8.55,0.00,1.00,-43.20,-38.40 +-14.40,-33.60,8.48,0.00,1.00,-38.40,-33.60 +-14.40,-33.60,8.42,0.00,1.00,-33.60,-28.80 +-9.60,-28.80,8.35,0.00,1.00,-28.80,-24.00 +-9.60,-24.00,8.29,0.00,1.00,-24.00,-19.20 +-4.80,-19.20,8.22,0.00,1.00,-19.20,-14.40 +-4.80,-14.40,8.16,0.00,1.00,-14.40,-9.60 +-4.80,-9.60,8.10,0.00,1.00,-9.60,-4.80 +-0.00,-4.80,8.03,0.00,1.00,-4.80,0.00 +0.00,0.00,7.97,0.00,1.00,0.00,4.80 +0.00,4.80,7.90,0.00,1.00,4.80,9.60 +4.80,9.60,7.84,0.00,1.00,9.60,14.40 +4.80,14.40,7.78,0.00,1.00,14.40,19.20 +9.60,19.20,7.71,0.00,1.00,19.20,24.00 +9.60,24.00,7.65,0.00,1.00,24.00,24.00 +14.40,24.00,7.58,0.00,1.00,28.80,28.80 +14.40,28.80,7.52,0.00,1.00,33.60,33.60 +19.20,33.60,7.45,0.00,1.00,33.60,38.40 +19.20,38.40,7.39,0.00,1.00,38.40,43.20 +24.00,43.20,7.33,0.00,1.00,43.20,48.00 +28.80,48.00,7.26,0.00,1.00,48.00,52.80 +33.60,52.80,7.20,0.00,1.00,57.60,52.80 +38.40,52.80,7.13,0.00,1.00,62.40,57.60 +43.20,57.60,7.07,0.00,1.00,67.20,62.40 +52.80,62.40,7.00,0.00,1.00,72.00,62.40 +62.40,62.40,6.94,0.00,1.00,76.80,67.20 +72.00,62.40,6.88,0.00,1.00,81.60,67.20 +81.60,67.20,6.81,0.00,1.00,86.40,67.20 +91.20,67.20,6.75,0.00,1.00,91.20,67.20 +105.60,67.20,6.68,0.00,1.00,96.00,67.20 +115.20,62.40,6.62,0.00,1.00,100.80,62.40 +124.80,62.40,6.55,0.00,1.00,105.60,57.60 +134.40,57.60,6.49,0.00,1.00,110.40,57.60 +139.20,57.60,6.43,0.00,1.00,115.20,52.80 +144.00,52.80,6.36,0.00,1.00,120.00,48.00 +148.80,48.00,6.30,0.00,1.00,129.60,43.20 +153.60,43.20,6.23,0.00,1.00,134.40,43.20 +158.40,38.40,6.17,0.00,1.00,139.20,38.40 +158.40,38.40,6.10,0.00,1.00,144.00,33.60 +163.20,33.60,6.04,0.00,1.00,148.80,28.80 +168.00,28.80,5.98,0.00,1.00,148.80,24.00 +168.00,24.00,5.91,0.00,1.00,153.60,19.20 +172.80,19.20,5.85,0.00,1.00,158.40,14.40 +172.80,14.40,5.78,0.00,1.00,163.20,9.60 +172.80,9.60,5.72,0.00,1.00,168.00,4.80 +177.60,4.80,5.65,0.00,1.00,172.80,0.00 +177.60,0.00,5.59,0.00,1.00,177.60,-0.00 +-177.60,-0.00,5.53,0.00,1.00,-177.60,-4.80 +-177.60,-4.80,5.46,0.00,1.00,-172.80,-9.60 +-172.80,-9.60,5.40,0.00,1.00,-168.00,-14.40 +-172.80,-14.40,5.33,0.00,1.00,-163.20,-19.20 +-172.80,-19.20,5.27,0.00,1.00,-158.40,-24.00 +-168.00,-24.00,5.20,0.00,1.00,-153.60,-28.80 +-168.00,-28.80,5.14,0.00,1.00,-148.80,-33.60 +-163.20,-33.60,5.08,0.00,1.00,-148.80,-38.40 +-158.40,-38.40,5.01,0.00,1.00,-144.00,-43.20 +-158.40,-38.40,4.95,0.00,1.00,-139.20,-43.20 +-153.60,-43.20,4.88,0.00,1.00,-134.40,-48.00 +-148.80,-48.00,4.82,0.00,1.00,-129.60,-52.80 +-144.00,-52.80,4.76,0.00,1.00,-120.00,-57.60 +-139.20,-57.60,4.69,0.00,1.00,-115.20,-57.60 +-134.40,-57.60,4.63,0.00,1.00,-110.40,-62.40 +-124.80,-62.40,4.56,0.00,1.00,-105.60,-67.20 +-115.20,-62.40,4.50,0.00,1.00,-100.80,-67.20 +-105.60,-67.20,4.43,0.00,1.00,-96.00,-67.20 +-91.20,-67.20,4.37,0.00,1.00,-91.20,-67.20 +-81.60,-67.20,4.31,0.00,1.00,-86.40,-67.20 +-72.00,-62.40,4.24,0.00,1.00,-81.60,-62.40 +-62.40,-62.40,4.18,0.00,1.00,-76.80,-62.40 +-52.80,-62.40,4.11,0.00,1.00,-72.00,-57.60 +-43.20,-57.60,4.05,0.00,1.00,-67.20,-52.80 +-38.40,-52.80,3.98,0.00,1.00,-62.40,-52.80 +-33.60,-52.80,3.92,0.00,1.00,-57.60,-48.00 +-28.80,-48.00,3.86,0.00,1.00,-48.00,-43.20 +-24.00,-43.20,3.79,0.00,1.00,-43.20,-38.40 +-19.20,-38.40,3.73,0.00,1.00,-38.40,-33.60 +-19.20,-33.60,3.66,0.00,1.00,-33.60,-28.80 +-14.40,-28.80,3.60,0.00,1.00,-33.60,-24.00 +-14.40,-24.00,3.53,0.00,1.00,-28.80,-24.00 +-9.60,-24.00,3.47,0.00,1.00,-24.00,-19.20 +-9.60,-19.20,3.41,0.00,1.00,-19.20,-14.40 +-4.80,-14.40,3.34,0.00,1.00,-14.40,-9.60 +-4.80,-9.60,3.28,0.00,1.00,-9.60,-4.80 +-0.00,-4.80,3.21,0.00,1.00,-4.80,0.00 +0.00,0.00,3.15,0.00,1.00,0.00,4.80 +0.00,4.80,3.08,0.00,1.00,4.80,9.60 +4.80,9.60,3.02,0.00,1.00,9.60,14.40 +4.80,14.40,2.96,0.00,1.00,14.40,19.20 +9.60,14.40,2.89,0.00,1.00,19.20,19.20 +14.40,19.20,2.83,0.00,1.00,19.20,24.00 +14.40,24.00,2.76,0.00,1.00,24.00,28.80 +19.20,28.80,2.70,0.00,1.00,28.80,33.60 +19.20,33.60,2.63,0.00,1.00,33.60,38.40 +24.00,38.40,2.57,0.00,1.00,38.40,43.20 +28.80,38.40,2.51,0.00,1.00,43.20,43.20 +33.60,43.20,2.44,0.00,1.00,48.00,48.00 +38.40,48.00,2.38,0.00,1.00,52.80,52.80 +43.20,52.80,2.31,0.00,1.00,57.60,52.80 +48.00,52.80,2.25,0.00,1.00,62.40,57.60 +57.60,57.60,2.18,0.00,1.00,72.00,57.60 +62.40,57.60,2.12,0.00,1.00,76.80,62.40 +72.00,62.40,2.06,0.00,1.00,81.60,62.40 +81.60,62.40,1.99,0.00,1.00,86.40,62.40 +91.20,62.40,1.93,0.00,1.00,91.20,62.40 +100.80,62.40,1.86,0.00,1.00,96.00,62.40 +110.40,57.60,1.80,0.00,1.00,100.80,57.60 +120.00,57.60,1.73,0.00,1.00,105.60,57.60 +129.60,57.60,1.67,0.00,1.00,115.20,52.80 +134.40,52.80,1.61,0.00,1.00,120.00,48.00 +139.20,48.00,1.54,0.00,1.00,124.80,48.00 +144.00,48.00,1.48,0.00,1.00,129.60,43.20 +148.80,43.20,1.41,0.00,1.00,134.40,38.40 +153.60,38.40,1.35,0.00,1.00,139.20,33.60 +158.40,33.60,1.29,0.00,1.00,144.00,33.60 +158.40,28.80,1.22,0.00,1.00,148.80,28.80 +163.20,28.80,1.16,0.00,1.00,153.60,24.00 +168.00,24.00,1.09,0.00,1.00,158.40,19.20 +168.00,19.20,1.03,0.00,1.00,163.20,14.40 +172.80,14.40,0.96,0.00,1.00,163.20,9.60 +172.80,9.60,0.90,0.00,1.00,168.00,4.80 +177.60,4.80,0.84,0.00,1.00,172.80,0.00 +177.60,0.00,0.77,0.00,1.00,177.60,-0.00 +-177.60,-0.00,0.71,0.00,1.00,-177.60,-4.80 +-177.60,-4.80,0.64,0.00,1.00,-172.80,-9.60 +-172.80,-9.60,0.58,0.00,1.00,-168.00,-14.40 +-172.80,-14.40,0.51,0.00,1.00,-163.20,-19.20 +-168.00,-19.20,0.45,0.00,1.00,-163.20,-24.00 +-168.00,-24.00,0.39,0.00,1.00,-158.40,-28.80 +-163.20,-28.80,0.32,0.00,1.00,-153.60,-33.60 +-158.40,-28.80,0.26,0.00,1.00,-148.80,-33.60 +-158.40,-33.60,0.19,0.00,1.00,-144.00,-38.40 +-153.60,-38.40,0.13,0.00,1.00,-139.20,-43.20 +-148.80,-43.20,0.06,0.00,1.00,-134.40,-48.00 +-144.00,-48.00,0.00,0.00,1.00,-129.60,-48.00 +-139.20,-48.00,0.00,0.00,1.00,-124.80,-52.80 +-134.40,-52.80,0.16,0.00,1.00,-120.00,-57.60 +-129.60,-57.60,0.32,0.00,1.00,-115.20,-57.60 +-120.00,-57.60,0.48,0.00,1.00,-105.60,-62.40 +-110.40,-57.60,0.65,0.00,1.00,-100.80,-62.40 +-100.80,-62.40,0.81,0.00,1.00,-96.00,-62.40 +-91.20,-62.40,0.97,0.00,1.00,-91.20,-62.40 +-81.60,-62.40,1.13,0.00,1.00,-86.40,-62.40 +-72.00,-62.40,1.29,0.00,1.00,-81.60,-57.60 +-62.40,-57.60,1.45,0.00,1.00,-76.80,-57.60 +-57.60,-57.60,1.62,0.00,1.00,-72.00,-52.80 +-48.00,-52.80,1.78,0.00,1.00,-62.40,-52.80 +-43.20,-52.80,1.94,0.00,1.00,-57.60,-48.00 +-38.40,-48.00,2.10,0.00,1.00,-52.80,-43.20 +-33.60,-43.20,2.26,0.00,1.00,-48.00,-43.20 +-28.80,-38.40,2.42,0.00,1.00,-43.20,-38.40 +-24.00,-38.40,2.59,0.00,1.00,-38.40,-33.60 +-19.20,-33.60,2.75,0.00,1.00,-33.60,-28.80 +-19.20,-28.80,2.91,0.00,1.00,-28.80,-24.00 +-14.40,-24.00,3.07,0.00,1.00,-24.00,-19.20 +-14.40,-19.20,3.23,0.00,1.00,-19.20,-19.20 +-9.60,-14.40,3.39,0.00,1.00,-19.20,-14.40 +-4.80,-14.40,3.56,0.00,1.00,-14.40,-9.60 +-4.80,-9.60,3.72,0.00,1.00,-9.60,-4.80 +-0.00,-4.80,3.88,0.00,1.00,-4.80,0.00 +0.00,0.00,4.04,0.00,1.00,0.00,4.80 +4.80,4.80,4.20,0.00,1.00,4.80,9.60 +4.80,9.60,4.36,0.00,1.00,9.60,14.40 +9.60,9.60,4.53,0.00,1.00,14.40,14.40 +9.60,14.40,4.69,0.00,1.00,14.40,19.20 +14.40,19.20,4.85,0.00,1.00,19.20,24.00 +19.20,24.00,5.01,0.00,1.00,24.00,28.80 +19.20,28.80,5.17,0.00,1.00,28.80,33.60 +24.00,28.80,5.33,0.00,1.00,33.60,33.60 +28.80,33.60,5.49,0.00,1.00,38.40,38.40 +33.60,38.40,5.66,0.00,1.00,43.20,43.20 +38.40,43.20,5.82,0.00,1.00,48.00,43.20 +43.20,43.20,5.98,0.00,1.00,52.80,48.00 +48.00,48.00,6.14,0.00,1.00,57.60,52.80 +52.80,48.00,6.30,0.00,1.00,62.40,52.80 +57.60,52.80,6.46,0.00,1.00,67.20,57.60 +67.20,52.80,6.63,0.00,1.00,72.00,57.60 +76.80,57.60,6.79,0.00,1.00,81.60,57.60 +81.60,57.60,6.95,0.00,1.00,86.40,57.60 +91.20,57.60,7.11,0.00,1.00,91.20,57.60 +100.80,57.60,7.27,0.00,1.00,96.00,57.60 +110.40,52.80,7.43,0.00,1.00,100.80,52.80 +115.20,52.80,7.60,0.00,1.00,110.40,52.80 +124.80,52.80,7.76,0.00,1.00,115.20,48.00 +129.60,48.00,7.92,0.00,1.00,120.00,48.00 +134.40,48.00,8.08,0.00,1.00,124.80,43.20 +139.20,43.20,8.24,0.00,1.00,129.60,38.40 +144.00,38.40,8.40,0.00,1.00,134.40,38.40 +148.80,38.40,8.57,0.00,1.00,139.20,33.60 +153.60,33.60,8.73,0.00,1.00,144.00,28.80 +158.40,28.80,8.89,0.00,1.00,148.80,24.00 +163.20,24.00,9.05,0.00,1.00,153.60,24.00 +163.20,24.00,9.21,0.00,1.00,158.40,19.20 +168.00,19.20,9.37,0.00,1.00,163.20,14.40 +172.80,14.40,9.54,0.00,1.00,168.00,9.60 +172.80,9.60,9.70,0.00,1.00,168.00,4.80 +177.60,4.80,9.86,0.00,1.00,172.80,0.00 +177.60,0.00,10.02,0.00,1.00,177.60,-0.00 +-177.60,-0.00,10.18,0.00,1.00,-177.60,-4.80 +-177.60,-4.80,10.34,0.00,1.00,-172.80,-9.60 +-172.80,-9.60,10.51,0.00,1.00,-168.00,-14.40 +-172.80,-14.40,10.67,0.00,1.00,-168.00,-19.20 +-168.00,-19.20,10.83,0.00,1.00,-163.20,-24.00 +-163.20,-24.00,10.99,0.00,1.00,-158.40,-24.00 +-163.20,-24.00,11.15,0.00,1.00,-153.60,-28.80 +-158.40,-28.80,11.31,0.00,1.00,-148.80,-33.60 +-153.60,-33.60,11.47,0.00,1.00,-144.00,-38.40 +-148.80,-38.40,11.64,0.00,1.00,-139.20,-38.40 +-144.00,-38.40,11.80,0.00,1.00,-134.40,-43.20 +-139.20,-43.20,11.96,0.00,1.00,-129.60,-48.00 +-134.40,-48.00,12.12,0.00,1.00,-124.80,-48.00 +-129.60,-48.00,12.28,0.00,1.00,-120.00,-52.80 +-124.80,-52.80,12.44,0.00,1.00,-115.20,-52.80 +-115.20,-52.80,12.61,0.00,1.00,-110.40,-57.60 +-110.40,-52.80,12.77,0.00,1.00,-100.80,-57.60 +-100.80,-57.60,12.93,0.00,1.00,-96.00,-57.60 +-91.20,-57.60,13.09,0.00,1.00,-91.20,-57.60 +-81.60,-57.60,13.25,0.00,1.00,-86.40,-57.60 +-76.80,-57.60,13.41,0.00,1.00,-81.60,-57.60 +-67.20,-52.80,13.58,0.00,1.00,-72.00,-52.80 +-57.60,-52.80,13.74,0.00,1.00,-67.20,-52.80 +-52.80,-48.00,13.90,0.00,1.00,-62.40,-48.00 +-48.00,-48.00,14.06,0.00,1.00,-57.60,-43.20 +-43.20,-43.20,14.22,0.00,1.00,-52.80,-43.20 +-38.40,-43.20,14.38,0.00,1.00,-48.00,-38.40 +-33.60,-38.40,14.55,0.00,1.00,-43.20,-33.60 +-28.80,-33.60,14.71,0.00,1.00,-38.40,-33.60 +-24.00,-28.80,14.87,0.00,1.00,-33.60,-28.80 +-19.20,-28.80,15.03,0.00,1.00,-28.80,-24.00 +-19.20,-24.00,15.19,0.00,1.00,-24.00,-19.20 +-14.40,-19.20,15.35,0.00,1.00,-19.20,-14.40 +-9.60,-14.40,15.52,0.00,1.00,-14.40,-14.40 +-9.60,-9.60,15.68,0.00,1.00,-14.40,-9.60 +-4.80,-9.60,15.84,0.00,1.00,-9.60,-4.80 +-4.80,-4.80,16.00,0.00,1.00,-4.80,0.00 +0.00,0.00,16.00,0.00,1.00,0.00,4.80 +4.80,4.80,15.84,0.00,1.00,4.80,9.60 +4.80,9.60,15.68,0.00,1.00,9.60,9.60 +9.60,9.60,15.52,0.00,1.00,9.60,14.40 +14.40,14.40,15.35,0.00,1.00,14.40,19.20 +14.40,19.20,15.19,0.00,1.00,19.20,24.00 +19.20,24.00,15.03,0.00,1.00,24.00,24.00 +24.00,24.00,14.87,0.00,1.00,28.80,28.80 +24.00,28.80,14.71,0.00,1.00,33.60,33.60 +28.80,33.60,14.55,0.00,1.00,38.40,38.40 +33.60,33.60,14.38,0.00,1.00,43.20,38.40 +38.40,38.40,14.22,0.00,1.00,48.00,43.20 +43.20,43.20,14.06,0.00,1.00,52.80,43.20 +48.00,43.20,13.90,0.00,1.00,57.60,48.00 +57.60,48.00,13.74,0.00,1.00,62.40,48.00 +62.40,48.00,13.58,0.00,1.00,67.20,52.80 +67.20,48.00,13.41,0.00,1.00,72.00,52.80 +76.80,52.80,13.25,0.00,1.00,81.60,52.80 +86.40,52.80,13.09,0.00,1.00,86.40,52.80 +91.20,52.80,12.93,0.00,1.00,91.20,52.80 +100.80,52.80,12.77,0.00,1.00,96.00,52.80 +105.60,48.00,12.61,0.00,1.00,105.60,48.00 +115.20,48.00,12.44,0.00,1.00,110.40,48.00 +120.00,48.00,12.28,0.00,1.00,115.20,48.00 +124.80,43.20,12.12,0.00,1.00,120.00,43.20 +134.40,43.20,11.96,0.00,1.00,124.80,43.20 +139.20,38.40,11.80,0.00,1.00,129.60,38.40 +144.00,38.40,11.64,0.00,1.00,134.40,33.60 +148.80,33.60,11.47,0.00,1.00,139.20,33.60 +153.60,28.80,11.31,0.00,1.00,144.00,28.80 +153.60,28.80,11.15,0.00,1.00,148.80,24.00 +158.40,24.00,10.99,0.00,1.00,153.60,19.20 +163.20,19.20,10.83,0.00,1.00,158.40,19.20 +168.00,14.40,10.67,0.00,1.00,163.20,14.40 +168.00,14.40,10.51,0.00,1.00,168.00,9.60 +172.80,9.60,10.34,0.00,1.00,172.80,4.80 +177.60,4.80,10.18,0.00,1.00,172.80,0.00 +177.60,0.00,10.02,0.00,1.00,177.60,-0.00 +-177.60,-0.00,9.86,0.00,1.00,-177.60,-4.80 +-177.60,-4.80,9.70,0.00,1.00,-172.80,-9.60 +-172.80,-9.60,9.54,0.00,1.00,-172.80,-14.40 +-168.00,-14.40,9.37,0.00,1.00,-168.00,-19.20 +-168.00,-14.40,9.21,0.00,1.00,-163.20,-19.20 +-163.20,-19.20,9.05,0.00,1.00,-158.40,-24.00 +-158.40,-24.00,8.89,0.00,1.00,-153.60,-28.80 +-153.60,-28.80,8.73,0.00,1.00,-148.80,-33.60 +-153.60,-28.80,8.57,0.00,1.00,-144.00,-33.60 +-148.80,-33.60,8.40,0.00,1.00,-139.20,-38.40 +-144.00,-38.40,8.24,0.00,1.00,-134.40,-43.20 +-139.20,-38.40,8.08,0.00,1.00,-129.60,-43.20 +-134.40,-43.20,7.92,0.00,1.00,-124.80,-48.00 +-124.80,-43.20,7.76,0.00,1.00,-120.00,-48.00 +-120.00,-48.00,7.60,0.00,1.00,-115.20,-48.00 +-115.20,-48.00,7.43,0.00,1.00,-110.40,-52.80 +-105.60,-48.00,7.27,0.00,1.00,-105.60,-52.80 +-100.80,-52.80,7.11,0.00,1.00,-96.00,-52.80 +-91.20,-52.80,6.95,0.00,1.00,-91.20,-52.80 +-86.40,-52.80,6.79,0.00,1.00,-86.40,-52.80 +-76.80,-52.80,6.63,0.00,1.00,-81.60,-52.80 +-67.20,-48.00,6.46,0.00,1.00,-72.00,-48.00 +-62.40,-48.00,6.30,0.00,1.00,-67.20,-48.00 +-57.60,-48.00,6.14,0.00,1.00,-62.40,-43.20 +-48.00,-43.20,5.98,0.00,1.00,-57.60,-43.20 +-43.20,-43.20,5.82,0.00,1.00,-52.80,-38.40 +-38.40,-38.40,5.66,0.00,1.00,-48.00,-38.40 +-33.60,-33.60,5.49,0.00,1.00,-43.20,-33.60 +-28.80,-33.60,5.33,0.00,1.00,-38.40,-28.80 +-24.00,-28.80,5.17,0.00,1.00,-33.60,-24.00 +-24.00,-24.00,5.01,0.00,1.00,-28.80,-24.00 +-19.20,-24.00,4.85,0.00,1.00,-24.00,-19.20 +-14.40,-19.20,4.69,0.00,1.00,-19.20,-14.40 +-14.40,-14.40,4.53,0.00,1.00,-14.40,-9.60 +-9.60,-9.60,4.36,0.00,1.00,-9.60,-9.60 +-4.80,-9.60,4.20,0.00,1.00,-9.60,-4.80 +-4.80,-4.80,4.04,0.00,1.00,-4.80,0.00 +0.00,0.00,3.88,0.00,1.00,0.00,4.80 +4.80,4.80,3.72,0.00,1.00,4.80,4.80 +4.80,4.80,3.56,0.00,1.00,4.80,9.60 +9.60,9.60,3.39,0.00,1.00,9.60,14.40 +14.40,14.40,3.23,0.00,1.00,14.40,19.20 +19.20,19.20,3.07,0.00,1.00,19.20,19.20 +19.20,19.20,2.91,0.00,1.00,24.00,24.00 +24.00,24.00,2.75,0.00,1.00,24.00,28.80 +28.80,28.80,2.59,0.00,1.00,28.80,28.80 +33.60,28.80,2.42,0.00,1.00,33.60,33.60 +38.40,33.60,2.26,0.00,1.00,38.40,38.40 +43.20,33.60,2.10,0.00,1.00,43.20,38.40 +48.00,38.40,1.94,0.00,1.00,48.00,43.20 +52.80,38.40,1.78,0.00,1.00,52.80,43.20 +57.60,43.20,1.62,0.00,1.00,62.40,43.20 +62.40,43.20,1.45,0.00,1.00,67.20,48.00 +72.00,43.20,1.29,0.00,1.00,72.00,48.00 +76.80,48.00,1.13,0.00,1.00,76.80,48.00 +86.40,48.00,0.97,0.00,1.00,86.40,48.00 +91.20,48.00,0.81,0.00,1.00,91.20,48.00 +100.80,48.00,0.65,0.00,1.00,96.00,48.00 +105.60,48.00,0.48,0.00,1.00,105.60,48.00 +110.40,43.20,0.32,0.00,1.00,110.40,43.20 +120.00,43.20,0.16,0.00,1.00,115.20,43.20 +124.80,43.20,0.00,0.00,1.00,124.80,38.40 +129.60,38.40,0.00,0.00,1.00,129.60,38.40 +134.40,38.40,0.04,0.00,1.00,134.40,33.60 +139.20,33.60,0.08,0.00,1.00,139.20,33.60 +144.00,33.60,0.12,0.00,1.00,144.00,28.80 +148.80,28.80,0.16,0.00,1.00,148.80,24.00 +153.60,24.00,0.20,0.00,1.00,153.60,24.00 +158.40,24.00,0.24,0.00,1.00,158.40,19.20 +163.20,19.20,0.28,0.00,1.00,158.40,14.40 +163.20,14.40,0.32,0.00,1.00,163.20,14.40 +168.00,14.40,0.36,0.00,1.00,168.00,9.60 +172.80,9.60,0.40,0.00,1.00,172.80,4.80 +172.80,4.80,0.44,0.00,1.00,172.80,0.00 +177.60,0.00,0.48,0.00,1.00,177.60,-0.00 +-177.60,-0.00,0.52,0.00,1.00,-177.60,-4.80 +-172.80,-4.80,0.56,0.00,1.00,-172.80,-9.60 +-172.80,-9.60,0.60,0.00,1.00,-172.80,-14.40 +-168.00,-14.40,0.64,0.00,1.00,-168.00,-14.40 +-163.20,-14.40,0.68,0.00,1.00,-163.20,-19.20 +-163.20,-19.20,0.72,0.00,1.00,-158.40,-24.00 +-158.40,-24.00,0.76,0.00,1.00,-158.40,-24.00 +-153.60,-24.00,0.80,0.00,1.00,-153.60,-28.80 +-148.80,-28.80,0.84,0.00,1.00,-148.80,-33.60 +-144.00,-33.60,0.88,0.00,1.00,-144.00,-33.60 +-139.20,-33.60,0.92,0.00,1.00,-139.20,-38.40 +-134.40,-38.40,0.96,0.00,1.00,-134.40,-38.40 +-129.60,-38.40,1.00,0.00,1.00,-129.60,-43.20 +-124.80,-43.20,1.04,0.00,1.00,-124.80,-43.20 +-120.00,-43.20,1.08,0.00,1.00,-115.20,-48.00 +-110.40,-43.20,1.12,0.00,1.00,-110.40,-48.00 +-105.60,-48.00,1.16,0.00,1.00,-105.60,-48.00 +-100.80,-48.00,1.20,0.00,1.00,-96.00,-48.00 +-91.20,-48.00,1.24,0.00,1.00,-91.20,-48.00 +-86.40,-48.00,1.28,0.00,1.00,-86.40,-48.00 +-76.80,-48.00,1.32,0.00,1.00,-76.80,-48.00 +-72.00,-43.20,1.36,0.00,1.00,-72.00,-43.20 +-62.40,-43.20,1.40,0.00,1.00,-67.20,-43.20 +-57.60,-43.20,1.44,0.00,1.00,-62.40,-43.20 +-52.80,-38.40,1.48,0.00,1.00,-52.80,-38.40 +-48.00,-38.40,1.52,0.00,1.00,-48.00,-38.40 +-43.20,-33.60,1.56,0.00,1.00,-43.20,-33.60 +-38.40,-33.60,1.60,0.00,1.00,-38.40,-28.80 +-33.60,-28.80,1.64,0.00,1.00,-33.60,-28.80 +-28.80,-28.80,1.68,0.00,1.00,-28.80,-24.00 +-24.00,-24.00,1.72,0.00,1.00,-24.00,-19.20 +-19.20,-19.20,1.76,0.00,1.00,-24.00,-19.20 +-19.20,-19.20,1.80,0.00,1.00,-19.20,-14.40 +-14.40,-14.40,1.84,0.00,1.00,-14.40,-9.60 +-9.60,-9.60,1.88,0.00,1.00,-9.60,-4.80 +-4.80,-4.80,1.92,0.00,1.00,-4.80,-4.80 +-4.80,-4.80,1.96,0.00,1.00,-4.80,0.00 +0.00,0.00,2.01,0.00,1.00,0.00,4.80 +4.80,4.80,2.05,0.00,1.00,4.80,4.80 +4.80,4.80,2.09,0.00,1.00,4.80,9.60 +9.60,9.60,2.13,0.00,1.00,9.60,14.40 +14.40,14.40,2.17,0.00,1.00,14.40,14.40 +19.20,14.40,2.21,0.00,1.00,14.40,19.20 +24.00,19.20,2.25,0.00,1.00,19.20,24.00 +24.00,24.00,2.29,0.00,1.00,24.00,24.00 +28.80,24.00,2.33,0.00,1.00,28.80,28.80 +33.60,28.80,2.37,0.00,1.00,33.60,28.80 +38.40,28.80,2.41,0.00,1.00,38.40,33.60 +43.20,33.60,2.45,0.00,1.00,43.20,33.60 +48.00,33.60,2.49,0.00,1.00,48.00,38.40 +52.80,38.40,2.53,0.00,1.00,52.80,38.40 +62.40,38.40,2.57,0.00,1.00,57.60,38.40 +67.20,38.40,2.61,0.00,1.00,62.40,43.20 +72.00,38.40,2.65,0.00,1.00,72.00,43.20 +76.80,43.20,2.69,0.00,1.00,76.80,43.20 +86.40,43.20,2.73,0.00,1.00,86.40,43.20 +91.20,43.20,2.77,0.00,1.00,91.20,43.20 +96.00,43.20,2.81,0.00,1.00,100.80,43.20 +105.60,43.20,2.85,0.00,1.00,105.60,43.20 +110.40,38.40,2.89,0.00,1.00,110.40,38.40 +115.20,38.40,2.93,0.00,1.00,120.00,38.40 +120.00,38.40,2.97,0.00,1.00,124.80,38.40 +129.60,33.60,3.01,0.00,1.00,129.60,33.60 +134.40,33.60,3.05,0.00,1.00,134.40,33.60 +139.20,28.80,3.09,0.00,1.00,139.20,28.80 +144.00,28.80,3.13,0.00,1.00,144.00,28.80 +148.80,24.00,3.17,0.00,1.00,148.80,24.00 +153.60,24.00,3.21,0.00,1.00,153.60,19.20 +153.60,19.20,3.25,0.00,1.00,158.40,19.20 +158.40,19.20,3.29,0.00,1.00,163.20,14.40 +163.20,14.40,3.33,0.00,1.00,163.20,9.60 +168.00,9.60,3.37,0.00,1.00,168.00,9.60 +172.80,9.60,3.41,0.00,1.00,172.80,4.80 +172.80,4.80,3.45,0.00,1.00,172.80,0.00 +177.60,0.00,3.49,0.00,1.00,177.60,-0.00 +-177.60,-0.00,3.53,0.00,1.00,-177.60,-4.80 +-172.80,-4.80,3.57,0.00,1.00,-172.80,-9.60 +-172.80,-9.60,3.61,0.00,1.00,-172.80,-9.60 +-168.00,-9.60,3.65,0.00,1.00,-168.00,-14.40 +-163.20,-14.40,3.69,0.00,1.00,-163.20,-19.20 +-158.40,-19.20,3.73,0.00,1.00,-163.20,-19.20 +-153.60,-19.20,3.77,0.00,1.00,-158.40,-24.00 +-153.60,-24.00,3.81,0.00,1.00,-153.60,-28.80 +-148.80,-24.00,3.85,0.00,1.00,-148.80,-28.80 +-144.00,-28.80,3.89,0.00,1.00,-144.00,-33.60 +-139.20,-28.80,3.93,0.00,1.00,-139.20,-33.60 +-134.40,-33.60,3.97,0.00,1.00,-134.40,-38.40 +-129.60,-33.60,4.01,0.00,1.00,-129.60,-38.40 +-120.00,-38.40,4.05,0.00,1.00,-124.80,-38.40 +-115.20,-38.40,4.09,0.00,1.00,-120.00,-43.20 +-110.40,-38.40,4.13,0.00,1.00,-110.40,-43.20 +-105.60,-43.20,4.17,0.00,1.00,-105.60,-43.20 +-96.00,-43.20,4.21,0.00,1.00,-100.80,-43.20 +-91.20,-43.20,4.25,0.00,1.00,-91.20,-43.20 +-86.40,-43.20,4.29,0.00,1.00,-86.40,-43.20 +-76.80,-43.20,4.33,0.00,1.00,-76.80,-43.20 +-72.00,-38.40,4.37,0.00,1.00,-72.00,-38.40 +-67.20,-38.40,4.41,0.00,1.00,-62.40,-38.40 +-62.40,-38.40,4.45,0.00,1.00,-57.60,-38.40 +-52.80,-38.40,4.49,0.00,1.00,-52.80,-33.60 +-48.00,-33.60,4.53,0.00,1.00,-48.00,-33.60 +-43.20,-33.60,4.57,0.00,1.00,-43.20,-28.80 +-38.40,-28.80,4.61,0.00,1.00,-38.40,-28.80 +-33.60,-28.80,4.65,0.00,1.00,-33.60,-24.00 +-28.80,-24.00,4.69,0.00,1.00,-28.80,-24.00 +-24.00,-24.00,4.73,0.00,1.00,-24.00,-19.20 +-24.00,-19.20,4.77,0.00,1.00,-19.20,-14.40 +-19.20,-14.40,4.81,0.00,1.00,-14.40,-14.40 +-14.40,-14.40,4.85,0.00,1.00,-14.40,-9.60 +-9.60,-9.60,4.89,0.00,1.00,-9.60,-4.80 +-4.80,-4.80,4.93,0.00,1.00,-4.80,-4.80 +-4.80,-4.80,4.97,0.00,1.00,-4.80,0.00 +0.00,0.00,5.01,0.00,1.00,0.00,4.80 +4.80,4.80,5.05,0.00,1.00,4.80,4.80 +9.60,4.80,5.09,0.00,1.00,4.80,9.60 +9.60,9.60,5.13,0.00,1.00,9.60,9.60 +14.40,9.60,5.17,0.00,1.00,9.60,14.40 +19.20,14.40,5.21,0.00,1.00,14.40,19.20 +24.00,19.20,5.25,0.00,1.00,19.20,19.20 +28.80,19.20,5.29,0.00,1.00,24.00,24.00 +33.60,24.00,5.33,0.00,1.00,24.00,24.00 +38.40,24.00,5.37,0.00,1.00,28.80,28.80 +43.20,28.80,5.41,0.00,1.00,33.60,28.80 +48.00,28.80,5.45,0.00,1.00,38.40,33.60 +52.80,28.80,5.49,0.00,1.00,43.20,33.60 +57.60,33.60,5.53,0.00,1.00,48.00,33.60 +62.40,33.60,5.57,0.00,1.00,52.80,38.40 +67.20,33.60,5.61,0.00,1.00,62.40,38.40 +72.00,38.40,5.65,0.00,1.00,67.20,38.40 +81.60,38.40,5.69,0.00,1.00,76.80,38.40 +86.40,38.40,5.73,0.00,1.00,86.40,38.40 +91.20,38.40,5.77,0.00,1.00,91.20,38.40 +96.00,38.40,5.81,0.00,1.00,100.80,38.40 +105.60,38.40,5.85,0.00,1.00,105.60,38.40 +110.40,33.60,5.89,0.00,1.00,115.20,33.60 +115.20,33.60,5.93,0.00,1.00,120.00,33.60 +120.00,33.60,5.97,0.00,1.00,129.60,33.60 +124.80,33.60,6.02,0.00,1.00,134.40,28.80 +129.60,28.80,6.06,0.00,1.00,139.20,28.80 +134.40,28.80,6.10,0.00,1.00,144.00,24.00 +139.20,24.00,6.14,0.00,1.00,148.80,24.00 +144.00,24.00,6.18,0.00,1.00,153.60,19.20 +148.80,19.20,6.22,0.00,1.00,158.40,19.20 +153.60,19.20,6.26,0.00,1.00,158.40,14.40 +158.40,14.40,6.30,0.00,1.00,163.20,14.40 +163.20,14.40,6.34,0.00,1.00,168.00,9.60 +168.00,9.60,6.38,0.00,1.00,168.00,9.60 +168.00,9.60,6.42,0.00,1.00,172.80,4.80 +172.80,4.80,6.46,0.00,1.00,177.60,0.00 +177.60,0.00,6.50,0.00,1.00,177.60,-0.00 +-177.60,-0.00,6.54,0.00,1.00,-177.60,-4.80 +-172.80,-4.80,6.58,0.00,1.00,-177.60,-9.60 +-168.00,-9.60,6.62,0.00,1.00,-172.80,-9.60 +-168.00,-9.60,6.66,0.00,1.00,-168.00,-14.40 +-163.20,-14.40,6.70,0.00,1.00,-168.00,-14.40 +-158.40,-14.40,6.74,0.00,1.00,-163.20,-19.20 +-153.60,-19.20,6.78,0.00,1.00,-158.40,-19.20 +-148.80,-19.20,6.82,0.00,1.00,-158.40,-24.00 +-144.00,-24.00,6.86,0.00,1.00,-153.60,-24.00 +-139.20,-24.00,6.90,0.00,1.00,-148.80,-28.80 +-134.40,-28.80,6.94,0.00,1.00,-144.00,-28.80 +-129.60,-28.80,6.98,0.00,1.00,-139.20,-33.60 +-124.80,-33.60,7.02,0.00,1.00,-134.40,-33.60 +-120.00,-33.60,7.06,0.00,1.00,-129.60,-33.60 +-115.20,-33.60,7.10,0.00,1.00,-120.00,-38.40 +-110.40,-33.60,7.14,0.00,1.00,-115.20,-38.40 +-105.60,-38.40,7.18,0.00,1.00,-105.60,-38.40 +-96.00,-38.40,7.22,0.00,1.00,-100.80,-38.40 +-91.20,-38.40,7.26,0.00,1.00,-91.20,-38.40 +-86.40,-38.40,7.30,0.00,1.00,-86.40,-38.40 +-81.60,-38.40,7.34,0.00,1.00,-76.80,-38.40 +-72.00,-38.40,7.38,0.00,1.00,-67.20,-38.40 +-67.20,-33.60,7.42,0.00,1.00,-62.40,-33.60 +-62.40,-33.60,7.46,0.00,1.00,-52.80,-33.60 +-57.60,-33.60,7.50,0.00,1.00,-48.00,-33.60 +-52.80,-28.80,7.54,0.00,1.00,-43.20,-28.80 +-48.00,-28.80,7.58,0.00,1.00,-38.40,-28.80 +-43.20,-28.80,7.62,0.00,1.00,-33.60,-24.00 +-38.40,-24.00,7.66,0.00,1.00,-28.80,-24.00 +-33.60,-24.00,7.70,0.00,1.00,-24.00,-19.20 +-28.80,-19.20,7.74,0.00,1.00,-24.00,-19.20 +-24.00,-19.20,7.78,0.00,1.00,-19.20,-14.40 +-19.20,-14.40,7.82,0.00,1.00,-14.40,-9.60 +-14.40,-9.60,7.86,0.00,1.00,-9.60,-9.60 +-9.60,-9.60,7.90,0.00,1.00,-9.60,-4.80 +-9.60,-4.80,7.94,0.00,1.00,-4.80,-4.80 +-4.80,-4.80,7.98,0.00,1.00,-4.80,0.00 +0.00,0.00,8.02,0.00,1.00,0.00,4.80 +4.80,4.80,8.06,0.00,1.00,4.80,4.80 +9.60,4.80,8.10,0.00,1.00,4.80,9.60 +14.40,9.60,8.14,0.00,1.00,9.60,9.60 +14.40,9.60,8.18,0.00,1.00,9.60,14.40 +19.20,14.40,8.22,0.00,1.00,14.40,14.40 +24.00,14.40,8.26,0.00,1.00,14.40,19.20 +28.80,19.20,8.30,0.00,1.00,19.20,19.20 +33.60,19.20,8.34,0.00,1.00,24.00,24.00 +38.40,19.20,8.38,0.00,1.00,28.80,24.00 +43.20,24.00,8.42,0.00,1.00,28.80,24.00 +48.00,24.00,8.46,0.00,1.00,33.60,28.80 +52.80,28.80,8.50,0.00,1.00,38.40,28.80 +57.60,28.80,8.54,0.00,1.00,48.00,28.80 +62.40,28.80,8.58,0.00,1.00,52.80,33.60 +67.20,28.80,8.62,0.00,1.00,57.60,33.60 +76.80,33.60,8.66,0.00,1.00,67.20,33.60 +81.60,33.60,8.70,0.00,1.00,76.80,33.60 +86.40,33.60,8.74,0.00,1.00,81.60,33.60 +91.20,33.60,8.78,0.00,1.00,91.20,33.60 +96.00,33.60,8.82,0.00,1.00,100.80,33.60 +100.80,33.60,8.86,0.00,1.00,110.40,33.60 +110.40,28.80,8.90,0.00,1.00,115.20,33.60 +115.20,28.80,8.94,0.00,1.00,124.80,28.80 +120.00,28.80,8.98,0.00,1.00,129.60,28.80 +124.80,28.80,9.02,0.00,1.00,139.20,28.80 +129.60,24.00,9.06,0.00,1.00,144.00,24.00 +134.40,24.00,9.10,0.00,1.00,148.80,24.00 +139.20,24.00,9.14,0.00,1.00,153.60,19.20 +144.00,19.20,9.18,0.00,1.00,153.60,19.20 +148.80,19.20,9.22,0.00,1.00,158.40,14.40 +153.60,14.40,9.26,0.00,1.00,163.20,14.40 +158.40,14.40,9.30,0.00,1.00,163.20,9.60 +163.20,9.60,9.34,0.00,1.00,168.00,9.60 +168.00,9.60,9.38,0.00,1.00,172.80,4.80 +168.00,4.80,9.42,0.00,1.00,172.80,4.80 +172.80,4.80,9.46,0.00,1.00,177.60,0.00 +177.60,0.00,9.50,0.00,1.00,177.60,-0.00 +-177.60,-0.00,9.54,0.00,1.00,-177.60,-4.80 +-172.80,-4.80,9.58,0.00,1.00,-177.60,-4.80 +-168.00,-4.80,9.62,0.00,1.00,-172.80,-9.60 +-168.00,-9.60,9.66,0.00,1.00,-172.80,-9.60 +-163.20,-9.60,9.70,0.00,1.00,-168.00,-14.40 +-158.40,-14.40,9.74,0.00,1.00,-163.20,-14.40 +-153.60,-14.40,9.78,0.00,1.00,-163.20,-19.20 +-148.80,-19.20,9.82,0.00,1.00,-158.40,-19.20 +-144.00,-19.20,9.86,0.00,1.00,-153.60,-24.00 +-139.20,-24.00,9.90,0.00,1.00,-153.60,-24.00 +-134.40,-24.00,9.94,0.00,1.00,-148.80,-28.80 +-129.60,-24.00,9.98,0.00,1.00,-144.00,-28.80 +-124.80,-28.80,10.03,0.00,1.00,-139.20,-28.80 +-120.00,-28.80,10.07,0.00,1.00,-129.60,-33.60 +-115.20,-28.80,10.11,0.00,1.00,-124.80,-33.60 +-110.40,-28.80,10.15,0.00,1.00,-115.20,-33.60 +-100.80,-33.60,10.19,0.00,1.00,-110.40,-33.60 +-96.00,-33.60,10.23,0.00,1.00,-100.80,-33.60 +-91.20,-33.60,10.27,0.00,1.00,-91.20,-33.60 +-86.40,-33.60,10.31,0.00,1.00,-81.60,-33.60 +-81.60,-33.60,10.35,0.00,1.00,-76.80,-33.60 +-76.80,-33.60,10.39,0.00,1.00,-67.20,-33.60 +-67.20,-28.80,10.43,0.00,1.00,-57.60,-28.80 +-62.40,-28.80,10.47,0.00,1.00,-52.80,-28.80 +-57.60,-28.80,10.51,0.00,1.00,-48.00,-28.80 +-52.80,-28.80,10.55,0.00,1.00,-38.40,-24.00 +-48.00,-24.00,10.59,0.00,1.00,-33.60,-24.00 +-43.20,-24.00,10.63,0.00,1.00,-28.80,-24.00 +-38.40,-19.20,10.67,0.00,1.00,-28.80,-19.20 +-33.60,-19.20,10.71,0.00,1.00,-24.00,-19.20 +-28.80,-19.20,10.75,0.00,1.00,-19.20,-14.40 +-24.00,-14.40,10.79,0.00,1.00,-14.40,-14.40 +-19.20,-14.40,10.83,0.00,1.00,-14.40,-9.60 +-14.40,-9.60,10.87,0.00,1.00,-9.60,-9.60 +-14.40,-9.60,10.91,0.00,1.00,-9.60,-4.80 +-9.60,-4.80,10.95,0.00,1.00,-4.80,-4.80 +-4.80,-4.80,10.99,0.00,1.00,-4.80,0.00 +0.00,0.00,11.03,0.00,1.00,0.00,0.00 +4.80,0.00,11.07,0.00,1.00,0.00,4.80 +9.60,4.80,11.11,0.00,1.00,4.80,4.80 +14.40,4.80,11.15,0.00,1.00,4.80,9.60 +19.20,9.60,11.19,0.00,1.00,9.60,9.60 +19.20,9.60,11.23,0.00,1.00,9.60,14.40 +24.00,14.40,11.27,0.00,1.00,14.40,14.40 +28.80,14.40,11.31,0.00,1.00,19.20,19.20 +33.60,14.40,11.35,0.00,1.00,19.20,19.20 +38.40,19.20,11.39,0.00,1.00,24.00,19.20 +43.20,19.20,11.43,0.00,1.00,28.80,24.00 +48.00,24.00,11.47,0.00,1.00,33.60,24.00 +52.80,24.00,11.51,0.00,1.00,38.40,24.00 +57.60,24.00,11.55,0.00,1.00,43.20,24.00 +62.40,24.00,11.59,0.00,1.00,48.00,28.80 +72.00,24.00,11.63,0.00,1.00,52.80,28.80 +76.80,28.80,11.67,0.00,1.00,62.40,28.80 +81.60,28.80,11.71,0.00,1.00,72.00,28.80 +86.40,28.80,11.75,0.00,1.00,81.60,28.80 +91.20,28.80,11.79,0.00,1.00,91.20,28.80 +96.00,28.80,11.83,0.00,1.00,100.80,28.80 +100.80,28.80,11.87,0.00,1.00,110.40,28.80 +105.60,28.80,11.91,0.00,1.00,120.00,28.80 +110.40,24.00,11.95,0.00,1.00,129.60,24.00 +120.00,24.00,11.99,0.00,1.00,134.40,24.00 +124.80,24.00,12.03,0.00,1.00,139.20,24.00 +129.60,24.00,12.07,0.00,1.00,144.00,24.00 +134.40,19.20,12.11,0.00,1.00,148.80,19.20 +139.20,19.20,12.15,0.00,1.00,153.60,19.20 +144.00,19.20,12.19,0.00,1.00,158.40,14.40 +148.80,14.40,12.23,0.00,1.00,163.20,14.40 +153.60,14.40,12.27,0.00,1.00,163.20,14.40 +158.40,9.60,12.31,0.00,1.00,168.00,9.60 +158.40,9.60,12.35,0.00,1.00,168.00,9.60 +163.20,9.60,12.39,0.00,1.00,172.80,4.80 +168.00,4.80,12.43,0.00,1.00,172.80,4.80 +172.80,4.80,12.47,0.00,1.00,177.60,0.00 +177.60,0.00,12.51,0.00,1.00,177.60,-0.00 +-177.60,-0.00,12.55,0.00,1.00,-177.60,-4.80 +-172.80,-4.80,12.59,0.00,1.00,-177.60,-4.80 +-168.00,-4.80,12.63,0.00,1.00,-172.80,-9.60 +-163.20,-9.60,12.67,0.00,1.00,-172.80,-9.60 +-158.40,-9.60,12.71,0.00,1.00,-168.00,-14.40 +-158.40,-9.60,12.75,0.00,1.00,-168.00,-14.40 +-153.60,-14.40,12.79,0.00,1.00,-163.20,-14.40 +-148.80,-14.40,12.83,0.00,1.00,-163.20,-19.20 +-144.00,-19.20,12.87,0.00,1.00,-158.40,-19.20 +-139.20,-19.20,12.91,0.00,1.00,-153.60,-24.00 +-134.40,-19.20,12.95,0.00,1.00,-148.80,-24.00 +-129.60,-24.00,12.99,0.00,1.00,-144.00,-24.00 +-124.80,-24.00,13.03,0.00,1.00,-139.20,-24.00 +-120.00,-24.00,13.07,0.00,1.00,-134.40,-28.80 +-110.40,-24.00,13.11,0.00,1.00,-129.60,-28.80 +-105.60,-28.80,13.15,0.00,1.00,-120.00,-28.80 +-100.80,-28.80,13.19,0.00,1.00,-110.40,-28.80 +-96.00,-28.80,13.23,0.00,1.00,-100.80,-28.80 +-91.20,-28.80,13.27,0.00,1.00,-91.20,-28.80 +-86.40,-28.80,13.31,0.00,1.00,-81.60,-28.80 +-81.60,-28.80,13.35,0.00,1.00,-72.00,-28.80 +-76.80,-28.80,13.39,0.00,1.00,-62.40,-28.80 +-72.00,-24.00,13.43,0.00,1.00,-52.80,-24.00 +-62.40,-24.00,13.47,0.00,1.00,-48.00,-24.00 +-57.60,-24.00,13.51,0.00,1.00,-43.20,-24.00 +-52.80,-24.00,13.55,0.00,1.00,-38.40,-24.00 +-48.00,-24.00,13.59,0.00,1.00,-33.60,-19.20 +-43.20,-19.20,13.63,0.00,1.00,-28.80,-19.20 +-38.40,-19.20,13.67,0.00,1.00,-24.00,-19.20 +-33.60,-14.40,13.71,0.00,1.00,-19.20,-14.40 +-28.80,-14.40,13.75,0.00,1.00,-19.20,-14.40 +-24.00,-14.40,13.79,0.00,1.00,-14.40,-9.60 +-19.20,-9.60,13.83,0.00,1.00,-9.60,-9.60 +-19.20,-9.60,13.87,0.00,1.00,-9.60,-4.80 +-14.40,-4.80,13.91,0.00,1.00,-4.80,-4.80 +-9.60,-4.80,13.95,0.00,1.00,-4.80,-0.00 +-4.80,-0.00,13.99,0.00,1.00,-0.00,0.00 +0.00,0.00,14.04,0.00,1.00,0.00,0.00 +4.80,0.00,14.08,0.00,1.00,0.00,4.80 +9.60,4.80,14.12,0.00,1.00,4.80,4.80 +14.40,4.80,14.16,0.00,1.00,4.80,9.60 +19.20,9.60,14.20,0.00,1.00,9.60,9.60 +24.00,9.60,14.24,0.00,1.00,9.60,9.60 +28.80,9.60,14.28,0.00,1.00,14.40,14.40 +33.60,14.40,14.32,0.00,1.00,14.40,14.40 +38.40,14.40,14.36,0.00,1.00,19.20,14.40 +43.20,14.40,14.40,0.00,1.00,19.20,19.20 +48.00,14.40,14.44,0.00,1.00,24.00,19.20 +52.80,19.20,14.48,0.00,1.00,28.80,19.20 +57.60,19.20,14.52,0.00,1.00,33.60,19.20 +62.40,19.20,14.56,0.00,1.00,38.40,24.00 +67.20,19.20,14.60,0.00,1.00,43.20,24.00 +72.00,24.00,14.64,0.00,1.00,48.00,24.00 +76.80,24.00,14.68,0.00,1.00,57.60,24.00 +81.60,24.00,14.72,0.00,1.00,67.20,24.00 +86.40,24.00,14.76,0.00,1.00,81.60,24.00 +91.20,24.00,14.80,0.00,1.00,91.20,24.00 +96.00,24.00,14.84,0.00,1.00,105.60,24.00 +100.80,24.00,14.88,0.00,1.00,115.20,24.00 +105.60,24.00,14.92,0.00,1.00,124.80,24.00 +110.40,19.20,14.96,0.00,1.00,134.40,19.20 +115.20,19.20,15.00,0.00,1.00,139.20,19.20 +120.00,19.20,15.04,0.00,1.00,144.00,19.20 +124.80,19.20,15.08,0.00,1.00,148.80,19.20 +129.60,19.20,15.12,0.00,1.00,153.60,19.20 +134.40,14.40,15.16,0.00,1.00,158.40,14.40 +139.20,14.40,15.20,0.00,1.00,163.20,14.40 +144.00,14.40,15.24,0.00,1.00,163.20,14.40 +148.80,9.60,15.28,0.00,1.00,168.00,9.60 +153.60,9.60,15.32,0.00,1.00,168.00,9.60 +158.40,9.60,15.36,0.00,1.00,172.80,4.80 +163.20,4.80,15.40,0.00,1.00,172.80,4.80 +168.00,4.80,15.44,0.00,1.00,177.60,4.80 +172.80,4.80,15.48,0.00,1.00,177.60,0.00 +177.60,0.00,15.52,0.00,1.00,177.60,-0.00 +-177.60,-0.00,15.56,0.00,1.00,-177.60,-4.80 +-172.80,-4.80,15.60,0.00,1.00,-177.60,-4.80 +-168.00,-4.80,15.64,0.00,1.00,-177.60,-4.80 +-163.20,-4.80,15.68,0.00,1.00,-172.80,-9.60 +-158.40,-9.60,15.72,0.00,1.00,-172.80,-9.60 +-153.60,-9.60,15.76,0.00,1.00,-168.00,-14.40 +-148.80,-9.60,15.80,0.00,1.00,-168.00,-14.40 +-144.00,-14.40,15.84,0.00,1.00,-163.20,-14.40 +-139.20,-14.40,15.88,0.00,1.00,-163.20,-19.20 +-134.40,-14.40,15.92,0.00,1.00,-158.40,-19.20 +-129.60,-19.20,15.96,0.00,1.00,-153.60,-19.20 +-124.80,-19.20,16.00,0.00,1.00,-148.80,-19.20 +-120.00,-19.20,16.00,0.00,1.00,-144.00,-19.20 +-115.20,-19.20,15.96,0.00,1.00,-139.20,-24.00 +-110.40,-19.20,15.92,0.00,1.00,-134.40,-24.00 +-105.60,-24.00,15.88,0.00,1.00,-124.80,-24.00 +-100.80,-24.00,15.84,0.00,1.00,-115.20,-24.00 +-96.00,-24.00,15.80,0.00,1.00,-105.60,-24.00 +-91.20,-24.00,15.76,0.00,1.00,-91.20,-24.00 +-86.40,-24.00,15.72,0.00,1.00,-81.60,-24.00 +-81.60,-24.00,15.68,0.00,1.00,-67.20,-24.00 +-76.80,-24.00,15.64,0.00,1.00,-57.60,-24.00 +-72.00,-24.00,15.60,0.00,1.00,-48.00,-24.00 +-67.20,-19.20,15.56,0.00,1.00,-43.20,-19.20 +-62.40,-19.20,15.52,0.00,1.00,-38.40,-19.20 +-57.60,-19.20,15.48,0.00,1.00,-33.60,-19.20 +-52.80,-19.20,15.44,0.00,1.00,-28.80,-19.20 +-48.00,-14.40,15.40,0.00,1.00,-24.00,-14.40 +-43.20,-14.40,15.36,0.00,1.00,-19.20,-14.40 +-38.40,-14.40,15.32,0.00,1.00,-19.20,-14.40 +-33.60,-14.40,15.28,0.00,1.00,-14.40,-9.60 +-28.80,-9.60,15.24,0.00,1.00,-14.40,-9.60 +-24.00,-9.60,15.20,0.00,1.00,-9.60,-9.60 +-19.20,-9.60,15.16,0.00,1.00,-9.60,-4.80 +-14.40,-4.80,15.12,0.00,1.00,-4.80,-4.80 +-9.60,-4.80,15.08,0.00,1.00,-4.80,-0.00 +-4.80,-0.00,15.04,0.00,1.00,-0.00,0.00 +0.00,0.00,15.00,0.00,1.00,0.00,0.00 +4.80,0.00,14.96,0.00,1.00,0.00,4.80 +9.60,4.80,14.92,0.00,1.00,4.80,4.80 +14.40,4.80,14.88,0.00,1.00,4.80,4.80 +19.20,4.80,14.84,0.00,1.00,4.80,9.60 +24.00,9.60,14.80,0.00,1.00,9.60,9.60 +28.80,9.60,14.76,0.00,1.00,9.60,9.60 +33.60,9.60,14.72,0.00,1.00,9.60,9.60 +38.40,9.60,14.68,0.00,1.00,14.40,14.40 +43.20,14.40,14.64,0.00,1.00,14.40,14.40 +48.00,14.40,14.60,0.00,1.00,19.20,14.40 +52.80,14.40,14.56,0.00,1.00,24.00,14.40 +57.60,14.40,14.52,0.00,1.00,24.00,19.20 +62.40,14.40,14.48,0.00,1.00,28.80,19.20 +67.20,14.40,14.44,0.00,1.00,38.40,19.20 +72.00,19.20,14.40,0.00,1.00,43.20,19.20 +76.80,19.20,14.36,0.00,1.00,52.80,19.20 +81.60,19.20,14.32,0.00,1.00,62.40,19.20 +86.40,19.20,14.28,0.00,1.00,76.80,19.20 +91.20,19.20,14.24,0.00,1.00,96.00,19.20 +96.00,19.20,14.20,0.00,1.00,110.40,19.20 +100.80,19.20,14.16,0.00,1.00,120.00,19.20 +105.60,19.20,14.12,0.00,1.00,134.40,19.20 +110.40,19.20,14.08,0.00,1.00,139.20,19.20 +115.20,14.40,14.04,0.00,1.00,148.80,14.40 +120.00,14.40,13.99,0.00,1.00,153.60,14.40 +124.80,14.40,13.95,0.00,1.00,158.40,14.40 +129.60,14.40,13.91,0.00,1.00,158.40,14.40 +134.40,14.40,13.87,0.00,1.00,163.20,14.40 +139.20,9.60,13.83,0.00,1.00,163.20,9.60 +144.00,9.60,13.79,0.00,1.00,168.00,9.60 +148.80,9.60,13.75,0.00,1.00,168.00,9.60 +153.60,9.60,13.71,0.00,1.00,172.80,4.80 +158.40,4.80,13.67,0.00,1.00,172.80,4.80 +163.20,4.80,13.63,0.00,1.00,172.80,4.80 +168.00,4.80,13.59,0.00,1.00,177.60,0.00 +172.80,0.00,13.55,0.00,1.00,177.60,0.00 +177.60,0.00,13.51,0.00,1.00,177.60,-0.00 +-177.60,-0.00,13.47,0.00,1.00,-177.60,-0.00 +-172.80,-0.00,13.43,0.00,1.00,-177.60,-4.80 +-168.00,-4.80,13.39,0.00,1.00,-177.60,-4.80 +-163.20,-4.80,13.35,0.00,1.00,-172.80,-4.80 +-158.40,-4.80,13.31,0.00,1.00,-172.80,-9.60 +-153.60,-9.60,13.27,0.00,1.00,-172.80,-9.60 +-148.80,-9.60,13.23,0.00,1.00,-168.00,-9.60 +-144.00,-9.60,13.19,0.00,1.00,-168.00,-14.40 +-139.20,-9.60,13.15,0.00,1.00,-163.20,-14.40 +-134.40,-14.40,13.11,0.00,1.00,-163.20,-14.40 +-129.60,-14.40,13.07,0.00,1.00,-158.40,-14.40 +-124.80,-14.40,13.03,0.00,1.00,-158.40,-14.40 +-120.00,-14.40,12.99,0.00,1.00,-153.60,-19.20 +-115.20,-14.40,12.95,0.00,1.00,-148.80,-19.20 +-110.40,-19.20,12.91,0.00,1.00,-139.20,-19.20 +-105.60,-19.20,12.87,0.00,1.00,-134.40,-19.20 +-100.80,-19.20,12.83,0.00,1.00,-120.00,-19.20 +-96.00,-19.20,12.79,0.00,1.00,-110.40,-19.20 +-91.20,-19.20,12.75,0.00,1.00,-96.00,-19.20 +-86.40,-19.20,12.71,0.00,1.00,-76.80,-19.20 +-81.60,-19.20,12.67,0.00,1.00,-62.40,-19.20 +-76.80,-19.20,12.63,0.00,1.00,-52.80,-19.20 +-72.00,-19.20,12.59,0.00,1.00,-43.20,-19.20 +-67.20,-14.40,12.55,0.00,1.00,-38.40,-19.20 +-62.40,-14.40,12.51,0.00,1.00,-28.80,-14.40 +-57.60,-14.40,12.47,0.00,1.00,-24.00,-14.40 +-52.80,-14.40,12.43,0.00,1.00,-24.00,-14.40 +-48.00,-14.40,12.39,0.00,1.00,-19.20,-14.40 +-43.20,-14.40,12.35,0.00,1.00,-14.40,-9.60 +-38.40,-9.60,12.31,0.00,1.00,-14.40,-9.60 +-33.60,-9.60,12.27,0.00,1.00,-9.60,-9.60 +-28.80,-9.60,12.23,0.00,1.00,-9.60,-9.60 +-24.00,-9.60,12.19,0.00,1.00,-9.60,-4.80 +-19.20,-4.80,12.15,0.00,1.00,-4.80,-4.80 +-14.40,-4.80,12.11,0.00,1.00,-4.80,-4.80 +-9.60,-4.80,12.07,0.00,1.00,-4.80,-0.00 +-4.80,-0.00,12.03,0.00,1.00,-0.00,0.00 +0.00,0.00,11.99,0.00,1.00,0.00,0.00 +4.80,0.00,11.95,0.00,1.00,0.00,0.00 +9.60,0.00,11.91,0.00,1.00,0.00,4.80 +14.40,4.80,11.87,0.00,1.00,4.80,4.80 +19.20,4.80,11.83,0.00,1.00,4.80,4.80 +24.00,4.80,11.79,0.00,1.00,4.80,4.80 +28.80,4.80,11.75,0.00,1.00,4.80,9.60 +33.60,9.60,11.71,0.00,1.00,9.60,9.60 +38.40,9.60,11.67,0.00,1.00,9.60,9.60 +43.20,9.60,11.63,0.00,1.00,14.40,9.60 +48.00,9.60,11.59,0.00,1.00,14.40,9.60 +52.80,9.60,11.55,0.00,1.00,14.40,14.40 +57.60,9.60,11.51,0.00,1.00,19.20,14.40 +62.40,9.60,11.47,0.00,1.00,24.00,14.40 +67.20,14.40,11.43,0.00,1.00,28.80,14.40 +72.00,14.40,11.39,0.00,1.00,33.60,14.40 +76.80,14.40,11.35,0.00,1.00,43.20,14.40 +81.60,14.40,11.31,0.00,1.00,57.60,14.40 +86.40,14.40,11.27,0.00,1.00,76.80,14.40 +91.20,14.40,11.23,0.00,1.00,96.00,14.40 +96.00,14.40,11.19,0.00,1.00,115.20,14.40 +100.80,14.40,11.15,0.00,1.00,129.60,14.40 +105.60,14.40,11.11,0.00,1.00,139.20,14.40 +110.40,14.40,11.07,0.00,1.00,148.80,14.40 +115.20,9.60,11.03,0.00,1.00,153.60,14.40 +120.00,9.60,10.99,0.00,1.00,158.40,9.60 +124.80,9.60,10.95,0.00,1.00,163.20,9.60 +129.60,9.60,10.91,0.00,1.00,163.20,9.60 +134.40,9.60,10.87,0.00,1.00,168.00,9.60 +139.20,9.60,10.83,0.00,1.00,168.00,9.60 +144.00,9.60,10.79,0.00,1.00,172.80,9.60 +148.80,4.80,10.75,0.00,1.00,172.80,4.80 +153.60,4.80,10.71,0.00,1.00,172.80,4.80 +158.40,4.80,10.67,0.00,1.00,172.80,4.80 +163.20,4.80,10.63,0.00,1.00,177.60,4.80 +168.00,4.80,10.59,0.00,1.00,177.60,0.00 +172.80,0.00,10.55,0.00,1.00,177.60,0.00 +177.60,0.00,10.51,0.00,1.00,177.60,-0.00 +-177.60,-0.00,10.47,0.00,1.00,-177.60,-0.00 +-172.80,-0.00,10.43,0.00,1.00,-177.60,-4.80 +-168.00,-4.80,10.39,0.00,1.00,-177.60,-4.80 +-163.20,-4.80,10.35,0.00,1.00,-177.60,-4.80 +-158.40,-4.80,10.31,0.00,1.00,-172.80,-4.80 +-153.60,-4.80,10.27,0.00,1.00,-172.80,-9.60 +-148.80,-4.80,10.23,0.00,1.00,-172.80,-9.60 +-144.00,-9.60,10.19,0.00,1.00,-172.80,-9.60 +-139.20,-9.60,10.15,0.00,1.00,-168.00,-9.60 +-134.40,-9.60,10.11,0.00,1.00,-168.00,-9.60 +-129.60,-9.60,10.07,0.00,1.00,-163.20,-9.60 +-124.80,-9.60,10.03,0.00,1.00,-163.20,-14.40 +-120.00,-9.60,9.98,0.00,1.00,-158.40,-14.40 +-115.20,-9.60,9.94,0.00,1.00,-153.60,-14.40 +-110.40,-14.40,9.90,0.00,1.00,-148.80,-14.40 +-105.60,-14.40,9.86,0.00,1.00,-139.20,-14.40 +-100.80,-14.40,9.82,0.00,1.00,-129.60,-14.40 +-96.00,-14.40,9.78,0.00,1.00,-115.20,-14.40 +-91.20,-14.40,9.74,0.00,1.00,-96.00,-14.40 +-86.40,-14.40,9.70,0.00,1.00,-76.80,-14.40 +-81.60,-14.40,9.66,0.00,1.00,-57.60,-14.40 +-76.80,-14.40,9.62,0.00,1.00,-43.20,-14.40 +-72.00,-14.40,9.58,0.00,1.00,-33.60,-14.40 +-67.20,-14.40,9.54,0.00,1.00,-28.80,-14.40 +-62.40,-9.60,9.50,0.00,1.00,-24.00,-14.40 +-57.60,-9.60,9.46,0.00,1.00,-19.20,-9.60 +-52.80,-9.60,9.42,0.00,1.00,-14.40,-9.60 +-48.00,-9.60,9.38,0.00,1.00,-14.40,-9.60 +-43.20,-9.60,9.34,0.00,1.00,-14.40,-9.60 +-38.40,-9.60,9.30,0.00,1.00,-9.60,-9.60 +-33.60,-9.60,9.26,0.00,1.00,-9.60,-4.80 +-28.80,-4.80,9.22,0.00,1.00,-4.80,-4.80 +-24.00,-4.80,9.18,0.00,1.00,-4.80,-4.80 +-19.20,-4.80,9.14,0.00,1.00,-4.80,-4.80 +-14.40,-4.80,9.10,0.00,1.00,-4.80,-0.00 +-9.60,-0.00,9.06,0.00,1.00,-0.00,-0.00 +-4.80,-0.00,9.02,0.00,1.00,-0.00,0.00 +0.00,0.00,8.98,0.00,1.00,0.00,0.00 +4.80,0.00,8.94,0.00,1.00,0.00,0.00 +9.60,0.00,8.90,0.00,1.00,0.00,0.00 +14.40,0.00,8.86,0.00,1.00,0.00,4.80 +19.20,4.80,8.82,0.00,1.00,4.80,4.80 +24.00,4.80,8.78,0.00,1.00,4.80,4.80 +28.80,4.80,8.74,0.00,1.00,4.80,4.80 +33.60,4.80,8.70,0.00,1.00,4.80,4.80 +38.40,4.80,8.66,0.00,1.00,4.80,4.80 +43.20,4.80,8.62,0.00,1.00,9.60,4.80 +48.00,4.80,8.58,0.00,1.00,9.60,9.60 +52.80,4.80,8.54,0.00,1.00,9.60,9.60 +57.60,4.80,8.50,0.00,1.00,14.40,9.60 +62.40,9.60,8.46,0.00,1.00,14.40,9.60 +67.20,9.60,8.42,0.00,1.00,19.20,9.60 +72.00,9.60,8.38,0.00,1.00,24.00,9.60 +76.80,9.60,8.34,0.00,1.00,33.60,9.60 +81.60,9.60,8.30,0.00,1.00,43.20,9.60 +86.40,9.60,8.26,0.00,1.00,67.20,9.60 +91.20,9.60,8.22,0.00,1.00,96.00,9.60 +96.00,9.60,8.18,0.00,1.00,124.80,9.60 +100.80,9.60,8.14,0.00,1.00,144.00,9.60 +105.60,9.60,8.10,0.00,1.00,153.60,9.60 +110.40,9.60,8.06,0.00,1.00,158.40,9.60 +115.20,9.60,8.02,0.00,1.00,163.20,9.60 +120.00,9.60,7.98,0.00,1.00,168.00,9.60 +124.80,4.80,7.94,0.00,1.00,168.00,9.60 +129.60,4.80,7.90,0.00,1.00,168.00,4.80 +134.40,4.80,7.86,0.00,1.00,172.80,4.80 +139.20,4.80,7.82,0.00,1.00,172.80,4.80 +144.00,4.80,7.78,0.00,1.00,172.80,4.80 +148.80,4.80,7.74,0.00,1.00,172.80,4.80 +153.60,4.80,7.70,0.00,1.00,177.60,4.80 +158.40,4.80,7.66,0.00,1.00,177.60,4.80 +163.20,4.80,7.62,0.00,1.00,177.60,0.00 +168.00,0.00,7.58,0.00,1.00,177.60,0.00 +172.80,0.00,7.54,0.00,1.00,177.60,0.00 +177.60,0.00,7.50,0.00,1.00,177.60,-0.00 +-177.60,-0.00,7.46,0.00,1.00,-177.60,-0.00 +-172.80,-0.00,7.42,0.00,1.00,-177.60,-0.00 +-168.00,-0.00,7.38,0.00,1.00,-177.60,-4.80 +-163.20,-4.80,7.34,0.00,1.00,-177.60,-4.80 +-158.40,-4.80,7.30,0.00,1.00,-177.60,-4.80 +-153.60,-4.80,7.26,0.00,1.00,-177.60,-4.80 +-148.80,-4.80,7.22,0.00,1.00,-172.80,-4.80 +-144.00,-4.80,7.18,0.00,1.00,-172.80,-4.80 +-139.20,-4.80,7.14,0.00,1.00,-172.80,-4.80 +-134.40,-4.80,7.10,0.00,1.00,-172.80,-9.60 +-129.60,-4.80,7.06,0.00,1.00,-168.00,-9.60 +-124.80,-4.80,7.02,0.00,1.00,-168.00,-9.60 +-120.00,-9.60,6.98,0.00,1.00,-168.00,-9.60 +-115.20,-9.60,6.94,0.00,1.00,-163.20,-9.60 +-110.40,-9.60,6.90,0.00,1.00,-158.40,-9.60 +-105.60,-9.60,6.86,0.00,1.00,-153.60,-9.60 +-100.80,-9.60,6.82,0.00,1.00,-144.00,-9.60 +-96.00,-9.60,6.78,0.00,1.00,-124.80,-9.60 +-91.20,-9.60,6.74,0.00,1.00,-96.00,-9.60 +-86.40,-9.60,6.70,0.00,1.00,-67.20,-9.60 +-81.60,-9.60,6.66,0.00,1.00,-43.20,-9.60 +-76.80,-9.60,6.62,0.00,1.00,-33.60,-9.60 +-72.00,-9.60,6.58,0.00,1.00,-24.00,-9.60 +-67.20,-9.60,6.54,0.00,1.00,-19.20,-9.60 +-62.40,-9.60,6.50,0.00,1.00,-14.40,-9.60 +-57.60,-4.80,6.46,0.00,1.00,-14.40,-9.60 +-52.80,-4.80,6.42,0.00,1.00,-9.60,-4.80 +-48.00,-4.80,6.38,0.00,1.00,-9.60,-4.80 +-43.20,-4.80,6.34,0.00,1.00,-9.60,-4.80 +-38.40,-4.80,6.30,0.00,1.00,-4.80,-4.80 +-33.60,-4.80,6.26,0.00,1.00,-4.80,-4.80 +-28.80,-4.80,6.22,0.00,1.00,-4.80,-4.80 +-24.00,-4.80,6.18,0.00,1.00,-4.80,-4.80 +-19.20,-4.80,6.14,0.00,1.00,-4.80,-0.00 +-14.40,-0.00,6.10,0.00,1.00,-0.00,-0.00 +-9.60,-0.00,6.06,0.00,1.00,-0.00,-0.00 +-4.80,-0.00,6.02,0.00,1.00,-0.00,0.00 +0.00,0.00,5.97,0.00,1.00,0.00,0.00 +4.80,0.00,5.93,0.00,1.00,0.00,0.00 +9.60,0.00,5.89,0.00,1.00,0.00,0.00 +14.40,0.00,5.85,0.00,1.00,0.00,0.00 +19.20,0.00,5.81,0.00,1.00,0.00,0.00 +24.00,0.00,5.77,0.00,1.00,0.00,0.00 +28.80,0.00,5.73,0.00,1.00,0.00,4.80 +33.60,0.00,5.69,0.00,1.00,0.00,4.80 +38.40,0.00,5.65,0.00,1.00,4.80,4.80 +43.20,4.80,5.61,0.00,1.00,4.80,4.80 +48.00,4.80,5.57,0.00,1.00,4.80,4.80 +52.80,4.80,5.53,0.00,1.00,4.80,4.80 +57.60,4.80,5.49,0.00,1.00,4.80,4.80 +62.40,4.80,5.45,0.00,1.00,4.80,4.80 +67.20,4.80,5.41,0.00,1.00,9.60,4.80 +72.00,4.80,5.37,0.00,1.00,9.60,4.80 +76.80,4.80,5.33,0.00,1.00,14.40,4.80 +81.60,4.80,5.29,0.00,1.00,24.00,4.80 +86.40,4.80,5.25,0.00,1.00,43.20,4.80 +91.20,4.80,5.21,0.00,1.00,110.40,4.80 +96.00,4.80,5.17,0.00,1.00,148.80,4.80 +100.80,4.80,5.13,0.00,1.00,163.20,4.80 +105.60,4.80,5.09,0.00,1.00,168.00,4.80 +110.40,4.80,5.05,0.00,1.00,172.80,4.80 +115.20,4.80,5.01,0.00,1.00,172.80,4.80 +120.00,4.80,4.97,0.00,1.00,172.80,4.80 +124.80,4.80,4.93,0.00,1.00,172.80,4.80 +129.60,4.80,4.89,0.00,1.00,177.60,4.80 +134.40,4.80,4.85,0.00,1.00,177.60,4.80 +139.20,0.00,4.81,0.00,1.00,177.60,4.80 +144.00,0.00,4.77,0.00,1.00,177.60,4.80 +148.80,0.00,4.73,0.00,1.00,177.60,0.00 +153.60,0.00,4.69,0.00,1.00,177.60,0.00 +158.40,0.00,4.65,0.00,1.00,177.60,0.00 +163.20,0.00,4.61,0.00,1.00,177.60,0.00 +168.00,0.00,4.57,0.00,1.00,177.60,0.00 +172.80,0.00,4.53,0.00,1.00,177.60,0.00 +177.60,0.00,4.49,0.00,1.00,177.60,-0.00 +-177.60,-0.00,4.45,0.00,1.00,-177.60,-0.00 +-172.80,-0.00,4.41,0.00,1.00,-177.60,-0.00 +-168.00,-0.00,4.37,0.00,1.00,-177.60,-0.00 +-163.20,-0.00,4.33,0.00,1.00,-177.60,-0.00 +-158.40,-0.00,4.29,0.00,1.00,-177.60,-0.00 +-153.60,-0.00,4.25,0.00,1.00,-177.60,-4.80 +-148.80,-0.00,4.21,0.00,1.00,-177.60,-4.80 +-144.00,-0.00,4.17,0.00,1.00,-177.60,-4.80 +-139.20,-0.00,4.13,0.00,1.00,-177.60,-4.80 +-134.40,-4.80,4.09,0.00,1.00,-177.60,-4.80 +-129.60,-4.80,4.05,0.00,1.00,-177.60,-4.80 +-124.80,-4.80,4.01,0.00,1.00,-172.80,-4.80 +-120.00,-4.80,3.97,0.00,1.00,-172.80,-4.80 +-115.20,-4.80,3.93,0.00,1.00,-172.80,-4.80 +-110.40,-4.80,3.89,0.00,1.00,-172.80,-4.80 +-105.60,-4.80,3.85,0.00,1.00,-168.00,-4.80 +-100.80,-4.80,3.81,0.00,1.00,-163.20,-4.80 +-96.00,-4.80,3.77,0.00,1.00,-148.80,-4.80 +-91.20,-4.80,3.73,0.00,1.00,-110.40,-4.80 +-86.40,-4.80,3.69,0.00,1.00,-43.20,-4.80 +-81.60,-4.80,3.65,0.00,1.00,-24.00,-4.80 +-76.80,-4.80,3.61,0.00,1.00,-14.40,-4.80 +-72.00,-4.80,3.57,0.00,1.00,-9.60,-4.80 +-67.20,-4.80,3.53,0.00,1.00,-9.60,-4.80 +-62.40,-4.80,3.49,0.00,1.00,-4.80,-4.80 +-57.60,-4.80,3.45,0.00,1.00,-4.80,-4.80 +-52.80,-4.80,3.41,0.00,1.00,-4.80,-4.80 +-48.00,-4.80,3.37,0.00,1.00,-4.80,-4.80 +-43.20,-4.80,3.33,0.00,1.00,-4.80,-4.80 +-38.40,-0.00,3.29,0.00,1.00,-4.80,-4.80 +-33.60,-0.00,3.25,0.00,1.00,-0.00,-0.00 +-28.80,-0.00,3.21,0.00,1.00,-0.00,-0.00 +-24.00,-0.00,3.17,0.00,1.00,-0.00,-0.00 +-19.20,-0.00,3.13,0.00,1.00,-0.00,-0.00 +-14.40,-0.00,3.09,0.00,1.00,-0.00,-0.00 +-9.60,-0.00,3.05,0.00,1.00,-0.00,-0.00 +-4.80,-0.00,3.01,0.00,1.00,-0.00,0.00 +0.00,0.00,2.97,0.00,1.00,-0.00,0.00 +4.80,-0.00,2.93,0.00,1.00,-0.00,0.00 +9.60,-0.00,2.89,0.00,1.00,-0.00,0.00 +14.40,-0.00,2.85,0.00,1.00,-0.00,0.00 +19.20,-0.00,2.81,0.00,1.00,-0.00,0.00 +24.00,-0.00,2.77,0.00,1.00,-0.00,0.00 +28.80,-0.00,2.73,0.00,1.00,-0.00,0.00 +33.60,-0.00,2.69,0.00,1.00,-0.00,0.00 +38.40,-0.00,2.65,0.00,1.00,-0.00,0.00 +43.20,-0.00,2.61,0.00,1.00,-0.00,0.00 +48.00,-0.00,2.57,0.00,1.00,-0.00,0.00 +52.80,-0.00,2.53,0.00,1.00,-0.00,0.00 +57.60,-0.00,2.49,0.00,1.00,-0.00,0.00 +62.40,-0.00,2.45,0.00,1.00,-0.00,0.00 +67.20,-0.00,2.41,0.00,1.00,-4.80,0.00 +72.00,-0.00,2.37,0.00,1.00,-4.80,0.00 +76.80,-0.00,2.33,0.00,1.00,-4.80,0.00 +81.60,-0.00,2.29,0.00,1.00,-9.60,0.00 +86.40,-0.00,2.25,0.00,1.00,-19.20,0.00 +91.20,-0.00,2.21,0.00,1.00,-134.40,0.00 +96.00,-0.00,2.17,0.00,1.00,-168.00,0.00 +100.80,-0.00,2.13,0.00,1.00,-172.80,0.00 +105.60,-0.00,2.09,0.00,1.00,-177.60,0.00 +110.40,-0.00,2.05,0.00,1.00,-177.60,0.00 +115.20,-0.00,2.01,0.00,1.00,-177.60,0.00 +120.00,-0.00,1.96,0.00,1.00,-177.60,0.00 +124.80,-0.00,1.92,0.00,1.00,-177.60,0.00 +129.60,-0.00,1.88,0.00,1.00,-177.60,0.00 +134.40,-0.00,1.84,0.00,1.00,-177.60,0.00 +139.20,-0.00,1.80,0.00,1.00,-177.60,0.00 +144.00,-0.00,1.76,0.00,1.00,-177.60,0.00 +148.80,-0.00,1.72,0.00,1.00,-177.60,0.00 +153.60,-0.00,1.68,0.00,1.00,-177.60,0.00 +158.40,-0.00,1.64,0.00,1.00,-177.60,0.00 +163.20,-0.00,1.60,0.00,1.00,-177.60,0.00 +168.00,-0.00,1.56,0.00,1.00,-177.60,0.00 +172.80,-0.00,1.52,0.00,1.00,-177.60,0.00 +177.60,-0.00,1.48,0.00,1.00,-177.60,0.00 +-177.60,0.00,1.44,0.00,1.00,177.60,0.00 +-172.80,0.00,1.40,0.00,1.00,177.60,0.00 +-168.00,0.00,1.36,0.00,1.00,177.60,0.00 +-163.20,0.00,1.32,0.00,1.00,177.60,0.00 +-158.40,0.00,1.28,0.00,1.00,177.60,0.00 +-153.60,0.00,1.24,0.00,1.00,177.60,0.00 +-148.80,0.00,1.20,0.00,1.00,177.60,0.00 +-144.00,0.00,1.16,0.00,1.00,177.60,0.00 +-139.20,0.00,1.12,0.00,1.00,177.60,0.00 +-134.40,0.00,1.08,0.00,1.00,177.60,0.00 +-129.60,0.00,1.04,0.00,1.00,177.60,0.00 +-124.80,0.00,1.00,0.00,1.00,177.60,0.00 +-120.00,0.00,0.96,0.00,1.00,177.60,0.00 +-115.20,0.00,0.92,0.00,1.00,177.60,0.00 +-110.40,0.00,0.88,0.00,1.00,177.60,0.00 +-105.60,0.00,0.84,0.00,1.00,177.60,0.00 +-100.80,0.00,0.80,0.00,1.00,172.80,0.00 +-96.00,0.00,0.76,0.00,1.00,168.00,0.00 +-91.20,0.00,0.72,0.00,1.00,134.40,0.00 +-86.40,0.00,0.68,0.00,1.00,19.20,0.00 +-81.60,0.00,0.64,0.00,1.00,9.60,0.00 +-76.80,0.00,0.60,0.00,1.00,4.80,0.00 +-72.00,0.00,0.56,0.00,1.00,4.80,0.00 +-67.20,0.00,0.52,0.00,1.00,4.80,0.00 +-62.40,0.00,0.48,0.00,1.00,0.00,0.00 +-57.60,0.00,0.44,0.00,1.00,0.00,0.00 +-52.80,0.00,0.40,0.00,1.00,0.00,0.00 +-48.00,0.00,0.36,0.00,1.00,0.00,0.00 +-43.20,0.00,0.32,0.00,1.00,0.00,0.00 +-38.40,0.00,0.28,0.00,1.00,0.00,0.00 +-33.60,0.00,0.24,0.00,1.00,0.00,0.00 +-28.80,0.00,0.20,0.00,1.00,0.00,0.00 +-24.00,0.00,0.16,0.00,1.00,0.00,0.00 +-19.20,0.00,0.12,0.00,1.00,0.00,0.00 +-14.40,0.00,0.08,0.00,1.00,0.00,0.00 +-9.60,0.00,0.04,0.00,1.00,0.00,0.00 +-4.80,0.00,0.00,0.00,1.00,0.00,0.00 diff --git a/scripts/testv/stvST16c.pcm b/scripts/testv/stvST16c.pcm deleted file mode 100644 index 2065162444609c00aed3e82b37f5709d85a97e5c..0000000000000000000000000000000000000000 --- a/scripts/testv/stvST16c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d6c807c28b5db494240b4b8cc574c73a97c2bc3dabc2089bbfa9dd24fe28a89a -size 1280004 diff --git a/scripts/testv/stvST16c.wav b/scripts/testv/stvST16c.wav new file mode 100644 index 0000000000000000000000000000000000000000..3fb9ec0b3b9f55a2fe252aa805fe91be2a6b3ae4 --- /dev/null +++ b/scripts/testv/stvST16c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11a2f5887fe2407df03128634188d8aef6d3f76b52db14a1f834dbb98b7dd52e +size 1280048 diff --git a/scripts/testv/stvST16n.pcm b/scripts/testv/stvST16n.pcm deleted file mode 100644 index e9dee06322830d0faac4e61a9d93755a7ab51fab..0000000000000000000000000000000000000000 --- a/scripts/testv/stvST16n.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:937241850c1092ca3d847a72bd2b319e8e731194ac83215e7590b29ed66f2fbd -size 1241604 diff --git a/scripts/testv/stvST16n.wav b/scripts/testv/stvST16n.wav new file mode 100644 index 0000000000000000000000000000000000000000..74c80dca9338eef9496975640b25d820ef5331cc --- /dev/null +++ b/scripts/testv/stvST16n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60a8cfa5abf4e052840fea0054fec5331465149747fd7bc7eadab18b62d864f1 +size 1241648 diff --git a/scripts/testv/stvST32c.pcm b/scripts/testv/stvST32c.pcm deleted file mode 100644 index 2c7229c3697ed5d2f7359f523deb5350d557347f..0000000000000000000000000000000000000000 --- a/scripts/testv/stvST32c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c6ec344a0e1b84090e7d2ad712c1d2b5f1685eb4d6b3d09f89660e926149fb3c -size 2560000 diff --git a/scripts/testv/stvST32c.wav b/scripts/testv/stvST32c.wav new file mode 100644 index 0000000000000000000000000000000000000000..68a4a1fa334a85b2a3b6a2802b7fcc5f5b8b39e1 --- /dev/null +++ b/scripts/testv/stvST32c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1182294e7c3ba44e854219698e6a3c209e24345ab2e5e4296fce38029324f374 +size 2560044 diff --git a/scripts/testv/stvST32n.pcm b/scripts/testv/stvST32n.pcm deleted file mode 100644 index fc9c266af602588921ffde5782b969a512e1ee81..0000000000000000000000000000000000000000 --- a/scripts/testv/stvST32n.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:157369cc45a4667262983e4afcfe29c307ba674d36daf0ef8d1a1e71c0551d32 -size 2483200 diff --git a/scripts/testv/stvST32n.wav b/scripts/testv/stvST32n.wav new file mode 100644 index 0000000000000000000000000000000000000000..7da590907d62a9df209f90d5b4b18692f1342f83 --- /dev/null +++ b/scripts/testv/stvST32n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6edbfd26681fa42f377891761ad79f97029a3380bc644e47bff1803c7904ff9 +size 2483244 diff --git a/scripts/testv/stvST48c.pcm b/scripts/testv/stvST48c.pcm deleted file mode 100644 index d12de42a45cc52ef6a0649c0a6dbaf671ab2f6e2..0000000000000000000000000000000000000000 --- a/scripts/testv/stvST48c.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:594b7e2f24baa73faa8628eede30706f409966c3e535cf0705217843b07e30ef -size 3840000 diff --git a/scripts/testv/stvST48c.wav b/scripts/testv/stvST48c.wav new file mode 100644 index 0000000000000000000000000000000000000000..df554e65210845892f2c72bc2da025f5e5cbfb39 --- /dev/null +++ b/scripts/testv/stvST48c.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40929eb3eb266ed78c16daa2a9c987745fe8e005a577f2dd81264ffda845c118 +size 3840044 diff --git a/scripts/testv/stvST48n.pcm b/scripts/testv/stvST48n.pcm deleted file mode 100644 index 3003287eddc5b9d95e024635fc89d10ce4fccae3..0000000000000000000000000000000000000000 --- a/scripts/testv/stvST48n.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:57694c7ad6e279b8ef4e9e1b19a16e4252b7bae2a2f70a09ef7b2e9f64403a04 -size 3724800 diff --git a/scripts/testv/stvST48n.wav b/scripts/testv/stvST48n.wav new file mode 100644 index 0000000000000000000000000000000000000000..cb2d8c4fc30272c6b440ce906a11693d0f339453 --- /dev/null +++ b/scripts/testv/stvST48n.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6074a3a3b88c7868f62c9bcf7df56e4a8fd25ffed059886846220efc4fbc0992 +size 3724844 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC.pcm b/scripts/testv/stv_IVASMASA_1dir1TC.pcm deleted file mode 100644 index 8f2bfc54e052f5d166eff7e91f5de3b520e84bad..0000000000000000000000000000000000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4dbbaa5c75c36bc74a100bc5721bc3cf2af4e22e2854a5b85c93532556afc776 -size 288000 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm b/scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm deleted file mode 100644 index b642a34076a4bc401858782b9b1c9183495afab0..0000000000000000000000000000000000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c45ab47c02eab6c5f9737749a0229c0bc4eed4b6ebe2cf8db077929ec1aa76a2 -size 1927680 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC.pcm b/scripts/testv/stv_IVASMASA_1dir2TC.pcm deleted file mode 100644 index 491e75f868b7a4ee269ca0e485909a051fbdd0a4..0000000000000000000000000000000000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cd34c99b89d9c1ed3514c3f8e32faf6b82fbc8bf364bc464904fc1c745266350 -size 1152000 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm b/scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm deleted file mode 100644 index 34f827e55b4448c68b925ddbd213de512b226cd2..0000000000000000000000000000000000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:04fe84511787c1577f2886bae5ee440fd3a7692381e119dab714aed70ff16466 -size 3855360 diff --git a/scripts/testv/stv_IVASMASA_2dir1TC.pcm b/scripts/testv/stv_IVASMASA_2dir1TC.pcm deleted file mode 100644 index 7c7209de2d83b475f73b957b111a3cd4b712d5f9..0000000000000000000000000000000000000000 --- a/scripts/testv/stv_IVASMASA_2dir1TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5afc7014451a8599f8399e3a503a29b23d22843ef482c0a701d4c46f6329ebc4 -size 576000 diff --git a/scripts/testv/stv_IVASMASA_2dir2TC.pcm b/scripts/testv/stv_IVASMASA_2dir2TC.pcm deleted file mode 100644 index ac8d4d341a29d5443044afb783aded9fb335f215..0000000000000000000000000000000000000000 --- a/scripts/testv/stv_IVASMASA_2dir2TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5d6c264295987b7db2a9a6a1352dd0b9c91a824fcc37c5631e0ba39e92df33f8 -size 576000 diff --git a/scripts/testv/test_8ch_16k.wav b/scripts/testv/test_8ch_16k.wav deleted file mode 100644 index 112985edbc8c48385a93f276266457851c951fa1..0000000000000000000000000000000000000000 --- a/scripts/testv/test_8ch_16k.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4b4a5f2c895033427626ce2cc05199cdcfbdd266cc8b2d75f8480bf0d051b54a -size 2304148 diff --git a/scripts/testv/test_8ch_32k.wav b/scripts/testv/test_8ch_32k.wav deleted file mode 100644 index abd795767ba2f89375179f56d870b20b674c6b14..0000000000000000000000000000000000000000 --- a/scripts/testv/test_8ch_32k.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f6a7ade09d04d823320157061558a177d00270bba789edff8bf554805ac35c61 -size 4608132 diff --git a/scripts/testv/test_8ch_48k.wav b/scripts/testv/test_8ch_48k.wav deleted file mode 100644 index dc170a11b9c962dae329e8a019b6eccc75b57c8a..0000000000000000000000000000000000000000 --- a/scripts/testv/test_8ch_48k.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:83cec3fb6760866285003140f482b9b8b1f52045072bdf8f6814973bbbea2d35 -size 6912044 diff --git a/scripts/testv/test_FOA.wav b/scripts/testv/test_FOA.wav deleted file mode 100644 index fd654bb7ed178008f82e318d3a5b50a044d12533..0000000000000000000000000000000000000000 --- a/scripts/testv/test_FOA.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9299bbe0637a72ab5419febfff4614066bda4ed8a58ffed19d068d17d4df46e0 -size 7680330 diff --git a/scripts/testv/test_HOA2.wav b/scripts/testv/test_HOA2.wav deleted file mode 100644 index e076c35ab8521f5dd643a742034dede9e6559edf..0000000000000000000000000000000000000000 --- a/scripts/testv/test_HOA2.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:daa96c69bcf085746add3c41db6e2082e1c691c1bf5ad85a8a815b0155caffe4 -size 17280580 diff --git a/scripts/testv/test_HOA3.wav b/scripts/testv/test_HOA3.wav deleted file mode 100644 index 811f8b58039109ee54eeb97b0d40c4b8b5886803..0000000000000000000000000000000000000000 --- a/scripts/testv/test_HOA3.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fef816a7ca44d528ff6d56c431fbd81a82b4cae5c7bd86c7770493427e9d3ffc -size 30720930 diff --git a/scripts/testv/test_ISM_1obj.wav b/scripts/testv/test_ISM_1obj.wav deleted file mode 100644 index b75df181b21d471a186bd4ba51eccd0aedcff8a4..0000000000000000000000000000000000000000 --- a/scripts/testv/test_ISM_1obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6ecc1d851c8c7f7ecf41e1b16abf01d35d37389584128537181add6f55530a9f -size 2880106 diff --git a/scripts/testv/test_ISM_2obj.wav b/scripts/testv/test_ISM_2obj.wav deleted file mode 100644 index a185618ec720afb6b0d7f23b245b525c75dc080f..0000000000000000000000000000000000000000 --- a/scripts/testv/test_ISM_2obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:41825bb3378c8a9657bc3ae4dbebda7a54591f5a7aae6de7f4c6cf077e9c8df0 -size 5760106 diff --git a/scripts/testv/test_ISM_3obj.wav b/scripts/testv/test_ISM_3obj.wav deleted file mode 100644 index 2ce33435357ace6f7c973fbdbfe038272edb2acb..0000000000000000000000000000000000000000 --- a/scripts/testv/test_ISM_3obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:235749b6b4f6e76c4dccbd8d9ece32bf979ce8b77b7ca4402bb5ca8c159f8acc -size 8640130 diff --git a/scripts/testv/test_ISM_4obj.wav b/scripts/testv/test_ISM_4obj.wav deleted file mode 100644 index e50b2d5cbdea95e8a47e288aa39080cff14334be..0000000000000000000000000000000000000000 --- a/scripts/testv/test_ISM_4obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:98bfb96a3b238a3e4004c07644932d35571f42d566f3278a6cf4bf6b080c1d1a -size 11520130 diff --git a/scripts/testv/test_MASA_1dir1TC.met b/scripts/testv/test_MASA_1dir1TC.met deleted file mode 100644 index f2ce23bd2054140614b7d2ad88769d5d2db77990..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MASA_1dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6349efe3448d28979b80744bcdc29d57f1c025704939b42d7b913d7fc3f23ccc -size 102300 diff --git a/scripts/testv/test_MASA_1dir1TC.wav b/scripts/testv/test_MASA_1dir1TC.wav deleted file mode 100644 index 9291feeee3971775f90639b262845ecd19f990fd..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MASA_1dir1TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:54ea4543e4d6d43c312f1e461a75a3d8ce18e34bfb5777f15f2e494dd277d2e5 -size 288106 diff --git a/scripts/testv/test_MASA_1dir2TC.met b/scripts/testv/test_MASA_1dir2TC.met deleted file mode 100644 index 00acdae5394c5d40e9193d7dd9cd1fee6d182c24..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MASA_1dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a1f87bfe360dbd221a94583aa68a58ef050e968a63351730d643f2dc2cac4e1 -size 204600 diff --git a/scripts/testv/test_MASA_1dir2TC.wav b/scripts/testv/test_MASA_1dir2TC.wav deleted file mode 100644 index aefec77efe5edf936ac1ce6fc86f6a7dfc11fb92..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MASA_1dir2TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ab7437cdf41e56338c93f5e593118a112a48bae5138be2cdd301eff5da59bb06 -size 1152106 diff --git a/scripts/testv/test_MASA_2dir1TC.met b/scripts/testv/test_MASA_2dir1TC.met deleted file mode 100644 index 64688774087538a671ebfda830ff11b4f836f438..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MASA_2dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d125a4c4e3989ac55f9c2617f464431feae4ede9b2e15d087d3271c0a4a56303 -size 319800 diff --git a/scripts/testv/test_MASA_2dir1TC.wav b/scripts/testv/test_MASA_2dir1TC.wav deleted file mode 100644 index c80192b76bd05f869e1bd20859bbb3fbf818c9ad..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MASA_2dir1TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b45ecb01efdc7a5d9877c9adcee2aad632ffde326dbc76554cb0452a78e3954d -size 576106 diff --git a/scripts/testv/test_MASA_2dir2TC.met b/scripts/testv/test_MASA_2dir2TC.met deleted file mode 100644 index 1b62022af572fc4f198e4212cca88d51913ec3c4..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MASA_2dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2eb412d646d7a32c77413dea54dc44cf45dc49e6d8c2de19abe4f4b93a91fa4a -size 159900 diff --git a/scripts/testv/test_MASA_2dir2TC.wav b/scripts/testv/test_MASA_2dir2TC.wav deleted file mode 100644 index 0f72267ea03c634f752c2c755294245cce8222b2..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MASA_2dir2TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5a0379965053087ef1ce4775c85384e8c06aaa8161f12888f5e5c06d8612c1f -size 576106 diff --git a/scripts/testv/test_MC51.wav b/scripts/testv/test_MC51.wav deleted file mode 100644 index 334d8197450f2c3a998142064c8d6b77d90f00a1..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MC51.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3a077210fb3ab4f4a8f04ab37a7813e474f3dfb3dbd927b71484e03986cb042a -size 11520130 diff --git a/scripts/testv/test_MC51p2.wav b/scripts/testv/test_MC51p2.wav deleted file mode 100644 index e696a7dae647dfaa2b0ceccd1a94d0d45788b2ea..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MC51p2.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d056d0c1b412c1e8507872212f18bf333a91aac17358eae6a59c7a76f1bb0aaf -size 2304130 diff --git a/scripts/testv/test_MC51p4.wav b/scripts/testv/test_MC51p4.wav deleted file mode 100644 index 3d1c7812a48766f0917636b7419798ac7f6c4db3..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MC51p4.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:eddaf145410ca04daba554a719c58ed391159c7d73e6ea140d2b5de250929366 -size 2880130 diff --git a/scripts/testv/test_MC71.wav b/scripts/testv/test_MC71.wav deleted file mode 100644 index 2a0b012ab051c2681cbee56d3165413cd531ae1c..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MC71.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d0ac38ddb16b2ce9cbca27965c5aedaf1af857a6fdce340bc01322794311e92d -size 2304130 diff --git a/scripts/testv/test_MC71p4.wav b/scripts/testv/test_MC71p4.wav deleted file mode 100644 index 9d0c1e594e0921e7fff3ee30a16c42456b04d35d..0000000000000000000000000000000000000000 --- a/scripts/testv/test_MC71p4.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e1f3fa943f86082be69a774280379f179f4bd51f221ee7aad6471c0310a9f4ab -size 3456130 diff --git a/scripts/testv/test_mono.wav b/scripts/testv/test_mono.wav deleted file mode 100644 index b841d174c36143796ce18f8c9376807d46183594..0000000000000000000000000000000000000000 --- a/scripts/testv/test_mono.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5daeac3fb92d487fc7ded7d1a4a9e6295d2f2f27f59f19dcdaeebaae01908a86 -size 1920106 diff --git a/scripts/testv/test_stereo.wav b/scripts/testv/test_stereo.wav deleted file mode 100644 index 70dc46062ec79e6fac58fb6a7531c775700eac5e..0000000000000000000000000000000000000000 --- a/scripts/testv/test_stereo.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e0de400200071a7b26de03eaef88b49efce7a5df813b971336ed17b90ba02aa2 -size 3840106 diff --git a/scripts/trajectories/azi+2-ele+2-every-100-frames-Euler.csv b/scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames-Euler.csv similarity index 100% rename from scripts/trajectories/azi+2-ele+2-every-100-frames-Euler.csv rename to scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames-Euler.csv diff --git a/scripts/trajectories/azi+2-ele+2-every-100-frames.csv b/scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames.csv similarity index 100% rename from scripts/trajectories/azi+2-ele+2-every-100-frames.csv rename to scripts/trajectories/azi_plus_2-ele_plus_2-every-100-frames.csv diff --git a/scripts/trajectories/azi_plus_2-ele_plus_2-every-25-rows.csv b/scripts/trajectories/azi_plus_2-ele_plus_2-every-25-rows.csv new file mode 100644 index 0000000000000000000000000000000000000000..4d8eb8d47b98963cf759f1a0a3f52b592f82ce86 --- /dev/null +++ b/scripts/trajectories/azi_plus_2-ele_plus_2-every-25-rows.csv @@ -0,0 +1,3000 @@ + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.653281, -0.270598, 0.270598, 0.653281 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.634602, -0.292582, 0.282543, 0.657150 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.615562, -0.314856, 0.293608, 0.660109 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.596200, -0.337381, 0.303779, 0.662147 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.576556, -0.360116, 0.313044, 0.663252 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.556670, -0.383022, 0.321394, 0.663414 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.536584, -0.406058, 0.328819, 0.662626 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.516337, -0.429181, 0.335313, 0.660881 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.495972, -0.452352, 0.340872, 0.658176 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.475528, -0.475528, 0.345492, 0.654508 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.455049, -0.498668, 0.349171, 0.649877 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.434575, -0.521730, 0.351911, 0.644283 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.414147, -0.544673, 0.353715, 0.637730 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.393807, -0.567455, 0.354585, 0.630223 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.373595, -0.590035, 0.354529, 0.621767 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.353553, -0.612372, 0.353553, 0.612372 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.333721, -0.634427, 0.351668, 0.602048 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.314138, -0.656158, 0.348885, 0.590807 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.294843, -0.677527, 0.345217, 0.578662 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.275876, -0.698494, 0.340678, 0.565629 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.257274, -0.719022, 0.335286, 0.551725 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.239074, -0.739074, 0.329057, 0.536969 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.221313, -0.758612, 0.322012, 0.521380 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.204025, -0.777602, 0.314172, 0.504981 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.187247, -0.796008, 0.305559, 0.487794 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.171010, -0.813798, 0.296198, 0.469846 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.155348, -0.830938, 0.286115, 0.451162 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.140291, -0.847398, 0.275336, 0.431771 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.125869, -0.863147, 0.263890, 0.411700 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.112112, -0.878156, 0.251807, 0.390980 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.099046, -0.892399, 0.239118, 0.369644 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.086697, -0.905849, 0.225854, 0.347723 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.075090, -0.918482, 0.212048, 0.325251 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.064248, -0.930274, 0.197736, 0.302264 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.054193, -0.941204, 0.182951, 0.278797 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.044943, -0.951251, 0.167731, 0.254887 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.036519, -0.960398, 0.152112, 0.230571 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.028936, -0.968628, 0.136132, 0.205888 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.022209, -0.975926, 0.119829, 0.180877 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.016352, -0.982278, 0.103242, 0.155578 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.011376, -0.987672, 0.086410, 0.130030 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.007292, -0.992099, 0.069374, 0.104274 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.004106, -0.995551, 0.052175, 0.078352 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.001826, -0.998021, 0.034852, 0.052304 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000457, -0.999505, 0.017446, 0.026173 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000000, -1.000000, 0.000000, 0.000000 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.000457, -0.999505, -0.017446, -0.026173 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.001826, -0.998021, -0.034852, -0.052304 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.004106, -0.995551, -0.052175, -0.078352 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.007292, -0.992099, -0.069374, -0.104274 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.011376, -0.987672, -0.086410, -0.130030 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.016352, -0.982278, -0.103242, -0.155578 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.022209, -0.975926, -0.119829, -0.180877 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.028936, -0.968628, -0.136132, -0.205888 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.036519, -0.960398, -0.152112, -0.230571 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.044943, -0.951251, -0.167731, -0.254887 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.054193, -0.941204, -0.182951, -0.278797 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.064248, -0.930274, -0.197736, -0.302264 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.075090, -0.918482, -0.212048, -0.325251 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.086697, -0.905849, -0.225854, -0.347723 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.099046, -0.892399, -0.239118, -0.369644 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.112112, -0.878156, -0.251807, -0.390980 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.125869, -0.863147, -0.263890, -0.411700 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.140291, -0.847398, -0.275336, -0.431771 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.155348, -0.830938, -0.286115, -0.451162 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.171010, -0.813798, -0.296198, -0.469846 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.187247, -0.796008, -0.305559, -0.487794 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.204025, -0.777602, -0.314172, -0.504981 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.221313, -0.758612, -0.322012, -0.521380 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.239074, -0.739074, -0.329057, -0.536969 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.257274, -0.719022, -0.335286, -0.551725 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.275876, -0.698494, -0.340678, -0.565629 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.294843, -0.677527, -0.345217, -0.578662 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.314138, -0.656158, -0.348885, -0.590807 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.333721, -0.634427, -0.351668, -0.602048 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.353553, -0.612372, -0.353553, -0.612372 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.373595, -0.590035, -0.354529, -0.621767 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.393807, -0.567455, -0.354585, -0.630223 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.414147, -0.544673, -0.353715, -0.637730 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.434575, -0.521730, -0.351911, -0.644283 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.455049, -0.498668, -0.349171, -0.649877 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.475528, -0.475528, -0.345492, -0.654508 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.495972, -0.452352, -0.340872, -0.658176 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.516337, -0.429181, -0.335313, -0.660881 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.536584, -0.406058, -0.328819, -0.662626 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.556670, -0.383022, -0.321394, -0.663414 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.576556, -0.360116, -0.313044, -0.663252 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.596200, -0.337381, -0.303779, -0.662147 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.615562, -0.314856, -0.293608, -0.660109 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.634602, -0.292582, -0.282543, -0.657150 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.653281, -0.270598, -0.270598, -0.653281 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.671562, -0.248943, -0.257788, -0.648519 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.689404, -0.227656, -0.244131, -0.642880 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.706773, -0.206773, -0.229644, -0.636381 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.723630, -0.186331, -0.214349, -0.629042 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.739942, -0.166366, -0.198267, -0.620885 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.755673, -0.146912, -0.181421, -0.611932 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.770791, -0.128003, -0.163837, -0.602208 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.785262, -0.109672, -0.145540, -0.591738 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.799057, -0.091950, -0.126558, -0.580549 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.812144, -0.074867, -0.106921, -0.568669 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.824496, -0.058452, -0.086658, -0.556130 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.836085, -0.042732, -0.065801, -0.542960 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.846886, -0.027734, -0.044383, -0.529193 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.856874, -0.013482, -0.022438, -0.514862 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.866025, -0.000000, -0.000000, -0.500000 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.874320, 0.012691, 0.022895, -0.484643 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.881738, 0.024570, 0.046210, -0.468828 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.888260, 0.035620, 0.069908, -0.452591 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.893870, 0.045822, 0.093950, -0.435970 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.898554, 0.055163, 0.118297, -0.419003 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.902298, 0.063628, 0.142910, -0.401729 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.905091, 0.071205, 0.167749, -0.384188 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.906923, 0.077885, 0.192772, -0.366421 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907786, 0.083659, 0.217940, -0.348466 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.907673, 0.088521, 0.243210, -0.330366 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.906582, 0.092466, 0.268542, -0.312161 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.904508, 0.095492, 0.293893, -0.293893 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.901453, 0.097596, 0.319221, -0.275602 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 + 0.897415, 0.098780, 0.344485, -0.257330 diff --git a/scripts/trajectories/const000-Vector3.csv b/scripts/trajectories/const000-Vector3.csv new file mode 100644 index 0000000000000000000000000000000000000000..f47ae12e5defebf51cff611c9887c231cfdb2327 --- /dev/null +++ b/scripts/trajectories/const000-Vector3.csv @@ -0,0 +1,4 @@ +0.0, 0.0, 0.0, 1.0, 0.0, 0.0 +0.0, 0.0, 0.0, 1.0, 0.0, 0.0 +0.0, 0.0, 0.0, 1.0, 0.0, 0.0 +0.0, 0.0, 0.0, 1.0, 0.0, 0.0 diff --git a/scripts/trajectories/full-circle-4s-Vector3.csv b/scripts/trajectories/full-circle-4s-Vector3.csv new file mode 100644 index 0000000000000000000000000000000000000000..38a350523957054744f92fb08c628981a12e0f9a --- /dev/null +++ b/scripts/trajectories/full-circle-4s-Vector3.csv @@ -0,0 +1,200 @@ +0.0000,0.0000,0.0000,0.9995,-0.0314,0.0000 +0.0000,0.0000,0.0000,0.9980,-0.0628,0.0000 +0.0000,0.0000,0.0000,0.9956,-0.0941,0.0000 +0.0000,0.0000,0.0000,0.9921,-0.1253,0.0000 +0.0000,0.0000,0.0000,0.9877,-0.1564,0.0000 +0.0000,0.0000,0.0000,0.9823,-0.1874,0.0000 +0.0000,0.0000,0.0000,0.9759,-0.2181,0.0000 +0.0000,0.0000,0.0000,0.9686,-0.2487,0.0000 +0.0000,0.0000,0.0000,0.9603,-0.2790,0.0000 +0.0000,0.0000,0.0000,0.9511,-0.3090,0.0000 +0.0000,0.0000,0.0000,0.9409,-0.3387,0.0000 +0.0000,0.0000,0.0000,0.9298,-0.3681,0.0000 +0.0000,0.0000,0.0000,0.9178,-0.3971,0.0000 +0.0000,0.0000,0.0000,0.9048,-0.4258,0.0000 +0.0000,0.0000,0.0000,0.8910,-0.4540,0.0000 +0.0000,0.0000,0.0000,0.8763,-0.4818,0.0000 +0.0000,0.0000,0.0000,0.8607,-0.5090,0.0000 +0.0000,0.0000,0.0000,0.8443,-0.5358,0.0000 +0.0000,0.0000,0.0000,0.8271,-0.5621,0.0000 +0.0000,0.0000,0.0000,0.8090,-0.5878,0.0000 +0.0000,0.0000,0.0000,0.7902,-0.6129,0.0000 +0.0000,0.0000,0.0000,0.7705,-0.6374,0.0000 +0.0000,0.0000,0.0000,0.7501,-0.6613,0.0000 +0.0000,0.0000,0.0000,0.7290,-0.6845,0.0000 +0.0000,0.0000,0.0000,0.7071,-0.7071,0.0000 +0.0000,0.0000,0.0000,0.6845,-0.7290,0.0000 +0.0000,0.0000,0.0000,0.6613,-0.7501,0.0000 +0.0000,0.0000,0.0000,0.6374,-0.7705,0.0000 +0.0000,0.0000,0.0000,0.6129,-0.7902,0.0000 +0.0000,0.0000,0.0000,0.5878,-0.8090,0.0000 +0.0000,0.0000,0.0000,0.5621,-0.8271,0.0000 +0.0000,0.0000,0.0000,0.5358,-0.8443,0.0000 +0.0000,0.0000,0.0000,0.5090,-0.8607,0.0000 +0.0000,0.0000,0.0000,0.4818,-0.8763,0.0000 +0.0000,0.0000,0.0000,0.4540,-0.8910,0.0000 +0.0000,0.0000,0.0000,0.4258,-0.9048,0.0000 +0.0000,0.0000,0.0000,0.3971,-0.9178,0.0000 +0.0000,0.0000,0.0000,0.3681,-0.9298,0.0000 +0.0000,0.0000,0.0000,0.3387,-0.9409,0.0000 +0.0000,0.0000,0.0000,0.3090,-0.9511,0.0000 +0.0000,0.0000,0.0000,0.2790,-0.9603,0.0000 +0.0000,0.0000,0.0000,0.2487,-0.9686,0.0000 +0.0000,0.0000,0.0000,0.2181,-0.9759,0.0000 +0.0000,0.0000,0.0000,0.1874,-0.9823,0.0000 +0.0000,0.0000,0.0000,0.1564,-0.9877,0.0000 +0.0000,0.0000,0.0000,0.1253,-0.9921,0.0000 +0.0000,0.0000,0.0000,0.0941,-0.9956,0.0000 +0.0000,0.0000,0.0000,0.0628,-0.9980,0.0000 +0.0000,0.0000,0.0000,0.0314,-0.9995,0.0000 +0.0000,0.0000,0.0000,-0.0000,-1.0000,0.0000 +0.0000,0.0000,0.0000,-0.0314,-0.9995,0.0000 +0.0000,0.0000,0.0000,-0.0628,-0.9980,0.0000 +0.0000,0.0000,0.0000,-0.0941,-0.9956,0.0000 +0.0000,0.0000,0.0000,-0.1253,-0.9921,0.0000 +0.0000,0.0000,0.0000,-0.1564,-0.9877,0.0000 +0.0000,0.0000,0.0000,-0.1874,-0.9823,0.0000 +0.0000,0.0000,0.0000,-0.2181,-0.9759,0.0000 +0.0000,0.0000,0.0000,-0.2487,-0.9686,0.0000 +0.0000,0.0000,0.0000,-0.2790,-0.9603,0.0000 +0.0000,0.0000,0.0000,-0.3090,-0.9511,0.0000 +0.0000,0.0000,0.0000,-0.3387,-0.9409,0.0000 +0.0000,0.0000,0.0000,-0.3681,-0.9298,0.0000 +0.0000,0.0000,0.0000,-0.3971,-0.9178,0.0000 +0.0000,0.0000,0.0000,-0.4258,-0.9048,0.0000 +0.0000,0.0000,0.0000,-0.4540,-0.8910,0.0000 +0.0000,0.0000,0.0000,-0.4818,-0.8763,0.0000 +0.0000,0.0000,0.0000,-0.5090,-0.8607,0.0000 +0.0000,0.0000,0.0000,-0.5358,-0.8443,0.0000 +0.0000,0.0000,0.0000,-0.5621,-0.8271,0.0000 +0.0000,0.0000,0.0000,-0.5878,-0.8090,0.0000 +0.0000,0.0000,0.0000,-0.6129,-0.7902,0.0000 +0.0000,0.0000,0.0000,-0.6374,-0.7705,0.0000 +0.0000,0.0000,0.0000,-0.6613,-0.7501,0.0000 +0.0000,0.0000,0.0000,-0.6845,-0.7290,0.0000 +0.0000,0.0000,0.0000,-0.7071,-0.7071,0.0000 +0.0000,0.0000,0.0000,-0.7290,-0.6845,0.0000 +0.0000,0.0000,0.0000,-0.7501,-0.6613,0.0000 +0.0000,0.0000,0.0000,-0.7705,-0.6374,0.0000 +0.0000,0.0000,0.0000,-0.7902,-0.6129,0.0000 +0.0000,0.0000,0.0000,-0.8090,-0.5878,0.0000 +0.0000,0.0000,0.0000,-0.8271,-0.5621,0.0000 +0.0000,0.0000,0.0000,-0.8443,-0.5358,0.0000 +0.0000,0.0000,0.0000,-0.8607,-0.5090,0.0000 +0.0000,0.0000,0.0000,-0.8763,-0.4818,0.0000 +0.0000,0.0000,0.0000,-0.8910,-0.4540,0.0000 +0.0000,0.0000,0.0000,-0.9048,-0.4258,0.0000 +0.0000,0.0000,0.0000,-0.9178,-0.3971,0.0000 +0.0000,0.0000,0.0000,-0.9298,-0.3681,0.0000 +0.0000,0.0000,0.0000,-0.9409,-0.3387,0.0000 +0.0000,0.0000,0.0000,-0.9511,-0.3090,0.0000 +0.0000,0.0000,0.0000,-0.9603,-0.2790,0.0000 +0.0000,0.0000,0.0000,-0.9686,-0.2487,0.0000 +0.0000,0.0000,0.0000,-0.9759,-0.2181,0.0000 +0.0000,0.0000,0.0000,-0.9823,-0.1874,0.0000 +0.0000,0.0000,0.0000,-0.9877,-0.1564,0.0000 +0.0000,0.0000,0.0000,-0.9921,-0.1253,0.0000 +0.0000,0.0000,0.0000,-0.9956,-0.0941,0.0000 +0.0000,0.0000,0.0000,-0.9980,-0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9995,-0.0314,0.0000 +0.0000,0.0000,0.0000,-1.0000,0.0000,0.0000 +0.0000,0.0000,0.0000,-0.9995,0.0314,0.0000 +0.0000,0.0000,0.0000,-0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9956,0.0941,0.0000 +0.0000,0.0000,0.0000,-0.9921,0.1253,0.0000 +0.0000,0.0000,0.0000,-0.9877,0.1564,0.0000 +0.0000,0.0000,0.0000,-0.9823,0.1874,0.0000 +0.0000,0.0000,0.0000,-0.9759,0.2181,0.0000 +0.0000,0.0000,0.0000,-0.9686,0.2487,0.0000 +0.0000,0.0000,0.0000,-0.9603,0.2790,0.0000 +0.0000,0.0000,0.0000,-0.9511,0.3090,0.0000 +0.0000,0.0000,0.0000,-0.9409,0.3387,0.0000 +0.0000,0.0000,0.0000,-0.9298,0.3681,0.0000 +0.0000,0.0000,0.0000,-0.9178,0.3971,0.0000 +0.0000,0.0000,0.0000,-0.9048,0.4258,0.0000 +0.0000,0.0000,0.0000,-0.8910,0.4540,0.0000 +0.0000,0.0000,0.0000,-0.8763,0.4818,0.0000 +0.0000,0.0000,0.0000,-0.8607,0.5090,0.0000 +0.0000,0.0000,0.0000,-0.8443,0.5358,0.0000 +0.0000,0.0000,0.0000,-0.8271,0.5621,0.0000 +0.0000,0.0000,0.0000,-0.8090,0.5878,0.0000 +0.0000,0.0000,0.0000,-0.7902,0.6129,0.0000 +0.0000,0.0000,0.0000,-0.7705,0.6374,0.0000 +0.0000,0.0000,0.0000,-0.7501,0.6613,0.0000 +0.0000,0.0000,0.0000,-0.7290,0.6845,0.0000 +0.0000,0.0000,0.0000,-0.7071,0.7071,0.0000 +0.0000,0.0000,0.0000,-0.6845,0.7290,0.0000 +0.0000,0.0000,0.0000,-0.6613,0.7501,0.0000 +0.0000,0.0000,0.0000,-0.6374,0.7705,0.0000 +0.0000,0.0000,0.0000,-0.6129,0.7902,0.0000 +0.0000,0.0000,0.0000,-0.5878,0.8090,0.0000 +0.0000,0.0000,0.0000,-0.5621,0.8271,0.0000 +0.0000,0.0000,0.0000,-0.5358,0.8443,0.0000 +0.0000,0.0000,0.0000,-0.5090,0.8607,0.0000 +0.0000,0.0000,0.0000,-0.4818,0.8763,0.0000 +0.0000,0.0000,0.0000,-0.4540,0.8910,0.0000 +0.0000,0.0000,0.0000,-0.4258,0.9048,0.0000 +0.0000,0.0000,0.0000,-0.3971,0.9178,0.0000 +0.0000,0.0000,0.0000,-0.3681,0.9298,0.0000 +0.0000,0.0000,0.0000,-0.3387,0.9409,0.0000 +0.0000,0.0000,0.0000,-0.3090,0.9511,0.0000 +0.0000,0.0000,0.0000,-0.2790,0.9603,0.0000 +0.0000,0.0000,0.0000,-0.2487,0.9686,0.0000 +0.0000,0.0000,0.0000,-0.2181,0.9759,0.0000 +0.0000,0.0000,0.0000,-0.1874,0.9823,0.0000 +0.0000,0.0000,0.0000,-0.1564,0.9877,0.0000 +0.0000,0.0000,0.0000,-0.1253,0.9921,0.0000 +0.0000,0.0000,0.0000,-0.0941,0.9956,0.0000 +0.0000,0.0000,0.0000,-0.0628,0.9980,0.0000 +0.0000,0.0000,0.0000,-0.0314,0.9995,0.0000 +0.0000,0.0000,0.0000,0.0000,1.0000,0.0000 +0.0000,0.0000,0.0000,0.0314,0.9995,0.0000 +0.0000,0.0000,0.0000,0.0628,0.9980,0.0000 +0.0000,0.0000,0.0000,0.0941,0.9956,0.0000 +0.0000,0.0000,0.0000,0.1253,0.9921,0.0000 +0.0000,0.0000,0.0000,0.1564,0.9877,0.0000 +0.0000,0.0000,0.0000,0.1874,0.9823,0.0000 +0.0000,0.0000,0.0000,0.2181,0.9759,0.0000 +0.0000,0.0000,0.0000,0.2487,0.9686,0.0000 +0.0000,0.0000,0.0000,0.2790,0.9603,0.0000 +0.0000,0.0000,0.0000,0.3090,0.9511,0.0000 +0.0000,0.0000,0.0000,0.3387,0.9409,0.0000 +0.0000,0.0000,0.0000,0.3681,0.9298,0.0000 +0.0000,0.0000,0.0000,0.3971,0.9178,0.0000 +0.0000,0.0000,0.0000,0.4258,0.9048,0.0000 +0.0000,0.0000,0.0000,0.4540,0.8910,0.0000 +0.0000,0.0000,0.0000,0.4818,0.8763,0.0000 +0.0000,0.0000,0.0000,0.5090,0.8607,0.0000 +0.0000,0.0000,0.0000,0.5358,0.8443,0.0000 +0.0000,0.0000,0.0000,0.5621,0.8271,0.0000 +0.0000,0.0000,0.0000,0.5878,0.8090,0.0000 +0.0000,0.0000,0.0000,0.6129,0.7902,0.0000 +0.0000,0.0000,0.0000,0.6374,0.7705,0.0000 +0.0000,0.0000,0.0000,0.6613,0.7501,0.0000 +0.0000,0.0000,0.0000,0.6845,0.7290,0.0000 +0.0000,0.0000,0.0000,0.7071,0.7071,0.0000 +0.0000,0.0000,0.0000,0.7290,0.6845,0.0000 +0.0000,0.0000,0.0000,0.7501,0.6613,0.0000 +0.0000,0.0000,0.0000,0.7705,0.6374,0.0000 +0.0000,0.0000,0.0000,0.7902,0.6129,0.0000 +0.0000,0.0000,0.0000,0.8090,0.5878,0.0000 +0.0000,0.0000,0.0000,0.8271,0.5621,0.0000 +0.0000,0.0000,0.0000,0.8443,0.5358,0.0000 +0.0000,0.0000,0.0000,0.8607,0.5090,0.0000 +0.0000,0.0000,0.0000,0.8763,0.4818,0.0000 +0.0000,0.0000,0.0000,0.8910,0.4540,0.0000 +0.0000,0.0000,0.0000,0.9048,0.4258,0.0000 +0.0000,0.0000,0.0000,0.9178,0.3971,0.0000 +0.0000,0.0000,0.0000,0.9298,0.3681,0.0000 +0.0000,0.0000,0.0000,0.9409,0.3387,0.0000 +0.0000,0.0000,0.0000,0.9511,0.3090,0.0000 +0.0000,0.0000,0.0000,0.9603,0.2790,0.0000 +0.0000,0.0000,0.0000,0.9686,0.2487,0.0000 +0.0000,0.0000,0.0000,0.9759,0.2181,0.0000 +0.0000,0.0000,0.0000,0.9823,0.1874,0.0000 +0.0000,0.0000,0.0000,0.9877,0.1564,0.0000 +0.0000,0.0000,0.0000,0.9921,0.1253,0.0000 +0.0000,0.0000,0.0000,0.9956,0.0941,0.0000 +0.0000,0.0000,0.0000,0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,0.9995,0.0314,0.0000 +0.0000,0.0000,0.0000,1.0000,-0.0000,0.0000 diff --git a/scripts/trajectories/full-circle-4s-ccw-Vector3.csv b/scripts/trajectories/full-circle-4s-ccw-Vector3.csv new file mode 100644 index 0000000000000000000000000000000000000000..37b2904ea4199014bf5647fa0196bf3975b13d55 --- /dev/null +++ b/scripts/trajectories/full-circle-4s-ccw-Vector3.csv @@ -0,0 +1,200 @@ +0.0000,0.0000,0.0000,0.9995,0.0314,0.0000 +0.0000,0.0000,0.0000,0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,0.9956,0.0941,0.0000 +0.0000,0.0000,0.0000,0.9921,0.1253,0.0000 +0.0000,0.0000,0.0000,0.9877,0.1564,0.0000 +0.0000,0.0000,0.0000,0.9823,0.1874,0.0000 +0.0000,0.0000,0.0000,0.9759,0.2181,0.0000 +0.0000,0.0000,0.0000,0.9686,0.2487,0.0000 +0.0000,0.0000,0.0000,0.9603,0.2790,0.0000 +0.0000,0.0000,0.0000,0.9511,0.3090,0.0000 +0.0000,0.0000,0.0000,0.9409,0.3387,0.0000 +0.0000,0.0000,0.0000,0.9298,0.3681,0.0000 +0.0000,0.0000,0.0000,0.9178,0.3971,0.0000 +0.0000,0.0000,0.0000,0.9048,0.4258,0.0000 +0.0000,0.0000,0.0000,0.8910,0.4540,0.0000 +0.0000,0.0000,0.0000,0.8763,0.4818,0.0000 +0.0000,0.0000,0.0000,0.8607,0.5090,0.0000 +0.0000,0.0000,0.0000,0.8443,0.5358,0.0000 +0.0000,0.0000,0.0000,0.8271,0.5621,0.0000 +0.0000,0.0000,0.0000,0.8090,0.5878,0.0000 +0.0000,0.0000,0.0000,0.7902,0.6129,0.0000 +0.0000,0.0000,0.0000,0.7705,0.6374,0.0000 +0.0000,0.0000,0.0000,0.7501,0.6613,0.0000 +0.0000,0.0000,0.0000,0.7290,0.6845,0.0000 +0.0000,0.0000,0.0000,0.7071,0.7071,0.0000 +0.0000,0.0000,0.0000,0.6845,0.7290,0.0000 +0.0000,0.0000,0.0000,0.6613,0.7501,0.0000 +0.0000,0.0000,0.0000,0.6374,0.7705,0.0000 +0.0000,0.0000,0.0000,0.6129,0.7902,0.0000 +0.0000,0.0000,0.0000,0.5878,0.8090,0.0000 +0.0000,0.0000,0.0000,0.5621,0.8271,0.0000 +0.0000,0.0000,0.0000,0.5358,0.8443,0.0000 +0.0000,0.0000,0.0000,0.5090,0.8607,0.0000 +0.0000,0.0000,0.0000,0.4818,0.8763,0.0000 +0.0000,0.0000,0.0000,0.4540,0.8910,0.0000 +0.0000,0.0000,0.0000,0.4258,0.9048,0.0000 +0.0000,0.0000,0.0000,0.3971,0.9178,0.0000 +0.0000,0.0000,0.0000,0.3681,0.9298,0.0000 +0.0000,0.0000,0.0000,0.3387,0.9409,0.0000 +0.0000,0.0000,0.0000,0.3090,0.9511,0.0000 +0.0000,0.0000,0.0000,0.2790,0.9603,0.0000 +0.0000,0.0000,0.0000,0.2487,0.9686,0.0000 +0.0000,0.0000,0.0000,0.2181,0.9759,0.0000 +0.0000,0.0000,0.0000,0.1874,0.9823,0.0000 +0.0000,0.0000,0.0000,0.1564,0.9877,0.0000 +0.0000,0.0000,0.0000,0.1253,0.9921,0.0000 +0.0000,0.0000,0.0000,0.0941,0.9956,0.0000 +0.0000,0.0000,0.0000,0.0628,0.9980,0.0000 +0.0000,0.0000,0.0000,0.0314,0.9995,0.0000 +0.0000,0.0000,0.0000,-0.0000,1.0000,0.0000 +0.0000,0.0000,0.0000,-0.0314,0.9995,0.0000 +0.0000,0.0000,0.0000,-0.0628,0.9980,0.0000 +0.0000,0.0000,0.0000,-0.0941,0.9956,0.0000 +0.0000,0.0000,0.0000,-0.1253,0.9921,0.0000 +0.0000,0.0000,0.0000,-0.1564,0.9877,0.0000 +0.0000,0.0000,0.0000,-0.1874,0.9823,0.0000 +0.0000,0.0000,0.0000,-0.2181,0.9759,0.0000 +0.0000,0.0000,0.0000,-0.2487,0.9686,0.0000 +0.0000,0.0000,0.0000,-0.2790,0.9603,0.0000 +0.0000,0.0000,0.0000,-0.3090,0.9511,0.0000 +0.0000,0.0000,0.0000,-0.3387,0.9409,0.0000 +0.0000,0.0000,0.0000,-0.3681,0.9298,0.0000 +0.0000,0.0000,0.0000,-0.3971,0.9178,0.0000 +0.0000,0.0000,0.0000,-0.4258,0.9048,0.0000 +0.0000,0.0000,0.0000,-0.4540,0.8910,0.0000 +0.0000,0.0000,0.0000,-0.4818,0.8763,0.0000 +0.0000,0.0000,0.0000,-0.5090,0.8607,0.0000 +0.0000,0.0000,0.0000,-0.5358,0.8443,0.0000 +0.0000,0.0000,0.0000,-0.5621,0.8271,0.0000 +0.0000,0.0000,0.0000,-0.5878,0.8090,0.0000 +0.0000,0.0000,0.0000,-0.6129,0.7902,0.0000 +0.0000,0.0000,0.0000,-0.6374,0.7705,0.0000 +0.0000,0.0000,0.0000,-0.6613,0.7501,0.0000 +0.0000,0.0000,0.0000,-0.6845,0.7290,0.0000 +0.0000,0.0000,0.0000,-0.7071,0.7071,0.0000 +0.0000,0.0000,0.0000,-0.7290,0.6845,0.0000 +0.0000,0.0000,0.0000,-0.7501,0.6613,0.0000 +0.0000,0.0000,0.0000,-0.7705,0.6374,0.0000 +0.0000,0.0000,0.0000,-0.7902,0.6129,0.0000 +0.0000,0.0000,0.0000,-0.8090,0.5878,0.0000 +0.0000,0.0000,0.0000,-0.8271,0.5621,0.0000 +0.0000,0.0000,0.0000,-0.8443,0.5358,0.0000 +0.0000,0.0000,0.0000,-0.8607,0.5090,0.0000 +0.0000,0.0000,0.0000,-0.8763,0.4818,0.0000 +0.0000,0.0000,0.0000,-0.8910,0.4540,0.0000 +0.0000,0.0000,0.0000,-0.9048,0.4258,0.0000 +0.0000,0.0000,0.0000,-0.9178,0.3971,0.0000 +0.0000,0.0000,0.0000,-0.9298,0.3681,0.0000 +0.0000,0.0000,0.0000,-0.9409,0.3387,0.0000 +0.0000,0.0000,0.0000,-0.9511,0.3090,0.0000 +0.0000,0.0000,0.0000,-0.9603,0.2790,0.0000 +0.0000,0.0000,0.0000,-0.9686,0.2487,0.0000 +0.0000,0.0000,0.0000,-0.9759,0.2181,0.0000 +0.0000,0.0000,0.0000,-0.9823,0.1874,0.0000 +0.0000,0.0000,0.0000,-0.9877,0.1564,0.0000 +0.0000,0.0000,0.0000,-0.9921,0.1253,0.0000 +0.0000,0.0000,0.0000,-0.9956,0.0941,0.0000 +0.0000,0.0000,0.0000,-0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9995,0.0314,0.0000 +0.0000,0.0000,0.0000,-1.0000,-0.0000,0.0000 +0.0000,0.0000,0.0000,-0.9995,-0.0314,0.0000 +0.0000,0.0000,0.0000,-0.9980,-0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9956,-0.0941,0.0000 +0.0000,0.0000,0.0000,-0.9921,-0.1253,0.0000 +0.0000,0.0000,0.0000,-0.9877,-0.1564,0.0000 +0.0000,0.0000,0.0000,-0.9823,-0.1874,0.0000 +0.0000,0.0000,0.0000,-0.9759,-0.2181,0.0000 +0.0000,0.0000,0.0000,-0.9686,-0.2487,0.0000 +0.0000,0.0000,0.0000,-0.9603,-0.2790,0.0000 +0.0000,0.0000,0.0000,-0.9511,-0.3090,0.0000 +0.0000,0.0000,0.0000,-0.9409,-0.3387,0.0000 +0.0000,0.0000,0.0000,-0.9298,-0.3681,0.0000 +0.0000,0.0000,0.0000,-0.9178,-0.3971,0.0000 +0.0000,0.0000,0.0000,-0.9048,-0.4258,0.0000 +0.0000,0.0000,0.0000,-0.8910,-0.4540,0.0000 +0.0000,0.0000,0.0000,-0.8763,-0.4818,0.0000 +0.0000,0.0000,0.0000,-0.8607,-0.5090,0.0000 +0.0000,0.0000,0.0000,-0.8443,-0.5358,0.0000 +0.0000,0.0000,0.0000,-0.8271,-0.5621,0.0000 +0.0000,0.0000,0.0000,-0.8090,-0.5878,0.0000 +0.0000,0.0000,0.0000,-0.7902,-0.6129,0.0000 +0.0000,0.0000,0.0000,-0.7705,-0.6374,0.0000 +0.0000,0.0000,0.0000,-0.7501,-0.6613,0.0000 +0.0000,0.0000,0.0000,-0.7290,-0.6845,0.0000 +0.0000,0.0000,0.0000,-0.7071,-0.7071,0.0000 +0.0000,0.0000,0.0000,-0.6845,-0.7290,0.0000 +0.0000,0.0000,0.0000,-0.6613,-0.7501,0.0000 +0.0000,0.0000,0.0000,-0.6374,-0.7705,0.0000 +0.0000,0.0000,0.0000,-0.6129,-0.7902,0.0000 +0.0000,0.0000,0.0000,-0.5878,-0.8090,0.0000 +0.0000,0.0000,0.0000,-0.5621,-0.8271,0.0000 +0.0000,0.0000,0.0000,-0.5358,-0.8443,0.0000 +0.0000,0.0000,0.0000,-0.5090,-0.8607,0.0000 +0.0000,0.0000,0.0000,-0.4818,-0.8763,0.0000 +0.0000,0.0000,0.0000,-0.4540,-0.8910,0.0000 +0.0000,0.0000,0.0000,-0.4258,-0.9048,0.0000 +0.0000,0.0000,0.0000,-0.3971,-0.9178,0.0000 +0.0000,0.0000,0.0000,-0.3681,-0.9298,0.0000 +0.0000,0.0000,0.0000,-0.3387,-0.9409,0.0000 +0.0000,0.0000,0.0000,-0.3090,-0.9511,0.0000 +0.0000,0.0000,0.0000,-0.2790,-0.9603,0.0000 +0.0000,0.0000,0.0000,-0.2487,-0.9686,0.0000 +0.0000,0.0000,0.0000,-0.2181,-0.9759,0.0000 +0.0000,0.0000,0.0000,-0.1874,-0.9823,0.0000 +0.0000,0.0000,0.0000,-0.1564,-0.9877,0.0000 +0.0000,0.0000,0.0000,-0.1253,-0.9921,0.0000 +0.0000,0.0000,0.0000,-0.0941,-0.9956,0.0000 +0.0000,0.0000,0.0000,-0.0628,-0.9980,0.0000 +0.0000,0.0000,0.0000,-0.0314,-0.9995,0.0000 +0.0000,0.0000,0.0000,0.0000,-1.0000,0.0000 +0.0000,0.0000,0.0000,0.0314,-0.9995,0.0000 +0.0000,0.0000,0.0000,0.0628,-0.9980,0.0000 +0.0000,0.0000,0.0000,0.0941,-0.9956,0.0000 +0.0000,0.0000,0.0000,0.1253,-0.9921,0.0000 +0.0000,0.0000,0.0000,0.1564,-0.9877,0.0000 +0.0000,0.0000,0.0000,0.1874,-0.9823,0.0000 +0.0000,0.0000,0.0000,0.2181,-0.9759,0.0000 +0.0000,0.0000,0.0000,0.2487,-0.9686,0.0000 +0.0000,0.0000,0.0000,0.2790,-0.9603,0.0000 +0.0000,0.0000,0.0000,0.3090,-0.9511,0.0000 +0.0000,0.0000,0.0000,0.3387,-0.9409,0.0000 +0.0000,0.0000,0.0000,0.3681,-0.9298,0.0000 +0.0000,0.0000,0.0000,0.3971,-0.9178,0.0000 +0.0000,0.0000,0.0000,0.4258,-0.9048,0.0000 +0.0000,0.0000,0.0000,0.4540,-0.8910,0.0000 +0.0000,0.0000,0.0000,0.4818,-0.8763,0.0000 +0.0000,0.0000,0.0000,0.5090,-0.8607,0.0000 +0.0000,0.0000,0.0000,0.5358,-0.8443,0.0000 +0.0000,0.0000,0.0000,0.5621,-0.8271,0.0000 +0.0000,0.0000,0.0000,0.5878,-0.8090,0.0000 +0.0000,0.0000,0.0000,0.6129,-0.7902,0.0000 +0.0000,0.0000,0.0000,0.6374,-0.7705,0.0000 +0.0000,0.0000,0.0000,0.6613,-0.7501,0.0000 +0.0000,0.0000,0.0000,0.6845,-0.7290,0.0000 +0.0000,0.0000,0.0000,0.7071,-0.7071,0.0000 +0.0000,0.0000,0.0000,0.7290,-0.6845,0.0000 +0.0000,0.0000,0.0000,0.7501,-0.6613,0.0000 +0.0000,0.0000,0.0000,0.7705,-0.6374,0.0000 +0.0000,0.0000,0.0000,0.7902,-0.6129,0.0000 +0.0000,0.0000,0.0000,0.8090,-0.5878,0.0000 +0.0000,0.0000,0.0000,0.8271,-0.5621,0.0000 +0.0000,0.0000,0.0000,0.8443,-0.5358,0.0000 +0.0000,0.0000,0.0000,0.8607,-0.5090,0.0000 +0.0000,0.0000,0.0000,0.8763,-0.4818,0.0000 +0.0000,0.0000,0.0000,0.8910,-0.4540,0.0000 +0.0000,0.0000,0.0000,0.9048,-0.4258,0.0000 +0.0000,0.0000,0.0000,0.9178,-0.3971,0.0000 +0.0000,0.0000,0.0000,0.9298,-0.3681,0.0000 +0.0000,0.0000,0.0000,0.9409,-0.3387,0.0000 +0.0000,0.0000,0.0000,0.9511,-0.3090,0.0000 +0.0000,0.0000,0.0000,0.9603,-0.2790,0.0000 +0.0000,0.0000,0.0000,0.9686,-0.2487,0.0000 +0.0000,0.0000,0.0000,0.9759,-0.2181,0.0000 +0.0000,0.0000,0.0000,0.9823,-0.1874,0.0000 +0.0000,0.0000,0.0000,0.9877,-0.1564,0.0000 +0.0000,0.0000,0.0000,0.9921,-0.1253,0.0000 +0.0000,0.0000,0.0000,0.9956,-0.0941,0.0000 +0.0000,0.0000,0.0000,0.9980,-0.0628,0.0000 +0.0000,0.0000,0.0000,0.9995,-0.0314,0.0000 +0.0000,0.0000,0.0000,1.0000,0.0000,0.0000 diff --git a/scripts/trajectories/full-circle-4s-ccw.csv b/scripts/trajectories/full-circle-4s-ccw.csv new file mode 100644 index 0000000000000000000000000000000000000000..13eeae28e126750542c3fc6583d05e4a30575f42 --- /dev/null +++ b/scripts/trajectories/full-circle-4s-ccw.csv @@ -0,0 +1,800 @@ +0.9999,0.0000,0.0000,0.0157 +0.9999,0.0000,0.0000,0.0157 +0.9999,0.0000,0.0000,0.0157 +0.9999,0.0000,0.0000,0.0157 +0.9995,0.0000,0.0000,0.0314 +0.9995,0.0000,0.0000,0.0314 +0.9995,0.0000,0.0000,0.0314 +0.9995,0.0000,0.0000,0.0314 +0.9989,0.0000,0.0000,0.0471 +0.9989,0.0000,0.0000,0.0471 +0.9989,0.0000,0.0000,0.0471 +0.9989,0.0000,0.0000,0.0471 +0.9980,0.0000,0.0000,0.0628 +0.9980,0.0000,0.0000,0.0628 +0.9980,0.0000,0.0000,0.0628 +0.9980,0.0000,0.0000,0.0628 +0.9969,0.0000,0.0000,0.0785 +0.9969,0.0000,0.0000,0.0785 +0.9969,0.0000,0.0000,0.0785 +0.9969,0.0000,0.0000,0.0785 +0.9956,0.0000,0.0000,0.0941 +0.9956,0.0000,0.0000,0.0941 +0.9956,0.0000,0.0000,0.0941 +0.9956,0.0000,0.0000,0.0941 +0.9940,0.0000,0.0000,0.1097 +0.9940,0.0000,0.0000,0.1097 +0.9940,0.0000,0.0000,0.1097 +0.9940,0.0000,0.0000,0.1097 +0.9921,0.0000,0.0000,0.1253 +0.9921,0.0000,0.0000,0.1253 +0.9921,0.0000,0.0000,0.1253 +0.9921,0.0000,0.0000,0.1253 +0.9900,0.0000,0.0000,0.1409 +0.9900,0.0000,0.0000,0.1409 +0.9900,0.0000,0.0000,0.1409 +0.9900,0.0000,0.0000,0.1409 +0.9877,0.0000,0.0000,0.1564 +0.9877,0.0000,0.0000,0.1564 +0.9877,0.0000,0.0000,0.1564 +0.9877,0.0000,0.0000,0.1564 +0.9851,0.0000,0.0000,0.1719 +0.9851,0.0000,0.0000,0.1719 +0.9851,0.0000,0.0000,0.1719 +0.9851,0.0000,0.0000,0.1719 +0.9823,0.0000,0.0000,0.1874 +0.9823,0.0000,0.0000,0.1874 +0.9823,0.0000,0.0000,0.1874 +0.9823,0.0000,0.0000,0.1874 +0.9792,0.0000,0.0000,0.2028 +0.9792,0.0000,0.0000,0.2028 +0.9792,0.0000,0.0000,0.2028 +0.9792,0.0000,0.0000,0.2028 +0.9759,0.0000,0.0000,0.2181 +0.9759,0.0000,0.0000,0.2181 +0.9759,0.0000,0.0000,0.2181 +0.9759,0.0000,0.0000,0.2181 +0.9724,0.0000,0.0000,0.2334 +0.9724,0.0000,0.0000,0.2334 +0.9724,0.0000,0.0000,0.2334 +0.9724,0.0000,0.0000,0.2334 +0.9686,0.0000,0.0000,0.2487 +0.9686,0.0000,0.0000,0.2487 +0.9686,0.0000,0.0000,0.2487 +0.9686,0.0000,0.0000,0.2487 +0.9646,0.0000,0.0000,0.2639 +0.9646,0.0000,0.0000,0.2639 +0.9646,0.0000,0.0000,0.2639 +0.9646,0.0000,0.0000,0.2639 +0.9603,0.0000,0.0000,0.2790 +0.9603,0.0000,0.0000,0.2790 +0.9603,0.0000,0.0000,0.2790 +0.9603,0.0000,0.0000,0.2790 +0.9558,0.0000,0.0000,0.2940 +0.9558,0.0000,0.0000,0.2940 +0.9558,0.0000,0.0000,0.2940 +0.9558,0.0000,0.0000,0.2940 +0.9511,0.0000,0.0000,0.3090 +0.9511,0.0000,0.0000,0.3090 +0.9511,0.0000,0.0000,0.3090 +0.9511,0.0000,0.0000,0.3090 +0.9461,0.0000,0.0000,0.3239 +0.9461,0.0000,0.0000,0.3239 +0.9461,0.0000,0.0000,0.3239 +0.9461,0.0000,0.0000,0.3239 +0.9409,0.0000,0.0000,0.3387 +0.9409,0.0000,0.0000,0.3387 +0.9409,0.0000,0.0000,0.3387 +0.9409,0.0000,0.0000,0.3387 +0.9354,0.0000,0.0000,0.3535 +0.9354,0.0000,0.0000,0.3535 +0.9354,0.0000,0.0000,0.3535 +0.9354,0.0000,0.0000,0.3535 +0.9298,0.0000,0.0000,0.3681 +0.9298,0.0000,0.0000,0.3681 +0.9298,0.0000,0.0000,0.3681 +0.9298,0.0000,0.0000,0.3681 +0.9239,0.0000,0.0000,0.3827 +0.9239,0.0000,0.0000,0.3827 +0.9239,0.0000,0.0000,0.3827 +0.9239,0.0000,0.0000,0.3827 +0.9178,0.0000,0.0000,0.3971 +0.9178,0.0000,0.0000,0.3971 +0.9178,0.0000,0.0000,0.3971 +0.9178,0.0000,0.0000,0.3971 +0.9114,0.0000,0.0000,0.4115 +0.9114,0.0000,0.0000,0.4115 +0.9114,0.0000,0.0000,0.4115 +0.9114,0.0000,0.0000,0.4115 +0.9048,0.0000,0.0000,0.4258 +0.9048,0.0000,0.0000,0.4258 +0.9048,0.0000,0.0000,0.4258 +0.9048,0.0000,0.0000,0.4258 +0.8980,0.0000,0.0000,0.4399 +0.8980,0.0000,0.0000,0.4399 +0.8980,0.0000,0.0000,0.4399 +0.8980,0.0000,0.0000,0.4399 +0.8910,0.0000,0.0000,0.4540 +0.8910,0.0000,0.0000,0.4540 +0.8910,0.0000,0.0000,0.4540 +0.8910,0.0000,0.0000,0.4540 +0.8838,0.0000,0.0000,0.4679 +0.8838,0.0000,0.0000,0.4679 +0.8838,0.0000,0.0000,0.4679 +0.8838,0.0000,0.0000,0.4679 +0.8763,0.0000,0.0000,0.4818 +0.8763,0.0000,0.0000,0.4818 +0.8763,0.0000,0.0000,0.4818 +0.8763,0.0000,0.0000,0.4818 +0.8686,0.0000,0.0000,0.4955 +0.8686,0.0000,0.0000,0.4955 +0.8686,0.0000,0.0000,0.4955 +0.8686,0.0000,0.0000,0.4955 +0.8607,0.0000,0.0000,0.5090 +0.8607,0.0000,0.0000,0.5090 +0.8607,0.0000,0.0000,0.5090 +0.8607,0.0000,0.0000,0.5090 +0.8526,0.0000,0.0000,0.5225 +0.8526,0.0000,0.0000,0.5225 +0.8526,0.0000,0.0000,0.5225 +0.8526,0.0000,0.0000,0.5225 +0.8443,0.0000,0.0000,0.5358 +0.8443,0.0000,0.0000,0.5358 +0.8443,0.0000,0.0000,0.5358 +0.8443,0.0000,0.0000,0.5358 +0.8358,0.0000,0.0000,0.5490 +0.8358,0.0000,0.0000,0.5490 +0.8358,0.0000,0.0000,0.5490 +0.8358,0.0000,0.0000,0.5490 +0.8271,0.0000,0.0000,0.5621 +0.8271,0.0000,0.0000,0.5621 +0.8271,0.0000,0.0000,0.5621 +0.8271,0.0000,0.0000,0.5621 +0.8181,0.0000,0.0000,0.5750 +0.8181,0.0000,0.0000,0.5750 +0.8181,0.0000,0.0000,0.5750 +0.8181,0.0000,0.0000,0.5750 +0.8090,0.0000,0.0000,0.5878 +0.8090,0.0000,0.0000,0.5878 +0.8090,0.0000,0.0000,0.5878 +0.8090,0.0000,0.0000,0.5878 +0.7997,0.0000,0.0000,0.6004 +0.7997,0.0000,0.0000,0.6004 +0.7997,0.0000,0.0000,0.6004 +0.7997,0.0000,0.0000,0.6004 +0.7902,0.0000,0.0000,0.6129 +0.7902,0.0000,0.0000,0.6129 +0.7902,0.0000,0.0000,0.6129 +0.7902,0.0000,0.0000,0.6129 +0.7804,0.0000,0.0000,0.6252 +0.7804,0.0000,0.0000,0.6252 +0.7804,0.0000,0.0000,0.6252 +0.7804,0.0000,0.0000,0.6252 +0.7705,0.0000,0.0000,0.6374 +0.7705,0.0000,0.0000,0.6374 +0.7705,0.0000,0.0000,0.6374 +0.7705,0.0000,0.0000,0.6374 +0.7604,0.0000,0.0000,0.6494 +0.7604,0.0000,0.0000,0.6494 +0.7604,0.0000,0.0000,0.6494 +0.7604,0.0000,0.0000,0.6494 +0.7501,0.0000,0.0000,0.6613 +0.7501,0.0000,0.0000,0.6613 +0.7501,0.0000,0.0000,0.6613 +0.7501,0.0000,0.0000,0.6613 +0.7396,0.0000,0.0000,0.6730 +0.7396,0.0000,0.0000,0.6730 +0.7396,0.0000,0.0000,0.6730 +0.7396,0.0000,0.0000,0.6730 +0.7290,0.0000,0.0000,0.6845 +0.7290,0.0000,0.0000,0.6845 +0.7290,0.0000,0.0000,0.6845 +0.7290,0.0000,0.0000,0.6845 +0.7181,0.0000,0.0000,0.6959 +0.7181,0.0000,0.0000,0.6959 +0.7181,0.0000,0.0000,0.6959 +0.7181,0.0000,0.0000,0.6959 +0.7071,0.0000,0.0000,0.7071 +0.7071,0.0000,0.0000,0.7071 +0.7071,0.0000,0.0000,0.7071 +0.7071,0.0000,0.0000,0.7071 +0.6959,0.0000,0.0000,0.7181 +0.6959,0.0000,0.0000,0.7181 +0.6959,0.0000,0.0000,0.7181 +0.6959,0.0000,0.0000,0.7181 +0.6845,0.0000,0.0000,0.7290 +0.6845,0.0000,0.0000,0.7290 +0.6845,0.0000,0.0000,0.7290 +0.6845,0.0000,0.0000,0.7290 +0.6730,0.0000,0.0000,0.7396 +0.6730,0.0000,0.0000,0.7396 +0.6730,0.0000,0.0000,0.7396 +0.6730,0.0000,0.0000,0.7396 +0.6613,0.0000,0.0000,0.7501 +0.6613,0.0000,0.0000,0.7501 +0.6613,0.0000,0.0000,0.7501 +0.6613,0.0000,0.0000,0.7501 +0.6494,0.0000,0.0000,0.7604 +0.6494,0.0000,0.0000,0.7604 +0.6494,0.0000,0.0000,0.7604 +0.6494,0.0000,0.0000,0.7604 +0.6374,0.0000,0.0000,0.7705 +0.6374,0.0000,0.0000,0.7705 +0.6374,0.0000,0.0000,0.7705 +0.6374,0.0000,0.0000,0.7705 +0.6252,0.0000,0.0000,0.7804 +0.6252,0.0000,0.0000,0.7804 +0.6252,0.0000,0.0000,0.7804 +0.6252,0.0000,0.0000,0.7804 +0.6129,0.0000,0.0000,0.7902 +0.6129,0.0000,0.0000,0.7902 +0.6129,0.0000,0.0000,0.7902 +0.6129,0.0000,0.0000,0.7902 +0.6004,0.0000,0.0000,0.7997 +0.6004,0.0000,0.0000,0.7997 +0.6004,0.0000,0.0000,0.7997 +0.6004,0.0000,0.0000,0.7997 +0.5878,0.0000,0.0000,0.8090 +0.5878,0.0000,0.0000,0.8090 +0.5878,0.0000,0.0000,0.8090 +0.5878,0.0000,0.0000,0.8090 +0.5750,0.0000,0.0000,0.8181 +0.5750,0.0000,0.0000,0.8181 +0.5750,0.0000,0.0000,0.8181 +0.5750,0.0000,0.0000,0.8181 +0.5621,0.0000,0.0000,0.8271 +0.5621,0.0000,0.0000,0.8271 +0.5621,0.0000,0.0000,0.8271 +0.5621,0.0000,0.0000,0.8271 +0.5490,0.0000,0.0000,0.8358 +0.5490,0.0000,0.0000,0.8358 +0.5490,0.0000,0.0000,0.8358 +0.5490,0.0000,0.0000,0.8358 +0.5358,0.0000,0.0000,0.8443 +0.5358,0.0000,0.0000,0.8443 +0.5358,0.0000,0.0000,0.8443 +0.5358,0.0000,0.0000,0.8443 +0.5225,0.0000,0.0000,0.8526 +0.5225,0.0000,0.0000,0.8526 +0.5225,0.0000,0.0000,0.8526 +0.5225,0.0000,0.0000,0.8526 +0.5090,0.0000,0.0000,0.8607 +0.5090,0.0000,0.0000,0.8607 +0.5090,0.0000,0.0000,0.8607 +0.5090,0.0000,0.0000,0.8607 +0.4955,0.0000,0.0000,0.8686 +0.4955,0.0000,0.0000,0.8686 +0.4955,0.0000,0.0000,0.8686 +0.4955,0.0000,0.0000,0.8686 +0.4818,0.0000,0.0000,0.8763 +0.4818,0.0000,0.0000,0.8763 +0.4818,0.0000,0.0000,0.8763 +0.4818,0.0000,0.0000,0.8763 +0.4679,0.0000,0.0000,0.8838 +0.4679,0.0000,0.0000,0.8838 +0.4679,0.0000,0.0000,0.8838 +0.4679,0.0000,0.0000,0.8838 +0.4540,0.0000,0.0000,0.8910 +0.4540,0.0000,0.0000,0.8910 +0.4540,0.0000,0.0000,0.8910 +0.4540,0.0000,0.0000,0.8910 +0.4399,0.0000,0.0000,0.8980 +0.4399,0.0000,0.0000,0.8980 +0.4399,0.0000,0.0000,0.8980 +0.4399,0.0000,0.0000,0.8980 +0.4258,0.0000,0.0000,0.9048 +0.4258,0.0000,0.0000,0.9048 +0.4258,0.0000,0.0000,0.9048 +0.4258,0.0000,0.0000,0.9048 +0.4115,0.0000,0.0000,0.9114 +0.4115,0.0000,0.0000,0.9114 +0.4115,0.0000,0.0000,0.9114 +0.4115,0.0000,0.0000,0.9114 +0.3971,0.0000,0.0000,0.9178 +0.3971,0.0000,0.0000,0.9178 +0.3971,0.0000,0.0000,0.9178 +0.3971,0.0000,0.0000,0.9178 +0.3827,0.0000,0.0000,0.9239 +0.3827,0.0000,0.0000,0.9239 +0.3827,0.0000,0.0000,0.9239 +0.3827,0.0000,0.0000,0.9239 +0.3681,0.0000,0.0000,0.9298 +0.3681,0.0000,0.0000,0.9298 +0.3681,0.0000,0.0000,0.9298 +0.3681,0.0000,0.0000,0.9298 +0.3535,0.0000,0.0000,0.9354 +0.3535,0.0000,0.0000,0.9354 +0.3535,0.0000,0.0000,0.9354 +0.3535,0.0000,0.0000,0.9354 +0.3387,0.0000,0.0000,0.9409 +0.3387,0.0000,0.0000,0.9409 +0.3387,0.0000,0.0000,0.9409 +0.3387,0.0000,0.0000,0.9409 +0.3239,0.0000,0.0000,0.9461 +0.3239,0.0000,0.0000,0.9461 +0.3239,0.0000,0.0000,0.9461 +0.3239,0.0000,0.0000,0.9461 +0.3090,0.0000,0.0000,0.9511 +0.3090,0.0000,0.0000,0.9511 +0.3090,0.0000,0.0000,0.9511 +0.3090,0.0000,0.0000,0.9511 +0.2940,0.0000,0.0000,0.9558 +0.2940,0.0000,0.0000,0.9558 +0.2940,0.0000,0.0000,0.9558 +0.2940,0.0000,0.0000,0.9558 +0.2790,0.0000,0.0000,0.9603 +0.2790,0.0000,0.0000,0.9603 +0.2790,0.0000,0.0000,0.9603 +0.2790,0.0000,0.0000,0.9603 +0.2639,0.0000,0.0000,0.9646 +0.2639,0.0000,0.0000,0.9646 +0.2639,0.0000,0.0000,0.9646 +0.2639,0.0000,0.0000,0.9646 +0.2487,0.0000,0.0000,0.9686 +0.2487,0.0000,0.0000,0.9686 +0.2487,0.0000,0.0000,0.9686 +0.2487,0.0000,0.0000,0.9686 +0.2334,0.0000,0.0000,0.9724 +0.2334,0.0000,0.0000,0.9724 +0.2334,0.0000,0.0000,0.9724 +0.2334,0.0000,0.0000,0.9724 +0.2181,0.0000,0.0000,0.9759 +0.2181,0.0000,0.0000,0.9759 +0.2181,0.0000,0.0000,0.9759 +0.2181,0.0000,0.0000,0.9759 +0.2028,0.0000,0.0000,0.9792 +0.2028,0.0000,0.0000,0.9792 +0.2028,0.0000,0.0000,0.9792 +0.2028,0.0000,0.0000,0.9792 +0.1874,0.0000,0.0000,0.9823 +0.1874,0.0000,0.0000,0.9823 +0.1874,0.0000,0.0000,0.9823 +0.1874,0.0000,0.0000,0.9823 +0.1719,0.0000,0.0000,0.9851 +0.1719,0.0000,0.0000,0.9851 +0.1719,0.0000,0.0000,0.9851 +0.1719,0.0000,0.0000,0.9851 +0.1564,0.0000,0.0000,0.9877 +0.1564,0.0000,0.0000,0.9877 +0.1564,0.0000,0.0000,0.9877 +0.1564,0.0000,0.0000,0.9877 +0.1409,0.0000,0.0000,0.9900 +0.1409,0.0000,0.0000,0.9900 +0.1409,0.0000,0.0000,0.9900 +0.1409,0.0000,0.0000,0.9900 +0.1253,0.0000,0.0000,0.9921 +0.1253,0.0000,0.0000,0.9921 +0.1253,0.0000,0.0000,0.9921 +0.1253,0.0000,0.0000,0.9921 +0.1097,0.0000,0.0000,0.9940 +0.1097,0.0000,0.0000,0.9940 +0.1097,0.0000,0.0000,0.9940 +0.1097,0.0000,0.0000,0.9940 +0.0941,0.0000,0.0000,0.9956 +0.0941,0.0000,0.0000,0.9956 +0.0941,0.0000,0.0000,0.9956 +0.0941,0.0000,0.0000,0.9956 +0.0785,0.0000,0.0000,0.9969 +0.0785,0.0000,0.0000,0.9969 +0.0785,0.0000,0.0000,0.9969 +0.0785,0.0000,0.0000,0.9969 +0.0628,0.0000,0.0000,0.9980 +0.0628,0.0000,0.0000,0.9980 +0.0628,0.0000,0.0000,0.9980 +0.0628,0.0000,0.0000,0.9980 +0.0471,0.0000,0.0000,0.9989 +0.0471,0.0000,0.0000,0.9989 +0.0471,0.0000,0.0000,0.9989 +0.0471,0.0000,0.0000,0.9989 +0.0314,0.0000,0.0000,0.9995 +0.0314,0.0000,0.0000,0.9995 +0.0314,0.0000,0.0000,0.9995 +0.0314,0.0000,0.0000,0.9995 +0.0157,0.0000,0.0000,0.9999 +0.0157,0.0000,0.0000,0.9999 +0.0157,0.0000,0.0000,0.9999 +0.0157,0.0000,0.0000,0.9999 +-0.0000,0.0000,0.0000,1.0000 +-0.0000,0.0000,0.0000,1.0000 +-0.0000,0.0000,0.0000,1.0000 +-0.0000,0.0000,0.0000,1.0000 +-0.0157,0.0000,0.0000,0.9999 +-0.0157,0.0000,0.0000,0.9999 +-0.0157,0.0000,0.0000,0.9999 +-0.0157,0.0000,0.0000,0.9999 +-0.0314,0.0000,0.0000,0.9995 +-0.0314,0.0000,0.0000,0.9995 +-0.0314,0.0000,0.0000,0.9995 +-0.0314,0.0000,0.0000,0.9995 +-0.0471,0.0000,0.0000,0.9989 +-0.0471,0.0000,0.0000,0.9989 +-0.0471,0.0000,0.0000,0.9989 +-0.0471,0.0000,0.0000,0.9989 +-0.0628,0.0000,0.0000,0.9980 +-0.0628,0.0000,0.0000,0.9980 +-0.0628,0.0000,0.0000,0.9980 +-0.0628,0.0000,0.0000,0.9980 +-0.0785,0.0000,0.0000,0.9969 +-0.0785,0.0000,0.0000,0.9969 +-0.0785,0.0000,0.0000,0.9969 +-0.0785,0.0000,0.0000,0.9969 +-0.0941,0.0000,0.0000,0.9956 +-0.0941,0.0000,0.0000,0.9956 +-0.0941,0.0000,0.0000,0.9956 +-0.0941,0.0000,0.0000,0.9956 +-0.1097,0.0000,0.0000,0.9940 +-0.1097,0.0000,0.0000,0.9940 +-0.1097,0.0000,0.0000,0.9940 +-0.1097,0.0000,0.0000,0.9940 +-0.1253,0.0000,0.0000,0.9921 +-0.1253,0.0000,0.0000,0.9921 +-0.1253,0.0000,0.0000,0.9921 +-0.1253,0.0000,0.0000,0.9921 +-0.1409,0.0000,0.0000,0.9900 +-0.1409,0.0000,0.0000,0.9900 +-0.1409,0.0000,0.0000,0.9900 +-0.1409,0.0000,0.0000,0.9900 +-0.1564,0.0000,0.0000,0.9877 +-0.1564,0.0000,0.0000,0.9877 +-0.1564,0.0000,0.0000,0.9877 +-0.1564,0.0000,0.0000,0.9877 +-0.1719,0.0000,0.0000,0.9851 +-0.1719,0.0000,0.0000,0.9851 +-0.1719,0.0000,0.0000,0.9851 +-0.1719,0.0000,0.0000,0.9851 +-0.1874,0.0000,0.0000,0.9823 +-0.1874,0.0000,0.0000,0.9823 +-0.1874,0.0000,0.0000,0.9823 +-0.1874,0.0000,0.0000,0.9823 +-0.2028,0.0000,0.0000,0.9792 +-0.2028,0.0000,0.0000,0.9792 +-0.2028,0.0000,0.0000,0.9792 +-0.2028,0.0000,0.0000,0.9792 +-0.2181,0.0000,0.0000,0.9759 +-0.2181,0.0000,0.0000,0.9759 +-0.2181,0.0000,0.0000,0.9759 +-0.2181,0.0000,0.0000,0.9759 +-0.2334,0.0000,0.0000,0.9724 +-0.2334,0.0000,0.0000,0.9724 +-0.2334,0.0000,0.0000,0.9724 +-0.2334,0.0000,0.0000,0.9724 +-0.2487,0.0000,0.0000,0.9686 +-0.2487,0.0000,0.0000,0.9686 +-0.2487,0.0000,0.0000,0.9686 +-0.2487,0.0000,0.0000,0.9686 +-0.2639,0.0000,0.0000,0.9646 +-0.2639,0.0000,0.0000,0.9646 +-0.2639,0.0000,0.0000,0.9646 +-0.2639,0.0000,0.0000,0.9646 +-0.2790,0.0000,0.0000,0.9603 +-0.2790,0.0000,0.0000,0.9603 +-0.2790,0.0000,0.0000,0.9603 +-0.2790,0.0000,0.0000,0.9603 +-0.2940,0.0000,0.0000,0.9558 +-0.2940,0.0000,0.0000,0.9558 +-0.2940,0.0000,0.0000,0.9558 +-0.2940,0.0000,0.0000,0.9558 +-0.3090,0.0000,0.0000,0.9511 +-0.3090,0.0000,0.0000,0.9511 +-0.3090,0.0000,0.0000,0.9511 +-0.3090,0.0000,0.0000,0.9511 +-0.3239,0.0000,0.0000,0.9461 +-0.3239,0.0000,0.0000,0.9461 +-0.3239,0.0000,0.0000,0.9461 +-0.3239,0.0000,0.0000,0.9461 +-0.3387,0.0000,0.0000,0.9409 +-0.3387,0.0000,0.0000,0.9409 +-0.3387,0.0000,0.0000,0.9409 +-0.3387,0.0000,0.0000,0.9409 +-0.3535,0.0000,0.0000,0.9354 +-0.3535,0.0000,0.0000,0.9354 +-0.3535,0.0000,0.0000,0.9354 +-0.3535,0.0000,0.0000,0.9354 +-0.3681,0.0000,0.0000,0.9298 +-0.3681,0.0000,0.0000,0.9298 +-0.3681,0.0000,0.0000,0.9298 +-0.3681,0.0000,0.0000,0.9298 +-0.3827,0.0000,0.0000,0.9239 +-0.3827,0.0000,0.0000,0.9239 +-0.3827,0.0000,0.0000,0.9239 +-0.3827,0.0000,0.0000,0.9239 +-0.3971,0.0000,0.0000,0.9178 +-0.3971,0.0000,0.0000,0.9178 +-0.3971,0.0000,0.0000,0.9178 +-0.3971,0.0000,0.0000,0.9178 +-0.4115,0.0000,0.0000,0.9114 +-0.4115,0.0000,0.0000,0.9114 +-0.4115,0.0000,0.0000,0.9114 +-0.4115,0.0000,0.0000,0.9114 +-0.4258,0.0000,0.0000,0.9048 +-0.4258,0.0000,0.0000,0.9048 +-0.4258,0.0000,0.0000,0.9048 +-0.4258,0.0000,0.0000,0.9048 +-0.4399,0.0000,0.0000,0.8980 +-0.4399,0.0000,0.0000,0.8980 +-0.4399,0.0000,0.0000,0.8980 +-0.4399,0.0000,0.0000,0.8980 +-0.4540,0.0000,0.0000,0.8910 +-0.4540,0.0000,0.0000,0.8910 +-0.4540,0.0000,0.0000,0.8910 +-0.4540,0.0000,0.0000,0.8910 +-0.4679,0.0000,0.0000,0.8838 +-0.4679,0.0000,0.0000,0.8838 +-0.4679,0.0000,0.0000,0.8838 +-0.4679,0.0000,0.0000,0.8838 +-0.4818,0.0000,0.0000,0.8763 +-0.4818,0.0000,0.0000,0.8763 +-0.4818,0.0000,0.0000,0.8763 +-0.4818,0.0000,0.0000,0.8763 +-0.4955,0.0000,0.0000,0.8686 +-0.4955,0.0000,0.0000,0.8686 +-0.4955,0.0000,0.0000,0.8686 +-0.4955,0.0000,0.0000,0.8686 +-0.5090,0.0000,0.0000,0.8607 +-0.5090,0.0000,0.0000,0.8607 +-0.5090,0.0000,0.0000,0.8607 +-0.5090,0.0000,0.0000,0.8607 +-0.5225,0.0000,0.0000,0.8526 +-0.5225,0.0000,0.0000,0.8526 +-0.5225,0.0000,0.0000,0.8526 +-0.5225,0.0000,0.0000,0.8526 +-0.5358,0.0000,0.0000,0.8443 +-0.5358,0.0000,0.0000,0.8443 +-0.5358,0.0000,0.0000,0.8443 +-0.5358,0.0000,0.0000,0.8443 +-0.5490,0.0000,0.0000,0.8358 +-0.5490,0.0000,0.0000,0.8358 +-0.5490,0.0000,0.0000,0.8358 +-0.5490,0.0000,0.0000,0.8358 +-0.5621,0.0000,0.0000,0.8271 +-0.5621,0.0000,0.0000,0.8271 +-0.5621,0.0000,0.0000,0.8271 +-0.5621,0.0000,0.0000,0.8271 +-0.5750,0.0000,0.0000,0.8181 +-0.5750,0.0000,0.0000,0.8181 +-0.5750,0.0000,0.0000,0.8181 +-0.5750,0.0000,0.0000,0.8181 +-0.5878,0.0000,0.0000,0.8090 +-0.5878,0.0000,0.0000,0.8090 +-0.5878,0.0000,0.0000,0.8090 +-0.5878,0.0000,0.0000,0.8090 +-0.6004,0.0000,0.0000,0.7997 +-0.6004,0.0000,0.0000,0.7997 +-0.6004,0.0000,0.0000,0.7997 +-0.6004,0.0000,0.0000,0.7997 +-0.6129,0.0000,0.0000,0.7902 +-0.6129,0.0000,0.0000,0.7902 +-0.6129,0.0000,0.0000,0.7902 +-0.6129,0.0000,0.0000,0.7902 +-0.6252,0.0000,0.0000,0.7804 +-0.6252,0.0000,0.0000,0.7804 +-0.6252,0.0000,0.0000,0.7804 +-0.6252,0.0000,0.0000,0.7804 +-0.6374,0.0000,0.0000,0.7705 +-0.6374,0.0000,0.0000,0.7705 +-0.6374,0.0000,0.0000,0.7705 +-0.6374,0.0000,0.0000,0.7705 +-0.6494,0.0000,0.0000,0.7604 +-0.6494,0.0000,0.0000,0.7604 +-0.6494,0.0000,0.0000,0.7604 +-0.6494,0.0000,0.0000,0.7604 +-0.6613,0.0000,0.0000,0.7501 +-0.6613,0.0000,0.0000,0.7501 +-0.6613,0.0000,0.0000,0.7501 +-0.6613,0.0000,0.0000,0.7501 +-0.6730,0.0000,0.0000,0.7396 +-0.6730,0.0000,0.0000,0.7396 +-0.6730,0.0000,0.0000,0.7396 +-0.6730,0.0000,0.0000,0.7396 +-0.6845,0.0000,0.0000,0.7290 +-0.6845,0.0000,0.0000,0.7290 +-0.6845,0.0000,0.0000,0.7290 +-0.6845,0.0000,0.0000,0.7290 +-0.6959,0.0000,0.0000,0.7181 +-0.6959,0.0000,0.0000,0.7181 +-0.6959,0.0000,0.0000,0.7181 +-0.6959,0.0000,0.0000,0.7181 +-0.7071,0.0000,0.0000,0.7071 +-0.7071,0.0000,0.0000,0.7071 +-0.7071,0.0000,0.0000,0.7071 +-0.7071,0.0000,0.0000,0.7071 +-0.7181,0.0000,0.0000,0.6959 +-0.7181,0.0000,0.0000,0.6959 +-0.7181,0.0000,0.0000,0.6959 +-0.7181,0.0000,0.0000,0.6959 +-0.7290,0.0000,0.0000,0.6845 +-0.7290,0.0000,0.0000,0.6845 +-0.7290,0.0000,0.0000,0.6845 +-0.7290,0.0000,0.0000,0.6845 +-0.7396,0.0000,0.0000,0.6730 +-0.7396,0.0000,0.0000,0.6730 +-0.7396,0.0000,0.0000,0.6730 +-0.7396,0.0000,0.0000,0.6730 +-0.7501,0.0000,0.0000,0.6613 +-0.7501,0.0000,0.0000,0.6613 +-0.7501,0.0000,0.0000,0.6613 +-0.7501,0.0000,0.0000,0.6613 +-0.7604,0.0000,0.0000,0.6494 +-0.7604,0.0000,0.0000,0.6494 +-0.7604,0.0000,0.0000,0.6494 +-0.7604,0.0000,0.0000,0.6494 +-0.7705,0.0000,0.0000,0.6374 +-0.7705,0.0000,0.0000,0.6374 +-0.7705,0.0000,0.0000,0.6374 +-0.7705,0.0000,0.0000,0.6374 +-0.7804,0.0000,0.0000,0.6252 +-0.7804,0.0000,0.0000,0.6252 +-0.7804,0.0000,0.0000,0.6252 +-0.7804,0.0000,0.0000,0.6252 +-0.7902,0.0000,0.0000,0.6129 +-0.7902,0.0000,0.0000,0.6129 +-0.7902,0.0000,0.0000,0.6129 +-0.7902,0.0000,0.0000,0.6129 +-0.7997,0.0000,0.0000,0.6004 +-0.7997,0.0000,0.0000,0.6004 +-0.7997,0.0000,0.0000,0.6004 +-0.7997,0.0000,0.0000,0.6004 +-0.8090,0.0000,0.0000,0.5878 +-0.8090,0.0000,0.0000,0.5878 +-0.8090,0.0000,0.0000,0.5878 +-0.8090,0.0000,0.0000,0.5878 +-0.8182,0.0000,0.0000,0.5750 +-0.8182,0.0000,0.0000,0.5750 +-0.8182,0.0000,0.0000,0.5750 +-0.8182,0.0000,0.0000,0.5750 +-0.8271,0.0000,0.0000,0.5621 +-0.8271,0.0000,0.0000,0.5621 +-0.8271,0.0000,0.0000,0.5621 +-0.8271,0.0000,0.0000,0.5621 +-0.8358,0.0000,0.0000,0.5490 +-0.8358,0.0000,0.0000,0.5490 +-0.8358,0.0000,0.0000,0.5490 +-0.8358,0.0000,0.0000,0.5490 +-0.8443,0.0000,0.0000,0.5358 +-0.8443,0.0000,0.0000,0.5358 +-0.8443,0.0000,0.0000,0.5358 +-0.8443,0.0000,0.0000,0.5358 +-0.8526,0.0000,0.0000,0.5225 +-0.8526,0.0000,0.0000,0.5225 +-0.8526,0.0000,0.0000,0.5225 +-0.8526,0.0000,0.0000,0.5225 +-0.8607,0.0000,0.0000,0.5090 +-0.8607,0.0000,0.0000,0.5090 +-0.8607,0.0000,0.0000,0.5090 +-0.8607,0.0000,0.0000,0.5090 +-0.8686,0.0000,0.0000,0.4955 +-0.8686,0.0000,0.0000,0.4955 +-0.8686,0.0000,0.0000,0.4955 +-0.8686,0.0000,0.0000,0.4955 +-0.8763,0.0000,0.0000,0.4818 +-0.8763,0.0000,0.0000,0.4818 +-0.8763,0.0000,0.0000,0.4818 +-0.8763,0.0000,0.0000,0.4818 +-0.8838,0.0000,0.0000,0.4679 +-0.8838,0.0000,0.0000,0.4679 +-0.8838,0.0000,0.0000,0.4679 +-0.8838,0.0000,0.0000,0.4679 +-0.8910,0.0000,0.0000,0.4540 +-0.8910,0.0000,0.0000,0.4540 +-0.8910,0.0000,0.0000,0.4540 +-0.8910,0.0000,0.0000,0.4540 +-0.8980,0.0000,0.0000,0.4399 +-0.8980,0.0000,0.0000,0.4399 +-0.8980,0.0000,0.0000,0.4399 +-0.8980,0.0000,0.0000,0.4399 +-0.9048,0.0000,0.0000,0.4258 +-0.9048,0.0000,0.0000,0.4258 +-0.9048,0.0000,0.0000,0.4258 +-0.9048,0.0000,0.0000,0.4258 +-0.9114,0.0000,0.0000,0.4115 +-0.9114,0.0000,0.0000,0.4115 +-0.9114,0.0000,0.0000,0.4115 +-0.9114,0.0000,0.0000,0.4115 +-0.9178,0.0000,0.0000,0.3971 +-0.9178,0.0000,0.0000,0.3971 +-0.9178,0.0000,0.0000,0.3971 +-0.9178,0.0000,0.0000,0.3971 +-0.9239,0.0000,0.0000,0.3827 +-0.9239,0.0000,0.0000,0.3827 +-0.9239,0.0000,0.0000,0.3827 +-0.9239,0.0000,0.0000,0.3827 +-0.9298,0.0000,0.0000,0.3681 +-0.9298,0.0000,0.0000,0.3681 +-0.9298,0.0000,0.0000,0.3681 +-0.9298,0.0000,0.0000,0.3681 +-0.9354,0.0000,0.0000,0.3535 +-0.9354,0.0000,0.0000,0.3535 +-0.9354,0.0000,0.0000,0.3535 +-0.9354,0.0000,0.0000,0.3535 +-0.9409,0.0000,0.0000,0.3387 +-0.9409,0.0000,0.0000,0.3387 +-0.9409,0.0000,0.0000,0.3387 +-0.9409,0.0000,0.0000,0.3387 +-0.9461,0.0000,0.0000,0.3239 +-0.9461,0.0000,0.0000,0.3239 +-0.9461,0.0000,0.0000,0.3239 +-0.9461,0.0000,0.0000,0.3239 +-0.9511,0.0000,0.0000,0.3090 +-0.9511,0.0000,0.0000,0.3090 +-0.9511,0.0000,0.0000,0.3090 +-0.9511,0.0000,0.0000,0.3090 +-0.9558,0.0000,0.0000,0.2940 +-0.9558,0.0000,0.0000,0.2940 +-0.9558,0.0000,0.0000,0.2940 +-0.9558,0.0000,0.0000,0.2940 +-0.9603,0.0000,0.0000,0.2790 +-0.9603,0.0000,0.0000,0.2790 +-0.9603,0.0000,0.0000,0.2790 +-0.9603,0.0000,0.0000,0.2790 +-0.9646,0.0000,0.0000,0.2639 +-0.9646,0.0000,0.0000,0.2639 +-0.9646,0.0000,0.0000,0.2639 +-0.9646,0.0000,0.0000,0.2639 +-0.9686,0.0000,0.0000,0.2487 +-0.9686,0.0000,0.0000,0.2487 +-0.9686,0.0000,0.0000,0.2487 +-0.9686,0.0000,0.0000,0.2487 +-0.9724,0.0000,0.0000,0.2334 +-0.9724,0.0000,0.0000,0.2334 +-0.9724,0.0000,0.0000,0.2334 +-0.9724,0.0000,0.0000,0.2334 +-0.9759,0.0000,0.0000,0.2181 +-0.9759,0.0000,0.0000,0.2181 +-0.9759,0.0000,0.0000,0.2181 +-0.9759,0.0000,0.0000,0.2181 +-0.9792,0.0000,0.0000,0.2028 +-0.9792,0.0000,0.0000,0.2028 +-0.9792,0.0000,0.0000,0.2028 +-0.9792,0.0000,0.0000,0.2028 +-0.9823,0.0000,0.0000,0.1874 +-0.9823,0.0000,0.0000,0.1874 +-0.9823,0.0000,0.0000,0.1874 +-0.9823,0.0000,0.0000,0.1874 +-0.9851,0.0000,0.0000,0.1719 +-0.9851,0.0000,0.0000,0.1719 +-0.9851,0.0000,0.0000,0.1719 +-0.9851,0.0000,0.0000,0.1719 +-0.9877,0.0000,0.0000,0.1564 +-0.9877,0.0000,0.0000,0.1564 +-0.9877,0.0000,0.0000,0.1564 +-0.9877,0.0000,0.0000,0.1564 +-0.9900,0.0000,0.0000,0.1409 +-0.9900,0.0000,0.0000,0.1409 +-0.9900,0.0000,0.0000,0.1409 +-0.9900,0.0000,0.0000,0.1409 +-0.9921,0.0000,0.0000,0.1253 +-0.9921,0.0000,0.0000,0.1253 +-0.9921,0.0000,0.0000,0.1253 +-0.9921,0.0000,0.0000,0.1253 +-0.9940,0.0000,0.0000,0.1097 +-0.9940,0.0000,0.0000,0.1097 +-0.9940,0.0000,0.0000,0.1097 +-0.9940,0.0000,0.0000,0.1097 +-0.9956,0.0000,0.0000,0.0941 +-0.9956,0.0000,0.0000,0.0941 +-0.9956,0.0000,0.0000,0.0941 +-0.9956,0.0000,0.0000,0.0941 +-0.9969,0.0000,0.0000,0.0785 +-0.9969,0.0000,0.0000,0.0785 +-0.9969,0.0000,0.0000,0.0785 +-0.9969,0.0000,0.0000,0.0785 +-0.9980,0.0000,0.0000,0.0628 +-0.9980,0.0000,0.0000,0.0628 +-0.9980,0.0000,0.0000,0.0628 +-0.9980,0.0000,0.0000,0.0628 +-0.9989,0.0000,0.0000,0.0471 +-0.9989,0.0000,0.0000,0.0471 +-0.9989,0.0000,0.0000,0.0471 +-0.9989,0.0000,0.0000,0.0471 +-0.9995,0.0000,0.0000,0.0314 +-0.9995,0.0000,0.0000,0.0314 +-0.9995,0.0000,0.0000,0.0314 +-0.9995,0.0000,0.0000,0.0314 +-0.9999,0.0000,0.0000,0.0157 +-0.9999,0.0000,0.0000,0.0157 +-0.9999,0.0000,0.0000,0.0157 +-0.9999,0.0000,0.0000,0.0157 +1.0000,0.0000,0.0000,0.0000 +1.0000,0.0000,0.0000,0.0000 +1.0000,0.0000,0.0000,0.0000 +1.0000,0.0000,0.0000,0.0000 diff --git a/scripts/trajectories/full-circle-4s.csv b/scripts/trajectories/full-circle-4s.csv new file mode 100644 index 0000000000000000000000000000000000000000..4174a531b7e4b7ed785105d18fcfe2d5d195c035 --- /dev/null +++ b/scripts/trajectories/full-circle-4s.csv @@ -0,0 +1,800 @@ +0.9999,0.0000,0.0000,-0.0157 +0.9999,0.0000,0.0000,-0.0157 +0.9999,0.0000,0.0000,-0.0157 +0.9999,0.0000,0.0000,-0.0157 +0.9995,0.0000,0.0000,-0.0314 +0.9995,0.0000,0.0000,-0.0314 +0.9995,0.0000,0.0000,-0.0314 +0.9995,0.0000,0.0000,-0.0314 +0.9989,0.0000,0.0000,-0.0471 +0.9989,0.0000,0.0000,-0.0471 +0.9989,0.0000,0.0000,-0.0471 +0.9989,0.0000,0.0000,-0.0471 +0.9980,0.0000,0.0000,-0.0628 +0.9980,0.0000,0.0000,-0.0628 +0.9980,0.0000,0.0000,-0.0628 +0.9980,0.0000,0.0000,-0.0628 +0.9969,0.0000,0.0000,-0.0785 +0.9969,0.0000,0.0000,-0.0785 +0.9969,0.0000,0.0000,-0.0785 +0.9969,0.0000,0.0000,-0.0785 +0.9956,0.0000,0.0000,-0.0941 +0.9956,0.0000,0.0000,-0.0941 +0.9956,0.0000,0.0000,-0.0941 +0.9956,0.0000,0.0000,-0.0941 +0.9940,0.0000,0.0000,-0.1097 +0.9940,0.0000,0.0000,-0.1097 +0.9940,0.0000,0.0000,-0.1097 +0.9940,0.0000,0.0000,-0.1097 +0.9921,0.0000,0.0000,-0.1253 +0.9921,0.0000,0.0000,-0.1253 +0.9921,0.0000,0.0000,-0.1253 +0.9921,0.0000,0.0000,-0.1253 +0.9900,0.0000,0.0000,-0.1409 +0.9900,0.0000,0.0000,-0.1409 +0.9900,0.0000,0.0000,-0.1409 +0.9900,0.0000,0.0000,-0.1409 +0.9877,0.0000,0.0000,-0.1564 +0.9877,0.0000,0.0000,-0.1564 +0.9877,0.0000,0.0000,-0.1564 +0.9877,0.0000,0.0000,-0.1564 +0.9851,0.0000,0.0000,-0.1719 +0.9851,0.0000,0.0000,-0.1719 +0.9851,0.0000,0.0000,-0.1719 +0.9851,0.0000,0.0000,-0.1719 +0.9823,0.0000,0.0000,-0.1874 +0.9823,0.0000,0.0000,-0.1874 +0.9823,0.0000,0.0000,-0.1874 +0.9823,0.0000,0.0000,-0.1874 +0.9792,0.0000,0.0000,-0.2028 +0.9792,0.0000,0.0000,-0.2028 +0.9792,0.0000,0.0000,-0.2028 +0.9792,0.0000,0.0000,-0.2028 +0.9759,0.0000,0.0000,-0.2181 +0.9759,0.0000,0.0000,-0.2181 +0.9759,0.0000,0.0000,-0.2181 +0.9759,0.0000,0.0000,-0.2181 +0.9724,0.0000,0.0000,-0.2334 +0.9724,0.0000,0.0000,-0.2334 +0.9724,0.0000,0.0000,-0.2334 +0.9724,0.0000,0.0000,-0.2334 +0.9686,0.0000,0.0000,-0.2487 +0.9686,0.0000,0.0000,-0.2487 +0.9686,0.0000,0.0000,-0.2487 +0.9686,0.0000,0.0000,-0.2487 +0.9646,0.0000,0.0000,-0.2639 +0.9646,0.0000,0.0000,-0.2639 +0.9646,0.0000,0.0000,-0.2639 +0.9646,0.0000,0.0000,-0.2639 +0.9603,0.0000,0.0000,-0.2790 +0.9603,0.0000,0.0000,-0.2790 +0.9603,0.0000,0.0000,-0.2790 +0.9603,0.0000,0.0000,-0.2790 +0.9558,0.0000,0.0000,-0.2940 +0.9558,0.0000,0.0000,-0.2940 +0.9558,0.0000,0.0000,-0.2940 +0.9558,0.0000,0.0000,-0.2940 +0.9511,0.0000,0.0000,-0.3090 +0.9511,0.0000,0.0000,-0.3090 +0.9511,0.0000,0.0000,-0.3090 +0.9511,0.0000,0.0000,-0.3090 +0.9461,0.0000,0.0000,-0.3239 +0.9461,0.0000,0.0000,-0.3239 +0.9461,0.0000,0.0000,-0.3239 +0.9461,0.0000,0.0000,-0.3239 +0.9409,0.0000,0.0000,-0.3387 +0.9409,0.0000,0.0000,-0.3387 +0.9409,0.0000,0.0000,-0.3387 +0.9409,0.0000,0.0000,-0.3387 +0.9354,0.0000,0.0000,-0.3535 +0.9354,0.0000,0.0000,-0.3535 +0.9354,0.0000,0.0000,-0.3535 +0.9354,0.0000,0.0000,-0.3535 +0.9298,0.0000,0.0000,-0.3681 +0.9298,0.0000,0.0000,-0.3681 +0.9298,0.0000,0.0000,-0.3681 +0.9298,0.0000,0.0000,-0.3681 +0.9239,0.0000,0.0000,-0.3827 +0.9239,0.0000,0.0000,-0.3827 +0.9239,0.0000,0.0000,-0.3827 +0.9239,0.0000,0.0000,-0.3827 +0.9178,0.0000,0.0000,-0.3971 +0.9178,0.0000,0.0000,-0.3971 +0.9178,0.0000,0.0000,-0.3971 +0.9178,0.0000,0.0000,-0.3971 +0.9114,0.0000,0.0000,-0.4115 +0.9114,0.0000,0.0000,-0.4115 +0.9114,0.0000,0.0000,-0.4115 +0.9114,0.0000,0.0000,-0.4115 +0.9048,0.0000,0.0000,-0.4258 +0.9048,0.0000,0.0000,-0.4258 +0.9048,0.0000,0.0000,-0.4258 +0.9048,0.0000,0.0000,-0.4258 +0.8980,0.0000,0.0000,-0.4399 +0.8980,0.0000,0.0000,-0.4399 +0.8980,0.0000,0.0000,-0.4399 +0.8980,0.0000,0.0000,-0.4399 +0.8910,0.0000,0.0000,-0.4540 +0.8910,0.0000,0.0000,-0.4540 +0.8910,0.0000,0.0000,-0.4540 +0.8910,0.0000,0.0000,-0.4540 +0.8838,0.0000,0.0000,-0.4679 +0.8838,0.0000,0.0000,-0.4679 +0.8838,0.0000,0.0000,-0.4679 +0.8838,0.0000,0.0000,-0.4679 +0.8763,0.0000,0.0000,-0.4818 +0.8763,0.0000,0.0000,-0.4818 +0.8763,0.0000,0.0000,-0.4818 +0.8763,0.0000,0.0000,-0.4818 +0.8686,0.0000,0.0000,-0.4955 +0.8686,0.0000,0.0000,-0.4955 +0.8686,0.0000,0.0000,-0.4955 +0.8686,0.0000,0.0000,-0.4955 +0.8607,0.0000,0.0000,-0.5090 +0.8607,0.0000,0.0000,-0.5090 +0.8607,0.0000,0.0000,-0.5090 +0.8607,0.0000,0.0000,-0.5090 +0.8526,0.0000,0.0000,-0.5225 +0.8526,0.0000,0.0000,-0.5225 +0.8526,0.0000,0.0000,-0.5225 +0.8526,0.0000,0.0000,-0.5225 +0.8443,0.0000,0.0000,-0.5358 +0.8443,0.0000,0.0000,-0.5358 +0.8443,0.0000,0.0000,-0.5358 +0.8443,0.0000,0.0000,-0.5358 +0.8358,0.0000,0.0000,-0.5490 +0.8358,0.0000,0.0000,-0.5490 +0.8358,0.0000,0.0000,-0.5490 +0.8358,0.0000,0.0000,-0.5490 +0.8271,0.0000,0.0000,-0.5621 +0.8271,0.0000,0.0000,-0.5621 +0.8271,0.0000,0.0000,-0.5621 +0.8271,0.0000,0.0000,-0.5621 +0.8181,0.0000,0.0000,-0.5750 +0.8181,0.0000,0.0000,-0.5750 +0.8181,0.0000,0.0000,-0.5750 +0.8181,0.0000,0.0000,-0.5750 +0.8090,0.0000,0.0000,-0.5878 +0.8090,0.0000,0.0000,-0.5878 +0.8090,0.0000,0.0000,-0.5878 +0.8090,0.0000,0.0000,-0.5878 +0.7997,0.0000,0.0000,-0.6004 +0.7997,0.0000,0.0000,-0.6004 +0.7997,0.0000,0.0000,-0.6004 +0.7997,0.0000,0.0000,-0.6004 +0.7902,0.0000,0.0000,-0.6129 +0.7902,0.0000,0.0000,-0.6129 +0.7902,0.0000,0.0000,-0.6129 +0.7902,0.0000,0.0000,-0.6129 +0.7804,0.0000,0.0000,-0.6252 +0.7804,0.0000,0.0000,-0.6252 +0.7804,0.0000,0.0000,-0.6252 +0.7804,0.0000,0.0000,-0.6252 +0.7705,0.0000,0.0000,-0.6374 +0.7705,0.0000,0.0000,-0.6374 +0.7705,0.0000,0.0000,-0.6374 +0.7705,0.0000,0.0000,-0.6374 +0.7604,0.0000,0.0000,-0.6494 +0.7604,0.0000,0.0000,-0.6494 +0.7604,0.0000,0.0000,-0.6494 +0.7604,0.0000,0.0000,-0.6494 +0.7501,0.0000,0.0000,-0.6613 +0.7501,0.0000,0.0000,-0.6613 +0.7501,0.0000,0.0000,-0.6613 +0.7501,0.0000,0.0000,-0.6613 +0.7396,0.0000,0.0000,-0.6730 +0.7396,0.0000,0.0000,-0.6730 +0.7396,0.0000,0.0000,-0.6730 +0.7396,0.0000,0.0000,-0.6730 +0.7290,0.0000,0.0000,-0.6845 +0.7290,0.0000,0.0000,-0.6845 +0.7290,0.0000,0.0000,-0.6845 +0.7290,0.0000,0.0000,-0.6845 +0.7181,0.0000,0.0000,-0.6959 +0.7181,0.0000,0.0000,-0.6959 +0.7181,0.0000,0.0000,-0.6959 +0.7181,0.0000,0.0000,-0.6959 +0.7071,0.0000,0.0000,-0.7071 +0.7071,0.0000,0.0000,-0.7071 +0.7071,0.0000,0.0000,-0.7071 +0.7071,0.0000,0.0000,-0.7071 +0.6959,0.0000,0.0000,-0.7181 +0.6959,0.0000,0.0000,-0.7181 +0.6959,0.0000,0.0000,-0.7181 +0.6959,0.0000,0.0000,-0.7181 +0.6845,0.0000,0.0000,-0.7290 +0.6845,0.0000,0.0000,-0.7290 +0.6845,0.0000,0.0000,-0.7290 +0.6845,0.0000,0.0000,-0.7290 +0.6730,0.0000,0.0000,-0.7396 +0.6730,0.0000,0.0000,-0.7396 +0.6730,0.0000,0.0000,-0.7396 +0.6730,0.0000,0.0000,-0.7396 +0.6613,0.0000,0.0000,-0.7501 +0.6613,0.0000,0.0000,-0.7501 +0.6613,0.0000,0.0000,-0.7501 +0.6613,0.0000,0.0000,-0.7501 +0.6494,0.0000,0.0000,-0.7604 +0.6494,0.0000,0.0000,-0.7604 +0.6494,0.0000,0.0000,-0.7604 +0.6494,0.0000,0.0000,-0.7604 +0.6374,0.0000,0.0000,-0.7705 +0.6374,0.0000,0.0000,-0.7705 +0.6374,0.0000,0.0000,-0.7705 +0.6374,0.0000,0.0000,-0.7705 +0.6252,0.0000,0.0000,-0.7804 +0.6252,0.0000,0.0000,-0.7804 +0.6252,0.0000,0.0000,-0.7804 +0.6252,0.0000,0.0000,-0.7804 +0.6129,0.0000,0.0000,-0.7902 +0.6129,0.0000,0.0000,-0.7902 +0.6129,0.0000,0.0000,-0.7902 +0.6129,0.0000,0.0000,-0.7902 +0.6004,0.0000,0.0000,-0.7997 +0.6004,0.0000,0.0000,-0.7997 +0.6004,0.0000,0.0000,-0.7997 +0.6004,0.0000,0.0000,-0.7997 +0.5878,0.0000,0.0000,-0.8090 +0.5878,0.0000,0.0000,-0.8090 +0.5878,0.0000,0.0000,-0.8090 +0.5878,0.0000,0.0000,-0.8090 +0.5750,0.0000,0.0000,-0.8181 +0.5750,0.0000,0.0000,-0.8181 +0.5750,0.0000,0.0000,-0.8181 +0.5750,0.0000,0.0000,-0.8181 +0.5621,0.0000,0.0000,-0.8271 +0.5621,0.0000,0.0000,-0.8271 +0.5621,0.0000,0.0000,-0.8271 +0.5621,0.0000,0.0000,-0.8271 +0.5490,0.0000,0.0000,-0.8358 +0.5490,0.0000,0.0000,-0.8358 +0.5490,0.0000,0.0000,-0.8358 +0.5490,0.0000,0.0000,-0.8358 +0.5358,0.0000,0.0000,-0.8443 +0.5358,0.0000,0.0000,-0.8443 +0.5358,0.0000,0.0000,-0.8443 +0.5358,0.0000,0.0000,-0.8443 +0.5225,0.0000,0.0000,-0.8526 +0.5225,0.0000,0.0000,-0.8526 +0.5225,0.0000,0.0000,-0.8526 +0.5225,0.0000,0.0000,-0.8526 +0.5090,0.0000,0.0000,-0.8607 +0.5090,0.0000,0.0000,-0.8607 +0.5090,0.0000,0.0000,-0.8607 +0.5090,0.0000,0.0000,-0.8607 +0.4955,0.0000,0.0000,-0.8686 +0.4955,0.0000,0.0000,-0.8686 +0.4955,0.0000,0.0000,-0.8686 +0.4955,0.0000,0.0000,-0.8686 +0.4818,0.0000,0.0000,-0.8763 +0.4818,0.0000,0.0000,-0.8763 +0.4818,0.0000,0.0000,-0.8763 +0.4818,0.0000,0.0000,-0.8763 +0.4679,0.0000,0.0000,-0.8838 +0.4679,0.0000,0.0000,-0.8838 +0.4679,0.0000,0.0000,-0.8838 +0.4679,0.0000,0.0000,-0.8838 +0.4540,0.0000,0.0000,-0.8910 +0.4540,0.0000,0.0000,-0.8910 +0.4540,0.0000,0.0000,-0.8910 +0.4540,0.0000,0.0000,-0.8910 +0.4399,0.0000,0.0000,-0.8980 +0.4399,0.0000,0.0000,-0.8980 +0.4399,0.0000,0.0000,-0.8980 +0.4399,0.0000,0.0000,-0.8980 +0.4258,0.0000,0.0000,-0.9048 +0.4258,0.0000,0.0000,-0.9048 +0.4258,0.0000,0.0000,-0.9048 +0.4258,0.0000,0.0000,-0.9048 +0.4115,0.0000,0.0000,-0.9114 +0.4115,0.0000,0.0000,-0.9114 +0.4115,0.0000,0.0000,-0.9114 +0.4115,0.0000,0.0000,-0.9114 +0.3971,0.0000,0.0000,-0.9178 +0.3971,0.0000,0.0000,-0.9178 +0.3971,0.0000,0.0000,-0.9178 +0.3971,0.0000,0.0000,-0.9178 +0.3827,0.0000,0.0000,-0.9239 +0.3827,0.0000,0.0000,-0.9239 +0.3827,0.0000,0.0000,-0.9239 +0.3827,0.0000,0.0000,-0.9239 +0.3681,0.0000,0.0000,-0.9298 +0.3681,0.0000,0.0000,-0.9298 +0.3681,0.0000,0.0000,-0.9298 +0.3681,0.0000,0.0000,-0.9298 +0.3535,0.0000,0.0000,-0.9354 +0.3535,0.0000,0.0000,-0.9354 +0.3535,0.0000,0.0000,-0.9354 +0.3535,0.0000,0.0000,-0.9354 +0.3387,0.0000,0.0000,-0.9409 +0.3387,0.0000,0.0000,-0.9409 +0.3387,0.0000,0.0000,-0.9409 +0.3387,0.0000,0.0000,-0.9409 +0.3239,0.0000,0.0000,-0.9461 +0.3239,0.0000,0.0000,-0.9461 +0.3239,0.0000,0.0000,-0.9461 +0.3239,0.0000,0.0000,-0.9461 +0.3090,0.0000,0.0000,-0.9511 +0.3090,0.0000,0.0000,-0.9511 +0.3090,0.0000,0.0000,-0.9511 +0.3090,0.0000,0.0000,-0.9511 +0.2940,0.0000,0.0000,-0.9558 +0.2940,0.0000,0.0000,-0.9558 +0.2940,0.0000,0.0000,-0.9558 +0.2940,0.0000,0.0000,-0.9558 +0.2790,0.0000,0.0000,-0.9603 +0.2790,0.0000,0.0000,-0.9603 +0.2790,0.0000,0.0000,-0.9603 +0.2790,0.0000,0.0000,-0.9603 +0.2639,0.0000,0.0000,-0.9646 +0.2639,0.0000,0.0000,-0.9646 +0.2639,0.0000,0.0000,-0.9646 +0.2639,0.0000,0.0000,-0.9646 +0.2487,0.0000,0.0000,-0.9686 +0.2487,0.0000,0.0000,-0.9686 +0.2487,0.0000,0.0000,-0.9686 +0.2487,0.0000,0.0000,-0.9686 +0.2334,0.0000,0.0000,-0.9724 +0.2334,0.0000,0.0000,-0.9724 +0.2334,0.0000,0.0000,-0.9724 +0.2334,0.0000,0.0000,-0.9724 +0.2181,0.0000,0.0000,-0.9759 +0.2181,0.0000,0.0000,-0.9759 +0.2181,0.0000,0.0000,-0.9759 +0.2181,0.0000,0.0000,-0.9759 +0.2028,0.0000,0.0000,-0.9792 +0.2028,0.0000,0.0000,-0.9792 +0.2028,0.0000,0.0000,-0.9792 +0.2028,0.0000,0.0000,-0.9792 +0.1874,0.0000,0.0000,-0.9823 +0.1874,0.0000,0.0000,-0.9823 +0.1874,0.0000,0.0000,-0.9823 +0.1874,0.0000,0.0000,-0.9823 +0.1719,0.0000,0.0000,-0.9851 +0.1719,0.0000,0.0000,-0.9851 +0.1719,0.0000,0.0000,-0.9851 +0.1719,0.0000,0.0000,-0.9851 +0.1564,0.0000,0.0000,-0.9877 +0.1564,0.0000,0.0000,-0.9877 +0.1564,0.0000,0.0000,-0.9877 +0.1564,0.0000,0.0000,-0.9877 +0.1409,0.0000,0.0000,-0.9900 +0.1409,0.0000,0.0000,-0.9900 +0.1409,0.0000,0.0000,-0.9900 +0.1409,0.0000,0.0000,-0.9900 +0.1253,0.0000,0.0000,-0.9921 +0.1253,0.0000,0.0000,-0.9921 +0.1253,0.0000,0.0000,-0.9921 +0.1253,0.0000,0.0000,-0.9921 +0.1097,0.0000,0.0000,-0.9940 +0.1097,0.0000,0.0000,-0.9940 +0.1097,0.0000,0.0000,-0.9940 +0.1097,0.0000,0.0000,-0.9940 +0.0941,0.0000,0.0000,-0.9956 +0.0941,0.0000,0.0000,-0.9956 +0.0941,0.0000,0.0000,-0.9956 +0.0941,0.0000,0.0000,-0.9956 +0.0785,0.0000,0.0000,-0.9969 +0.0785,0.0000,0.0000,-0.9969 +0.0785,0.0000,0.0000,-0.9969 +0.0785,0.0000,0.0000,-0.9969 +0.0628,0.0000,0.0000,-0.9980 +0.0628,0.0000,0.0000,-0.9980 +0.0628,0.0000,0.0000,-0.9980 +0.0628,0.0000,0.0000,-0.9980 +0.0471,0.0000,0.0000,-0.9989 +0.0471,0.0000,0.0000,-0.9989 +0.0471,0.0000,0.0000,-0.9989 +0.0471,0.0000,0.0000,-0.9989 +0.0314,0.0000,0.0000,-0.9995 +0.0314,0.0000,0.0000,-0.9995 +0.0314,0.0000,0.0000,-0.9995 +0.0314,0.0000,0.0000,-0.9995 +0.0157,0.0000,0.0000,-0.9999 +0.0157,0.0000,0.0000,-0.9999 +0.0157,0.0000,0.0000,-0.9999 +0.0157,0.0000,0.0000,-0.9999 +-0.0000,0.0000,0.0000,-1.0000 +-0.0000,0.0000,0.0000,-1.0000 +-0.0000,0.0000,0.0000,-1.0000 +-0.0000,0.0000,0.0000,-1.0000 +-0.0157,0.0000,0.0000,-0.9999 +-0.0157,0.0000,0.0000,-0.9999 +-0.0157,0.0000,0.0000,-0.9999 +-0.0157,0.0000,0.0000,-0.9999 +-0.0314,0.0000,0.0000,-0.9995 +-0.0314,0.0000,0.0000,-0.9995 +-0.0314,0.0000,0.0000,-0.9995 +-0.0314,0.0000,0.0000,-0.9995 +-0.0471,0.0000,0.0000,-0.9989 +-0.0471,0.0000,0.0000,-0.9989 +-0.0471,0.0000,0.0000,-0.9989 +-0.0471,0.0000,0.0000,-0.9989 +-0.0628,0.0000,0.0000,-0.9980 +-0.0628,0.0000,0.0000,-0.9980 +-0.0628,0.0000,0.0000,-0.9980 +-0.0628,0.0000,0.0000,-0.9980 +-0.0785,0.0000,0.0000,-0.9969 +-0.0785,0.0000,0.0000,-0.9969 +-0.0785,0.0000,0.0000,-0.9969 +-0.0785,0.0000,0.0000,-0.9969 +-0.0941,0.0000,0.0000,-0.9956 +-0.0941,0.0000,0.0000,-0.9956 +-0.0941,0.0000,0.0000,-0.9956 +-0.0941,0.0000,0.0000,-0.9956 +-0.1097,0.0000,0.0000,-0.9940 +-0.1097,0.0000,0.0000,-0.9940 +-0.1097,0.0000,0.0000,-0.9940 +-0.1097,0.0000,0.0000,-0.9940 +-0.1253,0.0000,0.0000,-0.9921 +-0.1253,0.0000,0.0000,-0.9921 +-0.1253,0.0000,0.0000,-0.9921 +-0.1253,0.0000,0.0000,-0.9921 +-0.1409,0.0000,0.0000,-0.9900 +-0.1409,0.0000,0.0000,-0.9900 +-0.1409,0.0000,0.0000,-0.9900 +-0.1409,0.0000,0.0000,-0.9900 +-0.1564,0.0000,0.0000,-0.9877 +-0.1564,0.0000,0.0000,-0.9877 +-0.1564,0.0000,0.0000,-0.9877 +-0.1564,0.0000,0.0000,-0.9877 +-0.1719,0.0000,0.0000,-0.9851 +-0.1719,0.0000,0.0000,-0.9851 +-0.1719,0.0000,0.0000,-0.9851 +-0.1719,0.0000,0.0000,-0.9851 +-0.1874,0.0000,0.0000,-0.9823 +-0.1874,0.0000,0.0000,-0.9823 +-0.1874,0.0000,0.0000,-0.9823 +-0.1874,0.0000,0.0000,-0.9823 +-0.2028,0.0000,0.0000,-0.9792 +-0.2028,0.0000,0.0000,-0.9792 +-0.2028,0.0000,0.0000,-0.9792 +-0.2028,0.0000,0.0000,-0.9792 +-0.2181,0.0000,0.0000,-0.9759 +-0.2181,0.0000,0.0000,-0.9759 +-0.2181,0.0000,0.0000,-0.9759 +-0.2181,0.0000,0.0000,-0.9759 +-0.2334,0.0000,0.0000,-0.9724 +-0.2334,0.0000,0.0000,-0.9724 +-0.2334,0.0000,0.0000,-0.9724 +-0.2334,0.0000,0.0000,-0.9724 +-0.2487,0.0000,0.0000,-0.9686 +-0.2487,0.0000,0.0000,-0.9686 +-0.2487,0.0000,0.0000,-0.9686 +-0.2487,0.0000,0.0000,-0.9686 +-0.2639,0.0000,0.0000,-0.9646 +-0.2639,0.0000,0.0000,-0.9646 +-0.2639,0.0000,0.0000,-0.9646 +-0.2639,0.0000,0.0000,-0.9646 +-0.2790,0.0000,0.0000,-0.9603 +-0.2790,0.0000,0.0000,-0.9603 +-0.2790,0.0000,0.0000,-0.9603 +-0.2790,0.0000,0.0000,-0.9603 +-0.2940,0.0000,0.0000,-0.9558 +-0.2940,0.0000,0.0000,-0.9558 +-0.2940,0.0000,0.0000,-0.9558 +-0.2940,0.0000,0.0000,-0.9558 +-0.3090,0.0000,0.0000,-0.9511 +-0.3090,0.0000,0.0000,-0.9511 +-0.3090,0.0000,0.0000,-0.9511 +-0.3090,0.0000,0.0000,-0.9511 +-0.3239,0.0000,0.0000,-0.9461 +-0.3239,0.0000,0.0000,-0.9461 +-0.3239,0.0000,0.0000,-0.9461 +-0.3239,0.0000,0.0000,-0.9461 +-0.3387,0.0000,0.0000,-0.9409 +-0.3387,0.0000,0.0000,-0.9409 +-0.3387,0.0000,0.0000,-0.9409 +-0.3387,0.0000,0.0000,-0.9409 +-0.3535,0.0000,0.0000,-0.9354 +-0.3535,0.0000,0.0000,-0.9354 +-0.3535,0.0000,0.0000,-0.9354 +-0.3535,0.0000,0.0000,-0.9354 +-0.3681,0.0000,0.0000,-0.9298 +-0.3681,0.0000,0.0000,-0.9298 +-0.3681,0.0000,0.0000,-0.9298 +-0.3681,0.0000,0.0000,-0.9298 +-0.3827,0.0000,0.0000,-0.9239 +-0.3827,0.0000,0.0000,-0.9239 +-0.3827,0.0000,0.0000,-0.9239 +-0.3827,0.0000,0.0000,-0.9239 +-0.3971,0.0000,0.0000,-0.9178 +-0.3971,0.0000,0.0000,-0.9178 +-0.3971,0.0000,0.0000,-0.9178 +-0.3971,0.0000,0.0000,-0.9178 +-0.4115,0.0000,0.0000,-0.9114 +-0.4115,0.0000,0.0000,-0.9114 +-0.4115,0.0000,0.0000,-0.9114 +-0.4115,0.0000,0.0000,-0.9114 +-0.4258,0.0000,0.0000,-0.9048 +-0.4258,0.0000,0.0000,-0.9048 +-0.4258,0.0000,0.0000,-0.9048 +-0.4258,0.0000,0.0000,-0.9048 +-0.4399,0.0000,0.0000,-0.8980 +-0.4399,0.0000,0.0000,-0.8980 +-0.4399,0.0000,0.0000,-0.8980 +-0.4399,0.0000,0.0000,-0.8980 +-0.4540,0.0000,0.0000,-0.8910 +-0.4540,0.0000,0.0000,-0.8910 +-0.4540,0.0000,0.0000,-0.8910 +-0.4540,0.0000,0.0000,-0.8910 +-0.4679,0.0000,0.0000,-0.8838 +-0.4679,0.0000,0.0000,-0.8838 +-0.4679,0.0000,0.0000,-0.8838 +-0.4679,0.0000,0.0000,-0.8838 +-0.4818,0.0000,0.0000,-0.8763 +-0.4818,0.0000,0.0000,-0.8763 +-0.4818,0.0000,0.0000,-0.8763 +-0.4818,0.0000,0.0000,-0.8763 +-0.4955,0.0000,0.0000,-0.8686 +-0.4955,0.0000,0.0000,-0.8686 +-0.4955,0.0000,0.0000,-0.8686 +-0.4955,0.0000,0.0000,-0.8686 +-0.5090,0.0000,0.0000,-0.8607 +-0.5090,0.0000,0.0000,-0.8607 +-0.5090,0.0000,0.0000,-0.8607 +-0.5090,0.0000,0.0000,-0.8607 +-0.5225,0.0000,0.0000,-0.8526 +-0.5225,0.0000,0.0000,-0.8526 +-0.5225,0.0000,0.0000,-0.8526 +-0.5225,0.0000,0.0000,-0.8526 +-0.5358,0.0000,0.0000,-0.8443 +-0.5358,0.0000,0.0000,-0.8443 +-0.5358,0.0000,0.0000,-0.8443 +-0.5358,0.0000,0.0000,-0.8443 +-0.5490,0.0000,0.0000,-0.8358 +-0.5490,0.0000,0.0000,-0.8358 +-0.5490,0.0000,0.0000,-0.8358 +-0.5490,0.0000,0.0000,-0.8358 +-0.5621,0.0000,0.0000,-0.8271 +-0.5621,0.0000,0.0000,-0.8271 +-0.5621,0.0000,0.0000,-0.8271 +-0.5621,0.0000,0.0000,-0.8271 +-0.5750,0.0000,0.0000,-0.8181 +-0.5750,0.0000,0.0000,-0.8181 +-0.5750,0.0000,0.0000,-0.8181 +-0.5750,0.0000,0.0000,-0.8181 +-0.5878,0.0000,0.0000,-0.8090 +-0.5878,0.0000,0.0000,-0.8090 +-0.5878,0.0000,0.0000,-0.8090 +-0.5878,0.0000,0.0000,-0.8090 +-0.6004,0.0000,0.0000,-0.7997 +-0.6004,0.0000,0.0000,-0.7997 +-0.6004,0.0000,0.0000,-0.7997 +-0.6004,0.0000,0.0000,-0.7997 +-0.6129,0.0000,0.0000,-0.7902 +-0.6129,0.0000,0.0000,-0.7902 +-0.6129,0.0000,0.0000,-0.7902 +-0.6129,0.0000,0.0000,-0.7902 +-0.6252,0.0000,0.0000,-0.7804 +-0.6252,0.0000,0.0000,-0.7804 +-0.6252,0.0000,0.0000,-0.7804 +-0.6252,0.0000,0.0000,-0.7804 +-0.6374,0.0000,0.0000,-0.7705 +-0.6374,0.0000,0.0000,-0.7705 +-0.6374,0.0000,0.0000,-0.7705 +-0.6374,0.0000,0.0000,-0.7705 +-0.6494,0.0000,0.0000,-0.7604 +-0.6494,0.0000,0.0000,-0.7604 +-0.6494,0.0000,0.0000,-0.7604 +-0.6494,0.0000,0.0000,-0.7604 +-0.6613,0.0000,0.0000,-0.7501 +-0.6613,0.0000,0.0000,-0.7501 +-0.6613,0.0000,0.0000,-0.7501 +-0.6613,0.0000,0.0000,-0.7501 +-0.6730,0.0000,0.0000,-0.7396 +-0.6730,0.0000,0.0000,-0.7396 +-0.6730,0.0000,0.0000,-0.7396 +-0.6730,0.0000,0.0000,-0.7396 +-0.6845,0.0000,0.0000,-0.7290 +-0.6845,0.0000,0.0000,-0.7290 +-0.6845,0.0000,0.0000,-0.7290 +-0.6845,0.0000,0.0000,-0.7290 +-0.6959,0.0000,0.0000,-0.7181 +-0.6959,0.0000,0.0000,-0.7181 +-0.6959,0.0000,0.0000,-0.7181 +-0.6959,0.0000,0.0000,-0.7181 +-0.7071,0.0000,0.0000,-0.7071 +-0.7071,0.0000,0.0000,-0.7071 +-0.7071,0.0000,0.0000,-0.7071 +-0.7071,0.0000,0.0000,-0.7071 +-0.7181,0.0000,0.0000,-0.6959 +-0.7181,0.0000,0.0000,-0.6959 +-0.7181,0.0000,0.0000,-0.6959 +-0.7181,0.0000,0.0000,-0.6959 +-0.7290,0.0000,0.0000,-0.6845 +-0.7290,0.0000,0.0000,-0.6845 +-0.7290,0.0000,0.0000,-0.6845 +-0.7290,0.0000,0.0000,-0.6845 +-0.7396,0.0000,0.0000,-0.6730 +-0.7396,0.0000,0.0000,-0.6730 +-0.7396,0.0000,0.0000,-0.6730 +-0.7396,0.0000,0.0000,-0.6730 +-0.7501,0.0000,0.0000,-0.6613 +-0.7501,0.0000,0.0000,-0.6613 +-0.7501,0.0000,0.0000,-0.6613 +-0.7501,0.0000,0.0000,-0.6613 +-0.7604,0.0000,0.0000,-0.6494 +-0.7604,0.0000,0.0000,-0.6494 +-0.7604,0.0000,0.0000,-0.6494 +-0.7604,0.0000,0.0000,-0.6494 +-0.7705,0.0000,0.0000,-0.6374 +-0.7705,0.0000,0.0000,-0.6374 +-0.7705,0.0000,0.0000,-0.6374 +-0.7705,0.0000,0.0000,-0.6374 +-0.7804,0.0000,0.0000,-0.6252 +-0.7804,0.0000,0.0000,-0.6252 +-0.7804,0.0000,0.0000,-0.6252 +-0.7804,0.0000,0.0000,-0.6252 +-0.7902,0.0000,0.0000,-0.6129 +-0.7902,0.0000,0.0000,-0.6129 +-0.7902,0.0000,0.0000,-0.6129 +-0.7902,0.0000,0.0000,-0.6129 +-0.7997,0.0000,0.0000,-0.6004 +-0.7997,0.0000,0.0000,-0.6004 +-0.7997,0.0000,0.0000,-0.6004 +-0.7997,0.0000,0.0000,-0.6004 +-0.8090,0.0000,0.0000,-0.5878 +-0.8090,0.0000,0.0000,-0.5878 +-0.8090,0.0000,0.0000,-0.5878 +-0.8090,0.0000,0.0000,-0.5878 +-0.8182,0.0000,0.0000,-0.5750 +-0.8182,0.0000,0.0000,-0.5750 +-0.8182,0.0000,0.0000,-0.5750 +-0.8182,0.0000,0.0000,-0.5750 +-0.8271,0.0000,0.0000,-0.5621 +-0.8271,0.0000,0.0000,-0.5621 +-0.8271,0.0000,0.0000,-0.5621 +-0.8271,0.0000,0.0000,-0.5621 +-0.8358,0.0000,0.0000,-0.5490 +-0.8358,0.0000,0.0000,-0.5490 +-0.8358,0.0000,0.0000,-0.5490 +-0.8358,0.0000,0.0000,-0.5490 +-0.8443,0.0000,0.0000,-0.5358 +-0.8443,0.0000,0.0000,-0.5358 +-0.8443,0.0000,0.0000,-0.5358 +-0.8443,0.0000,0.0000,-0.5358 +-0.8526,0.0000,0.0000,-0.5225 +-0.8526,0.0000,0.0000,-0.5225 +-0.8526,0.0000,0.0000,-0.5225 +-0.8526,0.0000,0.0000,-0.5225 +-0.8607,0.0000,0.0000,-0.5090 +-0.8607,0.0000,0.0000,-0.5090 +-0.8607,0.0000,0.0000,-0.5090 +-0.8607,0.0000,0.0000,-0.5090 +-0.8686,0.0000,0.0000,-0.4955 +-0.8686,0.0000,0.0000,-0.4955 +-0.8686,0.0000,0.0000,-0.4955 +-0.8686,0.0000,0.0000,-0.4955 +-0.8763,0.0000,0.0000,-0.4818 +-0.8763,0.0000,0.0000,-0.4818 +-0.8763,0.0000,0.0000,-0.4818 +-0.8763,0.0000,0.0000,-0.4818 +-0.8838,0.0000,0.0000,-0.4679 +-0.8838,0.0000,0.0000,-0.4679 +-0.8838,0.0000,0.0000,-0.4679 +-0.8838,0.0000,0.0000,-0.4679 +-0.8910,0.0000,0.0000,-0.4540 +-0.8910,0.0000,0.0000,-0.4540 +-0.8910,0.0000,0.0000,-0.4540 +-0.8910,0.0000,0.0000,-0.4540 +-0.8980,0.0000,0.0000,-0.4399 +-0.8980,0.0000,0.0000,-0.4399 +-0.8980,0.0000,0.0000,-0.4399 +-0.8980,0.0000,0.0000,-0.4399 +-0.9048,0.0000,0.0000,-0.4258 +-0.9048,0.0000,0.0000,-0.4258 +-0.9048,0.0000,0.0000,-0.4258 +-0.9048,0.0000,0.0000,-0.4258 +-0.9114,0.0000,0.0000,-0.4115 +-0.9114,0.0000,0.0000,-0.4115 +-0.9114,0.0000,0.0000,-0.4115 +-0.9114,0.0000,0.0000,-0.4115 +-0.9178,0.0000,0.0000,-0.3971 +-0.9178,0.0000,0.0000,-0.3971 +-0.9178,0.0000,0.0000,-0.3971 +-0.9178,0.0000,0.0000,-0.3971 +-0.9239,0.0000,0.0000,-0.3827 +-0.9239,0.0000,0.0000,-0.3827 +-0.9239,0.0000,0.0000,-0.3827 +-0.9239,0.0000,0.0000,-0.3827 +-0.9298,0.0000,0.0000,-0.3681 +-0.9298,0.0000,0.0000,-0.3681 +-0.9298,0.0000,0.0000,-0.3681 +-0.9298,0.0000,0.0000,-0.3681 +-0.9354,0.0000,0.0000,-0.3535 +-0.9354,0.0000,0.0000,-0.3535 +-0.9354,0.0000,0.0000,-0.3535 +-0.9354,0.0000,0.0000,-0.3535 +-0.9409,0.0000,0.0000,-0.3387 +-0.9409,0.0000,0.0000,-0.3387 +-0.9409,0.0000,0.0000,-0.3387 +-0.9409,0.0000,0.0000,-0.3387 +-0.9461,0.0000,0.0000,-0.3239 +-0.9461,0.0000,0.0000,-0.3239 +-0.9461,0.0000,0.0000,-0.3239 +-0.9461,0.0000,0.0000,-0.3239 +-0.9511,0.0000,0.0000,-0.3090 +-0.9511,0.0000,0.0000,-0.3090 +-0.9511,0.0000,0.0000,-0.3090 +-0.9511,0.0000,0.0000,-0.3090 +-0.9558,0.0000,0.0000,-0.2940 +-0.9558,0.0000,0.0000,-0.2940 +-0.9558,0.0000,0.0000,-0.2940 +-0.9558,0.0000,0.0000,-0.2940 +-0.9603,0.0000,0.0000,-0.2790 +-0.9603,0.0000,0.0000,-0.2790 +-0.9603,0.0000,0.0000,-0.2790 +-0.9603,0.0000,0.0000,-0.2790 +-0.9646,0.0000,0.0000,-0.2639 +-0.9646,0.0000,0.0000,-0.2639 +-0.9646,0.0000,0.0000,-0.2639 +-0.9646,0.0000,0.0000,-0.2639 +-0.9686,0.0000,0.0000,-0.2487 +-0.9686,0.0000,0.0000,-0.2487 +-0.9686,0.0000,0.0000,-0.2487 +-0.9686,0.0000,0.0000,-0.2487 +-0.9724,0.0000,0.0000,-0.2334 +-0.9724,0.0000,0.0000,-0.2334 +-0.9724,0.0000,0.0000,-0.2334 +-0.9724,0.0000,0.0000,-0.2334 +-0.9759,0.0000,0.0000,-0.2181 +-0.9759,0.0000,0.0000,-0.2181 +-0.9759,0.0000,0.0000,-0.2181 +-0.9759,0.0000,0.0000,-0.2181 +-0.9792,0.0000,0.0000,-0.2028 +-0.9792,0.0000,0.0000,-0.2028 +-0.9792,0.0000,0.0000,-0.2028 +-0.9792,0.0000,0.0000,-0.2028 +-0.9823,0.0000,0.0000,-0.1874 +-0.9823,0.0000,0.0000,-0.1874 +-0.9823,0.0000,0.0000,-0.1874 +-0.9823,0.0000,0.0000,-0.1874 +-0.9851,0.0000,0.0000,-0.1719 +-0.9851,0.0000,0.0000,-0.1719 +-0.9851,0.0000,0.0000,-0.1719 +-0.9851,0.0000,0.0000,-0.1719 +-0.9877,0.0000,0.0000,-0.1564 +-0.9877,0.0000,0.0000,-0.1564 +-0.9877,0.0000,0.0000,-0.1564 +-0.9877,0.0000,0.0000,-0.1564 +-0.9900,0.0000,0.0000,-0.1409 +-0.9900,0.0000,0.0000,-0.1409 +-0.9900,0.0000,0.0000,-0.1409 +-0.9900,0.0000,0.0000,-0.1409 +-0.9921,0.0000,0.0000,-0.1253 +-0.9921,0.0000,0.0000,-0.1253 +-0.9921,0.0000,0.0000,-0.1253 +-0.9921,0.0000,0.0000,-0.1253 +-0.9940,0.0000,0.0000,-0.1097 +-0.9940,0.0000,0.0000,-0.1097 +-0.9940,0.0000,0.0000,-0.1097 +-0.9940,0.0000,0.0000,-0.1097 +-0.9956,0.0000,0.0000,-0.0941 +-0.9956,0.0000,0.0000,-0.0941 +-0.9956,0.0000,0.0000,-0.0941 +-0.9956,0.0000,0.0000,-0.0941 +-0.9969,0.0000,0.0000,-0.0785 +-0.9969,0.0000,0.0000,-0.0785 +-0.9969,0.0000,0.0000,-0.0785 +-0.9969,0.0000,0.0000,-0.0785 +-0.9980,0.0000,0.0000,-0.0628 +-0.9980,0.0000,0.0000,-0.0628 +-0.9980,0.0000,0.0000,-0.0628 +-0.9980,0.0000,0.0000,-0.0628 +-0.9989,0.0000,0.0000,-0.0471 +-0.9989,0.0000,0.0000,-0.0471 +-0.9989,0.0000,0.0000,-0.0471 +-0.9989,0.0000,0.0000,-0.0471 +-0.9995,0.0000,0.0000,-0.0314 +-0.9995,0.0000,0.0000,-0.0314 +-0.9995,0.0000,0.0000,-0.0314 +-0.9995,0.0000,0.0000,-0.0314 +-0.9999,0.0000,0.0000,-0.0157 +-0.9999,0.0000,0.0000,-0.0157 +-0.9999,0.0000,0.0000,-0.0157 +-0.9999,0.0000,0.0000,-0.0157 +1.0000,0.0000,0.0000,-0.0000 +1.0000,0.0000,0.0000,-0.0000 +1.0000,0.0000,0.0000,-0.0000 +1.0000,0.0000,0.0000,-0.0000 diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv b/scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv new file mode 100644 index 0000000000000000000000000000000000000000..8fe2d2fe05d8e71170104a79cf3d50315ea722c8 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s-Vector3.csv @@ -0,0 +1,200 @@ +0.0000,0.0000,0.0000,0.7012,-0.0220,-0.7126 +0.0000,0.0000,0.0000,0.7057,-0.0444,-0.7071 +0.0000,0.0000,0.0000,0.7095,-0.0671,-0.7015 +0.0000,0.0000,0.0000,0.7125,-0.0900,-0.6959 +0.0000,0.0000,0.0000,0.7147,-0.1132,-0.6903 +0.0000,0.0000,0.0000,0.7161,-0.1366,-0.6845 +0.0000,0.0000,0.0000,0.7166,-0.1602,-0.6788 +0.0000,0.0000,0.0000,0.7164,-0.1839,-0.6730 +0.0000,0.0000,0.0000,0.7153,-0.2078,-0.6672 +0.0000,0.0000,0.0000,0.7134,-0.2318,-0.6613 +0.0000,0.0000,0.0000,0.7106,-0.2558,-0.6554 +0.0000,0.0000,0.0000,0.7070,-0.2799,-0.6494 +0.0000,0.0000,0.0000,0.7025,-0.3040,-0.6435 +0.0000,0.0000,0.0000,0.6972,-0.3281,-0.6374 +0.0000,0.0000,0.0000,0.6910,-0.3521,-0.6314 +0.0000,0.0000,0.0000,0.6839,-0.3760,-0.6252 +0.0000,0.0000,0.0000,0.6760,-0.3998,-0.6191 +0.0000,0.0000,0.0000,0.6671,-0.4234,-0.6129 +0.0000,0.0000,0.0000,0.6575,-0.4468,-0.6067 +0.0000,0.0000,0.0000,0.6470,-0.4700,-0.6004 +0.0000,0.0000,0.0000,0.6356,-0.4930,-0.5941 +0.0000,0.0000,0.0000,0.6234,-0.5157,-0.5878 +0.0000,0.0000,0.0000,0.6103,-0.5380,-0.5814 +0.0000,0.0000,0.0000,0.5964,-0.5601,-0.5750 +0.0000,0.0000,0.0000,0.5817,-0.5817,-0.5686 +0.0000,0.0000,0.0000,0.5662,-0.6029,-0.5621 +0.0000,0.0000,0.0000,0.5499,-0.6237,-0.5556 +0.0000,0.0000,0.0000,0.5328,-0.6440,-0.5490 +0.0000,0.0000,0.0000,0.5149,-0.6638,-0.5424 +0.0000,0.0000,0.0000,0.4963,-0.6831,-0.5358 +0.0000,0.0000,0.0000,0.4769,-0.7018,-0.5292 +0.0000,0.0000,0.0000,0.4569,-0.7199,-0.5225 +0.0000,0.0000,0.0000,0.4361,-0.7374,-0.5158 +0.0000,0.0000,0.0000,0.4147,-0.7543,-0.5090 +0.0000,0.0000,0.0000,0.3926,-0.7705,-0.5023 +0.0000,0.0000,0.0000,0.3698,-0.7860,-0.4955 +0.0000,0.0000,0.0000,0.3465,-0.8007,-0.4886 +0.0000,0.0000,0.0000,0.3226,-0.8148,-0.4818 +0.0000,0.0000,0.0000,0.2981,-0.8280,-0.4749 +0.0000,0.0000,0.0000,0.2731,-0.8405,-0.4679 +0.0000,0.0000,0.0000,0.2476,-0.8522,-0.4610 +0.0000,0.0000,0.0000,0.2216,-0.8630,-0.4540 +0.0000,0.0000,0.0000,0.1951,-0.8730,-0.4470 +0.0000,0.0000,0.0000,0.1683,-0.8821,-0.4399 +0.0000,0.0000,0.0000,0.1410,-0.8904,-0.4329 +0.0000,0.0000,0.0000,0.1134,-0.8977,-0.4258 +0.0000,0.0000,0.0000,0.0855,-0.9041,-0.4187 +0.0000,0.0000,0.0000,0.0572,-0.9096,-0.4115 +0.0000,0.0000,0.0000,0.0287,-0.9142,-0.4043 +0.0000,0.0000,0.0000,-0.0000,-0.9178,-0.3971 +0.0000,0.0000,0.0000,-0.0289,-0.9204,-0.3899 +0.0000,0.0000,0.0000,-0.0580,-0.9221,-0.3827 +0.0000,0.0000,0.0000,-0.0872,-0.9227,-0.3754 +0.0000,0.0000,0.0000,-0.1165,-0.9224,-0.3681 +0.0000,0.0000,0.0000,-0.1459,-0.9212,-0.3608 +0.0000,0.0000,0.0000,-0.1753,-0.9189,-0.3535 +0.0000,0.0000,0.0000,-0.2047,-0.9156,-0.3461 +0.0000,0.0000,0.0000,-0.2340,-0.9113,-0.3387 +0.0000,0.0000,0.0000,-0.2632,-0.9060,-0.3313 +0.0000,0.0000,0.0000,-0.2924,-0.8998,-0.3239 +0.0000,0.0000,0.0000,-0.3213,-0.8925,-0.3165 +0.0000,0.0000,0.0000,-0.3501,-0.8843,-0.3090 +0.0000,0.0000,0.0000,-0.3787,-0.8750,-0.3015 +0.0000,0.0000,0.0000,-0.4070,-0.8648,-0.2940 +0.0000,0.0000,0.0000,-0.4350,-0.8536,-0.2865 +0.0000,0.0000,0.0000,-0.4626,-0.8415,-0.2790 +0.0000,0.0000,0.0000,-0.4899,-0.8284,-0.2714 +0.0000,0.0000,0.0000,-0.5168,-0.8144,-0.2639 +0.0000,0.0000,0.0000,-0.5433,-0.7995,-0.2563 +0.0000,0.0000,0.0000,-0.5693,-0.7836,-0.2487 +0.0000,0.0000,0.0000,-0.5948,-0.7669,-0.2411 +0.0000,0.0000,0.0000,-0.6198,-0.7492,-0.2334 +0.0000,0.0000,0.0000,-0.6442,-0.7307,-0.2258 +0.0000,0.0000,0.0000,-0.6681,-0.7114,-0.2181 +0.0000,0.0000,0.0000,-0.6913,-0.6913,-0.2105 +0.0000,0.0000,0.0000,-0.7138,-0.6703,-0.2028 +0.0000,0.0000,0.0000,-0.7357,-0.6486,-0.1951 +0.0000,0.0000,0.0000,-0.7569,-0.6261,-0.1874 +0.0000,0.0000,0.0000,-0.7773,-0.6029,-0.1797 +0.0000,0.0000,0.0000,-0.7970,-0.5790,-0.1719 +0.0000,0.0000,0.0000,-0.8159,-0.5545,-0.1642 +0.0000,0.0000,0.0000,-0.8339,-0.5292,-0.1564 +0.0000,0.0000,0.0000,-0.8512,-0.5034,-0.1487 +0.0000,0.0000,0.0000,-0.8676,-0.4769,-0.1409 +0.0000,0.0000,0.0000,-0.8831,-0.4499,-0.1331 +0.0000,0.0000,0.0000,-0.8977,-0.4224,-0.1253 +0.0000,0.0000,0.0000,-0.9114,-0.3944,-0.1175 +0.0000,0.0000,0.0000,-0.9242,-0.3659,-0.1097 +0.0000,0.0000,0.0000,-0.9360,-0.3370,-0.1019 +0.0000,0.0000,0.0000,-0.9468,-0.3076,-0.0941 +0.0000,0.0000,0.0000,-0.9567,-0.2779,-0.0863 +0.0000,0.0000,0.0000,-0.9656,-0.2479,-0.0785 +0.0000,0.0000,0.0000,-0.9735,-0.2176,-0.0706 +0.0000,0.0000,0.0000,-0.9803,-0.1870,-0.0628 +0.0000,0.0000,0.0000,-0.9862,-0.1562,-0.0549 +0.0000,0.0000,0.0000,-0.9910,-0.1252,-0.0471 +0.0000,0.0000,0.0000,-0.9948,-0.0940,-0.0393 +0.0000,0.0000,0.0000,-0.9975,-0.0628,-0.0314 +0.0000,0.0000,0.0000,-0.9992,-0.0314,-0.0236 +0.0000,0.0000,0.0000,-0.9999,0.0000,-0.0157 +0.0000,0.0000,0.0000,-0.9995,0.0314,-0.0079 +0.0000,0.0000,0.0000,-0.9980,0.0628,0.0000 +0.0000,0.0000,0.0000,-0.9955,0.0941,0.0079 +0.0000,0.0000,0.0000,-0.9920,0.1253,0.0157 +0.0000,0.0000,0.0000,-0.9874,0.1564,0.0236 +0.0000,0.0000,0.0000,-0.9818,0.1873,0.0314 +0.0000,0.0000,0.0000,-0.9752,0.2180,0.0393 +0.0000,0.0000,0.0000,-0.9675,0.2484,0.0471 +0.0000,0.0000,0.0000,-0.9588,0.2786,0.0550 +0.0000,0.0000,0.0000,-0.9492,0.3084,0.0628 +0.0000,0.0000,0.0000,-0.9385,0.3379,0.0706 +0.0000,0.0000,0.0000,-0.9269,0.3670,0.0785 +0.0000,0.0000,0.0000,-0.9143,0.3957,0.0863 +0.0000,0.0000,0.0000,-0.9008,0.4239,0.0941 +0.0000,0.0000,0.0000,-0.8864,0.4516,0.1019 +0.0000,0.0000,0.0000,-0.8710,0.4788,0.1097 +0.0000,0.0000,0.0000,-0.8548,0.5055,0.1175 +0.0000,0.0000,0.0000,-0.8377,0.5316,0.1253 +0.0000,0.0000,0.0000,-0.8197,0.5571,0.1331 +0.0000,0.0000,0.0000,-0.8009,0.5819,0.1409 +0.0000,0.0000,0.0000,-0.7814,0.6061,0.1487 +0.0000,0.0000,0.0000,-0.7610,0.6296,0.1564 +0.0000,0.0000,0.0000,-0.7399,0.6523,0.1642 +0.0000,0.0000,0.0000,-0.7181,0.6744,0.1719 +0.0000,0.0000,0.0000,-0.6956,0.6956,0.1797 +0.0000,0.0000,0.0000,-0.6724,0.7161,0.1874 +0.0000,0.0000,0.0000,-0.6486,0.7357,0.1951 +0.0000,0.0000,0.0000,-0.6242,0.7545,0.2028 +0.0000,0.0000,0.0000,-0.5992,0.7725,0.2105 +0.0000,0.0000,0.0000,-0.5736,0.7895,0.2181 +0.0000,0.0000,0.0000,-0.5476,0.8057,0.2258 +0.0000,0.0000,0.0000,-0.5210,0.8210,0.2334 +0.0000,0.0000,0.0000,-0.4940,0.8354,0.2411 +0.0000,0.0000,0.0000,-0.4666,0.8488,0.2487 +0.0000,0.0000,0.0000,-0.4388,0.8612,0.2563 +0.0000,0.0000,0.0000,-0.4107,0.8728,0.2639 +0.0000,0.0000,0.0000,-0.3822,0.8833,0.2714 +0.0000,0.0000,0.0000,-0.3535,0.8929,0.2790 +0.0000,0.0000,0.0000,-0.3245,0.9014,0.2865 +0.0000,0.0000,0.0000,-0.2954,0.9090,0.2940 +0.0000,0.0000,0.0000,-0.2660,0.9156,0.3015 +0.0000,0.0000,0.0000,-0.2365,0.9212,0.3090 +0.0000,0.0000,0.0000,-0.2069,0.9258,0.3165 +0.0000,0.0000,0.0000,-0.1773,0.9293,0.3239 +0.0000,0.0000,0.0000,-0.1476,0.9319,0.3313 +0.0000,0.0000,0.0000,-0.1179,0.9335,0.3387 +0.0000,0.0000,0.0000,-0.0883,0.9340,0.3461 +0.0000,0.0000,0.0000,-0.0587,0.9336,0.3535 +0.0000,0.0000,0.0000,-0.0293,0.9322,0.3608 +0.0000,0.0000,0.0000,0.0000,0.9298,0.3681 +0.0000,0.0000,0.0000,0.0291,0.9264,0.3754 +0.0000,0.0000,0.0000,0.0580,0.9221,0.3827 +0.0000,0.0000,0.0000,0.0867,0.9168,0.3899 +0.0000,0.0000,0.0000,0.1150,0.9105,0.3971 +0.0000,0.0000,0.0000,0.1431,0.9033,0.4043 +0.0000,0.0000,0.0000,0.1708,0.8953,0.4115 +0.0000,0.0000,0.0000,0.1981,0.8863,0.4187 +0.0000,0.0000,0.0000,0.2250,0.8764,0.4258 +0.0000,0.0000,0.0000,0.2515,0.8657,0.4329 +0.0000,0.0000,0.0000,0.2775,0.8541,0.4399 +0.0000,0.0000,0.0000,0.3030,0.8417,0.4470 +0.0000,0.0000,0.0000,0.3280,0.8284,0.4540 +0.0000,0.0000,0.0000,0.3524,0.8144,0.4610 +0.0000,0.0000,0.0000,0.3763,0.7997,0.4679 +0.0000,0.0000,0.0000,0.3995,0.7841,0.4749 +0.0000,0.0000,0.0000,0.4222,0.7679,0.4818 +0.0000,0.0000,0.0000,0.4441,0.7510,0.4886 +0.0000,0.0000,0.0000,0.4654,0.7334,0.4955 +0.0000,0.0000,0.0000,0.4860,0.7152,0.5023 +0.0000,0.0000,0.0000,0.5059,0.6964,0.5090 +0.0000,0.0000,0.0000,0.5251,0.6769,0.5158 +0.0000,0.0000,0.0000,0.5435,0.6570,0.5225 +0.0000,0.0000,0.0000,0.5611,0.6365,0.5292 +0.0000,0.0000,0.0000,0.5780,0.6155,0.5358 +0.0000,0.0000,0.0000,0.5940,0.5940,0.5424 +0.0000,0.0000,0.0000,0.6093,0.5721,0.5490 +0.0000,0.0000,0.0000,0.6237,0.5499,0.5556 +0.0000,0.0000,0.0000,0.6373,0.5272,0.5621 +0.0000,0.0000,0.0000,0.6500,0.5042,0.5686 +0.0000,0.0000,0.0000,0.6619,0.4809,0.5750 +0.0000,0.0000,0.0000,0.6729,0.4573,0.5814 +0.0000,0.0000,0.0000,0.6831,0.4335,0.5878 +0.0000,0.0000,0.0000,0.6924,0.4095,0.5941 +0.0000,0.0000,0.0000,0.7008,0.3852,0.6004 +0.0000,0.0000,0.0000,0.7083,0.3609,0.6067 +0.0000,0.0000,0.0000,0.7150,0.3364,0.6129 +0.0000,0.0000,0.0000,0.7207,0.3119,0.6191 +0.0000,0.0000,0.0000,0.7256,0.2873,0.6252 +0.0000,0.0000,0.0000,0.7296,0.2627,0.6314 +0.0000,0.0000,0.0000,0.7328,0.2381,0.6374 +0.0000,0.0000,0.0000,0.7351,0.2136,0.6435 +0.0000,0.0000,0.0000,0.7365,0.1891,0.6494 +0.0000,0.0000,0.0000,0.7371,0.1648,0.6554 +0.0000,0.0000,0.0000,0.7368,0.1406,0.6613 +0.0000,0.0000,0.0000,0.7357,0.1165,0.6672 +0.0000,0.0000,0.0000,0.7338,0.0927,0.6730 +0.0000,0.0000,0.0000,0.7311,0.0691,0.6788 +0.0000,0.0000,0.0000,0.7275,0.0458,0.6845 +0.0000,0.0000,0.0000,0.7232,0.0227,0.6903 +0.0000,0.0000,0.0000,0.7181,-0.0000,0.6959 diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s-ccw-Vector3.csv b/scripts/trajectories/full-circle-with-up-and-down-4s-ccw-Vector3.csv new file mode 100644 index 0000000000000000000000000000000000000000..63108890206963dbde169465283d8eb28796fc68 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s-ccw-Vector3.csv @@ -0,0 +1,200 @@ +0.0000,0.0000,0.0000,0.7012,0.0220,0.7126 +0.0000,0.0000,0.0000,0.7057,0.0444,0.7071 +0.0000,0.0000,0.0000,0.7095,0.0671,0.7015 +0.0000,0.0000,0.0000,0.7125,0.0900,0.6959 +0.0000,0.0000,0.0000,0.7147,0.1132,0.6903 +0.0000,0.0000,0.0000,0.7161,0.1366,0.6845 +0.0000,0.0000,0.0000,0.7166,0.1602,0.6788 +0.0000,0.0000,0.0000,0.7164,0.1839,0.6730 +0.0000,0.0000,0.0000,0.7153,0.2078,0.6672 +0.0000,0.0000,0.0000,0.7134,0.2318,0.6613 +0.0000,0.0000,0.0000,0.7106,0.2558,0.6554 +0.0000,0.0000,0.0000,0.7070,0.2799,0.6494 +0.0000,0.0000,0.0000,0.7025,0.3040,0.6435 +0.0000,0.0000,0.0000,0.6972,0.3281,0.6374 +0.0000,0.0000,0.0000,0.6910,0.3521,0.6314 +0.0000,0.0000,0.0000,0.6839,0.3760,0.6252 +0.0000,0.0000,0.0000,0.6760,0.3998,0.6191 +0.0000,0.0000,0.0000,0.6671,0.4234,0.6129 +0.0000,0.0000,0.0000,0.6575,0.4468,0.6067 +0.0000,0.0000,0.0000,0.6470,0.4700,0.6004 +0.0000,0.0000,0.0000,0.6356,0.4930,0.5941 +0.0000,0.0000,0.0000,0.6234,0.5157,0.5878 +0.0000,0.0000,0.0000,0.6103,0.5380,0.5814 +0.0000,0.0000,0.0000,0.5964,0.5601,0.5750 +0.0000,0.0000,0.0000,0.5817,0.5817,0.5686 +0.0000,0.0000,0.0000,0.5662,0.6029,0.5621 +0.0000,0.0000,0.0000,0.5499,0.6237,0.5556 +0.0000,0.0000,0.0000,0.5328,0.6440,0.5490 +0.0000,0.0000,0.0000,0.5149,0.6638,0.5424 +0.0000,0.0000,0.0000,0.4963,0.6831,0.5358 +0.0000,0.0000,0.0000,0.4769,0.7018,0.5292 +0.0000,0.0000,0.0000,0.4569,0.7199,0.5225 +0.0000,0.0000,0.0000,0.4361,0.7374,0.5158 +0.0000,0.0000,0.0000,0.4147,0.7543,0.5090 +0.0000,0.0000,0.0000,0.3926,0.7705,0.5023 +0.0000,0.0000,0.0000,0.3698,0.7860,0.4955 +0.0000,0.0000,0.0000,0.3465,0.8007,0.4886 +0.0000,0.0000,0.0000,0.3226,0.8148,0.4818 +0.0000,0.0000,0.0000,0.2981,0.8280,0.4749 +0.0000,0.0000,0.0000,0.2731,0.8405,0.4679 +0.0000,0.0000,0.0000,0.2476,0.8522,0.4610 +0.0000,0.0000,0.0000,0.2216,0.8630,0.4540 +0.0000,0.0000,0.0000,0.1951,0.8730,0.4470 +0.0000,0.0000,0.0000,0.1683,0.8821,0.4399 +0.0000,0.0000,0.0000,0.1410,0.8904,0.4329 +0.0000,0.0000,0.0000,0.1134,0.8977,0.4258 +0.0000,0.0000,0.0000,0.0855,0.9041,0.4187 +0.0000,0.0000,0.0000,0.0572,0.9096,0.4115 +0.0000,0.0000,0.0000,0.0287,0.9142,0.4043 +0.0000,0.0000,0.0000,-0.0000,0.9178,0.3971 +0.0000,0.0000,0.0000,-0.0289,0.9204,0.3899 +0.0000,0.0000,0.0000,-0.0580,0.9221,0.3827 +0.0000,0.0000,0.0000,-0.0872,0.9227,0.3754 +0.0000,0.0000,0.0000,-0.1165,0.9224,0.3681 +0.0000,0.0000,0.0000,-0.1459,0.9212,0.3608 +0.0000,0.0000,0.0000,-0.1753,0.9189,0.3535 +0.0000,0.0000,0.0000,-0.2047,0.9156,0.3461 +0.0000,0.0000,0.0000,-0.2340,0.9113,0.3387 +0.0000,0.0000,0.0000,-0.2632,0.9060,0.3313 +0.0000,0.0000,0.0000,-0.2924,0.8998,0.3239 +0.0000,0.0000,0.0000,-0.3213,0.8925,0.3165 +0.0000,0.0000,0.0000,-0.3501,0.8843,0.3090 +0.0000,0.0000,0.0000,-0.3787,0.8750,0.3015 +0.0000,0.0000,0.0000,-0.4070,0.8648,0.2940 +0.0000,0.0000,0.0000,-0.4350,0.8536,0.2865 +0.0000,0.0000,0.0000,-0.4626,0.8415,0.2790 +0.0000,0.0000,0.0000,-0.4899,0.8284,0.2714 +0.0000,0.0000,0.0000,-0.5168,0.8144,0.2639 +0.0000,0.0000,0.0000,-0.5433,0.7995,0.2563 +0.0000,0.0000,0.0000,-0.5693,0.7836,0.2487 +0.0000,0.0000,0.0000,-0.5948,0.7669,0.2411 +0.0000,0.0000,0.0000,-0.6198,0.7492,0.2334 +0.0000,0.0000,0.0000,-0.6442,0.7307,0.2258 +0.0000,0.0000,0.0000,-0.6681,0.7114,0.2181 +0.0000,0.0000,0.0000,-0.6913,0.6913,0.2105 +0.0000,0.0000,0.0000,-0.7138,0.6703,0.2028 +0.0000,0.0000,0.0000,-0.7357,0.6486,0.1951 +0.0000,0.0000,0.0000,-0.7569,0.6261,0.1874 +0.0000,0.0000,0.0000,-0.7773,0.6029,0.1797 +0.0000,0.0000,0.0000,-0.7970,0.5790,0.1719 +0.0000,0.0000,0.0000,-0.8159,0.5545,0.1642 +0.0000,0.0000,0.0000,-0.8339,0.5292,0.1564 +0.0000,0.0000,0.0000,-0.8512,0.5034,0.1487 +0.0000,0.0000,0.0000,-0.8676,0.4769,0.1409 +0.0000,0.0000,0.0000,-0.8831,0.4499,0.1331 +0.0000,0.0000,0.0000,-0.8977,0.4224,0.1253 +0.0000,0.0000,0.0000,-0.9114,0.3944,0.1175 +0.0000,0.0000,0.0000,-0.9242,0.3659,0.1097 +0.0000,0.0000,0.0000,-0.9360,0.3370,0.1019 +0.0000,0.0000,0.0000,-0.9468,0.3076,0.0941 +0.0000,0.0000,0.0000,-0.9567,0.2779,0.0863 +0.0000,0.0000,0.0000,-0.9656,0.2479,0.0785 +0.0000,0.0000,0.0000,-0.9735,0.2176,0.0706 +0.0000,0.0000,0.0000,-0.9803,0.1870,0.0628 +0.0000,0.0000,0.0000,-0.9862,0.1562,0.0549 +0.0000,0.0000,0.0000,-0.9910,0.1252,0.0471 +0.0000,0.0000,0.0000,-0.9948,0.0940,0.0393 +0.0000,0.0000,0.0000,-0.9975,0.0628,0.0314 +0.0000,0.0000,0.0000,-0.9992,0.0314,0.0236 +0.0000,0.0000,0.0000,-0.9999,-0.0000,0.0157 +0.0000,0.0000,0.0000,-0.9995,-0.0314,0.0079 +0.0000,0.0000,0.0000,-0.9980,-0.0628,-0.0000 +0.0000,0.0000,0.0000,-0.9955,-0.0941,-0.0079 +0.0000,0.0000,0.0000,-0.9920,-0.1253,-0.0157 +0.0000,0.0000,0.0000,-0.9874,-0.1564,-0.0236 +0.0000,0.0000,0.0000,-0.9818,-0.1873,-0.0314 +0.0000,0.0000,0.0000,-0.9752,-0.2180,-0.0393 +0.0000,0.0000,0.0000,-0.9675,-0.2484,-0.0471 +0.0000,0.0000,0.0000,-0.9588,-0.2786,-0.0550 +0.0000,0.0000,0.0000,-0.9492,-0.3084,-0.0628 +0.0000,0.0000,0.0000,-0.9385,-0.3379,-0.0706 +0.0000,0.0000,0.0000,-0.9269,-0.3670,-0.0785 +0.0000,0.0000,0.0000,-0.9143,-0.3957,-0.0863 +0.0000,0.0000,0.0000,-0.9008,-0.4239,-0.0941 +0.0000,0.0000,0.0000,-0.8864,-0.4516,-0.1019 +0.0000,0.0000,0.0000,-0.8710,-0.4788,-0.1097 +0.0000,0.0000,0.0000,-0.8548,-0.5055,-0.1175 +0.0000,0.0000,0.0000,-0.8377,-0.5316,-0.1253 +0.0000,0.0000,0.0000,-0.8197,-0.5571,-0.1331 +0.0000,0.0000,0.0000,-0.8009,-0.5819,-0.1409 +0.0000,0.0000,0.0000,-0.7814,-0.6061,-0.1487 +0.0000,0.0000,0.0000,-0.7610,-0.6296,-0.1564 +0.0000,0.0000,0.0000,-0.7399,-0.6523,-0.1642 +0.0000,0.0000,0.0000,-0.7181,-0.6744,-0.1719 +0.0000,0.0000,0.0000,-0.6956,-0.6956,-0.1797 +0.0000,0.0000,0.0000,-0.6724,-0.7161,-0.1874 +0.0000,0.0000,0.0000,-0.6486,-0.7357,-0.1951 +0.0000,0.0000,0.0000,-0.6242,-0.7545,-0.2028 +0.0000,0.0000,0.0000,-0.5992,-0.7725,-0.2105 +0.0000,0.0000,0.0000,-0.5736,-0.7895,-0.2181 +0.0000,0.0000,0.0000,-0.5476,-0.8057,-0.2258 +0.0000,0.0000,0.0000,-0.5210,-0.8210,-0.2334 +0.0000,0.0000,0.0000,-0.4940,-0.8354,-0.2411 +0.0000,0.0000,0.0000,-0.4666,-0.8488,-0.2487 +0.0000,0.0000,0.0000,-0.4388,-0.8612,-0.2563 +0.0000,0.0000,0.0000,-0.4107,-0.8728,-0.2639 +0.0000,0.0000,0.0000,-0.3822,-0.8833,-0.2714 +0.0000,0.0000,0.0000,-0.3535,-0.8929,-0.2790 +0.0000,0.0000,0.0000,-0.3245,-0.9014,-0.2865 +0.0000,0.0000,0.0000,-0.2954,-0.9090,-0.2940 +0.0000,0.0000,0.0000,-0.2660,-0.9156,-0.3015 +0.0000,0.0000,0.0000,-0.2365,-0.9212,-0.3090 +0.0000,0.0000,0.0000,-0.2069,-0.9258,-0.3165 +0.0000,0.0000,0.0000,-0.1773,-0.9293,-0.3239 +0.0000,0.0000,0.0000,-0.1476,-0.9319,-0.3313 +0.0000,0.0000,0.0000,-0.1179,-0.9335,-0.3387 +0.0000,0.0000,0.0000,-0.0883,-0.9340,-0.3461 +0.0000,0.0000,0.0000,-0.0587,-0.9336,-0.3535 +0.0000,0.0000,0.0000,-0.0293,-0.9322,-0.3608 +0.0000,0.0000,0.0000,0.0000,-0.9298,-0.3681 +0.0000,0.0000,0.0000,0.0291,-0.9264,-0.3754 +0.0000,0.0000,0.0000,0.0580,-0.9221,-0.3827 +0.0000,0.0000,0.0000,0.0867,-0.9168,-0.3899 +0.0000,0.0000,0.0000,0.1150,-0.9105,-0.3971 +0.0000,0.0000,0.0000,0.1431,-0.9033,-0.4043 +0.0000,0.0000,0.0000,0.1708,-0.8953,-0.4115 +0.0000,0.0000,0.0000,0.1981,-0.8863,-0.4187 +0.0000,0.0000,0.0000,0.2250,-0.8764,-0.4258 +0.0000,0.0000,0.0000,0.2515,-0.8657,-0.4329 +0.0000,0.0000,0.0000,0.2775,-0.8541,-0.4399 +0.0000,0.0000,0.0000,0.3030,-0.8417,-0.4470 +0.0000,0.0000,0.0000,0.3280,-0.8284,-0.4540 +0.0000,0.0000,0.0000,0.3524,-0.8144,-0.4610 +0.0000,0.0000,0.0000,0.3763,-0.7997,-0.4679 +0.0000,0.0000,0.0000,0.3995,-0.7841,-0.4749 +0.0000,0.0000,0.0000,0.4222,-0.7679,-0.4818 +0.0000,0.0000,0.0000,0.4441,-0.7510,-0.4886 +0.0000,0.0000,0.0000,0.4654,-0.7334,-0.4955 +0.0000,0.0000,0.0000,0.4860,-0.7152,-0.5023 +0.0000,0.0000,0.0000,0.5059,-0.6964,-0.5090 +0.0000,0.0000,0.0000,0.5251,-0.6769,-0.5158 +0.0000,0.0000,0.0000,0.5435,-0.6570,-0.5225 +0.0000,0.0000,0.0000,0.5611,-0.6365,-0.5292 +0.0000,0.0000,0.0000,0.5780,-0.6155,-0.5358 +0.0000,0.0000,0.0000,0.5940,-0.5940,-0.5424 +0.0000,0.0000,0.0000,0.6093,-0.5721,-0.5490 +0.0000,0.0000,0.0000,0.6237,-0.5499,-0.5556 +0.0000,0.0000,0.0000,0.6373,-0.5272,-0.5621 +0.0000,0.0000,0.0000,0.6500,-0.5042,-0.5686 +0.0000,0.0000,0.0000,0.6619,-0.4809,-0.5750 +0.0000,0.0000,0.0000,0.6729,-0.4573,-0.5814 +0.0000,0.0000,0.0000,0.6831,-0.4335,-0.5878 +0.0000,0.0000,0.0000,0.6924,-0.4095,-0.5941 +0.0000,0.0000,0.0000,0.7008,-0.3852,-0.6004 +0.0000,0.0000,0.0000,0.7083,-0.3609,-0.6067 +0.0000,0.0000,0.0000,0.7150,-0.3364,-0.6129 +0.0000,0.0000,0.0000,0.7207,-0.3119,-0.6191 +0.0000,0.0000,0.0000,0.7256,-0.2873,-0.6252 +0.0000,0.0000,0.0000,0.7296,-0.2627,-0.6314 +0.0000,0.0000,0.0000,0.7328,-0.2381,-0.6374 +0.0000,0.0000,0.0000,0.7351,-0.2136,-0.6435 +0.0000,0.0000,0.0000,0.7365,-0.1891,-0.6494 +0.0000,0.0000,0.0000,0.7371,-0.1648,-0.6554 +0.0000,0.0000,0.0000,0.7368,-0.1406,-0.6613 +0.0000,0.0000,0.0000,0.7357,-0.1165,-0.6672 +0.0000,0.0000,0.0000,0.7338,-0.0927,-0.6730 +0.0000,0.0000,0.0000,0.7311,-0.0691,-0.6788 +0.0000,0.0000,0.0000,0.7275,-0.0458,-0.6845 +0.0000,0.0000,0.0000,0.7232,-0.0227,-0.6903 +0.0000,0.0000,0.0000,0.7181,0.0000,-0.6959 diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s-ccw.csv b/scripts/trajectories/full-circle-with-up-and-down-4s-ccw.csv new file mode 100644 index 0000000000000000000000000000000000000000..1e4a316720c584ee96394a65340d0e6726332552 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s-ccw.csv @@ -0,0 +1,800 @@ +0.9223,-0.0000,-0.3863,0.0119 +0.9223,-0.0000,-0.3863,0.0119 +0.9223,-0.0000,-0.3863,0.0119 +0.9223,-0.0000,-0.3863,0.0119 +0.9235,-0.0000,-0.3828,0.0240 +0.9235,-0.0000,-0.3828,0.0240 +0.9235,-0.0000,-0.3828,0.0240 +0.9235,-0.0000,-0.3828,0.0240 +0.9245,-0.0000,-0.3794,0.0363 +0.9245,-0.0000,-0.3794,0.0363 +0.9245,-0.0000,-0.3794,0.0363 +0.9245,-0.0000,-0.3794,0.0363 +0.9253,-0.0000,-0.3760,0.0486 +0.9253,-0.0000,-0.3760,0.0486 +0.9253,-0.0000,-0.3760,0.0486 +0.9253,-0.0000,-0.3760,0.0486 +0.9259,-0.0000,-0.3727,0.0611 +0.9259,-0.0000,-0.3727,0.0611 +0.9259,-0.0000,-0.3727,0.0611 +0.9259,-0.0000,-0.3727,0.0611 +0.9263,-0.0000,-0.3695,0.0737 +0.9263,-0.0000,-0.3695,0.0737 +0.9263,-0.0000,-0.3695,0.0737 +0.9263,-0.0000,-0.3695,0.0737 +0.9265,-0.0000,-0.3663,0.0865 +0.9265,-0.0000,-0.3663,0.0865 +0.9265,-0.0000,-0.3663,0.0865 +0.9265,-0.0000,-0.3663,0.0865 +0.9264,-0.0000,-0.3632,0.0993 +0.9264,-0.0000,-0.3632,0.0993 +0.9264,-0.0000,-0.3632,0.0993 +0.9264,-0.0000,-0.3632,0.0993 +0.9261,-0.0000,-0.3602,0.1122 +0.9261,-0.0000,-0.3602,0.1122 +0.9261,-0.0000,-0.3602,0.1122 +0.9261,-0.0000,-0.3602,0.1122 +0.9256,-0.0000,-0.3572,0.1252 +0.9256,-0.0000,-0.3572,0.1252 +0.9256,-0.0000,-0.3572,0.1252 +0.9256,-0.0000,-0.3572,0.1252 +0.9248,-0.0000,-0.3543,0.1383 +0.9248,-0.0000,-0.3543,0.1383 +0.9248,-0.0000,-0.3543,0.1383 +0.9248,-0.0000,-0.3543,0.1383 +0.9239,-0.0000,-0.3515,0.1515 +0.9239,-0.0000,-0.3515,0.1515 +0.9239,-0.0000,-0.3515,0.1515 +0.9239,-0.0000,-0.3515,0.1515 +0.9226,-0.0000,-0.3487,0.1648 +0.9226,-0.0000,-0.3487,0.1648 +0.9226,-0.0000,-0.3487,0.1648 +0.9226,-0.0000,-0.3487,0.1648 +0.9212,-0.0000,-0.3460,0.1781 +0.9212,-0.0000,-0.3460,0.1781 +0.9212,-0.0000,-0.3460,0.1781 +0.9212,-0.0000,-0.3460,0.1781 +0.9195,-0.0000,-0.3433,0.1914 +0.9195,-0.0000,-0.3433,0.1914 +0.9195,-0.0000,-0.3433,0.1914 +0.9195,-0.0000,-0.3433,0.1914 +0.9176,-0.0000,-0.3407,0.2049 +0.9176,-0.0000,-0.3407,0.2049 +0.9176,-0.0000,-0.3407,0.2049 +0.9176,-0.0000,-0.3407,0.2049 +0.9154,-0.0000,-0.3382,0.2183 +0.9154,-0.0000,-0.3382,0.2183 +0.9154,-0.0000,-0.3382,0.2183 +0.9154,-0.0000,-0.3382,0.2183 +0.9130,-0.0000,-0.3357,0.2319 +0.9130,-0.0000,-0.3357,0.2319 +0.9130,-0.0000,-0.3357,0.2319 +0.9130,-0.0000,-0.3357,0.2319 +0.9104,-0.0000,-0.3332,0.2454 +0.9104,-0.0000,-0.3332,0.2454 +0.9104,-0.0000,-0.3332,0.2454 +0.9104,-0.0000,-0.3332,0.2454 +0.9075,-0.0000,-0.3308,0.2590 +0.9075,-0.0000,-0.3308,0.2590 +0.9075,-0.0000,-0.3308,0.2590 +0.9075,-0.0000,-0.3308,0.2590 +0.9043,-0.0000,-0.3285,0.2726 +0.9043,-0.0000,-0.3285,0.2726 +0.9043,-0.0000,-0.3285,0.2726 +0.9043,-0.0000,-0.3285,0.2726 +0.9009,-0.0000,-0.3262,0.2862 +0.9009,-0.0000,-0.3262,0.2862 +0.9009,-0.0000,-0.3262,0.2862 +0.9009,-0.0000,-0.3262,0.2862 +0.8973,-0.0000,-0.3240,0.2998 +0.8973,-0.0000,-0.3240,0.2998 +0.8973,-0.0000,-0.3240,0.2998 +0.8973,-0.0000,-0.3240,0.2998 +0.8934,-0.0000,-0.3218,0.3134 +0.8934,-0.0000,-0.3218,0.3134 +0.8934,-0.0000,-0.3218,0.3134 +0.8934,-0.0000,-0.3218,0.3134 +0.8893,-0.0000,-0.3197,0.3271 +0.8893,-0.0000,-0.3197,0.3271 +0.8893,-0.0000,-0.3197,0.3271 +0.8893,-0.0000,-0.3197,0.3271 +0.8849,-0.0000,-0.3176,0.3407 +0.8849,-0.0000,-0.3176,0.3407 +0.8849,-0.0000,-0.3176,0.3407 +0.8849,-0.0000,-0.3176,0.3407 +0.8803,-0.0000,-0.3156,0.3543 +0.8803,-0.0000,-0.3156,0.3543 +0.8803,-0.0000,-0.3156,0.3543 +0.8803,-0.0000,-0.3156,0.3543 +0.8754,-0.0000,-0.3136,0.3678 +0.8754,-0.0000,-0.3136,0.3678 +0.8754,-0.0000,-0.3136,0.3678 +0.8754,-0.0000,-0.3136,0.3678 +0.8703,-0.0000,-0.3116,0.3814 +0.8703,-0.0000,-0.3116,0.3814 +0.8703,-0.0000,-0.3116,0.3814 +0.8703,-0.0000,-0.3116,0.3814 +0.8650,-0.0000,-0.3097,0.3949 +0.8650,-0.0000,-0.3097,0.3949 +0.8650,-0.0000,-0.3097,0.3949 +0.8650,-0.0000,-0.3097,0.3949 +0.8593,-0.0000,-0.3079,0.4083 +0.8593,-0.0000,-0.3079,0.4083 +0.8593,-0.0000,-0.3079,0.4083 +0.8593,-0.0000,-0.3079,0.4083 +0.8535,-0.0000,-0.3061,0.4217 +0.8535,-0.0000,-0.3061,0.4217 +0.8535,-0.0000,-0.3061,0.4217 +0.8535,-0.0000,-0.3061,0.4217 +0.8474,-0.0000,-0.3043,0.4351 +0.8474,-0.0000,-0.3043,0.4351 +0.8474,-0.0000,-0.3043,0.4351 +0.8474,-0.0000,-0.3043,0.4351 +0.8410,-0.0000,-0.3026,0.4484 +0.8410,-0.0000,-0.3026,0.4484 +0.8410,-0.0000,-0.3026,0.4484 +0.8410,-0.0000,-0.3026,0.4484 +0.8344,-0.0000,-0.3010,0.4617 +0.8344,-0.0000,-0.3010,0.4617 +0.8344,-0.0000,-0.3010,0.4617 +0.8344,-0.0000,-0.3010,0.4617 +0.8276,-0.0000,-0.2993,0.4748 +0.8276,-0.0000,-0.2993,0.4748 +0.8276,-0.0000,-0.2993,0.4748 +0.8276,-0.0000,-0.2993,0.4748 +0.8205,-0.0000,-0.2978,0.4879 +0.8205,-0.0000,-0.2978,0.4879 +0.8205,-0.0000,-0.2978,0.4879 +0.8205,-0.0000,-0.2978,0.4879 +0.8132,-0.0000,-0.2962,0.5010 +0.8132,-0.0000,-0.2962,0.5010 +0.8132,-0.0000,-0.2962,0.5010 +0.8132,-0.0000,-0.2962,0.5010 +0.8056,-0.0000,-0.2947,0.5139 +0.8056,-0.0000,-0.2947,0.5139 +0.8056,-0.0000,-0.2947,0.5139 +0.8056,-0.0000,-0.2947,0.5139 +0.7978,-0.0000,-0.2932,0.5267 +0.7978,-0.0000,-0.2932,0.5267 +0.7978,-0.0000,-0.2932,0.5267 +0.7978,-0.0000,-0.2932,0.5267 +0.7898,-0.0000,-0.2918,0.5395 +0.7898,-0.0000,-0.2918,0.5395 +0.7898,-0.0000,-0.2918,0.5395 +0.7898,-0.0000,-0.2918,0.5395 +0.7815,-0.0000,-0.2904,0.5521 +0.7815,-0.0000,-0.2904,0.5521 +0.7815,-0.0000,-0.2904,0.5521 +0.7815,-0.0000,-0.2904,0.5521 +0.7730,-0.0000,-0.2891,0.5647 +0.7730,-0.0000,-0.2891,0.5647 +0.7730,-0.0000,-0.2891,0.5647 +0.7730,-0.0000,-0.2891,0.5647 +0.7643,-0.0000,-0.2878,0.5771 +0.7643,-0.0000,-0.2878,0.5771 +0.7643,-0.0000,-0.2878,0.5771 +0.7643,-0.0000,-0.2878,0.5771 +0.7553,-0.0000,-0.2865,0.5894 +0.7553,-0.0000,-0.2865,0.5894 +0.7553,-0.0000,-0.2865,0.5894 +0.7553,-0.0000,-0.2865,0.5894 +0.7461,-0.0000,-0.2853,0.6016 +0.7461,-0.0000,-0.2853,0.6016 +0.7461,-0.0000,-0.2853,0.6016 +0.7461,-0.0000,-0.2853,0.6016 +0.7367,-0.0000,-0.2841,0.6136 +0.7367,-0.0000,-0.2841,0.6136 +0.7367,-0.0000,-0.2841,0.6136 +0.7367,-0.0000,-0.2841,0.6136 +0.7271,-0.0000,-0.2830,0.6255 +0.7271,-0.0000,-0.2830,0.6255 +0.7271,-0.0000,-0.2830,0.6255 +0.7271,-0.0000,-0.2830,0.6255 +0.7172,-0.0000,-0.2819,0.6373 +0.7172,-0.0000,-0.2819,0.6373 +0.7172,-0.0000,-0.2819,0.6373 +0.7172,-0.0000,-0.2819,0.6373 +0.7071,-0.0000,-0.2808,0.6490 +0.7071,-0.0000,-0.2808,0.6490 +0.7071,-0.0000,-0.2808,0.6490 +0.7071,-0.0000,-0.2808,0.6490 +0.6968,-0.0000,-0.2798,0.6604 +0.6968,-0.0000,-0.2798,0.6604 +0.6968,-0.0000,-0.2798,0.6604 +0.6968,-0.0000,-0.2798,0.6604 +0.6863,-0.0000,-0.2788,0.6718 +0.6863,-0.0000,-0.2788,0.6718 +0.6863,-0.0000,-0.2788,0.6718 +0.6863,-0.0000,-0.2788,0.6718 +0.6756,-0.0000,-0.2779,0.6829 +0.6756,-0.0000,-0.2779,0.6829 +0.6756,-0.0000,-0.2779,0.6829 +0.6756,-0.0000,-0.2779,0.6829 +0.6646,-0.0000,-0.2769,0.6940 +0.6646,-0.0000,-0.2769,0.6940 +0.6646,-0.0000,-0.2769,0.6940 +0.6646,-0.0000,-0.2769,0.6940 +0.6535,-0.0000,-0.2761,0.7048 +0.6535,-0.0000,-0.2761,0.7048 +0.6535,-0.0000,-0.2761,0.7048 +0.6535,-0.0000,-0.2761,0.7048 +0.6422,-0.0000,-0.2752,0.7155 +0.6422,-0.0000,-0.2752,0.7155 +0.6422,-0.0000,-0.2752,0.7155 +0.6422,-0.0000,-0.2752,0.7155 +0.6306,-0.0000,-0.2744,0.7260 +0.6306,-0.0000,-0.2744,0.7260 +0.6306,-0.0000,-0.2744,0.7260 +0.6306,-0.0000,-0.2744,0.7260 +0.6189,-0.0000,-0.2737,0.7363 +0.6189,-0.0000,-0.2737,0.7363 +0.6189,-0.0000,-0.2737,0.7363 +0.6189,-0.0000,-0.2737,0.7363 +0.6069,-0.0000,-0.2730,0.7464 +0.6069,-0.0000,-0.2730,0.7464 +0.6069,-0.0000,-0.2730,0.7464 +0.6069,-0.0000,-0.2730,0.7464 +0.5948,-0.0000,-0.2723,0.7563 +0.5948,-0.0000,-0.2723,0.7563 +0.5948,-0.0000,-0.2723,0.7563 +0.5948,-0.0000,-0.2723,0.7563 +0.5825,-0.0000,-0.2716,0.7661 +0.5825,-0.0000,-0.2716,0.7661 +0.5825,-0.0000,-0.2716,0.7661 +0.5825,-0.0000,-0.2716,0.7661 +0.5700,-0.0000,-0.2710,0.7756 +0.5700,-0.0000,-0.2710,0.7756 +0.5700,-0.0000,-0.2710,0.7756 +0.5700,-0.0000,-0.2710,0.7756 +0.5574,-0.0000,-0.2705,0.7850 +0.5574,-0.0000,-0.2705,0.7850 +0.5574,-0.0000,-0.2705,0.7850 +0.5574,-0.0000,-0.2705,0.7850 +0.5445,-0.0000,-0.2700,0.7941 +0.5445,-0.0000,-0.2700,0.7941 +0.5445,-0.0000,-0.2700,0.7941 +0.5445,-0.0000,-0.2700,0.7941 +0.5315,-0.0000,-0.2695,0.8030 +0.5315,-0.0000,-0.2695,0.8030 +0.5315,-0.0000,-0.2695,0.8030 +0.5315,-0.0000,-0.2695,0.8030 +0.5184,-0.0000,-0.2691,0.8117 +0.5184,-0.0000,-0.2691,0.8117 +0.5184,-0.0000,-0.2691,0.8117 +0.5184,-0.0000,-0.2691,0.8117 +0.5050,-0.0000,-0.2687,0.8202 +0.5050,-0.0000,-0.2687,0.8202 +0.5050,-0.0000,-0.2687,0.8202 +0.5050,-0.0000,-0.2687,0.8202 +0.4915,-0.0000,-0.2684,0.8285 +0.4915,-0.0000,-0.2684,0.8285 +0.4915,-0.0000,-0.2684,0.8285 +0.4915,-0.0000,-0.2684,0.8285 +0.4779,-0.0000,-0.2682,0.8365 +0.4779,-0.0000,-0.2682,0.8365 +0.4779,-0.0000,-0.2682,0.8365 +0.4779,-0.0000,-0.2682,0.8365 +0.4640,-0.0000,-0.2680,0.8443 +0.4640,-0.0000,-0.2680,0.8443 +0.4640,-0.0000,-0.2680,0.8443 +0.4640,-0.0000,-0.2680,0.8443 +0.4501,-0.0000,-0.2678,0.8519 +0.4501,-0.0000,-0.2678,0.8519 +0.4501,-0.0000,-0.2678,0.8519 +0.4501,-0.0000,-0.2678,0.8519 +0.4360,-0.0000,-0.2677,0.8592 +0.4360,-0.0000,-0.2677,0.8592 +0.4360,-0.0000,-0.2677,0.8592 +0.4360,-0.0000,-0.2677,0.8592 +0.4218,-0.0000,-0.2677,0.8663 +0.4218,-0.0000,-0.2677,0.8663 +0.4218,-0.0000,-0.2677,0.8663 +0.4218,-0.0000,-0.2677,0.8663 +0.4074,-0.0000,-0.2677,0.8731 +0.4074,-0.0000,-0.2677,0.8731 +0.4074,-0.0000,-0.2677,0.8731 +0.4074,-0.0000,-0.2677,0.8731 +0.3929,-0.0000,-0.2678,0.8797 +0.3929,-0.0000,-0.2678,0.8797 +0.3929,-0.0000,-0.2678,0.8797 +0.3929,-0.0000,-0.2678,0.8797 +0.3783,-0.0000,-0.2680,0.8860 +0.3783,-0.0000,-0.2680,0.8860 +0.3783,-0.0000,-0.2680,0.8860 +0.3783,-0.0000,-0.2680,0.8860 +0.3635,-0.0000,-0.2683,0.8921 +0.3635,-0.0000,-0.2683,0.8921 +0.3635,-0.0000,-0.2683,0.8921 +0.3635,-0.0000,-0.2683,0.8921 +0.3487,-0.0000,-0.2687,0.8979 +0.3487,-0.0000,-0.2687,0.8979 +0.3487,-0.0000,-0.2687,0.8979 +0.3487,-0.0000,-0.2687,0.8979 +0.3337,-0.0000,-0.2692,0.9034 +0.3337,-0.0000,-0.2692,0.9034 +0.3337,-0.0000,-0.2692,0.9034 +0.3337,-0.0000,-0.2692,0.9034 +0.3186,-0.0000,-0.2698,0.9087 +0.3186,-0.0000,-0.2698,0.9087 +0.3186,-0.0000,-0.2698,0.9087 +0.3186,-0.0000,-0.2698,0.9087 +0.3034,-0.0000,-0.2705,0.9136 +0.3034,-0.0000,-0.2705,0.9136 +0.3034,-0.0000,-0.2705,0.9136 +0.3034,-0.0000,-0.2705,0.9136 +0.2882,-0.0000,-0.2714,0.9183 +0.2882,-0.0000,-0.2714,0.9183 +0.2882,-0.0000,-0.2714,0.9183 +0.2882,-0.0000,-0.2714,0.9183 +0.2728,-0.0000,-0.2725,0.9227 +0.2728,-0.0000,-0.2725,0.9227 +0.2728,-0.0000,-0.2725,0.9227 +0.2728,-0.0000,-0.2725,0.9227 +0.2573,-0.0000,-0.2738,0.9267 +0.2573,-0.0000,-0.2738,0.9267 +0.2573,-0.0000,-0.2738,0.9267 +0.2573,-0.0000,-0.2738,0.9267 +0.2418,-0.0000,-0.2753,0.9305 +0.2418,-0.0000,-0.2753,0.9305 +0.2418,-0.0000,-0.2753,0.9305 +0.2418,-0.0000,-0.2753,0.9305 +0.2262,-0.0000,-0.2771,0.9339 +0.2262,-0.0000,-0.2771,0.9339 +0.2262,-0.0000,-0.2771,0.9339 +0.2262,-0.0000,-0.2771,0.9339 +0.2105,-0.0000,-0.2792,0.9369 +0.2105,-0.0000,-0.2792,0.9369 +0.2105,-0.0000,-0.2792,0.9369 +0.2105,-0.0000,-0.2792,0.9369 +0.1947,-0.0000,-0.2818,0.9395 +0.1947,-0.0000,-0.2818,0.9395 +0.1947,-0.0000,-0.2818,0.9395 +0.1947,-0.0000,-0.2818,0.9395 +0.1789,-0.0000,-0.2848,0.9417 +0.1789,-0.0000,-0.2848,0.9417 +0.1789,-0.0000,-0.2848,0.9417 +0.1789,-0.0000,-0.2848,0.9417 +0.1630,-0.0000,-0.2886,0.9435 +0.1630,-0.0000,-0.2886,0.9435 +0.1630,-0.0000,-0.2886,0.9435 +0.1630,-0.0000,-0.2886,0.9435 +0.1471,-0.0000,-0.2933,0.9446 +0.1471,-0.0000,-0.2933,0.9446 +0.1471,-0.0000,-0.2933,0.9446 +0.1471,-0.0000,-0.2933,0.9446 +0.1312,-0.0000,-0.2991,0.9452 +0.1312,-0.0000,-0.2991,0.9452 +0.1312,-0.0000,-0.2991,0.9452 +0.1312,-0.0000,-0.2991,0.9452 +0.1152,-0.0000,-0.3067,0.9448 +0.1152,-0.0000,-0.3067,0.9448 +0.1152,-0.0000,-0.3067,0.9448 +0.1152,-0.0000,-0.3067,0.9448 +0.0991,-0.0000,-0.3167,0.9433 +0.0991,-0.0000,-0.3167,0.9433 +0.0991,-0.0000,-0.3167,0.9433 +0.0991,-0.0000,-0.3167,0.9433 +0.0831,-0.0000,-0.3307,0.9401 +0.0831,-0.0000,-0.3307,0.9401 +0.0831,-0.0000,-0.3307,0.9401 +0.0831,-0.0000,-0.3307,0.9401 +0.0670,-0.0000,-0.3514,0.9338 +0.0670,-0.0000,-0.3514,0.9338 +0.0670,-0.0000,-0.3514,0.9338 +0.0670,-0.0000,-0.3514,0.9338 +0.0510,-0.0000,-0.3848,0.9216 +0.0510,-0.0000,-0.3848,0.9216 +0.0510,-0.0000,-0.3848,0.9216 +0.0510,-0.0000,-0.3848,0.9216 +0.0351,-0.0000,-0.4473,0.8937 +0.0351,-0.0000,-0.4473,0.8937 +0.0351,-0.0000,-0.4473,0.8937 +0.0351,-0.0000,-0.4473,0.8937 +0.0196,-0.0000,-0.6000,0.7997 +0.0196,-0.0000,-0.6000,0.7997 +0.0196,-0.0000,-0.6000,0.7997 +0.0196,-0.0000,-0.6000,0.7997 +0.0079,-0.0000,-1.0000,-0.0001 +0.0079,-0.0000,-1.0000,-0.0001 +0.0079,-0.0000,-1.0000,-0.0001 +0.0079,-0.0000,-1.0000,-0.0001 +0.0162,-0.0000,-0.2425,-0.9700 +0.0162,-0.0000,-0.2425,-0.9700 +0.0162,-0.0000,-0.2425,-0.9700 +0.0162,-0.0000,-0.2425,-0.9700 +0.0314,-0.0000,0.0000,-0.9995 +0.0314,-0.0000,0.0000,-0.9995 +0.0314,-0.0000,0.0000,-0.9995 +0.0314,-0.0000,0.0000,-0.9995 +0.0473,-0.0000,0.0831,-0.9954 +0.0473,-0.0000,0.0831,-0.9954 +0.0473,-0.0000,0.0831,-0.9954 +0.0473,-0.0000,0.0831,-0.9954 +0.0633,-0.0000,0.1241,-0.9902 +0.0633,-0.0000,0.1241,-0.9902 +0.0633,-0.0000,0.1241,-0.9902 +0.0633,-0.0000,0.1241,-0.9902 +0.0793,-0.0000,0.1485,-0.9857 +0.0793,-0.0000,0.1485,-0.9857 +0.0793,-0.0000,0.1485,-0.9857 +0.0793,-0.0000,0.1485,-0.9857 +0.0954,-0.0000,0.1646,-0.9817 +0.0954,-0.0000,0.1646,-0.9817 +0.0954,-0.0000,0.1646,-0.9817 +0.0954,-0.0000,0.1646,-0.9817 +0.1114,-0.0000,0.1762,-0.9780 +0.1114,-0.0000,0.1762,-0.9780 +0.1114,-0.0000,0.1762,-0.9780 +0.1114,-0.0000,0.1762,-0.9780 +0.1275,-0.0000,0.1848,-0.9745 +0.1275,-0.0000,0.1848,-0.9745 +0.1275,-0.0000,0.1848,-0.9745 +0.1275,-0.0000,0.1848,-0.9745 +0.1435,-0.0000,0.1915,-0.9709 +0.1435,-0.0000,0.1915,-0.9709 +0.1435,-0.0000,0.1915,-0.9709 +0.1435,-0.0000,0.1915,-0.9709 +0.1594,-0.0000,0.1970,-0.9674 +0.1594,-0.0000,0.1970,-0.9674 +0.1594,-0.0000,0.1970,-0.9674 +0.1594,-0.0000,0.1970,-0.9674 +0.1753,-0.0000,0.2014,-0.9637 +0.1753,-0.0000,0.2014,-0.9637 +0.1753,-0.0000,0.2014,-0.9637 +0.1753,-0.0000,0.2014,-0.9637 +0.1912,-0.0000,0.2052,-0.9599 +0.1912,-0.0000,0.2052,-0.9599 +0.1912,-0.0000,0.2052,-0.9599 +0.1912,-0.0000,0.2052,-0.9599 +0.2070,-0.0000,0.2085,-0.9559 +0.2070,-0.0000,0.2085,-0.9559 +0.2070,-0.0000,0.2085,-0.9559 +0.2070,-0.0000,0.2085,-0.9559 +0.2227,-0.0000,0.2113,-0.9517 +0.2227,-0.0000,0.2113,-0.9517 +0.2227,-0.0000,0.2113,-0.9517 +0.2227,-0.0000,0.2113,-0.9517 +0.2384,-0.0000,0.2138,-0.9473 +0.2384,-0.0000,0.2138,-0.9473 +0.2384,-0.0000,0.2138,-0.9473 +0.2384,-0.0000,0.2138,-0.9473 +0.2540,-0.0000,0.2161,-0.9428 +0.2540,-0.0000,0.2161,-0.9428 +0.2540,-0.0000,0.2161,-0.9428 +0.2540,-0.0000,0.2161,-0.9428 +0.2695,-0.0000,0.2181,-0.9380 +0.2695,-0.0000,0.2181,-0.9380 +0.2695,-0.0000,0.2181,-0.9380 +0.2695,-0.0000,0.2181,-0.9380 +0.2849,-0.0000,0.2200,-0.9330 +0.2849,-0.0000,0.2200,-0.9330 +0.2849,-0.0000,0.2200,-0.9330 +0.2849,-0.0000,0.2200,-0.9330 +0.3002,-0.0000,0.2217,-0.9277 +0.3002,-0.0000,0.2217,-0.9277 +0.3002,-0.0000,0.2217,-0.9277 +0.3002,-0.0000,0.2217,-0.9277 +0.3155,-0.0000,0.2233,-0.9223 +0.3155,-0.0000,0.2233,-0.9223 +0.3155,-0.0000,0.2233,-0.9223 +0.3155,-0.0000,0.2233,-0.9223 +0.3306,-0.0000,0.2248,-0.9166 +0.3306,-0.0000,0.2248,-0.9166 +0.3306,-0.0000,0.2248,-0.9166 +0.3306,-0.0000,0.2248,-0.9166 +0.3457,-0.0000,0.2263,-0.9107 +0.3457,-0.0000,0.2263,-0.9107 +0.3457,-0.0000,0.2263,-0.9107 +0.3457,-0.0000,0.2263,-0.9107 +0.3606,-0.0000,0.2277,-0.9045 +0.3606,-0.0000,0.2277,-0.9045 +0.3606,-0.0000,0.2277,-0.9045 +0.3606,-0.0000,0.2277,-0.9045 +0.3754,-0.0000,0.2290,-0.8981 +0.3754,-0.0000,0.2290,-0.8981 +0.3754,-0.0000,0.2290,-0.8981 +0.3754,-0.0000,0.2290,-0.8981 +0.3901,-0.0000,0.2303,-0.8915 +0.3901,-0.0000,0.2303,-0.8915 +0.3901,-0.0000,0.2303,-0.8915 +0.3901,-0.0000,0.2303,-0.8915 +0.4047,-0.0000,0.2315,-0.8847 +0.4047,-0.0000,0.2315,-0.8847 +0.4047,-0.0000,0.2315,-0.8847 +0.4047,-0.0000,0.2315,-0.8847 +0.4192,-0.0000,0.2327,-0.8776 +0.4192,-0.0000,0.2327,-0.8776 +0.4192,-0.0000,0.2327,-0.8776 +0.4192,-0.0000,0.2327,-0.8776 +0.4335,-0.0000,0.2339,-0.8703 +0.4335,-0.0000,0.2339,-0.8703 +0.4335,-0.0000,0.2339,-0.8703 +0.4335,-0.0000,0.2339,-0.8703 +0.4477,-0.0000,0.2351,-0.8627 +0.4477,-0.0000,0.2351,-0.8627 +0.4477,-0.0000,0.2351,-0.8627 +0.4477,-0.0000,0.2351,-0.8627 +0.4617,-0.0000,0.2362,-0.8550 +0.4617,-0.0000,0.2362,-0.8550 +0.4617,-0.0000,0.2362,-0.8550 +0.4617,-0.0000,0.2362,-0.8550 +0.4756,-0.0000,0.2374,-0.8470 +0.4756,-0.0000,0.2374,-0.8470 +0.4756,-0.0000,0.2374,-0.8470 +0.4756,-0.0000,0.2374,-0.8470 +0.4894,-0.0000,0.2385,-0.8388 +0.4894,-0.0000,0.2385,-0.8388 +0.4894,-0.0000,0.2385,-0.8388 +0.4894,-0.0000,0.2385,-0.8388 +0.5030,-0.0000,0.2396,-0.8304 +0.5030,-0.0000,0.2396,-0.8304 +0.5030,-0.0000,0.2396,-0.8304 +0.5030,-0.0000,0.2396,-0.8304 +0.5164,-0.0000,0.2408,-0.8218 +0.5164,-0.0000,0.2408,-0.8218 +0.5164,-0.0000,0.2408,-0.8218 +0.5164,-0.0000,0.2408,-0.8218 +0.5297,-0.0000,0.2419,-0.8130 +0.5297,-0.0000,0.2419,-0.8130 +0.5297,-0.0000,0.2419,-0.8130 +0.5297,-0.0000,0.2419,-0.8130 +0.5428,-0.0000,0.2431,-0.8039 +0.5428,-0.0000,0.2431,-0.8039 +0.5428,-0.0000,0.2431,-0.8039 +0.5428,-0.0000,0.2431,-0.8039 +0.5558,-0.0000,0.2442,-0.7947 +0.5558,-0.0000,0.2442,-0.7947 +0.5558,-0.0000,0.2442,-0.7947 +0.5558,-0.0000,0.2442,-0.7947 +0.5685,-0.0000,0.2454,-0.7852 +0.5685,-0.0000,0.2454,-0.7852 +0.5685,-0.0000,0.2454,-0.7852 +0.5685,-0.0000,0.2454,-0.7852 +0.5811,-0.0000,0.2465,-0.7756 +0.5811,-0.0000,0.2465,-0.7756 +0.5811,-0.0000,0.2465,-0.7756 +0.5811,-0.0000,0.2465,-0.7756 +0.5936,-0.0000,0.2477,-0.7657 +0.5936,-0.0000,0.2477,-0.7657 +0.5936,-0.0000,0.2477,-0.7657 +0.5936,-0.0000,0.2477,-0.7657 +0.6058,-0.0000,0.2489,-0.7557 +0.6058,-0.0000,0.2489,-0.7557 +0.6058,-0.0000,0.2489,-0.7557 +0.6058,-0.0000,0.2489,-0.7557 +0.6179,-0.0000,0.2501,-0.7455 +0.6179,-0.0000,0.2501,-0.7455 +0.6179,-0.0000,0.2501,-0.7455 +0.6179,-0.0000,0.2501,-0.7455 +0.6297,-0.0000,0.2513,-0.7351 +0.6297,-0.0000,0.2513,-0.7351 +0.6297,-0.0000,0.2513,-0.7351 +0.6297,-0.0000,0.2513,-0.7351 +0.6414,-0.0000,0.2525,-0.7245 +0.6414,-0.0000,0.2525,-0.7245 +0.6414,-0.0000,0.2525,-0.7245 +0.6414,-0.0000,0.2525,-0.7245 +0.6528,-0.0000,0.2538,-0.7137 +0.6528,-0.0000,0.2538,-0.7137 +0.6528,-0.0000,0.2538,-0.7137 +0.6528,-0.0000,0.2538,-0.7137 +0.6641,-0.0000,0.2550,-0.7028 +0.6641,-0.0000,0.2550,-0.7028 +0.6641,-0.0000,0.2550,-0.7028 +0.6641,-0.0000,0.2550,-0.7028 +0.6752,-0.0000,0.2563,-0.6917 +0.6752,-0.0000,0.2563,-0.6917 +0.6752,-0.0000,0.2563,-0.6917 +0.6752,-0.0000,0.2563,-0.6917 +0.6860,-0.0000,0.2576,-0.6804 +0.6860,-0.0000,0.2576,-0.6804 +0.6860,-0.0000,0.2576,-0.6804 +0.6860,-0.0000,0.2576,-0.6804 +0.6967,-0.0000,0.2590,-0.6690 +0.6967,-0.0000,0.2590,-0.6690 +0.6967,-0.0000,0.2590,-0.6690 +0.6967,-0.0000,0.2590,-0.6690 +0.7071,-0.0000,0.2603,-0.6575 +0.7071,-0.0000,0.2603,-0.6575 +0.7071,-0.0000,0.2603,-0.6575 +0.7071,-0.0000,0.2603,-0.6575 +0.7173,-0.0000,0.2617,-0.6457 +0.7173,-0.0000,0.2617,-0.6457 +0.7173,-0.0000,0.2617,-0.6457 +0.7173,-0.0000,0.2617,-0.6457 +0.7273,-0.0000,0.2631,-0.6339 +0.7273,-0.0000,0.2631,-0.6339 +0.7273,-0.0000,0.2631,-0.6339 +0.7273,-0.0000,0.2631,-0.6339 +0.7371,-0.0000,0.2645,-0.6219 +0.7371,-0.0000,0.2645,-0.6219 +0.7371,-0.0000,0.2645,-0.6219 +0.7371,-0.0000,0.2645,-0.6219 +0.7467,-0.0000,0.2659,-0.6097 +0.7467,-0.0000,0.2659,-0.6097 +0.7467,-0.0000,0.2659,-0.6097 +0.7467,-0.0000,0.2659,-0.6097 +0.7560,-0.0000,0.2674,-0.5974 +0.7560,-0.0000,0.2674,-0.5974 +0.7560,-0.0000,0.2674,-0.5974 +0.7560,-0.0000,0.2674,-0.5974 +0.7651,-0.0000,0.2689,-0.5851 +0.7651,-0.0000,0.2689,-0.5851 +0.7651,-0.0000,0.2689,-0.5851 +0.7651,-0.0000,0.2689,-0.5851 +0.7740,-0.0000,0.2705,-0.5725 +0.7740,-0.0000,0.2705,-0.5725 +0.7740,-0.0000,0.2705,-0.5725 +0.7740,-0.0000,0.2705,-0.5725 +0.7826,-0.0000,0.2720,-0.5599 +0.7826,-0.0000,0.2720,-0.5599 +0.7826,-0.0000,0.2720,-0.5599 +0.7826,-0.0000,0.2720,-0.5599 +0.7910,-0.0000,0.2736,-0.5472 +0.7910,-0.0000,0.2736,-0.5472 +0.7910,-0.0000,0.2736,-0.5472 +0.7910,-0.0000,0.2736,-0.5472 +0.7992,-0.0000,0.2752,-0.5343 +0.7992,-0.0000,0.2752,-0.5343 +0.7992,-0.0000,0.2752,-0.5343 +0.7992,-0.0000,0.2752,-0.5343 +0.8072,-0.0000,0.2769,-0.5214 +0.8072,-0.0000,0.2769,-0.5214 +0.8072,-0.0000,0.2769,-0.5214 +0.8072,-0.0000,0.2769,-0.5214 +0.8149,-0.0000,0.2786,-0.5083 +0.8149,-0.0000,0.2786,-0.5083 +0.8149,-0.0000,0.2786,-0.5083 +0.8149,-0.0000,0.2786,-0.5083 +0.8223,-0.0000,0.2803,-0.4952 +0.8223,-0.0000,0.2803,-0.4952 +0.8223,-0.0000,0.2803,-0.4952 +0.8223,-0.0000,0.2803,-0.4952 +0.8295,-0.0000,0.2820,-0.4820 +0.8295,-0.0000,0.2820,-0.4820 +0.8295,-0.0000,0.2820,-0.4820 +0.8295,-0.0000,0.2820,-0.4820 +0.8365,-0.0000,0.2838,-0.4687 +0.8365,-0.0000,0.2838,-0.4687 +0.8365,-0.0000,0.2838,-0.4687 +0.8365,-0.0000,0.2838,-0.4687 +0.8433,-0.0000,0.2857,-0.4553 +0.8433,-0.0000,0.2857,-0.4553 +0.8433,-0.0000,0.2857,-0.4553 +0.8433,-0.0000,0.2857,-0.4553 +0.8497,-0.0000,0.2875,-0.4419 +0.8497,-0.0000,0.2875,-0.4419 +0.8497,-0.0000,0.2875,-0.4419 +0.8497,-0.0000,0.2875,-0.4419 +0.8560,-0.0000,0.2894,-0.4284 +0.8560,-0.0000,0.2894,-0.4284 +0.8560,-0.0000,0.2894,-0.4284 +0.8560,-0.0000,0.2894,-0.4284 +0.8620,-0.0000,0.2913,-0.4148 +0.8620,-0.0000,0.2913,-0.4148 +0.8620,-0.0000,0.2913,-0.4148 +0.8620,-0.0000,0.2913,-0.4148 +0.8677,-0.0000,0.2933,-0.4012 +0.8677,-0.0000,0.2933,-0.4012 +0.8677,-0.0000,0.2933,-0.4012 +0.8677,-0.0000,0.2933,-0.4012 +0.8732,-0.0000,0.2953,-0.3876 +0.8732,-0.0000,0.2953,-0.3876 +0.8732,-0.0000,0.2953,-0.3876 +0.8732,-0.0000,0.2953,-0.3876 +0.8785,-0.0000,0.2974,-0.3739 +0.8785,-0.0000,0.2974,-0.3739 +0.8785,-0.0000,0.2974,-0.3739 +0.8785,-0.0000,0.2974,-0.3739 +0.8835,-0.0000,0.2995,-0.3602 +0.8835,-0.0000,0.2995,-0.3602 +0.8835,-0.0000,0.2995,-0.3602 +0.8835,-0.0000,0.2995,-0.3602 +0.8883,-0.0000,0.3016,-0.3465 +0.8883,-0.0000,0.3016,-0.3465 +0.8883,-0.0000,0.3016,-0.3465 +0.8883,-0.0000,0.3016,-0.3465 +0.8928,-0.0000,0.3038,-0.3327 +0.8928,-0.0000,0.3038,-0.3327 +0.8928,-0.0000,0.3038,-0.3327 +0.8928,-0.0000,0.3038,-0.3327 +0.8970,-0.0000,0.3060,-0.3189 +0.8970,-0.0000,0.3060,-0.3189 +0.8970,-0.0000,0.3060,-0.3189 +0.8970,-0.0000,0.3060,-0.3189 +0.9010,-0.0000,0.3083,-0.3051 +0.9010,-0.0000,0.3083,-0.3051 +0.9010,-0.0000,0.3083,-0.3051 +0.9010,-0.0000,0.3083,-0.3051 +0.9048,-0.0000,0.3106,-0.2913 +0.9048,-0.0000,0.3106,-0.2913 +0.9048,-0.0000,0.3106,-0.2913 +0.9048,-0.0000,0.3106,-0.2913 +0.9083,-0.0000,0.3130,-0.2776 +0.9083,-0.0000,0.3130,-0.2776 +0.9083,-0.0000,0.3130,-0.2776 +0.9083,-0.0000,0.3130,-0.2776 +0.9116,-0.0000,0.3154,-0.2638 +0.9116,-0.0000,0.3154,-0.2638 +0.9116,-0.0000,0.3154,-0.2638 +0.9116,-0.0000,0.3154,-0.2638 +0.9146,-0.0000,0.3179,-0.2500 +0.9146,-0.0000,0.3179,-0.2500 +0.9146,-0.0000,0.3179,-0.2500 +0.9146,-0.0000,0.3179,-0.2500 +0.9174,-0.0000,0.3204,-0.2363 +0.9174,-0.0000,0.3204,-0.2363 +0.9174,-0.0000,0.3204,-0.2363 +0.9174,-0.0000,0.3204,-0.2363 +0.9199,-0.0000,0.3229,-0.2226 +0.9199,-0.0000,0.3229,-0.2226 +0.9199,-0.0000,0.3229,-0.2226 +0.9199,-0.0000,0.3229,-0.2226 +0.9222,-0.0000,0.3256,-0.2089 +0.9222,-0.0000,0.3256,-0.2089 +0.9222,-0.0000,0.3256,-0.2089 +0.9222,-0.0000,0.3256,-0.2089 +0.9242,-0.0000,0.3282,-0.1952 +0.9242,-0.0000,0.3282,-0.1952 +0.9242,-0.0000,0.3282,-0.1952 +0.9242,-0.0000,0.3282,-0.1952 +0.9260,-0.0000,0.3309,-0.1817 +0.9260,-0.0000,0.3309,-0.1817 +0.9260,-0.0000,0.3309,-0.1817 +0.9260,-0.0000,0.3309,-0.1817 +0.9276,-0.0000,0.3337,-0.1681 +0.9276,-0.0000,0.3337,-0.1681 +0.9276,-0.0000,0.3337,-0.1681 +0.9276,-0.0000,0.3337,-0.1681 +0.9289,-0.0000,0.3366,-0.1546 +0.9289,-0.0000,0.3366,-0.1546 +0.9289,-0.0000,0.3366,-0.1546 +0.9289,-0.0000,0.3366,-0.1546 +0.9300,-0.0000,0.3395,-0.1412 +0.9300,-0.0000,0.3395,-0.1412 +0.9300,-0.0000,0.3395,-0.1412 +0.9300,-0.0000,0.3395,-0.1412 +0.9308,-0.0000,0.3424,-0.1279 +0.9308,-0.0000,0.3424,-0.1279 +0.9308,-0.0000,0.3424,-0.1279 +0.9308,-0.0000,0.3424,-0.1279 +0.9314,-0.0000,0.3454,-0.1146 +0.9314,-0.0000,0.3454,-0.1146 +0.9314,-0.0000,0.3454,-0.1146 +0.9314,-0.0000,0.3454,-0.1146 +0.9318,-0.0000,0.3485,-0.1015 +0.9318,-0.0000,0.3485,-0.1015 +0.9318,-0.0000,0.3485,-0.1015 +0.9318,-0.0000,0.3485,-0.1015 +0.9320,-0.0000,0.3516,-0.0884 +0.9320,-0.0000,0.3516,-0.0884 +0.9320,-0.0000,0.3516,-0.0884 +0.9320,-0.0000,0.3516,-0.0884 +0.9319,-0.0000,0.3548,-0.0754 +0.9319,-0.0000,0.3548,-0.0754 +0.9319,-0.0000,0.3548,-0.0754 +0.9319,-0.0000,0.3548,-0.0754 +0.9316,-0.0000,0.3581,-0.0625 +0.9316,-0.0000,0.3581,-0.0625 +0.9316,-0.0000,0.3581,-0.0625 +0.9316,-0.0000,0.3581,-0.0625 +0.9311,-0.0000,0.3614,-0.0498 +0.9311,-0.0000,0.3614,-0.0498 +0.9311,-0.0000,0.3614,-0.0498 +0.9311,-0.0000,0.3614,-0.0498 +0.9303,-0.0000,0.3648,-0.0371 +0.9303,-0.0000,0.3648,-0.0371 +0.9303,-0.0000,0.3648,-0.0371 +0.9303,-0.0000,0.3648,-0.0371 +0.9294,-0.0000,0.3683,-0.0246 +0.9294,-0.0000,0.3683,-0.0246 +0.9294,-0.0000,0.3683,-0.0246 +0.9294,-0.0000,0.3683,-0.0246 +0.9282,-0.0000,0.3718,-0.0122 +0.9282,-0.0000,0.3718,-0.0122 +0.9282,-0.0000,0.3718,-0.0122 +0.9282,-0.0000,0.3718,-0.0122 +0.9269,0.0000,0.3754,0.0000 +0.9269,0.0000,0.3754,0.0000 +0.9269,0.0000,0.3754,0.0000 +0.9269,0.0000,0.3754,0.0000 diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv b/scripts/trajectories/full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv new file mode 100644 index 0000000000000000000000000000000000000000..c858131d945425a27860315c123758a1544ad922 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv @@ -0,0 +1,200 @@ +10.0000,10.0000,10.0000,10.7012,9.9780,9.2874 +10.0000,10.0000,10.0000,10.7057,9.9556,9.2929 +10.0000,10.0000,10.0000,10.7095,9.9329,9.2985 +10.0000,10.0000,10.0000,10.7125,9.9100,9.3041 +10.0000,10.0000,10.0000,10.7147,9.8868,9.3097 +10.0000,10.0000,10.0000,10.7161,9.8634,9.3155 +10.0000,10.0000,10.0000,10.7166,9.8398,9.3212 +10.0000,10.0000,10.0000,10.7164,9.8161,9.3270 +10.0000,10.0000,10.0000,10.7153,9.7922,9.3328 +10.0000,10.0000,10.0000,10.7134,9.7682,9.3387 +10.0000,10.0000,10.0000,10.7106,9.7442,9.3446 +10.0000,10.0000,10.0000,10.7070,9.7201,9.3506 +10.0000,10.0000,10.0000,10.7025,9.6960,9.3565 +10.0000,10.0000,10.0000,10.6972,9.6719,9.3626 +10.0000,10.0000,10.0000,10.6910,9.6479,9.3686 +10.0000,10.0000,10.0000,10.6839,9.6240,9.3748 +10.0000,10.0000,10.0000,10.6760,9.6002,9.3809 +10.0000,10.0000,10.0000,10.6671,9.5766,9.3871 +10.0000,10.0000,10.0000,10.6575,9.5532,9.3933 +10.0000,10.0000,10.0000,10.6470,9.5300,9.3996 +10.0000,10.0000,10.0000,10.6356,9.5070,9.4059 +10.0000,10.0000,10.0000,10.6234,9.4843,9.4122 +10.0000,10.0000,10.0000,10.6103,9.4620,9.4186 +10.0000,10.0000,10.0000,10.5964,9.4399,9.4250 +10.0000,10.0000,10.0000,10.5817,9.4183,9.4314 +10.0000,10.0000,10.0000,10.5662,9.3971,9.4379 +10.0000,10.0000,10.0000,10.5499,9.3763,9.4444 +10.0000,10.0000,10.0000,10.5328,9.3560,9.4510 +10.0000,10.0000,10.0000,10.5149,9.3362,9.4576 +10.0000,10.0000,10.0000,10.4963,9.3169,9.4642 +10.0000,10.0000,10.0000,10.4769,9.2982,9.4708 +10.0000,10.0000,10.0000,10.4569,9.2801,9.4775 +10.0000,10.0000,10.0000,10.4361,9.2626,9.4842 +10.0000,10.0000,10.0000,10.4147,9.2457,9.4910 +10.0000,10.0000,10.0000,10.3926,9.2295,9.4977 +10.0000,10.0000,10.0000,10.3698,9.2140,9.5045 +10.0000,10.0000,10.0000,10.3465,9.1993,9.5114 +10.0000,10.0000,10.0000,10.3226,9.1852,9.5182 +10.0000,10.0000,10.0000,10.2981,9.1720,9.5251 +10.0000,10.0000,10.0000,10.2731,9.1595,9.5321 +10.0000,10.0000,10.0000,10.2476,9.1478,9.5390 +10.0000,10.0000,10.0000,10.2216,9.1370,9.5460 +10.0000,10.0000,10.0000,10.1951,9.1270,9.5530 +10.0000,10.0000,10.0000,10.1683,9.1179,9.5601 +10.0000,10.0000,10.0000,10.1410,9.1096,9.5671 +10.0000,10.0000,10.0000,10.1134,9.1023,9.5742 +10.0000,10.0000,10.0000,10.0855,9.0959,9.5813 +10.0000,10.0000,10.0000,10.0572,9.0904,9.5885 +10.0000,10.0000,10.0000,10.0287,9.0858,9.5957 +10.0000,10.0000,10.0000,10.0000,9.0822,9.6029 +10.0000,10.0000,10.0000,9.9711,9.0796,9.6101 +10.0000,10.0000,10.0000,9.9420,9.0779,9.6173 +10.0000,10.0000,10.0000,9.9128,9.0773,9.6246 +10.0000,10.0000,10.0000,9.8835,9.0776,9.6319 +10.0000,10.0000,10.0000,9.8541,9.0788,9.6392 +10.0000,10.0000,10.0000,9.8247,9.0811,9.6465 +10.0000,10.0000,10.0000,9.7953,9.0844,9.6539 +10.0000,10.0000,10.0000,9.7660,9.0887,9.6613 +10.0000,10.0000,10.0000,9.7368,9.0940,9.6687 +10.0000,10.0000,10.0000,9.7076,9.1002,9.6761 +10.0000,10.0000,10.0000,9.6787,9.1075,9.6835 +10.0000,10.0000,10.0000,9.6499,9.1157,9.6910 +10.0000,10.0000,10.0000,9.6213,9.1250,9.6985 +10.0000,10.0000,10.0000,9.5930,9.1352,9.7060 +10.0000,10.0000,10.0000,9.5650,9.1464,9.7135 +10.0000,10.0000,10.0000,9.5374,9.1585,9.7210 +10.0000,10.0000,10.0000,9.5101,9.1716,9.7286 +10.0000,10.0000,10.0000,9.4832,9.1856,9.7361 +10.0000,10.0000,10.0000,9.4567,9.2005,9.7437 +10.0000,10.0000,10.0000,9.4307,9.2164,9.7513 +10.0000,10.0000,10.0000,9.4052,9.2331,9.7589 +10.0000,10.0000,10.0000,9.3802,9.2508,9.7666 +10.0000,10.0000,10.0000,9.3558,9.2693,9.7742 +10.0000,10.0000,10.0000,9.3319,9.2886,9.7819 +10.0000,10.0000,10.0000,9.3087,9.3087,9.7895 +10.0000,10.0000,10.0000,9.2862,9.3297,9.7972 +10.0000,10.0000,10.0000,9.2643,9.3514,9.8049 +10.0000,10.0000,10.0000,9.2431,9.3739,9.8126 +10.0000,10.0000,10.0000,9.2227,9.3971,9.8203 +10.0000,10.0000,10.0000,9.2030,9.4210,9.8281 +10.0000,10.0000,10.0000,9.1841,9.4455,9.8358 +10.0000,10.0000,10.0000,9.1661,9.4708,9.8436 +10.0000,10.0000,10.0000,9.1488,9.4966,9.8513 +10.0000,10.0000,10.0000,9.1324,9.5231,9.8591 +10.0000,10.0000,10.0000,9.1169,9.5501,9.8669 +10.0000,10.0000,10.0000,9.1023,9.5776,9.8747 +10.0000,10.0000,10.0000,9.0886,9.6056,9.8825 +10.0000,10.0000,10.0000,9.0758,9.6341,9.8903 +10.0000,10.0000,10.0000,9.0640,9.6630,9.8981 +10.0000,10.0000,10.0000,9.0532,9.6924,9.9059 +10.0000,10.0000,10.0000,9.0433,9.7221,9.9137 +10.0000,10.0000,10.0000,9.0344,9.7521,9.9215 +10.0000,10.0000,10.0000,9.0265,9.7824,9.9294 +10.0000,10.0000,10.0000,9.0197,9.8130,9.9372 +10.0000,10.0000,10.0000,9.0138,9.8438,9.9451 +10.0000,10.0000,10.0000,9.0090,9.8748,9.9529 +10.0000,10.0000,10.0000,9.0052,9.9060,9.9607 +10.0000,10.0000,10.0000,9.0025,9.9372,9.9686 +10.0000,10.0000,10.0000,9.0008,9.9686,9.9764 +10.0000,10.0000,10.0000,9.0001,10.0000,9.9843 +10.0000,10.0000,10.0000,9.0005,10.0314,9.9921 +10.0000,10.0000,10.0000,9.0020,10.0628,10.0000 +10.0000,10.0000,10.0000,9.0045,10.0941,10.0079 +10.0000,10.0000,10.0000,9.0080,10.1253,10.0157 +10.0000,10.0000,10.0000,9.0126,10.1564,10.0236 +10.0000,10.0000,10.0000,9.0182,10.1873,10.0314 +10.0000,10.0000,10.0000,9.0248,10.2180,10.0393 +10.0000,10.0000,10.0000,9.0325,10.2484,10.0471 +10.0000,10.0000,10.0000,9.0412,10.2786,10.0550 +10.0000,10.0000,10.0000,9.0508,10.3084,10.0628 +10.0000,10.0000,10.0000,9.0615,10.3379,10.0706 +10.0000,10.0000,10.0000,9.0731,10.3670,10.0785 +10.0000,10.0000,10.0000,9.0857,10.3957,10.0863 +10.0000,10.0000,10.0000,9.0992,10.4239,10.0941 +10.0000,10.0000,10.0000,9.1136,10.4516,10.1019 +10.0000,10.0000,10.0000,9.1290,10.4788,10.1097 +10.0000,10.0000,10.0000,9.1452,10.5055,10.1175 +10.0000,10.0000,10.0000,9.1623,10.5316,10.1253 +10.0000,10.0000,10.0000,9.1803,10.5571,10.1331 +10.0000,10.0000,10.0000,9.1991,10.5819,10.1409 +10.0000,10.0000,10.0000,9.2186,10.6061,10.1487 +10.0000,10.0000,10.0000,9.2390,10.6296,10.1564 +10.0000,10.0000,10.0000,9.2601,10.6523,10.1642 +10.0000,10.0000,10.0000,9.2819,10.6744,10.1719 +10.0000,10.0000,10.0000,9.3044,10.6956,10.1797 +10.0000,10.0000,10.0000,9.3276,10.7161,10.1874 +10.0000,10.0000,10.0000,9.3514,10.7357,10.1951 +10.0000,10.0000,10.0000,9.3758,10.7545,10.2028 +10.0000,10.0000,10.0000,9.4008,10.7725,10.2105 +10.0000,10.0000,10.0000,9.4264,10.7895,10.2181 +10.0000,10.0000,10.0000,9.4524,10.8057,10.2258 +10.0000,10.0000,10.0000,9.4790,10.8210,10.2334 +10.0000,10.0000,10.0000,9.5060,10.8354,10.2411 +10.0000,10.0000,10.0000,9.5334,10.8488,10.2487 +10.0000,10.0000,10.0000,9.5612,10.8612,10.2563 +10.0000,10.0000,10.0000,9.5893,10.8728,10.2639 +10.0000,10.0000,10.0000,9.6178,10.8833,10.2714 +10.0000,10.0000,10.0000,9.6465,10.8929,10.2790 +10.0000,10.0000,10.0000,9.6755,10.9014,10.2865 +10.0000,10.0000,10.0000,9.7046,10.9090,10.2940 +10.0000,10.0000,10.0000,9.7340,10.9156,10.3015 +10.0000,10.0000,10.0000,9.7635,10.9212,10.3090 +10.0000,10.0000,10.0000,9.7931,10.9258,10.3165 +10.0000,10.0000,10.0000,9.8227,10.9293,10.3239 +10.0000,10.0000,10.0000,9.8524,10.9319,10.3313 +10.0000,10.0000,10.0000,9.8821,10.9335,10.3387 +10.0000,10.0000,10.0000,9.9117,10.9340,10.3461 +10.0000,10.0000,10.0000,9.9413,10.9336,10.3535 +10.0000,10.0000,10.0000,9.9707,10.9322,10.3608 +10.0000,10.0000,10.0000,10.0000,10.9298,10.3681 +10.0000,10.0000,10.0000,10.0291,10.9264,10.3754 +10.0000,10.0000,10.0000,10.0580,10.9221,10.3827 +10.0000,10.0000,10.0000,10.0867,10.9168,10.3899 +10.0000,10.0000,10.0000,10.1150,10.9105,10.3971 +10.0000,10.0000,10.0000,10.1431,10.9033,10.4043 +10.0000,10.0000,10.0000,10.1708,10.8953,10.4115 +10.0000,10.0000,10.0000,10.1981,10.8863,10.4187 +10.0000,10.0000,10.0000,10.2250,10.8764,10.4258 +10.0000,10.0000,10.0000,10.2515,10.8657,10.4329 +10.0000,10.0000,10.0000,10.2775,10.8541,10.4399 +10.0000,10.0000,10.0000,10.3030,10.8417,10.4470 +10.0000,10.0000,10.0000,10.3280,10.8284,10.4540 +10.0000,10.0000,10.0000,10.3524,10.8144,10.4610 +10.0000,10.0000,10.0000,10.3763,10.7997,10.4679 +10.0000,10.0000,10.0000,10.3995,10.7841,10.4749 +10.0000,10.0000,10.0000,10.4222,10.7679,10.4818 +10.0000,10.0000,10.0000,10.4441,10.7510,10.4886 +10.0000,10.0000,10.0000,10.4654,10.7334,10.4955 +10.0000,10.0000,10.0000,10.4860,10.7152,10.5023 +10.0000,10.0000,10.0000,10.5059,10.6964,10.5090 +10.0000,10.0000,10.0000,10.5251,10.6769,10.5158 +10.0000,10.0000,10.0000,10.5435,10.6570,10.5225 +10.0000,10.0000,10.0000,10.5611,10.6365,10.5292 +10.0000,10.0000,10.0000,10.5780,10.6155,10.5358 +10.0000,10.0000,10.0000,10.5940,10.5940,10.5424 +10.0000,10.0000,10.0000,10.6093,10.5721,10.5490 +10.0000,10.0000,10.0000,10.6237,10.5499,10.5556 +10.0000,10.0000,10.0000,10.6373,10.5272,10.5621 +10.0000,10.0000,10.0000,10.6500,10.5042,10.5686 +10.0000,10.0000,10.0000,10.6619,10.4809,10.5750 +10.0000,10.0000,10.0000,10.6729,10.4573,10.5814 +10.0000,10.0000,10.0000,10.6831,10.4335,10.5878 +10.0000,10.0000,10.0000,10.6924,10.4095,10.5941 +10.0000,10.0000,10.0000,10.7008,10.3852,10.6004 +10.0000,10.0000,10.0000,10.7083,10.3609,10.6067 +10.0000,10.0000,10.0000,10.7150,10.3364,10.6129 +10.0000,10.0000,10.0000,10.7207,10.3119,10.6191 +10.0000,10.0000,10.0000,10.7256,10.2873,10.6252 +10.0000,10.0000,10.0000,10.7296,10.2627,10.6314 +10.0000,10.0000,10.0000,10.7328,10.2381,10.6374 +10.0000,10.0000,10.0000,10.7351,10.2136,10.6435 +10.0000,10.0000,10.0000,10.7365,10.1891,10.6494 +10.0000,10.0000,10.0000,10.7371,10.1648,10.6554 +10.0000,10.0000,10.0000,10.7368,10.1406,10.6613 +10.0000,10.0000,10.0000,10.7357,10.1165,10.6672 +10.0000,10.0000,10.0000,10.7338,10.0927,10.6730 +10.0000,10.0000,10.0000,10.7311,10.0691,10.6788 +10.0000,10.0000,10.0000,10.7275,10.0458,10.6845 +10.0000,10.0000,10.0000,10.7232,10.0227,10.6903 +10.0000,10.0000,10.0000,10.7181,10.0000,10.6959 diff --git a/scripts/trajectories/full-circle-with-up-and-down-4s.csv b/scripts/trajectories/full-circle-with-up-and-down-4s.csv new file mode 100644 index 0000000000000000000000000000000000000000..31692f46736eacc50237c02ec4a532cee6c67927 --- /dev/null +++ b/scripts/trajectories/full-circle-with-up-and-down-4s.csv @@ -0,0 +1,800 @@ +0.9223,-0.0000,0.3863,-0.0119 +0.9223,-0.0000,0.3863,-0.0119 +0.9223,-0.0000,0.3863,-0.0119 +0.9223,-0.0000,0.3863,-0.0119 +0.9235,-0.0000,0.3828,-0.0240 +0.9235,-0.0000,0.3828,-0.0240 +0.9235,-0.0000,0.3828,-0.0240 +0.9235,-0.0000,0.3828,-0.0240 +0.9245,-0.0000,0.3794,-0.0363 +0.9245,-0.0000,0.3794,-0.0363 +0.9245,-0.0000,0.3794,-0.0363 +0.9245,-0.0000,0.3794,-0.0363 +0.9253,-0.0000,0.3760,-0.0486 +0.9253,-0.0000,0.3760,-0.0486 +0.9253,-0.0000,0.3760,-0.0486 +0.9253,-0.0000,0.3760,-0.0486 +0.9259,-0.0000,0.3727,-0.0611 +0.9259,-0.0000,0.3727,-0.0611 +0.9259,-0.0000,0.3727,-0.0611 +0.9259,-0.0000,0.3727,-0.0611 +0.9263,-0.0000,0.3695,-0.0737 +0.9263,-0.0000,0.3695,-0.0737 +0.9263,-0.0000,0.3695,-0.0737 +0.9263,-0.0000,0.3695,-0.0737 +0.9265,-0.0000,0.3663,-0.0865 +0.9265,-0.0000,0.3663,-0.0865 +0.9265,-0.0000,0.3663,-0.0865 +0.9265,-0.0000,0.3663,-0.0865 +0.9264,-0.0000,0.3632,-0.0993 +0.9264,-0.0000,0.3632,-0.0993 +0.9264,-0.0000,0.3632,-0.0993 +0.9264,-0.0000,0.3632,-0.0993 +0.9261,-0.0000,0.3602,-0.1122 +0.9261,-0.0000,0.3602,-0.1122 +0.9261,-0.0000,0.3602,-0.1122 +0.9261,-0.0000,0.3602,-0.1122 +0.9256,-0.0000,0.3572,-0.1252 +0.9256,-0.0000,0.3572,-0.1252 +0.9256,-0.0000,0.3572,-0.1252 +0.9256,-0.0000,0.3572,-0.1252 +0.9248,-0.0000,0.3543,-0.1383 +0.9248,-0.0000,0.3543,-0.1383 +0.9248,-0.0000,0.3543,-0.1383 +0.9248,-0.0000,0.3543,-0.1383 +0.9239,-0.0000,0.3515,-0.1515 +0.9239,-0.0000,0.3515,-0.1515 +0.9239,-0.0000,0.3515,-0.1515 +0.9239,-0.0000,0.3515,-0.1515 +0.9226,-0.0000,0.3487,-0.1648 +0.9226,-0.0000,0.3487,-0.1648 +0.9226,-0.0000,0.3487,-0.1648 +0.9226,-0.0000,0.3487,-0.1648 +0.9212,-0.0000,0.3460,-0.1781 +0.9212,-0.0000,0.3460,-0.1781 +0.9212,-0.0000,0.3460,-0.1781 +0.9212,-0.0000,0.3460,-0.1781 +0.9195,-0.0000,0.3433,-0.1914 +0.9195,-0.0000,0.3433,-0.1914 +0.9195,-0.0000,0.3433,-0.1914 +0.9195,-0.0000,0.3433,-0.1914 +0.9176,-0.0000,0.3407,-0.2049 +0.9176,-0.0000,0.3407,-0.2049 +0.9176,-0.0000,0.3407,-0.2049 +0.9176,-0.0000,0.3407,-0.2049 +0.9154,-0.0000,0.3382,-0.2183 +0.9154,-0.0000,0.3382,-0.2183 +0.9154,-0.0000,0.3382,-0.2183 +0.9154,-0.0000,0.3382,-0.2183 +0.9130,-0.0000,0.3357,-0.2319 +0.9130,-0.0000,0.3357,-0.2319 +0.9130,-0.0000,0.3357,-0.2319 +0.9130,-0.0000,0.3357,-0.2319 +0.9104,-0.0000,0.3332,-0.2454 +0.9104,-0.0000,0.3332,-0.2454 +0.9104,-0.0000,0.3332,-0.2454 +0.9104,-0.0000,0.3332,-0.2454 +0.9075,-0.0000,0.3308,-0.2590 +0.9075,-0.0000,0.3308,-0.2590 +0.9075,-0.0000,0.3308,-0.2590 +0.9075,-0.0000,0.3308,-0.2590 +0.9043,-0.0000,0.3285,-0.2726 +0.9043,-0.0000,0.3285,-0.2726 +0.9043,-0.0000,0.3285,-0.2726 +0.9043,-0.0000,0.3285,-0.2726 +0.9009,-0.0000,0.3262,-0.2862 +0.9009,-0.0000,0.3262,-0.2862 +0.9009,-0.0000,0.3262,-0.2862 +0.9009,-0.0000,0.3262,-0.2862 +0.8973,-0.0000,0.3240,-0.2998 +0.8973,-0.0000,0.3240,-0.2998 +0.8973,-0.0000,0.3240,-0.2998 +0.8973,-0.0000,0.3240,-0.2998 +0.8934,-0.0000,0.3218,-0.3134 +0.8934,-0.0000,0.3218,-0.3134 +0.8934,-0.0000,0.3218,-0.3134 +0.8934,-0.0000,0.3218,-0.3134 +0.8893,-0.0000,0.3197,-0.3271 +0.8893,-0.0000,0.3197,-0.3271 +0.8893,-0.0000,0.3197,-0.3271 +0.8893,-0.0000,0.3197,-0.3271 +0.8849,-0.0000,0.3176,-0.3407 +0.8849,-0.0000,0.3176,-0.3407 +0.8849,-0.0000,0.3176,-0.3407 +0.8849,-0.0000,0.3176,-0.3407 +0.8803,-0.0000,0.3156,-0.3543 +0.8803,-0.0000,0.3156,-0.3543 +0.8803,-0.0000,0.3156,-0.3543 +0.8803,-0.0000,0.3156,-0.3543 +0.8754,-0.0000,0.3136,-0.3678 +0.8754,-0.0000,0.3136,-0.3678 +0.8754,-0.0000,0.3136,-0.3678 +0.8754,-0.0000,0.3136,-0.3678 +0.8703,-0.0000,0.3116,-0.3814 +0.8703,-0.0000,0.3116,-0.3814 +0.8703,-0.0000,0.3116,-0.3814 +0.8703,-0.0000,0.3116,-0.3814 +0.8650,-0.0000,0.3097,-0.3949 +0.8650,-0.0000,0.3097,-0.3949 +0.8650,-0.0000,0.3097,-0.3949 +0.8650,-0.0000,0.3097,-0.3949 +0.8593,-0.0000,0.3079,-0.4083 +0.8593,-0.0000,0.3079,-0.4083 +0.8593,-0.0000,0.3079,-0.4083 +0.8593,-0.0000,0.3079,-0.4083 +0.8535,-0.0000,0.3061,-0.4217 +0.8535,-0.0000,0.3061,-0.4217 +0.8535,-0.0000,0.3061,-0.4217 +0.8535,-0.0000,0.3061,-0.4217 +0.8474,-0.0000,0.3043,-0.4351 +0.8474,-0.0000,0.3043,-0.4351 +0.8474,-0.0000,0.3043,-0.4351 +0.8474,-0.0000,0.3043,-0.4351 +0.8410,-0.0000,0.3026,-0.4484 +0.8410,-0.0000,0.3026,-0.4484 +0.8410,-0.0000,0.3026,-0.4484 +0.8410,-0.0000,0.3026,-0.4484 +0.8344,-0.0000,0.3010,-0.4617 +0.8344,-0.0000,0.3010,-0.4617 +0.8344,-0.0000,0.3010,-0.4617 +0.8344,-0.0000,0.3010,-0.4617 +0.8276,-0.0000,0.2993,-0.4748 +0.8276,-0.0000,0.2993,-0.4748 +0.8276,-0.0000,0.2993,-0.4748 +0.8276,-0.0000,0.2993,-0.4748 +0.8205,-0.0000,0.2978,-0.4879 +0.8205,-0.0000,0.2978,-0.4879 +0.8205,-0.0000,0.2978,-0.4879 +0.8205,-0.0000,0.2978,-0.4879 +0.8132,-0.0000,0.2962,-0.5010 +0.8132,-0.0000,0.2962,-0.5010 +0.8132,-0.0000,0.2962,-0.5010 +0.8132,-0.0000,0.2962,-0.5010 +0.8056,-0.0000,0.2947,-0.5139 +0.8056,-0.0000,0.2947,-0.5139 +0.8056,-0.0000,0.2947,-0.5139 +0.8056,-0.0000,0.2947,-0.5139 +0.7978,-0.0000,0.2932,-0.5267 +0.7978,-0.0000,0.2932,-0.5267 +0.7978,-0.0000,0.2932,-0.5267 +0.7978,-0.0000,0.2932,-0.5267 +0.7898,-0.0000,0.2918,-0.5395 +0.7898,-0.0000,0.2918,-0.5395 +0.7898,-0.0000,0.2918,-0.5395 +0.7898,-0.0000,0.2918,-0.5395 +0.7815,-0.0000,0.2904,-0.5521 +0.7815,-0.0000,0.2904,-0.5521 +0.7815,-0.0000,0.2904,-0.5521 +0.7815,-0.0000,0.2904,-0.5521 +0.7730,-0.0000,0.2891,-0.5647 +0.7730,-0.0000,0.2891,-0.5647 +0.7730,-0.0000,0.2891,-0.5647 +0.7730,-0.0000,0.2891,-0.5647 +0.7643,-0.0000,0.2878,-0.5771 +0.7643,-0.0000,0.2878,-0.5771 +0.7643,-0.0000,0.2878,-0.5771 +0.7643,-0.0000,0.2878,-0.5771 +0.7553,-0.0000,0.2865,-0.5894 +0.7553,-0.0000,0.2865,-0.5894 +0.7553,-0.0000,0.2865,-0.5894 +0.7553,-0.0000,0.2865,-0.5894 +0.7461,-0.0000,0.2853,-0.6016 +0.7461,-0.0000,0.2853,-0.6016 +0.7461,-0.0000,0.2853,-0.6016 +0.7461,-0.0000,0.2853,-0.6016 +0.7367,-0.0000,0.2841,-0.6136 +0.7367,-0.0000,0.2841,-0.6136 +0.7367,-0.0000,0.2841,-0.6136 +0.7367,-0.0000,0.2841,-0.6136 +0.7271,-0.0000,0.2830,-0.6255 +0.7271,-0.0000,0.2830,-0.6255 +0.7271,-0.0000,0.2830,-0.6255 +0.7271,-0.0000,0.2830,-0.6255 +0.7172,-0.0000,0.2819,-0.6373 +0.7172,-0.0000,0.2819,-0.6373 +0.7172,-0.0000,0.2819,-0.6373 +0.7172,-0.0000,0.2819,-0.6373 +0.7071,-0.0000,0.2808,-0.6490 +0.7071,-0.0000,0.2808,-0.6490 +0.7071,-0.0000,0.2808,-0.6490 +0.7071,-0.0000,0.2808,-0.6490 +0.6968,-0.0000,0.2798,-0.6604 +0.6968,-0.0000,0.2798,-0.6604 +0.6968,-0.0000,0.2798,-0.6604 +0.6968,-0.0000,0.2798,-0.6604 +0.6863,-0.0000,0.2788,-0.6718 +0.6863,-0.0000,0.2788,-0.6718 +0.6863,-0.0000,0.2788,-0.6718 +0.6863,-0.0000,0.2788,-0.6718 +0.6756,-0.0000,0.2779,-0.6829 +0.6756,-0.0000,0.2779,-0.6829 +0.6756,-0.0000,0.2779,-0.6829 +0.6756,-0.0000,0.2779,-0.6829 +0.6646,-0.0000,0.2769,-0.6940 +0.6646,-0.0000,0.2769,-0.6940 +0.6646,-0.0000,0.2769,-0.6940 +0.6646,-0.0000,0.2769,-0.6940 +0.6535,-0.0000,0.2761,-0.7048 +0.6535,-0.0000,0.2761,-0.7048 +0.6535,-0.0000,0.2761,-0.7048 +0.6535,-0.0000,0.2761,-0.7048 +0.6422,-0.0000,0.2752,-0.7155 +0.6422,-0.0000,0.2752,-0.7155 +0.6422,-0.0000,0.2752,-0.7155 +0.6422,-0.0000,0.2752,-0.7155 +0.6306,-0.0000,0.2744,-0.7260 +0.6306,-0.0000,0.2744,-0.7260 +0.6306,-0.0000,0.2744,-0.7260 +0.6306,-0.0000,0.2744,-0.7260 +0.6189,-0.0000,0.2737,-0.7363 +0.6189,-0.0000,0.2737,-0.7363 +0.6189,-0.0000,0.2737,-0.7363 +0.6189,-0.0000,0.2737,-0.7363 +0.6069,-0.0000,0.2730,-0.7464 +0.6069,-0.0000,0.2730,-0.7464 +0.6069,-0.0000,0.2730,-0.7464 +0.6069,-0.0000,0.2730,-0.7464 +0.5948,-0.0000,0.2723,-0.7563 +0.5948,-0.0000,0.2723,-0.7563 +0.5948,-0.0000,0.2723,-0.7563 +0.5948,-0.0000,0.2723,-0.7563 +0.5825,-0.0000,0.2716,-0.7661 +0.5825,-0.0000,0.2716,-0.7661 +0.5825,-0.0000,0.2716,-0.7661 +0.5825,-0.0000,0.2716,-0.7661 +0.5700,-0.0000,0.2710,-0.7756 +0.5700,-0.0000,0.2710,-0.7756 +0.5700,-0.0000,0.2710,-0.7756 +0.5700,-0.0000,0.2710,-0.7756 +0.5574,-0.0000,0.2705,-0.7850 +0.5574,-0.0000,0.2705,-0.7850 +0.5574,-0.0000,0.2705,-0.7850 +0.5574,-0.0000,0.2705,-0.7850 +0.5445,-0.0000,0.2700,-0.7941 +0.5445,-0.0000,0.2700,-0.7941 +0.5445,-0.0000,0.2700,-0.7941 +0.5445,-0.0000,0.2700,-0.7941 +0.5315,-0.0000,0.2695,-0.8030 +0.5315,-0.0000,0.2695,-0.8030 +0.5315,-0.0000,0.2695,-0.8030 +0.5315,-0.0000,0.2695,-0.8030 +0.5184,-0.0000,0.2691,-0.8117 +0.5184,-0.0000,0.2691,-0.8117 +0.5184,-0.0000,0.2691,-0.8117 +0.5184,-0.0000,0.2691,-0.8117 +0.5050,-0.0000,0.2687,-0.8202 +0.5050,-0.0000,0.2687,-0.8202 +0.5050,-0.0000,0.2687,-0.8202 +0.5050,-0.0000,0.2687,-0.8202 +0.4915,-0.0000,0.2684,-0.8285 +0.4915,-0.0000,0.2684,-0.8285 +0.4915,-0.0000,0.2684,-0.8285 +0.4915,-0.0000,0.2684,-0.8285 +0.4779,-0.0000,0.2682,-0.8365 +0.4779,-0.0000,0.2682,-0.8365 +0.4779,-0.0000,0.2682,-0.8365 +0.4779,-0.0000,0.2682,-0.8365 +0.4640,-0.0000,0.2680,-0.8443 +0.4640,-0.0000,0.2680,-0.8443 +0.4640,-0.0000,0.2680,-0.8443 +0.4640,-0.0000,0.2680,-0.8443 +0.4501,-0.0000,0.2678,-0.8519 +0.4501,-0.0000,0.2678,-0.8519 +0.4501,-0.0000,0.2678,-0.8519 +0.4501,-0.0000,0.2678,-0.8519 +0.4360,-0.0000,0.2677,-0.8592 +0.4360,-0.0000,0.2677,-0.8592 +0.4360,-0.0000,0.2677,-0.8592 +0.4360,-0.0000,0.2677,-0.8592 +0.4218,-0.0000,0.2677,-0.8663 +0.4218,-0.0000,0.2677,-0.8663 +0.4218,-0.0000,0.2677,-0.8663 +0.4218,-0.0000,0.2677,-0.8663 +0.4074,-0.0000,0.2677,-0.8731 +0.4074,-0.0000,0.2677,-0.8731 +0.4074,-0.0000,0.2677,-0.8731 +0.4074,-0.0000,0.2677,-0.8731 +0.3929,-0.0000,0.2678,-0.8797 +0.3929,-0.0000,0.2678,-0.8797 +0.3929,-0.0000,0.2678,-0.8797 +0.3929,-0.0000,0.2678,-0.8797 +0.3783,-0.0000,0.2680,-0.8860 +0.3783,-0.0000,0.2680,-0.8860 +0.3783,-0.0000,0.2680,-0.8860 +0.3783,-0.0000,0.2680,-0.8860 +0.3635,-0.0000,0.2683,-0.8921 +0.3635,-0.0000,0.2683,-0.8921 +0.3635,-0.0000,0.2683,-0.8921 +0.3635,-0.0000,0.2683,-0.8921 +0.3487,-0.0000,0.2687,-0.8979 +0.3487,-0.0000,0.2687,-0.8979 +0.3487,-0.0000,0.2687,-0.8979 +0.3487,-0.0000,0.2687,-0.8979 +0.3337,-0.0000,0.2692,-0.9034 +0.3337,-0.0000,0.2692,-0.9034 +0.3337,-0.0000,0.2692,-0.9034 +0.3337,-0.0000,0.2692,-0.9034 +0.3186,-0.0000,0.2698,-0.9087 +0.3186,-0.0000,0.2698,-0.9087 +0.3186,-0.0000,0.2698,-0.9087 +0.3186,-0.0000,0.2698,-0.9087 +0.3034,-0.0000,0.2705,-0.9136 +0.3034,-0.0000,0.2705,-0.9136 +0.3034,-0.0000,0.2705,-0.9136 +0.3034,-0.0000,0.2705,-0.9136 +0.2882,-0.0000,0.2714,-0.9183 +0.2882,-0.0000,0.2714,-0.9183 +0.2882,-0.0000,0.2714,-0.9183 +0.2882,-0.0000,0.2714,-0.9183 +0.2728,-0.0000,0.2725,-0.9227 +0.2728,-0.0000,0.2725,-0.9227 +0.2728,-0.0000,0.2725,-0.9227 +0.2728,-0.0000,0.2725,-0.9227 +0.2573,-0.0000,0.2738,-0.9267 +0.2573,-0.0000,0.2738,-0.9267 +0.2573,-0.0000,0.2738,-0.9267 +0.2573,-0.0000,0.2738,-0.9267 +0.2418,-0.0000,0.2753,-0.9305 +0.2418,-0.0000,0.2753,-0.9305 +0.2418,-0.0000,0.2753,-0.9305 +0.2418,-0.0000,0.2753,-0.9305 +0.2262,-0.0000,0.2771,-0.9339 +0.2262,-0.0000,0.2771,-0.9339 +0.2262,-0.0000,0.2771,-0.9339 +0.2262,-0.0000,0.2771,-0.9339 +0.2105,-0.0000,0.2792,-0.9369 +0.2105,-0.0000,0.2792,-0.9369 +0.2105,-0.0000,0.2792,-0.9369 +0.2105,-0.0000,0.2792,-0.9369 +0.1947,-0.0000,0.2818,-0.9395 +0.1947,-0.0000,0.2818,-0.9395 +0.1947,-0.0000,0.2818,-0.9395 +0.1947,-0.0000,0.2818,-0.9395 +0.1789,-0.0000,0.2848,-0.9417 +0.1789,-0.0000,0.2848,-0.9417 +0.1789,-0.0000,0.2848,-0.9417 +0.1789,-0.0000,0.2848,-0.9417 +0.1630,-0.0000,0.2886,-0.9435 +0.1630,-0.0000,0.2886,-0.9435 +0.1630,-0.0000,0.2886,-0.9435 +0.1630,-0.0000,0.2886,-0.9435 +0.1471,-0.0000,0.2933,-0.9446 +0.1471,-0.0000,0.2933,-0.9446 +0.1471,-0.0000,0.2933,-0.9446 +0.1471,-0.0000,0.2933,-0.9446 +0.1312,-0.0000,0.2991,-0.9452 +0.1312,-0.0000,0.2991,-0.9452 +0.1312,-0.0000,0.2991,-0.9452 +0.1312,-0.0000,0.2991,-0.9452 +0.1152,-0.0000,0.3067,-0.9448 +0.1152,-0.0000,0.3067,-0.9448 +0.1152,-0.0000,0.3067,-0.9448 +0.1152,-0.0000,0.3067,-0.9448 +0.0991,-0.0000,0.3167,-0.9433 +0.0991,-0.0000,0.3167,-0.9433 +0.0991,-0.0000,0.3167,-0.9433 +0.0991,-0.0000,0.3167,-0.9433 +0.0831,-0.0000,0.3307,-0.9401 +0.0831,-0.0000,0.3307,-0.9401 +0.0831,-0.0000,0.3307,-0.9401 +0.0831,-0.0000,0.3307,-0.9401 +0.0670,-0.0000,0.3514,-0.9338 +0.0670,-0.0000,0.3514,-0.9338 +0.0670,-0.0000,0.3514,-0.9338 +0.0670,-0.0000,0.3514,-0.9338 +0.0510,-0.0000,0.3848,-0.9216 +0.0510,-0.0000,0.3848,-0.9216 +0.0510,-0.0000,0.3848,-0.9216 +0.0510,-0.0000,0.3848,-0.9216 +0.0351,-0.0000,0.4473,-0.8937 +0.0351,-0.0000,0.4473,-0.8937 +0.0351,-0.0000,0.4473,-0.8937 +0.0351,-0.0000,0.4473,-0.8937 +0.0196,-0.0000,0.6000,-0.7997 +0.0196,-0.0000,0.6000,-0.7997 +0.0196,-0.0000,0.6000,-0.7997 +0.0196,-0.0000,0.6000,-0.7997 +0.0079,0.0000,1.0000,0.0001 +0.0079,0.0000,1.0000,0.0001 +0.0079,0.0000,1.0000,0.0001 +0.0079,0.0000,1.0000,0.0001 +0.0162,0.0000,0.2425,0.9700 +0.0162,0.0000,0.2425,0.9700 +0.0162,0.0000,0.2425,0.9700 +0.0162,0.0000,0.2425,0.9700 +0.0314,-0.0000,-0.0000,0.9995 +0.0314,-0.0000,-0.0000,0.9995 +0.0314,-0.0000,-0.0000,0.9995 +0.0314,-0.0000,-0.0000,0.9995 +0.0473,-0.0000,-0.0831,0.9954 +0.0473,-0.0000,-0.0831,0.9954 +0.0473,-0.0000,-0.0831,0.9954 +0.0473,-0.0000,-0.0831,0.9954 +0.0633,-0.0000,-0.1241,0.9902 +0.0633,-0.0000,-0.1241,0.9902 +0.0633,-0.0000,-0.1241,0.9902 +0.0633,-0.0000,-0.1241,0.9902 +0.0793,-0.0000,-0.1485,0.9857 +0.0793,-0.0000,-0.1485,0.9857 +0.0793,-0.0000,-0.1485,0.9857 +0.0793,-0.0000,-0.1485,0.9857 +0.0954,-0.0000,-0.1646,0.9817 +0.0954,-0.0000,-0.1646,0.9817 +0.0954,-0.0000,-0.1646,0.9817 +0.0954,-0.0000,-0.1646,0.9817 +0.1114,-0.0000,-0.1762,0.9780 +0.1114,-0.0000,-0.1762,0.9780 +0.1114,-0.0000,-0.1762,0.9780 +0.1114,-0.0000,-0.1762,0.9780 +0.1275,-0.0000,-0.1848,0.9745 +0.1275,-0.0000,-0.1848,0.9745 +0.1275,-0.0000,-0.1848,0.9745 +0.1275,-0.0000,-0.1848,0.9745 +0.1435,-0.0000,-0.1915,0.9709 +0.1435,-0.0000,-0.1915,0.9709 +0.1435,-0.0000,-0.1915,0.9709 +0.1435,-0.0000,-0.1915,0.9709 +0.1594,-0.0000,-0.1970,0.9674 +0.1594,-0.0000,-0.1970,0.9674 +0.1594,-0.0000,-0.1970,0.9674 +0.1594,-0.0000,-0.1970,0.9674 +0.1753,-0.0000,-0.2014,0.9637 +0.1753,-0.0000,-0.2014,0.9637 +0.1753,-0.0000,-0.2014,0.9637 +0.1753,-0.0000,-0.2014,0.9637 +0.1912,-0.0000,-0.2052,0.9599 +0.1912,-0.0000,-0.2052,0.9599 +0.1912,-0.0000,-0.2052,0.9599 +0.1912,-0.0000,-0.2052,0.9599 +0.2070,-0.0000,-0.2085,0.9559 +0.2070,-0.0000,-0.2085,0.9559 +0.2070,-0.0000,-0.2085,0.9559 +0.2070,-0.0000,-0.2085,0.9559 +0.2227,-0.0000,-0.2113,0.9517 +0.2227,-0.0000,-0.2113,0.9517 +0.2227,-0.0000,-0.2113,0.9517 +0.2227,-0.0000,-0.2113,0.9517 +0.2384,-0.0000,-0.2138,0.9473 +0.2384,-0.0000,-0.2138,0.9473 +0.2384,-0.0000,-0.2138,0.9473 +0.2384,-0.0000,-0.2138,0.9473 +0.2540,-0.0000,-0.2161,0.9428 +0.2540,-0.0000,-0.2161,0.9428 +0.2540,-0.0000,-0.2161,0.9428 +0.2540,-0.0000,-0.2161,0.9428 +0.2695,-0.0000,-0.2181,0.9380 +0.2695,-0.0000,-0.2181,0.9380 +0.2695,-0.0000,-0.2181,0.9380 +0.2695,-0.0000,-0.2181,0.9380 +0.2849,-0.0000,-0.2200,0.9330 +0.2849,-0.0000,-0.2200,0.9330 +0.2849,-0.0000,-0.2200,0.9330 +0.2849,-0.0000,-0.2200,0.9330 +0.3002,-0.0000,-0.2217,0.9277 +0.3002,-0.0000,-0.2217,0.9277 +0.3002,-0.0000,-0.2217,0.9277 +0.3002,-0.0000,-0.2217,0.9277 +0.3155,-0.0000,-0.2233,0.9223 +0.3155,-0.0000,-0.2233,0.9223 +0.3155,-0.0000,-0.2233,0.9223 +0.3155,-0.0000,-0.2233,0.9223 +0.3306,-0.0000,-0.2248,0.9166 +0.3306,-0.0000,-0.2248,0.9166 +0.3306,-0.0000,-0.2248,0.9166 +0.3306,-0.0000,-0.2248,0.9166 +0.3457,-0.0000,-0.2263,0.9107 +0.3457,-0.0000,-0.2263,0.9107 +0.3457,-0.0000,-0.2263,0.9107 +0.3457,-0.0000,-0.2263,0.9107 +0.3606,-0.0000,-0.2277,0.9045 +0.3606,-0.0000,-0.2277,0.9045 +0.3606,-0.0000,-0.2277,0.9045 +0.3606,-0.0000,-0.2277,0.9045 +0.3754,-0.0000,-0.2290,0.8981 +0.3754,-0.0000,-0.2290,0.8981 +0.3754,-0.0000,-0.2290,0.8981 +0.3754,-0.0000,-0.2290,0.8981 +0.3901,-0.0000,-0.2303,0.8915 +0.3901,-0.0000,-0.2303,0.8915 +0.3901,-0.0000,-0.2303,0.8915 +0.3901,-0.0000,-0.2303,0.8915 +0.4047,-0.0000,-0.2315,0.8847 +0.4047,-0.0000,-0.2315,0.8847 +0.4047,-0.0000,-0.2315,0.8847 +0.4047,-0.0000,-0.2315,0.8847 +0.4192,-0.0000,-0.2327,0.8776 +0.4192,-0.0000,-0.2327,0.8776 +0.4192,-0.0000,-0.2327,0.8776 +0.4192,-0.0000,-0.2327,0.8776 +0.4335,-0.0000,-0.2339,0.8703 +0.4335,-0.0000,-0.2339,0.8703 +0.4335,-0.0000,-0.2339,0.8703 +0.4335,-0.0000,-0.2339,0.8703 +0.4477,-0.0000,-0.2351,0.8627 +0.4477,-0.0000,-0.2351,0.8627 +0.4477,-0.0000,-0.2351,0.8627 +0.4477,-0.0000,-0.2351,0.8627 +0.4617,-0.0000,-0.2362,0.8550 +0.4617,-0.0000,-0.2362,0.8550 +0.4617,-0.0000,-0.2362,0.8550 +0.4617,-0.0000,-0.2362,0.8550 +0.4756,-0.0000,-0.2374,0.8470 +0.4756,-0.0000,-0.2374,0.8470 +0.4756,-0.0000,-0.2374,0.8470 +0.4756,-0.0000,-0.2374,0.8470 +0.4894,-0.0000,-0.2385,0.8388 +0.4894,-0.0000,-0.2385,0.8388 +0.4894,-0.0000,-0.2385,0.8388 +0.4894,-0.0000,-0.2385,0.8388 +0.5030,-0.0000,-0.2396,0.8304 +0.5030,-0.0000,-0.2396,0.8304 +0.5030,-0.0000,-0.2396,0.8304 +0.5030,-0.0000,-0.2396,0.8304 +0.5164,-0.0000,-0.2408,0.8218 +0.5164,-0.0000,-0.2408,0.8218 +0.5164,-0.0000,-0.2408,0.8218 +0.5164,-0.0000,-0.2408,0.8218 +0.5297,-0.0000,-0.2419,0.8130 +0.5297,-0.0000,-0.2419,0.8130 +0.5297,-0.0000,-0.2419,0.8130 +0.5297,-0.0000,-0.2419,0.8130 +0.5428,-0.0000,-0.2431,0.8039 +0.5428,-0.0000,-0.2431,0.8039 +0.5428,-0.0000,-0.2431,0.8039 +0.5428,-0.0000,-0.2431,0.8039 +0.5558,-0.0000,-0.2442,0.7947 +0.5558,-0.0000,-0.2442,0.7947 +0.5558,-0.0000,-0.2442,0.7947 +0.5558,-0.0000,-0.2442,0.7947 +0.5685,-0.0000,-0.2454,0.7852 +0.5685,-0.0000,-0.2454,0.7852 +0.5685,-0.0000,-0.2454,0.7852 +0.5685,-0.0000,-0.2454,0.7852 +0.5811,-0.0000,-0.2465,0.7756 +0.5811,-0.0000,-0.2465,0.7756 +0.5811,-0.0000,-0.2465,0.7756 +0.5811,-0.0000,-0.2465,0.7756 +0.5936,-0.0000,-0.2477,0.7657 +0.5936,-0.0000,-0.2477,0.7657 +0.5936,-0.0000,-0.2477,0.7657 +0.5936,-0.0000,-0.2477,0.7657 +0.6058,-0.0000,-0.2489,0.7557 +0.6058,-0.0000,-0.2489,0.7557 +0.6058,-0.0000,-0.2489,0.7557 +0.6058,-0.0000,-0.2489,0.7557 +0.6179,-0.0000,-0.2501,0.7455 +0.6179,-0.0000,-0.2501,0.7455 +0.6179,-0.0000,-0.2501,0.7455 +0.6179,-0.0000,-0.2501,0.7455 +0.6297,-0.0000,-0.2513,0.7351 +0.6297,-0.0000,-0.2513,0.7351 +0.6297,-0.0000,-0.2513,0.7351 +0.6297,-0.0000,-0.2513,0.7351 +0.6414,-0.0000,-0.2525,0.7245 +0.6414,-0.0000,-0.2525,0.7245 +0.6414,-0.0000,-0.2525,0.7245 +0.6414,-0.0000,-0.2525,0.7245 +0.6528,-0.0000,-0.2538,0.7137 +0.6528,-0.0000,-0.2538,0.7137 +0.6528,-0.0000,-0.2538,0.7137 +0.6528,-0.0000,-0.2538,0.7137 +0.6641,-0.0000,-0.2550,0.7028 +0.6641,-0.0000,-0.2550,0.7028 +0.6641,-0.0000,-0.2550,0.7028 +0.6641,-0.0000,-0.2550,0.7028 +0.6752,-0.0000,-0.2563,0.6917 +0.6752,-0.0000,-0.2563,0.6917 +0.6752,-0.0000,-0.2563,0.6917 +0.6752,-0.0000,-0.2563,0.6917 +0.6860,-0.0000,-0.2576,0.6804 +0.6860,-0.0000,-0.2576,0.6804 +0.6860,-0.0000,-0.2576,0.6804 +0.6860,-0.0000,-0.2576,0.6804 +0.6967,-0.0000,-0.2590,0.6690 +0.6967,-0.0000,-0.2590,0.6690 +0.6967,-0.0000,-0.2590,0.6690 +0.6967,-0.0000,-0.2590,0.6690 +0.7071,-0.0000,-0.2603,0.6575 +0.7071,-0.0000,-0.2603,0.6575 +0.7071,-0.0000,-0.2603,0.6575 +0.7071,-0.0000,-0.2603,0.6575 +0.7173,-0.0000,-0.2617,0.6457 +0.7173,-0.0000,-0.2617,0.6457 +0.7173,-0.0000,-0.2617,0.6457 +0.7173,-0.0000,-0.2617,0.6457 +0.7273,-0.0000,-0.2631,0.6339 +0.7273,-0.0000,-0.2631,0.6339 +0.7273,-0.0000,-0.2631,0.6339 +0.7273,-0.0000,-0.2631,0.6339 +0.7371,-0.0000,-0.2645,0.6219 +0.7371,-0.0000,-0.2645,0.6219 +0.7371,-0.0000,-0.2645,0.6219 +0.7371,-0.0000,-0.2645,0.6219 +0.7467,-0.0000,-0.2659,0.6097 +0.7467,-0.0000,-0.2659,0.6097 +0.7467,-0.0000,-0.2659,0.6097 +0.7467,-0.0000,-0.2659,0.6097 +0.7560,-0.0000,-0.2674,0.5974 +0.7560,-0.0000,-0.2674,0.5974 +0.7560,-0.0000,-0.2674,0.5974 +0.7560,-0.0000,-0.2674,0.5974 +0.7651,-0.0000,-0.2689,0.5851 +0.7651,-0.0000,-0.2689,0.5851 +0.7651,-0.0000,-0.2689,0.5851 +0.7651,-0.0000,-0.2689,0.5851 +0.7740,-0.0000,-0.2705,0.5725 +0.7740,-0.0000,-0.2705,0.5725 +0.7740,-0.0000,-0.2705,0.5725 +0.7740,-0.0000,-0.2705,0.5725 +0.7826,-0.0000,-0.2720,0.5599 +0.7826,-0.0000,-0.2720,0.5599 +0.7826,-0.0000,-0.2720,0.5599 +0.7826,-0.0000,-0.2720,0.5599 +0.7910,-0.0000,-0.2736,0.5472 +0.7910,-0.0000,-0.2736,0.5472 +0.7910,-0.0000,-0.2736,0.5472 +0.7910,-0.0000,-0.2736,0.5472 +0.7992,-0.0000,-0.2752,0.5343 +0.7992,-0.0000,-0.2752,0.5343 +0.7992,-0.0000,-0.2752,0.5343 +0.7992,-0.0000,-0.2752,0.5343 +0.8072,-0.0000,-0.2769,0.5214 +0.8072,-0.0000,-0.2769,0.5214 +0.8072,-0.0000,-0.2769,0.5214 +0.8072,-0.0000,-0.2769,0.5214 +0.8149,-0.0000,-0.2786,0.5083 +0.8149,-0.0000,-0.2786,0.5083 +0.8149,-0.0000,-0.2786,0.5083 +0.8149,-0.0000,-0.2786,0.5083 +0.8223,-0.0000,-0.2803,0.4952 +0.8223,-0.0000,-0.2803,0.4952 +0.8223,-0.0000,-0.2803,0.4952 +0.8223,-0.0000,-0.2803,0.4952 +0.8295,-0.0000,-0.2820,0.4820 +0.8295,-0.0000,-0.2820,0.4820 +0.8295,-0.0000,-0.2820,0.4820 +0.8295,-0.0000,-0.2820,0.4820 +0.8365,-0.0000,-0.2838,0.4687 +0.8365,-0.0000,-0.2838,0.4687 +0.8365,-0.0000,-0.2838,0.4687 +0.8365,-0.0000,-0.2838,0.4687 +0.8433,-0.0000,-0.2857,0.4553 +0.8433,-0.0000,-0.2857,0.4553 +0.8433,-0.0000,-0.2857,0.4553 +0.8433,-0.0000,-0.2857,0.4553 +0.8497,-0.0000,-0.2875,0.4419 +0.8497,-0.0000,-0.2875,0.4419 +0.8497,-0.0000,-0.2875,0.4419 +0.8497,-0.0000,-0.2875,0.4419 +0.8560,-0.0000,-0.2894,0.4284 +0.8560,-0.0000,-0.2894,0.4284 +0.8560,-0.0000,-0.2894,0.4284 +0.8560,-0.0000,-0.2894,0.4284 +0.8620,-0.0000,-0.2913,0.4148 +0.8620,-0.0000,-0.2913,0.4148 +0.8620,-0.0000,-0.2913,0.4148 +0.8620,-0.0000,-0.2913,0.4148 +0.8677,-0.0000,-0.2933,0.4012 +0.8677,-0.0000,-0.2933,0.4012 +0.8677,-0.0000,-0.2933,0.4012 +0.8677,-0.0000,-0.2933,0.4012 +0.8732,-0.0000,-0.2953,0.3876 +0.8732,-0.0000,-0.2953,0.3876 +0.8732,-0.0000,-0.2953,0.3876 +0.8732,-0.0000,-0.2953,0.3876 +0.8785,-0.0000,-0.2974,0.3739 +0.8785,-0.0000,-0.2974,0.3739 +0.8785,-0.0000,-0.2974,0.3739 +0.8785,-0.0000,-0.2974,0.3739 +0.8835,-0.0000,-0.2995,0.3602 +0.8835,-0.0000,-0.2995,0.3602 +0.8835,-0.0000,-0.2995,0.3602 +0.8835,-0.0000,-0.2995,0.3602 +0.8883,-0.0000,-0.3016,0.3465 +0.8883,-0.0000,-0.3016,0.3465 +0.8883,-0.0000,-0.3016,0.3465 +0.8883,-0.0000,-0.3016,0.3465 +0.8928,-0.0000,-0.3038,0.3327 +0.8928,-0.0000,-0.3038,0.3327 +0.8928,-0.0000,-0.3038,0.3327 +0.8928,-0.0000,-0.3038,0.3327 +0.8970,-0.0000,-0.3060,0.3189 +0.8970,-0.0000,-0.3060,0.3189 +0.8970,-0.0000,-0.3060,0.3189 +0.8970,-0.0000,-0.3060,0.3189 +0.9010,-0.0000,-0.3083,0.3051 +0.9010,-0.0000,-0.3083,0.3051 +0.9010,-0.0000,-0.3083,0.3051 +0.9010,-0.0000,-0.3083,0.3051 +0.9048,-0.0000,-0.3106,0.2913 +0.9048,-0.0000,-0.3106,0.2913 +0.9048,-0.0000,-0.3106,0.2913 +0.9048,-0.0000,-0.3106,0.2913 +0.9083,-0.0000,-0.3130,0.2776 +0.9083,-0.0000,-0.3130,0.2776 +0.9083,-0.0000,-0.3130,0.2776 +0.9083,-0.0000,-0.3130,0.2776 +0.9116,-0.0000,-0.3154,0.2638 +0.9116,-0.0000,-0.3154,0.2638 +0.9116,-0.0000,-0.3154,0.2638 +0.9116,-0.0000,-0.3154,0.2638 +0.9146,-0.0000,-0.3179,0.2500 +0.9146,-0.0000,-0.3179,0.2500 +0.9146,-0.0000,-0.3179,0.2500 +0.9146,-0.0000,-0.3179,0.2500 +0.9174,-0.0000,-0.3204,0.2363 +0.9174,-0.0000,-0.3204,0.2363 +0.9174,-0.0000,-0.3204,0.2363 +0.9174,-0.0000,-0.3204,0.2363 +0.9199,-0.0000,-0.3229,0.2226 +0.9199,-0.0000,-0.3229,0.2226 +0.9199,-0.0000,-0.3229,0.2226 +0.9199,-0.0000,-0.3229,0.2226 +0.9222,-0.0000,-0.3256,0.2089 +0.9222,-0.0000,-0.3256,0.2089 +0.9222,-0.0000,-0.3256,0.2089 +0.9222,-0.0000,-0.3256,0.2089 +0.9242,-0.0000,-0.3282,0.1952 +0.9242,-0.0000,-0.3282,0.1952 +0.9242,-0.0000,-0.3282,0.1952 +0.9242,-0.0000,-0.3282,0.1952 +0.9260,-0.0000,-0.3309,0.1817 +0.9260,-0.0000,-0.3309,0.1817 +0.9260,-0.0000,-0.3309,0.1817 +0.9260,-0.0000,-0.3309,0.1817 +0.9276,-0.0000,-0.3337,0.1681 +0.9276,-0.0000,-0.3337,0.1681 +0.9276,-0.0000,-0.3337,0.1681 +0.9276,-0.0000,-0.3337,0.1681 +0.9289,-0.0000,-0.3366,0.1546 +0.9289,-0.0000,-0.3366,0.1546 +0.9289,-0.0000,-0.3366,0.1546 +0.9289,-0.0000,-0.3366,0.1546 +0.9300,-0.0000,-0.3395,0.1412 +0.9300,-0.0000,-0.3395,0.1412 +0.9300,-0.0000,-0.3395,0.1412 +0.9300,-0.0000,-0.3395,0.1412 +0.9308,-0.0000,-0.3424,0.1279 +0.9308,-0.0000,-0.3424,0.1279 +0.9308,-0.0000,-0.3424,0.1279 +0.9308,-0.0000,-0.3424,0.1279 +0.9314,-0.0000,-0.3454,0.1146 +0.9314,-0.0000,-0.3454,0.1146 +0.9314,-0.0000,-0.3454,0.1146 +0.9314,-0.0000,-0.3454,0.1146 +0.9318,-0.0000,-0.3485,0.1015 +0.9318,-0.0000,-0.3485,0.1015 +0.9318,-0.0000,-0.3485,0.1015 +0.9318,-0.0000,-0.3485,0.1015 +0.9320,-0.0000,-0.3516,0.0884 +0.9320,-0.0000,-0.3516,0.0884 +0.9320,-0.0000,-0.3516,0.0884 +0.9320,-0.0000,-0.3516,0.0884 +0.9319,-0.0000,-0.3548,0.0754 +0.9319,-0.0000,-0.3548,0.0754 +0.9319,-0.0000,-0.3548,0.0754 +0.9319,-0.0000,-0.3548,0.0754 +0.9316,-0.0000,-0.3581,0.0625 +0.9316,-0.0000,-0.3581,0.0625 +0.9316,-0.0000,-0.3581,0.0625 +0.9316,-0.0000,-0.3581,0.0625 +0.9311,-0.0000,-0.3614,0.0498 +0.9311,-0.0000,-0.3614,0.0498 +0.9311,-0.0000,-0.3614,0.0498 +0.9311,-0.0000,-0.3614,0.0498 +0.9303,-0.0000,-0.3648,0.0371 +0.9303,-0.0000,-0.3648,0.0371 +0.9303,-0.0000,-0.3648,0.0371 +0.9303,-0.0000,-0.3648,0.0371 +0.9294,-0.0000,-0.3683,0.0246 +0.9294,-0.0000,-0.3683,0.0246 +0.9294,-0.0000,-0.3683,0.0246 +0.9294,-0.0000,-0.3683,0.0246 +0.9282,-0.0000,-0.3718,0.0122 +0.9282,-0.0000,-0.3718,0.0122 +0.9282,-0.0000,-0.3718,0.0122 +0.9282,-0.0000,-0.3718,0.0122 +0.9269,-0.0000,-0.3754,-0.0000 +0.9269,-0.0000,-0.3754,-0.0000 +0.9269,-0.0000,-0.3754,-0.0000 +0.9269,-0.0000,-0.3754,-0.0000 diff --git a/tests/conftest.py b/tests/conftest.py index 9896c4908fadbe48b84edaeffc87bf5fe1265c12..ef5f46ffc9c13b590fee7485a18499c6b7daec4f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -450,7 +450,22 @@ def test_vector_path(request) -> str: path = str(path.resolve()) return path + +@pytest.fixture(scope="session") +def br_switch_file_path(request) -> str: + """ + Return base directory of test vector files. + """ + if request.config.option.test_vector_path: + return request.config.option.test_vector_path + here = Path(__file__).parent.resolve() + + path = here.joinpath("../scripts/switchPaths") + + path = str(path.resolve()) + + return path @pytest.fixture(scope="session") def reference_path(request) -> str: diff --git a/tests/create_short_testvectors.py b/tests/create_short_testvectors.py index 3b17bf431ce1051f026f358ffc59117aecf0153e..3b92bd8e45ca9e2a303476523ab69c1575eecb14 100755 --- a/tests/create_short_testvectors.py +++ b/tests/create_short_testvectors.py @@ -50,15 +50,15 @@ CUT_LEN = "5.0" def create_short_testvectors(): for fs in ['48', '32', '16']: - in_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c.pcm" + in_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c.wav" cut_gain = "1.0" - cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut.pcm" + cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut.wav" cut_samples(in_file, cut_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, cut_gain) cut_gain = "16.0" - cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut_{cut_gain}.pcm" + cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut_{cut_gain}.wav" cut_samples(in_file, cut_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, cut_gain) cut_gain = ".004" - cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut_{cut_gain}.pcm" + cut_file = f"{TEST_VECTOR_DIR}/stvFOA{fs}c_cut_{cut_gain}.wav" cut_samples(in_file, cut_file, NUM_CHANNELS, fs + "000", CUT_FROM, CUT_LEN, cut_gain) diff --git a/tests/cut_pcm.py b/tests/cut_pcm.py index 0027e3178d214ba6ba00af1404380aca6af5a887..99a6f6fc10bb6a2327a144327b8eb7fae165cba5 100755 --- a/tests/cut_pcm.py +++ b/tests/cut_pcm.py @@ -47,6 +47,13 @@ gain: optional gain value to apply to the copied samples import sys import platform +import numpy as np +from pathlib import Path + +HERE = Path(__file__).parent.resolve() +SCRIPTS_DIR = str(HERE.joinpath("../scripts").resolve()) +sys.path.append(SCRIPTS_DIR) +from pyaudio3dtools import audiofile def usage(): @@ -56,7 +63,7 @@ def usage(): def cut_samples(in_file, out_file, num_channels, sample_rate, start, duration, gain="1.0"): """ - Function to cut samples from a 16-bit PCM file. + Function to cut samples from an audio file (wav or pcm) """ # check for python >= 3.7 @@ -64,46 +71,26 @@ def cut_samples(in_file, out_file, num_channels, sample_rate, start, duration, g sys.exit("This script is written for Python >= 3.7. Found: " + platform.python_version()) # all input parameters are strings - convert some - num_ch = int(num_channels) fs = int(sample_rate) start_sec = float(start) dur_sec = float(duration) gain_f = float(gain) - with open(in_file, "rb") as fid_in: - fid_in.seek(0, 2) - num_in_samples = fid_in.tell() / 2 - num_in_samples_ch = num_in_samples / num_ch - num_samples_to_skip = int(start_sec * fs) - dur_samples = dur_sec * fs - if num_samples_to_skip + dur_samples > num_in_samples_ch: - sys.exit( - f"requested too many samples ({num_samples_to_skip}+{dur_samples})" - + f" - input is too short ({num_in_samples_ch})" - ) - num_bytes_to_skip = num_samples_to_skip * num_ch * 2 - num_bytes_to_copy = dur_samples * num_ch * 2 - fid_in.seek(num_bytes_to_skip, 0) - num_clip = 0 - with open(out_file, "wb") as fid_out: - bytes_written = 0 - while bytes_written < num_bytes_to_copy: - data = fid_in.read(2) - val = int.from_bytes(data, byteorder="little", signed=True) - val = int(val * gain_f) - if val > 32767: - val = 32767 - num_clip += 1 - if val < -32768: - val = -32768 - num_clip += 1 - data = val.to_bytes(2, byteorder="little", signed=True) - written = fid_out.write(data) - assert written == 2, f"Error writing data: {written} != {2}" - bytes_written += 2 - if num_clip: - print(f"{num_clip} output samples have been clipped.") + s, fs = audiofile.readfile(in_file, num_channels, fs, outdtype="float") + + num_in_samples = s.shape[0] + num_samples_to_skip = int(start_sec * fs) + dur_samples = int(dur_sec * fs) + if num_samples_to_skip + dur_samples > num_in_samples: + sys.exit( + f"requested too many samples ({num_samples_to_skip}+{dur_samples})" + + f" - input is too short ({num_in_samples})" + ) + + s_out = s[num_samples_to_skip:num_samples_to_skip + dur_samples, :] * gain_f + audiofile.writefile(out_file, s_out, fs) + def main(argv): if len(argv) < 7: diff --git a/tests/renderer/README.md b/tests/renderer/README.md index 9748d8abf1f67f311eab36b6c80d23b19ae9905a..513bd0991164ff1f79e8c3fe0525cb9955f0d51b 100644 --- a/tests/renderer/README.md +++ b/tests/renderer/README.md @@ -1,3 +1,7 @@ +======================================== +THIS FOLDER WILL NOT BE PART OF DELIVERY +======================================== + # External Renderer Tests See also the [contribution page](https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/wikis/Contributions/2-external-renderer) for related presentations. diff --git a/tests/renderer/__init__.py b/tests/renderer/__init__.py index c2c14754b4940b8f4ab39ef87a35a6356e5cab1a..8429fc9e1cd3947c33336e9c8825c7551a1edfd4 100644 --- a/tests/renderer/__init__.py +++ b/tests/renderer/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. diff --git a/tests/renderer/compare_audio.py b/tests/renderer/compare_audio.py index bf3ce26c93f968ca9bf11d2b17fe7279b4d3d15c..3fc5c064a8e49b44e028b820502f40ab1ca9d619 100644 --- a/tests/renderer/compare_audio.py +++ b/tests/renderer/compare_audio.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. diff --git a/tests/renderer/constants.py b/tests/renderer/constants.py index d71f73e5b767d7503690fd109745ddcf61949764..56b4d71e26de32cf12a9f16664808d5f8675a0c6 100644 --- a/tests/renderer/constants.py +++ b/tests/renderer/constants.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. @@ -94,14 +94,15 @@ FORMAT_TO_FILE_SMOKETEST = { "ISM2": NCHAN_TO_FILE[2], "ISM3": NCHAN_TO_FILE[3], "ISM4": NCHAN_TO_FILE[4], + "NDP_ISM4": NCHAN_TO_FILE[4], # "ISM1": TEST_VECTOR_DIR.joinpath("spectral_test_ism1.txt"), # "ISM2": TEST_VECTOR_DIR.joinpath("spectral_test_ism2.txt"), # "ISM3": TEST_VECTOR_DIR.joinpath("spectral_test_ism3.txt"), # "ISM4": TEST_VECTOR_DIR.joinpath("spectral_test_ism4.txt"), # "MASA1": NCHAN_TO_FILE[1], # "MASA2": NCHAN_TO_FILE[2], - "MASA1": TESTV_DIR.joinpath("stv_IVASMASA_1dir1TC.pcm"), - "MASA2": TESTV_DIR.joinpath("stv_IVASMASA_2dir2TC.pcm"), + "MASA1": TESTV_DIR.joinpath("stv1MASA1TC48c.wav"), + "MASA2": TESTV_DIR.joinpath("stv2MASA2TC48c.wav"), "META": TEST_VECTOR_DIR.joinpath("mixed_scene.txt"), "16ch_8+4+4": NCHAN_TO_FILE[16], "4d4": NCHAN_TO_FILE[8], @@ -109,26 +110,26 @@ FORMAT_TO_FILE_SMOKETEST = { } FORMAT_TO_FILE_COMPARETEST = { - "MONO": TESTV_DIR.joinpath("test_mono.wav"), - "STEREO": TESTV_DIR.joinpath("test_stereo.wav"), - "5_1": TESTV_DIR.joinpath("test_MC51.wav"), - "7_1": TESTV_DIR.joinpath("test_MC71.wav"), - "5_1_2": TESTV_DIR.joinpath("test_MC51p2.wav"), - "5_1_4": TESTV_DIR.joinpath("test_MC51p4.wav"), - "7_1_4": TESTV_DIR.joinpath("test_MC71p4.wav"), - "FOA": TESTV_DIR.joinpath("test_FOA.wav"), - "HOA2": TESTV_DIR.joinpath("test_HOA2.wav"), - "HOA3": TESTV_DIR.joinpath("test_HOA3.wav"), - "ISM1": TESTV_DIR.joinpath("test_ISM_1obj.wav"), - "ISM2": TESTV_DIR.joinpath("test_ISM_2obj.wav"), - "ISM3": TESTV_DIR.joinpath("test_ISM_3obj.wav"), - "ISM4": TESTV_DIR.joinpath("test_ISM_4obj.wav"), - "MASA1": TESTV_DIR.joinpath("stv_IVASMASA_1dir1TC.pcm"), - "MASA2": TESTV_DIR.joinpath("stv_IVASMASA_2dir2TC.pcm"), + "MONO": TESTV_DIR.joinpath("stv48c.wav"), + "STEREO": TESTV_DIR.joinpath("stvST48c.wav"), + "5_1": TESTV_DIR.joinpath("stv51MC48c.wav"), + "7_1": TESTV_DIR.joinpath("stv71MC48c.wav"), + "5_1_2": TESTV_DIR.joinpath("stv512MC48c.wav"), + "5_1_4": TESTV_DIR.joinpath("stv514MC48c.wav"), + "7_1_4": TESTV_DIR.joinpath("stv714MC48c.wav"), + "FOA": TESTV_DIR.joinpath("stvFOA48c.wav"), + "HOA2": TESTV_DIR.joinpath("stv2OA48c.wav"), + "HOA3": TESTV_DIR.joinpath("stv3OA48c.wav"), + "ISM1": TESTV_DIR.joinpath("stv1ISM48s.wav"), + "ISM2": TESTV_DIR.joinpath("stv2ISM48s.wav"), + "ISM3": TESTV_DIR.joinpath("stv3ISM48s.wav"), + "ISM4": TESTV_DIR.joinpath("stv4ISM48s.wav"), + "MASA1": TESTV_DIR.joinpath("stv1MASA1TC48c.wav"), + "MASA2": TESTV_DIR.joinpath("stv2MASA2TC48c.wav"), "META": TEST_VECTOR_DIR.joinpath("mixed_scene.txt"), - "16ch_8+4+4": TESTV_DIR.joinpath("test_HOA3.wav"), - "4d4": TESTV_DIR.joinpath("test_MC71.wav"), - "t_design_4": TESTV_DIR.joinpath("test_MC71p4.wav"), + "16ch_8+4+4": TESTV_DIR.joinpath("stv3OA48c.wav"), + "4d4": TESTV_DIR.joinpath("stv71MC48c.wav"), + "t_design_4": TESTV_DIR.joinpath("stv714MC48c.wav"), } FORMAT_TO_METADATA_FILES = { @@ -148,8 +149,14 @@ FORMAT_TO_METADATA_FILES = { str(TESTV_DIR.joinpath("stvISM3.csv")), str(TESTV_DIR.joinpath("stvISM4.csv")), ], - "MASA1": [str(TESTV_DIR.joinpath("stv_IVASMASA_1dir1TC.met"))], - "MASA2": [str(TESTV_DIR.joinpath("stv_IVASMASA_2dir2TC.met"))], + "NDP_ISM4": [ + str(TESTV_DIR.joinpath("stvISM1.csv")), + str(TESTV_DIR.joinpath("stvISM2_non-diegetic-pan.csv")), + str(TESTV_DIR.joinpath("stvISM3.csv")), + str(TESTV_DIR.joinpath("stvISM4.csv")), + ], + "MASA1": [str(TESTV_DIR.joinpath("stv1MASA1TC48c.met"))], + "MASA2": [str(TESTV_DIR.joinpath("stv2MASA2TC48c.met"))], } @@ -193,6 +200,10 @@ HR_TRAJECTORIES_TO_TEST = [ "rotate_yaw_pitch_roll1", ] +CONFIG_FILES_TO_TEST = [ + "just_reverb" +] + """ Per-testcase xfail SNR thresholds (dB) """ pass_snr = dict() # not relevant for tests anymore, should be deprecated soon _pass_snr = { diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index 866d2eee2c91eb9f231705d4117f5fe5a532dda6..38b7bbf9e743c4f479790c58a91e782623c806ca 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. @@ -26,12 +26,10 @@ the United Nations Convention on Contracts on the International Sales of Goods. """ - import pytest from .utils import * - """ Ambisonics """ @@ -58,6 +56,174 @@ def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): ) +# Test compares rendering with render config file containing just reverb defaults against rendering without config file. +# These should be binary equivalent. +@pytest.mark.parametrize("config_file", CONFIG_FILES_TO_TEST) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) +def test_ambisonics_binaural_headrotation_defaultrenderconfig(test_info, in_fmt, out_fmt, config_file): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "defaultrenderconfig" + }, + cut_kwargs={ + "config_file": TESTV_DIR.joinpath(f"{config_file}.cfg") + } + ) + +# Test compares rendering with just a trajectory file against rendering with a trajectory file + a zero ref rotation. +# These should be binary equivalent. +@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refrotzero(test_info, in_fmt, out_fmt, trj_file): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refrotzero", + "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv") + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), + "refrot_file": HR_TRAJECTORY_DIR.joinpath("const000.csv") + } + ) + + +# Second test compares rendering with no head rotation against rendering with equal ref and head rotation. +# These should also be binary equivalent. +# Note that reference rotation is supplied per 4 subframes; head rotation per subframe. +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refrotequal", + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("azi_plus_2-ele_plus_2-every-100-frames.csv"), + "refrot_file": HR_TRAJECTORY_DIR.joinpath("azi_plus_2-ele_plus_2-every-25-rows.csv") + } + ) + +# This test compares rendering with: +# ref: head rotation trajectory file (OTR=NONE) +# cut: identical head rotation trajectory file as ref but in addition a constant +# reference vector in the looking direction of the coordinate system (OTR=REF_VEC) +@pytest.mark.parametrize("trj_file", HR_TRAJECTORIES_TO_TEST) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refveczero(test_info, in_fmt, out_fmt, trj_file): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refveczero", + "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv") + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("const000-Vector3.csv") + } + ) + +# This test compares rendering with: +# ref: no head rotation (OTR=NONE) +# cut: rendering with head rotation and a ref vector which moves in the +# looking-direction of the head rotation and therefore compensates it (OTR=REF_VEC) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refvecequal(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvecequal", + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-Vector3.csv") + } + ) + +# This test compares rendering with: +# ref: a head rotation trajectory with elevation (OTR=NONE) +# cut: a static head rotation and a reference position trajectory which moves +# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_VEC) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvec_rotating", + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s.csv"), + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-ccw-Vector3.csv") + } + ) + +# This test compares rendering with: +# ref: a head rotation trajectory with elevation (OTR=NONE) +# cut: a static head rotation and a reference position trajectory which moves +# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_VEC) +# which also contains a fixed position offset between listener and reference position (which +# gets compensated in the REF_VEV OTR modes) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refvec_rotating_fixed_pos_offset(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvec_rotating", + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-ccw.csv"), + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv") + } + ) + +# This test compares rendering with: +# ref: a reference position trajectory with elevation and REF_VEC_LEV OTR mode (OTR=REF_VEC_LEV) +# cut: a reference position trajectory without the elevation and REF_VEC OTR mode (OTR=REF_VEC) +# Since the only difference between REF_VEC_LEV and REF_VEC is that *LEV ignores +# the height difference in positions, the output must be binary equivalent. +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI) +def test_ambisonics_binaural_headrotation_refveclev_vs_refvec(test_info, in_fmt, out_fmt): + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refveclevel", + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refveclev_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-Vector3.csv"), + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-4s-Vector3.csv") + } + ) + + """ Multichannel """ @@ -96,6 +262,30 @@ def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file trj_file=HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"), ) +# This test compares rendering with: +# ref: a head rotation trajectory with elevation (OTR=NONE) +# cut: a static head rotation and a reference position trajectory which moves +# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_VEC) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC) +def test_multichannel_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt): + if in_fmt in ["MONO", "STEREO"]: + pytest.skip("MONO or STEREO to Binaural rendering unsupported") + + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvec_rotating", + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s.csv"), + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-ccw-Vector3.csv") + } + ) + """ ISM """ @@ -144,6 +334,33 @@ def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file): in_meta_files=in_meta_files, ) +# This test compares rendering with: +# ref: a head rotation trajectory with elevation (OTR=NONE) +# cut: a static head rotation and a reference position trajectory which moves +# in a way that produces the same acoustic output as the ref head rot trajectory (OTR=REF_VEC) +@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL) +@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM) +def test_ism_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt): + try: + in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt] + except: + in_meta_files = None + + compare_renderer_args( + test_info, + in_fmt, + out_fmt, + ref_kwargs={ + "name_extension": "refvec_rotating", + "trj_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s.csv"), + "in_meta_files": in_meta_files + }, + cut_kwargs={ + "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"), + "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-with-up-and-down-4s-ccw-Vector3.csv"), + "in_meta_files": in_meta_files + } + ) """ MASA """ @@ -224,3 +441,20 @@ def test_metadata(test_info, in_fmt, out_fmt): out_fmt, metadata_input=TEST_VECTOR_DIR.joinpath(f"{in_fmt}.txt"), ) + + +""" non diegetic pan """ + + +@pytest.mark.parametrize("out_fmt", ["STEREO"]) +@pytest.mark.parametrize("in_fmt", ["MONO"]) +@pytest.mark.parametrize("non_diegetic_pan", ["0", "-30", "45", "90", "-90"]) +def test_non_diegetic_pan_static(test_info, in_fmt, out_fmt, non_diegetic_pan): + run_renderer(in_fmt, out_fmt, non_diegetic_pan=non_diegetic_pan) + + +@pytest.mark.parametrize("out_fmt", ["STEREO"]) +@pytest.mark.parametrize("in_fmt", ["ISM1"]) +@pytest.mark.parametrize("non_diegetic_pan", ["0", "-30", "45", "90", "-90"]) +def test_non_diegetic_pan_ism_static(test_info, in_fmt, out_fmt, non_diegetic_pan): + run_renderer(in_fmt, out_fmt, non_diegetic_pan=non_diegetic_pan) diff --git a/tests/renderer/test_renderer_be_comparison.py b/tests/renderer/test_renderer_be_comparison.py index 815d7fd640b2d53dd5fffcc5f3402e3a8c552a52..460ded4250421168864976c3941e2c2fbab34561 100644 --- a/tests/renderer/test_renderer_be_comparison.py +++ b/tests/renderer/test_renderer_be_comparison.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. @@ -203,3 +203,22 @@ def test_metadata(test_info, in_fmt, out_fmt): metadata_input=TEST_VECTOR_DIR.joinpath(f"{in_fmt}.txt"), is_comparetest=True, ) + + +""" non diegetic pan """ + + +# @pytest.mark.parametrize("out_fmt", ["STEREO"]) +# @pytest.mark.parametrize("in_fmt", ["MONO"]) +# @pytest.mark.parametrize("non_diegetic_pan", ["0", "-0.2", "0.5", "1", "-1"]) +# def test_non_diegetic_pan_static(test_info, in_fmt, out_fmt, non_diegetic_pan): +# compare_renderer_vs_mergetarget( +# test_info, in_fmt, out_fmt, non_diegetic_pan=non_diegetic_pan) + + +# @pytest.mark.parametrize("out_fmt", ["STEREO"]) +# @pytest.mark.parametrize("in_fmt", ["ISM1"]) +# @pytest.mark.parametrize("non_diegetic_pan", ["0", "-0.2", "0.5", "1", "-1"]) +# def test_non_diegetic_pan_ism_static(test_info, in_fmt, out_fmt, non_diegetic_pan): +# compare_renderer_vs_mergetarget( +# test_info, in_fmt, out_fmt, non_diegetic_pan=non_diegetic_pan) diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 143c33b066eaa5961ad3421ffe0793bea94720d6..356902ff47674ff111dbe7541bde3bac8e24bf4e 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ - (C) 2022 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB, + (C) 2022-2023 Baseline Development Group 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 Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved. @@ -31,12 +31,11 @@ import subprocess as sp import sys from pathlib import Path from tempfile import TemporaryDirectory -from typing import Optional, Tuple +from typing import Optional, Tuple, Dict import numpy as np import pytest - from .compare_audio import compare_audio_arrays from .constants import * @@ -106,6 +105,12 @@ def run_renderer( metadata_input: Optional[str] = None, in_meta_files: Optional[list] = None, trj_file: Optional[str] = None, + non_diegetic_pan: Optional[str] = None, + name_extension: Optional[str] = None, + refrot_file: Optional[str] = None, + refvec_file: Optional[str] = None, + refveclev_file: Optional[str] = None, + config_file: Optional[str] = None, output_path_base: str = OUTPUT_PATH_CUT, binary_suffix: str = "", is_comparetest: Optional[bool] = False, @@ -116,6 +121,28 @@ def run_renderer( else: trj_name = "" + if refrot_file is not None: + refrot_name = f"_{refrot_file.stem}" + else: + refrot_name = "" + + if refvec_file is not None: + refvec_name = f"_{refvec_file.stem}" + else: + refvec_name = "" + + if refveclev_file is not None: + refveclev_name = f"_{refveclev_file.stem}" + else: + refveclev_name = "" + + if config_file is not None: + config_name = f"_{config_file.stem}" + else: + config_name = "" + + + if not isinstance(out_fmt, str): out_name = f"{out_fmt.stem}" else: @@ -136,7 +163,11 @@ def run_renderer( in_file = FORMAT_TO_FILE[in_fmt] in_name = in_fmt - out_file = str(output_path_base.joinpath(f"{in_name}_to_{out_name}{trj_name}.wav")) + out_file = str( + output_path_base.joinpath( + f"{in_name}_to_{out_name}{trj_name}{non_diegetic_pan}{refrot_name}{refvec_name}{refveclev_name}{config_name}{name_extension}.wav" + ) + ) cmd = RENDERER_CMD[:] cmd[2] = str(in_file) @@ -152,60 +183,27 @@ def run_renderer( if trj_file is not None: cmd.extend(["-tf", str(trj_file)]) - run_cmd(cmd) - - return pyaudio3dtools.audiofile.readfile(out_file) - - -def run_pyscripts( - in_fmt, - out_fmt, - metadata_input: Optional[str] = None, - in_meta_files: Optional[list] = None, - trj_file: Optional[str] = None, - is_comparetest: Optional[bool] = False, -) -> Tuple[np.ndarray, int]: - """Reference creation with pyaudio3dtools""" - if trj_file is not None: - trj_name = f"_{trj_file.stem}" - else: - trj_name = "" - - if not isinstance(out_fmt, str): - out_name = f"{out_fmt.stem}" - else: - out_name = out_fmt + if non_diegetic_pan is not None: + cmd.extend(["-non_diegetic_pan", str(non_diegetic_pan)]) + if refrot_file is not None: + cmd.extend(["-rf", str(refrot_file)]) + cmd.extend(["-otr", "ref"]) - if is_comparetest: - FORMAT_TO_FILE = FORMAT_TO_FILE_COMPARETEST - else: - FORMAT_TO_FILE = FORMAT_TO_FILE_SMOKETEST + if refvec_file is not None: + cmd.extend(["-rvf", str(refvec_file)]) + cmd.extend(["-otr", "ref_vec"]) - if metadata_input is not None: - in_file = metadata_input - in_name = metadata_input.stem - elif isinstance(in_fmt, Path): - in_file = FORMAT_TO_FILE[in_fmt.stem] - in_name = in_fmt.stem - else: - in_file = FORMAT_TO_FILE[in_fmt] - in_name = in_fmt + if refveclev_file is not None: + cmd.extend(["-rvf", str(refveclev_file)]) + cmd.extend(["-otr", "ref_vec_lev"]) - out_file = str(OUTPUT_PATH_REF.joinpath(f"{in_name}_to_{out_name}{trj_name}.wav")) + if config_file is not None: + cmd.extend(["-rc", str(config_file)]) - pyaudio3dtools.spatialaudioconvert.spatial_audio_convert( - in_file, - out_file, - in_format=in_fmt, - out_format=out_fmt, - in_meta_files=in_meta_files, - trajectory=trj_file, - limit_output=True, - ) + run_cmd(cmd) return pyaudio3dtools.audiofile.readfile(out_file) - def compare_renderer_vs_mergetarget(test_info, in_fmt, out_fmt, **kwargs): ref, ref_fs = run_renderer( in_fmt, @@ -222,3 +220,8 @@ def compare_renderer_vs_pyscripts(test_info, in_fmt, out_fmt, **kwargs): ref, ref_fs = run_pyscripts(in_fmt, out_fmt, **kwargs) cut, cut_fs = run_renderer(in_fmt, out_fmt, **kwargs) check_BE(test_info, ref, ref_fs, cut, cut_fs) + +def compare_renderer_args(test_info, in_fmt, out_fmt, ref_kwargs: Dict, cut_kwargs: Dict): + ref, ref_fs = run_renderer(in_fmt, out_fmt, **ref_kwargs) + cut, cut_fs = run_renderer(in_fmt, out_fmt, **cut_kwargs) + check_BE(test_info, ref, ref_fs, cut, cut_fs) \ No newline at end of file diff --git a/tests/test_param_file.py b/tests/test_param_file.py index a4cfa12e2ad2ad488b82fbce4aa2d2fbb905d0bb..7774d5940344f037936ad68799de5d5924ef10c0 100644 --- a/tests/test_param_file.py +++ b/tests/test_param_file.py @@ -360,7 +360,7 @@ def pre_proc_input(testv_file, fs): num_channel = "9" elif "stv3OA" in testv_file: num_channel = "16" - cut_file = testv_file.replace(".pcm", num_channel + "chn_" + cut_gain + ".pcm") + cut_file = testv_file.replace(".wav", num_channel + "chn_" + cut_gain + ".wav") cut_samples( testv_file, cut_file, num_channel, fs + "000", cut_from, cut_len, cut_gain ) diff --git a/tests/test_sba_bs_enc.py b/tests/test_sba_bs_enc.py index 2b659432c214b3f7145b6d8ddb5250d5ffb73aad..6825ee12ba3d162a21759cbab87d8a8aa8d2aaaa 100644 --- a/tests/test_sba_bs_enc.py +++ b/tests/test_sba_bs_enc.py @@ -45,15 +45,15 @@ from conftest import EncoderFrontend, DecoderFrontend # params tag_list = ['stvFOA'] -tag_list_HOA2 = ['test_HOA2'] -tag_list_HOA3 = ['test_HOA3'] +tag_list_HOA2 = ['stv2OA'] +tag_list_HOA3 = ['stv3OA'] tag_list_bw_force = ['stvFOA'] dtx_set = ['0', '1'] dict_fsample_bw = {'48': '3', '32': '2', '16': '1'} dict_bw_idx = {'FB': '3', 'SWB': '2', 'WB': '1'} dict_bw_tag = {'SWB': '_ForceSWB', 'WB': '_ForceWB'} -ivas_br_FOA = ['32000', '64000', '96000', '160000', '256000', '384000', '512000'] +ivas_br_FOA = ['32000','64000', '96000', '160000', '256000', '384000', '512000','sw_24k4_256k.bin'] ivas_br_HOA2 = ['256000', '384000', '512000'] ivas_br_HOA3 = ['256000', '384000', '512000'] @@ -111,6 +111,7 @@ def test_bypass_enc( ref_encoder_path, reference_path, dut_base_path, + None, tag, fs, ivas_br, @@ -119,7 +120,8 @@ def test_bypass_enc( bypass, agc, sba_order, - update_ref + update_ref, + cut_testv=True ) # dec @@ -155,6 +157,7 @@ def test_sba_enc_system( dut_base_path, ref_encoder_path, ref_decoder_path, + br_switch_file_path, update_ref, keep_files, ivas_br, @@ -166,7 +169,9 @@ def test_sba_enc_system( if dtx == '1' and ivas_br not in ['32000', '64000']: # skip high bitrates for DTX until DTX issue is resolved pytest.skip() - + if ivas_br == 'sw_24k4_256k.bin' and agc != 1: + pytest.skip() + tag = tag + fs + 'c' max_bw = "FB" bypass = -1 @@ -185,6 +190,7 @@ def test_sba_enc_system( ref_encoder_path, reference_path, dut_base_path, + br_switch_file_path, tag, fs, ivas_br, @@ -195,7 +201,8 @@ def test_sba_enc_system( sba_order, update_ref, cut_gain=cut_gain, - create_dutenc=True + create_dutenc=True, + cut_testv=True ) # dec @@ -237,7 +244,7 @@ def test_spar_hoa2_enc_system( dtx = '0' agc = -1 -# tag = tag + '_' + fs + 'k' + tag = tag + fs + 'c' max_bw = "FB" bypass = -1 sba_order = "+2" @@ -250,6 +257,7 @@ def test_spar_hoa2_enc_system( ref_encoder_path, reference_path, dut_base_path, + None, tag, fs, ivas_br, @@ -259,7 +267,6 @@ def test_spar_hoa2_enc_system( agc, sba_order, update_ref, - '.wav' ) # dec @@ -301,7 +308,7 @@ def test_spar_hoa3_enc_system( dtx = '0' agc = -1 -# tag = tag + '_' + fs + 'k' + tag = tag + fs + 'c' max_bw = "FB" bypass = -1 sba_order = "+3" @@ -314,6 +321,7 @@ def test_spar_hoa3_enc_system( ref_encoder_path, reference_path, dut_base_path, + None, tag, fs, ivas_br, @@ -323,7 +331,6 @@ def test_spar_hoa3_enc_system( agc, sba_order, update_ref, - '.wav' ) # dec @@ -368,7 +375,8 @@ def test_sba_enc_BWforce_system( if dtx == '1' and ivas_br not in ['32000', '64000']: # skip high bitrates for DTX until DTX issue is resolved pytest.skip() - + if ivas_br == 'sw_24k4_256k.bin': + pytest.skip() fs = sample_rate_bw_idx[0] bw = sample_rate_bw_idx[1] tag = tag + fs + 'c' @@ -384,6 +392,7 @@ def test_sba_enc_BWforce_system( ref_encoder_path, reference_path, dut_base_path, + None, tag, fs, ivas_br, @@ -392,7 +401,8 @@ def test_sba_enc_BWforce_system( bypass, agc, sba_order, - update_ref + update_ref, + cut_testv=True ) # dec @@ -422,6 +432,7 @@ def sba_enc( ref_encoder_path, reference_path, dut_base_path, + br_switch_file_path, tag, sampling_rate, ivas_br, @@ -431,9 +442,9 @@ def sba_enc( agc, sba_order, update_ref, - in_extension='.pcm', cut_gain='1.0', - create_dutenc=False + create_dutenc=False, + cut_testv=False ): # ------------ run cmd ------------ @@ -443,6 +454,8 @@ def sba_enc( check_and_makedir(dut_out_dir) check_and_makedir(ref_out_dir) + in_extension = ".wav" + tag_in = tag # sampling rate to BW mapping bw_idx = dict_fsample_bw[sampling_rate] @@ -450,6 +463,8 @@ def sba_enc( tag = tag + dict_bw_tag[ivas_max_bw] tag_out = f"{tag}_ivasbr{ivas_br[:-3]}k_DTX{dtx}" + if ivas_br == 'sw_24k4_256k.bin': + ivas_br = f"{br_switch_file_path}/sw_24k4_256k.bin" short_tag_ext = "" if agc != -1: short_tag_ext += f'_AGC{agc}' @@ -468,7 +483,7 @@ def sba_enc( bypass_mode = bypass if bypass >= 0 else None dtx_mode = dtx == '1' - if in_extension == '.pcm': + if cut_testv: # use shortened and potentially gain adjusted input PCM file - create if not present # cut input PCM file: currently with mostly fixed (i.e. not test dependant) values num_channels = "4" # currently only FOA inputs end up, here