aboutsummaryrefslogtreecommitdiff
path: root/vendor/exr/benches
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
committerValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
commita990de90fe41456a23e58bd087d2f107d321f3a1 (patch)
tree15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/exr/benches
parent3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff)
downloadfparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz
fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip
Deleted vendor folder
Diffstat (limited to 'vendor/exr/benches')
-rw-r--r--vendor/exr/benches/pixel_format_conversion.rs119
-rw-r--r--vendor/exr/benches/profiling.rs39
-rw-r--r--vendor/exr/benches/read.rs172
-rw-r--r--vendor/exr/benches/write.rs80
4 files changed, 0 insertions, 410 deletions
diff --git a/vendor/exr/benches/pixel_format_conversion.rs b/vendor/exr/benches/pixel_format_conversion.rs
deleted file mode 100644
index 3d1ba93..0000000
--- a/vendor/exr/benches/pixel_format_conversion.rs
+++ /dev/null
@@ -1,119 +0,0 @@
-#[macro_use]
-extern crate bencher;
-
-extern crate exr;
-use exr::prelude::*;
-
-use bencher::Bencher;
-use std::fs;
-use std::io::Cursor;
-use exr::image::pixel_vec::PixelVec;
-use exr::io::Data;
-use exr::block::samples::FromNativeSample;
-
-const F32_ZIPS_PATH: &'static str = "tests/images/valid/custom/crowskull/crow_zips.exr";
-const F32_UNCOMPRESSED_PATH: &'static str = "tests/images/valid/custom/crowskull/crow_uncompressed.exr";
-const F16_UNCOMPRESSED_PATH: &'static str = "tests/images/valid/custom/crowskull/crow_uncompressed_half.exr";
-const F16_ZIP_PATH: &'static str = "tests/images/valid/custom/crowskull/crow_zip_half.exr";
-
-/// Read an image from an in-memory buffer into its native f32 format
-fn read_f32_as_f32_uncompressed_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f32>(bench, F32_UNCOMPRESSED_PATH, false);
-}
-
-/// Read image and convert the samples to u32 (from native f32)
-fn read_f32_as_u32_uncompressed_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<u32>(bench, F32_UNCOMPRESSED_PATH, false);
-}
-
-/// f16 is not natively supported by CPUs, which introduces unique performance pitfalls
-fn read_f32_as_f16_uncompressed_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f16>(bench, F32_UNCOMPRESSED_PATH, false);
-}
-
-fn read_f16_as_f16_uncompressed_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f16>(bench, F16_UNCOMPRESSED_PATH, false);
-}
-
-fn read_f16_as_f32_uncompressed_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f32>(bench, F16_UNCOMPRESSED_PATH, false);
-}
-
-fn read_f16_as_u32_uncompressed_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<u32>(bench, F16_UNCOMPRESSED_PATH, false);
-}
-
-
-fn read_f32_as_f16_zips_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f16>(bench, F32_ZIPS_PATH, false);
-}
-
-fn read_f16_as_f32_zip_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f32>(bench, F16_ZIP_PATH, false);
-}
-
-fn read_f32_as_f16_zips_nthreads(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f16>(bench, F32_ZIPS_PATH, true);
-}
-
-fn read_f16_as_f32_zip_nthreads(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f32>(bench, F16_ZIP_PATH, true);
-}
-
-fn read_f32_as_f32_zips_nthreads(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f32>(bench, F32_ZIPS_PATH, true);
-}
-
-fn read_f16_as_f16_zip_nthreads(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f16>(bench, F16_ZIP_PATH, true);
-}
-
-fn read_f32_as_f32_zips_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f32>(bench, F32_ZIPS_PATH, false);
-}
-
-fn read_f16_as_f16_zip_1thread(bench: &mut Bencher) {
- bench_read_image_rgba_as::<f16>(bench, F16_ZIP_PATH, false);
-}
-
-fn bench_read_image_rgba_as<T>(bench: &mut Bencher, path: &str, parallel: bool) {
- let mut file = fs::read(path).unwrap();
- bencher::black_box(&mut file);
-
- bench.iter(||{
- let image = read_file_from_memory_as::<f16>(file.as_slice(), parallel);
- bencher::black_box(image);
- })
-}
-
-fn read_file_from_memory_as<T>(file: &[u8], parallel: bool) -> RgbaImage<PixelVec<(T, T, T, T)>>
- where T: FromNativeSample
-{
- let read = exr::prelude::read()
- .no_deep_data().largest_resolution_level()
- .rgba_channels(PixelVec::<(T, T, T, T)>::constructor, PixelVec::set_pixel)
- .first_valid_layer().all_attributes();
-
- let read = if parallel { read } else { read.non_parallel() };
- read.from_buffered(Cursor::new(file)).unwrap()
-}
-
-benchmark_group!(pixel_format_conversion,
- read_f32_as_f32_uncompressed_1thread,
- read_f32_as_u32_uncompressed_1thread,
- read_f32_as_f16_uncompressed_1thread,
- read_f32_as_f16_zips_1thread,
- read_f32_as_f16_zips_nthreads,
- read_f32_as_f32_zips_nthreads,
- read_f32_as_f32_zips_1thread,
-
- read_f16_as_f16_uncompressed_1thread,
- read_f16_as_u32_uncompressed_1thread,
- read_f16_as_f32_uncompressed_1thread,
- read_f16_as_f32_zip_1thread,
- read_f16_as_f32_zip_nthreads,
- read_f16_as_f16_zip_nthreads,
- read_f16_as_f16_zip_1thread,
-);
-
-benchmark_main!(pixel_format_conversion); \ No newline at end of file
diff --git a/vendor/exr/benches/profiling.rs b/vendor/exr/benches/profiling.rs
deleted file mode 100644
index 1ae8c0d..0000000
--- a/vendor/exr/benches/profiling.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-#[macro_use]
-extern crate bencher;
-
-extern crate exr;
-use exr::prelude::*;
-
-use bencher::Bencher;
-use std::fs;
-use std::io::Cursor;
-use exr::image::pixel_vec::PixelVec;
-
-const PROFILING_REPETITIONS: i32 = 1; // make this 100 for profiling longer periods
-
-/// This is a suuuper long benchmark, to allow you to hook up a profiler while running it
-/// but this means we don't want it in our normal benchmarks
-fn read_single_image_from_buffer_rgba_f32_as_f16(bench: &mut Bencher) {
-
- let mut file = fs::read("tests/images/valid/custom/crowskull/crow_uncompressed.exr").unwrap();
- bencher::black_box(&mut file);
-
- bench.iter(||{
- for _ in 0 .. PROFILING_REPETITIONS {
- let image = exr::prelude::read()
- .no_deep_data().largest_resolution_level()
- .rgba_channels(PixelVec::<(f16,f16,f16,f16)>::constructor, PixelVec::set_pixel)
- .first_valid_layer().all_attributes()
- .non_parallel()
- .from_buffered(Cursor::new(file.as_slice())).unwrap();
-
- bencher::black_box(image);
- }
- })
-}
-
-benchmark_group!(profiling,
- read_single_image_from_buffer_rgba_f32_as_f16
-);
-
-benchmark_main!(profiling); \ No newline at end of file
diff --git a/vendor/exr/benches/read.rs b/vendor/exr/benches/read.rs
deleted file mode 100644
index 634f16e..0000000
--- a/vendor/exr/benches/read.rs
+++ /dev/null
@@ -1,172 +0,0 @@
-#[macro_use]
-extern crate bencher;
-
-extern crate exr;
-use exr::prelude::*;
-
-use bencher::Bencher;
-use std::fs;
-use std::io::Cursor;
-use exr::image::pixel_vec::PixelVec;
-
-/// Read uncompressed (always single core)
-fn read_single_image_uncompressed_non_parallel_rgba(bench: &mut Bencher) {
- let mut file = fs::read("tests/images/valid/custom/crowskull/crow_uncompressed.exr").unwrap();
- bench.iter(||{
- bencher::black_box(&mut file);
-
- let image = exr::prelude::read()
- .no_deep_data().largest_resolution_level()
- .rgba_channels(PixelVec::<(f32,f32,f32,f32)>::constructor, PixelVec::set_pixel)
- .all_layers().all_attributes()
- .non_parallel()
- .from_buffered(Cursor::new(file.as_slice())).unwrap();
-
- bencher::black_box(image);
- })
-}
-
-/// Read from in-memory in parallel
-fn read_single_image_uncompressed_rgba(bench: &mut Bencher) {
- let mut file = fs::read("tests/images/valid/custom/crowskull/crow_uncompressed.exr").unwrap();
-
- bench.iter(||{
- bencher::black_box(&mut file);
-
- let image = exr::prelude::read()
- .no_deep_data().largest_resolution_level()
- .rgba_channels(PixelVec::<(f32,f32,f32,f32)>::constructor, PixelVec::set_pixel)
- .all_layers().all_attributes()
- .from_buffered(Cursor::new(file.as_slice())).unwrap();
-
- bencher::black_box(image);
- })
-}
-
-/// Read with multi-core RLE decompression
-fn read_single_image_rle_all_channels(bench: &mut Bencher) {
- let mut file = fs::read("tests/images/valid/custom/crowskull/crow_rle.exr").unwrap();
-
- bench.iter(||{
- bencher::black_box(&mut file);
-
- let image = exr::prelude::read()
- .no_deep_data()
- .largest_resolution_level()
- .all_channels()
- .all_layers()
- .all_attributes()
- .from_buffered(Cursor::new(file.as_slice())).unwrap();
-
- bencher::black_box(image);
- })
-}
-
-/// Read without multi-core RLE decompression
-fn read_single_image_rle_non_parallel_all_channels(bench: &mut Bencher) {
- let mut file = fs::read("tests/images/valid/custom/crowskull/crow_rle.exr").unwrap();
-
- bench.iter(||{
- bencher::black_box(&mut file);
-
- // copied from `read_all_flat_layers_from_file` and added `.non_parallel()`
- let image = exr::prelude::read()
- .no_deep_data()
- .largest_resolution_level()
- .all_channels()
- .all_layers()
- .all_attributes()
- .non_parallel()
- .from_buffered(Cursor::new(file.as_slice())).unwrap();
-
- bencher::black_box(image);
- })
-}
-
-/// Read with multi-core RLE decompression
-fn read_single_image_rle_rgba(bench: &mut Bencher) {
- let mut file = fs::read("tests/images/valid/custom/crowskull/crow_rle.exr").unwrap();
-
- bench.iter(||{
- bencher::black_box(&mut file);
-
- let image = exr::prelude::read()
- .no_deep_data()
- .largest_resolution_level()
- .rgba_channels(PixelVec::<(f32,f32,f32,f32)>::constructor, PixelVec::set_pixel)
- .all_layers()
- .all_attributes()
- .from_buffered(Cursor::new(file.as_slice())).unwrap();
-
- bencher::black_box(image);
- })
-}
-
-/// Read without multi-core RLE decompression
-fn read_single_image_rle_non_parallel_rgba(bench: &mut Bencher) {
- let mut file = fs::read("tests/images/valid/custom/crowskull/crow_rle.exr").unwrap();
-
- bench.iter(||{
- bencher::black_box(&mut file);
-
- // copied from `read_all_flat_layers_from_file` and added `.non_parallel()`
- let image = exr::prelude::read()
- .no_deep_data()
- .largest_resolution_level()
- .rgba_channels(PixelVec::<(f32,f32,f32,f32)>::constructor, PixelVec::set_pixel)
- .all_layers()
- .all_attributes()
- .non_parallel()
- .from_buffered(Cursor::new(file.as_slice())).unwrap();
-
- bencher::black_box(image);
- })
-}
-
-/// Read with multi-core zip decompression
-fn read_single_image_zips_rgba(bench: &mut Bencher) {
- let mut file = fs::read("tests/images/valid/custom/crowskull/crow_zips.exr").unwrap();
-
- bench.iter(||{
- bencher::black_box(&mut file);
-
- let image = exr::prelude::read()
- .no_deep_data().largest_resolution_level()
- .rgba_channels(PixelVec::<(f32,f32,f32,f32)>::constructor, PixelVec::set_pixel)
- .all_layers().all_attributes()
- .from_buffered(Cursor::new(file.as_slice())).unwrap();
-
- bencher::black_box(image);
- })
-}
-
-/// Read without multi-core ZIP decompression
-fn read_single_image_zips_non_parallel_rgba(bench: &mut Bencher) {
- let mut file = fs::read("tests/images/valid/custom/crowskull/crow_zips.exr").unwrap();
-
- bench.iter(||{
- bencher::black_box(&mut file);
-
- let image = exr::prelude::read()
- .no_deep_data().largest_resolution_level()
- .rgba_channels(PixelVec::<(f32,f32,f32,f32)>::constructor, PixelVec::set_pixel)
- .all_layers().all_attributes()
- .non_parallel()
- .from_buffered(Cursor::new(file.as_slice())).unwrap();
-
- bencher::black_box(image);
- })
-}
-
-benchmark_group!(read,
- read_single_image_uncompressed_rgba,
- read_single_image_uncompressed_non_parallel_rgba,
- read_single_image_rle_rgba,
- read_single_image_rle_non_parallel_rgba,
- read_single_image_rle_all_channels,
- read_single_image_rle_non_parallel_all_channels,
- read_single_image_zips_rgba,
- read_single_image_zips_non_parallel_rgba,
-);
-
-benchmark_main!(read); \ No newline at end of file
diff --git a/vendor/exr/benches/write.rs b/vendor/exr/benches/write.rs
deleted file mode 100644
index 14331c5..0000000
--- a/vendor/exr/benches/write.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-#[macro_use]
-extern crate bencher;
-
-extern crate exr;
-use exr::prelude::*;
-
-use bencher::Bencher;
-use std::io::Cursor;
-
-fn write_parallel_any_channels_to_buffered(bench: &mut Bencher) {
- let path = "tests/images/valid/custom/crowskull/crow_rle.exr";
- let image = read_all_flat_layers_from_file(path).unwrap();
-
- bench.iter(||{
- let mut result = Vec::new();
- image.write().to_buffered(Cursor::new(&mut result)).unwrap();
- bencher::black_box(result);
- })
-}
-
-fn write_parallel_zip1_to_buffered(bench: &mut Bencher) {
- let path = "tests/images/valid/custom/crowskull/crow_rle.exr";
-
- let mut image = read_first_flat_layer_from_file(path).unwrap();
- image.layer_data.encoding.compression = Compression::ZIP1;
-
- bench.iter(||{
- let mut result = Vec::new();
- image.write().to_buffered(Cursor::new(&mut result)).unwrap();
- bencher::black_box(result);
- })
-}
-
-fn write_nonparallel_zip1_to_buffered(bench: &mut Bencher) {
- let path = "tests/images/valid/custom/crowskull/crow_rle.exr";
-
- let mut image = read_first_flat_layer_from_file(path).unwrap();
- image.layer_data.encoding.compression = Compression::ZIP1;
-
- bench.iter(||{
- let mut result = Vec::new();
- image.write().non_parallel().to_buffered(Cursor::new(&mut result)).unwrap();
- bencher::black_box(result);
- })
-}
-
-fn write_parallel_zip16_to_buffered(bench: &mut Bencher) {
- let path = "tests/images/valid/custom/crowskull/crow_rle.exr";
-
- let mut image = read_first_flat_layer_from_file(path).unwrap();
- image.layer_data.encoding.compression = Compression::ZIP16;
-
- bench.iter(||{
- let mut result = Vec::new();
- image.write().to_buffered(Cursor::new(&mut result)).unwrap();
- bencher::black_box(result);
- })
-}
-
-fn write_uncompressed_to_buffered(bench: &mut Bencher) {
- let path = "tests/images/valid/custom/crowskull/crow_uncompressed.exr";
- let image = read_all_flat_layers_from_file(path).unwrap();
- assert!(image.layer_data.iter().all(|layer| layer.encoding.compression == Compression::Uncompressed));
-
- bench.iter(||{
- let mut result = Vec::new();
- image.write().to_buffered(Cursor::new(&mut result)).unwrap();
- bencher::black_box(result);
- })
-}
-
-benchmark_group!(write,
- write_parallel_any_channels_to_buffered,
- write_nonparallel_zip1_to_buffered,
- write_parallel_zip1_to_buffered,
- write_parallel_zip16_to_buffered,
- write_uncompressed_to_buffered
-);
-
-benchmark_main!(write); \ No newline at end of file