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

Function fl_parlio_measure

examples/AutoResearch/AutoResearchParlioEncode.h:125–161  ·  view source on GitHub ↗

Time one configuration: scratch + output buffers (caller pre-allocates).

Source from the content-addressed store, hash-verified

123
124// Time one configuration: scratch + output buffers (caller pre-allocates).
125inline fl::u32 fl_parlio_measure(const fl::u8 *scratch, fl::size_t scratch_size,
126 fl::u8 *output, fl::size_t output_size,
127 const fl::Wave8ByteExpansionLut &byte_lut,
128 int iters_byte_positions,
129 volatile fl::u32 *sink) {
130 constexpr fl::size_t LANES = 16;
131 constexpr fl::size_t BYTES_PER_LANE = 768; // 256 LEDs × 3
132 const fl::size_t lane_stride = BYTES_PER_LANE;
133
134 const fl::size_t required_scratch = LANES * BYTES_PER_LANE;
135 const fl::size_t required_output = BYTES_PER_LANE * LANES * sizeof(fl::Wave8Byte);
136 if (scratch_size < required_scratch || output_size < required_output) {
137 FL_WARN("fl_parlio_measure: undersized buffer "
138 "(scratch=" << scratch_size << " need=" << required_scratch
139 << ", output=" << output_size << " need=" << required_output << ")");
140 return 0u;
141 }
142
143 constexpr fl::size_t BLOCK_SIZE = LANES * sizeof(fl::Wave8Byte);
144 fl::u32 t0 = micros();
145 int it = 0;
146 while (it < iters_byte_positions) {
147 const fl::size_t byte_offset =
148 static_cast<fl::size_t>(it) % BYTES_PER_LANE;
149 if (byte_offset + 3 < BYTES_PER_LANE && it + 3 < iters_byte_positions) {
150 *sink ^= fl_parlio_inner_four_byte_positions_bf1_pipe4(
151 scratch, lane_stride, byte_offset, byte_lut, output);
152 it += 4;
153 } else {
154 const fl::size_t output_idx = byte_offset * BLOCK_SIZE;
155 *sink ^= fl_parlio_inner_one_byte_position_bf1(
156 scratch, lane_stride, byte_offset, byte_lut, output, output_idx);
157 it += 1;
158 }
159 }
160 return micros() - t0;
161}
162
163inline fl::u8 *fl_parlio_alloc(fl::size_t size, bool psram) {
164 return reinterpret_cast<fl::u8 *>(heap_caps_malloc(

Callers 1

measureParlioEncodeFunction · 0.85

Calls 1

microsFunction · 0.50

Tested by

no test coverage detected