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

◆ processPixelWideLinearQ16()

void fl::processPixelWideLinearQ16 ( const StreamingPipelineQ16 & pipeline,
u8 r,
u8 g,
u8 b,
i32(&) drives[5] )

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

310 {
311 for (int i = 0; i < 5; ++i) drives[i] = 0;
312 if (!pipeline.wide) return;
313 const u16 linear_r = decodeTransferU16(pipeline.transfer, r);
314 const u16 linear_g = decodeTransferU16(pipeline.transfer, g);
315 const u16 linear_b = decodeTransferU16(pipeline.transfer, b);
316 i32 xyz[3];
317 linearRgbToXyzQ16(pipeline.source, linear_r, linear_g, linear_b, xyz);
318 const bool rgbww = pipeline.wide->topology ==
320 if (rgbww) {
321 i32 wide_drives[5];
322 if (pipeline.gamut_policy == GamutPolicy::Clamp &&
323 !allocateTwoWhiteDrivesQ16(pipeline.wide->rgbww.allocation,
324 xyz, wide_drives)) {
325 i32 rgb_drives[3];
326 solveRgbDrivesQ16(pipeline.wide->rgbww.allocation.rgb_solve,
327 xyz, rgb_drives);
328 for (int i = 0; i < 3; ++i) {
329 wide_drives[i] = rgb_drives[i] < 0 ? 0 :
330 (rgb_drives[i] > 65536 ? 65536 : rgb_drives[i]);
331 }
332 wide_drives[3] = 0;
333 wide_drives[4] = 0;
334 } else if (pipeline.gamut_policy != GamutPolicy::Clamp) {
335 mapAndAllocateRgbwwQ16(pipeline.wide->rgbww, xyz, wide_drives);
336 }
337 for (int i = 0; i < 5; ++i) drives[i] = wide_drives[i];
338 } else {
339 i32 wide_drives[4];
340 if (pipeline.gamut_policy == GamutPolicy::Clamp &&
341 !allocateEmitterDrivesQ16(pipeline.wide->rgbw.allocation,
342 xyz, wide_drives)) {
343 i32 rgb_drives[3];
344 solveRgbDrivesQ16(pipeline.wide->rgbw.allocation.rgb_solve,
345 xyz, rgb_drives);
346 for (int i = 0; i < 3; ++i) {
347 wide_drives[i] = rgb_drives[i] < 0 ? 0 :
348 (rgb_drives[i] > 65536 ? 65536 : rgb_drives[i]);
349 }
350 wide_drives[3] = 0;
351 } else if (pipeline.gamut_policy != GamutPolicy::Clamp) {
352 mapAndAllocateRgbwQ16(pipeline.wide->rgbw, xyz, wide_drives);
353 }
354 for (int i = 0; i < 4; ++i) drives[i] = wide_drives[i];
355 }
356}
void mapAndAllocateRgbwwQ16(const GamutMapRgbwwQ16 &map, const i32(&xyz)[3], i32(&drives)[5]) FL_NO_EXCEPT
One pixel: XYZ in s16.16 to five in-gamut drives – red, green, blue, white1, white2.
bool allocateTwoWhiteDrivesQ16(const TwoWhiteAllocationQ16 &allocation, const i32(&xyz)[3], i32(&drives)[5]) FL_NO_EXCEPT
One pixel: XYZ in s16.16 to five drives – red, green, blue, white1, white2 – at whichever end of the ...
bool allocateEmitterDrivesQ16(const WhiteAllocationQ16 &allocation, const i32(&xyz)[3], i32(&drives)[4]) FL_NO_EXCEPT
One pixel: XYZ in s16.16 to four drives, in the order red, green, blue, white, at whichever end of th...
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.
void mapAndAllocateRgbwQ16(const GamutMapRgbwQ16 &map, const i32(&xyz)[3], i32(&drives)[4]) FL_NO_EXCEPT
One pixel: XYZ in s16.16 to four in-gamut drives, red, green, blue, white.
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
shared_ptr< const WidePipelineQ16 > wide
Definition pipeline.h:104
SourceMatrixQ16 source
Source primaries to XYZ, with adaptation to D65 already folded in.
Definition pipeline.h:78

References allocateEmitterDrivesQ16(), allocateTwoWhiteDrivesQ16(), Clamp, decodeTransferU16(), FL_NO_EXCEPT, g, fl::StreamingPipelineQ16::gamut_policy, linearRgbToXyzQ16(), mapAndAllocateRgbwQ16(), mapAndAllocateRgbwwQ16(), fl::colorimetric_response::RGBWW, solveRgbDrivesQ16(), fl::StreamingPipelineQ16::source, fl::StreamingPipelineQ16::transfer, and fl::StreamingPipelineQ16::wide.

Referenced by processPixelWideQ16().

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