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

◆ wave8_transpose_4_bf1()

void fl::detail::wave8_transpose_4_bf1 ( const u8 lanes[4],
u8 W0,
u8 W1,
u8 output[4 *sizeof(Wave8Byte)] )

Definition at line 227 of file wave8.cpp.hpp.

229 {
230 u8 d_mask[8];
231 u8 m0_mask[8];
232 const u8 D_byte = W0 ^ W1;
233 for (int p = 0; p < 8; ++p) {
234 const int shift = 7 - p;
235 d_mask[p] = ((D_byte >> shift) & 1) ? 0xFFu : 0x00u;
236 m0_mask[p] = ((W0 >> shift) & 1) ? 0xFFu : 0x00u;
237 }
238 const u32 aLo = spreadA(lanes[0]) | (spreadA(lanes[1]) << 1)
239 | (spreadA(lanes[2]) << 2) | (spreadA(lanes[3]) << 3);
240 const u32 bLo = spreadB(lanes[0]) | (spreadB(lanes[1]) << 1)
241 | (spreadB(lanes[2]) << 2) | (spreadB(lanes[3]) << 3);
242 u8 cols[8];
243 cols[0] = static_cast<u8>(aLo);
244 cols[1] = static_cast<u8>(aLo >> 8);
245 cols[2] = static_cast<u8>(aLo >> 16);
246 cols[3] = static_cast<u8>(aLo >> 24);
247 cols[4] = static_cast<u8>(bLo);
248 cols[5] = static_cast<u8>(bLo >> 8);
249 cols[6] = static_cast<u8>(bLo >> 16);
250 cols[7] = static_cast<u8>(bLo >> 24);
251 for (int s = 0; s < 8; ++s) {
252 const u8 col = cols[s];
253 for (int k = 0; k < 4; ++k) {
254 const int p_hi = 2 * k;
255 const int p_lo = 2 * k + 1;
256 const u8 hi = static_cast<u8>((m0_mask[p_hi] & 0xF0u) ^ ((col << 4) & d_mask[p_hi]));
257 const u8 lo = static_cast<u8>((m0_mask[p_lo] & 0x0Fu) ^ (col & d_mask[p_lo]));
258 output[s * 4 + k] = static_cast<u8>(hi | lo);
259 }
260 }
261}
FASTLED_FORCE_INLINE u32 spreadA(u8 v)
Pulses 7,6,5,4 of v (byte j = bit (7-j)). Depends only on the high nibble.
FASTLED_FORCE_INLINE u32 spreadB(u8 v)
Pulses 3,2,1,0 of v (byte j = bit (3-j)). Depends only on the low nibble.
unsigned char u8
Definition stdint.h:131
@ W1
White is second.
Definition eorder.h:26
@ W0
White is first.
Definition eorder.h:27

References fl::FL_NO_EXCEPT, spreadA(), spreadB(), fl::W0, and fl::W1.

Referenced by fl::wave8Transpose_4_bf1().

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