| 35 | } |
| 36 | |
| 37 | __attribute__((noinline)) void benchmark_baseline(int iterations) { |
| 38 | CRGB color_scale(255, 200, 180); // Typical color temperature correction |
| 39 | u8 brightness = 128; // Mid brightness |
| 40 | |
| 41 | fl::span<const CRGB> input(g_input, NUM_LEDS); |
| 42 | fl::span<CRGBA5> output(g_output, NUM_LEDS); |
| 43 | |
| 44 | u8 local_sink = 0; |
| 45 | |
| 46 | for (int iter = 0; iter < iterations; iter++) { |
| 47 | // Vary brightness slightly to prevent over-optimization |
| 48 | u8 b = static_cast<u8>(brightness + (iter & 3)); |
| 49 | |
| 50 | asm volatile("" : : : "memory"); |
| 51 | |
| 52 | five_bit_hd_gamma_bitshift(input, color_scale, b, output); |
| 53 | |
| 54 | // Sink one value to prevent dead code elimination |
| 55 | local_sink ^= output[iter & (NUM_LEDS - 1)].brightness_5bit; |
| 56 | local_sink ^= output[iter & (NUM_LEDS - 1)].color.r; |
| 57 | |
| 58 | asm volatile("" : "+r"(local_sink) : : "memory"); |
| 59 | } |
| 60 | |
| 61 | g_sink = local_sink; |
| 62 | } |
| 63 | |
| 64 | int main(int argc, char *argv[]) { |
| 65 | bool json_output = (argc > 1 && fl::strcmp(argv[1], "baseline") == 0); |
no test coverage detected