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

◆ wave8Untranspose_2()

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

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

332 {
333 // Reverse the 2-lane transposition
334 // Input: 16 bytes of interleaved data (2 bytes per symbol, 8 symbols)
335 // Output: 2 Wave8Byte structures (16 bytes total, de-interleaved)
336
337 Wave8Byte lane_waves[2];
338
339 // Process each of the 8 symbols
340 for (int symbol_idx = 0; symbol_idx < 8; symbol_idx++) {
341 // Read the 2 interleaved bytes for this symbol
342 u16 interleaved = ((u16)transposed[symbol_idx * 2] << 8) |
343 transposed[symbol_idx * 2 + 1];
344
345 // De-interleave bits back to lanes
346 u8 lane0_bits = 0;
347 u8 lane1_bits = 0;
348
349 // Extract bits: interleaved format has alternating bits [L0, L1, L0, L1, ...]
350 // Bits are ordered: [L1_b7, L0_b7, L1_b6, L0_b6, L1_b5, L0_b5, L1_b4, L0_b4, ...]
351 for (int bit = 0; bit < 8; bit++) {
352 // Lane 0 bits are at odd positions (shifted left by 1)
353 if (interleaved & (1 << (bit * 2 + 1))) {
354 lane0_bits |= (1 << bit);
355 }
356 // Lane 1 bits are at even positions
357 if (interleaved & (1 << (bit * 2))) {
358 lane1_bits |= (1 << bit);
359 }
360 }
361
362 lane_waves[0].symbols[symbol_idx].data = lane0_bits;
363 lane_waves[1].symbols[symbol_idx].data = lane1_bits;
364 }
365
366 // Copy de-interleaved data to output
367 fl::isr::memcpy(output, &lane_waves[0], sizeof(Wave8Byte));
368 fl::isr::memcpy(output + sizeof(Wave8Byte), &lane_waves[1], sizeof(Wave8Byte));
369}
FL_OPTIMIZE_FUNCTION FL_IRAM FASTLED_FORCE_INLINE void memcpy(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_RESTRICT_PARAM, and fl::isr::memcpy().

+ Here is the call graph for this function: