From 8203988288dd93bd385dc7fc35ec785cbb0b6893 Mon Sep 17 00:00:00 2001 From: awxkee Date: Mon, 17 Jun 2024 23:38:25 +0100 Subject: [PATCH] LCh, bugfixes --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/app/src/main.rs | 8 +++++--- src/linear_to_image.rs | 10 +++++----- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2fc211f..b4fd4db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -163,7 +163,7 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorutils-rs" -version = "0.4.7" +version = "0.4.8" dependencies = [ "half", ] diff --git a/Cargo.toml b/Cargo.toml index 0423cce..2126626 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ workspace = { members = ["src/app"] } [package] name = "colorutils-rs" -version = "0.4.7" +version = "0.4.8" edition = "2021" description = "High performance utilities for color format handling and conversion." readme = "README.md" diff --git a/src/app/src/main.rs b/src/app/src/main.rs index 503b315..6275de5 100644 --- a/src/app/src/main.rs +++ b/src/app/src/main.rs @@ -23,7 +23,7 @@ fn main() { println!("HSL {:?}", hsl); println!("Back RGB {:?}", hsl.to_rgb8()); - let img = ImageReader::open("./assets/asset.jpg") + let img = ImageReader::open("./assets/beach_horizon.jpg") .unwrap() .decode() .unwrap(); @@ -58,13 +58,14 @@ fn main() { lab_store.resize(width as usize * components * height as usize, 0f32); let src_stride = width * components as u32; let start_time = Instant::now(); - rgb_to_lch( + rgb_to_linear( src_bytes, src_stride, &mut lab_store, store_stride as u32, width, height, + TransferFunction::Srgb, ); let elapsed_time = start_time.elapsed(); // Print the elapsed time in milliseconds @@ -92,13 +93,14 @@ fn main() { // } let start_time = Instant::now(); - lch_to_rgb( + linear_to_rgb( &lab_store, store_stride as u32, &mut dst_slice, src_stride, width, height, + TransferFunction::Srgb, ); let elapsed_time = start_time.elapsed(); diff --git a/src/linear_to_image.rs b/src/linear_to_image.rs index 3bbf498..59166c7 100644 --- a/src/linear_to_image.rs +++ b/src/linear_to_image.rs @@ -153,13 +153,13 @@ fn linear_to_gamma_channels