Compare commits

...

38 Commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks 0b99ef1be1 nvidia: Fix header includes now that they're in include not source 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 1eecb35c83 autoframing: I have no idea why this is necessary
There does not appear to be a reason for this to cause a compiler error, but it does on MSVC. To be precise, the 'grp2' part causes it if there is not an underscore behind it. A classic "doesn't work without this comment" problem.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks ef55651d9c nvidia: Fix missing includes 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 7fb8c6fea2 nvidia: Require explicit set/get commands
This addresses some unexpected behaviors, and might even fix a feature or two.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 4982a7900e Fix incorrect target_compile_definitions calls 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks b9b4dba686 nvidia: Actually test for windows 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks df70723884 ffmpeg: Don't break on MacOS
While AMF is not really available on MacOS, we still shouldn't just fail to compile because of it. Might as well do the test and if it doesn't work out, then we still behave the same as before.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 915c85e60e core: Frontend and Updater are default features 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks a63eb8b80a denoising: Check if NVIDIA component is available 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 34e754d474 upscaling: Check if NVIDIA component is available 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 4ebc96997e autoframing: Check if NVIDIA component is available 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 3239f5e5b9 virtual-greenscreen: Check if NVIDIA component is available 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks afcd5dfea9 nvidia: We only support Windows at the current time
While a Linux version is (supposedly) available for this functionality, at the current time we have no integration for it. Nor do we have any way to test it either, so it is better to disable it for now.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 92ddbd1330 Fix up some dependency logic in component resolving 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 4cf2a399f4 Update Copyright headers
These now include all history, which has fixed some headers that used to be wrong.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 4339a5f853 Update copyright.js tool
It will now properly sort authors by date, and follow renames, which should give a much better coverage of copyright information.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 0e913edccf Update component logic to support required and optional resolving
This allows resolving a dependency tree up to 10 elements deep, but a different solution may be necessary in the future. A better alternative in the future might be to keep a copy of the unresolved entries and then compare every loop, instead of limiting to a fixed number of cycles.

This currently doesn't address cyclic dependencies, since I'm not quite sure how those would work with the current model anyway.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 92b93a2479 nvidia: Add optional dependencies to the NVIDIA component 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks a48a32931a Update build guide with latest instructiosn 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 434936baf6 Split Find/Resolve/Link component discovery stages 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 7c887c06e8 nvidia: Move into its own component
This component enables interactivity with NVIDIA libraries. Currently this is limited to NVIDIA Maxine only.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 090f49d3c8 Add NVIDIA Maxine Audio Effects SDK as a third party dependency 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks e6c81ca71e Always build Frontend and Updater
We now require these features all the time, as they are becoming more of a core part of the StreamFX UI. Additionally several components rely on these already being present, so omitting them is not a great idea.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 72b0daca05 upscaling: Move into its own component 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 484c790c2a virtual-greenscreen: Move into its own component 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks e3ddbe4336 denoising: Move into its own component 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks d7d8253518 autoframing: Move into its own component 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 7ebe4f5631 sdf-effects: Move into its own component 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 65e91fbbc4 mirror: Move into its own component
Soon to be replaced by Spout/Sink
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 5d5852c8f7 color-grade: Move into its own component
Another re-usable code section that never got reused. This one is actually more useful, so I might split it into its own component eventually.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 4f845ac996 blur: Move into its own component
This still contains some of the old reusable code, which was never used in the first place. I'm unsure what the end goal for it was, as nothing really ended up using it anywhere else.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 02f8ca8d83 transform: Move into its own component 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 792bf163b4 dynamic-mask: Move into its own component 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks ecaf39bee1 shader: Move into its own component 2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks d5cf2d2ccf ffmpeg: Move into its own component
While we're at it, let's also fix the invalid destructor, as well as the NVENC HEVC encoder incorrectly using H264.Level to store H265.Level.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks d2a543f118 core: Clean up some older C++ code
- Remove float_t and double_t usage, as they aren't related to sized types.
- Remove unused aligned types, their usage has been replaced quite a while ago.
- Update the templates for pow and is_power_of_two.
2023-09-30 09:25:30 +02:00
Michael Fabian 'Xaymar' Dirks 6b02b76e6c Add prefix to commit titles when needed 2023-09-30 09:25:30 +02:00
brighten cfcf975794 fix: add decimal place to remove ambiguity
error: Error compiling shader:
0(142) : error C1101: ambiguous overloaded function reference "log(int)"
    (0) : lowp float log(lowp float)
    (0) : mediump float log(mediump float)
    (0) : float log(float)

error: device_pixelshader_create (GL) failed
error: Pass (0) <> missing pixel shader!
error: [StreamFX] <filter::color_grade> Error loading '/usr/local/share/obs/obs-plugins/StreamFX/effects/color-grade.effect': Unknown error during effect compile.
error: [StreamFX] Unexpected exception in function '_create': Unknown error during effect compile..
error: Failed to create source 'Color Grading'!
2023-09-30 04:46:14 +02:00
218 changed files with 1409 additions and 1956 deletions

3
.gitmodules vendored
View File

@ -23,3 +23,6 @@
[submodule "third-party/obs-studio"]
path = third-party/obs-studio
url = https://github.com/obsproject/obs-studio.git
[submodule "third-party/nvidia-maxine-afx-sdk"]
path = third-party/nvidia-maxine-afx-sdk
url = https://github.com/NVIDIA/MAXINE-AFX-SDK.git

View File

@ -3,5 +3,6 @@ Michael Fabian 'Xaymar' Dirks <info@xaymar.com> <github@xaymar.com>
Vainock <39059951+Vainock@users.noreply.github.com> <contact.vainock@gmail.com>
Charles Fettinger <charles@oncorporation.com> <charles@onacloud.org>
Charles Fettinger <charles@oncorporation.com> <charles@Oncorporation.com>
Radegast Stravinsky <radegast.ffxiv@gmail.com> <radegast.ffxiv@gmail.com>
Radegast Stravinsky <radegast.ffxiv@gmail.com> <58457062+Radegast-FFXIV@users.noreply.github.com>
Carsten Braun <info@braun-cloud.de> <info@braun-software-solutions.de>

View File

@ -8,14 +8,12 @@ This document intends to guide you through the process of building StreamFX. It
2. Follow the [OBS Studio build guide](https://obsproject.com/wiki/install-instructions) for automated building on your platform of choice.
- **MacOS:** You will need to use the XCode generator to build StreamFX as the Ninja generator does not support the flags StreamFX requires.
3. Integrate StreamFX into the OBS Studio build flow:
1. Navigate to either of these directories:
- **With UI:** `<obs studio source>/UI/frontend-plugins`
- **Without UI:** `<obs studio source>/plugins`
1. Navigate to `<obs studio source>/UI/frontend-plugins`
2. Open a `git` enabled shell (git-bash on windows).
3. Run `git submodule add 'https://github.com/Xaymar/obs-StreamFX.git' streamfx`.
4. Run `git submodule update --init --recursive`.
5. Append the line `add_subdirectory(streamfx)` to the `CMakeLists.txt` file in the same directory.
4. Run the same script(s) from step 2 again.
4. Run the same steps from the build guide in step 2 again.
5. Done. StreamFX is now part of the build.
</details>
@ -54,8 +52,8 @@ This document intends to guide you through the process of building StreamFX. It
A Node.JS based tool is provided toread and parse the `/third-party/obs-studio/buildspec.json` file. See `/.github/workflows/main.yml` on usage and output parsing.
- **MacOS**
A Node.JS based tool is provided toread and parse the `/third-party/obs-studio/buildspec.json` file. See `/.github/workflows/main.yml` on usage and output parsing.
- Linux:
- **Debian / Ubuntu:** `sudo apt install qt6-base-dev qt6-base-private-dev libqt6svg6-dev`
- **Debian / Ubuntu:**
`sudo apt install qt6-base-dev qt6-base-private-dev libqt6svg6-dev`
- [CURL](https://curl.se/):
- **Windows**
A Node.JS based tool is provided toread and parse the `/third-party/obs-studio/buildspec.json` file. See `/.github/workflows/main.yml` on usage and output parsing.

File diff suppressed because it is too large Load Diff

View File

@ -8,20 +8,65 @@ As this is a rather large project, we have certain rules to follow when contribu
### Linear History
We follow the paradigm of linear history which forbids branches from being merged, thus changes made on branches are `git rebase`d back onto the root. This simplifies the code history significantly, but makes reverting changes more difficult.
`git merge`
`git merge`
`git rebase`
### Commits
A commit should be containing a single change, even if it spans multiple units, and has the following format:
```
short description
prefix: short description
optional long description
```
The short description should be no longer than 120 characters and focus on the important things. The long description is optional, but should be included for larger changes.
#### The appropriate `prefix`
<table>
<tr>
<th>Path(s)</th>
<th>Prefix</th>
<th>Example</th>
</tr>
<tr>
<td>
data/locale
</td>
<td>locale</td>
<td>
<code>data/locale/en-US.ini</code> -> <code>locale</code>
</td>
</tr>
<tr>
<td>components/name</td>
<td>name</td>
<td>
<code>components/shader</code> -> <code>shader</code>
</td>
</tr>
<tr>
<td>
source<br>
templates<br>
data<br>
ui
</td>
<td>core</td>
<td>
<code>ui/main.ui</code> -> <code>core</code>
</td>
</tr>
<tr>
<td>Anything else</td>
<td><b>Omit the prefix</b></td>
<td></td>
</tr>
</table>
If multiple match, apply the prefix that changes the most files. If all are equal, alphabetically sort the prefixes and list comma separated.
</details>

View File

@ -0,0 +1,24 @@
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
cmake_minimum_required(VERSION 3.26)
project("AutoFraming")
list(APPEND CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
streamfx_add_component("Auto-Framing"
RESOLVER streamfx_auto_framing_resolver
)
streamfx_add_component_dependency("NVIDIA" OPTIONAL)
function(streamfx_auto_framing_resolver)
# Providers
#- NVIDIA
streamfx_enabled_component("NVIDIA" T_CHECK)
if(T_CHECK)
target_compile_definitions(${COMPONENT_TARGET} PRIVATE
PRIVATE ENABLE_NVIDIA
)
endif()
endfunction()

View File

@ -146,7 +146,7 @@ autoframing_instance::~autoframing_instance()
// TODO: Make this asynchronous.
switch (_provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case tracking_provider::NVIDIA_FACEDETECTION:
nvar_facedetection_unload();
break;
@ -358,7 +358,7 @@ void autoframing_instance::update(obs_data_t* data)
std::unique_lock<std::mutex> ul(_provider_lock);
switch (_provider) {
#ifdef ENABLE_FILTER_UPSCALING_NVIDIA
#ifdef ENABLE_NVIDIA
case tracking_provider::NVIDIA_FACEDETECTION:
nvar_facedetection_update(data);
break;
@ -375,7 +375,7 @@ void autoframing_instance::update(obs_data_t* data)
void streamfx::filter::autoframing::autoframing_instance::properties(obs_properties_t* properties)
{
switch (_provider_ui) {
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
case tracking_provider::NVIDIA_FACEDETECTION:
nvar_facedetection_properties(properties);
break;
@ -401,7 +401,7 @@ uint32_t autoframing_instance::get_height()
return std::max<uint32_t>(_out_size.second, 1);
}
void autoframing_instance::video_tick(float_t seconds)
void autoframing_instance::video_tick(float seconds)
{
auto target = obs_filter_get_target(_self);
auto width = obs_source_get_base_width(target);
@ -490,7 +490,7 @@ void autoframing_instance::video_render(gs_effect_t* effect)
std::unique_lock<std::mutex> ul(_provider_lock);
switch (_provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case tracking_provider::NVIDIA_FACEDETECTION:
nvar_facedetection_process();
break;
@ -864,7 +864,7 @@ void streamfx::filter::autoframing::autoframing_instance::task_switch_provider(u
try {
// Unload the previous provider.
switch (spd->provider) {
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
case tracking_provider::NVIDIA_FACEDETECTION:
nvar_facedetection_unload();
break;
@ -875,7 +875,7 @@ void streamfx::filter::autoframing::autoframing_instance::task_switch_provider(u
// Load the new provider.
switch (_provider) {
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
case tracking_provider::NVIDIA_FACEDETECTION:
nvar_facedetection_load();
break;
@ -894,7 +894,7 @@ void streamfx::filter::autoframing::autoframing_instance::task_switch_provider(u
}
}
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
void streamfx::filter::autoframing::autoframing_instance::nvar_facedetection_load()
{
_nvidia_fx = std::make_shared<::streamfx::nvidia::ar::facedetection>();
@ -1008,7 +1008,7 @@ autoframing_factory::autoframing_factory()
bool any_available = false;
// 1. Try and load any configured providers.
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
try {
// Load CVImage and Video Effects SDK.
_nvcuda = ::streamfx::nvidia::cuda::obs::get();
@ -1097,11 +1097,9 @@ obs_properties_t* autoframing_factory::get_properties2(autoframing_instance* dat
{
obs_properties_t* pr = obs_properties_create();
#ifdef ENABLE_FRONTEND
{
obs_properties_add_button2(pr, S_MANUAL_OPEN, D_TRANSLATE(S_MANUAL_OPEN), autoframing_factory::on_manual_open, nullptr);
}
#endif
{
auto grp = obs_properties_create();
@ -1144,26 +1142,26 @@ obs_properties_t* autoframing_factory::get_properties2(autoframing_instance* dat
}
{
auto grp2 = obs_properties_create();
obs_properties_add_group(grp, ST_KEY_FRAMING_PADDING, D_TRANSLATE(ST_I18N_FRAMING_PADDING), OBS_GROUP_NORMAL, grp2);
auto grp2_ = obs_properties_create();
obs_properties_add_group(grp, ST_KEY_FRAMING_PADDING, D_TRANSLATE(ST_I18N_FRAMING_PADDING), OBS_GROUP_NORMAL, grp2_);
{
auto p = obs_properties_add_text(grp2, ST_KEY_FRAMING_PADDING ".X", "X", OBS_TEXT_DEFAULT);
auto p = obs_properties_add_text(grp2_, ST_KEY_FRAMING_PADDING ".X", "X", OBS_TEXT_DEFAULT);
}
{
auto p = obs_properties_add_text(grp2, ST_KEY_FRAMING_PADDING ".Y", "Y", OBS_TEXT_DEFAULT);
auto p = obs_properties_add_text(grp2_, ST_KEY_FRAMING_PADDING ".Y", "Y", OBS_TEXT_DEFAULT);
}
}
{
auto grp2 = obs_properties_create();
obs_properties_add_group(grp, ST_KEY_FRAMING_OFFSET, D_TRANSLATE(ST_I18N_FRAMING_OFFSET), OBS_GROUP_NORMAL, grp2);
auto grp2_ = obs_properties_create();
obs_properties_add_group(grp, ST_KEY_FRAMING_OFFSET, D_TRANSLATE(ST_I18N_FRAMING_OFFSET), OBS_GROUP_NORMAL, grp2_);
{
auto p = obs_properties_add_text(grp2, ST_KEY_FRAMING_OFFSET ".X", "X", OBS_TEXT_DEFAULT);
auto p = obs_properties_add_text(grp2_, ST_KEY_FRAMING_OFFSET ".X", "X", OBS_TEXT_DEFAULT);
}
{
auto p = obs_properties_add_text(grp2, ST_KEY_FRAMING_OFFSET ".Y", "Y", OBS_TEXT_DEFAULT);
auto p = obs_properties_add_text(grp2_, ST_KEY_FRAMING_OFFSET ".Y", "Y", OBS_TEXT_DEFAULT);
}
}
@ -1213,7 +1211,7 @@ obs_properties_t* autoframing_factory::get_properties2(autoframing_instance* dat
auto p = obs_properties_add_list(grp, ST_KEY_ADVANCED_PROVIDER, D_TRANSLATE(ST_I18N_ADVANCED_PROVIDER), OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_set_modified_callback(p, modified_provider);
obs_property_list_add_int(p, D_TRANSLATE(S_STATE_AUTOMATIC), static_cast<int64_t>(tracking_provider::AUTOMATIC));
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
obs_property_list_add_int(p, D_TRANSLATE(ST_I18N_ADVANCED_PROVIDER_NVIDIA_FACEDETECTION), static_cast<int64_t>(tracking_provider::NVIDIA_FACEDETECTION));
#endif
}
@ -1224,18 +1222,16 @@ obs_properties_t* autoframing_factory::get_properties2(autoframing_instance* dat
return pr;
}
#ifdef ENABLE_FRONTEND
bool streamfx::filter::autoframing::autoframing_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
streamfx::open_url(HELP_URL);
return false;
}
#endif
bool streamfx::filter::autoframing::autoframing_factory::is_provider_available(tracking_provider provider)
{
switch (provider) {
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
case tracking_provider::NVIDIA_FACEDETECTION:
return _nvidia_available;
#endif

View File

@ -19,7 +19,7 @@
#include <mutex>
#include "warning-enable.hpp"
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
#include "nvidia/ar/nvidia-ar-facedetection.hpp"
#endif
@ -81,7 +81,7 @@ namespace streamfx::filter::autoframing {
std::mutex _provider_lock;
std::shared_ptr<util::threadpool::task> _provider_task;
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
std::shared_ptr<::streamfx::nvidia::ar::facedetection> _nvidia_fx;
#endif
@ -126,7 +126,7 @@ namespace streamfx::filter::autoframing {
uint32_t get_width() override;
uint32_t get_height() override;
virtual void video_tick(float_t seconds) override;
virtual void video_tick(float seconds) override;
virtual void video_render(gs_effect_t* effect) override;
private:
@ -135,7 +135,7 @@ namespace streamfx::filter::autoframing {
void switch_provider(tracking_provider provider);
void task_switch_provider(util::threadpool::task_data_t data);
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
void nvar_facedetection_load();
void nvar_facedetection_unload();
void nvar_facedetection_process();
@ -145,7 +145,7 @@ namespace streamfx::filter::autoframing {
};
class autoframing_factory : public obs::source_factory<streamfx::filter::autoframing::autoframing_factory, streamfx::filter::autoframing::autoframing_instance> {
#ifdef ENABLE_FILTER_AUTOFRAMING_NVIDIA
#ifdef ENABLE_NVIDIA
bool _nvidia_available;
std::shared_ptr<::streamfx::nvidia::cuda::obs> _nvcuda;
std::shared_ptr<::streamfx::nvidia::cv::cv> _nvcvi;
@ -161,9 +161,7 @@ namespace streamfx::filter::autoframing {
void get_defaults2(obs_data_t* data) override;
obs_properties_t* get_properties2(autoframing_instance* data) override;
#ifdef ENABLE_FRONTEND
static bool on_manual_open(obs_properties_t* props, obs_property_t* property, void* data);
#endif
bool is_provider_available(tracking_provider);
tracking_provider find_ideal_provider();

View File

@ -0,0 +1,9 @@
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
cmake_minimum_required(VERSION 3.26)
project("Blur")
list(APPEND CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
streamfx_add_component("Blur")

View File

@ -1,5 +1,6 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2019-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2019 Cat Stevens <catb0t@protonmail.ch>
// AUTOGENERATED COPYRIGHT HEADER END
#include "filter-blur.hpp"
@ -290,12 +291,12 @@ void blur_instance::update(obs_data_t* settings)
_mask.type = static_cast<mask_type>(obs_data_get_int(settings, ST_KEY_MASK_TYPE));
switch (_mask.type) {
case mask_type::Region:
_mask.region.left = float_t(obs_data_get_double(settings, ST_KEY_MASK_REGION_LEFT) / 100.0);
_mask.region.top = float_t(obs_data_get_double(settings, ST_KEY_MASK_REGION_TOP) / 100.0);
_mask.region.right = 1.0f - float_t(obs_data_get_double(settings, ST_KEY_MASK_REGION_RIGHT) / 100.0);
_mask.region.bottom = 1.0f - float_t(obs_data_get_double(settings, ST_KEY_MASK_REGION_BOTTOM) / 100.0);
_mask.region.feather = float_t(obs_data_get_double(settings, ST_KEY_MASK_REGION_FEATHER) / 100.0);
_mask.region.feather_shift = float_t(obs_data_get_double(settings, ST_KEY_MASK_REGION_FEATHER_SHIFT) / 100.0);
_mask.region.left = float(obs_data_get_double(settings, ST_KEY_MASK_REGION_LEFT) / 100.0);
_mask.region.top = float(obs_data_get_double(settings, ST_KEY_MASK_REGION_TOP) / 100.0);
_mask.region.right = 1.0f - float(obs_data_get_double(settings, ST_KEY_MASK_REGION_RIGHT) / 100.0);
_mask.region.bottom = 1.0f - float(obs_data_get_double(settings, ST_KEY_MASK_REGION_BOTTOM) / 100.0);
_mask.region.feather = float(obs_data_get_double(settings, ST_KEY_MASK_REGION_FEATHER) / 100.0);
_mask.region.feather_shift = float(obs_data_get_double(settings, ST_KEY_MASK_REGION_FEATHER_SHIFT) / 100.0);
_mask.region.invert = obs_data_get_bool(settings, ST_KEY_MASK_REGION_INVERT);
break;
case mask_type::Image:
@ -310,8 +311,8 @@ void blur_instance::update(obs_data_t* settings)
_mask.color.r = static_cast<float>((color >> 0) & 0xFF) / 255.0f;
_mask.color.g = static_cast<float>((color >> 8) & 0xFF) / 255.0f;
_mask.color.b = static_cast<float>((color >> 16) & 0xFF) / 255.0f;
_mask.color.a = static_cast<float_t>(obs_data_get_double(settings, ST_KEY_MASK_ALPHA));
_mask.multiplier = float_t(obs_data_get_double(settings, ST_KEY_MASK_MULTIPLIER));
_mask.color.a = static_cast<float>(obs_data_get_double(settings, ST_KEY_MASK_ALPHA));
_mask.multiplier = float(obs_data_get_double(settings, ST_KEY_MASK_MULTIPLIER));
}
}
}
@ -464,7 +465,7 @@ void blur_instance::video_render(gs_effect_t* effect)
std::string technique = "";
switch (this->_mask.type) {
case mask_type::Region:
if (this->_mask.region.feather > std::numeric_limits<float_t>::epsilon()) {
if (this->_mask.region.feather > std::numeric_limits<float>::epsilon()) {
if (this->_mask.region.invert) {
technique = "RegionFeatherInverted";
} else {
@ -744,11 +745,9 @@ obs_properties_t* blur_factory::get_properties2(blur_instance* data)
obs_properties_t* pr = obs_properties_create();
obs_property_t* p = NULL;
#ifdef ENABLE_FRONTEND
{
obs_properties_add_button2(pr, S_MANUAL_OPEN, D_TRANSLATE(S_MANUAL_OPEN), streamfx::filter::blur::blur_factory::on_manual_open, nullptr);
}
#endif
// Blur Type and Sub-Type
{
@ -839,7 +838,6 @@ std::string blur_factory::translate_string(const char* format, ...)
return std::string(buffer.data(), buffer.data() + len);
}
#ifdef ENABLE_FRONTEND
bool blur_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try {
@ -853,7 +851,6 @@ bool blur_factory::on_manual_open(obs_properties_t* props, obs_property_t* prope
return false;
}
}
#endif
std::shared_ptr<blur_factory> blur_factory::instance()
{

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2019-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once
@ -55,12 +55,12 @@ namespace streamfx::filter::blur {
bool enabled;
mask_type type;
struct {
float_t left;
float_t top;
float_t right;
float_t bottom;
float_t feather;
float_t feather_shift;
float left;
float top;
float right;
float bottom;
float feather;
float feather_shift;
bool invert;
} region;
struct {
@ -76,12 +76,12 @@ namespace streamfx::filter::blur {
std::shared_ptr<streamfx::obs::gs::texture> texture;
} source;
struct {
float_t r;
float_t g;
float_t b;
float_t a;
float r;
float g;
float b;
float a;
} color;
float_t multiplier;
float multiplier;
} _mask;
public:
@ -93,7 +93,7 @@ namespace streamfx::filter::blur {
virtual void migrate(obs_data_t* settings, uint64_t version) override;
virtual void update(obs_data_t* settings) override;
virtual void video_tick(float_t time) override;
virtual void video_tick(float time) override;
virtual void video_render(gs_effect_t* effect) override;
private:
@ -115,9 +115,7 @@ namespace streamfx::filter::blur {
std::string translate_string(const char* format, ...);
#ifdef ENABLE_FRONTEND
static bool on_manual_open(obs_properties_t* props, obs_property_t* property, void* data);
#endif
public: // Singleton
static std::shared_ptr<blur_factory> instance();

View File

@ -236,8 +236,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_linear::r
auto gdmp = streamfx::obs::gs::debug_marker(streamfx::obs::gs::debug_color_azure_radiance, "Box Linear Blur");
#endif
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
gs_set_cull_mode(GS_NEITHER);
gs_enable_color(true, true, true, true);
@ -257,10 +257,10 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_linear::r
if (effect) {
// Pass 1
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), 0.f);
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size));
effect.get_parameter("pSizeInverseMul").set_float(float_t(1.0f / (float_t(_size) * 2.0f + 1.0f)));
effect.get_parameter("pImageTexel").set_float2(float(1.f / width), 0.f);
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size));
effect.get_parameter("pSizeInverseMul").set_float(float(1.0f / (float(_size) * 2.0f + 1.0f)));
{
#if defined(ENABLE_PROFILING) && !defined(D_PLATFORM_MAC) && _DEBUG
@ -276,7 +276,7 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_linear::r
// Pass 2
effect.get_parameter("pImage").set_texture(_rendertarget2->get_texture());
effect.get_parameter("pImageTexel").set_float2(0., float_t(1.f / height));
effect.get_parameter("pImageTexel").set_float2(0., float(1.f / height));
{
#if defined(ENABLE_PROFILING) && !defined(D_PLATFORM_MAC) && _DEBUG
@ -326,8 +326,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_linear_di
auto gdmp = streamfx::obs::gs::debug_marker(streamfx::obs::gs::debug_color_azure_radiance, "Box Linear Directional Blur");
#endif
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
gs_blend_state_push();
gs_reset_blend_state();
@ -346,10 +346,10 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_linear_di
streamfx::obs::gs::effect effect = _data->get_effect();
if (effect) {
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1. / width * cos(_angle)), float_t(1.f / height * sin(_angle)));
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size));
effect.get_parameter("pSizeInverseMul").set_float(float_t(1.0f / (float_t(_size) * 2.0f + 1.0f)));
effect.get_parameter("pImageTexel").set_float2(float(1. / width * cos(_angle)), float(1.f / height * sin(_angle)));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size));
effect.get_parameter("pSizeInverseMul").set_float(float(1.0f / (float(_size) * 2.0f + 1.0f)));
{
auto op = _rendertarget->render(uint32_t(width), uint32_t(height));

View File

@ -246,8 +246,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box::render()
auto gdmp = streamfx::obs::gs::debug_marker(streamfx::obs::gs::debug_color_azure_radiance, "Box Blur");
#endif
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
gs_set_cull_mode(GS_NEITHER);
gs_enable_color(true, true, true, true);
@ -267,10 +267,10 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box::render()
if (effect) {
// Pass 1
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), 0.f);
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size));
effect.get_parameter("pSizeInverseMul").set_float(float_t(1.0f / (float_t(_size) * 2.0f + 1.0f)));
effect.get_parameter("pImageTexel").set_float2(float(1.f / width), 0.f);
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size));
effect.get_parameter("pSizeInverseMul").set_float(float(1.0f / (float(_size) * 2.0f + 1.0f)));
{
#if defined(ENABLE_PROFILING) && !defined(D_PLATFORM_MAC) && _DEBUG
@ -286,7 +286,7 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box::render()
// Pass 2
effect.get_parameter("pImage").set_texture(_rendertarget2->get_texture());
effect.get_parameter("pImageTexel").set_float2(0.f, float_t(1.f / height));
effect.get_parameter("pImageTexel").set_float2(0.f, float(1.f / height));
{
#if defined(ENABLE_PROFILING) && !defined(D_PLATFORM_MAC) && _DEBUG
@ -336,8 +336,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_direction
auto gdmp = streamfx::obs::gs::debug_marker(streamfx::obs::gs::debug_color_azure_radiance, "Box Directional Blur");
#endif
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
gs_blend_state_push();
gs_reset_blend_state();
@ -356,10 +356,10 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_direction
streamfx::obs::gs::effect effect = _data->get_effect();
if (effect) {
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1. / width * cos(_angle)), float_t(1.f / height * sin(_angle)));
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size));
effect.get_parameter("pSizeInverseMul").set_float(float_t(1.0f / (float_t(_size) * 2.0f + 1.0f)));
effect.get_parameter("pImageTexel").set_float2(float(1. / width * cos(_angle)), float(1.f / height * sin(_angle)));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size));
effect.get_parameter("pSizeInverseMul").set_float(float(1.0f / (float(_size) * 2.0f + 1.0f)));
{
auto op = _rendertarget->render(uint32_t(width), uint32_t(height));
@ -410,8 +410,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_rotationa
auto gdmp = streamfx::obs::gs::debug_marker(streamfx::obs::gs::debug_color_azure_radiance, "Box Rotational Blur");
#endif
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
gs_blend_state_push();
gs_reset_blend_state();
@ -430,12 +430,12 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_rotationa
streamfx::obs::gs::effect effect = _data->get_effect();
if (effect) {
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), float_t(1.f / height));
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size));
effect.get_parameter("pSizeInverseMul").set_float(float_t(1.0f / (float_t(_size) * 2.0f + 1.0f)));
effect.get_parameter("pAngle").set_float(float_t(_angle / _size));
effect.get_parameter("pCenter").set_float2(float_t(_center.first), float_t(_center.second));
effect.get_parameter("pImageTexel").set_float2(float(1.f / width), float(1.f / height));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size));
effect.get_parameter("pSizeInverseMul").set_float(float(1.0f / (float(_size) * 2.0f + 1.0f)));
effect.get_parameter("pAngle").set_float(float(_angle / _size));
effect.get_parameter("pCenter").set_float2(float(_center.first), float(_center.second));
{
auto op = _rendertarget->render(uint32_t(width), uint32_t(height));
@ -476,8 +476,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_zoom::ren
auto gdmp = streamfx::obs::gs::debug_marker(streamfx::obs::gs::debug_color_azure_radiance, "Box Zoom Blur");
#endif
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
gs_blend_state_push();
gs_reset_blend_state();
@ -496,11 +496,11 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::box_zoom::ren
streamfx::obs::gs::effect effect = _data->get_effect();
if (effect) {
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), float_t(1.f / height));
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size));
effect.get_parameter("pSizeInverseMul").set_float(float_t(1.0f / (float_t(_size) * 2.0f + 1.0f)));
effect.get_parameter("pCenter").set_float2(float_t(_center.first), float_t(_center.second));
effect.get_parameter("pImageTexel").set_float2(float(1.f / width), float(1.f / height));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size));
effect.get_parameter("pSizeInverseMul").set_float(float(1.0f / (float(_size) * 2.0f + 1.0f)));
effect.get_parameter("pCenter").set_float2(float(_center.first), float(_center.second));
{
auto op = _rendertarget->render(uint32_t(width), uint32_t(height));

View File

@ -40,7 +40,7 @@ streamfx::gfx::blur::gaussian_linear_data::gaussian_linear_data() : _gfx_util(::
// Precalculate Kernels
for (std::size_t kernel_size = 1; kernel_size <= ST_MAX_BLUR_SIZE; kernel_size++) {
std::vector<double_t> kernel_math(ST_MAX_KERNEL_SIZE);
std::vector<float_t> kernel_data(ST_MAX_KERNEL_SIZE);
std::vector<float> kernel_data(ST_MAX_KERNEL_SIZE);
double_t actual_width = 1.;
// Find actual kernel width.
@ -61,7 +61,7 @@ streamfx::gfx::blur::gaussian_linear_data::gaussian_linear_data() : _gfx_util(::
// Normalize to fill the entire 0..1 range over the width.
double_t inverse_sum = 1.0 / sum;
for (std::size_t p = 0; p <= kernel_size; p++) {
kernel_data.at(p) = float_t(kernel_math[p] * inverse_sum);
kernel_data.at(p) = float(kernel_math[p] * inverse_sum);
}
_kernels.push_back(std::move(kernel_data));
@ -78,7 +78,7 @@ streamfx::obs::gs::effect streamfx::gfx::blur::gaussian_linear_data::get_effect(
return _effect;
}
std::vector<float_t> const& streamfx::gfx::blur::gaussian_linear_data::get_kernel(std::size_t width)
std::vector<float> const& streamfx::gfx::blur::gaussian_linear_data::get_kernel(std::size_t width)
{
if (width < 1)
width = 1;
@ -292,8 +292,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_line
return _input_texture;
}
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
// Setup
gs_set_cull_mode(GS_NEITHER);
@ -310,13 +310,13 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_line
gs_stencil_op(GS_STENCIL_BOTH, GS_ZERO, GS_ZERO, GS_ZERO);
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size));
effect.get_parameter("pKernel").set_value(kernel.data(), ST_MAX_KERNEL_SIZE);
// First Pass
if (_step_scale.first > std::numeric_limits<double_t>::epsilon()) {
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), 0.f);
effect.get_parameter("pImageTexel").set_float2(float(1.f / width), 0.f);
{
#if defined(ENABLE_PROFILING) && !defined(D_PLATFORM_MAC) && _DEBUG
@ -336,7 +336,7 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_line
// Second Pass
if (_step_scale.second > std::numeric_limits<double_t>::epsilon()) {
effect.get_parameter("pImageTexel").set_float2(0.f, float_t(1.f / height));
effect.get_parameter("pImageTexel").set_float2(0.f, float(1.f / height));
{
#if defined(ENABLE_PROFILING) && !defined(D_PLATFORM_MAC) && _DEBUG
@ -397,8 +397,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_line
return _input_texture;
}
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
// Setup
gs_set_cull_mode(GS_NEITHER);
@ -415,9 +415,9 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_line
gs_stencil_op(GS_STENCIL_BOTH, GS_ZERO, GS_ZERO, GS_ZERO);
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width * cos(_angle)), float_t(1.f / height * sin(_angle)));
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size));
effect.get_parameter("pImageTexel").set_float2(float(1.f / width * cos(_angle)), float(1.f / height * sin(_angle)));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size));
effect.get_parameter("pKernel").set_value(kernel.data(), ST_MAX_KERNEL_SIZE);
// First Pass

View File

@ -20,7 +20,7 @@ namespace streamfx::gfx {
class gaussian_linear_data {
streamfx::obs::gs::effect _effect;
std::shared_ptr<streamfx::gfx::util> _gfx_util;
std::vector<std::vector<float_t>> _kernels;
std::vector<std::vector<float>> _kernels;
public:
gaussian_linear_data();
@ -30,7 +30,7 @@ namespace streamfx::gfx {
streamfx::obs::gs::effect get_effect();
std::vector<float_t> const& get_kernel(std::size_t width);
std::vector<float> const& get_kernel(std::size_t width);
};
class gaussian_linear_factory : public ::streamfx::gfx::blur::ifactory {

View File

@ -108,7 +108,7 @@ std::shared_ptr<streamfx::gfx::util> streamfx::gfx::blur::gaussian_data::get_gfx
return _gfx_util;
}
std::vector<float_t> const& streamfx::gfx::blur::gaussian_data::get_kernel(std::size_t width)
std::vector<float> const& streamfx::gfx::blur::gaussian_data::get_kernel(std::size_t width)
{
width = std::clamp<size_t>(width, 1, ST_MAX_BLUR_SIZE);
return _kernels.at(width);
@ -321,8 +321,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian::ren
}
auto kernel = _data->get_kernel(size_t(_size));
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
// Setup
gs_set_cull_mode(GS_NEITHER);
@ -338,14 +338,14 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian::ren
gs_stencil_function(GS_STENCIL_BOTH, GS_ALWAYS);
gs_stencil_op(GS_STENCIL_BOTH, GS_ZERO, GS_ZERO, GS_ZERO);
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size * ST_OVERSAMPLE_MULTIPLIER));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size * ST_OVERSAMPLE_MULTIPLIER));
effect.get_parameter("pKernel").set_value(kernel.data(), ST_KERNEL_SIZE);
// First Pass
if (_step_scale.first > std::numeric_limits<double_t>::epsilon()) {
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), 0.f);
effect.get_parameter("pImageTexel").set_float2(float(1.f / width), 0.f);
{
#if defined(ENABLE_PROFILING) && !defined(D_PLATFORM_MAC) && _DEBUG
@ -365,7 +365,7 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian::ren
// Second Pass
if (_step_scale.second > std::numeric_limits<double_t>::epsilon()) {
effect.get_parameter("pImage").set_texture(_rendertarget->get_texture());
effect.get_parameter("pImageTexel").set_float2(0.f, float_t(1.f / height));
effect.get_parameter("pImageTexel").set_float2(0.f, float(1.f / height));
{
#if defined(ENABLE_PROFILING) && !defined(D_PLATFORM_MAC) && _DEBUG
@ -426,8 +426,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_dire
}
auto kernel = _data->get_kernel(size_t(_size));
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
// Setup
gs_set_cull_mode(GS_NEITHER);
@ -444,9 +444,9 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_dire
gs_stencil_op(GS_STENCIL_BOTH, GS_ZERO, GS_ZERO, GS_ZERO);
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width * cos(m_angle)), float_t(1.f / height * sin(m_angle)));
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size * ST_OVERSAMPLE_MULTIPLIER));
effect.get_parameter("pImageTexel").set_float2(float(1.f / width * cos(m_angle)), float(1.f / height * sin(m_angle)));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size * ST_OVERSAMPLE_MULTIPLIER));
effect.get_parameter("pKernel").set_value(kernel.data(), ST_KERNEL_SIZE);
{
@ -482,8 +482,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_rota
}
auto kernel = _data->get_kernel(size_t(_size));
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
// Setup
gs_set_cull_mode(GS_NEITHER);
@ -500,11 +500,11 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_rota
gs_stencil_op(GS_STENCIL_BOTH, GS_ZERO, GS_ZERO, GS_ZERO);
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), float_t(1.f / height));
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size * ST_OVERSAMPLE_MULTIPLIER));
effect.get_parameter("pAngle").set_float(float_t(m_angle / _size));
effect.get_parameter("pCenter").set_float2(float_t(m_center.first), float_t(m_center.second));
effect.get_parameter("pImageTexel").set_float2(float(1.f / width), float(1.f / height));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size * ST_OVERSAMPLE_MULTIPLIER));
effect.get_parameter("pAngle").set_float(float(m_angle / _size));
effect.get_parameter("pCenter").set_float2(float(m_center.first), float(m_center.second));
effect.get_parameter("pKernel").set_value(kernel.data(), ST_KERNEL_SIZE);
// First Pass
@ -563,8 +563,8 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_zoom
return _input_texture;
}
float_t width = float_t(_input_texture->get_width());
float_t height = float_t(_input_texture->get_height());
float width = float(_input_texture->get_width());
float height = float(_input_texture->get_height());
// Setup
gs_set_cull_mode(GS_NEITHER);
@ -581,10 +581,10 @@ std::shared_ptr<::streamfx::obs::gs::texture> streamfx::gfx::blur::gaussian_zoom
gs_stencil_op(GS_STENCIL_BOTH, GS_ZERO, GS_ZERO, GS_ZERO);
effect.get_parameter("pImage").set_texture(_input_texture);
effect.get_parameter("pImageTexel").set_float2(float_t(1.f / width), float_t(1.f / height));
effect.get_parameter("pStepScale").set_float2(float_t(_step_scale.first), float_t(_step_scale.second));
effect.get_parameter("pSize").set_float(float_t(_size));
effect.get_parameter("pCenter").set_float2(float_t(m_center.first), float_t(m_center.second));
effect.get_parameter("pImageTexel").set_float2(float(1.f / width), float(1.f / height));
effect.get_parameter("pStepScale").set_float2(float(_step_scale.first), float(_step_scale.second));
effect.get_parameter("pSize").set_float(float(_size));
effect.get_parameter("pCenter").set_float2(float(m_center.first), float(m_center.second));
effect.get_parameter("pKernel").set_value(kernel.data(), ST_KERNEL_SIZE);
// First Pass

View File

@ -30,7 +30,7 @@ namespace streamfx::gfx {
std::shared_ptr<streamfx::gfx::util> get_gfx_util();
std::vector<float_t> const& get_kernel(std::size_t width);
std::vector<float> const& get_kernel(std::size_t width);
};
class gaussian_factory : public ::streamfx::gfx::blur::ifactory {

View File

@ -0,0 +1,9 @@
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
cmake_minimum_required(VERSION 3.26)
project("ColorGrade")
list(APPEND CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
streamfx_add_component("Color Grade")

View File

@ -156,12 +156,12 @@ void color_grade_instance::allocate_rendertarget(gs_color_format format)
_cache_rt = std::make_unique<streamfx::obs::gs::rendertarget>(format, GS_ZS_NONE);
}
float_t fix_gamma_value(double_t v)
float fix_gamma_value(double_t v)
{
if (v < 0.0) {
return static_cast<float_t>(-v + 1.0);
return static_cast<float>(-v + 1.0);
} else {
return static_cast<float_t>(1.0 / (v + 1.0));
return static_cast<float>(1.0 / (v + 1.0));
}
}
@ -174,38 +174,38 @@ void color_grade_instance::migrate(obs_data_t* data, uint64_t version) {}
void color_grade_instance::update(obs_data_t* data)
{
_lift.x = static_cast<float_t>(obs_data_get_double(data, ST_KEY_LIFT_(ST_RED)) / 100.0);
_lift.y = static_cast<float_t>(obs_data_get_double(data, ST_KEY_LIFT_(ST_GREEN)) / 100.0);
_lift.z = static_cast<float_t>(obs_data_get_double(data, ST_KEY_LIFT_(ST_BLUE)) / 100.0);
_lift.w = static_cast<float_t>(obs_data_get_double(data, ST_KEY_LIFT_(ST_ALL)) / 100.0);
_lift.x = static_cast<float>(obs_data_get_double(data, ST_KEY_LIFT_(ST_RED)) / 100.0);
_lift.y = static_cast<float>(obs_data_get_double(data, ST_KEY_LIFT_(ST_GREEN)) / 100.0);
_lift.z = static_cast<float>(obs_data_get_double(data, ST_KEY_LIFT_(ST_BLUE)) / 100.0);
_lift.w = static_cast<float>(obs_data_get_double(data, ST_KEY_LIFT_(ST_ALL)) / 100.0);
_gamma.x = fix_gamma_value(obs_data_get_double(data, ST_KEY_GAMMA_(ST_RED)) / 100.0);
_gamma.y = fix_gamma_value(obs_data_get_double(data, ST_KEY_GAMMA_(ST_GREEN)) / 100.0);
_gamma.z = fix_gamma_value(obs_data_get_double(data, ST_KEY_GAMMA_(ST_BLUE)) / 100.0);
_gamma.w = fix_gamma_value(obs_data_get_double(data, ST_KEY_GAMMA_(ST_ALL)) / 100.0);
_gain.x = static_cast<float_t>(obs_data_get_double(data, ST_KEY_GAIN_(ST_RED)) / 100.0);
_gain.y = static_cast<float_t>(obs_data_get_double(data, ST_KEY_GAIN_(ST_GREEN)) / 100.0);
_gain.z = static_cast<float_t>(obs_data_get_double(data, ST_KEY_GAIN_(ST_BLUE)) / 100.0);
_gain.w = static_cast<float_t>(obs_data_get_double(data, ST_KEY_GAIN_(ST_ALL)) / 100.0);
_offset.x = static_cast<float_t>(obs_data_get_double(data, ST_KEY_OFFSET_(ST_RED)) / 100.0);
_offset.y = static_cast<float_t>(obs_data_get_double(data, ST_KEY_OFFSET_(ST_GREEN)) / 100.0);
_offset.z = static_cast<float_t>(obs_data_get_double(data, ST_KEY_OFFSET_(ST_BLUE)) / 100.0);
_offset.w = static_cast<float_t>(obs_data_get_double(data, ST_KEY_OFFSET_(ST_ALL)) / 100.0);
_gain.x = static_cast<float>(obs_data_get_double(data, ST_KEY_GAIN_(ST_RED)) / 100.0);
_gain.y = static_cast<float>(obs_data_get_double(data, ST_KEY_GAIN_(ST_GREEN)) / 100.0);
_gain.z = static_cast<float>(obs_data_get_double(data, ST_KEY_GAIN_(ST_BLUE)) / 100.0);
_gain.w = static_cast<float>(obs_data_get_double(data, ST_KEY_GAIN_(ST_ALL)) / 100.0);
_offset.x = static_cast<float>(obs_data_get_double(data, ST_KEY_OFFSET_(ST_RED)) / 100.0);
_offset.y = static_cast<float>(obs_data_get_double(data, ST_KEY_OFFSET_(ST_GREEN)) / 100.0);
_offset.z = static_cast<float>(obs_data_get_double(data, ST_KEY_OFFSET_(ST_BLUE)) / 100.0);
_offset.w = static_cast<float>(obs_data_get_double(data, ST_KEY_OFFSET_(ST_ALL)) / 100.0);
_tint_detection = static_cast<detection_mode>(obs_data_get_int(data, ST_KEY_TINT_DETECTION));
_tint_luma = static_cast<luma_mode>(obs_data_get_int(data, ST_KEY_TINT_MODE));
_tint_exponent = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_EXPONENT));
_tint_low.x = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_LOW, ST_RED)) / 100.0);
_tint_low.y = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_LOW, ST_GREEN)) / 100.0);
_tint_low.z = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_LOW, ST_BLUE)) / 100.0);
_tint_mid.x = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_MID, ST_RED)) / 100.0);
_tint_mid.y = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_MID, ST_GREEN)) / 100.0);
_tint_mid.z = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_MID, ST_BLUE)) / 100.0);
_tint_hig.x = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_HIGH, ST_RED)) / 100.0);
_tint_hig.y = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_HIGH, ST_GREEN)) / 100.0);
_tint_hig.z = static_cast<float_t>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_HIGH, ST_BLUE)) / 100.0);
_correction.x = static_cast<float_t>(obs_data_get_double(data, ST_KEY_CORRECTION_(ST_HUE)) / 360.0);
_correction.y = static_cast<float_t>(obs_data_get_double(data, ST_KEY_CORRECTION_(ST_SATURATION)) / 100.0);
_correction.z = static_cast<float_t>(obs_data_get_double(data, ST_KEY_CORRECTION_(ST_LIGHTNESS)) / 100.0);
_correction.w = static_cast<float_t>(obs_data_get_double(data, ST_KEY_CORRECTION_(ST_CONTRAST)) / 100.0);
_tint_exponent = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_EXPONENT));
_tint_low.x = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_LOW, ST_RED)) / 100.0);
_tint_low.y = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_LOW, ST_GREEN)) / 100.0);
_tint_low.z = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_LOW, ST_BLUE)) / 100.0);
_tint_mid.x = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_MID, ST_RED)) / 100.0);
_tint_mid.y = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_MID, ST_GREEN)) / 100.0);
_tint_mid.z = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_MID, ST_BLUE)) / 100.0);
_tint_hig.x = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_HIGH, ST_RED)) / 100.0);
_tint_hig.y = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_HIGH, ST_GREEN)) / 100.0);
_tint_hig.z = static_cast<float>(obs_data_get_double(data, ST_KEY_TINT_(ST_TONE_HIGH, ST_BLUE)) / 100.0);
_correction.x = static_cast<float>(obs_data_get_double(data, ST_KEY_CORRECTION_(ST_HUE)) / 360.0);
_correction.y = static_cast<float>(obs_data_get_double(data, ST_KEY_CORRECTION_(ST_SATURATION)) / 100.0);
_correction.z = static_cast<float>(obs_data_get_double(data, ST_KEY_CORRECTION_(ST_LIGHTNESS)) / 100.0);
_correction.w = static_cast<float>(obs_data_get_double(data, ST_KEY_CORRECTION_(ST_CONTRAST)) / 100.0);
{
int64_t v = obs_data_get_int(data, ST_KEY_RENDERMODE);
@ -370,7 +370,7 @@ void color_grade_instance::video_render(gs_effect_t* shader)
{
auto op = _ccache_rt->render(width, height);
gs_ortho(0, static_cast<float_t>(width), 0, static_cast<float_t>(height), 0, 1);
gs_ortho(0, static_cast<float>(width), 0, static_cast<float>(height), 0, 1);
// Blank out the input cache.
gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &blank, 0., 0);
@ -613,11 +613,9 @@ obs_properties_t* color_grade_factory::get_properties2(color_grade_instance* dat
{
obs_properties_t* pr = obs_properties_create();
#ifdef ENABLE_FRONTEND
{
obs_properties_add_button2(pr, S_MANUAL_OPEN, D_TRANSLATE(S_MANUAL_OPEN), streamfx::filter::color_grade::color_grade_factory::on_manual_open, nullptr);
}
#endif
{
obs_properties_t* grp = obs_properties_create();
@ -810,7 +808,6 @@ obs_properties_t* color_grade_factory::get_properties2(color_grade_instance* dat
return pr;
}
#ifdef ENABLE_FRONTEND
bool color_grade_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try {
@ -824,7 +821,6 @@ bool color_grade_factory::on_manual_open(obs_properties_t* props, obs_property_t
return false;
}
}
#endif
std::shared_ptr<color_grade_factory> streamfx::filter::color_grade::color_grade_factory::instance()
{

View File

@ -43,7 +43,7 @@ namespace streamfx::filter::color_grade {
vec4 _offset;
detection_mode _tint_detection;
luma_mode _tint_luma;
float_t _tint_exponent;
float _tint_exponent;
vec3 _tint_low;
vec3 _tint_mid;
vec3 _tint_hig;
@ -83,7 +83,7 @@ namespace streamfx::filter::color_grade {
void rebuild_lut();
virtual void video_tick(float_t time) override;
virtual void video_tick(float time) override;
virtual void video_render(gs_effect_t* effect) override;
};
@ -98,9 +98,7 @@ namespace streamfx::filter::color_grade {
virtual obs_properties_t* get_properties2(color_grade_instance* data) override;
#ifdef ENABLE_FRONTEND
static bool on_manual_open(obs_properties_t* props, obs_property_t* property, void* data);
#endif
public: // Singleton
static std::shared_ptr<color_grade_factory> instance();

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -0,0 +1,23 @@
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
cmake_minimum_required(VERSION 3.26)
project("Denoising")
list(APPEND CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
streamfx_add_component("Denoising"
RESOLVER streamfx_denoising_resolver
)
streamfx_add_component_dependency("NVIDIA" OPTIONAL)
function(streamfx_denoising_resolver)
# Providers
#- NVIDIA
streamfx_enabled_component("NVIDIA" T_CHECK)
if(T_CHECK)
target_compile_definitions(${COMPONENT_TARGET} PRIVATE
ENABLE_NVIDIA
)
endif()
endfunction()

View File

@ -30,7 +30,7 @@
#define ST_I18N_PROVIDER ST_I18N "." ST_KEY_PROVIDER
#define ST_I18N_PROVIDER_NVIDIA_DENOISING ST_I18N_PROVIDER ".NVIDIA.Denoising"
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
#define ST_KEY_NVIDIA_DENOISING "NVIDIA.Denoising"
#define ST_I18N_NVIDIA_DENOISING ST_I18N "." ST_KEY_NVIDIA_DENOISING
#define ST_KEY_NVIDIA_DENOISING_STRENGTH "NVIDIA.Denoising.Strength"
@ -121,7 +121,7 @@ denoising_instance::~denoising_instance()
// TODO: Make this asynchronous.
switch (_provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case denoising_provider::NVIDIA_DENOISING:
nvvfx_denoising_unload();
break;
@ -157,7 +157,7 @@ void denoising_instance::update(obs_data_t* data)
std::unique_lock<std::mutex> ul(_provider_lock);
switch (_provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case denoising_provider::NVIDIA_DENOISING:
nvvfx_denoising_update(data);
break;
@ -171,7 +171,7 @@ void denoising_instance::update(obs_data_t* data)
void streamfx::filter::denoising::denoising_instance::properties(obs_properties_t* properties)
{
switch (_provider_ui) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case denoising_provider::NVIDIA_DENOISING:
nvvfx_denoising_properties(properties);
break;
@ -191,7 +191,7 @@ uint32_t streamfx::filter::denoising::denoising_instance::get_height()
return std::max<uint32_t>(_size.second, 1);
}
void denoising_instance::video_tick(float_t time)
void denoising_instance::video_tick(float time)
{
auto parent = obs_filter_get_parent(_self);
auto target = obs_filter_get_target(_self);
@ -208,7 +208,7 @@ void denoising_instance::video_tick(float_t time)
std::unique_lock<std::mutex> ul(_provider_lock);
switch (_provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case denoising_provider::NVIDIA_DENOISING:
nvvfx_denoising_size();
break;
@ -252,7 +252,7 @@ void denoising_instance::video_render(gs_effect_t* effect)
{ // Allow the provider to restrict the size.
switch (_provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case denoising_provider::NVIDIA_DENOISING:
nvvfx_denoising_size();
break;
@ -305,7 +305,7 @@ void denoising_instance::video_render(gs_effect_t* effect)
::streamfx::obs::gs::debug_marker profiler1{::streamfx::obs::gs::debug_color_convert, "Process"};
#endif
switch (_provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case denoising_provider::NVIDIA_DENOISING:
nvvfx_denoising_process();
break;
@ -401,7 +401,7 @@ void streamfx::filter::denoising::denoising_instance::task_switch_provider(util:
try {
// 3. Unload the previous provider.
switch (spd->provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case denoising_provider::NVIDIA_DENOISING:
nvvfx_denoising_unload();
break;
@ -412,7 +412,7 @@ void streamfx::filter::denoising::denoising_instance::task_switch_provider(util:
// 4. Load the new provider.
switch (_provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case denoising_provider::NVIDIA_DENOISING:
nvvfx_denoising_load();
break;
@ -431,7 +431,7 @@ void streamfx::filter::denoising::denoising_instance::task_switch_provider(util:
}
}
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
void streamfx::filter::denoising::denoising_instance::nvvfx_denoising_load()
{
_nvidia_fx = std::make_shared<::streamfx::nvidia::vfx::denoising>();
@ -493,7 +493,7 @@ denoising_factory::denoising_factory()
bool any_available = false;
// 1. Try and load any configured providers.
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
try {
// Load CVImage and Video Effects SDK.
_nvcuda = ::streamfx::nvidia::cuda::obs::get();
@ -543,7 +543,7 @@ void denoising_factory::get_defaults2(obs_data_t* data)
{
obs_data_set_default_int(data, ST_KEY_PROVIDER, static_cast<int64_t>(denoising_provider::AUTOMATIC));
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
obs_data_set_default_double(data, ST_KEY_NVIDIA_DENOISING_STRENGTH, 1.);
#endif
}
@ -565,11 +565,9 @@ obs_properties_t* denoising_factory::get_properties2(denoising_instance* data)
{
obs_properties_t* pr = obs_properties_create();
#ifdef ENABLE_FRONTEND
{
obs_properties_add_button2(pr, S_MANUAL_OPEN, D_TRANSLATE(S_MANUAL_OPEN), denoising_factory::on_manual_open, nullptr);
}
#endif
if (data) {
data->properties(pr);
@ -590,18 +588,16 @@ obs_properties_t* denoising_factory::get_properties2(denoising_instance* data)
return pr;
}
#ifdef ENABLE_FRONTEND
bool denoising_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
streamfx::open_url(HELP_URL);
return false;
}
#endif
bool streamfx::filter::denoising::denoising_factory::is_provider_available(denoising_provider provider)
{
switch (provider) {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
case denoising_provider::NVIDIA_DENOISING:
return _nvidia_available;
#endif

View File

@ -16,7 +16,7 @@
#include <mutex>
#include "warning-enable.hpp"
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
#include "nvidia/vfx/nvidia-vfx-denoising.hpp"
#endif
@ -48,7 +48,7 @@ namespace streamfx::filter::denoising {
std::shared_ptr<::streamfx::obs::gs::texture> _output;
bool _dirty;
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
std::shared_ptr<::streamfx::nvidia::vfx::denoising> _nvidia_fx;
#endif
@ -64,14 +64,14 @@ namespace streamfx::filter::denoising {
uint32_t get_width() override;
uint32_t get_height() override;
void video_tick(float_t time) override;
void video_tick(float time) override;
void video_render(gs_effect_t* effect) override;
private:
void switch_provider(denoising_provider provider);
void task_switch_provider(util::threadpool::task_data_t data);
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
void nvvfx_denoising_load();
void nvvfx_denoising_unload();
void nvvfx_denoising_size();
@ -82,7 +82,7 @@ namespace streamfx::filter::denoising {
};
class denoising_factory : public obs::source_factory<::streamfx::filter::denoising::denoising_factory, ::streamfx::filter::denoising::denoising_instance> {
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
#ifdef ENABLE_NVIDIA
bool _nvidia_available;
std::shared_ptr<::streamfx::nvidia::cuda::obs> _nvcuda;
std::shared_ptr<::streamfx::nvidia::cv::cv> _nvcvi;
@ -98,9 +98,7 @@ namespace streamfx::filter::denoising {
virtual void get_defaults2(obs_data_t* data) override;
virtual obs_properties_t* get_properties2(denoising_instance* data) override;
#ifdef ENABLE_FRONTEND
static bool on_manual_open(obs_properties_t* props, obs_property_t* property, void* data);
#endif
bool is_provider_available(denoising_provider);
denoising_provider find_ideal_provider();

View File

@ -0,0 +1,9 @@
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
cmake_minimum_required(VERSION 3.26)
project("DynamicMask")
list(APPEND CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
streamfx_add_component("Dynamic Mask")

View File

@ -158,11 +158,11 @@ void dynamic_mask_instance::update(obs_data_t* settings)
}
std::string chv_key = std::string(ST_KEY_CHANNEL_VALUE) + "." + kv1.second;
found->second.value = static_cast<float_t>(obs_data_get_double(settings, chv_key.c_str()));
found->second.value = static_cast<float>(obs_data_get_double(settings, chv_key.c_str()));
_precalc.base.ptr[static_cast<size_t>(kv1.first)] = found->second.value;
std::string chm_key = std::string(ST_KEY_CHANNEL_MULTIPLIER) + "." + kv1.second;
found->second.scale = static_cast<float_t>(obs_data_get_double(settings, chm_key.c_str()));
found->second.scale = static_cast<float>(obs_data_get_double(settings, chm_key.c_str()));
_precalc.scale.ptr[static_cast<size_t>(kv1.first)] = found->second.scale;
vec4* ch = &_precalc.matrix.x;
@ -185,7 +185,7 @@ void dynamic_mask_instance::update(obs_data_t* settings)
for (auto kv2 : channel_translations) {
std::string ab_key = std::string(ST_KEY_CHANNEL_INPUT) + "." + kv1.second + "." + kv2.second;
found->second.values.ptr[static_cast<size_t>(kv2.first)] = static_cast<float_t>(obs_data_get_double(settings, ab_key.c_str()));
found->second.values.ptr[static_cast<size_t>(kv2.first)] = static_cast<float>(obs_data_get_double(settings, ab_key.c_str()));
ch->ptr[static_cast<size_t>(kv2.first)] = found->second.values.ptr[static_cast<size_t>(kv2.first)];
}
}
@ -721,11 +721,9 @@ obs_properties_t* dynamic_mask_factory::get_properties2(dynamic_mask_instance* d
_translation_cache.clear();
#ifdef ENABLE_FRONTEND
{
obs_properties_add_button2(props, S_MANUAL_OPEN, D_TRANSLATE(S_MANUAL_OPEN), streamfx::filter::dynamic_mask::dynamic_mask_factory::on_manual_open, nullptr);
}
#endif
{ // Input
p = obs_properties_add_list(props, ST_KEY_INPUT, D_TRANSLATE(ST_I18N_INPUT), OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
@ -806,7 +804,6 @@ std::string dynamic_mask_factory::translate_string(const char* format, ...)
return std::string(buffer.data(), buffer.data() + len);
}
#ifdef ENABLE_FRONTEND
bool dynamic_mask_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try {
@ -820,7 +817,6 @@ bool dynamic_mask_factory::on_manual_open(obs_properties_t* props, obs_property_
return false;
}
}
#endif
std::shared_ptr<dynamic_mask_factory> dynamic_mask_factory::instance()
{

View File

@ -72,8 +72,8 @@ namespace streamfx::filter::dynamic_mask {
int64_t _debug_texture;
struct channel_data {
float_t value = 0.0;
float_t scale = 1.0;
float value = 0.0;
float scale = 1.0;
vec4 values = {0, 0, 0, 0};
};
std::map<channel, channel_data> _channels;
@ -94,7 +94,7 @@ namespace streamfx::filter::dynamic_mask {
virtual void save(obs_data_t* settings) override;
virtual gs_color_space video_get_color_space(size_t count, const gs_color_space* preferred_spaces) override;
virtual void video_tick(float_t time) override;
virtual void video_tick(float time) override;
virtual void video_render(gs_effect_t* effect) override;
void enum_active_sources(obs_source_enum_proc_t enum_callback, void* param) override;
@ -124,9 +124,7 @@ namespace streamfx::filter::dynamic_mask {
std::string translate_string(const char* format, ...);
#ifdef ENABLE_FRONTEND
static bool on_manual_open(obs_properties_t* props, obs_property_t* property, void* data);
#endif
public: // Singleton
static void initialize();

View File

@ -0,0 +1,27 @@
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
cmake_minimum_required(VERSION 3.26)
project("FFmpeg")
list(APPEND CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
streamfx_add_component(${PROJECT_NAME})
find_package("FFmpeg"
COMPONENTS "avutil" "avcodec" "swscale"
)
if(NOT FFmpeg_FOUND)
streamfx_disable_component(${COMPONENT_TARGET} "FFmpeg is not available.")
return()
else()
target_link_libraries(${COMPONENT_TARGET}
PUBLIC
${FFMPEG_LIBRARIES}
)
target_include_directories(${COMPONENT_TARGET}
PUBLIC
${FFMPEG_INCLUDE_DIRS}
)
endif()

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#include "av1.hpp"

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -1,6 +1,6 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2022 Carsten Braun <info@braun-cloud.de>
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -1030,11 +1030,9 @@ obs_properties_t* ffmpeg_factory::get_properties2(instance_t* data)
{
obs_properties_t* props = obs_properties_create();
#ifdef ENABLE_FRONTEND
{
obs_properties_add_button2(props, S_MANUAL_OPEN, D_TRANSLATE(S_MANUAL_OPEN), streamfx::encoder::ffmpeg::ffmpeg_factory::on_manual_open, this);
}
#endif
if (data) {
data->get_properties(props);
@ -1108,14 +1106,12 @@ obs_properties_t* ffmpeg_factory::get_properties2(instance_t* data)
return props;
}
#ifdef ENABLE_FRONTEND
bool ffmpeg_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
ffmpeg_factory* ptr = static_cast<ffmpeg_factory*>(data);
streamfx::open_url(ptr->_handler->help(ptr));
return false;
}
#endif
const AVCodec* ffmpeg_factory::get_avcodec()
{

View File

@ -129,9 +129,7 @@ namespace streamfx::encoder::ffmpeg {
obs_properties_t* get_properties2(instance_t* data) override;
#ifdef ENABLE_FRONTEND
static bool on_manual_open(obs_properties_t* props, obs_property_t* property, void* data);
#endif
public:
const AVCodec* get_avcodec();

View File

@ -1,7 +1,6 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
//--------------------------------------------------------------------------------//
// THIS FEATURE IS DEPRECATED. SUBMITTED PATCHES WILL BE REJECTED.
@ -136,7 +135,7 @@ bool streamfx::encoder::ffmpeg::amf::is_available()
#else
std::filesystem::path lib_name = std::filesystem::u8path("amfrt32.dll");
#endif
#elif defined(D_PLATFORM_LINUX)
#else
#if defined(D_PLATFORM_64BIT)
std::filesystem::path lib_name = std::filesystem::u8path("libamfrt64.so.1");
#else

View File

@ -1,8 +1,7 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020 Daniel Molkentin <daniel@molkentin.de>
// AUTOGENERATED COPYRIGHT HEADER END
#include "debug.hpp"
#include "common.hpp"

View File

@ -1,9 +1,8 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
// Copyright (C) 2022 Carsten Braun <info@braun-cloud.de>
// Copyright (C) 2022 lainon <GermanAizek@yandex.ru>
// Copyright (C) 2022-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#include "dnxhd.hpp"
#include "common.hpp"

View File

@ -1,8 +1,7 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
// Copyright (C) 2022 Carsten Braun <info@braun-cloud.de>
// Copyright (C) 2022-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
#pragma once
#include "encoders/encoder-ffmpeg.hpp"

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#include "handler.hpp"

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once
@ -19,6 +19,7 @@ namespace streamfx::encoder::ffmpeg {
struct handler {
handler(std::string codec);
virtual ~handler(){};
virtual bool has_keyframes(ffmpeg_factory* factory);
virtual bool has_threading(ffmpeg_factory* factory);

View File

@ -1,8 +1,7 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2022 lainon <GermanAizek@yandex.ru>
// AUTOGENERATED COPYRIGHT HEADER END
#include "nvenc.hpp"
#include "common.hpp"
@ -88,7 +87,7 @@ extern "C" {
#define ST_KEY_H265_PROFILE "H265.Profile"
#define ST_KEY_H265_TIER "H265.Tier"
#define ST_KEY_H264_LEVEL "H265.Level"
#define ST_KEY_H265_LEVEL "H265.Level"
using namespace streamfx::encoder::ffmpeg;
using namespace streamfx::encoder::codec;
@ -1045,7 +1044,7 @@ void nvenc_hevc::defaults(ffmpeg_factory* factory, obs_data_t* settings)
obs_data_set_default_string(settings, ST_KEY_H265_PROFILE, "");
obs_data_set_default_string(settings, ST_KEY_H265_TIER, "");
obs_data_set_default_string(settings, ST_KEY_H264_LEVEL, "auto");
obs_data_set_default_string(settings, ST_KEY_H265_LEVEL, "auto");
}
void nvenc_hevc::properties(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_properties_t* props)
@ -1061,6 +1060,17 @@ void nvenc_hevc::migrate(ffmpeg_factory* factory, ffmpeg_instance* instance, obs
{
nvenc::migrate(factory, instance, settings, version);
// Migrate:
// - all versions below 0.12.
// - all versions that are larger than 0.12, but smaller than 0.12.0.315.
// - no other version.
if ((version < STREAMFX_MAKE_VERSION(0, 12, 0, 0))
|| ((version > STREAMFX_MAKE_VERSION(0, 12, 0, 0)) && (version < STREAMFX_MAKE_VERSION(0, 12, 0, 315)))) {
// Accidentally had this stored int he wrong place. Oops.
obs_data_set_string(settings, ST_KEY_H265_LEVEL, obs_data_get_string(settings, ST_KEY_H264_LEVEL));
obs_data_unset_user_value(settings, ST_KEY_H264_LEVEL);
}
if (version < STREAMFX_MAKE_VERSION(0, 11, 1, 0)) {
// Profile
if (auto v = obs_data_get_int(settings, ST_KEY_H265_PROFILE); v != -1) {
@ -1092,7 +1102,7 @@ void nvenc_hevc::migrate(ffmpeg_factory* factory, ffmpeg_instance* instance, obs
}
// Level
obs_data_set_string(settings, ST_KEY_H264_LEVEL, "auto");
obs_data_set_string(settings, ST_KEY_H265_LEVEL, "auto");
}
}
@ -1110,7 +1120,7 @@ void nvenc_hevc::update(ffmpeg_factory* factory, ffmpeg_instance* instance, obs_
if (const char* v = obs_data_get_string(settings, ST_KEY_H265_TIER); v && (v[0] != '\0')) {
av_opt_set(context->priv_data, "tier", v, AV_OPT_SEARCH_CHILDREN);
}
if (const char* v = obs_data_get_string(settings, ST_KEY_H264_LEVEL); v && (v[0] != '\0')) {
if (const char* v = obs_data_get_string(settings, ST_KEY_H265_LEVEL); v && (v[0] != '\0')) {
av_opt_set(context->priv_data, "level", v, AV_OPT_SEARCH_CHILDREN);
}
}
@ -1172,7 +1182,7 @@ void nvenc_hevc::properties_encoder(ffmpeg_factory* factory, ffmpeg_instance* in
});
}
{
auto p = obs_properties_add_list(grp, ST_KEY_H264_LEVEL, D_TRANSLATE(S_CODEC_HEVC_LEVEL), OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
auto p = obs_properties_add_list(grp, ST_KEY_H265_LEVEL, D_TRANSLATE(S_CODEC_HEVC_LEVEL), OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
streamfx::ffmpeg::tools::avoption_list_add_entries(context->priv_data, "level", [&p](const AVOption* opt) {
if (opt->default_val.i64 == 0) {

View File

@ -1,7 +1,6 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#include "prores_aw.hpp"
#include "common.hpp"

View File

@ -1,7 +1,6 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once
#include "encoders/encoder-ffmpeg.hpp"

View File

@ -0,0 +1,9 @@
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
cmake_minimum_required(VERSION 3.26)
project("Mirror")
list(APPEND CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
streamfx_add_component("Mirror")

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2019-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2022 lainon <GermanAizek@yandex.ru>
// AUTOGENERATED COPYRIGHT HEADER END
@ -140,7 +140,7 @@ void mirror_instance::save(obs_data_t* data)
}
}
void mirror_instance::video_tick(float_t time) {}
void mirror_instance::video_tick(float time) {}
void mirror_instance::video_render(gs_effect_t* effect)
{
@ -316,11 +316,9 @@ obs_properties_t* mirror_factory::get_properties2(mirror_instance* data)
obs_properties_t* pr = obs_properties_create();
obs_property_t* p = nullptr;
#ifdef ENABLE_FRONTEND
{
obs_properties_add_button2(pr, S_MANUAL_OPEN, D_TRANSLATE(S_MANUAL_OPEN), streamfx::source::mirror::mirror_factory::on_manual_open, nullptr);
}
#endif
{
p = obs_properties_add_list(pr, ST_KEY_SOURCE, D_TRANSLATE(ST_I18N_SOURCE), OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
@ -365,7 +363,6 @@ obs_properties_t* mirror_factory::get_properties2(mirror_instance* data)
return pr;
}
#ifdef ENABLE_FRONTEND
bool mirror_factory::on_manual_open(obs_properties_t* props, obs_property_t* property, void* data)
{
try {
@ -379,7 +376,6 @@ bool mirror_factory::on_manual_open(obs_properties_t* props, obs_property_t* pro
return false;
}
}
#endif
std::shared_ptr<mirror_factory> mirror_factory::instance()
{

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2019-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once
@ -55,7 +55,7 @@ namespace streamfx::source::mirror {
virtual void update(obs_data_t*) override;
virtual void save(obs_data_t*) override;
virtual void video_tick(float_t) override;
virtual void video_tick(float) override;
virtual void video_render(gs_effect_t*) override;
virtual void enum_active_sources(obs_source_enum_proc_t, void*) override;
@ -81,9 +81,7 @@ namespace streamfx::source::mirror {
virtual obs_properties_t* get_properties2(source::mirror::mirror_instance* data) override;
#ifdef ENABLE_FRONTEND
static bool on_manual_open(obs_properties_t* props, obs_property_t* property, void* data);
#endif
public: // Singleton
static void initialize();

View File

@ -0,0 +1,48 @@
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
cmake_minimum_required(VERSION 3.26)
project("NVIDIA")
list(APPEND CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}] ")
#- NVIDIA Audio Effects SDK
if(NOT TARGET NVIDIA::AFX)
add_library(NVIDIA::AFX IMPORTED INTERFACE)
target_include_directories(NVIDIA::AFX
INTERFACE
"${StreamFX_SOURCE_DIR}/third-party/nvidia-maxine-afx-sdk/nvafx/include/"
)
endif()
#- NVIDIA Augmented Reality SDK
if(NOT TARGET NVIDIA::AR)
add_library(NVIDIA::AR IMPORTED INTERFACE)
target_include_directories(NVIDIA::AR
INTERFACE
"${StreamFX_SOURCE_DIR}/third-party/nvidia-maxine-ar-sdk/nvar/include/"
"${StreamFX_SOURCE_DIR}/third-party/nvidia-maxine-ar-sdk/nvar/src/"
)
endif()
#- NVIDIA Video Effects SDK
if(NOT TARGET NVIDIA::VFX)
add_library(NVIDIA::VFX IMPORTED INTERFACE)
target_include_directories(NVIDIA::VFX
INTERFACE
"${StreamFX_SOURCE_DIR}/third-party/nvidia-maxine-vfx-sdk/nvvfx/include/"
"${StreamFX_SOURCE_DIR}/third-party/nvidia-maxine-vfx-sdk/nvvfx/src/"
)
endif()
streamfx_add_component("NVIDIA")
target_link_libraries(${COMPONENT_TARGET}
PRIVATE
NVIDIA::AFX
NVIDIA::AR
NVIDIA::VFX
)
if(NOT D_PLATFORM_WINDOWS)
streamfx_disable_component("NVIDIA" REASON "NVIDIA integration is (currently) only available for Windows under Direct3D11.")
endif()

View File

@ -32,58 +32,58 @@ namespace streamfx::nvidia::ar {
}
public /* Int32 */:
inline cv::result set(parameter_t param, uint32_t const value)
inline cv::result set_uint32(parameter_t param, uint32_t const value)
{
return _nvar->NvAR_SetU32(_fx.get(), param, value);
}
inline cv::result get(parameter_t param, uint32_t* value)
inline cv::result get_uint32(parameter_t param, uint32_t* value)
{
return _nvar->NvAR_GetU32(_fx.get(), param, value);
}
inline cv::result set(parameter_t param, int32_t const value)
inline cv::result set_int32(parameter_t param, int32_t const value)
{
return _nvar->NvAR_SetS32(_fx.get(), param, value);
}
inline cv::result get(parameter_t param, int32_t* value)
inline cv::result get_int32(parameter_t param, int32_t* value)
{
return _nvar->NvAR_GetS32(_fx.get(), param, value);
}
public /* Int64 */:
inline cv::result set(parameter_t param, uint64_t const value)
inline cv::result set_uint64(parameter_t param, uint64_t const value)
{
return _nvar->NvAR_SetU64(_fx.get(), param, value);
}
inline cv::result get(parameter_t param, uint64_t* value)
inline cv::result get_uint64(parameter_t param, uint64_t* value)
{
return _nvar->NvAR_GetU64(_fx.get(), param, value);
}
public /* Float32 */:
inline cv::result set(parameter_t param, float const value)
inline cv::result set_float32(parameter_t param, float const value)
{
return _nvar->NvAR_SetF32(_fx.get(), param, value);
}
inline cv::result get(parameter_t param, float* value)
inline cv::result get_float32(parameter_t param, float* value)
{
return _nvar->NvAR_GetF32(_fx.get(), param, value);
}
inline cv::result set(parameter_t param, float* const value, int32_t size)
inline cv::result set_float32array(parameter_t param, float* const value, int32_t size)
{
return _nvar->NvAR_SetF32Array(_fx.get(), param, value, static_cast<int32_t>(size));
}
inline cv::result get(parameter_t param, const float* value, int32_t size)
inline cv::result get_float32array(parameter_t param, const float* value, int32_t size)
{
return _nvar->NvAR_GetF32Array(_fx.get(), param, &value, &size);
}
inline cv::result set(parameter_t param, std::vector<float> const& value)
inline cv::result set_float32array(parameter_t param, std::vector<float> const& value)
{
return _nvar->NvAR_SetF32Array(_fx.get(), param, value.data(), static_cast<int32_t>(value.size()));
}
inline cv::result get(parameter_t param, std::vector<float>& value)
inline cv::result get_float32array(parameter_t param, std::vector<float>& value)
{
const float* data;
int32_t size;
@ -98,71 +98,71 @@ namespace streamfx::nvidia::ar {
}
public /* Float64 */:
inline cv::result set(parameter_t param, double const value)
inline cv::result set_float64(parameter_t param, double const value)
{
return _nvar->NvAR_SetF64(_fx.get(), param, value);
}
inline cv::result get(parameter_t param, double* value)
inline cv::result get_float64(parameter_t param, double* value)
{
return _nvar->NvAR_GetF64(_fx.get(), param, value);
}
public /* String */:
inline cv::result set(parameter_t param, const char* const value)
inline cv::result set_string(parameter_t param, const char* const value)
{
return _nvar->NvAR_SetString(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, const char*& value)
inline cv::result get_string(parameter_t param, const char*& value)
{
return _nvar->NvAR_GetString(_fx.get(), param, &value);
};
inline cv::result set(parameter_t param, std::string_view const value)
inline cv::result set_string(parameter_t param, std::string_view const value)
{
return _nvar->NvAR_SetString(_fx.get(), param, value.data());
};
cv::result get(parameter_t param, std::string_view& value);
inline cv::result set(parameter_t param, std::string const& value)
inline cv::result set_string(parameter_t param, std::string const& value)
{
return _nvar->NvAR_SetString(_fx.get(), param, value.c_str());
};
cv::result get(parameter_t param, std::string& value);
public /* CUDA Stream */:
inline cv::result set(parameter_t param, cuda::stream_t const value)
inline cv::result set_cuda_stream(parameter_t param, cuda::stream_t const value)
{
return _nvar->NvAR_SetCudaStream(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, cuda::stream_t& value)
inline cv::result get_cuda_stream(parameter_t param, cuda::stream_t& value)
{
return _nvar->NvAR_GetCudaStream(_fx.get(), param, &value);
};
inline cv::result set(parameter_t param, std::shared_ptr<::streamfx::nvidia::cuda::stream> const value)
inline cv::result set_cuda_stream(parameter_t param, std::shared_ptr<::streamfx::nvidia::cuda::stream> const value)
{
return _nvar->NvAR_SetCudaStream(_fx.get(), param, value->get());
}
//inline cv::result get(parameter_t param, std::shared_ptr<::streamfx::nvidia::cuda::stream> value);
public /* CV Image */:
inline cv::result set(parameter_t param, cv::image_t& value)
inline cv::result set_image(parameter_t param, cv::image_t& value)
{
return _nvar->NvAR_SetObject(_fx.get(), param, &value, sizeof(cv::image_t));
};
inline cv::result get(parameter_t param, cv::image_t*& value)
inline cv::result get_image(parameter_t param, cv::image_t*& value)
{
return _nvar->NvAR_GetObject(_fx.get(), param, reinterpret_cast<object_t*>(&value), sizeof(cv::image_t));
};
inline cv::result set(parameter_t param, std::shared_ptr<cv::image> const value)
inline cv::result set_image(parameter_t param, std::shared_ptr<cv::image> const value)
{
return _nvar->NvAR_SetObject(_fx.get(), param, value->get_image(), sizeof(cv::image_t));
};
//inline cv::result get(parameter_t param, std::shared_ptr<cv::image>& value);
public /* CV Texture */:
inline cv::result set(parameter_t param, std::shared_ptr<cv::texture> const value)
inline cv::result set_image(parameter_t param, std::shared_ptr<cv::texture> const value)
{
return _nvar->NvAR_SetObject(_fx.get(), param, value->get_image(), sizeof(cv::image_t));
};

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2022 lainon <GermanAizek@yandex.ru>
// AUTOGENERATED COPYRIGHT HEADER END

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2017-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -1,5 +1,5 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#pragma once

View File

@ -39,137 +39,137 @@ namespace streamfx::nvidia::vfx {
}
public /* Int32 */:
inline cv::result set(parameter_t param, uint32_t const value)
inline cv::result set_uint32(parameter_t param, uint32_t const value)
{
return _nvvfx->NvVFX_SetU32(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, uint32_t& value)
}
inline cv::result get_uint32(parameter_t param, uint32_t& value)
{
return _nvvfx->NvVFX_GetU32(_fx.get(), param, &value);
};
}
inline cv::result set(parameter_t param, int32_t const value)
inline cv::result set_int32(parameter_t param, int32_t const value)
{
return _nvvfx->NvVFX_SetS32(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, int32_t& value)
}
inline cv::result get_int32(parameter_t param, int32_t& value)
{
return _nvvfx->NvVFX_GetS32(_fx.get(), param, &value);
};
}
public /* Int64 */:
inline cv::result set(parameter_t param, uint64_t const value)
inline cv::result set_uint64(parameter_t param, uint64_t const value)
{
return _nvvfx->NvVFX_SetU64(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, uint64_t& value)
}
inline cv::result get_uint64(parameter_t param, uint64_t& value)
{
return _nvvfx->NvVFX_GetU64(_fx.get(), param, &value);
};
}
public /* Float32 */:
inline cv::result set(parameter_t param, float const value)
inline cv::result set_float32(parameter_t param, float const value)
{
return _nvvfx->NvVFX_SetF32(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, float& value)
}
inline cv::result get_float32(parameter_t param, float& value)
{
return _nvvfx->NvVFX_GetF32(_fx.get(), param, &value);
};
}
public /* Float64 */:
inline cv::result set(parameter_t param, double const value)
inline cv::result set_float64(parameter_t param, double const value)
{
return _nvvfx->NvVFX_SetF64(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, double& value)
}
inline cv::result get_float64(parameter_t param, double& value)
{
return _nvvfx->NvVFX_GetF64(_fx.get(), param, &value);
};
}
public /* String */:
inline cv::result set(parameter_t param, const char* const value)
inline cv::result set_string(parameter_t param, const char* const value)
{
return _nvvfx->NvVFX_SetString(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, const char*& value)
}
inline cv::result get_string(parameter_t param, const char*& value)
{
return _nvvfx->NvVFX_GetString(_fx.get(), param, &value);
};
}
inline cv::result set(parameter_t param, std::string_view const& value)
inline cv::result set_string(parameter_t param, std::string_view const& value)
{
return _nvvfx->NvVFX_SetString(_fx.get(), param, value.data());
};
cv::result get(parameter_t param, std::string_view& value);
}
cv::result get_string(parameter_t param, std::string_view& value);
inline cv::result set(parameter_t param, std::string const& value)
inline cv::result set_string(parameter_t param, std::string const& value)
{
return _nvvfx->NvVFX_SetString(_fx.get(), param, value.c_str());
};
cv::result get(parameter_t param, std::string& value);
}
cv::result get_string(parameter_t param, std::string& value);
public /* CUDA Stream */:
inline cv::result set(parameter_t param, cuda::stream_t const& value)
inline cv::result set_cuda_stream(parameter_t param, cuda::stream_t const& value)
{
return _nvvfx->NvVFX_SetCudaStream(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, cuda::stream_t& value)
}
inline cv::result get_cuda_stream(parameter_t param, cuda::stream_t& value)
{
return _nvvfx->NvVFX_GetCudaStream(_fx.get(), param, &value);
};
}
inline cv::result set(parameter_t param, std::shared_ptr<cuda::stream> const& value)
inline cv::result set_cuda_stream(parameter_t param, std::shared_ptr<cuda::stream> const& value)
{
return _nvvfx->NvVFX_SetCudaStream(_fx.get(), param, value->get());
};
}
//cv::result get_stream(parameter_t param, std::shared_ptr<cuda::stream>& value);
public /* CV Image */:
inline cv::result set(parameter_t param, cv::image_t* value)
inline cv::result set_image(parameter_t param, cv::image_t* value)
{
return _nvvfx->NvVFX_SetImage(_fx.get(), param, value);
};
inline cv::result get(parameter_t param, cv::image_t* value)
}
inline cv::result get_image(parameter_t param, cv::image_t* value)
{
return _nvvfx->NvVFX_GetImage(_fx.get(), param, value);
};
}
inline cv::result set(parameter_t param, std::shared_ptr<cv::image> const& value)
inline cv::result set_image(parameter_t param, std::shared_ptr<cv::image> const& value)
{
return _nvvfx->NvVFX_SetImage(_fx.get(), param, value->get_image());
};
inline cv::result get(parameter_t param, std::shared_ptr<cv::image>& value)
}
inline cv::result get_image(parameter_t param, std::shared_ptr<cv::image>& value)
{
return _nvvfx->NvVFX_GetImage(_fx.get(), param, value->get_image());
};
}
public /* CV Texture */:
inline cv::result set(parameter_t param, std::shared_ptr<cv::texture> const& value)
inline cv::result set_image(parameter_t param, std::shared_ptr<cv::texture> const& value)
{
return _nvvfx->NvVFX_SetImage(_fx.get(), param, value->get_image());
};
}
//cv::result get(parameter_t param, std::shared_ptr<cv::texture>& value);
public /* Objects */:
inline cv::result set_object(parameter_t param, void* const value)
{
return _nvvfx->NvVFX_SetObject(_fx.get(), param, value);
};
}
inline cv::result get_object(parameter_t param, void*& value)
{
return _nvvfx->NvVFX_GetObject(_fx.get(), param, &value);
};
}
public /* Control */:
inline cv::result load()
{
return _nvvfx->NvVFX_Load(_fx.get());
};
}
inline cv::result run(bool async = false)
{
return _nvvfx->NvVFX_Run(_fx.get(), async ? 1 : 0);
};
}
};
} // namespace streamfx::nvidia::vfx

View File

@ -3,7 +3,7 @@
// Copyright (C) 2022 lainon <GermanAizek@yandex.ru>
// AUTOGENERATED COPYRIGHT HEADER END
#include "nvidia-ar-facedetection.hpp"
#include "nvidia/ar/nvidia-ar-facedetection.hpp"
#include "obs/gs/gs-helper.hpp"
#include "util/util-logging.hpp"
@ -40,11 +40,6 @@ streamfx::nvidia::ar::facedetection::facedetection() : feature(FEATURE_FACE_DETE
{
D_LOG_DEBUG("Initializing... (Addr: 0x%" PRIuPTR ")", this);
// Assign CUDA Stream object.
if (auto err = set(P_NVAR_CONFIG "CUDAStream", _nvcuda->get_stream()); err != cv::result::SUCCESS) {
throw cv::exception("CUDAStream", err);
}
// Prepare initial memory
_rects.resize(ST_MAX_TRACKED_FACES);
_rects_confidence.resize(ST_MAX_TRACKED_FACES);
@ -86,10 +81,10 @@ void ar::facedetection::set_tracking_limit(size_t v)
if (auto err = set_object(P_NVAR_OUTPUT "BoundingBoxes", reinterpret_cast<void*>(&_bboxes), sizeof(bounds_t)); err != cv::result::SUCCESS) {
throw cv::exception("BoundingBoxes", err);
}
if (auto err = set(P_NVAR_OUTPUT "BoundingBoxesConfidence", _rects_confidence); err != cv::result::SUCCESS) {
if (auto err = set_float32array(P_NVAR_OUTPUT "BoundingBoxesConfidence", _rects_confidence); err != cv::result::SUCCESS) {
throw cv::exception("BoundingBoxesConfidence", err);
}
if (auto err = set(P_NVAR_CONFIG "Temporal", (v == 1)); err != cv::result::SUCCESS) {
if (auto err = set_uint32(P_NVAR_CONFIG "Temporal", (v == 1)); err != cv::result::SUCCESS) {
throw cv::exception("Temporal", err);
}
@ -189,7 +184,7 @@ void ar::facedetection::resize(uint32_t width, uint32_t height)
_source = std::make_shared<::streamfx::nvidia::cv::image>(width, height, ::streamfx::nvidia::cv::pixel_format::BGR, ::streamfx::nvidia::cv::component_type::UINT8, ::streamfx::nvidia::cv::component_layout::INTERLEAVED, ::streamfx::nvidia::cv::memory_location::GPU, 1);
}
if (auto err = set(P_NVAR_INPUT "Image", _source); err != cv::result::SUCCESS) {
if (auto err = set_image(P_NVAR_INPUT "Image", _source); err != cv::result::SUCCESS) {
throw cv::exception("Image", err);
}
@ -203,7 +198,7 @@ void streamfx::nvidia::ar::facedetection::load()
auto cctx = ::streamfx::nvidia::cuda::obs::get()->get_context()->enter();
// Assign CUDA Stream object.
if (auto err = set(P_NVAR_CONFIG "CUDAStream", _nvcuda->get_stream()); err != cv::result::SUCCESS) {
if (auto err = set_cuda_stream(P_NVAR_CONFIG "CUDAStream", _nvcuda->get_stream()); err != cv::result::SUCCESS) {
throw cv::exception("CUDAStream", err);
}

View File

@ -1,8 +1,8 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#include "nvidia-ar-feature.hpp"
#include "nvidia/ar/nvidia-ar-feature.hpp"
#include "obs/gs/gs-helper.hpp"
#include "util/util-logging.hpp"
#include "util/util-platform.hpp"
@ -40,15 +40,15 @@ streamfx::nvidia::ar::feature::feature(feature_t feature) : _nvcuda(::streamfx::
_fx = std::shared_ptr<void>(handle, [this](::streamfx::nvidia::ar::handle_t handle) { _nvar->NvAR_Destroy(handle); });
// Set CUDA stream and model directory.
set(P_NVAR_CONFIG "CUDAStream", _nvcuda->get_stream());
set_cuda_stream(P_NVAR_CONFIG "CUDAStream", _nvcuda->get_stream());
_model_path = _nvar->get_model_path().generic_u8string();
set(P_NVAR_CONFIG "ModelDir", _model_path);
set_string(P_NVAR_CONFIG "ModelDir", _model_path);
}
streamfx::nvidia::cv::result streamfx::nvidia::ar::feature::get(parameter_t param, std::string_view& value)
{
const char* cvalue = nullptr;
cv::result res = get(param, cvalue);
cv::result res = get_string(param, cvalue);
if (res == cv::result::SUCCESS) {
if (cvalue) {
value = std::string_view(cvalue);
@ -62,7 +62,7 @@ streamfx::nvidia::cv::result streamfx::nvidia::ar::feature::get(parameter_t para
streamfx::nvidia::cv::result streamfx::nvidia::ar::feature::get(parameter_t param, std::string& value)
{
const char* cvalue = nullptr;
cv::result res = get(param, cvalue);
cv::result res = get_string(param, cvalue);
if (res == cv::result::SUCCESS) {
if (cvalue) {
value = cvalue;

View File

@ -1,8 +1,8 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#include "nvidia-ar.hpp"
#include "nvidia/ar/nvidia-ar.hpp"
#include "nvidia/cuda/nvidia-cuda-obs.hpp"
#include "obs/gs/gs-helper.hpp"
#include "util/util-logging.hpp"

View File

@ -2,7 +2,7 @@
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#include "nvidia-cuda-context.hpp"
#include "nvidia/cuda/nvidia-cuda-context.hpp"
#include "util/util-logging.hpp"
#include "warning-disable.hpp"

Some files were not shown because too many files have changed in this diff Show More