Cycles Denoising: Speedup reconstruction by skipping near-zero weights

This commit is contained in:
Lukas Stockner 2017-06-09 22:27:49 +02:00
parent f0bbb67e8a
commit 7dc51f87ed
3 changed files with 6 additions and 2 deletions

@ -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));
}
}
}

@ -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,

@ -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);