Comments (4)
This is technically outside of the scope of the plugin. If you need a faster way, I'd recommend doing exactly what you already said to do. However there are actual optimizations that can be done for the filter.
Pass the Kernel by Value instead of Texture
Currently the plugin allocates a Kernel texture containing every kernel for 0 Width to 31 Width. This is very inefficient as Textures really don't fit well into a Fragment L1 cache. A significant speed up could already be attained through simply moving the values into an actual float array of constant size.
Use the result of linear-sampling in addition to multi-pass blurring
The filter already uses dual-pass blurring, which is the only reason that Gaussian blur doesn't absolutely kill your GPU right now. The number of texture accesses can be halved if we take linear-sampling into account and do some clever math to hide the inaccuracies resulting from that.
Unroll the loop
The D3D11 and OpenGL shader compilers currently don't know how many iterations the loop will do at most. This is inefficient and leads to expensive instructions being generated. This plus the first optimization is already a huge boost, looping code is very expensive.
Implement better Blur filters
There are many solutions that actually out-perform currently implement solutions simply by their access pattern and how they actually calculate the final value. Some however are a bit difficult to actually do without direct access to D3D11 or the OpenGL api, which OBS abstracts away.
Edit: By the way, if you need a fast way to blur things, Box Blur is the way to go. Gaussian and Bilateral Blur are computationally expensive and should be used only if you have the necessary gpu capacity to do so.
from obs-streamfx.
Gaussian Blur now also has the kernel array optimization, further reducing GPU usage. This is as far as I'll optimize this for now, and should make Gaussian Blur more usable.
Marking as Fixed/Completed.
from obs-streamfx.
A faster variant of Box Blur is now implemented: Box Linear. This blur reduces the total number of samples by n, allowing the blur to run even faster. If the Radius is even, the blur only takes O(2n+1) instead of O(4n+1), if the Radius is odd, the blur only takes O(2n) instead of O(4n+1).
The same type of optimization will be added for Gaussian Blur, in addition to moving to kernel array instead of texture.
from obs-streamfx.
Gaussian Linear Blur has also now been implemented, reducing the number of samples for Gaussian Blur by up to n. An even radius will now only take O(2n+2), while an odd radius will take O(2n+4) instead of O(4n+2). Further improvements can be done by switching out the kernel texture with an array of floats.
from obs-streamfx.
Related Issues (20)
- StreamFX 0.12 causes OBS 29.0.0 to hang on exit on Linux HOT 7
- Auto-Framing fails on Windows 11 with NVCV_ERR_SELECTOR on "Temporal" option HOT 1
- obs::source_tracker loses or duplicates references to Sources
- Adding Blur Filter crashes application on Mac M2 HOT 3
- Blur: Refactor for a better UX
- Spout/Sink System HOT 1
- Shaders: Support the new Missing Files API
- Current User installation is in the wrong directory on Windows
- Optimize resource usage and order by gfx::mipmapper HOT 1
- Transform: Migrate to resource pooling HOT 1
- Blur: Migrate to resource pooling
- Auto-Framing: Migrate to resource pooling
- Color Grade: Migrate to resource pooling
- Denoising: Migrate to resource pooling
- Dynamic Mask: Migrate to resource pooling
- Shader: Migrate to resource pooling
- Upscaling: Migrate to resource pooling
- Virtual Greenscreen: Migrate to resource pooling
- 3D Transform: Randomly stops displaying anything HOT 2
- Add/Implement NUMA awareness HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from obs-streamfx.