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
This commit is contained in:
Manuel Castilla 2021-07-05 19:53:39 +02:00
parent 00c6cbb985
commit c94877ae3d
2 changed files with 18 additions and 2 deletions

View File

@ -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;

View File

@ -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