Skip to content

Commit aa4bf15

Browse files
committed
feat(graphics): benchmark rgb2yuv tile encoding
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
1 parent 36cdb85 commit aa4bf15

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ironrdp-graphics/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ authors.workspace = true
1111
keywords.workspace = true
1212
categories.workspace = true
1313

14+
[features]
15+
bench = []
16+
1417
[lib]
1518
doctest = false
1619
# test = false
@@ -31,6 +34,13 @@ thiserror.workspace = true
3134
[dev-dependencies]
3235
bmp = "0.5"
3336
expect-test.workspace = true
37+
criterion = "0.5"
38+
39+
[[bench]]
40+
name = "bench"
41+
path = "benches/bench.rs"
42+
required-features = ["bench"]
43+
harness = false
3444

3545
[lints]
3646
workspace = true
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use criterion::{criterion_group, criterion_main, Criterion};
2+
use ironrdp_graphics::color_conversion::to_64x64_ycbcr_tile;
3+
4+
pub fn criterion_benchmark(c: &mut Criterion) {
5+
const WIDTH: usize = 64;
6+
const HEIGHT: usize = 64;
7+
let input = vec![0; WIDTH * HEIGHT * 4];
8+
let stride = WIDTH * 4;
9+
let mut y = [0i16; WIDTH * HEIGHT];
10+
let mut cb = [0i16; WIDTH * HEIGHT];
11+
let mut cr = [0i16; WIDTH * HEIGHT];
12+
let format = ironrdp_graphics::image_processing::PixelFormat::ARgb32;
13+
c.bench_function("rgb2yuv", |b| {
14+
b.iter(|| to_64x64_ycbcr_tile(&input, WIDTH, HEIGHT, stride, format, &mut y, &mut cb, &mut cr))
15+
});
16+
}
17+
18+
criterion_group!(benches, criterion_benchmark);
19+
criterion_main!(benches);

0 commit comments

Comments
 (0)