[Bf-blender-cvs] [90a62404cb7] master: Cycles: Cleanup, variable names

Sergey Sharybin noreply at git.blender.org
Fri May 19 12:53:17 CEST 2017


Commit: 90a62404cb74be2d0601d8dd5abbce452c1a5c87
Author: Sergey Sharybin
Date:   Fri May 19 12:52:12 2017 +0200
Branches: master
https://developer.blender.org/rB90a62404cb74be2d0601d8dd5abbce452c1a5c87

Cycles: Cleanup, variable names

Don't use camel case for variable names. Leave that for the structures.

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

M	intern/cycles/kernel/filter/filter_nlm_cpu.h
M	intern/cycles/kernel/filter/filter_nlm_gpu.h
M	intern/cycles/kernel/kernels/cpu/filter_cpu.h
M	intern/cycles/kernel/kernels/cpu/filter_cpu_impl.h
M	intern/cycles/kernel/kernels/cuda/filter.cu
M	intern/cycles/kernel/kernels/opencl/filter.cl

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

diff --git a/intern/cycles/kernel/filter/filter_nlm_cpu.h b/intern/cycles/kernel/filter/filter_nlm_cpu.h
index 57222811992..5cb4038bc33 100644
--- a/intern/cycles/kernel/filter/filter_nlm_cpu.h
+++ b/intern/cycles/kernel/filter/filter_nlm_cpu.h
@@ -17,9 +17,9 @@
 CCL_NAMESPACE_BEGIN
 
 ccl_device_inline void kernel_filter_nlm_calc_difference(int dx, int dy,
-                                                         const float *ccl_restrict weightImage,
-                                                         const float *ccl_restrict varianceImage,
-                                                         float *differenceImage,
+                                                         const float *ccl_restrict weight_image,
+                                                         const float *ccl_restrict variance_image,
+                                                         float *difference_image,
                                                          int4 rect,
                                                          int w,
                                                          int channel_offset,
@@ -31,21 +31,21 @@ ccl_device_inline void kernel_filter_nlm_calc_difference(int dx, int dy,
 			float diff = 0.0f;
 			int numChannels = channel_offset? 3 : 1;
 			for(int c = 0; c < numChannels; c++) {
-				float cdiff = weightImage[c*channel_offset + y*w+x] - weightImage[c*channel_offset + (y+dy)*w+(x+dx)];
-				float pvar = varianceImage[c*channel_offset + y*w+x];
-				float qvar = varianceImage[c*channel_offset + (y+dy)*w+(x+dx)];
+				float cdiff = weight_image[c*channel_offset + y*w+x] - weight_image[c*channel_offset + (y+dy)*w+(x+dx)];
+				float pvar = variance_image[c*channel_offset + y*w+x];
+				float qvar = variance_image[c*channel_offset + (y+dy)*w+(x+dx)];
 				diff += (cdiff*cdiff - a*(pvar + min(pvar, qvar))) / (1e-8f + k_2*(pvar+qvar));
 			}
 			if(numChannels > 1) {
 				diff *= 1.0f/numChannels;
 			}
-			differenceImage[y*w+x] = diff;
+			difference_image[y*w+x] = diff;
 		}
 	}
 }
 
-ccl_device_inline void kernel_filter_nlm_blur(const float *ccl_restrict differenceImage,
-                                              float *outImage,
+ccl_device_inline void kernel_filter_nlm_blur(const float *ccl_restrict difference_image,
+                                              float *out_image,
                                               int4 rect,
                                               int w,
                                               int f)
@@ -58,34 +58,34 @@ ccl_device_inline void kernel_filter_nlm_blur(const float *ccl_restrict differen
 		const int low = max(rect.y, y-f);
 		const int high = min(rect.w, y+f+1);
 		for(int x = rect.x; x < rect.z; x++) {
-			outImage[y*w+x] = 0.0f;
+			out_image[y*w+x] = 0.0f;
 		}
 		for(int y1 = low; y1 < high; y1++) {
 #ifdef __KERNEL_SSE3__
 			for(int x = aligned_lowx; x < aligned_highx; x+=4) {
-				_mm_store_ps(outImage + y*w+x, _mm_add_ps(_mm_load_ps(outImage + y*w+x), _mm_load_ps(differenceImage + y1*w+x)));
+				_mm_store_ps(out_image + y*w+x, _mm_add_ps(_mm_load_ps(out_image + y*w+x), _mm_load_ps(difference_image + y1*w+x)));
 			}
 #else
 			for(int x = rect.x; x < rect.z; x++) {
-				outImage[y*w+x] += differenceImage[y1*w+x];
+				out_image[y*w+x] += difference_image[y1*w+x];
 			}
 #endif
 		}
 		for(int x = rect.x; x < rect.z; x++) {
-			outImage[y*w+x] *= 1.0f/(high - low);
+			out_image[y*w+x] *= 1.0f/(high - low);
 		}
 	}
 }
 
