FastLED 3.9.15
Loading...
Searching...
No Matches

◆ wave8_transpose_16_bf1()

FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION void fl::detail::wave8_transpose_16_bf1 ( const u8 lanes[16],
u8 W0,
u8 W1,
u8 output[16 *sizeof(Wave8Byte)] )

BF1: chipset-aware direct encode for Wave8 16-lane (#2548 deep-dive).

Bypasses the byte_lut entirely by exploiting the algebraic identity: output_bit(s, p, lane) = M0_p XOR (input_bit_(7-s)_of_lane AND D_p) where W0/W1 are the bit-0 / bit-1 waveform patterns (chipset constants), M0_p = (W0 >> (7-p)) & 1, D_p = M0_p XOR M1_p. The bit-transpose of input lane bytes (giving the per-symbol column bytes) is computed ONCE by spread_transpose16_symbol — replacing the prior 8 calls (one per symbol) plus the 16 byte_lut expansions.

Bit-identical to wave8_transpose_16(expand(lanes_input), output). Works for ANY Wave8 chipset/timing — W0/W1 are derived from the byte_lut at runtime.

Measured 6 822 → 1 757 µs/frame (3.88× faster than pipe4, 5.49× vs baseline) when fused with pipe4 (#2548 final).

Definition at line 315 of file wave8.hpp.

317 {
318 u8 d_mask[8];
319 u8 m0_mask[8];
320 const u8 D_byte = W0 ^ W1;
321 for (int p = 0; p < 8; ++p) {
322 const int shift = 7 - p;
323 d_mask[p] = ((D_byte >> shift) & 1) ? 0xFFu : 0x00u;
324 m0_mask[p] = ((W0 >> shift) & 1) ? 0xFFu : 0x00u;
325 }
326 // Bit-transpose: spread_transpose16_symbol on input bytes gives
327 // cols[2s+h] = byte where bit L = bit(7-s) of lanes[L+8h].
328 u8 cols[16];
329 spread_transpose16_symbol(lanes, cols);
330 for (int s = 0; s < 8; ++s) {
331 const u8 col_lo = cols[2 * s + 0];
332 const u8 col_hi = cols[2 * s + 1];
333 for (int p = 0; p < 8; ++p) {
334 output[s * 16 + p * 2 + 0] = m0_mask[p] ^ (col_lo & d_mask[p]);
335 output[s * 16 + p * 2 + 1] = m0_mask[p] ^ (col_hi & d_mask[p]);
336 }
337 }
338}
FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION void spread_transpose16_symbol(const u8 l[16], u8 out[16])
Transpose one symbol of 16 lanes (16 input bytes) into 16 output bytes: 8 pulses × 2 bytes,...
unsigned char u8
Definition stdint.h:131
@ W1
White is second.
Definition eorder.h:26
@ W0
White is first.
Definition eorder.h:27

References spread_transpose16_symbol(), fl::W0, and fl::W1.

Referenced by fl::wave8Transpose_16_bf1().

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