Commit Graph

869 Commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks ba61329dd1 ui: Prevent Qt from automatically assigning Menu roles
Qt defaults to give every QAction a TextHeuristicRole, which means that certain key words will cause Qt to change how the QAction behaves. We do not want this, so we explicitly assign it to have NoRole instead.

Fixes #323
2023-03-28 13:11:21 +02:00
Michael Fabian 'Xaymar' Dirks 465158476a ui: Insert StreamFX menu before OBS "Help" menu
Instead of adding ourselves as the last entry which seems to confuse the MacOS Qt implementation, we instead insert ourselves before the Help menu. This should hopefully prevent the StreamFX menu from overriding the OBS About entry.

Fixes #323
2023-03-28 13:11:20 +02:00
Michael Fabian 'Xaymar' Dirks f01d2e6db1 filters/sdf-effects: Improve user experience with visual property groups
Grouping properties by what they do improves the user experience as the user does not have to guess at what belongs to which part of the effect. Additionally toggleable groups automatically disable all child elements, so the user is not confused by them still being active.
2023-03-28 13:11:20 +02:00
Michael Fabian 'Xaymar' Dirks a8c8d3beaa filters/displacement: Permanently deprecate the filter 2023-03-28 13:11:20 +02:00
Michael Fabian 'Xaymar' Dirks 5a65cf3525 plugin: Replace long descriptions with "Open Manual" button
While the long descriptions were useful, keeping the updated and translated is pretty much impossible. Technology moves fast and not everyone that translates the project knows a lot about technology.

