code cleanup: compositor - define size for executePixel function output float array

This commit is contained in:
2012-08-10 14:07:24 +00:00
parent e877247789
commit 94a3945cf9
251 changed files with 852 additions and 874 deletions

View File

@@ -33,9 +33,9 @@ void SingleThreadedNodeOperation::initExecution()
initMutex(); 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() void SingleThreadedNodeOperation::deinitExecution()

View File

@@ -39,7 +39,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

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

View File

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

View File

@@ -39,6 +39,6 @@ public:
/** /**
* the inner loop of this program * 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 #endif

View File

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

View File

@@ -41,7 +41,7 @@ public:
/** /**
* the inner loop of this program * 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; } void setX(float x) { this->m_x = x; }
}; };

View File

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

View File

@@ -39,7 +39,7 @@ public:
/** /**
* the inner loop of this program * 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 #endif

View File

@@ -42,14 +42,14 @@ void AntiAliasOperation::initExecution()
NodeOperation::initMutex(); 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) { 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 { else {
int offset = y * this->m_width + x; 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 * 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 * Initialize the execution

View File

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

View File

@@ -38,7 +38,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -74,7 +74,7 @@ void BokehBlurOperation::initExecution()
QualityStepHelper::initExecution(COM_QH_INCREASE); 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 color_accum[4];
float tempBoundingBox[4]; float tempBoundingBox[4];
@@ -124,13 +124,13 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, void *data)
bufferindex += offsetadd; bufferindex += offsetadd;
} }
} }
color[0] = color_accum[0] * (1.0f / multiplier_accum[0]); output[0] = color_accum[0] * (1.0f / multiplier_accum[0]);
color[1] = color_accum[1] * (1.0f / multiplier_accum[1]); output[1] = color_accum[1] * (1.0f / multiplier_accum[1]);
color[2] = color_accum[2] * (1.0f / multiplier_accum[2]); output[2] = color_accum[2] * (1.0f / multiplier_accum[2]);
color[3] = color_accum[3] * (1.0f / multiplier_accum[3]); output[3] = color_accum[3] * (1.0f / multiplier_accum[3]);
} }
else { 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 * 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 * Initialize the execution

View File

@@ -85,7 +85,7 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y)
} }
return insideBokeh; 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 shift = this->m_data->lensshift;
float shift2 = shift / 2.0f; float shift2 = shift / 2.0f;
@@ -94,16 +94,16 @@ void BokehImageOperation::executePixel(float *color, float x, float y, PixelSamp
float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), x, y); float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), x, y);
float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), x, y); float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), x, y);
if (shift < 0) { if (shift < 0) {
color[0] = insideBokehMax; output[0] = insideBokehMax;
color[1] = insideBokehMed; output[1] = insideBokehMed;
color[2] = insideBokehMin; output[2] = insideBokehMin;
} }
else { else {
color[0] = insideBokehMin; output[0] = insideBokehMin;
color[1] = insideBokehMed; output[1] = insideBokehMed;
color[2] = insideBokehMax; output[2] = insideBokehMax;
} }
color[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f; output[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f;
} }
void BokehImageOperation::deinitExecution() void BokehImageOperation::deinitExecution()

View File

@@ -45,7 +45,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

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

View File

@@ -45,7 +45,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

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

View File

@@ -40,7 +40,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -42,9 +42,9 @@ void CalculateMeanOperation::initExecution()
NodeOperation::initMutex(); 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() void CalculateMeanOperation::deinitExecution()

View File

@@ -46,7 +46,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -31,9 +31,9 @@ CalculateStandardDeviationOperation::CalculateStandardDeviationOperation() : Cal
/* pass */ /* 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) void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect)

View File

@@ -39,7 +39,7 @@ public:
/** /**
* the inner loop of this program * 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); void *initializeTileData(rcti *rect);

View File

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

View File

@@ -49,7 +49,7 @@ public:
/** /**
* the inner loop of this program * 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 setHue(float hue) { this->m_hue = hue; }
void setSaturation(float saturation) { this->m_saturation = saturation; } void setSaturation(float saturation) { this->m_saturation = saturation; }

View File

@@ -83,7 +83,7 @@ void ChannelMatteOperation::deinitExecution()
this->m_inputImageProgram = NULL; 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 inColor[4];
float alpha; 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 */ /* 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 * 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 initExecution();
void deinitExecution(); void deinitExecution();

View File

@@ -44,7 +44,7 @@ void ChromaMatteOperation::deinitExecution()
this->m_inputKeyProgram = NULL; 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 inKey[4];
float inImage[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 */ /* don't make something that was more transparent less transparent */
if (alpha < inImage[3]) { if (alpha < inImage[3]) {
outputValue[0] = alpha; output[0] = alpha;
} }
else { else {
outputValue[0] = inImage[3]; output[0] = inImage[3];
} }
} }
else { /*pixel is outside key color */ 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 * 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 initExecution();
void deinitExecution(); void deinitExecution();

View File

@@ -49,7 +49,7 @@ void ColorBalanceASCCDLOperation::initExecution()
this->m_inputColorOperation = this->getInputSocketReader(1); 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 inputColor[4];
float value[4]; float value[4];
@@ -61,10 +61,10 @@ void ColorBalanceASCCDLOperation::executePixel(float *outputColor, float x, floa
fac = min(1.0f, fac); fac = min(1.0f, fac);
const float mfac = 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]); output[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]); output[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]); output[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[3] = inputColor[3];
} }

