aest 0.1.0
Collection of C++ utility libraries
Loading...
Searching...
No Matches
Transfer.cppm File Reference

Partition aest.colors:transfer: the transfer functions that encode linear light into RGB channel values. More...

#include <algorithm>
#include <cmath>
#include <concepts>
#include <string_view>
import aest.colors:color;

Go to the source code of this file.

Classes

struct  aest::colors::tf::Linear
 No transfer function: channel values are proportional to light. More...
struct  aest::colors::tf::SRGB
 The sRGB transfer function of IEC 61966-2-1: a short linear segment near black, then a power curve with exponent 2.4. More...
struct  aest::colors::tf::Rec709
 The OETF of ITU-R BT.709, which BT.2020 shares for SDR: a linear segment near black, then a power curve with exponent 0.45. More...
struct  aest::colors::tf::PQ
 The Perceptual Quantizer of SMPTE ST 2084 and ITU-R BT.2100, the absolute HDR transfer function of HDR10 and Dolby Vision. More...
struct  aest::colors::tf::HLG
 The Hybrid Log-Gamma OETF of ITU-R BT.2100 and ARIB STD-B67, the relative HDR transfer function of broadcast. More...

Namespaces

namespace  aest::colors::tf
 Transfer function tags, the second parameter of BasicRGB.

Concepts

concept  aest::colors::TransferFunction
 A transfer function tag, the second parameter of BasicRGB.
concept  aest::colors::HDRTransfer
 A transfer function for HDR signals, such as PQ or HLG: a tag with a static IS_HDR set to true. Tags without it are SDR.

Variables

constexpr float aest::colors::SRGB_GAMMA = 2.4f
 Exponent of the sRGB transfer function.
constexpr float aest::colors::REC709_ALPHA = 1.09929682680944f
 Offset alpha of the Rec. 709 OETF, solved so that its two segments meet; ITU-R BT.2020 gives it, BT.709 rounds it to 1.099.
constexpr float aest::colors::REC709_BETA = 0.018053968510807f
 Linear light beta where the Rec. 709 OETF turns from its linear segment to its power curve; BT.709 rounds it to 0.018.
constexpr float aest::colors::REC709_SLOPE = 4.5f
 Slope of the linear segment of the Rec. 709 OETF.
constexpr float aest::colors::REC709_EXPONENT = 0.45f
 Exponent of the power curve of the Rec. 709 OETF.
constexpr double aest::colors::PQ_PEAK_NITS = 10000.0
 Luminance of the PQ signal 1.0 in cd/m², the peak of SMPTE ST 2084.
constexpr double aest::colors::PQ_M1 = 2610.0 / 16384.0
 PQ constant m1 = 2610 / 16384, from SMPTE ST 2084.
constexpr double aest::colors::PQ_M2 = 2523.0 / 4096.0 * 128.0
 PQ constant m2 = 2523 / 4096 * 128, from SMPTE ST 2084.
constexpr double aest::colors::PQ_C1 = 3424.0 / 4096.0
 PQ constant c1 = 3424 / 4096, from SMPTE ST 2084.
constexpr double aest::colors::PQ_C2 = 2413.0 / 4096.0 * 32.0
 PQ constant c2 = 2413 / 4096 * 32, from SMPTE ST 2084.
constexpr double aest::colors::PQ_C3 = 2392.0 / 4096.0 * 32.0
 PQ constant c3 = 2392 / 4096 * 32, from SMPTE ST 2084.
constexpr double aest::colors::HLG_A = 0.17883277
 HLG constant a, from ITU-R BT.2100.
constexpr double aest::colors::HLG_B = 1 - 4 * HLG_A
 HLG constant b = 1 - 4a, from ITU-R BT.2100.
constexpr double aest::colors::HLG_C = 0.559910729529562
 HLG constant c = 0.5 - a ln(4a), from ITU-R BT.2100.
constexpr double aest::colors::HLG_REFERENCE_WHITE = 0.26496256042100724
 Scene light that HLG encodes to 75%, its BT.2408 reference white: (exp((0.75 - c) / a) + b) / 12.
constexpr float aest::colors::REFERENCE_WHITE_NITS = 203.f
 Luminance of linear 1.0 in cd/m²: the HDR reference white of ITU-R BT.2408, and the scale of every linear space.

Detailed Description

Partition aest.colors:transfer: the transfer functions that encode linear light into RGB channel values.

Author
Davide Pierotti

Definition in file Transfer.cppm.

Variable Documentation

◆ HLG_A

double aest::colors::HLG_A = 0.17883277
constexpr

HLG constant a, from ITU-R BT.2100.

Definition at line 59 of file Transfer.cppm.

◆ HLG_B

double aest::colors::HLG_B = 1 - 4 * HLG_A
constexpr

HLG constant b = 1 - 4a, from ITU-R BT.2100.

Definition at line 62 of file Transfer.cppm.

◆ HLG_C

double aest::colors::HLG_C = 0.559910729529562
constexpr

HLG constant c = 0.5 - a ln(4a), from ITU-R BT.2100.

Note
std::log is not constexpr.

Definition at line 68 of file Transfer.cppm.

◆ HLG_REFERENCE_WHITE

double aest::colors::HLG_REFERENCE_WHITE = 0.26496256042100724
constexpr

Scene light that HLG encodes to 75%, its BT.2408 reference white: (exp((0.75 - c) / a) + b) / 12.

Note
std::exp is not constexpr.

Definition at line 75 of file Transfer.cppm.

◆ PQ_C1

double aest::colors::PQ_C1 = 3424.0 / 4096.0
constexpr

PQ constant c1 = 3424 / 4096, from SMPTE ST 2084.

Definition at line 50 of file Transfer.cppm.

◆ PQ_C2

double aest::colors::PQ_C2 = 2413.0 / 4096.0 * 32.0
constexpr

PQ constant c2 = 2413 / 4096 * 32, from SMPTE ST 2084.

Definition at line 53 of file Transfer.cppm.

◆ PQ_C3

double aest::colors::PQ_C3 = 2392.0 / 4096.0 * 32.0
constexpr

PQ constant c3 = 2392 / 4096 * 32, from SMPTE ST 2084.

Definition at line 56 of file Transfer.cppm.

◆ PQ_M1

double aest::colors::PQ_M1 = 2610.0 / 16384.0
constexpr

PQ constant m1 = 2610 / 16384, from SMPTE ST 2084.

Definition at line 44 of file Transfer.cppm.

◆ PQ_M2

double aest::colors::PQ_M2 = 2523.0 / 4096.0 * 128.0
constexpr

PQ constant m2 = 2523 / 4096 * 128, from SMPTE ST 2084.

Definition at line 47 of file Transfer.cppm.

◆ PQ_PEAK_NITS

double aest::colors::PQ_PEAK_NITS = 10000.0
constexpr

Luminance of the PQ signal 1.0 in cd/m², the peak of SMPTE ST 2084.

Definition at line 41 of file Transfer.cppm.

◆ REC709_ALPHA

float aest::colors::REC709_ALPHA = 1.09929682680944f
constexpr

Offset alpha of the Rec. 709 OETF, solved so that its two segments meet; ITU-R BT.2020 gives it, BT.709 rounds it to 1.099.

Definition at line 26 of file Transfer.cppm.

◆ REC709_BETA

float aest::colors::REC709_BETA = 0.018053968510807f
constexpr

Linear light beta where the Rec. 709 OETF turns from its linear segment to its power curve; BT.709 rounds it to 0.018.

Definition at line 32 of file Transfer.cppm.

◆ REC709_EXPONENT

float aest::colors::REC709_EXPONENT = 0.45f
constexpr

Exponent of the power curve of the Rec. 709 OETF.

Definition at line 38 of file Transfer.cppm.

◆ REC709_SLOPE

float aest::colors::REC709_SLOPE = 4.5f
constexpr

Slope of the linear segment of the Rec. 709 OETF.

Definition at line 35 of file Transfer.cppm.

◆ REFERENCE_WHITE_NITS

float aest::colors::REFERENCE_WHITE_NITS = 203.f
inlineconstexprexport

Luminance of linear 1.0 in cd/m²: the HDR reference white of ITU-R BT.2408, and the scale of every linear space.

Divide an absolute luminance by it to get a linear value, as in tf::PQ::encode(1000.f / REFERENCE_WHITE_NITS) for the PQ signal of 1000 cd/m², or the linear headroom of a 1000 cd/m² display.

See also
ITU-R BT.2408

Definition at line 120 of file Transfer.cppm.

◆ SRGB_GAMMA

float aest::colors::SRGB_GAMMA = 2.4f
constexpr

Exponent of the sRGB transfer function.

Definition at line 20 of file Transfer.cppm.