hyperray 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hyperdrone/__init__.py +53 -0
- hyperdrone/_cuda/__init__.py +76 -0
- hyperdrone/_dlpack.py +30 -0
- hyperdrone/_jit/__init__.py +131 -0
- hyperdrone/_jit/_build.py +113 -0
- hyperdrone/_jit/_lock.py +23 -0
- hyperdrone/_jit/_patches.py +99 -0
- hyperdrone/_jit/_toolchain.py +17 -0
- hyperdrone/_jit/_workspace.py +94 -0
- hyperdrone/_native/cmake/hyperdrone_jit.cmake +65 -0
- hyperdrone/_native/common/bindings.h +39 -0
- hyperdrone/_native/common/cuda_staging.h +80 -0
- hyperdrone/_native/common/jit_host.h +69 -0
- hyperdrone/_native/common/models.h +24 -0
- hyperdrone/_native/common/verbosity.h +52 -0
- hyperdrone/_native/dynamics/CMakeLists.txt +63 -0
- hyperdrone/_native/dynamics/host.cpp +188 -0
- hyperdrone/_native/dynamics/iface.h +71 -0
- hyperdrone/_native/dynamics/impl.cpp +638 -0
- hyperdrone/_native/env/CMakeLists.txt +98 -0
- hyperdrone/_native/env/environment.cpp +190 -0
- hyperdrone/_native/env/environment.h +282 -0
- hyperdrone/_native/env/impl.cpp +779 -0
- hyperdrone/_native/env/rotorcraft_bindings.cpp +53 -0
- hyperdrone/_native/render/CMakeLists.txt +96 -0
- hyperdrone/_native/render/renderer.cpp +973 -0
- hyperdrone/_native/render/rig_bindings.h +152 -0
- hyperdrone/_native/render/scene_bindings.cpp +515 -0
- hyperdrone/_outputs.py +32 -0
- hyperdrone/_parameters.py +36 -0
- hyperdrone/_vendor/rl-tools/CMakeLists.txt +207 -0
- hyperdrone/_vendor/rl-tools/LICENSE +21 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/all.cmake +34 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/git-diff.cmake +100 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/git-hash.cmake +24 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/summary.cmake +65 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier0-compiler.cmake +18 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier1-blas.cmake +51 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier2-json-hdf5-zlib.cmake +82 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier3-tensorboard.cmake +25 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier4-cuda.cmake +42 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier5-cli11.cmake +24 -0
- hyperdrone/_vendor/rl-tools/cmake/dependencies/assimp.cmake +19 -0
- hyperdrone/_vendor/rl-tools/cmake/legacy_flags.cmake +33 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/assimp.cmake +30 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/googletest.cmake +20 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/metal.cmake +25 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/mujoco.cmake +89 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/optix.cmake +25 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/raytracing.cmake +105 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/raytracing_generic.cmake +2 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/vulkan.cmake +4 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/webgpu.cmake +24 -0
- hyperdrone/_vendor/rl-tools/cmake/scripts/embed_text.cmake +7 -0
- hyperdrone/_vendor/rl-tools/cmake/scripts/generate-git-snapshot.cmake +138 -0
- hyperdrone/_vendor/rl-tools/include/conta/conta.h +1480 -0
- hyperdrone/_vendor/rl-tools/include/metra/metra.h +381 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/matrix.h +143 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_arm.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu.h +314 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_accelerate.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_blas.h +67 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_mkl.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_openblas.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cuda.h +289 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_dummy.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_esp32.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_generic.h +944 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_wasm32.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/persist_code.h +136 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_arm.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu.h +94 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_accelerate.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_blas.h +115 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_mkl.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_openblas.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cuda.h +713 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_generic.h +1356 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/persist_code.h +130 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/tensor.h +490 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/arm.h +91 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu.h +210 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_accelerate.h +23 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_blas.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_emscripten.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_mkl.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_openblas.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_tensorboard.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cuda.h +464 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cuda_streams.h +23 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/devices.h +105 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/dummy.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/esp32.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/generic.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/wasm32.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/model.h +218 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/operations_generic.h +769 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/persist.h +278 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter.h +100 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter_persist.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/tensor_operations_generic.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_backend.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_interface.h +36 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/l2f.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_dyn.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_generic.h +268 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_backend.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_interface.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_backend.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_interface.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/executor.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/helper.h +109 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/operations_generic.h +219 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arduino.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arm.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu_tensorboard.h +151 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cuda.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_dummy.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_wasm32.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_arm.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cpu.h +138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cuda.h +380 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_dummy.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_esp32.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_generic.h +295 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_wasm32.h +230 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/mode/mode.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/activation_functions.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/capability.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/persist_code.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/group.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/layer.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_cuda.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_generic.h +186 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/persist.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/layer.h +300 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cpu_mkl.h +590 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cuda.h +809 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_generic.h +1219 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist_code.h +170 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/layer.h +145 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/dsp.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/opt.h +173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_accelerate.h +66 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_blas.h +282 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_mkl.h +66 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_openblas.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cuda.h +519 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_dummy.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/dsp.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/opt.h +167 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_generic.h +429 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist.h +62 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_code.h +178 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_common.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/layer.h +188 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_cuda.h +356 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_generic.h +536 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/persist.h +32 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/layer.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/operations_generic.h +223 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/persist.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/layer.h +121 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/operations_generic.h +154 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist_code.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_cuda.h +602 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_generic.h +251 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/layer.h +206 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/operations_generic.h +889 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist.h +75 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist_code.h +199 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/layers.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/layer.h +143 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_cuda.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_generic.h +216 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/persist.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_blas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_mkl.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_openblas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cuda.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_generic.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/layer.h +223 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_cuda.h +138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_generic.h +446 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/persist.h +70 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/layer.h +154 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_cuda.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_generic.h +502 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist_code.h +173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/layer.h +116 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_cuda.h +156 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_generic.h +295 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist.h +83 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist_code.h +163 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/layer.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/operations_generic.h +272 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist_code.h +164 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/layer.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_cuda.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_generic.h +160 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist_code.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/layer.h +132 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_cuda.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_generic.h +230 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/categorical_cross_entropy/operations_generic.h +102 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_cuda.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_generic.h +101 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/operations_generic.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/nn.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_blas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mux.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_openblas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cuda.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_generic.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/adam.h +121 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_cuda.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_generic.h +150 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist_code.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_cuda.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_generic.h +109 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/persist.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/instance/operations_generic.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/lamb.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/operations_generic.h +68 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/optimizers.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_cuda.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_generic.h +140 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist_code.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_cuda.h +49 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_generic.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/sgd.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/update.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_cuda.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_generic.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/parameters.h +79 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist_code.h +136 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist_code.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/behaviors/skip_parameter_gradients.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/group/README.md +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/group/model.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/group/persist_code.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/network.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_cuda.h +10 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_dummy.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_generic.h +407 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist_code.h +137 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/network.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/operations_generic.h +86 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist_code.h +142 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/models.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/model.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/operations_generic.h +288 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist_code.h +71 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cpu.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cuda.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_generic.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/model.h +290 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_cuda.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_generic.h +623 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist_code.h +200 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist_code.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/model.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/operations_generic.h +73 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/resnet/resnet.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/model.h +270 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/operations_generic.h +625 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist_code.h +115 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/bf16.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/categories.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/persist_code.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/policy.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_1.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_2.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_3.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_1.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_1.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mux.h +158 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_1.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_1.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_3.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_1.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/hdf5.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/operations_cpu.h +419 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/io.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_cpu.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_generic.h +620 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_posix.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/tar.h +74 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/code.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_arm.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cpu.h +81 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cuda.h +172 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_dummy.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_esp32.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic_array.h +73 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_wasm32.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/persist.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/camera.h +105 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/annotations/cache.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/annotations/free_space.h +60 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/annotations/operations_cpu.h +411 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/glb/glb.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/glb/operations_cpu.h +1288 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/operations_cpu.h +136 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/catalog.h +232 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/conversion.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/operations_cpu.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/procthor.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_cpu.h +717 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_generic.h +1283 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/context.h +193 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/device_source.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/operations_cpu.h +1123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device.h +207 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device_impl.h +1043 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/operations_cuda.h +1747 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/overlay_accel.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/specialization.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/context.h +251 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/device_source.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/operations_cpu.h +2067 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/bvh_sah.h +182 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/context.h +280 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/device_source.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/operations_cpu.h +1405 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_common.h +948 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_mux.h +32 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_post.h +96 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/renderer.h +484 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/save_cpu.h +314 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/transforms_generic.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/types.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/rig/operations_cpu.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/rig/operations_generic.h +121 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/rig/rig.h +70 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/scene.h +132 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/segmentation_cpu.h +145 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/transforms.h +204 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/types.h +76 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/algorithms.h +6 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_generic.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/config.h +243 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_cuda.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_generic.h +205 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/persist.h +109 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/state.h +51 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/mixed_imitation.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_cuda.h +190 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic.h +332 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic_mixed_imitation.h +81 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/persist.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/ppo.h +105 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_gru.h +84 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_mlp.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/config.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/operations_generic.h +193 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/state.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_accelerate.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mkl.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mux.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cuda.h +131 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_generic.h +580 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/sac.h +151 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_gru.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_mlp.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/config.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/operations_generic.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/state.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_accelerate.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mkl.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mux.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cuda.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_generic.h +359 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/td3.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/components.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/off_policy_runner.h +225 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu.h +95 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_accelerate.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_mkl.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cuda.h +237 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic.h +498 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic_per_env.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/collection.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/on_policy_runner.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_accelerate.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_mkl.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_mux.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cuda.h +183 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic.h +366 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic_common.h +74 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/persist.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_generic.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_generic.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/persist.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/replay_buffer.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/operations_generic.h +76 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/persist.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/running_normalizer.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/operations_generic.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/operations_generic.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/wrapper.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/wrappers.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/acrobot.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_cpu.h +152 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_generic.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/environment.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/operations_cuda.h +204 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/operations_generic.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/operations_generic_common.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/persist.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/car.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_cpu.h +110 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_generic.h +206 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_json.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/track.h +23 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/ui.h +189 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/environments.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/environment.h +87 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_cpu.h +212 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_generic.h +215 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/observation.h +75 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/operations_cpu.h +1063 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/operations_cuda.h +564 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/pose.h +253 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/presets.h +154 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/raptor/operations_cpu.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/raptor/operations_generic.h +91 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/raptor/raptor.h +71 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/rig/operations_cpu.h +190 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/rig/operations_generic.h +32 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/rig/rig.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/capture_cpu.h +86 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/capture_cuda.h +69 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/capture_optix.h +163 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/operations_cpu.h +223 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/operations_cpu_spectator.h +194 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/operations_cuda.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/operations_cuda_spectator.h +109 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/spectator.h +82 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/spy.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/spy/ui.h +30 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/moving_gate/moving_gate.h +103 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/moving_gate/operations_cpu.h +279 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/moving_gate/operations_cuda.h +242 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/operations_cpu.h +322 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/operations_cuda.h +312 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/operations_generic_position_hold.h +128 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/position_hold.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/target_frame.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/baseline.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/calibration.h +62 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/metrics.h +101 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/operations_cpu.h +374 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/visual_inertial_localization.h +126 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/world.h +333 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/inertial_velocity.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/metrics.h +266 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/multirotor.h +1138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_cpu.h +2252 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/05_state_is_nan.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/10_sample_initial_parameters.h +228 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/20_initial_state.h +208 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/30_sample_initial_state.h +300 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/35_get_desired_state.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/40_observe.h +637 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/50_state_algebra.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/60_dynamics.h +134 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/70_post_integration.h +368 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/80_abs_diff.h +312 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic.h +367 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic_inertial_velocity.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_helper_generic.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic.h +70 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic_forward.h +24 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/default.h +209 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/arpl.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie.h +127 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie_openmv.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/flightmare.h +111 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/fs.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/mrs.h +110 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft_rigid.h +118 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_real.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_sim.h +114 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/init/default.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/registry.h +96 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/default.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/reward_functions.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/operations_generic.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/squared.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/termination/default.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/lissajous.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/trajectory.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/persist.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/persist_code.h +53 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/quaternion_helper.h +103 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/ui.h +180 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/environment.h +69 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_cpu.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_generic.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/README.MD +5 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ant.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/model.h +415 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/operations_cpu.h +162 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/persist.h +86 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ui.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/mujoco.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/bottleneck.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_cpu.h +289 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_generic.h +495 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/environments.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/observation.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_generic.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_cpu.h +146 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_generic.h +262 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/pendulum.h +197 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui_xeus.h +124 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_cpu.h +426 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_generic.h +424 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/reacher.h +137 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/loop.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/config.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/operations_cpu.h +233 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/persist.h +30 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/state.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/config.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/operations_generic.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/state.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/config.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/operations_generic.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/persist.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/state.h +36 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/config.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/operations_cpu.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/state.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/config.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/operations_cpu.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/state.h +24 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/config.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/operations_cpu.h +190 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/persist.h +30 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/state.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/steps.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/config.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/operations_cpu.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/state.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/operations_generic.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/rl.h +5 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/evaluation.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_cpu.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_generic.h +275 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation.h +269 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation_analysis.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl_tools.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/client.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_boost.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_cpu.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_websocket.h +208 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/server.h +448 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/universe.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/declarations_cpu.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/declarations_cpu_emscripten.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_arm.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cpu.h +24 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cpu_emscripten.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cuda.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_dummy.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_esp32.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_generic.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_wasm32.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_cpu.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_generic.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/extrack.h +129 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/operations_cpu.h +588 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/integrators.h +103 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/memcpy.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/operations_generic.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/tuple.h +147 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/typing.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/vector_operations.h +172 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_cuda.h +53 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_generic.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/string/operations_generic.h +201 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/zlib/operations_cpu.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/version.h +28 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/CMakeLists.txt +15 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/README.md +214 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/CMakeLists.txt +11 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/CMakeLists.txt +17 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/freestanding_check.cpp +134 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/CMakeLists.txt +31 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/device.metal +912 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/metal_cpp_impl.cpp +6 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/CMakeLists.txt +51 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/device.cu +1 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/overlay_accel.cu +308 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/CMakeLists.txt +37 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device.comp +970 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device_spirv.cpp +44 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/webgpu/CMakeLists.txt +31 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/webgpu/device.wgsl +1381 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/CMakeLists.txt +129 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/README.md +131 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark.cpp +180 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark_dynamic.cpp +491 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/download_paper_scene.py +74 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/CMakeLists.txt +104 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/Info.plist +36 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/Sources/BenchmarkApp.swift +172 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/benchmark.h +10 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/benchmark.mm +46 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/ios_app/build.sh +17 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/rig.cpp +119 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix.cpp +1382 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix.h +5 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_config.h.in +25 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_identity.cmake +11 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_main.cpp +5 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.cu +125 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.h +58 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics_contract.h +179 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics_cpu.cpp +77 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/camera_orbit.h +51 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/CMakeLists.txt +199 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/antialiasing.cpp +214 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone.cpp +320 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone_device.cu +359 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/environment.h +96 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/operations_cpu.h +263 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/example.cpp +273 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/fixed_pose.cpp +221 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/flow.cpp +120 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/interactive.cpp +1015 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/make_drone_glb.py +172 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/minimal.cpp +82 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/minimal_overlay.cpp +137 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/motion_blur.cpp +232 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace.cpp +1829 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace_motion_blur.cpp +647 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/CMakeLists.txt +147 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/README.md +15 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/job.sbatch +28 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model.h +260 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_config.h +24 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_forward_cuda.h +397 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_operations.h +418 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_persist.h +45 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_student.h +70 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.cpp +222 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.h +68 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.gitignore +4 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/CMakeLists.txt +4 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info.plist +24 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info_ios.plist +36 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/CameraManager.swift +120 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/ContentView.swift +703 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/DatasetRecorder.swift +285 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/YawPredictorApp.swift +25 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/YawPredictor.entitlements +8 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build.sh +66 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build_ios.sh +133 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/generate.sh +6 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/h5_to_tar.cpp +82 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.cpp +166 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.h +26 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/project.yml +30 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/test_tar_vs_hdf5.cpp +173 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_cuda.cu +699 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_dataset_overlay.cpp +475 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_distill_cuda.cu +995 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_eval.cu +457 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_real_world_eval.cpp +660 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_viewer.cu +443 -0
- hyperdrone/_vendor/rl-tools/src/rl/environments/hyperdrone/spy/CMakeLists.txt +63 -0
- hyperdrone/_vendor/rl-tools/src/rl/environments/hyperdrone/spy/example.cpp +101 -0
- hyperdrone/_vendor/rl-tools/src/rl/environments/hyperdrone/spy/ui.cpp +380 -0
- hyperdrone/dynamics/__init__.py +5 -0
- hyperdrone/dynamics/_component.py +31 -0
- hyperdrone/dynamics/_config.py +46 -0
- hyperdrone/dynamics/_sim.py +166 -0
- hyperdrone/env/__init__.py +23 -0
- hyperdrone/env/_multi_environment.py +566 -0
- hyperdrone/env/_rotorcraft.py +29 -0
- hyperdrone/env/_spy.py +39 -0
- hyperdrone/examples/.gitignore +3 -0
- hyperdrone/examples/Benchmark.ipynb +113 -0
- hyperdrone/examples/HyperDrone.ipynb +589 -0
- hyperdrone/examples/Orbiter.ipynb +496 -0
- hyperdrone/examples/Renderer.ipynb +218 -0
- hyperdrone/examples/__init__.py +16 -0
- hyperdrone/examples/articulation.py +55 -0
- hyperdrone/examples/benchmark.py +236 -0
- hyperdrone/examples/benchmark_minimal.py +65 -0
- hyperdrone/examples/data.py +71 -0
- hyperdrone/examples/drone_flythrough.py +169 -0
- hyperdrone/examples/hyperdrone_videos/my_world_preview.h +17 -0
- hyperdrone/examples/my_world.h +17 -0
- hyperdrone/examples/render_procthor.py +40 -0
- hyperdrone/examples/shots.py +108 -0
- hyperdrone/examples/spy.py +40 -0
- hyperdrone/examples/visual_inertial_localization.py +158 -0
- hyperdrone/gym/__init__.py +67 -0
- hyperdrone/render/__init__.py +57 -0
- hyperdrone/render/_component.py +51 -0
- hyperdrone/render/_config.py +76 -0
- hyperdrone/render/_renderer.py +498 -0
- hyperdrone/render/_rig.py +136 -0
- hyperdrone/render/_sampling.py +69 -0
- hyperdrone/render/_scene.py +38 -0
- hyperdrone/render/datasets.py +15 -0
- hyperray-0.0.1.dist-info/METADATA +519 -0
- hyperray-0.0.1.dist-info/RECORD +788 -0
- hyperray-0.0.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,1829 @@
|
|
|
1
|
+
#define RL_TOOLS_RENDERING_RAYTRACING_DISABLE_PROBE_RAYS 0
|
|
2
|
+
|
|
3
|
+
#include <rl_tools/operations/cpu_mux.h>
|
|
4
|
+
|
|
5
|
+
#include "environment/environment.h"
|
|
6
|
+
#include "environment/operations_cpu.h"
|
|
7
|
+
#include <rl_tools/rendering/raytracing/save_cpu.h>
|
|
8
|
+
|
|
9
|
+
#include <nlohmann/json.hpp>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#include <algorithm>
|
|
13
|
+
#include <cerrno>
|
|
14
|
+
#include <cctype>
|
|
15
|
+
#include <cmath>
|
|
16
|
+
#include <cstdio>
|
|
17
|
+
#include <cstdlib>
|
|
18
|
+
#include <cstring>
|
|
19
|
+
#include <fstream>
|
|
20
|
+
#include <iostream>
|
|
21
|
+
#include <limits>
|
|
22
|
+
#include <sstream>
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <sys/stat.h>
|
|
25
|
+
#include <vector>
|
|
26
|
+
|
|
27
|
+
namespace rlt = rl_tools;
|
|
28
|
+
using json = nlohmann::json;
|
|
29
|
+
|
|
30
|
+
using T = float;
|
|
31
|
+
using TI = typename rlt::devices::DEVICE_FACTORY<>::index_t;
|
|
32
|
+
|
|
33
|
+
static constexpr TI NUM_CAMERAS = 1;
|
|
34
|
+
static constexpr TI NUM_PROBES = 1;
|
|
35
|
+
static constexpr int FRAME_JPEG_QUALITY = 90;
|
|
36
|
+
static constexpr TI MIN_VIDEO_DIMENSION = 2048;
|
|
37
|
+
static constexpr double DEFAULT_FOV_DEG = 80.0;
|
|
38
|
+
static constexpr double DEFAULT_SMOOTH_POSITION_SIGMA_S = 1.0;
|
|
39
|
+
static constexpr double DEFAULT_SMOOTH_ORIENTATION_SIGMA_S = 6.0;
|
|
40
|
+
static constexpr double DEFAULT_MAX_ORIENTATION_SPEED_RAD_S = 1.6;
|
|
41
|
+
static constexpr double DEFAULT_ORIENTATION_JUMP_RAMP_MULTIPLIER = 5.0;
|
|
42
|
+
|
|
43
|
+
struct RenderResolutionOption {
|
|
44
|
+
const char* name;
|
|
45
|
+
TI width;
|
|
46
|
+
TI height;
|
|
47
|
+
bool enabled_by_default;
|
|
48
|
+
const char* alias = nullptr;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
enum class AntiAliasingSelection {
|
|
52
|
+
NONE,
|
|
53
|
+
AA2,
|
|
54
|
+
BOTH
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
static constexpr RenderResolutionOption RENDER_RESOLUTIONS[] = {
|
|
58
|
+
{"64", 64, 64, true},
|
|
59
|
+
{"128", 128, 128, true},
|
|
60
|
+
{"256", 256, 256, true},
|
|
61
|
+
{"512", 512, 512, true},
|
|
62
|
+
{"1024", 1024, 1024, true},
|
|
63
|
+
{"2048", 2048, 2048, true},
|
|
64
|
+
{"4k", 3840, 2160, true}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
struct TracePose {
|
|
68
|
+
T eye[3];
|
|
69
|
+
T look_at[3];
|
|
70
|
+
T up[3];
|
|
71
|
+
double yaw = 0.0;
|
|
72
|
+
double pitch = 0.0;
|
|
73
|
+
double timestamp_s = 0.0;
|
|
74
|
+
bool has_timestamp = false;
|
|
75
|
+
bool has_yaw_pitch = false;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
struct Options {
|
|
79
|
+
std::string trace_path;
|
|
80
|
+
std::string scene_path;
|
|
81
|
+
std::string output_dir = ".";
|
|
82
|
+
std::string ffmpeg = "ffmpeg";
|
|
83
|
+
bool ffmpeg_gpu = false;
|
|
84
|
+
std::string settings = "very_high";
|
|
85
|
+
int resolution_width = 0;
|
|
86
|
+
int resolution_height = 0;
|
|
87
|
+
int fps = 60;
|
|
88
|
+
int max_frames = 0;
|
|
89
|
+
double fov_deg = DEFAULT_FOV_DEG;
|
|
90
|
+
AntiAliasingSelection aa = AntiAliasingSelection::BOTH;
|
|
91
|
+
double smooth_position_sigma_s = DEFAULT_SMOOTH_POSITION_SIGMA_S;
|
|
92
|
+
double smooth_orientation_sigma_s = DEFAULT_SMOOTH_ORIENTATION_SIGMA_S;
|
|
93
|
+
double max_orientation_speed_rad_s = DEFAULT_MAX_ORIENTATION_SPEED_RAD_S;
|
|
94
|
+
double orientation_jump_ramp_multiplier = DEFAULT_ORIENTATION_JUMP_RAMP_MULTIPLIER;
|
|
95
|
+
bool write_frames = false;
|
|
96
|
+
bool help = false;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
struct RenderRecord {
|
|
100
|
+
std::string name;
|
|
101
|
+
std::string output;
|
|
102
|
+
std::string profile;
|
|
103
|
+
std::string anti_aliasing;
|
|
104
|
+
std::string path;
|
|
105
|
+
std::string frames_dir;
|
|
106
|
+
std::string frame_pattern;
|
|
107
|
+
std::string frame_format;
|
|
108
|
+
std::string ffmpeg_command;
|
|
109
|
+
TI width = 0;
|
|
110
|
+
TI height = 0;
|
|
111
|
+
TI video_width = 0;
|
|
112
|
+
TI video_height = 0;
|
|
113
|
+
TI video_oversampling_factor = 1;
|
|
114
|
+
TI aa_grid_size = 1;
|
|
115
|
+
TI samples_per_pixel = 1;
|
|
116
|
+
size_t frame_count = 0;
|
|
117
|
+
int frame_jpeg_quality = 0;
|
|
118
|
+
int ffmpeg_status = 0;
|
|
119
|
+
bool ok = false;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
static void print_usage(const char* argv0) {
|
|
123
|
+
std::cout
|
|
124
|
+
<< "Usage: " << argv0 << " --trace pose_trace.json [options]\n"
|
|
125
|
+
<< "Options:\n"
|
|
126
|
+
<< " --trace <path> Camera pose JSON or trace JSON\n"
|
|
127
|
+
<< " --scene <path> Scene path override\n"
|
|
128
|
+
<< " --output-dir <dir> Parent output directory; renders go under <dir>/<trace-name>/ (default: .)\n"
|
|
129
|
+
<< " --fps <n> MP4 frame rate; timestamped traces are resampled to this rate (default: 60)\n"
|
|
130
|
+
<< " --fov <deg> Horizontal FOV in degrees (default: 80)\n"
|
|
131
|
+
<< " --ffmpeg <path> ffmpeg binary (default: ffmpeg)\n"
|
|
132
|
+
<< " --ffmpeg-gpu Use NVIDIA NVENC H.264 encoding instead of libx264\n"
|
|
133
|
+
<< " --settings <list> all, rgb, depth, very_high, high, medium, low, or comma list; depth has no rendering profile\n"
|
|
134
|
+
<< " Legacy aliases: very_high_fidelity, basic, high_fidelity, fast_flat\n"
|
|
135
|
+
<< " --resolution <name> Render one resolution: 64, 128, 256, 512, 1024, 2048, or 4k\n"
|
|
136
|
+
<< " 4k is UHD 3840x2160\n"
|
|
137
|
+
<< " By default all listed resolutions are rendered\n"
|
|
138
|
+
<< " Encoded videos are upscaled to at least 2048 pixels per axis\n"
|
|
139
|
+
<< " --aa <mode> Anti-aliasing mode: none, aa2, or both (default: both)\n"
|
|
140
|
+
<< " --frames Write per-frame PNG/JPEG image sequences\n"
|
|
141
|
+
<< " Frames are written under <output-dir>/<trace-name>/frames/<render-name>/\n"
|
|
142
|
+
<< " 64x64 and 128x128 frames are PNG; larger frames are JPEG\n"
|
|
143
|
+
<< " --no-frames Do not write per-frame image sequences (default)\n"
|
|
144
|
+
<< " --max-frames <n> Limit trace frames when >0\n"
|
|
145
|
+
<< " --smooth-sigma-s <s> Gaussian smoothing sigma for position and orientation (use 0 to disable)\n"
|
|
146
|
+
<< " --smooth-position-sigma-s <s>\n"
|
|
147
|
+
<< " Gaussian smoothing sigma for position only (default: 1)\n"
|
|
148
|
+
<< " --smooth-orientation-sigma-s <s>\n"
|
|
149
|
+
<< " Gaussian smoothing sigma for orientation only (default: 6)\n"
|
|
150
|
+
<< " --max-orientation-speed-deg-s <deg/s>\n"
|
|
151
|
+
<< " Detect orientation jumps before smoothing (default: 91.7; use 0 to disable)\n"
|
|
152
|
+
<< " --orientation-jump-ramp-multiplier <x>\n"
|
|
153
|
+
<< " Lengthen detected jump slerp ramps by this factor (default: 5)\n";
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static bool parse_int(const std::string& value, int& out) {
|
|
157
|
+
char* end = nullptr;
|
|
158
|
+
const long parsed = std::strtol(value.c_str(), &end, 10);
|
|
159
|
+
if(end == value.c_str() || *end != '\0') {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
out = static_cast<int>(parsed);
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
static bool parse_resolution(const std::string& value, int& width, int& height) {
|
|
167
|
+
std::string lower = value;
|
|
168
|
+
std::transform(lower.begin(), lower.end(), lower.begin(), [](unsigned char c) {
|
|
169
|
+
return static_cast<char>(std::tolower(c));
|
|
170
|
+
});
|
|
171
|
+
for(const RenderResolutionOption& resolution : RENDER_RESOLUTIONS) {
|
|
172
|
+
if(lower == resolution.name || (resolution.alias != nullptr && lower == resolution.alias)) {
|
|
173
|
+
width = static_cast<int>(resolution.width);
|
|
174
|
+
height = static_cast<int>(resolution.height);
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
int requested_width = 0;
|
|
180
|
+
if(!parse_int(value, requested_width) || requested_width <= 0) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
for(const RenderResolutionOption& resolution : RENDER_RESOLUTIONS) {
|
|
184
|
+
if(static_cast<TI>(requested_width) == resolution.width) {
|
|
185
|
+
width = static_cast<int>(resolution.width);
|
|
186
|
+
height = static_cast<int>(resolution.height);
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
static bool should_render_resolution(const Options& options, TI width, TI height) {
|
|
194
|
+
if(options.resolution_width != 0 || options.resolution_height != 0) {
|
|
195
|
+
return static_cast<TI>(options.resolution_width) == width && static_cast<TI>(options.resolution_height) == height;
|
|
196
|
+
}
|
|
197
|
+
for(const RenderResolutionOption& resolution : RENDER_RESOLUTIONS) {
|
|
198
|
+
if(width == resolution.width && height == resolution.height) {
|
|
199
|
+
return resolution.enabled_by_default;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
static const char* aa_selection_name(AntiAliasingSelection aa) {
|
|
206
|
+
switch(aa) {
|
|
207
|
+
case AntiAliasingSelection::NONE: return "none";
|
|
208
|
+
case AntiAliasingSelection::AA2: return "aa2";
|
|
209
|
+
case AntiAliasingSelection::BOTH: return "both";
|
|
210
|
+
}
|
|
211
|
+
return "both";
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
static bool parse_aa_selection(const std::string& value, AntiAliasingSelection& out) {
|
|
215
|
+
std::string lower = value;
|
|
216
|
+
std::transform(lower.begin(), lower.end(), lower.begin(), [](unsigned char c) {
|
|
217
|
+
return static_cast<char>(std::tolower(c));
|
|
218
|
+
});
|
|
219
|
+
if(lower == "none" || lower == "off" || lower == "no") {
|
|
220
|
+
out = AntiAliasingSelection::NONE;
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
if(lower == "aa2" || lower == "2" || lower == "on") {
|
|
224
|
+
out = AntiAliasingSelection::AA2;
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
if(lower == "both" || lower == "all") {
|
|
228
|
+
out = AntiAliasingSelection::BOTH;
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
static const char* video_encoder_name(const Options& options) {
|
|
235
|
+
return options.ffmpeg_gpu ? "h264_nvenc" : "libx264";
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
static bool should_render_aa(const Options& options, bool enabled, TI grid_size) {
|
|
239
|
+
switch(options.aa) {
|
|
240
|
+
case AntiAliasingSelection::NONE:
|
|
241
|
+
return !enabled;
|
|
242
|
+
case AntiAliasingSelection::AA2:
|
|
243
|
+
return enabled && grid_size == static_cast<TI>(2);
|
|
244
|
+
case AntiAliasingSelection::BOTH:
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
static bool parse_double(const std::string& value, double& out) {
|
|
251
|
+
char* end = nullptr;
|
|
252
|
+
const double parsed = std::strtod(value.c_str(), &end);
|
|
253
|
+
if(end == value.c_str() || *end != '\0' || !std::isfinite(parsed)) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
out = parsed;
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
static double degrees_to_radians(double degrees) {
|
|
261
|
+
return degrees * 3.14159265358979323846 / 180.0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
static bool option_value(int& i, int argc, char** argv, const std::string& arg, const char* name, std::string& out) {
|
|
265
|
+
const std::string prefix = std::string(name) + "=";
|
|
266
|
+
if(arg.compare(0, prefix.size(), prefix) == 0) {
|
|
267
|
+
out = arg.substr(prefix.size());
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
if(arg == name) {
|
|
271
|
+
if(i + 1 >= argc) {
|
|
272
|
+
std::cerr << "Missing value for " << name << std::endl;
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
out = argv[++i];
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
static bool parse_options(int argc, char** argv, Options& options) {
|
|
282
|
+
for(int i = 1; i < argc; i++) {
|
|
283
|
+
const std::string arg = argv[i];
|
|
284
|
+
std::string value;
|
|
285
|
+
if(arg == "-h" || arg == "--help") {
|
|
286
|
+
options.help = true;
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
else if(option_value(i, argc, argv, arg, "--trace", value)) {
|
|
290
|
+
options.trace_path = value;
|
|
291
|
+
}
|
|
292
|
+
else if(option_value(i, argc, argv, arg, "--scene", value)) {
|
|
293
|
+
options.scene_path = value;
|
|
294
|
+
}
|
|
295
|
+
else if(option_value(i, argc, argv, arg, "--output-dir", value)) {
|
|
296
|
+
options.output_dir = value;
|
|
297
|
+
}
|
|
298
|
+
else if(option_value(i, argc, argv, arg, "--ffmpeg", value)) {
|
|
299
|
+
options.ffmpeg = value;
|
|
300
|
+
}
|
|
301
|
+
else if(arg == "--ffmpeg-gpu") {
|
|
302
|
+
options.ffmpeg_gpu = true;
|
|
303
|
+
}
|
|
304
|
+
else if(option_value(i, argc, argv, arg, "--settings", value)) {
|
|
305
|
+
options.settings = value;
|
|
306
|
+
}
|
|
307
|
+
else if(option_value(i, argc, argv, arg, "--resolution", value)) {
|
|
308
|
+
if(!parse_resolution(value, options.resolution_width, options.resolution_height)) {
|
|
309
|
+
std::cerr << "Invalid --resolution: " << value << std::endl;
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else if(option_value(i, argc, argv, arg, "--aa", value)) {
|
|
314
|
+
if(!parse_aa_selection(value, options.aa)) {
|
|
315
|
+
std::cerr << "Invalid --aa: " << value << " (expected none, aa2, or both)" << std::endl;
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
else if(arg == "--no-frames") {
|
|
320
|
+
options.write_frames = false;
|
|
321
|
+
}
|
|
322
|
+
else if(arg == "--frames") {
|
|
323
|
+
options.write_frames = true;
|
|
324
|
+
}
|
|
325
|
+
else if(option_value(i, argc, argv, arg, "--fps", value)) {
|
|
326
|
+
if(!parse_int(value, options.fps) || options.fps <= 0) {
|
|
327
|
+
std::cerr << "Invalid --fps: " << value << std::endl;
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
else if(option_value(i, argc, argv, arg, "--fov", value) || option_value(i, argc, argv, arg, "--fov-deg", value)) {
|
|
332
|
+
if(!parse_double(value, options.fov_deg) || options.fov_deg <= 0.0 || options.fov_deg >= 180.0) {
|
|
333
|
+
std::cerr << "Invalid --fov: " << value << " (expected degrees in (0, 180))" << std::endl;
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else if(option_value(i, argc, argv, arg, "--max-frames", value)) {
|
|
338
|
+
if(!parse_int(value, options.max_frames) || options.max_frames < 0) {
|
|
339
|
+
std::cerr << "Invalid --max-frames: " << value << std::endl;
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
else if(option_value(i, argc, argv, arg, "--smooth-sigma-s", value)) {
|
|
344
|
+
double sigma_s = 0.0;
|
|
345
|
+
if(!parse_double(value, sigma_s) || sigma_s < 0.0) {
|
|
346
|
+
std::cerr << "Invalid --smooth-sigma-s: " << value << std::endl;
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
options.smooth_position_sigma_s = sigma_s;
|
|
350
|
+
options.smooth_orientation_sigma_s = sigma_s;
|
|
351
|
+
}
|
|
352
|
+
else if(option_value(i, argc, argv, arg, "--smooth-position-sigma-s", value)) {
|
|
353
|
+
if(!parse_double(value, options.smooth_position_sigma_s) || options.smooth_position_sigma_s < 0.0) {
|
|
354
|
+
std::cerr << "Invalid --smooth-position-sigma-s: " << value << std::endl;
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
else if(option_value(i, argc, argv, arg, "--smooth-orientation-sigma-s", value)) {
|
|
359
|
+
if(!parse_double(value, options.smooth_orientation_sigma_s) || options.smooth_orientation_sigma_s < 0.0) {
|
|
360
|
+
std::cerr << "Invalid --smooth-orientation-sigma-s: " << value << std::endl;
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else if(option_value(i, argc, argv, arg, "--max-orientation-speed-deg-s", value)) {
|
|
365
|
+
double max_speed_deg_s = 0.0;
|
|
366
|
+
if(!parse_double(value, max_speed_deg_s) || max_speed_deg_s < 0.0) {
|
|
367
|
+
std::cerr << "Invalid --max-orientation-speed-deg-s: " << value << std::endl;
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
options.max_orientation_speed_rad_s = max_speed_deg_s * 3.14159265358979323846 / 180.0;
|
|
371
|
+
}
|
|
372
|
+
else if(option_value(i, argc, argv, arg, "--orientation-jump-ramp-multiplier", value)) {
|
|
373
|
+
if(!parse_double(value, options.orientation_jump_ramp_multiplier) || options.orientation_jump_ramp_multiplier < 1.0) {
|
|
374
|
+
std::cerr << "Invalid --orientation-jump-ramp-multiplier: " << value << std::endl;
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
std::cerr << "Unknown argument: " << arg << std::endl;
|
|
380
|
+
return false;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if(options.trace_path.empty()) {
|
|
384
|
+
std::cerr << "--trace is required" << std::endl;
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
static bool mkdir_p(const std::string& path) {
|
|
391
|
+
if(path.empty()) {
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
std::string current;
|
|
395
|
+
size_t i = 0;
|
|
396
|
+
if(path[0] == '/') {
|
|
397
|
+
current = "/";
|
|
398
|
+
i = 1;
|
|
399
|
+
}
|
|
400
|
+
while(i <= path.size()) {
|
|
401
|
+
const size_t next = path.find('/', i);
|
|
402
|
+
std::string part = path.substr(i, next == std::string::npos ? std::string::npos : next - i);
|
|
403
|
+
if(!part.empty()) {
|
|
404
|
+
if(!current.empty() && current.back() != '/') {
|
|
405
|
+
current += "/";
|
|
406
|
+
}
|
|
407
|
+
current += part;
|
|
408
|
+
if(mkdir(current.c_str(), 0755) != 0 && errno != EEXIST) {
|
|
409
|
+
std::cerr << "Failed to create directory " << current << ": " << std::strerror(errno) << std::endl;
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if(next == std::string::npos) {
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
i = next + 1;
|
|
417
|
+
}
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
static std::string join_path(const std::string& a, const std::string& b) {
|
|
422
|
+
if(a.empty() || a == ".") {
|
|
423
|
+
return b;
|
|
424
|
+
}
|
|
425
|
+
if(a.back() == '/') {
|
|
426
|
+
return a + b;
|
|
427
|
+
}
|
|
428
|
+
return a + "/" + b;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
static std::string path_basename(const std::string& path) {
|
|
432
|
+
const size_t end = path.find_last_not_of("/\\");
|
|
433
|
+
if(end == std::string::npos) {
|
|
434
|
+
return std::string();
|
|
435
|
+
}
|
|
436
|
+
const size_t begin = path.find_last_of("/\\", end);
|
|
437
|
+
if(begin == std::string::npos) {
|
|
438
|
+
return path.substr(0, end + 1);
|
|
439
|
+
}
|
|
440
|
+
return path.substr(begin + 1, end - begin);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
static std::string strip_extension(const std::string& path) {
|
|
444
|
+
const size_t dot = path.find_last_of('.');
|
|
445
|
+
if(dot == std::string::npos || dot == 0) {
|
|
446
|
+
return path;
|
|
447
|
+
}
|
|
448
|
+
return path.substr(0, dot);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
static std::string sanitize_path_component(const std::string& value) {
|
|
452
|
+
std::string out;
|
|
453
|
+
bool wrote_separator = false;
|
|
454
|
+
for(unsigned char c : value) {
|
|
455
|
+
if(std::isalnum(c) || c == '-' || c == '_' || c == '.') {
|
|
456
|
+
out += static_cast<char>(c);
|
|
457
|
+
wrote_separator = false;
|
|
458
|
+
}
|
|
459
|
+
else if(!wrote_separator) {
|
|
460
|
+
out += '_';
|
|
461
|
+
wrote_separator = true;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
while(!out.empty() && out[0] == '.') {
|
|
465
|
+
out.erase(out.begin());
|
|
466
|
+
}
|
|
467
|
+
while(!out.empty() && out.back() == '_') {
|
|
468
|
+
out.pop_back();
|
|
469
|
+
}
|
|
470
|
+
return out.empty() ? std::string("trace") : out;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
static std::string trace_output_name(const std::string& trace_path) {
|
|
474
|
+
const std::string basename = path_basename(trace_path);
|
|
475
|
+
const std::string stem = strip_extension(basename);
|
|
476
|
+
return sanitize_path_component(stem.empty() ? basename : stem);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
static std::string shell_quote(const std::string& value) {
|
|
480
|
+
std::string quoted = "'";
|
|
481
|
+
for(char c : value) {
|
|
482
|
+
if(c == '\'') {
|
|
483
|
+
quoted += "'\\''";
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
quoted += c;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
quoted += "'";
|
|
490
|
+
return quoted;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
static std::vector<std::string> split_settings(const std::string& settings) {
|
|
494
|
+
std::vector<std::string> tokens;
|
|
495
|
+
std::string token;
|
|
496
|
+
std::stringstream ss(settings);
|
|
497
|
+
while(std::getline(ss, token, ',')) {
|
|
498
|
+
token.erase(std::remove_if(token.begin(), token.end(), [](unsigned char c){ return std::isspace(c); }), token.end());
|
|
499
|
+
if(!token.empty()) {
|
|
500
|
+
tokens.push_back(token);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return tokens;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
static bool contains_token(const std::vector<std::string>& tokens, const std::string& value) {
|
|
507
|
+
return std::find(tokens.begin(), tokens.end(), value) != tokens.end();
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
static bool contains_profile_token(const std::vector<std::string>& tokens, const std::string& profile) {
|
|
511
|
+
return contains_token(tokens, profile)
|
|
512
|
+
|| (profile == "very_high" &&
|
|
513
|
+
(contains_token(tokens, "very_high_fidelity") ||
|
|
514
|
+
contains_token(tokens, "veryhigh") ||
|
|
515
|
+
contains_token(tokens, "veryhigh_fidelity")))
|
|
516
|
+
|| (profile == "medium" && contains_token(tokens, "basic"))
|
|
517
|
+
|| (profile == "high" && contains_token(tokens, "high_fidelity"))
|
|
518
|
+
|| (profile == "low" && contains_token(tokens, "fast_flat"));
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
static bool has_profile_filter(const std::vector<std::string>& tokens) {
|
|
522
|
+
return contains_token(tokens, "very_high") || contains_token(tokens, "very_high_fidelity")
|
|
523
|
+
|| contains_token(tokens, "veryhigh") || contains_token(tokens, "veryhigh_fidelity")
|
|
524
|
+
|| contains_token(tokens, "medium") || contains_token(tokens, "basic")
|
|
525
|
+
|| contains_token(tokens, "high") || contains_token(tokens, "high_fidelity")
|
|
526
|
+
|| contains_token(tokens, "low") || contains_token(tokens, "fast_flat");
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
static bool should_render_setting(const Options& options, const char* output, const char* profile) {
|
|
530
|
+
const std::vector<std::string> tokens = split_settings(options.settings);
|
|
531
|
+
if(tokens.empty() || contains_token(tokens, "all")) {
|
|
532
|
+
return true;
|
|
533
|
+
}
|
|
534
|
+
const bool has_output_filter = contains_token(tokens, "rgb") || contains_token(tokens, "depth");
|
|
535
|
+
const bool has_profile_filter_value = has_profile_filter(tokens);
|
|
536
|
+
const bool output_ok = !has_output_filter || contains_token(tokens, output);
|
|
537
|
+
const bool profile_ok = !has_profile_filter_value || contains_profile_token(tokens, profile);
|
|
538
|
+
return output_ok && profile_ok;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
static bool should_render_depth(const Options& options) {
|
|
542
|
+
const std::vector<std::string> tokens = split_settings(options.settings);
|
|
543
|
+
return tokens.empty() || contains_token(tokens, "all") || contains_token(tokens, "depth");
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
static bool read_json_file(const std::string& path, json& out) {
|
|
547
|
+
std::ifstream f(path);
|
|
548
|
+
if(!f) {
|
|
549
|
+
std::cerr << "Failed to open trace JSON: " << path << std::endl;
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
try {
|
|
553
|
+
f >> out;
|
|
554
|
+
}
|
|
555
|
+
catch(const std::exception& e) {
|
|
556
|
+
std::cerr << "Failed to parse trace JSON: " << e.what() << std::endl;
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
return true;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
static bool read_vec3(const json& value, T out[3]) {
|
|
563
|
+
if(!value.is_array() || value.size() != 3) {
|
|
564
|
+
return false;
|
|
565
|
+
}
|
|
566
|
+
for(int i = 0; i < 3; i++) {
|
|
567
|
+
if(!value[i].is_number()) {
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
out[i] = value[i].get<T>();
|
|
571
|
+
}
|
|
572
|
+
return true;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
static void normalize(T v[3]) {
|
|
576
|
+
const T norm = std::sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
|
|
577
|
+
if(norm < static_cast<T>(1e-6)) {
|
|
578
|
+
v[0] = static_cast<T>(1);
|
|
579
|
+
v[1] = static_cast<T>(0);
|
|
580
|
+
v[2] = static_cast<T>(0);
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
v[0] /= norm;
|
|
584
|
+
v[1] /= norm;
|
|
585
|
+
v[2] /= norm;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
static double wrap_angle_delta(double delta) {
|
|
589
|
+
constexpr double two_pi = 2.0 * 3.14159265358979323846;
|
|
590
|
+
delta = std::fmod(delta + 3.14159265358979323846, two_pi);
|
|
591
|
+
if(delta < 0.0) {
|
|
592
|
+
delta += two_pi;
|
|
593
|
+
}
|
|
594
|
+
return delta - 3.14159265358979323846;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
static void set_pose_yaw_pitch(TracePose& pose, double yaw, double pitch) {
|
|
598
|
+
pose.yaw = yaw;
|
|
599
|
+
pose.pitch = pitch;
|
|
600
|
+
pose.has_yaw_pitch = true;
|
|
601
|
+
pose.up[0] = static_cast<T>(0);
|
|
602
|
+
pose.up[1] = static_cast<T>(0);
|
|
603
|
+
pose.up[2] = static_cast<T>(1);
|
|
604
|
+
pose.look_at[0] = pose.eye[0] + static_cast<T>(std::cos(yaw) * std::cos(pitch));
|
|
605
|
+
pose.look_at[1] = pose.eye[1] + static_cast<T>(std::sin(yaw) * std::cos(pitch));
|
|
606
|
+
pose.look_at[2] = pose.eye[2] + static_cast<T>(std::sin(pitch));
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
static bool parse_pose(const json& pose_json, TracePose& pose) {
|
|
610
|
+
const json* source = &pose_json;
|
|
611
|
+
pose.timestamp_s = 0.0;
|
|
612
|
+
pose.has_timestamp = false;
|
|
613
|
+
pose.has_yaw_pitch = false;
|
|
614
|
+
if(pose_json.contains("timestamp_s") && pose_json["timestamp_s"].is_number()) {
|
|
615
|
+
pose.timestamp_s = pose_json["timestamp_s"].get<double>();
|
|
616
|
+
pose.has_timestamp = true;
|
|
617
|
+
}
|
|
618
|
+
if(pose_json.contains("renderer") && pose_json["renderer"].is_object()) {
|
|
619
|
+
source = &pose_json["renderer"];
|
|
620
|
+
}
|
|
621
|
+
if(!pose.has_timestamp && source->contains("timestamp_s") && (*source)["timestamp_s"].is_number()) {
|
|
622
|
+
pose.timestamp_s = (*source)["timestamp_s"].get<double>();
|
|
623
|
+
pose.has_timestamp = true;
|
|
624
|
+
}
|
|
625
|
+
if(!source->contains("position") || !read_vec3((*source)["position"], pose.eye)) {
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
628
|
+
if(source->contains("yaw") && source->contains("pitch") && (*source)["yaw"].is_number() && (*source)["pitch"].is_number()) {
|
|
629
|
+
pose.yaw = (*source)["yaw"].get<double>();
|
|
630
|
+
pose.pitch = (*source)["pitch"].get<double>();
|
|
631
|
+
pose.has_yaw_pitch = true;
|
|
632
|
+
}
|
|
633
|
+
if(source->contains("up")) {
|
|
634
|
+
if(!read_vec3((*source)["up"], pose.up)) {
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
pose.up[0] = static_cast<T>(0);
|
|
640
|
+
pose.up[1] = static_cast<T>(0);
|
|
641
|
+
pose.up[2] = static_cast<T>(1);
|
|
642
|
+
}
|
|
643
|
+
if(source->contains("look_at")) {
|
|
644
|
+
return read_vec3((*source)["look_at"], pose.look_at);
|
|
645
|
+
}
|
|
646
|
+
if(source->contains("forward")) {
|
|
647
|
+
T forward[3];
|
|
648
|
+
if(!read_vec3((*source)["forward"], forward)) {
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
normalize(forward);
|
|
652
|
+
pose.look_at[0] = pose.eye[0] + forward[0];
|
|
653
|
+
pose.look_at[1] = pose.eye[1] + forward[1];
|
|
654
|
+
pose.look_at[2] = pose.eye[2] + forward[2];
|
|
655
|
+
return true;
|
|
656
|
+
}
|
|
657
|
+
if(source->contains("yaw") && source->contains("pitch") && (*source)["yaw"].is_number() && (*source)["pitch"].is_number()) {
|
|
658
|
+
set_pose_yaw_pitch(pose, pose.yaw, pose.pitch);
|
|
659
|
+
return true;
|
|
660
|
+
}
|
|
661
|
+
return false;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
static bool load_trace(const Options& options, std::string& scene_path, std::vector<TracePose>& poses) {
|
|
665
|
+
json trace_json;
|
|
666
|
+
if(!read_json_file(options.trace_path, trace_json)) {
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
669
|
+
scene_path = options.scene_path;
|
|
670
|
+
if(scene_path.empty() && trace_json.contains("scene_path") && trace_json["scene_path"].is_string()) {
|
|
671
|
+
scene_path = trace_json["scene_path"].get<std::string>();
|
|
672
|
+
}
|
|
673
|
+
if(scene_path.empty()) {
|
|
674
|
+
std::cerr << "Trace JSON has no scene_path; pass --scene <path>" << std::endl;
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
if(trace_json.contains("poses") && trace_json["poses"].is_array()) {
|
|
679
|
+
for(const json& item : trace_json["poses"]) {
|
|
680
|
+
TracePose pose;
|
|
681
|
+
if(!parse_pose(item, pose)) {
|
|
682
|
+
std::cerr << "Invalid pose entry in trace JSON" << std::endl;
|
|
683
|
+
return false;
|
|
684
|
+
}
|
|
685
|
+
poses.push_back(pose);
|
|
686
|
+
if(options.max_frames > 0 && static_cast<int>(poses.size()) >= options.max_frames) {
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
TracePose pose;
|
|
693
|
+
if(!parse_pose(trace_json, pose)) {
|
|
694
|
+
std::cerr << "Trace JSON is neither a valid single pose nor a trace with poses[]" << std::endl;
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
poses.push_back(pose);
|
|
698
|
+
}
|
|
699
|
+
if(poses.empty()) {
|
|
700
|
+
std::cerr << "Trace contains no poses" << std::endl;
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
return true;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
static T lerp_scalar(T a, T b, double t) {
|
|
707
|
+
return static_cast<T>(static_cast<double>(a) + (static_cast<double>(b) - static_cast<double>(a)) * t);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
static void lerp_vec3(const T a[3], const T b[3], double t, T out[3]) {
|
|
711
|
+
out[0] = lerp_scalar(a[0], b[0], t);
|
|
712
|
+
out[1] = lerp_scalar(a[1], b[1], t);
|
|
713
|
+
out[2] = lerp_scalar(a[2], b[2], t);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
static void pose_forward(const TracePose& pose, T out[3]) {
|
|
717
|
+
out[0] = pose.look_at[0] - pose.eye[0];
|
|
718
|
+
out[1] = pose.look_at[1] - pose.eye[1];
|
|
719
|
+
out[2] = pose.look_at[2] - pose.eye[2];
|
|
720
|
+
normalize(out);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
static double dot_vec3(const T a[3], const T b[3]) {
|
|
724
|
+
return static_cast<double>(a[0]) * static_cast<double>(b[0])
|
|
725
|
+
+ static_cast<double>(a[1]) * static_cast<double>(b[1])
|
|
726
|
+
+ static_cast<double>(a[2]) * static_cast<double>(b[2]);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
static bool normalize_vec3_checked(T v[3]) {
|
|
730
|
+
const double norm = std::sqrt(dot_vec3(v, v));
|
|
731
|
+
if(norm < 1e-9) {
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
734
|
+
v[0] = static_cast<T>(static_cast<double>(v[0]) / norm);
|
|
735
|
+
v[1] = static_cast<T>(static_cast<double>(v[1]) / norm);
|
|
736
|
+
v[2] = static_cast<T>(static_cast<double>(v[2]) / norm);
|
|
737
|
+
return true;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
static void slerp_unit_vec3(const T a_in[3], const T b_in[3], double t, T out[3]) {
|
|
741
|
+
T a[3] = {a_in[0], a_in[1], a_in[2]};
|
|
742
|
+
T b[3] = {b_in[0], b_in[1], b_in[2]};
|
|
743
|
+
if(!normalize_vec3_checked(a)) {
|
|
744
|
+
a[0] = static_cast<T>(1);
|
|
745
|
+
a[1] = static_cast<T>(0);
|
|
746
|
+
a[2] = static_cast<T>(0);
|
|
747
|
+
}
|
|
748
|
+
if(!normalize_vec3_checked(b)) {
|
|
749
|
+
b[0] = a[0];
|
|
750
|
+
b[1] = a[1];
|
|
751
|
+
b[2] = a[2];
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
double d = dot_vec3(a, b);
|
|
755
|
+
d = std::min(std::max(d, -1.0), 1.0);
|
|
756
|
+
if(d > 0.9995) {
|
|
757
|
+
lerp_vec3(a, b, t, out);
|
|
758
|
+
normalize(out);
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if(d < -0.9995) {
|
|
762
|
+
T ortho[3] = {-a[1], a[0], static_cast<T>(0)};
|
|
763
|
+
if(!normalize_vec3_checked(ortho)) {
|
|
764
|
+
ortho[0] = -a[2];
|
|
765
|
+
ortho[1] = static_cast<T>(0);
|
|
766
|
+
ortho[2] = a[0];
|
|
767
|
+
normalize_vec3_checked(ortho);
|
|
768
|
+
}
|
|
769
|
+
const double angle = 3.14159265358979323846 * t;
|
|
770
|
+
const double ca = std::cos(angle);
|
|
771
|
+
const double sa = std::sin(angle);
|
|
772
|
+
for(int i = 0; i < 3; i++) {
|
|
773
|
+
out[i] = static_cast<T>(ca * static_cast<double>(a[i]) + sa * static_cast<double>(ortho[i]));
|
|
774
|
+
}
|
|
775
|
+
normalize(out);
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
const double theta = std::acos(d);
|
|
780
|
+
const double sin_theta = std::sin(theta);
|
|
781
|
+
const double wa = std::sin((1.0 - t) * theta) / sin_theta;
|
|
782
|
+
const double wb = std::sin(t * theta) / sin_theta;
|
|
783
|
+
for(int i = 0; i < 3; i++) {
|
|
784
|
+
out[i] = static_cast<T>(wa * static_cast<double>(a[i]) + wb * static_cast<double>(b[i]));
|
|
785
|
+
}
|
|
786
|
+
normalize(out);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
static void orthonormalize_up_for_forward(const T forward[3], const T preferred_up[3], T up[3]) {
|
|
790
|
+
up[0] = preferred_up[0];
|
|
791
|
+
up[1] = preferred_up[1];
|
|
792
|
+
up[2] = preferred_up[2];
|
|
793
|
+
const double projection = dot_vec3(up, forward);
|
|
794
|
+
for(int i = 0; i < 3; i++) {
|
|
795
|
+
up[i] = static_cast<T>(static_cast<double>(up[i]) - projection * static_cast<double>(forward[i]));
|
|
796
|
+
}
|
|
797
|
+
if(normalize_vec3_checked(up)) {
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
T fallback[3] = {static_cast<T>(0), static_cast<T>(0), static_cast<T>(1)};
|
|
801
|
+
if(std::fabs(dot_vec3(fallback, forward)) > 0.95) {
|
|
802
|
+
fallback[0] = static_cast<T>(0);
|
|
803
|
+
fallback[1] = static_cast<T>(1);
|
|
804
|
+
fallback[2] = static_cast<T>(0);
|
|
805
|
+
}
|
|
806
|
+
const double fallback_projection = dot_vec3(fallback, forward);
|
|
807
|
+
for(int i = 0; i < 3; i++) {
|
|
808
|
+
up[i] = static_cast<T>(static_cast<double>(fallback[i]) - fallback_projection * static_cast<double>(forward[i]));
|
|
809
|
+
}
|
|
810
|
+
normalize(up);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
static TracePose interpolate_pose(const TracePose& a, const TracePose& b, double timestamp_s) {
|
|
814
|
+
const double duration = b.timestamp_s - a.timestamp_s;
|
|
815
|
+
const double t = duration > 0.0 ? std::min(std::max((timestamp_s - a.timestamp_s) / duration, 0.0), 1.0) : 0.0;
|
|
816
|
+
|
|
817
|
+
TracePose out;
|
|
818
|
+
lerp_vec3(a.eye, b.eye, t, out.eye);
|
|
819
|
+
|
|
820
|
+
if(a.has_yaw_pitch && b.has_yaw_pitch) {
|
|
821
|
+
const double yaw = a.yaw + wrap_angle_delta(b.yaw - a.yaw) * t;
|
|
822
|
+
const double pitch = static_cast<double>(a.pitch) + (static_cast<double>(b.pitch) - static_cast<double>(a.pitch)) * t;
|
|
823
|
+
set_pose_yaw_pitch(out, yaw, pitch);
|
|
824
|
+
out.timestamp_s = timestamp_s;
|
|
825
|
+
out.has_timestamp = true;
|
|
826
|
+
return out;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
T forward_a[3];
|
|
830
|
+
T forward_b[3];
|
|
831
|
+
T forward[3];
|
|
832
|
+
pose_forward(a, forward_a);
|
|
833
|
+
pose_forward(b, forward_b);
|
|
834
|
+
slerp_unit_vec3(forward_a, forward_b, t, forward);
|
|
835
|
+
|
|
836
|
+
T up_preferred[3];
|
|
837
|
+
slerp_unit_vec3(a.up, b.up, t, up_preferred);
|
|
838
|
+
orthonormalize_up_for_forward(forward, up_preferred, out.up);
|
|
839
|
+
|
|
840
|
+
out.look_at[0] = out.eye[0] + forward[0];
|
|
841
|
+
out.look_at[1] = out.eye[1] + forward[1];
|
|
842
|
+
out.look_at[2] = out.eye[2] + forward[2];
|
|
843
|
+
out.timestamp_s = timestamp_s;
|
|
844
|
+
out.has_timestamp = true;
|
|
845
|
+
return out;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
static bool trace_timestamp_stats(const std::vector<TracePose>& poses, double& duration_s, double& implied_fps) {
|
|
849
|
+
duration_s = 0.0;
|
|
850
|
+
implied_fps = 0.0;
|
|
851
|
+
if(poses.size() < 2) {
|
|
852
|
+
return false;
|
|
853
|
+
}
|
|
854
|
+
for(size_t i = 0; i < poses.size(); i++) {
|
|
855
|
+
if(!poses[i].has_timestamp || !std::isfinite(poses[i].timestamp_s)) {
|
|
856
|
+
return false;
|
|
857
|
+
}
|
|
858
|
+
if(i > 0 && poses[i].timestamp_s <= poses[i - 1].timestamp_s) {
|
|
859
|
+
return false;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
duration_s = poses.back().timestamp_s - poses.front().timestamp_s;
|
|
863
|
+
if(duration_s <= 0.0) {
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
implied_fps = static_cast<double>(poses.size() - 1) / duration_s;
|
|
867
|
+
return true;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
static std::vector<TracePose> resample_trace(const std::vector<TracePose>& source, int fps, double& duration_s, double& implied_fps, bool& timestamp_resampled) {
|
|
871
|
+
timestamp_resampled = false;
|
|
872
|
+
if(!trace_timestamp_stats(source, duration_s, implied_fps)) {
|
|
873
|
+
return source;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
const size_t output_frames = std::max<size_t>(1, static_cast<size_t>(std::ceil(duration_s * static_cast<double>(fps))));
|
|
877
|
+
std::vector<TracePose> resampled;
|
|
878
|
+
resampled.reserve(output_frames);
|
|
879
|
+
|
|
880
|
+
size_t segment = 0;
|
|
881
|
+
const double start_s = source.front().timestamp_s;
|
|
882
|
+
for(size_t frame_i = 0; frame_i < output_frames; frame_i++) {
|
|
883
|
+
const double target_s = std::min(start_s + static_cast<double>(frame_i) / static_cast<double>(fps), source.back().timestamp_s);
|
|
884
|
+
while(segment + 1 < source.size() && source[segment + 1].timestamp_s < target_s) {
|
|
885
|
+
segment++;
|
|
886
|
+
}
|
|
887
|
+
if(segment + 1 >= source.size()) {
|
|
888
|
+
resampled.push_back(source.back());
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
resampled.push_back(interpolate_pose(source[segment], source[segment + 1], target_s));
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
timestamp_resampled = true;
|
|
895
|
+
return resampled;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
struct Quaternion {
|
|
899
|
+
double w = 1.0;
|
|
900
|
+
double x = 0.0;
|
|
901
|
+
double y = 0.0;
|
|
902
|
+
double z = 0.0;
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
static double dot_quaternion(const Quaternion& a, const Quaternion& b) {
|
|
906
|
+
return a.w * b.w + a.x * b.x + a.y * b.y + a.z * b.z;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
static Quaternion negate_quaternion(const Quaternion& q) {
|
|
910
|
+
Quaternion out;
|
|
911
|
+
out.w = -q.w;
|
|
912
|
+
out.x = -q.x;
|
|
913
|
+
out.y = -q.y;
|
|
914
|
+
out.z = -q.z;
|
|
915
|
+
return out;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
static Quaternion normalize_quaternion(const Quaternion& q) {
|
|
919
|
+
const double norm = std::sqrt(dot_quaternion(q, q));
|
|
920
|
+
if(norm < 1e-12) {
|
|
921
|
+
return Quaternion{};
|
|
922
|
+
}
|
|
923
|
+
Quaternion out;
|
|
924
|
+
out.w = q.w / norm;
|
|
925
|
+
out.x = q.x / norm;
|
|
926
|
+
out.y = q.y / norm;
|
|
927
|
+
out.z = q.z / norm;
|
|
928
|
+
return out;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
static double quaternion_angle(const Quaternion& a, const Quaternion& b) {
|
|
932
|
+
const Quaternion an = normalize_quaternion(a);
|
|
933
|
+
const Quaternion bn = normalize_quaternion(b);
|
|
934
|
+
double d = std::fabs(dot_quaternion(an, bn));
|
|
935
|
+
d = std::min(std::max(d, -1.0), 1.0);
|
|
936
|
+
return 2.0 * std::acos(d);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
static Quaternion slerp_quaternion(const Quaternion& a_in, const Quaternion& b_in, double t) {
|
|
940
|
+
Quaternion a = normalize_quaternion(a_in);
|
|
941
|
+
Quaternion b = normalize_quaternion(b_in);
|
|
942
|
+
double d = dot_quaternion(a, b);
|
|
943
|
+
if(d < 0.0) {
|
|
944
|
+
b = negate_quaternion(b);
|
|
945
|
+
d = -d;
|
|
946
|
+
}
|
|
947
|
+
d = std::min(std::max(d, -1.0), 1.0);
|
|
948
|
+
if(d > 0.9995) {
|
|
949
|
+
Quaternion out;
|
|
950
|
+
out.w = a.w + (b.w - a.w) * t;
|
|
951
|
+
out.x = a.x + (b.x - a.x) * t;
|
|
952
|
+
out.y = a.y + (b.y - a.y) * t;
|
|
953
|
+
out.z = a.z + (b.z - a.z) * t;
|
|
954
|
+
return normalize_quaternion(out);
|
|
955
|
+
}
|
|
956
|
+
const double theta = std::acos(d);
|
|
957
|
+
const double sin_theta = std::sin(theta);
|
|
958
|
+
const double wa = std::sin((1.0 - t) * theta) / sin_theta;
|
|
959
|
+
const double wb = std::sin(t * theta) / sin_theta;
|
|
960
|
+
Quaternion out;
|
|
961
|
+
out.w = wa * a.w + wb * b.w;
|
|
962
|
+
out.x = wa * a.x + wb * b.x;
|
|
963
|
+
out.y = wa * a.y + wb * b.y;
|
|
964
|
+
out.z = wa * a.z + wb * b.z;
|
|
965
|
+
return normalize_quaternion(out);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
static void cross3(const T a[3], const T b[3], T out[3]) {
|
|
969
|
+
out[0] = a[1] * b[2] - a[2] * b[1];
|
|
970
|
+
out[1] = a[2] * b[0] - a[0] * b[2];
|
|
971
|
+
out[2] = a[0] * b[1] - a[1] * b[0];
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
static double norm3(const T v[3]) {
|
|
975
|
+
return std::sqrt(static_cast<double>(v[0]) * static_cast<double>(v[0]) + static_cast<double>(v[1]) * static_cast<double>(v[1]) + static_cast<double>(v[2]) * static_cast<double>(v[2]));
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
static bool normalize3(T v[3]) {
|
|
979
|
+
const double norm = norm3(v);
|
|
980
|
+
if(norm < 1e-9) {
|
|
981
|
+
return false;
|
|
982
|
+
}
|
|
983
|
+
v[0] = static_cast<T>(static_cast<double>(v[0]) / norm);
|
|
984
|
+
v[1] = static_cast<T>(static_cast<double>(v[1]) / norm);
|
|
985
|
+
v[2] = static_cast<T>(static_cast<double>(v[2]) / norm);
|
|
986
|
+
return true;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
static void pose_basis(const TracePose& pose, T forward[3], T left[3], T up[3]) {
|
|
990
|
+
pose_forward(pose, forward);
|
|
991
|
+
up[0] = pose.up[0];
|
|
992
|
+
up[1] = pose.up[1];
|
|
993
|
+
up[2] = pose.up[2];
|
|
994
|
+
if(!normalize3(up)) {
|
|
995
|
+
up[0] = static_cast<T>(0);
|
|
996
|
+
up[1] = static_cast<T>(0);
|
|
997
|
+
up[2] = static_cast<T>(1);
|
|
998
|
+
}
|
|
999
|
+
cross3(up, forward, left);
|
|
1000
|
+
if(!normalize3(left)) {
|
|
1001
|
+
T reference_up[3] = {static_cast<T>(0), static_cast<T>(0), static_cast<T>(1)};
|
|
1002
|
+
cross3(reference_up, forward, left);
|
|
1003
|
+
if(!normalize3(left)) {
|
|
1004
|
+
reference_up[0] = static_cast<T>(0);
|
|
1005
|
+
reference_up[1] = static_cast<T>(1);
|
|
1006
|
+
reference_up[2] = static_cast<T>(0);
|
|
1007
|
+
cross3(reference_up, forward, left);
|
|
1008
|
+
normalize3(left);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
cross3(forward, left, up);
|
|
1012
|
+
normalize3(up);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
static Quaternion quaternion_from_basis(const T forward[3], const T left[3], const T up[3]) {
|
|
1016
|
+
const double m00 = forward[0];
|
|
1017
|
+
const double m01 = left[0];
|
|
1018
|
+
const double m02 = up[0];
|
|
1019
|
+
const double m10 = forward[1];
|
|
1020
|
+
const double m11 = left[1];
|
|
1021
|
+
const double m12 = up[1];
|
|
1022
|
+
const double m20 = forward[2];
|
|
1023
|
+
const double m21 = left[2];
|
|
1024
|
+
const double m22 = up[2];
|
|
1025
|
+
Quaternion q;
|
|
1026
|
+
const double trace = m00 + m11 + m22;
|
|
1027
|
+
if(trace > 0.0) {
|
|
1028
|
+
const double s = std::sqrt(trace + 1.0) * 2.0;
|
|
1029
|
+
q.w = 0.25 * s;
|
|
1030
|
+
q.x = (m21 - m12) / s;
|
|
1031
|
+
q.y = (m02 - m20) / s;
|
|
1032
|
+
q.z = (m10 - m01) / s;
|
|
1033
|
+
}
|
|
1034
|
+
else if(m00 > m11 && m00 > m22) {
|
|
1035
|
+
const double s = std::sqrt(1.0 + m00 - m11 - m22) * 2.0;
|
|
1036
|
+
q.w = (m21 - m12) / s;
|
|
1037
|
+
q.x = 0.25 * s;
|
|
1038
|
+
q.y = (m01 + m10) / s;
|
|
1039
|
+
q.z = (m02 + m20) / s;
|
|
1040
|
+
}
|
|
1041
|
+
else if(m11 > m22) {
|
|
1042
|
+
const double s = std::sqrt(1.0 + m11 - m00 - m22) * 2.0;
|
|
1043
|
+
q.w = (m02 - m20) / s;
|
|
1044
|
+
q.x = (m01 + m10) / s;
|
|
1045
|
+
q.y = 0.25 * s;
|
|
1046
|
+
q.z = (m12 + m21) / s;
|
|
1047
|
+
}
|
|
1048
|
+
else {
|
|
1049
|
+
const double s = std::sqrt(1.0 + m22 - m00 - m11) * 2.0;
|
|
1050
|
+
q.w = (m10 - m01) / s;
|
|
1051
|
+
q.x = (m02 + m20) / s;
|
|
1052
|
+
q.y = (m12 + m21) / s;
|
|
1053
|
+
q.z = 0.25 * s;
|
|
1054
|
+
}
|
|
1055
|
+
return normalize_quaternion(q);
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
static Quaternion pose_quaternion(const TracePose& pose) {
|
|
1059
|
+
T forward[3];
|
|
1060
|
+
T left[3];
|
|
1061
|
+
T up[3];
|
|
1062
|
+
pose_basis(pose, forward, left, up);
|
|
1063
|
+
return quaternion_from_basis(forward, left, up);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
static void quaternion_to_forward_up(const Quaternion& q_in, T forward[3], T up[3]) {
|
|
1067
|
+
const Quaternion q = normalize_quaternion(q_in);
|
|
1068
|
+
const double xx = q.x * q.x;
|
|
1069
|
+
const double yy = q.y * q.y;
|
|
1070
|
+
const double zz = q.z * q.z;
|
|
1071
|
+
const double xy = q.x * q.y;
|
|
1072
|
+
const double xz = q.x * q.z;
|
|
1073
|
+
const double yz = q.y * q.z;
|
|
1074
|
+
const double wx = q.w * q.x;
|
|
1075
|
+
const double wy = q.w * q.y;
|
|
1076
|
+
const double wz = q.w * q.z;
|
|
1077
|
+
|
|
1078
|
+
forward[0] = static_cast<T>(1.0 - 2.0 * (yy + zz));
|
|
1079
|
+
forward[1] = static_cast<T>(2.0 * (xy + wz));
|
|
1080
|
+
forward[2] = static_cast<T>(2.0 * (xz - wy));
|
|
1081
|
+
|
|
1082
|
+
up[0] = static_cast<T>(2.0 * (xz + wy));
|
|
1083
|
+
up[1] = static_cast<T>(2.0 * (yz - wx));
|
|
1084
|
+
up[2] = static_cast<T>(1.0 - 2.0 * (xx + yy));
|
|
1085
|
+
normalize(forward);
|
|
1086
|
+
normalize(up);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
static std::vector<double> smoothing_times(const std::vector<TracePose>& poses, int fps) {
|
|
1090
|
+
double duration_s = 0.0;
|
|
1091
|
+
double implied_fps = 0.0;
|
|
1092
|
+
const bool use_trace_timestamps = trace_timestamp_stats(poses, duration_s, implied_fps);
|
|
1093
|
+
std::vector<double> times;
|
|
1094
|
+
times.reserve(poses.size());
|
|
1095
|
+
for(size_t i = 0; i < poses.size(); i++) {
|
|
1096
|
+
times.push_back(use_trace_timestamps ? poses[i].timestamp_s : static_cast<double>(i) / static_cast<double>(fps));
|
|
1097
|
+
}
|
|
1098
|
+
return times;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
static double gaussian_weight(double dt, double sigma_s) {
|
|
1102
|
+
const double x = dt / sigma_s;
|
|
1103
|
+
return std::exp(-0.5 * x * x);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
static bool trace_has_yaw_pitch(const std::vector<TracePose>& poses) {
|
|
1107
|
+
if(poses.empty()) {
|
|
1108
|
+
return false;
|
|
1109
|
+
}
|
|
1110
|
+
for(const TracePose& pose : poses) {
|
|
1111
|
+
if(!pose.has_yaw_pitch || !std::isfinite(pose.yaw) || !std::isfinite(pose.pitch)) {
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
return true;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
static std::vector<double> gaussian_smooth_scalar(const std::vector<double>& values, const std::vector<double>& times, double sigma_s) {
|
|
1119
|
+
if(sigma_s <= 0.0 || values.size() < 2) {
|
|
1120
|
+
return values;
|
|
1121
|
+
}
|
|
1122
|
+
std::vector<double> output(values.size());
|
|
1123
|
+
const double radius_s = 3.0 * sigma_s;
|
|
1124
|
+
for(size_t i = 0; i < values.size(); i++) {
|
|
1125
|
+
const auto begin_it = std::lower_bound(times.begin(), times.end(), times[i] - radius_s);
|
|
1126
|
+
const auto end_it = std::upper_bound(times.begin(), times.end(), times[i] + radius_s);
|
|
1127
|
+
const size_t begin = static_cast<size_t>(begin_it - times.begin());
|
|
1128
|
+
const size_t end = static_cast<size_t>(end_it - times.begin());
|
|
1129
|
+
double sum_w = 0.0;
|
|
1130
|
+
double sum = 0.0;
|
|
1131
|
+
for(size_t j = begin; j < end; j++) {
|
|
1132
|
+
const double w = gaussian_weight(times[j] - times[i], sigma_s);
|
|
1133
|
+
sum_w += w;
|
|
1134
|
+
sum += w * values[j];
|
|
1135
|
+
}
|
|
1136
|
+
output[i] = sum_w > 0.0 ? sum / sum_w : values[i];
|
|
1137
|
+
}
|
|
1138
|
+
return output;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
static void limit_yaw_pitch_speed(const std::vector<double>& input_yaw, const std::vector<double>& input_pitch, const std::vector<double>& times, double max_speed_rad_s, double ramp_multiplier, std::vector<double>& yaw, std::vector<double>& pitch) {
|
|
1142
|
+
yaw = input_yaw;
|
|
1143
|
+
pitch = input_pitch;
|
|
1144
|
+
if(max_speed_rad_s <= 0.0 || yaw.size() < 2) {
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
const double ramp_scale = std::max(ramp_multiplier, 1.0);
|
|
1148
|
+
bool ramping = false;
|
|
1149
|
+
for(size_t i = 1; i < yaw.size(); i++) {
|
|
1150
|
+
double dt = times[i] - times[i - 1];
|
|
1151
|
+
if(dt <= 1e-6 || !std::isfinite(dt)) {
|
|
1152
|
+
dt = 1.0 / 30.0;
|
|
1153
|
+
}
|
|
1154
|
+
const double trigger_angle = max_speed_rad_s * dt;
|
|
1155
|
+
const double ramp_angle = trigger_angle / ramp_scale;
|
|
1156
|
+
const double input_delta_yaw = input_yaw[i] - input_yaw[i - 1];
|
|
1157
|
+
const double input_delta_pitch = input_pitch[i] - input_pitch[i - 1];
|
|
1158
|
+
const double input_angle = std::sqrt(input_delta_yaw * input_delta_yaw + input_delta_pitch * input_delta_pitch);
|
|
1159
|
+
const double target_delta_yaw = input_yaw[i] - yaw[i - 1];
|
|
1160
|
+
const double target_delta_pitch = input_pitch[i] - pitch[i - 1];
|
|
1161
|
+
const double target_angle = std::sqrt(target_delta_yaw * target_delta_yaw + target_delta_pitch * target_delta_pitch);
|
|
1162
|
+
if(ramping || input_angle > trigger_angle) {
|
|
1163
|
+
if(ramp_angle > 0.0 && target_angle > ramp_angle) {
|
|
1164
|
+
const double alpha = ramp_angle / target_angle;
|
|
1165
|
+
yaw[i] = yaw[i - 1] + target_delta_yaw * alpha;
|
|
1166
|
+
pitch[i] = pitch[i - 1] + target_delta_pitch * alpha;
|
|
1167
|
+
ramping = true;
|
|
1168
|
+
}
|
|
1169
|
+
else {
|
|
1170
|
+
yaw[i] = input_yaw[i];
|
|
1171
|
+
pitch[i] = input_pitch[i];
|
|
1172
|
+
ramping = false;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
static std::vector<TracePose> filter_yaw_pitch_trace(const std::vector<TracePose>& input, const Options& options, bool& yaw_pitch_filter_applied) {
|
|
1179
|
+
const bool filter_requested = options.max_orientation_speed_rad_s > 0.0;
|
|
1180
|
+
yaw_pitch_filter_applied = false;
|
|
1181
|
+
if(!filter_requested || input.size() < 2 || !trace_has_yaw_pitch(input)) {
|
|
1182
|
+
return input;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
const std::vector<double> times = smoothing_times(input, options.fps);
|
|
1186
|
+
std::vector<double> input_yaw(input.size());
|
|
1187
|
+
std::vector<double> input_pitch(input.size());
|
|
1188
|
+
input_yaw[0] = input[0].yaw;
|
|
1189
|
+
input_pitch[0] = input[0].pitch;
|
|
1190
|
+
for(size_t i = 1; i < input.size(); i++) {
|
|
1191
|
+
input_yaw[i] = input_yaw[i - 1] + wrap_angle_delta(input[i].yaw - input[i - 1].yaw);
|
|
1192
|
+
input_pitch[i] = input[i].pitch;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
std::vector<double> yaw;
|
|
1196
|
+
std::vector<double> pitch;
|
|
1197
|
+
limit_yaw_pitch_speed(
|
|
1198
|
+
input_yaw,
|
|
1199
|
+
input_pitch,
|
|
1200
|
+
times,
|
|
1201
|
+
options.max_orientation_speed_rad_s,
|
|
1202
|
+
options.orientation_jump_ramp_multiplier,
|
|
1203
|
+
yaw,
|
|
1204
|
+
pitch
|
|
1205
|
+
);
|
|
1206
|
+
|
|
1207
|
+
std::vector<TracePose> output = input;
|
|
1208
|
+
for(size_t i = 0; i < output.size(); i++) {
|
|
1209
|
+
set_pose_yaw_pitch(output[i], yaw[i], pitch[i]);
|
|
1210
|
+
}
|
|
1211
|
+
yaw_pitch_filter_applied = true;
|
|
1212
|
+
return output;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
static std::vector<Quaternion> pose_quaternions_continuous(const std::vector<TracePose>& poses) {
|
|
1216
|
+
std::vector<Quaternion> quaternions;
|
|
1217
|
+
quaternions.reserve(poses.size());
|
|
1218
|
+
for(const TracePose& pose : poses) {
|
|
1219
|
+
Quaternion q = pose_quaternion(pose);
|
|
1220
|
+
if(!quaternions.empty() && dot_quaternion(q, quaternions.back()) < 0.0) {
|
|
1221
|
+
q = negate_quaternion(q);
|
|
1222
|
+
}
|
|
1223
|
+
quaternions.push_back(q);
|
|
1224
|
+
}
|
|
1225
|
+
return quaternions;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
static void smooth_position_at(const std::vector<TracePose>& input, const std::vector<double>& times, size_t i, double sigma_s, T eye[3]) {
|
|
1229
|
+
const double radius_s = 3.0 * sigma_s;
|
|
1230
|
+
const auto begin_it = std::lower_bound(times.begin(), times.end(), times[i] - radius_s);
|
|
1231
|
+
const auto end_it = std::upper_bound(times.begin(), times.end(), times[i] + radius_s);
|
|
1232
|
+
const size_t begin = static_cast<size_t>(begin_it - times.begin());
|
|
1233
|
+
const size_t end = static_cast<size_t>(end_it - times.begin());
|
|
1234
|
+
double sum_w = 0.0;
|
|
1235
|
+
double sum[3] = {0.0, 0.0, 0.0};
|
|
1236
|
+
for(size_t j = begin; j < end; j++) {
|
|
1237
|
+
const double w = gaussian_weight(times[j] - times[i], sigma_s);
|
|
1238
|
+
sum_w += w;
|
|
1239
|
+
sum[0] += w * static_cast<double>(input[j].eye[0]);
|
|
1240
|
+
sum[1] += w * static_cast<double>(input[j].eye[1]);
|
|
1241
|
+
sum[2] += w * static_cast<double>(input[j].eye[2]);
|
|
1242
|
+
}
|
|
1243
|
+
if(sum_w <= 0.0) {
|
|
1244
|
+
eye[0] = input[i].eye[0];
|
|
1245
|
+
eye[1] = input[i].eye[1];
|
|
1246
|
+
eye[2] = input[i].eye[2];
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
eye[0] = static_cast<T>(sum[0] / sum_w);
|
|
1250
|
+
eye[1] = static_cast<T>(sum[1] / sum_w);
|
|
1251
|
+
eye[2] = static_cast<T>(sum[2] / sum_w);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
static Quaternion smooth_orientation_at(const std::vector<Quaternion>& quaternions, const std::vector<double>& times, size_t i, double sigma_s) {
|
|
1255
|
+
const double radius_s = 3.0 * sigma_s;
|
|
1256
|
+
const auto begin_it = std::lower_bound(times.begin(), times.end(), times[i] - radius_s);
|
|
1257
|
+
const auto end_it = std::upper_bound(times.begin(), times.end(), times[i] + radius_s);
|
|
1258
|
+
const size_t begin = static_cast<size_t>(begin_it - times.begin());
|
|
1259
|
+
const size_t end = static_cast<size_t>(end_it - times.begin());
|
|
1260
|
+
Quaternion sum;
|
|
1261
|
+
sum.w = 0.0;
|
|
1262
|
+
sum.x = 0.0;
|
|
1263
|
+
sum.y = 0.0;
|
|
1264
|
+
sum.z = 0.0;
|
|
1265
|
+
for(size_t j = begin; j < end; j++) {
|
|
1266
|
+
double w = gaussian_weight(times[j] - times[i], sigma_s);
|
|
1267
|
+
Quaternion q = quaternions[j];
|
|
1268
|
+
if(dot_quaternion(q, quaternions[i]) < 0.0) {
|
|
1269
|
+
q = negate_quaternion(q);
|
|
1270
|
+
}
|
|
1271
|
+
sum.w += w * q.w;
|
|
1272
|
+
sum.x += w * q.x;
|
|
1273
|
+
sum.y += w * q.y;
|
|
1274
|
+
sum.z += w * q.z;
|
|
1275
|
+
}
|
|
1276
|
+
return normalize_quaternion(sum);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
static std::vector<Quaternion> limit_orientation_speed(const std::vector<Quaternion>& input, const std::vector<double>& times, double max_speed_rad_s, double ramp_multiplier) {
|
|
1280
|
+
if(max_speed_rad_s <= 0.0 || input.size() < 2) {
|
|
1281
|
+
return input;
|
|
1282
|
+
}
|
|
1283
|
+
const double ramp_scale = std::max(ramp_multiplier, 1.0);
|
|
1284
|
+
std::vector<Quaternion> output = input;
|
|
1285
|
+
bool ramping = false;
|
|
1286
|
+
for(size_t i = 1; i < output.size(); i++) {
|
|
1287
|
+
double dt = times[i] - times[i - 1];
|
|
1288
|
+
if(dt <= 1e-6 || !std::isfinite(dt)) {
|
|
1289
|
+
dt = 1.0 / 30.0;
|
|
1290
|
+
}
|
|
1291
|
+
const double trigger_angle = max_speed_rad_s * dt;
|
|
1292
|
+
const double ramp_angle = trigger_angle / ramp_scale;
|
|
1293
|
+
const double input_angle = quaternion_angle(input[i - 1], input[i]);
|
|
1294
|
+
const double target_angle = quaternion_angle(output[i - 1], input[i]);
|
|
1295
|
+
if(ramping || input_angle > trigger_angle) {
|
|
1296
|
+
if(ramp_angle > 0.0 && target_angle > ramp_angle) {
|
|
1297
|
+
output[i] = slerp_quaternion(output[i - 1], input[i], ramp_angle / target_angle);
|
|
1298
|
+
ramping = true;
|
|
1299
|
+
}
|
|
1300
|
+
else {
|
|
1301
|
+
output[i] = input[i];
|
|
1302
|
+
ramping = false;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
return output;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
static void set_pose_orientation(TracePose& pose, const Quaternion& q) {
|
|
1310
|
+
T forward[3];
|
|
1311
|
+
T up[3];
|
|
1312
|
+
quaternion_to_forward_up(q, forward, up);
|
|
1313
|
+
pose.up[0] = up[0];
|
|
1314
|
+
pose.up[1] = up[1];
|
|
1315
|
+
pose.up[2] = up[2];
|
|
1316
|
+
pose.look_at[0] = pose.eye[0] + forward[0];
|
|
1317
|
+
pose.look_at[1] = pose.eye[1] + forward[1];
|
|
1318
|
+
pose.look_at[2] = pose.eye[2] + forward[2];
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
static std::vector<TracePose> smooth_trace(const std::vector<TracePose>& input, const Options& options, bool& smoothing_applied, bool source_yaw_pitch_filter_applied) {
|
|
1322
|
+
const bool smoothing_requested = options.smooth_position_sigma_s > 0.0 ||
|
|
1323
|
+
options.smooth_orientation_sigma_s > 0.0 ||
|
|
1324
|
+
(!source_yaw_pitch_filter_applied && options.max_orientation_speed_rad_s > 0.0);
|
|
1325
|
+
smoothing_applied = smoothing_requested && input.size() >= 2;
|
|
1326
|
+
if(!smoothing_applied) {
|
|
1327
|
+
return input;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
const std::vector<double> times = smoothing_times(input, options.fps);
|
|
1331
|
+
std::vector<TracePose> output = input;
|
|
1332
|
+
|
|
1333
|
+
if(options.smooth_position_sigma_s > 0.0) {
|
|
1334
|
+
for(size_t i = 0; i < input.size(); i++) {
|
|
1335
|
+
T forward[3];
|
|
1336
|
+
pose_forward(input[i], forward);
|
|
1337
|
+
smooth_position_at(input, times, i, options.smooth_position_sigma_s, output[i].eye);
|
|
1338
|
+
output[i].look_at[0] = output[i].eye[0] + forward[0];
|
|
1339
|
+
output[i].look_at[1] = output[i].eye[1] + forward[1];
|
|
1340
|
+
output[i].look_at[2] = output[i].eye[2] + forward[2];
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
if(options.smooth_orientation_sigma_s > 0.0 || (!source_yaw_pitch_filter_applied && options.max_orientation_speed_rad_s > 0.0)) {
|
|
1345
|
+
if(trace_has_yaw_pitch(input)) {
|
|
1346
|
+
std::vector<double> input_yaw(input.size());
|
|
1347
|
+
std::vector<double> input_pitch(input.size());
|
|
1348
|
+
input_yaw[0] = input[0].yaw;
|
|
1349
|
+
input_pitch[0] = input[0].pitch;
|
|
1350
|
+
for(size_t i = 1; i < input.size(); i++) {
|
|
1351
|
+
input_yaw[i] = input_yaw[i - 1] + wrap_angle_delta(input[i].yaw - input[i - 1].yaw);
|
|
1352
|
+
input_pitch[i] = input[i].pitch;
|
|
1353
|
+
}
|
|
1354
|
+
std::vector<double> yaw = input_yaw;
|
|
1355
|
+
std::vector<double> pitch = input_pitch;
|
|
1356
|
+
if(!source_yaw_pitch_filter_applied) {
|
|
1357
|
+
limit_yaw_pitch_speed(
|
|
1358
|
+
input_yaw,
|
|
1359
|
+
input_pitch,
|
|
1360
|
+
times,
|
|
1361
|
+
options.max_orientation_speed_rad_s,
|
|
1362
|
+
options.orientation_jump_ramp_multiplier,
|
|
1363
|
+
yaw,
|
|
1364
|
+
pitch
|
|
1365
|
+
);
|
|
1366
|
+
}
|
|
1367
|
+
yaw = gaussian_smooth_scalar(yaw, times, options.smooth_orientation_sigma_s);
|
|
1368
|
+
pitch = gaussian_smooth_scalar(pitch, times, options.smooth_orientation_sigma_s);
|
|
1369
|
+
for(size_t i = 0; i < input.size(); i++) {
|
|
1370
|
+
set_pose_yaw_pitch(output[i], yaw[i], pitch[i]);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
else {
|
|
1374
|
+
std::vector<Quaternion> quaternions = pose_quaternions_continuous(input);
|
|
1375
|
+
quaternions = limit_orientation_speed(
|
|
1376
|
+
quaternions,
|
|
1377
|
+
times,
|
|
1378
|
+
options.max_orientation_speed_rad_s,
|
|
1379
|
+
options.orientation_jump_ramp_multiplier
|
|
1380
|
+
);
|
|
1381
|
+
for(size_t i = 0; i < input.size(); i++) {
|
|
1382
|
+
const Quaternion q = options.smooth_orientation_sigma_s > 0.0
|
|
1383
|
+
? smooth_orientation_at(quaternions, times, i, options.smooth_orientation_sigma_s)
|
|
1384
|
+
: quaternions[i];
|
|
1385
|
+
set_pose_orientation(output[i], q);
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
return output;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
static std::string resolution_suffix(TI width, TI height) {
|
|
1394
|
+
return std::to_string(width) + "x" + std::to_string(height);
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
static std::string aa_suffix(bool enabled, TI grid_size) {
|
|
1398
|
+
return enabled ? std::string("_aa") + std::to_string(grid_size) : std::string();
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
static std::string aa_name(bool enabled, TI grid_size) {
|
|
1402
|
+
return enabled ? std::string("aa") + std::to_string(grid_size) : std::string("none");
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
static TI video_oversampling_factor(TI width, TI height) {
|
|
1406
|
+
const TI width_factor = width < MIN_VIDEO_DIMENSION ? (MIN_VIDEO_DIMENSION + width - 1) / width : static_cast<TI>(1);
|
|
1407
|
+
const TI height_factor = height < MIN_VIDEO_DIMENSION ? (MIN_VIDEO_DIMENSION + height - 1) / height : static_cast<TI>(1);
|
|
1408
|
+
return std::max(width_factor, height_factor);
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
static std::string ffmpeg_command(const Options& options, TI width, TI height, TI video_width, TI video_height, const std::string& output_path) {
|
|
1412
|
+
std::ostringstream cmd;
|
|
1413
|
+
cmd << shell_quote(options.ffmpeg)
|
|
1414
|
+
<< " -hide_banner -loglevel error -y -f rawvideo -pix_fmt rgba"
|
|
1415
|
+
<< " -s " << width << "x" << height
|
|
1416
|
+
<< " -r " << options.fps
|
|
1417
|
+
<< " -i -";
|
|
1418
|
+
if(video_width != width || video_height != height) {
|
|
1419
|
+
cmd << " -vf scale=" << video_width << ":" << video_height << ":flags=neighbor";
|
|
1420
|
+
}
|
|
1421
|
+
cmd << " -an -c:v " << video_encoder_name(options);
|
|
1422
|
+
if(options.ffmpeg_gpu) {
|
|
1423
|
+
cmd << " -preset p4 -tune hq -rc constqp -qp 19";
|
|
1424
|
+
}
|
|
1425
|
+
cmd << " -pix_fmt yuv420p " << shell_quote(output_path);
|
|
1426
|
+
return cmd.str();
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
static bool write_frame(FILE* pipe, const std::vector<uint32_t>& frame, int frame_i) {
|
|
1430
|
+
const size_t bytes = frame.size() * sizeof(uint32_t);
|
|
1431
|
+
const size_t written = std::fwrite(frame.data(), 1, bytes, pipe);
|
|
1432
|
+
if(written != bytes) {
|
|
1433
|
+
std::cerr << "Failed writing frame " << frame_i << " to ffmpeg" << std::endl;
|
|
1434
|
+
return false;
|
|
1435
|
+
}
|
|
1436
|
+
return true;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
static bool use_png_frames(TI width, TI height) {
|
|
1440
|
+
return width == height && (width == 64 || width == 128);
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
static const char* frame_extension(bool png) {
|
|
1444
|
+
return png ? "png" : "jpg";
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
static const char* frame_format_name(bool png) {
|
|
1448
|
+
return png ? "png_rgb" : "jpeg_rgb";
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
static std::string frame_filename(const std::string& frames_dir, size_t frame_i, bool png) {
|
|
1452
|
+
char filename[64];
|
|
1453
|
+
std::snprintf(filename, sizeof(filename), "frame_%06zu.%s", frame_i, frame_extension(png));
|
|
1454
|
+
return join_path(frames_dir, filename);
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
static bool write_rgb_image_frame(const std::string& path, const std::vector<uint32_t>& frame, std::vector<uint8_t>& rgb_frame, TI width, TI height, bool png) {
|
|
1458
|
+
const size_t pixels = frame.size();
|
|
1459
|
+
if(rgb_frame.size() != pixels * 3) {
|
|
1460
|
+
rgb_frame.resize(pixels * 3);
|
|
1461
|
+
}
|
|
1462
|
+
for(size_t i = 0; i < pixels; i++) {
|
|
1463
|
+
const uint32_t rgba = frame[i];
|
|
1464
|
+
rgb_frame[i * 3 + 0] = static_cast<uint8_t>((rgba >> 0) & 0xFF);
|
|
1465
|
+
rgb_frame[i * 3 + 1] = static_cast<uint8_t>((rgba >> 8) & 0xFF);
|
|
1466
|
+
rgb_frame[i * 3 + 2] = static_cast<uint8_t>((rgba >> 16) & 0xFF);
|
|
1467
|
+
}
|
|
1468
|
+
const int write_ok = png
|
|
1469
|
+
? stbi_write_png(path.c_str(), width, height, 3, rgb_frame.data(), width * 3)
|
|
1470
|
+
: stbi_write_jpg(path.c_str(), width, height, 3, rgb_frame.data(), FRAME_JPEG_QUALITY);
|
|
1471
|
+
if(write_ok == 0) {
|
|
1472
|
+
std::cerr << "Failed writing RGB " << (png ? "PNG" : "JPEG") << " frame: " << path << std::endl;
|
|
1473
|
+
return false;
|
|
1474
|
+
}
|
|
1475
|
+
return true;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
static void depth_range(const float* depth, size_t count, float max_depth, float& min_depth, float& max_valid_depth) {
|
|
1479
|
+
const float sentinel = max_depth * 0.999f;
|
|
1480
|
+
for(size_t i = 0; i < count; i++) {
|
|
1481
|
+
const float value = depth[i];
|
|
1482
|
+
if(std::isfinite(value) && value > 0.f && value < sentinel) {
|
|
1483
|
+
min_depth = std::min(min_depth, value);
|
|
1484
|
+
max_valid_depth = std::max(max_valid_depth, value);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
static void depth_to_rgba(const float* depth, std::vector<uint32_t>& frame, float max_depth, float min_valid_depth, float max_valid_depth) {
|
|
1490
|
+
const float sentinel = max_depth * 0.999f;
|
|
1491
|
+
const bool has_valid_depth = min_valid_depth <= max_valid_depth;
|
|
1492
|
+
const float range = has_valid_depth ? max_valid_depth - min_valid_depth : 0.f;
|
|
1493
|
+
for(size_t i = 0; i < frame.size(); i++) {
|
|
1494
|
+
uint8_t value = 0;
|
|
1495
|
+
const float d = depth[i];
|
|
1496
|
+
if(has_valid_depth && std::isfinite(d) && d > 0.f && d < sentinel) {
|
|
1497
|
+
const float normalized = std::fmin(std::fmax((d - min_valid_depth) / (range + 1e-6f), 0.f), 1.f);
|
|
1498
|
+
value = static_cast<uint8_t>((1.f - normalized) * 255.f);
|
|
1499
|
+
}
|
|
1500
|
+
frame[i] = (0xFFu << 24) | (uint32_t(value) << 16) | (uint32_t(value) << 8) | uint32_t(value);
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
template <typename SPEC>
|
|
1505
|
+
static bool render_trace_for_setting(rlt::devices::DEVICE_FACTORY<>& device, const Options& options, const std::string& scene_path, const std::vector<TracePose>& poses, const char* output_name, const char* profile_name, RenderRecord& record) {
|
|
1506
|
+
constexpr TI WIDTH = SPEC::CAM_WIDTH;
|
|
1507
|
+
constexpr TI HEIGHT = SPEC::CAM_HEIGHT;
|
|
1508
|
+
constexpr bool ENABLE_AA = SPEC::ENABLE_ANTI_ALIASING;
|
|
1509
|
+
constexpr TI AA_GRID_SIZE = ENABLE_AA ? SPEC::ANTI_ALIASING_GRID_SIZE : 1;
|
|
1510
|
+
record.output = output_name;
|
|
1511
|
+
record.profile = profile_name[0] == '\0' ? "none" : profile_name;
|
|
1512
|
+
record.anti_aliasing = aa_name(ENABLE_AA, AA_GRID_SIZE);
|
|
1513
|
+
record.width = WIDTH;
|
|
1514
|
+
record.height = HEIGHT;
|
|
1515
|
+
record.video_oversampling_factor = video_oversampling_factor(WIDTH, HEIGHT);
|
|
1516
|
+
record.video_width = WIDTH * record.video_oversampling_factor;
|
|
1517
|
+
record.video_height = HEIGHT * record.video_oversampling_factor;
|
|
1518
|
+
record.aa_grid_size = AA_GRID_SIZE;
|
|
1519
|
+
record.samples_per_pixel = AA_GRID_SIZE * AA_GRID_SIZE;
|
|
1520
|
+
const std::string base_name = profile_name[0] == '\0' ? std::string(output_name) : std::string(output_name) + "_" + profile_name;
|
|
1521
|
+
record.name = base_name + "_" + resolution_suffix(WIDTH, HEIGHT) + aa_suffix(ENABLE_AA, AA_GRID_SIZE);
|
|
1522
|
+
record.path = join_path(options.output_dir, std::string("trace_") + record.name + ".mp4");
|
|
1523
|
+
const bool png_frames = use_png_frames(WIDTH, HEIGHT);
|
|
1524
|
+
if(options.write_frames) {
|
|
1525
|
+
record.frames_dir = join_path(join_path(options.output_dir, "frames"), record.name);
|
|
1526
|
+
record.frame_pattern = join_path(record.frames_dir, std::string("frame_%06d.") + frame_extension(png_frames));
|
|
1527
|
+
record.frame_format = frame_format_name(png_frames);
|
|
1528
|
+
record.frame_jpeg_quality = png_frames ? 0 : FRAME_JPEG_QUALITY;
|
|
1529
|
+
}
|
|
1530
|
+
record.ffmpeg_command = ffmpeg_command(options, WIDTH, HEIGHT, record.video_width, record.video_height, record.path);
|
|
1531
|
+
record.frame_count = poses.size();
|
|
1532
|
+
|
|
1533
|
+
if(options.write_frames && !mkdir_p(record.frames_dir)) {
|
|
1534
|
+
return false;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
rlt::rl::environments::raytracing_example::Environment<SPEC> env;
|
|
1538
|
+
env.scene_path = scene_path.c_str();
|
|
1539
|
+
rlt::malloc(device, env);
|
|
1540
|
+
rlt::init(device, env);
|
|
1541
|
+
|
|
1542
|
+
std::vector<uint32_t> frame(static_cast<size_t>(WIDTH) * static_cast<size_t>(HEIGHT));
|
|
1543
|
+
FILE* pipe = popen(record.ffmpeg_command.c_str(), "w");
|
|
1544
|
+
if(pipe == nullptr) {
|
|
1545
|
+
std::cerr << "Failed to start ffmpeg for " << record.path << std::endl;
|
|
1546
|
+
rlt::free(device, env);
|
|
1547
|
+
return false;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
bool ok = true;
|
|
1551
|
+
std::vector<uint8_t> rgb_frame;
|
|
1552
|
+
const T fov = static_cast<T>(degrees_to_radians(options.fov_deg));
|
|
1553
|
+
rlt::Tensor<typename decltype(env.renderer->cameras)::SPEC> camera_staging;
|
|
1554
|
+
rlt::malloc(device, camera_staging);
|
|
1555
|
+
for(size_t frame_i = 0; frame_i < poses.size(); frame_i++) {
|
|
1556
|
+
const TracePose& pose = poses[frame_i];
|
|
1557
|
+
rlt::set(device, camera_staging, rlt::make_camera_data(pose.eye, pose.look_at, pose.up, fov, static_cast<T>(WIDTH) / static_cast<T>(HEIGHT)), 0);
|
|
1558
|
+
rlt::copy(device, env.renderer->device, camera_staging, rlt::cameras(device, *env.renderer));
|
|
1559
|
+
if constexpr (SPEC::HAS_DEPTH) {
|
|
1560
|
+
rlt::render(device, *env.renderer);
|
|
1561
|
+
std::vector<float> depth_staging(frame.size());
|
|
1562
|
+
{
|
|
1563
|
+
rlt::Tensor<typename decltype(env.renderer->depth_buffer)::SPEC> depth_alias;
|
|
1564
|
+
depth_alias._data = depth_staging.data();
|
|
1565
|
+
rlt::copy(env.renderer->device, device, rlt::depth_buffer(device, *env.renderer), depth_alias);
|
|
1566
|
+
}
|
|
1567
|
+
const float miss_depth = env.renderer->max_ray_length > 0 ? env.renderer->max_ray_length : 1e30f;
|
|
1568
|
+
float min_depth = std::numeric_limits<float>::max();
|
|
1569
|
+
float max_depth_value = std::numeric_limits<float>::lowest();
|
|
1570
|
+
depth_range(depth_staging.data(), frame.size(), miss_depth, min_depth, max_depth_value);
|
|
1571
|
+
depth_to_rgba(depth_staging.data(), frame, miss_depth, min_depth, max_depth_value);
|
|
1572
|
+
}
|
|
1573
|
+
else {
|
|
1574
|
+
rlt::render(device, *env.renderer);
|
|
1575
|
+
{
|
|
1576
|
+
rlt::Tensor<typename decltype(env.renderer->frame_buffer)::SPEC> frame_alias;
|
|
1577
|
+
frame_alias._data = frame.data();
|
|
1578
|
+
rlt::copy(env.renderer->device, device, rlt::frame_buffer(device, *env.renderer), frame_alias);
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
if(options.write_frames && !write_rgb_image_frame(frame_filename(record.frames_dir, frame_i, png_frames), frame, rgb_frame, WIDTH, HEIGHT, png_frames)) {
|
|
1582
|
+
ok = false;
|
|
1583
|
+
break;
|
|
1584
|
+
}
|
|
1585
|
+
if(!write_frame(pipe, frame, static_cast<int>(frame_i))) {
|
|
1586
|
+
ok = false;
|
|
1587
|
+
break;
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
rlt::free(device, camera_staging);
|
|
1591
|
+
|
|
1592
|
+
record.ffmpeg_status = pclose(pipe);
|
|
1593
|
+
record.ok = ok && record.ffmpeg_status == 0;
|
|
1594
|
+
if(!record.ok) {
|
|
1595
|
+
std::cerr << "ffmpeg failed for " << record.path << " with status " << record.ffmpeg_status << std::endl;
|
|
1596
|
+
}
|
|
1597
|
+
else {
|
|
1598
|
+
std::cout << "Wrote " << record.path << std::endl;
|
|
1599
|
+
if(options.write_frames) {
|
|
1600
|
+
std::cout << "Wrote RGB frames to " << record.frames_dir << std::endl;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
rlt::free(device, env);
|
|
1605
|
+
return record.ok;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
static bool write_manifest(const Options& options, const std::string& scene_path, const std::vector<TracePose>& source_poses, const std::vector<TracePose>& render_poses, double trace_duration_s, double source_implied_fps, bool timestamp_resampled, bool smoothing_applied, bool yaw_pitch_filter_applied, const std::vector<RenderRecord>& records) {
|
|
1609
|
+
json manifest;
|
|
1610
|
+
manifest["trace_path"] = options.trace_path;
|
|
1611
|
+
manifest["scene_path"] = scene_path;
|
|
1612
|
+
manifest["output_dir"] = options.output_dir;
|
|
1613
|
+
manifest["fps"] = options.fps;
|
|
1614
|
+
manifest["fov_deg"] = options.fov_deg;
|
|
1615
|
+
manifest["fov_rad"] = degrees_to_radians(options.fov_deg);
|
|
1616
|
+
manifest["ffmpeg_gpu"] = options.ffmpeg_gpu;
|
|
1617
|
+
manifest["ffmpeg_encoder"] = video_encoder_name(options);
|
|
1618
|
+
manifest["resolutions"] = json::array();
|
|
1619
|
+
for(const RenderResolutionOption& resolution : RENDER_RESOLUTIONS) {
|
|
1620
|
+
if(should_render_resolution(options, resolution.width, resolution.height)) {
|
|
1621
|
+
if(resolution.width == resolution.height) {
|
|
1622
|
+
manifest["resolutions"].push_back(resolution.width);
|
|
1623
|
+
}
|
|
1624
|
+
else {
|
|
1625
|
+
manifest["resolutions"].push_back(resolution.name);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
manifest["write_frames"] = options.write_frames;
|
|
1630
|
+
manifest["aa"] = aa_selection_name(options.aa);
|
|
1631
|
+
manifest["anti_aliasing"] = json::array();
|
|
1632
|
+
if(should_render_aa(options, false, 1)) {
|
|
1633
|
+
manifest["anti_aliasing"].push_back({
|
|
1634
|
+
{"name", "none"},
|
|
1635
|
+
{"enabled", false},
|
|
1636
|
+
{"grid_size", 1},
|
|
1637
|
+
{"samples_per_pixel", 1}
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
if(should_render_aa(options, true, 2)) {
|
|
1641
|
+
manifest["anti_aliasing"].push_back({
|
|
1642
|
+
{"name", "aa2"},
|
|
1643
|
+
{"enabled", true},
|
|
1644
|
+
{"grid_size", 2},
|
|
1645
|
+
{"samples_per_pixel", 4}
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
manifest["frames"] = render_poses.size();
|
|
1649
|
+
manifest["source_frames"] = source_poses.size();
|
|
1650
|
+
manifest["rendered_frames"] = render_poses.size();
|
|
1651
|
+
manifest["trace_duration_s"] = trace_duration_s;
|
|
1652
|
+
manifest["source_implied_fps"] = source_implied_fps;
|
|
1653
|
+
manifest["timestamp_resampled"] = timestamp_resampled;
|
|
1654
|
+
manifest["depth_visualization"] = {
|
|
1655
|
+
{"mapping", "per_frame_min_max"},
|
|
1656
|
+
{"near_value", 255},
|
|
1657
|
+
{"far_value", 0}
|
|
1658
|
+
};
|
|
1659
|
+
manifest["smoothing"] = {
|
|
1660
|
+
{"applied", smoothing_applied},
|
|
1661
|
+
{"algorithm", yaw_pitch_filter_applied ? "source_yaw_pitch_speed_limit_then_resample_then_yaw_pitch_gaussian" : "yaw_pitch_or_quaternion_speed_limit_then_gaussian"},
|
|
1662
|
+
{"source_yaw_pitch_filter_applied", yaw_pitch_filter_applied},
|
|
1663
|
+
{"position_sigma_s", options.smooth_position_sigma_s},
|
|
1664
|
+
{"orientation_sigma_s", options.smooth_orientation_sigma_s},
|
|
1665
|
+
{"max_orientation_speed_rad_s", options.max_orientation_speed_rad_s},
|
|
1666
|
+
{"max_orientation_speed_deg_s", options.max_orientation_speed_rad_s * 180.0 / 3.14159265358979323846},
|
|
1667
|
+
{"orientation_jump_ramp_multiplier", options.orientation_jump_ramp_multiplier}
|
|
1668
|
+
};
|
|
1669
|
+
manifest["renders"] = json::array();
|
|
1670
|
+
for(const RenderRecord& record : records) {
|
|
1671
|
+
json item;
|
|
1672
|
+
item["name"] = record.name;
|
|
1673
|
+
item["output"] = record.output;
|
|
1674
|
+
item["profile"] = record.profile;
|
|
1675
|
+
item["fidelity"] = record.profile;
|
|
1676
|
+
item["anti_aliasing"] = record.anti_aliasing;
|
|
1677
|
+
item["aa_grid_size"] = record.aa_grid_size;
|
|
1678
|
+
item["samples_per_pixel"] = record.samples_per_pixel;
|
|
1679
|
+
item["width"] = record.width;
|
|
1680
|
+
item["height"] = record.height;
|
|
1681
|
+
item["video_width"] = record.video_width;
|
|
1682
|
+
item["video_height"] = record.video_height;
|
|
1683
|
+
item["video_oversampling_factor"] = record.video_oversampling_factor;
|
|
1684
|
+
item["path"] = record.path;
|
|
1685
|
+
item["write_frames"] = options.write_frames;
|
|
1686
|
+
if(options.write_frames) {
|
|
1687
|
+
item["frames_dir"] = record.frames_dir;
|
|
1688
|
+
item["frame_pattern"] = record.frame_pattern;
|
|
1689
|
+
item["frame_format"] = record.frame_format;
|
|
1690
|
+
if(record.frame_jpeg_quality > 0) {
|
|
1691
|
+
item["frame_jpeg_quality"] = record.frame_jpeg_quality;
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
item["frame_count"] = record.frame_count;
|
|
1695
|
+
item["ffmpeg_command"] = record.ffmpeg_command;
|
|
1696
|
+
item["ffmpeg_status"] = record.ffmpeg_status;
|
|
1697
|
+
item["ok"] = record.ok;
|
|
1698
|
+
manifest["renders"].push_back(item);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
const std::string manifest_path = join_path(options.output_dir, "trace_render_manifest.json");
|
|
1702
|
+
std::ofstream f(manifest_path);
|
|
1703
|
+
if(!f) {
|
|
1704
|
+
std::cerr << "Failed to write manifest: " << manifest_path << std::endl;
|
|
1705
|
+
return false;
|
|
1706
|
+
}
|
|
1707
|
+
f << manifest.dump(2) << "\n";
|
|
1708
|
+
std::cout << "Wrote " << manifest_path << std::endl;
|
|
1709
|
+
return true;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
template <TI WIDTH, TI HEIGHT, bool ENABLE_AA, TI AA_GRID_SIZE>
|
|
1713
|
+
static bool render_selected_settings_for_resolution(rlt::devices::DEVICE_FACTORY<>& device, const Options& options, const std::string& scene_path, const std::vector<TracePose>& poses, std::vector<RenderRecord>& records) {
|
|
1714
|
+
if(!should_render_resolution(options, WIDTH, HEIGHT)) {
|
|
1715
|
+
return true;
|
|
1716
|
+
}
|
|
1717
|
+
if(!should_render_aa(options, ENABLE_AA, AA_GRID_SIZE)) {
|
|
1718
|
+
return true;
|
|
1719
|
+
}
|
|
1720
|
+
bool ok = true;
|
|
1721
|
+
if(should_render_setting(options, "rgb", "very_high")) {
|
|
1722
|
+
using SPEC = rlt::rl::environments::raytracing_example::Specification<T, TI, NUM_CAMERAS, WIDTH, HEIGHT, NUM_PROBES, rlt::rendering::raytracing::VeryHigh, false, 1, ENABLE_AA, AA_GRID_SIZE>;
|
|
1723
|
+
records.emplace_back();
|
|
1724
|
+
ok = render_trace_for_setting<SPEC>(device, options, scene_path, poses, "rgb", "very_high", records.back()) && ok;
|
|
1725
|
+
}
|
|
1726
|
+
if(should_render_setting(options, "rgb", "high")) {
|
|
1727
|
+
using SPEC = rlt::rl::environments::raytracing_example::Specification<T, TI, NUM_CAMERAS, WIDTH, HEIGHT, NUM_PROBES, rlt::rendering::raytracing::High, false, 1, ENABLE_AA, AA_GRID_SIZE>;
|
|
1728
|
+
records.emplace_back();
|
|
1729
|
+
ok = render_trace_for_setting<SPEC>(device, options, scene_path, poses, "rgb", "high", records.back()) && ok;
|
|
1730
|
+
}
|
|
1731
|
+
if(should_render_setting(options, "rgb", "medium")) {
|
|
1732
|
+
using SPEC = rlt::rl::environments::raytracing_example::Specification<T, TI, NUM_CAMERAS, WIDTH, HEIGHT, NUM_PROBES, rlt::rendering::raytracing::Medium, false, 1, ENABLE_AA, AA_GRID_SIZE>;
|
|
1733
|
+
records.emplace_back();
|
|
1734
|
+
ok = render_trace_for_setting<SPEC>(device, options, scene_path, poses, "rgb", "medium", records.back()) && ok;
|
|
1735
|
+
}
|
|
1736
|
+
if(should_render_setting(options, "rgb", "low")) {
|
|
1737
|
+
using SPEC = rlt::rl::environments::raytracing_example::Specification<T, TI, NUM_CAMERAS, WIDTH, HEIGHT, NUM_PROBES, rlt::rendering::raytracing::Low, false, 1, ENABLE_AA, AA_GRID_SIZE>;
|
|
1738
|
+
records.emplace_back();
|
|
1739
|
+
ok = render_trace_for_setting<SPEC>(device, options, scene_path, poses, "rgb", "low", records.back()) && ok;
|
|
1740
|
+
}
|
|
1741
|
+
if(should_render_depth(options)) {
|
|
1742
|
+
using SPEC = rlt::rl::environments::raytracing_example::Specification<T, TI, NUM_CAMERAS, WIDTH, HEIGHT, NUM_PROBES, rlt::rendering::raytracing::Medium, false, 1, ENABLE_AA, AA_GRID_SIZE, false, true>;
|
|
1743
|
+
records.emplace_back();
|
|
1744
|
+
ok = render_trace_for_setting<SPEC>(device, options, scene_path, poses, "depth", "", records.back()) && ok;
|
|
1745
|
+
}
|
|
1746
|
+
return ok;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
int main(int argc, char** argv) {
|
|
1750
|
+
Options options;
|
|
1751
|
+
if(!parse_options(argc, argv, options)) {
|
|
1752
|
+
print_usage(argv[0]);
|
|
1753
|
+
return 1;
|
|
1754
|
+
}
|
|
1755
|
+
if(options.help) {
|
|
1756
|
+
print_usage(argv[0]);
|
|
1757
|
+
return 0;
|
|
1758
|
+
}
|
|
1759
|
+
options.output_dir = join_path(options.output_dir, trace_output_name(options.trace_path));
|
|
1760
|
+
if(!mkdir_p(options.output_dir)) {
|
|
1761
|
+
return 1;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
std::string scene_path;
|
|
1765
|
+
std::vector<TracePose> source_poses;
|
|
1766
|
+
if(!load_trace(options, scene_path, source_poses)) {
|
|
1767
|
+
return 1;
|
|
1768
|
+
}
|
|
1769
|
+
bool yaw_pitch_filter_applied = false;
|
|
1770
|
+
std::vector<TracePose> filtered_source_poses = filter_yaw_pitch_trace(source_poses, options, yaw_pitch_filter_applied);
|
|
1771
|
+
if(yaw_pitch_filter_applied) {
|
|
1772
|
+
std::cout << "Applied source yaw/pitch jump filter before resampling with max orientation speed "
|
|
1773
|
+
<< (options.max_orientation_speed_rad_s * 180.0 / 3.14159265358979323846)
|
|
1774
|
+
<< " deg/s with " << options.orientation_jump_ramp_multiplier
|
|
1775
|
+
<< "x jump ramps" << std::endl;
|
|
1776
|
+
}
|
|
1777
|
+
double trace_duration_s = 0.0;
|
|
1778
|
+
double source_implied_fps = 0.0;
|
|
1779
|
+
bool timestamp_resampled = false;
|
|
1780
|
+
std::vector<TracePose> poses = resample_trace(filtered_source_poses, options.fps, trace_duration_s, source_implied_fps, timestamp_resampled);
|
|
1781
|
+
if(timestamp_resampled) {
|
|
1782
|
+
std::cout << "Resampled " << source_poses.size() << " timestamped poses over " << trace_duration_s << "s to " << poses.size() << " frames at " << options.fps << " fps" << std::endl;
|
|
1783
|
+
}
|
|
1784
|
+
else {
|
|
1785
|
+
std::cout << "Rendering " << poses.size() << " poses without timestamp resampling" << std::endl;
|
|
1786
|
+
}
|
|
1787
|
+
bool post_resample_smoothing_applied = false;
|
|
1788
|
+
poses = smooth_trace(poses, options, post_resample_smoothing_applied, yaw_pitch_filter_applied);
|
|
1789
|
+
const bool smoothing_applied = yaw_pitch_filter_applied || post_resample_smoothing_applied;
|
|
1790
|
+
if(post_resample_smoothing_applied) {
|
|
1791
|
+
std::cout << "Applied post-resample trace smoothing with position sigma " << options.smooth_position_sigma_s << "s";
|
|
1792
|
+
if(!yaw_pitch_filter_applied) {
|
|
1793
|
+
std::cout << ", orientation sigma " << options.smooth_orientation_sigma_s
|
|
1794
|
+
<< "s, and max orientation speed " << (options.max_orientation_speed_rad_s * 180.0 / 3.14159265358979323846)
|
|
1795
|
+
<< " deg/s with " << options.orientation_jump_ramp_multiplier
|
|
1796
|
+
<< "x jump ramps";
|
|
1797
|
+
}
|
|
1798
|
+
std::cout << std::endl;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
using DEVICE = rlt::devices::DEVICE_FACTORY<>;
|
|
1802
|
+
DEVICE device;
|
|
1803
|
+
rlt::init(device);
|
|
1804
|
+
|
|
1805
|
+
std::vector<RenderRecord> records;
|
|
1806
|
+
bool ok = true;
|
|
1807
|
+
|
|
1808
|
+
ok = render_selected_settings_for_resolution<64, 64, false, 1>(device, options, scene_path, poses, records) && ok;
|
|
1809
|
+
ok = render_selected_settings_for_resolution<64, 64, true, 2>(device, options, scene_path, poses, records) && ok;
|
|
1810
|
+
ok = render_selected_settings_for_resolution<128, 128, false, 1>(device, options, scene_path, poses, records) && ok;
|
|
1811
|
+
ok = render_selected_settings_for_resolution<128, 128, true, 2>(device, options, scene_path, poses, records) && ok;
|
|
1812
|
+
ok = render_selected_settings_for_resolution<256, 256, false, 1>(device, options, scene_path, poses, records) && ok;
|
|
1813
|
+
ok = render_selected_settings_for_resolution<256, 256, true, 2>(device, options, scene_path, poses, records) && ok;
|
|
1814
|
+
ok = render_selected_settings_for_resolution<512, 512, false, 1>(device, options, scene_path, poses, records) && ok;
|
|
1815
|
+
ok = render_selected_settings_for_resolution<512, 512, true, 2>(device, options, scene_path, poses, records) && ok;
|
|
1816
|
+
ok = render_selected_settings_for_resolution<1024, 1024, false, 1>(device, options, scene_path, poses, records) && ok;
|
|
1817
|
+
ok = render_selected_settings_for_resolution<1024, 1024, true, 2>(device, options, scene_path, poses, records) && ok;
|
|
1818
|
+
ok = render_selected_settings_for_resolution<2048, 2048, false, 1>(device, options, scene_path, poses, records) && ok;
|
|
1819
|
+
ok = render_selected_settings_for_resolution<2048, 2048, true, 2>(device, options, scene_path, poses, records) && ok;
|
|
1820
|
+
ok = render_selected_settings_for_resolution<3840, 2160, false, 1>(device, options, scene_path, poses, records) && ok;
|
|
1821
|
+
ok = render_selected_settings_for_resolution<3840, 2160, true, 2>(device, options, scene_path, poses, records) && ok;
|
|
1822
|
+
|
|
1823
|
+
if(records.empty()) {
|
|
1824
|
+
std::cerr << "No render settings selected by --settings=" << options.settings << std::endl;
|
|
1825
|
+
return 1;
|
|
1826
|
+
}
|
|
1827
|
+
ok = write_manifest(options, scene_path, source_poses, poses, trace_duration_s, source_implied_fps, timestamp_resampled, smoothing_applied, yaw_pitch_filter_applied, records) && ok;
|
|
1828
|
+
return ok ? 0 : 1;
|
|
1829
|
+
}
|