diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-15 13:58:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-15 13:58:52 +0400 |
commit | ec755bdfa7920c9db4dd771c065e85539b00d140 (patch) | |
tree | fc05b551bd397aae04c478a5fcb6ea7c0be05b2e /source/blender/compositor | |
parent | 3264db37972877184ead9785181722e5cf65f164 (diff) |
style cleanup: composite/blur
Diffstat (limited to 'source/blender/compositor')
18 files changed, 197 insertions, 195 deletions
diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp index fa654d35785..6baa04ff7c2 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp @@ -26,13 +26,13 @@ #include "COM_ExecutionSystem.h" #include "COM_BilateralBlurOperation.h" -BilateralBlurNode::BilateralBlurNode(bNode *editorNode): Node(editorNode) +BilateralBlurNode::BilateralBlurNode(bNode *editorNode) : Node(editorNode) { } -void BilateralBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) +void BilateralBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { - NodeBilateralBlurData *data = (NodeBilateralBlurData*)this->getbNode()->storage; + NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->getbNode()->storage; BilateralBlurOperation *operation = new BilateralBlurOperation(); operation->setQuality(context->getQuality()); operation->setData(data); diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp index b27b6323f49..fe93768161c 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BlurNode.cpp @@ -29,19 +29,19 @@ #include "COM_GaussianBokehBlurOperation.h" #include "COM_FastGaussianBlurOperation.h" -BlurNode::BlurNode(bNode *editorNode): Node(editorNode) +BlurNode::BlurNode(bNode *editorNode) : Node(editorNode) { } -void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) +void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { bNode *editorNode = this->getbNode(); - NodeBlurData * data = (NodeBlurData*)editorNode->storage; - InputSocket * inputSizeSocket = this->getInputSocket(1); + NodeBlurData *data = (NodeBlurData *)editorNode->storage; + InputSocket *inputSizeSocket = this->getInputSocket(1); bool connectedSizeSocket = inputSizeSocket->isConnected(); const bNodeSocket *sock = this->getInputSocket(1)->getbNodeSocket(); - const float size = ((const bNodeSocketValueFloat*)sock->default_value)->value; + const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value; CompositorQuality quality = context->getQuality(); diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp index abae1b88890..ee0119230f4 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp @@ -30,11 +30,11 @@ #include "COM_VariableSizeBokehBlurOperation.h" #include "COM_ConvertDepthToRadiusOperation.h" -BokehBlurNode::BokehBlurNode(bNode *editorNode): Node(editorNode) +BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode) { } -void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) +void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { Object *camob = context->getScene()->camera; @@ -58,7 +58,7 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph); this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph); - operation->setSize(((bNodeSocketValueFloat*)this->getInputSocket(2)->getbNodeSocket()->default_value)->value); + operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value); operation->setQuality(context->getQuality()); graph->addOperation(operation); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp index d63fbbdb092..d096ef977f8 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp @@ -26,13 +26,13 @@ #include "COM_ExecutionSystem.h" #include "COM_DirectionalBlurOperation.h" -DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode): Node(editorNode) +DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode) : Node(editorNode) { } -void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) +void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { - NodeDBlurData *data = (NodeDBlurData*)this->getbNode()->storage; + NodeDBlurData *data = (NodeDBlurData *)this->getbNode()->storage; DirectionalBlurOperation *operation = new DirectionalBlurOperation(); operation->setQuality(context->getQuality()); operation->setData(data); diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp index 98096c3de7b..78b9065b4da 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp @@ -24,14 +24,14 @@ #include "DNA_node_types.h" #include "COM_VectorBlurOperation.h" -VectorBlurNode::VectorBlurNode(bNode *editorNode): Node(editorNode) +VectorBlurNode::VectorBlurNode(bNode *editorNode) : Node(editorNode) { } -void VectorBlurNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) +void VectorBlurNode::convertToOperations(ExecutionSystem *system, CompositorContext *context) { bNode *node = this->getbNode(); - NodeBlurData *vectorBlurSettings = (NodeBlurData*)node->storage; + NodeBlurData *vectorBlurSettings = (NodeBlurData *)node->storage; VectorBlurOperation *operation = new VectorBlurOperation(); operation->setVectorBlurSettings(vectorBlurSettings); operation->setQuality(context->getQuality()); diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp index 7129e7c140a..3628c399581 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp @@ -65,14 +65,14 @@ void BilateralBlurOperation::executePixel(float *color, int x, int y, MemoryBuff zero_v4(blurColor); blurDivider = 0.0f; - for (int yi = miny ; yi < maxy ; yi+=QualityStepHelper::getStep()) { - for (int xi = minx ; xi < maxx ; xi+=QualityStepHelper::getStep()) { + for (int yi = miny; yi < maxy; yi += QualityStepHelper::getStep()) { + for (int xi = minx; xi < maxx; xi += QualityStepHelper::getStep()) { // read determinator this->inputDeterminatorProgram->read(determinator, xi, yi, inputBuffers, data); deltaColor = (fabsf(determinatorReferenceColor[0] - determinator[0]) + fabsf(determinatorReferenceColor[1] - determinator[1]) + fabsf(determinatorReferenceColor[2] - determinator[2])); // do not take the alpha channel into account - if (deltaColor< sigmacolor) { + if (deltaColor < sigmacolor) { // add this to the blur this->inputColorProgram->read(tempColor, xi, yi, inputBuffers, data); add_v4_v4(blurColor, tempColor); @@ -101,7 +101,7 @@ void BilateralBlurOperation::deinitExecution() bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - int add = ceil(this->space)+1; + int add = ceil(this->space) + 1; newInput.xmax = input->xmax + (add); newInput.xmin = input->xmin - (add); diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp index 2280ee3a435..bb915fec590 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp @@ -27,7 +27,7 @@ extern "C" { #include "RE_pipeline.h" } -BlurBaseOperation::BlurBaseOperation(): NodeOperation() +BlurBaseOperation::BlurBaseOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); @@ -37,7 +37,7 @@ BlurBaseOperation::BlurBaseOperation(): NodeOperation() this->data = NULL; this->size = 1.0f; this->deleteData = false; - this->sizeavailable=false; + this->sizeavailable = false; } void BlurBaseOperation::initExecution() { @@ -47,18 +47,18 @@ void BlurBaseOperation::initExecution() 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); - 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); - 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); - break; + 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); + 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); + 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); + break; } } @@ -77,14 +77,14 @@ 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; + gausstab[i + rad] = val; } - sum = 1.0f/sum; - for (i=0; i<n; i++) - gausstab[i]*= sum; + sum = 1.0f / sum; + for (i = 0; i < n; i++) + gausstab[i] *= sum; return gausstab; } diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index 67e24496cbe..dca087bb587 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -59,15 +59,15 @@ void BokehBlurOperation::initExecution() int height = inputBokehProgram->getHeight(); float dimension; - if (width<height) { + if (width < height) { dimension = width; } else { dimension = height; } - this->bokehMidX = width/2.0f; - this->bokehMidY = height/2.0f; - this->bokehDimension = dimension/2.0f; + this->bokehMidX = width / 2.0f; + this->bokehMidY = height / 2.0f; + this->bokehDimension = dimension / 2.0f; QualityStepHelper::initExecution(COM_QH_INCREASE); } @@ -78,14 +78,14 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer * float bokeh[4]; inputBoundingBoxReader->read(tempBoundingBox, x, y, COM_PS_NEAREST, inputBuffers); - if (tempBoundingBox[0] >0.0f) { + if (tempBoundingBox[0] > 0.0f) { float overallmultiplyer[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; int bufferstarty = inputBuffer->getRect()->ymin; - int pixelSize = this->size*this->getWidth()/100.0f; + int pixelSize = this->size * this->getWidth() / 100.0f; int miny = y - pixelSize; int maxy = y + pixelSize; @@ -101,16 +101,16 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer * int step = getStep(); int offsetadd = getOffsetAdd(); - float m = this->bokehDimension/pixelSize; - for (int ny = miny ; ny < maxy ; ny +=step) { - int bufferindex = ((minx - bufferstartx)*4)+((ny-bufferstarty)*4*bufferwidth); - for (int nx = minx ; nx < maxx ; nx +=step) { - float u = this->bokehMidX - (nx-x) *m; - float v = this->bokehMidY - (ny-y) *m; + float m = this->bokehDimension / pixelSize; + for (int ny = miny; ny < maxy; ny += step) { + int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth); + for (int nx = minx; nx < maxx; nx += step) { + float u = this->bokehMidX - (nx - x) * m; + float v = this->bokehMidY - (ny - y) * m; inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers); madd_v4_v4v4(tempColor, bokeh, &buffer[bufferindex]); add_v4_v4(overallmultiplyer, bokeh); - bufferindex +=offsetadd; + bufferindex += offsetadd; } } color[0] = tempColor[0] * (1.0f / overallmultiplyer[0]); @@ -135,10 +135,10 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe rcti newInput; rcti bokehInput; - newInput.xmax = input->xmax + (size*this->getWidth()/100.0f); - newInput.xmin = input->xmin - (size*this->getWidth()/100.0f); - newInput.ymax = input->ymax + (size*this->getWidth()/100.0f); - newInput.ymin = input->ymin - (size*this->getWidth()/100.0f); + newInput.xmax = input->xmax + (size * this->getWidth() / 100.0f); + newInput.xmin = input->xmin - (size * this->getWidth() / 100.0f); + newInput.ymax = input->ymax + (size * this->getWidth() / 100.0f); + newInput.ymin = input->ymin - (size * this->getWidth() / 100.0f); NodeOperation *operation = getInputOperation(1); bokehInput.xmax = operation->getWidth(); @@ -168,7 +168,7 @@ void BokehBlurOperation::executeOpenCL(cl_context context, cl_program program, c if (!kernel) { kernel = COM_clCreateKernel(program, "bokehBlurKernel", NULL); } - cl_int radius = this->getWidth()*this->size/100.0f; + cl_int radius = this->getWidth() * this->size / 100.0f; cl_int step = this->getStep(); COM_clAttachMemoryBufferToKernelParameter(context, kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->inputBoundingBoxReader); diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp index 60c31400eca..271a165f0ff 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp @@ -54,12 +54,12 @@ void DirectionalBlurOperation::initExecution() const float itsc = 1.0f / powf(2.0f, (float)iterations); float D; - D = distance * sqrtf(width*width + height*height); + D = distance * sqrtf(width * width + height * height); center_x_pix = center_x * width; center_y_pix = center_y * height; tx = itsc * D * cosf(a); - ty = -itsc * D * sinf(a); + ty = -itsc *D *sinf(a); sc = itsc * zoom; rot = itsc * spin; @@ -68,8 +68,8 @@ void DirectionalBlurOperation::initExecution() 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; diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index 92e1aace9e2..7830eef829c 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -24,14 +24,14 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation() +FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation() { this->iirgaus = NULL; } -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; + MemoryBuffer *newData = (MemoryBuffer *)data; newData->read(color, x, y); } @@ -44,7 +44,7 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, Re sizeInput.xmax = 5; sizeInput.ymax = 5; - NodeOperation * operation = this->getInputOperation(1); + NodeOperation *operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; } @@ -81,25 +81,25 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **m { lockMutex(); if (!iirgaus) { - MemoryBuffer *newBuf = (MemoryBuffer*)this->inputProgram->initializeTileData(rect, memoryBuffers); + MemoryBuffer *newBuf = (MemoryBuffer *)this->inputProgram->initializeTileData(rect, memoryBuffers); MemoryBuffer *copy = newBuf->duplicate(); updateSize(memoryBuffers); int c; - sx = data->sizex * this->size/2.0f; - sy = data->sizey * this->size/2.0f; + sx = data->sizex * this->size / 2.0f; + sy = data->sizey * this->size / 2.0f; if ((sx == sy) && (sx > 0.f)) { - for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c) + for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c) IIR_gauss(copy, sx, c, 3); } else { if (sx > 0.f) { - for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c) + for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c) IIR_gauss(copy, sx, c, 1); } if (sy > 0.f) { - for (c=0; c<COM_NUMBER_OF_CHANNELS; ++c) + for (c = 0; c < COM_NUMBER_OF_CHANNELS; ++c) IIR_gauss(copy, sy, c, 2); } } @@ -130,17 +130,17 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int ch // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 if (sigma >= 3.556f) - q = 0.9804f*(sigma - 3.556f) + 2.5091f; + q = 0.9804f * (sigma - 3.556f) + 2.5091f; else // sigma >= 0.5 - q = (0.0561f*sigma + 0.5784f)*sigma - 0.2568f; - q2 = q*q; - sc = (1.1668 + q)*(3.203729649 + (2.21566 + q)*q); + q = (0.0561f * sigma + 0.5784f) * sigma - 0.2568f; + q2 = q * q; + sc = (1.1668 + q) * (3.203729649 + (2.21566 + q) * q); // no gabor filtering here, so no complex multiplies, just the regular coefs. // all negated here, so as not to have to recalc Triggs/Sdika matrix - cf[1] = q*(5.788961737 + (6.76492 + 3.0*q)*q)/ sc; - cf[2] = -q2*(3.38246 + 3.0*q)/sc; + cf[1] = q * (5.788961737 + (6.76492 + 3.0 * q) * q) / sc; + cf[2] = -q2 * (3.38246 + 3.0 * q) / sc; // 0 & 3 unchanged - cf[3] = q2*q/sc; + cf[3] = q2 * q / sc; cf[0] = 1.0 - cf[1] - cf[2] - cf[3]; // Triggs/Sdika border corrections, @@ -150,59 +150,61 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, int ch // but neither seem to be quite the same, result seems to be ok so far anyway. // Extra scale factor here to not have to do it in filter, // though maybe this had something to with the precision errors - sc = cf[0]/((1.0 + cf[1] - cf[2] + cf[3])*(1.0 - cf[1] - cf[2] - cf[3])*(1.0 + cf[2] + (cf[1] - cf[3])*cf[3])); - tsM[0] = sc*(-cf[3]*cf[1] + 1.0 - cf[3]*cf[3] - cf[2]); - tsM[1] = sc*((cf[3] + cf[1])*(cf[2] + cf[3]*cf[1])); - tsM[2] = sc*(cf[3]*(cf[1] + cf[3]*cf[2])); - tsM[3] = sc*(cf[1] + cf[3]*cf[2]); - tsM[4] = sc*(-(cf[2] - 1.0)*(cf[2] + cf[3]*cf[1])); - tsM[5] = sc*(-(cf[3]*cf[1] + cf[3]*cf[3] + cf[2] - 1.0)*cf[3]); - tsM[6] = sc*(cf[3]*cf[1] + cf[2] + cf[1]*cf[1] - cf[2]*cf[2]); - tsM[7] = sc*(cf[1]*cf[2] + cf[3]*cf[2]*cf[2] - cf[1]*cf[3]*cf[3] - cf[3]*cf[3]*cf[3] - cf[3]*cf[2] + cf[3]); - tsM[8] = sc*(cf[3]*(cf[1] + cf[3]*cf[2])); + sc = cf[0] / ((1.0 + cf[1] - cf[2] + cf[3]) * (1.0 - cf[1] - cf[2] - cf[3]) * (1.0 + cf[2] + (cf[1] - cf[3]) * cf[3])); + tsM[0] = sc * (-cf[3] * cf[1] + 1.0 - cf[3] * cf[3] - cf[2]); + tsM[1] = sc * ((cf[3] + cf[1]) * (cf[2] + cf[3] * cf[1])); + tsM[2] = sc * (cf[3] * (cf[1] + cf[3] * cf[2])); + tsM[3] = sc * (cf[1] + cf[3] * cf[2]); + tsM[4] = sc * (-(cf[2] - 1.0) * (cf[2] + cf[3] * cf[1])); + tsM[5] = sc * (-(cf[3] * cf[1] + cf[3] * cf[3] + cf[2] - 1.0) * cf[3]); + tsM[6] = sc * (cf[3] * cf[1] + cf[2] + cf[1] * cf[1] - cf[2] * cf[2]); + tsM[7] = sc * (cf[1] * cf[2] + cf[3] * cf[2] * cf[2] - cf[1] * cf[3] * cf[3] - cf[3] * cf[3] * cf[3] - cf[3] * cf[2] + cf[3]); + tsM[8] = sc * (cf[3] * (cf[1] + cf[3] * cf[2])); -#define YVV(L) \ -{ \ -W[0] = cf[0]*X[0] + cf[1]*X[0] + cf[2]*X[0] + cf[3]*X[0]; \ -W[1] = cf[0]*X[1] + cf[1]*W[0] + cf[2]*X[0] + cf[3]*X[0]; \ -W[2] = cf[0]*X[2] + cf[1]*W[1] + cf[2]*W[0] + cf[3]*X[0]; \ -for (i=3; i<L; i++) \ -W[i] = cf[0]*X[i] + cf[1]*W[i-1] + cf[2]*W[i-2] + cf[3]*W[i-3]; \ -tsu[0] = W[L-1] - X[L-1]; \ -tsu[1] = W[L-2] - X[L-1]; \ -tsu[2] = W[L-3] - X[L-1]; \ -tsv[0] = tsM[0]*tsu[0] + tsM[1]*tsu[1] + tsM[2]*tsu[2] + X[L-1]; \ -tsv[1] = tsM[3]*tsu[0] + tsM[4]*tsu[1] + tsM[5]*tsu[2] + X[L-1]; \ -tsv[2] = tsM[6]*tsu[0] + tsM[7]*tsu[1] + tsM[8]*tsu[2] + X[L-1]; \ -Y[L-1] = cf[0]*W[L-1] + cf[1]*tsv[0] + cf[2]*tsv[1] + cf[3]*tsv[2]; \ -Y[L-2] = cf[0]*W[L-2] + cf[1]*Y[L-1] + cf[2]*tsv[0] + cf[3]*tsv[1]; \ -Y[L-3] = cf[0]*W[L-3] + cf[1]*Y[L-2] + cf[2]*Y[L-1] + cf[3]*tsv[0]; \ -for (i=L-4; i>=0; i--) \ -Y[i] = cf[0]*W[i] + cf[1]*Y[i+1] + cf[2]*Y[i+2] + cf[3]*Y[i+3]; \ -} +#define YVV(L) \ +{ \ + W[0] = cf[0] * X[0] + cf[1] * X[0] + cf[2] * X[0] + cf[3] * X[0]; \ + W[1] = cf[0] * X[1] + cf[1] * W[0] + cf[2] * X[0] + cf[3] * X[0]; \ + W[2] = cf[0] * X[2] + cf[1] * W[1] + cf[2] * W[0] + cf[3] * X[0]; \ + for (i = 3; i < L; i++) { \ + W[i] = cf[0] * X[i] + cf[1] * W[i - 1] + cf[2] * W[i - 2] + cf[3] * W[i - 3]; \ + } \ + tsu[0] = W[L - 1] - X[L - 1]; \ + tsu[1] = W[L - 2] - X[L - 1]; \ + tsu[2] = W[L - 3] - X[L - 1]; \ + tsv[0] = tsM[0] * tsu[0] + tsM[1] * tsu[1] + tsM[2] * tsu[2] + X[L - 1]; \ + tsv[1] = tsM[3] * tsu[0] + tsM[4] * tsu[1] + tsM[5] * tsu[2] + X[L - 1]; \ + tsv[2] = tsM[6] * tsu[0] + tsM[7] * tsu[1] + tsM[8] * tsu[2] + X[L - 1]; \ + Y[L - 1] = cf[0] * W[L - 1] + cf[1] * tsv[0] + cf[2] * tsv[1] + cf[3] * tsv[2]; \ + Y[L - 2] = cf[0] * W[L - 2] + cf[1] * Y[L - 1] + cf[2] * tsv[0] + cf[3] * tsv[1]; \ + Y[L - 3] = cf[0] * W[L - 3] + cf[1] * Y[L - 2] + cf[2] * Y[L - 1] + cf[3] * tsv[0]; \ + for (i = L - 4; i >= 0; i--) { \ + Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3]; \ + } \ +} (void)0 // intermediate buffers sz = MAX2(src->getWidth(), src->getHeight()); - X = (double*)MEM_callocN(sz*sizeof(double), "IIR_gauss X buf"); - Y = (double*)MEM_callocN(sz*sizeof(double), "IIR_gauss Y buf"); - W = (double*)MEM_callocN(sz*sizeof(double), "IIR_gauss W buf"); - if (xy & 1) { // H - for (y=0; y<src->getHeight(); ++y) { - const int yx = y*src->getWidth(); - for (x=0; x<src->getWidth(); ++x) - X[x] = buffer[(x + yx)*COM_NUMBER_OF_CHANNELS + chan]; + X = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss X buf"); + Y = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss Y buf"); + W = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss W buf"); + if (xy & 1) { // H + for (y = 0; y < src->getHeight(); ++y) { + const int yx = y * src->getWidth(); + for (x = 0; x < src->getWidth(); ++x) + X[x] = buffer[(x + yx) * COM_NUMBER_OF_CHANNELS + chan]; YVV(src->getWidth()); - for (x=0; x<src->getWidth(); ++x) - buffer[(x + yx)*COM_NUMBER_OF_CHANNELS + chan] = Y[x]; + for (x = 0; x < src->getWidth(); ++x) + buffer[(x + yx) * COM_NUMBER_OF_CHANNELS + chan] = Y[x]; } } - if (xy & 2) { // V - for (x=0; x<src->getWidth(); ++x) { - for (y=0; y<src->getHeight(); ++y) - X[y] = buffer[(x + y*src->getWidth())*COM_NUMBER_OF_CHANNELS + chan]; + if (xy & 2) { // V + for (x = 0; x < src->getWidth(); ++x) { + for (y = 0; y < src->getHeight(); ++y) + X[y] = buffer[(x + y * src->getWidth()) * COM_NUMBER_OF_CHANNELS + chan]; YVV(src->getHeight()); - for (y=0; y<src->getHeight(); ++y) - buffer[(x + y*src->getWidth())*COM_NUMBER_OF_CHANNELS + chan] = Y[y]; + for (y = 0; y < src->getHeight(); ++y) + buffer[(x + y * src->getWidth()) * COM_NUMBER_OF_CHANNELS + chan] = Y[y]; } } diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h index 9c8973f6a3a..f92e3dc68a5 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h @@ -34,7 +34,7 @@ private: public: FastGaussianBlurOperation(); 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); static void IIR_gauss(MemoryBuffer *src, float sigma, int channel, int xy); void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index 80e35f63ac5..b5ae54299eb 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -27,7 +27,7 @@ extern "C" { #include "RE_pipeline.h" } -GaussianBokehBlurOperation::GaussianBokehBlurOperation(): BlurBaseOperation() +GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation() { this->gausstab = NULL; } @@ -65,42 +65,42 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) if (!sizeavailable) { updateSize(memoryBuffers); } - radxf = size*(float)this->data->sizex; - if (radxf>width/2.0f) - radxf = width/2.0f; - else if (radxf<1.0f) + radxf = size * (float)this->data->sizex; + if (radxf > width / 2.0f) + radxf = width / 2.0f; + else if (radxf < 1.0f) radxf = 1.0f; /* vertical */ - radyf = size*(float)this->data->sizey; - if (radyf>height/2.0f) - radyf = height/2.0f; - else if (radyf<1.0f) + radyf = size * (float)this->data->sizey; + if (radyf > height / 2.0f) + radyf = height / 2.0f; + else if (radyf < 1.0f) radyf = 1.0f; radx = ceil(radxf); rady = ceil(radyf); - n = (2*radx+1)*(2*rady+1); + n = (2 * radx + 1) * (2 * rady + 1); /* create a full filter image */ ddgauss = new float[n]; dgauss = ddgauss; val = 0.0f; - for (j=-rady; j<=rady; j++) { - for (i=-radx; i<=radx; i++, dgauss++) { + 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); - val+= *dgauss; + val += *dgauss; } } - if (val!=0.0f) { - val = 1.0f/val; - for (j = n - 1; j>=0; j--) - ddgauss[j]*= val; + if (val != 0.0f) { + val = 1.0f / val; + for (j = n - 1; j >= 0; j--) + ddgauss[j] *= val; } else ddgauss[4] = 1.0f; @@ -116,7 +116,7 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, Memory tempColor[2] = 0; tempColor[3] = 0; float overallmultiplyer = 0; - MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; @@ -134,15 +134,15 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, Memory int index; int step = QualityStepHelper::getStep(); int offsetadd = QualityStepHelper::getOffsetAdd(); - for (int ny = miny ; ny < maxy ; ny +=step) { - index = ((ny-y)+this->rady) * (this->radx*2+1) + (minx-x+this->radx); - int bufferindex = ((minx - bufferstartx)*4)+((ny-bufferstarty)*4*bufferwidth); - for (int nx = minx ; nx < maxx ; nx +=step) { + for (int ny = miny; ny < maxy; ny += step) { + index = ((ny - y) + this->rady) * (this->radx * 2 + 1) + (minx - x + this->radx); + int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth); + for (int nx = minx; nx < maxx; nx += step) { const float multiplyer = gausstab[index]; madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplyer); overallmultiplyer += multiplyer; index += step; - bufferindex +=offsetadd; + bufferindex += offsetadd; } } @@ -164,7 +164,7 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R sizeInput.ymin = 0; sizeInput.xmax = 5; sizeInput.ymax = 5; - NodeOperation * operation = this->getInputOperation(1); + NodeOperation *operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index e30cbfeff7e..8edbf8f0617 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -27,7 +27,7 @@ extern "C" { #include "RE_pipeline.h" } -GaussianXBlurOperation::GaussianXBlurOperation(): BlurBaseOperation() +GaussianXBlurOperation::GaussianXBlurOperation() : BlurBaseOperation() { this->gausstab = NULL; this->rad = 0; @@ -48,8 +48,8 @@ void GaussianXBlurOperation::initExecution() BlurBaseOperation::initExecution(); if (this->sizeavailable) { - float rad = size*this->data->sizex; - if (rad<1) + float rad = size * this->data->sizex; + if (rad < 1) rad = 1; this->rad = rad; @@ -61,8 +61,8 @@ void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { if (this->gausstab == NULL) { updateSize(memoryBuffers); - float rad = size*this->data->sizex; - if (rad<1) + float rad = size * this->data->sizex; + if (rad < 1) rad = 1; this->rad = rad; @@ -78,7 +78,7 @@ void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuff tempColor[2] = 0; tempColor[3] = 0; float overallmultiplyer = 0.0f; - MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; @@ -96,9 +96,9 @@ void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuff int index; int step = getStep(); int offsetadd = getOffsetAdd(); - int bufferindex = ((minx - bufferstartx)*4)+((miny-bufferstarty)*4*bufferwidth); - for (int nx = minx ; nx < maxx ; nx +=step) { - index = (nx-x)+this->rad; + int bufferindex = ((minx - bufferstartx) * 4) + ((miny - bufferstarty) * 4 * bufferwidth); + for (int nx = minx; nx < maxx; nx += step) { + index = (nx - x) + this->rad; const float multiplyer = gausstab[index]; madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplyer); overallmultiplyer += multiplyer; @@ -123,7 +123,7 @@ bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadB sizeInput.xmax = 5; sizeInput.ymax = 5; - NodeOperation * operation = this->getInputOperation(1); + NodeOperation *operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; } diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index c0561704596..7143cc02615 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -27,7 +27,7 @@ extern "C" { #include "RE_pipeline.h" } -GaussianYBlurOperation::GaussianYBlurOperation(): BlurBaseOperation() +GaussianYBlurOperation::GaussianYBlurOperation() : BlurBaseOperation() { this->gausstab = NULL; this->rad = 0; @@ -45,8 +45,8 @@ void *GaussianYBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memo void GaussianYBlurOperation::initExecution() { if (this->sizeavailable) { - float rad = size*this->data->sizey; - if (rad<1) + float rad = size * this->data->sizey; + if (rad < 1) rad = 1; this->rad = rad; @@ -58,8 +58,8 @@ void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { if (this->gausstab == NULL) { updateSize(memoryBuffers); - float rad = size*this->data->sizey; - if (rad<1) + float rad = size * this->data->sizey; + if (rad < 1) rad = 1; this->rad = rad; @@ -75,7 +75,7 @@ void GaussianYBlurOperation::executePixel(float *color, int x, int y, MemoryBuff tempColor[2] = 0; tempColor[3] = 0; float overallmultiplyer = 0; - MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); int bufferstartx = inputBuffer->getRect()->xmin; @@ -92,9 +92,9 @@ void GaussianYBlurOperation::executePixel(float *color, int x, int y, MemoryBuff int step = getStep(); int index; - for (int ny = miny ; ny < maxy ; ny +=step) { - index = (ny-y)+this->rad; - int bufferindex = ((minx - bufferstartx)*4)+((ny-bufferstarty)*4*bufferwidth); + for (int ny = miny; ny < maxy; ny += step) { + index = (ny - y) + this->rad; + int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth); const float multiplyer = gausstab[index]; madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplyer); overallmultiplyer += multiplyer; @@ -118,7 +118,7 @@ bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadB sizeInput.xmax = 5; sizeInput.ymax = 5; - NodeOperation * operation = this->getInputOperation(1); + NodeOperation *operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; } diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp b/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp index 3ed3921e0c1..9c7a33c1327 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp @@ -28,7 +28,7 @@ #include "BLI_listbase.h" #include "BLI_math.h" -KeyingBlurOperation::KeyingBlurOperation(): NodeOperation() +KeyingBlurOperation::KeyingBlurOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -47,7 +47,7 @@ void *KeyingBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB void KeyingBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { - MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferWidth = inputBuffer->getWidth(); diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.h b/source/blender/compositor/operations/COM_KeyingBlurOperation.h index 8d7834c7265..2848f260cbd 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.h +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.h @@ -27,8 +27,8 @@ #include "COM_NodeOperation.h" /** - * Class with implementation of bluring for keying node - */ + * Class with implementation of bluring for keying node + */ class KeyingBlurOperation : public NodeOperation { protected: int size; diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index 1544b1c8d06..7c9b0c75518 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -76,9 +76,9 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me add_v4_v4(tempColor, readColor); add_v3_fl(overallmultiplyer, 1.0f); - for (int ny = miny ; ny < maxy ; ny += QualityStepHelper::getStep()) { - for (int nx = minx ; nx < maxx ; nx += QualityStepHelper::getStep()) { - if (nx >=0 && nx < this->getWidth() && ny >= 0 && ny < getHeight()) { + for (int ny = miny; ny < maxy; ny += QualityStepHelper::getStep()) { + for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) { + if (nx >= 0 && nx < this->getWidth() && ny >= 0 && ny < getHeight()) { inputSizeProgram->read(tempSize, nx, ny, COM_PS_NEAREST, inputBuffers); float size = tempSize[0]; // size += this->threshold; @@ -88,8 +88,8 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me /* pass */ } else if (size >= fabsf(dx) && size >= fabsf(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); madd_v4_v4v4(tempColor, bokeh, readColor); @@ -119,10 +119,10 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu rcti newInput; rcti bokehInput; - newInput.xmax = input->xmax + maxBlur+2; - newInput.xmin = input->xmin - maxBlur+2; - newInput.ymax = input->ymax + maxBlur-2; - newInput.ymin = input->ymin - maxBlur-2; + newInput.xmax = input->xmax + maxBlur + 2; + newInput.xmin = input->xmin - maxBlur + 2; + newInput.ymax = input->ymax + maxBlur - 2; + newInput.ymin = input->ymin - maxBlur - 2; bokehInput.xmax = 512; bokehInput.xmin = 0; bokehInput.ymax = 512; diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp index 3dac3547b8a..3efae2c4e3d 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp @@ -28,7 +28,7 @@ extern "C" { #include "RE_pipeline.h" } -VectorBlurOperation::VectorBlurOperation(): NodeOperation() +VectorBlurOperation::VectorBlurOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); // ZBUF @@ -54,12 +54,12 @@ void VectorBlurOperation::initExecution() 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; + float *buffer = (float *) data; + int index = (y * this->getWidth() + x) * COM_NUMBER_OF_CHANNELS; color[0] = buffer[index]; - color[1] = buffer[index+1]; - color[2] = buffer[index+2]; - color[3] = buffer[index+3]; + color[1] = buffer[index + 1]; + color[2] = buffer[index + 2]; + color[3] = buffer[index + 3]; } void VectorBlurOperation::deinitExecution() @@ -79,11 +79,11 @@ void *VectorBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB lockMutex(); 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]; - memcpy(data, tile->getBuffer(),this->getWidth()*this->getHeight()*COM_NUMBER_OF_CHANNELS*sizeof(float)); + 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; } @@ -110,7 +110,7 @@ void VectorBlurOperation::generateVectorBlur(float *data, MemoryBuffer *inputIma { float *zbuf = inputZ->convertToValueBuffer(); NodeBlurData blurdata; - blurdata.samples = this->settings->samples/QualityStepHelper::getStep(); + blurdata.samples = this->settings->samples / QualityStepHelper::getStep(); blurdata.maxspeed = this->settings->maxspeed; blurdata.minspeed = this->settings->minspeed; blurdata.curved = this->settings->curved; |