FastLED 3.9.15
Loading...
Searching...
No Matches
BlurBenchmark.ino
Go to the documentation of this file.
1// @filter: (mem is large)
2// Gaussian blur AVR benchmark — run in avr8js emulator.
3// Exercises blurGaussian<R,R> on an 8x8 CRGB matrix and prints
4// microseconds per iteration over Serial.
5
6#include <FastLED.h>
7
8#define WIDTH 8
9#define HEIGHT 8
10#define NUM_LEDS (WIDTH * HEIGHT)
11#define ITERS 100
12
14
15static void fill_test_data() {
16 for (int i = 0; i < NUM_LEDS; i++) {
17 leds[i] = CRGB(i * 37 + 17, i * 59 + 31, i * 83 + 47);
18 }
19}
20
21template <int hR, int vR>
22static void bench(const char *label) {
24
25 // Warmup
28
29 // Timed run
31 unsigned long t0 = micros();
32 for (int i = 0; i < ITERS; i++) {
34 }
35 unsigned long elapsed = micros() - t0;
36
37 Serial.print(label);
38 Serial.print(": ");
39 Serial.print(elapsed / ITERS);
40 Serial.println(" us/iter");
41}
42
43void setup() {
44 Serial.begin(115200);
45 delay(100);
46
47 Serial.println("== Gaussian Blur AVR Benchmark (8x8) ==");
48
49 bench<1, 1>("R1 (3x3)");
50 bench<2, 2>("R2 (5x5)");
51 bench<3, 3>("R3 (7x7)");
52 bench<4, 4>("R4 (9x9)");
53
54 Serial.println("== Done ==");
55}
56
57void loop() {
58 delay(1000);
59 Serial.println("Test loop!");
60}
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
#define ITERS
void setup()
static void fill_test_data()
static void bench(const char *label)
void loop()
#define WIDTH
#define HEIGHT
fl::CRGB CRGB
Definition crgb.h:25
void blurGaussian(Canvas< RGB_T > &canvas, alpha8 dimFactor)
Compile-time Gaussian blur with independent H/V radii.
Simple rectangular canvas for graphics operations Combines a pixel buffer with dimensions for cache-o...
Definition canvas.h:66
#define Serial
Definition serial.h:304