svn merge ^/trunk/blender -r49763:49774

This commit is contained in:
Campbell Barton
2012-08-10 15:45:09 +00:00
273 changed files with 1018 additions and 990 deletions

View File

@@ -451,7 +451,7 @@ if not os.path.isdir ( B.root_build_dir):
if not os.path.isdir ( B.root_build_dir + 'data_headers'):
os.makedirs ( B.root_build_dir + 'data_headers' )
# use for includes
env['DATA_HEADERS'] = "#" + env['BF_BUILDDIR'] + "/data_headers"
env['DATA_HEADERS'] = os.path.join(os.path.abspath(env['BF_BUILDDIR']), "data_headers")
def ensure_data(FILE_FROM, FILE_TO, VAR_NAME):
if os.sep == "\\":
FILE_FROM = FILE_FROM.replace("/", "\\")

View File

@@ -2486,7 +2486,7 @@ static ImBuf *do_adjustment_impl(SeqRenderData context, Sequence *seq, float cfr
seqbasep = BKE_sequence_seqbase(&ed->seqbase, seq);
if (seq->machine > 0) {
if (seq->machine > 1) {
i = BKE_sequencer_give_ibuf_seqbase(context, cfra, seq->machine - 1, seqbasep);
}

View File

@@ -3774,7 +3774,7 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
return seq;
}
#else // WITH_AUDASPACE
Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
{
(void) C;
(void) seqbasep;

View File

@@ -107,4 +107,6 @@ typedef enum OrderOfChunks {
#define COM_NUMBER_OF_CHANNELS 4
#define COM_BLUR_BOKEH_PIXELS 512
#endif

View File

@@ -186,7 +186,7 @@ void ExecutionGroup::deinitExecution()
this->m_cachedReadOperations.clear();
this->m_bTree = NULL;
}
void ExecutionGroup::determineResolution(unsigned int resolution[])
void ExecutionGroup::determineResolution(unsigned int resolution[2])
{
NodeOperation *operation = this->getOutputNodeOperation();
resolution[0] = operation->getWidth();

View File

@@ -270,13 +270,13 @@ public:
* @brief determine the resolution of this ExecutionGroup
* @param resolution
*/
void determineResolution(unsigned int resolution[]);
void determineResolution(unsigned int resolution[2]);
/**
* @brief set the resolution of this executiongroup
* @param resolution
*/
void setResolution(unsigned int resolution[]) { this->m_width = resolution[0]; this->m_height = resolution[1]; }
void setResolution(unsigned int resolution[2]) { this->m_width = resolution[0]; this->m_height = resolution[1]; }
/**
* @brief get the width of this execution group

View File

@@ -54,7 +54,7 @@ SocketConnection *InputSocket::getConnection()
return this->m_connection;
}
void InputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void InputSocket::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
if (this->isConnected()) {
this->m_connection->getFromSocket()->determineResolution(resolution, preferredResolution);

View File

@@ -89,7 +89,7 @@ public:
* @param resolution the result of this operation
* @param preferredResolution the preferrable resolution as no resolution could be determined
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
/**
* @brief Notifies the Input of the data type (via a SocketConnection)

View File

@@ -26,14 +26,12 @@ class MemoryBuffer;
#define _COM_MemoryBuffer_h_
#include "COM_ExecutionGroup.h"
#include "BLI_rect.h"
#include "COM_MemoryProxy.h"
extern "C" {
//#include "BLI_threads.h"
#include "BLI_math.h"
#include "BLI_rect.h"
}
//#include <vector>
/**
* @brief state of a memory buffer
@@ -147,6 +145,18 @@ public:
const int dx = x - this->m_rect.xmin;
const int dy = y - this->m_rect.ymin;
const int offset = (this->m_chunkWidth * dy + dx) * COM_NUMBER_OF_CHANNELS;
BLI_assert(offset >= 0);
BLI_assert(offset < this->determineBufferSize() * COM_NUMBER_OF_CHANNELS);
BLI_assert(x >= this->m_rect.xmin && x < this->m_rect.xmax &&
y >= this->m_rect.ymin && y < this->m_rect.ymax);
#if 0
/* always true */
BLI_assert((int)(MEM_allocN_len(this->m_buffer) / sizeof(*this->m_buffer)) ==
(int)(this->determineBufferSize() * COM_NUMBER_OF_CHANNELS));
#endif
copy_v4_v4(result, &this->m_buffer[offset]);
}

View File

@@ -38,7 +38,7 @@ NodeOperation::NodeOperation() : NodeBase()
this->m_btree = NULL;
}
void NodeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void NodeOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
unsigned int temp[2];
unsigned int temp2[2];

View File

@@ -96,7 +96,7 @@ public:
* @param resolution the result of this operation
* @param preferredResolution the preferrable resolution as no resolution could be determined
*/
virtual void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
virtual void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
/**
* @brief isOutputOperation determines whether this operation is an output of the ExecutionSystem during rendering or editing.
@@ -174,7 +174,7 @@ public:
* @brief set the resolution
* @param resolution the resolution to set
*/
void setResolution(unsigned int resolution[]) {
void setResolution(unsigned int resolution[2]) {
if (!isResolutionSet()) {
this->m_width = resolution[0];
this->m_height = resolution[1];

View File

@@ -33,7 +33,7 @@ OutputSocket::OutputSocket(DataType datatype) : Socket(datatype)
int OutputSocket::isOutputSocket() const { return true; }
const int OutputSocket::isConnected() const { return this->m_connections.size() != 0; }
void OutputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void OutputSocket::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
NodeBase *node = this->getNode();
if (node->isOperation()) {

View File

@@ -59,7 +59,7 @@ public:
* @param resolution the result of this operation
* @param preferredResolution the preferrable resolution as no resolution could be determined
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
/**
* @brief determine the actual data type and channel info.

View File

@@ -33,9 +33,9 @@ void SingleThreadedNodeOperation::initExecution()
initMutex();
}
void SingleThreadedNodeOperation::executePixel(float *color, int x, int y, void *data)
void SingleThreadedNodeOperation::executePixel(float output[4], int x, int y, void *data)
{
this->m_cachedInstance->readNoCheck(color, x, y);
this->m_cachedInstance->readNoCheck(output, x, y);
}
void SingleThreadedNodeOperation::deinitExecution()

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -73,7 +73,7 @@ public:
const virtual int isConnected() const;
int isInputSocket() const;
int isOutputSocket() const;
virtual void determineResolution(int resolution[], unsigned int preferredResolution[]) {}
virtual void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) {}
void setEditorSocket(bNodeSocket *editorSocket) { this->m_editorSocket = editorSocket; }
bNodeSocket *getbNodeSocket() const { return this->m_editorSocket; }

View File

@@ -63,7 +63,7 @@ protected:
* @param y the y-coordinate of the pixel to calculate in image space
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
*/
virtual void executePixel(float *result, float x, float y, PixelSampler sampler) {}
virtual void executePixel(float output[4], float x, float y, PixelSampler sampler) {}
/**
* @brief calculate a single pixel
@@ -74,8 +74,8 @@ protected:
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
* @param chunkData chunk specific data a during execution time.
*/
virtual void executePixel(float *result, int x, int y, void *chunkData) {
executePixel(result, x, y, COM_PS_NEAREST);
virtual void executePixel(float output[4], int x, int y, void *chunkData) {
executePixel(output, x, y, COM_PS_NEAREST);
}
/**
@@ -88,7 +88,7 @@ protected:
* @param dy
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
*/
virtual void executePixel(float *result, float x, float y, float dx, float dy) {}
virtual void executePixel(float output[4], float x, float y, float dx, float dy) {}
public:
inline void read(float *result, float x, float y, PixelSampler sampler) {

View File

@@ -36,24 +36,42 @@ BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode)
void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
BokehBlurOperation *operation = new BokehBlurOperation();
InputSocket *inputSizeSocket = this->getInputSocket(2);
bool connectedSizeSocket = inputSizeSocket->isConnected();
const bNodeSocket *sock = this->getInputSocket(2)->getbNodeSocket();
const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value;
if (connectedSizeSocket) {
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
this->getInputSocket(2)->relinkConnections(operation->getInputSocket(3), 2, graph);
this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph);
//operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value);
operation->setQuality(context->getQuality());
operation->setbNode(this->getbNode());
graph->addOperation(operation);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph);
operation->setQuality(context->getQuality());
operation->setbNode(this->getbNode());
graph->addOperation(operation);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
operation->setThreshold(0.0f);
/* TODO, we need to know the max input pixel of the input, this value is arbitrary! */
operation->setMaxBlur(100.0f);
operation->setDoScaleSize(true);
}
else {
BokehBlurOperation *operation = new BokehBlurOperation();
const bNodeSocket *sock = this->getInputSocket(2)->getbNodeSocket();
const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value;
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
this->getInputSocket(2)->relinkConnections(operation->getInputSocket(3), 2, graph);
this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph);
//operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value);
operation->setQuality(context->getQuality());
operation->setbNode(this->getbNode());
graph->addOperation(operation);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
if (!connectedSizeSocket) {
operation->setSize(size);
}
}

View File

@@ -27,7 +27,7 @@ AlphaOverKeyOperation::AlphaOverKeyOperation() : MixBaseOperation()
/* pass */
}
void AlphaOverKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void AlphaOverKeyOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputOverColor[4];
@@ -38,18 +38,18 @@ void AlphaOverKeyOperation::executePixel(float *outputValue, float x, float y, P
this->m_inputColor2Operation->read(inputOverColor, x, y, sampler);
if (inputOverColor[3] <= 0.0f) {
copy_v4_v4(outputValue, inputColor1);
copy_v4_v4(output, inputColor1);
}
else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) {
copy_v4_v4(outputValue, inputOverColor);
copy_v4_v4(output, inputOverColor);
}
else {
float premul = value[0] * inputOverColor[3];
float mul = 1.0f - premul;
outputValue[0] = (mul * inputColor1[0]) + premul * inputOverColor[0];
outputValue[1] = (mul * inputColor1[1]) + premul * inputOverColor[1];
outputValue[2] = (mul * inputColor1[2]) + premul * inputOverColor[2];
outputValue[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
output[0] = (mul * inputColor1[0]) + premul * inputOverColor[0];
output[1] = (mul * inputColor1[1]) + premul * inputOverColor[1];
output[2] = (mul * inputColor1[2]) + premul * inputOverColor[2];
output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
}
}

View File

@@ -39,6 +39,6 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ AlphaOverMixedOperation::AlphaOverMixedOperation() : MixBaseOperation()
this->m_x = 0.0f;
}
void AlphaOverMixedOperation::executePixel(float outputValue[4], float x, float y, PixelSampler sampler)
void AlphaOverMixedOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputOverColor[4];
@@ -38,20 +38,20 @@ void AlphaOverMixedOperation::executePixel(float outputValue[4], float x, float
this->m_inputColor2Operation->read(inputOverColor, x, y, sampler);
if (inputOverColor[3] <= 0.0f) {
copy_v4_v4(outputValue, inputColor1);
copy_v4_v4(output, inputColor1);
}
else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) {
copy_v4_v4(outputValue, inputOverColor);
copy_v4_v4(output, inputOverColor);
}
else {
float addfac = 1.0f - this->m_x + inputOverColor[3] * this->m_x;
float premul = value[0] * addfac;
float mul = 1.0f - value[0] * inputOverColor[3];
outputValue[0] = (mul * inputColor1[0]) + premul * inputOverColor[0];
outputValue[1] = (mul * inputColor1[1]) + premul * inputOverColor[1];
outputValue[2] = (mul * inputColor1[2]) + premul * inputOverColor[2];
outputValue[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
output[0] = (mul * inputColor1[0]) + premul * inputOverColor[0];
output[1] = (mul * inputColor1[1]) + premul * inputOverColor[1];
output[2] = (mul * inputColor1[2]) + premul * inputOverColor[2];
output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
}
}

View File

@@ -41,7 +41,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void setX(float x) { this->m_x = x; }
};

View File

@@ -27,7 +27,7 @@ AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation() : MixBaseOperatio
/* pass */
}
void AlphaOverPremultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void AlphaOverPremultiplyOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputOverColor[4];
@@ -39,18 +39,18 @@ void AlphaOverPremultiplyOperation::executePixel(float *outputValue, float x, fl
/* Zero alpha values should still permit an add of RGB data */
if (inputOverColor[3] < 0.0f) {
copy_v4_v4(outputValue, inputColor1);
copy_v4_v4(output, inputColor1);
}
else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) {
copy_v4_v4(outputValue, inputOverColor);
copy_v4_v4(output, inputOverColor);
}
else {
float mul = 1.0f - value[0] * inputOverColor[3];
outputValue[0] = (mul * inputColor1[0]) + value[0] * inputOverColor[0];
outputValue[1] = (mul * inputColor1[1]) + value[0] * inputOverColor[1];
outputValue[2] = (mul * inputColor1[2]) + value[0] * inputOverColor[2];
outputValue[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
output[0] = (mul * inputColor1[0]) + value[0] * inputOverColor[0];
output[1] = (mul * inputColor1[1]) + value[0] * inputOverColor[1];
output[2] = (mul * inputColor1[2]) + value[0] * inputOverColor[2];
output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
}
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -42,14 +42,14 @@ void AntiAliasOperation::initExecution()
NodeOperation::initMutex();
}
void AntiAliasOperation::executePixel(float *color, int x, int y, void *data)
void AntiAliasOperation::executePixel(float output[4], int x, int y, void *data)
{
if (y < 0 || (unsigned int)y >= this->m_height || x < 0 || (unsigned int)x >= this->m_width) {
color[0] = 0.0f;
output[0] = 0.0f;
}
else {
int offset = y * this->m_width + x;
color[0] = this->m_buffer[offset] / 255.0f;
output[0] = this->m_buffer[offset] / 255.0f;
}
}

View File

@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -46,7 +46,7 @@ void BilateralBlurOperation::initExecution()
QualityStepHelper::initExecution(COM_QH_INCREASE);
}
void BilateralBlurOperation::executePixel(float *color, int x, int y, void *data)
void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
// read the determinator color at x, y, this will be used as the reference color for the determinator
float determinatorReferenceColor[4];
@@ -82,13 +82,13 @@ void BilateralBlurOperation::executePixel(float *color, int x, int y, void *data
}
if (blurDivider > 0.0f) {
mul_v4_v4fl(color, blurColor, 1.0f / blurDivider);
mul_v4_v4fl(output, blurColor, 1.0f / blurDivider);
}
else {
color[0] = 0.0f;
color[1] = 0.0f;
color[2] = 0.0f;
color[3] = 1.0f;
output[0] = 0.0f;
output[1] = 0.0f;
output[2] = 0.0f;
output[3] = 1.0f;
}
}

View File

@@ -38,7 +38,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -74,7 +74,7 @@ void BokehBlurOperation::initExecution()
QualityStepHelper::initExecution(COM_QH_INCREASE);
}
void BokehBlurOperation::executePixel(float *color, int x, int y, void *data)
void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
float color_accum[4];
float tempBoundingBox[4];
@@ -124,13 +124,13 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, void *data)
bufferindex += offsetadd;
}
}
color[0] = color_accum[0] * (1.0f / multiplier_accum[0]);
color[1] = color_accum[1] * (1.0f / multiplier_accum[1]);
color[2] = color_accum[2] * (1.0f / multiplier_accum[2]);
color[3] = color_accum[3] * (1.0f / multiplier_accum[3]);
output[0] = color_accum[0] * (1.0f / multiplier_accum[0]);
output[1] = color_accum[1] * (1.0f / multiplier_accum[1]);
output[2] = color_accum[2] * (1.0f / multiplier_accum[2]);
output[3] = color_accum[3] * (1.0f / multiplier_accum[3]);
}
else {
this->m_inputProgram->read(color, x, y, COM_PS_NEAREST);
this->m_inputProgram->read(output, x, y, COM_PS_NEAREST);
}
}

View File

@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -30,10 +30,8 @@ BokehImageOperation::BokehImageOperation() : NodeOperation()
}
void BokehImageOperation::initExecution()
{
this->m_centerX = getWidth() / 2;
this->m_centerY = getHeight() / 2;
this->m_center[0] = this->m_centerX;
this->m_center[1] = this->m_centerY;
this->m_center[0] = getWidth() / 2;
this->m_center[1] = getHeight() / 2;
this->m_inverseRounding = 1.0f - this->m_data->rounding;
this->m_circularDistance = getWidth() / 2;
this->m_flapRad = (float)(M_PI * 2) / this->m_data->flaps;
@@ -47,14 +45,14 @@ void BokehImageOperation::initExecution()
}
void BokehImageOperation::detemineStartPointOfFlap(float r[2], int flapNumber, float distance)
{
r[0] = sinf(this->m_flapRad * flapNumber + this->m_flapRadAdd) * distance + this->m_centerX;
r[1] = cosf(this->m_flapRad * flapNumber + this->m_flapRadAdd) * distance + this->m_centerY;
r[0] = sinf(this->m_flapRad * flapNumber + this->m_flapRadAdd) * distance + this->m_center[0];
r[1] = cosf(this->m_flapRad * flapNumber + this->m_flapRadAdd) * distance + this->m_center[1];
}
float BokehImageOperation::isInsideBokeh(float distance, float x, float y)
{
float insideBokeh = 0.0f;
const float deltaX = x - this->m_centerX;
const float deltaY = y - this->m_centerY;
const float deltaX = x - this->m_center[0];
const float deltaY = y - this->m_center[1];
float closestPoint[2];
float lineP1[2];
float lineP2[2];
@@ -87,7 +85,7 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y)
}
return insideBokeh;
}
void BokehImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void BokehImageOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float shift = this->m_data->lensshift;
float shift2 = shift / 2.0f;
@@ -96,16 +94,16 @@ void BokehImageOperation::executePixel(float *color, float x, float y, PixelSamp
float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), x, y);
float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), x, y);
if (shift < 0) {
color[0] = insideBokehMax;
color[1] = insideBokehMed;
color[2] = insideBokehMin;
output[0] = insideBokehMax;
output[1] = insideBokehMed;
output[2] = insideBokehMin;
}
else {
color[0] = insideBokehMin;
color[1] = insideBokehMed;
color[2] = insideBokehMax;
output[0] = insideBokehMin;
output[1] = insideBokehMed;
output[2] = insideBokehMax;
}
color[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f;
output[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f;
}
void BokehImageOperation::deinitExecution()
@@ -118,8 +116,8 @@ void BokehImageOperation::deinitExecution()
}
}
void BokehImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void BokehImageOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
resolution[0] = 512;
resolution[1] = 512;
resolution[0] = COM_BLUR_BOKEH_PIXELS;
resolution[1] = COM_BLUR_BOKEH_PIXELS;
}

View File

@@ -30,8 +30,6 @@ private:
NodeBokehImage *m_data;
float m_center[2];
float m_centerX;
float m_centerY;
float m_inverseRounding;
float m_circularDistance;
float m_flapRad;
@@ -47,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution
@@ -59,7 +57,7 @@ public:
*/
void deinitExecution();
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
void setData(NodeBokehImage *data) { this->m_data = data; }
void deleteDataOnFinish() { this->m_deleteData = true; }

