MCPcopy Create free account
hub / github.com/FastLED/FastLED / wave8Untranspose_8

Function wave8Untranspose_8

src/fl/channels/wave8.cpp.hpp:417–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415}
416
417FL_OPTIMIZE_FUNCTION
418void wave8Untranspose_8(const u8 (&FL_RESTRICT_PARAM transposed)[8 * sizeof(Wave8Byte)],
419 u8 (&FL_RESTRICT_PARAM output)[8 * sizeof(Wave8Byte)]) {
420 // Reverse the 8-lane transposition
421 // Input: 64 bytes of interleaved data (8 bytes per symbol, 8 symbols)
422 // Output: 8 Wave8Byte structures (64 bytes total, de-interleaved)
423
424 Wave8Byte lane_waves[8];
425
426 // Process each of the 8 symbols
427 for (int symbol_idx = 0; symbol_idx < 8; symbol_idx++) {
428 u8 lane_bytes[8] = {0, 0, 0, 0, 0, 0, 0, 0};
429
430 // Process 8 input bytes (1 pulse per byte)
431 // After transpose+reversal: byte 0 = bit 7 (first pulse, MSB),
432 // byte 7 = bit 0 (last pulse, LSB)
433 for (int byte_idx = 0; byte_idx < 8; byte_idx++) {
434 u8 input_byte = transposed[symbol_idx * 8 + byte_idx];
435
436 // Calculate which pulse bit this corresponds to
437 // byte 0 = bit 7, byte 7 = bit 0 (reversed order)
438 int pulse_bit = 7 - byte_idx;
439
440 // De-interleave 8 lanes from this byte
441 // Bit layout: [L7, L6, L5, L4, L3, L2, L1, L0]
442 for (int lane = 0; lane < 8; lane++) {
443 // Extract bit for this lane (lane 0 = LSB, lane 7 = MSB)
444 u8 pulse = (input_byte >> lane) & 1;
445
446 // Reconstruct lane byte
447 lane_bytes[lane] |= (pulse << pulse_bit);
448 }
449 }
450
451 // Store de-interleaved bytes
452 for (int lane = 0; lane < 8; lane++) {
453 lane_waves[lane].symbols[symbol_idx].data = lane_bytes[lane];
454 }
455 }
456
457 // Copy de-interleaved data to output
458 for (int lane = 0; lane < 8; lane++) {
459 fl::isr::memcpy(output + lane * sizeof(Wave8Byte), &lane_waves[lane], sizeof(Wave8Byte));
460 }
461}
462
463FL_OPTIMIZE_FUNCTION
464void wave8Untranspose_16(const u8 (&FL_RESTRICT_PARAM transposed)[16 * sizeof(Wave8Byte)],

Callers 2

FL_TEST_FILEFunction · 0.85
FL_TEST_FILEFunction · 0.85

Calls 1

memcpyFunction · 0.50

Tested by

no test coverage detected