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 <cmath>
13#include <array>
14
15namespace hi { inline namespace v1 {
16
21
26
33[[nodiscard]] inline float Rec2100_linear_to_gamma(float L) noexcept
34{
35 constexpr float c1 = 0.8359375f;
36 constexpr float c2 = 18.8515625f;
37 constexpr float c3 = 18.6875f;
38 constexpr float m1 = 0.1593017578125f;
39 constexpr float m2 = 78.84375;
40
41 hilet Lm1 = std::pow(L, m1);
42
43 return std::pow((c1 + c2 * Lm1) / (1.0f + c3 * Lm1), m2);
44}
45
52[[nodiscard]] inline float Rec2100_gamma_to_linear(float N) noexcept
53{
54 constexpr float c1 = 0.8359375f;
55 constexpr float c2 = 18.8515625f;
56 constexpr float c3 = 18.6875f;
57 constexpr float m1 = 0.1593017578125f;
58 constexpr float m2 = 78.84375;
59
60 hilet Nm2 = std::pow(N, 1.0f / m2);
61
62 return std::pow((Nm2 - c1) / (c2 - c3 * Nm2), 1.0f / m1);
63}
64
65}} // namespace hi::v1
color space conversion matrices between XYZ and Rec.2020
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
constexpr matrix3 XYZ_to_Rec2020
XYZ to Rec.2020 color space conversion matrix.
Definition Rec2020.hpp:26
constexpr matrix3 XYZ_to_Rec2100
XYZ to Rec.2100 color space conversion matrix.
Definition Rec2100.hpp:25
float Rec2100_linear_to_gamma(float L) noexcept
Rec.2100 linear to gamma transfer function.
Definition Rec2100.hpp:33
constexpr matrix3 Rec2020_to_XYZ
Rec.2020 to XYZ color space conversion matrix.
Definition Rec2020.hpp:21
constexpr matrix3 Rec2100_to_XYZ
Rec.2100 to XYZ color space conversion matrix.
Definition Rec2100.hpp:20
float Rec2100_gamma_to_linear(float N) noexcept
Rec.2100 gamma to linear transfer function.
Definition Rec2100.hpp:52
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
A 2D or 3D homogenius matrix for transforming homogenious vectors and points.
Definition matrix.hpp:33
T pow(T... args)