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 "../geometry/geometry.hpp"
13#include "../macros.hpp"
14#include <cmath>
15#include <array>
16
17hi_export_module(hikogui.color.Rec2100);
18
19hi_export namespace hi { inline namespace v1 {
20
25
30
37[[nodiscard]] inline float Rec2100_linear_to_gamma(float L) noexcept
38{
39 constexpr float c1 = 0.8359375f;
40 constexpr float c2 = 18.8515625f;
41 constexpr float c3 = 18.6875f;
42 constexpr float m1 = 0.1593017578125f;
43 constexpr float m2 = 78.84375;
44
45 auto const Lm1 = std::pow(L, m1);
46
47 return std::pow((c1 + c2 * Lm1) / (1.0f + c3 * Lm1), m2);
48}
49
56[[nodiscard]] inline float Rec2100_gamma_to_linear(float N) noexcept
57{
58 constexpr float c1 = 0.8359375f;
59 constexpr float c2 = 18.8515625f;
60 constexpr float c3 = 18.6875f;
61 constexpr float m1 = 0.1593017578125f;
62 constexpr float m2 = 78.84375;
63
64 auto const Nm2 = std::pow(N, 1.0f / m2);
65
66 return std::pow((Nm2 - c1) / (c2 - c3 * Nm2), 1.0f / m1);
67}
68
69}} // 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:30
constexpr matrix3 XYZ_to_Rec2100
XYZ to Rec.2100 color space conversion matrix.
Definition Rec2100.hpp:29
float Rec2100_linear_to_gamma(float L) noexcept
Rec.2100 linear to gamma transfer function.
Definition Rec2100.hpp:37
constexpr matrix3 Rec2020_to_XYZ
Rec.2020 to XYZ color space conversion matrix.
Definition Rec2020.hpp:25
constexpr matrix3 Rec2100_to_XYZ
Rec.2100 to XYZ color space conversion matrix.
Definition Rec2100.hpp:24
float Rec2100_gamma_to_linear(float N) noexcept
Rec.2100 gamma to linear transfer function.
Definition Rec2100.hpp:56
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
A 2D or 3D homogenius matrix for transforming homogenious vectors and points.
Definition matrix3.hpp:36
T pow(T... args)