HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Rec2100.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2020-2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
9#pragma once
10
11#include "Rec2020.hpp"
12#include "../macros.hpp"
13#include <cmath>
14#include <array>
15
16namespace hi { inline namespace v1 {
17
22
27
34[[nodiscard]] inline float Rec2100_linear_to_gamma(float L) noexcept
35{
36 constexpr float c1 = 0.8359375f;
37 constexpr float c2 = 18.8515625f;
38 constexpr float c3 = 18.6875f;
39 constexpr float m1 = 0.1593017578125f;
40 constexpr float m2 = 78.84375;
41
42 hilet Lm1 = std::pow(L, m1);
43
44 return std::pow((c1 + c2 * Lm1) / (1.0f + c3 * Lm1), m2);
45}
46
53[[nodiscard]] inline float Rec2100_gamma_to_linear(float N) noexcept
54{
55 constexpr float c1 = 0.8359375f;
56 constexpr float c2 = 18.8515625f;
57 constexpr float c3 = 18.6875f;
58 constexpr float m1 = 0.1593017578125f;
59 constexpr float m2 = 78.84375;
60
61 hilet Nm2 = std::pow(N, 1.0f / m2);
62
63 return std::pow((Nm2 - c1) / (c2 - c3 * Nm2), 1.0f / m1);
64}
65
66}} // namespace hi::v1
color space conversion matrices between XYZ and Rec.2020
constexpr matrix3 XYZ_to_Rec2020
XYZ to Rec.2020 color space conversion matrix.
Definition Rec2020.hpp:27
constexpr matrix3 XYZ_to_Rec2100
XYZ to Rec.2100 color space conversion matrix.
Definition Rec2100.hpp:26
float Rec2100_linear_to_gamma(float L) noexcept
Rec.2100 linear to gamma transfer function.
Definition Rec2100.hpp:34
constexpr matrix3 Rec2020_to_XYZ
Rec.2020 to XYZ color space conversion matrix.
Definition Rec2020.hpp:22
constexpr matrix3 Rec2100_to_XYZ
Rec.2100 to XYZ color space conversion matrix.
Definition Rec2100.hpp:21
float Rec2100_gamma_to_linear(float N) noexcept
Rec.2100 gamma to linear transfer function.
Definition Rec2100.hpp:53
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
A 2D or 3D homogenius matrix for transforming homogenious vectors and points.
Definition matrix3.hpp:30
T pow(T... args)