| 49 | /// @param output Output buffer (6 bytes = 2 * 3) |
| 50 | FASTLED_FORCE_INLINE FL_IRAM FL_OPTIMIZE_FUNCTION |
| 51 | void wave3_transpose_2(const Wave3Byte lane_waves[2], |
| 52 | u8 output[2 * sizeof(Wave3Byte)]) { |
| 53 | // Wave3 produces 3 symbols per LED byte (one byte per symbol for each lane). |
| 54 | // For 2 lanes: interleave bits from both lanes into 2 bytes per symbol. |
| 55 | // Each symbol byte has 8 bits. With 2 lanes we produce 2 bytes per symbol |
| 56 | // using the same bit-spreading as wave8_transpose_2. |
| 57 | |
| 58 | for (int symbol_idx = 0; symbol_idx < 3; symbol_idx++) { |
| 59 | u8 l0 = lane_waves[0].data[symbol_idx]; |
| 60 | u8 l1 = lane_waves[1].data[symbol_idx]; |
| 61 | |
| 62 | // Interleave bits: for each bit position, lane0 goes to odd bits, lane1 to even bits |
| 63 | u16 interleaved = 0; |
| 64 | for (int bit = 0; bit < 8; bit++) { |
| 65 | u16 b0 = (l0 >> bit) & 1; |
| 66 | u16 b1 = (l1 >> bit) & 1; |
| 67 | interleaved |= (b1 << (bit * 2)); // even positions |
| 68 | interleaved |= (b0 << (bit * 2 + 1)); // odd positions |
| 69 | } |
| 70 | |
| 71 | output[symbol_idx * 2] = (u8)(interleaved >> 8); |
| 72 | output[symbol_idx * 2 + 1] = (u8)(interleaved & 0xFF); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | // ============================================================================ |
| 77 | // 4-Lane Transposition (Force Inline) |