View File

@@ -44,7 +44,7 @@ void BoxMaskOperation::initExecution()
this->m_aspectRatio = ((float)this->getWidth()) / this->getHeight();
}
void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void BoxMaskOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputMask[4];
float inputValue[4];
@@ -70,40 +70,40 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler
switch (this->m_maskType) {
case CMP_NODE_MASKTYPE_ADD:
if (inside) {
color[0] = max(inputMask[0], inputValue[0]);
output[0] = max(inputMask[0], inputValue[0]);
}
else {
color[0] = inputMask[0];
output[0] = inputMask[0];
}
break;
case CMP_NODE_MASKTYPE_SUBTRACT:
if (inside) {
color[0] = inputMask[0] - inputValue[0];
CLAMP(color[0], 0, 1);
output[0] = inputMask[0] - inputValue[0];
CLAMP(output[0], 0, 1);
}
else {
color[0] = inputMask[0];
output[0] = inputMask[0];
}
break;
case CMP_NODE_MASKTYPE_MULTIPLY:
if (inside) {
color[0] = inputMask[0] * inputValue[0];
output[0] = inputMask[0] * inputValue[0];
}
else {
color[0] = 0;
output[0] = 0;
}
break;
case CMP_NODE_MASKTYPE_NOT:
if (inside) {
if (inputMask[0] > 0.0f) {
color[0] = 0;
output[0] = 0;
}
else {
color[0] = inputValue[0];
output[0] = inputValue[0];
}
}
else {
color[0] = inputMask[0];
output[0] = inputMask[0];
}
break;
}

View File

@@ -45,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -37,7 +37,7 @@ void BrightnessOperation::initExecution()
this->m_inputContrastProgram = this->getInputSocketReader(2);
}
void BrightnessOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void BrightnessOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue[4];
float a, b;
@@ -65,10 +65,10 @@ void BrightnessOperation::executePixel(float *color, float x, float y, PixelSamp
b = a * (brightness + delta);
}
color[0] = a * inputValue[0] + b;
color[1] = a * inputValue[1] + b;
color[2] = a * inputValue[2] + b;
color[3] = inputValue[3];
output[0] = a * inputValue[0] + b;
output[1] = a * inputValue[1] + b;
output[2] = a * inputValue[2] + b;
output[3] = inputValue[3];
}
void BrightnessOperation::deinitExecution()

View File

@@ -40,7 +40,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -42,9 +42,9 @@ void CalculateMeanOperation::initExecution()
NodeOperation::initMutex();
}
void CalculateMeanOperation::executePixel(float *color, int x, int y, void *data)
void CalculateMeanOperation::executePixel(float output[4], int x, int y, void *data)
{
color[0] = this->m_result;
output[0] = this->m_result;
}
void CalculateMeanOperation::deinitExecution()

View File

@@ -46,7 +46,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -31,9 +31,9 @@ CalculateStandardDeviationOperation::CalculateStandardDeviationOperation() : Cal
/* pass */
}
void CalculateStandardDeviationOperation::executePixel(float *color, int x, int y, void *data)
void CalculateStandardDeviationOperation::executePixel(float output[4], int x, int y, void *data)
{
color[0] = this->m_standardDeviation;
output[0] = this->m_standardDeviation;
}
void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect)

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
void *initializeTileData(rcti *rect);

View File

@@ -39,17 +39,17 @@ void ChangeHSVOperation::deinitExecution()
this->m_inputOperation = NULL;
}
void ChangeHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ChangeHSVOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
this->m_inputOperation->read(inputColor1, x, y, sampler);
outputValue[0] = inputColor1[0] + (this->m_hue - 0.5f);
if (outputValue[0] > 1.0f) outputValue[0] -= 1.0f;
else if (outputValue[0] < 0.0f) outputValue[0] += 1.0f;
outputValue[1] = inputColor1[1] * this->m_saturation;
outputValue[2] = inputColor1[2] * this->m_value;
outputValue[3] = inputColor1[3];
output[0] = inputColor1[0] + (this->m_hue - 0.5f);
if (output[0] > 1.0f) output[0] -= 1.0f;
else if (output[0] < 0.0f) output[0] += 1.0f;
output[1] = inputColor1[1] * this->m_saturation;
output[2] = inputColor1[2] * this->m_value;
output[3] = inputColor1[3];
}

View File

@@ -49,7 +49,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void setHue(float hue) { this->m_hue = hue; }
void setSaturation(float saturation) { this->m_saturation = saturation; }

View File

@@ -83,7 +83,7 @@ void ChannelMatteOperation::deinitExecution()
this->m_inputImageProgram = NULL;
}
void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ChannelMatteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inColor[4];
float alpha;
@@ -116,6 +116,6 @@ void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, P
*/
/* don't make something that was more transparent less transparent */
outputValue[0] = min(alpha, inColor[3]);
output[0] = min(alpha, inColor[3]);
}

View File

@@ -59,7 +59,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -44,7 +44,7 @@ void ChromaMatteOperation::deinitExecution()
this->m_inputKeyProgram = NULL;
}
void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ChromaMatteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inKey[4];
float inImage[4];
@@ -88,14 +88,14 @@ void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, Pi
/* don't make something that was more transparent less transparent */
if (alpha < inImage[3]) {
outputValue[0] = alpha;
output[0] = alpha;
}
else {
outputValue[0] = inImage[3];
output[0] = inImage[3];
}
}
else { /*pixel is outside key color */
outputValue[0] = inImage[3]; /* make pixel just as transparent as it was before */
output[0] = inImage[3]; /* make pixel just as transparent as it was before */
}
}

View File

@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -49,7 +49,7 @@ void ColorBalanceASCCDLOperation::initExecution()
this->m_inputColorOperation = this->getInputSocketReader(1);
}
void ColorBalanceASCCDLOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler)
void ColorBalanceASCCDLOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
float value[4];
@@ -61,10 +61,10 @@ void ColorBalanceASCCDLOperation::executePixel(float *outputColor, float x, floa
fac = min(1.0f, fac);
const float mfac = 1.0f - fac;
outputColor[0] = mfac * inputColor[0] + fac *colorbalance_cdl(inputColor[0], this->m_lift[0], this->m_gamma[0], this->m_gain[0]);
outputColor[1] = mfac * inputColor[1] + fac *colorbalance_cdl(inputColor[1], this->m_lift[1], this->m_gamma[1], this->m_gain[1]);
outputColor[2] = mfac * inputColor[2] + fac *colorbalance_cdl(inputColor[2], this->m_lift[2], this->m_gamma[2], this->m_gain[2]);
outputColor[3] = inputColor[3];
output[0] = mfac * inputColor[0] + fac *colorbalance_cdl(inputColor[0], this->m_lift[0], this->m_gamma[0], this->m_gain[0]);
output[1] = mfac * inputColor[1] + fac *colorbalance_cdl(inputColor[1], this->m_lift[1], this->m_gamma[1], this->m_gain[1]);
output[2] = mfac * inputColor[2] + fac *colorbalance_cdl(inputColor[2], this->m_lift[2], this->m_gamma[2], this->m_gain[2]);
output[3] = inputColor[3];
}

View File

@@ -49,7 +49,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -54,7 +54,7 @@ void ColorBalanceLGGOperation::initExecution()
this->m_inputColorOperation = this->getInputSocketReader(1);
}
void ColorBalanceLGGOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler)
void ColorBalanceLGGOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
float value[4];
@@ -66,10 +66,10 @@ void ColorBalanceLGGOperation::executePixel(float *outputColor, float x, float y
fac = min(1.0f, fac);
const float mfac = 1.0f - fac;
outputColor[0] = mfac * inputColor[0] + fac *colorbalance_lgg(inputColor[0], this->m_lift[0], this->m_gamma_inv[0], this->m_gain[0]);
outputColor[1] = mfac * inputColor[1] + fac *colorbalance_lgg(inputColor[1], this->m_lift[1], this->m_gamma_inv[1], this->m_gain[1]);
outputColor[2] = mfac * inputColor[2] + fac *colorbalance_lgg(inputColor[2], this->m_lift[2], this->m_gamma_inv[2], this->m_gain[2]);
outputColor[3] = inputColor[3];
output[0] = mfac * inputColor[0] + fac * colorbalance_lgg(inputColor[0], this->m_lift[0], this->m_gamma_inv[0], this->m_gain[0]);
output[1] = mfac * inputColor[1] + fac * colorbalance_lgg(inputColor[1], this->m_lift[1], this->m_gamma_inv[1], this->m_gain[1]);
output[2] = mfac * inputColor[2] + fac * colorbalance_lgg(inputColor[2], this->m_lift[2], this->m_gamma_inv[2], this->m_gain[2]);
output[3] = inputColor[3];
}

View File

@@ -50,7 +50,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -40,7 +40,7 @@ void ColorCorrectionOperation::initExecution()
this->m_inputMask = this->getInputSocketReader(1);
}
void ColorCorrectionOperation::executePixel(float *output, float x, float y, PixelSampler sampler)
void ColorCorrectionOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputImageColor[4];
float inputMask[4];

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -58,7 +58,7 @@ void ColorCurveOperation::initExecution()
}
void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ColorCurveOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
CurveMapping *cumap = this->m_curveMapping;
CurveMapping *workingCopy = (CurveMapping *)MEM_dupallocN(cumap);
@@ -77,18 +77,18 @@ void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSamp
this->m_inputImageProgram->read(image, x, y, sampler);
if (*fac >= 1.0f)
curvemapping_evaluate_premulRGBF(workingCopy, color, image);
curvemapping_evaluate_premulRGBF(workingCopy, output, image);
else if (*fac <= 0.0f) {
copy_v3_v3(color, image);
copy_v3_v3(output, image);
}
else {
float col[4], mfac = 1.0f - *fac;
curvemapping_evaluate_premulRGBF(workingCopy, col, image);
color[0] = mfac * image[0] + *fac * col[0];
color[1] = mfac * image[1] + *fac * col[1];
color[2] = mfac * image[2] + *fac * col[2];
output[0] = mfac * image[0] + *fac * col[0];
output[1] = mfac * image[1] + *fac * col[1];
output[2] = mfac * image[2] + *fac * col[2];
}
color[3] = image[3];
output[3] = image[3];
MEM_freeN(workingCopy);
}
@@ -126,7 +126,7 @@ void ConstantLevelColorCurveOperation::initExecution()
curvemapping_set_black_white(this->m_curveMapping, this->m_black, this->m_white);
}
void ConstantLevelColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ConstantLevelColorCurveOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float fac[4];
float image[4];
@@ -136,18 +136,18 @@ void ConstantLevelColorCurveOperation::executePixel(float *color, float x, float
this->m_inputImageProgram->read(image, x, y, sampler);
if (*fac >= 1.0f)
curvemapping_evaluate_premulRGBF(this->m_curveMapping, color, image);
curvemapping_evaluate_premulRGBF(this->m_curveMapping, output, image);
else if (*fac <= 0.0f) {
copy_v3_v3(color, image);
copy_v3_v3(output, image);
}
else {
float col[4], mfac = 1.0f - *fac;
curvemapping_evaluate_premulRGBF(this->m_curveMapping, col, image);
color[0] = mfac * image[0] + *fac * col[0];
color[1] = mfac * image[1] + *fac * col[1];
color[2] = mfac * image[2] + *fac * col[2];
output[0] = mfac * image[0] + *fac * col[0];
output[1] = mfac * image[1] + *fac * col[1];
output[2] = mfac * image[2] + *fac * col[2];
}
color[3] = image[3];
output[3] = image[3];
}
void ConstantLevelColorCurveOperation::deinitExecution()

View File

@@ -41,7 +41,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution
@@ -70,7 +70,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -44,7 +44,7 @@ void ColorMatteOperation::deinitExecution()
this->m_inputKeyProgram = NULL;
}
void ColorMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ColorMatteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inColor[4];
float inKey[4];
@@ -75,11 +75,11 @@ void ColorMatteOperation::executePixel(float *outputValue, float x, float y, Pix
/* hue */ ((h_wrap = 2.f * fabsf(inColor[0] - inKey[0])) < hue || (2.f - h_wrap) < hue)
)
{
outputValue[0] = 0.0f; /* make transparent */
output[0] = 0.0f; /* make transparent */
}
else { /*pixel is outside key color */
outputValue[0] = inColor[3]; /* make pixel just as transparent as it was before */
output[0] = inColor[3]; /* make pixel just as transparent as it was before */
}
}

View File

@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -43,12 +43,12 @@ void ColorRampOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
void ColorRampOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ColorRampOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float values[4];
this->m_inputProgram->read(values, x, y, sampler);
do_colorband(this->m_colorBand, values[0], color);
do_colorband(this->m_colorBand, values[0], output);
}
void ColorRampOperation::deinitExecution()

View File

@@ -38,7 +38,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -84,7 +84,7 @@ void ColorSpillOperation::deinitExecution()
this->m_inputFacReader = NULL;
}
void ColorSpillOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ColorSpillOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float fac[4];
float input[4];
@@ -93,13 +93,13 @@ void ColorSpillOperation::executePixel(float *outputValue, float x, float y, Pix
float rfac = min(1.0f, fac[0]);
float map = calculateMapValue(rfac, input);
if (map > 0.0f) {
outputValue[0] = input[0] + this->m_rmut * (this->m_settings->uspillr * map);
outputValue[1] = input[1] + this->m_gmut * (this->m_settings->uspillg * map);
outputValue[2] = input[2] + this->m_bmut * (this->m_settings->uspillb * map);
outputValue[3] = input[3];
output[0] = input[0] + this->m_rmut * (this->m_settings->uspillr * map);
output[1] = input[1] + this->m_gmut * (this->m_settings->uspillg * map);
output[2] = input[2] + this->m_bmut * (this->m_settings->uspillb * map);
output[3] = input[3];
}
else {
copy_v4_v4(outputValue, input);
copy_v4_v4(output, input);
}
}
float ColorSpillOperation::calculateMapValue(float fac, float *input)

View File

@@ -46,7 +46,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -79,24 +79,24 @@ void CombineChannelsOperation::deinitExecution()
}
void CombineChannelsOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void CombineChannelsOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float input[4];
/// @todo: remove if statements
if (this->m_inputChannel1Operation) {
this->m_inputChannel1Operation->read(input, x, y, sampler);
color[0] = input[0];
output[0] = input[0];
}
if (this->m_inputChannel2Operation) {
this->m_inputChannel2Operation->read(input, x, y, sampler);
color[1] = input[0];
output[1] = input[0];
}
if (this->m_inputChannel3Operation) {
this->m_inputChannel3Operation->read(input, x, y, sampler);
color[2] = input[0];
output[2] = input[0];
}
if (this->m_inputChannel4Operation) {
this->m_inputChannel4Operation->read(input, x, y, sampler);
color[3] = input[0];
output[3] = input[0];
}
}

View File

@@ -33,7 +33,7 @@ private:
SocketReader *m_inputChannel4Operation;
public:
CombineChannelsOperation();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -158,7 +158,7 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber)
}
}
void CompositorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void CompositorOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
int width = this->m_rd->xsch * this->m_rd->size / 100;
int height = this->m_rd->ysch * this->m_rd->size / 100;

View File

@@ -71,6 +71,6 @@ public:
void initExecution();
void deinitExecution();
const CompositorPriority getRenderPriority() const { return COM_PRIORITY_MEDIUM; }
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
};
#endif

View File

@@ -38,11 +38,11 @@ void ConvertColorProfileOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertColorProfileOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertColorProfileOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float color[4];
this->m_inputOperation->read(color, x, y, sampler);
IMB_buffer_float_from_float(outputValue, color, 4, this->m_toProfile, this->m_fromProfile, this->m_predivided, 1, 1, 0, 0);
IMB_buffer_float_from_float(output, color, 4, this->m_toProfile, this->m_fromProfile, this->m_predivided, 1, 1, 0, 0);
}
void ConvertColorProfileOperation::deinitExecution()

View File

@@ -59,7 +59,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -34,11 +34,11 @@ void ConvertColorToBWOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertColorToBWOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertColorToBWOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->read(&inputColor[0], x, y, sampler);
outputValue[0] = rgb_to_bw(inputColor);
output[0] = rgb_to_bw(inputColor);
}
void ConvertColorToBWOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -34,11 +34,11 @@ void ConvertColorToValueProg::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertColorToValueProg::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertColorToValueProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->read(&inputColor[0], x, y, sampler);
outputValue[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f;
output[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f;
}
void ConvertColorToValueProg::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -34,9 +34,9 @@ void ConvertColorToVectorOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertColorToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertColorToVectorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
this->m_inputOperation->read(outputValue, x, y, sampler);
this->m_inputOperation->read(output, x, y, sampler);
}
void ConvertColorToVectorOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -72,7 +72,7 @@ void ConvertDepthToRadiusOperation::initExecution()
}
}
void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertDepthToRadiusOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue[4];
float z;
@@ -94,9 +94,11 @@ void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, fl
if (radius > this->m_maxRadius) {
radius = this->m_maxRadius;
}
outputValue[0] = radius;
output[0] = radius;
}
else {
output[0] = 0.0f;
}
else outputValue[0] = 0.0f;
}
void ConvertDepthToRadiusOperation::deinitExecution()

View File

@@ -54,7 +54,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -35,12 +35,12 @@ void ConvertHSVToRGBOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertHSVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertHSVToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler);
hsv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor[3];
hsv_to_rgb_v(inputColor, output);
output[3] = inputColor[3];
}
void ConvertHSVToRGBOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -35,7 +35,7 @@ void ConvertKeyToPremulOperation::initExecution()
this->m_inputColor = getInputSocketReader(0);
}
void ConvertKeyToPremulOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertKeyToPremulOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue[4];
float alpha;
@@ -43,10 +43,10 @@ void ConvertKeyToPremulOperation::executePixel(float *outputValue, float x, floa
this->m_inputColor->read(inputValue, x, y, sampler);
alpha = inputValue[3];
mul_v3_v3fl(outputValue, inputValue, alpha);
mul_v3_v3fl(output, inputValue, alpha);
/* never touches the alpha */
outputValue[3] = alpha;
output[3] = alpha;
}
void ConvertKeyToPremulOperation::deinitExecution()

View File

@@ -40,7 +40,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -35,7 +35,7 @@ void ConvertPremulToKeyOperation::initExecution()
this->m_inputColor = getInputSocketReader(0);
}
void ConvertPremulToKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertPremulToKeyOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue[4];
float alpha;
@@ -44,14 +44,14 @@ void ConvertPremulToKeyOperation::executePixel(float *outputValue, float x, floa
alpha = inputValue[3];
if (fabsf(alpha) < 1e-5f) {
zero_v3(outputValue);
zero_v3(output);
}
else {
mul_v3_v3fl(outputValue, inputValue, 1.0f / alpha);
mul_v3_v3fl(output, inputValue, 1.0f / alpha);
}
/* never touches the alpha */
outputValue[3] = alpha;
output[3] = alpha;
}
void ConvertPremulToKeyOperation::deinitExecution()

