FastLED 3.10.8
Loading...
Searching...
No Matches
PixelController< RGB_ORDER, LANES, MASK > Struct Template Reference

Detailed Description

template<EOrder RGB_ORDER, int LANES = 1, fl::u32 MASK = 0xFFFFFFFF>
struct PixelController< RGB_ORDER, LANES, MASK >

Pixel controller class.

This is the class that we use to centralize pixel access in a block of data, including support for things like RGB reordering, scaling, dithering, skipping (for ARGB data), and eventually, we will centralize 8/12/16 conversions here as well.

Template Parameters
RGB_ORDERthe rgb ordering for the LEDs (e.g. what order red, green, and blue data is written out in)
LANEShow many parallel lanes of output to write
MASKbitmask for the output lanes

Definition at line 105 of file pixel_controller.h.

#include <pixel_controller.h>

+ Inheritance diagram for PixelController< RGB_ORDER, LANES, MASK >:
+ Collaboration diagram for PixelController< RGB_ORDER, LANES, MASK >:

Public Types

enum  { kLanes = LANES , kMask = MASK }
 

Public Member Functions

 PixelController (const CRGB &d, int len, ColorAdjustment color_adjustment, EDitherMode dither) FL_NO_EXCEPT
 Constructor.
 
 PixelController (const CRGB *d, int len, ColorAdjustment color_adjustment, EDitherMode dither) FL_NO_EXCEPT
 Constructor.
 
 PixelController (const fl::u8 *d, int len, ColorAdjustment color_adjustment, EDitherMode dither, bool advance, fl::u8 skip) FL_NO_EXCEPT
 Constructor.
 
 PixelController (const PixelController &other) FL_NO_EXCEPT
 Copy constructor.
 
template<EOrder RGB_ORDER_OTHER>
 PixelController (const PixelController< RGB_ORDER_OTHER, LANES, MASK > &other) FL_NO_EXCEPT
 
FASTLED_FORCE_INLINE fl::u8 advanceAndLoadAndScale0 () FL_NO_EXCEPT
 non-template alias of advanceAndLoadAndScale<0>()
 
FASTLED_FORCE_INLINE fl::u8 advanceAndLoadAndScale0 (int lane) FL_NO_EXCEPT
 non-template alias of advanceAndLoadAndScale<0>()
 
FASTLED_FORCE_INLINE fl::u8 advanceAndLoadAndScale0 (int lane, fl::u8 scale) FL_NO_EXCEPT
 non-template alias of advanceAndLoadAndScale<0>()
 
FASTLED_FORCE_INLINE int advanceBy () FL_NO_EXCEPT
 Get the amount to advance the pointer by.
 
FASTLED_FORCE_INLINE void advanceData () FL_NO_EXCEPT
 Advance the data pointer forward, adjust position counter.
 
FASTLED_FORCE_INLINE fl::PixelIterator as_iterator (const Rgbw &rgbw) FL_NO_EXCEPT
 
template<typename PixelControllerT>
void copy (const PixelControllerT &other) FL_NO_EXCEPT
 
void disableColorAdjustment () FL_NO_EXCEPT
 
FASTLED_FORCE_INLINE bool ditherActive () const FL_NO_EXCEPT
 Is temporal dithering on for this frame? (any channel has a range)
 
void enable_dithering (EDitherMode dither) FL_NO_EXCEPT
 Toggle dithering enable/disable.
 
const fl::u8 * getRawPixelData () const FL_NO_EXCEPT
 Get read-only access to the current pixel data Used by encoders to access raw RGB values for HD processing.
 
FASTLED_FORCE_INLINE fl::u8 getScale0 () FL_NO_EXCEPT
 non-template alias of getscale<0>()
 
FASTLED_FORCE_INLINE fl::u8 getScale1 () FL_NO_EXCEPT
 non-template alias of getscale<1>()
 
FASTLED_FORCE_INLINE fl::u8 getScale2 () FL_NO_EXCEPT
 non-template alias of getscale<2>()
 
FASTLED_FORCE_INLINE bool has (int n) FL_NO_EXCEPT
 Do we have n pixels left to process?
 
void init_binary_dithering () FL_NO_EXCEPT
 Set up the values for binary dithering from the shared frame phase.
 
void initOffsets (int len) FL_NO_EXCEPT
 Initialize the PixelController::mOffsets array based on the length of the strip.
 
