diff --git a/Cargo.lock b/Cargo.lock index 7ddebf7..adfb098 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -163,7 +163,7 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorutils-rs" -version = "0.2.8" +version = "0.2.9" dependencies = [ "half", ] diff --git a/Cargo.toml b/Cargo.toml index d0a1cc0..9cea439 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ workspace = { members = ["src/app"] } [package] name = "colorutils-rs" -version = "0.2.8" +version = "0.2.9" edition = "2021" description = "Hig performance utilities for color format handling and conversion." readme = "README.md" diff --git a/src/image_to_linear_u8.rs b/src/image_to_linear_u8.rs index 4615414..107d1d0 100644 --- a/src/image_to_linear_u8.rs +++ b/src/image_to_linear_u8.rs @@ -115,9 +115,9 @@ fn channels_to_linear( let rgb_f32 = rgb.to_rgb_f32(); unsafe { - let t_r = transfer(rgb_f32.r).min(255f32).max(0f32) as u8; - let t_g = transfer(rgb_f32.g).min(255f32).max(0f32) as u8; - let t_b = transfer(rgb_f32.b).min(255f32).max(0f32) as u8; + let t_r = (transfer(rgb_f32.r) * 255f32).min(255f32).max(0f32) as u8; + let t_g = (transfer(rgb_f32.g) * 255f32).min(255f32).max(0f32) as u8; + let t_b = (transfer(rgb_f32.b) * 255f32).min(255f32).max(0f32) as u8; *dst_slice.get_unchecked_mut(px) = t_r; *dst_slice.get_unchecked_mut(px + 1) = t_g; *dst_slice.get_unchecked_mut(px + 2) = t_b; diff --git a/src/linear_to_image_u8.rs b/src/linear_to_image_u8.rs index 1d87719..7757bf1 100644 --- a/src/linear_to_image_u8.rs +++ b/src/linear_to_image_u8.rs @@ -6,7 +6,7 @@ use crate::image::ImageConfiguration; any(target_arch = "aarch64", target_arch = "arm"), target_feature = "neon" ))] -use crate::neon_to_linear::get_neon_linear_transfer; +use crate::neon_linear_to_image::get_neon_gamma_transfer; #[cfg(all( any(target_arch = "aarch64", target_arch = "arm"), target_feature = "neon" @@ -14,9 +14,9 @@ use crate::neon_to_linear::get_neon_linear_transfer; use crate::neon_to_linear_u8::neon_image_linear_to_u8; #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] use crate::sse_image_to_linear_u8::sse_image_to_linear_unsigned; -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] -use crate::sse_to_linear::get_sse_linear_transfer; use crate::Rgb; +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +use crate::sse_linear_to_image::get_sse_gamma_transfer; #[inline] fn linear_to_gamma_channels( @@ -56,7 +56,7 @@ fn linear_to_gamma_channels