View File

@@ -40,7 +40,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -35,12 +35,12 @@ void ConvertRGBToHSVOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertRGBToHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertRGBToHSVOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler);
rgb_to_hsv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor[3];
rgb_to_hsv_v(inputColor, output);
output[3] = inputColor[3];
}
void ConvertRGBToHSVOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -50,7 +50,7 @@ void ConvertRGBToYCCOperation::setMode(int mode)
}
}
void ConvertRGBToYCCOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertRGBToYCCOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
float color[3];
@@ -60,8 +60,8 @@ void ConvertRGBToYCCOperation::executePixel(float *outputValue, float x, float y
/* divided by 255 to normalize for viewing in */
/* R,G,B --> Y,Cb,Cr */
mul_v3_v3fl(outputValue, color, 1.0f / 255.0f);
outputValue[3] = inputColor[3];
mul_v3_v3fl(output, color, 1.0f / 255.0f);
output[3] = inputColor[3];
}
void ConvertRGBToYCCOperation::deinitExecution()

View File

@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -34,12 +34,12 @@ void ConvertRGBToYUVOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertRGBToYUVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertRGBToYUVOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler);
rgb_to_yuv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor[3];
rgb_to_yuv(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2]);
output[3] = inputColor[3];
}
void ConvertRGBToYUVOperation::deinitExecution()

View File

@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -33,14 +33,12 @@ void ConvertValueToColorProg::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
void ConvertValueToColorProg::executePixel(float *color, float x, float y, PixelSampler sampler)
void ConvertValueToColorProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue[4];
this->m_inputProgram->read(inputValue, x, y, sampler);
color[0] = inputValue[0];
color[1] = inputValue[0];
color[2] = inputValue[0];
color[3] = 1.0f;
output[0] = output[1] = output[2] = inputValue[0];
output[3] = 1.0f;
}
void ConvertValueToColorProg::deinitExecution()

View File

@@ -37,7 +37,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -34,14 +34,14 @@ void ConvertValueToVectorOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertValueToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertValueToVectorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float input[4];
this->m_inputOperation->read(input, x, y, sampler);
outputValue[0] = input[0];
outputValue[1] = input[0];
outputValue[2] = input[0];
outputValue[3] = 0.0f;
output[0] = input[0];
output[1] = input[0];
output[2] = input[0];
output[3] = 0.0f;
}
void ConvertValueToVectorOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -34,10 +34,10 @@ void ConvertVectorToColorOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertVectorToColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertVectorToColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
this->m_inputOperation->read(outputValue, x, y, sampler);
outputValue[3] = 1.0f;
this->m_inputOperation->read(output, x, y, sampler);
output[3] = 1.0f;
}
void ConvertVectorToColorOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -34,11 +34,11 @@ void ConvertVectorToValueOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertVectorToValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertVectorToValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float input[4];
this->m_inputOperation->read(input, x, y, sampler);
outputValue[0] = (input[0] + input[1] + input[2]) / 3.0f;
output[0] = (input[0] + input[1] + input[2]) / 3.0f;
}
void ConvertVectorToValueOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -50,7 +50,7 @@ void ConvertYCCToRGBOperation::setMode(int mode)
}
}
void ConvertYCCToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertYCCToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler);
@@ -59,8 +59,8 @@ void ConvertYCCToRGBOperation::executePixel(float *outputValue, float x, float y
/* R,G,B --> Y,Cb,Cr */
mul_v3_fl(inputColor, 255.0f);
ycc_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2], this->m_mode);
outputValue[3] = inputColor[3];
ycc_to_rgb(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2], this->m_mode);
output[3] = inputColor[3];
}
void ConvertYCCToRGBOperation::deinitExecution()

View File

@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -34,12 +34,12 @@ void ConvertYUVToRGBOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void ConvertYUVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void ConvertYUVToRGBOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler);
yuv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor[3];
yuv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2]);
output[3] = inputColor[3];
}
void ConvertYUVToRGBOperation::deinitExecution()

View File

@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -28,9 +28,9 @@ ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFi
/* pass */
}
void ConvolutionEdgeFilterOperation::executePixel(float *color, int x, int y, void *data)
void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, void *data)
{
float in1[4], in2[4], res1[4], res2[4];
float in1[4], in2[4], res1[4] = {0.0}, res2[4] = {0.0};
int x1 = x - 1;
int x2 = x;
@@ -48,16 +48,7 @@ void ConvolutionEdgeFilterOperation::executePixel(float *color, int x, int y, vo
float value[4];
this->m_inputValueOperation->read(value, x2, y2, NULL);
float mval = 1.0f - value[0];
res1[0] = 0.0f;
res1[1] = 0.0f;
res1[2] = 0.0f;
res1[3] = 0.0f;
res2[0] = 0.0f;
res2[1] = 0.0f;
res2[2] = 0.0f;
res2[3] = 0.0f;
this->m_inputOperation->read(in1, x1, y1, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[0]);
madd_v3_v3fl(res2, in1, this->m_filter[0]);
@@ -94,13 +85,13 @@ void ConvolutionEdgeFilterOperation::executePixel(float *color, int x, int y, vo
madd_v3_v3fl(res1, in1, this->m_filter[8]);
madd_v3_v3fl(res2, in1, this->m_filter[8]);
color[0] = sqrt(res1[0] * res1[0] + res2[0] * res2[0]);
color[1] = sqrt(res1[1] * res1[1] + res2[1] * res2[1]);
color[2] = sqrt(res1[2] * res1[2] + res2[2] * res2[2]);
output[0] = sqrt(res1[0] * res1[0] + res2[0] * res2[0]);
output[1] = sqrt(res1[1] * res1[1] + res2[1] * res2[1]);
output[2] = sqrt(res1[2] * res1[2] + res2[2] * res2[2]);
color[0] = color[0] * value[0] + in2[0] * mval;
color[1] = color[1] * value[0] + in2[1] * mval;
color[2] = color[2] * value[0] + in2[2] * mval;
output[0] = output[0] * value[0] + in2[0] * mval;
output[1] = output[1] * value[0] + in2[1] * mval;
output[2] = output[2] * value[0] + in2[2] * mval;
color[3] = in2[3];
output[3] = in2[3];
}

View File

@@ -28,7 +28,7 @@
class ConvolutionEdgeFilterOperation : public ConvolutionFilterOperation {
public:
ConvolutionEdgeFilterOperation();
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
};
#endif

View File

@@ -67,7 +67,7 @@ void ConvolutionFilterOperation::deinitExecution()
}
void ConvolutionFilterOperation::executePixel(float *color, int x, int y, void *data)
void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, void *data)
{
float in1[4];
float in2[4];
@@ -87,30 +87,30 @@ void ConvolutionFilterOperation::executePixel(float *color, int x, int y, void *
this->m_inputValueOperation->read(value, x2, y2, NULL);
const float mval = 1.0f - value[0];
zero_v4(color);
zero_v4(output);
this->m_inputOperation->read(in1, x1, y1, NULL);
madd_v4_v4fl(color, in1, this->m_filter[0]);
madd_v4_v4fl(output, in1, this->m_filter[0]);
this->m_inputOperation->read(in1, x2, y1, NULL);
madd_v4_v4fl(color, in1, this->m_filter[1]);
madd_v4_v4fl(output, in1, this->m_filter[1]);
this->m_inputOperation->read(in1, x3, y1, NULL);
madd_v4_v4fl(color, in1, this->m_filter[2]);
madd_v4_v4fl(output, in1, this->m_filter[2]);
this->m_inputOperation->read(in1, x1, y2, NULL);
madd_v4_v4fl(color, in1, this->m_filter[3]);
madd_v4_v4fl(output, in1, this->m_filter[3]);
this->m_inputOperation->read(in2, x2, y2, NULL);
madd_v4_v4fl(color, in2, this->m_filter[4]);
madd_v4_v4fl(output, in2, this->m_filter[4]);
this->m_inputOperation->read(in1, x3, y2, NULL);
madd_v4_v4fl(color, in1, this->m_filter[5]);
madd_v4_v4fl(output, in1, this->m_filter[5]);
this->m_inputOperation->read(in1, x1, y3, NULL);
madd_v4_v4fl(color, in1, this->m_filter[6]);
madd_v4_v4fl(output, in1, this->m_filter[6]);
this->m_inputOperation->read(in1, x2, y3, NULL);
madd_v4_v4fl(color, in1, this->m_filter[7]);
madd_v4_v4fl(output, in1, this->m_filter[7]);
this->m_inputOperation->read(in1, x3, y3, NULL);
madd_v4_v4fl(color, in1, this->m_filter[8]);
madd_v4_v4fl(output, in1, this->m_filter[8]);
color[0] = color[0] * value[0] + in2[0] * mval;
color[1] = color[1] * value[0] + in2[1] * mval;
color[2] = color[2] * value[0] + in2[2] * mval;
color[3] = color[3] * value[0] + in2[3] * mval;
output[0] = output[0] * value[0] + in2[0] * mval;
output[1] = output[1] * value[0] + in2[1] * mval;
output[2] = output[2] * value[0] + in2[2] * mval;
output[3] = output[3] * value[0] + in2[3] * mval;
}
bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)

View File

@@ -39,7 +39,7 @@ public:
ConvolutionFilterOperation();
void set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
void initExecution();
void deinitExecution();

View File

@@ -73,13 +73,13 @@ CropOperation::CropOperation() : CropBaseOperation()
/* pass */
}
void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void CropOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
if ((x < this->m_xmax && x >= this->m_xmin) && (y < this->m_ymax && y >= this->m_ymin)) {
this->m_inputOperation->read(color, x, y, sampler);
this->m_inputOperation->read(output, x, y, sampler);
}
else {
zero_v4(color);
zero_v4(output);
}
}
@@ -100,7 +100,7 @@ bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[])
void CropImageOperation::determineResolution(unsigned int resolution[2], unsigned int preferedResolution[2])
{
NodeOperation::determineResolution(resolution, preferedResolution);
updateArea();
@@ -108,7 +108,7 @@ void CropImageOperation::determineResolution(unsigned int resolution[], unsigned
resolution[1] = this->m_ymax - this->m_ymin;
}
void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void CropImageOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
this->m_inputOperation->read(color, (x + this->m_xmin), (y + this->m_ymin), sampler);
this->m_inputOperation->read(output, (x + this->m_xmin), (y + this->m_ymin), sampler);
}

View File

@@ -48,7 +48,7 @@ class CropOperation : public CropBaseOperation {
private:
public:
CropOperation();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class CropImageOperation : public CropBaseOperation {
@@ -56,8 +56,8 @@ private:
public:
CropImageOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void determineResolution(unsigned int resolution[], unsigned int preferedResolution[]);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[2], unsigned int preferedResolution[2]);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -44,7 +44,7 @@ void DifferenceMatteOperation::deinitExecution()
this->m_inputImage2Program = NULL;
}
void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void DifferenceMatteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inColor1[4];
float inColor2[4];
@@ -66,7 +66,7 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y
/* make 100% transparent */
if (difference < tolerance) {
outputValue[0] = 0.0f;
output[0] = 0.0f;
}
/*in the falloff region, make partially transparent */
else if (difference < falloff + tolerance) {
@@ -74,15 +74,15 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y
alpha = difference / falloff;
/*only change if more transparent than before */
if (alpha < inColor1[3]) {
outputValue[0] = alpha;
output[0] = alpha;
}
else { /* leave as before */
outputValue[0] = inColor1[3];
output[0] = inColor1[3];
}
}
else {
/* foreground object */
outputValue[0] = inColor1[3];
output[0] = inColor1[3];
}
}

View File

@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -60,7 +60,7 @@ void *DilateErodeThresholdOperation::initializeTileData(rcti *rect)
return buffer;
}
void DilateErodeThresholdOperation::executePixel(float *color, int x, int y, void *data)
void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, void *data)
{
float inputValue[4];
const float sw = this->m__switch;
@@ -117,28 +117,28 @@ void DilateErodeThresholdOperation::executePixel(float *color, int x, int y, voi
const float delta = distance - pixelvalue;
if (delta >= 0.0f) {
if (delta >= inset) {
color[0] = 1.0f;
output[0] = 1.0f;
}
else {
color[0] = delta / inset;
output[0] = delta / inset;
}
}
else {
color[0] = 0.0f;
output[0] = 0.0f;
}
}
else {
const float delta = -distance + pixelvalue;
if (delta < 0.0f) {
if (delta < -inset) {
color[0] = 1.0f;
output[0] = 1.0f;
}
else {
color[0] = (-delta) / inset;
output[0] = (-delta) / inset;
}
}
else {
color[0] = 0.0f;
output[0] = 0.0f;
}
}
}
@@ -185,7 +185,7 @@ void *DilateDistanceOperation::initializeTileData(rcti *rect)
return buffer;
}
void DilateDistanceOperation::executePixel(float *color, int x, int y, void *data)
void DilateDistanceOperation::executePixel(float output[4], int x, int y, void *data)
{
const float distance = this->m_distance;
const float mindist = distance * distance;
@@ -214,7 +214,7 @@ void DilateDistanceOperation::executePixel(float *color, int x, int y, void *dat
offset += 4;
}
}
color[0] = value;
output[0] = value;
}
void DilateDistanceOperation::deinitExecution()
@@ -259,7 +259,7 @@ ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation()
/* pass */
}
void ErodeDistanceOperation::executePixel(float *color, int x, int y, void *data)
void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *data)
{
const float distance = this->m_distance;
const float mindist = distance * distance;
@@ -288,7 +288,7 @@ void ErodeDistanceOperation::executePixel(float *color, int x, int y, void *data
offset += 4;
}
}
color[0] = value;
output[0] = value;
}
void ErodeDistanceOperation::executeOpenCL(OpenCLDevice *device,
@@ -374,9 +374,9 @@ void *DilateStepOperation::initializeTileData(rcti *rect)
}
void DilateStepOperation::executePixel(float *color, int x, int y, void *data)
void DilateStepOperation::executePixel(float output[4], int x, int y, void *data)
{
color[0] = this->m_cached_buffer[y * this->getWidth() + x];
output[0] = this->m_cached_buffer[y * this->getWidth() + x];
}
void DilateStepOperation::deinitExecution()

View File

@@ -47,7 +47,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution
@@ -83,7 +83,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution
@@ -111,7 +111,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
void executeOpenCL(OpenCLDevice *device,
MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
@@ -135,7 +135,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -66,7 +66,7 @@ void DirectionalBlurOperation::initExecution()
}
void DirectionalBlurOperation::executePixel(float *color, int x, int y, void *data)
void DirectionalBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
const int iterations = pow(2.0f, this->m_data->iter);
float col[4] = {0, 0, 0, 0};
@@ -98,7 +98,7 @@ void DirectionalBlurOperation::executePixel(float *color, int x, int y, void *da
lsc += this->m_sc;
}
mul_v4_v4fl(color, col2, 1.0f / (iterations+1));
mul_v4_v4fl(output, col2, 1.0f / (iterations + 1));
}
void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device,

View File

@@ -40,7 +40,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -54,7 +54,7 @@ void DisplaceOperation::initExecution()
* in order to take effect */
#define DISPLACE_EPSILON 0.01f
void DisplaceOperation::executePixel(float *color, int x, int y, void *data)
void DisplaceOperation::executePixel(float output[4], int x, int y, void *data)
{
float inVector[4];
float inScale[4];
@@ -96,7 +96,7 @@ void DisplaceOperation::executePixel(float *color, int x, int y, void *data)
dyt = signf(dyt) * maxf(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight();
/* EWA filtering */
this->m_inputColorProgram->read(color, u, v, dxt, dyt);
this->m_inputColorProgram->read(output, u, v, dxt, dyt);
}
void DisplaceOperation::deinitExecution()

View File

@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -53,7 +53,7 @@ void DisplaceSimpleOperation::initExecution()
* in order to take effect */
#define DISPLACE_EPSILON 0.01f
void DisplaceSimpleOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void DisplaceSimpleOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inVector[4];
float inScale[4];
@@ -82,7 +82,7 @@ void DisplaceSimpleOperation::executePixel(float *color, float x, float y, Pixel
CLAMP(u, 0.f, this->getWidth() - 1.f);
CLAMP(v, 0.f, this->getHeight() - 1.f);
this->m_inputColorProgram->read(color, u, v, sampler);
this->m_inputColorProgram->read(output, u, v, sampler);
}
void DisplaceSimpleOperation::deinitExecution()

View File

@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -44,7 +44,7 @@ void DistanceMatteOperation::deinitExecution()
this->m_inputKeyProgram = NULL;
}
void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void DistanceMatteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inKey[4];
float inImage[4];
@@ -68,7 +68,7 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y,
/*make 100% transparent */
if (distance < tolerance) {
outputValue[0] = 0.f;
output[0] = 0.f;
}
/*in the falloff region, make partially transparent */
else if (distance < falloff + tolerance) {
@@ -76,15 +76,15 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y,
alpha = distance / falloff;
/*only change if more transparent than before */
if (alpha < inImage[3]) {
outputValue[0] = alpha;
output[0] = alpha;
}
else { /* leave as before */
outputValue[0] = inImage[3];
output[0] = inImage[3];
}
}
else {
/* leave as before */
outputValue[0] = inImage[3];
output[0] = inImage[3];
}
}

View File

@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -45,11 +45,11 @@ void DotproductOperation::deinitExecution()
/** @todo: current implementation is the inverse of a dotproduct. not 'logically' correct
*/
void DotproductOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void DotproductOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float input1[4];
float input2[4];
this->m_input1Operation->read(input1, x, y, sampler);
this->m_input2Operation->read(input2, x, y, sampler);
color[0] = -(input1[0] * input2[0] + input1[1] * input2[1] + input1[2] * input2[2]);
output[0] = -(input1[0] * input2[0] + input1[1] * input2[1] + input1[2] * input2[2]);
}

View File

@@ -31,7 +31,7 @@ private:
SocketReader *m_input2Operation;
public:
DotproductOperation();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -1280,11 +1280,11 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect)
unlockMutex();
return this->m_cachedInstance;
}
void DoubleEdgeMaskOperation::executePixel(float *color, int x, int y, void *data)
void DoubleEdgeMaskOperation::executePixel(float output[4], int x, int y, void *data)
{
float *buffer = (float *)data;
int index = (y * this->getWidth() + x);
copy_v4_v4(color, buffer + index);
copy_v4_v4(output, buffer + index);
}
void DoubleEdgeMaskOperation::deinitExecution()

View File

@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -44,7 +44,7 @@ void EllipseMaskOperation::initExecution()
this->m_aspectRatio = ((float)this->getWidth()) / this->getHeight();
}
void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void EllipseMaskOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputMask[4];
float inputValue[4];
@@ -74,40 +74,40 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam
switch (this->m_maskType) {
case CMP_NODE_MASKTYPE_ADD:
if (inside) {
color[0] = max(inputMask[0], inputValue[0]);
output[0] = max(inputMask[0], inputValue[0]);
}
else {
color[0] = inputMask[0];
output[0] = inputMask[0];
}
break;
case CMP_NODE_MASKTYPE_SUBTRACT:
if (inside) {
color[0] = inputMask[0] - inputValue[0];
CLAMP(color[0], 0, 1);
output[0] = inputMask[0] - inputValue[0];
CLAMP(output[0], 0, 1);
}
else {
color[0] = inputMask[0];
output[0] = inputMask[0];
}
break;
case CMP_NODE_MASKTYPE_MULTIPLY:
if (inside) {
color[0] = inputMask[0] * inputValue[0];
output[0] = inputMask[0] * inputValue[0];
}
else {
color[0] = 0;
output[0] = 0;
}
break;
case CMP_NODE_MASKTYPE_NOT:
if (inside) {
if (inputMask[0] > 0.0f) {
color[0] = 0;
output[0] = 0;
}
else {
color[0] = inputValue[0];
output[0] = inputValue[0];
}
}
else {
color[0] = inputMask[0];
output[0] = inputMask[0];
}
break;
}

View File

@@ -45,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -31,10 +31,10 @@ FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation(COM_D
this->m_iirgaus = NULL;
}
void FastGaussianBlurOperation::executePixel(float *color, int x, int y, void *data)
void FastGaussianBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
MemoryBuffer *newData = (MemoryBuffer *)data;
newData->read(color, x, y);
newData->read(output, x, y);
}
bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -233,10 +233,10 @@ FastGaussianBlurValueOperation::FastGaussianBlurValueOperation() : NodeOperation
setComplex(true);
}
void FastGaussianBlurValueOperation::executePixel(float *color, int x, int y, void *data)
void FastGaussianBlurValueOperation::executePixel(float output[4], int x, int y, void *data)
{
MemoryBuffer *newData = (MemoryBuffer *)data;
newData->read(color, x, y);
newData->read(output, x, y);
}
bool FastGaussianBlurValueOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)

View File

@@ -34,7 +34,7 @@ private:
public:
FastGaussianBlurOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
static void IIR_gauss(MemoryBuffer *src, float sigma, unsigned int channel, unsigned int xy);
void *initializeTileData(rcti *rect);
@@ -62,7 +62,7 @@ private:
public:
FastGaussianBlurValueOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
void *initializeTileData(rcti *rect);
void deinitExecution();

View File

@@ -42,12 +42,12 @@ void FlipOperation::deinitExecution()
}
void FlipOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void FlipOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float nx = this->m_flipX ? this->getWidth() - 1 - x : x;
float ny = this->m_flipY ? this->getHeight() - 1 - y : y;
this->m_inputOperation->read(color, nx, ny, sampler);
this->m_inputOperation->read(output, nx, ny, sampler);
}
bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)

View File

@@ -33,7 +33,7 @@ private:
public:
FlipOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -34,7 +34,7 @@ void GammaCorrectOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
void GammaCorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void GammaCorrectOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
this->m_inputProgram->read(inputColor, x, y, sampler);
@@ -45,18 +45,18 @@ void GammaCorrectOperation::executePixel(float *color, float x, float y, PixelSa
}
/* check for negative to avoid nan's */
color[0] = inputColor[0] > 0.0f ? inputColor[0] * inputColor[0] : 0.0f;
color[1] = inputColor[1] > 0.0f ? inputColor[1] * inputColor[1] : 0.0f;
color[2] = inputColor[2] > 0.0f ? inputColor[2] * inputColor[2] : 0.0f;
output[0] = inputColor[0] > 0.0f ? inputColor[0] * inputColor[0] : 0.0f;
output[1] = inputColor[1] > 0.0f ? inputColor[1] * inputColor[1] : 0.0f;
output[2] = inputColor[2] > 0.0f ? inputColor[2] * inputColor[2] : 0.0f;
inputColor[0] *= inputColor[3];
inputColor[1] *= inputColor[3];
inputColor[2] *= inputColor[3];
color[0] = inputColor[0];
color[1] = inputColor[1];
color[2] = inputColor[2];
color[3] = inputColor[3];
output[0] = inputColor[0];
output[1] = inputColor[1];
output[2] = inputColor[2];
output[3] = inputColor[3];
}
void GammaCorrectOperation::deinitExecution()
@@ -75,7 +75,7 @@ void GammaUncorrectOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
void GammaUncorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void GammaUncorrectOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor[4];
this->m_inputProgram->read(inputColor, x, y, sampler);
@@ -86,18 +86,18 @@ void GammaUncorrectOperation::executePixel(float *color, float x, float y, Pixel
inputColor[2] /= inputColor[3];
}
color[0] = inputColor[0] > 0.0f ? sqrtf(inputColor[0]) : 0.0f;
color[1] = inputColor[1] > 0.0f ? sqrtf(inputColor[1]) : 0.0f;
color[2] = inputColor[2] > 0.0f ? sqrtf(inputColor[2]) : 0.0f;
output[0] = inputColor[0] > 0.0f ? sqrtf(inputColor[0]) : 0.0f;
output[1] = inputColor[1] > 0.0f ? sqrtf(inputColor[1]) : 0.0f;
output[2] = inputColor[2] > 0.0f ? sqrtf(inputColor[2]) : 0.0f;
inputColor[0] *= inputColor[3];
inputColor[1] *= inputColor[3];
inputColor[2] *= inputColor[3];
color[0] = inputColor[0];
color[1] = inputColor[1];
color[2] = inputColor[2];
color[3] = inputColor[3];
output[0] = inputColor[0];
output[1] = inputColor[1];
output[2] = inputColor[2];
output[3] = inputColor[3];
}
void GammaUncorrectOperation::deinitExecution()

View File

@@ -38,7 +38,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution
@@ -64,7 +64,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -37,7 +37,7 @@ void GammaOperation::initExecution()
this->m_inputGammaProgram = this->getInputSocketReader(1);
}
void GammaOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void GammaOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue[4];
float inputGamma[4];
@@ -46,11 +46,11 @@ void GammaOperation::executePixel(float *color, float x, float y, PixelSampler s
this->m_inputGammaProgram->read(inputGamma, x, y, sampler);
const float gamma = inputGamma[0];
/* check for negative to avoid nan's */
color[0] = inputValue[0] > 0.0f ? powf(inputValue[0], gamma) : inputValue[0];
color[1] = inputValue[1] > 0.0f ? powf(inputValue[1], gamma) : inputValue[1];
color[2] = inputValue[2] > 0.0f ? powf(inputValue[2], gamma) : inputValue[2];
output[0] = inputValue[0] > 0.0f ? powf(inputValue[0], gamma) : inputValue[0];
output[1] = inputValue[1] > 0.0f ? powf(inputValue[1], gamma) : inputValue[1];
output[2] = inputValue[2] > 0.0f ? powf(inputValue[2], gamma) : inputValue[2];
color[3] = inputValue[3];
output[3] = inputValue[3];
}
void GammaOperation::deinitExecution()

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -90,7 +90,7 @@ BLI_INLINE float finv_test(const float f, const bool test)
return (LIKELY(test == false)) ? f : 1.0f - f;
}
void GaussianAlphaXBlurOperation::executePixel(float *color, int x, int y, void *data)
void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
const bool do_invert = this->m_do_subtract;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
@@ -148,7 +148,7 @@ void GaussianAlphaXBlurOperation::executePixel(float *color, int x, int y, void
/* blend between the max value and gauss blue - gives nice feather */
const float value_blur = alpha_accum / multiplier_accum;
const float value_final = (value_max * distfacinv_max) + (value_blur * (1.0f - distfacinv_max));
color[0] = finv_test(value_final, do_invert);
output[0] = finv_test(value_final, do_invert);
}
void GaussianAlphaXBlurOperation::deinitExecution()

View File

@@ -40,7 +40,7 @@ public:
/**
* @brief the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* @brief initialize the execution

View File

@@ -90,7 +90,7 @@ BLI_INLINE float finv_test(const float f, const bool test)
return (LIKELY(test == false)) ? f : 1.0f - f;
}
void GaussianAlphaYBlurOperation::executePixel(float *color, int x, int y, void *data)
void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
const bool do_invert = this->m_do_subtract;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
@@ -148,7 +148,7 @@ void GaussianAlphaYBlurOperation::executePixel(float *color, int x, int y, void
/* blend between the max value and gauss blue - gives nice feather */
const float value_blur = alpha_accum / multiplier_accum;
const float value_final = (value_max * distfacinv_max) + (value_blur * (1.0f - distfacinv_max));
color[0] = finv_test(value_final, do_invert);
output[0] = finv_test(value_final, do_invert);
}
void GaussianAlphaYBlurOperation::deinitExecution()

View File

@@ -40,7 +40,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* @brief initialize the execution

View File

@@ -112,7 +112,7 @@ void GaussianBokehBlurOperation::updateGauss()
}
}
void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, void *data)
void GaussianBokehBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
float tempColor[4];
tempColor[0] = 0;
@@ -152,7 +152,7 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, void *
}
}
mul_v4_v4fl(color, tempColor, 1.0f / multiplier_accum);
mul_v4_v4fl(output, tempColor, 1.0f / multiplier_accum);
}
void GaussianBokehBlurOperation::deinitExecution()
@@ -262,7 +262,7 @@ void GaussianBlurReferenceOperation::updateGauss()
m_maintabs[i] = make_gausstab(i + 1);
}
void GaussianBlurReferenceOperation::executePixel(float *color, int x, int y, void *data)
void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, void *data)
{
MemoryBuffer *memorybuffer = (MemoryBuffer *)data;
float *buffer = memorybuffer->getBuffer();
@@ -285,7 +285,7 @@ void GaussianBlurReferenceOperation::executePixel(float *color, int x, int y, vo
else if (refrady < 1) refrady = 1;
if (refradx == 1 && refrady == 1) {
memorybuffer->readNoCheck(color, x, y);
memorybuffer->readNoCheck(output, x, y);
}
else {
int minxr = x - refradx < 0 ? -x : -refradx;
@@ -314,10 +314,10 @@ void GaussianBlurReferenceOperation::executePixel(float *color, int x, int y, vo
}
}
sum = 1.0f / sum;
color[0] = rval * sum;
color[1] = gval * sum;
color[2] = bval * sum;
color[3] = aval * sum;
output[0] = rval * sum;
output[1] = gval * sum;
output[2] = bval * sum;
output[3] = aval * sum;
}
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Deinitialize the execution
@@ -66,7 +66,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Deinitialize the execution

View File

@@ -73,7 +73,7 @@ void GaussianXBlurOperation::updateGauss()
}
}
void GaussianXBlurOperation::executePixel(float *color, int x, int y, void *data)
void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float multiplier_accum = 0.0f;
@@ -101,7 +101,7 @@ void GaussianXBlurOperation::executePixel(float *color, int x, int y, void *data
multiplier_accum += multiplier;
bufferindex += offsetadd;
}
mul_v4_v4fl(color, color_accum, 1.0f / multiplier_accum);
mul_v4_v4fl(output, color_accum, 1.0f / multiplier_accum);
}
void GaussianXBlurOperation::deinitExecution()

View File

@@ -36,7 +36,7 @@ public:
/**
* @brief the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* @brief initialize the execution

View File

@@ -73,7 +73,7 @@ void GaussianYBlurOperation::updateGauss()
}
}
void GaussianYBlurOperation::executePixel(float *color, int x, int y, void *data)
void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float multiplier_accum = 0.0f;
@@ -102,7 +102,7 @@ void GaussianYBlurOperation::executePixel(float *color, int x, int y, void *data
madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier);
multiplier_accum += multiplier;
}
mul_v4_v4fl(color, color_accum, 1.0f / multiplier_accum);
mul_v4_v4fl(output, color_accum, 1.0f / multiplier_accum);
}
void GaussianYBlurOperation::deinitExecution()

View File

@@ -36,7 +36,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* @brief initialize the execution

View File

@@ -30,7 +30,7 @@ GlareThresholdOperation::GlareThresholdOperation() : NodeOperation()
this->m_inputProgram = NULL;
}
void GlareThresholdOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void GlareThresholdOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
NodeOperation::determineResolution(resolution, preferredResolution);
resolution[0] = resolution[0] / (1 << this->m_settings->quality);
@@ -42,19 +42,19 @@ void GlareThresholdOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
void GlareThresholdOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void GlareThresholdOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
const float threshold = this->m_settings->threshold;
this->m_inputProgram->read(color, x, y, sampler);
if (rgb_to_luma_y(color) >= threshold) {
color[0] -= threshold, color[1] -= threshold, color[2] -= threshold;
color[0] = MAX2(color[0], 0.0f);
color[1] = MAX2(color[1], 0.0f);
color[2] = MAX2(color[2], 0.0f);
this->m_inputProgram->read(output, x, y, sampler);
if (rgb_to_luma_y(output) >= threshold) {
output[0] -= threshold, output[1] -= threshold, output[2] -= threshold;
output[0] = max(output[0], 0.0f);
output[1] = max(output[1], 0.0f);
output[2] = max(output[2], 0.0f);
}
else {
zero_v3(color);
zero_v3(output);
}
}

View File

@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution
@@ -58,6 +58,6 @@ public:
this->m_settings = settings;
}
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
};
#endif

View File

@@ -45,7 +45,7 @@ void HueSaturationValueCorrectOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
void HueSaturationValueCorrectOperation::executePixel(float *output, float x, float y, PixelSampler sampler)
void HueSaturationValueCorrectOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float hsv[4], f;

View File

@@ -37,7 +37,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *Vector, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -33,13 +33,13 @@ void IDMaskOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
void IDMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void IDMaskOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue[4];
this->m_inputProgram->read(inputValue, x, y, sampler);
const float a = (inputValue[0] == this->m_objectIndex) ? 1.0f : 0.0f;
color[0] = a;
output[0] = a;
}
void IDMaskOperation::deinitExecution()

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -94,7 +94,7 @@ void BaseImageOperation::deinitExecution()
this->m_imageBuffer = NULL;
}
void BaseImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void BaseImageOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
ImBuf *stackbuf = getImBuf();
@@ -107,32 +107,32 @@ void BaseImageOperation::determineResolution(unsigned int resolution[], unsigned
}
}
void ImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ImageOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
if (this->m_imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
zero_v4(color);
zero_v4(output);
}
else {
switch (sampler) {
case COM_PS_NEAREST:
neareast_interpolation_color(this->m_buffer, NULL, color, x, y);
neareast_interpolation_color(this->m_buffer, NULL, output, x, y);
break;
case COM_PS_BILINEAR:
bilinear_interpolation_color(this->m_buffer, NULL, color, x, y);
bilinear_interpolation_color(this->m_buffer, NULL, output, x, y);
break;
case COM_PS_BICUBIC:
bicubic_interpolation_color(this->m_buffer, NULL, color, x, y);
bicubic_interpolation_color(this->m_buffer, NULL, output, x, y);
break;
}
}
}
void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ImageAlphaOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float tempcolor[4];
if (this->m_imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
color[0] = 0.0f;
output[0] = 0.0f;
}
else {
tempcolor[3] = 1.0f;
@@ -147,17 +147,17 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp
bicubic_interpolation_color(this->m_buffer, NULL, tempcolor, x, y);
break;
}
color[0] = tempcolor[3];
output[0] = tempcolor[3];
}
}
void ImageDepthOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ImageDepthOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
if (this->m_depthBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
color[0] = 0.0f;
output[0] = 0.0f;
}
else {
int offset = y * this->m_width + x;
color[0] = this->m_depthBuffer[offset];
output[0] = this->m_depthBuffer[offset];
}
}

View File

@@ -53,7 +53,7 @@ protected:
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
virtual ImBuf *getImBuf();
@@ -72,7 +72,7 @@ public:
* Constructor
*/
ImageOperation();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class ImageAlphaOperation : public BaseImageOperation {
public:
@@ -80,7 +80,7 @@ public:
* Constructor
*/
ImageAlphaOperation();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class ImageDepthOperation : public BaseImageOperation {
public:
@@ -88,6 +88,6 @@ public:
* Constructor
*/
ImageDepthOperation();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -240,11 +240,11 @@ void *InpaintSimpleOperation::initializeTileData(rcti *rect)
return this->m_cached_buffer;
}
void InpaintSimpleOperation::executePixel(float *color, int x, int y, void *data)
void InpaintSimpleOperation::executePixel(float output[4], int x, int y, void *data)
{
this->clamp_xy(x, y);
copy_v3_v3(color, this->get_pixel(x, y));
color[3] = 1.0f;
copy_v3_v3(output, this->get_pixel(x, y));
output[3] = 1.0f;
}
void InpaintSimpleOperation::deinitExecution()

View File

@@ -45,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -39,7 +39,7 @@ void InvertOperation::initExecution()
this->m_inputColorProgram = this->getInputSocketReader(1);
}
void InvertOperation::executePixel(float *out, float x, float y, PixelSampler sampler)
void InvertOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue[4];
float inputColor[4];
@@ -50,18 +50,18 @@ void InvertOperation::executePixel(float *out, float x, float y, PixelSampler sa
const float invertedValue = 1.0f - value;
if (this->m_color) {
out[0] = (1.0f - inputColor[0]) * value + inputColor[0] * invertedValue;
out[1] = (1.0f - inputColor[1]) * value + inputColor[1] * invertedValue;
out[2] = (1.0f - inputColor[2]) * value + inputColor[2] * invertedValue;
output[0] = (1.0f - inputColor[0]) * value + inputColor[0] * invertedValue;
output[1] = (1.0f - inputColor[1]) * value + inputColor[1] * invertedValue;
output[2] = (1.0f - inputColor[2]) * value + inputColor[2] * invertedValue;
}
else {
copy_v3_v3(out, inputColor);
copy_v3_v3(output, inputColor);
}
if (this->m_alpha)
out[3] = (1.0f - inputColor[3]) * value + inputColor[3] * invertedValue;
output[3] = (1.0f - inputColor[3]) * value + inputColor[3] * invertedValue;
else
out[3] = inputColor[3];
output[3] = inputColor[3];
}

View File

@@ -42,7 +42,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -46,7 +46,7 @@ void *KeyingBlurOperation::initializeTileData(rcti *rect)
return buffer;
}
void KeyingBlurOperation::executePixel(float *color, int x, int y, void *data)
void KeyingBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
float *buffer = inputBuffer->getBuffer();
@@ -85,7 +85,7 @@ void KeyingBlurOperation::executePixel(float *color, int x, int y, void *data)
average /= (float) count;
color[0] = average;
output[0] = average;
}
bool KeyingBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)

View File

@@ -47,7 +47,7 @@ public:
void *initializeTileData(rcti *rect);
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
};

View File

