VSE: reduce effects code duplication, making gaussian blur faster in the process #116089

Merged
Aras Pranckevicius merged 2 commits from aras_p/blender:vse-fx-cleanup into main 2023-12-14 17:31:16 +01:00

2 Commits

Author SHA1 Message Date
Aras Pranckevicius bac0481697 VSE: make Gaussian Blur effect both faster and with less code
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
Similar to previous commit, there was a lot of code duplication
between "byte" and "float" gaussian blur code variants. Also:

- Use direct parallel_for threading instead of very roundabout
  way that was coming from C times. Way less code, and allows loading
  CPU cores better (parallel_for seems better than task pool, also
  gaussian blur is relatively expensive so use smaller grain sizes).
- Calculate gaussian kernel tables once per effect, instead of once
  per CPU job.
- Do "sample from this to that pixel" including boundary conditions
  calculation explicitly, instead of checking boundary condition
  at each iteration inside the inner loop.

Applying gaussian blur effect of 100x100 size on 4K UHD sequencer
strip input, on Windows / Ryzen 5950X: 630ms -> 450ms

And with 220 fewer lines of code :)
2023-12-12 11:45:33 +02:00
Aras Pranckevicius 82182bce3d VSE: reduce code duplication in some effects
Logic between byte vs float effects was the same in many places, so now
that the source is in C++, we can reduce that duplication. Effects:
alpha over, alpha under, gamma cross, wipe, apply blend function util.
2023-12-12 10:41:02 +02:00