[Bf-blender-cvs] [1926b15] soc-2016-cycles_denoising: Cycles: Remove a few useless temporary files

Lukas Stockner noreply at git.blender.org
Wed Aug 10 03:22:15 CEST 2016


Commit: 1926b15e3bb8234c51f3919fac01645038ea2471
Author: Lukas Stockner
Date:   Tue Aug 9 02:45:32 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB1926b15e3bb8234c51f3919fac01645038ea2471

Cycles: Remove a few useless temporary files

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

D	intern/cycles/kernel/kernel_filter.h.orig
D	intern/cycles/kernel/kernel_filter.h.rej
D	intern/cycles/kernel/kernel_filter_old.h
D	intern/cycles/kernel/kernel_path.h.orig
D	intern/cycles/kernel/kernel_path_branched.h.orig
D	intern/cycles/render/buffers.cpp.orig
D	intern/cycles/render/buffers.h.orig
D	intern/cycles/render/film.cpp.orig
D	intern/cycles/render/film.h.orig
D	intern/cycles/render/integrator.cpp.orig

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

diff --git a/intern/cycles/kernel/kernel_filter.h.orig b/intern/cycles/kernel/kernel_filter.h.orig
deleted file mode 100644
index 7209431..0000000
--- a/intern/cycles/kernel/kernel_filter.h.orig
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * Copyright 2011-2016 Blender Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "util_math_matrix.h"
-
-CCL_NAMESPACE_BEGIN
-
-#define FOR_PIXEL_WINDOW for(int py = low.y; py < high.y; py++) { \
-                             int ytile = (py < tile_y[1])? 0: ((py < tile_y[2])? 1: 2); \
-                                 for(int px = low.x; px < high.x; px++) { \
-                                     int xtile = (px < tile_x[1])? 0: ((px < tile_x[2])? 1: 2); \
-                                     int tile = ytile*3+xtile; \
-                                     buffer = buffers[tile] + (offset[tile] + py*stride[tile] + px)*kernel_data.film.pass_stride + kernel_data.film.pass_denoising;
-
-#define END_FOR_PIXEL_WINDOW }}
-
-#define FEATURE_PASSES 7 /* Normals, Albedo, Depth */
-
-ccl_device_inline void filter_get_features(int x, int y, float *buffer, float sample, float *features, float *mean)
-{
-	float sample_scale = 1.0f/sample;
-	features[0] = buffer[0] * sample_scale;
-	features[1] = buffer[1] * sample_scale;
-	features[2] = buffer[2] * sample_scale;
-	features[3] = buffer[6] * sample_scale;
-	features[4] = buffer[7] * sample_scale;
-	features[5] = buffer[8] * sample_scale;
-	features[6] = buffer[12] * sample_scale;
-	features[7] = x;
-	features[8] = y;
-	if(mean) {
-		for(int i = 0; i < DENOISE_FEATURES; i++)
-			features[i] -= mean[i];
-	}
-#ifdef DENOISE_SECOND_ORDER_SCREEN
-	features[9] = features[7]*features[7];
-	features[10] = features[8]*features[8];
-	features[11] = features[7]*features[8];
-#endif
-}
-
-ccl_device_inline void filter_get_feature_variance(int x, int y, float *buffer, float sample, float *features, float *scale)
-{
-	float sample_scale = 1.0f/sample;
-	float sample_scale_var = 1.0f/(sample - 1.0f);
-	features[0] = saturate(buffer[3] * sample_scale_var) * sample_scale;
-	features[1] = saturate(buffer[4] * sample_scale_var) * sample_scale;
-	features[2] = saturate(buffer[5] * sample_scale_var) * sample_scale;
-	features[3] = saturate(buffer[9] * sample_scale_var) * sample_scale;
-	features[4] = saturate(buffer[10] * sample_scale_var) * sample_scale;
-	features[5] = saturate(buffer[11] * sample_scale_var) * sample_scale;
-	features[6] = saturate(buffer[13] * sample_scale_var) * sample_scale;
-	features[7] = 0.0f;
-	features[8] = 0.0f;
-#ifdef DENOISE_SECOND_ORDER_SCREEN
-	features[9] = 0.0f;
-	features[10] = 0.0f;
-	features[11] = 0.0f;
-#endif
-	for(int i = 0; i < DENOISE_FEATURES; i++)
-		features[i] *= scale[i]*scale[i];
-}
-
-ccl_device_inline float3 filter_get_pixel_color(float *buffer, float sample)
-{
-	float sample_scale = 1.0f/sample;
-	return make_float3(buffer[14], buffer[15], buffer[16]) * sample_scale;
-}
-
-ccl_device_inline float filter_get_pixel_variance(float *buffer, float sample)
-{
-	float sample_scale_var = 1.0f/(sample * (sample - 1.0f));
-	return average(make_float3(buffer[17], buffer[18], buffer[19])) * sample_scale_var;
-}
-
-ccl_device_inline float filter_fill_design_row(float *features, int rank, float *design_row, float *feature_transform, float *bandwidth_factor)
-{
-	design_row[0] = 1.0f;
-	float weight = 1.0f;
-	for(int d = 0; d < rank; d++) {
-		float x = math_dot(features, feature_transform + d*DENOISE_FEATURES, DENOISE_FEATURES);
-		float x2 = x*x;
-		if(bandwidth_factor) x2 *= bandwidth_factor[d]*bandwidth_factor[d];
-		if(x2 < 1.0f) {
-			/* Pixels are weighted by Epanechnikov kernels. */
-			weight *= 0.75f * (1.0f - x2);
-		}
-		else {
-			weight = 0.0f;
-			break;
-		}
-		design_row[1+d] = x;
-		if(!bandwidth_factor) design_row[1+rank+d] = x2;
-	}
-	return weight;
-}
-
-ccl_device_inline bool filter_firefly_rejection(float3 pixel_color, float pixel_variance, float3 center_color, float sqrt_center_variance)
-{
-	float color_diff = average(fabs(pixel_color - center_color));
-	float variance = sqrt_center_variance + sqrtf(pixel_variance) + 0.005f;
-	return (color_diff > 3.0f*variance);
-}
-
-/* Since the filtering may be performed across tile edged, all the neighboring tiles have to be passed along as well.
- * tile_x/y contain the x/y positions of the tile grid, 4 entries each:
- * - Start of the lower/left neighbor
- * - Start of the own tile
- * - Start of the upper/right neighbor
- * - Start of the next upper/right neighbor (not accessed)
- * buffers contains the nine buffer pointers (y-major ordering, starting with the lower left tile), offset and stride the respective parameters of the tile.
- */
-ccl_device void kernel_filter_estimate_params(KernelGlobals *kg, int sample, float **buffers, int x, int y, int *tile_x, int *tile_y, int *offset, int *stride, FilterStorage *storage, int4 filter_rect)
-{
-	storage += (y-filter_rect.y)*(filter_rect.z-filter_rect.x) + (x-filter_rect.x);
-
-	/* Temporary storage, used in different steps of the algorithm. */
-	float tempmatrix[(2*DENOISE_FEATURES+1)*(2*DENOISE_FEATURES+1)], tempvector[2*DENOISE_FEATURES+1];
-	float *buffer, features[DENOISE_FEATURES];
-
-	/* === Get center pixel color and variance. === */
-	float *center_buffer = buffers[4] + (offset[4] + y*stride[4] + x)*kernel_data.film.pass_stride + kernel_data.film.pass_denoising;
-	float3 center_color    = make_float3(center_buffer[14], center_buffer[15], center_buffer[16]) / sample;
-	float sqrt_center_variance = sqrtf(average(make_float3(center_buffer[17], center_buffer[18], center_buffer[19])) / (sample * (sample - 1.0f)));
-
-
-
-
-	/* === Calculate denoising window. === */
-	int2 low  = make_int2(max(tile_x[0], x - kernel_data.integrator.half_window),
-	                      max(tile_y[0], y - kernel_data.integrator.half_window));
-	int2 high = make_int2(min(tile_x[3], x + kernel_data.integrator.half_window + 1),
-	                      min(tile_y[3], y + kernel_data.integrator.half_window + 1));
-
-
-
-
-	/* === Shift feature passes to have mean 0. === */
-	float feature_means[DENOISE_FEATURES] = {0.0f};
-	FOR_PIXEL_WINDOW {
-		filter_get_features(px, py, buffer, sample, features, NULL);
-		for(int i = 0; i < FEATURE_PASSES; i++)
-			feature_means[i] += features[i];
-	} END_FOR_PIXEL_WINDOW
-
-	float pixel_scale = 1.0f / ((high.y - low.y) * (high.x - low.x));
-	for(int i = 0; i < FEATURE_PASSES; i++)
-		feature_means[i] *= pixel_scale;
-	feature_means[7] = x;
-	feature_means[8] = y;
-
-	/* === Scale the shifted feature passes to a range of [-1; 1], will be baked into the transform later. === */
-	float *feature_scale = tempvector;
-	math_vector_zero(feature_scale, DENOISE_FEATURES);
-
-	FOR_PIXEL_WINDOW {
-		filter_get_features(px, py, buffer, sample, features, feature_means);
-		for(int i = 0; i < FEATURE_PASSES; i++)
-			feature_scale[i] = max(feature_scale[i], fabsf(features[i]));
-	} END_FOR_PIXEL_WINDOW
-
-	for(int i = 0; i < FEATURE_PASSES; i++)
-		feature_scale[i] = 1.0f / max(feature_scale[i], 0.01f);
-	feature_scale[7] = feature_scale[8] = 1.0f / kernel_data.integrator.half_window;
-#ifdef DENOISE_SECOND_ORDER_SCREEN
-	feature_scale[9] = feature_scale[10] = feature_scale[11] = 1.0f / (kernel_data.integrator.half_window*kernel_data.integrator.half_window);
-#endif
-
-
-
-
-	/* === Generate the feature transformation. ===
-	 * This transformation maps the DENOISE_FEATURES-dimentional feature space to a reduced feature (r-feature) space
-	 * which generally has fewer dimensions. This mainly helps to prevent overfitting. */
-	float *feature_matrix = tempmatrix, *perturbation_matrix = tempmatrix + DENOISE_FEATURES*DENOISE_FEATURES;
-	math_matrix_zero_lower(feature_matrix, DENOISE_FEATURES);
-	math_matrix_zero_lower(perturbation_matrix, DENOISE_FEATURES);
-	FOR_PIXEL_WINDOW {
-		filter_get_features(px, py, buffer, sample, features, feature_means);
-		for(int i = 0; i < FEATURE_PASSES; i++)
-			features[i] *= feature_scale[i];
-		math_add_gramian(feature_matrix, DENOISE_FEATURES, features, 1.0f);
-
-		filter_get_feature_variance(px, py, buffer, sample, features, feature_scale);
-		math_add_gramian(perturbation_matrix, DENOISE_FEATURES, features, 1.0f);
-	} END_FOR_PIXEL_WINDOW
-	math_lower_tri_to_full(feature_matrix, DENOISE_FEATURES);
-
-	float *feature_transform = &storage->transform[0], *singular = tempvector + DENOISE_FEATURES;
-	int rank = svd(feature_matrix, feature_transform, singular, DENOISE_FEATURES);
-
-	float *eigenvector_guess = tempvector + DENOISE_FEATURES;
-	for(int i = 0; i < DENOISE_FEATURES; i++)
-		eigenvector_guess[i] = 1.0f;
-	float singular_threshold = 0.01f + 2.0f * sqrtf(math_largest_eigenvalue(perturbation_matrix, DENOISE_FEATURES, eigenvector_guess, tempvector + 2*DENOISE_FEATURES));
-	if (x%100== 0 && y%100 == 0) {
-		for(int r = 0; r < DENOISE_FEATURES; r++) {
-			int c;
-			for(c = 0; c <= r; c++) printf("%f ", (double) perturbation_matrix[r*DENOISE_FEATURES+c]);
-			for(; c < DENOISE_FEATURES; c++) printf("%f ", (double) perturbation_matrix[c*DENOISE_FEATURES+r]);
-			printf("\n");
-		}
-		printf("Singular val: %f\n", (double) (0.5f*(singular_threshold - 0.01f)));
-	}
-
-	rank = 0;
-	for(int i = 0; i < DENOISE_FEATURES; i++, rank++) {
-		float s = sqrtf(singular[i]);
-		if(i >= 2 && s < singular_threshold)
-			break;
-		/* Bake the feature scaling into the transformation matrix. */
-		for(int j = 0; j < DENOISE_FEATURES; j++)
-			feature_transform[rank*DENOISE_FEATURES + j] *= feature_scale[j];
-	}
-
-#ifdef WITH_CYCLES_DEBUG_FILTER
-	storage->feature_matrix_norm = 0.0f;//feature_matrix_norm;
-	storage->singular_threshold = singular_threshold;
-	for(int i = 0; i < DENOISE_FEATURES; i++

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list