Cycles: Reuse existing buffer in the NLM denoising kernels on CPU
authorLukas Stockner <lukas.stockner@freenet.de>
Mon, 8 Oct 2018 20:17:06 +0000 (22:17 +0200)
committerLukas Stockner <lukas.stockner@freenet.de>
Mon, 8 Oct 2018 20:17:06 +0000 (22:17 +0200)
intern/cycles/device/device_cpu.cpp
intern/cycles/device/device_denoising.cpp

index 4986bb809fba06aa47d726a885ae711f80450b11..7eb73dea3ef610300d447a4078a6a5ca1ef0333c 100644 (file)
@@ -475,7 +475,6 @@ public:
                float *blurDifference = temporary_mem;
                float *difference     = temporary_mem + task->buffer.pass_stride;
                float *weightAccum    = temporary_mem + 2*task->buffer.pass_stride;
-               float *temp_image     = temporary_mem + 3*task->buffer.pass_stride;
 
                memset(weightAccum, 0, sizeof(float)*w*h);
                memset((float*) out_ptr, 0, sizeof(float)*w*h);
@@ -500,7 +499,7 @@ public:
                        filter_nlm_update_output_kernel()(dx, dy,
                                                          blurDifference,
                                                          (float*) image_ptr,
-                                                         temp_image,
+                                                         difference,
                                                          (float*) out_ptr,
                                                          weightAccum,
                                                          local_rect,
index 3384e1d81fd7850d16b53ebf10b22b8fd2f6ebd7..78c65a3d22d5b1e8ffeaf6a93b85a48f6683f1f3 100644 (file)
@@ -107,7 +107,7 @@ void DenoisingTask::setup_denoising_buffer()
                num_layers = 2*num_shifts + 1;
        }
        else {
-               num_layers = 4;
+               num_layers = 3;
        }
        /* Allocate two layers per shift as well as one for the weight accumulation. */
        buffer.temporary_mem.alloc_to_device(num_layers * buffer.pass_stride);