View File

@@ -49,7 +49,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -54,7 +54,7 @@ void ColorBalanceLGGOperation::initExecution()
this->m_inputColorOperation = this->getInputSocketReader(1); 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 inputColor[4];
float value[4]; float value[4];
@@ -66,10 +66,10 @@ void ColorBalanceLGGOperation::executePixel(float *outputColor, float x, float y
fac = min(1.0f, fac); fac = min(1.0f, fac);
const float mfac = 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]); output[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]); output[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]); output[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[3] = inputColor[3];
} }

View File

@@ -50,7 +50,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -40,7 +40,7 @@ void ColorCorrectionOperation::initExecution()
this->m_inputMask = this->getInputSocketReader(1); 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 inputImageColor[4];
float inputMask[4]; float inputMask[4];

View File

@@ -44,7 +44,7 @@ public:
/** /**
* the inner loop of this program * 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 * 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 *cumap = this->m_curveMapping;
CurveMapping *workingCopy = (CurveMapping *)MEM_dupallocN(cumap); 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); this->m_inputImageProgram->read(image, x, y, sampler);
if (*fac >= 1.0f) if (*fac >= 1.0f)
curvemapping_evaluate_premulRGBF(workingCopy, color, image); curvemapping_evaluate_premulRGBF(workingCopy, output, image);
else if (*fac <= 0.0f) { else if (*fac <= 0.0f) {
copy_v3_v3(color, image); copy_v3_v3(output, image);
} }
else { else {
float col[4], mfac = 1.0f - *fac; float col[4], mfac = 1.0f - *fac;
curvemapping_evaluate_premulRGBF(workingCopy, col, image); curvemapping_evaluate_premulRGBF(workingCopy, col, image);
color[0] = mfac * image[0] + *fac * col[0]; output[0] = mfac * image[0] + *fac * col[0];
color[1] = mfac * image[1] + *fac * col[1]; output[1] = mfac * image[1] + *fac * col[1];
color[2] = mfac * image[2] + *fac * col[2]; output[2] = mfac * image[2] + *fac * col[2];
} }
color[3] = image[3]; output[3] = image[3];
MEM_freeN(workingCopy); MEM_freeN(workingCopy);
} }
@@ -126,7 +126,7 @@ void ConstantLevelColorCurveOperation::initExecution()
curvemapping_set_black_white(this->m_curveMapping, this->m_black, this->m_white); 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 fac[4];
float image[4]; float image[4];
@@ -136,18 +136,18 @@ void ConstantLevelColorCurveOperation::executePixel(float *color, float x, float
this->m_inputImageProgram->read(image, x, y, sampler); this->m_inputImageProgram->read(image, x, y, sampler);
if (*fac >= 1.0f) 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) { else if (*fac <= 0.0f) {
copy_v3_v3(color, image); copy_v3_v3(output, image);
} }
else { else {
float col[4], mfac = 1.0f - *fac; float col[4], mfac = 1.0f - *fac;
curvemapping_evaluate_premulRGBF(this->m_curveMapping, col, image); curvemapping_evaluate_premulRGBF(this->m_curveMapping, col, image);
color[0] = mfac * image[0] + *fac * col[0]; output[0] = mfac * image[0] + *fac * col[0];
color[1] = mfac * image[1] + *fac * col[1]; output[1] = mfac * image[1] + *fac * col[1];
color[2] = mfac * image[2] + *fac * col[2]; output[2] = mfac * image[2] + *fac * col[2];
} }
color[3] = image[3]; output[3] = image[3];
} }
void ConstantLevelColorCurveOperation::deinitExecution() void ConstantLevelColorCurveOperation::deinitExecution()

View File

@@ -41,7 +41,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution
@@ -70,7 +70,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -44,7 +44,7 @@ void ColorMatteOperation::deinitExecution()
this->m_inputKeyProgram = NULL; 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 inColor[4];
float inKey[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) /* 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 */ 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 * 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 initExecution();
void deinitExecution(); void deinitExecution();

View File

@@ -43,12 +43,12 @@ void ColorRampOperation::initExecution()
this->m_inputProgram = this->getInputSocketReader(0); 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]; float values[4];
this->m_inputProgram->read(values, x, y, sampler); 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() void ColorRampOperation::deinitExecution()

View File

@@ -38,7 +38,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -84,7 +84,7 @@ void ColorSpillOperation::deinitExecution()
this->m_inputFacReader = NULL; 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 fac[4];
float input[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 rfac = min(1.0f, fac[0]);
float map = calculateMapValue(rfac, input); float map = calculateMapValue(rfac, input);
if (map > 0.0f) { if (map > 0.0f) {
outputValue[0] = input[0] + this->m_rmut * (this->m_settings->uspillr * map); output[0] = input[0] + this->m_rmut * (this->m_settings->uspillr * map);
outputValue[1] = input[1] + this->m_gmut * (this->m_settings->uspillg * map); output[1] = input[1] + this->m_gmut * (this->m_settings->uspillg * map);
outputValue[2] = input[2] + this->m_bmut * (this->m_settings->uspillb * map); output[2] = input[2] + this->m_bmut * (this->m_settings->uspillb * map);
outputValue[3] = input[3]; output[3] = input[3];
} }
else { else {
copy_v4_v4(outputValue, input); copy_v4_v4(output, input);
} }
} }
float ColorSpillOperation::calculateMapValue(float fac, float *input) float ColorSpillOperation::calculateMapValue(float fac, float *input)

View File

