File: bench_color_mapper.rs

package info (click to toggle)
rust-fast-image-resize 5.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,772 kB
  • sloc: makefile: 2
file content (29 lines) | stat: -rw-r--r-- 816 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use fast_image_resize::create_srgb_mapper;
use fast_image_resize::images::Image;
use fast_image_resize::pixels::U8x3;
use utils::pin_process_to_cpu0;
use utils::testing::PixelTestingExt;

mod utils;

pub fn bench_color_mapper(bench_group: &mut utils::BenchGroup) {
    let src_image = U8x3::load_big_src_image();
    let mut dst_image = Image::new(
        src_image.width(),
        src_image.height(),
        src_image.pixel_type(),
    );
    let mapper = create_srgb_mapper();
    bench_group
        .criterion_group
        .bench_function("SRGB U8x3 => RGB U8x3", |bencher| {
            bencher.iter(|| {
                mapper.forward_map(&src_image, &mut dst_image).unwrap();
            })
        });
}

fn main() {
    pin_process_to_cpu0();
    utils::run_bench(bench_color_mapper, "Color mapper");
}