[Bf-blender-cvs] [1c870f4] master: Compositor: Cleanup, don't shortcut float values

Sergey Sharybin noreply at git.blender.org
Sun Feb 14 10:13:43 CET 2016


Commit: 1c870f46e79c6378488bd84ed9ffbb40affae464
Author: Sergey Sharybin
Date:   Sun Feb 14 10:12:45 2016 +0100
Branches: master
https://developer.blender.org/rB1c870f46e79c6378488bd84ed9ffbb40affae464

Compositor: Cleanup, don't shortcut float values

Use 0.0f instead of 0.f and so on.

===================================================================

M	source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
M	source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
M	source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
M	source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
M	source/blender/compositor/operations/COM_ColorMatteOperation.cpp
M	source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
M	source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
M	source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
M	source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
M	source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
M	source/blender/compositor/operations/COM_GlareGhostOperation.cpp
M	source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
M	source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
M	source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
M	source/blender/compositor/operations/COM_MapUVOperation.cpp
M	source/blender/compositor/operations/COM_MixOperation.cpp
M	source/blender/compositor/operations/COM_NormalizeOperation.cpp
M	source/blender/compositor/operations/COM_TonemapOperation.cpp

===================================================================

diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
index 1449484..3faffc1 100644
--- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
@@ -110,7 +110,7 @@ void ChannelMatteOperation::executePixelSampled(float output[4], float x, float
 		alpha = inColor[3]; /*whatever it was prior */
 	}
 	else if (alpha < limit_min) {
-		alpha = 0.f;
+		alpha = 0.0f;
 	}
 	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 9a20ca4..bc6389c 100644
--- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
@@ -84,16 +84,16 @@ void ChromaMatteOperation::executePixelSampled(float output[4], float x, float y
 
 	/*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.0f));
 
-	if (kfg > 0.f) {  /* found a pixel that is within key color */
+	if (kfg > 0.0f) {  /* found a pixel that is within key color */
 		alpha = 1.0f - (kfg / gain);
 
 		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.0f)) {
+			alpha = 0.0f;
 		}
 
 		/* don't make something that was more transparent less transparent */
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
index fb97e45..3482f63 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
@@ -28,7 +28,7 @@ inline float colorbalance_cdl(float in, float offset, float power, float slope)
 	float x = in * slope + offset;
 
 	/* prevent NaN */
-	if (x < 0.f) x = 0.f;
+	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 9588687..627bbb7 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
@@ -33,7 +33,7 @@ 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.f) x = 0.f;
+	if (x < 0.0f) x = 0.0f;
 
 	return powf(srgb_to_linearrgb(x), gamma_inv);
 }
diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
index b928141..c95811e 100644
--- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
@@ -72,7 +72,7 @@ void ColorMatteOperation::executePixelSampled(float output[4], float x, float y,
 	    /* 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.0f * fabsf(inColor[0] - inKey[0])) < hue || (2.0f - h_wrap) < hue)
 	    )
 	{
 		output[0] = 0.0f; /* make transparent */
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
index fa9a957..7fdd10a 100644
--- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
@@ -79,8 +79,8 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], float x
 	float radius;
 	this->m_inputOperation->readSampled(inputValue, x, y, sampler);
 	z = inputValue[0];
-	if (z != 0.f) {
-		float iZ = (1.f / z);
+	if (z != 0.0f) {
+		float iZ = (1.0f / z);
 		
 		// bug #6656 part 2b, do not rescale
 #if 0
@@ -88,7 +88,7 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], float x
 		// scale crad back to original maximum and blend
 		crad->rect[px] = bcrad + wts->rect[px] * (scf * crad->rect[px] - bcrad);
 #endif
-		radius = 0.5f * fabsf(this->m_aperture * (this->m_dof_sp * (this->m_inverseFocalDistance - iZ) - 1.f));
+		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) radius = 0.0f;
 		if (radius > this->m_maxRadius) {
diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
index 48160d5..40b4fde 100644
--- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
@@ -79,8 +79,8 @@ void DisplaceSimpleOperation::executePixelSampled(float output[4], float x, floa
 	/* 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.0f, this->getWidth() - 1.0f);
+	CLAMP(v, 0.0f, this->getHeight() - 1.0f);
 
 	this->m_inputColorProgram->readSampled(output, u, v, sampler);
 }
diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
index 072ca10..b9e6864 100644
--- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
@@ -71,7 +71,7 @@ void DistanceRGBMatteOperation::executePixelSampled(float output[4], float x, fl
  
 	/*make 100% transparent */
 	if (distance < tolerance) {
-		output[0] = 0.f;
+		output[0] = 0.0f;
 	}
 	/*in the falloff region, make partially transparent */
 	else if (distance < falloff + tolerance) {
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index 968319b..b83ebdd 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -91,7 +91,7 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect)
 		this->m_sx = this->m_data.sizex * this->m_size / 2.0f;
 		this->m_sy = this->m_data.sizey * this->m_size / 2.0f;
 		
-		if ((this->m_sx == this->m_sy) && (this->m_sx > 0.f)) {
+		if ((this->m_sx == this->m_sy) && (this->m_sx > 0.0f)) {
 			for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c)
 				IIR_gauss(copy, this->m_sx, c, 3);
 		}
diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
index 04993b0..d452a74 100644
--- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
@@ -274,15 +274,15 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
 	data2 = (fREAL *)MEM_callocN(w2 * h2 * sizeof(fREAL), "convolve_fast FHT data2");
 
 	// normalize convolutor
-	wt[0] = wt[1] = wt[2] = 0.f;
+	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++)
 			add_v3_v3(wt, colp[x]);
 	}
-	if (wt[0] != 0.f) wt[0] = 1.f / wt[0];
-	if (wt[1] != 0.f) wt[1] = 1.f / wt[1];
-	if (wt[2] != 0.f) wt[2] = 1.f / wt[2];
+	if (wt[0] != 0.0f) wt[0] = 1.0f / wt[0];
+	if (wt[1] != 0.0f) wt[1] = 1.0f / wt[1];
+	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++)
@@ -375,7 +375,7 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile,
 	fRGB fcol;
 	MemoryBuffer *ckrn;
 	unsigned int sz = 1 << settings->size;
-	const float cs_r = 1.f, cs_g = 1.f, cs_b = 1.f;
+	const float cs_r = 1.0f, cs_g = 1.0f, cs_b = 1.0f;
 
 	// temp. src image
 	// make the convolution kernel
@@ -386,14 +386,14 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile,
 	scale = 0.25f * sqrtf((float)(sz * sz));
 
 	for (y = 0; y < sz; ++y) {
-		v = 2.f * (y / (float)sz) - 1.0f;
+		v = 2.0f * (y / (float)sz) - 1.0f;
 		for (x = 0; x < sz; ++x) {
-			u = 2.f * (x / (float)sz) - 1.0f;
+			u = 2.0f * (x / (float)sz) - 1.0f;
 			r = (u * u + v * v) * scale;
 			d = -sqrtf(sqrtf(sqrtf(r))) * 9.0f;
 			fcol[0] = expf(d * cs_r), fcol[1] = expf(d * cs_g), fcol[2] = expf(d * cs_b);
 			// linear window good enough here, visual result counts, not scientific analysis
-			//w = (1.f-fabs(u))*(1.f-fabs(v));
+			//w = (1.0f-fabs(u))*(1.0f-fabs(v));
 			// actually, Hanning window is ok, cos^2 for some reason is slower
 			w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI));
 			mul_v3_fl(fcol, w);
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
index eea6588..9bef5ac 100644
--- a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
@@ -40,11 +40,11 @@ static float smoothMask(float x, float y)
 void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings)
 {
 	const int qt = 1 << settings->quality;
-	const float s1 = 4.f / (float)qt, s2 = 2.f * s1;
+	const float s1 = 4.0f / (float)qt, s2 = 2.0f * s1;
 	int x, y, n, p, np;
 	fRGB c, tc, cm[64];
 	flo

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list