Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-23 04:21:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-23 04:22:25 +0300
commit3302fbaeb1d5f58d926c06b6153ec5d6f1a9b0be (patch)
tree5be399e227415fef745bcdb2b7f20a578628718b /source/blender/compositor/operations
parent64b4b719ebd5201d27aa25d7fa2d765eabded9b0 (diff)
Cleanup: style, use braces for compositor
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_AntiAliasOperation.cpp48
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.cpp3
-rw-r--r--source/blender/compositor/operations/COM_ChangeHSVOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp3
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp3
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp3
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp30
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp27
-rw-r--r--source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp63
-rw-r--r--source/blender/compositor/operations/COM_GlareGhostOperation.cpp45
-rw-r--r--source/blender/compositor/operations/COM_GlareStreaksOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ImageOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_InpaintOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_InvertOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_KeyingClipOperation.cpp15
-rw-r--r--source/blender/compositor/operations/COM_KeyingScreenOperation.cpp33
-rw-r--r--source/blender/compositor/operations/COM_MapRangeOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MapValueOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp36
-rw-r--r--source/blender/compositor/operations/COM_MixOperation.cpp135
-rw-r--r--source/blender/compositor/operations/COM_MovieClipOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_MultilayerImageOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_NormalizeOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_OpenCLKernels.cl16
-rw-r--r--source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp27
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cpp30
-rw-r--r--source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp15
-rw-r--r--source/blender/compositor/operations/COM_PlaneTrackOperation.cpp3
-rw-r--r--source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp3
-rw-r--r--source/blender/compositor/operations/COM_RenderLayersProg.cpp27
-rw-r--r--source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_TextureOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_TrackPositionOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_VectorBlurOperation.cpp105
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.h3
-rw-r--r--source/blender/compositor/operations/COM_WrapOperation.cpp12
41 files changed, 552 insertions, 280 deletions
diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
index 94514c64e08..de7c43a8751 100644
--- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
+++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
@@ -56,39 +56,55 @@ static int extrapolate9(float *E0,
*DST = *SRC; \
} while (0)
if ((!PEQ(B, H)) && (!PEQ(D, F))) {
- if (PEQ(D, B))
+ if (PEQ(D, B)) {
PCPY(E0, D);
- else
+ }
+ else {
PCPY(E0, E);
- if ((PEQ(D, B) && !PEQ(E, C)) || (PEQ(B, F) && !PEQ(E, A)))
+ }
+ if ((PEQ(D, B) && !PEQ(E, C)) || (PEQ(B, F) && !PEQ(E, A))) {
PCPY(E1, B);
- else
+ }
+ else {
PCPY(E1, E);
- if (PEQ(B, F))
+ }
+ if (PEQ(B, F)) {
PCPY(E2, F);
- else
+ }
+ else {
PCPY(E2, E);
- if ((PEQ(D, B) && !PEQ(E, G)) || (PEQ(D, H) && !PEQ(E, A)))
+ }
+ if ((PEQ(D, B) && !PEQ(E, G)) || (PEQ(D, H) && !PEQ(E, A))) {
PCPY(E3, D);
- else
+ }
+ else {
PCPY(E3, E);
+ }
PCPY(E4, E);
- if ((PEQ(B, F) && !PEQ(E, I)) || (PEQ(H, F) && !PEQ(E, C)))
+ if ((PEQ(B, F) && !PEQ(E, I)) || (PEQ(H, F) && !PEQ(E, C))) {
PCPY(E5, F);
- else
+ }
+ else {
PCPY(E5, E);
- if (PEQ(D, H))
+ }
+ if (PEQ(D, H)) {
PCPY(E6, D);
- else
+ }
+ else {
PCPY(E6, E);
- if ((PEQ(D, H) && !PEQ(E, I)) || (PEQ(H, F) && !PEQ(E, G)))
+ }
+ if ((PEQ(D, H) && !PEQ(E, I)) || (PEQ(H, F) && !PEQ(E, G))) {
PCPY(E7, H);
- else
+ }
+ else {
PCPY(E7, E);
- if (PEQ(H, F))
+ }
+ if (PEQ(H, F)) {
PCPY(E8, F);
- else
+ }
+ else {
PCPY(E8, E);
+ }
return 1;
}
else {
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index aca98085a3e..f3b090287ad 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -81,8 +81,9 @@ float *BlurBaseOperation::make_gausstab(float rad, int size)
}
sum = 1.0f / sum;
- for (i = 0; i < n; i++)
+ for (i = 0; i < n; i++) {
gausstab[i] *= sum;
+ }
return gausstab;
}
diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
index a2554cd60de..ddbc400777f 100644
--- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
@@ -58,10 +58,12 @@ void ChangeHSVOperation::executePixelSampled(float output[4],
this->m_valueOperation->readSampled(value, x, y, sampler);
output[0] = inputColor1[0] + (hue[0] - 0.5f);
- if (output[0] > 1.0f)
+ if (output[0] > 1.0f) {
output[0] -= 1.0f;
- else if (output[0] < 0.0f)
+ }
+ else if (output[0] < 0.0f) {
output[0] += 1.0f;
+ }
output[1] = inputColor1[1] * saturation[0];
output[2] = inputColor1[2] * value[0];
output[3] = inputColor1[3];
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
index f957186a652..a515b9a6a67 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
@@ -24,8 +24,9 @@ inline float colorbalance_cdl(float in, float offset, float power, float slope)
float x = in * slope + offset;
/* prevent NaN */
- if (x < 0.0f)
+ if (x < 0.0f) {
x = 0.0f;
+ }
return powf(x, power);
}
diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
index 48807e9218d..c48c39f7726 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
@@ -28,8 +28,9 @@ inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float g
float x = (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain;
/* prevent NaN */
- if (x < 0.0f)
+ if (x < 0.0f) {
x = 0.0f;
+ }
return powf(srgb_to_linearrgb(x), gamma_inv);
}
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index 6caaf227ef2..40315d217ce 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -54,8 +54,9 @@ CompositorOperation::CompositorOperation() : NodeOperation()
void CompositorOperation::initExecution()
{
- if (!this->m_active)
+ if (!this->m_active) {
return;
+ }
// When initializing the tree during initial load the width and height can be zero.
this->m_imageInput = getInputSocketReader(0);
@@ -73,8 +74,9 @@ void CompositorOperation::initExecution()
void CompositorOperation::deinitExecution()
{
- if (!this->m_active)
+ if (!this->m_active) {
return;
+ }
if (!isBreaked()) {
Render *re = RE_GetSceneRender(this->m_scene);
@@ -136,8 +138,9 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/)
float *buffer = this->m_outputBuffer;
float *zbuffer = this->m_depthBuffer;
- if (!buffer)
+ if (!buffer) {
return;
+ }
int x1 = rect->xmin;
int y1 = rect->ymin;
int x2 = rect->xmax;
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
index 7b63d3ef3cb..c47e4d560a5 100644
--- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
@@ -56,8 +56,9 @@ void ConvertDepthToRadiusOperation::initExecution()
this->m_inputOperation = this->getInputSocketReader(0);
float focalDistance = determineFocalDistance();
- if (focalDistance == 0.0f)
+ if (focalDistance == 0.0f) {
focalDistance = 1e10f; /* if the dof is 0.0 then set it to be far away */
+ }
this->m_inverseFocalDistance = 1.0f / focalDistance;
this->m_aspect = (this->getWidth() > this->getHeight()) ?
(this->getHeight() / (float)this->getWidth()) :
@@ -95,8 +96,9 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4],
radius = 0.5f * fabsf(this->m_aperture *
(this->m_dof_sp * (this->m_inverseFocalDistance - iZ) - 1.0f));
// 'bug' #6615, limit minimum radius to 1 pixel, not really a solution, but somewhat mitigates the problem
- if (radius < 0.0f)
+ if (radius < 0.0f) {
radius = 0.0f;
+ }
if (radius > this->m_maxRadius) {
radius = this->m_maxRadius;
}
diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp
index fbbe8706e11..625490dd3ab 100644
--- a/source/blender/compositor/operations/COM_CropOperation.cpp
+++ b/source/blender/compositor/operations/COM_CropOperation.cpp
@@ -41,14 +41,18 @@ void CropBaseOperation::updateArea()
local_settings.y1 = height * local_settings.fac_y1;
local_settings.y2 = height * local_settings.fac_y2;
}
- if (width <= local_settings.x1 + 1)
+ if (width <= local_settings.x1 + 1) {
local_settings.x1 = width - 1;
- if (height <= local_settings.y1 + 1)
+ }
+ if (height <= local_settings.y1 + 1) {
local_settings.y1 = height - 1;
- if (width <= local_settings.x2 + 1)
+ }
+ if (width <= local_settings.x2 + 1) {
local_settings.x2 = width - 1;
- if (height <= local_settings.y2 + 1)
+ }
+ if (height <= local_settings.y2 + 1) {
local_settings.y2 = height - 1;
+ }
this->m_xmax = max(local_settings.x1, local_settings.x2) + 1;
this->m_xmin = min(local_settings.x1, local_settings.x2);
diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
index 34f0d2cb760..cd1dae2c9b5 100644
--- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
@@ -1340,8 +1340,9 @@ void DoubleEdgeMaskOperation::initExecution()
void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect)
{
- if (this->m_cachedInstance)
+ if (this->m_cachedInstance) {
return this->m_cachedInstance;
+ }
lockMutex();
if (this->m_cachedInstance == NULL) {
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index e375b2fe45b..8d11328b63b 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -89,17 +89,20 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
this->m_sy = this->m_data.sizey * this->m_size / 2.0f;
if ((this->m_sx == this->m_sy) && (this->m_sx > 0.0f)) {
- for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c)
+ for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c) {
IIR_gauss(copy, this->m_sx, c, 3);
+ }
}
else {
if (this->m_sx > 0.0f) {
- for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c)
+ for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c) {
IIR_gauss(copy, this->m_sx, c, 1);
+ }
}
if (this->m_sy > 0.0f) {
- for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c)
+ for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c) {
IIR_gauss(copy, this->m_sy, c, 2);
+ }
}
}
this->m_iirgaus = copy;
@@ -123,27 +126,34 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src,
const unsigned int num_channels = src->get_num_channels();
// <0.5 not valid, though can have a possibly useful sort of sharpening effect
- if (sigma < 0.5f)
+ if (sigma < 0.5f) {
return;
+ }
- if ((xy < 1) || (xy > 3))
+ if ((xy < 1) || (xy > 3)) {
xy = 3;
+ }
// XXX The YVV macro defined below explicitly expects sources of at least 3x3 pixels,
// so just skipping blur along faulty direction if src's def is below that limit!
- if (src_width < 3)
+ if (src_width < 3) {
xy &= ~1;
- if (src_height < 3)
+ }
+ if (src_height < 3) {
xy &= ~2;
- if (xy < 1)
+ }
+ if (xy < 1) {
return;
+ }
// see "Recursive Gabor Filtering" by Young/VanVliet
// all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200
- if (sigma >= 3.556f)
+ if (sigma >= 3.556f) {
q = 0.9804f * (sigma - 3.556f) + 2.5091f;
- else // sigma >= 0.5
+ }
+ else { // sigma >= 0.5
q = (0.0561f * sigma + 0.5784f) * sigma - 0.2568f;
+ }
q2 = q * q;
sc = (1.1668 + q) * (3.203729649 + (2.21566 + q) * q);
// no gabor filtering here, so no complex multiplies, just the regular coefs.
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index 88c4ff7d935..318c182fdff 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -98,8 +98,9 @@ void GaussianBokehBlurOperation::updateGauss()
if (sum > 0.0f) {
/* normalize */
float norm = 1.0f / sum;
- for (j = n - 1; j >= 0; j--)
+ for (j = n - 1; j >= 0; j--) {
ddgauss[j] *= norm;
+ }
}
else {
int center = m_rady * ddwidth + m_radx;
@@ -233,19 +234,23 @@ void GaussianBlurReferenceOperation::initExecution()
/* horizontal */
m_filtersizex = (float)this->m_data.sizex;
int imgx = getWidth() / 2;
- if (m_filtersizex > imgx)
+ if (m_filtersizex > imgx) {
m_filtersizex = imgx;
- else if (m_filtersizex < 1)
+ }
+ else if (m_filtersizex < 1) {
m_filtersizex = 1;
+ }
m_radx = (float)m_filtersizex;
/* vertical */
m_filtersizey = (float)this->m_data.sizey;
int imgy = getHeight() / 2;
- if (m_filtersizey > imgy)
+ if (m_filtersizey > imgy) {
m_filtersizey = imgy;
- else if (m_filtersizey < 1)
+ }
+ else if (m_filtersizey < 1) {
m_filtersizey = 1;
+ }
m_rady = (float)m_filtersizey;
updateGauss();
}
@@ -277,14 +282,18 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y,
float refSize = tempSize[0];
int refradx = (int)(refSize * m_radx);
int refrady = (int)(refSize * m_rady);
- if (refradx > m_filtersizex)
+ if (refradx > m_filtersizex) {
refradx = m_filtersizex;
- else if (refradx < 1)
+ }
+ else if (refradx < 1) {
refradx = 1;
- if (refrady > m_filtersizey)
+ }
+ if (refrady > m_filtersizey) {
refrady = m_filtersizey;
- else if (refrady < 1)
+ }
+ else if (refrady < 1) {
refrady = 1;
+ }
if (refradx == 1 && refrady == 1) {
memorybuffer->readNoCheck(output, x, y);
diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
index e0a2790b318..ff75fb7090f 100644
--- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
@@ -30,8 +30,9 @@ static unsigned int nextPow2(unsigned int x, unsigned int *L2)
{
unsigned int pw, x_notpow2 = x & (x - 1);
*L2 = 0;
- while (x >>= 1)
+ while (x >>= 1) {
++(*L2);
+ }
pw = 1 << (*L2);
if (x_notpow2) {
(*L2)++;
@@ -46,8 +47,9 @@ static unsigned int nextPow2(unsigned int x, unsigned int *L2)
// use: r = revbin_upd(r, h) where h = N>>1
static unsigned int revbin_upd(unsigned int r, unsigned int h)
{
- while (!((r ^= h) & h))
+ while (!((r ^= h) & h)) {
h >>= 1;
+ }
return r;
}
//------------------------------------------------------------------------------
@@ -115,8 +117,9 @@ static void FHT(fREAL *data, unsigned int M, unsigned int inverse)
if (inverse) {
fREAL sc = (fREAL)1 / (fREAL)len;
- for (k = 0; k < len; ++k)
+ for (k = 0; k < len; ++k) {
data[k] *= sc;
+ }
}
}
//------------------------------------------------------------------------------
@@ -133,25 +136,29 @@ static void FHT2D(
// rows (forward transform skips 0 pad data)
maxy = inverse ? Ny : nzp;
- for (j = 0; j < maxy; ++j)
+ for (j = 0; j < maxy; ++j) {
FHT(&data[Nx * j], Mx, inverse);
+ }
// transpose data
if (Nx == Ny) { // square
- for (j = 0; j < Ny; ++j)
+ for (j = 0; j < Ny; ++j) {
for (i = j + 1; i < Nx; ++i) {
unsigned int op = i + (j << Mx), np = j + (i << My);
SWAP(fREAL, data[op], data[np]);
}
+ }
}
else { // rectangular
unsigned int k, Nym = Ny - 1, stm = 1 << (Mx + My);
for (i = 0; stm > 0; i++) {
#define PRED(k) (((k & Nym) << Mx) + (k >> My))
- for (j = PRED(i); j > i; j = PRED(j))
+ for (j = PRED(i); j > i; j = PRED(j)) {
;
- if (j < i)
+ }
+ if (j < i) {
continue;
+ }
for (k = i, j = PRED(i); j != i; k = j, j = PRED(j), stm--) {
SWAP(fREAL, data[j], data[k]);
}
@@ -164,8 +171,9 @@ static void FHT2D(
SWAP(unsigned int, Mx, My);
// now columns == transposed rows
- for (j = 0; j < Ny; ++j)
+ for (j = 0; j < Ny; ++j) {
FHT(&data[Nx * j], Mx, inverse);
+ }
// finalize
for (j = 0; j <= (Ny >> 1); j++) {
@@ -280,19 +288,24 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
wt[0] = wt[1] = wt[2] = 0.0f;
for (y = 0; y < kernelHeight; y++) {
colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR];
- for (x = 0; x < kernelWidth; x++)
+ for (x = 0; x < kernelWidth; x++) {
add_v3_v3(wt, colp[x]);
+ }
}
- if (wt[0] != 0.0f)
+ if (wt[0] != 0.0f) {
wt[0] = 1.0f / wt[0];
- if (wt[1] != 0.0f)
+ }
+ if (wt[1] != 0.0f) {
wt[1] = 1.0f / wt[1];
- if (wt[2] != 0.0f)
+ }
+ if (wt[2] != 0.0f) {
wt[2] = 1.0f / wt[2];
+ }
for (y = 0; y < kernelHeight; y++) {
colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR];
- for (x = 0; x < kernelWidth; x++)
+ for (x = 0; x < kernelWidth; x++) {
mul_v3_v3(colp[x], wt);
+ }
}
// copy image data, unpacking interleaved RGBA into separate channels
@@ -304,11 +317,13 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
xbsz = (w2 + 1) - kernelWidth;
ybsz = (h2 + 1) - kernelHeight;
nxb = imageWidth / xbsz;
- if (imageWidth % xbsz)
+ if (imageWidth % xbsz) {
nxb++;
+ }
nyb = imageHeight / ybsz;
- if (imageHeight % ybsz)
+ if (imageHeight % ybsz) {
nyb++;
+ }
for (ybl = 0; ybl < nyb; ybl++) {
for (xbl = 0; xbl < nxb; xbl++) {
@@ -322,8 +337,9 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
for (y = 0; y < kernelHeight; y++) {
fp = &data1ch[y * w2];
colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR];
- for (x = 0; x < kernelWidth; x++)
+ for (x = 0; x < kernelWidth; x++) {
fp[x] = colp[x][ch];
+ }
}
}
@@ -331,22 +347,25 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
memset(data2, 0, w2 * h2 * sizeof(fREAL));
for (y = 0; y < ybsz; y++) {
int yy = ybl * ybsz + y;
- if (yy >= imageHeight)
+ if (yy >= imageHeight) {
continue;
+ }
fp = &data2[y * w2];
colp = (fRGB *)&imageBuffer[yy * imageWidth * COM_NUM_CHANNELS_COLOR];
for (x = 0; x < xbsz; x++) {
int xx = xbl * xbsz + x;
- if (xx >= imageWidth)
+ if (xx >= imageWidth) {
continue;
+ }
fp[x] = colp[xx][ch];
}
}
// forward FHT
// zero pad data start is different for each == height+1
- if (!in2done)
+ if (!in2done) {
FHT2D(data1ch, log2_w, log2_h, kernelHeight + 1, 0);
+ }
FHT2D(data2, log2_w, log2_h, kernelHeight + 1, 0);
// FHT2D transposed data, row/col now swapped
@@ -358,14 +377,16 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
// overlap-add result
for (y = 0; y < (int)h2; y++) {
const int yy = ybl * ybsz + y - hh;
- if ((yy < 0) || (yy >= imageHeight))
+ if ((yy < 0) || (yy >= imageHeight)) {
continue;
+ }
fp = &data2[y * w2];
colp = (fRGB *)&rdst->getBuffer()[yy * imageWidth * COM_NUM_CHANNELS_COLOR];
for (x = 0; x < (int)w2; x++) {
const int xx = xbl * xbsz + x - hw;
- if ((xx < 0) || (xx >= imageWidth))
+ if ((xx < 0) || (xx >= imageWidth)) {
continue;
+ }
colp[xx][ch] += fp[x];
}
}
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
index f2bf25327af..944a1d9c5dc 100644
--- a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
@@ -48,41 +48,54 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
bool breaked = false;
FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 0, 3);
- if (!breaked)
+ if (!breaked) {
FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 1, 3);
- if (isBreaked())
+ }
+ if (isBreaked()) {
breaked = true;
- if (!breaked)
+ }
+ if (!breaked) {
FastGaussianBlurOperation::IIR_gauss(tbuf1, s1, 2, 3);
+ }
MemoryBuffer *tbuf2 = tbuf1->duplicate();
- if (isBreaked())
+ if (isBreaked()) {
breaked = true;
- if (!breaked)
+ }
+ if (!breaked) {
FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 0, 3);
- if (isBreaked())
+ }
+ if (isBreaked()) {
breaked = true;
- if (!breaked)
+ }
+ if (!breaked) {
FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 1, 3);
- if (isBreaked())
+ }
+ if (isBreaked()) {
breaked = true;
- if (!breaked)
+ }
+ if (!breaked) {
FastGaussianBlurOperation::IIR_gauss(tbuf2, s2, 2, 3);
+ }
ofs = (settings->iter & 1) ? 0.5f : 0.0f;
for (x = 0; x < (settings->iter * 4); x++) {
y = x & 3;
cm[x][0] = cm[x][1] = cm[x][2] = 1;
- if (y == 1)
+ if (y == 1) {
fRGB_rgbmult(cm[x], 1.0f, cmo, cmo);
- if (y == 2)
+ }
+ if (y == 2) {
fRGB_rgbmult(cm[x], cmo, cmo, 1.0f);
- if (y == 3)
+ }
+ if (y == 3) {
fRGB_rgbmult(cm[x], cmo, 1.0f, cmo);
+ }
scalef[x] = 2.1f * (1.0f - (x + ofs) / (float)(settings->iter * 4));
- if (x & 1)
+ if (x & 1) {
scalef[x] = -0.99f / scalef[x];
+ }
}
sc = 2.13;
@@ -104,8 +117,9 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
gbuf->writePixel(x, y, c);
}
- if (isBreaked())
+ if (isBreaked()) {
breaked = true;
+ }
}
memset(tbuf1->getBuffer(),
@@ -128,8 +142,9 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
}
tbuf1->addPixel(x, y, tc);
}
- if (isBreaked())
+ if (isBreaked()) {
breaked = true;
+ }
}
memcpy(gbuf->getBuffer(),
tbuf1->getBuffer(),
diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp b/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
index cf60a1378b4..78ca373faaf 100644
--- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
@@ -54,10 +54,12 @@ void GlareStreaksOperation::generateGlare(float *data,
for (x = 0; x < tsrc->getWidth(); ++x, tdstcol += 4) {
// first pass no offset, always same for every pass, exact copy,
// otherwise results in uneven brightness, only need once
- if (n == 0)
+ if (n == 0) {
tsrc->read(c1, x, y);
- else
+ }
+ else {
c1[0] = c1[1] = c1[2] = 0;
+ }
tsrc->readBilinear(c2, x + vxp, y + vyp);
tsrc->readBilinear(c3, x + vxp * 2.0f, y + vyp * 2.0f);
tsrc->readBilinear(c4, x + vxp * 3.0f, y + vyp * 3.0f);
diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp
index bf9ad441803..3a60b1c84a3 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_ImageOperation.cpp
@@ -66,12 +66,14 @@ ImBuf *BaseImageOperation::getImBuf()
ImBuf *ibuf;
ImageUser iuser = *this->m_imageUser;
- if (this->m_image == NULL)
+ if (this->m_image == NULL) {
return NULL;
+ }
/* local changes to the original ImageUser */
- if (BKE_image_is_multilayer(this->m_image) == false)
+ if (BKE_image_is_multilayer(this->m_image) == false) {
iuser.multi_index = BKE_scene_multiview_view_id_get(this->m_rd, this->m_viewName);
+ }
ibuf = BKE_image_acquire_ibuf(this->m_image, &iuser, NULL);
if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) {
@@ -194,8 +196,9 @@ void ImageDepthOperation::executePixelSampled(float output[4],
output[0] = 0.0f;
}
else {
- if (x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight())
+ if (x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight()) {
output[0] = 0.0f;
+ }
else {
int offset = y * this->m_width + x;
output[0] = this->m_depthBuffer[offset];
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp
index 86d566834e6..0967984899d 100644
--- a/source/blender/compositor/operations/COM_InpaintOperation.cpp
+++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp
@@ -125,10 +125,12 @@ void InpaintSimpleOperation::calc_manhatten_distance()
/* no need to clamp here */
if (this->get_pixel(i, j)[3] < 1.0f) {
r = width + height;
- if (i > 0)
+ if (i > 0) {
r = min_ii(r, m[j * width + i - 1] + 1);
- if (j > 0)
+ }
+ if (j > 0) {
r = min_ii(r, m[(j - 1) * width + i] + 1);
+ }
}
m[j * width + i] = r;
}
@@ -138,10 +140,12 @@ void InpaintSimpleOperation::calc_manhatten_distance()
for (int i = width - 1; i >= 0; i--) {
int r = m[j * width + i];
- if (i + 1 < width)
+ if (i + 1 < width) {
r = min_ii(r, m[j * width + i + 1] + 1);
- if (j + 1 < height)
+ }
+ if (j + 1 < height) {
r = min_ii(r, m[(j + 1) * width + i] + 1);
+ }
m[j * width + i] = r;
diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp
index 632dbdbfa4e..bfd9d14a1ef 100644
--- a/source/blender/compositor/operations/COM_InvertOperation.cpp
+++ b/source/blender/compositor/operations/COM_InvertOperation.cpp
@@ -54,10 +54,12 @@ void InvertOperation::executePixelSampled(float output[4], float x, float y, Pix
copy_v3_v3(output, inputColor);
}
- if (this->m_alpha)
+ if (this->m_alpha) {
output[3] = (1.0f - inputColor[3]) * value + inputColor[3] * invertedValue;
- else
+ }
+ else {
output[3] = inputColor[3];
+ }
}
void InvertOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
index 89fa8a8d303..b11bd54a190 100644
--- a/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cpp
@@ -90,21 +90,26 @@ void KeyingClipOperation::executePixel(float output[4], int x, int y, void *data
}
if (this->m_isEdgeMatte) {
- if (ok)
+ if (ok) {
output[0] = 0.0f;
- else
+ }
+ else {
output[0] = 1.0f;
+ }
}
else {
output[0] = value;
if (ok) {
- if (output[0] < this->m_clipBlack)
+ if (output[0] < this->m_clipBlack) {
output[0] = 0.0f;
- else if (output[0] >= this->m_clipWhite)
+ }
+ else if (output[0] >= this->m_clipWhite) {
output[0] = 1.0f;
- else
+ }
+ else {
output[0] = (output[0] - this->m_clipBlack) / (this->m_clipWhite - this->m_clipBlack);
+ }
}
}
}
diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
index 03a6bf6a7dd..ab9ef0335e0 100644
--- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
@@ -52,14 +52,17 @@ void KeyingScreenOperation::deinitExecution()
if (this->m_cachedTriangulation) {
TriangulationData *triangulation = this->m_cachedTriangulation;
- if (triangulation->triangulated_points)
+ if (triangulation->triangulated_points) {
MEM_freeN(triangulation->triangulated_points);
+ }
- if (triangulation->triangles)
+ if (triangulation->triangles) {
MEM_freeN(triangulation->triangles);
+ }
- if (triangulation->triangles_AABB)
+ if (triangulation->triangles_AABB) {
MEM_freeN(triangulation->triangles_AABB);
+ }
MEM_freeN(this->m_cachedTriangulation);
@@ -86,13 +89,15 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
if (this->m_trackingObject[0]) {
MovieTrackingObject *object = BKE_tracking_object_get_named(tracking, this->m_trackingObject);
- if (!object)
+ if (!object) {
return NULL;
+ }
tracksbase = BKE_tracking_object_get_tracks(tracking, object);
}
- else
+ else {
tracksbase = BKE_tracking_get_active_tracks(tracking);
+ }
/* count sites */
for (track = (MovieTrackingTrack *)tracksbase->first, sites_total = 0; track;
@@ -100,8 +105,9 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_frame);
float pos[2];
- if (marker->flag & MARKER_DISABLED)
+ if (marker->flag & MARKER_DISABLED) {
continue;
+ }
add_v2_v2v2(pos, marker->pos, track->offset);
@@ -112,14 +118,16 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
sites_total++;
}
- if (!sites_total)
+ if (!sites_total) {
return NULL;
+ }
BKE_movieclip_user_set_frame(&user, clip_frame);
ibuf = BKE_movieclip_get_ibuf(this->m_movieClip, &user);
- if (!ibuf)
+ if (!ibuf) {
return NULL;
+ }
triangulation = (TriangulationData *)MEM_callocN(sizeof(TriangulationData),
"keying screen triangulation data");
@@ -133,8 +141,9 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
int j;
float pos[2];
- if (marker->flag & MARKER_DISABLED)
+ if (marker->flag & MARKER_DISABLED) {
continue;
+ }
add_v2_v2v2(pos, marker->pos, track->offset);
@@ -225,8 +234,9 @@ void *KeyingScreenOperation::initializeTileData(rcti *rect)
int chunk_size = 20;
int i;
- if (this->m_movieClip == NULL)
+ if (this->m_movieClip == NULL) {
return NULL;
+ }
if (!this->m_cachedTriangulation) {
lockMutex();
@@ -238,8 +248,9 @@ void *KeyingScreenOperation::initializeTileData(rcti *rect)
triangulation = this->m_cachedTriangulation;
- if (!triangulation)
+ if (!triangulation) {
return NULL;
+ }
tile_data = (TileData *)MEM_callocN(sizeof(TileData), "keying screen tile data");
diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cpp b/source/blender/compositor/operations/COM_MapRangeOperation.cpp
index 489f0dabdaf..46bd015163b 100644
--- a/source/blender/compositor/operations/COM_MapRangeOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapRangeOperation.cpp
@@ -73,10 +73,12 @@ void MapRangeOperation::executePixelSampled(float output[4],
value = (value - source_min) / (source_max - source_min);
value = dest_min + value * (dest_max - dest_min);
}
- else if (value > BLENDER_ZMAX)
+ else if (value > BLENDER_ZMAX) {
value = dest_max;
- else
+ }
+ else {
value = dest_min;
+ }
if (this->m_useClamp) {
if (dest_max > dest_min) {
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp
index 98b5b650cb9..21d432b9222 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp
@@ -64,10 +64,12 @@ void MapUVOperation::executePixelSampled(float output[4],
float dv = len_v2(deriv[1]);
float factor = 1.0f - threshold * (du / m_inputColorProgram->getWidth() +
dv / m_inputColorProgram->getHeight());
- if (factor < 0.0f)
+ if (factor < 0.0f) {
alpha = 0.0f;
- else
+ }
+ else {
alpha *= factor;
+ }
/* "premul" */
if (alpha < 1.0f) {
diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp
index d99a68a5e00..45104d11210 100644
--- a/source/blender/compositor/operations/COM_MapValueOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp
@@ -39,12 +39,16 @@ void MapValueOperation::executePixelSampled(float output[4],
this->m_inputOperation->readSampled(src, x, y, sampler);
TexMapping *texmap = this->m_settings;
float value = (src[0] + texmap->loc[0]) * texmap->size[0];
- if (texmap->flag & TEXMAP_CLIP_MIN)
- if (value < texmap->min[0])
+ if (texmap->flag & TEXMAP_CLIP_MIN) {
+ if (value < texmap->min[0]) {
value = texmap->min[0];
- if (texmap->flag & TEXMAP_CLIP_MAX)
- if (value > texmap->max[0])
+ }
+ }
+ if (texmap->flag & TEXMAP_CLIP_MAX) {
+ if (value > texmap->max[0]) {
value = texmap->max[0];
+ }
+ }
output[0] = value;
}
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index b3251d32005..15dbd4e2ac9 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -124,10 +124,12 @@ void MathDivideOperation::executePixelSampled(float output[4],
this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler);
- if (inputValue2[0] == 0) /* We don't want to divide by zero. */
+ if (inputValue2[0] == 0) { /* We don't want to divide by zero. */
output[0] = 0.0;
- else
+ }
+ else {
output[0] = inputValue1[0] / inputValue2[0];
+ }
clampIfNeeded(output);
}
@@ -191,10 +193,12 @@ void MathArcSineOperation::executePixelSampled(float output[4],
this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler);
- if (inputValue1[0] <= 1 && inputValue1[0] >= -1)
+ if (inputValue1[0] <= 1 && inputValue1[0] >= -1) {
output[0] = asin(inputValue1[0]);
- else
+ }
+ else {
output[0] = 0.0;
+ }
clampIfNeeded(output);
}
@@ -210,10 +214,12 @@ void MathArcCosineOperation::executePixelSampled(float output[4],
this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler);
- if (inputValue1[0] <= 1 && inputValue1[0] >= -1)
+ if (inputValue1[0] <= 1 && inputValue1[0] >= -1) {
output[0] = acos(inputValue1[0]);
- else
+ }
+ else {
output[0] = 0.0;
+ }
clampIfNeeded(output);
}
@@ -273,10 +279,12 @@ void MathLogarithmOperation::executePixelSampled(float output[4],
this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler);
- if (inputValue1[0] > 0 && inputValue2[0] > 0)
+ if (inputValue1[0] > 0 && inputValue2[0] > 0) {
output[0] = log(inputValue1[0]) / log(inputValue2[0]);
- else
+ }
+ else {
output[0] = 0.0;
+ }
clampIfNeeded(output);
}
@@ -372,10 +380,12 @@ void MathModuloOperation::executePixelSampled(float output[4],
this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler);
- if (inputValue2[0] == 0)
+ if (inputValue2[0] == 0) {
output[0] = 0.0;
- else
+ }
+ else {
output[0] = fmod(inputValue1[0], inputValue2[0]);
+ }
clampIfNeeded(output);
}
@@ -461,10 +471,12 @@ void MathSqrtOperation::executePixelSampled(float output[4],
this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
- if (inputValue1[0] > 0)
+ if (inputValue1[0] > 0) {
output[0] = sqrt(inputValue1[0]);
- else
+ }
+ else {
output[0] = 0.0f;
+ }
clampIfNeeded(output);
}
diff --git a/source/blender/compositor/operations/COM_MixOperation.cpp b/source/blender/compositor/operations/COM_MixOperation.cpp
index 8e09586aaa8..a610cb0d1e8 100644
--- a/source/blender/compositor/operations/COM_MixOperation.cpp
+++ b/source/blender/compositor/operations/COM_MixOperation.cpp
@@ -185,42 +185,54 @@ void MixBurnOperation::executePixelSampled(float output[4], float x, float y, Pi
float valuem = 1.0f - value;
tmp = valuem + value * inputColor2[0];
- if (tmp <= 0.0f)
+ if (tmp <= 0.0f) {
output[0] = 0.0f;
+ }
else {
tmp = 1.0f - (1.0f - inputColor1[0]) / tmp;
- if (tmp < 0.0f)
+ if (tmp < 0.0f) {
output[0] = 0.0f;
- else if (tmp > 1.0f)
+ }
+ else if (tmp > 1.0f) {
output[0] = 1.0f;
- else
+ }
+ else {
output[0] = tmp;
+ }
}
tmp = valuem + value * inputColor2[1];
- if (tmp <= 0.0f)
+ if (tmp <= 0.0f) {
output[1] = 0.0f;
+ }
else {
tmp = 1.0f - (1.0f - inputColor1[1]) / tmp;
- if (tmp < 0.0f)
+ if (tmp < 0.0f) {
output[1] = 0.0f;
- else if (tmp > 1.0f)
+ }
+ else if (tmp > 1.0f) {
output[1] = 1.0f;
- else
+ }
+ else {
output[1] = tmp;
+ }
}
tmp = valuem + value * inputColor2[2];
- if (tmp <= 0.0f)
+ if (tmp <= 0.0f) {
output[2] = 0.0f;
+ }
else {
tmp = 1.0f - (1.0f - inputColor1[2]) / tmp;
- if (tmp < 0.0f)
+ if (tmp < 0.0f) {
output[2] = 0.0f;
- else if (tmp > 1.0f)
+ }
+ else if (tmp > 1.0f) {
output[2] = 1.0f;
- else
+ }
+ else {
output[2] = tmp;
+ }
}
output[3] = inputColor1[3];
@@ -365,18 +377,24 @@ void MixDivideOperation::executePixelSampled(float output[4],
}
float valuem = 1.0f - value;
- if (inputColor2[0] != 0.0f)
+ if (inputColor2[0] != 0.0f) {
output[0] = valuem * (inputColor1[0]) + value * (inputColor1[0]) / inputColor2[0];
- else
+ }
+ else {
output[0] = 0.0f;
- if (inputColor2[1] != 0.0f)
+ }
+ if (inputColor2[1] != 0.0f) {
output[1] = valuem * (inputColor1[1]) + value * (inputColor1[1]) / inputColor2[1];
- else
+ }
+ else {
output[1] = 0.0f;
- if (inputColor2[2] != 0.0f)
+ }
+ if (inputColor2[2] != 0.0f) {
output[2] = valuem * (inputColor1[2]) + value * (inputColor1[2]) / inputColor2[2];
- else
+ }
+ else {
output[2] = 0.0f;
+ }
output[3] = inputColor1[3];
@@ -411,48 +429,60 @@ void MixDodgeOperation::executePixelSampled(float output[4],
if (inputColor1[0] != 0.0f) {
tmp = 1.0f - value * inputColor2[0];
- if (tmp <= 0.0f)
+ if (tmp <= 0.0f) {
output[0] = 1.0f;
+ }
else {
tmp = inputColor1[0] / tmp;
- if (tmp > 1.0f)
+ if (tmp > 1.0f) {
output[0] = 1.0f;
- else
+ }
+ else {
output[0] = tmp;
+ }
}
}
- else
+ else {
output[0] = 0.0f;
+ }
if (inputColor1[1] != 0.0f) {
tmp = 1.0f - value * inputColor2[1];
- if (tmp <= 0.0f)
+ if (tmp <= 0.0f) {
output[1] = 1.0f;
+ }
else {
tmp = inputColor1[1] / tmp;
- if (tmp > 1.0f)
+ if (tmp > 1.0f) {
output[1] = 1.0f;
- else
+ }
+ else {
output[1] = tmp;
+ }
}
}
- else
+ else {
output[1] = 0.0f;
+ }
if (inputColor1[2] != 0.0f) {
tmp = 1.0f - value * inputColor2[2];
- if (tmp <= 0.0f)
+ if (tmp <= 0.0f) {
output[2] = 1.0f;
+ }
else {
tmp = inputColor1[2] / tmp;
- if (tmp > 1.0f)
+ if (tmp > 1.0f) {
output[2] = 1.0f;
- else
+ }
+ else {
output[2] = tmp;
+ }
}
}
- else
+ else {
output[2] = 0.0f;
+ }
output[3] = inputColor1[3];
@@ -482,12 +512,15 @@ void MixGlareOperation::executePixelSampled(float output[4],
value = inputValue[0];
float mf = 2.0f - 2.0f * fabsf(value - 0.5f);
- if (inputColor1[0] < 0.0f)
+ if (inputColor1[0] < 0.0f) {
inputColor1[0] = 0.0f;
- if (inputColor1[1] < 0.0f)
+ }
+ if (inputColor1[1] < 0.0f) {
inputColor1[1] = 0.0f;
- if (inputColor1[2] < 0.0f)
+ }
+ if (inputColor1[2] < 0.0f) {
inputColor1[2] = 0.0f;
+ }
output[0] = mf * max(inputColor1[0] + value * (inputColor2[0] - inputColor1[0]), 0.0f);
output[1] = mf * max(inputColor1[1] + value * (inputColor2[1] - inputColor1[1]), 0.0f);
@@ -565,20 +598,26 @@ void MixLightenOperation::executePixelSampled(float output[4],
}
float tmp;
tmp = value * inputColor2[0];
- if (tmp > inputColor1[0])
+ if (tmp > inputColor1[0]) {
output[0] = tmp;
- else
+ }
+ else {
output[0] = inputColor1[0];
+ }
tmp = value * inputColor2[1];
- if (tmp > inputColor1[1])
+ if (tmp > inputColor1[1]) {
output[1] = tmp;
- else
+ }
+ else {
output[1] = inputColor1[1];
+ }
tmp = value * inputColor2[2];
- if (tmp > inputColor1[2])
+ if (tmp > inputColor1[2]) {
output[2] = tmp;
- else
+ }
+ else {
output[2] = inputColor1[2];
+ }
output[3] = inputColor1[3];
clampIfNeeded(output);
@@ -608,18 +647,24 @@ void MixLinearLightOperation::executePixelSampled(float output[4],
if (this->useValueAlphaMultiply()) {
value *= inputColor2[3];
}
- if (inputColor2[0] > 0.5f)
+ if (inputColor2[0] > 0.5f) {
output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0] - 0.5f));
- else
+ }
+ else {
output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0]) - 1.0f);
- if (inputColor2[1] > 0.5f)
+ }
+ if (inputColor2[1] > 0.5f) {
output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1] - 0.5f));
- else
+ }
+ else {
output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1]) - 1.0f);
- if (inputColor2[2] > 0.5f)
+ }
+ if (inputColor2[2] > 0.5f) {
output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2] - 0.5f));
- else
+ }
+ else {
output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f);
+ }
output[3] = inputColor1[3];
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
index ce7973fdc99..c5757274143 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp
@@ -42,11 +42,13 @@ void MovieClipBaseOperation::initExecution()
BKE_movieclip_user_set_frame(this->m_movieClipUser, this->m_framenumber);
ImBuf *ibuf;
- if (this->m_cacheFrame)
+ if (this->m_cacheFrame) {
ibuf = BKE_movieclip_get_ibuf(this->m_movieClip, this->m_movieClipUser);
- else
+ }
+ else {
ibuf = BKE_movieclip_get_ibuf_flag(
this->m_movieClip, this->m_movieClipUser, this->m_movieClip->flag, MOVIECLIP_CACHE_SKIP);
+ }
if (ibuf) {
this->m_movieClipBuffer = ibuf;
diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
index 14542f1e65a..9876c319944 100644
--- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp
@@ -72,8 +72,9 @@ void MultilayerColorOperation::executePixelSampled(float output[4],
int yi = y;
int xi = x;
if (xi < 0 || yi < 0 || (unsigned int)xi >= this->getWidth() ||
- (unsigned int)yi >= this->getHeight())
+ (unsigned int)yi >= this->getHeight()) {
zero_v4(output);
+ }
else {
int offset = (yi * this->getWidth() + xi) * 3;
copy_v3_v3(output, &this->m_imageFloatBuffer[offset]);
@@ -94,8 +95,9 @@ void MultilayerValueOperation::executePixelSampled(float output[4],
int yi = y;
int xi = x;
if (xi < 0 || yi < 0 || (unsigned int)xi >= this->getWidth() ||
- (unsigned int)yi >= this->getHeight())
+ (unsigned int)yi >= this->getHeight()) {
output[0] = 0.0f;
+ }
else {
float result = this->m_imageFloatBuffer[yi * this->getWidth() + xi];
output[0] = result;
@@ -115,8 +117,9 @@ void MultilayerVectorOperation::executePixelSampled(float output[4],
int yi = y;
int xi = x;
if (xi < 0 || yi < 0 || (unsigned int)xi >= this->getWidth() ||
- (unsigned int)yi >= this->getHeight())
+ (unsigned int)yi >= this->getHeight()) {
output[0] = 0.0f;
+ }
else {
int offset = (yi * this->getWidth() + xi) * 3;
copy_v3_v3(output, &this->m_imageFloatBuffer[offset]);
diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
index 703ffbe3999..da594be2268 100644
--- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp
+++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp
@@ -42,10 +42,12 @@ void NormalizeOperation::executePixel(float output[4], int x, int y, void *data)
output[0] = (output[0] - minmult->x) * minmult->y;
/* clamp infinities */
- if (output[0] > 1.0f)
+ if (output[0] > 1.0f) {
output[0] = 1.0f;
- else if (output[0] < 0.0f)
+ }
+ else if (output[0] < 0.0f) {
output[0] = 0.0f;
+ }
}
void NormalizeOperation::deinitExecution()
@@ -62,8 +64,9 @@ bool NormalizeOperation::determineDependingAreaOfInterest(rcti * /*input*/,
rcti *output)
{
rcti imageInput;
- if (this->m_cachedInstance)
+ if (this->m_cachedInstance) {
return false;
+ }
NodeOperation *operation = getInputOperation(0);
imageInput.xmax = operation->getWidth();
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl
index ebe8a6d08ec..4dfca1777f1 100644
--- a/source/blender/compositor/operations/COM_OpenCLKernels.cl
+++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl
@@ -26,22 +26,22 @@
const sampler_t SAMPLER_NEAREST = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
const sampler_t SAMPLER_NEAREST_CLAMP = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
-__constant const int2 zero = {0,0};
+__constant const int zero = {0,0};
// KERNEL --- BOKEH BLUR ---
__kernel void bokehBlurKernel(__read_only image2d_t boundingBox, __read_only image2d_t inputImage,
__read_only image2d_t bokehImage, __write_only image2d_t output,
- int2 offsetInput, int2 offsetOutput, int radius, int step, int2 dimension, int2 offset)
+ int offsetInput, int offsetOutput, int radius, int step, int dimension, int offset)
{
- int2 coords = {get_global_id(0), get_global_id(1)};
+ int coords = {get_global_id(0), get_global_id(1)};
coords += offset;
float tempBoundingBox;
- float4 color = {0.0f,0.0f,0.0f,0.0f};
- float4 multiplyer = {0.0f,0.0f,0.0f,0.0f};
- float4 bokeh;
+ float color = {0.0f,0.0f,0.0f,0.0f};
+ float multiplyer = {0.0f,0.0f,0.0f,0.0f};
+ float bokeh;
const float radius2 = radius*2.0f;
- const int2 realCoordinate = coords + offsetOutput;
- int2 imageCoordinates = realCoordinate - offsetInput;
+ const int realCoordinate = coords + offsetOutput;
+ int imageCoordinates = realCoordinate - offsetInput;
tempBoundingBox = read_imagef(boundingBox, SAMPLER_NEAREST, coords).s0;
diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
index 62ba896f38e..f6cbb8f69c1 100644
--- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
@@ -66,14 +66,16 @@ void *OutputOpenExrSingleLayerMultiViewOperation::get_handle(const char *filenam
exrhandle = IMB_exr_get_handle_name(filename);
- if (!BKE_scene_multiview_is_render_view_first(this->m_rd, this->m_viewName))
+ if (!BKE_scene_multiview_is_render_view_first(this->m_rd, this->m_viewName)) {
return exrhandle;
+ }
IMB_exr_clear_channels(exrhandle);
for (srv = (SceneRenderView *)this->m_rd->views.first; srv; srv = srv->next) {
- if (BKE_scene_multiview_is_render_view_active(this->m_rd, srv) == false)
+ if (BKE_scene_multiview_is_render_view_active(this->m_rd, srv) == false) {
continue;
+ }
IMB_exr_add_view(exrhandle, srv->name);
add_exr_channels(exrhandle, NULL, this->m_datatype, srv->name, width, false, NULL);
@@ -166,20 +168,22 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename
/* get a new global handle */
exrhandle = IMB_exr_get_handle_name(filename);
- if (!BKE_scene_multiview_is_render_view_first(this->m_rd, this->m_viewName))
+ if (!BKE_scene_multiview_is_render_view_first(this->m_rd, this->m_viewName)) {
return exrhandle;
+ }
IMB_exr_clear_channels(exrhandle);
/* check renderdata for amount of views */
for (srv = (SceneRenderView *)this->m_rd->views.first; srv; srv = srv->next) {
- if (BKE_scene_multiview_is_render_view_active(this->m_rd, srv) == false)
+ if (BKE_scene_multiview_is_render_view_active(this->m_rd, srv) == false) {
continue;
+ }
IMB_exr_add_view(exrhandle, srv->name);
- for (unsigned int i = 0; i < this->m_layers.size(); ++i)
+ for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
add_exr_channels(exrhandle,
this->m_layers[i].name,
this->m_layers[i].datatype,
@@ -187,6 +191,7 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename
width,
this->m_exr_half_float,
NULL);
+ }
}
BLI_make_existing_file(filename);
@@ -224,7 +229,7 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinitExecution()
exrhandle = this->get_handle(filename);
- for (unsigned int i = 0; i < this->m_layers.size(); ++i)
+ for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
add_exr_channels(exrhandle,
this->m_layers[i].name,
this->m_layers[i].datatype,
@@ -232,6 +237,7 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinitExecution()
width,
this->m_exr_half_float,
this->m_layers[i].outputBuffer);
+ }
for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
/* memory can only be freed after we write all views to the file */
@@ -284,13 +290,15 @@ void *OutputStereoOperation::get_handle(const char *filename)
exrhandle = IMB_exr_get_handle_name(filename);
- if (!BKE_scene_multiview_is_render_view_first(this->m_rd, this->m_viewName))
+ if (!BKE_scene_multiview_is_render_view_first(this->m_rd, this->m_viewName)) {
return exrhandle;
+ }
IMB_exr_clear_channels(exrhandle);
- for (i = 0; i < 2; i++)
+ for (i = 0; i < 2; i++) {
IMB_exr_add_view(exrhandle, names[i]);
+ }
return exrhandle;
}
@@ -359,8 +367,9 @@ void OutputStereoOperation::deinitExecution()
BKE_imbuf_write(ibuf[2], filename, this->m_format);
/* imbuf knows which rects are not part of ibuf */
- for (i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++) {
IMB_freeImBuf(ibuf[i]);
+ }
IMB_exr_close(exrhandle);
}
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index f83ce478bd5..79e3b2f1108 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -86,8 +86,9 @@ void free_exr_channels(void *exrhandle,
for (srv = (SceneRenderView *)rd->views.first; srv; srv = srv->next) {
float *rect = NULL;
- if (BKE_scene_multiview_is_render_view_active(rd, srv) == false)
+ if (BKE_scene_multiview_is_render_view_active(rd, srv) == false) {
continue;
+ }
/* the pointer is stored in the first channel of each datatype */
switch (datatype) {
@@ -103,8 +104,9 @@ void free_exr_channels(void *exrhandle,
default:
break;
}
- if (rect)
+ if (rect) {
MEM_freeN(rect);
+ }
}
}
@@ -129,8 +131,9 @@ static float *init_buffer(unsigned int width, unsigned int height, DataType data
int size = get_datatype_size(datatype);
return (float *)MEM_callocN(width * height * size * sizeof(float), "OutputFile buffer");
}
- else
+ else {
return NULL;
+ }
}
static void write_buffer_rect(rcti *rect,
@@ -143,8 +146,9 @@ static void write_buffer_rect(rcti *rect,
float color[4];
int i, size = get_datatype_size(datatype);
- if (!buffer)
+ if (!buffer) {
return;
+ }
int x1 = rect->xmin;
int y1 = rect->ymin;
int x2 = rect->xmax;
@@ -158,12 +162,14 @@ static void write_buffer_rect(rcti *rect,
for (x = x1; x < x2 && (!breaked); x++) {
reader->readSampled(color, x, y, COM_PS_NEAREST);
- for (i = 0; i < size; ++i)
+ for (i = 0; i < size; ++i) {
buffer[offset + i] = color[i];
+ }
offset += size;
- if (tree->test_break && tree->test_break(tree->tbh))
+ if (tree->test_break && tree->test_break(tree->tbh)) {
breaked = true;
+ }
}
offset += (width - (x2 - x1)) * size;
}
@@ -240,10 +246,12 @@ void OutputSingleLayerOperation::deinitExecution()
true,
suffix);
- if (0 == BKE_imbuf_write(ibuf, filename, this->m_format))
+ if (0 == BKE_imbuf_write(ibuf, filename, this->m_format)) {
printf("Cannot save Node File Output to %s\n", filename);
- else
+ }
+ else {
printf("Saved: %s\n", filename);
+ }
IMB_freeImBuf(ibuf);
}
@@ -304,13 +312,14 @@ void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int /*
{
for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
OutputOpenExrLayer &layer = this->m_layers[i];
- if (layer.imageInput)
+ if (layer.imageInput) {
write_buffer_rect(rect,
this->m_tree,
layer.imageInput,
layer.outputBuffer,
this->getWidth(),
layer.datatype);
+ }
}
}
@@ -336,8 +345,9 @@ void OutputOpenExrMultiLayerOperation::deinitExecution()
for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
OutputOpenExrLayer &layer = this->m_layers[i];
- if (!layer.imageInput)
+ if (!layer.imageInput) {
continue; /* skip unconnected sockets */
+ }
add_exr_channels(exrhandle,
this->m_layers[i].name,
diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp
index 63640d43973..90bc859a1bb 100644
--- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp
+++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp
@@ -43,13 +43,16 @@ static bool check_corners(float corners[4][2])
sub_v2_v2v2(v2, corners[next], corners[i]);
cur_cross = cross_v2v2(v1, v2);
- if (fabsf(cur_cross) <= FLT_EPSILON)
+ if (fabsf(cur_cross) <= FLT_EPSILON) {
return false;
+ }
- if (cross == 0.0f)
+ if (cross == 0.0f) {
cross = cur_cross;
- else if (cross * cur_cross < 0.0f)
+ }
+ else if (cross * cur_cross < 0.0f) {
return false;
+ }
}
return true;
@@ -205,9 +208,11 @@ void *PlaneCornerPinWarpImageOperation::initializeTileData(rcti *rect)
bool PlaneCornerPinWarpImageOperation::determineDependingAreaOfInterest(
rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
- for (int i = 0; i < 4; ++i)
- if (getInputOperation(i + 1)->determineDependingAreaOfInterest(input, readOperation, output))
+ for (int i = 0; i < 4; ++i) {
+ if (getInputOperation(i + 1)->determineDependingAreaOfInterest(input, readOperation, output)) {
return true;
+ }
+ }
/* XXX this is bad, but unavoidable with the current design:
* we don't know the actual corners and matrix at this point,
diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp b/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp
index 76ecabb8c8b..c2fe41eea1d 100644
--- a/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp
+++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp
@@ -46,8 +46,9 @@ void PlaneTrackCommon::readCornersFromTrack(float corners[4][2], float frame)
MovieTracking *tracking;
MovieTrackingObject *object;
- if (!this->m_movieClip)
+ if (!this->m_movieClip) {
return;
+ }
tracking = &this->m_movieClip->tracking;
diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
index 40299d33306..32933f1b966 100644
--- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
@@ -97,8 +97,9 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(
void ProjectorLensDistortionOperation::updateDispersion()
{
- if (this->m_dispersionAvailable)
+ if (this->m_dispersionAvailable) {
return;
+ }
this->lockMutex();
if (!this->m_dispersionAvailable) {
float result[4];
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
index e7f33cd2c79..3c0b01874aa 100644
--- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
@@ -47,8 +47,9 @@ void RenderLayersProg::initExecution()
Render *re = (scene) ? RE_GetSceneRender(scene) : NULL;
RenderResult *rr = NULL;
- if (re)
+ if (re) {
rr = RE_AcquireResultRead(re);
+ }
if (rr) {
ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, getLayerId());
@@ -74,12 +75,15 @@ void RenderLayersProg::doInterpolation(float output[4], float x, float y, PixelS
int ix = x, iy = y;
if (ix < 0 || iy < 0 || ix >= width || iy >= height) {
- if (this->m_elementsize == 1)
+ if (this->m_elementsize == 1) {
output[0] = 0.0f;
- else if (this->m_elementsize == 3)
+ }
+ else if (this->m_elementsize == 3) {
zero_v3(output);
- else
+ }
+ else {
zero_v4(output);
+ }
return;
}
@@ -87,12 +91,15 @@ void RenderLayersProg::doInterpolation(float output[4], float x, float y, PixelS
case COM_PS_NEAREST: {
offset = (iy * width + ix) * this->m_elementsize;
- if (this->m_elementsize == 1)
+ if (this->m_elementsize == 1) {
output[0] = this->m_inputBuffer[offset];
- else if (this->m_elementsize == 3)
+ }
+ else if (this->m_elementsize == 3) {
copy_v3_v3(output, &this->m_inputBuffer[offset]);
- else
+ }
+ else {
copy_v4_v4(output, &this->m_inputBuffer[offset]);
+ }
break;
}
@@ -185,8 +192,9 @@ void RenderLayersProg::determineResolution(unsigned int resolution[2],
resolution[0] = 0;
resolution[1] = 0;
- if (re)
+ if (re) {
rr = RE_AcquireResultRead(re);
+ }
if (rr) {
ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&sce->view_layers, getLayerId());
@@ -199,8 +207,9 @@ void RenderLayersProg::determineResolution(unsigned int resolution[2],
}
}
- if (re)
+ if (re) {
RE_ReleaseResult(re);
+ }
}
/* ******** Render Layers AO Operation ******** */
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
index eeefb2a9f3b..738f7ed31ba 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
@@ -125,8 +125,9 @@ bool ScreenLensDistortionOperation::get_delta(float r_sq,
distort_uv(uv, t, delta);
return true;
}
- else
+ else {
return false;
+ }
}
void ScreenLensDistortionOperation::accumulate(MemoryBuffer *buffer,
@@ -182,12 +183,15 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y,
accumulate(buffer, 0, 1, uv_dot, uv, delta, sum, count);
accumulate(buffer, 1, 2, uv_dot, uv, delta, sum, count);
- if (count[0])
+ if (count[0]) {
output[0] = 2.0f * sum[0] / (float)count[0];
- if (count[1])
+ }
+ if (count[1]) {
output[1] = 2.0f * sum[1] / (float)count[1];
- if (count[2])
+ }
+ if (count[2]) {
output[2] = 2.0f * sum[2] / (float)count[2];
+ }
/* set alpha */
output[3] = 1.0f;
diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp
index f23057bbe8e..4cc9d7a748c 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.cpp
+++ b/source/blender/compositor/operations/COM_TextureOperation.cpp
@@ -132,10 +132,12 @@ void TextureBaseOperation::executePixelSampled(float output[4],
retval = multitex_ext(
this->m_texture, vec, NULL, NULL, 0, &texres, thread_id, m_pool, m_sceneColorManage, false);
- if (texres.talpha)
+ if (texres.talpha) {
output[3] = texres.ta;
- else
+ }
+ else {
output[3] = texres.tin;
+ }
if ((retval & TEX_RGB)) {
output[0] = texres.tr;
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
index 178a9b57cba..e497d58732b 100644
--- a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
@@ -52,8 +52,9 @@ void TrackPositionOperation::initExecution()
zero_v2(this->m_markerPos);
zero_v2(this->m_relativePos);
- if (!this->m_movieClip)
+ if (!this->m_movieClip) {
return;
+ }
tracking = &this->m_movieClip->tracking;
@@ -121,10 +122,12 @@ void TrackPositionOperation::executePixelSampled(float output[4],
{
output[0] = this->m_markerPos[this->m_axis] - this->m_relativePos[this->m_axis];
- if (this->m_axis == 0)
+ if (this->m_axis == 0) {
output[0] *= this->m_width;
- else
+ }
+ else {
output[0] *= this->m_height;
+ }
}
void TrackPositionOperation::determineResolution(unsigned int resolution[2],
diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
index 26e688e1c97..fb86b04cff7 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
@@ -178,10 +178,12 @@ void zbuf_alloc_span(ZSpan *zspan, int rectx, int recty, float clipcrop)
void zbuf_free_span(ZSpan *zspan)
{
if (zspan) {
- if (zspan->span1)
+ if (zspan->span1) {
MEM_freeN(zspan->span1);
- if (zspan->span2)
+ }
+ if (zspan->span2) {
MEM_freeN(zspan->span2);
+ }
zspan->span1 = zspan->span2 = NULL;
}
}
@@ -213,18 +215,22 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
my0 = ceil(minv[1]);
my2 = floor(maxv[1]);
- if (my2 < 0 || my0 >= zspan->recty)
+ if (my2 < 0 || my0 >= zspan->recty) {
return;
+ }
/* clip top */
- if (my2 >= zspan->recty)
+ if (my2 >= zspan->recty) {
my2 = zspan->recty - 1;
+ }
/* clip bottom */
- if (my0 < 0)
+ if (my0 < 0) {
my0 = 0;
+ }
- if (my0 > my2)
+ if (my0 > my2) {
return;
+ }
/* if (my0>my2) should still fill in, that way we get spans that skip nicely */
xx1 = maxv[1] - minv[1];
@@ -258,10 +264,12 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
if (zspan->maxp1 == NULL || zspan->maxp1[1] < maxv[1]) {
zspan->maxp1 = maxv;
}
- if (my0 < zspan->miny1)
+ if (my0 < zspan->miny1) {
zspan->miny1 = my0;
- if (my2 > zspan->maxy1)
+ }
+ if (my2 > zspan->maxy1) {
zspan->maxy1 = my2;
+ }
}
else {
// printf("right span my0 %d my2 %d\n", my0, my2);
@@ -271,10 +279,12 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
if (zspan->maxp2 == NULL || zspan->maxp2[1] < maxv[1]) {
zspan->maxp2 = maxv;
}
- if (my0 < zspan->miny2)
+ if (my0 < zspan->miny2) {
zspan->miny2 = my0;
- if (my2 > zspan->maxy2)
+ }
+ if (my2 > zspan->maxy2) {
zspan->maxy2 = my2;
+ }
}
for (y = my2; y >= my0; y--, xs0 += dx0) {
@@ -312,15 +322,17 @@ static void zbuf_fill_in_rgba(
zbuf_add_to_span(zspan, v4, v1);
/* clipped */
- if (zspan->minp2 == NULL || zspan->maxp2 == NULL)
+ if (zspan->minp2 == NULL || zspan->maxp2 == NULL) {
return;
+ }
my0 = max_ii(zspan->miny1, zspan->miny2);
my2 = min_ii(zspan->maxy1, zspan->maxy2);
// printf("my %d %d\n", my0, my2);
- if (my2 < my0)
+ if (my2 < my0) {
return;
+ }
/* ZBUF DX DY, in floats still */
x1 = v1[0] - v2[0];
@@ -333,8 +345,9 @@ static void zbuf_fill_in_rgba(
y0 = z1 * x2 - x1 * z2;
z0 = x1 * y2 - y1 * x2;
- if (z0 == 0.0f)
+ if (z0 == 0.0f) {
return;
+ }
xx1 = (x0 * v1[0] + y0 * v1[1]) / z0 + v1[2];
@@ -364,10 +377,12 @@ static void zbuf_fill_in_rgba(
sn2 = floor(*span2);
sn1++;
- if (sn2 >= rectx)
+ if (sn2 >= rectx) {
sn2 = rectx - 1;
- if (sn1 < 0)
+ }
+ if (sn1 < 0) {
sn1 = 0;
+ }
if (sn2 >= sn1) {
zverg = (double)sn1 * zxd + zy0;
@@ -409,8 +424,9 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
row3 = row2 + xsize;
for (x = 2; x < xsize; x++, row1++, row2++, row3++) {
if (row2[1]) {
- if (row2[0] == 0 || row2[2] == 0 || row1[1] == 0 || row3[1] == 0)
+ if (row2[0] == 0 || row2[2] == 0 || row1[1] == 0 || row3[1] == 0) {
row2[1] = 128;
+ }
}
}
}
@@ -424,8 +440,9 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
/* find previous color and next color and amount of steps to blend */
prev = row1[-1];
step = 1;
- while (x + step < xsize && row1[step] == 128)
+ while (x + step < xsize && row1[step] == 128) {
step++;
+ }
if (x + step != xsize) {
/* now we can blend values */
@@ -455,8 +472,9 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
/* find previous color and next color and amount of steps to blend */
prev = row1[-xsize];
step = 1;
- while (y + step < ysize && row1[step * xsize] == 128)
+ while (y + step < ysize && row1[step * xsize] == 128) {
step++;
+ }
if (y + step != ysize) {
/* now we can blend values */
@@ -483,8 +501,9 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
row3 = row2 + xsize;
for (x = 2; x < xsize; x++, row1++, row2++, row3++) {
if (row2[1] == 0) {
- if (row2[0] > 1 || row2[2] > 1 || row1[1] > 1 || row3[1] > 1)
+ if (row2[0] > 1 || row2[2] > 1 || row1[1] > 1 || row3[1] > 1) {
row2[1] = 1;
+ }
}
}
}
@@ -567,8 +586,9 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
tsktsk = 1;
}
}
- if (tsktsk)
+ if (tsktsk) {
printf("Found uninitialized speed in vector buffer... fixed.\n");
+ }
/* min speed? then copy speedbuffer to recalculate speed vectors */
if (nbd->minspeed) {
@@ -605,15 +625,19 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
dvz = rectvz;
for (y = 0; y <= ysize; y++) {
- if (y == 0)
+ if (y == 0) {
dvec1 = vecbufrect + 4 * y * xsize;
- else
+ }
+ else {
dvec1 = vecbufrect + 4 * (y - 1) * xsize;
+ }
- if (y == ysize)
+ if (y == ysize) {
dvec2 = vecbufrect + 4 * (y - 1) * xsize;
- else
+ }
+ else {
dvec2 = vecbufrect + 4 * y * xsize;
+ }
for (x = 0; x <= xsize; x++) {
@@ -698,8 +722,9 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
dm = rectmove;
dvec1 = vecbufrect;
for (x = xsize * ysize; x > 0; x--, dm++, dvec1 += 4) {
- if ((dvec1[0] != 0.0f || dvec1[1] != 0.0f || dvec1[2] != 0.0f || dvec1[3] != 0.0f))
+ if ((dvec1[0] != 0.0f || dvec1[1] != 0.0f || dvec1[2] != 0.0f || dvec1[3] != 0.0f)) {
*dm = 255;
+ }
}
antialias_tagbuf(xsize, ysize, rectmove);
@@ -722,20 +747,26 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
float blendfac, ipodata[4];
/* clear zbuf, if we draw future we fill in not moving pixels */
- if (0)
- for (x = xsize * ysize - 1; x >= 0; x--)
+ if (0) {
+ for (x = xsize * ysize - 1; x >= 0; x--) {
rectz[x] = 10e16;
- else
+ }
+ }
+ else {
for (x = xsize * ysize - 1; x >= 0; x--) {
- if (rectmove[x] == 0)
+ if (rectmove[x] == 0) {
rectz[x] = zbufrect[x];
- else
+ }
+ else {
rectz[x] = 10e16;
+ }
}
+ }
/* clear drawing buffer */
- for (x = xsize * ysize - 1; x >= 0; x--)
+ for (x = xsize * ysize - 1; x >= 0; x--) {
rectdraw[x].colpoin = NULL;
+ }
dimg = imgrect;
dm = rectmove;
@@ -790,12 +821,15 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
v3, speedfac * dz2[4] + jfx + 1.0f, speedfac * dz2[5] + jfy + 1.0f, *dz);
ARRAY_SET_ITEMS(v4, speedfac * dz2[0] + jfx, speedfac * dz2[1] + jfy + 1.0f, *dz);
}
- if (*dm == 255)
+ if (*dm == 255) {
col.alpha = 1.0f;
- else if (*dm < 2)
+ }
+ else if (*dm < 2) {
col.alpha = 0.0f;
- else
+ }
+ else {
col.alpha = ((float)*dm) / 255.0f;
+ }
col.colpoin = dimg;
zbuf_fill_in_rgba(&zspan, &col, v1, v2, v3, v4);
@@ -858,7 +892,8 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
MEM_freeN(rectvz);
MEM_freeN(rectweight);
MEM_freeN(rectmax);
- if (minvecbufrect)
+ if (minvecbufrect) {
MEM_freeN(vecbufrect); /* rects were swapped! */
+ }
zbuf_free_span(&zspan);
}
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index fcf6a2a731d..5c82fe7db2f 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -82,8 +82,9 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/)
{
float *buffer = this->m_outputBuffer;
float *depthbuffer = this->m_depthBuffer;
- if (!buffer)
+ if (!buffer) {
return;
+ }
const int x1 = rect->xmin;
const int y1 = rect->ymin;
const int x2 = rect->xmax;
@@ -149,8 +150,9 @@ void ViewerOperation::initImage()
ibuf->x = getWidth();
ibuf->y = getHeight();
/* zero size can happen if no image buffers exist to define a sensible resolution */
- if (ibuf->x > 0 && ibuf->y > 0)
+ if (ibuf->x > 0 && ibuf->y > 0) {
imb_addrectfloatImBuf(ibuf);
+ }
ima->ok = IMA_OK_LOADED;
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h
index 29c3b6d8075..9a6239ca32e 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerOperation.h
@@ -53,8 +53,9 @@ class ViewerOperation : public NodeOperation {
void executeRegion(rcti *rect, unsigned int tileNumber);
bool isOutputOperation(bool /*rendering*/) const
{
- if (G.background)
+ if (G.background) {
return false;
+ }
return isActiveViewerOutput();
}
void setImage(Image *image)
diff --git a/source/blender/compositor/operations/COM_WrapOperation.cpp b/source/blender/compositor/operations/COM_WrapOperation.cpp
index e55f63f7d73..cb119fb4f1d 100644
--- a/source/blender/compositor/operations/COM_WrapOperation.cpp
+++ b/source/blender/compositor/operations/COM_WrapOperation.cpp
@@ -25,19 +25,23 @@ WrapOperation::WrapOperation(DataType datatype) : ReadBufferOperation(datatype)
inline float WrapOperation::getWrappedOriginalXPos(float x)
{
- if (this->getWidth() == 0)
+ if (this->getWidth() == 0) {
return 0;
- while (x < 0)
+ }
+ while (x < 0) {
x += this->m_width;
+ }
return fmodf(x, this->getWidth());
}
inline float WrapOperation::getWrappedOriginalYPos(float y)
{
- if (this->getHeight() == 0)
+ if (this->getHeight() == 0) {
return 0;
- while (y < 0)
+ }
+ while (y < 0) {
y += this->m_height;
+ }
return fmodf(y, this->getHeight());
}