[Bf-blender-cvs] [0be2b57] soc-2016-cycles_denoising: Cycles: Clamp optimal bandwidth parameter to the range of evaluated parameters
Lukas Stockner
noreply at git.blender.org
Sat Dec 3 02:26:41 CET 2016
Commit: 0be2b5773818eeee7fa2885a44ca1935add05bdd
Author: Lukas Stockner
Date: Fri Dec 2 23:31:45 2016 +0100
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB0be2b5773818eeee7fa2885a44ca1935add05bdd
Cycles: Clamp optimal bandwidth parameter to the range of evaluated parameters
===================================================================
M intern/cycles/kernel/filter/filter_wlr.h
M intern/cycles/kernel/filter/filter_wlr_cuda.h
M intern/cycles/kernel/filter/filter_wlr_sse.h
===================================================================
diff --git a/intern/cycles/kernel/filter/filter_wlr.h b/intern/cycles/kernel/filter/filter_wlr.h
index 8a32834..d5fab6e 100644
--- a/intern/cycles/kernel/filter/filter_wlr.h
+++ b/intern/cycles/kernel/filter/filter_wlr.h
@@ -315,7 +315,7 @@ ccl_device void kernel_filter_estimate_wlr_params(KernelGlobals *kg, int sample,
#endif
/* === Store the calculated data for the second kernel. === */
- storage->global_bandwidth = optimal_bw;
+ storage->global_bandwidth = clamp(optimal_bw, 0.05f, 2.0f);
}
CCL_NAMESPACE_END
\ No newline at end of file
diff --git a/intern/cycles/kernel/filter/filter_wlr_cuda.h b/intern/cycles/kernel/filter/filter_wlr_cuda.h
index 273b94f..8dcc447 100644
--- a/intern/cycles/kernel/filter/filter_wlr_cuda.h
+++ b/intern/cycles/kernel/filter/filter_wlr_cuda.h
@@ -281,7 +281,8 @@ ccl_device void kernel_filter_calculate_bandwidth(KernelGlobals *kg, int sample,
/* === Estimate optimal global bandwidth. === */
double bias_coef = bias_XtY / bias_XtX;
double variance_coef = var_XtY / var_XtX;
- storage->global_bandwidth = (float) pow((storage->rank * variance_coef) / (4.0 * bias_coef*bias_coef * sample), 1.0 / (storage->rank + 4));
+ float optimal_bw = (float) pow((storage->rank * variance_coef) / (4.0 * bias_coef*bias_coef * sample), 1.0 / (storage->rank + 4));
+ storage->global_bandwidth = clamp(optimal_bw, 0.05f, 2.0f);
}
CCL_NAMESPACE_END
\ No newline at end of file
diff --git a/intern/cycles/kernel/filter/filter_wlr_sse.h b/intern/cycles/kernel/filter/filter_wlr_sse.h
index f84f224..a0829d0 100644
--- a/intern/cycles/kernel/filter/filter_wlr_sse.h
+++ b/intern/cycles/kernel/filter/filter_wlr_sse.h
@@ -294,7 +294,7 @@ ccl_device void kernel_filter_estimate_wlr_params(KernelGlobals *kg, int sample,
#endif
/* === Store the calculated data for the second kernel. === */
- storage->global_bandwidth = optimal_bw;
+ storage->global_bandwidth = clamp(optimal_bw, 0.05f, 2.0f);
}
CCL_NAMESPACE_END
\ No newline at end of file
More information about the Bf-blender-cvs
mailing list