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

◆ wave8Untranspose_4()

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

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

380 {
381 // Reverse the 4-lane transposition
382 // Input: 32 bytes of interleaved data (4 bytes per symbol, 8 symbols)
383 // Output: 4 Wave8Byte structures (32 bytes total, de-interleaved)
384
385 Wave8Byte lane_waves[4];
386
387 // Process each of the 8 symbols
388 for (int symbol_idx = 0; symbol_idx < 8; symbol_idx++) {
389 u8 lane_bytes[4] = {0, 0, 0, 0};
390
391 // Process 4 input bytes (2 pulses per byte)
392 for (int byte_idx = 0; byte_idx < 4; byte_idx++) {
393 u8 input_byte = transposed[symbol_idx * 4 + byte_idx];
394
395 // Calculate which pulse bits these correspond to
396 int pulse_bit_hi = 7 - (byte_idx * 2);
397 int pulse_bit_lo = pulse_bit_hi - 1;
398
399 // De-interleave 4 lanes from this byte
400 // Bit layout: [L3_hi, L2_hi, L1_hi, L0_hi, L3_lo, L2_lo, L1_lo, L0_lo]
401 for (int lane = 0; lane < 4; lane++) {
402 // Extract bits for this lane
403 u8 pulse_hi = (input_byte >> (4 + lane)) & 1;
404 u8 pulse_lo = (input_byte >> lane) & 1;
405
406 // Reconstruct lane byte
407 lane_bytes[lane] |= (pulse_hi << pulse_bit_hi);
408 lane_bytes[lane] |= (pulse_lo << pulse_bit_lo);
409 }
410 }
411
412 // Store de-interleaved bytes
413 for (int lane = 0; lane < 4; lane++) {
414 lane_waves[lane].symbols[symbol_idx].data = lane_bytes[lane];
415 }
416 }
417
418 // Copy de-interleaved data to output
419 for (int lane = 0; lane < 4; lane++) {
420 fl::isr::memcopy(output + lane * sizeof(Wave8Byte), &lane_waves[lane], sizeof(Wave8Byte));
421 }
422}
unsigned char u8
Definition stdint.h:131
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: