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
13
CRGB
leds
[
NUM_LEDS
];
14
15
static
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
21
template
<
int
hR,
int
vR>
22
static
void
bench
(
const
char
*label) {
23
fl::gfx::Canvas<CRGB>
canvas(
fl::span<CRGB>
(
leds
,
NUM_LEDS
),
WIDTH
,
HEIGHT
);
24
25
// Warmup
26
fill_test_data
();
27
fl::gfx::blurGaussian<hR, vR>
(canvas);
28
29
// Timed run
30
fill_test_data
();
31
unsigned
long
t0 = micros();
32
for
(
int
i = 0; i <
ITERS
; i++) {
33
fl::gfx::blurGaussian<hR, vR>
(canvas);
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
43
void
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
57
void
loop
() {
58
delay(1000);
59
Serial
.println(
"Test loop!"
);
60
}
NUM_LEDS
#define NUM_LEDS
Definition
Animartrix.ino:79
leds
fl::CRGB leds[NUM_LEDS]
Definition
Animartrix.ino:93
ITERS
#define ITERS
Definition
BlurBenchmark.ino:11
setup
void setup()
Definition
BlurBenchmark.ino:43
fill_test_data
static void fill_test_data()
Definition
BlurBenchmark.ino:15
bench
static void bench(const char *label)
Definition
BlurBenchmark.ino:22
loop
void loop()
Definition
BlurBenchmark.ino:57
WIDTH
#define WIDTH
HEIGHT
#define HEIGHT
fl::span
Definition
span.h:385
CRGB
fl::CRGB CRGB
Definition
crgb.h:25
fl::gfx::blurGaussian
void blurGaussian(Canvas< RGB_T > &canvas, alpha8 dimFactor)
Compile-time Gaussian blur with independent H/V radii.
Definition
blur.cpp.hpp:1195
fl::gfx::Canvas
Simple rectangular canvas for graphics operations Combines a pixel buffer with dimensions for cache-o...
Definition
canvas.h:66
Serial
#define Serial
Definition
serial.h:304
examples
BlurBenchmark
BlurBenchmark.ino
Generated on Tue Jun 16 2026 00:06:58 for FastLED by
1.13.2