1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "BLI_math_vec_types.hh"
#include "GPU_texture.h"
#include "COM_context.hh"
namespace blender::realtime_compositor {
/* --------------------------------------------------------------------
* Sum Reductions.
*/
/* Computes the sum of the red channel of all pixels in the given texture. */
float sum_red(Context &context, GPUTexture *texture);
/* Computes the sum of the green channel of all pixels in the given texture. */
float sum_green(Context &context, GPUTexture *texture);
/* Computes the sum of the blue channel of all pixels in the given texture. */
float sum_blue(Context &context, GPUTexture *texture);
/* Computes the sum of the luminance of all pixels in the given texture, using the given luminance
* coefficients to compute the luminance. */
float sum_luminance(Context &context, GPUTexture *texture, float3 luminance_coefficients);
/* Computes the sum of the logarithm of the luminance of all pixels in the given texture, using the
* given luminance coefficients to compute the luminance. */
float sum_log_luminance(Context &context, GPUTexture *texture, float3 luminance_coefficients);
/* Computes the sum of the colors of all pixels in the given texture. */
float4 sum_color(Context &context, GPUTexture *texture);
/* --------------------------------------------------------------------
* Sum Of Squared Difference Reductions.
*/
/* Computes the sum of the squared difference between the red channel of all pixels in the given
* texture and the given subtrahend. This can be used to compute the standard deviation if the
* given subtrahend is the mean. */
float sum_red_squared_difference(Context &context, GPUTexture *texture, float subtrahend);
/* Computes the sum of the squared difference between the green channel of all pixels in the given
* texture and the given subtrahend. This can be used to compute the standard deviation if the
* given subtrahend is the mean. */
float sum_green_squared_difference(Context &context, GPUTexture *texture, float subtrahend);
/* Computes the sum of the squared difference between the blue channel of all pixels in the given
* texture and the given subtrahend. This can be used to compute the standard deviation if the
* given subtrahend is the mean. */
float sum_blue_squared_difference(Context &context, GPUTexture *texture, float subtrahend);
/* Computes the sum of the squared difference between the luminance of all pixels in the given
* texture and the given subtrahend, using the given luminance coefficients to compute the
* luminance. This can be used to compute the standard deviation if the given subtrahend is the
* mean. */
float sum_luminance_squared_difference(Context &context,
GPUTexture *texture,
float3 luminance_coefficients,
float subtrahend);
/* --------------------------------------------------------------------
* Maximum Reductions.
*/
/* Computes the maximum luminance of all pixels in the given texture, using the given luminance
* coefficients to compute the luminance. */
float maximum_luminance(Context &context, GPUTexture *texture, float3 luminance_coefficients);
/* Computes the maximum float of all pixels in the given float texture, limited to the given range.
* Values outside of the given range are ignored. If non of the pixel values are in the range, the
* lower bound of the range is returned. For instance, if the given range is [-10, 10] and the
* image contains the values {2, 5, 11}, the maximum will be 5, since 11 is outside of the range.
* This is particularly useful for Z Depth normalization, since Z Depth can contain near infinite
* values, so enforcing an upper bound is beneficial. */
float maximum_float_in_range(Context &context,
GPUTexture *texture,
float lower_bound,
float upper_bound);
/* --------------------------------------------------------------------
* Minimum Reductions.
*/
/* Computes the minimum luminance of all pixels in the given texture, using the given luminance
* coefficients to compute the luminance. */
float minimum_luminance(Context &context, GPUTexture *texture, float3 luminance_coefficients);
/* Computes the minimum float of all pixels in the given float texture, limited to the given range.
* Values outside of the given range are ignored. If non of the pixel values are in the range, the
* upper bound of the range is returned. For instance, if the given range is [-10, 10] and the
* image contains the values {-11, 2, 5}, the minimum will be 2, since -11 is outside of the range.
* This is particularly useful for Z Depth normalization, since Z Depth can contain near infinite
* values, so enforcing a lower bound is beneficial. */
float minimum_float_in_range(Context &context,
GPUTexture *texture,
float lower_bound,
float upper_bound);
} // namespace blender::realtime_compositor
|