Blender V5.3
COM_algorithm_parallel_reduction.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
9#include "COM_context.hh"
10#include "COM_result.hh"
11
12namespace blender::compositor {
13
14/* --------------------------------------------------------------------
15 * Sum Reductions.
16 */
17
18/* Computes the sum of all pixels in the given input. */
19float4 sum_color(Context &context, const Result &input);
20
21/* Computes the sum of the logarithm of the luminance of all pixels in the given color input, using
22 * the given luminance coefficients to compute the luminance. */
23float sum_log_luminance(Context &context,
24 const Result &input,
25 const float3 &luminance_coefficients);
26
27/* --------------------------------------------------------------------
28 * Sum Of Squared Difference Reductions.
29 */
30
31/* Computes the sum of the squared difference between the all pixels in the given input and the
32 * given subtrahend. This can be used to compute the standard deviation if the given subtrahend is
33 * the mean. */
35 const Result &input,
36 const float4 subtrahend);
37
38/* --------------------------------------------------------------------
39 * Minimum Reductions.
40 */
41
42/* Computes the minimum value of all pixels in the given input. */
43float minimum_float(Context &context, const Result &input);
44Color minimum_color(Context &context, const Result &input);
45
46/* Computes the minimum luminance of all pixels in the given input, using the given luminance
47 * coefficients to compute the luminance. */
48float minimum_luminance(Context &context,
49 const Result &input,
50 const float3 &luminance_coefficients);
51
52/* Computes the minimum float of all pixels in the given float input, limited to the given range.
53 * Values outside of the given range are ignored. If non of the pixel values are in the range, the
54 * upper bound of the range is returned. For instance, if the given range is [-10, 10] and the
55 * image contains the values {-11, 2, 5}, the minimum will be 2, since -11 is outside of the range.
56 * This is particularly useful for Z Depth normalization, since Z Depth can contain near infinite
57 * values, so enforcing a lower bound is beneficial. */
58float minimum_float_in_range(Context &context,
59 const Result &input,
60 const float lower_bound,
61 const float upper_bound);
62
63/* --------------------------------------------------------------------
64 * Maximum Reductions.
65 */
66
67/* Computes the maximum value of all pixels in the given input. */
68float maximum_float(Context &context, const Result &input);
69float2 maximum_float2(Context &context, const Result &input);
70Color maximum_color(Context &context, const Result &input);
71
72/* Computes the maximum luminance of all pixels in the given input, using the given luminance
73 * coefficients to compute the luminance. */
74float maximum_luminance(Context &context,
75 const Result &input,
76 const float3 &luminance_coefficients);
77
78/* Computes the maximum float of all pixels in the given float input, limited to the given range.
79 * Values outside of the given range are ignored. If non of the pixel values are in the range, the
80 * lower bound of the range is returned. For instance, if the given range is [-10, 10] and the
81 * image contains the values {2, 5, 11}, the maximum will be 5, since 11 is outside of the range.
82 * This is particularly useful for Z Depth normalization, since Z Depth can contain near infinite
83 * values, so enforcing an upper bound is beneficial. */
84float maximum_float_in_range(Context &context,
85 const Result &input,
86 const float lower_bound,
87 const float upper_bound);
88
89} // namespace blender::compositor
float minimum_float(Context &context, const Result &input)
float minimum_float_in_range(Context &context, const Result &input, const float lower_bound, const float upper_bound)
float2 maximum_float2(Context &context, const Result &input)
float4 sum_squared_difference_color(Context &context, const Result &input, const float4 subtrahend)
Color minimum_color(Context &context, const Result &input)
ColorSceneLinear4f< eAlpha::Premultiplied > Color
Definition COM_result.hh:96
float minimum_luminance(Context &context, const Result &input, const float3 &luminance_coefficients)
float maximum_float_in_range(Context &context, const Result &input, const float lower_bound, const float upper_bound)
float sum_log_luminance(Context &context, const Result &input, const float3 &luminance_coefficients)
Color maximum_color(Context &context, const Result &input)
float maximum_float(Context &context, const Result &input)
float maximum_luminance(Context &context, const Result &input, const float3 &luminance_coefficients)
float4 sum_color(Context &context, const Result &input)