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

◆ wave8Untranspose_4()

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

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

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