From 570cc70772d78703053956ce57b20c6c4ed74c95 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Jun 2012 18:42:03 +0000 Subject: style cleanup: compositor operations --- .../blender/compositor/intern/COM_OpenCLDevice.h | 14 +- .../operations/COM_AlphaOverKeyOperation.cpp | 12 +- .../operations/COM_AlphaOverMixedOperation.cpp | 18 +- .../COM_AlphaOverPremultiplyOperation.cpp | 14 +- .../operations/COM_AntiAliasOperation.cpp | 22 +- .../operations/COM_BokehImageOperation.cpp | 18 +- .../compositor/operations/COM_BoxMaskOperation.cpp | 36 +- .../operations/COM_BrightnessOperation.cpp | 16 +- .../operations/COM_CalculateMeanOperation.cpp | 38 +- .../COM_CalculateStandardDeviationOperation.cpp | 50 +- .../operations/COM_ChangeHSVOperation.cpp | 6 +- .../operations/COM_ChannelMatteOperation.cpp | 10 +- .../operations/COM_ChromaMatteOperation.cpp | 28 +- .../operations/COM_ColorBalanceASCCDLOperation.cpp | 8 +- .../operations/COM_ColorBalanceLGGOperation.cpp | 8 +- .../operations/COM_ColorCorrectionOperation.cpp | 26 +- .../operations/COM_ColorCurveOperation.cpp | 8 +- .../operations/COM_ColorMatteOperation.cpp | 17 +- .../operations/COM_ColorRampOperation.cpp | 2 +- .../operations/COM_ColorSpillOperation.cpp | 8 +- .../operations/COM_CombineChannelsOperation.cpp | 2 +- .../COM_ConvertColorProfileOperation.cpp | 2 +- .../operations/COM_ConvertColorToBWOperation.cpp | 4 +- .../COM_ConvertColorToVectorOperation.cpp | 2 +- .../operations/COM_ConvertColourToValueProg.cpp | 4 +- .../COM_ConvertDepthToRadiusOperation.cpp | 22 +- .../operations/COM_ConvertHSVToRGBOperation.cpp | 2 +- .../operations/COM_ConvertKeyToPremulOperation.cpp | 2 +- .../operations/COM_ConvertPremulToKeyOperation.cpp | 2 +- .../operations/COM_ConvertRGBToHSVOperation.cpp | 2 +- .../operations/COM_ConvertRGBToYCCOperation.cpp | 22 +- .../operations/COM_ConvertRGBToYUVOperation.cpp | 2 +- .../operations/COM_ConvertValueToColourProg.cpp | 2 +- .../COM_ConvertValueToVectorOperation.cpp | 2 +- .../COM_ConvertVectorToColorOperation.cpp | 2 +- .../COM_ConvertVectorToValueOperation.cpp | 4 +- .../operations/COM_ConvertYCCToRGBOperation.cpp | 22 +- .../operations/COM_ConvertYUVToRGBOperation.cpp | 2 +- .../COM_ConvolutionEdgeFilterOperation.cpp | 16 +- .../operations/COM_ConvolutionFilterOperation.cpp | 20 +- .../compositor/operations/COM_CropOperation.cpp | 8 +- .../operations/COM_CurveBaseOperation.cpp | 2 +- .../operations/COM_DifferenceMatteOperation.cpp | 16 +- .../operations/COM_DisplaceOperation.cpp | 16 +- .../operations/COM_DisplaceSimpleOperation.cpp | 12 +- .../operations/COM_DistanceMatteOperation.cpp | 28 +- .../operations/COM_DotproductOperation.cpp | 6 +- .../operations/COM_DoubleEdgeMaskOperation.cpp | 1062 ++++++++++---------- .../operations/COM_EllipseMaskOperation.cpp | 46 +- .../compositor/operations/COM_FlipOperation.cpp | 14 +- .../operations/COM_GammaCorrectOperation.cpp | 16 +- .../compositor/operations/COM_GammaOperation.cpp | 2 +- .../operations/COM_GaussianXBlurOperation.h | 6 +- .../COM_HueSaturationValueCorrectOperation.cpp | 4 +- .../compositor/operations/COM_IDMaskOperation.cpp | 4 +- .../compositor/operations/COM_ImageOperation.cpp | 52 +- .../compositor/operations/COM_InvertOperation.cpp | 10 +- .../operations/COM_KeyingClipOperation.cpp | 4 +- .../operations/COM_KeyingDespillOperation.cpp | 2 +- .../compositor/operations/COM_KeyingOperation.cpp | 2 +- .../operations/COM_KeyingScreenOperation.cpp | 8 +- .../operations/COM_LuminanceMatteOperation.cpp | 26 +- .../compositor/operations/COM_MapUVOperation.cpp | 72 +- .../operations/COM_MapValueOperation.cpp | 8 +- .../compositor/operations/COM_MaskOperation.cpp | 12 +- .../operations/COM_MathBaseOperation.cpp | 17 +- .../compositor/operations/COM_MixAddOperation.cpp | 8 +- .../compositor/operations/COM_MixBaseOperation.cpp | 10 +- .../operations/COM_MixBlendOperation.cpp | 8 +- .../compositor/operations/COM_MixBurnOperation.cpp | 8 +- .../operations/COM_MixColorOperation.cpp | 18 +- .../operations/COM_MixDarkenOperation.cpp | 8 +- .../operations/COM_MixDifferenceOperation.cpp | 8 +- .../operations/COM_MixDivideOperation.cpp | 8 +- .../operations/COM_MixDodgeOperation.cpp | 8 +- .../operations/COM_MixGlareOperation.cpp | 10 +- .../compositor/operations/COM_MixHueOperation.cpp | 18 +- .../operations/COM_MixLightenOperation.cpp | 8 +- .../operations/COM_MixLinearLightOperation.cpp | 14 +- .../operations/COM_MixMultiplyOperation.cpp | 8 +- .../operations/COM_MixOverlayOperation.cpp | 14 +- .../operations/COM_MixSaturationOperation.cpp | 10 +- .../operations/COM_MixScreenOperation.cpp | 8 +- .../operations/COM_MixSoftLightOperation.cpp | 14 +- .../operations/COM_MixSubtractOperation.cpp | 8 +- .../operations/COM_MixValueOperation.cpp | 8 +- .../operations/COM_MovieClipAttributeOperation.cpp | 26 +- .../operations/COM_MovieClipOperation.cpp | 24 +- .../operations/COM_MovieDistortionOperation.cpp | 8 +- .../operations/COM_MultilayerImageOperation.cpp | 34 +- .../operations/COM_NormalizeOperation.cpp | 16 +- .../operations/COM_OutputFileOperation.cpp | 92 +- .../compositor/operations/COM_PreviewOperation.cpp | 32 +- .../COM_ProjectorLensDistortionOperation.cpp | 18 +- .../operations/COM_QualityStepHelper.cpp | 64 +- .../operations/COM_ReadBufferOperation.cpp | 10 +- .../operations/COM_RenderLayersAOOperation.cpp | 2 +- .../operations/COM_RenderLayersAlphaProg.cpp | 8 +- .../operations/COM_RenderLayersBaseProg.cpp | 26 +- .../operations/COM_RenderLayersColorOperation.cpp | 2 +- .../operations/COM_RenderLayersCyclesOperation.cpp | 2 +- .../operations/COM_RenderLayersDepthProg.cpp | 2 +- .../COM_RenderLayersDiffuseOperation.cpp | 2 +- .../operations/COM_RenderLayersEmitOperation.cpp | 2 +- .../COM_RenderLayersEnvironmentOperation.cpp | 2 +- .../operations/COM_RenderLayersImageProg.cpp | 2 +- .../COM_RenderLayersIndirectOperation.cpp | 2 +- .../COM_RenderLayersMaterialIndexOperation.cpp | 2 +- .../operations/COM_RenderLayersMistOperation.cpp | 2 +- .../operations/COM_RenderLayersNormalOperation.cpp | 2 +- .../COM_RenderLayersObjectIndexOperation.cpp | 2 +- .../COM_RenderLayersReflectionOperation.cpp | 2 +- .../COM_RenderLayersRefractionOperation.cpp | 2 +- .../operations/COM_RenderLayersShadowOperation.cpp | 2 +- .../COM_RenderLayersSpecularOperation.cpp | 2 +- .../operations/COM_RenderLayersSpeedOperation.cpp | 2 +- .../operations/COM_RenderLayersUVOperation.cpp | 2 +- .../compositor/operations/COM_RotateOperation.cpp | 38 +- .../COM_ScreenLensDistortionOperation.cpp | 98 +- .../operations/COM_SeparateChannelOperation.cpp | 2 +- .../operations/COM_SetAlphaOperation.cpp | 2 +- .../operations/COM_SetColorOperation.cpp | 2 +- .../operations/COM_SetSamplerOperation.cpp | 2 +- .../operations/COM_SetValueOperation.cpp | 2 +- .../operations/COM_SetVectorOperation.cpp | 2 +- .../operations/COM_SocketProxyOperation.cpp | 2 +- .../compositor/operations/COM_TextureOperation.cpp | 26 +- .../compositor/operations/COM_TonemapOperation.cpp | 16 +- .../operations/COM_TranslateOperation.cpp | 4 +- .../operations/COM_VectorCurveOperation.cpp | 2 +- .../operations/COM_WriteBufferOperation.cpp | 46 +- .../operations/COM_ZCombineOperation.cpp | 14 +- 132 files changed, 1403 insertions(+), 1407 deletions(-) (limited to 'source/blender') diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h index 75c326eda23..83ce8cec811 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.h +++ b/source/blender/compositor/intern/COM_OpenCLDevice.h @@ -37,29 +37,29 @@ class OpenCLDevice; class OpenCLDevice : public Device { private: /** - *@brief opencl context + * @brief opencl context */ cl_context context; /** - *@brief opencl device + * @brief opencl device */ cl_device_id device; /** - *@brief opencl program + * @brief opencl program */ cl_program program; /** - *@brief opencl command queue + * @brief opencl command queue */ cl_command_queue queue; public: /** - *@brief constructor with opencl device - *@param context - *@param device + * @brief constructor with opencl device + * @param context + * @param device */ OpenCLDevice(cl_context context, cl_device_id device, cl_program program); diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp index 4a0c8b7ab7f..e614e1fa15a 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp @@ -22,7 +22,7 @@ #include "COM_AlphaOverKeyOperation.h" -AlphaOverKeyOperation::AlphaOverKeyOperation(): MixBaseOperation() +AlphaOverKeyOperation::AlphaOverKeyOperation() : MixBaseOperation() { /* pass */ } @@ -44,12 +44,12 @@ void AlphaOverKeyOperation::executePixel(float *outputValue, float x, float y, P copy_v4_v4(outputValue, inputOverColor); } else { - float premul = value[0]*inputOverColor[3]; + 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_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp index 850bbd5cc00..81c1e4d2587 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp @@ -22,7 +22,7 @@ #include "COM_AlphaOverMixedOperation.h" -AlphaOverMixedOperation::AlphaOverMixedOperation(): MixBaseOperation() +AlphaOverMixedOperation::AlphaOverMixedOperation() : MixBaseOperation() { this->x = 0.0f; } @@ -44,14 +44,14 @@ void AlphaOverMixedOperation::executePixel(float outputValue[4], float x, float copy_v4_v4(outputValue, inputOverColor); } else { - 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]; + 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]; } } diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp index 5b36f83af41..a6bf8b8834c 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp @@ -22,7 +22,7 @@ #include "COM_AlphaOverPremultiplyOperation.h" -AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation(): MixBaseOperation() +AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation() : MixBaseOperation() { /* pass */ } @@ -38,19 +38,19 @@ void AlphaOverPremultiplyOperation::executePixel(float *outputValue, float x, fl inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers); /* Zero alpha values should still permit an add of RGB data */ - if (inputOverColor[3]<0.0f) { + if (inputOverColor[3] < 0.0f) { copy_v4_v4(outputValue, inputColor1); } else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) { copy_v4_v4(outputValue, inputOverColor); } 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_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp index 4cd9552b108..458d11f2616 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp @@ -28,7 +28,7 @@ extern "C" { } -AntiAliasOperation::AntiAliasOperation(): NodeOperation() +AntiAliasOperation::AntiAliasOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -42,14 +42,14 @@ void AntiAliasOperation::initExecution() 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 || (unsigned int)y >= this->height || x < 0 || (unsigned int)x >= this->width) { color[0] = 0.0f; } else { - int offset = y*this->width + x; - color[0] = buffer[offset]/255.0f; + int offset = y * this->width + x; + color[0] = buffer[offset] / 255.0f; } } @@ -84,17 +84,17 @@ bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe void *AntiAliasOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { - if (this->buffer) {return buffer;} + if (this->buffer) {return buffer; } lockMutex(); if (this->buffer == NULL) { - MemoryBuffer *tile = (MemoryBuffer*)valueReader->initializeTileData(rect, memoryBuffers); - int size = tile->getHeight()*tile->getWidth(); - float * input = tile->getBuffer(); + MemoryBuffer *tile = (MemoryBuffer *)valueReader->initializeTileData(rect, memoryBuffers); + int size = tile->getHeight() * tile->getWidth(); + float *input = tile->getBuffer(); char *valuebuffer = new char[size]; - for (int i = 0 ; i < size ; i ++) { + for (int i = 0; i < size; i++) { float in = input[i * COM_NUMBER_OF_CHANNELS]; - if (in < 0.0f) { in = 0.0f;} - if (in > 1.0f) {in = 1.0f;} + if (in < 0.0f) { in = 0.0f; } + if (in > 1.0f) {in = 1.0f; } valuebuffer[i] = in * 255; } antialias_tagbuf(tile->getWidth(), tile->getHeight(), valuebuffer); diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp index 189ba98aa57..abb378e2adb 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp @@ -23,7 +23,7 @@ #include "COM_BokehImageOperation.h" #include "BLI_math.h" -BokehImageOperation::BokehImageOperation(): NodeOperation() +BokehImageOperation::BokehImageOperation() : NodeOperation() { this->addOutputSocket(COM_DT_COLOR); this->deleteData = false; @@ -35,7 +35,7 @@ void BokehImageOperation::initExecution() this->center[0] = this->centerX; this->center[1] = this->centerY; this->inverseRounding = 1.0f - this->data->rounding; - this->circularDistance = getWidth()/2; + this->circularDistance = getWidth() / 2; this->flapRad = (float)(M_PI * 2) / this->data->flaps; this->flapRadAdd = (this->data->angle / 360.0f) * (float)(M_PI * 2.0); while (this->flapRadAdd < 0.0f) { @@ -64,19 +64,19 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y) const float distanceToCenter = len_v2v2(point, center); const float bearing = (atan2f(deltaX, deltaY) + (float)(M_PI * 2.0)); - int flapNumber = (int)((bearing-flapRadAdd)/flapRad); + int flapNumber = (int)((bearing - flapRadAdd) / flapRad); detemineStartPointOfFlap(lineP1, flapNumber, distance); - detemineStartPointOfFlap(lineP2, flapNumber+1, distance); + detemineStartPointOfFlap(lineP2, flapNumber + 1, distance); closest_to_line_v2(closestPoint, point, lineP1, lineP2); const float distanceLineToCenter = len_v2v2(center, closestPoint); - const float distanceRoundingToCenter = inverseRounding*distanceLineToCenter+this->data->rounding*distance; + const float distanceRoundingToCenter = inverseRounding * distanceLineToCenter + this->data->rounding * distance; const float catadioptricDistanceToCenter = distanceRoundingToCenter * this->data->catadioptric; - if (distanceRoundingToCenter>=distanceToCenter && catadioptricDistanceToCenter <= distanceToCenter) { + if (distanceRoundingToCenter >= distanceToCenter && catadioptricDistanceToCenter <= distanceToCenter) { if (distanceRoundingToCenter - distanceToCenter < 1.0f) { - insideBokeh = (distanceRoundingToCenter-distanceToCenter); + insideBokeh = (distanceRoundingToCenter - distanceToCenter); } else if (this->data->catadioptric != 0.0f && distanceToCenter - catadioptricDistanceToCenter < 1.0f) { insideBokeh = (distanceToCenter - catadioptricDistanceToCenter); @@ -95,7 +95,7 @@ void BokehImageOperation::executePixel(float *color, float x, float y, PixelSamp float insideBokehMax = isInsideBokeh(distance, x, y); float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), x, y); float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), x, y); - if (shift<0) { + if (shift < 0) { color[0] = insideBokehMax; color[1] = insideBokehMed; color[2] = insideBokehMin; @@ -105,7 +105,7 @@ void BokehImageOperation::executePixel(float *color, float x, float y, PixelSamp color[1] = insideBokehMed; color[2] = insideBokehMax; } - color[3] = (insideBokehMax+insideBokehMed+insideBokehMin)/3.0f; + color[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f; } void BokehImageOperation::deinitExecution() diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp index ae83115ff69..3b99fc9a2a0 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp @@ -24,7 +24,7 @@ #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); @@ -41,7 +41,7 @@ void BoxMaskOperation::initExecution() const double rad = DEG2RAD((double)this->data->rotation); this->cosine = cos(rad); this->sine = sin(rad); - this->aspectRatio = ((float)this->getWidth())/this->getHeight(); + this->aspectRatio = ((float)this->getWidth()) / this->getHeight(); } void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) @@ -49,13 +49,13 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler float inputMask[4]; float inputValue[4]; - float rx = x/this->getWidth(); - float ry = y/this->getHeight(); + float rx = x / this->getWidth(); + float ry = y / this->getHeight(); - const float dy = (ry - this->data->y)/this->aspectRatio; + const float dy = (ry - this->data->y) / this->aspectRatio; const float dx = rx - this->data->x; - rx = this->data->x+(this->cosine*dx + this->sine*dy); - ry = this->data->y+(-this->sine*dx + this->cosine*dy); + rx = this->data->x + (this->cosine * dx + this->sine * dy); + ry = this->data->y + (-this->sine * dx + this->cosine * dy); this->inputMask->read(inputMask, x, y, sampler, inputBuffers); this->inputValue->read(inputValue, x, y, sampler, inputBuffers); @@ -70,7 +70,7 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler switch (this->maskType) { case CMP_NODE_MASKTYPE_ADD: if (inside) { - color[0] = max(inputMask[0],inputValue[0]); + color[0] = max(inputMask[0], inputValue[0]); } else { color[0] = inputMask[0]; @@ -78,7 +78,7 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler break; case CMP_NODE_MASKTYPE_SUBTRACT: if (inside) { - color[0] = inputMask[0]-inputValue[0]; + color[0] = inputMask[0] - inputValue[0]; CLAMP(color[0], 0, 1); } else { @@ -87,24 +87,24 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler break; case CMP_NODE_MASKTYPE_MULTIPLY: if (inside) { - color[0] = inputMask[0]*inputValue[0]; + color[0] = inputMask[0] * inputValue[0]; } else { color[0] = 0; } break; case CMP_NODE_MASKTYPE_NOT: - if (inside) { - if (inputMask[0]>0.0f) { - color[0] = 0; + if (inside) { + if (inputMask[0] > 0.0f) { + color[0] = 0; + } + else { + color[0] = inputValue[0]; + } } else { - color[0] = inputValue[0]; + color[0] = inputMask[0]; } - } - else { - color[0] = inputMask[0]; - } break; } diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp index a4396a43cf7..95862a1fd83 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp +++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp @@ -22,7 +22,7 @@ #include "COM_BrightnessOperation.h" -BrightnessOperation::BrightnessOperation(): NodeOperation() +BrightnessOperation::BrightnessOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); @@ -52,10 +52,10 @@ void BrightnessOperation::executePixel(float *color, float x, float y, PixelSamp float delta = contrast / 200.0f; a = 1.0f - delta * 2.0f; /* - * The algorithm is by Werner D. Streidt - * (http://visca.com/ffactory/archives/5-99/msg00021.html) - * Extracted of OpenCV demhist.c - */ + * The algorithm is by Werner D. Streidt + * (http://visca.com/ffactory/archives/5-99/msg00021.html) + * Extracted of OpenCV demhist.c + */ if (contrast > 0) { a = 1.0f / a; b = a * (brightness - delta); @@ -65,9 +65,9 @@ void BrightnessOperation::executePixel(float *color, float x, float y, PixelSamp b = a * (brightness + delta); } - color[0] = a*inputValue[0]+b; - color[1] = a*inputValue[1]+b; - color[2] = a*inputValue[2]+b; + color[0] = a * inputValue[0] + b; + color[1] = a * inputValue[1] + b; + color[2] = a * inputValue[2] + b; color[3] = inputValue[3]; } diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp index 077d8473f0b..3f9003b8c48 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp @@ -26,7 +26,7 @@ -CalculateMeanOperation::CalculateMeanOperation(): NodeOperation() +CalculateMeanOperation::CalculateMeanOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_VALUE); @@ -42,7 +42,7 @@ void CalculateMeanOperation::initExecution() 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; } @@ -74,7 +74,7 @@ void *CalculateMeanOperation::initializeTileData(rcti *rect, MemoryBuffer **memo { lockMutex(); if (!this->iscalculated) { - MemoryBuffer *tile = (MemoryBuffer*)imageReader->initializeTileData(rect, memoryBuffers); + MemoryBuffer *tile = (MemoryBuffer *)imageReader->initializeTileData(rect, memoryBuffers); calculateMean(tile); this->iscalculated = true; } @@ -82,44 +82,44 @@ 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(); - int size = tile->getWidth()*tile->getHeight(); + int size = tile->getWidth() * tile->getHeight(); int pixels = 0; float sum; - for (int i = 0, offset = 0 ; i < size ; i ++, offset +=4) { - if (buffer[offset+3] > 0) { - pixels ++; + for (int i = 0, offset = 0; i < size; i++, offset += 4) { + if (buffer[offset + 3] > 0) { + pixels++; switch (this->setting) { - case 1: + case 1: { - sum += buffer[offset]*0.35f + buffer[offset+1]*0.45f + buffer[offset+2]*0.2f; + sum += buffer[offset] * 0.35f + buffer[offset + 1] * 0.45f + buffer[offset + 2] * 0.2f; break; } - case 2: + case 2: { - sum+= buffer[offset]; + sum += buffer[offset]; break; } - case 3: + case 3: { - sum+= buffer[offset+1]; + sum += buffer[offset + 1]; break; } - case 4: + case 4: { - sum+= buffer[offset+2]; + sum += buffer[offset + 2]; break; } - case 5: + case 5: { float yuv[3]; - rgb_to_yuv(buffer[offset], buffer[offset+1], buffer[offset+2], &yuv[0], &yuv[1], &yuv[2]); - sum+=yuv[0]; + rgb_to_yuv(buffer[offset], buffer[offset + 1], buffer[offset + 2], &yuv[0], &yuv[1], &yuv[2]); + sum += yuv[0]; break; } } diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp index 884c22021df..b0739cd7567 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp @@ -26,12 +26,12 @@ -CalculateStandardDeviationOperation::CalculateStandardDeviationOperation(): CalculateMeanOperation() +CalculateStandardDeviationOperation::CalculateStandardDeviationOperation() : CalculateMeanOperation() { /* pass */ } -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; } @@ -40,57 +40,57 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect, Memory { lockMutex(); 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(); - int size = tile->getWidth()*tile->getHeight(); + int size = tile->getWidth() * tile->getHeight(); int pixels = 0; float sum; float mean = this->result; - for (int i = 0, offset = 0 ; i < size ; i ++, offset +=4) { - if (buffer[offset+3] > 0) { - pixels ++; + for (int i = 0, offset = 0; i < size; i++, offset += 4) { + if (buffer[offset + 3] > 0) { + pixels++; switch (this->setting) { - case 1: + case 1: { - float value = buffer[offset]*0.35f + buffer[offset+1]*0.45f + buffer[offset+2]*0.2f; - sum+=(value-mean)*(value-mean); + float value = buffer[offset] * 0.35f + buffer[offset + 1] * 0.45f + buffer[offset + 2] * 0.2f; + sum += (value - mean) * (value - mean); break; } - case 2: + case 2: { float value = buffer[offset]; - sum+=value; - sum+=(value-mean)*(value-mean); + sum += value; + sum += (value - mean) * (value - mean); break; } - case 3: + case 3: { - float value = buffer[offset+1]; - sum+=value; - sum+=(value-mean)*(value-mean); + float value = buffer[offset + 1]; + sum += value; + sum += (value - mean) * (value - mean); break; } - case 4: + case 4: { - float value = buffer[offset+2]; - sum+=value; - sum+=(value-mean)*(value-mean); + float value = buffer[offset + 2]; + sum += value; + sum += (value - mean) * (value - mean); } - case 5: + case 5: { float yuv[3]; - rgb_to_yuv(buffer[offset], buffer[offset+1], buffer[offset+2], &yuv[0], &yuv[1], &yuv[2]); - sum+=(yuv[0]-mean)*(yuv[0]-mean); + rgb_to_yuv(buffer[offset], buffer[offset + 1], buffer[offset + 2], &yuv[0], &yuv[1], &yuv[2]); + sum += (yuv[0] - mean) * (yuv[0] - mean); break; } } } } - this->standardDeviation = sqrt(sum / (float)(pixels-1)); + this->standardDeviation = sqrt(sum / (float)(pixels - 1)); this->iscalculated = true; } unlockMutex(); diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp index f949b0a55fa..487c1869782 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ChangeHSVOperation.h" -ChangeHSVOperation::ChangeHSVOperation(): NodeOperation() +ChangeHSVOperation::ChangeHSVOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -46,8 +46,8 @@ void ChangeHSVOperation::executePixel(float *outputValue, float x, float y, Pixe inputOperation->read(inputColor1, x, y, sampler, inputBuffers); outputValue[0] = inputColor1[0] + (this->hue - 0.5f); - if (outputValue[0] > 1.0f) outputValue[0] -= 1.0f; - else if (outputValue[0] < 0.0f) outputValue[0] += 1.0f; + if (outputValue[0] > 1.0f) outputValue[0] -= 1.0f; + else if (outputValue[0] < 0.0f) outputValue[0] += 1.0f; outputValue[1] = inputColor1[1] * this->saturation; outputValue[2] = inputColor1[2] * this->value; outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp index 70bfc8f8cfa..24af1a3aa53 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ChannelMatteOperation.h" #include "BLI_math.h" -ChannelMatteOperation::ChannelMatteOperation(): NodeOperation() +ChannelMatteOperation::ChannelMatteOperation() : NodeOperation() { addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); @@ -39,9 +39,9 @@ void ChannelMatteOperation::initExecution() switch (this->limit_method) { /* SINGLE */ case 0: { - /* 123 / RGB / HSV / YUV / YCC */ - const int matte_channel=this->matte_channel-1; - const int limit_channel=this->limit_channel-1; + /* 123 / RGB / HSV / YUV / YCC */ + const int matte_channel = this->matte_channel - 1; + const int limit_channel = this->limit_channel - 1; this->ids[0] = matte_channel; this->ids[1] = limit_channel; this->ids[2] = limit_channel; @@ -107,7 +107,7 @@ void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, P else if (alpha < limit_min) { alpha = 0.f; } - else {/*blend */ + else { /*blend */ alpha = (alpha - limit_min) / limit_range; } diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp index e082ffed2b6..0ce1a585598 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ChromaMatteOperation.h" #include "BLI_math.h" -ChromaMatteOperation::ChromaMatteOperation(): NodeOperation() +ChromaMatteOperation::ChromaMatteOperation() : NodeOperation() { addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_COLOR); @@ -66,36 +66,36 @@ void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, Pi /* Algorithm from book "Video Demistified," does not include the spill reduction part */ /* find theta, the angle that the color space should be rotated based on key*/ - theta=atan2(inKey[2], inKey[1]); + theta = atan2(inKey[2], inKey[1]); /*rotate the cb and cr into x/z space */ - x_angle=inImage[1]*cosf(theta)+inImage[2]*sinf(theta); - z_angle=inImage[2]*cosf(theta)-inImage[1]*sinf(theta); + x_angle = inImage[1] * cosf(theta) + inImage[2] * sinf(theta); + z_angle = inImage[2] * cosf(theta) - inImage[1] * sinf(theta); /*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); + if (kfg > 0.f) { /* found a pixel that is within key color */ + alpha = (1.f - kfg) * (gain); - beta=atan2(z_angle,x_angle); + beta = atan2(z_angle, x_angle); /* if beta is within the cutoff angle */ - if (fabsf(beta) < (cutoff/2.f)) { - alpha=0.f; + if (fabsf(beta) < (cutoff / 2.f)) { + alpha = 0.f; } /* don't make something that was more transparent less transparent */ - if (alphaaddInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); @@ -61,9 +61,9 @@ void ColorBalanceASCCDLOperation::executePixel(float *outputColor, float x, floa fac = min(1.0f, fac); const float mfac = 1.0f - fac; - outputColor[0] = mfac*inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->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]); - outputColor[2] = mfac*inputColor[2] + fac * colorbalance_cdl(inputColor[2], this->lift[2], this->gamma[2], this->gain[2]); + 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]); + outputColor[2] = mfac * inputColor[2] + fac *colorbalance_cdl(inputColor[2], this->lift[2], this->gamma[2], this->gain[2]); outputColor[3] = inputColor[3]; } diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp index 82958a7086e..7a8d62dfe21 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp @@ -38,7 +38,7 @@ 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); @@ -66,9 +66,9 @@ void ColorBalanceLGGOperation::executePixel(float *outputColor, float x, float y fac = min(1.0f, fac); const float mfac = 1.0f - fac; - outputColor[0] = mfac*inputColor[0] + fac * colorbalance_lgg(inputColor[0], this->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]); - outputColor[2] = mfac*inputColor[2] + fac * colorbalance_lgg(inputColor[2], this->lift[2], this->gamma_inv[2], this->gain[2]); + 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]); + outputColor[2] = mfac * inputColor[2] + fac *colorbalance_lgg(inputColor[2], this->lift[2], this->gamma_inv[2], this->gain[2]); outputColor[3] = inputColor[3]; } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp index 8ff58be7980..5f62f9ec403 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp @@ -23,7 +23,7 @@ #include "COM_ColorCorrectionOperation.h" #include "BLI_math.h" -ColorCorrectionOperation::ColorCorrectionOperation(): NodeOperation() +ColorCorrectionOperation::ColorCorrectionOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); @@ -47,7 +47,7 @@ void ColorCorrectionOperation::executePixel(float *output, float x, float y, Pix 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 level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2]) / 3.0f; float contrast = this->data->master.contrast; float saturation = this->data->master.saturation; float gamma = this->data->master.gamma; @@ -83,11 +83,11 @@ void ColorCorrectionOperation::executePixel(float *output, float x, float y, Pix } #undef MARGIN #undef MARGIN_DIV - contrast *= (levelShadows*this->data->shadows.contrast)+(levelMidtones*this->data->midtones.contrast)+(levelHighlights*this->data->highlights.contrast); - saturation *= (levelShadows*this->data->shadows.saturation)+(levelMidtones*this->data->midtones.saturation)+(levelHighlights*this->data->highlights.saturation); - gamma *= (levelShadows*this->data->shadows.gamma)+(levelMidtones*this->data->midtones.gamma)+(levelHighlights*this->data->highlights.gamma); - gain *= (levelShadows*this->data->shadows.gain)+(levelMidtones*this->data->midtones.gain)+(levelHighlights*this->data->highlights.gain); - lift += (levelShadows*this->data->shadows.lift)+(levelMidtones*this->data->midtones.lift)+(levelHighlights*this->data->highlights.lift); + contrast *= (levelShadows * this->data->shadows.contrast) + (levelMidtones * this->data->midtones.contrast) + (levelHighlights * this->data->highlights.contrast); + saturation *= (levelShadows * this->data->shadows.saturation) + (levelMidtones * this->data->midtones.saturation) + (levelHighlights * this->data->highlights.saturation); + gamma *= (levelShadows * this->data->shadows.gamma) + (levelMidtones * this->data->midtones.gamma) + (levelHighlights * this->data->highlights.gamma); + gain *= (levelShadows * this->data->shadows.gain) + (levelMidtones * this->data->midtones.gain) + (levelHighlights * this->data->highlights.gain); + lift += (levelShadows * this->data->shadows.lift) + (levelMidtones * this->data->midtones.lift) + (levelHighlights * this->data->highlights.lift); float invgamma = 1.0f / gamma; float luma = rgb_to_luma_y(inputImageColor); @@ -104,15 +104,15 @@ void ColorCorrectionOperation::executePixel(float *output, float x, float y, Pix g = 0.5f + ((g - 0.5f) * contrast); b = 0.5f + ((b - 0.5f) * contrast); - r = powf(r*gain+lift, invgamma); - g = powf(g*gain+lift, invgamma); - b = powf(b*gain+lift, invgamma); + r = powf(r * gain + lift, invgamma); + g = powf(g * gain + lift, invgamma); + b = powf(b * gain + lift, invgamma); // mix with mask - r = mvalue*inputImageColor[0] + value * r; - g = mvalue*inputImageColor[1] + value * g; - b = mvalue*inputImageColor[2] + value * b; + r = mvalue * inputImageColor[0] + value * r; + g = mvalue * inputImageColor[1] + value * g; + b = mvalue * inputImageColor[2] + value * b; if (this->redChannelEnabled) { output[0] = r; diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index c4336ed5e06..4feac3e7273 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -31,7 +31,7 @@ extern "C" { #include "MEM_guardedalloc.h" #endif -ColorCurveOperation::ColorCurveOperation(): CurveBaseOperation() +ColorCurveOperation::ColorCurveOperation() : CurveBaseOperation() { this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); @@ -60,8 +60,8 @@ void ColorCurveOperation::initExecution() void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { - CurveMapping* cumap = this->curveMapping; - CurveMapping* workingCopy = (CurveMapping*)MEM_dupallocN(cumap); + CurveMapping *cumap = this->curveMapping; + CurveMapping *workingCopy = (CurveMapping *)MEM_dupallocN(cumap); float black[4]; float white[4]; @@ -104,7 +104,7 @@ void ColorCurveOperation::deinitExecution() // Constant level curve mapping -ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation(): CurveBaseOperation() +ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation() : CurveBaseOperation() { this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp index 7706559be00..afb362dbdcd 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ColorMatteOperation.h" #include "BLI_math.h" -ColorMatteOperation::ColorMatteOperation(): NodeOperation() +ColorMatteOperation::ColorMatteOperation() : NodeOperation() { addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_COLOR); @@ -64,16 +64,17 @@ void ColorMatteOperation::executePixel(float *outputValue, float x, float y, Pix */ if ( - /* do hue last because it needs to wrap, and does some more checks */ + /* 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 */ + /* 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.0f; /*make transparent*/ } diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.cpp b/source/blender/compositor/operations/COM_ColorRampOperation.cpp index 992bf3b9d1d..9af70ddc5a7 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorRampOperation.cpp @@ -30,7 +30,7 @@ extern "C" { } #endif -ColorRampOperation::ColorRampOperation(): NodeOperation() +ColorRampOperation::ColorRampOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp index 9b57d64eb40..1a534d778c0 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp @@ -22,9 +22,9 @@ #include "COM_ColorSpillOperation.h" #include "BLI_math.h" -#define avg(a,b) ((a+b)/2) +#define AVG(a, b) ((a + b) / 2) -ColorSpillOperation::ColorSpillOperation(): NodeOperation() +ColorSpillOperation::ColorSpillOperation() : NodeOperation() { addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_VALUE); @@ -104,11 +104,11 @@ void ColorSpillOperation::executePixel(float *outputValue, float x, float y, Pix } float ColorSpillOperation::calculateMapValue(float fac, float *input) { - return fac * (input[this->spillChannel]-(this->settings->limscale*input[this->settings->limchan])); + return fac * (input[this->spillChannel] - (this->settings->limscale * input[this->settings->limchan])); } float ColorSpillAverageOperation::calculateMapValue(float fac, float *input) { - return fac * (input[this->spillChannel]-(this->settings->limscale*avg(input[this->channel2], input[this->channel3]))); + return fac * (input[this->spillChannel] - (this->settings->limscale * AVG(input[this->channel2], input[this->channel3]))); } diff --git a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp b/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp index 6b64934f0b8..dff8ccf7e73 100644 --- a/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp +++ b/source/blender/compositor/operations/COM_CombineChannelsOperation.cpp @@ -53,7 +53,7 @@ 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 diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp index df12a7d6b49..2e8fc9005b8 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp @@ -25,7 +25,7 @@ extern "C" { #include "IMB_imbuf.h" } -ConvertColorProfileOperation::ConvertColorProfileOperation(): NodeOperation() +ConvertColorProfileOperation::ConvertColorProfileOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp index f4be7d2e65b..c66cb8df9be 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ConvertColorToBWOperation.h" -ConvertColorToBWOperation::ConvertColorToBWOperation(): NodeOperation() +ConvertColorToBWOperation::ConvertColorToBWOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VALUE); @@ -38,7 +38,7 @@ void ConvertColorToBWOperation::executePixel(float *outputValue, float x, float { 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; + outputValue[0] = inputColor[0] * 0.35f + inputColor[1] * 0.45f + inputColor[2] * 0.2f; } void ConvertColorToBWOperation::deinitExecution() diff --git a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp index ce45266ace0..613bfe68fbb 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ConvertColorToVectorOperation.h" -ConvertColorToVectorOperation::ConvertColorToVectorOperation(): NodeOperation() +ConvertColorToVectorOperation::ConvertColorToVectorOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VECTOR); diff --git a/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp b/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp index 0d4f2df22d8..2c8caec6f61 100644 --- a/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp +++ b/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp @@ -22,7 +22,7 @@ #include "COM_ConvertColourToValueProg.h" -ConvertColourToValueProg::ConvertColourToValueProg(): NodeOperation() +ConvertColourToValueProg::ConvertColourToValueProg() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VALUE); @@ -38,7 +38,7 @@ void ConvertColourToValueProg::executePixel(float *outputValue, float x, float y { float inputColor[4]; inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers); - outputValue[0] = (inputColor[0] + inputColor[1] + inputColor[2])/3.0f; + outputValue[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f; } void ConvertColourToValueProg::deinitExecution() diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp index f64f0c054b1..1746afea713 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp @@ -24,7 +24,7 @@ #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); @@ -41,7 +41,7 @@ float ConvertDepthToRadiusOperation::determineFocalDistance() 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 @@ -62,12 +62,12 @@ 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 */ - inverseFocalDistance = 1.f/focalDistance; + 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; + this->aperture = 0.5f * (this->cam_lens / (this->aspect * 32.f)) / this->fStop; float minsz = MIN2(getWidth(), getHeight()); - this->dof_sp = (float)minsz / (16.f / cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov); + 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[]) @@ -77,16 +77,16 @@ void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, fl float radius; inputOperation->read(inputValue, x, y, sampler, inputBuffers); z = inputValue[0]; - if (z!=0.f) { - float iZ = (1.f/z); + if (z != 0.f) { + float iZ = (1.f / z); // bug #6656 part 2b, do not rescale - /* +#if 0 bcrad = 0.5f*fabs(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f)); // scale crad back to original maximum and blend crad->rect[px] = bcrad + wts->rect[px]*(scf*crad->rect[px] - bcrad); - */ - radius = 0.5f*fabsf(this->aperture*(dof_sp*(inverseFocalDistance - iZ) - 1.f)); +#endif + radius = 0.5f * fabsf(this->aperture * (dof_sp * (inverseFocalDistance - iZ) - 1.f)); // 'bug' #6615, limit minimum radius to 1 pixel, not really a solution, but somewhat mitigates the problem if (radius < 0.5f) radius = 0.5f; if (radius > maxRadius) { diff --git a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp index 97dd7e69092..e8c0061319c 100644 --- a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.cpp @@ -23,7 +23,7 @@ #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); diff --git a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp index db27e07d52f..842546a2755 100644 --- a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ConvertKeyToPremulOperation.h" #include "BLI_math.h" -ConvertKeyToPremulOperation::ConvertKeyToPremulOperation(): NodeOperation() +ConvertKeyToPremulOperation::ConvertKeyToPremulOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp index 920b5f8a775..3554be53e3f 100644 --- a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ConvertPremulToKeyOperation.h" #include "BLI_math.h" -ConvertPremulToKeyOperation::ConvertPremulToKeyOperation(): NodeOperation() +ConvertPremulToKeyOperation::ConvertPremulToKeyOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp index 99054efc267..051d9d2b8f9 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.cpp @@ -23,7 +23,7 @@ #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); diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp index ce62cf0ae49..d984a1ab943 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp @@ -22,7 +22,7 @@ #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); @@ -38,16 +38,16 @@ void ConvertRGBToYCCOperation::setMode(int mode) { switch (mode) { - case 1: - this->mode = BLI_YCC_ITU_BT709; - break; - case 2: - this->mode = BLI_YCC_JFIF_0_255; - break; - case 0: - default: - this->mode = BLI_YCC_ITU_BT601; - break; + case 1: + this->mode = BLI_YCC_ITU_BT709; + break; + case 2: + this->mode = BLI_YCC_JFIF_0_255; + break; + case 0: + default: + this->mode = BLI_YCC_ITU_BT601; + break; } } diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp index c4b870d6ad5..e5a8e7de1bb 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.cpp @@ -22,7 +22,7 @@ #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); diff --git a/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp b/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp index dce554efbac..9d95c51a546 100644 --- a/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp +++ b/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp @@ -22,7 +22,7 @@ #include "COM_ConvertValueToColourProg.h" -ConvertValueToColourProg::ConvertValueToColourProg(): NodeOperation() +ConvertValueToColourProg::ConvertValueToColourProg() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp index ba7913d24ee..5ba3f6ef4a9 100644 --- a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ConvertValueToVectorOperation.h" -ConvertValueToVectorOperation::ConvertValueToVectorOperation(): NodeOperation() +ConvertValueToVectorOperation::ConvertValueToVectorOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VECTOR); diff --git a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp index 5a4cc4d3549..f6a2072932c 100644 --- a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ConvertVectorToColorOperation.h" -ConvertVectorToColorOperation::ConvertVectorToColorOperation(): NodeOperation() +ConvertVectorToColorOperation::ConvertVectorToColorOperation() : NodeOperation() { this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp index 67cc42ac8fc..ef2d45eea03 100644 --- a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.cpp @@ -22,7 +22,7 @@ #include "COM_ConvertVectorToValueOperation.h" -ConvertVectorToValueOperation::ConvertVectorToValueOperation(): NodeOperation() +ConvertVectorToValueOperation::ConvertVectorToValueOperation() : NodeOperation() { this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_VALUE); @@ -38,7 +38,7 @@ void ConvertVectorToValueOperation::executePixel(float *outputValue, float x, fl { float input[4]; inputOperation->read(input, x, y, sampler, inputBuffers); - outputValue[0] = (input[0]+input[1]+input[2])/3.0f; + outputValue[0] = (input[0] + input[1] + input[2]) / 3.0f; } void ConvertVectorToValueOperation::deinitExecution() diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp index dbfe4847c78..373de25a276 100644 --- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp @@ -22,7 +22,7 @@ #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); @@ -38,16 +38,16 @@ void ConvertYCCToRGBOperation::setMode(int mode) { switch (mode) { - case 1: - this->mode = BLI_YCC_ITU_BT709; - break; - case 2: - this->mode = BLI_YCC_JFIF_0_255; - break; - case 0: - default: - this->mode = BLI_YCC_ITU_BT601; - break; + case 1: + this->mode = BLI_YCC_ITU_BT709; + break; + case 2: + this->mode = BLI_YCC_JFIF_0_255; + break; + case 0: + default: + this->mode = BLI_YCC_ITU_BT601; + break; } } diff --git a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp index d7037a2c2d1..a77806d16d0 100644 --- a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.cpp @@ -22,7 +22,7 @@ #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); diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp index 18a12a21f26..5ac8c2254dc 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp @@ -28,9 +28,9 @@ ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFi /* pass */ } -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 in1[4], in2[4], res1[4], res2[4]; int x1 = x - 1; int x2 = x; @@ -38,12 +38,12 @@ void ConvolutionEdgeFilterOperation::executePixel(float *color,int x, int y, Mem int y1 = y - 1; int y2 = y; int y3 = y + 1; - CLAMP(x1, 0, getWidth()-1); - CLAMP(x2, 0, getWidth()-1); - CLAMP(x3, 0, getWidth()-1); - CLAMP(y1, 0, getHeight()-1); - CLAMP(y2, 0, getHeight()-1); - CLAMP(y3, 0, getHeight()-1); + CLAMP(x1, 0, getWidth() - 1); + CLAMP(x2, 0, getWidth() - 1); + CLAMP(x3, 0, getWidth() - 1); + CLAMP(y1, 0, getHeight() - 1); + CLAMP(y2, 0, getHeight() - 1); + CLAMP(y3, 0, getHeight() - 1); float value[4]; this->inputValueOperation->read(value, x2, y2, inputBuffers, NULL); diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp index 3c9cde92e2e..b4f2714360e 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp @@ -61,13 +61,13 @@ void ConvolutionFilterOperation::deinitExecution() this->inputOperation = NULL; this->inputValueOperation = NULL; if (this->filter) { - delete [] this->filter; + delete[] this->filter; this->filter = NULL; } } -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) { float in1[4]; float in2[4]; @@ -77,12 +77,12 @@ void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryB int y1 = y - 1; int y2 = y; int y3 = y + 1; - CLAMP(x1, 0, getWidth()-1); - CLAMP(x2, 0, getWidth()-1); - CLAMP(x3, 0, getWidth()-1); - CLAMP(y1, 0, getHeight()-1); - CLAMP(y2, 0, getHeight()-1); - CLAMP(y3, 0, getHeight()-1); + CLAMP(x1, 0, getWidth() - 1); + CLAMP(x2, 0, getWidth() - 1); + CLAMP(x3, 0, getWidth() - 1); + CLAMP(y1, 0, getHeight() - 1); + CLAMP(y2, 0, getHeight() - 1); + CLAMP(y3, 0, getHeight() - 1); float value[4]; this->inputValueOperation->read(value, x2, y2, inputBuffers, NULL); const float mval = 1.0f - value[0]; @@ -116,8 +116,8 @@ void ConvolutionFilterOperation::executePixel(float *color,int x, int y, MemoryB 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; + int addx = (this->filterWidth - 1) / 2 + 1; + int addy = (this->filterHeight - 1) / 2 + 1; newInput.xmax = input->xmax + addx; newInput.xmin = input->xmin - addx; newInput.ymax = input->ymax + addy; diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp index 9b105bb2760..0bdd2cfcb51 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cpp +++ b/source/blender/compositor/operations/COM_CropOperation.cpp @@ -23,7 +23,7 @@ #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); @@ -33,7 +33,7 @@ CropBaseOperation::CropBaseOperation() :NodeOperation() void CropBaseOperation::updateArea() { - SocketReader * inputReference = this->getInputSocketReader(0); + SocketReader *inputReference = this->getInputSocketReader(0); float width = inputReference->getWidth(); float height = inputReference->getHeight(); if (this->relative) { @@ -68,7 +68,7 @@ void CropBaseOperation::deinitExecution() this->inputOperation = NULL; } -CropOperation::CropOperation() :CropBaseOperation() +CropOperation::CropOperation() : CropBaseOperation() { /* pass */ } @@ -86,7 +86,7 @@ void CropOperation::executePixel(float *color, float x, float y, PixelSampler sa } } -CropImageOperation::CropImageOperation() :CropBaseOperation() +CropImageOperation::CropImageOperation() : CropBaseOperation() { /* pass */ } diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp index fda5b00e2a0..6aa8bc2a0df 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp @@ -30,7 +30,7 @@ extern "C" { } #endif -CurveBaseOperation::CurveBaseOperation(): NodeOperation() +CurveBaseOperation::CurveBaseOperation() : NodeOperation() { this->curveMapping = NULL; } diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp index 0b1ac1b2127..c27e699f627 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp @@ -23,7 +23,7 @@ #include "COM_DifferenceMatteOperation.h" #include "BLI_math.h" -DifferenceMatteOperation::DifferenceMatteOperation(): NodeOperation() +DifferenceMatteOperation::DifferenceMatteOperation() : NodeOperation() { addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_COLOR); @@ -49,8 +49,8 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y float inColor1[4]; float inColor2[4]; - const float tolerence=this->settings->t1; - const float falloff=this->settings->t2; + const float tolerence = this->settings->t1; + const float falloff = this->settings->t2; float difference; float alpha; @@ -69,15 +69,15 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y outputValue[0] = 0.0f; } /*in the falloff region, make partially transparent */ - else if (difference < falloff+tolerence) { - difference=difference-tolerence; - alpha=difference/falloff; + else if (difference < falloff + tolerence) { + difference = difference - tolerence; + alpha = difference / falloff; /*only change if more transparent than before */ if (alpha < inColor1[3]) { - outputValue[0]=alpha; + outputValue[0] = alpha; } else { /* leave as before */ - outputValue[0]=inColor1[3]; + outputValue[0] = inColor1[3]; } } else { diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp index 2add367f39e..be50641a125 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp @@ -23,7 +23,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -DisplaceOperation::DisplaceOperation(): NodeOperation() +DisplaceOperation::DisplaceOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VECTOR); @@ -52,14 +52,14 @@ void DisplaceOperation::initExecution() /* minimum distance (in pixels) a pixel has to be displaced * in order to take effect */ -#define DISPLACE_EPSILON 0.01f +#define DISPLACE_EPSILON 0.01f void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { float inVector[4]; float inScale[4]; - float p_dx, p_dy; /* main displacement in pixel space */ + float p_dx, p_dy; /* main displacement in pixel space */ float d_dx, d_dy; float dxt, dyt; float u, v; @@ -83,17 +83,17 @@ void DisplaceOperation::executePixel(float *color, int x, int y, MemoryBuffer *i v = y - p_dy + 0.5f; /* calc derivatives */ - this->inputVectorProgram->read(inVector, x+1, y, COM_PS_NEAREST, inputBuffers); + this->inputVectorProgram->read(inVector, x + 1, y, COM_PS_NEAREST, inputBuffers); d_dx = inVector[0] * xs; - this->inputVectorProgram->read(inVector, x, y+1, COM_PS_NEAREST, inputBuffers); + this->inputVectorProgram->read(inVector, x, y + 1, COM_PS_NEAREST, inputBuffers); d_dy = inVector[0] * ys; /* clamp derivatives to minimum displacement distance in UV space */ dxt = p_dx - d_dx; dyt = p_dy - d_dy; - dxt = signf(dxt)*maxf(fabsf(dxt), DISPLACE_EPSILON)/this->getWidth(); - dyt = signf(dyt)*maxf(fabsf(dyt), DISPLACE_EPSILON)/this->getHeight(); + dxt = signf(dxt) * maxf(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth(); + dyt = signf(dyt) * maxf(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight(); /* EWA filtering */ this->inputColorProgram->read(color, u, v, dxt, dyt, inputBuffers); @@ -111,7 +111,7 @@ bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffer { rcti colorInput; rcti vectorInput; - NodeOperation *operation=NULL; + NodeOperation *operation = NULL; /* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */ /* image */ diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp index 8675caca1e2..716646e9c36 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp @@ -23,7 +23,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -DisplaceSimpleOperation::DisplaceSimpleOperation(): NodeOperation() +DisplaceSimpleOperation::DisplaceSimpleOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VECTOR); @@ -51,14 +51,14 @@ void DisplaceSimpleOperation::initExecution() /* minimum distance (in pixels) a pixel has to be displaced * in order to take effect */ -#define DISPLACE_EPSILON 0.01f +#define DISPLACE_EPSILON 0.01f void DisplaceSimpleOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { float inVector[4]; float inScale[4]; - float p_dx, p_dy; /* main displacement in pixel space */ + float p_dx, p_dy; /* main displacement in pixel space */ float u, v; this->inputScaleXProgram->read(inScale, x, y, sampler, inputBuffers); @@ -79,8 +79,8 @@ void DisplaceSimpleOperation::executePixel(float *color, float x, float y, Pixel /* clamp nodes to avoid glitches */ u = x - p_dx + 0.5f; v = y - p_dy + 0.5f; - CLAMP(u, 0.f, this->getWidth()-1.f); - CLAMP(v, 0.f, this->getHeight()-1.f); + CLAMP(u, 0.f, this->getWidth() - 1.f); + CLAMP(v, 0.f, this->getHeight() - 1.f); this->inputColorProgram->read(color, u, v, sampler, inputBuffers); } @@ -96,7 +96,7 @@ void DisplaceSimpleOperation::deinitExecution() bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti colorInput; - NodeOperation *operation=NULL; + NodeOperation *operation = NULL; /* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */ /* image */ diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp index 304f7fa5066..ec01ba922b5 100644 --- a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp @@ -22,7 +22,7 @@ #include "COM_DistanceMatteOperation.h" #include "BLI_math.h" -DistanceMatteOperation::DistanceMatteOperation(): NodeOperation() +DistanceMatteOperation::DistanceMatteOperation() : NodeOperation() { addInputSocket(COM_DT_COLOR); addInputSocket(COM_DT_COLOR); @@ -49,8 +49,8 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, float inKey[4]; float inImage[4]; - const float tolerence=this->settings->t1; - const float falloff=this->settings->t2; + const float tolerence = this->settings->t1; + const float falloff = this->settings->t2; float distance; float alpha; @@ -58,9 +58,9 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, this->inputKeyProgram->read(inKey, x, y, sampler, inputBuffers); this->inputImageProgram->read(inImage, x, y, sampler, inputBuffers); - distance = sqrt(pow((inKey[0]-inImage[0]),2)+ - pow((inKey[1]-inImage[1]),2)+ - pow((inKey[2]-inImage[2]),2)); + distance = sqrt(pow((inKey[0] - inImage[0]), 2) + + pow((inKey[1] - inImage[1]), 2) + + pow((inKey[2] - inImage[2]), 2)); /* store matte(alpha) value in [0] to go with * COM_SetAlphaOperation and the Value output @@ -68,23 +68,23 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, /*make 100% transparent */ if (distance < tolerence) { - outputValue[0]=0.f; + outputValue[0] = 0.f; } /*in the falloff region, make partially transparent */ - else if (distance < falloff+tolerence) { - distance=distance-tolerence; - alpha=distance/falloff; + else if (distance < falloff + tolerence) { + distance = distance - tolerence; + alpha = distance / falloff; /*only change if more transparent than before */ if (alpha < inImage[3]) { - outputValue[0]=alpha; + outputValue[0] = alpha; } else { /* leave as before */ - outputValue[0]=inImage[3]; + outputValue[0] = inImage[3]; } } else { - /* leave as before */ - outputValue[0]=inImage[3]; + /* leave as before */ + outputValue[0] = inImage[3]; } } diff --git a/source/blender/compositor/operations/COM_DotproductOperation.cpp b/source/blender/compositor/operations/COM_DotproductOperation.cpp index b03b176f08a..e225a677989 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.cpp +++ b/source/blender/compositor/operations/COM_DotproductOperation.cpp @@ -44,12 +44,12 @@ void DotproductOperation::deinitExecution() } /** @todo: current implementation is the inverse of a dotproduct. not 'logically' correct - */ -void DotproductOperation::executePixel(float *color,float x, float y, PixelSampler sampler, 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); this->input2Operation->read(input2, x, y, sampler, inputBuffers); - color[0] = -(input1[0]*input2[0]+input1[1]*input2[1]+input1[2]*input2[2]); + color[0] = -(input1[0] * input2[0] + input1[1] * input2[1] + input1[2] * input2[2]); } diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index df04b889200..ba54c8ad9d6 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -30,735 +30,735 @@ 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 - unsigned int gsz=0; // gradient fill area size + unsigned int isz = 0; // inner edge size + unsigned int osz = 0; // outer edge size + unsigned int gsz = 0; // gradient fill area size /* Test the four corners */ /* upper left corner */ - x=t-rw+1; + x = t - rw + 1; // test if inner mask is filled if (limask[x]) { // test if pixel underneath, or to the right, are empty in the inner mask, // but filled in the outer mask - if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + 1] && lomask[x + 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x] = 3; // flag pixel as outer edge } /* upper right corner */ - x=t; + x = t; // test if inner mask is filled if (limask[x]) { // test if pixel underneath, or to the left, are empty in the inner mask, // but filled in the outer mask - if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) { + if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x - 1] && lomask[x - 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } /* lower left corner */ - x=0; + x = 0; // test if inner mask is filled if (limask[x]) { // test if pixel above, or to the right, are empty in the inner mask, // but filled in the outer mask - if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x + rw] && lomask[x + rw]) || (!limask[x + 1] && lomask[x + 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } /* lower right corner */ - x=rw-1; + x = rw - 1; // test if inner mask is filled if (limask[x]) { // test if pixel above, or to the left, are empty in the inner mask, // but filled in the outer mask - if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) { + if ((!limask[x + rw] && lomask[x + rw]) || (!limask[x - 1] && lomask[x - 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } /* 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, // but filled in the outer mask - if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x - 1] && lomask[x - 1]) || (!limask[x + 1] && lomask[x + 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } } /* 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, // but filled in the outer mask - if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x - 1] && lomask[x - 1]) || (!limask[x + 1] && lomask[x + 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } } /* 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, // but filled in the outer mask - if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + rw] && lomask[x + rw])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } } /* 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, // but filled in the outer mask - if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + rw] && lomask[x + rw])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } } - rsize[0]=isz; // fill in our return sizes for edges + fill - rsize[1]=osz; - rsize[2]=gsz; + rsize[0] = isz; // fill in our return sizes for edges + fill + rsize[1] = osz; + 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) { int x; - unsigned int isz=0; // inner edge size - unsigned int osz=0; // outer edge size - unsigned int gsz=0; // gradient fill area size + unsigned int isz = 0; // inner edge size + unsigned int osz = 0; // outer edge size + unsigned int gsz = 0; // gradient fill area size /* Test the four corners */ /* upper left corner */ - x=t-rw+1; + x = t - rw + 1; // test if inner mask is filled if (limask[x]) { // test if pixel underneath, or to the right, are empty in the inner mask, // but filled in the outer mask - if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + 1] && lomask[x + 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right + if (!lomask[x - rw] || !lomask[x + 1]) { // test if outer mask is empty underneath or to the right osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } /* upper right corner */ - x=t; + x = t; // test if inner mask is filled if (limask[x]) { // test if pixel underneath, or to the left, are empty in the inner mask, // but filled in the outer mask - if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) { + if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x - 1] && lomask[x - 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left + if (!lomask[x - rw] || !lomask[x - 1]) { // test if outer mask is empty underneath or to the left osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } /* lower left corner */ - x=0; + x = 0; // test if inner mask is filled if (limask[x]) { // test if pixel above, or to the right, are empty in the inner mask, // but filled in the outer mask - if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x + rw] && lomask[x + rw]) || (!limask[x + 1] && lomask[x + 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty above or to the right + if (!lomask[x + rw] || !lomask[x + 1]) { // test if outer mask is empty above or to the right osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } /* lower right corner */ - x=rw-1; + x = rw - 1; // test if inner mask is filled if (limask[x]) { // test if pixel above, or to the left, are empty in the inner mask, // but filled in the outer mask - if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) { + if ((!limask[x + rw] && lomask[x + rw]) || (!limask[x - 1] && lomask[x - 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left + if (!lomask[x + rw] || !lomask[x - 1]) { // test if outer mask is empty above or to the left osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } /* 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, // but filled in the outer mask - if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x - 1] && lomask[x - 1]) || (!limask[x + 1] && lomask[x + 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x - 1] || !lomask[x + 1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } } /* 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, // but filled in the outer mask - if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x - 1] && lomask[x - 1]) || (!limask[x + 1] && lomask[x + 1])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x - 1] || !lomask[x + 1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } } /* 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, // but filled in the outer mask - if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + rw] && lomask[x + rw])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x - rw] || !lomask[x + rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } } /* 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, // but filled in the outer mask - if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x - rw] && lomask[x - rw]) || (!limask[x + rw] && lomask[x + rw])) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x - rw] || !lomask[x + rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } } - rsize[0]=isz; // fill in our return sizes for edges + fill - rsize[1]=osz; - rsize[2]=gsz; + rsize[0] = isz; // fill in our return sizes for edges + fill + rsize[1] = osz; + 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) { int x; - unsigned int isz=0; // inner edge size - unsigned int osz=0; // outer edge size - unsigned int gsz=0; // gradient fill area size + unsigned int isz = 0; // inner edge size + unsigned int osz = 0; // outer edge size + unsigned int gsz = 0; // gradient fill area size /* Test the four corners */ /* upper left corner */ - x=t-rw+1; + x = t - rw + 1; // test if inner mask is filled if (limask[x]) { // test if the inner mask is empty underneath or to the right - if (!limask[x-rw] || !limask[x+1]) { + if (!limask[x - rw] || !limask[x + 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } /* upper right corner */ - x=t; + x = t; // test if inner mask is filled if (limask[x]) { // test if the inner mask is empty underneath or to the left - if (!limask[x-rw] || !limask[x-1]) { + if (!limask[x - rw] || !limask[x - 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } /* lower left corner */ - x=0; + x = 0; // test if inner mask is filled if (limask[x]) { // test if inner mask is empty above or to the right - if (!limask[x+rw] || !limask[x+1]) { + if (!limask[x + rw] || !limask[x + 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } /* lower right corner */ - x=rw-1; + x = rw - 1; // test if inner mask is filled if (limask[x]) { // test if inner mask is empty above or to the left - if (!limask[x+rw] || !limask[x-1]) { + if (!limask[x + rw] || !limask[x - 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } /* 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 - if (!limask[x-1] || !limask[x+1]) { + if (!limask[x - 1] || !limask[x + 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } } /* 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 - if (!limask[x-1] || !limask[x+1]) { + if (!limask[x - 1] || !limask[x + 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } } /* 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 - if (!limask[x-rw] || !limask[x+rw]) { + if (!limask[x - rw] || !limask[x + rw]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } } /* 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 - if (!limask[x-rw] || !limask[x+rw]) { + if (!limask[x - rw] || !limask[x + rw]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } } - rsize[0]=isz; // fill in our return sizes for edges + fill - rsize[1]=osz; - rsize[2]=gsz; + rsize[0] = isz; // fill in our return sizes for edges + fill + rsize[1] = osz; + 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) { int x; - unsigned int isz=0; // inner edge size - unsigned int osz=0; // outer edge size - unsigned int gsz=0; // gradient fill area size + unsigned int isz = 0; // inner edge size + unsigned int osz = 0; // outer edge size + unsigned int gsz = 0; // gradient fill area size /* Test the four corners */ /* upper left corner */ - x=t-rw+1; + x = t - rw + 1; // test if inner mask is filled if (limask[x]) { // test if the inner mask is empty underneath or to the right - if (!limask[x-rw] || !limask[x+1]) { + if (!limask[x - rw] || !limask[x + 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right + if (!lomask[x - rw] || !lomask[x + 1]) { // test if outer mask is empty underneath or to the right osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } /* upper right corner */ - x=t; + x = t; // test if inner mask is filled if (limask[x]) { // test if the inner mask is empty underneath or to the left - if (!limask[x-rw] || !limask[x-1]) { + if (!limask[x - rw] || !limask[x - 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left + if (!lomask[x - rw] || !lomask[x - 1]) { // test if outer mask is empty above or to the left osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } /* lower left corner */ - x=0; + x = 0; // test if inner mask is filled if (limask[x]) { // test if inner mask is empty above or to the right - if (!limask[x+rw] || !limask[x+1]) { + if (!limask[x + rw] || !limask[x + 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right + if (!lomask[x + rw] || !lomask[x + 1]) { // test if outer mask is empty underneath or to the right osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } /* lower right corner */ - x=rw-1; + x = rw - 1; // test if inner mask is filled if (limask[x]) { // test if inner mask is empty above or to the left - if (!limask[x+rw] || !limask[x-1]) { + if (!limask[x + rw] || !limask[x - 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left + if (!lomask[x + rw] || !lomask[x - 1]) { // test if outer mask is empty underneath or to the left osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } /* 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 - if (!limask[x-1] || !limask[x+1]) { + if (!limask[x - 1] || !limask[x + 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x - 1] || !lomask[x + 1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } } /* 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 - if (!limask[x-1] || !limask[x+1]) { + if (!limask[x - 1] || !limask[x + 1]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x - 1] || !lomask[x + 1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } } /* 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 - if (!limask[x-rw] || !limask[x+rw]) { + if (!limask[x - rw] || !limask[x + rw]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + if (!lomask[x - rw] || !lomask[x + rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } } /* 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 - if (!limask[x-rw] || !limask[x+rw]) { + if (!limask[x - rw] || !limask[x + rw]) { isz++; // increment inner edge size - lres[x]=4; // flag pixel as inner edge + lres[x] = 4; // flag pixel as inner edge } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge } } - else if (lomask[x]) { // inner mask was empty, test if outer mask is filled - if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x - rw] || !lomask[x + rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } else { gsz++; // increment the gradient pixel count - lres[x]=2; // flag pixel as gradient + lres[x] = 2; // flag pixel as gradient } } } - rsize[0]=isz; // fill in our return sizes for edges + fill - rsize[1]=osz; - rsize[2]=gsz; + rsize[0] = isz; // fill in our return sizes for edges + fill + rsize[1] = osz; + 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) @@ -771,43 +771,43 @@ 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) { - a=x-2; - pix_prevRow=a+rw; - pix_nextRow=a-rw; - pix_prevCol=a+1; - pix_nextCol=a-1; - while (a>dx-2) { + 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; + pix_prevCol = a + 1; + pix_nextCol = a - 1; + while (a > dx - 2) { if (!limask[a]) { // if the inner mask is empty if (lomask[a]) { // if the outer mask is full /* - Next we test all 4 directions around the current pixel: next/prev/up/down - The test ensures that the outer mask is empty and that the inner mask - is also empty. If both conditions are true for any one of the 4 adjacent pixels - then the current pixel is counted as being a true outer edge pixel. - */ + Next we test all 4 directions around the current pixel: next/prev/up/down + The test ensures that the outer mask is empty and that the inner mask + is also empty. If both conditions are true for any one of the 4 adjacent pixels + 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])) { - in_osz++; // increment the outer boundary pixel count - lres[a]=3; // flag pixel as part of outer edge + in_osz++; // increment the outer boundary pixel count + lres[a] = 3; // flag pixel as part of outer edge } - else { // it's not a boundary pixel, but it is a gradient pixel - in_gsz++; // increment the gradient pixel count - lres[a]=2; // flag pixel as gradient + else { // it's not a boundary pixel, but it is a gradient pixel + in_gsz++; // increment the gradient pixel count + lres[a] = 2; // flag pixel as gradient } } } else { if (!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) { - in_isz++; // increment the inner boundary pixel count - lres[a]=4; // flag pixel as part of inner edge + in_isz++; // increment the inner boundary pixel count + lres[a] = 4; // flag pixel as part of inner edge } else { - res[a]=1.0f; // pixel is part of inner mask, but not at an edge + res[a] = 1.0f; // pixel is part of inner mask, but not at an edge } } a--; @@ -818,9 +818,9 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l } } - rsize[0]=in_isz; // fill in our return sizes for edges + fill - rsize[1]=in_osz; - rsize[2]=in_gsz; + rsize[0] = in_isz; // fill in our return sizes for edges + fill + rsize[1] = in_osz; + 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) @@ -833,32 +833,32 @@ 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) { - a=x-2; - pix_prevRow=a+rw; - pix_nextRow=a-rw; - pix_prevCol=a+1; - pix_nextCol=a-1; - while (a>dx-2) { - if (!limask[a]) { // if the inner mask is empty - if (lomask[a]) { // if the outer mask is full + 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; + pix_prevCol = a + 1; + pix_nextCol = a - 1; + while (a > dx - 2) { + if (!limask[a]) { // if the inner mask is empty + if (lomask[a]) { // if the outer mask is full /* - Next we test all 4 directions around the current pixel: next/prev/up/down - The test ensures that the outer mask is empty and that the inner mask - is also empty. If both conditions are true for any one of the 4 adjacent pixels - then the current pixel is counted as being a true outer edge pixel. - */ + Next we test all 4 directions around the current pixel: next/prev/up/down + The test ensures that the outer mask is empty and that the inner mask + is also empty. If both conditions are true for any one of the 4 adjacent pixels + 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])) { - in_osz++; // increment the outer boundary pixel count - lres[a]=3; // flag pixel as part of outer edge + in_osz++; // increment the outer boundary pixel count + lres[a] = 3; // flag pixel as part of outer edge } - else { // it's not a boundary pixel, but it is a gradient pixel - in_gsz++; // increment the gradient pixel count - lres[a]=2; // flag pixel as gradient + else { // it's not a boundary pixel, but it is a gradient pixel + in_gsz++; // increment the gradient pixel count + lres[a] = 2; // flag pixel as gradient } } @@ -869,24 +869,24 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i (!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 + in_isz++; // increment the inner boundary pixel count + lres[a] = 4; // flag pixel as part of inner edge } else { - res[a]=1.0f; // pixel is part of inner mask, but not at an edge + res[a] = 1.0f; // pixel is part of inner mask, but not at an edge } } a--; - pix_prevRow--; // advance all four "surrounding" pixel pointers + pix_prevRow--; // advance all four "surrounding" pixel pointers pix_nextRow--; pix_prevCol--; pix_nextCol--; } } - rsize[0]=in_isz; // fill in our return sizes for edges + fill - rsize[1]=in_osz; - rsize[2]=in_gsz; + rsize[0] = in_isz; // fill in our return sizes for edges + fill + rsize[1] = in_osz; + 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) @@ -898,102 +898,102 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne unsigned int rsl; // long used for finding fast 1.0/sqrt unsigned int gradientFillOffset; - unsigned int innerAccum=0; // for looping inner edge pixel indexes, represents current position from offset - unsigned int outerAccum=0; // for looping outer edge pixel indexes, represents current position from offset - unsigned int gradientAccum=0; // for looping gradient pixel indexes, represents current position from offset + unsigned int innerAccum = 0; // for looping inner edge pixel indexes, represents current position from offset + unsigned int outerAccum = 0; // for looping outer edge pixel indexes, represents current position from offset + unsigned int gradientAccum = 0; // for looping gradient pixel indexes, represents current position from offset /* - Here we compute the size of buffer needed to hold (row,col) coordinates - for each pixel previously determined to be either gradient, inner edge, - or outer edge. - - Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even - though gbuf[] is declared as unsigned short* (2 bytes) because we don't - store the pixel indexes, we only store x,y location of pixel in buffer. - - 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 - per flagged pixel. - - In general, the buffer on-screen: - - Example: 9 by 9 pixel block - - . = pixel non-white in both outer and inner mask - o = pixel white in outer, but not inner mask, adjacent to "." pixel - g = pixel white in outer, but not inner mask, not adjacent to "." pixel - i = pixel white in inner mask, adjacent to "g" or "." pixel - F = pixel white in inner mask, only adjacent to other pixels white in the inner mask - - - ......... <----- pixel #80 - ..oooo... - .oggggo.. - .oggiggo. - .ogiFigo. - .oggiggo. - .oggggo.. - ..oooo... - pixel #00 -----> ......... - - gsz = 18 (18 "g" pixels above) - isz = 4 (4 "i" pixels above) - osz = 18 (18 "o" pixels above) - - - The memory in gbuf[] after filling will look like this: - - gradientFillOffset (0 pixels) innerEdgeOffset (18 pixels) outerEdgeOffset (22 pixels) - / / / - / / / - |X Y X Y X Y X Y > <----------------> <------------------------> <----------------+ - |0 2 4 6 8 10 12 14 > ... <68 70 72 74 > ... <80 82 84 86 88 90 > ... <152 154 156 158 | <- bytes - +--------------------------------> <----------------> <------------------------> <----------------+ - |g0 g0 g1 g1 g2 g2 g3 g3 > ......... + + gsz = 18 (18 "g" pixels above) + isz = 4 (4 "i" pixels above) + osz = 18 (18 "o" pixels above) + + + The memory in gbuf[] after filling will look like this: + + gradientFillOffset (0 pixels) innerEdgeOffset (18 pixels) outerEdgeOffset (22 pixels) + / / / + / / / + |X Y X Y X Y X Y > <----------------> <------------------------> <----------------+ + |0 2 4 6 8 10 12 14 > ... <68 70 72 74 > ... <80 82 84 86 88 90 > ... <152 154 156 158 | <- bytes + +--------------------------------> <----------------> <------------------------> <----------------+ + |g0 g0 g1 g1 g2 g2 g3 g3 > =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] - dmin=0xffffffff; // reset min distance to edge pixel - for (a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) { // loop through all outer edge buffer pixels - ud=a<<1; - dy=t-gbuf[ud]; // set dx to gradient pixel column - outer edge pixel row - dx=fsz-gbuf[ud+1]; // set dy to gradient pixel row - outer edge pixel column - ud=dx*dx+dy*dy; // compute sum of squares - if (ud= 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] + dmin = 0xffffffff; // reset min distance to edge pixel + for (a = outerEdgeOffset + osz - 1; a >= outerEdgeOffset; a--) { // loop through all outer edge buffer pixels + ud = a << 1; + dy = t - gbuf[ud]; // set dx to gradient pixel column - outer edge pixel row + dx = fsz - gbuf[ud + 1]; // set dy to gradient pixel row - outer edge pixel column + ud = dx * dx + dy * dy; // compute sum of squares + if (ud < dmin) { // if our new sum of squares is less than the current minimum + dmin = ud; // set a new minimum equal to the new lower value } } - odist=(float)(dmin); // cast outer min to a float - rsf=odist*0.5f; // - rsl=*(unsigned int*)&odist; // use some peculiar properties of the way bits are stored - rsl=0x5f3759df-(rsl>>1); // in floats vs. unsigned ints to compute an approximate - 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 - 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 - ud=dx*dx+dy*dy; // compute sum of squares - if (ud> 1); // in floats vs. unsigned ints to compute an approximate + 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 + 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 + ud = dx * dx + dy * dy; // compute sum of squares + if (ud < dmin) { // if our new sum of squares is less than the current minimum we've found + dmin = ud; // set a new minimum equal to the new lower value } } - idist=(float)(dmin); // cast inner min to a float - rsf=idist*0.5f; // - rsl=*(unsigned int*)&idist; // - rsl=0x5f3759df-(rsl>>1); // see notes above - idist=*(float*)&rsl; // - idist=idist*(rsopf-(rsf*idist*idist)); // + idist = (float)(dmin); // cast inner min to a float + rsf = idist * 0.5f; // + rsl = *(unsigned int *)&idist; // + rsl = 0x5f3759df - (rsl >> 1); // see notes above + idist = *(float *)&rsl; // + idist = idist * (rsopf - (rsf * idist * idist)); // /* - Note once again that since we are using reciprocals of distance values our - proportion is already the correct intensity, and does not need to be - subracted from 1.0 like it would have if we used real distances. - */ + * Note once again that since we are using reciprocals of distance values our + * proportion is already the correct intensity, and does not need to be + * subracted from 1.0 like it would have if we used real distances. + */ /* - Here we reconstruct the pixel's memory location in the CompBuf by - Pixel Index = Pixel Column + ( Pixel Row * Row Width ) - */ - res[gbuf[gradientFillOffset+1]+(gbuf[gradientFillOffset]*rw)]=(idist/(idist+odist)); //set intensity + * Here we reconstruct the pixel's memory location in the CompBuf by + * Pixel Index = Pixel Column + ( Pixel Row * Row Width ) + */ + res[gbuf[gradientFillOffset + 1] + (gbuf[gradientFillOffset] * rw)] = (idist / (idist + odist)); //set intensity } } @@ -1140,92 +1140,92 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float int t; // t = total number of pixels in buffer - 1 (used for loop starts) int fsz; // size of the frame - unsigned int isz=0; // size (in pixels) of inside edge pixel index buffer - unsigned int osz=0; // size (in pixels) of outside edge pixel index buffer - unsigned int gsz=0; // size (in pixels) of gradient pixel index buffer - unsigned int rsize[3]; // size storage to pass to helper functions - unsigned int innerEdgeOffset=0; // offset into final buffer where inner edge pixel indexes start - unsigned int outerEdgeOffset=0; // offset into final buffer where outer edge pixel indexes start + unsigned int isz = 0; // size (in pixels) of inside edge pixel index buffer + unsigned int osz = 0; // size (in pixels) of outside edge pixel index buffer + unsigned int gsz = 0; // size (in pixels) of gradient pixel index buffer + unsigned int rsize[3]; // size storage to pass to helper functions + unsigned int innerEdgeOffset = 0; // offset into final buffer where inner edge pixel indexes start + unsigned int outerEdgeOffset = 0; // offset into final buffer where outer edge pixel indexes start unsigned short *gbuf; // gradient/inner/outer pixel location index buffer if (true) { // if both input sockets have some data coming in... - t=(this->getWidth()*this->getHeight())-1; // determine size of the frame + 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) - 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) + 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 /* - The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the - LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows. - This allows for quick computation of outer edge pixels where - a screen edge pixel is marked to be gradient. - - The pixel type (gradient vs inner-edge vs outer-edge) tests change - depending on the user selected "Inner Edge Mode" and the user selected - "Buffer Edge Mode" on the node's GUI. There are 4 sets of basically the - same algorithm: - - 1.) Inner Edge -> Adjacent Only - Buffer Edge -> Keep Inside - - 2.) Inner Edge -> Adjacent Only - Buffer Edge -> Bleed Out - - 3.) Inner Edge -> All - Buffer Edge -> Keep Inside - - 4.) Inner Edge -> All - Buffer Edge -> Bleed Out - - Each version has slightly different criteria for detecting an edge pixel. + * The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the + * LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows. + * This allows for quick computation of outer edge pixels where + * a screen edge pixel is marked to be gradient. + * + * The pixel type (gradient vs inner-edge vs outer-edge) tests change + * depending on the user selected "Inner Edge Mode" and the user selected + * "Buffer Edge Mode" on the node's GUI. There are 4 sets of basically the + * same algorithm: + * + * 1.) Inner Edge -> Adjacent Only + * Buffer Edge -> Keep Inside + * + * 2.) Inner Edge -> Adjacent Only + * Buffer Edge -> Bleed Out + * + * 3.) Inner Edge -> All + * Buffer Edge -> Keep Inside + * + * 4.) Inner Edge -> All + * Buffer Edge -> Bleed Out + * + * Each version has slightly different criteria for detecting an edge pixel. */ - if (this->adjecentOnly) { // if "adjacent only" inner edge mode is turned on - if (this->keepInside) { // if "keep inside" buffer edge mode is turned on - do_adjacentKeepBorders(t,rw,limask,lomask,lres,res,rsize); + if (this->adjecentOnly) { // if "adjacent only" inner edge mode is turned on + if (this->keepInside) { // if "keep inside" buffer edge mode is turned on + do_adjacentKeepBorders(t, rw, limask, lomask, lres, res, rsize); } - else { // "bleed out" buffer edge mode is turned on - do_adjacentBleedBorders(t,rw,limask,lomask,lres,res,rsize); + else { // "bleed out" buffer edge mode is turned on + do_adjacentBleedBorders(t, rw, limask, lomask, lres, res, rsize); } - isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass - osz=rsize[1]; - gsz=rsize[2]; + isz = rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass + osz = rsize[1]; + gsz = rsize[2]; // detect edges in all non-border pixels in the buffer - do_adjacentEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz); + do_adjacentEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz); } - else { // "all" inner edge mode is turned on - if (this->keepInside) { // if "keep inside" buffer edge mode is turned on - do_allKeepBorders(t,rw,limask,lomask,lres,res,rsize); + else { // "all" inner edge mode is turned on + if (this->keepInside) { // if "keep inside" buffer edge mode is turned on + do_allKeepBorders(t, rw, limask, lomask, lres, res, rsize); } - else { // "bleed out" buffer edge mode is turned on - do_allBleedBorders(t,rw,limask,lomask,lres,res,rsize); + else { // "bleed out" buffer edge mode is turned on + do_allBleedBorders(t, rw, limask, lomask, lres, res, rsize); } - isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass - osz=rsize[1]; - gsz=rsize[2]; + isz = rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass + osz = rsize[1]; + gsz = rsize[2]; // detect edges in all non-border pixels in the buffer - do_allEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz); + do_allEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz); } - isz=rsize[0]; // set edge and gradient buffer sizes once again... - osz=rsize[1]; // the sizes in rsize[] may have been modified - gsz=rsize[2]; // by the do_*EdgeDetection() function. + isz = rsize[0]; // set edge and gradient buffer sizes once again... + osz = rsize[1]; // the sizes in rsize[] may have been modified + gsz = rsize[2]; // by the do_*EdgeDetection() function. - fsz=gsz+isz+osz; // calculate size of pixel index buffer needed - gbuf = (unsigned short*)MEM_callocN(sizeof (unsigned short)*fsz*2, "DEM"); // allocate edge/gradient pixel index buffer + fsz = gsz + isz + osz; // calculate size of pixel index buffer needed + gbuf = (unsigned short *)MEM_callocN(sizeof (unsigned short) * fsz * 2, "DEM"); // 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); + do_createEdgeLocationBuffer(t, rw, lres, res, gbuf, &innerEdgeOffset, &outerEdgeOffset, isz, gsz); + do_fillGradientBuffer(rw, res, gbuf, isz, osz, gsz, innerEdgeOffset, outerEdgeOffset); - MEM_freeN(gbuf); // free the gradient index buffer + MEM_freeN(gbuf); // free the gradient index buffer } } -DoubleEdgeMaskOperation::DoubleEdgeMaskOperation(): NodeOperation() +DoubleEdgeMaskOperation::DoubleEdgeMaskOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); @@ -1266,9 +1266,9 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **mem lockMutex(); 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()]; + 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); @@ -1281,12 +1281,12 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect, MemoryBuffer **mem } void DoubleEdgeMaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { - float *buffer = (float*) data; - int index = (y*this->getWidth() + x); + float *buffer = (float *) data; + int index = (y * this->getWidth() + x); 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 DoubleEdgeMaskOperation::deinitExecution() diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp index 650c57dd8dc..0beacd02738 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp @@ -24,7 +24,7 @@ #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); @@ -41,7 +41,7 @@ void EllipseMaskOperation::initExecution() const double rad = DEG2RAD((double)this->data->rotation); this->cosine = cos(rad); this->sine = sin(rad); - this->aspectRatio = ((float)this->getWidth())/this->getHeight(); + this->aspectRatio = ((float)this->getWidth()) / this->getHeight(); } void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) @@ -49,32 +49,32 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam float inputMask[4]; float inputValue[4]; - float rx = x/this->getWidth(); - float ry = y/this->getHeight(); + float rx = x / this->getWidth(); + float ry = y / this->getHeight(); - const float dy = (ry - this->data->y)/this->aspectRatio; + const float dy = (ry - this->data->y) / this->aspectRatio; const float dx = rx - this->data->x; - rx = this->data->x+(this->cosine*dx + this->sine*dy); - ry = this->data->y+(-this->sine*dx + this->cosine*dy); + rx = this->data->x + (this->cosine * dx + this->sine * dy); + ry = this->data->y + (-this->sine * dx + this->cosine * dy); this->inputMask->read(inputMask, x, y, sampler, inputBuffers); this->inputValue->read(inputValue, x, y, sampler, inputBuffers); - const float halfHeight = (this->data->height)/2.0f; - const float halfWidth = this->data->width/2.0f; - float sx = rx-this->data->x; + const float halfHeight = (this->data->height) / 2.0f; + const float halfWidth = this->data->width / 2.0f; + float sx = rx - this->data->x; sx *= sx; const float tx = halfWidth * halfWidth; - float sy = ry-this->data->y; + float sy = ry - this->data->y; sy *= sy; const float ty = halfHeight * halfHeight; - bool inside = ((sx/tx)+(sy/ty))<1.0f; + bool inside = ((sx / tx) + (sy / ty)) < 1.0f; switch (this->maskType) { case CMP_NODE_MASKTYPE_ADD: if (inside) { - color[0] = max(inputMask[0],inputValue[0]); + color[0] = max(inputMask[0], inputValue[0]); } else { color[0] = inputMask[0]; @@ -82,7 +82,7 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam break; case CMP_NODE_MASKTYPE_SUBTRACT: if (inside) { - color[0] = inputMask[0]-inputValue[0]; + color[0] = inputMask[0] - inputValue[0]; CLAMP(color[0], 0, 1); } else { @@ -91,24 +91,24 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam break; case CMP_NODE_MASKTYPE_MULTIPLY: if (inside) { - color[0] = inputMask[0]*inputValue[0]; + color[0] = inputMask[0] * inputValue[0]; } else { color[0] = 0; } break; case CMP_NODE_MASKTYPE_NOT: - if (inside) { - if (inputMask[0]>0.0f) { - color[0] = 0; + if (inside) { + if (inputMask[0] > 0.0f) { + color[0] = 0; + } + else { + color[0] = inputValue[0]; + } } else { - color[0] = inputValue[0]; + color[0] = inputMask[0]; } - } - else { - color[0] = inputMask[0]; - } break; } diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp index 38018ffc3f7..5023473f4aa 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cpp +++ b/source/blender/compositor/operations/COM_FlipOperation.cpp @@ -42,10 +42,10 @@ void FlipOperation::deinitExecution() } -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; + 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); } @@ -55,16 +55,16 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper rcti newInput; if (this->flipX) { - newInput.xmax = (this->getWidth()- 1 - input->xmin)+1; - newInput.xmin = (this->getWidth()- 1 - input->xmax)-1; + newInput.xmax = (this->getWidth() - 1 - input->xmin) + 1; + newInput.xmin = (this->getWidth() - 1 - input->xmax) - 1; } else { newInput.xmin = input->xmin; newInput.xmax = input->xmax; } if (this->flipY) { - newInput.ymax = (this->getHeight()- 1 - input->ymin)+1; - newInput.ymin = (this->getHeight()- 1 - input->ymax)-1; + newInput.ymax = (this->getHeight() - 1 - input->ymin) + 1; + newInput.ymin = (this->getHeight() - 1 - input->ymax) - 1; } else { newInput.ymin = input->ymin; diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp index a4fb20402a4..3e90b643604 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp @@ -23,7 +23,7 @@ #include "COM_GammaCorrectOperation.h" #include "BLI_math.h" -GammaCorrectOperation::GammaCorrectOperation(): NodeOperation() +GammaCorrectOperation::GammaCorrectOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -45,9 +45,9 @@ void GammaCorrectOperation::executePixel(float *color, float x, float y, PixelSa } /* check for negative to avoid nan's */ - color[0] = inputColor[0]>0.0f?inputColor[0]*inputColor[0] :0.0f; - color[1] = inputColor[1]>0.0f?inputColor[1]*inputColor[1] :0.0f; - color[2] = inputColor[2]>0.0f?inputColor[2]*inputColor[2] :0.0f; + color[0] = inputColor[0] > 0.0f ? inputColor[0] * inputColor[0] : 0.0f; + color[1] = inputColor[1] > 0.0f ? inputColor[1] * inputColor[1] : 0.0f; + color[2] = inputColor[2] > 0.0f ? inputColor[2] * inputColor[2] : 0.0f; inputColor[0] *= inputColor[3]; inputColor[1] *= inputColor[3]; @@ -64,7 +64,7 @@ void GammaCorrectOperation::deinitExecution() this->inputProgram = NULL; } -GammaUncorrectOperation::GammaUncorrectOperation(): NodeOperation() +GammaUncorrectOperation::GammaUncorrectOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -86,9 +86,9 @@ void GammaUncorrectOperation::executePixel(float *color, float x, float y, Pixel inputColor[2] /= inputColor[3]; } - color[0] = inputColor[0]>0.0f?sqrtf(inputColor[0]) :0.0f; - color[1] = inputColor[1]>0.0f?sqrtf(inputColor[1]) :0.0f; - color[2] = inputColor[2]>0.0f?sqrtf(inputColor[2]) :0.0f; + color[0] = inputColor[0] > 0.0f ? sqrtf(inputColor[0]) : 0.0f; + color[1] = inputColor[1] > 0.0f ? sqrtf(inputColor[1]) : 0.0f; + color[2] = inputColor[2] > 0.0f ? sqrtf(inputColor[2]) : 0.0f; inputColor[0] *= inputColor[3]; inputColor[1] *= inputColor[3]; diff --git a/source/blender/compositor/operations/COM_GammaOperation.cpp b/source/blender/compositor/operations/COM_GammaOperation.cpp index 989ffd5dfba..2c3e78840ee 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaOperation.cpp @@ -23,7 +23,7 @@ #include "COM_GammaOperation.h" #include "BLI_math.h" -GammaOperation::GammaOperation(): NodeOperation() +GammaOperation::GammaOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h index 5dc896fafaa..10a8a538391 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h @@ -34,17 +34,17 @@ public: GaussianXBlurOperation(); /** - *@brief the inner loop of this program + * @brief the inner loop of this program */ void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data); /** - *@brief initialize the execution + * @brief initialize the execution */ void initExecution(); /** - *@brief Deinitialize the execution + * @brief Deinitialize the execution */ void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp index 2afcc2e5cc7..b8e46e2d0be 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp @@ -32,7 +32,7 @@ extern "C" { } #endif -HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation(): CurveBaseOperation() +HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation() : CurveBaseOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -53,7 +53,7 @@ void HueSaturationValueCorrectOperation::executePixel(float *output, float x, fl /* adjust hue, scaling returned default 0.5 up to 1 */ f = curvemapping_evaluateF(this->curveMapping, 0, hsv[0]); - hsv[0] += f-0.5f; + hsv[0] += f - 0.5f; /* adjust saturation, scaling returned default 0.5 up to 1 */ f = curvemapping_evaluateF(this->curveMapping, 1, hsv[0]); diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cpp b/source/blender/compositor/operations/COM_IDMaskOperation.cpp index 834ca4fc5ed..d02367088d7 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_IDMaskOperation.cpp @@ -22,7 +22,7 @@ #include "COM_IDMaskOperation.h" -IDMaskOperation::IDMaskOperation(): NodeOperation() +IDMaskOperation::IDMaskOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -38,7 +38,7 @@ void IDMaskOperation::executePixel(float *color, float x, float y, PixelSampler float inputValue[4]; this->inputProgram->read(inputValue, x, y, sampler, inputBuffers); - const float a = (inputValue[0] == this->objectIndex)?1.0f:0.0f; + const float a = (inputValue[0] == this->objectIndex) ? 1.0f : 0.0f; color[0] = a; } diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp index 04cd91d3c3a..9dbe8419daa 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cpp +++ b/source/blender/compositor/operations/COM_ImageOperation.cpp @@ -36,7 +36,7 @@ extern "C" { #include "IMB_imbuf_types.h" } -BaseImageOperation::BaseImageOperation(): NodeOperation() +BaseImageOperation::BaseImageOperation() : NodeOperation() { this->image = NULL; this->buffer = NULL; @@ -48,15 +48,15 @@ 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); } @@ -66,12 +66,12 @@ ImBuf *BaseImageOperation::getImBuf() ImBuf *ibuf; ibuf = BKE_image_get_ibuf(this->image, this->imageUser); - if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { - return NULL; + if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) { + return NULL; } if (ibuf->rect_float == NULL) { - IMB_float_from_rect(ibuf); + IMB_float_from_rect(ibuf); } return ibuf; } @@ -108,7 +108,7 @@ void BaseImageOperation::determineResolution(unsigned int resolution[], unsigned } } -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; @@ -118,15 +118,15 @@ void ImageOperation::executePixel(float *color, float x, float y, PixelSampler s } else { switch (sampler) { - case COM_PS_NEAREST: - neareast_interpolation_color(this->buffer, NULL, color, x, y); - break; - case COM_PS_BILINEAR: - bilinear_interpolation_color(this->buffer, NULL, color, x, y); - break; - case COM_PS_BICUBIC: - bicubic_interpolation_color(this->buffer, NULL, color, x, y); - break; + case COM_PS_NEAREST: + neareast_interpolation_color(this->buffer, NULL, color, x, y); + break; + case COM_PS_BILINEAR: + bilinear_interpolation_color(this->buffer, NULL, color, x, y); + break; + case COM_PS_BICUBIC: + bicubic_interpolation_color(this->buffer, NULL, color, x, y); + break; } } } @@ -141,15 +141,15 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp else { tempcolor[3] = 1.0f; switch (sampler) { - case COM_PS_NEAREST: - neareast_interpolation_color(this->buffer, NULL, tempcolor, x, y); - break; - case COM_PS_BILINEAR: - bilinear_interpolation_color(this->buffer, NULL, tempcolor, x, y); - break; - case COM_PS_BICUBIC: - bicubic_interpolation_color(this->buffer, NULL, tempcolor, x, y); - break; + case COM_PS_NEAREST: + neareast_interpolation_color(this->buffer, NULL, tempcolor, x, y); + break; + case COM_PS_BILINEAR: + bilinear_interpolation_color(this->buffer, NULL, tempcolor, x, y); + break; + case COM_PS_BICUBIC: + bicubic_interpolation_color(this->buffer, NULL, tempcolor, x, y); + break; } color[0] = tempcolor[3]; } diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp index 82158c4adad..6142959a12e 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.cpp +++ b/source/blender/compositor/operations/COM_InvertOperation.cpp @@ -22,7 +22,7 @@ #include "COM_InvertOperation.h" -InvertOperation::InvertOperation(): NodeOperation() +InvertOperation::InvertOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); @@ -50,16 +50,16 @@ void InvertOperation::executePixel(float *out, float x, float y, PixelSampler sa const float invertedValue = 1.0f - value; if (color) { - out[0] = (1.0f - inputColor[0])*value + inputColor[0]*invertedValue; - out[1] = (1.0f - inputColor[1])*value + inputColor[1]*invertedValue; - out[2] = (1.0f - inputColor[2])*value + inputColor[2]*invertedValue; + out[0] = (1.0f - inputColor[0]) * value + inputColor[0] * invertedValue; + out[1] = (1.0f - inputColor[1]) * value + inputColor[1] * invertedValue; + out[2] = (1.0f - inputColor[2]) * value + inputColor[2] * invertedValue; } else { copy_v3_v3(out, inputColor); } if (alpha) - out[3] = (1.0f - inputColor[3])*value + inputColor[3]*invertedValue; + out[3] = (1.0f - inputColor[3]) * value + inputColor[3] * invertedValue; else out[3] = inputColor[3]; diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp index 09b5b7a523c..2c9949f2b4b 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp @@ -28,7 +28,7 @@ #include "BLI_listbase.h" #include "BLI_math.h" -KeyingClipOperation::KeyingClipOperation(): NodeOperation() +KeyingClipOperation::KeyingClipOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -56,7 +56,7 @@ void KeyingClipOperation::executePixel(float *color, int x, int y, MemoryBuffer const int delta = this->kernelRadius; const float tolerance = this->kernelTolerance; - MemoryBuffer *inputBuffer = (MemoryBuffer*)data; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; float *buffer = inputBuffer->getBuffer(); int bufferWidth = inputBuffer->getWidth(); diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp index b7fd2772729..04523384653 100644 --- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp @@ -40,7 +40,7 @@ static int get_pixel_primary_channel(float *pixel) return 2; } -KeyingDespillOperation::KeyingDespillOperation(): NodeOperation() +KeyingDespillOperation::KeyingDespillOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp index e04c79f6713..0a450cc3bf8 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp @@ -52,7 +52,7 @@ static float get_pixel_saturation(float pixelColor[4], float screen_balance, int return (pixelColor[primary_channel] - val) * fabsf(1.0f - val); } -KeyingOperation::KeyingOperation(): NodeOperation() +KeyingOperation::KeyingOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp index f6301557aaf..b728f6c5cca 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp @@ -39,7 +39,7 @@ extern "C" { #include "IMB_imbuf_types.h" } -KeyingScreenOperation::KeyingScreenOperation(): NodeOperation() +KeyingScreenOperation::KeyingScreenOperation() : NodeOperation() { this->addOutputSocket(COM_DT_COLOR); this->movieClip = NULL; @@ -149,7 +149,7 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri BLI_voronoi_triangulate(sites, sites_total, &edges, width, height, &triangulation->triangulated_points, &triangulation->triangulated_points_total, - &triangulation->triangles, &triangulation->triangles_total); + &triangulation->triangles, &triangulation->triangles_total); MEM_freeN(sites); BLI_freelistN(&edges); @@ -204,8 +204,8 @@ void KeyingScreenOperation::executePixel(float *color, int x, int y, MemoryBuffe for (i = 0; i < triangulation->triangles_total; i++) { int *triangle = triangulation->triangles[i]; VoronoiTriangulationPoint *a = &triangulation->triangulated_points[triangle[0]], - *b = &triangulation->triangulated_points[triangle[1]], - *c = &triangulation->triangulated_points[triangle[2]]; + *b = &triangulation->triangulated_points[triangle[1]], + *c = &triangulation->triangulated_points[triangle[2]]; float co[2] = {(float) x, (float) y}, w[3]; if (barycentric_coords_v2(a->co, b->co, c->co, co, w)) { diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp index f206bf4df8e..6e8aa9461e6 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp @@ -22,7 +22,7 @@ #include "COM_LuminanceMatteOperation.h" #include "BLI_math.h" -LuminanceMatteOperation::LuminanceMatteOperation(): NodeOperation() +LuminanceMatteOperation::LuminanceMatteOperation() : NodeOperation() { addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); @@ -44,26 +44,26 @@ void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y, { float inColor[4]; - const float high=this->settings->t1; - const float low=this->settings->t2; + const float high = this->settings->t1; + const float low = this->settings->t2; float alpha; this->inputImageProgram->read(inColor, x, y, sampler, inputBuffers); /* one line thread-friend algorithm: - outputValue[0] = max(inputValue[3], min(high, max(low, ((inColor[0]-low)/(high-low)))) - */ + * outputValue[0] = max(inputValue[3], min(high, max(low, ((inColor[0]-low)/(high-low)))) + */ /* test range*/ if (inColor[0] > high) { - alpha=1.f; + alpha = 1.f; } else if (inColor[0] < low) { - alpha=0.f; + alpha = 0.f; } - else {/*blend */ - alpha=(inColor[0]-low)/(high-low); + else { /*blend */ + alpha = (inColor[0] - low) / (high - low); } @@ -72,12 +72,12 @@ void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y, */ /* don't make something that was more transparent less transparent */ - if (alphaaddInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VECTOR); @@ -44,7 +44,7 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s { float inputUV[4]; float uv_a[4], uv_b[4]; - float u,v; + float u, v; float dx, dy; float uv_l, uv_r; @@ -52,48 +52,45 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s this->inputUVProgram->read(inputUV, x, y, sampler, inputBuffers); if (inputUV[2] == 0.f) { - color[0] = 0.f; - color[1] = 0.f; - color[2] = 0.f; - color[3] = 0.f; - return; + zero_v4(color); + return; } /* 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? fabsf(inputUV[0] - uv_a[0]) : 0.f; - uv_r = uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f; + 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 ? fabsf(inputUV[0] - uv_a[0]) : 0.f; + uv_r = uv_b[2] != 0.f ? fabsf(inputUV[0] - uv_b[0]) : 0.f; 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? fabsf(inputUV[1] - uv_a[1]) : 0.f; - uv_d = uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f; + 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 ? fabsf(inputUV[1] - uv_a[1]) : 0.f; + uv_d = uv_b[2] != 0.f ? fabsf(inputUV[1] - uv_b[1]) : 0.f; 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; - - 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; - - 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; + + 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; + + dx += 0.25f * (uv_l + uv_r); + dy += 0.25f * (uv_u + uv_d); /* UV to alpha threshold */ const float threshold = this->alpha * 0.05f; @@ -114,10 +111,7 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s /* "premul" */ if (alpha < 1.0f) { - color[0]*= alpha; - color[1]*= alpha; - color[2]*= alpha; - color[3]*= alpha; + mul_v4_fl(color, alpha); } } @@ -131,7 +125,7 @@ bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOpe { rcti colorInput; rcti uvInput; - NodeOperation *operation=NULL; + NodeOperation *operation = NULL; /* the uv buffer only needs a 3x3 buffer. The image needs whole buffer */ diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp index bf6d29c0456..6d7804dd6e3 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MapValueOperation.h" -MapValueOperation::MapValueOperation(): NodeOperation() +MapValueOperation::MapValueOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -39,12 +39,12 @@ void MapValueOperation::executePixel(float *outputValue, float x, float y, Pixel float src[4]; inputOperation->read(src, x, y, sampler, inputBuffers); TexMapping *texmap = this->settings; - float value = (src[0] + texmap->loc[0])*texmap->size[0]; + float value = (src[0] + texmap->loc[0]) * texmap->size[0]; if (texmap->flag & TEXMAP_CLIP_MIN) - if (valuemin[0]) + if (value < texmap->min[0]) value = texmap->min[0]; if (texmap->flag & TEXMAP_CLIP_MAX) - if (value>texmap->max[0]) + if (value > texmap->max[0]) value = texmap->max[0]; outputValue[0] = value; diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp index 8f7115659a1..0493bdee12c 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cpp +++ b/source/blender/compositor/operations/COM_MaskOperation.cpp @@ -32,10 +32,10 @@ extern "C" { #include "BKE_mask.h" - #include "../../../../intern/raskter/raskter.h" + #include "../../../../intern/raskter/raskter.h" } -MaskOperation::MaskOperation(): NodeOperation() +MaskOperation::MaskOperation() : NodeOperation() { this->addOutputSocket(COM_DT_VALUE); this->mask = NULL; @@ -76,9 +76,9 @@ void *MaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers buffer = (float *)MEM_callocN(sizeof(float) * width * height, "rasterized mask"); BKE_mask_rasterize(mask, width, height, buffer, TRUE, this->smooth); - if(this->smooth) { - PLX_antialias_buffer(buffer, width, height); - } + if (this->smooth) { + PLX_antialias_buffer(buffer, width, height); + } this->rasterizedMask = buffer; } @@ -110,7 +110,7 @@ void MaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *input color[0] = 0.0f; } else { - float *buffer = (float*) data; + float *buffer = (float *) data; int index = (y * this->getWidth() + x); color[0] = buffer[index]; diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index b943ec88fde..5e9fb70b206 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -25,7 +25,7 @@ extern "C" { #include "BLI_math.h" } -MathBaseOperation::MathBaseOperation(): NodeOperation() +MathBaseOperation::MathBaseOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); @@ -50,14 +50,15 @@ void MathBaseOperation::deinitExecution() void MathBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { InputSocket *socket; - unsigned int tempPreferredResolution[] = {0,0}; + unsigned int tempPreferredResolution[] = {0, 0}; unsigned int tempResolution[2]; socket = this->getInputSocket(0); socket->determineResolution(tempResolution, tempPreferredResolution); if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) { this->setResolutionInputSocketIndex(0); - } else { + } + else { this->setResolutionInputSocketIndex(1); } NodeOperation::determineResolution(resolution, preferredResolution); @@ -104,7 +105,7 @@ void MathDivideOperation::executePixel(float *outputValue, float x, float y, Pix inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if (inputValue2[0]==0) /* We don't want to divide by zero. */ + if (inputValue2[0] == 0) /* We don't want to divide by zero. */ outputValue[0] = 0.0; else outputValue[0] = inputValue1[0] / inputValue2[0]; @@ -151,7 +152,7 @@ void MathArcSineOperation::executePixel(float *outputValue, float x, float y, Pi inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if (inputValue1[0] <= 1 && inputValue1[0] >= -1 ) + if (inputValue1[0] <= 1 && inputValue1[0] >= -1) outputValue[0] = asin(inputValue1[0]); else outputValue[0] = 0.0; @@ -165,7 +166,7 @@ void MathArcCosineOperation::executePixel(float *outputValue, float x, float y, inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if (inputValue1[0] <= 1 && inputValue1[0] >= -1 ) + if (inputValue1[0] <= 1 && inputValue1[0] >= -1) outputValue[0] = acos(inputValue1[0]); else outputValue[0] = 0.0; @@ -260,7 +261,7 @@ void MathLessThanOperation::executePixel(float *outputValue, float x, float y, P inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - outputValue[0] = inputValue1[0]read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - outputValue[0] = inputValue1[0]>inputValue2[0]?1.0f:0.0f; + outputValue[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f; } diff --git a/source/blender/compositor/operations/COM_MixAddOperation.cpp b/source/blender/compositor/operations/COM_MixAddOperation.cpp index 2c25635e3bc..bd9538a5600 100644 --- a/source/blender/compositor/operations/COM_MixAddOperation.cpp +++ b/source/blender/compositor/operations/COM_MixAddOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixAddOperation.h" -MixAddOperation::MixAddOperation(): MixBaseOperation() +MixAddOperation::MixAddOperation() : MixBaseOperation() { /* pass */ } @@ -42,9 +42,9 @@ void MixAddOperation::executePixel(float *outputValue, float x, float y, PixelSa if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - outputValue[0] = inputColor1[0]+value*inputColor2[0]; - outputValue[1] = inputColor1[1]+value*inputColor2[1]; - outputValue[2] = inputColor1[2]+value*inputColor2[2]; + outputValue[0] = inputColor1[0] + value * inputColor2[0]; + outputValue[1] = inputColor1[1] + value * inputColor2[1]; + outputValue[2] = inputColor1[2] + value * inputColor2[2]; outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.cpp b/source/blender/compositor/operations/COM_MixBaseOperation.cpp index 49ae67a06f7..0efab2942b0 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBaseOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixBaseOperation.h" -MixBaseOperation::MixBaseOperation(): NodeOperation() +MixBaseOperation::MixBaseOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); @@ -55,9 +55,9 @@ void MixBaseOperation::executePixel(float *outputColor, float x, float y, PixelS value *= inputColor2[3]; } float valuem = 1.0f - value; - outputColor[0] = valuem*(inputColor1[0])+value*(inputColor2[0]); - outputColor[1] = valuem*(inputColor1[1])+value*(inputColor2[1]); - outputColor[2] = valuem*(inputColor1[2])+value*(inputColor2[2]); + outputColor[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]; } @@ -71,7 +71,7 @@ void MixBaseOperation::deinitExecution() void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { InputSocket *socket; - unsigned int tempPreferredResolution[] = {0,0}; + unsigned int tempPreferredResolution[] = {0, 0}; unsigned int tempResolution[2]; socket = this->getInputSocket(1); diff --git a/source/blender/compositor/operations/COM_MixBlendOperation.cpp b/source/blender/compositor/operations/COM_MixBlendOperation.cpp index fadac8bbf21..f010d23ce60 100644 --- a/source/blender/compositor/operations/COM_MixBlendOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBlendOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixBlendOperation.h" -MixBlendOperation::MixBlendOperation(): MixBaseOperation() +MixBlendOperation::MixBlendOperation() : MixBaseOperation() { /* pass */ } @@ -43,8 +43,8 @@ void MixBlendOperation::executePixel(float *outputValue, float x, float y, Pixel value *= inputColor2[3]; } float valuem = 1.0f - value; - outputValue[0] = valuem*(inputColor1[0])+value*(inputColor2[0]); - outputValue[1] = valuem*(inputColor1[1])+value*(inputColor2[1]); - outputValue[2] = valuem*(inputColor1[2])+value*(inputColor2[2]); + outputValue[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]); + outputValue[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]); + outputValue[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]); outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixBurnOperation.cpp b/source/blender/compositor/operations/COM_MixBurnOperation.cpp index 8231a5d60af..e94834148e8 100644 --- a/source/blender/compositor/operations/COM_MixBurnOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBurnOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixBurnOperation.h" -MixBurnOperation::MixBurnOperation(): MixBaseOperation() +MixBurnOperation::MixBurnOperation() : MixBaseOperation() { /* pass */ } @@ -43,7 +43,7 @@ void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelS } float valuem = 1.0f - value; - tmp = valuem + value*inputColor2[0]; + tmp = valuem + value * inputColor2[0]; if (tmp <= 0.0f) outputValue[0] = 0.0f; else { @@ -56,7 +56,7 @@ void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelS outputValue[0] = tmp; } - tmp = valuem + value*inputColor2[1]; + tmp = valuem + value * inputColor2[1]; if (tmp <= 0.0f) outputValue[1] = 0.0f; else { @@ -69,7 +69,7 @@ void MixBurnOperation::executePixel(float *outputValue, float x, float y, PixelS outputValue[1] = tmp; } - tmp = valuem + value*inputColor2[2]; + tmp = valuem + value * inputColor2[2]; if (tmp <= 0.0f) outputValue[2] = 0.0f; else { diff --git a/source/blender/compositor/operations/COM_MixColorOperation.cpp b/source/blender/compositor/operations/COM_MixColorOperation.cpp index 035e764d780..f3e893bc18f 100644 --- a/source/blender/compositor/operations/COM_MixColorOperation.cpp +++ b/source/blender/compositor/operations/COM_MixColorOperation.cpp @@ -26,7 +26,7 @@ extern "C" { #include "BLI_math.h" } -MixColorOperation::MixColorOperation(): MixBaseOperation() +MixColorOperation::MixColorOperation() : MixBaseOperation() { /* pass */ } @@ -46,16 +46,16 @@ void MixColorOperation::executePixel(float *outputValue, float x, float y, Pixel } float valuem = 1.0f - value; - float colH,colS,colV; + float colH, colS, colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); - if (colS!=0.0f) { - float rH,rS,rV; - float tmpr,tmpg,tmpb; + if (colS != 0.0f) { + float rH, rS, rV; + float tmpr, tmpg, tmpb; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); - hsv_to_rgb(colH , colS, rV, &tmpr, &tmpg, &tmpb); - outputValue[0] = valuem*(inputColor1[0]) + value*tmpr; - outputValue[1] = valuem*(inputColor1[1]) + value*tmpg; - outputValue[2] = valuem*(inputColor1[2]) + value*tmpb; + hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb); + outputValue[0] = valuem * (inputColor1[0]) + value * tmpr; + outputValue[1] = valuem * (inputColor1[1]) + value * tmpg; + outputValue[2] = valuem * (inputColor1[2]) + value * tmpb; } outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp index a1da5dce9c8..a36c663ddda 100644 --- a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixDarkenOperation.h" -MixDarkenOperation::MixDarkenOperation(): MixBaseOperation() +MixDarkenOperation::MixDarkenOperation() : MixBaseOperation() { /* pass */ } @@ -42,13 +42,13 @@ void MixDarkenOperation::executePixel(float *outputValue, float x, float y, Pixe } float valuem = 1.0f - value; float tmp; - tmp=inputColor2[0]+((1.0f-inputColor2[0])*valuem); + tmp = inputColor2[0] + ((1.0f - inputColor2[0]) * valuem); if (tmp < inputColor1[0]) outputValue[0] = tmp; else outputValue[0] = inputColor1[0]; - tmp=inputColor2[1]+((1.0f-inputColor2[1])*valuem); + tmp = inputColor2[1] + ((1.0f - inputColor2[1]) * valuem); if (tmp < inputColor1[1]) outputValue[1] = tmp; else outputValue[1] = inputColor1[1]; - tmp=inputColor2[2]+((1.0f-inputColor2[2])*valuem); + tmp = inputColor2[2] + ((1.0f - inputColor2[2]) * valuem); if (tmp < inputColor1[2]) outputValue[2] = tmp; else outputValue[2] = inputColor1[2]; diff --git a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp index 883837f0917..69886753480 100644 --- a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp @@ -23,7 +23,7 @@ #include "COM_MixDifferenceOperation.h" #include "BLI_math.h" -MixDifferenceOperation::MixDifferenceOperation(): MixBaseOperation() +MixDifferenceOperation::MixDifferenceOperation() : MixBaseOperation() { /* pass */ } @@ -42,9 +42,9 @@ void MixDifferenceOperation::executePixel(float *outputValue, float x, float y, value *= inputColor2[3]; } float valuem = 1.0f - value; - outputValue[0] = valuem*inputColor1[0] + value*fabsf(inputColor1[0]-inputColor2[0]); - outputValue[1] = valuem*inputColor1[1] + value*fabsf(inputColor1[1]-inputColor2[1]); - outputValue[2] = valuem*inputColor1[2] + value*fabsf(inputColor1[2]-inputColor2[2]); + outputValue[0] = valuem * inputColor1[0] + value *fabsf(inputColor1[0] - inputColor2[0]); + outputValue[1] = valuem * inputColor1[1] + value *fabsf(inputColor1[1] - inputColor2[1]); + outputValue[2] = valuem * inputColor1[2] + value *fabsf(inputColor1[2] - inputColor2[2]); outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.cpp b/source/blender/compositor/operations/COM_MixDivideOperation.cpp index 706308dccc5..8b6586c5336 100644 --- a/source/blender/compositor/operations/COM_MixDivideOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDivideOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixDivideOperation.h" -MixDivideOperation::MixDivideOperation(): MixBaseOperation() +MixDivideOperation::MixDivideOperation() : MixBaseOperation() { /* pass */ } @@ -43,15 +43,15 @@ void MixDivideOperation::executePixel(float *outputValue, float x, float y, Pixe float valuem = 1.0f - value; if (inputColor2[0] != 0.0f) - outputValue[0] = valuem*(inputColor1[0]) + value*(inputColor1[0])/inputColor2[0]; + outputValue[0] = valuem * (inputColor1[0]) + value * (inputColor1[0]) / inputColor2[0]; else outputValue[0] = 0.0f; if (inputColor2[1] != 0.0f) - outputValue[1] = valuem*(inputColor1[1]) + value*(inputColor1[1])/inputColor2[1]; + outputValue[1] = valuem * (inputColor1[1]) + value * (inputColor1[1]) / inputColor2[1]; else outputValue[1] = 0.0f; if (inputColor2[2] != 0.0f) - outputValue[2] = valuem*(inputColor1[2]) + value*(inputColor1[2])/inputColor2[2]; + outputValue[2] = valuem * (inputColor1[2]) + value * (inputColor1[2]) / inputColor2[2]; else outputValue[2] = 0.0f; diff --git a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp index 619819e6298..971ddd5b736 100644 --- a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixDodgeOperation.h" -MixDodgeOperation::MixDodgeOperation(): MixBaseOperation() +MixDodgeOperation::MixDodgeOperation() : MixBaseOperation() { /* pass */ } @@ -43,7 +43,7 @@ void MixDodgeOperation::executePixel(float *outputValue, float x, float y, Pixel } if (inputColor1[0] != 0.0f) { - tmp = 1.0f - value*inputColor2[0]; + tmp = 1.0f - value * inputColor2[0]; if (tmp <= 0.0f) outputValue[0] = 1.0f; else { @@ -58,7 +58,7 @@ void MixDodgeOperation::executePixel(float *outputValue, float x, float y, Pixel outputValue[0] = 0.0f; if (inputColor1[1] != 0.0f) { - tmp = 1.0f - value*inputColor2[1]; + tmp = 1.0f - value * inputColor2[1]; if (tmp <= 0.0f) outputValue[1] = 1.0f; else { @@ -73,7 +73,7 @@ void MixDodgeOperation::executePixel(float *outputValue, float x, float y, Pixel outputValue[1] = 0.0f; if (inputColor1[2] != 0.0f) { - tmp = 1.0f - value*inputColor2[2]; + tmp = 1.0f - value * inputColor2[2]; if (tmp <= 0.0f) outputValue[2] = 1.0f; else { diff --git a/source/blender/compositor/operations/COM_MixGlareOperation.cpp b/source/blender/compositor/operations/COM_MixGlareOperation.cpp index 71b676622c5..bfb0efe692f 100644 --- a/source/blender/compositor/operations/COM_MixGlareOperation.cpp +++ b/source/blender/compositor/operations/COM_MixGlareOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixGlareOperation.h" -MixGlareOperation::MixGlareOperation(): MixBaseOperation() +MixGlareOperation::MixGlareOperation() : MixBaseOperation() { /* pass */ } @@ -38,10 +38,10 @@ void MixGlareOperation::executePixel(float *outputValue, float x, float y, Pixel inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers); inputColor2Operation->read(inputColor2, x, y, sampler, inputBuffers); value = inputValue[0]; - float mf = 2.f - 2.f*fabsf(value - 0.5f); + float mf = 2.f - 2.f * fabsf(value - 0.5f); - outputValue[0] = mf*((inputColor1[0])+value*(inputColor2[0]-inputColor1[0])); - outputValue[1] = mf*((inputColor1[1])+value*(inputColor2[1]-inputColor1[1])); - outputValue[2] = mf*((inputColor1[2])+value*(inputColor2[2]-inputColor1[2])); + outputValue[0] = mf * ((inputColor1[0]) + value * (inputColor2[0] - inputColor1[0])); + outputValue[1] = mf * ((inputColor1[1]) + value * (inputColor2[1] - inputColor1[1])); + outputValue[2] = mf * ((inputColor1[2]) + value * (inputColor2[2] - inputColor1[2])); outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixHueOperation.cpp b/source/blender/compositor/operations/COM_MixHueOperation.cpp index d97109c244c..05d02805ebc 100644 --- a/source/blender/compositor/operations/COM_MixHueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixHueOperation.cpp @@ -26,7 +26,7 @@ extern "C" { #include "BLI_math.h" } -MixHueOperation::MixHueOperation(): MixBaseOperation() +MixHueOperation::MixHueOperation() : MixBaseOperation() { /* pass */ } @@ -46,16 +46,16 @@ void MixHueOperation::executePixel(float *outputValue, float x, float y, PixelSa } float valuem = 1.0f - value; - float colH,colS,colV; + float colH, colS, colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); - if (colS!=0.0f) { - float rH,rS,rV; - float tmpr,tmpg,tmpb; + if (colS != 0.0f) { + float rH, rS, rV; + float tmpr, tmpg, tmpb; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); - hsv_to_rgb(colH , rS, rV, &tmpr, &tmpg, &tmpb); - outputValue[0] = valuem*(inputColor1[0]) + value*tmpr; - outputValue[1] = valuem*(inputColor1[1]) + value*tmpg; - outputValue[2] = valuem*(inputColor1[2]) + value*tmpb; + hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb); + outputValue[0] = valuem * (inputColor1[0]) + value * tmpr; + outputValue[1] = valuem * (inputColor1[1]) + value * tmpg; + outputValue[2] = valuem * (inputColor1[2]) + value * tmpb; } outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.cpp b/source/blender/compositor/operations/COM_MixLightenOperation.cpp index 09d81afcec7..6e1af7a3c44 100644 --- a/source/blender/compositor/operations/COM_MixLightenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLightenOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixLightenOperation.h" -MixLightenOperation::MixLightenOperation(): MixBaseOperation() +MixLightenOperation::MixLightenOperation() : MixBaseOperation() { /* pass */ } @@ -41,13 +41,13 @@ void MixLightenOperation::executePixel(float *outputValue, float x, float y, Pix value *= inputColor2[3]; } float tmp; - tmp=value * inputColor2[0]; + tmp = value * inputColor2[0]; if (tmp > inputColor1[0]) outputValue[0] = tmp; else outputValue[0] = inputColor1[0]; - tmp=value * inputColor2[1]; + tmp = value * inputColor2[1]; if (tmp > inputColor1[1]) outputValue[1] = tmp; else outputValue[1] = inputColor1[1]; - tmp=value * inputColor2[2]; + tmp = value * inputColor2[2]; if (tmp > inputColor1[2]) outputValue[2] = tmp; else outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp index 2e3907c15d4..bf1c181b566 100644 --- a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixLinearLightOperation.h" -MixLinearLightOperation::MixLinearLightOperation(): MixBaseOperation() +MixLinearLightOperation::MixLinearLightOperation() : MixBaseOperation() { /* pass */ } @@ -41,17 +41,17 @@ void MixLinearLightOperation::executePixel(float *outputValue, float x, float y, value *= inputColor2[3]; } if (inputColor2[0] > 0.5f) - outputValue[0] = inputColor1[0] + value*(2.0f*(inputColor2[0]-0.5f)); + outputValue[0] = inputColor1[0] + value * (2.0f * (inputColor2[0] - 0.5f)); else - outputValue[0] = inputColor1[0] + value*(2.0f*(inputColor2[0]) - 1.0f); + outputValue[0] = inputColor1[0] + value * (2.0f * (inputColor2[0]) - 1.0f); if (inputColor2[1] > 0.5f) - outputValue[1] = inputColor1[1] + value*(2.0f*(inputColor2[1]-0.5f)); + outputValue[1] = inputColor1[1] + value * (2.0f * (inputColor2[1] - 0.5f)); else - outputValue[1] = inputColor1[1] + value*(2.0f*(inputColor2[1]) - 1.0f); + outputValue[1] = inputColor1[1] + value * (2.0f * (inputColor2[1]) - 1.0f); if (inputColor2[2] > 0.5f) - outputValue[2] = inputColor1[2] + value*(2.0f*(inputColor2[2]-0.5f)); + outputValue[2] = inputColor1[2] + value * (2.0f * (inputColor2[2] - 0.5f)); else - outputValue[2] = inputColor1[2] + value*(2.0f*(inputColor2[2]) - 1.0f); + outputValue[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f); outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp b/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp index 223aa476f18..62018ed5698 100644 --- a/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp +++ b/source/blender/compositor/operations/COM_MixMultiplyOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixMultiplyOperation.h" -MixMultiplyOperation::MixMultiplyOperation(): MixBaseOperation() +MixMultiplyOperation::MixMultiplyOperation() : MixBaseOperation() { /* pass */ } @@ -42,9 +42,9 @@ void MixMultiplyOperation::executePixel(float *outputValue, float x, float y, Pi value *= inputColor2[3]; } float valuem = 1.0f - value; - outputValue[0] = inputColor1[0] *(valuem+value*inputColor2[0]); - outputValue[1] = inputColor1[1] *(valuem+value*inputColor2[1]); - outputValue[2] = inputColor1[2] *(valuem+value*inputColor2[2]); + outputValue[0] = inputColor1[0] * (valuem + value * inputColor2[0]); + outputValue[1] = inputColor1[1] * (valuem + value * inputColor2[1]); + outputValue[2] = inputColor1[2] * (valuem + value * inputColor2[2]); outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp index dfea8440b67..a269045c598 100644 --- a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixOverlayOperation.h" -MixOverlayOperation::MixOverlayOperation(): MixBaseOperation() +MixOverlayOperation::MixOverlayOperation() : MixBaseOperation() { /* pass */ } @@ -44,22 +44,22 @@ void MixOverlayOperation::executePixel(float *outputValue, float x, float y, Pix float valuem = 1.0f - value; if (inputColor1[0] < 0.5f) { - outputValue[0] = inputColor1[0] * (valuem + 2.0f*value*inputColor2[0]); + outputValue[0] = inputColor1[0] * (valuem + 2.0f * value * inputColor2[0]); } else { - outputValue[0] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[0])) * (1.0f - inputColor1[0]); + outputValue[0] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]); } if (inputColor1[1] < 0.5f) { - outputValue[1] = inputColor1[1] * (valuem + 2.0f*value*inputColor2[1]); + outputValue[1] = inputColor1[1] * (valuem + 2.0f * value * inputColor2[1]); } else { - outputValue[1] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[1])) * (1.0f - inputColor1[1]); + outputValue[1] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]); } if (inputColor1[2] < 0.5f) { - outputValue[2] = inputColor1[2] * (valuem + 2.0f*value*inputColor2[2]); + outputValue[2] = inputColor1[2] * (valuem + 2.0f * value * inputColor2[2]); } else { - outputValue[2] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[2])) * (1.0f - inputColor1[2]); + outputValue[2] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]); } outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp index 25342abec8a..863a17a7f80 100644 --- a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp @@ -26,7 +26,7 @@ extern "C" { #include "BLI_math.h" } -MixSaturationOperation::MixSaturationOperation(): MixBaseOperation() +MixSaturationOperation::MixSaturationOperation() : MixBaseOperation() { /* pass */ } @@ -46,12 +46,12 @@ void MixSaturationOperation::executePixel(float *outputValue, float x, float y, } float valuem = 1.0f - value; - float rH,rS,rV; + float rH, rS, rV; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); - if (rS!=0.0f) { - float colH,colS,colV; + if (rS != 0.0f) { + float colH, colS, colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); - hsv_to_rgb(rH , (valuem*rS+value*colS), rV, &outputValue[0], &outputValue[1], &outputValue[2]); + hsv_to_rgb(rH, (valuem * rS + value * colS), rV, &outputValue[0], &outputValue[1], &outputValue[2]); } outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixScreenOperation.cpp b/source/blender/compositor/operations/COM_MixScreenOperation.cpp index 8b9916165e2..6fb7befeba4 100644 --- a/source/blender/compositor/operations/COM_MixScreenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixScreenOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixScreenOperation.h" -MixScreenOperation::MixScreenOperation(): MixBaseOperation() +MixScreenOperation::MixScreenOperation() : MixBaseOperation() { /* pass */ } @@ -43,9 +43,9 @@ void MixScreenOperation::executePixel(float *outputValue, float x, float y, Pixe } float valuem = 1.0f - value; - outputValue[0] = 1.0f - (valuem + value*(1.0f-inputColor2[0])) *(1.0f-inputColor1[0]); - outputValue[1] = 1.0f - (valuem + value*(1.0f-inputColor2[1])) *(1.0f-inputColor1[1]); - outputValue[2] = 1.0f - (valuem + value*(1.0f-inputColor2[2])) *(1.0f-inputColor1[2]); + outputValue[0] = 1.0f - (valuem + value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]); + outputValue[1] = 1.0f - (valuem + value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]); + outputValue[2] = 1.0f - (valuem + value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]); outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp index a4882b7b83b..9f7d0823473 100644 --- a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp @@ -22,13 +22,13 @@ #include "COM_MixSoftLightOperation.h" -MixSoftLightOperation::MixSoftLightOperation(): MixBaseOperation() +MixSoftLightOperation::MixSoftLightOperation() : MixBaseOperation() { /* pass */ } -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; @@ -48,9 +48,9 @@ void MixSoftLightOperation::executePixel(float *outputValue, float x, float y, P scg = 1.0f - (1.0f - inputColor2[1]) * (1.0f - inputColor1[1]); scb = 1.0f - (1.0f - inputColor2[2]) * (1.0f - inputColor1[2]); - outputValue[0] = valuem*(inputColor1[0]) + value*(((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) + (inputColor1[0] * scr)); - outputValue[1] = valuem*(inputColor1[1]) + value*(((1.0f - inputColor1[1]) * inputColor2[1] * (inputColor1[1])) + (inputColor1[1] * scg)); - outputValue[2] = valuem*(inputColor1[2]) + value*(((1.0f - inputColor1[2]) * inputColor2[2] * (inputColor1[2])) + (inputColor1[2] * scb)); + outputValue[0] = valuem * (inputColor1[0]) + value * (((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) + (inputColor1[0] * scr)); + outputValue[1] = valuem * (inputColor1[1]) + value * (((1.0f - inputColor1[1]) * inputColor2[1] * (inputColor1[1])) + (inputColor1[1] * scg)); + outputValue[2] = valuem * (inputColor1[2]) + value * (((1.0f - inputColor1[2]) * inputColor2[2] * (inputColor1[2])) + (inputColor1[2] * scb)); outputValue[3] = inputColor1[3]; -} + } diff --git a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp index d7c7da688a3..80086053872 100644 --- a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp @@ -22,7 +22,7 @@ #include "COM_MixSubtractOperation.h" -MixSubtractOperation::MixSubtractOperation(): MixBaseOperation() +MixSubtractOperation::MixSubtractOperation() : MixBaseOperation() { /* pass */ } @@ -40,9 +40,9 @@ void MixSubtractOperation::executePixel(float *outputValue, float x, float y, Pi if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } - outputValue[0] = inputColor1[0]-value*(inputColor2[0]); - outputValue[1] = inputColor1[1]-value*(inputColor2[1]); - outputValue[2] = inputColor1[2]-value*(inputColor2[2]); + outputValue[0] = inputColor1[0] - value * (inputColor2[0]); + outputValue[1] = inputColor1[1] - value * (inputColor2[1]); + outputValue[2] = inputColor1[2] - value * (inputColor2[2]); outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixValueOperation.cpp b/source/blender/compositor/operations/COM_MixValueOperation.cpp index f680692f529..cd79c54318d 100644 --- a/source/blender/compositor/operations/COM_MixValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixValueOperation.cpp @@ -26,7 +26,7 @@ extern "C" { #include "BLI_math.h" } -MixValueOperation::MixValueOperation(): MixBaseOperation() +MixValueOperation::MixValueOperation() : MixBaseOperation() { /* pass */ } @@ -46,10 +46,10 @@ void MixValueOperation::executePixel(float *outputValue, float x, float y, Pixel } float valuem = 1.0f - value; - float rH,rS,rV; - float colH,colS,colV; + float rH, rS, rV; + float colH, colS, colV; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); - hsv_to_rgb(rH , rS, (valuem*rV+value*colV), &outputValue[0], &outputValue[1], &outputValue[2]); + hsv_to_rgb(rH, rS, (valuem * rV + value * colV), &outputValue[0], &outputValue[1], &outputValue[2]); outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp index d9f9801e2e1..662212567de 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp @@ -25,7 +25,7 @@ extern "C" { #include "BKE_tracking.h" #include "BKE_movieclip.h" } -MovieClipAttributeOperation::MovieClipAttributeOperation(): NodeOperation() +MovieClipAttributeOperation::MovieClipAttributeOperation() : NodeOperation() { this->addOutputSocket(COM_DT_VALUE); this->valueSet = false; @@ -46,18 +46,18 @@ void MovieClipAttributeOperation::executePixel(float *outputValue, float x, floa BKE_tracking_stabilization_data_get(&clip->tracking, clip_framenr, getWidth(), getHeight(), loc, &scale, &angle); } switch (this->attribute) { - case MCA_SCALE: - this->value = scale; - break; - case MCA_ANGLE: - this->value = angle; - break; - case MCA_X: - this->value = loc[0]; - break; - case MCA_Y: - this->value = loc[1]; - break; + case MCA_SCALE: + this->value = scale; + break; + case MCA_ANGLE: + this->value = angle; + break; + case MCA_X: + this->value = loc[0]; + break; + case MCA_Y: + this->value = loc[1]; + break; } valueSet = true; } diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp index 6019ab879be..b8bda12c626 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp @@ -31,7 +31,7 @@ extern "C" { } #include "BKE_image.h" -MovieClipOperation::MovieClipOperation(): NodeOperation() +MovieClipOperation::MovieClipOperation() : NodeOperation() { this->addOutputSocket(COM_DT_COLOR); this->movieClip = NULL; @@ -51,9 +51,9 @@ void MovieClipOperation::initExecution() ibuf = BKE_movieclip_get_ibuf(this->movieClip, this->movieClipUser); if (ibuf) { this->movieClipBuffer = ibuf; - if (ibuf->rect_float == NULL || ibuf->userflags&IB_RECT_INVALID) { + if (ibuf->rect_float == NULL || ibuf->userflags & IB_RECT_INVALID) { IMB_float_from_rect(ibuf); - ibuf->userflags&= ~IB_RECT_INVALID; + ibuf->userflags &= ~IB_RECT_INVALID; } } } @@ -93,15 +93,15 @@ void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampl } else { switch (sampler) { - case COM_PS_NEAREST: - neareast_interpolation_color(this->movieClipBuffer, NULL, color, x, y); - break; - case COM_PS_BILINEAR: - bilinear_interpolation_color(this->movieClipBuffer, NULL, color, x, y); - break; - case COM_PS_BICUBIC: - bicubic_interpolation_color(this->movieClipBuffer, NULL, color, x, y); - break; + case COM_PS_NEAREST: + neareast_interpolation_color(this->movieClipBuffer, NULL, color, x, y); + break; + case COM_PS_BILINEAR: + bilinear_interpolation_color(this->movieClipBuffer, NULL, color, x, y); + break; + case COM_PS_BICUBIC: + bicubic_interpolation_color(this->movieClipBuffer, NULL, color, x, y); + break; } } } diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp index d9e8977871f..5320f901747 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp @@ -29,7 +29,7 @@ extern "C" { } -vector s_cache; +vector s_cache; MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperation() @@ -52,8 +52,8 @@ void MovieDistortionOperation::initExecution() BKE_movieclip_user_set_frame(&clipUser, this->framenumber); BKE_movieclip_get_size(this->movieClip, &clipUser, &calibration_width, &calibration_height); - for (unsigned int i = 0 ; i < s_cache.size() ; i ++) { - DistortionCache *c = (DistortionCache*)s_cache[i]; + for (unsigned int i = 0; i < s_cache.size(); i++) { + DistortionCache *c = (DistortionCache *)s_cache[i]; if (c->isCacheFor(this->movieClip, this->width, this->height, calibration_width, calibration_height, this->distortion)) { @@ -78,7 +78,7 @@ void MovieDistortionOperation::deinitExecution() } -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) { diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp index 5e81cd639dd..1bd21f6e712 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp @@ -27,7 +27,7 @@ extern "C" { #include "IMB_imbuf_types.h" } -MultilayerBaseOperation::MultilayerBaseOperation(int pass): BaseImageOperation() +MultilayerBaseOperation::MultilayerBaseOperation(int pass) : BaseImageOperation() { this->passId = pass; } @@ -56,22 +56,22 @@ void MultilayerColorOperation::executePixel(float *color, float x, float y, Pixe else { if (this->numberOfChannels == 4) { switch (sampler) { - case COM_PS_NEAREST: - neareast_interpolation_color(this->buffer, NULL, color, x, y); - break; - case COM_PS_BILINEAR: - bilinear_interpolation_color(this->buffer, NULL, color, x, y); - break; - case COM_PS_BICUBIC: - bicubic_interpolation_color(this->buffer, NULL, color, x, y); - break; + case COM_PS_NEAREST: + neareast_interpolation_color(this->buffer, NULL, color, x, y); + break; + case COM_PS_BILINEAR: + bilinear_interpolation_color(this->buffer, NULL, color, x, y); + break; + case COM_PS_BICUBIC: + bicubic_interpolation_color(this->buffer, NULL, color, x, y); + break; } } else { - int offset = (yi*this->getWidth()+xi)*3; + int offset = (yi * this->getWidth() + xi) * 3; color[0] = this->imageBuffer[offset]; - color[1] = this->imageBuffer[offset+1]; - color[2] = this->imageBuffer[offset+2]; + color[1] = this->imageBuffer[offset + 1]; + color[2] = this->imageBuffer[offset + 2]; } } } @@ -84,7 +84,7 @@ void MultilayerValueOperation::executePixel(float *color, float x, float y, Pixe color[0] = 0.0f; } else { - float result = this->imageBuffer[yi*this->getWidth()+xi]; + float result = this->imageBuffer[yi * this->getWidth() + xi]; color[0] = result; } } @@ -97,9 +97,9 @@ void MultilayerVectorOperation::executePixel(float *color, float x, float y, Pix color[0] = 0.0f; } else { - int offset = (yi*this->getWidth()+xi)*3; + int offset = (yi * this->getWidth() + xi) * 3; color[0] = this->imageBuffer[offset]; - color[1] = this->imageBuffer[offset+1]; - color[2] = this->imageBuffer[offset+2]; + color[1] = this->imageBuffer[offset + 1]; + color[2] = this->imageBuffer[offset + 2]; } } diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp index df382547f13..6d12141a455 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp +++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp @@ -21,7 +21,7 @@ #include "COM_NormalizeOperation.h" -NormalizeOperation::NormalizeOperation(): NodeOperation() +NormalizeOperation::NormalizeOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); @@ -35,7 +35,7 @@ void NormalizeOperation::initExecution() 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; @@ -78,7 +78,7 @@ void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu { lockMutex(); 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(); @@ -86,20 +86,20 @@ void *NormalizeOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu int p = tile->getWidth() * tile->getHeight(); float *bc = buffer; - float minv = 1.0f+BLENDER_ZMAX; - float maxv = -1.0f-BLENDER_ZMAX; + float minv = 1.0f + BLENDER_ZMAX; + float maxv = -1.0f - BLENDER_ZMAX; float value; while (p--) { - value=bc[0]; + value = bc[0]; maxv = max(value, maxv); minv = min(value, minv); - bc+=4; + bc += 4; } minmult->x = minv; /* The rare case of flat buffer would cause a divide by 0 */ - minmult->y = ((maxv!=minv)? 1.0f/(maxv-minv):0.f); + minmult->y = ((maxv != minv) ? 1.0f / (maxv - minv) : 0.f); this->cachedInstance = minmult; } diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index 1438116f313..e71178a811d 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -41,10 +41,10 @@ extern "C" { static int get_datatype_size(DataType datatype) { switch (datatype) { - case COM_DT_VALUE: return 1; - case COM_DT_VECTOR: return 3; - case COM_DT_COLOR: return 4; - default: return 0; + case COM_DT_VALUE: return 1; + case COM_DT_VECTOR: return 3; + case COM_DT_COLOR: return 4; + default: return 0; } } @@ -53,13 +53,13 @@ static float *init_buffer(unsigned int width, unsigned int height, DataType data // 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); - return (float *)MEM_callocN(width*height*size*sizeof(float), "OutputFile buffer"); + return (float *)MEM_callocN(width * height * size * sizeof(float), "OutputFile buffer"); } else return NULL; } -static void write_buffer_rect(rcti *rect, MemoryBuffer** memoryBuffers, const bNodeTree *tree, +static void write_buffer_rect(rcti *rect, MemoryBuffer **memoryBuffers, const bNodeTree *tree, SocketReader *reader, float *buffer, unsigned int width, DataType datatype) { float color[4]; @@ -70,29 +70,29 @@ static void write_buffer_rect(rcti *rect, MemoryBuffer** memoryBuffers, const bN int y1 = rect->ymin; int x2 = rect->xmax; int y2 = rect->ymax; - int offset = (y1*width + x1 ) * size; + int offset = (y1 * width + x1) * size; int x; int y; bool breaked = false; - for (y = y1 ; y < y2 && (!breaked); y++) { - for (x = x1 ; x < x2 && (!breaked) ; x++) { + for (y = y1; y < y2 && (!breaked); y++) { + for (x = x1; x < x2 && (!breaked); x++) { reader->read(color, x, y, COM_PS_NEAREST, memoryBuffers); - for (i=0; i < size; ++i) - buffer[offset+i] = color[i]; + for (i = 0; i < size; ++i) + buffer[offset + i] = color[i]; offset += size; if (tree->test_break && tree->test_break(tree->tbh)) breaked = true; } - offset += (width-(x2-x1)) * size; + offset += (width - (x2 - x1)) * size; } } OutputSingleLayerOperation::OutputSingleLayerOperation( - const Scene *scene, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path) + const Scene *scene, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path) { this->scene = scene; this->tree = tree; @@ -113,7 +113,7 @@ void OutputSingleLayerOperation::initExecution() 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); } @@ -123,7 +123,7 @@ 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); + ImBuf *ibuf = IMB_allocImBuf(this->getWidth(), this->getHeight(), size * 8, 0); Main *bmain = G.main; /* TODO, have this passed along */ char filename[FILE_MAX]; @@ -160,7 +160,7 @@ OutputOpenExrLayer::OutputOpenExrLayer(const char *name, DataType datatype) } OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation( - const Scene *scene, const bNodeTree *tree, const char *path, char exr_codec) + const Scene *scene, const bNodeTree *tree, const char *path, char exr_codec) { this->scene = scene; this->tree = tree; @@ -177,15 +177,15 @@ void OutputOpenExrMultiLayerOperation::add_layer(const char *name, DataType data void OutputOpenExrMultiLayerOperation::initExecution() { - for (unsigned int i=0; i < layers.size(); ++i) { + for (unsigned int i = 0; i < layers.size(); ++i) { layers[i].imageInput = getInputSocketReader(i); layers[i].outputBuffer = init_buffer(this->getWidth(), this->getHeight(), layers[i].datatype); } } -void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) +void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers) { - for (unsigned int i=0; i < layers.size(); ++i) { + for (unsigned int i = 0; i < layers.size(); ++i) { write_buffer_rect(rect, memoryBuffers, this->tree, layers[i].imageInput, layers[i].outputBuffer, this->getWidth(), layers[i].datatype); } } @@ -203,39 +203,39 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() (this->scene->r.scemode & R_EXTENSION), true); BLI_make_existing_file(filename); - for (unsigned int i=0; i < layers.size(); ++i) { + for (unsigned int i = 0; i < layers.size(); ++i) { char channelname[EXR_TOT_MAXNAME]; - BLI_strncpy(channelname, layers[i].name, sizeof(channelname)-2); + BLI_strncpy(channelname, layers[i].name, sizeof(channelname) - 2); char *channelname_ext = channelname + strlen(channelname); float *buf = layers[i].outputBuffer; /* create channels */ switch (layers[i].datatype) { - case COM_DT_VALUE: - strcpy(channelname_ext, ".V"); - IMB_exr_add_channel(exrhandle, 0, channelname, 1, width, buf); - break; - case COM_DT_VECTOR: - strcpy(channelname_ext, ".X"); - IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3*width, buf); - strcpy(channelname_ext, ".Y"); - IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3*width, buf+1); - strcpy(channelname_ext, ".Z"); - IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3*width, buf+2); - break; - case COM_DT_COLOR: - strcpy(channelname_ext, ".R"); - IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4*width, buf); - strcpy(channelname_ext, ".G"); - IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4*width, buf+1); - strcpy(channelname_ext, ".B"); - IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4*width, buf+2); - strcpy(channelname_ext, ".A"); - IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4*width, buf+3); - break; - default: - break; + case COM_DT_VALUE: + strcpy(channelname_ext, ".V"); + IMB_exr_add_channel(exrhandle, 0, channelname, 1, width, buf); + break; + case COM_DT_VECTOR: + strcpy(channelname_ext, ".X"); + IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3 * width, buf); + strcpy(channelname_ext, ".Y"); + IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3 * width, buf + 1); + strcpy(channelname_ext, ".Z"); + IMB_exr_add_channel(exrhandle, 0, channelname, 3, 3 * width, buf + 2); + break; + case COM_DT_COLOR: + strcpy(channelname_ext, ".R"); + IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4 * width, buf); + strcpy(channelname_ext, ".G"); + IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4 * width, buf + 1); + strcpy(channelname_ext, ".B"); + IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4 * width, buf + 2); + strcpy(channelname_ext, ".A"); + IMB_exr_add_channel(exrhandle, 0, channelname, 4, 4 * width, buf + 3); + break; + default: + break; } } @@ -251,7 +251,7 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() } IMB_exr_close(exrhandle); - for (unsigned int i=0; i < layers.size(); ++i) { + for (unsigned int i = 0; i < layers.size(); ++i) { if (layers[i].outputBuffer) { MEM_freeN(layers[i].outputBuffer); layers[i].outputBuffer = NULL; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp index 4975f13a285..54a95af33b9 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cpp +++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp @@ -52,7 +52,7 @@ void PreviewOperation::initExecution() { this->input = getInputSocketReader(0); if (!this->node->preview) { - this->node->preview = (bNodePreview*)MEM_callocN(sizeof(bNodePreview), "node preview"); + this->node->preview = (bNodePreview *)MEM_callocN(sizeof(bNodePreview), "node preview"); } else { if (this->getWidth() == (unsigned int)this->node->preview->xsize && this->getHeight() == (unsigned int)this->node->preview->ysize) { @@ -61,9 +61,9 @@ void PreviewOperation::initExecution() } if (this->outputBuffer == NULL) { - this->outputBuffer = (unsigned char*)MEM_callocN(sizeof(unsigned char)*4*getWidth()*getHeight(), "PreviewOperation"); + this->outputBuffer = (unsigned char *)MEM_callocN(sizeof(unsigned char) * 4 * getWidth() * getHeight(), "PreviewOperation"); if (this->node->preview->rect) { - MEM_freeN(this->node->preview->rect); + MEM_freeN(this->node->preview->rect); } this->node->preview->xsize = getWidth(); this->node->preview->ysize = getHeight(); @@ -81,11 +81,11 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, Memory { int offset; float color[4]; - for (int y = rect->ymin ; y < rect->ymax ; y++) { - offset = (y * getWidth() + rect->xmin)*4; - for (int x = rect->xmin ; x < rect->xmax ; x++) { - float rx = floor(x/divider); - float ry = floor(y/divider); + for (int y = rect->ymin; y < rect->ymax; y++) { + offset = (y * getWidth() + rect->xmin) * 4; + for (int x = rect->xmin; x < rect->xmax; x++) { + float rx = floor(x / divider); + float ry = floor(y / divider); color[0] = 0.0f; color[1] = 0.0f; @@ -93,8 +93,8 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, Memory color[3] = 1.0f; input->read(color, rx, ry, COM_PS_NEAREST, memoryBuffers); linearrgb_to_srgb_v4(color, color); - F4TOCHAR4(color, outputBuffer+offset); - offset +=4; + F4TOCHAR4(color, outputBuffer + offset); + offset += 4; } } } @@ -102,10 +102,10 @@ bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferO { rcti newInput; - newInput.xmin = input->xmin/divider; - newInput.xmax = input->xmax/divider; - newInput.ymin = input->ymin/divider; - newInput.ymax = input->ymax/divider; + newInput.xmin = input->xmin / divider; + newInput.xmax = input->xmax / divider; + newInput.ymin = input->ymin / divider; + newInput.ymax = input->ymax / divider; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } @@ -116,10 +116,10 @@ void PreviewOperation::determineResolution(unsigned int resolution[], unsigned i int height = resolution[1]; this->divider = 0.0f; if (width > height) { - divider = COM_PREVIEW_SIZE / (width-1); + divider = COM_PREVIEW_SIZE / (width - 1); } else { - divider = COM_PREVIEW_SIZE / (height-1); + divider = COM_PREVIEW_SIZE / (height - 1); } width = width * divider; height = height * divider; diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp index 7695e0f63c2..77f2a06b29b 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp @@ -24,7 +24,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -ProjectorLensDistortionOperation::ProjectorLensDistortionOperation(): NodeOperation() +ProjectorLensDistortionOperation::ProjectorLensDistortionOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -34,7 +34,7 @@ ProjectorLensDistortionOperation::ProjectorLensDistortionOperation(): NodeOperat void ProjectorLensDistortionOperation::initExecution() { this->inputProgram = this->getInputSocketReader(0); - kr = 0.25f*MAX2(MIN2(this->dispersion, 1.f), 0.f); + kr = 0.25f * MAX2(MIN2(this->dispersion, 1.f), 0.f); kr2 = kr * 20; } @@ -49,14 +49,14 @@ void ProjectorLensDistortionOperation::executePixel(float *color, int x, int y, float inputValue[4]; const float height = this->getHeight(); const float width = this->getWidth(); - const float v = (y + 0.5f)/height; - const float u = (x + 0.5f)/width; - MemoryBuffer * inputBuffer = (MemoryBuffer*)data; - inputBuffer->readCubic(inputValue, (u*width + kr2) - 0.5f, v*height - 0.5f); + const float v = (y + 0.5f) / height; + const float u = (x + 0.5f) / width; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; + inputBuffer->readCubic(inputValue, (u * width + kr2) - 0.5f, v * height - 0.5f); color[0] = inputValue[0]; inputBuffer->read(inputValue, x, y); color[1] = inputValue[1]; - inputBuffer->readCubic(inputValue, (u*width - kr2) - 0.5f, v*height - 0.5f); + inputBuffer->readCubic(inputValue, (u * width - kr2) - 0.5f, v * height - 0.5f); color[2] = inputValue[2]; color[3] = 1.0f; } @@ -71,7 +71,7 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *in rcti newInput; newInput.ymax = input->ymax; newInput.ymin = input->ymin; - newInput.xmin = input->xmin-kr2-2; - newInput.xmax = input->xmax+kr2+2; + newInput.xmin = input->xmin - kr2 - 2; + newInput.xmax = input->xmax + kr2 + 2; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.cpp b/source/blender/compositor/operations/COM_QualityStepHelper.cpp index f2d700292a4..18b3b106138 100644 --- a/source/blender/compositor/operations/COM_QualityStepHelper.cpp +++ b/source/blender/compositor/operations/COM_QualityStepHelper.cpp @@ -32,40 +32,40 @@ QualityStepHelper::QualityStepHelper() void QualityStepHelper::initExecution(QualityHelper helper) { switch (helper) { - case COM_QH_INCREASE: - switch (this->quality) { - case COM_QUALITY_HIGH: - default: - this->step = 1; - this->offsetadd = 4; + case COM_QH_INCREASE: + switch (this->quality) { + case COM_QUALITY_HIGH: + default: + this->step = 1; + this->offsetadd = 4; + break; + case COM_QUALITY_MEDIUM: + this->step = 2; + this->offsetadd = 8; + break; + case COM_QUALITY_LOW: + this->step = 3; + this->offsetadd = 12; + break; + } break; - case COM_QUALITY_MEDIUM: - this->step = 2; - this->offsetadd = 8; + case COM_QH_MULTIPLY: + switch (this->quality) { + case COM_QUALITY_HIGH: + default: + this->step = 1; + this->offsetadd = 4; + break; + case COM_QUALITY_MEDIUM: + this->step = 2; + this->offsetadd = 8; + break; + case COM_QUALITY_LOW: + this->step = 4; + this->offsetadd = 16; + break; + } break; - case COM_QUALITY_LOW: - this->step = 3; - this->offsetadd = 12; - break; - } - break; - case COM_QH_MULTIPLY: - switch (this->quality) { - case COM_QUALITY_HIGH: - default: - this->step = 1; - this->offsetadd = 4; - break; - case COM_QUALITY_MEDIUM: - this->step = 2; - this->offsetadd = 8; - break; - case COM_QUALITY_LOW: - this->step = 4; - this->offsetadd = 16; - break; - } - break; } } diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp index 14b6db9037b..fa1f0280207 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp @@ -24,7 +24,7 @@ #include "COM_WriteBufferOperation.h" #include "COM_defines.h" -ReadBufferOperation::ReadBufferOperation():NodeOperation() +ReadBufferOperation::ReadBufferOperation() : NodeOperation() { this->addOutputSocket(COM_DT_COLOR); this->offset = 0; @@ -38,7 +38,7 @@ void *ReadBufferOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryB void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { if (this->memoryProxy != NULL) { - WriteBufferOperation * operation = memoryProxy->getWriteBufferOperation(); + WriteBufferOperation *operation = memoryProxy->getWriteBufferOperation(); operation->determineResolution(resolution, preferredResolution); operation->setResolution(resolution); @@ -67,9 +67,9 @@ void ReadBufferOperation::executePixel(float *color, float x, float y, float dx, } } -bool ReadBufferOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output) +bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { - if (this==readOperation) { + if (this == readOperation) { BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax); return true; } @@ -78,7 +78,7 @@ bool ReadBufferOperation::determineDependingAreaOfInterest(rcti * input, ReadBuf void ReadBufferOperation::readResolutionFromWriteBuffer() { if (this->memoryProxy != NULL) { - WriteBufferOperation * operation = memoryProxy->getWriteBufferOperation(); + WriteBufferOperation *operation = memoryProxy->getWriteBufferOperation(); this->setWidth(operation->getWidth()); this->setHeight(operation->getHeight()); } diff --git a/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp index dad082cf0ca..bb165c2fe1c 100644 --- a/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersAOOperation.cpp @@ -22,7 +22,7 @@ #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 ccb7dd91c04..35f787cb59f 100644 --- a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp @@ -22,7 +22,7 @@ #include "COM_RenderLayersAlphaProg.h" -RenderLayersAlphaProg::RenderLayersAlphaProg() :RenderLayersBaseProg(SCE_PASS_COMBINED, 4) +RenderLayersAlphaProg::RenderLayersAlphaProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4) { this->addOutputSocket(COM_DT_VALUE); } @@ -31,7 +31,7 @@ void RenderLayersAlphaProg::executePixel(float *output, float x, float y, PixelS { int ix = x; int iy = y; - float * inputBuffer = this->getInputBuffer(); + float *inputBuffer = this->getInputBuffer(); if (inputBuffer == NULL || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || iy >= (int)this->getHeight() ) { output[0] = 0.0f; @@ -40,8 +40,8 @@ void RenderLayersAlphaProg::executePixel(float *output, float x, float y, PixelS output[3] = 0.0f; } else { - unsigned int offset = (iy*this->getWidth()+ix) * 4; - output[0] = inputBuffer[offset+3]; + unsigned int offset = (iy * this->getWidth() + ix) * 4; + output[0] = inputBuffer[offset + 3]; output[1] = 0.0f; output[2] = 0.0f; output[3] = 0.0f; diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp index 35c8753ded6..f27af3c25f5 100644 --- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp @@ -31,7 +31,7 @@ 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); @@ -42,15 +42,15 @@ RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize): Nod void RenderLayersBaseProg::initExecution() { - Scene * scene = this->getScene(); - Render *re = (scene)? RE_GetRender(scene->id.name): NULL; + Scene *scene = this->getScene(); + Render *re = (scene) ? RE_GetRender(scene->id.name) : NULL; RenderResult *rr = NULL; if (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); @@ -81,7 +81,7 @@ void RenderLayersBaseProg::executePixel(float *output, float x, float y, PixelSa output[3] = 0.0f; } else { - unsigned int offset = (iy*this->getWidth()+ix) * elementsize; + unsigned int offset = (iy * this->getWidth() + ix) * elementsize; if (elementsize == 1) { output[0] = inputBuffer[offset]; output[1] = 0.0f; @@ -90,15 +90,15 @@ void RenderLayersBaseProg::executePixel(float *output, float x, float y, PixelSa } else if (elementsize == 3) { output[0] = inputBuffer[offset]; - output[1] = inputBuffer[offset+1]; - output[2] = inputBuffer[offset+2]; + output[1] = inputBuffer[offset + 1]; + output[2] = inputBuffer[offset + 2]; output[3] = 1.0f; } else { output[0] = inputBuffer[offset]; - output[1] = inputBuffer[offset+1]; - output[2] = inputBuffer[offset+2]; - output[3] = inputBuffer[offset+3]; + output[1] = inputBuffer[offset + 1]; + output[2] = inputBuffer[offset + 2]; + output[3] = inputBuffer[offset + 3]; } } } @@ -121,12 +121,12 @@ void RenderLayersBaseProg::determineResolution(unsigned int resolution[], unsign 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; + resolution[0] = rl->rectx; + resolution[1] = rl->recty; } } } diff --git a/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp b/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp index aee68afe55d..3083c37c2bb 100644 --- a/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersColorOperation.cpp @@ -22,7 +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 fc1df884181..b056896994e 100644 --- a/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersCyclesOperation.cpp @@ -22,7 +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 985b1c1bee8..ae5fc3b2254 100644 --- a/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersDepthProg.cpp @@ -22,7 +22,7 @@ #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 ad73490b92d..6baa25e5600 100644 --- a/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersDiffuseOperation.cpp @@ -22,7 +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 7537e2d10fc..1b03a4e169f 100644 --- a/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersEmitOperation.cpp @@ -22,7 +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 0ace9a7c58f..f4d6dc7353b 100644 --- a/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersEnvironmentOperation.cpp @@ -22,7 +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 264e2f0fd79..14c3d652c42 100644 --- a/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp @@ -22,7 +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 645f9768eb2..4258cb94a26 100644 --- a/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersIndirectOperation.cpp @@ -22,7 +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 e5cef7753f2..aab7e0089e4 100644 --- a/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersMaterialIndexOperation.cpp @@ -22,7 +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 fae6c73f747..c64ddc6e9d8 100644 --- a/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersMistOperation.cpp @@ -22,7 +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 67ea4d68204..9d8e7d6272c 100644 --- a/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersNormalOperation.cpp @@ -22,7 +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 821ff447112..430ea698263 100644 --- a/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersObjectIndexOperation.cpp @@ -22,7 +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 e53144d3501..1fbd599235b 100644 --- a/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersReflectionOperation.cpp @@ -22,7 +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 6e333175220..2ec9be46059 100644 --- a/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersRefractionOperation.cpp @@ -22,7 +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 ce492d54a79..7582e010e2c 100644 --- a/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersShadowOperation.cpp @@ -22,7 +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 7b7d223680c..60c1636dcda 100644 --- a/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersSpecularOperation.cpp @@ -22,7 +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 213d044a9bd..5a0662d13eb 100644 --- a/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersSpeedOperation.cpp @@ -22,7 +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 e3917d7796b..b966f98632c 100644 --- a/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersUVOperation.cpp @@ -22,7 +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 a391a26b89c..ac06048faf3 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -38,8 +38,8 @@ void RotateOperation::initExecution() { this->imageSocket = this->getInputSocketReader(0); this->degreeSocket = this->getInputSocketReader(1); - this->centerX = this->getWidth()/2.0; - this->centerY = this->getHeight()/2.0; + this->centerX = this->getWidth() / 2.0; + this->centerY = this->getHeight() / 2.0; } void RotateOperation::deinitExecution() @@ -54,10 +54,10 @@ inline void RotateOperation::ensureDegree() { this->degreeSocket->read(degree, 0, 0, COM_PS_NEAREST, NULL); double rad; if (this->doDegree2RadConversion) { - rad = DEG2RAD((double)degree[0]); + rad = DEG2RAD((double)degree[0]); } else { - rad = degree[0]; + rad = degree[0]; } this->cosine = cos(rad); this->sine = sin(rad); @@ -67,13 +67,13 @@ inline void RotateOperation::ensureDegree() { } -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[]) { ensureDegree(); const float dy = y - this->centerY; const float dx = x - this->centerX; - const float nx = this->centerX+(this->cosine*dx + this->sine*dy); - const float ny = this->centerY+(-this->sine*dx + this->cosine*dy); + const float nx = this->centerX + (this->cosine * dx + this->sine * dy); + const float ny = this->centerY + (-this->sine * dx + this->cosine * dy); this->imageSocket->read(color, nx, ny, sampler, inputBuffers); } @@ -87,23 +87,23 @@ bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOp const float dxmax = input->xmax - this->centerX; const float dymax = input->ymax - this->centerY; - const float x1 = this->centerX+(this->cosine*dxmin + this->sine*dymin); - const float x2 = this->centerX+(this->cosine*dxmax + this->sine*dymin); - const float x3 = this->centerX+(this->cosine*dxmin + this->sine*dymax); - const float x4 = this->centerX+(this->cosine*dxmax + this->sine*dymax); - const float y1 = this->centerY+(-this->sine*dxmin + this->cosine*dymin); - const float y2 = this->centerY+(-this->sine*dxmax + this->cosine*dymin); - const float y3 = this->centerY+(-this->sine*dxmin + this->cosine*dymax); - const float y4 = this->centerY+(-this->sine*dxmax + this->cosine*dymax); + const float x1 = this->centerX + (this->cosine * dxmin + this->sine * dymin); + const float x2 = this->centerX + (this->cosine * dxmax + this->sine * dymin); + const float x3 = this->centerX + (this->cosine * dxmin + this->sine * dymax); + const float x4 = this->centerX + (this->cosine * dxmax + this->sine * dymax); + const float y1 = this->centerY + (-this->sine * dxmin + this->cosine * dymin); + const float y2 = this->centerY + (-this->sine * dxmax + this->cosine * dymin); + const float y3 = this->centerY + (-this->sine * dxmin + this->cosine * dymax); + const float y4 = this->centerY + (-this->sine * dxmax + this->cosine * dymax); const float minx = min(x1, min(x2, min(x3, x4))); const float maxx = max(x1, max(x2, max(x3, x4))); const float miny = min(y1, min(y2, min(y3, y4))); const float maxy = max(y1, max(y2, max(y3, y4))); - newInput.xmax = ceil(maxx)+1; - newInput.xmin = floor(minx)-1; - newInput.ymax = ceil(maxy)+1; - newInput.ymin = floor(miny)-1; + newInput.xmax = ceil(maxx) + 1; + newInput.xmin = floor(minx) - 1; + newInput.ymax = ceil(maxy) + 1; + newInput.ymin = floor(miny) - 1; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp index 4442fd9075e..3299434a02e 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp @@ -27,7 +27,7 @@ extern "C" { #include "BLI_rand.h" } -ScreenLensDistortionOperation::ScreenLensDistortionOperation(): NodeOperation() +ScreenLensDistortionOperation::ScreenLensDistortionOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); @@ -39,19 +39,19 @@ void ScreenLensDistortionOperation::initExecution() this->inputProgram = this->getInputSocketReader(0); kg = MAX2(MIN2(this->distortion, 1.f), -0.999f); // smaller dispersion range for somewhat more control - const float d = 0.25f*MAX2(MIN2(this->dispersion, 1.f), 0.f); - kr = MAX2(MIN2((kg+d), 1.f), -0.999f); - kb = MAX2(MIN2((kg-d), 1.f), -0.999f); + const float d = 0.25f * MAX2(MIN2(this->dispersion, 1.f), 0.f); + kr = MAX2(MIN2((kg + d), 1.f), -0.999f); + kb = MAX2(MIN2((kg - d), 1.f), -0.999f); maxk = MAX3(kr, kg, kb); - sc = (this->data->fit && (maxk > 0.f)) ? (1.f/(1.f + 2.f*maxk)) : (1.f/(1.f + maxk)); - drg = 4.f*(kg - kr); - dgb = 4.f*(kb - kg); + sc = (this->data->fit && (maxk > 0.f)) ? (1.f / (1.f + 2.f * maxk)) : (1.f / (1.f + maxk)); + drg = 4.f * (kg - kr); + dgb = 4.f * (kb - kg); - kr4 = kr*4; - kg4 = kg*4.f; - kb4 *= kb*4.f; - cx = 0.5f*(float)getWidth(); - cy = 0.5f*(float)getHeight(); + kr4 = kr * 4; + kg4 = kg * 4.f; + kb4 *= kb * 4.f; + cx = 0.5f * (float)getWidth(); + cy = 0.5f * (float)getHeight(); } @@ -65,28 +65,28 @@ void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int { 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}; float tc[4] = {0, 0, 0, 0}; - const float v = sc*((y + 0.5f) - cy)/cy; - const float u = sc*((x + 0.5f) - cx)/cx; + const float v = sc * ((y + 0.5f) - cy) / cy; + const float u = sc * ((x + 0.5f) - cx) / cx; int sta = 0, mid = 0, end = 0; - if ((t = 1.f - kr4*(u*u + v*v)) >= 0.f) { - d = 1.f/(1.f + sqrtf(t)); - ln[0] = (u*d + 0.5f)*width - 0.5f, ln[1] = (v*d + 0.5f)*height - 0.5f; + if ((t = 1.f - kr4 * (u * u + v * v)) >= 0.f) { + d = 1.f / (1.f + sqrtf(t)); + ln[0] = (u * d + 0.5f) * width - 0.5f, ln[1] = (v * d + 0.5f) * height - 0.5f; sta = 1; } - if ((t = 1.f - kg4*(u*u + v*v)) >= 0.f) { - d = 1.f/(1.f + sqrtf(t)); - ln[2] = (u*d + 0.5f)*width - 0.5f, ln[3] = (v*d + 0.5f)*height - 0.5f; + if ((t = 1.f - kg4 * (u * u + v * v)) >= 0.f) { + d = 1.f / (1.f + sqrtf(t)); + ln[2] = (u * d + 0.5f) * width - 0.5f, ln[3] = (v * d + 0.5f) * height - 0.5f; mid = 1; } - if ((t = 1.f - kb4*(u*u + v*v)) >= 0.f) { - d = 1.f/(1.f + sqrtf(t)); - ln[4] = (u*d + 0.5f)*width - 0.5f, ln[5] = (v*d + 0.5f)*height - 0.5f; + if ((t = 1.f - kb4 * (u * u + v * v)) >= 0.f) { + d = 1.f / (1.f + sqrtf(t)); + ln[4] = (u * d + 0.5f) * width - 0.5f, ln[5] = (v * d + 0.5f) * height - 0.5f; end = 1; } @@ -97,43 +97,43 @@ void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int { // RG const int dx = ln[2] - ln[0], dy = ln[3] - ln[1]; - const float dsf = sqrtf((float)dx*dx + dy*dy) + 1.f; + const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f; const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf); - const float sd = 1.f/(float)ds; + const float sd = 1.f / (float)ds; - for (z=0; zreadCubic(color, nx, ny); - tc[0] += (1.f-tz)*color[0], tc[1] += tz*color[1]; + tc[0] += (1.f - tz) * color[0], tc[1] += tz * color[1]; dr++, dg++; } } { // GB const int dx = ln[4] - ln[2], dy = ln[5] - ln[3]; - const float dsf = sqrtf((float)dx*dx + dy*dy) + 1.f; + const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f; const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf); - const float sd = 1.f/(float)ds; + const float sd = 1.f / (float)ds; - for (z=0; zreadCubic(color, nx, ny); - tc[1] += (1.f-tz)*color[1], tc[2] += tz*color[2]; + tc[1] += (1.f - tz) * color[1], tc[2] += tz * color[2]; dg++, db++; } } - if (dr) outputColor[0] = 2.f*tc[0] / (float)dr; - if (dg) outputColor[1] = 2.f*tc[1] / (float)dg; - if (db) outputColor[2] = 2.f*tc[2] / (float)db; + if (dr) outputColor[0] = 2.f * tc[0] / (float)dr; + if (dg) outputColor[1] = 2.f * tc[1] / (float)dg; + if (db) outputColor[2] = 2.f * tc[2] / (float)db; /* set alpha */ outputColor[3] = 1.0f; @@ -153,12 +153,12 @@ void ScreenLensDistortionOperation::deinitExecution() 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); - float d = 1.f/(1.f + sqrtf(t)); - result[0] = (u*d + 0.5f)*getWidth() - 0.5f; - result[1] = (v*d + 0.5f)*getHeight() - 0.5f; + 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); + float d = 1.f / (1.f + sqrtf(t)); + result[0] = (u * d + 0.5f) * getWidth() - 0.5f; + result[1] = (v * d + 0.5f) * getHeight() - 0.5f; } bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) diff --git a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp b/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp index 680e1648ebd..caa1387da2a 100644 --- a/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp +++ b/source/blender/compositor/operations/COM_SeparateChannelOperation.cpp @@ -39,7 +39,7 @@ void SeparateChannelOperation::deinitExecution() } -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); diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp index 0aefb075b64..5924108ed86 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp @@ -22,7 +22,7 @@ #include "COM_SetAlphaOperation.h" -SetAlphaOperation::SetAlphaOperation(): NodeOperation() +SetAlphaOperation::SetAlphaOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); diff --git a/source/blender/compositor/operations/COM_SetColorOperation.cpp b/source/blender/compositor/operations/COM_SetColorOperation.cpp index 50ff2a87a72..5307d7abc24 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.cpp +++ b/source/blender/compositor/operations/COM_SetColorOperation.cpp @@ -22,7 +22,7 @@ #include "COM_SetColorOperation.h" -SetColorOperation::SetColorOperation(): NodeOperation() +SetColorOperation::SetColorOperation() : NodeOperation() { this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp index 8974554e700..dfe7fe91bf8 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp @@ -22,7 +22,7 @@ #include "COM_SetSamplerOperation.h" -SetSamplerOperation::SetSamplerOperation(): NodeOperation() +SetSamplerOperation::SetSamplerOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); diff --git a/source/blender/compositor/operations/COM_SetValueOperation.cpp b/source/blender/compositor/operations/COM_SetValueOperation.cpp index abd4acafea6..483fcc97a1f 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.cpp +++ b/source/blender/compositor/operations/COM_SetValueOperation.cpp @@ -22,7 +22,7 @@ #include "COM_SetValueOperation.h" -SetValueOperation::SetValueOperation(): NodeOperation() +SetValueOperation::SetValueOperation() : NodeOperation() { this->addOutputSocket(COM_DT_VALUE); } diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cpp b/source/blender/compositor/operations/COM_SetVectorOperation.cpp index 79c0201733e..3d15a184c4e 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.cpp +++ b/source/blender/compositor/operations/COM_SetVectorOperation.cpp @@ -23,7 +23,7 @@ #include "COM_SetVectorOperation.h" #include "COM_defines.h" -SetVectorOperation::SetVectorOperation(): NodeOperation() +SetVectorOperation::SetVectorOperation() : NodeOperation() { this->addOutputSocket(COM_DT_VECTOR); } diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp index 5f86d6bd7c7..55c4b68ee57 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.cpp +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cpp @@ -39,7 +39,7 @@ 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[]) { if (this->inputOperation) { this->inputOperation->read(color, x, y, sampler, inputBuffers); diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp index 0d85f71c691..072528f3fc6 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cpp +++ b/source/blender/compositor/operations/COM_TextureOperation.cpp @@ -25,10 +25,10 @@ #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->addInputSocket(COM_DT_VECTOR); //offset + this->addInputSocket(COM_DT_VECTOR); //size this->texture = NULL; this->inputSize = NULL; this->inputOffset = NULL; @@ -57,8 +57,8 @@ void TextureBaseOperation::deinitExecution() void TextureBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { if (preferredResolution[0] == 0 || preferredResolution[1] == 0) { - int width = this->scene->r.xsch*this->scene->r.size/100; - int height = this->scene->r.ysch*this->scene->r.size/100; + int width = this->scene->r.xsch * this->scene->r.size / 100; + int height = this->scene->r.ysch * this->scene->r.size / 100; resolution[0] = width; resolution[1] = height; } @@ -79,22 +79,22 @@ void TextureAlphaOperation::executePixel(float *color, float x, float y, PixelSa 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}; + TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; float textureSize[4]; float textureOffset[4]; float vec[3]; int retval; - const float cx = this->getWidth()/2; - const float cy = this->getHeight()/2; - const float u = (cx-x)/this->getWidth()*2; - const float v = (cy-y)/this->getHeight()*2; + const float cx = this->getWidth() / 2; + const float cy = this->getHeight() / 2; + const float u = (cx - x) / this->getWidth() * 2; + const float v = (cy - y) / this->getHeight() * 2; 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); diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp index 412cdbdf661..7b978e0f87c 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cpp +++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp @@ -26,7 +26,7 @@ -TonemapOperation::TonemapOperation(): NodeOperation() +TonemapOperation::TonemapOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); @@ -41,9 +41,9 @@ void TonemapOperation::initExecution() 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; + AvgLogLum *avg = (AvgLogLum *)data; float output[4]; this->imageReader->read(output, x, y, inputBuffers, NULL); @@ -120,10 +120,10 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff { lockMutex(); 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 *buffer = tile->getBuffer(); float lsum = 0.0f; int p = tile->getWidth() * tile->getHeight(); @@ -131,7 +131,7 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff float avl, maxl = -1e10f, minl = 1e10f; const float sc = 1.0f / p; float Lav = 0.f; - float cav[4] = {0.0f,0.0f,0.0f,0.0f}; + float cav[4] = {0.0f, 0.0f, 0.0f, 0.0f}; while (p--) { float L = rgb_to_luma_y(bc); Lav += L; @@ -139,7 +139,7 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff lsum += logf(MAX2(L, 0.0f) + 1e-5f); maxl = (L > maxl) ? L : maxl; minl = (L < minl) ? L : minl; - bc+=4; + bc += 4; } data->lav = Lav * sc; mul_v3_v3fl(data->cav, cav, sc); @@ -147,7 +147,7 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff data->auto_key = (maxl > minl) ? ((maxl - avl) / (maxl - minl)) : 1.f; float al = exp((double)avl); data->al = (al == 0.f) ? 0.f : (this->data->key / al); - data->igm = (this->data->gamma==0.f) ? 1 : (1.f / this->data->gamma); + data->igm = (this->data->gamma == 0.f) ? 1 : (1.f / this->data->gamma); this->cachedInstance = data; } unlockMutex(); diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp index b9b06d6d356..c41e2c7f156 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.cpp +++ b/source/blender/compositor/operations/COM_TranslateOperation.cpp @@ -50,10 +50,10 @@ void TranslateOperation::deinitExecution() } -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[]) { ensureDelta(); - this->inputOperation->read(color, x-this->getDeltaX(), y-this->getDeltaY(), sampler, inputBuffers); + this->inputOperation->read(color, x - this->getDeltaX(), y - this->getDeltaY(), sampler, inputBuffers); } bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp index e9045b126e2..3173599ece6 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp @@ -30,7 +30,7 @@ extern "C" { } #endif -VectorCurveOperation::VectorCurveOperation(): CurveBaseOperation() +VectorCurveOperation::VectorCurveOperation() : CurveBaseOperation() { this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_VECTOR); diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp index 087ab50cf47..e1018e0d037 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp @@ -24,7 +24,7 @@ #include "COM_defines.h" #include -WriteBufferOperation::WriteBufferOperation() :NodeOperation() +WriteBufferOperation::WriteBufferOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->memoryProxy = new MemoryProxy(); @@ -56,7 +56,7 @@ void WriteBufferOperation::deinitExecution() this->memoryProxy->free(); } -void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer** memoryBuffers) +void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers) { //MemoryBuffer *memoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), tileNumber); MemoryBuffer *memoryBuffer = this->memoryProxy->getBuffer(); @@ -70,11 +70,11 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me int x; int y; bool breaked = false; - for (y = y1 ; y < y2 && (!breaked) ; y++) { - int offset4 = (y*memoryBuffer->getWidth()+x1)*COM_NUMBER_OF_CHANNELS; - for (x = x1 ; x < x2; x++) { + for (y = y1; y < y2 && (!breaked); y++) { + int offset4 = (y * memoryBuffer->getWidth() + x1) * COM_NUMBER_OF_CHANNELS; + for (x = x1; x < x2; x++) { input->read(&(buffer[offset4]), x, y, memoryBuffers, data); - offset4 +=COM_NUMBER_OF_CHANNELS; + offset4 += COM_NUMBER_OF_CHANNELS; } if (isBreaked()) { @@ -96,11 +96,11 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me int x; int y; bool breaked = false; - for (y = y1 ; y < y2 && (!breaked) ; y++) { - int offset4 = (y*memoryBuffer->getWidth()+x1)*COM_NUMBER_OF_CHANNELS; - for (x = x1 ; x < x2 ; x++) { + for (y = y1; y < y2 && (!breaked); y++) { + int offset4 = (y * memoryBuffer->getWidth() + x1) * COM_NUMBER_OF_CHANNELS; + for (x = x1; x < x2; x++) { input->read(&(buffer[offset4]), x, y, COM_PS_NEAREST, memoryBuffers); - offset4 +=COM_NUMBER_OF_CHANNELS; + offset4 += COM_NUMBER_OF_CHANNELS; } if (isBreaked()) { breaked = true; @@ -110,7 +110,7 @@ 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* outputBuffer) +void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer **inputMemoryBuffers, MemoryBuffer *outputBuffer) { float *outputFloatBuffer = outputBuffer->getBuffer(); cl_int error; @@ -131,11 +131,11 @@ void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program pr CL_FLOAT }; - cl_mem clOutputBuffer = clCreateImage2D(context, CL_MEM_WRITE_ONLY|CL_MEM_USE_HOST_PTR, &imageFormat, outputBufferWidth, outputBufferHeight, 0, outputFloatBuffer, &error); - if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } + cl_mem clOutputBuffer = clCreateImage2D(context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR, &imageFormat, outputBufferWidth, outputBufferHeight, 0, outputFloatBuffer, &error); + if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } // STEP 2 - list * clMemToCleanUp = new list(); + list *clMemToCleanUp = new list(); clMemToCleanUp->push_back(clOutputBuffer); list *clKernelsToCleanUp = new list(); @@ -143,40 +143,40 @@ void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program pr // STEP 3 - size_t origin[3] = {0,0,0}; - size_t region[3] = {outputBufferWidth,outputBufferHeight,1}; + size_t origin[3] = {0, 0, 0}; + size_t region[3] = {outputBufferWidth, outputBufferHeight, 1}; // clFlush(queue); // clFinish(queue); error = clEnqueueBarrier(queue); - if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } + if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } error = clEnqueueReadImage(queue, clOutputBuffer, CL_TRUE, origin, region, 0, 0, outputFloatBuffer, 0, NULL, NULL); - if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } + if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } this->getMemoryProxy()->getBuffer()->copyContentFrom(outputBuffer); // STEP 4 - while (clMemToCleanUp->size()>0) { + while (clMemToCleanUp->size() > 0) { cl_mem mem = clMemToCleanUp->front(); error = clReleaseMemObject(mem); - if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } + if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } clMemToCleanUp->pop_front(); } - while (clKernelsToCleanUp->size()>0) { + while (clKernelsToCleanUp->size() > 0) { cl_kernel kernel = clKernelsToCleanUp->front(); error = clReleaseKernel(kernel); - if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } + if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } clKernelsToCleanUp->pop_front(); } delete clKernelsToCleanUp; } void WriteBufferOperation::readResolutionFromInputSocket() { - NodeOperation* inputOperation = this->getInputOperation(0); + NodeOperation *inputOperation = this->getInputOperation(0); this->setWidth(inputOperation->getWidth()); this->setHeight(inputOperation->getHeight()); } diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp index 7f32bac2e64..eb02b150fa4 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp +++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp @@ -23,7 +23,7 @@ #include "COM_ZCombineOperation.h" #include "BLI_utildefines.h" -ZCombineOperation::ZCombineOperation(): NodeOperation() +ZCombineOperation::ZCombineOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); @@ -53,7 +53,7 @@ void ZCombineOperation::executePixel(float *color, float x, float y, PixelSample this->depth1Reader->read(depth1, x, y, sampler, inputBuffers); this->depth2Reader->read(depth2, x, y, sampler, inputBuffers); - if (depth1[0]image1Reader->read(color, x, y, sampler, inputBuffers); } else { @@ -69,7 +69,7 @@ void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelS this->depth1Reader->read(depth1, x, y, sampler, inputBuffers); this->depth2Reader->read(depth2, x, y, sampler, inputBuffers); - if (depth1[0]image1Reader->read(color1, x, y, sampler, inputBuffers); this->image2Reader->read(color2, x, y, sampler, inputBuffers); } @@ -78,10 +78,10 @@ void ZCombineAlphaOperation::executePixel(float *color, float x, float y, PixelS this->image2Reader->read(color1, x, y, sampler, inputBuffers); } float fac = color1[3]; - float ifac = 1.0f-fac; - color[0] = color1[0]+ifac*color2[0]; - color[1] = color1[1]+ifac*color2[1]; - color[2] = color1[2]+ifac*color2[2]; + float ifac = 1.0f - fac; + color[0] = color1[0] + ifac * color2[0]; + color[1] = color1[1] + ifac * color2[1]; + color[2] = color1[2] + ifac * color2[2]; color[3] = MAX2(color1[3], color2[3]); } -- cgit v1.2.3