FastLED 3.10.8
Loading...
Searching...
No Matches

◆ wave8Untranspose_2()

void fl::wave8Untranspose_2 ( const u8(&) transposed[2 *sizeof(Wave8Byte)],
u8(&) output[2 *sizeof(Wave8Byte)] )

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

339 {
340 // Reverse the 2-lane transposition
341 // Input: 16 bytes of interleaved data (2 bytes per symbol, 8 symbols)
342 // Output: 2 Wave8Byte structures (16 bytes total, de-interleaved)
343
344 Wave8Byte lane_waves[2];
345
346 // Process each of the 8 symbols
347 for (int symbol_idx = 0; symbol_idx < 8; symbol_idx++) {
348 // Read the 2 interleaved bytes for this symbol
349 u16 interleaved = ((u16)transposed[symbol_idx * 2] << 8) |
350 transposed[symbol_idx * 2 + 1];
351
352 // De-interleave bits back to lanes
353 u8 lane0_bits = 0;
354 u8 lane1_bits = 0;
355
356 // Extract bits: interleaved format has alternating bits [L0, L1, L0, L1, ...]
357 // Bits are ordered: [L1_b7, L0_b7, L1_b6, L0_b6, L1_b5, L0_b5, L1_b4, L0_b4, ...]
358 for (int bit = 0; bit < 8; bit++) {
359 // Lane 0 bits are at odd positions (shifted left by 1)
360 if (interleaved & (1 << (bit * 2 + 1))) {
361 lane0_bits |= (1 << bit);
362 }
363 // Lane 1 bits are at even positions
364 if (interleaved & (1 << (bit * 2))) {
365 lane1_bits |= (1 << bit);
366 }
367 }
368
369 lane_waves[0].symbols[symbol_idx].data = lane0_bits;
370 lane_waves[1].symbols[symbol_idx].data = lane1_bits;
371 }
372
373 // Copy de-interleaved data to output
374 fl::isr::memcopy(output, &lane_waves[0], sizeof(Wave8Byte));
375 fl::isr::memcopy(output + sizeof(Wave8Byte), &lane_waves[1], sizeof(Wave8Byte));
376}
FL_OPTIMIZE_FUNCTION FL_IRAM FASTLED_FORCE_INLINE void memcopy(void *FL_RESTRICT_PARAM dst, const void *FL_RESTRICT_PARAM src, size_t num_bytes)
ISR-optimized memcpy with alignment detection and switch dispatch.
Definition memcpy.h:75
unsigned char u8
Definition stdint.h:131

References FL_NO_EXCEPT, FL_RESTRICT_PARAM, and fl::isr::memcopy().

+ Here is the call graph for this function: