Commit: 7dc51f87ed239470f8b7a62c48757142bc078ae4
Author: Lukas Stockner
Date:   Fri Jun 9 22:27:49 2017 +0200
Branches: master
https://developer.blender.org/rB7dc51f87ed239470f8b7a62c48757142bc078ae4

Cycles Denoising: Speedup reconstruction by skipping near-zero weights

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

M       intern/cycles/kernel/filter/filter_nlm_cpu.h
M       intern/cycles/kernel/filter/filter_nlm_gpu.h
M       intern/cycles/kernel/filter/filter_reconstruction.h

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

diff --git a/intern/cycles/kernel/filter/filter_nlm_cpu.h 
b/intern/cycles/kernel/filter/filter_nlm_cpu.h
index 88afc00ccb3..3e752bce68f 100644
--- a/intern/cycles/kernel/filter/filter_nlm_cpu.h
+++ b/intern/cycles/kernel/filter/filter_nlm_cpu.h
@@ -101,7 +101,7 @@ 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);
-                       out_image[y*w+x] = expf(-max(out_image[y*w+x] * 
(1.0f/(high - low)), 0.0f));
+                       out_image[y*w+x] = fast_expf(-max(out_image[y*w+x] * 
(1.0f/(high - low)), 0.0f));
                }
        }
 }
diff --git a/intern/cycles/kernel/filter/filter_nlm_gpu.h 
b/intern/cycles/kernel/filter/filter_nlm_gpu.h
index 62bd5be1de5..2c5ac807051 100644
--- a/intern/cycles/kernel/filter/filter_nlm_gpu.h
+++ b/intern/cycles/kernel/filter/filter_nlm_gpu.h
@@ -66,7 +66,7 @@ ccl_device_inline void kernel_filter_nlm_calc_weight(int x, 
int y,
                sum += difference_image[y*w+x1];
        }
        sum *= 1.0f/(high-low);
-       out_image[y*w+x] = expf(-max(sum, 0.0f));
+       out_image[y*w+x] = fast_expf(-max(sum, 0.0f));
 }
 
 ccl_device_inline void kernel_filter_nlm_update_output(int x, int y,
diff --git a/intern/cycles/kernel/filter/filter_reconstruction.h 
b/intern/cycles/kernel/filter/filter_reconstruction.h
index 90a2816ddf7..538d57d3dc9 100644
--- a/intern/cycles/kernel/filter/filter_reconstruction.h
+++ b/intern/cycles/kernel/filter/filter_reconstruction.h
@@ -29,6 +29,10 @@ ccl_device_inline void kernel_filter_construct_gramian(int 
x, int y,
                                                        ccl_global float3 *XtWY,
                                                        int localIdx)
 {
+       if(weight < 1e-3f) {
+               return;
+       }
+
        int p_offset =  y    *w +  x;
        int q_offset = (y+dy)*w + (x+dx);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to