@@ -46,7 +46,7 @@ public:
/** /**
* the inner loop of this program * 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 initExecution();
void deinitExecution(); 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]; float input[4];
/// @todo: remove if statements /// @todo: remove if statements
if (this->m_inputChannel1Operation) { if (this->m_inputChannel1Operation) {
this->m_inputChannel1Operation->read(input, x, y, sampler); this->m_inputChannel1Operation->read(input, x, y, sampler);
color[0] = input[0]; output[0] = input[0];
} }
if (this->m_inputChannel2Operation) { if (this->m_inputChannel2Operation) {
this->m_inputChannel2Operation->read(input, x, y, sampler); this->m_inputChannel2Operation->read(input, x, y, sampler);
color[1] = input[0]; output[1] = input[0];
} }
if (this->m_inputChannel3Operation) { if (this->m_inputChannel3Operation) {
this->m_inputChannel3Operation->read(input, x, y, sampler); this->m_inputChannel3Operation->read(input, x, y, sampler);
color[2] = input[0]; output[2] = input[0];
} }
if (this->m_inputChannel4Operation) { if (this->m_inputChannel4Operation) {
this->m_inputChannel4Operation->read(input, x, y, sampler); 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; SocketReader *m_inputChannel4Operation;
public: public:
CombineChannelsOperation(); 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 initExecution();
void deinitExecution(); void deinitExecution();

View File

@@ -38,11 +38,11 @@ void ConvertColorProfileOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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]; float color[4];
this->m_inputOperation->read(color, x, y, sampler); 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() void ConvertColorProfileOperation::deinitExecution()

View File

@@ -59,7 +59,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -34,11 +34,11 @@ void ConvertColorToBWOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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]; float inputColor[4];
this->m_inputOperation->read(&inputColor[0], x, y, sampler); this->m_inputOperation->read(&inputColor[0], x, y, sampler);
outputValue[0] = rgb_to_bw(inputColor); output[0] = rgb_to_bw(inputColor);
} }
void ConvertColorToBWOperation::deinitExecution() void ConvertColorToBWOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -34,11 +34,11 @@ void ConvertColorToValueProg::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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]; float inputColor[4];
this->m_inputOperation->read(&inputColor[0], x, y, sampler); 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() void ConvertColorToValueProg::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -34,9 +34,9 @@ void ConvertColorToVectorOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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() void ConvertColorToVectorOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/** /**
* the inner loop of this program * 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 * 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 inputValue[4];
float z; float z;
@@ -94,9 +94,11 @@ void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, fl
if (radius > this->m_maxRadius) { if (radius > this->m_maxRadius) {
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() void ConvertDepthToRadiusOperation::deinitExecution()

View File

@@ -54,7 +54,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -35,12 +35,12 @@ void ConvertHSVToRGBOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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]; float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler); this->m_inputOperation->read(inputColor, x, y, sampler);
hsv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]); hsv_to_rgb_v(inputColor, output);
outputValue[3] = inputColor[3]; output[3] = inputColor[3];
} }
void ConvertHSVToRGBOperation::deinitExecution() void ConvertHSVToRGBOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

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

View File

@@ -40,7 +40,7 @@ public:
/** /**
* the inner loop of this program * 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 initExecution();
void deinitExecution(); void deinitExecution();

View File

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

View File

@@ -40,7 +40,7 @@ public:
/** /**
* the inner loop of this program * 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 initExecution();
void deinitExecution(); void deinitExecution();

View File

@@ -35,12 +35,12 @@ void ConvertRGBToHSVOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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]; float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler); this->m_inputOperation->read(inputColor, x, y, sampler);
rgb_to_hsv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]); rgb_to_hsv_v(inputColor, output);
outputValue[3] = inputColor[3]; output[3] = inputColor[3];
} }
void ConvertRGBToHSVOperation::deinitExecution() void ConvertRGBToHSVOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/** /**
* the inner loop of this program * 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 * 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 inputColor[4];
float color[3]; float color[3];
@@ -60,8 +60,8 @@ void ConvertRGBToYCCOperation::executePixel(float *outputValue, float x, float y
/* divided by 255 to normalize for viewing in */ /* divided by 255 to normalize for viewing in */
/* R,G,B --> Y,Cb,Cr */ /* R,G,B --> Y,Cb,Cr */
mul_v3_v3fl(outputValue, color, 1.0f / 255.0f); mul_v3_v3fl(output, color, 1.0f / 255.0f);
outputValue[3] = inputColor[3]; output[3] = inputColor[3];
} }
void ConvertRGBToYCCOperation::deinitExecution() void ConvertRGBToYCCOperation::deinitExecution()

View File

@@ -48,7 +48,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -34,12 +34,12 @@ void ConvertRGBToYUVOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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]; float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler); this->m_inputOperation->read(inputColor, x, y, sampler);
rgb_to_yuv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]); rgb_to_yuv(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2]);
outputValue[3] = inputColor[3]; output[3] = inputColor[3];
} }
void ConvertRGBToYUVOperation::deinitExecution() void ConvertRGBToYUVOperation::deinitExecution()

View File

@@ -43,7 +43,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -33,14 +33,12 @@ void ConvertValueToColorProg::initExecution()
this->m_inputProgram = this->getInputSocketReader(0); 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]; float inputValue[4];
this->m_inputProgram->read(inputValue, x, y, sampler); this->m_inputProgram->read(inputValue, x, y, sampler);
color[0] = inputValue[0]; output[0] = output[1] = output[2] = inputValue[0];
color[1] = inputValue[0]; output[3] = 1.0f;
color[2] = inputValue[0];
color[3] = 1.0f;
} }
void ConvertValueToColorProg::deinitExecution() void ConvertValueToColorProg::deinitExecution()

View File

@@ -37,7 +37,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -34,14 +34,14 @@ void ConvertValueToVectorOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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]; float input[4];
this->m_inputOperation->read(input, x, y, sampler); this->m_inputOperation->read(input, x, y, sampler);
outputValue[0] = input[0]; output[0] = input[0];
outputValue[1] = input[0]; output[1] = input[0];
outputValue[2] = input[0]; output[2] = input[0];
outputValue[3] = 0.0f; output[3] = 0.0f;
} }
void ConvertValueToVectorOperation::deinitExecution() void ConvertValueToVectorOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -34,10 +34,10 @@ void ConvertVectorToColorOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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); this->m_inputOperation->read(output, x, y, sampler);
outputValue[3] = 1.0f; output[3] = 1.0f;
} }
void ConvertVectorToColorOperation::deinitExecution() void ConvertVectorToColorOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -34,11 +34,11 @@ void ConvertVectorToValueOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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]; float input[4];
this->m_inputOperation->read(input, x, y, sampler); 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() void ConvertVectorToValueOperation::deinitExecution()

View File

@@ -44,7 +44,7 @@ public:
/** /**
* the inner loop of this program * 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 * 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]; float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler); 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 */ /* R,G,B --> Y,Cb,Cr */
mul_v3_fl(inputColor, 255.0f); mul_v3_fl(inputColor, 255.0f);
ycc_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2], this->m_mode); ycc_to_rgb(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2], this->m_mode);
outputValue[3] = inputColor[3]; output[3] = inputColor[3];
} }
void ConvertYCCToRGBOperation::deinitExecution() void ConvertYCCToRGBOperation::deinitExecution()

View File

@@ -48,7 +48,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -34,12 +34,12 @@ void ConvertYUVToRGBOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0); 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]; float inputColor[4];
this->m_inputOperation->read(inputColor, x, y, sampler); this->m_inputOperation->read(inputColor, x, y, sampler);
yuv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]); yuv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2]);
outputValue[3] = inputColor[3]; output[3] = inputColor[3];
} }
void ConvertYUVToRGBOperation::deinitExecution() void ConvertYUVToRGBOperation::deinitExecution()

View File

@@ -43,7 +43,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -28,9 +28,9 @@ ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFi
/* pass */ /* 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 x1 = x - 1;
int x2 = x; int x2 = x;
@@ -49,15 +49,6 @@ void ConvolutionEdgeFilterOperation::executePixel(float *color, int x, int y, vo
this->m_inputValueOperation->read(value, x2, y2, NULL); this->m_inputValueOperation->read(value, x2, y2, NULL);
float mval = 1.0f - value[0]; 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); this->m_inputOperation->read(in1, x1, y1, NULL);
madd_v3_v3fl(res1, in1, this->m_filter[0]); madd_v3_v3fl(res1, in1, this->m_filter[0]);
madd_v3_v3fl(res2, 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(res1, in1, this->m_filter[8]);
madd_v3_v3fl(res2, 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]); output[0] = sqrt(res1[0] * res1[0] + res2[0] * res2[0]);
color[1] = sqrt(res1[1] * res1[1] + res2[1] * res2[1]); output[1] = sqrt(res1[1] * res1[1] + res2[1] * res2[1]);
color[2] = sqrt(res1[2] * res1[2] + res2[2] * res2[2]); output[2] = sqrt(res1[2] * res1[2] + res2[2] * res2[2]);
color[0] = color[0] * value[0] + in2[0] * mval; output[0] = output[0] * value[0] + in2[0] * mval;
color[1] = color[1] * value[0] + in2[1] * mval; output[1] = output[1] * value[0] + in2[1] * mval;
color[2] = color[2] * value[0] + in2[2] * 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 { class ConvolutionEdgeFilterOperation : public ConvolutionFilterOperation {
public: public:
ConvolutionEdgeFilterOperation(); ConvolutionEdgeFilterOperation();
void executePixel(float *color, int x, int y, void *data); void executePixel(float output[4], int x, int y, void *data);
}; };
#endif #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 in1[4];
float in2[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); this->m_inputValueOperation->read(value, x2, y2, NULL);
const float mval = 1.0f - value[0]; const float mval = 1.0f - value[0];
zero_v4(color); zero_v4(output);
this->m_inputOperation->read(in1, x1, y1, NULL); 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); 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); 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); 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); 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); 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); 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); 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); 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; output[0] = output[0] * value[0] + in2[0] * mval;
color[1] = color[1] * value[0] + in2[1] * mval; output[1] = output[1] * value[0] + in2[1] * mval;
color[2] = color[2] * value[0] + in2[2] * mval; output[2] = output[2] * value[0] + in2[2] * mval;
color[3] = color[3] * value[0] + in2[3] * mval; output[3] = output[3] * value[0] + in2[3] * mval;
} }
bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)

View File

@@ -39,7 +39,7 @@ public:
ConvolutionFilterOperation(); ConvolutionFilterOperation();
void set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9); 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); 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 initExecution();
void deinitExecution(); void deinitExecution();

View File

@@ -73,13 +73,13 @@ CropOperation::CropOperation() : CropBaseOperation()
/* pass */ /* 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)) { 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 { else {
zero_v4(color); zero_v4(output);
} }
} }
@@ -108,7 +108,7 @@ void CropImageOperation::determineResolution(unsigned int resolution[2], unsigne
resolution[1] = this->m_ymax - this->m_ymin; 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: private:
public: public:
CropOperation(); 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 { class CropImageOperation : public CropBaseOperation {
@@ -57,7 +57,7 @@ public:
CropImageOperation(); CropImageOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
void determineResolution(unsigned int resolution[2], unsigned int preferedResolution[2]); void determineResolution(unsigned int resolution[2], unsigned int preferedResolution[2]);
void executePixel(float *color, float x, float y, PixelSampler sampler); void executePixel(float output[4], float x, float y, PixelSampler sampler);
}; };
#endif #endif

View File

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

View File

@@ -43,7 +43,7 @@ public:
/** /**
* the inner loop of this program * 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 initExecution();
void deinitExecution(); void deinitExecution();

View File

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

View File

@@ -47,7 +47,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution
@@ -83,7 +83,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution
@@ -111,7 +111,7 @@ public:
/** /**
* the inner loop of this program * 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, void executeOpenCL(OpenCLDevice *device,
MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
@@ -135,7 +135,7 @@ public:
/** /**
* the inner loop of this program * 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 * 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); const int iterations = pow(2.0f, this->m_data->iter);
float col[4] = {0, 0, 0, 0}; 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; 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, void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device,

View File

@@ -40,7 +40,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

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

View File

@@ -48,7 +48,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

@@ -53,7 +53,7 @@ void DisplaceSimpleOperation::initExecution()
* in order to take effect */ * in order to take effect */
#define DISPLACE_EPSILON 0.01f #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 inVector[4];
float inScale[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(u, 0.f, this->getWidth() - 1.f);
CLAMP(v, 0.f, this->getHeight() - 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() void DisplaceSimpleOperation::deinitExecution()

View File

@@ -48,7 +48,7 @@ public:
/** /**
* the inner loop of this program * 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 * Initialize the execution

View File

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

View File

@@ -42,7 +42,7 @@ public:
/** /**
* the inner loop of this program * 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 initExecution();
void deinitExecution(); void deinitExecution();

View File

@@ -45,11 +45,11 @@ void DotproductOperation::deinitExecution()
/** @todo: current implementation is the inverse of a dotproduct. not 'logically' correct /** @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 input1[4];
float input2[4]; float input2[4];
this->m_input1Operation->read(input1, x, y, sampler); this->m_input1Operation->read(input1, x, y, sampler);
this->m_input2Operation->read(input2, 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]);
} }

Some files were not shown because too many files have changed in this diff Show More