25 {0.59719, 0.35458, 0.04823},
26 {0.07600, 0.90834, 0.01566},
27 {0.02840, 0.13383, 0.83777},
35 {1.60475, -0.53108, -0.07367},
36 {-0.10208, 1.10813, -0.00605},
37 {-0.00327, -0.07276, 1.07602},
47 const double numerator = value * (value + 0.0245786) - 0.000090537;
48 const double denominator = value * (0.983729 * value + 0.4329510) + 0.238081;
49 return numerator / denominator;
64export template <LinearRGBSpace Color>
67 return Color{color.red() / (1 + color.red()), color.green() / (1 + color.green()),
68 color.blue() / (1 + color.blue()), color.alpha()};
86export template <LinearRGBSpace Color>
89 const float whiteSquared = white * white;
90 const auto map = [whiteSquared](
const float channel) ->
float {
91 return channel * (1 + channel / whiteSquared) / (1 + channel);
93 return Color{map(color.red()), map(color.green()), map(color.blue()), color.alpha()};
110export template <LinearRGBSpace Color>
120 clamp(
static_cast<float>(output[1])),
121 clamp(
static_cast<float>(output[2])), color.alpha()});
constexpr float clamp(const float value)
Clamp a floating-point value to the 0-1 range.
constexpr ColorOut convert(const ColorIn &color)
Convert a color from one color space to another.
blas::Vector< double, 3 > Vector3
A column of three values, such as XYZ or linear RGB channels.
blas::Matrix< double, 3, 3 > Matrix3
A 3x3 matrix, stored as three rows.
BasicRGB< gamut::SRGB, tf::Linear > LinSRGB
Linear sRGB: the sRGB primaries without the gamma encoding, so channels are proportional to light and...
constexpr Vector< T, Rows > multiply(const Matrix< T, Rows, Columns > &matrix, const Vector< T, Columns > &vector)
Multiplies a matrix by a column vector.
constexpr float green() const noexcept
Get the green channel value.
constexpr float red() const noexcept
Get the red channel value.
constexpr float blue() const noexcept
Get the blue channel value.
Tonemapping operators, from HDR linear light to the 0-1 range of a display.
constexpr Color reinhard_extended(const Color &color, const float white)
Extended Reinhard tonemapping, c (1 + c / w²) / (1 + c) on each channel, which maps white to 1.
constexpr Matrix3 ACES_OUTPUT
Output matrix of the ACES fit by Stephen Hill: back from the ODT to linear sRGB, with the saturation ...
constexpr Matrix3 ACES_INPUT
Input matrix of the ACES fit by Stephen Hill: linear sRGB to the ACES AP1 primaries,...
constexpr Color aces_fitted(const Color &color)
Fitted ACES tonemapping by Stephen Hill: an approximation of the ACES Reference Rendering Transform a...
constexpr double rrt_and_odt_fit(const double value)
Rational fit of the ACES RRT and sRGB ODT curve, by Stephen Hill.
constexpr Color reinhard(const Color &color)
Reinhard tonemapping, c / (1 + c) on each channel.