@@ -51,7 +51,7 @@ void *KeyingClipOperation::initializeTileData(rcti *rect)
return buffer;
}
void KeyingClipOperation::executePixel(float *color, int x, int y, void *data)
void KeyingClipOperation::executePixel(float output[4], int x, int y, void *data)
{
const int delta = this->m_kernelRadius;
const float tolerance = this->m_kernelTolerance;
@@ -92,20 +92,20 @@ void KeyingClipOperation::executePixel(float *color, int x, int y, void *data)
if (this->m_isEdgeMatte) {
if (ok)
color[0] = 0.0f;
output[0] = 0.0f;
else
color[0] = 1.0f;
output[0] = 1.0f;
}
else {
color[0] = value;
output[0] = value;
if (ok) {
if (color[0] < this->m_clipBlack)
color[0] = 0.0f;
else if (color[0] >= this->m_clipWhite)
color[0] = 1.0f;
if (output[0] < this->m_clipBlack)
output[0] = 0.0f;
else if (output[0] >= this->m_clipWhite)
output[0] = 1.0f;
else
color[0] = (color[0] - this->m_clipBlack) / (this->m_clipWhite - this->m_clipBlack);
output[0] = (output[0] - this->m_clipBlack) / (this->m_clipWhite - this->m_clipBlack);
}
}
}

View File

@@ -51,7 +51,7 @@ public:
void *initializeTileData(rcti *rect);
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
};

View File

@@ -65,7 +65,7 @@ void KeyingDespillOperation::deinitExecution()
this->m_screenReader = NULL;
}
void KeyingDespillOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void KeyingDespillOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float pixelColor[4];
float screenColor[4];
@@ -85,12 +85,9 @@ void KeyingDespillOperation::executePixel(float *color, float x, float y, PixelS
average_value = this->m_colorBalance * pixelColor[min_channel] + (1.0f - this->m_colorBalance) * pixelColor[max_channel];
amount = (pixelColor[screen_primary_channel] - average_value);
color[0] = pixelColor[0];
color[1] = pixelColor[1];
color[2] = pixelColor[2];
color[3] = pixelColor[3];
copy_v4_v4(output, pixelColor);
if (this->m_despillFactor * amount > 0) {
color[screen_primary_channel] = pixelColor[screen_primary_channel] - this->m_despillFactor * amount;
output[screen_primary_channel] = pixelColor[screen_primary_channel] - this->m_despillFactor * amount;
}
}

View File

@@ -45,7 +45,7 @@ public:
void setDespillFactor(float value) {this->m_despillFactor = value;}
void setColorBalance(float value) {this->m_colorBalance = value;}
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -77,7 +77,7 @@ void KeyingOperation::deinitExecution()
this->m_screenReader = NULL;
}
void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void KeyingOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float pixelColor[4];
float screenColor[4];
@@ -93,7 +93,7 @@ void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler
* because saturation and falloff calculation is based on the fact
* that pixels are not overexposured
*/
color[0] = 1.0f;
output[0] = 1.0f;
}
else {
float saturation = get_pixel_saturation(pixelColor, this->m_screenBalance, primary_channel);
@@ -103,19 +103,19 @@ void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler
/* means main channel of pixel is different from screen,
* assume this is completely a foreground
*/
color[0] = 1.0f;
output[0] = 1.0f;
}
else if (saturation >= screen_saturation) {
/* matched main channels and higher saturation on pixel
* is treated as completely background
*/
color[0] = 0.0f;
output[0] = 0.0f;
}
else {
/* nice alpha falloff on edges */
float distance = 1.0f - saturation / screen_saturation;
color[0] = distance;
output[0] = distance;
}
}
}

View File

@@ -49,7 +49,7 @@ public:
void setScreenBalance(float value) {this->m_screenBalance = value;}
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -280,7 +280,7 @@ void KeyingScreenOperation::deinitializeTileData(rcti *rect, void *data)
MEM_freeN(tile_data);
}
void KeyingScreenOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void KeyingScreenOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
resolution[0] = 0;
resolution[1] = 0;
@@ -298,12 +298,12 @@ void KeyingScreenOperation::determineResolution(unsigned int resolution[], unsig
}
}
void KeyingScreenOperation::executePixel(float *color, int x, int y, void *data)
void KeyingScreenOperation::executePixel(float output[4], int x, int y, void *data)
{
color[0] = 0.0f;
color[1] = 0.0f;
color[2] = 0.0f;
color[3] = 1.0f;
output[0] = 0.0f;
output[1] = 0.0f;
output[2] = 0.0f;
output[3] = 1.0f;
if (this->m_movieClip && data) {
TriangulationData *triangulation = this->m_cachedTriangulation;
@@ -324,9 +324,9 @@ void KeyingScreenOperation::executePixel(float *color, int x, int y, void *data)
if (barycentric_coords_v2(a->co, b->co, c->co, co, w)) {
if (barycentric_inside_triangle_v2(w)) {
color[0] = a->color[0] * w[0] + b->color[0] * w[1] + c->color[0] * w[2];
color[1] = a->color[1] * w[0] + b->color[1] * w[1] + c->color[1] * w[2];
color[2] = a->color[2] * w[0] + b->color[2] * w[1] + c->color[2] * w[2];
output[0] = a->color[0] * w[0] + b->color[0] * w[1] + c->color[0] * w[2];
output[1] = a->color[1] * w[0] + b->color[1] * w[1] + c->color[1] * w[2];
output[2] = a->color[2] * w[0] + b->color[2] * w[1] + c->color[2] * w[2];
break;
}

View File

@@ -62,7 +62,7 @@ protected:
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
TriangulationData *buildVoronoiTriangulation();
@@ -79,7 +79,7 @@ public:
void setTrackingObject(const char *object) {strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject));}
void setFramenumber(int framenumber) {this->m_framenumber = framenumber;}
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
};
#endif

View File

@@ -40,7 +40,7 @@ void LuminanceMatteOperation::deinitExecution()
this->m_inputImageProgram = NULL;
}
void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void LuminanceMatteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inColor[4];
@@ -52,7 +52,7 @@ void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y,
this->m_inputImageProgram->read(inColor, x, y, sampler);
/* one line thread-friend algorithm:
* outputValue[0] = max(inputValue[3], min(high, max(low, ((inColor[0]-low)/(high-low))))
* output[0] = max(inputValue[3], min(high, max(low, ((inColor[0]-low)/(high-low))))
*/
/* test range */
@@ -73,11 +73,11 @@ void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y,
/* don't make something that was more transparent less transparent */
if (alpha < inColor[3]) {
outputValue[0] = alpha;
output[0] = alpha;
}
else {
/* leave now it was before */
outputValue[0] = inColor[3];
output[0] = inColor[3];
}
}

View File

@@ -41,7 +41,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -40,7 +40,7 @@ void MapUVOperation::initExecution()
this->m_inputUVProgram = this->getInputSocketReader(1);
}
void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void MapUVOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputUV[4];
float uv_a[4], uv_b[4];
@@ -52,7 +52,7 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s
this->m_inputUVProgram->read(inputUV, x, y, sampler);
if (inputUV[2] == 0.f) {
zero_v4(color);
zero_v4(output);
return;
}
/* adaptive sampling, red (U) channel */
@@ -107,11 +107,11 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s
u = inputUV[0] * this->m_inputColorProgram->getWidth();
v = inputUV[1] * this->m_inputColorProgram->getHeight();
this->m_inputColorProgram->read(color, u, v, dx, dy);
this->m_inputColorProgram->read(output, u, v, dx, dy);
/* "premul" */
if (alpha < 1.0f) {
mul_v4_fl(color, alpha);
mul_v4_fl(output, alpha);
}
}

View File

@@ -45,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -34,7 +34,7 @@ void MapValueOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
}
void MapValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MapValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float src[4];
this->m_inputOperation->read(src, x, y, sampler);
@@ -47,7 +47,7 @@ void MapValueOperation::executePixel(float *outputValue, float x, float y, Pixel
if (value > texmap->max[0])
value = texmap->max[0];
outputValue[0] = value;
output[0] = value;
}
void MapValueOperation::deinitExecution()

View File

@@ -45,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -109,7 +109,7 @@ void MaskOperation::deinitExecution()
}
}
void MaskOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void MaskOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
if (this->m_maskWidth == 0 || this->m_maskHeight == 0) {
NodeOperation::determineResolution(resolution, preferredResolution);
@@ -127,29 +127,30 @@ void MaskOperation::determineResolution(unsigned int resolution[], unsigned int
}
}
void MaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void MaskOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
const float xy[2] = {x * this->m_maskWidthInv, y * this->m_maskHeightInv};
const float xy[2] = {x * this->m_maskWidthInv,
y * this->m_maskHeightInv};
if (this->m_rasterMaskHandleTot == 1) {
if (this->m_rasterMaskHandles[0]) {
color[0] = BKE_maskrasterize_handle_sample(this->m_rasterMaskHandles[0], xy);
output[0] = BKE_maskrasterize_handle_sample(this->m_rasterMaskHandles[0], xy);
}
else {
color[0] = 0.0f;
output[0] = 0.0f;
}
}
else {
/* incase loop below fails */
color[0] = 0.0f;
output[0] = 0.0f;
for (unsigned int i = 0; i < this->m_rasterMaskHandleTot; i++) {
if (this->m_rasterMaskHandles[i]) {
color[0] += BKE_maskrasterize_handle_sample(this->m_rasterMaskHandles[i], xy);
output[0] += BKE_maskrasterize_handle_sample(this->m_rasterMaskHandles[i], xy);
}
}
/* until we get better falloff */
color[0] /= this->m_rasterMaskHandleTot;
output[0] /= this->m_rasterMaskHandleTot;
}
}

View File

