diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-18 02:55:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-18 02:55:28 +0400 |
commit | 7862b2fa13c0437d9c17eae78e7b79a421dacf05 (patch) | |
tree | 08f9c26af3e71795d0f65803a415b5612d6b53ab /source/blender/compositor/operations | |
parent | 69b95e1a8a00c9ff146d803b8ec11183d7a68908 (diff) |
style cleanup: compositor, pointer syntax, function brace placement, line length
Diffstat (limited to 'source/blender/compositor/operations')
268 files changed, 1886 insertions, 1282 deletions
diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp index 3e80de78223..c891142b808 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp @@ -22,10 +22,12 @@ #include "COM_AlphaOverKeyOperation.h" -AlphaOverKeyOperation::AlphaOverKeyOperation(): MixBaseOperation() { +AlphaOverKeyOperation::AlphaOverKeyOperation(): MixBaseOperation() +{ } -void AlphaOverKeyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void AlphaOverKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputOverColor[4]; float value[4]; @@ -34,25 +36,25 @@ void AlphaOverKeyOperation::executePixel(float* outputValue, float x, float y, P inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers); inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers); - if (inputOverColor[3]<=0.0f) { + if (inputOverColor[3] <= 0.0f) { outputValue[0] = inputColor1[0]; outputValue[1] = inputColor1[1]; outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } - else if (value[0]==1.0f && inputOverColor[3]>=1.0f) { + else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) { outputValue[0] = inputOverColor[0]; outputValue[1] = inputOverColor[1]; outputValue[2] = inputOverColor[2]; outputValue[3] = inputOverColor[3]; } else { - float premul= value[0]*inputOverColor[3]; - float mul= 1.0f - premul; + 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]; + 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]; } } diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h index 5ed99d0dbc6..d3077a05706 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h @@ -39,6 +39,6 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp index 48762e6370e..aedf6ec5e9e 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp @@ -22,11 +22,13 @@ #include "COM_AlphaOverMixedOperation.h" -AlphaOverMixedOperation::AlphaOverMixedOperation(): MixBaseOperation() { +AlphaOverMixedOperation::AlphaOverMixedOperation(): MixBaseOperation() +{ this->x = 0.0f; } -void AlphaOverMixedOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void AlphaOverMixedOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputOverColor[4]; float value[4]; @@ -35,27 +37,27 @@ void AlphaOverMixedOperation::executePixel(float* outputValue, float x, float y, inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers); inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers); - if (inputOverColor[3]<=0.0f) { + if (inputOverColor[3] <= 0.0f) { outputValue[0] = inputColor1[0]; outputValue[1] = inputColor1[1]; outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } - else if (value[0]==1.0f && inputOverColor[3]>=1.0f) { + else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) { outputValue[0] = inputOverColor[0]; outputValue[1] = inputOverColor[1]; outputValue[2] = inputOverColor[2]; outputValue[3] = inputOverColor[3]; } else { - float addfac= 1.0f - this->x + inputOverColor[3]*this->x; - float premul= value[0]*addfac; - float mul= 1.0f - value[0]*inputOverColor[3]; + float addfac = 1.0f - this->x + inputOverColor[3]*this->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]; + 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]; } } diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h index 3ee5f243303..92936a20b79 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h @@ -41,7 +41,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void setX(float x) {this->x = x;} }; diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp index c46f3a04113..6cc33387917 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp @@ -22,10 +22,12 @@ #include "COM_AlphaOverPremultiplyOperation.h" -AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation(): MixBaseOperation() { +AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation(): MixBaseOperation() +{ } -void AlphaOverPremultiplyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void AlphaOverPremultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputOverColor[4]; float value[4]; @@ -41,19 +43,19 @@ void AlphaOverPremultiplyOperation::executePixel(float* outputValue, float x, fl outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } - else if (value[0]==1.0f && inputOverColor[3]>=1.0f) { + else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) { outputValue[0] = inputOverColor[0]; outputValue[1] = inputOverColor[1]; outputValue[2] = inputOverColor[2]; outputValue[3] = inputOverColor[3]; } 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]; - 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]; + 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]; } } diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h index 4fc3b482942..2fe4422d03e 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp index 3d8cd13229f..62639eeb24a 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp @@ -28,19 +28,22 @@ extern "C" { } -AntiAliasOperation::AntiAliasOperation(): NodeOperation() { +AntiAliasOperation::AntiAliasOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->valueReader = NULL; this->buffer = NULL; this->setComplex(true); } -void AntiAliasOperation::initExecution() { +void AntiAliasOperation::initExecution() +{ this->valueReader = this->getInputSocketReader(0); NodeOperation::initMutex(); } -void AntiAliasOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) { +void AntiAliasOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data) +{ if (y < 0 || y >= this->height || x < 0 || x >= this->width) { color[0] = 0.0f; } @@ -51,7 +54,8 @@ void AntiAliasOperation::executePixel(float* color, int x, int y, MemoryBuffer * } -void AntiAliasOperation::deinitExecution() { +void AntiAliasOperation::deinitExecution() +{ this->valueReader = NULL; if (this->buffer) { delete buffer; @@ -59,13 +63,14 @@ void AntiAliasOperation::deinitExecution() { NodeOperation::deinitMutex(); } -bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti imageInput; if (this->buffer) { return false; } else { - NodeOperation* operation = getInputOperation(0); + NodeOperation *operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; imageInput.ymax = operation->getHeight(); @@ -77,16 +82,17 @@ bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe return false; } -void* AntiAliasOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *AntiAliasOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ if (this->buffer) {return buffer;} BLI_mutex_lock(getMutex()); if (this->buffer == NULL) { - MemoryBuffer* tile = (MemoryBuffer*)valueReader->initializeTileData(rect, memoryBuffers); + MemoryBuffer *tile = (MemoryBuffer*)valueReader->initializeTileData(rect, memoryBuffers); int size = tile->getHeight()*tile->getWidth(); float * input = tile->getBuffer(); - char* valuebuffer = new char[size]; + char *valuebuffer = new char[size]; for (int i = 0 ; i < size ; i ++) { - float in = input[i* COM_NUMBER_OF_CHANNELS]; + float in = input[i * COM_NUMBER_OF_CHANNELS]; if (in < 0.0f) { in = 0.0f;} if (in > 1.0f) {in = 1.0f;} valuebuffer[i] = in * 255; diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.h b/source/blender/compositor/operations/COM_AntiAliasOperation.h index 1b8b4c42ff9..fe160763828 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.h +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.h @@ -43,14 +43,14 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data); /** * Initialize the execution */ void initExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); /** * Deinitialize the execution diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp index 8d507a754d5..88fe17f633e 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp @@ -27,7 +27,8 @@ extern "C" { #include "RE_pipeline.h" } -BilateralBlurOperation::BilateralBlurOperation() : NodeOperation() { +BilateralBlurOperation::BilateralBlurOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -37,14 +38,16 @@ BilateralBlurOperation::BilateralBlurOperation() : NodeOperation() { this->inputDeterminatorProgram = NULL; } -void BilateralBlurOperation::initExecution() { +void BilateralBlurOperation::initExecution() +{ this->inputColorProgram = getInputSocketReader(0); this->inputDeterminatorProgram = getInputSocketReader(1); this->space = this->data->sigma_space + this->data->iter; QualityStepHelper::initExecution(COM_QH_INCREASE); } -void BilateralBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void BilateralBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ // read the determinator color at x, y, this will be used as the reference color for the determinator float determinatorReferenceColor[4]; float determinator[4]; @@ -98,12 +101,14 @@ void BilateralBlurOperation::executePixel(float* color, int x, int y, MemoryBuff } } -void BilateralBlurOperation::deinitExecution() { +void BilateralBlurOperation::deinitExecution() +{ this->inputColorProgram = NULL; this->inputDeterminatorProgram = NULL; } -bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; int add = ceil(this->space)+1; diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.h b/source/blender/compositor/operations/COM_BilateralBlurOperation.h index 295797fb0b8..8ec1ba8df99 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.h +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.h @@ -27,9 +27,9 @@ class BilateralBlurOperation : public NodeOperation, public QualityStepHelper { private: - SocketReader* inputColorProgram; - SocketReader* inputDeterminatorProgram; - NodeBilateralBlurData* data; + SocketReader *inputColorProgram; + SocketReader *inputDeterminatorProgram; + NodeBilateralBlurData *data; float space; public: @@ -38,7 +38,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp index 60954503949..6e1a7e2a908 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp @@ -27,7 +27,8 @@ extern "C" { #include "RE_pipeline.h" } -BlurBaseOperation::BlurBaseOperation(): NodeOperation() { +BlurBaseOperation::BlurBaseOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); @@ -37,24 +38,25 @@ BlurBaseOperation::BlurBaseOperation(): NodeOperation() { this->size = 1.0f; this->deleteData = false; } -void BlurBaseOperation::initExecution() { +void BlurBaseOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); this->inputSize = this->getInputSocketReader(1); - this->data->image_in_width= this->getWidth(); - this->data->image_in_height= this->getHeight(); + this->data->image_in_width = this->getWidth(); + this->data->image_in_height = this->getHeight(); if (this->data->relative) { switch (this->data->aspect) { case CMP_NODE_BLUR_ASPECT_NONE: - this->data->sizex= (int)(this->data->percentx*0.01f*this->data->image_in_width); - this->data->sizey= (int)(this->data->percenty*0.01f*this->data->image_in_height); + this->data->sizex = (int)(this->data->percentx*0.01f*this->data->image_in_width); + this->data->sizey = (int)(this->data->percenty*0.01f*this->data->image_in_height); break; case CMP_NODE_BLUR_ASPECT_Y: - this->data->sizex= (int)(this->data->percentx*0.01f*this->data->image_in_width); - this->data->sizey= (int)(this->data->percenty*0.01f*this->data->image_in_width); + this->data->sizex = (int)(this->data->percentx*0.01f*this->data->image_in_width); + this->data->sizey = (int)(this->data->percenty*0.01f*this->data->image_in_width); break; case CMP_NODE_BLUR_ASPECT_X: - this->data->sizex= (int)(this->data->percentx*0.01f*this->data->image_in_height); - this->data->sizey= (int)(this->data->percenty*0.01f*this->data->image_in_height); + this->data->sizex = (int)(this->data->percentx*0.01f*this->data->image_in_height); + this->data->sizey = (int)(this->data->percenty*0.01f*this->data->image_in_height); break; } } @@ -63,7 +65,7 @@ void BlurBaseOperation::initExecution() { } -float* BlurBaseOperation::make_gausstab(int rad) +float *BlurBaseOperation::make_gausstab(int rad) { float *gausstab, sum, val; int i, n; @@ -74,19 +76,20 @@ float* BlurBaseOperation::make_gausstab(int rad) sum = 0.0f; for (i = -rad; i <= rad; i++) { - val= RE_filter_value(this->data->filtertype, (float)i/(float)rad); + val = RE_filter_value(this->data->filtertype, (float)i/(float)rad); sum += val; gausstab[i+rad] = val; } - sum= 1.0f/sum; + sum = 1.0f/sum; for (i=0; i<n; i++) gausstab[i]*= sum; return gausstab; } -void BlurBaseOperation::deinitExecution() { +void BlurBaseOperation::deinitExecution() +{ this->inputProgram = NULL; this->inputSize = NULL; if (this->deleteData) { @@ -95,7 +98,8 @@ void BlurBaseOperation::deinitExecution() { this->data = NULL; } -void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers) { +void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers) +{ float result[4]; this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers); this->size = result[0]; diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h index 3eb36f29865..13e7eb52b77 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h @@ -32,11 +32,11 @@ protected: /** * Cached reference to the inputProgram */ - SocketReader* inputProgram; - SocketReader* inputSize; + SocketReader *inputProgram; + SocketReader *inputSize; NodeBlurData * data; BlurBaseOperation(); - float* make_gausstab(int rad); + float *make_gausstab(int rad); float size; bool deleteData; void updateSize(MemoryBuffer **memoryBuffers); @@ -51,7 +51,7 @@ public: */ void deinitExecution(); - void setData(NodeBlurData* data) {this->data= data;} + void setData(NodeBlurData *data) {this->data = data;} void deleteDataWhenFinished() {this->deleteData = true;} }; diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index 1d5f4852340..1050fc57194 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -27,7 +27,8 @@ extern "C" { #include "RE_pipeline.h" } -BokehBlurOperation::BokehBlurOperation() : NodeOperation() { +BokehBlurOperation::BokehBlurOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addInputSocket(COM_DT_VALUE); @@ -41,12 +42,14 @@ BokehBlurOperation::BokehBlurOperation() : NodeOperation() { this->inputBoundingBoxReader = NULL; } -void* BokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { - void* buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); +void *BokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ + void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); return buffer; } -void BokehBlurOperation::initExecution() { +void BokehBlurOperation::initExecution() +{ this->inputProgram = getInputSocketReader(0); this->inputBokehProgram = getInputSocketReader(1); this->inputBoundingBoxReader = getInputSocketReader(2); @@ -67,7 +70,8 @@ void BokehBlurOperation::initExecution() { QualityStepHelper::initExecution(COM_QH_INCREASE); } -void BokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ float tempColor[4]; float tempBoundingBox[4]; float bokeh[4]; @@ -81,8 +85,8 @@ void BokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer * float overallmultiplyerr = 0; float overallmultiplyerg = 0; float overallmultiplyerb = 0; - MemoryBuffer* inputBuffer = (MemoryBuffer*)data; - float* buffer = inputBuffer->getBuffer(); + MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; int bufferstarty = inputBuffer->getRect()->ymin; @@ -126,13 +130,15 @@ void BokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer * } } -void BokehBlurOperation::deinitExecution() { +void BokehBlurOperation::deinitExecution() +{ this->inputProgram = NULL; this->inputBokehProgram = NULL; this->inputBoundingBoxReader = NULL; } -bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; rcti bokehInput; @@ -141,7 +147,7 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe newInput.ymax = input->ymax + (size*this->getWidth()); newInput.ymin = input->ymin - (size*this->getWidth()); - NodeOperation* operation = getInputOperation(1); + NodeOperation *operation = getInputOperation(1); bokehInput.xmax = operation->getWidth(); bokehInput.xmin = 0; bokehInput.ymax = operation->getHeight(); diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.h b/source/blender/compositor/operations/COM_BokehBlurOperation.h index c782c421966..ce14faa8596 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.h @@ -27,9 +27,9 @@ class BokehBlurOperation : public NodeOperation, public QualityStepHelper { private: - SocketReader* inputProgram; - SocketReader* inputBokehProgram; - SocketReader* inputBoundingBoxReader; + SocketReader *inputProgram; + SocketReader *inputBokehProgram; + SocketReader *inputBoundingBoxReader; float size; float bokehMidX; float bokehMidY; @@ -37,11 +37,11 @@ private: public: BokehBlurOperation(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp index 22b73417778..4bc738052f6 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp @@ -23,11 +23,13 @@ #include "COM_BokehImageOperation.h" #include "BLI_math.h" -BokehImageOperation::BokehImageOperation(): NodeOperation() { +BokehImageOperation::BokehImageOperation(): NodeOperation() +{ this->addOutputSocket(COM_DT_COLOR); this->deleteData = false; } -void BokehImageOperation::initExecution() { +void BokehImageOperation::initExecution() +{ this->centerX = getWidth() / 2; this->centerY = getHeight() / 2; this->center[0] = this->centerX; @@ -40,11 +42,13 @@ void BokehImageOperation::initExecution() { this->flapRadAdd-=M_PI*2; } } -void BokehImageOperation::detemineStartPointOfFlap(float r[2], int flapNumber, float distance) { +void BokehImageOperation::detemineStartPointOfFlap(float r[2], int flapNumber, float distance) +{ r[0] = sin(flapRad*flapNumber + flapRadAdd)*distance+centerX; r[1] = cos(flapRad*flapNumber + flapRadAdd)*distance+centerY; } -float BokehImageOperation::isInsideBokeh(float distance, float x, float y) { +float BokehImageOperation::isInsideBokeh(float distance, float x, float y) +{ float insideBokeh = 0.0; const float deltaX = x - centerX; const float deltaY = y - centerY; @@ -80,7 +84,8 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y) { } return insideBokeh; } -void BokehImageOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void BokehImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float shift = this->data->lensshift; float shift2 = shift/2.0f; float distance = this->circularDistance; @@ -100,7 +105,8 @@ void BokehImageOperation::executePixel(float* color, float x, float y, PixelSamp color[3] = 1.0f; } -void BokehImageOperation::deinitExecution() { +void BokehImageOperation::deinitExecution() +{ if (deleteData) { if (data) { delete data; @@ -109,7 +115,8 @@ void BokehImageOperation::deinitExecution() { } } -void BokehImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void BokehImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ resolution[0] = 512; resolution[1] = 512; } diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h index 3089ca6f12e..516cc1da4f0 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.h +++ b/source/blender/compositor/operations/COM_BokehImageOperation.h @@ -47,7 +47,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp index 5b769fef3ef..0244be4cad3 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp @@ -24,7 +24,8 @@ #include "BLI_math.h" #include "DNA_node_types.h" -BoxMaskOperation::BoxMaskOperation(): NodeOperation() { +BoxMaskOperation::BoxMaskOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -33,7 +34,8 @@ BoxMaskOperation::BoxMaskOperation(): NodeOperation() { this->cosine = 0.0f; this->sine = 0.0f; } -void BoxMaskOperation::initExecution() { +void BoxMaskOperation::initExecution() +{ this->inputMask = this->getInputSocketReader(0); this->inputValue = this->getInputSocketReader(1); const double rad = DEG2RAD(this->data->rotation); @@ -42,7 +44,8 @@ void BoxMaskOperation::initExecution() { this->aspectRatio = ((float)this->getWidth())/this->getHeight(); } -void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputMask[4]; float inputValue[4]; @@ -108,7 +111,8 @@ void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler } -void BoxMaskOperation::deinitExecution() { +void BoxMaskOperation::deinitExecution() +{ this->inputMask = NULL; this->inputValue = NULL; } diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.h b/source/blender/compositor/operations/COM_BoxMaskOperation.h index 3436eec8b4c..c3af95578d4 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.h +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.h @@ -45,7 +45,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp index a62470e5b1d..a4396a43cf7 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp +++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp @@ -22,20 +22,23 @@ #include "COM_BrightnessOperation.h" -BrightnessOperation::BrightnessOperation(): NodeOperation() { +BrightnessOperation::BrightnessOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->inputProgram = NULL; } -void BrightnessOperation::initExecution() { +void BrightnessOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); this->inputBrightnessProgram = this->getInputSocketReader(1); this->inputContrastProgram = this->getInputSocketReader(2); } -void BrightnessOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void BrightnessOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue[4]; float a, b; float inputBrightness[4]; @@ -68,7 +71,8 @@ void BrightnessOperation::executePixel(float* color, float x, float y, PixelSamp color[3] = inputValue[3]; } -void BrightnessOperation::deinitExecution() { +void BrightnessOperation::deinitExecution() +{ this->inputProgram = NULL; this->inputBrightnessProgram = NULL; this->inputContrastProgram = NULL; diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.h b/source/blender/compositor/operations/COM_BrightnessOperation.h index 60666098bc1..0c718a8b131 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.h +++ b/source/blender/compositor/operations/COM_BrightnessOperation.h @@ -30,9 +30,9 @@ private: /** * Cached reference to the inputProgram */ - SocketReader * inputProgram; - SocketReader * inputBrightnessProgram; - SocketReader* inputContrastProgram; + SocketReader *inputProgram; + SocketReader *inputBrightnessProgram; + SocketReader *inputContrastProgram; public: BrightnessOperation(); @@ -40,7 +40,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp index 7a1fc5e511c..a3438cea27b 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp @@ -26,7 +26,8 @@ -CalculateMeanOperation::CalculateMeanOperation(): NodeOperation() { +CalculateMeanOperation::CalculateMeanOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_VALUE); this->imageReader = NULL; @@ -34,27 +35,31 @@ CalculateMeanOperation::CalculateMeanOperation(): NodeOperation() { this->setting = 1; this->setComplex(true); } -void CalculateMeanOperation::initExecution() { +void CalculateMeanOperation::initExecution() +{ this->imageReader = this->getInputSocketReader(0); this->iscalculated = false; NodeOperation::initMutex(); } -void CalculateMeanOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) { +void CalculateMeanOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data) +{ color[0] = this->result; } -void CalculateMeanOperation::deinitExecution() { +void CalculateMeanOperation::deinitExecution() +{ this->imageReader = NULL; NodeOperation::deinitMutex(); } -bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti imageInput; if (iscalculated) { return false; } - NodeOperation* operation = getInputOperation(0); + NodeOperation *operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; imageInput.ymax = operation->getHeight(); @@ -65,10 +70,11 @@ bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti *input, ReadB return false; } -void* CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ BLI_mutex_lock(getMutex()); if (!this->iscalculated) { - MemoryBuffer* tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers); + MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers); calculateMean(tile); this->iscalculated = true; } @@ -76,9 +82,10 @@ void* CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memo return NULL; } -void CalculateMeanOperation::calculateMean(MemoryBuffer * tile) { +void CalculateMeanOperation::calculateMean(MemoryBuffer * tile) +{ this->result = 0.0f; - float* buffer = tile->getBuffer(); + float *buffer = tile->getBuffer(); int size = tile->getWidth()*tile->getHeight(); int pixels = 0; float sum; diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.h b/source/blender/compositor/operations/COM_CalculateMeanOperation.h index e77b864c5c8..b21743aa8bc 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.h +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.h @@ -46,14 +46,14 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data); /** * Initialize the execution */ void initExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); /** * Deinitialize the execution @@ -64,6 +64,6 @@ public: void setSetting(int setting) {this->setting = setting;} protected: - void calculateMean(MemoryBuffer* tile); + void calculateMean(MemoryBuffer *tile); }; #endif diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp index 9d9dc46eb6c..651c6674fdb 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp @@ -26,20 +26,23 @@ -CalculateStandardDeviationOperation::CalculateStandardDeviationOperation(): CalculateMeanOperation() { +CalculateStandardDeviationOperation::CalculateStandardDeviationOperation(): CalculateMeanOperation() +{ } -void CalculateStandardDeviationOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) { +void CalculateStandardDeviationOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data) +{ color[0] = this->standardDeviation; } -void* CalculateStandardDeviationOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ BLI_mutex_lock(getMutex()); if (!this->iscalculated) { - MemoryBuffer* tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers); + MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers); CalculateMeanOperation::calculateMean(tile); this->standardDeviation = 0.0f; - float* buffer = tile->getBuffer(); + float *buffer = tile->getBuffer(); int size = tile->getWidth()*tile->getHeight(); int pixels = 0; float sum; diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h index 9da8823acd1..05c94401c86 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h @@ -39,9 +39,9 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); }; #endif diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp index da59524586c..9b7f87e38bc 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp @@ -22,21 +22,25 @@ #include "COM_ChangeHSVOperation.h" -ChangeHSVOperation::ChangeHSVOperation(): NodeOperation() { +ChangeHSVOperation::ChangeHSVOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; } -void ChangeHSVOperation::initExecution() { +void ChangeHSVOperation::initExecution() +{ this->inputOperation = getInputSocketReader(0); } -void ChangeHSVOperation::deinitExecution() { +void ChangeHSVOperation::deinitExecution() +{ this->inputOperation = NULL; } -void ChangeHSVOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ChangeHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; inputOperation->read(inputColor1, x, y, sampler, inputBuffers); diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h index 8adae8e8ce7..a89487f9d7b 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h @@ -49,7 +49,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void setHue(float hue) {this->hue = hue;} void setSaturation(float saturation) {this->saturation = saturation;} diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp index 10ff140f8be..70bfc8f8cfa 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp @@ -22,14 +22,16 @@ #include "COM_ChannelMatteOperation.h" #include "BLI_math.h" -ChannelMatteOperation::ChannelMatteOperation(): NodeOperation() { +ChannelMatteOperation::ChannelMatteOperation(): NodeOperation() +{ addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); inputImageProgram = NULL; } -void ChannelMatteOperation::initExecution() { +void ChannelMatteOperation::initExecution() +{ this->inputImageProgram = this->getInputSocketReader(0); this->limit_range = this->limit_max - this->limit_min; @@ -76,11 +78,13 @@ void ChannelMatteOperation::initExecution() { } } -void ChannelMatteOperation::deinitExecution() { - this->inputImageProgram= NULL; +void ChannelMatteOperation::deinitExecution() +{ + this->inputImageProgram = NULL; } -void ChannelMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inColor[4]; float alpha; diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.h b/source/blender/compositor/operations/COM_ChannelMatteOperation.h index 33e502fe565..a4b5f454f92 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.h @@ -59,12 +59,12 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); - void setSettings(NodeChroma* nodeChroma, const int custom2) + void setSettings(NodeChroma *nodeChroma, const int custom2) { this->limit_max = nodeChroma->t1; this->limit_min = nodeChroma->t2; diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp index 9556b673c0f..e082ffed2b6 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp @@ -22,7 +22,8 @@ #include "COM_ChromaMatteOperation.h" #include "BLI_math.h" -ChromaMatteOperation::ChromaMatteOperation(): NodeOperation() { +ChromaMatteOperation::ChromaMatteOperation(): NodeOperation() +{ addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); @@ -31,17 +32,20 @@ ChromaMatteOperation::ChromaMatteOperation(): NodeOperation() { inputKeyProgram = NULL; } -void ChromaMatteOperation::initExecution() { +void ChromaMatteOperation::initExecution() +{ this->inputImageProgram = this->getInputSocketReader(0); this->inputKeyProgram = this->getInputSocketReader(1); } -void ChromaMatteOperation::deinitExecution() { - this->inputImageProgram= NULL; - this->inputKeyProgram= NULL; +void ChromaMatteOperation::deinitExecution() +{ + this->inputImageProgram = NULL; + this->inputKeyProgram = NULL; } -void ChromaMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inKey[4]; float inImage[4]; @@ -70,7 +74,7 @@ void ChromaMatteOperation::executePixel(float* outputValue, float x, float y, Pi /*if within the acceptance angle */ /* if kfg is <0 then the pixel is outside of the key color */ - kfg= x_angle-(fabsf(z_angle)/tanf(acceptance/2.f)); + kfg = x_angle-(fabsf(z_angle)/tanf(acceptance/2.f)); if (kfg>0.f) { /* found a pixel that is within key color */ alpha=(1.f-kfg)*(gain); diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.h b/source/blender/compositor/operations/COM_ChromaMatteOperation.h index 21f0f4b4fe6..9c5a5ff997b 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.h @@ -42,11 +42,11 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); - void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;} + void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;} }; #endif diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp index 317d84b0299..cc535cd95df 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp @@ -33,7 +33,8 @@ inline float colorbalance_cdl(float in, float offset, float power, float slope) return powf(x, power); } -ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation(): NodeOperation() { +ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -42,12 +43,14 @@ ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation(): NodeOperation() { this->setResolutionInputSocketIndex(1); } -void ColorBalanceASCCDLOperation::initExecution() { +void ColorBalanceASCCDLOperation::initExecution() +{ this->inputValueOperation = this->getInputSocketReader(0); this->inputColorOperation = this->getInputSocketReader(1); } -void ColorBalanceASCCDLOperation::executePixel(float* outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ColorBalanceASCCDLOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; float value[4]; @@ -56,7 +59,7 @@ void ColorBalanceASCCDLOperation::executePixel(float* outputColor, float x, floa float fac = value[0]; 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->lift[0], this->gamma[0], this->gain[0]); outputColor[1] = mfac*inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->lift[1], this->gamma[1], this->gain[1]); @@ -65,7 +68,8 @@ void ColorBalanceASCCDLOperation::executePixel(float* outputColor, float x, floa } -void ColorBalanceASCCDLOperation::deinitExecution() { +void ColorBalanceASCCDLOperation::deinitExecution() +{ this->inputValueOperation = NULL; this->inputColorOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h index a7e9680c98d..fb973e75c15 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h @@ -50,7 +50,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp index b853c28136f..82958a7086e 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp @@ -30,7 +30,7 @@ inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float g * but best keep it this way, sice testing for durian shows a similar calculation * without lin/srgb conversions gives bad results (over-saturated shadows) with colors * slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */ - float x= (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain; + float x = (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain; /* prevent NaN */ if (x < 0.f) x = 0.f; @@ -38,7 +38,8 @@ inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float g return powf(srgb_to_linearrgb(x), gamma_inv); } -ColorBalanceLGGOperation::ColorBalanceLGGOperation(): NodeOperation() { +ColorBalanceLGGOperation::ColorBalanceLGGOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -47,12 +48,14 @@ ColorBalanceLGGOperation::ColorBalanceLGGOperation(): NodeOperation() { this->setResolutionInputSocketIndex(1); } -void ColorBalanceLGGOperation::initExecution() { +void ColorBalanceLGGOperation::initExecution() +{ this->inputValueOperation = this->getInputSocketReader(0); this->inputColorOperation = this->getInputSocketReader(1); } -void ColorBalanceLGGOperation::executePixel(float* outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ColorBalanceLGGOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; float value[4]; @@ -61,7 +64,7 @@ void ColorBalanceLGGOperation::executePixel(float* outputColor, float x, float y float fac = value[0]; 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->lift[0], this->gamma_inv[0], this->gain[0]); outputColor[1] = mfac*inputColor[1] + fac * colorbalance_lgg(inputColor[1], this->lift[1], this->gamma_inv[1], this->gain[1]); @@ -70,7 +73,8 @@ void ColorBalanceLGGOperation::executePixel(float* outputColor, float x, float y } -void ColorBalanceLGGOperation::deinitExecution() { +void ColorBalanceLGGOperation::deinitExecution() +{ this->inputValueOperation = NULL; this->inputColorOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h index ebaabfeb736..e0df76cf2c5 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h @@ -50,7 +50,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp index fb617549b1c..0a257b22ab8 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp @@ -23,7 +23,8 @@ #include "COM_ColorCorrectionOperation.h" #include "BLI_math.h" -ColorCorrectionOperation::ColorCorrectionOperation(): NodeOperation() { +ColorCorrectionOperation::ColorCorrectionOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); @@ -33,19 +34,21 @@ ColorCorrectionOperation::ColorCorrectionOperation(): NodeOperation() { this->greenChannelEnabled = true; this->blueChannelEnabled = true; } -void ColorCorrectionOperation::initExecution() { +void ColorCorrectionOperation::initExecution() +{ this->inputImage = this->getInputSocketReader(0); this->inputMask = this->getInputSocketReader(1); } -void ColorCorrectionOperation::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ColorCorrectionOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputImageColor[4]; float inputMask[4]; this->inputImage->read(inputImageColor, x, y, sampler, inputBuffers); this->inputMask->read(inputMask, x, y, sampler, inputBuffers); float level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2])/3.0f; - float contrast= this->data->master.contrast; + float contrast = this->data->master.contrast; float saturation = this->data->master.saturation; float gamma = this->data->master.gamma; float gain = this->data->master.gain; @@ -54,7 +57,7 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix float value = inputMask[0]; value = min(1.0f, value); - const float mvalue= 1.0f - value; + const float mvalue = 1.0f - value; float levelShadows = 0.0; float levelMidtones = 0.0; @@ -66,14 +69,14 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix } else if (level < this->data->startmidtones+MARGIN) { levelMidtones = ((level-this->data->startmidtones)*MARGIN_DIV)+0.5; - levelShadows = 1.0- levelMidtones; + levelShadows = 1.0 - levelMidtones; } else if (level < this->data->endmidtones-MARGIN) { levelMidtones = 1.0f; } else if (level < this->data->endmidtones+MARGIN) { levelHighlights = ((level-this->data->endmidtones)*MARGIN_DIV)+0.5; - levelMidtones = 1.0- levelHighlights; + levelMidtones = 1.0 - levelHighlights; } else { levelHighlights = 1.0f; @@ -134,7 +137,8 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix output[3] = inputImageColor[3]; } -void ColorCorrectionOperation::deinitExecution() { +void ColorCorrectionOperation::deinitExecution() +{ this->inputImage = NULL; this->inputMask = NULL; } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h index 9a3eefe30c6..89107150ebd 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h @@ -30,8 +30,8 @@ private: /** * Cached reference to the inputProgram */ - SocketReader * inputImage; - SocketReader* inputMask; + SocketReader *inputImage; + SocketReader *inputMask; NodeColorCorrection *data; bool redChannelEnabled; @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index 375d7269124..8aee54013b1 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -30,7 +30,8 @@ extern "C" { } #endif -ColorCurveOperation::ColorCurveOperation(): CurveBaseOperation() { +ColorCurveOperation::ColorCurveOperation(): CurveBaseOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR); @@ -44,7 +45,8 @@ ColorCurveOperation::ColorCurveOperation(): CurveBaseOperation() { this->setResolutionInputSocketIndex(1); } -void ColorCurveOperation::initExecution() { +void ColorCurveOperation::initExecution() +{ CurveBaseOperation::initExecution(); this->inputFacProgram = this->getInputSocketReader(0); this->inputImageProgram = this->getInputSocketReader(1); @@ -55,7 +57,8 @@ void ColorCurveOperation::initExecution() { } -void ColorCurveOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float black[4]; float white[4]; float fac[4]; @@ -69,24 +72,25 @@ void ColorCurveOperation::executePixel(float* color, float x, float y, PixelSamp this->inputFacProgram->read(fac, x, y, sampler, inputBuffers); this->inputImageProgram->read(image, x, y, sampler, inputBuffers); - if (fac[0]>=1.0) + if (fac[0] >= 1.0) curvemapping_evaluate_premulRGBF(this->curveMapping, color, image); else if (*fac<=0.0) { - color[0]= image[0]; - color[1]= image[1]; - color[2]= image[2]; + color[0] = image[0]; + color[1] = image[1]; + color[2] = image[2]; } else { - float col[4], mfac= 1.0f-*fac; + float col[4], mfac = 1.0f-*fac; curvemapping_evaluate_premulRGBF(this->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]; + color[0] = mfac*image[0] + *fac*col[0]; + color[1] = mfac*image[1] + *fac*col[1]; + color[2] = mfac*image[2] + *fac*col[2]; } - color[3]= image[3]; + color[3] = image[3]; } -void ColorCurveOperation::deinitExecution() { +void ColorCurveOperation::deinitExecution() +{ this->inputFacProgram = NULL; this->inputImageProgram = NULL; this->inputBlackProgram = NULL; diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.h b/source/blender/compositor/operations/COM_ColorCurveOperation.h index 986f6fcfcc2..15f9fd25e81 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.h +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.h @@ -41,7 +41,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp index 6e9c1b0d48a..7706559be00 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp @@ -22,7 +22,8 @@ #include "COM_ColorMatteOperation.h" #include "BLI_math.h" -ColorMatteOperation::ColorMatteOperation(): NodeOperation() { +ColorMatteOperation::ColorMatteOperation(): NodeOperation() +{ addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); @@ -31,23 +32,26 @@ ColorMatteOperation::ColorMatteOperation(): NodeOperation() { inputKeyProgram = NULL; } -void ColorMatteOperation::initExecution() { +void ColorMatteOperation::initExecution() +{ this->inputImageProgram = this->getInputSocketReader(0); this->inputKeyProgram = this->getInputSocketReader(1); } -void ColorMatteOperation::deinitExecution() { - this->inputImageProgram= NULL; - this->inputKeyProgram= NULL; +void ColorMatteOperation::deinitExecution() +{ + this->inputImageProgram = NULL; + this->inputKeyProgram = NULL; } -void ColorMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ColorMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inColor[4]; float inKey[4]; - const float hue=this->settings->t1; - const float sat=this->settings->t2; - const float val=this->settings->t3; + const float hue = this->settings->t1; + const float sat = this->settings->t2; + const float val = this->settings->t3; float h_wrap; @@ -62,19 +66,19 @@ void ColorMatteOperation::executePixel(float* outputValue, float x, float y, Pix if ( /* do hue last because it needs to wrap, and does some more checks */ - /* sat */ (fabsf(inColor[1]-inKey[1]) < sat) && - /* val */ (fabsf(inColor[2]-inKey[2]) < val) && + /* sat */ (fabsf(inColor[1] - inKey[1]) < sat) && + /* val */ (fabsf(inColor[2] - inKey[2]) < val) && /* multiply by 2 because it wraps on both sides of the hue, * otherwise 0.5 would key all hue's */ - /* 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.f; /*make transparent*/ + outputValue[0] = 0.0f; /*make transparent*/ } else { /*pixel is outside key color */ - outputValue[0]=inColor[3]; /* make pixel just as transparent as it was before */ + outputValue[0] = inColor[3]; /* make pixel just as transparent as it was before */ } } diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.h b/source/blender/compositor/operations/COM_ColorMatteOperation.h index 954a5bbb3e8..904a51128c8 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.h +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.h @@ -42,11 +42,11 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); - void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;} + void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;} }; #endif diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.cpp b/source/blender/compositor/operations/COM_ColorRampOperation.cpp index a7cfb30b439..992bf3b9d1d 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorRampOperation.cpp @@ -30,24 +30,28 @@ extern "C" { } #endif -ColorRampOperation::ColorRampOperation(): NodeOperation() { +ColorRampOperation::ColorRampOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->inputProgram = NULL; this->colorBand = NULL; } -void ColorRampOperation::initExecution() { +void ColorRampOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); } -void ColorRampOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ColorRampOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float values[4]; this->inputProgram->read(values, x, y, sampler, inputBuffers); do_colorband(this->colorBand, values[0], color); } -void ColorRampOperation::deinitExecution() { +void ColorRampOperation::deinitExecution() +{ this->inputProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.h b/source/blender/compositor/operations/COM_ColorRampOperation.h index 08a6c26a8bf..8b8635cc5cd 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.h +++ b/source/blender/compositor/operations/COM_ColorRampOperation.h @@ -31,14 +31,14 @@ private: * Cached reference to the inputProgram */ SocketReader * inputProgram; - ColorBand* colorBand; + ColorBand *colorBand; public: ColorRampOperation(); /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution @@ -50,7 +50,7 @@ public: */ void deinitExecution(); - void setColorBand(ColorBand* colorBand) {this->colorBand = colorBand;} + void setColorBand(ColorBand *colorBand) {this->colorBand = colorBand;} }; diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp index 56f45c0fdeb..56141efe681 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp @@ -24,7 +24,8 @@ #include "BLI_math.h" #define avg(a,b) ((a+b)/2) -ColorSpillOperation::ColorSpillOperation(): NodeOperation() { +ColorSpillOperation::ColorSpillOperation(): NodeOperation() +{ addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_VALUE); addOutputSocket(COM_DT_COLOR); @@ -34,7 +35,8 @@ ColorSpillOperation::ColorSpillOperation(): NodeOperation() { this->spillChannel = 1; // GREEN } -void ColorSpillOperation::initExecution() { +void ColorSpillOperation::initExecution() +{ this->inputImageReader = this->getInputSocketReader(0); this->inputFacReader = this->getInputSocketReader(1); if (spillChannel == 0) { @@ -76,12 +78,14 @@ void ColorSpillOperation::initExecution() { } } -void ColorSpillOperation::deinitExecution() { - this->inputImageReader= NULL; +void ColorSpillOperation::deinitExecution() +{ + this->inputImageReader = NULL; this->inputFacReader = NULL; } -void ColorSpillOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ColorSpillOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float fac[4]; float input[4]; float map; @@ -102,11 +106,13 @@ void ColorSpillOperation::executePixel(float* outputValue, float x, float y, Pix outputValue[3]=input[3]; } } -float ColorSpillOperation::calculateMapValue(float fac, float *input) { +float ColorSpillOperation::calculateMapValue(float fac, float *input) +{ return fac * (input[this->spillChannel]-(this->settings->limscale*input[settings->limchan])); } -float ColorSpillAverageOperation::calculateMapValue(float fac, float *input) { +float ColorSpillAverageOperation::calculateMapValue(float fac, float *input) +{ return fac * (input[this->spillChannel]-(this->settings->limscale*avg(input[this->channel2], input[this->channel3]))); } diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.h b/source/blender/compositor/operations/COM_ColorSpillOperation.h index 963eaae3076..69f51882496 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.h +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.h @@ -46,12 +46,12 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); - void setSettings(NodeColorspill* nodeColorSpill) {this->settings= nodeColorSpill;} + void setSettings(NodeColorspill *nodeColorSpill) {this->settings = nodeColorSpill;} void setSpillChannel(int channel) {this->spillChannel = channel;} float calculateMapValue(float fac, float *input); diff --git a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp b/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp index efeac9db410..6b64934f0b8 100644 --- a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp +++ b/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp @@ -23,7 +23,8 @@ #include "COM_CombineChannelsOperation.h" #include <stdio.h> -CombineChannelsOperation::CombineChannelsOperation() : NodeOperation() { +CombineChannelsOperation::CombineChannelsOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); @@ -35,14 +36,16 @@ CombineChannelsOperation::CombineChannelsOperation() : NodeOperation() { this->inputChannel3Operation = NULL; this->inputChannel4Operation = NULL; } -void CombineChannelsOperation::initExecution() { +void CombineChannelsOperation::initExecution() +{ this->inputChannel1Operation = this->getInputSocketReader(0); this->inputChannel2Operation = this->getInputSocketReader(1); this->inputChannel3Operation = this->getInputSocketReader(2); this->inputChannel4Operation = this->getInputSocketReader(3); } -void CombineChannelsOperation::deinitExecution() { +void CombineChannelsOperation::deinitExecution() +{ this->inputChannel1Operation = NULL; this->inputChannel2Operation = NULL; this->inputChannel3Operation = NULL; @@ -50,7 +53,8 @@ void CombineChannelsOperation::deinitExecution() { } -void CombineChannelsOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void CombineChannelsOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float input[4]; /// @todo: remove if statements if (this->inputChannel1Operation) { diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 6391fa2537d..ce9484d0d9f 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -36,7 +36,8 @@ extern "C" { #include "PIL_time.h" -CompositorOperation::CompositorOperation() : NodeOperation() { +CompositorOperation::CompositorOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); @@ -46,7 +47,8 @@ CompositorOperation::CompositorOperation() : NodeOperation() { this->alphaInput = NULL; } -void CompositorOperation::initExecution() { +void CompositorOperation::initExecution() +{ // When initializing the tree during initial load the width and height can be zero. this->imageInput = getInputSocketReader(0); this->alphaInput = getInputSocketReader(1); @@ -54,13 +56,13 @@ void CompositorOperation::initExecution() { this->outputBuffer=(float*) MEM_callocN(this->getWidth()*this->getHeight()*4*sizeof(float), "CompositorOperation"); } const Scene * scene = this->scene; - Render* re= RE_GetRender(scene->id.name); - RenderResult *rr= RE_AcquireResultWrite(re); + Render *re = RE_GetRender(scene->id.name); + RenderResult *rr = RE_AcquireResultWrite(re); if (rr) { if (rr->rectf != NULL) { MEM_freeN(rr->rectf); } - rr->rectf= outputBuffer; + rr->rectf = outputBuffer; } if (re) { RE_ReleaseResult(re); @@ -69,16 +71,18 @@ void CompositorOperation::initExecution() { } -void CompositorOperation::deinitExecution() { +void CompositorOperation::deinitExecution() +{ this->outputBuffer = NULL; this->imageInput = NULL; this->alphaInput = NULL; } -void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) { +void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) +{ float color[8]; // 7 is enough - float* buffer = this->outputBuffer; + float *buffer = this->outputBuffer; if (!buffer) return; int x1 = rect->xmin; @@ -109,9 +113,10 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, Mem } } -void CompositorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void CompositorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ int width = this->scene->r.xsch*this->scene->r.size/100; - int height= this->scene->r.ysch*this->scene->r.size/100; + int height = this->scene->r.ysch*this->scene->r.size/100; preferredResolution[0] = width; preferredResolution[1] = height; diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h index 6f71fdff7b4..39c81b8292a 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.h +++ b/source/blender/compositor/operations/COM_CompositorOperation.h @@ -34,12 +34,12 @@ private: /** * @brief local reference to the scene */ - const Scene* scene; + const Scene *scene; /** * @brief local reference to the node tree */ - const bNodeTree* tree; + const bNodeTree *tree; /** * @brief reference to the output float buffer @@ -49,17 +49,17 @@ private: /** * @brief local reference to the input image operation */ - SocketReader* imageInput; + SocketReader *imageInput; /** * @brief local reference to the input alpha operation */ - SocketReader* alphaInput; + SocketReader *alphaInput; public: CompositorOperation(); void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers); - void setScene(const Scene* scene) {this->scene = scene;} - void setbNodeTree(const bNodeTree* tree) {this->tree= tree;} + void setScene(const Scene *scene) {this->scene = scene;} + void setbNodeTree(const bNodeTree *tree) {this->tree = tree;} bool isOutputOperation(bool rendering) const {return rendering;} void initExecution(); void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp index 3267994feea..df12a7d6b49 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp @@ -25,23 +25,27 @@ extern "C" { #include "IMB_imbuf.h" } -ConvertColorProfileOperation::ConvertColorProfileOperation(): NodeOperation() { +ConvertColorProfileOperation::ConvertColorProfileOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; this->predivided = false; } -void ConvertColorProfileOperation::initExecution() { +void ConvertColorProfileOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertColorProfileOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertColorProfileOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float color[4]; inputOperation->read(color, x, y, sampler, inputBuffers); IMB_buffer_float_from_float(outputValue, color, 4, this->toProfile, this->fromProfile, this->predivided, 1, 1, 0, 0); } -void ConvertColorProfileOperation::deinitExecution() { +void ConvertColorProfileOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h index 9781795b952..1868de6d815 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h @@ -59,7 +59,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp index 8c48c5c0d14..4421dec319a 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp @@ -22,22 +22,26 @@ #include "COM_ConvertColorToBWOperation.h" -ConvertColorToBWOperation::ConvertColorToBWOperation(): NodeOperation() { +ConvertColorToBWOperation::ConvertColorToBWOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VALUE); this->inputOperation = NULL; } -void ConvertColorToBWOperation::initExecution() { +void ConvertColorToBWOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertColorToBWOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertColorToBWOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers); outputValue[0] = (inputColor[0]*0.35f + inputColor[1]*0.45f + inputColor[2]*0.2f)*inputColor[3]; } -void ConvertColorToBWOperation::deinitExecution() { +void ConvertColorToBWOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h index 82d71453e1e..616cf0f2d01 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp index af86f3ea5e8..ce45266ace0 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp @@ -22,20 +22,24 @@ #include "COM_ConvertColorToVectorOperation.h" -ConvertColorToVectorOperation::ConvertColorToVectorOperation(): NodeOperation() { +ConvertColorToVectorOperation::ConvertColorToVectorOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VECTOR); this->inputOperation = NULL; } -void ConvertColorToVectorOperation::initExecution() { +void ConvertColorToVectorOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertColorToVectorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertColorToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ inputOperation->read(outputValue, x, y, sampler, inputBuffers); } -void ConvertColorToVectorOperation::deinitExecution() { +void ConvertColorToVectorOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h index de7315da02f..11a1bf30a07 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp b/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp index caf41419668..84a33f652cd 100644 --- a/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp +++ b/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp @@ -22,22 +22,26 @@ #include "COM_ConvertColourToValueProg.h" -ConvertColourToValueProg::ConvertColourToValueProg(): NodeOperation() { +ConvertColourToValueProg::ConvertColourToValueProg(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VALUE); this->inputOperation = NULL; } -void ConvertColourToValueProg::initExecution() { +void ConvertColourToValueProg::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertColourToValueProg::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertColourToValueProg::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers); outputValue[0] = ((inputColor[0] + inputColor[1] + inputColor[2])/3.0f)*inputColor[3]; } -void ConvertColourToValueProg::deinitExecution() { +void ConvertColourToValueProg::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertColourToValueProg.h b/source/blender/compositor/operations/COM_ConvertColourToValueProg.h index 73e71b5665a..7aa07dd46f2 100644 --- a/source/blender/compositor/operations/COM_ConvertColourToValueProg.h +++ b/source/blender/compositor/operations/COM_ConvertColourToValueProg.h @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp index e262533b2f7..f64f0c054b1 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp @@ -24,7 +24,8 @@ #include "BLI_math.h" #include "DNA_camera_types.h" -ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation() { +ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->inputOperation = NULL; @@ -33,13 +34,14 @@ ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation(): NodeOperation() this->maxRadius = 32.0f; } -float ConvertDepthToRadiusOperation::determineFocalDistance() { +float ConvertDepthToRadiusOperation::determineFocalDistance() +{ if (cameraObject == NULL || cameraObject->type != OB_CAMERA) { return 10.0f; } else { - Camera *camera= (Camera*)this->cameraObject->data; + Camera *camera = (Camera*)this->cameraObject->data; cam_lens = camera->lens; if (camera->dof_ob) { /* too simple, better to return the distance on the view axis only @@ -56,10 +58,11 @@ float ConvertDepthToRadiusOperation::determineFocalDistance() { } } -void ConvertDepthToRadiusOperation::initExecution() { +void ConvertDepthToRadiusOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); float focalDistance = determineFocalDistance(); - if (focalDistance==0.0f) focalDistance = 1e10f; /* if the dof is 0.0 then set it be be far away */ + if (focalDistance == 0.0f) focalDistance = 1e10f; /* if the dof is 0.0 then set it be be far away */ inverseFocalDistance = 1.f/focalDistance; this->aspect = (this->getWidth() > this->getHeight()) ? (this->getHeight() / (float)this->getWidth()) : (this->getWidth() / (float)this->getHeight()); this->aperture = 0.5f*(this->cam_lens / (this->aspect*32.f)) / this->fStop; @@ -67,7 +70,8 @@ void ConvertDepthToRadiusOperation::initExecution() { this->dof_sp = (float)minsz / (16.f / cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov); } -void ConvertDepthToRadiusOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue[4]; float z; float radius; @@ -93,6 +97,7 @@ void ConvertDepthToRadiusOperation::executePixel(float* outputValue, float x, fl else outputValue[0] = 0.0f; } -void ConvertDepthToRadiusOperation::deinitExecution() { +void ConvertDepthToRadiusOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h index 80a56122565..c199ea87fe3 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h @@ -52,7 +52,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution @@ -66,7 +66,7 @@ public: void setfStop(float fStop) {this->fStop = fStop;} void setMaxRadius(float maxRadius) {this->maxRadius = maxRadius;} - void setCameraObject(Object* camera) {this->cameraObject = camera;} + void setCameraObject(Object *camera) {this->cameraObject = camera;} float determineFocalDistance(); }; #endif diff --git a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp index 8de98fef28b..97dd7e69092 100644 --- a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp @@ -23,24 +23,28 @@ #include "COM_ConvertHSVToRGBOperation.h" #include "BLI_math_color.h" -ConvertHSVToRGBOperation::ConvertHSVToRGBOperation(): NodeOperation() { +ConvertHSVToRGBOperation::ConvertHSVToRGBOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; } -void ConvertHSVToRGBOperation::initExecution() { +void ConvertHSVToRGBOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertHSVToRGBOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertHSVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; inputOperation->read(inputColor, x, y, sampler, inputBuffers); hsv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]); outputValue[3] = inputColor[3]; } -void ConvertHSVToRGBOperation::deinitExecution() { +void ConvertHSVToRGBOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h index f2f61250aad..327b4089934 100644 --- a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h +++ b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp index 509093f4d5f..547915f58c9 100644 --- a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp @@ -22,18 +22,21 @@ #include "COM_ConvertKeyToPremulOperation.h" #include "BLI_math.h" -ConvertKeyToPremulOperation::ConvertKeyToPremulOperation(): NodeOperation() { +ConvertKeyToPremulOperation::ConvertKeyToPremulOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputColor = NULL; } -void ConvertKeyToPremulOperation::initExecution() { +void ConvertKeyToPremulOperation::initExecution() +{ this->inputColor = getInputSocketReader(0); } -void ConvertKeyToPremulOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertKeyToPremulOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue[4]; float alpha; @@ -48,6 +51,7 @@ void ConvertKeyToPremulOperation::executePixel(float* outputValue, float x, floa outputValue[3] = alpha; } -void ConvertKeyToPremulOperation::deinitExecution() { +void ConvertKeyToPremulOperation::deinitExecution() +{ this->inputColor = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h index 15195b37f49..1d5a1c1c4a6 100644 --- a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h +++ b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h @@ -40,7 +40,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp index c800587ab0c..16636ee2afc 100644 --- a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp @@ -22,18 +22,21 @@ #include "COM_ConvertPremulToKeyOperation.h" #include "BLI_math.h" -ConvertPremulToKeyOperation::ConvertPremulToKeyOperation(): NodeOperation() { +ConvertPremulToKeyOperation::ConvertPremulToKeyOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputColor = NULL; } -void ConvertPremulToKeyOperation::initExecution() { +void ConvertPremulToKeyOperation::initExecution() +{ this->inputColor = getInputSocketReader(0); } -void ConvertPremulToKeyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertPremulToKeyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue[4]; float alpha; @@ -41,9 +44,9 @@ void ConvertPremulToKeyOperation::executePixel(float* outputValue, float x, floa alpha = inputValue[3]; if (fabsf(alpha) < 1e-5f) { - outputValue[0]= 0.f; - outputValue[1]= 0.f; - outputValue[2]= 0.f; + outputValue[0] = 0.f; + outputValue[1] = 0.f; + outputValue[2] = 0.f; } else { outputValue[0] = inputValue[0] / alpha; @@ -55,6 +58,7 @@ void ConvertPremulToKeyOperation::executePixel(float* outputValue, float x, floa outputValue[3] = alpha; } -void ConvertPremulToKeyOperation::deinitExecution() { +void ConvertPremulToKeyOperation::deinitExecution() +{ this->inputColor = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h index 431dcfe5742..17597fa8f15 100644 --- a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h +++ b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h @@ -40,7 +40,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp index b8208a864ff..99054efc267 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp @@ -23,23 +23,27 @@ #include "COM_ConvertRGBToHSVOperation.h" #include "BLI_math_color.h" -ConvertRGBToHSVOperation::ConvertRGBToHSVOperation(): NodeOperation() { +ConvertRGBToHSVOperation::ConvertRGBToHSVOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; } -void ConvertRGBToHSVOperation::initExecution() { +void ConvertRGBToHSVOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertRGBToHSVOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertRGBToHSVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; inputOperation->read(inputColor, x, y, sampler, inputBuffers); rgb_to_hsv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]); outputValue[3] = inputColor[3]; } -void ConvertRGBToHSVOperation::deinitExecution() { +void ConvertRGBToHSVOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h index a36092640e8..5064bd06993 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h +++ b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp index e1aa91e35da..c626dc03000 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp @@ -22,17 +22,20 @@ #include "COM_ConvertRGBToYCCOperation.h" #include "BLI_math_color.h" -ConvertRGBToYCCOperation::ConvertRGBToYCCOperation(): NodeOperation() { +ConvertRGBToYCCOperation::ConvertRGBToYCCOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; } -void ConvertRGBToYCCOperation::initExecution() { +void ConvertRGBToYCCOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertRGBToYCCOperation::setMode(int mode) { +void ConvertRGBToYCCOperation::setMode(int mode) +{ switch (mode) { case 1: @@ -48,7 +51,8 @@ void ConvertRGBToYCCOperation::setMode(int mode) { } } -void ConvertRGBToYCCOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertRGBToYCCOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; float color[3]; @@ -62,6 +66,7 @@ void ConvertRGBToYCCOperation::executePixel(float* outputValue, float x, float y outputValue[3] = inputColor[3]; } -void ConvertRGBToYCCOperation::deinitExecution() { +void ConvertRGBToYCCOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h index 76825061c19..a952627893b 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h +++ b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h @@ -48,7 +48,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp index c8ab3dd5a4b..c4b870d6ad5 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp @@ -22,23 +22,27 @@ #include "COM_ConvertRGBToYUVOperation.h" #include "BLI_math_color.h" -ConvertRGBToYUVOperation::ConvertRGBToYUVOperation(): NodeOperation() { +ConvertRGBToYUVOperation::ConvertRGBToYUVOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; } -void ConvertRGBToYUVOperation::initExecution() { +void ConvertRGBToYUVOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertRGBToYUVOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertRGBToYUVOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; inputOperation->read(inputColor, x, y, sampler, inputBuffers); rgb_to_yuv(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]); outputValue[3] = inputColor[3]; } -void ConvertRGBToYUVOperation::deinitExecution() { +void ConvertRGBToYUVOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h index aba759b6b97..5bc763dde00 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h +++ b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h @@ -43,7 +43,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp b/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp index 622163739d6..dce554efbac 100644 --- a/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp +++ b/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp @@ -22,16 +22,19 @@ #include "COM_ConvertValueToColourProg.h" -ConvertValueToColourProg::ConvertValueToColourProg(): NodeOperation() { +ConvertValueToColourProg::ConvertValueToColourProg(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->inputProgram = NULL; } -void ConvertValueToColourProg::initExecution() { +void ConvertValueToColourProg::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); } -void ConvertValueToColourProg::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertValueToColourProg::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue[4]; this->inputProgram->read(inputValue, x, y, sampler, inputBuffers); color[0] = inputValue[0]; @@ -40,6 +43,7 @@ void ConvertValueToColourProg::executePixel(float* color, float x, float y, Pixe color[3] = 1.0f; } -void ConvertValueToColourProg::deinitExecution() { +void ConvertValueToColourProg::deinitExecution() +{ this->inputProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertValueToColourProg.h b/source/blender/compositor/operations/COM_ConvertValueToColourProg.h index 25643a74f35..4956f7196f5 100644 --- a/source/blender/compositor/operations/COM_ConvertValueToColourProg.h +++ b/source/blender/compositor/operations/COM_ConvertValueToColourProg.h @@ -30,14 +30,14 @@ private: /** * Cached reference to the inputProgram */ - SocketReader* inputProgram; + SocketReader *inputProgram; public: ConvertValueToColourProg(); /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp index c675ea16fdb..ba7913d24ee 100644 --- a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp @@ -22,17 +22,20 @@ #include "COM_ConvertValueToVectorOperation.h" -ConvertValueToVectorOperation::ConvertValueToVectorOperation(): NodeOperation() { +ConvertValueToVectorOperation::ConvertValueToVectorOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VECTOR); this->inputOperation = NULL; } -void ConvertValueToVectorOperation::initExecution() { +void ConvertValueToVectorOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertValueToVectorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertValueToVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float input[4]; inputOperation->read(input, x, y, sampler, inputBuffers); outputValue[0] = input[0]; @@ -41,6 +44,7 @@ void ConvertValueToVectorOperation::executePixel(float* outputValue, float x, fl outputValue[3] = 0.0f; } -void ConvertValueToVectorOperation::deinitExecution() { +void ConvertValueToVectorOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h index 0824bb0e4fe..1e6a7d4b3e7 100644 --- a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h +++ b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp index 517fc56e93e..5a4cc4d3549 100644 --- a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp @@ -22,21 +22,25 @@ #include "COM_ConvertVectorToColorOperation.h" -ConvertVectorToColorOperation::ConvertVectorToColorOperation(): NodeOperation() { +ConvertVectorToColorOperation::ConvertVectorToColorOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; } -void ConvertVectorToColorOperation::initExecution() { +void ConvertVectorToColorOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertVectorToColorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertVectorToColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ inputOperation->read(outputValue, x, y, sampler, inputBuffers); outputValue[3] = 1.0f; } -void ConvertVectorToColorOperation::deinitExecution() { +void ConvertVectorToColorOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h index 4ebaf5b9230..45ffd0675bd 100644 --- a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h +++ b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp index a57cd229e1f..67cc42ac8fc 100644 --- a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp @@ -22,22 +22,26 @@ #include "COM_ConvertVectorToValueOperation.h" -ConvertVectorToValueOperation::ConvertVectorToValueOperation(): NodeOperation() { +ConvertVectorToValueOperation::ConvertVectorToValueOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_VALUE); this->inputOperation = NULL; } -void ConvertVectorToValueOperation::initExecution() { +void ConvertVectorToValueOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertVectorToValueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertVectorToValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float input[4]; inputOperation->read(input, x, y, sampler, inputBuffers); outputValue[0] = (input[0]+input[1]+input[2])/3.0f; } -void ConvertVectorToValueOperation::deinitExecution() { +void ConvertVectorToValueOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h index ede7853f57e..59bae18ed26 100644 --- a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h +++ b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp index 6f9c5244c29..d3048c131e4 100644 --- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp @@ -22,17 +22,20 @@ #include "COM_ConvertYCCToRGBOperation.h" #include "BLI_math_color.h" -ConvertYCCToRGBOperation::ConvertYCCToRGBOperation(): NodeOperation() { +ConvertYCCToRGBOperation::ConvertYCCToRGBOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; } -void ConvertYCCToRGBOperation::initExecution() { +void ConvertYCCToRGBOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertYCCToRGBOperation::setMode(int mode) { +void ConvertYCCToRGBOperation::setMode(int mode) +{ switch (mode) { case 1: @@ -48,7 +51,8 @@ void ConvertYCCToRGBOperation::setMode(int mode) { } } -void ConvertYCCToRGBOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertYCCToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; inputOperation->read(inputColor, x, y, sampler, inputBuffers); @@ -61,7 +65,8 @@ void ConvertYCCToRGBOperation::executePixel(float* outputValue, float x, float y outputValue[3] = inputColor[3]; } -void ConvertYCCToRGBOperation::deinitExecution() { +void ConvertYCCToRGBOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h index c3702de3b48..a13c2826a79 100644 --- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h +++ b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h @@ -48,7 +48,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp index a807030cb8a..d7037a2c2d1 100644 --- a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp @@ -22,24 +22,28 @@ #include "COM_ConvertYUVToRGBOperation.h" #include "BLI_math_color.h" -ConvertYUVToRGBOperation::ConvertYUVToRGBOperation(): NodeOperation() { +ConvertYUVToRGBOperation::ConvertYUVToRGBOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; } -void ConvertYUVToRGBOperation::initExecution() { +void ConvertYUVToRGBOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void ConvertYUVToRGBOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ConvertYUVToRGBOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; inputOperation->read(inputColor, x, y, sampler, inputBuffers); yuv_to_rgb(inputColor[0], inputColor[1], inputColor[2], &outputValue[0], &outputValue[1], &outputValue[2]); outputValue[3] = inputColor[3]; } -void ConvertYUVToRGBOperation::deinitExecution() { +void ConvertYUVToRGBOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h index 6d82d36fe5c..380510d0100 100644 --- a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h +++ b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h @@ -43,7 +43,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp index 6505e1be83e..0daa2b9c08a 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp @@ -23,15 +23,18 @@ #include "COM_ConvolutionEdgeFilterOperation.h" #include "BLI_math.h" -ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFilterOperation() { +ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFilterOperation() +{ } -inline void addFilter(float* result, float*input, float value) { +inline void addFilter(float *result, float*input, float value) +{ result[0] += input[0] * value; result[1] += input[1] * value; result[2] += input[2] * value; } -void ConvolutionEdgeFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void ConvolutionEdgeFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ float in1[4],in2[4], res1[4], res2[4]; float value[4]; diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h index 64a52d1a925..a0f9c1b3452 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h @@ -28,7 +28,7 @@ class ConvolutionEdgeFilterOperation: public ConvolutionFilterOperation { public: ConvolutionEdgeFilterOperation(); - void executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data); }; #endif diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp index 1bf53260e23..05cd570feaa 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp @@ -22,7 +22,8 @@ #include "COM_ConvolutionFilterOperation.h" -ConvolutionFilterOperation::ConvolutionFilterOperation() : NodeOperation() { +ConvolutionFilterOperation::ConvolutionFilterOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); @@ -31,12 +32,14 @@ ConvolutionFilterOperation::ConvolutionFilterOperation() : NodeOperation() { this->filter = NULL; this->setComplex(true); } -void ConvolutionFilterOperation::initExecution() { +void ConvolutionFilterOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); this->inputValueOperation = this->getInputSocketReader(1); } -void ConvolutionFilterOperation::set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9) { +void ConvolutionFilterOperation::set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9) +{ this->filter = new float[9]; this->filter[0] = f1; this->filter[1] = f2; @@ -51,7 +54,8 @@ void ConvolutionFilterOperation::set3x3Filter(float f1, float f2, float f3, floa this->filterWidth = 3; } -void ConvolutionFilterOperation::deinitExecution() { +void ConvolutionFilterOperation::deinitExecution() +{ this->inputOperation = NULL; this->inputValueOperation = NULL; if (this->filter) { @@ -61,7 +65,8 @@ void ConvolutionFilterOperation::deinitExecution() { } -void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ color[0] = 0.0; color[1] = 0.0; color[2] = 0.0; @@ -123,7 +128,8 @@ void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryB color[2] = color[2]*value[0] + in2[2] * mval; } -bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; int addx = (this->filterWidth-1)/2+1; int addy = (this->filterHeight-1)/2+1; diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h index 732b3d3699e..3276038726b 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h @@ -33,13 +33,13 @@ private: protected: SocketReader *inputOperation; SocketReader *inputValueOperation; - float* filter; + float *filter; 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, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data); void initExecution(); void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp index 3c4e3428ec2..192ad8d0bda 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cpp +++ b/source/blender/compositor/operations/COM_CropOperation.cpp @@ -23,22 +23,24 @@ #include "COM_CropOperation.h" #include "BLI_math.h" -CropBaseOperation::CropBaseOperation() :NodeOperation() { +CropBaseOperation::CropBaseOperation() :NodeOperation() +{ this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; this->settings = NULL; } -void CropBaseOperation::updateArea() { +void CropBaseOperation::updateArea() +{ SocketReader * inputReference = this->getInputSocketReader(0); float width = inputReference->getWidth(); float height = inputReference->getHeight(); if (this->relative) { - settings->x1= width * settings->fac_x1; - settings->x2= width * settings->fac_x2; - settings->y1= height * settings->fac_y1; - settings->y2= height * settings->fac_y2; + settings->x1 = width * settings->fac_x1; + settings->x2 = width * settings->fac_x2; + settings->y1 = height * settings->fac_y1; + settings->y2 = height * settings->fac_y2; } if (width <= settings->x1 + 1) settings->x1 = width - 1; @@ -55,19 +57,23 @@ void CropBaseOperation::updateArea() { this->ymin = MIN2(settings->y1, settings->y2); } -void CropBaseOperation::initExecution() { +void CropBaseOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); updateArea(); } -void CropBaseOperation::deinitExecution() { +void CropBaseOperation::deinitExecution() +{ this->inputOperation = NULL; } -CropOperation::CropOperation() :CropBaseOperation() { +CropOperation::CropOperation() :CropBaseOperation() +{ } -void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ if ((x < this->xmax && x >= xmin) && (y < ymax && y >= ymin)) { inputOperation->read(color, x, y, sampler, inputBuffers); } @@ -79,10 +85,12 @@ void CropOperation::executePixel(float *color, float x, float y, PixelSampler sa } } -CropImageOperation::CropImageOperation() :CropBaseOperation() { +CropImageOperation::CropImageOperation() :CropBaseOperation() +{ } -bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.xmax = input->xmax + this->xmin; @@ -93,13 +101,15 @@ 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[], unsigned int preferedResolution[]) +{ NodeOperation::determineResolution(resolution, preferedResolution); updateArea(); resolution[0] = this->xmax - this->xmin; resolution[1] = this->ymax - this->ymin; } -void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ this->inputOperation->read(color, (x + this->xmin), (y + this->ymin), sampler, inputBuffers); } diff --git a/source/blender/compositor/operations/COM_CropOperation.h b/source/blender/compositor/operations/COM_CropOperation.h index a728212d221..e8edabf08ed 100644 --- a/source/blender/compositor/operations/COM_CropOperation.h +++ b/source/blender/compositor/operations/COM_CropOperation.h @@ -41,7 +41,7 @@ public: void initExecution(); void deinitExecution(); void setCropSettings(NodeTwoXYs *settings) {this->settings = settings;} - void setRelative(bool rel) {this->relative =rel;} + void setRelative(bool rel) {this->relative = rel;} }; class CropOperation: public CropBaseOperation { diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp index ddccff01772..fda5b00e2a0 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp @@ -30,9 +30,11 @@ extern "C" { } #endif -CurveBaseOperation::CurveBaseOperation(): NodeOperation() { +CurveBaseOperation::CurveBaseOperation(): NodeOperation() +{ this->curveMapping = NULL; } -void CurveBaseOperation::initExecution() { +void CurveBaseOperation::initExecution() +{ curvemapping_initialize(this->curveMapping); } diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.h b/source/blender/compositor/operations/COM_CurveBaseOperation.h index bd4ee2ef2ed..366af5b07cb 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.h +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.h @@ -39,6 +39,6 @@ public: */ void initExecution(); - void setCurveMapping(CurveMapping* mapping) {this->curveMapping = mapping;} + void setCurveMapping(CurveMapping *mapping) {this->curveMapping = mapping;} }; #endif diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp index c64f2593318..628daa7c775 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp @@ -23,7 +23,8 @@ #include "COM_DifferenceMatteOperation.h" #include "BLI_math.h" -DifferenceMatteOperation::DifferenceMatteOperation(): NodeOperation() { +DifferenceMatteOperation::DifferenceMatteOperation(): NodeOperation() +{ addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); @@ -32,16 +33,19 @@ DifferenceMatteOperation::DifferenceMatteOperation(): NodeOperation() { inputImage2Program = NULL; } -void DifferenceMatteOperation::initExecution() { +void DifferenceMatteOperation::initExecution() +{ this->inputImage1Program = this->getInputSocketReader(0); this->inputImage2Program = this->getInputSocketReader(1); } -void DifferenceMatteOperation::deinitExecution() { - this->inputImage1Program= NULL; - this->inputImage2Program= NULL; +void DifferenceMatteOperation::deinitExecution() +{ + this->inputImage1Program = NULL; + this->inputImage2Program = NULL; } -void DifferenceMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inColor1[4]; float inColor2[4]; @@ -53,9 +57,9 @@ void DifferenceMatteOperation::executePixel(float* outputValue, float x, float y this->inputImage1Program->read(inColor1, x, y, sampler, inputBuffers); this->inputImage2Program->read(inColor2, x, y, sampler, inputBuffers); - difference= fabs(inColor2[0]-inColor1[0])+ - fabs(inColor2[1]-inColor1[1])+ - fabs(inColor2[2]-inColor1[2]); + difference = (fabs(inColor2[0] - inColor1[0]) + + fabs(inColor2[1] - inColor1[1]) + + fabs(inColor2[2] - inColor1[2])); /*average together the distances*/ difference=difference/3.0; @@ -78,7 +82,7 @@ void DifferenceMatteOperation::executePixel(float* outputValue, float x, float y } else { /*foreground object*/ - outputValue[0]= inColor1[3]; + outputValue[0] = inColor1[3]; } } diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h index 2b63bfd7a15..95ebed6f63d 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h @@ -31,9 +31,9 @@ */ class DifferenceMatteOperation : public NodeOperation { private: - NodeChroma* settings; + NodeChroma *settings; SocketReader * inputImage1Program; - SocketReader* inputImage2Program; + SocketReader *inputImage2Program; public: /** * Default constructor @@ -43,11 +43,11 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); - void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;} + void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;} }; #endif diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index c34d8976719..d9c0350eb09 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -23,7 +23,8 @@ #include "COM_DilateErodeOperation.h" #include "BLI_math.h" -DilateErodeOperation::DilateErodeOperation(): NodeOperation() { +DilateErodeOperation::DilateErodeOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->setComplex(true); @@ -32,7 +33,8 @@ DilateErodeOperation::DilateErodeOperation(): NodeOperation() { this->_switch = 0.5f; this->distance = 0.0f; } -void DilateErodeOperation::initExecution() { +void DilateErodeOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); if (this->distance < 0.0f) { this->scope = - this->distance + this->inset; @@ -50,12 +52,14 @@ void DilateErodeOperation::initExecution() { } } -void* DilateErodeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { - void* buffer = inputProgram->initializeTileData(NULL, memoryBuffers); +void *DilateErodeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ + void *buffer = inputProgram->initializeTileData(NULL, memoryBuffers); return buffer; } -void DilateErodeOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void DilateErodeOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ float inputValue[4]; const float sw = this->_switch; const float distance = this->distance; @@ -64,9 +68,9 @@ void DilateErodeOperation::executePixel(float* color, int x, int y, MemoryBuffer const float inset = this->inset; float mindist = rd*2; - MemoryBuffer* inputBuffer = (MemoryBuffer*)data; - float* buffer = inputBuffer->getBuffer(); - rcti* rect = inputBuffer->getRect(); + MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + float *buffer = inputBuffer->getBuffer(); + rcti *rect = inputBuffer->getRect(); const int minx = max(x - scope, rect->xmin); const int miny = max(y - scope, rect->ymin); const int maxx = min(x + scope, rect->xmax); @@ -137,11 +141,13 @@ void DilateErodeOperation::executePixel(float* color, int x, int y, MemoryBuffer } } -void DilateErodeOperation::deinitExecution() { +void DilateErodeOperation::deinitExecution() +{ this->inputProgram = NULL; } -bool DilateErodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool DilateErodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.xmax = input->xmax + scope; diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h index af554fa0d16..102d1165bc8 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.h +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h @@ -47,14 +47,14 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution */ void initExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp index 4b4e9ce851a..30a09a45ade 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp @@ -27,7 +27,8 @@ extern "C" { #include "RE_pipeline.h" } -DirectionalBlurOperation::DirectionalBlurOperation() : NodeOperation() { +DirectionalBlurOperation::DirectionalBlurOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); @@ -35,7 +36,8 @@ DirectionalBlurOperation::DirectionalBlurOperation() : NodeOperation() { this->inputProgram = NULL; } -void DirectionalBlurOperation::initExecution() { +void DirectionalBlurOperation::initExecution() +{ this->inputProgram = getInputSocketReader(0); QualityStepHelper::initExecution(COM_QH_INCREASE); const float angle = this->data->angle; @@ -48,37 +50,38 @@ void DirectionalBlurOperation::initExecution() { const float width = getWidth(); const float height = getHeight(); - const float a= angle; - const float itsc= 1.f / pow(2.f, (float)iterations); + const float a = angle; + const float itsc = 1.f / pow(2.f, (float)iterations); float D; - D= distance * sqrtf(width*width + height*height); - center_x_pix= center_x * width; - center_y_pix= center_y * height; + D = distance * sqrtf(width*width + height*height); + center_x_pix = center_x * width; + center_y_pix = center_y * height; tx= itsc * D * cos(a); ty= -itsc * D * sin(a); sc= itsc * zoom; - rot= itsc * spin; + rot = itsc * spin; } -void DirectionalBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void DirectionalBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ const int iterations = pow(2.f, this->data->iter); - float col[4]= {0,0,0,0}; - float col2[4]= {0,0,0,0}; + float col[4] = {0,0,0,0}; + float col2[4] = {0,0,0,0}; this->inputProgram->read(col2, x, y, COM_PS_NEAREST, inputBuffers); float ltx = tx; float lty = ty; float lsc = sc; float lrot = rot; /* blur the image */ - for (int i= 0; i < iterations; ++i) { - const float cs= cos(lrot), ss= sin(lrot); - const float isc= 1.f / (1.f + lsc); + for (int i = 0; i < iterations; ++i) { + const float cs = cos(lrot), ss = sin(lrot); + const float isc = 1.f / (1.f + lsc); - const float v= isc * (y - center_y_pix) + lty; - const float u= isc * (x - center_x_pix) + ltx; + const float v = isc * (y - center_y_pix) + lty; + const float u = isc * (x - center_x_pix) + ltx; this->inputProgram->read(col, cs * u + ss * v + center_x_pix, cs * v - ss * u + center_y_pix, COM_PS_NEAREST, inputBuffers); @@ -99,11 +102,13 @@ void DirectionalBlurOperation::executePixel(float* color, int x, int y, MemoryBu color[3] = col2[3]/iterations; } -void DirectionalBlurOperation::deinitExecution() { +void DirectionalBlurOperation::deinitExecution() +{ this->inputProgram = NULL; } -bool DirectionalBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool DirectionalBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.xmax = this->getWidth(); diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h index e82b451c102..280e9247c1b 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h @@ -27,8 +27,8 @@ class DirectionalBlurOperation : public NodeOperation, public QualityStepHelper { private: - SocketReader* inputProgram; - NodeDBlurData* data; + SocketReader *inputProgram; + NodeDBlurData *data; float center_x_pix, center_y_pix; float tx, ty; @@ -40,7 +40,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp index b30ce5ac5b5..2add367f39e 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp @@ -23,7 +23,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -DisplaceOperation::DisplaceOperation(): NodeOperation() { +DisplaceOperation::DisplaceOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VECTOR); this->addInputSocket(COM_DT_VALUE); @@ -37,7 +38,8 @@ DisplaceOperation::DisplaceOperation(): NodeOperation() { this->inputScaleYProgram = NULL; } -void DisplaceOperation::initExecution() { +void DisplaceOperation::initExecution() +{ this->inputColorProgram = this->getInputSocketReader(0); this->inputVectorProgram = this->getInputSocketReader(1); this->inputScaleXProgram = this->getInputSocketReader(2); @@ -52,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, MemoryBuffer *inputBuffers[], void* data) +void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { float inVector[4]; float inScale[4]; @@ -97,14 +99,16 @@ void DisplaceOperation::executePixel(float* color, int x, int y, MemoryBuffer *i this->inputColorProgram->read(color, u, v, dxt, dyt, inputBuffers); } -void DisplaceOperation::deinitExecution() { +void DisplaceOperation::deinitExecution() +{ this->inputColorProgram = NULL; this->inputVectorProgram = NULL; this->inputScaleXProgram = NULL; this->inputScaleYProgram = NULL; } -bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti colorInput; rcti vectorInput; NodeOperation *operation=NULL; diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.h b/source/blender/compositor/operations/COM_DisplaceOperation.h index 17f65eea20f..9c59c928854 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceOperation.h @@ -29,10 +29,10 @@ private: /** * Cached reference to the inputProgram */ - SocketReader* inputColorProgram; - SocketReader* inputVectorProgram; - SocketReader* inputScaleXProgram; - SocketReader* inputScaleYProgram; + SocketReader *inputColorProgram; + SocketReader *inputVectorProgram; + SocketReader *inputScaleXProgram; + SocketReader *inputScaleYProgram; float width_x4; float height_x4; @@ -48,7 +48,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp index 99d1eb1cd14..8675caca1e2 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp @@ -23,7 +23,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -DisplaceSimpleOperation::DisplaceSimpleOperation(): NodeOperation() { +DisplaceSimpleOperation::DisplaceSimpleOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VECTOR); this->addInputSocket(COM_DT_VALUE); @@ -36,7 +37,8 @@ DisplaceSimpleOperation::DisplaceSimpleOperation(): NodeOperation() { this->inputScaleYProgram = NULL; } -void DisplaceSimpleOperation::initExecution() { +void DisplaceSimpleOperation::initExecution() +{ this->inputColorProgram = this->getInputSocketReader(0); this->inputVectorProgram = this->getInputSocketReader(1); this->inputScaleXProgram = this->getInputSocketReader(2); @@ -51,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, MemoryBuffer *inputBuffers[]) +void DisplaceSimpleOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { float inVector[4]; float inScale[4]; @@ -83,14 +85,16 @@ void DisplaceSimpleOperation::executePixel(float* color, float x, float y, Pixel this->inputColorProgram->read(color, u, v, sampler, inputBuffers); } -void DisplaceSimpleOperation::deinitExecution() { +void DisplaceSimpleOperation::deinitExecution() +{ this->inputColorProgram = NULL; this->inputVectorProgram = NULL; this->inputScaleXProgram = NULL; this->inputScaleYProgram = NULL; } -bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti colorInput; NodeOperation *operation=NULL; diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h index 88569954305..0e3bcc1b1f0 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h @@ -29,10 +29,10 @@ private: /** * Cached reference to the inputProgram */ - SocketReader* inputColorProgram; - SocketReader* inputVectorProgram; - SocketReader* inputScaleXProgram; - SocketReader* inputScaleYProgram; + SocketReader *inputColorProgram; + SocketReader *inputVectorProgram; + SocketReader *inputScaleXProgram; + SocketReader *inputScaleYProgram; float width_x4; float height_x4; @@ -48,7 +48,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp index ab4df7bf1ac..304f7fa5066 100644 --- a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp @@ -22,7 +22,8 @@ #include "COM_DistanceMatteOperation.h" #include "BLI_math.h" -DistanceMatteOperation::DistanceMatteOperation(): NodeOperation() { +DistanceMatteOperation::DistanceMatteOperation(): NodeOperation() +{ addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); @@ -31,17 +32,20 @@ DistanceMatteOperation::DistanceMatteOperation(): NodeOperation() { inputKeyProgram = NULL; } -void DistanceMatteOperation::initExecution() { +void DistanceMatteOperation::initExecution() +{ this->inputImageProgram = this->getInputSocketReader(0); this->inputKeyProgram = this->getInputSocketReader(1); } -void DistanceMatteOperation::deinitExecution() { - this->inputImageProgram= NULL; - this->inputKeyProgram= NULL; +void DistanceMatteOperation::deinitExecution() +{ + this->inputImageProgram = NULL; + this->inputKeyProgram = NULL; } -void DistanceMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inKey[4]; float inImage[4]; diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.h b/source/blender/compositor/operations/COM_DistanceMatteOperation.h index efa735445fa..2a668f31f8f 100644 --- a/source/blender/compositor/operations/COM_DistanceMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.h @@ -42,11 +42,11 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); - void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;} + void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;} }; #endif diff --git a/source/blender/compositor/operations/COM_DotproductOperation.cpp b/source/blender/compositor/operations/COM_DotproductOperation.cpp index 284fb0ddca4..b03b176f08a 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.cpp +++ b/source/blender/compositor/operations/COM_DotproductOperation.cpp @@ -22,7 +22,8 @@ #include "COM_DotproductOperation.h" -DotproductOperation::DotproductOperation() : NodeOperation() { +DotproductOperation::DotproductOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_VECTOR); this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_VALUE); @@ -30,19 +31,22 @@ DotproductOperation::DotproductOperation() : NodeOperation() { this->input1Operation = NULL; this->input2Operation = NULL; } -void DotproductOperation::initExecution() { +void DotproductOperation::initExecution() +{ this->input1Operation = this->getInputSocketReader(0); this->input2Operation = this->getInputSocketReader(1); } -void DotproductOperation::deinitExecution() { +void DotproductOperation::deinitExecution() +{ this->input1Operation = NULL; this->input2Operation = NULL; } /** @todo: current implementation is the inverse of a dotproduct. not 'logically' correct */ -void DotproductOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void DotproductOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float input1[4]; float input2[4]; this->input1Operation->read(input1, x, y, sampler, inputBuffers); diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index b42e676893a..9e911e7ba40 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -26,7 +26,8 @@ // this part has been copied from the double edge mask // Contributor(s): Peter Larabell. -static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { +static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) +{ int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -106,7 +107,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int } /* Test the TOP row of pixels in buffer, except corners */ - for (x= t-1; x>=(t-rw)+2; x--) { + for (x = t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled if (limask[x]) { // test if pixel to the right, or to the left, are empty in the inner mask, @@ -126,7 +127,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int } /* Test the BOTTOM row of pixels in buffer, except corners */ - for (x= rw-2; x; x--) { + for (x = rw-2; x; x--) { // test if inner mask is filled if (limask[x]) { // test if pixel to the right, or to the left, are empty in the inner mask, @@ -145,7 +146,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int } } /* Test the LEFT edge of pixels in buffer, except corners */ - for (x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x = t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, @@ -165,7 +166,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int } /* Test the RIGHT edge of pixels in buffer, except corners */ - for (x= t-rw; x>rw; x-=rw) { + for (x = t-rw; x>rw; x-=rw) { // test if inner mask is filled if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, @@ -189,7 +190,8 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int rsize[2]=gsz; } -static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { +static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) +{ int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -292,7 +294,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } } /* Test the TOP row of pixels in buffer, except corners */ - for (x= t-1; x>=(t-rw)+2; x--) { + for (x = t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled if (limask[x]) { // test if pixel to the left, or to the right, are empty in the inner mask, @@ -318,7 +320,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } /* Test the BOTTOM row of pixels in buffer, except corners */ - for (x= rw-2; x; x--) { + for (x = rw-2; x; x--) { // test if inner mask is filled if (limask[x]) { // test if pixel to the left, or to the right, are empty in the inner mask, @@ -343,7 +345,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } } /* Test the LEFT edge of pixels in buffer, except corners */ - for (x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x = t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, @@ -369,7 +371,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } /* Test the RIGHT edge of pixels in buffer, except corners */ - for (x= t-rw; x>rw; x-=rw) { + for (x = t-rw; x>rw; x-=rw) { // test if inner mask is filled if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, @@ -399,7 +401,8 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in rsize[2]=gsz; } -static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { +static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) +{ int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -475,7 +478,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim } /* Test the TOP row of pixels in buffer, except corners */ - for (x= t-1; x>=(t-rw)+2; x--) { + for (x = t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled if (limask[x]) { // test if inner mask is empty to the left or to the right @@ -494,7 +497,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim } /* Test the BOTTOM row of pixels in buffer, except corners */ - for (x= rw-2; x; x--) { + for (x = rw-2; x; x--) { // test if inner mask is filled if (limask[x]) { // test if inner mask is empty to the left or to the right @@ -512,7 +515,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim } } /* Test the LEFT edge of pixels in buffer, except corners */ - for (x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x = t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled if (limask[x]) { // test if inner mask is empty underneath or above @@ -531,7 +534,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim } /* Test the RIGHT edge of pixels in buffer, except corners */ - for (x= t-rw; x>rw; x-=rw) { + for (x = t-rw; x>rw; x-=rw) { // test if inner mask is filled if (limask[x]) { // test if inner mask is empty underneath or above @@ -554,7 +557,8 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim rsize[2]=gsz; } -static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { +static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) +{ int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -653,7 +657,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } } /* Test the TOP row of pixels in buffer, except corners */ - for (x= t-1; x>=(t-rw)+2; x--) { + for (x = t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled if (limask[x]) { // test if inner mask is empty to the left or to the right @@ -678,7 +682,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } /* Test the BOTTOM row of pixels in buffer, except corners */ - for (x= rw-2; x; x--) { + for (x = rw-2; x; x--) { // test if inner mask is filled if (limask[x]) { // test if inner mask is empty to the left or to the right @@ -702,7 +706,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } } /* Test the LEFT edge of pixels in buffer, except corners */ - for (x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x = t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled if (limask[x]) { // test if inner mask is empty underneath or above @@ -727,7 +731,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } /* Test the RIGHT edge of pixels in buffer, except corners */ - for (x= t-rw; x>rw; x-=rw) { + for (x = t-rw; x>rw; x-=rw) { // test if inner mask is filled if (limask[x]) { // test if inner mask is empty underneath or above @@ -756,7 +760,8 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li rsize[2]=gsz; } -static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) { +static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) +{ int x; // x = pixel loop counter int a; // a = pixel loop counter int dx; // dx = delta x @@ -765,7 +770,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop /* Test all rows between the FIRST and LAST rows, excluding left and right edges */ - for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { + for (x = (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { a=x-2; pix_prevRow=a+rw; pix_nextRow=a-rw; @@ -781,9 +786,9 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l then the current pixel is counted as being a true outer edge pixel. */ if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) || - (!lomask[pix_prevCol] && !limask[pix_prevCol]) || - (!lomask[pix_nextRow] && !limask[pix_nextRow]) || - (!lomask[pix_prevRow] && !limask[pix_prevRow])) + (!lomask[pix_prevCol] && !limask[pix_prevCol]) || + (!lomask[pix_nextRow] && !limask[pix_nextRow]) || + (!lomask[pix_prevRow] && !limask[pix_prevRow])) { in_osz++; // increment the outer boundary pixel count lres[a]=3; // flag pixel as part of outer edge @@ -817,7 +822,8 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l rsize[2]=in_gsz; } -static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) { +static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) +{ int x; // x = pixel loop counter int a; // a = pixel loop counter int dx; // dx = delta x @@ -826,7 +832,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop /* Test all rows between the FIRST and LAST rows, excluding left and right edges */ - for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { + for (x = (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { a=x-2; pix_prevRow=a+rw; pix_nextRow=a-rw; @@ -842,9 +848,9 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i then the current pixel is counted as being a true outer edge pixel. */ if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) || - (!lomask[pix_prevCol] && !limask[pix_prevCol]) || - (!lomask[pix_nextRow] && !limask[pix_nextRow]) || - (!lomask[pix_prevRow] && !limask[pix_prevRow])) + (!lomask[pix_prevCol] && !limask[pix_prevCol]) || + (!lomask[pix_nextRow] && !limask[pix_nextRow]) || + (!lomask[pix_prevRow] && !limask[pix_prevRow])) { in_osz++; // increment the outer boundary pixel count lres[a]=3; // flag pixel as part of outer edge @@ -858,9 +864,9 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i } else { if ((!limask[pix_nextCol] && lomask[pix_nextCol]) || - (!limask[pix_prevCol] && lomask[pix_prevCol]) || - (!limask[pix_nextRow] && lomask[pix_nextRow]) || - (!limask[pix_prevRow] && lomask[pix_prevRow])) + (!limask[pix_prevCol] && lomask[pix_prevCol]) || + (!limask[pix_nextRow] && lomask[pix_nextRow]) || + (!limask[pix_prevRow] && lomask[pix_prevRow])) { in_isz++; // increment the inner boundary pixel count lres[a]=4; // flag pixel as part of inner edge @@ -882,7 +888,8 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i rsize[2]=in_gsz; } -static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz) { +static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz) +{ int x; // x = pixel loop counter int a; // a = temporary pixel index buffer loop counter unsigned int ud; // ud = unscaled edge distance @@ -904,7 +911,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne This does make the assumption that x and y can fit in 16 unsigned bits so if Blender starts doing renders greater than 65536 in either direction - this will need to allocate gbuf[] as unsigned int* and allocate 8 bytes + this will need to allocate gbuf[] as unsigned int *and allocate 8 bytes per flagged pixel. In general, the buffer on-screen: @@ -992,7 +999,8 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne } -static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset) { +static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset) +{ int x; // x = pixel loop counter int a; // a = temporary pixel index buffer loop counter int fsz; // size of the frame @@ -1068,7 +1076,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g Loop through all gradient pixels. */ - for (x= gsz-1; x>=0; x--) { + for (x = gsz-1; x>=0; x--) { gradientFillOffset=x<<1; t=gbuf[gradientFillOffset]; // calculate column of pixel indexed by gbuf[x] fsz=gbuf[gradientFillOffset+1]; // calculate row of pixel indexed by gbuf[x] @@ -1089,7 +1097,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g odist=*(float*)&rsl; // reciprocal square root odist=odist*(rsopf-(rsf*odist*odist)); // -- ** this line can be iterated for more accuracy ** -- dmin=0xffffffff; // reset min distance to edge pixel - for (a= innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels + for (a = innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels ud=a<<1; dy=t-gbuf[ud]; // compute delta in Y from gradient pixel to inside edge pixel dx=fsz-gbuf[ud+1]; // compute delta in X from gradient pixel to inside edge pixel @@ -1121,8 +1129,8 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g // end of copy -void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float *res) { - +void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float *res) +{ unsigned int *lres; // lres = unsigned int pointer to output pixel buffer (for bit operations) unsigned int *limask; // limask = unsigned int pointer to inner mask (for bit operations) unsigned int *lomask; // lomask = unsigned int pointer to outer mask (for bit operations) @@ -1144,10 +1152,10 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float t=(this->getWidth()*this->getHeight())-1; // determine size of the frame - lres= (unsigned int*)res; // unsigned int pointer to output buffer (for bit level ops) + lres = (unsigned int*)res; // unsigned int pointer to output buffer (for bit level ops) limask=(unsigned int*)imask; // unsigned int pointer to input mask (for bit level ops) lomask=(unsigned int*)omask; // unsigned int pointer to output mask (for bit level ops) - rw= this->getWidth(); // width of a row of pixels + rw = this->getWidth(); // width of a row of pixels /* @@ -1207,7 +1215,7 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float gsz=rsize[2]; // by the do_*EdgeDetection() function. fsz=gsz+isz+osz; // calculate size of pixel index buffer needed - gbuf= new unsigned short[fsz*2]; // allocate edge/gradient pixel index buffer + gbuf = new unsigned short[fsz*2]; // allocate edge/gradient pixel index buffer do_createEdgeLocationBuffer(t,rw,lres,res,gbuf,&innerEdgeOffset,&outerEdgeOffset,isz,gsz); do_fillGradientBuffer(rw,res,gbuf,isz,osz,gsz,innerEdgeOffset,outerEdgeOffset); @@ -1216,7 +1224,8 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float } } -DoubleEdgeMaskOperation::DoubleEdgeMaskOperation(): NodeOperation() { +DoubleEdgeMaskOperation::DoubleEdgeMaskOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -1227,7 +1236,8 @@ DoubleEdgeMaskOperation::DoubleEdgeMaskOperation(): NodeOperation() { this->setComplex(true); } -bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ if (this->cachedInstance == NULL) { rcti newInput; newInput.xmax = this->getWidth(); @@ -1241,23 +1251,25 @@ bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti *input, Read } } -void DoubleEdgeMaskOperation::initExecution() { +void DoubleEdgeMaskOperation::initExecution() +{ this->inputInnerMask = this->getInputSocketReader(0); this->inputOuterMask = this->getInputSocketReader(1); initMutex(); this->cachedInstance = NULL; } -void* DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ if (this->cachedInstance) return this->cachedInstance; BLI_mutex_lock(getMutex()); if (this->cachedInstance == NULL) { - MemoryBuffer* innerMask = (MemoryBuffer*)inputInnerMask->initializeTileData(rect, memoryBuffers); - MemoryBuffer* outerMask= (MemoryBuffer*)inputOuterMask->initializeTileData(rect, memoryBuffers); - float* data = new float[this->getWidth()*this->getHeight()]; - float* imask = innerMask->convertToValueBuffer(); - float* omask = outerMask->convertToValueBuffer(); + MemoryBuffer *innerMask = (MemoryBuffer*)inputInnerMask->initializeTileData(rect, memoryBuffers); + MemoryBuffer *outerMask = (MemoryBuffer*)inputOuterMask->initializeTileData(rect, memoryBuffers); + float *data = new float[this->getWidth()*this->getHeight()]; + float *imask = innerMask->convertToValueBuffer(); + float *omask = outerMask->convertToValueBuffer(); doDoubleEdgeMask(imask, omask, data); delete imask; delete omask; @@ -1266,8 +1278,9 @@ void* DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **mem BLI_mutex_unlock(getMutex()); return this->cachedInstance; } -void DoubleEdgeMaskOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { - float* buffer = (float*) data; +void DoubleEdgeMaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ + float *buffer = (float*) data; int index = (y*this->getWidth() + x); color[0] = buffer[index]; color[1] = buffer[index+1]; @@ -1275,7 +1288,8 @@ void DoubleEdgeMaskOperation::executePixel(float* color, int x, int y, MemoryBuf color[3] = buffer[index+3]; } -void DoubleEdgeMaskOperation::deinitExecution() { +void DoubleEdgeMaskOperation::deinitExecution() +{ this->inputInnerMask = NULL; this->inputOuterMask = NULL; deinitMutex(); diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h index f233570800a..85c4fd9e5b7 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h @@ -34,15 +34,15 @@ private: SocketReader * inputInnerMask; bool adjecentOnly; bool keepInside; - float* cachedInstance; + float *cachedInstance; public: DoubleEdgeMaskOperation(); - void doDoubleEdgeMask(float* inner, float *outer, float *res); + void doDoubleEdgeMask(float *inner, float *outer, float *res); /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution @@ -54,7 +54,7 @@ public: */ void deinitExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp index bc15523c149..85a629f7365 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp @@ -24,7 +24,8 @@ #include "BLI_math.h" #include "DNA_node_types.h" -EllipseMaskOperation::EllipseMaskOperation(): NodeOperation() { +EllipseMaskOperation::EllipseMaskOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -33,7 +34,8 @@ EllipseMaskOperation::EllipseMaskOperation(): NodeOperation() { this->cosine = 0.0f; this->sine = 0.0f; } -void EllipseMaskOperation::initExecution() { +void EllipseMaskOperation::initExecution() +{ this->inputMask = this->getInputSocketReader(0); this->inputValue = this->getInputSocketReader(1); const double rad = DEG2RAD(this->data->rotation); @@ -42,7 +44,8 @@ void EllipseMaskOperation::initExecution() { this->aspectRatio = ((float)this->getWidth())/this->getHeight(); } -void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputMask[4]; float inputValue[4]; @@ -112,7 +115,8 @@ void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSam } -void EllipseMaskOperation::deinitExecution() { +void EllipseMaskOperation::deinitExecution() +{ this->inputMask = NULL; this->inputValue = NULL; } diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.h b/source/blender/compositor/operations/COM_EllipseMaskOperation.h index 969013782e6..bff94941190 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.h +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.h @@ -45,7 +45,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index 6194e1d6699..ad8f3b12387 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -24,17 +24,20 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation() { +FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation() +{ this->iirgaus = false; } -void FastGaussianBlurOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data) { +void FastGaussianBlurOperation::executePixel(float *color,int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ MemoryBuffer *newData = (MemoryBuffer*)data; newData->read(color, x, y); } -bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; rcti sizeInput; sizeInput.xmin = 0; @@ -63,7 +66,8 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, Re } } -void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ MemoryBuffer *newBuf = (MemoryBuffer*)this->inputProgram->initializeTileData(rect, memoryBuffers); MemoryBuffer *copy = newBuf->duplicate(); updateSize(memoryBuffers); @@ -90,12 +94,14 @@ void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **m return copy; } -void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) { +void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) +{ MemoryBuffer *newData = (MemoryBuffer*)data; delete newData; } -void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int chan, int xy) { +void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int chan, int xy) +{ double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3]; double *X, *Y, *W; int i, x, y, sz; diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h index 3e1d5416ca7..cf36e7f6ebe 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h @@ -37,7 +37,7 @@ public: void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); void IIR_gauss(MemoryBuffer *src, float sigma, int channel, int xy); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data); }; diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp index 98acb4cfb5d..38018ffc3f7 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cpp +++ b/source/blender/compositor/operations/COM_FlipOperation.cpp @@ -22,7 +22,8 @@ #include "COM_FlipOperation.h" -FlipOperation::FlipOperation() : NodeOperation() { +FlipOperation::FlipOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); @@ -30,23 +31,27 @@ FlipOperation::FlipOperation() : NodeOperation() { this->flipX = true; this->flipY = false; } -void FlipOperation::initExecution() { +void FlipOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void FlipOperation::deinitExecution() { +void FlipOperation::deinitExecution() +{ this->inputOperation = NULL; } -void FlipOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void FlipOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float nx = this->flipX?this->getWidth()-1-x:x; float ny = this->flipY?this->getHeight()-1-y:y; this->inputOperation->read(color, nx, ny, sampler, inputBuffers); } -bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; if (this->flipX) { diff --git a/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp b/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp index a81597322a0..600bfde64d9 100644 --- a/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp +++ b/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp @@ -23,10 +23,12 @@ #include "COM_FogGlowImageOperation.h" #include "BLI_math.h" -FogGlowImageOperation::FogGlowImageOperation(): NodeOperation() { +FogGlowImageOperation::FogGlowImageOperation(): NodeOperation() +{ this->addOutputSocket(COM_DT_COLOR); } -void FogGlowImageOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void FogGlowImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ const float cs_r = 1.f, cs_g = 1.f, cs_b = 1.f; float u, v, w, d, r; @@ -42,7 +44,8 @@ void FogGlowImageOperation::executePixel(float* color, float x, float y, PixelSa color[3] = 1.0f; } -void FogGlowImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void FogGlowImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ resolution[0] = 512; resolution[1] = 512; } diff --git a/source/blender/compositor/operations/COM_FogGlowImageOperation.h b/source/blender/compositor/operations/COM_FogGlowImageOperation.h index f68346eeb8d..d0fc107638e 100644 --- a/source/blender/compositor/operations/COM_FogGlowImageOperation.h +++ b/source/blender/compositor/operations/COM_FogGlowImageOperation.h @@ -32,7 +32,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); }; diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp index c83c5d0ecb6..a4fb20402a4 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp @@ -23,16 +23,19 @@ #include "COM_GammaCorrectOperation.h" #include "BLI_math.h" -GammaCorrectOperation::GammaCorrectOperation(): NodeOperation() { +GammaCorrectOperation::GammaCorrectOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputProgram = NULL; } -void GammaCorrectOperation::initExecution() { +void GammaCorrectOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); } -void GammaCorrectOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void GammaCorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; this->inputProgram->read(inputColor, x, y, sampler, inputBuffers); if (inputColor[3] > 0.0f) { @@ -56,20 +59,24 @@ void GammaCorrectOperation::executePixel(float* color, float x, float y, PixelSa color[3] = inputColor[3]; } -void GammaCorrectOperation::deinitExecution() { +void GammaCorrectOperation::deinitExecution() +{ this->inputProgram = NULL; } -GammaUncorrectOperation::GammaUncorrectOperation(): NodeOperation() { +GammaUncorrectOperation::GammaUncorrectOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputProgram = NULL; } -void GammaUncorrectOperation::initExecution() { +void GammaUncorrectOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); } -void GammaUncorrectOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void GammaUncorrectOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor[4]; this->inputProgram->read(inputColor, x, y, sampler, inputBuffers); @@ -93,6 +100,7 @@ void GammaUncorrectOperation::executePixel(float* color, float x, float y, Pixel color[3] = inputColor[3]; } -void GammaUncorrectOperation::deinitExecution() { +void GammaUncorrectOperation::deinitExecution() +{ this->inputProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.h b/source/blender/compositor/operations/COM_GammaCorrectOperation.h index bcf78f4508a..6132f04edba 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.h +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.h @@ -38,7 +38,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution @@ -64,7 +64,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_GammaOperation.cpp b/source/blender/compositor/operations/COM_GammaOperation.cpp index eaa56c2f31a..f0887d4adee 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaOperation.cpp @@ -23,19 +23,22 @@ #include "COM_GammaOperation.h" #include "BLI_math.h" -GammaOperation::GammaOperation(): NodeOperation() { +GammaOperation::GammaOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->inputProgram = NULL; this->inputGammaProgram = NULL; } -void GammaOperation::initExecution() { +void GammaOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); this->inputGammaProgram = this->getInputSocketReader(1); } -void GammaOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void GammaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue[4]; float inputGamma[4]; @@ -50,7 +53,8 @@ void GammaOperation::executePixel(float* color, float x, float y, PixelSampler s color[3] = inputValue[3]; } -void GammaOperation::deinitExecution() { +void GammaOperation::deinitExecution() +{ this->inputProgram = NULL; this->inputGammaProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h index 0fbbf58bad6..2f3d8cdf9f7 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.h +++ b/source/blender/compositor/operations/COM_GammaOperation.h @@ -31,7 +31,7 @@ private: * Cached reference to the inputProgram */ SocketReader * inputProgram; - SocketReader* inputGammaProgram; + SocketReader *inputGammaProgram; public: GammaOperation(); @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index faadad27a55..af10791590b 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -27,23 +27,26 @@ extern "C" { #include "RE_pipeline.h" } -GaussianBokehBlurOperation::GaussianBokehBlurOperation(): BlurBaseOperation() { +GaussianBokehBlurOperation::GaussianBokehBlurOperation(): BlurBaseOperation() +{ this->gausstab = NULL; } -void* GaussianBokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *GaussianBokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ updateGauss(memoryBuffers); - void* buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); + void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); return buffer; } -void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { +void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) +{ if (this->gausstab == NULL) { float radxf; float radyf; int n; - float* dgauss; - float* ddgauss; + float *dgauss; + float *ddgauss; float val; int j, i; const float width = this->getWidth(); @@ -52,56 +55,57 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { radxf = size*(float)this->data->sizex; if (radxf>width/2.0f) - radxf= width/2.0f; + radxf = width/2.0f; else if (radxf<1.0f) - radxf= 1.0f; + radxf = 1.0f; /* vertical */ radyf = size*(float)this->data->sizey; if (radyf>height/2.0f) - radyf= height/2.0f; + radyf = height/2.0f; else if (radyf<1.0f) - radyf= 1.0f; + radyf = 1.0f; - radx= ceil(radxf); - rady= ceil(radyf); + radx = ceil(radxf); + rady = ceil(radyf); n = (2*radx+1)*(2*rady+1); /* create a full filter image */ - ddgauss= new float[n]; - dgauss= ddgauss; - val= 0.0f; + ddgauss = new float[n]; + dgauss = ddgauss; + val = 0.0f; for (j=-rady; j<=rady; j++) { for (i=-radx; i<=radx; i++, dgauss++) { - float fj= (float)j/radyf; - float fi= (float)i/radxf; - float dist= sqrt(fj*fj + fi*fi); - *dgauss= RE_filter_value(this->data->filtertype, dist); + float fj = (float)j / radyf; + float fi = (float)i / radxf; + float dist = sqrt(fj * fj + fi * fi); + *dgauss = RE_filter_value(this->data->filtertype, dist); val+= *dgauss; } } if (val!=0.0f) { - val= 1.0f/val; - for (j= n -1; j>=0; j--) + val = 1.0f/val; + for (j = n - 1; j>=0; j--) ddgauss[j]*= val; } - else ddgauss[4]= 1.0f; + else ddgauss[4] = 1.0f; gausstab = ddgauss; } } -void GaussianBokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ float tempColor[4]; tempColor[0] = 0; tempColor[1] = 0; tempColor[2] = 0; tempColor[3] = 0; float overallmultiplyer = 0; - MemoryBuffer* inputBuffer = (MemoryBuffer*)data; - float* buffer = inputBuffer->getBuffer(); + MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; int bufferstarty = inputBuffer->getRect()->ymin; @@ -138,13 +142,15 @@ void GaussianBokehBlurOperation::executePixel(float* color, int x, int y, Memory color[3] = tempColor[3]*divider; } -void GaussianBokehBlurOperation::deinitExecution() { +void GaussianBokehBlurOperation::deinitExecution() +{ BlurBaseOperation::deinitExecution(); delete this->gausstab; this->gausstab = NULL; } -bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; rcti sizeInput; sizeInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h index 806f77fd375..a7a0ee74364 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h @@ -28,18 +28,18 @@ class GaussianBokehBlurOperation : public BlurBaseOperation { private: - float* gausstab; + float *gausstab; int radx, rady; void updateGauss(MemoryBuffer **memoryBuffers); public: GaussianBokehBlurOperation(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Deinitialize the execution diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index 7ac8fcb2d64..276efd90740 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -27,40 +27,43 @@ extern "C" { #include "RE_pipeline.h" } -GaussianXBlurOperation::GaussianXBlurOperation(): BlurBaseOperation() { +GaussianXBlurOperation::GaussianXBlurOperation(): BlurBaseOperation() +{ this->gausstab = NULL; this->rad = 0; } -void* GaussianXBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *GaussianXBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ updateGauss(memoryBuffers); - void* buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); + void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); return buffer; } -void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { +void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) +{ if (this->gausstab == NULL) { updateSize(memoryBuffers); float rad = size*this->data->sizex; if (rad<1) - rad= 1; + rad = 1; this->rad = rad; this->gausstab = BlurBaseOperation::make_gausstab(rad); } } -void GaussianXBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { - +void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ float tempColor[4]; tempColor[0] = 0; tempColor[1] = 0; tempColor[2] = 0; tempColor[3] = 0; float overallmultiplyer = 0; - MemoryBuffer* inputBuffer = (MemoryBuffer*)data; - float* buffer = inputBuffer->getBuffer(); + MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; int bufferstarty = inputBuffer->getRect()->ymin; @@ -94,13 +97,15 @@ void GaussianXBlurOperation::executePixel(float* color, int x, int y, MemoryBuff color[3] = tempColor[3]*divider; } -void GaussianXBlurOperation::deinitExecution() { +void GaussianXBlurOperation::deinitExecution() +{ BlurBaseOperation::deinitExecution(); delete this->gausstab; this->gausstab = NULL; } -bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; rcti sizeInput; sizeInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h index 6b6eb4d80f9..704d063d28f 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h @@ -27,7 +27,7 @@ class GaussianXBlurOperation : public BlurBaseOperation { private: - float* gausstab; + float *gausstab; int rad; void updateGauss(MemoryBuffer **memoryBuffers); public: @@ -36,14 +36,14 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void *data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Deinitialize the execution */ void deinitExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; #endif diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index 2218334bec8..faef152dc31 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -27,39 +27,42 @@ extern "C" { #include "RE_pipeline.h" } -GaussianYBlurOperation::GaussianYBlurOperation(): BlurBaseOperation() { +GaussianYBlurOperation::GaussianYBlurOperation(): BlurBaseOperation() +{ this->gausstab = NULL; this->rad = 0; } -void* GaussianYBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *GaussianYBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ updateGauss(memoryBuffers); - void* buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); + void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); return buffer; } -void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { +void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) +{ if (this->gausstab == NULL) { updateSize(memoryBuffers); float rad = size*this->data->sizey; if (rad<1) - rad= 1; + rad = 1; this->rad = rad; this->gausstab = BlurBaseOperation::make_gausstab(rad); } } -void GaussianYBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { - +void GaussianYBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ float tempColor[4]; tempColor[0] = 0; tempColor[1] = 0; tempColor[2] = 0; tempColor[3] = 0; float overallmultiplyer = 0; - MemoryBuffer* inputBuffer = (MemoryBuffer*)data; - float* buffer = inputBuffer->getBuffer(); + MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; int bufferstarty = inputBuffer->getRect()->ymin; @@ -91,13 +94,15 @@ void GaussianYBlurOperation::executePixel(float* color, int x, int y, MemoryBuff color[3] = tempColor[3]*divider; } -void GaussianYBlurOperation::deinitExecution() { +void GaussianYBlurOperation::deinitExecution() +{ BlurBaseOperation::deinitExecution(); delete this->gausstab; this->gausstab = NULL; } -bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; rcti sizeInput; sizeInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h index 5c116e80a71..c9baf27b1d6 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h @@ -27,7 +27,7 @@ class GaussianYBlurOperation : public BlurBaseOperation { private: - float* gausstab; + float *gausstab; int rad; void updateGauss(MemoryBuffer **memoryBuffers); public: @@ -36,14 +36,14 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void *data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Deinitialize the execution */ void deinitExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; #endif diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp index b86c61ea9da..6715d50bb95 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp @@ -23,21 +23,24 @@ #include "COM_GlareBaseOperation.h" #include "BLI_math.h" -GlareBaseOperation::GlareBaseOperation(): NodeOperation() { +GlareBaseOperation::GlareBaseOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->settings = NULL; this->cachedInstance = NULL; setComplex(true); } -void GlareBaseOperation::initExecution() { +void GlareBaseOperation::initExecution() +{ initMutex(); this->inputProgram = getInputSocketReader(0); this->cachedInstance = NULL; } -void GlareBaseOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { - float* buffer = (float*) data; +void GlareBaseOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)\ +{ + float *buffer = (float*) data; int index = (y*this->getWidth() + x) * COM_NUMBER_OF_CHANNELS; color[0] = buffer[index]; color[1] = buffer[index+1]; @@ -45,7 +48,8 @@ void GlareBaseOperation::executePixel(float* color, int x, int y, MemoryBuffer * color[3] = buffer[index+3]; } -void GlareBaseOperation::deinitExecution() { +void GlareBaseOperation::deinitExecution() +{ deinitMutex(); this->inputProgram = NULL; if (this->cachedInstance) { @@ -53,11 +57,12 @@ void GlareBaseOperation::deinitExecution() { this->cachedInstance = NULL; } } -void* GlareBaseOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *GlareBaseOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ BLI_mutex_lock(getMutex()); if (this->cachedInstance == NULL) { - MemoryBuffer* tile = (MemoryBuffer*)inputProgram->initializeTileData(rect, memoryBuffers); - float* data = new float[this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS]; + MemoryBuffer *tile = (MemoryBuffer*)inputProgram->initializeTileData(rect, memoryBuffers); + float *data = new float[this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS]; this->generateGlare(data, tile, this->settings); this->cachedInstance = data; } @@ -65,7 +70,8 @@ void* GlareBaseOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu return this->cachedInstance; } -bool GlareBaseOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool GlareBaseOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.xmax = this->getWidth(); newInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h index 4233e6150a2..e06244d3cdd 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.h +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h @@ -37,14 +37,14 @@ private: */ NodeGlare * settings; - float* cachedInstance; + float *cachedInstance; public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution @@ -56,14 +56,14 @@ public: */ void deinitExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); void setGlareSettings(NodeGlare * settings) {this->settings = settings;} bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); protected: GlareBaseOperation(); - virtual void generateGlare(float* data, MemoryBuffer* inputTile, NodeGlare* settings) = 0; + virtual void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) = 0; }; diff --git a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp index ce3fd82acf0..602e18521ee 100644 --- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp @@ -22,14 +22,15 @@ #include "COM_GlareSimpleStarOperation.h" -void GlareSimpleStarOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) { +void GlareSimpleStarOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) +{ int i, x, y, ym, yp, xm, xp; float c[4] = {0,0,0,0}, tc[4] = {0,0,0,0}; const float f1 = 1.f - settings->fade, f2 = (1.f - f1)*0.5f; - MemoryBuffer* tbuf1 = inputTile->duplicate(); - MemoryBuffer* tbuf2 = inputTile->duplicate(); + MemoryBuffer *tbuf1 = inputTile->duplicate(); + MemoryBuffer *tbuf2 = inputTile->duplicate(); for (i=0; i<settings->iter; i++) { // // (x || x-1, y-1) to (x || x+1, y+1) diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp b/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp index 177bb6e0730..42b6a2b5e50 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp @@ -23,7 +23,8 @@ #include "COM_GlareStreaksOperation.h" #include "BLI_math.h" -void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) { +void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) +{ int x, y, n; unsigned int nump=0; float c1[4], c2[4], c3[4], c4[4]; @@ -33,8 +34,8 @@ void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile, int size4 = size*4; - MemoryBuffer* tsrc = inputTile->duplicate(); - MemoryBuffer* tdst = new MemoryBuffer(NULL, inputTile->getRect()); + MemoryBuffer *tsrc = inputTile->duplicate(); + MemoryBuffer *tdst = new MemoryBuffer(NULL, inputTile->getRect()); tdst->clear(); memset(data, 0, size4*sizeof(float)); @@ -46,7 +47,7 @@ void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile, const float vxp = vx*p4, vyp = vy*p4; const float wt = pow((double)settings->fade, (double)p4); const float cmo = 1.f - (float)pow((double)settings->colmod, (double)n+1); // colormodulation amount relative to current pass - float* tdstcol = tdst->getBuffer(); + float *tdstcol = tdst->getBuffer(); for (y=0; y<tsrc->getHeight(); ++y) { for (x=0; x<tsrc->getWidth(); ++x, tdstcol+=4) { // first pass no offset, always same for every pass, exact copy, @@ -75,7 +76,7 @@ void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile, } // addImage(sbuf, tsrc, 1.f/(float)(6 - ndg->iter)); // add result to data @todo - float* sourcebuffer = tsrc->getBuffer(); + float *sourcebuffer = tsrc->getBuffer(); float factor = 1.f/(float)(6 - settings->iter); for (int i = 0 ; i < size4; i ++) { data[i] += sourcebuffer[i] * factor; diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp index cc8bda2730e..e8def72b7da 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp @@ -23,16 +23,19 @@ #include "COM_GlareThresholdOperation.h" #include "BLI_math.h" -GlareThresholdOperation::GlareThresholdOperation(): NodeOperation() { +GlareThresholdOperation::GlareThresholdOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputProgram = NULL; } -void GlareThresholdOperation::initExecution() { +void GlareThresholdOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); } -void GlareThresholdOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void GlareThresholdOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ this->inputProgram->read(color, x, y, sampler, inputBuffers); if ((0.212671f*color[0] + 0.71516f*color[1] + 0.072169f*color[2]) >= threshold) { color[0] -= threshold, color[1] -= threshold, color[2] -= threshold; @@ -43,6 +46,7 @@ void GlareThresholdOperation::executePixel(float* color, float x, float y, Pixel else color[0] = color[1] = color[2] = 0.f; } -void GlareThresholdOperation::deinitExecution() { +void GlareThresholdOperation::deinitExecution() +{ this->inputProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.h b/source/blender/compositor/operations/COM_GlareThresholdOperation.h index 3d68181ae47..3dfa2f44339 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.h +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.h @@ -40,7 +40,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp index d5d577e91a9..2970c396493 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp @@ -32,18 +32,21 @@ extern "C" { } #endif -HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation(): CurveBaseOperation() { +HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation(): CurveBaseOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputProgram = NULL; } -void HueSaturationValueCorrectOperation::initExecution() { +void HueSaturationValueCorrectOperation::initExecution() +{ CurveBaseOperation::initExecution(); this->inputProgram = this->getInputSocketReader(0); } -void HueSaturationValueCorrectOperation::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void HueSaturationValueCorrectOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float hsv[4], f; this->inputProgram->read(hsv, x, y, sampler, inputBuffers); @@ -63,12 +66,13 @@ void HueSaturationValueCorrectOperation::executePixel(float* output, float x, fl hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */ CLAMP(hsv[1], 0.f, 1.f); - output[0]= hsv[0]; - output[1]= hsv[1]; - output[2]= hsv[2]; - output[3]= hsv[3]; + output[0] = hsv[0]; + output[1] = hsv[1]; + output[2] = hsv[2]; + output[3] = hsv[3]; } -void HueSaturationValueCorrectOperation::deinitExecution() { +void HueSaturationValueCorrectOperation::deinitExecution() +{ this->inputProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h index 472a85f5531..860bb71a0f1 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h @@ -37,7 +37,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* Vector, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *Vector, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cpp b/source/blender/compositor/operations/COM_IDMaskOperation.cpp index 198248e35a3..834ca4fc5ed 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_IDMaskOperation.cpp @@ -22,16 +22,19 @@ #include "COM_IDMaskOperation.h" -IDMaskOperation::IDMaskOperation(): NodeOperation() { +IDMaskOperation::IDMaskOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->inputProgram = NULL; } -void IDMaskOperation::initExecution() { +void IDMaskOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); } -void IDMaskOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void IDMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue[4]; this->inputProgram->read(inputValue, x, y, sampler, inputBuffers); @@ -39,7 +42,8 @@ void IDMaskOperation::executePixel(float* color, float x, float y, PixelSampler color[0] = a; } -void IDMaskOperation::deinitExecution() { +void IDMaskOperation::deinitExecution() +{ this->inputProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.h b/source/blender/compositor/operations/COM_IDMaskOperation.h index 3b22be16d8a..9f897c53d18 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.h +++ b/source/blender/compositor/operations/COM_IDMaskOperation.h @@ -30,7 +30,7 @@ private: /** * Cached reference to the inputProgram */ - SocketReader* inputProgram; + SocketReader *inputProgram; float objectIndex; public: @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp index f4cea24cb20..be3d9e80337 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cpp +++ b/source/blender/compositor/operations/COM_ImageOperation.cpp @@ -36,7 +36,8 @@ extern "C" { #include "IMB_imbuf_types.h" } -BaseImageOperation::BaseImageOperation(): NodeOperation() { +BaseImageOperation::BaseImageOperation(): NodeOperation() +{ this->image = NULL; this->buffer = NULL; this->imageBuffer = NULL; @@ -47,20 +48,24 @@ BaseImageOperation::BaseImageOperation(): NodeOperation() { this->depthBuffer = NULL; this->numberOfChannels = 0; } -ImageOperation::ImageOperation(): BaseImageOperation() { +ImageOperation::ImageOperation(): BaseImageOperation() +{ this->addOutputSocket(COM_DT_COLOR); } -ImageAlphaOperation::ImageAlphaOperation(): BaseImageOperation() { +ImageAlphaOperation::ImageAlphaOperation(): BaseImageOperation() +{ this->addOutputSocket(COM_DT_VALUE); } -ImageDepthOperation::ImageDepthOperation(): BaseImageOperation() { +ImageDepthOperation::ImageDepthOperation(): BaseImageOperation() +{ this->addOutputSocket(COM_DT_VALUE); } -ImBuf* BaseImageOperation::getImBuf() { +ImBuf *BaseImageOperation::getImBuf() +{ ImBuf *ibuf; - ibuf= BKE_image_get_ibuf(this->image, this->imageUser); + ibuf = BKE_image_get_ibuf(this->image, this->imageUser); if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { return NULL; } @@ -72,8 +77,9 @@ ImBuf* BaseImageOperation::getImBuf() { } -void BaseImageOperation::initExecution() { - ImBuf *stackbuf= getImBuf(); +void BaseImageOperation::initExecution() +{ + ImBuf *stackbuf = getImBuf(); this->buffer = stackbuf; if (stackbuf) { this->imageBuffer = stackbuf->rect_float; @@ -84,19 +90,22 @@ void BaseImageOperation::initExecution() { } } -void BaseImageOperation::deinitExecution() { - this->imageBuffer= NULL; +void BaseImageOperation::deinitExecution() +{ + this->imageBuffer = NULL; } -void BaseImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { - ImBuf *stackbuf= getImBuf(); +void BaseImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ + ImBuf *stackbuf = getImBuf(); if (stackbuf) { resolution[0] = stackbuf->x; resolution[1] = stackbuf->y; } } -void ImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])\ +{ if (this->imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) { color[0] = 0.0f; color[1] = 0.0f; @@ -118,7 +127,8 @@ void ImageOperation::executePixel(float *color, float x, float y, PixelSampler s } } -void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float tempcolor[4]; if (this->imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) { @@ -141,7 +151,8 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp } } -void ImageDepthOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ImageDepthOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ if (this->depthBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) { color[0] = 0.0f; } diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h index a5e2c753b59..0bd112304a8 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.h +++ b/source/blender/compositor/operations/COM_ImageOperation.h @@ -40,9 +40,9 @@ extern "C" { */ class BaseImageOperation : public NodeOperation { protected: - ImBuf* buffer; - Image* image; - ImageUser* imageUser; + ImBuf *buffer; + Image *image; + ImageUser *imageUser; float *imageBuffer; float *depthBuffer; int imageheight; @@ -56,14 +56,14 @@ protected: */ void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); - virtual ImBuf* getImBuf(); + virtual ImBuf *getImBuf(); public: void initExecution(); void deinitExecution(); - void setImage(Image* image) {this->image = image;} - void setImageUser(ImageUser* imageuser) {this->imageUser = imageuser;} + void setImage(Image *image) {this->image = image;} + void setImageUser(ImageUser *imageuser) {this->imageUser = imageuser;} void setFramenumber(int framenumber) {this->framenumber = framenumber;} }; diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp index baf8699603c..982fe1a5450 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.cpp +++ b/source/blender/compositor/operations/COM_InvertOperation.cpp @@ -22,7 +22,8 @@ #include "COM_InvertOperation.h" -InvertOperation::InvertOperation(): NodeOperation() { +InvertOperation::InvertOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -32,12 +33,14 @@ InvertOperation::InvertOperation(): NodeOperation() { this->alpha = false; setResolutionInputSocketIndex(1); } -void InvertOperation::initExecution() { +void InvertOperation::initExecution() +{ this->inputValueProgram = this->getInputSocketReader(0); this->inputColorProgram = this->getInputSocketReader(1); } -void InvertOperation::executePixel(float* out, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void InvertOperation::executePixel(float *out, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue[4]; float inputColor[4]; this->inputValueProgram->read(inputValue, x, y, sampler, inputBuffers); @@ -64,7 +67,8 @@ void InvertOperation::executePixel(float* out, float x, float y, PixelSampler sa } -void InvertOperation::deinitExecution() { +void InvertOperation::deinitExecution() +{ this->inputValueProgram = NULL; this->inputColorProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_InvertOperation.h b/source/blender/compositor/operations/COM_InvertOperation.h index 6baa10a3d62..27a995238c7 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.h +++ b/source/blender/compositor/operations/COM_InvertOperation.h @@ -42,7 +42,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_LensGhostOperation.cpp b/source/blender/compositor/operations/COM_LensGhostOperation.cpp index 89387675090..e99bbb536f7 100644 --- a/source/blender/compositor/operations/COM_LensGhostOperation.cpp +++ b/source/blender/compositor/operations/COM_LensGhostOperation.cpp @@ -33,7 +33,7 @@ public: double wavelength; float intensity; bool valid; - void copyFrom(Ray* other) { + void copyFrom(Ray *other) { copy_v3_v3(position, other->position); copy_v3_v3(direction, other->direction); copy_v2_v2(uv, other->uv); @@ -62,7 +62,7 @@ public: double refraction3; float thicknessCoathing; virtual bool isFlat() = 0; - virtual void intersect(Intersection* result, Ray* ray) = 0; + virtual void intersect(Intersection *result, Ray *ray) = 0; }; class FlatInterface: public LensInterface { @@ -80,7 +80,7 @@ public: this->thicknessCoathing = 0.0f; } - void intersect(Intersection* result, Ray* ray) { + void intersect(Intersection *result, Ray *ray) { const float dz = this->position[2]-ray->position[2]; result->position[0] = ray->position[0] + ray->direction[0]*(dz)/ray->direction[2]; result->position[1] = ray->position[1] + ray->direction[1]*(dz)/ray->direction[2]; @@ -110,7 +110,7 @@ public: this->thicknessCoathing = coatingPhase/4/this->refraction2; } bool isFlat() {return false;} - void intersect(Intersection* result, Ray* ray) { + void intersect(Intersection *result, Ray *ray) { float delta[3] ={ray->position[0] - this->position[0], ray->position[1] - this->position[1], ray->position[2] - this->position[2]}; @@ -200,7 +200,7 @@ public: } - RayResult* getRayResult(int x, int y) { + RayResult *getRayResult(int x, int y) { return &(raster[x+y*rasterLength]); } }; @@ -222,7 +222,7 @@ public: for (int j = i+1; j < interfaces.size()-1 ; j ++) { if (!interfaces[j]->isFlat()) { int length = interfaces.size()+2*(j-i); - Bounce* bounce = new Bounce(interfaces[j], interfaces[i], length, step); + Bounce *bounce = new Bounce(interfaces[j], interfaces[i], length, step); bounces.push_back(bounce); } } @@ -231,7 +231,7 @@ public: } - void addInterface(LensInterface* pinterface) { + void addInterface(LensInterface *pinterface) { this->interfaces.push_back(pinterface); this->lensIndex = this->interfaces.size()-1; } @@ -245,23 +245,23 @@ public: // VECCOPY(refract, view); -// dot= view[0]*n[0] + view[1]*n[1] + view[2]*n[2]; +// dot = view[0]*n[0] + view[1]*n[1] + view[2]*n[2]; // if (dot>0.0f) { // index = 1.0f/index; -// fac= 1.0f - (1.0f - dot*dot)*index*index; +// fac = 1.0f - (1.0f - dot*dot)*index*index; // if (fac<= 0.0f) return 0; // fac= -dot*index + sqrt(fac); // } // else { -// fac= 1.0f - (1.0f - dot*dot)*index*index; +// fac = 1.0f - (1.0f - dot*dot)*index*index; // if (fac<= 0.0f) return 0; // fac= -dot*index - sqrt(fac); // } -// refract[0]= index*view[0] + fac*n[0]; -// refract[1]= index*view[1] + fac*n[1]; -// refract[2]= index*view[2] + fac*n[2]; +// refract[0] = index*view[0] + fac*n[0]; +// refract[1] = index*view[1] + fac*n[1]; +// refract[2] = index*view[2] + fac*n[2]; // normalize_v3(refract); // return 1; @@ -301,9 +301,9 @@ public: f1= -2.0f*dot_v3v3(n, view); - ref[0]= (view[0]+f1*n[0]); - ref[1]= (view[1]+f1*n[1]); - ref[2]= (view[2]+f1*n[2]); + ref[0] = (view[0]+f1*n[0]); + ref[1] = (view[1]+f1*n[1]); + ref[2] = (view[2]+f1*n[2]); normalize_v3(ref); } @@ -334,15 +334,15 @@ public: return ( out_s2+out_p2 ) / 2 ; } - void detectHit(Ray* result, Ray* inputRay, Bounce *bounce) { + void detectHit(Ray *result, Ray *inputRay, Bounce *bounce) { int phase = 0; int delta = 1; int t = 1; int k; result->copyFrom(inputRay); result->valid = false; - LensInterface* next = bounce->interface1; - LensInterface* f = NULL; + LensInterface *next = bounce->interface1; + LensInterface *f = NULL; Intersection intersection; for (k = 0 ; k < bounce->length-1;k++, t+=delta) { f = this->interfaces[t]; @@ -425,12 +425,13 @@ public: }; typedef struct LensFace { - RayResult* v1; - RayResult* v2; - RayResult* v3; + RayResult *v1; + RayResult *v2; + RayResult *v3; } LensFace; -LensGhostProjectionOperation::LensGhostProjectionOperation(): NodeOperation() { +LensGhostProjectionOperation::LensGhostProjectionOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); @@ -441,12 +442,14 @@ LensGhostProjectionOperation::LensGhostProjectionOperation(): NodeOperation() { this->setComplex(false); } -LensGhostOperation::LensGhostOperation(): LensGhostProjectionOperation() { +LensGhostOperation::LensGhostOperation(): LensGhostProjectionOperation() +{ this->setComplex(true); } -void LensGhostProjectionOperation::initExecution() { +void LensGhostProjectionOperation::initExecution() +{ if (this->cameraObject != NULL && this->lampObject != NULL) { if (lampObject == NULL || cameraObject == NULL) { visualLampPosition[0] = 0; @@ -491,7 +494,7 @@ void LensGhostProjectionOperation::initExecution() { system->addInterface(new SphereInterface(0.0f,0.0f, 6 CM, 3 CM, 2 CM, AIR, GLASS, 0.0f)); system->addInterface(new SphereInterface(0.0f,0.0f, 5.5 CM, 3 CM, 2 CM, GLASS, AIR, 0.f)); system->addInterface(new FlatInterface(0.0f,0.0f,0 CM, 30 MM)); // SENSOR - system->bokehIndex =3; + system->bokehIndex = 3; // determine interfaces // LensSystem *system = new LensSystem(); @@ -510,7 +513,8 @@ void LensGhostProjectionOperation::initExecution() { this->system = system; } -void LensGhostOperation::initExecution() { +void LensGhostOperation::initExecution() +{ LensGhostProjectionOperation::initExecution(); LensSystem *system = (LensSystem*)this->system; LensInterface *interface1 = system->interfaces[0]; @@ -521,7 +525,7 @@ void LensGhostOperation::initExecution() { float wavelength = HERZ[iw]; // for every bounce for (int ib = 0 ; ib < system->bounces.size() ; ib++) { - Bounce* bounce = system->bounces[ib]; + Bounce *bounce = system->bounces[ib]; // based on quality setting the number of iteration will be different (128^2, 64^2, 32^2) for (int xi = 0 ; xi < step ; xi ++) { float x = -interface1->radius+xi*(interface1->radius*2/step); @@ -572,11 +576,11 @@ void LensGhostOperation::initExecution() { // LensSystem *system = (LensSystem*)this->system; LensInterface * lens = system->interfaces[system->lensIndex]; for (int i = 0 ; i < system->bounces.size() ; i ++) { - Bounce* bounce = system->bounces[i]; + Bounce *bounce = system->bounces[i]; for (int r = 0 ; r < bounce->rasterLength*bounce->rasterLength ; r ++) { RayResult *result = &bounce->raster[r]; // if (result->valid) { - float ru= result->x/lens->nominalRadius*width2+width2; + float ru = result->x/lens->nominalRadius*width2+width2; float rv = result->y/lens->nominalRadius*height2+height2; result->screenX = ru; result->screenY = rv; @@ -586,7 +590,8 @@ void LensGhostOperation::initExecution() { } } -void* LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ vector<LensFace*>* result = new vector<LensFace*>(); LensSystem *system = (LensSystem*)this->system; const float minx = rect->xmin; @@ -594,22 +599,22 @@ void* LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu const float maxx = rect->xmax; const float maxy = rect->ymax; for (int i = 0 ; i < system->bounces.size() ; i ++) { - Bounce* bounce = system->bounces[i]; + Bounce *bounce = system->bounces[i]; int faceX, faceY; for (faceX = 0 ; faceX < bounce->rasterLength-1 ; faceX++) { for (faceY = 0 ; faceY < bounce->rasterLength-1 ; faceY++) { - RayResult* vertex1 = bounce->getRayResult(faceX, faceY); - RayResult* vertex2 = bounce->getRayResult(faceX+1, faceY); - RayResult* vertex3 = bounce->getRayResult(faceX+1, faceY+1); - RayResult* vertex4 = bounce->getRayResult(faceX, faceY+1); + RayResult *vertex1 = bounce->getRayResult(faceX, faceY); + RayResult *vertex2 = bounce->getRayResult(faceX+1, faceY); + RayResult *vertex3 = bounce->getRayResult(faceX+1, faceY+1); + RayResult *vertex4 = bounce->getRayResult(faceX, faceY+1); // early hit test if (!((vertex1->screenX < minx && vertex2->screenX < minx && vertex3->screenX < minx && vertex4->screenX < minx) || (vertex1->screenX > maxx && vertex2->screenX > maxx && vertex3->screenX > maxx && vertex4->screenX > maxx) || (vertex1->screenY < miny && vertex2->screenY < miny && vertex3->screenY < miny && vertex4->screenY < miny) || (vertex1->screenY > maxy && vertex2->screenY > maxy && vertex3->screenY > maxy && vertex4->screenY > maxy))) { - int number = vertex1->hasIntensity +vertex2->hasIntensity +vertex3->hasIntensity +vertex4->hasIntensity; + int number = vertex1->hasIntensity + vertex2->hasIntensity + vertex3->hasIntensity + vertex4->hasIntensity; if (number == 4) { - LensFace* face = new LensFace(); + LensFace *face = new LensFace(); face->v1 = vertex1; face->v2 = vertex2; face->v3 = vertex3; @@ -652,7 +657,8 @@ void* LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu return result; } -void LensGhostOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) { +void LensGhostOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) +{ if (data) { vector<LensFace*>* faces = (vector<LensFace*>*)data; while (faces->size() != 0) { @@ -665,7 +671,8 @@ void LensGhostOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryB } -void LensGhostProjectionOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void LensGhostProjectionOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float bokeh[4]; LensSystem *system = (LensSystem*)this->system; LensInterface *interface1 = system->interfaces[0]; @@ -696,7 +703,7 @@ void LensGhostProjectionOperation::executePixel(float* color, float x, float y, // for every bounce for (int ib = 0 ; ib < system->bounces.size() ; ib++) { - Bounce* bounce = system->bounces[ib]; + Bounce *bounce = system->bounces[ib]; // based on quality setting the number of iteration will be different (128^2, 64^2, 32^2) Ray r; @@ -732,7 +739,8 @@ void LensGhostProjectionOperation::executePixel(float* color, float x, float y, -void LensGhostOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void LensGhostOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ vector<LensFace*>* faces = (vector<LensFace*>*)data; #if 0 /* UNUSED */ const float bokehWidth = bokehReader->getWidth(); @@ -747,9 +755,9 @@ void LensGhostOperation::executePixel(float* color, int x, int y, MemoryBuffer * unsigned int index; for (index = 0 ; index < faces->size() ; index ++) { LensFace * face = faces->operator [](index); - RayResult* vertex1 = face->v1; - RayResult* vertex2 = face->v2; - RayResult* vertex3 = face->v3; + RayResult *vertex1 = face->v1; + RayResult *vertex2 = face->v2; + RayResult *vertex3 = face->v3; if (!((vertex1->screenX < x && vertex2->screenX < x && vertex3->screenX < x) || (vertex1->screenX > x && vertex2->screenX > x && vertex3->screenX > x) || (vertex1->screenY < y && vertex2->screenY < y && vertex3->screenY < y) || @@ -783,13 +791,15 @@ void LensGhostOperation::executePixel(float* color, int x, int y, MemoryBuffer * } -void LensGhostProjectionOperation::deinitExecution() { +void LensGhostProjectionOperation::deinitExecution() +{ if (this->system) delete (LensSystem*)this->system; this->system = NULL; this->bokehReader = NULL; } -bool LensGhostProjectionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool LensGhostProjectionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti bokehInput; NodeOperation *operation = this->getInputOperation(1); diff --git a/source/blender/compositor/operations/COM_LensGhostOperation.h b/source/blender/compositor/operations/COM_LensGhostOperation.h index 396f681e797..5546ce96fd1 100644 --- a/source/blender/compositor/operations/COM_LensGhostOperation.h +++ b/source/blender/compositor/operations/COM_LensGhostOperation.h @@ -29,11 +29,11 @@ class LensGhostProjectionOperation : public NodeOperation { protected: - Object* lampObject; - Lamp* lamp; - Object* cameraObject; + Object *lampObject; + Lamp *lamp; + Object *cameraObject; - void* system; + void *system; float visualLampPosition[3]; CompositorQuality quality; int step; @@ -45,7 +45,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution @@ -58,8 +58,8 @@ public: void deinitExecution(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - void setLampObject(Object* lampObject) {this->lampObject = lampObject;} - void setCameraObject(Object* cameraObject) {this->cameraObject = cameraObject;} + void setLampObject(Object *lampObject) {this->lampObject = lampObject;} + void setCameraObject(Object *cameraObject) {this->cameraObject = cameraObject;} void setQuality(CompositorQuality quality) {this->quality = quality;} }; @@ -68,12 +68,12 @@ class LensGhostOperation : public LensGhostProjectionOperation { public: LensGhostOperation(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data); /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data); /** * Initialize the execution */ diff --git a/source/blender/compositor/operations/COM_LensGlowImageOperation.cpp b/source/blender/compositor/operations/COM_LensGlowImageOperation.cpp index 935844a84f1..ee0a02e5fae 100644 --- a/source/blender/compositor/operations/COM_LensGlowImageOperation.cpp +++ b/source/blender/compositor/operations/COM_LensGlowImageOperation.cpp @@ -23,13 +23,16 @@ #include "COM_LensGlowImageOperation.h" #include "BLI_math.h" -LensGlowImageOperation::LensGlowImageOperation(): NodeOperation() { +LensGlowImageOperation::LensGlowImageOperation(): NodeOperation() +{ this->addOutputSocket(COM_DT_COLOR); } -void LensGlowImageOperation::initExecution() { +void LensGlowImageOperation::initExecution() +{ this->scale = 1/20000.0f; } -void LensGlowImageOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void LensGlowImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ const float cs_r = 1.f, cs_g = 1.f, cs_b = 1.f; const float v = 2.f*(y / (float)512.0f) - 1.f; const float u = 2.f*(x / (float)512.0f) - 1.f; @@ -42,10 +45,12 @@ void LensGlowImageOperation::executePixel(float* color, float x, float y, PixelS color[3] = 1.0f; } -void LensGlowImageOperation::deinitExecution() { +void LensGlowImageOperation::deinitExecution() +{ } -void LensGlowImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void LensGlowImageOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ resolution[0] = 512; resolution[1] = 512; } diff --git a/source/blender/compositor/operations/COM_LensGlowImageOperation.h b/source/blender/compositor/operations/COM_LensGlowImageOperation.h index 2943f8957a6..424b4d4fc3d 100644 --- a/source/blender/compositor/operations/COM_LensGlowImageOperation.h +++ b/source/blender/compositor/operations/COM_LensGlowImageOperation.h @@ -35,7 +35,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_LensGlowOperation.cpp b/source/blender/compositor/operations/COM_LensGlowOperation.cpp index ecaef52d8e1..492dc715f10 100644 --- a/source/blender/compositor/operations/COM_LensGlowOperation.cpp +++ b/source/blender/compositor/operations/COM_LensGlowOperation.cpp @@ -23,17 +23,20 @@ #include "COM_LensGlowOperation.h" #include "BLI_math.h" -LensGlowOperation::LensGlowOperation(): NodeOperation() { +LensGlowOperation::LensGlowOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->inputProgram = NULL; this->lamp = NULL; } -void LensGlowOperation::initExecution() { +void LensGlowOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); } -void LensGlowOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void LensGlowOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ // const float emit100 = this->lamp->energy*100; // const float emit200 = emit100*2; // const float deltaX = 160-x; @@ -49,6 +52,7 @@ void LensGlowOperation::executePixel(float* color, float x, float y, PixelSample // color[3] = 1.0f; } -void LensGlowOperation::deinitExecution() { +void LensGlowOperation::deinitExecution() +{ this->inputProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_LensGlowOperation.h b/source/blender/compositor/operations/COM_LensGlowOperation.h index 9a18f605cda..77e13e88418 100644 --- a/source/blender/compositor/operations/COM_LensGlowOperation.h +++ b/source/blender/compositor/operations/COM_LensGlowOperation.h @@ -31,7 +31,7 @@ private: * Cached reference to the inputProgram */ SocketReader * inputProgram; - Lamp* lamp; + Lamp *lamp; public: LensGlowOperation(); @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution @@ -51,6 +51,6 @@ public: */ void deinitExecution(); - void setLamp(Lamp* lamp) {this->lamp = lamp;} + void setLamp(Lamp *lamp) {this->lamp = lamp;} }; #endif diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp index 3e8a5ed3344..f206bf4df8e 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp @@ -22,22 +22,26 @@ #include "COM_LuminanceMatteOperation.h" #include "BLI_math.h" -LuminanceMatteOperation::LuminanceMatteOperation(): NodeOperation() { +LuminanceMatteOperation::LuminanceMatteOperation(): NodeOperation() +{ addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); inputImageProgram = NULL; } -void LuminanceMatteOperation::initExecution() { +void LuminanceMatteOperation::initExecution() +{ this->inputImageProgram = this->getInputSocketReader(0); } -void LuminanceMatteOperation::deinitExecution() { - this->inputImageProgram= NULL; +void LuminanceMatteOperation::deinitExecution() +{ + this->inputImageProgram = NULL; } -void LuminanceMatteOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inColor[4]; const float high=this->settings->t1; diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h index 3c33cee71e9..1c2cd2dca51 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h @@ -41,11 +41,11 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); - void setSettings(NodeChroma* nodeChroma) {this->settings= nodeChroma;} + void setSettings(NodeChroma *nodeChroma) {this->settings = nodeChroma;} }; #endif diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index 08790955d03..7b393cc04a8 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -22,7 +22,8 @@ #include "COM_MapUVOperation.h" #include "BLI_math.h" -MapUVOperation::MapUVOperation(): NodeOperation() { +MapUVOperation::MapUVOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_COLOR); @@ -33,12 +34,14 @@ MapUVOperation::MapUVOperation(): NodeOperation() { this->inputColorProgram = NULL; } -void MapUVOperation::initExecution() { +void MapUVOperation::initExecution() +{ this->inputColorProgram = this->getInputSocketReader(0); this->inputUVProgram = this->getInputSocketReader(1); } -void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputUV[4]; float uv_a[4], uv_b[4]; float u,v; @@ -58,36 +61,36 @@ void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler s /* adaptive sampling, red (U) channel */ this->inputUVProgram->read(uv_a, x-1, y, COM_PS_NEAREST, inputBuffers); this->inputUVProgram->read(uv_b, x+1, y, COM_PS_NEAREST, inputBuffers); - uv_l= uv_a[2]!=0.f? fabs(inputUV[0] - uv_a[0]) : 0.f; - uv_r= uv_b[2]!=0.f? fabs(inputUV[0] - uv_b[0]) : 0.f; + uv_l = uv_a[2]!=0.f? fabs(inputUV[0] - uv_a[0]) : 0.f; + uv_r = uv_b[2]!=0.f? fabs(inputUV[0] - uv_b[0]) : 0.f; - dx= 0.5f * (uv_l + uv_r); + dx = 0.5f * (uv_l + uv_r); /* adaptive sampling, green (V) channel */ this->inputUVProgram->read(uv_a, x, y-1, COM_PS_NEAREST, inputBuffers); this->inputUVProgram->read(uv_b, x, y+1, COM_PS_NEAREST, inputBuffers); - uv_u= uv_a[2]!=0.f? fabs(inputUV[1] - uv_a[1]) : 0.f; - uv_d= uv_b[2]!=0.f? fabs(inputUV[1] - uv_b[1]) : 0.f; + uv_u = uv_a[2]!=0.f? fabs(inputUV[1] - uv_a[1]) : 0.f; + uv_d = uv_b[2]!=0.f? fabs(inputUV[1] - uv_b[1]) : 0.f; - dy= 0.5f * (uv_u + uv_d); + dy = 0.5f * (uv_u + uv_d); /* more adaptive sampling, red and green (UV) channels */ this->inputUVProgram->read(uv_a, x-1, y-1, COM_PS_NEAREST, inputBuffers); this->inputUVProgram->read(uv_b, x-1, y+1, COM_PS_NEAREST, inputBuffers); - uv_l= uv_a[2]!=0.f? fabsf(inputUV[0] - uv_a[0]) : 0.f; - uv_r= uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f; - uv_u= uv_a[2]!=0.f? fabsf(inputUV[1] - uv_a[1]) : 0.f; - uv_d= uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f; + uv_l = uv_a[2]!=0.f? fabsf(inputUV[0] - uv_a[0]) : 0.f; + uv_r = uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f; + uv_u = uv_a[2]!=0.f? fabsf(inputUV[1] - uv_a[1]) : 0.f; + uv_d = uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f; dx+= 0.25f * (uv_l + uv_r); dy+= 0.25f * (uv_u + uv_d); this->inputUVProgram->read(uv_a, x+1, y-1, COM_PS_NEAREST, inputBuffers); this->inputUVProgram->read(uv_b, x+1, y+1, COM_PS_NEAREST, inputBuffers); - uv_l= uv_a[2]!=0.f? fabsf(inputUV[0] - uv_a[0]) : 0.f; - uv_r= uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f; - uv_u= uv_a[2]!=0.f? fabsf(inputUV[1] - uv_a[1]) : 0.f; - uv_d= uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f; + uv_l = uv_a[2]!=0.f? fabsf(inputUV[0] - uv_a[0]) : 0.f; + uv_r = uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f; + uv_u = uv_a[2]!=0.f? fabsf(inputUV[1] - uv_a[1]) : 0.f; + uv_d = uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f; dx+= 0.25f * (uv_l + uv_r); dy+= 0.25f * (uv_u + uv_d); @@ -95,12 +98,12 @@ void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler s /* UV to alpha threshold */ const float threshold = this->alpha * 0.05f; float alpha = 1.0f - threshold * (dx + dy); - if (alpha < 0.f) alpha= 0.f; + if (alpha < 0.f) alpha = 0.f; else alpha *= inputUV[2]; /* should use mipmap */ - dx= min(dx, 0.2f); - dy= min(dy, 0.2f); + dx = min(dx, 0.2f); + dy = min(dy, 0.2f); /* EWA filtering */ @@ -118,12 +121,14 @@ void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler s } } -void MapUVOperation::deinitExecution() { +void MapUVOperation::deinitExecution() +{ this->inputUVProgram = NULL; this->inputColorProgram = NULL; } -bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti colorInput; rcti uvInput; NodeOperation *operation=NULL; diff --git a/source/blender/compositor/operations/COM_MapUVOperation.h b/source/blender/compositor/operations/COM_MapUVOperation.h index 58c962eb17c..069f454895d 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.h +++ b/source/blender/compositor/operations/COM_MapUVOperation.h @@ -29,8 +29,8 @@ private: /** * Cached reference to the inputProgram */ - SocketReader* inputUVProgram; - SocketReader* inputColorProgram; + SocketReader *inputUVProgram; + SocketReader *inputColorProgram; float alpha; @@ -45,7 +45,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp index 5a7005af382..bf6d29c0456 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp @@ -22,31 +22,35 @@ #include "COM_MapValueOperation.h" -MapValueOperation::MapValueOperation(): NodeOperation() { +MapValueOperation::MapValueOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->inputOperation = NULL; } -void MapValueOperation::initExecution() { +void MapValueOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void MapValueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MapValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float src[4]; inputOperation->read(src, x, y, sampler, inputBuffers); - TexMapping *texmap= this->settings; + TexMapping *texmap = this->settings; float value = (src[0] + texmap->loc[0])*texmap->size[0]; if (texmap->flag & TEXMAP_CLIP_MIN) if (value<texmap->min[0]) - value= texmap->min[0]; + value = texmap->min[0]; if (texmap->flag & TEXMAP_CLIP_MAX) if (value>texmap->max[0]) - value= texmap->max[0]; + value = texmap->max[0]; outputValue[0] = value; } -void MapValueOperation::deinitExecution() { +void MapValueOperation::deinitExecution() +{ this->inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h index 93274a12493..ac320256fe4 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.h +++ b/source/blender/compositor/operations/COM_MapValueOperation.h @@ -45,7 +45,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution @@ -60,7 +60,7 @@ public: /** * @brief set the TexMapping settings */ - void setSettings(TexMapping* settings) {this->settings = settings;} + void setSettings(TexMapping *settings) {this->settings = settings;} }; #endif diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index d612361a7fe..2f315855652 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -25,7 +25,8 @@ extern "C" { #include "BLI_math.h" } -MathBaseOperation::MathBaseOperation(): NodeOperation() { +MathBaseOperation::MathBaseOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -33,18 +34,21 @@ MathBaseOperation::MathBaseOperation(): NodeOperation() { this->inputValue2Operation = NULL; } -void MathBaseOperation::initExecution() { +void MathBaseOperation::initExecution() +{ this->inputValue1Operation = this->getInputSocketReader(0); this->inputValue2Operation = this->getInputSocketReader(1); } -void MathBaseOperation::deinitExecution() { +void MathBaseOperation::deinitExecution() +{ this->inputValue1Operation = NULL; this->inputValue2Operation = NULL; } -void MathAddOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -54,7 +58,8 @@ void MathAddOperation::executePixel(float* outputValue, float x, float y, PixelS outputValue[0] = inputValue1[0] + inputValue2[0]; } -void MathSubtractOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -64,7 +69,8 @@ void MathSubtractOperation::executePixel(float* outputValue, float x, float y, P outputValue[0] = inputValue1[0] - inputValue2[0]; } -void MathMultiplyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -74,7 +80,8 @@ void MathMultiplyOperation::executePixel(float* outputValue, float x, float y, P outputValue[0] = inputValue1[0] * inputValue2[0]; } -void MathDivideOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -82,12 +89,13 @@ void MathDivideOperation::executePixel(float* outputValue, float x, float y, Pix inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); if (inputValue2[0]==0) /* We don't want to divide by zero. */ - outputValue[0]= 0.0; + outputValue[0] = 0.0; else - outputValue[0]= inputValue1[0] / inputValue2[0]; + outputValue[0] = inputValue1[0] / inputValue2[0]; } -void MathSineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -97,7 +105,8 @@ void MathSineOperation::executePixel(float* outputValue, float x, float y, Pixel outputValue[0] = sin(inputValue1[0]); } -void MathCosineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -107,7 +116,8 @@ void MathCosineOperation::executePixel(float* outputValue, float x, float y, Pix outputValue[0] = cos(inputValue1[0]); } -void MathTangentOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -117,7 +127,8 @@ void MathTangentOperation::executePixel(float* outputValue, float x, float y, Pi outputValue[0] = tan(inputValue1[0]); } -void MathArcSineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathArcSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -125,12 +136,13 @@ void MathArcSineOperation::executePixel(float* outputValue, float x, float y, Pi inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); if (inputValue1[0] <= 1 && inputValue1[0] >= -1 ) - outputValue[0]= asin(inputValue1[0]); + outputValue[0] = asin(inputValue1[0]); else - outputValue[0]= 0.0; + outputValue[0] = 0.0; } -void MathArcCosineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathArcCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -138,12 +150,13 @@ void MathArcCosineOperation::executePixel(float* outputValue, float x, float y, inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); if (inputValue1[0] <= 1 && inputValue1[0] >= -1 ) - outputValue[0]= acos(inputValue1[0]); + outputValue[0] = acos(inputValue1[0]); else - outputValue[0]= 0.0; + outputValue[0] = 0.0; } -void MathArcTangentOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathArcTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -153,7 +166,8 @@ void MathArcTangentOperation::executePixel(float* outputValue, float x, float y, outputValue[0] = atan(inputValue1[0]); } -void MathPowerOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathPowerOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -161,13 +175,13 @@ void MathPowerOperation::executePixel(float* outputValue, float x, float y, Pixe inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); if ( inputValue1[0] >= 0 ) { - outputValue[0]= pow(inputValue1[0], inputValue2[0]); + outputValue[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.999 || y_mod_1 < 0.001) { - outputValue[0]= pow(inputValue1[0], (float)floor(inputValue2[0] + 0.5)); + outputValue[0] = pow(inputValue1[0], (float)floor(inputValue2[0] + 0.5)); } else { outputValue[0] = 0.0; @@ -175,7 +189,8 @@ void MathPowerOperation::executePixel(float* outputValue, float x, float y, Pixe } } -void MathLogarithmOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathLogarithmOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -183,12 +198,13 @@ void MathLogarithmOperation::executePixel(float* outputValue, float x, float y, inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); if ( inputValue1[0] > 0 && inputValue2[0] > 0 ) - outputValue[0]= log(inputValue1[0]) / log(inputValue2[0]); + outputValue[0] = log(inputValue1[0]) / log(inputValue2[0]); else - outputValue[0]= 0.0; + outputValue[0] = 0.0; } -void MathMinimumOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathMinimumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -198,7 +214,8 @@ void MathMinimumOperation::executePixel(float* outputValue, float x, float y, Pi outputValue[0] = min(inputValue1[0], inputValue2[0]); } -void MathMaximumOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathMaximumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -208,7 +225,8 @@ void MathMaximumOperation::executePixel(float* outputValue, float x, float y, Pi outputValue[0] = max(inputValue1[0], inputValue2[0]); } -void MathRoundOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathRoundOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -218,7 +236,8 @@ void MathRoundOperation::executePixel(float* outputValue, float x, float y, Pixe outputValue[0] = round(inputValue1[0]); } -void MathLessThanOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathLessThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; @@ -228,7 +247,8 @@ void MathLessThanOperation::executePixel(float* outputValue, float x, float y, P outputValue[0] = inputValue1[0]<inputValue2[0]?1.0f:0.0f; } -void MathGreaterThanOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MathGreaterThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputValue1[4]; float inputValue2[4]; diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h index 728d989e1e9..87f8a304158 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.h +++ b/source/blender/compositor/operations/COM_MathBaseOperation.h @@ -46,7 +46,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) = 0; + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) = 0; /** * Initialize the execution @@ -63,88 +63,88 @@ public: class MathAddOperation: public MathBaseOperation { public: MathAddOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathSubtractOperation: public MathBaseOperation { public: MathSubtractOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathMultiplyOperation: public MathBaseOperation { public: MathMultiplyOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathDivideOperation: public MathBaseOperation { public: MathDivideOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathSineOperation: public MathBaseOperation { public: MathSineOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathCosineOperation: public MathBaseOperation { public: MathCosineOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathTangentOperation: public MathBaseOperation { public: MathTangentOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathArcSineOperation: public MathBaseOperation { public: MathArcSineOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathArcCosineOperation: public MathBaseOperation { public: MathArcCosineOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathArcTangentOperation: public MathBaseOperation { public: MathArcTangentOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathPowerOperation: public MathBaseOperation { public: MathPowerOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathLogarithmOperation: public MathBaseOperation { public: MathLogarithmOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathMinimumOperation: public MathBaseOperation { public: MathMinimumOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathMaximumOperation: public MathBaseOperation { public: MathMaximumOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathRoundOperation: public MathBaseOperation { public: MathRoundOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathLessThanOperation: public MathBaseOperation { public: MathLessThanOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class MathGreaterThanOperation: public MathBaseOperation { public: MathGreaterThanOperation() : MathBaseOperation() {} - void executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixAddOperation.cpp b/source/blender/compositor/operations/COM_MixAddOperation.cpp index d428ca52b49..a4f601ae9e6 100644 --- a/source/blender/compositor/operations/COM_MixAddOperation.cpp +++ b/source/blender/compositor/operations/COM_MixAddOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixAddOperation.h" -MixAddOperation::MixAddOperation(): MixBaseOperation() { +MixAddOperation::MixAddOperation(): MixBaseOperation() +{ } -void MixAddOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float inputValue[4]; diff --git a/source/blender/compositor/operations/COM_MixAddOperation.h b/source/blender/compositor/operations/COM_MixAddOperation.h index 0a76083be73..99a6af67d7d 100644 --- a/source/blender/compositor/operations/COM_MixAddOperation.h +++ b/source/blender/compositor/operations/COM_MixAddOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.cpp b/source/blender/compositor/operations/COM_MixBaseOperation.cpp index a84ecc6edf8..49ae67a06f7 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBaseOperation.cpp @@ -22,7 +22,8 @@ #include "COM_MixBaseOperation.h" -MixBaseOperation::MixBaseOperation(): NodeOperation() { +MixBaseOperation::MixBaseOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR); @@ -33,13 +34,15 @@ MixBaseOperation::MixBaseOperation(): NodeOperation() { this->setUseValueAlphaMultiply(false); } -void MixBaseOperation::initExecution() { +void MixBaseOperation::initExecution() +{ this->inputValueOperation = this->getInputSocketReader(0); this->inputColor1Operation = this->getInputSocketReader(1); this->inputColor2Operation = this->getInputSocketReader(2); } -void MixBaseOperation::executePixel(float* outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixBaseOperation::executePixel(float *outputColor, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -51,21 +54,23 @@ void MixBaseOperation::executePixel(float* outputColor, float x, float y, PixelS if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + 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]; } -void MixBaseOperation::deinitExecution() { +void MixBaseOperation::deinitExecution() +{ this->inputValueOperation = NULL; this->inputColor1Operation = NULL; this->inputColor2Operation = NULL; } -void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { - InputSocket* socket; +void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ + InputSocket *socket; unsigned int tempPreferredResolution[] = {0,0}; unsigned int tempResolution[2]; diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.h b/source/blender/compositor/operations/COM_MixBaseOperation.h index 171cde080eb..b9bb94d58d8 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.h +++ b/source/blender/compositor/operations/COM_MixBaseOperation.h @@ -34,9 +34,9 @@ protected: /** * Prefetched reference to the inputProgram */ - SocketReader * inputValueOperation; - SocketReader* inputColor1Operation; - SocketReader* inputColor2Operation; + SocketReader *inputValueOperation; + SocketReader *inputColor1Operation; + SocketReader *inputColor2Operation; bool valueAlphaMultiply; public: /** @@ -47,7 +47,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_MixBlendOperation.cpp b/source/blender/compositor/operations/COM_MixBlendOperation.cpp index 7b12393bb20..579f15bcc27 100644 --- a/source/blender/compositor/operations/COM_MixBlendOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBlendOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixBlendOperation.h" -MixBlendOperation::MixBlendOperation(): MixBaseOperation() { +MixBlendOperation::MixBlendOperation(): MixBaseOperation() +{ } -void MixBlendOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixBlendOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float inputValue[4]; @@ -39,7 +41,7 @@ void MixBlendOperation::executePixel(float* outputValue, float x, float y, Pixel if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + 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]); diff --git a/source/blender/compositor/operations/COM_MixBlendOperation.h b/source/blender/compositor/operations/COM_MixBlendOperation.h index 5cf31ee9151..da3342c0e4a 100644 --- a/source/blender/compositor/operations/COM_MixBlendOperation.h +++ b/source/blender/compositor/operations/COM_MixBlendOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixBurnOperation.cpp b/source/blender/compositor/operations/COM_MixBurnOperation.cpp index 28b86be5e1e..7cad107c5e9 100644 --- a/source/blender/compositor/operations/COM_MixBurnOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBurnOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixBurnOperation.h" -MixBurnOperation::MixBurnOperation(): MixBaseOperation() { +MixBurnOperation::MixBurnOperation(): MixBaseOperation() +{ } -void MixBurnOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -38,7 +40,7 @@ void MixBurnOperation::executePixel(float* outputValue, float x, float y, PixelS if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + float valuem = 1.0f - value; tmp = valuem + value*inputColor2[0]; if (tmp <= 0.0f) diff --git a/source/blender/compositor/operations/COM_MixBurnOperation.h b/source/blender/compositor/operations/COM_MixBurnOperation.h index 132db3d25e7..ff7de119605 100644 --- a/source/blender/compositor/operations/COM_MixBurnOperation.h +++ b/source/blender/compositor/operations/COM_MixBurnOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixColorOperation.cpp b/source/blender/compositor/operations/COM_MixColorOperation.cpp index d5ec55daf07..e14b10b305e 100644 --- a/source/blender/compositor/operations/COM_MixColorOperation.cpp +++ b/source/blender/compositor/operations/COM_MixColorOperation.cpp @@ -26,10 +26,12 @@ extern "C" { #include "BLI_math.h" } -MixColorOperation::MixColorOperation(): MixBaseOperation() { +MixColorOperation::MixColorOperation(): MixBaseOperation() +{ } -void MixColorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -41,7 +43,7 @@ void MixColorOperation::executePixel(float* outputValue, float x, float y, Pixel if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + float valuem = 1.0f - value; float colH,colS,colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); diff --git a/source/blender/compositor/operations/COM_MixColorOperation.h b/source/blender/compositor/operations/COM_MixColorOperation.h index dfbdcfc0368..1a98e847ccd 100644 --- a/source/blender/compositor/operations/COM_MixColorOperation.h +++ b/source/blender/compositor/operations/COM_MixColorOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp index 7e8271a9c96..666db9d8f32 100644 --- a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixDarkenOperation.h" -MixDarkenOperation::MixDarkenOperation(): MixBaseOperation() { +MixDarkenOperation::MixDarkenOperation(): MixBaseOperation() +{ } -void MixDarkenOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixDarkenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -37,16 +39,16 @@ void MixDarkenOperation::executePixel(float* outputValue, float x, float y, Pixe if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem = 1.0f-value; + float valuem = 1.0f - value; float tmp; tmp=inputColor2[0]+((1.0f-inputColor2[0])*valuem); - if (tmp < inputColor1[0]) outputValue[0]= tmp; + if (tmp < inputColor1[0]) outputValue[0] = tmp; else outputValue[0] = inputColor1[0]; tmp=inputColor2[1]+((1.0f-inputColor2[1])*valuem); - if (tmp < inputColor1[1]) outputValue[1]= tmp; + if (tmp < inputColor1[1]) outputValue[1] = tmp; else outputValue[1] = inputColor1[1]; tmp=inputColor2[2]+((1.0f-inputColor2[2])*valuem); - if (tmp < inputColor1[2]) outputValue[2]= tmp; + if (tmp < inputColor1[2]) outputValue[2] = tmp; else outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.h b/source/blender/compositor/operations/COM_MixDarkenOperation.h index 7ead435212d..b1792d4930e 100644 --- a/source/blender/compositor/operations/COM_MixDarkenOperation.h +++ b/source/blender/compositor/operations/COM_MixDarkenOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp index 4ea1428b387..497bb9c2bb5 100644 --- a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp @@ -23,10 +23,12 @@ #include "COM_MixDifferenceOperation.h" #include "BLI_math.h" -MixDifferenceOperation::MixDifferenceOperation(): MixBaseOperation() { +MixDifferenceOperation::MixDifferenceOperation(): MixBaseOperation() +{ } -void MixDifferenceOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixDifferenceOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -38,7 +40,7 @@ void MixDifferenceOperation::executePixel(float* outputValue, float x, float y, if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + 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]); diff --git a/source/blender/compositor/operations/COM_MixDifferenceOperation.h b/source/blender/compositor/operations/COM_MixDifferenceOperation.h index 9b95d5a91ad..554d7b2f1fe 100644 --- a/source/blender/compositor/operations/COM_MixDifferenceOperation.h +++ b/source/blender/compositor/operations/COM_MixDifferenceOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.cpp b/source/blender/compositor/operations/COM_MixDivideOperation.cpp index 6bab381c706..c522fcf225a 100644 --- a/source/blender/compositor/operations/COM_MixDivideOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDivideOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixDivideOperation.h" -MixDivideOperation::MixDivideOperation(): MixBaseOperation() { +MixDivideOperation::MixDivideOperation(): MixBaseOperation() +{ } -void MixDivideOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -37,17 +39,17 @@ void MixDivideOperation::executePixel(float* outputValue, float x, float y, Pixe if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + float valuem = 1.0f - value; - if (inputColor2[0]!=0.0f) + if (inputColor2[0] != 0.0f) outputValue[0] = valuem*(inputColor1[0]) + value*(inputColor1[0])/inputColor2[0]; else outputValue[0] = 0.0f; - if (inputColor2[1]!=0.0f) + if (inputColor2[1] != 0.0f) outputValue[1] = valuem*(inputColor1[1]) + value*(inputColor1[1])/inputColor2[1]; else outputValue[1] = 0.0f; - if (inputColor2[2]!=0.0f) + if (inputColor2[2] != 0.0f) outputValue[2] = valuem*(inputColor1[2]) + value*(inputColor1[2])/inputColor2[2]; else outputValue[2] = 0.0f; diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.h b/source/blender/compositor/operations/COM_MixDivideOperation.h index d43ddb49c91..e9c4cf81cd3 100644 --- a/source/blender/compositor/operations/COM_MixDivideOperation.h +++ b/source/blender/compositor/operations/COM_MixDivideOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp index 7e6ddeee5e6..10c04ba376b 100644 --- a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixDodgeOperation.h" -MixDodgeOperation::MixDodgeOperation(): MixBaseOperation() { +MixDodgeOperation::MixDodgeOperation(): MixBaseOperation() +{ } -void MixDodgeOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixDodgeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; diff --git a/source/blender/compositor/operations/COM_MixDodgeOperation.h b/source/blender/compositor/operations/COM_MixDodgeOperation.h index 0a910c167ba..6baa73e8f6f 100644 --- a/source/blender/compositor/operations/COM_MixDodgeOperation.h +++ b/source/blender/compositor/operations/COM_MixDodgeOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixHueOperation.cpp b/source/blender/compositor/operations/COM_MixHueOperation.cpp index 8454c694f65..de376f3500c 100644 --- a/source/blender/compositor/operations/COM_MixHueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixHueOperation.cpp @@ -26,10 +26,12 @@ extern "C" { #include "BLI_math.h" } -MixHueOperation::MixHueOperation(): MixBaseOperation() { +MixHueOperation::MixHueOperation(): MixBaseOperation() +{ } -void MixHueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -41,7 +43,7 @@ void MixHueOperation::executePixel(float* outputValue, float x, float y, PixelSa if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + float valuem = 1.0f - value; float colH,colS,colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); diff --git a/source/blender/compositor/operations/COM_MixHueOperation.h b/source/blender/compositor/operations/COM_MixHueOperation.h index 5e46b625385..d3d1717f448 100644 --- a/source/blender/compositor/operations/COM_MixHueOperation.h +++ b/source/blender/compositor/operations/COM_MixHueOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.cpp b/source/blender/compositor/operations/COM_MixLightenOperation.cpp index 6a06d5ab6e1..bc3e5090bd8 100644 --- a/source/blender/compositor/operations/COM_MixLightenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLightenOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixLightenOperation.h" -MixLightenOperation::MixLightenOperation(): MixBaseOperation() { +MixLightenOperation::MixLightenOperation(): MixBaseOperation() +{ } -void MixLightenOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixLightenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -39,13 +41,13 @@ void MixLightenOperation::executePixel(float* outputValue, float x, float y, Pix } float tmp; tmp=value * inputColor2[0]; - if (tmp > inputColor1[0]) outputValue[0]= tmp; + if (tmp > inputColor1[0]) outputValue[0] = tmp; else outputValue[0] = inputColor1[0]; tmp=value * inputColor2[1]; - if (tmp > inputColor1[1]) outputValue[1]= tmp; + if (tmp > inputColor1[1]) outputValue[1] = tmp; else outputValue[1] = inputColor1[1]; tmp=value * inputColor2[2]; - if (tmp > inputColor1[2]) outputValue[2]= tmp; + if (tmp > inputColor1[2]) outputValue[2] = tmp; else outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.h b/source/blender/compositor/operations/COM_MixLightenOperation.h index 64b1bf9bbc9..73ac3e6e165 100644 --- a/source/blender/compositor/operations/COM_MixLightenOperation.h +++ b/source/blender/compositor/operations/COM_MixLightenOperation.h @@ -39,6 +39,6 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp index 413b09d7242..b68064f0e47 100644 --- a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixLinearLightOperation.h" -MixLinearLightOperation::MixLinearLightOperation(): MixBaseOperation() { +MixLinearLightOperation::MixLinearLightOperation(): MixBaseOperation() +{ } -void MixLinearLightOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixLinearLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; diff --git a/source/blender/compositor/operations/COM_MixLinearLightOperation.h b/source/blender/compositor/operations/COM_MixLinearLightOperation.h index 9fb2a433104..7e26b25e5c0 100644 --- a/source/blender/compositor/operations/COM_MixLinearLightOperation.h +++ b/source/blender/compositor/operations/COM_MixLinearLightOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp b/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp index 82c6c2e9c1f..fdf8c1ca51b 100644 --- a/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp +++ b/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixMultiplyOperation.h" -MixMultiplyOperation::MixMultiplyOperation(): MixBaseOperation() { +MixMultiplyOperation::MixMultiplyOperation(): MixBaseOperation() +{ } -void MixMultiplyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float inputValue[4]; @@ -38,7 +40,7 @@ void MixMultiplyOperation::executePixel(float* outputValue, float x, float y, Pi if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + 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]); diff --git a/source/blender/compositor/operations/COM_MixMultiplyOperation.h b/source/blender/compositor/operations/COM_MixMultiplyOperation.h index c35e4bbf64b..5d4468e7271 100644 --- a/source/blender/compositor/operations/COM_MixMultiplyOperation.h +++ b/source/blender/compositor/operations/COM_MixMultiplyOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp index 7a3030b9262..0025daeb3f5 100644 --- a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixOverlayOperation.h" -MixOverlayOperation::MixOverlayOperation(): MixBaseOperation() { +MixOverlayOperation::MixOverlayOperation(): MixBaseOperation() +{ } -void MixOverlayOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixOverlayOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -38,7 +40,7 @@ void MixOverlayOperation::executePixel(float* outputValue, float x, float y, Pix value *= inputColor2[3]; } - float valuem= 1.0f-value; + float valuem = 1.0f - value; if (inputColor1[0] < 0.5f) { outputValue[0] = inputColor1[0] * (valuem + 2.0f*value*inputColor2[0]); diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.h b/source/blender/compositor/operations/COM_MixOverlayOperation.h index 1a0e865b0e8..dd1d16a53d3 100644 --- a/source/blender/compositor/operations/COM_MixOverlayOperation.h +++ b/source/blender/compositor/operations/COM_MixOverlayOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp index a8fe647828b..f6f6ec73c6e 100644 --- a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp @@ -26,10 +26,12 @@ extern "C" { #include "BLI_math.h" } -MixSaturationOperation::MixSaturationOperation(): MixBaseOperation() { +MixSaturationOperation::MixSaturationOperation(): MixBaseOperation() +{ } -void MixSaturationOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixSaturationOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -41,7 +43,7 @@ void MixSaturationOperation::executePixel(float* outputValue, float x, float y, if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + float valuem = 1.0f - value; float rH,rS,rV; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.h b/source/blender/compositor/operations/COM_MixSaturationOperation.h index cea2c886a06..7e746c02e09 100644 --- a/source/blender/compositor/operations/COM_MixSaturationOperation.h +++ b/source/blender/compositor/operations/COM_MixSaturationOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixScreenOperation.cpp b/source/blender/compositor/operations/COM_MixScreenOperation.cpp index 25004ca7257..a1a98bd82a2 100644 --- a/source/blender/compositor/operations/COM_MixScreenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixScreenOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixScreenOperation.h" -MixScreenOperation::MixScreenOperation(): MixBaseOperation() { +MixScreenOperation::MixScreenOperation(): MixBaseOperation() +{ } -void MixScreenOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixScreenOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float valuev[4]; @@ -38,7 +40,7 @@ void MixScreenOperation::executePixel(float* outputValue, float x, float y, Pixe if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + 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]); diff --git a/source/blender/compositor/operations/COM_MixScreenOperation.h b/source/blender/compositor/operations/COM_MixScreenOperation.h index 5fb99c7582f..6522907f295 100644 --- a/source/blender/compositor/operations/COM_MixScreenOperation.h +++ b/source/blender/compositor/operations/COM_MixScreenOperation.h @@ -39,6 +39,6 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp index 3195b3440ec..ea6a3ddd498 100644 --- a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixSoftLightOperation.h" -MixSoftLightOperation::MixSoftLightOperation(): MixBaseOperation() { +MixSoftLightOperation::MixSoftLightOperation(): MixBaseOperation() +{ } -void MixSoftLightOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixSoftLightOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])\ +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -37,7 +39,7 @@ void MixSoftLightOperation::executePixel(float* outputValue, float x, float y, P if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem = 1.0f-value; + float valuem = 1.0f - value; float scr, scg, scb; /* first calculate non-fac based Screen mix */ diff --git a/source/blender/compositor/operations/COM_MixSoftLightOperation.h b/source/blender/compositor/operations/COM_MixSoftLightOperation.h index 1f5e9a24f07..fcbd8dab8b8 100644 --- a/source/blender/compositor/operations/COM_MixSoftLightOperation.h +++ b/source/blender/compositor/operations/COM_MixSoftLightOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp index 49792c99c27..57320dcd611 100644 --- a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp @@ -22,10 +22,12 @@ #include "COM_MixSubtractOperation.h" -MixSubtractOperation::MixSubtractOperation(): MixBaseOperation() { +MixSubtractOperation::MixSubtractOperation(): MixBaseOperation() +{ } -void MixSubtractOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; diff --git a/source/blender/compositor/operations/COM_MixSubtractOperation.h b/source/blender/compositor/operations/COM_MixSubtractOperation.h index 119d614081f..441857a8aca 100644 --- a/source/blender/compositor/operations/COM_MixSubtractOperation.h +++ b/source/blender/compositor/operations/COM_MixSubtractOperation.h @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MixValueOperation.cpp b/source/blender/compositor/operations/COM_MixValueOperation.cpp index 93bb7b59b5f..8c43bb6af8c 100644 --- a/source/blender/compositor/operations/COM_MixValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixValueOperation.cpp @@ -26,10 +26,12 @@ extern "C" { #include "BLI_math.h" } -MixValueOperation::MixValueOperation(): MixBaseOperation() { +MixValueOperation::MixValueOperation(): MixBaseOperation() +{ } -void MixValueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MixValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float inputColor1[4]; float inputColor2[4]; float value; @@ -41,7 +43,7 @@ void MixValueOperation::executePixel(float* outputValue, float x, float y, Pixel if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - float valuem= 1.0f-value; + float valuem = 1.0f - value; float rH,rS,rV; float colH,colS,colV; diff --git a/source/blender/compositor/operations/COM_MixValueOperation.h b/source/blender/compositor/operations/COM_MixValueOperation.h index ce358ebb506..89461b3ba40 100644 --- a/source/blender/compositor/operations/COM_MixValueOperation.h +++ b/source/blender/compositor/operations/COM_MixValueOperation.h @@ -39,6 +39,6 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp index 5d0e7e4a4fe..a81288be3f7 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp @@ -24,14 +24,16 @@ extern "C" { #include "BKE_tracking.h" } -MovieClipAttributeOperation::MovieClipAttributeOperation(): NodeOperation() { +MovieClipAttributeOperation::MovieClipAttributeOperation(): NodeOperation() +{ this->addOutputSocket(COM_DT_VALUE); this->valueSet = false; this->framenumber = 0; this->attribute = MCA_X; } -void MovieClipAttributeOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MovieClipAttributeOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ if (!valueSet) { float loc[2], scale, angle; loc[0] = 0.0f; @@ -60,7 +62,8 @@ void MovieClipAttributeOperation::executePixel(float* outputValue, float x, floa outputValue[0] = this->value; } -void MovieClipAttributeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void MovieClipAttributeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h index 960d837dd7e..aca2ec2eff7 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h @@ -51,10 +51,10 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); - void setMovieClip(MovieClip* clip) {this->clip = clip;} + void setMovieClip(MovieClip *clip) {this->clip = clip;} void setFramenumber(int framenumber) {this->framenumber = framenumber;} void setAttribute(MovieClipAttribute attribute) {this->attribute = attribute;} }; diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp index 7597497acc7..14687133194 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp @@ -31,7 +31,8 @@ extern "C" { } #include "BKE_image.h" -MovieClipOperation::MovieClipOperation(): NodeOperation() { +MovieClipOperation::MovieClipOperation(): NodeOperation() +{ this->addOutputSocket(COM_DT_COLOR); this->movieClip = NULL; this->movieClipBuffer = NULL; @@ -42,11 +43,12 @@ MovieClipOperation::MovieClipOperation(): NodeOperation() { } -void MovieClipOperation::initExecution() { +void MovieClipOperation::initExecution() +{ if (this->movieClip) { BKE_movieclip_user_set_frame(this->movieClipUser, this->framenumber); ImBuf *ibuf; - ibuf= BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser); + ibuf = BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser); if (ibuf) { this->movieClipBuffer = ibuf; if (ibuf->rect_float == NULL || ibuf->userflags&IB_RECT_INVALID) { @@ -57,14 +59,16 @@ void MovieClipOperation::initExecution() { } } -void MovieClipOperation::deinitExecution() { +void MovieClipOperation::deinitExecution() +{ this->movieClipBuffer = NULL; } -void MovieClipOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void MovieClipOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ ImBuf *ibuf; if (this->movieClip) { - ibuf= BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser); + ibuf = BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser); if (ibuf) { resolution[0] = ibuf->x; resolution[1] = ibuf->y; @@ -72,7 +76,8 @@ void MovieClipOperation::determineResolution(unsigned int resolution[], unsigned } } -void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ if (this->movieClipBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) { color[0] = 0.0f; color[1] = 0.0f; diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h index c861115dee8..f52a9973fc5 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipOperation.h @@ -37,8 +37,8 @@ */ class MovieClipOperation : public NodeOperation { protected: - MovieClip* movieClip; - MovieClipUser* movieClipUser; + MovieClip *movieClip; + MovieClipUser *movieClipUser; ImBuf *movieClipBuffer; int movieClipheight; int movieClipwidth; @@ -54,8 +54,8 @@ public: void initExecution(); void deinitExecution(); - void setMovieClip(MovieClip* image) {this->movieClip = image;} - void setMovieClipUser(MovieClipUser* imageuser) {this->movieClipUser = imageuser;} + void setMovieClip(MovieClip *image) {this->movieClip = image;} + void setMovieClipUser(MovieClipUser *imageuser) {this->movieClipUser = imageuser;} void setFramenumber(int framenumber) {this->framenumber = framenumber;} void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp index b848192d40b..1699707ab3a 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp @@ -32,7 +32,8 @@ extern "C" { vector<DistortionCache*> s_cache; -MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperation() { +MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); @@ -41,17 +42,18 @@ MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperat this->cache = NULL; this->distortion = distortion; } -void MovieDistortionOperation::initExecution() { +void MovieDistortionOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); if (this->movieClip) { for (int i = 0 ; i < s_cache.size() ; i ++) { - DistortionCache* c = (DistortionCache*)s_cache[i]; + DistortionCache *c = (DistortionCache*)s_cache[i]; if (c->isCacheFor(this->movieClip, this->width, this->height, this->distortion)) { this->cache = c; return; } } - DistortionCache* newC = new DistortionCache(this->movieClip, this->width, this->height, this->distortion); + DistortionCache *newC = new DistortionCache(this->movieClip, this->width, this->height, this->distortion); s_cache.push_back(newC); this->cache = newC; } @@ -60,13 +62,15 @@ void MovieDistortionOperation::initExecution() { } } -void MovieDistortionOperation::deinitExecution() { +void MovieDistortionOperation::deinitExecution() +{ this->inputOperation = NULL; this->movieClip = NULL; } -void MovieDistortionOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MovieDistortionOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ if (this->cache != NULL) { float u, v; @@ -78,7 +82,8 @@ void MovieDistortionOperation::executePixel(float *color,float x, float y, Pixel } } -bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.xmax = input->xmax + 100; diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h index 21aa955075d..fcdf7090566 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h @@ -40,7 +40,7 @@ private: float *buffer; int *bufferCalculated; public: - DistortionCache(MovieClip* movieclip, int width, int height, bool inverted) { + DistortionCache(MovieClip *movieclip, int width, int height, bool inverted) { this->k1 = movieclip->tracking.camera.k1; this->k2 = movieclip->tracking.camera.k2; this->k3 = movieclip->tracking.camera.k3; @@ -53,7 +53,7 @@ public: this->bufferCalculated[i] = 0; } } - bool isCacheFor(MovieClip* movieclip, int width, int height, bool inverted) { + bool isCacheFor(MovieClip *movieclip, int width, int height, bool inverted) { return this->k1 == movieclip->tracking.camera.k1 && this->k2 == movieclip->tracking.camera.k2 && this->k3 == movieclip->tracking.camera.k3 && @@ -62,7 +62,7 @@ public: this->height == height; } - void getUV(MovieTracking* trackingData, int x, int y, float *u, float*v) { + void getUV(MovieTracking *trackingData, int x, int y, float *u, float*v) { if (x<0 || x >= this->width || y <0 || y >= this->height) { *u = x; *v = y; @@ -106,7 +106,7 @@ public: void initExecution(); void deinitExecution(); - void setMovieClip(MovieClip* clip) {this->movieClip = clip;} + void setMovieClip(MovieClip *clip) {this->movieClip = clip;} }; diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp index df2b762b563..f95dd12a81a 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp @@ -27,21 +27,24 @@ extern "C" { #include "IMB_imbuf_types.h" } -MultilayerBaseOperation::MultilayerBaseOperation(int pass): BaseImageOperation() { +MultilayerBaseOperation::MultilayerBaseOperation(int pass): BaseImageOperation() +{ this->passId = pass; } -ImBuf* MultilayerBaseOperation::getImBuf() { +ImBuf *MultilayerBaseOperation::getImBuf() +{ RenderPass *rpass; rpass = (RenderPass *)BLI_findlink(&this->renderlayer->passes, this->passId); if (rpass) { - this->imageUser->pass= this->passId; + this->imageUser->pass = this->passId; BKE_image_multilayer_index(image->rr, this->imageUser); return BaseImageOperation::getImBuf(); } return NULL; } -void MultilayerColorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MultilayerColorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ int yi = y; int xi = x; if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) { @@ -73,7 +76,8 @@ void MultilayerColorOperation::executePixel(float *color, float x, float y, Pixe } } -void MultilayerValueOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MultilayerValueOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ int yi = y; int xi = x; if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) { @@ -85,7 +89,8 @@ void MultilayerValueOperation::executePixel(float *color, float x, float y, Pixe } } -void MultilayerVectorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void MultilayerVectorOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ int yi = y; int xi = x; if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) { diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.h b/source/blender/compositor/operations/COM_MultilayerImageOperation.h index 37e8020d56c..809253e532a 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.h +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.h @@ -30,9 +30,9 @@ class MultilayerBaseOperation: public BaseImageOperation { private: int passId; - RenderLayer* renderlayer; + RenderLayer *renderlayer; protected: - ImBuf* getImBuf(); + ImBuf *getImBuf(); public: /** * Constructor diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp index ade2fde8d07..d144739f845 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp +++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp @@ -21,19 +21,22 @@ #include "COM_NormalizeOperation.h" -NormalizeOperation::NormalizeOperation(): NodeOperation() { +NormalizeOperation::NormalizeOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->imageReader = NULL; this->cachedInstance = NULL; this->setComplex(true); } -void NormalizeOperation::initExecution() { +void NormalizeOperation::initExecution() +{ this->imageReader = this->getInputSocketReader(0); NodeOperation::initMutex(); } -void NormalizeOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) { +void NormalizeOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data) +{ /* using generic two floats struct to store x: min y: mult */ NodeTwoFloats *minmult = (NodeTwoFloats *)data; @@ -43,7 +46,8 @@ void NormalizeOperation::executePixel(float* color, int x, int y, MemoryBuffer * color[0] = (output[0] - minmult->x) * minmult->y; } -void NormalizeOperation::deinitExecution() { +void NormalizeOperation::deinitExecution() +{ this->imageReader = NULL; if (this->cachedInstance) { delete cachedInstance; @@ -51,10 +55,11 @@ void NormalizeOperation::deinitExecution() { NodeOperation::deinitMutex(); } -bool NormalizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool NormalizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti imageInput; - NodeOperation* operation = getInputOperation(0); + NodeOperation *operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; imageInput.ymax = operation->getHeight(); @@ -69,12 +74,12 @@ bool NormalizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe /* The code below assumes all data is inside range +- this, and that input buffer is single channel */ #define BLENDER_ZMAX 10000.0f -void* NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { - +void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ BLI_mutex_lock(getMutex()); if (this->cachedInstance == NULL) { - MemoryBuffer* tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers); + MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers); /* using generic two floats struct to store x: min y: mult */ NodeTwoFloats *minmult = new NodeTwoFloats(); @@ -104,5 +109,6 @@ void* NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu return this->cachedInstance; } -void NormalizeOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) { +void NormalizeOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) +{ } diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.h b/source/blender/compositor/operations/COM_NormalizeOperation.h index 9475cd3852a..765b8847384 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.h +++ b/source/blender/compositor/operations/COM_NormalizeOperation.h @@ -47,14 +47,14 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data); /** * Initialize the execution */ void initExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data); /** diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp b/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp index adaba8e3330..66db4a1c86b 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp @@ -1,7 +1,7 @@ /// @todo: this source needs to be generated from COM_OpenCLKernels.cl. /// not implemented yet. new data to h -const char* sourcecode = "/// This file contains all opencl kernels for node-operation implementations \n" \ +const char *sourcecode = "/// This file contains all opencl kernels for node-operation implementations \n" \ "\n" \ "__kernel void testKernel(__global __write_only image2d_t output) {\n" \ " int x = get_global_id(0);\n" \ diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index e410dd966c8..8d39e987bd4 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -48,7 +48,8 @@ static int get_datatype_size(DataType datatype) } } -static float *init_buffer(unsigned int width, unsigned int height, DataType datatype) { +static float *init_buffer(unsigned int width, unsigned int height, DataType datatype) +{ // When initializing the tree during initial load the width and height can be zero. if (width != 0 && height != 0) { int size = get_datatype_size(datatype); @@ -59,7 +60,7 @@ static float *init_buffer(unsigned int width, unsigned int height, DataType data } static void write_buffer_rect(rcti *rect, MemoryBuffer** memoryBuffers, const bNodeTree *tree, - SocketReader *reader, float* buffer, unsigned int width, DataType datatype) + SocketReader *reader, float *buffer, unsigned int width, DataType datatype) { float color[4]; int i, size = get_datatype_size(datatype); @@ -106,12 +107,14 @@ OutputSingleLayerOperation::OutputSingleLayerOperation( BLI_strncpy(this->path, path, sizeof(this->path)); } -void OutputSingleLayerOperation::initExecution() { +void OutputSingleLayerOperation::initExecution() +{ this->imageInput = getInputSocketReader(0); this->outputBuffer = init_buffer(this->getWidth(), this->getHeight(), this->datatype); } -void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) { +void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) +{ write_buffer_rect(rect, memoryBuffers, this->tree, imageInput, this->outputBuffer, this->getWidth(), this->datatype); } @@ -120,14 +123,14 @@ void OutputSingleLayerOperation::deinitExecution() if (this->getWidth() * this->getHeight() != 0) { int size = get_datatype_size(this->datatype); - ImBuf *ibuf= IMB_allocImBuf(this->getWidth(), this->getHeight(), size*8, 0); - Main *bmain= G.main; /* TODO, have this passed along */ + ImBuf *ibuf = IMB_allocImBuf(this->getWidth(), this->getHeight(), size*8, 0); + Main *bmain = G.main; /* TODO, have this passed along */ char filename[FILE_MAX]; ibuf->channels = size; - ibuf->rect_float= this->outputBuffer; + ibuf->rect_float = this->outputBuffer; ibuf->mall |= IB_rectfloat; - ibuf->dither= scene->r.dither_intensity; + ibuf->dither = scene->r.dither_intensity; if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) ibuf->profile = IB_PROFILE_LINEAR_RGB; @@ -192,9 +195,9 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() unsigned int width = this->getWidth(); unsigned int height = this->getHeight(); if (width != 0 && height != 0) { - Main *bmain= G.main; /* TODO, have this passed along */ + Main *bmain = G.main; /* TODO, have this passed along */ char filename[FILE_MAX]; - void *exrhandle= IMB_exr_get_handle(); + void *exrhandle = IMB_exr_get_handle(); BKE_makepicstring(filename, this->path, bmain->name, this->scene->r.cfra, R_IMF_IMTYPE_MULTILAYER, (this->scene->r.scemode & R_EXTENSION), true); diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h index 0fbe874e9e0..0e37432ca5b 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileOperation.h @@ -33,14 +33,14 @@ class OutputSingleLayerOperation : public NodeOperation { private: const Scene *scene; - const bNodeTree* tree; + const bNodeTree *tree; ImageFormatData *format; char path[FILE_MAX]; float *outputBuffer; DataType datatype; - SocketReader* imageInput; + SocketReader *imageInput; public: OutputSingleLayerOperation(const Scene *scene, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path); @@ -59,7 +59,7 @@ struct OutputOpenExrLayer { char name[EXR_TOT_MAXNAME-2]; float *outputBuffer; DataType datatype; - SocketReader* imageInput; + SocketReader *imageInput; }; /* Writes inputs into OpenEXR multilayer channels. */ @@ -68,7 +68,7 @@ private: typedef std::vector<OutputOpenExrLayer> LayerList; const Scene *scene; - const bNodeTree* tree; + const bNodeTree *tree; char path[FILE_MAX]; char exr_codec; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp index 4a9d08380ea..2b02546a8f9 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cpp +++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp @@ -39,7 +39,8 @@ extern "C" { } -PreviewOperation::PreviewOperation() : NodeOperation() { +PreviewOperation::PreviewOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->outputBuffer = NULL; this->input = NULL; @@ -48,7 +49,8 @@ PreviewOperation::PreviewOperation() : NodeOperation() { this->priority = 0; } -void PreviewOperation::initExecution() { +void PreviewOperation::initExecution() +{ this->input = getInputSocketReader(0); if (!this->node->preview) { this->node->preview = (bNodePreview*)MEM_callocN(sizeof(bNodePreview), "node preview"); @@ -64,18 +66,20 @@ void PreviewOperation::initExecution() { if (this->node->preview->rect) { MEM_freeN(this->node->preview->rect); } - this->node->preview->xsize= getWidth(); - this->node->preview->ysize= getHeight(); - this->node->preview->rect= outputBuffer; + this->node->preview->xsize = getWidth(); + this->node->preview->ysize = getHeight(); + this->node->preview->rect = outputBuffer; } } -void PreviewOperation::deinitExecution() { +void PreviewOperation::deinitExecution() +{ this->outputBuffer = NULL; this->input = NULL; } -void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers) { +void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers) +{ int offset; float color[4]; for (int y = rect->ymin ; y < rect->ymax ; y++) { @@ -96,7 +100,8 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, Memory } } } -bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.xmin = input->xmin/divider; @@ -106,7 +111,8 @@ 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[], unsigned int preferredResolution[]) +{ NodeOperation::determineResolution(resolution, preferredResolution); int width = resolution[0]; int height = resolution[1]; @@ -124,6 +130,7 @@ void PreviewOperation::determineResolution(unsigned int resolution[], unsigned i resolution[1] = height; } -const int PreviewOperation::getRenderPriority() const { +const int PreviewOperation::getRenderPriority() const +{ return this->priority; } diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h index c36c85ad746..8450b7fc556 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.h +++ b/source/blender/compositor/operations/COM_PreviewOperation.h @@ -33,9 +33,9 @@ protected: /** * @brief holds reference to the SDNA bNode, where this nodes will render the preview image for */ - bNode* node; - const bNodeTree* tree; - SocketReader* input; + bNode *node; + const bNodeTree *tree; + SocketReader *input; float divider; int priority; @@ -48,8 +48,8 @@ public: void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers); void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); - void setbNode(bNode* node) { this->node = node;} - void setbNodeTree(const bNodeTree* tree) { this->tree = tree;} + void setbNode(bNode *node) { this->node = node;} + void setbNodeTree(const bNodeTree *tree) { this->tree = tree;} bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void setPriority(int priority) { this->priority = priority; } }; diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp index adb72f9abb3..7695e0f63c2 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp @@ -24,24 +24,28 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -ProjectorLensDistortionOperation::ProjectorLensDistortionOperation(): NodeOperation() { +ProjectorLensDistortionOperation::ProjectorLensDistortionOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); this->inputProgram = NULL; } -void ProjectorLensDistortionOperation::initExecution() { +void ProjectorLensDistortionOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); kr = 0.25f*MAX2(MIN2(this->dispersion, 1.f), 0.f); kr2 = kr * 20; } -void* ProjectorLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { - void* buffer = inputProgram->initializeTileData(NULL, memoryBuffers); +void *ProjectorLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ + void *buffer = inputProgram->initializeTileData(NULL, memoryBuffers); return buffer; } -void ProjectorLensDistortionOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void ProjectorLensDistortionOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ float inputValue[4]; const float height = this->getHeight(); const float width = this->getWidth(); @@ -57,11 +61,13 @@ void ProjectorLensDistortionOperation::executePixel(float* color, int x, int y, color[3] = 1.0f; } -void ProjectorLensDistortionOperation::deinitExecution() { +void ProjectorLensDistortionOperation::deinitExecution() +{ this->inputProgram = NULL; } -bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.ymax = input->ymax; newInput.ymin = input->ymin; diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h index 6b05dbfcd41..c8788e100c8 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h @@ -42,20 +42,20 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution */ void initExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); /** * Deinitialize the execution */ void deinitExecution(); - void setData(NodeLensDist* data) {this->data = data;} + void setData(NodeLensDist *data) {this->data = data;} void setDispertion(float dispersion) {this->dispersion = dispersion;} bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.cpp b/source/blender/compositor/operations/COM_QualityStepHelper.cpp index c21163e03ac..f2d700292a4 100644 --- a/source/blender/compositor/operations/COM_QualityStepHelper.cpp +++ b/source/blender/compositor/operations/COM_QualityStepHelper.cpp @@ -22,13 +22,15 @@ #include "COM_QualityStepHelper.h" -QualityStepHelper::QualityStepHelper() { +QualityStepHelper::QualityStepHelper() +{ this->quality = COM_QUALITY_HIGH; this->step = 1; this->offsetadd = 4; } -void QualityStepHelper::initExecution(QualityHelper helper) { +void QualityStepHelper::initExecution(QualityHelper helper) +{ switch (helper) { case COM_QH_INCREASE: switch (this->quality) { diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.h b/source/blender/compositor/operations/COM_QualityStepHelper.h index ff4870f03bd..80b25684c5e 100644 --- a/source/blender/compositor/operations/COM_QualityStepHelper.h +++ b/source/blender/compositor/operations/COM_QualityStepHelper.h @@ -37,12 +37,12 @@ private: protected: /** - * Initialize the execution - */ - void initExecution(QualityHelper helper); + * Initialize the execution + */ + void initExecution(QualityHelper helper); - inline int getStep() const {return this->step;} - inline int getOffsetAdd() const {return this->offsetadd;} + inline int getStep() const {return this->step;} + inline int getOffsetAdd() const {return this->offsetadd;} public: QualityStepHelper(); diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp index 69405ef6d23..d7f95c10cfb 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp @@ -24,16 +24,19 @@ #include "COM_WriteBufferOperation.h" #include "COM_defines.h" -ReadBufferOperation::ReadBufferOperation():NodeOperation() { +ReadBufferOperation::ReadBufferOperation():NodeOperation() +{ this->addOutputSocket(COM_DT_COLOR); this->offset = 0; } -void* ReadBufferOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *ReadBufferOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ return getInputMemoryBuffer(memoryBuffers); } -void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ if (this->memoryProxy != NULL) { WriteBufferOperation * operation = memoryProxy->getWriteBufferOperation(); operation->determineResolution(resolution, preferredResolution); @@ -43,7 +46,8 @@ void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigne if (memoryProxy->getExecutor()) memoryProxy->getExecutor()->setResolution(resolution); } } -void ReadBufferOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ReadBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ MemoryBuffer *inputBuffer = inputBuffers[this->offset]; if (inputBuffer) { if (sampler == COM_PS_NEAREST) { @@ -55,14 +59,16 @@ void ReadBufferOperation::executePixel(float* color, float x, float y, PixelSamp } } -void ReadBufferOperation::executePixel(float *color, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) { +void ReadBufferOperation::executePixel(float *color, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) +{ MemoryBuffer *inputBuffer = inputBuffers[this->offset]; if (inputBuffer) { inputBuffer->readEWA(color, x, y, dx, dy); } } -bool ReadBufferOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation* readOperation, rcti* output) { +bool ReadBufferOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output) +{ if (this==readOperation) { BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax); return true; diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h index 807f615f2e1..d58d131264b 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.h +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h @@ -33,18 +33,18 @@ private: public: ReadBufferOperation(); int isBufferOperation() {return true;} - void setMemoryProxy(MemoryProxy* memoryProxy) {this->memoryProxy = memoryProxy;} - MemoryProxy* getMemoryProxy() {return this->memoryProxy;} + void setMemoryProxy(MemoryProxy *memoryProxy) {this->memoryProxy = memoryProxy;} + MemoryProxy *getMemoryProxy() {return this->memoryProxy;} void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void executePixel(float *color, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]); const bool isReadBufferOperation() const {return true;} void setOffset(unsigned int offset) {this->offset = offset;} unsigned int getOffset() {return this->offset;} - bool determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti* output); - MemoryBuffer* getInputMemoryBuffer(MemoryBuffer** memoryBuffers) {return memoryBuffers[offset];} + bool determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output); + MemoryBuffer *getInputMemoryBuffer(MemoryBuffer** memoryBuffers) {return memoryBuffers[offset];} }; diff --git a/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp index a73f29c3615..dad082cf0ca 100644 --- a/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp @@ -22,7 +22,8 @@ #include "COM_RenderLayersAOOperation.h" -RenderLayersAOOperation::RenderLayersAOOperation() :RenderLayersBaseProg(SCE_PASS_AO, 3) { +RenderLayersAOOperation::RenderLayersAOOperation() :RenderLayersBaseProg(SCE_PASS_AO, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp index d18915c593b..ccb7dd91c04 100644 --- a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp @@ -22,11 +22,13 @@ #include "COM_RenderLayersAlphaProg.h" -RenderLayersAlphaProg::RenderLayersAlphaProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4) { +RenderLayersAlphaProg::RenderLayersAlphaProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4) +{ this->addOutputSocket(COM_DT_VALUE); } -void RenderLayersAlphaProg::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void RenderLayersAlphaProg::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ int ix = x; int iy = y; float * inputBuffer = this->getInputBuffer(); diff --git a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.h b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.h index 6386915230c..da808f49fdf 100644 --- a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.h +++ b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.h @@ -28,7 +28,7 @@ class RenderLayersAlphaProg : public RenderLayersBaseProg { public: RenderLayersAlphaProg(); - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp index 94ba8973314..35c8753ded6 100644 --- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp @@ -31,7 +31,8 @@ extern "C" { #include "RE_render_ext.h" } -RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize): NodeOperation() { +RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize): NodeOperation() +{ this->renderpass = renderpass; this->setScene(NULL); this->inputBuffer = NULL; @@ -39,27 +40,28 @@ RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize): Nod } -void RenderLayersBaseProg::initExecution() { +void RenderLayersBaseProg::initExecution() +{ Scene * scene = this->getScene(); - Render *re= (scene)? RE_GetRender(scene->id.name): NULL; - RenderResult *rr= NULL; + Render *re = (scene)? RE_GetRender(scene->id.name): NULL; + RenderResult *rr = NULL; if (re) - rr= RE_AcquireResultRead(re); + rr = RE_AcquireResultRead(re); if (rr) { - SceneRenderLayer *srl= (SceneRenderLayer*)BLI_findlink(&scene->r.layers, getLayerId()); + SceneRenderLayer *srl = (SceneRenderLayer*)BLI_findlink(&scene->r.layers, getLayerId()); if (srl) { - - RenderLayer *rl= RE_GetRenderLayer(rr, srl->name); - if (rl && rl->rectf) { - this->inputBuffer = RE_RenderLayerGetPass(rl, renderpass); - - if (this->inputBuffer == NULL || renderpass == SCE_PASS_COMBINED) { - this->inputBuffer = rl->rectf; - } - } - } + + RenderLayer *rl = RE_GetRenderLayer(rr, srl->name); + if (rl && rl->rectf) { + this->inputBuffer = RE_RenderLayerGetPass(rl, renderpass); + + if (this->inputBuffer == NULL || renderpass == SCE_PASS_COMBINED) { + this->inputBuffer = rl->rectf; + } + } + } } if (re) { RE_ReleaseResult(re); @@ -67,7 +69,8 @@ void RenderLayersBaseProg::initExecution() { } } -void RenderLayersBaseProg::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void RenderLayersBaseProg::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ int ix = x; int iy = y; @@ -100,34 +103,36 @@ void RenderLayersBaseProg::executePixel(float* output, float x, float y, PixelSa } } -void RenderLayersBaseProg::deinitExecution() { +void RenderLayersBaseProg::deinitExecution() +{ this->inputBuffer = NULL; } -void RenderLayersBaseProg::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { - Scene *sce= this->getScene(); - Render *re= (sce)? RE_GetRender(sce->id.name): NULL; - RenderResult *rr= NULL; +void RenderLayersBaseProg::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ + Scene *sce = this->getScene(); + Render *re = (sce) ? RE_GetRender(sce->id.name) : NULL; + RenderResult *rr = NULL; resolution[0] = 0; resolution[1] = 0; if (re) - rr= RE_AcquireResultRead(re); + rr = RE_AcquireResultRead(re); if (rr) { - SceneRenderLayer *srl= (SceneRenderLayer*)BLI_findlink(&sce->r.layers, getLayerId()); + SceneRenderLayer *srl = (SceneRenderLayer*)BLI_findlink(&sce->r.layers, getLayerId()); if (srl) { - RenderLayer *rl= RE_GetRenderLayer(rr, srl->name); - if (rl && rl->rectf) { - resolution[0]=rl->rectx; - resolution[1]=rl->recty; - } + RenderLayer *rl = RE_GetRenderLayer(rr, srl->name); + if (rl && rl->rectf) { + resolution[0]=rl->rectx; + resolution[1]=rl->recty; + } } } if (re) - RE_ReleaseResult(re); + RE_ReleaseResult(re); } diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.h b/source/blender/compositor/operations/COM_RenderLayersBaseProg.h index a1802d1db65..64e2496621f 100644 --- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.h +++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.h @@ -45,7 +45,7 @@ private: /** * Reference to the scene object. */ - Scene* scene; + Scene *scene; /** * layerId of the layer where this operation needs to get its data from @@ -55,7 +55,7 @@ private: /** * cached instance to the float buffer inside the layer */ - float* inputBuffer; + float *inputBuffer; /** * renderpass where this operation needs to get its data from @@ -78,7 +78,7 @@ protected: /** * retrieve the reference to the float buffer of the renderer. */ - inline float* getInputBuffer() {return this->inputBuffer;} + inline float *getInputBuffer() {return this->inputBuffer;} public: /** @@ -86,13 +86,13 @@ public: * @see RenderLayerNode to set the actual scene where * the data will be retrieved from. */ - void setScene(Scene* scene) {this->scene = scene;} - Scene* getScene() {return this->scene;} + void setScene(Scene *scene) {this->scene = scene;} + Scene *getScene() {return this->scene;} void setLayerId(short layerId) {this->layerId = layerId;} short getLayerId() {return this->layerId;} void initExecution(); void deinitExecution(); - void executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; diff --git a/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp index 71461ac0e3f..aee68afe55d 100644 --- a/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersColorOperation.h" -RenderLayersColorOperation::RenderLayersColorOperation() :RenderLayersBaseProg(SCE_PASS_RGBA, 4) { +RenderLayersColorOperation::RenderLayersColorOperation() :RenderLayersBaseProg(SCE_PASS_RGBA, 4) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp index 17e2c6683d9..fc1df884181 100644 --- a/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersCyclesOperation.h" -RenderLayersCyclesOperation::RenderLayersCyclesOperation(int pass) :RenderLayersBaseProg(pass, 3) { +RenderLayersCyclesOperation::RenderLayersCyclesOperation(int pass) :RenderLayersBaseProg(pass, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp b/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp index badb9189206..985b1c1bee8 100644 --- a/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp @@ -22,7 +22,8 @@ #include "COM_RenderLayersDepthProg.h" -RenderLayersDepthProg::RenderLayersDepthProg() :RenderLayersBaseProg(SCE_PASS_Z, 1) { +RenderLayersDepthProg::RenderLayersDepthProg() :RenderLayersBaseProg(SCE_PASS_Z, 1) +{ this->addOutputSocket(COM_DT_VALUE); } diff --git a/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp index 6c3359ed063..ad73490b92d 100644 --- a/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersDiffuseOperation.h" -RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() :RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3) { +RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() :RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp index 936b1f0c59a..7537e2d10fc 100644 --- a/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersEmitOperation.h" -RenderLayersEmitOperation::RenderLayersEmitOperation() :RenderLayersBaseProg(SCE_PASS_EMIT, 3) { +RenderLayersEmitOperation::RenderLayersEmitOperation() :RenderLayersBaseProg(SCE_PASS_EMIT, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp index 642f07d7e16..0ace9a7c58f 100644 --- a/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersEnvironmentOperation.h" -RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() :RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3) { +RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() :RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp b/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp index a58f16b10a1..264e2f0fd79 100644 --- a/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersImageProg.h" -RenderLayersColourProg::RenderLayersColourProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4) { +RenderLayersColourProg::RenderLayersColourProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp index db61c237c61..645f9768eb2 100644 --- a/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersIndirectOperation.h" -RenderLayersIndirectOperation::RenderLayersIndirectOperation() :RenderLayersBaseProg(SCE_PASS_INDIRECT, 3) { +RenderLayersIndirectOperation::RenderLayersIndirectOperation() :RenderLayersBaseProg(SCE_PASS_INDIRECT, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp index 96bab2569dd..e5cef7753f2 100644 --- a/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersMaterialIndexOperation.h" -RenderLayersMaterialIndexOperation::RenderLayersMaterialIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXMA, 1) { +RenderLayersMaterialIndexOperation::RenderLayersMaterialIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXMA, 1) +{ this->addOutputSocket(COM_DT_VALUE); } diff --git a/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp index d3be993b3f9..fae6c73f747 100644 --- a/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersMistOperation.h" -RenderLayersMistOperation::RenderLayersMistOperation() :RenderLayersBaseProg(SCE_PASS_MIST, 1) { +RenderLayersMistOperation::RenderLayersMistOperation() :RenderLayersBaseProg(SCE_PASS_MIST, 1) +{ this->addOutputSocket(COM_DT_VALUE); } diff --git a/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp index dba40e3cc7a..67ea4d68204 100644 --- a/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersNormalOperation.h" -RenderLayersNormalOperation::RenderLayersNormalOperation() :RenderLayersBaseProg(SCE_PASS_NORMAL, 3) { +RenderLayersNormalOperation::RenderLayersNormalOperation() :RenderLayersBaseProg(SCE_PASS_NORMAL, 3) +{ this->addOutputSocket(COM_DT_VECTOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp index d4d14de6d98..821ff447112 100644 --- a/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersObjectIndexOperation.h" -RenderLayersObjectIndexOperation::RenderLayersObjectIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXOB, 1) { +RenderLayersObjectIndexOperation::RenderLayersObjectIndexOperation() :RenderLayersBaseProg(SCE_PASS_INDEXOB, 1) +{ this->addOutputSocket(COM_DT_VALUE); } diff --git a/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp index 0417a6fade2..e53144d3501 100644 --- a/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersReflectionOperation.h" -RenderLayersReflectionOperation::RenderLayersReflectionOperation() :RenderLayersBaseProg(SCE_PASS_REFLECT, 3) { +RenderLayersReflectionOperation::RenderLayersReflectionOperation() :RenderLayersBaseProg(SCE_PASS_REFLECT, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp index 74042f46f78..6e333175220 100644 --- a/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersRefractionOperation.h" -RenderLayersRefractionOperation::RenderLayersRefractionOperation() :RenderLayersBaseProg(SCE_PASS_REFRACT, 3) { +RenderLayersRefractionOperation::RenderLayersRefractionOperation() :RenderLayersBaseProg(SCE_PASS_REFRACT, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp index 87155607d82..ce492d54a79 100644 --- a/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersShadowOperation.h" -RenderLayersShadowOperation::RenderLayersShadowOperation() :RenderLayersBaseProg(SCE_PASS_SHADOW, 3) { +RenderLayersShadowOperation::RenderLayersShadowOperation() :RenderLayersBaseProg(SCE_PASS_SHADOW, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp index ed6a0853436..7b7d223680c 100644 --- a/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersSpecularOperation.h" -RenderLayersSpecularOperation::RenderLayersSpecularOperation() :RenderLayersBaseProg(SCE_PASS_SPEC, 3) { +RenderLayersSpecularOperation::RenderLayersSpecularOperation() :RenderLayersBaseProg(SCE_PASS_SPEC, 3) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp index 0a76d04959e..213d044a9bd 100644 --- a/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersSpeedOperation.h" -RenderLayersSpeedOperation::RenderLayersSpeedOperation() :RenderLayersBaseProg(SCE_PASS_VECTOR, 4) { +RenderLayersSpeedOperation::RenderLayersSpeedOperation() :RenderLayersBaseProg(SCE_PASS_VECTOR, 4) +{ this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp index b15bbb0f3dd..e3917d7796b 100644 --- a/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp @@ -22,6 +22,7 @@ #include "COM_RenderLayersUVOperation.h" -RenderLayersUVOperation::RenderLayersUVOperation() :RenderLayersBaseProg(SCE_PASS_UV, 3) { +RenderLayersUVOperation::RenderLayersUVOperation() :RenderLayersBaseProg(SCE_PASS_UV, 3) +{ this->addOutputSocket(COM_DT_VECTOR); } diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp index ac2e8c5e8a9..313e49d8609 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -23,7 +23,8 @@ #include "COM_RotateOperation.h" #include "BLI_math.h" -RotateOperation::RotateOperation() : NodeOperation() { +RotateOperation::RotateOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); @@ -32,7 +33,8 @@ RotateOperation::RotateOperation() : NodeOperation() { this->degreeSocket = NULL; this->doDegree2RadConversion = false; } -void RotateOperation::initExecution() { +void RotateOperation::initExecution() +{ this->imageSocket = this->getInputSocketReader(0); this->degreeSocket = this->getInputSocketReader(1); this->centerX = this->getWidth()/2.0; @@ -50,13 +52,15 @@ void RotateOperation::initExecution() { this->sine = sin(rad); } -void RotateOperation::deinitExecution() { +void RotateOperation::deinitExecution() +{ this->imageSocket = NULL; this->degreeSocket = NULL; } -void RotateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void RotateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ const float dy = y - this->centerY; const float dx = x - this->centerX; const float nx = this->centerX+(this->cosine*dx + this->sine*dy); @@ -64,7 +68,8 @@ void RotateOperation::executePixel(float *color,float x, float y, PixelSampler s this->imageSocket->read(color, nx, ny, sampler, inputBuffers); } -bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; const float dxmin = input->xmin - this->centerX; diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cpp b/source/blender/compositor/operations/COM_ScaleOperation.cpp index ef3d8250bab..ca2095c3170 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cpp +++ b/source/blender/compositor/operations/COM_ScaleOperation.cpp @@ -22,7 +22,8 @@ #include "COM_ScaleOperation.h" -ScaleOperation::ScaleOperation() : NodeOperation() { +ScaleOperation::ScaleOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); @@ -32,7 +33,8 @@ ScaleOperation::ScaleOperation() : NodeOperation() { this->inputXOperation = NULL; this->inputYOperation = NULL; } -void ScaleOperation::initExecution() { +void ScaleOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); this->inputXOperation = this->getInputSocketReader(1); this->inputYOperation = this->getInputSocketReader(2); @@ -40,14 +42,16 @@ void ScaleOperation::initExecution() { this->centerY = this->getHeight()/2.0; } -void ScaleOperation::deinitExecution() { +void ScaleOperation::deinitExecution() +{ this->inputOperation = NULL; this->inputXOperation = NULL; this->inputYOperation = NULL; } -void ScaleOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ScaleOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float scaleX[4]; float scaleY[4]; @@ -62,7 +66,8 @@ void ScaleOperation::executePixel(float *color,float x, float y, PixelSampler sa this->inputOperation->read(color, nx, ny, sampler, inputBuffers); } -bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; float scaleX[4]; float scaleY[4]; @@ -83,17 +88,19 @@ bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOpe // SCALE ABSOLUTE -ScaleAbsoluteOperation::ScaleAbsoluteOperation() : NodeOperation() { +ScaleAbsoluteOperation::ScaleAbsoluteOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); this->inputOperation = NULL; - this->inputXOperation= NULL; + this->inputXOperation = NULL; this->inputYOperation = NULL; } -void ScaleAbsoluteOperation::initExecution() { +void ScaleAbsoluteOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); this->inputXOperation = this->getInputSocketReader(1); this->inputYOperation = this->getInputSocketReader(2); @@ -101,14 +108,16 @@ void ScaleAbsoluteOperation::initExecution() { this->centerY = this->getHeight()/2.0; } -void ScaleAbsoluteOperation::deinitExecution() { +void ScaleAbsoluteOperation::deinitExecution() +{ this->inputOperation = NULL; this->inputXOperation = NULL; this->inputYOperation = NULL; } -void ScaleAbsoluteOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ScaleAbsoluteOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float scaleX[4]; float scaleY[4]; @@ -128,7 +137,8 @@ void ScaleAbsoluteOperation::executePixel(float *color,float x, float y, PixelSa this->inputOperation->read(color, nx, ny, sampler, inputBuffers); } -bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; float scaleX[4]; float scaleY[4]; @@ -154,28 +164,33 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, ReadB // Absolute fixed siez -ScaleFixedSizeOperation::ScaleFixedSizeOperation() : NodeOperation() { +ScaleFixedSizeOperation::ScaleFixedSizeOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); this->inputOperation = NULL; } -void ScaleFixedSizeOperation::initExecution() { +void ScaleFixedSizeOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); this->relX = inputOperation->getWidth() / (float)this->newWidth; this->relY = inputOperation->getHeight() / (float)this->newHeight; } -void ScaleFixedSizeOperation::deinitExecution() { +void ScaleFixedSizeOperation::deinitExecution() +{ this->inputOperation = NULL; } -void ScaleFixedSizeOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ScaleFixedSizeOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ this->inputOperation->read(color, x*relX, y*relY, sampler, inputBuffers); } -bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.xmax = input->xmax *relX; @@ -186,7 +201,8 @@ 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[], unsigned int preferredResolution[]) +{ unsigned int nr[2]; nr[0] = newWidth; nr[1] = newHeight; diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp index 474874d4bb4..4442fd9075e 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp @@ -27,13 +27,15 @@ extern "C" { #include "BLI_rand.h" } -ScreenLensDistortionOperation::ScreenLensDistortionOperation(): NodeOperation() { +ScreenLensDistortionOperation::ScreenLensDistortionOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); this->inputProgram = NULL; } -void ScreenLensDistortionOperation::initExecution() { +void ScreenLensDistortionOperation::initExecution() +{ this->inputProgram = this->getInputSocketReader(0); kg = MAX2(MIN2(this->distortion, 1.f), -0.999f); // smaller dispersion range for somewhat more control @@ -53,15 +55,17 @@ void ScreenLensDistortionOperation::initExecution() { } -void* ScreenLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { - void* buffer = inputProgram->initializeTileData(NULL, memoryBuffers); +void *ScreenLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ + void *buffer = inputProgram->initializeTileData(NULL, memoryBuffers); return buffer; } -void ScreenLensDistortionOperation::executePixel(float* outputColor, int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ const float height = this->getHeight(); const float width = this->getWidth(); - MemoryBuffer* buffer = (MemoryBuffer*)data; + MemoryBuffer *buffer = (MemoryBuffer*)data; int dr = 0, dg = 0, db = 0; float d, t, ln[6] = {0, 0, 0, 0, 0, 0}; @@ -132,21 +136,23 @@ void ScreenLensDistortionOperation::executePixel(float* outputColor, int x, int if (db) outputColor[2] = 2.f*tc[2] / (float)db; /* set alpha */ - outputColor[3]= 1.0f; + outputColor[3] = 1.0f; } else { - outputColor[0]= 0.0f; - outputColor[1]= 0.0f; - outputColor[2]= 0.0f; - outputColor[3]= 0.0f; + outputColor[0] = 0.0f; + outputColor[1] = 0.0f; + outputColor[2] = 0.0f; + outputColor[3] = 0.0f; } } -void ScreenLensDistortionOperation::deinitExecution() { +void ScreenLensDistortionOperation::deinitExecution() +{ this->inputProgram = NULL; } -void ScreenLensDistortionOperation::determineUV(float result[2], float x, float y) const { +void ScreenLensDistortionOperation::determineUV(float result[2], float x, float y) const +{ const float v = sc*((y + 0.5f) - cy)/cy; const float u = sc*((x + 0.5f) - cx)/cx; const float t = ABS(MIN3(kr, kg, kb)*4); @@ -155,7 +161,8 @@ void ScreenLensDistortionOperation::determineUV(float result[2], float x, float result[1] = (v*d + 0.5f)*getHeight() - 0.5f; } -bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.xmin = 0; newInput.ymin = 0; diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h index 65262cfd3dd..d2db55ea214 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h @@ -30,7 +30,7 @@ private: /** * Cached reference to the inputProgram */ - SocketReader* inputProgram; + SocketReader *inputProgram; NodeLensDist * data; @@ -48,27 +48,27 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution */ void initExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); /** * Deinitialize the execution */ void deinitExecution(); - void setData(NodeLensDist* data) {this->data = data;} + void setData(NodeLensDist *data) {this->data = data;} void setDispertion(float dispersion) {this->dispersion = dispersion;} void setDistortion(float distortion) {this->distortion = distortion;} bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); private: - void determineUV(float* result, float x, float y) const; + void determineUV(float *result, float x, float y) const; }; #endif diff --git a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp b/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp index 4e0ad1580cd..680e1648ebd 100644 --- a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp +++ b/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp @@ -22,21 +22,25 @@ #include "COM_SeparateChannelOperation.h" -SeparateChannelOperation::SeparateChannelOperation() : NodeOperation() { +SeparateChannelOperation::SeparateChannelOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VALUE); this->inputOperation = NULL; } -void SeparateChannelOperation::initExecution() { +void SeparateChannelOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void SeparateChannelOperation::deinitExecution() { +void SeparateChannelOperation::deinitExecution() +{ this->inputOperation = NULL; } -void SeparateChannelOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void SeparateChannelOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float input[4]; this->inputOperation->read(input, x, y, sampler, inputBuffers); color[0] = input[this->channel]; diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp index b6545912a80..0aefb075b64 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp @@ -22,7 +22,8 @@ #include "COM_SetAlphaOperation.h" -SetAlphaOperation::SetAlphaOperation(): NodeOperation() { +SetAlphaOperation::SetAlphaOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); @@ -31,12 +32,14 @@ SetAlphaOperation::SetAlphaOperation(): NodeOperation() { this->inputAlpha = NULL; } -void SetAlphaOperation::initExecution() { +void SetAlphaOperation::initExecution() +{ this->inputColor = getInputSocketReader(0); this->inputAlpha = getInputSocketReader(1); } -void SetAlphaOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void SetAlphaOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float alphaInput[4]; this->inputColor->read(outputValue, x, y, sampler, inputBuffers); @@ -45,7 +48,8 @@ void SetAlphaOperation::executePixel(float* outputValue, float x, float y, Pixel outputValue[3] = alphaInput[0]; } -void SetAlphaOperation::deinitExecution() { +void SetAlphaOperation::deinitExecution() +{ this->inputColor = NULL; this->inputAlpha = NULL; } diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.h b/source/blender/compositor/operations/COM_SetAlphaOperation.h index 2cb42bf8cf3..3d9caabf880 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.h +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.h @@ -43,7 +43,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_SetColorOperation.cpp b/source/blender/compositor/operations/COM_SetColorOperation.cpp index 729a8073d7a..50ff2a87a72 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.cpp +++ b/source/blender/compositor/operations/COM_SetColorOperation.cpp @@ -22,18 +22,21 @@ #include "COM_SetColorOperation.h" -SetColorOperation::SetColorOperation(): NodeOperation() { +SetColorOperation::SetColorOperation(): NodeOperation() +{ this->addOutputSocket(COM_DT_COLOR); } -void SetColorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void SetColorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ outputValue[0] = this->channel1; outputValue[1] = this->channel2; outputValue[2] = this->channel3; outputValue[3] = this->channel4; } -void SetColorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void SetColorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h index 13d4bc21392..dad3cfd7fc9 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.h +++ b/source/blender/compositor/operations/COM_SetColorOperation.h @@ -55,7 +55,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); const bool isSetOperation() const {return true;} diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp index d5fda4a8827..8974554e700 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp @@ -22,18 +22,22 @@ #include "COM_SetSamplerOperation.h" -SetSamplerOperation::SetSamplerOperation(): NodeOperation() { +SetSamplerOperation::SetSamplerOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); } -void SetSamplerOperation::initExecution() { +void SetSamplerOperation::initExecution() +{ this->reader = this->getInputSocketReader(0); } -void SetSamplerOperation::deinitExecution() { +void SetSamplerOperation::deinitExecution() +{ this->reader = NULL; } -void SetSamplerOperation::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void SetSamplerOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ reader->read(output, x, y, this->sampler, inputBuffers); } diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.h b/source/blender/compositor/operations/COM_SetSamplerOperation.h index f7b850fcfe9..49bbae7e4ff 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.h +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.h @@ -44,7 +44,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void initExecution(); void deinitExecution(); }; diff --git a/source/blender/compositor/operations/COM_SetValueOperation.cpp b/source/blender/compositor/operations/COM_SetValueOperation.cpp index a8a681a6659..abd4acafea6 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.cpp +++ b/source/blender/compositor/operations/COM_SetValueOperation.cpp @@ -22,15 +22,18 @@ #include "COM_SetValueOperation.h" -SetValueOperation::SetValueOperation(): NodeOperation() { +SetValueOperation::SetValueOperation(): NodeOperation() +{ this->addOutputSocket(COM_DT_VALUE); } -void SetValueOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void SetValueOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ outputValue[0] = this->value; } -void SetValueOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void SetValueOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h index 30a8de16dc4..25810cd7ee5 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.h +++ b/source/blender/compositor/operations/COM_SetValueOperation.h @@ -46,7 +46,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); const bool isSetOperation() const {return true;} diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cpp b/source/blender/compositor/operations/COM_SetVectorOperation.cpp index 3e9b68ac971..70477de0514 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.cpp +++ b/source/blender/compositor/operations/COM_SetVectorOperation.cpp @@ -23,18 +23,21 @@ #include "COM_SetVectorOperation.h" #include "COM_defines.h" -SetVectorOperation::SetVectorOperation(): NodeOperation() { +SetVectorOperation::SetVectorOperation(): NodeOperation() +{ this->addOutputSocket(COM_DT_VECTOR); } -void SetVectorOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void SetVectorOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ outputValue[0] = this->x; outputValue[1] = this->y; outputValue[2] = this->z; outputValue[3] = this->w; } -void SetVectorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void SetVectorOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ if (preferredResolution[0] == 0 ||preferredResolution[1]==0) { resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH; resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT; diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h index c1f3c679b5b..9b5dd3ce674 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.h +++ b/source/blender/compositor/operations/COM_SetVectorOperation.h @@ -54,7 +54,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); const bool isSetOperation() const {return true;} diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp index 161bdb3e295..6ed877523d1 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp @@ -22,20 +22,24 @@ #include "COM_SocketProxyOperation.h" -SocketProxyOperation::SocketProxyOperation() : NodeOperation() { +SocketProxyOperation::SocketProxyOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR/*|COM_DT_VECTOR|COM_DT_VALUE*/); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; } -void SocketProxyOperation::initExecution() { +void SocketProxyOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); } -void SocketProxyOperation::deinitExecution() { +void SocketProxyOperation::deinitExecution() +{ this->inputOperation = NULL; } -void SocketProxyOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void SocketProxyOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ this->inputOperation->read(color, x, y, sampler, inputBuffers); } diff --git a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp index f2d5e491001..4601bebb49f 100644 --- a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp @@ -36,30 +36,34 @@ extern "C" { } -SplitViewerOperation::SplitViewerOperation() : ViewerBaseOperation() { +SplitViewerOperation::SplitViewerOperation() : ViewerBaseOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR); this->image1Input = NULL; this->image2Input = NULL; } -void SplitViewerOperation::initExecution() { +void SplitViewerOperation::initExecution() +{ // When initializing the tree during initial load the width and height can be zero. this->image1Input = getInputSocketReader(0); this->image2Input = getInputSocketReader(1); ViewerBaseOperation::initExecution(); } -void SplitViewerOperation::deinitExecution() { +void SplitViewerOperation::deinitExecution() +{ this->image1Input = NULL; this->image2Input = NULL; ViewerBaseOperation::deinitExecution(); } -void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) { - float* buffer = this->outputBuffer; - unsigned char* bufferDisplay = this->outputBufferDisplay; +void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) +{ + float *buffer = this->outputBuffer; + unsigned char *bufferDisplay = this->outputBufferDisplay; if (!buffer) return; int x1 = rect->xmin; diff --git a/source/blender/compositor/operations/COM_SplitViewerOperation.h b/source/blender/compositor/operations/COM_SplitViewerOperation.h index 61e4b027cec..2c3163f0b0a 100644 --- a/source/blender/compositor/operations/COM_SplitViewerOperation.h +++ b/source/blender/compositor/operations/COM_SplitViewerOperation.h @@ -28,8 +28,8 @@ class SplitViewerOperation : public ViewerBaseOperation { private: - SocketReader* image1Input; - SocketReader* image2Input; + SocketReader *image1Input; + SocketReader *image2Input; float splitPercentage; bool xSplit; diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp index 3eb08140914..f7edd922376 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cpp +++ b/source/blender/compositor/operations/COM_TextureOperation.cpp @@ -25,30 +25,36 @@ #include "BLI_listbase.h" #include "DNA_scene_types.h" -TextureBaseOperation::TextureBaseOperation(): NodeOperation() { +TextureBaseOperation::TextureBaseOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_VECTOR);//offset this->addInputSocket(COM_DT_VECTOR);//size this->texture = NULL; this->inputSize = NULL; this->inputOffset = NULL; } -TextureOperation::TextureOperation() : TextureBaseOperation() { +TextureOperation::TextureOperation() : TextureBaseOperation() +{ this->addOutputSocket(COM_DT_COLOR); } -TextureAlphaOperation::TextureAlphaOperation() : TextureBaseOperation() { +TextureAlphaOperation::TextureAlphaOperation() : TextureBaseOperation() +{ this->addOutputSocket(COM_DT_VALUE); } -void TextureBaseOperation::initExecution() { +void TextureBaseOperation::initExecution() +{ this->inputOffset = getInputSocketReader(0); this->inputSize = getInputSocketReader(1); } -void TextureBaseOperation::deinitExecution() { +void TextureBaseOperation::deinitExecution() +{ this->inputSize = NULL; this->inputOffset = NULL; } -void TextureBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { +void TextureBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ if (preferredResolution[0] == 0 || preferredResolution[1] == 0) { resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH; resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT; @@ -59,7 +65,8 @@ void TextureBaseOperation::determineResolution(unsigned int resolution[], unsign } } -void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ TextureBaseOperation::executePixel(color, x, y, sampler, inputBuffers); color[0] = color[3]; color[1] = 0.0f; @@ -67,7 +74,8 @@ void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSa color[3] = 0.0f; } -void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; float textureSize[4]; float textureOffset[4]; @@ -81,21 +89,21 @@ void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSam this->inputSize->read(textureSize, x, y, sampler, inputBuffers); this->inputOffset->read(textureOffset, x, y, sampler, inputBuffers); - vec[0]= textureSize[0]*(u + textureOffset[0]); - vec[1]= textureSize[1]*(v + textureOffset[1]); - vec[2]= textureSize[2]*textureOffset[2]; + vec[0] = textureSize[0]*(u + textureOffset[0]); + vec[1] = textureSize[1]*(v + textureOffset[1]); + vec[2] = textureSize[2]*textureOffset[2]; - retval= multitex_ext(this->texture, vec, NULL, NULL, 0, &texres); + retval = multitex_ext(this->texture, vec, NULL, NULL, 0, &texres); if (texres.talpha) - color[3]= texres.ta; + color[3] = texres.ta; else - color[3]= texres.tin; + color[3] = texres.tin; if ((retval & TEX_RGB)) { - color[0]= texres.tr; - color[1]= texres.tg; - color[2]= texres.tb; + color[0] = texres.tr; + color[1] = texres.tg; + color[2] = texres.tb; } - else color[0]= color[1]= color[2]= color[3]; + else color[0] = color[1] = color[2] = color[3]; } diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h index a545a5eea97..ee067df2c64 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.h +++ b/source/blender/compositor/operations/COM_TextureOperation.h @@ -42,7 +42,7 @@ extern "C" { */ class TextureBaseOperation : public NodeOperation { private: - Tex* texture; + Tex *texture; SocketReader *inputSize; SocketReader *inputOffset; @@ -61,7 +61,7 @@ protected: public: void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); - void setTexture(Tex* texture) {this->texture = texture;} + void setTexture(Tex *texture) {this->texture = texture;} void initExecution(); void deinitExecution(); }; diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp index 84e893d0b2e..56830f4970d 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cpp +++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp @@ -26,7 +26,8 @@ -TonemapOperation::TonemapOperation(): NodeOperation() { +TonemapOperation::TonemapOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); this->imageReader = NULL; @@ -34,12 +35,14 @@ TonemapOperation::TonemapOperation(): NodeOperation() { this->cachedInstance = NULL; this->setComplex(true); } -void TonemapOperation::initExecution() { +void TonemapOperation::initExecution() +{ this->imageReader = this->getInputSocketReader(0); NodeOperation::initMutex(); } -void TonemapOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) { +void TonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data) +{ AvgLogLum * avg = (AvgLogLum*)data; float output[4]; @@ -65,7 +68,8 @@ void TonemapOperation::executePixel(float* color, int x, int y, MemoryBuffer *in color[2] = output[2]; color[3] = output[3]; } -void PhotoreceptorTonemapOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) { +void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data) +{ AvgLogLum * avg = (AvgLogLum*)data; NodeTonemap *ntm = this->data; @@ -96,7 +100,8 @@ void PhotoreceptorTonemapOperation::executePixel(float* color, int x, int y, Mem color[3] = output[3]; } -void TonemapOperation::deinitExecution() { +void TonemapOperation::deinitExecution() +{ this->imageReader = NULL; if (this->cachedInstance) { delete cachedInstance; @@ -104,10 +109,11 @@ void TonemapOperation::deinitExecution() { NodeOperation::deinitMutex(); } -bool TonemapOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool TonemapOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti imageInput; - NodeOperation* operation = getInputOperation(0); + NodeOperation *operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; imageInput.ymax = operation->getHeight(); @@ -118,17 +124,18 @@ bool TonemapOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferO return false; } -void* TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ BLI_mutex_lock(getMutex()); if (this->cachedInstance == NULL) { - MemoryBuffer* tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers); + MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers); AvgLogLum *data = new AvgLogLum(); float * buffer = tile->getBuffer(); float lsum = 0; int p = tile->getWidth() * tile->getHeight(); - float* bc = buffer; + float *bc = buffer; float avl, maxl = -1e10f, minl = 1e10f; const float sc = 1.f/(p); float Lav = 0.f; @@ -159,5 +166,6 @@ void* TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff return this->cachedInstance; } -void TonemapOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) { +void TonemapOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) +{ } diff --git a/source/blender/compositor/operations/COM_TonemapOperation.h b/source/blender/compositor/operations/COM_TonemapOperation.h index c895fdcba77..e7ea4f039f2 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.h +++ b/source/blender/compositor/operations/COM_TonemapOperation.h @@ -64,14 +64,14 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data); /** * Initialize the execution */ void initExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data); /** @@ -79,7 +79,7 @@ public: */ void deinitExecution(); - void setData(NodeTonemap* data) {this->data = data;} + void setData(NodeTonemap *data) {this->data = data;} bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); @@ -97,7 +97,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data); }; #endif diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp index 48774833e14..6d2fdfc11d0 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.cpp +++ b/source/blender/compositor/operations/COM_TranslateOperation.cpp @@ -22,7 +22,8 @@ #include "COM_TranslateOperation.h" -TranslateOperation::TranslateOperation() : NodeOperation() { +TranslateOperation::TranslateOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); @@ -32,7 +33,8 @@ TranslateOperation::TranslateOperation() : NodeOperation() { this->inputXOperation = NULL; this->inputYOperation = NULL; } -void TranslateOperation::initExecution() { +void TranslateOperation::initExecution() +{ this->inputOperation = this->getInputSocketReader(0); this->inputXOperation = this->getInputSocketReader(1); this->inputYOperation = this->getInputSocketReader(2); @@ -44,18 +46,21 @@ void TranslateOperation::initExecution() { this->deltaY = tempDelta[0]; } -void TranslateOperation::deinitExecution() { +void TranslateOperation::deinitExecution() +{ this->inputOperation = NULL; this->inputXOperation = NULL; this->inputYOperation = NULL; } -void TranslateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void TranslateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ this->inputOperation->read(color, x-this->getDeltaX(), y-this->getDeltaY(), sampler, inputBuffers); } -bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; newInput.xmax = input->xmax - this->getDeltaX(); diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index 83b9f55b431..f14de097dfd 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -27,7 +27,8 @@ extern "C" { #include "RE_pipeline.h" } -VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation() { +VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); // do not resize the bokeh image. this->addInputSocket(COM_DT_VALUE); @@ -42,14 +43,16 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation } -void VariableSizeBokehBlurOperation::initExecution() { +void VariableSizeBokehBlurOperation::initExecution() +{ this->inputProgram = getInputSocketReader(0); this->inputBokehProgram = getInputSocketReader(1); this->inputSizeProgram = getInputSocketReader(2); QualityStepHelper::initExecution(COM_QH_INCREASE); } -void VariableSizeBokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { +void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ float tempColor[4]; float readColor[4]; float bokeh[4]; @@ -87,8 +90,8 @@ void VariableSizeBokehBlurOperation::executePixel(float* color, int x, int y, Me /* pass */ } else if (size>= fabs(dx) && size >= fabs(dy)) { - float u = 256+ dx*256/size; - float v = 256+ dy*256/size; + float u = 256 + dx*256/size; + float v = 256 + dy*256/size; inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers); inputProgram->read(readColor, nx, ny, COM_PS_NEAREST, inputBuffers); tempColor[0] += bokeh[0] * readColor[0]; @@ -109,13 +112,15 @@ void VariableSizeBokehBlurOperation::executePixel(float* color, int x, int y, Me } -void VariableSizeBokehBlurOperation::deinitExecution() { +void VariableSizeBokehBlurOperation::deinitExecution() +{ this->inputProgram = NULL; this->inputBokehProgram = NULL; this->inputSizeProgram = NULL; } -bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ rcti newInput; rcti bokehInput; @@ -128,7 +133,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu bokehInput.ymax = 512; bokehInput.ymin = 0; - NodeOperation* operation = getInputOperation(2); + NodeOperation *operation = getInputOperation(2); if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) { return true; } diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h index 6c3159a8092..9c2c4b4bf68 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h @@ -29,9 +29,9 @@ class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepH private: int maxBlur; float threshold; - SocketReader* inputProgram; - SocketReader* inputBokehProgram; - SocketReader* inputSizeProgram; + SocketReader *inputProgram; + SocketReader *inputBokehProgram; + SocketReader *inputSizeProgram; public: VariableSizeBokehBlurOperation(); @@ -39,7 +39,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp index 7b6ebe9728f..e6305dc26a2 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp @@ -28,7 +28,8 @@ extern "C" { #include "RE_pipeline.h" } -VectorBlurOperation::VectorBlurOperation(): NodeOperation() { +VectorBlurOperation::VectorBlurOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); // ZBUF this->addInputSocket(COM_DT_COLOR); //SPEED @@ -40,7 +41,8 @@ VectorBlurOperation::VectorBlurOperation(): NodeOperation() { this->inputZProgram = NULL; setComplex(true); } -void VectorBlurOperation::initExecution() { +void VectorBlurOperation::initExecution() +{ initMutex(); this->inputImageProgram = getInputSocketReader(0); this->inputZProgram = getInputSocketReader(1); @@ -50,8 +52,9 @@ void VectorBlurOperation::initExecution() { } -void VectorBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data) { - float* buffer = (float*) data; +void VectorBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ + float *buffer = (float*) data; int index = (y*this->getWidth() + x) * COM_NUMBER_OF_CHANNELS; color[0] = buffer[index]; color[1] = buffer[index+1]; @@ -59,7 +62,8 @@ void VectorBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer color[3] = buffer[index+3]; } -void VectorBlurOperation::deinitExecution() { +void VectorBlurOperation::deinitExecution() +{ deinitMutex(); this->inputImageProgram = NULL; this->inputSpeedProgram = NULL; @@ -69,15 +73,16 @@ void VectorBlurOperation::deinitExecution() { this->cachedInstance = NULL; } } -void* VectorBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { +void *VectorBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ if (this->cachedInstance) return this->cachedInstance; BLI_mutex_lock(getMutex()); if (this->cachedInstance == NULL) { - MemoryBuffer* tile = (MemoryBuffer*)inputImageProgram->initializeTileData(rect, memoryBuffers); - MemoryBuffer* speed= (MemoryBuffer*)inputSpeedProgram->initializeTileData(rect, memoryBuffers); - MemoryBuffer* z = (MemoryBuffer*)inputZProgram->initializeTileData(rect, memoryBuffers); - float* data = new float[this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS]; + MemoryBuffer *tile = (MemoryBuffer*)inputImageProgram->initializeTileData(rect, memoryBuffers); + MemoryBuffer *speed = (MemoryBuffer*)inputSpeedProgram->initializeTileData(rect, memoryBuffers); + MemoryBuffer *z = (MemoryBuffer*)inputZProgram->initializeTileData(rect, memoryBuffers); + float *data = new float[this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS]; memcpy(data, tile->getBuffer(),this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS*sizeof(float)); this->generateVectorBlur(data, tile, speed, z); this->cachedInstance = data; @@ -86,7 +91,8 @@ void* VectorBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB return this->cachedInstance; } -bool VectorBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { +bool VectorBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ if (this->cachedInstance == NULL) { rcti newInput; newInput.xmax = this->getWidth(); @@ -100,7 +106,8 @@ bool VectorBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuff } } -void VectorBlurOperation::generateVectorBlur(float* data, MemoryBuffer* inputImage, MemoryBuffer* inputSpeed, MemoryBuffer* inputZ) { +void VectorBlurOperation::generateVectorBlur(float *data, MemoryBuffer *inputImage, MemoryBuffer *inputSpeed, MemoryBuffer *inputZ) +{ float *zbuf = inputZ->convertToValueBuffer(); NodeBlurData blurdata; blurdata.samples = this->settings->samples/QualityStepHelper::getStep(); diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h index e3275f1bc15..2c45628726d 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.h +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h @@ -40,7 +40,7 @@ private: */ NodeBlurData * settings; - float* cachedInstance; + float *cachedInstance; public: VectorBlurOperation(); @@ -48,7 +48,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void* data); + void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data); /** * Initialize the execution @@ -60,13 +60,13 @@ public: */ void deinitExecution(); - void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); void setVectorBlurSettings(NodeBlurData * settings) {this->settings = settings;} bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); protected: - void generateVectorBlur(float* data, MemoryBuffer* inputImage, MemoryBuffer* inputSpeed, MemoryBuffer* inputZ); + void generateVectorBlur(float *data, MemoryBuffer *inputImage, MemoryBuffer *inputSpeed, MemoryBuffer *inputZ); }; diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp index 697d082c33e..e9045b126e2 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp @@ -30,27 +30,31 @@ extern "C" { } #endif -VectorCurveOperation::VectorCurveOperation(): CurveBaseOperation() { +VectorCurveOperation::VectorCurveOperation(): CurveBaseOperation() +{ this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_VECTOR); this->inputProgram = NULL; } -void VectorCurveOperation::initExecution() { +void VectorCurveOperation::initExecution() +{ CurveBaseOperation::initExecution(); this->inputProgram = this->getInputSocketReader(0); } -void VectorCurveOperation::executePixel(float* output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void VectorCurveOperation::executePixel(float *output, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float input[4]; this->inputProgram->read(input, x, y, sampler, inputBuffers); curvemapping_evaluate_premulRGBF(this->curveMapping, output, input); - output[3]= input[3]; + output[3] = input[3]; } -void VectorCurveOperation::deinitExecution() { +void VectorCurveOperation::deinitExecution() +{ this->inputProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.h b/source/blender/compositor/operations/COM_VectorCurveOperation.h index d3097345ae5..759e265220f 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.h +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.h @@ -37,7 +37,7 @@ public: /** * the inner loop of this program */ - void executePixel(float* Vector, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *Vector, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); /** * Initialize the execution diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp index 85b5cc4c3a8..44b4c26fb64 100644 --- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp @@ -38,7 +38,8 @@ extern "C" { } -ViewerBaseOperation::ViewerBaseOperation() : NodeOperation() { +ViewerBaseOperation::ViewerBaseOperation() : NodeOperation() +{ this->setImage(NULL); this->setImageUser(NULL); this->outputBuffer = NULL; @@ -47,25 +48,27 @@ ViewerBaseOperation::ViewerBaseOperation() : NodeOperation() { this->doColorManagement = true; } -void ViewerBaseOperation::initExecution() { +void ViewerBaseOperation::initExecution() +{ // When initializing the tree during initial load the width and height can be zero. initImage(); } -void ViewerBaseOperation::initImage() { - Image* anImage = this->image; - ImBuf *ibuf= BKE_image_acquire_ibuf(anImage, this->imageUser, &this->lock); +void ViewerBaseOperation::initImage() +{ + Image *anImage = this->image; + ImBuf *ibuf = BKE_image_acquire_ibuf(anImage, this->imageUser, &this->lock); if (!ibuf) return; if (ibuf->x != (int)getWidth() || ibuf->y != (int)getHeight()) { imb_freerectImBuf(ibuf); imb_freerectfloatImBuf(ibuf); IMB_freezbuffloatImBuf(ibuf); - ibuf->x= getWidth(); - ibuf->y= getHeight(); + ibuf->x = getWidth(); + ibuf->y = getHeight(); imb_addrectImBuf(ibuf); imb_addrectfloatImBuf(ibuf); - anImage->ok= IMA_OK_LOADED; + anImage->ok = IMA_OK_LOADED; } /* now we combine the input with ibuf */ @@ -74,16 +77,19 @@ void ViewerBaseOperation::initImage() { BKE_image_release_ibuf(this->image, this->lock); } -void ViewerBaseOperation:: updateImage(rcti *rect) { +void ViewerBaseOperation:: updateImage(rcti *rect) +{ /// @todo: introduce new event to update smaller area WM_main_add_notifier(NC_WINDOW|ND_DRAW, NULL); } -void ViewerBaseOperation::deinitExecution() { +void ViewerBaseOperation::deinitExecution() +{ this->outputBuffer = NULL; } -const int ViewerBaseOperation::getRenderPriority() const { +const int ViewerBaseOperation::getRenderPriority() const +{ if (this->isActiveViewerOutput()) { return 8; } diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.h b/source/blender/compositor/operations/COM_ViewerBaseOperation.h index e94d2644e36..58101911550 100644 --- a/source/blender/compositor/operations/COM_ViewerBaseOperation.h +++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.h @@ -34,7 +34,7 @@ protected: ImageUser * imageUser; void *lock; bool active; - const bNodeTree* tree; + const bNodeTree *tree; float centerX; float centerY; OrderOfChunks chunkOrder; @@ -45,11 +45,11 @@ public: bool isOutputOperation(bool rendering) const {return true;} void initExecution(); void deinitExecution(); - void setImage(Image* image) {this->image = image;} - void setImageUser(ImageUser* imageUser) {this->imageUser = imageUser;} + void setImage(Image *image) {this->image = image;} + void setImageUser(ImageUser *imageUser) {this->imageUser = imageUser;} const bool isActiveViewerOutput() const {return active;} void setActive(bool active) {this->active = active;} - void setbNodeTree(const bNodeTree* tree) {this->tree = tree;} + void setbNodeTree(const bNodeTree *tree) {this->tree = tree;} void setCenterX(float centerX) {this->centerX = centerX;} void setCenterY(float centerY) {this->centerY = centerY;} void setChunkOrder(OrderOfChunks tileOrder) {this->chunkOrder = tileOrder;} diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index 8fa63329e1f..22e6511fbe7 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -39,7 +39,8 @@ extern "C" { } -ViewerOperation::ViewerOperation() : ViewerBaseOperation() { +ViewerOperation::ViewerOperation() : ViewerBaseOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); @@ -47,23 +48,26 @@ ViewerOperation::ViewerOperation() : ViewerBaseOperation() { this->alphaInput = NULL; } -void ViewerOperation::initExecution() { +void ViewerOperation::initExecution() +{ // When initializing the tree during initial load the width and height can be zero. this->imageInput = getInputSocketReader(0); this->alphaInput = getInputSocketReader(1); ViewerBaseOperation::initExecution(); } -void ViewerOperation::deinitExecution() { +void ViewerOperation::deinitExecution() +{ this->imageInput = NULL; this->alphaInput = NULL; ViewerBaseOperation::deinitExecution(); } -void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) { - float* buffer = this->outputBuffer; - unsigned char* bufferDisplay = this->outputBufferDisplay; +void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) +{ + float *buffer = this->outputBuffer; + unsigned char *bufferDisplay = this->outputBufferDisplay; if (!buffer) return; const int x1 = rect->xmin; const int y1 = rect->ymin; diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h index 951e9ff6fc3..4ffae31c131 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.h +++ b/source/blender/compositor/operations/COM_ViewerOperation.h @@ -29,8 +29,8 @@ class ViewerOperation : public ViewerBaseOperation { private: - SocketReader* imageInput; - SocketReader* alphaInput; + SocketReader *imageInput; + SocketReader *alphaInput; public: ViewerOperation(); diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp index 6bb38c007ef..3af914f8d0e 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp @@ -26,37 +26,43 @@ #include <stdio.h> /// @TODO: writebuffers don't have an actual data type set. -WriteBufferOperation::WriteBufferOperation() :NodeOperation() { +WriteBufferOperation::WriteBufferOperation() :NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->memoryProxy = new MemoryProxy(); this->memoryProxy->setWriteBufferOperation(this); this->memoryProxy->setExecutor(NULL); this->tree = NULL; } -WriteBufferOperation::~WriteBufferOperation() { +WriteBufferOperation::~WriteBufferOperation() +{ if (this->memoryProxy) { delete this->memoryProxy; this->memoryProxy = NULL; } } -void WriteBufferOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void WriteBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ input->read(color, x, y, sampler, inputBuffers); } -void WriteBufferOperation::initExecution() { +void WriteBufferOperation::initExecution() +{ this->input = this->getInputOperation(0); MemoryManager::addMemoryProxy(this->memoryProxy); } -void WriteBufferOperation::deinitExecution() { +void WriteBufferOperation::deinitExecution() +{ this->input = NULL; } -void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) { - MemoryBuffer* memoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), tileNumber); - float* buffer = memoryBuffer->getBuffer(); +void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) +{ + MemoryBuffer *memoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), tileNumber); + float *buffer = memoryBuffer->getBuffer(); if (this->input->isComplex()) { - void* data = this->input->initializeTileData(rect, memoryBuffers); + void *data = this->input->initializeTileData(rect, memoryBuffers); int x1 = rect->xmin; int y1 = rect->ymin; int x2 = rect->xmax; @@ -103,18 +109,19 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me memoryBuffer->setCreatedState(); } -void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** inputMemoryBuffers) { - MemoryBuffer* outputMemoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), chunkNumber); - float* outputFloatBuffer = outputMemoryBuffer->getBuffer(); +void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** inputMemoryBuffers) +{ + MemoryBuffer *outputMemoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), chunkNumber); + float *outputFloatBuffer = outputMemoryBuffer->getBuffer(); cl_int error; /* - 1. create cl_mem from outputbuffer - 2. call NodeOperation (input) executeOpenCLChunk(.....) - 3. schedule readback from opencl to main device (outputbuffer) - 4. schedule native callback - - note: list of cl_mem will be filled by 2, and needs to be cleaned up by 4 - */ + * 1. create cl_mem from outputbuffer + * 2. call NodeOperation (input) executeOpenCLChunk(.....) + * 3. schedule readback from opencl to main device (outputbuffer) + * 4. schedule native callback + * + * note: list of cl_mem will be filled by 2, and needs to be cleaned up by 4 + */ // STEP 1 const unsigned int outputBufferWidth = outputMemoryBuffer->getWidth(); const unsigned int outputBufferHeight = outputMemoryBuffer->getHeight(); diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h index 3b28ffd4f63..b17122d68f0 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.h +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h @@ -38,14 +38,14 @@ public: WriteBufferOperation(); ~WriteBufferOperation(); int isBufferOperation() {return true;} - MemoryProxy* getMemoryProxy() {return this->memoryProxy;} - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + MemoryProxy *getMemoryProxy() {return this->memoryProxy;} + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); const bool isWriteBufferOperation() const {return true;} void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers); void initExecution(); void deinitExecution(); - void setbNodeTree(const bNodeTree* tree) {this->tree = tree;} + void setbNodeTree(const bNodeTree *tree) {this->tree = tree;} void executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** memoryBuffers); }; diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp index e45d66dd597..7f32bac2e64 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp +++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp @@ -23,7 +23,8 @@ #include "COM_ZCombineOperation.h" #include "BLI_utildefines.h" -ZCombineOperation::ZCombineOperation(): NodeOperation() { +ZCombineOperation::ZCombineOperation(): NodeOperation() +{ this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); @@ -37,14 +38,16 @@ ZCombineOperation::ZCombineOperation(): NodeOperation() { } -void ZCombineOperation::initExecution() { +void ZCombineOperation::initExecution() +{ this->image1Reader = this->getInputSocketReader(0); this->depth1Reader = this->getInputSocketReader(1); this->image2Reader = this->getInputSocketReader(2); this->depth2Reader = this->getInputSocketReader(3); } -void ZCombineOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ZCombineOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float depth1[4]; float depth2[4]; @@ -57,7 +60,8 @@ void ZCombineOperation::executePixel(float* color, float x, float y, PixelSample this->image2Reader->read(color, x, y, sampler, inputBuffers); } } -void ZCombineAlphaOperation::executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { +void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +{ float depth1[4]; float depth2[4]; float color1[4]; @@ -81,7 +85,8 @@ void ZCombineAlphaOperation::executePixel(float* color, float x, float y, PixelS color[3] = MAX2(color1[3], color2[3]); } -void ZCombineOperation::deinitExecution() { +void ZCombineOperation::deinitExecution() +{ this->image1Reader = NULL; this->depth1Reader = NULL; this->image2Reader = NULL; diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.h b/source/blender/compositor/operations/COM_ZCombineOperation.h index d5a3f02fea2..f9de916fce0 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.h +++ b/source/blender/compositor/operations/COM_ZCombineOperation.h @@ -31,10 +31,10 @@ */ class ZCombineOperation : public NodeOperation { protected: - SocketReader* image1Reader; - SocketReader* depth1Reader; - SocketReader* image2Reader; - SocketReader* depth2Reader; + SocketReader *image1Reader; + SocketReader *depth1Reader; + SocketReader *image2Reader; + SocketReader *depth2Reader; public: /** * Default constructor @@ -47,11 +47,11 @@ public: /** * the inner loop of this program */ - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; class ZCombineAlphaOperation: public ZCombineOperation { - void executePixel(float* color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); }; #endif |