FastLED 3.10.6
Loading...
Searching...
No Matches
oklab_q16.h
Go to the documentation of this file.
1#pragma once
2
3// OKLab in the pipeline working domain (P7, #4041).
4//
5// The gamut mapper selected in docs/color-gamut-algorithm-selection.md works
6// in OKLab, so the working domain needs the transform in s16.16 rather than
7// in float. Both directions are three multiply-accumulates per component
8// around a per-component nonlinearity -- a cube root going in, a cube coming
9// back -- with no float, no division, no allocation and no trigonometry.
10//
11// The matrices are universal constants rather than profile-derived, so they
12// are quantized at compile time and cost nothing to build.
13
14#include "fl/stl/int.h"
15#include "fl/stl/noexcept.h"
16
17namespace fl {
18
40constexpr i32 kOklabQ16MaxMagnitude = 64 * 65536;
41
47void xyzToOklabQ16(const i32 (&xyz)[3], i32 (&out_lab)[3]) FL_NO_EXCEPT;
48
63void oklabToXyzQ16(const i32 (&lab)[3], i32 (&out_xyz)[3]) FL_NO_EXCEPT;
64
65} // namespace fl
constexpr i32 kOklabQ16MaxMagnitude
Largest magnitude either direction accepts, as an s16.16 raw value (64.0).
Definition oklab_q16.h:40
void oklabToXyzQ16(const i32(&lab)[3], i32(&out_xyz)[3]) FL_NO_EXCEPT
OKLab (s16.16) -> XYZ (s16.16).
void xyzToOklabQ16(const i32(&xyz)[3], i32(&out_lab)[3]) FL_NO_EXCEPT
XYZ (s16.16, D65-relative) -> OKLab (s16.16), L then a then b.
InputGamut g FL_NO_EXCEPT
Definition rgbw.h:121
Base definition for an LED controller.
Definition crgb.hpp:179