False if either white has a zero cone response, which no real white does but a corrupt profile might.
85 {
86 if (out == nullptr) {
87 return false;
88 }
89
90
91
92 i32 source_xy[2];
93 i32 destination_xy[2];
94 if (!adaptationWhiteQ16(source_white, source_xy) ||
95 !adaptationWhiteQ16(destination_white, destination_xy)) {
96 return false;
97 }
99 i64 destination_xyz[3];
102 return false;
103 }
104 const i32 source_v[3] = {static_cast<i32>(source_xyz[0]), static_cast<i32>(source_xyz[1]),
105 static_cast<i32>(source_xyz[2])};
106 const i32 destination_v[3] = {static_cast<i32>(destination_xyz[0]),
107 static_cast<i32>(destination_xyz[1]),
108 static_cast<i32>(destination_xyz[2])};
110 for (int i = 0; i < 3; ++i) {
112 const i32 destination_cone =
114
115
116 if (source_cone == 0) {
117 return false;
118 }
120 static_cast<i64>(destination_cone) * kAdaptationQ16One, source_cone);
121 }
122 for (int row = 0; row < 3; ++row) {
123 for (int col = 0; col < 3; ++col) {
124
125
127 for (int k = 0; k < 3; ++k) {
130 kAdaptationQ16One);
132 }
134 if (
value > 2147483647LL ||
value < -2147483648LL) {
135 return false;
136 }
137 out->
m[row][col] =
static_cast<i32
>(
value);
138 }
139 }
140 return true;
141}
fl::UISlider scale("Scale", 4,.1, 4,.1)
i32 dotRowQ16(const i32(&row)[3], const i32(&v)[3]) FL_NO_EXCEPT
One s16.16 matrix row against a vector, rounded and saturated.
i64 roundedDivideQ16(i64 numerator, i64 denominator) FL_NO_EXCEPT
The s16.16 building blocks the bind-time builders share.
const i32 kBradfordInverseQ16[3][3]
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...
bool xyzColumnQ16(const i32(&xy)[2], i32 luminance, i64(&column)[3]) FL_NO_EXCEPT
XYZ of chromaticity xy at luminance luminance, all s16.16; false for a non-positive or out-of-simplex...
constexpr int type_rank< T >::value