Cycles: Implement denoising option for reducing noise in the rendered image
[blender.git] / intern / cycles / kernel / kernels / cpu / filter_cpu.h
1 /*
2  * Copyright 2011-2017 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /* Templated common declaration part of all CPU kernels. */
18
19 void KERNEL_FUNCTION_FULL_NAME(filter_divide_shadow)(int sample,
20                                                      TilesInfo *tiles,
21                                                      int x,
22                                                      int y,
23                                                      float *unfilteredA,
24                                                      float *unfilteredB,
25                                                      float *sampleV,
26                                                      float *sampleVV,
27                                                      float *bufferV,
28                                                      int* prefilter_rect,
29                                                      int buffer_pass_stride,
30                                                      int buffer_denoising_offset,
31                                                      bool use_split_variance);
32
33 void KERNEL_FUNCTION_FULL_NAME(filter_get_feature)(int sample,
34                                                    TilesInfo *tiles,
35                                                    int m_offset,
36                                                    int v_offset,
37                                                    int x,
38                                                    int y,
39                                                    float *mean,
40                                                    float *variance,
41                                                    int* prefilter_rect,
42                                                    int buffer_pass_stride,
43                                                    int buffer_denoising_offset,
44                                                    bool use_split_variance);
45
46 void KERNEL_FUNCTION_FULL_NAME(filter_combine_halves)(int x, int y,
47                                                       float *mean,
48                                                       float *variance,
49                                                       float *a,
50                                                       float *b,
51                                                       int* prefilter_rect,
52                                                       int r);
53
54 void KERNEL_FUNCTION_FULL_NAME(filter_construct_transform)(float* buffer,
55                                                            int x,
56                                                            int y,
57                                                            int storage_ofs,
58                                                            float *transform,
59                                                            int *rank,
60                                                            int* rect,
61                                                            int pass_stride,
62                                                            int radius,
63                                                            float pca_threshold);
64
65 void KERNEL_FUNCTION_FULL_NAME(filter_nlm_calc_difference)(int dx,
66                                                            int dy,
67                                                            float *weightImage,
68                                                            float *variance,
69                                                            float *differenceImage,
70                                                            int* rect,
71                                                            int w,
72                                                            int channel_offset,
73                                                            float a,
74                                                            float k_2);
75
76 void KERNEL_FUNCTION_FULL_NAME(filter_nlm_blur)(float *differenceImage,
77                                                 float *outImage,
78                                                 int* rect,
79                                                 int w,
80                                                 int f);
81
82 void KERNEL_FUNCTION_FULL_NAME(filter_nlm_calc_weight)(float *differenceImage,
83                                                        float *outImage,
84                                                        int* rect,
85                                                        int w,
86                                                        int f);
87
88 void KERNEL_FUNCTION_FULL_NAME(filter_nlm_update_output)(int dx,
89                                                          int dy,
90                                                          float *differenceImage,
91                                                          float *image,
92                                                          float *outImage,
93                                                          float *accumImage,
94                                                          int* rect,
95                                                          int w,
96                                                          int f);
97
98 void KERNEL_FUNCTION_FULL_NAME(filter_nlm_construct_gramian)(int dx,
99                                                              int dy,
100                                                              float *differenceImage,
101                                                              float *buffer,
102                                                              float *color_pass,
103                                                              float *variance_pass,
104                                                              float *transform,
105                                                              int *rank,
106                                                              float *XtWX,
107                                                              float3 *XtWY,
108                                                              int *rect,
109                                                              int *filter_rect,
110                                                              int w,
111                                                              int h,
112                                                              int f,
113                                                              int pass_stride);
114
115 void KERNEL_FUNCTION_FULL_NAME(filter_nlm_normalize)(float *outImage,
116                                                      float *accumImage,
117                                                      int* rect,
118                                                      int w);
119
120 void KERNEL_FUNCTION_FULL_NAME(filter_finalize)(int x,
121                                                 int y,
122                                                 int storage_ofs,
123                                                 int w,
124                                                 int h,
125                                                 float *buffer,
126                                                 int *rank,
127                                                 float *XtWX,
128                                                 float3 *XtWY,
129                                                 int *buffer_params,
130                                                 int sample);
131
132 #undef KERNEL_ARCH