-ccl_device_inline void kernel_filter_nlm_calc_weight(const float *ccl_restrict differenceImage,
-                                                     float *outImage,
+ccl_device_inline void kernel_filter_nlm_calc_weight(const float *ccl_restrict difference_image,
+                                                     float *out_image,
                                                      int4 rect,
                                                      int w,
                                                      int f)
 {
 	for(int y = rect.y; y < rect.w; y++) {
 		for(int x = rect.x; x < rect.z; x++) {
-			outImage[y*w+x] = 0.0f;
+			out_image[y*w+x] = 0.0f;
 		}
 	}
 	for(int dx = -f; dx <= f; dx++) {
@@ -93,7 +93,7 @@ ccl_device_inline void kernel_filter_nlm_calc_weight(const float *ccl_restrict d
 		int neg_dx = min(0, dx);
 		for(int y = rect.y; y < rect.w; y++) {
 			for(int x = rect.x-neg_dx; x < rect.z-pos_dx; x++) {
-				outImage[y*w+x] += differenceImage[y*w+dx+x];
+				out_image[y*w+x] += difference_image[y*w+dx+x];
 			}
 		}
 	}
@@ -101,16 +101,16 @@ ccl_device_inline void kernel_filter_nlm_calc_weight(const float *ccl_restrict d
 		for(int x = rect.x; x < rect.z; x++) {
 			const int low = max(rect.x, x-f);
 			const int high = min(rect.z, x+f+1);
-			outImage[y*w+x] = expf(-max(outImage[y*w+x] * (1.0f/(high - low)), 0.0f));
+			out_image[y*w+x] = expf(-max(out_image[y*w+x] * (1.0f/(high - low)), 0.0f));
 		}
 	}
 }
 
 ccl_device_inline void kernel_filter_nlm_update_output(int dx, int dy,
-                                                       const float *ccl_restrict differenceImage,
+                                                       const float *ccl_restrict difference_image,
                                                        const float *ccl_restrict image,
-                                                       float *outImage,
-                                                       float *accumImage,
+                                                       float *out_image,
+                                                       float *accum_image,
                                                        int4 rect,
                                                        int w,
                                                        int f)
@@ -121,17 +121,17 @@ ccl_device_inline void kernel_filter_nlm_update_output(int dx, int dy,
 			const int high = min(rect.z, x+f+1);
 			float sum = 0.0f;
 			for(int x1 = low; x1 < high; x1++) {
-				sum += differenceImage[y*w+x1];
+				sum += difference_image[y*w+x1];
 			}
 			float weight = sum * (1.0f/(high - low));
-			accumImage[y*w+x] += weight;
-			outImage[y*w+x] += weight*image[(y+dy)*w+(x+dx)];
+			accum_image[y*w+x] += weight;
+			out_image[y*w+x] += weight*image[(y+dy)*w+(x+dx)];
 		}
 	}
 }
 
 ccl_device_inline void kernel_filter_nlm_construct_gramian(int dx, int dy,
-                                                           const float *ccl_restrict differenceImage,
+                                                           const float *ccl_restrict difference_image,
                                                            const float *ccl_restrict buffer,
                                                            float *color_pass,
                                                            float *variance_pass,
@@ -153,7 +153,7 @@ ccl_device_inline void kernel_filter_nlm_construct_gramian(int dx, int dy,
 			const int high = min(rect.z, x+f+1);
 			float sum = 0.0f;
 			for(int x1 = low; x1 < high; x1++) {
-				sum += differenceImage[y*w+x1];
+				sum += difference_image[y*w+x1];
 			}
 			float weight = sum * (1.0f/(high - low));
 
@@ -174,14 +174,14 @@ ccl_device_inline void kernel_filter_nlm_construct_gramian(int dx, int dy,
 	}
 }
 
-ccl_device_inline void kernel_filter_nlm_normalize(float *outImage,
-                                                   const float *ccl_restrict accumImage,
+ccl_device_inline void kernel_filter_nlm_normalize(float *out_image,
+                                                   const float *ccl_restrict accum_image,
                                                    int4 rect,
                                                    int w)
 {
 	for(int y = rect.y; y < rect.w; y++) {
 		for(int x = rect.x; x < rect.z; x++) {
-			outImage[y*w+x] /= accumImage[y*w+x];
+			out_image[y*w+x] /= accum_image[y*w+x];
 		}
 	}
 }
diff --git a/intern/cycles/kernel/filter/filter_nlm_gpu.h b/intern/cycles/kernel/filter/filter_nlm_gpu.h
index fd0a88340ea..078c5f56763 100644
--- a/intern/cycles/kernel/filter/filter_nlm_gpu.h
+++ b/intern/cycles/kernel/filter/filter_nlm_gpu.h
@@ -18,9 +18,9 @@ CCL_NAMESPACE_BEGIN
 
 ccl_device_inline void kernel_filter_nlm_calc_difference(int x, int y,
                                                          int dx, int dy,
-                                                         const ccl_global float *ccl_restrict weightImage,
-                                                         const ccl_global float *ccl_restrict varianceImage,
-                                                         ccl_global float *differenceImage,
+                                                         const ccl_global float *ccl_restrict weight_image,
+                                                         const ccl_global float *ccl_restrict variance_image,
+                                                         ccl_global float *difference_image,
                                                          int4 rect, int w,
                                                          int channel_offset,
                                                          float a, float k_2)
@@ -28,74 +28,74 @@ ccl_device_inline void kernel_filter_nlm_calc_difference(int x, int y,
 	float diff = 0.0f;
 	int numChannels = channel_offset? 3 : 1;
 	for(int c = 0; c < numChannels; c++) {
-		float cdiff = weightImage[c*channel_offset + y*w+x] - weightImage[c*channel_offset + (y+dy)*w+(x+dx)];
-		float pvar = varianceImage[c*channel_offset + y*w+x];
-		float qvar = varianceImage[c*channel_offset + (y+dy)*w+(x+dx)];
+		float cdiff = weight_image[c*channel_offset + y*w+x] - weight_image[c*channel_offset + (y+dy)*w+(x+dx)];
+		float pvar = variance_image[c*channel_offset + y*w+x];
+		float qvar = variance_image[c*channel_offset + (y+dy)*w+(x+dx)];
 		diff += (cdiff*cdiff - a*(pvar + min(pvar, qvar))) / (1e-8f + k_2*(pvar+qvar));
 	}
 	if(numChannels > 1) {
 		diff *= 1.0f/numChannels;
 	}
-	differenceImage[y*w+x] = diff;
+	difference_image[y*w+x] = diff;
 }
 
 ccl_device_inline void kernel_filter_nlm_blur(int x, int y,
-                                              const ccl_global float *ccl_restrict differenceImage,
-        

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list