Compositor: Full frame convert nodes
Adds full frame implementation to all nodes in "Converter" sub-menu except "ID Mask" which is implemented separately. No functional changes. Part of T88150. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D12095
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "COM_NodeOperation.h"
|
||||
#include "COM_MultiThreadedOperation.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace blender::compositor {
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MathBaseOperation : public NodeOperation {
|
||||
class MathBaseOperation : public MultiThreadedOperation {
|
||||
protected:
|
||||
/**
|
||||
* Prefetched reference to the inputProgram
|
||||
@@ -43,8 +43,24 @@ class MathBaseOperation : public NodeOperation {
|
||||
*/
|
||||
MathBaseOperation();
|
||||
|
||||
/* TODO(manzanilla): to be removed with tiled implementation. */
|
||||
void clampIfNeeded(float color[4]);
|
||||
|
||||
float clamp_when_enabled(float value)
|
||||
{
|
||||
if (this->m_useClamp) {
|
||||
return CLAMPIS(value, 0.0f, 1.0f);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
void clamp_when_enabled(float *out)
|
||||
{
|
||||
if (this->m_useClamp) {
|
||||
CLAMP(*out, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Initialize the execution
|
||||
@@ -66,87 +82,151 @@ class MathBaseOperation : public NodeOperation {
|
||||
{
|
||||
this->m_useClamp = value;
|
||||
}
|
||||
|
||||
void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) final;
|
||||
|
||||
protected:
|
||||
virtual void update_memory_buffer_partial(BuffersIterator<float> &it) = 0;
|
||||
};
|
||||
|
||||
class MathAddOperation : public MathBaseOperation {
|
||||
template<template<typename> typename TFunctor>
|
||||
class MathFunctor2Operation : public MathBaseOperation {
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) final
|
||||
{
|
||||
TFunctor functor;
|
||||
for (; !it.is_end(); ++it) {
|
||||
*it.out = functor(*it.in(0), *it.in(1));
|
||||
clamp_when_enabled(it.out);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class MathAddOperation : public MathFunctor2Operation<std::plus> {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
};
|
||||
class MathSubtractOperation : public MathBaseOperation {
|
||||
class MathSubtractOperation : public MathFunctor2Operation<std::minus> {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
};
|
||||
class MathMultiplyOperation : public MathBaseOperation {
|
||||
class MathMultiplyOperation : public MathFunctor2Operation<std::multiplies> {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
};
|
||||
class MathDivideOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathSineOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathCosineOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathTangentOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathHyperbolicSineOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathHyperbolicCosineOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathHyperbolicTangentOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathArcSineOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathArcCosineOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathArcTangentOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathPowerOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathLogarithmOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathMinimumOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathMaximumOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathRoundOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
class MathLessThanOperation : public MathBaseOperation {
|
||||
class MathLessThanOperation : public MathFunctor2Operation<std::less> {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
};
|
||||
class MathGreaterThanOperation : public MathBaseOperation {
|
||||
class MathGreaterThanOperation : public MathFunctor2Operation<std::greater> {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
};
|
||||
@@ -154,101 +234,161 @@ class MathGreaterThanOperation : public MathBaseOperation {
|
||||
class MathModuloOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathAbsoluteOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathRadiansOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathDegreesOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathArcTan2Operation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathFloorOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathCeilOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathFractOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathSqrtOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathInverseSqrtOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathSignOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathExponentOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathTruncOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathSnapOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathWrapOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathPingpongOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathCompareOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathMultiplyAddOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathSmoothMinOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
class MathSmoothMaxOperation : public MathBaseOperation {
|
||||
public:
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_partial(BuffersIterator<float> &it) override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
Reference in New Issue
Block a user