[Bf-blender-cvs] [88d72a8f5c9] compositor-full-frame: Compositor: Full frame Bokeh Image node
Manuel Castilla
noreply at git.blender.org
Fri Jul 23 19:23:13 CEST 2021
Commit: 88d72a8f5c93c73338e762cd7cb65e89c16e3b25
Author: Manuel Castilla
Date: Fri Jul 23 17:29:35 2021 +0200
Branches: compositor-full-frame
https://developer.blender.org/rB88d72a8f5c93c73338e762cd7cb65e89c16e3b25
Compositor: Full frame Bokeh Image node
Adds full frame implementation to this node operation.
No functional changes.
===================================================================
M source/blender/compositor/operations/COM_BokehImageOperation.cc
M source/blender/compositor/operations/COM_BokehImageOperation.h
===================================================================
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cc b/source/blender/compositor/operations/COM_BokehImageOperation.cc
index 63f283b6acc..bd5b25b5af8 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.cc
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.cc
@@ -110,6 +110,31 @@ void BokehImageOperation::executePixelSampled(float output[4],
output[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f;
}
+void BokehImageOperation::update_memory_buffer_partial(MemoryBuffer *output,
+ const rcti &area,
+ Span<MemoryBuffer *> UNUSED(inputs))
+{
+ const float shift = this->m_data->lensshift;
+ const float shift2 = shift / 2.0f;
+ const float distance = this->m_circularDistance;
+ for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) {
+ const float insideBokehMax = isInsideBokeh(distance, it.x, it.y);
+ const float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), it.x, it.y);
+ const float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), it.x, it.y);
+ if (shift < 0) {
+ it.out[0] = insideBokehMax;
+ it.out[1] = insideBokehMed;
+ it.out[2] = insideBokehMin;
+ }
+ else {
+ it.out[0] = insideBokehMin;
+ it.out[1] = insideBokehMed;
+ it.out[2] = insideBokehMax;
+ }
+ it.out[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f;
+ }
+}
+
void BokehImageOperation::deinitExecution()
{
if (this->m_deleteData) {
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h
index 2e0bc8a34dc..2527233fabd 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.h
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.h
@@ -18,7 +18,7 @@
#pragma once
-#include "COM_NodeOperation.h"
+#include "COM_MultiThreadedOperation.h"
namespace blender::compositor {
@@ -49,7 +49,7 @@ namespace blender::compositor {
* With a simple compare it can be detected if the evaluated pixel is between the outer and inner
*edge.
*/
-class BokehImageOperation : public NodeOperation {
+class BokehImageOperation : public MultiThreadedOperation {
private:
/**
* \brief Settings of the bokeh image
@@ -151,6 +151,10 @@ class BokehImageOperation : public NodeOperation {
{
this->m_deleteData = true;
}
+
+ void update_memory_buffer_partial(MemoryBuffer *output,
+ const rcti &area,
+ Span<MemoryBuffer *> inputs) override;
};
} // namespace blender::compositor
More information about the Bf-blender-cvs
mailing list