[Bf-blender-cvs] [6fee3a5db7] temp-cycles-denoising: Cycles Denoising: Remove support for cross-frame denoising
Lukas Stockner
noreply at git.blender.org
Fri Feb 10 18:11:12 CET 2017
Commit: 6fee3a5db7cd645d0f5d5e0673d14f5fff6eec1f
Author: Lukas Stockner
Date: Fri Feb 10 03:38:31 2017 +0100
Branches: temp-cycles-denoising
https://developer.blender.org/rB6fee3a5db7cd645d0f5d5e0673d14f5fff6eec1f
Cycles Denoising: Remove support for cross-frame denoising
===================================================================
M intern/cycles/blender/blender_python.cpp
M intern/cycles/filter/filter_features.h
M intern/cycles/filter/filter_features_sse.h
M intern/cycles/filter/filter_reconstruction.h
M intern/cycles/filter/filter_transform.h
M intern/cycles/filter/filter_transform_cuda.h
M intern/cycles/filter/filter_transform_sse.h
M intern/cycles/kernel/kernel_types.h
M intern/cycles/render/buffers.cpp
M intern/cycles/render/buffers.h
M intern/cycles/render/denoising.cpp
M intern/cycles/render/denoising.h
M intern/cycles/render/film.cpp
M intern/cycles/render/session.cpp
M intern/cycles/render/session.h
===================================================================
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp
index 6f3ebb851f..0cdb55b21a 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -768,12 +768,11 @@ static PyObject *denoise_files_func(PyObject * /*self*/, PyObject *args, PyObjec
session_params.samples = 128;
session_params.threads = 0;
- PyObject *pyframelist;
- int midframe, half_output = 0, use_gpu = 0;
- const char *output = NULL;
+ int half_output = 0, use_gpu = 0;
+ const char *output = NULL, *filename = NULL;
- static const char* keylist[] = {"frames", "midframe", "output", "half_float", "use_gpu", "samples", "threads", "tile_x", "tile_y", "filter_strength", "filter_weight_adjust"};
- if(!PyArg_ParseTupleAndKeywords(args, keywords, "Ois|ppiiiiff", const_cast<char **>(keylist), &pyframelist, &midframe, &output, &half_output, &use_gpu,
+ static const char* keylist[] = {"filename", "output", "half_float", "use_gpu", "samples", "threads", "tile_x", "tile_y", "filter_strength", "filter_weight_adjust"};
+ if(!PyArg_ParseTupleAndKeywords(args, keywords, "ss|ppiiiiff", const_cast<char **>(keylist), &filename, &output, &half_output, &use_gpu,
&session_params.samples, &session_params.threads, &session_params.tile_size.x, &session_params.tile_size.y,
&session_params.filter_strength, &session_params.filter_weight_adjust)) {
return NULL;
@@ -784,17 +783,7 @@ static PyObject *denoise_files_func(PyObject * /*self*/, PyObject *args, PyObjec
BL::UserPreferences b_userpref(get_user_preferences());
session_params.device = BlenderSync::get_device_info(b_userpref, use_gpu);
- int numframes = PyList_Size(pyframelist);
- if(numframes < 1) {
- Py_RETURN_FALSE;
- }
-
- vector<string> frames;
- for(int i = 0; i < numframes; i++) {
- frames.push_back(_PyUnicode_AsString(PyList_GetItem(pyframelist, i)));
- }
-
- if(denoise_standalone(session_params, frames, midframe)) {
+ if(denoise_standalone(session_params, filename)) {
Py_RETURN_TRUE;
}
Py_RETURN_FALSE;
diff --git a/intern/cycles/filter/filter_features.h b/intern/cycles/filter/filter_features.h
index 96b2db960d..678f255d37 100644
--- a/intern/cycles/filter/filter_features.h
+++ b/intern/cycles/filter/filter_features.h
@@ -20,19 +20,6 @@
/* Loop over the pixels in the range [low.x, high.x) x [low.y, high.y).
* pixel_buffer always points to the current pixel in the first pass. */
-#ifdef DENOISE_TEMPORAL
-#define FOR_PIXEL_WINDOW pixel_buffer = buffer + (low.y - rect.y)*buffer_w + (low.x - rect.x); \
- for(int t = 0; t < num_frames; t++) { \
- pixel.z = (t == 0)? 0: ((t <= prev_frames)? (t-prev_frames-1): (t - prev_frames)); \
- for(pixel.y = low.y; pixel.y < high.y; pixel.y++) { \
- for(pixel.x = low.x; pixel.x < high.x; pixel.x++, pixel_buffer++) {
-
-#define END_FOR_PIXEL_WINDOW } \
- pixel_buffer += buffer_w - (high.x - low.x); \
- } \
- pixel_buffer += buffer_w * (buffer_h - (high.y - low.y)); \
- }
-#else
#define FOR_PIXEL_WINDOW pixel_buffer = buffer + (low.y - rect.y)*buffer_w + (low.x - rect.x); \
for(pixel.y = low.y; pixel.y < high.y; pixel.y++) { \
for(pixel.x = low.x; pixel.x < high.x; pixel.x++, pixel_buffer++) {
@@ -40,24 +27,19 @@
#define END_FOR_PIXEL_WINDOW } \
pixel_buffer += buffer_w - (high.x - low.x); \
}
-#endif
-ccl_device_inline void filter_get_features(int3 pixel, float ccl_readonly_ptr buffer, float *features, float ccl_readonly_ptr mean, int pass_stride)
+ccl_device_inline void filter_get_features(int2 pixel, float ccl_readonly_ptr buffer, float *features, float ccl_readonly_ptr mean, int pass_stride)
{
- float *feature = features;
- *(feature++) = pixel.x;
- *(feature++) = pixel.y;
-#ifdef DENOISE_TEMPORAL
- *(feature++) = pixel.z;
-#endif
- *(feature++) = ccl_get_feature(0);
- *(feature++) = ccl_get_feature(1);
- *(feature++) = ccl_get_feature(2);
- *(feature++) = ccl_get_feature(3);
- *(feature++) = ccl_get_feature(4);
- *(feature++) = ccl_get_feature(5);
- *(feature++) = ccl_get_feature(6);
- *(feature++) = ccl_get_feature(7);
+ features[0] = pixel.x;
+ features[1] = pixel.y;
+ features[2] = ccl_get_feature(0);
+ features[3] = ccl_get_feature(1);
+ features[4] = ccl_get_feature(2);
+ features[5] = ccl_get_feature(3);
+ features[6] = ccl_get_feature(4);
+ features[7] = ccl_get_feature(5);
+ features[8] = ccl_get_feature(6);
+ features[9] = ccl_get_feature(7);
if(mean) {
for(int i = 0; i < DENOISE_FEATURES; i++)
features[i] -= mean[i];
@@ -69,52 +51,28 @@ ccl_device_inline void filter_get_features(int3 pixel, float ccl_readonly_ptr bu
#endif
}
-ccl_device_inline void filter_get_feature_scales(int3 pixel, float ccl_readonly_ptr buffer, float *scales, float ccl_readonly_ptr mean, int pass_stride)
+ccl_device_inline void filter_get_feature_scales(int2 pixel, float ccl_readonly_ptr buffer, float *scales, float ccl_readonly_ptr mean, int pass_stride)
{
- *(scales++) = fabsf(pixel.x - *(mean++)); //X
- *(scales++) = fabsf(pixel.y - *(mean++)); //Y
-#ifdef DENOISE_TEMPORAL
- *(scales++) = fabsf(pixel.z - *(mean++)); //T
-#endif
-
- *(scales++) = fabsf(ccl_get_feature(0) - *(mean++)); //Depth
-
- float normalS = len_squared(make_float3(ccl_get_feature(1) - mean[0], ccl_get_feature(2) - mean[1], ccl_get_feature(3) - mean[2]));
- mean += 3;
- *(scales++) = normalS; //NormalX
- *(scales++) = normalS; //NormalY
- *(scales++) = normalS; //NormalZ
-
- *(scales++) = fabsf(ccl_get_feature(4) - *(mean++)); //Shadow
-
- float normalT = len_squared(make_float3(ccl_get_feature(5) - mean[0], ccl_get_feature(6) - mean[1], ccl_get_feature(7) - mean[2]));
- mean += 3;
- *(scales++) = normalT; //AlbedoR
- *(scales++) = normalT; //AlbedoG
- *(scales++) = normalT; //AlbedoB
+ scales[0] = fabsf(pixel.x - mean[0]);
+ scales[1] = fabsf(pixel.y - mean[1]);
+ scales[2] = fabsf(ccl_get_feature(0) - mean[2]);
+ scales[3] = len_squared(make_float3(ccl_get_feature(1) - mean[3],
+ ccl_get_feature(2) - mean[4],
+ ccl_get_feature(3) - mean[5]));
+ scales[4] = fabsf(ccl_get_feature(4) - mean[6]);
+ scales[5] = len_squared(make_float3(ccl_get_feature(5) - mean[7],
+ ccl_get_feature(6) - mean[8],
+ ccl_get_feature(7) - mean[9]));
}
ccl_device_inline void filter_calculate_scale(float *scale)
{
- scale[0] = 1.0f/max(scale[0], 0.01f); //X
- scale[1] = 1.0f/max(scale[1], 0.01f); //Y
- scale += 2;
-#ifdef DENOISE_TEMPORAL
- scale[0] = 1.0f/max(scale[0], 0.01f); //T
- scale++;
-#endif
-
- scale[0] = 1.0f/max(scale[0], 0.01f); //Depth
-
- scale[1] = 1.0f/max(sqrtf(scale[1]), 0.01f); //NormalX
- scale[2] = 1.0f/max(sqrtf(scale[2]), 0.01f); //NormalY
- scale[3] = 1.0f/max(sqrtf(scale[3]), 0.01f); //NormalZ
-
- scale[4] = 1.0f/max(scale[4], 0.01f); //Shadow
-
- scale[5] = 1.0f/max(sqrtf(scale[5]), 0.01f); //AlbedoR
- scale[6] = 1.0f/max(sqrtf(scale[6]), 0.01f); //AlbedoG
- scale[7] = 1.0f/max(sqrtf(scale[7]), 0.01f); //AlbedoB
+ scale[0] = 1.0f/max(scale[0], 0.01f);
+ scale[1] = 1.0f/max(scale[1], 0.01f);
+ scale[2] = 1.0f/max(scale[2], 0.01f);
+ scale[6] = 1.0f/max(scale[4], 0.01f);
+ scale[7] = scale[8] = scale[9] = 1.0f/max(sqrtf(scale[5]), 0.01f);
+ scale[3] = scale[4] = scale[5] = 1.0f/max(sqrtf(scale[3]), 0.01f);
}
ccl_device_inline float3 filter_get_pixel_color(float ccl_readonly_ptr buffer, int pass_stride)
@@ -135,7 +93,7 @@ ccl_device_inline bool filter_firefly_rejection(float3 pixel_color, float pixel_
}
/* Fill the design row without computing the weight. */
-ccl_device_inline void filter_get_design_row_transform(int3 pixel, float ccl_readonly_ptr buffer, float ccl_readonly_ptr feature_means, int pass_stride, float *features, int rank, float *design_row, float ccl_readonly_ptr feature_transform, int transform_stride)
+ccl_device_inline void filter_get_design_row_transform(int2 pixel, float ccl_readonly_ptr buffer, float ccl_readonly_ptr feature_means, int pass_stride, float *features, int rank, float *design_row, float ccl_readonly_ptr feature_transform, int transform_stride)
{
filter_get_features(pixel, buffer, features, feature_means, pass_stride);
design_row[0] = 1.0f;
diff --git a/intern/cycles/filter/filter_features_sse.h b/intern/cycles/filter/filter_features_sse.h
index 7e8803f54d..0ec6150108 100644
--- a/intern/cycles/filter/filter_features_sse.h
+++ b/intern/cycles/filter/filter_features_sse.h
@@ -22,25 +22,8 @@ CCL_NAMESPACE_BEGIN
* pixel_buffer always points to the first of the 4 current pixel in the first pass.
* x4 and y4 contain the coordinates of the four pixels, active_pixels contains a mask that's set for all pixels within the window. */
-#ifdef DENOISE_TEMPORAL
-#define FOR_PIXEL_WINDOW_SSE pixel_buffer = buffer + (low.y - rect.y)*buffer_w + (low.x - rect.x); \
- for(int t = 0; t < num_frames; t++) { \
- __m128 t4 = _mm_set1_ps((t == 0)? 0: ((t <= prev_frames)? (t-prev_frames-1): (t - prev_frames))); \
- for(pixel.y = low.y; pixel.y < high.y; pixel.y++) { \
- __m128 y4 = _mm_set1_ps(pixel.y); \
- for(pixel.x = low.x; pixel.x < high.x; pixel.x += 4, pixel_buffer += 4) { \
- __m128 x4 = _mm_add_ps(_mm_set1_ps(pixel.x), _mm_set_ps(3.0f, 2.0f, 1.0f, 0.0f)); \
- __m128 active_pixels = _mm_cmplt_ps(x4, _mm_set1_ps(high.x));
-
-#define END_FOR_PIXEL_WINDOW_SSE } \
- pixel_buffer += buffer_w - (pixel.x - low.x); \
- } \
- pixel_buffer += buffer_w * (buf
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list