New ("fullframe") CPU compositor backend is being used now, and all the code
related to "tiled" CPU compositor is just never used anymore. The new backend
is faster, uses less memory, better matches GPU compositor, etc.
TL;DR: 20 thousand lines of code gone.
This commit:
- Removes various bits and pieces related to "tiled" compositor (execution
groups, one-pixel-at-a-time node processing, read/write buffer operations
related to node execution groups).
- "GPU" (OpenCL) execution device, that was only used by several nodes of
the tiled compositor.
- With that, remove CLEW external library too, since nothing within Blender
uses OpenCL directly anymore.
Pull Request: https://projects.blender.org/blender/blender/pulls/118819
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
/* SPDX-FileCopyrightText: 2011 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#include "COM_DifferenceMatteOperation.h"
|
|
|
|
namespace blender::compositor {
|
|
|
|
DifferenceMatteOperation::DifferenceMatteOperation()
|
|
{
|
|
add_input_socket(DataType::Color);
|
|
add_input_socket(DataType::Color);
|
|
add_output_socket(DataType::Value);
|
|
|
|
flags_.can_be_constant = true;
|
|
}
|
|
|
|
void DifferenceMatteOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
|
const rcti &area,
|
|
Span<MemoryBuffer *> inputs)
|
|
{
|
|
for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
|
|
const float *color1 = it.in(0);
|
|
const float *color2 = it.in(1);
|
|
|
|
float difference = (fabsf(color2[0] - color1[0]) + fabsf(color2[1] - color1[1]) +
|
|
fabsf(color2[2] - color1[2]));
|
|
|
|
/* Average together the distances. */
|
|
difference = difference / 3.0f;
|
|
|
|
const float tolerance = settings_->t1;
|
|
const float falloff = settings_->t2;
|
|
|
|
/* Make 100% transparent. */
|
|
if (difference <= tolerance) {
|
|
it.out[0] = 0.0f;
|
|
}
|
|
/* In the falloff region, make partially transparent. */
|
|
else if (difference <= falloff + tolerance) {
|
|
difference = difference - tolerance;
|
|
const float alpha = difference / falloff;
|
|
/* Only change if more transparent than before. */
|
|
if (alpha < color1[3]) {
|
|
it.out[0] = alpha;
|
|
}
|
|
else { /* Leave as before. */
|
|
it.out[0] = color1[3];
|
|
}
|
|
}
|
|
else {
|
|
/* Foreground object. */
|
|
it.out[0] = color1[3];
|
|
}
|
|
}
|
|
}
|
|
|
|
} // namespace blender::compositor
|