FastLED 3.10.6
Loading...
Searching...
No Matches
chromatic_adaptation.h
Go to the documentation of this file.
1#pragma once
2
3// Chromatic adaptation between white points (P6, #4040).
4//
5// B7 makes Bradford the normative CAT. The whole adaptation collapses to one
6// 3x3 matrix, built when a profile is bound, so nothing iterative or
7// trigonometric runs per pixel -- and folding it into the source matrix makes
8// it free, since the two then cost a single multiply together.
9
11#include "fl/gfx/source_xyz.h"
12#include "fl/stl/int.h"
13#include "fl/stl/noexcept.h"
14
15namespace fl {
16namespace detail {
17
29extern const float kBradford[3][3];
30extern const float kBradfordInverse[3][3];
32extern const i32 kBradfordQ16[3][3];
33extern const i32 kBradfordInverseQ16[3][3];
34
35} // namespace detail
36
42 i32 m[3][3];
43};
44
48bool buildBradfordMatrixQ16(Chromaticity source_white,
49 Chromaticity destination_white,
51
61void adaptXyzQ16(const AdaptationMatrixQ16& matrix, const i32 (&xyz)[3],
62 i32 (&out_xyz)[3]) FL_NO_EXCEPT;
63
71
72} // namespace fl
const i32 kBradfordInverseQ16[3][3]
const float kBradfordInverse[3][3]
Its inverse, precomputed.
const float kBradford[3][3]
ICC linear Bradford cone-response matrix.
const i32 kBradfordQ16[3][3]
The two matrices above in s16.16, rounded from the float32 values, so the bind-time build needs no fl...
Compile-time linker keep-alive hook for a single fl::Bus.
Definition bus_info.h:57
void foldAdaptationIntoSourceMatrix(const AdaptationMatrixQ16 &adaptation, SourceMatrixQ16 *source) FL_NO_EXCEPT
Pre-multiply the adaptation into a source matrix, in place.
InputGamut g FL_NO_EXCEPT
Definition rgbw.h:121
void adaptXyzQ16(const AdaptationMatrixQ16 &matrix, const i32(&xyz)[3], i32(&out_xyz)[3]) FL_NO_EXCEPT
Adapt one XYZ triple.
bool buildBradfordMatrixQ16(Chromaticity source_white, Chromaticity destination_white, AdaptationMatrixQ16 *out) FL_NO_EXCEPT
Build the Bradford transform from source_white to destination_white.
Base definition for an LED controller.
Definition crgb.hpp:179
A collapsed adaptation transform in s16.16.
Source-primaries matrix in s16.16, rows ordered X, Y, Z.
Definition source_xyz.h:20
CIE 1931 xy chromaticity, independent of encoded storage and chipset.