@@ -56,7 +56,7 @@ protected:
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
public:
MaskOperation();
@@ -83,7 +83,7 @@ public:
void setMotionBlurSamples(int samples) { this->m_rasterMaskHandleTot = min(max(1, samples), CMP_NODE_MASK_MBLUR_SAMPLES_MAX); }
void setMotionBlurShutter(float shutter) { this->m_frame_shutter = shutter; }
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -48,10 +48,10 @@ void MathBaseOperation::deinitExecution()
this->m_inputValue2Operation = NULL;
}
void MathBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void MathBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
InputSocket *socket;
unsigned int tempPreferredResolution[] = {0, 0};
unsigned int tempPreferredResolution[2] = {0, 0};
unsigned int tempResolution[2];
socket = this->getInputSocket(0);
@@ -72,7 +72,7 @@ void MathBaseOperation::clampIfNeeded(float *color)
}
}
void MathAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathAddOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -80,12 +80,12 @@ void MathAddOperation::executePixel(float *outputValue, float x, float y, PixelS
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] + inputValue2[0];
output[0] = inputValue1[0] + inputValue2[0];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathSubtractOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -93,12 +93,12 @@ void MathSubtractOperation::executePixel(float *outputValue, float x, float y, P
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] - inputValue2[0];
output[0] = inputValue1[0] - inputValue2[0];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathMultiplyOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -106,12 +106,12 @@ void MathMultiplyOperation::executePixel(float *outputValue, float x, float y, P
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] * inputValue2[0];
output[0] = inputValue1[0] * inputValue2[0];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathDivideOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -120,14 +120,14 @@ void MathDivideOperation::executePixel(float *outputValue, float x, float y, Pix
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue2[0] == 0) /* We don't want to divide by zero. */
outputValue[0] = 0.0;
output[0] = 0.0;
else
outputValue[0] = inputValue1[0] / inputValue2[0];
output[0] = inputValue1[0] / inputValue2[0];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathSineOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -135,12 +135,12 @@ void MathSineOperation::executePixel(float *outputValue, float x, float y, Pixel
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = sin(inputValue1[0]);
output[0] = sin(inputValue1[0]);
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathCosineOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -148,12 +148,12 @@ void MathCosineOperation::executePixel(float *outputValue, float x, float y, Pix
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = cos(inputValue1[0]);
output[0] = cos(inputValue1[0]);
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathTangentOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -161,12 +161,12 @@ void MathTangentOperation::executePixel(float *outputValue, float x, float y, Pi
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = tan(inputValue1[0]);
output[0] = tan(inputValue1[0]);
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathArcSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathArcSineOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -175,14 +175,14 @@ void MathArcSineOperation::executePixel(float *outputValue, float x, float y, Pi
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue1[0] <= 1 && inputValue1[0] >= -1)
outputValue[0] = asin(inputValue1[0]);
output[0] = asin(inputValue1[0]);
else
outputValue[0] = 0.0;
output[0] = 0.0;
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathArcCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathArcCosineOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -191,14 +191,14 @@ void MathArcCosineOperation::executePixel(float *outputValue, float x, float y,
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue1[0] <= 1 && inputValue1[0] >= -1)
outputValue[0] = acos(inputValue1[0]);
output[0] = acos(inputValue1[0]);
else
outputValue[0] = 0.0;
output[0] = 0.0;
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathArcTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathArcTangentOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -206,12 +206,12 @@ void MathArcTangentOperation::executePixel(float *outputValue, float x, float y,
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = atan(inputValue1[0]);
output[0] = atan(inputValue1[0]);
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathPowerOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathPowerOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -220,23 +220,23 @@ void MathPowerOperation::executePixel(float *outputValue, float x, float y, Pixe
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue1[0] >= 0) {
outputValue[0] = pow(inputValue1[0], inputValue2[0]);
output[0] = pow(inputValue1[0], inputValue2[0]);
}
else {
float y_mod_1 = fmod(inputValue2[0], 1);
/* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
outputValue[0] = pow(inputValue1[0], floorf(inputValue2[0] + 0.5f));
output[0] = pow(inputValue1[0], floorf(inputValue2[0] + 0.5f));
}
else {
outputValue[0] = 0.0;
output[0] = 0.0;
}
}
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathLogarithmOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathLogarithmOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -245,14 +245,14 @@ void MathLogarithmOperation::executePixel(float *outputValue, float x, float y,
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
if (inputValue1[0] > 0 && inputValue2[0] > 0)
outputValue[0] = log(inputValue1[0]) / log(inputValue2[0]);
output[0] = log(inputValue1[0]) / log(inputValue2[0]);
else
outputValue[0] = 0.0;
output[0] = 0.0;
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathMinimumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathMinimumOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -260,12 +260,12 @@ void MathMinimumOperation::executePixel(float *outputValue, float x, float y, Pi
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = min(inputValue1[0], inputValue2[0]);
output[0] = min(inputValue1[0], inputValue2[0]);
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathMaximumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathMaximumOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -273,12 +273,12 @@ void MathMaximumOperation::executePixel(float *outputValue, float x, float y, Pi
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = max(inputValue1[0], inputValue2[0]);
output[0] = max(inputValue1[0], inputValue2[0]);
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathRoundOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathRoundOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -286,12 +286,12 @@ void MathRoundOperation::executePixel(float *outputValue, float x, float y, Pixe
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = round(inputValue1[0]);
output[0] = round(inputValue1[0]);
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathLessThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathLessThanOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -299,12 +299,12 @@ void MathLessThanOperation::executePixel(float *outputValue, float x, float y, P
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] < inputValue2[0] ? 1.0f : 0.0f;
output[0] = inputValue1[0] < inputValue2[0] ? 1.0f : 0.0f;
clampIfNeeded(outputValue);
clampIfNeeded(output);
}
void MathGreaterThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MathGreaterThanOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputValue1[4];
float inputValue2[4];
@@ -312,9 +312,9 @@ void MathGreaterThanOperation::executePixel(float *outputValue, float x, float y
this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler);
this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler);
outputValue[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f;
output[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f;
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -50,7 +50,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler) = 0;
void executePixel(float output[4], float x, float y, PixelSampler sampler) = 0;
/**
* Initialize the execution
@@ -65,7 +65,7 @@ public:
/**
* Determine resolution
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
void setUseClamp(bool value) { this->m_useClamp = value; }
};
@@ -73,88 +73,88 @@ public:
class MathAddOperation : public MathBaseOperation {
public:
MathAddOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathSubtractOperation : public MathBaseOperation {
public:
MathSubtractOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathMultiplyOperation : public MathBaseOperation {
public:
MathMultiplyOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathDivideOperation : public MathBaseOperation {
public:
MathDivideOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathSineOperation : public MathBaseOperation {
public:
MathSineOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathCosineOperation : public MathBaseOperation {
public:
MathCosineOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathTangentOperation : public MathBaseOperation {
public:
MathTangentOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathArcSineOperation : public MathBaseOperation {
public:
MathArcSineOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathArcCosineOperation : public MathBaseOperation {
public:
MathArcCosineOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathArcTangentOperation : public MathBaseOperation {
public:
MathArcTangentOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathPowerOperation : public MathBaseOperation {
public:
MathPowerOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathLogarithmOperation : public MathBaseOperation {
public:
MathLogarithmOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathMinimumOperation : public MathBaseOperation {
public:
MathMinimumOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathMaximumOperation : public MathBaseOperation {
public:
MathMaximumOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathRoundOperation : public MathBaseOperation {
public:
MathRoundOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathLessThanOperation : public MathBaseOperation {
public:
MathLessThanOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MathGreaterThanOperation : public MathBaseOperation {
public:
MathGreaterThanOperation() : MathBaseOperation() {}
void executePixel(float *outputValue, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixAddOperation::MixAddOperation() : MixBaseOperation()
/* pass */
}
void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixAddOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -42,11 +42,11 @@ void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSa
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
}
outputValue[0] = inputColor1[0] + value * inputColor2[0];
outputValue[1] = inputColor1[1] + value * inputColor2[1];
outputValue[2] = inputColor1[2] + value * inputColor2[2];
outputValue[3] = inputColor1[3];
output[0] = inputColor1[0] + value * inputColor2[0];
output[1] = inputColor1[1] + value * inputColor2[1];
output[2] = inputColor1[2] + value * inputColor2[2];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -42,7 +42,7 @@ void MixBaseOperation::initExecution()
this->m_inputColor2Operation = this->getInputSocketReader(2);
}
void MixBaseOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler)
void MixBaseOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -57,10 +57,10 @@ void MixBaseOperation::executePixel(float *outputColor, float x, float y, PixelS
value *= inputColor2[3];
}
float valuem = 1.0f - value;
outputColor[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
outputColor[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
outputColor[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
outputColor[3] = inputColor1[3];
output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
output[3] = inputColor1[3];
}
void MixBaseOperation::deinitExecution()
@@ -70,10 +70,10 @@ void MixBaseOperation::deinitExecution()
this->m_inputColor2Operation = NULL;
}
void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void MixBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
InputSocket *socket;
unsigned int tempPreferredResolution[] = {0, 0};
unsigned int tempPreferredResolution[2] = {0, 0};
unsigned int tempResolution[2];
socket = this->getInputSocket(1);

View File

@@ -59,7 +59,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution
@@ -71,7 +71,7 @@ public:
*/
void deinitExecution();
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
void setUseValueAlphaMultiply(const bool value) { this->m_valueAlphaMultiply = value; }
bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; }

View File

@@ -27,7 +27,7 @@ MixBlendOperation::MixBlendOperation() : MixBaseOperation()
/* pass */
}
void MixBlendOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixBlendOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -43,10 +43,10 @@ void MixBlendOperation::executePixel(float *outputValue, float x, float y, Pixel
value *= inputColor2[3];
}
float valuem = 1.0f - value;
outputValue[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
outputValue[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
outputValue[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
outputValue[3] = inputColor1[3];
output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixBurnOperation::MixBurnOperation() : MixBaseOperation()
/* pass */
}
void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixBurnOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -45,45 +45,45 @@ void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelS
tmp = valuem + value * inputColor2[0];
if (tmp <= 0.0f)
outputValue[0] = 0.0f;
output[0] = 0.0f;
else {
tmp = 1.0f - (1.0f - inputColor1[0]) / tmp;
if (tmp < 0.0f)
outputValue[0] = 0.0f;
output[0] = 0.0f;
else if (tmp > 1.0f)
outputValue[0] = 1.0f;
output[0] = 1.0f;
else
outputValue[0] = tmp;
output[0] = tmp;
}
tmp = valuem + value * inputColor2[1];
if (tmp <= 0.0f)
outputValue[1] = 0.0f;
output[1] = 0.0f;
else {
tmp = 1.0f - (1.0f - inputColor1[1]) / tmp;
if (tmp < 0.0f)
outputValue[1] = 0.0f;
output[1] = 0.0f;
else if (tmp > 1.0f)
outputValue[1] = 1.0f;
output[1] = 1.0f;
else
outputValue[1] = tmp;
output[1] = tmp;
}
tmp = valuem + value * inputColor2[2];
if (tmp <= 0.0f)
outputValue[2] = 0.0f;
output[2] = 0.0f;
else {
tmp = 1.0f - (1.0f - inputColor1[2]) / tmp;
if (tmp < 0.0f)
outputValue[2] = 0.0f;
output[2] = 0.0f;
else if (tmp > 1.0f)
outputValue[2] = 1.0f;
output[2] = 1.0f;
else
outputValue[2] = tmp;
output[2] = tmp;
}
outputValue[3] = inputColor1[3];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -31,7 +31,7 @@ MixColorOperation::MixColorOperation() : MixBaseOperation()
/* pass */
}
void MixColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -53,12 +53,12 @@ void MixColorOperation::executePixel(float *outputValue, float x, float y, Pixel
float tmpr, tmpg, tmpb;
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb);
outputValue[0] = valuem * (inputColor1[0]) + value * tmpr;
outputValue[1] = valuem * (inputColor1[1]) + value * tmpg;
outputValue[2] = valuem * (inputColor1[2]) + value * tmpb;
output[0] = valuem * (inputColor1[0]) + value * tmpr;
output[1] = valuem * (inputColor1[1]) + value * tmpg;
output[2] = valuem * (inputColor1[2]) + value * tmpb;
}
outputValue[3] = inputColor1[3];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixDarkenOperation::MixDarkenOperation() : MixBaseOperation()
/* pass */
}
void MixDarkenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixDarkenOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -43,17 +43,17 @@ void MixDarkenOperation::executePixel(float *outputValue, float x, float y, Pixe
float valuem = 1.0f - value;
float tmp;
tmp = inputColor2[0] + ((1.0f - inputColor2[0]) * valuem);
if (tmp < inputColor1[0]) outputValue[0] = tmp;
else outputValue[0] = inputColor1[0];
if (tmp < inputColor1[0]) output[0] = tmp;
else output[0] = inputColor1[0];
tmp = inputColor2[1] + ((1.0f - inputColor2[1]) * valuem);
if (tmp < inputColor1[1]) outputValue[1] = tmp;
else outputValue[1] = inputColor1[1];
if (tmp < inputColor1[1]) output[1] = tmp;
else output[1] = inputColor1[1];
tmp = inputColor2[2] + ((1.0f - inputColor2[2]) * valuem);
if (tmp < inputColor1[2]) outputValue[2] = tmp;
else outputValue[2] = inputColor1[2];
if (tmp < inputColor1[2]) output[2] = tmp;
else output[2] = inputColor1[2];
outputValue[3] = inputColor1[3];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -28,7 +28,7 @@ MixDifferenceOperation::MixDifferenceOperation() : MixBaseOperation()
/* pass */
}
void MixDifferenceOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixDifferenceOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -42,11 +42,11 @@ void MixDifferenceOperation::executePixel(float *outputValue, float x, float y,
value *= inputColor2[3];
}
float valuem = 1.0f - value;
outputValue[0] = valuem * inputColor1[0] + value *fabsf(inputColor1[0] - inputColor2[0]);
outputValue[1] = valuem * inputColor1[1] + value *fabsf(inputColor1[1] - inputColor2[1]);
outputValue[2] = valuem * inputColor1[2] + value *fabsf(inputColor1[2] - inputColor2[2]);
outputValue[3] = inputColor1[3];
output[0] = valuem * inputColor1[0] + value *fabsf(inputColor1[0] - inputColor2[0]);
output[1] = valuem * inputColor1[1] + value *fabsf(inputColor1[1] - inputColor2[1]);
output[2] = valuem * inputColor1[2] + value *fabsf(inputColor1[2] - inputColor2[2]);
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixDivideOperation::MixDivideOperation() : MixBaseOperation()
/* pass */
}
void MixDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixDivideOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -43,20 +43,20 @@ void MixDivideOperation::executePixel(float *outputValue, float x, float y, Pixe
float valuem = 1.0f - value;
if (inputColor2[0] != 0.0f)
outputValue[0] = valuem * (inputColor1[0]) + value * (inputColor1[0]) / inputColor2[0];
output[0] = valuem * (inputColor1[0]) + value * (inputColor1[0]) / inputColor2[0];
else
outputValue[0] = 0.0f;
output[0] = 0.0f;
if (inputColor2[1] != 0.0f)
outputValue[1] = valuem * (inputColor1[1]) + value * (inputColor1[1]) / inputColor2[1];
output[1] = valuem * (inputColor1[1]) + value * (inputColor1[1]) / inputColor2[1];
else
outputValue[1] = 0.0f;
output[1] = 0.0f;
if (inputColor2[2] != 0.0f)
outputValue[2] = valuem * (inputColor1[2]) + value * (inputColor1[2]) / inputColor2[2];
output[2] = valuem * (inputColor1[2]) + value * (inputColor1[2]) / inputColor2[2];
else
outputValue[2] = 0.0f;
output[2] = 0.0f;
outputValue[3] = inputColor1[3];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixDodgeOperation::MixDodgeOperation() : MixBaseOperation()
/* pass */
}
void MixDodgeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixDodgeOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -45,50 +45,50 @@ void MixDodgeOperation::executePixel(float *outputValue, float x, float y, Pixel
if (inputColor1[0] != 0.0f) {
tmp = 1.0f - value * inputColor2[0];
if (tmp <= 0.0f)
outputValue[0] = 1.0f;
output[0] = 1.0f;
else {
tmp = inputColor1[0] / tmp;
if (tmp > 1.0f)
outputValue[0] = 1.0f;
output[0] = 1.0f;
else
outputValue[0] = tmp;
output[0] = tmp;
}
}
else
outputValue[0] = 0.0f;
output[0] = 0.0f;
if (inputColor1[1] != 0.0f) {
tmp = 1.0f - value * inputColor2[1];
if (tmp <= 0.0f)
outputValue[1] = 1.0f;
output[1] = 1.0f;
else {
tmp = inputColor1[1] / tmp;
if (tmp > 1.0f)
outputValue[1] = 1.0f;
output[1] = 1.0f;
else
outputValue[1] = tmp;
output[1] = tmp;
}
}
else
outputValue[1] = 0.0f;
output[1] = 0.0f;
if (inputColor1[2] != 0.0f) {
tmp = 1.0f - value * inputColor2[2];
if (tmp <= 0.0f)
outputValue[2] = 1.0f;
output[2] = 1.0f;
else {
tmp = inputColor1[2] / tmp;
if (tmp > 1.0f)
outputValue[2] = 1.0f;
output[2] = 1.0f;
else
outputValue[2] = tmp;
output[2] = tmp;
}
}
else
outputValue[2] = 0.0f;
output[2] = 0.0f;
outputValue[3] = inputColor1[3];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixGlareOperation::MixGlareOperation() : MixBaseOperation()
/* pass */
}
void MixGlareOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixGlareOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -40,10 +40,10 @@ void MixGlareOperation::executePixel(float *outputValue, float x, float y, Pixel
value = inputValue[0];
float mf = 2.f - 2.f * fabsf(value - 0.5f);
outputValue[0] = mf * ((inputColor1[0]) + value * (inputColor2[0] - inputColor1[0]));
outputValue[1] = mf * ((inputColor1[1]) + value * (inputColor2[1] - inputColor1[1]));
outputValue[2] = mf * ((inputColor1[2]) + value * (inputColor2[2] - inputColor1[2]));
outputValue[3] = inputColor1[3];
output[0] = mf * ((inputColor1[0]) + value * (inputColor2[0] - inputColor1[0]));
output[1] = mf * ((inputColor1[1]) + value * (inputColor2[1] - inputColor1[1]));
output[2] = mf * ((inputColor1[2]) + value * (inputColor2[2] - inputColor1[2]));
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -31,7 +31,7 @@ MixHueOperation::MixHueOperation() : MixBaseOperation()
/* pass */
}
void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixHueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -53,11 +53,11 @@ void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSa
float tmpr, tmpg, tmpb;
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb);
outputValue[0] = valuem * (inputColor1[0]) + value * tmpr;
outputValue[1] = valuem * (inputColor1[1]) + value * tmpg;
outputValue[2] = valuem * (inputColor1[2]) + value * tmpb;
output[0] = valuem * (inputColor1[0]) + value * tmpr;
output[1] = valuem * (inputColor1[1]) + value * tmpg;
output[2] = valuem * (inputColor1[2]) + value * tmpb;
}
outputValue[3] = inputColor1[3];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixLightenOperation::MixLightenOperation() : MixBaseOperation()
/* pass */
}
void MixLightenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixLightenOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -42,16 +42,16 @@ void MixLightenOperation::executePixel(float *outputValue, float x, float y, Pix
}
float tmp;
tmp = value * inputColor2[0];
if (tmp > inputColor1[0]) outputValue[0] = tmp;
else outputValue[0] = inputColor1[0];
if (tmp > inputColor1[0]) output[0] = tmp;
else output[0] = inputColor1[0];
tmp = value * inputColor2[1];
if (tmp > inputColor1[1]) outputValue[1] = tmp;
else outputValue[1] = inputColor1[1];
if (tmp > inputColor1[1]) output[1] = tmp;
else output[1] = inputColor1[1];
tmp = value * inputColor2[2];
if (tmp > inputColor1[2]) outputValue[2] = tmp;
else outputValue[2] = inputColor1[2];
outputValue[3] = inputColor1[3];
if (tmp > inputColor1[2]) output[2] = tmp;
else output[2] = inputColor1[2];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,6 +39,6 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixLinearLightOperation::MixLinearLightOperation() : MixBaseOperation()
/* pass */
}
void MixLinearLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixLinearLightOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -41,19 +41,19 @@ void MixLinearLightOperation::executePixel(float *outputValue, float x, float y,
value *= inputColor2[3];
}
if (inputColor2[0] > 0.5f)
outputValue[0] = inputColor1[0] + value * (2.0f * (inputColor2[0] - 0.5f));
output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0] - 0.5f));
else
outputValue[0] = inputColor1[0] + value * (2.0f * (inputColor2[0]) - 1.0f);
output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0]) - 1.0f);
if (inputColor2[1] > 0.5f)
outputValue[1] = inputColor1[1] + value * (2.0f * (inputColor2[1] - 0.5f));
output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1] - 0.5f));
else
outputValue[1] = inputColor1[1] + value * (2.0f * (inputColor2[1]) - 1.0f);
output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1]) - 1.0f);
if (inputColor2[2] > 0.5f)
outputValue[2] = inputColor1[2] + value * (2.0f * (inputColor2[2] - 0.5f));
output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2] - 0.5f));
else
outputValue[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f);
output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f);
outputValue[3] = inputColor1[3];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixMultiplyOperation::MixMultiplyOperation() : MixBaseOperation()
/* pass */
}
void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixMultiplyOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -42,11 +42,11 @@ void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, Pi
value *= inputColor2[3];
}
float valuem = 1.0f - value;
outputValue[0] = inputColor1[0] * (valuem + value * inputColor2[0]);
outputValue[1] = inputColor1[1] * (valuem + value * inputColor2[1]);
outputValue[2] = inputColor1[2] * (valuem + value * inputColor2[2]);
outputValue[3] = inputColor1[3];
output[0] = inputColor1[0] * (valuem + value * inputColor2[0]);
output[1] = inputColor1[1] * (valuem + value * inputColor2[1]);
output[2] = inputColor1[2] * (valuem + value * inputColor2[2]);
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixOverlayOperation::MixOverlayOperation() : MixBaseOperation()
/* pass */
}
void MixOverlayOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixOverlayOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -44,25 +44,25 @@ void MixOverlayOperation::executePixel(float *outputValue, float x, float y, Pix
float valuem = 1.0f - value;
if (inputColor1[0] < 0.5f) {
outputValue[0] = inputColor1[0] * (valuem + 2.0f * value * inputColor2[0]);
output[0] = inputColor1[0] * (valuem + 2.0f * value * inputColor2[0]);
}
else {
outputValue[0] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
output[0] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
}
if (inputColor1[1] < 0.5f) {
outputValue[1] = inputColor1[1] * (valuem + 2.0f * value * inputColor2[1]);
output[1] = inputColor1[1] * (valuem + 2.0f * value * inputColor2[1]);
}
else {
outputValue[1] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
output[1] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
}
if (inputColor1[2] < 0.5f) {
outputValue[2] = inputColor1[2] * (valuem + 2.0f * value * inputColor2[2]);
output[2] = inputColor1[2] * (valuem + 2.0f * value * inputColor2[2]);
}
else {
outputValue[2] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
output[2] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
}
outputValue[3] = inputColor1[3];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -31,7 +31,7 @@ MixSaturationOperation::MixSaturationOperation() : MixBaseOperation()
/* pass */
}
void MixSaturationOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixSaturationOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -51,9 +51,9 @@ void MixSaturationOperation::executePixel(float *outputValue, float x, float y,
if (rS != 0.0f) {
float colH, colS, colV;
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
hsv_to_rgb(rH, (valuem * rS + value * colS), rV, &outputValue[0], &outputValue[1], &outputValue[2]);
hsv_to_rgb(rH, (valuem * rS + value * colS), rV, &output[0], &output[1], &output[2]);
}
outputValue[3] = inputColor1[3];
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixScreenOperation::MixScreenOperation() : MixBaseOperation()
/* pass */
}
void MixScreenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixScreenOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -43,11 +43,11 @@ void MixScreenOperation::executePixel(float *outputValue, float x, float y, Pixe
}
float valuem = 1.0f - value;
outputValue[0] = 1.0f - (valuem + value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
outputValue[1] = 1.0f - (valuem + value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
outputValue[2] = 1.0f - (valuem + value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
outputValue[3] = inputColor1[3];
output[0] = 1.0f - (valuem + value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
output[1] = 1.0f - (valuem + value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
output[2] = 1.0f - (valuem + value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,6 +39,6 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixSoftLightOperation::MixSoftLightOperation() : MixBaseOperation()
/* pass */
}
void MixSoftLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler) \
void MixSoftLightOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) \
{
float inputColor1[4];
float inputColor2[4];
@@ -48,11 +48,11 @@ void MixSoftLightOperation::executePixel(float *outputValue, float x, float y, P
scg = 1.0f - (1.0f - inputColor2[1]) * (1.0f - inputColor1[1]);
scb = 1.0f - (1.0f - inputColor2[2]) * (1.0f - inputColor1[2]);
outputValue[0] = valuem * (inputColor1[0]) + value * (((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) + (inputColor1[0] * scr));
outputValue[1] = valuem * (inputColor1[1]) + value * (((1.0f - inputColor1[1]) * inputColor2[1] * (inputColor1[1])) + (inputColor1[1] * scg));
outputValue[2] = valuem * (inputColor1[2]) + value * (((1.0f - inputColor1[2]) * inputColor2[2] * (inputColor1[2])) + (inputColor1[2] * scb));
outputValue[3] = inputColor1[3];
output[0] = valuem * (inputColor1[0]) + value * (((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) + (inputColor1[0] * scr));
output[1] = valuem * (inputColor1[1]) + value * (((1.0f - inputColor1[1]) * inputColor2[1] * (inputColor1[1])) + (inputColor1[1] * scg));
output[2] = valuem * (inputColor1[2]) + value * (((1.0f - inputColor1[2]) * inputColor2[2] * (inputColor1[2])) + (inputColor1[2] * scb));
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -27,7 +27,7 @@ MixSubtractOperation::MixSubtractOperation() : MixBaseOperation()
/* pass */
}
void MixSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixSubtractOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -40,11 +40,11 @@ void MixSubtractOperation::executePixel(float *outputValue, float x, float y, Pi
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
}
outputValue[0] = inputColor1[0] - value * (inputColor2[0]);
outputValue[1] = inputColor1[1] - value * (inputColor2[1]);
outputValue[2] = inputColor1[2] - value * (inputColor2[2]);
outputValue[3] = inputColor1[3];
output[0] = inputColor1[0] - value * (inputColor2[0]);
output[1] = inputColor1[1] - value * (inputColor2[1]);
output[2] = inputColor1[2] - value * (inputColor2[2]);
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,7 +39,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -31,7 +31,7 @@ MixValueOperation::MixValueOperation() : MixBaseOperation()
/* pass */
}
void MixValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MixValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
float inputColor2[4];
@@ -50,8 +50,8 @@ void MixValueOperation::executePixel(float *outputValue, float x, float y, Pixel
float colH, colS, colV;
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
hsv_to_rgb(rH, rS, (valuem * rV + value * colV), &outputValue[0], &outputValue[1], &outputValue[2]);
outputValue[3] = inputColor1[3];
hsv_to_rgb(rH, rS, (valuem * rV + value * colV), &output[0], &output[1], &output[2]);
output[3] = inputColor1[3];
clampIfNeeded(outputValue);
clampIfNeeded(output);
}

View File

@@ -39,6 +39,6 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -33,7 +33,7 @@ MovieClipAttributeOperation::MovieClipAttributeOperation() : NodeOperation()
this->m_attribute = MCA_X;
}
void MovieClipAttributeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void MovieClipAttributeOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
if (!this->m_valueSet) {
float loc[2], scale, angle;
@@ -61,10 +61,10 @@ void MovieClipAttributeOperation::executePixel(float *outputValue, float x, floa
}
this->m_valueSet = true;
}
outputValue[0] = this->m_value;
output[0] = this->m_value;
}
void MovieClipAttributeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void MovieClipAttributeOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
resolution[0] = preferredResolution[0];
resolution[1] = preferredResolution[1];

View File

@@ -51,8 +51,8 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
void setMovieClip(MovieClip *clip) { this->m_clip = clip; }
void setFramenumber(int framenumber) { this->m_framenumber = framenumber; }

View File

@@ -76,7 +76,7 @@ void MovieClipOperation::deinitExecution()
}
}
void MovieClipOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void MovieClipOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
resolution[0] = 0;
resolution[1] = 0;
@@ -91,21 +91,21 @@ void MovieClipOperation::determineResolution(unsigned int resolution[], unsigned
}
}
void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void MovieClipOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
if (this->m_movieClipBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) {
zero_v4(color);
zero_v4(output);
}
else {
switch (sampler) {
case COM_PS_NEAREST:
neareast_interpolation_color(this->m_movieClipBuffer, NULL, color, x, y);
neareast_interpolation_color(this->m_movieClipBuffer, NULL, output, x, y);
break;
case COM_PS_BILINEAR:
bilinear_interpolation_color(this->m_movieClipBuffer, NULL, color, x, y);
bilinear_interpolation_color(this->m_movieClipBuffer, NULL, output, x, y);
break;
case COM_PS_BICUBIC:
bicubic_interpolation_color(this->m_movieClipBuffer, NULL, color, x, y);
bicubic_interpolation_color(this->m_movieClipBuffer, NULL, output, x, y);
break;
}
}

