FastLED 3.10.6
Loading...
Searching...
No Matches

◆ processPixelLinearQ16()

void fl::processPixelLinearQ16 ( const StreamingPipelineQ16 & pipeline,
u8 r,
u8 g,
u8 b,
i32(&) light[3] )

Pre-response linear emitter light for a power prepass.

Source decoding, gamut mapping and the physical solve are exactly the encoder's stages; brightness/response inversion intentionally follow this boundary.

Definition at line 263 of file pipeline.cpp.hpp.

264 {
265 // One semantic conversion per channel: code straight to linear light.
266 // Nothing here writes an RGB8 intermediate, which is what B3 asks and
267 // what ci/tests/test_no_rgb8_intermediate.py enforces structurally.
268 const u16 linear_r = decodeTransferU16(pipeline.transfer, r);
269 const u16 linear_g = decodeTransferU16(pipeline.transfer, g);
270 const u16 linear_b = decodeTransferU16(pipeline.transfer, b);
271
272 i32 xyz[3];
273 linearRgbToXyzQ16(pipeline.source, linear_r, linear_g, linear_b, xyz);
274
275 if (pipeline.gamut_policy == GamutPolicy::Clamp) {
276 // The caller asked for the cheap answer. Solve and clip, which is
277 // `map_clip` from the P7 study -- about 20 dE2000 from the reference
278 // where the mapper is at 0.15, and offered only because the binding
279 // offers it.
280 solveRgbDrivesQ16(pipeline.gamut.solve, xyz, drives);
281 for (int i = 0; i < 3; ++i) {
282 if (drives[i] < 0) {
283 drives[i] = 0;
284 } else if (drives[i] > 65536) {
285 drives[i] = 65536;
286 }
287 }
288 } else {
289 // The mapper owns clamping, so the stages above hand it the honest
290 // target even when that is outside the hull.
291 mapAndSolveDrivesQ16(pipeline.gamut, xyz, drives);
292 }
293
294}
void mapAndSolveDrivesQ16(const GamutMapQ16 &map, const i32(&xyz)[3], i32(&drives)[3]) FL_NO_EXCEPT
One pixel: XYZ in s16.16 to in-gamut emitter drives in s16.16.
u16 decodeTransferU16(TransferFunction transfer, u8 code) FL_NO_EXCEPT
Decode one 8-bit source code to u16 linear light under transfer.
void linearRgbToXyzQ16(const SourceMatrixQ16 &matrix, u16 r, u16 g, u16 b, i32(&out_xyz)[3]) FL_NO_EXCEPT
One pixel: u16 linear RGB -> s16.16 XYZ.
InputGamut g
Definition rgbw.h:124
void solveRgbDrivesQ16(const EmitterSolveMatrixQ16 &matrix, const i32(&xyz)[3], i32(&drives)[3]) FL_NO_EXCEPT
One pixel: XYZ in s16.16 to three emitter drives in s16.16.
TransferFunction transfer
The source's transfer function, applied per code.
Definition pipeline.h:75
GamutPolicy gamut_policy
What to do with a target the device cannot reproduce.
Definition pipeline.h:91
GamutMapQ16 gamut
The device hull, its solve, and the lightness bound.
Definition pipeline.h:81
EmitterSolveMatrixQ16 solve
Definition gamut_map.h:44
SourceMatrixQ16 source
Source primaries to XYZ, with adaptation to D65 already folded in.
Definition pipeline.h:78

References Clamp, decodeTransferU16(), FL_NO_EXCEPT, g, fl::StreamingPipelineQ16::gamut, fl::StreamingPipelineQ16::gamut_policy, linearRgbToXyzQ16(), mapAndSolveDrivesQ16(), fl::GamutMapQ16::solve, solveRgbDrivesQ16(), fl::StreamingPipelineQ16::source, and fl::StreamingPipelineQ16::transfer.

Referenced by processPixelQ16().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: