Commit Graph

2221 Commits

Author SHA1 Message Date
Omar Emara
b43c36e801 Compositor: Implement Morphological Distance Feather algorithm for CPU
Reference #125968.
2024-11-27 19:28:16 +02:00
Omar Emara
32186ca908 Compositor: Implement Morphological Distance algorithm for CPU
Reference #125968.
2024-11-27 19:28:16 +02:00
Omar Emara
939242b100 Compositor: Implement Morphological Distance Feather Weights to CPU
Reference #125968.
2024-11-27 19:28:16 +02:00
Campbell Barton
b9f055459a Cleanup: ensure trailing space around comment blocks 2024-11-27 19:01:00 +11:00
Omar Emara
a9f8eca927 Compositor: Implement Symmetric Separable Variable Size Blur for CPU
Reference #125968.
2024-11-26 16:10:56 +02:00
Campbell Barton
9e9598877e Cleanup: balance braces in pre-processor checks
While it's correct, unbalanced braces confuses some editing operations.
2024-11-26 12:41:29 +11:00
Aras Pranckevicius
377e998e39 BLI: Add pixel sampling functions with arbitrary UV wrapping modes
Implements #130836:

interpolate_*_wrapmode_fl take InterpWrapMode wrap_u and wrap_v arguments.
U and V coordinate axes can have different wrap modes: clamp/extend,
border/zero, wrap/repeat.

Note that this removes inconsistency where cubic interpolation was
returning zero for samples completely outside the image, but all other
functions were not, and the behavior was not matching the function
documentation either.

Use the new functions in the new compositor CPU backend.

Possible performance impact for other places (e.g. VSE): measured on
4K resolution, transformed (scaled and rotated) 4K EXR image:
- Nearest filter: no change,
- Bilinear filter: no change,
- Cubic BSpline filter: slight performance decrease, IMB_transform
  19.5 -> 20.7 ms (Ryzen 5950X, VS2022). Feels acceptable.

Pull Request: https://projects.blender.org/blender/blender/pulls/130893
2024-11-25 16:03:33 +01:00
Omar Emara
c7d58d8dbc Compositor: Implement Morphological Blurring for CPU
Reference #125968.
2024-11-25 16:19:51 +02:00
Omar Emara
140e5de1f5 Cleanup: Use const for input arguments 2024-11-25 16:18:44 +02:00
Omar Emara
5a589d004a Cleanup: Remove unused variable 2024-11-25 16:17:46 +02:00
Omar Emara
986802fc87 Composite: Implement Van Vliet Gaussian blur for CPU
Reference #125968.
2024-11-22 15:22:32 +02:00
Omar Emara
3379652bfd Compositor: Implement Deriche Gaussian blur for CPU
Reference #125968.
2024-11-22 15:22:32 +02:00
Omar Emara
edbad1fbde Compositor: Implement Symmetric Separable Blur for CPU
Reference #125968.
2024-11-22 15:22:32 +02:00
Omar Emara
ea767aa242 Refactor: Compositor: Eliminate branching in blur shader 2024-11-21 16:58:55 +02:00
Omar Emara
90fba1aaf4 Fix: Shader compile error in Defocus Blur
A shader compile error due to conflicting function names in two
different included headers. Use the math_vector_lib header to resolve
the issue.
2024-11-21 16:56:59 +02:00
Omar Emara
bb61b6fde9 Compositor: Implement Symmetric Separable Blur Weights for CPU
Reference #125968.
2024-11-21 16:48:27 +02:00
Omar Emara
80a054c15d Compositor: Implement Symmetric Blur Weights for new CPU compositor
Reference #125968.
2024-11-21 16:40:03 +02:00
Omar Emara
715b80e68f Cleanup: Compositor: Refactor blur gamma correction
Avoid condition selection for negative data and use max function
instead.
2024-11-21 16:33:11 +02:00
Omar Emara
afdbef449b Cleanup: Compositor: Remove redundant includes 2024-11-21 16:26:49 +02:00
Omar Emara
15cdeae620 Fix: Compile error in Despeckle node for Metal
We can't use the `threshold` uniform name in Metal because it is used as
a local variable in one of the library files, because uniforms are
defines in Metal, so it causes an error. Change the name to
`color_threshold` as a fix.
2024-11-21 09:37:44 +02:00
Omar Emara
71e971700c Compositor: Implement Summed Area Table for new CPU compositor
Reference #125968.
2024-11-20 15:57:39 +02:00
Omar Emara
e5352b11da Cleanup: Use is_equal method in Despeckle node 2024-11-20 15:52:17 +02:00
Omar Emara
9dd04cafd9 Compositor: Implement Jump Flooding for new CPU compositor
Reference #125968.
2024-11-18 17:35:22 +02:00
Omar Emara
6166e9ab6e Compositor: Add integer pixel load and store functions 2024-11-18 17:35:21 +02:00
Omar Emara
5511256f3b Compositor: Add fallback variant for pixel loader
This patch adds a variant of the pixel loader function that returns a
fallback value for out of bound access.
2024-11-18 17:35:21 +02:00
Omar Emara
4457f8a70d Compositor: Implement Movie Distortion for new CPU compositor
Reference #125968.
2024-11-14 14:21:57 +02:00
Omar Emara
b9acba177e Compositor: Implement zero boundary EWA sampling
Reference #125968.
2024-11-13 16:01:47 +02:00
Jacques Lucke
64a9260921 Core: remove WITH_CXX_GUARDEDALLOC option
This implements the proposal from #124512. For that it contains the following
changes:
* Remove the global override of `new`/`delete` when `WITH_CXX_GUARDEDALLOC` was
  enabled.