View File

@@ -47,7 +47,7 @@ protected:
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
public:
MovieClipOperation();
@@ -59,7 +59,7 @@ public:
void setCacheFrame(bool value) { this->m_cacheFrame = value; }
void setFramenumber(int framenumber) { this->m_framenumber = framenumber; }
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -78,16 +78,16 @@ void MovieDistortionOperation::deinitExecution()
}
void MovieDistortionOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void MovieDistortionOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
if (this->m_cache != NULL) {
float u, v;
this->m_cache->getUV(&this->m_movieClip->tracking, x, y, &u, &v);
this->m_inputOperation->read(color, u, v, sampler);
this->m_inputOperation->read(output, u, v, sampler);
}
else {
this->m_inputOperation->read(color, x, y, sampler);
this->m_inputOperation->read(output, x, y, sampler);
}
}

View File

@@ -130,7 +130,7 @@ protected:
public:
MovieDistortionOperation(bool distortion);
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -43,59 +43,56 @@ ImBuf *MultilayerBaseOperation::getImBuf()
return NULL;
}
void MultilayerColorOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void MultilayerColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
int yi = y;
int xi = x;
if (this->m_imageBuffer == NULL || xi < 0 || yi < 0 || (unsigned int)xi >= this->getWidth() || (unsigned int)yi >= this->getHeight() ) {
color[0] = 0.0f;
color[1] = 0.0f;
color[2] = 0.0f;
color[3] = 0.0f;
zero_v4(output);
}
else {
if (this->m_numberOfChannels == 4) {
switch (sampler) {
case COM_PS_NEAREST:
neareast_interpolation_color(this->m_buffer, NULL, color, x, y);
neareast_interpolation_color(this->m_buffer, NULL, output, x, y);
break;
case COM_PS_BILINEAR:
bilinear_interpolation_color(this->m_buffer, NULL, color, x, y);
bilinear_interpolation_color(this->m_buffer, NULL, output, x, y);
break;
case COM_PS_BICUBIC:
bicubic_interpolation_color(this->m_buffer, NULL, color, x, y);
bicubic_interpolation_color(this->m_buffer, NULL, output, x, y);
break;
}
}
else {
int offset = (yi * this->getWidth() + xi) * 3;
copy_v3_v3(color, &this->m_imageBuffer[offset]);
copy_v3_v3(output, &this->m_imageBuffer[offset]);
}
}
}
void MultilayerValueOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void MultilayerValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
int yi = y;
int xi = x;
if (this->m_imageBuffer == NULL || xi < 0 || yi < 0 || (unsigned int)xi >= this->getWidth() || (unsigned int)yi >= this->getHeight() ) {
color[0] = 0.0f;
output[0] = 0.0f;
}
else {
float result = this->m_imageBuffer[yi * this->getWidth() + xi];
color[0] = result;
output[0] = result;
}
}
void MultilayerVectorOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void MultilayerVectorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
int yi = y;
int xi = x;
if (this->m_imageBuffer == NULL || xi < 0 || yi < 0 || (unsigned int)xi >= this->getWidth() || (unsigned int)yi >= this->getHeight() ) {
color[0] = 0.0f;
output[0] = 0.0f;
}
else {
int offset = (yi * this->getWidth() + xi) * 3;
copy_v3_v3(color, &this->m_imageBuffer[offset]);
copy_v3_v3(output, &this->m_imageBuffer[offset]);
}
}

View File

@@ -46,7 +46,7 @@ public:
MultilayerColorOperation(int pass) : MultilayerBaseOperation(pass) {
this->addOutputSocket(COM_DT_COLOR);
}
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MultilayerValueOperation : public MultilayerBaseOperation {
@@ -54,7 +54,7 @@ public:
MultilayerValueOperation(int pass) : MultilayerBaseOperation(pass) {
this->addOutputSocket(COM_DT_VALUE);
}
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class MultilayerVectorOperation : public MultilayerBaseOperation {
@@ -62,7 +62,7 @@ public:
MultilayerVectorOperation(int pass) : MultilayerBaseOperation(pass) {
this->addOutputSocket(COM_DT_VECTOR);
}
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -35,15 +35,14 @@ void NormalizeOperation::initExecution()
NodeOperation::initMutex();
}
void NormalizeOperation::executePixel(float *color, int x, int y, void *data)
void NormalizeOperation::executePixel(float output[4], int x, int y, void *data)
{
/* using generic two floats struct to store x: min y: mult */
NodeTwoFloats *minmult = (NodeTwoFloats *)data;
float output[4];
this->m_imageReader->read(output, x, y, NULL);
color[0] = (output[0] - minmult->x) * minmult->y;
output[0] = (output[0] - minmult->x) * minmult->y;
}
void NormalizeOperation::deinitExecution()

View File

@@ -47,7 +47,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -78,7 +78,7 @@ __kernel void bokehBlurKernel(__read_only image2d_t boundingBox, __read_only ima
__kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2d_t bokehImage,
__read_only image2d_t inputSize,
__write_only image2d_t output, int2 offsetInput, int2 offsetOutput,
int step, int maxBlur, float threshold, int2 dimension, int2 offset)
int step, int maxBlurScalar, float threshold, int2 dimension, int2 offset, float scalar)
{
float4 color = {1.0f, 0.0f, 0.0f, 1.0f};
int2 coords = {get_global_id(0), get_global_id(1)};
@@ -92,14 +92,14 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
float4 multiplier_accum = {1.0f, 1.0f, 1.0f, 1.0f};
float4 color_accum;
int minx = max(realCoordinate.s0 - maxBlur, 0);
int miny = max(realCoordinate.s1 - maxBlur, 0);
int maxx = min(realCoordinate.s0 + maxBlur, dimension.s0);
int maxy = min(realCoordinate.s1 + maxBlur, dimension.s1);
int minx = max(realCoordinate.s0 - maxBlurScalar, 0);
int miny = max(realCoordinate.s1 - maxBlurScalar, 0);
int maxx = min(realCoordinate.s0 + maxBlurScalar, dimension.s0);
int maxy = min(realCoordinate.s1 + maxBlurScalar, dimension.s1);
{
int2 inputCoordinate = realCoordinate - offsetInput;
float size_center = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
float size_center = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0 * scalar;
color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);
readColor = color_accum;
@@ -111,7 +111,7 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
float dx = nx - realCoordinate.s0;
if (dx != 0 || dy != 0) {
inputCoordinate.s0 = nx - offsetInput.s0;
size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0 * scalar;
if (size > threshold) {
if (size >= fabs(dx) && size >= fabs(dy)) {
float2 uv = {256.0f + dx * 255.0f / size,

View File

@@ -110,7 +110,7 @@ bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferO
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
void PreviewOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void PreviewOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
NodeOperation::determineResolution(resolution, preferredResolution);
int width = resolution[0];

View File

@@ -45,7 +45,7 @@ public:
const CompositorPriority getRenderPriority() const;
void executeRegion(rcti *rect, unsigned int tileNumber);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
void setbNode(bNode *node) { this->m_node = node; }
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
bool isPreviewOperation() { return true; }

View File

@@ -47,7 +47,7 @@ void *ProjectorLensDistortionOperation::initializeTileData(rcti *rect)
return buffer;
}
void ProjectorLensDistortionOperation::executePixel(float *color, int x, int y, void *data)
void ProjectorLensDistortionOperation::executePixel(float output[4], int x, int y, void *data)
{
float inputValue[4];
const float height = this->getHeight();
@@ -56,12 +56,12 @@ void ProjectorLensDistortionOperation::executePixel(float *color, int x, int y,
const float u = (x + 0.5f) / width;
MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
inputBuffer->readCubic(inputValue, (u * width + this->m_kr2) - 0.5f, v * height - 0.5f);
color[0] = inputValue[0];
output[0] = inputValue[0];
inputBuffer->read(inputValue, x, y);
color[1] = inputValue[1];
output[1] = inputValue[1];
inputBuffer->readCubic(inputValue, (u * width - this->m_kr2) - 0.5f, v * height - 0.5f);
color[2] = inputValue[2];
color[3] = 1.0f;
output[2] = inputValue[2];
output[3] = 1.0f;
}
void ProjectorLensDistortionOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -36,7 +36,7 @@ void *ReadBufferOperation::initializeTileData(rcti *rect)
return m_buffer;
}
void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void ReadBufferOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
if (this->m_memoryProxy != NULL) {
WriteBufferOperation *operation = this->m_memoryProxy->getWriteBufferOperation();
@@ -49,19 +49,19 @@ void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigne
}
}
}
void ReadBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ReadBufferOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
if (sampler == COM_PS_NEAREST) {
m_buffer->read(color, x, y);
m_buffer->read(output, x, y);
}
else {
m_buffer->readCubic(color, x, y);
m_buffer->readCubic(output, x, y);
}
}
void ReadBufferOperation::executePixel(float *color, float x, float y, float dx, float dy)
void ReadBufferOperation::executePixel(float output[4], float x, float y, float dx, float dy)
{
m_buffer->readEWA(color, x, y, dx, dy);
m_buffer->readEWA(output, x, y, dx, dy);
}
bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)

View File

@@ -36,11 +36,11 @@ public:
int isBufferOperation() { return true; }
void setMemoryProxy(MemoryProxy *memoryProxy) { this->m_memoryProxy = memoryProxy; }
MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; }
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
void *initializeTileData(rcti *rect);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float *color, float x, float y, float dx, float dy);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, float dx, float dy);
const bool isReadBufferOperation() const { return true; }
void setOffset(unsigned int offset) { this->m_offset = offset; }
unsigned int getOffset() { return this->m_offset; }

View File

@@ -27,7 +27,7 @@ RenderLayersAlphaProg::RenderLayersAlphaProg() : RenderLayersBaseProg(SCE_PASS_C
this->addOutputSocket(COM_DT_VALUE);
}
void RenderLayersAlphaProg::executePixel(float *output, float x, float y, PixelSampler sampler)
void RenderLayersAlphaProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
int ix = x;
int iy = y;

View File

@@ -28,7 +28,7 @@
class RenderLayersAlphaProg : public RenderLayersBaseProg {
public:
RenderLayersAlphaProg();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};

View File

@@ -69,7 +69,7 @@ void RenderLayersBaseProg::initExecution()
}
}
void RenderLayersBaseProg::executePixel(float *output, float x, float y, PixelSampler sampler)
void RenderLayersBaseProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
int ix = x;
int iy = y;
@@ -100,7 +100,7 @@ void RenderLayersBaseProg::deinitExecution()
this->m_inputBuffer = NULL;
}
void RenderLayersBaseProg::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void RenderLayersBaseProg::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
Scene *sce = this->getScene();
Render *re = (sce) ? RE_GetRender(sce->id.name) : NULL;

View File

@@ -73,7 +73,7 @@ protected:
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
/**
* retrieve the reference to the float buffer of the renderer.
@@ -92,7 +92,7 @@ public:
short getLayerId() { return this->m_layerId; }
void initExecution();
void deinitExecution();
void executePixel(float *output, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -68,14 +68,14 @@ inline void RotateOperation::ensureDegree()
}
void RotateOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void RotateOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
ensureDegree();
const float dy = y - this->m_centerY;
const float dx = x - this->m_centerX;
const float nx = this->m_centerX + (this->m_cosine * dx + this->m_sine * dy);
const float ny = this->m_centerY + (-this->m_sine * dx + this->m_cosine * dy);
this->m_imageSocket->read(color, nx, ny, sampler);
this->m_imageSocket->read(output, nx, ny, sampler);
}
bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)

View File

@@ -38,7 +38,7 @@ private:
public:
RotateOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
void setDoDegree2RadConversion(bool abool) { this->m_doDegree2RadConversion = abool; }

View File

@@ -57,7 +57,7 @@ void ScaleOperation::deinitExecution()
}
void ScaleOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ScaleOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
#ifdef USE_FORCE_BILINEAR
sampler = COM_PS_BILINEAR;
@@ -74,7 +74,7 @@ void ScaleOperation::executePixel(float *color, float x, float y, PixelSampler s
float nx = this->m_centerX + (x - this->m_centerX) / scx;
float ny = this->m_centerY + (y - this->m_centerY) / scy;
this->m_inputOperation->read(color, nx, ny, sampler);
this->m_inputOperation->read(output, nx, ny, sampler);
}
bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -127,7 +127,7 @@ void ScaleAbsoluteOperation::deinitExecution()
}
void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ScaleAbsoluteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
#ifdef USE_FORCE_BILINEAR
sampler = COM_PS_BILINEAR;
@@ -151,7 +151,7 @@ void ScaleAbsoluteOperation::executePixel(float *color, float x, float y, PixelS
float nx = this->m_centerX + (x - this->m_centerX) / relativeXScale;
float ny = this->m_centerY + (y - this->m_centerY) / relativeYScale;
this->m_inputOperation->read(color, nx, ny, sampler);
this->m_inputOperation->read(output, nx, ny, sampler);
}
bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -248,7 +248,7 @@ void ScaleFixedSizeOperation::deinitExecution()
}
void ScaleFixedSizeOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ScaleFixedSizeOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
#ifdef USE_FORCE_BILINEAR
sampler = COM_PS_BILINEAR;
@@ -257,10 +257,10 @@ void ScaleFixedSizeOperation::executePixel(float *color, float x, float y, Pixel
if (this->m_is_offset) {
float nx = ((x - this->m_offsetX) * this->m_relX);
float ny = ((y - this->m_offsetY) * this->m_relY);
this->m_inputOperation->read(color, nx, ny, sampler);
this->m_inputOperation->read(output, nx, ny, sampler);
}
else {
this->m_inputOperation->read(color, x * this->m_relX, y * this->m_relY, sampler);
this->m_inputOperation->read(output, x * this->m_relX, y * this->m_relY, sampler);
}
}
@@ -276,7 +276,7 @@ bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, Read
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
unsigned int nr[2];
nr[0] = this->m_newWidth;

View File

@@ -35,7 +35,7 @@ private:
public:
ScaleOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
@@ -51,7 +51,7 @@ class ScaleAbsoluteOperation : public NodeOperation {
public:
ScaleAbsoluteOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
@@ -75,8 +75,8 @@ class ScaleFixedSizeOperation : public NodeOperation {
public:
ScaleFixedSizeOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -55,7 +55,7 @@ void *ScreenLensDistortionOperation::initializeTileData(rcti *rect)
return buffer;
}
void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int y, void *data)
void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y, void *data)
{
const float height = this->getHeight();
const float width = this->getWidth();
@@ -126,18 +126,15 @@ void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int
}
}
if (dr) outputColor[0] = 2.0f * tc[0] / (float)dr;
if (dg) outputColor[1] = 2.0f * tc[1] / (float)dg;
if (db) outputColor[2] = 2.0f * tc[2] / (float)db;
if (dr) output[0] = 2.0f * tc[0] / (float)dr;
if (dg) output[1] = 2.0f * tc[1] / (float)dg;
if (db) output[2] = 2.0f * tc[2] / (float)db;
/* set alpha */
outputColor[3] = 1.0f;
output[3] = 1.0f;
}
else {
outputColor[0] = 0.0f;
outputColor[1] = 0.0f;
outputColor[2] = 0.0f;
outputColor[3] = 0.0f;
zero_v4(output);
}
}

View File

@@ -49,7 +49,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -39,9 +39,9 @@ void SeparateChannelOperation::deinitExecution()
}
void SeparateChannelOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void SeparateChannelOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float input[4];
this->m_inputOperation->read(input, x, y, sampler);
color[0] = input[this->m_channel];
output[0] = input[this->m_channel];
}

View File

@@ -31,7 +31,7 @@ private:
int m_channel;
public:
SeparateChannelOperation();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -38,14 +38,14 @@ void SetAlphaOperation::initExecution()
this->m_inputAlpha = getInputSocketReader(1);
}
void SetAlphaOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void SetAlphaOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float alphaInput[4];
this->m_inputColor->read(outputValue, x, y, sampler);
this->m_inputColor->read(output, x, y, sampler);
this->m_inputAlpha->read(alphaInput, x, y, sampler);
outputValue[3] = alphaInput[0];
output[3] = alphaInput[0];
}
void SetAlphaOperation::deinitExecution()

View File

@@ -43,7 +43,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -27,15 +27,15 @@ SetColorOperation::SetColorOperation() : NodeOperation()
this->addOutputSocket(COM_DT_COLOR);
}
void SetColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void SetColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
outputValue[0] = this->m_channel1;
outputValue[1] = this->m_channel2;
outputValue[2] = this->m_channel3;
outputValue[3] = this->m_channel4;
output[0] = this->m_channel1;
output[1] = this->m_channel2;
output[2] = this->m_channel3;
output[3] = this->m_channel4;
}
void SetColorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void SetColorOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
resolution[0] = preferredResolution[0];
resolution[1] = preferredResolution[1];

View File

@@ -61,9 +61,9 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
const bool isSetOperation() const { return true; }
};

View File

@@ -37,7 +37,7 @@ void SetSamplerOperation::deinitExecution()
this->m_reader = NULL;
}
void SetSamplerOperation::executePixel(float *output, float x, float y, PixelSampler sampler)
void SetSamplerOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
this->m_reader->read(output, x, y, this->m_sampler);
}

View File

@@ -44,7 +44,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();
};

View File

@@ -27,12 +27,12 @@ SetValueOperation::SetValueOperation() : NodeOperation()
this->addOutputSocket(COM_DT_VALUE);
}
void SetValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void SetValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
outputValue[0] = this->m_value;
output[0] = this->m_value;
}
void SetValueOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void SetValueOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
resolution[0] = preferredResolution[0];
resolution[1] = preferredResolution[1];

View File

@@ -46,8 +46,8 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
const bool isSetOperation() const { return true; }
};

View File

@@ -28,15 +28,15 @@ SetVectorOperation::SetVectorOperation() : NodeOperation()
this->addOutputSocket(COM_DT_VECTOR);
}
void SetVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void SetVectorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
outputValue[0] = this->m_x;
outputValue[1] = this->m_y;
outputValue[2] = this->m_z;
outputValue[3] = this->m_w;
output[0] = this->m_x;
output[1] = this->m_y;
output[2] = this->m_z;
output[3] = this->m_w;
}
void SetVectorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void SetVectorOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
resolution[0] = preferredResolution[0];
resolution[1] = preferredResolution[1];

View File

@@ -54,9 +54,9 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
const bool isSetOperation() const { return true; }
void setVector(float vector[3]) {

View File

@@ -39,9 +39,9 @@ void SocketProxyOperation::deinitExecution()
this->m_inputOperation = NULL;
}
void SocketProxyOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void SocketProxyOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
if (this->m_inputOperation) {
this->m_inputOperation->read(color, x, y, sampler);
this->m_inputOperation->read(output, x, y, sampler);
}
}

View File

@@ -30,7 +30,7 @@ private:
SocketReader *m_inputOperation;
public:
SocketProxyOperation(DataType type);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -53,7 +53,7 @@ void TextureBaseOperation::deinitExecution()
this->m_inputOffset = NULL;
}
void TextureBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void TextureBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
if (preferredResolution[0] == 0 || preferredResolution[1] == 0) {
int width = this->m_rd->xsch * this->m_rd->size / 100;
@@ -67,16 +67,16 @@ void TextureBaseOperation::determineResolution(unsigned int resolution[], unsign
}
}
void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void TextureAlphaOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
TextureBaseOperation::executePixel(color, x, y, sampler);
color[0] = color[3];
color[1] = 0.0f;
color[2] = 0.0f;
color[3] = 0.0f;
TextureBaseOperation::executePixel(output, x, y, sampler);
output[0] = output[3];
output[1] = 0.0f;
output[2] = 0.0f;
output[3] = 0.0f;
}
void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void TextureBaseOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
float textureSize[4];
@@ -98,14 +98,16 @@ void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSam
retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres);
if (texres.talpha)
color[3] = texres.ta;
output[3] = texres.ta;
else
color[3] = texres.tin;
output[3] = texres.tin;
if ((retval & TEX_RGB)) {
color[0] = texres.tr;
color[1] = texres.tg;
color[2] = texres.tb;
output[0] = texres.tr;
output[1] = texres.tg;
output[2] = texres.tb;
}
else {
output[0] = output[1] = output[2] = output[3];
}
else color[0] = color[1] = color[2] = color[3];
}

View File

@@ -51,7 +51,7 @@ protected:
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
/**
* Constructor
@@ -59,7 +59,7 @@ protected:
TextureBaseOperation();
public:
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void setTexture(Tex *texture) { this->m_texture = texture; }
void initExecution();
@@ -75,7 +75,7 @@ public:
class TextureAlphaOperation : public TextureBaseOperation {
public:
TextureAlphaOperation();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};

View File

@@ -41,11 +41,10 @@ void TonemapOperation::initExecution()
NodeOperation::initMutex();
}
void TonemapOperation::executePixel(float *color, int x, int y, void *data)
void TonemapOperation::executePixel(float output[4], int x, int y, void *data)
{
AvgLogLum *avg = (AvgLogLum *)data;
float output[4];
this->m_imageReader->read(output, x, y, NULL);
mul_v3_fl(output, avg->al);
float dr = output[0] + this->m_data->offset;
@@ -56,14 +55,12 @@ void TonemapOperation::executePixel(float *color, int x, int y, void *data)
output[2] /= ((db == 0.f) ? 1.0f : db);
const float igm = avg->igm;
if (igm != 0.0f) {
output[0] = powf(MAX2(output[0], 0.0f), igm);
output[1] = powf(MAX2(output[1], 0.0f), igm);
output[2] = powf(MAX2(output[2], 0.0f), igm);
output[0] = powf(max(output[0], 0.0f), igm);
output[1] = powf(max(output[1], 0.0f), igm);
output[2] = powf(max(output[2], 0.0f), igm);
}
copy_v4_v4(color, output);
}
void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, void *data)
void PhotoreceptorTonemapOperation::executePixel(float output[4], int x, int y, void *data)
{
AvgLogLum *avg = (AvgLogLum *)data;
NodeTonemap *ntm = this->m_data;
@@ -72,7 +69,6 @@ void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, voi
const float m = (ntm->m > 0.0f) ? ntm->m : (0.3f + 0.7f * powf(avg->auto_key, 1.4f));
const float ic = 1.0f - ntm->c, ia = 1.0f - ntm->a;
float output[4];
this->m_imageReader->read(output, x, y, NULL);
const float L = rgb_to_luma_y(output);
@@ -88,8 +84,6 @@ void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, voi
I_g = avg->cav[2] + ic * (avg->lav - avg->cav[2]);
I_a = I_l + ia * (I_g - I_l);
output[2] /= (output[2] + powf(f * I_a, m));
copy_v4_v4(color, output);
}
void TonemapOperation::deinitExecution()

View File

@@ -64,7 +64,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution
@@ -97,7 +97,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
};
#endif

View File

@@ -101,17 +101,17 @@ void TrackPositionOperation::initExecution()
}
}
void TrackPositionOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler)
void TrackPositionOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
outputValue[0] = this->m_markerPos[this->m_axis] - this->m_relativePos[this->m_axis];
output[0] = this->m_markerPos[this->m_axis] - this->m_relativePos[this->m_axis];
if (this->m_axis == 0)
outputValue[0] *= this->m_width;
output[0] *= this->m_width;
else
outputValue[0] *= this->m_height;
output[0] *= this->m_height;
}
void TrackPositionOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void TrackPositionOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
resolution[0] = preferredResolution[0];
resolution[1] = preferredResolution[1];

View File

@@ -60,7 +60,7 @@ protected:
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
public:
TrackPositionOperation();
@@ -75,7 +75,7 @@ public:
void initExecution();
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
const bool isSetOperation() const { return true; }
};

View File

@@ -50,10 +50,10 @@ void TranslateOperation::deinitExecution()
}
void TranslateOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void TranslateOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
ensureDelta();
this->m_inputOperation->read(color, x - this->getDeltaX(), y - this->getDeltaY(), sampler);
this->m_inputOperation->read(output, x - this->getDeltaX(), y - this->getDeltaY(), sampler);
}
bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)

View File

@@ -36,7 +36,7 @@ private:
public:
TranslateOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
void initExecution();
void deinitExecution();

View File

@@ -45,6 +45,7 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation
this->m_inputSizeProgram = NULL;
this->m_maxBlur = 32.0f;
this->m_threshold = 1.0f;
this->m_do_size_scale = false;
#ifdef COM_DEFOCUS_SEARCH
this->m_inputSearchProgram = NULL;
#endif
@@ -66,7 +67,7 @@ struct VariableSizeBokehBlurTileData
MemoryBuffer *color;
MemoryBuffer *bokeh;
MemoryBuffer *size;
int maxBlur;
int maxBlurScalar;
};
void *VariableSizeBokehBlurOperation::initializeTileData(rcti *rect)
@@ -79,8 +80,12 @@ void *VariableSizeBokehBlurOperation::initializeTileData(rcti *rect)
rcti rect2;
this->determineDependingAreaOfInterest(rect, (ReadBufferOperation *)this->m_inputSizeProgram, &rect2);
data->maxBlur = (int)data->size->getMaximumValue(&rect2);
CLAMP(data->maxBlur, 1.0f, this->m_maxBlur);
const float max_dim = max(m_width, m_height);
const float scalar = this->m_do_size_scale ? (max_dim / 100.0f) : 1.0f;
data->maxBlurScalar = (int)(data->size->getMaximumValue(&rect2) * scalar);
CLAMP(data->maxBlurScalar, 1.0f, this->m_maxBlur);
return data;
}
@@ -90,7 +95,7 @@ void VariableSizeBokehBlurOperation::deinitializeTileData(rcti *rect, void *data
delete result;
}
void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, void *data)
void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
VariableSizeBokehBlurTileData *tileData = (VariableSizeBokehBlurTileData *)data;
MemoryBuffer *inputProgramBuffer = tileData->color;
@@ -103,7 +108,13 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, vo
float tempSize[4];
float multiplier_accum[4];
float color_accum[4];
int maxBlur = tileData->maxBlur;
const float max_dim = max(m_width, m_height);
const float scalar = this->m_do_size_scale ? (max_dim / 100.0f) : 1.0f;
int maxBlurScalar = tileData->maxBlurScalar;
BLI_assert(inputBokehBuffer->getWidth() == COM_BLUR_BOKEH_PIXELS);
BLI_assert(inputBokehBuffer->getHeight() == COM_BLUR_BOKEH_PIXELS);
#ifdef COM_DEFOCUS_SEARCH
float search[4];
@@ -113,10 +124,10 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, vo
int maxx = search[2];
int maxy = search[3];
#else
int minx = max(x - maxBlur, 0);
int miny = max(y - maxBlur, 0);
int maxx = min(x + maxBlur, (int)m_width);
int maxy = min(y + maxBlur, (int)m_height);
int minx = max(x - maxBlurScalar, 0);
int miny = max(y - maxBlurScalar, 0);
int maxx = min(x + maxBlurScalar, (int)m_width);
int maxy = min(y + maxBlurScalar, (int)m_height);
#endif
{
inputSizeBuffer->readNoCheck(tempSize, x, y);
@@ -124,7 +135,7 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, vo
copy_v4_v4(color_accum, readColor);
copy_v4_fl(multiplier_accum, 1.0f);
float size_center = tempSize[0];
float size_center = tempSize[0] * scalar;
const int addXStep = QualityStepHelper::getStep() * COM_NUMBER_OF_CHANNELS;
@@ -135,12 +146,13 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, vo
int offsetNxNy = offsetNy + (minx * COM_NUMBER_OF_CHANNELS);
for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
if (nx != x || ny != y) {
float size = inputSizeFloatBuffer[offsetNxNy];
float size = inputSizeFloatBuffer[offsetNxNy] * scalar;
if (size > this->m_threshold) {
float dx = nx - x;
if (size > fabsf(dx) && size > fabsf(dy)) {
float uv[2] = {256.0f + (dx / size) * 255.0f,
256.0f + (dy / size) * 255.0f};
float uv[2] = {
(float)(COM_BLUR_BOKEH_PIXELS / 2) + (dx / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1),
(float)(COM_BLUR_BOKEH_PIXELS / 2) + (dy / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1)};
inputBokehBuffer->readNoCheck(bokeh, uv[0], uv[1]);
madd_v4_v4v4(color_accum, bokeh, &inputProgramFloatBuffer[offsetNxNy]);
add_v4_v4(multiplier_accum, bokeh);
@@ -152,10 +164,10 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, vo
}
}
color[0] = color_accum[0] / multiplier_accum[0];
color[1] = color_accum[1] / multiplier_accum[1];
color[2] = color_accum[2] / multiplier_accum[2];
color[3] = color_accum[3] / multiplier_accum[3];
output[0] = color_accum[0] / multiplier_accum[0];
output[1] = color_accum[1] / multiplier_accum[1];
output[2] = color_accum[2] / multiplier_accum[2];
output[3] = color_accum[3] / multiplier_accum[3];
/* blend in out values over the threshold, otherwise we get sharp, ugly transitions */
if ((size_center > this->m_threshold) &&
@@ -163,7 +175,7 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, vo
{
/* factor from 0-1 */
float fac = (size_center - this->m_threshold) / this->m_threshold;
interp_v4_v4v4(color, readColor, color, fac);
interp_v4_v4v4(output, readColor, output, fac);
}
}
@@ -181,7 +193,11 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device,
cl_float threshold = this->m_threshold;
MemoryBuffer *sizeMemoryBuffer = (MemoryBuffer *)this->m_inputSizeProgram->getInputMemoryBuffer(inputMemoryBuffers);
maxBlur = (cl_int)sizeMemoryBuffer->getMaximumValue();
const float max_dim = max(m_width, m_height);
cl_float scalar = this->m_do_size_scale ? (max_dim / 100.0f) : 1.0f;
maxBlur = (cl_int)sizeMemoryBuffer->getMaximumValue() * scalar;
maxBlur = MIN2(maxBlur, this->m_maxBlur);
device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
@@ -192,9 +208,10 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device,
clSetKernelArg(defocusKernel, 6, sizeof(cl_int), &step);
clSetKernelArg(defocusKernel, 7, sizeof(cl_int), &maxBlur);
clSetKernelArg(defocusKernel, 8, sizeof(cl_float), &threshold);
device->COM_clAttachSizeToKernelParameter(defocusKernel, 9, this);
clSetKernelArg(defocusKernel, 9, sizeof(cl_float), &scalar);
device->COM_clAttachSizeToKernelParameter(defocusKernel, 10, this);
device->COM_clEnqueueRange(defocusKernel, outputMemoryBuffer, 10, this);
device->COM_clEnqueueRange(defocusKernel, outputMemoryBuffer, 11, this);
}
void VariableSizeBokehBlurOperation::deinitExecution()
@@ -212,13 +229,17 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu
rcti newInput;
rcti bokehInput;
newInput.xmax = input->xmax + this->m_maxBlur + 2;
newInput.xmin = input->xmin - this->m_maxBlur + 2;
newInput.ymax = input->ymax + this->m_maxBlur - 2;
newInput.ymin = input->ymin - this->m_maxBlur - 2;
bokehInput.xmax = 512;
const float max_dim = max(m_width, m_height);
const float scalar = this->m_do_size_scale ? (max_dim / 100.0f) : 1.0f;
int maxBlurScalar = this->m_maxBlur * scalar;
newInput.xmax = input->xmax + maxBlurScalar + 2;
newInput.xmin = input->xmin - maxBlurScalar + 2;
newInput.ymax = input->ymax + maxBlurScalar - 2;
newInput.ymin = input->ymin - maxBlurScalar - 2;
bokehInput.xmax = COM_BLUR_BOKEH_PIXELS;
bokehInput.xmin = 0;
bokehInput.ymax = 512;
bokehInput.ymax = COM_BLUR_BOKEH_PIXELS;
bokehInput.ymin = 0;
@@ -317,7 +338,7 @@ voi *InverseSearchRadiusOperation::initializeTileData(rcti *rect)
return data;
}
void InverseSearchRadiusOperation::executePixel(float *color, int x, int y, void *data)
void InverseSearchRadiusOperation::executePixel(float output[4], int x, int y, void *data)
{
MemoryBuffer *buffer = (MemoryBuffer *)data;
buffer->readNoCheck(color, x, y);
@@ -336,7 +357,7 @@ void InverseSearchRadiusOperation::deinitExecution()
this->m_inputRadius = NULL;
}
void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
{
NodeOperation::determineResolution(resolution, preferredResolution);
resolution[0] = resolution[0] / DIVIDER;

View File

@@ -31,6 +31,7 @@ class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepH
private:
int m_maxBlur;
float m_threshold;
bool m_do_size_scale; /* scale size, matching 'BokehBlurNode' */
SocketReader *m_inputProgram;
SocketReader *m_inputBokehProgram;
SocketReader *m_inputSizeProgram;
@@ -44,7 +45,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution
@@ -66,6 +67,8 @@ public:
void setThreshold(float threshold) { this->m_threshold = threshold; }
void setDoScaleSize(bool scale_size) { this->m_do_size_scale = scale_size; }
void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp);
};
@@ -82,7 +85,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
void executePixel(float output[4], int x, int y, MemoryBuffer *inputBuffers[], void *data);
/**
* Initialize the execution
@@ -97,7 +100,7 @@ public:
void deinitExecution();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
void setMaxBlur(int maxRadius) { this->m_maxBlur = maxRadius; }
};

View File

@@ -52,11 +52,11 @@ void VectorBlurOperation::initExecution()
}
void VectorBlurOperation::executePixel(float *color, int x, int y, void *data)
void VectorBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
float *buffer = (float *) data;
int index = (y * this->getWidth() + x) * COM_NUMBER_OF_CHANNELS;
copy_v4_v4(color, &buffer[index]);
copy_v4_v4(output, &buffer[index]);
}
void VectorBlurOperation::deinitExecution()

View File

@@ -48,7 +48,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, int x, int y, void *data);
void executePixel(float output[4], int x, int y, void *data);
/**
* Initialize the execution

View File

@@ -43,7 +43,7 @@ void VectorCurveOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0);
}
void VectorCurveOperation::executePixel(float *output, float x, float y, PixelSampler sampler)
void VectorCurveOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float input[4];

View File

@@ -37,7 +37,7 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *Vector, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
* Initialize the execution

View File

@@ -40,9 +40,9 @@ WriteBufferOperation::~WriteBufferOperation()
}
}
void WriteBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void WriteBufferOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
this->m_input->read(color, x, y, sampler);
this->m_input->read(output, x, y, sampler);
}
void WriteBufferOperation::initExecution()

View File

@@ -38,7 +38,7 @@ public:
~WriteBufferOperation();
int isBufferOperation() { return true; }
MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; }
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
const bool isWriteBufferOperation() const { return true; }
void executeRegion(rcti *rect, unsigned int tileNumber);

View File

@@ -46,7 +46,7 @@ void ZCombineOperation::initExecution()
this->m_depth2Reader = this->getInputSocketReader(3);
}
void ZCombineOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ZCombineOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float depth1[4];
float depth2[4];
@@ -54,13 +54,13 @@ void ZCombineOperation::executePixel(float *color, float x, float y, PixelSample
this->m_depth1Reader->read(depth1, x, y, sampler);
this->m_depth2Reader->read(depth2, x, y, sampler);
if (depth1[0] < depth2[0]) {
this->m_image1Reader->read(color, x, y, sampler);
this->m_image1Reader->read(output, x, y, sampler);
}
else {
this->m_image2Reader->read(color, x, y, sampler);
this->m_image2Reader->read(output, x, y, sampler);
}
}
void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler)
void ZCombineAlphaOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float depth1[4];
float depth2[4];
@@ -79,10 +79,10 @@ void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelS
}
float fac = color1[3];
float ifac = 1.0f - fac;
color[0] = color1[0] + ifac * color2[0];
color[1] = color1[1] + ifac * color2[1];
color[2] = color1[2] + ifac * color2[2];
color[3] = MAX2(color1[3], color2[3]);
output[0] = color1[0] + ifac * color2[0];
output[1] = color1[1] + ifac * color2[1];
output[2] = color1[2] + ifac * color2[2];
output[3] = MAX2(color1[3], color2[3]);
}
void ZCombineOperation::deinitExecution()

View File

@@ -47,11 +47,11 @@ public:
/**
* the inner loop of this program
*/
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
class ZCombineAlphaOperation : public ZCombineOperation {
void executePixel(float *color, float x, float y, PixelSampler sampler);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
};
#endif

View File

@@ -5301,7 +5301,7 @@ void MESH_OT_convex_hull(wmOperatorType *ot)
/* api callbacks */
ot->exec = edbm_convex_hull_exec;
ot->poll = EM_view3d_poll;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

View File

@@ -2685,7 +2685,7 @@ static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, wmEvent *event
void VIEW3D_OT_zoom_border(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Border Zoom";
ot->name = "Zoom to Border";
ot->description = "Zoom in the view to the nearest object contained in the border";
ot->idname = "VIEW3D_OT_zoom_border";