22 { 53675, 23718, -8446},
24 { 3157, 17317, 41520},
29 { 13792, 52011, -267},
30 { 129630, -159160, 29530},
31 { 1698, 51300, -52997},
36 { 65536, 25974, 14143},
37 { 65536, -6918, -4185},
38 { 65536, -5864, -84639},
43 { 80405, -36557, 18441},
44 { -2659, 72895, -4700},
45 { -5005, -27623, 104001},
70 const i64 acc =
static_cast<i64>(row[0]) *
static_cast<i64>(v[0])
71 +
static_cast<i64>(row[1]) *
static_cast<i64>(v[1])
72 +
static_cast<i64>(row[2]) *
static_cast<i64>(v[2]);
73 return static_cast<i32
>((acc + 32768) >> 16);
90 const i64 magnitude = raw < 0 ? -
static_cast<i64>(raw) :
static_cast<i64>(raw);
91 const i32 root =
static_cast<i32
>(
93 return raw < 0 ? -root : root;
114 const i64 magnitude = clamped < 0 ? -
static_cast<i64>(clamped)
115 :
static_cast<i64>(clamped);
116 const i64 squared = (magnitude * magnitude + 32768) >> 16;
117 const i64 cubed = (squared * magnitude + 32768) >> 16;
118 return clamped < 0 ? -
static_cast<i32
>(cubed) :
static_cast<i32
>(cubed);
128 dotOklabMatrixQ16(kLmsFromXyz, clamped, lms);
129 const i32 root[3] = {
130 signedCbrtQ16(lms[0]), signedCbrtQ16(lms[1]), signedCbrtQ16(lms[2])};
131 dotOklabMatrixQ16(kOklabFromLmsRoot, root, out_lab);
139 dotOklabMatrixQ16(kLmsRootFromOklab, clamped, root);
141 signedCubeQ16(root[0]), signedCubeQ16(root[1]), signedCubeQ16(root[2])};
142 dotOklabMatrixQ16(kXyzFromLms, lms, out_xyz);
constexpr i32 kOklabQ16MaxCubeRoot
Signed cube of an s16.16 raw value, rounding to nearest at each step.
constexpr i32 kLmsRootFromOklab[3][3]
OKLab -> cube-rooted LMS.
i32 signedCubeQ16(i32 raw) FL_NO_EXCEPT
i32 clampOklabQ16(i32 value, i32 bound) FL_NO_EXCEPT
Clamp into a symmetric domain.
constexpr i32 kLmsFromXyz[3][3]
XYZ -> LMS.
constexpr i32 kXyzFromLms[3][3]
LMS -> XYZ.
void dotOklabMatrixQ16(const i32(&matrix)[3][3], const i32(&v)[3], i32(&out)[3]) FL_NO_EXCEPT
constexpr i32 kOklabFromLmsRoot[3][3]
Cube-rooted LMS -> OKLab.
i32 dotOklabRowQ16(const i32(&row)[3], const i32(&v)[3]) FL_NO_EXCEPT
One matrix row against a clamped s16.16 vector.
i32 signedCbrtQ16(i32 raw) FL_NO_EXCEPT
Signed cube root of an s16.16 raw value.
constexpr int type_rank< T >::value
constexpr i32 kOklabQ16MaxMagnitude
Largest magnitude either direction accepts, as an s16.16 raw value (64.0).
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.
FL_OPTIMIZE_FUNCTION constexpr u32 icbrt64(u64 x) FL_NO_EXCEPT
InputGamut g FL_NO_EXCEPT
Base definition for an LED controller.