FastLED 3.10.6
Loading...
Searching...
No Matches
wave8.h
Go to the documentation of this file.
1
9
10#pragma once
11
12// IWYU pragma: private
13
14#include "fl/channels/wave8.h"
16
17namespace fl {
18
19namespace detail {
20
21// ============================================================================
22// Constexpr LUTs (header — compile-time visibility required)
23// ============================================================================
24
26constexpr u8 kTranspose4_16_LUT[16] = {0x00, 0x01, 0x04, 0x05, 0x10, 0x11,
27 0x14, 0x15, 0x40, 0x41, 0x44, 0x45,
28 0x50, 0x51, 0x54, 0x55};
29
31constexpr u8 kTranspose2_4_LUT[4] = {
32 0x00, // 0b00 → no bits set
33 0x01, // 0b01 → bit at position 0 (pulse 1)
34 0x10, // 0b10 → bit at position 4 (pulse 0)
35 0x11 // 0b11 → bits at positions 0 and 4 (both pulses)
36};
37
38} // namespace detail
39} // namespace fl
40
41// ============================================================================
42// 2-Lane Transposition Helper Macro (header — expanded at each use)
43// ============================================================================
44
45#define FL_WAVE8_SPREAD_TO_16(lane_u8_0, lane_u8_1, out_16) \
46 do { \
47 const ::fl::u8 _a = (::fl::u8)(lane_u8_0); \
48 const ::fl::u8 _b = (::fl::u8)(lane_u8_1); \
49 const ::fl::u16 _even = \
50 (::fl::u16)((::fl::u16)::fl::detail::kTranspose4_16_LUT[_b & 0x0Fu] | \
51 ((::fl::u16)::fl::detail::kTranspose4_16_LUT[_b >> 4] << 8)); \
52 const ::fl::u16 _odd = \
53 (::fl::u16)(((::fl::u16)::fl::detail::kTranspose4_16_LUT[_a & 0x0Fu] | \
54 ((::fl::u16)::fl::detail::kTranspose4_16_LUT[_a >> 4] << 8)) \
55 << 1); \
56 (out_16) |= (::fl::u16)(_even | _odd); \
57 } while (0)
58
59namespace fl {
60namespace detail {
61
62// ============================================================================
63// Out-of-line function declarations
64// ============================================================================
65
67 const Wave8BitExpansionLut& lut,
68 Wave8Byte* output) FL_NO_EXCEPT;
69
70void wave8_expand_byte(u8 byte_value,
71 const Wave8ByteExpansionLut& lut,
72 Wave8Byte* output) FL_NO_EXCEPT;
73
74void wave8_transpose_2(const Wave8Byte lane_waves[2],
75 u8 output[2 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
76
77void wave8_transpose_4(const Wave8Byte lane_waves[4],
78 u8 output[4 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
79
80void wave8_transpose_8(const Wave8Byte lane_waves[8],
81 u8 output[8 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
82
83void wave8_transpose_16(const Wave8Byte lane_waves[16],
84 u8 output[16 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
85
86void wave8_transpose_16x2_pipe2(const Wave8Byte lane_waves_a[16],
87 const Wave8Byte lane_waves_b[16],
88 u8 output_a[16 * sizeof(Wave8Byte)],
89 u8 output_b[16 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
90
91void wave8_transpose_16x4_pipe4(const Wave8Byte lane_waves_a[16],
92 const Wave8Byte lane_waves_b[16],
93 const Wave8Byte lane_waves_c[16],
94 const Wave8Byte lane_waves_d[16],
95 u8 output_a[16 * sizeof(Wave8Byte)],
96 u8 output_b[16 * sizeof(Wave8Byte)],
97 u8 output_c[16 * sizeof(Wave8Byte)],
98 u8 output_d[16 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
99
100void wave8_transpose_16_bf1(const u8 lanes[16],
101 u8 W0, u8 W1,
102 u8 output[16 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
103
104void wave8_transpose_8_bf1(const u8 lanes[8],
105 u8 W0, u8 W1,
106 u8 output[8 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
107
108void wave8_transpose_4_bf1(const u8 lanes[4],
109 u8 W0, u8 W1,
110 u8 output[4 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
111
112void wave8_transpose_2_bf1(const u8 lanes[2],
113 u8 W0, u8 W1,
114 u8 output[2 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
115
116void wave8_transpose_16x4_bf1_pipe4(const u8 lanes_a[16],
117 const u8 lanes_b[16],
118 const u8 lanes_c[16],
119 const u8 lanes_d[16],
120 u8 W0, u8 W1,
121 u8 output_a[16 * sizeof(Wave8Byte)],
122 u8 output_b[16 * sizeof(Wave8Byte)],
123 u8 output_c[16 * sizeof(Wave8Byte)],
124 u8 output_d[16 * sizeof(Wave8Byte)]) FL_NO_EXCEPT;
125
126} // namespace detail
127
131void wave8(u8 lane,
132 const Wave8BitExpansionLut& lut,
133 u8 (&FL_RESTRICT_PARAM output)[sizeof(Wave8Byte)]) FL_NO_EXCEPT;
134
135} // namespace fl
#define FL_RESTRICT_PARAM
constexpr EOrderW W0
Definition eorder.h:27
constexpr EOrderW W1
Definition eorder.h:26
unsigned char u8
Definition stdint.h:131
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_16_bf1(const u8 lanes[16], u8 W0, u8 W1, u8 output[16 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_16x2_pipe2(const Wave8Byte lane_waves_a[16], const Wave8Byte lane_waves_b[16], u8 output_a[16 *sizeof(Wave8Byte)], u8 output_b[16 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_4(const Wave8Byte lane_waves[4], u8 output[4 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
Definition wave8.cpp.hpp:62
constexpr u8 kTranspose2_4_LUT[4]
4-lane LUT: Spreads 2 bits into 4-lane interleaved positions (2-bit → byte).
Definition wave8.h:31
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_16x4_pipe4(const Wave8Byte lane_waves_a[16], const Wave8Byte lane_waves_b[16], const Wave8Byte lane_waves_c[16], const Wave8Byte lane_waves_d[16], u8 output_a[16 *sizeof(Wave8Byte)], u8 output_b[16 *sizeof(Wave8Byte)], u8 output_c[16 *sizeof(Wave8Byte)], u8 output_d[16 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_8(const Wave8Byte lane_waves[8], u8 output[8 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_16(const Wave8Byte lane_waves[16], u8 output[16 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_16x4_bf1_pipe4(const u8 lanes_a[16], const u8 lanes_b[16], const u8 lanes_c[16], const u8 lanes_d[16], u8 W0, u8 W1, u8 output_a[16 *sizeof(Wave8Byte)], u8 output_b[16 *sizeof(Wave8Byte)], u8 output_c[16 *sizeof(Wave8Byte)], u8 output_d[16 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_4_bf1(const u8 lanes[4], u8 W0, u8 W1, u8 output[4 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_8_bf1(const u8 lanes[8], u8 W0, u8 W1, u8 output[8 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_2(const Wave8Byte lane_waves[2], u8 output[2 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
Definition wave8.cpp.hpp:48
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_convert_byte_to_wave8byte(u8 byte_value, const Wave8BitExpansionLut &lut, Wave8Byte *output) FL_NO_EXCEPT
Definition wave8.cpp.hpp:24
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_transpose_2_bf1(const u8 lanes[2], u8 W0, u8 W1, u8 output[2 *sizeof(Wave8Byte)]) FL_NO_EXCEPT
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8_expand_byte(u8 byte_value, const Wave8ByteExpansionLut &lut, Wave8Byte *output) FL_NO_EXCEPT
Definition wave8.cpp.hpp:39
constexpr u8 kTranspose4_16_LUT[16]
2-lane LUT: Spreads 4 bits into 2-lane interleaved positions (nibble → byte).
Definition wave8.h:26
Compile-time linker keep-alive hook for a single fl::Bus.
Definition bus_info.h:57
unsigned char u8
Definition stdint.h:131
FL_IRAM FL_OPTIMIZE_FUNCTION void wave8(u8 lane, const Wave8BitExpansionLut &lut, u8(&FL_RESTRICT_PARAM output)[sizeof(Wave8Byte)]) FL_NO_EXCEPT
Public single-lane wave8 encoder.
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NO_EXCEPT