FASTLED_FORCE_INLINE int lanes () FL_NO_EXCEPT
 Get the number of lanes of the Controller.
 
FASTLED_FORCE_INLINE fl::u8 loadAndScale0 () FL_NO_EXCEPT
 non-template alias of loadAndScale<0>()
 
FASTLED_FORCE_INLINE fl::u8 loadAndScale0 (int lane) FL_NO_EXCEPT
 non-template alias of loadAndScale<0>()
 
FASTLED_FORCE_INLINE fl::u8 loadAndScale0 (int lane, fl::u8 scale) FL_NO_EXCEPT
 non-template alias of loadAndScale<0>()
 
FASTLED_FORCE_INLINE fl::u8 loadAndScale1 () FL_NO_EXCEPT
 non-template alias of loadAndScale<1>()
 
FASTLED_FORCE_INLINE fl::u8 loadAndScale1 (int lane) FL_NO_EXCEPT
 non-template alias of loadAndScale<1>()
 
FASTLED_FORCE_INLINE fl::u8 loadAndScale1 (int lane, fl::u8 scale) FL_NO_EXCEPT
 non-template alias of loadAndScale<1>()
 
FASTLED_FORCE_INLINE fl::u8 loadAndScale2 () FL_NO_EXCEPT
 non-template alias of loadAndScale<2>()
 
FASTLED_FORCE_INLINE fl::u8 loadAndScale2 (int lane) FL_NO_EXCEPT
 non-template alias of loadAndScale<2>()
 
FASTLED_FORCE_INLINE fl::u8 loadAndScale2 (int lane, fl::u8 scale) FL_NO_EXCEPT
 non-template alias of loadAndScale<2>()
 
FASTLED_FORCE_INLINE fl::u8 loadAndScaleChannel (fl::u8 c) FL_NO_EXCEPT
 One source channel, loaded, dithered and scaled – loadAndScale<SLOT> with RO(SLOT) replaced by a runtime channel index.
 
FASTLED_FORCE_INLINE void loadAndScaleRGB (fl::u8 *b0_out, fl::u8 *b1_out, fl::u8 *b2_out) FL_NO_EXCEPT
 
FASTLED_FORCE_INLINE void loadAndScaleRGBW (const Rgbw &rgbw, fl::u8 *b0_out, fl::u8 *b1_out, fl::u8 *b2_out, fl::u8 *b3_out) FL_NO_EXCEPT
 
FASTLED_FORCE_INLINE void loadAndScaleRGBWUnordered (const Rgbw &rgbw, fl::u8 *r_out, fl::u8 *g_out, fl::u8 *b_out, fl::u8 *w_out) FL_NO_EXCEPT
 loadAndScaleRGBW before its wire reorder: RGB in source order plus W.
 
