[Bf-blender-cvs] [c94877ae3d3] master: Compositor: Full frame Gamma node

Manuel Castilla noreply at git.blender.org
Mon Jul 5 23:51:56 CEST 2021


Commit: c94877ae3d38f2bd0a772caa09ad84647641b7f3
Author: Manuel Castilla
Date:   Mon Jul 5 19:53:39 2021 +0200
Branches: master
https://developer.blender.org/rBc94877ae3d38f2bd0a772caa09ad84647641b7f3

Compositor: Full frame Gamma node

Adds full frame implementation to this node operation.
No functional changes.
1.5x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11767

===================================================================

M	source/blender/compositor/operations/COM_GammaOperation.cc
M	source/blender/compositor/operations/COM_GammaOperation.h

===================================================================

diff --git a/source/blender/compositor/operations/COM_GammaOperation.cc b/source/blender/compositor/operations/COM_GammaOperation.cc
index 343e335070a..7083c677f03 100644
--- a/source/blender/compositor/operations/COM_GammaOperation.cc
+++ b/source/blender/compositor/operations/COM_GammaOperation.cc
@@ -51,6 +51,20 @@ void GammaOperation::executePixelSampled(float output[4], float x, float y, Pixe
   output[3] = inputValue[3];
 }
 
+void GammaOperation::update_memory_buffer_row(PixelCursor &p)
+{
+  for (; p.out < p.row_end; p.next()) {
+    const float *in_value = p.ins[0];
+    const float *in_gamma = p.ins[1];
+    const float gamma = in_gamma[0];
+    /* Check for negative to avoid nan's. */
+    p.out[0] = in_value[0] > 0.0f ? powf(in_value[0], gamma) : in_value[0];
+    p.out[1] = in_value[1] > 0.0f ? powf(in_value[1], gamma) : in_value[1];
+    p.out[2] = in_value[2] > 0.0f ? powf(in_value[2], gamma) : in_value[2];
+    p.out[3] = in_value[3];
+  }
+}
+
 void GammaOperation::deinitExecution()
 {
   this->m_inputProgram = nullptr;
diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h
index 034046106d6..713d3d8484f 100644
--- a/source/blender/compositor/operations/COM_GammaOperation.h
+++ b/source/blender/compositor/operations/COM_GammaOperation.h
@@ -18,11 +18,11 @@
 
 #pragma once
 
-#include "COM_NodeOperation.h"
+#include "COM_MultiThreadedRowOperation.h"
 
 namespace blender::compositor {
 
-class GammaOperation : public NodeOperation {
+class GammaOperation : public MultiThreadedRowOperation {
  private:
   /**
    * Cached reference to the inputProgram
@@ -47,6 +47,8 @@ class GammaOperation : public NodeOperation {
    * Deinitialize the execution
    */
   void deinitExecution() override;
+
+  void update_memory_buffer_row(PixelCursor &p) override;
 };
 
 }  // namespace blender::compositor



More information about the Bf-blender-cvs mailing list