* Always use `MEM_CXX_CLASS_ALLOC_FUNCS` where it is currently used. This used
  to be guarded by `WITH_CXX_GUARDEDALLOC` in some but not all cases. This means
  that a few classes which didn't use our guarded allocator by default before,
  are now using it.

Pull Request: https://projects.blender.org/blender/blender/pulls/130181
2024-11-13 13:39:49 +01:00
Bastien Montagne
b325142d17 Merge branch 'blender-v4.3-release' 2024-11-12 16:55:40 +01:00
Bastien Montagne
0b3a7cbe69 Cleanup: Move BKE_image.h and related headers to C++.
NOTE: This also required some changes to Cycles code itself, who is now
directly including `BKE_image.hh` instead of declaring a few prototypes
of these functions in its `blender/utils.h` header (due to C++ functions
names mangling, this was not working anymore).

Pull Request: https://projects.blender.org/blender/blender/pulls/130174
2024-11-12 16:53:54 +01:00
Omar Emara
aff8a8878f Fix: Zero division in Corner Pin node
Points at infinity in the Corner Pin node causes zero division, so
early exit with a zero.
2024-11-12 16:27:29 +02:00
Omar Emara
3f2f3cb08d Merge branch 'blender-v4.3-release' 2024-11-12 13:54:31 +02:00
Omar Emara
a0cfb0b142 Fix #130134: Double Edge Mask uses too much memory
The Double Edge Mask node uses too much memory when it is not connected
to anything in the Full-Frame compositor. That's because it tries to
allocate a buffer of size 131072x131072, which is due to the cumulation
of multiple issues.

1. The Full-Frame compositor evaluates nodes that are not connected to
   the output.
2. The constant folder assigns a bounds of +-65536 to its output memory
   buffers as a maximum possible value.
3. Then the MemoryBuffer::inflate method doesn't know about the constant
   folder special value, so it tries to allocate a buffer of that size.

The safest fix for now is to clear the output and return early if all
inputs are single value.

The problem is that this issue might happen for other nodes that also
satisfy the 3 issues above, that is, uses inflate and can be constant
folded. I manually checked for such nodes and there are no nodes that
satisfy all three, so hopefully this is isolated to the Double Edge Mask
node.

Pull Request: https://projects.blender.org/blender/blender/pulls/130163
2024-11-12 12:53:23 +01:00
Omar Emara
741c7d8a8a Compositor: Implement EWA filtering for new CPU compositor
Reference #125968.
2024-11-12 13:46:01 +02:00
Omar Emara
9d82daefdd Fix: Zero division in Plane Deform node
Points at infinity in the Plane Deform node causes zero division, so
early exist since they needn't be accumulated.
2024-11-12 13:44:01 +02:00
Omar Emara
b98185a035 Fix: Anti-Alias node produces wrong value when unlinked
The Anti-Alias node produces wrong values when unlinked due to a switch
case that mistakenly fall-through.
2024-11-12 07:49:51 +02:00
Omar Emara
778a86fa48 Compositor: Implement Keying Screen for new CPU compositor
Reference #125968.
2024-11-11 14:04:29 +02:00
Omar Emara
22b3aff9c8 Compositor: Implement SMAA for new CPU compositor
Reference #125968.
2024-11-11 09:24:51 +02:00
Omar Emara
a40046eae5 Compositor: Support bilinear sampling for new CPU compositor
Reference #125968.
2024-11-11 09:08:56 +02:00
Omar Emara
ad7f03c623 Compositor: Implement parallel reduction for new CPU compositor
Reference #125968.
2024-11-07 13:12:54 +02:00
Omar Emara
3cf944bae7 Refactor: Make result channels count public 2024-11-06 15:42:16 +02:00
Omar Emara
7471478b57 Compositor: Implement Texture node for new CPU compositor
Reference #125968.
2024-11-06 13:39:17 +02:00
Omar Emara
65797a5107 Compositor: Implement Mask node for new CPU compositor
Reference #125968.
2024-11-06 13:37:46 +02:00
Omar Emara
7220b3bb19 Compositor: Implement Bokeh Image for new CPU compositor
Reference #125968.
2024-11-06 13:36:41 +02:00
Campbell Barton
15c207a294 Merge branch 'blender-v4.3-release' 2024-11-02 17:34:00 +11:00
Campbell Barton
4df285ccd5 Cleanup: move function comments into headers or implementation notes
For C/C++ doc-strings should be located in headers,
move function comments into the headers, in some cases merging
with existing doc-strings, in other cases, moving implementation
notes into the function body.
2024-11-02 17:27:09 +11:00
Omar Emara
c6d4c759eb Compositor: Implement Color Balance node for new CPU compositor
Reference #125968.
2024-10-29 10:44:20 +03:00
Omar Emara
61eb3e06df Merge branch 'blender-v4.3-release' 2024-10-28 14:19:09 +03:00
Omar Emara
f0125f26fd Fix #129435: Bad Cryptomatte output in camera view
The Cryptomatte node produces a bad output when the viewport is in
camera view. That's because compositing is limited to the camera region
in that case, but the node assumes the full viewport size. To fix this,
only consider the compositing region instead of the full viewport.
2024-10-28 14:14:49 +03:00
Omar Emara
ba5c6c8682 Compositor: Implement Chroma Matte for new CPU compositor
Reference #125968.
2024-10-25 11:25:55 +03:00