Therefore the long descriptions have now been replaced with a button that opens the wiki page for the feature instead. This should drastically reduce the number of help cases, and improve the translation coverage at the same time.
2023-03-28 13:11:20 +02:00
Michael Fabian 'Xaymar' Dirks 48ba34538e plugin: Add function to open an URL 2023-03-28 13:11:19 +02:00
Michael Fabian 'Xaymar' Dirks 21d455b674 filters/color-grading: Add proper suffixes to UI properties 2023-03-28 13:11:19 +02:00
Michael Fabian 'Xaymar' Dirks cd7f45eec4 source/shader: Fix missing buffered draw requirement (#516)
Fixes #516
2023-03-28 13:11:19 +02:00
Michael Fabian 'Xaymar' Dirks b324ed2b28 filters/color-grading: Adjust range for Lift and Gain (#515)
Fixes #515
2023-03-28 13:11:19 +02:00
Michael Fabian 'Xaymar' Dirks 0a44333c11 transition/shader: Use direct rendering (#501) 2023-03-28 13:11:17 +02:00
Michael Fabian 'Xaymar' Dirks a2f518224f source/shader: Use direct rendering (#501) 2023-03-28 13:11:17 +02:00
Michael Fabian 'Xaymar' Dirks 4a3d1d4fa5 filter/shader: Use direct rendering (#501) 2023-03-28 13:11:17 +02:00
Michael Fabian 'Xaymar' Dirks e7dd44e3ec gfx/shader: Allow specifying effect for direct rendering (#501) 2023-03-28 13:11:17 +02:00
Michael Fabian 'Xaymar' Dirks 4e21830627 filter/dynamic-mask: Require buffered rendering 2023-03-28 13:11:17 +02:00
Michael Fabian 'Xaymar' Dirks ed92e7390a filter/displacement: Require buffered rendering 2023-03-28 13:11:16 +02:00
Michael Fabian 'Xaymar' Dirks 29d60180cc filter/color-grade: Add direct rendering support (#501) 2023-03-28 13:11:16 +02:00
Michael Fabian 'Xaymar' Dirks 4c082ad3a9 filters/color-grade: Fix support for translucent Inputs
Additionally also document some of the code and enforce certain GPU states for rendering.
2023-03-28 13:11:16 +02:00
Michael Fabian 'Xaymar' Dirks 303c14de4e ffmpeg/tools: Fix incorrect transfer characteristics
Both Rec. 601 and sRGB looked extremely wrong before, resulting in weird or warped colors. Since it is very difficult to find up to date and accurate information on standards, we should simply go for what has the most widespread support.
2023-03-28 13:11:12 +02:00
Michael Fabian 'Xaymar' Dirks 1909ee01d6 obs/gs/vertex: Don't include unused headers 2023-03-28 13:11:12 +02:00
Michael Fabian 'Xaymar' Dirks b0ac0b724a nvidia/cuda: Use reinterpret_case instead of static_cast 2023-03-28 13:11:12 +02:00
Michael Fabian 'Xaymar' Dirks 26a76e0451 filters/color-grade: Redesign for use with LUTs
There is hardly any reason for us to recalculate everything all the time. LUTs can cache the work once, and then re-use it every time necessary, drastically reducing the impact of Color Grading by almost 60% (on some GPUs even more). Additionally this fixes the negative gamma issue, which plagued the filter for a while.

In the future, once PR 4199 (https://github.com/obsproject/obs-studio/pull/4199) has been merged, we can cut away one intermediate rendering step currently required to make the effect work. Hopefully this will be with the 27.x release of OBS Studio.
2023-03-28 13:11:11 +02:00
Michael Fabian 'Xaymar' Dirks eba0a467d5 gfx/lut: Add a simple but efficient LUT producer and consumer
For simple image and video editing, LUTs (Look-Up Tables) are vastly superior to running the entire editing operation on each pixel - especially if all the processing can be done inside a single shader.

Due to the post-processing requirements for our LUTs, we are limited to 8 bits per channel - though clever use of the unused Alpha channel may result in additional space. For our purposes however, this is definitely enough.
2023-03-28 13:11:11 +02:00
tytan652 6ccac3331a ui: Don't reference Updater if it's been disabled
Merges #446
2023-03-28 13:11:10 +02:00
Michael Fabian 'Xaymar' Dirks 5ac894c59c cmake: Refactor component and dependency system
A complete redesign of the component and dependency system is necessary in order to support additional platforms, such as MacOS and other Linux platforms. Additionally it results in a much cleaner code base, which is less confusing overall.

Eventually it might be necessary to push components of StreamFX into their own CMake projects, as it is getting kind of complex now. Especially with the push for a proper plugin manager, things get dicey for big plugins like StreamFX.
2023-03-28 13:11:10 +02:00
Michael Fabian 'Xaymar' Dirks b8ff72d6c8 sources/mirror: Clamp minimum size to 1x1
This works around an issue in our code with asynchronous or delayed sources.
2023-03-28 13:11:10 +02:00
Michael Fabian 'Xaymar' Dirks 675186a737 ui: Fix additional Qt issues 2023-03-28 13:11:07 +02:00
Xaymar 2c37e19266 ui/updater: Don't require Qt interaction before OBS is ready (#427)
Fixes one of the launch freezes caused by StreamFX due to interaction with the Qt message loop.
2023-03-28 13:11:07 +02:00
Michael Fabian 'Xaymar' Dirks e7992cd776 source/mirror: Don't ignore data in initializer 2023-03-28 13:11:07 +02:00
Michael Fabian 'Xaymar' Dirks 3c2fbf2dc4 filter/shader: Initialize with given data
Ignoring the data parameter during initialization results in duplication and some third party plugins not working as expected, so it's better to not ignore it.

Fixes #315
2023-03-28 13:11:06 +02:00
Michael Fabian 'Xaymar' Dirks 17ffbdc55e gfx/shader: Correctly cache shader rendering result
Fixes #392
2023-03-28 13:11:06 +02:00
Michael Fabian 'Xaymar' Dirks ff3f8cff03 encoders/ffmpeg: Implement AMF H.264 and H.265 handlers
Adds support for the AMD Advanced Media Framework H.264 and H.265 encoders via FFmpeg. The majority of settings are supported, and the UI/UX experience mimics that of the NVENC implementation. Various settings are left out due to their complexity and should be controlled via the custom parameters field.
2023-03-28 13:11:06 +02:00
Michael Fabian 'Xaymar' Dirks 79ef573f5b filter/dynamic-mask: Explicitly increase showing/active references
Fixes #384
2023-03-28 13:11:05 +02:00
Michael Fabian 'Xaymar' Dirks 716da4f6cc obs/tools: Add active_source and visible_source helpers
These classes help us manage active and showing references to a source, which seem to be necessary for filters.
2023-03-28 13:11:05 +02:00
Michael Fabian 'Xaymar' Dirks ad33066cd3 filter/blur: Fix unicode support
Related: #359
2023-03-28 13:11:05 +02:00
Michael Fabian 'Xaymar' Dirks e2d342818a filter/color-grade: Fix unicode support
Related: #359
2023-03-28 13:11:05 +02:00
Michael Fabian 'Xaymar' Dirks 576606c712 filter/displacement: Fix unicode support
Related: #359
2023-03-28 13:11:05 +02:00
Michael Fabian 'Xaymar' Dirks 3da4526795 filter/dynamic-mask: Fix unicode support
Related: #359
2023-03-28 13:11:05 +02:00
Michael Fabian 'Xaymar' Dirks 785ffa0b7d filter/sdf-effects: Fix unicode support
Related: #359
2023-03-28 13:11:05 +02:00
Michael Fabian 'Xaymar' Dirks 54127f6ced gfx/shader: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks aacb1d41bc obs/gs/effect: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks cc1b9c1559 obs/gs/mipmapper: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks 0a71af9d6a util/library: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks 55ad82aac0 gfx/blur: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks 71a969c30f configuration: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks 4de094511a plugin: Implement proper functions to get config and data files
Using the obs_module_file and obs_module_config_path macros works okay, but it comes with a slight overhead as well as additional requirements when passing it to C++ functions that expect certain rules to be fulfilled. By instead wrapping the actual functionality into our own functions and using those we can avoid most of the issues that come with the old approach.

Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks f796c85527 util/bitmask: Move bitmask functionality its own file 2023-03-28 13:11:03 +02:00
Michael Fabian 'Xaymar' Dirks 7e7ed80a9a util/library: Use string_view instead of string
Slightly improves performance and reduces memory impact, as string data is not duplicated.
2023-03-28 13:11:03 +02:00
Michael Fabian 'Xaymar' Dirks 032a3c6deb obs/source-factory: Skip broken filter rendering by default
Fixes a black screen issue if a filter happens to run into an unexpected issue which it considers unrecoverable.
2023-03-28 13:11:03 +02:00
Michael Fabian 'Xaymar' Dirks d36e735bb1 util/curl: Add missing include for vector 2023-03-28 13:11:02 +02:00
Michael Fabian 'Xaymar' Dirks 74c621cde5 ui/updater: Set modal flag after hiding the dialog
This fixes a bug with older Qt versions which would not remove the modal window from the parent in the setModal() call, resulting in an unusable parent window.

Fixes #368
2023-03-28 13:11:02 +02:00
Michael Fabian 'Xaymar' Dirks e6cef83588 ui/updater: Always initialize members to zero 2023-03-28 13:11:02 +02:00
Daniel Molkentin 3d5e752139 encoders/handlers/debug: Always return something in to_string (#354) 2023-03-28 13:11:01 +02:00
Daniel Molkentin 2c8687f4b7 encoders/ffmpeg: Use correct parameter for log (#355) 2023-03-28 13:11:01 +02:00
Michael Fabian 'Xaymar' Dirks daa4a385d7 encoder/ffmpeg: Don't use hardware encoding for unsupported formats 2023-03-28 13:11:00 +02:00
Michael Fabian 'Xaymar' Dirks 6bc1a6b870 encoders/ffmpeg: Don't overwrite already correct settings 2023-03-28 13:11:00 +02:00
Michael Fabian 'Xaymar' Dirks 9938422d5c ffmpeg/tools: Set correct information when encoding
Improves the previous logic and makes it compatible with the new additions in 26.x, such as sRGB. This was previously broken as the focus was on existing features which could be tested without requiring a compiler to be installed.

Incorrect understanding of how sRGB works with RGB and YCC/YUV formats also caused sRGB to be treated as RGB when I444 was selected. This should also now be fixed, hopefully permanently.

Fixes #331
2023-03-28 13:11:00 +02:00
Michael Fabian 'Xaymar' Dirks 82413fd85c ui/updater: Apply workaround for OBS Studio checking for modals
In order to work around a bug in the OBS Studio UI code, we have to swap our modal status right before showing and right after hiding, so that the OBS Studio tray menu continuous working correctly. This is a bit of a weird solution, but it does work as expected.

Related: https://github.com/obsproject/obs-studio/issues/3518
2023-03-28 13:10:59 +02:00
Michael Fabian 'Xaymar' Dirks 07c892b6a4 ui/about: Fix incorrect icon for YouTube URL
Fixes #329
2023-03-28 12:52:28 +02:00
Michael Fabian 'Xaymar' Dirks f907fc80b0 updater: Add functionality to check for updates
Implements a manual and automatic update checker with support for both release and testing update channels, allowing users to stay as up to date as possible. It is fully compliant with privacy regulations around the world, as it stays completely silent and inactive until the user gives the Ok to connect to GitHub for the latest releases.
2023-03-28 12:52:27 +02:00
Michael Fabian 'Xaymar' Dirks 1107c1e390 util/curl: Add C++ wrapper for CURL 2023-03-28 12:52:27 +02:00
Michael Fabian 'Xaymar' Dirks 59950bec3b ui: Fix support for disambiguation in translations 2023-03-28 12:52:27 +02:00
Michael Fabian 'Xaymar' Dirks 36976cb550 util/threadpool: Don't hold work endlessly after processing it 2023-03-28 12:52:27 +02:00
Michael Fabian 'Xaymar' Dirks 0e1377f359 encoders/handlers/nvenc: Don't list encoders on unsupported systems
Removes the NVENC entry on systems without an NVIDIA GPU by checking if the library for it can be loaded. If it can't be loaded, it's likely that the user does not have a system with NVENC capabilities - and guaranteed that they can't use the encoder as FFmpeg relies on these libraries.
2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks 8306dc5b92 encoders/ffmpeg: Add function to get info object 2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks a39fd89ba7 util/library: Cross-platform handler for library loading
Adds a utility class and functions to load libraries and symbols from libraries somewhat safely. Libraries are immediately unloaded when the last reference to them is lost, so the shared_ptr should be stored if the library is actually needed.
2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks ab9d9e8443 encoders/handlers/nvenc: Make code C++ standard compliant again 2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks c445865111 encoders/ffmpeg: Support for FFmpeg versions older than 58.x 2023-03-28 12:52:23 +02:00
Michael Fabian 'Xaymar' Dirks 012027578a encoders/ffmpeg: Disable hardware path on Linux 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks 2f6070d7a2 encoders/handlers/prores_aw: Fix override warning 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks 6b57cdf019 encoders/codecs: Add missing includes 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks 66b1715d78 ffmpeg/tools: Fix compatibility with Ubuntu 18.04 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks 63a5873413 project: Remove non-standard std:: prefix from types 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks c20ac4a413 templates: Add generated configuration file 2023-03-28 12:52:21 +02:00
Michael Fabian 'Xaymar' Dirks f3b3af2030 ffmpeg/tools: Ensure we aren't comparing against a nullptr 2023-03-28 12:52:21 +02:00
Michael Fabian 'Xaymar' Dirks dbb9db596e project: Apply formatting 2023-03-28 12:52:21 +02:00
Michael Fabian 'Xaymar' Dirks f9f25dbd8a obs/gs/effect: Use the actual shared_ptr, not a pointer to it
Fixes several warnings and potential memory corruptions that could happen. Also makes the entire thing easier to read.
2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks dbb71cf801 project: Code cleanup and reapply formatting
Changes applied:

* Moved utility files to /util/.
* Removed unused #includes.
* Removed unused ::ffmpeg::tools function.
* Removed unused variables.
* Fixed missing parentheses in the version macro.
* Fixed missing override on virtual function overrides and removed unnecessary virtual keyword from them.
* Disabled additional warning for ATL headers on MSVC only.
* Replaced direct printf parameters with their macro equivalent.
* Replaced C-style casts with C++-style casts.
* Applied clang-format again after an earlier change to the CMake file broke the integration for it.
2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks d883f66fa0 util/threadpool: Show warnings for uncaught exceptions
Tasks should not leak exceptions, so it is better if we actually log them instead of silently ignoring them.
2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks 2fb901278f ui-about: Add new 'Thank You' entries 2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks 334ed4790c encoders/handlers/nvenc: Remove 5.2 from H.264
The levels 5.2 and above were added in a newer FFmpeg version than OBS Studio is shipping with. Ideally we'd take these options directly from FFmpeg, but that is for a future commit.
2023-03-28 12:52:19 +02:00
Michael Fabian 'Xaymar' Dirks 6185de2170 encoders/handlers/nvenc: Fix incorrect values being logged
Fixes the issue where "high444p" shows as "high", and "high" shows as "main", caused by the internal option mapping never being correct across version changes. Instead of keeping our own copy of things that has to be adjusted for each FFmpeg version, it's easier to just use the FFmpeg values and names.
2023-03-28 12:52:19 +02:00
Michael Fabian 'Xaymar' Dirks f7da7283fb ffmpeg/tools: Add string value mapping to print_av_option 2023-03-28 12:52:19 +02:00
Michael Fabian 'Xaymar' Dirks a0d0760f6d encoders/ffmpeg: Fix fallbacks, hide handler-less encoders and clean up
* Changes the encoder name to 'streamfx-{name}' from 'streamfx--{name}' as the latter is a typo, but adds a proxy to still support the latter in bad configurations.
* Some of the warning messages have been improved in order to better support end-users, and support for the new encoder error messages has been added.
* Adds support for the is_hw argument instead of blindly relying on obs_encoder_get_caps() which actually returns the wrong values due to rerouting.
* Fixed handler-less encoders showing up in the UI outside of debug builds.
2023-03-28 12:52:19 +02:00
Michael Fabian 'Xaymar' Dirks a7ac58aba6 obs/encoder-factory: Fix encoder rerouting not working properly
Due to an oversight in the code, the fallback code would simply fail to work as the encoder was always the zero-copy version. This resulted in weird crashes and encoders not working that used to work before.

Fixes #295
2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks 81a8a25d4a obs/gs/vertexbuffer: Cleanup and add workaround for OBS Studio memory leak 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks 07034c0e6e obs/gs/helper: Throw exception if we aren't in a context 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks c1abe07b0f utility: Don't crash on nullptr in free_aligned 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks 56a90db234 plugin: Fix missing include 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks 68a49498e6 common: Rename LOG_ to DLOG_ to avoid macro confusion 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks 2a7187a3c4 plugin: Fix problematic 'using namespace' code 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks f98319dee7 obs/source-tracker: Don't leak pointers to sources 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks f5bc53564d configuration: Don't leak pointers and add messages to exceptions 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks 75663f73a4 encoders/handlers/nvenc: Don't list 'each' mode for H.264 2023-03-28 12:52:16 +02:00
Michael Fabian 'Xaymar' Dirks c9e8b889b0 encoders/handlers/nvenc: Improve UI/UX for NVENC
* "Quality" Minimum/Maximum is actually QP Minimum/Maximum
* Bitrate Limits is now just Limits
* Buffer Size and Quality Target have been moved into "Limits".
2023-03-28 12:52:16 +02:00
Michael Fabian 'Xaymar' Dirks 9a969a0b61 encoders/handlers/nvenc: Update names 2023-03-28 12:52:16 +02:00
Michael Fabian 'Xaymar' Dirks c21f2c32a4 encoders/ffmpeg: Add support for settings migration 2023-03-28 12:52:13 +02:00
Michael Fabian 'Xaymar' Dirks d9198211f7 gfx/shader: Add Per-Instance/Activation/Frame Random values 2023-03-28 12:52:13 +02:00
Michael Fabian 'Xaymar' Dirks 9562d84221 filters/shader: Fix occasional invisibility problem 2023-03-28 12:52:13 +02:00
Michael Fabian 'Xaymar' Dirks 8fc9b5cf1f sources/mirror: Retrieve source size on acquire 2023-03-28 12:52:13 +02:00
Michael Fabian 'Xaymar' Dirks 22e94bb0d8 filters/shader: Don't use scaled size for input capture 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks b4250a74f5 gfx/shader: Increase size limit and function to get base size 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks 411b716402 obs/encoder-factory: Fix incorrect proxy registration 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks ee0a69bbf0 project: Adjust object Ids and add proxies for compatibility 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks 203581f30c obs/source-factory: Add function to register proxy objects
Proxies allow for older configurations to work fine on newer versions, without having to manually adjust the scene collection to match the new ids at all. Thanks to the migration system we can freely support any number of old versions, as long as we write migration code.
2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks 5530d2d416 nvidia/cuda/cuda: Convert to global Singleton 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks 9658c1ee0f nvidia/cuda: Remove 'cu_' prefix from types 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks 6ae69a5c71 strings: Add global id prefix 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks 161f10a921 encoders/ffmpeg: Rename files to match naming scheme 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks ce93f96a69 encoders/ffmpeg: Rebase onto obs::encoder_factory 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks d3c2f288b4 obs/encoder-factory: Factory to create encoder instances 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks 5ad1f173de project: Apply formatting 2023-03-28 12:40:47 +02:00
Michael Fabian 'Xaymar' Dirks 40920204b5 source/mirror: Fix rare out-of-order lock on source
Occasionally, mostly due to other sources rebuilding their UI, an out-of-order lock freeze can be observed with Source Mirror. This is unwanted, so we need to move the freezing logic into a place where freezing shouldn't happen.

Fixes #228
Actually fixes #61
2023-03-28 12:40:47 +02:00
Michael Fabian 'Xaymar' Dirks b60f68fcb8 ffmpeg/tools: Fix incorrect colors for sRGB 2023-03-28 12:40:46 +02:00
Michael Fabian 'Xaymar' Dirks d85ced4107 encoders/ffmpeg: Assume source pixel format for empty support lists 2023-03-28 12:40:46 +02:00
Michael Fabian 'Xaymar' Dirks a9da1481d7 configuration: Fix failed saving due to invalid path 2023-03-28 12:40:46 +02:00
Michael Fabian 'Xaymar' Dirks 04e52d143f ui: Fix about dialog not being shown and move menu
Moves the menu for StreamFX to the primary menu, so that it is not hidden under tools. This makes it clearer to the user if their installation of StreamFX is working correctly, in addition to reducing the steps necessary to use the menu.

Also the 'About StreamFX' dialog now actually shows up for every update, as expected.
2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks 4e24444524 transitions/shader: Fix order of assignment 2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks c1b3972550 gfx/shader/param/basic: Fix bool and suffixes, add enums and optimize
Adds support for enumerations, a different way of selecting how something should behave in a shader. Enumerations rely on a continuous list of values, and will automatically detect how many values there are in the enumeration. Only non-vector types are supported as enumeration entries, and array/vector parameters can have each member set to a different enumeration value.

Furthermore suffixes now are properly assigned, and 'bool' no longer causes shaders to stop rendering. Additionally by inlining some functions and using std::string_view we can achieve a slightly better performance than before.
2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks a2fd4dd2f6 gfx/shader: Inlining, std::string_view and optimizations 2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks 3a40a63832 obs/gs/effect-parameter: Use string_view over std::string
Using std::string_view over std::string (and const std::string&) has the advantage that we skip potential temporary std::string objects that are immediately thrown away, thus slowing down the code. It can also be implicitly cast to std::string, which makes it compatible with existing code that uses std::string.
2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks 9db3dfd874 ui/about: Add 'Thank You' images to the About dialog
Images were created by the talented Inga (https://twitter.com/IngaPotejto).
2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks 5fc95b48d8 filters/nv-face-tracking: Improve tracking and remove high priority CUDA stream
The high priority CUDA stream causes libOBS to be at a lower priority than the tracking, which is not what we want. Instead we want tracking to be incomplete in those cases, rather than slowing down encoding and other things.

Geometry updates are also now done once per frame instead of one per tracking update, which should improve the smoothness without affecting performance too much. Additionally all tracking info is now in the 0..1 range, which drastically simplifies some math - especially with texture coordinates.

To deal with tracking and updates being asynchronous, a very simple approximation of movement velocity has been added. This is mostly wrong, but it can bridge the gap where tracking updates are slower, as the values are all filtered anyway.
2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks b91df3e11a nvicia/cuda-context: Don't modify the primary context
Doing so could potentially cause other CUDA implementations to suddenly fail.
2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks a40db1258a nvidia/cuda: Add cuCtxCreate, cuCtxSynchronize 2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks 7ac5670d54 ui/about: Add version information 2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks 1951fb62ee obs/gs-helper: Optimize performance with inline 2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks 0eddfd75ae util/threadpool: Formatting and allow cancelling of tasks 2023-03-28 12:40:42 +02:00
Michael Fabian 'Xaymar' Dirks a9bb56c5ee project: Optimize to use single fullscreen tri instead 2023-03-28 12:40:42 +02:00
Michael Fabian 'Xaymar' Dirks 775e27caff gs-helper: Only include debug markers if profiling is enabled 2023-03-28 12:40:42 +02:00
Michael Fabian 'Xaymar' Dirks 49f1cbc15e project: Improve performance profiling support
Adds a new CMake option "ENABLE_PROFILING" which enables all CPU and GPU performance profiling available in StreamFX for tracking what's actually causing things to be slow.
2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 071760b867 ffmpeg-encoder/nvenc: Invert "no-scenecut" option for "Adaptive I-Frames"
Our "Adaptive I-Frames" is the inverse of the expected parameter to "no-scenecut" in FFmpegs NVENC.

Related #191
2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 0966b61f76 ffmpeg-encoder/nvenc: Test for "h264_nvenc" in for "Adaptive B-Frames"
Fixes the bug where "Adaptive B-Frames" would not be applied in the way it was expected to be applied.

Related: #191
2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks fb024cad73 gfx-blur-dual-filtering: Implement asynchronous rendering
Asynchronous rendering allows the GPU to perform work while the CPU performs other work, and is significantly faster than lockstep immediate rendering. By reusing existing render targets we can see a performance improvement of up to 500%, while still doing the same things.
2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 9b13d64551 filter-blur: Add debug markers for performance tracking 2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 6e8135dc98 gfx-blur-*: Add debug markers for performance tracking 2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 4947d46aa1 gs-mipmapper: Update API usage, remove broken options and optimize
The new libOBS API allows us to directly access the underlying API instead of having to mess around in memory. By using it we can avoid crashing in case the compiler for it is different, or in case the actual back end structure changes.

Additionally the mostly unimplemented and unused options have also been removed, which streamlines the use of this class even further and reduces both shader and code complexity.

Finally by optimizing the use of the internal render target we can achieve a speed up of up to 3000% over the old way, allowing for many more mipmapped filters.
2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks 47a22ce462 gs-vertexbuffer: Initialize memory to 0 2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks 8b0cc92d10 ui: Fix incorrect namespace for Qt symbol
Q_INIT_RESOURCE and Q_CLEANUP_RESOURCE can't be called from within a namespace and instead have to be in outside of the namespace, so by moving them into small inline functions we can fulfill this restriction.

Related: #192 #155
2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks a553b39a6d gfx-shader: Actually fix the thing 93207d was supposed to fix 2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks c2c5afd763 gfx-shader: Actually write alpha channel to render target 2023-03-28 12:40:39 +02:00
Michael Fabian 'Xaymar' Dirks bb21d940bf project: Fix virtual overrides not using the correct type 2023-03-28 12:40:39 +02:00
Michael Fabian 'Xaymar' Dirks a5518388ec util-profiler: Specify type for template 2023-03-28 12:40:38 +02:00
Michael Fabian 'Xaymar' Dirks 544b67d55e util-profiler: Fix typo with in reparent() 2023-03-28 12:40:38 +02:00
Michael Fabian 'Xaymar' Dirks ad4d00e0ea util-event: Fix unknown type 2023-03-28 12:40:37 +02:00
Michael Fabian 'Xaymar' Dirks a19e8d1e00 gfx-shader: Add default path for file selection 2023-03-28 12:40:37 +02:00
Michael Fabian 'Xaymar' Dirks 7a929d6af4 locale: Add missing and remove unused strings 2020-04-23 09:14:31 +02:00
Michael Fabian 'Xaymar' Dirks 5291b193e2 gfx-shader: Fix rendering at unexpected sizes and fix performance
Fixes rendering at unexpected sizes by first rendering to a render target and then rendering the contents of that render target to the frame buffer instead. This also prevent rendering twice or more, which might cause severe FPS impact.
2020-04-23 08:10:01 +02:00
Michael Fabian 'Xaymar' Dirks f58ce9f421 project: Implement a brand new UI with fancy windows
Implements support for various new UI features that weren't possible up until now, such as an 'About StreamFX' window with a thank you to everyone that supported the project up until now.
2020-04-23 01:09:02 +02:00
Michael Fabian 'Xaymar' Dirks d0941895ad project: Refactor into namespace streamfx 2020-04-23 00:50:39 +02:00
Michael Fabian 'Xaymar' Dirks 2ab8949ba5 cmake: Place Windows exclusive functionality into own file 2020-04-22 23:32:22 +02:00
Michael Fabian 'Xaymar' Dirks 9ddc9051c7 configuration: Add global configuration handler 2020-04-22 23:15:32 +02:00
Michael Fabian 'Xaymar' Dirks 6cbfee4579 obs-tools: Add OBS data deleter 2020-04-22 23:15:32 +02:00
Michael Fabian 'Xaymar' Dirks ce74d2f7cd common: Undefine the unsafe 'strtoll' define from libobs 2020-04-22 23:11:30 +02:00
Michael Fabian 'Xaymar' Dirks 04ac0a640f filter-nv-face-tracking: Improve performance with asynchronous tracking
Through converting the code to a threaded asynchronous approach, the libOBS video renderer no longer has to wait on our tracking code to run, and we can enjoy a little bit of extra calculation time before we actually have to do anything.

However due to the remaining synchronization with the Direct3D11/OpenGL context, it is not entirely safe to spend a full frame tracking as libOBS will then start skipped/dropping frames. Even though the priority of the stream is now increased, this still means that we can't just sit around and have to quickly finish all work.

Related #150
2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks 4d8ff417e7 nvidia-cuda: Improve usage of CUDA resources and functions
Load additional functions from CUDA and add new enumerations to support them:
* cuDevicePrimaryCtxSetFlags allows us to sched scheduling mode for the GPU.
* cuCtxgetStreamPriorityRange allows us to check which priority levels are supported.
* cuStreamCreateWithPriority allows us to create streams with non-default priority.

The scheduler mode is now set to yield so that other threads can do work when we hit an eventual stalling problem. Streams can also now be created with higher priority and different flags, if necessary. In most cases this should allow CUDA resources to execute even while the GPU is under heavy load.
2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks 97e1846156 obs-tools: Add deleter for obs_weak_source_t 2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks e4b4dc23e8 gs-helper: Define extra debug colors 2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks 05d69e3c59 util-threadpool: Fix rare double-execute bug 2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks 984a1132bf ffmpeg-encoder: Implement additional support checks 2020-04-17 11:13:10 +02:00
Michael Fabian 'Xaymar' Dirks a9c881130e ffmpeg-encoder/nvenc: Fix Look Ahead setting
Also now disables Adaptive I & B as they do nothing without Look-Ahead set to non-zero.

Fixes #159
2020-04-17 11:13:10 +02:00
Michael Fabian 'Xaymar' Dirks c03fc933bb ffmpeg-encoder/d3d11: Set highest eviction priority for buffers
This should ideally prevent textures from being removed from the GPU while the encoder is actively using them.
2020-04-11 15:23:07 +02:00
Michael Fabian 'Xaymar' Dirks 908d1f0a20 project: Modernize code to proper C++ 2020-04-09 00:17:25 +02:00
Michael Fabian 'Xaymar' Dirks 05399bd183 filter-dynamic-mask: Add missing include
Fixes #134
2020-04-06 15:39:12 +02:00
Michael Fabian 'Xaymar' Dirks 6a9921c9ce project: Fix include ordering and reapply formatting 2020-04-06 15:39:12 +02:00
Michael Fabian 'Xaymar' Dirks cd5acd42f4 obs-source-factory: Add settings migration code
Previously sources had to manually implement migration code, which resulted in unresolvable regression issues due to the lack of version and commit tagging. With the new migration code, all sources automatically have this version and commit tagging at all times, and as such can now have a temporary regression fixed without the user needing to change any values manually.
2020-04-05 07:28:10 +02:00
Michael Fabian 'Xaymar' Dirks a138f95126 cmake: Fix clang support in native OBS Studio build 2020-04-05 06:50:21 +02:00
Michael Fabian 'Xaymar' Dirks 9e9e9cbcd5 ffmpeg-encoder/prores: Improve pixel format override logic 2020-04-04 19:34:58 +02:00
Michael Fabian 'Xaymar' Dirks 87163f5f70 ffmpeg-encoder: Use correct key when getting pixel formats 2020-04-04 19:34:58 +02:00
Michael Fabian 'Xaymar' Dirks 9ca190c96a gfx-shader: Don't use modified_properties to reload shaders
As OBS Studio locks some mutexes in a different order depending on what actions are being done, using modified_properties for GPU work causes things to freeze in place. Instead have users manually click the refresh button when they changed files in order to prevent this freeze from happening.

Fixes: #118
2020-04-03 18:54:56 +02:00
Michael Fabian 'Xaymar' Dirks cc9d3486b2 project: Fix Linux support by fixing errors and warnings
With this, GCC 8 and above should now be able to compile the project both in obs-studio and as a standalone install. Some features are currently still not fully supported and require extra work, but the majority of things are supported and work out of the box. Exact feature parity can be looked up here on the wiki: https://github.com/Xaymar/obs-StreamFX/wiki/Platform-Feature-Parity

Related: #119 #98 #30
2020-04-02 20:37:45 +02:00
Michael Fabian 'Xaymar' Dirks 3ad2424b22 ffmpeg-encoder: Throw std::runtime_error instead of std::exception 2020-04-02 17:05:02 +02:00
Michael Fabian 'Xaymar' Dirks 59fa1d36d7 common: Common header include for improved platform support
This header includes all common data between headers used in the plugin. This should improve cross-platform compiling support whenever possible, as all platform-dependent common includes and defines can be done here.
2020-04-02 17:02:01 +02:00
Michael Fabian 'Xaymar' Dirks 451d31546f gs-effect-*: Replace strnlen_s with strnlen 2020-04-02 16:21:42 +02:00
Michael Fabian 'Xaymar' Dirks 89b99402c0 util-threadpool: Add missing includes 2020-04-01 14:32:54 +02:00
Michael Fabian 'Xaymar' Dirks 30aaea8449 filter-nv-face-tracking: Possibly fix for rare 0x0 bug 2020-04-01 01:41:18 +02:00
Michael Fabian 'Xaymar' Dirks cf6e867ba5 source-shader: Fix size and parameters 2020-04-01 00:09:21 +02:00
Michael Fabian 'Xaymar' Dirks 3dcf4e5dd6 filter-shader: Fix detected sizes 2020-03-31 22:42:18 +02:00
Michael Fabian 'Xaymar' Dirks ac8844b305 gfx-shader: Add defaults 2020-03-31 22:34:22 +02:00
Michael Fabian 'Xaymar' Dirks d5dffbbe03 filter-shader: Fix some crashes 2020-03-31 22:26:50 +02:00
Michael Fabian 'Xaymar' Dirks bb2f43a629 filter-shader: Fix incorrect shader mode 2020-03-31 22:22:55 +02:00
Michael Fabian 'Xaymar' Dirks 43f1dcf205 filter-nv-face-tracking: Nvidia exclusive Face Tracking filter
Ever wished you had a professional camera operator to highlight and follow the action, ensuring the audience never misses a beat? Thanks to NVIDIA, you can now do this at home for free! The new NVIDIA AR SDK unlocks augmented reality features, including motion tracking for faces.

This allows me to provide you with an automated zoom and cropping solution for your video camera to transform your streams into a slick, polished broadcast, where you’ll always be the star of the show. Don’t forget - everything is customizable so the possibilities are endless. You can even recreate that Futurama squinting meme if you wanted to (with some scripting)!

The filter requires compatible Nvidia RTX hardware and the Nvidia AR SDK Runtime to be installed ahead of time. This filter is considered "stable" and shouldn't change much from version to version.
2020-03-31 21:46:47 +02:00
Michael Fabian 'Xaymar' Dirks 88213e81f6 nvidia-cuda: GPL compatible CUDA library interface
Due to the 'nvcuda' library being part of the driver, it falls in a clause of the GPL which allows us to load and interface with system drivers. Since we can't rely on Nvidias headers here (incompatible license), most of this was pulled from FFmpeg and other things were found out via testing.
2020-03-31 21:46:47 +02:00
Michael Fabian 'Xaymar' Dirks 2e48723e83 util-profiler: Possible fix for issue #119
Microsoft automatically includes cmath by default, while GCC and Clang don't seem to do this.
2020-03-31 21:46:03 +02:00
Michael Fabian 'Xaymar' Dirks 1285e7efd3 util-event: Fix duplicated name 2020-03-31 15:47:15 +02:00
Michael Fabian 'Xaymar' Dirks 79406b0b08 gfx-shader: Additional stable time values
'Time.x' gets inaccurate if OBS Studio is running for more than two hours, therefore we have to do something to fix it. By allowing the shader code to control when things loop using 'Time.y' (0..1) and 'Time.z' (the number of times 'Time.y' wrapped back to 0), a much more stable animation can be achieved.
2020-03-28 22:17:33 +01:00
Michael Fabian 'Xaymar' Dirks 43b5d309eb transition: Add initial version of Shader filter
These allow you to apply any kind of filtering to a any source, using just standard HLSL. Just like transitions, one extra parameter is set called 'InputA'.

Fixes #95
2020-03-28 18:54:56 +01:00
Michael Fabian 'Xaymar' Dirks ead355beea transition-shader: Add initial version of Shader transitions
With this, the first proper shader effect is now possible. By using the four new automated shader parameters 'InputA', 'InputB', 'TransitionTime' and 'TransitionSize' you can write your own transition in HLSL.

Fixes #96
2020-03-28 18:38:45 +01:00
Michael Fabian 'Xaymar' Dirks 2e250ad826 obs-source-factory: Fix support for transitions
Transitions always require audio and video rendering.
2020-03-28 18:37:20 +01:00
Michael Fabian 'Xaymar' Dirks 6ae9904e13 gfx-shader: Support for filters and transitions
Due to render logic required for transitions, some of the render logic is split into an additional function called 'prepare_render'. Additionally the storage for some temporary objects has been removed as it these objects usually do not outlive their rendering time anyway.

Related: #96 #95 #94 #5
2020-03-28 18:37:00 +01:00
Michael Fabian 'Xaymar' Dirks e66acbeb98 filter-transform: Fix function location 2020-03-28 16:24:26 +01:00
Michael Fabian 'Xaymar' Dirks 18b3cd30bf filter-transform: Migration code for earlier stable versions
This fixes #116 which was caused by a refactor in commit efb6b0b9be. This bug was left undiscovered until users started upgrading from the last stable version to the current pre-release.
2020-03-28 16:18:17 +01:00
Michael Fabian 'Xaymar' Dirks 4f7c1cb35e ffmpeg-encoder: Various warning fixes and cleanup
Also don't include it from plugin.cpp if it's not enabled.
2020-03-27 20:10:29 +01:00
Michael Fabian 'Xaymar' Dirks ff3c2e8c66 filter-dynamic-mask: Initialize all members 2020-03-27 20:10:17 +01:00
Michael Fabian 'Xaymar' Dirks 87e6767033 gs-mipmapper: Fix some warnings 2020-03-27 20:10:17 +01:00
Michael Fabian 'Xaymar' Dirks 1942782b56 util-threadpool: Fix order of initialization 2020-03-27 20:10:09 +01:00
Michael Fabian 'Xaymar' Dirks 10fee7f048 util-profiler: Easy to use profiling helper 2020-03-27 20:10:09 +01:00
Michael Fabian 'Xaymar' Dirks 03bee0aaf2 source-mirror: Fix freeze introduced in OBS Studio v25.x
For an unknown reason, OBS Studio v25.x now causes a freeze to happen at this location. This should hopefully work around that issue by ensuring that we are in a location that does not cause an unusual lock order.
2020-03-21 09:13:31 +01:00
Michael Fabian 'Xaymar' Dirks b54e9431c0 ffmpeg-encoder: Fall back to software encoding for scaling 2020-03-21 08:59:53 +01:00
Michael Fabian 'Xaymar' Dirks ccb8a205b0 source-mirror: Update first, then acquire source
Fixes a bug where a 2nd update is necessary for proper audio mirroring.
2020-03-21 08:59:35 +01:00
Michael Fabian 'Xaymar' Dirks d6c903a3bd source-mirror: Fix out-of-order playback of audio
On highly parallel systems (> 4 Threads) audio had a chance of being played back out of order, causing it to jitter. This queue should help eliminate the issue entirely.

Fixes #111
2020-03-20 23:59:42 +01:00