FASTLED_FORCE_INLINE void loadAndScaleRGBWW (fl::Rgbww rgbww, fl::u8 *b0_out, fl::u8 *b1_out, fl::u8 *b2_out, fl::u8 *b3_out, fl::u8 *b4_out) FL_NO_EXCEPT
 Load + scale a single pixel to 5-channel RGBWW (issue #2558).
 
FASTLED_FORCE_INLINE void loadAndScaleRGBWWUnordered (fl::Rgbww rgbww, fl::u8 *r_out, fl::u8 *g_out, fl::u8 *b_out, fl::u8 *ww_out, fl::u8 *wc_out) FL_NO_EXCEPT
 loadAndScaleRGBWW before its wire reorder. See loadAndScaleRGBWUnordered.
 
PixelController & operator= (const PixelController &other) FL_NO_EXCEPT
 Copy assignment, through the same copy() as the copy constructor.
 
FASTLED_FORCE_INLINE void preStepFirstByteDithering () FL_NO_EXCEPT
 Some chipsets pre-cycle the first byte, which means we want to cycle byte 0's dithering separately.
 
void reseed_binary_dithering (fl::u8 R) FL_NO_EXCEPT
 Re-point binary dithering at phase R after construction, leaving the per-channel ranges e[] as init_binary_dithering() set them: only the offsets depend on the phase.
 
FASTLED_FORCE_INLINE int size () const FL_NO_EXCEPT
 Get the length of the LED strip.
 
FASTLED_FORCE_INLINE fl::u8 stepAdvanceAndLoadAndScale0 () FL_NO_EXCEPT
 stepDithering() and advanceAndLoadAndScale0()
 
FASTLED_FORCE_INLINE fl::u8 stepAdvanceAndLoadAndScale0 (int lane) FL_NO_EXCEPT
 stepDithering() and advanceAndLoadAndScale0()
 
FASTLED_FORCE_INLINE fl::u8 stepAdvanceAndLoadAndScale0 (int lane, fl::u8 scale) FL_NO_EXCEPT
 stepDithering() and advanceAndLoadAndScale0()
 
FASTLED_FORCE_INLINE void stepDithering () FL_NO_EXCEPT
 Step the dithering forward - creates triangular wave that toggles between pixels.
 

Static Public Member Functions

Template'd static functions for output

These functions are used for retrieving LED data for the LED chipset output controllers.

template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 loadByte (PixelController &pc) FL_NO_EXCEPT
 Read a byte of LED data.
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 loadByte (PixelController &pc, int lane) FL_NO_EXCEPT
 Read a byte of LED data for parallel output.
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 dither (PixelController &pc, fl::u8 b) FL_NO_EXCEPT
 Add dither offset to pixel value (BEFORE scaling).
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 dither (PixelController &, fl::u8 b, fl::u8 d) FL_NO_EXCEPT
 Add explicit dither offset to pixel value (BEFORE scaling).
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 scale (PixelController &pc, fl::u8 b) FL_NO_EXCEPT
 Scale a value using the per-channel scale data.
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 scale (PixelController &, fl::u8 b, fl::u8 scale) FL_NO_EXCEPT
 Scale a value.
 
Composite shortcut functions for loading, dithering, and scaling

These composite functions will load color data, dither it, and scale it all at once so that it's ready for the output controller to send to the LEDs.

template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 loadAndScale (PixelController &pc) FL_NO_EXCEPT
 Complete pipeline: load → dither → scale (THE MAGIC HAPPENS HERE!) Order is critical: pixel + dither FIRST, then scale by brightness.
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 loadAndScale (PixelController &pc, int lane) FL_NO_EXCEPT
 Complete pipeline: load → dither → scale (parallel output version)
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 loadAndScale (PixelController &pc, int lane, fl::u8 d, fl::u8 scale) FL_NO_EXCEPT
 Complete pipeline: load → dither → scale (explicit dither/scale values)
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 loadAndScale (PixelController &pc, int lane, fl::u8 scale) FL_NO_EXCEPT
 Loads and scales a single byte for a given output slot and lane.
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 advanceAndLoadAndScale (PixelController &pc) FL_NO_EXCEPT
 A version of loadAndScale() that advances the output data pointer.
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 advanceAndLoadAndScale (PixelController &pc, int lane) FL_NO_EXCEPT
 A version of loadAndScale() that advances the output data pointer.
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 advanceAndLoadAndScale (PixelController &pc, int lane, fl::u8 scale) FL_NO_EXCEPT
 A version of loadAndScale() that advances the output data pointer without dithering.
 
Data retrieval functions

These functions retrieve channel-specific data from the class, arranged in output order.

template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 getd (PixelController &pc) FL_NO_EXCEPT
 Gets the dithering data for the provided output slot.
 
template<int SLOT>
static FASTLED_FORCE_INLINE fl::u8 getscale (PixelController &pc) FL_NO_EXCEPT
 Gets the scale data for the provided output slot.
 

Public Attributes

fl::u8 d [3]
 [DITHER] Current dither offset per R,G,B channel (toggles via stepDithering)
 
fl::u8 e [3]
 [DITHER] Max dither range per R,G,B channel (inversely proportional to brightness)
 
fl::i8 mAdvance
 how many bytes to advance the pointer by each time. For CRGB this is 3.
 
ColorAdjustment mColorAdjustment
 
const fl::u8 * mData
 pointer to the underlying LED data
 
int mLen
 number of LEDs in the data for one lane
 
int mLenRemaining
 counter for the number of LEDs left to process
 
int mOffsets [LANES]
 the number of bytes to offset each lane from the starting pointer
 

Static Public Attributes

static constexpr EOrder kColorOrder = RGB_ORDER
 The colour order this instantiation writes, as a value.
 

The documentation for this struct was generated from the following file: