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

◆ phase()

static FASTLED_FORCE_INLINE u8 fl::BinaryDither::phase ( u8 frame)
inlinestatic

The frame's offset pattern value Q: frame wrapped to VIRTUAL_BITS, bit-reversed so consecutive frames land far apart (0,1,2,3 -> 0,128,64,192), then shifted to the middle of its bin.

Definition at line 120 of file binary_dither.h.

120 {
121 frame &= (0x01 << VIRTUAL_BITS) - 1;
122 u8 q = 0;
123 if (frame & 0x01) { q |= 0x80; }
124 if (frame & 0x02) { q |= 0x40; }
125 if (frame & 0x04) { q |= 0x20; }
126 if (frame & 0x08) { q |= 0x10; }
127 if (frame & 0x10) { q |= 0x08; }
128 if (frame & 0x20) { q |= 0x04; }
129 if (frame & 0x40) { q |= 0x02; }
130 if (frame & 0x80) { q |= 0x01; }
131 if (VIRTUAL_BITS < 8) {
132 q += 0x01 << (7 - VIRTUAL_BITS);
133 }
134 return q;
135 }
#define VIRTUAL_BITS
Alias for RECOMMENDED_VIRTUAL_BITS.
unsigned char u8
Definition stdint.h:131

References FASTLED_FORCE_INLINE, fl::FL_NO_EXCEPT, and VIRTUAL_BITS.

Referenced by init(), and reseed().

+ Here is the caller graph for this function: