HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Rec2100.hpp
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
5#pragma once
6
7#include "Rec2020.hpp"
8#include <cmath>
9#include <array>
10
11namespace hi::inline v1 {
12
13constexpr matrix3 Rec2100_to_XYZ = Rec2020_to_XYZ;
14
15constexpr matrix3 XYZ_to_Rec2100 = XYZ_to_Rec2020;
16
17[[nodiscard]] inline float Rec2100_linear_to_gamma(float L) noexcept
18{
19 constexpr float c1 = 0.8359375f;
20 constexpr float c2 = 18.8515625f;
21 constexpr float c3 = 18.6875f;
22 constexpr float m1 = 0.1593017578125f;
23 constexpr float m2 = 78.84375;
24
25 hilet Lm1 = std::pow(L, m1);
26
27 return std::pow((c1 + c2 * Lm1) / (1.0f + c3 * Lm1), m2);
28}
29
30[[nodiscard]] inline float Rec2100_gamma_to_linear(float N) noexcept
31{
32 constexpr float c1 = 0.8359375f;
33 constexpr float c2 = 18.8515625f;
34 constexpr float c3 = 18.6875f;
35 constexpr float m1 = 0.1593017578125f;
36 constexpr float m2 = 78.84375;
37
38 hilet Nm2 = std::pow(N, 1.0f / m2);
39
40 return std::pow((Nm2 - c1) / (c2 - c3 * Nm2), 1.0f / m1);
41}
42
43} // namespace hi::inline v1
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
DOXYGEN BUG.
Definition algorithm.hpp:15
T pow(T... args)