├── audio2x-sdk ├── VERSION.md └── RELEASE_NOTES.md ├── .gitattributes ├── .gitignore ├── audio2emotion-sdk ├── source │ ├── samples │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── sample-a2e-executor │ │ │ └── CMakeLists.txt │ │ └── sample-a2e-inference │ │ │ └── CMakeLists.txt │ ├── benchmarks │ │ ├── test_benchmark.sh │ │ ├── test_benchmark.bat │ │ ├── CMakeLists.txt │ │ └── main.cpp │ └── audio2emotion-core │ │ └── CMakeLists.txt ├── CMakeLists.txt ├── scripts │ ├── gen_test_data.py │ ├── gen_sample_data.py │ ├── common.py │ └── utils.py ├── include │ └── audio2emotion │ │ ├── dll_export.h │ │ ├── internal │ │ ├── model.h │ │ ├── executor_postprocess_core.h │ │ ├── logger.h │ │ ├── multitrack_postprocess_cuda.h │ │ └── executor_classifier.h │ │ └── model.h └── tests │ ├── utils.h │ ├── CMakeLists.txt │ ├── utils.cpp │ └── main.cpp ├── audio2x-common ├── CMakeLists.txt ├── source │ └── audio2x │ │ ├── CMakeLists.txt │ │ ├── interactive_executor.cpp │ │ ├── cuda_utils.cpp │ │ ├── logger_trt.cpp │ │ ├── audio_accumulator_cuda.cu │ │ ├── nvtx_trace.cpp │ │ └── tensor_cuda.cu ├── scripts │ ├── audio2x │ │ ├── __init__.py │ │ └── common.py │ ├── gen_test_data.py │ └── gen_test_data_scripts │ │ └── gen_test_data_io.py ├── tests │ ├── CMakeLists.txt │ ├── utils.h │ ├── utils.cpp │ ├── main.cpp │ └── test_npz_util.cpp └── include │ └── audio2x │ ├── cuda_fwd.h │ ├── internal │ ├── npz_utils.h │ ├── audio_accumulator_cuda.h │ ├── tensor_cuda.h │ ├── audio_utils.h │ ├── animated_tensor_cuda.h │ ├── executor.h │ ├── logger_trt.h │ ├── cuda_stream.h │ ├── tensor_dict.h │ ├── nvtx_trace.h │ ├── unique_ptr.h │ ├── io.h │ ├── tensor_pool.h │ └── logger.h │ ├── cuda_utils.h │ ├── export.h │ ├── tensor.h │ ├── cuda_stream.h │ ├── io.h │ └── audio_accumulator.h ├── sample-data ├── audio_1sec_16k_s16le.wav ├── audio_4sec_16k_s16le.wav └── audio_6sec_48k_s16le.wav ├── audio2face-sdk ├── source │ ├── samples │ │ ├── CMakeLists.txt │ │ ├── sample-a2f-executor │ │ │ └── CMakeLists.txt │ │ ├── sample-a2f-a2e-executor │ │ │ └── CMakeLists.txt │ │ ├── sample-a2f-low-level-api-fullface │ │ │ └── CMakeLists.txt │ │ └── README.md │ ├── benchmarks │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── test_benchmark.sh │ │ └── test_benchmark.bat │ └── audio2face-core │ │ ├── CMakeLists.txt │ │ ├── error.cpp │ │ └── blendshape_solver_cuda.cu ├── CMakeLists.txt ├── scripts │ ├── gen_test_data.py │ ├── common.py │ ├── gen_test_data_scripts │ │ └── gen_test_data_interpolator.py │ └── util │ │ └── interpolator.py ├── tests │ ├── utils.h │ ├── CMakeLists.txt │ ├── utils.cpp │ ├── main.cpp │ ├── test_core_error.cpp │ └── test_core_batch_eyes_animator_cuda.h └── include │ └── audio2face │ ├── dll_export.h │ ├── job_runner.h │ ├── internal │ ├── eigen_utils.h │ ├── mask_extraction.h │ ├── admm.h │ ├── cublas_handle.h │ ├── logger.h │ ├── job_runner.h │ ├── executor_regression.h │ ├── math_utils.h │ └── executor_diffusion.h │ └── noise.h ├── tools └── packman │ ├── config.packman.xml │ ├── python.bat │ ├── python.sh │ └── bootstrap │ ├── fetch_file_from_packman_bootstrap.cmd │ └── download_file_from_url.ps1 ├── deps ├── build-deps.packman.xml ├── requirements.txt └── target-deps.packman.xml ├── CITATION.md ├── licenses ├── eigen-LICENSE.README ├── audiofile-LICENSE.txt ├── nlohmann_json-LICENSE.txt.1 ├── cxxopts-LICENSE.txt ├── tbtsvd-LICENSE.txt ├── cnpy-LICENSE.txt ├── refl-cpp-LICENSE.txt ├── magic_enum-LICENSE.txt ├── nlohmann_json-LICENSE.MIT ├── audio2x-sdk-LICENSE.txt ├── zlib-LICENSE.txt ├── nlohmann_json-LICENSE.txt.3 ├── gtest-LICENSE.txt ├── eigen-LICENSE.BSD ├── TensorRT-Readme.txt └── eigen-LICENSE.MINPACK ├── gen_testdata.bat ├── download_models.bat ├── gen_testdata.sh ├── fetch_deps.sh ├── download_models.sh ├── fetch_deps.bat ├── LICENSE.txt └── cmake └── Modules ├── FindAudioFile.cmake └── FindTbtSVD.cmake /audio2x-sdk/VERSION.md: -------------------------------------------------------------------------------- 1 | 1.0.0 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.wav filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | /_build/ 3 | /_data/ 4 | /_deps/ 5 | /venv/ -------------------------------------------------------------------------------- /audio2emotion-sdk/source/samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(sample-a2e-executor) 2 | add_subdirectory(sample-a2e-inference) 3 | -------------------------------------------------------------------------------- /audio2x-sdk/RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | # [AUDIO2X SDK] Release Notes 2 | 3 | ## Version: 1.0.0 4 | 5 | This is the first release of Audio2X SDK on GitHub -------------------------------------------------------------------------------- /audio2x-common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(A2X_COMMON_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) 2 | 3 | add_subdirectory(source/audio2x) 4 | add_subdirectory(tests) 5 | -------------------------------------------------------------------------------- /sample-data/audio_1sec_16k_s16le.wav: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:3e29663c863380bbcb7758b02715bfcaa9efbe41d378fc3287c7d0e7a8476e7c 3 | size 14696 4 | -------------------------------------------------------------------------------- /sample-data/audio_4sec_16k_s16le.wav: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:9760ba86375cefc5833d2aea2e68604782a364e639899c1e2895233c7ae8c082 3 | size 128078 4 | -------------------------------------------------------------------------------- /sample-data/audio_6sec_48k_s16le.wav: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:65cf40415a4abc0eb52b9a3e1e9f18401872a628f79e3221bdf5b5ce2bbf02b3 3 | size 551894 4 | -------------------------------------------------------------------------------- /audio2face-sdk/source/samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(sample-a2f-a2e-executor) 2 | add_subdirectory(sample-a2f-executor) 3 | add_subdirectory(sample-a2f-low-level-api-fullface) 4 | -------------------------------------------------------------------------------- /audio2face-sdk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(A2F_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) 2 | 3 | add_subdirectory(source/audio2face-core) 4 | add_subdirectory(tests) 5 | add_subdirectory(source/benchmarks) 6 | add_subdirectory(source/samples) 7 | -------------------------------------------------------------------------------- /audio2emotion-sdk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(A2E_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) 2 | 3 | add_subdirectory(source/audio2emotion-core) 4 | add_subdirectory(tests) 5 | add_subdirectory(source/benchmarks) 6 | add_subdirectory(source/samples) 7 | -------------------------------------------------------------------------------- /tools/packman/config.packman.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /deps/build-deps.packman.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /audio2emotion-sdk/source/samples/README.md: -------------------------------------------------------------------------------- 1 | # Audio2Emotion SDK Samples 2 | 3 | This directory contains sample applications demonstrating different aspects of the Audio2Emotion SDK. Each sample showcases specific usage patterns, from high-level executor API to low-level inference engine control. 4 | 5 | ## Sample Overview 6 | 7 | 1. **`sample-a2e-executor`** - High-level executor API for emotion detection. Shows audio loading, emotion classification with preferred emotions, and CSV output. Recommended starting point. 8 | 9 | 2. **`sample-a2e-inference`** - Low-level inference engine API for maximum control. Direct tensor management, manual bindings setup. 10 | -------------------------------------------------------------------------------- /CITATION.md: -------------------------------------------------------------------------------- 1 | # Citation Guide 2 | 3 | If you use Audio2Face-3D Training Framework or Audio2Face-3D models in publications or other outputs, please use citations in the following format (BibTeX entry for LaTeX): 4 | 5 | ```bibtex 6 | @misc{ 7 | nvidia2025audio2face3d, 8 | title={Audio2Face-3D: Audio-driven Realistic Facial Animation For Digital Avatars}, 9 | author={Chaeyeon Chung and Ilya Fedorov and Michael Huang and Aleksey Karmanov and Dmitry Korobchenko and Roger Ribera and Yeongho Seol}, 10 | year={2025}, 11 | eprint={2508.16401}, 12 | archivePrefix={arXiv}, 13 | primaryClass={cs.GR}, 14 | url={https://arxiv.org/abs/2508.16401}, 15 | note={Authors listed in alphabetical order} 16 | } 17 | ``` 18 | -------------------------------------------------------------------------------- /audio2emotion-sdk/source/benchmarks/test_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # At least one arg should be passed 5 | if [ -z "$1" ]; then 6 | echo "Usage: test_benchmark.sh [args...]" 7 | exit 1 8 | fi 9 | 10 | # Define the list of arguments 11 | args=( 12 | "--benchmark_filter=BM_InteractiveExecutorBatch/BatchSize:0/InferencesToSkip:0/Classifier:1/real_time" 13 | "--benchmark_filter=BM_InteractiveExecutorLayer/Layer:0/Classifier:1/real_time" 14 | "--benchmark_filter=BM_ExecutorPartial/ActiveTracks:1/iterations:10/real_time" 15 | ) 16 | 17 | # Iterate over the arguments and execute the benchmark command 18 | for current_arg in "${args[@]}"; do 19 | echo "Running: $@ $current_arg" 20 | bash "$@" "$current_arg" 21 | done 22 | -------------------------------------------------------------------------------- /audio2emotion-sdk/source/samples/sample-a2e-executor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(sample-a2e-executor) 2 | 3 | set_target_properties(sample-a2e-executor PROPERTIES 4 | ARCHIVE_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 5 | LIBRARY_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 6 | RUNTIME_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/bin 7 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin;$" 8 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 9 | ) 10 | target_sources(sample-a2e-executor PRIVATE 11 | main.cpp 12 | ) 13 | 14 | target_compile_definitions(sample-a2e-executor PRIVATE 15 | TEST_DATA_DIR="${TEST_DATA_DIR}" 16 | ) 17 | 18 | target_link_libraries(sample-a2e-executor PRIVATE 19 | audio2x 20 | AudioFile::AudioFile 21 | ) 22 | -------------------------------------------------------------------------------- /audio2face-sdk/source/samples/sample-a2f-executor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(sample-a2f-executor) 2 | 3 | set_target_properties(sample-a2f-executor PROPERTIES 4 | ARCHIVE_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 5 | LIBRARY_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 6 | RUNTIME_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/bin 7 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin;$" 8 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 9 | ) 10 | 11 | target_sources(sample-a2f-executor PRIVATE 12 | main.cpp 13 | ) 14 | 15 | target_compile_definitions(sample-a2f-executor PRIVATE 16 | TEST_DATA_DIR="${TEST_DATA_DIR}" 17 | ) 18 | 19 | target_link_libraries(sample-a2f-executor PRIVATE 20 | audio2x 21 | AudioFile::AudioFile 22 | ) 23 | -------------------------------------------------------------------------------- /audio2emotion-sdk/source/samples/sample-a2e-inference/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(sample-a2e-inference) 2 | 3 | set_target_properties(sample-a2e-inference PROPERTIES 4 | ARCHIVE_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 5 | LIBRARY_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 6 | RUNTIME_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/bin 7 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin;$" 8 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 9 | ) 10 | 11 | target_sources(sample-a2e-inference PRIVATE 12 | main.cpp 13 | ) 14 | 15 | target_compile_definitions(sample-a2e-inference PRIVATE 16 | TEST_DATA_DIR="${TEST_DATA_DIR}" 17 | ) 18 | 19 | target_link_libraries(sample-a2e-inference PRIVATE 20 | audio2x 21 | AudioFile::AudioFile 22 | ) 23 | -------------------------------------------------------------------------------- /audio2face-sdk/source/samples/sample-a2f-a2e-executor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(sample-a2f-a2e-executor) 2 | 3 | set_target_properties(sample-a2f-a2e-executor PROPERTIES 4 | ARCHIVE_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 5 | LIBRARY_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 6 | RUNTIME_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/bin 7 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin;$" 8 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 9 | ) 10 | 11 | target_sources(sample-a2f-a2e-executor PRIVATE 12 | main.cpp 13 | ) 14 | 15 | target_compile_definitions(sample-a2f-a2e-executor PRIVATE 16 | TEST_DATA_DIR="${TEST_DATA_DIR}" 17 | ) 18 | 19 | target_link_libraries(sample-a2f-a2e-executor PRIVATE 20 | audio2x 21 | AudioFile::AudioFile 22 | ) 23 | -------------------------------------------------------------------------------- /licenses/eigen-LICENSE.README: -------------------------------------------------------------------------------- 1 | Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links: 2 | http://www.mozilla.org/MPL/2.0/ 3 | http://www.mozilla.org/MPL/2.0/FAQ.html 4 | 5 | Some files contain third-party code under BSD or LGPL licenses, whence the other 6 | COPYING.* files here. 7 | 8 | All the LGPL code is either LGPL 2.1-only, or LGPL 2.1-or-later. 9 | For this reason, the COPYING.LGPL file contains the LGPL 2.1 text. 10 | 11 | If you want to guarantee that the Eigen code that you are #including is licensed 12 | under the MPL2 and possibly more permissive licenses (like BSD), #define this 13 | preprocessor symbol: 14 | EIGEN_MPL2_ONLY 15 | For example, with most compilers, you could add this to your project CXXFLAGS: 16 | -DEIGEN_MPL2_ONLY 17 | This will cause a compilation error to be generated if you #include any code that is 18 | LGPL licensed. 19 | -------------------------------------------------------------------------------- /gen_testdata.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set "BASE_DIR=%~dp0" 4 | 5 | set PYTHONPATH=%BASE_DIR%audio2x-common\scripts;%PYTHONPATH% 6 | 7 | if not defined TENSORRT_ROOT_DIR ( 8 | echo TENSORRT_ROOT_DIR is not defined 9 | exit /b 1 10 | ) 11 | 12 | set "PATH=%TENSORRT_ROOT_DIR%\bin;%TENSORRT_ROOT_DIR%\lib;%PATH%" 13 | 14 | echo Generating test data... 15 | python "%BASE_DIR%audio2x-common/scripts/gen_test_data.py" || exit /b 16 | python "%BASE_DIR%audio2face-sdk/scripts/gen_test_data.py" || exit /b 17 | python "%BASE_DIR%audio2emotion-sdk/scripts/gen_test_data.py" || exit /b 18 | 19 | echo Generating sample data... 20 | python "%BASE_DIR%audio2face-sdk/scripts/gen_sample_data.py" || exit /b 21 | python "%BASE_DIR%audio2emotion-sdk/scripts/gen_sample_data.py" || exit /b 22 | 23 | echo Generating benchmark data... 24 | python "%BASE_DIR%audio2emotion-sdk/scripts/gen_benchmark_data.py" || exit /b -------------------------------------------------------------------------------- /download_models.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set BASE_DIR=%~dp0 4 | 5 | mkdir %BASE_DIR%_data 6 | 7 | @REM Download A2F models 8 | set A2F_MODEL_DIR=%BASE_DIR%_data\audio2face-models 9 | mkdir "%A2F_MODEL_DIR%" 10 | hf download nvidia/Audio2Face-3D-v3.0 --local-dir %A2F_MODEL_DIR%/audio2face-3d-v3.0 11 | hf download nvidia/Audio2Face-3D-v2.3.1-Claire --local-dir %A2F_MODEL_DIR%/audio2face-3d-v2.3.1-claire 12 | hf download nvidia/Audio2Face-3D-v2.3.1-James --local-dir %A2F_MODEL_DIR%/audio2face-3d-v2.3.1-james 13 | hf download nvidia/Audio2Face-3D-v2.3-Mark --local-dir %A2F_MODEL_DIR%/audio2face-3d-v2.3-mark 14 | 15 | @REM Download A2E models 16 | set A2E_MODEL_DIR=%BASE_DIR%_data\audio2emotion-models 17 | mkdir "%A2E_MODEL_DIR%" 18 | hf download nvidia/Audio2Emotion-v2.2 --local-dir %A2E_MODEL_DIR%/audio2emotion-v2.2 19 | 20 | echo Models are downloaded to %A2F_MODEL_DIR% and %A2E_MODEL_DIR% -------------------------------------------------------------------------------- /deps/requirements.txt: -------------------------------------------------------------------------------- 1 | # PIP requirements for running the Python scripts that generate test data and for using huggingface-cli to download models. 2 | # Extra index URL for PyTorch CUDA builds 3 | --extra-index-url https://download.pytorch.org/whl/cu128 4 | 5 | certifi==2025.7.9 6 | charset-normalizer==3.4.2 7 | colorama==0.4.6 8 | filelock==3.18.0 9 | fsspec==2025.5.1 10 | huggingface-hub==0.34.3 11 | idna==3.10 12 | inquirerpy==0.3.4 13 | Jinja2==3.1.6 14 | MarkupSafe==3.0.2 15 | mpmath==1.3.0 16 | networkx==3.4.2 17 | numpy==1.23.5 18 | onnx==1.18.0 19 | packaging==25.0 20 | pfzy==0.3.4 21 | prompt_toolkit==3.0.51 22 | protobuf==6.31.1 23 | pydub==0.25.1 24 | PyYAML==6.0.2 25 | requests==2.32.4 26 | scipy==1.11.4 27 | sympy==1.14.0 28 | # Fallback to CUDA-less versions if not found. 29 | torch==2.7.1+cu128 30 | torch==2.7.1 31 | tqdm==4.67.1 32 | typing_extensions==4.14.0 33 | urllib3==2.5.0 34 | wcwidth==0.2.13 35 | -------------------------------------------------------------------------------- /audio2face-sdk/source/samples/sample-a2f-low-level-api-fullface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(sample-a2f-low-level-api-fullface) 2 | 3 | set_target_properties(sample-a2f-low-level-api-fullface PROPERTIES 4 | ARCHIVE_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 5 | LIBRARY_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 6 | RUNTIME_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/bin 7 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin;$" 8 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 9 | ) 10 | 11 | target_sources(sample-a2f-low-level-api-fullface PRIVATE 12 | main.cpp 13 | ) 14 | 15 | target_compile_definitions(sample-a2f-low-level-api-fullface PRIVATE 16 | TEST_DATA_DIR="${TEST_DATA_DIR}" 17 | ) 18 | 19 | target_link_libraries(sample-a2f-low-level-api-fullface PRIVATE 20 | audio2x 21 | AudioFile::AudioFile 22 | Cnpy::Cnpy 23 | ZLIB::ZLIB 24 | ) 25 | -------------------------------------------------------------------------------- /gen_testdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | BASE_DIR="$(dirname ${BASH_SOURCE})" 6 | 7 | # Set up PYTHONPATH 8 | export PYTHONPATH="$BASE_DIR/audio2x-common/scripts:$PYTHONPATH" 9 | 10 | if [ -z "$TENSORRT_ROOT_DIR" ]; then 11 | echo "TENSORRT_ROOT_DIR is not defined" 12 | exit 1 13 | fi 14 | 15 | export PATH="$TENSORRT_ROOT_DIR/bin:$PATH" 16 | export LD_LIBRARY_PATH="$TENSORRT_ROOT_DIR/lib:$LD_LIBRARY_PATH" 17 | 18 | echo "Generating test data..." 19 | python "$BASE_DIR/audio2x-common/scripts/gen_test_data.py" 20 | python "$BASE_DIR/audio2face-sdk/scripts/gen_test_data.py" 21 | python "$BASE_DIR/audio2emotion-sdk/scripts/gen_test_data.py" 22 | 23 | echo "Generating sample data..." 24 | python "$BASE_DIR/audio2face-sdk/scripts/gen_sample_data.py" 25 | python "$BASE_DIR/audio2emotion-sdk/scripts/gen_sample_data.py" 26 | 27 | echo "Generating benchmark data..." 28 | python "$BASE_DIR/audio2emotion-sdk/scripts/gen_benchmark_data.py" -------------------------------------------------------------------------------- /audio2emotion-sdk/source/benchmarks/test_benchmark.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set "COMMAND=%*" 4 | 5 | @REM At least one arg should be passed 6 | if "%1"=="" ( 7 | echo "Usage: test_benchmark.bat [args..]" 8 | exit /b 1 9 | ) 10 | 11 | REM Define the list of arguments 12 | set args[0]=--benchmark_filter=BM_InteractiveExecutorBatch/BatchSize:0/InferencesToSkip:0/Classifier:1/real_time 13 | set args[1]=--benchmark_filter=BM_InteractiveExecutorLayer/Layer:0/Classifier:1/real_time 14 | set args[2]=--benchmark_filter=BM_ExecutorPartial/ActiveTracks:1/iterations:10/real_time 15 | 16 | setlocal enabledelayedexpansion 17 | 18 | REM Iterate over the arguments and execute the benchmark command 19 | for /L %%i in (0,1,2) do ( 20 | set "current_arg=!args[%%i]!" 21 | echo "%%i" 22 | echo Running: %COMMAND% !current_arg! 23 | call %COMMAND% !current_arg! 24 | 25 | if !errorlevel! neq 0 ( 26 | exit /b !errorlevel! 27 | ) 28 | ) 29 | -------------------------------------------------------------------------------- /audio2face-sdk/source/samples/README.md: -------------------------------------------------------------------------------- 1 | # Audio2Face SDK Samples 2 | 3 | This directory contains sample applications demonstrating different aspects of the Audio2Face SDK. Each sample is designed to showcase specific features and usage patterns, from basic executor API usage to advanced low-level integration. 4 | 5 | ## Sample Overview 6 | 7 | 1. **`sample-a2f-executor`** - Simplest sample with executor API. Shows geometry executor creation with bundles, audio loading, and neutral emotion setup (no A2E needed). Supports both regression and diffusion models. Recommended starting point. 8 | 9 | 2. **`sample-a2f-a2e-executor`** - Audio2Face and Audio2Emotion integration with streaming capabilities. Shows combined processing, offline vs streaming modes. 10 | 11 | 3. **`sample-a2f-low-level-api-fullface`** - Advanced usage of low-level API for maximum control. Direct usage of core components with tensor manipulation, NPY data loading, and manual inference engine setup. 12 | 13 | -------------------------------------------------------------------------------- /fetch_deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Get the directory where this script is located 4 | BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 | 6 | BUILD_CONFIG=release 7 | # Check if a build configuration was provided as an argument 8 | if [ "$1" != "" ]; then 9 | BUILD_CONFIG="$1" 10 | fi 11 | 12 | if [ "$PYTHON" = "" ]; then 13 | PYTHON="python" 14 | fi 15 | 16 | if [ "$PACKMAN" = "" ]; then 17 | PACKMAN="${BASE_DIR}/tools/packman/packman" 18 | fi 19 | 20 | # Pull dependencies using packman 21 | "$PACKMAN" pull -t config="$BUILD_CONFIG" --platform linux-x86_64 "${BASE_DIR}/deps/build-deps.packman.xml" 22 | if [ $? -ne 0 ]; then 23 | echo "Failed to pull dependencies in build-deps.packman.xml" 24 | exit 1 25 | fi 26 | 27 | "$PACKMAN" pull -t config="$BUILD_CONFIG" --platform linux-x86_64 "${BASE_DIR}/deps/target-deps.packman.xml" 28 | if [ $? -ne 0 ]; then 29 | echo "Failed to pull dependencies in target-deps.packman.xml" 30 | exit 1 31 | fi -------------------------------------------------------------------------------- /audio2emotion-sdk/source/benchmarks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Single benchmark executable that includes all .cpp files 2 | add_executable(audio2emotion-benchmarks) 3 | 4 | set_target_properties(audio2emotion-benchmarks PROPERTIES 5 | ARCHIVE_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 6 | LIBRARY_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 7 | RUNTIME_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/bin 8 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin;$" 9 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 10 | ) 11 | 12 | target_sources(audio2emotion-benchmarks PRIVATE 13 | main.cpp 14 | utils.cpp 15 | executor.cpp 16 | interactive_executor.cpp 17 | ) 18 | 19 | target_compile_definitions(audio2emotion-benchmarks PRIVATE 20 | TEST_DATA_DIR="${TEST_DATA_DIR}" 21 | ) 22 | 23 | target_link_libraries(audio2emotion-benchmarks PRIVATE 24 | audio2x 25 | AudioFile::AudioFile 26 | Benchmark::Benchmark 27 | ) 28 | -------------------------------------------------------------------------------- /download_models.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Get the directory where this script is located 6 | BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 7 | 8 | mkdir -p "$BASE_DIR/_data" 9 | 10 | # Download A2F models 11 | A2F_MODEL_DIR="$BASE_DIR/_data/audio2face-models" 12 | mkdir -p "$A2F_MODEL_DIR" 13 | hf download nvidia/Audio2Face-3D-v3.0 --local-dir "$A2F_MODEL_DIR/audio2face-3d-v3.0" 14 | hf download nvidia/Audio2Face-3D-v2.3.1-Claire --local-dir "$A2F_MODEL_DIR/audio2face-3d-v2.3.1-claire" 15 | hf download nvidia/Audio2Face-3D-v2.3.1-James --local-dir "$A2F_MODEL_DIR/audio2face-3d-v2.3.1-james" 16 | hf download nvidia/Audio2Face-3D-v2.3-Mark --local-dir "$A2F_MODEL_DIR/audio2face-3d-v2.3-mark" 17 | 18 | # Download A2E models 19 | A2E_MODEL_DIR="$BASE_DIR/_data/audio2emotion-models" 20 | mkdir -p "$A2E_MODEL_DIR" 21 | hf download nvidia/Audio2Emotion-v2.2 --local-dir $A2E_MODEL_DIR/audio2emotion-v2.2 22 | 23 | echo Models are downloaded to "$A2F_MODEL_DIR" and "$A2E_MODEL_DIR" -------------------------------------------------------------------------------- /fetch_deps.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | @REM Reset the errorlevel. If invoked by CMake, it may be set to a non-zero value. 4 | @REM This can cause issues with packman commands that rely on errorlevel. 5 | set errorlevel=0 6 | 7 | set BASE_DIR=%~dp0 8 | 9 | set BUILD_CONFIG=release 10 | @REM Check if a build configuration was provided as an argument 11 | if not "%1"=="" ( 12 | set BUILD_CONFIG=%1 13 | ) 14 | if "%PYTHON%"=="" SET "PYTHON=tools\packman\python.bat" 15 | if "%PACKMAN%"=="" SET "PACKMAN=%BASE_DIR%tools\packman\packman" 16 | 17 | @REM Pull dependencies using packman 18 | call %PACKMAN% pull -t config=%BUILD_CONFIG% --platform windows-x86_64 %BASE_DIR%deps\build-deps.packman.xml 19 | if errorlevel 1 ( 20 | echo Failed to pull dependencies in build-deps.packman.xml 21 | exit /b 1 22 | ) 23 | call %PACKMAN% pull -t config=%BUILD_CONFIG% --platform windows-x86_64 %BASE_DIR%deps\target-deps.packman.xml 24 | if errorlevel 1 ( 25 | echo Failed to pull dependencies in target-deps.packman.xml 26 | exit /b 1 27 | ) 28 | -------------------------------------------------------------------------------- /audio2face-sdk/source/benchmarks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Single benchmark executable that includes all .cpp files 2 | add_executable(audio2face-benchmarks) 3 | 4 | set_target_properties(audio2face-benchmarks PROPERTIES 5 | ARCHIVE_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 6 | LIBRARY_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 7 | RUNTIME_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/bin 8 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin;$" 9 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 10 | ) 11 | 12 | target_sources(audio2face-benchmarks PRIVATE 13 | main.cpp 14 | blendshape_solver.cpp 15 | executor_blendshape.cpp 16 | executor_geometry.cpp 17 | interactive_executor.cpp 18 | utils.cpp 19 | ) 20 | 21 | target_compile_definitions(audio2face-benchmarks PRIVATE 22 | TEST_DATA_DIR="${TEST_DATA_DIR}" 23 | ) 24 | 25 | target_link_libraries(audio2face-benchmarks PRIVATE 26 | audio2x 27 | AudioFile::AudioFile 28 | Benchmark::Benchmark 29 | Cnpy::Cnpy 30 | ZLIB::ZLIB 31 | ) 32 | -------------------------------------------------------------------------------- /licenses/audiofile-LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Adam Stark 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/nlohmann_json-LICENSE.txt.1: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /licenses/cxxopts-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Jarryd Beck 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /audio2x-common/source/audio2x/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Define the static library target 2 | add_library(audio2x-common STATIC) 3 | 4 | set_target_properties(audio2x-common PROPERTIES 5 | ARCHIVE_OUTPUT_DIRECTORY ${A2X_COMMON_BINARY_DIR}/lib 6 | LIBRARY_OUTPUT_DIRECTORY ${A2X_COMMON_BINARY_DIR}/lib 7 | RUNTIME_OUTPUT_DIRECTORY ${A2X_COMMON_BINARY_DIR}/bin 8 | ) 9 | 10 | # Add all source files from source/audio2x 11 | file(GLOB_RECURSE AUDIO2X_SOURCES 12 | "*.cpp" 13 | "*.cu" 14 | ) 15 | 16 | target_sources(audio2x-common PRIVATE ${AUDIO2X_SOURCES}) 17 | 18 | # Include directories 19 | target_include_directories(audio2x-common 20 | PUBLIC 21 | $ 22 | PRIVATE 23 | ${CMAKE_CURRENT_SOURCE_DIR}/../../include/audio2x/internal 24 | ) 25 | 26 | # Add compile definitions 27 | target_compile_definitions(audio2x-common PRIVATE AUDIO2X_SDK_EXPORTS) 28 | 29 | target_link_libraries(audio2x-common 30 | PUBLIC 31 | Cnpy::Cnpy 32 | CUDA::cudart 33 | TensorRT::TensorRT 34 | ZLIB::ZLIB 35 | PRIVATE 36 | AudioFile::AudioFile 37 | ) 38 | -------------------------------------------------------------------------------- /audio2face-sdk/source/audio2face-core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Define the static library target 2 | add_library(audio2face-core STATIC) 3 | 4 | # Add all source files from source/audio2face-core 5 | file(GLOB_RECURSE AUDIO2FACE_CORE_SOURCES 6 | "*.cpp" 7 | "*.cu" 8 | ) 9 | 10 | target_sources(audio2face-core PRIVATE ${AUDIO2FACE_CORE_SOURCES}) 11 | 12 | # Include directories 13 | target_include_directories(audio2face-core 14 | PUBLIC 15 | $ 16 | PRIVATE 17 | ${CMAKE_CURRENT_SOURCE_DIR}/../../include/audio2face/internal 18 | ) 19 | 20 | # Add compile definitions 21 | target_compile_definitions(audio2face-core 22 | PRIVATE 23 | AUDIO2X_SDK_EXPORTS 24 | $<$:AUDIO2FACE_SDK_DLL_EXPORTS> 25 | ) 26 | 27 | # Link libraries 28 | target_link_libraries(audio2face-core 29 | PUBLIC 30 | CUDA::cublas 31 | CUDA::curand 32 | audio2x-common 33 | PRIVATE 34 | Eigen3::Eigen 35 | magic_enum::magic_enum 36 | nlohmann_json::nlohmann_json 37 | refl-cpp::refl-cpp 38 | tbtSVD::tbtSVD 39 | ) 40 | -------------------------------------------------------------------------------- /licenses/tbtsvd-LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 wi-re 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /licenses/cnpy-LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) Carl Rogers, 2011 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a 6 | copy of this software and associated documentation files (the "Software"), 7 | to deal in the Software without restriction, including without limitation 8 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | and/or sell copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/refl-cpp-LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Veselin Karaganev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /licenses/magic_enum-LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 - 2023 Daniil Goncharov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /licenses/nlohmann_json-LICENSE.MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-2022 Niels Lohmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tools/packman/python.bat: -------------------------------------------------------------------------------- 1 | :: Copyright 2019-2020 NVIDIA CORPORATION 2 | :: 3 | :: Licensed under the Apache License, Version 2.0 (the "License"); 4 | :: you may not use this file except in compliance with the License. 5 | :: You may obtain a copy of the License at 6 | :: 7 | :: http://www.apache.org/licenses/LICENSE-2.0 8 | :: 9 | :: Unless required by applicable law or agreed to in writing, software 10 | :: distributed under the License is distributed on an "AS IS" BASIS, 11 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | :: See the License for the specific language governing permissions and 13 | :: limitations under the License. 14 | 15 | @echo off 16 | setlocal enableextensions 17 | 18 | call "%~dp0\packman" init 19 | set "PYTHONPATH=%PM_MODULE_DIR%;%PYTHONPATH%" 20 | 21 | if not defined PYTHONNOUSERSITE ( 22 | set PYTHONNOUSERSITE=1 23 | ) 24 | 25 | REM For performance, default to unbuffered; however, allow overriding via 26 | REM PYTHONUNBUFFERED=0 since PYTHONUNBUFFERED on windows can truncate output 27 | REM when printing long strings 28 | if not defined PYTHONUNBUFFERED ( 29 | set PYTHONUNBUFFERED=1 30 | ) 31 | 32 | %PM_PYTHON% %* 33 | -------------------------------------------------------------------------------- /licenses/audio2x-sdk-LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a 6 | copy of this software and associated documentation files (the "Software"), 7 | to deal in the Software without restriction, including without limitation 8 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | and/or sell copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /audio2emotion-sdk/source/audio2emotion-core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Define the static library target 2 | add_library(audio2emotion-core STATIC) 3 | 4 | set_target_properties(audio2emotion-core PROPERTIES 5 | ARCHIVE_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 6 | LIBRARY_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 7 | RUNTIME_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/bin 8 | ) 9 | 10 | # Add all source files from source/audio2emotion-core 11 | file(GLOB_RECURSE AUDIO2EMOTION_CORE_SOURCES 12 | "*.cpp" 13 | "*.cu" 14 | ) 15 | 16 | target_sources(audio2emotion-core PRIVATE ${AUDIO2EMOTION_CORE_SOURCES}) 17 | 18 | # Include directories 19 | target_include_directories(audio2emotion-core 20 | PUBLIC 21 | $ 22 | PRIVATE 23 | ${CMAKE_CURRENT_SOURCE_DIR}/../../include/audio2emotion/internal 24 | ) 25 | 26 | # Add compile definitions 27 | target_compile_definitions(audio2emotion-core 28 | PRIVATE 29 | AUDIO2X_SDK_EXPORTS 30 | $<$:AUDIO2EMOTION_SDK_DLL_EXPORTS> 31 | ) 32 | 33 | # Link libraries 34 | target_link_libraries(audio2emotion-core 35 | PUBLIC 36 | audio2x-common 37 | PRIVATE 38 | nlohmann_json::nlohmann_json 39 | ) 40 | -------------------------------------------------------------------------------- /audio2x-common/scripts/audio2x/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /audio2x-common/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Define the test executable target 2 | add_executable(audio2x-common-unit-tests) 3 | 4 | set_target_properties(audio2x-common-unit-tests PROPERTIES 5 | ARCHIVE_OUTPUT_DIRECTORY ${A2X_COMMON_BINARY_DIR}/lib 6 | LIBRARY_OUTPUT_DIRECTORY ${A2X_COMMON_BINARY_DIR}/lib 7 | RUNTIME_OUTPUT_DIRECTORY ${A2X_COMMON_BINARY_DIR}/bin 8 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin" 9 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 10 | ) 11 | 12 | # Add all test source files 13 | file(GLOB_RECURSE TEST_SOURCES 14 | "*.cpp" 15 | ) 16 | 17 | target_sources(audio2x-common-unit-tests PRIVATE ${TEST_SOURCES}) 18 | 19 | # Set compile definitions 20 | target_compile_definitions(audio2x-common-unit-tests PRIVATE 21 | AUDIO2X_SDK_STATIC_DEFINE 22 | TEST_DATA_DIR="${TEST_DATA_DIR}" 23 | ) 24 | 25 | # Link with required libraries 26 | target_link_libraries(audio2x-common-unit-tests 27 | PRIVATE 28 | audio2x-common 29 | GTest::gtest 30 | GTest::gtest_main 31 | ) 32 | 33 | # Platform-specific linking 34 | if(UNIX AND NOT APPLE) 35 | target_link_libraries(audio2x-common-unit-tests PRIVATE pthread) 36 | endif() 37 | 38 | gtest_discover_tests(audio2x-common-unit-tests DISCOVERY_MODE PRE_TEST) 39 | -------------------------------------------------------------------------------- /audio2emotion-sdk/scripts/gen_test_data.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | from gen_test_data_scripts import gen_test_data_inference 22 | 23 | gen_test_data_inference.gen_data() 24 | -------------------------------------------------------------------------------- /audio2x-common/scripts/gen_test_data.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | from gen_test_data_scripts import gen_test_data_inference, gen_test_data_io 22 | 23 | gen_test_data_io.gen_data() 24 | gen_test_data_inference.gen_data() 25 | -------------------------------------------------------------------------------- /licenses/zlib-LICENSE.txt: -------------------------------------------------------------------------------- 1 | zlib.h -- interface of the 'zlib' general purpose compression library 2 | version 1.3.1, January 22nd, 2024 3 | 4 | Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. If you use this software 16 | in a product, an acknowledgment in the product documentation would be 17 | appreciated but is not required. 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 3. This notice may not be removed or altered from any source distribution. 21 | 22 | Jean-loup Gailly Mark Adler 23 | jloup@gzip.org madler@alumni.caltech.edu 24 | 25 | 26 | The data format used by the zlib library is described by RFCs (Request for 27 | Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 28 | (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). 29 | -------------------------------------------------------------------------------- /audio2face-sdk/scripts/gen_test_data.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | from gen_test_data_scripts import gen_test_data_audio, gen_test_data_interpolator 22 | 23 | gen_test_data_audio.gen_data() 24 | gen_test_data_interpolator.gen_data() 25 | -------------------------------------------------------------------------------- /audio2face-sdk/tests/utils.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | 25 | void FillRandom(std::vector &data, unsigned seed=0); 26 | 27 | 28 | constexpr int kDeviceID = 0; 29 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/cuda_fwd.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | // Forward declaration of cudaStream_t to avoid including the whole CUDA header runtime. 24 | typedef struct CUstream_st *cudaStream_t; 25 | -------------------------------------------------------------------------------- /audio2x-common/tests/utils.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | #include 25 | 26 | void FillRandom(std::vector& data); 27 | std::int64_t GetRandomInteger(std::int64_t limit); 28 | -------------------------------------------------------------------------------- /tools/packman/python.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2019-2020 NVIDIA CORPORATION 4 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | PACKMAN_CMD="$(dirname "${BASH_SOURCE}")/packman" 20 | if [ ! -f "$PACKMAN_CMD" ]; then 21 | PACKMAN_CMD="${PACKMAN_CMD}.sh" 22 | fi 23 | source "$PACKMAN_CMD" init 24 | export PYTHONPATH="${PM_MODULE_DIR}:${PYTHONPATH}" 25 | 26 | if [ -z "${PYTHONNOUSERSITE:-}" ]; then 27 | export PYTHONNOUSERSITE=1 28 | fi 29 | 30 | # For performance, default to unbuffered; however, allow overriding via 31 | # PYTHONUNBUFFERED=0 since PYTHONUNBUFFERED on windows can truncate output 32 | # when printing long strings 33 | if [ -z "${PYTHONUNBUFFERED:-}" ]; then 34 | export PYTHONUNBUFFERED=1 35 | fi 36 | 37 | # workaround for our python not shipping with certs 38 | if [[ -z ${SSL_CERT_DIR:-} ]]; then 39 | export SSL_CERT_DIR=/etc/ssl/certs/ 40 | fi 41 | 42 | "${PM_PYTHON}" "$@" 43 | -------------------------------------------------------------------------------- /audio2x-common/source/audio2x/interactive_executor.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "audio2x/interactive_executor.h" 22 | 23 | namespace nva2x { 24 | 25 | IInteractiveExecutor::~IInteractiveExecutor() = default; 26 | 27 | } // namespace nva2x 28 | -------------------------------------------------------------------------------- /licenses/nlohmann_json-LICENSE.txt.3: -------------------------------------------------------------------------------- 1 | Copyright (c) . 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /tools/packman/bootstrap/fetch_file_from_packman_bootstrap.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright 2019 NVIDIA CORPORATION 2 | :: 3 | :: Licensed under the Apache License, Version 2.0 (the "License"); 4 | :: you may not use this file except in compliance with the License. 5 | :: You may obtain a copy of the License at 6 | :: 7 | :: http://www.apache.org/licenses/LICENSE-2.0 8 | :: 9 | :: Unless required by applicable law or agreed to in writing, software 10 | :: distributed under the License is distributed on an "AS IS" BASIS, 11 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | :: See the License for the specific language governing permissions and 13 | :: limitations under the License. 14 | 15 | :: You need to specify as input to this command 16 | @setlocal 17 | @set PACKAGE_NAME=%1 18 | @set TARGET_PATH=%2 19 | 20 | @echo Fetching %PACKAGE_NAME% ... 21 | 22 | @powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0download_file_from_url.ps1" ^ 23 | -source "https://bootstrap.packman.nvidia.com/%PACKAGE_NAME%" -output %TARGET_PATH% 24 | :: A bug in powershell prevents the errorlevel code from being set when using the -File execution option 25 | :: We must therefore do our own failure analysis, basically make sure the file exists: 26 | @if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED 27 | 28 | @endlocal 29 | @exit /b 0 30 | 31 | :ERROR_DOWNLOAD_FAILED 32 | @echo Failed to download file from S3 33 | @echo Most likely because endpoint cannot be reached or file %PACKAGE_NAME% doesn't exist 34 | @endlocal 35 | @exit /b 1 -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/dll_export.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #ifdef _WIN32 24 | #ifdef AUDIO2FACE_SDK_DLL_EXPORTS 25 | #define AUDIO2FACE_DLL_API __declspec(dllexport) 26 | #else 27 | #define AUDIO2FACE_DLL_API __declspec(dllimport) 28 | #endif 29 | #else 30 | #define AUDIO2FACE_DLL_API 31 | #endif 32 | -------------------------------------------------------------------------------- /audio2emotion-sdk/include/audio2emotion/dll_export.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #ifdef _WIN32 24 | #ifdef AUDIO2EMOTION_SDK_DLL_EXPORTS 25 | #define AUDIO2EMOTION_DLL_API __declspec(dllexport) 26 | #else 27 | #define AUDIO2EMOTION_DLL_API __declspec(dllimport) 28 | #endif 29 | #else 30 | #define AUDIO2EMOTION_DLL_API 31 | #endif 32 | -------------------------------------------------------------------------------- /licenses/gtest-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /audio2emotion-sdk/tests/utils.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | 25 | // TODO: Investigate how to get consistent inference result and relax EPS to 1e-6 26 | const double EPS = 1e-3; 27 | const float EPSf = 1e-3f; 28 | 29 | void FillRandom(std::vector &data, unsigned seed=0); 30 | 31 | 32 | constexpr int kDeviceID = 0; 33 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/npz_utils.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | 22 | #pragma once 23 | 24 | #include "cnpy.h" 25 | 26 | #include 27 | #include 28 | 29 | namespace nva2x { 30 | 31 | cnpy::npz_t npz_load(std::string fname); 32 | std::vector parse_string_array_from_npy_array(const cnpy::NpyArray &str_npy_arr); 33 | 34 | } // namespace nva2x 35 | -------------------------------------------------------------------------------- /licenses/eigen-LICENSE.BSD: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Intel Corporation. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Intel Corporation nor the names of its contributors may 13 | be used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | -------------------------------------------------------------------------------- /audio2face-sdk/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Define the test executable target 2 | add_executable(audio2face-unit-tests) 3 | 4 | set_target_properties(audio2face-unit-tests PROPERTIES 5 | ARCHIVE_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 6 | LIBRARY_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/lib 7 | RUNTIME_OUTPUT_DIRECTORY ${A2F_BINARY_DIR}/bin 8 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin" 9 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 10 | ) 11 | 12 | # Add all test source files 13 | file(GLOB_RECURSE TEST_SOURCES 14 | "*.cpp" 15 | "*.cu" 16 | ) 17 | 18 | target_sources(audio2face-unit-tests PRIVATE ${TEST_SOURCES}) 19 | 20 | # Include directories 21 | target_include_directories(audio2face-unit-tests 22 | PRIVATE 23 | ${CMAKE_CURRENT_SOURCE_DIR}/../include 24 | ${CMAKE_CURRENT_SOURCE_DIR}/../../audio2x-common/include 25 | ) 26 | 27 | # Set compile definitions 28 | target_compile_definitions(audio2face-unit-tests PRIVATE 29 | AUDIO2X_SDK_EXPORTS 30 | AUDIO2FACE_SDK_DLL_EXPORTS 31 | TEST_DATA_DIR="${TEST_DATA_DIR}" 32 | ) 33 | 34 | # Link with required libraries 35 | target_link_libraries(audio2face-unit-tests 36 | PRIVATE 37 | audio2face-core 38 | audio2x-common 39 | Eigen3::Eigen 40 | refl-cpp::refl-cpp 41 | tbtSVD::tbtSVD 42 | GTest::gtest 43 | GTest::gtest_main 44 | ) 45 | 46 | # Platform-specific linking 47 | if(UNIX AND NOT APPLE) 48 | target_link_libraries(audio2face-unit-tests PRIVATE pthread) 49 | endif() 50 | 51 | gtest_discover_tests(audio2face-unit-tests DISCOVERY_MODE PRE_TEST) 52 | -------------------------------------------------------------------------------- /tools/packman/bootstrap/download_file_from_url.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Copyright 2019 NVIDIA CORPORATION 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | #> 16 | 17 | param( 18 | [Parameter(Mandatory=$true)][string]$source=$null, 19 | [string]$output="out.exe" 20 | ) 21 | $filename = $output 22 | 23 | $triesLeft = 4 24 | $delay = 2 25 | do 26 | { 27 | $triesLeft -= 1 28 | 29 | try 30 | { 31 | Write-Host "Downloading from bootstrap.packman.nvidia.com ..." 32 | $wc = New-Object net.webclient 33 | $wc.Downloadfile($source, $fileName) 34 | exit 0 35 | } 36 | catch 37 | { 38 | Write-Host "Error downloading $source!" 39 | Write-Host $_.Exception|format-list -force 40 | if ($triesLeft) 41 | { 42 | Write-Host "Retrying in $delay seconds ..." 43 | Start-Sleep -seconds $delay 44 | } 45 | $delay = $delay * $delay 46 | } 47 | } while ($triesLeft -gt 0) 48 | # We only get here if the retries have been exhausted, remove any left-overs: 49 | if (Test-Path $fileName) 50 | { 51 | Remove-Item $fileName 52 | } 53 | exit 1 -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/audio_accumulator_cuda.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/cuda_fwd.h" 24 | 25 | #include 26 | #include 27 | 28 | namespace nva2x::cuda { 29 | 30 | std::error_code MultiplyOnDevice( 31 | float* buffer, std::size_t size, float multiplier, cudaStream_t cudaStream 32 | ); 33 | 34 | } // namespace nva2x::cuda 35 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/tensor_cuda.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/cuda_fwd.h" 24 | 25 | #include 26 | #include 27 | 28 | namespace nva2x::cuda { 29 | 30 | template 31 | std::error_code FillOnDevice( 32 | Scalar* destination, std::size_t size, Scalar value, cudaStream_t cudaStream 33 | ); 34 | 35 | } // namespace nva2x::cuda 36 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/audio_utils.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | namespace nva2x { 28 | 29 | // Warning: This resampling function is for test use only. It generates a 16kHz audio buffer with suboptimal quality. 30 | std::optional> get_file_wav_content(const std::string& filename); 31 | 32 | } // namespace nva2x 33 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/animated_tensor_cuda.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/cuda_fwd.h" 24 | 25 | #include 26 | #include 27 | 28 | namespace nva2x::cuda { 29 | 30 | // destination = a * (1 - t) + b * t 31 | std::error_code Lerp( 32 | float* destination, const float* a, const float* b, float t, std::size_t size, cudaStream_t cudaStream 33 | ); 34 | 35 | } // namespace nva2x::cuda 36 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/cuda_utils.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/export.h" 24 | 25 | #include 26 | 27 | namespace nva2x { 28 | 29 | // Set the CUDA device if needed by first checking if the current device is the one requested 30 | // to minimize the overhead of setting the device when it's already set. 31 | AUDIO2X_SDK_EXPORT std::error_code SetCudaDeviceIfNeeded(int device); 32 | 33 | } // namespace nva2x 34 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/executor.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/internal/audio_accumulator.h" 24 | #include "audio2x/internal/emotion_accumulator.h" 25 | 26 | namespace nva2x { 27 | 28 | std::size_t GetNbAvailableExecutions( 29 | const WindowProgress& progress, 30 | const IAudioAccumulator& audioAccumulator, 31 | const IEmotionAccumulator* emotionAccumulator, 32 | std::size_t nbFramesPerWindow 33 | ); 34 | 35 | } // namespace nva2x 36 | -------------------------------------------------------------------------------- /audio2x-common/tests/utils.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "utils.h" 22 | 23 | #include 24 | #include 25 | 26 | void FillRandom(std::vector& data) { 27 | for (unsigned int t = 0; t < data.size(); ++t) { 28 | data[t] = 29 | static_cast(std::rand()) / static_cast(RAND_MAX) - 0.5f; 30 | } 31 | } 32 | 33 | std::int64_t GetRandomInteger(std::int64_t limit) { 34 | return (static_cast(rand()) * limit) / (static_cast(RAND_MAX) + 1); 35 | } 36 | -------------------------------------------------------------------------------- /audio2face-sdk/source/benchmarks/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | 22 | #include "utils.h" 23 | 24 | #include "audio2x/cuda_utils.h" 25 | 26 | #include 27 | 28 | int main(int argc, char** argv) { 29 | ::benchmark::Initialize(&argc, argv); 30 | 31 | // Set device id in the beginning once. 32 | if (nva2x::SetCudaDeviceIfNeeded(kDeviceID)) { 33 | return -1; 34 | } 35 | 36 | ::benchmark::RunSpecifiedBenchmarks(); 37 | ::benchmark::Shutdown(); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /audio2emotion-sdk/source/benchmarks/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | 22 | #include "audio2x/cuda_utils.h" 23 | 24 | #include 25 | 26 | int main(int argc, char** argv) { 27 | ::benchmark::Initialize(&argc, argv); 28 | 29 | // Set device id in the beginning once. 30 | static constexpr const int kDeviceID = 0; 31 | if (nva2x::SetCudaDeviceIfNeeded(kDeviceID)) { 32 | return -1; 33 | } 34 | 35 | ::benchmark::RunSpecifiedBenchmarks(); 36 | ::benchmark::Shutdown(); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /audio2face-sdk/source/benchmarks/test_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # At least one arg should be passed 5 | if [ -z "$1" ]; then 6 | echo "Usage: test_benchmark.sh [args...]" 7 | exit 1 8 | fi 9 | 10 | # Define the list of arguments 11 | args=( 12 | "--benchmark_filter=BM_RegressionBlendshapeSolveExecutorOffline/FP16:0/UseGPU:0/Identity:0/ExecutionOption:1/A2EPrecompute:0/A2ESkipInference:0/NbTracks:1/real_time" 13 | "--benchmark_filter=BM_RegressionBlendshapeSolveExecutorStreaming/FP16:0/UseGPU:0/Identity:1/ExecutionOption:1/A2ESkipInference:8/AudioChunkSize:100/NbTracks:8/real_time" 14 | "--benchmark_filter=BM_DiffusionBlendshapeSolveExecutorStreaming/FP16:0/UseGPU:1/Identity:2/ExecutionOption:1/A2ESkipInference:0/AudioChunkSize:100/NbTracks:8/real_time" 15 | "--benchmark_filter=BM_DiffusionGeometryExecutorOffline/FP16:0/Identity:0/ExecutionOption:3/A2EPrecompute:0/A2ESkipInference:8/NbTracks:8/real_time" 16 | "--benchmark_filter=BM_RegressionGeometryExecutorStreaming/FP16:0/Identity:0/ExecutionOption:7/A2ESkipInference:8/AudioChunkSize:1/NbTracks:1/real_time" 17 | "--benchmark_filter=BM_DiffusionGeometryExecutorStreaming/FP16:0/Identity:0/ExecutionOption:2/A2ESkipInference:4/AudioChunkSize:100/NbTracks:1/real_time" 18 | "--benchmark_filter=BM_InteractiveExecutorBatch/BatchSize:0/Regression:1/real_time" 19 | "--benchmark_filter=BM_GeometryInteractiveExecutorLayer/Layer:0/LookBack:0/Regression:1/real_time" 20 | "--benchmark_filter=BM_BlendshapeInteractiveExecutorLayer/Layer:0/UseGpuSolver:0/LookBack:0/Regression:1/real_time" 21 | ) 22 | 23 | # Iterate over the arguments and execute the benchmark command 24 | for current_arg in "${args[@]}"; do 25 | echo "Running: $@ $current_arg" 26 | bash "$@" "$current_arg" 27 | done -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/export.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #ifdef AUDIO2X_SDK_STATIC_DEFINE 24 | 25 | #define AUDIO2X_SDK_EXPORT 26 | #define AUDIO2X_SDK_EXTERN 27 | 28 | #else 29 | 30 | #ifdef _WIN32 31 | #ifdef AUDIO2X_SDK_EXPORTS 32 | #define AUDIO2X_SDK_EXPORT __declspec(dllexport) 33 | #define AUDIO2X_SDK_EXTERN 34 | #else 35 | #define AUDIO2X_SDK_EXPORT __declspec(dllimport) 36 | #define AUDIO2X_SDK_EXTERN extern 37 | #endif 38 | #else 39 | #define AUDIO2X_SDK_EXPORT 40 | #define AUDIO2X_SDK_EXTERN 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /audio2emotion-sdk/include/audio2emotion/internal/model.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/internal/inference_engine.h" 24 | 25 | namespace nva2e { 26 | 27 | namespace IClassifierModel { 28 | const nva2x::BufferBindingsDescription& GetBindingsDescription(); 29 | nva2x::BufferBindings* CreateBindings(); 30 | } // namespace IClassifierModel 31 | 32 | const nva2x::IBufferBindingsDescription& GetBindingsDescriptionForClassifierModel_INTERNAL(); 33 | 34 | nva2x::IBufferBindings* CreateBindingsForClassifierModel_INTERNAL(); 35 | 36 | } // namespace nva2e 37 | -------------------------------------------------------------------------------- /audio2emotion-sdk/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Define the test executable target 2 | add_executable(audio2emotion-unit-tests) 3 | 4 | set_target_properties(audio2emotion-unit-tests PROPERTIES 5 | ARCHIVE_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 6 | LIBRARY_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/lib 7 | RUNTIME_OUTPUT_DIRECTORY ${A2E_BINARY_DIR}/bin 8 | VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${TENSORRT_ROOT_DIR}/lib;${CUDA_PATH}/bin" 9 | VS_DEBUGGER_WORKING_DIRECTORY ${AUDIO2X_SDK_ROOT} 10 | ) 11 | 12 | # Add all test source files 13 | file(GLOB_RECURSE TEST_SOURCES 14 | "*.cpp" 15 | "*.cu" 16 | ) 17 | 18 | target_sources(audio2emotion-unit-tests PRIVATE ${TEST_SOURCES}) 19 | 20 | # Include directories 21 | target_include_directories(audio2emotion-unit-tests 22 | PRIVATE 23 | # Hardcoded includes based on premake5.lua - to be converted to Find modules later 24 | ${CMAKE_CURRENT_SOURCE_DIR}/../include 25 | ${CMAKE_CURRENT_SOURCE_DIR}/../../audio2x-common/include 26 | ) 27 | 28 | # Set compile definitions 29 | target_compile_definitions(audio2emotion-unit-tests PRIVATE 30 | AUDIO2X_SDK_EXPORTS 31 | $<$:AUDIO2EMOTION_SDK_DLL_EXPORTS> 32 | TEST_DATA_DIR="${TEST_DATA_DIR}" 33 | ) 34 | 35 | # Link with required libraries 36 | target_link_libraries(audio2emotion-unit-tests 37 | PRIVATE 38 | audio2emotion-core 39 | audio2x-common 40 | GTest::gtest 41 | GTest::gtest_main 42 | CUDA::cudart 43 | CUDA::cublas 44 | CUDA::curand 45 | CUDA::nvrtc 46 | TensorRT::TensorRT 47 | ZLIB::ZLIB 48 | ) 49 | 50 | # Platform-specific linking 51 | if(UNIX AND NOT APPLE) 52 | target_link_libraries(audio2emotion-unit-tests PRIVATE pthread) 53 | endif() 54 | 55 | gtest_discover_tests(audio2emotion-unit-tests DISCOVERY_MODE PRE_TEST) 56 | -------------------------------------------------------------------------------- /audio2emotion-sdk/tests/utils.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "utils.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | void FillRandom(std::vector &data, unsigned int seed) { 29 | if (seed == 0) { 30 | seed = static_cast(time(NULL)); 31 | } 32 | std::cout << "Current srand seed: " << seed << std::endl; 33 | std::srand(seed); // make random inputs reproducible 34 | for (unsigned int t = 0; t < data.size(); ++t) { 35 | data[t] = 36 | static_cast(std::rand()) / static_cast(RAND_MAX) - 0.5f; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /audio2face-sdk/tests/utils.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "utils.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | void FillRandom(std::vector &data, unsigned int seed) { 29 | if (seed == 0) { 30 | seed = static_cast(time(NULL)); 31 | } 32 | std::cout << "Current srand seed: " << seed << std::endl; 33 | std::srand(seed); // make random inputs reproducible 34 | for (unsigned int t = 0; t < data.size(); ++t) { 35 | data[t] = 36 | static_cast(std::rand()) / static_cast(RAND_MAX) - 0.5f; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /audio2x-common/source/audio2x/cuda_utils.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "audio2x/internal/audio2x.h" 22 | #include "audio2x/internal/logger.h" 23 | #include "audio2x/internal/macros.h" 24 | #include "audio2x/error.h" 25 | 26 | #include 27 | 28 | std::error_code nva2x::internal::SetCudaDeviceIfNeeded(int device) { 29 | int current_device; 30 | A2X_CUDA_CHECK_ERROR(cudaGetDevice(¤t_device), ErrorCode::eCudaDeviceGetError); 31 | if (current_device != device) { 32 | A2X_CUDA_CHECK_ERROR(cudaSetDevice(device), ErrorCode::eCudaDeviceSetError); 33 | } 34 | return ErrorCode::eSuccess; 35 | } 36 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/job_runner.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace nva2f { 27 | 28 | // Function type for job runner tasks. 29 | using JobRunnerTask = void(*)(void*); 30 | 31 | // Interface for job runners that execute tasks asynchronously. 32 | class IJobRunner { 33 | public: 34 | // Enqueue a task for asynchronous execution. 35 | virtual void Enqueue(JobRunnerTask task, void* taskData) = 0; 36 | // Delete this object. 37 | virtual void Destroy() = 0; 38 | 39 | protected: 40 | virtual ~IJobRunner(); 41 | }; 42 | 43 | } // namespace nva2f 44 | -------------------------------------------------------------------------------- /audio2emotion-sdk/tests/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include 22 | 23 | #include "audio2x/cuda_utils.h" 24 | 25 | int main(int argc, char *argv[]) { 26 | #if 0 27 | // To help with running in a debugger. 28 | std::this_thread::sleep_for(std::chrono::seconds(10)); 29 | testing::GTEST_FLAG(break_on_failure) = true; 30 | #endif 31 | 32 | // Set the device ID for all tests. 33 | constexpr int kDeviceID = 0; 34 | if (nva2x::SetCudaDeviceIfNeeded(kDeviceID)) { 35 | return -1; 36 | } 37 | 38 | srand((unsigned int)time(NULL)); 39 | ::testing::InitGoogleTest(&argc, argv); 40 | int ret = RUN_ALL_TESTS(); 41 | return ret; 42 | } 43 | -------------------------------------------------------------------------------- /audio2face-sdk/tests/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include 22 | 23 | #include "audio2x/cuda_utils.h" 24 | 25 | int main(int argc, char *argv[]) { 26 | #if 0 27 | // To help with running in a debugger. 28 | std::this_thread::sleep_for(std::chrono::seconds(10)); 29 | testing::GTEST_FLAG(break_on_failure) = true; 30 | #endif 31 | 32 | // Set the device ID for all tests. 33 | constexpr int kDeviceID = 0; 34 | if (nva2x::SetCudaDeviceIfNeeded(kDeviceID)) { 35 | return -1; 36 | } 37 | 38 | srand((unsigned int)time(NULL)); 39 | ::testing::InitGoogleTest(&argc, argv); 40 | int ret = RUN_ALL_TESTS(); 41 | return ret; 42 | } 43 | -------------------------------------------------------------------------------- /audio2x-common/tests/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include 22 | 23 | #include "audio2x/cuda_utils.h" 24 | 25 | int main(int argc, char *argv[]) { 26 | #if 0 27 | // To help with running in a debugger. 28 | std::this_thread::sleep_for(std::chrono::seconds(10)); 29 | testing::GTEST_FLAG(break_on_failure) = true; 30 | #endif 31 | 32 | // Set the device ID for all tests. 33 | constexpr int kDeviceID = 0; 34 | if (nva2x::SetCudaDeviceIfNeeded(kDeviceID)) { 35 | return -1; 36 | } 37 | 38 | srand((unsigned int)time(NULL)); 39 | ::testing::InitGoogleTest(&argc, argv); 40 | int ret = RUN_ALL_TESTS(); 41 | return ret; 42 | } 43 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/internal/eigen_utils.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/tensor.h" 24 | 25 | #include 26 | 27 | #include 28 | 29 | namespace nva2f { 30 | 31 | // Define helper to help with matrix mapping. 32 | inline nva2x::HostTensorFloatConstView ToConstView(Eigen::Ref mat) { 33 | assert(mat.size() >= 0); 34 | return {mat.data(), static_cast(mat.size())}; 35 | } 36 | 37 | inline nva2x::HostTensorFloatView ToView(Eigen::Ref mat) { 38 | assert(mat.size() >= 0); 39 | return {mat.data(), static_cast(mat.size())}; 40 | } 41 | 42 | } // namespace nva2f 43 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/internal/mask_extraction.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | 22 | #include 23 | 24 | #include 25 | 26 | // Ideally this function is part of BlendshapeSolver class, 27 | // as of now, blendshape_solver.h requires #include Eigen/Dense 28 | // but that results in a tsunami of warnings from nvcc 29 | 30 | // CopyIndices resides here to avoid the warnings 31 | // until the bvls core function are factored out of the blendsahpe_solver class 32 | // a way to mute those warnings is found 33 | 34 | namespace nva2f 35 | { 36 | std::error_code CopyIndices(float* dst, const float* src, const int* indices, int numIndices, cudaStream_t stream) ; 37 | } 38 | -------------------------------------------------------------------------------- /audio2emotion-sdk/scripts/gen_sample_data.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | import os 22 | import shutil 23 | from os.path import join as opj 24 | 25 | import audio2x.trt 26 | from common import ONNX_MODEL_FOLDER_PATH, SAMPLES_MODEL_ROOT 27 | 28 | 29 | def gen_data(): 30 | # Create the model folder with the real model data 31 | os.makedirs(SAMPLES_MODEL_ROOT, exist_ok=True) 32 | for filename in ["model_config.json", "network_info.json", "trt_info.json", "model.json"]: 33 | shutil.copy(opj(ONNX_MODEL_FOLDER_PATH, filename), opj(SAMPLES_MODEL_ROOT, filename)) 34 | audio2x.trt.convert_onnx_to_trt_from_folders(ONNX_MODEL_FOLDER_PATH, SAMPLES_MODEL_ROOT) 35 | 36 | 37 | if __name__ == "__main__": 38 | gen_data() 39 | -------------------------------------------------------------------------------- /audio2face-sdk/source/audio2face-core/error.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "audio2face/internal/error.h" 22 | 23 | #define MAGIC_ENUM_RANGE_MIN 0 24 | #define MAGIC_ENUM_RANGE_MAX static_cast(nva2f::ErrorCode::eEndOfEnum) 25 | #include 26 | 27 | namespace nva2f { 28 | 29 | std::error_code make_error_code(ErrorCode code) { 30 | return {static_cast(code), FieldError::instance()}; 31 | } 32 | 33 | ErrorCode get_error_code(std::error_code err) { 34 | return static_cast(err.value() & FieldError::kReservedMask); 35 | } 36 | 37 | std::string Error2String(ErrorCode e) { 38 | return std::string(magic_enum::enum_name(e)); 39 | } 40 | 41 | }//namespace nva2f 42 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/logger_trt.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | 24 | #if defined(_MSC_VER) 25 | #pragma warning(push) 26 | #pragma warning(disable : 4100 5204) 27 | #elif defined(__GNUC__) 28 | #pragma GCC diagnostic push 29 | #pragma GCC diagnostic ignored "-Wunused-parameter" 30 | #endif 31 | #include 32 | #if defined(_MSC_VER) 33 | #pragma warning(pop) 34 | #elif defined(__GNUC__) 35 | #pragma GCC diagnostic pop 36 | #endif 37 | 38 | namespace nva2x { 39 | 40 | class TRTLogger : public nvinfer1::ILogger { 41 | void log(nvinfer1::ILogger::Severity severity, 42 | const char *msg) noexcept override; 43 | }; 44 | 45 | extern TRTLogger trtLogger; 46 | 47 | } // namespace nva2x 48 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/cuda_stream.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/cuda_stream.h" 24 | 25 | namespace nva2x { 26 | 27 | class CudaStream : public ICudaStream { 28 | public: 29 | CudaStream(); 30 | CudaStream(CudaStream&&); 31 | ~CudaStream(); 32 | 33 | CudaStream(const CudaStream&) = delete; 34 | CudaStream& operator=(const CudaStream&) = delete; 35 | CudaStream& operator=(CudaStream&&) = delete; 36 | 37 | std::error_code Synchronize() const override; 38 | cudaStream_t Data() const override; 39 | void Destroy() override; 40 | 41 | std::error_code Init(); 42 | std::error_code Deallocate(); 43 | 44 | private: 45 | cudaStream_t _cudaStream; 46 | }; 47 | 48 | } // namespace nva2x 49 | -------------------------------------------------------------------------------- /audio2x-common/tests/test_npz_util.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "audio2x/internal/npz_utils.h" 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | TEST(NpzUtils, ParseStringArray) { 29 | cnpy::npz_t npzInputData; 30 | try { 31 | npzInputData = nva2x::npz_load(TEST_DATA_DIR "_data/generated/audio2x-common/tests/data/test_string_arr.npz"); 32 | } catch(const std::exception& e [[maybe_unused]]) { 33 | 34 | } 35 | ASSERT_TRUE(npzInputData.count("names")); 36 | cnpy::NpyArray namesNpyArr = npzInputData["names"]; 37 | std::vector names = nva2x::parse_string_array_from_npy_array(namesNpyArr); 38 | EXPECT_EQ(names[0], "apple"); 39 | EXPECT_EQ(names[1], "banana"); 40 | } 41 | -------------------------------------------------------------------------------- /licenses/TensorRT-Readme.txt: -------------------------------------------------------------------------------- 1 | === NVIDIA TensorRT === 2 | 3 | NVIDIA® TensorRT™ is a C++ library that facilitates high-performance inference 4 | on NVIDIA GPUs. TensorRT takes a trained network, which consists of a network 5 | definition and a set of trained parameters, and produces a highly optimized 6 | runtime engine that performs inference for that network. TensorRT provides APIs 7 | using C++ and Python that help to express deep learning models using the Network 8 | Definition API or load a pre-defined model using the parsers that allow TensorRT 9 | to optimize and run them on an NVIDIA GPU. TensorRT applies graph optimizations, 10 | layer fusion, among other optimizations, while also finding the fastest 11 | implementation of that model leveraging a diverse collection of highly optimized 12 | kernels. TensorRT also supplies a runtime that you can use to execute this 13 | network on NVIDIA’s GPUs. 14 | 15 | For more information about TensorRT, visit https://developer.nvidia.com/tensorrt. 16 | 17 | In previous TensorRT releases, PDF documentation was included inside the TensorRT 18 | package. The PDF documentation has been removed from the package in favor of 19 | online documentation, which is updated regularly. Online documentation can be 20 | found at https://docs.nvidia.com/deeplearning/tensorrt. 21 | 22 | For details on TensorRT's license agreement, visit https://docs.nvidia.com/deeplearning/tensorrt/sla/. 23 | 24 | === References === 25 | 26 | Quick Start Guide: https://docs.nvidia.com/deeplearning/tensorrt/quick-start-guide 27 | Release Notes: https://docs.nvidia.com/deeplearning/tensorrt/release-notes 28 | Support Matrix: https://docs.nvidia.com/deeplearning/tensorrt/support-matrix 29 | Installation Guide: https://docs.nvidia.com/deeplearning/tensorrt/install-guide 30 | 31 | API Reference: https://docs.nvidia.com/deeplearning/tensorrt/api 32 | Developer Guide: https://docs.nvidia.com/deeplearning/tensorrt/developer-guide 33 | Sample Support Guide: https://docs.nvidia.com/deeplearning/tensorrt/sample-support-guide 34 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/internal/admm.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | 25 | #include 26 | 27 | #include 28 | 29 | namespace nva2f { 30 | 31 | std::error_code admm_init( 32 | float *z, float *u, float *Atb, 33 | float *b_vec, 34 | float *amat, float *amat_inv, 35 | float *lower, float *upper, 36 | int batch_size, int num_poses, cublasHandle_t cublas_handle, cudaStream_t cuda_stream); 37 | 38 | std::error_code admm_update( 39 | float *z, float *u, 40 | float *z_out, float *u_out, 41 | float *admmWeights, float *ATb, float *admmMatInvDevice, 42 | float *lower, float *upper, 43 | int batch_size, int num_poses, cudaStream_t cuda_stream); 44 | 45 | } // namespace nva2f 46 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/tensor_dict.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/tensor_dict.h" 24 | #include "audio2x/internal/tensor.h" 25 | 26 | #include 27 | #include 28 | 29 | namespace nva2x { 30 | 31 | class HostTensorDict : public IHostTensorDict { 32 | public: 33 | HostTensorDict(); 34 | ~HostTensorDict(); 35 | 36 | std::error_code ReadFromBuffer(const void *data, size_t size) override; 37 | std::error_code ReadFromFile(const char *filePath) override; 38 | const HostTensorFloat* At(const char *tensorName) const override; 39 | size_t Size() const override; 40 | void Destroy() override; 41 | 42 | private: 43 | std::unordered_map _tensors; 44 | }; 45 | 46 | } // namespace nva2x 47 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/nvtx_trace.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | namespace nva2x { 24 | 25 | class NvtxTraceScope { 26 | public: 27 | NvtxTraceScope(const char* name); 28 | ~NvtxTraceScope(); 29 | 30 | NvtxTraceScope(const NvtxTraceScope&) = delete; 31 | NvtxTraceScope(NvtxTraceScope&&) = delete; 32 | NvtxTraceScope& operator=(const NvtxTraceScope&) = delete; 33 | NvtxTraceScope& operator=(NvtxTraceScope&&) = delete; 34 | }; 35 | 36 | } // namespace nva2x 37 | 38 | #ifdef USE_NVTX 39 | #define A2X_CONCAT_(x, y) x##y 40 | #define A2X_CONCAT(x, y) A2X_CONCAT_(x, y) 41 | #define A2X_UNIQUE_NAME A2X_CONCAT(var, __COUNTER__) 42 | #define NVTX_TRACE(name) ::nva2x::NvtxTraceScope A2X_UNIQUE_NAME(name) 43 | #else 44 | #define NVTX_TRACE(name) 45 | #endif 46 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/unique_ptr.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | 25 | namespace nva2x { 26 | 27 | namespace internal { 28 | 29 | struct Destroyer { 30 | template 31 | void operator()(T* obj) const { 32 | obj->Destroy(); 33 | } 34 | }; 35 | 36 | } // namespace internal 37 | 38 | template 39 | using UniquePtr = std::unique_ptr; 40 | 41 | template 42 | UniquePtr ToUniquePtr(T* ptr) { return UniquePtr(ptr); } 43 | 44 | template 45 | using SharedPtr = std::shared_ptr; 46 | 47 | template 48 | std::shared_ptr ToSharedPtr(T* ptr) { 49 | return std::shared_ptr(ptr, [](T* p) { p->Destroy(); }); 50 | } 51 | 52 | } // namespace nva2x 53 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/internal/cublas_handle.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | 25 | #include 26 | 27 | namespace nva2f { 28 | 29 | // This class is a simpler wrapper around cublasHandle_t. 30 | class CublasHandle { 31 | public: 32 | CublasHandle(); 33 | CublasHandle(CublasHandle&&); 34 | ~CublasHandle(); 35 | CublasHandle& operator=(CublasHandle&&); 36 | 37 | CublasHandle(const CublasHandle&) = delete; 38 | CublasHandle& operator=(const CublasHandle&) = delete; 39 | 40 | std::error_code Init(); 41 | std::error_code Deallocate(); 42 | 43 | std::error_code SetCudaStream(cudaStream_t cudaStream); 44 | 45 | cublasHandle_t Data() const; 46 | 47 | private: 48 | cublasHandle_t _cublasHandle{nullptr}; 49 | }; 50 | 51 | } // namespace nva2f 52 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/io.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/io.h" 24 | 25 | #include 26 | 27 | namespace nva2x { 28 | 29 | class DataBytes : public IDataBytes { 30 | public: 31 | DataBytes(); 32 | ~DataBytes(); 33 | 34 | std::error_code ReadFromFile(const char* filePath) override; 35 | const void* Data() const override; 36 | std::size_t Size() const override; 37 | void Destroy() override; 38 | 39 | private: 40 | std::vector _data; 41 | }; 42 | 43 | class DataReader { 44 | public: 45 | DataReader(const void* data, std::size_t dataSize); 46 | ~DataReader(); 47 | std::error_code Read(void* dst, std::size_t size); 48 | void Reset(); 49 | 50 | private: 51 | const void* _data; 52 | std::size_t _dataSize; 53 | std::size_t _dataPos; 54 | }; 55 | 56 | } // namespace nva2x 57 | -------------------------------------------------------------------------------- /audio2x-common/source/audio2x/logger_trt.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "audio2x/internal/logger_trt.h" 22 | 23 | #include "audio2x/internal/logger.h" 24 | 25 | namespace nva2x { 26 | 27 | void TRTLogger::log(nvinfer1::ILogger::Severity severity, 28 | const char *msg) noexcept { 29 | switch (severity) { 30 | case nvinfer1::ILogger::Severity::kINTERNAL_ERROR: 31 | case nvinfer1::ILogger::Severity::kERROR: 32 | A2X_BASE_LOG_ERROR("TensorRT", msg); 33 | break; 34 | case nvinfer1::ILogger::Severity::kWARNING: 35 | case nvinfer1::ILogger::Severity::kINFO: 36 | A2X_BASE_LOG_INFO("TensorRT", msg); 37 | break; 38 | case nvinfer1::ILogger::Severity::kVERBOSE: 39 | A2X_BASE_LOG_DEBUG("TensorRT", msg); 40 | break; 41 | default: 42 | break; 43 | } 44 | } 45 | 46 | TRTLogger trtLogger; 47 | 48 | } // namespace nva2x 49 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/tensor_pool.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/internal/tensor.h" 24 | #include "audio2x/internal/tensor_pool.h" 25 | 26 | #include 27 | #include 28 | 29 | namespace nva2x { 30 | 31 | 32 | // This class is not thread-safe. Any synchronization must be done externally. 33 | class DeviceTensorPool { 34 | public: 35 | std::error_code Allocate(std::size_t tensorSize, std::size_t tensorCount); 36 | std::error_code Deallocate(); 37 | 38 | std::unique_ptr Obtain(); 39 | std::error_code Return(std::unique_ptr tensor); 40 | 41 | inline std::size_t TensorSize() const {return _tensorSize; } 42 | 43 | private: 44 | std::size_t _tensorSize{0}; 45 | std::vector> _pool; 46 | }; 47 | 48 | 49 | } // namespace nva2x 50 | -------------------------------------------------------------------------------- /audio2face-sdk/scripts/common.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | import os 22 | 23 | from audio2x.common import CUR_OS, ROOT_DIR, normalize_path 24 | 25 | AUDIO_INPUT_TENSOR_NAME = "input" 26 | EMOTION_INPUT_TENSOR_NAME = "emotion" 27 | 28 | SAMPLE_NETWORKS_PATH = normalize_path(ROOT_DIR, "_data/audio2face-models/") 29 | AUDIO_TRACKS_DATA_ROOT = normalize_path(ROOT_DIR, "sample-data") 30 | SAMPLES_DATA_ROOT = normalize_path(ROOT_DIR, "_data/generated/audio2face-sdk/samples/data/") 31 | GOLDEN_DATA_ROOT = normalize_path(ROOT_DIR, "_data/audio2face-golden-data/") 32 | AUDIO2FACE_SDK_NETS_SAMPLES_DATA_ROOT = normalize_path( 33 | ROOT_DIR, "_data/generated/audio2face-sdk/samples/data/audio2face-sdk-nets/" 34 | ) 35 | TESTS_DATA_ROOT = normalize_path(ROOT_DIR, "_data/generated/audio2face-sdk/tests/data/") 36 | 37 | os.makedirs(SAMPLES_DATA_ROOT, exist_ok=True) 38 | os.makedirs(TESTS_DATA_ROOT, exist_ok=True) 39 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/tensor.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/tensor_float.h" 24 | #include "audio2x/tensor_int64.h" 25 | #include "audio2x/tensor_uint64.h" 26 | #include "audio2x/tensor_bool.h" 27 | #include "audio2x/tensor_void.h" 28 | 29 | namespace nva2x { 30 | 31 | // Information describing how multiple slices are batched together in a tensor. 32 | struct TensorBatchInfo { 33 | // Offset from the start of the tensor to the first slice. 34 | std::size_t offset{0}; 35 | // Size of a batch slice. 36 | std::size_t size{0}; 37 | // Stride between consecutive slices. 38 | std::size_t stride{0}; 39 | }; 40 | 41 | // Validates that the given tensor batch info is compatible with the provided tensor. 42 | std::error_code ValidateTensorBatchInfo(DeviceTensorFloatConstView tensor, const TensorBatchInfo& info); 43 | 44 | } // namespace nva2x 45 | -------------------------------------------------------------------------------- /audio2face-sdk/scripts/gen_test_data_scripts/gen_test_data_interpolator.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | import os 22 | 23 | import data_utils 24 | import numpy as np 25 | from common import TESTS_DATA_ROOT 26 | from util.interpolator import Interpolator 27 | 28 | 29 | def gen_data(): 30 | RAW_LEN = 300 31 | smoothing = 0.2 32 | interp = Interpolator(smoothing=smoothing) 33 | dt_arr = np.array([0.0, 0.1, 0.3, 0.2, 0.65], dtype=np.float32) 34 | raw_arr = np.random.randn(len(dt_arr), RAW_LEN).astype(np.float32) 35 | 36 | for i in range(len(dt_arr)): 37 | smoothed = interp.update(raw_arr[i], dt_arr[i]) 38 | 39 | data = {"raw_arr": raw_arr, "dt_arr": dt_arr, "smoothed": smoothed} 40 | 41 | os.makedirs(TESTS_DATA_ROOT, exist_ok=True) 42 | data_utils.export_to_bin(data, os.path.join(TESTS_DATA_ROOT, "test_data_interpolator.bin")) 43 | 44 | 45 | if __name__ == "__main__": 46 | gen_data() 47 | -------------------------------------------------------------------------------- /audio2face-sdk/tests/test_core_error.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "audio2face/error.h" 22 | #include 23 | 24 | TEST(TestCoreError, Code) { 25 | // These are generic codes, they typically work. 26 | { 27 | const std::error_code errorCode = nva2f::ErrorCode::eCudaEventCreateError; 28 | const std::string errorMessage = errorCode.message(); 29 | ASSERT_EQ(errorMessage, "eCudaEventCreateError"); 30 | } 31 | 32 | // These are specific for fields, they used to crash. 33 | { 34 | const std::error_code errorCode = nva2f::ErrorCode::eNotANumber; 35 | const std::string errorMessage = errorCode.message(); 36 | ASSERT_EQ(errorMessage, "eNotANumber"); 37 | } 38 | { 39 | const std::error_code errorCode = nva2f::ErrorCode::eOutOfRange; 40 | const std::string errorMessage = errorCode.message(); 41 | ASSERT_EQ(errorMessage, "eOutOfRange"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/cuda_stream.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/export.h" 24 | #include "audio2x/cuda_fwd.h" 25 | 26 | #include 27 | 28 | namespace nva2x { 29 | 30 | // This class creates, manages, and synchronizes CUDA streams. 31 | class ICudaStream { 32 | public: 33 | // Synchronize the CUDA stream. 34 | virtual std::error_code Synchronize() const = 0; 35 | 36 | // Get the underlying CUDA stream handle 37 | virtual cudaStream_t Data() const = 0; 38 | 39 | // Delete this object. 40 | virtual void Destroy() = 0; 41 | 42 | protected: 43 | virtual ~ICudaStream(); 44 | }; 45 | 46 | // Create a new CUDA stream instance 47 | AUDIO2X_SDK_EXPORT ICudaStream* CreateCudaStream(); 48 | 49 | // Create a CUDA stream instance using the default CUDA stream 50 | AUDIO2X_SDK_EXPORT ICudaStream* CreateDefaultCudaStream(); 51 | 52 | } // namespace nva2x 53 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/io.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/export.h" 24 | 25 | #include 26 | #include 27 | 28 | namespace nva2x { 29 | 30 | // This class loads and accesses file contents as raw bytes. 31 | class IDataBytes { 32 | public: 33 | // Read binary data from the specified file path. 34 | virtual std::error_code ReadFromFile(const char* filePath) = 0; 35 | 36 | // Return a pointer to the loaded binary file content. 37 | virtual const void* Data() const = 0; 38 | 39 | // Return the size of the loaded binary file content in bytes. 40 | virtual std::size_t Size() const = 0; 41 | 42 | // Delete this object. 43 | virtual void Destroy() = 0; 44 | 45 | protected: 46 | virtual ~IDataBytes(); 47 | }; 48 | 49 | // Create a new data bytes instance. 50 | AUDIO2X_SDK_EXPORT IDataBytes* CreateDataBytes(); 51 | 52 | } // namespace nva2x 53 | -------------------------------------------------------------------------------- /cmake/Modules/FindAudioFile.cmake: -------------------------------------------------------------------------------- 1 | # FindAudioFile.cmake 2 | # Find the AudioFile header-only library 3 | # 4 | # This module creates the following imported target: 5 | # AudioFile::AudioFile - The AudioFile header-only library target 6 | # 7 | # Usage: 8 | # find_package(AudioFile REQUIRED) 9 | # target_link_libraries(your_target PRIVATE AudioFile::AudioFile) 10 | # 11 | # You can specify the AudioFile installation directory by setting: 12 | # AUDIOFILE_ROOT - Environment variable or CMake variable 13 | # 14 | # If not specified, the module will search in standard locations and 15 | # the project's typical dependency location. 16 | 17 | # Allow overriding the search path via environment variable or CMake variable 18 | set(_audiofile_search_paths) 19 | 20 | # Priority 1: CMake variable AUDIOFILE_ROOT 21 | if(AUDIOFILE_ROOT) 22 | list(APPEND _audiofile_search_paths ${AUDIOFILE_ROOT}) 23 | endif() 24 | 25 | # Priority 2: Environment variable AUDIOFILE_ROOT 26 | if(DEFINED ENV{AUDIOFILE_ROOT}) 27 | list(APPEND _audiofile_search_paths $ENV{AUDIOFILE_ROOT}) 28 | endif() 29 | 30 | # Priority 3: Standard system locations 31 | list(APPEND _audiofile_search_paths 32 | /usr/local 33 | /usr 34 | /opt/local 35 | /opt 36 | ) 37 | 38 | # Find the header file 39 | find_path(AUDIOFILE_INCLUDE_DIR 40 | NAMES AudioFile.h 41 | PATHS ${_audiofile_search_paths} 42 | PATH_SUFFIXES include include/audiofile 43 | DOC "AudioFile include directory" 44 | ) 45 | 46 | # Handle standard arguments 47 | include(FindPackageHandleStandardArgs) 48 | find_package_handle_standard_args(AudioFile 49 | FOUND_VAR AUDIOFILE_FOUND 50 | REQUIRED_VARS AUDIOFILE_INCLUDE_DIR 51 | ) 52 | 53 | # Create imported target for modern CMake 54 | if(AUDIOFILE_FOUND) 55 | if(NOT TARGET AudioFile::AudioFile) 56 | add_library(AudioFile::AudioFile INTERFACE IMPORTED) 57 | set_target_properties(AudioFile::AudioFile PROPERTIES 58 | INTERFACE_INCLUDE_DIRECTORIES "${AUDIOFILE_INCLUDE_DIR}" 59 | ) 60 | endif() 61 | endif() 62 | 63 | # Clean up temporary variables 64 | unset(_audiofile_search_paths) 65 | unset(AUDIOFILE_INCLUDE_DIR) -------------------------------------------------------------------------------- /audio2emotion-sdk/include/audio2emotion/internal/executor_postprocess_core.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2emotion/executor_postprocess.h" 24 | #include "audio2emotion/internal/executor_core.h" 25 | 26 | namespace nva2e { 27 | 28 | namespace IPostProcessModel { 29 | 30 | class EmotionExecutorCore : public EmotionExecutorCoreBase { 31 | public: 32 | std::error_code Init( 33 | std::size_t nbTracks, cudaStream_t cudaStream, 34 | const nva2e::IPostProcessModel::EmotionExecutorCreationParameters& postProcessParams 35 | ); 36 | 37 | static std::error_code GetProgressParameters( 38 | nva2x::WindowProgressParameters& outProgressParams, 39 | std::size_t samplingRate, 40 | std::size_t frameRateNumerator, 41 | std::size_t frameRateDenominator 42 | ); 43 | }; 44 | 45 | } // namespace IPostProcessModel 46 | 47 | } // namespace nva2e 48 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/internal/logger.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | 25 | #define AUDIO2FACE_LOG_LEVEL_ERROR 1 26 | #define AUDIO2FACE_LOG_LEVEL_INFO 2 27 | #define AUDIO2FACE_LOG_LEVEL_DEBUG 3 28 | 29 | #ifndef AUDIO2FACE_LOG_LEVEL 30 | #define AUDIO2FACE_LOG_LEVEL AUDIO2FACE_LOG_LEVEL_DEBUG 31 | #endif 32 | 33 | #if AUDIO2FACE_LOG_LEVEL >= AUDIO2FACE_LOG_LEVEL_ERROR 34 | #define LOG_ERROR(x) (std::cerr << "[A2F SDK] [ERROR] " << x << std::endl) 35 | #else 36 | #define LOG_ERROR(x) 37 | #endif 38 | 39 | #if AUDIO2FACE_LOG_LEVEL >= AUDIO2FACE_LOG_LEVEL_INFO 40 | #define LOG_INFO(x) (std::cout << "[A2F SDK] [INFO] " << x << std::endl) 41 | #else 42 | #define LOG_INFO(x) 43 | #endif 44 | 45 | #if AUDIO2FACE_LOG_LEVEL >= AUDIO2FACE_LOG_LEVEL_DEBUG 46 | #define LOG_DEBUG(x) (std::cout << "[A2F SDK] [DEBUG] " << x << std::endl) 47 | #else 48 | #define LOG_DEBUG(x) 49 | #endif 50 | -------------------------------------------------------------------------------- /audio2emotion-sdk/include/audio2emotion/model.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | 25 | namespace nva2e { 26 | 27 | namespace IClassifierModel { 28 | 29 | // Contains network information details for the emotion classifier model. 30 | struct NetworkInfo { 31 | // Length of the audio buffer in samples. 32 | std::size_t bufferLength{0}; 33 | // Sample rate of the audio buffer in Hz. 34 | std::size_t bufferSamplerate{0}; 35 | // Length of the inference emotion output vector. 36 | std::size_t emotionLength{0}; 37 | }; 38 | 39 | // Indices of the buffers in bindings for this model. 40 | 41 | // Index of the input audio tensor in the model bindings. 42 | constexpr std::size_t kInputTensorIndex = 0; 43 | // Index of the output emotion tensor in the model bindings. 44 | constexpr std::size_t kResultTensorIndex = 1; 45 | } 46 | 47 | } // namespace nva2e 48 | -------------------------------------------------------------------------------- /audio2face-sdk/scripts/util/interpolator.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | import copy 22 | 23 | import numpy as np 24 | 25 | 26 | class Interpolator: 27 | def __init__(self, smoothing=0.8, degree=2): 28 | self.smoothing = smoothing 29 | self.degree = degree 30 | self.values = [] 31 | 32 | def get(self): 33 | return self.values[-1] if len(self.values) != 0 else np.zeros(()) 34 | 35 | def update(self, input, time_delta): 36 | v = self.values 37 | if len(v) != 0 and v[0].shape != input.shape: 38 | del v[:] 39 | 40 | if len(v) == 0: 41 | v.append(copy.deepcopy(input)) 42 | v[0][:] = input 43 | while len(v) < self.degree + 1: 44 | v.append(copy.deepcopy(v[-1])) 45 | 46 | alpha = 1.0 - 0.5 ** (time_delta / self.smoothing) if self.smoothing > 0 else 1.0 47 | for i in range(1, len(v)): 48 | v[i] += (v[i - 1] - v[i]) * alpha 49 | return self.get() 50 | -------------------------------------------------------------------------------- /cmake/Modules/FindTbtSVD.cmake: -------------------------------------------------------------------------------- 1 | # FindTbtSVD.cmake 2 | # Find the tbtSVD header-only library 3 | # 4 | # This module creates the following imported target: 5 | # tbtSVD::tbtSVD - The tbtSVD header-only library target 6 | # 7 | # Usage: 8 | # find_package(TbtSVD REQUIRED) 9 | # target_link_libraries(your_target PRIVATE tbtSVD::tbtSVD) 10 | # 11 | # You can specify the tbtSVD installation directory by setting: 12 | # TBT_SVD_ROOT - Environment variable or CMake variable 13 | # 14 | # If not specified, the module will search in standard locations and 15 | # the project's typical dependency location. 16 | 17 | # Allow overriding the search path via environment variable or CMake variable 18 | set(_tbt_svd_search_paths) 19 | 20 | # Priority 1: CMake variable TBT_SVD_ROOT 21 | if(TBT_SVD_ROOT) 22 | list(APPEND _tbt_svd_search_paths ${TBT_SVD_ROOT}) 23 | endif() 24 | 25 | # Priority 2: Environment variable TBT_SVD_ROOT 26 | if(DEFINED ENV{TBT_SVD_ROOT}) 27 | list(APPEND _tbt_svd_search_paths $ENV{TBT_SVD_ROOT}) 28 | endif() 29 | 30 | # Priority 3: Project's dependency location 31 | list(APPEND _tbt_svd_search_paths 32 | ${CMAKE_SOURCE_DIR}/_build/target-deps/tbtsvd 33 | ) 34 | 35 | # Priority 4: Standard system locations 36 | list(APPEND _tbt_svd_search_paths 37 | /usr/local 38 | /usr 39 | /opt/local 40 | /opt 41 | ) 42 | 43 | # Find the header file 44 | find_path(TBT_SVD_INCLUDE_DIR 45 | NAMES tbtSVD/SVD.h 46 | PATHS ${_tbt_svd_search_paths} 47 | PATH_SUFFIXES include 48 | DOC "tbtSVD include directory" 49 | ) 50 | 51 | # Handle standard arguments 52 | include(FindPackageHandleStandardArgs) 53 | find_package_handle_standard_args(TbtSVD 54 | FOUND_VAR TBTSVD_FOUND 55 | REQUIRED_VARS TBT_SVD_INCLUDE_DIR 56 | ) 57 | 58 | # Create imported target for modern CMake 59 | if(TBTSVD_FOUND) 60 | if(NOT TARGET tbtSVD::tbtSVD) 61 | add_library(tbtSVD::tbtSVD INTERFACE IMPORTED) 62 | set_target_properties(tbtSVD::tbtSVD PROPERTIES 63 | INTERFACE_INCLUDE_DIRECTORIES "${TBT_SVD_INCLUDE_DIR}" 64 | ) 65 | endif() 66 | endif() 67 | 68 | # Clean up temporary variables 69 | unset(_tbt_svd_search_paths) 70 | mark_as_advanced(TBT_SVD_INCLUDE_DIR) -------------------------------------------------------------------------------- /audio2emotion-sdk/include/audio2emotion/internal/logger.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | 25 | #define AUDIO2EMOTION_LOG_LEVEL_ERROR 1 26 | #define AUDIO2EMOTION_LOG_LEVEL_INFO 2 27 | #define AUDIO2EMOTION_LOG_LEVEL_DEBUG 3 28 | 29 | #ifndef AUDIO2EMOTION_LOG_LEVEL 30 | # define AUDIO2EMOTION_LOG_LEVEL AUDIO2EMOTION_LOG_LEVEL_DEBUG 31 | #endif 32 | 33 | #if AUDIO2EMOTION_LOG_LEVEL >= AUDIO2EMOTION_LOG_LEVEL_ERROR 34 | # define LOG_ERROR(x) (std::cout << "[A2E SDK] [ERROR] " << x << std::endl) 35 | #else 36 | # define LOG_INFO(x) 37 | #endif 38 | 39 | #if AUDIO2EMOTION_LOG_LEVEL >= AUDIO2EMOTION_LOG_LEVEL_INFO 40 | # define LOG_INFO(x) (std::cout << "[A2E SDK] [INFO] " << x << std::endl) 41 | #else 42 | # define LOG_INFO(x) 43 | #endif 44 | 45 | #if AUDIO2EMOTION_LOG_LEVEL >= AUDIO2EMOTION_LOG_LEVEL_DEBUG 46 | # define LOG_DEBUG(x) (std::cout << "[A2E SDK] [DEBUG] " << x << std::endl) 47 | #else 48 | # define LOG_DEBUG(x) 49 | #endif 50 | -------------------------------------------------------------------------------- /audio2x-common/scripts/gen_test_data_scripts/gen_test_data_io.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | import os 22 | 23 | import audio2x.data_utils as data_utils 24 | import numpy as np 25 | from audio2x.common import TESTS_DATA_ROOT 26 | 27 | 28 | def gen_data(): 29 | data = { 30 | "tensor1": np.random.randn(16, 1234).astype(np.float32), 31 | "tensor2": np.random.randn(16, 56).astype(np.float32), 32 | "tensor3": np.random.randn(16, 789).astype(np.float32), 33 | } 34 | 35 | os.makedirs(TESTS_DATA_ROOT, exist_ok=True) 36 | data_utils.export_to_bin(data, os.path.join(TESTS_DATA_ROOT, "test_data_io.bin")) 37 | np.savez(os.path.join(TESTS_DATA_ROOT, "test_data_io.npz"), **data) 38 | np.savez_compressed(os.path.join(TESTS_DATA_ROOT, "test_data_io_compressed.npz"), **data) 39 | 40 | string_arr_data = {"names": np.array(["apple", "banana"], dtype="S")} 41 | np.savez_compressed(os.path.join(TESTS_DATA_ROOT, "test_string_arr.npz"), **string_arr_data) 42 | 43 | 44 | if __name__ == "__main__": 45 | gen_data() 46 | -------------------------------------------------------------------------------- /audio2x-common/source/audio2x/audio_accumulator_cuda.cu: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "audio2x/internal/audio_accumulator_cuda.h" 22 | #include "audio2x/internal/logger.h" 23 | #include "audio2x/internal/macros.h" 24 | #include "audio2x/error.h" 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | std::error_code nva2x::cuda::MultiplyOnDevice( 32 | float* buffer, std::size_t size, float multiplier, cudaStream_t cudaStream 33 | ) { 34 | // in-place transformation: buffer <- multiplier * buffer 35 | thrust::device_ptr bufferPtr = thrust::device_pointer_cast(buffer); 36 | thrust::transform( 37 | thrust::cuda::par_nosync.on(cudaStream), 38 | bufferPtr, 39 | bufferPtr + size, 40 | bufferPtr, 41 | multiplier * thrust::placeholders::_1 42 | ); 43 | 44 | A2X_CUDA_CHECK_ERROR(cudaGetLastError(), ErrorCode::eCudaThrustError); 45 | return ErrorCode::eSuccess; 46 | } 47 | -------------------------------------------------------------------------------- /audio2face-sdk/source/benchmarks/test_benchmark.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set "COMMAND=%*" 4 | 5 | @REM At least one arg should be passed 6 | if "%1"=="" ( 7 | echo "Usage: test_benchmark.bat [args..]" 8 | exit /b 1 9 | ) 10 | 11 | REM Define the list of arguments 12 | set args[0]=--benchmark_filter=BM_RegressionBlendshapeSolveExecutorOffline/FP16:0/UseGPU:0/Identity:0/ExecutionOption:1/A2EPrecompute:0/A2ESkipInference:0/NbTracks:1/real_time 13 | set args[1]=--benchmark_filter=BM_RegressionBlendshapeSolveExecutorStreaming/FP16:0/UseGPU:0/Identity:1/ExecutionOption:1/A2ESkipInference:8/AudioChunkSize:100/NbTracks:8/real_time 14 | set args[2]=--benchmark_filter=BM_DiffusionBlendshapeSolveExecutorStreaming/FP16:0/UseGPU:1/Identity:2/ExecutionOption:1/A2ESkipInference:0/AudioChunkSize:100/NbTracks:8/real_time 15 | set args[3]=--benchmark_filter=BM_DiffusionGeometryExecutorOffline/FP16:0/Identity:0/ExecutionOption:3/A2EPrecompute:0/A2ESkipInference:8/NbTracks:8/real_time 16 | set args[4]=--benchmark_filter=BM_RegressionGeometryExecutorStreaming/FP16:0/Identity:0/ExecutionOption:7/A2ESkipInference:8/AudioChunkSize:1/NbTracks:1/real_time 17 | set args[5]=--benchmark_filter=BM_DiffusionGeometryExecutorStreaming/FP16:0/Identity:0/ExecutionOption:2/A2ESkipInference:4/AudioChunkSize:100/NbTracks:1/real_time 18 | set args[6]=--benchmark_filter=BM_InteractiveExecutorBatch/BatchSize:0/Regression:1/real_time 19 | set args[7]=--benchmark_filter=BM_GeometryInteractiveExecutorLayer/Layer:0/LookBack:0/Regression:1/real_time 20 | set args[8]=--benchmark_filter=BM_BlendshapeInteractiveExecutorLayer/Layer:0/UseGpuSolver:0/LookBack:0/Regression:1/real_time 21 | set args[9]=--benchmark_filter=BlendshapeSolverBenchmark/BM_Solve/0/0/real_time 22 | set args[10]=--benchmark_filter=BlendshapeSolverBenchmark/BM_CPUSolveAsync/0/3/2/real_time 23 | set args[11]=--benchmark_filter=BlendshapeSolverBatchBenchmark/BM_GPUSolveAsync/10/4/real_time 24 | 25 | setlocal enabledelayedexpansion 26 | 27 | REM Iterate over the arguments and execute the benchmark command 28 | for /L %%i in (0,1,11) do ( 29 | set "current_arg=!args[%%i]!" 30 | echo Running: %COMMAND% !current_arg! 31 | call %COMMAND% !current_arg! 32 | 33 | if !errorlevel! neq 0 ( 34 | exit /b !errorlevel! 35 | ) 36 | ) 37 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/internal/job_runner.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "audio2face/job_runner.h" 35 | 36 | namespace nva2f { 37 | 38 | class ThreadPoolJobRunner : public IJobRunner { 39 | public: 40 | ThreadPoolJobRunner(size_t numThreads); 41 | ~ThreadPoolJobRunner(); 42 | void Enqueue(JobRunnerTask task, void* taskData) override; 43 | void Destroy() override; 44 | private: 45 | std::atomic_bool m_isActive{ true }; 46 | std::vector m_pool; 47 | std::condition_variable m_cv; 48 | std::mutex m_guard; 49 | std::deque> m_pendingJobs; 50 | 51 | void _workerFunction(); 52 | void _terminate(); 53 | }; 54 | 55 | 56 | IJobRunner *CreateThreadPoolJobRunner_INTERNAL(size_t numThreads); 57 | 58 | } // namespace nva2f 59 | -------------------------------------------------------------------------------- /deps/target-deps.packman.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /audio2emotion-sdk/scripts/common.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | import os 22 | from os.path import join as opj 23 | 24 | from audio2x.common import ROOT_DIR, normalize_path 25 | 26 | X_TENSOR_NAME = "input_values" 27 | Z_TENSOR_NAME = "output" 28 | 29 | 30 | def normalize_path(base, sub): 31 | return os.path.normpath(os.path.join(base, sub)) 32 | 33 | 34 | AUDIO_TRACKS_DATA_ROOT = normalize_path(ROOT_DIR, "sample-data") 35 | AUDIO2EMOTION_NET_ROOT = normalize_path(ROOT_DIR, "_data/audio2emotion-models/") 36 | BENCHMARK_DATA_ROOT = normalize_path(ROOT_DIR, "_data/generated/audio2emotion-sdk/benchmark/data/") 37 | SAMPLES_MODEL_ROOT = normalize_path(ROOT_DIR, "_data/generated/audio2emotion-sdk/samples/model/") 38 | TESTS_DATA_ROOT = normalize_path(ROOT_DIR, "_data/generated/audio2emotion-sdk/tests/data/") 39 | 40 | NETWORK_VERSION = "audio2emotion-v2.2" 41 | ONNX_MODEL_FOLDER_PATH = opj(AUDIO2EMOTION_NET_ROOT, NETWORK_VERSION) 42 | ONNX_MODEL_PATH = opj(ONNX_MODEL_FOLDER_PATH, "network.onnx") 43 | NETWORK_INFO_PATH = opj(ONNX_MODEL_FOLDER_PATH, "network_info.json") 44 | CONFIG_PATH = opj(ONNX_MODEL_FOLDER_PATH, "model_config.json") 45 | -------------------------------------------------------------------------------- /audio2emotion-sdk/scripts/utils.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | from os.path import join as opj 22 | 23 | from common import CONFIG_PATH, NETWORK_INFO_PATH 24 | 25 | 26 | def gen_config_data(sample_network_path, trt_info_fpath, sample_data_root): 27 | out_config_data_path = opj(sample_data_root, "a2e_ms_config.json") 28 | import json 29 | 30 | config = gen_config_contents(trt_info_fpath) 31 | config["net_path"] = sample_network_path 32 | 33 | with open(out_config_data_path, "w") as f: 34 | json.dump(config, f, indent=4) 35 | 36 | 37 | def gen_config_contents(trt_info_fpath): 38 | import json 39 | 40 | with open(CONFIG_PATH, "r") as f: 41 | config = json.load(f) 42 | 43 | with open(NETWORK_INFO_PATH, "r") as f: 44 | network_info = json.load(f) 45 | 46 | config["device_id"] = 0 47 | 48 | with open(trt_info_fpath, "r") as f: 49 | trt_info = json.load(f) 50 | 51 | config["audio_params"] = { 52 | "buffer_len": int(trt_info["defaults"]["MAX_BUFFER_LEN"]), 53 | "samplerate": network_info["audio_params"]["samplerate"], 54 | } 55 | 56 | return config 57 | -------------------------------------------------------------------------------- /licenses/eigen-LICENSE.MINPACK: -------------------------------------------------------------------------------- 1 | Minpack Copyright Notice (1999) University of Chicago. All rights reserved 2 | 3 | Redistribution and use in source and binary forms, with or 4 | without modification, are permitted provided that the 5 | following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials 14 | provided with the distribution. 15 | 16 | 3. The end-user documentation included with the 17 | redistribution, if any, must include the following 18 | acknowledgment: 19 | 20 | "This product includes software developed by the 21 | University of Chicago, as Operator of Argonne National 22 | Laboratory. 23 | 24 | Alternately, this acknowledgment may appear in the software 25 | itself, if and wherever such third-party acknowledgments 26 | normally appear. 27 | 28 | 4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" 29 | WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE 30 | UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND 31 | THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES 33 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE 34 | OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY 35 | OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR 36 | USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF 37 | THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) 38 | DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION 39 | UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL 40 | BE CORRECTED. 41 | 42 | 5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT 43 | HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF 44 | ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, 45 | INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF 46 | ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF 47 | PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER 48 | SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT 49 | (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, 50 | EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE 51 | POSSIBILITY OF SUCH LOSS OR DAMAGES. 52 | -------------------------------------------------------------------------------- /audio2x-common/source/audio2x/nvtx_trace.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "audio2x/internal/nvtx_trace.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | namespace { 28 | 29 | nvtxDomainHandle_t a2xDomain = nullptr; 30 | std::once_flag a2xDomainFlag; 31 | 32 | } 33 | 34 | namespace nva2x { 35 | 36 | NvtxTraceScope::NvtxTraceScope(const char* name) { 37 | // TODO: call nvtxDomainDestroy(a2xDomain) 38 | // Maybe from a global Finalize() function...? 39 | std::call_once(a2xDomainFlag, [](){ a2xDomain = nvtxDomainCreateA("Audio2X SDK"); }); 40 | 41 | nvtxEventAttributes_t eventAttrib; 42 | eventAttrib.version = NVTX_VERSION; 43 | eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; 44 | eventAttrib.category = 0; 45 | eventAttrib.colorType = NVTX_COLOR_ARGB; 46 | eventAttrib.color = 0xFF87CEEB; 47 | eventAttrib.payloadType = NVTX_PAYLOAD_UNKNOWN; 48 | eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; 49 | eventAttrib.message.ascii = name; 50 | nvtxDomainRangePushEx(a2xDomain, &eventAttrib); 51 | } 52 | 53 | NvtxTraceScope::~NvtxTraceScope() { 54 | nvtxDomainRangePop(a2xDomain); 55 | } 56 | 57 | } // namespace nva2x 58 | -------------------------------------------------------------------------------- /audio2emotion-sdk/include/audio2emotion/internal/multitrack_postprocess_cuda.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/cuda_fwd.h" 24 | 25 | #include 26 | #include 27 | 28 | namespace nva2e::cuda { 29 | 30 | static constexpr unsigned int kExpectedWarpSize = 32; 31 | 32 | std::error_code PostProcess_Set( 33 | std::uint64_t* deviceBits, const std::uint64_t* hostBits, std::size_t size, 34 | cudaStream_t cudaStream 35 | ); 36 | 37 | std::error_code PostProcess( 38 | float* outputEmotions, std::size_t outputEmotionsOffset, std::size_t outputEmotionsStride, std::size_t outputEmotionsSize, 39 | const float* inputEmotions, std::size_t inputEmotionsOffset, std::size_t inputEmotionsStride, std::size_t inputEmotionsSize, 40 | const std::int64_t* a2eEmotionCorrespondence, const std::int64_t* a2fEmotionCorrespondence, 41 | const float* postProcessParams, std::size_t postProcessParamsStride, 42 | const float* preferredEmotion, 43 | float* stateAndWorkBuffers, std::size_t stateAndWorkBuffersStride, 44 | const std::uint64_t* activeTracks, 45 | std::size_t nbTracks, 46 | cudaStream_t cudaStream, 47 | bool useFastPath 48 | ); 49 | 50 | } // namespace nva2e::cuda 51 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/internal/executor_regression.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2face/internal/executor.h" 24 | #include "audio2face/internal/executor_regression_core.h" 25 | #include "audio2face/internal/model_regression.h" 26 | 27 | namespace nva2f { 28 | 29 | namespace IRegressionModel { 30 | 31 | class GeometryExecutor : public GeometryExecutorBase { 32 | public: 33 | std::error_code Reset(std::size_t trackIndex) override; 34 | 35 | std::error_code Execute(std::size_t* pNbExecutedTracks) override; 36 | 37 | std::error_code Init( 38 | const nva2f::GeometryExecutorCreationParameters& params, 39 | const nva2f::IRegressionModel::GeometryExecutorCreationParameters& regressionParams 40 | ); 41 | 42 | protected: 43 | GeometryExecutorCore& GetCore() override; 44 | const GeometryExecutorCore& GetCore() const override; 45 | 46 | private: 47 | GeometryExecutorCore _core; 48 | }; 49 | 50 | } // namespace IRegressionModel 51 | 52 | IGeometryExecutor* CreateRegressionGeometryExecutor_INTERNAL( 53 | const GeometryExecutorCreationParameters& params, 54 | const IRegressionModel::GeometryExecutorCreationParameters& regressionParams 55 | ); 56 | 57 | } // namespace nva2f 58 | -------------------------------------------------------------------------------- /audio2face-sdk/tests/test_core_batch_eyes_animator_cuda.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/cuda_fwd.h" 24 | 25 | #include 26 | #include 27 | 28 | namespace test { 29 | 30 | std::error_code ComputeEyesRotation( 31 | float* outputEyesRotation, std::size_t outputEyesRotationOffset, std::size_t outputEyesRotationStride, 32 | const float* inputEyesRotationResult, std::size_t inputEyesRotationResultOffset, std::size_t inputEyesRotationResultStride, 33 | const float* params, std::size_t paramsStride, 34 | const float* saccadeRot, std::size_t saccadeRotSize, 35 | float dt, 36 | float* liveTime, 37 | std::size_t nbTracks, 38 | cudaStream_t cudaStream 39 | ); 40 | 41 | std::error_code ComputeEyesRotationEmpty( 42 | float* outputEyesRotation, std::size_t outputEyesRotationOffset, std::size_t outputEyesRotationStride, 43 | const float* inputEyesRotationResult, std::size_t inputEyesRotationResultOffset, std::size_t inputEyesRotationResultStride, 44 | const float* params, std::size_t paramsStride, 45 | const float* saccadeRot, std::size_t saccadeRotSize, 46 | float dt, 47 | float* liveTime, 48 | std::size_t nbTracks, 49 | cudaStream_t cudaStream 50 | ); 51 | 52 | } // namespace test 53 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/internal/logger.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include 24 | 25 | #define AUDIO2X_LOG_LEVEL_ERROR 1 26 | #define AUDIO2X_LOG_LEVEL_INFO 2 27 | #define AUDIO2X_LOG_LEVEL_DEBUG 3 28 | 29 | #ifndef AUDIO2X_LOG_LEVEL 30 | #define AUDIO2X_LOG_LEVEL AUDIO2X_LOG_LEVEL_DEBUG 31 | #endif 32 | 33 | // Generic macros that can be used to define SDK-specific ones. 34 | #if AUDIO2X_LOG_LEVEL >= AUDIO2X_LOG_LEVEL_ERROR 35 | #define A2X_BASE_LOG_ERROR(category, x) (std::cerr << "[" category "] [ERROR] " << x << std::endl) 36 | #else 37 | #define A2X_BASE_LOG_ERROR(category, x) 38 | #endif 39 | 40 | #if AUDIO2X_LOG_LEVEL >= AUDIO2X_LOG_LEVEL_INFO 41 | #define A2X_BASE_LOG_INFO(category, x) (std::cout << "[" category "] [INFO] " << x << std::endl) 42 | #else 43 | #define A2X_BASE_LOG_INFO(category, x) 44 | #endif 45 | 46 | #if AUDIO2X_LOG_LEVEL >= AUDIO2X_LOG_LEVEL_DEBUG 47 | #define A2X_BASE_LOG_DEBUG(category, x) (std::cout << "[" category "] [DEBUG] " << x << std::endl) 48 | #else 49 | #define A2X_BASE_LOG_DEBUG(category, x) 50 | #endif 51 | 52 | // A2X SDK specific macros. 53 | #define A2X_LOG_ERROR(x) A2X_BASE_LOG_ERROR("A2X SDK", x) 54 | #define A2X_LOG_INFO(x) A2X_BASE_LOG_INFO ("A2X SDK", x) 55 | #define A2X_LOG_DEBUG(x) A2X_BASE_LOG_DEBUG("A2X SDK", x) 56 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/internal/math_utils.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | #include 23 | #include 24 | 25 | namespace nva2f { 26 | 27 | // Compute the transform between two point sets. 28 | // 29 | // output_transform : a 4x4 matrix containing the best rigid transformation 30 | // (translate + rotate) transforming the points in the 31 | // from_pose array to the points in the to_pose array. 32 | // The matrix is stored in column-major. 33 | // to_pose : destination point set after the transform to be computed 34 | // is applied, contains 3 x nb_points floats. 35 | // The points are stored [x0,y0,z0,x1,y1,z1,...]. 36 | // from_pose : source point set before the transform to be computed is 37 | // applied, contains 3 x nb_points floats. 38 | // The points are stored [x0,y0,z0,x1,y1,z1,...]. 39 | // nb_points : number of points in the to_pose and from_pose arrays. 40 | std::error_code rigidXform( 41 | float* output_transform, 42 | const float* to_pose, 43 | const float* from_pose, 44 | std::size_t nb_points 45 | ); 46 | 47 | } // namespace nva2f 48 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/noise.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/tensor.h" 24 | 25 | namespace nva2f { 26 | 27 | // Interface for generating noise data on GPU. 28 | // It generates normally distributed random numbers with mean 0 and standard deviation 1. 29 | class INoiseGenerator { 30 | public: 31 | // Set the CUDA stream for GPU noise generation operations. 32 | virtual std::error_code SetCudaStream(cudaStream_t cudaStream) = 0; 33 | 34 | // Initialize the noise generator with the specified number of tracks and generation size. 35 | virtual std::error_code Init(std::size_t nbTracks, std::size_t sizeToGenerate) = 0; 36 | 37 | // Generate noise data for the specified track and store it in the provided tensor. 38 | virtual std::error_code Generate(std::size_t trackIndex, nva2x::DeviceTensorFloatView tensor) = 0; 39 | 40 | // Reset the noise generation state for the specified track and generation index. 41 | // After this call, the generator will be in the same state as if a count of generateIndex calls 42 | // to Generate() had been made. 43 | virtual std::error_code Reset(std::size_t trackIndex, std::size_t generateIndex) = 0; 44 | 45 | // Delete this object. 46 | virtual void Destroy() = 0; 47 | 48 | protected: 49 | virtual ~INoiseGenerator(); 50 | }; 51 | 52 | } // namespace nva2f 53 | -------------------------------------------------------------------------------- /audio2face-sdk/source/audio2face-core/blendshape_solver_cuda.cu: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | 22 | #include "audio2face/internal/mask_extraction.h" 23 | #include "audio2face/internal/logger.h" 24 | #include "audio2face/internal/macros.h" 25 | #include "audio2x/error.h" 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | 32 | 33 | namespace nva2f 34 | { 35 | 36 | // Kernel to copy elements from src to dst based on indices 37 | __global__ void copyIndicesKernel(float* dst, const float* src, const int* indices, int numIndices) { 38 | int idx = blockIdx.x * blockDim.x + threadIdx.x; 39 | if (idx < numIndices) { 40 | int srcIdx = indices[idx]; 41 | dst[idx] = src[srcIdx]; 42 | } 43 | } 44 | 45 | std::error_code CopyIndices(float* dst, const float* src, const int* indices, int numIndices, cudaStream_t stream) { 46 | int threadsPerBlock = 1024; 47 | int blocksPerGrid = (numIndices + threadsPerBlock - 1) / threadsPerBlock; 48 | 49 | // Launch the kernel 50 | copyIndicesKernel<<>>(dst,src, indices, numIndices); 51 | 52 | // Check for any errors launching the kernel 53 | CUDA_CHECK_ERROR(cudaGetLastError(), nva2x::ErrorCode::eCudaKernelError); 54 | return nva2x::ErrorCode::eSuccess; 55 | } 56 | 57 | } // namespace nva2f 58 | -------------------------------------------------------------------------------- /audio2x-common/source/audio2x/tensor_cuda.cu: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #include "audio2x/internal/tensor_cuda.h" 22 | #include "audio2x/internal/logger.h" 23 | #include "audio2x/internal/macros.h" 24 | #include "audio2x/error.h" 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | template 31 | std::error_code nva2x::cuda::FillOnDevice( 32 | Scalar* destination, std::size_t size, Scalar value, cudaStream_t cudaStream 33 | ) { 34 | thrust::fill_n( 35 | thrust::cuda::par_nosync.on(cudaStream), 36 | thrust::device_pointer_cast(destination), 37 | size, 38 | value 39 | ); 40 | A2X_CUDA_CHECK_ERROR(cudaGetLastError(), ErrorCode::eCudaThrustError); 41 | return ErrorCode::eSuccess; 42 | } 43 | 44 | template std::error_code nva2x::cuda::FillOnDevice(float* destination, std::size_t size, float value, cudaStream_t cudaStream); 45 | template std::error_code nva2x::cuda::FillOnDevice(int64_t* destination, std::size_t size, int64_t value, cudaStream_t cudaStream); 46 | template std::error_code nva2x::cuda::FillOnDevice(uint64_t* destination, std::size_t size, uint64_t value, cudaStream_t cudaStream); 47 | template std::error_code nva2x::cuda::FillOnDevice(bool* destination, std::size_t size, bool value, cudaStream_t cudaStream); 48 | -------------------------------------------------------------------------------- /audio2emotion-sdk/include/audio2emotion/internal/executor_classifier.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2emotion/executor_classifier.h" 24 | #include "audio2emotion/internal/executor.h" 25 | #include "audio2emotion/internal/executor_classifier_core.h" 26 | 27 | namespace nva2e { 28 | 29 | namespace IClassifierModel { 30 | 31 | class EmotionExecutor : public EmotionExecutorBase { 32 | public: 33 | std::size_t GetNextAudioSampleToRead(std::size_t trackIndex) const override; 34 | 35 | std::error_code Execute(std::size_t* pNbExecutedTracks) override; 36 | 37 | std::error_code Init( 38 | const nva2e::EmotionExecutorCreationParameters& params, 39 | const nva2e::IClassifierModel::EmotionExecutorCreationParameters& classifierParams 40 | ); 41 | 42 | protected: 43 | std::error_code RunInference(std::size_t& outNbExecutedTracks) override; 44 | EmotionExecutorCore& GetCore() override; 45 | const EmotionExecutorCore& GetCore() const override; 46 | 47 | private: 48 | EmotionExecutorCore _core; 49 | }; 50 | 51 | } // namespace IClassifierModel 52 | 53 | IEmotionExecutor* CreateClassifierEmotionExecutor_INTERNAL( 54 | const nva2e::EmotionExecutorCreationParameters& params, 55 | const nva2e::IClassifierModel::EmotionExecutorCreationParameters& classifierParams 56 | ); 57 | 58 | } // namespace nva2e 59 | -------------------------------------------------------------------------------- /audio2face-sdk/include/audio2face/internal/executor_diffusion.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2face/internal/executor_diffusion_core.h" 24 | #include "audio2face/internal/executor.h" 25 | #include "audio2face/internal/model_diffusion.h" 26 | #include "audio2x/internal/bit_vector.h" 27 | 28 | namespace nva2f { 29 | 30 | namespace IDiffusionModel { 31 | 32 | class GeometryExecutor : public GeometryExecutorBase { 33 | public: 34 | std::error_code Reset(std::size_t trackIndex) override; 35 | 36 | std::error_code Execute(std::size_t* pNbExecutedTracks) override; 37 | 38 | std::error_code Init( 39 | const nva2f::GeometryExecutorCreationParameters& params, 40 | const nva2f::IDiffusionModel::GeometryExecutorCreationParameters& diffusionParams 41 | ); 42 | 43 | protected: 44 | GeometryExecutorCore& GetCore() override; 45 | const GeometryExecutorCore& GetCore() const override; 46 | 47 | private: 48 | GeometryExecutorCore _core; 49 | 50 | nva2x::bit_vector _postProcessTracks; 51 | nva2x::bit_vector _doneTracks; 52 | }; 53 | 54 | } // namespace IDiffusionModel 55 | 56 | IGeometryExecutor* CreateDiffusionGeometryExecutor_INTERNAL( 57 | const GeometryExecutorCreationParameters& params, 58 | const IDiffusionModel::GeometryExecutorCreationParameters& diffusionParams 59 | ); 60 | 61 | } // namespace nva2f 62 | -------------------------------------------------------------------------------- /audio2x-common/include/audio2x/audio_accumulator.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | // SPDX-License-Identifier: MIT 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a 5 | // copy of this software and associated documentation files (the "Software"), 6 | // to deal in the Software without restriction, including without limitation 7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | // and/or sell copies of the Software, and to permit persons to whom the 9 | // Software is furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | // DEALINGS IN THE SOFTWARE. 21 | #pragma once 22 | 23 | #include "audio2x/tensor.h" 24 | #include "audio2x/float_accumulator.h" 25 | 26 | namespace nva2x { 27 | 28 | // This class is thread-safe, it is safe to call any functions concurrently, 29 | // with the exception of Destroy(). 30 | class IAudioAccumulator : public IFloatAccumulator { 31 | public: 32 | // Read samples from the accumulator. 33 | // The start sample is in number of samples since the start of the audio. 34 | // This function is GPU async. 35 | virtual std::error_code Read( 36 | DeviceTensorFloatView destination, timestamp_t absoluteStartSample, float inputStrength, cudaStream_t cudaStream 37 | ) const = 0; 38 | 39 | // Implement the IFloatAccumulator::Read() function as a wrapper around the more 40 | // specialized Read() function. 41 | std::error_code Read( 42 | DeviceTensorFloatView destination, timestamp_t absoluteStartSample, cudaStream_t cudaStream 43 | ) const final { 44 | return Read(destination, absoluteStartSample, 1.0f, cudaStream); 45 | } 46 | 47 | protected: 48 | virtual ~IAudioAccumulator(); 49 | }; 50 | 51 | // Create an audio accumulator pre-allocated with tensorCount buffers holding tensorSize float values. 52 | AUDIO2X_SDK_EXPORT IAudioAccumulator* CreateAudioAccumulator(std::size_t tensorSize, std::size_t tensorCount); 53 | 54 | } // namespace nva2x 55 | -------------------------------------------------------------------------------- /audio2x-common/scripts/audio2x/common.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | import argparse 22 | import os 23 | import tempfile 24 | 25 | CUR_DIR = os.path.dirname(os.path.abspath(__file__)) 26 | ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(CUR_DIR))) 27 | DEPS_DIR = os.path.join(ROOT_DIR, "_deps/target-deps") 28 | A2X_SDK_TMP_DIR = os.path.join(tempfile.gettempdir(), "a2x_sdk_tmp") 29 | os.makedirs(A2X_SDK_TMP_DIR, exist_ok=True) 30 | # for speed up development, we can set this to true system-wide to avoid re-converting the model 31 | # use with caution, as it may lead to incorrect results 32 | USE_TRT_CACHE = os.environ.get("A2X_SDK_USE_TRT_CACHE", "").lower() == "true" 33 | 34 | 35 | def normalize_path(base, sub): 36 | return os.path.normpath(os.path.join(base, sub)) 37 | 38 | 39 | if os.name == "nt": 40 | CUR_OS = "windows" 41 | else: 42 | CUR_OS = "linux" 43 | 44 | TRT_DEVICE = 0 45 | 46 | parser = argparse.ArgumentParser() 47 | parser.add_argument("--want_nvinfer_dispatch", nargs=1, type=str) 48 | parser.add_argument("--want_ampere_plus", nargs=1, type=str) 49 | args = parser.parse_args() 50 | WANT_NVINFER_DISPATCH = args.want_nvinfer_dispatch[0].lower() == "true" if args.want_nvinfer_dispatch else False 51 | WANT_AMPERE_PLUS = args.want_ampere_plus[0].lower() == "true" if args.want_ampere_plus else False 52 | del parser, args 53 | 54 | TESTS_DATA_ROOT = normalize_path(ROOT_DIR, "_data/generated/audio2x-common/tests/data/") 55 | --------------------------------------------------------------------------------