Commit graph

212 commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks
5b2e28a723 code: Disable profiling on MacOS
This may address a nullptr crash on MacOS with several features.
2023-04-05 19:21:13 +02:00
Michael Fabian 'Xaymar' Dirks
5a3954ae0e project: Fix License, License headers and Copyright information
Fixes several files incorrectly stated a different license from the actual project, as well as the copyright headers included in all files. This change has no effect on the licensing terms, it should clear up a bit of confusion by contributors. Plus the files get a bit smaller, and we have less duplicated information across the entire project.

Overall the project is GPLv2 if not built with Qt, and GPLv3 if it is built with Qt. There are no parts licensed under a different license, all have been adapted from other compatible licenses into GPLv2 or GPLv3.
2023-04-05 18:59:08 +02:00
Michael Fabian 'Xaymar' Dirks
e8ec23c4d4 obs/source-tracker: Fix leaked source references
This functionality broke at some point in the past without anyone noticing, resulting in most dropdowns that rely on this functionality being blank.

Fixes #1025
2023-04-05 18:59:03 +02:00
Michael Fabian 'Xaymar' Dirks
bc7f949c7b filter/blur: Don't increment your own reference count
Fixes #818
2023-04-05 18:58:57 +02:00
Michael Fabian 'Xaymar' Dirks
52afca38aa gfx/mipmapper: Move gs-mipmapper into proper directory
This is not an obs feature, so it shouldn't be in the obs directory.
2023-04-05 18:58:56 +02:00
Michael Fabian 'Xaymar' Dirks
8aa8745a3a gfx/util: Move draw_fullscreen_triangle here for consistency 2023-04-05 18:58:56 +02:00
Michael Fabian 'Xaymar' Dirks
9b8ef5ac74 gfx/util: Rename debug to util(ity)
They may be useful for debugging, but they are still utilities.
2023-04-05 18:58:55 +02:00
Michael Fabian 'Xaymar' Dirks
2577622dbe filter/dynamic-mask: Replace rendering code and optimize storage
The rendering code here was one of the older code bases, which was riddled with bugs and leaks. The new code doesn't look pretty, but it works for the time being until a better solution is found or made. It should be able to handle HDR inputs now, but it may not be completely correct yet. This also fixes the double-free bug.

As an additional improvement, I've moved the allocation of the effect to a shared class which should reduce the memory usage slightly when multiple effects are in play. And now selecting nothing selects the filter target itself without infinitely adding references to the filter. Good enough in my eyes.

Fixes #819
2023-04-05 18:58:54 +02:00
Michael Fabian 'Xaymar' Dirks
fddf21b8de util/threadpool: Optimize for dynamic thread pooling
While the previous approach of a static thread pool worked, it was sub-optimal in its resource usage. Many of the threads would never see a single task, and simply permanently sleep. This seems like a good idea, except that sleeping threads still end up in the scheduler, and thus waste a tiny amount of resources.

It is better to instead dynamically spawn threads when needed and only keeping the bare minimum around all the time. These dynamically spawned threads are also explicitly set to background priority which further reduces scheduling overhead. Finally optimizing the memory layout to prevent unwanted false sharing should also keep sporadic wake ups at a minimum.

This new model should be able to handle many more tasks than ever before, but is still not as optimal as it could be.
2023-04-05 18:58:49 +02:00
Michael Fabian 'Xaymar' Dirks
1c7350edf7 code: Fix initialization order for constructors
Prevents some out-of-order events from occurring.
2023-04-05 18:58:40 +02:00
Michael Fabian 'Xaymar' Dirks
08544b4116 cmake, code: Abuse pre-processor to disable/enable warnings 2023-04-05 18:58:39 +02:00
Michael Fabian 'Xaymar' Dirks
0aca1fc132 code: Always provide a default case for enumerations 2023-04-05 18:58:37 +02:00
Michael Fabian 'Xaymar' Dirks
4fa26dd2d6 code: Always initialize or cast to correct type 2023-04-05 18:58:37 +02:00
Michael Fabian 'Xaymar' Dirks
0fe5c7e654 code: Don't use try-catch as function definition
This breaks MSVC and results in leaked exceptions.
2023-04-05 18:58:37 +02:00
Michael Fabian 'Xaymar' Dirks
b5195c580c filter/displacement: Add missing deprecation notice 2023-04-05 18:58:35 +02:00
Michael Fabian 'Xaymar' Dirks
8f8b8839e5 obs/weak-source: Further optimization and modernization 2023-04-05 18:58:33 +02:00
lainon
6e1566386e project: Apply more C++ paradigms to the code
- Use auto in places where code clarity is improved or identical.
- Replace trivial constructors and destructors with default.
- Use true random for random generation.
- Use std::string_view where it is valid to do so.
- Apply const where it is valid to do so.
- Use references where it is valid to do so.
- Manually optimize memory usage with std::move and std::copy.
- Opt for memory efficient containers where the size is known ahead of time.

Signed-off-by: lainon <GermanAizek@yandex.ru>
2023-04-05 18:58:32 +02:00
Michael Fabian 'Xaymar' Dirks
8a31b986ab project: Update to new classes 2023-04-05 18:58:22 +02:00
Michael Fabian 'Xaymar' Dirks
b108362ee1 gfx/source-texture: Update to new classes 2023-04-05 18:58:21 +02:00
Michael Fabian 'Xaymar' Dirks
e3c7b13d6f obs/source-factory: Add support for OBS Studio 27.x
Also improves the functionality logic slightly to be more in line with real behavior.
2023-04-05 18:58:21 +02:00
Michael Fabian 'Xaymar' Dirks
b5cb3440f2 filters/autoframing: Always set projection matrix
Fixes #739
2023-04-05 18:51:55 +02:00
coolsoft.rf
bba606e439 gfx/shader: Support for visible and active tracking in parameters
Co-authored-by: Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
2023-04-05 18:51:42 +02:00
Michael Fabian 'Xaymar' Dirks
d1fdab45fc filter/transform: Fix mip-map level calculation 2023-04-05 18:51:40 +02:00
Michael Fabian 'Xaymar' Dirks
50a23799b0 filter/transform: Swap parameter names in migration code 2023-04-05 18:51:39 +02:00
Michael Fabian 'Xaymar' Dirks
29bbe22bec obs/gs/effect: Preprocess shaders to improve platform compatibility
Improves cross-platform compatibility of Shaders written for StreamFX through the use of preprocessing to make things a bit more compatible. While we don't perform any proper parsing, this will be able to prevent basic issues.
2023-04-05 18:51:38 +02:00
Michael Fabian 'Xaymar' Dirks
aeb889091e filter/autoframing: Remaining part of ff235b765e 2023-04-05 18:51:37 +02:00
Michael Fabian 'Xaymar' Dirks
2b3535f089 filter/autoframing: Allow specifying Tracking Frequency in Hz 2023-04-05 18:51:36 +02:00
Michael Fabian 'Xaymar' Dirks
ad3ac69cd7 filter/auto-framing: Frame your face, automatically! 2023-04-05 18:51:36 +02:00
Michael Fabian 'Xaymar' Dirks
c3440d2069 project: Remove undocumented "NVIDIA Face Tracking" feature
Originally intended to be an experiment with no future, it turned out to be very popular with streamers that move a lot. In the end it was popular enough that NVIDIA added their own variant to their Broadcast software, which works decently enough. Unfortunately my wrapper code around the library was written very poorly, so it didn't take long for it to break out of nowhere.
2023-04-05 18:51:35 +02:00
Michael Fabian 'Xaymar' Dirks
f0b0b0d33d filter/denoising: Wait for internal task to be completed 2023-04-05 18:51:33 +02:00
Michael Fabian 'Xaymar' Dirks
926cb740b3 filter/upscaling: Wait for internal task to be completed 2023-04-05 18:51:33 +02:00
Michael Fabian 'Xaymar' Dirks
21f872edfc filter/virtual-greenscreen: Wait for internal task to be completed 2023-04-05 18:51:33 +02:00
Michael Fabian 'Xaymar' Dirks
a7fd867be6 filter/upscaling: Set correct parameters to the appropriate textures 2023-04-05 18:51:32 +02:00
Michael Fabian 'Xaymar' Dirks
90bb03779c filter/virtual-greenscreen: Add Virtual Greenscreen filter 2023-04-05 18:51:31 +02:00
Michael Fabian 'Xaymar' Dirks
a7faa2e445 filter/transform: Enable Anisotropic Filtering with Mip-Mapping 2023-04-05 18:51:29 +02:00
Michael Fabian 'Xaymar' Dirks
150b728419 filter/transform: Implement 'Corner Pin' mode
'Perspective' and 'Orthographic' work great if you know what the parameters were to generate the exact object position, but what if you don't know them? That is where 'Corner Pin' comes in! With it you can specify the exact location of every corner down to the micro-pixel, instead of fiddling with parameters.

Fixes #565
2023-04-05 18:51:29 +02:00
Michael Fabian 'Xaymar' Dirks
e0c6e55259 filter/transform: Modernize code base for future expansion 2023-04-05 18:51:29 +02:00
Michael Fabian 'Xaymar' Dirks
a40021b17b filter/transform: Migrate a number of settings for future use 2023-04-05 18:51:29 +02:00
Michael Fabian 'Xaymar' Dirks
948976fce1 effects: Add Draw, DrawPremultiplied to 'standard.effect' 2023-04-05 18:51:29 +02:00
Michael Fabian 'Xaymar' Dirks
e3563c7cf4 filter/dynamic-mask: Prevent recursive filter graphs 2023-04-05 18:51:25 +02:00
Michael Fabian 'Xaymar' Dirks
5952dfe73f filter/upscaling: Restore alpha after processing
As none of the known Upscaling algorithms handle Alpha, we need to manually restore and interpolate it properly. While this technically reduces visual quality slightly, the chances of this being noticed are slim to none considering that Upscaling is already a questionable solution to quality. Linear was picked here as it produces the best overall result for scaling, keeping gradients mostly in one piece. Mostly.

Fixes #646
2023-04-05 18:51:22 +02:00
Michael Fabian 'Xaymar' Dirks
fc479bcdaf filter/denoising: Restore alpha after processing
As the Alpha channel is completely ignored and possibly destroyed by denoising algorithms, we should restore the Alpha channel manually. Linear interpolation was chosen here as it will behave like Point if the size matches, and properly interpolate if the size doesn't match.

Fixes: #646
2023-04-05 18:51:22 +02:00
Michael Fabian 'Xaymar' Dirks
e40e7526de filter/upscaling: Update Source Identifier 2023-04-05 18:51:21 +02:00
Michael Fabian 'Xaymar' Dirks
0e5709f7da filter/denoising: Update Source Identifier 2023-04-05 18:51:21 +02:00
Michael Fabian 'Xaymar' Dirks
f9c03f2c86 filter/denoising: Don't denoise the same image twice 2023-04-05 18:51:21 +02:00
Michael Fabian 'Xaymar' Dirks
3735627b13 filter/denoising: Use actual size instead of base size of target 2023-04-05 18:51:21 +02:00
Michael Fabian 'Xaymar' Dirks
45cedde1ae filter/denoising: Restrict size to reasonable numbers
Prevents invalid sizes from being used by the filter, which sometimes happens with Async Sources that aren't quite ready yet.

Fixes: #642
2023-04-05 18:51:20 +02:00
Michael Fabian 'Xaymar' Dirks
a5166c409e filter/denoising: Fix incorrect define checks 2023-04-05 18:51:19 +02:00
Michael Fabian 'Xaymar' Dirks
0ff1e3145d locale: Adjust text to match reality 2023-04-05 18:51:18 +02:00
Michael Fabian 'Xaymar' Dirks
247553fa74 filter/denoising: Add Denoising filter 2023-04-05 18:51:17 +02:00